From: Cris Di Sclafani Date: Fri, 30 Oct 2020 11:33:47 +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%7B%7Blicense.messaging?a=commitdiff_plain;h=a5ee30eb1c84a9f8b886a88ec5d92b73cc6e6aa1;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 90c25bf..3681b29 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T11:24:55.058Z", "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 be87b84..687efc2 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 _0x7c2f=['TEXT','exports','VIRTUAL','getDataValue','action','STRING','motionbar','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)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0x7c2f,0x15f));var _0xf7c2=function(_0x26fdd6,_0x31726a){_0x26fdd6=_0x26fdd6-0x0;var _0x4224e5=_0x7c2f[_0x26fdd6];return _0x4224e5;};'use strict';var Sequelize=require('sequelize');module[_0xf7c2('0x0')]={'name':{'type':Sequelize[_0xf7c2('0x1')],'get':function(_0x522fb2){return this[_0xf7c2('0x2')](_0xf7c2('0x3'));}},'action':{'type':Sequelize[_0xf7c2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xf7c2('0x5'),'jscripty',_0xf7c2('0x6'),'browser',_0xf7c2('0x7'),_0xf7c2('0x8')]],'msg':_0xf7c2('0x9')}},'comment':_0xf7c2('0x9')},'data1':{'type':Sequelize[_0xf7c2('0x4')](0x1000),'comment':_0xf7c2('0xa')},'data2':{'type':Sequelize[_0xf7c2('0x4')](0x1000),'comment':_0xf7c2('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xf7c2('0xc')},'data4':{'type':Sequelize[_0xf7c2('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xf7c2('0x4')]},'data7':{'type':Sequelize[_0xf7c2('0xd')]}}; \ No newline at end of file +var _0xee40=['STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','TEXT','sequelize','VIRTUAL','getDataValue','action'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee40,0x128));var _0x0ee4=function(_0x4f4a8c,_0x50d8f7){_0x4f4a8c=_0x4f4a8c-0x0;var _0x19d21b=_0xee40[_0x4f4a8c];return _0x19d21b;};'use strict';var Sequelize=require(_0x0ee4('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ee4('0x1')],'get':function(_0x3e61d1){return this[_0x0ee4('0x2')](_0x0ee4('0x3'));}},'action':{'type':Sequelize[_0x0ee4('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0ee4('0x5'),_0x0ee4('0x6'),_0x0ee4('0x7'),_0x0ee4('0x8'),_0x0ee4('0x9'),_0x0ee4('0xa'),'bot',_0x0ee4('0xb')]],'msg':_0x0ee4('0xc')}},'comment':_0x0ee4('0xc')},'data1':{'type':Sequelize[_0x0ee4('0x4')](0x1000),'comment':_0x0ee4('0xd')},'data2':{'type':Sequelize[_0x0ee4('0x4')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x0ee4('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x0ee4('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x0ee4('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9ef2c6a..ef0a54c 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 _0x872d=['mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','send','update','body','Action','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x494965,_0x48ace5){var _0x3e682e=function(_0x463373){while(--_0x463373){_0x494965['push'](_0x494965['shift']());}};_0x3e682e(++_0x48ace5);}(_0x872d,0x17c));var _0xd872=function(_0x4f20b6,_0x178bf4){_0x4f20b6=_0x4f20b6-0x0;var _0x326e51=_0x872d[_0x4f20b6];return _0x326e51;};'use strict';var pdf=require(_0xd872('0x0'));var emlformat=require(_0xd872('0x1'));var rimraf=require(_0xd872('0x2'));var zipdir=require(_0xd872('0x3'));var jsonpatch=require(_0xd872('0x4'));var rp=require('request-promise');var moment=require(_0xd872('0x5'));var BPromise=require(_0xd872('0x6'));var Mustache=require(_0xd872('0x7'));var util=require(_0xd872('0x8'));var path=require(_0xd872('0x9'));var sox=require('sox');var csv=require(_0xd872('0xa'));var ejs=require(_0xd872('0xb'));var fs=require('fs');var _=require(_0xd872('0xc'));var squel=require(_0xd872('0xd'));var crypto=require('crypto');var jsforce=require(_0xd872('0xe'));var deskjs=require(_0xd872('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd872('0x10'));var Papa=require('papaparse');var Redis=require(_0xd872('0x11'));var authService=require(_0xd872('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd872('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd872('0x14'))(_0xd872('0x15'));var utils=require('../../config/utils');var config=require(_0xd872('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196d18,_0x361376){_0x361376=_0x361376||0xcc;return function(_0x3e9b28){if(_0x3e9b28){return _0x196d18[_0xd872('0x17')](_0x361376);}return _0x196d18[_0xd872('0x18')](_0x361376)['end']();};}function respondWithResult(_0x237322,_0x300054){_0x300054=_0x300054||0xc8;return function(_0x60e58c){if(_0x60e58c){return _0x237322[_0xd872('0x18')](_0x300054)[_0xd872('0x19')](_0x60e58c);}};}function respondWithFilteredResult(_0x454190,_0x3d118d){return function(_0x4816b5){if(_0x4816b5){var _0x16160d=_0x4816b5[_0xd872('0x1a')],_0x86b197=_0x3d118d[_0xd872('0x1b')],_0x1d3db9=_0x3d118d[_0xd872('0x1b')]+_0x3d118d[_0xd872('0x1c')],_0x45b6bb;if(_0x1d3db9>=_0x16160d){_0x1d3db9=_0x16160d;_0x45b6bb=0xc8;}else{_0x45b6bb=0xce;}_0x454190['status'](_0x45b6bb);return _0x454190[_0xd872('0x1d')]('Content-Range',_0x86b197+'-'+_0x1d3db9+'/'+_0x16160d)['json'](_0x4816b5);}return null;};}function patchUpdates(_0x1fce4c){return function(_0x36fc0a){try{jsonpatch[_0xd872('0x1e')](_0x36fc0a,_0x1fce4c,!![]);}catch(_0x4cf3){return BPromise[_0xd872('0x1f')](_0x4cf3);}return _0x36fc0a[_0xd872('0x20')]();};}function saveUpdates(_0x9609da,_0x8cbd99){return function(_0x50c479){if(_0x50c479){return _0x50c479['update'](_0x9609da)['then'](function(_0x5a0336){return _0x5a0336;});}return null;};}function removeEntity(_0x17f248,_0x42cbd8){return function(_0x304d38){if(_0x304d38){return _0x304d38['destroy']()[_0xd872('0x21')](function(){_0x17f248['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x399cfc,_0x2e504b){return function(_0x517bcb){if(!_0x517bcb){_0x399cfc[_0xd872('0x17')](0x194);}return _0x517bcb;};}function handleError(_0x2ed656,_0x19f4ef){_0x19f4ef=_0x19f4ef||0x1f4;return function(_0x21f109){logger[_0xd872('0x22')](_0x21f109[_0xd872('0x23')]);if(_0x21f109['name']){delete _0x21f109[_0xd872('0x24')];}_0x2ed656[_0xd872('0x18')](_0x19f4ef)[_0xd872('0x25')](_0x21f109);};}exports[_0xd872('0x26')]=function(_0x1dd82d,_0x4db204){if(_0x1dd82d[_0xd872('0x27')]['id']){delete _0x1dd82d[_0xd872('0x27')]['id'];}return db[_0xd872('0x28')][_0xd872('0x29')]({'where':{'id':_0x1dd82d['params']['id']}})[_0xd872('0x21')](handleEntityNotFound(_0x4db204,null))['then'](saveUpdates(_0x1dd82d[_0xd872('0x27')],null))['then'](respondWithResult(_0x4db204,null))['catch'](handleError(_0x4db204,null));};exports['destroy']=function(_0x528ac0,_0x3d60c3){return db[_0xd872('0x28')][_0xd872('0x29')]({'where':{'id':_0x528ac0[_0xd872('0x2a')]['id']}})[_0xd872('0x21')](handleEntityNotFound(_0x3d60c3,null))[_0xd872('0x21')](removeEntity(_0x3d60c3,null))['catch'](handleError(_0x3d60c3,null));}; \ No newline at end of file +var _0x1158=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','body','Action','find','params','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3e6c83,_0x595a7c){var _0x1159e2=function(_0x24b37d){while(--_0x24b37d){_0x3e6c83['push'](_0x3e6c83['shift']());}};_0x1159e2(++_0x595a7c);}(_0x1158,0xdf));var _0x8115=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x1158[_0x45783c];return _0x1161da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8115('0x0'));var jsonpatch=require(_0x8115('0x1'));var rp=require(_0x8115('0x2'));var moment=require(_0x8115('0x3'));var BPromise=require(_0x8115('0x4'));var Mustache=require(_0x8115('0x5'));var util=require('util');var path=require(_0x8115('0x6'));var sox=require(_0x8115('0x7'));var csv=require(_0x8115('0x8'));var ejs=require(_0x8115('0x9'));var fs=require('fs');var _=require(_0x8115('0xa'));var squel=require(_0x8115('0xb'));var crypto=require(_0x8115('0xc'));var jsforce=require(_0x8115('0xd'));var deskjs=require(_0x8115('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8115('0xf'));var Papa=require('papaparse');var Redis=require(_0x8115('0x10'));var authService=require(_0x8115('0x11'));var qs=require(_0x8115('0x12'));var as=require(_0x8115('0x13'));var hardwareService=require(_0x8115('0x14'));var logger=require(_0x8115('0x15'))(_0x8115('0x16'));var utils=require(_0x8115('0x17'));var config=require(_0x8115('0x18'));var db=require(_0x8115('0x19'))['db'];function respondWithStatusCode(_0x44b865,_0x4c62c8){_0x4c62c8=_0x4c62c8||0xcc;return function(_0xe7e20d){if(_0xe7e20d){return _0x44b865[_0x8115('0x1a')](_0x4c62c8);}return _0x44b865[_0x8115('0x1b')](_0x4c62c8)[_0x8115('0x1c')]();};}function respondWithResult(_0xb3dd14,_0x153609){_0x153609=_0x153609||0xc8;return function(_0x4928c2){if(_0x4928c2){return _0xb3dd14[_0x8115('0x1b')](_0x153609)[_0x8115('0x1d')](_0x4928c2);}};}function respondWithFilteredResult(_0x5b7da6,_0x32f077){return function(_0x34b9ff){if(_0x34b9ff){var _0x44a4c4=_0x34b9ff[_0x8115('0x1e')],_0x50e1da=_0x32f077[_0x8115('0x1f')],_0x2aa333=_0x32f077[_0x8115('0x1f')]+_0x32f077[_0x8115('0x20')],_0x44819e;if(_0x2aa333>=_0x44a4c4){_0x2aa333=_0x44a4c4;_0x44819e=0xc8;}else{_0x44819e=0xce;}_0x5b7da6[_0x8115('0x1b')](_0x44819e);return _0x5b7da6['set'](_0x8115('0x21'),_0x50e1da+'-'+_0x2aa333+'/'+_0x44a4c4)[_0x8115('0x1d')](_0x34b9ff);}return null;};}function patchUpdates(_0x338f59){return function(_0x242747){try{jsonpatch[_0x8115('0x22')](_0x242747,_0x338f59,!![]);}catch(_0x75181d){return BPromise['reject'](_0x75181d);}return _0x242747[_0x8115('0x23')]();};}function saveUpdates(_0x17a88b,_0x584019){return function(_0xa53a1f){if(_0xa53a1f){return _0xa53a1f[_0x8115('0x24')](_0x17a88b)[_0x8115('0x25')](function(_0x223e7e){return _0x223e7e;});}return null;};}function removeEntity(_0x19abdf,_0x551d28){return function(_0x5325db){if(_0x5325db){return _0x5325db[_0x8115('0x26')]()[_0x8115('0x25')](function(){_0x19abdf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b84c,_0xf7cbbb){return function(_0x2a2974){if(!_0x2a2974){_0x11b84c[_0x8115('0x1a')](0x194);}return _0x2a2974;};}function handleError(_0x4a4e7b,_0x1758af){_0x1758af=_0x1758af||0x1f4;return function(_0x5685c8){logger[_0x8115('0x27')](_0x5685c8[_0x8115('0x28')]);if(_0x5685c8[_0x8115('0x29')]){delete _0x5685c8[_0x8115('0x29')];}_0x4a4e7b[_0x8115('0x1b')](_0x1758af)['send'](_0x5685c8);};}exports[_0x8115('0x24')]=function(_0x36a507,_0x5f2c5c){if(_0x36a507[_0x8115('0x2a')]['id']){delete _0x36a507[_0x8115('0x2a')]['id'];}return db[_0x8115('0x2b')][_0x8115('0x2c')]({'where':{'id':_0x36a507[_0x8115('0x2d')]['id']}})[_0x8115('0x25')](handleEntityNotFound(_0x5f2c5c,null))[_0x8115('0x25')](saveUpdates(_0x36a507[_0x8115('0x2a')],null))[_0x8115('0x25')](respondWithResult(_0x5f2c5c,null))[_0x8115('0x2e')](handleError(_0x5f2c5c,null));};exports[_0x8115('0x26')]=function(_0x282abd,_0x4fa18a){return db[_0x8115('0x2b')][_0x8115('0x2c')]({'where':{'id':_0x282abd[_0x8115('0x2d')]['id']}})[_0x8115('0x25')](handleEntityNotFound(_0x4fa18a,null))[_0x8115('0x25')](removeEntity(_0x4fa18a,null))['catch'](handleError(_0x4fa18a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 09350ad..0839d22 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 _0xcd1a=['moment','request-promise','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0xcd1a,0x76));var _0xacd1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcd1a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xacd1('0x0'));var util=require('util');var logger=require(_0xacd1('0x1'))(_0xacd1('0x2'));var moment=require(_0xacd1('0x3'));var BPromise=require('bluebird');var rp=require(_0xacd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xacd1('0x5'));var config=require(_0xacd1('0x6'));var attributes=require(_0xacd1('0x7'));module[_0xacd1('0x8')]=function(_0x54fd3,_0xc622fd){return _0x54fd3['define'](_0xacd1('0x9'),attributes,{'tableName':_0xacd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cad=['path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x530cb9,_0x54380a){var _0x28f667=function(_0x237006){while(--_0x237006){_0x530cb9['push'](_0x530cb9['shift']());}};_0x28f667(++_0x54380a);}(_0x5cad,0x166));var _0xd5ca=function(_0x4b869a,_0x1f993d){_0x4b869a=_0x4b869a-0x0;var _0x10d713=_0x5cad[_0x4b869a];return _0x10d713;};'use strict';var _=require('lodash');var util=require(_0xd5ca('0x0'));var logger=require(_0xd5ca('0x1'))(_0xd5ca('0x2'));var moment=require(_0xd5ca('0x3'));var BPromise=require(_0xd5ca('0x4'));var rp=require(_0xd5ca('0x5'));var fs=require('fs');var path=require(_0xd5ca('0x6'));var rimraf=require(_0xd5ca('0x7'));var config=require(_0xd5ca('0x8'));var attributes=require(_0xd5ca('0x9'));module[_0xd5ca('0xa')]=function(_0x38dd7b,_0x1aec16){return _0x38dd7b[_0xd5ca('0xb')]('Action',attributes,{'tableName':_0xd5ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5cc8c0c..5ecba93 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(_0x3f5927,_0x23d04b){var _0x33b391=function(_0x3e2907){while(--_0x3e2907){_0x3f5927['push'](_0x3f5927['shift']());}};_0x33b391(++_0x23d04b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4e9015,_0x2eb6ff){var _0x289dc3=function(_0xcae84d){while(--_0xcae84d){_0x4e9015['push'](_0x4e9015['shift']());}};_0x289dc3(++_0x2eb6ff);}(_0x70e0,0x17b));var _0x070e=function(_0x3d60ca,_0x58a3bd){_0x3d60ca=_0x3d60ca-0x0;var _0x103bc4=_0x70e0[_0x3d60ca];return _0x103bc4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f88058f..6fedab1 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 _0xd686=['destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','update','delete','isAuthenticated'];(function(_0x5f59b9,_0x6aa001){var _0x3d6991=function(_0xc5b398){while(--_0xc5b398){_0x5f59b9['push'](_0x5f59b9['shift']());}};_0x3d6991(++_0x6aa001);}(_0xd686,0x92));var _0x6d68=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xd686[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require('multer');var util=require(_0x6d68('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d68('0x1')]();var auth=require(_0x6d68('0x2'));var interaction=require(_0x6d68('0x3'));var config=require(_0x6d68('0x4'));var controller=require(_0x6d68('0x5'));router['put'](_0x6d68('0x6'),auth['isAuthenticated'](),controller[_0x6d68('0x7')]);router[_0x6d68('0x8')](_0x6d68('0x6'),auth[_0x6d68('0x9')](),controller[_0x6d68('0xa')]);module[_0x6d68('0xb')]=router; \ No newline at end of file +var _0x6bf9=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./action.controller','isAuthenticated','update','exports','multer','util','path'];(function(_0x2f6559,_0x5d94e9){var _0x56b523=function(_0x3c4807){while(--_0x3c4807){_0x2f6559['push'](_0x2f6559['shift']());}};_0x56b523(++_0x5d94e9);}(_0x6bf9,0x14d));var _0x96bf=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x6bf9[_0x29632e];return _0x426e04;};'use strict';var multer=require(_0x96bf('0x0'));var util=require(_0x96bf('0x1'));var path=require(_0x96bf('0x2'));var timeout=require(_0x96bf('0x3'));var express=require(_0x96bf('0x4'));var router=express[_0x96bf('0x5')]();var auth=require(_0x96bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96bf('0x7'));var controller=require(_0x96bf('0x8'));router['put']('/:id',auth[_0x96bf('0x9')](),controller[_0x96bf('0xa')]);router['delete']('/:id',auth[_0x96bf('0x9')](),controller['destroy']);module[_0x96bf('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c59978f..d88c028 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 _0x7f0e=['TEXT','sequelize','STRING'];(function(_0x2258fd,_0x57b189){var _0x1295ab=function(_0x27be15){while(--_0x27be15){_0x2258fd['push'](_0x2258fd['shift']());}};_0x1295ab(++_0x57b189);}(_0x7f0e,0x85));var _0xe7f0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7f0e[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xe7f0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7f0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe7f0('0x1')]},'parent':{'type':Sequelize[_0xe7f0('0x1')]},'table':{'type':Sequelize[_0xe7f0('0x1')]},'conditions':{'type':Sequelize[_0xe7f0('0x2')]},'joins':{'type':Sequelize[_0xe7f0('0x2')]}}; \ No newline at end of file +var _0xec99=['TEXT','sequelize','exports','STRING'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xec99,0xd5));var _0x9ec9=function(_0x4660e1,_0x1d863f){_0x4660e1=_0x4660e1-0x0;var _0x4b46a6=_0xec99[_0x4660e1];return _0x4b46a6;};'use strict';var Sequelize=require(_0x9ec9('0x0'));module[_0x9ec9('0x1')]={'name':{'type':Sequelize[_0x9ec9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9ec9('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x9ec9('0x2')]},'conditions':{'type':Sequelize[_0x9ec9('0x3')]},'joins':{'type':Sequelize[_0x9ec9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b0b527f..8eba28d 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 _0x2209=['api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','Reports','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','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','order','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','SELECT','MIN(%s)','UNIX_TIMESTAMP(%s)','alias','clone','limit','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','runReport','orderBy','Limited\x20Query:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x124851,_0x404f63){var _0x3ddc11=function(_0x2b1294){while(--_0x2b1294){_0x124851['push'](_0x124851['shift']());}};_0x3ddc11(++_0x404f63);}(_0x2209,0x95));var _0x9220=function(_0x1db8b4,_0x18aa52){_0x1db8b4=_0x1db8b4-0x0;var _0xaafd23=_0x2209[_0x1db8b4];return _0xaafd23;};'use strict';var pdf=require(_0x9220('0x0'));var emlformat=require(_0x9220('0x1'));var rimraf=require(_0x9220('0x2'));var zipdir=require(_0x9220('0x3'));var jsonpatch=require(_0x9220('0x4'));var rp=require('request-promise');var moment=require(_0x9220('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9220('0x6'));var util=require(_0x9220('0x7'));var path=require(_0x9220('0x8'));var sox=require(_0x9220('0x9'));var csv=require(_0x9220('0xa'));var ejs=require(_0x9220('0xb'));var fs=require('fs');var _=require(_0x9220('0xc'));var squel=require(_0x9220('0xd'));var crypto=require(_0x9220('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9220('0xf'));var toCsv=require(_0x9220('0xa'));var querystring=require('querystring');var Papa=require(_0x9220('0x10'));var Redis=require(_0x9220('0x11'));var authService=require(_0x9220('0x12'));var qs=require(_0x9220('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9220('0x14'));var logger=require(_0x9220('0x15'))(_0x9220('0x16'));var utils=require(_0x9220('0x17'));var config=require(_0x9220('0x18'));var db=require(_0x9220('0x19'))['db'];var dbH=require(_0x9220('0x19'))[_0x9220('0x1a')];function respondWithStatusCode(_0x4c58e9,_0x2cbe2a){_0x2cbe2a=_0x2cbe2a||0xcc;return function(_0x50bcc8){if(_0x50bcc8){return _0x4c58e9[_0x9220('0x1b')](_0x2cbe2a);}return _0x4c58e9['status'](_0x2cbe2a)[_0x9220('0x1c')]();};}function respondWithResult(_0x4d8bf1,_0xa13cd){_0xa13cd=_0xa13cd||0xc8;return function(_0x45506f){if(_0x45506f){return _0x4d8bf1[_0x9220('0x1d')](_0xa13cd)[_0x9220('0x1e')](_0x45506f);}};}function respondWithFilteredResult(_0x493744,_0x3fe2c1){return function(_0x1f484b){if(_0x1f484b){var _0x4898c5=_0x1f484b[_0x9220('0x1f')],_0x577bd8=_0x3fe2c1[_0x9220('0x20')],_0x3c3473=_0x3fe2c1[_0x9220('0x20')]+_0x3fe2c1['limit'],_0x559581;if(_0x3c3473>=_0x4898c5){_0x3c3473=_0x4898c5;_0x559581=0xc8;}else{_0x559581=0xce;}_0x493744[_0x9220('0x1d')](_0x559581);return _0x493744[_0x9220('0x21')]('Content-Range',_0x577bd8+'-'+_0x3c3473+'/'+_0x4898c5)[_0x9220('0x1e')](_0x1f484b);}return null;};}function patchUpdates(_0x558c28){return function(_0x4e37e0){try{jsonpatch[_0x9220('0x22')](_0x4e37e0,_0x558c28,!![]);}catch(_0x10a8f2){return BPromise[_0x9220('0x23')](_0x10a8f2);}return _0x4e37e0[_0x9220('0x24')]();};}function saveUpdates(_0x2ded94,_0x27f242){return function(_0x3c13b1){if(_0x3c13b1){return _0x3c13b1[_0x9220('0x25')](_0x2ded94)[_0x9220('0x26')](function(_0x9d19fe){return _0x9d19fe;});}return null;};}function removeEntity(_0x462798,_0x2eb9f3){return function(_0x1e1135){if(_0x1e1135){return _0x1e1135['destroy']()[_0x9220('0x26')](function(){var _0x379c1f=_0x1e1135[_0x9220('0x27')]({'plain':!![]});var _0xfde27f='CustomReports';return db[_0x9220('0x28')][_0x9220('0x29')]({'where':{'type':_0xfde27f,'resourceId':_0x379c1f['id']}})[_0x9220('0x26')](function(){return _0x1e1135;});})[_0x9220('0x26')](function(){_0x462798[_0x9220('0x1d')](0xcc)[_0x9220('0x1c')]();});}};}function handleEntityNotFound(_0x5902d2,_0x959dc0){return function(_0x3ca360){if(!_0x3ca360){_0x5902d2[_0x9220('0x1b')](0x194);}return _0x3ca360;};}function handleError(_0x2d7a91,_0x5594c8){_0x5594c8=_0x5594c8||0x1f4;return function(_0x5e6918){logger[_0x9220('0x2a')](_0x5e6918[_0x9220('0x2b')]);if(_0x5e6918[_0x9220('0x2c')]){delete _0x5e6918['name'];}_0x2d7a91['status'](_0x5594c8)[_0x9220('0x2d')](_0x5e6918);};}exports[_0x9220('0x2e')]=function(_0x51cf57,_0x44dffb){var _0x2e4f81={},_0x608ed4={},_0x50f431={'count':0x0,'rows':[]};var _0x18bb7d=_[_0x9220('0x2f')](db[_0x9220('0x30')][_0x9220('0x31')],function(_0x14fee4){return{'name':_0x14fee4[_0x9220('0x32')],'type':_0x14fee4[_0x9220('0x33')][_0x9220('0x34')]};});_0x608ed4[_0x9220('0x35')]=_[_0x9220('0x2f')](_0x18bb7d,'name');_0x608ed4[_0x9220('0x36')]=_[_0x9220('0x37')](_0x51cf57['query']);_0x608ed4['filters']=_[_0x9220('0x38')](_0x608ed4['model'],_0x608ed4[_0x9220('0x36')]);_0x2e4f81[_0x9220('0x39')]=_[_0x9220('0x38')](_0x608ed4[_0x9220('0x35')],qs[_0x9220('0x3a')](_0x51cf57[_0x9220('0x36')]['fields']));_0x2e4f81[_0x9220('0x39')]=_0x2e4f81[_0x9220('0x39')][_0x9220('0x3b')]?_0x2e4f81[_0x9220('0x39')]:_0x608ed4[_0x9220('0x35')];if(!_0x51cf57[_0x9220('0x36')][_0x9220('0x3c')]('nolimit')){_0x2e4f81['limit']=qs['limit'](_0x51cf57[_0x9220('0x36')]['limit']);_0x2e4f81[_0x9220('0x20')]=qs[_0x9220('0x20')](_0x51cf57[_0x9220('0x36')][_0x9220('0x20')]);}_0x2e4f81['order']=qs[_0x9220('0x3d')](_0x51cf57[_0x9220('0x36')][_0x9220('0x3d')]);_0x2e4f81[_0x9220('0x3e')]=qs[_0x9220('0x3f')](_[_0x9220('0x40')](_0x51cf57[_0x9220('0x36')],_0x608ed4[_0x9220('0x3f')]),_0x18bb7d);if(_0x51cf57['query']['filter']){_0x2e4f81[_0x9220('0x3e')]=_[_0x9220('0x41')](_0x2e4f81[_0x9220('0x3e')],{'$or':_[_0x9220('0x2f')](_0x18bb7d,function(_0x1d94fe){if(_0x1d94fe['type']!=='VIRTUAL'){var _0x28064b={};_0x28064b[_0x1d94fe[_0x9220('0x2c')]]={'$like':'%'+_0x51cf57[_0x9220('0x36')][_0x9220('0x42')]+'%'};return _0x28064b;}})});}_0x2e4f81=_[_0x9220('0x41')]({},_0x2e4f81,_0x51cf57[_0x9220('0x43')]);var _0x262018={'where':_0x2e4f81[_0x9220('0x3e')]};return db[_0x9220('0x30')]['count'](_0x262018)[_0x9220('0x26')](function(_0x3d3410){_0x50f431[_0x9220('0x1f')]=_0x3d3410;if(_0x51cf57['query'][_0x9220('0x44')]){_0x2e4f81[_0x9220('0x45')]=[{'all':!![]}];}return db[_0x9220('0x30')][_0x9220('0x46')](_0x2e4f81);})[_0x9220('0x26')](function(_0x5d0683){_0x50f431[_0x9220('0x47')]=_0x5d0683;return _0x50f431;})[_0x9220('0x26')](respondWithFilteredResult(_0x44dffb,_0x2e4f81))[_0x9220('0x48')](handleError(_0x44dffb,null));};exports[_0x9220('0x49')]=function(_0x1e8170,_0x12c6ae){var _0xaf4963={'raw':![],'where':{'id':_0x1e8170['params']['id']}},_0x273d3f={};_0x273d3f[_0x9220('0x35')]=_[_0x9220('0x37')](db['AnalyticCustomReport'][_0x9220('0x31')]);_0x273d3f[_0x9220('0x36')]=_[_0x9220('0x37')](_0x1e8170['query']);_0x273d3f[_0x9220('0x3f')]=_['intersection'](_0x273d3f[_0x9220('0x35')],_0x273d3f[_0x9220('0x36')]);_0xaf4963[_0x9220('0x39')]=_[_0x9220('0x38')](_0x273d3f[_0x9220('0x35')],qs[_0x9220('0x3a')](_0x1e8170[_0x9220('0x36')][_0x9220('0x3a')]));_0xaf4963[_0x9220('0x39')]=_0xaf4963['attributes'][_0x9220('0x3b')]?_0xaf4963[_0x9220('0x39')]:_0x273d3f[_0x9220('0x35')];if(_0x1e8170[_0x9220('0x36')][_0x9220('0x44')]){_0xaf4963[_0x9220('0x45')]=[{'all':!![]}];}_0xaf4963=_['merge']({},_0xaf4963,_0x1e8170[_0x9220('0x43')]);return db[_0x9220('0x30')][_0x9220('0x4a')](_0xaf4963)[_0x9220('0x26')](handleEntityNotFound(_0x12c6ae,null))[_0x9220('0x26')](respondWithResult(_0x12c6ae,null))[_0x9220('0x48')](handleError(_0x12c6ae,null));};exports[_0x9220('0x4b')]=function(_0x2ee52c,_0xb6a97b){return db[_0x9220('0x30')][_0x9220('0x4b')](_0x2ee52c[_0x9220('0x4c')],{})[_0x9220('0x26')](function(_0x26f07b){var _0x4dc5ec=_0x2ee52c[_0x9220('0x4d')][_0x9220('0x27')]({'plain':!![]});if(!_0x4dc5ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dc5ec[_0x9220('0x4e')]===_0x9220('0x4d')){var _0x19bd37=_0x26f07b[_0x9220('0x27')]({'plain':!![]});var _0x58d3c5=_0x9220('0x4f');return db['UserProfileSection'][_0x9220('0x4a')]({'where':{'name':_0x58d3c5,'userProfileId':_0x4dc5ec[_0x9220('0x50')]},'raw':!![]})[_0x9220('0x26')](function(_0x3ffa7a){if(_0x3ffa7a&&_0x3ffa7a[_0x9220('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x19bd37[_0x9220('0x2c')],'resourceId':_0x19bd37['id'],'type':_0x9220('0x52'),'sectionId':_0x3ffa7a['id']},{})['then'](function(){return _0x26f07b;});}else{return _0x26f07b;}})[_0x9220('0x48')](function(_0x5c9d33){logger['error'](_0x9220('0x53'),_0x5c9d33);throw _0x5c9d33;});}return _0x26f07b;})['then'](respondWithResult(_0xb6a97b,0xc9))[_0x9220('0x48')](handleError(_0xb6a97b,null));};exports[_0x9220('0x25')]=function(_0x28849c,_0x1bd1c1){if(_0x28849c['body']['id']){delete _0x28849c[_0x9220('0x4c')]['id'];}return db[_0x9220('0x30')]['find']({'where':{'id':_0x28849c[_0x9220('0x54')]['id']}})['then'](handleEntityNotFound(_0x1bd1c1,null))['then'](saveUpdates(_0x28849c['body'],null))[_0x9220('0x26')](respondWithResult(_0x1bd1c1,null))[_0x9220('0x48')](handleError(_0x1bd1c1,null));};exports[_0x9220('0x29')]=function(_0x3d342c,_0x291be5){return db['AnalyticCustomReport']['find']({'where':{'id':_0x3d342c['params']['id']}})[_0x9220('0x26')](handleEntityNotFound(_0x291be5,null))[_0x9220('0x26')](removeEntity(_0x291be5,null))[_0x9220('0x48')](handleError(_0x291be5,null));};exports[_0x9220('0x55')]=function(_0x53b624,_0x3469fe){var _0x389837=0xa;var _0x1d92ca=[_0x9220('0x56'),_0x9220('0x57'),_0x9220('0x58'),_0x9220('0x59')];var _0x54c672={'SUM':_0x9220('0x5a'),'COUNT':_0x9220('0x5b'),'COUNT DISTINCT':_0x9220('0x5c'),'MAX':_0x9220('0x5d'),'MIN':'MIN(%s)','AVG':_0x9220('0x5e'),'GROUP_CONCAT':_0x9220('0x5f'),'GROUP_CONCAT ASC':_0x9220('0x60'),'GROUP_CONCAT DESC':_0x9220('0x61')};var _0x401817={'SEC_TO_TIME':_0x9220('0x62'),'DATE':_0x9220('0x63'),'HOUR':_0x9220('0x64'),'ROUND':_0x9220('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x22d03d=function(_0x54e219){return!_[_0x9220('0x66')]([_0x9220('0x67'),_0x9220('0x68'),_0x9220('0x69'),_0x9220('0x6a')],_0x54e219);};var _0x2b74e4=function(_0x262c18){if(!_0x262c18||!_0x262c18[_0x9220('0x6b')][_0x9220('0x3b')]){return'';}for(var _0x581dfe='(',_0x36b5d6=0x0;_0x36b5d6<_0x262c18[_0x9220('0x6b')][_0x9220('0x3b')];_0x36b5d6+=0x1){_0x36b5d6>0x0&&(_0x581dfe+='\x20'+_0x262c18[_0x9220('0x6c')]+'\x20');_0x581dfe+=_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6d')]?_0x2b74e4(_0x262c18['rules'][_0x36b5d6][_0x9220('0x6d')]):_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6e')]+'\x20'+_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6f')]+(_0x22d03d(_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x6f')])?'\x20'+_0x262c18[_0x9220('0x6b')][_0x36b5d6][_0x9220('0x70')]:'');}return _0x581dfe+')';};var _0x493e45={'where':{'id':_0x53b624[_0x9220('0x54')]['id']}},_0x3f3599,_0x66d981,_0x9561ab,_0x265416,_0x357c4a;_0x493e45=_[_0x9220('0x41')]({},_0x493e45,_0x53b624[_0x9220('0x43')]);return db[_0x9220('0x30')][_0x9220('0x4a')](_0x493e45)[_0x9220('0x26')](function(_0x55f50d){if(_0x55f50d){_0x3f3599=_0x55f50d;return _0x55f50d[_0x9220('0x71')]();}return null;})[_0x9220('0x26')](function(_0x3d261e){if(_0x3d261e){if(!_0x3d261e['length']){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x74'),0x193);}_0x66d981=_0x3d261e;return db[_0x9220('0x75')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x468a87){if(_0x468a87){_0x9561ab=_[_0x9220('0x76')](_0x468a87,'id');var _0x562324;var _0x25d5c6=squel[_0x9220('0x77')]();_0x25d5c6[_0x9220('0x78')](_0x3f3599[_0x9220('0x79')]);for(var _0x47309a=0x0;_0x47309a<_0x66d981[_0x9220('0x3b')];_0x47309a+=0x1){_0x562324=_0x66d981[_0x47309a][_0x9220('0x7a')]?_0x9561ab[_0x66d981[_0x47309a][_0x9220('0x7a')]][_0x9220('0x7b')]:_0x66d981[_0x47309a][_0x9220('0x6e')];_0x562324=_0x66d981[_0x47309a][_0x9220('0x7c')]?_[_0x9220('0x7d')](_0x54c672[_0x66d981[_0x47309a]['function']],'%s',_0x562324):_0x562324;_0x562324=_0x66d981[_0x47309a]['format']?_[_0x9220('0x7d')](_0x401817[_0x66d981[_0x47309a][_0x9220('0x7e')]],'%s',_0x562324):_0x562324;if(_0x66d981[_0x47309a][_0x9220('0x7f')]){_0x25d5c6[_0x9220('0x6d')](_0x562324);}_0x66d981[_0x47309a]['orderBy']&&_0x25d5c6[_0x9220('0x80')](_0x562324,_0x66d981[_0x47309a]['orderBy']===_0x9220('0x81')?![]:!![]);_0x25d5c6[_0x9220('0x6e')](_0x562324,_0x66d981[_0x47309a]['alias']||_0x562324);}if(_0x3f3599[_0x9220('0x82')]){_0x3f3599[_0x9220('0x82')]=JSON[_0x9220('0x83')](_0x3f3599[_0x9220('0x82')]);for(var _0x5b3579=0x0;_0x5b3579<_0x3f3599[_0x9220('0x82')][_0x9220('0x3b')];_0x5b3579+=0x1){if(_0x3f3599['joins'][_0x5b3579]['type']&&_[_0x9220('0x66')](_0x1d92ca,_0x3f3599[_0x9220('0x82')][_0x5b3579]['type'])&&_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x84')]&&_0x3f3599['joins'][_0x5b3579][_0x9220('0x85')]&&_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x86')]){_0x25d5c6[_0x3f3599[_0x9220('0x82')][_0x5b3579]['type']](_0x3f3599['joins'][_0x5b3579][_0x9220('0x85')],null,util[_0x9220('0x7e')](_0x9220('0x87'),_0x3f3599['table'],_0x3f3599[_0x9220('0x82')][_0x5b3579]['parentKey'],_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x85')],_0x3f3599[_0x9220('0x82')][_0x5b3579][_0x9220('0x86')]));}}}if(_0x3f3599['conditions']){_0x3f3599['conditions']=JSON[_0x9220('0x83')](_0x3f3599['conditions']);_0x25d5c6[_0x9220('0x3e')](_0x2b74e4(_0x3f3599[_0x9220('0x88')][_0x9220('0x6d')]));}_0x357c4a=_0x25d5c6['clone']();_0x25d5c6['limit'](_0x389837);_0x25d5c6[_0x9220('0x20')](0x0);logger[_0x9220('0x89')]('Limited\x20Query:',_0x25d5c6['toString']());return db['sequelize'][_0x9220('0x36')](_0x25d5c6[_0x9220('0x8a')](),{'type':db[_0x9220('0x8b')][_0x9220('0x8c')][_0x9220('0x8d')]});}})[_0x9220('0x26')](respondWithResult(_0x3469fe,null))[_0x9220('0x48')](handleError(_0x3469fe,null));};function runReport(_0x3ccf19,_0x2beccf,_0x20a351){var _0x4e5b95=_0x2beccf[_0x9220('0x2c')];var _0x255c90=0xa;var _0x525f77=[_0x9220('0x56'),_0x9220('0x57'),_0x9220('0x58'),_0x9220('0x59')];var _0x2e8a01={'SUM':_0x9220('0x5a'),'COUNT':_0x9220('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9220('0x5d'),'MIN':_0x9220('0x8e'),'AVG':_0x9220('0x5e'),'GROUP_CONCAT':_0x9220('0x5f'),'GROUP_CONCAT ASC':_0x9220('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x408f67={'SEC_TO_TIME':_0x9220('0x62'),'DATE':_0x9220('0x63'),'HOUR':_0x9220('0x64'),'ROUND':_0x9220('0x65'),'UNIX_TIMESTAMP':_0x9220('0x8f')};var _0x4b0155=function(_0x5ab05a){return!_['includes']([_0x9220('0x67'),_0x9220('0x68'),_0x9220('0x69'),_0x9220('0x6a')],_0x5ab05a);};var _0x34c56f=function(_0x53d701){if(!_0x53d701||!_0x53d701[_0x9220('0x6b')][_0x9220('0x3b')]){return'';}for(var _0x1a9a93='(',_0xc60c45=0x0;_0xc60c45<_0x53d701['rules'][_0x9220('0x3b')];_0xc60c45+=0x1){_0xc60c45>0x0&&(_0x1a9a93+='\x20'+_0x53d701[_0x9220('0x6c')]+'\x20');_0x1a9a93+=_0x53d701[_0x9220('0x6b')][_0xc60c45][_0x9220('0x6d')]?_0x34c56f(_0x53d701['rules'][_0xc60c45]['group']):_0x53d701['rules'][_0xc60c45][_0x9220('0x6e')]+'\x20'+_0x53d701[_0x9220('0x6b')][_0xc60c45]['condition']+(_0x4b0155(_0x53d701[_0x9220('0x6b')][_0xc60c45][_0x9220('0x6f')])?'\x20'+_0x53d701[_0x9220('0x6b')][_0xc60c45]['value']:'');}return _0x1a9a93+')';};var _0x3d67b1={'where':{'id':_0x3ccf19['id']}},_0x583705,_0x4d846c,_0x171e1c,_0x2b3ce1,_0x4d2be3;_0x3d67b1=_[_0x9220('0x41')]({},_0x3d67b1,_0x20a351);return db['AnalyticCustomReport'][_0x9220('0x4a')](_0x3d67b1)[_0x9220('0x26')](function(_0x197fc0){if(_0x197fc0){_0x583705=_0x197fc0;return _0x197fc0[_0x9220('0x71')]();}return null;})[_0x9220('0x26')](function(_0x496a88){if(_0x496a88){if(!_0x496a88[_0x9220('0x3b')]){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x74'),0x193);}_0x4d846c=_0x496a88;return db[_0x9220('0x75')][_0x9220('0x46')]({'raw':!![]});}return null;})[_0x9220('0x26')](function(_0x43c85d){if(_0x43c85d){_0x171e1c=_['keyBy'](_0x43c85d,'id');var _0x37fcc4;var _0x4ba0c2=squel[_0x9220('0x77')]();_0x4ba0c2['from'](_0x583705[_0x9220('0x79')]);for(var _0x1f6c72=0x0;_0x1f6c72<_0x4d846c['length'];_0x1f6c72+=0x1){_0x37fcc4=_0x4d846c[_0x1f6c72][_0x9220('0x7a')]?_0x171e1c[_0x4d846c[_0x1f6c72][_0x9220('0x7a')]][_0x9220('0x7b')]:_0x4d846c[_0x1f6c72][_0x9220('0x6e')];_0x37fcc4=_0x4d846c[_0x1f6c72][_0x9220('0x7c')]?_[_0x9220('0x7d')](_0x2e8a01[_0x4d846c[_0x1f6c72]['function']],'%s',_0x37fcc4):_0x37fcc4;_0x37fcc4=_0x4d846c[_0x1f6c72][_0x9220('0x7e')]?_[_0x9220('0x7d')](_0x408f67[_0x4d846c[_0x1f6c72][_0x9220('0x7e')]],'%s',_0x37fcc4):_0x37fcc4;if(_0x4d846c[_0x1f6c72][_0x9220('0x7f')]){_0x4ba0c2['group'](_0x37fcc4);}_0x4d846c[_0x1f6c72]['orderBy']&&_0x4ba0c2[_0x9220('0x80')](_0x37fcc4,_0x4d846c[_0x1f6c72]['orderBy']===_0x9220('0x81')?![]:!![]);_0x4ba0c2['field'](_0x37fcc4,_0x4d846c[_0x1f6c72][_0x9220('0x90')]||_0x37fcc4);}if(_0x583705[_0x9220('0x82')]){_0x583705[_0x9220('0x82')]=JSON[_0x9220('0x83')](_0x583705[_0x9220('0x82')]);for(var _0x54df43=0x0;_0x54df43<_0x583705[_0x9220('0x82')][_0x9220('0x3b')];_0x54df43+=0x1){if(_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x33')]&&_[_0x9220('0x66')](_0x525f77,_0x583705[_0x9220('0x82')][_0x54df43]['type'])&&_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x84')]&&_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x85')]&&_0x583705['joins'][_0x54df43]['foreignKey']){_0x4ba0c2[_0x583705[_0x9220('0x82')][_0x54df43]['type']](_0x583705['joins'][_0x54df43]['foreignTable'],null,util[_0x9220('0x7e')]('%s.%s\x20=\x20%s.%s',_0x583705['table'],_0x583705[_0x9220('0x82')][_0x54df43]['parentKey'],_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x85')],_0x583705[_0x9220('0x82')][_0x54df43][_0x9220('0x86')]));}}}if(_0x583705[_0x9220('0x88')]){_0x583705['conditions']=JSON[_0x9220('0x83')](_0x583705[_0x9220('0x88')]);_0x4ba0c2[_0x9220('0x3e')](_0x34c56f(_0x583705[_0x9220('0x88')][_0x9220('0x6d')]));}_0x4d2be3=_0x4ba0c2[_0x9220('0x91')]();_0x4ba0c2[_0x9220('0x92')](_0x255c90);_0x4ba0c2['offset'](0x0);logger[_0x9220('0x89')]('Limited\x20Query:',_0x4ba0c2[_0x9220('0x8a')]());return db['sequelize']['query'](_0x4ba0c2[_0x9220('0x8a')](),{'type':db[_0x9220('0x8b')]['QueryTypes'][_0x9220('0x8d')]});}})[_0x9220('0x26')](function(_0x340244){if(!_0x340244[_0x9220('0x3b')]){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x93'),0xcc);}if(_0x2beccf[_0x9220('0x94')]===_0x9220('0x95')){return null;}var _0x229232=_[_0x9220('0x41')](_0x2beccf,{'name':_0x2beccf[_0x9220('0x96')]||_0x2beccf[_0x9220('0x2c')]||_0x583705[_0x9220('0x2c')],'basename':_0x4e5b95,'savename':util[_0x9220('0x7e')](_0x9220('0x97'),_0x2beccf[_0x9220('0x2c')]||_0x583705[_0x9220('0x2c')],require(_0x9220('0x98'))[_0x9220('0x99')](0x4),_0x2beccf[_0x9220('0x94')]||'csv'),'reportId':_0x583705['id'],'reportType':_0x9220('0x9a')});return db[_0x9220('0x9b')]['create'](_0x229232,{'raw':!![]});})['then'](function(_0x46f82a){if(_0x583705[_0x9220('0x79')]===_0x9220('0x9c')){_0x4d2be3[_0x9220('0x3e')](_0x583705['table']+_0x9220('0x9d'),_0x2beccf[_0x9220('0x9e')],_0x2beccf[_0x9220('0x9f')]);}else{_0x4d2be3['where'](_0x583705['table']+_0x9220('0xa0'),_0x2beccf[_0x9220('0x9e')],_0x2beccf['endDate']);}if(_0x46f82a){logger[_0x9220('0xa1')](_0x9220('0xa2'),_0x4d2be3[_0x9220('0x8a')]());require(_0x9220('0xa3'))['fork'](path[_0x9220('0x56')](__dirname,_0x9220('0xa4'),_0x46f82a['output']),[_0x46f82a['id'],_0x4d2be3[_0x9220('0x8a')](),path[_0x9220('0x56')](__dirname,'../../files/reports',_0x46f82a[_0x9220('0xa5')]),_0x4e5b95]);return _0x46f82a;}else{var _0x24ff08=squel[_0x9220('0x77')]();_0x24ff08['from']('('+_0x4d2be3['toString']()+')',_0x9220('0xa6'));_0x24ff08[_0x9220('0x6e')](_0x9220('0xa7'),_0x9220('0x1f'));_0x4d2be3[_0x9220('0x92')](_0x2beccf[_0x9220('0x92')]||_0x255c90);_0x4d2be3['offset'](_0x2beccf[_0x9220('0x20')]||0x0);return dbH[_0x9220('0x8b')][_0x9220('0x36')](_0x24ff08[_0x9220('0x8a')](),{'type':dbH[_0x9220('0x8b')][_0x9220('0x8c')][_0x9220('0x8d')]})[_0x9220('0x26')](function(_0x12a2b4){if(!_0x12a2b4['length']){_0x2b3ce1=0x0;}else{_0x2b3ce1=_0x12a2b4[0x0]['count']||0x0;}return dbH[_0x9220('0x8b')]['query'](_0x4d2be3[_0x9220('0x8a')](),{'type':dbH['sequelize'][_0x9220('0x8c')][_0x9220('0x8d')]});})[_0x9220('0x26')](function(_0x265338){return{'rows':_0x265338||[],'count':_0x2b3ce1};});}});}exports['run']=function(_0x275f1b,_0x52a1d6){return runReport(_0x275f1b[_0x9220('0x54')],_0x275f1b['query'],_0x275f1b[_0x9220('0x43')])['then'](respondWithResult(_0x52a1d6,null))[_0x9220('0x48')](handleError(_0x52a1d6,null));};exports[_0x9220('0xa8')]=runReport;exports[_0x9220('0x36')]=function(_0x3350cb,_0x2a326f){var _0xb65d54=0xa;var _0x5a4e9b=[_0x9220('0x56'),'left_join',_0x9220('0x58'),_0x9220('0x59')];var _0xa409da={'SUM':_0x9220('0x5a'),'COUNT':_0x9220('0x5b'),'COUNT DISTINCT':_0x9220('0x5c'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9220('0x5f'),'GROUP_CONCAT ASC':_0x9220('0x60'),'GROUP_CONCAT DESC':_0x9220('0x61')};var _0x299870={'SEC_TO_TIME':_0x9220('0x62'),'DATE':_0x9220('0x63'),'HOUR':_0x9220('0x64'),'ROUND':_0x9220('0x65'),'UNIX_TIMESTAMP':_0x9220('0x8f')};var _0x3f3367=function(_0x672f6){return!_[_0x9220('0x66')]([_0x9220('0x67'),'IS\x20NOT\x20NULL',_0x9220('0x69'),'IS\x20NOT\x20EMPTY'],_0x672f6);};var _0x94d760=function(_0x5f51b0){if(!_0x5f51b0||!_0x5f51b0['rules']['length']){return'';}for(var _0x406014='(',_0xa588f8=0x0;_0xa588f8<_0x5f51b0[_0x9220('0x6b')][_0x9220('0x3b')];_0xa588f8+=0x1){_0xa588f8>0x0&&(_0x406014+='\x20'+_0x5f51b0[_0x9220('0x6c')]+'\x20');_0x406014+=_0x5f51b0['rules'][_0xa588f8][_0x9220('0x6d')]?_0x94d760(_0x5f51b0[_0x9220('0x6b')][_0xa588f8]['group']):_0x5f51b0[_0x9220('0x6b')][_0xa588f8][_0x9220('0x6e')]+'\x20'+_0x5f51b0['rules'][_0xa588f8][_0x9220('0x6f')]+(_0x3f3367(_0x5f51b0[_0x9220('0x6b')][_0xa588f8]['condition'])?'\x20'+_0x5f51b0[_0x9220('0x6b')][_0xa588f8][_0x9220('0x70')]:'');}return _0x406014+')';};var _0x192d94={'where':{'id':_0x3350cb[_0x9220('0x54')]['id']}},_0x4a112e,_0x1977c3,_0x42671a,_0x3c7e60,_0x158c2d;_0x192d94=_['merge']({},_0x192d94,_0x3350cb[_0x9220('0x43')]);return db[_0x9220('0x30')][_0x9220('0x4a')](_0x192d94)[_0x9220('0x26')](function(_0x2ff662){if(_0x2ff662){_0x4a112e=_0x2ff662;return _0x2ff662[_0x9220('0x71')]();}return null;})[_0x9220('0x26')](function(_0x48a9c2){if(_0x48a9c2){if(!_0x48a9c2['length']){throw new db[(_0x9220('0x72'))][(_0x9220('0x73'))](_0x9220('0x74'),0x193);}_0x1977c3=_0x48a9c2;return db[_0x9220('0x75')]['findAll']({'raw':!![]});}return null;})[_0x9220('0x26')](function(_0x4cb4e3){if(_0x4cb4e3){_0x42671a=_[_0x9220('0x76')](_0x4cb4e3,'id');var _0x354045;var _0x2f6d6e=squel['select']();_0x2f6d6e[_0x9220('0x78')](_0x4a112e[_0x9220('0x79')]);for(var _0x560eef=0x0;_0x560eef<_0x1977c3[_0x9220('0x3b')];_0x560eef+=0x1){_0x354045=_0x1977c3[_0x560eef]['MetricId']?_0x42671a[_0x1977c3[_0x560eef][_0x9220('0x7a')]][_0x9220('0x7b')]:_0x1977c3[_0x560eef][_0x9220('0x6e')];_0x354045=_0x1977c3[_0x560eef]['function']?_[_0x9220('0x7d')](_0xa409da[_0x1977c3[_0x560eef][_0x9220('0x7c')]],'%s',_0x354045):_0x354045;_0x354045=_0x1977c3[_0x560eef][_0x9220('0x7e')]?_[_0x9220('0x7d')](_0x299870[_0x1977c3[_0x560eef]['format']],'%s',_0x354045):_0x354045;if(_0x1977c3[_0x560eef][_0x9220('0x7f')]){_0x2f6d6e[_0x9220('0x6d')](_0x354045);}_0x1977c3[_0x560eef][_0x9220('0xa9')]&&_0x2f6d6e[_0x9220('0x80')](_0x354045,_0x1977c3[_0x560eef]['orderBy']==='DESC'?![]:!![]);_0x2f6d6e[_0x9220('0x6e')](_0x354045,_0x1977c3[_0x560eef][_0x9220('0x90')]||_0x354045);}if(_0x4a112e['joins']){_0x4a112e[_0x9220('0x82')]=JSON[_0x9220('0x83')](_0x4a112e[_0x9220('0x82')]);for(var _0x4958f2=0x0;_0x4958f2<_0x4a112e[_0x9220('0x82')]['length'];_0x4958f2+=0x1){if(_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x33')]&&_[_0x9220('0x66')](_0x5a4e9b,_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x33')])&&_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x84')]&&_0x4a112e[_0x9220('0x82')][_0x4958f2]['foreignTable']&&_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x86')]){_0x2f6d6e[_0x4a112e[_0x9220('0x82')][_0x4958f2]['type']](_0x4a112e[_0x9220('0x82')][_0x4958f2]['foreignTable'],null,util['format'](_0x9220('0x87'),_0x4a112e[_0x9220('0x79')],_0x4a112e[_0x9220('0x82')][_0x4958f2]['parentKey'],_0x4a112e['joins'][_0x4958f2][_0x9220('0x85')],_0x4a112e[_0x9220('0x82')][_0x4958f2][_0x9220('0x86')]));}}}if(_0x4a112e['conditions']){_0x4a112e[_0x9220('0x88')]=JSON['parse'](_0x4a112e[_0x9220('0x88')]);_0x2f6d6e[_0x9220('0x3e')](_0x94d760(_0x4a112e[_0x9220('0x88')][_0x9220('0x6d')]));}_0x158c2d=_0x2f6d6e['clone']();_0x2f6d6e['limit'](_0xb65d54);_0x2f6d6e[_0x9220('0x20')](0x0);logger[_0x9220('0x89')](_0x9220('0xaa'),_0x2f6d6e[_0x9220('0x8a')]());return db[_0x9220('0x8b')][_0x9220('0x36')](_0x2f6d6e['toString'](),{'type':db[_0x9220('0x8b')][_0x9220('0x8c')][_0x9220('0x8d')]});}})[_0x9220('0x26')](function(){return{'sql':_0x158c2d[_0x9220('0x8a')]()};})[_0x9220('0x26')](respondWithResult(_0x2a326f,null))['catch'](handleError(_0x2a326f,null));}; \ No newline at end of file +var _0x0b25=['alias','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','get','CustomReports','destroy','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','options','count','include','rows','catch','show','keys','length','includeAll','merge','find','user','role','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','operator','findAll','metric'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x0b25,0x155));var _0x50b2=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x0b25[_0x20fdc1];return _0x25397c;};'use strict';var pdf=require(_0x50b2('0x0'));var emlformat=require(_0x50b2('0x1'));var rimraf=require(_0x50b2('0x2'));var zipdir=require(_0x50b2('0x3'));var jsonpatch=require(_0x50b2('0x4'));var rp=require(_0x50b2('0x5'));var moment=require(_0x50b2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50b2('0x7'));var path=require('path');var sox=require(_0x50b2('0x8'));var csv=require(_0x50b2('0x9'));var ejs=require(_0x50b2('0xa'));var fs=require('fs');var _=require(_0x50b2('0xb'));var squel=require(_0x50b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x50b2('0xd'));var deskjs=require(_0x50b2('0xe'));var toCsv=require(_0x50b2('0x9'));var querystring=require(_0x50b2('0xf'));var Papa=require('papaparse');var Redis=require(_0x50b2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x50b2('0x11'));var as=require(_0x50b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50b2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x50b2('0x14'));var db=require(_0x50b2('0x15'))['db'];var dbH=require(_0x50b2('0x15'))[_0x50b2('0x16')];function respondWithStatusCode(_0x3eda73,_0x3ab9e6){_0x3ab9e6=_0x3ab9e6||0xcc;return function(_0x36067a){if(_0x36067a){return _0x3eda73[_0x50b2('0x17')](_0x3ab9e6);}return _0x3eda73[_0x50b2('0x18')](_0x3ab9e6)[_0x50b2('0x19')]();};}function respondWithResult(_0x391255,_0x4d6650){_0x4d6650=_0x4d6650||0xc8;return function(_0x131cf1){if(_0x131cf1){return _0x391255[_0x50b2('0x18')](_0x4d6650)[_0x50b2('0x1a')](_0x131cf1);}};}function respondWithFilteredResult(_0x54cc61,_0x3c3fd6){return function(_0x112d57){if(_0x112d57){var _0x2f0f92=_0x112d57['count'],_0x1a4df6=_0x3c3fd6[_0x50b2('0x1b')],_0x1308dd=_0x3c3fd6[_0x50b2('0x1b')]+_0x3c3fd6['limit'],_0xb95d74;if(_0x1308dd>=_0x2f0f92){_0x1308dd=_0x2f0f92;_0xb95d74=0xc8;}else{_0xb95d74=0xce;}_0x54cc61[_0x50b2('0x18')](_0xb95d74);return _0x54cc61[_0x50b2('0x1c')]('Content-Range',_0x1a4df6+'-'+_0x1308dd+'/'+_0x2f0f92)[_0x50b2('0x1a')](_0x112d57);}return null;};}function patchUpdates(_0x106491){return function(_0x52aaf9){try{jsonpatch[_0x50b2('0x1d')](_0x52aaf9,_0x106491,!![]);}catch(_0x1119c6){return BPromise[_0x50b2('0x1e')](_0x1119c6);}return _0x52aaf9[_0x50b2('0x1f')]();};}function saveUpdates(_0x4b6005,_0x42aef5){return function(_0x41d435){if(_0x41d435){return _0x41d435[_0x50b2('0x20')](_0x4b6005)[_0x50b2('0x21')](function(_0x20d71e){return _0x20d71e;});}return null;};}function removeEntity(_0x459eaf,_0x51f7ae){return function(_0x57c697){if(_0x57c697){return _0x57c697['destroy']()[_0x50b2('0x21')](function(){var _0x34c3cb=_0x57c697[_0x50b2('0x22')]({'plain':!![]});var _0x28e515=_0x50b2('0x23');return db['UserProfileResource'][_0x50b2('0x24')]({'where':{'type':_0x28e515,'resourceId':_0x34c3cb['id']}})[_0x50b2('0x21')](function(){return _0x57c697;});})[_0x50b2('0x21')](function(){_0x459eaf[_0x50b2('0x18')](0xcc)[_0x50b2('0x19')]();});}};}function handleEntityNotFound(_0x412639,_0x21ae06){return function(_0x2a145a){if(!_0x2a145a){_0x412639[_0x50b2('0x17')](0x194);}return _0x2a145a;};}function handleError(_0x8e2403,_0x2d05f5){_0x2d05f5=_0x2d05f5||0x1f4;return function(_0x2c6fff){logger['error'](_0x2c6fff[_0x50b2('0x25')]);if(_0x2c6fff[_0x50b2('0x26')]){delete _0x2c6fff[_0x50b2('0x26')];}_0x8e2403[_0x50b2('0x18')](_0x2d05f5)[_0x50b2('0x27')](_0x2c6fff);};}exports['index']=function(_0x65ecbe,_0x24d967){var _0x1220e3={},_0x2cc4fe={},_0x508693={'count':0x0,'rows':[]};var _0x34309d=_[_0x50b2('0x28')](db[_0x50b2('0x29')][_0x50b2('0x2a')],function(_0x313b33){return{'name':_0x313b33[_0x50b2('0x2b')],'type':_0x313b33[_0x50b2('0x2c')][_0x50b2('0x2d')]};});_0x2cc4fe[_0x50b2('0x2e')]=_[_0x50b2('0x28')](_0x34309d,_0x50b2('0x26'));_0x2cc4fe[_0x50b2('0x2f')]=_['keys'](_0x65ecbe['query']);_0x2cc4fe[_0x50b2('0x30')]=_[_0x50b2('0x31')](_0x2cc4fe[_0x50b2('0x2e')],_0x2cc4fe[_0x50b2('0x2f')]);_0x1220e3['attributes']=_[_0x50b2('0x31')](_0x2cc4fe['model'],qs[_0x50b2('0x32')](_0x65ecbe[_0x50b2('0x2f')][_0x50b2('0x32')]));_0x1220e3['attributes']=_0x1220e3[_0x50b2('0x33')]['length']?_0x1220e3[_0x50b2('0x33')]:_0x2cc4fe[_0x50b2('0x2e')];if(!_0x65ecbe[_0x50b2('0x2f')][_0x50b2('0x34')](_0x50b2('0x35'))){_0x1220e3['limit']=qs[_0x50b2('0x36')](_0x65ecbe[_0x50b2('0x2f')][_0x50b2('0x36')]);_0x1220e3['offset']=qs['offset'](_0x65ecbe[_0x50b2('0x2f')]['offset']);}_0x1220e3[_0x50b2('0x37')]=qs[_0x50b2('0x38')](_0x65ecbe['query'][_0x50b2('0x38')]);_0x1220e3['where']=qs[_0x50b2('0x30')](_[_0x50b2('0x39')](_0x65ecbe[_0x50b2('0x2f')],_0x2cc4fe[_0x50b2('0x30')]),_0x34309d);if(_0x65ecbe[_0x50b2('0x2f')]['filter']){_0x1220e3[_0x50b2('0x3a')]=_['merge'](_0x1220e3['where'],{'$or':_['map'](_0x34309d,function(_0x177e69){if(_0x177e69[_0x50b2('0x2c')]!==_0x50b2('0x3b')){var _0x4dad2f={};_0x4dad2f[_0x177e69[_0x50b2('0x26')]]={'$like':'%'+_0x65ecbe['query']['filter']+'%'};return _0x4dad2f;}})});}_0x1220e3=_['merge']({},_0x1220e3,_0x65ecbe[_0x50b2('0x3c')]);var _0x40207c={'where':_0x1220e3['where']};return db[_0x50b2('0x29')][_0x50b2('0x3d')](_0x40207c)[_0x50b2('0x21')](function(_0x19cc7e){_0x508693['count']=_0x19cc7e;if(_0x65ecbe[_0x50b2('0x2f')]['includeAll']){_0x1220e3[_0x50b2('0x3e')]=[{'all':!![]}];}return db[_0x50b2('0x29')]['findAll'](_0x1220e3);})[_0x50b2('0x21')](function(_0x2e4781){_0x508693[_0x50b2('0x3f')]=_0x2e4781;return _0x508693;})['then'](respondWithFilteredResult(_0x24d967,_0x1220e3))[_0x50b2('0x40')](handleError(_0x24d967,null));};exports[_0x50b2('0x41')]=function(_0x7c5241,_0x3ade1a){var _0x330348={'raw':![],'where':{'id':_0x7c5241['params']['id']}},_0x27725a={};_0x27725a[_0x50b2('0x2e')]=_[_0x50b2('0x42')](db['AnalyticCustomReport'][_0x50b2('0x2a')]);_0x27725a[_0x50b2('0x2f')]=_[_0x50b2('0x42')](_0x7c5241[_0x50b2('0x2f')]);_0x27725a['filters']=_[_0x50b2('0x31')](_0x27725a[_0x50b2('0x2e')],_0x27725a[_0x50b2('0x2f')]);_0x330348[_0x50b2('0x33')]=_[_0x50b2('0x31')](_0x27725a['model'],qs[_0x50b2('0x32')](_0x7c5241[_0x50b2('0x2f')][_0x50b2('0x32')]));_0x330348[_0x50b2('0x33')]=_0x330348[_0x50b2('0x33')][_0x50b2('0x43')]?_0x330348[_0x50b2('0x33')]:_0x27725a[_0x50b2('0x2e')];if(_0x7c5241[_0x50b2('0x2f')][_0x50b2('0x44')]){_0x330348[_0x50b2('0x3e')]=[{'all':!![]}];}_0x330348=_[_0x50b2('0x45')]({},_0x330348,_0x7c5241[_0x50b2('0x3c')]);return db['AnalyticCustomReport'][_0x50b2('0x46')](_0x330348)['then'](handleEntityNotFound(_0x3ade1a,null))[_0x50b2('0x21')](respondWithResult(_0x3ade1a,null))['catch'](handleError(_0x3ade1a,null));};exports['create']=function(_0x3ba565,_0x550778){return db['AnalyticCustomReport']['create'](_0x3ba565['body'],{})['then'](function(_0x4cfa62){var _0x33fa98=_0x3ba565[_0x50b2('0x47')][_0x50b2('0x22')]({'plain':!![]});if(!_0x33fa98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fa98[_0x50b2('0x48')]==='user'){var _0x26c804=_0x4cfa62[_0x50b2('0x22')]({'plain':!![]});var _0x9f7672='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x9f7672,'userProfileId':_0x33fa98['userProfileId']},'raw':!![]})[_0x50b2('0x21')](function(_0x3dcd8d){if(_0x3dcd8d&&_0x3dcd8d[_0x50b2('0x49')]===0x0){return db['UserProfileResource'][_0x50b2('0x4a')]({'name':_0x26c804['name'],'resourceId':_0x26c804['id'],'type':'CustomReports','sectionId':_0x3dcd8d['id']},{})[_0x50b2('0x21')](function(){return _0x4cfa62;});}else{return _0x4cfa62;}})[_0x50b2('0x40')](function(_0x2d4f0e){logger[_0x50b2('0x4b')](_0x50b2('0x4c'),_0x2d4f0e);throw _0x2d4f0e;});}return _0x4cfa62;})[_0x50b2('0x21')](respondWithResult(_0x550778,0xc9))[_0x50b2('0x40')](handleError(_0x550778,null));};exports[_0x50b2('0x20')]=function(_0x34247b,_0x79b436){if(_0x34247b[_0x50b2('0x4d')]['id']){delete _0x34247b['body']['id'];}return db['AnalyticCustomReport'][_0x50b2('0x46')]({'where':{'id':_0x34247b[_0x50b2('0x4e')]['id']}})[_0x50b2('0x21')](handleEntityNotFound(_0x79b436,null))['then'](saveUpdates(_0x34247b[_0x50b2('0x4d')],null))[_0x50b2('0x21')](respondWithResult(_0x79b436,null))[_0x50b2('0x40')](handleError(_0x79b436,null));};exports[_0x50b2('0x24')]=function(_0x4fa58a,_0x5b9b0f){return db[_0x50b2('0x29')][_0x50b2('0x46')]({'where':{'id':_0x4fa58a[_0x50b2('0x4e')]['id']}})[_0x50b2('0x21')](handleEntityNotFound(_0x5b9b0f,null))[_0x50b2('0x21')](removeEntity(_0x5b9b0f,null))[_0x50b2('0x40')](handleError(_0x5b9b0f,null));};exports[_0x50b2('0x4f')]=function(_0x3e81e5,_0xfc6a64){var _0x1c9c2a=0xa;var _0x528cde=[_0x50b2('0x50'),_0x50b2('0x51'),_0x50b2('0x52'),_0x50b2('0x53')];var _0x4cb3d0={'SUM':_0x50b2('0x54'),'COUNT':_0x50b2('0x55'),'COUNT DISTINCT':_0x50b2('0x56'),'MAX':_0x50b2('0x57'),'MIN':_0x50b2('0x58'),'AVG':_0x50b2('0x59'),'GROUP_CONCAT':_0x50b2('0x5a'),'GROUP_CONCAT ASC':_0x50b2('0x5b'),'GROUP_CONCAT DESC':_0x50b2('0x5c')};var _0x21fece={'SEC_TO_TIME':_0x50b2('0x5d'),'DATE':_0x50b2('0x5e'),'HOUR':_0x50b2('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30db39=function(_0x213ffb){return!_[_0x50b2('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x50b2('0x61')],_0x213ffb);};var _0x402596=function(_0xe9168e){if(!_0xe9168e||!_0xe9168e[_0x50b2('0x62')]['length']){return'';}for(var _0x250a8f='(',_0x287199=0x0;_0x287199<_0xe9168e['rules']['length'];_0x287199+=0x1){_0x287199>0x0&&(_0x250a8f+='\x20'+_0xe9168e['operator']+'\x20');_0x250a8f+=_0xe9168e[_0x50b2('0x62')][_0x287199][_0x50b2('0x63')]?_0x402596(_0xe9168e[_0x50b2('0x62')][_0x287199][_0x50b2('0x63')]):_0xe9168e[_0x50b2('0x62')][_0x287199]['field']+'\x20'+_0xe9168e['rules'][_0x287199][_0x50b2('0x64')]+(_0x30db39(_0xe9168e['rules'][_0x287199][_0x50b2('0x64')])?'\x20'+_0xe9168e['rules'][_0x287199][_0x50b2('0x65')]:'');}return _0x250a8f+')';};var _0x15a2f9={'where':{'id':_0x3e81e5[_0x50b2('0x4e')]['id']}},_0x3aea36,_0x1c3dbb,_0x288119,_0xf5da02,_0x19f5a7;_0x15a2f9=_[_0x50b2('0x45')]({},_0x15a2f9,_0x3e81e5['options']);return db[_0x50b2('0x29')][_0x50b2('0x46')](_0x15a2f9)[_0x50b2('0x21')](function(_0x43f5d8){if(_0x43f5d8){_0x3aea36=_0x43f5d8;return _0x43f5d8[_0x50b2('0x66')]();}return null;})[_0x50b2('0x21')](function(_0x5bdacf){if(_0x5bdacf){if(!_0x5bdacf[_0x50b2('0x43')]){throw new db[(_0x50b2('0x67'))][(_0x50b2('0x68'))](_0x50b2('0x69'),0x193);}_0x1c3dbb=_0x5bdacf;return db[_0x50b2('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x287ac3){if(_0x287ac3){_0x288119=_['keyBy'](_0x287ac3,'id');var _0x3f5214;var _0x36c8b4=squel[_0x50b2('0x6b')]();_0x36c8b4[_0x50b2('0x6c')](_0x3aea36[_0x50b2('0x6d')]);for(var _0x4f9af7=0x0;_0x4f9af7<_0x1c3dbb[_0x50b2('0x43')];_0x4f9af7+=0x1){_0x3f5214=_0x1c3dbb[_0x4f9af7][_0x50b2('0x6e')]?_0x288119[_0x1c3dbb[_0x4f9af7][_0x50b2('0x6e')]]['metric']:_0x1c3dbb[_0x4f9af7][_0x50b2('0x6f')];_0x3f5214=_0x1c3dbb[_0x4f9af7][_0x50b2('0x70')]?_[_0x50b2('0x71')](_0x4cb3d0[_0x1c3dbb[_0x4f9af7][_0x50b2('0x70')]],'%s',_0x3f5214):_0x3f5214;_0x3f5214=_0x1c3dbb[_0x4f9af7]['format']?_[_0x50b2('0x71')](_0x21fece[_0x1c3dbb[_0x4f9af7][_0x50b2('0x72')]],'%s',_0x3f5214):_0x3f5214;if(_0x1c3dbb[_0x4f9af7][_0x50b2('0x73')]){_0x36c8b4[_0x50b2('0x63')](_0x3f5214);}_0x1c3dbb[_0x4f9af7][_0x50b2('0x74')]&&_0x36c8b4[_0x50b2('0x37')](_0x3f5214,_0x1c3dbb[_0x4f9af7][_0x50b2('0x74')]===_0x50b2('0x75')?![]:!![]);_0x36c8b4[_0x50b2('0x6f')](_0x3f5214,_0x1c3dbb[_0x4f9af7]['alias']||_0x3f5214);}if(_0x3aea36[_0x50b2('0x76')]){_0x3aea36[_0x50b2('0x76')]=JSON[_0x50b2('0x77')](_0x3aea36[_0x50b2('0x76')]);for(var _0x469042=0x0;_0x469042<_0x3aea36[_0x50b2('0x76')][_0x50b2('0x43')];_0x469042+=0x1){if(_0x3aea36['joins'][_0x469042]['type']&&_[_0x50b2('0x60')](_0x528cde,_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x2c')])&&_0x3aea36[_0x50b2('0x76')][_0x469042]['parentKey']&&_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x78')]&&_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x79')]){_0x36c8b4[_0x3aea36[_0x50b2('0x76')][_0x469042]['type']](_0x3aea36[_0x50b2('0x76')][_0x469042]['foreignTable'],null,util[_0x50b2('0x72')](_0x50b2('0x7a'),_0x3aea36[_0x50b2('0x6d')],_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x7b')],_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x78')],_0x3aea36[_0x50b2('0x76')][_0x469042][_0x50b2('0x79')]));}}}if(_0x3aea36[_0x50b2('0x7c')]){_0x3aea36[_0x50b2('0x7c')]=JSON[_0x50b2('0x77')](_0x3aea36['conditions']);_0x36c8b4['where'](_0x402596(_0x3aea36[_0x50b2('0x7c')]['group']));}_0x19f5a7=_0x36c8b4[_0x50b2('0x7d')]();_0x36c8b4[_0x50b2('0x36')](_0x1c9c2a);_0x36c8b4[_0x50b2('0x1b')](0x0);logger[_0x50b2('0x7e')](_0x50b2('0x7f'),_0x36c8b4[_0x50b2('0x80')]());return db[_0x50b2('0x81')][_0x50b2('0x2f')](_0x36c8b4[_0x50b2('0x80')](),{'type':db['sequelize'][_0x50b2('0x82')][_0x50b2('0x83')]});}})[_0x50b2('0x21')](respondWithResult(_0xfc6a64,null))[_0x50b2('0x40')](handleError(_0xfc6a64,null));};function runReport(_0x427415,_0x1694f1,_0x423468){var _0x1cceff=_0x1694f1[_0x50b2('0x26')];var _0x661785=0xa;var _0xe81c02=[_0x50b2('0x50'),'left_join','right_join',_0x50b2('0x53')];var _0x4cf7e7={'SUM':_0x50b2('0x54'),'COUNT':_0x50b2('0x55'),'COUNT DISTINCT':_0x50b2('0x56'),'MAX':_0x50b2('0x57'),'MIN':'MIN(%s)','AVG':_0x50b2('0x59'),'GROUP_CONCAT':_0x50b2('0x5a'),'GROUP_CONCAT ASC':_0x50b2('0x5b'),'GROUP_CONCAT DESC':_0x50b2('0x5c')};var _0x2e8965={'SEC_TO_TIME':_0x50b2('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x50b2('0x84'),'UNIX_TIMESTAMP':_0x50b2('0x85')};var _0x350a70=function(_0x1a60f8){return!_[_0x50b2('0x60')]([_0x50b2('0x86'),'IS\x20NOT\x20NULL',_0x50b2('0x87'),'IS\x20NOT\x20EMPTY'],_0x1a60f8);};var _0x382c74=function(_0x5792e7){if(!_0x5792e7||!_0x5792e7[_0x50b2('0x62')]['length']){return'';}for(var _0xfea7b7='(',_0x43910a=0x0;_0x43910a<_0x5792e7[_0x50b2('0x62')][_0x50b2('0x43')];_0x43910a+=0x1){_0x43910a>0x0&&(_0xfea7b7+='\x20'+_0x5792e7[_0x50b2('0x88')]+'\x20');_0xfea7b7+=_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x63')]?_0x382c74(_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x63')]):_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x6f')]+'\x20'+_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x64')]+(_0x350a70(_0x5792e7[_0x50b2('0x62')][_0x43910a][_0x50b2('0x64')])?'\x20'+_0x5792e7[_0x50b2('0x62')][_0x43910a]['value']:'');}return _0xfea7b7+')';};var _0xbe66c6={'where':{'id':_0x427415['id']}},_0x5ee380,_0xcde634,_0x19b392,_0x2698b7,_0x43ec67;_0xbe66c6=_[_0x50b2('0x45')]({},_0xbe66c6,_0x423468);return db['AnalyticCustomReport'][_0x50b2('0x46')](_0xbe66c6)[_0x50b2('0x21')](function(_0x3c06c1){if(_0x3c06c1){_0x5ee380=_0x3c06c1;return _0x3c06c1[_0x50b2('0x66')]();}return null;})[_0x50b2('0x21')](function(_0x50af09){if(_0x50af09){if(!_0x50af09[_0x50b2('0x43')]){throw new db[(_0x50b2('0x67'))][(_0x50b2('0x68'))](_0x50b2('0x69'),0x193);}_0xcde634=_0x50af09;return db[_0x50b2('0x6a')][_0x50b2('0x89')]({'raw':!![]});}return null;})[_0x50b2('0x21')](function(_0x2d72a1){if(_0x2d72a1){_0x19b392=_['keyBy'](_0x2d72a1,'id');var _0x2db0d1;var _0x3895c6=squel[_0x50b2('0x6b')]();_0x3895c6[_0x50b2('0x6c')](_0x5ee380[_0x50b2('0x6d')]);for(var _0x263b94=0x0;_0x263b94<_0xcde634[_0x50b2('0x43')];_0x263b94+=0x1){_0x2db0d1=_0xcde634[_0x263b94][_0x50b2('0x6e')]?_0x19b392[_0xcde634[_0x263b94]['MetricId']][_0x50b2('0x8a')]:_0xcde634[_0x263b94][_0x50b2('0x6f')];_0x2db0d1=_0xcde634[_0x263b94]['function']?_['replace'](_0x4cf7e7[_0xcde634[_0x263b94]['function']],'%s',_0x2db0d1):_0x2db0d1;_0x2db0d1=_0xcde634[_0x263b94][_0x50b2('0x72')]?_[_0x50b2('0x71')](_0x2e8965[_0xcde634[_0x263b94][_0x50b2('0x72')]],'%s',_0x2db0d1):_0x2db0d1;if(_0xcde634[_0x263b94]['groupBy']){_0x3895c6['group'](_0x2db0d1);}_0xcde634[_0x263b94]['orderBy']&&_0x3895c6[_0x50b2('0x37')](_0x2db0d1,_0xcde634[_0x263b94][_0x50b2('0x74')]==='DESC'?![]:!![]);_0x3895c6[_0x50b2('0x6f')](_0x2db0d1,_0xcde634[_0x263b94][_0x50b2('0x8b')]||_0x2db0d1);}if(_0x5ee380[_0x50b2('0x76')]){_0x5ee380[_0x50b2('0x76')]=JSON[_0x50b2('0x77')](_0x5ee380['joins']);for(var _0x5cc987=0x0;_0x5cc987<_0x5ee380[_0x50b2('0x76')][_0x50b2('0x43')];_0x5cc987+=0x1){if(_0x5ee380['joins'][_0x5cc987][_0x50b2('0x2c')]&&_['includes'](_0xe81c02,_0x5ee380[_0x50b2('0x76')][_0x5cc987]['type'])&&_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x7b')]&&_0x5ee380['joins'][_0x5cc987][_0x50b2('0x78')]&&_0x5ee380[_0x50b2('0x76')][_0x5cc987]['foreignKey']){_0x3895c6[_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x2c')]](_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x78')],null,util['format'](_0x50b2('0x7a'),_0x5ee380[_0x50b2('0x6d')],_0x5ee380[_0x50b2('0x76')][_0x5cc987]['parentKey'],_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x78')],_0x5ee380[_0x50b2('0x76')][_0x5cc987][_0x50b2('0x79')]));}}}if(_0x5ee380[_0x50b2('0x7c')]){_0x5ee380['conditions']=JSON[_0x50b2('0x77')](_0x5ee380[_0x50b2('0x7c')]);_0x3895c6[_0x50b2('0x3a')](_0x382c74(_0x5ee380['conditions']['group']));}_0x43ec67=_0x3895c6[_0x50b2('0x7d')]();_0x3895c6[_0x50b2('0x36')](_0x661785);_0x3895c6[_0x50b2('0x1b')](0x0);logger[_0x50b2('0x7e')](_0x50b2('0x7f'),_0x3895c6[_0x50b2('0x80')]());return db[_0x50b2('0x81')][_0x50b2('0x2f')](_0x3895c6[_0x50b2('0x80')](),{'type':db[_0x50b2('0x81')][_0x50b2('0x82')][_0x50b2('0x83')]});}})[_0x50b2('0x21')](function(_0xde6c9e){if(!_0xde6c9e['length']){throw new db[(_0x50b2('0x67'))][(_0x50b2('0x68'))](_0x50b2('0x8c'),0xcc);}if(_0x1694f1[_0x50b2('0x8d')]===_0x50b2('0x8e')){return null;}var _0x101165=_[_0x50b2('0x45')](_0x1694f1,{'name':_0x1694f1['fullPath']||_0x1694f1[_0x50b2('0x26')]||_0x5ee380['name'],'basename':_0x1cceff,'savename':util['format'](_0x50b2('0x8f'),_0x1694f1[_0x50b2('0x26')]||_0x5ee380[_0x50b2('0x26')],require(_0x50b2('0x90'))[_0x50b2('0x91')](0x4),_0x1694f1[_0x50b2('0x8d')]||_0x50b2('0x92')),'reportId':_0x5ee380['id'],'reportType':_0x50b2('0x93')});return db[_0x50b2('0x94')]['create'](_0x101165,{'raw':!![]});})[_0x50b2('0x21')](function(_0x5da4e0){if(_0x5ee380['table']===_0x50b2('0x95')){_0x43ec67[_0x50b2('0x3a')](_0x5ee380[_0x50b2('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1694f1[_0x50b2('0x96')],_0x1694f1[_0x50b2('0x97')]);}else{_0x43ec67[_0x50b2('0x3a')](_0x5ee380['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1694f1[_0x50b2('0x96')],_0x1694f1[_0x50b2('0x97')]);}if(_0x5da4e0){logger[_0x50b2('0x98')](_0x50b2('0x99'),_0x43ec67['toString']());require(_0x50b2('0x9a'))[_0x50b2('0x9b')](path['join'](__dirname,_0x50b2('0x9c'),_0x5da4e0[_0x50b2('0x8d')]),[_0x5da4e0['id'],_0x43ec67[_0x50b2('0x80')](),path[_0x50b2('0x50')](__dirname,_0x50b2('0x9d'),_0x5da4e0['savename']),_0x1cceff]);return _0x5da4e0;}else{var _0x392e48=squel[_0x50b2('0x6b')]();_0x392e48['from']('('+_0x43ec67['toString']()+')',_0x50b2('0x9e'));_0x392e48[_0x50b2('0x6f')](_0x50b2('0x9f'),_0x50b2('0x3d'));_0x43ec67[_0x50b2('0x36')](_0x1694f1['limit']||_0x661785);_0x43ec67[_0x50b2('0x1b')](_0x1694f1[_0x50b2('0x1b')]||0x0);return dbH['sequelize'][_0x50b2('0x2f')](_0x392e48[_0x50b2('0x80')](),{'type':dbH[_0x50b2('0x81')][_0x50b2('0x82')][_0x50b2('0x83')]})[_0x50b2('0x21')](function(_0x1b4840){if(!_0x1b4840[_0x50b2('0x43')]){_0x2698b7=0x0;}else{_0x2698b7=_0x1b4840[0x0][_0x50b2('0x3d')]||0x0;}return dbH['sequelize'][_0x50b2('0x2f')](_0x43ec67['toString'](),{'type':dbH[_0x50b2('0x81')]['QueryTypes'][_0x50b2('0x83')]});})[_0x50b2('0x21')](function(_0xf46d01){return{'rows':_0xf46d01||[],'count':_0x2698b7};});}});}exports['run']=function(_0x2b708c,_0x580d01){return runReport(_0x2b708c['params'],_0x2b708c['query'],_0x2b708c[_0x50b2('0x3c')])[_0x50b2('0x21')](respondWithResult(_0x580d01,null))[_0x50b2('0x40')](handleError(_0x580d01,null));};exports['runReport']=runReport;exports[_0x50b2('0x2f')]=function(_0x269158,_0x59a8d4){var _0x53edb2=0xa;var _0x4b86cb=[_0x50b2('0x50'),_0x50b2('0x51'),'right_join',_0x50b2('0x53')];var _0x550e94={'SUM':_0x50b2('0x54'),'COUNT':_0x50b2('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x50b2('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x50b2('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x50b2('0x5c')};var _0xa7f172={'SEC_TO_TIME':_0x50b2('0x5d'),'DATE':_0x50b2('0x5e'),'HOUR':_0x50b2('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x50b2('0x85')};var _0x419458=function(_0x468ebd){return!_['includes']([_0x50b2('0x86'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x468ebd);};var _0x15de59=function(_0x889ace){if(!_0x889ace||!_0x889ace['rules'][_0x50b2('0x43')]){return'';}for(var _0x15403a='(',_0x54a25f=0x0;_0x54a25f<_0x889ace[_0x50b2('0x62')][_0x50b2('0x43')];_0x54a25f+=0x1){_0x54a25f>0x0&&(_0x15403a+='\x20'+_0x889ace[_0x50b2('0x88')]+'\x20');_0x15403a+=_0x889ace['rules'][_0x54a25f]['group']?_0x15de59(_0x889ace[_0x50b2('0x62')][_0x54a25f]['group']):_0x889ace[_0x50b2('0x62')][_0x54a25f]['field']+'\x20'+_0x889ace[_0x50b2('0x62')][_0x54a25f]['condition']+(_0x419458(_0x889ace[_0x50b2('0x62')][_0x54a25f][_0x50b2('0x64')])?'\x20'+_0x889ace[_0x50b2('0x62')][_0x54a25f]['value']:'');}return _0x15403a+')';};var _0x519dfd={'where':{'id':_0x269158['params']['id']}},_0x4ca044,_0xa9de7,_0x29722e,_0xadd2d8,_0x5d4630;_0x519dfd=_[_0x50b2('0x45')]({},_0x519dfd,_0x269158[_0x50b2('0x3c')]);return db[_0x50b2('0x29')][_0x50b2('0x46')](_0x519dfd)[_0x50b2('0x21')](function(_0xa441b){if(_0xa441b){_0x4ca044=_0xa441b;return _0xa441b[_0x50b2('0x66')]();}return null;})[_0x50b2('0x21')](function(_0x4b9d29){if(_0x4b9d29){if(!_0x4b9d29[_0x50b2('0x43')]){throw new db[(_0x50b2('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa9de7=_0x4b9d29;return db[_0x50b2('0x6a')][_0x50b2('0x89')]({'raw':!![]});}return null;})[_0x50b2('0x21')](function(_0x51d28c){if(_0x51d28c){_0x29722e=_['keyBy'](_0x51d28c,'id');var _0x44303f;var _0x18c3e9=squel[_0x50b2('0x6b')]();_0x18c3e9['from'](_0x4ca044['table']);for(var _0x2a1f8d=0x0;_0x2a1f8d<_0xa9de7[_0x50b2('0x43')];_0x2a1f8d+=0x1){_0x44303f=_0xa9de7[_0x2a1f8d][_0x50b2('0x6e')]?_0x29722e[_0xa9de7[_0x2a1f8d][_0x50b2('0x6e')]]['metric']:_0xa9de7[_0x2a1f8d][_0x50b2('0x6f')];_0x44303f=_0xa9de7[_0x2a1f8d][_0x50b2('0x70')]?_[_0x50b2('0x71')](_0x550e94[_0xa9de7[_0x2a1f8d][_0x50b2('0x70')]],'%s',_0x44303f):_0x44303f;_0x44303f=_0xa9de7[_0x2a1f8d][_0x50b2('0x72')]?_[_0x50b2('0x71')](_0xa7f172[_0xa9de7[_0x2a1f8d][_0x50b2('0x72')]],'%s',_0x44303f):_0x44303f;if(_0xa9de7[_0x2a1f8d][_0x50b2('0x73')]){_0x18c3e9[_0x50b2('0x63')](_0x44303f);}_0xa9de7[_0x2a1f8d][_0x50b2('0x74')]&&_0x18c3e9[_0x50b2('0x37')](_0x44303f,_0xa9de7[_0x2a1f8d]['orderBy']===_0x50b2('0x75')?![]:!![]);_0x18c3e9['field'](_0x44303f,_0xa9de7[_0x2a1f8d][_0x50b2('0x8b')]||_0x44303f);}if(_0x4ca044[_0x50b2('0x76')]){_0x4ca044[_0x50b2('0x76')]=JSON['parse'](_0x4ca044['joins']);for(var _0x5a525e=0x0;_0x5a525e<_0x4ca044[_0x50b2('0x76')]['length'];_0x5a525e+=0x1){if(_0x4ca044['joins'][_0x5a525e][_0x50b2('0x2c')]&&_[_0x50b2('0x60')](_0x4b86cb,_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x2c')])&&_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x7b')]&&_0x4ca044[_0x50b2('0x76')][_0x5a525e]['foreignTable']&&_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x79')]){_0x18c3e9[_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x2c')]](_0x4ca044[_0x50b2('0x76')][_0x5a525e]['foreignTable'],null,util[_0x50b2('0x72')](_0x50b2('0x7a'),_0x4ca044[_0x50b2('0x6d')],_0x4ca044[_0x50b2('0x76')][_0x5a525e]['parentKey'],_0x4ca044['joins'][_0x5a525e][_0x50b2('0x78')],_0x4ca044[_0x50b2('0x76')][_0x5a525e][_0x50b2('0x79')]));}}}if(_0x4ca044[_0x50b2('0x7c')]){_0x4ca044[_0x50b2('0x7c')]=JSON[_0x50b2('0x77')](_0x4ca044[_0x50b2('0x7c')]);_0x18c3e9['where'](_0x15de59(_0x4ca044[_0x50b2('0x7c')]['group']));}_0x5d4630=_0x18c3e9['clone']();_0x18c3e9[_0x50b2('0x36')](_0x53edb2);_0x18c3e9['offset'](0x0);logger[_0x50b2('0x7e')](_0x50b2('0x7f'),_0x18c3e9['toString']());return db[_0x50b2('0x81')][_0x50b2('0x2f')](_0x18c3e9[_0x50b2('0x80')](),{'type':db['sequelize'][_0x50b2('0x82')][_0x50b2('0x83')]});}})[_0x50b2('0x21')](function(){return{'sql':_0x5d4630[_0x50b2('0x80')]()};})[_0x50b2('0x21')](respondWithResult(_0x59a8d4,null))['catch'](handleError(_0x59a8d4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 490ce75..b182e6f 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 _0xbf57=['api','moment','bluebird','path','rimraf','exports','analytics_custom_reports','util'];(function(_0x292f97,_0x2d9da1){var _0x1a4f71=function(_0x994a18){while(--_0x994a18){_0x292f97['push'](_0x292f97['shift']());}};_0x1a4f71(++_0x2d9da1);}(_0xbf57,0x1bf));var _0x7bf5=function(_0xdb5b68,_0x1303ee){_0xdb5b68=_0xdb5b68-0x0;var _0x5a441d=_0xbf57[_0xdb5b68];return _0x5a441d;};'use strict';var _=require('lodash');var util=require(_0x7bf5('0x0'));var logger=require('../../config/logger')(_0x7bf5('0x1'));var moment=require(_0x7bf5('0x2'));var BPromise=require(_0x7bf5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bf5('0x4'));var rimraf=require(_0x7bf5('0x5'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x7bf5('0x6')]=function(_0x158926,_0x13fde7){return _0x158926['define']('AnalyticCustomReport',attributes,{'tableName':_0x7bf5('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1aa=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment','bluebird','path'];(function(_0x539ef5,_0xff6d0f){var _0x4dbf96=function(_0x221237){while(--_0x221237){_0x539ef5['push'](_0x539ef5['shift']());}};_0x4dbf96(++_0xff6d0f);}(_0xd1aa,0x13f));var _0xad1a=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xd1aa[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0xad1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var BPromise=require(_0xad1a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad1a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad1a('0x5'));module['exports']=function(_0x1efc05,_0x8b8043){return _0x1efc05[_0xad1a('0x6')](_0xad1a('0x7'),attributes,{'tableName':_0xad1a('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b06dce4..bc84804 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 _0x7b73=['request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c2eac,_0x566843){var _0x7f47f9=function(_0x19612c){while(--_0x19612c){_0x5c2eac['push'](_0x5c2eac['shift']());}};_0x7f47f9(++_0x566843);}(_0x7b73,0x1e8));var _0x37b7=function(_0x358478,_0x5f2729){_0x358478=_0x358478-0x0;var _0x1aa513=_0x7b73[_0x358478];return _0x1aa513;};'use strict';var _=require(_0x37b7('0x0'));var util=require('util');var moment=require(_0x37b7('0x1'));var BPromise=require(_0x37b7('0x2'));var rs=require(_0x37b7('0x3'));var fs=require('fs');var Redis=require(_0x37b7('0x4'));var db=require(_0x37b7('0x5'))['db'];var utils=require(_0x37b7('0x6'));var logger=require('../../config/logger')(_0x37b7('0x7'));var config=require(_0x37b7('0x8'));var jayson=require(_0x37b7('0x9'));var client=jayson[_0x37b7('0xa')][_0x37b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437e14,_0xfba64e,_0x2e5f76){return new BPromise(function(_0x560222,_0x32763d){return client[_0x37b7('0xc')](_0x437e14,_0x2e5f76)[_0x37b7('0xd')](function(_0x56fe3b){logger[_0x37b7('0xe')](_0x37b7('0xf'),_0xfba64e,_0x37b7('0x10'));logger[_0x37b7('0x11')](_0x37b7('0x12'),_0xfba64e,_0x37b7('0x10'),JSON[_0x37b7('0x13')](_0x56fe3b));if(_0x56fe3b['error']){if(_0x56fe3b[_0x37b7('0x14')][_0x37b7('0x15')]===0x1f4){logger[_0x37b7('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfba64e,_0x56fe3b[_0x37b7('0x14')][_0x37b7('0x16')]);return _0x32763d(_0x56fe3b[_0x37b7('0x14')]['message']);}logger[_0x37b7('0x14')](_0x37b7('0xf'),_0xfba64e,_0x56fe3b[_0x37b7('0x14')]['message']);return _0x560222(_0x56fe3b[_0x37b7('0x14')][_0x37b7('0x16')]);}else{logger['info'](_0x37b7('0xf'),_0xfba64e,'request\x20sent');_0x560222(_0x56fe3b[_0x37b7('0x17')][_0x37b7('0x16')]);}})[_0x37b7('0x18')](function(_0xf822cc){logger[_0x37b7('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfba64e,_0xf822cc);_0x32763d(_0xf822cc);});});} \ No newline at end of file +var _0xb4d0=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x18e196,_0x2ddc7f){var _0x4e775d=function(_0x357f99){while(--_0x357f99){_0x18e196['push'](_0x18e196['shift']());}};_0x4e775d(++_0x2ddc7f);}(_0xb4d0,0xe4));var _0x0b4d=function(_0x204f31,_0x1d9b04){_0x204f31=_0x204f31-0x0;var _0x4c0106=_0xb4d0[_0x204f31];return _0x4c0106;};'use strict';var _=require('lodash');var util=require(_0x0b4d('0x0'));var moment=require(_0x0b4d('0x1'));var BPromise=require(_0x0b4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b4d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b4d('0x4'));var logger=require(_0x0b4d('0x5'))(_0x0b4d('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b4d('0x7'));var client=jayson[_0x0b4d('0x8')][_0x0b4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e5ca4,_0x5236e0,_0x2ea95f){return new BPromise(function(_0x39c4fd,_0x24d6f2){return client[_0x0b4d('0xa')](_0x1e5ca4,_0x2ea95f)[_0x0b4d('0xb')](function(_0x5cc06c){logger['info'](_0x0b4d('0xc'),_0x5236e0,_0x0b4d('0xd'));logger[_0x0b4d('0xe')](_0x0b4d('0xf'),_0x5236e0,_0x0b4d('0xd'),JSON[_0x0b4d('0x10')](_0x5cc06c));if(_0x5cc06c['error']){if(_0x5cc06c[_0x0b4d('0x11')]['code']===0x1f4){logger[_0x0b4d('0x11')](_0x0b4d('0xc'),_0x5236e0,_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);return _0x24d6f2(_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);}logger[_0x0b4d('0x11')](_0x0b4d('0xc'),_0x5236e0,_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);return _0x39c4fd(_0x5cc06c[_0x0b4d('0x11')][_0x0b4d('0x12')]);}else{logger[_0x0b4d('0x13')](_0x0b4d('0xc'),_0x5236e0,'request\x20sent');_0x39c4fd(_0x5cc06c[_0x0b4d('0x14')][_0x0b4d('0x12')]);}})[_0x0b4d('0x15')](function(_0x35386f){logger[_0x0b4d('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5236e0,_0x35386f);_0x24d6f2(_0x35386f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 55c44fc..e3fdc85 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 _0x7550=['preview','/:id/run','run','/:id/query','query','post','create','put','update','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x35cb03,_0x578e9d){var _0x696377=function(_0x318fa3){while(--_0x318fa3){_0x35cb03['push'](_0x35cb03['shift']());}};_0x696377(++_0x578e9d);}(_0x7550,0xfb));var _0x0755=function(_0x2799b0,_0x5a8089){_0x2799b0=_0x2799b0-0x0;var _0x4ebb6d=_0x7550[_0x2799b0];return _0x4ebb6d;};'use strict';var multer=require(_0x0755('0x0'));var util=require(_0x0755('0x1'));var path=require(_0x0755('0x2'));var timeout=require('connect-timeout');var express=require(_0x0755('0x3'));var router=express[_0x0755('0x4')]();var auth=require(_0x0755('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0755('0x6'));var controller=require(_0x0755('0x7'));router[_0x0755('0x8')]('/',auth[_0x0755('0x9')](),controller[_0x0755('0xa')]);router[_0x0755('0x8')](_0x0755('0xb'),auth['isAuthenticated'](),controller[_0x0755('0xc')]);router[_0x0755('0x8')]('/:id/preview',auth[_0x0755('0x9')](),controller[_0x0755('0xd')]);router['get'](_0x0755('0xe'),auth[_0x0755('0x9')](),controller[_0x0755('0xf')]);router[_0x0755('0x8')](_0x0755('0x10'),auth['isAuthenticated'](),controller[_0x0755('0x11')]);router[_0x0755('0x12')]('/',auth['isAuthenticated'](),controller[_0x0755('0x13')]);router[_0x0755('0x14')](_0x0755('0xb'),auth[_0x0755('0x9')](),controller[_0x0755('0x15')]);router['delete']('/:id',auth[_0x0755('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8cb2=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','/:id/preview','isAuthenticated','preview','run','/:id/query','query','create','put','update','delete','exports'];(function(_0x21fc96,_0x2df0fe){var _0x2e00b0=function(_0x439cde){while(--_0x439cde){_0x21fc96['push'](_0x21fc96['shift']());}};_0x2e00b0(++_0x2df0fe);}(_0x8cb2,0x14a));var _0x28cb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8cb2[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x28cb('0x0'));var util=require(_0x28cb('0x1'));var path=require(_0x28cb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x28cb('0x3')]();var auth=require(_0x28cb('0x4'));var interaction=require(_0x28cb('0x5'));var config=require(_0x28cb('0x6'));var controller=require(_0x28cb('0x7'));router[_0x28cb('0x8')]('/',auth['isAuthenticated'](),controller[_0x28cb('0x9')]);router[_0x28cb('0x8')](_0x28cb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x28cb('0x8')](_0x28cb('0xb'),auth[_0x28cb('0xc')](),controller[_0x28cb('0xd')]);router[_0x28cb('0x8')]('/:id/run',auth[_0x28cb('0xc')](),controller[_0x28cb('0xe')]);router[_0x28cb('0x8')](_0x28cb('0xf'),auth['isAuthenticated'](),controller[_0x28cb('0x10')]);router['post']('/',auth[_0x28cb('0xc')](),controller[_0x28cb('0x11')]);router[_0x28cb('0x12')](_0x28cb('0xa'),auth[_0x28cb('0xc')](),controller[_0x28cb('0x13')]);router[_0x28cb('0x14')](_0x28cb('0xa'),auth[_0x28cb('0xc')](),controller['destroy']);module[_0x28cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c60ffd4..7d9172c 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 _0x1a53=['TEXT','sequelize','exports','STRING'];(function(_0x3cd0b0,_0x67a6d6){var _0x547862=function(_0x4144ba){while(--_0x4144ba){_0x3cd0b0['push'](_0x3cd0b0['shift']());}};_0x547862(++_0x67a6d6);}(_0x1a53,0xed));var _0x31a5=function(_0x72f370,_0x2ca373){_0x72f370=_0x72f370-0x0;var _0x51ba11=_0x1a53[_0x72f370];return _0x51ba11;};'use strict';var Sequelize=require(_0x31a5('0x0'));module[_0x31a5('0x1')]={'name':{'type':Sequelize[_0x31a5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x31a5('0x2')]},'table':{'type':Sequelize[_0x31a5('0x2')]},'conditions':{'type':Sequelize[_0x31a5('0x3')]},'joins':{'type':Sequelize[_0x31a5('0x3')]}}; \ No newline at end of file +var _0x24c2=['sequelize','exports','STRING','TEXT'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x24c2,0x138));var _0x224c=function(_0x3bd4ec,_0x4cb5ce){_0x3bd4ec=_0x3bd4ec-0x0;var _0x5062dc=_0x24c2[_0x3bd4ec];return _0x5062dc;};'use strict';var Sequelize=require(_0x224c('0x0'));module[_0x224c('0x1')]={'name':{'type':Sequelize[_0x224c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x224c('0x2')]},'table':{'type':Sequelize[_0x224c('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x224c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6cb5fe1..9d05e98 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 _0xfefa=['where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','order','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','operator','table','DESC','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','default','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','child_process','../../files/reports','COUNT(*)','run','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','UserProfileResource','then','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xfefa,0xff));var _0xafef=function(_0x1fc6a6,_0x57c2e3){_0x1fc6a6=_0x1fc6a6-0x0;var _0x133140=_0xfefa[_0x1fc6a6];return _0x133140;};'use strict';var pdf=require(_0xafef('0x0'));var emlformat=require(_0xafef('0x1'));var rimraf=require(_0xafef('0x2'));var zipdir=require(_0xafef('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafef('0x4'));var moment=require(_0xafef('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xafef('0x6'));var path=require(_0xafef('0x7'));var sox=require(_0xafef('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xafef('0x9'));var squel=require(_0xafef('0xa'));var crypto=require(_0xafef('0xb'));var jsforce=require(_0xafef('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xafef('0xd'));var Redis=require('ioredis');var authService=require(_0xafef('0xe'));var qs=require(_0xafef('0xf'));var as=require(_0xafef('0x10'));var hardwareService=require(_0xafef('0x11'));var logger=require(_0xafef('0x12'))(_0xafef('0x13'));var utils=require('../../config/utils');var config=require(_0xafef('0x14'));var db=require(_0xafef('0x15'))['db'];var dbH=require('../../mysqldb')[_0xafef('0x16')];function respondWithStatusCode(_0x4bc795,_0x3f37c9){_0x3f37c9=_0x3f37c9||0xcc;return function(_0xcf8f55){if(_0xcf8f55){return _0x4bc795[_0xafef('0x17')](_0x3f37c9);}return _0x4bc795[_0xafef('0x18')](_0x3f37c9)[_0xafef('0x19')]();};}function respondWithResult(_0x45c413,_0x1b1787){_0x1b1787=_0x1b1787||0xc8;return function(_0x5516fd){if(_0x5516fd){return _0x45c413[_0xafef('0x18')](_0x1b1787)[_0xafef('0x1a')](_0x5516fd);}};}function respondWithFilteredResult(_0x35c46b,_0xaaade1){return function(_0x20ddeb){if(_0x20ddeb){var _0x50450c=_0x20ddeb[_0xafef('0x1b')],_0x577c75=_0xaaade1[_0xafef('0x1c')],_0x23bffe=_0xaaade1[_0xafef('0x1c')]+_0xaaade1[_0xafef('0x1d')],_0x130f70;if(_0x23bffe>=_0x50450c){_0x23bffe=_0x50450c;_0x130f70=0xc8;}else{_0x130f70=0xce;}_0x35c46b[_0xafef('0x18')](_0x130f70);return _0x35c46b[_0xafef('0x1e')](_0xafef('0x1f'),_0x577c75+'-'+_0x23bffe+'/'+_0x50450c)[_0xafef('0x1a')](_0x20ddeb);}return null;};}function patchUpdates(_0x469563){return function(_0x14a26d){try{jsonpatch[_0xafef('0x20')](_0x14a26d,_0x469563,!![]);}catch(_0x2f709c){return BPromise['reject'](_0x2f709c);}return _0x14a26d['save']();};}function saveUpdates(_0x525bb5,_0x3b29fc){return function(_0x42bb12){if(_0x42bb12){return _0x42bb12[_0xafef('0x21')](_0x525bb5)['then'](function(_0x1417bf){return _0x1417bf;});}return null;};}function removeEntity(_0x5837cd,_0x492aaf){return function(_0x5c9684){if(_0x5c9684){return _0x5c9684[_0xafef('0x22')]()['then'](function(){var _0x2b2dcd=_0x5c9684['get']({'plain':!![]});var _0x342127='DefaultReports';return db[_0xafef('0x23')][_0xafef('0x22')]({'where':{'type':_0x342127,'resourceId':_0x2b2dcd['id']}})[_0xafef('0x24')](function(){return _0x5c9684;});})[_0xafef('0x24')](function(){_0x5837cd[_0xafef('0x18')](0xcc)[_0xafef('0x19')]();});}};}function handleEntityNotFound(_0x2844c1,_0x22de9c){return function(_0x207e0d){if(!_0x207e0d){_0x2844c1[_0xafef('0x17')](0x194);}return _0x207e0d;};}function handleError(_0x1732d7,_0x4edefa){_0x4edefa=_0x4edefa||0x1f4;return function(_0x158aa3){logger[_0xafef('0x25')](_0x158aa3[_0xafef('0x26')]);if(_0x158aa3[_0xafef('0x27')]){delete _0x158aa3[_0xafef('0x27')];}_0x1732d7['status'](_0x4edefa)[_0xafef('0x28')](_0x158aa3);};}exports['index']=function(_0x3893de,_0x375fd2){var _0x1e7ce7={},_0x42351e={},_0x1ba917={'count':0x0,'rows':[]};var _0x356e8a=_[_0xafef('0x29')](db[_0xafef('0x2a')][_0xafef('0x2b')],function(_0x387125){return{'name':_0x387125['fieldName'],'type':_0x387125['type'][_0xafef('0x2c')]};});_0x42351e[_0xafef('0x2d')]=_['map'](_0x356e8a,_0xafef('0x27'));_0x42351e[_0xafef('0x2e')]=_[_0xafef('0x2f')](_0x3893de[_0xafef('0x2e')]);_0x42351e[_0xafef('0x30')]=_[_0xafef('0x31')](_0x42351e[_0xafef('0x2d')],_0x42351e[_0xafef('0x2e')]);_0x1e7ce7[_0xafef('0x32')]=_['intersection'](_0x42351e[_0xafef('0x2d')],qs['fields'](_0x3893de['query'][_0xafef('0x33')]));_0x1e7ce7['attributes']=_0x1e7ce7[_0xafef('0x32')][_0xafef('0x34')]?_0x1e7ce7['attributes']:_0x42351e['model'];if(!_0x3893de[_0xafef('0x2e')]['hasOwnProperty'](_0xafef('0x35'))){_0x1e7ce7[_0xafef('0x1d')]=qs[_0xafef('0x1d')](_0x3893de['query'][_0xafef('0x1d')]);_0x1e7ce7[_0xafef('0x1c')]=qs['offset'](_0x3893de['query'][_0xafef('0x1c')]);}_0x1e7ce7['order']=qs[_0xafef('0x36')](_0x3893de[_0xafef('0x2e')][_0xafef('0x36')]);_0x1e7ce7[_0xafef('0x37')]=qs[_0xafef('0x30')](_[_0xafef('0x38')](_0x3893de[_0xafef('0x2e')],_0x42351e[_0xafef('0x30')]),_0x356e8a);if(_0x3893de[_0xafef('0x2e')][_0xafef('0x39')]){_0x1e7ce7['where']=_['merge'](_0x1e7ce7[_0xafef('0x37')],{'$or':_['map'](_0x356e8a,function(_0x12c42e){if(_0x12c42e[_0xafef('0x3a')]!==_0xafef('0x3b')){var _0x415343={};_0x415343[_0x12c42e[_0xafef('0x27')]]={'$like':'%'+_0x3893de[_0xafef('0x2e')]['filter']+'%'};return _0x415343;}})});}_0x1e7ce7=_[_0xafef('0x3c')]({},_0x1e7ce7,_0x3893de[_0xafef('0x3d')]);var _0x163e07={'where':_0x1e7ce7[_0xafef('0x37')]};return db[_0xafef('0x2a')][_0xafef('0x1b')](_0x163e07)[_0xafef('0x24')](function(_0x355786){_0x1ba917[_0xafef('0x1b')]=_0x355786;if(_0x3893de[_0xafef('0x2e')][_0xafef('0x3e')]){_0x1e7ce7[_0xafef('0x3f')]=[{'all':!![]}];}return db[_0xafef('0x2a')][_0xafef('0x40')](_0x1e7ce7);})['then'](function(_0x114568){_0x1ba917[_0xafef('0x41')]=_0x114568;return _0x1ba917;})[_0xafef('0x24')](respondWithFilteredResult(_0x375fd2,_0x1e7ce7))[_0xafef('0x42')](handleError(_0x375fd2,null));};exports['show']=function(_0x5ca073,_0x15ef41){var _0x5b832a={'raw':!![],'where':{'id':_0x5ca073[_0xafef('0x43')]['id']}},_0x1aafab={};_0x1aafab[_0xafef('0x2d')]=_[_0xafef('0x2f')](db[_0xafef('0x2a')][_0xafef('0x2b')]);_0x1aafab[_0xafef('0x2e')]=_[_0xafef('0x2f')](_0x5ca073[_0xafef('0x2e')]);_0x1aafab[_0xafef('0x30')]=_[_0xafef('0x31')](_0x1aafab[_0xafef('0x2d')],_0x1aafab[_0xafef('0x2e')]);_0x5b832a[_0xafef('0x32')]=_[_0xafef('0x31')](_0x1aafab[_0xafef('0x2d')],qs[_0xafef('0x33')](_0x5ca073[_0xafef('0x2e')][_0xafef('0x33')]));_0x5b832a['attributes']=_0x5b832a[_0xafef('0x32')][_0xafef('0x34')]?_0x5b832a[_0xafef('0x32')]:_0x1aafab['model'];if(_0x5ca073[_0xafef('0x2e')][_0xafef('0x3e')]){_0x5b832a[_0xafef('0x3f')]=[{'all':!![]}];}_0x5b832a=_['merge']({},_0x5b832a,_0x5ca073['options']);return db[_0xafef('0x2a')]['find'](_0x5b832a)[_0xafef('0x24')](handleEntityNotFound(_0x15ef41,null))['then'](respondWithResult(_0x15ef41,null))[_0xafef('0x42')](handleError(_0x15ef41,null));};exports[_0xafef('0x44')]=function(_0xae2d7e,_0x5530e9){return db[_0xafef('0x2a')][_0xafef('0x44')](_0xae2d7e[_0xafef('0x45')],{})['then'](function(_0x11ce6d){var _0x4819ee=_0xae2d7e['user']['get']({'plain':!![]});if(!_0x4819ee)throw new Error(_0xafef('0x46'));if(_0x4819ee[_0xafef('0x47')]==='user'){var _0x1fc54d=_0x11ce6d['get']({'plain':!![]});var _0x234847=_0xafef('0x48');return db[_0xafef('0x49')][_0xafef('0x4a')]({'where':{'name':_0x234847,'userProfileId':_0x4819ee[_0xafef('0x4b')]},'raw':!![]})['then'](function(_0x54bbee){if(_0x54bbee&&_0x54bbee[_0xafef('0x4c')]===0x0){return db[_0xafef('0x23')][_0xafef('0x44')]({'name':_0x1fc54d['name'],'resourceId':_0x1fc54d['id'],'type':_0xafef('0x4d'),'sectionId':_0x54bbee['id']},{})[_0xafef('0x24')](function(){return _0x11ce6d;});}else{return _0x11ce6d;}})['catch'](function(_0x55cbc3){logger[_0xafef('0x25')](_0xafef('0x4e'),_0x55cbc3);throw _0x55cbc3;});}return _0x11ce6d;})[_0xafef('0x24')](respondWithResult(_0x5530e9,0xc9))[_0xafef('0x42')](handleError(_0x5530e9,null));};exports[_0xafef('0x21')]=function(_0x21b9c7,_0x41bfe1){if(_0x21b9c7['body']['id']){delete _0x21b9c7[_0xafef('0x45')]['id'];}return db[_0xafef('0x2a')]['find']({'where':{'id':_0x21b9c7[_0xafef('0x43')]['id']}})['then'](handleEntityNotFound(_0x41bfe1,null))[_0xafef('0x24')](saveUpdates(_0x21b9c7['body'],null))[_0xafef('0x24')](respondWithResult(_0x41bfe1,null))[_0xafef('0x42')](handleError(_0x41bfe1,null));};exports['destroy']=function(_0x492265,_0x1423d5){return db[_0xafef('0x2a')][_0xafef('0x4a')]({'where':{'id':_0x492265[_0xafef('0x43')]['id']}})['then'](handleEntityNotFound(_0x1423d5,null))[_0xafef('0x24')](removeEntity(_0x1423d5,null))[_0xafef('0x42')](handleError(_0x1423d5,null));};exports['preview']=function(_0x5ed0b4,_0x44f0a2){var _0xd4e54=0xa;var _0x4bfdc2=[_0xafef('0x4f'),_0xafef('0x50'),'right_join',_0xafef('0x51')];var _0x43c440={'SUM':'SUM(%s)','COUNT':_0xafef('0x52'),'COUNT DISTINCT':_0xafef('0x53'),'MAX':_0xafef('0x54'),'MIN':_0xafef('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xafef('0x56')};var _0x9c8c42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xafef('0x57'),'HOUR':_0xafef('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xafef('0x59')};var _0x6c9977=function(_0x390010){return!_['includes']([_0xafef('0x5a'),_0xafef('0x5b'),_0xafef('0x5c'),_0xafef('0x5d')],_0x390010);};var _0x45e42c=function(_0x26a58d){if(!_0x26a58d||!_0x26a58d[_0xafef('0x5e')][_0xafef('0x34')]){return'';}for(var _0x3fc211='(',_0x5ecb94=0x0;_0x5ecb94<_0x26a58d[_0xafef('0x5e')][_0xafef('0x34')];_0x5ecb94+=0x1){_0x5ecb94>0x0&&(_0x3fc211+='\x20'+_0x26a58d['operator']+'\x20');_0x3fc211+=_0x26a58d[_0xafef('0x5e')][_0x5ecb94][_0xafef('0x5f')]?_0x45e42c(_0x26a58d[_0xafef('0x5e')][_0x5ecb94]['group']):_0x26a58d[_0xafef('0x5e')][_0x5ecb94][_0xafef('0x60')]+'\x20'+_0x26a58d['rules'][_0x5ecb94][_0xafef('0x61')]+(_0x6c9977(_0x26a58d['rules'][_0x5ecb94][_0xafef('0x61')])?'\x20'+_0x26a58d[_0xafef('0x5e')][_0x5ecb94][_0xafef('0x62')]:'');}return _0x3fc211+')';};var _0x389a4e={'where':{'id':_0x5ed0b4['params']['id']}},_0x544a84,_0x210288,_0x18fed5,_0x574e13,_0x4766e6;_0x389a4e=_[_0xafef('0x3c')]({},_0x389a4e,_0x5ed0b4[_0xafef('0x3d')]);return db[_0xafef('0x2a')]['find'](_0x389a4e)['then'](function(_0x359b8f){if(_0x359b8f){_0x544a84=_0x359b8f;return _0x359b8f[_0xafef('0x63')]();}return null;})[_0xafef('0x24')](function(_0x26173d){if(_0x26173d){if(!_0x26173d[_0xafef('0x34')]){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x66'),0x193);}_0x210288=_0x26173d;return db[_0xafef('0x67')][_0xafef('0x40')]({'raw':!![]});}return null;})[_0xafef('0x24')](function(_0x5256a6){if(_0x5256a6){_0x18fed5=_[_0xafef('0x68')](_0x5256a6,'id');var _0x59262a;var _0x424a69=squel[_0xafef('0x69')]();_0x424a69[_0xafef('0x6a')](_0x544a84['table']);for(var _0x4ad3bb=0x0;_0x4ad3bb<_0x210288[_0xafef('0x34')];_0x4ad3bb+=0x1){_0x59262a=_0x210288[_0x4ad3bb][_0xafef('0x6b')]?_0x18fed5[_0x210288[_0x4ad3bb][_0xafef('0x6b')]][_0xafef('0x6c')]:_0x210288[_0x4ad3bb][_0xafef('0x60')];_0x59262a=_0x210288[_0x4ad3bb][_0xafef('0x6d')]?_[_0xafef('0x6e')](_0x43c440[_0x210288[_0x4ad3bb]['function']],'%s',_0x59262a):_0x59262a;_0x59262a=_0x210288[_0x4ad3bb][_0xafef('0x6f')]?_[_0xafef('0x6e')](_0x9c8c42[_0x210288[_0x4ad3bb]['format']],'%s',_0x59262a):_0x59262a;if(_0x210288[_0x4ad3bb][_0xafef('0x70')]){_0x424a69[_0xafef('0x5f')](_0x59262a);}_0x210288[_0x4ad3bb][_0xafef('0x71')]&&_0x424a69[_0xafef('0x72')](_0x59262a,_0x210288[_0x4ad3bb][_0xafef('0x71')]==='DESC'?![]:!![]);_0x424a69[_0xafef('0x60')](_0x59262a,_0x210288[_0x4ad3bb]['alias']||_0x59262a);}if(_0x544a84[_0xafef('0x73')]){_0x544a84['joins']=JSON[_0xafef('0x74')](_0x544a84[_0xafef('0x73')]);for(var _0x3ce8c5=0x0;_0x3ce8c5<_0x544a84['joins'][_0xafef('0x34')];_0x3ce8c5+=0x1){if(_0x544a84['joins'][_0x3ce8c5][_0xafef('0x3a')]&&_[_0xafef('0x75')](_0x4bfdc2,_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x3a')])&&_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x76')]&&_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x77')]&&_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x78')]){_0x424a69[_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x3a')]](_0x544a84['joins'][_0x3ce8c5][_0xafef('0x77')],null,util[_0xafef('0x6f')](_0xafef('0x79'),_0x544a84['table'],_0x544a84['joins'][_0x3ce8c5][_0xafef('0x76')],_0x544a84[_0xafef('0x73')][_0x3ce8c5][_0xafef('0x77')],_0x544a84['joins'][_0x3ce8c5]['foreignKey']));}}}if(_0x544a84[_0xafef('0x7a')]){_0x544a84[_0xafef('0x7a')]=JSON['parse'](_0x544a84['conditions']);_0x424a69['where'](_0x45e42c(_0x544a84[_0xafef('0x7a')][_0xafef('0x5f')]));}_0x4766e6=_0x424a69[_0xafef('0x7b')]();_0x424a69[_0xafef('0x1d')](_0xd4e54);_0x424a69['offset'](0x0);logger[_0xafef('0x7c')](_0xafef('0x7d'),_0x424a69[_0xafef('0x7e')]());return db[_0xafef('0x7f')][_0xafef('0x2e')](_0x424a69[_0xafef('0x7e')](),{'type':db[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});}})[_0xafef('0x24')](respondWithResult(_0x44f0a2,null))[_0xafef('0x42')](handleError(_0x44f0a2,null));};function runReport(_0xa70c2e,_0x1eff52,_0xc7f62){var _0x5ab896=_0x1eff52[_0xafef('0x27')];var _0xbf8c9f=0xa;var _0x59b25d=[_0xafef('0x4f'),_0xafef('0x50'),_0xafef('0x82'),'cross_join'];var _0x44c29a={'SUM':_0xafef('0x83'),'COUNT':_0xafef('0x52'),'COUNT DISTINCT':_0xafef('0x53'),'MAX':_0xafef('0x54'),'MIN':_0xafef('0x55'),'AVG':_0xafef('0x84'),'GROUP_CONCAT':_0xafef('0x85'),'GROUP_CONCAT ASC':_0xafef('0x86'),'GROUP_CONCAT DESC':_0xafef('0x56')};var _0x59ef3c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xafef('0x58'),'ROUND':_0xafef('0x87'),'UNIX_TIMESTAMP':_0xafef('0x59')};var _0x4f9a72=function(_0x336b53){return!_[_0xafef('0x75')](['IS\x20NULL',_0xafef('0x5b'),_0xafef('0x5c'),'IS\x20NOT\x20EMPTY'],_0x336b53);};var _0x9cf618=function(_0x881f89){if(!_0x881f89||!_0x881f89[_0xafef('0x5e')][_0xafef('0x34')]){return'';}for(var _0x36e831='(',_0x28eddb=0x0;_0x28eddb<_0x881f89[_0xafef('0x5e')][_0xafef('0x34')];_0x28eddb+=0x1){_0x28eddb>0x0&&(_0x36e831+='\x20'+_0x881f89[_0xafef('0x88')]+'\x20');_0x36e831+=_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x5f')]?_0x9cf618(_0x881f89['rules'][_0x28eddb][_0xafef('0x5f')]):_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x60')]+'\x20'+_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x61')]+(_0x4f9a72(_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x61')])?'\x20'+_0x881f89[_0xafef('0x5e')][_0x28eddb][_0xafef('0x62')]:'');}return _0x36e831+')';};var _0x2797a3={'where':{'id':_0xa70c2e['id']}},_0x10dc7a,_0x4a5441,_0x2b5ca4,_0x3217a8,_0x23562a;_0x2797a3=_[_0xafef('0x3c')]({},_0x2797a3,_0xc7f62);return db[_0xafef('0x2a')][_0xafef('0x4a')](_0x2797a3)[_0xafef('0x24')](function(_0x416de5){if(_0x416de5){_0x10dc7a=_0x416de5;return _0x416de5['getFields']();}return null;})[_0xafef('0x24')](function(_0x15cc3d){if(_0x15cc3d){if(!_0x15cc3d[_0xafef('0x34')]){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x66'),0x193);}_0x4a5441=_0x15cc3d;return db[_0xafef('0x67')][_0xafef('0x40')]({'raw':!![]});}return null;})[_0xafef('0x24')](function(_0x5e793d){if(_0x5e793d){_0x2b5ca4=_['keyBy'](_0x5e793d,'id');var _0x57b506;var _0x4850f0=squel[_0xafef('0x69')]();_0x4850f0['from'](_0x10dc7a[_0xafef('0x89')]);for(var _0x186ba0=0x0;_0x186ba0<_0x4a5441[_0xafef('0x34')];_0x186ba0+=0x1){_0x57b506=_0x4a5441[_0x186ba0][_0xafef('0x6b')]?_0x2b5ca4[_0x4a5441[_0x186ba0][_0xafef('0x6b')]][_0xafef('0x6c')]:_0x4a5441[_0x186ba0][_0xafef('0x60')];_0x57b506=_0x4a5441[_0x186ba0][_0xafef('0x6d')]?_[_0xafef('0x6e')](_0x44c29a[_0x4a5441[_0x186ba0][_0xafef('0x6d')]],'%s',_0x57b506):_0x57b506;_0x57b506=_0x4a5441[_0x186ba0][_0xafef('0x6f')]?_[_0xafef('0x6e')](_0x59ef3c[_0x4a5441[_0x186ba0]['format']],'%s',_0x57b506):_0x57b506;if(_0x4a5441[_0x186ba0][_0xafef('0x70')]){_0x4850f0[_0xafef('0x5f')](_0x57b506);}_0x4a5441[_0x186ba0][_0xafef('0x71')]&&_0x4850f0[_0xafef('0x72')](_0x57b506,_0x4a5441[_0x186ba0]['orderBy']===_0xafef('0x8a')?![]:!![]);_0x4850f0[_0xafef('0x60')](_0x57b506,_0x4a5441[_0x186ba0]['alias']||_0x57b506);}if(_0x10dc7a[_0xafef('0x73')]){_0x10dc7a[_0xafef('0x73')]=JSON[_0xafef('0x74')](_0x10dc7a[_0xafef('0x73')]);for(var _0x3784eb=0x0;_0x3784eb<_0x10dc7a[_0xafef('0x73')][_0xafef('0x34')];_0x3784eb+=0x1){if(_0x10dc7a['joins'][_0x3784eb][_0xafef('0x3a')]&&_[_0xafef('0x75')](_0x59b25d,_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x3a')])&&_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x76')]&&_0x10dc7a['joins'][_0x3784eb][_0xafef('0x77')]&&_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x78')]){_0x4850f0[_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x3a')]](_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x77')],null,util[_0xafef('0x6f')](_0xafef('0x79'),_0x10dc7a[_0xafef('0x89')],_0x10dc7a[_0xafef('0x73')][_0x3784eb]['parentKey'],_0x10dc7a['joins'][_0x3784eb]['foreignTable'],_0x10dc7a[_0xafef('0x73')][_0x3784eb][_0xafef('0x78')]));}}}if(_0x10dc7a[_0xafef('0x7a')]){_0x10dc7a[_0xafef('0x7a')]=JSON[_0xafef('0x74')](_0x10dc7a[_0xafef('0x7a')]);_0x4850f0[_0xafef('0x37')](_0x9cf618(_0x10dc7a[_0xafef('0x7a')]['group']));}_0x23562a=_0x4850f0['clone']();_0x4850f0[_0xafef('0x1d')](_0xbf8c9f);_0x4850f0[_0xafef('0x1c')](0x0);logger[_0xafef('0x7c')](_0xafef('0x7d'),_0x4850f0['toString']());return db[_0xafef('0x7f')][_0xafef('0x2e')](_0x4850f0['toString'](),{'type':db[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});}})[_0xafef('0x24')](function(_0x295975){if(!_0x295975[_0xafef('0x34')]){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x8b'),0xcc);}if(_0x1eff52[_0xafef('0x8c')]===_0xafef('0x8d')){return null;}var _0x5500b3=_['merge'](_0x1eff52,{'name':_0x1eff52['fullPath']||_0x1eff52['name']||_0x10dc7a['name'],'basename':_0x5ab896,'savename':util['format'](_0xafef('0x8e'),_0x1eff52[_0xafef('0x27')]||_0x10dc7a[_0xafef('0x27')],require(_0xafef('0x8f'))[_0xafef('0x90')](0x4),_0x1eff52['output']||_0xafef('0x91')),'reportId':_0x10dc7a['id'],'reportType':_0xafef('0x92')});return db['AnalyticExtractedReport'][_0xafef('0x44')](_0x5500b3,{'raw':!![]});})[_0xafef('0x24')](function(_0x1793d6){if(_0x10dc7a[_0xafef('0x89')]===_0xafef('0x93')){_0x23562a['where'](_0x10dc7a[_0xafef('0x89')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1eff52['startDate'],_0x1eff52[_0xafef('0x94')]);}else{_0x23562a[_0xafef('0x37')](_0x10dc7a[_0xafef('0x89')]+_0xafef('0x95'),_0x1eff52[_0xafef('0x96')],_0x1eff52[_0xafef('0x94')]);}if(_0x1793d6){logger['info']('Run\x20Query:',_0x23562a['toString']());require(_0xafef('0x97'))['fork'](path['join'](__dirname,'../../components/export/',_0x1793d6['output']),[_0x1793d6['id'],_0x23562a[_0xafef('0x7e')](),path[_0xafef('0x4f')](__dirname,_0xafef('0x98'),_0x1793d6['savename']),_0x5ab896]);return _0x1793d6;}else{var _0x16801d=squel['select']();_0x16801d[_0xafef('0x6a')]('('+_0x23562a[_0xafef('0x7e')]()+')','countTable');_0x16801d['field'](_0xafef('0x99'),_0xafef('0x1b'));_0x23562a[_0xafef('0x1d')](_0x1eff52[_0xafef('0x1d')]||_0xbf8c9f);_0x23562a['offset'](_0x1eff52[_0xafef('0x1c')]||0x0);return dbH[_0xafef('0x7f')][_0xafef('0x2e')](_0x16801d[_0xafef('0x7e')](),{'type':dbH[_0xafef('0x7f')][_0xafef('0x80')]['SELECT']})[_0xafef('0x24')](function(_0x62f174){if(!_0x62f174[_0xafef('0x34')]){_0x3217a8=0x0;}else{_0x3217a8=_0x62f174[0x0][_0xafef('0x1b')]||0x0;}return dbH[_0xafef('0x7f')][_0xafef('0x2e')](_0x23562a['toString'](),{'type':dbH[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});})[_0xafef('0x24')](function(_0xe4af65){return{'rows':_0xe4af65||[],'count':_0x3217a8};});}});}exports[_0xafef('0x9a')]=function(_0x3679eb,_0x2f8621){return runReport(_0x3679eb['params'],_0x3679eb[_0xafef('0x2e')],_0x3679eb['options'])[_0xafef('0x24')](respondWithResult(_0x2f8621,null))[_0xafef('0x42')](handleError(_0x2f8621,null));};exports['runReport']=runReport;exports['query']=function(_0x5d5508,_0x396395){var _0x299244=0xa;var _0x1d0e05=['join',_0xafef('0x50'),'right_join',_0xafef('0x51')];var _0xdd596c={'SUM':'SUM(%s)','COUNT':_0xafef('0x52'),'COUNT DISTINCT':_0xafef('0x53'),'MAX':'MAX(%s)','MIN':_0xafef('0x55'),'AVG':_0xafef('0x84'),'GROUP_CONCAT':_0xafef('0x85'),'GROUP_CONCAT ASC':_0xafef('0x86'),'GROUP_CONCAT DESC':_0xafef('0x56')};var _0x3c2ec9={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xafef('0x57'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xafef('0x59')};var _0x1a8540=function(_0x3cfd10){return!_[_0xafef('0x75')]([_0xafef('0x5a'),_0xafef('0x5b'),_0xafef('0x5c'),_0xafef('0x5d')],_0x3cfd10);};var _0x136e5e=function(_0x483d5e){if(!_0x483d5e||!_0x483d5e[_0xafef('0x5e')]['length']){return'';}for(var _0x1e7f3c='(',_0x249ed0=0x0;_0x249ed0<_0x483d5e[_0xafef('0x5e')][_0xafef('0x34')];_0x249ed0+=0x1){_0x249ed0>0x0&&(_0x1e7f3c+='\x20'+_0x483d5e[_0xafef('0x88')]+'\x20');_0x1e7f3c+=_0x483d5e[_0xafef('0x5e')][_0x249ed0]['group']?_0x136e5e(_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x5f')]):_0x483d5e['rules'][_0x249ed0][_0xafef('0x60')]+'\x20'+_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x61')]+(_0x1a8540(_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x61')])?'\x20'+_0x483d5e[_0xafef('0x5e')][_0x249ed0][_0xafef('0x62')]:'');}return _0x1e7f3c+')';};var _0x4d1b86={'where':{'id':_0x5d5508[_0xafef('0x43')]['id']}},_0x54e778,_0xa4cac2,_0x4313f6,_0x46e4d4,_0x4e9026;_0x4d1b86=_[_0xafef('0x3c')]({},_0x4d1b86,_0x5d5508[_0xafef('0x3d')]);return db['AnalyticDefaultReport'][_0xafef('0x4a')](_0x4d1b86)[_0xafef('0x24')](function(_0x41b8bc){if(_0x41b8bc){_0x54e778=_0x41b8bc;return _0x41b8bc[_0xafef('0x63')]();}return null;})[_0xafef('0x24')](function(_0x2f40dd){if(_0x2f40dd){if(!_0x2f40dd['length']){throw new db[(_0xafef('0x64'))][(_0xafef('0x65'))](_0xafef('0x66'),0x193);}_0xa4cac2=_0x2f40dd;return db[_0xafef('0x67')][_0xafef('0x40')]({'raw':!![]});}return null;})['then'](function(_0x2b3791){if(_0x2b3791){_0x4313f6=_[_0xafef('0x68')](_0x2b3791,'id');var _0xe53431;var _0x3a14bc=squel[_0xafef('0x69')]();_0x3a14bc[_0xafef('0x6a')](_0x54e778[_0xafef('0x89')]);for(var _0x1e588a=0x0;_0x1e588a<_0xa4cac2[_0xafef('0x34')];_0x1e588a+=0x1){_0xe53431=_0xa4cac2[_0x1e588a][_0xafef('0x6b')]?_0x4313f6[_0xa4cac2[_0x1e588a][_0xafef('0x6b')]][_0xafef('0x6c')]:_0xa4cac2[_0x1e588a][_0xafef('0x60')];_0xe53431=_0xa4cac2[_0x1e588a][_0xafef('0x6d')]?_[_0xafef('0x6e')](_0xdd596c[_0xa4cac2[_0x1e588a][_0xafef('0x6d')]],'%s',_0xe53431):_0xe53431;_0xe53431=_0xa4cac2[_0x1e588a]['format']?_[_0xafef('0x6e')](_0x3c2ec9[_0xa4cac2[_0x1e588a]['format']],'%s',_0xe53431):_0xe53431;if(_0xa4cac2[_0x1e588a][_0xafef('0x70')]){_0x3a14bc[_0xafef('0x5f')](_0xe53431);}_0xa4cac2[_0x1e588a][_0xafef('0x71')]&&_0x3a14bc[_0xafef('0x72')](_0xe53431,_0xa4cac2[_0x1e588a][_0xafef('0x71')]===_0xafef('0x8a')?![]:!![]);_0x3a14bc[_0xafef('0x60')](_0xe53431,_0xa4cac2[_0x1e588a]['alias']||_0xe53431);}if(_0x54e778[_0xafef('0x73')]){_0x54e778[_0xafef('0x73')]=JSON[_0xafef('0x74')](_0x54e778[_0xafef('0x73')]);for(var _0x1a63c5=0x0;_0x1a63c5<_0x54e778[_0xafef('0x73')]['length'];_0x1a63c5+=0x1){if(_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x3a')]&&_[_0xafef('0x75')](_0x1d0e05,_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x3a')])&&_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x76')]&&_0x54e778['joins'][_0x1a63c5][_0xafef('0x77')]&&_0x54e778[_0xafef('0x73')][_0x1a63c5][_0xafef('0x78')]){_0x3a14bc[_0x54e778['joins'][_0x1a63c5][_0xafef('0x3a')]](_0x54e778[_0xafef('0x73')][_0x1a63c5]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x54e778['table'],_0x54e778[_0xafef('0x73')][_0x1a63c5]['parentKey'],_0x54e778['joins'][_0x1a63c5][_0xafef('0x77')],_0x54e778['joins'][_0x1a63c5]['foreignKey']));}}}if(_0x54e778['conditions']){_0x54e778['conditions']=JSON[_0xafef('0x74')](_0x54e778[_0xafef('0x7a')]);_0x3a14bc[_0xafef('0x37')](_0x136e5e(_0x54e778['conditions'][_0xafef('0x5f')]));}_0x4e9026=_0x3a14bc['clone']();_0x3a14bc[_0xafef('0x1d')](_0x299244);_0x3a14bc['offset'](0x0);logger[_0xafef('0x7c')]('Limited\x20Query:',_0x3a14bc['toString']());return db['sequelize'][_0xafef('0x2e')](_0x3a14bc[_0xafef('0x7e')](),{'type':db[_0xafef('0x7f')][_0xafef('0x80')][_0xafef('0x81')]});}})['then'](function(){return{'sql':_0x4e9026['toString']()};})[_0xafef('0x24')](respondWithResult(_0x396395,null))['catch'](handleError(_0x396395,null));}; \ No newline at end of file +var _0x43d8=['%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','operator','value','getFields','ValidationErrorItem','AnalyticMetric','metric','No\x20available\x20data','output','web','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','savename','COUNT(*)','runReport','SEC_TO_TIME(%s)','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Reports','UserProfileSection','userProfileId','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','from','table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','foreignKey','foreignTable'];(function(_0x10d73c,_0x29a737){var _0x283c9e=function(_0x6ab160){while(--_0x6ab160){_0x10d73c['push'](_0x10d73c['shift']());}};_0x283c9e(++_0x29a737);}(_0x43d8,0xc0));var _0x843d=function(_0x5303b9,_0x5c548){_0x5303b9=_0x5303b9-0x0;var _0x455125=_0x43d8[_0x5303b9];return _0x455125;};'use strict';var pdf=require(_0x843d('0x0'));var emlformat=require(_0x843d('0x1'));var rimraf=require(_0x843d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x843d('0x3'));var moment=require(_0x843d('0x4'));var BPromise=require(_0x843d('0x5'));var Mustache=require(_0x843d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x843d('0x7'));var csv=require(_0x843d('0x8'));var ejs=require(_0x843d('0x9'));var fs=require('fs');var _=require(_0x843d('0xa'));var squel=require('squel');var crypto=require(_0x843d('0xb'));var jsforce=require(_0x843d('0xc'));var deskjs=require(_0x843d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x843d('0xe'));var authService=require(_0x843d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x843d('0x10'));var hardwareService=require(_0x843d('0x11'));var logger=require('../../config/logger')(_0x843d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x843d('0x13'))['db'];var dbH=require(_0x843d('0x13'))[_0x843d('0x14')];function respondWithStatusCode(_0xc632c,_0x461d25){_0x461d25=_0x461d25||0xcc;return function(_0x534ac7){if(_0x534ac7){return _0xc632c[_0x843d('0x15')](_0x461d25);}return _0xc632c[_0x843d('0x16')](_0x461d25)[_0x843d('0x17')]();};}function respondWithResult(_0x282d20,_0x88d58e){_0x88d58e=_0x88d58e||0xc8;return function(_0x3c759d){if(_0x3c759d){return _0x282d20[_0x843d('0x16')](_0x88d58e)[_0x843d('0x18')](_0x3c759d);}};}function respondWithFilteredResult(_0x521285,_0x36663d){return function(_0xf4efa9){if(_0xf4efa9){var _0x38f1fd=_0xf4efa9[_0x843d('0x19')],_0x4b1cd0=_0x36663d[_0x843d('0x1a')],_0x1b8695=_0x36663d[_0x843d('0x1a')]+_0x36663d[_0x843d('0x1b')],_0x49bafb;if(_0x1b8695>=_0x38f1fd){_0x1b8695=_0x38f1fd;_0x49bafb=0xc8;}else{_0x49bafb=0xce;}_0x521285[_0x843d('0x16')](_0x49bafb);return _0x521285[_0x843d('0x1c')]('Content-Range',_0x4b1cd0+'-'+_0x1b8695+'/'+_0x38f1fd)[_0x843d('0x18')](_0xf4efa9);}return null;};}function patchUpdates(_0x324d9b){return function(_0x38199b){try{jsonpatch['apply'](_0x38199b,_0x324d9b,!![]);}catch(_0x1c1848){return BPromise[_0x843d('0x1d')](_0x1c1848);}return _0x38199b[_0x843d('0x1e')]();};}function saveUpdates(_0x5443dc,_0x47a787){return function(_0xac23a6){if(_0xac23a6){return _0xac23a6['update'](_0x5443dc)[_0x843d('0x1f')](function(_0x1aaa68){return _0x1aaa68;});}return null;};}function removeEntity(_0x577997,_0x13e5ed){return function(_0x44f692){if(_0x44f692){return _0x44f692['destroy']()['then'](function(){var _0x2b6c1d=_0x44f692[_0x843d('0x20')]({'plain':!![]});var _0x1d8500='DefaultReports';return db[_0x843d('0x21')]['destroy']({'where':{'type':_0x1d8500,'resourceId':_0x2b6c1d['id']}})['then'](function(){return _0x44f692;});})[_0x843d('0x1f')](function(){_0x577997[_0x843d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1831e5,_0xa74ffd){return function(_0x5c32fb){if(!_0x5c32fb){_0x1831e5[_0x843d('0x15')](0x194);}return _0x5c32fb;};}function handleError(_0x1376f7,_0x377745){_0x377745=_0x377745||0x1f4;return function(_0x140748){logger[_0x843d('0x22')](_0x140748[_0x843d('0x23')]);if(_0x140748[_0x843d('0x24')]){delete _0x140748[_0x843d('0x24')];}_0x1376f7[_0x843d('0x16')](_0x377745)[_0x843d('0x25')](_0x140748);};}exports[_0x843d('0x26')]=function(_0x40a34b,_0x93e100){var _0x4a3847={},_0x430782={},_0x10bab0={'count':0x0,'rows':[]};var _0x2932c5=_[_0x843d('0x27')](db[_0x843d('0x28')][_0x843d('0x29')],function(_0x112f83){return{'name':_0x112f83['fieldName'],'type':_0x112f83[_0x843d('0x2a')][_0x843d('0x2b')]};});_0x430782[_0x843d('0x2c')]=_[_0x843d('0x27')](_0x2932c5,_0x843d('0x24'));_0x430782['query']=_['keys'](_0x40a34b[_0x843d('0x2d')]);_0x430782[_0x843d('0x2e')]=_['intersection'](_0x430782['model'],_0x430782[_0x843d('0x2d')]);_0x4a3847['attributes']=_[_0x843d('0x2f')](_0x430782[_0x843d('0x2c')],qs[_0x843d('0x30')](_0x40a34b[_0x843d('0x2d')][_0x843d('0x30')]));_0x4a3847[_0x843d('0x31')]=_0x4a3847[_0x843d('0x31')][_0x843d('0x32')]?_0x4a3847[_0x843d('0x31')]:_0x430782[_0x843d('0x2c')];if(!_0x40a34b[_0x843d('0x2d')]['hasOwnProperty']('nolimit')){_0x4a3847['limit']=qs[_0x843d('0x1b')](_0x40a34b[_0x843d('0x2d')]['limit']);_0x4a3847[_0x843d('0x1a')]=qs['offset'](_0x40a34b[_0x843d('0x2d')][_0x843d('0x1a')]);}_0x4a3847[_0x843d('0x33')]=qs[_0x843d('0x34')](_0x40a34b['query']['sort']);_0x4a3847[_0x843d('0x35')]=qs['filters'](_[_0x843d('0x36')](_0x40a34b[_0x843d('0x2d')],_0x430782[_0x843d('0x2e')]),_0x2932c5);if(_0x40a34b['query'][_0x843d('0x37')]){_0x4a3847['where']=_['merge'](_0x4a3847[_0x843d('0x35')],{'$or':_[_0x843d('0x27')](_0x2932c5,function(_0x583999){if(_0x583999[_0x843d('0x2a')]!==_0x843d('0x38')){var _0x185e38={};_0x185e38[_0x583999['name']]={'$like':'%'+_0x40a34b[_0x843d('0x2d')][_0x843d('0x37')]+'%'};return _0x185e38;}})});}_0x4a3847=_[_0x843d('0x39')]({},_0x4a3847,_0x40a34b[_0x843d('0x3a')]);var _0x3c584a={'where':_0x4a3847['where']};return db['AnalyticDefaultReport'][_0x843d('0x19')](_0x3c584a)[_0x843d('0x1f')](function(_0x5cfd6c){_0x10bab0['count']=_0x5cfd6c;if(_0x40a34b['query'][_0x843d('0x3b')]){_0x4a3847[_0x843d('0x3c')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x4a3847);})[_0x843d('0x1f')](function(_0x5c7de0){_0x10bab0[_0x843d('0x3d')]=_0x5c7de0;return _0x10bab0;})[_0x843d('0x1f')](respondWithFilteredResult(_0x93e100,_0x4a3847))[_0x843d('0x3e')](handleError(_0x93e100,null));};exports[_0x843d('0x3f')]=function(_0x12b333,_0x4a374a){var _0x2d623d={'raw':!![],'where':{'id':_0x12b333[_0x843d('0x40')]['id']}},_0x5d9abf={};_0x5d9abf[_0x843d('0x2c')]=_[_0x843d('0x41')](db[_0x843d('0x28')][_0x843d('0x29')]);_0x5d9abf['query']=_[_0x843d('0x41')](_0x12b333['query']);_0x5d9abf[_0x843d('0x2e')]=_[_0x843d('0x2f')](_0x5d9abf['model'],_0x5d9abf['query']);_0x2d623d[_0x843d('0x31')]=_[_0x843d('0x2f')](_0x5d9abf[_0x843d('0x2c')],qs[_0x843d('0x30')](_0x12b333[_0x843d('0x2d')][_0x843d('0x30')]));_0x2d623d[_0x843d('0x31')]=_0x2d623d[_0x843d('0x31')][_0x843d('0x32')]?_0x2d623d['attributes']:_0x5d9abf[_0x843d('0x2c')];if(_0x12b333[_0x843d('0x2d')]['includeAll']){_0x2d623d['include']=[{'all':!![]}];}_0x2d623d=_[_0x843d('0x39')]({},_0x2d623d,_0x12b333[_0x843d('0x3a')]);return db['AnalyticDefaultReport'][_0x843d('0x42')](_0x2d623d)[_0x843d('0x1f')](handleEntityNotFound(_0x4a374a,null))['then'](respondWithResult(_0x4a374a,null))[_0x843d('0x3e')](handleError(_0x4a374a,null));};exports[_0x843d('0x43')]=function(_0x56dd99,_0x12d2f2){return db[_0x843d('0x28')][_0x843d('0x43')](_0x56dd99[_0x843d('0x44')],{})[_0x843d('0x1f')](function(_0x5ba76c){var _0x459e22=_0x56dd99[_0x843d('0x45')]['get']({'plain':!![]});if(!_0x459e22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x459e22['role']===_0x843d('0x45')){var _0x4fe28d=_0x5ba76c['get']({'plain':!![]});var _0x379592=_0x843d('0x46');return db[_0x843d('0x47')][_0x843d('0x42')]({'where':{'name':_0x379592,'userProfileId':_0x459e22[_0x843d('0x48')]},'raw':!![]})['then'](function(_0x29f047){if(_0x29f047&&_0x29f047['autoAssociation']===0x0){return db[_0x843d('0x21')]['create']({'name':_0x4fe28d[_0x843d('0x24')],'resourceId':_0x4fe28d['id'],'type':_0x843d('0x49'),'sectionId':_0x29f047['id']},{})['then'](function(){return _0x5ba76c;});}else{return _0x5ba76c;}})['catch'](function(_0x3c424f){logger['error'](_0x843d('0x4a'),_0x3c424f);throw _0x3c424f;});}return _0x5ba76c;})[_0x843d('0x1f')](respondWithResult(_0x12d2f2,0xc9))[_0x843d('0x3e')](handleError(_0x12d2f2,null));};exports[_0x843d('0x4b')]=function(_0x313d3b,_0x5b1b6d){if(_0x313d3b['body']['id']){delete _0x313d3b['body']['id'];}return db[_0x843d('0x28')]['find']({'where':{'id':_0x313d3b[_0x843d('0x40')]['id']}})[_0x843d('0x1f')](handleEntityNotFound(_0x5b1b6d,null))[_0x843d('0x1f')](saveUpdates(_0x313d3b[_0x843d('0x44')],null))[_0x843d('0x1f')](respondWithResult(_0x5b1b6d,null))[_0x843d('0x3e')](handleError(_0x5b1b6d,null));};exports['destroy']=function(_0x5c1745,_0x369f82){return db[_0x843d('0x28')][_0x843d('0x42')]({'where':{'id':_0x5c1745[_0x843d('0x40')]['id']}})[_0x843d('0x1f')](handleEntityNotFound(_0x369f82,null))[_0x843d('0x1f')](removeEntity(_0x369f82,null))[_0x843d('0x3e')](handleError(_0x369f82,null));};exports['preview']=function(_0x2e35a8,_0x1a64c8){var _0x2b4da9=0xa;var _0x9576ac=[_0x843d('0x4c'),_0x843d('0x4d'),_0x843d('0x4e'),'cross_join'];var _0x402cd7={'SUM':_0x843d('0x4f'),'COUNT':_0x843d('0x50'),'COUNT DISTINCT':_0x843d('0x51'),'MAX':_0x843d('0x52'),'MIN':_0x843d('0x53'),'AVG':_0x843d('0x54'),'GROUP_CONCAT':_0x843d('0x55'),'GROUP_CONCAT ASC':_0x843d('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x49681e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x843d('0x57'),'HOUR':_0x843d('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x843d('0x59')};var _0x112b6e=function(_0x203f00){return!_[_0x843d('0x5a')]([_0x843d('0x5b'),_0x843d('0x5c'),_0x843d('0x5d'),_0x843d('0x5e')],_0x203f00);};var _0x379a66=function(_0x217913){if(!_0x217913||!_0x217913['rules'][_0x843d('0x32')]){return'';}for(var _0x320528='(',_0x37e4f5=0x0;_0x37e4f5<_0x217913['rules'][_0x843d('0x32')];_0x37e4f5+=0x1){_0x37e4f5>0x0&&(_0x320528+='\x20'+_0x217913['operator']+'\x20');_0x320528+=_0x217913[_0x843d('0x5f')][_0x37e4f5][_0x843d('0x60')]?_0x379a66(_0x217913[_0x843d('0x5f')][_0x37e4f5]['group']):_0x217913[_0x843d('0x5f')][_0x37e4f5][_0x843d('0x61')]+'\x20'+_0x217913[_0x843d('0x5f')][_0x37e4f5][_0x843d('0x62')]+(_0x112b6e(_0x217913['rules'][_0x37e4f5][_0x843d('0x62')])?'\x20'+_0x217913[_0x843d('0x5f')][_0x37e4f5]['value']:'');}return _0x320528+')';};var _0x1455a2={'where':{'id':_0x2e35a8[_0x843d('0x40')]['id']}},_0x3e2818,_0x1d31fc,_0x193a84,_0x368450,_0xc4b70;_0x1455a2=_[_0x843d('0x39')]({},_0x1455a2,_0x2e35a8['options']);return db[_0x843d('0x28')][_0x843d('0x42')](_0x1455a2)[_0x843d('0x1f')](function(_0x27caa4){if(_0x27caa4){_0x3e2818=_0x27caa4;return _0x27caa4['getFields']();}return null;})['then'](function(_0x11c089){if(_0x11c089){if(!_0x11c089[_0x843d('0x32')]){throw new db[(_0x843d('0x63'))]['ValidationErrorItem'](_0x843d('0x64'),0x193);}_0x1d31fc=_0x11c089;return db['AnalyticMetric'][_0x843d('0x65')]({'raw':!![]});}return null;})['then'](function(_0x6324b9){if(_0x6324b9){_0x193a84=_[_0x843d('0x66')](_0x6324b9,'id');var _0x37158f;var _0x34fbd3=squel[_0x843d('0x67')]();_0x34fbd3[_0x843d('0x68')](_0x3e2818[_0x843d('0x69')]);for(var _0x31b451=0x0;_0x31b451<_0x1d31fc['length'];_0x31b451+=0x1){_0x37158f=_0x1d31fc[_0x31b451][_0x843d('0x6a')]?_0x193a84[_0x1d31fc[_0x31b451][_0x843d('0x6a')]]['metric']:_0x1d31fc[_0x31b451][_0x843d('0x61')];_0x37158f=_0x1d31fc[_0x31b451]['function']?_['replace'](_0x402cd7[_0x1d31fc[_0x31b451][_0x843d('0x6b')]],'%s',_0x37158f):_0x37158f;_0x37158f=_0x1d31fc[_0x31b451][_0x843d('0x6c')]?_[_0x843d('0x6d')](_0x49681e[_0x1d31fc[_0x31b451][_0x843d('0x6c')]],'%s',_0x37158f):_0x37158f;if(_0x1d31fc[_0x31b451][_0x843d('0x6e')]){_0x34fbd3[_0x843d('0x60')](_0x37158f);}_0x1d31fc[_0x31b451][_0x843d('0x6f')]&&_0x34fbd3[_0x843d('0x33')](_0x37158f,_0x1d31fc[_0x31b451][_0x843d('0x6f')]===_0x843d('0x70')?![]:!![]);_0x34fbd3[_0x843d('0x61')](_0x37158f,_0x1d31fc[_0x31b451][_0x843d('0x71')]||_0x37158f);}if(_0x3e2818[_0x843d('0x72')]){_0x3e2818[_0x843d('0x72')]=JSON[_0x843d('0x73')](_0x3e2818['joins']);for(var _0x4bd192=0x0;_0x4bd192<_0x3e2818[_0x843d('0x72')]['length'];_0x4bd192+=0x1){if(_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x2a')]&&_[_0x843d('0x5a')](_0x9576ac,_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x2a')])&&_0x3e2818[_0x843d('0x72')][_0x4bd192]['parentKey']&&_0x3e2818[_0x843d('0x72')][_0x4bd192]['foreignTable']&&_0x3e2818['joins'][_0x4bd192][_0x843d('0x74')]){_0x34fbd3[_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x2a')]](_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x75')],null,util[_0x843d('0x6c')](_0x843d('0x76'),_0x3e2818[_0x843d('0x69')],_0x3e2818[_0x843d('0x72')][_0x4bd192][_0x843d('0x77')],_0x3e2818[_0x843d('0x72')][_0x4bd192]['foreignTable'],_0x3e2818['joins'][_0x4bd192]['foreignKey']));}}}if(_0x3e2818[_0x843d('0x78')]){_0x3e2818[_0x843d('0x78')]=JSON[_0x843d('0x73')](_0x3e2818[_0x843d('0x78')]);_0x34fbd3[_0x843d('0x35')](_0x379a66(_0x3e2818['conditions'][_0x843d('0x60')]));}_0xc4b70=_0x34fbd3[_0x843d('0x79')]();_0x34fbd3[_0x843d('0x1b')](_0x2b4da9);_0x34fbd3[_0x843d('0x1a')](0x0);logger['debug'](_0x843d('0x7a'),_0x34fbd3[_0x843d('0x7b')]());return db[_0x843d('0x7c')][_0x843d('0x2d')](_0x34fbd3['toString'](),{'type':db[_0x843d('0x7c')][_0x843d('0x7d')][_0x843d('0x7e')]});}})[_0x843d('0x1f')](respondWithResult(_0x1a64c8,null))[_0x843d('0x3e')](handleError(_0x1a64c8,null));};function runReport(_0x3fce36,_0x4b4ae2,_0x55a024){var _0x5acf76=_0x4b4ae2[_0x843d('0x24')];var _0x65554d=0xa;var _0x1baaa8=[_0x843d('0x4c'),_0x843d('0x4d'),_0x843d('0x4e'),_0x843d('0x7f')];var _0x2b8b5e={'SUM':_0x843d('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x843d('0x51'),'MAX':_0x843d('0x52'),'MIN':'MIN(%s)','AVG':_0x843d('0x54'),'GROUP_CONCAT':_0x843d('0x55'),'GROUP_CONCAT ASC':_0x843d('0x56'),'GROUP_CONCAT DESC':_0x843d('0x80')};var _0x17d258={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x843d('0x57'),'HOUR':_0x843d('0x58'),'ROUND':_0x843d('0x81'),'UNIX_TIMESTAMP':_0x843d('0x59')};var _0x12cdbc=function(_0x1a4847){return!_[_0x843d('0x5a')](['IS\x20NULL',_0x843d('0x5c'),'IS\x20EMPTY',_0x843d('0x5e')],_0x1a4847);};var _0x58b4f8=function(_0x53d851){if(!_0x53d851||!_0x53d851[_0x843d('0x5f')][_0x843d('0x32')]){return'';}for(var _0x43e224='(',_0x33d8b8=0x0;_0x33d8b8<_0x53d851[_0x843d('0x5f')]['length'];_0x33d8b8+=0x1){_0x33d8b8>0x0&&(_0x43e224+='\x20'+_0x53d851[_0x843d('0x82')]+'\x20');_0x43e224+=_0x53d851[_0x843d('0x5f')][_0x33d8b8][_0x843d('0x60')]?_0x58b4f8(_0x53d851[_0x843d('0x5f')][_0x33d8b8][_0x843d('0x60')]):_0x53d851[_0x843d('0x5f')][_0x33d8b8][_0x843d('0x61')]+'\x20'+_0x53d851['rules'][_0x33d8b8][_0x843d('0x62')]+(_0x12cdbc(_0x53d851['rules'][_0x33d8b8]['condition'])?'\x20'+_0x53d851['rules'][_0x33d8b8][_0x843d('0x83')]:'');}return _0x43e224+')';};var _0x3df404={'where':{'id':_0x3fce36['id']}},_0x2d0a2f,_0x49f3a1,_0x59ae04,_0x549d86,_0x3b1498;_0x3df404=_[_0x843d('0x39')]({},_0x3df404,_0x55a024);return db[_0x843d('0x28')][_0x843d('0x42')](_0x3df404)[_0x843d('0x1f')](function(_0x4b4469){if(_0x4b4469){_0x2d0a2f=_0x4b4469;return _0x4b4469[_0x843d('0x84')]();}return null;})[_0x843d('0x1f')](function(_0x4b7449){if(_0x4b7449){if(!_0x4b7449[_0x843d('0x32')]){throw new db[(_0x843d('0x63'))][(_0x843d('0x85'))](_0x843d('0x64'),0x193);}_0x49f3a1=_0x4b7449;return db[_0x843d('0x86')]['findAll']({'raw':!![]});}return null;})[_0x843d('0x1f')](function(_0xebdc38){if(_0xebdc38){_0x59ae04=_[_0x843d('0x66')](_0xebdc38,'id');var _0x39dee1;var _0x424454=squel[_0x843d('0x67')]();_0x424454[_0x843d('0x68')](_0x2d0a2f['table']);for(var _0x98c03f=0x0;_0x98c03f<_0x49f3a1['length'];_0x98c03f+=0x1){_0x39dee1=_0x49f3a1[_0x98c03f][_0x843d('0x6a')]?_0x59ae04[_0x49f3a1[_0x98c03f][_0x843d('0x6a')]][_0x843d('0x87')]:_0x49f3a1[_0x98c03f]['field'];_0x39dee1=_0x49f3a1[_0x98c03f][_0x843d('0x6b')]?_[_0x843d('0x6d')](_0x2b8b5e[_0x49f3a1[_0x98c03f]['function']],'%s',_0x39dee1):_0x39dee1;_0x39dee1=_0x49f3a1[_0x98c03f][_0x843d('0x6c')]?_[_0x843d('0x6d')](_0x17d258[_0x49f3a1[_0x98c03f][_0x843d('0x6c')]],'%s',_0x39dee1):_0x39dee1;if(_0x49f3a1[_0x98c03f][_0x843d('0x6e')]){_0x424454[_0x843d('0x60')](_0x39dee1);}_0x49f3a1[_0x98c03f][_0x843d('0x6f')]&&_0x424454[_0x843d('0x33')](_0x39dee1,_0x49f3a1[_0x98c03f][_0x843d('0x6f')]===_0x843d('0x70')?![]:!![]);_0x424454['field'](_0x39dee1,_0x49f3a1[_0x98c03f]['alias']||_0x39dee1);}if(_0x2d0a2f[_0x843d('0x72')]){_0x2d0a2f['joins']=JSON[_0x843d('0x73')](_0x2d0a2f[_0x843d('0x72')]);for(var _0x2fc056=0x0;_0x2fc056<_0x2d0a2f[_0x843d('0x72')]['length'];_0x2fc056+=0x1){if(_0x2d0a2f[_0x843d('0x72')][_0x2fc056]['type']&&_[_0x843d('0x5a')](_0x1baaa8,_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x2a')])&&_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x77')]&&_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x75')]&&_0x2d0a2f['joins'][_0x2fc056][_0x843d('0x74')]){_0x424454[_0x2d0a2f['joins'][_0x2fc056][_0x843d('0x2a')]](_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x75')],null,util[_0x843d('0x6c')](_0x843d('0x76'),_0x2d0a2f[_0x843d('0x69')],_0x2d0a2f[_0x843d('0x72')][_0x2fc056][_0x843d('0x77')],_0x2d0a2f['joins'][_0x2fc056][_0x843d('0x75')],_0x2d0a2f[_0x843d('0x72')][_0x2fc056]['foreignKey']));}}}if(_0x2d0a2f[_0x843d('0x78')]){_0x2d0a2f[_0x843d('0x78')]=JSON[_0x843d('0x73')](_0x2d0a2f[_0x843d('0x78')]);_0x424454[_0x843d('0x35')](_0x58b4f8(_0x2d0a2f[_0x843d('0x78')][_0x843d('0x60')]));}_0x3b1498=_0x424454[_0x843d('0x79')]();_0x424454[_0x843d('0x1b')](_0x65554d);_0x424454[_0x843d('0x1a')](0x0);logger['debug'](_0x843d('0x7a'),_0x424454['toString']());return db[_0x843d('0x7c')][_0x843d('0x2d')](_0x424454[_0x843d('0x7b')](),{'type':db[_0x843d('0x7c')]['QueryTypes'][_0x843d('0x7e')]});}})['then'](function(_0x31f496){if(!_0x31f496['length']){throw new db[(_0x843d('0x63'))]['ValidationErrorItem'](_0x843d('0x88'),0xcc);}if(_0x4b4ae2[_0x843d('0x89')]===_0x843d('0x8a')){return null;}var _0x1be8c4=_[_0x843d('0x39')](_0x4b4ae2,{'name':_0x4b4ae2['fullPath']||_0x4b4ae2['name']||_0x2d0a2f['name'],'basename':_0x5acf76,'savename':util[_0x843d('0x6c')](_0x843d('0x8b'),_0x4b4ae2[_0x843d('0x24')]||_0x2d0a2f[_0x843d('0x24')],require(_0x843d('0x8c'))['generate'](0x4),_0x4b4ae2[_0x843d('0x89')]||_0x843d('0x8d')),'reportId':_0x2d0a2f['id'],'reportType':'default'});return db[_0x843d('0x8e')][_0x843d('0x43')](_0x1be8c4,{'raw':!![]});})['then'](function(_0x205d28){if(_0x2d0a2f[_0x843d('0x69')]===_0x843d('0x8f')){_0x3b1498[_0x843d('0x35')](_0x2d0a2f[_0x843d('0x69')]+_0x843d('0x90'),_0x4b4ae2[_0x843d('0x91')],_0x4b4ae2[_0x843d('0x92')]);}else{_0x3b1498[_0x843d('0x35')](_0x2d0a2f[_0x843d('0x69')]+_0x843d('0x93'),_0x4b4ae2[_0x843d('0x91')],_0x4b4ae2[_0x843d('0x92')]);}if(_0x205d28){logger['info'](_0x843d('0x94'),_0x3b1498[_0x843d('0x7b')]());require(_0x843d('0x95'))[_0x843d('0x96')](path[_0x843d('0x4c')](__dirname,'../../components/export/',_0x205d28[_0x843d('0x89')]),[_0x205d28['id'],_0x3b1498[_0x843d('0x7b')](),path['join'](__dirname,'../../files/reports',_0x205d28[_0x843d('0x97')]),_0x5acf76]);return _0x205d28;}else{var _0x471484=squel[_0x843d('0x67')]();_0x471484[_0x843d('0x68')]('('+_0x3b1498[_0x843d('0x7b')]()+')','countTable');_0x471484[_0x843d('0x61')](_0x843d('0x98'),_0x843d('0x19'));_0x3b1498[_0x843d('0x1b')](_0x4b4ae2['limit']||_0x65554d);_0x3b1498[_0x843d('0x1a')](_0x4b4ae2['offset']||0x0);return dbH[_0x843d('0x7c')]['query'](_0x471484['toString'](),{'type':dbH[_0x843d('0x7c')][_0x843d('0x7d')][_0x843d('0x7e')]})[_0x843d('0x1f')](function(_0x3f5a98){if(!_0x3f5a98[_0x843d('0x32')]){_0x549d86=0x0;}else{_0x549d86=_0x3f5a98[0x0][_0x843d('0x19')]||0x0;}return dbH[_0x843d('0x7c')][_0x843d('0x2d')](_0x3b1498['toString'](),{'type':dbH[_0x843d('0x7c')][_0x843d('0x7d')][_0x843d('0x7e')]});})[_0x843d('0x1f')](function(_0x595818){return{'rows':_0x595818||[],'count':_0x549d86};});}});}exports['run']=function(_0xe1522d,_0x3f3909){return runReport(_0xe1522d['params'],_0xe1522d[_0x843d('0x2d')],_0xe1522d[_0x843d('0x3a')])[_0x843d('0x1f')](respondWithResult(_0x3f3909,null))[_0x843d('0x3e')](handleError(_0x3f3909,null));};exports[_0x843d('0x99')]=runReport;exports['query']=function(_0x802d32,_0x259d49){var _0x44d592=0xa;var _0x4c2118=['join',_0x843d('0x4d'),_0x843d('0x4e'),'cross_join'];var _0x32dbd7={'SUM':_0x843d('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x843d('0x51'),'MAX':_0x843d('0x52'),'MIN':_0x843d('0x53'),'AVG':_0x843d('0x54'),'GROUP_CONCAT':_0x843d('0x55'),'GROUP_CONCAT ASC':_0x843d('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5ea61d={'SEC_TO_TIME':_0x843d('0x9a'),'DATE':_0x843d('0x57'),'HOUR':'HOUR(%s)','ROUND':_0x843d('0x81'),'UNIX_TIMESTAMP':_0x843d('0x59')};var _0x18896b=function(_0x49e4e7){return!_[_0x843d('0x5a')]([_0x843d('0x5b'),'IS\x20NOT\x20NULL',_0x843d('0x5d'),_0x843d('0x5e')],_0x49e4e7);};var _0x589b7e=function(_0x27f58f){if(!_0x27f58f||!_0x27f58f[_0x843d('0x5f')]['length']){return'';}for(var _0x769b78='(',_0x54b571=0x0;_0x54b571<_0x27f58f[_0x843d('0x5f')]['length'];_0x54b571+=0x1){_0x54b571>0x0&&(_0x769b78+='\x20'+_0x27f58f[_0x843d('0x82')]+'\x20');_0x769b78+=_0x27f58f[_0x843d('0x5f')][_0x54b571]['group']?_0x589b7e(_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x60')]):_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x61')]+'\x20'+_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x62')]+(_0x18896b(_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x62')])?'\x20'+_0x27f58f[_0x843d('0x5f')][_0x54b571][_0x843d('0x83')]:'');}return _0x769b78+')';};var _0x4457a9={'where':{'id':_0x802d32[_0x843d('0x40')]['id']}},_0x2998b2,_0x421d68,_0x12d723,_0x4b2141,_0x31af56;_0x4457a9=_[_0x843d('0x39')]({},_0x4457a9,_0x802d32[_0x843d('0x3a')]);return db['AnalyticDefaultReport']['find'](_0x4457a9)[_0x843d('0x1f')](function(_0x26eb1f){if(_0x26eb1f){_0x2998b2=_0x26eb1f;return _0x26eb1f[_0x843d('0x84')]();}return null;})[_0x843d('0x1f')](function(_0x58515e){if(_0x58515e){if(!_0x58515e[_0x843d('0x32')]){throw new db[(_0x843d('0x63'))][(_0x843d('0x85'))](_0x843d('0x64'),0x193);}_0x421d68=_0x58515e;return db[_0x843d('0x86')][_0x843d('0x65')]({'raw':!![]});}return null;})[_0x843d('0x1f')](function(_0x3a970f){if(_0x3a970f){_0x12d723=_[_0x843d('0x66')](_0x3a970f,'id');var _0x8e2626;var _0x40c74e=squel[_0x843d('0x67')]();_0x40c74e[_0x843d('0x68')](_0x2998b2['table']);for(var _0x45acce=0x0;_0x45acce<_0x421d68[_0x843d('0x32')];_0x45acce+=0x1){_0x8e2626=_0x421d68[_0x45acce][_0x843d('0x6a')]?_0x12d723[_0x421d68[_0x45acce][_0x843d('0x6a')]][_0x843d('0x87')]:_0x421d68[_0x45acce][_0x843d('0x61')];_0x8e2626=_0x421d68[_0x45acce][_0x843d('0x6b')]?_[_0x843d('0x6d')](_0x32dbd7[_0x421d68[_0x45acce]['function']],'%s',_0x8e2626):_0x8e2626;_0x8e2626=_0x421d68[_0x45acce][_0x843d('0x6c')]?_[_0x843d('0x6d')](_0x5ea61d[_0x421d68[_0x45acce]['format']],'%s',_0x8e2626):_0x8e2626;if(_0x421d68[_0x45acce][_0x843d('0x6e')]){_0x40c74e['group'](_0x8e2626);}_0x421d68[_0x45acce][_0x843d('0x6f')]&&_0x40c74e[_0x843d('0x33')](_0x8e2626,_0x421d68[_0x45acce]['orderBy']===_0x843d('0x70')?![]:!![]);_0x40c74e[_0x843d('0x61')](_0x8e2626,_0x421d68[_0x45acce]['alias']||_0x8e2626);}if(_0x2998b2[_0x843d('0x72')]){_0x2998b2[_0x843d('0x72')]=JSON[_0x843d('0x73')](_0x2998b2[_0x843d('0x72')]);for(var _0x27d323=0x0;_0x27d323<_0x2998b2['joins'][_0x843d('0x32')];_0x27d323+=0x1){if(_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x2a')]&&_[_0x843d('0x5a')](_0x4c2118,_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x2a')])&&_0x2998b2[_0x843d('0x72')][_0x27d323]['parentKey']&&_0x2998b2['joins'][_0x27d323]['foreignTable']&&_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x74')]){_0x40c74e[_0x2998b2[_0x843d('0x72')][_0x27d323]['type']](_0x2998b2['joins'][_0x27d323][_0x843d('0x75')],null,util[_0x843d('0x6c')]('%s.%s\x20=\x20%s.%s',_0x2998b2[_0x843d('0x69')],_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x77')],_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x75')],_0x2998b2[_0x843d('0x72')][_0x27d323][_0x843d('0x74')]));}}}if(_0x2998b2[_0x843d('0x78')]){_0x2998b2[_0x843d('0x78')]=JSON[_0x843d('0x73')](_0x2998b2['conditions']);_0x40c74e[_0x843d('0x35')](_0x589b7e(_0x2998b2[_0x843d('0x78')][_0x843d('0x60')]));}_0x31af56=_0x40c74e[_0x843d('0x79')]();_0x40c74e[_0x843d('0x1b')](_0x44d592);_0x40c74e[_0x843d('0x1a')](0x0);logger['debug'](_0x843d('0x7a'),_0x40c74e['toString']());return db[_0x843d('0x7c')][_0x843d('0x2d')](_0x40c74e[_0x843d('0x7b')](),{'type':db[_0x843d('0x7c')][_0x843d('0x7d')]['SELECT']});}})[_0x843d('0x1f')](function(){return{'sql':_0x31af56[_0x843d('0x7b')]()};})[_0x843d('0x1f')](respondWithResult(_0x259d49,null))[_0x843d('0x3e')](handleError(_0x259d49,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index bd9c355..ee5f60d 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 _0xc4aa=['bluebird','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x1d7c9d,_0x198c69){var _0x534e9e=function(_0x436052){while(--_0x436052){_0x1d7c9d['push'](_0x1d7c9d['shift']());}};_0x534e9e(++_0x198c69);}(_0x0295,0x1f0));var _0x5029=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x0295[_0x25efdf];return _0x22c495;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 8f9ed72..cdce622 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 _0x66d3=['request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x1a3d07,_0x105a71){var _0xd0058a=function(_0x213e53){while(--_0x213e53){_0x1a3d07['push'](_0x1a3d07['shift']());}};_0xd0058a(++_0x105a71);}(_0x66d3,0x10f));var _0x366d=function(_0x1de105,_0x166e04){_0x1de105=_0x1de105-0x0;var _0x4d9fd7=_0x66d3[_0x1de105];return _0x4d9fd7;};'use strict';var _=require(_0x366d('0x0'));var util=require('util');var moment=require(_0x366d('0x1'));var BPromise=require('bluebird');var rs=require(_0x366d('0x2'));var fs=require('fs');var Redis=require(_0x366d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x366d('0x4'));var logger=require('../../config/logger')(_0x366d('0x5'));var config=require('../../config/environment');var jayson=require(_0x366d('0x6'));var client=jayson[_0x366d('0x7')][_0x366d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454c54,_0x2e9573,_0x16907c){return new BPromise(function(_0x247d15,_0x12c7bb){return client[_0x366d('0x9')](_0x454c54,_0x16907c)[_0x366d('0xa')](function(_0x2adf49){logger['info'](_0x366d('0xb'),_0x2e9573,_0x366d('0xc'));logger[_0x366d('0xd')](_0x366d('0xe'),_0x2e9573,_0x366d('0xc'),JSON[_0x366d('0xf')](_0x2adf49));if(_0x2adf49[_0x366d('0x10')]){if(_0x2adf49[_0x366d('0x10')]['code']===0x1f4){logger['error'](_0x366d('0xb'),_0x2e9573,_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);return _0x12c7bb(_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);}logger[_0x366d('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e9573,_0x2adf49[_0x366d('0x10')][_0x366d('0x11')]);return _0x247d15(_0x2adf49['error'][_0x366d('0x11')]);}else{logger[_0x366d('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e9573,_0x366d('0xc'));_0x247d15(_0x2adf49[_0x366d('0x13')][_0x366d('0x11')]);}})['catch'](function(_0x10a27f){logger['error'](_0x366d('0xb'),_0x2e9573,_0x10a27f);_0x12c7bb(_0x10a27f);});});} \ No newline at end of file +var _0x93ed=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message'];(function(_0x41ef02,_0x101e1a){var _0x5e6995=function(_0x124fdd){while(--_0x124fdd){_0x41ef02['push'](_0x41ef02['shift']());}};_0x5e6995(++_0x101e1a);}(_0x93ed,0xfe));var _0xd93e=function(_0x18f074,_0x41b2c0){_0x18f074=_0x18f074-0x0;var _0x24832a=_0x93ed[_0x18f074];return _0x24832a;};'use strict';var _=require(_0xd93e('0x0'));var util=require(_0xd93e('0x1'));var moment=require(_0xd93e('0x2'));var BPromise=require(_0xd93e('0x3'));var rs=require(_0xd93e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd93e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd93e('0x6'))(_0xd93e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd93e('0x8'));var client=jayson[_0xd93e('0x9')][_0xd93e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x478305,_0xd74ab3,_0x4998bf){return new BPromise(function(_0x4ef1a1,_0x466fca){return client[_0xd93e('0xb')](_0x478305,_0x4998bf)[_0xd93e('0xc')](function(_0x14fc46){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd74ab3,_0xd93e('0xd'));logger['debug'](_0xd93e('0xe'),_0xd74ab3,_0xd93e('0xd'),JSON[_0xd93e('0xf')](_0x14fc46));if(_0x14fc46[_0xd93e('0x10')]){if(_0x14fc46[_0xd93e('0x10')]['code']===0x1f4){logger[_0xd93e('0x10')](_0xd93e('0x11'),_0xd74ab3,_0x14fc46[_0xd93e('0x10')][_0xd93e('0x12')]);return _0x466fca(_0x14fc46[_0xd93e('0x10')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd74ab3,_0x14fc46['error'][_0xd93e('0x12')]);return _0x4ef1a1(_0x14fc46[_0xd93e('0x10')][_0xd93e('0x12')]);}else{logger['info'](_0xd93e('0x11'),_0xd74ab3,'request\x20sent');_0x4ef1a1(_0x14fc46[_0xd93e('0x13')][_0xd93e('0x12')]);}})[_0xd93e('0x14')](function(_0x1ba021){logger[_0xd93e('0x10')](_0xd93e('0x11'),_0xd74ab3,_0x1ba021);_0x466fca(_0x1ba021);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1b52914..c176f71 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 _0x28d4=['preview','/:id/run','run','query','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','show','get','/:id/preview'];(function(_0x250496,_0x408b04){var _0x7e28ab=function(_0x50eef4){while(--_0x50eef4){_0x250496['push'](_0x250496['shift']());}};_0x7e28ab(++_0x408b04);}(_0x28d4,0xe6));var _0x428d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x28d4[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x428d('0x0'));var util=require(_0x428d('0x1'));var path=require(_0x428d('0x2'));var timeout=require(_0x428d('0x3'));var express=require(_0x428d('0x4'));var router=express[_0x428d('0x5')]();var auth=require(_0x428d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x428d('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x428d('0x8')](),controller['index']);router['get']('/:id',auth[_0x428d('0x8')](),controller[_0x428d('0x9')]);router[_0x428d('0xa')](_0x428d('0xb'),auth[_0x428d('0x8')](),controller[_0x428d('0xc')]);router[_0x428d('0xa')](_0x428d('0xd'),auth[_0x428d('0x8')](),controller[_0x428d('0xe')]);router[_0x428d('0xa')]('/:id/query',auth[_0x428d('0x8')](),controller[_0x428d('0xf')]);router[_0x428d('0x10')]('/',auth[_0x428d('0x8')](),controller[_0x428d('0x11')]);router['put'](_0x428d('0x12'),auth[_0x428d('0x8')](),controller[_0x428d('0x13')]);router['delete']('/:id',auth[_0x428d('0x8')](),controller[_0x428d('0x14')]);module[_0x428d('0x15')]=router; \ No newline at end of file +var _0x6a13=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','run','create','put','delete','destroy'];(function(_0x27e37d,_0x45a064){var _0x2375d2=function(_0x375c36){while(--_0x375c36){_0x27e37d['push'](_0x27e37d['shift']());}};_0x2375d2(++_0x45a064);}(_0x6a13,0x16a));var _0x36a1=function(_0x3eab63,_0x8e719c){_0x3eab63=_0x3eab63-0x0;var _0x143ad6=_0x6a13[_0x3eab63];return _0x143ad6;};'use strict';var multer=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var path=require('path');var timeout=require(_0x36a1('0x2'));var express=require(_0x36a1('0x3'));var router=express['Router']();var auth=require(_0x36a1('0x4'));var interaction=require(_0x36a1('0x5'));var config=require(_0x36a1('0x6'));var controller=require(_0x36a1('0x7'));router[_0x36a1('0x8')]('/',auth[_0x36a1('0x9')](),controller[_0x36a1('0xa')]);router[_0x36a1('0x8')](_0x36a1('0xb'),auth[_0x36a1('0x9')](),controller['show']);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0x36a1('0xc')]);router[_0x36a1('0x8')]('/:id/run',auth[_0x36a1('0x9')](),controller[_0x36a1('0xd')]);router[_0x36a1('0x8')]('/:id/query',auth[_0x36a1('0x9')](),controller['query']);router['post']('/',auth[_0x36a1('0x9')](),controller[_0x36a1('0xe')]);router[_0x36a1('0xf')]('/:id',auth[_0x36a1('0x9')](),controller['update']);router[_0x36a1('0x10')](_0x36a1('0xb'),auth[_0x36a1('0x9')](),controller[_0x36a1('0x11')]);module[_0x36a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index bc94730..943e086 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 _0x440b=['DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','STRING','csv','pdf','xlsx'];(function(_0xcdafcc,_0x3f49f1){var _0x50722c=function(_0x22c0d9){while(--_0x22c0d9){_0xcdafcc['push'](_0xcdafcc['shift']());}};_0x50722c(++_0x3f49f1);}(_0x440b,0x132));var _0xb440=function(_0x4c1711,_0x2f49ce){_0x4c1711=_0x4c1711-0x0;var _0x3de6eb=_0x440b[_0x4c1711];return _0x3de6eb;};'use strict';var Sequelize=require(_0xb440('0x0'));var moment=require(_0xb440('0x1'));module['exports']={'name':{'type':Sequelize[_0xb440('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xb440('0x3'),_0xb440('0x4'),_0xb440('0x5')),'allowNull':![],'defaultValue':_0xb440('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xb440('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb440('0x2')],'defaultValue':_0xb440('0x7')},'type':{'type':Sequelize[_0xb440('0x8')](_0xb440('0x9'),_0xb440('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb440('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd976=['STRING','ENUM','pdf','xlsx','csv','DATE','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x35eb8d,_0x2265c4){var _0x447a49=function(_0x163187){while(--_0x163187){_0x35eb8d['push'](_0x35eb8d['shift']());}};_0x447a49(++_0x2265c4);}(_0xd976,0x135));var _0x6d97=function(_0x154e02,_0x11b0e1){_0x154e02=_0x154e02-0x0;var _0x3bd6d1=_0xd976[_0x154e02];return _0x3bd6d1;};'use strict';var Sequelize=require(_0x6d97('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x6d97('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x6d97('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x6d97('0x2')]('csv',_0x6d97('0x3'),_0x6d97('0x4')),'allowNull':![],'defaultValue':_0x6d97('0x5')},'savename':{'type':Sequelize[_0x6d97('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x6d97('0x6')]},'status':{'type':Sequelize[_0x6d97('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x6d97('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x6d97('0x8')](0xb)[_0x6d97('0x9')]},'reportType':{'type':Sequelize[_0x6d97('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7c468b5..0ef77c2 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 _0x5e0c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','error','name','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','params','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','server/files/reports','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x32f296,_0x1877e7){var _0x29e16d=function(_0x149105){while(--_0x149105){_0x32f296['push'](_0x32f296['shift']());}};_0x29e16d(++_0x1877e7);}(_0x5e0c,0x109));var _0xc5e0=function(_0x522bc8,_0x3525bf){_0x522bc8=_0x522bc8-0x0;var _0x5c5ab4=_0x5e0c[_0x522bc8];return _0x5c5ab4;};'use strict';var pdf=require(_0xc5e0('0x0'));var emlformat=require(_0xc5e0('0x1'));var rimraf=require(_0xc5e0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5e0('0x3'));var rp=require(_0xc5e0('0x4'));var moment=require(_0xc5e0('0x5'));var BPromise=require(_0xc5e0('0x6'));var Mustache=require(_0xc5e0('0x7'));var util=require(_0xc5e0('0x8'));var path=require(_0xc5e0('0x9'));var sox=require(_0xc5e0('0xa'));var csv=require(_0xc5e0('0xb'));var ejs=require(_0xc5e0('0xc'));var fs=require('fs');var _=require(_0xc5e0('0xd'));var squel=require(_0xc5e0('0xe'));var crypto=require(_0xc5e0('0xf'));var jsforce=require(_0xc5e0('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc5e0('0x11'));var Redis=require(_0xc5e0('0x12'));var authService=require(_0xc5e0('0x13'));var qs=require(_0xc5e0('0x14'));var as=require(_0xc5e0('0x15'));var hardwareService=require(_0xc5e0('0x16'));var logger=require(_0xc5e0('0x17'))(_0xc5e0('0x18'));var utils=require(_0xc5e0('0x19'));var config=require('../../config/environment');var db=require(_0xc5e0('0x1a'))['db'];function respondWithStatusCode(_0x2bd968,_0x57d908){_0x57d908=_0x57d908||0xcc;return function(_0x4b72f4){if(_0x4b72f4){return _0x2bd968[_0xc5e0('0x1b')](_0x57d908);}return _0x2bd968[_0xc5e0('0x1c')](_0x57d908)[_0xc5e0('0x1d')]();};}function respondWithResult(_0x3e21bb,_0x4a2738){_0x4a2738=_0x4a2738||0xc8;return function(_0x453e4e){if(_0x453e4e){return _0x3e21bb[_0xc5e0('0x1c')](_0x4a2738)[_0xc5e0('0x1e')](_0x453e4e);}};}function respondWithFilteredResult(_0x4076e9,_0x2e23a4){return function(_0x5e7cd4){if(_0x5e7cd4){var _0x2c7fef=_0x5e7cd4[_0xc5e0('0x1f')],_0x5ca30e=_0x2e23a4[_0xc5e0('0x20')],_0x2b2b43=_0x2e23a4[_0xc5e0('0x20')]+_0x2e23a4['limit'],_0x3d6f48;if(_0x2b2b43>=_0x2c7fef){_0x2b2b43=_0x2c7fef;_0x3d6f48=0xc8;}else{_0x3d6f48=0xce;}_0x4076e9[_0xc5e0('0x1c')](_0x3d6f48);return _0x4076e9[_0xc5e0('0x21')]('Content-Range',_0x5ca30e+'-'+_0x2b2b43+'/'+_0x2c7fef)['json'](_0x5e7cd4);}return null;};}function patchUpdates(_0x39938a){return function(_0x11a929){try{jsonpatch[_0xc5e0('0x22')](_0x11a929,_0x39938a,!![]);}catch(_0x55efb3){return BPromise[_0xc5e0('0x23')](_0x55efb3);}return _0x11a929[_0xc5e0('0x24')]();};}function saveUpdates(_0x51f480,_0xc90184){return function(_0x2a86ac){if(_0x2a86ac){return _0x2a86ac[_0xc5e0('0x25')](_0x51f480)['then'](function(_0x65139a){return _0x65139a;});}return null;};}function removeEntity(_0x368b9d,_0x199a09){return function(_0x3441df){if(_0x3441df){return _0x3441df[_0xc5e0('0x26')]()[_0xc5e0('0x27')](function(){var _0x103b7d=_0x3441df[_0xc5e0('0x28')]({'plain':!![]});var _0x3c97ad=_0xc5e0('0x29');return db[_0xc5e0('0x2a')][_0xc5e0('0x26')]({'where':{'type':_0x3c97ad,'resourceId':_0x103b7d['id']}})[_0xc5e0('0x27')](function(){return _0x3441df;});})['then'](function(){_0x368b9d[_0xc5e0('0x1c')](0xcc)[_0xc5e0('0x1d')]();});}};}function handleEntityNotFound(_0x514a4b,_0x1e84ef){return function(_0x964032){if(!_0x964032){_0x514a4b['sendStatus'](0x194);}return _0x964032;};}function handleError(_0x328388,_0xe1b679){_0xe1b679=_0xe1b679||0x1f4;return function(_0x5bb6fe){logger[_0xc5e0('0x2b')](_0x5bb6fe['stack']);if(_0x5bb6fe[_0xc5e0('0x2c')]){delete _0x5bb6fe[_0xc5e0('0x2c')];}_0x328388[_0xc5e0('0x1c')](_0xe1b679)['send'](_0x5bb6fe);};}exports['index']=function(_0xe57c7d,_0x34ebb3){var _0x52de68={},_0x1f4c6b={},_0x364df1={'count':0x0,'rows':[]};var _0x3d31d3=_['map'](db[_0xc5e0('0x2d')][_0xc5e0('0x2e')],function(_0x2ecc59){return{'name':_0x2ecc59[_0xc5e0('0x2f')],'type':_0x2ecc59[_0xc5e0('0x30')][_0xc5e0('0x31')]};});_0x1f4c6b[_0xc5e0('0x32')]=_[_0xc5e0('0x33')](_0x3d31d3,_0xc5e0('0x2c'));_0x1f4c6b[_0xc5e0('0x34')]=_[_0xc5e0('0x35')](_0xe57c7d['query']);_0x1f4c6b[_0xc5e0('0x36')]=_[_0xc5e0('0x37')](_0x1f4c6b[_0xc5e0('0x32')],_0x1f4c6b[_0xc5e0('0x34')]);_0x52de68[_0xc5e0('0x38')]=_[_0xc5e0('0x37')](_0x1f4c6b[_0xc5e0('0x32')],qs[_0xc5e0('0x39')](_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x39')]));_0x52de68[_0xc5e0('0x38')]=_0x52de68['attributes']['length']?_0x52de68['attributes']:_0x1f4c6b[_0xc5e0('0x32')];if(!_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x3a')]('nolimit')){_0x52de68[_0xc5e0('0x3b')]=qs[_0xc5e0('0x3b')](_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x3b')]);_0x52de68[_0xc5e0('0x20')]=qs['offset'](_0xe57c7d['query'][_0xc5e0('0x20')]);}_0x52de68[_0xc5e0('0x3c')]=qs['sort'](_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x3d')]);_0x52de68[_0xc5e0('0x3e')]=qs[_0xc5e0('0x36')](_[_0xc5e0('0x3f')](_0xe57c7d[_0xc5e0('0x34')],_0x1f4c6b['filters']),_0x3d31d3);if(_0xe57c7d[_0xc5e0('0x34')]['filter']){_0x52de68[_0xc5e0('0x3e')]=_['merge'](_0x52de68[_0xc5e0('0x3e')],{'$or':_[_0xc5e0('0x33')](_0x3d31d3,function(_0x13ddb0){if(_0x13ddb0[_0xc5e0('0x30')]!==_0xc5e0('0x40')){var _0x171f0f={};_0x171f0f[_0x13ddb0[_0xc5e0('0x2c')]]={'$like':'%'+_0xe57c7d[_0xc5e0('0x34')][_0xc5e0('0x41')]+'%'};return _0x171f0f;}})});}_0x52de68=_[_0xc5e0('0x42')]({},_0x52de68,_0xe57c7d[_0xc5e0('0x43')]);var _0x2f2266={'where':_0x52de68[_0xc5e0('0x3e')]};return db[_0xc5e0('0x2d')]['count'](_0x2f2266)['then'](function(_0x1f1546){_0x364df1['count']=_0x1f1546;if(_0xe57c7d[_0xc5e0('0x34')]['includeAll']){_0x52de68['include']=[{'all':!![]}];}return db[_0xc5e0('0x2d')][_0xc5e0('0x44')](_0x52de68);})[_0xc5e0('0x27')](function(_0x191bbe){_0x364df1[_0xc5e0('0x45')]=_0x191bbe;return _0x364df1;})[_0xc5e0('0x27')](respondWithFilteredResult(_0x34ebb3,_0x52de68))[_0xc5e0('0x46')](handleError(_0x34ebb3,null));};exports['show']=function(_0x32b8bc,_0x276745){var _0xa1b0a4={'raw':!![],'where':{'id':_0x32b8bc[_0xc5e0('0x47')]['id']}},_0x46be42={};_0x46be42[_0xc5e0('0x32')]=_[_0xc5e0('0x35')](db[_0xc5e0('0x2d')][_0xc5e0('0x2e')]);_0x46be42[_0xc5e0('0x34')]=_[_0xc5e0('0x35')](_0x32b8bc['query']);_0x46be42[_0xc5e0('0x36')]=_[_0xc5e0('0x37')](_0x46be42['model'],_0x46be42['query']);_0xa1b0a4['attributes']=_['intersection'](_0x46be42['model'],qs[_0xc5e0('0x39')](_0x32b8bc[_0xc5e0('0x34')]['fields']));_0xa1b0a4[_0xc5e0('0x38')]=_0xa1b0a4[_0xc5e0('0x38')][_0xc5e0('0x48')]?_0xa1b0a4[_0xc5e0('0x38')]:_0x46be42[_0xc5e0('0x32')];if(_0x32b8bc[_0xc5e0('0x34')][_0xc5e0('0x49')]){_0xa1b0a4[_0xc5e0('0x4a')]=[{'all':!![]}];}_0xa1b0a4=_['merge']({},_0xa1b0a4,_0x32b8bc[_0xc5e0('0x43')]);return db[_0xc5e0('0x2d')][_0xc5e0('0x4b')](_0xa1b0a4)[_0xc5e0('0x27')](handleEntityNotFound(_0x276745,null))[_0xc5e0('0x27')](respondWithResult(_0x276745,null))['catch'](handleError(_0x276745,null));};exports[_0xc5e0('0x4c')]=function(_0x710d78,_0x21c416){return db[_0xc5e0('0x2d')][_0xc5e0('0x4c')](_0x710d78[_0xc5e0('0x4d')],{})[_0xc5e0('0x27')](function(_0x3342a1){var _0x102c2f=_0x710d78[_0xc5e0('0x4e')][_0xc5e0('0x28')]({'plain':!![]});if(!_0x102c2f)throw new Error(_0xc5e0('0x4f'));if(_0x102c2f[_0xc5e0('0x50')]===_0xc5e0('0x4e')){var _0x35d2d5=_0x3342a1['get']({'plain':!![]});var _0x3cedcb='ExtractedReports';return db['UserProfileSection'][_0xc5e0('0x4b')]({'where':{'name':_0x3cedcb,'userProfileId':_0x102c2f[_0xc5e0('0x51')]},'raw':!![]})[_0xc5e0('0x27')](function(_0x1a5e4a){if(_0x1a5e4a&&_0x1a5e4a['autoAssociation']===0x0){return db[_0xc5e0('0x2a')][_0xc5e0('0x4c')]({'name':_0x35d2d5[_0xc5e0('0x2c')],'resourceId':_0x35d2d5['id'],'type':_0x1a5e4a[_0xc5e0('0x2c')],'sectionId':_0x1a5e4a['id']},{})[_0xc5e0('0x27')](function(){return _0x3342a1;});}else{return _0x3342a1;}})[_0xc5e0('0x46')](function(_0x1b1192){logger['error'](_0xc5e0('0x52'),_0x1b1192);throw _0x1b1192;});}return _0x3342a1;})[_0xc5e0('0x27')](respondWithResult(_0x21c416,0xc9))['catch'](handleError(_0x21c416,null));};exports['update']=function(_0x27ffef,_0x201217){if(_0x27ffef[_0xc5e0('0x4d')]['id']){delete _0x27ffef[_0xc5e0('0x4d')]['id'];}return db[_0xc5e0('0x2d')]['find']({'where':{'id':_0x27ffef[_0xc5e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x201217,null))[_0xc5e0('0x27')](saveUpdates(_0x27ffef[_0xc5e0('0x4d')],null))['then'](respondWithResult(_0x201217,null))[_0xc5e0('0x46')](handleError(_0x201217,null));};exports[_0xc5e0('0x26')]=function(_0x1fa604,_0x36aea0){return db[_0xc5e0('0x2d')]['find']({'where':{'id':_0x1fa604[_0xc5e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x36aea0,null))[_0xc5e0('0x27')](removeEntity(_0x36aea0,null))['catch'](handleError(_0x36aea0,null));};exports[_0xc5e0('0x53')]=function(_0x64f8ff,_0x423b70,_0x7bf1e7){return db['AnalyticExtractedReport'][_0xc5e0('0x4b')]({'where':{'id':_0x64f8ff[_0xc5e0('0x47')]['id']},'attributes':[_0xc5e0('0x2c'),_0xc5e0('0x54'),_0xc5e0('0x55'),'output'],'raw':!![]})[_0xc5e0('0x27')](handleEntityNotFound(_0x423b70,null))[_0xc5e0('0x27')](function(_0x395c5f){if(_0x395c5f){if(!fs[_0xc5e0('0x56')](path[_0xc5e0('0x57')](config['root'],'server/files/reports',_0x395c5f[_0xc5e0('0x55')]))){throw new db[(_0xc5e0('0x58'))][(_0xc5e0('0x59'))](_0xc5e0('0x5a'));}if(_0x64f8ff[_0xc5e0('0x34')]['exists']){return _0x423b70[_0xc5e0('0x1b')](0xc8);}return _0x423b70['download'](path[_0xc5e0('0x57')](config[_0xc5e0('0x5b')],_0xc5e0('0x5c'),_0x395c5f['savename']),util['format'](_0xc5e0('0x5d'),_0x395c5f[_0xc5e0('0x54')]||_0x395c5f[_0xc5e0('0x2c')],_0x395c5f['output'][_0xc5e0('0x5e')]()));}})[_0xc5e0('0x46')](handleError(_0x423b70,null));}; \ No newline at end of file +var _0xa0a3=['reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','length','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','server/files/reports','%s.%s','basename','toLowerCase','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','set'];(function(_0x20fa49,_0x2e4b4c){var _0x7de2aa=function(_0x227fed){while(--_0x227fed){_0x20fa49['push'](_0x20fa49['shift']());}};_0x7de2aa(++_0x2e4b4c);}(_0xa0a3,0xf4));var _0x3a0a=function(_0x2c6f7c,_0x5de691){_0x2c6f7c=_0x2c6f7c-0x0;var _0x5efaa0=_0xa0a3[_0x2c6f7c];return _0x5efaa0;};'use strict';var pdf=require(_0x3a0a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require(_0x3a0a('0x2'));var rp=require(_0x3a0a('0x3'));var moment=require('moment');var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a0a('0x9'));var squel=require(_0x3a0a('0xa'));var crypto=require('crypto');var jsforce=require(_0x3a0a('0xb'));var deskjs=require(_0x3a0a('0xc'));var toCsv=require(_0x3a0a('0xd'));var querystring=require(_0x3a0a('0xe'));var Papa=require(_0x3a0a('0xf'));var Redis=require(_0x3a0a('0x10'));var authService=require(_0x3a0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3a0a('0x12'));var hardwareService=require(_0x3a0a('0x13'));var logger=require(_0x3a0a('0x14'))('api');var utils=require(_0x3a0a('0x15'));var config=require('../../config/environment');var db=require(_0x3a0a('0x16'))['db'];function respondWithStatusCode(_0x37f349,_0x24947d){_0x24947d=_0x24947d||0xcc;return function(_0x1b7e2b){if(_0x1b7e2b){return _0x37f349['sendStatus'](_0x24947d);}return _0x37f349[_0x3a0a('0x17')](_0x24947d)[_0x3a0a('0x18')]();};}function respondWithResult(_0x586dd3,_0x42d45e){_0x42d45e=_0x42d45e||0xc8;return function(_0x503f0c){if(_0x503f0c){return _0x586dd3[_0x3a0a('0x17')](_0x42d45e)[_0x3a0a('0x19')](_0x503f0c);}};}function respondWithFilteredResult(_0x261cb2,_0x13324c){return function(_0x2e6210){if(_0x2e6210){var _0x31aae3=_0x2e6210['count'],_0x3d9d72=_0x13324c[_0x3a0a('0x1a')],_0x4eb2b2=_0x13324c['offset']+_0x13324c[_0x3a0a('0x1b')],_0x42214a;if(_0x4eb2b2>=_0x31aae3){_0x4eb2b2=_0x31aae3;_0x42214a=0xc8;}else{_0x42214a=0xce;}_0x261cb2[_0x3a0a('0x17')](_0x42214a);return _0x261cb2[_0x3a0a('0x1c')]('Content-Range',_0x3d9d72+'-'+_0x4eb2b2+'/'+_0x31aae3)['json'](_0x2e6210);}return null;};}function patchUpdates(_0x14a933){return function(_0xb22fab){try{jsonpatch['apply'](_0xb22fab,_0x14a933,!![]);}catch(_0x2448c6){return BPromise[_0x3a0a('0x1d')](_0x2448c6);}return _0xb22fab['save']();};}function saveUpdates(_0x40c151,_0x299122){return function(_0x41d298){if(_0x41d298){return _0x41d298[_0x3a0a('0x1e')](_0x40c151)[_0x3a0a('0x1f')](function(_0x3d5123){return _0x3d5123;});}return null;};}function removeEntity(_0x31d598,_0x16f311){return function(_0x16d444){if(_0x16d444){return _0x16d444[_0x3a0a('0x20')]()['then'](function(){var _0x1badd8=_0x16d444[_0x3a0a('0x21')]({'plain':!![]});var _0x188bad='ExtractedReports';return db[_0x3a0a('0x22')]['destroy']({'where':{'type':_0x188bad,'resourceId':_0x1badd8['id']}})[_0x3a0a('0x1f')](function(){return _0x16d444;});})[_0x3a0a('0x1f')](function(){_0x31d598[_0x3a0a('0x17')](0xcc)[_0x3a0a('0x18')]();});}};}function handleEntityNotFound(_0x48c3cb,_0x7aa305){return function(_0x181123){if(!_0x181123){_0x48c3cb['sendStatus'](0x194);}return _0x181123;};}function handleError(_0x922b3f,_0x3c72e4){_0x3c72e4=_0x3c72e4||0x1f4;return function(_0x21dbdd){logger[_0x3a0a('0x23')](_0x21dbdd[_0x3a0a('0x24')]);if(_0x21dbdd['name']){delete _0x21dbdd[_0x3a0a('0x25')];}_0x922b3f[_0x3a0a('0x17')](_0x3c72e4)[_0x3a0a('0x26')](_0x21dbdd);};}exports[_0x3a0a('0x27')]=function(_0x5a1ad5,_0x191407){var _0x43063b={},_0x146f18={},_0xe692ce={'count':0x0,'rows':[]};var _0x882fbe=_['map'](db[_0x3a0a('0x28')][_0x3a0a('0x29')],function(_0x4f5b4c){return{'name':_0x4f5b4c[_0x3a0a('0x2a')],'type':_0x4f5b4c[_0x3a0a('0x2b')]['key']};});_0x146f18[_0x3a0a('0x2c')]=_[_0x3a0a('0x2d')](_0x882fbe,_0x3a0a('0x25'));_0x146f18[_0x3a0a('0x2e')]=_[_0x3a0a('0x2f')](_0x5a1ad5[_0x3a0a('0x2e')]);_0x146f18['filters']=_[_0x3a0a('0x30')](_0x146f18[_0x3a0a('0x2c')],_0x146f18[_0x3a0a('0x2e')]);_0x43063b[_0x3a0a('0x31')]=_[_0x3a0a('0x30')](_0x146f18[_0x3a0a('0x2c')],qs[_0x3a0a('0x32')](_0x5a1ad5['query'][_0x3a0a('0x32')]));_0x43063b['attributes']=_0x43063b[_0x3a0a('0x31')]['length']?_0x43063b[_0x3a0a('0x31')]:_0x146f18['model'];if(!_0x5a1ad5['query']['hasOwnProperty']('nolimit')){_0x43063b[_0x3a0a('0x1b')]=qs[_0x3a0a('0x1b')](_0x5a1ad5['query'][_0x3a0a('0x1b')]);_0x43063b['offset']=qs[_0x3a0a('0x1a')](_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x1a')]);}_0x43063b[_0x3a0a('0x33')]=qs[_0x3a0a('0x34')](_0x5a1ad5['query'][_0x3a0a('0x34')]);_0x43063b[_0x3a0a('0x35')]=qs[_0x3a0a('0x36')](_[_0x3a0a('0x37')](_0x5a1ad5[_0x3a0a('0x2e')],_0x146f18['filters']),_0x882fbe);if(_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x38')]){_0x43063b[_0x3a0a('0x35')]=_[_0x3a0a('0x39')](_0x43063b[_0x3a0a('0x35')],{'$or':_['map'](_0x882fbe,function(_0x25ef8e){if(_0x25ef8e[_0x3a0a('0x2b')]!=='VIRTUAL'){var _0x1c2a91={};_0x1c2a91[_0x25ef8e[_0x3a0a('0x25')]]={'$like':'%'+_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x38')]+'%'};return _0x1c2a91;}})});}_0x43063b=_[_0x3a0a('0x39')]({},_0x43063b,_0x5a1ad5[_0x3a0a('0x3a')]);var _0x8694cc={'where':_0x43063b[_0x3a0a('0x35')]};return db[_0x3a0a('0x28')][_0x3a0a('0x3b')](_0x8694cc)[_0x3a0a('0x1f')](function(_0x4a49e4){_0xe692ce[_0x3a0a('0x3b')]=_0x4a49e4;if(_0x5a1ad5[_0x3a0a('0x2e')][_0x3a0a('0x3c')]){_0x43063b['include']=[{'all':!![]}];}return db[_0x3a0a('0x28')][_0x3a0a('0x3d')](_0x43063b);})['then'](function(_0x3ab020){_0xe692ce[_0x3a0a('0x3e')]=_0x3ab020;return _0xe692ce;})[_0x3a0a('0x1f')](respondWithFilteredResult(_0x191407,_0x43063b))['catch'](handleError(_0x191407,null));};exports[_0x3a0a('0x3f')]=function(_0x140b13,_0x3fd4d1){var _0x197aae={'raw':!![],'where':{'id':_0x140b13[_0x3a0a('0x40')]['id']}},_0x491b1f={};_0x491b1f[_0x3a0a('0x2c')]=_[_0x3a0a('0x2f')](db[_0x3a0a('0x28')][_0x3a0a('0x29')]);_0x491b1f['query']=_['keys'](_0x140b13[_0x3a0a('0x2e')]);_0x491b1f[_0x3a0a('0x36')]=_[_0x3a0a('0x30')](_0x491b1f[_0x3a0a('0x2c')],_0x491b1f['query']);_0x197aae[_0x3a0a('0x31')]=_[_0x3a0a('0x30')](_0x491b1f[_0x3a0a('0x2c')],qs['fields'](_0x140b13[_0x3a0a('0x2e')][_0x3a0a('0x32')]));_0x197aae[_0x3a0a('0x31')]=_0x197aae[_0x3a0a('0x31')][_0x3a0a('0x41')]?_0x197aae[_0x3a0a('0x31')]:_0x491b1f[_0x3a0a('0x2c')];if(_0x140b13[_0x3a0a('0x2e')]['includeAll']){_0x197aae[_0x3a0a('0x42')]=[{'all':!![]}];}_0x197aae=_[_0x3a0a('0x39')]({},_0x197aae,_0x140b13['options']);return db[_0x3a0a('0x28')]['find'](_0x197aae)[_0x3a0a('0x1f')](handleEntityNotFound(_0x3fd4d1,null))[_0x3a0a('0x1f')](respondWithResult(_0x3fd4d1,null))[_0x3a0a('0x43')](handleError(_0x3fd4d1,null));};exports[_0x3a0a('0x44')]=function(_0x260a93,_0x368758){return db[_0x3a0a('0x28')]['create'](_0x260a93['body'],{})[_0x3a0a('0x1f')](function(_0x1448ab){var _0x16c54d=_0x260a93['user'][_0x3a0a('0x21')]({'plain':!![]});if(!_0x16c54d)throw new Error(_0x3a0a('0x45'));if(_0x16c54d['role']===_0x3a0a('0x46')){var _0x42054e=_0x1448ab[_0x3a0a('0x21')]({'plain':!![]});var _0x3e38fd=_0x3a0a('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x3e38fd,'userProfileId':_0x16c54d['userProfileId']},'raw':!![]})[_0x3a0a('0x1f')](function(_0x2061f1){if(_0x2061f1&&_0x2061f1[_0x3a0a('0x48')]===0x0){return db[_0x3a0a('0x22')]['create']({'name':_0x42054e[_0x3a0a('0x25')],'resourceId':_0x42054e['id'],'type':_0x2061f1['name'],'sectionId':_0x2061f1['id']},{})['then'](function(){return _0x1448ab;});}else{return _0x1448ab;}})['catch'](function(_0x377422){logger[_0x3a0a('0x23')](_0x3a0a('0x49'),_0x377422);throw _0x377422;});}return _0x1448ab;})['then'](respondWithResult(_0x368758,0xc9))[_0x3a0a('0x43')](handleError(_0x368758,null));};exports[_0x3a0a('0x1e')]=function(_0x86ac35,_0x4d007){if(_0x86ac35[_0x3a0a('0x4a')]['id']){delete _0x86ac35[_0x3a0a('0x4a')]['id'];}return db[_0x3a0a('0x28')][_0x3a0a('0x4b')]({'where':{'id':_0x86ac35[_0x3a0a('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d007,null))[_0x3a0a('0x1f')](saveUpdates(_0x86ac35['body'],null))[_0x3a0a('0x1f')](respondWithResult(_0x4d007,null))[_0x3a0a('0x43')](handleError(_0x4d007,null));};exports[_0x3a0a('0x20')]=function(_0x524369,_0x32acb1){return db[_0x3a0a('0x28')]['find']({'where':{'id':_0x524369['params']['id']}})[_0x3a0a('0x1f')](handleEntityNotFound(_0x32acb1,null))['then'](removeEntity(_0x32acb1,null))[_0x3a0a('0x43')](handleError(_0x32acb1,null));};exports[_0x3a0a('0x4c')]=function(_0x5198e0,_0x5d99ee,_0x49274d){return db[_0x3a0a('0x28')]['find']({'where':{'id':_0x5198e0[_0x3a0a('0x40')]['id']},'attributes':[_0x3a0a('0x25'),'basename',_0x3a0a('0x4d'),_0x3a0a('0x4e')],'raw':!![]})[_0x3a0a('0x1f')](handleEntityNotFound(_0x5d99ee,null))[_0x3a0a('0x1f')](function(_0x5a5d43){if(_0x5a5d43){if(!fs[_0x3a0a('0x4f')](path[_0x3a0a('0x50')](config[_0x3a0a('0x51')],'server/files/reports',_0x5a5d43['savename']))){throw new db[(_0x3a0a('0x52'))][(_0x3a0a('0x53'))](_0x3a0a('0x54'));}if(_0x5198e0[_0x3a0a('0x2e')][_0x3a0a('0x55')]){return _0x5d99ee[_0x3a0a('0x56')](0xc8);}return _0x5d99ee[_0x3a0a('0x4c')](path[_0x3a0a('0x50')](config[_0x3a0a('0x51')],_0x3a0a('0x57'),_0x5a5d43[_0x3a0a('0x4d')]),util['format'](_0x3a0a('0x58'),_0x5a5d43[_0x3a0a('0x59')]||_0x5a5d43[_0x3a0a('0x25')],_0x5a5d43[_0x3a0a('0x4e')][_0x3a0a('0x5a')]()));}})[_0x3a0a('0x43')](handleError(_0x5d99ee,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1aa7671..b264535 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 _0x8821=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x4f2fdc,_0x279832){var _0x42a639=function(_0x34436e){while(--_0x34436e){_0x4f2fdc['push'](_0x4f2fdc['shift']());}};_0x42a639(++_0x279832);}(_0x8821,0x1a1));var _0x1882=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0x8821[_0x385eb1];return _0x5d40eb;};'use strict';var _=require('lodash');var util=require(_0x1882('0x0'));var logger=require(_0x1882('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1882('0x2'));var rp=require(_0x1882('0x3'));var fs=require('fs');var path=require(_0x1882('0x4'));var rimraf=require(_0x1882('0x5'));var config=require(_0x1882('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x1882('0x7')]=function(_0xbec9cf,_0x3a4337){return _0xbec9cf[_0x1882('0x8')](_0x1882('0x9'),attributes,{'tableName':_0x1882('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff02=['request-promise','rimraf','../../config/environment','exports','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x4a1e00,_0x4dee07){var _0x152fbe=function(_0x454554){while(--_0x454554){_0x4a1e00['push'](_0x4a1e00['shift']());}};_0x152fbe(++_0x4dee07);}(_0xff02,0x1e5));var _0x2ff0=function(_0x1dbf15,_0x4ce75d){_0x1dbf15=_0x1dbf15-0x0;var _0x20dd47=_0xff02[_0x1dbf15];return _0x20dd47;};'use strict';var _=require(_0x2ff0('0x0'));var util=require(_0x2ff0('0x1'));var logger=require('../../config/logger')(_0x2ff0('0x2'));var moment=require(_0x2ff0('0x3'));var BPromise=require(_0x2ff0('0x4'));var rp=require(_0x2ff0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ff0('0x6'));var config=require(_0x2ff0('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x2ff0('0x8')]=function(_0x34965b,_0x2731e1){return _0x34965b['define']('AnalyticExtractedReport',attributes,{'tableName':_0x2ff0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 16bde1f..c0f8f2b 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 _0x4484=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xc36646,_0x2db8f5){var _0x155c57=function(_0x5b6b28){while(--_0x5b6b28){_0xc36646['push'](_0xc36646['shift']());}};_0x155c57(++_0x2db8f5);}(_0x4484,0x128));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4448('0x0'));var util=require(_0x4448('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4448('0x3'));var logger=require(_0x4448('0x4'))(_0x4448('0x5'));var config=require(_0x4448('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4448('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0bea,_0x567b86,_0x2c5258){return new BPromise(function(_0xd0c6dd,_0x311051){return client[_0x4448('0x8')](_0x2f0bea,_0x2c5258)[_0x4448('0x9')](function(_0x3d7991){logger[_0x4448('0xa')](_0x4448('0xb'),_0x567b86,_0x4448('0xc'));logger[_0x4448('0xd')](_0x4448('0xe'),_0x567b86,'request\x20sent',JSON['stringify'](_0x3d7991));if(_0x3d7991[_0x4448('0xf')]){if(_0x3d7991[_0x4448('0xf')][_0x4448('0x10')]===0x1f4){logger['error'](_0x4448('0xb'),_0x567b86,_0x3d7991['error'][_0x4448('0x11')]);return _0x311051(_0x3d7991['error'][_0x4448('0x11')]);}logger[_0x4448('0xf')](_0x4448('0xb'),_0x567b86,_0x3d7991[_0x4448('0xf')][_0x4448('0x11')]);return _0xd0c6dd(_0x3d7991[_0x4448('0xf')]['message']);}else{logger[_0x4448('0xa')](_0x4448('0xb'),_0x567b86,_0x4448('0xc'));_0xd0c6dd(_0x3d7991[_0x4448('0x12')]['message']);}})['catch'](function(_0x2e77d2){logger[_0x4448('0xf')](_0x4448('0xb'),_0x567b86,_0x2e77d2);_0x311051(_0x2e77d2);});});} \ No newline at end of file +var _0x92b9=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x92b9,0x163));var _0x992b=function(_0x620a7e,_0x10be30){_0x620a7e=_0x620a7e-0x0;var _0x2008c4=_0x92b9[_0x620a7e];return _0x2008c4;};'use strict';var _=require(_0x992b('0x0'));var util=require(_0x992b('0x1'));var moment=require(_0x992b('0x2'));var BPromise=require(_0x992b('0x3'));var rs=require(_0x992b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x992b('0x5'))['db'];var utils=require(_0x992b('0x6'));var logger=require('../../config/logger')(_0x992b('0x7'));var config=require(_0x992b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x992b('0x9')][_0x992b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4006d1,_0x3cc857,_0x5cd8f6){return new BPromise(function(_0x4ac30f,_0x45f472){return client['request'](_0x4006d1,_0x5cd8f6)[_0x992b('0xb')](function(_0x23d26b){logger[_0x992b('0xc')](_0x992b('0xd'),_0x3cc857,'request\x20sent');logger[_0x992b('0xe')](_0x992b('0xf'),_0x3cc857,_0x992b('0x10'),JSON[_0x992b('0x11')](_0x23d26b));if(_0x23d26b[_0x992b('0x12')]){if(_0x23d26b[_0x992b('0x12')]['code']===0x1f4){logger[_0x992b('0x12')](_0x992b('0xd'),_0x3cc857,_0x23d26b['error'][_0x992b('0x13')]);return _0x45f472(_0x23d26b['error'][_0x992b('0x13')]);}logger['error'](_0x992b('0xd'),_0x3cc857,_0x23d26b[_0x992b('0x12')][_0x992b('0x13')]);return _0x4ac30f(_0x23d26b[_0x992b('0x12')][_0x992b('0x13')]);}else{logger[_0x992b('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3cc857,_0x992b('0x10'));_0x4ac30f(_0x23d26b[_0x992b('0x14')][_0x992b('0x13')]);}})['catch'](function(_0xb8e55c){logger[_0x992b('0x12')](_0x992b('0xd'),_0x3cc857,_0xb8e55c);_0x45f472(_0xb8e55c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d2d96e0..1534da5 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 _0x921b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','Router'];(function(_0x233ab6,_0x3b8bdd){var _0x2c8c8e=function(_0x565c45){while(--_0x565c45){_0x233ab6['push'](_0x233ab6['shift']());}};_0x2c8c8e(++_0x3b8bdd);}(_0x921b,0x10d));var _0xb921=function(_0x4b3426,_0x1e8579){_0x4b3426=_0x4b3426-0x0;var _0x5f04a9=_0x921b[_0x4b3426];return _0x5f04a9;};'use strict';var multer=require(_0xb921('0x0'));var util=require(_0xb921('0x1'));var path=require(_0xb921('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb921('0x3')]();var auth=require(_0xb921('0x4'));var interaction=require(_0xb921('0x5'));var config=require(_0xb921('0x6'));var controller=require(_0xb921('0x7'));router[_0xb921('0x8')]('/',auth['isAuthenticated'](),controller[_0xb921('0x9')]);router['get'](_0xb921('0xa'),auth[_0xb921('0xb')](),controller[_0xb921('0xc')]);router['get'](_0xb921('0xd'),auth[_0xb921('0xb')](),controller[_0xb921('0xe')]);router[_0xb921('0xf')]('/',auth['isAuthenticated'](),controller[_0xb921('0x10')]);router[_0xb921('0x11')](_0xb921('0xa'),auth[_0xb921('0xb')](),controller['update']);router[_0xb921('0x12')](_0xb921('0xa'),auth[_0xb921('0xb')](),controller[_0xb921('0x13')]);module[_0xb921('0x14')]=router; \ No newline at end of file +var _0x7868=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id/download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x111c87,_0x2b0e87){var _0x433871=function(_0x45b703){while(--_0x45b703){_0x111c87['push'](_0x111c87['shift']());}};_0x433871(++_0x2b0e87);}(_0x7868,0x67));var _0x8786=function(_0x38c9cf,_0x49c42c){_0x38c9cf=_0x38c9cf-0x0;var _0x3c00c9=_0x7868[_0x38c9cf];return _0x3c00c9;};'use strict';var multer=require(_0x8786('0x0'));var util=require(_0x8786('0x1'));var path=require(_0x8786('0x2'));var timeout=require(_0x8786('0x3'));var express=require(_0x8786('0x4'));var router=express[_0x8786('0x5')]();var auth=require(_0x8786('0x6'));var interaction=require(_0x8786('0x7'));var config=require(_0x8786('0x8'));var controller=require(_0x8786('0x9'));router['get']('/',auth[_0x8786('0xa')](),controller[_0x8786('0xb')]);router[_0x8786('0xc')]('/:id',auth[_0x8786('0xa')](),controller['show']);router[_0x8786('0xc')](_0x8786('0xd'),auth[_0x8786('0xa')](),controller['download']);router[_0x8786('0xe')]('/',auth['isAuthenticated'](),controller[_0x8786('0xf')]);router[_0x8786('0x10')](_0x8786('0x11'),auth[_0x8786('0xa')](),controller[_0x8786('0x12')]);router[_0x8786('0x13')](_0x8786('0x11'),auth['isAuthenticated'](),controller[_0x8786('0x14')]);module[_0x8786('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8e65fc5..3b1064e 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x1cd5b1,_0x58dd23){var _0x25b4c7=function(_0x272195){while(--_0x272195){_0x1cd5b1['push'](_0x1cd5b1['shift']());}};_0x25b4c7(++_0x58dd23);}(_0x326f,0xd1));var _0xf326=function(_0x29462d,_0x42f9cb){_0x29462d=_0x29462d-0x0;var _0x4d97b1=_0x326f[_0x29462d];return _0x4d97b1;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x39b07e,_0x33b057){var _0x591dae=function(_0x5bdec5){while(--_0x5bdec5){_0x39b07e['push'](_0x39b07e['shift']());}};_0x591dae(++_0x33b057);}(_0x326f,0xd1));var _0xf326=function(_0x1bc0d8,_0x156f44){_0x1bc0d8=_0x1bc0d8-0x0;var _0x527bdf=_0x326f[_0x1bc0d8];return _0x527bdf;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d7c0843..2539410 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 _0x973f=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','catch','params','include','find','create','body','bulkCreate','update','destroy','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x48e2eb,_0x2df535){var _0x5eca92=function(_0x170b22){while(--_0x170b22){_0x48e2eb['push'](_0x48e2eb['shift']());}};_0x5eca92(++_0x2df535);}(_0x973f,0x13f));var _0xf973=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x973f[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0xf973('0x0'));var emlformat=require(_0xf973('0x1'));var rimraf=require(_0xf973('0x2'));var zipdir=require(_0xf973('0x3'));var jsonpatch=require(_0xf973('0x4'));var rp=require(_0xf973('0x5'));var moment=require(_0xf973('0x6'));var BPromise=require(_0xf973('0x7'));var Mustache=require(_0xf973('0x8'));var util=require(_0xf973('0x9'));var path=require(_0xf973('0xa'));var sox=require(_0xf973('0xb'));var csv=require(_0xf973('0xc'));var ejs=require(_0xf973('0xd'));var fs=require('fs');var _=require(_0xf973('0xe'));var squel=require(_0xf973('0xf'));var crypto=require(_0xf973('0x10'));var jsforce=require(_0xf973('0x11'));var deskjs=require(_0xf973('0x12'));var toCsv=require('to-csv');var querystring=require(_0xf973('0x13'));var Papa=require('papaparse');var Redis=require(_0xf973('0x14'));var authService=require(_0xf973('0x15'));var qs=require(_0xf973('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf973('0x17'));var utils=require(_0xf973('0x18'));var config=require(_0xf973('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33947f,_0x176b1a){_0x176b1a=_0x176b1a||0xcc;return function(_0x1bef17){if(_0x1bef17){return _0x33947f[_0xf973('0x1a')](_0x176b1a);}return _0x33947f['status'](_0x176b1a)[_0xf973('0x1b')]();};}function respondWithResult(_0x46fd80,_0x44d1d4){_0x44d1d4=_0x44d1d4||0xc8;return function(_0x21d817){if(_0x21d817){return _0x46fd80[_0xf973('0x1c')](_0x44d1d4)[_0xf973('0x1d')](_0x21d817);}};}function respondWithFilteredResult(_0x2d575c,_0x1eb405){return function(_0xb3f815){if(_0xb3f815){var _0x11ae86=_0xb3f815[_0xf973('0x1e')],_0x59509a=_0x1eb405[_0xf973('0x1f')],_0xc51fe1=_0x1eb405[_0xf973('0x1f')]+_0x1eb405['limit'],_0x8f1147;if(_0xc51fe1>=_0x11ae86){_0xc51fe1=_0x11ae86;_0x8f1147=0xc8;}else{_0x8f1147=0xce;}_0x2d575c['status'](_0x8f1147);return _0x2d575c[_0xf973('0x20')](_0xf973('0x21'),_0x59509a+'-'+_0xc51fe1+'/'+_0x11ae86)[_0xf973('0x1d')](_0xb3f815);}return null;};}function patchUpdates(_0x535712){return function(_0x3e043a){try{jsonpatch[_0xf973('0x22')](_0x3e043a,_0x535712,!![]);}catch(_0x2e18dd){return BPromise['reject'](_0x2e18dd);}return _0x3e043a[_0xf973('0x23')]();};}function saveUpdates(_0x4e6ee6,_0x24bac8){return function(_0x56b18b){if(_0x56b18b){return _0x56b18b['update'](_0x4e6ee6)['then'](function(_0x52e7ac){return _0x52e7ac;});}return null;};}function removeEntity(_0x44c100,_0x172b0b){return function(_0x3d0123){if(_0x3d0123){return _0x3d0123['destroy']()['then'](function(){_0x44c100[_0xf973('0x1c')](0xcc)[_0xf973('0x1b')]();});}};}function handleEntityNotFound(_0x459177,_0x2c21f1){return function(_0x715fdc){if(!_0x715fdc){_0x459177[_0xf973('0x1a')](0x194);}return _0x715fdc;};}function handleError(_0x3866d8,_0x3b9f1f){_0x3b9f1f=_0x3b9f1f||0x1f4;return function(_0x5405c8){logger[_0xf973('0x24')](_0x5405c8[_0xf973('0x25')]);if(_0x5405c8['name']){delete _0x5405c8[_0xf973('0x26')];}_0x3866d8[_0xf973('0x1c')](_0x3b9f1f)['send'](_0x5405c8);};}exports[_0xf973('0x27')]=function(_0x31fd9d,_0x2b5843){var _0x10bc79={},_0x28f8d1={},_0x18e2be={'count':0x0,'rows':[]};var _0x4406ee=_[_0xf973('0x28')](db[_0xf973('0x29')][_0xf973('0x2a')],function(_0x1930e5){return{'name':_0x1930e5[_0xf973('0x2b')],'type':_0x1930e5[_0xf973('0x2c')][_0xf973('0x2d')]};});_0x28f8d1[_0xf973('0x2e')]=_[_0xf973('0x28')](_0x4406ee,_0xf973('0x26'));_0x28f8d1[_0xf973('0x2f')]=_[_0xf973('0x30')](_0x31fd9d['query']);_0x28f8d1[_0xf973('0x31')]=_['intersection'](_0x28f8d1[_0xf973('0x2e')],_0x28f8d1[_0xf973('0x2f')]);_0x10bc79[_0xf973('0x32')]=_[_0xf973('0x33')](_0x28f8d1[_0xf973('0x2e')],qs[_0xf973('0x34')](_0x31fd9d['query']['fields']));_0x10bc79[_0xf973('0x32')]=_0x10bc79[_0xf973('0x32')][_0xf973('0x35')]?_0x10bc79[_0xf973('0x32')]:_0x28f8d1[_0xf973('0x2e')];if(!_0x31fd9d[_0xf973('0x2f')]['hasOwnProperty'](_0xf973('0x36'))){_0x10bc79['limit']=qs[_0xf973('0x37')](_0x31fd9d[_0xf973('0x2f')][_0xf973('0x37')]);_0x10bc79['offset']=qs[_0xf973('0x1f')](_0x31fd9d['query'][_0xf973('0x1f')]);}_0x10bc79[_0xf973('0x38')]=qs[_0xf973('0x39')](_0x31fd9d[_0xf973('0x2f')][_0xf973('0x39')]);_0x10bc79[_0xf973('0x3a')]=qs[_0xf973('0x31')](_[_0xf973('0x3b')](_0x31fd9d[_0xf973('0x2f')],_0x28f8d1[_0xf973('0x31')]),_0x4406ee);if(_0x31fd9d['query'][_0xf973('0x3c')]){_0x10bc79[_0xf973('0x3a')]=_['merge'](_0x10bc79[_0xf973('0x3a')],{'$or':_[_0xf973('0x28')](_0x4406ee,function(_0x56cc20){if(_0x56cc20[_0xf973('0x2c')]!=='VIRTUAL'){var _0x44f82d={};_0x44f82d[_0x56cc20[_0xf973('0x26')]]={'$like':'%'+_0x31fd9d[_0xf973('0x2f')][_0xf973('0x3c')]+'%'};return _0x44f82d;}})});}_0x10bc79=_[_0xf973('0x3d')]({},_0x10bc79,_0x31fd9d[_0xf973('0x3e')]);var _0x278f99={'where':_0x10bc79[_0xf973('0x3a')]};return db['AnalyticFieldReport']['count'](_0x278f99)[_0xf973('0x3f')](function(_0x35c1e3){_0x18e2be[_0xf973('0x1e')]=_0x35c1e3;if(_0x31fd9d['query'][_0xf973('0x40')]){_0x10bc79['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xf973('0x41')](_0x10bc79);})[_0xf973('0x3f')](function(_0x26749c){_0x18e2be[_0xf973('0x42')]=_0x26749c;return _0x18e2be;})[_0xf973('0x3f')](respondWithFilteredResult(_0x2b5843,_0x10bc79))[_0xf973('0x43')](handleError(_0x2b5843,null));};exports['show']=function(_0xf8f00a,_0xdaed82){var _0x3a3636={'raw':![],'where':{'id':_0xf8f00a[_0xf973('0x44')]['id']}},_0x544efb={};_0x544efb[_0xf973('0x2e')]=_[_0xf973('0x30')](db[_0xf973('0x29')][_0xf973('0x2a')]);_0x544efb[_0xf973('0x2f')]=_[_0xf973('0x30')](_0xf8f00a[_0xf973('0x2f')]);_0x544efb['filters']=_[_0xf973('0x33')](_0x544efb['model'],_0x544efb[_0xf973('0x2f')]);_0x3a3636[_0xf973('0x32')]=_['intersection'](_0x544efb[_0xf973('0x2e')],qs[_0xf973('0x34')](_0xf8f00a[_0xf973('0x2f')][_0xf973('0x34')]));_0x3a3636[_0xf973('0x32')]=_0x3a3636[_0xf973('0x32')][_0xf973('0x35')]?_0x3a3636['attributes']:_0x544efb[_0xf973('0x2e')];if(_0xf8f00a[_0xf973('0x2f')]['includeAll']){_0x3a3636[_0xf973('0x45')]=[{'all':!![]}];}_0x3a3636=_['merge']({},_0x3a3636,_0xf8f00a[_0xf973('0x3e')]);return db['AnalyticFieldReport'][_0xf973('0x46')](_0x3a3636)[_0xf973('0x3f')](handleEntityNotFound(_0xdaed82,null))[_0xf973('0x3f')](respondWithResult(_0xdaed82,null))[_0xf973('0x43')](handleError(_0xdaed82,null));};exports[_0xf973('0x47')]=function(_0x4c859d,_0x2ac8c9){return db[_0xf973('0x29')][_0xf973('0x47')](_0x4c859d[_0xf973('0x48')],{})[_0xf973('0x3f')](respondWithResult(_0x2ac8c9,0xc9))[_0xf973('0x43')](handleError(_0x2ac8c9,null));};exports['bulkCreate']=function(_0x14e62f,_0x4909d7){return db['AnalyticFieldReport'][_0xf973('0x49')](_0x14e62f['body'],{'raw':![],'individualHooks':!![]})[_0xf973('0x3f')](respondWithResult(_0x4909d7,0xc9))[_0xf973('0x43')](handleError(_0x4909d7,null));};exports[_0xf973('0x4a')]=function(_0x47d31e,_0x223a5a){if(_0x47d31e[_0xf973('0x48')]['id']){delete _0x47d31e[_0xf973('0x48')]['id'];}return db[_0xf973('0x29')][_0xf973('0x46')]({'where':{'id':_0x47d31e[_0xf973('0x44')]['id']}})['then'](handleEntityNotFound(_0x223a5a,null))[_0xf973('0x3f')](saveUpdates(_0x47d31e['body'],null))[_0xf973('0x3f')](respondWithResult(_0x223a5a,null))['catch'](handleError(_0x223a5a,null));};exports[_0xf973('0x4b')]=function(_0x5c7993,_0x73f7e){return db[_0xf973('0x29')][_0xf973('0x46')]({'where':{'id':_0x5c7993[_0xf973('0x44')]['id']}})[_0xf973('0x3f')](handleEntityNotFound(_0x73f7e,null))[_0xf973('0x3f')](removeEntity(_0x73f7e,null))['catch'](handleError(_0x73f7e,null));};exports[_0xf973('0x4c')]=function(_0x3f15fb,_0x3cfa50){return db[_0xf973('0x29')][_0xf973('0x4b')]({'where':{'id':_0x3f15fb[_0xf973('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xf973('0x3f')](respondWithResult(_0x3cfa50,0xcc))[_0xf973('0x43')](handleError(_0x3cfa50,null));};exports[_0xf973('0x4d')]=function(_0x228bfc,_0x1eec6b,_0x1f6136){return db[_0xf973('0x4e')]['findOne']({'where':{'id':_0x228bfc[_0xf973('0x44')]['id']}})[_0xf973('0x3f')](handleEntityNotFound(_0x1eec6b,null))[_0xf973('0x3f')](function(_0xd7f8e9){if(_0xd7f8e9){return db[_0xf973('0x4f')][_0xf973('0x50')](function(_0x12c68b){return db[_0xf973('0x29')][_0xf973('0x4b')]({'where':{'CustomReportId':_0x228bfc[_0xf973('0x44')]['id']},'transaction':_0x12c68b})[_0xf973('0x3f')](function(_0x37af83){var _0x40aca8=_[_0xf973('0x28')](_0x228bfc['body'],function(_0x332e92){delete _0x332e92['id'];_0x332e92[_0xf973('0x51')]=_0x228bfc[_0xf973('0x44')]['id'];return _0x332e92;});return db[_0xf973('0x29')][_0xf973('0x49')](_0x40aca8,{'transaction':_0x12c68b});});})[_0xf973('0x3f')](function(){return db[_0xf973('0x29')][_0xf973('0x41')]({'where':{'CustomReportId':_0x228bfc['params']['id']}});});}})[_0xf973('0x3f')](respondWithResult(_0x1eec6b,null))[_0xf973('0x43')](handleError(_0x1eec6b,null));}; \ No newline at end of file +var _0x1a3c=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','then','destroy','error','name','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','findAll','catch','show','params','keys','create','body','bulkCreate','update','find','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs'];(function(_0x383912,_0x3bb9b4){var _0x5cfe8e=function(_0x102bdd){while(--_0x102bdd){_0x383912['push'](_0x383912['shift']());}};_0x5cfe8e(++_0x3bb9b4);}(_0x1a3c,0x1a6));var _0xc1a3=function(_0x37ca53,_0x28f799){_0x37ca53=_0x37ca53-0x0;var _0x4e94a8=_0x1a3c[_0x37ca53];return _0x4e94a8;};'use strict';var pdf=require(_0xc1a3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc1a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1a3('0x2'));var rp=require(_0xc1a3('0x3'));var moment=require(_0xc1a3('0x4'));var BPromise=require(_0xc1a3('0x5'));var Mustache=require(_0xc1a3('0x6'));var util=require('util');var path=require(_0xc1a3('0x7'));var sox=require(_0xc1a3('0x8'));var csv=require(_0xc1a3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc1a3('0xa'));var squel=require(_0xc1a3('0xb'));var crypto=require('crypto');var jsforce=require(_0xc1a3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1a3('0xd'));var Redis=require(_0xc1a3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc1a3('0xf'));var as=require(_0xc1a3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1a3('0x11'))(_0xc1a3('0x12'));var utils=require(_0xc1a3('0x13'));var config=require(_0xc1a3('0x14'));var db=require(_0xc1a3('0x15'))['db'];function respondWithStatusCode(_0x1d53d4,_0x333476){_0x333476=_0x333476||0xcc;return function(_0x122c8f){if(_0x122c8f){return _0x1d53d4[_0xc1a3('0x16')](_0x333476);}return _0x1d53d4[_0xc1a3('0x17')](_0x333476)[_0xc1a3('0x18')]();};}function respondWithResult(_0x20da25,_0x707d72){_0x707d72=_0x707d72||0xc8;return function(_0x4d9dcc){if(_0x4d9dcc){return _0x20da25[_0xc1a3('0x17')](_0x707d72)[_0xc1a3('0x19')](_0x4d9dcc);}};}function respondWithFilteredResult(_0x5b8eef,_0x133a05){return function(_0x488f51){if(_0x488f51){var _0xb3a107=_0x488f51[_0xc1a3('0x1a')],_0x44faea=_0x133a05[_0xc1a3('0x1b')],_0x139fc2=_0x133a05[_0xc1a3('0x1b')]+_0x133a05[_0xc1a3('0x1c')],_0x54f99f;if(_0x139fc2>=_0xb3a107){_0x139fc2=_0xb3a107;_0x54f99f=0xc8;}else{_0x54f99f=0xce;}_0x5b8eef[_0xc1a3('0x17')](_0x54f99f);return _0x5b8eef[_0xc1a3('0x1d')](_0xc1a3('0x1e'),_0x44faea+'-'+_0x139fc2+'/'+_0xb3a107)[_0xc1a3('0x19')](_0x488f51);}return null;};}function patchUpdates(_0x5de3c7){return function(_0x55a3a4){try{jsonpatch['apply'](_0x55a3a4,_0x5de3c7,!![]);}catch(_0x3233af){return BPromise['reject'](_0x3233af);}return _0x55a3a4['save']();};}function saveUpdates(_0xb64ada,_0x382090){return function(_0x20ac11){if(_0x20ac11){return _0x20ac11['update'](_0xb64ada)[_0xc1a3('0x1f')](function(_0x4c31cb){return _0x4c31cb;});}return null;};}function removeEntity(_0x5a77fc,_0x491165){return function(_0x2d9ac2){if(_0x2d9ac2){return _0x2d9ac2[_0xc1a3('0x20')]()[_0xc1a3('0x1f')](function(){_0x5a77fc[_0xc1a3('0x17')](0xcc)[_0xc1a3('0x18')]();});}};}function handleEntityNotFound(_0x20e306,_0x13bf2e){return function(_0x3a2887){if(!_0x3a2887){_0x20e306[_0xc1a3('0x16')](0x194);}return _0x3a2887;};}function handleError(_0xb4d62b,_0x240f10){_0x240f10=_0x240f10||0x1f4;return function(_0x341e03){logger[_0xc1a3('0x21')](_0x341e03['stack']);if(_0x341e03[_0xc1a3('0x22')]){delete _0x341e03[_0xc1a3('0x22')];}_0xb4d62b[_0xc1a3('0x17')](_0x240f10)['send'](_0x341e03);};}exports[_0xc1a3('0x23')]=function(_0x3527de,_0x184d61){var _0x6f4fa9={},_0x17dbc9={},_0x3b0077={'count':0x0,'rows':[]};var _0x10a8cc=_['map'](db[_0xc1a3('0x24')][_0xc1a3('0x25')],function(_0x27ac47){return{'name':_0x27ac47[_0xc1a3('0x26')],'type':_0x27ac47['type'][_0xc1a3('0x27')]};});_0x17dbc9[_0xc1a3('0x28')]=_[_0xc1a3('0x29')](_0x10a8cc,_0xc1a3('0x22'));_0x17dbc9[_0xc1a3('0x2a')]=_['keys'](_0x3527de[_0xc1a3('0x2a')]);_0x17dbc9[_0xc1a3('0x2b')]=_[_0xc1a3('0x2c')](_0x17dbc9[_0xc1a3('0x28')],_0x17dbc9['query']);_0x6f4fa9[_0xc1a3('0x2d')]=_['intersection'](_0x17dbc9[_0xc1a3('0x28')],qs['fields'](_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x2e')]));_0x6f4fa9[_0xc1a3('0x2d')]=_0x6f4fa9[_0xc1a3('0x2d')][_0xc1a3('0x2f')]?_0x6f4fa9[_0xc1a3('0x2d')]:_0x17dbc9[_0xc1a3('0x28')];if(!_0x3527de['query']['hasOwnProperty'](_0xc1a3('0x30'))){_0x6f4fa9['limit']=qs[_0xc1a3('0x1c')](_0x3527de['query'][_0xc1a3('0x1c')]);_0x6f4fa9[_0xc1a3('0x1b')]=qs['offset'](_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x1b')]);}_0x6f4fa9[_0xc1a3('0x31')]=qs[_0xc1a3('0x32')](_0x3527de['query'][_0xc1a3('0x32')]);_0x6f4fa9['where']=qs[_0xc1a3('0x2b')](_['pick'](_0x3527de[_0xc1a3('0x2a')],_0x17dbc9['filters']),_0x10a8cc);if(_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x33')]){_0x6f4fa9[_0xc1a3('0x34')]=_[_0xc1a3('0x35')](_0x6f4fa9[_0xc1a3('0x34')],{'$or':_[_0xc1a3('0x29')](_0x10a8cc,function(_0x4ed538){if(_0x4ed538[_0xc1a3('0x36')]!==_0xc1a3('0x37')){var _0x44cd59={};_0x44cd59[_0x4ed538['name']]={'$like':'%'+_0x3527de[_0xc1a3('0x2a')][_0xc1a3('0x33')]+'%'};return _0x44cd59;}})});}_0x6f4fa9=_[_0xc1a3('0x35')]({},_0x6f4fa9,_0x3527de[_0xc1a3('0x38')]);var _0x50f68a={'where':_0x6f4fa9['where']};return db['AnalyticFieldReport'][_0xc1a3('0x1a')](_0x50f68a)[_0xc1a3('0x1f')](function(_0xfce1f0){_0x3b0077[_0xc1a3('0x1a')]=_0xfce1f0;if(_0x3527de[_0xc1a3('0x2a')]['includeAll']){_0x6f4fa9['include']=[{'all':!![]}];}return db[_0xc1a3('0x24')][_0xc1a3('0x39')](_0x6f4fa9);})['then'](function(_0xd8f796){_0x3b0077['rows']=_0xd8f796;return _0x3b0077;})[_0xc1a3('0x1f')](respondWithFilteredResult(_0x184d61,_0x6f4fa9))[_0xc1a3('0x3a')](handleError(_0x184d61,null));};exports[_0xc1a3('0x3b')]=function(_0x29bdd6,_0x2b8542){var _0x2bb8e9={'raw':![],'where':{'id':_0x29bdd6[_0xc1a3('0x3c')]['id']}},_0x586435={};_0x586435[_0xc1a3('0x28')]=_[_0xc1a3('0x3d')](db[_0xc1a3('0x24')][_0xc1a3('0x25')]);_0x586435[_0xc1a3('0x2a')]=_[_0xc1a3('0x3d')](_0x29bdd6['query']);_0x586435[_0xc1a3('0x2b')]=_['intersection'](_0x586435[_0xc1a3('0x28')],_0x586435[_0xc1a3('0x2a')]);_0x2bb8e9['attributes']=_[_0xc1a3('0x2c')](_0x586435[_0xc1a3('0x28')],qs[_0xc1a3('0x2e')](_0x29bdd6[_0xc1a3('0x2a')][_0xc1a3('0x2e')]));_0x2bb8e9[_0xc1a3('0x2d')]=_0x2bb8e9[_0xc1a3('0x2d')][_0xc1a3('0x2f')]?_0x2bb8e9[_0xc1a3('0x2d')]:_0x586435[_0xc1a3('0x28')];if(_0x29bdd6[_0xc1a3('0x2a')]['includeAll']){_0x2bb8e9['include']=[{'all':!![]}];}_0x2bb8e9=_['merge']({},_0x2bb8e9,_0x29bdd6['options']);return db[_0xc1a3('0x24')]['find'](_0x2bb8e9)[_0xc1a3('0x1f')](handleEntityNotFound(_0x2b8542,null))[_0xc1a3('0x1f')](respondWithResult(_0x2b8542,null))['catch'](handleError(_0x2b8542,null));};exports[_0xc1a3('0x3e')]=function(_0x147148,_0x5aede8){return db[_0xc1a3('0x24')][_0xc1a3('0x3e')](_0x147148[_0xc1a3('0x3f')],{})[_0xc1a3('0x1f')](respondWithResult(_0x5aede8,0xc9))[_0xc1a3('0x3a')](handleError(_0x5aede8,null));};exports[_0xc1a3('0x40')]=function(_0x39956a,_0x54e666){return db[_0xc1a3('0x24')]['bulkCreate'](_0x39956a[_0xc1a3('0x3f')],{'raw':![],'individualHooks':!![]})[_0xc1a3('0x1f')](respondWithResult(_0x54e666,0xc9))[_0xc1a3('0x3a')](handleError(_0x54e666,null));};exports[_0xc1a3('0x41')]=function(_0xc00834,_0x1ec518){if(_0xc00834['body']['id']){delete _0xc00834[_0xc1a3('0x3f')]['id'];}return db[_0xc1a3('0x24')][_0xc1a3('0x42')]({'where':{'id':_0xc00834[_0xc1a3('0x3c')]['id']}})[_0xc1a3('0x1f')](handleEntityNotFound(_0x1ec518,null))['then'](saveUpdates(_0xc00834[_0xc1a3('0x3f')],null))[_0xc1a3('0x1f')](respondWithResult(_0x1ec518,null))[_0xc1a3('0x3a')](handleError(_0x1ec518,null));};exports[_0xc1a3('0x20')]=function(_0x7ec4ae,_0x147b86){return db['AnalyticFieldReport'][_0xc1a3('0x42')]({'where':{'id':_0x7ec4ae[_0xc1a3('0x3c')]['id']}})[_0xc1a3('0x1f')](handleEntityNotFound(_0x147b86,null))['then'](removeEntity(_0x147b86,null))[_0xc1a3('0x3a')](handleError(_0x147b86,null));};exports[_0xc1a3('0x43')]=function(_0x41f77b,_0x5bde52){return db[_0xc1a3('0x24')][_0xc1a3('0x20')]({'where':{'id':_0x41f77b[_0xc1a3('0x2a')][_0xc1a3('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0xc1a3('0x1f')](respondWithResult(_0x5bde52,0xcc))[_0xc1a3('0x3a')](handleError(_0x5bde52,null));};exports['addFields']=function(_0x58a100,_0x5410de,_0x58bade){return db[_0xc1a3('0x45')][_0xc1a3('0x46')]({'where':{'id':_0x58a100[_0xc1a3('0x3c')]['id']}})[_0xc1a3('0x1f')](handleEntityNotFound(_0x5410de,null))[_0xc1a3('0x1f')](function(_0x2c7532){if(_0x2c7532){return db[_0xc1a3('0x47')][_0xc1a3('0x48')](function(_0x150218){return db['AnalyticFieldReport'][_0xc1a3('0x20')]({'where':{'CustomReportId':_0x58a100[_0xc1a3('0x3c')]['id']},'transaction':_0x150218})[_0xc1a3('0x1f')](function(_0x28951f){var _0x4b0920=_[_0xc1a3('0x29')](_0x58a100[_0xc1a3('0x3f')],function(_0x5d95c2){delete _0x5d95c2['id'];_0x5d95c2['CustomReportId']=_0x58a100[_0xc1a3('0x3c')]['id'];return _0x5d95c2;});return db[_0xc1a3('0x24')]['bulkCreate'](_0x4b0920,{'transaction':_0x150218});});})[_0xc1a3('0x1f')](function(){return db[_0xc1a3('0x24')][_0xc1a3('0x39')]({'where':{'CustomReportId':_0x58a100[_0xc1a3('0x3c')]['id']}});});}})[_0xc1a3('0x1f')](respondWithResult(_0x5410de,null))['catch'](handleError(_0x5410de,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 36b5a23..cfb4f55 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 _0x9304=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x532dd2,_0xceafdb){var _0x2f6b7d=function(_0x29a058){while(--_0x29a058){_0x532dd2['push'](_0x532dd2['shift']());}};_0x2f6b7d(++_0xceafdb);}(_0x9304,0x1bf));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4930('0x0'));var util=require(_0x4930('0x1'));var logger=require(_0x4930('0x2'))('api');var moment=require(_0x4930('0x3'));var BPromise=require(_0x4930('0x4'));var rp=require(_0x4930('0x5'));var fs=require('fs');var path=require(_0x4930('0x6'));var rimraf=require(_0x4930('0x7'));var config=require(_0x4930('0x8'));var attributes=require(_0x4930('0x9'));module[_0x4930('0xa')]=function(_0x38daad,_0x442ad4){return _0x38daad[_0x4930('0xb')](_0x4930('0xc'),attributes,{'tableName':_0x4930('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee02=['lodash','util','bluebird','path','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xee02,0xa2));var _0x2ee0=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xee02[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x2ee0('0x0'));var util=require(_0x2ee0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2ee0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ee0('0x3'));var rimraf=require('rimraf');var config=require(_0x2ee0('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x2ee0('0x5')]=function(_0x478c73,_0xbce544){return _0x478c73[_0x2ee0('0x6')](_0x2ee0('0x7'),attributes,{'tableName':_0x2ee0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 2127996..f5344cd 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 _0x590b=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','AnalyticFieldReport,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird'];(function(_0x17f8c4,_0x58da02){var _0x5bc08d=function(_0x1bbc63){while(--_0x1bbc63){_0x17f8c4['push'](_0x17f8c4['shift']());}};_0x5bc08d(++_0x58da02);}(_0x590b,0x82));var _0xb590=function(_0x1a2f63,_0x21435f){_0x1a2f63=_0x1a2f63-0x0;var _0xaadc1d=_0x590b[_0x1a2f63];return _0xaadc1d;};'use strict';var _=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var moment=require('moment');var BPromise=require(_0xb590('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb590('0x3'));var db=require(_0xb590('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb590('0x5'))(_0xb590('0x6'));var config=require('../../config/environment');var jayson=require(_0xb590('0x7'));var client=jayson['client'][_0xb590('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bf63d,_0x47a96f,_0x4e6b5c){return new BPromise(function(_0x2c77e6,_0x4f039e){return client[_0xb590('0x9')](_0x1bf63d,_0x4e6b5c)[_0xb590('0xa')](function(_0x7afa2a){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x47a96f,_0xb590('0xb'));logger[_0xb590('0xc')](_0xb590('0xd'),_0x47a96f,_0xb590('0xb'),JSON[_0xb590('0xe')](_0x7afa2a));if(_0x7afa2a['error']){if(_0x7afa2a['error']['code']===0x1f4){logger['error'](_0xb590('0xf'),_0x47a96f,_0x7afa2a['error']['message']);return _0x4f039e(_0x7afa2a[_0xb590('0x10')][_0xb590('0x11')]);}logger[_0xb590('0x10')](_0xb590('0xf'),_0x47a96f,_0x7afa2a[_0xb590('0x10')][_0xb590('0x11')]);return _0x2c77e6(_0x7afa2a[_0xb590('0x10')][_0xb590('0x11')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x47a96f,_0xb590('0xb'));_0x2c77e6(_0x7afa2a['result']['message']);}})[_0xb590('0x12')](function(_0x48ac7f){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x47a96f,_0x48ac7f);_0x4f039e(_0x48ac7f);});});} \ No newline at end of file +var _0xaf78=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x751bc2,_0x3959b0){var _0x1dad34=function(_0x308666){while(--_0x308666){_0x751bc2['push'](_0x751bc2['shift']());}};_0x1dad34(++_0x3959b0);}(_0xaf78,0x1bd));var _0x8af7=function(_0x16e01a,_0x5f34e2){_0x16e01a=_0x16e01a-0x0;var _0x3235db=_0xaf78[_0x16e01a];return _0x3235db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8af7('0x0'));var BPromise=require(_0x8af7('0x1'));var rs=require(_0x8af7('0x2'));var fs=require('fs');var Redis=require(_0x8af7('0x3'));var db=require(_0x8af7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8af7('0x5'))('rpc');var config=require(_0x8af7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8af7('0x7')][_0x8af7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43017d,_0x58c65c,_0xb4198c){return new BPromise(function(_0x22ef2e,_0x1d72ca){return client[_0x8af7('0x9')](_0x43017d,_0xb4198c)[_0x8af7('0xa')](function(_0x26cf67){logger[_0x8af7('0xb')](_0x8af7('0xc'),_0x58c65c,_0x8af7('0xd'));logger[_0x8af7('0xe')](_0x8af7('0xf'),_0x58c65c,_0x8af7('0xd'),JSON['stringify'](_0x26cf67));if(_0x26cf67[_0x8af7('0x10')]){if(_0x26cf67[_0x8af7('0x10')][_0x8af7('0x11')]===0x1f4){logger[_0x8af7('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x58c65c,_0x26cf67['error'][_0x8af7('0x12')]);return _0x1d72ca(_0x26cf67['error'][_0x8af7('0x12')]);}logger[_0x8af7('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x58c65c,_0x26cf67['error']['message']);return _0x22ef2e(_0x26cf67[_0x8af7('0x10')][_0x8af7('0x12')]);}else{logger[_0x8af7('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x58c65c,_0x8af7('0xd'));_0x22ef2e(_0x26cf67[_0x8af7('0x13')]['message']);}})[_0x8af7('0x14')](function(_0x5734f0){logger[_0x8af7('0x10')](_0x8af7('0xc'),_0x58c65c,_0x5734f0);_0x1d72ca(_0x5734f0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index cfbb06d..d572b93 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x272cd7,_0x342fa2){var _0x4aa0bd=function(_0x36b43c){while(--_0x36b43c){_0x272cd7['push'](_0x272cd7['shift']());}};_0x4aa0bd(++_0x342fa2);}(_0x814b,0x1a2));var _0xb814=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0x814b[_0x300860];return _0x2094ad;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file +var _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x326f,0xd1));var _0xf326=function(_0x416c14,_0x8f64df){_0x416c14=_0x416c14-0x0;var _0x13a057=_0x326f[_0x416c14];return _0x13a057;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 812e463..7c8b365 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 _0xb574=['name','STRING','sequelize','exports'];(function(_0x4b86c9,_0x5d2422){var _0x4991a3=function(_0x54e770){while(--_0x54e770){_0x4b86c9['push'](_0x4b86c9['shift']());}};_0x4991a3(++_0x5d2422);}(_0xb574,0x106));var _0x4b57=function(_0xfac4e0,_0x10eea8){_0xfac4e0=_0xfac4e0-0x0;var _0x59791c=_0xb574[_0xfac4e0];return _0x59791c;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b57('0x2')},'table':{'type':Sequelize[_0x4b57('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x4b57('0x3')]}}; \ No newline at end of file +var _0x6f18=['TEXT','sequelize','STRING'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x6f18,0x1b4));var _0x86f1=function(_0x46e25c,_0x5b54ae){_0x46e25c=_0x46e25c-0x0;var _0x2d87a0=_0x6f18[_0x46e25c];return _0x2d87a0;};'use strict';var Sequelize=require(_0x86f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x86f1('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x86f1('0x1')]},'metric':{'type':Sequelize[_0x86f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9c26e59..718ef10 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 _0x1775=['reject','save','update','then','destroy','Metrics','UserProfileResource','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','body','user','get','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5177('0x0'));var rimraf=require(_0x5177('0x1'));var zipdir=require(_0x5177('0x2'));var jsonpatch=require(_0x5177('0x3'));var rp=require(_0x5177('0x4'));var moment=require(_0x5177('0x5'));var BPromise=require(_0x5177('0x6'));var Mustache=require(_0x5177('0x7'));var util=require(_0x5177('0x8'));var path=require(_0x5177('0x9'));var sox=require(_0x5177('0xa'));var csv=require(_0x5177('0xb'));var ejs=require(_0x5177('0xc'));var fs=require('fs');var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xb'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var db=require(_0x5177('0x1a'))['db'];function respondWithStatusCode(_0x22fe21,_0xc613b9){_0xc613b9=_0xc613b9||0xcc;return function(_0x3c4ced){if(_0x3c4ced){return _0x22fe21[_0x5177('0x1b')](_0xc613b9);}return _0x22fe21[_0x5177('0x1c')](_0xc613b9)[_0x5177('0x1d')]();};}function respondWithResult(_0x2ec90f,_0x3e6224){_0x3e6224=_0x3e6224||0xc8;return function(_0x1eb9dd){if(_0x1eb9dd){return _0x2ec90f[_0x5177('0x1c')](_0x3e6224)[_0x5177('0x1e')](_0x1eb9dd);}};}function respondWithFilteredResult(_0x29cd2c,_0x31aff8){return function(_0x1b32e6){if(_0x1b32e6){var _0x175ca6=_0x1b32e6['count'],_0x2ab5e5=_0x31aff8[_0x5177('0x1f')],_0x7dba6f=_0x31aff8[_0x5177('0x1f')]+_0x31aff8[_0x5177('0x20')],_0xe6dcf6;if(_0x7dba6f>=_0x175ca6){_0x7dba6f=_0x175ca6;_0xe6dcf6=0xc8;}else{_0xe6dcf6=0xce;}_0x29cd2c[_0x5177('0x1c')](_0xe6dcf6);return _0x29cd2c['set'](_0x5177('0x21'),_0x2ab5e5+'-'+_0x7dba6f+'/'+_0x175ca6)[_0x5177('0x1e')](_0x1b32e6);}return null;};}function patchUpdates(_0x13d5d4){return function(_0x5b5918){try{jsonpatch[_0x5177('0x22')](_0x5b5918,_0x13d5d4,!![]);}catch(_0x4cf600){return BPromise[_0x5177('0x23')](_0x4cf600);}return _0x5b5918[_0x5177('0x24')]();};}function saveUpdates(_0x219744,_0x27b732){return function(_0x451e5c){if(_0x451e5c){return _0x451e5c[_0x5177('0x25')](_0x219744)[_0x5177('0x26')](function(_0xfc1bd4){return _0xfc1bd4;});}return null;};}function removeEntity(_0x2152d4,_0x2a95cc){return function(_0x23dad2){if(_0x23dad2){return _0x23dad2[_0x5177('0x27')]()['then'](function(){var _0x3dcea1=_0x23dad2['get']({'plain':!![]});var _0x30b60f=_0x5177('0x28');return db[_0x5177('0x29')][_0x5177('0x27')]({'where':{'type':_0x30b60f,'resourceId':_0x3dcea1['id']}})['then'](function(){return _0x23dad2;});})[_0x5177('0x26')](function(){_0x2152d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(!_0x577bf7){_0x19a0c2[_0x5177('0x1b')](0x194);}return _0x577bf7;};}function handleError(_0x4eba3a,_0x231d35){_0x231d35=_0x231d35||0x1f4;return function(_0x1cbd29){logger['error'](_0x1cbd29[_0x5177('0x2a')]);if(_0x1cbd29[_0x5177('0x2b')]){delete _0x1cbd29[_0x5177('0x2b')];}_0x4eba3a[_0x5177('0x1c')](_0x231d35)[_0x5177('0x2c')](_0x1cbd29);};}exports[_0x5177('0x2d')]=function(_0x5577bb,_0x498fcd){var _0x45cf20={},_0x1c660e={},_0x7dae59={'count':0x0,'rows':[]};var _0x174f7a=_[_0x5177('0x2e')](db[_0x5177('0x2f')][_0x5177('0x30')],function(_0x72dced){return{'name':_0x72dced['fieldName'],'type':_0x72dced[_0x5177('0x31')][_0x5177('0x32')]};});_0x1c660e['model']=_[_0x5177('0x2e')](_0x174f7a,'name');_0x1c660e[_0x5177('0x33')]=_[_0x5177('0x34')](_0x5577bb[_0x5177('0x33')]);_0x1c660e['filters']=_['intersection'](_0x1c660e[_0x5177('0x35')],_0x1c660e[_0x5177('0x33')]);_0x45cf20[_0x5177('0x36')]=_[_0x5177('0x37')](_0x1c660e[_0x5177('0x35')],qs[_0x5177('0x38')](_0x5577bb[_0x5177('0x33')][_0x5177('0x38')]));_0x45cf20['attributes']=_0x45cf20[_0x5177('0x36')][_0x5177('0x39')]?_0x45cf20['attributes']:_0x1c660e[_0x5177('0x35')];if(!_0x5577bb[_0x5177('0x33')][_0x5177('0x3a')](_0x5177('0x3b'))){_0x45cf20[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x5577bb['query'][_0x5177('0x20')]);_0x45cf20[_0x5177('0x1f')]=qs[_0x5177('0x1f')](_0x5577bb[_0x5177('0x33')][_0x5177('0x1f')]);}_0x45cf20[_0x5177('0x3c')]=qs[_0x5177('0x3d')](_0x5577bb['query'][_0x5177('0x3d')]);_0x45cf20[_0x5177('0x3e')]=qs['filters'](_['pick'](_0x5577bb[_0x5177('0x33')],_0x1c660e[_0x5177('0x3f')]),_0x174f7a);if(_0x5577bb[_0x5177('0x33')][_0x5177('0x40')]){_0x45cf20[_0x5177('0x3e')]=_[_0x5177('0x41')](_0x45cf20[_0x5177('0x3e')],{'$or':_[_0x5177('0x2e')](_0x174f7a,function(_0xa2ed49){if(_0xa2ed49[_0x5177('0x31')]!==_0x5177('0x42')){var _0x1f15f8={};_0x1f15f8[_0xa2ed49[_0x5177('0x2b')]]={'$like':'%'+_0x5577bb['query'][_0x5177('0x40')]+'%'};return _0x1f15f8;}})});}_0x45cf20=_[_0x5177('0x41')]({},_0x45cf20,_0x5577bb['options']);var _0x7341c0={'where':_0x45cf20['where']};return db[_0x5177('0x2f')][_0x5177('0x43')](_0x7341c0)[_0x5177('0x26')](function(_0x5742aa){_0x7dae59['count']=_0x5742aa;if(_0x5577bb[_0x5177('0x33')][_0x5177('0x44')]){_0x45cf20[_0x5177('0x45')]=[{'all':!![]}];}return db[_0x5177('0x2f')][_0x5177('0x46')](_0x45cf20);})[_0x5177('0x26')](function(_0x41d874){_0x7dae59[_0x5177('0x47')]=_0x41d874;return _0x7dae59;})['then'](respondWithFilteredResult(_0x498fcd,_0x45cf20))[_0x5177('0x48')](handleError(_0x498fcd,null));};exports['show']=function(_0x5e3d30,_0x30e4f3){var _0x17dc98={'raw':!![],'where':{'id':_0x5e3d30[_0x5177('0x49')]['id']}},_0x5172f8={};_0x5172f8['model']=_['keys'](db[_0x5177('0x2f')][_0x5177('0x30')]);_0x5172f8[_0x5177('0x33')]=_[_0x5177('0x34')](_0x5e3d30[_0x5177('0x33')]);_0x5172f8[_0x5177('0x3f')]=_[_0x5177('0x37')](_0x5172f8['model'],_0x5172f8['query']);_0x17dc98[_0x5177('0x36')]=_['intersection'](_0x5172f8[_0x5177('0x35')],qs[_0x5177('0x38')](_0x5e3d30[_0x5177('0x33')][_0x5177('0x38')]));_0x17dc98['attributes']=_0x17dc98[_0x5177('0x36')][_0x5177('0x39')]?_0x17dc98[_0x5177('0x36')]:_0x5172f8[_0x5177('0x35')];if(_0x5e3d30[_0x5177('0x33')][_0x5177('0x44')]){_0x17dc98[_0x5177('0x45')]=[{'all':!![]}];}_0x17dc98=_[_0x5177('0x41')]({},_0x17dc98,_0x5e3d30[_0x5177('0x4a')]);return db[_0x5177('0x2f')][_0x5177('0x4b')](_0x17dc98)['then'](handleEntityNotFound(_0x30e4f3,null))[_0x5177('0x26')](respondWithResult(_0x30e4f3,null))['catch'](handleError(_0x30e4f3,null));};exports['create']=function(_0x5bda8a,_0x2f9ff9){return db[_0x5177('0x2f')]['create'](_0x5bda8a[_0x5177('0x4c')],{})[_0x5177('0x26')](function(_0x208483){var _0x4891fe=_0x5bda8a[_0x5177('0x4d')]['get']({'plain':!![]});if(!_0x4891fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4891fe['role']===_0x5177('0x4d')){var _0x37d5dd=_0x208483[_0x5177('0x4e')]({'plain':!![]});var _0x5a1f8b='Metrics';return db[_0x5177('0x4f')]['find']({'where':{'name':_0x5a1f8b,'userProfileId':_0x4891fe[_0x5177('0x50')]},'raw':!![]})[_0x5177('0x26')](function(_0x430e8e){if(_0x430e8e&&_0x430e8e[_0x5177('0x51')]===0x0){return db[_0x5177('0x29')][_0x5177('0x52')]({'name':_0x37d5dd[_0x5177('0x2b')],'resourceId':_0x37d5dd['id'],'type':_0x430e8e[_0x5177('0x2b')],'sectionId':_0x430e8e['id']},{})[_0x5177('0x26')](function(){return _0x208483;});}else{return _0x208483;}})[_0x5177('0x48')](function(_0x89fe3a){logger[_0x5177('0x53')](_0x5177('0x54'),_0x89fe3a);throw _0x89fe3a;});}return _0x208483;})['then'](respondWithResult(_0x2f9ff9,0xc9))['catch'](handleError(_0x2f9ff9,null));};exports[_0x5177('0x25')]=function(_0x5d5016,_0x649c6f){if(_0x5d5016['body']['id']){delete _0x5d5016[_0x5177('0x4c')]['id'];}return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x5d5016['params']['id']}})['then'](handleEntityNotFound(_0x649c6f,null))[_0x5177('0x26')](saveUpdates(_0x5d5016[_0x5177('0x4c')],null))[_0x5177('0x26')](respondWithResult(_0x649c6f,null))[_0x5177('0x48')](handleError(_0x649c6f,null));};exports['destroy']=function(_0x5718a1,_0x3f0e89){return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x5718a1[_0x5177('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f0e89,null))[_0x5177('0x26')](removeEntity(_0x3f0e89,null))[_0x5177('0x48')](handleError(_0x3f0e89,null));}; \ No newline at end of file +var _0x0490=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Metrics','UserProfileResource','error','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x0490,0x147));var _0x0049=function(_0x41732e,_0x4ca559){_0x41732e=_0x41732e-0x0;var _0x225b7e=_0x0490[_0x41732e];return _0x225b7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0049('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0049('0x1'));var BPromise=require(_0x0049('0x2'));var Mustache=require(_0x0049('0x3'));var util=require(_0x0049('0x4'));var path=require(_0x0049('0x5'));var sox=require(_0x0049('0x6'));var csv=require(_0x0049('0x7'));var ejs=require(_0x0049('0x8'));var fs=require('fs');var _=require(_0x0049('0x9'));var squel=require('squel');var crypto=require(_0x0049('0xa'));var jsforce=require(_0x0049('0xb'));var deskjs=require(_0x0049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0049('0xd'));var Papa=require(_0x0049('0xe'));var Redis=require(_0x0049('0xf'));var authService=require(_0x0049('0x10'));var qs=require(_0x0049('0x11'));var as=require(_0x0049('0x12'));var hardwareService=require(_0x0049('0x13'));var logger=require(_0x0049('0x14'))(_0x0049('0x15'));var utils=require('../../config/utils');var config=require(_0x0049('0x16'));var db=require(_0x0049('0x17'))['db'];function respondWithStatusCode(_0x20d5cc,_0x5b4d44){_0x5b4d44=_0x5b4d44||0xcc;return function(_0x547be9){if(_0x547be9){return _0x20d5cc[_0x0049('0x18')](_0x5b4d44);}return _0x20d5cc[_0x0049('0x19')](_0x5b4d44)[_0x0049('0x1a')]();};}function respondWithResult(_0x3898be,_0x42dc6b){_0x42dc6b=_0x42dc6b||0xc8;return function(_0x5934fc){if(_0x5934fc){return _0x3898be[_0x0049('0x19')](_0x42dc6b)[_0x0049('0x1b')](_0x5934fc);}};}function respondWithFilteredResult(_0x573138,_0x1802f5){return function(_0x2aace1){if(_0x2aace1){var _0x2d6b06=_0x2aace1[_0x0049('0x1c')],_0x1a62aa=_0x1802f5[_0x0049('0x1d')],_0x5adcf2=_0x1802f5[_0x0049('0x1d')]+_0x1802f5[_0x0049('0x1e')],_0x502038;if(_0x5adcf2>=_0x2d6b06){_0x5adcf2=_0x2d6b06;_0x502038=0xc8;}else{_0x502038=0xce;}_0x573138[_0x0049('0x19')](_0x502038);return _0x573138[_0x0049('0x1f')](_0x0049('0x20'),_0x1a62aa+'-'+_0x5adcf2+'/'+_0x2d6b06)[_0x0049('0x1b')](_0x2aace1);}return null;};}function patchUpdates(_0x6df63c){return function(_0x226808){try{jsonpatch['apply'](_0x226808,_0x6df63c,!![]);}catch(_0x57dd61){return BPromise[_0x0049('0x21')](_0x57dd61);}return _0x226808['save']();};}function saveUpdates(_0x314d00,_0x4624ff){return function(_0x2a5ec3){if(_0x2a5ec3){return _0x2a5ec3[_0x0049('0x22')](_0x314d00)[_0x0049('0x23')](function(_0x4c1507){return _0x4c1507;});}return null;};}function removeEntity(_0x26a9fb,_0x462ceb){return function(_0x49c00b){if(_0x49c00b){return _0x49c00b[_0x0049('0x24')]()[_0x0049('0x23')](function(){var _0x4d76e0=_0x49c00b[_0x0049('0x25')]({'plain':!![]});var _0x91d727=_0x0049('0x26');return db[_0x0049('0x27')][_0x0049('0x24')]({'where':{'type':_0x91d727,'resourceId':_0x4d76e0['id']}})[_0x0049('0x23')](function(){return _0x49c00b;});})[_0x0049('0x23')](function(){_0x26a9fb[_0x0049('0x19')](0xcc)[_0x0049('0x1a')]();});}};}function handleEntityNotFound(_0x47b0c4,_0x217a12){return function(_0x2813d2){if(!_0x2813d2){_0x47b0c4[_0x0049('0x18')](0x194);}return _0x2813d2;};}function handleError(_0x118bc0,_0x435789){_0x435789=_0x435789||0x1f4;return function(_0x48b588){logger[_0x0049('0x28')](_0x48b588['stack']);if(_0x48b588[_0x0049('0x29')]){delete _0x48b588[_0x0049('0x29')];}_0x118bc0[_0x0049('0x19')](_0x435789)[_0x0049('0x2a')](_0x48b588);};}exports['index']=function(_0x305623,_0x402774){var _0x2407d8={},_0x2b8715={},_0x414029={'count':0x0,'rows':[]};var _0x5e59be=_[_0x0049('0x2b')](db[_0x0049('0x2c')][_0x0049('0x2d')],function(_0x4bd71c){return{'name':_0x4bd71c[_0x0049('0x2e')],'type':_0x4bd71c[_0x0049('0x2f')][_0x0049('0x30')]};});_0x2b8715[_0x0049('0x31')]=_['map'](_0x5e59be,_0x0049('0x29'));_0x2b8715[_0x0049('0x32')]=_['keys'](_0x305623[_0x0049('0x32')]);_0x2b8715[_0x0049('0x33')]=_['intersection'](_0x2b8715[_0x0049('0x31')],_0x2b8715[_0x0049('0x32')]);_0x2407d8[_0x0049('0x34')]=_[_0x0049('0x35')](_0x2b8715[_0x0049('0x31')],qs['fields'](_0x305623[_0x0049('0x32')][_0x0049('0x36')]));_0x2407d8[_0x0049('0x34')]=_0x2407d8[_0x0049('0x34')][_0x0049('0x37')]?_0x2407d8['attributes']:_0x2b8715[_0x0049('0x31')];if(!_0x305623['query'][_0x0049('0x38')](_0x0049('0x39'))){_0x2407d8[_0x0049('0x1e')]=qs['limit'](_0x305623[_0x0049('0x32')]['limit']);_0x2407d8[_0x0049('0x1d')]=qs[_0x0049('0x1d')](_0x305623[_0x0049('0x32')]['offset']);}_0x2407d8[_0x0049('0x3a')]=qs[_0x0049('0x3b')](_0x305623[_0x0049('0x32')][_0x0049('0x3b')]);_0x2407d8[_0x0049('0x3c')]=qs[_0x0049('0x33')](_['pick'](_0x305623[_0x0049('0x32')],_0x2b8715[_0x0049('0x33')]),_0x5e59be);if(_0x305623['query']['filter']){_0x2407d8[_0x0049('0x3c')]=_[_0x0049('0x3d')](_0x2407d8[_0x0049('0x3c')],{'$or':_[_0x0049('0x2b')](_0x5e59be,function(_0x1f35e7){if(_0x1f35e7[_0x0049('0x2f')]!==_0x0049('0x3e')){var _0x267d8a={};_0x267d8a[_0x1f35e7['name']]={'$like':'%'+_0x305623[_0x0049('0x32')][_0x0049('0x3f')]+'%'};return _0x267d8a;}})});}_0x2407d8=_[_0x0049('0x3d')]({},_0x2407d8,_0x305623[_0x0049('0x40')]);var _0xe8a86f={'where':_0x2407d8[_0x0049('0x3c')]};return db[_0x0049('0x2c')][_0x0049('0x1c')](_0xe8a86f)['then'](function(_0x2397aa){_0x414029[_0x0049('0x1c')]=_0x2397aa;if(_0x305623[_0x0049('0x32')][_0x0049('0x41')]){_0x2407d8[_0x0049('0x42')]=[{'all':!![]}];}return db[_0x0049('0x2c')][_0x0049('0x43')](_0x2407d8);})[_0x0049('0x23')](function(_0x469bb1){_0x414029[_0x0049('0x44')]=_0x469bb1;return _0x414029;})[_0x0049('0x23')](respondWithFilteredResult(_0x402774,_0x2407d8))[_0x0049('0x45')](handleError(_0x402774,null));};exports[_0x0049('0x46')]=function(_0x4ebc42,_0x22e083){var _0x2818dd={'raw':!![],'where':{'id':_0x4ebc42['params']['id']}},_0x36a2fc={};_0x36a2fc['model']=_[_0x0049('0x47')](db['AnalyticMetric'][_0x0049('0x2d')]);_0x36a2fc[_0x0049('0x32')]=_[_0x0049('0x47')](_0x4ebc42[_0x0049('0x32')]);_0x36a2fc[_0x0049('0x33')]=_[_0x0049('0x35')](_0x36a2fc[_0x0049('0x31')],_0x36a2fc[_0x0049('0x32')]);_0x2818dd['attributes']=_['intersection'](_0x36a2fc['model'],qs[_0x0049('0x36')](_0x4ebc42[_0x0049('0x32')][_0x0049('0x36')]));_0x2818dd['attributes']=_0x2818dd[_0x0049('0x34')][_0x0049('0x37')]?_0x2818dd[_0x0049('0x34')]:_0x36a2fc['model'];if(_0x4ebc42['query']['includeAll']){_0x2818dd[_0x0049('0x42')]=[{'all':!![]}];}_0x2818dd=_['merge']({},_0x2818dd,_0x4ebc42['options']);return db[_0x0049('0x2c')][_0x0049('0x48')](_0x2818dd)[_0x0049('0x23')](handleEntityNotFound(_0x22e083,null))[_0x0049('0x23')](respondWithResult(_0x22e083,null))[_0x0049('0x45')](handleError(_0x22e083,null));};exports['create']=function(_0xa60a2b,_0x2862bf){return db[_0x0049('0x2c')][_0x0049('0x49')](_0xa60a2b[_0x0049('0x4a')],{})[_0x0049('0x23')](function(_0x5cc0bc){var _0x433ce2=_0xa60a2b['user'][_0x0049('0x25')]({'plain':!![]});if(!_0x433ce2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x433ce2[_0x0049('0x4b')]===_0x0049('0x4c')){var _0x22a8c4=_0x5cc0bc[_0x0049('0x25')]({'plain':!![]});var _0xc3a900='Metrics';return db[_0x0049('0x4d')][_0x0049('0x48')]({'where':{'name':_0xc3a900,'userProfileId':_0x433ce2[_0x0049('0x4e')]},'raw':!![]})[_0x0049('0x23')](function(_0x1cd1dc){if(_0x1cd1dc&&_0x1cd1dc[_0x0049('0x4f')]===0x0){return db['UserProfileResource'][_0x0049('0x49')]({'name':_0x22a8c4['name'],'resourceId':_0x22a8c4['id'],'type':_0x1cd1dc[_0x0049('0x29')],'sectionId':_0x1cd1dc['id']},{})[_0x0049('0x23')](function(){return _0x5cc0bc;});}else{return _0x5cc0bc;}})['catch'](function(_0x1abc14){logger[_0x0049('0x28')](_0x0049('0x50'),_0x1abc14);throw _0x1abc14;});}return _0x5cc0bc;})[_0x0049('0x23')](respondWithResult(_0x2862bf,0xc9))[_0x0049('0x45')](handleError(_0x2862bf,null));};exports[_0x0049('0x22')]=function(_0x23a6fb,_0x528824){if(_0x23a6fb['body']['id']){delete _0x23a6fb[_0x0049('0x4a')]['id'];}return db[_0x0049('0x2c')][_0x0049('0x48')]({'where':{'id':_0x23a6fb[_0x0049('0x51')]['id']}})['then'](handleEntityNotFound(_0x528824,null))[_0x0049('0x23')](saveUpdates(_0x23a6fb['body'],null))['then'](respondWithResult(_0x528824,null))['catch'](handleError(_0x528824,null));};exports['destroy']=function(_0xe3ca3d,_0x227785){return db[_0x0049('0x2c')][_0x0049('0x48')]({'where':{'id':_0xe3ca3d[_0x0049('0x51')]['id']}})['then'](handleEntityNotFound(_0x227785,null))['then'](removeEntity(_0x227785,null))[_0x0049('0x45')](handleError(_0x227785,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fa2e9ab..bc6353b 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 _0x5735=['request-promise','path','rimraf','./analyticMetric.attributes','exports','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird'];(function(_0xde3149,_0x14baf9){var _0x4e09a4=function(_0x9ece31){while(--_0x9ece31){_0xde3149['push'](_0xde3149['shift']());}};_0x4e09a4(++_0x14baf9);}(_0x5735,0xed));var _0x5573=function(_0x3c7f77,_0x50b2a2){_0x3c7f77=_0x3c7f77-0x0;var _0x7f4d0=_0x5735[_0x3c7f77];return _0x7f4d0;};'use strict';var _=require(_0x5573('0x0'));var util=require('util');var logger=require(_0x5573('0x1'))(_0x5573('0x2'));var moment=require(_0x5573('0x3'));var BPromise=require(_0x5573('0x4'));var rp=require(_0x5573('0x5'));var fs=require('fs');var path=require(_0x5573('0x6'));var rimraf=require(_0x5573('0x7'));var config=require('../../config/environment');var attributes=require(_0x5573('0x8'));module[_0x5573('0x9')]=function(_0x2e6d3b,_0x18844e){return _0x2e6d3b['define'](_0x5573('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6583=['define','AnalyticMetric','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6583,0x1e6));var _0x3658=function(_0x2377a3,_0x7b4522){_0x2377a3=_0x2377a3-0x0;var _0x538284=_0x6583[_0x2377a3];return _0x538284;};'use strict';var _=require(_0x3658('0x0'));var util=require(_0x3658('0x1'));var logger=require('../../config/logger')(_0x3658('0x2'));var moment=require(_0x3658('0x3'));var BPromise=require(_0x3658('0x4'));var rp=require(_0x3658('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3658('0x6'));var attributes=require(_0x3658('0x7'));module[_0x3658('0x8')]=function(_0x38f571,_0x476f6f){return _0x38f571[_0x3658('0x9')](_0x3658('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 92b6746..97b8903 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 _0xcc49=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x20a175,_0x3bcada){var _0xf13f48=function(_0x205010){while(--_0x205010){_0x20a175['push'](_0x20a175['shift']());}};_0xf13f48(++_0x3bcada);}(_0xcc49,0x9f));var _0x9cc4=function(_0x455e00,_0x29577f){_0x455e00=_0x455e00-0x0;var _0x568400=_0xcc49[_0x455e00];return _0x568400;};'use strict';var _=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var moment=require('moment');var BPromise=require(_0x9cc4('0x2'));var rs=require(_0x9cc4('0x3'));var fs=require('fs');var Redis=require(_0x9cc4('0x4'));var db=require(_0x9cc4('0x5'))['db'];var utils=require(_0x9cc4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9cc4('0x7'));var client=jayson[_0x9cc4('0x8')][_0x9cc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x281241,_0x3d365a,_0x1bb0ab){return new BPromise(function(_0x6a2bd1,_0x741455){return client[_0x9cc4('0xa')](_0x281241,_0x1bb0ab)[_0x9cc4('0xb')](function(_0x506f8c){logger[_0x9cc4('0xc')](_0x9cc4('0xd'),_0x3d365a,_0x9cc4('0xe'));logger[_0x9cc4('0xf')](_0x9cc4('0x10'),_0x3d365a,'request\x20sent',JSON[_0x9cc4('0x11')](_0x506f8c));if(_0x506f8c[_0x9cc4('0x12')]){if(_0x506f8c[_0x9cc4('0x12')]['code']===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3d365a,_0x506f8c[_0x9cc4('0x12')]['message']);return _0x741455(_0x506f8c['error'][_0x9cc4('0x13')]);}logger[_0x9cc4('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3d365a,_0x506f8c[_0x9cc4('0x12')]['message']);return _0x6a2bd1(_0x506f8c['error'][_0x9cc4('0x13')]);}else{logger[_0x9cc4('0xc')](_0x9cc4('0xd'),_0x3d365a,_0x9cc4('0xe'));_0x6a2bd1(_0x506f8c['result']['message']);}})[_0x9cc4('0x14')](function(_0x2b1911){logger[_0x9cc4('0x12')](_0x9cc4('0xd'),_0x3d365a,_0x2b1911);_0x741455(_0x2b1911);});});} \ No newline at end of file +var _0xf97b=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x106cfc,_0x497abd){var _0x17af18=function(_0x16ec08){while(--_0x16ec08){_0x106cfc['push'](_0x106cfc['shift']());}};_0x17af18(++_0x497abd);}(_0xf97b,0x1e6));var _0xbf97=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf97b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var moment=require(_0xbf97('0x2'));var BPromise=require(_0xbf97('0x3'));var rs=require(_0xbf97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf97('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf97('0x6'))(_0xbf97('0x7'));var config=require(_0xbf97('0x8'));var jayson=require(_0xbf97('0x9'));var client=jayson[_0xbf97('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3244e0,_0x2469dd,_0xa1987e){return new BPromise(function(_0x4d9ca9,_0x4b1e7c){return client[_0xbf97('0xb')](_0x3244e0,_0xa1987e)[_0xbf97('0xc')](function(_0x1cdcf2){logger[_0xbf97('0xd')](_0xbf97('0xe'),_0x2469dd,_0xbf97('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2469dd,_0xbf97('0xf'),JSON[_0xbf97('0x10')](_0x1cdcf2));if(_0x1cdcf2[_0xbf97('0x11')]){if(_0x1cdcf2[_0xbf97('0x11')][_0xbf97('0x12')]===0x1f4){logger[_0xbf97('0x11')](_0xbf97('0xe'),_0x2469dd,_0x1cdcf2[_0xbf97('0x11')][_0xbf97('0x13')]);return _0x4b1e7c(_0x1cdcf2['error']['message']);}logger['error'](_0xbf97('0xe'),_0x2469dd,_0x1cdcf2[_0xbf97('0x11')]['message']);return _0x4d9ca9(_0x1cdcf2[_0xbf97('0x11')]['message']);}else{logger[_0xbf97('0xd')](_0xbf97('0xe'),_0x2469dd,_0xbf97('0xf'));_0x4d9ca9(_0x1cdcf2[_0xbf97('0x14')]['message']);}})[_0xbf97('0x15')](function(_0x1a6436){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x2469dd,_0x1a6436);_0x4b1e7c(_0x1a6436);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b5a9c37..ac33bdd 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdb28,0x106));var _0x8db2=function(_0x101217,_0x17939c){_0x101217=_0x101217-0x0;var _0xc999f5=_0xdb28[_0x101217];return _0xc999f5;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var auth=require(_0x8db2('0x5'));var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router['get']('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xa')]);router['get']('/:id',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')]('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xd')]);router[_0x8db2('0xe')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x10')]);router[_0x8db2('0x11')](_0x8db2('0xf'),auth['isAuthenticated'](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x57ca=['isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x57ca,0x108));var _0xa57c=function(_0x537ee3,_0x22f394){_0x537ee3=_0x537ee3-0x0;var _0x2e8d90=_0x57ca[_0x537ee3];return _0x2e8d90;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./analyticMetric.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['put'](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller['update']);router[_0xa57c('0xe')]('/:id',auth[_0xa57c('0x8')](),controller[_0xa57c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cda1c73..61d58da 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 _0x2442=['sequelize','exports','TEXT'];(function(_0x3fa5a3,_0x56efc7){var _0x32d06a=function(_0x3bb6b3){while(--_0x3bb6b3){_0x3fa5a3['push'](_0x3fa5a3['shift']());}};_0x32d06a(++_0x56efc7);}(_0x2442,0xff));var _0x2244=function(_0x3a115e,_0x3dac39){_0x3a115e=_0x3a115e-0x0;var _0x1b7e61=_0x2442[_0x3a115e];return _0x1b7e61;};'use strict';var Sequelize=require(_0x2244('0x0'));module[_0x2244('0x1')]={'tree':{'type':Sequelize[_0x2244('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0f4e=['exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f4e,0x162));var _0xe0f4=function(_0x12de61,_0x4b56a4){_0x12de61=_0x12de61-0x0;var _0xb3684f=_0x0f4e[_0x12de61];return _0xb3684f;};'use strict';var Sequelize=require('sequelize');module[_0xe0f4('0x0')]={'tree':{'type':Sequelize[_0xe0f4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8f4eb8f..fc2fd67 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 _0xc67d=['status','json','offset','set','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','rawAttributes','fields','length','find','create','body','params','destroy','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x5d7903,_0x46f3fe){var _0x19a55b=function(_0x577222){while(--_0x577222){_0x5d7903['push'](_0x5d7903['shift']());}};_0x19a55b(++_0x46f3fe);}(_0xc67d,0x1d9));var _0xdc67=function(_0x1f404d,_0x1de0d8){_0x1f404d=_0x1f404d-0x0;var _0x16e68a=_0xc67d[_0x1f404d];return _0x16e68a;};'use strict';var pdf=require(_0xdc67('0x0'));var emlformat=require(_0xdc67('0x1'));var rimraf=require(_0xdc67('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc67('0x3'));var moment=require(_0xdc67('0x4'));var BPromise=require(_0xdc67('0x5'));var Mustache=require(_0xdc67('0x6'));var util=require(_0xdc67('0x7'));var path=require('path');var sox=require(_0xdc67('0x8'));var csv=require(_0xdc67('0x9'));var ejs=require(_0xdc67('0xa'));var fs=require('fs');var _=require(_0xdc67('0xb'));var squel=require(_0xdc67('0xc'));var crypto=require(_0xdc67('0xd'));var jsforce=require(_0xdc67('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdc67('0x9'));var querystring=require(_0xdc67('0xf'));var Papa=require(_0xdc67('0x10'));var Redis=require(_0xdc67('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc67('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc67('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdc67('0x14'));var db=require(_0xdc67('0x15'))['db'];function respondWithStatusCode(_0x16d203,_0x3017de){_0x3017de=_0x3017de||0xcc;return function(_0x26353c){if(_0x26353c){return _0x16d203[_0xdc67('0x16')](_0x3017de);}return _0x16d203['status'](_0x3017de)[_0xdc67('0x17')]();};}function respondWithResult(_0x4d3505,_0x2de7d1){_0x2de7d1=_0x2de7d1||0xc8;return function(_0x55fde2){if(_0x55fde2){return _0x4d3505[_0xdc67('0x18')](_0x2de7d1)[_0xdc67('0x19')](_0x55fde2);}};}function respondWithFilteredResult(_0x22feba,_0x25ff4d){return function(_0x45c0cb){if(_0x45c0cb){var _0x38f12c=_0x45c0cb['count'],_0x12c1f3=_0x25ff4d[_0xdc67('0x1a')],_0x3d5807=_0x25ff4d[_0xdc67('0x1a')]+_0x25ff4d['limit'],_0x701fbd;if(_0x3d5807>=_0x38f12c){_0x3d5807=_0x38f12c;_0x701fbd=0xc8;}else{_0x701fbd=0xce;}_0x22feba[_0xdc67('0x18')](_0x701fbd);return _0x22feba[_0xdc67('0x1b')]('Content-Range',_0x12c1f3+'-'+_0x3d5807+'/'+_0x38f12c)['json'](_0x45c0cb);}return null;};}function patchUpdates(_0x51cd80){return function(_0x3fa63f){try{jsonpatch['apply'](_0x3fa63f,_0x51cd80,!![]);}catch(_0x2da385){return BPromise[_0xdc67('0x1c')](_0x2da385);}return _0x3fa63f[_0xdc67('0x1d')]();};}function saveUpdates(_0x55cc92,_0x42d264){return function(_0x48d86c){if(_0x48d86c){return _0x48d86c[_0xdc67('0x1e')](_0x55cc92)[_0xdc67('0x1f')](function(_0x472e47){return _0x472e47;});}return null;};}function removeEntity(_0xdba0a5,_0x2de598){return function(_0x5d93af){if(_0x5d93af){return _0x5d93af['destroy']()[_0xdc67('0x1f')](function(){_0xdba0a5[_0xdc67('0x18')](0xcc)[_0xdc67('0x17')]();});}};}function handleEntityNotFound(_0x58cfff,_0x2766f2){return function(_0x3643b5){if(!_0x3643b5){_0x58cfff[_0xdc67('0x16')](0x194);}return _0x3643b5;};}function handleError(_0x2a483f,_0x451595){_0x451595=_0x451595||0x1f4;return function(_0x35e929){logger[_0xdc67('0x20')](_0x35e929[_0xdc67('0x21')]);if(_0x35e929['name']){delete _0x35e929[_0xdc67('0x22')];}_0x2a483f[_0xdc67('0x18')](_0x451595)[_0xdc67('0x23')](_0x35e929);};}exports[_0xdc67('0x24')]=function(_0x5e2357,_0x409bab){var _0x253f6a={},_0x26830b={},_0x2a2bc5={'count':0x0,'rows':[]};var _0x5713bf=_[_0xdc67('0x25')](db[_0xdc67('0x26')]['rawAttributes'],function(_0x522dd6){return{'name':_0x522dd6[_0xdc67('0x27')],'type':_0x522dd6[_0xdc67('0x28')]['key']};});_0x26830b[_0xdc67('0x29')]=_[_0xdc67('0x25')](_0x5713bf,_0xdc67('0x22'));_0x26830b[_0xdc67('0x2a')]=_[_0xdc67('0x2b')](_0x5e2357[_0xdc67('0x2a')]);_0x26830b[_0xdc67('0x2c')]=_[_0xdc67('0x2d')](_0x26830b[_0xdc67('0x29')],_0x26830b['query']);_0x253f6a['attributes']=_[_0xdc67('0x2d')](_0x26830b[_0xdc67('0x29')],qs['fields'](_0x5e2357[_0xdc67('0x2a')]['fields']));_0x253f6a[_0xdc67('0x2e')]=_0x253f6a[_0xdc67('0x2e')]['length']?_0x253f6a['attributes']:_0x26830b['model'];if(!_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x2f')](_0xdc67('0x30'))){_0x253f6a[_0xdc67('0x31')]=qs[_0xdc67('0x31')](_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x31')]);_0x253f6a[_0xdc67('0x1a')]=qs['offset'](_0x5e2357[_0xdc67('0x2a')]['offset']);}_0x253f6a['order']=qs[_0xdc67('0x32')](_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x32')]);_0x253f6a['where']=qs[_0xdc67('0x2c')](_[_0xdc67('0x33')](_0x5e2357[_0xdc67('0x2a')],_0x26830b['filters']),_0x5713bf);if(_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x34')]){_0x253f6a[_0xdc67('0x35')]=_['merge'](_0x253f6a[_0xdc67('0x35')],{'$or':_[_0xdc67('0x25')](_0x5713bf,function(_0x1ac24b){if(_0x1ac24b[_0xdc67('0x28')]!==_0xdc67('0x36')){var _0x3b75d2={};_0x3b75d2[_0x1ac24b['name']]={'$like':'%'+_0x5e2357[_0xdc67('0x2a')][_0xdc67('0x34')]+'%'};return _0x3b75d2;}})});}_0x253f6a=_[_0xdc67('0x37')]({},_0x253f6a,_0x5e2357[_0xdc67('0x38')]);var _0x4e9773={'where':_0x253f6a[_0xdc67('0x35')]};return db['AnalyticTreeReport'][_0xdc67('0x39')](_0x4e9773)[_0xdc67('0x1f')](function(_0x5f4f28){_0x2a2bc5[_0xdc67('0x39')]=_0x5f4f28;if(_0x5e2357['query'][_0xdc67('0x3a')]){_0x253f6a[_0xdc67('0x3b')]=[{'all':!![]}];}return db[_0xdc67('0x26')][_0xdc67('0x3c')](_0x253f6a);})[_0xdc67('0x1f')](function(_0x3a1a8c){_0x2a2bc5[_0xdc67('0x3d')]=_0x3a1a8c;return _0x2a2bc5;})[_0xdc67('0x1f')](respondWithFilteredResult(_0x409bab,_0x253f6a))[_0xdc67('0x3e')](handleError(_0x409bab,null));};exports['show']=function(_0x2b8cfe,_0x5b475e){var _0x2b7f58={'raw':!![],'where':{'id':_0x2b8cfe['params']['id']}},_0x345512={};_0x345512['model']=_[_0xdc67('0x2b')](db['AnalyticTreeReport'][_0xdc67('0x3f')]);_0x345512[_0xdc67('0x2a')]=_[_0xdc67('0x2b')](_0x2b8cfe[_0xdc67('0x2a')]);_0x345512[_0xdc67('0x2c')]=_[_0xdc67('0x2d')](_0x345512['model'],_0x345512[_0xdc67('0x2a')]);_0x2b7f58[_0xdc67('0x2e')]=_[_0xdc67('0x2d')](_0x345512['model'],qs['fields'](_0x2b8cfe[_0xdc67('0x2a')][_0xdc67('0x40')]));_0x2b7f58[_0xdc67('0x2e')]=_0x2b7f58[_0xdc67('0x2e')][_0xdc67('0x41')]?_0x2b7f58[_0xdc67('0x2e')]:_0x345512[_0xdc67('0x29')];if(_0x2b8cfe[_0xdc67('0x2a')][_0xdc67('0x3a')]){_0x2b7f58[_0xdc67('0x3b')]=[{'all':!![]}];}_0x2b7f58=_['merge']({},_0x2b7f58,_0x2b8cfe['options']);return db[_0xdc67('0x26')][_0xdc67('0x42')](_0x2b7f58)['then'](handleEntityNotFound(_0x5b475e,null))['then'](respondWithResult(_0x5b475e,null))[_0xdc67('0x3e')](handleError(_0x5b475e,null));};exports['create']=function(_0x41369c,_0x1864f1){return db['AnalyticTreeReport'][_0xdc67('0x43')](_0x41369c[_0xdc67('0x44')],{})[_0xdc67('0x1f')](respondWithResult(_0x1864f1,0xc9))[_0xdc67('0x3e')](handleError(_0x1864f1,null));};exports[_0xdc67('0x1e')]=function(_0x5d0b25,_0x2d3310){if(_0x5d0b25[_0xdc67('0x44')]['id']){delete _0x5d0b25['body']['id'];}return db[_0xdc67('0x26')][_0xdc67('0x42')]({'where':{'id':_0x5d0b25[_0xdc67('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d3310,null))['then'](saveUpdates(_0x5d0b25[_0xdc67('0x44')],null))['then'](respondWithResult(_0x2d3310,null))[_0xdc67('0x3e')](handleError(_0x2d3310,null));};exports[_0xdc67('0x46')]=function(_0x2f9897,_0x57f7e8){return db[_0xdc67('0x26')][_0xdc67('0x42')]({'where':{'id':_0x2f9897[_0xdc67('0x45')]['id']}})[_0xdc67('0x1f')](handleEntityNotFound(_0x57f7e8,null))[_0xdc67('0x1f')](removeEntity(_0x57f7e8,null))[_0xdc67('0x3e')](handleError(_0x57f7e8,null));}; \ No newline at end of file +var _0x184d=['attributes','fields','limit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','reject','save','update','then','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','keys','intersection','model'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x184d,0x19b));var _0xd184=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x184d[_0x49b207];return _0x2dc8fa;};'use strict';var pdf=require(_0xd184('0x0'));var emlformat=require(_0xd184('0x1'));var rimraf=require(_0xd184('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd184('0x3'));var rp=require(_0xd184('0x4'));var moment=require(_0xd184('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd184('0x6'));var path=require(_0xd184('0x7'));var sox=require(_0xd184('0x8'));var csv=require('to-csv');var ejs=require(_0xd184('0x9'));var fs=require('fs');var _=require(_0xd184('0xa'));var squel=require(_0xd184('0xb'));var crypto=require('crypto');var jsforce=require(_0xd184('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd184('0xd'));var querystring=require(_0xd184('0xe'));var Papa=require(_0xd184('0xf'));var Redis=require(_0xd184('0x10'));var authService=require(_0xd184('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd184('0x12'))(_0xd184('0x13'));var utils=require(_0xd184('0x14'));var config=require(_0xd184('0x15'));var db=require(_0xd184('0x16'))['db'];function respondWithStatusCode(_0x17daef,_0x342092){_0x342092=_0x342092||0xcc;return function(_0x5a84d6){if(_0x5a84d6){return _0x17daef[_0xd184('0x17')](_0x342092);}return _0x17daef[_0xd184('0x18')](_0x342092)[_0xd184('0x19')]();};}function respondWithResult(_0x306490,_0x365a78){_0x365a78=_0x365a78||0xc8;return function(_0x442616){if(_0x442616){return _0x306490[_0xd184('0x18')](_0x365a78)['json'](_0x442616);}};}function respondWithFilteredResult(_0x1371aa,_0x32a365){return function(_0xea4b51){if(_0xea4b51){var _0x452ee0=_0xea4b51[_0xd184('0x1a')],_0x479c85=_0x32a365[_0xd184('0x1b')],_0x4a881a=_0x32a365[_0xd184('0x1b')]+_0x32a365['limit'],_0x7bef51;if(_0x4a881a>=_0x452ee0){_0x4a881a=_0x452ee0;_0x7bef51=0xc8;}else{_0x7bef51=0xce;}_0x1371aa['status'](_0x7bef51);return _0x1371aa['set'](_0xd184('0x1c'),_0x479c85+'-'+_0x4a881a+'/'+_0x452ee0)['json'](_0xea4b51);}return null;};}function patchUpdates(_0x3b803e){return function(_0x112b98){try{jsonpatch['apply'](_0x112b98,_0x3b803e,!![]);}catch(_0x17a249){return BPromise[_0xd184('0x1d')](_0x17a249);}return _0x112b98[_0xd184('0x1e')]();};}function saveUpdates(_0x246a46,_0x3714a2){return function(_0x2ef179){if(_0x2ef179){return _0x2ef179[_0xd184('0x1f')](_0x246a46)['then'](function(_0x23fc57){return _0x23fc57;});}return null;};}function removeEntity(_0x30b44a,_0xbc2a03){return function(_0x4f428b){if(_0x4f428b){return _0x4f428b['destroy']()[_0xd184('0x20')](function(){_0x30b44a[_0xd184('0x18')](0xcc)[_0xd184('0x19')]();});}};}function handleEntityNotFound(_0x4016c8,_0x5bd8cf){return function(_0x100a3a){if(!_0x100a3a){_0x4016c8[_0xd184('0x17')](0x194);}return _0x100a3a;};}function handleError(_0x451bda,_0x1cad54){_0x1cad54=_0x1cad54||0x1f4;return function(_0x50cb3c){logger['error'](_0x50cb3c['stack']);if(_0x50cb3c[_0xd184('0x21')]){delete _0x50cb3c['name'];}_0x451bda[_0xd184('0x18')](_0x1cad54)['send'](_0x50cb3c);};}exports[_0xd184('0x22')]=function(_0x154928,_0xdcd97){var _0x29de3e={},_0x3c3d9a={},_0xd6e2e5={'count':0x0,'rows':[]};var _0x253a60=_[_0xd184('0x23')](db[_0xd184('0x24')][_0xd184('0x25')],function(_0x4f7f6a){return{'name':_0x4f7f6a[_0xd184('0x26')],'type':_0x4f7f6a[_0xd184('0x27')]['key']};});_0x3c3d9a['model']=_[_0xd184('0x23')](_0x253a60,_0xd184('0x21'));_0x3c3d9a[_0xd184('0x28')]=_[_0xd184('0x29')](_0x154928[_0xd184('0x28')]);_0x3c3d9a['filters']=_[_0xd184('0x2a')](_0x3c3d9a[_0xd184('0x2b')],_0x3c3d9a[_0xd184('0x28')]);_0x29de3e[_0xd184('0x2c')]=_[_0xd184('0x2a')](_0x3c3d9a[_0xd184('0x2b')],qs[_0xd184('0x2d')](_0x154928[_0xd184('0x28')][_0xd184('0x2d')]));_0x29de3e[_0xd184('0x2c')]=_0x29de3e[_0xd184('0x2c')]['length']?_0x29de3e[_0xd184('0x2c')]:_0x3c3d9a['model'];if(!_0x154928[_0xd184('0x28')]['hasOwnProperty']('nolimit')){_0x29de3e[_0xd184('0x2e')]=qs['limit'](_0x154928[_0xd184('0x28')][_0xd184('0x2e')]);_0x29de3e['offset']=qs[_0xd184('0x1b')](_0x154928[_0xd184('0x28')][_0xd184('0x1b')]);}_0x29de3e['order']=qs['sort'](_0x154928['query']['sort']);_0x29de3e[_0xd184('0x2f')]=qs[_0xd184('0x30')](_[_0xd184('0x31')](_0x154928[_0xd184('0x28')],_0x3c3d9a[_0xd184('0x30')]),_0x253a60);if(_0x154928[_0xd184('0x28')]['filter']){_0x29de3e[_0xd184('0x2f')]=_[_0xd184('0x32')](_0x29de3e[_0xd184('0x2f')],{'$or':_[_0xd184('0x23')](_0x253a60,function(_0x401112){if(_0x401112['type']!==_0xd184('0x33')){var _0x29de26={};_0x29de26[_0x401112[_0xd184('0x21')]]={'$like':'%'+_0x154928[_0xd184('0x28')][_0xd184('0x34')]+'%'};return _0x29de26;}})});}_0x29de3e=_['merge']({},_0x29de3e,_0x154928[_0xd184('0x35')]);var _0x2fda97={'where':_0x29de3e[_0xd184('0x2f')]};return db['AnalyticTreeReport'][_0xd184('0x1a')](_0x2fda97)[_0xd184('0x20')](function(_0x2ed4cc){_0xd6e2e5[_0xd184('0x1a')]=_0x2ed4cc;if(_0x154928['query'][_0xd184('0x36')]){_0x29de3e[_0xd184('0x37')]=[{'all':!![]}];}return db[_0xd184('0x24')][_0xd184('0x38')](_0x29de3e);})['then'](function(_0x8cf2d1){_0xd6e2e5[_0xd184('0x39')]=_0x8cf2d1;return _0xd6e2e5;})[_0xd184('0x20')](respondWithFilteredResult(_0xdcd97,_0x29de3e))['catch'](handleError(_0xdcd97,null));};exports[_0xd184('0x3a')]=function(_0x3ba883,_0xa7d440){var _0x4612e5={'raw':!![],'where':{'id':_0x3ba883[_0xd184('0x3b')]['id']}},_0x364cb1={};_0x364cb1['model']=_['keys'](db[_0xd184('0x24')][_0xd184('0x25')]);_0x364cb1[_0xd184('0x28')]=_[_0xd184('0x29')](_0x3ba883['query']);_0x364cb1['filters']=_[_0xd184('0x2a')](_0x364cb1[_0xd184('0x2b')],_0x364cb1[_0xd184('0x28')]);_0x4612e5[_0xd184('0x2c')]=_[_0xd184('0x2a')](_0x364cb1[_0xd184('0x2b')],qs['fields'](_0x3ba883[_0xd184('0x28')]['fields']));_0x4612e5[_0xd184('0x2c')]=_0x4612e5[_0xd184('0x2c')][_0xd184('0x3c')]?_0x4612e5['attributes']:_0x364cb1['model'];if(_0x3ba883[_0xd184('0x28')][_0xd184('0x36')]){_0x4612e5[_0xd184('0x37')]=[{'all':!![]}];}_0x4612e5=_[_0xd184('0x32')]({},_0x4612e5,_0x3ba883[_0xd184('0x35')]);return db[_0xd184('0x24')]['find'](_0x4612e5)['then'](handleEntityNotFound(_0xa7d440,null))[_0xd184('0x20')](respondWithResult(_0xa7d440,null))[_0xd184('0x3d')](handleError(_0xa7d440,null));};exports[_0xd184('0x3e')]=function(_0x32adf2,_0x7b74c9){return db[_0xd184('0x24')][_0xd184('0x3e')](_0x32adf2['body'],{})[_0xd184('0x20')](respondWithResult(_0x7b74c9,0xc9))[_0xd184('0x3d')](handleError(_0x7b74c9,null));};exports[_0xd184('0x1f')]=function(_0xa8645a,_0x26ba71){if(_0xa8645a[_0xd184('0x3f')]['id']){delete _0xa8645a[_0xd184('0x3f')]['id'];}return db['AnalyticTreeReport'][_0xd184('0x40')]({'where':{'id':_0xa8645a[_0xd184('0x3b')]['id']}})['then'](handleEntityNotFound(_0x26ba71,null))['then'](saveUpdates(_0xa8645a[_0xd184('0x3f')],null))[_0xd184('0x20')](respondWithResult(_0x26ba71,null))['catch'](handleError(_0x26ba71,null));};exports['destroy']=function(_0x164ad6,_0x3253e4){return db['AnalyticTreeReport']['find']({'where':{'id':_0x164ad6[_0xd184('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3253e4,null))['then'](removeEntity(_0x3253e4,null))[_0xd184('0x3d')](handleError(_0x3253e4,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1adaf1a..a4a10cb 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 _0x2e11=['util','api','moment','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x2e11,0x112));var _0x12e1=function(_0x1d01be,_0x107191){_0x1d01be=_0x1d01be-0x0;var _0x467fd8=_0x2e11[_0x1d01be];return _0x467fd8;};'use strict';var _=require(_0x12e1('0x0'));var util=require(_0x12e1('0x1'));var logger=require('../../config/logger')(_0x12e1('0x2'));var moment=require(_0x12e1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x12e1('0x4'));var rimraf=require(_0x12e1('0x5'));var config=require(_0x12e1('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x12e1('0x7')]=function(_0x84785c,_0x4fe6fe){return _0x84785c[_0x12e1('0x8')](_0x12e1('0x9'),attributes,{'tableName':_0x12e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc675=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees'];(function(_0x8d25be,_0x5ad363){var _0x3fcb44=function(_0x5ef82b){while(--_0x5ef82b){_0x8d25be['push'](_0x8d25be['shift']());}};_0x3fcb44(++_0x5ad363);}(_0xc675,0x1c8));var _0x5c67=function(_0x59c0c6,_0xb3446c){_0x59c0c6=_0x59c0c6-0x0;var _0x25c8dc=_0xc675[_0x59c0c6];return _0x25c8dc;};'use strict';var _=require('lodash');var util=require(_0x5c67('0x0'));var logger=require(_0x5c67('0x1'))(_0x5c67('0x2'));var moment=require(_0x5c67('0x3'));var BPromise=require(_0x5c67('0x4'));var rp=require(_0x5c67('0x5'));var fs=require('fs');var path=require(_0x5c67('0x6'));var rimraf=require(_0x5c67('0x7'));var config=require(_0x5c67('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x5c67('0x9')]=function(_0x365ca1,_0x14b754){return _0x365ca1[_0x5c67('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x5c67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 2b7ece1..640563a 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 _0xe6a6=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x581960,_0x1232ff){var _0x4ee892=function(_0x2a920d){while(--_0x2a920d){_0x581960['push'](_0x581960['shift']());}};_0x4ee892(++_0x1232ff);}(_0xe6a6,0x1c1));var _0x6e6a=function(_0x388754,_0x4b72a3){_0x388754=_0x388754-0x0;var _0x12246f=_0xe6a6[_0x388754];return _0x12246f;};'use strict';var _=require('lodash');var util=require(_0x6e6a('0x0'));var moment=require(_0x6e6a('0x1'));var BPromise=require(_0x6e6a('0x2'));var rs=require(_0x6e6a('0x3'));var fs=require('fs');var Redis=require(_0x6e6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e6a('0x5'));var logger=require(_0x6e6a('0x6'))(_0x6e6a('0x7'));var config=require(_0x6e6a('0x8'));var jayson=require(_0x6e6a('0x9'));var client=jayson[_0x6e6a('0xa')][_0x6e6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a1911,_0x345e83,_0xd7cf7d){return new BPromise(function(_0x232339,_0x208770){return client[_0x6e6a('0xc')](_0x5a1911,_0xd7cf7d)[_0x6e6a('0xd')](function(_0x156caa){logger[_0x6e6a('0xe')](_0x6e6a('0xf'),_0x345e83,_0x6e6a('0x10'));logger['debug'](_0x6e6a('0x11'),_0x345e83,_0x6e6a('0x10'),JSON[_0x6e6a('0x12')](_0x156caa));if(_0x156caa[_0x6e6a('0x13')]){if(_0x156caa['error'][_0x6e6a('0x14')]===0x1f4){logger[_0x6e6a('0x13')](_0x6e6a('0xf'),_0x345e83,_0x156caa[_0x6e6a('0x13')][_0x6e6a('0x15')]);return _0x208770(_0x156caa[_0x6e6a('0x13')][_0x6e6a('0x15')]);}logger[_0x6e6a('0x13')](_0x6e6a('0xf'),_0x345e83,_0x156caa['error'][_0x6e6a('0x15')]);return _0x232339(_0x156caa[_0x6e6a('0x13')][_0x6e6a('0x15')]);}else{logger[_0x6e6a('0xe')](_0x6e6a('0xf'),_0x345e83,'request\x20sent');_0x232339(_0x156caa[_0x6e6a('0x16')][_0x6e6a('0x15')]);}})[_0x6e6a('0x17')](function(_0x32712b){logger['error'](_0x6e6a('0xf'),_0x345e83,_0x32712b);_0x208770(_0x32712b);});});} \ No newline at end of file +var _0xa45a=['then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xa45a,0x9b));var _0xaa45=function(_0x886621,_0x1eab8d){_0x886621=_0x886621-0x0;var _0x233ce4=_0xa45a[_0x886621];return _0x233ce4;};'use strict';var _=require(_0xaa45('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa45('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa45('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa45('0x3'))('rpc');var config=require(_0xaa45('0x4'));var jayson=require(_0xaa45('0x5'));var client=jayson['client'][_0xaa45('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49bc2b,_0x2dd09c,_0xac5a0d){return new BPromise(function(_0x24db5d,_0x510625){return client['request'](_0x49bc2b,_0xac5a0d)[_0xaa45('0x7')](function(_0xa9e8b0){logger['info'](_0xaa45('0x8'),_0x2dd09c,_0xaa45('0x9'));logger[_0xaa45('0xa')](_0xaa45('0xb'),_0x2dd09c,_0xaa45('0x9'),JSON[_0xaa45('0xc')](_0xa9e8b0));if(_0xa9e8b0[_0xaa45('0xd')]){if(_0xa9e8b0['error'][_0xaa45('0xe')]===0x1f4){logger[_0xaa45('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2dd09c,_0xa9e8b0[_0xaa45('0xd')][_0xaa45('0xf')]);return _0x510625(_0xa9e8b0[_0xaa45('0xd')][_0xaa45('0xf')]);}logger[_0xaa45('0xd')](_0xaa45('0x8'),_0x2dd09c,_0xa9e8b0['error'][_0xaa45('0xf')]);return _0x24db5d(_0xa9e8b0[_0xaa45('0xd')][_0xaa45('0xf')]);}else{logger['info'](_0xaa45('0x8'),_0x2dd09c,_0xaa45('0x9'));_0x24db5d(_0xa9e8b0[_0xaa45('0x10')]['message']);}})[_0xaa45('0x11')](function(_0x5f015c){logger['error'](_0xaa45('0x8'),_0x2dd09c,_0x5f015c);_0x510625(_0x5f015c);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1535d78..f257dae 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 _0x2cb3=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cb3,0x183));var _0x32cb=function(_0x3f4afe,_0x5db38f){_0x3f4afe=_0x3f4afe-0x0;var _0x482cdc=_0x2cb3[_0x3f4afe];return _0x482cdc;};'use strict';var multer=require(_0x32cb('0x0'));var util=require(_0x32cb('0x1'));var path=require('path');var timeout=require(_0x32cb('0x2'));var express=require('express');var router=express[_0x32cb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x32cb('0x4'));var config=require(_0x32cb('0x5'));var controller=require(_0x32cb('0x6'));router[_0x32cb('0x7')]('/',auth[_0x32cb('0x8')](),controller[_0x32cb('0x9')]);router[_0x32cb('0x7')](_0x32cb('0xa'),auth['isAuthenticated'](),controller[_0x32cb('0xb')]);router[_0x32cb('0xc')]('/',auth[_0x32cb('0x8')](),controller['create']);router[_0x32cb('0xd')](_0x32cb('0xa'),auth[_0x32cb('0x8')](),controller[_0x32cb('0xe')]);router[_0x32cb('0xf')](_0x32cb('0xa'),auth['isAuthenticated'](),controller[_0x32cb('0x10')]);module[_0x32cb('0x11')]=router; \ No newline at end of file +var _0x1503=['isAuthenticated','index','get','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1503,0x127));var _0x3150=function(_0x2a27e4,_0x56917a){_0x2a27e4=_0x2a27e4-0x0;var _0x4de982=_0x1503[_0x2a27e4];return _0x4de982;};'use strict';var multer=require(_0x3150('0x0'));var util=require(_0x3150('0x1'));var path=require(_0x3150('0x2'));var timeout=require(_0x3150('0x3'));var express=require(_0x3150('0x4'));var router=express[_0x3150('0x5')]();var auth=require(_0x3150('0x6'));var interaction=require(_0x3150('0x7'));var config=require(_0x3150('0x8'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x3150('0x9')](),controller[_0x3150('0xa')]);router[_0x3150('0xb')]('/:id',auth[_0x3150('0x9')](),controller[_0x3150('0xc')]);router[_0x3150('0xd')]('/',auth[_0x3150('0x9')](),controller[_0x3150('0xe')]);router['put'](_0x3150('0xf'),auth[_0x3150('0x9')](),controller['update']);router[_0x3150('0x10')](_0x3150('0xf'),auth['isAuthenticated'](),controller[_0x3150('0x11')]);module[_0x3150('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 822de7a..8ea75f4 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 _0xd926=['sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd926,0x1bb));var _0x6d92=function(_0x3815ca,_0x5d2ce0){_0x3815ca=_0x3815ca-0x0;var _0xccfa9f=_0xd926[_0x3815ca];return _0xccfa9f;};'use strict';var Sequelize=require(_0x6d92('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc0b7=['exports','STRING','sequelize'];(function(_0x414baf,_0x58e1d0){var _0x3a959b=function(_0x1b06d0){while(--_0x1b06d0){_0x414baf['push'](_0x414baf['shift']());}};_0x3a959b(++_0x58e1d0);}(_0xc0b7,0x1f4));var _0x7c0b=function(_0xb90a9a,_0x3a76fe){_0xb90a9a=_0xb90a9a-0x0;var _0x503084=_0xc0b7[_0xb90a9a];return _0x503084;};'use strict';var Sequelize=require(_0x7c0b('0x0'));module[_0x7c0b('0x1')]={'name':{'type':Sequelize[_0x7c0b('0x2')]},'basename':{'type':Sequelize[_0x7c0b('0x2')]},'type':{'type':Sequelize[_0x7c0b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 43842e4..17c635a 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 _0xfd42=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','where','filters','type','VIRTUAL','filter','merge','include','findAll','rows','catch','show','includeAll','params','length','options','find','get','omit','createdAt','body','updatedAt','create','originalname','basename','file','filename','download','findOne','join','root','html-pdf','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xfd42,0x1f1));var _0x2fd4=function(_0xcf2200,_0x4f5f6b){_0xcf2200=_0xcf2200-0x0;var _0x3aadf1=_0xfd42[_0xcf2200];return _0x3aadf1;};'use strict';var pdf=require(_0x2fd4('0x0'));var emlformat=require(_0x2fd4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2fd4('0x2'));var BPromise=require(_0x2fd4('0x3'));var Mustache=require(_0x2fd4('0x4'));var util=require(_0x2fd4('0x5'));var path=require(_0x2fd4('0x6'));var sox=require(_0x2fd4('0x7'));var csv=require(_0x2fd4('0x8'));var ejs=require(_0x2fd4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2fd4('0xa'));var deskjs=require(_0x2fd4('0xb'));var toCsv=require(_0x2fd4('0x8'));var querystring=require(_0x2fd4('0xc'));var Papa=require(_0x2fd4('0xd'));var Redis=require(_0x2fd4('0xe'));var authService=require(_0x2fd4('0xf'));var qs=require(_0x2fd4('0x10'));var as=require(_0x2fd4('0x11'));var hardwareService=require(_0x2fd4('0x12'));var logger=require(_0x2fd4('0x13'))(_0x2fd4('0x14'));var utils=require(_0x2fd4('0x15'));var config=require(_0x2fd4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x902d56,_0xb1cabe){_0xb1cabe=_0xb1cabe||0xcc;return function(_0x4e3e5f){if(_0x4e3e5f){return _0x902d56[_0x2fd4('0x17')](_0xb1cabe);}return _0x902d56[_0x2fd4('0x18')](_0xb1cabe)['end']();};}function respondWithResult(_0x46e073,_0x2e671c){_0x2e671c=_0x2e671c||0xc8;return function(_0x78d9ad){if(_0x78d9ad){return _0x46e073[_0x2fd4('0x18')](_0x2e671c)[_0x2fd4('0x19')](_0x78d9ad);}};}function respondWithFilteredResult(_0x21e1b4,_0x4c31a1){return function(_0x406c45){if(_0x406c45){var _0x369683=_0x406c45[_0x2fd4('0x1a')],_0x468a93=_0x4c31a1[_0x2fd4('0x1b')],_0x338e71=_0x4c31a1[_0x2fd4('0x1b')]+_0x4c31a1[_0x2fd4('0x1c')],_0x56db02;if(_0x338e71>=_0x369683){_0x338e71=_0x369683;_0x56db02=0xc8;}else{_0x56db02=0xce;}_0x21e1b4[_0x2fd4('0x18')](_0x56db02);return _0x21e1b4[_0x2fd4('0x1d')](_0x2fd4('0x1e'),_0x468a93+'-'+_0x338e71+'/'+_0x369683)[_0x2fd4('0x19')](_0x406c45);}return null;};}function patchUpdates(_0x42bae8){return function(_0xe86f88){try{jsonpatch[_0x2fd4('0x1f')](_0xe86f88,_0x42bae8,!![]);}catch(_0x30150b){return BPromise[_0x2fd4('0x20')](_0x30150b);}return _0xe86f88[_0x2fd4('0x21')]();};}function saveUpdates(_0x228bff,_0x1d7805){return function(_0x410ed7){if(_0x410ed7){return _0x410ed7[_0x2fd4('0x22')](_0x228bff)[_0x2fd4('0x23')](function(_0x52c8dc){return _0x52c8dc;});}return null;};}function removeEntity(_0x139954,_0x303783){return function(_0x5dbdce){if(_0x5dbdce){return _0x5dbdce[_0x2fd4('0x24')]()[_0x2fd4('0x23')](function(){_0x139954[_0x2fd4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c7f6,_0x29c64c){return function(_0x3651e0){if(!_0x3651e0){_0x37c7f6['sendStatus'](0x194);}return _0x3651e0;};}function handleError(_0x601e14,_0x571503){_0x571503=_0x571503||0x1f4;return function(_0x1fb7eb){logger[_0x2fd4('0x25')](_0x1fb7eb[_0x2fd4('0x26')]);if(_0x1fb7eb[_0x2fd4('0x27')]){delete _0x1fb7eb[_0x2fd4('0x27')];}_0x601e14[_0x2fd4('0x18')](_0x571503)[_0x2fd4('0x28')](_0x1fb7eb);};}exports[_0x2fd4('0x29')]=function(_0x2365bb,_0xb2c070){var _0xf0d278={},_0x448dd9={},_0xfda747={'count':0x0,'rows':[]};var _0x4ae485=_[_0x2fd4('0x2a')](db[_0x2fd4('0x2b')][_0x2fd4('0x2c')],function(_0x481e0d){return{'name':_0x481e0d[_0x2fd4('0x2d')],'type':_0x481e0d['type'][_0x2fd4('0x2e')]};});_0x448dd9[_0x2fd4('0x2f')]=_[_0x2fd4('0x2a')](_0x4ae485,'name');_0x448dd9['query']=_[_0x2fd4('0x30')](_0x2365bb[_0x2fd4('0x31')]);_0x448dd9['filters']=_[_0x2fd4('0x32')](_0x448dd9[_0x2fd4('0x2f')],_0x448dd9[_0x2fd4('0x31')]);_0xf0d278['attributes']=_[_0x2fd4('0x32')](_0x448dd9[_0x2fd4('0x2f')],qs[_0x2fd4('0x33')](_0x2365bb['query'][_0x2fd4('0x33')]));_0xf0d278[_0x2fd4('0x34')]=_0xf0d278[_0x2fd4('0x34')]['length']?_0xf0d278['attributes']:_0x448dd9[_0x2fd4('0x2f')];if(!_0x2365bb[_0x2fd4('0x31')][_0x2fd4('0x35')](_0x2fd4('0x36'))){_0xf0d278[_0x2fd4('0x1c')]=qs[_0x2fd4('0x1c')](_0x2365bb['query'][_0x2fd4('0x1c')]);_0xf0d278[_0x2fd4('0x1b')]=qs['offset'](_0x2365bb[_0x2fd4('0x31')]['offset']);}_0xf0d278['order']=qs['sort'](_0x2365bb[_0x2fd4('0x31')]['sort']);_0xf0d278[_0x2fd4('0x37')]=qs['filters'](_['pick'](_0x2365bb['query'],_0x448dd9[_0x2fd4('0x38')]),_0x4ae485);if(_0x2365bb[_0x2fd4('0x31')]['filter']){_0xf0d278['where']=_['merge'](_0xf0d278[_0x2fd4('0x37')],{'$or':_['map'](_0x4ae485,function(_0x168e53){if(_0x168e53[_0x2fd4('0x39')]!==_0x2fd4('0x3a')){var _0x33593c={};_0x33593c[_0x168e53['name']]={'$like':'%'+_0x2365bb[_0x2fd4('0x31')][_0x2fd4('0x3b')]+'%'};return _0x33593c;}})});}_0xf0d278=_[_0x2fd4('0x3c')]({},_0xf0d278,_0x2365bb['options']);var _0x193fd4={'where':_0xf0d278[_0x2fd4('0x37')]};return db['Attachment'][_0x2fd4('0x1a')](_0x193fd4)[_0x2fd4('0x23')](function(_0x147333){_0xfda747['count']=_0x147333;if(_0x2365bb[_0x2fd4('0x31')]['includeAll']){_0xf0d278[_0x2fd4('0x3d')]=[{'all':!![]}];}return db[_0x2fd4('0x2b')][_0x2fd4('0x3e')](_0xf0d278);})[_0x2fd4('0x23')](function(_0x440bee){_0xfda747[_0x2fd4('0x3f')]=_0x440bee;return _0xfda747;})[_0x2fd4('0x23')](respondWithFilteredResult(_0xb2c070,_0xf0d278))[_0x2fd4('0x40')](handleError(_0xb2c070,null));};exports[_0x2fd4('0x41')]=function(_0x3b8f1e,_0xbdb8b9){var _0x72f26a={'raw':!![],'where':{'id':_0x3b8f1e['params']['id']}},_0x1127cc={};_0x1127cc[_0x2fd4('0x2f')]=_[_0x2fd4('0x30')](db[_0x2fd4('0x2b')][_0x2fd4('0x2c')]);_0x1127cc[_0x2fd4('0x31')]=_[_0x2fd4('0x30')](_0x3b8f1e[_0x2fd4('0x31')]);_0x1127cc[_0x2fd4('0x38')]=_[_0x2fd4('0x32')](_0x1127cc[_0x2fd4('0x2f')],_0x1127cc[_0x2fd4('0x31')]);_0x72f26a[_0x2fd4('0x34')]=_[_0x2fd4('0x32')](_0x1127cc[_0x2fd4('0x2f')],qs[_0x2fd4('0x33')](_0x3b8f1e[_0x2fd4('0x31')][_0x2fd4('0x33')]));_0x72f26a[_0x2fd4('0x34')]=_0x72f26a['attributes']['length']?_0x72f26a[_0x2fd4('0x34')]:_0x1127cc[_0x2fd4('0x2f')];if(_0x3b8f1e[_0x2fd4('0x31')][_0x2fd4('0x42')]){_0x72f26a[_0x2fd4('0x3d')]=[{'all':!![]}];}_0x72f26a=_[_0x2fd4('0x3c')]({},_0x72f26a,_0x3b8f1e['options']);return db['Attachment']['find'](_0x72f26a)[_0x2fd4('0x23')](handleEntityNotFound(_0xbdb8b9,null))['then'](respondWithResult(_0xbdb8b9,null))[_0x2fd4('0x40')](handleError(_0xbdb8b9,null));};exports['clone']=function(_0x342058,_0x79730b){var _0x981731={'where':{'id':_0x342058[_0x2fd4('0x43')]['id']}},_0x3bdf2a={};_0x3bdf2a[_0x2fd4('0x2f')]=_['keys'](db['Attachment'][_0x2fd4('0x2c')]);_0x981731['attributes']=_[_0x2fd4('0x32')](_0x3bdf2a['model'],qs['fields'](_0x342058[_0x2fd4('0x31')]['fields']));_0x981731['attributes']=_0x981731[_0x2fd4('0x34')][_0x2fd4('0x44')]?_0x981731[_0x2fd4('0x34')]:_0x3bdf2a[_0x2fd4('0x2f')];if(_0x342058['query'][_0x2fd4('0x42')]){_0x981731[_0x2fd4('0x3d')]=[{'all':!![]}];}_0x981731=_[_0x2fd4('0x3c')]({},_0x981731,_0x342058[_0x2fd4('0x45')]);return db[_0x2fd4('0x2b')][_0x2fd4('0x46')](_0x981731)['then'](handleEntityNotFound(_0x79730b,null))['then'](function(_0x276a61){if(_0x276a61){var _0x5d1585=_0x276a61[_0x2fd4('0x47')]({'plain':!![]});_0x5d1585=qs[_0x2fd4('0x48')](_0x5d1585,['id',_0x2fd4('0x49'),'updatedAt']);_0x342058[_0x2fd4('0x4a')]=_[_0x2fd4('0x48')](_0x342058[_0x2fd4('0x4a')],['id',_0x2fd4('0x49'),_0x2fd4('0x4b')]);return db[_0x2fd4('0x2b')][_0x2fd4('0x4c')](_[_0x2fd4('0x3c')](_0x5d1585,_0x342058['body']),{'include':_0x342058['query'][_0x2fd4('0x42')]?[{'all':!![]}]:undefined});}})[_0x2fd4('0x23')](respondWithResult(_0x79730b,0xc9))[_0x2fd4('0x40')](handleError(_0x79730b,null));};exports[_0x2fd4('0x22')]=function(_0x3ac7be,_0x167bc8){if(_0x3ac7be[_0x2fd4('0x4a')]['id']){delete _0x3ac7be[_0x2fd4('0x4a')]['id'];}return db[_0x2fd4('0x2b')][_0x2fd4('0x46')]({'where':{'id':_0x3ac7be[_0x2fd4('0x43')]['id']}})[_0x2fd4('0x23')](handleEntityNotFound(_0x167bc8,null))[_0x2fd4('0x23')](saveUpdates(_0x3ac7be[_0x2fd4('0x4a')],null))[_0x2fd4('0x23')](respondWithResult(_0x167bc8,null))[_0x2fd4('0x40')](handleError(_0x167bc8,null));};exports[_0x2fd4('0x24')]=function(_0x38ca1b,_0x18002f){return db[_0x2fd4('0x2b')][_0x2fd4('0x46')]({'where':{'id':_0x38ca1b[_0x2fd4('0x43')]['id']}})[_0x2fd4('0x23')](handleEntityNotFound(_0x18002f,null))[_0x2fd4('0x23')](removeEntity(_0x18002f,null))[_0x2fd4('0x40')](handleError(_0x18002f,null));};exports[_0x2fd4('0x4c')]=function(_0xc8083a,_0x3d4103,_0x44e425){_0xc8083a[_0x2fd4('0x4a')][_0x2fd4('0x27')]=_0xc8083a['file'][_0x2fd4('0x4d')];_0xc8083a['body'][_0x2fd4('0x4e')]=_0xc8083a[_0x2fd4('0x4f')][_0x2fd4('0x50')];_0xc8083a[_0x2fd4('0x4a')][_0x2fd4('0x39')]=_0xc8083a['file']['mimetype'];return db[_0x2fd4('0x2b')]['create'](_0xc8083a['body'])[_0x2fd4('0x23')](respondWithResult(_0x3d4103,0xc9))[_0x2fd4('0x40')](handleError(_0x3d4103,null));};exports[_0x2fd4('0x51')]=function(_0xcafc00,_0x5808c1,_0x36386f){return db[_0x2fd4('0x2b')][_0x2fd4('0x52')]({'where':{'id':_0xcafc00[_0x2fd4('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5808c1,null))['then'](function(_0x55584b){if(_0x55584b){return _0x5808c1[_0x2fd4('0x51')](path[_0x2fd4('0x53')](config[_0x2fd4('0x54')],'server/files/attachments/',_0x55584b[_0x2fd4('0x4e')]));}})[_0x2fd4('0x40')](handleError(_0x5808c1,null));}; \ No newline at end of file +var _0x0d7a=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','Attachment','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','rawAttributes','include','find','clone','get','omit','createdAt','updatedAt','body','file','originalname','basename','filename','create','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','apply'];(function(_0x4a48d8,_0x576db6){var _0x1dabb0=function(_0xe8382b){while(--_0xe8382b){_0x4a48d8['push'](_0x4a48d8['shift']());}};_0x1dabb0(++_0x576db6);}(_0x0d7a,0x18d));var _0xa0d7=function(_0x1243ea,_0x55ee56){_0x1243ea=_0x1243ea-0x0;var _0x348358=_0x0d7a[_0x1243ea];return _0x348358;};'use strict';var pdf=require(_0xa0d7('0x0'));var emlformat=require(_0xa0d7('0x1'));var rimraf=require(_0xa0d7('0x2'));var zipdir=require(_0xa0d7('0x3'));var jsonpatch=require(_0xa0d7('0x4'));var rp=require(_0xa0d7('0x5'));var moment=require(_0xa0d7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa0d7('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa0d7('0x8'));var csv=require(_0xa0d7('0x9'));var ejs=require(_0xa0d7('0xa'));var fs=require('fs');var _=require(_0xa0d7('0xb'));var squel=require('squel');var crypto=require(_0xa0d7('0xc'));var jsforce=require(_0xa0d7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa0d7('0x9'));var querystring=require(_0xa0d7('0xe'));var Papa=require('papaparse');var Redis=require(_0xa0d7('0xf'));var authService=require(_0xa0d7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa0d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0d7('0x12'))('api');var utils=require(_0xa0d7('0x13'));var config=require(_0xa0d7('0x14'));var db=require(_0xa0d7('0x15'))['db'];function respondWithStatusCode(_0x457b2a,_0x8dd6ed){_0x8dd6ed=_0x8dd6ed||0xcc;return function(_0x45d337){if(_0x45d337){return _0x457b2a['sendStatus'](_0x8dd6ed);}return _0x457b2a[_0xa0d7('0x16')](_0x8dd6ed)['end']();};}function respondWithResult(_0x3b08ad,_0x2e4b39){_0x2e4b39=_0x2e4b39||0xc8;return function(_0x31b6d){if(_0x31b6d){return _0x3b08ad[_0xa0d7('0x16')](_0x2e4b39)[_0xa0d7('0x17')](_0x31b6d);}};}function respondWithFilteredResult(_0x335ad4,_0x5ec1a4){return function(_0x553879){if(_0x553879){var _0x52a33d=_0x553879['count'],_0x1fc798=_0x5ec1a4[_0xa0d7('0x18')],_0x4488af=_0x5ec1a4['offset']+_0x5ec1a4[_0xa0d7('0x19')],_0x37f4ed;if(_0x4488af>=_0x52a33d){_0x4488af=_0x52a33d;_0x37f4ed=0xc8;}else{_0x37f4ed=0xce;}_0x335ad4[_0xa0d7('0x16')](_0x37f4ed);return _0x335ad4['set'](_0xa0d7('0x1a'),_0x1fc798+'-'+_0x4488af+'/'+_0x52a33d)[_0xa0d7('0x17')](_0x553879);}return null;};}function patchUpdates(_0x1bc68a){return function(_0x504027){try{jsonpatch[_0xa0d7('0x1b')](_0x504027,_0x1bc68a,!![]);}catch(_0x252a91){return BPromise[_0xa0d7('0x1c')](_0x252a91);}return _0x504027[_0xa0d7('0x1d')]();};}function saveUpdates(_0x1ddeed,_0x3fb09a){return function(_0xacaf78){if(_0xacaf78){return _0xacaf78[_0xa0d7('0x1e')](_0x1ddeed)[_0xa0d7('0x1f')](function(_0xa6da8d){return _0xa6da8d;});}return null;};}function removeEntity(_0x5807db,_0x266454){return function(_0x422872){if(_0x422872){return _0x422872[_0xa0d7('0x20')]()[_0xa0d7('0x1f')](function(){_0x5807db[_0xa0d7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313a31,_0xf3b9ba){return function(_0x2bc08a){if(!_0x2bc08a){_0x313a31[_0xa0d7('0x21')](0x194);}return _0x2bc08a;};}function handleError(_0x285f2c,_0x4ca7d1){_0x4ca7d1=_0x4ca7d1||0x1f4;return function(_0x1dc450){logger[_0xa0d7('0x22')](_0x1dc450[_0xa0d7('0x23')]);if(_0x1dc450[_0xa0d7('0x24')]){delete _0x1dc450[_0xa0d7('0x24')];}_0x285f2c[_0xa0d7('0x16')](_0x4ca7d1)[_0xa0d7('0x25')](_0x1dc450);};}exports['index']=function(_0xcf18fc,_0x2fc611){var _0x2dbd45={},_0x43969f={},_0x212e24={'count':0x0,'rows':[]};var _0x5bb86c=_['map'](db[_0xa0d7('0x26')]['rawAttributes'],function(_0x4cbe23){return{'name':_0x4cbe23[_0xa0d7('0x27')],'type':_0x4cbe23[_0xa0d7('0x28')][_0xa0d7('0x29')]};});_0x43969f[_0xa0d7('0x2a')]=_[_0xa0d7('0x2b')](_0x5bb86c,'name');_0x43969f[_0xa0d7('0x2c')]=_[_0xa0d7('0x2d')](_0xcf18fc['query']);_0x43969f[_0xa0d7('0x2e')]=_[_0xa0d7('0x2f')](_0x43969f[_0xa0d7('0x2a')],_0x43969f['query']);_0x2dbd45[_0xa0d7('0x30')]=_[_0xa0d7('0x2f')](_0x43969f['model'],qs[_0xa0d7('0x31')](_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x31')]));_0x2dbd45[_0xa0d7('0x30')]=_0x2dbd45[_0xa0d7('0x30')][_0xa0d7('0x32')]?_0x2dbd45[_0xa0d7('0x30')]:_0x43969f[_0xa0d7('0x2a')];if(!_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x33')](_0xa0d7('0x34'))){_0x2dbd45[_0xa0d7('0x19')]=qs[_0xa0d7('0x19')](_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x19')]);_0x2dbd45['offset']=qs['offset'](_0xcf18fc[_0xa0d7('0x2c')]['offset']);}_0x2dbd45[_0xa0d7('0x35')]=qs['sort'](_0xcf18fc[_0xa0d7('0x2c')]['sort']);_0x2dbd45[_0xa0d7('0x36')]=qs['filters'](_[_0xa0d7('0x37')](_0xcf18fc['query'],_0x43969f['filters']),_0x5bb86c);if(_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x38')]){_0x2dbd45[_0xa0d7('0x36')]=_[_0xa0d7('0x39')](_0x2dbd45[_0xa0d7('0x36')],{'$or':_[_0xa0d7('0x2b')](_0x5bb86c,function(_0x114e89){if(_0x114e89[_0xa0d7('0x28')]!==_0xa0d7('0x3a')){var _0x4d73fa={};_0x4d73fa[_0x114e89['name']]={'$like':'%'+_0xcf18fc['query'][_0xa0d7('0x38')]+'%'};return _0x4d73fa;}})});}_0x2dbd45=_[_0xa0d7('0x39')]({},_0x2dbd45,_0xcf18fc[_0xa0d7('0x3b')]);var _0x1e2e85={'where':_0x2dbd45[_0xa0d7('0x36')]};return db[_0xa0d7('0x26')][_0xa0d7('0x3c')](_0x1e2e85)[_0xa0d7('0x1f')](function(_0x36ce3e){_0x212e24['count']=_0x36ce3e;if(_0xcf18fc[_0xa0d7('0x2c')][_0xa0d7('0x3d')]){_0x2dbd45['include']=[{'all':!![]}];}return db[_0xa0d7('0x26')][_0xa0d7('0x3e')](_0x2dbd45);})[_0xa0d7('0x1f')](function(_0xf8006e){_0x212e24[_0xa0d7('0x3f')]=_0xf8006e;return _0x212e24;})[_0xa0d7('0x1f')](respondWithFilteredResult(_0x2fc611,_0x2dbd45))[_0xa0d7('0x40')](handleError(_0x2fc611,null));};exports['show']=function(_0x56fd80,_0x9b6e53){var _0x28306c={'raw':!![],'where':{'id':_0x56fd80[_0xa0d7('0x41')]['id']}},_0x417865={};_0x417865[_0xa0d7('0x2a')]=_['keys'](db[_0xa0d7('0x26')][_0xa0d7('0x42')]);_0x417865[_0xa0d7('0x2c')]=_[_0xa0d7('0x2d')](_0x56fd80[_0xa0d7('0x2c')]);_0x417865[_0xa0d7('0x2e')]=_[_0xa0d7('0x2f')](_0x417865[_0xa0d7('0x2a')],_0x417865[_0xa0d7('0x2c')]);_0x28306c[_0xa0d7('0x30')]=_[_0xa0d7('0x2f')](_0x417865[_0xa0d7('0x2a')],qs['fields'](_0x56fd80[_0xa0d7('0x2c')][_0xa0d7('0x31')]));_0x28306c['attributes']=_0x28306c[_0xa0d7('0x30')][_0xa0d7('0x32')]?_0x28306c['attributes']:_0x417865[_0xa0d7('0x2a')];if(_0x56fd80[_0xa0d7('0x2c')][_0xa0d7('0x3d')]){_0x28306c[_0xa0d7('0x43')]=[{'all':!![]}];}_0x28306c=_[_0xa0d7('0x39')]({},_0x28306c,_0x56fd80['options']);return db[_0xa0d7('0x26')][_0xa0d7('0x44')](_0x28306c)['then'](handleEntityNotFound(_0x9b6e53,null))[_0xa0d7('0x1f')](respondWithResult(_0x9b6e53,null))[_0xa0d7('0x40')](handleError(_0x9b6e53,null));};exports[_0xa0d7('0x45')]=function(_0x2310ac,_0x40b34a){var _0x25a8f4={'where':{'id':_0x2310ac['params']['id']}},_0x6c7b2={};_0x6c7b2['model']=_[_0xa0d7('0x2d')](db[_0xa0d7('0x26')]['rawAttributes']);_0x25a8f4['attributes']=_['intersection'](_0x6c7b2[_0xa0d7('0x2a')],qs[_0xa0d7('0x31')](_0x2310ac[_0xa0d7('0x2c')][_0xa0d7('0x31')]));_0x25a8f4['attributes']=_0x25a8f4[_0xa0d7('0x30')][_0xa0d7('0x32')]?_0x25a8f4[_0xa0d7('0x30')]:_0x6c7b2[_0xa0d7('0x2a')];if(_0x2310ac[_0xa0d7('0x2c')][_0xa0d7('0x3d')]){_0x25a8f4['include']=[{'all':!![]}];}_0x25a8f4=_[_0xa0d7('0x39')]({},_0x25a8f4,_0x2310ac[_0xa0d7('0x3b')]);return db['Attachment'][_0xa0d7('0x44')](_0x25a8f4)[_0xa0d7('0x1f')](handleEntityNotFound(_0x40b34a,null))['then'](function(_0x46cd82){if(_0x46cd82){var _0x6497f4=_0x46cd82[_0xa0d7('0x46')]({'plain':!![]});_0x6497f4=qs[_0xa0d7('0x47')](_0x6497f4,['id',_0xa0d7('0x48'),_0xa0d7('0x49')]);_0x2310ac['body']=_[_0xa0d7('0x47')](_0x2310ac[_0xa0d7('0x4a')],['id','createdAt',_0xa0d7('0x49')]);return db['Attachment']['create'](_[_0xa0d7('0x39')](_0x6497f4,_0x2310ac['body']),{'include':_0x2310ac['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xa0d7('0x1f')](respondWithResult(_0x40b34a,0xc9))[_0xa0d7('0x40')](handleError(_0x40b34a,null));};exports[_0xa0d7('0x1e')]=function(_0xbdf6c0,_0x4a5a99){if(_0xbdf6c0['body']['id']){delete _0xbdf6c0[_0xa0d7('0x4a')]['id'];}return db['Attachment'][_0xa0d7('0x44')]({'where':{'id':_0xbdf6c0[_0xa0d7('0x41')]['id']}})[_0xa0d7('0x1f')](handleEntityNotFound(_0x4a5a99,null))['then'](saveUpdates(_0xbdf6c0[_0xa0d7('0x4a')],null))[_0xa0d7('0x1f')](respondWithResult(_0x4a5a99,null))[_0xa0d7('0x40')](handleError(_0x4a5a99,null));};exports['destroy']=function(_0x4857ad,_0x23234d){return db['Attachment']['find']({'where':{'id':_0x4857ad[_0xa0d7('0x41')]['id']}})[_0xa0d7('0x1f')](handleEntityNotFound(_0x23234d,null))[_0xa0d7('0x1f')](removeEntity(_0x23234d,null))[_0xa0d7('0x40')](handleError(_0x23234d,null));};exports['create']=function(_0x31640a,_0x69fe3d,_0x46d744){_0x31640a[_0xa0d7('0x4a')][_0xa0d7('0x24')]=_0x31640a[_0xa0d7('0x4b')][_0xa0d7('0x4c')];_0x31640a['body'][_0xa0d7('0x4d')]=_0x31640a[_0xa0d7('0x4b')][_0xa0d7('0x4e')];_0x31640a['body'][_0xa0d7('0x28')]=_0x31640a[_0xa0d7('0x4b')]['mimetype'];return db[_0xa0d7('0x26')][_0xa0d7('0x4f')](_0x31640a[_0xa0d7('0x4a')])['then'](respondWithResult(_0x69fe3d,0xc9))[_0xa0d7('0x40')](handleError(_0x69fe3d,null));};exports[_0xa0d7('0x50')]=function(_0x2b9c66,_0x52aab1,_0x14a039){return db[_0xa0d7('0x26')][_0xa0d7('0x51')]({'where':{'id':_0x2b9c66[_0xa0d7('0x41')]['id']},'raw':!![]})[_0xa0d7('0x1f')](handleEntityNotFound(_0x52aab1,null))['then'](function(_0x3e744f){if(_0x3e744f){return _0x52aab1[_0xa0d7('0x50')](path[_0xa0d7('0x52')](config[_0xa0d7('0x53')],_0xa0d7('0x54'),_0x3e744f[_0xa0d7('0x4d')]));}})[_0xa0d7('0x40')](handleError(_0x52aab1,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4f44ad7..c5ecd98 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 _0x2f68=['Attachment','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x2f68,0x9a));var _0x82f6=function(_0x2c6758,_0x4ffd7a){_0x2c6758=_0x2c6758-0x0;var _0x1c291d=_0x2f68[_0x2c6758];return _0x1c291d;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x82f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var attributes=require('./attachment.attributes');module[_0x82f6('0x7')]=function(_0x2c4302,_0x542737){return _0x2c4302['define'](_0x82f6('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd87e=['moment','bluebird','path','../../config/environment','./attachment.attributes','Attachment','attachments','lodash','util','api'];(function(_0x5efbee,_0x137fa1){var _0x2c4125=function(_0x4fbf80){while(--_0x4fbf80){_0x5efbee['push'](_0x5efbee['shift']());}};_0x2c4125(++_0x137fa1);}(_0xd87e,0x1bf));var _0xed87=function(_0x48ae97,_0x450240){_0x48ae97=_0x48ae97-0x0;var _0x13a62f=_0xd87e[_0x48ae97];return _0x13a62f;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var moment=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed87('0x5'));var rimraf=require('rimraf');var config=require(_0xed87('0x6'));var attributes=require(_0xed87('0x7'));module['exports']=function(_0x17adfe,_0x589fb9){return _0x17adfe['define'](_0xed87('0x8'),attributes,{'tableName':_0xed87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 9fb4b6d..3a993d4 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 _0xe1e7=['body','options','raw','CreateAttachment','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Attachment','create'];(function(_0x3948aa,_0x254cf8){var _0x45ccae=function(_0x3855a9){while(--_0x3855a9){_0x3948aa['push'](_0x3948aa['shift']());}};_0x45ccae(++_0x254cf8);}(_0xe1e7,0x143));var _0x7e1e=function(_0x13cba8,_0x4e7fae){_0x13cba8=_0x13cba8-0x0;var _0x1d53b2=_0xe1e7[_0x13cba8];return _0x1d53b2;};'use strict';var _=require(_0x7e1e('0x0'));var util=require('util');var moment=require(_0x7e1e('0x1'));var BPromise=require(_0x7e1e('0x2'));var rs=require(_0x7e1e('0x3'));var fs=require('fs');var Redis=require(_0x7e1e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e1e('0x5'));var logger=require(_0x7e1e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e1e('0x7'));var client=jayson[_0x7e1e('0x8')][_0x7e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39c4f5,_0x1e1d58,_0x4828f7){return new BPromise(function(_0x1bbc7f,_0xbe7b62){return client[_0x7e1e('0xa')](_0x39c4f5,_0x4828f7)[_0x7e1e('0xb')](function(_0x532324){logger['info'](_0x7e1e('0xc'),_0x1e1d58,_0x7e1e('0xd'));logger[_0x7e1e('0xe')](_0x7e1e('0xf'),_0x1e1d58,_0x7e1e('0xd'),JSON[_0x7e1e('0x10')](_0x532324));if(_0x532324[_0x7e1e('0x11')]){if(_0x532324['error'][_0x7e1e('0x12')]===0x1f4){logger[_0x7e1e('0x11')](_0x7e1e('0xc'),_0x1e1d58,_0x532324[_0x7e1e('0x11')][_0x7e1e('0x13')]);return _0xbe7b62(_0x532324['error'][_0x7e1e('0x13')]);}logger[_0x7e1e('0x11')](_0x7e1e('0xc'),_0x1e1d58,_0x532324['error'][_0x7e1e('0x13')]);return _0x1bbc7f(_0x532324[_0x7e1e('0x11')][_0x7e1e('0x13')]);}else{logger[_0x7e1e('0x14')](_0x7e1e('0xc'),_0x1e1d58,_0x7e1e('0xd'));_0x1bbc7f(_0x532324[_0x7e1e('0x15')][_0x7e1e('0x13')]);}})[_0x7e1e('0x16')](function(_0x1393df){logger['error'](_0x7e1e('0xc'),_0x1e1d58,_0x1393df);_0xbe7b62(_0x1393df);});});}exports['CreateAttachment']=function(_0x3c6713){var _0x2806b1=this;return new Promise(function(_0x2aab71,_0x534487){return db[_0x7e1e('0x17')][_0x7e1e('0x18')](_0x3c6713[_0x7e1e('0x19')],{'raw':_0x3c6713[_0x7e1e('0x1a')]?_0x3c6713[_0x7e1e('0x1a')][_0x7e1e('0x1b')]===undefined?!![]:![]:!![]})[_0x7e1e('0xb')](function(_0x48c182){logger[_0x7e1e('0x14')](_0x7e1e('0x1c'),_0x3c6713);logger[_0x7e1e('0xe')](_0x7e1e('0x1c'),_0x3c6713,JSON[_0x7e1e('0x10')](_0x48c182));_0x2aab71(_0x48c182);})[_0x7e1e('0x16')](function(_0x3d6e3e){logger[_0x7e1e('0x11')](_0x7e1e('0x1c'),_0x3d6e3e[_0x7e1e('0x13')],_0x3c6713);_0x534487(_0x2806b1[_0x7e1e('0x11')](0x1f4,_0x3d6e3e[_0x7e1e('0x13')]));});});}; \ No newline at end of file +var _0x289c=['create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment'];(function(_0x2abd96,_0xbefb59){var _0x584582=function(_0x63111d){while(--_0x63111d){_0x2abd96['push'](_0x2abd96['shift']());}};_0x584582(++_0xbefb59);}(_0x289c,0x126));var _0xc289=function(_0x244cb4,_0x5da548){_0x244cb4=_0x244cb4-0x0;var _0xad88f4=_0x289c[_0x244cb4];return _0xad88f4;};'use strict';var _=require(_0xc289('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc289('0x1'));var rs=require(_0xc289('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc289('0x3'))['db'];var utils=require(_0xc289('0x4'));var logger=require(_0xc289('0x5'))(_0xc289('0x6'));var config=require('../../config/environment');var jayson=require(_0xc289('0x7'));var client=jayson[_0xc289('0x8')][_0xc289('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8dd6,_0x381615,_0x1ea59c){return new BPromise(function(_0x5e848a,_0x57d96c){return client[_0xc289('0xa')](_0x3f8dd6,_0x1ea59c)[_0xc289('0xb')](function(_0x3792e5){logger[_0xc289('0xc')](_0xc289('0xd'),_0x381615,_0xc289('0xe'));logger[_0xc289('0xf')](_0xc289('0x10'),_0x381615,_0xc289('0xe'),JSON[_0xc289('0x11')](_0x3792e5));if(_0x3792e5[_0xc289('0x12')]){if(_0x3792e5[_0xc289('0x12')][_0xc289('0x13')]===0x1f4){logger[_0xc289('0x12')](_0xc289('0xd'),_0x381615,_0x3792e5[_0xc289('0x12')][_0xc289('0x14')]);return _0x57d96c(_0x3792e5[_0xc289('0x12')][_0xc289('0x14')]);}logger[_0xc289('0x12')](_0xc289('0xd'),_0x381615,_0x3792e5[_0xc289('0x12')]['message']);return _0x5e848a(_0x3792e5[_0xc289('0x12')][_0xc289('0x14')]);}else{logger[_0xc289('0xc')]('Attachment,\x20%s,\x20%s',_0x381615,'request\x20sent');_0x5e848a(_0x3792e5[_0xc289('0x15')]['message']);}})[_0xc289('0x16')](function(_0x595e0f){logger['error'](_0xc289('0xd'),_0x381615,_0x595e0f);_0x57d96c(_0x595e0f);});});}exports[_0xc289('0x17')]=function(_0x615d81){var _0x1ea0cd=this;return new Promise(function(_0x564b6b,_0x5ad385){return db[_0xc289('0x18')][_0xc289('0x19')](_0x615d81[_0xc289('0x1a')],{'raw':_0x615d81['options']?_0x615d81[_0xc289('0x1b')][_0xc289('0x1c')]===undefined?!![]:![]:!![]})[_0xc289('0xb')](function(_0x3ebf3a){logger[_0xc289('0xc')]('CreateAttachment',_0x615d81);logger['debug'](_0xc289('0x17'),_0x615d81,JSON[_0xc289('0x11')](_0x3ebf3a));_0x564b6b(_0x3ebf3a);})[_0xc289('0x16')](function(_0x5a7584){logger[_0xc289('0x12')](_0xc289('0x17'),_0x5a7584[_0xc289('0x14')],_0x615d81);_0x5ad385(_0x1ea0cd['error'](0x1f4,_0x5a7584[_0xc289('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3945910..3a0c225 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 _0x2015=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','single','put','destroy','multer','util','path'];(function(_0x14fff8,_0x1c9f11){var _0x3a959b=function(_0x4e92b9){while(--_0x4e92b9){_0x14fff8['push'](_0x14fff8['shift']());}};_0x3a959b(++_0x1c9f11);}(_0x2015,0x193));var _0x5201=function(_0x4ad513,_0x487bc7){_0x4ad513=_0x4ad513-0x0;var _0x8a9d6e=_0x2015[_0x4ad513];return _0x8a9d6e;};'use strict';var multer=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var path=require(_0x5201('0x2'));var timeout=require(_0x5201('0x3'));var express=require(_0x5201('0x4'));var router=express[_0x5201('0x5')]();var auth=require(_0x5201('0x6'));var interaction=require(_0x5201('0x7'));var config=require('../../config/environment');var controller=require(_0x5201('0x8'));router[_0x5201('0x9')]('/',auth[_0x5201('0xa')](),controller[_0x5201('0xb')]);router[_0x5201('0x9')](_0x5201('0xc'),auth[_0x5201('0xa')](),controller[_0x5201('0xd')]);router[_0x5201('0x9')](_0x5201('0xe'),auth['isAuthenticated'](),controller[_0x5201('0xf')]);router[_0x5201('0x10')]('/:id/clone',auth[_0x5201('0xa')](),controller[_0x5201('0x11')]);var upload=multer({'storage':multer[_0x5201('0x12')]({'destination':function(_0x47aa66,_0x129e16,_0x29c68f){_0x29c68f(null,path[_0x5201('0x13')](config[_0x5201('0x14')],_0x5201('0x15')));},'filename':function(_0x26677a,_0x2038a9,_0x677cd5){_0x677cd5(null,util[_0x5201('0x16')](_0x5201('0x17'),Date[_0x5201('0x18')](),_0x2038a9[_0x5201('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5201('0x10')]('/',upload[_0x5201('0x1a')]('file'),controller['create']);router[_0x5201('0x1b')](_0x5201('0xc'),auth[_0x5201('0xa')](),controller['update']);router['delete'](_0x5201('0xc'),auth['isAuthenticated'](),controller[_0x5201('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3eae=['../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','download','/:id/clone','clone','diskStorage','join','root','format','%s-%s','now','post','single','file','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eae,0x126));var _0xe3ea=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x3eae[_0x7148a3];return _0x52f31d;};'use strict';var multer=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var path=require(_0xe3ea('0x2'));var timeout=require(_0xe3ea('0x3'));var express=require('express');var router=express[_0xe3ea('0x4')]();var auth=require(_0xe3ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe3ea('0x6'));var controller=require(_0xe3ea('0x7'));router[_0xe3ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xe3ea('0x9')]);router[_0xe3ea('0x8')](_0xe3ea('0xa'),auth[_0xe3ea('0xb')](),controller[_0xe3ea('0xc')]);router[_0xe3ea('0x8')]('/:id/download',auth[_0xe3ea('0xb')](),controller[_0xe3ea('0xd')]);router['post'](_0xe3ea('0xe'),auth[_0xe3ea('0xb')](),controller[_0xe3ea('0xf')]);var upload=multer({'storage':multer[_0xe3ea('0x10')]({'destination':function(_0x1db54c,_0x577d3b,_0x2796ed){_0x2796ed(null,path[_0xe3ea('0x11')](config[_0xe3ea('0x12')],'server/files/attachments/'));},'filename':function(_0x309396,_0x3fa991,_0x470912){_0x470912(null,util[_0xe3ea('0x13')](_0xe3ea('0x14'),Date[_0xe3ea('0x15')](),_0x3fa991['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe3ea('0x16')]('/',upload[_0xe3ea('0x17')](_0xe3ea('0x18')),controller[_0xe3ea('0x19')]);router[_0xe3ea('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xe3ea('0x1b')]);router[_0xe3ea('0x1c')]('/:id',auth[_0xe3ea('0xb')](),controller[_0xe3ea('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index cf04dff..194848f 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 _0x95c3=['value','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','Strategy','../../mysqldb','signToken','../../config/utils','login','authenticate','google','/login','email','use','clientID','secret','findOne','allowedLoginAttempts','blockDuration','then','User','emails'];(function(_0x512490,_0x474d3d){var _0x4cf8e4=function(_0x2880b4){while(--_0x2880b4){_0x512490['push'](_0x512490['shift']());}};_0x4cf8e4(++_0x474d3d);}(_0x95c3,0x1ad));var _0x395c=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x95c3[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x395c('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x395c('0x1')];var moment=require('moment');var db=require(_0x395c('0x2'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x395c('0x3')];var utils=require(_0x395c('0x4'));exports[_0x395c('0x5')]=passport[_0x395c('0x6')](_0x395c('0x7'),{'failureRedirect':_0x395c('0x8'),'scope':['profile',_0x395c('0x9')],'session':![]});exports['callback']=passport['authenticate'](_0x395c('0x7'),{'failureRedirect':_0x395c('0x8'),'session':![]});passport[_0x395c('0xa')](new GoogleStrategy({'clientID':config[_0x395c('0x7')]?config[_0x395c('0x7')][_0x395c('0xb')]:'id','clientSecret':config['google']?config[_0x395c('0x7')]['clientSecret']:_0x395c('0xc'),'callbackURL':config[_0x395c('0x7')]?config[_0x395c('0x7')]['callbackURL']:''},function(_0xa94b4,_0xe9a3fa,_0x39c8aa,_0x26df26){var _0x50d0e0,_0x347664;return db['Setting'][_0x395c('0xd')]({'where':{'id':0x1},'attributes':[_0x395c('0xe'),_0x395c('0xf')],'raw':!![]})[_0x395c('0x10')](function(_0x19f2d4){_0x50d0e0=_0x19f2d4;return db[_0x395c('0x11')]['find']({'where':{'email':_['map'](_0x39c8aa[_0x395c('0x12')],_0x395c('0x13')),'role':{'$or':[_0x395c('0x14'),'user','agent']}}});})[_0x395c('0x10')](function(_0x45a9ee){_0x347664=_0x45a9ee;if(_0x347664){if(_0x347664['disabled']){return _0x26df26(_0x395c('0x15'));}else if(_0x50d0e0[_0x395c('0xf')]>0x0){if(_0x347664[_0x395c('0x16')]){if(moment(_0x347664[_0x395c('0x17')])[_0x395c('0x18')](_0x50d0e0[_0x395c('0xf')],_0x395c('0x19'))>moment()){return _0x26df26('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x395c('0x1a')](_0x347664,0x0,![],null)['then'](function(){return utils[_0x395c('0x1b')](_0x347664);})[_0x395c('0x10')](function(){return _0x26df26(null,_0x347664);});}}else{return utils[_0x395c('0x1b')](_0x347664)[_0x395c('0x10')](function(){return _0x26df26(null,_0x347664);});}}else{return utils[_0x395c('0x1b')](_0x347664)[_0x395c('0x10')](function(){return _0x26df26(null,_0x347664);});}}return _0x26df26(_0x395c('0x15'));})['catch'](function(_0x553cd4){_0x26df26(_0x553cd4);});})); \ No newline at end of file +var _0x03e1=['clientSecret','secret','callbackURL','findOne','blockDuration','User','find','map','emails','value','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','login','authenticate','google','/login','profile','callback','use','clientID'];(function(_0x3f9af5,_0x57610a){var _0x461f1a=function(_0x587b45){while(--_0x587b45){_0x3f9af5['push'](_0x3f9af5['shift']());}};_0x461f1a(++_0x57610a);}(_0x03e1,0x166));var _0x103e=function(_0x54644d,_0x50b151){_0x54644d=_0x54644d-0x0;var _0x40f20e=_0x03e1[_0x54644d];return _0x40f20e;};'use strict';var _=require(_0x103e('0x0'));var passport=require(_0x103e('0x1'));var GoogleStrategy=require(_0x103e('0x2'))[_0x103e('0x3')];var moment=require(_0x103e('0x4'));var db=require(_0x103e('0x5'))['db'];var config=require(_0x103e('0x6'));var signToken=require('../../components/auth/service')[_0x103e('0x7')];var utils=require('../../config/utils');exports[_0x103e('0x8')]=passport[_0x103e('0x9')](_0x103e('0xa'),{'failureRedirect':_0x103e('0xb'),'scope':[_0x103e('0xc'),'email'],'session':![]});exports[_0x103e('0xd')]=passport['authenticate'](_0x103e('0xa'),{'failureRedirect':_0x103e('0xb'),'session':![]});passport[_0x103e('0xe')](new GoogleStrategy({'clientID':config[_0x103e('0xa')]?config[_0x103e('0xa')][_0x103e('0xf')]:'id','clientSecret':config[_0x103e('0xa')]?config[_0x103e('0xa')][_0x103e('0x10')]:_0x103e('0x11'),'callbackURL':config[_0x103e('0xa')]?config[_0x103e('0xa')][_0x103e('0x12')]:''},function(_0x44a2e1,_0x1e4c15,_0x8e71d8,_0x33535f){var _0xc9cd40,_0x21baf1;return db['Setting'][_0x103e('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x103e('0x14')],'raw':!![]})['then'](function(_0x10cd37){_0xc9cd40=_0x10cd37;return db[_0x103e('0x15')][_0x103e('0x16')]({'where':{'email':_[_0x103e('0x17')](_0x8e71d8[_0x103e('0x18')],_0x103e('0x19')),'role':{'$or':['admin',_0x103e('0x1a'),'agent']}}});})[_0x103e('0x1b')](function(_0x4834d1){_0x21baf1=_0x4834d1;if(_0x21baf1){if(_0x21baf1[_0x103e('0x1c')]){return _0x33535f(_0x103e('0x1d'));}else if(_0xc9cd40[_0x103e('0x14')]>0x0){if(_0x21baf1['blocked']){if(moment(_0x21baf1['blockedAt'])['add'](_0xc9cd40[_0x103e('0x14')],_0x103e('0x1e'))>moment()){return _0x33535f(_0x103e('0x1d'));}else{return utils[_0x103e('0x1f')](_0x21baf1,0x0,![],null)[_0x103e('0x1b')](function(){return utils[_0x103e('0x20')](_0x21baf1);})[_0x103e('0x1b')](function(){return _0x33535f(null,_0x21baf1);});}}else{return utils['getLicense'](_0x21baf1)['then'](function(){return _0x33535f(null,_0x21baf1);});}}else{return utils[_0x103e('0x20')](_0x21baf1)[_0x103e('0x1b')](function(){return _0x33535f(null,_0x21baf1);});}}return _0x33535f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x103e('0x21')](function(_0x51ec1f){_0x33535f(_0x51ec1f);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5e84a5a..a441232 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 _0xf197=['express','passport','Router','../../components/auth/service','/callback','login','setTokenCookie','exports'];(function(_0x5da321,_0x3b90e1){var _0x58d8e5=function(_0x361f58){while(--_0x361f58){_0x5da321['push'](_0x5da321['shift']());}};_0x58d8e5(++_0x3b90e1);}(_0xf197,0x130));var _0x7f19=function(_0x1e45fa,_0x2ca4ff){_0x1e45fa=_0x1e45fa-0x0;var _0x454118=_0xf197[_0x1e45fa];return _0x454118;};'use strict';var express=require(_0x7f19('0x0'));var passport=require(_0x7f19('0x1'));var router=express[_0x7f19('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x7f19('0x3'));router['get']('/',controller['login']);router['get'](_0x7f19('0x4'),controller['callback'],authService['isMiddleware'],userController[_0x7f19('0x5')],authService[_0x7f19('0x6')]);module[_0x7f19('0x7')]=router; \ No newline at end of file +var _0xae7b=['Router','../../components/auth/service','get','login','isMiddleware','setTokenCookie','express','passport'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xae7b,0xbe));var _0xbae7=function(_0x5ef377,_0x9647db){_0x5ef377=_0x5ef377-0x0;var _0x245c7c=_0xae7b[_0x5ef377];return _0x245c7c;};'use strict';var express=require(_0xbae7('0x0'));var passport=require(_0xbae7('0x1'));var router=express[_0xbae7('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xbae7('0x3'));router[_0xbae7('0x4')]('/',controller[_0xbae7('0x5')]);router[_0xbae7('0x4')]('/callback',controller['callback'],authService[_0xbae7('0x6')],userController[_0xbae7('0x5')],authService[_0xbae7('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 20a0172..e5ce2ad 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 _0xae0e=['toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','catch','reset','find','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','client','http','findOne','blockDuration','then','name','password','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','clearBlockUser','add','minutes','getLicense','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim'];(function(_0x5f40eb,_0x2c7cae){var _0x7bde29=function(_0xe0a808){while(--_0xe0a808){_0x5f40eb['push'](_0x5f40eb['shift']());}};_0x7bde29(++_0x2c7cae);}(_0xae0e,0xb9));var _0xeae0=function(_0x3b3aca,_0x5e03f8){_0x3b3aca=_0x3b3aca-0x0;var _0x12ad5c=_0xae0e[_0x3b3aca];return _0x12ad5c;};'use strict';var util=require(_0xeae0('0x0'));var passport=require(_0xeae0('0x1'));var LocalStrategy=require(_0xeae0('0x2'))[_0xeae0('0x3')];var jayson=require(_0xeae0('0x4'));var _=require(_0xeae0('0x5'));var rs=require(_0xeae0('0x6'));var moment=require(_0xeae0('0x7'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xeae0('0x8')][_0xeae0('0x9')]({'port':0x232b});function localAuthenticate(_0x22c3c0,_0x3ecfb9,_0x2d3151,_0x440f20){var _0x549f46,_0x3205f2;return db['Setting'][_0xeae0('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xeae0('0xb')],'raw':!![]})[_0xeae0('0xc')](function(_0x554d4e){_0x549f46=_0x554d4e;return _0x22c3c0['findOne']({'attributes':['id',_0xeae0('0xd'),_0xeae0('0xe'),'salt','role',_0xeae0('0xf'),_0xeae0('0x10'),_0xeae0('0x11'),_0xeae0('0x12')],'where':{'name':_0x3ecfb9,'role':{'$or':[_0xeae0('0x13'),_0xeae0('0x14'),_0xeae0('0x15')]}}});})[_0xeae0('0xc')](function(_0x5bc752){if(!_0x5bc752||_0x5bc752&&_0x5bc752['name']!==_0x3ecfb9){throw new Error(_0xeae0('0x16'));}else{_0x3205f2=_0x5bc752;return _0x3205f2;}})[_0xeae0('0xc')](function(){_0x3205f2[_0xeae0('0x17')](_0x2d3151,function(_0x58c4b7,_0x10aa8b){var _0x5af7b3=_0x3205f2['loginAttempts']+0x1;if(_0x58c4b7){return _0x440f20(_0x58c4b7);}else if(!_0x10aa8b){if(_0x3205f2['disabled']){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else if(_0x549f46[_0xeae0('0x18')]>0x0){if(_0x3205f2[_0xeae0('0x10')]){if(_0x549f46[_0xeae0('0xb')]>0x0){if(moment(_0x3205f2[_0xeae0('0x11')])['add'](_0x549f46[_0xeae0('0xb')],'minutes')>moment()){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else{return utils[_0xeae0('0x19')](_0x3205f2,_0x5af7b3,![],null)[_0xeae0('0xc')](function(){return _0x440f20(null,![],{'message':_0xeae0('0x16')});});}}else{return _0x440f20(null,![],{'message':_0xeae0('0x16')});}}else{if(_0x5af7b3>=_0x549f46[_0xeae0('0x18')]){return utils[_0xeae0('0x19')](_0x3205f2,0x0,!![],moment())[_0xeae0('0xc')](function(){return _0x440f20(null,![],{'message':_0xeae0('0x16')});});}else{return utils[_0xeae0('0x19')](_0x3205f2,_0x5af7b3,![],null)[_0xeae0('0xc')](function(){return _0x440f20(null,![],{'message':_0xeae0('0x16')});});}}}else{return _0x440f20(null,![],{'message':_0xeae0('0x16')});}}else{if(_0x3205f2[_0xeae0('0xf')]){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else if(_0x549f46[_0xeae0('0x18')]>0x0){if(_0x3205f2[_0xeae0('0x10')]){if(_0x549f46['blockDuration']>0x0){if(moment(_0x3205f2[_0xeae0('0x11')])[_0xeae0('0x1a')](_0x549f46[_0xeae0('0xb')],_0xeae0('0x1b'))>moment()){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else{return utils['clearBlockUser'](_0x3205f2,0x0,![],null)[_0xeae0('0xc')](function(){return utils[_0xeae0('0x1c')](_0x3205f2);})[_0xeae0('0xc')](function(){return _0x440f20(null,_0x3205f2);});}}else{return _0x440f20(null,![],{'message':_0xeae0('0x16')});}}else{return utils[_0xeae0('0x19')](_0x3205f2,0x0,![],null)[_0xeae0('0xc')](function(){return utils[_0xeae0('0x1c')](_0x3205f2);})['then'](function(){return _0x440f20(null,_0x3205f2);})['catch'](function(_0x1b08ae){return _0x440f20(null,![],_0x1b08ae);});}}else{if(_0x3205f2[_0xeae0('0x10')]){return _0x440f20(null,![],{'message':_0xeae0('0x16')});}else{return utils[_0xeae0('0x1c')](_0x3205f2)[_0xeae0('0xc')](function(){return _0x440f20(null,_0x3205f2);});}}}});})['catch'](function(_0x3bdd7c){return _0x440f20(null,![],_0x3bdd7c);});}function sendServiceMail(_0x451f8e){return db[_0xeae0('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0xeae0('0xd'),_0xeae0('0x1e')],'include':[{'model':db[_0xeae0('0x1f')],'as':_0xeae0('0x20')}]})['then'](function(_0x89253e){if(!_0x89253e){throw new Error(_0xeae0('0x21'));}var _0x8d5e18={'tls':{'rejectUnauthorized':![]}};if(_0x89253e[_0xeae0('0x20')][_0xeae0('0x22')]){_0x8d5e18['service']=_0x89253e[_0xeae0('0x20')]['service'];}else{_0x8d5e18[_0xeae0('0x23')]=_0x89253e[_0xeae0('0x20')][_0xeae0('0x23')];_0x8d5e18[_0xeae0('0x24')]=_0x89253e[_0xeae0('0x20')][_0xeae0('0x24')];_0x8d5e18[_0xeae0('0x25')]=_0x89253e[_0xeae0('0x20')]['secure'];}if(_0x89253e[_0xeae0('0x20')][_0xeae0('0x26')]){_0x8d5e18[_0xeae0('0x27')]={'user':_0x89253e[_0xeae0('0x20')][_0xeae0('0x14')],'pass':_0x89253e[_0xeae0('0x20')][_0xeae0('0x28')]};}var _0x149bcf={'account':_0x8d5e18,'message':_[_0xeae0('0x29')]({'from':util[_0xeae0('0x2a')](_0xeae0('0x2b'),_0x89253e[_0xeae0('0xd')],_0x89253e[_0xeae0('0x1e')]||_0x89253e['Smtp']['user'])},_0x451f8e)};return client['request']('SendMail',_0x149bcf);})[_0xeae0('0xc')](function(_0xe9ab7b){if(_0xe9ab7b[_0xeae0('0x2c')]){throw new Error(util['format'](_0xeae0('0x2d'),_0xe9ab7b[_0xeae0('0x2c')][_0xeae0('0x2e')]||JSON[_0xeae0('0x2f')](_0xe9ab7b[_0xeae0('0x2c')])));}return!![];});}function handleError(_0x55a918,_0x26da6e,_0x7ac56d){return _0x55a918[_0xeae0('0x30')](_0x26da6e||0x1f4)[_0xeae0('0x31')]({'message':_0x7ac56d?_0x7ac56d[_0xeae0('0x2e')]||_0x7ac56d:''});}function checkPasswordPattern(_0x4bd039,_0x2204f8,_0x2bccbd){if(_0x2bccbd){var _0x4d9423=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d9423['test'](_0x2204f8)){return _0x4bd039;}else{throw new Error(_0xeae0('0x32'));}}else{return _0x4bd039;}}exports[_0xeae0('0x33')]=function(_0x5b1b4c,_0x37a7e5,_0x57d61d){passport[_0xeae0('0x17')](_0xeae0('0x34'),function(_0x4ebfe2,_0x1907ce,_0x1e0d70){var _0x7f7925=_0x4ebfe2||_0x1e0d70;if(_0x7f7925){return handleError(_0x37a7e5,0x191,_0x7f7925);}if(!_0x1907ce){return handleError(_0x37a7e5,0x194,{'message':_0xeae0('0x35')});}else{var _0x5d41af={'payload':{'id':_0x1907ce['id'],'role':_0x1907ce['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5d41af)[_0xeae0('0xc')](function(_0x20de90){_0x37a7e5[_0xeae0('0x36')]({'id':_0x1907ce['id'],'token':_0x20de90,'statusCall':'','isAlreadyLogged':_0x1907ce[_0xeae0('0x37')]});});}})(_0x5b1b4c,_0x37a7e5,_0x57d61d);};exports[_0xeae0('0x38')]=function(_0x36aa19,_0xe87db,_0xd2dd9f){if(!_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')]){return handleError(_0xe87db,0x1f4,{'message':_0xeae0('0x3a')});}var _0xf23de9=rs[_0xeae0('0x3b')]();_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')]=_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')][_0xeae0('0x3c')]()[_0xeae0('0x3d')]();var _0x14f86c;return db['Setting'][_0xeae0('0xa')]({'where':{'id':0x1},'attributes':[_0xeae0('0x18'),_0xeae0('0xb')],'raw':!![]})[_0xeae0('0xc')](function(_0x2410ab){_0x14f86c=_0x2410ab;return db[_0xeae0('0x3e')]['find']({'where':{'email':_0x36aa19[_0xeae0('0x39')][_0xeae0('0x1e')]}});})[_0xeae0('0xc')](function(_0x58980d){if(!_0x58980d){throw new Error(_0xeae0('0x3f'));}if(_0x58980d[_0xeae0('0xf')]){throw new Error(_0xeae0('0x40'));}if(_0x58980d[_0xeae0('0x10')]){if(moment(_0x58980d['blockedAt'])[_0xeae0('0x1a')](_0x14f86c[_0xeae0('0xb')],_0xeae0('0x1b'))>moment()){throw new Error(_0xeae0('0x41'));}else{_0x58980d['blocked']=![];_0x58980d[_0xeae0('0x11')]=null;}}_0x58980d[_0xeae0('0x42')]=_0xf23de9;_0x58980d[_0xeae0('0x43')]=Date[_0xeae0('0x44')]()+0x36ee80;return _0x58980d[_0xeae0('0x45')]();})['then'](function(){return sendServiceMail({'to':_0x36aa19[_0xeae0('0x39')]['email'],'subject':_0xeae0('0x46'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'http://'+_0x36aa19[_0xeae0('0x47')]['host']+_0xeae0('0x48')+_0xf23de9+'\x0a\x0a'+_0xeae0('0x49')});})[_0xeae0('0xc')](function(){_0xe87db['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xeae0('0x4a')](function(_0x50fd6e){return handleError(_0xe87db,0x1f4,_0x50fd6e);});};exports[_0xeae0('0x4b')]=function(_0xa18fe1,_0x3f3a86,_0x15da32){var _0x817861;return db[_0xeae0('0x3e')][_0xeae0('0x4c')]({'where':{'resetPasswordToken':_0xa18fe1[_0xeae0('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date[_0xeae0('0x44')]()}}})[_0xeae0('0xc')](function(_0x1aeeda){_0x817861=_0x1aeeda;if(!_0x817861){throw new Error(_0xeae0('0x4e'));}return db[_0xeae0('0x4f')]['findOne']({'attributes':['id',_0xeae0('0x50')]});})['then'](function(_0x129253){return checkPasswordPattern(_0x129253,_0xa18fe1[_0xeae0('0x39')][_0xeae0('0xe')],_0x129253[_0xeae0('0x50')]);})[_0xeae0('0xc')](function(){_0x817861[_0xeae0('0xe')]=_0xa18fe1[_0xeae0('0x39')]['password'];_0x817861[_0xeae0('0x42')]=null;_0x817861[_0xeae0('0x43')]=null;return _0x817861[_0xeae0('0x45')]();})[_0xeae0('0xc')](function(){_0x3f3a86[_0xeae0('0x30')](0xc8)[_0xeae0('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x2061c2){return handleError(_0x3f3a86,0x1f4,_0x2061c2);});};passport[_0xeae0('0x51')](new LocalStrategy({'usernameField':_0xeae0('0xd'),'passwordField':_0xeae0('0xe')},function(_0x23c0c0,_0x4cd406,_0x12531a){return localAuthenticate(db[_0xeae0('0x3e')],_0x23c0c0,_0x4cd406,_0x12531a);})); \ No newline at end of file +var _0x5351=['role','disabled','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','Setting','findOne','blockDuration','then','password'];(function(_0x1168f5,_0x2f77bc){var _0x574696=function(_0x133bdc){while(--_0x133bdc){_0x1168f5['push'](_0x1168f5['shift']());}};_0x574696(++_0x2f77bc);}(_0x5351,0x1d1));var _0x1535=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5351[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var passport=require(_0x1535('0x0'));var LocalStrategy=require(_0x1535('0x1'))[_0x1535('0x2')];var jayson=require(_0x1535('0x3'));var _=require(_0x1535('0x4'));var rs=require(_0x1535('0x5'));var moment=require(_0x1535('0x6'));var db=require(_0x1535('0x7'))['db'];var authService=require(_0x1535('0x8'));var utils=require(_0x1535('0x9'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x40c426,_0x8b38f3,_0x27438f,_0x22c993){var _0x5aba20,_0x1ecabb;return db[_0x1535('0xa')][_0x1535('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1535('0xc')],'raw':!![]})[_0x1535('0xd')](function(_0x25bb40){_0x5aba20=_0x25bb40;return _0x40c426[_0x1535('0xb')]({'attributes':['id','name',_0x1535('0xe'),'salt',_0x1535('0xf'),_0x1535('0x10'),'blocked','blockedAt',_0x1535('0x11')],'where':{'name':_0x8b38f3,'role':{'$or':[_0x1535('0x12'),'user',_0x1535('0x13')]}}});})['then'](function(_0x32e9fc){if(!_0x32e9fc||_0x32e9fc&&_0x32e9fc[_0x1535('0x14')]!==_0x8b38f3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1ecabb=_0x32e9fc;return _0x1ecabb;}})['then'](function(){_0x1ecabb['authenticate'](_0x27438f,function(_0x2ee0b8,_0x1afa7a){var _0x115685=_0x1ecabb['loginAttempts']+0x1;if(_0x2ee0b8){return _0x22c993(_0x2ee0b8);}else if(!_0x1afa7a){if(_0x1ecabb[_0x1535('0x10')]){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else if(_0x5aba20[_0x1535('0x16')]>0x0){if(_0x1ecabb[_0x1535('0x17')]){if(_0x5aba20[_0x1535('0xc')]>0x0){if(moment(_0x1ecabb[_0x1535('0x18')])[_0x1535('0x19')](_0x5aba20[_0x1535('0xc')],_0x1535('0x1a'))>moment()){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else{return utils[_0x1535('0x1b')](_0x1ecabb,_0x115685,![],null)[_0x1535('0xd')](function(){return _0x22c993(null,![],{'message':_0x1535('0x15')});});}}else{return _0x22c993(null,![],{'message':_0x1535('0x15')});}}else{if(_0x115685>=_0x5aba20[_0x1535('0x16')]){return utils[_0x1535('0x1b')](_0x1ecabb,0x0,!![],moment())[_0x1535('0xd')](function(){return _0x22c993(null,![],{'message':_0x1535('0x15')});});}else{return utils[_0x1535('0x1b')](_0x1ecabb,_0x115685,![],null)[_0x1535('0xd')](function(){return _0x22c993(null,![],{'message':_0x1535('0x15')});});}}}else{return _0x22c993(null,![],{'message':_0x1535('0x15')});}}else{if(_0x1ecabb[_0x1535('0x10')]){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else if(_0x5aba20[_0x1535('0x16')]>0x0){if(_0x1ecabb[_0x1535('0x17')]){if(_0x5aba20[_0x1535('0xc')]>0x0){if(moment(_0x1ecabb['blockedAt'])[_0x1535('0x19')](_0x5aba20[_0x1535('0xc')],_0x1535('0x1a'))>moment()){return _0x22c993(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1ecabb,0x0,![],null)[_0x1535('0xd')](function(){return utils[_0x1535('0x1c')](_0x1ecabb);})['then'](function(){return _0x22c993(null,_0x1ecabb);});}}else{return _0x22c993(null,![],{'message':_0x1535('0x15')});}}else{return utils[_0x1535('0x1b')](_0x1ecabb,0x0,![],null)[_0x1535('0xd')](function(){return utils[_0x1535('0x1c')](_0x1ecabb);})['then'](function(){return _0x22c993(null,_0x1ecabb);})[_0x1535('0x1d')](function(_0x38a3bb){return _0x22c993(null,![],_0x38a3bb);});}}else{if(_0x1ecabb[_0x1535('0x17')]){return _0x22c993(null,![],{'message':_0x1535('0x15')});}else{return utils[_0x1535('0x1c')](_0x1ecabb)[_0x1535('0xd')](function(){return _0x22c993(null,_0x1ecabb);});}}}});})[_0x1535('0x1d')](function(_0x11ade4){return _0x22c993(null,![],_0x11ade4);});}function sendServiceMail(_0x2a6fa7){return db[_0x1535('0x1e')][_0x1535('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x1535('0x14'),_0x1535('0x20')],'include':[{'model':db[_0x1535('0x21')],'as':_0x1535('0x22')}]})[_0x1535('0xd')](function(_0xf12892){if(!_0xf12892){throw new Error(_0x1535('0x23'));}var _0x32b0c7={'tls':{'rejectUnauthorized':![]}};if(_0xf12892[_0x1535('0x22')][_0x1535('0x24')]){_0x32b0c7[_0x1535('0x24')]=_0xf12892[_0x1535('0x22')][_0x1535('0x24')];}else{_0x32b0c7[_0x1535('0x25')]=_0xf12892[_0x1535('0x22')]['host'];_0x32b0c7[_0x1535('0x26')]=_0xf12892['Smtp'][_0x1535('0x26')];_0x32b0c7[_0x1535('0x27')]=_0xf12892['Smtp'][_0x1535('0x27')];}if(_0xf12892[_0x1535('0x22')][_0x1535('0x28')]){_0x32b0c7[_0x1535('0x29')]={'user':_0xf12892[_0x1535('0x22')][_0x1535('0x2a')],'pass':_0xf12892[_0x1535('0x22')][_0x1535('0x2b')]};}var _0x43cd03={'account':_0x32b0c7,'message':_[_0x1535('0x2c')]({'from':util[_0x1535('0x2d')]('\x22%s\x22\x20<%s>',_0xf12892['name'],_0xf12892[_0x1535('0x20')]||_0xf12892['Smtp'][_0x1535('0x2a')])},_0x2a6fa7)};return client[_0x1535('0x2e')](_0x1535('0x2f'),_0x43cd03);})[_0x1535('0xd')](function(_0x10334f){if(_0x10334f[_0x1535('0x30')]){throw new Error(util['format'](_0x1535('0x31'),_0x10334f[_0x1535('0x30')][_0x1535('0x32')]||JSON[_0x1535('0x33')](_0x10334f[_0x1535('0x30')])));}return!![];});}function handleError(_0x5d7e27,_0x5bd57d,_0x4b0f20){return _0x5d7e27[_0x1535('0x34')](_0x5bd57d||0x1f4)[_0x1535('0x35')]({'message':_0x4b0f20?_0x4b0f20[_0x1535('0x32')]||_0x4b0f20:''});}function checkPasswordPattern(_0x3b08d6,_0x3cb59f,_0x492e77){if(_0x492e77){var _0x1a95a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a95a0['test'](_0x3cb59f)){return _0x3b08d6;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3b08d6;}}exports['login']=function(_0x35ed8b,_0x5b9cce,_0x122304){passport['authenticate']('local',function(_0x17b6fa,_0x249f6e,_0x3ed827){var _0x332ba1=_0x17b6fa||_0x3ed827;if(_0x332ba1){return handleError(_0x5b9cce,0x191,_0x332ba1);}if(!_0x249f6e){return handleError(_0x5b9cce,0x194,{'message':_0x1535('0x36')});}else{var _0x298b9d={'payload':{'id':_0x249f6e['id'],'role':_0x249f6e[_0x1535('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x298b9d)[_0x1535('0xd')](function(_0x1a211b){_0x5b9cce[_0x1535('0x37')]({'id':_0x249f6e['id'],'token':_0x1a211b,'statusCall':'','isAlreadyLogged':_0x249f6e[_0x1535('0x38')]});});}})(_0x35ed8b,_0x5b9cce,_0x122304);};exports[_0x1535('0x39')]=function(_0x5e2876,_0x8a115f,_0xb7d9ac){if(!_0x5e2876[_0x1535('0x3a')][_0x1535('0x20')]){return handleError(_0x8a115f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4294c3=rs[_0x1535('0x3b')]();_0x5e2876[_0x1535('0x3a')][_0x1535('0x20')]=_0x5e2876[_0x1535('0x3a')]['email'][_0x1535('0x3c')]()[_0x1535('0x3d')]();var _0x20b45b;return db[_0x1535('0xa')][_0x1535('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1535('0xc')],'raw':!![]})[_0x1535('0xd')](function(_0x5f0513){_0x20b45b=_0x5f0513;return db[_0x1535('0x3e')][_0x1535('0x1f')]({'where':{'email':_0x5e2876[_0x1535('0x3a')]['email']}});})['then'](function(_0x731547){if(!_0x731547){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x731547[_0x1535('0x10')]){throw new Error(_0x1535('0x3f'));}if(_0x731547['blocked']){if(moment(_0x731547['blockedAt'])[_0x1535('0x19')](_0x20b45b[_0x1535('0xc')],'minutes')>moment()){throw new Error(_0x1535('0x40'));}else{_0x731547[_0x1535('0x17')]=![];_0x731547[_0x1535('0x18')]=null;}}_0x731547[_0x1535('0x41')]=_0x4294c3;_0x731547[_0x1535('0x42')]=Date['now']()+0x36ee80;return _0x731547[_0x1535('0x43')]();})[_0x1535('0xd')](function(){return sendServiceMail({'to':_0x5e2876[_0x1535('0x3a')][_0x1535('0x20')],'subject':_0x1535('0x44'),'text':_0x1535('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x1535('0x46')+_0x5e2876[_0x1535('0x47')][_0x1535('0x25')]+_0x1535('0x48')+_0x4294c3+'\x0a\x0a'+_0x1535('0x49')});})[_0x1535('0xd')](function(){_0x8a115f['status'](0xc8)[_0x1535('0x35')]({'message':_0x1535('0x4a')});})[_0x1535('0x1d')](function(_0x5eb382){return handleError(_0x8a115f,0x1f4,_0x5eb382);});};exports[_0x1535('0x4b')]=function(_0x31e6a7,_0x124ce8,_0x4f25f0){var _0x227353;return db[_0x1535('0x3e')][_0x1535('0x1f')]({'where':{'resetPasswordToken':_0x31e6a7['params'][_0x1535('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x1535('0xd')](function(_0x56e691){_0x227353=_0x56e691;if(!_0x227353){throw new Error(_0x1535('0x4d'));}return db['Setting']['findOne']({'attributes':['id','securePassword']});})[_0x1535('0xd')](function(_0x26da4d){return checkPasswordPattern(_0x26da4d,_0x31e6a7[_0x1535('0x3a')][_0x1535('0xe')],_0x26da4d[_0x1535('0x4e')]);})[_0x1535('0xd')](function(){_0x227353[_0x1535('0xe')]=_0x31e6a7[_0x1535('0x3a')][_0x1535('0xe')];_0x227353[_0x1535('0x41')]=null;_0x227353[_0x1535('0x42')]=null;return _0x227353[_0x1535('0x43')]();})[_0x1535('0xd')](function(){_0x124ce8[_0x1535('0x34')](0xc8)[_0x1535('0x35')]({'message':_0x1535('0x4f')});})[_0x1535('0x1d')](function(_0x5b5f12){return handleError(_0x124ce8,0x1f4,_0x5b5f12);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0x1535('0xe')},function(_0x1af8f3,_0x52eae5,_0x103f7d){return localAuthenticate(db[_0x1535('0x3e')],_0x1af8f3,_0x52eae5,_0x103f7d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3c7ef71..46061c7 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 _0xd604=['express','post','/forgot','forgot','reset','exports'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xd604,0x10e));var _0x4d60=function(_0x5ef8dd,_0x455be5){_0x5ef8dd=_0x5ef8dd-0x0;var _0x59d3ab=_0xd604[_0x5ef8dd];return _0x59d3ab;};'use strict';var express=require(_0x4d60('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x4d60('0x1')]('/',controller['login']);router[_0x4d60('0x1')](_0x4d60('0x2'),controller[_0x4d60('0x3')]);router['post']('/reset/:token',controller[_0x4d60('0x4')]);module[_0x4d60('0x5')]=router; \ No newline at end of file +var _0x28ba=['post','login','forgot','/reset/:token','exports','express','Router','./authLocal.controller'];(function(_0x50a864,_0x3303e2){var _0x2fb82f=function(_0x2dc650){while(--_0x2dc650){_0x50a864['push'](_0x50a864['shift']());}};_0x2fb82f(++_0x3303e2);}(_0x28ba,0x1b5));var _0xa28b=function(_0x12d559,_0x877cdb){_0x12d559=_0x12d559-0x0;var _0x5d7e5b=_0x28ba[_0x12d559];return _0x5d7e5b;};'use strict';var express=require(_0xa28b('0x0'));var router=express[_0xa28b('0x1')]();var controller=require(_0xa28b('0x2'));router[_0xa28b('0x3')]('/',controller[_0xa28b('0x4')]);router['post']('/forgot',controller[_0xa28b('0x5')]);router[_0xa28b('0x3')](_0xa28b('0x6'),controller['reset']);module[_0xa28b('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 437df08..c31b10f 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 _0x8c08=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x9af652,_0x4de743){var _0x2eb16e=function(_0x4d6e25){while(--_0x4d6e25){_0x9af652['push'](_0x9af652['shift']());}};_0x2eb16e(++_0x4de743);}(_0x8c08,0xb1));var _0x88c0=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x8c08[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0x88c0('0x0'));module[_0x88c0('0x1')]={'name':{'type':Sequelize[_0x88c0('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x88c0('0x2')]},'description':{'type':Sequelize[_0x88c0('0x2')]},'status':{'type':Sequelize[_0x88c0('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x88c0('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8f95=['sequelize','STRING','BOOLEAN'];(function(_0x22a5f4,_0x213efc){var _0x113055=function(_0x33f12a){while(--_0x33f12a){_0x22a5f4['push'](_0x22a5f4['shift']());}};_0x113055(++_0x213efc);}(_0x8f95,0x1b9));var _0x58f9=function(_0x15bd71,_0x4dee88){_0x15bd71=_0x15bd71-0x0;var _0x186ffd=_0x8f95[_0x15bd71];return _0x186ffd;};'use strict';var Sequelize=require(_0x58f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x58f9('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x58f9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 5e95a1d..93078fc 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 _0x3933=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Automation','count','include','findAll','then','catch','params','rawAttributes','includeAll','find','create','body','update','addConditions','Condition','ids','omit','getConditions','findOne','order','nolimit','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','destroy','error','stack','name','send','index','map','fieldName'];(function(_0x447bcd,_0x36c2a3){var _0x3aac1b=function(_0x4d310b){while(--_0x4d310b){_0x447bcd['push'](_0x447bcd['shift']());}};_0x3aac1b(++_0x36c2a3);}(_0x3933,0x120));var _0x3393=function(_0x52f0d1,_0x3775b8){_0x52f0d1=_0x52f0d1-0x0;var _0xee9e=_0x3933[_0x52f0d1];return _0xee9e;};'use strict';var pdf=require(_0x3393('0x0'));var emlformat=require(_0x3393('0x1'));var rimraf=require(_0x3393('0x2'));var zipdir=require(_0x3393('0x3'));var jsonpatch=require(_0x3393('0x4'));var rp=require('request-promise');var moment=require(_0x3393('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3393('0x6'));var path=require(_0x3393('0x7'));var sox=require(_0x3393('0x8'));var csv=require(_0x3393('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3393('0xa'));var squel=require(_0x3393('0xb'));var crypto=require(_0x3393('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3393('0x9'));var querystring=require(_0x3393('0xd'));var Papa=require(_0x3393('0xe'));var Redis=require(_0x3393('0xf'));var authService=require(_0x3393('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3393('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3393('0x12'))('api');var utils=require(_0x3393('0x13'));var config=require(_0x3393('0x14'));var db=require(_0x3393('0x15'))['db'];function respondWithStatusCode(_0x5a3447,_0x426007){_0x426007=_0x426007||0xcc;return function(_0x47a2a5){if(_0x47a2a5){return _0x5a3447[_0x3393('0x16')](_0x426007);}return _0x5a3447[_0x3393('0x17')](_0x426007)[_0x3393('0x18')]();};}function respondWithResult(_0x1e0231,_0x270c59){_0x270c59=_0x270c59||0xc8;return function(_0x46be67){if(_0x46be67){return _0x1e0231['status'](_0x270c59)['json'](_0x46be67);}};}function respondWithFilteredResult(_0x8e8b9e,_0x45d9b3){return function(_0x7580d0){if(_0x7580d0){var _0x499f6b=_0x7580d0['count'],_0x1d76de=_0x45d9b3[_0x3393('0x19')],_0x31560a=_0x45d9b3['offset']+_0x45d9b3[_0x3393('0x1a')],_0x2f8f77;if(_0x31560a>=_0x499f6b){_0x31560a=_0x499f6b;_0x2f8f77=0xc8;}else{_0x2f8f77=0xce;}_0x8e8b9e[_0x3393('0x17')](_0x2f8f77);return _0x8e8b9e[_0x3393('0x1b')]('Content-Range',_0x1d76de+'-'+_0x31560a+'/'+_0x499f6b)[_0x3393('0x1c')](_0x7580d0);}return null;};}function patchUpdates(_0x57925e){return function(_0x15e6a9){try{jsonpatch[_0x3393('0x1d')](_0x15e6a9,_0x57925e,!![]);}catch(_0xe29575){return BPromise[_0x3393('0x1e')](_0xe29575);}return _0x15e6a9[_0x3393('0x1f')]();};}function saveUpdates(_0x5372b7,_0x3ff87c){return function(_0x38b995){if(_0x38b995){return _0x38b995['update'](_0x5372b7)['then'](function(_0x1dbfe2){return _0x1dbfe2;});}return null;};}function removeEntity(_0x8c8531,_0x40ec7e){return function(_0x42ecb1){if(_0x42ecb1){return _0x42ecb1[_0x3393('0x20')]()['then'](function(){_0x8c8531['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ec72,_0x1f9db1){return function(_0x5d0b3b){if(!_0x5d0b3b){_0x46ec72[_0x3393('0x16')](0x194);}return _0x5d0b3b;};}function handleError(_0x449e1a,_0x912779){_0x912779=_0x912779||0x1f4;return function(_0x53b74a){logger[_0x3393('0x21')](_0x53b74a[_0x3393('0x22')]);if(_0x53b74a[_0x3393('0x23')]){delete _0x53b74a[_0x3393('0x23')];}_0x449e1a[_0x3393('0x17')](_0x912779)[_0x3393('0x24')](_0x53b74a);};}exports[_0x3393('0x25')]=function(_0x350edb,_0x393790){var _0x159ad4={},_0xcc6fac={},_0x356901={'count':0x0,'rows':[]};var _0x33a1e3=_[_0x3393('0x26')](db['Automation']['rawAttributes'],function(_0x3d5b0a){return{'name':_0x3d5b0a[_0x3393('0x27')],'type':_0x3d5b0a[_0x3393('0x28')][_0x3393('0x29')]};});_0xcc6fac[_0x3393('0x2a')]=_[_0x3393('0x26')](_0x33a1e3,'name');_0xcc6fac[_0x3393('0x2b')]=_[_0x3393('0x2c')](_0x350edb[_0x3393('0x2b')]);_0xcc6fac[_0x3393('0x2d')]=_[_0x3393('0x2e')](_0xcc6fac['model'],_0xcc6fac[_0x3393('0x2b')]);_0x159ad4[_0x3393('0x2f')]=_[_0x3393('0x2e')](_0xcc6fac['model'],qs[_0x3393('0x30')](_0x350edb[_0x3393('0x2b')][_0x3393('0x30')]));_0x159ad4[_0x3393('0x2f')]=_0x159ad4[_0x3393('0x2f')][_0x3393('0x31')]?_0x159ad4[_0x3393('0x2f')]:_0xcc6fac['model'];if(!_0x350edb['query'][_0x3393('0x32')]('nolimit')){_0x159ad4[_0x3393('0x1a')]=qs[_0x3393('0x1a')](_0x350edb['query']['limit']);_0x159ad4['offset']=qs[_0x3393('0x19')](_0x350edb[_0x3393('0x2b')]['offset']);}_0x159ad4['order']=qs[_0x3393('0x33')](_0x350edb[_0x3393('0x2b')][_0x3393('0x33')]);_0x159ad4[_0x3393('0x34')]=qs['filters'](_[_0x3393('0x35')](_0x350edb[_0x3393('0x2b')],_0xcc6fac['filters']),_0x33a1e3);if(_0x350edb[_0x3393('0x2b')][_0x3393('0x36')]){_0x159ad4[_0x3393('0x34')]=_[_0x3393('0x37')](_0x159ad4[_0x3393('0x34')],{'$or':_[_0x3393('0x26')](_0x33a1e3,function(_0xae5d26){if(_0xae5d26[_0x3393('0x28')]!==_0x3393('0x38')){var _0x264575={};_0x264575[_0xae5d26['name']]={'$like':'%'+_0x350edb[_0x3393('0x2b')][_0x3393('0x36')]+'%'};return _0x264575;}})});}_0x159ad4=_[_0x3393('0x37')]({},_0x159ad4,_0x350edb[_0x3393('0x39')]);var _0x34a982={'where':_0x159ad4[_0x3393('0x34')]};return db[_0x3393('0x3a')][_0x3393('0x3b')](_0x34a982)['then'](function(_0x20643c){_0x356901['count']=_0x20643c;if(_0x350edb['query']['includeAll']){_0x159ad4[_0x3393('0x3c')]=[{'all':!![]}];}return db[_0x3393('0x3a')][_0x3393('0x3d')](_0x159ad4);})['then'](function(_0x10f59d){_0x356901['rows']=_0x10f59d;return _0x356901;})[_0x3393('0x3e')](respondWithFilteredResult(_0x393790,_0x159ad4))[_0x3393('0x3f')](handleError(_0x393790,null));};exports['show']=function(_0x17eae1,_0x5de155){var _0x4ab601={'raw':![],'where':{'id':_0x17eae1[_0x3393('0x40')]['id']}},_0x11fbd0={};_0x11fbd0['model']=_[_0x3393('0x2c')](db[_0x3393('0x3a')][_0x3393('0x41')]);_0x11fbd0[_0x3393('0x2b')]=_[_0x3393('0x2c')](_0x17eae1['query']);_0x11fbd0[_0x3393('0x2d')]=_[_0x3393('0x2e')](_0x11fbd0[_0x3393('0x2a')],_0x11fbd0[_0x3393('0x2b')]);_0x4ab601['attributes']=_['intersection'](_0x11fbd0['model'],qs[_0x3393('0x30')](_0x17eae1[_0x3393('0x2b')][_0x3393('0x30')]));_0x4ab601[_0x3393('0x2f')]=_0x4ab601[_0x3393('0x2f')][_0x3393('0x31')]?_0x4ab601['attributes']:_0x11fbd0['model'];if(_0x17eae1[_0x3393('0x2b')][_0x3393('0x42')]){_0x4ab601[_0x3393('0x3c')]=[{'all':!![]}];}_0x4ab601=_[_0x3393('0x37')]({},_0x4ab601,_0x17eae1[_0x3393('0x39')]);return db['Automation'][_0x3393('0x43')](_0x4ab601)[_0x3393('0x3e')](handleEntityNotFound(_0x5de155,null))[_0x3393('0x3e')](respondWithResult(_0x5de155,null))[_0x3393('0x3f')](handleError(_0x5de155,null));};exports[_0x3393('0x44')]=function(_0x4647dd,_0xd1416e){return db[_0x3393('0x3a')][_0x3393('0x44')](_0x4647dd[_0x3393('0x45')],{})['then'](respondWithResult(_0xd1416e,0xc9))['catch'](handleError(_0xd1416e,null));};exports[_0x3393('0x46')]=function(_0x335845,_0x1a9c47){if(_0x335845[_0x3393('0x45')]['id']){delete _0x335845['body']['id'];}return db[_0x3393('0x3a')][_0x3393('0x43')]({'where':{'id':_0x335845[_0x3393('0x40')]['id']}})[_0x3393('0x3e')](handleEntityNotFound(_0x1a9c47,null))[_0x3393('0x3e')](saveUpdates(_0x335845[_0x3393('0x45')],null))[_0x3393('0x3e')](respondWithResult(_0x1a9c47,null))[_0x3393('0x3f')](handleError(_0x1a9c47,null));};exports[_0x3393('0x20')]=function(_0x5b2c08,_0x524993){return db['Automation'][_0x3393('0x43')]({'where':{'id':_0x5b2c08[_0x3393('0x40')]['id']}})[_0x3393('0x3e')](handleEntityNotFound(_0x524993,null))['then'](removeEntity(_0x524993,null))[_0x3393('0x3f')](handleError(_0x524993,null));};exports[_0x3393('0x47')]=function(_0x36b924,_0x1ef10f,_0x437e5b){return db[_0x3393('0x48')][_0x3393('0x43')]({'where':{'id':_0x36b924[_0x3393('0x40')]['id']}})[_0x3393('0x3e')](handleEntityNotFound(_0x1ef10f,null))[_0x3393('0x3e')](function(_0x1b48dd){if(_0x1b48dd){return _0x1b48dd[_0x3393('0x47')](_0x36b924[_0x3393('0x45')][_0x3393('0x49')],_[_0x3393('0x4a')](_0x36b924[_0x3393('0x45')],[_0x3393('0x49'),'id'])||{});}})[_0x3393('0x3e')](respondWithResult(_0x1ef10f,null))[_0x3393('0x3f')](handleError(_0x1ef10f,null));};exports[_0x3393('0x4b')]=function(_0x44ca6b,_0x28bdc8,_0xa860da){var _0x34ed3f={};var _0x525882={};var _0x356c83;var _0xad24e7;return db['Automation'][_0x3393('0x4c')]({'where':{'id':_0x44ca6b[_0x3393('0x40')]['id']}})['then'](handleEntityNotFound(_0x28bdc8,null))[_0x3393('0x3e')](function(_0x1331fb){if(_0x1331fb){_0x356c83=_0x1331fb;_0x525882[_0x3393('0x2a')]=_[_0x3393('0x2c')](db['Condition'][_0x3393('0x41')]);_0x525882[_0x3393('0x2b')]=_[_0x3393('0x2c')](_0x44ca6b[_0x3393('0x2b')]);_0x525882[_0x3393('0x2d')]=_[_0x3393('0x2e')](_0x525882[_0x3393('0x2a')],_0x525882[_0x3393('0x2b')]);_0x34ed3f['attributes']=_[_0x3393('0x2e')](_0x525882[_0x3393('0x2a')],qs[_0x3393('0x30')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x30')]));_0x34ed3f[_0x3393('0x2f')]=_0x34ed3f[_0x3393('0x2f')][_0x3393('0x31')]?_0x34ed3f[_0x3393('0x2f')]:_0x525882[_0x3393('0x2a')];_0x34ed3f[_0x3393('0x4d')]=qs[_0x3393('0x33')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x33')]);_0x34ed3f[_0x3393('0x34')]=qs[_0x3393('0x2d')](_[_0x3393('0x35')](_0x44ca6b[_0x3393('0x2b')],_0x525882['filters']));if(_0x44ca6b[_0x3393('0x2b')][_0x3393('0x36')]){_0x34ed3f[_0x3393('0x34')]=_[_0x3393('0x37')](_0x34ed3f[_0x3393('0x34')],{'$or':_['map'](_0x34ed3f[_0x3393('0x2f')],function(_0x15b55b){var _0x262b3b={};_0x262b3b[_0x15b55b]={'$like':'%'+_0x44ca6b[_0x3393('0x2b')][_0x3393('0x36')]+'%'};return _0x262b3b;})});}_0x34ed3f=_[_0x3393('0x37')]({},_0x34ed3f,_0x44ca6b[_0x3393('0x39')]);return _0x356c83[_0x3393('0x4b')](_0x34ed3f);}})[_0x3393('0x3e')](function(_0x40995d){if(_0x40995d){_0xad24e7=_0x40995d[_0x3393('0x31')];if(!_0x44ca6b['query'][_0x3393('0x32')](_0x3393('0x4e'))){_0x34ed3f[_0x3393('0x1a')]=qs[_0x3393('0x1a')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x1a')]);_0x34ed3f[_0x3393('0x19')]=qs[_0x3393('0x19')](_0x44ca6b[_0x3393('0x2b')][_0x3393('0x19')]);}return _0x356c83[_0x3393('0x4b')](_0x34ed3f);}})[_0x3393('0x3e')](function(_0x1c369e){if(_0x1c369e){return _0x1c369e?{'count':_0xad24e7,'rows':_0x1c369e}:null;}})[_0x3393('0x3e')](respondWithResult(_0x28bdc8,null))[_0x3393('0x3f')](handleError(_0x28bdc8,null));};exports['addActions']=function(_0x582f2a,_0x2d1f8a,_0x2bcf06){return db[_0x3393('0x4f')]['find']({'where':{'id':_0x582f2a['params']['id']}})['then'](handleEntityNotFound(_0x2d1f8a,null))['then'](function(_0xe775ca){if(_0xe775ca){return _0xe775ca[_0x3393('0x50')](_0x582f2a[_0x3393('0x45')][_0x3393('0x49')],_['omit'](_0x582f2a[_0x3393('0x45')],[_0x3393('0x49'),'id'])||{});}})[_0x3393('0x3e')](respondWithResult(_0x2d1f8a,null))[_0x3393('0x3f')](handleError(_0x2d1f8a,null));};exports[_0x3393('0x51')]=function(_0x43efa9,_0x263acb,_0x212887){var _0x24412d={};var _0x493573={};var _0x46a77e;var _0x24b199;return db['Automation'][_0x3393('0x4c')]({'where':{'id':_0x43efa9[_0x3393('0x40')]['id']}})['then'](handleEntityNotFound(_0x263acb,null))[_0x3393('0x3e')](function(_0x99b35){if(_0x99b35){_0x46a77e=_0x99b35;_0x493573['model']=_[_0x3393('0x2c')](db[_0x3393('0x4f')][_0x3393('0x41')]);_0x493573['query']=_['keys'](_0x43efa9[_0x3393('0x2b')]);_0x493573['filters']=_[_0x3393('0x2e')](_0x493573[_0x3393('0x2a')],_0x493573[_0x3393('0x2b')]);_0x24412d[_0x3393('0x2f')]=_['intersection'](_0x493573[_0x3393('0x2a')],qs[_0x3393('0x30')](_0x43efa9[_0x3393('0x2b')][_0x3393('0x30')]));_0x24412d[_0x3393('0x2f')]=_0x24412d[_0x3393('0x2f')][_0x3393('0x31')]?_0x24412d[_0x3393('0x2f')]:_0x493573[_0x3393('0x2a')];_0x24412d[_0x3393('0x4d')]=qs[_0x3393('0x33')](_0x43efa9[_0x3393('0x2b')][_0x3393('0x33')]);_0x24412d[_0x3393('0x34')]=qs['filters'](_[_0x3393('0x35')](_0x43efa9[_0x3393('0x2b')],_0x493573[_0x3393('0x2d')]));if(_0x43efa9[_0x3393('0x2b')]['filter']){_0x24412d[_0x3393('0x34')]=_['merge'](_0x24412d[_0x3393('0x34')],{'$or':_[_0x3393('0x26')](_0x24412d[_0x3393('0x2f')],function(_0x4d8ad9){var _0x225d0f={};_0x225d0f[_0x4d8ad9]={'$like':'%'+_0x43efa9[_0x3393('0x2b')][_0x3393('0x36')]+'%'};return _0x225d0f;})});}_0x24412d=_[_0x3393('0x37')]({},_0x24412d,_0x43efa9[_0x3393('0x39')]);return _0x46a77e[_0x3393('0x51')](_0x24412d);}})[_0x3393('0x3e')](function(_0x1487f0){if(_0x1487f0){_0x24b199=_0x1487f0['length'];if(!_0x43efa9[_0x3393('0x2b')][_0x3393('0x32')]('nolimit')){_0x24412d['limit']=qs[_0x3393('0x1a')](_0x43efa9['query'][_0x3393('0x1a')]);_0x24412d[_0x3393('0x19')]=qs[_0x3393('0x19')](_0x43efa9[_0x3393('0x2b')][_0x3393('0x19')]);}return _0x46a77e[_0x3393('0x51')](_0x24412d);}})[_0x3393('0x3e')](function(_0x1f4d94){if(_0x1f4d94){return _0x1f4d94?{'count':_0x24b199,'rows':_0x1f4d94}:null;}})[_0x3393('0x3e')](respondWithResult(_0x263acb,null))[_0x3393('0x3f')](handleError(_0x263acb,null));}; \ No newline at end of file +var _0x09f8=['attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','catch','params','include','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','order','addActions','Action','getActions','rawAttributes','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','intersection','fields','length'];(function(_0x43693c,_0x4d888c){var _0x175d7a=function(_0x1e958a){while(--_0x1e958a){_0x43693c['push'](_0x43693c['shift']());}};_0x175d7a(++_0x4d888c);}(_0x09f8,0x72));var _0x809f=function(_0x2085fd,_0x260ccc){_0x2085fd=_0x2085fd-0x0;var _0x557ab3=_0x09f8[_0x2085fd];return _0x557ab3;};'use strict';var pdf=require(_0x809f('0x0'));var emlformat=require(_0x809f('0x1'));var rimraf=require(_0x809f('0x2'));var zipdir=require(_0x809f('0x3'));var jsonpatch=require(_0x809f('0x4'));var rp=require(_0x809f('0x5'));var moment=require(_0x809f('0x6'));var BPromise=require(_0x809f('0x7'));var Mustache=require(_0x809f('0x8'));var util=require('util');var path=require(_0x809f('0x9'));var sox=require(_0x809f('0xa'));var csv=require(_0x809f('0xb'));var ejs=require(_0x809f('0xc'));var fs=require('fs');var _=require(_0x809f('0xd'));var squel=require(_0x809f('0xe'));var crypto=require(_0x809f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x809f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x809f('0x11'));var Papa=require('papaparse');var Redis=require(_0x809f('0x12'));var authService=require(_0x809f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x809f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x809f('0x15'))(_0x809f('0x16'));var utils=require(_0x809f('0x17'));var config=require(_0x809f('0x18'));var db=require(_0x809f('0x19'))['db'];function respondWithStatusCode(_0x3f1983,_0x31789c){_0x31789c=_0x31789c||0xcc;return function(_0x2e026c){if(_0x2e026c){return _0x3f1983['sendStatus'](_0x31789c);}return _0x3f1983[_0x809f('0x1a')](_0x31789c)[_0x809f('0x1b')]();};}function respondWithResult(_0x2a6d82,_0x802a81){_0x802a81=_0x802a81||0xc8;return function(_0x234683){if(_0x234683){return _0x2a6d82['status'](_0x802a81)[_0x809f('0x1c')](_0x234683);}};}function respondWithFilteredResult(_0x2947c5,_0x5cebb9){return function(_0x593d45){if(_0x593d45){var _0x12426d=_0x593d45['count'],_0x20e67a=_0x5cebb9[_0x809f('0x1d')],_0x1f398b=_0x5cebb9['offset']+_0x5cebb9[_0x809f('0x1e')],_0x15b412;if(_0x1f398b>=_0x12426d){_0x1f398b=_0x12426d;_0x15b412=0xc8;}else{_0x15b412=0xce;}_0x2947c5[_0x809f('0x1a')](_0x15b412);return _0x2947c5[_0x809f('0x1f')]('Content-Range',_0x20e67a+'-'+_0x1f398b+'/'+_0x12426d)[_0x809f('0x1c')](_0x593d45);}return null;};}function patchUpdates(_0xcfa46d){return function(_0x28e7aa){try{jsonpatch[_0x809f('0x20')](_0x28e7aa,_0xcfa46d,!![]);}catch(_0x262896){return BPromise['reject'](_0x262896);}return _0x28e7aa[_0x809f('0x21')]();};}function saveUpdates(_0x23e8b7,_0x5f36e8){return function(_0x55b55a){if(_0x55b55a){return _0x55b55a[_0x809f('0x22')](_0x23e8b7)[_0x809f('0x23')](function(_0x32b1b7){return _0x32b1b7;});}return null;};}function removeEntity(_0x1192f5,_0x2df940){return function(_0x507c17){if(_0x507c17){return _0x507c17[_0x809f('0x24')]()[_0x809f('0x23')](function(){_0x1192f5['status'](0xcc)[_0x809f('0x1b')]();});}};}function handleEntityNotFound(_0x15831d,_0xe3f473){return function(_0x1556ba){if(!_0x1556ba){_0x15831d[_0x809f('0x25')](0x194);}return _0x1556ba;};}function handleError(_0x5f0fe4,_0x4df571){_0x4df571=_0x4df571||0x1f4;return function(_0x265d25){logger[_0x809f('0x26')](_0x265d25[_0x809f('0x27')]);if(_0x265d25[_0x809f('0x28')]){delete _0x265d25[_0x809f('0x28')];}_0x5f0fe4[_0x809f('0x1a')](_0x4df571)[_0x809f('0x29')](_0x265d25);};}exports[_0x809f('0x2a')]=function(_0x9076f7,_0x18aa03){var _0x46bf02={},_0x282d73={},_0x17aa25={'count':0x0,'rows':[]};var _0xf4ea49=_[_0x809f('0x2b')](db[_0x809f('0x2c')]['rawAttributes'],function(_0x592107){return{'name':_0x592107[_0x809f('0x2d')],'type':_0x592107[_0x809f('0x2e')][_0x809f('0x2f')]};});_0x282d73[_0x809f('0x30')]=_[_0x809f('0x2b')](_0xf4ea49,_0x809f('0x28'));_0x282d73[_0x809f('0x31')]=_[_0x809f('0x32')](_0x9076f7[_0x809f('0x31')]);_0x282d73['filters']=_[_0x809f('0x33')](_0x282d73[_0x809f('0x30')],_0x282d73[_0x809f('0x31')]);_0x46bf02['attributes']=_[_0x809f('0x33')](_0x282d73[_0x809f('0x30')],qs[_0x809f('0x34')](_0x9076f7[_0x809f('0x31')][_0x809f('0x34')]));_0x46bf02['attributes']=_0x46bf02['attributes'][_0x809f('0x35')]?_0x46bf02[_0x809f('0x36')]:_0x282d73['model'];if(!_0x9076f7['query'][_0x809f('0x37')](_0x809f('0x38'))){_0x46bf02[_0x809f('0x1e')]=qs[_0x809f('0x1e')](_0x9076f7[_0x809f('0x31')][_0x809f('0x1e')]);_0x46bf02['offset']=qs[_0x809f('0x1d')](_0x9076f7[_0x809f('0x31')][_0x809f('0x1d')]);}_0x46bf02['order']=qs[_0x809f('0x39')](_0x9076f7[_0x809f('0x31')]['sort']);_0x46bf02[_0x809f('0x3a')]=qs[_0x809f('0x3b')](_[_0x809f('0x3c')](_0x9076f7[_0x809f('0x31')],_0x282d73[_0x809f('0x3b')]),_0xf4ea49);if(_0x9076f7[_0x809f('0x31')][_0x809f('0x3d')]){_0x46bf02[_0x809f('0x3a')]=_[_0x809f('0x3e')](_0x46bf02['where'],{'$or':_[_0x809f('0x2b')](_0xf4ea49,function(_0x1e9a45){if(_0x1e9a45[_0x809f('0x2e')]!==_0x809f('0x3f')){var _0x34a631={};_0x34a631[_0x1e9a45[_0x809f('0x28')]]={'$like':'%'+_0x9076f7[_0x809f('0x31')]['filter']+'%'};return _0x34a631;}})});}_0x46bf02=_[_0x809f('0x3e')]({},_0x46bf02,_0x9076f7[_0x809f('0x40')]);var _0x2762c3={'where':_0x46bf02[_0x809f('0x3a')]};return db['Automation'][_0x809f('0x41')](_0x2762c3)[_0x809f('0x23')](function(_0x194e22){_0x17aa25['count']=_0x194e22;if(_0x9076f7[_0x809f('0x31')][_0x809f('0x42')]){_0x46bf02['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x46bf02);})[_0x809f('0x23')](function(_0x53ded3){_0x17aa25['rows']=_0x53ded3;return _0x17aa25;})[_0x809f('0x23')](respondWithFilteredResult(_0x18aa03,_0x46bf02))[_0x809f('0x43')](handleError(_0x18aa03,null));};exports['show']=function(_0x4886d7,_0x3b3fe0){var _0x1b2e91={'raw':![],'where':{'id':_0x4886d7[_0x809f('0x44')]['id']}},_0x2ba911={};_0x2ba911[_0x809f('0x30')]=_[_0x809f('0x32')](db['Automation']['rawAttributes']);_0x2ba911[_0x809f('0x31')]=_[_0x809f('0x32')](_0x4886d7['query']);_0x2ba911['filters']=_['intersection'](_0x2ba911[_0x809f('0x30')],_0x2ba911[_0x809f('0x31')]);_0x1b2e91['attributes']=_[_0x809f('0x33')](_0x2ba911[_0x809f('0x30')],qs[_0x809f('0x34')](_0x4886d7[_0x809f('0x31')][_0x809f('0x34')]));_0x1b2e91[_0x809f('0x36')]=_0x1b2e91['attributes'][_0x809f('0x35')]?_0x1b2e91[_0x809f('0x36')]:_0x2ba911['model'];if(_0x4886d7['query'][_0x809f('0x42')]){_0x1b2e91[_0x809f('0x45')]=[{'all':!![]}];}_0x1b2e91=_['merge']({},_0x1b2e91,_0x4886d7[_0x809f('0x40')]);return db[_0x809f('0x2c')][_0x809f('0x46')](_0x1b2e91)[_0x809f('0x23')](handleEntityNotFound(_0x3b3fe0,null))[_0x809f('0x23')](respondWithResult(_0x3b3fe0,null))[_0x809f('0x43')](handleError(_0x3b3fe0,null));};exports['create']=function(_0x586622,_0x4ebeea){return db['Automation'][_0x809f('0x47')](_0x586622[_0x809f('0x48')],{})[_0x809f('0x23')](respondWithResult(_0x4ebeea,0xc9))[_0x809f('0x43')](handleError(_0x4ebeea,null));};exports['update']=function(_0x327ab8,_0x4f06db){if(_0x327ab8['body']['id']){delete _0x327ab8['body']['id'];}return db[_0x809f('0x2c')][_0x809f('0x46')]({'where':{'id':_0x327ab8[_0x809f('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f06db,null))[_0x809f('0x23')](saveUpdates(_0x327ab8[_0x809f('0x48')],null))[_0x809f('0x23')](respondWithResult(_0x4f06db,null))[_0x809f('0x43')](handleError(_0x4f06db,null));};exports[_0x809f('0x24')]=function(_0x94e9b9,_0xcfe95c){return db[_0x809f('0x2c')]['find']({'where':{'id':_0x94e9b9[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0xcfe95c,null))['then'](removeEntity(_0xcfe95c,null))['catch'](handleError(_0xcfe95c,null));};exports[_0x809f('0x49')]=function(_0x5c8bb3,_0xf9131f,_0x5ebaee){return db['Condition'][_0x809f('0x46')]({'where':{'id':_0x5c8bb3[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0xf9131f,null))[_0x809f('0x23')](function(_0x14b651){if(_0x14b651){return _0x14b651['addConditions'](_0x5c8bb3[_0x809f('0x48')][_0x809f('0x4a')],_[_0x809f('0x4b')](_0x5c8bb3[_0x809f('0x48')],[_0x809f('0x4a'),'id'])||{});}})[_0x809f('0x23')](respondWithResult(_0xf9131f,null))[_0x809f('0x43')](handleError(_0xf9131f,null));};exports[_0x809f('0x4c')]=function(_0x286ec2,_0x13be23,_0x32bef7){var _0x35312d={};var _0xbb2b87={};var _0xb0b13f;var _0x1c42a5;return db['Automation'][_0x809f('0x4d')]({'where':{'id':_0x286ec2[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0x13be23,null))[_0x809f('0x23')](function(_0x4a65cc){if(_0x4a65cc){_0xb0b13f=_0x4a65cc;_0xbb2b87[_0x809f('0x30')]=_['keys'](db[_0x809f('0x4e')]['rawAttributes']);_0xbb2b87[_0x809f('0x31')]=_[_0x809f('0x32')](_0x286ec2[_0x809f('0x31')]);_0xbb2b87[_0x809f('0x3b')]=_[_0x809f('0x33')](_0xbb2b87['model'],_0xbb2b87[_0x809f('0x31')]);_0x35312d['attributes']=_[_0x809f('0x33')](_0xbb2b87[_0x809f('0x30')],qs[_0x809f('0x34')](_0x286ec2[_0x809f('0x31')][_0x809f('0x34')]));_0x35312d[_0x809f('0x36')]=_0x35312d[_0x809f('0x36')][_0x809f('0x35')]?_0x35312d[_0x809f('0x36')]:_0xbb2b87[_0x809f('0x30')];_0x35312d[_0x809f('0x4f')]=qs[_0x809f('0x39')](_0x286ec2[_0x809f('0x31')]['sort']);_0x35312d[_0x809f('0x3a')]=qs[_0x809f('0x3b')](_[_0x809f('0x3c')](_0x286ec2[_0x809f('0x31')],_0xbb2b87[_0x809f('0x3b')]));if(_0x286ec2[_0x809f('0x31')][_0x809f('0x3d')]){_0x35312d['where']=_[_0x809f('0x3e')](_0x35312d['where'],{'$or':_[_0x809f('0x2b')](_0x35312d[_0x809f('0x36')],function(_0x1c8d60){var _0x5a71c9={};_0x5a71c9[_0x1c8d60]={'$like':'%'+_0x286ec2[_0x809f('0x31')][_0x809f('0x3d')]+'%'};return _0x5a71c9;})});}_0x35312d=_['merge']({},_0x35312d,_0x286ec2[_0x809f('0x40')]);return _0xb0b13f['getConditions'](_0x35312d);}})[_0x809f('0x23')](function(_0x34a531){if(_0x34a531){_0x1c42a5=_0x34a531[_0x809f('0x35')];if(!_0x286ec2[_0x809f('0x31')][_0x809f('0x37')](_0x809f('0x38'))){_0x35312d[_0x809f('0x1e')]=qs[_0x809f('0x1e')](_0x286ec2[_0x809f('0x31')][_0x809f('0x1e')]);_0x35312d[_0x809f('0x1d')]=qs[_0x809f('0x1d')](_0x286ec2[_0x809f('0x31')][_0x809f('0x1d')]);}return _0xb0b13f[_0x809f('0x4c')](_0x35312d);}})[_0x809f('0x23')](function(_0x541381){if(_0x541381){return _0x541381?{'count':_0x1c42a5,'rows':_0x541381}:null;}})[_0x809f('0x23')](respondWithResult(_0x13be23,null))[_0x809f('0x43')](handleError(_0x13be23,null));};exports[_0x809f('0x50')]=function(_0xd7a14d,_0x4f4b09,_0x4b75a0){return db[_0x809f('0x51')][_0x809f('0x46')]({'where':{'id':_0xd7a14d['params']['id']}})['then'](handleEntityNotFound(_0x4f4b09,null))[_0x809f('0x23')](function(_0x1e630c){if(_0x1e630c){return _0x1e630c[_0x809f('0x50')](_0xd7a14d[_0x809f('0x48')]['ids'],_['omit'](_0xd7a14d[_0x809f('0x48')],[_0x809f('0x4a'),'id'])||{});}})[_0x809f('0x23')](respondWithResult(_0x4f4b09,null))['catch'](handleError(_0x4f4b09,null));};exports[_0x809f('0x52')]=function(_0x4d8c31,_0x31e60f,_0x17a7c8){var _0x2d2363={};var _0x981d82={};var _0x34210b;var _0x3740c2;return db[_0x809f('0x2c')]['findOne']({'where':{'id':_0x4d8c31[_0x809f('0x44')]['id']}})[_0x809f('0x23')](handleEntityNotFound(_0x31e60f,null))['then'](function(_0x528628){if(_0x528628){_0x34210b=_0x528628;_0x981d82[_0x809f('0x30')]=_[_0x809f('0x32')](db[_0x809f('0x51')][_0x809f('0x53')]);_0x981d82['query']=_[_0x809f('0x32')](_0x4d8c31['query']);_0x981d82['filters']=_[_0x809f('0x33')](_0x981d82['model'],_0x981d82['query']);_0x2d2363[_0x809f('0x36')]=_['intersection'](_0x981d82[_0x809f('0x30')],qs[_0x809f('0x34')](_0x4d8c31[_0x809f('0x31')][_0x809f('0x34')]));_0x2d2363['attributes']=_0x2d2363[_0x809f('0x36')][_0x809f('0x35')]?_0x2d2363[_0x809f('0x36')]:_0x981d82[_0x809f('0x30')];_0x2d2363[_0x809f('0x4f')]=qs[_0x809f('0x39')](_0x4d8c31[_0x809f('0x31')]['sort']);_0x2d2363['where']=qs[_0x809f('0x3b')](_[_0x809f('0x3c')](_0x4d8c31[_0x809f('0x31')],_0x981d82['filters']));if(_0x4d8c31[_0x809f('0x31')][_0x809f('0x3d')]){_0x2d2363[_0x809f('0x3a')]=_[_0x809f('0x3e')](_0x2d2363[_0x809f('0x3a')],{'$or':_[_0x809f('0x2b')](_0x2d2363[_0x809f('0x36')],function(_0x3736f2){var _0x24ae06={};_0x24ae06[_0x3736f2]={'$like':'%'+_0x4d8c31[_0x809f('0x31')][_0x809f('0x3d')]+'%'};return _0x24ae06;})});}_0x2d2363=_[_0x809f('0x3e')]({},_0x2d2363,_0x4d8c31[_0x809f('0x40')]);return _0x34210b['getActions'](_0x2d2363);}})[_0x809f('0x23')](function(_0x43f771){if(_0x43f771){_0x3740c2=_0x43f771[_0x809f('0x35')];if(!_0x4d8c31['query']['hasOwnProperty'](_0x809f('0x38'))){_0x2d2363[_0x809f('0x1e')]=qs[_0x809f('0x1e')](_0x4d8c31[_0x809f('0x31')][_0x809f('0x1e')]);_0x2d2363['offset']=qs['offset'](_0x4d8c31['query']['offset']);}return _0x34210b[_0x809f('0x52')](_0x2d2363);}})[_0x809f('0x23')](function(_0xe5d0fe){if(_0xe5d0fe){return _0xe5d0fe?{'count':_0x3740c2,'rows':_0xe5d0fe}:null;}})[_0x809f('0x23')](respondWithResult(_0x31e60f,null))[_0x809f('0x43')](handleError(_0x31e60f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 32dec13..eebcf68 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 _0x3e74=['exports','Automation','tools_automations','lodash','../../config/logger','api','moment','path','../../config/environment','./automation.attributes'];(function(_0x178a9c,_0x562a28){var _0x3fd933=function(_0x37a0e2){while(--_0x37a0e2){_0x178a9c['push'](_0x178a9c['shift']());}};_0x3fd933(++_0x562a28);}(_0x3e74,0x175));var _0x43e7=function(_0x3320a3,_0x3032d7){_0x3320a3=_0x3320a3-0x0;var _0x2feece=_0x3e74[_0x3320a3];return _0x2feece;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_automations','lodash'];(function(_0x2548ca,_0x117ca1){var _0x55dda4=function(_0x294d7d){while(--_0x294d7d){_0x2548ca['push'](_0x2548ca['shift']());}};_0x55dda4(++_0x117ca1);}(_0xabce,0x103));var _0xeabc=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xabce[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Automation',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 578f03a..440af27 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 _0x1ca3=['message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x1ca3,0x18a));var _0x31ca=function(_0x1e6c93,_0x3cd9a7){_0x1e6c93=_0x1e6c93-0x0;var _0x367a16=_0x1ca3[_0x1e6c93];return _0x367a16;};'use strict';var _=require(_0x31ca('0x0'));var util=require('util');var moment=require(_0x31ca('0x1'));var BPromise=require(_0x31ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31ca('0x3'))['db'];var utils=require(_0x31ca('0x4'));var logger=require(_0x31ca('0x5'))(_0x31ca('0x6'));var config=require(_0x31ca('0x7'));var jayson=require(_0x31ca('0x8'));var client=jayson[_0x31ca('0x9')][_0x31ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c9f8,_0x4ad837,_0x2f0197){return new BPromise(function(_0x200722,_0x45edb7){return client[_0x31ca('0xb')](_0x31c9f8,_0x2f0197)[_0x31ca('0xc')](function(_0x4d41e8){logger[_0x31ca('0xd')]('Automation,\x20%s,\x20%s',_0x4ad837,_0x31ca('0xe'));logger['debug'](_0x31ca('0xf'),_0x4ad837,_0x31ca('0xe'),JSON[_0x31ca('0x10')](_0x4d41e8));if(_0x4d41e8['error']){if(_0x4d41e8[_0x31ca('0x11')][_0x31ca('0x12')]===0x1f4){logger[_0x31ca('0x11')](_0x31ca('0x13'),_0x4ad837,_0x4d41e8['error'][_0x31ca('0x14')]);return _0x45edb7(_0x4d41e8[_0x31ca('0x11')]['message']);}logger[_0x31ca('0x11')](_0x31ca('0x13'),_0x4ad837,_0x4d41e8[_0x31ca('0x11')][_0x31ca('0x14')]);return _0x200722(_0x4d41e8['error']['message']);}else{logger[_0x31ca('0xd')](_0x31ca('0x13'),_0x4ad837,'request\x20sent');_0x200722(_0x4d41e8[_0x31ca('0x15')][_0x31ca('0x14')]);}})[_0x31ca('0x16')](function(_0x26037d){logger[_0x31ca('0x11')]('Automation,\x20%s,\x20%s',_0x4ad837,_0x26037d);_0x45edb7(_0x26037d);});});} \ No newline at end of file +var _0xbee8=['info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x68f8c8,_0x3fff19){var _0x193d6f=function(_0x141a37){while(--_0x141a37){_0x68f8c8['push'](_0x68f8c8['shift']());}};_0x193d6f(++_0x3fff19);}(_0xbee8,0x17a));var _0x8bee=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xbee8[_0xbc1a4b];return _0x108b87;};'use strict';var _=require(_0x8bee('0x0'));var util=require(_0x8bee('0x1'));var moment=require(_0x8bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bee('0x3'));var fs=require('fs');var Redis=require(_0x8bee('0x4'));var db=require(_0x8bee('0x5'))['db'];var utils=require(_0x8bee('0x6'));var logger=require(_0x8bee('0x7'))(_0x8bee('0x8'));var config=require('../../config/environment');var jayson=require(_0x8bee('0x9'));var client=jayson[_0x8bee('0xa')][_0x8bee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18f3f3,_0x34f49f,_0x2fffc5){return new BPromise(function(_0x48a27a,_0x12f0b5){return client[_0x8bee('0xc')](_0x18f3f3,_0x2fffc5)['then'](function(_0x177fd5){logger[_0x8bee('0xd')]('Automation,\x20%s,\x20%s',_0x34f49f,'request\x20sent');logger[_0x8bee('0xe')](_0x8bee('0xf'),_0x34f49f,_0x8bee('0x10'),JSON[_0x8bee('0x11')](_0x177fd5));if(_0x177fd5[_0x8bee('0x12')]){if(_0x177fd5[_0x8bee('0x12')][_0x8bee('0x13')]===0x1f4){logger[_0x8bee('0x12')](_0x8bee('0x14'),_0x34f49f,_0x177fd5[_0x8bee('0x12')][_0x8bee('0x15')]);return _0x12f0b5(_0x177fd5[_0x8bee('0x12')][_0x8bee('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x34f49f,_0x177fd5[_0x8bee('0x12')]['message']);return _0x48a27a(_0x177fd5[_0x8bee('0x12')][_0x8bee('0x15')]);}else{logger[_0x8bee('0xd')](_0x8bee('0x14'),_0x34f49f,_0x8bee('0x10'));_0x48a27a(_0x177fd5['result'][_0x8bee('0x15')]);}})[_0x8bee('0x16')](function(_0x212c72){logger[_0x8bee('0x12')](_0x8bee('0x14'),_0x34f49f,_0x212c72);_0x12f0b5(_0x212c72);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index bec05dc..5970602 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 _0x3a22=['getActions','post','create','addConditions','addActions','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x4d9455,_0x58b1b7){var _0x51aa7f=function(_0x5ba4b3){while(--_0x5ba4b3){_0x4d9455['push'](_0x4d9455['shift']());}};_0x51aa7f(++_0x58b1b7);}(_0x3a22,0xa9));var _0x23a2=function(_0x1e0270,_0x4e51c2){_0x1e0270=_0x1e0270-0x0;var _0x46893c=_0x3a22[_0x1e0270];return _0x46893c;};'use strict';var multer=require(_0x23a2('0x0'));var util=require('util');var path=require(_0x23a2('0x1'));var timeout=require(_0x23a2('0x2'));var express=require(_0x23a2('0x3'));var router=express[_0x23a2('0x4')]();var auth=require(_0x23a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x23a2('0x6'));var controller=require(_0x23a2('0x7'));router[_0x23a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x23a2('0x9'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xb')]);router[_0x23a2('0x8')](_0x23a2('0xc'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xd')]);router[_0x23a2('0x8')](_0x23a2('0xe'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xf')]);router[_0x23a2('0x10')]('/',auth['isAuthenticated'](),controller[_0x23a2('0x11')]);router['post'](_0x23a2('0xc'),auth[_0x23a2('0xa')](),controller[_0x23a2('0x12')]);router[_0x23a2('0x10')](_0x23a2('0xe'),auth[_0x23a2('0xa')](),controller[_0x23a2('0x13')]);router[_0x23a2('0x14')](_0x23a2('0x9'),auth[_0x23a2('0xa')](),controller['update']);router[_0x23a2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x23a2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2657=['get','/:id','show','/:id/conditions','getConditions','/:id/actions','create','post','addActions','update','destroy','multer','path','express','../../config/environment','./automation.controller','isAuthenticated','index'];(function(_0xc795f8,_0x6f05e7){var _0x4ae07b=function(_0x371e52){while(--_0x371e52){_0xc795f8['push'](_0xc795f8['shift']());}};_0x4ae07b(++_0x6f05e7);}(_0x2657,0xd1));var _0x7265=function(_0x2aa983,_0x28c4f0){_0x2aa983=_0x2aa983-0x0;var _0x4c1248=_0x2657[_0x2aa983];return _0x4c1248;};'use strict';var multer=require(_0x7265('0x0'));var util=require('util');var path=require(_0x7265('0x1'));var timeout=require('connect-timeout');var express=require(_0x7265('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7265('0x3'));var controller=require(_0x7265('0x4'));router['get']('/',auth[_0x7265('0x5')](),controller[_0x7265('0x6')]);router[_0x7265('0x7')](_0x7265('0x8'),auth[_0x7265('0x5')](),controller[_0x7265('0x9')]);router['get'](_0x7265('0xa'),auth[_0x7265('0x5')](),controller[_0x7265('0xb')]);router[_0x7265('0x7')](_0x7265('0xc'),auth[_0x7265('0x5')](),controller['getActions']);router['post']('/',auth[_0x7265('0x5')](),controller[_0x7265('0xd')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x7265('0xe')](_0x7265('0xc'),auth[_0x7265('0x5')](),controller[_0x7265('0xf')]);router['put'](_0x7265('0x8'),auth['isAuthenticated'](),controller[_0x7265('0x10')]);router['delete'](_0x7265('0x8'),auth[_0x7265('0x5')](),controller[_0x7265('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f3c7043..728fe3e 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 _0x8094=['#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)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2a84d6,_0x538497){var _0x55c2ea=function(_0x3f5d46){while(--_0x3f5d46){_0x2a84d6['push'](_0x2a84d6['shift']());}};_0x55c2ea(++_0x538497);}(_0x8094,0x12d));var _0x4809=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x8094[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require('sequelize');module[_0x4809('0x0')]={'name':{'type':Sequelize[_0x4809('0x1')],'unique':_0x4809('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4809('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x4809('0x4')},'description':{'type':Sequelize[_0x4809('0x1')]},'active':{'type':Sequelize[_0x4809('0x5')],'defaultValue':0x0,'comment':_0x4809('0x6')},'limitCalls':{'type':Sequelize[_0x4809('0x7')](0x4)[_0x4809('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4809('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4809('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'comment':_0x4809('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4809('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4809('0xe')},'dialTimezone':{'type':Sequelize[_0x4809('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x4809('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4809('0x10'),'never',_0x4809('0x11')),'defaultValue':_0x4809('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4809('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4809('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4809('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4809('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4809('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4809('0x7')](0x9)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4809('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4809('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4809('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4809('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x4809('0x18')),'defaultValue':_0x4809('0x19')},'dialPrefix':{'type':Sequelize[_0x4809('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4809('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4809('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4809('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4809('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4809('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4809('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4809('0x7')](0x3)[_0x4809('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4809('0x7')](0x5)[_0x4809('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xa120=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x46aec6,_0x1745da){var _0x425ffb=function(_0x4d7fc3){while(--_0x4d7fc3){_0x46aec6['push'](_0x46aec6['shift']());}};_0x425ffb(++_0x1745da);}(_0xa120,0xe8));var _0x0a12=function(_0x3873d8,_0x571bc2){_0x3873d8=_0x3873d8-0x0;var _0x1b2111=_0xa120[_0x3873d8];return _0x1b2111;};'use strict';var Sequelize=require(_0x0a12('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a12('0x1')],'unique':_0x0a12('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0a12('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x0a12('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0a12('0x5')],'defaultValue':0x0,'comment':_0x0a12('0x6')},'limitCalls':{'type':Sequelize[_0x0a12('0x7')](0x4)[_0x0a12('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0a12('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a12('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a12('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'comment':_0x0a12('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0a12('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0a12('0x3')](_0x0a12('0xf'),_0x0a12('0x10'),_0x0a12('0x11')),'defaultValue':_0x0a12('0xf')},'dialAMDActive':{'type':Sequelize[_0x0a12('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a12('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a12('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x0a12('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a12('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a12('0x7')](0x9)[_0x0a12('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a12('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a12('0x7')](0x9)[_0x0a12('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0a12('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a12('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0a12('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0a12('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a12('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0a12('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a12('0x7')](0x9)[_0x0a12('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a12('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x0a12('0x19'),_0x0a12('0x1a')),'defaultValue':_0x0a12('0x19')},'dialPrefix':{'type':Sequelize[_0x0a12('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a12('0x1b')},'dialCutDigit':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a12('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a12('0x7')](0x3)[_0x0a12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a12('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a12('0x7')](0x5)[_0x0a12('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a12('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a6a418e..6b72ed0 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 _0xf4b0=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','role','UserProfileSection','autoAssociation','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','field','phone','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ContactId','createdAt','select','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf4b0,0x182));var _0x0f4b=function(_0x3f1728,_0x579c67){_0x3f1728=_0x3f1728-0x0;var _0x1998dc=_0xf4b0[_0x3f1728];return _0x1998dc;};'use strict';var pdf=require(_0x0f4b('0x0'));var emlformat=require(_0x0f4b('0x1'));var rimraf=require(_0x0f4b('0x2'));var zipdir=require(_0x0f4b('0x3'));var jsonpatch=require(_0x0f4b('0x4'));var rp=require('request-promise');var moment=require(_0x0f4b('0x5'));var BPromise=require(_0x0f4b('0x6'));var Mustache=require(_0x0f4b('0x7'));var util=require(_0x0f4b('0x8'));var path=require(_0x0f4b('0x9'));var sox=require(_0x0f4b('0xa'));var csv=require(_0x0f4b('0xb'));var ejs=require(_0x0f4b('0xc'));var fs=require('fs');var _=require(_0x0f4b('0xd'));var squel=require(_0x0f4b('0xe'));var crypto=require(_0x0f4b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0f4b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0f4b('0x11'));var Papa=require('papaparse');var Redis=require(_0x0f4b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0f4b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f4b('0x14'));var logger=require(_0x0f4b('0x15'))(_0x0f4b('0x16'));var utils=require('../../config/utils');var config=require(_0x0f4b('0x17'));var db=require(_0x0f4b('0x18'))['db'];function respondWithStatusCode(_0x462831,_0x4caa50){_0x4caa50=_0x4caa50||0xcc;return function(_0x237feb){if(_0x237feb){return _0x462831[_0x0f4b('0x19')](_0x4caa50);}return _0x462831[_0x0f4b('0x1a')](_0x4caa50)[_0x0f4b('0x1b')]();};}function respondWithResult(_0x22a8ee,_0x16581e){_0x16581e=_0x16581e||0xc8;return function(_0x45c014){if(_0x45c014){return _0x22a8ee['status'](_0x16581e)['json'](_0x45c014);}};}function respondWithFilteredResult(_0x2077f6,_0x5edd0c){return function(_0x3d9bae){if(_0x3d9bae){var _0x245274=_0x3d9bae[_0x0f4b('0x1c')],_0xa4ee17=_0x5edd0c[_0x0f4b('0x1d')],_0x1ed776=_0x5edd0c['offset']+_0x5edd0c[_0x0f4b('0x1e')],_0x2781d6;if(_0x1ed776>=_0x245274){_0x1ed776=_0x245274;_0x2781d6=0xc8;}else{_0x2781d6=0xce;}_0x2077f6[_0x0f4b('0x1a')](_0x2781d6);return _0x2077f6['set'](_0x0f4b('0x1f'),_0xa4ee17+'-'+_0x1ed776+'/'+_0x245274)[_0x0f4b('0x20')](_0x3d9bae);}return null;};}function patchUpdates(_0x2d0f09){return function(_0x95bdd9){try{jsonpatch[_0x0f4b('0x21')](_0x95bdd9,_0x2d0f09,!![]);}catch(_0x37a43d){return BPromise[_0x0f4b('0x22')](_0x37a43d);}return _0x95bdd9[_0x0f4b('0x23')]();};}function saveUpdates(_0x4882ee,_0x9a5a04){return function(_0x209c3d){if(_0x209c3d){return _0x209c3d[_0x0f4b('0x24')](_0x4882ee)[_0x0f4b('0x25')](function(_0x2dd4f3){return _0x2dd4f3;});}return null;};}function removeEntity(_0x46a38f,_0x1b6e33){return function(_0x17e81c){if(_0x17e81c){return _0x17e81c[_0x0f4b('0x26')]()[_0x0f4b('0x25')](function(){var _0x13ac69=_0x17e81c[_0x0f4b('0x27')]({'plain':!![]});var _0x4ce0f4=_0x0f4b('0x28');return db[_0x0f4b('0x29')][_0x0f4b('0x26')]({'where':{'type':_0x4ce0f4,'resourceId':_0x13ac69['id']}})['then'](function(){return _0x17e81c;});})[_0x0f4b('0x25')](function(){_0x46a38f[_0x0f4b('0x1a')](0xcc)[_0x0f4b('0x1b')]();});}};}function handleEntityNotFound(_0x380018,_0x4410cb){return function(_0x557a37){if(!_0x557a37){_0x380018['sendStatus'](0x194);}return _0x557a37;};}function handleError(_0x387d7a,_0x40f520){_0x40f520=_0x40f520||0x1f4;return function(_0x47473f){logger[_0x0f4b('0x2a')](_0x47473f[_0x0f4b('0x2b')]);if(_0x47473f[_0x0f4b('0x2c')]){delete _0x47473f[_0x0f4b('0x2c')];}_0x387d7a[_0x0f4b('0x1a')](_0x40f520)[_0x0f4b('0x2d')](_0x47473f);};}exports[_0x0f4b('0x2e')]=function(_0x195090,_0x2ee876){var _0x20dd9e={},_0x59f693={},_0x2d596b={'count':0x0,'rows':[]};var _0x12b785=_[_0x0f4b('0x2f')](db[_0x0f4b('0x30')]['rawAttributes'],function(_0x58cf8b){return{'name':_0x58cf8b[_0x0f4b('0x31')],'type':_0x58cf8b[_0x0f4b('0x32')][_0x0f4b('0x33')]};});_0x59f693[_0x0f4b('0x34')]=_[_0x0f4b('0x2f')](_0x12b785,_0x0f4b('0x2c'));_0x59f693[_0x0f4b('0x35')]=_['keys'](_0x195090['query']);_0x59f693[_0x0f4b('0x36')]=_['intersection'](_0x59f693[_0x0f4b('0x34')],_0x59f693[_0x0f4b('0x35')]);_0x20dd9e[_0x0f4b('0x37')]=_['intersection'](_0x59f693[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x195090[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x20dd9e['attributes']=_0x20dd9e[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0x20dd9e['attributes']:_0x59f693[_0x0f4b('0x34')];if(!_0x195090['query'][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x20dd9e[_0x0f4b('0x1e')]=qs['limit'](_0x195090[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0x20dd9e[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x195090['query'][_0x0f4b('0x1d')]);}_0x20dd9e[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x195090[_0x0f4b('0x35')]['sort']);_0x20dd9e[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x195090[_0x0f4b('0x35')],_0x59f693[_0x0f4b('0x36')]),_0x12b785);if(_0x195090[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x20dd9e['where']=_[_0x0f4b('0x41')](_0x20dd9e[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x12b785,function(_0x5f26bb){if(_0x5f26bb[_0x0f4b('0x32')]!==_0x0f4b('0x42')){var _0x42ba99={};_0x42ba99[_0x5f26bb['name']]={'$like':'%'+_0x195090[_0x0f4b('0x35')][_0x0f4b('0x40')]+'%'};return _0x42ba99;}})});}_0x20dd9e=_['merge']({},_0x20dd9e,_0x195090[_0x0f4b('0x43')]);var _0x572279={'where':_0x20dd9e[_0x0f4b('0x3e')]};return db[_0x0f4b('0x30')]['count'](_0x572279)['then'](function(_0x47c4e1){_0x2d596b[_0x0f4b('0x1c')]=_0x47c4e1;if(_0x195090[_0x0f4b('0x35')]['includeAll']){_0x20dd9e[_0x0f4b('0x44')]=[{'all':!![]}];}return db[_0x0f4b('0x30')][_0x0f4b('0x45')](_0x20dd9e);})[_0x0f4b('0x25')](function(_0x120ec8){_0x2d596b['rows']=_0x120ec8;return _0x2d596b;})[_0x0f4b('0x25')](respondWithFilteredResult(_0x2ee876,_0x20dd9e))[_0x0f4b('0x46')](handleError(_0x2ee876,null));};exports[_0x0f4b('0x47')]=function(_0x13bde7,_0xe12dc8){var _0xd0036c={'raw':![],'where':{'id':_0x13bde7[_0x0f4b('0x48')]['id']}},_0x2e4f79={};_0x2e4f79['model']=_[_0x0f4b('0x49')](db[_0x0f4b('0x30')][_0x0f4b('0x4a')]);_0x2e4f79[_0x0f4b('0x35')]=_['keys'](_0x13bde7['query']);_0x2e4f79[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x2e4f79[_0x0f4b('0x34')],_0x2e4f79[_0x0f4b('0x35')]);_0xd0036c['attributes']=_[_0x0f4b('0x4b')](_0x2e4f79[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x13bde7[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0xd0036c['attributes']=_0xd0036c[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0xd0036c[_0x0f4b('0x37')]:_0x2e4f79['model'];if(_0x13bde7[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0xd0036c[_0x0f4b('0x44')]=[{'all':!![]}];}_0xd0036c=_['merge']({},_0xd0036c,_0x13bde7['options']);return db[_0x0f4b('0x30')][_0x0f4b('0x4d')](_0xd0036c)[_0x0f4b('0x25')](handleEntityNotFound(_0xe12dc8,null))[_0x0f4b('0x25')](respondWithResult(_0xe12dc8,null))[_0x0f4b('0x46')](handleError(_0xe12dc8,null));};exports[_0x0f4b('0x4e')]=function(_0x3080d0,_0x1505d4){return db[_0x0f4b('0x30')][_0x0f4b('0x4e')](_0x3080d0[_0x0f4b('0x4f')],{})['then'](function(_0x3a7011){var _0x435a80=_0x3080d0[_0x0f4b('0x50')][_0x0f4b('0x27')]({'plain':!![]});if(!_0x435a80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x435a80['role']===_0x0f4b('0x50')){var _0x5578d9=_0x3a7011[_0x0f4b('0x27')]({'plain':!![]});var _0x2b7bf9=_0x0f4b('0x28');return db['UserProfileSection'][_0x0f4b('0x4d')]({'where':{'name':_0x2b7bf9,'userProfileId':_0x435a80[_0x0f4b('0x51')]},'raw':!![]})[_0x0f4b('0x25')](function(_0x50b3a4){if(_0x50b3a4&&_0x50b3a4['autoAssociation']===0x0){return db[_0x0f4b('0x29')][_0x0f4b('0x4e')]({'name':_0x5578d9['name'],'resourceId':_0x5578d9['id'],'type':_0x50b3a4['name'],'sectionId':_0x50b3a4['id']},{})[_0x0f4b('0x25')](function(){return _0x3a7011;});}else{return _0x3a7011;}})['catch'](function(_0x4780a4){logger[_0x0f4b('0x2a')](_0x0f4b('0x52'),_0x4780a4);throw _0x4780a4;});}return _0x3a7011;})[_0x0f4b('0x25')](respondWithResult(_0x1505d4,0xc9))['catch'](handleError(_0x1505d4,null));};exports[_0x0f4b('0x53')]=function(_0x320905,_0x6fbe3b){var _0x1c9941={'where':{'id':_0x320905[_0x0f4b('0x48')]['id']}},_0x3f9da9={};_0x3f9da9[_0x0f4b('0x34')]=_[_0x0f4b('0x49')](db['Campaign'][_0x0f4b('0x4a')]);_0x1c9941['attributes']=_[_0x0f4b('0x4b')](_0x3f9da9[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x320905[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x1c9941[_0x0f4b('0x37')]=_0x1c9941[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0x1c9941[_0x0f4b('0x37')]:_0x3f9da9['model'];if(_0x320905[_0x0f4b('0x35')]['includeAll']){_0x1c9941[_0x0f4b('0x44')]=[{'all':!![]}];}_0x1c9941=_[_0x0f4b('0x41')]({},_0x1c9941,_0x320905['options']);return db[_0x0f4b('0x30')]['find'](_0x1c9941)[_0x0f4b('0x25')](handleEntityNotFound(_0x6fbe3b,null))['then'](function(_0x22e327){if(_0x22e327){var _0xb8af04=_0x22e327['get']({'plain':!![]});_0xb8af04=qs[_0x0f4b('0x54')](_0xb8af04,['id','createdAt',_0x0f4b('0x55')]);_0x320905['body']=_[_0x0f4b('0x54')](_0x320905[_0x0f4b('0x4f')],['id','createdAt',_0x0f4b('0x55')]);return db['Campaign'][_0x0f4b('0x4e')](_['merge'](_0xb8af04,_0x320905[_0x0f4b('0x4f')]),{'include':_0x320905[_0x0f4b('0x35')][_0x0f4b('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x41b97a){var _0x2406d4=_0x320905['user'][_0x0f4b('0x27')]({'plain':!![]});if(!_0x2406d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2406d4[_0x0f4b('0x56')]===_0x0f4b('0x50')){var _0x5e4bf6=_0x41b97a['get']({'plain':!![]});var _0x68bdee='IvrCampaigns';return db[_0x0f4b('0x57')][_0x0f4b('0x4d')]({'where':{'name':_0x68bdee,'userProfileId':_0x2406d4[_0x0f4b('0x51')]},'raw':!![]})[_0x0f4b('0x25')](function(_0x1a9f1d){if(_0x1a9f1d&&_0x1a9f1d[_0x0f4b('0x58')]===0x0){return db['UserProfileResource'][_0x0f4b('0x4e')]({'name':_0x5e4bf6['name'],'resourceId':_0x5e4bf6['id'],'type':_0x1a9f1d[_0x0f4b('0x2c')],'sectionId':_0x1a9f1d['id']},{})[_0x0f4b('0x25')](function(){return _0x41b97a;});}else{return _0x41b97a;}})['catch'](function(_0x499630){logger[_0x0f4b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499630);throw _0x499630;});}return _0x41b97a;});}})[_0x0f4b('0x25')](respondWithResult(_0x6fbe3b,0xc9))['catch'](handleError(_0x6fbe3b,null));};exports[_0x0f4b('0x24')]=function(_0x21f638,_0x21bade){if(_0x21f638['body']['id']){delete _0x21f638[_0x0f4b('0x4f')]['id'];}return db[_0x0f4b('0x30')][_0x0f4b('0x4d')]({'where':{'id':_0x21f638[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x21bade,null))[_0x0f4b('0x25')](saveUpdates(_0x21f638[_0x0f4b('0x4f')],null))['then'](respondWithResult(_0x21bade,null))[_0x0f4b('0x46')](handleError(_0x21bade,null));};exports[_0x0f4b('0x26')]=function(_0x29fc04,_0x2a2aa1){return db[_0x0f4b('0x30')]['find']({'where':{'id':_0x29fc04[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x2a2aa1,null))[_0x0f4b('0x25')](removeEntity(_0x2a2aa1,null))[_0x0f4b('0x46')](handleError(_0x2a2aa1,null));};exports[_0x0f4b('0x59')]=function(_0x540141,_0x4775c3,_0x3919f2){var _0xb4201b={'raw':!![],'where':{}};var _0x3da267={};var _0x5ec94b={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x540141[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x4775c3,null))[_0x0f4b('0x25')](function(_0x5ae53a){if(_0x5ae53a){_0x3da267[_0x0f4b('0x34')]=_[_0x0f4b('0x49')](db['CmHopper'][_0x0f4b('0x4a')]);_0x3da267[_0x0f4b('0x35')]=_[_0x0f4b('0x49')](_0x540141[_0x0f4b('0x35')]);_0x3da267[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x3da267[_0x0f4b('0x34')],_0x3da267['query']);_0xb4201b[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x3da267[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x540141[_0x0f4b('0x35')]['fields']));_0xb4201b['attributes']=_0xb4201b[_0x0f4b('0x37')]['length']?_0xb4201b[_0x0f4b('0x37')]:_0x3da267[_0x0f4b('0x34')];if(!_0x540141['query'][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0xb4201b[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x540141[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0xb4201b[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x540141[_0x0f4b('0x35')]['offset']);}_0xb4201b['order']=qs[_0x0f4b('0x3d')](_0x540141[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0xb4201b[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x540141['query'],_0x3da267['filters']));_0xb4201b[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x5ae53a['id'];if(_0x540141[_0x0f4b('0x35')]['filter']){_0xb4201b[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0xb4201b[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0xb4201b[_0x0f4b('0x37')],function(_0xd33dd2){var _0x191a68={};_0x191a68[_0xd33dd2]={'$like':'%'+_0x540141[_0x0f4b('0x35')][_0x0f4b('0x40')]+'%'};return _0x191a68;})});}_0xb4201b=_[_0x0f4b('0x41')]({},_0xb4201b,_0x540141[_0x0f4b('0x43')]);return db[_0x0f4b('0x5c')][_0x0f4b('0x1c')]({'where':_0xb4201b[_0x0f4b('0x3e')]})[_0x0f4b('0x25')](function(_0x1a750a){_0x5ec94b[_0x0f4b('0x1c')]=_0x1a750a;if(_0x540141[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0xb4201b[_0x0f4b('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xb4201b);})[_0x0f4b('0x25')](function(_0x3d9d86){_0x5ec94b['rows']=_0x3d9d86;return _0x5ec94b;});}})['then'](respondWithFilteredResult(_0x4775c3,_0xb4201b))[_0x0f4b('0x46')](handleError(_0x4775c3,null));};exports[_0x0f4b('0x5d')]=function(_0x4389d4,_0xd8963f,_0x362bc7){var _0x52a012={'raw':!![],'where':{}};var _0x525b90={};var _0x154219={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x4389d4[_0x0f4b('0x48')]['id']}})['then'](handleEntityNotFound(_0xd8963f,null))[_0x0f4b('0x25')](function(_0x1d5db7){if(_0x1d5db7){_0x525b90[_0x0f4b('0x34')]=_[_0x0f4b('0x49')](db[_0x0f4b('0x5e')][_0x0f4b('0x4a')]);_0x525b90[_0x0f4b('0x35')]=_['keys'](_0x4389d4[_0x0f4b('0x35')]);_0x525b90['filters']=_[_0x0f4b('0x4b')](_0x525b90['model'],_0x525b90[_0x0f4b('0x35')]);_0x52a012[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x525b90[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x4389d4[_0x0f4b('0x35')]['fields']));_0x52a012[_0x0f4b('0x37')]=_0x52a012['attributes'][_0x0f4b('0x39')]?_0x52a012[_0x0f4b('0x37')]:_0x525b90[_0x0f4b('0x34')];if(!_0x4389d4[_0x0f4b('0x35')]['hasOwnProperty'](_0x0f4b('0x3b'))){_0x52a012[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x4389d4[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0x52a012[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x4389d4['query'][_0x0f4b('0x1d')]);}_0x52a012[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x4389d4[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0x52a012[_0x0f4b('0x3e')]=qs['filters'](_[_0x0f4b('0x3f')](_0x4389d4['query'],_0x525b90[_0x0f4b('0x36')]));_0x52a012[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x1d5db7['id'];if(_0x4389d4[_0x0f4b('0x35')]['filter']){_0x52a012[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x52a012[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x52a012['attributes'],function(_0x48892d){var _0x25095d={};_0x25095d[_0x48892d]={'$like':'%'+_0x4389d4['query'][_0x0f4b('0x40')]+'%'};return _0x25095d;})});}_0x52a012=_['merge']({},_0x52a012,_0x4389d4[_0x0f4b('0x43')]);return db['CmHopperHistory'][_0x0f4b('0x1c')]({'where':_0x52a012[_0x0f4b('0x3e')]})[_0x0f4b('0x25')](function(_0x5c402e){_0x154219[_0x0f4b('0x1c')]=_0x5c402e;if(_0x4389d4[_0x0f4b('0x35')]['includeAll']){_0x52a012[_0x0f4b('0x44')]=[{'all':!![]}];}return db[_0x0f4b('0x5e')][_0x0f4b('0x45')](_0x52a012);})['then'](function(_0x236f07){_0x154219[_0x0f4b('0x5f')]=_0x236f07;return _0x154219;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0xd8963f,_0x52a012))[_0x0f4b('0x46')](handleError(_0xd8963f,null));};exports['getHopperFinals']=function(_0x18bf70,_0x5533ae,_0x2e217c){var _0x957202={'raw':!![],'where':{}};var _0x10c7ed={};var _0x16e420={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x18bf70['params']['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x5533ae,null))['then'](function(_0x586043){if(_0x586043){_0x10c7ed[_0x0f4b('0x34')]=_['keys'](db[_0x0f4b('0x60')][_0x0f4b('0x4a')]);_0x10c7ed['query']=_[_0x0f4b('0x49')](_0x18bf70[_0x0f4b('0x35')]);_0x10c7ed[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x10c7ed['model'],_0x10c7ed[_0x0f4b('0x35')]);_0x957202[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x10c7ed[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x18bf70['query'][_0x0f4b('0x38')]));_0x957202[_0x0f4b('0x37')]=_0x957202['attributes']['length']?_0x957202[_0x0f4b('0x37')]:_0x10c7ed[_0x0f4b('0x34')];if(!_0x18bf70[_0x0f4b('0x35')]['hasOwnProperty'](_0x0f4b('0x3b'))){_0x957202[_0x0f4b('0x1e')]=qs['limit'](_0x18bf70[_0x0f4b('0x35')]['limit']);_0x957202[_0x0f4b('0x1d')]=qs['offset'](_0x18bf70[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}_0x957202[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x18bf70['query'][_0x0f4b('0x3d')]);_0x957202[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x18bf70[_0x0f4b('0x35')],_0x10c7ed[_0x0f4b('0x36')]));_0x957202[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x586043['id'];if(_0x18bf70[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x957202[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x957202[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x957202[_0x0f4b('0x37')],function(_0x3cc3be){var _0x59808e={};_0x59808e[_0x3cc3be]={'$like':'%'+_0x18bf70[_0x0f4b('0x35')]['filter']+'%'};return _0x59808e;})});}_0x957202=_['merge']({},_0x957202,_0x18bf70[_0x0f4b('0x43')]);return db['CmHopperFinal']['count']({'where':_0x957202[_0x0f4b('0x3e')]})['then'](function(_0x22199f){_0x16e420['count']=_0x22199f;if(_0x18bf70[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0x957202['include']=[{'all':!![]}];}return db[_0x0f4b('0x60')][_0x0f4b('0x45')](_0x957202);})['then'](function(_0x4d3715){_0x16e420[_0x0f4b('0x5f')]=_0x4d3715;return _0x16e420;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0x5533ae,_0x957202))[_0x0f4b('0x46')](handleError(_0x5533ae,null));};exports[_0x0f4b('0x61')]=function(_0x25a58b,_0x2cb348,_0x5be729){var _0x298ed7={'raw':!![],'where':{}};var _0x2e043c={};var _0x40edf5={'count':0x0,'rows':[]};return db['Campaign'][_0x0f4b('0x5a')]({'where':{'id':_0x25a58b['params']['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x2cb348,null))['then'](function(_0x577dc3){if(_0x577dc3){_0x2e043c[_0x0f4b('0x34')]=_['keys'](db[_0x0f4b('0x62')][_0x0f4b('0x4a')]);_0x2e043c[_0x0f4b('0x35')]=_[_0x0f4b('0x49')](_0x25a58b[_0x0f4b('0x35')]);_0x2e043c[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x2e043c[_0x0f4b('0x34')],_0x2e043c['query']);_0x298ed7[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x2e043c[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x298ed7['attributes']=_0x298ed7['attributes'][_0x0f4b('0x39')]?_0x298ed7[_0x0f4b('0x37')]:_0x2e043c[_0x0f4b('0x34')];if(!_0x25a58b['query'][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x298ed7[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x25a58b['query'][_0x0f4b('0x1e')]);_0x298ed7[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}_0x298ed7['order']=qs[_0x0f4b('0x3d')](_0x25a58b['query'][_0x0f4b('0x3d')]);_0x298ed7[_0x0f4b('0x3e')]=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x25a58b[_0x0f4b('0x35')],_0x2e043c[_0x0f4b('0x36')]));_0x298ed7[_0x0f4b('0x3e')][_0x0f4b('0x5b')]=_0x577dc3['id'];if(_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x298ed7[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x298ed7['where'],{'$or':_['map'](_0x298ed7[_0x0f4b('0x37')],function(_0xf167a0){var _0x44d36e={};_0x44d36e[_0xf167a0]={'$like':'%'+_0x25a58b[_0x0f4b('0x35')]['filter']+'%'};return _0x44d36e;})});}_0x298ed7=_[_0x0f4b('0x41')]({},_0x298ed7,_0x25a58b[_0x0f4b('0x43')]);return db[_0x0f4b('0x62')][_0x0f4b('0x1c')]({'where':_0x298ed7[_0x0f4b('0x3e')]})['then'](function(_0x481e7f){_0x40edf5[_0x0f4b('0x1c')]=_0x481e7f;if(_0x25a58b[_0x0f4b('0x35')][_0x0f4b('0x4c')]){_0x298ed7[_0x0f4b('0x44')]=[{'all':!![]}];}return db[_0x0f4b('0x62')][_0x0f4b('0x45')](_0x298ed7);})['then'](function(_0x58dd5a){_0x40edf5['rows']=_0x58dd5a;return _0x40edf5;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0x2cb348,_0x298ed7))[_0x0f4b('0x46')](handleError(_0x2cb348,null));};exports[_0x0f4b('0x63')]=function(_0x58af04,_0x117a25,_0x714c8c){var _0x579f1f={};var _0x1f1beb={};var _0xb1d142;var _0x3f0227;return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x58af04['params']['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x117a25,null))[_0x0f4b('0x25')](function(_0x362e06){if(_0x362e06){_0xb1d142=_0x362e06;_0x1f1beb['model']=_[_0x0f4b('0x49')](db[_0x0f4b('0x64')][_0x0f4b('0x4a')]);_0x1f1beb['query']=_[_0x0f4b('0x49')](_0x58af04[_0x0f4b('0x35')]);_0x1f1beb['filters']=_[_0x0f4b('0x4b')](_0x1f1beb['model'],_0x1f1beb[_0x0f4b('0x35')]);_0x579f1f['attributes']=_[_0x0f4b('0x4b')](_0x1f1beb[_0x0f4b('0x34')],qs[_0x0f4b('0x38')](_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x579f1f['attributes']=_0x579f1f[_0x0f4b('0x37')]['length']?_0x579f1f[_0x0f4b('0x37')]:_0x1f1beb[_0x0f4b('0x34')];_0x579f1f[_0x0f4b('0x3c')]=qs[_0x0f4b('0x3d')](_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0x579f1f['where']=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x58af04[_0x0f4b('0x35')],_0x1f1beb['filters']));if(_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x579f1f['where']=_[_0x0f4b('0x41')](_0x579f1f[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x579f1f[_0x0f4b('0x37')],function(_0x533a91){var _0x387804={};_0x387804[_0x533a91]={'$like':'%'+_0x58af04['query'][_0x0f4b('0x40')]+'%'};return _0x387804;})});}_0x579f1f=_[_0x0f4b('0x41')]({},_0x579f1f,_0x58af04[_0x0f4b('0x43')]);return _0xb1d142[_0x0f4b('0x63')](_0x579f1f);}})[_0x0f4b('0x25')](function(_0x1c6d77){if(_0x1c6d77){_0x3f0227=_0x1c6d77[_0x0f4b('0x39')];if(!_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x579f1f[_0x0f4b('0x1e')]=qs[_0x0f4b('0x1e')](_0x58af04['query'][_0x0f4b('0x1e')]);_0x579f1f[_0x0f4b('0x1d')]=qs[_0x0f4b('0x1d')](_0x58af04[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}return _0xb1d142[_0x0f4b('0x63')](_0x579f1f);}})[_0x0f4b('0x25')](function(_0x57fd3f){if(_0x57fd3f){return _0x57fd3f?{'count':_0x3f0227,'rows':_0x57fd3f}:null;}})[_0x0f4b('0x25')](respondWithResult(_0x117a25,null))[_0x0f4b('0x46')](handleError(_0x117a25,null));};exports[_0x0f4b('0x65')]=function(_0x23eb89,_0x71a5a1,_0x2752e4){var _0x2625a6,_0xe3ee47;return db[_0x0f4b('0x30')]['find']({'where':{'id':_0x23eb89[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x71a5a1,null))['then'](function(_0x10f5f4){if(_0x10f5f4){_0xe3ee47=_0x10f5f4;return _0x10f5f4[_0x0f4b('0x65')](_0x23eb89['body'][_0x0f4b('0x66')],_[_0x0f4b('0x54')](_0x23eb89[_0x0f4b('0x4f')],[_0x0f4b('0x66'),'id'])||{});}return null;})[_0x0f4b('0x67')](function(_0x1a097e){var _0x11177b;_0x2625a6=_0x1a097e||[];var _0x31ad2f=[];if(_0x1a097e){for(var _0xa15f83=0x0;_0xa15f83<_0x1a097e[_0x0f4b('0x39')];_0xa15f83+=0x1){var _0x38b237=_0x1a097e[_0xa15f83][_0x0f4b('0x27')]({'plain':!![]});_0xe3ee47[_0x0f4b('0x68')]=_0x23eb89[_0x0f4b('0x4f')]['dialCheckDuplicateType']?_0x23eb89[_0x0f4b('0x4f')]['dialCheckDuplicateType']:_0xe3ee47[_0x0f4b('0x68')];switch(_0xe3ee47[_0x0f4b('0x68')]){case _0x0f4b('0x69'):_0x11177b=squel[_0x0f4b('0x6a')]()[_0x0f4b('0x6b')](_0x0f4b('0x6c'))[_0x0f4b('0x6d')](['phone',_0x0f4b('0x6e'),'ContactId',_0x0f4b('0x6f'),_0x0f4b('0x5b'),'createdAt',_0x0f4b('0x55')],squel['select']()[_0x0f4b('0x70')]('phone',_0x0f4b('0x71'))[_0x0f4b('0x70')]('NOW()',_0x0f4b('0x6e'))[_0x0f4b('0x70')]('id','ContactId')['field'](_0x38b237['CmListId']['toString'](),_0x0f4b('0x6f'))['field'](_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),_0x0f4b('0x5b'))[_0x0f4b('0x70')](_0x0f4b('0x73'),'createdAt')[_0x0f4b('0x70')]('NOW()','updatedAt')[_0x0f4b('0x74')](_0x0f4b('0x75'))[_0x0f4b('0x3e')](_0x0f4b('0x76'))[_0x0f4b('0x3e')](_0x0f4b('0x77'),_0x38b237[_0x0f4b('0x78')]['toString']())[_0x0f4b('0x3e')](_0x0f4b('0x79'))[_0x0f4b('0x3e')](_0x0f4b('0x7a'),squel['select']()[_0x0f4b('0x70')](_0x0f4b('0x7b'))[_0x0f4b('0x74')](_0x0f4b('0x7c'))[_0x0f4b('0x3e')]('CampaignId\x20=\x20?',_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')]()))[_0x0f4b('0x3e')](_0x0f4b('0x7a'),squel['select']()[_0x0f4b('0x70')]('COALESCE(phone,\x27\x27)')[_0x0f4b('0x74')](_0x0f4b('0x6c'))[_0x0f4b('0x3e')](_0x0f4b('0x7d'),_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')]())))[_0x0f4b('0x72')]();break;case _0x0f4b('0x7e'):_0x11177b=squel[_0x0f4b('0x6a')]()[_0x0f4b('0x6b')](_0x0f4b('0x6c'))['fromQuery']([_0x0f4b('0x71'),_0x0f4b('0x6e'),_0x0f4b('0x7f'),_0x0f4b('0x6f'),_0x0f4b('0x5b'),_0x0f4b('0x80'),'updatedAt'],squel[_0x0f4b('0x81')]()['field'](_0x0f4b('0x71'),_0x0f4b('0x71'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x6e'))[_0x0f4b('0x70')]('id',_0x0f4b('0x7f'))[_0x0f4b('0x70')](_0x38b237[_0x0f4b('0x78')]['toString'](),'ListId')[_0x0f4b('0x70')](_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),_0x0f4b('0x5b'))['field'](_0x0f4b('0x73'),_0x0f4b('0x80'))['field'](_0x0f4b('0x73'),_0x0f4b('0x55'))[_0x0f4b('0x74')](_0x0f4b('0x75'))['where'](_0x0f4b('0x76'))[_0x0f4b('0x3e')](_0x0f4b('0x77'),_0x38b237[_0x0f4b('0x78')][_0x0f4b('0x72')]())[_0x0f4b('0x3e')](_0x0f4b('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0f4b('0x81')]()[_0x0f4b('0x70')]('COALESCE(phone,\x27\x27)')[_0x0f4b('0x74')](_0x0f4b('0x6c'))[_0x0f4b('0x3e')]('CampaignId\x20=\x20?',_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')]())))[_0x0f4b('0x72')]();break;default:_0x11177b=squel['insert']()['into'](_0x0f4b('0x6c'))[_0x0f4b('0x6d')]([_0x0f4b('0x71'),_0x0f4b('0x6e'),'ContactId','ListId',_0x0f4b('0x5b'),_0x0f4b('0x80'),_0x0f4b('0x55')],squel[_0x0f4b('0x81')]()['field'](_0x0f4b('0x71'),_0x0f4b('0x71'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x6e'))[_0x0f4b('0x70')]('id',_0x0f4b('0x7f'))[_0x0f4b('0x70')](_0x38b237[_0x0f4b('0x78')]['toString'](),'ListId')[_0x0f4b('0x70')](_0x23eb89[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),_0x0f4b('0x5b'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x80'))[_0x0f4b('0x70')](_0x0f4b('0x73'),_0x0f4b('0x55'))['from'](_0x0f4b('0x75'))[_0x0f4b('0x3e')](_0x0f4b('0x76'))['where'](_0x0f4b('0x77'),_0x38b237[_0x0f4b('0x78')][_0x0f4b('0x72')]())[_0x0f4b('0x3e')](_0x0f4b('0x79')))[_0x0f4b('0x72')]();}_0x31ad2f[_0x0f4b('0x82')](db['sequelize'][_0x0f4b('0x35')](_0x11177b));}return BPromise[_0x0f4b('0x83')](_0x31ad2f);}})[_0x0f4b('0x25')](function(){return _0x2625a6;})[_0x0f4b('0x25')](respondWithResult(_0x71a5a1,null))[_0x0f4b('0x46')](handleError(_0x71a5a1,null));};exports[_0x0f4b('0x84')]=function(_0x503692,_0xb34431,_0x120f3b){return db[_0x0f4b('0x30')]['find']({'where':{'id':_0x503692['params']['id']}})['then'](handleEntityNotFound(_0xb34431,null))[_0x0f4b('0x25')](function(_0x33d95c){if(_0x33d95c){return _0x33d95c[_0x0f4b('0x84')](_0x503692['query']['ids']);}})[_0x0f4b('0x25')](function(_0x5b6146){if(_0x5b6146){return db[_0x0f4b('0x5c')][_0x0f4b('0x26')]({'where':{'ListId':_0x503692[_0x0f4b('0x35')][_0x0f4b('0x66')],'CampaignId':_0x503692[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](function(){return _0x5b6146;});}})['then'](respondWithStatusCode(_0xb34431,null))[_0x0f4b('0x46')](handleError(_0xb34431,null));};exports[_0x0f4b('0x85')]=function(_0x146468,_0x415774,_0x475343){var _0x34b627={'raw':!![],'where':{}};var _0x150931={};var _0x2b3d37={'count':0x0,'rows':[]};return db[_0x0f4b('0x30')][_0x0f4b('0x5a')]({'where':{'id':_0x146468[_0x0f4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x415774,null))[_0x0f4b('0x25')](function(_0x3d793f){if(_0x3d793f){_0x150931[_0x0f4b('0x34')]=_['keys'](db[_0x0f4b('0x64')][_0x0f4b('0x4a')]);_0x150931[_0x0f4b('0x35')]=_[_0x0f4b('0x49')](_0x146468[_0x0f4b('0x35')]);_0x150931[_0x0f4b('0x36')]=_[_0x0f4b('0x4b')](_0x150931['model'],_0x150931[_0x0f4b('0x35')]);_0x34b627[_0x0f4b('0x37')]=_[_0x0f4b('0x4b')](_0x150931[_0x0f4b('0x34')],qs['fields'](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x38')]));_0x34b627['attributes']=_0x34b627[_0x0f4b('0x37')][_0x0f4b('0x39')]?_0x34b627[_0x0f4b('0x37')]:_0x150931['model'];if(!_0x146468[_0x0f4b('0x35')][_0x0f4b('0x3a')](_0x0f4b('0x3b'))){_0x34b627['limit']=qs[_0x0f4b('0x1e')](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x1e')]);_0x34b627['offset']=qs[_0x0f4b('0x1d')](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x1d')]);}_0x34b627['order']=qs[_0x0f4b('0x3d')](_0x146468[_0x0f4b('0x35')][_0x0f4b('0x3d')]);_0x34b627['where']=qs[_0x0f4b('0x36')](_[_0x0f4b('0x3f')](_0x146468['query'],_0x150931['filters']));_0x34b627[_0x0f4b('0x3e')]['CampaignId']=_0x3d793f['id'];if(_0x146468[_0x0f4b('0x35')][_0x0f4b('0x40')]){_0x34b627[_0x0f4b('0x3e')]=_[_0x0f4b('0x41')](_0x34b627[_0x0f4b('0x3e')],{'$or':_[_0x0f4b('0x2f')](_0x34b627['attributes'],function(_0x154465){var _0x456fca={};_0x456fca[_0x154465]={'$like':'%'+_0x146468[_0x0f4b('0x35')][_0x0f4b('0x40')]+'%'};return _0x456fca;})});}_0x34b627=_[_0x0f4b('0x41')]({},_0x34b627,_0x146468['options']);return db['CmList']['count']({'where':_0x34b627[_0x0f4b('0x3e')]})['then'](function(_0x3d9bef){_0x2b3d37['count']=_0x3d9bef;if(_0x146468[_0x0f4b('0x35')]['includeAll']){_0x34b627[_0x0f4b('0x44')]=[{'all':!![]}];}return db['CmList'][_0x0f4b('0x45')](_0x34b627);})['then'](function(_0x3fc03e){_0x2b3d37[_0x0f4b('0x5f')]=_0x3fc03e;return _0x2b3d37;});}})[_0x0f4b('0x25')](respondWithFilteredResult(_0x415774,_0x34b627))[_0x0f4b('0x46')](handleError(_0x415774,null));};exports[_0x0f4b('0x86')]=function(_0x4d49b5,_0x4ac702,_0x17a69a){var _0xd38428,_0x73f711;return db['Campaign']['find']({'where':{'id':_0x4d49b5[_0x0f4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ac702,null))[_0x0f4b('0x25')](function(_0x2a11c2){if(_0x2a11c2){_0x73f711=_0x2a11c2;return _0x2a11c2[_0x0f4b('0x86')](_0x4d49b5['body'][_0x0f4b('0x66')],_['omit'](_0x4d49b5[_0x0f4b('0x4f')],['ids','id'])||{});}return null;})[_0x0f4b('0x67')](function(_0x2cb528){var _0x59bb9b;_0xd38428=_0x2cb528||[];var _0x169a05=[];if(_0x2cb528){for(var _0x310eba=0x0;_0x310eba<_0x2cb528['length'];_0x310eba+=0x1){var _0x350b94=_0x2cb528[_0x310eba][_0x0f4b('0x27')]({'plain':!![]});_0x59bb9b=squel['insert']()[_0x0f4b('0x6b')](_0x0f4b('0x87'))[_0x0f4b('0x6d')]([_0x0f4b('0x71'),_0x0f4b('0x7f'),_0x0f4b('0x6f'),_0x0f4b('0x5b'),_0x0f4b('0x80'),_0x0f4b('0x55')],squel['select']()[_0x0f4b('0x70')](_0x0f4b('0x71'),_0x0f4b('0x71'))[_0x0f4b('0x70')]('id',_0x0f4b('0x7f'))[_0x0f4b('0x70')](_0x350b94[_0x0f4b('0x78')][_0x0f4b('0x72')](),_0x0f4b('0x6f'))['field'](_0x4d49b5[_0x0f4b('0x48')]['id'][_0x0f4b('0x72')](),'CampaignId')['field'](_0x0f4b('0x73'),_0x0f4b('0x80'))['field'](_0x0f4b('0x73'),_0x0f4b('0x55'))[_0x0f4b('0x74')](_0x0f4b('0x75'))['where'](_0x0f4b('0x76'))['where'](_0x0f4b('0x77'),_0x350b94[_0x0f4b('0x78')][_0x0f4b('0x72')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0f4b('0x72')]();_0x169a05['push'](db[_0x0f4b('0x88')][_0x0f4b('0x35')](_0x59bb9b));}return BPromise[_0x0f4b('0x83')](_0x169a05);}})[_0x0f4b('0x25')](function(){return _0xd38428;})['then'](respondWithResult(_0x4ac702,null))[_0x0f4b('0x46')](handleError(_0x4ac702,null));};exports[_0x0f4b('0x89')]=function(_0x476417,_0x15172b,_0x41beb6){return db[_0x0f4b('0x30')][_0x0f4b('0x4d')]({'where':{'id':_0x476417[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](handleEntityNotFound(_0x15172b,null))[_0x0f4b('0x25')](function(_0x100f0b){if(_0x100f0b){return _0x100f0b[_0x0f4b('0x89')](_0x476417[_0x0f4b('0x35')][_0x0f4b('0x66')]);}})[_0x0f4b('0x25')](function(_0x191a8f){if(_0x191a8f){return db[_0x0f4b('0x62')][_0x0f4b('0x26')]({'where':{'ListId':_0x476417[_0x0f4b('0x35')][_0x0f4b('0x66')],'CampaignId':_0x476417[_0x0f4b('0x48')]['id']}})[_0x0f4b('0x25')](function(){return _0x191a8f;});}})[_0x0f4b('0x25')](respondWithStatusCode(_0x15172b,null))[_0x0f4b('0x46')](handleError(_0x15172b,null));}; \ No newline at end of file +var _0x383e=['CmListId','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','into','sequelize','removeLists','CmList','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','Content-Range','json','apply','reject','save','then','destroy','IvrCampaigns','UserProfileResource','error','name','send','map','Campaign','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','select','field','ContactId','ListId','toString','NOW()','cm_contacts','ListId\x20=\x20?'];(function(_0xe202e2,_0xa15f46){var _0x3705fa=function(_0x587bd0){while(--_0x587bd0){_0xe202e2['push'](_0xe202e2['shift']());}};_0x3705fa(++_0xa15f46);}(_0x383e,0x117));var _0xe383=function(_0x32e8c4,_0x39c482){_0x32e8c4=_0x32e8c4-0x0;var _0x1b4ea0=_0x383e[_0x32e8c4];return _0x1b4ea0;};'use strict';var pdf=require(_0xe383('0x0'));var emlformat=require(_0xe383('0x1'));var rimraf=require(_0xe383('0x2'));var zipdir=require(_0xe383('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe383('0x4'));var moment=require(_0xe383('0x5'));var BPromise=require(_0xe383('0x6'));var Mustache=require(_0xe383('0x7'));var util=require('util');var path=require(_0xe383('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe383('0x9'));var squel=require(_0xe383('0xa'));var crypto=require(_0xe383('0xb'));var jsforce=require(_0xe383('0xc'));var deskjs=require(_0xe383('0xd'));var toCsv=require(_0xe383('0xe'));var querystring=require(_0xe383('0xf'));var Papa=require(_0xe383('0x10'));var Redis=require(_0xe383('0x11'));var authService=require(_0xe383('0x12'));var qs=require(_0xe383('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe383('0x14'));var logger=require(_0xe383('0x15'))(_0xe383('0x16'));var utils=require('../../config/utils');var config=require(_0xe383('0x17'));var db=require(_0xe383('0x18'))['db'];function respondWithStatusCode(_0x44320a,_0x4922f8){_0x4922f8=_0x4922f8||0xcc;return function(_0x231d59){if(_0x231d59){return _0x44320a[_0xe383('0x19')](_0x4922f8);}return _0x44320a['status'](_0x4922f8)[_0xe383('0x1a')]();};}function respondWithResult(_0x6c294b,_0x5d3df8){_0x5d3df8=_0x5d3df8||0xc8;return function(_0x3df4b2){if(_0x3df4b2){return _0x6c294b[_0xe383('0x1b')](_0x5d3df8)['json'](_0x3df4b2);}};}function respondWithFilteredResult(_0x31f4f4,_0x387e02){return function(_0x1bb1b3){if(_0x1bb1b3){var _0xf0aac3=_0x1bb1b3['count'],_0x469d53=_0x387e02[_0xe383('0x1c')],_0x23a209=_0x387e02[_0xe383('0x1c')]+_0x387e02['limit'],_0x5e0262;if(_0x23a209>=_0xf0aac3){_0x23a209=_0xf0aac3;_0x5e0262=0xc8;}else{_0x5e0262=0xce;}_0x31f4f4[_0xe383('0x1b')](_0x5e0262);return _0x31f4f4['set'](_0xe383('0x1d'),_0x469d53+'-'+_0x23a209+'/'+_0xf0aac3)[_0xe383('0x1e')](_0x1bb1b3);}return null;};}function patchUpdates(_0x552af6){return function(_0x31c671){try{jsonpatch[_0xe383('0x1f')](_0x31c671,_0x552af6,!![]);}catch(_0x1db0bb){return BPromise[_0xe383('0x20')](_0x1db0bb);}return _0x31c671[_0xe383('0x21')]();};}function saveUpdates(_0x5045ef,_0x2e42fd){return function(_0x396a97){if(_0x396a97){return _0x396a97['update'](_0x5045ef)[_0xe383('0x22')](function(_0x309202){return _0x309202;});}return null;};}function removeEntity(_0x14244f,_0x5aa437){return function(_0x4777ae){if(_0x4777ae){return _0x4777ae[_0xe383('0x23')]()['then'](function(){var _0xcf05a1=_0x4777ae['get']({'plain':!![]});var _0x3f4b8e=_0xe383('0x24');return db[_0xe383('0x25')]['destroy']({'where':{'type':_0x3f4b8e,'resourceId':_0xcf05a1['id']}})['then'](function(){return _0x4777ae;});})['then'](function(){_0x14244f[_0xe383('0x1b')](0xcc)[_0xe383('0x1a')]();});}};}function handleEntityNotFound(_0x421c92,_0x5c57fa){return function(_0x447e80){if(!_0x447e80){_0x421c92['sendStatus'](0x194);}return _0x447e80;};}function handleError(_0x1698c0,_0x40e16c){_0x40e16c=_0x40e16c||0x1f4;return function(_0x5b0aa3){logger[_0xe383('0x26')](_0x5b0aa3['stack']);if(_0x5b0aa3[_0xe383('0x27')]){delete _0x5b0aa3[_0xe383('0x27')];}_0x1698c0['status'](_0x40e16c)[_0xe383('0x28')](_0x5b0aa3);};}exports['index']=function(_0xdff372,_0x4c0ee7){var _0x21a31e={},_0x3a1bfc={},_0x5b623c={'count':0x0,'rows':[]};var _0x3fa536=_[_0xe383('0x29')](db[_0xe383('0x2a')][_0xe383('0x2b')],function(_0x178aad){return{'name':_0x178aad['fieldName'],'type':_0x178aad[_0xe383('0x2c')]['key']};});_0x3a1bfc[_0xe383('0x2d')]=_[_0xe383('0x29')](_0x3fa536,_0xe383('0x27'));_0x3a1bfc[_0xe383('0x2e')]=_['keys'](_0xdff372[_0xe383('0x2e')]);_0x3a1bfc[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x3a1bfc[_0xe383('0x2d')],_0x3a1bfc['query']);_0x21a31e[_0xe383('0x31')]=_[_0xe383('0x30')](_0x3a1bfc[_0xe383('0x2d')],qs['fields'](_0xdff372[_0xe383('0x2e')][_0xe383('0x32')]));_0x21a31e[_0xe383('0x31')]=_0x21a31e['attributes'][_0xe383('0x33')]?_0x21a31e[_0xe383('0x31')]:_0x3a1bfc[_0xe383('0x2d')];if(!_0xdff372[_0xe383('0x2e')]['hasOwnProperty'](_0xe383('0x34'))){_0x21a31e[_0xe383('0x35')]=qs[_0xe383('0x35')](_0xdff372[_0xe383('0x2e')]['limit']);_0x21a31e[_0xe383('0x1c')]=qs[_0xe383('0x1c')](_0xdff372[_0xe383('0x2e')][_0xe383('0x1c')]);}_0x21a31e[_0xe383('0x36')]=qs[_0xe383('0x37')](_0xdff372[_0xe383('0x2e')]['sort']);_0x21a31e[_0xe383('0x38')]=qs['filters'](_[_0xe383('0x39')](_0xdff372[_0xe383('0x2e')],_0x3a1bfc[_0xe383('0x2f')]),_0x3fa536);if(_0xdff372[_0xe383('0x2e')][_0xe383('0x3a')]){_0x21a31e[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x21a31e[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x3fa536,function(_0x4e6f91){if(_0x4e6f91[_0xe383('0x2c')]!==_0xe383('0x3c')){var _0x7639a={};_0x7639a[_0x4e6f91[_0xe383('0x27')]]={'$like':'%'+_0xdff372[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x7639a;}})});}_0x21a31e=_[_0xe383('0x3b')]({},_0x21a31e,_0xdff372[_0xe383('0x3d')]);var _0x336e38={'where':_0x21a31e['where']};return db[_0xe383('0x2a')][_0xe383('0x3e')](_0x336e38)['then'](function(_0x1bf0d0){_0x5b623c[_0xe383('0x3e')]=_0x1bf0d0;if(_0xdff372[_0xe383('0x2e')][_0xe383('0x3f')]){_0x21a31e[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x2a')][_0xe383('0x41')](_0x21a31e);})[_0xe383('0x22')](function(_0x5830de){_0x5b623c[_0xe383('0x42')]=_0x5830de;return _0x5b623c;})['then'](respondWithFilteredResult(_0x4c0ee7,_0x21a31e))['catch'](handleError(_0x4c0ee7,null));};exports['show']=function(_0x3459c4,_0x15a22d){var _0x562dbd={'raw':![],'where':{'id':_0x3459c4[_0xe383('0x43')]['id']}},_0x416aaa={};_0x416aaa['model']=_[_0xe383('0x44')](db[_0xe383('0x2a')][_0xe383('0x2b')]);_0x416aaa['query']=_['keys'](_0x3459c4['query']);_0x416aaa[_0xe383('0x2f')]=_['intersection'](_0x416aaa[_0xe383('0x2d')],_0x416aaa[_0xe383('0x2e')]);_0x562dbd[_0xe383('0x31')]=_[_0xe383('0x30')](_0x416aaa[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x3459c4[_0xe383('0x2e')][_0xe383('0x32')]));_0x562dbd['attributes']=_0x562dbd[_0xe383('0x31')]['length']?_0x562dbd[_0xe383('0x31')]:_0x416aaa[_0xe383('0x2d')];if(_0x3459c4[_0xe383('0x2e')]['includeAll']){_0x562dbd[_0xe383('0x40')]=[{'all':!![]}];}_0x562dbd=_[_0xe383('0x3b')]({},_0x562dbd,_0x3459c4['options']);return db[_0xe383('0x2a')]['find'](_0x562dbd)['then'](handleEntityNotFound(_0x15a22d,null))[_0xe383('0x22')](respondWithResult(_0x15a22d,null))[_0xe383('0x45')](handleError(_0x15a22d,null));};exports[_0xe383('0x46')]=function(_0x1efcdf,_0xa1f54e){return db['Campaign'][_0xe383('0x46')](_0x1efcdf['body'],{})['then'](function(_0x5d8527){var _0x1e7deb=_0x1efcdf[_0xe383('0x47')][_0xe383('0x48')]({'plain':!![]});if(!_0x1e7deb)throw new Error(_0xe383('0x49'));if(_0x1e7deb[_0xe383('0x4a')]===_0xe383('0x47')){var _0x42fb96=_0x5d8527[_0xe383('0x48')]({'plain':!![]});var _0x57620b=_0xe383('0x24');return db[_0xe383('0x4b')][_0xe383('0x4c')]({'where':{'name':_0x57620b,'userProfileId':_0x1e7deb[_0xe383('0x4d')]},'raw':!![]})[_0xe383('0x22')](function(_0x12c4c6){if(_0x12c4c6&&_0x12c4c6[_0xe383('0x4e')]===0x0){return db[_0xe383('0x25')]['create']({'name':_0x42fb96['name'],'resourceId':_0x42fb96['id'],'type':_0x12c4c6[_0xe383('0x27')],'sectionId':_0x12c4c6['id']},{})[_0xe383('0x22')](function(){return _0x5d8527;});}else{return _0x5d8527;}})[_0xe383('0x45')](function(_0x116e28){logger[_0xe383('0x26')](_0xe383('0x4f'),_0x116e28);throw _0x116e28;});}return _0x5d8527;})[_0xe383('0x22')](respondWithResult(_0xa1f54e,0xc9))[_0xe383('0x45')](handleError(_0xa1f54e,null));};exports['clone']=function(_0x2a775c,_0x265ee2){var _0x67d134={'where':{'id':_0x2a775c[_0xe383('0x43')]['id']}},_0x37408b={};_0x37408b[_0xe383('0x2d')]=_[_0xe383('0x44')](db['Campaign']['rawAttributes']);_0x67d134[_0xe383('0x31')]=_['intersection'](_0x37408b[_0xe383('0x2d')],qs['fields'](_0x2a775c[_0xe383('0x2e')]['fields']));_0x67d134[_0xe383('0x31')]=_0x67d134[_0xe383('0x31')][_0xe383('0x33')]?_0x67d134['attributes']:_0x37408b[_0xe383('0x2d')];if(_0x2a775c['query'][_0xe383('0x3f')]){_0x67d134[_0xe383('0x40')]=[{'all':!![]}];}_0x67d134=_['merge']({},_0x67d134,_0x2a775c[_0xe383('0x3d')]);return db['Campaign'][_0xe383('0x4c')](_0x67d134)[_0xe383('0x22')](handleEntityNotFound(_0x265ee2,null))[_0xe383('0x22')](function(_0x1a65c7){if(_0x1a65c7){var _0x186379=_0x1a65c7[_0xe383('0x48')]({'plain':!![]});_0x186379=qs[_0xe383('0x50')](_0x186379,['id',_0xe383('0x51'),_0xe383('0x52')]);_0x2a775c[_0xe383('0x53')]=_[_0xe383('0x50')](_0x2a775c['body'],['id',_0xe383('0x51'),_0xe383('0x52')]);return db[_0xe383('0x2a')]['create'](_['merge'](_0x186379,_0x2a775c[_0xe383('0x53')]),{'include':_0x2a775c['query'][_0xe383('0x3f')]?[{'all':!![]}]:undefined})[_0xe383('0x22')](function(_0x3f6e76){var _0x4aa7f4=_0x2a775c[_0xe383('0x47')]['get']({'plain':!![]});if(!_0x4aa7f4)throw new Error(_0xe383('0x49'));if(_0x4aa7f4[_0xe383('0x4a')]===_0xe383('0x47')){var _0x4e6a76=_0x3f6e76[_0xe383('0x48')]({'plain':!![]});var _0x4e7a76='IvrCampaigns';return db['UserProfileSection'][_0xe383('0x4c')]({'where':{'name':_0x4e7a76,'userProfileId':_0x4aa7f4[_0xe383('0x4d')]},'raw':!![]})[_0xe383('0x22')](function(_0x4613ce){if(_0x4613ce&&_0x4613ce[_0xe383('0x4e')]===0x0){return db[_0xe383('0x25')][_0xe383('0x46')]({'name':_0x4e6a76[_0xe383('0x27')],'resourceId':_0x4e6a76['id'],'type':_0x4613ce[_0xe383('0x27')],'sectionId':_0x4613ce['id']},{})[_0xe383('0x22')](function(){return _0x3f6e76;});}else{return _0x3f6e76;}})[_0xe383('0x45')](function(_0x3802a2){logger['error'](_0xe383('0x4f'),_0x3802a2);throw _0x3802a2;});}return _0x3f6e76;});}})[_0xe383('0x22')](respondWithResult(_0x265ee2,0xc9))[_0xe383('0x45')](handleError(_0x265ee2,null));};exports['update']=function(_0x50aaf4,_0x241654){if(_0x50aaf4[_0xe383('0x53')]['id']){delete _0x50aaf4[_0xe383('0x53')]['id'];}return db[_0xe383('0x2a')][_0xe383('0x4c')]({'where':{'id':_0x50aaf4[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x241654,null))['then'](saveUpdates(_0x50aaf4[_0xe383('0x53')],null))[_0xe383('0x22')](respondWithResult(_0x241654,null))[_0xe383('0x45')](handleError(_0x241654,null));};exports[_0xe383('0x23')]=function(_0x4b921c,_0x3150ac){return db[_0xe383('0x2a')]['find']({'where':{'id':_0x4b921c[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x3150ac,null))[_0xe383('0x22')](removeEntity(_0x3150ac,null))[_0xe383('0x45')](handleError(_0x3150ac,null));};exports[_0xe383('0x54')]=function(_0x236ef1,_0x35bb0d,_0x386072){var _0x5199e0={'raw':!![],'where':{}};var _0x5ef246={};var _0x44c0bc={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x236ef1['params']['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x35bb0d,null))[_0xe383('0x22')](function(_0x5f1482){if(_0x5f1482){_0x5ef246[_0xe383('0x2d')]=_['keys'](db['CmHopper'][_0xe383('0x2b')]);_0x5ef246[_0xe383('0x2e')]=_[_0xe383('0x44')](_0x236ef1[_0xe383('0x2e')]);_0x5ef246['filters']=_[_0xe383('0x30')](_0x5ef246[_0xe383('0x2d')],_0x5ef246[_0xe383('0x2e')]);_0x5199e0[_0xe383('0x31')]=_['intersection'](_0x5ef246[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x236ef1['query'][_0xe383('0x32')]));_0x5199e0['attributes']=_0x5199e0[_0xe383('0x31')][_0xe383('0x33')]?_0x5199e0['attributes']:_0x5ef246[_0xe383('0x2d')];if(!_0x236ef1[_0xe383('0x2e')]['hasOwnProperty'](_0xe383('0x34'))){_0x5199e0['limit']=qs[_0xe383('0x35')](_0x236ef1[_0xe383('0x2e')][_0xe383('0x35')]);_0x5199e0['offset']=qs[_0xe383('0x1c')](_0x236ef1[_0xe383('0x2e')]['offset']);}_0x5199e0[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x236ef1['query']['sort']);_0x5199e0[_0xe383('0x38')]=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x236ef1[_0xe383('0x2e')],_0x5ef246[_0xe383('0x2f')]));_0x5199e0[_0xe383('0x38')][_0xe383('0x56')]=_0x5f1482['id'];if(_0x236ef1['query'][_0xe383('0x3a')]){_0x5199e0['where']=_['merge'](_0x5199e0[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x5199e0[_0xe383('0x31')],function(_0x177a26){var _0x356eff={};_0x356eff[_0x177a26]={'$like':'%'+_0x236ef1[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x356eff;})});}_0x5199e0=_['merge']({},_0x5199e0,_0x236ef1['options']);return db['CmHopper'][_0xe383('0x3e')]({'where':_0x5199e0[_0xe383('0x38')]})[_0xe383('0x22')](function(_0x14bad8){_0x44c0bc['count']=_0x14bad8;if(_0x236ef1['query']['includeAll']){_0x5199e0[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x57')][_0xe383('0x41')](_0x5199e0);})[_0xe383('0x22')](function(_0x5b68ed){_0x44c0bc['rows']=_0x5b68ed;return _0x44c0bc;});}})[_0xe383('0x22')](respondWithFilteredResult(_0x35bb0d,_0x5199e0))['catch'](handleError(_0x35bb0d,null));};exports[_0xe383('0x58')]=function(_0x4b6d9b,_0x1d6e09,_0x1d3ba4){var _0x34137e={'raw':!![],'where':{}};var _0x141905={};var _0x1add48={'count':0x0,'rows':[]};return db['Campaign'][_0xe383('0x55')]({'where':{'id':_0x4b6d9b[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d6e09,null))['then'](function(_0x7344f1){if(_0x7344f1){_0x141905['model']=_[_0xe383('0x44')](db[_0xe383('0x59')][_0xe383('0x2b')]);_0x141905[_0xe383('0x2e')]=_[_0xe383('0x44')](_0x4b6d9b[_0xe383('0x2e')]);_0x141905[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x141905[_0xe383('0x2d')],_0x141905['query']);_0x34137e[_0xe383('0x31')]=_[_0xe383('0x30')](_0x141905[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x4b6d9b[_0xe383('0x2e')][_0xe383('0x32')]));_0x34137e[_0xe383('0x31')]=_0x34137e['attributes'][_0xe383('0x33')]?_0x34137e[_0xe383('0x31')]:_0x141905['model'];if(!_0x4b6d9b['query'][_0xe383('0x5a')]('nolimit')){_0x34137e[_0xe383('0x35')]=qs[_0xe383('0x35')](_0x4b6d9b['query']['limit']);_0x34137e[_0xe383('0x1c')]=qs[_0xe383('0x1c')](_0x4b6d9b['query']['offset']);}_0x34137e[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x4b6d9b[_0xe383('0x2e')]['sort']);_0x34137e[_0xe383('0x38')]=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x4b6d9b[_0xe383('0x2e')],_0x141905[_0xe383('0x2f')]));_0x34137e['where'][_0xe383('0x56')]=_0x7344f1['id'];if(_0x4b6d9b[_0xe383('0x2e')][_0xe383('0x3a')]){_0x34137e[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x34137e['where'],{'$or':_[_0xe383('0x29')](_0x34137e[_0xe383('0x31')],function(_0x33daab){var _0x53f5fe={};_0x53f5fe[_0x33daab]={'$like':'%'+_0x4b6d9b[_0xe383('0x2e')]['filter']+'%'};return _0x53f5fe;})});}_0x34137e=_[_0xe383('0x3b')]({},_0x34137e,_0x4b6d9b['options']);return db[_0xe383('0x59')][_0xe383('0x3e')]({'where':_0x34137e['where']})[_0xe383('0x22')](function(_0x31e262){_0x1add48[_0xe383('0x3e')]=_0x31e262;if(_0x4b6d9b[_0xe383('0x2e')]['includeAll']){_0x34137e[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x59')]['findAll'](_0x34137e);})['then'](function(_0x2dde03){_0x1add48[_0xe383('0x42')]=_0x2dde03;return _0x1add48;});}})[_0xe383('0x22')](respondWithFilteredResult(_0x1d6e09,_0x34137e))['catch'](handleError(_0x1d6e09,null));};exports[_0xe383('0x5b')]=function(_0x3659d3,_0x568ca8,_0x865362){var _0x5f345a={'raw':!![],'where':{}};var _0x4eefb4={};var _0x6d3e60={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x3659d3[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x568ca8,null))[_0xe383('0x22')](function(_0x123e7f){if(_0x123e7f){_0x4eefb4[_0xe383('0x2d')]=_[_0xe383('0x44')](db[_0xe383('0x5c')][_0xe383('0x2b')]);_0x4eefb4[_0xe383('0x2e')]=_[_0xe383('0x44')](_0x3659d3[_0xe383('0x2e')]);_0x4eefb4['filters']=_[_0xe383('0x30')](_0x4eefb4[_0xe383('0x2d')],_0x4eefb4[_0xe383('0x2e')]);_0x5f345a[_0xe383('0x31')]=_['intersection'](_0x4eefb4[_0xe383('0x2d')],qs[_0xe383('0x32')](_0x3659d3[_0xe383('0x2e')][_0xe383('0x32')]));_0x5f345a[_0xe383('0x31')]=_0x5f345a[_0xe383('0x31')][_0xe383('0x33')]?_0x5f345a['attributes']:_0x4eefb4[_0xe383('0x2d')];if(!_0x3659d3['query'][_0xe383('0x5a')](_0xe383('0x34'))){_0x5f345a[_0xe383('0x35')]=qs['limit'](_0x3659d3[_0xe383('0x2e')][_0xe383('0x35')]);_0x5f345a[_0xe383('0x1c')]=qs[_0xe383('0x1c')](_0x3659d3[_0xe383('0x2e')]['offset']);}_0x5f345a[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x3659d3[_0xe383('0x2e')][_0xe383('0x37')]);_0x5f345a[_0xe383('0x38')]=qs['filters'](_[_0xe383('0x39')](_0x3659d3[_0xe383('0x2e')],_0x4eefb4[_0xe383('0x2f')]));_0x5f345a[_0xe383('0x38')][_0xe383('0x56')]=_0x123e7f['id'];if(_0x3659d3[_0xe383('0x2e')][_0xe383('0x3a')]){_0x5f345a[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x5f345a[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x5f345a[_0xe383('0x31')],function(_0x4709){var _0x52bc64={};_0x52bc64[_0x4709]={'$like':'%'+_0x3659d3[_0xe383('0x2e')]['filter']+'%'};return _0x52bc64;})});}_0x5f345a=_['merge']({},_0x5f345a,_0x3659d3[_0xe383('0x3d')]);return db['CmHopperFinal'][_0xe383('0x3e')]({'where':_0x5f345a[_0xe383('0x38')]})['then'](function(_0x2c63a2){_0x6d3e60[_0xe383('0x3e')]=_0x2c63a2;if(_0x3659d3['query'][_0xe383('0x3f')]){_0x5f345a[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x5c')][_0xe383('0x41')](_0x5f345a);})[_0xe383('0x22')](function(_0x4666a3){_0x6d3e60[_0xe383('0x42')]=_0x4666a3;return _0x6d3e60;});}})[_0xe383('0x22')](respondWithFilteredResult(_0x568ca8,_0x5f345a))[_0xe383('0x45')](handleError(_0x568ca8,null));};exports[_0xe383('0x5d')]=function(_0x71a684,_0xc7dc7c,_0x24fa52){var _0x405256={'raw':!![],'where':{}};var _0x1d05ad={};var _0xb3c52b={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x71a684['params']['id']}})[_0xe383('0x22')](handleEntityNotFound(_0xc7dc7c,null))[_0xe383('0x22')](function(_0x20e9c7){if(_0x20e9c7){_0x1d05ad[_0xe383('0x2d')]=_[_0xe383('0x44')](db['CmHopperBlack'][_0xe383('0x2b')]);_0x1d05ad['query']=_[_0xe383('0x44')](_0x71a684[_0xe383('0x2e')]);_0x1d05ad[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x1d05ad[_0xe383('0x2d')],_0x1d05ad[_0xe383('0x2e')]);_0x405256[_0xe383('0x31')]=_[_0xe383('0x30')](_0x1d05ad['model'],qs[_0xe383('0x32')](_0x71a684[_0xe383('0x2e')]['fields']));_0x405256[_0xe383('0x31')]=_0x405256[_0xe383('0x31')][_0xe383('0x33')]?_0x405256[_0xe383('0x31')]:_0x1d05ad[_0xe383('0x2d')];if(!_0x71a684[_0xe383('0x2e')][_0xe383('0x5a')](_0xe383('0x34'))){_0x405256['limit']=qs[_0xe383('0x35')](_0x71a684['query']['limit']);_0x405256['offset']=qs[_0xe383('0x1c')](_0x71a684[_0xe383('0x2e')][_0xe383('0x1c')]);}_0x405256['order']=qs[_0xe383('0x37')](_0x71a684['query'][_0xe383('0x37')]);_0x405256[_0xe383('0x38')]=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x71a684[_0xe383('0x2e')],_0x1d05ad[_0xe383('0x2f')]));_0x405256[_0xe383('0x38')][_0xe383('0x56')]=_0x20e9c7['id'];if(_0x71a684[_0xe383('0x2e')][_0xe383('0x3a')]){_0x405256[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x405256[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x405256[_0xe383('0x31')],function(_0x3c01c9){var _0x351022={};_0x351022[_0x3c01c9]={'$like':'%'+_0x71a684[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x351022;})});}_0x405256=_['merge']({},_0x405256,_0x71a684[_0xe383('0x3d')]);return db[_0xe383('0x5e')]['count']({'where':_0x405256[_0xe383('0x38')]})['then'](function(_0x405c92){_0xb3c52b[_0xe383('0x3e')]=_0x405c92;if(_0x71a684[_0xe383('0x2e')][_0xe383('0x3f')]){_0x405256['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xe383('0x41')](_0x405256);})[_0xe383('0x22')](function(_0x278da3){_0xb3c52b[_0xe383('0x42')]=_0x278da3;return _0xb3c52b;});}})[_0xe383('0x22')](respondWithFilteredResult(_0xc7dc7c,_0x405256))[_0xe383('0x45')](handleError(_0xc7dc7c,null));};exports['getLists']=function(_0x83b69f,_0x148260,_0xabb240){var _0x21f908={};var _0x3fc54b={};var _0x42e66d;var _0x16af9c;return db[_0xe383('0x2a')]['findOne']({'where':{'id':_0x83b69f[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x148260,null))[_0xe383('0x22')](function(_0xbe97c1){if(_0xbe97c1){_0x42e66d=_0xbe97c1;_0x3fc54b[_0xe383('0x2d')]=_['keys'](db['CmList']['rawAttributes']);_0x3fc54b['query']=_[_0xe383('0x44')](_0x83b69f[_0xe383('0x2e')]);_0x3fc54b[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x3fc54b[_0xe383('0x2d')],_0x3fc54b['query']);_0x21f908['attributes']=_[_0xe383('0x30')](_0x3fc54b[_0xe383('0x2d')],qs['fields'](_0x83b69f[_0xe383('0x2e')][_0xe383('0x32')]));_0x21f908['attributes']=_0x21f908['attributes']['length']?_0x21f908[_0xe383('0x31')]:_0x3fc54b[_0xe383('0x2d')];_0x21f908[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x83b69f[_0xe383('0x2e')][_0xe383('0x37')]);_0x21f908['where']=qs[_0xe383('0x2f')](_[_0xe383('0x39')](_0x83b69f['query'],_0x3fc54b[_0xe383('0x2f')]));if(_0x83b69f[_0xe383('0x2e')][_0xe383('0x3a')]){_0x21f908[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x21f908['where'],{'$or':_['map'](_0x21f908[_0xe383('0x31')],function(_0x2ba50f){var _0x37341b={};_0x37341b[_0x2ba50f]={'$like':'%'+_0x83b69f[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x37341b;})});}_0x21f908=_[_0xe383('0x3b')]({},_0x21f908,_0x83b69f[_0xe383('0x3d')]);return _0x42e66d['getLists'](_0x21f908);}})[_0xe383('0x22')](function(_0x43b340){if(_0x43b340){_0x16af9c=_0x43b340['length'];if(!_0x83b69f['query'][_0xe383('0x5a')](_0xe383('0x34'))){_0x21f908[_0xe383('0x35')]=qs[_0xe383('0x35')](_0x83b69f[_0xe383('0x2e')]['limit']);_0x21f908['offset']=qs[_0xe383('0x1c')](_0x83b69f['query']['offset']);}return _0x42e66d[_0xe383('0x5f')](_0x21f908);}})[_0xe383('0x22')](function(_0x503ef1){if(_0x503ef1){return _0x503ef1?{'count':_0x16af9c,'rows':_0x503ef1}:null;}})[_0xe383('0x22')](respondWithResult(_0x148260,null))[_0xe383('0x45')](handleError(_0x148260,null));};exports[_0xe383('0x60')]=function(_0xffdbc,_0x4d7828,_0x454ec3){var _0x412d93,_0x5745dd;return db[_0xe383('0x2a')][_0xe383('0x4c')]({'where':{'id':_0xffdbc[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x4d7828,null))[_0xe383('0x22')](function(_0x415665){if(_0x415665){_0x5745dd=_0x415665;return _0x415665[_0xe383('0x60')](_0xffdbc[_0xe383('0x53')]['ids'],_[_0xe383('0x50')](_0xffdbc[_0xe383('0x53')],[_0xe383('0x61'),'id'])||{});}return null;})[_0xe383('0x62')](function(_0xbd07dc){var _0x297651;_0x412d93=_0xbd07dc||[];var _0x401466=[];if(_0xbd07dc){for(var _0x4e5125=0x0;_0x4e5125<_0xbd07dc['length'];_0x4e5125+=0x1){var _0x32ef12=_0xbd07dc[_0x4e5125][_0xe383('0x48')]({'plain':!![]});_0x5745dd[_0xe383('0x63')]=_0xffdbc[_0xe383('0x53')][_0xe383('0x63')]?_0xffdbc[_0xe383('0x53')][_0xe383('0x63')]:_0x5745dd[_0xe383('0x63')];switch(_0x5745dd[_0xe383('0x63')]){case _0xe383('0x64'):_0x297651=squel[_0xe383('0x65')]()['into'](_0xe383('0x66'))[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x69'),'ContactId','ListId',_0xe383('0x56'),'createdAt','updatedAt'],squel[_0xe383('0x6a')]()[_0xe383('0x6b')](_0xe383('0x68'),'phone')['field']('NOW()','scheduledAt')[_0xe383('0x6b')]('id',_0xe383('0x6c'))[_0xe383('0x6b')](_0x32ef12['CmListId']['toString'](),_0xe383('0x6d'))[_0xe383('0x6b')](_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')](),_0xe383('0x56'))['field']('NOW()',_0xe383('0x51'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x52'))['from'](_0xe383('0x70'))[_0xe383('0x38')]('deletedAt\x20IS\x20NULL')[_0xe383('0x38')](_0xe383('0x71'),_0x32ef12[_0xe383('0x72')]['toString']())[_0xe383('0x38')](_0xe383('0x73'))[_0xe383('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe383('0x6a')]()[_0xe383('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0xe383('0x74')](_0xe383('0x75'))[_0xe383('0x38')](_0xe383('0x76'),_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')]()))[_0xe383('0x38')](_0xe383('0x77'),squel[_0xe383('0x6a')]()[_0xe383('0x6b')](_0xe383('0x78'))[_0xe383('0x74')]('cm_hopper')[_0xe383('0x38')](_0xe383('0x76'),_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')]())))[_0xe383('0x6e')]();break;case _0xe383('0x79'):_0x297651=squel[_0xe383('0x65')]()['into'](_0xe383('0x66'))[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x69'),_0xe383('0x6c'),_0xe383('0x6d'),_0xe383('0x56'),_0xe383('0x51'),_0xe383('0x52')],squel[_0xe383('0x6a')]()[_0xe383('0x6b')]('phone','phone')[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x69'))['field']('id',_0xe383('0x6c'))['field'](_0x32ef12[_0xe383('0x72')]['toString'](),_0xe383('0x6d'))[_0xe383('0x6b')](_0xffdbc['params']['id'][_0xe383('0x6e')](),'CampaignId')[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x51'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x52'))[_0xe383('0x74')]('cm_contacts')['where'](_0xe383('0x7a'))['where']('ListId\x20=\x20?',_0x32ef12['CmListId'][_0xe383('0x6e')]())[_0xe383('0x38')](_0xe383('0x73'))[_0xe383('0x38')](_0xe383('0x77'),squel['select']()['field'](_0xe383('0x78'))[_0xe383('0x74')](_0xe383('0x66'))[_0xe383('0x38')](_0xe383('0x76'),_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')]())))['toString']();break;default:_0x297651=squel['insert']()[_0xe383('0x7b')]('cm_hopper')[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x69'),_0xe383('0x6c'),_0xe383('0x6d'),_0xe383('0x56'),_0xe383('0x51'),_0xe383('0x52')],squel['select']()[_0xe383('0x6b')](_0xe383('0x68'),_0xe383('0x68'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x69'))[_0xe383('0x6b')]('id',_0xe383('0x6c'))['field'](_0x32ef12[_0xe383('0x72')]['toString'](),_0xe383('0x6d'))[_0xe383('0x6b')](_0xffdbc[_0xe383('0x43')]['id'][_0xe383('0x6e')](),_0xe383('0x56'))[_0xe383('0x6b')]('NOW()',_0xe383('0x51'))['field'](_0xe383('0x6f'),_0xe383('0x52'))[_0xe383('0x74')](_0xe383('0x70'))[_0xe383('0x38')](_0xe383('0x7a'))['where'](_0xe383('0x71'),_0x32ef12[_0xe383('0x72')]['toString']())[_0xe383('0x38')](_0xe383('0x73')))[_0xe383('0x6e')]();}_0x401466['push'](db[_0xe383('0x7c')][_0xe383('0x2e')](_0x297651));}return BPromise['all'](_0x401466);}})[_0xe383('0x22')](function(){return _0x412d93;})[_0xe383('0x22')](respondWithResult(_0x4d7828,null))[_0xe383('0x45')](handleError(_0x4d7828,null));};exports[_0xe383('0x7d')]=function(_0x54202c,_0x2e66f6,_0x34886c){return db[_0xe383('0x2a')][_0xe383('0x4c')]({'where':{'id':_0x54202c[_0xe383('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e66f6,null))[_0xe383('0x22')](function(_0x385843){if(_0x385843){return _0x385843[_0xe383('0x7d')](_0x54202c['query'][_0xe383('0x61')]);}})['then'](function(_0xb2f798){if(_0xb2f798){return db[_0xe383('0x57')][_0xe383('0x23')]({'where':{'ListId':_0x54202c[_0xe383('0x2e')]['ids'],'CampaignId':_0x54202c['params']['id']}})['then'](function(){return _0xb2f798;});}})[_0xe383('0x22')](respondWithStatusCode(_0x2e66f6,null))[_0xe383('0x45')](handleError(_0x2e66f6,null));};exports['getBlackLists']=function(_0x1d9099,_0x5ca485,_0x23db1b){var _0x1723f0={'raw':!![],'where':{}};var _0x3e0cfb={};var _0xdab81b={'count':0x0,'rows':[]};return db[_0xe383('0x2a')][_0xe383('0x55')]({'where':{'id':_0x1d9099[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x5ca485,null))['then'](function(_0x4a382d){if(_0x4a382d){_0x3e0cfb[_0xe383('0x2d')]=_[_0xe383('0x44')](db[_0xe383('0x7e')][_0xe383('0x2b')]);_0x3e0cfb['query']=_[_0xe383('0x44')](_0x1d9099[_0xe383('0x2e')]);_0x3e0cfb[_0xe383('0x2f')]=_[_0xe383('0x30')](_0x3e0cfb['model'],_0x3e0cfb[_0xe383('0x2e')]);_0x1723f0[_0xe383('0x31')]=_[_0xe383('0x30')](_0x3e0cfb[_0xe383('0x2d')],qs['fields'](_0x1d9099['query'][_0xe383('0x32')]));_0x1723f0[_0xe383('0x31')]=_0x1723f0['attributes']['length']?_0x1723f0[_0xe383('0x31')]:_0x3e0cfb['model'];if(!_0x1d9099['query'][_0xe383('0x5a')](_0xe383('0x34'))){_0x1723f0[_0xe383('0x35')]=qs[_0xe383('0x35')](_0x1d9099[_0xe383('0x2e')][_0xe383('0x35')]);_0x1723f0['offset']=qs[_0xe383('0x1c')](_0x1d9099[_0xe383('0x2e')][_0xe383('0x1c')]);}_0x1723f0[_0xe383('0x36')]=qs[_0xe383('0x37')](_0x1d9099[_0xe383('0x2e')][_0xe383('0x37')]);_0x1723f0[_0xe383('0x38')]=qs[_0xe383('0x2f')](_['pick'](_0x1d9099[_0xe383('0x2e')],_0x3e0cfb['filters']));_0x1723f0['where'][_0xe383('0x56')]=_0x4a382d['id'];if(_0x1d9099[_0xe383('0x2e')][_0xe383('0x3a')]){_0x1723f0[_0xe383('0x38')]=_[_0xe383('0x3b')](_0x1723f0[_0xe383('0x38')],{'$or':_[_0xe383('0x29')](_0x1723f0['attributes'],function(_0x287df8){var _0x4c0f71={};_0x4c0f71[_0x287df8]={'$like':'%'+_0x1d9099[_0xe383('0x2e')][_0xe383('0x3a')]+'%'};return _0x4c0f71;})});}_0x1723f0=_['merge']({},_0x1723f0,_0x1d9099['options']);return db[_0xe383('0x7e')][_0xe383('0x3e')]({'where':_0x1723f0[_0xe383('0x38')]})[_0xe383('0x22')](function(_0x387d09){_0xdab81b['count']=_0x387d09;if(_0x1d9099['query'][_0xe383('0x3f')]){_0x1723f0[_0xe383('0x40')]=[{'all':!![]}];}return db[_0xe383('0x7e')]['findAll'](_0x1723f0);})[_0xe383('0x22')](function(_0x358a29){_0xdab81b[_0xe383('0x42')]=_0x358a29;return _0xdab81b;});}})['then'](respondWithFilteredResult(_0x5ca485,_0x1723f0))[_0xe383('0x45')](handleError(_0x5ca485,null));};exports[_0xe383('0x7f')]=function(_0xf5df04,_0x47ac8d,_0x30746d){var _0x423aee,_0x4b1e90;return db[_0xe383('0x2a')]['find']({'where':{'id':_0xf5df04[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x47ac8d,null))['then'](function(_0x424ac7){if(_0x424ac7){_0x4b1e90=_0x424ac7;return _0x424ac7[_0xe383('0x7f')](_0xf5df04[_0xe383('0x53')][_0xe383('0x61')],_[_0xe383('0x50')](_0xf5df04['body'],[_0xe383('0x61'),'id'])||{});}return null;})[_0xe383('0x62')](function(_0x3e1fb4){var _0x402c40;_0x423aee=_0x3e1fb4||[];var _0x521d96=[];if(_0x3e1fb4){for(var _0x17107c=0x0;_0x17107c<_0x3e1fb4['length'];_0x17107c+=0x1){var _0x640daa=_0x3e1fb4[_0x17107c]['get']({'plain':!![]});_0x402c40=squel['insert']()[_0xe383('0x7b')](_0xe383('0x80'))[_0xe383('0x67')]([_0xe383('0x68'),_0xe383('0x6c'),'ListId',_0xe383('0x56'),_0xe383('0x51'),_0xe383('0x52')],squel[_0xe383('0x6a')]()['field'](_0xe383('0x68'),_0xe383('0x68'))['field']('id',_0xe383('0x6c'))[_0xe383('0x6b')](_0x640daa[_0xe383('0x72')][_0xe383('0x6e')](),'ListId')[_0xe383('0x6b')](_0xf5df04['params']['id'][_0xe383('0x6e')](),_0xe383('0x56'))[_0xe383('0x6b')](_0xe383('0x6f'),_0xe383('0x51'))[_0xe383('0x6b')]('NOW()',_0xe383('0x52'))[_0xe383('0x74')](_0xe383('0x70'))[_0xe383('0x38')](_0xe383('0x7a'))[_0xe383('0x38')](_0xe383('0x71'),_0x640daa[_0xe383('0x72')][_0xe383('0x6e')]())[_0xe383('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0xe383('0x6e')]();_0x521d96['push'](db[_0xe383('0x7c')][_0xe383('0x2e')](_0x402c40));}return BPromise[_0xe383('0x81')](_0x521d96);}})[_0xe383('0x22')](function(){return _0x423aee;})[_0xe383('0x22')](respondWithResult(_0x47ac8d,null))[_0xe383('0x45')](handleError(_0x47ac8d,null));};exports[_0xe383('0x82')]=function(_0x2ccff6,_0x30febe,_0x28d667){return db['Campaign'][_0xe383('0x4c')]({'where':{'id':_0x2ccff6[_0xe383('0x43')]['id']}})[_0xe383('0x22')](handleEntityNotFound(_0x30febe,null))[_0xe383('0x22')](function(_0x298203){if(_0x298203){return _0x298203[_0xe383('0x82')](_0x2ccff6[_0xe383('0x2e')][_0xe383('0x61')]);}})[_0xe383('0x22')](function(_0x3e1f52){if(_0x3e1f52){return db[_0xe383('0x5e')][_0xe383('0x23')]({'where':{'ListId':_0x2ccff6[_0xe383('0x2e')][_0xe383('0x61')],'CampaignId':_0x2ccff6[_0xe383('0x43')]['id']}})[_0xe383('0x22')](function(){return _0x3e1f52;});}})[_0xe383('0x22')](respondWithStatusCode(_0x30febe,null))[_0xe383('0x45')](handleError(_0x30febe,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d6abdb0..fcb9e12 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xb10b,0x12a));var _0xbb10=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0xb10b[_0x52b844];return _0x14432f;};'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')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'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(_0x205423,_0x37236d){var _0x2612eb=function(_0x456426){while(--_0x456426){_0x205423['push'](_0x205423['shift']());}};_0x2612eb(++_0x37236d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d313c45..67e9036 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(_0x1d408d,_0x2fef27){var _0x112a98=function(_0x5615a8){while(--_0x5615a8){_0x1d408d['push'](_0x1d408d['shift']());}};_0x112a98(++_0x2fef27);}(_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 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(_0x5b1a13,_0x2b4c39){var _0x5ca732=function(_0x388a35){while(--_0x388a35){_0x5b1a13['push'](_0x5b1a13['shift']());}};_0x5ca732(++_0x2b4c39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a0f0907..6363332 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 _0xc037=['getHoppers','/:id/hopper_histories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','post','create','clone','addLists','update','destroy','delete','removeLists','/:id/blacklists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers'];(function(_0x322652,_0x5a85c0){var _0x5d5e88=function(_0x5ce853){while(--_0x5ce853){_0x322652['push'](_0x322652['shift']());}};_0x5d5e88(++_0x5a85c0);}(_0xc037,0x88));var _0x7c03=function(_0x51b057,_0x1a509c){_0x51b057=_0x51b057-0x0;var _0x55716c=_0xc037[_0x51b057];return _0x55716c;};'use strict';var multer=require('multer');var util=require(_0x7c03('0x0'));var path=require(_0x7c03('0x1'));var timeout=require(_0x7c03('0x2'));var express=require(_0x7c03('0x3'));var router=express[_0x7c03('0x4')]();var auth=require(_0x7c03('0x5'));var interaction=require(_0x7c03('0x6'));var config=require(_0x7c03('0x7'));var controller=require(_0x7c03('0x8'));router[_0x7c03('0x9')]('/',auth[_0x7c03('0xa')](),controller['index']);router[_0x7c03('0x9')](_0x7c03('0xb'),auth[_0x7c03('0xa')](),controller[_0x7c03('0xc')]);router[_0x7c03('0x9')](_0x7c03('0xd'),auth[_0x7c03('0xa')](),controller[_0x7c03('0xe')]);router['get'](_0x7c03('0xf'),auth[_0x7c03('0xa')](),controller['getHopperHistories']);router[_0x7c03('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x7c03('0x10')]);router[_0x7c03('0x9')]('/:id/hopper_black',auth[_0x7c03('0xa')](),controller[_0x7c03('0x11')]);router[_0x7c03('0x9')](_0x7c03('0x12'),auth['isAuthenticated'](),controller[_0x7c03('0x13')]);router[_0x7c03('0x9')]('/:id/blacklists',auth[_0x7c03('0xa')](),controller['getBlackLists']);router[_0x7c03('0x14')]('/',auth['isAuthenticated'](),controller[_0x7c03('0x15')]);router[_0x7c03('0x14')]('/:id/clone',auth[_0x7c03('0xa')](),controller[_0x7c03('0x16')]);router[_0x7c03('0x14')]('/:id/lists',auth[_0x7c03('0xa')](),controller[_0x7c03('0x17')]);router[_0x7c03('0x14')]('/:id/blacklists',auth[_0x7c03('0xa')](),controller['addBlackLists']);router['put']('/:id',auth[_0x7c03('0xa')](),controller[_0x7c03('0x18')]);router['delete'](_0x7c03('0xb'),auth[_0x7c03('0xa')](),controller[_0x7c03('0x19')]);router[_0x7c03('0x1a')]('/:id/lists',auth[_0x7c03('0xa')](),controller[_0x7c03('0x1b')]);router[_0x7c03('0x1a')](_0x7c03('0x1c'),auth[_0x7c03('0xa')](),controller[_0x7c03('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x43c0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists'];(function(_0x504f5d,_0x5f50e2){var _0x4b76a1=function(_0x2c9263){while(--_0x2c9263){_0x504f5d['push'](_0x504f5d['shift']());}};_0x4b76a1(++_0x5f50e2);}(_0x43c0,0x13b));var _0x043c=function(_0x5dc56d,_0x3ca8f0){_0x5dc56d=_0x5dc56d-0x0;var _0x144f0a=_0x43c0[_0x5dc56d];return _0x144f0a;};'use strict';var multer=require(_0x043c('0x0'));var util=require(_0x043c('0x1'));var path=require(_0x043c('0x2'));var timeout=require(_0x043c('0x3'));var express=require(_0x043c('0x4'));var router=express[_0x043c('0x5')]();var auth=require(_0x043c('0x6'));var interaction=require(_0x043c('0x7'));var config=require(_0x043c('0x8'));var controller=require('./campaign.controller');router[_0x043c('0x9')]('/',auth[_0x043c('0xa')](),controller[_0x043c('0xb')]);router[_0x043c('0x9')](_0x043c('0xc'),auth['isAuthenticated'](),controller[_0x043c('0xd')]);router[_0x043c('0x9')](_0x043c('0xe'),auth[_0x043c('0xa')](),controller['getHoppers']);router['get'](_0x043c('0xf'),auth[_0x043c('0xa')](),controller[_0x043c('0x10')]);router[_0x043c('0x9')](_0x043c('0x11'),auth[_0x043c('0xa')](),controller[_0x043c('0x12')]);router[_0x043c('0x9')](_0x043c('0x13'),auth[_0x043c('0xa')](),controller['getHopperBlacks']);router[_0x043c('0x9')](_0x043c('0x14'),auth[_0x043c('0xa')](),controller[_0x043c('0x15')]);router[_0x043c('0x9')]('/:id/blacklists',auth[_0x043c('0xa')](),controller[_0x043c('0x16')]);router[_0x043c('0x17')]('/',auth[_0x043c('0xa')](),controller[_0x043c('0x18')]);router[_0x043c('0x17')](_0x043c('0x19'),auth[_0x043c('0xa')](),controller[_0x043c('0x1a')]);router['post'](_0x043c('0x14'),auth[_0x043c('0xa')](),controller[_0x043c('0x1b')]);router[_0x043c('0x17')](_0x043c('0x1c'),auth[_0x043c('0xa')](),controller[_0x043c('0x1d')]);router[_0x043c('0x1e')](_0x043c('0xc'),auth[_0x043c('0xa')](),controller['update']);router[_0x043c('0x1f')](_0x043c('0xc'),auth[_0x043c('0xa')](),controller[_0x043c('0x20')]);router[_0x043c('0x1f')]('/:id/lists',auth[_0x043c('0xa')](),controller[_0x043c('0x21')]);router[_0x043c('0x1f')](_0x043c('0x1c'),auth['isAuthenticated'](),controller[_0x043c('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4d16dd3..84c0cda 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 _0xd080=['VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd080,0x198));var _0x0d08=function(_0x21ab24,_0x5849aa){_0x21ab24=_0x21ab24-0x0;var _0x41f411=_0xd080[_0x21ab24];return _0x41f411;};'use strict';var Sequelize=require(_0x0d08('0x0'));module['exports']={'key':{'type':Sequelize[_0x0d08('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x0d08('0x1')]},'name':{'type':Sequelize[_0x0d08('0x2')],'get':function(){return this[_0x0d08('0x3')](_0x0d08('0x4'));}}}; \ No newline at end of file +var _0xc689=['getDataValue','sequelize','exports','STRING','VIRTUAL'];(function(_0x2c1280,_0x3e01f9){var _0x1fae85=function(_0x3e3b5a){while(--_0x3e3b5a){_0x2c1280['push'](_0x2c1280['shift']());}};_0x1fae85(++_0x3e01f9);}(_0xc689,0x1b4));var _0x9c68=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xc689[_0x22ffbf];return _0x360c17;};'use strict';var Sequelize=require(_0x9c68('0x0'));module[_0x9c68('0x1')]={'key':{'type':Sequelize[_0x9c68('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x9c68('0x2')]},'name':{'type':Sequelize[_0x9c68('0x3')],'get':function(){return this[_0x9c68('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ce76a0a..96f87c2 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 _0x9837=['limit','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','name','map','CannedAnswer','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','options','find','catch','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','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','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','json','count','offset'];(function(_0x5c049a,_0x2c1263){var _0x168e70=function(_0x49441e){while(--_0x49441e){_0x5c049a['push'](_0x5c049a['shift']());}};_0x168e70(++_0x2c1263);}(_0x9837,0x1d6));var _0x7983=function(_0x175b8,_0x176eb6){_0x175b8=_0x175b8-0x0;var _0x41034d=_0x9837[_0x175b8];return _0x41034d;};'use strict';var pdf=require(_0x7983('0x0'));var emlformat=require(_0x7983('0x1'));var rimraf=require(_0x7983('0x2'));var zipdir=require(_0x7983('0x3'));var jsonpatch=require(_0x7983('0x4'));var rp=require('request-promise');var moment=require(_0x7983('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7983('0x6'));var util=require(_0x7983('0x7'));var path=require(_0x7983('0x8'));var sox=require(_0x7983('0x9'));var csv=require(_0x7983('0xa'));var ejs=require(_0x7983('0xb'));var fs=require('fs');var _=require(_0x7983('0xc'));var squel=require(_0x7983('0xd'));var crypto=require(_0x7983('0xe'));var jsforce=require(_0x7983('0xf'));var deskjs=require(_0x7983('0x10'));var toCsv=require(_0x7983('0xa'));var querystring=require('querystring');var Papa=require(_0x7983('0x11'));var Redis=require('ioredis');var authService=require(_0x7983('0x12'));var qs=require(_0x7983('0x13'));var as=require(_0x7983('0x14'));var hardwareService=require(_0x7983('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7983('0x16'));var db=require(_0x7983('0x17'))['db'];function respondWithStatusCode(_0x33b931,_0xbf1eee){_0xbf1eee=_0xbf1eee||0xcc;return function(_0x43eea7){if(_0x43eea7){return _0x33b931['sendStatus'](_0xbf1eee);}return _0x33b931[_0x7983('0x18')](_0xbf1eee)['end']();};}function respondWithResult(_0x361036,_0x387466){_0x387466=_0x387466||0xc8;return function(_0x578fe6){if(_0x578fe6){return _0x361036[_0x7983('0x18')](_0x387466)[_0x7983('0x19')](_0x578fe6);}};}function respondWithFilteredResult(_0x3b9420,_0x3b03fc){return function(_0x3a1a02){if(_0x3a1a02){var _0xfb5a5c=_0x3a1a02[_0x7983('0x1a')],_0x340dc5=_0x3b03fc[_0x7983('0x1b')],_0x2ced70=_0x3b03fc['offset']+_0x3b03fc[_0x7983('0x1c')],_0x259f1e;if(_0x2ced70>=_0xfb5a5c){_0x2ced70=_0xfb5a5c;_0x259f1e=0xc8;}else{_0x259f1e=0xce;}_0x3b9420['status'](_0x259f1e);return _0x3b9420['set'](_0x7983('0x1d'),_0x340dc5+'-'+_0x2ced70+'/'+_0xfb5a5c)[_0x7983('0x19')](_0x3a1a02);}return null;};}function patchUpdates(_0x51956f){return function(_0x148b27){try{jsonpatch[_0x7983('0x1e')](_0x148b27,_0x51956f,!![]);}catch(_0x5d1191){return BPromise[_0x7983('0x1f')](_0x5d1191);}return _0x148b27[_0x7983('0x20')]();};}function saveUpdates(_0x671bd4,_0x8cf311){return function(_0x41a4c8){if(_0x41a4c8){return _0x41a4c8[_0x7983('0x21')](_0x671bd4)[_0x7983('0x22')](function(_0x497fe9){return _0x497fe9;});}return null;};}function removeEntity(_0x2cced0,_0xf42047){return function(_0x5b4e9e){if(_0x5b4e9e){return _0x5b4e9e[_0x7983('0x23')]()['then'](function(){var _0x444a48=_0x5b4e9e['get']({'plain':!![]});var _0xc50734='CannedAnswers';return db[_0x7983('0x24')]['destroy']({'where':{'type':_0xc50734,'resourceId':_0x444a48['id']}})[_0x7983('0x22')](function(){return _0x5b4e9e;});})[_0x7983('0x22')](function(){_0x2cced0[_0x7983('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f87a5,_0x299e80){return function(_0x493cb4){if(!_0x493cb4){_0x4f87a5[_0x7983('0x25')](0x194);}return _0x493cb4;};}function handleError(_0x9c4b29,_0x2f0456){_0x2f0456=_0x2f0456||0x1f4;return function(_0x39e528){logger[_0x7983('0x26')](_0x39e528['stack']);if(_0x39e528[_0x7983('0x27')]){delete _0x39e528[_0x7983('0x27')];}_0x9c4b29['status'](_0x2f0456)['send'](_0x39e528);};}exports['index']=function(_0x56f31c,_0x2ce1a7){var _0x266504={},_0x534521={},_0x236c39={'count':0x0,'rows':[]};var _0x49a87c=_[_0x7983('0x28')](db[_0x7983('0x29')][_0x7983('0x2a')],function(_0x53acf3){return{'name':_0x53acf3['fieldName'],'type':_0x53acf3[_0x7983('0x2b')][_0x7983('0x2c')]};});_0x534521['model']=_[_0x7983('0x28')](_0x49a87c,_0x7983('0x27'));_0x534521[_0x7983('0x2d')]=_[_0x7983('0x2e')](_0x56f31c[_0x7983('0x2d')]);_0x534521['filters']=_[_0x7983('0x2f')](_0x534521[_0x7983('0x30')],_0x534521[_0x7983('0x2d')]);_0x266504[_0x7983('0x31')]=_[_0x7983('0x2f')](_0x534521['model'],qs[_0x7983('0x32')](_0x56f31c[_0x7983('0x2d')][_0x7983('0x32')]));_0x266504[_0x7983('0x31')]=_0x266504['attributes'][_0x7983('0x33')]?_0x266504[_0x7983('0x31')]:_0x534521[_0x7983('0x30')];if(!_0x56f31c[_0x7983('0x2d')]['hasOwnProperty'](_0x7983('0x34'))){_0x266504[_0x7983('0x1c')]=qs[_0x7983('0x1c')](_0x56f31c['query'][_0x7983('0x1c')]);_0x266504[_0x7983('0x1b')]=qs['offset'](_0x56f31c[_0x7983('0x2d')][_0x7983('0x1b')]);}_0x266504[_0x7983('0x35')]=qs['sort'](_0x56f31c[_0x7983('0x2d')][_0x7983('0x36')]);_0x266504[_0x7983('0x37')]=qs['filters'](_[_0x7983('0x38')](_0x56f31c[_0x7983('0x2d')],_0x534521['filters']),_0x49a87c);if(_0x56f31c[_0x7983('0x2d')][_0x7983('0x39')]){_0x266504[_0x7983('0x37')]=_[_0x7983('0x3a')](_0x266504[_0x7983('0x37')],{'$or':_[_0x7983('0x28')](_0x49a87c,function(_0x14484b){if(_0x14484b[_0x7983('0x2b')]!==_0x7983('0x3b')){var _0x1106a4={};_0x1106a4[_0x14484b[_0x7983('0x27')]]={'$like':'%'+_0x56f31c[_0x7983('0x2d')][_0x7983('0x39')]+'%'};return _0x1106a4;}})});}_0x266504=_[_0x7983('0x3a')]({},_0x266504,_0x56f31c['options']);var _0x76bb2f={'where':_0x266504[_0x7983('0x37')]};return db['CannedAnswer']['count'](_0x76bb2f)['then'](function(_0x396773){_0x236c39[_0x7983('0x1a')]=_0x396773;if(_0x56f31c[_0x7983('0x2d')][_0x7983('0x3c')]){_0x266504['include']=[{'all':!![]}];}return db[_0x7983('0x29')]['findAll'](_0x266504);})[_0x7983('0x22')](function(_0x56ece3){_0x236c39[_0x7983('0x3d')]=_0x56ece3;return _0x236c39;})[_0x7983('0x22')](respondWithFilteredResult(_0x2ce1a7,_0x266504))['catch'](handleError(_0x2ce1a7,null));};exports[_0x7983('0x3e')]=function(_0x19f2a0,_0x1ea0b1){var _0x51f854={'raw':!![],'where':{'id':_0x19f2a0['params']['id']}},_0x183bc1={};_0x183bc1[_0x7983('0x30')]=_[_0x7983('0x2e')](db[_0x7983('0x29')][_0x7983('0x2a')]);_0x183bc1['query']=_['keys'](_0x19f2a0[_0x7983('0x2d')]);_0x183bc1['filters']=_[_0x7983('0x2f')](_0x183bc1[_0x7983('0x30')],_0x183bc1[_0x7983('0x2d')]);_0x51f854[_0x7983('0x31')]=_[_0x7983('0x2f')](_0x183bc1['model'],qs[_0x7983('0x32')](_0x19f2a0[_0x7983('0x2d')][_0x7983('0x32')]));_0x51f854[_0x7983('0x31')]=_0x51f854['attributes']['length']?_0x51f854[_0x7983('0x31')]:_0x183bc1['model'];if(_0x19f2a0[_0x7983('0x2d')][_0x7983('0x3c')]){_0x51f854['include']=[{'all':!![]}];}_0x51f854=_[_0x7983('0x3a')]({},_0x51f854,_0x19f2a0[_0x7983('0x3f')]);return db['CannedAnswer'][_0x7983('0x40')](_0x51f854)[_0x7983('0x22')](handleEntityNotFound(_0x1ea0b1,null))[_0x7983('0x22')](respondWithResult(_0x1ea0b1,null))[_0x7983('0x41')](handleError(_0x1ea0b1,null));};exports[_0x7983('0x21')]=function(_0x3db01c,_0x1f66f1){if(_0x3db01c[_0x7983('0x42')]['id']){delete _0x3db01c[_0x7983('0x42')]['id'];}return db[_0x7983('0x29')]['find']({'where':{'id':_0x3db01c['params']['id']}})[_0x7983('0x22')](handleEntityNotFound(_0x1f66f1,null))[_0x7983('0x22')](saveUpdates(_0x3db01c[_0x7983('0x42')],null))[_0x7983('0x22')](respondWithResult(_0x1f66f1,null))['catch'](handleError(_0x1f66f1,null));};exports[_0x7983('0x23')]=function(_0x5c4214,_0x28ccc3){return db[_0x7983('0x29')]['find']({'where':{'id':_0x5c4214[_0x7983('0x43')]['id']}})[_0x7983('0x22')](handleEntityNotFound(_0x28ccc3,null))[_0x7983('0x22')](removeEntity(_0x28ccc3,null))['catch'](handleError(_0x28ccc3,null));};exports[_0x7983('0x44')]=function(_0x25e602,_0x107492){var _0x476174={'key':_0x25e602['body'][_0x7983('0x2c')]};if(_0x25e602['body'][_0x7983('0x45')]){_0x476174[_0x7983('0x45')]=_0x25e602[_0x7983('0x42')][_0x7983('0x45')];}else if(_0x25e602['body'][_0x7983('0x46')]){_0x476174[_0x7983('0x46')]=_0x25e602[_0x7983('0x42')][_0x7983('0x46')];}else if(_0x25e602['body'][_0x7983('0x47')]){_0x476174[_0x7983('0x47')]=_0x25e602[_0x7983('0x42')][_0x7983('0x47')];}else if(_0x25e602[_0x7983('0x42')][_0x7983('0x48')]){_0x476174[_0x7983('0x48')]=_0x25e602[_0x7983('0x42')]['ChatWebsiteId'];}return db[_0x7983('0x29')][_0x7983('0x40')]({'where':_0x476174})[_0x7983('0x22')](function(_0xd3fa1e){if(_0xd3fa1e){throw new db[(_0x7983('0x49'))][(_0x7983('0x4a'))](_0x7983('0x4b'));}return db[_0x7983('0x29')][_0x7983('0x44')](_0x25e602[_0x7983('0x42')]);})['then'](function(_0x57e4b8){var _0xecbf9a=_0x25e602['user'][_0x7983('0x4c')]({'plain':!![]});if(!_0xecbf9a)throw new Error(_0x7983('0x4d'));if(_0xecbf9a[_0x7983('0x4e')]==='user'){var _0x31944c=_0x57e4b8[_0x7983('0x4c')]({'plain':!![]});return db[_0x7983('0x4f')][_0x7983('0x40')]({'where':{'name':'CannedAnswers','userProfileId':_0xecbf9a[_0x7983('0x50')]},'raw':!![]})['then'](function(_0x5e8549){if(_0x5e8549&&_0x5e8549[_0x7983('0x51')]===0x0){return db['UserProfileResource'][_0x7983('0x44')]({'name':_0x31944c[_0x7983('0x27')],'resourceId':_0x31944c['id'],'type':_0x5e8549[_0x7983('0x27')],'sectionId':_0x5e8549['id']},{})['then'](function(){return _0x57e4b8;});}else{return _0x57e4b8;}})['catch'](function(_0xf993b1){logger['error'](_0x7983('0x52'),_0xf993b1);throw _0xf993b1;});}return _0x57e4b8;})[_0x7983('0x22')](respondWithResult(_0x107492,0xc9))[_0x7983('0x41')](handleError(_0x107492,null));}; \ No newline at end of file +var _0xbc8e=['then','get','CannedAnswers','UserProfileResource','destroy','sendStatus','error','name','index','CannedAnswer','rawAttributes','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','count','offset','limit','set','apply','save','update'];(function(_0x306376,_0x2ce4d5){var _0x22a613=function(_0x94379f){while(--_0x94379f){_0x306376['push'](_0x306376['shift']());}};_0x22a613(++_0x2ce4d5);}(_0xbc8e,0xd7));var _0xebc8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbc8e[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0xebc8('0x0'));var emlformat=require(_0xebc8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xebc8('0x2'));var jsonpatch=require(_0xebc8('0x3'));var rp=require(_0xebc8('0x4'));var moment=require(_0xebc8('0x5'));var BPromise=require(_0xebc8('0x6'));var Mustache=require('mustache');var util=require(_0xebc8('0x7'));var path=require(_0xebc8('0x8'));var sox=require('sox');var csv=require(_0xebc8('0x9'));var ejs=require(_0xebc8('0xa'));var fs=require('fs');var _=require(_0xebc8('0xb'));var squel=require('squel');var crypto=require(_0xebc8('0xc'));var jsforce=require(_0xebc8('0xd'));var deskjs=require(_0xebc8('0xe'));var toCsv=require(_0xebc8('0x9'));var querystring=require(_0xebc8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xebc8('0x10'));var qs=require(_0xebc8('0x11'));var as=require(_0xebc8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebc8('0x13'))(_0xebc8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55b734,_0x599dab){_0x599dab=_0x599dab||0xcc;return function(_0x134e80){if(_0x134e80){return _0x55b734['sendStatus'](_0x599dab);}return _0x55b734[_0xebc8('0x15')](_0x599dab)[_0xebc8('0x16')]();};}function respondWithResult(_0x78e094,_0x4fd317){_0x4fd317=_0x4fd317||0xc8;return function(_0x2db7ff){if(_0x2db7ff){return _0x78e094['status'](_0x4fd317)[_0xebc8('0x17')](_0x2db7ff);}};}function respondWithFilteredResult(_0x13549f,_0x3e846a){return function(_0x3393ec){if(_0x3393ec){var _0x355048=_0x3393ec[_0xebc8('0x18')],_0xfebe76=_0x3e846a[_0xebc8('0x19')],_0xb6d547=_0x3e846a[_0xebc8('0x19')]+_0x3e846a[_0xebc8('0x1a')],_0x2e5287;if(_0xb6d547>=_0x355048){_0xb6d547=_0x355048;_0x2e5287=0xc8;}else{_0x2e5287=0xce;}_0x13549f[_0xebc8('0x15')](_0x2e5287);return _0x13549f[_0xebc8('0x1b')]('Content-Range',_0xfebe76+'-'+_0xb6d547+'/'+_0x355048)[_0xebc8('0x17')](_0x3393ec);}return null;};}function patchUpdates(_0xf3643b){return function(_0x172c77){try{jsonpatch[_0xebc8('0x1c')](_0x172c77,_0xf3643b,!![]);}catch(_0x3bfba0){return BPromise['reject'](_0x3bfba0);}return _0x172c77[_0xebc8('0x1d')]();};}function saveUpdates(_0x19bb16,_0x22aede){return function(_0x39379b){if(_0x39379b){return _0x39379b[_0xebc8('0x1e')](_0x19bb16)[_0xebc8('0x1f')](function(_0x366fde){return _0x366fde;});}return null;};}function removeEntity(_0x1984a6,_0x20b581){return function(_0x201933){if(_0x201933){return _0x201933['destroy']()[_0xebc8('0x1f')](function(){var _0xa384b8=_0x201933[_0xebc8('0x20')]({'plain':!![]});var _0x549f09=_0xebc8('0x21');return db[_0xebc8('0x22')][_0xebc8('0x23')]({'where':{'type':_0x549f09,'resourceId':_0xa384b8['id']}})[_0xebc8('0x1f')](function(){return _0x201933;});})[_0xebc8('0x1f')](function(){_0x1984a6['status'](0xcc)[_0xebc8('0x16')]();});}};}function handleEntityNotFound(_0x3e54bd,_0x5731b5){return function(_0x3b16b4){if(!_0x3b16b4){_0x3e54bd[_0xebc8('0x24')](0x194);}return _0x3b16b4;};}function handleError(_0x43b855,_0x4083d1){_0x4083d1=_0x4083d1||0x1f4;return function(_0x4ff6a8){logger[_0xebc8('0x25')](_0x4ff6a8['stack']);if(_0x4ff6a8[_0xebc8('0x26')]){delete _0x4ff6a8[_0xebc8('0x26')];}_0x43b855['status'](_0x4083d1)['send'](_0x4ff6a8);};}exports[_0xebc8('0x27')]=function(_0x269e8e,_0x3ade8d){var _0x4e4e37={},_0x403194={},_0x5e870f={'count':0x0,'rows':[]};var _0x4c9b43=_['map'](db[_0xebc8('0x28')][_0xebc8('0x29')],function(_0x134402){return{'name':_0x134402['fieldName'],'type':_0x134402['type']['key']};});_0x403194[_0xebc8('0x2a')]=_[_0xebc8('0x2b')](_0x4c9b43,_0xebc8('0x26'));_0x403194['query']=_[_0xebc8('0x2c')](_0x269e8e['query']);_0x403194[_0xebc8('0x2d')]=_[_0xebc8('0x2e')](_0x403194['model'],_0x403194[_0xebc8('0x2f')]);_0x4e4e37[_0xebc8('0x30')]=_['intersection'](_0x403194[_0xebc8('0x2a')],qs[_0xebc8('0x31')](_0x269e8e['query']['fields']));_0x4e4e37[_0xebc8('0x30')]=_0x4e4e37[_0xebc8('0x30')][_0xebc8('0x32')]?_0x4e4e37[_0xebc8('0x30')]:_0x403194[_0xebc8('0x2a')];if(!_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x33')]('nolimit')){_0x4e4e37['limit']=qs[_0xebc8('0x1a')](_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x1a')]);_0x4e4e37[_0xebc8('0x19')]=qs[_0xebc8('0x19')](_0x269e8e['query']['offset']);}_0x4e4e37['order']=qs[_0xebc8('0x34')](_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x34')]);_0x4e4e37[_0xebc8('0x35')]=qs[_0xebc8('0x2d')](_[_0xebc8('0x36')](_0x269e8e['query'],_0x403194[_0xebc8('0x2d')]),_0x4c9b43);if(_0x269e8e['query'][_0xebc8('0x37')]){_0x4e4e37[_0xebc8('0x35')]=_[_0xebc8('0x38')](_0x4e4e37[_0xebc8('0x35')],{'$or':_[_0xebc8('0x2b')](_0x4c9b43,function(_0x279839){if(_0x279839[_0xebc8('0x39')]!==_0xebc8('0x3a')){var _0xad4f77={};_0xad4f77[_0x279839['name']]={'$like':'%'+_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x37')]+'%'};return _0xad4f77;}})});}_0x4e4e37=_['merge']({},_0x4e4e37,_0x269e8e[_0xebc8('0x3b')]);var _0x4941d1={'where':_0x4e4e37['where']};return db[_0xebc8('0x28')]['count'](_0x4941d1)[_0xebc8('0x1f')](function(_0x4eb494){_0x5e870f['count']=_0x4eb494;if(_0x269e8e[_0xebc8('0x2f')][_0xebc8('0x3c')]){_0x4e4e37[_0xebc8('0x3d')]=[{'all':!![]}];}return db[_0xebc8('0x28')]['findAll'](_0x4e4e37);})[_0xebc8('0x1f')](function(_0x4d9c37){_0x5e870f[_0xebc8('0x3e')]=_0x4d9c37;return _0x5e870f;})['then'](respondWithFilteredResult(_0x3ade8d,_0x4e4e37))[_0xebc8('0x3f')](handleError(_0x3ade8d,null));};exports[_0xebc8('0x40')]=function(_0x370b8c,_0x284e32){var _0x4b8d7a={'raw':!![],'where':{'id':_0x370b8c[_0xebc8('0x41')]['id']}},_0x5275b7={};_0x5275b7[_0xebc8('0x2a')]=_[_0xebc8('0x2c')](db[_0xebc8('0x28')][_0xebc8('0x29')]);_0x5275b7[_0xebc8('0x2f')]=_['keys'](_0x370b8c[_0xebc8('0x2f')]);_0x5275b7[_0xebc8('0x2d')]=_[_0xebc8('0x2e')](_0x5275b7['model'],_0x5275b7['query']);_0x4b8d7a[_0xebc8('0x30')]=_[_0xebc8('0x2e')](_0x5275b7[_0xebc8('0x2a')],qs[_0xebc8('0x31')](_0x370b8c['query']['fields']));_0x4b8d7a[_0xebc8('0x30')]=_0x4b8d7a[_0xebc8('0x30')][_0xebc8('0x32')]?_0x4b8d7a['attributes']:_0x5275b7['model'];if(_0x370b8c[_0xebc8('0x2f')][_0xebc8('0x3c')]){_0x4b8d7a[_0xebc8('0x3d')]=[{'all':!![]}];}_0x4b8d7a=_[_0xebc8('0x38')]({},_0x4b8d7a,_0x370b8c[_0xebc8('0x3b')]);return db[_0xebc8('0x28')][_0xebc8('0x42')](_0x4b8d7a)[_0xebc8('0x1f')](handleEntityNotFound(_0x284e32,null))[_0xebc8('0x1f')](respondWithResult(_0x284e32,null))['catch'](handleError(_0x284e32,null));};exports[_0xebc8('0x1e')]=function(_0x259715,_0x2f65a0){if(_0x259715[_0xebc8('0x43')]['id']){delete _0x259715['body']['id'];}return db[_0xebc8('0x28')]['find']({'where':{'id':_0x259715['params']['id']}})[_0xebc8('0x1f')](handleEntityNotFound(_0x2f65a0,null))['then'](saveUpdates(_0x259715[_0xebc8('0x43')],null))['then'](respondWithResult(_0x2f65a0,null))['catch'](handleError(_0x2f65a0,null));};exports['destroy']=function(_0x34fe45,_0x2a2e19){return db[_0xebc8('0x28')][_0xebc8('0x42')]({'where':{'id':_0x34fe45[_0xebc8('0x41')]['id']}})[_0xebc8('0x1f')](handleEntityNotFound(_0x2a2e19,null))[_0xebc8('0x1f')](removeEntity(_0x2a2e19,null))['catch'](handleError(_0x2a2e19,null));};exports[_0xebc8('0x44')]=function(_0x1952ae,_0x331650){var _0x5a282a={'key':_0x1952ae[_0xebc8('0x43')][_0xebc8('0x45')]};if(_0x1952ae['body'][_0xebc8('0x46')]){_0x5a282a[_0xebc8('0x46')]=_0x1952ae[_0xebc8('0x43')][_0xebc8('0x46')];}else if(_0x1952ae[_0xebc8('0x43')][_0xebc8('0x47')]){_0x5a282a['SmsAccountId']=_0x1952ae[_0xebc8('0x43')]['SmsAccountId'];}else if(_0x1952ae[_0xebc8('0x43')][_0xebc8('0x48')]){_0x5a282a[_0xebc8('0x48')]=_0x1952ae[_0xebc8('0x43')]['OpenchannelAccountId'];}else if(_0x1952ae[_0xebc8('0x43')][_0xebc8('0x49')]){_0x5a282a[_0xebc8('0x49')]=_0x1952ae[_0xebc8('0x43')][_0xebc8('0x49')];}return db[_0xebc8('0x28')][_0xebc8('0x42')]({'where':_0x5a282a})[_0xebc8('0x1f')](function(_0x1c6930){if(_0x1c6930){throw new db[(_0xebc8('0x4a'))][(_0xebc8('0x4b'))](_0xebc8('0x4c'));}return db[_0xebc8('0x28')][_0xebc8('0x44')](_0x1952ae['body']);})[_0xebc8('0x1f')](function(_0x2d687f){var _0x2ae5a3=_0x1952ae[_0xebc8('0x4d')][_0xebc8('0x20')]({'plain':!![]});if(!_0x2ae5a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ae5a3[_0xebc8('0x4e')]===_0xebc8('0x4d')){var _0x2c7922=_0x2d687f['get']({'plain':!![]});return db[_0xebc8('0x4f')]['find']({'where':{'name':_0xebc8('0x21'),'userProfileId':_0x2ae5a3['userProfileId']},'raw':!![]})[_0xebc8('0x1f')](function(_0x2baabf){if(_0x2baabf&&_0x2baabf[_0xebc8('0x50')]===0x0){return db[_0xebc8('0x22')][_0xebc8('0x44')]({'name':_0x2c7922['name'],'resourceId':_0x2c7922['id'],'type':_0x2baabf['name'],'sectionId':_0x2baabf['id']},{})['then'](function(){return _0x2d687f;});}else{return _0x2d687f;}})[_0xebc8('0x3f')](function(_0x3a9819){logger['error'](_0xebc8('0x51'),_0x3a9819);throw _0x3a9819;});}return _0x2d687f;})[_0xebc8('0x1f')](respondWithResult(_0x331650,0xc9))[_0xebc8('0x3f')](handleError(_0x331650,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ee34615..a93c88e 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 _0x9f7a=['utf8mb4','lodash','util','../../config/logger','api','bluebird','../../config/environment','./cannedAnswer.attributes'];(function(_0x16228d,_0x5ee350){var _0x3e734b=function(_0x51871c){while(--_0x51871c){_0x16228d['push'](_0x16228d['shift']());}};_0x3e734b(++_0x5ee350);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x9f7a[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var logger=require(_0xa9f7('0x2'))(_0xa9f7('0x3'));var moment=require('moment');var BPromise=require(_0xa9f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9f7('0x5'));var attributes=require(_0xa9f7('0x6'));module['exports']=function(_0x499ff6,_0xc1334d){return _0x499ff6['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9f7('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9f75=['api','request-promise','path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9f75,0x15a));var _0x59f7=function(_0xe0df2f,_0x26706f){_0xe0df2f=_0xe0df2f-0x0;var _0x318c91=_0x9f75[_0xe0df2f];return _0x318c91;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59f7('0xa'),'collate':_0x59f7('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 556d889..e1e3c59 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 _0x0d1c=['info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3220ae,_0x23e4b8){var _0x31def2=function(_0x3b4611){while(--_0x3b4611){_0x3220ae['push'](_0x3220ae['shift']());}};_0x31def2(++_0x23e4b8);}(_0x0d1c,0x1be));var _0xc0d1=function(_0x5a5059,_0x126afc){_0x5a5059=_0x5a5059-0x0;var _0x55be99=_0x0d1c[_0x5a5059];return _0x55be99;};'use strict';var _=require(_0xc0d1('0x0'));var util=require(_0xc0d1('0x1'));var moment=require(_0xc0d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0d1('0x3'));var fs=require('fs');var Redis=require(_0xc0d1('0x4'));var db=require(_0xc0d1('0x5'))['db'];var utils=require(_0xc0d1('0x6'));var logger=require(_0xc0d1('0x7'))(_0xc0d1('0x8'));var config=require(_0xc0d1('0x9'));var jayson=require(_0xc0d1('0xa'));var client=jayson['client'][_0xc0d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51e32e,_0x3a5ae9,_0x1d31b8){return new BPromise(function(_0x102bc9,_0x2854e4){return client[_0xc0d1('0xc')](_0x51e32e,_0x1d31b8)[_0xc0d1('0xd')](function(_0x2bfd6d){logger[_0xc0d1('0xe')](_0xc0d1('0xf'),_0x3a5ae9,'request\x20sent');logger['debug'](_0xc0d1('0x10'),_0x3a5ae9,_0xc0d1('0x11'),JSON[_0xc0d1('0x12')](_0x2bfd6d));if(_0x2bfd6d[_0xc0d1('0x13')]){if(_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x14')]===0x1f4){logger['error'](_0xc0d1('0xf'),_0x3a5ae9,_0x2bfd6d['error'][_0xc0d1('0x15')]);return _0x2854e4(_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x15')]);}logger[_0xc0d1('0x13')](_0xc0d1('0xf'),_0x3a5ae9,_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x15')]);return _0x102bc9(_0x2bfd6d[_0xc0d1('0x13')][_0xc0d1('0x15')]);}else{logger[_0xc0d1('0xe')](_0xc0d1('0xf'),_0x3a5ae9,_0xc0d1('0x11'));_0x102bc9(_0x2bfd6d['result'][_0xc0d1('0x15')]);}})[_0xc0d1('0x16')](function(_0x4783fd){logger[_0xc0d1('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x3a5ae9,_0x4783fd);_0x2854e4(_0x4783fd);});});} \ No newline at end of file +var _0xe0f4=['../../config/environment','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5f01c2,_0x36aea9){var _0x4fddc2=function(_0x883b08){while(--_0x883b08){_0x5f01c2['push'](_0x5f01c2['shift']());}};_0x4fddc2(++_0x36aea9);}(_0xe0f4,0x1bc));var _0x4e0f=function(_0x857bc8,_0x35b60d){_0x857bc8=_0x857bc8-0x0;var _0x4a6559=_0xe0f4[_0x857bc8];return _0x4a6559;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e0f('0x0'));var BPromise=require(_0x4e0f('0x1'));var rs=require(_0x4e0f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e0f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e0f('0x4'))(_0x4e0f('0x5'));var config=require(_0x4e0f('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14e075,_0x3d3800,_0x3d5777){return new BPromise(function(_0x2a2b11,_0x284ba5){return client[_0x4e0f('0x7')](_0x14e075,_0x3d5777)[_0x4e0f('0x8')](function(_0xc3681c){logger[_0x4e0f('0x9')](_0x4e0f('0xa'),_0x3d3800,_0x4e0f('0xb'));logger['debug'](_0x4e0f('0xc'),_0x3d3800,'request\x20sent',JSON[_0x4e0f('0xd')](_0xc3681c));if(_0xc3681c[_0x4e0f('0xe')]){if(_0xc3681c[_0x4e0f('0xe')]['code']===0x1f4){logger[_0x4e0f('0xe')](_0x4e0f('0xa'),_0x3d3800,_0xc3681c[_0x4e0f('0xe')]['message']);return _0x284ba5(_0xc3681c[_0x4e0f('0xe')]['message']);}logger[_0x4e0f('0xe')](_0x4e0f('0xa'),_0x3d3800,_0xc3681c[_0x4e0f('0xe')][_0x4e0f('0xf')]);return _0x2a2b11(_0xc3681c['error'][_0x4e0f('0xf')]);}else{logger['info'](_0x4e0f('0xa'),_0x3d3800,_0x4e0f('0xb'));_0x2a2b11(_0xc3681c[_0x4e0f('0x10')][_0x4e0f('0xf')]);}})[_0x4e0f('0x11')](function(_0x269e18){logger[_0x4e0f('0xe')](_0x4e0f('0xa'),_0x3d3800,_0x269e18);_0x284ba5(_0x269e18);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c5b4c02..6f318fa 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 _0xe9d5=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x2c1923,_0x5446e9){var _0x73c9b4=function(_0x1c0f5d){while(--_0x1c0f5d){_0x2c1923['push'](_0x2c1923['shift']());}};_0x73c9b4(++_0x5446e9);}(_0xe9d5,0x191));var _0x5e9d=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xe9d5[_0x368e09];return _0x14b7df;};'use strict';var multer=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var path=require(_0x5e9d('0x2'));var timeout=require(_0x5e9d('0x3'));var express=require(_0x5e9d('0x4'));var router=express['Router']();var auth=require(_0x5e9d('0x5'));var interaction=require(_0x5e9d('0x6'));var config=require(_0x5e9d('0x7'));var controller=require(_0x5e9d('0x8'));router[_0x5e9d('0x9')]('/',auth[_0x5e9d('0xa')](),controller[_0x5e9d('0xb')]);router[_0x5e9d('0x9')](_0x5e9d('0xc'),auth[_0x5e9d('0xa')](),controller[_0x5e9d('0xd')]);router[_0x5e9d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e9d('0xf')]);router[_0x5e9d('0x10')](_0x5e9d('0xc'),auth[_0x5e9d('0xa')](),controller[_0x5e9d('0x11')]);router[_0x5e9d('0x12')](_0x5e9d('0xc'),auth['isAuthenticated'](),controller[_0x5e9d('0x13')]);module[_0x5e9d('0x14')]=router; \ No newline at end of file +var _0x7050=['express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','destroy','multer','util','path','connect-timeout'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7050,0x74));var _0x0705=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x7050[_0xf73c09];return _0xa8923c;};'use strict';var multer=require(_0x0705('0x0'));var util=require(_0x0705('0x1'));var path=require(_0x0705('0x2'));var timeout=require(_0x0705('0x3'));var express=require(_0x0705('0x4'));var router=express['Router']();var auth=require(_0x0705('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0705('0x6'));var controller=require('./cannedAnswer.controller');router[_0x0705('0x7')]('/',auth[_0x0705('0x8')](),controller[_0x0705('0x9')]);router[_0x0705('0x7')](_0x0705('0xa'),auth['isAuthenticated'](),controller[_0x0705('0xb')]);router[_0x0705('0xc')]('/',auth[_0x0705('0x8')](),controller['create']);router['put'](_0x0705('0xa'),auth[_0x0705('0x8')](),controller[_0x0705('0xd')]);router['delete']('/:id',auth[_0x0705('0x8')](),controller[_0x0705('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8c9eea5..e1844b3 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 _0x4e45=['1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x55a8d1,_0x517b73){var _0x2a5210=function(_0x17c765){while(--_0x17c765){_0x55a8d1['push'](_0x55a8d1['shift']());}};_0x2a5210(++_0x517b73);}(_0x4e45,0x1ef));var _0x54e4=function(_0x30e85e,_0x1f450d){_0x30e85e=_0x30e85e-0x0;var _0x1c86b6=_0x4e45[_0x30e85e];return _0x1c86b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x54e4('0x0')},'clid':{'type':Sequelize[_0x54e4('0x1')]},'src':{'type':Sequelize[_0x54e4('0x1')]},'dst':{'type':Sequelize[_0x54e4('0x1')]},'dcontext':{'type':Sequelize[_0x54e4('0x1')]},'channel':{'type':Sequelize[_0x54e4('0x1')]},'dstchannel':{'type':Sequelize[_0x54e4('0x1')]},'lastapp':{'type':Sequelize[_0x54e4('0x1')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x54e4('0x1')]},'amaflags':{'type':Sequelize[_0x54e4('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x54e4('0x1')]},'userfield':{'type':Sequelize[_0x54e4('0x1')]},'uniqueid':{'type':Sequelize[_0x54e4('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x54e4('0x1')]},'type':{'type':Sequelize[_0x54e4('0x1')]},'tag':{'type':Sequelize[_0x54e4('0x1')]}}; \ No newline at end of file +var _0xaa20=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x3e97da,_0x47b543){var _0x3637a0=function(_0x3b0c41){while(--_0x3b0c41){_0x3e97da['push'](_0x3e97da['shift']());}};_0x3637a0(++_0x47b543);}(_0xaa20,0x14b));var _0x0aa2=function(_0xd15221,_0x123874){_0xd15221=_0xd15221-0x0;var _0x321a0f=_0xaa20[_0xd15221];return _0x321a0f;};'use strict';var Sequelize=require(_0x0aa2('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x0aa2('0x1')],'allowNull':![],'defaultValue':_0x0aa2('0x2')},'clid':{'type':Sequelize[_0x0aa2('0x3')]},'src':{'type':Sequelize[_0x0aa2('0x3')]},'dst':{'type':Sequelize[_0x0aa2('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0aa2('0x3')]},'dstchannel':{'type':Sequelize[_0x0aa2('0x3')]},'lastapp':{'type':Sequelize[_0x0aa2('0x3')]},'lastdata':{'type':Sequelize[_0x0aa2('0x3')]},'duration':{'type':Sequelize[_0x0aa2('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0aa2('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0aa2('0x3')]},'amaflags':{'type':Sequelize[_0x0aa2('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x0aa2('0x3')]},'uniqueid':{'type':Sequelize[_0x0aa2('0x3')]},'linkedid':{'type':Sequelize[_0x0aa2('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x0aa2('0x3')]},'type':{'type':Sequelize[_0x0aa2('0x3')]},'tag':{'type':Sequelize[_0x0aa2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index dbac5fb..553df0f 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 _0x76a4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','count','includeAll','rows','catch','keys','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x554b96,_0xa7f28){var _0xe445a8=function(_0x1c2dfb){while(--_0x1c2dfb){_0x554b96['push'](_0x554b96['shift']());}};_0xe445a8(++_0xa7f28);}(_0x76a4,0x7d));var _0x476a=function(_0x59973d,_0x363064){_0x59973d=_0x59973d-0x0;var _0x465f06=_0x76a4[_0x59973d];return _0x465f06;};'use strict';var pdf=require(_0x476a('0x0'));var emlformat=require(_0x476a('0x1'));var rimraf=require(_0x476a('0x2'));var zipdir=require(_0x476a('0x3'));var jsonpatch=require(_0x476a('0x4'));var rp=require(_0x476a('0x5'));var moment=require('moment');var BPromise=require(_0x476a('0x6'));var Mustache=require(_0x476a('0x7'));var util=require(_0x476a('0x8'));var path=require(_0x476a('0x9'));var sox=require(_0x476a('0xa'));var csv=require('to-csv');var ejs=require(_0x476a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x476a('0xc'));var jsforce=require(_0x476a('0xd'));var deskjs=require(_0x476a('0xe'));var toCsv=require(_0x476a('0xf'));var querystring=require(_0x476a('0x10'));var Papa=require('papaparse');var Redis=require(_0x476a('0x11'));var authService=require(_0x476a('0x12'));var qs=require(_0x476a('0x13'));var as=require(_0x476a('0x14'));var hardwareService=require(_0x476a('0x15'));var logger=require(_0x476a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x476a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd8d52,_0x4e34a4){_0x4e34a4=_0x4e34a4||0xcc;return function(_0x35d6ed){if(_0x35d6ed){return _0xdd8d52[_0x476a('0x18')](_0x4e34a4);}return _0xdd8d52[_0x476a('0x19')](_0x4e34a4)[_0x476a('0x1a')]();};}function respondWithResult(_0x38c8ea,_0x22e390){_0x22e390=_0x22e390||0xc8;return function(_0x5711f4){if(_0x5711f4){return _0x38c8ea[_0x476a('0x19')](_0x22e390)['json'](_0x5711f4);}};}function respondWithFilteredResult(_0x2db574,_0x4c81b5){return function(_0x11f024){if(_0x11f024){var _0xb039af=_0x11f024['count'],_0x13b93b=_0x4c81b5[_0x476a('0x1b')],_0xafd9d0=_0x4c81b5[_0x476a('0x1b')]+_0x4c81b5['limit'],_0x5204af;if(_0xafd9d0>=_0xb039af){_0xafd9d0=_0xb039af;_0x5204af=0xc8;}else{_0x5204af=0xce;}_0x2db574['status'](_0x5204af);return _0x2db574[_0x476a('0x1c')](_0x476a('0x1d'),_0x13b93b+'-'+_0xafd9d0+'/'+_0xb039af)['json'](_0x11f024);}return null;};}function patchUpdates(_0xe3a5cb){return function(_0x357c00){try{jsonpatch[_0x476a('0x1e')](_0x357c00,_0xe3a5cb,!![]);}catch(_0x377591){return BPromise['reject'](_0x377591);}return _0x357c00[_0x476a('0x1f')]();};}function saveUpdates(_0x2f06e9,_0x5102ea){return function(_0x7d8069){if(_0x7d8069){return _0x7d8069[_0x476a('0x20')](_0x2f06e9)[_0x476a('0x21')](function(_0x4a6b8e){return _0x4a6b8e;});}return null;};}function removeEntity(_0x2c7243,_0x3cca08){return function(_0xde94e7){if(_0xde94e7){return _0xde94e7[_0x476a('0x22')]()[_0x476a('0x21')](function(){_0x2c7243[_0x476a('0x19')](0xcc)[_0x476a('0x1a')]();});}};}function handleEntityNotFound(_0x3baa0f,_0x291840){return function(_0x3bd013){if(!_0x3bd013){_0x3baa0f['sendStatus'](0x194);}return _0x3bd013;};}function handleError(_0x26af7c,_0x3df861){_0x3df861=_0x3df861||0x1f4;return function(_0x3cd89f){logger[_0x476a('0x23')](_0x3cd89f[_0x476a('0x24')]);if(_0x3cd89f[_0x476a('0x25')]){delete _0x3cd89f['name'];}_0x26af7c[_0x476a('0x19')](_0x3df861)['send'](_0x3cd89f);};}exports[_0x476a('0x26')]=function(_0x173fea,_0x316dc9){var _0x3d1de4={},_0x12e570={},_0x8d563e={'count':0x0,'rows':[]};var _0x3e648b=_['map'](db[_0x476a('0x27')][_0x476a('0x28')],function(_0x9420af){return{'name':_0x9420af['fieldName'],'type':_0x9420af['type']['key']};});_0x12e570[_0x476a('0x29')]=_[_0x476a('0x2a')](_0x3e648b,_0x476a('0x25'));_0x12e570[_0x476a('0x2b')]=_['keys'](_0x173fea['query']);_0x12e570[_0x476a('0x2c')]=_[_0x476a('0x2d')](_0x12e570[_0x476a('0x29')],_0x12e570[_0x476a('0x2b')]);_0x3d1de4[_0x476a('0x2e')]=_[_0x476a('0x2d')](_0x12e570[_0x476a('0x29')],qs[_0x476a('0x2f')](_0x173fea[_0x476a('0x2b')][_0x476a('0x2f')]));_0x3d1de4[_0x476a('0x2e')]=_0x3d1de4[_0x476a('0x2e')]['length']?_0x3d1de4['attributes']:_0x12e570[_0x476a('0x29')];if(!_0x173fea[_0x476a('0x2b')][_0x476a('0x30')](_0x476a('0x31'))){_0x3d1de4[_0x476a('0x32')]=qs[_0x476a('0x32')](_0x173fea['query'][_0x476a('0x32')]);_0x3d1de4['offset']=qs[_0x476a('0x1b')](_0x173fea[_0x476a('0x2b')][_0x476a('0x1b')]);}_0x3d1de4[_0x476a('0x33')]=qs[_0x476a('0x34')](_0x173fea[_0x476a('0x2b')][_0x476a('0x34')]);_0x3d1de4[_0x476a('0x35')]=qs[_0x476a('0x2c')](_['pick'](_0x173fea[_0x476a('0x2b')],_0x12e570[_0x476a('0x2c')]),_0x3e648b);if(_0x173fea[_0x476a('0x2b')][_0x476a('0x36')]){_0x3d1de4['where']=_['merge'](_0x3d1de4[_0x476a('0x35')],{'$or':_[_0x476a('0x2a')](_0x3e648b,function(_0x63c7a5){if(_0x63c7a5[_0x476a('0x37')]!==_0x476a('0x38')){var _0x272488={};_0x272488[_0x63c7a5['name']]={'$like':'%'+_0x173fea[_0x476a('0x2b')][_0x476a('0x36')]+'%'};return _0x272488;}})});}_0x3d1de4=_[_0x476a('0x39')]({},_0x3d1de4,_0x173fea[_0x476a('0x3a')]);var _0x23b2e2={'where':_0x3d1de4[_0x476a('0x35')]};return db['Cdr'][_0x476a('0x3b')](_0x23b2e2)['then'](function(_0x2cf4fb){_0x8d563e[_0x476a('0x3b')]=_0x2cf4fb;if(_0x173fea[_0x476a('0x2b')][_0x476a('0x3c')]){_0x3d1de4['include']=[{'all':!![]}];}return db[_0x476a('0x27')]['findAll'](_0x3d1de4);})[_0x476a('0x21')](function(_0x6c6483){_0x8d563e[_0x476a('0x3d')]=_0x6c6483;return _0x8d563e;})[_0x476a('0x21')](respondWithFilteredResult(_0x316dc9,_0x3d1de4))[_0x476a('0x3e')](handleError(_0x316dc9,null));};exports['show']=function(_0x4bdd01,_0x1798a8){var _0x555c74={'raw':!![],'where':{'id':_0x4bdd01['params']['id']}},_0x4846d3={};_0x4846d3[_0x476a('0x29')]=_[_0x476a('0x3f')](db['Cdr']['rawAttributes']);_0x4846d3[_0x476a('0x2b')]=_[_0x476a('0x3f')](_0x4bdd01[_0x476a('0x2b')]);_0x4846d3[_0x476a('0x2c')]=_['intersection'](_0x4846d3[_0x476a('0x29')],_0x4846d3[_0x476a('0x2b')]);_0x555c74[_0x476a('0x2e')]=_[_0x476a('0x2d')](_0x4846d3[_0x476a('0x29')],qs[_0x476a('0x2f')](_0x4bdd01[_0x476a('0x2b')][_0x476a('0x2f')]));_0x555c74[_0x476a('0x2e')]=_0x555c74[_0x476a('0x2e')][_0x476a('0x40')]?_0x555c74[_0x476a('0x2e')]:_0x4846d3['model'];if(_0x4bdd01['query'][_0x476a('0x3c')]){_0x555c74[_0x476a('0x41')]=[{'all':!![]}];}_0x555c74=_[_0x476a('0x39')]({},_0x555c74,_0x4bdd01['options']);return db['Cdr'][_0x476a('0x42')](_0x555c74)[_0x476a('0x21')](handleEntityNotFound(_0x1798a8,null))['then'](respondWithResult(_0x1798a8,null))[_0x476a('0x3e')](handleError(_0x1798a8,null));};exports[_0x476a('0x43')]=function(_0x2db62f,_0x159f48){return db[_0x476a('0x27')][_0x476a('0x43')](_0x2db62f[_0x476a('0x44')],{})[_0x476a('0x21')](respondWithResult(_0x159f48,0xc9))[_0x476a('0x3e')](handleError(_0x159f48,null));};exports['update']=function(_0x168116,_0x45d124){if(_0x168116[_0x476a('0x44')]['id']){delete _0x168116[_0x476a('0x44')]['id'];}return db['Cdr']['find']({'where':{'id':_0x168116[_0x476a('0x45')]['id']}})[_0x476a('0x21')](handleEntityNotFound(_0x45d124,null))[_0x476a('0x21')](saveUpdates(_0x168116[_0x476a('0x44')],null))[_0x476a('0x21')](respondWithResult(_0x45d124,null))[_0x476a('0x3e')](handleError(_0x45d124,null));};exports[_0x476a('0x22')]=function(_0x4b6f14,_0x3b49ce){return db['Cdr'][_0x476a('0x42')]({'where':{'id':_0x4b6f14[_0x476a('0x45')]['id']}})[_0x476a('0x21')](handleEntityNotFound(_0x3b49ce,null))[_0x476a('0x21')](removeEntity(_0x3b49ce,null))[_0x476a('0x3e')](handleError(_0x3b49ce,null));};exports[_0x476a('0x46')]=function(_0x48ef8c,_0x1bd3d6){return db[_0x476a('0x27')][_0x476a('0x46')]()[_0x476a('0x21')](respondWithResult(_0x1bd3d6,null))[_0x476a('0x3e')](handleError(_0x1bd3d6,null));}; \ No newline at end of file +var _0xb561=['path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','moment','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb561,0x1b0));var _0x1b56=function(_0x1c3054,_0x202a0f){_0x1c3054=_0x1c3054-0x0;var _0x4b1466=_0xb561[_0x1c3054];return _0x4b1466;};'use strict';var pdf=require(_0x1b56('0x0'));var emlformat=require(_0x1b56('0x1'));var rimraf=require(_0x1b56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b56('0x3'));var BPromise=require(_0x1b56('0x4'));var Mustache=require('mustache');var util=require(_0x1b56('0x5'));var path=require(_0x1b56('0x6'));var sox=require(_0x1b56('0x7'));var csv=require(_0x1b56('0x8'));var ejs=require(_0x1b56('0x9'));var fs=require('fs');var _=require(_0x1b56('0xa'));var squel=require('squel');var crypto=require(_0x1b56('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1b56('0x8'));var querystring=require(_0x1b56('0xc'));var Papa=require(_0x1b56('0xd'));var Redis=require(_0x1b56('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1b56('0xf'));var hardwareService=require(_0x1b56('0x10'));var logger=require(_0x1b56('0x11'))(_0x1b56('0x12'));var utils=require('../../config/utils');var config=require(_0x1b56('0x13'));var db=require(_0x1b56('0x14'))['db'];function respondWithStatusCode(_0x73ccb5,_0x3bad80){_0x3bad80=_0x3bad80||0xcc;return function(_0x169372){if(_0x169372){return _0x73ccb5[_0x1b56('0x15')](_0x3bad80);}return _0x73ccb5['status'](_0x3bad80)[_0x1b56('0x16')]();};}function respondWithResult(_0x5eac0d,_0x5cc0f4){_0x5cc0f4=_0x5cc0f4||0xc8;return function(_0x5a6de0){if(_0x5a6de0){return _0x5eac0d[_0x1b56('0x17')](_0x5cc0f4)[_0x1b56('0x18')](_0x5a6de0);}};}function respondWithFilteredResult(_0x315661,_0x3969bc){return function(_0xe94376){if(_0xe94376){var _0xfb7a45=_0xe94376['count'],_0x11ce40=_0x3969bc[_0x1b56('0x19')],_0x31910c=_0x3969bc['offset']+_0x3969bc[_0x1b56('0x1a')],_0x3f73ee;if(_0x31910c>=_0xfb7a45){_0x31910c=_0xfb7a45;_0x3f73ee=0xc8;}else{_0x3f73ee=0xce;}_0x315661[_0x1b56('0x17')](_0x3f73ee);return _0x315661[_0x1b56('0x1b')](_0x1b56('0x1c'),_0x11ce40+'-'+_0x31910c+'/'+_0xfb7a45)[_0x1b56('0x18')](_0xe94376);}return null;};}function patchUpdates(_0x55e59f){return function(_0x5ee806){try{jsonpatch[_0x1b56('0x1d')](_0x5ee806,_0x55e59f,!![]);}catch(_0x5f1bd0){return BPromise['reject'](_0x5f1bd0);}return _0x5ee806[_0x1b56('0x1e')]();};}function saveUpdates(_0xc237c1,_0x508899){return function(_0x464b12){if(_0x464b12){return _0x464b12[_0x1b56('0x1f')](_0xc237c1)[_0x1b56('0x20')](function(_0x3ffd61){return _0x3ffd61;});}return null;};}function removeEntity(_0x5bf319,_0x52504f){return function(_0x5dff04){if(_0x5dff04){return _0x5dff04['destroy']()[_0x1b56('0x20')](function(){_0x5bf319[_0x1b56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d342,_0x37d03e){return function(_0x300f00){if(!_0x300f00){_0x48d342[_0x1b56('0x15')](0x194);}return _0x300f00;};}function handleError(_0x16d3c6,_0x5d5060){_0x5d5060=_0x5d5060||0x1f4;return function(_0x19d1e){logger[_0x1b56('0x21')](_0x19d1e[_0x1b56('0x22')]);if(_0x19d1e[_0x1b56('0x23')]){delete _0x19d1e[_0x1b56('0x23')];}_0x16d3c6[_0x1b56('0x17')](_0x5d5060)[_0x1b56('0x24')](_0x19d1e);};}exports[_0x1b56('0x25')]=function(_0x20e6ab,_0x4de618){var _0x44e559={},_0x115e46={},_0x336328={'count':0x0,'rows':[]};var _0xc4d4ef=_[_0x1b56('0x26')](db[_0x1b56('0x27')][_0x1b56('0x28')],function(_0x59640a){return{'name':_0x59640a[_0x1b56('0x29')],'type':_0x59640a[_0x1b56('0x2a')][_0x1b56('0x2b')]};});_0x115e46['model']=_[_0x1b56('0x26')](_0xc4d4ef,_0x1b56('0x23'));_0x115e46[_0x1b56('0x2c')]=_[_0x1b56('0x2d')](_0x20e6ab[_0x1b56('0x2c')]);_0x115e46['filters']=_[_0x1b56('0x2e')](_0x115e46[_0x1b56('0x2f')],_0x115e46[_0x1b56('0x2c')]);_0x44e559[_0x1b56('0x30')]=_[_0x1b56('0x2e')](_0x115e46[_0x1b56('0x2f')],qs['fields'](_0x20e6ab[_0x1b56('0x2c')]['fields']));_0x44e559['attributes']=_0x44e559[_0x1b56('0x30')][_0x1b56('0x31')]?_0x44e559[_0x1b56('0x30')]:_0x115e46[_0x1b56('0x2f')];if(!_0x20e6ab['query']['hasOwnProperty']('nolimit')){_0x44e559[_0x1b56('0x1a')]=qs['limit'](_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x1a')]);_0x44e559[_0x1b56('0x19')]=qs[_0x1b56('0x19')](_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x19')]);}_0x44e559[_0x1b56('0x32')]=qs[_0x1b56('0x33')](_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x33')]);_0x44e559['where']=qs[_0x1b56('0x34')](_[_0x1b56('0x35')](_0x20e6ab[_0x1b56('0x2c')],_0x115e46['filters']),_0xc4d4ef);if(_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x36')]){_0x44e559[_0x1b56('0x37')]=_[_0x1b56('0x38')](_0x44e559[_0x1b56('0x37')],{'$or':_[_0x1b56('0x26')](_0xc4d4ef,function(_0x32b119){if(_0x32b119[_0x1b56('0x2a')]!==_0x1b56('0x39')){var _0x1044e6={};_0x1044e6[_0x32b119[_0x1b56('0x23')]]={'$like':'%'+_0x20e6ab['query'][_0x1b56('0x36')]+'%'};return _0x1044e6;}})});}_0x44e559=_[_0x1b56('0x38')]({},_0x44e559,_0x20e6ab[_0x1b56('0x3a')]);var _0x2dc019={'where':_0x44e559['where']};return db[_0x1b56('0x27')][_0x1b56('0x3b')](_0x2dc019)[_0x1b56('0x20')](function(_0x477fe1){_0x336328[_0x1b56('0x3b')]=_0x477fe1;if(_0x20e6ab[_0x1b56('0x2c')][_0x1b56('0x3c')]){_0x44e559[_0x1b56('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x1b56('0x3e')](_0x44e559);})[_0x1b56('0x20')](function(_0x3f172e){_0x336328[_0x1b56('0x3f')]=_0x3f172e;return _0x336328;})[_0x1b56('0x20')](respondWithFilteredResult(_0x4de618,_0x44e559))[_0x1b56('0x40')](handleError(_0x4de618,null));};exports[_0x1b56('0x41')]=function(_0x4aa2cc,_0x221130){var _0x8261ee={'raw':!![],'where':{'id':_0x4aa2cc[_0x1b56('0x42')]['id']}},_0x389c2b={};_0x389c2b[_0x1b56('0x2f')]=_[_0x1b56('0x2d')](db['Cdr'][_0x1b56('0x28')]);_0x389c2b[_0x1b56('0x2c')]=_[_0x1b56('0x2d')](_0x4aa2cc[_0x1b56('0x2c')]);_0x389c2b[_0x1b56('0x34')]=_[_0x1b56('0x2e')](_0x389c2b[_0x1b56('0x2f')],_0x389c2b[_0x1b56('0x2c')]);_0x8261ee[_0x1b56('0x30')]=_[_0x1b56('0x2e')](_0x389c2b[_0x1b56('0x2f')],qs[_0x1b56('0x43')](_0x4aa2cc[_0x1b56('0x2c')]['fields']));_0x8261ee['attributes']=_0x8261ee['attributes'][_0x1b56('0x31')]?_0x8261ee[_0x1b56('0x30')]:_0x389c2b[_0x1b56('0x2f')];if(_0x4aa2cc[_0x1b56('0x2c')]['includeAll']){_0x8261ee[_0x1b56('0x3d')]=[{'all':!![]}];}_0x8261ee=_[_0x1b56('0x38')]({},_0x8261ee,_0x4aa2cc[_0x1b56('0x3a')]);return db[_0x1b56('0x27')][_0x1b56('0x44')](_0x8261ee)[_0x1b56('0x20')](handleEntityNotFound(_0x221130,null))[_0x1b56('0x20')](respondWithResult(_0x221130,null))[_0x1b56('0x40')](handleError(_0x221130,null));};exports[_0x1b56('0x45')]=function(_0x356fb3,_0x4aedb6){return db[_0x1b56('0x27')][_0x1b56('0x45')](_0x356fb3[_0x1b56('0x46')],{})['then'](respondWithResult(_0x4aedb6,0xc9))['catch'](handleError(_0x4aedb6,null));};exports['update']=function(_0x271b2b,_0x41cbdc){if(_0x271b2b['body']['id']){delete _0x271b2b[_0x1b56('0x46')]['id'];}return db[_0x1b56('0x27')]['find']({'where':{'id':_0x271b2b['params']['id']}})[_0x1b56('0x20')](handleEntityNotFound(_0x41cbdc,null))[_0x1b56('0x20')](saveUpdates(_0x271b2b[_0x1b56('0x46')],null))['then'](respondWithResult(_0x41cbdc,null))[_0x1b56('0x40')](handleError(_0x41cbdc,null));};exports[_0x1b56('0x47')]=function(_0x53262d,_0x16978a){return db[_0x1b56('0x27')]['find']({'where':{'id':_0x53262d[_0x1b56('0x42')]['id']}})[_0x1b56('0x20')](handleEntityNotFound(_0x16978a,null))[_0x1b56('0x20')](removeEntity(_0x16978a,null))[_0x1b56('0x40')](handleError(_0x16978a,null));};exports[_0x1b56('0x48')]=function(_0x34c90c,_0x99f65d){return db[_0x1b56('0x27')][_0x1b56('0x48')]()[_0x1b56('0x20')](respondWithResult(_0x99f65d,null))[_0x1b56('0x40')](handleError(_0x99f65d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9a32d6c..305f3b2 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 _0x2a1c=['dst','uniqueid','../../config/logger','api','moment','rimraf','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a1c,0x9c));var _0xc2a1=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x2a1c[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc2a1('0x0'))(_0xc2a1('0x1'));var moment=require(_0xc2a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc2a1('0x3'));var config=require('../../config/environment');var attributes=require(_0xc2a1('0x4'));module[_0xc2a1('0x5')]=function(_0x983014,_0x53203c){return _0x983014[_0xc2a1('0x6')](_0xc2a1('0x7'),attributes,{'tableName':_0xc2a1('0x8'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0xc2a1('0x9')]},{'name':'calldate','fields':[_0xc2a1('0xa')]},{'name':_0xc2a1('0xb'),'fields':[_0xc2a1('0xb')]},{'name':_0xc2a1('0xc'),'fields':[_0xc2a1('0xc')]},{'name':'src','fields':['src']},{'name':_0xc2a1('0xd'),'fields':[_0xc2a1('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1403=['src','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','dst'];(function(_0x4cefcd,_0xb59db){var _0x57ded8=function(_0x79970b){while(--_0x79970b){_0x4cefcd['push'](_0x4cefcd['shift']());}};_0x57ded8(++_0xb59db);}(_0x1403,0x123));var _0x3140=function(_0x5f01d3,_0x305393){_0x5f01d3=_0x5f01d3-0x0;var _0x342227=_0x1403[_0x5f01d3];return _0x342227;};'use strict';var _=require(_0x3140('0x0'));var util=require(_0x3140('0x1'));var logger=require(_0x3140('0x2'))(_0x3140('0x3'));var moment=require(_0x3140('0x4'));var BPromise=require('bluebird');var rp=require(_0x3140('0x5'));var fs=require('fs');var path=require(_0x3140('0x6'));var rimraf=require('rimraf');var config=require(_0x3140('0x7'));var attributes=require(_0x3140('0x8'));module[_0x3140('0x9')]=function(_0x2ff2e9,_0x29e110){return _0x2ff2e9['define'](_0x3140('0xa'),attributes,{'tableName':_0x3140('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x3140('0xc')]},{'name':_0x3140('0xd'),'fields':[_0x3140('0xd')]},{'name':'disposition','fields':['disposition']},{'name':_0x3140('0xe'),'fields':[_0x3140('0xe')]},{'name':_0x3140('0xf'),'fields':[_0x3140('0xf')]},{'name':_0x3140('0x10'),'fields':[_0x3140('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index d9e3083..1277702 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 _0x0612=['jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0612,0x1b7));var _0x2061=function(_0x25c654,_0x292a51){_0x25c654=_0x25c654-0x0;var _0xaeb2be=_0x0612[_0x25c654];return _0xaeb2be;};'use strict';var _=require(_0x2061('0x0'));var util=require(_0x2061('0x1'));var moment=require(_0x2061('0x2'));var BPromise=require(_0x2061('0x3'));var rs=require(_0x2061('0x4'));var fs=require('fs');var Redis=require(_0x2061('0x5'));var db=require(_0x2061('0x6'))['db'];var utils=require(_0x2061('0x7'));var logger=require(_0x2061('0x8'))(_0x2061('0x9'));var config=require(_0x2061('0xa'));var jayson=require(_0x2061('0xb'));var client=jayson[_0x2061('0xc')][_0x2061('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x12ba23,_0x27ea35,_0x52d661){return new BPromise(function(_0x3333db,_0x5e7982){return client[_0x2061('0xe')](_0x12ba23,_0x52d661)[_0x2061('0xf')](function(_0x48145b){logger[_0x2061('0x10')](_0x2061('0x11'),_0x27ea35,_0x2061('0x12'));logger[_0x2061('0x13')]('Cdr,\x20%s,\x20%s,\x20%s',_0x27ea35,_0x2061('0x12'),JSON['stringify'](_0x48145b));if(_0x48145b[_0x2061('0x14')]){if(_0x48145b['error'][_0x2061('0x15')]===0x1f4){logger[_0x2061('0x14')](_0x2061('0x11'),_0x27ea35,_0x48145b[_0x2061('0x14')][_0x2061('0x16')]);return _0x5e7982(_0x48145b[_0x2061('0x14')][_0x2061('0x16')]);}logger[_0x2061('0x14')](_0x2061('0x11'),_0x27ea35,_0x48145b['error'][_0x2061('0x16')]);return _0x3333db(_0x48145b[_0x2061('0x14')][_0x2061('0x16')]);}else{logger[_0x2061('0x10')](_0x2061('0x11'),_0x27ea35,_0x2061('0x12'));_0x3333db(_0x48145b[_0x2061('0x17')][_0x2061('0x16')]);}})[_0x2061('0x18')](function(_0x20b404){logger[_0x2061('0x14')]('Cdr,\x20%s,\x20%s',_0x27ea35,_0x20b404);_0x5e7982(_0x20b404);});});} \ No newline at end of file +var _0xe7ec=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x33f0f1,_0x1cea77){var _0x398dee=function(_0x26a7e4){while(--_0x26a7e4){_0x33f0f1['push'](_0x33f0f1['shift']());}};_0x398dee(++_0x1cea77);}(_0xe7ec,0x119));var _0xce7e=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xe7ec[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0xce7e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xce7e('0x1'));var rs=require(_0xce7e('0x2'));var fs=require('fs');var Redis=require(_0xce7e('0x3'));var db=require(_0xce7e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xce7e('0x5'))(_0xce7e('0x6'));var config=require(_0xce7e('0x7'));var jayson=require(_0xce7e('0x8'));var client=jayson[_0xce7e('0x9')][_0xce7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x343b9e,_0x38457b,_0x40cfab){return new BPromise(function(_0x1095b9,_0x4549fe){return client[_0xce7e('0xb')](_0x343b9e,_0x40cfab)[_0xce7e('0xc')](function(_0x2f3a52){logger['info']('Cdr,\x20%s,\x20%s',_0x38457b,_0xce7e('0xd'));logger[_0xce7e('0xe')](_0xce7e('0xf'),_0x38457b,_0xce7e('0xd'),JSON[_0xce7e('0x10')](_0x2f3a52));if(_0x2f3a52['error']){if(_0x2f3a52[_0xce7e('0x11')][_0xce7e('0x12')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x38457b,_0x2f3a52[_0xce7e('0x11')][_0xce7e('0x13')]);return _0x4549fe(_0x2f3a52[_0xce7e('0x11')][_0xce7e('0x13')]);}logger['error'](_0xce7e('0x14'),_0x38457b,_0x2f3a52['error'][_0xce7e('0x13')]);return _0x1095b9(_0x2f3a52['error'][_0xce7e('0x13')]);}else{logger[_0xce7e('0x15')](_0xce7e('0x14'),_0x38457b,_0xce7e('0xd'));_0x1095b9(_0x2f3a52[_0xce7e('0x16')][_0xce7e('0x13')]);}})[_0xce7e('0x17')](function(_0x2345cb){logger['error'](_0xce7e('0x14'),_0x38457b,_0x2345cb);_0x4549fe(_0x2345cb);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9aff253..68fd7a6 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 _0x95dc=['describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe'];(function(_0x3865b3,_0x456fee){var _0x300357=function(_0x14594f){while(--_0x14594f){_0x3865b3['push'](_0x3865b3['shift']());}};_0x300357(++_0x456fee);}(_0x95dc,0x1e9));var _0xc95d=function(_0xf83315,_0x2ec986){_0xf83315=_0xf83315-0x0;var _0x1ca896=_0x95dc[_0xf83315];return _0x1ca896;};'use strict';var multer=require(_0xc95d('0x0'));var util=require(_0xc95d('0x1'));var path=require(_0xc95d('0x2'));var timeout=require('connect-timeout');var express=require(_0xc95d('0x3'));var router=express['Router']();var auth=require(_0xc95d('0x4'));var interaction=require(_0xc95d('0x5'));var config=require(_0xc95d('0x6'));var controller=require(_0xc95d('0x7'));router[_0xc95d('0x8')]('/',auth[_0xc95d('0x9')](),controller['index']);router[_0xc95d('0x8')](_0xc95d('0xa'),auth['isAuthenticated'](),controller[_0xc95d('0xb')]);router[_0xc95d('0x8')](_0xc95d('0xc'),auth[_0xc95d('0x9')](),controller[_0xc95d('0xd')]);router[_0xc95d('0xe')]('/',auth[_0xc95d('0x9')](),controller[_0xc95d('0xf')]);router[_0xc95d('0x10')]('/:id',auth[_0xc95d('0x9')](),controller[_0xc95d('0x11')]);router[_0xc95d('0x12')](_0xc95d('0xc'),auth[_0xc95d('0x9')](),controller['destroy']);module[_0xc95d('0x13')]=router; \ No newline at end of file +var _0xfb20=['express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4af3b7,_0x30c116){var _0x24727c=function(_0x3ae9a0){while(--_0x3ae9a0){_0x4af3b7['push'](_0x4af3b7['shift']());}};_0x24727c(++_0x30c116);}(_0xfb20,0x138));var _0x0fb2=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xfb20[_0x3cb152];return _0x4f54c3;};'use strict';var multer=require(_0x0fb2('0x0'));var util=require('util');var path=require(_0x0fb2('0x1'));var timeout=require(_0x0fb2('0x2'));var express=require(_0x0fb2('0x3'));var router=express[_0x0fb2('0x4')]();var auth=require(_0x0fb2('0x5'));var interaction=require(_0x0fb2('0x6'));var config=require('../../config/environment');var controller=require(_0x0fb2('0x7'));router['get']('/',auth[_0x0fb2('0x8')](),controller[_0x0fb2('0x9')]);router[_0x0fb2('0xa')](_0x0fb2('0xb'),auth['isAuthenticated'](),controller[_0x0fb2('0xc')]);router[_0x0fb2('0xa')](_0x0fb2('0xd'),auth['isAuthenticated'](),controller[_0x0fb2('0xe')]);router[_0x0fb2('0xf')]('/',auth[_0x0fb2('0x8')](),controller[_0x0fb2('0x10')]);router[_0x0fb2('0x11')](_0x0fb2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0fb2('0x12')]('/:id',auth[_0x0fb2('0x8')](),controller[_0x0fb2('0x13')]);module[_0x0fb2('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 008b702..2984e85 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 _0xca39=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xca39,0xf0));var _0x9ca3=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xca39[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x9ca3('0x0'));module[_0x9ca3('0x1')]={'priority':{'type':Sequelize[_0x9ca3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ca3('0x3')},'appdata':{'type':Sequelize[_0x9ca3('0x4')]()},'description':{'type':Sequelize[_0x9ca3('0x5')]},'interval':{'type':Sequelize[_0x9ca3('0x5')],'defaultValue':_0x9ca3('0x6')}}; \ No newline at end of file +var _0xa0e9=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x14c48f,_0x4392fb){var _0x36b105=function(_0x2a5b90){while(--_0x2a5b90){_0x14c48f['push'](_0x14c48f['shift']());}};_0x36b105(++_0x4392fb);}(_0xa0e9,0x196));var _0x9a0e=function(_0x581db0,_0x31d992){_0x581db0=_0x581db0-0x0;var _0x198b98=_0xa0e9[_0x581db0];return _0x198b98;};'use strict';var Sequelize=require(_0x9a0e('0x0'));module[_0x9a0e('0x1')]={'priority':{'type':Sequelize[_0x9a0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a0e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9a0e('0x4')]()},'description':{'type':Sequelize[_0x9a0e('0x3')]},'interval':{'type':Sequelize[_0x9a0e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a6e4e64..3f4f35b 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 _0xf912=['fields','length','includeAll','include','merge','options','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','then','destroy','name','send','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','model'];(function(_0x11ad47,_0xe38604){var _0x3f95dc=function(_0x567dd1){while(--_0x567dd1){_0x11ad47['push'](_0x11ad47['shift']());}};_0x3f95dc(++_0xe38604);}(_0xf912,0x1b2));var _0x2f91=function(_0x50d2ae,_0x4c533c){_0x50d2ae=_0x50d2ae-0x0;var _0x3e3cdb=_0xf912[_0x50d2ae];return _0x3e3cdb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2f91('0x0'));var rimraf=require(_0x2f91('0x1'));var zipdir=require(_0x2f91('0x2'));var jsonpatch=require(_0x2f91('0x3'));var rp=require(_0x2f91('0x4'));var moment=require(_0x2f91('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2f91('0x6'));var util=require(_0x2f91('0x7'));var path=require('path');var sox=require(_0x2f91('0x8'));var csv=require(_0x2f91('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2f91('0xa'));var squel=require('squel');var crypto=require(_0x2f91('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2f91('0xc'));var Papa=require(_0x2f91('0xd'));var Redis=require('ioredis');var authService=require(_0x2f91('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2f91('0xf'));var hardwareService=require(_0x2f91('0x10'));var logger=require('../../config/logger')(_0x2f91('0x11'));var utils=require(_0x2f91('0x12'));var config=require(_0x2f91('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d02e8,_0x4417ce){_0x4417ce=_0x4417ce||0xcc;return function(_0xec6b4a){if(_0xec6b4a){return _0x2d02e8[_0x2f91('0x14')](_0x4417ce);}return _0x2d02e8[_0x2f91('0x15')](_0x4417ce)[_0x2f91('0x16')]();};}function respondWithResult(_0x43309d,_0x40c1ed){_0x40c1ed=_0x40c1ed||0xc8;return function(_0x2d7a0c){if(_0x2d7a0c){return _0x43309d['status'](_0x40c1ed)[_0x2f91('0x17')](_0x2d7a0c);}};}function respondWithFilteredResult(_0x51114a,_0x394b2d){return function(_0x6112a5){if(_0x6112a5){var _0x2950d6=_0x6112a5['count'],_0x24fb05=_0x394b2d['offset'],_0x7cf467=_0x394b2d[_0x2f91('0x18')]+_0x394b2d[_0x2f91('0x19')],_0x45c58f;if(_0x7cf467>=_0x2950d6){_0x7cf467=_0x2950d6;_0x45c58f=0xc8;}else{_0x45c58f=0xce;}_0x51114a[_0x2f91('0x15')](_0x45c58f);return _0x51114a['set'](_0x2f91('0x1a'),_0x24fb05+'-'+_0x7cf467+'/'+_0x2950d6)['json'](_0x6112a5);}return null;};}function patchUpdates(_0x3d67ff){return function(_0x836c36){try{jsonpatch[_0x2f91('0x1b')](_0x836c36,_0x3d67ff,!![]);}catch(_0x23ff06){return BPromise['reject'](_0x23ff06);}return _0x836c36[_0x2f91('0x1c')]();};}function saveUpdates(_0x48aa84,_0x3c0b2a){return function(_0x4c600c){if(_0x4c600c){return _0x4c600c['update'](_0x48aa84)[_0x2f91('0x1d')](function(_0x43d56c){return _0x43d56c;});}return null;};}function removeEntity(_0x1975fa,_0x288467){return function(_0x4b5a74){if(_0x4b5a74){return _0x4b5a74[_0x2f91('0x1e')]()[_0x2f91('0x1d')](function(){_0x1975fa[_0x2f91('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bbd9a,_0x1c3171){return function(_0x4e402d){if(!_0x4e402d){_0x5bbd9a['sendStatus'](0x194);}return _0x4e402d;};}function handleError(_0x4888fc,_0x496e68){_0x496e68=_0x496e68||0x1f4;return function(_0x23c1c5){logger['error'](_0x23c1c5['stack']);if(_0x23c1c5[_0x2f91('0x1f')]){delete _0x23c1c5[_0x2f91('0x1f')];}_0x4888fc[_0x2f91('0x15')](_0x496e68)[_0x2f91('0x20')](_0x23c1c5);};}exports[_0x2f91('0x21')]=function(_0x55d6ef,_0x325d54){var _0x583176={'raw':!![],'where':{'id':_0x55d6ef[_0x2f91('0x22')]['id']}},_0x391d0c={};_0x391d0c['model']=_['keys'](db[_0x2f91('0x23')][_0x2f91('0x24')]);_0x391d0c[_0x2f91('0x25')]=_[_0x2f91('0x26')](_0x55d6ef[_0x2f91('0x25')]);_0x391d0c[_0x2f91('0x27')]=_[_0x2f91('0x28')](_0x391d0c['model'],_0x391d0c[_0x2f91('0x25')]);_0x583176[_0x2f91('0x29')]=_[_0x2f91('0x28')](_0x391d0c[_0x2f91('0x2a')],qs[_0x2f91('0x2b')](_0x55d6ef[_0x2f91('0x25')][_0x2f91('0x2b')]));_0x583176[_0x2f91('0x29')]=_0x583176[_0x2f91('0x29')][_0x2f91('0x2c')]?_0x583176['attributes']:_0x391d0c[_0x2f91('0x2a')];if(_0x55d6ef[_0x2f91('0x25')][_0x2f91('0x2d')]){_0x583176[_0x2f91('0x2e')]=[{'all':!![]}];}_0x583176=_[_0x2f91('0x2f')]({},_0x583176,_0x55d6ef[_0x2f91('0x30')]);return db[_0x2f91('0x23')][_0x2f91('0x31')](_0x583176)[_0x2f91('0x1d')](handleEntityNotFound(_0x325d54,null))['then'](respondWithResult(_0x325d54,null))[_0x2f91('0x32')](handleError(_0x325d54,null));};exports[_0x2f91('0x33')]=function(_0x245f4c,_0xdf2c9e){if(_0x245f4c[_0x2f91('0x34')]['id']){delete _0x245f4c[_0x2f91('0x34')]['id'];}return db['ChatApplication'][_0x2f91('0x31')]({'where':{'id':_0x245f4c[_0x2f91('0x22')]['id']}})[_0x2f91('0x1d')](handleEntityNotFound(_0xdf2c9e,null))[_0x2f91('0x1d')](saveUpdates(_0x245f4c[_0x2f91('0x34')],null))['then'](respondWithResult(_0xdf2c9e,null))['catch'](handleError(_0xdf2c9e,null));};exports[_0x2f91('0x1e')]=function(_0x55dea9,_0x56ed50){return db[_0x2f91('0x23')]['find']({'where':{'id':_0x55dea9[_0x2f91('0x22')]['id']}})['then'](handleEntityNotFound(_0x56ed50,null))[_0x2f91('0x1d')](removeEntity(_0x56ed50,null))['catch'](handleError(_0x56ed50,null));}; \ No newline at end of file +var _0x874d=['model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','update','then','destroy','error','stack','name','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x874d,0x123));var _0xd874=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0x874d[_0x8a30cf];return _0x20f439;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd874('0x0'));var rimraf=require(_0xd874('0x1'));var zipdir=require(_0xd874('0x2'));var jsonpatch=require(_0xd874('0x3'));var rp=require(_0xd874('0x4'));var moment=require(_0xd874('0x5'));var BPromise=require(_0xd874('0x6'));var Mustache=require(_0xd874('0x7'));var util=require('util');var path=require(_0xd874('0x8'));var sox=require('sox');var csv=require(_0xd874('0x9'));var ejs=require(_0xd874('0xa'));var fs=require('fs');var _=require(_0xd874('0xb'));var squel=require(_0xd874('0xc'));var crypto=require(_0xd874('0xd'));var jsforce=require(_0xd874('0xe'));var deskjs=require(_0xd874('0xf'));var toCsv=require(_0xd874('0x9'));var querystring=require(_0xd874('0x10'));var Papa=require(_0xd874('0x11'));var Redis=require(_0xd874('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd874('0x13'));var logger=require(_0xd874('0x14'))('api');var utils=require(_0xd874('0x15'));var config=require(_0xd874('0x16'));var db=require(_0xd874('0x17'))['db'];function respondWithStatusCode(_0x597f0b,_0xc9d102){_0xc9d102=_0xc9d102||0xcc;return function(_0x2605fc){if(_0x2605fc){return _0x597f0b[_0xd874('0x18')](_0xc9d102);}return _0x597f0b['status'](_0xc9d102)[_0xd874('0x19')]();};}function respondWithResult(_0x4216c8,_0x212b8c){_0x212b8c=_0x212b8c||0xc8;return function(_0x2b3f6e){if(_0x2b3f6e){return _0x4216c8[_0xd874('0x1a')](_0x212b8c)[_0xd874('0x1b')](_0x2b3f6e);}};}function respondWithFilteredResult(_0x4b5bcb,_0x11b5a5){return function(_0x476752){if(_0x476752){var _0x519052=_0x476752[_0xd874('0x1c')],_0x468dc4=_0x11b5a5[_0xd874('0x1d')],_0x369d26=_0x11b5a5['offset']+_0x11b5a5[_0xd874('0x1e')],_0x2320aa;if(_0x369d26>=_0x519052){_0x369d26=_0x519052;_0x2320aa=0xc8;}else{_0x2320aa=0xce;}_0x4b5bcb[_0xd874('0x1a')](_0x2320aa);return _0x4b5bcb['set'](_0xd874('0x1f'),_0x468dc4+'-'+_0x369d26+'/'+_0x519052)[_0xd874('0x1b')](_0x476752);}return null;};}function patchUpdates(_0x82dc39){return function(_0x19b47f){try{jsonpatch['apply'](_0x19b47f,_0x82dc39,!![]);}catch(_0x52080a){return BPromise['reject'](_0x52080a);}return _0x19b47f['save']();};}function saveUpdates(_0x523141,_0x3d3d43){return function(_0x1f4cb8){if(_0x1f4cb8){return _0x1f4cb8[_0xd874('0x20')](_0x523141)[_0xd874('0x21')](function(_0x5f4c90){return _0x5f4c90;});}return null;};}function removeEntity(_0x5612da,_0x2e4bec){return function(_0x21ab00){if(_0x21ab00){return _0x21ab00[_0xd874('0x22')]()[_0xd874('0x21')](function(){_0x5612da[_0xd874('0x1a')](0xcc)[_0xd874('0x19')]();});}};}function handleEntityNotFound(_0x338675,_0x2e1a66){return function(_0x18db9b){if(!_0x18db9b){_0x338675[_0xd874('0x18')](0x194);}return _0x18db9b;};}function handleError(_0x25c886,_0x5d4ebc){_0x5d4ebc=_0x5d4ebc||0x1f4;return function(_0x1e26d3){logger[_0xd874('0x23')](_0x1e26d3[_0xd874('0x24')]);if(_0x1e26d3[_0xd874('0x25')]){delete _0x1e26d3[_0xd874('0x25')];}_0x25c886[_0xd874('0x1a')](_0x5d4ebc)['send'](_0x1e26d3);};}exports['show']=function(_0x4fe5c0,_0xdb48b5){var _0x3cac41={'raw':!![],'where':{'id':_0x4fe5c0[_0xd874('0x26')]['id']}},_0x2e429c={};_0x2e429c[_0xd874('0x27')]=_[_0xd874('0x28')](db[_0xd874('0x29')][_0xd874('0x2a')]);_0x2e429c['query']=_['keys'](_0x4fe5c0[_0xd874('0x2b')]);_0x2e429c[_0xd874('0x2c')]=_[_0xd874('0x2d')](_0x2e429c[_0xd874('0x27')],_0x2e429c[_0xd874('0x2b')]);_0x3cac41[_0xd874('0x2e')]=_[_0xd874('0x2d')](_0x2e429c[_0xd874('0x27')],qs['fields'](_0x4fe5c0[_0xd874('0x2b')][_0xd874('0x2f')]));_0x3cac41[_0xd874('0x2e')]=_0x3cac41['attributes']['length']?_0x3cac41['attributes']:_0x2e429c[_0xd874('0x27')];if(_0x4fe5c0[_0xd874('0x2b')][_0xd874('0x30')]){_0x3cac41[_0xd874('0x31')]=[{'all':!![]}];}_0x3cac41=_[_0xd874('0x32')]({},_0x3cac41,_0x4fe5c0[_0xd874('0x33')]);return db[_0xd874('0x29')]['find'](_0x3cac41)[_0xd874('0x21')](handleEntityNotFound(_0xdb48b5,null))[_0xd874('0x21')](respondWithResult(_0xdb48b5,null))[_0xd874('0x34')](handleError(_0xdb48b5,null));};exports[_0xd874('0x20')]=function(_0x528ea5,_0x3b87e2){if(_0x528ea5[_0xd874('0x35')]['id']){delete _0x528ea5['body']['id'];}return db[_0xd874('0x29')]['find']({'where':{'id':_0x528ea5[_0xd874('0x26')]['id']}})[_0xd874('0x21')](handleEntityNotFound(_0x3b87e2,null))[_0xd874('0x21')](saveUpdates(_0x528ea5['body'],null))['then'](respondWithResult(_0x3b87e2,null))['catch'](handleError(_0x3b87e2,null));};exports['destroy']=function(_0x2c8904,_0x52f64e){return db['ChatApplication'][_0xd874('0x36')]({'where':{'id':_0x2c8904[_0xd874('0x26')]['id']}})[_0xd874('0x21')](handleEntityNotFound(_0x52f64e,null))['then'](removeEntity(_0x52f64e,null))[_0xd874('0x34')](handleError(_0x52f64e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dfb3786..c9482e6 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 _0xdee2=['rimraf','../../config/environment','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3e8b23,_0x4392cd){var _0x38d8c3=function(_0x41266a){while(--_0x41266a){_0x3e8b23['push'](_0x3e8b23['shift']());}};_0x38d8c3(++_0x4392cd);}(_0xdee2,0x191));var _0x2dee=function(_0x241af1,_0xf80087){_0x241af1=_0x241af1-0x0;var _0x5bdfee=_0xdee2[_0x241af1];return _0x5bdfee;};'use strict';var _=require(_0x2dee('0x0'));var util=require('util');var logger=require(_0x2dee('0x1'))(_0x2dee('0x2'));var moment=require('moment');var BPromise=require(_0x2dee('0x3'));var rp=require(_0x2dee('0x4'));var fs=require('fs');var path=require(_0x2dee('0x5'));var rimraf=require(_0x2dee('0x6'));var config=require(_0x2dee('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x4498c1,_0x585982){return _0x4498c1['define'](_0x2dee('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dee('0x9'),'collate':_0x2dee('0xa')});}; \ No newline at end of file +var _0xa174=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4baaa2,_0x3a100a){var _0x5cfc61=function(_0x184610){while(--_0x184610){_0x4baaa2['push'](_0x4baaa2['shift']());}};_0x5cfc61(++_0x3a100a);}(_0xa174,0xbf));var _0x4a17=function(_0x172662,_0x4d8dd1){_0x172662=_0x172662-0x0;var _0xdd6143=_0xa174[_0x172662];return _0xdd6143;};'use strict';var _=require('lodash');var util=require(_0x4a17('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4a17('0x1'));var BPromise=require(_0x4a17('0x2'));var rp=require(_0x4a17('0x3'));var fs=require('fs');var path=require(_0x4a17('0x4'));var rimraf=require(_0x4a17('0x5'));var config=require(_0x4a17('0x6'));var attributes=require('./chatApplication.attributes');module[_0x4a17('0x7')]=function(_0x14dc0c,_0x3f5818){return _0x14dc0c[_0x4a17('0x8')]('ChatApplication',attributes,{'tableName':_0x4a17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a17('0xa'),'collate':_0x4a17('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 57a6079..d9e006e 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 _0x697e=['rpc','../../config/environment','jayson/promise','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0x697e,0x10c));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe697('0x0'));var moment=require(_0xe697('0x1'));var BPromise=require(_0xe697('0x2'));var rs=require(_0xe697('0x3'));var fs=require('fs');var Redis=require(_0xe697('0x4'));var db=require(_0xe697('0x5'))['db'];var utils=require(_0xe697('0x6'));var logger=require(_0xe697('0x7'))(_0xe697('0x8'));var config=require(_0xe697('0x9'));var jayson=require(_0xe697('0xa'));var client=jayson['client'][_0xe697('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x240ad4,_0x1a754e,_0x7d1d6f){return new BPromise(function(_0x3b0f27,_0x1833ea){return client[_0xe697('0xc')](_0x240ad4,_0x7d1d6f)['then'](function(_0x36f179){logger[_0xe697('0xd')](_0xe697('0xe'),_0x1a754e,_0xe697('0xf'));logger[_0xe697('0x10')](_0xe697('0x11'),_0x1a754e,_0xe697('0xf'),JSON[_0xe697('0x12')](_0x36f179));if(_0x36f179[_0xe697('0x13')]){if(_0x36f179[_0xe697('0x13')]['code']===0x1f4){logger[_0xe697('0x13')](_0xe697('0xe'),_0x1a754e,_0x36f179['error']['message']);return _0x1833ea(_0x36f179[_0xe697('0x13')][_0xe697('0x14')]);}logger[_0xe697('0x13')](_0xe697('0xe'),_0x1a754e,_0x36f179[_0xe697('0x13')][_0xe697('0x14')]);return _0x3b0f27(_0x36f179[_0xe697('0x13')][_0xe697('0x14')]);}else{logger[_0xe697('0xd')](_0xe697('0xe'),_0x1a754e,_0xe697('0xf'));_0x3b0f27(_0x36f179[_0xe697('0x15')]['message']);}})[_0xe697('0x16')](function(_0x36fe7f){logger[_0xe697('0x13')](_0xe697('0xe'),_0x1a754e,_0x36fe7f);_0x1833ea(_0x36fe7f);});});} \ No newline at end of file +var _0xf334=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2eae80,_0x481d0b){var _0x48ca71=function(_0xd17f32){while(--_0xd17f32){_0x2eae80['push'](_0x2eae80['shift']());}};_0x48ca71(++_0x481d0b);}(_0xf334,0x7e));var _0x4f33=function(_0x27cb2a,_0x25e011){_0x27cb2a=_0x27cb2a-0x0;var _0x5e85c6=_0xf334[_0x27cb2a];return _0x5e85c6;};'use strict';var _=require('lodash');var util=require(_0x4f33('0x0'));var moment=require('moment');var BPromise=require(_0x4f33('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f33('0x2'))['db'];var utils=require(_0x4f33('0x3'));var logger=require(_0x4f33('0x4'))('rpc');var config=require(_0x4f33('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4f33('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aee45,_0xcf13df,_0x598ba9){return new BPromise(function(_0x3b6a78,_0x4a282b){return client[_0x4f33('0x7')](_0x2aee45,_0x598ba9)[_0x4f33('0x8')](function(_0x571f0b){logger['info'](_0x4f33('0x9'),_0xcf13df,_0x4f33('0xa'));logger[_0x4f33('0xb')](_0x4f33('0xc'),_0xcf13df,_0x4f33('0xa'),JSON[_0x4f33('0xd')](_0x571f0b));if(_0x571f0b[_0x4f33('0xe')]){if(_0x571f0b[_0x4f33('0xe')]['code']===0x1f4){logger[_0x4f33('0xe')]('ChatApplication,\x20%s,\x20%s',_0xcf13df,_0x571f0b[_0x4f33('0xe')]['message']);return _0x4a282b(_0x571f0b['error'][_0x4f33('0xf')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0xcf13df,_0x571f0b[_0x4f33('0xe')][_0x4f33('0xf')]);return _0x3b6a78(_0x571f0b[_0x4f33('0xe')][_0x4f33('0xf')]);}else{logger['info'](_0x4f33('0x9'),_0xcf13df,_0x4f33('0xa'));_0x3b6a78(_0x571f0b[_0x4f33('0x10')][_0x4f33('0xf')]);}})[_0x4f33('0x11')](function(_0x1c69de){logger[_0x4f33('0xe')](_0x4f33('0x9'),_0xcf13df,_0x1c69de);_0x4a282b(_0x1c69de);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8e969f9..349205d 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 _0x92e2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x92e2,0x19c));var _0x292e=function(_0x952282,_0x51a614){_0x952282=_0x952282-0x0;var _0x613507=_0x92e2[_0x952282];return _0x613507;};'use strict';var multer=require(_0x292e('0x0'));var util=require('util');var path=require(_0x292e('0x1'));var timeout=require(_0x292e('0x2'));var express=require(_0x292e('0x3'));var router=express[_0x292e('0x4')]();var auth=require(_0x292e('0x5'));var interaction=require(_0x292e('0x6'));var config=require(_0x292e('0x7'));var controller=require(_0x292e('0x8'));router['get']('/:id',auth[_0x292e('0x9')](),controller['show']);router[_0x292e('0xa')](_0x292e('0xb'),auth[_0x292e('0x9')](),controller[_0x292e('0xc')]);router[_0x292e('0xd')](_0x292e('0xb'),auth[_0x292e('0x9')](),controller[_0x292e('0xe')]);module[_0x292e('0xf')]=router; \ No newline at end of file +var _0x60e3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','put','update','/:id','exports'];(function(_0x1d190d,_0x55117e){var _0x59b5b2=function(_0x54ad80){while(--_0x54ad80){_0x1d190d['push'](_0x1d190d['shift']());}};_0x59b5b2(++_0x55117e);}(_0x60e3,0xc3));var _0x360e=function(_0x5281fb,_0x51d61a){_0x5281fb=_0x5281fb-0x0;var _0x2be1aa=_0x60e3[_0x5281fb];return _0x2be1aa;};'use strict';var multer=require(_0x360e('0x0'));var util=require(_0x360e('0x1'));var path=require(_0x360e('0x2'));var timeout=require(_0x360e('0x3'));var express=require(_0x360e('0x4'));var router=express[_0x360e('0x5')]();var auth=require(_0x360e('0x6'));var interaction=require(_0x360e('0x7'));var config=require('../../config/environment');var controller=require(_0x360e('0x8'));router[_0x360e('0x9')]('/:id',auth[_0x360e('0xa')](),controller['show']);router[_0x360e('0xb')]('/:id',auth[_0x360e('0xa')](),controller[_0x360e('0xc')]);router['delete'](_0x360e('0xd'),auth[_0x360e('0xa')](),controller['destroy']);module[_0x360e('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 045ab1d..6504676 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 _0xa4cb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2fb690,_0x11edbe){var _0x5c80dc=function(_0xa0f889){while(--_0xa0f889){_0x2fb690['push'](_0x2fb690['shift']());}};_0x5c80dc(++_0x11edbe);}(_0xa4cb,0xc5));var _0xba4c=function(_0xf3ea74,_0x3a6544){_0xf3ea74=_0xf3ea74-0x0;var _0x20527d=_0xa4cb[_0xf3ea74];return _0x20527d;};'use strict';var Sequelize=require(_0xba4c('0x0'));module[_0xba4c('0x1')]={'name':{'type':Sequelize[_0xba4c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xba4c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xef2c=['STRING','BOOLEAN'];(function(_0x2a82db,_0xd0f42e){var _0x2bc54c=function(_0x17e9e8){while(--_0x17e9e8){_0x2a82db['push'](_0x2a82db['shift']());}};_0x2bc54c(++_0xd0f42e);}(_0xef2c,0x182));var _0xcef2=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0xef2c[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcef2('0x0')]},'write':{'type':Sequelize[_0xcef2('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 39b2913..1668806 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 _0xf140=['params','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','rawAttributes','sort','options','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','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','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','ChatGroup','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','count','includeAll','include','rows','show'];(function(_0x1c2051,_0x4cb6b9){var _0x2b58a0=function(_0x4308df){while(--_0x4308df){_0x1c2051['push'](_0x1c2051['shift']());}};_0x2b58a0(++_0x4cb6b9);}(_0xf140,0xe8));var _0x0f14=function(_0x45d31c,_0xd0b936){_0x45d31c=_0x45d31c-0x0;var _0x33c23a=_0xf140[_0x45d31c];return _0x33c23a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f14('0x0'));var rimraf=require(_0x0f14('0x1'));var zipdir=require(_0x0f14('0x2'));var jsonpatch=require(_0x0f14('0x3'));var rp=require(_0x0f14('0x4'));var moment=require(_0x0f14('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0f14('0x6'));var sox=require('sox');var csv=require(_0x0f14('0x7'));var ejs=require(_0x0f14('0x8'));var fs=require('fs');var _=require(_0x0f14('0x9'));var squel=require(_0x0f14('0xa'));var crypto=require('crypto');var jsforce=require(_0x0f14('0xb'));var deskjs=require(_0x0f14('0xc'));var toCsv=require(_0x0f14('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f14('0xd'));var qs=require(_0x0f14('0xe'));var as=require(_0x0f14('0xf'));var hardwareService=require(_0x0f14('0x10'));var logger=require(_0x0f14('0x11'))(_0x0f14('0x12'));var utils=require(_0x0f14('0x13'));var config=require(_0x0f14('0x14'));var db=require(_0x0f14('0x15'))['db'];config[_0x0f14('0x16')]=_[_0x0f14('0x17')](config[_0x0f14('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f14('0x18'))(new Redis(config[_0x0f14('0x16')]));require(_0x0f14('0x19'))['register'](socket);var jayson=require(_0x0f14('0x1a'));var client=jayson[_0x0f14('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x5510df,_0x3bdc7e,_0x2ad607){if(_0x2ad607){var _0x5a2ff7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a2ff7['test'](_0x3bdc7e)){return _0x5510df;}else{throw new db['Sequelize'][(_0x0f14('0x1c'))](_0x0f14('0x1d'));}}else{return _0x5510df;}}function respondWithRpcPromise(_0x2fbd7b,_0x4ac1ca,_0x5bdedc,_0x232827){return new BPromise(function(_0x2c700d,_0x57be20){var _0x374371=_0x232827||client;return _0x374371[_0x0f14('0x1e')](_0x2fbd7b,_0x5bdedc)[_0x0f14('0x1f')](function(_0x22ce95){logger['info'](_0x0f14('0x20'),_0x4ac1ca,_0x0f14('0x21'));logger['debug'](_0x0f14('0x22'),_0x4ac1ca,_0x0f14('0x21'),JSON[_0x0f14('0x23')](_0x22ce95));if(_0x22ce95[_0x0f14('0x24')]){if(_0x22ce95[_0x0f14('0x24')][_0x0f14('0x25')]===0x1f4){logger[_0x0f14('0x24')](_0x0f14('0x20'),_0x4ac1ca,_0x22ce95[_0x0f14('0x24')][_0x0f14('0x26')]);return _0x57be20(_0x22ce95[_0x0f14('0x24')][_0x0f14('0x26')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4ac1ca,_0x22ce95['error'][_0x0f14('0x26')]);return _0x2c700d(_0x22ce95[_0x0f14('0x24')][_0x0f14('0x26')]);}else{logger[_0x0f14('0x27')]('ChatGroup,\x20%s,\x20%s',_0x4ac1ca,_0x0f14('0x21'));_0x2c700d(_0x22ce95['result'][_0x0f14('0x26')]);}})[_0x0f14('0x28')](function(_0xc73280){logger['error'](_0x0f14('0x20'),_0x4ac1ca,_0xc73280);_0x57be20(_0xc73280);});});}function respondWithStatusCode(_0x1d0fe2,_0x53328e){_0x53328e=_0x53328e||0xcc;return function(_0x2ba39f){if(_0x2ba39f){return _0x1d0fe2['sendStatus'](_0x53328e);}return _0x1d0fe2[_0x0f14('0x29')](_0x53328e)[_0x0f14('0x2a')]();};}function respondWithResult(_0x2bb32f,_0x70f547){_0x70f547=_0x70f547||0xc8;return function(_0x28e677){if(_0x28e677){return _0x2bb32f[_0x0f14('0x29')](_0x70f547)[_0x0f14('0x2b')](_0x28e677);}};}function respondWithFilteredResult(_0x42e781,_0x4b2480){return function(_0x407361){if(_0x407361){var _0x423a0c=_0x407361['count'],_0x129478=_0x4b2480[_0x0f14('0x2c')],_0x460d62=_0x4b2480[_0x0f14('0x2c')]+_0x4b2480[_0x0f14('0x2d')],_0x5103f3;if(_0x460d62>=_0x423a0c){_0x460d62=_0x423a0c;_0x5103f3=0xc8;}else{_0x5103f3=0xce;}_0x42e781[_0x0f14('0x29')](_0x5103f3);return _0x42e781[_0x0f14('0x2e')](_0x0f14('0x2f'),_0x129478+'-'+_0x460d62+'/'+_0x423a0c)['json'](_0x407361);}return null;};}function patchUpdates(_0x298100){return function(_0x19e728){try{jsonpatch[_0x0f14('0x30')](_0x19e728,_0x298100,!![]);}catch(_0x5f5145){return BPromise['reject'](_0x5f5145);}return _0x19e728['save']();};}function saveUpdates(_0x506fee,_0x467ed7){return function(_0x11affa){if(_0x11affa){return _0x11affa[_0x0f14('0x31')](_0x506fee)[_0x0f14('0x1f')](function(_0x24032a){return _0x24032a;});}return null;};}function removeEntity(_0x35ec15,_0x453d45){return function(_0x2a7dfa){if(_0x2a7dfa){return _0x2a7dfa[_0x0f14('0x32')]()[_0x0f14('0x1f')](function(){_0x35ec15['status'](0xcc)[_0x0f14('0x2a')]();});}};}function handleEntityNotFound(_0x553c59,_0x4130ae){return function(_0x494b37){if(!_0x494b37){_0x553c59['sendStatus'](0x194);}return _0x494b37;};}function handleError(_0x995a4e,_0x3d3e6c){_0x3d3e6c=_0x3d3e6c||0x1f4;return function(_0xb4feb4){logger[_0x0f14('0x24')](_0xb4feb4[_0x0f14('0x33')]);if(_0xb4feb4['name']){delete _0xb4feb4[_0x0f14('0x34')];}_0x995a4e['status'](_0x3d3e6c)[_0x0f14('0x35')](_0xb4feb4);};}exports[_0x0f14('0x36')]=function(_0x3d536b,_0x53ab19){var _0x1b2fcb={},_0x549c1a={},_0x12400a={'count':0x0,'rows':[]};var _0x1484e0=_[_0x0f14('0x37')](db[_0x0f14('0x38')]['rawAttributes'],function(_0xa50606){return{'name':_0xa50606[_0x0f14('0x39')],'type':_0xa50606[_0x0f14('0x3a')]['key']};});_0x549c1a['model']=_[_0x0f14('0x37')](_0x1484e0,_0x0f14('0x34'));_0x549c1a[_0x0f14('0x3b')]=_[_0x0f14('0x3c')](_0x3d536b['query']);_0x549c1a[_0x0f14('0x3d')]=_[_0x0f14('0x3e')](_0x549c1a[_0x0f14('0x3f')],_0x549c1a[_0x0f14('0x3b')]);_0x1b2fcb[_0x0f14('0x40')]=_[_0x0f14('0x3e')](_0x549c1a['model'],qs[_0x0f14('0x41')](_0x3d536b['query'][_0x0f14('0x41')]));_0x1b2fcb['attributes']=_0x1b2fcb[_0x0f14('0x40')][_0x0f14('0x42')]?_0x1b2fcb[_0x0f14('0x40')]:_0x549c1a[_0x0f14('0x3f')];if(!_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x43')](_0x0f14('0x44'))){_0x1b2fcb[_0x0f14('0x2d')]=qs[_0x0f14('0x2d')](_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x2d')]);_0x1b2fcb[_0x0f14('0x2c')]=qs[_0x0f14('0x2c')](_0x3d536b['query'][_0x0f14('0x2c')]);}_0x1b2fcb[_0x0f14('0x45')]=qs['sort'](_0x3d536b[_0x0f14('0x3b')]['sort']);_0x1b2fcb['where']=qs['filters'](_[_0x0f14('0x46')](_0x3d536b[_0x0f14('0x3b')],_0x549c1a['filters']),_0x1484e0);if(_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x47')]){_0x1b2fcb[_0x0f14('0x48')]=_[_0x0f14('0x49')](_0x1b2fcb[_0x0f14('0x48')],{'$or':_[_0x0f14('0x37')](_0x1484e0,function(_0x4f1554){if(_0x4f1554['type']!==_0x0f14('0x4a')){var _0x4c3f3f={};_0x4c3f3f[_0x4f1554[_0x0f14('0x34')]]={'$like':'%'+_0x3d536b['query'][_0x0f14('0x47')]+'%'};return _0x4c3f3f;}})});}_0x1b2fcb=_['merge']({},_0x1b2fcb,_0x3d536b['options']);var _0x414c46={'where':_0x1b2fcb[_0x0f14('0x48')]};return db['ChatGroup'][_0x0f14('0x4b')](_0x414c46)[_0x0f14('0x1f')](function(_0x2b389b){_0x12400a[_0x0f14('0x4b')]=_0x2b389b;if(_0x3d536b[_0x0f14('0x3b')][_0x0f14('0x4c')]){_0x1b2fcb[_0x0f14('0x4d')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x1b2fcb);})[_0x0f14('0x1f')](function(_0x723ec6){_0x12400a[_0x0f14('0x4e')]=_0x723ec6;return _0x12400a;})[_0x0f14('0x1f')](respondWithFilteredResult(_0x53ab19,_0x1b2fcb))[_0x0f14('0x28')](handleError(_0x53ab19,null));};exports[_0x0f14('0x4f')]=function(_0x56b77e,_0x2497e7){var _0x3afe79={'raw':!![],'where':{'id':_0x56b77e[_0x0f14('0x50')]['id']}},_0x34f3ea={};_0x34f3ea[_0x0f14('0x3f')]=_[_0x0f14('0x3c')](db[_0x0f14('0x38')]['rawAttributes']);_0x34f3ea[_0x0f14('0x3b')]=_[_0x0f14('0x3c')](_0x56b77e['query']);_0x34f3ea[_0x0f14('0x3d')]=_[_0x0f14('0x3e')](_0x34f3ea[_0x0f14('0x3f')],_0x34f3ea['query']);_0x3afe79[_0x0f14('0x40')]=_[_0x0f14('0x3e')](_0x34f3ea[_0x0f14('0x3f')],qs[_0x0f14('0x41')](_0x56b77e['query'][_0x0f14('0x41')]));_0x3afe79[_0x0f14('0x40')]=_0x3afe79['attributes'][_0x0f14('0x42')]?_0x3afe79[_0x0f14('0x40')]:_0x34f3ea[_0x0f14('0x3f')];if(_0x56b77e['query'][_0x0f14('0x4c')]){_0x3afe79[_0x0f14('0x4d')]=[{'all':!![]}];}_0x3afe79=_[_0x0f14('0x49')]({},_0x3afe79,_0x56b77e['options']);return db[_0x0f14('0x38')][_0x0f14('0x51')](_0x3afe79)['then'](handleEntityNotFound(_0x2497e7,null))[_0x0f14('0x1f')](respondWithResult(_0x2497e7,null))[_0x0f14('0x28')](handleError(_0x2497e7,null));};exports['create']=function(_0x9e28fe,_0x99be93){return db['ChatGroup'][_0x0f14('0x52')](_0x9e28fe[_0x0f14('0x53')],{})[_0x0f14('0x1f')](respondWithResult(_0x99be93,0xc9))['catch'](handleError(_0x99be93,null));};exports[_0x0f14('0x31')]=function(_0x2edb7f,_0x2e8847){if(_0x2edb7f[_0x0f14('0x53')]['id']){delete _0x2edb7f[_0x0f14('0x53')]['id'];}return db[_0x0f14('0x38')]['find']({'where':{'id':_0x2edb7f[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x2e8847,null))[_0x0f14('0x1f')](saveUpdates(_0x2edb7f['body'],null))[_0x0f14('0x1f')](respondWithResult(_0x2e8847,null))[_0x0f14('0x28')](handleError(_0x2e8847,null));};exports[_0x0f14('0x32')]=function(_0x339801,_0x2ea758){return db[_0x0f14('0x38')]['find']({'where':{'id':_0x339801[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x2ea758,null))[_0x0f14('0x1f')](removeEntity(_0x2ea758,null))[_0x0f14('0x28')](handleError(_0x2ea758,null));};exports[_0x0f14('0x54')]=function(_0x18db38,_0x232b44){return db[_0x0f14('0x38')]['describe']()[_0x0f14('0x1f')](respondWithResult(_0x232b44,null))[_0x0f14('0x28')](handleError(_0x232b44,null));};exports[_0x0f14('0x55')]=function(_0x1f6d49,_0x1a85ab,_0x4c0f34){return db[_0x0f14('0x56')][_0x0f14('0x4b')]({'where':{'ChatGroupId':_0x1f6d49[_0x0f14('0x50')]['id'],'ToId':_0x1f6d49[_0x0f14('0x57')]['id'],'read':![]}})[_0x0f14('0x1f')](function(_0x12c281){return{'id':_['toInteger'](_0x1f6d49[_0x0f14('0x50')]['id']),'count':_0x12c281};})['then'](respondWithResult(_0x1a85ab,null))[_0x0f14('0x28')](handleError(_0x1a85ab,null));};exports[_0x0f14('0x58')]=function(_0x13a191,_0x2efb8b,_0x5a890d){return db[_0x0f14('0x38')][_0x0f14('0x51')]({'where':{'id':_0x13a191[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x2efb8b,null))[_0x0f14('0x1f')](function(_0x5d352d){if(_0x5d352d){return _0x5d352d['addMembers'](_0x13a191['body'][_0x0f14('0x59')],_[_0x0f14('0x5a')](_0x13a191[_0x0f14('0x53')],[_0x0f14('0x59'),'id'])||{});}})['then'](respondWithResult(_0x2efb8b,null))[_0x0f14('0x28')](handleError(_0x2efb8b,null));};exports['getMembers']=function(_0x174098,_0xf77d19,_0x3ef989){var _0x5823e0={};var _0x1dcf03={};var _0x29024c;var _0x2371c8;return db[_0x0f14('0x38')][_0x0f14('0x5b')]({'where':{'id':_0x174098['params']['id']}})['then'](handleEntityNotFound(_0xf77d19,null))[_0x0f14('0x1f')](function(_0x180e28){if(_0x180e28){_0x29024c=_0x180e28;_0x1dcf03[_0x0f14('0x3f')]=_[_0x0f14('0x3c')](db[_0x0f14('0x5c')][_0x0f14('0x5d')]);_0x1dcf03[_0x0f14('0x3b')]=_['keys'](_0x174098[_0x0f14('0x3b')]);_0x1dcf03['filters']=_[_0x0f14('0x3e')](_0x1dcf03['model'],_0x1dcf03[_0x0f14('0x3b')]);_0x5823e0['attributes']=_[_0x0f14('0x3e')](_0x1dcf03[_0x0f14('0x3f')],qs[_0x0f14('0x41')](_0x174098[_0x0f14('0x3b')][_0x0f14('0x41')]));_0x5823e0[_0x0f14('0x40')]=_0x5823e0[_0x0f14('0x40')]['length']?_0x5823e0[_0x0f14('0x40')]:_0x1dcf03['model'];_0x5823e0[_0x0f14('0x45')]=qs[_0x0f14('0x5e')](_0x174098['query'][_0x0f14('0x5e')]);_0x5823e0[_0x0f14('0x48')]=qs[_0x0f14('0x3d')](_[_0x0f14('0x46')](_0x174098[_0x0f14('0x3b')],_0x1dcf03[_0x0f14('0x3d')]));if(_0x174098[_0x0f14('0x3b')][_0x0f14('0x47')]){_0x5823e0[_0x0f14('0x48')]=_['merge'](_0x5823e0['where'],{'$or':_['map'](_0x5823e0[_0x0f14('0x40')],function(_0x71d966){var _0x7c14bb={};_0x7c14bb[_0x71d966]={'$like':'%'+_0x174098[_0x0f14('0x3b')][_0x0f14('0x47')]+'%'};return _0x7c14bb;})});}_0x5823e0=_[_0x0f14('0x49')]({},_0x5823e0,_0x174098[_0x0f14('0x5f')]);return _0x29024c[_0x0f14('0x60')](_0x5823e0);}})[_0x0f14('0x1f')](function(_0x163eef){if(_0x163eef){_0x2371c8=_0x163eef[_0x0f14('0x42')];if(!_0x174098[_0x0f14('0x3b')][_0x0f14('0x43')](_0x0f14('0x44'))){_0x5823e0[_0x0f14('0x2d')]=qs['limit'](_0x174098[_0x0f14('0x3b')][_0x0f14('0x2d')]);_0x5823e0[_0x0f14('0x2c')]=qs[_0x0f14('0x2c')](_0x174098[_0x0f14('0x3b')][_0x0f14('0x2c')]);}return _0x29024c[_0x0f14('0x60')](_0x5823e0);}})[_0x0f14('0x1f')](function(_0x57694b){if(_0x57694b){return _0x57694b?{'count':_0x2371c8,'rows':_0x57694b}:null;}})[_0x0f14('0x1f')](respondWithResult(_0xf77d19,null))[_0x0f14('0x28')](handleError(_0xf77d19,null));};exports[_0x0f14('0x61')]=function(_0x4248bf,_0x43fc14,_0x2767b2){return db[_0x0f14('0x38')][_0x0f14('0x51')]({'where':{'id':_0x4248bf[_0x0f14('0x50')]['id']}})['then'](handleEntityNotFound(_0x43fc14,null))[_0x0f14('0x1f')](function(_0x5aacbd){if(_0x5aacbd){return _0x5aacbd[_0x0f14('0x61')](_0x4248bf['query'][_0x0f14('0x59')]);}})[_0x0f14('0x1f')](respondWithStatusCode(_0x43fc14,null))[_0x0f14('0x28')](handleError(_0x43fc14,null));};exports[_0x0f14('0x62')]=function(_0x3df8ce,_0x32a0d8,_0x495a8a){if(_0x3df8ce[_0x0f14('0x53')]['id']){delete _0x3df8ce[_0x0f14('0x53')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x3df8ce[_0x0f14('0x50')]['id']}})[_0x0f14('0x1f')](handleEntityNotFound(_0x32a0d8,null))['then'](function(_0x46cab2){if(_0x46cab2){_0x3df8ce[_0x0f14('0x53')][_0x0f14('0x63')]=_0x46cab2['id'];return db[_0x0f14('0x56')][_0x0f14('0x52')](_0x3df8ce[_0x0f14('0x53')]);}})[_0x0f14('0x1f')](respondWithResult(_0x32a0d8,null))['catch'](handleError(_0x32a0d8,null));};exports[_0x0f14('0x64')]=function(_0x2f7b47,_0x156ed2,_0x110e14){var _0x2727c8={};var _0x1f72a5={};var _0x10f802;var _0x2d6e5b;return db[_0x0f14('0x38')][_0x0f14('0x5b')]({'where':{'id':_0x2f7b47[_0x0f14('0x50')]['id']}})['then'](handleEntityNotFound(_0x156ed2,null))[_0x0f14('0x1f')](function(_0x46c487){if(_0x46c487){_0x10f802=_0x46c487;_0x1f72a5[_0x0f14('0x3f')]=_[_0x0f14('0x3c')](db[_0x0f14('0x56')]['rawAttributes']);_0x1f72a5[_0x0f14('0x3b')]=_[_0x0f14('0x3c')](_0x2f7b47[_0x0f14('0x3b')]);_0x1f72a5[_0x0f14('0x3d')]=_[_0x0f14('0x3e')](_0x1f72a5[_0x0f14('0x3f')],_0x1f72a5[_0x0f14('0x3b')]);_0x2727c8[_0x0f14('0x40')]=_['intersection'](_0x1f72a5[_0x0f14('0x3f')],qs[_0x0f14('0x41')](_0x2f7b47['query'][_0x0f14('0x41')]));_0x2727c8[_0x0f14('0x40')]=_0x2727c8[_0x0f14('0x40')][_0x0f14('0x42')]?_0x2727c8['attributes']:_0x1f72a5[_0x0f14('0x3f')];_0x2727c8[_0x0f14('0x45')]=qs[_0x0f14('0x5e')](_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x5e')]);_0x2727c8[_0x0f14('0x48')]=qs[_0x0f14('0x3d')](_[_0x0f14('0x46')](_0x2f7b47[_0x0f14('0x3b')],_0x1f72a5['filters']));if(_0x2f7b47['query'][_0x0f14('0x47')]){_0x2727c8[_0x0f14('0x48')]=_[_0x0f14('0x49')](_0x2727c8[_0x0f14('0x48')],{'$or':_[_0x0f14('0x37')](_0x2727c8[_0x0f14('0x40')],function(_0x34765e){var _0x3727ac={};_0x3727ac[_0x34765e]={'$like':'%'+_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x47')]+'%'};return _0x3727ac;})});}if(_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x65')]){var _0x2f1f4e=_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x65')][_0x0f14('0x66')](',');var _0x3dfa8e={};_0x3dfa8e[_0x2f1f4e[0x0]]={'$gte':moment(_0x2f1f4e[0x1])[_0x0f14('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2727c8[_0x0f14('0x48')]=_['merge'](_0x2727c8[_0x0f14('0x48')],_0x3dfa8e);}_0x2727c8=_['merge']({},_0x2727c8,_0x2f7b47[_0x0f14('0x5f')]);return _0x10f802[_0x0f14('0x64')](_0x2727c8);}})['then'](function(_0x3f6fbb){if(_0x3f6fbb){_0x2d6e5b=_0x3f6fbb[_0x0f14('0x42')];if(!_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x43')](_0x0f14('0x44'))){_0x2727c8['limit']=qs[_0x0f14('0x2d')](_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x2d')]);_0x2727c8[_0x0f14('0x2c')]=qs[_0x0f14('0x2c')](_0x2f7b47[_0x0f14('0x3b')][_0x0f14('0x2c')]);}return _0x10f802[_0x0f14('0x64')](_0x2727c8);}})[_0x0f14('0x1f')](function(_0x45aafc){if(_0x45aafc){return _0x45aafc?{'count':_0x2d6e5b,'rows':_0x45aafc}:null;}})[_0x0f14('0x1f')](respondWithResult(_0x156ed2,null))['catch'](handleError(_0x156ed2,null));}; \ No newline at end of file +var _0x709c=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filters','pick','where','map','VIRTUAL','merge','options','count','includeAll','findAll','rows','show','params','include','find','create','destroy','ChatInternalMessage','user','addMembers','omit','body','ids','getMembers','filter','ChatGroupId','findOne','sort','$gte','format','getMessages','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','update','then','end','stack','name','send','ChatGroup','rawAttributes','fieldName','type'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x709c,0x1bf));var _0xc709=function(_0x31548e,_0x1297be){_0x31548e=_0x31548e-0x0;var _0x129939=_0x709c[_0x31548e];return _0x129939;};'use strict';var pdf=require(_0xc709('0x0'));var emlformat=require(_0xc709('0x1'));var rimraf=require(_0xc709('0x2'));var zipdir=require(_0xc709('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc709('0x4'));var Mustache=require(_0xc709('0x5'));var util=require('util');var path=require(_0xc709('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc709('0x7'));var fs=require('fs');var _=require(_0xc709('0x8'));var squel=require('squel');var crypto=require(_0xc709('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc709('0xa'));var toCsv=require(_0xc709('0xb'));var querystring=require(_0xc709('0xc'));var Papa=require('papaparse');var Redis=require(_0xc709('0xd'));var authService=require(_0xc709('0xe'));var qs=require(_0xc709('0xf'));var as=require(_0xc709('0x10'));var hardwareService=require(_0xc709('0x11'));var logger=require(_0xc709('0x12'))(_0xc709('0x13'));var utils=require(_0xc709('0x14'));var config=require(_0xc709('0x15'));var db=require('../../mysqldb')['db'];config[_0xc709('0x16')]=_['defaults'](config['redis'],{'host':_0xc709('0x17'),'port':0x18eb});var socket=require(_0xc709('0x18'))(new Redis(config['redis']));require(_0xc709('0x19'))[_0xc709('0x1a')](socket);var jayson=require(_0xc709('0x1b'));var client=jayson['client'][_0xc709('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x141742,_0x40daa3,_0x3d2d07){if(_0x3d2d07){var _0x333ace=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x333ace[_0xc709('0x1d')](_0x40daa3)){return _0x141742;}else{throw new db['Sequelize'][(_0xc709('0x1e'))](_0xc709('0x1f'));}}else{return _0x141742;}}function respondWithRpcPromise(_0x432362,_0x360b,_0x2831fa,_0x3f7b7e){return new BPromise(function(_0x45adce,_0x4b7ddc){var _0x4a1c96=_0x3f7b7e||client;return _0x4a1c96['request'](_0x432362,_0x2831fa)['then'](function(_0x2b4caa){logger[_0xc709('0x20')](_0xc709('0x21'),_0x360b,_0xc709('0x22'));logger[_0xc709('0x23')](_0xc709('0x24'),_0x360b,_0xc709('0x22'),JSON['stringify'](_0x2b4caa));if(_0x2b4caa[_0xc709('0x25')]){if(_0x2b4caa[_0xc709('0x25')]['code']===0x1f4){logger[_0xc709('0x25')](_0xc709('0x21'),_0x360b,_0x2b4caa[_0xc709('0x25')][_0xc709('0x26')]);return _0x4b7ddc(_0x2b4caa[_0xc709('0x25')]['message']);}logger[_0xc709('0x25')](_0xc709('0x21'),_0x360b,_0x2b4caa[_0xc709('0x25')][_0xc709('0x26')]);return _0x45adce(_0x2b4caa[_0xc709('0x25')][_0xc709('0x26')]);}else{logger[_0xc709('0x20')](_0xc709('0x21'),_0x360b,'request\x20sent');_0x45adce(_0x2b4caa[_0xc709('0x27')][_0xc709('0x26')]);}})[_0xc709('0x28')](function(_0x5bd4cb){logger['error']('ChatGroup,\x20%s,\x20%s',_0x360b,_0x5bd4cb);_0x4b7ddc(_0x5bd4cb);});});}function respondWithStatusCode(_0x11fb4f,_0x47c0b3){_0x47c0b3=_0x47c0b3||0xcc;return function(_0x5eec15){if(_0x5eec15){return _0x11fb4f[_0xc709('0x29')](_0x47c0b3);}return _0x11fb4f['status'](_0x47c0b3)['end']();};}function respondWithResult(_0x1b9c86,_0x261192){_0x261192=_0x261192||0xc8;return function(_0x3fb183){if(_0x3fb183){return _0x1b9c86[_0xc709('0x2a')](_0x261192)[_0xc709('0x2b')](_0x3fb183);}};}function respondWithFilteredResult(_0x2cdd2e,_0x2a31e1){return function(_0x1f83f7){if(_0x1f83f7){var _0x474426=_0x1f83f7['count'],_0x3e9fb6=_0x2a31e1[_0xc709('0x2c')],_0x493ca1=_0x2a31e1['offset']+_0x2a31e1['limit'],_0x34e00b;if(_0x493ca1>=_0x474426){_0x493ca1=_0x474426;_0x34e00b=0xc8;}else{_0x34e00b=0xce;}_0x2cdd2e[_0xc709('0x2a')](_0x34e00b);return _0x2cdd2e['set'](_0xc709('0x2d'),_0x3e9fb6+'-'+_0x493ca1+'/'+_0x474426)['json'](_0x1f83f7);}return null;};}function patchUpdates(_0x38904c){return function(_0x1577ca){try{jsonpatch[_0xc709('0x2e')](_0x1577ca,_0x38904c,!![]);}catch(_0x5ec82f){return BPromise[_0xc709('0x2f')](_0x5ec82f);}return _0x1577ca['save']();};}function saveUpdates(_0x1b9a30,_0x71bd6){return function(_0x1ad166){if(_0x1ad166){return _0x1ad166[_0xc709('0x30')](_0x1b9a30)[_0xc709('0x31')](function(_0x4d52d8){return _0x4d52d8;});}return null;};}function removeEntity(_0x1d35da,_0x4f8e1c){return function(_0x43961f){if(_0x43961f){return _0x43961f['destroy']()[_0xc709('0x31')](function(){_0x1d35da[_0xc709('0x2a')](0xcc)[_0xc709('0x32')]();});}};}function handleEntityNotFound(_0x65d1d2,_0x1b2369){return function(_0x1cce20){if(!_0x1cce20){_0x65d1d2[_0xc709('0x29')](0x194);}return _0x1cce20;};}function handleError(_0x465ef8,_0x2eec76){_0x2eec76=_0x2eec76||0x1f4;return function(_0x185cbf){logger[_0xc709('0x25')](_0x185cbf[_0xc709('0x33')]);if(_0x185cbf[_0xc709('0x34')]){delete _0x185cbf['name'];}_0x465ef8['status'](_0x2eec76)[_0xc709('0x35')](_0x185cbf);};}exports['index']=function(_0x5bb29d,_0x37971c){var _0x38b1a9={},_0x101fcf={},_0x177690={'count':0x0,'rows':[]};var _0x4948c0=_['map'](db[_0xc709('0x36')][_0xc709('0x37')],function(_0x28103d){return{'name':_0x28103d[_0xc709('0x38')],'type':_0x28103d[_0xc709('0x39')][_0xc709('0x3a')]};});_0x101fcf[_0xc709('0x3b')]=_['map'](_0x4948c0,_0xc709('0x34'));_0x101fcf[_0xc709('0x3c')]=_[_0xc709('0x3d')](_0x5bb29d[_0xc709('0x3c')]);_0x101fcf['filters']=_['intersection'](_0x101fcf[_0xc709('0x3b')],_0x101fcf[_0xc709('0x3c')]);_0x38b1a9['attributes']=_[_0xc709('0x3e')](_0x101fcf[_0xc709('0x3b')],qs[_0xc709('0x3f')](_0x5bb29d[_0xc709('0x3c')][_0xc709('0x3f')]));_0x38b1a9[_0xc709('0x40')]=_0x38b1a9[_0xc709('0x40')][_0xc709('0x41')]?_0x38b1a9[_0xc709('0x40')]:_0x101fcf[_0xc709('0x3b')];if(!_0x5bb29d['query'][_0xc709('0x42')](_0xc709('0x43'))){_0x38b1a9[_0xc709('0x44')]=qs['limit'](_0x5bb29d[_0xc709('0x3c')]['limit']);_0x38b1a9[_0xc709('0x2c')]=qs[_0xc709('0x2c')](_0x5bb29d[_0xc709('0x3c')][_0xc709('0x2c')]);}_0x38b1a9[_0xc709('0x45')]=qs['sort'](_0x5bb29d[_0xc709('0x3c')]['sort']);_0x38b1a9['where']=qs[_0xc709('0x46')](_[_0xc709('0x47')](_0x5bb29d[_0xc709('0x3c')],_0x101fcf[_0xc709('0x46')]),_0x4948c0);if(_0x5bb29d[_0xc709('0x3c')]['filter']){_0x38b1a9[_0xc709('0x48')]=_['merge'](_0x38b1a9[_0xc709('0x48')],{'$or':_[_0xc709('0x49')](_0x4948c0,function(_0x2ceb40){if(_0x2ceb40['type']!==_0xc709('0x4a')){var _0x38a85d={};_0x38a85d[_0x2ceb40['name']]={'$like':'%'+_0x5bb29d[_0xc709('0x3c')]['filter']+'%'};return _0x38a85d;}})});}_0x38b1a9=_[_0xc709('0x4b')]({},_0x38b1a9,_0x5bb29d[_0xc709('0x4c')]);var _0x28969d={'where':_0x38b1a9['where']};return db[_0xc709('0x36')][_0xc709('0x4d')](_0x28969d)[_0xc709('0x31')](function(_0x176d9f){_0x177690[_0xc709('0x4d')]=_0x176d9f;if(_0x5bb29d[_0xc709('0x3c')][_0xc709('0x4e')]){_0x38b1a9['include']=[{'all':!![]}];}return db[_0xc709('0x36')][_0xc709('0x4f')](_0x38b1a9);})[_0xc709('0x31')](function(_0x4b2a40){_0x177690[_0xc709('0x50')]=_0x4b2a40;return _0x177690;})[_0xc709('0x31')](respondWithFilteredResult(_0x37971c,_0x38b1a9))[_0xc709('0x28')](handleError(_0x37971c,null));};exports[_0xc709('0x51')]=function(_0x1b4af8,_0x168721){var _0x3f9092={'raw':!![],'where':{'id':_0x1b4af8[_0xc709('0x52')]['id']}},_0x4c9824={};_0x4c9824[_0xc709('0x3b')]=_[_0xc709('0x3d')](db[_0xc709('0x36')][_0xc709('0x37')]);_0x4c9824[_0xc709('0x3c')]=_[_0xc709('0x3d')](_0x1b4af8[_0xc709('0x3c')]);_0x4c9824[_0xc709('0x46')]=_['intersection'](_0x4c9824['model'],_0x4c9824[_0xc709('0x3c')]);_0x3f9092[_0xc709('0x40')]=_[_0xc709('0x3e')](_0x4c9824[_0xc709('0x3b')],qs['fields'](_0x1b4af8[_0xc709('0x3c')]['fields']));_0x3f9092[_0xc709('0x40')]=_0x3f9092[_0xc709('0x40')][_0xc709('0x41')]?_0x3f9092[_0xc709('0x40')]:_0x4c9824[_0xc709('0x3b')];if(_0x1b4af8[_0xc709('0x3c')][_0xc709('0x4e')]){_0x3f9092[_0xc709('0x53')]=[{'all':!![]}];}_0x3f9092=_[_0xc709('0x4b')]({},_0x3f9092,_0x1b4af8[_0xc709('0x4c')]);return db[_0xc709('0x36')][_0xc709('0x54')](_0x3f9092)[_0xc709('0x31')](handleEntityNotFound(_0x168721,null))[_0xc709('0x31')](respondWithResult(_0x168721,null))[_0xc709('0x28')](handleError(_0x168721,null));};exports[_0xc709('0x55')]=function(_0x2cbb3f,_0x247ef8){return db[_0xc709('0x36')][_0xc709('0x55')](_0x2cbb3f['body'],{})['then'](respondWithResult(_0x247ef8,0xc9))['catch'](handleError(_0x247ef8,null));};exports[_0xc709('0x30')]=function(_0x4f5047,_0x54e54c){if(_0x4f5047['body']['id']){delete _0x4f5047['body']['id'];}return db['ChatGroup'][_0xc709('0x54')]({'where':{'id':_0x4f5047['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x54e54c,null))[_0xc709('0x31')](saveUpdates(_0x4f5047['body'],null))[_0xc709('0x31')](respondWithResult(_0x54e54c,null))[_0xc709('0x28')](handleError(_0x54e54c,null));};exports[_0xc709('0x56')]=function(_0x123a06,_0x6343f2){return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x123a06[_0xc709('0x52')]['id']}})['then'](handleEntityNotFound(_0x6343f2,null))['then'](removeEntity(_0x6343f2,null))[_0xc709('0x28')](handleError(_0x6343f2,null));};exports['describe']=function(_0x2099e2,_0x272c75){return db[_0xc709('0x36')]['describe']()['then'](respondWithResult(_0x272c75,null))[_0xc709('0x28')](handleError(_0x272c75,null));};exports['getUnread']=function(_0x2fed54,_0x2ded56,_0x3501c9){return db[_0xc709('0x57')][_0xc709('0x4d')]({'where':{'ChatGroupId':_0x2fed54[_0xc709('0x52')]['id'],'ToId':_0x2fed54[_0xc709('0x58')]['id'],'read':![]}})[_0xc709('0x31')](function(_0x325444){return{'id':_['toInteger'](_0x2fed54['params']['id']),'count':_0x325444};})[_0xc709('0x31')](respondWithResult(_0x2ded56,null))['catch'](handleError(_0x2ded56,null));};exports[_0xc709('0x59')]=function(_0x2e41ea,_0x1e1bc7,_0x5a19a1){return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x2e41ea[_0xc709('0x52')]['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x1e1bc7,null))[_0xc709('0x31')](function(_0x10f154){if(_0x10f154){return _0x10f154[_0xc709('0x59')](_0x2e41ea['body']['ids'],_[_0xc709('0x5a')](_0x2e41ea[_0xc709('0x5b')],[_0xc709('0x5c'),'id'])||{});}})[_0xc709('0x31')](respondWithResult(_0x1e1bc7,null))['catch'](handleError(_0x1e1bc7,null));};exports[_0xc709('0x5d')]=function(_0x881e42,_0x3ce18d,_0x3870b8){var _0x12fd0d={};var _0x2b4038={};var _0x5adb52;var _0x157fed;return db[_0xc709('0x36')]['findOne']({'where':{'id':_0x881e42['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x3ce18d,null))['then'](function(_0x179855){if(_0x179855){_0x5adb52=_0x179855;_0x2b4038[_0xc709('0x3b')]=_[_0xc709('0x3d')](db['User']['rawAttributes']);_0x2b4038['query']=_['keys'](_0x881e42[_0xc709('0x3c')]);_0x2b4038[_0xc709('0x46')]=_[_0xc709('0x3e')](_0x2b4038[_0xc709('0x3b')],_0x2b4038[_0xc709('0x3c')]);_0x12fd0d[_0xc709('0x40')]=_['intersection'](_0x2b4038[_0xc709('0x3b')],qs[_0xc709('0x3f')](_0x881e42[_0xc709('0x3c')][_0xc709('0x3f')]));_0x12fd0d['attributes']=_0x12fd0d[_0xc709('0x40')]['length']?_0x12fd0d['attributes']:_0x2b4038[_0xc709('0x3b')];_0x12fd0d['order']=qs['sort'](_0x881e42[_0xc709('0x3c')]['sort']);_0x12fd0d['where']=qs[_0xc709('0x46')](_[_0xc709('0x47')](_0x881e42[_0xc709('0x3c')],_0x2b4038[_0xc709('0x46')]));if(_0x881e42[_0xc709('0x3c')][_0xc709('0x5e')]){_0x12fd0d[_0xc709('0x48')]=_[_0xc709('0x4b')](_0x12fd0d[_0xc709('0x48')],{'$or':_[_0xc709('0x49')](_0x12fd0d[_0xc709('0x40')],function(_0x176bbb){var _0x4d73d7={};_0x4d73d7[_0x176bbb]={'$like':'%'+_0x881e42[_0xc709('0x3c')][_0xc709('0x5e')]+'%'};return _0x4d73d7;})});}_0x12fd0d=_['merge']({},_0x12fd0d,_0x881e42[_0xc709('0x4c')]);return _0x5adb52[_0xc709('0x5d')](_0x12fd0d);}})['then'](function(_0x460871){if(_0x460871){_0x157fed=_0x460871[_0xc709('0x41')];if(!_0x881e42[_0xc709('0x3c')][_0xc709('0x42')](_0xc709('0x43'))){_0x12fd0d[_0xc709('0x44')]=qs[_0xc709('0x44')](_0x881e42[_0xc709('0x3c')][_0xc709('0x44')]);_0x12fd0d[_0xc709('0x2c')]=qs[_0xc709('0x2c')](_0x881e42[_0xc709('0x3c')]['offset']);}return _0x5adb52['getMembers'](_0x12fd0d);}})[_0xc709('0x31')](function(_0x502368){if(_0x502368){return _0x502368?{'count':_0x157fed,'rows':_0x502368}:null;}})[_0xc709('0x31')](respondWithResult(_0x3ce18d,null))[_0xc709('0x28')](handleError(_0x3ce18d,null));};exports['removeMembers']=function(_0x1453a8,_0x3bec59,_0x109350){return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x1453a8['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x3bec59,null))[_0xc709('0x31')](function(_0x25102b){if(_0x25102b){return _0x25102b['removeMembers'](_0x1453a8[_0xc709('0x3c')]['ids']);}})[_0xc709('0x31')](respondWithStatusCode(_0x3bec59,null))[_0xc709('0x28')](handleError(_0x3bec59,null));};exports['addMessage']=function(_0x2ddf54,_0x53abb9,_0x16b80f){if(_0x2ddf54['body']['id']){delete _0x2ddf54[_0xc709('0x5b')]['id'];}return db[_0xc709('0x36')][_0xc709('0x54')]({'where':{'id':_0x2ddf54['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x53abb9,null))['then'](function(_0x455724){if(_0x455724){_0x2ddf54['body'][_0xc709('0x5f')]=_0x455724['id'];return db[_0xc709('0x57')][_0xc709('0x55')](_0x2ddf54['body']);}})['then'](respondWithResult(_0x53abb9,null))[_0xc709('0x28')](handleError(_0x53abb9,null));};exports['getMessages']=function(_0x22f2b0,_0x3e930d,_0x461462){var _0x396ffa={};var _0x3caefd={};var _0x4763f9;var _0x344fbe;return db[_0xc709('0x36')][_0xc709('0x60')]({'where':{'id':_0x22f2b0['params']['id']}})[_0xc709('0x31')](handleEntityNotFound(_0x3e930d,null))[_0xc709('0x31')](function(_0x4e94a2){if(_0x4e94a2){_0x4763f9=_0x4e94a2;_0x3caefd[_0xc709('0x3b')]=_[_0xc709('0x3d')](db[_0xc709('0x57')][_0xc709('0x37')]);_0x3caefd[_0xc709('0x3c')]=_[_0xc709('0x3d')](_0x22f2b0[_0xc709('0x3c')]);_0x3caefd['filters']=_[_0xc709('0x3e')](_0x3caefd[_0xc709('0x3b')],_0x3caefd[_0xc709('0x3c')]);_0x396ffa[_0xc709('0x40')]=_[_0xc709('0x3e')](_0x3caefd[_0xc709('0x3b')],qs[_0xc709('0x3f')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x3f')]));_0x396ffa[_0xc709('0x40')]=_0x396ffa[_0xc709('0x40')][_0xc709('0x41')]?_0x396ffa[_0xc709('0x40')]:_0x3caefd[_0xc709('0x3b')];_0x396ffa['order']=qs[_0xc709('0x61')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x61')]);_0x396ffa[_0xc709('0x48')]=qs[_0xc709('0x46')](_[_0xc709('0x47')](_0x22f2b0['query'],_0x3caefd[_0xc709('0x46')]));if(_0x22f2b0[_0xc709('0x3c')][_0xc709('0x5e')]){_0x396ffa['where']=_['merge'](_0x396ffa[_0xc709('0x48')],{'$or':_['map'](_0x396ffa[_0xc709('0x40')],function(_0x48e992){var _0xe35953={};_0xe35953[_0x48e992]={'$like':'%'+_0x22f2b0[_0xc709('0x3c')][_0xc709('0x5e')]+'%'};return _0xe35953;})});}if(_0x22f2b0[_0xc709('0x3c')][_0xc709('0x62')]){var _0x239e66=_0x22f2b0[_0xc709('0x3c')][_0xc709('0x62')]['split'](',');var _0x4560cb={};_0x4560cb[_0x239e66[0x0]]={'$gte':moment(_0x239e66[0x1])[_0xc709('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x396ffa[_0xc709('0x48')]=_[_0xc709('0x4b')](_0x396ffa[_0xc709('0x48')],_0x4560cb);}_0x396ffa=_['merge']({},_0x396ffa,_0x22f2b0[_0xc709('0x4c')]);return _0x4763f9[_0xc709('0x64')](_0x396ffa);}})[_0xc709('0x31')](function(_0x3e6042){if(_0x3e6042){_0x344fbe=_0x3e6042['length'];if(!_0x22f2b0[_0xc709('0x3c')][_0xc709('0x42')](_0xc709('0x43'))){_0x396ffa[_0xc709('0x44')]=qs[_0xc709('0x44')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x44')]);_0x396ffa[_0xc709('0x2c')]=qs[_0xc709('0x2c')](_0x22f2b0[_0xc709('0x3c')][_0xc709('0x2c')]);}return _0x4763f9['getMessages'](_0x396ffa);}})[_0xc709('0x31')](function(_0x1e0bc4){if(_0x1e0bc4){return _0x1e0bc4?{'count':_0x344fbe,'rows':_0x1e0bc4}:null;}})[_0xc709('0x31')](respondWithResult(_0x3e930d,null))[_0xc709('0x28')](handleError(_0x3e930d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 3b876a5..e9ca31e 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xadb5,0xad));var _0x5adb=function(_0x302391,_0x409b4a){_0x302391=_0x302391-0x0;var _0x3674a5=_0xadb5[_0x302391];return _0x3674a5;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0xadb5,0xad));var _0x5adb=function(_0x45f525,_0x2aa935){_0x45f525=_0x45f525-0x0;var _0x22cba7=_0xadb5[_0x45f525];return _0x22cba7;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c9d341c..32f6074 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 _0x6b8f=['exports','define','ChatGroup','chat_groups','util','api','request-promise','path','../../config/environment','./chatGroup.attributes'];(function(_0x3da36b,_0x1e1878){var _0x40f385=function(_0xd6dc8a){while(--_0xd6dc8a){_0x3da36b['push'](_0x3da36b['shift']());}};_0x40f385(++_0x1e1878);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x539c3f,_0x12a6c1){_0x539c3f=_0x539c3f-0x0;var _0x14daf7=_0x6b8f[_0x539c3f];return _0x14daf7;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2e=['./chatGroup.attributes','chat_groups','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x58cfdf,_0x2109de){var _0x478001=function(_0x1ccb1f){while(--_0x1ccb1f){_0x58cfdf['push'](_0x58cfdf['shift']());}};_0x478001(++_0x2109de);}(_0xfd2e,0x6e));var _0xefd2=function(_0x5f1e6a,_0x46a513){_0x5f1e6a=_0x5f1e6a-0x0;var _0x2a5a41=_0xfd2e[_0x5f1e6a];return _0x2a5a41;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('ChatGroup',attributes,{'tableName':_0xefd2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index d1cb7eb..6636a3c 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 _0x8b31=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b31,0x132));var _0x18b3=function(_0x494653,_0x324945){_0x494653=_0x494653-0x0;var _0x14eb14=_0x8b31[_0x494653];return _0x14eb14;};'use strict';var _=require(_0x18b3('0x0'));var util=require(_0x18b3('0x1'));var moment=require('moment');var BPromise=require(_0x18b3('0x2'));var rs=require(_0x18b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18b3('0x4'))['db'];var utils=require(_0x18b3('0x5'));var logger=require(_0x18b3('0x6'))(_0x18b3('0x7'));var config=require(_0x18b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18b3('0x9')][_0x18b3('0xa')]({'port':0x232a});config[_0x18b3('0xb')]=_[_0x18b3('0xc')](config['redis'],{'host':_0x18b3('0xd'),'port':0x18eb});var socket=require(_0x18b3('0xe'))(new Redis(config[_0x18b3('0xb')]));require('./chatGroup.socket')[_0x18b3('0xf')](socket);function respondWithRpcPromise(_0x3bee19,_0x11c13c,_0x33282a){return new BPromise(function(_0x1df1f7,_0x5755f9){return client[_0x18b3('0x10')](_0x3bee19,_0x33282a)[_0x18b3('0x11')](function(_0x4f839b){logger[_0x18b3('0x12')](_0x18b3('0x13'),_0x11c13c,_0x18b3('0x14'));logger[_0x18b3('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x11c13c,_0x18b3('0x14'),JSON[_0x18b3('0x16')](_0x4f839b));if(_0x4f839b[_0x18b3('0x17')]){if(_0x4f839b[_0x18b3('0x17')][_0x18b3('0x18')]===0x1f4){logger[_0x18b3('0x17')]('ChatGroup,\x20%s,\x20%s',_0x11c13c,_0x4f839b[_0x18b3('0x17')][_0x18b3('0x19')]);return _0x5755f9(_0x4f839b[_0x18b3('0x17')][_0x18b3('0x19')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x11c13c,_0x4f839b[_0x18b3('0x17')]['message']);return _0x1df1f7(_0x4f839b[_0x18b3('0x17')][_0x18b3('0x19')]);}else{logger[_0x18b3('0x12')](_0x18b3('0x13'),_0x11c13c,_0x18b3('0x14'));_0x1df1f7(_0x4f839b['result'][_0x18b3('0x19')]);}})[_0x18b3('0x1a')](function(_0x295370){logger[_0x18b3('0x17')](_0x18b3('0x13'),_0x11c13c,_0x295370);_0x5755f9(_0x295370);});});} \ No newline at end of file +var _0x1ab6=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x506c08,_0x2b271f){var _0x4ea6fa=function(_0x4fb4f9){while(--_0x4fb4f9){_0x506c08['push'](_0x506c08['shift']());}};_0x4ea6fa(++_0x2b271f);}(_0x1ab6,0x76));var _0x61ab=function(_0x2ef476,_0x2089be){_0x2ef476=_0x2ef476-0x0;var _0x347e5a=_0x1ab6[_0x2ef476];return _0x347e5a;};'use strict';var _=require(_0x61ab('0x0'));var util=require(_0x61ab('0x1'));var moment=require('moment');var BPromise=require(_0x61ab('0x2'));var rs=require(_0x61ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x61ab('0x5'))('rpc');var config=require(_0x61ab('0x6'));var jayson=require(_0x61ab('0x7'));var client=jayson['client'][_0x61ab('0x8')]({'port':0x232a});config[_0x61ab('0x9')]=_[_0x61ab('0xa')](config[_0x61ab('0x9')],{'host':_0x61ab('0xb'),'port':0x18eb});var socket=require(_0x61ab('0xc'))(new Redis(config[_0x61ab('0x9')]));require('./chatGroup.socket')[_0x61ab('0xd')](socket);function respondWithRpcPromise(_0x48cb34,_0x360ab2,_0x510772){return new BPromise(function(_0x580961,_0x318ab4){return client[_0x61ab('0xe')](_0x48cb34,_0x510772)[_0x61ab('0xf')](function(_0x57e573){logger[_0x61ab('0x10')]('ChatGroup,\x20%s,\x20%s',_0x360ab2,_0x61ab('0x11'));logger['debug'](_0x61ab('0x12'),_0x360ab2,_0x61ab('0x11'),JSON[_0x61ab('0x13')](_0x57e573));if(_0x57e573[_0x61ab('0x14')]){if(_0x57e573[_0x61ab('0x14')]['code']===0x1f4){logger[_0x61ab('0x14')]('ChatGroup,\x20%s,\x20%s',_0x360ab2,_0x57e573[_0x61ab('0x14')][_0x61ab('0x15')]);return _0x318ab4(_0x57e573[_0x61ab('0x14')][_0x61ab('0x15')]);}logger['error'](_0x61ab('0x16'),_0x360ab2,_0x57e573[_0x61ab('0x14')][_0x61ab('0x15')]);return _0x580961(_0x57e573[_0x61ab('0x14')]['message']);}else{logger['info'](_0x61ab('0x16'),_0x360ab2,_0x61ab('0x11'));_0x580961(_0x57e573[_0x61ab('0x17')][_0x61ab('0x15')]);}})[_0x61ab('0x18')](function(_0x330ac8){logger[_0x61ab('0x14')](_0x61ab('0x16'),_0x360ab2,_0x330ac8);_0x318ab4(_0x330ac8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 4d32800..f726d0f 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 _0xddbe=['removeListener','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x1fbc06,_0x4cfe7a){var _0x143c60=function(_0x26ad66){while(--_0x26ad66){_0x1fbc06['push'](_0x1fbc06['shift']());}};_0x143c60(++_0x4cfe7a);}(_0xddbe,0xc0));var _0xeddb=function(_0x56722f,_0x168759){_0x56722f=_0x56722f-0x0;var _0x1176ff=_0xddbe[_0x56722f];return _0x1176ff;};'use strict';var ChatGroupEvents=require(_0xeddb('0x0'));var events=['save',_0xeddb('0x1'),_0xeddb('0x2')];function createListener(_0x312f1e,_0x1c89e7){return function(_0x54ec0b){_0x1c89e7[_0xeddb('0x3')](_0x312f1e,_0x54ec0b);};}function removeListener(_0x41e326,_0x4e61d2){return function(){ChatGroupEvents[_0xeddb('0x4')](_0x41e326,_0x4e61d2);};}exports['register']=function(_0x145074){for(var _0x499f25=0x0,_0x4d756b=events[_0xeddb('0x5')];_0x499f25<_0x4d756b;_0x499f25++){var _0x23cc09=events[_0x499f25];var _0x57a75c=createListener(_0xeddb('0x6')+_0x23cc09,_0x145074);ChatGroupEvents['on'](_0x23cc09,_0x57a75c);}}; \ No newline at end of file +var _0xbfb4=['register','length','./chatGroup.events','save','remove','removeListener'];(function(_0x336c1c,_0x3d4c73){var _0x520ffc=function(_0x50cef7){while(--_0x50cef7){_0x336c1c['push'](_0x336c1c['shift']());}};_0x520ffc(++_0x3d4c73);}(_0xbfb4,0x146));var _0x4bfb=function(_0x530937,_0x5ad1b9){_0x530937=_0x530937-0x0;var _0xdc2b2a=_0xbfb4[_0x530937];return _0xdc2b2a;};'use strict';var ChatGroupEvents=require(_0x4bfb('0x0'));var events=[_0x4bfb('0x1'),_0x4bfb('0x2'),'update'];function createListener(_0x3f3541,_0x3ddcd8){return function(_0x46ccb8){_0x3ddcd8['emit'](_0x3f3541,_0x46ccb8);};}function removeListener(_0x3ab54b,_0xf84cdc){return function(){ChatGroupEvents[_0x4bfb('0x3')](_0x3ab54b,_0xf84cdc);};}exports[_0x4bfb('0x4')]=function(_0x2bcd11){for(var _0x2dc086=0x0,_0x1510a1=events[_0x4bfb('0x5')];_0x2dc086<_0x1510a1;_0x2dc086++){var _0x54493d=events[_0x2dc086];var _0x23308d=createListener('chatGroup:'+_0x54493d,_0x2bcd11);ChatGroupEvents['on'](_0x54493d,_0x23308d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a124011..a9d7d92 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 _0x4707=['index','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMessage','update','delete','destroy','removeMembers','util','path','connect-timeout','express','../../components/auth/service','./chatGroup.controller','get'];(function(_0x4e23dd,_0x5eb415){var _0x272cc9=function(_0x63cf55){while(--_0x63cf55){_0x4e23dd['push'](_0x4e23dd['shift']());}};_0x272cc9(++_0x5eb415);}(_0x4707,0x71));var _0x7470=function(_0x2db1c5,_0x10ad29){_0x2db1c5=_0x2db1c5-0x0;var _0xd9a8a=_0x4707[_0x2db1c5];return _0xd9a8a;};'use strict';var multer=require('multer');var util=require(_0x7470('0x0'));var path=require(_0x7470('0x1'));var timeout=require(_0x7470('0x2'));var express=require(_0x7470('0x3'));var router=express['Router']();var auth=require(_0x7470('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7470('0x5'));router[_0x7470('0x6')]('/',auth['isAuthenticated'](),controller[_0x7470('0x7')]);router[_0x7470('0x6')](_0x7470('0x8'),auth[_0x7470('0x9')](),controller['describe']);router[_0x7470('0x6')](_0x7470('0xa'),auth['isAuthenticated'](),controller[_0x7470('0xb')]);router[_0x7470('0x6')](_0x7470('0xc'),auth[_0x7470('0x9')](),controller[_0x7470('0xd')]);router[_0x7470('0x6')]('/:id/members',auth[_0x7470('0x9')](),controller[_0x7470('0xe')]);router['get'](_0x7470('0xf'),auth['isAuthenticated'](),controller[_0x7470('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7470('0x11')](_0x7470('0x12'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0x7470('0xf'),auth['isAuthenticated'](),controller[_0x7470('0x13')]);router['put'](_0x7470('0xa'),auth[_0x7470('0x9')](),controller[_0x7470('0x14')]);router[_0x7470('0x15')](_0x7470('0xa'),auth['isAuthenticated'](),controller[_0x7470('0x16')]);router[_0x7470('0x15')](_0x7470('0x12'),auth['isAuthenticated'](),controller[_0x7470('0x17')]);module['exports']=router; \ No newline at end of file +var _0xcc32=['destroy','removeMembers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','getMessages','post','/:id/messages','addMessage','put','update','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcc32,0x162));var _0x2cc3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcc32[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x2cc3('0x0'));var util=require(_0x2cc3('0x1'));var path=require('path');var timeout=require(_0x2cc3('0x2'));var express=require(_0x2cc3('0x3'));var router=express['Router']();var auth=require(_0x2cc3('0x4'));var interaction=require(_0x2cc3('0x5'));var config=require(_0x2cc3('0x6'));var controller=require('./chatGroup.controller');router[_0x2cc3('0x7')]('/',auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x9')]);router[_0x2cc3('0x7')](_0x2cc3('0xa'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0xb')]);router[_0x2cc3('0x7')](_0x2cc3('0xc'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0xd')]);router[_0x2cc3('0x7')]('/:id/unread',auth['isAuthenticated'](),controller[_0x2cc3('0xe')]);router['get'](_0x2cc3('0xf'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x10')]);router[_0x2cc3('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2cc3('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2cc3('0x12')]('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x2cc3('0x12')](_0x2cc3('0x13'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x14')]);router[_0x2cc3('0x15')](_0x2cc3('0xc'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x16')]);router[_0x2cc3('0x17')](_0x2cc3('0xc'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x18')]);router[_0x2cc3('0x17')](_0x2cc3('0xf'),auth[_0x2cc3('0x8')](),controller[_0x2cc3('0x19')]);module[_0x2cc3('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 953ce03..ac3fba6 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 _0x8806=['ENUM','TEXT','STRING','DATE','out','sequelize','BOOLEAN','INTEGER'];(function(_0x5b04a1,_0x389abc){var _0x7abfae=function(_0x2ad898){while(--_0x2ad898){_0x5b04a1['push'](_0x5b04a1['shift']());}};_0x7abfae(++_0x389abc);}(_0x8806,0xbd));var _0x6880=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x8806[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x6880('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6880('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6880('0x2')]},'ratingType':{'type':Sequelize[_0x6880('0x3')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x6880('0x4')]},'mailTranscript':{'type':Sequelize[_0x6880('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6880('0x6')]},'disposition':{'type':Sequelize[_0x6880('0x5')]},'note':{'type':Sequelize[_0x6880('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6880('0x5')]},'deviceModel':{'type':Sequelize[_0x6880('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6880('0x5')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x6880('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6880('0x3')]('in',_0x6880('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6880('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x6880('0x4')]}}; \ No newline at end of file +var _0x427b=['thumb','TEXT','STRING','DATE','long','exports','INTEGER','ENUM','star'];(function(_0x1b87c3,_0xe13126){var _0x59f3cc=function(_0x5a9967){while(--_0x5a9967){_0x1b87c3['push'](_0x1b87c3['shift']());}};_0x59f3cc(++_0xe13126);}(_0x427b,0xb0));var _0xb427=function(_0x39de60,_0x86aed9){_0x39de60=_0x39de60-0x0;var _0x484194=_0x427b[_0x39de60];return _0x484194;};'use strict';var Sequelize=require('sequelize');module[_0xb427('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb427('0x1')]},'ratingType':{'type':Sequelize[_0xb427('0x2')](_0xb427('0x3'),_0xb427('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xb427('0x5')]},'pathTranscript':{'type':Sequelize[_0xb427('0x5')]},'mailTranscript':{'type':Sequelize[_0xb427('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb427('0x7')]},'disposition':{'type':Sequelize[_0xb427('0x6')]},'note':{'type':Sequelize[_0xb427('0x6')]},'browserName':{'type':Sequelize[_0xb427('0x6')]},'browserVersion':{'type':Sequelize[_0xb427('0x6')]},'osName':{'type':Sequelize[_0xb427('0x6')]},'osVersion':{'type':Sequelize[_0xb427('0x6')]},'deviceModel':{'type':Sequelize[_0xb427('0x6')]},'deviceVendor':{'type':Sequelize[_0xb427('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xb427('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xb427('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xb427('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xb427('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ec8a562..94bc39f 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 _0x0295=['ContactId','buildExpression','text','start','Tag','union','operator','UserId','some','compact','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','rawAttributes','includeAll','merge','options','create','body','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','addMessage','ids','getMessages','include','getMyMessages','secret','includeAgent','addTags','setTags','omit','spread','findAll','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','Account','Owner','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','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','from','tools_tags','u.id','field','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x32a8a8,_0x340cd5){var _0x25837c=function(_0x4c81ec){while(--_0x4c81ec){_0x32a8a8['push'](_0x32a8a8['shift']());}};_0x25837c(++_0x340cd5);}(_0x0295,0x1f0));var _0x5029=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0295[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var db=require('../../mysqldb')['db'];config[_0x5029('0x14')]=_[_0x5029('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0x16'))[_0x5029('0x17')](socket);var jayson=require(_0x5029('0x18'));var client=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232b});var client9004=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x317c20,_0x10bf55,_0x326923){if(_0x326923){var _0x457c73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x457c73[_0x5029('0x1b')](_0x10bf55)){return _0x317c20;}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))](_0x5029('0x1e'));}}else{return _0x317c20;}}function respondWithRpcPromise(_0x4f7ab4,_0x1ed567,_0x31a155,_0x35de81){return new BPromise(function(_0x4902f3,_0x8cea01){var _0x5e115f=_0x35de81||client;return _0x5e115f[_0x5029('0x1f')](_0x4f7ab4,_0x31a155)['then'](function(_0x226a5c){logger['info'](_0x5029('0x20'),_0x1ed567,_0x5029('0x21'));logger[_0x5029('0x22')](_0x5029('0x23'),_0x1ed567,'request\x20sent',JSON['stringify'](_0x226a5c));if(_0x226a5c[_0x5029('0x24')]){if(_0x226a5c['error'][_0x5029('0x25')]===0x1f4){logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x226a5c[_0x5029('0x24')][_0x5029('0x26')]);return _0x8cea01(_0x226a5c[_0x5029('0x24')][_0x5029('0x26')]);}logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x226a5c['error']['message']);return _0x4902f3(_0x226a5c['error'][_0x5029('0x26')]);}else{logger[_0x5029('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x1ed567,'request\x20sent');_0x4902f3(_0x226a5c[_0x5029('0x28')][_0x5029('0x26')]);}})[_0x5029('0x29')](function(_0x5527fc){logger[_0x5029('0x24')](_0x5029('0x20'),_0x1ed567,_0x5527fc);_0x8cea01(_0x5527fc);});});}function respondWithStatusCode(_0x5e45c4,_0x2b6d99){_0x2b6d99=_0x2b6d99||0xcc;return function(_0x31f0a0){if(_0x31f0a0){return _0x5e45c4[_0x5029('0x2a')](_0x2b6d99);}return _0x5e45c4['status'](_0x2b6d99)[_0x5029('0x2b')]();};}function respondWithResult(_0x251f99,_0xe5313e){_0xe5313e=_0xe5313e||0xc8;return function(_0x4b6f92){if(_0x4b6f92){return _0x251f99[_0x5029('0x2c')](_0xe5313e)[_0x5029('0x2d')](_0x4b6f92);}};}function respondWithFilteredResult(_0x4cc16a,_0x1d79b9){return function(_0x25032b){if(_0x25032b){var _0x4434ff=_0x25032b[_0x5029('0x2e')],_0x1c3dd9=_0x1d79b9[_0x5029('0x2f')],_0x196830=_0x1d79b9[_0x5029('0x2f')]+_0x1d79b9[_0x5029('0x30')],_0x2a1ed6;if(_0x196830>=_0x4434ff){_0x196830=_0x4434ff;_0x2a1ed6=0xc8;}else{_0x2a1ed6=0xce;}_0x4cc16a[_0x5029('0x2c')](_0x2a1ed6);return _0x4cc16a[_0x5029('0x31')]('Content-Range',_0x1c3dd9+'-'+_0x196830+'/'+_0x4434ff)[_0x5029('0x2d')](_0x25032b);}return null;};}function patchUpdates(_0x5cb04b){return function(_0x31c621){try{jsonpatch['apply'](_0x31c621,_0x5cb04b,!![]);}catch(_0x48f387){return BPromise[_0x5029('0x32')](_0x48f387);}return _0x31c621[_0x5029('0x33')]();};}function saveUpdates(_0x1f9173,_0x4b7330){return function(_0x2a1535){if(_0x2a1535){return _0x2a1535[_0x5029('0x34')](_0x1f9173)[_0x5029('0x35')](function(_0x29c59a){return _0x29c59a;});}return null;};}function removeEntity(_0x1bb896,_0x4513b9){return function(_0x46ec59){if(_0x46ec59){return _0x46ec59[_0x5029('0x36')]()[_0x5029('0x35')](function(){_0x1bb896['status'](0xcc)[_0x5029('0x2b')]();});}};}function handleEntityNotFound(_0xa4a432,_0xc110e8){return function(_0x1b3817){if(!_0x1b3817){_0xa4a432['sendStatus'](0x194);}return _0x1b3817;};}function handleError(_0x184b8d,_0x388cca){_0x388cca=_0x388cca||0x1f4;return function(_0x3e2d88){logger['error'](_0x3e2d88['stack']);if(_0x3e2d88[_0x5029('0x37')]){delete _0x3e2d88[_0x5029('0x37')];}_0x184b8d['status'](_0x388cca)['send'](_0x3e2d88);};}function getInteractionUsers(_0x9656f2,_0x157969){return new BPromise(function(_0x270d66,_0x3210cb){try{if(_0x157969[_0x9656f2['id']]){_0x9656f2[_0x5029('0x38')]=_[_0x5029('0x39')](_0x157969[_0x9656f2['id']],function(_0x3cb84e){return{'id':_0x3cb84e['id'],'fullname':_0x3cb84e[_0x5029('0x3a')]};});}}catch(_0x10eb75){_0x3210cb(_0x10eb75);}_0x270d66(_0x9656f2);});}function getInteractionTags(_0x3effa4,_0x3e5b67){return new BPromise(function(_0xbdb3fa,_0x46314a){try{if(_0x3effa4[_0x5029('0x3b')]){_0x3effa4['Tags']=[];_0x3effa4['TagIds'][_0x5029('0x3c')](',')[_0x5029('0x3d')](function(_0x423ed1){_0x3effa4['Tags'][_0x5029('0x3e')](_0x3e5b67[_0x423ed1]);});}delete _0x3effa4[_0x5029('0x3b')];}catch(_0x52572a){_0x46314a(_0x52572a);}_0xbdb3fa(_0x3effa4);});}function updateChatInteraction(_0x247789,_0x4c3e11,_0x506f0d){return new BPromise(function(_0x5653cb,_0x2a6286){return getInteractionUsers(_0x247789,_0x506f0d)[_0x5029('0x35')](function(_0x24a18d){return getInteractionTags(_0x24a18d,_0x4c3e11);})[_0x5029('0x35')](function(_0x346fd9){_0x5653cb(_0x346fd9);})[_0x5029('0x29')](function(_0x4b2219){_0x2a6286(_0x4b2219);});});}exports[_0x5029('0x3f')]=function(_0x2ae047,_0x5a3e4d){var _0x103dfb={},_0x236455={},_0x1e040d={'count':0x0,'rows':[]};var _0x1edc00=_[_0x5029('0x39')](db[_0x5029('0x40')]['rawAttributes'],function(_0x259db8){return{'name':_0x259db8[_0x5029('0x41')],'type':_0x259db8[_0x5029('0x42')][_0x5029('0x43')]};});_0x236455[_0x5029('0x44')]=_['map'](_0x1edc00,_0x5029('0x37'));_0x236455[_0x5029('0x45')]=_[_0x5029('0x46')](_0x2ae047[_0x5029('0x45')]);_0x236455[_0x5029('0x47')]=_[_0x5029('0x48')](_0x236455[_0x5029('0x44')],_0x236455[_0x5029('0x45')]);_0x103dfb[_0x5029('0x49')]=_['intersection'](_0x236455[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x2ae047[_0x5029('0x45')][_0x5029('0x4a')]));_0x103dfb['attributes']=_0x103dfb['attributes'][_0x5029('0x4b')]?_0x103dfb[_0x5029('0x49')]:_0x236455[_0x5029('0x44')];if(!_0x2ae047[_0x5029('0x45')][_0x5029('0x4c')](_0x5029('0x4d'))){_0x103dfb[_0x5029('0x30')]=qs[_0x5029('0x30')](_0x2ae047[_0x5029('0x45')][_0x5029('0x30')]);_0x103dfb[_0x5029('0x2f')]=qs[_0x5029('0x2f')](_0x2ae047[_0x5029('0x45')][_0x5029('0x2f')]);}_0x103dfb[_0x5029('0x4e')]=qs[_0x5029('0x4f')](_0x2ae047[_0x5029('0x45')][_0x5029('0x4f')]);_0x103dfb[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0x2ae047['query'],_0x236455[_0x5029('0x47')]),_0x1edc00);var _0x5e1bcb=[];var _0x189d7d=squel[_0x5029('0x52')]()['field']('id')['field'](_0x5029('0x37'))['field']('color')[_0x5029('0x53')](_0x5029('0x54'));var _0x2e4c4e=squel['select']()['field'](_0x5029('0x55'))[_0x5029('0x56')]('u.fullname')[_0x5029('0x56')]('ui.ChatInteractionId')[_0x5029('0x53')]('user_has_chat_interactions','ui')[_0x5029('0x57')](_0x5029('0x58'),'u',_0x5029('0x59'));var _0x6d03b2=squel[_0x5029('0x52')]()[_0x5029('0x53')](_0x5029('0x5a'),'i')[_0x5029('0x57')]('cm_contacts','c',_0x5029('0x5b'))['left_join'](_0x5029('0x58'),'o',_0x5029('0x5c'))['left_join'](_0x5029('0x5d'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me',_0x5029('0x5e'))['left_join'](_0x5029('0x5f'),'it',_0x5029('0x60'))[_0x5029('0x57')]('tools_tags','t',_0x5029('0x61'));var _0x53fd4f=squel['expr']();var _0x45c7cd=[];var _0x98abd1=squel[_0x5029('0x62')]();var _0x448273;if(_0x2ae047[_0x5029('0x45')]['search']){_0x448273=as[_0x5029('0x63')](_0x2ae047[_0x5029('0x45')][_0x5029('0x64')]);var _0x4311a6=_0x448273['sqlOperator'];for(var _0x33812b=0x0;_0x33812b<_0x448273[_0x5029('0x65')]['length'];_0x33812b++){var _0x512de9=_0x448273[_0x5029('0x65')][_0x33812b];var _0x4685a6='i';var _0x1263ba=_[_0x5029('0x66')](_0x1edc00,['name',_0x512de9[_0x5029('0x56')]]);if(!_0x1263ba){switch(_0x512de9[_0x5029('0x56')]){case _0x5029('0x67'):if(_0x512de9[_0x5029('0x68')]==0x1){_0x6d03b2[_0x5029('0x69')]('`'+_0x512de9[_0x5029('0x56')]+'`\x20=\x200');}else{_0x6d03b2['having']('`'+_0x512de9[_0x5029('0x56')]+_0x5029('0x6a'));}break;case _0x5029('0x6b'):if(_0x512de9['operator']===_0x5029('0x6c')){if(_0x512de9[_0x5029('0x68')][_0x5029('0x3c')]('\x20')[_0x5029('0x4b')]>0x1){_0x53fd4f[_0x4311a6](_0x5029('0x6d'),qs['getFullTextValue'](_0x512de9[_0x5029('0x68')]),null);}else{var _0x352736='%'+_0x512de9[_0x5029('0x68')]+'%';_0x53fd4f[_0x4311a6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x352736,_0x352736,_0x352736);}}else{_0x1263ba=_[_0x5029('0x66')](_0x1edc00,['name',_0x5029('0x6e')]);_0x512de9['field']=_0x5029('0x6e');_0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba[_0x5029('0x42')],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f[_0x5029('0x68')][_0x5029('0x71')],_0x236c3f['value'][_0x5029('0x2b')]);}break;case _0x5029('0x72'):var _0x1ff8df=_0x512de9[_0x5029('0x68')][_0x5029('0x3c')](',')['map'](function(_0x13ca47){return Number(_0x13ca47);});_0x1ff8df['forEach'](function(_0x2780e2){_0x98abd1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2780e2+',%');});_0x45c7cd=_[_0x5029('0x73')](_0x45c7cd,_0x1ff8df);break;case'User':if(_0x512de9[_0x5029('0x74')]==='$substring'){_0x53fd4f[_0x4311a6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x512de9[_0x5029('0x68')]+'%',null);}else{_0x1263ba=_['find'](_0x1edc00,[_0x5029('0x37'),_0x5029('0x75')]);_0x512de9[_0x5029('0x56')]='UserId';_0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba['type'],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f[_0x5029('0x68')][_0x5029('0x71')],_0x236c3f[_0x5029('0x68')][_0x5029('0x2b')]);}break;case'body':_0x236c3f=as[_0x5029('0x6f')]('me',null,_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f[_0x5029('0x70')],_0x236c3f['value'][_0x5029('0x71')],_0x236c3f[_0x5029('0x68')][_0x5029('0x2b')]);break;}}else{var _0x236c3f=as[_0x5029('0x6f')](_0x4685a6,_0x1263ba[_0x5029('0x42')],_0x512de9);_0x53fd4f[_0x4311a6](_0x236c3f['text'],_0x236c3f['value'][_0x5029('0x71')],_0x236c3f['value'][_0x5029('0x2b')]);}}}else{var _0x21fad4=_(_0x2ae047['query'])[_0x5029('0x46')]()['map'](function(_0x4cc275){return _[_0x5029('0x76')](_0x1edc00,[_0x5029('0x37'),_0x4cc275])?_0x4cc275:undefined;})[_0x5029('0x77')]()[_0x5029('0x68')]();if(!_['isEmpty'](_0x21fad4)){_0x21fad4[_0x5029('0x3d')](function(_0x43fcc0){if(_0x43fcc0==='ChatWebsiteId'){_0x6d03b2[_0x5029('0x50')](_0x5029('0x78'),[]['concat'](_0x2ae047['query'][_0x43fcc0]));}else if(_0x43fcc0==='createdAt'){var _0x7441d8=JSON[_0x5029('0x79')](_0x2ae047[_0x5029('0x45')][_0x43fcc0])[_0x5029('0x7a')];var _0x46be5a=JSON[_0x5029('0x79')](_0x2ae047[_0x5029('0x45')][_0x43fcc0])[_0x5029('0x7b')];_0x6d03b2[_0x5029('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7441d8,_0x46be5a);}else{if(_0x2ae047['query'][_0x43fcc0]===_0x5029('0x7c')){_0x6d03b2[_0x5029('0x50')]('i.'+_0x43fcc0+_0x5029('0x7d'));}else{_0x6d03b2[_0x5029('0x50')]('i.'+_0x43fcc0+_0x5029('0x7e'),_0x2ae047[_0x5029('0x45')][_0x43fcc0]);}}});}if(_0x2ae047[_0x5029('0x45')]['read']){if(_0x2ae047[_0x5029('0x45')][_0x5029('0x7f')]==0x1){_0x6d03b2[_0x5029('0x69')]('`unreadMessages`\x20=\x200');}else{_0x6d03b2[_0x5029('0x69')](_0x5029('0x80'));}}if(_0x2ae047[_0x5029('0x45')]['tag']){_0x45c7cd=_[_0x5029('0x81')](_0x2ae047[_0x5029('0x45')][_0x5029('0x82')])?_0x2ae047['query'][_0x5029('0x82')]:new Array(_0x2ae047[_0x5029('0x45')]['tag']);_0x45c7cd[_0x5029('0x3d')](function(_0x42d795){_0x98abd1['or'](_0x5029('0x83'),'%,'+_0x42d795+',%');});}if(_0x2ae047[_0x5029('0x45')][_0x5029('0x84')]){var _0x4a2f3a=_0x2ae047[_0x5029('0x45')][_0x5029('0x84')][_0x5029('0x85')]('\x5c','\x5c\x5c')[_0x5029('0x85')]('\x27\x27',_0x5029('0x86'));if(qs['isNumeric'](_0x4a2f3a)){_0x53fd4f['or'](_0x5029('0x87'),_0x4a2f3a+'%');}else{_0x53fd4f['or'](_0x5029('0x88'),qs[_0x5029('0x89')](_0x4a2f3a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4a2f3a+'%');}}}_0x6d03b2[_0x5029('0x50')](_0x53fd4f);_0x6d03b2[_0x5029('0x8a')](_0x5029('0x8b'));var _0x3e47bd={'type':db[_0x5029('0x1c')][_0x5029('0x8c')][_0x5029('0x8d')],'raw':!![]};var _0x5e2c3e=_0x6d03b2[_0x5029('0x8e')]();_0x5e2c3e[_0x5029('0x56')](_0x5029('0x8b'));_0x5e2c3e[_0x5029('0x56')](_0x5029('0x8f'),'unreadMessages');if(_0x103dfb[_0x5029('0x4e')]){_0x103dfb[_0x5029('0x4e')][_0x5029('0x3d')](function(_0x4f2ceb){_0x6d03b2[_0x5029('0x4e')]('i.'+_0x4f2ceb[0x0],_0x4f2ceb[0x1]===_0x5029('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45c7cd)){_0x6d03b2['having'](_0x98abd1);_0x5e2c3e['where'](_0x5029('0x91'),_0x45c7cd);}BPromise[_0x5029('0x92')]()[_0x5029('0x35')](function(){if(!_0x448273){if(_0x2ae047[_0x5029('0x45')][_0x5029('0x93')]||_0x2ae047['query'][_0x5029('0x94')])return;_0x5e2c3e[_0x5029('0x50')](_0x5029('0x95'));_0x6d03b2['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x2ae047[_0x5029('0x96')][_0x5029('0x97')]({'attributes':['id'],'raw':!![]})[_0x5029('0x35')](function(_0x24a8f6){if(_['isEmpty'](_0x24a8f6)){_0x5e2c3e[_0x5029('0x50')](_0x5029('0x98'));_0x6d03b2[_0x5029('0x50')](_0x5029('0x98'));}else{_0x5e2c3e[_0x5029('0x50')](_0x5029('0x78'),_[_0x5029('0x39')](_0x24a8f6,'id'));_0x6d03b2[_0x5029('0x50')]('i.ChatWebsiteId\x20IN\x20?',_[_0x5029('0x39')](_0x24a8f6,'id'));}});})['then'](function(){db['sequelize'][_0x5029('0x45')](_0x5e2c3e['toString'](),_0x3e47bd)[_0x5029('0x35')](function(_0xe7fa61){_0x1e040d[_0x5029('0x2e')]=_0xe7fa61[_0x5029('0x4b')];if(_0x1e040d[_0x5029('0x2e')]===0x0)return[];return db[_0x5029('0x99')][_0x5029('0x45')](_0x189d7d[_0x5029('0x9a')](),_0x3e47bd)['then'](function(_0x5b7694){_0x5e1bcb=_[_0x5029('0x9b')](_0x5b7694,'id');_0x3e47bd=_['merge'](_0x3e47bd,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ae047[_0x5029('0x45')]['fields']){_0x103dfb['attributes'][_0x5029('0x3d')](function(_0xb8da0b){_0x6d03b2[_0x5029('0x56')]('i.'+_0xb8da0b);});}else{_0x6d03b2[_0x5029('0x56')](_0x5029('0x8f'),'unreadMessages');_0x6d03b2[_0x5029('0x56')](_0x5029('0x9c'),_0x5029('0x9d'));_0x6d03b2['field'](_0x5029('0x9e'),_0x5029('0x9f'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa0'));_0x6d03b2[_0x5029('0x56')]('c.firstName','Contact.firstName');_0x6d03b2[_0x5029('0x56')](_0x5029('0xa1'),'Contact.lastName');_0x6d03b2[_0x5029('0x56')](_0x5029('0xa2'),_0x5029('0xa3'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa4'),_0x5029('0xa5'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa6'),'Contact.mobile');_0x6d03b2['field'](_0x5029('0xa7'),'Contact.fax');_0x6d03b2[_0x5029('0x56')]('o.fullname',_0x5029('0xa8'));_0x6d03b2[_0x5029('0x56')](_0x5029('0xa9'),'Owner.internal');_0x6d03b2[_0x5029('0x56')](_0x5029('0xaa'),_0x5029('0x3b'));}if(_0x103dfb['limit'])_0x6d03b2[_0x5029('0x30')](_0x103dfb[_0x5029('0x30')]);if(_0x103dfb[_0x5029('0x2f')])_0x6d03b2[_0x5029('0x2f')](_0x103dfb[_0x5029('0x2f')]);return db[_0x5029('0x99')][_0x5029('0x45')](_0x6d03b2[_0x5029('0x9a')](),_0x3e47bd);})[_0x5029('0x35')](function(_0x1834f2){_0x2e4c4e[_0x5029('0x50')](_0x5029('0xab'),_[_0x5029('0x39')](_0x1834f2,'id'));return db[_0x5029('0x99')][_0x5029('0x45')](_0x2e4c4e[_0x5029('0x9a')](),_0x3e47bd)[_0x5029('0x35')](function(_0x2468fa){var _0x4da8f8=_[_0x5029('0xac')](_0x2468fa,_0x5029('0xad'));var _0x2102ef=[];_0x1834f2[_0x5029('0x3d')](function(_0x34494c){_0x2102ef['push'](updateChatInteraction(_0x34494c,_0x5e1bcb,_0x4da8f8));});return BPromise[_0x5029('0xae')](_0x2102ef);});});})[_0x5029('0x35')](function(_0xec074c){_0x1e040d[_0x5029('0xaf')]=_0xec074c;return _0x1e040d;})[_0x5029('0x35')](respondWithFilteredResult(_0x5a3e4d,_0x103dfb));})['catch'](handleError(_0x5a3e4d,null));};exports[_0x5029('0xb0')]=function(_0x46be82,_0x20b00e){var _0x139971={'raw':![],'where':{'id':_0x46be82['params']['id']}},_0x3c601c={};_0x3c601c[_0x5029('0x44')]=_[_0x5029('0x46')](db[_0x5029('0x40')][_0x5029('0xb1')]);_0x3c601c[_0x5029('0x45')]=_[_0x5029('0x46')](_0x46be82[_0x5029('0x45')]);_0x3c601c[_0x5029('0x47')]=_['intersection'](_0x3c601c['model'],_0x3c601c[_0x5029('0x45')]);_0x139971[_0x5029('0x49')]=_[_0x5029('0x48')](_0x3c601c[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x46be82['query'][_0x5029('0x4a')]));_0x139971['attributes']=_0x139971[_0x5029('0x49')][_0x5029('0x4b')]?_0x139971[_0x5029('0x49')]:_0x3c601c[_0x5029('0x44')];if(_0x46be82[_0x5029('0x45')][_0x5029('0xb2')]){_0x139971['include']=[{'all':!![]}];}_0x139971=_[_0x5029('0xb3')]({},_0x139971,_0x46be82[_0x5029('0xb4')]);return db['ChatInteraction'][_0x5029('0x66')](_0x139971)[_0x5029('0x35')](handleEntityNotFound(_0x20b00e,null))['then'](respondWithResult(_0x20b00e,null))[_0x5029('0x29')](handleError(_0x20b00e,null));};exports['create']=function(_0x54c0f3,_0x50d603){return db['ChatInteraction'][_0x5029('0xb5')](_0x54c0f3['body'],{})[_0x5029('0x35')](respondWithResult(_0x50d603,0xc9))[_0x5029('0x29')](handleError(_0x50d603,null));};exports['update']=function(_0x28fc01,_0x2084cf){if(_0x28fc01['body']['id']){delete _0x28fc01[_0x5029('0xb6')]['id'];}return db[_0x5029('0x40')]['find']({'where':{'id':_0x28fc01[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x2084cf,null))['then'](saveUpdates(_0x28fc01[_0x5029('0xb6')],null))[_0x5029('0x35')](respondWithResult(_0x2084cf,null))[_0x5029('0x29')](handleError(_0x2084cf,null));};exports[_0x5029('0x36')]=function(_0xf57e38,_0x233ce5){return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0xf57e38['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x233ce5,null))[_0x5029('0x35')](removeEntity(_0x233ce5,null))[_0x5029('0x29')](handleError(_0x233ce5,null));};exports[_0x5029('0xb8')]=function(_0x3e4f7d,_0x2138cc){return db[_0x5029('0x40')][_0x5029('0xb8')]()[_0x5029('0x35')](respondWithResult(_0x2138cc,null))[_0x5029('0x29')](handleError(_0x2138cc,null));};exports[_0x5029('0xb9')]=function(_0x41ca12,_0x14f995){var _0x3ccdc9=_0x41ca12[_0x5029('0xb7')]['id'];var _0x2ac88e;var _0x55ee4f;var _0x1fa9eb;return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x3ccdc9}})[_0x5029('0x35')](function(_0x1ebc8c){_0x2ac88e=_0x1ebc8c;return db[_0x5029('0xbb')]['findOne']({'where':{'id':_0x1ebc8c[_0x5029('0x93')]},'attributes':['id',_0x5029('0xbc'),_0x5029('0xbd')],'raw':!![]});})[_0x5029('0x35')](function(_0x156da){if(_0x156da&&_0x156da['vidaooApiKey']&&_0x156da[_0x5029('0xbd')]){_0x55ee4f=_0x156da;var _0x2a3025={'rejectUnauthorized':![],'method':_0x5029('0xbe'),'uri':_0x5029('0xbf'),'headers':{'X-APIKEY':_0x156da[_0x5029('0xbc')]},'body':{'name':_0x5029('0xc0')+_0x3ccdc9},'redirect':_0x5029('0xc1'),'json':!![]};return rp(_0x2a3025);}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))](_0x5029('0xc2'));}})['then'](function(_0xb26cc0){_0x1fa9eb=_0xb26cc0;if(_0x1fa9eb['id']){var _0x4ac3b8={'body':_0x1fa9eb[_0x5029('0xc3')],'ChatWebsiteId':_0x55ee4f['id'],'ChatInteractionId':_0x2ac88e['id'],'direction':_0x5029('0xc4'),'UserId':_0x41ca12[_0x5029('0x96')]['id']};return db[_0x5029('0xc5')]['create'](_0x4ac3b8,{});}else{throw new db[(_0x5029('0x1c'))][(_0x5029('0x1d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5029('0x35')](function(){return _0x2ac88e[_0x5029('0xc6')]({'vidaooSessionId':_0x1fa9eb['id']});})['then'](respondWithResult(_0x14f995,null))[_0x5029('0x29')](handleError(_0x14f995,null));};exports[_0x5029('0xc7')]=function(_0x5b290f,_0x4a5d3e){if(_0x5b290f[_0x5029('0xb6')]['id']){delete _0x5b290f['body']['id'];}return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0x5b290f['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x4a5d3e,null))[_0x5029('0x35')](saveUpdates(_0x5b290f['body'],null))[_0x5029('0x35')](respondWithResult(_0x4a5d3e,null))[_0x5029('0x29')](handleError(_0x4a5d3e,null));};exports['abandon']=function(_0x3ac39a,_0x37c47b,_0x62e4af){if(_0x3ac39a['body']['id']){delete _0x3ac39a[_0x5029('0xb6')]['id'];}return db['ChatInteraction'][_0x5029('0x66')]({'where':{'id':_0x3ac39a[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](function(_0x5e7ec8){if(!_0x5e7ec8){logger[_0x5029('0x24')](_0x5029('0xc8'),'abandon',0x194,_0x5029('0xc9'));_0x37c47b[_0x5029('0x2a')](0x194);}else{if(_0x5e7ec8['UserId']){throw new db['Sequelize'][(_0x5029('0x1d'))](_0x5029('0xca'));}}return _0x5e7ec8;})['then'](function(_0x5842a5){if(_0x5842a5){return _0x5842a5['update']({'closed':_0x3ac39a[_0x5029('0xb6')][_0x5029('0xcb')],'disposition':_0x3ac39a[_0x5029('0xb6')]['disposition']})[_0x5029('0x35')](function(_0x581237){return _0x581237;});}})[_0x5029('0x35')](function(_0x5de481){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3ac39a['body'],client9004);})[_0x5029('0x35')](respondWithResult(_0x37c47b,null))[_0x5029('0x29')](handleError(_0x37c47b,null));};exports[_0x5029('0xcc')]=function(_0x11f39c,_0x12ba67,_0x5b0939){_0x11f39c[_0x5029('0xb6')][_0x5029('0x37')]=_0x11f39c[_0x5029('0xcd')][_0x5029('0xce')];_0x11f39c[_0x5029('0xb6')][_0x5029('0xcf')]=_0x11f39c['file'][_0x5029('0xd0')];_0x11f39c[_0x5029('0xb6')][_0x5029('0x42')]=_0x11f39c['file']['mimetype'];return db[_0x5029('0xd1')][_0x5029('0xb5')](_0x11f39c[_0x5029('0xb6')])[_0x5029('0x35')](respondWithResult(_0x12ba67,0xc9))[_0x5029('0x29')](handleError(_0x12ba67,null));};exports[_0x5029('0xd2')]=function(_0x181970,_0x10a16e,_0x47b508){return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x181970[_0x5029('0xb7')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x10a16e,null))[_0x5029('0x35')](function(_0x594896){if(_0x594896){if(_0x594896[_0x5029('0xcb')]){return _0x10a16e[_0x5029('0x2c')](0x193)[_0x5029('0x2d')]({'status':0x193,'message':_0x5029('0xd3')});}return db[_0x5029('0xd1')][_0x5029('0xba')]({'where':{'id':_0x181970[_0x5029('0x45')][_0x5029('0xd4')]},'raw':!![]})['then'](handleEntityNotFound(_0x10a16e,null));}})['then'](function(_0x4dc23a){if(_0x4dc23a){return _0x10a16e[_0x5029('0xd5')](path[_0x5029('0xd6')](config[_0x5029('0xd7')],_0x5029('0xd8'),_0x4dc23a[_0x5029('0xcf')]));}})['catch'](handleError(_0x10a16e,null));};exports[_0x5029('0xd9')]=function(_0x17dfbd,_0xa26684){var _0x156450=null;var _0x3bb095=null;var _0x4ee7b0=null;var _0x32b1b4=null;if(_0x17dfbd[_0x5029('0xb6')]['id']){delete _0x17dfbd[_0x5029('0xb6')]['id'];}if(_0x17dfbd[_0x5029('0xb6')][_0x5029('0xda')]){_0x32b1b4=path[_0x5029('0xd6')](config[_0x5029('0xd7')],_0x5029('0xdb'),util[_0x5029('0xdc')](_0x5029('0xdd'),Date[_0x5029('0xde')]()));_0x17dfbd[_0x5029('0xb6')][_0x5029('0xdf')]=_0x32b1b4;}return db['ChatInteraction']['find']({'where':{'id':_0x17dfbd[_0x5029('0xb7')]['id']},'include':[{'model':db[_0x5029('0xc5')],'as':'Messages','include':[{'model':db[_0x5029('0xe0')],'as':_0x5029('0xe0')}]}]})['then'](handleEntityNotFound(_0xa26684,null))[_0x5029('0x35')](saveUpdates(_0x17dfbd[_0x5029('0xb6')],null))[_0x5029('0x35')](function(_0x54794c){if(_0x54794c){_0x156450=_0x54794c;return db[_0x5029('0xbb')][_0x5029('0x66')]({'where':{'id':_0x156450['ChatWebsiteId']}});}})[_0x5029('0x35')](function(_0x50637d){if(_0x50637d){_0x4ee7b0=_0x50637d;return db['CmContact'][_0x5029('0x66')]({'where':{'id':_0x156450['ContactId']}});}})[_0x5029('0x35')](function(_0x139540){if(_0x139540){_0x3bb095=_0x139540;if(_0x32b1b4){var _0x35f7b5=null;for(var _0x58b3e7=0x1;_0x58b3e7<_0x156450[_0x5029('0xe1')]['length'];++_0x58b3e7){_0x35f7b5=_0x156450['Messages'][_0x58b3e7];var _0x196706=_0x35f7b5['UserId']?util[_0x5029('0xdc')](_0x5029('0xe2'),_0x4ee7b0[_0x5029('0xe3')],_0x35f7b5['UserId']):_0x5029('0xe4');var _0x1caa56=_0x17dfbd[_0x5029('0xb6')][_0x5029('0xe5')]||util[_0x5029('0xdc')](_0x5029('0xe2'),'Visitor',_0x35f7b5['ContactId']);switch(_0x4ee7b0[_0x5029('0xe6')]){case _0x5029('0xe7'):_0x196706=_0x35f7b5['UserId']?util[_0x5029('0xdc')]('%s%d',_0x4ee7b0['agentAlias'],_0x35f7b5[_0x5029('0x75')]):_0x5029('0xe4');break;case _0x5029('0xe8'):_0x196706=_0x35f7b5[_0x5029('0x75')]?_0x35f7b5[_0x5029('0xe0')][_0x5029('0xe9')]||_0x35f7b5[_0x5029('0xe0')][_0x5029('0x3a')]:_0x5029('0xe4');break;case _0x5029('0xea'):_0x196706=_0x35f7b5[_0x5029('0x75')]?_0x35f7b5[_0x5029('0xe0')][_0x5029('0x3a')]:_0x5029('0xe4');break;default:_0x196706=_0x35f7b5[_0x5029('0x75')]?util[_0x5029('0xdc')](_0x5029('0xe2'),_0x4ee7b0[_0x5029('0xe3')],_0x35f7b5[_0x5029('0x75')]):_0x5029('0xe4');}var _0x38bb6b=util['format'](_0x5029('0xeb'),moment(_0x35f7b5[_0x5029('0xec')])[_0x5029('0xdc')]('MM/DD/YYYY\x20HH:mm:ss'),_0x35f7b5[_0x5029('0xed')]==='in'?_0x1caa56:_0x196706,_0x35f7b5['body']);if(!_0x35f7b5['secret']){fs[_0x5029('0xee')](_0x32b1b4,_0x38bb6b);}}return db[_0x5029('0xef')][_0x5029('0xba')]({'where':{'service':!![]},'include':[{'model':db[_0x5029('0xf0')],'as':_0x5029('0xf1'),'raw':!![]}]});}}})[_0x5029('0x35')](function(_0x2f3103){if(_0x2f3103&&_0x2f3103['Smtp']&&_0x17dfbd[_0x5029('0xb6')]){var _0x47b6de={'tls':{'rejectUnauthorized':![]}};if(_0x2f3103['Smtp'][_0x5029('0xf2')]){_0x47b6de[_0x5029('0xf2')]=_0x2f3103[_0x5029('0xf1')][_0x5029('0xf2')];}else{_0x47b6de[_0x5029('0xf3')]=_0x2f3103['Smtp']['host'];_0x47b6de['port']=_0x2f3103['Smtp']['port'];_0x47b6de['secure']=_0x2f3103[_0x5029('0xf1')][_0x5029('0xf4')];}if(_0x2f3103[_0x5029('0xf1')][_0x5029('0xf5')]){_0x47b6de[_0x5029('0xf6')]={'user':_0x2f3103['Smtp'][_0x5029('0x96')],'pass':_0x2f3103['Smtp'][_0x5029('0xf7')]};}return respondWithRpcPromise(_0x5029('0xf8'),'sendMail',{'account':_0x47b6de,'message':{'from':util[_0x5029('0xdc')](_0x5029('0xf9'),_0x2f3103['name'],_0x2f3103['email']||_0x2f3103[_0x5029('0xf1')]['user']),'to':_0x17dfbd[_0x5029('0xb6')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x17dfbd[_0x5029('0xb6')][_0x5029('0xda')]),'attachments':[{'path':_0x32b1b4}]}})['then'](function(){return _0x156450;})['catch'](function(_0x4aa892){console['error'](_0x4aa892);});}else{return _0x156450;}})[_0x5029('0x35')](respondWithStatusCode(_0xa26684,0xc8))[_0x5029('0x29')](handleError(_0xa26684,null));};exports['addMessage']=function(_0x28dc2d,_0xb6d199,_0x54f1cb){return db[_0x5029('0xc5')][_0x5029('0x66')]({'where':{'id':_0x28dc2d[_0x5029('0xb7')]['id']}})[_0x5029('0x35')](handleEntityNotFound(_0xb6d199,null))[_0x5029('0x35')](function(_0x1d52b5){if(_0x1d52b5){return _0x1d52b5[_0x5029('0xfa')](_0x28dc2d[_0x5029('0xb6')][_0x5029('0xfb')],_['omit'](_0x28dc2d[_0x5029('0xb6')],[_0x5029('0xfb'),'id'])||{});}})[_0x5029('0x35')](respondWithResult(_0xb6d199,null))[_0x5029('0x29')](handleError(_0xb6d199,null));};exports[_0x5029('0xfc')]=function(_0xa0b531,_0xe35b61,_0x32c365){var _0x4f8884={'raw':![],'where':{}};var _0x2e5925={};var _0x5e2547={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5029('0xba')]({'where':{'id':_0xa0b531['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0xe35b61,null))['then'](function(_0x3f64e1){if(_0x3f64e1){_0x2e5925[_0x5029('0x44')]=_[_0x5029('0x46')](db[_0x5029('0xc5')][_0x5029('0xb1')]);_0x2e5925['query']=_[_0x5029('0x46')](_0xa0b531[_0x5029('0x45')]);_0x2e5925[_0x5029('0x47')]=_[_0x5029('0x48')](_0x2e5925[_0x5029('0x44')],_0x2e5925[_0x5029('0x45')]);_0x4f8884[_0x5029('0x49')]=_['intersection'](_0x2e5925[_0x5029('0x44')],qs['fields'](_0xa0b531[_0x5029('0x45')][_0x5029('0x4a')]));_0x4f8884[_0x5029('0x49')]=_0x4f8884[_0x5029('0x49')]['length']?_0x4f8884[_0x5029('0x49')]:_0x2e5925[_0x5029('0x44')];if(!_0xa0b531['query']['hasOwnProperty'](_0x5029('0x4d'))){_0x4f8884[_0x5029('0x30')]=qs[_0x5029('0x30')](_0xa0b531[_0x5029('0x45')]['limit']);_0x4f8884[_0x5029('0x2f')]=qs[_0x5029('0x2f')](_0xa0b531['query'][_0x5029('0x2f')]);}_0x4f8884[_0x5029('0x4e')]=qs['sort'](_0xa0b531[_0x5029('0x45')]['sort']);_0x4f8884[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0xa0b531[_0x5029('0x45')],_0x2e5925['filters']));_0x4f8884[_0x5029('0x50')]['ChatInteractionId']=_0x3f64e1['id'];if(_0xa0b531[_0x5029('0x45')]['filter']){_0x4f8884['where']=_[_0x5029('0xb3')](_0x4f8884[_0x5029('0x50')],{'$or':_['map'](_0x4f8884[_0x5029('0x49')],function(_0x37fb59){var _0x58cfe1={};_0x58cfe1[_0x37fb59]={'$like':'%'+_0xa0b531['query'][_0x5029('0x84')]+'%'};return _0x58cfe1;})});}if(_0xa0b531[_0x5029('0x45')][_0x5029('0x7a')]){var _0x239e86=_0xa0b531[_0x5029('0x45')]['$gte'][_0x5029('0x3c')](',');var _0x2fc922={};_0x2fc922[_0x239e86[0x0]]={'$gte':moment(_0x239e86[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4f8884['where']=_[_0x5029('0xb3')](_0x4f8884['where'],_0x2fc922);}_0x4f8884=_[_0x5029('0xb3')]({},_0x4f8884,_0xa0b531[_0x5029('0xb4')]);return db[_0x5029('0xc5')][_0x5029('0x2e')]({'where':_0x4f8884[_0x5029('0x50')]})[_0x5029('0x35')](function(_0x7b22ad){_0x5e2547['count']=_0x7b22ad;if(_0xa0b531[_0x5029('0x45')][_0x5029('0xb2')]){_0x4f8884[_0x5029('0xfd')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f8884);})[_0x5029('0x35')](function(_0x29ac1d){_0x5e2547['rows']=_0x29ac1d;return _0x5e2547;});}})['then'](respondWithFilteredResult(_0xe35b61,_0x4f8884))['catch'](handleError(_0xe35b61,null));};exports[_0x5029('0xfe')]=function(_0x523b0d,_0x57d3af,_0x10cf6b){var _0x6ae483={'where':{}},_0x5405a1={},_0x4b7d7e={'count':0x0,'rows':[]};return db[_0x5029('0x40')][_0x5029('0xba')]({'where':{'id':_0x523b0d[_0x5029('0xb7')]['id']}})['then'](handleEntityNotFound(_0x57d3af,null))['then'](function(_0x53e729){if(_0x53e729){_0x5405a1[_0x5029('0x44')]=_['keys'](db[_0x5029('0xc5')]['rawAttributes']);_0x5405a1['query']=_[_0x5029('0x46')](_0x523b0d[_0x5029('0x45')]);_0x5405a1[_0x5029('0x47')]=_[_0x5029('0x48')](_0x5405a1[_0x5029('0x44')],_0x5405a1['query']);_0x6ae483[_0x5029('0x49')]=_[_0x5029('0x48')](_0x5405a1[_0x5029('0x44')],qs[_0x5029('0x4a')](_0x523b0d[_0x5029('0x45')][_0x5029('0x4a')]));_0x6ae483['attributes']=_0x6ae483[_0x5029('0x49')][_0x5029('0x4b')]?_0x6ae483[_0x5029('0x49')]:_0x5405a1['model'];if(!_0x523b0d['query'][_0x5029('0x4c')](_0x5029('0x4d'))){_0x6ae483[_0x5029('0x30')]=qs[_0x5029('0x30')](_0x523b0d[_0x5029('0x45')][_0x5029('0x30')]);_0x6ae483[_0x5029('0x2f')]=qs['offset'](_0x523b0d['query'][_0x5029('0x2f')]);}_0x6ae483[_0x5029('0x4e')]=qs[_0x5029('0x4f')](_0x523b0d[_0x5029('0x45')]['sort']);_0x6ae483[_0x5029('0x50')]=qs[_0x5029('0x47')](_[_0x5029('0x51')](_0x523b0d['query'],_0x5405a1[_0x5029('0x47')]));_0x6ae483[_0x5029('0x50')][_0x5029('0xad')]=_0x53e729['id'];if(_0x523b0d[_0x5029('0x45')][_0x5029('0x84')]){_0x6ae483[_0x5029('0x50')]=_[_0x5029('0xb3')](_0x6ae483[_0x5029('0x50')],{'$or':_[_0x5029('0x39')](_0x6ae483[_0x5029('0x49')],function(_0x3eae37){var _0x290290={};_0x290290[_0x3eae37]={'$like':'%'+_0x523b0d[_0x5029('0x45')][_0x5029('0x84')]+'%'};return _0x290290;})});}_0x6ae483[_0x5029('0x50')][_0x5029('0xff')]=![];if(_0x523b0d[_0x5029('0x45')]['id']){_0x6ae483['where']['id']={'$gt':_0x523b0d[_0x5029('0x45')]['id']};}_0x6ae483=_[_0x5029('0xb3')]({},_0x6ae483,_0x523b0d[_0x5029('0xb4')]);return db[_0x5029('0xc5')][_0x5029('0x2e')]({'where':_0x6ae483[_0x5029('0x50')]})[_0x5029('0x35')](function(_0x5e9494){_0x4b7d7e[_0x5029('0x2e')]=_0x5e9494;_0x6ae483[_0x5029('0xfd')]=[];if(_0x523b0d[_0x5029('0x45')][_0x5029('0x100')]){_0x6ae483[_0x5029('0xfd')][_0x5029('0x3e')]({'model':db['User'],'as':_0x5029('0xe0'),'attributes':['id','fullname',_0x5029('0xe9')]});}if(_0x523b0d[_0x5029('0x45')][_0x5029('0xb2')]){_0x6ae483[_0x5029('0xfd')]=[{'all':!![]}];}return db[_0x5029('0xc5')]['findAll'](_0x6ae483);})[_0x5029('0x35')](function(_0x44c4f2){_0x4b7d7e['rows']=_0x44c4f2;return _0x4b7d7e;});}})[_0x5029('0x35')](respondWithFilteredResult(_0x57d3af,_0x6ae483))['catch'](handleError(_0x57d3af,null));};exports[_0x5029('0x101')]=function(_0x4246b3,_0x26b20e,_0x1210f8){return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x4246b3[_0x5029('0xb7')]['id']}})['then'](handleEntityNotFound(_0x26b20e,null))['then'](function(_0x3355f8){if(_0x3355f8){return _0x3355f8[_0x5029('0x102')](_0x4246b3[_0x5029('0xb6')]['ids'],_[_0x5029('0x103')](_0x4246b3[_0x5029('0xb6')],[_0x5029('0xfb'),'id'])||{})[_0x5029('0x104')](function(){return db[_0x5029('0x72')][_0x5029('0x105')]({'attributes':['id',_0x5029('0x37'),_0x5029('0x106')],'where':{'id':_0x4246b3[_0x5029('0xb6')][_0x5029('0xfb')]}});})['then'](function(_0x351108){socket[_0x5029('0x107')](_0x5029('0x108'),{'id':Number(_0x4246b3[_0x5029('0xb7')]['id']),'tags':_0x351108||[]});return{'id':Number(_0x4246b3['params']['id']),'tags':_0x351108||[]};});}})[_0x5029('0x35')](respondWithResult(_0x26b20e,null))[_0x5029('0x29')](handleError(_0x26b20e,null));};exports[_0x5029('0x109')]=function(_0x353828,_0x462d02,_0xf147f9){return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x353828['params']['id']}})[_0x5029('0x35')](handleEntityNotFound(_0x462d02,null))[_0x5029('0x35')](function(_0x4050ba){if(_0x4050ba){return _0x4050ba[_0x5029('0x109')](_0x353828[_0x5029('0x45')]['ids']);}})[_0x5029('0x35')](respondWithStatusCode(_0x462d02,null))[_0x5029('0x29')](handleError(_0x462d02,null));};exports[_0x5029('0xd5')]=function(_0x5c119a,_0x12c8ab){var _0x45d7ea=moment()[_0x5029('0x10a')]()['toString']();var _0xcd3b26=path[_0x5029('0xd6')](config[_0x5029('0xd7')],'server',_0x5029('0x10b'),_0x5029('0x10c'));var _0x45b31f=path[_0x5029('0xd6')](config['root'],_0x5029('0x10d'),_0x5029('0x10b'),_0x5029('0x10e'));var _0x195b81=path['join'](_0xcd3b26,_0x45d7ea);var _0x32c962=util['format'](_0x5029('0x10f'),_0x5c119a['params']['id'],_0x45d7ea);var _0x3b20f9=path[_0x5029('0xd6')](_0xcd3b26,_0x32c962);var _0x52f005=[];_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0xe0')],'as':_0x5029('0xe0'),'attributes':['id','fullname'],'raw':!![]});_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0x110')],'as':_0x5029('0x6b'),'attributes':['id',_0x5029('0x111'),'lastName'],'raw':!![]});if(_0x5c119a[_0x5029('0x45')]['attachments']){_0x52f005[_0x5029('0x3e')]({'model':db[_0x5029('0xd1')],'as':_0x5029('0xd1'),'raw':!![]});}var _0x54523d=[{'model':db[_0x5029('0xc5')],'as':_0x5029('0xe1'),'attributes':['id','body',_0x5029('0xec'),'direction','secret',_0x5029('0x7f')],'include':_0x52f005}];_0x54523d[_0x5029('0x3e')]({'model':db['ChatWebsite'],'as':_0x5029('0x112'),'attributes':['id',_0x5029('0x37')]});_0x54523d[_0x5029('0x3e')]({'model':db['User'],'as':_0x5029('0x113'),'attributes':['id','fullname']});return db[_0x5029('0x40')][_0x5029('0x66')]({'where':{'id':_0x5c119a[_0x5029('0xb7')]['id']},'include':_0x54523d})[_0x5029('0x35')](handleEntityNotFound(_0x12c8ab,null))[_0x5029('0x35')](function(_0x568b05){if(_0x568b05){var _0x19fb32=_0x568b05['get']({'plain':!![]});fs[_0x5029('0x114')](_0x195b81);var _0x524300={'format':'A4','border':'10px','header':{'height':_0x5029('0x115'),'contents':{'first':_0x5029('0x116')}},'footer':{'height':_0x5029('0x117'),'contents':{'default':util[_0x5029('0xdc')](_0x5029('0x118'),util[_0x5029('0xdc')](_0x5029('0x119'),_0x5029('0x11a'),_0x19fb32['id']),moment()[_0x5029('0xdc')](_0x5029('0x11b'))[_0x5029('0x9a')]())}}};var _0x8456be={'channel':_0x5029('0x11a'),'account':_0x19fb32['Account'][_0x5029('0x37')],'agent':_0x19fb32[_0x5029('0x113')]?_0x19fb32[_0x5029('0x113')]['fullname']:_0x5029('0x11c'),'createdAt':moment(_0x19fb32['createdAt'])[_0x5029('0xdc')](_0x5029('0x11d'))['toString'](),'closedAt':_0x19fb32['closed']?moment(_0x19fb32[_0x5029('0x11e')])[_0x5029('0xdc')](_0x5029('0x11d'))[_0x5029('0x9a')]():'','disposition':_0x19fb32[_0x5029('0x11f')],'chatInfo':{'browser':_0x19fb32[_0x5029('0x120')],'os':_0x19fb32['osName'],'referer':_0x19fb32['referer'],'customerIp':_0x19fb32[_0x5029('0x121')],'customerPort':_0x19fb32[_0x5029('0x122')]?_0x19fb32[_0x5029('0x122')]:_0x5029('0x11c')},'messages':_(_0x19fb32['Messages'])[_0x5029('0x123')]()[_0x5029('0x84')]({'secret':![]})[_0x5029('0x39')](function(_0x24fb0a){if(_0x24fb0a[_0x5029('0xd1')]){var _0x8b8ea4=path[_0x5029('0xd6')](_0x45b31f,_0x24fb0a[_0x5029('0xd1')][_0x5029('0xcf')]);if(fs[_0x5029('0x124')](_0x8b8ea4)){fs[_0x5029('0x125')](_0x8b8ea4)[_0x5029('0x126')](fs['createWriteStream'](path['join'](_0x195b81,_0x24fb0a[_0x5029('0xd1')]['basename'])));}}return{'date':moment(_0x24fb0a[_0x5029('0xec')])['format'](_0x5029('0x11d'))[_0x5029('0x9a')](),'sender':_0x24fb0a[_0x5029('0xed')]===_0x5029('0xc4')?_0x24fb0a[_0x5029('0xe0')]?_0x24fb0a[_0x5029('0xe0')]['fullname']:_0x5029('0xe4'):_0x24fb0a['Contact'][_0x5029('0x111')]+(_0x24fb0a['Contact']['lastName']?'\x20'+_0x24fb0a[_0x5029('0x6b')][_0x5029('0x127')]:''),'body':_0x24fb0a[_0x5029('0xd1')]?_0x24fb0a['Attachment']['basename']:_0x24fb0a['body'],'direction':_0x24fb0a[_0x5029('0xed')]===_0x5029('0xc4')?'A':'C','secret':_0x24fb0a[_0x5029('0xff')],'read':_0x24fb0a[_0x5029('0x7f')],'attachment':_0x24fb0a[_0x5029('0xd1')]};})[_0x5029('0x68')]()};return ejs['renderFile'](path[_0x5029('0xd6')](config[_0x5029('0xd7')],'server',_0x5029('0x128'),'downloadInteraction.html'),{'interaction':_0x8456be})[_0x5029('0x35')](function(_0x22cff6){return new BPromise(function(_0x557bc0,_0x3b9b79){pdf['create'](_0x22cff6,_0x524300)[_0x5029('0x129')](path[_0x5029('0xd6')](_0x195b81,_0x5029('0x12a')+_0x19fb32['id']+'-'+_0x45d7ea+_0x5029('0x12b')),function(_0x348ca3,_0x1f1322){if(_0x348ca3)return _0x3b9b79(_0x348ca3);_0x557bc0(_0x1f1322);});});})[_0x5029('0x35')](function(){return new BPromise(function(_0xd4c200,_0x3d5e48){zipdir(_0x195b81,{'saveTo':_0x3b20f9},function(_0x437897,_0x2aef6b){if(_0x437897)return _0x3d5e48(_0x437897);return _0xd4c200(_0x2aef6b);});})[_0x5029('0x35')](function(){return new BPromise(function(_0x3da175,_0x3d9ff4){rimraf(_0x195b81,function(_0x1680eb){if(_0x1680eb)_0x3d9ff4(_0x1680eb);return _0x3da175();});});})['then'](function(){return _0x12c8ab[_0x5029('0xd5')](_0x3b20f9,_0x32c962,function(_0xb7a7fb){if(_0xb7a7fb){console[_0x5029('0x12c')](_0x5029('0x12d'),_0xb7a7fb);}else{fs[_0x5029('0x12e')](_0x3b20f9);}});});});}else{return _0x12c8ab[_0x5029('0x2a')](0xc8);}})['catch'](handleError(_0x12c8ab,null));}; \ No newline at end of file +var _0x5fab=['Smtp','service','host','port','secure','authentication','auth','pass','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','sort','pick','ChatInteractionId','includeAll','findAll','getMyMessages','addTags','spread','chatInteractionTags:save','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','save','update','stack','name','map','fullname','split','TagIds','catch','index','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','forEach','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','order','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','push','all','rows','show','include','options','ChatInteraction','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount'];(function(_0x2c8aa9,_0x253358){var _0x5b5466=function(_0x1c3806){while(--_0x1c3806){_0x2c8aa9['push'](_0x2c8aa9['shift']());}};_0x5b5466(++_0x253358);}(_0x5fab,0x177));var _0xb5fa=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x5fab[_0x128450];return _0x4d80ed;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];config[_0xb5fa('0x19')]=_['defaults'](config[_0xb5fa('0x19')],{'host':_0xb5fa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0x19')]));require('./chatInteraction.socket')[_0xb5fa('0x1b')](socket);var jayson=require(_0xb5fa('0x1c'));var client=jayson[_0xb5fa('0x1d')][_0xb5fa('0x1e')]({'port':0x232b});var client9004=jayson[_0xb5fa('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x567f31,_0x38e964,_0x587043){if(_0x587043){var _0x31f252=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31f252[_0xb5fa('0x1f')](_0x38e964)){return _0x567f31;}else{throw new db['Sequelize']['ValidationError'](_0xb5fa('0x20'));}}else{return _0x567f31;}}function respondWithRpcPromise(_0x1f7f05,_0x32e9e5,_0x46eef0,_0x324ba5){return new BPromise(function(_0x13e82b,_0x3b0f69){var _0x21f4f4=_0x324ba5||client;return _0x21f4f4[_0xb5fa('0x21')](_0x1f7f05,_0x46eef0)[_0xb5fa('0x22')](function(_0x3c8d53){logger[_0xb5fa('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x32e9e5,_0xb5fa('0x24'));logger['debug'](_0xb5fa('0x25'),_0x32e9e5,'request\x20sent',JSON[_0xb5fa('0x26')](_0x3c8d53));if(_0x3c8d53[_0xb5fa('0x27')]){if(_0x3c8d53['error'][_0xb5fa('0x28')]===0x1f4){logger[_0xb5fa('0x27')](_0xb5fa('0x29'),_0x32e9e5,_0x3c8d53['error'][_0xb5fa('0x2a')]);return _0x3b0f69(_0x3c8d53[_0xb5fa('0x27')][_0xb5fa('0x2a')]);}logger['error'](_0xb5fa('0x29'),_0x32e9e5,_0x3c8d53['error'][_0xb5fa('0x2a')]);return _0x13e82b(_0x3c8d53[_0xb5fa('0x27')][_0xb5fa('0x2a')]);}else{logger[_0xb5fa('0x23')](_0xb5fa('0x29'),_0x32e9e5,_0xb5fa('0x24'));_0x13e82b(_0x3c8d53[_0xb5fa('0x2b')][_0xb5fa('0x2a')]);}})['catch'](function(_0x4ec294){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x32e9e5,_0x4ec294);_0x3b0f69(_0x4ec294);});});}function respondWithStatusCode(_0x28a350,_0x460b54){_0x460b54=_0x460b54||0xcc;return function(_0x12c0d4){if(_0x12c0d4){return _0x28a350[_0xb5fa('0x2c')](_0x460b54);}return _0x28a350[_0xb5fa('0x2d')](_0x460b54)[_0xb5fa('0x2e')]();};}function respondWithResult(_0x358549,_0x353314){_0x353314=_0x353314||0xc8;return function(_0x409af9){if(_0x409af9){return _0x358549[_0xb5fa('0x2d')](_0x353314)[_0xb5fa('0x2f')](_0x409af9);}};}function respondWithFilteredResult(_0x259d21,_0xab5427){return function(_0x1f4380){if(_0x1f4380){var _0xed02e=_0x1f4380[_0xb5fa('0x30')],_0x116773=_0xab5427[_0xb5fa('0x31')],_0x5a0152=_0xab5427[_0xb5fa('0x31')]+_0xab5427[_0xb5fa('0x32')],_0x3fd1fb;if(_0x5a0152>=_0xed02e){_0x5a0152=_0xed02e;_0x3fd1fb=0xc8;}else{_0x3fd1fb=0xce;}_0x259d21[_0xb5fa('0x2d')](_0x3fd1fb);return _0x259d21[_0xb5fa('0x33')]('Content-Range',_0x116773+'-'+_0x5a0152+'/'+_0xed02e)[_0xb5fa('0x2f')](_0x1f4380);}return null;};}function patchUpdates(_0x4d056c){return function(_0x5c7fdd){try{jsonpatch['apply'](_0x5c7fdd,_0x4d056c,!![]);}catch(_0x1e6ba0){return BPromise['reject'](_0x1e6ba0);}return _0x5c7fdd[_0xb5fa('0x34')]();};}function saveUpdates(_0x5876f1,_0x5518b1){return function(_0x1847bc){if(_0x1847bc){return _0x1847bc[_0xb5fa('0x35')](_0x5876f1)['then'](function(_0x59f41d){return _0x59f41d;});}return null;};}function removeEntity(_0x3d73c2,_0x9cf63d){return function(_0x252421){if(_0x252421){return _0x252421['destroy']()[_0xb5fa('0x22')](function(){_0x3d73c2[_0xb5fa('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18398f,_0x2056de){return function(_0x204d6b){if(!_0x204d6b){_0x18398f['sendStatus'](0x194);}return _0x204d6b;};}function handleError(_0x4652cd,_0x2c950e){_0x2c950e=_0x2c950e||0x1f4;return function(_0x24ef11){logger['error'](_0x24ef11[_0xb5fa('0x36')]);if(_0x24ef11[_0xb5fa('0x37')]){delete _0x24ef11[_0xb5fa('0x37')];}_0x4652cd[_0xb5fa('0x2d')](_0x2c950e)['send'](_0x24ef11);};}function getInteractionUsers(_0x4bba91,_0x4901ad){return new BPromise(function(_0x49e786,_0x5989e1){try{if(_0x4901ad[_0x4bba91['id']]){_0x4bba91['Users']=_[_0xb5fa('0x38')](_0x4901ad[_0x4bba91['id']],function(_0x4c0a4d){return{'id':_0x4c0a4d['id'],'fullname':_0x4c0a4d[_0xb5fa('0x39')]};});}}catch(_0x3ae696){_0x5989e1(_0x3ae696);}_0x49e786(_0x4bba91);});}function getInteractionTags(_0x36db1a,_0x30b288){return new BPromise(function(_0x40c1c0,_0x269d21){try{if(_0x36db1a['TagIds']){_0x36db1a['Tags']=[];_0x36db1a['TagIds'][_0xb5fa('0x3a')](',')['forEach'](function(_0x73d425){_0x36db1a['Tags']['push'](_0x30b288[_0x73d425]);});}delete _0x36db1a[_0xb5fa('0x3b')];}catch(_0x42d331){_0x269d21(_0x42d331);}_0x40c1c0(_0x36db1a);});}function updateChatInteraction(_0x2e056e,_0x36c345,_0x5bc93f){return new BPromise(function(_0x26ef1b,_0x337c53){return getInteractionUsers(_0x2e056e,_0x5bc93f)[_0xb5fa('0x22')](function(_0x19e370){return getInteractionTags(_0x19e370,_0x36c345);})[_0xb5fa('0x22')](function(_0x5acc08){_0x26ef1b(_0x5acc08);})[_0xb5fa('0x3c')](function(_0x4bc9df){_0x337c53(_0x4bc9df);});});}exports[_0xb5fa('0x3d')]=function(_0x39aac3,_0x2c7c5f){var _0x2ef359={},_0x1c706b={},_0x3954b2={'count':0x0,'rows':[]};var _0x3414b2=_[_0xb5fa('0x38')](db['ChatInteraction'][_0xb5fa('0x3e')],function(_0xc03e44){return{'name':_0xc03e44['fieldName'],'type':_0xc03e44[_0xb5fa('0x3f')]['key']};});_0x1c706b[_0xb5fa('0x40')]=_[_0xb5fa('0x38')](_0x3414b2,'name');_0x1c706b['query']=_[_0xb5fa('0x41')](_0x39aac3[_0xb5fa('0x42')]);_0x1c706b[_0xb5fa('0x43')]=_[_0xb5fa('0x44')](_0x1c706b[_0xb5fa('0x40')],_0x1c706b[_0xb5fa('0x42')]);_0x2ef359[_0xb5fa('0x45')]=_[_0xb5fa('0x44')](_0x1c706b['model'],qs[_0xb5fa('0x46')](_0x39aac3[_0xb5fa('0x42')]['fields']));_0x2ef359[_0xb5fa('0x45')]=_0x2ef359[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x2ef359[_0xb5fa('0x45')]:_0x1c706b[_0xb5fa('0x40')];if(!_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x48')](_0xb5fa('0x49'))){_0x2ef359[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x32')]);_0x2ef359[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x31')]);}_0x2ef359['order']=qs['sort'](_0x39aac3[_0xb5fa('0x42')]['sort']);_0x2ef359[_0xb5fa('0x4a')]=qs[_0xb5fa('0x43')](_['pick'](_0x39aac3[_0xb5fa('0x42')],_0x1c706b[_0xb5fa('0x43')]),_0x3414b2);var _0x18b37c=[];var _0x3159e9=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4c')]('id')['field'](_0xb5fa('0x37'))['field'](_0xb5fa('0x4d'))[_0xb5fa('0x4e')](_0xb5fa('0x4f'));var _0x51f96a=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4c')]('u.id')['field'](_0xb5fa('0x50'))[_0xb5fa('0x4c')](_0xb5fa('0x51'))[_0xb5fa('0x4e')](_0xb5fa('0x52'),'ui')[_0xb5fa('0x53')](_0xb5fa('0x54'),'u',_0xb5fa('0x55'));var _0x1c1f1b=squel[_0xb5fa('0x4b')]()[_0xb5fa('0x4e')](_0xb5fa('0x56'),'i')[_0xb5fa('0x53')](_0xb5fa('0x57'),'c',_0xb5fa('0x58'))[_0xb5fa('0x53')](_0xb5fa('0x54'),'o',_0xb5fa('0x59'))['left_join'](_0xb5fa('0x5a'),'a',_0xb5fa('0x5b'))[_0xb5fa('0x53')](_0xb5fa('0x5c'),'me',_0xb5fa('0x5d'))[_0xb5fa('0x53')](_0xb5fa('0x5e'),'it',_0xb5fa('0x5f'))[_0xb5fa('0x53')](_0xb5fa('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x5750d0=squel[_0xb5fa('0x60')]();var _0x264732=[];var _0x1e78cb=squel['expr']();var _0x441c41;if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x61')]){_0x441c41=as[_0xb5fa('0x62')](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x61')]);var _0x2e7286=_0x441c41['sqlOperator'];for(var _0x7bcd09=0x0;_0x7bcd09<_0x441c41[_0xb5fa('0x63')]['length'];_0x7bcd09++){var _0x31e602=_0x441c41[_0xb5fa('0x63')][_0x7bcd09];var _0x540295='i';var _0xd94224=_[_0xb5fa('0x64')](_0x3414b2,[_0xb5fa('0x37'),_0x31e602[_0xb5fa('0x4c')]]);if(!_0xd94224){switch(_0x31e602[_0xb5fa('0x4c')]){case _0xb5fa('0x65'):if(_0x31e602[_0xb5fa('0x66')]==0x1){_0x1c1f1b[_0xb5fa('0x67')]('`'+_0x31e602[_0xb5fa('0x4c')]+_0xb5fa('0x68'));}else{_0x1c1f1b[_0xb5fa('0x67')]('`'+_0x31e602[_0xb5fa('0x4c')]+_0xb5fa('0x69'));}break;case _0xb5fa('0x6a'):if(_0x31e602[_0xb5fa('0x6b')]===_0xb5fa('0x6c')){if(_0x31e602[_0xb5fa('0x66')][_0xb5fa('0x3a')]('\x20')[_0xb5fa('0x47')]>0x1){_0x5750d0[_0x2e7286](_0xb5fa('0x6d'),qs[_0xb5fa('0x6e')](_0x31e602[_0xb5fa('0x66')]),null);}else{var _0x488563='%'+_0x31e602[_0xb5fa('0x66')]+'%';_0x5750d0[_0x2e7286](_0xb5fa('0x6f'),_0x488563,_0x488563,_0x488563);}}else{_0xd94224=_[_0xb5fa('0x64')](_0x3414b2,['name',_0xb5fa('0x70')]);_0x31e602[_0xb5fa('0x4c')]='ContactId';_0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224[_0xb5fa('0x3f')],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value']['start'],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}break;case _0xb5fa('0x73'):var _0x57d8b7=_0x31e602[_0xb5fa('0x66')][_0xb5fa('0x3a')](',')[_0xb5fa('0x38')](function(_0x12b0a2){return Number(_0x12b0a2);});_0x57d8b7['forEach'](function(_0x55000b){_0x1e78cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x55000b+',%');});_0x264732=_[_0xb5fa('0x74')](_0x264732,_0x57d8b7);break;case _0xb5fa('0x75'):if(_0x31e602[_0xb5fa('0x6b')]==='$substring'){_0x5750d0[_0x2e7286](_0xb5fa('0x76'),'%'+_0x31e602[_0xb5fa('0x66')]+'%',null);}else{_0xd94224=_[_0xb5fa('0x64')](_0x3414b2,[_0xb5fa('0x37'),_0xb5fa('0x77')]);_0x31e602[_0xb5fa('0x4c')]=_0xb5fa('0x77');_0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224[_0xb5fa('0x3f')],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}break;case _0xb5fa('0x79'):_0x3e90c7=as['buildExpression']('me',null,_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value'][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);break;}}else{var _0x3e90c7=as[_0xb5fa('0x71')](_0x540295,_0xd94224['type'],_0x31e602);_0x5750d0[_0x2e7286](_0x3e90c7[_0xb5fa('0x72')],_0x3e90c7['value'][_0xb5fa('0x78')],_0x3e90c7[_0xb5fa('0x66')][_0xb5fa('0x2e')]);}}}else{var _0x394386=_(_0x39aac3['query'])['keys']()['map'](function(_0x78a34c){return _[_0xb5fa('0x7a')](_0x3414b2,[_0xb5fa('0x37'),_0x78a34c])?_0x78a34c:undefined;})[_0xb5fa('0x7b')]()[_0xb5fa('0x66')]();if(!_[_0xb5fa('0x7c')](_0x394386)){_0x394386['forEach'](function(_0x9bf200){if(_0x9bf200==='ChatWebsiteId'){_0x1c1f1b['where'](_0xb5fa('0x7d'),[]['concat'](_0x39aac3['query'][_0x9bf200]));}else if(_0x9bf200==='createdAt'){var _0x193e63=JSON['parse'](_0x39aac3[_0xb5fa('0x42')][_0x9bf200])[_0xb5fa('0x7e')];var _0x1f05f7=JSON['parse'](_0x39aac3['query'][_0x9bf200])[_0xb5fa('0x7f')];_0x1c1f1b[_0xb5fa('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x193e63,_0x1f05f7);}else{if(_0x39aac3[_0xb5fa('0x42')][_0x9bf200]===_0xb5fa('0x80')){_0x1c1f1b[_0xb5fa('0x4a')]('i.'+_0x9bf200+_0xb5fa('0x81'));}else{_0x1c1f1b['where']('i.'+_0x9bf200+_0xb5fa('0x82'),_0x39aac3[_0xb5fa('0x42')][_0x9bf200]);}}});}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x83')]){if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x83')]==0x1){_0x1c1f1b[_0xb5fa('0x67')]('`unreadMessages`\x20=\x200');}else{_0x1c1f1b[_0xb5fa('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]){_0x264732=_['isArray'](_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')])?_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]:new Array(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x84')]);_0x264732[_0xb5fa('0x85')](function(_0x1bac54){_0x1e78cb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bac54+',%');});}if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x86')]){var _0x2c5357=_0x39aac3[_0xb5fa('0x42')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xb5fa('0x87')](_0x2c5357)){_0x5750d0['or'](_0xb5fa('0x88'),_0x2c5357+'%');}else{_0x5750d0['or'](_0xb5fa('0x89'),qs[_0xb5fa('0x6e')](_0x2c5357))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2c5357+'%');}}}_0x1c1f1b['where'](_0x5750d0);_0x1c1f1b[_0xb5fa('0x8a')]('i.id');var _0x32eebd={'type':db[_0xb5fa('0x8b')][_0xb5fa('0x8c')][_0xb5fa('0x8d')],'raw':!![]};var _0x577aef=_0x1c1f1b[_0xb5fa('0x8e')]();_0x577aef['field'](_0xb5fa('0x8f'));_0x577aef[_0xb5fa('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2ef359[_0xb5fa('0x90')]){_0x2ef359[_0xb5fa('0x90')][_0xb5fa('0x85')](function(_0x1bcca7){_0x1c1f1b[_0xb5fa('0x90')]('i.'+_0x1bcca7[0x0],_0x1bcca7[0x1]===_0xb5fa('0x91')?![]:!![]);});}if(!_[_0xb5fa('0x7c')](_0x264732)){_0x1c1f1b[_0xb5fa('0x67')](_0x1e78cb);_0x577aef[_0xb5fa('0x4a')](_0xb5fa('0x92'),_0x264732);}BPromise[_0xb5fa('0x93')]()[_0xb5fa('0x22')](function(){if(!_0x441c41){if(_0x39aac3[_0xb5fa('0x42')]['ChatWebsiteId']||_0x39aac3['query'][_0xb5fa('0x94')])return;_0x577aef['where'](_0xb5fa('0x95'));_0x1c1f1b[_0xb5fa('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x39aac3[_0xb5fa('0x96')][_0xb5fa('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45afeb){if(_[_0xb5fa('0x7c')](_0x45afeb)){_0x577aef['where'](_0xb5fa('0x98'));_0x1c1f1b[_0xb5fa('0x4a')](_0xb5fa('0x98'));}else{_0x577aef['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xb5fa('0x38')](_0x45afeb,'id'));_0x1c1f1b[_0xb5fa('0x4a')](_0xb5fa('0x7d'),_[_0xb5fa('0x38')](_0x45afeb,'id'));}});})[_0xb5fa('0x22')](function(){db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x577aef[_0xb5fa('0x9a')](),_0x32eebd)[_0xb5fa('0x22')](function(_0x1a4465){_0x3954b2['count']=_0x1a4465['length'];if(_0x3954b2[_0xb5fa('0x30')]===0x0)return[];return db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x3159e9[_0xb5fa('0x9a')](),_0x32eebd)['then'](function(_0x2c93c7){_0x18b37c=_[_0xb5fa('0x9b')](_0x2c93c7,'id');_0x32eebd=_[_0xb5fa('0x9c')](_0x32eebd,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39aac3[_0xb5fa('0x42')][_0xb5fa('0x46')]){_0x2ef359[_0xb5fa('0x45')][_0xb5fa('0x85')](function(_0x5ba2e7){_0x1c1f1b[_0xb5fa('0x4c')]('i.'+_0x5ba2e7);});}else{_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0x9d'),_0xb5fa('0x65'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0x9e'),_0xb5fa('0x9f'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa0'),_0xb5fa('0xa1'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa2'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa3'),_0xb5fa('0xa4'));_0x1c1f1b['field'](_0xb5fa('0xa5'),_0xb5fa('0xa6'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa7'),_0xb5fa('0xa8'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xa9'),_0xb5fa('0xaa'));_0x1c1f1b['field']('c.mobile',_0xb5fa('0xab'));_0x1c1f1b['field']('c.fax',_0xb5fa('0xac'));_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xad'),'Owner.fullname');_0x1c1f1b[_0xb5fa('0x4c')](_0xb5fa('0xae'),_0xb5fa('0xaf'));_0x1c1f1b['field'](_0xb5fa('0xb0'),_0xb5fa('0x3b'));}if(_0x2ef359['limit'])_0x1c1f1b[_0xb5fa('0x32')](_0x2ef359[_0xb5fa('0x32')]);if(_0x2ef359[_0xb5fa('0x31')])_0x1c1f1b[_0xb5fa('0x31')](_0x2ef359[_0xb5fa('0x31')]);return db[_0xb5fa('0x99')][_0xb5fa('0x42')](_0x1c1f1b['toString'](),_0x32eebd);})[_0xb5fa('0x22')](function(_0xafde6d){_0x51f96a[_0xb5fa('0x4a')](_0xb5fa('0xb1'),_['map'](_0xafde6d,'id'));return db['sequelize'][_0xb5fa('0x42')](_0x51f96a[_0xb5fa('0x9a')](),_0x32eebd)[_0xb5fa('0x22')](function(_0x1a889a){var _0x4eb5a0=_['groupBy'](_0x1a889a,'ChatInteractionId');var _0x537a51=[];_0xafde6d[_0xb5fa('0x85')](function(_0x46a651){_0x537a51[_0xb5fa('0xb2')](updateChatInteraction(_0x46a651,_0x18b37c,_0x4eb5a0));});return BPromise[_0xb5fa('0xb3')](_0x537a51);});});})[_0xb5fa('0x22')](function(_0x1a19ec){_0x3954b2[_0xb5fa('0xb4')]=_0x1a19ec;return _0x3954b2;})[_0xb5fa('0x22')](respondWithFilteredResult(_0x2c7c5f,_0x2ef359));})[_0xb5fa('0x3c')](handleError(_0x2c7c5f,null));};exports[_0xb5fa('0xb5')]=function(_0x4581ed,_0x5ce5d7){var _0x427d61={'raw':![],'where':{'id':_0x4581ed['params']['id']}},_0x2a6f66={};_0x2a6f66[_0xb5fa('0x40')]=_[_0xb5fa('0x41')](db['ChatInteraction'][_0xb5fa('0x3e')]);_0x2a6f66[_0xb5fa('0x42')]=_[_0xb5fa('0x41')](_0x4581ed[_0xb5fa('0x42')]);_0x2a6f66[_0xb5fa('0x43')]=_[_0xb5fa('0x44')](_0x2a6f66[_0xb5fa('0x40')],_0x2a6f66[_0xb5fa('0x42')]);_0x427d61[_0xb5fa('0x45')]=_['intersection'](_0x2a6f66[_0xb5fa('0x40')],qs[_0xb5fa('0x46')](_0x4581ed[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x427d61[_0xb5fa('0x45')]=_0x427d61[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x427d61[_0xb5fa('0x45')]:_0x2a6f66['model'];if(_0x4581ed[_0xb5fa('0x42')]['includeAll']){_0x427d61[_0xb5fa('0xb6')]=[{'all':!![]}];}_0x427d61=_[_0xb5fa('0x9c')]({},_0x427d61,_0x4581ed[_0xb5fa('0xb7')]);return db[_0xb5fa('0xb8')][_0xb5fa('0x64')](_0x427d61)[_0xb5fa('0x22')](handleEntityNotFound(_0x5ce5d7,null))[_0xb5fa('0x22')](respondWithResult(_0x5ce5d7,null))[_0xb5fa('0x3c')](handleError(_0x5ce5d7,null));};exports[_0xb5fa('0xb9')]=function(_0x4bb9b4,_0x49b530){return db[_0xb5fa('0xb8')][_0xb5fa('0xb9')](_0x4bb9b4[_0xb5fa('0x79')],{})[_0xb5fa('0x22')](respondWithResult(_0x49b530,0xc9))['catch'](handleError(_0x49b530,null));};exports[_0xb5fa('0x35')]=function(_0x5d1897,_0x392359){if(_0x5d1897[_0xb5fa('0x79')]['id']){delete _0x5d1897['body']['id'];}return db[_0xb5fa('0xb8')]['find']({'where':{'id':_0x5d1897[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x392359,null))[_0xb5fa('0x22')](saveUpdates(_0x5d1897[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](respondWithResult(_0x392359,null))[_0xb5fa('0x3c')](handleError(_0x392359,null));};exports[_0xb5fa('0xbb')]=function(_0x1cdb82,_0x3833cc){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x1cdb82[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x3833cc,null))['then'](removeEntity(_0x3833cc,null))[_0xb5fa('0x3c')](handleError(_0x3833cc,null));};exports[_0xb5fa('0xbc')]=function(_0x384c8e,_0x497931){return db[_0xb5fa('0xb8')][_0xb5fa('0xbc')]()[_0xb5fa('0x22')](respondWithResult(_0x497931,null))[_0xb5fa('0x3c')](handleError(_0x497931,null));};exports[_0xb5fa('0xbd')]=function(_0xa68be5,_0x22ce9f){var _0x3c5115=_0xa68be5['params']['id'];var _0x245ee1;var _0x5c1e1f;var _0x3ba723;return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x3c5115}})[_0xb5fa('0x22')](function(_0x2be44e){_0x245ee1=_0x2be44e;return db[_0xb5fa('0xbf')][_0xb5fa('0xbe')]({'where':{'id':_0x2be44e[_0xb5fa('0xc0')]},'attributes':['id',_0xb5fa('0xc1'),_0xb5fa('0xc2')],'raw':!![]});})[_0xb5fa('0x22')](function(_0x46f1d3){if(_0x46f1d3&&_0x46f1d3[_0xb5fa('0xc1')]&&_0x46f1d3[_0xb5fa('0xc2')]){_0x5c1e1f=_0x46f1d3;var _0x46af2f={'rejectUnauthorized':![],'method':_0xb5fa('0xc3'),'uri':_0xb5fa('0xc4'),'headers':{'X-APIKEY':_0x46f1d3['vidaooApiKey']},'body':{'name':_0xb5fa('0xc5')+_0x3c5115},'redirect':_0xb5fa('0xc6'),'json':!![]};return rp(_0x46af2f);}else{throw new db['Sequelize'][(_0xb5fa('0xc7'))](_0xb5fa('0xc8'));}})['then'](function(_0x4fefa0){_0x3ba723=_0x4fefa0;if(_0x3ba723['id']){var _0x486f43={'body':_0x3ba723[_0xb5fa('0xc9')],'ChatWebsiteId':_0x5c1e1f['id'],'ChatInteractionId':_0x245ee1['id'],'direction':_0xb5fa('0xca'),'UserId':_0xa68be5[_0xb5fa('0x96')]['id']};return db[_0xb5fa('0xcb')][_0xb5fa('0xb9')](_0x486f43,{});}else{throw new db[(_0xb5fa('0x8b'))][(_0xb5fa('0xc7'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x245ee1['updateAttributes']({'vidaooSessionId':_0x3ba723['id']});})[_0xb5fa('0x22')](respondWithResult(_0x22ce9f,null))['catch'](handleError(_0x22ce9f,null));};exports['customUpdate']=function(_0x2c7076,_0x5ab2ba){if(_0x2c7076[_0xb5fa('0x79')]['id']){delete _0x2c7076[_0xb5fa('0x79')]['id'];}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x2c7076[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x5ab2ba,null))[_0xb5fa('0x22')](saveUpdates(_0x2c7076[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](respondWithResult(_0x5ab2ba,null))[_0xb5fa('0x3c')](handleError(_0x5ab2ba,null));};exports[_0xb5fa('0xcc')]=function(_0x488818,_0x15b228,_0x42fd84){if(_0x488818[_0xb5fa('0x79')]['id']){delete _0x488818[_0xb5fa('0x79')]['id'];}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x488818['params']['id']}})[_0xb5fa('0x22')](function(_0x390043){if(!_0x390043){logger[_0xb5fa('0x27')](_0xb5fa('0xcd'),_0xb5fa('0xcc'),0x194,_0xb5fa('0xce'));_0x15b228[_0xb5fa('0x2c')](0x194);}else{if(_0x390043[_0xb5fa('0x77')]){throw new db[(_0xb5fa('0x8b'))][(_0xb5fa('0xc7'))](_0xb5fa('0xcf'));}}return _0x390043;})[_0xb5fa('0x22')](function(_0x1d307c){if(_0x1d307c){return _0x1d307c[_0xb5fa('0x35')]({'closed':_0x488818[_0xb5fa('0x79')][_0xb5fa('0xd0')],'disposition':_0x488818[_0xb5fa('0x79')][_0xb5fa('0xd1')]})[_0xb5fa('0x22')](function(_0x2b1c3f){return _0x2b1c3f;});}})[_0xb5fa('0x22')](function(_0x40d8e0){return respondWithRpcPromise('AbandonInteraction','abandon',_0x488818[_0xb5fa('0x79')],client9004);})[_0xb5fa('0x22')](respondWithResult(_0x15b228,null))[_0xb5fa('0x3c')](handleError(_0x15b228,null));};exports[_0xb5fa('0xd2')]=function(_0x160e9a,_0x813966,_0x549579){_0x160e9a['body']['name']=_0x160e9a[_0xb5fa('0xd3')][_0xb5fa('0xd4')];_0x160e9a['body'][_0xb5fa('0xd5')]=_0x160e9a[_0xb5fa('0xd3')]['filename'];_0x160e9a[_0xb5fa('0x79')][_0xb5fa('0x3f')]=_0x160e9a[_0xb5fa('0xd3')][_0xb5fa('0xd6')];return db[_0xb5fa('0xd7')][_0xb5fa('0xb9')](_0x160e9a[_0xb5fa('0x79')])[_0xb5fa('0x22')](respondWithResult(_0x813966,0xc9))['catch'](handleError(_0x813966,null));};exports[_0xb5fa('0xd8')]=function(_0x564c7c,_0xfb95c,_0x5bfb10){return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x564c7c['params']['id']},'raw':!![]})[_0xb5fa('0x22')](handleEntityNotFound(_0xfb95c,null))[_0xb5fa('0x22')](function(_0x3a7f29){if(_0x3a7f29){if(_0x3a7f29[_0xb5fa('0xd0')]){return _0xfb95c['status'](0x193)[_0xb5fa('0x2f')]({'status':0x193,'message':_0xb5fa('0xd9')});}return db[_0xb5fa('0xd7')][_0xb5fa('0xbe')]({'where':{'id':_0x564c7c[_0xb5fa('0x42')][_0xb5fa('0xda')]},'raw':!![]})[_0xb5fa('0x22')](handleEntityNotFound(_0xfb95c,null));}})['then'](function(_0x87f3){if(_0x87f3){return _0xfb95c['download'](path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0xdd'),_0x87f3[_0xb5fa('0xd5')]));}})[_0xb5fa('0x3c')](handleError(_0xfb95c,null));};exports[_0xb5fa('0xde')]=function(_0x34a13e,_0x591df9){var _0x496a26=null;var _0x331ff8=null;var _0x3d9563=null;var _0x419034=null;if(_0x34a13e[_0xb5fa('0x79')]['id']){delete _0x34a13e[_0xb5fa('0x79')]['id'];}if(_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')]){_0x419034=path[_0xb5fa('0xdb')](config['root'],_0xb5fa('0xe0'),util[_0xb5fa('0xe1')](_0xb5fa('0xe2'),Date[_0xb5fa('0xe3')]()));_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xe4')]=_0x419034;}return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x34a13e[_0xb5fa('0xba')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xb5fa('0xe5'),'include':[{'model':db['User'],'as':_0xb5fa('0x75')}]}]})[_0xb5fa('0x22')](handleEntityNotFound(_0x591df9,null))[_0xb5fa('0x22')](saveUpdates(_0x34a13e[_0xb5fa('0x79')],null))[_0xb5fa('0x22')](function(_0x3327bd){if(_0x3327bd){_0x496a26=_0x3327bd;return db['ChatWebsite'][_0xb5fa('0x64')]({'where':{'id':_0x496a26[_0xb5fa('0xc0')]}});}})[_0xb5fa('0x22')](function(_0x327f35){if(_0x327f35){_0x3d9563=_0x327f35;return db[_0xb5fa('0xe6')][_0xb5fa('0x64')]({'where':{'id':_0x496a26[_0xb5fa('0x70')]}});}})['then'](function(_0x5d0e21){if(_0x5d0e21){_0x331ff8=_0x5d0e21;if(_0x419034){var _0x405677=null;for(var _0x3a8dad=0x1;_0x3a8dad<_0x496a26[_0xb5fa('0xe5')][_0xb5fa('0x47')];++_0x3a8dad){_0x405677=_0x496a26[_0xb5fa('0xe5')][_0x3a8dad];var _0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563[_0xb5fa('0xe8')],_0x405677['UserId']):_0xb5fa('0xe9');var _0x2dec50=_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xea')]||util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0xb5fa('0xeb'),_0x405677[_0xb5fa('0x70')]);switch(_0x3d9563[_0xb5fa('0xec')]){case _0xb5fa('0xed'):_0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563[_0xb5fa('0xe8')],_0x405677['UserId']):'System';break;case _0xb5fa('0xee'):_0x38f750=_0x405677[_0xb5fa('0x77')]?_0x405677['User'][_0xb5fa('0xef')]||_0x405677[_0xb5fa('0x75')][_0xb5fa('0x39')]:'System';break;case _0xb5fa('0xf0'):_0x38f750=_0x405677[_0xb5fa('0x77')]?_0x405677[_0xb5fa('0x75')][_0xb5fa('0x39')]:_0xb5fa('0xe9');break;default:_0x38f750=_0x405677[_0xb5fa('0x77')]?util[_0xb5fa('0xe1')](_0xb5fa('0xe7'),_0x3d9563['agentAlias'],_0x405677[_0xb5fa('0x77')]):_0xb5fa('0xe9');}var _0x4da81b=util[_0xb5fa('0xe1')](_0xb5fa('0xf1'),moment(_0x405677['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0xf2')),_0x405677[_0xb5fa('0xf3')]==='in'?_0x2dec50:_0x38f750,_0x405677[_0xb5fa('0x79')]);if(!_0x405677[_0xb5fa('0xf4')]){fs[_0xb5fa('0xf5')](_0x419034,_0x4da81b);}}return db[_0xb5fa('0xf6')][_0xb5fa('0xbe')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb5fa('0xf7'),'raw':!![]}]});}}})[_0xb5fa('0x22')](function(_0x2d49e4){if(_0x2d49e4&&_0x2d49e4[_0xb5fa('0xf7')]&&_0x34a13e[_0xb5fa('0x79')]){var _0x486620={'tls':{'rejectUnauthorized':![]}};if(_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xf8')]){_0x486620[_0xb5fa('0xf8')]=_0x2d49e4['Smtp'][_0xb5fa('0xf8')];}else{_0x486620[_0xb5fa('0xf9')]=_0x2d49e4[_0xb5fa('0xf7')]['host'];_0x486620[_0xb5fa('0xfa')]=_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfa')];_0x486620[_0xb5fa('0xfb')]=_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfb')];}if(_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfc')]){_0x486620[_0xb5fa('0xfd')]={'user':_0x2d49e4['Smtp'][_0xb5fa('0x96')],'pass':_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0xfe')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x486620,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2d49e4['name'],_0x2d49e4[_0xb5fa('0xff')]||_0x2d49e4[_0xb5fa('0xf7')][_0xb5fa('0x96')]),'to':_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')],'subject':_0xb5fa('0x100'),'text':util[_0xb5fa('0xe1')](_0xb5fa('0x101'),_0x34a13e[_0xb5fa('0x79')][_0xb5fa('0xdf')]),'attachments':[{'path':_0x419034}]}})['then'](function(){return _0x496a26;})['catch'](function(_0x41c680){console[_0xb5fa('0x27')](_0x41c680);});}else{return _0x496a26;}})[_0xb5fa('0x22')](respondWithStatusCode(_0x591df9,0xc8))['catch'](handleError(_0x591df9,null));};exports['addMessage']=function(_0x3d0a9d,_0x33f6f5,_0x326014){return db[_0xb5fa('0xcb')][_0xb5fa('0x64')]({'where':{'id':_0x3d0a9d[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x33f6f5,null))[_0xb5fa('0x22')](function(_0x286862){if(_0x286862){return _0x286862['addMessage'](_0x3d0a9d[_0xb5fa('0x79')][_0xb5fa('0x102')],_[_0xb5fa('0x103')](_0x3d0a9d[_0xb5fa('0x79')],[_0xb5fa('0x102'),'id'])||{});}})[_0xb5fa('0x22')](respondWithResult(_0x33f6f5,null))[_0xb5fa('0x3c')](handleError(_0x33f6f5,null));};exports[_0xb5fa('0x104')]=function(_0x52481f,_0x187456,_0x1845f3){var _0x55da0a={'raw':![],'where':{}};var _0x510ce8={};var _0x2a87ec={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb5fa('0xbe')]({'where':{'id':_0x52481f[_0xb5fa('0xba')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x187456,null))[_0xb5fa('0x22')](function(_0xa7da23){if(_0xa7da23){_0x510ce8[_0xb5fa('0x40')]=_[_0xb5fa('0x41')](db[_0xb5fa('0xcb')]['rawAttributes']);_0x510ce8[_0xb5fa('0x42')]=_[_0xb5fa('0x41')](_0x52481f[_0xb5fa('0x42')]);_0x510ce8[_0xb5fa('0x43')]=_['intersection'](_0x510ce8[_0xb5fa('0x40')],_0x510ce8[_0xb5fa('0x42')]);_0x55da0a['attributes']=_[_0xb5fa('0x44')](_0x510ce8[_0xb5fa('0x40')],qs['fields'](_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x55da0a['attributes']=_0x55da0a[_0xb5fa('0x45')]['length']?_0x55da0a['attributes']:_0x510ce8[_0xb5fa('0x40')];if(!_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x48')](_0xb5fa('0x49'))){_0x55da0a[_0xb5fa('0x32')]=qs[_0xb5fa('0x32')](_0x52481f[_0xb5fa('0x42')]['limit']);_0x55da0a[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x52481f['query']['offset']);}_0x55da0a[_0xb5fa('0x90')]=qs[_0xb5fa('0x105')](_0x52481f[_0xb5fa('0x42')]['sort']);_0x55da0a[_0xb5fa('0x4a')]=qs['filters'](_[_0xb5fa('0x106')](_0x52481f['query'],_0x510ce8[_0xb5fa('0x43')]));_0x55da0a[_0xb5fa('0x4a')][_0xb5fa('0x107')]=_0xa7da23['id'];if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x86')]){_0x55da0a[_0xb5fa('0x4a')]=_[_0xb5fa('0x9c')](_0x55da0a['where'],{'$or':_[_0xb5fa('0x38')](_0x55da0a[_0xb5fa('0x45')],function(_0x55a03d){var _0x39d8f3={};_0x39d8f3[_0x55a03d]={'$like':'%'+_0x52481f['query'][_0xb5fa('0x86')]+'%'};return _0x39d8f3;})});}if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x7e')]){var _0x165b0a=_0x52481f['query'][_0xb5fa('0x7e')]['split'](',');var _0xc6b700={};_0xc6b700[_0x165b0a[0x0]]={'$gte':moment(_0x165b0a[0x1])[_0xb5fa('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55da0a[_0xb5fa('0x4a')]=_[_0xb5fa('0x9c')](_0x55da0a[_0xb5fa('0x4a')],_0xc6b700);}_0x55da0a=_[_0xb5fa('0x9c')]({},_0x55da0a,_0x52481f[_0xb5fa('0xb7')]);return db['ChatMessage'][_0xb5fa('0x30')]({'where':_0x55da0a['where']})[_0xb5fa('0x22')](function(_0x1789d1){_0x2a87ec['count']=_0x1789d1;if(_0x52481f[_0xb5fa('0x42')][_0xb5fa('0x108')]){_0x55da0a['include']=[{'all':!![]}];}return db['ChatMessage'][_0xb5fa('0x109')](_0x55da0a);})[_0xb5fa('0x22')](function(_0x2ef70d){_0x2a87ec[_0xb5fa('0xb4')]=_0x2ef70d;return _0x2a87ec;});}})[_0xb5fa('0x22')](respondWithFilteredResult(_0x187456,_0x55da0a))[_0xb5fa('0x3c')](handleError(_0x187456,null));};exports[_0xb5fa('0x10a')]=function(_0x1f0cec,_0x5dbfd7,_0x2eff56){var _0x4d65e2={'where':{}},_0x51f050={},_0x4a2254={'count':0x0,'rows':[]};return db[_0xb5fa('0xb8')][_0xb5fa('0xbe')]({'where':{'id':_0x1f0cec['params']['id']}})['then'](handleEntityNotFound(_0x5dbfd7,null))['then'](function(_0x5ae447){if(_0x5ae447){_0x51f050[_0xb5fa('0x40')]=_['keys'](db[_0xb5fa('0xcb')][_0xb5fa('0x3e')]);_0x51f050[_0xb5fa('0x42')]=_['keys'](_0x1f0cec[_0xb5fa('0x42')]);_0x51f050[_0xb5fa('0x43')]=_['intersection'](_0x51f050[_0xb5fa('0x40')],_0x51f050[_0xb5fa('0x42')]);_0x4d65e2['attributes']=_['intersection'](_0x51f050['model'],qs[_0xb5fa('0x46')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x46')]));_0x4d65e2['attributes']=_0x4d65e2[_0xb5fa('0x45')][_0xb5fa('0x47')]?_0x4d65e2[_0xb5fa('0x45')]:_0x51f050[_0xb5fa('0x40')];if(!_0x1f0cec[_0xb5fa('0x42')]['hasOwnProperty'](_0xb5fa('0x49'))){_0x4d65e2['limit']=qs[_0xb5fa('0x32')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x32')]);_0x4d65e2[_0xb5fa('0x31')]=qs[_0xb5fa('0x31')](_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x31')]);}_0x4d65e2[_0xb5fa('0x90')]=qs[_0xb5fa('0x105')](_0x1f0cec['query']['sort']);_0x4d65e2[_0xb5fa('0x4a')]=qs[_0xb5fa('0x43')](_['pick'](_0x1f0cec[_0xb5fa('0x42')],_0x51f050[_0xb5fa('0x43')]));_0x4d65e2['where'][_0xb5fa('0x107')]=_0x5ae447['id'];if(_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x86')]){_0x4d65e2['where']=_[_0xb5fa('0x9c')](_0x4d65e2[_0xb5fa('0x4a')],{'$or':_[_0xb5fa('0x38')](_0x4d65e2[_0xb5fa('0x45')],function(_0x268913){var _0x53e713={};_0x53e713[_0x268913]={'$like':'%'+_0x1f0cec[_0xb5fa('0x42')][_0xb5fa('0x86')]+'%'};return _0x53e713;})});}_0x4d65e2[_0xb5fa('0x4a')][_0xb5fa('0xf4')]=![];if(_0x1f0cec[_0xb5fa('0x42')]['id']){_0x4d65e2['where']['id']={'$gt':_0x1f0cec['query']['id']};}_0x4d65e2=_[_0xb5fa('0x9c')]({},_0x4d65e2,_0x1f0cec[_0xb5fa('0xb7')]);return db[_0xb5fa('0xcb')][_0xb5fa('0x30')]({'where':_0x4d65e2[_0xb5fa('0x4a')]})['then'](function(_0x5adaa2){_0x4a2254['count']=_0x5adaa2;_0x4d65e2[_0xb5fa('0xb6')]=[];if(_0x1f0cec[_0xb5fa('0x42')]['includeAgent']){_0x4d65e2[_0xb5fa('0xb6')][_0xb5fa('0xb2')]({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x75'),'attributes':['id',_0xb5fa('0x39'),'alias']});}if(_0x1f0cec[_0xb5fa('0x42')]['includeAll']){_0x4d65e2[_0xb5fa('0xb6')]=[{'all':!![]}];}return db[_0xb5fa('0xcb')][_0xb5fa('0x109')](_0x4d65e2);})[_0xb5fa('0x22')](function(_0x1db92b){_0x4a2254[_0xb5fa('0xb4')]=_0x1db92b;return _0x4a2254;});}})[_0xb5fa('0x22')](respondWithFilteredResult(_0x5dbfd7,_0x4d65e2))[_0xb5fa('0x3c')](handleError(_0x5dbfd7,null));};exports[_0xb5fa('0x10b')]=function(_0x497465,_0x268f7e,_0x7a3bd4){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x497465['params']['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x268f7e,null))[_0xb5fa('0x22')](function(_0x48ca4b){if(_0x48ca4b){return _0x48ca4b['setTags'](_0x497465[_0xb5fa('0x79')][_0xb5fa('0x102')],_['omit'](_0x497465['body'],[_0xb5fa('0x102'),'id'])||{})[_0xb5fa('0x10c')](function(){return db[_0xb5fa('0x73')][_0xb5fa('0x109')]({'attributes':['id',_0xb5fa('0x37'),'color'],'where':{'id':_0x497465['body'][_0xb5fa('0x102')]}});})['then'](function(_0x2593ba){socket['emit'](_0xb5fa('0x10d'),{'id':Number(_0x497465[_0xb5fa('0xba')]['id']),'tags':_0x2593ba||[]});return{'id':Number(_0x497465['params']['id']),'tags':_0x2593ba||[]};});}})['then'](respondWithResult(_0x268f7e,null))[_0xb5fa('0x3c')](handleError(_0x268f7e,null));};exports['removeTags']=function(_0x2429ef,_0x315488,_0x49f3a0){return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x2429ef[_0xb5fa('0xba')]['id']}})['then'](handleEntityNotFound(_0x315488,null))[_0xb5fa('0x22')](function(_0x1c77f7){if(_0x1c77f7){return _0x1c77f7['removeTags'](_0x2429ef[_0xb5fa('0x42')][_0xb5fa('0x102')]);}})[_0xb5fa('0x22')](respondWithStatusCode(_0x315488,null))[_0xb5fa('0x3c')](handleError(_0x315488,null));};exports[_0xb5fa('0x10e')]=function(_0x117bd1,_0x41f06c){var _0x1f164f=moment()[_0xb5fa('0x10f')]()[_0xb5fa('0x9a')]();var _0x2dd8fe=path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0x110'),_0xb5fa('0x111'),_0xb5fa('0x112'));var _0x449807=path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],_0xb5fa('0x110'),_0xb5fa('0x111'),_0xb5fa('0x113'));var _0x3e1d20=path[_0xb5fa('0xdb')](_0x2dd8fe,_0x1f164f);var _0x58907b=util[_0xb5fa('0xe1')](_0xb5fa('0x114'),_0x117bd1[_0xb5fa('0xba')]['id'],_0x1f164f);var _0x74e62a=path[_0xb5fa('0xdb')](_0x2dd8fe,_0x58907b);var _0x31646a=[];_0x31646a['push']({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x75'),'attributes':['id',_0xb5fa('0x39')],'raw':!![]});_0x31646a[_0xb5fa('0xb2')]({'model':db[_0xb5fa('0xe6')],'as':_0xb5fa('0x6a'),'attributes':['id',_0xb5fa('0x115'),_0xb5fa('0x116')],'raw':!![]});if(_0x117bd1[_0xb5fa('0x42')][_0xb5fa('0x113')]){_0x31646a[_0xb5fa('0xb2')]({'model':db['Attachment'],'as':_0xb5fa('0xd7'),'raw':!![]});}var _0x1f90aa=[{'model':db[_0xb5fa('0xcb')],'as':_0xb5fa('0xe5'),'attributes':['id','body',_0xb5fa('0x117'),'direction',_0xb5fa('0xf4'),'read'],'include':_0x31646a}];_0x1f90aa['push']({'model':db[_0xb5fa('0xbf')],'as':_0xb5fa('0x118'),'attributes':['id',_0xb5fa('0x37')]});_0x1f90aa[_0xb5fa('0xb2')]({'model':db[_0xb5fa('0x75')],'as':_0xb5fa('0x119'),'attributes':['id',_0xb5fa('0x39')]});return db[_0xb5fa('0xb8')][_0xb5fa('0x64')]({'where':{'id':_0x117bd1[_0xb5fa('0xba')]['id']},'include':_0x1f90aa})['then'](handleEntityNotFound(_0x41f06c,null))[_0xb5fa('0x22')](function(_0x492dfe){if(_0x492dfe){var _0x37132c=_0x492dfe[_0xb5fa('0x11a')]({'plain':!![]});fs[_0xb5fa('0x11b')](_0x3e1d20);var _0x324e9c={'format':'A4','border':_0xb5fa('0x11c'),'header':{'height':_0xb5fa('0x11d'),'contents':{'first':_0xb5fa('0x11e')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xb5fa('0x11f'),util[_0xb5fa('0xe1')](_0xb5fa('0x120'),_0xb5fa('0x121'),_0x37132c['id']),moment()[_0xb5fa('0xe1')](_0xb5fa('0x122'))['toString']())}}};var _0x42195b={'channel':_0xb5fa('0x121'),'account':_0x37132c[_0xb5fa('0x118')][_0xb5fa('0x37')],'agent':_0x37132c['Owner']?_0x37132c[_0xb5fa('0x119')][_0xb5fa('0x39')]:_0xb5fa('0x123'),'createdAt':moment(_0x37132c['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')](),'closedAt':_0x37132c['closed']?moment(_0x37132c[_0xb5fa('0x125')])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')]():'','disposition':_0x37132c[_0xb5fa('0xd1')],'chatInfo':{'browser':_0x37132c[_0xb5fa('0x126')],'os':_0x37132c[_0xb5fa('0x127')],'referer':_0x37132c[_0xb5fa('0x128')],'customerIp':_0x37132c['customerIp'],'customerPort':_0x37132c[_0xb5fa('0x129')]?_0x37132c[_0xb5fa('0x129')]:_0xb5fa('0x123')},'messages':_(_0x37132c[_0xb5fa('0xe5')])[_0xb5fa('0x12a')]()[_0xb5fa('0x86')]({'secret':![]})['map'](function(_0x11f9e8){if(_0x11f9e8[_0xb5fa('0xd7')]){var _0x4ba538=path[_0xb5fa('0xdb')](_0x449807,_0x11f9e8[_0xb5fa('0xd7')][_0xb5fa('0xd5')]);if(fs[_0xb5fa('0x12b')](_0x4ba538)){fs[_0xb5fa('0x12c')](_0x4ba538)[_0xb5fa('0x12d')](fs[_0xb5fa('0x12e')](path[_0xb5fa('0xdb')](_0x3e1d20,_0x11f9e8['Attachment']['basename'])));}}return{'date':moment(_0x11f9e8['createdAt'])[_0xb5fa('0xe1')](_0xb5fa('0x124'))[_0xb5fa('0x9a')](),'sender':_0x11f9e8[_0xb5fa('0xf3')]==='out'?_0x11f9e8[_0xb5fa('0x75')]?_0x11f9e8[_0xb5fa('0x75')]['fullname']:_0xb5fa('0xe9'):_0x11f9e8[_0xb5fa('0x6a')][_0xb5fa('0x115')]+(_0x11f9e8['Contact']['lastName']?'\x20'+_0x11f9e8['Contact'][_0xb5fa('0x116')]:''),'body':_0x11f9e8[_0xb5fa('0xd7')]?_0x11f9e8[_0xb5fa('0xd7')]['basename']:_0x11f9e8[_0xb5fa('0x79')],'direction':_0x11f9e8['direction']===_0xb5fa('0xca')?'A':'C','secret':_0x11f9e8[_0xb5fa('0xf4')],'read':_0x11f9e8['read'],'attachment':_0x11f9e8[_0xb5fa('0xd7')]};})[_0xb5fa('0x66')]()};return ejs[_0xb5fa('0x12f')](path[_0xb5fa('0xdb')](config[_0xb5fa('0xdc')],'server',_0xb5fa('0x130'),_0xb5fa('0x131')),{'interaction':_0x42195b})[_0xb5fa('0x22')](function(_0x1f3c01){return new BPromise(function(_0xb5561b,_0xbd3013){pdf[_0xb5fa('0xb9')](_0x1f3c01,_0x324e9c)[_0xb5fa('0x132')](path[_0xb5fa('0xdb')](_0x3e1d20,'transcript-'+_0x37132c['id']+'-'+_0x1f164f+_0xb5fa('0x133')),function(_0x25a3a1,_0x21df98){if(_0x25a3a1)return _0xbd3013(_0x25a3a1);_0xb5561b(_0x21df98);});});})[_0xb5fa('0x22')](function(){return new BPromise(function(_0x46e0b3,_0xebcda7){zipdir(_0x3e1d20,{'saveTo':_0x74e62a},function(_0x5e6be6,_0x5daeba){if(_0x5e6be6)return _0xebcda7(_0x5e6be6);return _0x46e0b3(_0x5daeba);});})[_0xb5fa('0x22')](function(){return new BPromise(function(_0x593cc7,_0x51c15b){rimraf(_0x3e1d20,function(_0x5a8104){if(_0x5a8104)_0x51c15b(_0x5a8104);return _0x593cc7();});});})[_0xb5fa('0x22')](function(){return _0x41f06c[_0xb5fa('0x10e')](_0x74e62a,_0x58907b,function(_0x2ac2c1){if(_0x2ac2c1){console[_0xb5fa('0x134')](_0xb5fa('0x135'),_0x2ac2c1);}else{fs[_0xb5fa('0x136')](_0x74e62a);}});});});}else{return _0x41f06c[_0xb5fa('0x2c')](0xc8);}})[_0xb5fa('0x3c')](handleError(_0x41f06c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index aca2a20..3cf44ce 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 _0x3f7d=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3f7d,0x1cf));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xd3f7('0x0'));var ChatInteraction=require(_0xd3f7('0x1'))['db'][_0xd3f7('0x2')];var ChatMessage=require(_0xd3f7('0x1'))['db'][_0xd3f7('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd3f7('0x4')](0x0);var events={'afterCreate':_0xd3f7('0x5'),'afterUpdate':_0xd3f7('0x6'),'afterDestroy':_0xd3f7('0x7')};function emitEvent(_0x52b7b3){return function(_0x4cf348,_0x7bc4d6,_0x4eec54){_0x4cf348['getUsers']({'attributes':['id'],'raw':!![]})[_0xd3f7('0x8')](function(_0x189041){_0x4cf348[_0xd3f7('0x9')](_0xd3f7('0xa'),_0x189041[_0xd3f7('0xb')](function(_0x16d010){return{'id':_0x16d010['id']};}));return ChatMessage[_0xd3f7('0xc')]({'where':{'ChatInteractionId':_0x4cf348['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3f7('0x8')](function(_0x526757){_0x4cf348['setDataValue'](_0xd3f7('0xd'),_0x526757[_0xd3f7('0xe')]);ChatInteractionEvents['emit'](_0x52b7b3+':'+_0x4cf348['id'],_0x4cf348);ChatInteractionEvents[_0xd3f7('0xf')](_0x52b7b3,_0x4cf348);_0x4eec54(null);})[_0xd3f7('0x10')](_0x4eec54(null));};}for(var e in events){if(events[_0xd3f7('0x11')](e)){var event=events[e];ChatInteraction[_0xd3f7('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xea21=['findAll','unreadMessages','emit','hook','exports','../../mysqldb','ChatMessage','save','remove','then','setDataValue','Users','map'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xea21,0x109));var _0x1ea2=function(_0x19e3dc,_0x54b281){_0x19e3dc=_0x19e3dc-0x0;var _0x14a1dc=_0xea21[_0x19e3dc];return _0x14a1dc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x1ea2('0x0'))['db'][_0x1ea2('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ea2('0x2'),'afterUpdate':'update','afterDestroy':_0x1ea2('0x3')};function emitEvent(_0x5c7852){return function(_0x44e926,_0xc6f39,_0x29a098){_0x44e926['getUsers']({'attributes':['id'],'raw':!![]})[_0x1ea2('0x4')](function(_0x1f81c6){_0x44e926[_0x1ea2('0x5')](_0x1ea2('0x6'),_0x1f81c6[_0x1ea2('0x7')](function(_0x449af0){return{'id':_0x449af0['id']};}));return ChatMessage[_0x1ea2('0x8')]({'where':{'ChatInteractionId':_0x44e926['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1ea2('0x4')](function(_0x4f6f2c){_0x44e926[_0x1ea2('0x5')](_0x1ea2('0x9'),_0x4f6f2c['length']);ChatInteractionEvents[_0x1ea2('0xa')](_0x5c7852+':'+_0x44e926['id'],_0x44e926);ChatInteractionEvents['emit'](_0x5c7852,_0x44e926);_0x29a098(null);})['catch'](_0x29a098(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1ea2('0xb')](e,emitEvent(event));}}module[_0x1ea2('0xc')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 23e4360..c73ba14 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 _0x7963=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format'];(function(_0x29720b,_0x7e179d){var _0x44c4b4=function(_0x45ca45){while(--_0x45ca45){_0x29720b['push'](_0x29720b['shift']());}};_0x44c4b4(++_0x7e179d);}(_0x7963,0x92));var _0x3796=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0x7963[_0x16e5d1];return _0x3f72e6;};'use strict';var _=require('lodash');var util=require(_0x3796('0x0'));var logger=require(_0x3796('0x1'))(_0x3796('0x2'));var moment=require(_0x3796('0x3'));var BPromise=require('bluebird');var rp=require(_0x3796('0x4'));var fs=require('fs');var path=require(_0x3796('0x5'));var rimraf=require(_0x3796('0x6'));var config=require(_0x3796('0x7'));var attributes=require(_0x3796('0x8'));module[_0x3796('0x9')]=function(_0x6b34af,_0x3190e1){return _0x6b34af[_0x3796('0xa')](_0x3796('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d4f77,_0x17be6f,_0x5b2220){if(_0x2d4f77[_0x3796('0xc')](_0x3796('0xd'))){_0x2d4f77[_0x3796('0xe')]=moment()[_0x3796('0xf')](_0x3796('0x10'));}_0x5b2220(null,_0x2d4f77);}},'charset':_0x3796('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3245=['changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction'];(function(_0x1c0bd3,_0x4014bc){var _0x886e6e=function(_0xd04ee3){while(--_0xd04ee3){_0x1c0bd3['push'](_0x1c0bd3['shift']());}};_0x886e6e(++_0x4014bc);}(_0x3245,0x1c4));var _0x5324=function(_0x1120c7,_0x18f931){_0x1120c7=_0x1120c7-0x0;var _0x436f8a=_0x3245[_0x1120c7];return _0x436f8a;};'use strict';var _=require(_0x5324('0x0'));var util=require(_0x5324('0x1'));var logger=require(_0x5324('0x2'))(_0x5324('0x3'));var moment=require(_0x5324('0x4'));var BPromise=require(_0x5324('0x5'));var rp=require(_0x5324('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5324('0x7'));var config=require(_0x5324('0x8'));var attributes=require(_0x5324('0x9'));module[_0x5324('0xa')]=function(_0x39a320,_0x30d984){return _0x39a320['define'](_0x5324('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fbc72,_0x3605de,_0x28bc16){if(_0x3fbc72[_0x5324('0xc')]('closed')){_0x3fbc72[_0x5324('0xd')]=moment()['format'](_0x5324('0xe'));}_0x28bc16(null,_0x3fbc72);}},'charset':_0x5324('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 86d63bf..92d337a 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 _0x2286=['../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x43f2af,_0x5c563c){var _0x423674=function(_0x3be993){while(--_0x3be993){_0x43f2af['push'](_0x43f2af['shift']());}};_0x423674(++_0x5c563c);}(_0x2286,0x167));var _0x6228=function(_0x5a4825,_0x27644a){_0x5a4825=_0x5a4825-0x0;var _0x9f2654=_0x2286[_0x5a4825];return _0x9f2654;};'use strict';var _=require(_0x6228('0x0'));var util=require('util');var moment=require(_0x6228('0x1'));var BPromise=require(_0x6228('0x2'));var rs=require(_0x6228('0x3'));var fs=require('fs');var Redis=require(_0x6228('0x4'));var db=require(_0x6228('0x5'))['db'];var utils=require(_0x6228('0x6'));var logger=require(_0x6228('0x7'))(_0x6228('0x8'));var config=require(_0x6228('0x9'));var jayson=require(_0x6228('0xa'));var client=jayson[_0x6228('0xb')]['http']({'port':0x232a});config['redis']=_[_0x6228('0xc')](config[_0x6228('0xd')],{'host':_0x6228('0xe'),'port':0x18eb});var socket=require(_0x6228('0xf'))(new Redis(config[_0x6228('0xd')]));require(_0x6228('0x10'))[_0x6228('0x11')](socket);function respondWithRpcPromise(_0x112a6b,_0x255a7c,_0x26e8c8){return new BPromise(function(_0x392c38,_0x26c305){return client['request'](_0x112a6b,_0x26e8c8)['then'](function(_0x454310){logger[_0x6228('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x255a7c,_0x6228('0x13'));logger[_0x6228('0x14')](_0x6228('0x15'),_0x255a7c,'request\x20sent',JSON[_0x6228('0x16')](_0x454310));if(_0x454310[_0x6228('0x17')]){if(_0x454310[_0x6228('0x17')][_0x6228('0x18')]===0x1f4){logger[_0x6228('0x17')](_0x6228('0x19'),_0x255a7c,_0x454310[_0x6228('0x17')][_0x6228('0x1a')]);return _0x26c305(_0x454310['error'][_0x6228('0x1a')]);}logger[_0x6228('0x17')](_0x6228('0x19'),_0x255a7c,_0x454310[_0x6228('0x17')][_0x6228('0x1a')]);return _0x392c38(_0x454310[_0x6228('0x17')]['message']);}else{logger[_0x6228('0x12')](_0x6228('0x19'),_0x255a7c,_0x6228('0x13'));_0x392c38(_0x454310[_0x6228('0x1b')]['message']);}})[_0x6228('0x1c')](function(_0x1e27b2){logger[_0x6228('0x17')](_0x6228('0x19'),_0x255a7c,_0x1e27b2);_0x26c305(_0x1e27b2);});});}exports[_0x6228('0x1d')]=function(_0x2228ae){var _0x2a0be8=this;return new Promise(function(_0x5dbc46,_0x152a62){return db[_0x6228('0x1e')][_0x6228('0x1f')](_0x2228ae[_0x6228('0x20')],{'raw':_0x2228ae[_0x6228('0x21')]?_0x2228ae[_0x6228('0x21')][_0x6228('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2228ae['options']?_0x2228ae[_0x6228('0x21')][_0x6228('0x23')]||null:null,'attributes':_0x2228ae[_0x6228('0x21')]?_0x2228ae['options'][_0x6228('0x24')]||null:null,'limit':_0x2228ae[_0x6228('0x21')]?_0x2228ae['options'][_0x6228('0x25')]||null:null})['then'](function(_0x407063){logger['info']('UpdateChatInteraction',_0x2228ae);logger[_0x6228('0x14')](_0x6228('0x1d'),_0x2228ae,JSON['stringify'](_0x407063));_0x5dbc46(_0x407063);})['catch'](function(_0x53a0a9){logger[_0x6228('0x17')]('UpdateChatInteraction',_0x53a0a9['message'],_0x2228ae);_0x152a62(_0x2a0be8[_0x6228('0x17')](0x1f4,_0x53a0a9[_0x6228('0x1a')]));});});};exports[_0x6228('0x26')]=function(_0x2e1fd6){return new Promise(function(_0xbc2052,_0x22cafc){return db['ChatInteraction'][_0x6228('0x27')]({'where':_0x2e1fd6['options']?_0x2e1fd6[_0x6228('0x21')][_0x6228('0x23')]||null:null})[_0x6228('0x28')](function(_0x46f8ce){if(_0x46f8ce){return _0x46f8ce[_0x6228('0x29')](_0x2e1fd6[_0x6228('0x20')][_0x6228('0x2a')],_[_0x6228('0x2b')](_0x2e1fd6['body'],[_0x6228('0x2a'),'id'])||{});}})[_0x6228('0x2c')](function(_0x271609){logger[_0x6228('0x12')](_0x6228('0x2d'),_0x2e1fd6);logger[_0x6228('0x14')](_0x6228('0x2d'),_0x2e1fd6,JSON[_0x6228('0x16')](_0x271609));_0xbc2052(_0x271609);})['catch'](function(_0x431e2e){logger['error']('AddTags',_0x431e2e['message'],_0x2e1fd6);_0x22cafc(_this[_0x6228('0x17')](0x1f4,_0x431e2e[_0x6228('0x1a')]));});});}; \ No newline at end of file +var _0x400f=['then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','AddTags','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','redis','./chatInteraction.socket','register','request'];(function(_0x4f98bd,_0x5a478d){var _0x143a7d=function(_0xb4e744){while(--_0xb4e744){_0x4f98bd['push'](_0x4f98bd['shift']());}};_0x143a7d(++_0x5a478d);}(_0x400f,0xb6));var _0xf400=function(_0x11fb34,_0x14675b){_0x11fb34=_0x11fb34-0x0;var _0x160715=_0x400f[_0x11fb34];return _0x160715;};'use strict';var _=require(_0xf400('0x0'));var util=require(_0xf400('0x1'));var moment=require('moment');var BPromise=require(_0xf400('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf400('0x3'))(_0xf400('0x4'));var config=require(_0xf400('0x5'));var jayson=require(_0xf400('0x6'));var client=jayson['client'][_0xf400('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf400('0x8'))(new Redis(config[_0xf400('0x9')]));require(_0xf400('0xa'))[_0xf400('0xb')](socket);function respondWithRpcPromise(_0x3fa674,_0x5a8e84,_0x7b62f0){return new BPromise(function(_0x3e3eb2,_0x43255b){return client[_0xf400('0xc')](_0x3fa674,_0x7b62f0)[_0xf400('0xd')](function(_0x168c59){logger[_0xf400('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x5a8e84,_0xf400('0xf'));logger[_0xf400('0x10')](_0xf400('0x11'),_0x5a8e84,_0xf400('0xf'),JSON[_0xf400('0x12')](_0x168c59));if(_0x168c59[_0xf400('0x13')]){if(_0x168c59[_0xf400('0x13')][_0xf400('0x14')]===0x1f4){logger[_0xf400('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5a8e84,_0x168c59['error'][_0xf400('0x15')]);return _0x43255b(_0x168c59[_0xf400('0x13')]['message']);}logger[_0xf400('0x13')](_0xf400('0x16'),_0x5a8e84,_0x168c59['error'][_0xf400('0x15')]);return _0x3e3eb2(_0x168c59[_0xf400('0x13')]['message']);}else{logger[_0xf400('0xe')](_0xf400('0x16'),_0x5a8e84,'request\x20sent');_0x3e3eb2(_0x168c59[_0xf400('0x17')]['message']);}})[_0xf400('0x18')](function(_0x56b868){logger['error'](_0xf400('0x16'),_0x5a8e84,_0x56b868);_0x43255b(_0x56b868);});});}exports[_0xf400('0x19')]=function(_0x5ad35d){var _0x49ebe8=this;return new Promise(function(_0x4f82a0,_0x2123da){return db[_0xf400('0x1a')][_0xf400('0x1b')](_0x5ad35d[_0xf400('0x1c')],{'raw':_0x5ad35d['options']?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad35d[_0xf400('0x1d')]?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x1f')]||null:null,'attributes':_0x5ad35d['options']?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x20')]||null:null,'limit':_0x5ad35d[_0xf400('0x1d')]?_0x5ad35d[_0xf400('0x1d')][_0xf400('0x21')]||null:null})[_0xf400('0xd')](function(_0x4bd5b1){logger[_0xf400('0xe')](_0xf400('0x19'),_0x5ad35d);logger[_0xf400('0x10')](_0xf400('0x19'),_0x5ad35d,JSON[_0xf400('0x12')](_0x4bd5b1));_0x4f82a0(_0x4bd5b1);})[_0xf400('0x18')](function(_0x5560ed){logger['error'](_0xf400('0x19'),_0x5560ed[_0xf400('0x15')],_0x5ad35d);_0x2123da(_0x49ebe8['error'](0x1f4,_0x5560ed[_0xf400('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x524032){return new Promise(function(_0x40d22c,_0x213fdb){return db[_0xf400('0x1a')][_0xf400('0x22')]({'where':_0x524032[_0xf400('0x1d')]?_0x524032['options'][_0xf400('0x1f')]||null:null})[_0xf400('0xd')](function(_0x4584f2){if(_0x4584f2){return _0x4584f2[_0xf400('0x23')](_0x524032['body'][_0xf400('0x24')],_[_0xf400('0x25')](_0x524032[_0xf400('0x1c')],[_0xf400('0x24'),'id'])||{});}})['spread'](function(_0xa00a1c){logger[_0xf400('0xe')](_0xf400('0x26'),_0x524032);logger[_0xf400('0x10')](_0xf400('0x26'),_0x524032,JSON[_0xf400('0x12')](_0xa00a1c));_0x40d22c(_0xa00a1c);})['catch'](function(_0x104cde){logger['error']('AddTags',_0x104cde[_0xf400('0x15')],_0x524032);_0x213fdb(_this[_0xf400('0x13')](0x1f4,_0x104cde['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9c7d2ab..c174c37 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 _0xf38a=['register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x5345e0,_0x1c93a4){var _0x35e35b=function(_0x2925ba){while(--_0x2925ba){_0x5345e0['push'](_0x5345e0['shift']());}};_0x35e35b(++_0x1c93a4);}(_0xf38a,0x133));var _0xaf38=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xf38a[_0x2d994d];return _0xd54be4;};'use strict';var ChatInteractionEvents=require(_0xaf38('0x0'));var events=[_0xaf38('0x1'),_0xaf38('0x2'),'update'];function createListener(_0x17e63b,_0x38cc07){return function(_0x6570b6){_0x38cc07['emit'](_0x17e63b,_0x6570b6);};}function removeListener(_0x275a3b,_0x5e2baf){return function(){ChatInteractionEvents['removeListener'](_0x275a3b,_0x5e2baf);};}exports[_0xaf38('0x3')]=function(_0x13a854){for(var _0x25b1ee=0x0,_0x22d364=events['length'];_0x25b1ee<_0x22d364;_0x25b1ee++){var _0x34144d=events[_0x25b1ee];var _0xdccb18=createListener(_0xaf38('0x4')+_0x34144d,_0x13a854);ChatInteractionEvents['on'](_0x34144d,_0xdccb18);}}; \ No newline at end of file +var _0x4ce3=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','update'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x4ce3,0x1be));var _0x34ce=function(_0x112c0d,_0x5af795){_0x112c0d=_0x112c0d-0x0;var _0xcb9325=_0x4ce3[_0x112c0d];return _0xcb9325;};'use strict';var ChatInteractionEvents=require(_0x34ce('0x0'));var events=['save','remove',_0x34ce('0x1')];function createListener(_0x50cf5b,_0x44ab70){return function(_0x333ff4){_0x44ab70[_0x34ce('0x2')](_0x50cf5b,_0x333ff4);};}function removeListener(_0x4f60a4,_0x55ec2c){return function(){ChatInteractionEvents[_0x34ce('0x3')](_0x4f60a4,_0x55ec2c);};}exports[_0x34ce('0x4')]=function(_0x21dcab){for(var _0x2bc5f4=0x0,_0x242f1c=events[_0x34ce('0x5')];_0x2bc5f4<_0x242f1c;_0x2bc5f4++){var _0xa54b2f=events[_0x2bc5f4];var _0x54f844=createListener(_0x34ce('0x6')+_0xa54b2f,_0x21dcab);ChatInteractionEvents['on'](_0xa54b2f,_0x54f844);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e4b7334..1991aed 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 _0xd052=['chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','path','express','../../components/interaction/service','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat'];(function(_0x1bc930,_0x5b74cd){var _0x24eda7=function(_0x494b73){while(--_0x494b73){_0x1bc930['push'](_0x1bc930['shift']());}};_0x24eda7(++_0x5b74cd);}(_0xd052,0x69));var _0x2d05=function(_0x1b87a5,_0x5875ef){_0x1b87a5=_0x1b87a5-0x0;var _0x212666=_0xd052[_0x1b87a5];return _0x212666;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d05('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d05('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d05('0x2'));var config=require('../../config/environment');var controller=require(_0x2d05('0x3'));router[_0x2d05('0x4')]('/',auth['isAuthenticated'](),controller[_0x2d05('0x5')]);router[_0x2d05('0x4')](_0x2d05('0x6'),auth[_0x2d05('0x7')](),controller[_0x2d05('0x8')]);router[_0x2d05('0x4')](_0x2d05('0x9'),auth[_0x2d05('0xa')](),controller[_0x2d05('0xb')]);router[_0x2d05('0x4')](_0x2d05('0xc'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router['get'](_0x2d05('0xd'),auth[_0x2d05('0x7')](),controller[_0x2d05('0xe')]);router[_0x2d05('0x4')]('/:id/my_messages',auth[_0x2d05('0xa')](),controller['getMyMessages']);router[_0x2d05('0x4')](_0x2d05('0xf'),auth[_0x2d05('0x7')](),controller['download']);router[_0x2d05('0x10')]('/',auth[_0x2d05('0x7')](),controller[_0x2d05('0x11')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x2d05('0x12')]);var upload=multer({'storage':multer[_0x2d05('0x13')]({'destination':function(_0x4cf64f,_0x2a68bd,_0x5bf467){_0x5bf467(null,path['join'](config[_0x2d05('0x14')],_0x2d05('0x15')));},'filename':function(_0x4b02be,_0x15b13c,_0x3f9b30){_0x3f9b30(null,util[_0x2d05('0x16')](_0x2d05('0x17'),Date[_0x2d05('0x18')](),_0x15b13c['originalname'][_0x2d05('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2d05('0x10')](_0x2d05('0x1a'),upload['single'](_0x2d05('0x1b')),controller[_0x2d05('0x1c')]);router[_0x2d05('0x10')](_0x2d05('0xd'),auth[_0x2d05('0xa')](),controller[_0x2d05('0x1d')]);router[_0x2d05('0x10')](_0x2d05('0x1e'),auth[_0x2d05('0x7')](),interaction[_0x2d05('0x1f')]('chat',_0x2d05('0x20')),controller[_0x2d05('0x21')]);router[_0x2d05('0x22')](_0x2d05('0x9'),auth[_0x2d05('0x7')](),interaction[_0x2d05('0x1f')](_0x2d05('0x23'),_0x2d05('0x24')),controller[_0x2d05('0x25')]);router['put'](_0x2d05('0x26'),controller[_0x2d05('0x27')]);router[_0x2d05('0x22')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x2d05('0x22')](_0x2d05('0x28'),controller[_0x2d05('0x29')]);router[_0x2d05('0x2a')](_0x2d05('0x9'),auth['isAuthenticated'](),interaction[_0x2d05('0x1f')]('chat',_0x2d05('0x2b')),controller[_0x2d05('0x2c')]);router[_0x2d05('0x2a')](_0x2d05('0x1e'),auth[_0x2d05('0x7')](),controller[_0x2d05('0x2d')]);module[_0x2d05('0x2e')]=router; \ No newline at end of file +var _0xd878=['originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','%s-%s','now'];(function(_0x113202,_0x138d83){var _0xfa095=function(_0xb3746b){while(--_0xb3746b){_0x113202['push'](_0x113202['shift']());}};_0xfa095(++_0x138d83);}(_0xd878,0x118));var _0x8d87=function(_0x5016a2,_0xfaec3d){_0x5016a2=_0x5016a2-0x0;var _0xfac792=_0xd878[_0x5016a2];return _0xfac792;};'use strict';var multer=require(_0x8d87('0x0'));var util=require(_0x8d87('0x1'));var path=require(_0x8d87('0x2'));var timeout=require(_0x8d87('0x3'));var express=require(_0x8d87('0x4'));var router=express[_0x8d87('0x5')]();var auth=require(_0x8d87('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x8d87('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8d87('0x7')](_0x8d87('0x8'),auth[_0x8d87('0x9')](),controller[_0x8d87('0xa')]);router[_0x8d87('0x7')](_0x8d87('0xb'),auth[_0x8d87('0xc')](),controller[_0x8d87('0xd')]);router[_0x8d87('0x7')]('/:id/attachment_download',auth[_0x8d87('0xc')](),controller['attachmentDownload']);router['get'](_0x8d87('0xe'),auth[_0x8d87('0x9')](),controller[_0x8d87('0xf')]);router[_0x8d87('0x7')](_0x8d87('0x10'),auth[_0x8d87('0xc')](),controller['getMyMessages']);router[_0x8d87('0x7')]('/:id/download',auth[_0x8d87('0x9')](),controller['download']);router[_0x8d87('0x11')]('/',auth[_0x8d87('0x9')](),controller[_0x8d87('0x12')]);router['post'](_0x8d87('0x13'),auth[_0x8d87('0x9')](),controller[_0x8d87('0x14')]);var upload=multer({'storage':multer[_0x8d87('0x15')]({'destination':function(_0x5954d3,_0x1d6695,_0x28c54e){_0x28c54e(null,path[_0x8d87('0x16')](config[_0x8d87('0x17')],'server/files/attachments/'));},'filename':function(_0x34ead7,_0x3326d5,_0x5b627f){_0x5b627f(null,util['format'](_0x8d87('0x18'),Date[_0x8d87('0x19')](),_0x3326d5[_0x8d87('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8d87('0x11')](_0x8d87('0x1b'),upload[_0x8d87('0x1c')](_0x8d87('0x1d')),controller[_0x8d87('0x1e')]);router[_0x8d87('0x11')](_0x8d87('0xe'),auth[_0x8d87('0xc')](),controller[_0x8d87('0x1f')]);router[_0x8d87('0x11')](_0x8d87('0x20'),auth[_0x8d87('0x9')](),interaction[_0x8d87('0x21')](_0x8d87('0x22'),_0x8d87('0x23')),controller[_0x8d87('0x24')]);router[_0x8d87('0x25')](_0x8d87('0xb'),auth[_0x8d87('0x9')](),interaction['tracked'](_0x8d87('0x22'),_0x8d87('0x26')),controller[_0x8d87('0x27')]);router['put'](_0x8d87('0x28'),controller[_0x8d87('0x29')]);router[_0x8d87('0x25')](_0x8d87('0x2a'),auth[_0x8d87('0xc')](),controller[_0x8d87('0x2b')]);router[_0x8d87('0x25')](_0x8d87('0x2c'),controller[_0x8d87('0x2d')]);router[_0x8d87('0x2e')](_0x8d87('0xb'),auth[_0x8d87('0x9')](),interaction[_0x8d87('0x21')](_0x8d87('0x22'),_0x8d87('0x2f')),controller[_0x8d87('0x30')]);router[_0x8d87('0x2e')](_0x8d87('0x20'),auth[_0x8d87('0x9')](),controller[_0x8d87('0x31')]);module[_0x8d87('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index dc5af17..055e3ef 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 _0xadb5=['INTEGER','exports','medium','BOOLEAN'];(function(_0x2f0948,_0x1e86ee){var _0x3de563=function(_0x5c1dbc){while(--_0x5c1dbc){_0x2f0948['push'](_0x2f0948['shift']());}};_0x3de563(++_0x1e86ee);}(_0xadb5,0xad));var _0x5adb=function(_0xe36231,_0x5c222d){_0xe36231=_0xe36231-0x0;var _0x3cac4e=_0xadb5[_0xe36231];return _0x3cac4e;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5adb('0x3')]}}; \ No newline at end of file +var _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x9d4d4a,_0x5ac72f){var _0x393234=function(_0x37b9cf){while(--_0x37b9cf){_0x9d4d4a['push'](_0x9d4d4a['shift']());}};_0x393234(++_0x5ac72f);}(_0x66fa,0x117));var _0xa66f=function(_0x35d70c,_0x5628e6){_0x35d70c=_0x35d70c-0x0;var _0x5aeb21=_0x66fa[_0x35d70c];return _0x5aeb21;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index b541cda..35f0d49 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 _0x7c86=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','user','role','userpic','online','lastLoginAt','showWebBar','VoiceQueue','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','all','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','status','end','json','count','offset','limit','set','reject','save','then','destroy','sendStatus','error','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c86,0x171));var _0x67c8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x7c86[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0x67c8('0x0'));var emlformat=require(_0x67c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x67c8('0x2'));var jsonpatch=require(_0x67c8('0x3'));var rp=require(_0x67c8('0x4'));var moment=require(_0x67c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x67c8('0x6'));var util=require(_0x67c8('0x7'));var path=require(_0x67c8('0x8'));var sox=require('sox');var csv=require(_0x67c8('0x9'));var ejs=require(_0x67c8('0xa'));var fs=require('fs');var _=require(_0x67c8('0xb'));var squel=require(_0x67c8('0xc'));var crypto=require(_0x67c8('0xd'));var jsforce=require(_0x67c8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x67c8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x67c8('0xf'));var authService=require(_0x67c8('0x10'));var qs=require(_0x67c8('0x11'));var as=require(_0x67c8('0x12'));var hardwareService=require(_0x67c8('0x13'));var logger=require(_0x67c8('0x14'))(_0x67c8('0x15'));var utils=require(_0x67c8('0x16'));var config=require('../../config/environment');var db=require(_0x67c8('0x17'))['db'];config[_0x67c8('0x18')]=_[_0x67c8('0x19')](config[_0x67c8('0x18')],{'host':_0x67c8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67c8('0x18')]));require(_0x67c8('0x1b'))[_0x67c8('0x1c')](socket);function respondWithStatusCode(_0x10a6d1,_0xdd44ae){_0xdd44ae=_0xdd44ae||0xcc;return function(_0xc73b4d){if(_0xc73b4d){return _0x10a6d1['sendStatus'](_0xdd44ae);}return _0x10a6d1[_0x67c8('0x1d')](_0xdd44ae)[_0x67c8('0x1e')]();};}function respondWithResult(_0x4347e5,_0x37ed79){_0x37ed79=_0x37ed79||0xc8;return function(_0x483ff9){if(_0x483ff9){return _0x4347e5[_0x67c8('0x1d')](_0x37ed79)[_0x67c8('0x1f')](_0x483ff9);}};}function respondWithFilteredResult(_0x29e2a8,_0xbdadcc){return function(_0x36a917){if(_0x36a917){var _0x4a06e6=_0x36a917[_0x67c8('0x20')],_0x427db3=_0xbdadcc[_0x67c8('0x21')],_0x4a0789=_0xbdadcc[_0x67c8('0x21')]+_0xbdadcc[_0x67c8('0x22')],_0x2728d1;if(_0x4a0789>=_0x4a06e6){_0x4a0789=_0x4a06e6;_0x2728d1=0xc8;}else{_0x2728d1=0xce;}_0x29e2a8[_0x67c8('0x1d')](_0x2728d1);return _0x29e2a8[_0x67c8('0x23')]('Content-Range',_0x427db3+'-'+_0x4a0789+'/'+_0x4a06e6)[_0x67c8('0x1f')](_0x36a917);}return null;};}function patchUpdates(_0xb5f990){return function(_0x3f5eb3){try{jsonpatch['apply'](_0x3f5eb3,_0xb5f990,!![]);}catch(_0x531cd9){return BPromise[_0x67c8('0x24')](_0x531cd9);}return _0x3f5eb3[_0x67c8('0x25')]();};}function saveUpdates(_0x336bdb,_0x5c5880){return function(_0x1a89f5){if(_0x1a89f5){return _0x1a89f5['update'](_0x336bdb)[_0x67c8('0x26')](function(_0x3316db){return _0x3316db;});}return null;};}function removeEntity(_0x9cc1f5,_0x479e8b){return function(_0x348048){if(_0x348048){return _0x348048[_0x67c8('0x27')]()[_0x67c8('0x26')](function(){_0x9cc1f5[_0x67c8('0x1d')](0xcc)[_0x67c8('0x1e')]();});}};}function handleEntityNotFound(_0x54a12b,_0xc79ba6){return function(_0x4d96f3){if(!_0x4d96f3){_0x54a12b[_0x67c8('0x28')](0x194);}return _0x4d96f3;};}function handleError(_0x1dbce4,_0x4bd5b1){_0x4bd5b1=_0x4bd5b1||0x1f4;return function(_0x165f48){logger[_0x67c8('0x29')](_0x165f48['stack']);if(_0x165f48['name']){delete _0x165f48['name'];}_0x1dbce4['status'](_0x4bd5b1)[_0x67c8('0x2a')](_0x165f48);};}exports[_0x67c8('0x2b')]=function(_0x2365ca,_0x1d730d){var _0x308d3d={},_0x534ab9={},_0x29b749={'count':0x0,'rows':[]};var _0x35fa0e=_[_0x67c8('0x2c')](db[_0x67c8('0x2d')][_0x67c8('0x2e')],function(_0x5c452d){return{'name':_0x5c452d[_0x67c8('0x2f')],'type':_0x5c452d[_0x67c8('0x30')][_0x67c8('0x31')]};});_0x534ab9[_0x67c8('0x32')]=_[_0x67c8('0x2c')](_0x35fa0e,_0x67c8('0x33'));_0x534ab9[_0x67c8('0x34')]=_[_0x67c8('0x35')](_0x2365ca[_0x67c8('0x34')]);_0x534ab9[_0x67c8('0x36')]=_[_0x67c8('0x37')](_0x534ab9[_0x67c8('0x32')],_0x534ab9[_0x67c8('0x34')]);_0x308d3d[_0x67c8('0x38')]=_[_0x67c8('0x37')](_0x534ab9[_0x67c8('0x32')],qs[_0x67c8('0x39')](_0x2365ca[_0x67c8('0x34')][_0x67c8('0x39')]));_0x308d3d[_0x67c8('0x38')]=_0x308d3d[_0x67c8('0x38')]['length']?_0x308d3d[_0x67c8('0x38')]:_0x534ab9['model'];if(!_0x2365ca[_0x67c8('0x34')][_0x67c8('0x3a')](_0x67c8('0x3b'))){_0x308d3d[_0x67c8('0x22')]=qs[_0x67c8('0x22')](_0x2365ca[_0x67c8('0x34')]['limit']);_0x308d3d[_0x67c8('0x21')]=qs[_0x67c8('0x21')](_0x2365ca['query'][_0x67c8('0x21')]);}_0x308d3d[_0x67c8('0x3c')]=qs['sort'](_0x2365ca['query'][_0x67c8('0x3d')]);_0x308d3d[_0x67c8('0x3e')]=qs[_0x67c8('0x36')](_[_0x67c8('0x3f')](_0x2365ca['query'],_0x534ab9[_0x67c8('0x36')]),_0x35fa0e);if(_0x2365ca[_0x67c8('0x34')][_0x67c8('0x40')]){_0x308d3d['where']=_[_0x67c8('0x41')](_0x308d3d['where'],{'$or':_['map'](_0x35fa0e,function(_0x429dda){if(_0x429dda[_0x67c8('0x30')]!==_0x67c8('0x42')){var _0x42cb7c={};_0x42cb7c[_0x429dda[_0x67c8('0x33')]]={'$like':'%'+_0x2365ca[_0x67c8('0x34')]['filter']+'%'};return _0x42cb7c;}})});}_0x308d3d=_[_0x67c8('0x41')]({},_0x308d3d,_0x2365ca[_0x67c8('0x43')]);var _0x475231={'where':_0x308d3d['where']};return db[_0x67c8('0x2d')]['count'](_0x475231)[_0x67c8('0x26')](function(_0x475569){_0x29b749[_0x67c8('0x20')]=_0x475569;if(_0x2365ca['query'][_0x67c8('0x44')]){_0x308d3d['include']=[{'all':!![]}];}return db[_0x67c8('0x2d')]['findAll'](_0x308d3d);})['then'](function(_0x321d73){_0x29b749[_0x67c8('0x45')]=_0x321d73;return _0x29b749;})[_0x67c8('0x26')](respondWithFilteredResult(_0x1d730d,_0x308d3d))[_0x67c8('0x46')](handleError(_0x1d730d,null));};exports[_0x67c8('0x47')]=function(_0x2ae283,_0x1f9506){var _0xa1b285={'raw':!![],'where':{'id':_0x2ae283[_0x67c8('0x48')]['id']}},_0xa4ea5e={};_0xa4ea5e[_0x67c8('0x32')]=_[_0x67c8('0x35')](db['ChatInternalMessage'][_0x67c8('0x2e')]);_0xa4ea5e['query']=_['keys'](_0x2ae283[_0x67c8('0x34')]);_0xa4ea5e[_0x67c8('0x36')]=_[_0x67c8('0x37')](_0xa4ea5e['model'],_0xa4ea5e[_0x67c8('0x34')]);_0xa1b285[_0x67c8('0x38')]=_[_0x67c8('0x37')](_0xa4ea5e['model'],qs[_0x67c8('0x39')](_0x2ae283[_0x67c8('0x34')][_0x67c8('0x39')]));_0xa1b285[_0x67c8('0x38')]=_0xa1b285[_0x67c8('0x38')][_0x67c8('0x49')]?_0xa1b285[_0x67c8('0x38')]:_0xa4ea5e[_0x67c8('0x32')];if(_0x2ae283[_0x67c8('0x34')]['includeAll']){_0xa1b285[_0x67c8('0x4a')]=[{'all':!![]}];}_0xa1b285=_[_0x67c8('0x41')]({},_0xa1b285,_0x2ae283['options']);return db[_0x67c8('0x2d')][_0x67c8('0x4b')](_0xa1b285)[_0x67c8('0x26')](handleEntityNotFound(_0x1f9506,null))[_0x67c8('0x26')](respondWithResult(_0x1f9506,null))['catch'](handleError(_0x1f9506,null));};exports['create']=function(_0x2101f8,_0x14f74b){return db[_0x67c8('0x2d')]['create'](_0x2101f8[_0x67c8('0x4c')],{})[_0x67c8('0x26')](respondWithResult(_0x14f74b,0xc9))[_0x67c8('0x46')](handleError(_0x14f74b,null));};exports[_0x67c8('0x4d')]=function(_0x527bc3,_0x2be485){if(_0x527bc3['body']['id']){delete _0x527bc3[_0x67c8('0x4c')]['id'];}return db[_0x67c8('0x2d')][_0x67c8('0x4b')]({'where':{'id':_0x527bc3[_0x67c8('0x48')]['id']}})[_0x67c8('0x26')](handleEntityNotFound(_0x2be485,null))[_0x67c8('0x26')](saveUpdates(_0x527bc3[_0x67c8('0x4c')],null))[_0x67c8('0x26')](respondWithResult(_0x2be485,null))[_0x67c8('0x46')](handleError(_0x2be485,null));};exports[_0x67c8('0x27')]=function(_0x1adb9c,_0xbfd7fe){return db[_0x67c8('0x2d')][_0x67c8('0x4b')]({'where':{'id':_0x1adb9c[_0x67c8('0x48')]['id']}})[_0x67c8('0x26')](handleEntityNotFound(_0xbfd7fe,null))[_0x67c8('0x26')](removeEntity(_0xbfd7fe,null))[_0x67c8('0x46')](handleError(_0xbfd7fe,null));};exports[_0x67c8('0x4e')]=function(_0x241cc8,_0x4a26f1){return db[_0x67c8('0x2d')][_0x67c8('0x4e')]()['then'](respondWithResult(_0x4a26f1,null))[_0x67c8('0x46')](handleError(_0x4a26f1,null));};function wrapUser(_0x189f98){return function(_0x441503){var _0x5bddb4=_0x189f98[_0x67c8('0x4f')]({'plain':!![]});_0x5bddb4[_0x67c8('0x50')]=[];if(_0x441503){_0x5bddb4[_0x67c8('0x51')]=_0x441503[_0x67c8('0x52')];_0x5bddb4[_0x67c8('0x53')]=_0x441503;}else{_0x5bddb4[_0x67c8('0x51')]=moment(0x0)[_0x67c8('0x54')](_0x67c8('0x55'));_0x5bddb4[_0x67c8('0x53')]={};}return _0x5bddb4;};}exports[_0x67c8('0x56')]=function(_0xa08f8f,_0xa91b2f,_0x4cbc46){var _0x40c589=[];return db['User'][_0x67c8('0x57')]({'where':{'role':[_0x67c8('0x58'),_0x67c8('0x59'),_0x67c8('0x5a')]},'attributes':['id','fullname',_0x67c8('0x33'),_0x67c8('0x5b'),_0x67c8('0x5c'),'internal',_0x67c8('0x5d'),_0x67c8('0x5e'),'allowmessenger',_0x67c8('0x5f')],'order':qs[_0x67c8('0x3d')]('-online'),'include':[{'model':db[_0x67c8('0x60')],'as':'VoiceQueues','attributes':['id',_0x67c8('0x33'),_0x67c8('0x30')],'through':{'attributes':[]}}]})[_0x67c8('0x26')](function(_0x2212aa){if(_0x2212aa){var _0x23813b=_0xa08f8f[_0x67c8('0x5a')][_0x67c8('0x4f')]({'plain':!![]});if(!_0x23813b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23813b[_0x67c8('0x5b')]===_0x67c8('0x5a')){return db[_0x67c8('0x61')][_0x67c8('0x4b')]({'where':{'name':'Agents','userProfileId':_0x23813b[_0x67c8('0x62')]},'raw':!![]})['then'](function(_0x2c03a1){if(_0x2c03a1){if(_0x2c03a1[_0x67c8('0x63')]===0x0){return db[_0x67c8('0x64')][_0x67c8('0x57')]({'where':{'sectionId':_0x2c03a1['id']},'raw':!![]})[_0x67c8('0x26')](function(_0x1a513a){var _0x2de889=[];if(_[_0x67c8('0x65')](_0x1a513a)){_0x2de889=_['filter'](_0x2212aa,function(_0x2e73dc){if(_0x2e73dc['role']!==_0x67c8('0x58')){return _0x2e73dc;}});return _0x2de889;}else{for(var _0x57a813=0x0;_0x57a813<_0x2212aa[_0x67c8('0x49')];_0x57a813++){var _0x1236bd=_0x2212aa[_0x57a813];if(_0x1236bd[_0x67c8('0x5b')]==='agent'){var _0x3c4370=_[_0x67c8('0x4b')](_0x1a513a,function(_0x516ac9){return _0x516ac9[_0x67c8('0x66')]===_0x1236bd['id'];});if(_0x3c4370)_0x2de889['push'](_0x1236bd);}else{_0x2de889[_0x67c8('0x67')](_0x1236bd);}}return _0x2de889;}});}else{return _0x2212aa;}}else{var _0x526551=_[_0x67c8('0x40')](_0x2212aa,function(_0x3d713e){if(_0x3d713e['role']!==_0x67c8('0x58')){return _0x3d713e;}});return _0x526551;}});}else{return _0x2212aa;}}})['then'](function(_0xe3ffdd){var _0x46e793=[];if(_0xe3ffdd){_0x40c589=_0xe3ffdd;for(var _0x15bf76=0x0;_0x15bf76<_0xe3ffdd[_0x67c8('0x49')];_0x15bf76+=0x1){_0x40c589[_0x15bf76]['messages']=[];_0x46e793[_0x67c8('0x67')](db['ChatInternalMessage'][_0x67c8('0x4b')]({'where':{'FromId':[_0xa08f8f[_0x67c8('0x5a')]['id'],_0xe3ffdd[_0x15bf76]['id']],'ToId':[_0xa08f8f[_0x67c8('0x5a')]['id'],_0xe3ffdd[_0x15bf76]['id']],'ChatGroupId':null},'attributes':['id',_0x67c8('0x52'),_0x67c8('0x68'),'ToId','read',_0x67c8('0x4c')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xe3ffdd[_0x15bf76])));}return BPromise[_0x67c8('0x69')](_0x46e793);}return[];})[_0x67c8('0x26')](function(_0x1979e6){return{'rows':_0x1979e6,'count':_0x1979e6['length']};})[_0x67c8('0x26')](respondWithResult(_0xa91b2f,null))[_0x67c8('0x46')](handleError(_0xa91b2f,null));}; \ No newline at end of file +var _0x9a99=['pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','update','describe','messages','lastMessageAt','createdAt','lastMessage','admin','user','userpic','internal','online','allowmessenger','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','findAll','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','index','ChatInternalMessage','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1effd2,_0x13627b){var _0x1d3bcf=function(_0x56be81){while(--_0x56be81){_0x1effd2['push'](_0x1effd2['shift']());}};_0x1d3bcf(++_0x13627b);}(_0x9a99,0x91));var _0x99a9=function(_0x16a93a,_0x1035d5){_0x16a93a=_0x16a93a-0x0;var _0x406b01=_0x9a99[_0x16a93a];return _0x406b01;};'use strict';var pdf=require(_0x99a9('0x0'));var emlformat=require(_0x99a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x99a9('0x2'));var jsonpatch=require(_0x99a9('0x3'));var rp=require(_0x99a9('0x4'));var moment=require(_0x99a9('0x5'));var BPromise=require(_0x99a9('0x6'));var Mustache=require(_0x99a9('0x7'));var util=require(_0x99a9('0x8'));var path=require(_0x99a9('0x9'));var sox=require(_0x99a9('0xa'));var csv=require('to-csv');var ejs=require(_0x99a9('0xb'));var fs=require('fs');var _=require(_0x99a9('0xc'));var squel=require(_0x99a9('0xd'));var crypto=require(_0x99a9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x99a9('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a9('0x10'));var authService=require(_0x99a9('0x11'));var qs=require(_0x99a9('0x12'));var as=require(_0x99a9('0x13'));var hardwareService=require(_0x99a9('0x14'));var logger=require('../../config/logger')(_0x99a9('0x15'));var utils=require(_0x99a9('0x16'));var config=require('../../config/environment');var db=require(_0x99a9('0x17'))['db'];config[_0x99a9('0x18')]=_['defaults'](config[_0x99a9('0x18')],{'host':_0x99a9('0x19'),'port':0x18eb});var socket=require(_0x99a9('0x1a'))(new Redis(config[_0x99a9('0x18')]));require(_0x99a9('0x1b'))[_0x99a9('0x1c')](socket);function respondWithStatusCode(_0x3bef1a,_0x42cfe7){_0x42cfe7=_0x42cfe7||0xcc;return function(_0x1493c0){if(_0x1493c0){return _0x3bef1a[_0x99a9('0x1d')](_0x42cfe7);}return _0x3bef1a[_0x99a9('0x1e')](_0x42cfe7)[_0x99a9('0x1f')]();};}function respondWithResult(_0x524753,_0x2d7d21){_0x2d7d21=_0x2d7d21||0xc8;return function(_0x485150){if(_0x485150){return _0x524753[_0x99a9('0x1e')](_0x2d7d21)[_0x99a9('0x20')](_0x485150);}};}function respondWithFilteredResult(_0x3c3d03,_0x374662){return function(_0x17cee8){if(_0x17cee8){var _0x1c7fe6=_0x17cee8[_0x99a9('0x21')],_0x36ec89=_0x374662[_0x99a9('0x22')],_0x1ee72b=_0x374662['offset']+_0x374662[_0x99a9('0x23')],_0x4cab8b;if(_0x1ee72b>=_0x1c7fe6){_0x1ee72b=_0x1c7fe6;_0x4cab8b=0xc8;}else{_0x4cab8b=0xce;}_0x3c3d03[_0x99a9('0x1e')](_0x4cab8b);return _0x3c3d03['set']('Content-Range',_0x36ec89+'-'+_0x1ee72b+'/'+_0x1c7fe6)[_0x99a9('0x20')](_0x17cee8);}return null;};}function patchUpdates(_0x2b6b97){return function(_0x5498ee){try{jsonpatch[_0x99a9('0x24')](_0x5498ee,_0x2b6b97,!![]);}catch(_0x537740){return BPromise[_0x99a9('0x25')](_0x537740);}return _0x5498ee[_0x99a9('0x26')]();};}function saveUpdates(_0x18ae60,_0x55a9d8){return function(_0x1985a5){if(_0x1985a5){return _0x1985a5['update'](_0x18ae60)[_0x99a9('0x27')](function(_0x562218){return _0x562218;});}return null;};}function removeEntity(_0x1c1e13,_0x5bd047){return function(_0x66418e){if(_0x66418e){return _0x66418e[_0x99a9('0x28')]()['then'](function(){_0x1c1e13[_0x99a9('0x1e')](0xcc)[_0x99a9('0x1f')]();});}};}function handleEntityNotFound(_0x2d94db,_0x1dc968){return function(_0x3a9ac5){if(!_0x3a9ac5){_0x2d94db['sendStatus'](0x194);}return _0x3a9ac5;};}function handleError(_0x402d10,_0x33d843){_0x33d843=_0x33d843||0x1f4;return function(_0x4f753f){logger[_0x99a9('0x29')](_0x4f753f[_0x99a9('0x2a')]);if(_0x4f753f['name']){delete _0x4f753f[_0x99a9('0x2b')];}_0x402d10['status'](_0x33d843)['send'](_0x4f753f);};}exports[_0x99a9('0x2c')]=function(_0x56286a,_0x2ffd32){var _0x1f49c6={},_0x52d42c={},_0x282b0f={'count':0x0,'rows':[]};var _0x460edb=_['map'](db[_0x99a9('0x2d')][_0x99a9('0x2e')],function(_0xd3e853){return{'name':_0xd3e853['fieldName'],'type':_0xd3e853[_0x99a9('0x2f')][_0x99a9('0x30')]};});_0x52d42c[_0x99a9('0x31')]=_[_0x99a9('0x32')](_0x460edb,'name');_0x52d42c['query']=_[_0x99a9('0x33')](_0x56286a['query']);_0x52d42c['filters']=_[_0x99a9('0x34')](_0x52d42c[_0x99a9('0x31')],_0x52d42c[_0x99a9('0x35')]);_0x1f49c6[_0x99a9('0x36')]=_[_0x99a9('0x34')](_0x52d42c[_0x99a9('0x31')],qs[_0x99a9('0x37')](_0x56286a[_0x99a9('0x35')][_0x99a9('0x37')]));_0x1f49c6[_0x99a9('0x36')]=_0x1f49c6[_0x99a9('0x36')][_0x99a9('0x38')]?_0x1f49c6[_0x99a9('0x36')]:_0x52d42c[_0x99a9('0x31')];if(!_0x56286a['query'][_0x99a9('0x39')](_0x99a9('0x3a'))){_0x1f49c6[_0x99a9('0x23')]=qs[_0x99a9('0x23')](_0x56286a[_0x99a9('0x35')]['limit']);_0x1f49c6['offset']=qs[_0x99a9('0x22')](_0x56286a[_0x99a9('0x35')][_0x99a9('0x22')]);}_0x1f49c6[_0x99a9('0x3b')]=qs[_0x99a9('0x3c')](_0x56286a['query']['sort']);_0x1f49c6[_0x99a9('0x3d')]=qs[_0x99a9('0x3e')](_[_0x99a9('0x3f')](_0x56286a['query'],_0x52d42c[_0x99a9('0x3e')]),_0x460edb);if(_0x56286a[_0x99a9('0x35')][_0x99a9('0x40')]){_0x1f49c6[_0x99a9('0x3d')]=_[_0x99a9('0x41')](_0x1f49c6[_0x99a9('0x3d')],{'$or':_[_0x99a9('0x32')](_0x460edb,function(_0x239998){if(_0x239998[_0x99a9('0x2f')]!=='VIRTUAL'){var _0xef49f0={};_0xef49f0[_0x239998['name']]={'$like':'%'+_0x56286a[_0x99a9('0x35')][_0x99a9('0x40')]+'%'};return _0xef49f0;}})});}_0x1f49c6=_['merge']({},_0x1f49c6,_0x56286a[_0x99a9('0x42')]);var _0x5603e5={'where':_0x1f49c6[_0x99a9('0x3d')]};return db[_0x99a9('0x2d')][_0x99a9('0x21')](_0x5603e5)[_0x99a9('0x27')](function(_0x21ba4a){_0x282b0f[_0x99a9('0x21')]=_0x21ba4a;if(_0x56286a[_0x99a9('0x35')][_0x99a9('0x43')]){_0x1f49c6[_0x99a9('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x1f49c6);})['then'](function(_0x479024){_0x282b0f['rows']=_0x479024;return _0x282b0f;})['then'](respondWithFilteredResult(_0x2ffd32,_0x1f49c6))[_0x99a9('0x45')](handleError(_0x2ffd32,null));};exports[_0x99a9('0x46')]=function(_0x5df1c0,_0x33d018){var _0x40ff35={'raw':!![],'where':{'id':_0x5df1c0[_0x99a9('0x47')]['id']}},_0x5ebb92={};_0x5ebb92[_0x99a9('0x31')]=_[_0x99a9('0x33')](db['ChatInternalMessage'][_0x99a9('0x2e')]);_0x5ebb92[_0x99a9('0x35')]=_[_0x99a9('0x33')](_0x5df1c0[_0x99a9('0x35')]);_0x5ebb92[_0x99a9('0x3e')]=_[_0x99a9('0x34')](_0x5ebb92[_0x99a9('0x31')],_0x5ebb92[_0x99a9('0x35')]);_0x40ff35[_0x99a9('0x36')]=_[_0x99a9('0x34')](_0x5ebb92[_0x99a9('0x31')],qs['fields'](_0x5df1c0['query'][_0x99a9('0x37')]));_0x40ff35[_0x99a9('0x36')]=_0x40ff35[_0x99a9('0x36')][_0x99a9('0x38')]?_0x40ff35[_0x99a9('0x36')]:_0x5ebb92[_0x99a9('0x31')];if(_0x5df1c0[_0x99a9('0x35')]['includeAll']){_0x40ff35['include']=[{'all':!![]}];}_0x40ff35=_['merge']({},_0x40ff35,_0x5df1c0['options']);return db[_0x99a9('0x2d')][_0x99a9('0x48')](_0x40ff35)[_0x99a9('0x27')](handleEntityNotFound(_0x33d018,null))[_0x99a9('0x27')](respondWithResult(_0x33d018,null))[_0x99a9('0x45')](handleError(_0x33d018,null));};exports[_0x99a9('0x49')]=function(_0xda110,_0x23e65b){return db[_0x99a9('0x2d')]['create'](_0xda110[_0x99a9('0x4a')],{})[_0x99a9('0x27')](respondWithResult(_0x23e65b,0xc9))[_0x99a9('0x45')](handleError(_0x23e65b,null));};exports[_0x99a9('0x4b')]=function(_0x731dbd,_0x274e64){if(_0x731dbd['body']['id']){delete _0x731dbd[_0x99a9('0x4a')]['id'];}return db[_0x99a9('0x2d')][_0x99a9('0x48')]({'where':{'id':_0x731dbd[_0x99a9('0x47')]['id']}})[_0x99a9('0x27')](handleEntityNotFound(_0x274e64,null))[_0x99a9('0x27')](saveUpdates(_0x731dbd[_0x99a9('0x4a')],null))['then'](respondWithResult(_0x274e64,null))[_0x99a9('0x45')](handleError(_0x274e64,null));};exports[_0x99a9('0x28')]=function(_0x210225,_0x4924e9){return db[_0x99a9('0x2d')][_0x99a9('0x48')]({'where':{'id':_0x210225['params']['id']}})[_0x99a9('0x27')](handleEntityNotFound(_0x4924e9,null))[_0x99a9('0x27')](removeEntity(_0x4924e9,null))['catch'](handleError(_0x4924e9,null));};exports[_0x99a9('0x4c')]=function(_0x22b42e,_0x5d0db9){return db[_0x99a9('0x2d')]['describe']()[_0x99a9('0x27')](respondWithResult(_0x5d0db9,null))['catch'](handleError(_0x5d0db9,null));};function wrapUser(_0x541ef8){return function(_0x59a4c7){var _0x39368d=_0x541ef8['get']({'plain':!![]});_0x39368d[_0x99a9('0x4d')]=[];if(_0x59a4c7){_0x39368d[_0x99a9('0x4e')]=_0x59a4c7[_0x99a9('0x4f')];_0x39368d[_0x99a9('0x50')]=_0x59a4c7;}else{_0x39368d[_0x99a9('0x4e')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x39368d[_0x99a9('0x50')]={};}return _0x39368d;};}exports['getUsers']=function(_0x12b1f3,_0x2623c2,_0x17b42c){var _0xa22485=[];return db['User']['findAll']({'where':{'role':['agent',_0x99a9('0x51'),_0x99a9('0x52')]},'attributes':['id','fullname',_0x99a9('0x2b'),'role',_0x99a9('0x53'),_0x99a9('0x54'),_0x99a9('0x55'),'lastLoginAt',_0x99a9('0x56'),'showWebBar'],'order':qs['sort'](_0x99a9('0x57')),'include':[{'model':db[_0x99a9('0x58')],'as':'VoiceQueues','attributes':['id','name',_0x99a9('0x2f')],'through':{'attributes':[]}}]})[_0x99a9('0x27')](function(_0x59b76f){if(_0x59b76f){var _0x5a351b=_0x12b1f3['user'][_0x99a9('0x59')]({'plain':!![]});if(!_0x5a351b)throw new Error(_0x99a9('0x5a'));if(_0x5a351b[_0x99a9('0x5b')]===_0x99a9('0x52')){return db[_0x99a9('0x5c')][_0x99a9('0x48')]({'where':{'name':'Agents','userProfileId':_0x5a351b['userProfileId']},'raw':!![]})[_0x99a9('0x27')](function(_0x1b81b1){if(_0x1b81b1){if(_0x1b81b1[_0x99a9('0x5d')]===0x0){return db[_0x99a9('0x5e')][_0x99a9('0x5f')]({'where':{'sectionId':_0x1b81b1['id']},'raw':!![]})[_0x99a9('0x27')](function(_0x9f4c51){var _0x5c1a75=[];if(_[_0x99a9('0x60')](_0x9f4c51)){_0x5c1a75=_[_0x99a9('0x40')](_0x59b76f,function(_0x369d1b){if(_0x369d1b[_0x99a9('0x5b')]!==_0x99a9('0x61')){return _0x369d1b;}});return _0x5c1a75;}else{for(var _0x226265=0x0;_0x226265<_0x59b76f['length'];_0x226265++){var _0x14252d=_0x59b76f[_0x226265];if(_0x14252d[_0x99a9('0x5b')]==='agent'){var _0x2b459d=_[_0x99a9('0x48')](_0x9f4c51,function(_0x565eed){return _0x565eed[_0x99a9('0x62')]===_0x14252d['id'];});if(_0x2b459d)_0x5c1a75['push'](_0x14252d);}else{_0x5c1a75[_0x99a9('0x63')](_0x14252d);}}return _0x5c1a75;}});}else{return _0x59b76f;}}else{var _0x3b20d1=_[_0x99a9('0x40')](_0x59b76f,function(_0x2acac9){if(_0x2acac9[_0x99a9('0x5b')]!==_0x99a9('0x61')){return _0x2acac9;}});return _0x3b20d1;}});}else{return _0x59b76f;}}})[_0x99a9('0x27')](function(_0x5ef26d){var _0x5a5bc3=[];if(_0x5ef26d){_0xa22485=_0x5ef26d;for(var _0x7c3393=0x0;_0x7c3393<_0x5ef26d[_0x99a9('0x38')];_0x7c3393+=0x1){_0xa22485[_0x7c3393][_0x99a9('0x4d')]=[];_0x5a5bc3[_0x99a9('0x63')](db[_0x99a9('0x2d')]['find']({'where':{'FromId':[_0x12b1f3[_0x99a9('0x52')]['id'],_0x5ef26d[_0x7c3393]['id']],'ToId':[_0x12b1f3[_0x99a9('0x52')]['id'],_0x5ef26d[_0x7c3393]['id']],'ChatGroupId':null},'attributes':['id',_0x99a9('0x4f'),_0x99a9('0x64'),_0x99a9('0x65'),_0x99a9('0x66'),_0x99a9('0x4a')],'order':qs[_0x99a9('0x3c')](_0x99a9('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x99a9('0x27')](wrapUser(_0x5ef26d[_0x7c3393])));}return BPromise['all'](_0x5a5bc3);}return[];})['then'](function(_0x4e64e3){return{'rows':_0x4e64e3,'count':_0x4e64e3[_0x99a9('0x38')]};})[_0x99a9('0x27')](respondWithResult(_0x2623c2,null))[_0x99a9('0x45')](handleError(_0x2623c2,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1ec43a3..b7f9f9d 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 _0xd8ee=['hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save','remove','emit'];(function(_0x4416be,_0x28ba96){var _0x21128b=function(_0x291fdb){while(--_0x291fdb){_0x4416be['push'](_0x4416be['shift']());}};_0x21128b(++_0x28ba96);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x16cf30,_0x593b43){_0x16cf30=_0x16cf30-0x0;var _0x1818ee=_0xd8ee[_0x16cf30];return _0x1818ee;};'use strict';var EventEmitter=require(_0xed8e('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xed8e('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xed8e('0x2')](0x0);var events={'afterCreate':_0xed8e('0x3'),'afterUpdate':'update','afterDestroy':_0xed8e('0x4')};function emitEvent(_0x3db0fb){return function(_0x3402ae,_0x35aed7,_0x474f12){ChatInternalMessageEvents[_0xed8e('0x5')](_0x3db0fb+':'+_0x3402ae['id'],_0x3402ae);ChatInternalMessageEvents['emit'](_0x3db0fb,_0x3402ae);_0x474f12(null);};}for(var e in events){if(events[_0xed8e('0x6')](e)){var event=events[e];ChatInternalMessage[_0xed8e('0x7')](e,emitEvent(event));}}module[_0xed8e('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x0763=['events','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0763,0x87));var _0x3076=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0x0763[_0x41ed37];return _0x13f7ea;};'use strict';var EventEmitter=require(_0x3076('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3076('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3076('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3076('0x3'),'afterDestroy':_0x3076('0x4')};function emitEvent(_0x3ae0c9){return function(_0xecc289,_0x55bd44,_0x3eba05){ChatInternalMessageEvents[_0x3076('0x5')](_0x3ae0c9+':'+_0xecc289['id'],_0xecc289);ChatInternalMessageEvents[_0x3076('0x5')](_0x3ae0c9,_0xecc289);_0x3eba05(null);};}for(var e in events){if(events[_0x3076('0x6')](e)){var event=events[e];ChatInternalMessage[_0x3076('0x7')](e,emitEvent(event));}}module[_0x3076('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8075d48..2a432a2 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 _0x89ee=['moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x226444,_0x282b29){var _0x278811=function(_0x1d150d){while(--_0x1d150d){_0x226444['push'](_0x226444['shift']());}};_0x278811(++_0x282b29);}(_0x89ee,0x130));var _0xe89e=function(_0x33f13f,_0x2bd0d4){_0x33f13f=_0x33f13f-0x0;var _0x201f02=_0x89ee[_0x33f13f];return _0x201f02;};'use strict';var _=require(_0xe89e('0x0'));var util=require(_0xe89e('0x1'));var logger=require(_0xe89e('0x2'))(_0xe89e('0x3'));var moment=require(_0xe89e('0x4'));var BPromise=require(_0xe89e('0x5'));var rp=require(_0xe89e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe89e('0x7'));var attributes=require(_0xe89e('0x8'));module[_0xe89e('0x9')]=function(_0x5091c4,_0x712f98){return _0x5091c4['define'](_0xe89e('0xa'),attributes,{'tableName':_0xe89e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe89e('0xc'),'collate':_0xe89e('0xd')});}; \ No newline at end of file +var _0x2eb2=['bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x497ca0,_0x21bc0c){var _0xdbe67e=function(_0x406bce){while(--_0x406bce){_0x497ca0['push'](_0x497ca0['shift']());}};_0xdbe67e(++_0x21bc0c);}(_0x2eb2,0xe1));var _0x22eb=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2eb2[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22eb('0x0'))(_0x22eb('0x1'));var moment=require(_0x22eb('0x2'));var BPromise=require(_0x22eb('0x3'));var rp=require(_0x22eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x5'));var config=require(_0x22eb('0x6'));var attributes=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0xafdde7,_0x5b2c3b){return _0xafdde7[_0x22eb('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x22eb('0xa'),'collate':_0x22eb('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 02fbf16..44fee3c 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 _0x37be=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x37be,0xba));var _0xe37b=function(_0x5b0c03,_0x53ca0a){_0x5b0c03=_0x5b0c03-0x0;var _0x2f664a=_0x37be[_0x5b0c03];return _0x2f664a;};'use strict';var _=require(_0xe37b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe37b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe37b('0x2'));var logger=require(_0xe37b('0x3'))(_0xe37b('0x4'));var config=require(_0xe37b('0x5'));var jayson=require(_0xe37b('0x6'));var client=jayson[_0xe37b('0x7')][_0xe37b('0x8')]({'port':0x232a});config[_0xe37b('0x9')]=_['defaults'](config[_0xe37b('0x9')],{'host':_0xe37b('0xa'),'port':0x18eb});var socket=require(_0xe37b('0xb'))(new Redis(config[_0xe37b('0x9')]));require(_0xe37b('0xc'))['register'](socket);function respondWithRpcPromise(_0x8b85b8,_0x102b7f,_0x5358c8){return new BPromise(function(_0x18496c,_0x3db05c){return client['request'](_0x8b85b8,_0x5358c8)[_0xe37b('0xd')](function(_0x3d5800){logger[_0xe37b('0xe')](_0xe37b('0xf'),_0x102b7f,_0xe37b('0x10'));logger[_0xe37b('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x102b7f,_0xe37b('0x10'),JSON[_0xe37b('0x12')](_0x3d5800));if(_0x3d5800[_0xe37b('0x13')]){if(_0x3d5800[_0xe37b('0x13')][_0xe37b('0x14')]===0x1f4){logger[_0xe37b('0x13')](_0xe37b('0xf'),_0x102b7f,_0x3d5800['error'][_0xe37b('0x15')]);return _0x3db05c(_0x3d5800[_0xe37b('0x13')][_0xe37b('0x15')]);}logger[_0xe37b('0x13')](_0xe37b('0xf'),_0x102b7f,_0x3d5800[_0xe37b('0x13')][_0xe37b('0x15')]);return _0x18496c(_0x3d5800[_0xe37b('0x13')]['message']);}else{logger[_0xe37b('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x102b7f,_0xe37b('0x10'));_0x18496c(_0x3d5800[_0xe37b('0x16')][_0xe37b('0x15')]);}})[_0xe37b('0x17')](function(_0x53995c){logger[_0xe37b('0x13')](_0xe37b('0xf'),_0x102b7f,_0x53995c);_0x3db05c(_0x53995c);});});} \ No newline at end of file +var _0x19c1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x46d459,_0x10dc2b){var _0x2fa982=function(_0x2f00b1){while(--_0x2f00b1){_0x46d459['push'](_0x46d459['shift']());}};_0x2fa982(++_0x10dc2b);}(_0x19c1,0x129));var _0x119c=function(_0x576e6e,_0x4df6df){_0x576e6e=_0x576e6e-0x0;var _0x40ce06=_0x19c1[_0x576e6e];return _0x40ce06;};'use strict';var _=require('lodash');var util=require(_0x119c('0x0'));var moment=require(_0x119c('0x1'));var BPromise=require(_0x119c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119c('0x3'))['db'];var utils=require(_0x119c('0x4'));var logger=require(_0x119c('0x5'))(_0x119c('0x6'));var config=require(_0x119c('0x7'));var jayson=require(_0x119c('0x8'));var client=jayson['client'][_0x119c('0x9')]({'port':0x232a});config[_0x119c('0xa')]=_[_0x119c('0xb')](config[_0x119c('0xa')],{'host':_0x119c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x119c('0xa')]));require('./chatInternalMessage.socket')[_0x119c('0xd')](socket);function respondWithRpcPromise(_0x374169,_0x3af550,_0x109067){return new BPromise(function(_0x551247,_0x3d473b){return client['request'](_0x374169,_0x109067)[_0x119c('0xe')](function(_0x12cf8c){logger[_0x119c('0xf')](_0x119c('0x10'),_0x3af550,_0x119c('0x11'));logger[_0x119c('0x12')](_0x119c('0x13'),_0x3af550,_0x119c('0x11'),JSON[_0x119c('0x14')](_0x12cf8c));if(_0x12cf8c[_0x119c('0x15')]){if(_0x12cf8c[_0x119c('0x15')][_0x119c('0x16')]===0x1f4){logger[_0x119c('0x15')](_0x119c('0x10'),_0x3af550,_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);return _0x3d473b(_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);}logger[_0x119c('0x15')](_0x119c('0x10'),_0x3af550,_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);return _0x551247(_0x12cf8c[_0x119c('0x15')][_0x119c('0x17')]);}else{logger['info'](_0x119c('0x10'),_0x3af550,_0x119c('0x11'));_0x551247(_0x12cf8c['result']['message']);}})[_0x119c('0x18')](function(_0x3c3d69){logger[_0x119c('0x15')](_0x119c('0x10'),_0x3af550,_0x3c3d69);_0x3d473b(_0x3c3d69);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f215c70..c5f2da2 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 _0xb575=['chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener','register'];(function(_0xc57c18,_0x3259fc){var _0x5daed9=function(_0x58537b){while(--_0x58537b){_0xc57c18['push'](_0xc57c18['shift']());}};_0x5daed9(++_0x3259fc);}(_0xb575,0xda));var _0x5b57=function(_0x28f5da,_0xaf971d){_0x28f5da=_0x28f5da-0x0;var _0x2362b8=_0xb575[_0x28f5da];return _0x2362b8;};'use strict';var ChatInternalMessageEvents=require(_0x5b57('0x0'));var events=[_0x5b57('0x1'),'remove',_0x5b57('0x2')];function createListener(_0x4c5b3f,_0x4a644c){return function(_0x585c94){_0x4a644c[_0x5b57('0x3')](_0x4c5b3f,_0x585c94);};}function removeListener(_0x34ae8e,_0x4b91c3){return function(){ChatInternalMessageEvents[_0x5b57('0x4')](_0x34ae8e,_0x4b91c3);};}exports[_0x5b57('0x5')]=function(_0x501a91){for(var _0x542b77=0x0,_0x672beb=events['length'];_0x542b77<_0x672beb;_0x542b77++){var _0x4232d0=events[_0x542b77];var _0x5dd0c7=createListener(_0x5b57('0x6')+_0x4232d0,_0x501a91);ChatInternalMessageEvents['on'](_0x4232d0,_0x5dd0c7);}}; \ No newline at end of file +var _0xf0ba=['update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x4058cc,_0x52646f){var _0x105ea6=function(_0x190dc5){while(--_0x190dc5){_0x4058cc['push'](_0x4058cc['shift']());}};_0x105ea6(++_0x52646f);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require(_0xaf0b('0x0'));var events=[_0xaf0b('0x1'),_0xaf0b('0x2'),_0xaf0b('0x3')];function createListener(_0xea88b2,_0x555620){return function(_0x277920){_0x555620[_0xaf0b('0x4')](_0xea88b2,_0x277920);};}function removeListener(_0x4cffa5,_0xcd565f){return function(){ChatInternalMessageEvents['removeListener'](_0x4cffa5,_0xcd565f);};}exports[_0xaf0b('0x5')]=function(_0x4b3b85){for(var _0x4d1479=0x0,_0x53b32d=events[_0xaf0b('0x6')];_0x4d1479<_0x53b32d;_0x4d1479++){var _0x17b6d5=events[_0x4d1479];var _0x3439d5=createListener(_0xaf0b('0x7')+_0x17b6d5,_0x4b3b85);ChatInternalMessageEvents['on'](_0x17b6d5,_0x3439d5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4af1fdb..8ed004f 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x30cd7b,_0x140683){var _0x59cc85=function(_0x30fe59){while(--_0x30fe59){_0x30cd7b['push'](_0x30cd7b['shift']());}};_0x59cc85(++_0x140683);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x551db7,_0xb015d2){var _0x22fb25=function(_0xf24c3a){while(--_0xf24c3a){_0x551db7['push'](_0x551db7['shift']());}};_0x22fb25(++_0xb015d2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xcb91[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 513bbe8..a629192 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 _0x372a=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x22d655,_0x3941dd){var _0x257739=function(_0x98136e){while(--_0x98136e){_0x22d655['push'](_0x22d655['shift']());}};_0x257739(++_0x3941dd);}(_0x372a,0x115));var _0xa372=function(_0x167472,_0x455f52){_0x167472=_0x167472-0x0;var _0x34b3bc=_0x372a[_0x167472];return _0x34b3bc;};'use strict';var Sequelize=require(_0xa372('0x0'));module[_0xa372('0x1')]={'body':{'type':Sequelize[_0xa372('0x2')](_0xa372('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa372('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa372('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa372('0x5')]('in',_0xa372('0x6')),'defaultValue':_0xa372('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa372('0x7')]}}; \ No newline at end of file +var _0xe478=['DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x223ae9,_0x4965ec){var _0x235ca5=function(_0x80ee91){while(--_0x80ee91){_0x223ae9['push'](_0x223ae9['shift']());}};_0x235ca5(++_0x4965ec);}(_0xe478,0xf7));var _0x8e47=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe478[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x8e47('0x0'));module['exports']={'body':{'type':Sequelize[_0x8e47('0x1')](_0x8e47('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x8e47('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8e47('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8e47('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 87d02b1..e26fd0d 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 _0x06be=['length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','ChatInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','acceptmessage','parse','chat-interactions','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','reject','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','sendStatus','stack','name','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06be,0xb1));var _0xe06b=function(_0x291bac,_0x1bc4af){_0x291bac=_0x291bac-0x0;var _0x11866e=_0x06be[_0x291bac];return _0x11866e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe06b('0x0'));var rimraf=require(_0xe06b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe06b('0x2'));var rp=require(_0xe06b('0x3'));var moment=require(_0xe06b('0x4'));var BPromise=require(_0xe06b('0x5'));var Mustache=require(_0xe06b('0x6'));var util=require(_0xe06b('0x7'));var path=require(_0xe06b('0x8'));var sox=require(_0xe06b('0x9'));var csv=require(_0xe06b('0xa'));var ejs=require(_0xe06b('0xb'));var fs=require('fs');var _=require(_0xe06b('0xc'));var squel=require('squel');var crypto=require(_0xe06b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe06b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe06b('0xf'));var Papa=require('papaparse');var Redis=require(_0xe06b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe06b('0x11'));var as=require(_0xe06b('0x12'));var hardwareService=require(_0xe06b('0x13'));var logger=require(_0xe06b('0x14'))('api');var utils=require(_0xe06b('0x15'));var config=require(_0xe06b('0x16'));var db=require(_0xe06b('0x17'))['db'];config['redis']=_[_0xe06b('0x18')](config[_0xe06b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe06b('0x1a'))(new Redis(config['redis']));require(_0xe06b('0x1b'))[_0xe06b('0x1c')](socket);var jayson=require(_0xe06b('0x1d'));var client=jayson[_0xe06b('0x1e')][_0xe06b('0x1f')]({'port':0x232c});var client9002=jayson[_0xe06b('0x1e')][_0xe06b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x5aff1d,_0x3a6a46,_0x2e3d9a){if(_0x2e3d9a){var _0x33d8c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33d8c9[_0xe06b('0x20')](_0x3a6a46)){return _0x5aff1d;}else{throw new db['Sequelize'][(_0xe06b('0x21'))](_0xe06b('0x22'));}}else{return _0x5aff1d;}}function respondWithRpcPromise(_0x425159,_0x10a3b5,_0x31bbce,_0x5f1d58){return new BPromise(function(_0x58e7e2,_0x10f106){var _0x1a5d64=_0x5f1d58||client;return _0x1a5d64[_0xe06b('0x23')](_0x425159,_0x31bbce)[_0xe06b('0x24')](function(_0x51d7b3){logger['info']('ChatMessage,\x20%s,\x20%s',_0x10a3b5,_0xe06b('0x25'));logger[_0xe06b('0x26')](_0xe06b('0x27'),_0x10a3b5,'request\x20sent',JSON[_0xe06b('0x28')](_0x51d7b3));if(_0x51d7b3[_0xe06b('0x29')]){if(_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2a')]===0x1f4){logger[_0xe06b('0x29')](_0xe06b('0x2b'),_0x10a3b5,_0x51d7b3['error'][_0xe06b('0x2c')]);return _0x10f106(_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2c')]);}logger['error'](_0xe06b('0x2b'),_0x10a3b5,_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2c')]);return _0x58e7e2(_0x51d7b3[_0xe06b('0x29')][_0xe06b('0x2c')]);}else{logger[_0xe06b('0x2d')](_0xe06b('0x2b'),_0x10a3b5,'request\x20sent');_0x58e7e2(_0x51d7b3[_0xe06b('0x2e')][_0xe06b('0x2c')]);}})['catch'](function(_0x825639){logger[_0xe06b('0x29')](_0xe06b('0x2b'),_0x10a3b5,_0x825639);_0x10f106(_0x825639);});});}function respondWithStatusCode(_0x24fba4,_0xb28880){_0xb28880=_0xb28880||0xcc;return function(_0x1a2369){if(_0x1a2369){return _0x24fba4['sendStatus'](_0xb28880);}return _0x24fba4[_0xe06b('0x2f')](_0xb28880)[_0xe06b('0x30')]();};}function respondWithResult(_0x506619,_0x46953f){_0x46953f=_0x46953f||0xc8;return function(_0x453499){if(_0x453499){return _0x506619['status'](_0x46953f)[_0xe06b('0x31')](_0x453499);}};}function respondWithFilteredResult(_0x125f9b,_0x386eab){return function(_0xf47708){if(_0xf47708){var _0x4d92f9=_0xf47708[_0xe06b('0x32')],_0x188a99=_0x386eab['offset'],_0x26bc7d=_0x386eab[_0xe06b('0x33')]+_0x386eab[_0xe06b('0x34')],_0x3b94c5;if(_0x26bc7d>=_0x4d92f9){_0x26bc7d=_0x4d92f9;_0x3b94c5=0xc8;}else{_0x3b94c5=0xce;}_0x125f9b[_0xe06b('0x2f')](_0x3b94c5);return _0x125f9b['set'](_0xe06b('0x35'),_0x188a99+'-'+_0x26bc7d+'/'+_0x4d92f9)[_0xe06b('0x31')](_0xf47708);}return null;};}function patchUpdates(_0x51a534){return function(_0x4d2923){try{jsonpatch[_0xe06b('0x36')](_0x4d2923,_0x51a534,!![]);}catch(_0x5008f3){return BPromise['reject'](_0x5008f3);}return _0x4d2923[_0xe06b('0x37')]();};}function saveUpdates(_0x1c343a,_0xcb6248){return function(_0x549f7a){if(_0x549f7a){return _0x549f7a[_0xe06b('0x38')](_0x1c343a)[_0xe06b('0x24')](function(_0x59f4ca){return _0x59f4ca;});}return null;};}function removeEntity(_0x501e5d,_0x92aa4c){return function(_0x28a5a7){if(_0x28a5a7){return _0x28a5a7[_0xe06b('0x39')]()[_0xe06b('0x24')](function(){_0x501e5d['status'](0xcc)[_0xe06b('0x30')]();});}};}function handleEntityNotFound(_0x47468e,_0xf40c45){return function(_0x1638af){if(!_0x1638af){_0x47468e[_0xe06b('0x3a')](0x194);}return _0x1638af;};}function handleError(_0x5b5337,_0x1e28aa){_0x1e28aa=_0x1e28aa||0x1f4;return function(_0x38b6b3){logger['error'](_0x38b6b3[_0xe06b('0x3b')]);if(_0x38b6b3[_0xe06b('0x3c')]){delete _0x38b6b3[_0xe06b('0x3c')];}_0x5b5337['status'](_0x1e28aa)['send'](_0x38b6b3);};}exports['index']=function(_0x5c7b37,_0x1a9f41){var _0x323d1f={},_0x225d87={},_0x584004={'count':0x0,'rows':[]};var _0x3983cf=_[_0xe06b('0x3d')](db[_0xe06b('0x3e')][_0xe06b('0x3f')],function(_0x22fd53){return{'name':_0x22fd53[_0xe06b('0x40')],'type':_0x22fd53[_0xe06b('0x41')][_0xe06b('0x42')]};});_0x225d87['model']=_[_0xe06b('0x3d')](_0x3983cf,_0xe06b('0x3c'));_0x225d87[_0xe06b('0x43')]=_[_0xe06b('0x44')](_0x5c7b37[_0xe06b('0x43')]);_0x225d87['filters']=_[_0xe06b('0x45')](_0x225d87[_0xe06b('0x46')],_0x225d87[_0xe06b('0x43')]);_0x323d1f[_0xe06b('0x47')]=_[_0xe06b('0x45')](_0x225d87[_0xe06b('0x46')],qs[_0xe06b('0x48')](_0x5c7b37[_0xe06b('0x43')]['fields']));_0x323d1f[_0xe06b('0x47')]=_0x323d1f[_0xe06b('0x47')][_0xe06b('0x49')]?_0x323d1f['attributes']:_0x225d87['model'];if(!_0x5c7b37['query']['hasOwnProperty'](_0xe06b('0x4a'))){_0x323d1f[_0xe06b('0x34')]=qs['limit'](_0x5c7b37[_0xe06b('0x43')]['limit']);_0x323d1f['offset']=qs[_0xe06b('0x33')](_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x33')]);}_0x323d1f[_0xe06b('0x4b')]=qs[_0xe06b('0x4c')](_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x4c')]);_0x323d1f[_0xe06b('0x4d')]=qs['filters'](_[_0xe06b('0x4e')](_0x5c7b37[_0xe06b('0x43')],_0x225d87[_0xe06b('0x4f')]),_0x3983cf);if(_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x50')]){_0x323d1f[_0xe06b('0x4d')]=_['merge'](_0x323d1f[_0xe06b('0x4d')],{'$or':_[_0xe06b('0x3d')](_0x3983cf,function(_0x1cac76){if(_0x1cac76[_0xe06b('0x41')]!=='VIRTUAL'){var _0x56e087={};_0x56e087[_0x1cac76[_0xe06b('0x3c')]]={'$like':'%'+_0x5c7b37['query'][_0xe06b('0x50')]+'%'};return _0x56e087;}})});}_0x323d1f=_[_0xe06b('0x51')]({},_0x323d1f,_0x5c7b37[_0xe06b('0x52')]);var _0x137be8={'where':_0x323d1f['where']};return db['ChatMessage'][_0xe06b('0x32')](_0x137be8)[_0xe06b('0x24')](function(_0x2ef893){_0x584004[_0xe06b('0x32')]=_0x2ef893;if(_0x5c7b37[_0xe06b('0x43')][_0xe06b('0x53')]){_0x323d1f[_0xe06b('0x54')]=[{'all':!![]}];}return db[_0xe06b('0x3e')][_0xe06b('0x55')](_0x323d1f);})[_0xe06b('0x24')](function(_0x555432){_0x584004[_0xe06b('0x56')]=_0x555432;return _0x584004;})['then'](respondWithFilteredResult(_0x1a9f41,_0x323d1f))[_0xe06b('0x57')](handleError(_0x1a9f41,null));};exports[_0xe06b('0x58')]=function(_0x4712e7,_0x64dcb0){var _0x2923ea={'raw':!![],'where':{'id':_0x4712e7['params']['id']}},_0x11c5d0={};_0x11c5d0[_0xe06b('0x46')]=_[_0xe06b('0x44')](db[_0xe06b('0x3e')][_0xe06b('0x3f')]);_0x11c5d0['query']=_[_0xe06b('0x44')](_0x4712e7[_0xe06b('0x43')]);_0x11c5d0['filters']=_['intersection'](_0x11c5d0['model'],_0x11c5d0[_0xe06b('0x43')]);_0x2923ea[_0xe06b('0x47')]=_[_0xe06b('0x45')](_0x11c5d0[_0xe06b('0x46')],qs[_0xe06b('0x48')](_0x4712e7['query']['fields']));_0x2923ea['attributes']=_0x2923ea['attributes'][_0xe06b('0x49')]?_0x2923ea['attributes']:_0x11c5d0[_0xe06b('0x46')];if(_0x4712e7['query'][_0xe06b('0x53')]){_0x2923ea['include']=[{'all':!![]}];}_0x2923ea=_[_0xe06b('0x51')]({},_0x2923ea,_0x4712e7['options']);return db['ChatMessage']['find'](_0x2923ea)[_0xe06b('0x24')](handleEntityNotFound(_0x64dcb0,null))[_0xe06b('0x24')](respondWithResult(_0x64dcb0,null))[_0xe06b('0x57')](handleError(_0x64dcb0,null));};exports[_0xe06b('0x59')]=function(_0x3f4117,_0x27b692){return db[_0xe06b('0x3e')][_0xe06b('0x59')](_0x3f4117[_0xe06b('0x5a')],{})[_0xe06b('0x24')](respondWithResult(_0x27b692,0xc9))[_0xe06b('0x57')](handleError(_0x27b692,null));};exports[_0xe06b('0x38')]=function(_0x3bddbe,_0x1a4bef){if(_0x3bddbe[_0xe06b('0x5a')]['id']){delete _0x3bddbe['body']['id'];}return db[_0xe06b('0x3e')][_0xe06b('0x5b')]({'where':{'id':_0x3bddbe[_0xe06b('0x5c')]['id']}})[_0xe06b('0x24')](handleEntityNotFound(_0x1a4bef,null))[_0xe06b('0x24')](saveUpdates(_0x3bddbe[_0xe06b('0x5a')],null))[_0xe06b('0x24')](respondWithResult(_0x1a4bef,null))[_0xe06b('0x57')](handleError(_0x1a4bef,null));};exports[_0xe06b('0x39')]=function(_0x4ef260,_0xb729b4){return db['ChatMessage'][_0xe06b('0x5b')]({'where':{'id':_0x4ef260[_0xe06b('0x5c')]['id']}})['then'](handleEntityNotFound(_0xb729b4,null))[_0xe06b('0x24')](removeEntity(_0xb729b4,null))[_0xe06b('0x57')](handleError(_0xb729b4,null));};exports['describe']=function(_0x361c36,_0x16fd3a){return db[_0xe06b('0x3e')]['describe']()[_0xe06b('0x24')](respondWithResult(_0x16fd3a,null))[_0xe06b('0x57')](handleError(_0x16fd3a,null));};var interaction_log=require(_0xe06b('0x14'))('chat-interactions');exports[_0xe06b('0x5d')]=function(_0x4369e2,_0x44bfd2,_0x1b2ed8){var _0x1d207e={'channel':_0xe06b('0x5e')};if(_0x4369e2[_0xe06b('0x5a')]['id']){delete _0x4369e2['body']['id'];}_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x5f')]=!![];_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x60')]=moment()[_0xe06b('0x61')](_0xe06b('0x62'));_0x4369e2[_0xe06b('0x5a')]['UserId']=_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x63')]||_0x4369e2[_0xe06b('0x64')]['id'];return db[_0xe06b('0x3e')][_0xe06b('0x5b')]({'where':{'id':_0x4369e2['params']['id'],'UserId':null},'include':[{'model':db[_0xe06b('0x65')],'as':_0xe06b('0x66')}]})[_0xe06b('0x24')](handleEntityNotFound(_0x44bfd2,null))[_0xe06b('0x24')](saveUpdates(_0x4369e2[_0xe06b('0x5a')],null))['then'](function(_0x4e290f){if(_0x4e290f){_0x1d207e[_0xe06b('0x2c')]=_0x4e290f['get']({'plain':!![]});return db[_0xe06b('0x67')][_0xe06b('0x5b')]({'where':{'id':_0x4e290f['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x44bfd2,null))['then'](function(_0x1e6bf0){if(_0x1e6bf0){return _0x1e6bf0[_0xe06b('0x38')]({'UserId':_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x63')],'read1stAt':_[_0xe06b('0x68')](_0x1e6bf0[_0xe06b('0x69')])?moment()[_0xe06b('0x61')](_0xe06b('0x62')):undefined});}return null;})[_0xe06b('0x24')](function(_0x5574e0){if(_0x5574e0){_0x1d207e[_0xe06b('0x6a')]=_0x5574e0['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4369e2[_0xe06b('0x64')]['id'],_0x4369e2[_0xe06b('0x64')][_0xe06b('0x3c')],_0x4369e2[_0xe06b('0x64')][_0xe06b('0x6b')],_0x1d207e[_0xe06b('0x6a')]['id'],_0x4369e2[_0xe06b('0x5a')]?JSON[_0xe06b('0x28')](_0x4369e2[_0xe06b('0x5a')]):_0xe06b('0x6c'));return respondWithRpcPromise(_0xe06b('0x6d'),_0xe06b('0x6e'),_0x1d207e);}return null;})[_0xe06b('0x24')](function(_0x24bdf4){if(_0x24bdf4){if(_0x4369e2[_0xe06b('0x5a')][_0xe06b('0x6f')]){_0x1d207e[_0xe06b('0x2c')]['interface']=util[_0xe06b('0x61')]('SIP/%s',_0x4369e2['user'][_0xe06b('0x3c')]);_0x1d207e[_0xe06b('0x2c')][_0xe06b('0x70')]=_0x1d207e[_0xe06b('0x70')];_0x1d207e[_0xe06b('0x2c')][_0xe06b('0x71')]=_0xe06b('0x5d');return respondWithRpcPromise(_0xe06b('0x72'),_0xe06b('0x72'),{'event':_0xe06b('0x73'),'message':_[_0xe06b('0x51')](_0x1d207e[_0xe06b('0x2c')],JSON[_0xe06b('0x74')](_0x1d207e[_0xe06b('0x6a')]['formData']))},client9002)[_0xe06b('0x24')](function(){return _0x1d207e;});}return _0x1d207e;}return null;})[_0xe06b('0x24')](respondWithResult(_0x44bfd2,null))[_0xe06b('0x57')](handleError(_0x44bfd2,null));};var interaction_log=require('../../config/logger')(_0xe06b('0x75'));exports['reject']=function(_0xc3e6e7,_0x218151,_0x2cac03){var _0x550f6b={'agent':{},'channel':_0xe06b('0x5e')};if(_0xc3e6e7[_0xe06b('0x5a')]['id']){delete _0xc3e6e7[_0xe06b('0x5a')]['id'];}_0xc3e6e7['body']['UserId']=_0xc3e6e7[_0xe06b('0x5a')][_0xe06b('0x63')]||_0xc3e6e7[_0xe06b('0x64')]['id'];_0x550f6b[_0xe06b('0x76')]['id']=_0xc3e6e7[_0xe06b('0x5a')][_0xe06b('0x63')];return db[_0xe06b('0x3e')]['find']({'where':{'id':_0xc3e6e7[_0xe06b('0x5c')]['id'],'UserId':null}})[_0xe06b('0x24')](handleEntityNotFound(_0x218151,null))[_0xe06b('0x24')](function(_0xb5cdf8){if(_0xb5cdf8){_0x550f6b['message']=_0xb5cdf8[_0xe06b('0x77')]({'plain':!![]});return db[_0xe06b('0x67')]['find']({'where':{'id':_0xb5cdf8[_0xe06b('0x78')]}});}return null;})[_0xe06b('0x24')](handleEntityNotFound(_0x218151,null))[_0xe06b('0x24')](function(_0x3506b5){if(_0x3506b5){_0x550f6b[_0xe06b('0x6a')]=_0x3506b5[_0xe06b('0x77')]({'plain':!![]});interaction_log[_0xe06b('0x2d')](_0xe06b('0x79'),_0xc3e6e7[_0xe06b('0x64')]['id'],_0xc3e6e7[_0xe06b('0x64')][_0xe06b('0x3c')],_0xc3e6e7[_0xe06b('0x64')][_0xe06b('0x6b')],_0x550f6b[_0xe06b('0x6a')]['id'],_0xc3e6e7[_0xe06b('0x5a')]?JSON['stringify'](_0xc3e6e7[_0xe06b('0x5a')]):_0xe06b('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x550f6b);}return null;})[_0xe06b('0x24')](function(_0x4b7a81){if(_0x4b7a81){_0x4b7a81[_0xe06b('0x2c')]['interface']=util['format'](_0xe06b('0x7a'),_0xc3e6e7[_0xe06b('0x64')][_0xe06b('0x3c')]);_0x4b7a81[_0xe06b('0x2c')][_0xe06b('0x70')]=_0x550f6b[_0xe06b('0x70')];_0x4b7a81[_0xe06b('0x2c')]['event']=_0xe06b('0x7b');respondWithRpcPromise(_0xe06b('0x72'),_0xe06b('0x72'),{'event':_0xe06b('0x7c'),'message':_0x4b7a81[_0xe06b('0x2c')]},client9002);return _0x550f6b;}return null;})[_0xe06b('0x24')](respondWithResult(_0x218151,null))['catch'](handleError(_0x218151,null));}; \ No newline at end of file +var _0xea49=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','set','Content-Range','destroy','end','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','create','body','update','find','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat-interactions','reject','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3364f7,_0x3ee4b0){var _0x3d2089=function(_0x56658d){while(--_0x56658d){_0x3364f7['push'](_0x3364f7['shift']());}};_0x3d2089(++_0x3ee4b0);}(_0xea49,0x166));var _0x9ea4=function(_0x16b13d,_0x2faf09){_0x16b13d=_0x16b13d-0x0;var _0x1f1e77=_0xea49[_0x16b13d];return _0x1f1e77;};'use strict';var pdf=require(_0x9ea4('0x0'));var emlformat=require(_0x9ea4('0x1'));var rimraf=require(_0x9ea4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ea4('0x3'));var rp=require(_0x9ea4('0x4'));var moment=require(_0x9ea4('0x5'));var BPromise=require(_0x9ea4('0x6'));var Mustache=require(_0x9ea4('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ea4('0x8'));var squel=require(_0x9ea4('0x9'));var crypto=require(_0x9ea4('0xa'));var jsforce=require(_0x9ea4('0xb'));var deskjs=require(_0x9ea4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9ea4('0xd'));var Papa=require(_0x9ea4('0xe'));var Redis=require(_0x9ea4('0xf'));var authService=require(_0x9ea4('0x10'));var qs=require(_0x9ea4('0x11'));var as=require(_0x9ea4('0x12'));var hardwareService=require(_0x9ea4('0x13'));var logger=require(_0x9ea4('0x14'))(_0x9ea4('0x15'));var utils=require(_0x9ea4('0x16'));var config=require(_0x9ea4('0x17'));var db=require(_0x9ea4('0x18'))['db'];config['redis']=_[_0x9ea4('0x19')](config[_0x9ea4('0x1a')],{'host':_0x9ea4('0x1b'),'port':0x18eb});var socket=require(_0x9ea4('0x1c'))(new Redis(config[_0x9ea4('0x1a')]));require(_0x9ea4('0x1d'))[_0x9ea4('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9ea4('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x9ea4('0x1f')][_0x9ea4('0x20')]({'port':0x232a});function checkPasswordPattern(_0x208197,_0x151051,_0x543572){if(_0x543572){var _0x24165d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24165d['test'](_0x151051)){return _0x208197;}else{throw new db[(_0x9ea4('0x21'))][(_0x9ea4('0x22'))](_0x9ea4('0x23'));}}else{return _0x208197;}}function respondWithRpcPromise(_0x4c6f17,_0x1cd2c4,_0x2f1ccf,_0x4bc3fe){return new BPromise(function(_0x34c819,_0x1fc1d6){var _0x4833a8=_0x4bc3fe||client;return _0x4833a8[_0x9ea4('0x24')](_0x4c6f17,_0x2f1ccf)[_0x9ea4('0x25')](function(_0x325091){logger[_0x9ea4('0x26')]('ChatMessage,\x20%s,\x20%s',_0x1cd2c4,_0x9ea4('0x27'));logger[_0x9ea4('0x28')](_0x9ea4('0x29'),_0x1cd2c4,_0x9ea4('0x27'),JSON[_0x9ea4('0x2a')](_0x325091));if(_0x325091[_0x9ea4('0x2b')]){if(_0x325091['error'][_0x9ea4('0x2c')]===0x1f4){logger[_0x9ea4('0x2b')](_0x9ea4('0x2d'),_0x1cd2c4,_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);return _0x1fc1d6(_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);}logger['error'](_0x9ea4('0x2d'),_0x1cd2c4,_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);return _0x34c819(_0x325091[_0x9ea4('0x2b')][_0x9ea4('0x2e')]);}else{logger[_0x9ea4('0x26')]('ChatMessage,\x20%s,\x20%s',_0x1cd2c4,'request\x20sent');_0x34c819(_0x325091['result'][_0x9ea4('0x2e')]);}})[_0x9ea4('0x2f')](function(_0x2973c9){logger['error'](_0x9ea4('0x2d'),_0x1cd2c4,_0x2973c9);_0x1fc1d6(_0x2973c9);});});}function respondWithStatusCode(_0x5b08b6,_0x18490b){_0x18490b=_0x18490b||0xcc;return function(_0x4783e3){if(_0x4783e3){return _0x5b08b6[_0x9ea4('0x30')](_0x18490b);}return _0x5b08b6[_0x9ea4('0x31')](_0x18490b)['end']();};}function respondWithResult(_0x3987fd,_0xd9f5d7){_0xd9f5d7=_0xd9f5d7||0xc8;return function(_0x42c2a2){if(_0x42c2a2){return _0x3987fd[_0x9ea4('0x31')](_0xd9f5d7)['json'](_0x42c2a2);}};}function respondWithFilteredResult(_0x2a9ffe,_0x267732){return function(_0x276e6c){if(_0x276e6c){var _0x3a6dd4=_0x276e6c[_0x9ea4('0x32')],_0x3cd710=_0x267732[_0x9ea4('0x33')],_0x5da5ab=_0x267732[_0x9ea4('0x33')]+_0x267732['limit'],_0x309918;if(_0x5da5ab>=_0x3a6dd4){_0x5da5ab=_0x3a6dd4;_0x309918=0xc8;}else{_0x309918=0xce;}_0x2a9ffe['status'](_0x309918);return _0x2a9ffe[_0x9ea4('0x34')](_0x9ea4('0x35'),_0x3cd710+'-'+_0x5da5ab+'/'+_0x3a6dd4)['json'](_0x276e6c);}return null;};}function patchUpdates(_0xb0ca78){return function(_0x4ffc9f){try{jsonpatch['apply'](_0x4ffc9f,_0xb0ca78,!![]);}catch(_0x1301ba){return BPromise['reject'](_0x1301ba);}return _0x4ffc9f['save']();};}function saveUpdates(_0x393226,_0x8edbe){return function(_0x3515df){if(_0x3515df){return _0x3515df['update'](_0x393226)[_0x9ea4('0x25')](function(_0x5a5c32){return _0x5a5c32;});}return null;};}function removeEntity(_0x325f35,_0x104fff){return function(_0x13361f){if(_0x13361f){return _0x13361f[_0x9ea4('0x36')]()[_0x9ea4('0x25')](function(){_0x325f35[_0x9ea4('0x31')](0xcc)[_0x9ea4('0x37')]();});}};}function handleEntityNotFound(_0x2eea54,_0xf520b0){return function(_0x1a7fdc){if(!_0x1a7fdc){_0x2eea54['sendStatus'](0x194);}return _0x1a7fdc;};}function handleError(_0x54ecf3,_0x21a0f9){_0x21a0f9=_0x21a0f9||0x1f4;return function(_0x1f7a04){logger['error'](_0x1f7a04['stack']);if(_0x1f7a04[_0x9ea4('0x38')]){delete _0x1f7a04[_0x9ea4('0x38')];}_0x54ecf3[_0x9ea4('0x31')](_0x21a0f9)[_0x9ea4('0x39')](_0x1f7a04);};}exports[_0x9ea4('0x3a')]=function(_0x13097c,_0x3c5d33){var _0x5d0a6f={},_0x5095d9={},_0x701303={'count':0x0,'rows':[]};var _0x3bd685=_[_0x9ea4('0x3b')](db[_0x9ea4('0x3c')][_0x9ea4('0x3d')],function(_0x599546){return{'name':_0x599546[_0x9ea4('0x3e')],'type':_0x599546[_0x9ea4('0x3f')][_0x9ea4('0x40')]};});_0x5095d9['model']=_[_0x9ea4('0x3b')](_0x3bd685,'name');_0x5095d9[_0x9ea4('0x41')]=_[_0x9ea4('0x42')](_0x13097c['query']);_0x5095d9[_0x9ea4('0x43')]=_[_0x9ea4('0x44')](_0x5095d9['model'],_0x5095d9[_0x9ea4('0x41')]);_0x5d0a6f['attributes']=_[_0x9ea4('0x44')](_0x5095d9[_0x9ea4('0x45')],qs[_0x9ea4('0x46')](_0x13097c[_0x9ea4('0x41')]['fields']));_0x5d0a6f[_0x9ea4('0x47')]=_0x5d0a6f[_0x9ea4('0x47')][_0x9ea4('0x48')]?_0x5d0a6f[_0x9ea4('0x47')]:_0x5095d9[_0x9ea4('0x45')];if(!_0x13097c['query'][_0x9ea4('0x49')]('nolimit')){_0x5d0a6f[_0x9ea4('0x4a')]=qs[_0x9ea4('0x4a')](_0x13097c['query']['limit']);_0x5d0a6f[_0x9ea4('0x33')]=qs[_0x9ea4('0x33')](_0x13097c['query']['offset']);}_0x5d0a6f[_0x9ea4('0x4b')]=qs[_0x9ea4('0x4c')](_0x13097c[_0x9ea4('0x41')]['sort']);_0x5d0a6f['where']=qs[_0x9ea4('0x43')](_[_0x9ea4('0x4d')](_0x13097c['query'],_0x5095d9['filters']),_0x3bd685);if(_0x13097c[_0x9ea4('0x41')][_0x9ea4('0x4e')]){_0x5d0a6f[_0x9ea4('0x4f')]=_['merge'](_0x5d0a6f[_0x9ea4('0x4f')],{'$or':_[_0x9ea4('0x3b')](_0x3bd685,function(_0x36654d){if(_0x36654d['type']!==_0x9ea4('0x50')){var _0x2672bd={};_0x2672bd[_0x36654d[_0x9ea4('0x38')]]={'$like':'%'+_0x13097c[_0x9ea4('0x41')][_0x9ea4('0x4e')]+'%'};return _0x2672bd;}})});}_0x5d0a6f=_[_0x9ea4('0x51')]({},_0x5d0a6f,_0x13097c[_0x9ea4('0x52')]);var _0x3069d0={'where':_0x5d0a6f[_0x9ea4('0x4f')]};return db[_0x9ea4('0x3c')]['count'](_0x3069d0)[_0x9ea4('0x25')](function(_0x21c951){_0x701303[_0x9ea4('0x32')]=_0x21c951;if(_0x13097c[_0x9ea4('0x41')]['includeAll']){_0x5d0a6f[_0x9ea4('0x53')]=[{'all':!![]}];}return db[_0x9ea4('0x3c')][_0x9ea4('0x54')](_0x5d0a6f);})[_0x9ea4('0x25')](function(_0x45bd3){_0x701303[_0x9ea4('0x55')]=_0x45bd3;return _0x701303;})[_0x9ea4('0x25')](respondWithFilteredResult(_0x3c5d33,_0x5d0a6f))['catch'](handleError(_0x3c5d33,null));};exports[_0x9ea4('0x56')]=function(_0x1ab4d7,_0x2d7828){var _0x140071={'raw':!![],'where':{'id':_0x1ab4d7[_0x9ea4('0x57')]['id']}},_0x48dc45={};_0x48dc45[_0x9ea4('0x45')]=_[_0x9ea4('0x42')](db[_0x9ea4('0x3c')]['rawAttributes']);_0x48dc45[_0x9ea4('0x41')]=_['keys'](_0x1ab4d7[_0x9ea4('0x41')]);_0x48dc45[_0x9ea4('0x43')]=_['intersection'](_0x48dc45['model'],_0x48dc45[_0x9ea4('0x41')]);_0x140071['attributes']=_['intersection'](_0x48dc45['model'],qs[_0x9ea4('0x46')](_0x1ab4d7[_0x9ea4('0x41')][_0x9ea4('0x46')]));_0x140071[_0x9ea4('0x47')]=_0x140071['attributes']['length']?_0x140071[_0x9ea4('0x47')]:_0x48dc45['model'];if(_0x1ab4d7[_0x9ea4('0x41')]['includeAll']){_0x140071[_0x9ea4('0x53')]=[{'all':!![]}];}_0x140071=_[_0x9ea4('0x51')]({},_0x140071,_0x1ab4d7[_0x9ea4('0x52')]);return db['ChatMessage']['find'](_0x140071)[_0x9ea4('0x25')](handleEntityNotFound(_0x2d7828,null))[_0x9ea4('0x25')](respondWithResult(_0x2d7828,null))[_0x9ea4('0x2f')](handleError(_0x2d7828,null));};exports[_0x9ea4('0x58')]=function(_0x42ff7c,_0x3090cc){return db[_0x9ea4('0x3c')][_0x9ea4('0x58')](_0x42ff7c[_0x9ea4('0x59')],{})['then'](respondWithResult(_0x3090cc,0xc9))['catch'](handleError(_0x3090cc,null));};exports[_0x9ea4('0x5a')]=function(_0x2a640c,_0x15ad26){if(_0x2a640c[_0x9ea4('0x59')]['id']){delete _0x2a640c['body']['id'];}return db['ChatMessage']['find']({'where':{'id':_0x2a640c[_0x9ea4('0x57')]['id']}})[_0x9ea4('0x25')](handleEntityNotFound(_0x15ad26,null))[_0x9ea4('0x25')](saveUpdates(_0x2a640c['body'],null))['then'](respondWithResult(_0x15ad26,null))['catch'](handleError(_0x15ad26,null));};exports['destroy']=function(_0x10ca02,_0x21da16){return db[_0x9ea4('0x3c')][_0x9ea4('0x5b')]({'where':{'id':_0x10ca02['params']['id']}})[_0x9ea4('0x25')](handleEntityNotFound(_0x21da16,null))[_0x9ea4('0x25')](removeEntity(_0x21da16,null))[_0x9ea4('0x2f')](handleError(_0x21da16,null));};exports[_0x9ea4('0x5c')]=function(_0x3f599a,_0x336b98){return db[_0x9ea4('0x3c')][_0x9ea4('0x5c')]()[_0x9ea4('0x25')](respondWithResult(_0x336b98,null))[_0x9ea4('0x2f')](handleError(_0x336b98,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x9ea4('0x5d')]=function(_0x1b4796,_0x17f77e,_0xb21287){var _0xb49d2d={'channel':_0x9ea4('0x5e')};if(_0x1b4796[_0x9ea4('0x59')]['id']){delete _0x1b4796['body']['id'];}_0x1b4796['body'][_0x9ea4('0x5f')]=!![];_0x1b4796[_0x9ea4('0x59')][_0x9ea4('0x60')]=moment()[_0x9ea4('0x61')](_0x9ea4('0x62'));_0x1b4796[_0x9ea4('0x59')][_0x9ea4('0x63')]=_0x1b4796['body'][_0x9ea4('0x63')]||_0x1b4796[_0x9ea4('0x64')]['id'];return db[_0x9ea4('0x3c')]['find']({'where':{'id':_0x1b4796[_0x9ea4('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x9ea4('0x65')],'as':'Contact'}]})[_0x9ea4('0x25')](handleEntityNotFound(_0x17f77e,null))['then'](saveUpdates(_0x1b4796['body'],null))[_0x9ea4('0x25')](function(_0x59df3a){if(_0x59df3a){_0xb49d2d['message']=_0x59df3a[_0x9ea4('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x9ea4('0x5b')]({'where':{'id':_0x59df3a[_0x9ea4('0x67')]}});}return null;})[_0x9ea4('0x25')](handleEntityNotFound(_0x17f77e,null))[_0x9ea4('0x25')](function(_0x3cf53c){if(_0x3cf53c){return _0x3cf53c[_0x9ea4('0x5a')]({'UserId':_0x1b4796[_0x9ea4('0x59')][_0x9ea4('0x63')],'read1stAt':_[_0x9ea4('0x68')](_0x3cf53c[_0x9ea4('0x69')])?moment()[_0x9ea4('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x32f5d1){if(_0x32f5d1){_0xb49d2d['interaction']=_0x32f5d1[_0x9ea4('0x66')]({'plain':!![]});interaction_log[_0x9ea4('0x26')](_0x9ea4('0x6a'),_0x1b4796[_0x9ea4('0x64')]['id'],_0x1b4796[_0x9ea4('0x64')][_0x9ea4('0x38')],_0x1b4796[_0x9ea4('0x64')][_0x9ea4('0x6b')],_0xb49d2d[_0x9ea4('0x6c')]['id'],_0x1b4796[_0x9ea4('0x59')]?JSON['stringify'](_0x1b4796[_0x9ea4('0x59')]):_0x9ea4('0x6d'));return respondWithRpcPromise(_0x9ea4('0x6e'),'acceptMessage',_0xb49d2d);}return null;})[_0x9ea4('0x25')](function(_0x1667ac){if(_0x1667ac){if(_0x1b4796[_0x9ea4('0x59')]['manual']){_0xb49d2d[_0x9ea4('0x2e')][_0x9ea4('0x6f')]=util[_0x9ea4('0x61')](_0x9ea4('0x70'),_0x1b4796[_0x9ea4('0x64')][_0x9ea4('0x38')]);_0xb49d2d[_0x9ea4('0x2e')]['channel']=_0xb49d2d[_0x9ea4('0x71')];_0xb49d2d['message']['event']=_0x9ea4('0x5d');return respondWithRpcPromise(_0x9ea4('0x72'),_0x9ea4('0x72'),{'event':_0x9ea4('0x73'),'message':_[_0x9ea4('0x51')](_0xb49d2d[_0x9ea4('0x2e')],JSON[_0x9ea4('0x74')](_0xb49d2d[_0x9ea4('0x6c')][_0x9ea4('0x75')]))},client9002)[_0x9ea4('0x25')](function(){return _0xb49d2d;});}return _0xb49d2d;}return null;})[_0x9ea4('0x25')](respondWithResult(_0x17f77e,null))[_0x9ea4('0x2f')](handleError(_0x17f77e,null));};var interaction_log=require('../../config/logger')(_0x9ea4('0x76'));exports[_0x9ea4('0x77')]=function(_0x3f65e2,_0x559d98,_0x57d513){var _0x5802c3={'agent':{},'channel':_0x9ea4('0x5e')};if(_0x3f65e2['body']['id']){delete _0x3f65e2['body']['id'];}_0x3f65e2[_0x9ea4('0x59')]['UserId']=_0x3f65e2['body'][_0x9ea4('0x63')]||_0x3f65e2['user']['id'];_0x5802c3[_0x9ea4('0x78')]['id']=_0x3f65e2['body']['UserId'];return db['ChatMessage'][_0x9ea4('0x5b')]({'where':{'id':_0x3f65e2[_0x9ea4('0x57')]['id'],'UserId':null}})[_0x9ea4('0x25')](handleEntityNotFound(_0x559d98,null))[_0x9ea4('0x25')](function(_0x880352){if(_0x880352){_0x5802c3[_0x9ea4('0x2e')]=_0x880352['get']({'plain':!![]});return db[_0x9ea4('0x79')][_0x9ea4('0x5b')]({'where':{'id':_0x880352[_0x9ea4('0x67')]}});}return null;})[_0x9ea4('0x25')](handleEntityNotFound(_0x559d98,null))[_0x9ea4('0x25')](function(_0x3fcfa5){if(_0x3fcfa5){_0x5802c3[_0x9ea4('0x6c')]=_0x3fcfa5['get']({'plain':!![]});interaction_log[_0x9ea4('0x26')](_0x9ea4('0x7a'),_0x3f65e2[_0x9ea4('0x64')]['id'],_0x3f65e2[_0x9ea4('0x64')]['name'],_0x3f65e2[_0x9ea4('0x64')]['role'],_0x5802c3[_0x9ea4('0x6c')]['id'],_0x3f65e2[_0x9ea4('0x59')]?JSON[_0x9ea4('0x2a')](_0x3f65e2['body']):_0x9ea4('0x6d'));return respondWithRpcPromise(_0x9ea4('0x7b'),'rejectMessage',_0x5802c3);}return null;})[_0x9ea4('0x25')](function(_0x44c9a3){if(_0x44c9a3){_0x44c9a3[_0x9ea4('0x2e')][_0x9ea4('0x6f')]=util[_0x9ea4('0x61')](_0x9ea4('0x70'),_0x3f65e2[_0x9ea4('0x64')][_0x9ea4('0x38')]);_0x44c9a3['message']['channel']=_0x5802c3[_0x9ea4('0x71')];_0x44c9a3[_0x9ea4('0x2e')]['event']=_0x9ea4('0x77');respondWithRpcPromise(_0x9ea4('0x72'),_0x9ea4('0x72'),{'event':_0x9ea4('0x7c'),'message':_0x44c9a3[_0x9ea4('0x2e')]},client9002);return _0x5802c3;}return null;})[_0x9ea4('0x25')](respondWithResult(_0x559d98,null))[_0x9ea4('0x2f')](handleError(_0x559d98,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b3a2dc4..2d9c9c9 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 _0x96a8=['events','setMaxListeners','update','hook','exports'];(function(_0x576f20,_0x3c6602){var _0x540ff1=function(_0x4a186e){while(--_0x4a186e){_0x576f20['push'](_0x576f20['shift']());}};_0x540ff1(++_0x3c6602);}(_0x96a8,0x16d));var _0x896a=function(_0xd74f82,_0x1a5de1){_0xd74f82=_0xd74f82-0x0;var _0x5ad9c4=_0x96a8[_0xd74f82];return _0x5ad9c4;};'use strict';var EventEmitter=require(_0x896a('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x896a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x896a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5725cd){return function(_0x42b870,_0x484da8,_0x2956ca){ChatMessageEvents['emit'](_0x5725cd+':'+_0x42b870['id'],_0x42b870);ChatMessageEvents['emit'](_0x5725cd,_0x42b870);_0x2956ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x896a('0x3')](e,emitEvent(event));}}module[_0x896a('0x4')]=ChatMessageEvents; \ No newline at end of file +var _0x1767=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1767,0x1bf));var _0x7176=function(_0x2defc4,_0x25dbea){_0x2defc4=_0x2defc4-0x0;var _0x10e80a=_0x1767[_0x2defc4];return _0x10e80a;};'use strict';var EventEmitter=require(_0x7176('0x0'));var ChatMessage=require(_0x7176('0x1'))['db'][_0x7176('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7176('0x3'),'afterUpdate':_0x7176('0x4'),'afterDestroy':_0x7176('0x5')};function emitEvent(_0x13700f){return function(_0x4448ec,_0x2a28ff,_0x3fd0e9){ChatMessageEvents['emit'](_0x13700f+':'+_0x4448ec['id'],_0x4448ec);ChatMessageEvents[_0x7176('0x6')](_0x13700f,_0x4448ec);_0x3fd0e9(null);};}for(var e in events){if(events[_0x7176('0x7')](e)){var event=events[e];ChatMessage[_0x7176('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index fd53cbb..1e14e18 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 _0xf073=['chat_messages','fti_chat_messages','body','FULLTEXT','get','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','direction','toLowerCase','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xf073,0xb5));var _0x3f07=function(_0x35c4d4,_0x2881a8){_0x35c4d4=_0x35c4d4-0x0;var _0x327471=_0xf073[_0x35c4d4];return _0x327471;};'use strict';var _=require('lodash');var util=require(_0x3f07('0x0'));var logger=require(_0x3f07('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3f07('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f07('0x3'));var rimraf=require('rimraf');var config=require(_0x3f07('0x4'));var attributes=require(_0x3f07('0x5'));module[_0x3f07('0x6')]=function(_0x453bd3,_0x4d5db4){return _0x453bd3['define'](_0x3f07('0x7'),attributes,{'tableName':_0x3f07('0x8'),'paranoid':![],'indexes':[{'name':_0x3f07('0x9'),'fields':[_0x3f07('0xa')],'type':_0x3f07('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a1f76,_0x19274a,_0x448839){var _0x5f47be=_0x453bd3['models'];var _0x35e020=_0x5a1f76[_0x3f07('0xc')]({'plain':!![]});if(_0x35e020['direction']['toLowerCase']()==='in'||_0x35e020['direction']['toLowerCase']()===_0x3f07('0xd')&&!_0x35e020[_0x3f07('0xe')]&&!_[_0x3f07('0xf')](_0x35e020[_0x3f07('0x10')])){_0x5f47be['ChatInteraction'][_0x3f07('0x11')]({'where':{'id':_0x35e020[_0x3f07('0x12')]}})[_0x3f07('0x13')](function(_0x1367d6){if(_0x1367d6){_0x1367d6[_0x3f07('0x14')]({'lastMsgAt':_0x35e020[_0x3f07('0x15')],'lastMsgDirection':_0x35e020[_0x3f07('0x16')][_0x3f07('0x17')]()});}})['catch'](function(_0xcb2512){console[_0x3f07('0x18')](_0xcb2512);});}_0x448839();}},'charset':_0x3f07('0x19'),'collate':_0x3f07('0x1a')});}; \ No newline at end of file +var _0x2804=['catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2804,0x7a));var _0x4280=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2804[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var logger=require(_0x4280('0x2'))(_0x4280('0x3'));var moment=require(_0x4280('0x4'));var BPromise=require(_0x4280('0x5'));var rp=require(_0x4280('0x6'));var fs=require('fs');var path=require(_0x4280('0x7'));var rimraf=require(_0x4280('0x8'));var config=require('../../config/environment');var attributes=require(_0x4280('0x9'));module['exports']=function(_0x648851,_0x1d8c91){return _0x648851[_0x4280('0xa')](_0x4280('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x4280('0xc'),'fields':[_0x4280('0xd')],'type':_0x4280('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15c2fe,_0x12d5b1,_0x12937c){var _0x585898=_0x648851[_0x4280('0xf')];var _0xe41c1d=_0x15c2fe[_0x4280('0x10')]({'plain':!![]});if(_0xe41c1d[_0x4280('0x11')][_0x4280('0x12')]()==='in'||_0xe41c1d[_0x4280('0x11')][_0x4280('0x12')]()===_0x4280('0x13')&&!_0xe41c1d['secret']&&!_[_0x4280('0x14')](_0xe41c1d[_0x4280('0x15')])){_0x585898[_0x4280('0x16')][_0x4280('0x17')]({'where':{'id':_0xe41c1d[_0x4280('0x18')]}})[_0x4280('0x19')](function(_0x55f121){if(_0x55f121){_0x55f121[_0x4280('0x1a')]({'lastMsgAt':_0xe41c1d[_0x4280('0x1b')],'lastMsgDirection':_0xe41c1d[_0x4280('0x11')][_0x4280('0x12')]()});}})[_0x4280('0x1c')](function(_0x33e6d9){console['error'](_0x33e6d9);});}_0x12937c();}},'charset':_0x4280('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 40b7ae9..f484b0e 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 _0xc799=['ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','request\x20sent','stringify','error','code'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc799,0x146));var _0x9c79=function(_0x21e38e,_0x381a5b){_0x21e38e=_0x21e38e-0x0;var _0x5e89f4=_0xc799[_0x21e38e];return _0x5e89f4;};'use strict';var _=require('lodash');var util=require(_0x9c79('0x0'));var moment=require(_0x9c79('0x1'));var BPromise=require(_0x9c79('0x2'));var rs=require(_0x9c79('0x3'));var fs=require('fs');var Redis=require(_0x9c79('0x4'));var db=require(_0x9c79('0x5'))['db'];var utils=require(_0x9c79('0x6'));var logger=require(_0x9c79('0x7'))(_0x9c79('0x8'));var config=require(_0x9c79('0x9'));var jayson=require(_0x9c79('0xa'));var client=jayson[_0x9c79('0xb')][_0x9c79('0xc')]({'port':0x232a});config['redis']=_[_0x9c79('0xd')](config[_0x9c79('0xe')],{'host':_0x9c79('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c79('0xe')]));require('./chatMessage.socket')[_0x9c79('0x10')](socket);function respondWithRpcPromise(_0x2cb353,_0x4ec184,_0x15f6b9){return new BPromise(function(_0x5164bf,_0x901730){return client[_0x9c79('0x11')](_0x2cb353,_0x15f6b9)[_0x9c79('0x12')](function(_0x1bbe04){logger[_0x9c79('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4ec184,_0x9c79('0x14'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4ec184,_0x9c79('0x14'),JSON[_0x9c79('0x15')](_0x1bbe04));if(_0x1bbe04['error']){if(_0x1bbe04[_0x9c79('0x16')][_0x9c79('0x17')]===0x1f4){logger[_0x9c79('0x16')](_0x9c79('0x18'),_0x4ec184,_0x1bbe04[_0x9c79('0x16')]['message']);return _0x901730(_0x1bbe04['error'][_0x9c79('0x19')]);}logger[_0x9c79('0x16')](_0x9c79('0x18'),_0x4ec184,_0x1bbe04[_0x9c79('0x16')][_0x9c79('0x19')]);return _0x5164bf(_0x1bbe04[_0x9c79('0x16')][_0x9c79('0x19')]);}else{logger[_0x9c79('0x13')](_0x9c79('0x18'),_0x4ec184,'request\x20sent');_0x5164bf(_0x1bbe04[_0x9c79('0x1a')]['message']);}})['catch'](function(_0x117dd9){logger[_0x9c79('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4ec184,_0x117dd9);_0x901730(_0x117dd9);});});}exports[_0x9c79('0x1b')]=function(_0x59c772){var _0x455598=this;return new Promise(function(_0x1b095c,_0x426df4){return db[_0x9c79('0x1c')][_0x9c79('0x1d')](_0x59c772[_0x9c79('0x1e')],{'raw':_0x59c772[_0x9c79('0x1f')]?_0x59c772[_0x9c79('0x1f')][_0x9c79('0x20')]===undefined?!![]:![]:!![]})[_0x9c79('0x12')](function(_0x50686a){logger['info']('CreateChatMessage',_0x59c772);logger[_0x9c79('0x21')](_0x9c79('0x1b'),_0x59c772,JSON[_0x9c79('0x15')](_0x50686a));_0x1b095c(_0x50686a);})[_0x9c79('0x22')](function(_0x4bbfc0){logger['error']('CreateChatMessage',_0x4bbfc0[_0x9c79('0x19')],_0x59c772);_0x426df4(_0x455598[_0x9c79('0x16')](0x1f4,_0x4bbfc0[_0x9c79('0x19')]));});});}; \ No newline at end of file +var _0x1c79=['ChatMessage,\x20%s,\x20%s','message','info','catch','CreateChatMessage','ChatMessage','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','localhost','socket.io-emitter','redis','register','then','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1c79,0x12b));var _0x91c7=function(_0x3bf1db,_0x4ae4cd){_0x3bf1db=_0x3bf1db-0x0;var _0x55af2d=_0x1c79[_0x3bf1db];return _0x55af2d;};'use strict';var _=require(_0x91c7('0x0'));var util=require('util');var moment=require(_0x91c7('0x1'));var BPromise=require(_0x91c7('0x2'));var rs=require(_0x91c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91c7('0x4'))['db'];var utils=require(_0x91c7('0x5'));var logger=require(_0x91c7('0x6'))(_0x91c7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x91c7('0x8')]({'port':0x232a});config['redis']=_[_0x91c7('0x9')](config['redis'],{'host':_0x91c7('0xa'),'port':0x18eb});var socket=require(_0x91c7('0xb'))(new Redis(config[_0x91c7('0xc')]));require('./chatMessage.socket')[_0x91c7('0xd')](socket);function respondWithRpcPromise(_0xb0b929,_0x151037,_0x45b5fd){return new BPromise(function(_0x31cfdc,_0x42d5bd){return client['request'](_0xb0b929,_0x45b5fd)[_0x91c7('0xe')](function(_0x26abfc){logger['info']('ChatMessage,\x20%s,\x20%s',_0x151037,_0x91c7('0xf'));logger['debug'](_0x91c7('0x10'),_0x151037,_0x91c7('0xf'),JSON[_0x91c7('0x11')](_0x26abfc));if(_0x26abfc[_0x91c7('0x12')]){if(_0x26abfc[_0x91c7('0x12')][_0x91c7('0x13')]===0x1f4){logger['error'](_0x91c7('0x14'),_0x151037,_0x26abfc['error']['message']);return _0x42d5bd(_0x26abfc[_0x91c7('0x12')][_0x91c7('0x15')]);}logger[_0x91c7('0x12')](_0x91c7('0x14'),_0x151037,_0x26abfc[_0x91c7('0x12')][_0x91c7('0x15')]);return _0x31cfdc(_0x26abfc[_0x91c7('0x12')][_0x91c7('0x15')]);}else{logger[_0x91c7('0x16')]('ChatMessage,\x20%s,\x20%s',_0x151037,_0x91c7('0xf'));_0x31cfdc(_0x26abfc['result']['message']);}})[_0x91c7('0x17')](function(_0x3ed454){logger[_0x91c7('0x12')]('ChatMessage,\x20%s,\x20%s',_0x151037,_0x3ed454);_0x42d5bd(_0x3ed454);});});}exports[_0x91c7('0x18')]=function(_0x995c33){var _0x6b9cf0=this;return new Promise(function(_0x2b3a9d,_0x19c066){return db[_0x91c7('0x19')]['create'](_0x995c33[_0x91c7('0x1a')],{'raw':_0x995c33['options']?_0x995c33[_0x91c7('0x1b')][_0x91c7('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3dabb9){logger[_0x91c7('0x16')](_0x91c7('0x18'),_0x995c33);logger['debug'](_0x91c7('0x18'),_0x995c33,JSON[_0x91c7('0x11')](_0x3dabb9));_0x2b3a9d(_0x3dabb9);})[_0x91c7('0x17')](function(_0x12d694){logger['error'](_0x91c7('0x18'),_0x12d694[_0x91c7('0x15')],_0x995c33);_0x19c066(_0x6b9cf0['error'](0x1f4,_0x12d694['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index bfbb276..90c0834 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 _0xacf4=['removeListener','register','length','remove','update','emit'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xacf4,0xe7));var _0x4acf=function(_0x59312d,_0x52bb25){_0x59312d=_0x59312d-0x0;var _0x13ca66=_0xacf4[_0x59312d];return _0x13ca66;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4acf('0x0'),_0x4acf('0x1')];function createListener(_0x1e2413,_0x21fb75){return function(_0x25709c){_0x21fb75[_0x4acf('0x2')](_0x1e2413,_0x25709c);};}function removeListener(_0x145264,_0x5cf22d){return function(){ChatMessageEvents[_0x4acf('0x3')](_0x145264,_0x5cf22d);};}exports[_0x4acf('0x4')]=function(_0x4e0c43){for(var _0x24bf24=0x0,_0x2ba08a=events[_0x4acf('0x5')];_0x24bf24<_0x2ba08a;_0x24bf24++){var _0x45a5a4=events[_0x24bf24];var _0x25d345=createListener('chatMessage:'+_0x45a5a4,_0x4e0c43);ChatMessageEvents['on'](_0x45a5a4,_0x25d345);}}; \ No newline at end of file +var _0x4137=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x71430b,_0x224419){var _0x5d5f14=function(_0x55b60b){while(--_0x55b60b){_0x71430b['push'](_0x71430b['shift']());}};_0x5d5f14(++_0x224419);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var ChatMessageEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){ChatMessageEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);ChatMessageEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9a965f4..d4599b4 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 _0xda9d=['create','put','/:id/accept','reject','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','isAuthenticated','describe','show','post','tracked'];(function(_0x5b4c95,_0x3d7219){var _0x238df5=function(_0x2966b5){while(--_0x2966b5){_0x5b4c95['push'](_0x5b4c95['shift']());}};_0x238df5(++_0x3d7219);}(_0xda9d,0x195));var _0xdda9=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xda9d[_0x343e44];return _0xa5130e;};'use strict';var multer=require('multer');var util=require(_0xdda9('0x0'));var path=require(_0xdda9('0x1'));var timeout=require(_0xdda9('0x2'));var express=require(_0xdda9('0x3'));var router=express[_0xdda9('0x4')]();var auth=require(_0xdda9('0x5'));var interaction=require(_0xdda9('0x6'));var config=require('../../config/environment');var controller=require(_0xdda9('0x7'));router[_0xdda9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdda9('0x8')](_0xdda9('0x9'),auth[_0xdda9('0xa')](),controller[_0xdda9('0xb')]);router['get']('/:id',auth[_0xdda9('0xa')](),controller[_0xdda9('0xc')]);router[_0xdda9('0xd')]('/',auth[_0xdda9('0xa')](),interaction[_0xdda9('0xe')]('chat','chatmessage:create'),controller[_0xdda9('0xf')]);router[_0xdda9('0x10')]('/:id',controller['update']);router[_0xdda9('0x10')](_0xdda9('0x11'),auth[_0xdda9('0xa')](),controller['accept']);router['put']('/:id/reject',auth[_0xdda9('0xa')](),controller[_0xdda9('0x12')]);router['delete'](_0xdda9('0x13'),auth[_0xdda9('0xa')](),controller['destroy']);module[_0xdda9('0x14')]=router; \ No newline at end of file +var _0x00d2=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x00d2,0x14c));var _0x200d=function(_0x14e589,_0x5d5c97){_0x14e589=_0x14e589-0x0;var _0x4ceb8c=_0x00d2[_0x14e589];return _0x4ceb8c;};'use strict';var multer=require(_0x200d('0x0'));var util=require(_0x200d('0x1'));var path=require(_0x200d('0x2'));var timeout=require(_0x200d('0x3'));var express=require(_0x200d('0x4'));var router=express['Router']();var auth=require(_0x200d('0x5'));var interaction=require(_0x200d('0x6'));var config=require(_0x200d('0x7'));var controller=require(_0x200d('0x8'));router[_0x200d('0x9')]('/',auth[_0x200d('0xa')](),controller['index']);router[_0x200d('0x9')](_0x200d('0xb'),auth[_0x200d('0xa')](),controller[_0x200d('0xc')]);router[_0x200d('0x9')](_0x200d('0xd'),auth[_0x200d('0xa')](),controller['show']);router['post']('/',auth[_0x200d('0xa')](),interaction['tracked'](_0x200d('0xe'),_0x200d('0xf')),controller[_0x200d('0x10')]);router[_0x200d('0x11')]('/:id',controller[_0x200d('0x12')]);router[_0x200d('0x11')](_0x200d('0x13'),auth[_0x200d('0xa')](),controller[_0x200d('0x14')]);router['put'](_0x200d('0x15'),auth[_0x200d('0xa')](),controller[_0x200d('0x16')]);router[_0x200d('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index dd3b38f..ec3e370 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 _0xa97d=['exports','medium','sequelize'];(function(_0x445aaa,_0x23be09){var _0x3079d6=function(_0x1ae48e){while(--_0x1ae48e){_0x445aaa['push'](_0x445aaa['shift']());}};_0x3079d6(++_0x23be09);}(_0xa97d,0x11f));var _0xda97=function(_0x5ceb75,_0x285bba){_0x5ceb75=_0x5ceb75-0x0;var _0x2b4079=_0xa97d[_0x5ceb75];return _0x2b4079;};'use strict';var Sequelize=require(_0xda97('0x0'));module[_0xda97('0x1')]={'body':{'type':Sequelize['TEXT'](_0xda97('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x7ebe=['medium','sequelize','exports'];(function(_0x1b0899,_0x179c99){var _0x30273f=function(_0x3013e7){while(--_0x3013e7){_0x1b0899['push'](_0x1b0899['shift']());}};_0x30273f(++_0x179c99);}(_0x7ebe,0x121));var _0xe7eb=function(_0x482415,_0x33b44c){_0x482415=_0x482415-0x0;var _0x330885=_0x7ebe[_0x482415];return _0x330885;};'use strict';var Sequelize=require(_0xe7eb('0x0'));module[_0xe7eb('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe7eb('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index ef31ba2..91b7717 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 _0x6050=['end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ChatOfflineMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x313086,_0x8027d5){var _0x7c2858=function(_0x26227f){while(--_0x26227f){_0x313086['push'](_0x313086['shift']());}};_0x7c2858(++_0x8027d5);}(_0x6050,0x196));var _0x0605=function(_0x48b5ad,_0x8545e3){_0x48b5ad=_0x48b5ad-0x0;var _0x4398af=_0x6050[_0x48b5ad];return _0x4398af;};'use strict';var pdf=require(_0x0605('0x0'));var emlformat=require(_0x0605('0x1'));var rimraf=require(_0x0605('0x2'));var zipdir=require(_0x0605('0x3'));var jsonpatch=require(_0x0605('0x4'));var rp=require(_0x0605('0x5'));var moment=require('moment');var BPromise=require(_0x0605('0x6'));var Mustache=require(_0x0605('0x7'));var util=require(_0x0605('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0605('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var db=require(_0x0605('0x17'))['db'];function respondWithStatusCode(_0x434e62,_0xd22e35){_0xd22e35=_0xd22e35||0xcc;return function(_0x39e288){if(_0x39e288){return _0x434e62[_0x0605('0x18')](_0xd22e35);}return _0x434e62[_0x0605('0x19')](_0xd22e35)[_0x0605('0x1a')]();};}function respondWithResult(_0x44e793,_0x169a70){_0x169a70=_0x169a70||0xc8;return function(_0x65a20b){if(_0x65a20b){return _0x44e793[_0x0605('0x19')](_0x169a70)['json'](_0x65a20b);}};}function respondWithFilteredResult(_0x2b4610,_0x1a802b){return function(_0x4993ab){if(_0x4993ab){var _0x5ce56a=_0x4993ab[_0x0605('0x1b')],_0x4eefe9=_0x1a802b[_0x0605('0x1c')],_0x12a455=_0x1a802b[_0x0605('0x1c')]+_0x1a802b[_0x0605('0x1d')],_0xd0996d;if(_0x12a455>=_0x5ce56a){_0x12a455=_0x5ce56a;_0xd0996d=0xc8;}else{_0xd0996d=0xce;}_0x2b4610[_0x0605('0x19')](_0xd0996d);return _0x2b4610[_0x0605('0x1e')](_0x0605('0x1f'),_0x4eefe9+'-'+_0x12a455+'/'+_0x5ce56a)[_0x0605('0x20')](_0x4993ab);}return null;};}function patchUpdates(_0x3a22e9){return function(_0x2fa77e){try{jsonpatch[_0x0605('0x21')](_0x2fa77e,_0x3a22e9,!![]);}catch(_0x103952){return BPromise['reject'](_0x103952);}return _0x2fa77e[_0x0605('0x22')]();};}function saveUpdates(_0x14a920,_0x430f28){return function(_0x443326){if(_0x443326){return _0x443326[_0x0605('0x23')](_0x14a920)[_0x0605('0x24')](function(_0x379211){return _0x379211;});}return null;};}function removeEntity(_0x2c90ed,_0x226ef5){return function(_0x5b0d44){if(_0x5b0d44){return _0x5b0d44[_0x0605('0x25')]()['then'](function(){_0x2c90ed[_0x0605('0x19')](0xcc)[_0x0605('0x1a')]();});}};}function handleEntityNotFound(_0x110098,_0xf182c4){return function(_0x10c575){if(!_0x10c575){_0x110098[_0x0605('0x18')](0x194);}return _0x10c575;};}function handleError(_0x2ea61d,_0x1ae3db){_0x1ae3db=_0x1ae3db||0x1f4;return function(_0x234231){logger[_0x0605('0x26')](_0x234231[_0x0605('0x27')]);if(_0x234231[_0x0605('0x28')]){delete _0x234231['name'];}_0x2ea61d[_0x0605('0x19')](_0x1ae3db)[_0x0605('0x29')](_0x234231);};}exports['index']=function(_0x4d9a31,_0x55ebd8){var _0x33558f={},_0x226825={},_0x4163cd={'count':0x0,'rows':[]};var _0x149e36=_[_0x0605('0x2a')](db[_0x0605('0x2b')]['rawAttributes'],function(_0x34f25d){return{'name':_0x34f25d['fieldName'],'type':_0x34f25d[_0x0605('0x2c')][_0x0605('0x2d')]};});_0x226825[_0x0605('0x2e')]=_[_0x0605('0x2a')](_0x149e36,_0x0605('0x28'));_0x226825[_0x0605('0x2f')]=_['keys'](_0x4d9a31[_0x0605('0x2f')]);_0x226825[_0x0605('0x30')]=_[_0x0605('0x31')](_0x226825[_0x0605('0x2e')],_0x226825[_0x0605('0x2f')]);_0x33558f[_0x0605('0x32')]=_[_0x0605('0x31')](_0x226825[_0x0605('0x2e')],qs[_0x0605('0x33')](_0x4d9a31[_0x0605('0x2f')][_0x0605('0x33')]));_0x33558f[_0x0605('0x32')]=_0x33558f[_0x0605('0x32')][_0x0605('0x34')]?_0x33558f[_0x0605('0x32')]:_0x226825[_0x0605('0x2e')];if(!_0x4d9a31[_0x0605('0x2f')][_0x0605('0x35')](_0x0605('0x36'))){_0x33558f[_0x0605('0x1d')]=qs[_0x0605('0x1d')](_0x4d9a31[_0x0605('0x2f')][_0x0605('0x1d')]);_0x33558f[_0x0605('0x1c')]=qs[_0x0605('0x1c')](_0x4d9a31[_0x0605('0x2f')][_0x0605('0x1c')]);}_0x33558f['order']=qs[_0x0605('0x37')](_0x4d9a31[_0x0605('0x2f')]['sort']);_0x33558f[_0x0605('0x38')]=qs[_0x0605('0x30')](_['pick'](_0x4d9a31[_0x0605('0x2f')],_0x226825[_0x0605('0x30')]),_0x149e36);if(_0x4d9a31[_0x0605('0x2f')][_0x0605('0x39')]){_0x33558f[_0x0605('0x38')]=_[_0x0605('0x3a')](_0x33558f['where'],{'$or':_['map'](_0x149e36,function(_0x216f82){if(_0x216f82[_0x0605('0x2c')]!==_0x0605('0x3b')){var _0x500497={};_0x500497[_0x216f82[_0x0605('0x28')]]={'$like':'%'+_0x4d9a31['query'][_0x0605('0x39')]+'%'};return _0x500497;}})});}_0x33558f=_[_0x0605('0x3a')]({},_0x33558f,_0x4d9a31[_0x0605('0x3c')]);var _0x22b61c={'where':_0x33558f[_0x0605('0x38')]};return db[_0x0605('0x2b')][_0x0605('0x1b')](_0x22b61c)[_0x0605('0x24')](function(_0x2ef7bf){_0x4163cd[_0x0605('0x1b')]=_0x2ef7bf;if(_0x4d9a31['query'][_0x0605('0x3d')]){_0x33558f['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x3e')](_0x33558f);})[_0x0605('0x24')](function(_0x479c55){_0x4163cd['rows']=_0x479c55;return _0x4163cd;})[_0x0605('0x24')](respondWithFilteredResult(_0x55ebd8,_0x33558f))['catch'](handleError(_0x55ebd8,null));};exports[_0x0605('0x3f')]=function(_0x52f4b6,_0xef54f1){var _0x3de34a={'raw':!![],'where':{'id':_0x52f4b6[_0x0605('0x40')]['id']}},_0x354f4e={};_0x354f4e[_0x0605('0x2e')]=_[_0x0605('0x41')](db[_0x0605('0x2b')][_0x0605('0x42')]);_0x354f4e[_0x0605('0x2f')]=_[_0x0605('0x41')](_0x52f4b6[_0x0605('0x2f')]);_0x354f4e['filters']=_['intersection'](_0x354f4e[_0x0605('0x2e')],_0x354f4e['query']);_0x3de34a[_0x0605('0x32')]=_[_0x0605('0x31')](_0x354f4e['model'],qs[_0x0605('0x33')](_0x52f4b6[_0x0605('0x2f')]['fields']));_0x3de34a[_0x0605('0x32')]=_0x3de34a[_0x0605('0x32')]['length']?_0x3de34a[_0x0605('0x32')]:_0x354f4e[_0x0605('0x2e')];if(_0x52f4b6['query'][_0x0605('0x3d')]){_0x3de34a['include']=[{'all':!![]}];}_0x3de34a=_['merge']({},_0x3de34a,_0x52f4b6[_0x0605('0x3c')]);return db[_0x0605('0x2b')][_0x0605('0x43')](_0x3de34a)[_0x0605('0x24')](handleEntityNotFound(_0xef54f1,null))[_0x0605('0x24')](respondWithResult(_0xef54f1,null))[_0x0605('0x44')](handleError(_0xef54f1,null));};exports[_0x0605('0x45')]=function(_0x232c93,_0x56190c){return db[_0x0605('0x2b')][_0x0605('0x45')](_0x232c93[_0x0605('0x46')],{})['then'](respondWithResult(_0x56190c,0xc9))[_0x0605('0x44')](handleError(_0x56190c,null));};exports[_0x0605('0x23')]=function(_0x45cc1a,_0x3a1624){if(_0x45cc1a[_0x0605('0x46')]['id']){delete _0x45cc1a[_0x0605('0x46')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x43')]({'where':{'id':_0x45cc1a[_0x0605('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a1624,null))[_0x0605('0x24')](saveUpdates(_0x45cc1a[_0x0605('0x46')],null))[_0x0605('0x24')](respondWithResult(_0x3a1624,null))[_0x0605('0x44')](handleError(_0x3a1624,null));};exports[_0x0605('0x25')]=function(_0x434289,_0x18995e){return db[_0x0605('0x2b')][_0x0605('0x43')]({'where':{'id':_0x434289[_0x0605('0x40')]['id']}})['then'](handleEntityNotFound(_0x18995e,null))['then'](removeEntity(_0x18995e,null))['catch'](handleError(_0x18995e,null));};exports[_0x0605('0x47')]=function(_0x7daeb7,_0x46d852){return db[_0x0605('0x2b')][_0x0605('0x47')]()[_0x0605('0x24')](respondWithResult(_0x46d852,null))['catch'](handleError(_0x46d852,null));}; \ No newline at end of file +var _0x4c60=['papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','error','name','send','index','map','ChatOfflineMessage','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x4c60,0xc1));var _0x04c6=function(_0x36370d,_0x53e095){_0x36370d=_0x36370d-0x0;var _0x5ae8e5=_0x4c60[_0x36370d];return _0x5ae8e5;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x7'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var db=require(_0x04c6('0x13'))['db'];function respondWithStatusCode(_0x119187,_0x4e5e6){_0x4e5e6=_0x4e5e6||0xcc;return function(_0x52cdcf){if(_0x52cdcf){return _0x119187[_0x04c6('0x14')](_0x4e5e6);}return _0x119187[_0x04c6('0x15')](_0x4e5e6)[_0x04c6('0x16')]();};}function respondWithResult(_0x56422a,_0x12d1c5){_0x12d1c5=_0x12d1c5||0xc8;return function(_0x15cbe0){if(_0x15cbe0){return _0x56422a[_0x04c6('0x15')](_0x12d1c5)[_0x04c6('0x17')](_0x15cbe0);}};}function respondWithFilteredResult(_0x4760f8,_0x19a26f){return function(_0x1cd963){if(_0x1cd963){var _0x3d46a9=_0x1cd963[_0x04c6('0x18')],_0x5a5a66=_0x19a26f[_0x04c6('0x19')],_0x31edf9=_0x19a26f[_0x04c6('0x19')]+_0x19a26f[_0x04c6('0x1a')],_0xa2bc92;if(_0x31edf9>=_0x3d46a9){_0x31edf9=_0x3d46a9;_0xa2bc92=0xc8;}else{_0xa2bc92=0xce;}_0x4760f8[_0x04c6('0x15')](_0xa2bc92);return _0x4760f8[_0x04c6('0x1b')]('Content-Range',_0x5a5a66+'-'+_0x31edf9+'/'+_0x3d46a9)[_0x04c6('0x17')](_0x1cd963);}return null;};}function patchUpdates(_0x13e472){return function(_0xa70fd2){try{jsonpatch['apply'](_0xa70fd2,_0x13e472,!![]);}catch(_0x4cef4e){return BPromise['reject'](_0x4cef4e);}return _0xa70fd2[_0x04c6('0x1c')]();};}function saveUpdates(_0xb997e0,_0x50dd61){return function(_0x5a5e9e){if(_0x5a5e9e){return _0x5a5e9e[_0x04c6('0x1d')](_0xb997e0)[_0x04c6('0x1e')](function(_0x3cd448){return _0x3cd448;});}return null;};}function removeEntity(_0x5daa22,_0x33a0f7){return function(_0x13f2dc){if(_0x13f2dc){return _0x13f2dc[_0x04c6('0x1f')]()['then'](function(){_0x5daa22[_0x04c6('0x15')](0xcc)[_0x04c6('0x16')]();});}};}function handleEntityNotFound(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(!_0x4c8d72){_0x562491[_0x04c6('0x14')](0x194);}return _0x4c8d72;};}function handleError(_0x3a2014,_0xd5828d){_0xd5828d=_0xd5828d||0x1f4;return function(_0x115e35){logger[_0x04c6('0x20')](_0x115e35['stack']);if(_0x115e35['name']){delete _0x115e35[_0x04c6('0x21')];}_0x3a2014[_0x04c6('0x15')](_0xd5828d)[_0x04c6('0x22')](_0x115e35);};}exports[_0x04c6('0x23')]=function(_0x4f256f,_0x1f5aaf){var _0x47c69a={},_0x1d0d3f={},_0x165cb5={'count':0x0,'rows':[]};var _0x4e00fe=_[_0x04c6('0x24')](db[_0x04c6('0x25')]['rawAttributes'],function(_0x5c9003){return{'name':_0x5c9003[_0x04c6('0x26')],'type':_0x5c9003[_0x04c6('0x27')][_0x04c6('0x28')]};});_0x1d0d3f[_0x04c6('0x29')]=_[_0x04c6('0x24')](_0x4e00fe,_0x04c6('0x21'));_0x1d0d3f['query']=_['keys'](_0x4f256f['query']);_0x1d0d3f[_0x04c6('0x2a')]=_['intersection'](_0x1d0d3f[_0x04c6('0x29')],_0x1d0d3f[_0x04c6('0x2b')]);_0x47c69a['attributes']=_[_0x04c6('0x2c')](_0x1d0d3f[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x4f256f[_0x04c6('0x2b')]['fields']));_0x47c69a[_0x04c6('0x2e')]=_0x47c69a[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x47c69a[_0x04c6('0x2e')]:_0x1d0d3f[_0x04c6('0x29')];if(!_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x30')](_0x04c6('0x31'))){_0x47c69a[_0x04c6('0x1a')]=qs[_0x04c6('0x1a')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x47c69a[_0x04c6('0x19')]=qs[_0x04c6('0x19')](_0x4f256f[_0x04c6('0x2b')]['offset']);}_0x47c69a[_0x04c6('0x32')]=qs[_0x04c6('0x33')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x33')]);_0x47c69a['where']=qs[_0x04c6('0x2a')](_[_0x04c6('0x34')](_0x4f256f['query'],_0x1d0d3f['filters']),_0x4e00fe);if(_0x4f256f['query'][_0x04c6('0x35')]){_0x47c69a[_0x04c6('0x36')]=_['merge'](_0x47c69a[_0x04c6('0x36')],{'$or':_['map'](_0x4e00fe,function(_0x15c270){if(_0x15c270[_0x04c6('0x27')]!==_0x04c6('0x37')){var _0x2b28cd={};_0x2b28cd[_0x15c270['name']]={'$like':'%'+_0x4f256f['query'][_0x04c6('0x35')]+'%'};return _0x2b28cd;}})});}_0x47c69a=_[_0x04c6('0x38')]({},_0x47c69a,_0x4f256f['options']);var _0x3f4fad={'where':_0x47c69a['where']};return db['ChatOfflineMessage'][_0x04c6('0x18')](_0x3f4fad)['then'](function(_0x181d3f){_0x165cb5[_0x04c6('0x18')]=_0x181d3f;if(_0x4f256f['query'][_0x04c6('0x39')]){_0x47c69a['include']=[{'all':!![]}];}return db[_0x04c6('0x25')][_0x04c6('0x3a')](_0x47c69a);})[_0x04c6('0x1e')](function(_0x120238){_0x165cb5[_0x04c6('0x3b')]=_0x120238;return _0x165cb5;})['then'](respondWithFilteredResult(_0x1f5aaf,_0x47c69a))[_0x04c6('0x3c')](handleError(_0x1f5aaf,null));};exports['show']=function(_0x74f1d1,_0x533608){var _0x1f7ead={'raw':!![],'where':{'id':_0x74f1d1[_0x04c6('0x3d')]['id']}},_0xc31731={};_0xc31731[_0x04c6('0x29')]=_[_0x04c6('0x3e')](db[_0x04c6('0x25')][_0x04c6('0x3f')]);_0xc31731['query']=_[_0x04c6('0x3e')](_0x74f1d1['query']);_0xc31731[_0x04c6('0x2a')]=_['intersection'](_0xc31731['model'],_0xc31731[_0x04c6('0x2b')]);_0x1f7ead['attributes']=_[_0x04c6('0x2c')](_0xc31731[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x74f1d1['query'][_0x04c6('0x2d')]));_0x1f7ead[_0x04c6('0x2e')]=_0x1f7ead[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x1f7ead[_0x04c6('0x2e')]:_0xc31731[_0x04c6('0x29')];if(_0x74f1d1[_0x04c6('0x2b')]['includeAll']){_0x1f7ead['include']=[{'all':!![]}];}_0x1f7ead=_[_0x04c6('0x38')]({},_0x1f7ead,_0x74f1d1[_0x04c6('0x40')]);return db[_0x04c6('0x25')]['find'](_0x1f7ead)[_0x04c6('0x1e')](handleEntityNotFound(_0x533608,null))[_0x04c6('0x1e')](respondWithResult(_0x533608,null))[_0x04c6('0x3c')](handleError(_0x533608,null));};exports['create']=function(_0x4c9942,_0x56c7e6){return db[_0x04c6('0x25')][_0x04c6('0x41')](_0x4c9942['body'],{})[_0x04c6('0x1e')](respondWithResult(_0x56c7e6,0xc9))[_0x04c6('0x3c')](handleError(_0x56c7e6,null));};exports[_0x04c6('0x1d')]=function(_0x4ef366,_0x392983){if(_0x4ef366[_0x04c6('0x42')]['id']){delete _0x4ef366['body']['id'];}return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x4ef366[_0x04c6('0x3d')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x392983,null))['then'](saveUpdates(_0x4ef366[_0x04c6('0x42')],null))[_0x04c6('0x1e')](respondWithResult(_0x392983,null))[_0x04c6('0x3c')](handleError(_0x392983,null));};exports[_0x04c6('0x1f')]=function(_0x5155aa,_0x192437){return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x5155aa[_0x04c6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x192437,null))[_0x04c6('0x1e')](removeEntity(_0x192437,null))[_0x04c6('0x3c')](handleError(_0x192437,null));};exports[_0x04c6('0x44')]=function(_0x489361,_0x3119f0){return db[_0x04c6('0x25')][_0x04c6('0x44')]()[_0x04c6('0x1e')](respondWithResult(_0x3119f0,null))[_0x04c6('0x3c')](handleError(_0x3119f0,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7800e4f..cf9564f 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 _0x4ed6=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x27b30f,_0x3949fe){var _0x3b563a=function(_0x3d8c66){while(--_0x3d8c66){_0x27b30f['push'](_0x27b30f['shift']());}};_0x3b563a(++_0x3949fe);}(_0x4ed6,0x76));var _0x64ed=function(_0x554c56,_0x35958f){_0x554c56=_0x554c56-0x0;var _0x50d470=_0x4ed6[_0x554c56];return _0x50d470;};'use strict';var _=require(_0x64ed('0x0'));var util=require(_0x64ed('0x1'));var logger=require('../../config/logger')(_0x64ed('0x2'));var moment=require(_0x64ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x64ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64ed('0x5'));var config=require(_0x64ed('0x6'));var attributes=require(_0x64ed('0x7'));module[_0x64ed('0x8')]=function(_0x1782c1,_0x1e1af1){return _0x1782c1[_0x64ed('0x9')](_0x64ed('0xa'),attributes,{'tableName':_0x64ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x64ed('0xc'),'collate':_0x64ed('0xd')});}; \ No newline at end of file +var _0x612c=['api','moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0x612c,0x1e0));var _0xc612=function(_0x3d85f0,_0xc4e3e2){_0x3d85f0=_0x3d85f0-0x0;var _0x59e8c7=_0x612c[_0x3d85f0];return _0x59e8c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc612('0x0'));var moment=require(_0xc612('0x1'));var BPromise=require('bluebird');var rp=require(_0xc612('0x2'));var fs=require('fs');var path=require(_0xc612('0x3'));var rimraf=require(_0xc612('0x4'));var config=require('../../config/environment');var attributes=require(_0xc612('0x5'));module[_0xc612('0x6')]=function(_0x409b28,_0x2917d5){return _0x409b28[_0xc612('0x7')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc612('0x8'),'collate':_0xc612('0x9')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 732aced..2b66868 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 _0x1478=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1478,0x74));var _0x8147=function(_0x302a64,_0x191bf6){_0x302a64=_0x302a64-0x0;var _0xc4c71e=_0x1478[_0x302a64];return _0xc4c71e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8147('0x0'));var BPromise=require('bluebird');var rs=require(_0x8147('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8147('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8147('0x3'))(_0x8147('0x4'));var config=require(_0x8147('0x5'));var jayson=require(_0x8147('0x6'));var client=jayson[_0x8147('0x7')][_0x8147('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5197ea,_0x451ff6,_0x403a55){return new BPromise(function(_0xde8c70,_0x440394){return client[_0x8147('0x9')](_0x5197ea,_0x403a55)[_0x8147('0xa')](function(_0x4bc7c7){logger['info'](_0x8147('0xb'),_0x451ff6,_0x8147('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x451ff6,_0x8147('0xc'),JSON[_0x8147('0xd')](_0x4bc7c7));if(_0x4bc7c7[_0x8147('0xe')]){if(_0x4bc7c7['error'][_0x8147('0xf')]===0x1f4){logger[_0x8147('0xe')](_0x8147('0xb'),_0x451ff6,_0x4bc7c7['error'][_0x8147('0x10')]);return _0x440394(_0x4bc7c7['error']['message']);}logger[_0x8147('0xe')](_0x8147('0xb'),_0x451ff6,_0x4bc7c7[_0x8147('0xe')][_0x8147('0x10')]);return _0xde8c70(_0x4bc7c7[_0x8147('0xe')][_0x8147('0x10')]);}else{logger[_0x8147('0x11')](_0x8147('0xb'),_0x451ff6,_0x8147('0xc'));_0xde8c70(_0x4bc7c7[_0x8147('0x12')][_0x8147('0x10')]);}})[_0x8147('0x13')](function(_0x432107){logger['error'](_0x8147('0xb'),_0x451ff6,_0x432107);_0x440394(_0x432107);});});} \ No newline at end of file +var _0x2180=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2180,0xfb));var _0x0218=function(_0x4d0662,_0x145963){_0x4d0662=_0x4d0662-0x0;var _0x6eea6d=_0x2180[_0x4d0662];return _0x6eea6d;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var moment=require('moment');var BPromise=require(_0x0218('0x2'));var rs=require(_0x0218('0x3'));var fs=require('fs');var Redis=require(_0x0218('0x4'));var db=require(_0x0218('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0218('0x6'))(_0x0218('0x7'));var config=require(_0x0218('0x8'));var jayson=require(_0x0218('0x9'));var client=jayson['client'][_0x0218('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40bc8d,_0x51eefd,_0x116a8f){return new BPromise(function(_0x55b7f6,_0x51bfc4){return client[_0x0218('0xb')](_0x40bc8d,_0x116a8f)[_0x0218('0xc')](function(_0x33bb4e){logger[_0x0218('0xd')](_0x0218('0xe'),_0x51eefd,_0x0218('0xf'));logger['debug'](_0x0218('0x10'),_0x51eefd,_0x0218('0xf'),JSON[_0x0218('0x11')](_0x33bb4e));if(_0x33bb4e[_0x0218('0x12')]){if(_0x33bb4e['error'][_0x0218('0x13')]===0x1f4){logger[_0x0218('0x12')](_0x0218('0xe'),_0x51eefd,_0x33bb4e[_0x0218('0x12')][_0x0218('0x14')]);return _0x51bfc4(_0x33bb4e[_0x0218('0x12')][_0x0218('0x14')]);}logger[_0x0218('0x12')](_0x0218('0xe'),_0x51eefd,_0x33bb4e[_0x0218('0x12')][_0x0218('0x14')]);return _0x55b7f6(_0x33bb4e[_0x0218('0x12')]['message']);}else{logger[_0x0218('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x51eefd,_0x0218('0xf'));_0x55b7f6(_0x33bb4e[_0x0218('0x15')][_0x0218('0x14')]);}})[_0x0218('0x16')](function(_0x285b2a){logger[_0x0218('0x12')](_0x0218('0xe'),_0x51eefd,_0x285b2a);_0x51bfc4(_0x285b2a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 7a0e566..ac2487a 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 _0x4c16=['../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5171e6,_0x4efdd8){var _0x258670=function(_0x3566c3){while(--_0x3566c3){_0x5171e6['push'](_0x5171e6['shift']());}};_0x258670(++_0x4efdd8);}(_0x4c16,0x18a));var _0x64c1=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0x4c16[_0x5a56cc];return _0x589caa;};'use strict';var multer=require(_0x64c1('0x0'));var util=require(_0x64c1('0x1'));var path=require(_0x64c1('0x2'));var timeout=require(_0x64c1('0x3'));var express=require(_0x64c1('0x4'));var router=express['Router']();var auth=require(_0x64c1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x64c1('0x6'));var controller=require(_0x64c1('0x7'));router[_0x64c1('0x8')]('/',auth[_0x64c1('0x9')](),controller[_0x64c1('0xa')]);router[_0x64c1('0x8')](_0x64c1('0xb'),auth[_0x64c1('0x9')](),controller[_0x64c1('0xc')]);router[_0x64c1('0x8')](_0x64c1('0xd'),auth['isAuthenticated'](),controller[_0x64c1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x64c1('0xf')]);router[_0x64c1('0x10')](_0x64c1('0xd'),auth[_0x64c1('0x9')](),controller[_0x64c1('0x11')]);router[_0x64c1('0x12')](_0x64c1('0xd'),auth[_0x64c1('0x9')](),controller[_0x64c1('0x13')]);module[_0x64c1('0x14')]=router; \ No newline at end of file +var _0x436d=['../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','update','delete','destroy','multer','util','path','Router','../../components/auth/service'];(function(_0x4d0d85,_0x3250d3){var _0x290a74=function(_0x4762db){while(--_0x4762db){_0x4d0d85['push'](_0x4d0d85['shift']());}};_0x290a74(++_0x3250d3);}(_0x436d,0x12d));var _0xd436=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x436d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd436('0x0'));var util=require(_0xd436('0x1'));var path=require(_0xd436('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd436('0x3')]();var auth=require(_0xd436('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd436('0x5'));var controller=require(_0xd436('0x6'));router['get']('/',auth[_0xd436('0x7')](),controller[_0xd436('0x8')]);router[_0xd436('0x9')](_0xd436('0xa'),auth[_0xd436('0x7')](),controller[_0xd436('0xb')]);router[_0xd436('0x9')](_0xd436('0xc'),auth[_0xd436('0x7')](),controller['show']);router[_0xd436('0xd')]('/',auth[_0xd436('0x7')](),controller[_0xd436('0xe')]);router['put'](_0xd436('0xc'),auth[_0xd436('0x7')](),controller[_0xd436('0xf')]);router[_0xd436('0x10')](_0xd436('0xc'),auth[_0xd436('0x7')](),controller[_0xd436('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a4136f3..7870519 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 _0x9022=['mouseOver','STRING','INTEGER','sequelize','timeout'];(function(_0x34bcbf,_0x529caf){var _0x4951ee=function(_0x22734c){while(--_0x22734c){_0x34bcbf['push'](_0x34bcbf['shift']());}};_0x4951ee(++_0x529caf);}(_0x9022,0x125));var _0x2902=function(_0x582689,_0x20c7b4){_0x582689=_0x582689-0x0;var _0x1041ca=_0x9022[_0x582689];return _0x1041ca;};'use strict';var Sequelize=require(_0x2902('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x2902('0x1')),'defaultValue':_0x2902('0x2')},'selector':{'type':Sequelize[_0x2902('0x3')]},'timeout':{'type':Sequelize[_0x2902('0x4')]}}; \ No newline at end of file +var _0x2d2e=['mouseOver','timeout','STRING'];(function(_0x4eb02b,_0x502ac2){var _0x545b18=function(_0x3c302c){while(--_0x3c302c){_0x4eb02b['push'](_0x4eb02b['shift']());}};_0x545b18(++_0x502ac2);}(_0x2d2e,0x14c));var _0xe2d2=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x2d2e[_0x59162a];return _0x35e50d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe2d2('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe2d2('0x1'),_0xe2d2('0x2')),'defaultValue':_0xe2d2('0x1')},'selector':{'type':Sequelize[_0xe2d2('0x0')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d482d5c..cc34805 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 _0x70e0=['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','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0xe7b87d,_0x230ee6){var _0x4a86ea=function(_0x89ff74){while(--_0x89ff74){_0xe7b87d['push'](_0xe7b87d['shift']());}};_0x4a86ea(++_0x230ee6);}(_0x70e0,0x17b));var _0x070e=function(_0x4770b5,_0x352a49){_0x4770b5=_0x4770b5-0x0;var _0x818eaf=_0x70e0[_0x4770b5];return _0x818eaf;};'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={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file +var _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x33d798,_0x4f9882){var _0xc20ea=function(_0x52ebff){while(--_0x52ebff){_0x33d798['push'](_0x33d798['shift']());}};_0xc20ea(++_0x4f9882);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ccbde02..f6be744 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 _0x7177=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x208f80,_0x2522c6){var _0x71c40c=function(_0x555c9a){while(--_0x555c9a){_0x208f80['push'](_0x208f80['shift']());}};_0x71c40c(++_0x2522c6);}(_0x7177,0xf7));var _0x7717=function(_0x114dbf,_0x3dd101){_0x114dbf=_0x114dbf-0x0;var _0x5953c9=_0x7177[_0x114dbf];return _0x5953c9;};'use strict';var _=require(_0x7717('0x0'));var util=require(_0x7717('0x1'));var logger=require('../../config/logger')(_0x7717('0x2'));var moment=require('moment');var BPromise=require(_0x7717('0x3'));var rp=require(_0x7717('0x4'));var fs=require('fs');var path=require(_0x7717('0x5'));var rimraf=require(_0x7717('0x6'));var config=require(_0x7717('0x7'));var attributes=require(_0x7717('0x8'));module[_0x7717('0x9')]=function(_0x2805b1,_0x2d0ce1){return _0x2805b1[_0x7717('0xa')](_0x7717('0xb'),attributes,{'tableName':_0x7717('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x944c=['./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x4a5eb9,_0x2e1010){var _0x2d00c7=function(_0x48ff32){while(--_0x48ff32){_0x4a5eb9['push'](_0x4a5eb9['shift']());}};_0x2d00c7(++_0x2e1010);}(_0x944c,0x66));var _0xc944=function(_0x56a4a4,_0x2e15e5){_0x56a4a4=_0x56a4a4-0x0;var _0x16d910=_0x944c[_0x56a4a4];return _0x16d910;};'use strict';var _=require('lodash');var util=require(_0xc944('0x0'));var logger=require(_0xc944('0x1'))('api');var moment=require(_0xc944('0x2'));var BPromise=require(_0xc944('0x3'));var rp=require(_0xc944('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc944('0x5'));var attributes=require(_0xc944('0x6'));module['exports']=function(_0x292133,_0x49a03c){return _0x292133['define'](_0xc944('0x7'),attributes,{'tableName':_0xc944('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ad19dab..d908b58 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 _0x5151=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3759f0,_0x2cc445){var _0x4252b5=function(_0x215baa){while(--_0x215baa){_0x3759f0['push'](_0x3759f0['shift']());}};_0x4252b5(++_0x2cc445);}(_0x5151,0x113));var _0x1515=function(_0x37550d,_0x44f31c){_0x37550d=_0x37550d-0x0;var _0x170ff4=_0x5151[_0x37550d];return _0x170ff4;};'use strict';var _=require(_0x1515('0x0'));var util=require(_0x1515('0x1'));var moment=require(_0x1515('0x2'));var BPromise=require(_0x1515('0x3'));var rs=require(_0x1515('0x4'));var fs=require('fs');var Redis=require(_0x1515('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1515('0x6'))(_0x1515('0x7'));var config=require(_0x1515('0x8'));var jayson=require(_0x1515('0x9'));var client=jayson[_0x1515('0xa')][_0x1515('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x356a6d,_0x384822,_0x40cbbd){return new BPromise(function(_0x951f72,_0xa1bfaf){return client['request'](_0x356a6d,_0x40cbbd)['then'](function(_0x2524f2){logger[_0x1515('0xc')](_0x1515('0xd'),_0x384822,_0x1515('0xe'));logger[_0x1515('0xf')](_0x1515('0x10'),_0x384822,'request\x20sent',JSON[_0x1515('0x11')](_0x2524f2));if(_0x2524f2[_0x1515('0x12')]){if(_0x2524f2['error'][_0x1515('0x13')]===0x1f4){logger[_0x1515('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x384822,_0x2524f2[_0x1515('0x12')][_0x1515('0x14')]);return _0xa1bfaf(_0x2524f2['error'][_0x1515('0x14')]);}logger[_0x1515('0x12')](_0x1515('0xd'),_0x384822,_0x2524f2[_0x1515('0x12')]['message']);return _0x951f72(_0x2524f2[_0x1515('0x12')][_0x1515('0x14')]);}else{logger[_0x1515('0xc')](_0x1515('0xd'),_0x384822,_0x1515('0xe'));_0x951f72(_0x2524f2[_0x1515('0x15')][_0x1515('0x14')]);}})[_0x1515('0x16')](function(_0x25f29f){logger[_0x1515('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x384822,_0x25f29f);_0xa1bfaf(_0x25f29f);});});} \ No newline at end of file +var _0x1698=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','randomstring','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0xcb7cc8,_0x5dd374){var _0x3d2dc3=function(_0x26e3d4){while(--_0x26e3d4){_0xcb7cc8['push'](_0xcb7cc8['shift']());}};_0x3d2dc3(++_0x5dd374);}(_0x1698,0x1e7));var _0x8169=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x1698[_0x257495];return _0x3849aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8169('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8169('0x1'))(_0x8169('0x2'));var config=require('../../config/environment');var jayson=require(_0x8169('0x3'));var client=jayson[_0x8169('0x4')][_0x8169('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5bc73a,_0x82a8e3,_0x1766b7){return new BPromise(function(_0x43d77f,_0xb56033){return client['request'](_0x5bc73a,_0x1766b7)['then'](function(_0x74bf01){logger[_0x8169('0x6')]('ChatProactiveAction,\x20%s,\x20%s',_0x82a8e3,_0x8169('0x7'));logger[_0x8169('0x8')](_0x8169('0x9'),_0x82a8e3,'request\x20sent',JSON['stringify'](_0x74bf01));if(_0x74bf01[_0x8169('0xa')]){if(_0x74bf01[_0x8169('0xa')][_0x8169('0xb')]===0x1f4){logger[_0x8169('0xa')](_0x8169('0xc'),_0x82a8e3,_0x74bf01[_0x8169('0xa')][_0x8169('0xd')]);return _0xb56033(_0x74bf01[_0x8169('0xa')][_0x8169('0xd')]);}logger[_0x8169('0xa')](_0x8169('0xc'),_0x82a8e3,_0x74bf01[_0x8169('0xa')]['message']);return _0x43d77f(_0x74bf01[_0x8169('0xa')][_0x8169('0xd')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x82a8e3,_0x8169('0x7'));_0x43d77f(_0x74bf01[_0x8169('0xe')][_0x8169('0xd')]);}})[_0x8169('0xf')](function(_0x5cdf20){logger[_0x8169('0xa')](_0x8169('0xc'),_0x82a8e3,_0x5cdf20);_0xb56033(_0x5cdf20);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 605c5e8..d84f8b6 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 _0xbcee=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','create','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x457b6c,_0x2b3821){var _0x2f8b58=function(_0x1a597c){while(--_0x1a597c){_0x457b6c['push'](_0x457b6c['shift']());}};_0x2f8b58(++_0x2b3821);}(_0xbcee,0xbe));var _0xebce=function(_0x375927,_0x5060d7){_0x375927=_0x375927-0x0;var _0x30337c=_0xbcee[_0x375927];return _0x30337c;};'use strict';var multer=require('multer');var util=require(_0xebce('0x0'));var path=require('path');var timeout=require(_0xebce('0x1'));var express=require(_0xebce('0x2'));var router=express[_0xebce('0x3')]();var auth=require(_0xebce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xebce('0x5'));var controller=require(_0xebce('0x6'));router[_0xebce('0x7')](_0xebce('0x8'),auth['isAuthenticated'](),controller[_0xebce('0x9')]);router['post']('/',auth[_0xebce('0xa')](),controller[_0xebce('0xb')]);router['put'](_0xebce('0x8'),auth[_0xebce('0xa')](),controller['update']);router[_0xebce('0xc')](_0xebce('0x8'),auth['isAuthenticated'](),controller[_0xebce('0xd')]);module[_0xebce('0xe')]=router; \ No newline at end of file +var _0x165d=['post','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show'];(function(_0x3eaad6,_0x3ae162){var _0x470f24=function(_0x7f6c24){while(--_0x7f6c24){_0x3eaad6['push'](_0x3eaad6['shift']());}};_0x470f24(++_0x3ae162);}(_0x165d,0x14a));var _0xd165=function(_0x2beb4d,_0xa7d7c5){_0x2beb4d=_0x2beb4d-0x0;var _0x40fade=_0x165d[_0x2beb4d];return _0x40fade;};'use strict';var multer=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var path=require(_0xd165('0x2'));var timeout=require(_0xd165('0x3'));var express=require(_0xd165('0x4'));var router=express[_0xd165('0x5')]();var auth=require(_0xd165('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd165('0x7'));var controller=require(_0xd165('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0xd165('0x9')]);router[_0xd165('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd165('0xb')](_0xd165('0xc'),auth[_0xd165('0xd')](),controller[_0xd165('0xe')]);router[_0xd165('0xf')](_0xd165('0xc'),auth[_0xd165('0xd')](),controller[_0xd165('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8a2c3ed..3354a0a 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 _0x5fc1=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x392dbc,_0x4d31cf){var _0x119302=function(_0x250580){while(--_0x250580){_0x392dbc['push'](_0x392dbc['shift']());}};_0x119302(++_0x4d31cf);}(_0x5fc1,0x6c));var _0x15fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fc1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x15fc('0x0'));module[_0x15fc('0x1')]={'name':{'type':Sequelize[_0x15fc('0x2')],'unique':_0x15fc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x15fc('0x2')]},'timeout':{'type':Sequelize[_0x15fc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15fc('0x5')](_0x15fc('0x6'),'beepall',_0x15fc('0x7'))}}; \ No newline at end of file +var _0xc0d6=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1daaf4,_0x5f05c4){var _0xd26375=function(_0x481ff4){while(--_0x481ff4){_0x1daaf4['push'](_0x1daaf4['shift']());}};_0xd26375(++_0x5f05c4);}(_0xc0d6,0xbb));var _0x6c0d=function(_0x5b526b,_0x1157da){_0x5b526b=_0x5b526b-0x0;var _0x591549=_0xc0d6[_0x5b526b];return _0x591549;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c0d('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c0d('0x0')]},'timeout':{'type':Sequelize[_0x6c0d('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6c0d('0x2')](_0x6c0d('0x3'),_0x6c0d('0x4'),_0x6c0d('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 5b038f6..7917d27 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 _0x1ae0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','options','User','agent','chatPause','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:save','userChatQueue:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','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','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','end','stack','name','send','map','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','count','includeAll','ChatQueue','findAll','rows','show','rawAttributes','intersection','include','create','body','user'];(function(_0x4c1c6a,_0x4c1ef5){var _0x59a9df=function(_0x6825f8){while(--_0x6825f8){_0x4c1c6a['push'](_0x4c1c6a['shift']());}};_0x59a9df(++_0x4c1ef5);}(_0x1ae0,0x15b));var _0x01ae=function(_0x46aaff,_0x439b0a){_0x46aaff=_0x46aaff-0x0;var _0x13abbf=_0x1ae0[_0x46aaff];return _0x13abbf;};'use strict';var pdf=require(_0x01ae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x01ae('0x1'));var zipdir=require(_0x01ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01ae('0x3'));var moment=require(_0x01ae('0x4'));var BPromise=require(_0x01ae('0x5'));var Mustache=require(_0x01ae('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x01ae('0x7'));var ejs=require(_0x01ae('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01ae('0x9'));var crypto=require(_0x01ae('0xa'));var jsforce=require(_0x01ae('0xb'));var deskjs=require(_0x01ae('0xc'));var toCsv=require(_0x01ae('0x7'));var querystring=require(_0x01ae('0xd'));var Papa=require('papaparse');var Redis=require(_0x01ae('0xe'));var authService=require(_0x01ae('0xf'));var qs=require(_0x01ae('0x10'));var as=require(_0x01ae('0x11'));var hardwareService=require(_0x01ae('0x12'));var logger=require(_0x01ae('0x13'))(_0x01ae('0x14'));var utils=require(_0x01ae('0x15'));var config=require(_0x01ae('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x01ae('0x17')](config['redis'],{'host':_0x01ae('0x18'),'port':0x18eb});var socket=require(_0x01ae('0x19'))(new Redis(config[_0x01ae('0x1a')]));require(_0x01ae('0x1b'))['register'](socket);var jayson=require(_0x01ae('0x1c'));var client=jayson[_0x01ae('0x1d')][_0x01ae('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x53f045,_0x66044,_0x240d26){if(_0x240d26){var _0x49683d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49683d[_0x01ae('0x1f')](_0x66044)){return _0x53f045;}else{throw new db['Sequelize'][(_0x01ae('0x20'))](_0x01ae('0x21'));}}else{return _0x53f045;}}function respondWithRpcPromise(_0x1c51c9,_0x52f38e,_0x433fde,_0x2efb56){return new BPromise(function(_0x380b5f,_0x7b7ce2){var _0x25442c=_0x2efb56||client;return _0x25442c[_0x01ae('0x22')](_0x1c51c9,_0x433fde)[_0x01ae('0x23')](function(_0x554367){logger[_0x01ae('0x24')](_0x01ae('0x25'),_0x52f38e,'request\x20sent');logger[_0x01ae('0x26')](_0x01ae('0x27'),_0x52f38e,_0x01ae('0x28'),JSON[_0x01ae('0x29')](_0x554367));if(_0x554367[_0x01ae('0x2a')]){if(_0x554367[_0x01ae('0x2a')][_0x01ae('0x2b')]===0x1f4){logger[_0x01ae('0x2a')](_0x01ae('0x25'),_0x52f38e,_0x554367[_0x01ae('0x2a')]['message']);return _0x7b7ce2(_0x554367[_0x01ae('0x2a')]['message']);}logger[_0x01ae('0x2a')](_0x01ae('0x25'),_0x52f38e,_0x554367[_0x01ae('0x2a')][_0x01ae('0x2c')]);return _0x380b5f(_0x554367[_0x01ae('0x2a')][_0x01ae('0x2c')]);}else{logger[_0x01ae('0x24')]('ChatQueue,\x20%s,\x20%s',_0x52f38e,_0x01ae('0x28'));_0x380b5f(_0x554367[_0x01ae('0x2d')][_0x01ae('0x2c')]);}})[_0x01ae('0x2e')](function(_0x28e41a){logger[_0x01ae('0x2a')](_0x01ae('0x25'),_0x52f38e,_0x28e41a);_0x7b7ce2(_0x28e41a);});});}function respondWithStatusCode(_0x30b817,_0x13e989){_0x13e989=_0x13e989||0xcc;return function(_0x191ef9){if(_0x191ef9){return _0x30b817[_0x01ae('0x2f')](_0x13e989);}return _0x30b817[_0x01ae('0x30')](_0x13e989)['end']();};}function respondWithResult(_0x42b840,_0x5e7c92){_0x5e7c92=_0x5e7c92||0xc8;return function(_0x52783e){if(_0x52783e){return _0x42b840[_0x01ae('0x30')](_0x5e7c92)[_0x01ae('0x31')](_0x52783e);}};}function respondWithFilteredResult(_0x476851,_0x5927cb){return function(_0x517bd2){if(_0x517bd2){var _0x40b1f6=_0x517bd2['count'],_0x251395=_0x5927cb[_0x01ae('0x32')],_0x52be55=_0x5927cb[_0x01ae('0x32')]+_0x5927cb[_0x01ae('0x33')],_0x2b21b3;if(_0x52be55>=_0x40b1f6){_0x52be55=_0x40b1f6;_0x2b21b3=0xc8;}else{_0x2b21b3=0xce;}_0x476851['status'](_0x2b21b3);return _0x476851[_0x01ae('0x34')]('Content-Range',_0x251395+'-'+_0x52be55+'/'+_0x40b1f6)[_0x01ae('0x31')](_0x517bd2);}return null;};}function patchUpdates(_0x5b6e51){return function(_0x4bf723){try{jsonpatch[_0x01ae('0x35')](_0x4bf723,_0x5b6e51,!![]);}catch(_0x9cff62){return BPromise[_0x01ae('0x36')](_0x9cff62);}return _0x4bf723[_0x01ae('0x37')]();};}function saveUpdates(_0x588a81,_0x1b1f6d){return function(_0x43f701){if(_0x43f701){return _0x43f701[_0x01ae('0x38')](_0x588a81)[_0x01ae('0x23')](function(_0x47fe81){return _0x47fe81;});}return null;};}function removeEntity(_0x57f807,_0x44f084){return function(_0x53a948){if(_0x53a948){return _0x53a948['destroy']()[_0x01ae('0x23')](function(){var _0xfd698e=_0x53a948[_0x01ae('0x39')]({'plain':!![]});var _0x55e974=_0x01ae('0x3a');return db[_0x01ae('0x3b')][_0x01ae('0x3c')]({'where':{'type':_0x55e974,'resourceId':_0xfd698e['id']}})['then'](function(){return _0x53a948;});})[_0x01ae('0x23')](function(){_0x57f807[_0x01ae('0x30')](0xcc)[_0x01ae('0x3d')]();});}};}function handleEntityNotFound(_0x2e88ac,_0x51c422){return function(_0x1e145c){if(!_0x1e145c){_0x2e88ac[_0x01ae('0x2f')](0x194);}return _0x1e145c;};}function handleError(_0x398381,_0x534f7e){_0x534f7e=_0x534f7e||0x1f4;return function(_0x1efdfb){logger[_0x01ae('0x2a')](_0x1efdfb[_0x01ae('0x3e')]);if(_0x1efdfb[_0x01ae('0x3f')]){delete _0x1efdfb[_0x01ae('0x3f')];}_0x398381[_0x01ae('0x30')](_0x534f7e)[_0x01ae('0x40')](_0x1efdfb);};}exports['index']=function(_0xfba725,_0x274d4f){var _0x1a9da3={},_0x135448={},_0x4a316a={'count':0x0,'rows':[]};var _0x14ab01=_[_0x01ae('0x41')](db['ChatQueue']['rawAttributes'],function(_0x357440){return{'name':_0x357440[_0x01ae('0x42')],'type':_0x357440[_0x01ae('0x43')][_0x01ae('0x44')]};});_0x135448[_0x01ae('0x45')]=_[_0x01ae('0x41')](_0x14ab01,_0x01ae('0x3f'));_0x135448[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0xfba725[_0x01ae('0x46')]);_0x135448['filters']=_['intersection'](_0x135448[_0x01ae('0x45')],_0x135448['query']);_0x1a9da3['attributes']=_['intersection'](_0x135448[_0x01ae('0x45')],qs['fields'](_0xfba725['query'][_0x01ae('0x48')]));_0x1a9da3[_0x01ae('0x49')]=_0x1a9da3['attributes'][_0x01ae('0x4a')]?_0x1a9da3[_0x01ae('0x49')]:_0x135448[_0x01ae('0x45')];if(!_0xfba725[_0x01ae('0x46')][_0x01ae('0x4b')](_0x01ae('0x4c'))){_0x1a9da3['limit']=qs[_0x01ae('0x33')](_0xfba725[_0x01ae('0x46')]['limit']);_0x1a9da3['offset']=qs[_0x01ae('0x32')](_0xfba725[_0x01ae('0x46')][_0x01ae('0x32')]);}_0x1a9da3[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0xfba725[_0x01ae('0x46')][_0x01ae('0x4e')]);_0x1a9da3['where']=qs['filters'](_[_0x01ae('0x4f')](_0xfba725[_0x01ae('0x46')],_0x135448[_0x01ae('0x50')]),_0x14ab01);if(_0xfba725[_0x01ae('0x46')]['filter']){_0x1a9da3[_0x01ae('0x51')]=_[_0x01ae('0x52')](_0x1a9da3[_0x01ae('0x51')],{'$or':_[_0x01ae('0x41')](_0x14ab01,function(_0x13f472){if(_0x13f472[_0x01ae('0x43')]!==_0x01ae('0x53')){var _0x2d35af={};_0x2d35af[_0x13f472[_0x01ae('0x3f')]]={'$like':'%'+_0xfba725['query'][_0x01ae('0x54')]+'%'};return _0x2d35af;}})});}_0x1a9da3=_['merge']({},_0x1a9da3,_0xfba725['options']);var _0x1dfb07={'where':_0x1a9da3[_0x01ae('0x51')]};return db['ChatQueue'][_0x01ae('0x55')](_0x1dfb07)[_0x01ae('0x23')](function(_0x38cebd){_0x4a316a['count']=_0x38cebd;if(_0xfba725[_0x01ae('0x46')][_0x01ae('0x56')]){_0x1a9da3['include']=[{'all':!![]}];}return db[_0x01ae('0x57')][_0x01ae('0x58')](_0x1a9da3);})[_0x01ae('0x23')](function(_0x2c7987){_0x4a316a[_0x01ae('0x59')]=_0x2c7987;return _0x4a316a;})['then'](respondWithFilteredResult(_0x274d4f,_0x1a9da3))[_0x01ae('0x2e')](handleError(_0x274d4f,null));};exports[_0x01ae('0x5a')]=function(_0x1a7645,_0x442428){var _0x782fcc={'raw':!![],'where':{'id':_0x1a7645['params']['id']}},_0x142b42={};_0x142b42[_0x01ae('0x45')]=_[_0x01ae('0x47')](db['ChatQueue'][_0x01ae('0x5b')]);_0x142b42[_0x01ae('0x46')]=_['keys'](_0x1a7645[_0x01ae('0x46')]);_0x142b42[_0x01ae('0x50')]=_[_0x01ae('0x5c')](_0x142b42['model'],_0x142b42[_0x01ae('0x46')]);_0x782fcc[_0x01ae('0x49')]=_[_0x01ae('0x5c')](_0x142b42[_0x01ae('0x45')],qs[_0x01ae('0x48')](_0x1a7645[_0x01ae('0x46')]['fields']));_0x782fcc['attributes']=_0x782fcc['attributes']['length']?_0x782fcc['attributes']:_0x142b42[_0x01ae('0x45')];if(_0x1a7645[_0x01ae('0x46')][_0x01ae('0x56')]){_0x782fcc[_0x01ae('0x5d')]=[{'all':!![]}];}_0x782fcc=_[_0x01ae('0x52')]({},_0x782fcc,_0x1a7645['options']);return db['ChatQueue']['find'](_0x782fcc)[_0x01ae('0x23')](handleEntityNotFound(_0x442428,null))['then'](respondWithResult(_0x442428,null))[_0x01ae('0x2e')](handleError(_0x442428,null));};exports[_0x01ae('0x5e')]=function(_0x3a8a3d,_0x1b57e3){return db[_0x01ae('0x57')][_0x01ae('0x5e')](_0x3a8a3d[_0x01ae('0x5f')],{})[_0x01ae('0x23')](function(_0x1553a4){var _0x27c0b1=_0x3a8a3d[_0x01ae('0x60')][_0x01ae('0x39')]({'plain':!![]});if(!_0x27c0b1)throw new Error(_0x01ae('0x61'));if(_0x27c0b1['role']==='user'){var _0x14a729=_0x1553a4[_0x01ae('0x39')]({'plain':!![]});var _0x1f58ed='ChatQueues';return db['UserProfileSection'][_0x01ae('0x62')]({'where':{'name':_0x1f58ed,'userProfileId':_0x27c0b1[_0x01ae('0x63')]},'raw':!![]})['then'](function(_0x4f7389){if(_0x4f7389&&_0x4f7389['autoAssociation']===0x0){return db['UserProfileResource'][_0x01ae('0x5e')]({'name':_0x14a729['name'],'resourceId':_0x14a729['id'],'type':_0x4f7389['name'],'sectionId':_0x4f7389['id']},{})[_0x01ae('0x23')](function(){return _0x1553a4;});}else{return _0x1553a4;}})[_0x01ae('0x2e')](function(_0x350586){logger[_0x01ae('0x2a')](_0x01ae('0x64'),_0x350586);throw _0x350586;});}return _0x1553a4;})['then'](respondWithResult(_0x1b57e3,0xc9))[_0x01ae('0x2e')](handleError(_0x1b57e3,null));};exports[_0x01ae('0x38')]=function(_0x319f5e,_0x569f95){if(_0x319f5e[_0x01ae('0x5f')]['id']){delete _0x319f5e[_0x01ae('0x5f')]['id'];}return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x319f5e[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x569f95,null))[_0x01ae('0x23')](saveUpdates(_0x319f5e[_0x01ae('0x5f')],null))[_0x01ae('0x23')](respondWithResult(_0x569f95,null))[_0x01ae('0x2e')](handleError(_0x569f95,null));};exports[_0x01ae('0x3c')]=function(_0x31e092,_0xea1b4e){return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x31e092[_0x01ae('0x65')]['id']}})['then'](handleEntityNotFound(_0xea1b4e,null))[_0x01ae('0x23')](removeEntity(_0xea1b4e,null))['catch'](handleError(_0xea1b4e,null));};exports[_0x01ae('0x66')]=function(_0x40236a,_0x362877){return db[_0x01ae('0x57')][_0x01ae('0x66')]()[_0x01ae('0x23')](respondWithResult(_0x362877,null))['catch'](handleError(_0x362877,null));};exports['getMembers']=function(_0x2575ba,_0x14c502,_0x35e5ba){var _0x1c84a6={'raw':!![],'where':{}},_0x25a372={},_0x11d4ca;return db[_0x01ae('0x57')][_0x01ae('0x67')]({'where':{'id':_0x2575ba[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x14c502,null))['then'](function(_0x4c63ad){if(_0x4c63ad){_0x11d4ca=_0x4c63ad[_0x01ae('0x39')]({'plain':!![]});_0x25a372[_0x01ae('0x45')]=_[_0x01ae('0x47')](db[_0x01ae('0x68')][_0x01ae('0x5b')]);_0x25a372[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0x2575ba['query']);_0x25a372[_0x01ae('0x50')]=_['intersection'](_0x25a372[_0x01ae('0x45')],_0x25a372[_0x01ae('0x46')]);_0x1c84a6[_0x01ae('0x49')]=_[_0x01ae('0x5c')](_0x25a372['model'],qs['fields'](_0x2575ba['query']['fields']));_0x1c84a6[_0x01ae('0x49')]=_0x1c84a6[_0x01ae('0x49')][_0x01ae('0x4a')]?_0x1c84a6['attributes']:_0x25a372[_0x01ae('0x45')];if(!_0x2575ba[_0x01ae('0x46')][_0x01ae('0x4b')](_0x01ae('0x4c'))){_0x1c84a6[_0x01ae('0x33')]=qs[_0x01ae('0x33')](_0x2575ba[_0x01ae('0x46')][_0x01ae('0x33')]);_0x1c84a6[_0x01ae('0x32')]=qs[_0x01ae('0x32')](_0x2575ba[_0x01ae('0x46')][_0x01ae('0x32')]);}_0x1c84a6[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0x2575ba[_0x01ae('0x46')][_0x01ae('0x4e')]);_0x1c84a6[_0x01ae('0x51')]=qs[_0x01ae('0x50')](_[_0x01ae('0x4f')](_0x2575ba[_0x01ae('0x46')],_0x25a372[_0x01ae('0x50')]));_0x1c84a6['where']['ChatQueueId']=_0x4c63ad['id'];if(_0x2575ba[_0x01ae('0x46')]['filter']){_0x1c84a6[_0x01ae('0x51')]=_['merge'](_0x1c84a6[_0x01ae('0x51')],{'$or':_[_0x01ae('0x41')](_0x1c84a6[_0x01ae('0x49')],function(_0x4d9488){var _0x2c87af={};_0x2c87af[_0x4d9488]={'$like':'%'+_0x2575ba[_0x01ae('0x46')]['filter']+'%'};return _0x2c87af;})});}_0x1c84a6=_[_0x01ae('0x52')]({},_0x1c84a6,_0x2575ba[_0x01ae('0x69')]);return db[_0x01ae('0x68')][_0x01ae('0x58')](_0x1c84a6);}})[_0x01ae('0x23')](function(_0x2714ee){if(_0x2714ee){return db[_0x01ae('0x6a')]['findAndCountAll']({'where':{'id':_[_0x01ae('0x41')](_0x2714ee,'UserId'),'role':_0x01ae('0x6b')},'attributes':['id','name',_0x01ae('0x6c'),'updatedAt','createdAt']});}})[_0x01ae('0x23')](function(_0x3fb4ca){if(_0x3fb4ca){return{'count':_0x3fb4ca[_0x01ae('0x55')],'rows':_[_0x01ae('0x41')](_0x3fb4ca[_0x01ae('0x59')],function(_0x31aa25){return{'membername':_0x31aa25[_0x01ae('0x3f')],'UserId':_0x31aa25['id'],'queue_name':_0x11d4ca['name'],'ChatQueueId':_0x11d4ca['id'],'interface':util['format']('%s/%s',_0x01ae('0x6d'),_0x31aa25[_0x01ae('0x3f')]),'penalty':0x0,'paused':_0x31aa25[_0x01ae('0x6c')],'createdAt':_0x31aa25[_0x01ae('0x6e')],'updatedAt':_0x31aa25[_0x01ae('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x01ae('0x23')](respondWithFilteredResult(_0x14c502,_0x1c84a6))[_0x01ae('0x2e')](handleError(_0x14c502,null));};exports[_0x01ae('0x70')]=function(_0x36099e,_0x463741,_0x3f129e){var _0x49d11a={};var _0x54d931={};var _0x1aac4e;var _0x48915c;return db['ChatQueue'][_0x01ae('0x67')]({'where':{'id':_0x36099e[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x463741,null))[_0x01ae('0x23')](function(_0x5c02e4){if(_0x5c02e4){_0x1aac4e=_0x5c02e4;_0x54d931[_0x01ae('0x45')]=_[_0x01ae('0x47')](db[_0x01ae('0x71')][_0x01ae('0x5b')]);_0x54d931[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0x36099e[_0x01ae('0x46')]);_0x54d931[_0x01ae('0x50')]=_['intersection'](_0x54d931[_0x01ae('0x45')],_0x54d931[_0x01ae('0x46')]);_0x49d11a[_0x01ae('0x49')]=_[_0x01ae('0x5c')](_0x54d931['model'],qs[_0x01ae('0x48')](_0x36099e['query'][_0x01ae('0x48')]));_0x49d11a['attributes']=_0x49d11a['attributes']['length']?_0x49d11a[_0x01ae('0x49')]:_0x54d931[_0x01ae('0x45')];_0x49d11a[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0x36099e[_0x01ae('0x46')][_0x01ae('0x4e')]);_0x49d11a[_0x01ae('0x51')]=qs['filters'](_[_0x01ae('0x4f')](_0x36099e[_0x01ae('0x46')],_0x54d931['filters']));if(_0x36099e[_0x01ae('0x46')][_0x01ae('0x54')]){_0x49d11a['where']=_[_0x01ae('0x52')](_0x49d11a[_0x01ae('0x51')],{'$or':_['map'](_0x49d11a[_0x01ae('0x49')],function(_0x1682b9){var _0x388db8={};_0x388db8[_0x1682b9]={'$like':'%'+_0x36099e['query'][_0x01ae('0x54')]+'%'};return _0x388db8;})});}_0x49d11a=_['merge']({},_0x49d11a,_0x36099e['options']);return _0x1aac4e[_0x01ae('0x70')](_0x49d11a);}})[_0x01ae('0x23')](function(_0x26a0c6){if(_0x26a0c6){_0x48915c=_0x26a0c6[_0x01ae('0x4a')];if(!_0x36099e['query'][_0x01ae('0x4b')]('nolimit')){_0x49d11a[_0x01ae('0x33')]=qs[_0x01ae('0x33')](_0x36099e['query'][_0x01ae('0x33')]);_0x49d11a['offset']=qs[_0x01ae('0x32')](_0x36099e[_0x01ae('0x46')][_0x01ae('0x32')]);}return _0x1aac4e['getTeams'](_0x49d11a);}})['then'](function(_0x271ce5){if(_0x271ce5){return _0x271ce5?{'count':_0x48915c,'rows':_0x271ce5}:null;}})[_0x01ae('0x23')](respondWithResult(_0x463741,null))['catch'](handleError(_0x463741,null));};exports[_0x01ae('0x72')]=function(_0x40abf3,_0x3b18d6,_0x4c02a3){var _0x1c3ec3=_0x40abf3['body'][_0x01ae('0x73')];return db[_0x01ae('0x71')][_0x01ae('0x58')]({'where':{'id':_0x1c3ec3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x01ae('0x74'),'attributes':['id','name','online',_0x01ae('0x75'),_0x01ae('0x76')],'raw':!![]}]})[_0x01ae('0x23')](function(_0x330159){if(_0x330159){var _0x2c0a0c=_[_0x01ae('0x77')](_0x330159,function(_0x48c375){var _0x51279a=_0x48c375[_0x01ae('0x39')]({'plain':!![]});return _0x51279a[_0x01ae('0x74')];});return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x40abf3[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](function(_0x4638c3){return db[_0x01ae('0x78')][_0x01ae('0x79')](function(_0x41d970){return _0x4638c3['addTeams'](_0x1c3ec3,{'transaction':_0x41d970})['then'](function(){return BPromise[_0x01ae('0x7a')](_0x2c0a0c,function(_0x2a5813){return db[_0x01ae('0x68')][_0x01ae('0x7b')]({'where':{'UserId':_0x2a5813['id'],'ChatQueueId':_0x40abf3[_0x01ae('0x65')]['id']},'transaction':_0x41d970});});})[_0x01ae('0x23')](function(){_0x2c0a0c[_0x01ae('0x7c')](function(_0x5c0eb8){socket[_0x01ae('0x7d')]('userChatQueue:save',{'UserId':_0x5c0eb8['id'],'ChatQueueId':_0x4638c3['id']});});});});});}})[_0x01ae('0x23')](respondWithStatusCode(_0x3b18d6,null))[_0x01ae('0x2e')](handleError(_0x3b18d6,null));};exports[_0x01ae('0x7e')]=function(_0x1901ab,_0x3d15ec,_0x285437){return db[_0x01ae('0x71')][_0x01ae('0x58')]({'where':{'id':_0x1901ab[_0x01ae('0x46')][_0x01ae('0x73')]},'attributes':['id'],'include':[{'model':db[_0x01ae('0x6a')],'as':_0x01ae('0x74'),'attributes':['id'],'raw':!![]}]})[_0x01ae('0x23')](handleEntityNotFound(_0x3d15ec,null))[_0x01ae('0x23')](function(_0x4c5118){var _0x552e07=_[_0x01ae('0x41')](_0x4c5118,'id');var _0x1389e4=[];var _0x2cd419=[];var _0x224109=squel['select']();_0x224109['field'](_0x01ae('0x7f'))[_0x01ae('0x80')]('team_has_chat_queues','tq')[_0x01ae('0x81')](_0x01ae('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x01ae('0x51')]('ChatQueueId\x20=\x20?',_0x1901ab[_0x01ae('0x65')]['id']);for(var _0x1e5c8f=0x0;_0x1e5c8f<_0x4c5118[_0x01ae('0x4a')];_0x1e5c8f+=0x1){let _0x56c1c4=_0x4c5118[_0x1e5c8f];for(var _0x1ebf46=0x0;_0x1ebf46<_0x56c1c4[_0x01ae('0x74')][_0x01ae('0x4a')];_0x1ebf46+=0x1){let _0x34b4de=_0x56c1c4[_0x01ae('0x74')][_0x1ebf46];var _0x11621e=_0x224109[_0x01ae('0x83')]();_0x11621e['where'](_0x01ae('0x84'),_0x34b4de['id']);_0x2cd419[_0x01ae('0x85')](db[_0x01ae('0x78')][_0x01ae('0x46')](_0x11621e['toString'](),{'type':db[_0x01ae('0x78')][_0x01ae('0x86')][_0x01ae('0x87')]})[_0x01ae('0x23')](function(_0x2c06c6){if(_0x2c06c6['length']===0x1){return _0x34b4de['id'];}else{var _0x592e3b=_[_0x01ae('0x88')](_[_0x01ae('0x41')](_0x2c06c6,_0x01ae('0x89')),function(_0x399334){return _['includes'](_0x552e07,_0x399334);});if(_0x592e3b){return _0x34b4de['id'];}}}));}}return BPromise[_0x01ae('0x8a')](_0x2cd419)['then'](function(_0x21c940){_0x1389e4=_(_0x1389e4)['union'](_0x21c940)['compact']()[_0x01ae('0x8b')]();return db[_0x01ae('0x57')]['find']({'where':{'id':_0x1901ab[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](function(_0x47cca1){return db[_0x01ae('0x78')][_0x01ae('0x79')](function(_0x291f37){return _0x47cca1[_0x01ae('0x7e')](_0x1901ab['query']['ids'],{'transaction':_0x291f37})['then'](function(){if(!_[_0x01ae('0x8c')](_0x1389e4)){return _0x47cca1[_0x01ae('0x8d')](_0x1389e4,{'transaction':_0x291f37});}})[_0x01ae('0x23')](function(){_0x1389e4[_0x01ae('0x7c')](function(_0x19a9ff){socket['emit']('userChatQueue:remove',{'UserId':_0x19a9ff,'ChatQueueId':_0x47cca1['id']});});});});});});})[_0x01ae('0x23')](respondWithStatusCode(_0x3d15ec,null))[_0x01ae('0x2e')](handleError(_0x3d15ec,null));};exports[_0x01ae('0x8e')]=function(_0x163185,_0x463987,_0x213bd1){return db[_0x01ae('0x57')][_0x01ae('0x62')]({'where':{'id':_0x163185[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x463987,null))[_0x01ae('0x23')](function(_0x55d2b0){if(_0x55d2b0){return _0x55d2b0[_0x01ae('0x8e')](_0x163185[_0x01ae('0x5f')][_0x01ae('0x73')],_[_0x01ae('0x8f')](_0x163185[_0x01ae('0x5f')],[_0x01ae('0x73'),'id'])||{})[_0x01ae('0x90')](function(_0x3b347d){for(var _0x9962c6=0x0;_0x9962c6<_0x163185[_0x01ae('0x5f')][_0x01ae('0x73')][_0x01ae('0x4a')];_0x9962c6+=0x1){socket['emit'](_0x01ae('0x91'),{'UserId':_0x163185[_0x01ae('0x5f')][_0x01ae('0x73')][_0x9962c6],'ChatQueueId':_0x163185[_0x01ae('0x65')]['id']});}return _0x3b347d;});}})['then'](respondWithResult(_0x463987,null))['catch'](handleError(_0x463987,null));};exports[_0x01ae('0x8d')]=function(_0x101545,_0x496b8f,_0xc3eea5){return db[_0x01ae('0x57')]['find']({'where':{'id':_0x101545[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x496b8f,null))[_0x01ae('0x23')](function(_0x54210d){if(_0x54210d){return _0x54210d[_0x01ae('0x8d')](_0x101545['query']['ids'])['then'](function(){if(_['isArray'](_0x101545['query']['ids'])){for(var _0x12d5ee=0x0;_0x12d5ee<_0x101545[_0x01ae('0x46')][_0x01ae('0x73')][_0x01ae('0x4a')];_0x12d5ee+=0x1){socket['emit'](_0x01ae('0x92'),{'UserId':Number(_0x101545[_0x01ae('0x46')][_0x01ae('0x73')][_0x12d5ee]),'ChatQueueId':Number(_0x101545[_0x01ae('0x65')]['id'])});}}else{socket[_0x01ae('0x7d')](_0x01ae('0x92'),{'UserId':Number(_0x101545[_0x01ae('0x46')][_0x01ae('0x73')]),'ChatQueueId':Number(_0x101545[_0x01ae('0x65')]['id'])});}});}})[_0x01ae('0x23')](respondWithStatusCode(_0x496b8f,null))[_0x01ae('0x2e')](handleError(_0x496b8f,null));};exports[_0x01ae('0x93')]=function(_0x2d8db6,_0x4454f4,_0x3688f6){var _0x4ee1dd={};var _0x3f3ef0={};var _0x342f68;var _0x47a71e;return db[_0x01ae('0x57')][_0x01ae('0x67')]({'where':{'id':_0x2d8db6[_0x01ae('0x65')]['id']}})[_0x01ae('0x23')](handleEntityNotFound(_0x4454f4,null))[_0x01ae('0x23')](function(_0x3f913a){if(_0x3f913a){_0x342f68=_0x3f913a;_0x3f3ef0[_0x01ae('0x45')]=_[_0x01ae('0x47')](db['User']['rawAttributes']);_0x3f3ef0[_0x01ae('0x46')]=_[_0x01ae('0x47')](_0x2d8db6[_0x01ae('0x46')]);_0x3f3ef0['filters']=_['intersection'](_0x3f3ef0[_0x01ae('0x45')],_0x3f3ef0['query']);_0x4ee1dd['attributes']=_[_0x01ae('0x5c')](_0x3f3ef0[_0x01ae('0x45')],qs[_0x01ae('0x48')](_0x2d8db6[_0x01ae('0x46')][_0x01ae('0x48')]));_0x4ee1dd[_0x01ae('0x49')]=_0x4ee1dd[_0x01ae('0x49')][_0x01ae('0x4a')]?_0x4ee1dd[_0x01ae('0x49')]:_0x3f3ef0[_0x01ae('0x45')];_0x4ee1dd[_0x01ae('0x4d')]=qs[_0x01ae('0x4e')](_0x2d8db6['query'][_0x01ae('0x4e')]);_0x4ee1dd[_0x01ae('0x51')]=qs[_0x01ae('0x50')](_['pick'](_0x2d8db6[_0x01ae('0x46')],_0x3f3ef0[_0x01ae('0x50')]));if(_0x2d8db6[_0x01ae('0x46')][_0x01ae('0x54')]){_0x4ee1dd['where']=_[_0x01ae('0x52')](_0x4ee1dd[_0x01ae('0x51')],{'$or':_[_0x01ae('0x41')](_0x4ee1dd[_0x01ae('0x49')],function(_0x2f2055){var _0x108cec={};_0x108cec[_0x2f2055]={'$like':'%'+_0x2d8db6['query'][_0x01ae('0x54')]+'%'};return _0x108cec;})});}_0x4ee1dd=_[_0x01ae('0x52')]({},_0x4ee1dd,_0x2d8db6[_0x01ae('0x69')]);return _0x342f68[_0x01ae('0x93')](_0x4ee1dd);}})[_0x01ae('0x23')](function(_0x4dedc8){if(_0x4dedc8){_0x47a71e=_0x4dedc8['length'];if(!_0x2d8db6[_0x01ae('0x46')]['hasOwnProperty'](_0x01ae('0x4c'))){_0x4ee1dd[_0x01ae('0x33')]=qs[_0x01ae('0x33')](_0x2d8db6[_0x01ae('0x46')]['limit']);_0x4ee1dd[_0x01ae('0x32')]=qs[_0x01ae('0x32')](_0x2d8db6[_0x01ae('0x46')][_0x01ae('0x32')]);}return _0x342f68[_0x01ae('0x93')](_0x4ee1dd);}})[_0x01ae('0x23')](function(_0x1e8119){if(_0x1e8119){return _0x1e8119?{'count':_0x47a71e,'rows':_0x1e8119}:null;}})[_0x01ae('0x23')](respondWithResult(_0x4454f4,null))[_0x01ae('0x2e')](handleError(_0x4454f4,null));}; \ No newline at end of file +var _0xa679=['forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','includes','all','isEmpty','removeAgents','addAgents','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','ChatQueues','UserProfileResource','end','name','index','ChatQueue','rawAttributes','type','map','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','order','ChatQueueId','User','UserId','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','findOrCreate'];(function(_0x27d5f4,_0x5a7934){var _0x5a3cff=function(_0x2d1f88){while(--_0x2d1f88){_0x27d5f4['push'](_0x27d5f4['shift']());}};_0x5a3cff(++_0x5a7934);}(_0xa679,0x13f));var _0x9a67=function(_0x3bd49e,_0x2573ca){_0x3bd49e=_0x3bd49e-0x0;var _0x518f14=_0xa679[_0x3bd49e];return _0x518f14;};'use strict';var pdf=require(_0x9a67('0x0'));var emlformat=require(_0x9a67('0x1'));var rimraf=require(_0x9a67('0x2'));var zipdir=require(_0x9a67('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a67('0x4'));var moment=require(_0x9a67('0x5'));var BPromise=require(_0x9a67('0x6'));var Mustache=require(_0x9a67('0x7'));var util=require('util');var path=require(_0x9a67('0x8'));var sox=require(_0x9a67('0x9'));var csv=require(_0x9a67('0xa'));var ejs=require(_0x9a67('0xb'));var fs=require('fs');var _=require(_0x9a67('0xc'));var squel=require(_0x9a67('0xd'));var crypto=require(_0x9a67('0xe'));var jsforce=require(_0x9a67('0xf'));var deskjs=require(_0x9a67('0x10'));var toCsv=require(_0x9a67('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9a67('0x11'));var qs=require(_0x9a67('0x12'));var as=require(_0x9a67('0x13'));var hardwareService=require(_0x9a67('0x14'));var logger=require(_0x9a67('0x15'))(_0x9a67('0x16'));var utils=require(_0x9a67('0x17'));var config=require(_0x9a67('0x18'));var db=require(_0x9a67('0x19'))['db'];config[_0x9a67('0x1a')]=_[_0x9a67('0x1b')](config[_0x9a67('0x1a')],{'host':_0x9a67('0x1c'),'port':0x18eb});var socket=require(_0x9a67('0x1d'))(new Redis(config[_0x9a67('0x1a')]));require(_0x9a67('0x1e'))[_0x9a67('0x1f')](socket);var jayson=require(_0x9a67('0x20'));var client=jayson[_0x9a67('0x21')][_0x9a67('0x22')]({'port':0x232a});function checkPasswordPattern(_0xe1fd3f,_0x58de93,_0x1f21f4){if(_0x1f21f4){var _0x352315=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x352315[_0x9a67('0x23')](_0x58de93)){return _0xe1fd3f;}else{throw new db[(_0x9a67('0x24'))][(_0x9a67('0x25'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xe1fd3f;}}function respondWithRpcPromise(_0x189c3e,_0x55666f,_0x2f994b,_0x21770e){return new BPromise(function(_0x3eb258,_0xb99342){var _0x10ad91=_0x21770e||client;return _0x10ad91[_0x9a67('0x26')](_0x189c3e,_0x2f994b)['then'](function(_0x468f1b){logger[_0x9a67('0x27')](_0x9a67('0x28'),_0x55666f,_0x9a67('0x29'));logger['debug'](_0x9a67('0x2a'),_0x55666f,'request\x20sent',JSON[_0x9a67('0x2b')](_0x468f1b));if(_0x468f1b['error']){if(_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2d')]===0x1f4){logger[_0x9a67('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x55666f,_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2e')]);return _0xb99342(_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2e')]);}logger['error'](_0x9a67('0x28'),_0x55666f,_0x468f1b[_0x9a67('0x2c')]['message']);return _0x3eb258(_0x468f1b[_0x9a67('0x2c')][_0x9a67('0x2e')]);}else{logger[_0x9a67('0x27')](_0x9a67('0x28'),_0x55666f,_0x9a67('0x29'));_0x3eb258(_0x468f1b[_0x9a67('0x2f')][_0x9a67('0x2e')]);}})[_0x9a67('0x30')](function(_0x84418e){logger['error'](_0x9a67('0x28'),_0x55666f,_0x84418e);_0xb99342(_0x84418e);});});}function respondWithStatusCode(_0x5e3d1b,_0x4f3ff1){_0x4f3ff1=_0x4f3ff1||0xcc;return function(_0x5c42e8){if(_0x5c42e8){return _0x5e3d1b[_0x9a67('0x31')](_0x4f3ff1);}return _0x5e3d1b[_0x9a67('0x32')](_0x4f3ff1)['end']();};}function respondWithResult(_0xb919ef,_0x4e3a70){_0x4e3a70=_0x4e3a70||0xc8;return function(_0x3c7321){if(_0x3c7321){return _0xb919ef['status'](_0x4e3a70)[_0x9a67('0x33')](_0x3c7321);}};}function respondWithFilteredResult(_0x29008a,_0x5694e2){return function(_0x20a5ed){if(_0x20a5ed){var _0x2a0e9c=_0x20a5ed[_0x9a67('0x34')],_0x541ad9=_0x5694e2[_0x9a67('0x35')],_0x273957=_0x5694e2[_0x9a67('0x35')]+_0x5694e2[_0x9a67('0x36')],_0x457d87;if(_0x273957>=_0x2a0e9c){_0x273957=_0x2a0e9c;_0x457d87=0xc8;}else{_0x457d87=0xce;}_0x29008a['status'](_0x457d87);return _0x29008a[_0x9a67('0x37')](_0x9a67('0x38'),_0x541ad9+'-'+_0x273957+'/'+_0x2a0e9c)[_0x9a67('0x33')](_0x20a5ed);}return null;};}function patchUpdates(_0x2eb69c){return function(_0x3c18e7){try{jsonpatch[_0x9a67('0x39')](_0x3c18e7,_0x2eb69c,!![]);}catch(_0xb0ba62){return BPromise[_0x9a67('0x3a')](_0xb0ba62);}return _0x3c18e7['save']();};}function saveUpdates(_0x190a31,_0x3974f0){return function(_0x1429e2){if(_0x1429e2){return _0x1429e2['update'](_0x190a31)[_0x9a67('0x3b')](function(_0x30dac2){return _0x30dac2;});}return null;};}function removeEntity(_0x3c9857,_0x6d7521){return function(_0x4a20a5){if(_0x4a20a5){return _0x4a20a5[_0x9a67('0x3c')]()[_0x9a67('0x3b')](function(){var _0xbf3d0c=_0x4a20a5['get']({'plain':!![]});var _0x2b4e62=_0x9a67('0x3d');return db[_0x9a67('0x3e')][_0x9a67('0x3c')]({'where':{'type':_0x2b4e62,'resourceId':_0xbf3d0c['id']}})['then'](function(){return _0x4a20a5;});})['then'](function(){_0x3c9857[_0x9a67('0x32')](0xcc)[_0x9a67('0x3f')]();});}};}function handleEntityNotFound(_0x271201,_0xb878dd){return function(_0x51bdd4){if(!_0x51bdd4){_0x271201[_0x9a67('0x31')](0x194);}return _0x51bdd4;};}function handleError(_0x144922,_0x2f5f62){_0x2f5f62=_0x2f5f62||0x1f4;return function(_0x2ed630){logger[_0x9a67('0x2c')](_0x2ed630['stack']);if(_0x2ed630['name']){delete _0x2ed630[_0x9a67('0x40')];}_0x144922[_0x9a67('0x32')](_0x2f5f62)['send'](_0x2ed630);};}exports[_0x9a67('0x41')]=function(_0x1cf6a2,_0x570498){var _0x4d417b={},_0x1d38e1={},_0x50398f={'count':0x0,'rows':[]};var _0x1cde09=_['map'](db[_0x9a67('0x42')][_0x9a67('0x43')],function(_0x3ae72f){return{'name':_0x3ae72f['fieldName'],'type':_0x3ae72f[_0x9a67('0x44')]['key']};});_0x1d38e1['model']=_[_0x9a67('0x45')](_0x1cde09,_0x9a67('0x40'));_0x1d38e1['query']=_['keys'](_0x1cf6a2['query']);_0x1d38e1['filters']=_[_0x9a67('0x46')](_0x1d38e1[_0x9a67('0x47')],_0x1d38e1[_0x9a67('0x48')]);_0x4d417b['attributes']=_['intersection'](_0x1d38e1['model'],qs['fields'](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x49')]));_0x4d417b[_0x9a67('0x4a')]=_0x4d417b[_0x9a67('0x4a')]['length']?_0x4d417b['attributes']:_0x1d38e1[_0x9a67('0x47')];if(!_0x1cf6a2['query'][_0x9a67('0x4b')](_0x9a67('0x4c'))){_0x4d417b[_0x9a67('0x36')]=qs['limit'](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x36')]);_0x4d417b[_0x9a67('0x35')]=qs['offset'](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x35')]);}_0x4d417b['order']=qs[_0x9a67('0x4d')](_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x4d')]);_0x4d417b[_0x9a67('0x4e')]=qs[_0x9a67('0x4f')](_[_0x9a67('0x50')](_0x1cf6a2[_0x9a67('0x48')],_0x1d38e1['filters']),_0x1cde09);if(_0x1cf6a2[_0x9a67('0x48')][_0x9a67('0x51')]){_0x4d417b[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x4d417b[_0x9a67('0x4e')],{'$or':_[_0x9a67('0x45')](_0x1cde09,function(_0x396743){if(_0x396743[_0x9a67('0x44')]!=='VIRTUAL'){var _0x5b398f={};_0x5b398f[_0x396743['name']]={'$like':'%'+_0x1cf6a2['query']['filter']+'%'};return _0x5b398f;}})});}_0x4d417b=_['merge']({},_0x4d417b,_0x1cf6a2[_0x9a67('0x53')]);var _0x2eeaed={'where':_0x4d417b[_0x9a67('0x4e')]};return db[_0x9a67('0x42')][_0x9a67('0x34')](_0x2eeaed)[_0x9a67('0x3b')](function(_0x1ea719){_0x50398f[_0x9a67('0x34')]=_0x1ea719;if(_0x1cf6a2['query'][_0x9a67('0x54')]){_0x4d417b[_0x9a67('0x55')]=[{'all':!![]}];}return db['ChatQueue'][_0x9a67('0x56')](_0x4d417b);})['then'](function(_0x53df3d){_0x50398f[_0x9a67('0x57')]=_0x53df3d;return _0x50398f;})[_0x9a67('0x3b')](respondWithFilteredResult(_0x570498,_0x4d417b))[_0x9a67('0x30')](handleError(_0x570498,null));};exports[_0x9a67('0x58')]=function(_0xca8e83,_0x5b61ae){var _0x493e8a={'raw':!![],'where':{'id':_0xca8e83[_0x9a67('0x59')]['id']}},_0xcd370c={};_0xcd370c[_0x9a67('0x47')]=_[_0x9a67('0x5a')](db[_0x9a67('0x42')][_0x9a67('0x43')]);_0xcd370c[_0x9a67('0x48')]=_[_0x9a67('0x5a')](_0xca8e83[_0x9a67('0x48')]);_0xcd370c[_0x9a67('0x4f')]=_['intersection'](_0xcd370c[_0x9a67('0x47')],_0xcd370c[_0x9a67('0x48')]);_0x493e8a[_0x9a67('0x4a')]=_[_0x9a67('0x46')](_0xcd370c[_0x9a67('0x47')],qs[_0x9a67('0x49')](_0xca8e83['query'][_0x9a67('0x49')]));_0x493e8a[_0x9a67('0x4a')]=_0x493e8a[_0x9a67('0x4a')][_0x9a67('0x5b')]?_0x493e8a[_0x9a67('0x4a')]:_0xcd370c[_0x9a67('0x47')];if(_0xca8e83[_0x9a67('0x48')][_0x9a67('0x54')]){_0x493e8a[_0x9a67('0x55')]=[{'all':!![]}];}_0x493e8a=_[_0x9a67('0x52')]({},_0x493e8a,_0xca8e83[_0x9a67('0x53')]);return db[_0x9a67('0x42')][_0x9a67('0x5c')](_0x493e8a)[_0x9a67('0x3b')](handleEntityNotFound(_0x5b61ae,null))[_0x9a67('0x3b')](respondWithResult(_0x5b61ae,null))['catch'](handleError(_0x5b61ae,null));};exports[_0x9a67('0x5d')]=function(_0x31cb2f,_0x2b7e29){return db[_0x9a67('0x42')][_0x9a67('0x5d')](_0x31cb2f[_0x9a67('0x5e')],{})[_0x9a67('0x3b')](function(_0x4a0cc3){var _0x547a8e=_0x31cb2f['user'][_0x9a67('0x5f')]({'plain':!![]});if(!_0x547a8e)throw new Error(_0x9a67('0x60'));if(_0x547a8e['role']===_0x9a67('0x61')){var _0x310d93=_0x4a0cc3[_0x9a67('0x5f')]({'plain':!![]});var _0x1ae367=_0x9a67('0x3d');return db[_0x9a67('0x62')][_0x9a67('0x5c')]({'where':{'name':_0x1ae367,'userProfileId':_0x547a8e[_0x9a67('0x63')]},'raw':!![]})['then'](function(_0x35972a){if(_0x35972a&&_0x35972a['autoAssociation']===0x0){return db[_0x9a67('0x3e')][_0x9a67('0x5d')]({'name':_0x310d93['name'],'resourceId':_0x310d93['id'],'type':_0x35972a[_0x9a67('0x40')],'sectionId':_0x35972a['id']},{})['then'](function(){return _0x4a0cc3;});}else{return _0x4a0cc3;}})['catch'](function(_0x10227d){logger[_0x9a67('0x2c')](_0x9a67('0x64'),_0x10227d);throw _0x10227d;});}return _0x4a0cc3;})[_0x9a67('0x3b')](respondWithResult(_0x2b7e29,0xc9))['catch'](handleError(_0x2b7e29,null));};exports[_0x9a67('0x65')]=function(_0x583c13,_0x24f27c){if(_0x583c13['body']['id']){delete _0x583c13[_0x9a67('0x5e')]['id'];}return db[_0x9a67('0x42')]['find']({'where':{'id':_0x583c13['params']['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x24f27c,null))[_0x9a67('0x3b')](saveUpdates(_0x583c13['body'],null))[_0x9a67('0x3b')](respondWithResult(_0x24f27c,null))['catch'](handleError(_0x24f27c,null));};exports[_0x9a67('0x3c')]=function(_0x3e71fd,_0x106680){return db[_0x9a67('0x42')][_0x9a67('0x5c')]({'where':{'id':_0x3e71fd['params']['id']}})['then'](handleEntityNotFound(_0x106680,null))[_0x9a67('0x3b')](removeEntity(_0x106680,null))['catch'](handleError(_0x106680,null));};exports[_0x9a67('0x66')]=function(_0x3a78ca,_0x14e295){return db['ChatQueue'][_0x9a67('0x66')]()[_0x9a67('0x3b')](respondWithResult(_0x14e295,null))[_0x9a67('0x30')](handleError(_0x14e295,null));};exports['getMembers']=function(_0x4a842c,_0x2962ae,_0x3cccc1){var _0x345b16={'raw':!![],'where':{}},_0x58cd9f={},_0x2ac248;return db[_0x9a67('0x42')][_0x9a67('0x67')]({'where':{'id':_0x4a842c['params']['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x2962ae,null))[_0x9a67('0x3b')](function(_0x124311){if(_0x124311){_0x2ac248=_0x124311[_0x9a67('0x5f')]({'plain':!![]});_0x58cd9f[_0x9a67('0x47')]=_[_0x9a67('0x5a')](db[_0x9a67('0x68')]['rawAttributes']);_0x58cd9f['query']=_[_0x9a67('0x5a')](_0x4a842c[_0x9a67('0x48')]);_0x58cd9f[_0x9a67('0x4f')]=_['intersection'](_0x58cd9f[_0x9a67('0x47')],_0x58cd9f['query']);_0x345b16[_0x9a67('0x4a')]=_[_0x9a67('0x46')](_0x58cd9f[_0x9a67('0x47')],qs['fields'](_0x4a842c['query'][_0x9a67('0x49')]));_0x345b16['attributes']=_0x345b16[_0x9a67('0x4a')]['length']?_0x345b16[_0x9a67('0x4a')]:_0x58cd9f[_0x9a67('0x47')];if(!_0x4a842c[_0x9a67('0x48')][_0x9a67('0x4b')](_0x9a67('0x4c'))){_0x345b16[_0x9a67('0x36')]=qs[_0x9a67('0x36')](_0x4a842c[_0x9a67('0x48')][_0x9a67('0x36')]);_0x345b16[_0x9a67('0x35')]=qs[_0x9a67('0x35')](_0x4a842c[_0x9a67('0x48')][_0x9a67('0x35')]);}_0x345b16[_0x9a67('0x69')]=qs[_0x9a67('0x4d')](_0x4a842c[_0x9a67('0x48')][_0x9a67('0x4d')]);_0x345b16['where']=qs[_0x9a67('0x4f')](_[_0x9a67('0x50')](_0x4a842c['query'],_0x58cd9f[_0x9a67('0x4f')]));_0x345b16[_0x9a67('0x4e')][_0x9a67('0x6a')]=_0x124311['id'];if(_0x4a842c[_0x9a67('0x48')]['filter']){_0x345b16[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x345b16[_0x9a67('0x4e')],{'$or':_['map'](_0x345b16[_0x9a67('0x4a')],function(_0x50c88a){var _0x194b74={};_0x194b74[_0x50c88a]={'$like':'%'+_0x4a842c[_0x9a67('0x48')][_0x9a67('0x51')]+'%'};return _0x194b74;})});}_0x345b16=_[_0x9a67('0x52')]({},_0x345b16,_0x4a842c[_0x9a67('0x53')]);return db[_0x9a67('0x68')][_0x9a67('0x56')](_0x345b16);}})['then'](function(_0x4f5e9a){if(_0x4f5e9a){return db[_0x9a67('0x6b')]['findAndCountAll']({'where':{'id':_['map'](_0x4f5e9a,_0x9a67('0x6c')),'role':_0x9a67('0x6d')},'attributes':['id',_0x9a67('0x40'),_0x9a67('0x6e'),'updatedAt',_0x9a67('0x6f')]});}})[_0x9a67('0x3b')](function(_0x488f6e){if(_0x488f6e){return{'count':_0x488f6e[_0x9a67('0x34')],'rows':_[_0x9a67('0x45')](_0x488f6e['rows'],function(_0x53f75a){return{'membername':_0x53f75a['name'],'UserId':_0x53f75a['id'],'queue_name':_0x2ac248[_0x9a67('0x40')],'ChatQueueId':_0x2ac248['id'],'interface':util['format'](_0x9a67('0x70'),_0x9a67('0x71'),_0x53f75a['name']),'penalty':0x0,'paused':_0x53f75a['chatPause'],'createdAt':_0x53f75a[_0x9a67('0x6f')],'updatedAt':_0x53f75a[_0x9a67('0x72')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9a67('0x3b')](respondWithFilteredResult(_0x2962ae,_0x345b16))[_0x9a67('0x30')](handleError(_0x2962ae,null));};exports['getTeams']=function(_0x570717,_0x463e67,_0x5dc956){var _0x101cb8={};var _0x2a30bc={};var _0x51cf3b;var _0x1e7895;return db[_0x9a67('0x42')]['findOne']({'where':{'id':_0x570717[_0x9a67('0x59')]['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x463e67,null))[_0x9a67('0x3b')](function(_0x544905){if(_0x544905){_0x51cf3b=_0x544905;_0x2a30bc[_0x9a67('0x47')]=_['keys'](db[_0x9a67('0x73')][_0x9a67('0x43')]);_0x2a30bc['query']=_[_0x9a67('0x5a')](_0x570717[_0x9a67('0x48')]);_0x2a30bc['filters']=_[_0x9a67('0x46')](_0x2a30bc[_0x9a67('0x47')],_0x2a30bc[_0x9a67('0x48')]);_0x101cb8['attributes']=_[_0x9a67('0x46')](_0x2a30bc[_0x9a67('0x47')],qs[_0x9a67('0x49')](_0x570717[_0x9a67('0x48')][_0x9a67('0x49')]));_0x101cb8[_0x9a67('0x4a')]=_0x101cb8['attributes'][_0x9a67('0x5b')]?_0x101cb8['attributes']:_0x2a30bc[_0x9a67('0x47')];_0x101cb8[_0x9a67('0x69')]=qs['sort'](_0x570717['query'][_0x9a67('0x4d')]);_0x101cb8['where']=qs[_0x9a67('0x4f')](_[_0x9a67('0x50')](_0x570717[_0x9a67('0x48')],_0x2a30bc[_0x9a67('0x4f')]));if(_0x570717[_0x9a67('0x48')][_0x9a67('0x51')]){_0x101cb8[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x101cb8['where'],{'$or':_[_0x9a67('0x45')](_0x101cb8[_0x9a67('0x4a')],function(_0x2fe205){var _0x3a39fc={};_0x3a39fc[_0x2fe205]={'$like':'%'+_0x570717[_0x9a67('0x48')][_0x9a67('0x51')]+'%'};return _0x3a39fc;})});}_0x101cb8=_[_0x9a67('0x52')]({},_0x101cb8,_0x570717[_0x9a67('0x53')]);return _0x51cf3b[_0x9a67('0x74')](_0x101cb8);}})[_0x9a67('0x3b')](function(_0x213eb9){if(_0x213eb9){_0x1e7895=_0x213eb9[_0x9a67('0x5b')];if(!_0x570717[_0x9a67('0x48')][_0x9a67('0x4b')](_0x9a67('0x4c'))){_0x101cb8['limit']=qs[_0x9a67('0x36')](_0x570717[_0x9a67('0x48')][_0x9a67('0x36')]);_0x101cb8[_0x9a67('0x35')]=qs['offset'](_0x570717[_0x9a67('0x48')]['offset']);}return _0x51cf3b['getTeams'](_0x101cb8);}})[_0x9a67('0x3b')](function(_0x387bf7){if(_0x387bf7){return _0x387bf7?{'count':_0x1e7895,'rows':_0x387bf7}:null;}})[_0x9a67('0x3b')](respondWithResult(_0x463e67,null))[_0x9a67('0x30')](handleError(_0x463e67,null));};exports[_0x9a67('0x75')]=function(_0x68f3e2,_0x10dd14,_0x202725){var _0x459f9b=_0x68f3e2[_0x9a67('0x5e')][_0x9a67('0x76')];return db[_0x9a67('0x73')][_0x9a67('0x56')]({'where':{'id':_0x459f9b},'attributes':['id'],'include':[{'model':db[_0x9a67('0x6b')],'as':_0x9a67('0x77'),'attributes':['id','name','online',_0x9a67('0x78'),_0x9a67('0x79')],'raw':!![]}]})[_0x9a67('0x3b')](function(_0x4dd6f8){if(_0x4dd6f8){var _0x487dae=_[_0x9a67('0x7a')](_0x4dd6f8,function(_0xe24e9d){var _0x20a8af=_0xe24e9d[_0x9a67('0x5f')]({'plain':!![]});return _0x20a8af[_0x9a67('0x77')];});return db[_0x9a67('0x42')][_0x9a67('0x5c')]({'where':{'id':_0x68f3e2[_0x9a67('0x59')]['id']}})[_0x9a67('0x3b')](function(_0xd4b6f4){return db['sequelize'][_0x9a67('0x7b')](function(_0x45dbbb){return _0xd4b6f4[_0x9a67('0x75')](_0x459f9b,{'transaction':_0x45dbbb})[_0x9a67('0x3b')](function(){return BPromise['each'](_0x487dae,function(_0x1d6fae){return db[_0x9a67('0x68')][_0x9a67('0x7c')]({'where':{'UserId':_0x1d6fae['id'],'ChatQueueId':_0x68f3e2['params']['id']},'transaction':_0x45dbbb});});})[_0x9a67('0x3b')](function(){_0x487dae[_0x9a67('0x7d')](function(_0x3b11dd){socket[_0x9a67('0x7e')](_0x9a67('0x7f'),{'UserId':_0x3b11dd['id'],'ChatQueueId':_0xd4b6f4['id']});});});});});}})[_0x9a67('0x3b')](respondWithStatusCode(_0x10dd14,null))[_0x9a67('0x30')](handleError(_0x10dd14,null));};exports[_0x9a67('0x80')]=function(_0x58d1ec,_0x357ee3,_0x5ba8af){return db[_0x9a67('0x73')][_0x9a67('0x56')]({'where':{'id':_0x58d1ec[_0x9a67('0x48')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9a67('0x6b')],'as':_0x9a67('0x77'),'attributes':['id'],'raw':!![]}]})[_0x9a67('0x3b')](handleEntityNotFound(_0x357ee3,null))[_0x9a67('0x3b')](function(_0x3f3598){var _0x2fdd5d=_[_0x9a67('0x45')](_0x3f3598,'id');var _0x1ece72=[];var _0x3f2cc4=[];var _0x20faa2=squel[_0x9a67('0x81')]();_0x20faa2[_0x9a67('0x82')]('tq.TeamId')[_0x9a67('0x83')](_0x9a67('0x84'),'tq')['join']('user_has_teams','ut',_0x9a67('0x85'))['where'](_0x9a67('0x86'),_0x58d1ec[_0x9a67('0x59')]['id']);for(var _0x222bba=0x0;_0x222bba<_0x3f3598[_0x9a67('0x5b')];_0x222bba+=0x1){let _0x4e5b4e=_0x3f3598[_0x222bba];for(var _0x393f79=0x0;_0x393f79<_0x4e5b4e[_0x9a67('0x77')]['length'];_0x393f79+=0x1){let _0x16157c=_0x4e5b4e[_0x9a67('0x77')][_0x393f79];var _0x1e049a=_0x20faa2[_0x9a67('0x87')]();_0x1e049a[_0x9a67('0x4e')](_0x9a67('0x88'),_0x16157c['id']);_0x3f2cc4[_0x9a67('0x89')](db[_0x9a67('0x8a')][_0x9a67('0x48')](_0x1e049a[_0x9a67('0x8b')](),{'type':db[_0x9a67('0x8a')]['QueryTypes'][_0x9a67('0x8c')]})[_0x9a67('0x3b')](function(_0x51a1c9){if(_0x51a1c9[_0x9a67('0x5b')]===0x1){return _0x16157c['id'];}else{var _0x1c3716=_['every'](_['map'](_0x51a1c9,'TeamId'),function(_0x3fa4d9){return _[_0x9a67('0x8d')](_0x2fdd5d,_0x3fa4d9);});if(_0x1c3716){return _0x16157c['id'];}}}));}}return BPromise[_0x9a67('0x8e')](_0x3f2cc4)[_0x9a67('0x3b')](function(_0x402a52){_0x1ece72=_(_0x1ece72)['union'](_0x402a52)['compact']()['value']();return db[_0x9a67('0x42')]['find']({'where':{'id':_0x58d1ec[_0x9a67('0x59')]['id']}})[_0x9a67('0x3b')](function(_0x5a4577){return db['sequelize'][_0x9a67('0x7b')](function(_0x4c89d3){return _0x5a4577['removeTeams'](_0x58d1ec[_0x9a67('0x48')][_0x9a67('0x76')],{'transaction':_0x4c89d3})['then'](function(){if(!_[_0x9a67('0x8f')](_0x1ece72)){return _0x5a4577[_0x9a67('0x90')](_0x1ece72,{'transaction':_0x4c89d3});}})[_0x9a67('0x3b')](function(){_0x1ece72['forEach'](function(_0x453ec3){socket[_0x9a67('0x7e')]('userChatQueue:remove',{'UserId':_0x453ec3,'ChatQueueId':_0x5a4577['id']});});});});});});})[_0x9a67('0x3b')](respondWithStatusCode(_0x357ee3,null))['catch'](handleError(_0x357ee3,null));};exports[_0x9a67('0x91')]=function(_0x426681,_0x3ac48c,_0x5b10cd){return db[_0x9a67('0x42')]['find']({'where':{'id':_0x426681['params']['id']}})['then'](handleEntityNotFound(_0x3ac48c,null))[_0x9a67('0x3b')](function(_0x497bbc){if(_0x497bbc){return _0x497bbc['addAgents'](_0x426681[_0x9a67('0x5e')]['ids'],_['omit'](_0x426681[_0x9a67('0x5e')],[_0x9a67('0x76'),'id'])||{})['spread'](function(_0x15d0d4){for(var _0x534ba7=0x0;_0x534ba7<_0x426681[_0x9a67('0x5e')][_0x9a67('0x76')][_0x9a67('0x5b')];_0x534ba7+=0x1){socket[_0x9a67('0x7e')]('userChatQueue:save',{'UserId':_0x426681['body'][_0x9a67('0x76')][_0x534ba7],'ChatQueueId':_0x426681[_0x9a67('0x59')]['id']});}return _0x15d0d4;});}})[_0x9a67('0x3b')](respondWithResult(_0x3ac48c,null))['catch'](handleError(_0x3ac48c,null));};exports[_0x9a67('0x90')]=function(_0x265de3,_0x3fc940,_0x398237){return db[_0x9a67('0x42')][_0x9a67('0x5c')]({'where':{'id':_0x265de3['params']['id']}})[_0x9a67('0x3b')](handleEntityNotFound(_0x3fc940,null))['then'](function(_0x28b0cb){if(_0x28b0cb){return _0x28b0cb[_0x9a67('0x90')](_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')])[_0x9a67('0x3b')](function(){if(_['isArray'](_0x265de3[_0x9a67('0x48')]['ids'])){for(var _0x3a7c60=0x0;_0x3a7c60<_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')]['length'];_0x3a7c60+=0x1){socket[_0x9a67('0x7e')](_0x9a67('0x92'),{'UserId':Number(_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')][_0x3a7c60]),'ChatQueueId':Number(_0x265de3[_0x9a67('0x59')]['id'])});}}else{socket['emit'](_0x9a67('0x92'),{'UserId':Number(_0x265de3[_0x9a67('0x48')][_0x9a67('0x76')]),'ChatQueueId':Number(_0x265de3[_0x9a67('0x59')]['id'])});}});}})[_0x9a67('0x3b')](respondWithStatusCode(_0x3fc940,null))['catch'](handleError(_0x3fc940,null));};exports['getAgents']=function(_0x281120,_0x478fe3,_0x33fbfb){var _0x53db3f={};var _0x1fbf7c={};var _0x1d99e7;var _0x3a1b5d;return db[_0x9a67('0x42')][_0x9a67('0x67')]({'where':{'id':_0x281120['params']['id']}})['then'](handleEntityNotFound(_0x478fe3,null))[_0x9a67('0x3b')](function(_0x1a3445){if(_0x1a3445){_0x1d99e7=_0x1a3445;_0x1fbf7c[_0x9a67('0x47')]=_['keys'](db[_0x9a67('0x6b')][_0x9a67('0x43')]);_0x1fbf7c[_0x9a67('0x48')]=_[_0x9a67('0x5a')](_0x281120[_0x9a67('0x48')]);_0x1fbf7c[_0x9a67('0x4f')]=_[_0x9a67('0x46')](_0x1fbf7c['model'],_0x1fbf7c[_0x9a67('0x48')]);_0x53db3f[_0x9a67('0x4a')]=_['intersection'](_0x1fbf7c[_0x9a67('0x47')],qs[_0x9a67('0x49')](_0x281120['query']['fields']));_0x53db3f[_0x9a67('0x4a')]=_0x53db3f[_0x9a67('0x4a')][_0x9a67('0x5b')]?_0x53db3f[_0x9a67('0x4a')]:_0x1fbf7c['model'];_0x53db3f[_0x9a67('0x69')]=qs['sort'](_0x281120[_0x9a67('0x48')]['sort']);_0x53db3f[_0x9a67('0x4e')]=qs[_0x9a67('0x4f')](_['pick'](_0x281120[_0x9a67('0x48')],_0x1fbf7c['filters']));if(_0x281120['query'][_0x9a67('0x51')]){_0x53db3f[_0x9a67('0x4e')]=_[_0x9a67('0x52')](_0x53db3f[_0x9a67('0x4e')],{'$or':_[_0x9a67('0x45')](_0x53db3f[_0x9a67('0x4a')],function(_0xcc925c){var _0x11e2fc={};_0x11e2fc[_0xcc925c]={'$like':'%'+_0x281120[_0x9a67('0x48')][_0x9a67('0x51')]+'%'};return _0x11e2fc;})});}_0x53db3f=_[_0x9a67('0x52')]({},_0x53db3f,_0x281120[_0x9a67('0x53')]);return _0x1d99e7[_0x9a67('0x93')](_0x53db3f);}})['then'](function(_0x3c181a){if(_0x3c181a){_0x3a1b5d=_0x3c181a['length'];if(!_0x281120[_0x9a67('0x48')]['hasOwnProperty'](_0x9a67('0x4c'))){_0x53db3f['limit']=qs[_0x9a67('0x36')](_0x281120[_0x9a67('0x48')]['limit']);_0x53db3f[_0x9a67('0x35')]=qs[_0x9a67('0x35')](_0x281120[_0x9a67('0x48')][_0x9a67('0x35')]);}return _0x1d99e7['getAgents'](_0x53db3f);}})[_0x9a67('0x3b')](function(_0x249d7a){if(_0x249d7a){return _0x249d7a?{'count':_0x3a1b5d,'rows':_0x249d7a}:null;}})[_0x9a67('0x3b')](respondWithResult(_0x478fe3,null))[_0x9a67('0x30')](handleError(_0x478fe3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5db6324..9162072 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x962220,_0xb60f61){var _0x43adb7=function(_0x19a58a){while(--_0x19a58a){_0x962220['push'](_0x962220['shift']());}};_0x43adb7(++_0xb60f61);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfb65aa,_0x1651a6){_0xfb65aa=_0xfb65aa-0x0;var _0x2aee31=_0x0b0e[_0xfb65aa];return _0x2aee31;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x337f8e,_0x48c37a){var _0x94b4e8=function(_0x1a46e5){while(--_0x1a46e5){_0x337f8e['push'](_0x337f8e['shift']());}};_0x94b4e8(++_0x48c37a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1dfd6a,_0x43e2b8){_0x1dfd6a=_0x1dfd6a-0x0;var _0x41fe5e=_0x5f2f[_0x1dfd6a];return _0x41fe5e;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7dc2c45..58b7a44 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 _0xa098=['../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3d15db,_0x33bbf6){var _0x309078=function(_0x2c6aa9){while(--_0x2c6aa9){_0x3d15db['push'](_0x3d15db['shift']());}};_0x309078(++_0x33bbf6);}(_0xa098,0x100));var _0x8a09=function(_0x2c485c,_0x592e01){_0x2c485c=_0x2c485c-0x0;var _0x3cac6c=_0xa098[_0x2c485c];return _0x3cac6c;};'use strict';var _=require(_0x8a09('0x0'));var util=require(_0x8a09('0x1'));var logger=require(_0x8a09('0x2'))(_0x8a09('0x3'));var moment=require(_0x8a09('0x4'));var BPromise=require(_0x8a09('0x5'));var rp=require(_0x8a09('0x6'));var fs=require('fs');var path=require(_0x8a09('0x7'));var rimraf=require('rimraf');var config=require(_0x8a09('0x8'));var attributes=require(_0x8a09('0x9'));module['exports']=function(_0x4f0f59,_0xe328a7){return _0x4f0f59['define'](_0x8a09('0xa'),attributes,{'tableName':_0x8a09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7493=['exports','define','ChatQueue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x2f122b,_0x14ffd8){var _0x4b2c4b=function(_0x54879c){while(--_0x54879c){_0x2f122b['push'](_0x2f122b['shift']());}};_0x4b2c4b(++_0x14ffd8);}(_0x7493,0x13b));var _0x3749=function(_0xb4788,_0x1efb8d){_0xb4788=_0xb4788-0x0;var _0xd49d21=_0x7493[_0xb4788];return _0xd49d21;};'use strict';var _=require('lodash');var util=require(_0x3749('0x0'));var logger=require(_0x3749('0x1'))(_0x3749('0x2'));var moment=require(_0x3749('0x3'));var BPromise=require(_0x3749('0x4'));var rp=require(_0x3749('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3749('0x6'));var config=require(_0x3749('0x7'));var attributes=require(_0x3749('0x8'));module[_0x3749('0x9')]=function(_0x1621ba,_0x2c78c8){return _0x1621ba[_0x3749('0xa')](_0x3749('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 0842c47..d6c8116 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 _0xd943=['include','map','model','GetChatQueue','ShowChatQueue','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueue','options','raw','where','attributes','limit'];(function(_0x4ffe26,_0x3d0beb){var _0x144660=function(_0x2e6dfb){while(--_0x2e6dfb){_0x4ffe26['push'](_0x4ffe26['shift']());}};_0x144660(++_0x3d0beb);}(_0xd943,0x15d));var _0x3d94=function(_0x55dae9,_0x18a582){_0x55dae9=_0x55dae9-0x0;var _0x3cb19b=_0xd943[_0x55dae9];return _0x3cb19b;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['GetChatQueue']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['findAll']({'raw':_0x28bead['options']?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![],'where':_0x28bead[_0x3d94('0x1a')]?_0x28bead['options'][_0x3d94('0x1c')]||null:null,'attributes':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1d')]||null:null,'limit':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1e')]||null:null,'include':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1f')],function(_0x3496c3){return{'model':db[_0x3496c3[_0x3d94('0x21')]],'as':_0x3496c3['as'],'attributes':_0x3496c3['attributes'],'include':_0x3496c3[_0x3d94('0x1f')]?_['map'](_0x3496c3[_0x3d94('0x1f')],function(_0x1d0a7a){return{'model':db[_0x1d0a7a[_0x3d94('0x21')]],'as':_0x1d0a7a['as'],'attributes':_0x1d0a7a[_0x3d94('0x1d')],'include':_0x1d0a7a[_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x1d0a7a[_0x3d94('0x1f')],function(_0x47d6ab){return{'model':db[_0x47d6ab['model']],'as':_0x47d6ab['as'],'attributes':_0x47d6ab[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dd410){logger[_0x3d94('0xf')]('GetChatQueue',_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x22'),_0x28bead,JSON[_0x3d94('0x13')](_0x4dd410));_0x16a6d0(_0x4dd410);})['catch'](function(_0x2a07b4){logger['error'](_0x3d94('0x22'),_0x2a07b4['message'],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x2a07b4[_0x3d94('0x16')]));});});};exports[_0x3d94('0x23')]=function(_0x246f88){var _0x50560c=this;return new Promise(function(_0x18f854,_0x51f634){return db[_0x3d94('0x19')][_0x3d94('0x24')]({'raw':_0x246f88['options']?_0x246f88['options'][_0x3d94('0x1b')]===undefined?!![]:![]:!![],'where':_0x246f88[_0x3d94('0x1a')]?_0x246f88[_0x3d94('0x1a')]['where']||null:null,'attributes':_0x246f88[_0x3d94('0x1a')]?_0x246f88[_0x3d94('0x1a')]['attributes']||null:null,'include':_0x246f88[_0x3d94('0x1a')]?_0x246f88[_0x3d94('0x1a')][_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x246f88[_0x3d94('0x1a')]['include'],function(_0xa43fc){return{'model':db[_0xa43fc[_0x3d94('0x21')]],'as':_0xa43fc['as'],'attributes':_0xa43fc[_0x3d94('0x1d')],'include':_0xa43fc[_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0xa43fc[_0x3d94('0x1f')],function(_0x546658){return{'model':db[_0x546658['model']],'as':_0x546658['as'],'attributes':_0x546658[_0x3d94('0x1d')],'include':_0x546658[_0x3d94('0x1f')]?_[_0x3d94('0x20')](_0x546658[_0x3d94('0x1f')],function(_0x3bfc16){return{'model':db[_0x3bfc16[_0x3d94('0x21')]],'as':_0x3bfc16['as'],'attributes':_0x3bfc16[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0x25')](function(_0x2e7b97){logger[_0x3d94('0xf')]('ShowChatQueue',_0x246f88);logger[_0x3d94('0x12')](_0x3d94('0x23'),_0x246f88,JSON[_0x3d94('0x13')](_0x2e7b97));_0x18f854(_0x2e7b97);})[_0x3d94('0x18')](function(_0x525d90){logger[_0x3d94('0x14')](_0x3d94('0x23'),_0x525d90[_0x3d94('0x16')],_0x246f88);_0x51f634(_0x50560c[_0x3d94('0x14')](0x1f4,_0x525d90[_0x3d94('0x16')]));});});}; \ No newline at end of file +var _0x3906=['result','GetChatQueue','ChatQueue','findAll','options','where','include','attributes','model','find','raw','map','ShowChatQueue','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2644ec,_0x42c4da){var _0x155449=function(_0x510f99){while(--_0x510f99){_0x2644ec['push'](_0x2644ec['shift']());}};_0x155449(++_0x42c4da);}(_0x3906,0xd6));var _0x6390=function(_0x166eea,_0xb7c5b5){_0x166eea=_0x166eea-0x0;var _0x1893e2=_0x3906[_0x166eea];return _0x1893e2;};'use strict';var _=require(_0x6390('0x0'));var util=require(_0x6390('0x1'));var moment=require('moment');var BPromise=require(_0x6390('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6390('0x3'));var db=require(_0x6390('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6390('0x5'))(_0x6390('0x6'));var config=require(_0x6390('0x7'));var jayson=require(_0x6390('0x8'));var client=jayson[_0x6390('0x9')][_0x6390('0xa')]({'port':0x232a});config[_0x6390('0xb')]=_[_0x6390('0xc')](config[_0x6390('0xb')],{'host':_0x6390('0xd'),'port':0x18eb});var socket=require(_0x6390('0xe'))(new Redis(config[_0x6390('0xb')]));require('./chatQueue.socket')[_0x6390('0xf')](socket);function respondWithRpcPromise(_0x522556,_0x105319,_0x1f4e72){return new BPromise(function(_0x277742,_0x428b3d){return client[_0x6390('0x10')](_0x522556,_0x1f4e72)[_0x6390('0x11')](function(_0x5f1482){logger[_0x6390('0x12')](_0x6390('0x13'),_0x105319,_0x6390('0x14'));logger[_0x6390('0x15')](_0x6390('0x16'),_0x105319,_0x6390('0x14'),JSON[_0x6390('0x17')](_0x5f1482));if(_0x5f1482[_0x6390('0x18')]){if(_0x5f1482[_0x6390('0x18')]['code']===0x1f4){logger[_0x6390('0x18')](_0x6390('0x13'),_0x105319,_0x5f1482[_0x6390('0x18')][_0x6390('0x19')]);return _0x428b3d(_0x5f1482[_0x6390('0x18')][_0x6390('0x19')]);}logger[_0x6390('0x18')](_0x6390('0x13'),_0x105319,_0x5f1482[_0x6390('0x18')][_0x6390('0x19')]);return _0x277742(_0x5f1482['error']['message']);}else{logger[_0x6390('0x12')](_0x6390('0x13'),_0x105319,_0x6390('0x14'));_0x277742(_0x5f1482[_0x6390('0x1a')][_0x6390('0x19')]);}})['catch'](function(_0x35cdce){logger[_0x6390('0x18')](_0x6390('0x13'),_0x105319,_0x35cdce);_0x428b3d(_0x35cdce);});});}exports[_0x6390('0x1b')]=function(_0x42520d){var _0xcdb5ab=this;return new Promise(function(_0x1c5414,_0x31de0a){return db[_0x6390('0x1c')][_0x6390('0x1d')]({'raw':_0x42520d['options']?_0x42520d['options']['raw']===undefined?!![]:![]:!![],'where':_0x42520d[_0x6390('0x1e')]?_0x42520d['options'][_0x6390('0x1f')]||null:null,'attributes':_0x42520d[_0x6390('0x1e')]?_0x42520d[_0x6390('0x1e')]['attributes']||null:null,'limit':_0x42520d['options']?_0x42520d[_0x6390('0x1e')]['limit']||null:null,'include':_0x42520d['options']?_0x42520d[_0x6390('0x1e')][_0x6390('0x20')]?_['map'](_0x42520d['options'][_0x6390('0x20')],function(_0x34391c){return{'model':db[_0x34391c['model']],'as':_0x34391c['as'],'attributes':_0x34391c[_0x6390('0x21')],'include':_0x34391c['include']?_['map'](_0x34391c[_0x6390('0x20')],function(_0x2cba99){return{'model':db[_0x2cba99[_0x6390('0x22')]],'as':_0x2cba99['as'],'attributes':_0x2cba99[_0x6390('0x21')],'include':_0x2cba99['include']?_['map'](_0x2cba99[_0x6390('0x20')],function(_0x25779b){return{'model':db[_0x25779b[_0x6390('0x22')]],'as':_0x25779b['as'],'attributes':_0x25779b[_0x6390('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27a174){logger[_0x6390('0x12')](_0x6390('0x1b'),_0x42520d);logger[_0x6390('0x15')](_0x6390('0x1b'),_0x42520d,JSON['stringify'](_0x27a174));_0x1c5414(_0x27a174);})['catch'](function(_0x446917){logger[_0x6390('0x18')]('GetChatQueue',_0x446917[_0x6390('0x19')],_0x42520d);_0x31de0a(_0xcdb5ab[_0x6390('0x18')](0x1f4,_0x446917[_0x6390('0x19')]));});});};exports['ShowChatQueue']=function(_0x2cb36b){var _0x5cd765=this;return new Promise(function(_0x2fa7f6,_0x21c2ff){return db['ChatQueue'][_0x6390('0x23')]({'raw':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')][_0x6390('0x24')]===undefined?!![]:![]:!![],'where':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')]['where']||null:null,'attributes':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')]['attributes']||null:null,'include':_0x2cb36b[_0x6390('0x1e')]?_0x2cb36b[_0x6390('0x1e')][_0x6390('0x20')]?_['map'](_0x2cb36b[_0x6390('0x1e')][_0x6390('0x20')],function(_0x403f6f){return{'model':db[_0x403f6f[_0x6390('0x22')]],'as':_0x403f6f['as'],'attributes':_0x403f6f['attributes'],'include':_0x403f6f[_0x6390('0x20')]?_[_0x6390('0x25')](_0x403f6f['include'],function(_0x4fa793){return{'model':db[_0x4fa793[_0x6390('0x22')]],'as':_0x4fa793['as'],'attributes':_0x4fa793['attributes'],'include':_0x4fa793['include']?_[_0x6390('0x25')](_0x4fa793[_0x6390('0x20')],function(_0x2e5324){return{'model':db[_0x2e5324[_0x6390('0x22')]],'as':_0x2e5324['as'],'attributes':_0x2e5324[_0x6390('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fe3d1){logger[_0x6390('0x12')](_0x6390('0x26'),_0x2cb36b);logger['debug']('ShowChatQueue',_0x2cb36b,JSON['stringify'](_0x3fe3d1));_0x2fa7f6(_0x3fe3d1);})[_0x6390('0x27')](function(_0x11837e){logger[_0x6390('0x18')]('ShowChatQueue',_0x11837e[_0x6390('0x19')],_0x2cb36b);_0x21c2ff(_0x5cd765[_0x6390('0x18')](0x1f4,_0x11837e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7e62acc..9e9c8c9 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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x5be216,_0x5a2010){var _0x189a77=function(_0x462d4d){while(--_0x462d4d){_0x5be216['push'](_0x5be216['shift']());}};_0x189a77(++_0x5a2010);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x5e7b8c,_0x568ddc){var _0x223bc1=function(_0x5983ba){while(--_0x5983ba){_0x5e7b8c['push'](_0x5e7b8c['shift']());}};_0x223bc1(++_0x568ddc);}(_0x0b0e,0x187));var _0xe0b0=function(_0x23e859,_0x419ccc){_0x23e859=_0x23e859-0x0;var _0xe4964=_0x0b0e[_0x23e859];return _0xe4964;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7c77d38..ec98b8f 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 _0x6a92=['/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers'];(function(_0x32e865,_0x317078){var _0x850461=function(_0x37417f){while(--_0x37417f){_0x32e865['push'](_0x32e865['shift']());}};_0x850461(++_0x317078);}(_0x6a92,0xec));var _0x26a9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6a92[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x26a9('0x0'));var path=require(_0x26a9('0x1'));var timeout=require(_0x26a9('0x2'));var express=require(_0x26a9('0x3'));var router=express[_0x26a9('0x4')]();var auth=require(_0x26a9('0x5'));var interaction=require(_0x26a9('0x6'));var config=require(_0x26a9('0x7'));var controller=require('./chatQueue.controller');router[_0x26a9('0x8')]('/',auth[_0x26a9('0x9')](),controller[_0x26a9('0xa')]);router[_0x26a9('0x8')](_0x26a9('0xb'),auth['isAuthenticated'](),controller[_0x26a9('0xc')]);router[_0x26a9('0x8')](_0x26a9('0xd'),auth[_0x26a9('0x9')](),controller[_0x26a9('0xe')]);router[_0x26a9('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x26a9('0xf')]);router[_0x26a9('0x8')](_0x26a9('0x10'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x11')]);router[_0x26a9('0x8')](_0x26a9('0x12'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x13')]);router[_0x26a9('0x14')]('/',auth[_0x26a9('0x9')](),controller['create']);router[_0x26a9('0x14')](_0x26a9('0x10'),auth['isAuthenticated'](),controller[_0x26a9('0x15')]);router[_0x26a9('0x14')]('/:id/users',auth[_0x26a9('0x9')](),controller[_0x26a9('0x16')]);router['put'](_0x26a9('0xd'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x17')]);router[_0x26a9('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x26a9('0x18')](_0x26a9('0x10'),auth[_0x26a9('0x9')](),controller[_0x26a9('0x19')]);router[_0x26a9('0x18')](_0x26a9('0x12'),auth['isAuthenticated'](),controller[_0x26a9('0x1a')]);module[_0x26a9('0x1b')]=router; \ No newline at end of file +var _0xdaec=['getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members'];(function(_0x28a6d7,_0x106ff0){var _0xc65da7=function(_0x261b48){while(--_0x261b48){_0x28a6d7['push'](_0x28a6d7['shift']());}};_0xc65da7(++_0x106ff0);}(_0xdaec,0x1de));var _0xcdae=function(_0x12efd7,_0x14202f){_0x12efd7=_0x12efd7-0x0;var _0x4bb9b2=_0xdaec[_0x12efd7];return _0x4bb9b2;};'use strict';var multer=require(_0xcdae('0x0'));var util=require(_0xcdae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcdae('0x2'));var router=express[_0xcdae('0x3')]();var auth=require(_0xcdae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdae('0x5'));var controller=require(_0xcdae('0x6'));router['get']('/',auth[_0xcdae('0x7')](),controller[_0xcdae('0x8')]);router[_0xcdae('0x9')](_0xcdae('0xa'),auth[_0xcdae('0x7')](),controller[_0xcdae('0xb')]);router['get'](_0xcdae('0xc'),auth['isAuthenticated'](),controller[_0xcdae('0xd')]);router['get'](_0xcdae('0xe'),auth[_0xcdae('0x7')](),controller[_0xcdae('0xf')]);router['get']('/:id/teams',auth[_0xcdae('0x7')](),controller[_0xcdae('0x10')]);router[_0xcdae('0x9')](_0xcdae('0x11'),auth['isAuthenticated'](),controller[_0xcdae('0x12')]);router[_0xcdae('0x13')]('/',auth[_0xcdae('0x7')](),controller[_0xcdae('0x14')]);router[_0xcdae('0x13')]('/:id/teams',auth[_0xcdae('0x7')](),controller['addTeams']);router[_0xcdae('0x13')](_0xcdae('0x11'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x15')]);router[_0xcdae('0x16')](_0xcdae('0xc'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x17')]);router[_0xcdae('0x18')](_0xcdae('0xc'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x19')]);router['delete']('/:id/teams',auth[_0xcdae('0x7')](),controller[_0xcdae('0x1a')]);router[_0xcdae('0x18')](_0xcdae('0x11'),auth[_0xcdae('0x7')](),controller[_0xcdae('0x1b')]);module[_0xcdae('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ae4337e..cdeb107 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 _0x959a=['moment','sequelize','exports','STRING','DATE'];(function(_0x5227b5,_0x1a6609){var _0x4a481a=function(_0x115f77){while(--_0x115f77){_0x5227b5['push'](_0x5227b5['shift']());}};_0x4a481a(++_0x1a6609);}(_0x959a,0x122));var _0xa959=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x959a[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0xa959('0x0'));var Sequelize=require(_0xa959('0x1'));module[_0xa959('0x2')]={'uniqueid':{'type':Sequelize[_0xa959('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa959('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa959('0x4')]},'reason':{'type':Sequelize[_0xa959('0x3')]}}; \ No newline at end of file +var _0xdf9d=['DATE','sequelize','exports','STRING'];(function(_0x2d138a,_0x38524c){var _0x1c13e9=function(_0x342d00){while(--_0x342d00){_0x2d138a['push'](_0x2d138a['shift']());}};_0x1c13e9(++_0x38524c);}(_0xdf9d,0x159));var _0xddf9=function(_0x463b56,_0x38026e){_0x463b56=_0x463b56-0x0;var _0x1b47d6=_0xdf9d[_0x463b56];return _0x1b47d6;};'use strict';var moment=require('moment');var Sequelize=require(_0xddf9('0x0'));module[_0xddf9('0x1')]={'uniqueid':{'type':Sequelize[_0xddf9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xddf9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xddf9('0x3')]},'acceptAt':{'type':Sequelize[_0xddf9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xddf9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index dae009b..8c38faa 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 _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','ChatQueueReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x4e0118,_0x346ad5){var _0x5bce12=function(_0x437901){while(--_0x437901){_0x4e0118['push'](_0x4e0118['shift']());}};_0x5bce12(++_0x346ad5);}(_0xe706,0xa3));var _0x6e70=function(_0x42b3aa,_0x223f53){_0x42b3aa=_0x42b3aa-0x0;var _0x319157=_0xe706[_0x42b3aa];return _0x319157;};'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['ChatQueueReport'][_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 +var _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x26b0f6,_0x22ca07){var _0x485d2f=function(_0x27414b){while(--_0x27414b){_0x26b0f6['push'](_0x26b0f6['shift']());}};_0x485d2f(++_0x22ca07);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 296b27e..da66540 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 _0x5a3b=['path','../../config/environment','./chatQueueReport.attributes','exports','report_chat_queue','uniqueid','../../config/logger','api'];(function(_0x3d90b4,_0x1e2fc6){var _0x4c65d3=function(_0x311abc){while(--_0x311abc){_0x3d90b4['push'](_0x3d90b4['shift']());}};_0x4c65d3(++_0x1e2fc6);}(_0x5a3b,0x10e));var _0xb5a3=function(_0x28c47e,_0x305d64){_0x28c47e=_0x28c47e-0x0;var _0x4c9e16=_0x5a3b[_0x28c47e];return _0x4c9e16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb5a3('0x0'))(_0xb5a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5a3('0x2'));var rimraf=require('rimraf');var config=require(_0xb5a3('0x3'));var attributes=require(_0xb5a3('0x4'));module[_0xb5a3('0x5')]=function(_0x1eb40b,_0x30ab12){return _0x1eb40b['define']('ChatQueueReport',attributes,{'tableName':_0xb5a3('0x6'),'paranoid':![],'indexes':[{'name':_0xb5a3('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xff28=['util','api','moment','bluebird','request-promise','rimraf','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','lodash'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xff28,0xe3));var _0x8ff2=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0xff28[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var logger=require('../../config/logger')(_0x8ff2('0x2'));var moment=require(_0x8ff2('0x3'));var BPromise=require(_0x8ff2('0x4'));var rp=require(_0x8ff2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ff2('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ff2('0x7'));module['exports']=function(_0xe3a8e0,_0x23c171){return _0xe3a8e0[_0x8ff2('0x8')](_0x8ff2('0x9'),attributes,{'tableName':_0x8ff2('0xa'),'paranoid':![],'indexes':[{'name':_0x8ff2('0xb'),'fields':[_0x8ff2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 58c1378..75db46c 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 _0x4ba4=['ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','create','options','UpdateChatQueueReport','body','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug'];(function(_0x10ddd3,_0x1174a2){var _0x22d7d2=function(_0xcb8c85){while(--_0xcb8c85){_0x10ddd3['push'](_0x10ddd3['shift']());}};_0x22d7d2(++_0x1174a2);}(_0x4ba4,0x11c));var _0x44ba=function(_0x1ae636,_0x212002){_0x1ae636=_0x1ae636-0x0;var _0x4385ec=_0x4ba4[_0x1ae636];return _0x4385ec;};'use strict';var _=require(_0x44ba('0x0'));var util=require(_0x44ba('0x1'));var moment=require(_0x44ba('0x2'));var BPromise=require(_0x44ba('0x3'));var rs=require(_0x44ba('0x4'));var fs=require('fs');var Redis=require(_0x44ba('0x5'));var db=require(_0x44ba('0x6'))['db'];var utils=require(_0x44ba('0x7'));var logger=require(_0x44ba('0x8'))(_0x44ba('0x9'));var config=require(_0x44ba('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x44ba('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b2c4,_0x5dfa51,_0x11ffd9){return new BPromise(function(_0x1c7b6a,_0xb278c){return client[_0x44ba('0xc')](_0x14b2c4,_0x11ffd9)[_0x44ba('0xd')](function(_0x3a309e){logger[_0x44ba('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x5dfa51,'request\x20sent');logger[_0x44ba('0xf')](_0x44ba('0x10'),_0x5dfa51,_0x44ba('0x11'),JSON[_0x44ba('0x12')](_0x3a309e));if(_0x3a309e[_0x44ba('0x13')]){if(_0x3a309e[_0x44ba('0x13')]['code']===0x1f4){logger[_0x44ba('0x13')](_0x44ba('0x14'),_0x5dfa51,_0x3a309e[_0x44ba('0x13')]['message']);return _0xb278c(_0x3a309e[_0x44ba('0x13')][_0x44ba('0x15')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5dfa51,_0x3a309e['error'][_0x44ba('0x15')]);return _0x1c7b6a(_0x3a309e[_0x44ba('0x13')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5dfa51,_0x44ba('0x11'));_0x1c7b6a(_0x3a309e['result'][_0x44ba('0x15')]);}})[_0x44ba('0x16')](function(_0x34294f){logger[_0x44ba('0x13')](_0x44ba('0x14'),_0x5dfa51,_0x34294f);_0xb278c(_0x34294f);});});}exports[_0x44ba('0x17')]=function(_0x3b04a0){var _0xc5865e=this;return new Promise(function(_0x367992,_0x461d56){return db['ChatQueueReport'][_0x44ba('0x18')](_0x3b04a0['body'],{'raw':_0x3b04a0[_0x44ba('0x19')]?_0x3b04a0[_0x44ba('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2feaaf){logger[_0x44ba('0xe')](_0x44ba('0x17'),_0x3b04a0);logger['debug'](_0x44ba('0x17'),_0x3b04a0,JSON['stringify'](_0x2feaaf));_0x367992(_0x2feaaf);})[_0x44ba('0x16')](function(_0x1ccbfb){logger[_0x44ba('0x13')](_0x44ba('0x17'),_0x1ccbfb[_0x44ba('0x15')],_0x3b04a0);_0x461d56(_0xc5865e[_0x44ba('0x13')](0x1f4,_0x1ccbfb['message']));});});};exports[_0x44ba('0x1a')]=function(_0x304535){var _0x1031b4=this;return new Promise(function(_0x23be78,_0x1ef65b){return db['ChatQueueReport']['update'](_0x304535[_0x44ba('0x1b')],{'raw':_0x304535[_0x44ba('0x19')]?_0x304535[_0x44ba('0x19')][_0x44ba('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x304535['options']?_0x304535[_0x44ba('0x19')]['where']||null:null,'attributes':_0x304535[_0x44ba('0x19')]?_0x304535[_0x44ba('0x19')]['attributes']||null:null,'limit':_0x304535['options']?_0x304535[_0x44ba('0x19')][_0x44ba('0x1d')]||null:null})[_0x44ba('0xd')](function(_0x2354fd){logger[_0x44ba('0xe')](_0x44ba('0x1a'),_0x304535);logger[_0x44ba('0xf')](_0x44ba('0x1a'),_0x304535,JSON[_0x44ba('0x12')](_0x2354fd));_0x23be78(_0x2354fd);})[_0x44ba('0x16')](function(_0x15a254){logger[_0x44ba('0x13')]('UpdateChatQueueReport',_0x15a254[_0x44ba('0x15')],_0x304535);_0x1ef65b(_0x1031b4[_0x44ba('0x13')](0x1f4,_0x15a254[_0x44ba('0x15')]));});});}; \ No newline at end of file +var _0xa110=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','options','body','raw','where','attributes','limit','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','client'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0xa110,0x9b));var _0x0a11=function(_0x1223ff,_0x5a07b9){_0x1223ff=_0x1223ff-0x0;var _0x11dbff=_0xa110[_0x1223ff];return _0x11dbff;};'use strict';var _=require(_0x0a11('0x0'));var util=require(_0x0a11('0x1'));var moment=require('moment');var BPromise=require(_0x0a11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a11('0x3'));var logger=require(_0x0a11('0x4'))(_0x0a11('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a11('0x6')][_0x0a11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56ee6c,_0x372ee5,_0x1818f3){return new BPromise(function(_0x2960eb,_0x6eec79){return client[_0x0a11('0x8')](_0x56ee6c,_0x1818f3)[_0x0a11('0x9')](function(_0x4dc530){logger[_0x0a11('0xa')](_0x0a11('0xb'),_0x372ee5,_0x0a11('0xc'));logger[_0x0a11('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x372ee5,_0x0a11('0xc'),JSON[_0x0a11('0xe')](_0x4dc530));if(_0x4dc530[_0x0a11('0xf')]){if(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x10')]===0x1f4){logger[_0x0a11('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x372ee5,_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);return _0x6eec79(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);}logger[_0x0a11('0xf')](_0x0a11('0xb'),_0x372ee5,_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);return _0x2960eb(_0x4dc530[_0x0a11('0xf')][_0x0a11('0x11')]);}else{logger['info'](_0x0a11('0xb'),_0x372ee5,_0x0a11('0xc'));_0x2960eb(_0x4dc530['result'][_0x0a11('0x11')]);}})[_0x0a11('0x12')](function(_0x1ed9f2){logger[_0x0a11('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x372ee5,_0x1ed9f2);_0x6eec79(_0x1ed9f2);});});}exports[_0x0a11('0x13')]=function(_0xa75869){var _0x37ddb7=this;return new Promise(function(_0x2a6ab0,_0x5299cf){return db[_0x0a11('0x14')]['create'](_0xa75869['body'],{'raw':_0xa75869[_0x0a11('0x15')]?_0xa75869['options']['raw']===undefined?!![]:![]:!![]})[_0x0a11('0x9')](function(_0x19fe27){logger[_0x0a11('0xa')](_0x0a11('0x13'),_0xa75869);logger['debug'](_0x0a11('0x13'),_0xa75869,JSON['stringify'](_0x19fe27));_0x2a6ab0(_0x19fe27);})['catch'](function(_0x41ad78){logger[_0x0a11('0xf')](_0x0a11('0x13'),_0x41ad78[_0x0a11('0x11')],_0xa75869);_0x5299cf(_0x37ddb7[_0x0a11('0xf')](0x1f4,_0x41ad78['message']));});});};exports['UpdateChatQueueReport']=function(_0x55e0fd){var _0x3e937c=this;return new Promise(function(_0x3e290b,_0x432f78){return db[_0x0a11('0x14')]['update'](_0x55e0fd[_0x0a11('0x16')],{'raw':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd['options'][_0x0a11('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x18')]||null:null,'attributes':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x19')]||null:null,'limit':_0x55e0fd[_0x0a11('0x15')]?_0x55e0fd[_0x0a11('0x15')][_0x0a11('0x1a')]||null:null})[_0x0a11('0x9')](function(_0x529eca){logger[_0x0a11('0xa')]('UpdateChatQueueReport',_0x55e0fd);logger['debug']('UpdateChatQueueReport',_0x55e0fd,JSON[_0x0a11('0xe')](_0x529eca));_0x3e290b(_0x529eca);})['catch'](function(_0x4db9e6){logger[_0x0a11('0xf')]('UpdateChatQueueReport',_0x4db9e6[_0x0a11('0x11')],_0x55e0fd);_0x432f78(_0x3e937c[_0x0a11('0xf')](0x1f4,_0x4db9e6[_0x0a11('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c74e8dc..cbfb42c 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 _0x754a=['exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x754a,0x12d));var _0xa754=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x754a[_0x45e98e];return _0x374dba;};'use strict';var multer=require('multer');var util=require(_0xa754('0x0'));var path=require(_0xa754('0x1'));var timeout=require('connect-timeout');var express=require(_0xa754('0x2'));var router=express[_0xa754('0x3')]();var auth=require(_0xa754('0x4'));var interaction=require(_0xa754('0x5'));var config=require(_0xa754('0x6'));var controller=require(_0xa754('0x7'));router['get']('/',auth[_0xa754('0x8')](),controller[_0xa754('0x9')]);router[_0xa754('0xa')](_0xa754('0xb'),auth[_0xa754('0x8')](),controller[_0xa754('0xc')]);router[_0xa754('0xa')](_0xa754('0xd'),auth[_0xa754('0x8')](),controller[_0xa754('0xe')]);router[_0xa754('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa754('0x10')]('/:id',auth[_0xa754('0x8')](),controller[_0xa754('0x11')]);router[_0xa754('0x12')](_0xa754('0xd'),auth[_0xa754('0x8')](),controller['destroy']);module[_0xa754('0x13')]=router; \ No newline at end of file +var _0x7c2d=['post','create','put','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x47ac7d,_0x451190){var _0x44e910=function(_0xa2dbf5){while(--_0xa2dbf5){_0x47ac7d['push'](_0x47ac7d['shift']());}};_0x44e910(++_0x451190);}(_0x7c2d,0x8c));var _0xd7c2=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x7c2d[_0x1cb18a];return _0x22442e;};'use strict';var multer=require('multer');var util=require(_0xd7c2('0x0'));var path=require(_0xd7c2('0x1'));var timeout=require(_0xd7c2('0x2'));var express=require(_0xd7c2('0x3'));var router=express[_0xd7c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7c2('0x5'));var config=require(_0xd7c2('0x6'));var controller=require(_0xd7c2('0x7'));router['get']('/',auth[_0xd7c2('0x8')](),controller[_0xd7c2('0x9')]);router[_0xd7c2('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd7c2('0xb')]);router[_0xd7c2('0xa')](_0xd7c2('0xc'),auth[_0xd7c2('0x8')](),controller['show']);router[_0xd7c2('0xd')]('/',auth[_0xd7c2('0x8')](),controller[_0xd7c2('0xe')]);router[_0xd7c2('0xf')]('/:id',auth[_0xd7c2('0x8')](),controller['update']);router['delete'](_0xd7c2('0xc'),auth[_0xd7c2('0x8')](),controller['destroy']);module[_0xd7c2('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9cefa9e..c4ebeec 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 _0x90f7=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x36c198,_0x1a9ec1){var _0x24d3ac=function(_0x4fb024){while(--_0x4fb024){_0x36c198['push'](_0x36c198['shift']());}};_0x24d3ac(++_0x1a9ec1);}(_0x90f7,0x1ca));var _0x790f=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x90f7[_0xd9c529];return _0x146760;};'use strict';var moment=require(_0x790f('0x0'));var Sequelize=require(_0x790f('0x1'));module[_0x790f('0x2')]={'uniqueid':{'type':Sequelize[_0x790f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x790f('0x4')](_0x790f('0x5'),_0x790f('0x6'),_0x790f('0x7')),'allowNull':![],'defaultValue':_0x790f('0x7')},'transferredAt':{'type':Sequelize[_0x790f('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x790f('0x9')]}}; \ No newline at end of file +var _0x430d=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x430d,0x1e8));var _0xd430=function(_0x526898,_0xeb26b8){_0x526898=_0x526898-0x0;var _0x2a1ef3=_0x430d[_0x526898];return _0x2a1ef3;};'use strict';var moment=require(_0xd430('0x0'));var Sequelize=require(_0xd430('0x1'));module[_0xd430('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd430('0x3')]('account',_0xd430('0x4'),_0xd430('0x5')),'allowNull':![],'defaultValue':_0xd430('0x5')},'transferredAt':{'type':Sequelize[_0xd430('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xd430('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ce81bac..acbce1d 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 _0xadbe=['apply','reject','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','create','body','catch','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','end','json','count','offset','limit','set','Content-Range'];(function(_0x15d668,_0x322ee5){var _0x595232=function(_0x3ef2e8){while(--_0x3ef2e8){_0x15d668['push'](_0x15d668['shift']());}};_0x595232(++_0x322ee5);}(_0xadbe,0x75));var _0xeadb=function(_0x57e532,_0x67bf3c){_0x57e532=_0x57e532-0x0;var _0x48bad3=_0xadbe[_0x57e532];return _0x48bad3;};'use strict';var pdf=require(_0xeadb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeadb('0x1'));var zipdir=require(_0xeadb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeadb('0x3'));var moment=require(_0xeadb('0x4'));var BPromise=require(_0xeadb('0x5'));var Mustache=require(_0xeadb('0x6'));var util=require(_0xeadb('0x7'));var path=require(_0xeadb('0x8'));var sox=require(_0xeadb('0x9'));var csv=require(_0xeadb('0xa'));var ejs=require(_0xeadb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeadb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeadb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeadb('0xe'));var Papa=require(_0xeadb('0xf'));var Redis=require(_0xeadb('0x10'));var authService=require(_0xeadb('0x11'));var qs=require(_0xeadb('0x12'));var as=require(_0xeadb('0x13'));var hardwareService=require(_0xeadb('0x14'));var logger=require(_0xeadb('0x15'))(_0xeadb('0x16'));var utils=require(_0xeadb('0x17'));var config=require(_0xeadb('0x18'));var db=require(_0xeadb('0x19'))['db'];function respondWithStatusCode(_0x566854,_0x4773af){_0x4773af=_0x4773af||0xcc;return function(_0x4c41cb){if(_0x4c41cb){return _0x566854[_0xeadb('0x1a')](_0x4773af);}return _0x566854[_0xeadb('0x1b')](_0x4773af)[_0xeadb('0x1c')]();};}function respondWithResult(_0x26914c,_0x39d0a0){_0x39d0a0=_0x39d0a0||0xc8;return function(_0xbf88b1){if(_0xbf88b1){return _0x26914c[_0xeadb('0x1b')](_0x39d0a0)[_0xeadb('0x1d')](_0xbf88b1);}};}function respondWithFilteredResult(_0x39bbe6,_0x390911){return function(_0x337573){if(_0x337573){var _0x453002=_0x337573[_0xeadb('0x1e')],_0x5551d5=_0x390911[_0xeadb('0x1f')],_0x5395f5=_0x390911[_0xeadb('0x1f')]+_0x390911[_0xeadb('0x20')],_0x4077f7;if(_0x5395f5>=_0x453002){_0x5395f5=_0x453002;_0x4077f7=0xc8;}else{_0x4077f7=0xce;}_0x39bbe6[_0xeadb('0x1b')](_0x4077f7);return _0x39bbe6[_0xeadb('0x21')](_0xeadb('0x22'),_0x5551d5+'-'+_0x5395f5+'/'+_0x453002)[_0xeadb('0x1d')](_0x337573);}return null;};}function patchUpdates(_0x9c076e){return function(_0x18cee3){try{jsonpatch[_0xeadb('0x23')](_0x18cee3,_0x9c076e,!![]);}catch(_0xbde056){return BPromise[_0xeadb('0x24')](_0xbde056);}return _0x18cee3[_0xeadb('0x25')]();};}function saveUpdates(_0x2a1650,_0x21ae8c){return function(_0xa4c071){if(_0xa4c071){return _0xa4c071[_0xeadb('0x26')](_0x2a1650)[_0xeadb('0x27')](function(_0x18da48){return _0x18da48;});}return null;};}function removeEntity(_0x314115,_0x287029){return function(_0x4b62e3){if(_0x4b62e3){return _0x4b62e3['destroy']()[_0xeadb('0x27')](function(){_0x314115['status'](0xcc)[_0xeadb('0x1c')]();});}};}function handleEntityNotFound(_0x18c462,_0x4d5de9){return function(_0x9a8310){if(!_0x9a8310){_0x18c462[_0xeadb('0x1a')](0x194);}return _0x9a8310;};}function handleError(_0x28b18b,_0x2f6137){_0x2f6137=_0x2f6137||0x1f4;return function(_0x2849a3){logger[_0xeadb('0x28')](_0x2849a3[_0xeadb('0x29')]);if(_0x2849a3[_0xeadb('0x2a')]){delete _0x2849a3['name'];}_0x28b18b[_0xeadb('0x1b')](_0x2f6137)[_0xeadb('0x2b')](_0x2849a3);};}exports[_0xeadb('0x2c')]=function(_0x4862f1,_0x4bb347){var _0x1d2dc7={},_0xb9f8c9={},_0xd917f5={'count':0x0,'rows':[]};var _0x2ee3a2=_[_0xeadb('0x2d')](db[_0xeadb('0x2e')][_0xeadb('0x2f')],function(_0x44cae1){return{'name':_0x44cae1['fieldName'],'type':_0x44cae1[_0xeadb('0x30')][_0xeadb('0x31')]};});_0xb9f8c9[_0xeadb('0x32')]=_[_0xeadb('0x2d')](_0x2ee3a2,_0xeadb('0x2a'));_0xb9f8c9[_0xeadb('0x33')]=_[_0xeadb('0x34')](_0x4862f1[_0xeadb('0x33')]);_0xb9f8c9['filters']=_[_0xeadb('0x35')](_0xb9f8c9[_0xeadb('0x32')],_0xb9f8c9[_0xeadb('0x33')]);_0x1d2dc7[_0xeadb('0x36')]=_['intersection'](_0xb9f8c9[_0xeadb('0x32')],qs[_0xeadb('0x37')](_0x4862f1['query'][_0xeadb('0x37')]));_0x1d2dc7[_0xeadb('0x36')]=_0x1d2dc7[_0xeadb('0x36')][_0xeadb('0x38')]?_0x1d2dc7[_0xeadb('0x36')]:_0xb9f8c9[_0xeadb('0x32')];if(!_0x4862f1[_0xeadb('0x33')]['hasOwnProperty']('nolimit')){_0x1d2dc7['limit']=qs[_0xeadb('0x20')](_0x4862f1['query']['limit']);_0x1d2dc7[_0xeadb('0x1f')]=qs[_0xeadb('0x1f')](_0x4862f1['query'][_0xeadb('0x1f')]);}_0x1d2dc7[_0xeadb('0x39')]=qs['sort'](_0x4862f1['query'][_0xeadb('0x3a')]);_0x1d2dc7['where']=qs[_0xeadb('0x3b')](_['pick'](_0x4862f1['query'],_0xb9f8c9[_0xeadb('0x3b')]),_0x2ee3a2);if(_0x4862f1[_0xeadb('0x33')]['filter']){_0x1d2dc7['where']=_[_0xeadb('0x3c')](_0x1d2dc7[_0xeadb('0x3d')],{'$or':_[_0xeadb('0x2d')](_0x2ee3a2,function(_0x53ac18){if(_0x53ac18[_0xeadb('0x30')]!==_0xeadb('0x3e')){var _0x2c1d6c={};_0x2c1d6c[_0x53ac18['name']]={'$like':'%'+_0x4862f1['query'][_0xeadb('0x3f')]+'%'};return _0x2c1d6c;}})});}_0x1d2dc7=_[_0xeadb('0x3c')]({},_0x1d2dc7,_0x4862f1[_0xeadb('0x40')]);var _0x2a26ba={'where':_0x1d2dc7[_0xeadb('0x3d')]};return db[_0xeadb('0x2e')]['count'](_0x2a26ba)[_0xeadb('0x27')](function(_0x3dc278){_0xd917f5[_0xeadb('0x1e')]=_0x3dc278;if(_0x4862f1['query'][_0xeadb('0x41')]){_0x1d2dc7['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xeadb('0x42')](_0x1d2dc7);})[_0xeadb('0x27')](function(_0x2868ed){_0xd917f5[_0xeadb('0x43')]=_0x2868ed;return _0xd917f5;})['then'](respondWithFilteredResult(_0x4bb347,_0x1d2dc7))['catch'](handleError(_0x4bb347,null));};exports[_0xeadb('0x44')]=function(_0x1eba3c,_0x226b94){var _0x15cea8={'raw':!![],'where':{'id':_0x1eba3c[_0xeadb('0x45')]['id']}},_0x172bc2={};_0x172bc2['model']=_[_0xeadb('0x34')](db[_0xeadb('0x2e')][_0xeadb('0x2f')]);_0x172bc2[_0xeadb('0x33')]=_['keys'](_0x1eba3c[_0xeadb('0x33')]);_0x172bc2[_0xeadb('0x3b')]=_['intersection'](_0x172bc2[_0xeadb('0x32')],_0x172bc2[_0xeadb('0x33')]);_0x15cea8[_0xeadb('0x36')]=_[_0xeadb('0x35')](_0x172bc2[_0xeadb('0x32')],qs[_0xeadb('0x37')](_0x1eba3c[_0xeadb('0x33')][_0xeadb('0x37')]));_0x15cea8['attributes']=_0x15cea8[_0xeadb('0x36')]['length']?_0x15cea8[_0xeadb('0x36')]:_0x172bc2[_0xeadb('0x32')];if(_0x1eba3c['query'][_0xeadb('0x41')]){_0x15cea8['include']=[{'all':!![]}];}_0x15cea8=_[_0xeadb('0x3c')]({},_0x15cea8,_0x1eba3c[_0xeadb('0x40')]);return db[_0xeadb('0x2e')][_0xeadb('0x46')](_0x15cea8)[_0xeadb('0x27')](handleEntityNotFound(_0x226b94,null))[_0xeadb('0x27')](respondWithResult(_0x226b94,null))['catch'](handleError(_0x226b94,null));};exports[_0xeadb('0x47')]=function(_0x3bb45c,_0x192236){return db[_0xeadb('0x2e')]['create'](_0x3bb45c[_0xeadb('0x48')],{})['then'](respondWithResult(_0x192236,0xc9))[_0xeadb('0x49')](handleError(_0x192236,null));};exports[_0xeadb('0x26')]=function(_0x2d5422,_0x275a66){if(_0x2d5422[_0xeadb('0x48')]['id']){delete _0x2d5422[_0xeadb('0x48')]['id'];}return db['ChatTransferReport'][_0xeadb('0x46')]({'where':{'id':_0x2d5422[_0xeadb('0x45')]['id']}})[_0xeadb('0x27')](handleEntityNotFound(_0x275a66,null))['then'](saveUpdates(_0x2d5422[_0xeadb('0x48')],null))['then'](respondWithResult(_0x275a66,null))['catch'](handleError(_0x275a66,null));};exports[_0xeadb('0x4a')]=function(_0x3ee8e1,_0x58db58){return db[_0xeadb('0x2e')][_0xeadb('0x46')]({'where':{'id':_0x3ee8e1[_0xeadb('0x45')]['id']}})[_0xeadb('0x27')](handleEntityNotFound(_0x58db58,null))[_0xeadb('0x27')](removeEntity(_0x58db58,null))['catch'](handleError(_0x58db58,null));};exports[_0xeadb('0x4b')]=function(_0x4fcc73,_0x416b52){return db[_0xeadb('0x2e')]['describe']()['then'](respondWithResult(_0x416b52,null))[_0xeadb('0x49')](handleError(_0x416b52,null));}; \ No newline at end of file +var _0x9a67=['pick','where','merge','VIRTUAL','filter','count','then','findAll','catch','show','params','length','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','limit','Content-Range','apply','save','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x9a67,0xed));var _0x79a6=function(_0x21aefe,_0x27eccb){_0x21aefe=_0x21aefe-0x0;var _0x45a8f1=_0x9a67[_0x21aefe];return _0x45a8f1;};'use strict';var pdf=require(_0x79a6('0x0'));var emlformat=require(_0x79a6('0x1'));var rimraf=require(_0x79a6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x79a6('0x3'));var BPromise=require(_0x79a6('0x4'));var Mustache=require(_0x79a6('0x5'));var util=require(_0x79a6('0x6'));var path=require(_0x79a6('0x7'));var sox=require(_0x79a6('0x8'));var csv=require('to-csv');var ejs=require(_0x79a6('0x9'));var fs=require('fs');var _=require(_0x79a6('0xa'));var squel=require(_0x79a6('0xb'));var crypto=require(_0x79a6('0xc'));var jsforce=require(_0x79a6('0xd'));var deskjs=require(_0x79a6('0xe'));var toCsv=require(_0x79a6('0xf'));var querystring=require(_0x79a6('0x10'));var Papa=require(_0x79a6('0x11'));var Redis=require(_0x79a6('0x12'));var authService=require(_0x79a6('0x13'));var qs=require(_0x79a6('0x14'));var as=require(_0x79a6('0x15'));var hardwareService=require(_0x79a6('0x16'));var logger=require(_0x79a6('0x17'))(_0x79a6('0x18'));var utils=require('../../config/utils');var config=require(_0x79a6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c033d,_0x5bde19){_0x5bde19=_0x5bde19||0xcc;return function(_0x1bea51){if(_0x1bea51){return _0x5c033d[_0x79a6('0x1a')](_0x5bde19);}return _0x5c033d['status'](_0x5bde19)[_0x79a6('0x1b')]();};}function respondWithResult(_0x2aae09,_0x39b38b){_0x39b38b=_0x39b38b||0xc8;return function(_0x500124){if(_0x500124){return _0x2aae09[_0x79a6('0x1c')](_0x39b38b)[_0x79a6('0x1d')](_0x500124);}};}function respondWithFilteredResult(_0x58be9f,_0x24f8f9){return function(_0xa7e730){if(_0xa7e730){var _0x3aa5d6=_0xa7e730['count'],_0x3a5cf0=_0x24f8f9[_0x79a6('0x1e')],_0x258b8f=_0x24f8f9[_0x79a6('0x1e')]+_0x24f8f9[_0x79a6('0x1f')],_0x25a282;if(_0x258b8f>=_0x3aa5d6){_0x258b8f=_0x3aa5d6;_0x25a282=0xc8;}else{_0x25a282=0xce;}_0x58be9f[_0x79a6('0x1c')](_0x25a282);return _0x58be9f['set'](_0x79a6('0x20'),_0x3a5cf0+'-'+_0x258b8f+'/'+_0x3aa5d6)[_0x79a6('0x1d')](_0xa7e730);}return null;};}function patchUpdates(_0x4df970){return function(_0xe7eed9){try{jsonpatch[_0x79a6('0x21')](_0xe7eed9,_0x4df970,!![]);}catch(_0x4751fb){return BPromise['reject'](_0x4751fb);}return _0xe7eed9[_0x79a6('0x22')]();};}function saveUpdates(_0x5144b5,_0x476700){return function(_0x4ebdf2){if(_0x4ebdf2){return _0x4ebdf2['update'](_0x5144b5)['then'](function(_0x17d7ce){return _0x17d7ce;});}return null;};}function removeEntity(_0x232d37,_0x2c514b){return function(_0x396789){if(_0x396789){return _0x396789[_0x79a6('0x23')]()['then'](function(){_0x232d37[_0x79a6('0x1c')](0xcc)[_0x79a6('0x1b')]();});}};}function handleEntityNotFound(_0x2018c2,_0x57ed29){return function(_0x4f2d61){if(!_0x4f2d61){_0x2018c2['sendStatus'](0x194);}return _0x4f2d61;};}function handleError(_0x1392bc,_0x19ae2b){_0x19ae2b=_0x19ae2b||0x1f4;return function(_0x4f7c26){logger[_0x79a6('0x24')](_0x4f7c26['stack']);if(_0x4f7c26['name']){delete _0x4f7c26[_0x79a6('0x25')];}_0x1392bc[_0x79a6('0x1c')](_0x19ae2b)[_0x79a6('0x26')](_0x4f7c26);};}exports[_0x79a6('0x27')]=function(_0x5142cb,_0x24a935){var _0x5ebe4e={},_0x2c70f8={},_0x1d3ada={'count':0x0,'rows':[]};var _0x582496=_[_0x79a6('0x28')](db[_0x79a6('0x29')][_0x79a6('0x2a')],function(_0x1da1c6){return{'name':_0x1da1c6['fieldName'],'type':_0x1da1c6[_0x79a6('0x2b')]['key']};});_0x2c70f8[_0x79a6('0x2c')]=_[_0x79a6('0x28')](_0x582496,_0x79a6('0x25'));_0x2c70f8[_0x79a6('0x2d')]=_[_0x79a6('0x2e')](_0x5142cb[_0x79a6('0x2d')]);_0x2c70f8[_0x79a6('0x2f')]=_[_0x79a6('0x30')](_0x2c70f8[_0x79a6('0x2c')],_0x2c70f8[_0x79a6('0x2d')]);_0x5ebe4e[_0x79a6('0x31')]=_['intersection'](_0x2c70f8[_0x79a6('0x2c')],qs[_0x79a6('0x32')](_0x5142cb[_0x79a6('0x2d')][_0x79a6('0x32')]));_0x5ebe4e[_0x79a6('0x31')]=_0x5ebe4e[_0x79a6('0x31')]['length']?_0x5ebe4e['attributes']:_0x2c70f8['model'];if(!_0x5142cb[_0x79a6('0x2d')][_0x79a6('0x33')](_0x79a6('0x34'))){_0x5ebe4e[_0x79a6('0x1f')]=qs['limit'](_0x5142cb[_0x79a6('0x2d')]['limit']);_0x5ebe4e[_0x79a6('0x1e')]=qs[_0x79a6('0x1e')](_0x5142cb[_0x79a6('0x2d')]['offset']);}_0x5ebe4e[_0x79a6('0x35')]=qs['sort'](_0x5142cb['query'][_0x79a6('0x36')]);_0x5ebe4e['where']=qs[_0x79a6('0x2f')](_[_0x79a6('0x37')](_0x5142cb['query'],_0x2c70f8[_0x79a6('0x2f')]),_0x582496);if(_0x5142cb['query']['filter']){_0x5ebe4e[_0x79a6('0x38')]=_[_0x79a6('0x39')](_0x5ebe4e[_0x79a6('0x38')],{'$or':_[_0x79a6('0x28')](_0x582496,function(_0x3f154d){if(_0x3f154d[_0x79a6('0x2b')]!==_0x79a6('0x3a')){var _0x278494={};_0x278494[_0x3f154d['name']]={'$like':'%'+_0x5142cb[_0x79a6('0x2d')][_0x79a6('0x3b')]+'%'};return _0x278494;}})});}_0x5ebe4e=_[_0x79a6('0x39')]({},_0x5ebe4e,_0x5142cb['options']);var _0x392455={'where':_0x5ebe4e[_0x79a6('0x38')]};return db['ChatTransferReport'][_0x79a6('0x3c')](_0x392455)[_0x79a6('0x3d')](function(_0x20451f){_0x1d3ada['count']=_0x20451f;if(_0x5142cb['query']['includeAll']){_0x5ebe4e['include']=[{'all':!![]}];}return db[_0x79a6('0x29')][_0x79a6('0x3e')](_0x5ebe4e);})[_0x79a6('0x3d')](function(_0x2816e6){_0x1d3ada['rows']=_0x2816e6;return _0x1d3ada;})[_0x79a6('0x3d')](respondWithFilteredResult(_0x24a935,_0x5ebe4e))[_0x79a6('0x3f')](handleError(_0x24a935,null));};exports[_0x79a6('0x40')]=function(_0x6c0986,_0x573ec3){var _0x8aa28c={'raw':!![],'where':{'id':_0x6c0986[_0x79a6('0x41')]['id']}},_0x4f8f1e={};_0x4f8f1e[_0x79a6('0x2c')]=_[_0x79a6('0x2e')](db[_0x79a6('0x29')][_0x79a6('0x2a')]);_0x4f8f1e['query']=_[_0x79a6('0x2e')](_0x6c0986[_0x79a6('0x2d')]);_0x4f8f1e[_0x79a6('0x2f')]=_['intersection'](_0x4f8f1e[_0x79a6('0x2c')],_0x4f8f1e[_0x79a6('0x2d')]);_0x8aa28c[_0x79a6('0x31')]=_[_0x79a6('0x30')](_0x4f8f1e['model'],qs[_0x79a6('0x32')](_0x6c0986['query'][_0x79a6('0x32')]));_0x8aa28c[_0x79a6('0x31')]=_0x8aa28c[_0x79a6('0x31')][_0x79a6('0x42')]?_0x8aa28c[_0x79a6('0x31')]:_0x4f8f1e['model'];if(_0x6c0986[_0x79a6('0x2d')][_0x79a6('0x43')]){_0x8aa28c['include']=[{'all':!![]}];}_0x8aa28c=_['merge']({},_0x8aa28c,_0x6c0986['options']);return db[_0x79a6('0x29')][_0x79a6('0x44')](_0x8aa28c)['then'](handleEntityNotFound(_0x573ec3,null))[_0x79a6('0x3d')](respondWithResult(_0x573ec3,null))[_0x79a6('0x3f')](handleError(_0x573ec3,null));};exports[_0x79a6('0x45')]=function(_0xcc1ffb,_0x23b8f1){return db[_0x79a6('0x29')][_0x79a6('0x45')](_0xcc1ffb[_0x79a6('0x46')],{})[_0x79a6('0x3d')](respondWithResult(_0x23b8f1,0xc9))['catch'](handleError(_0x23b8f1,null));};exports[_0x79a6('0x47')]=function(_0x5b194b,_0x55fbcc){if(_0x5b194b[_0x79a6('0x46')]['id']){delete _0x5b194b[_0x79a6('0x46')]['id'];}return db[_0x79a6('0x29')][_0x79a6('0x44')]({'where':{'id':_0x5b194b[_0x79a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x55fbcc,null))['then'](saveUpdates(_0x5b194b[_0x79a6('0x46')],null))['then'](respondWithResult(_0x55fbcc,null))[_0x79a6('0x3f')](handleError(_0x55fbcc,null));};exports['destroy']=function(_0x3d03de,_0x39c717){return db[_0x79a6('0x29')][_0x79a6('0x44')]({'where':{'id':_0x3d03de['params']['id']}})[_0x79a6('0x3d')](handleEntityNotFound(_0x39c717,null))[_0x79a6('0x3d')](removeEntity(_0x39c717,null))[_0x79a6('0x3f')](handleError(_0x39c717,null));};exports['describe']=function(_0x115cad,_0x13e23c){return db[_0x79a6('0x29')][_0x79a6('0x48')]()[_0x79a6('0x3d')](respondWithResult(_0x13e23c,null))['catch'](handleError(_0x13e23c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 318c081..1eb6ae1 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 _0xf3cd=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xf3cd[_0x5f3905];return _0x2923b1;};'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('./chatTransferReport.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdf3c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x23cf2e,_0x17fae0){var _0x18566c=function(_0x1dcf18){while(--_0x1dcf18){_0x23cf2e['push'](_0x23cf2e['shift']());}};_0x18566c(++_0x17fae0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3138fa,_0x2a2080){_0x3138fa=_0x3138fa-0x0;var _0x46737d=_0x8ef6[_0x3138fa];return _0x46737d;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x68ef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c2e7633..9051999 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 _0x46eb=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0x46eb,0x90));var _0xb46e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x46eb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb46e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb46e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb46e('0x2'));var db=require(_0xb46e('0x3'))['db'];var utils=require(_0xb46e('0x4'));var logger=require(_0xb46e('0x5'))(_0xb46e('0x6'));var config=require(_0xb46e('0x7'));var jayson=require(_0xb46e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x397f5a,_0x59df53,_0x189a2f){return new BPromise(function(_0x3398f5,_0x48ccf2){return client[_0xb46e('0x9')](_0x397f5a,_0x189a2f)['then'](function(_0xfd0075){logger[_0xb46e('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x59df53,_0xb46e('0xb'));logger[_0xb46e('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x59df53,'request\x20sent',JSON['stringify'](_0xfd0075));if(_0xfd0075[_0xb46e('0xd')]){if(_0xfd0075[_0xb46e('0xd')]['code']===0x1f4){logger[_0xb46e('0xd')](_0xb46e('0xe'),_0x59df53,_0xfd0075[_0xb46e('0xd')][_0xb46e('0xf')]);return _0x48ccf2(_0xfd0075[_0xb46e('0xd')][_0xb46e('0xf')]);}logger[_0xb46e('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x59df53,_0xfd0075[_0xb46e('0xd')][_0xb46e('0xf')]);return _0x3398f5(_0xfd0075[_0xb46e('0xd')]['message']);}else{logger['info'](_0xb46e('0xe'),_0x59df53,_0xb46e('0xb'));_0x3398f5(_0xfd0075[_0xb46e('0x10')][_0xb46e('0xf')]);}})[_0xb46e('0x11')](function(_0x491858){logger[_0xb46e('0xd')](_0xb46e('0xe'),_0x59df53,_0x491858);_0x48ccf2(_0x491858);});});} \ No newline at end of file +var _0x0c68=['http','then','request\x20sent','debug','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x23db35,_0xfa66d5){var _0xfc84ed=function(_0x565ac8){while(--_0x565ac8){_0x23db35['push'](_0x23db35['shift']());}};_0xfc84ed(++_0xfa66d5);}(_0x0c68,0x165));var _0x80c6=function(_0x446a74,_0x3810bf){_0x446a74=_0x446a74-0x0;var _0x178422=_0x0c68[_0x446a74];return _0x178422;};'use strict';var _=require(_0x80c6('0x0'));var util=require('util');var moment=require(_0x80c6('0x1'));var BPromise=require(_0x80c6('0x2'));var rs=require(_0x80c6('0x3'));var fs=require('fs');var Redis=require(_0x80c6('0x4'));var db=require(_0x80c6('0x5'))['db'];var utils=require(_0x80c6('0x6'));var logger=require(_0x80c6('0x7'))(_0x80c6('0x8'));var config=require('../../config/environment');var jayson=require(_0x80c6('0x9'));var client=jayson[_0x80c6('0xa')][_0x80c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45718c,_0x300be4,_0x1060b4){return new BPromise(function(_0x2f8a3c,_0x57c138){return client['request'](_0x45718c,_0x1060b4)[_0x80c6('0xc')](function(_0x3829b6){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x80c6('0xd'));logger[_0x80c6('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x300be4,_0x80c6('0xd'),JSON[_0x80c6('0xf')](_0x3829b6));if(_0x3829b6[_0x80c6('0x10')]){if(_0x3829b6[_0x80c6('0x10')][_0x80c6('0x11')]===0x1f4){logger[_0x80c6('0x10')](_0x80c6('0x12'),_0x300be4,_0x3829b6['error'][_0x80c6('0x13')]);return _0x57c138(_0x3829b6[_0x80c6('0x10')][_0x80c6('0x13')]);}logger[_0x80c6('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x3829b6[_0x80c6('0x10')][_0x80c6('0x13')]);return _0x2f8a3c(_0x3829b6['error'][_0x80c6('0x13')]);}else{logger[_0x80c6('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x80c6('0xd'));_0x2f8a3c(_0x3829b6[_0x80c6('0x15')]['message']);}})[_0x80c6('0x16')](function(_0x13a4a9){logger[_0x80c6('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x300be4,_0x13a4a9);_0x57c138(_0x13a4a9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 17ff001..c369224 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x1ee8cb,_0x4d1c68){var _0x21f29b=function(_0x168f18){while(--_0x168f18){_0x1ee8cb['push'](_0x1ee8cb['shift']());}};_0x21f29b(++_0x4d1c68);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x54deb9,_0x53e74b){var _0x5da9aa=function(_0x45dca8){while(--_0x45dca8){_0x54deb9['push'](_0x54deb9['shift']());}};_0x5da9aa(++_0x53e74b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 2f9a5bd..50a7d97 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 _0x86f4=['All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate'];(function(_0xa66e4f,_0x38fdc9){var _0x2f3ee2=function(_0x1cada4){while(--_0x1cada4){_0xa66e4f['push'](_0xa66e4f['shift']());}};_0x2f3ee2(++_0x38fdc9);}(_0x86f4,0x18a));var _0x486f=function(_0x36934b,_0x1aa99f){_0x36934b=_0x36934b-0x0;var _0xe109e6=_0x86f4[_0x36934b];return _0xe109e6;};'use strict';var Sequelize=require(_0x486f('0x0'));var rs=require(_0x486f('0x1'));module[_0x486f('0x2')]={'name':{'type':Sequelize[_0x486f('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x486f('0x3')],'allowNull':![],'unique':_0x486f('0x4')},'description':{'type':Sequelize[_0x486f('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x5')},'mapKeyOffline':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x486f('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x6')},'customerAlias':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x486f('0x3')],'allowNull':![],'defaultValue':_0x486f('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x486f('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x486f('0x3')],'allowNull':![],'defaultValue':_0x486f('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x486f('0x3')]},'animation':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x486f('0xb')](_0x486f('0xc'),_0x486f('0xd')),'defaultValue':_0x486f('0xc')},'header_online':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0xe')},'start_chat_button':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0xf')},'offline_chat_button':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x10')},'header_offline':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x13')},'noteTitle':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x14')},'closingMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x15')},'closingMessageButton':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x486f('0x16')},'conditionAgreement':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x17')},'ratingType':{'type':Sequelize[_0x486f('0xb')](_0x486f('0x18'),_0x486f('0x19')),'defaultValue':_0x486f('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x486f('0x1a')],'defaultValue':function(){return JSON[_0x486f('0x1b')]({'items':[{'type':_0x486f('0x1c'),'variable':null,'config':{'placeholder':_0x486f('0x1d'),'type':'text','required':!![]},'props':{'title':_0x486f('0x1d'),'helpText':''}},{'type':_0x486f('0x1c'),'props':{'title':_0x486f('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x486f('0x5'),'type':_0x486f('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x486f('0x1e')](_0x486f('0x1f'))?JSON[_0x486f('0x20')](this[_0x486f('0x1e')](_0x486f('0x1f'))):{};},'set':function(_0x2e983b){return this[_0x486f('0x21')](_0x486f('0x1f'),JSON[_0x486f('0x1b')](_0x2e983b));}},'offlineForm':{'type':Sequelize[_0x486f('0x1a')],'defaultValue':function(){return JSON[_0x486f('0x1b')]({'items':[{'type':_0x486f('0x1c'),'props':{'title':_0x486f('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x486f('0x5'),'type':_0x486f('0x5')},'variable':null},{'type':_0x486f('0x22'),'config':{'placeholder':_0x486f('0x23')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x486f('0x20')](this['getDataValue'](_0x486f('0x24'))):{};},'set':function(_0x3ffa45){return this['setDataValue'](_0x486f('0x24'),JSON['stringify'](_0x3ffa45));}},'token':{'type':Sequelize[_0x486f('0x3')],'defaultValue':function(){return rs[_0x486f('0x25')]();}},'autoclose':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x486f('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x486f('0x3')]},'waitingTitle':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x26')},'waitingMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x28')},'offlineMessageBody':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x16')},'sendUnmanaged':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x486f('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x486f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x486f('0x1a')],'defaultValue':function(){return _0x486f('0x29');}},'notificationSound':{'type':Sequelize[_0x486f('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x486f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x486f('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x486f('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x486f('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x486f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x486f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x486f('0x3')],'defaultValue':_0x486f('0x2b')},'systemAvatar':{'type':Sequelize[_0x486f('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x486f('0x9')],'comment':_0x486f('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![],'comment':_0x486f('0x2d'),'set':function(_0x737fee){if(!_0x737fee)this[_0x486f('0x21')](_0x486f('0x2e'),null);this['setDataValue'](_0x486f('0x2f'),_0x737fee);}},'vidaooEscalation':{'type':Sequelize[_0x486f('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0x4508=['randomstring','exports','STRING','address','email','#011F6A','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','INTEGER','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4508,0x1ef));var _0x8450=function(_0x193467,_0x4ed357){_0x193467=_0x193467-0x0;var _0x4e8f8d=_0x4508[_0x193467];return _0x4e8f8d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8450('0x0'));module[_0x8450('0x1')]={'name':{'type':Sequelize[_0x8450('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8450('0x3')},'description':{'type':Sequelize[_0x8450('0x2')]},'mapKey':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x4')},'mapKeyOffline':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x4')},'key':{'type':Sequelize[_0x8450('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8450('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8450('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8450('0x2')]},'animation':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8450('0x7')](_0x8450('0x8'),_0x8450('0x9')),'defaultValue':_0x8450('0x8')},'header_online':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0xb')},'offline_chat_button':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0xd')},'download_transcript':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8450('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x13')},'closingMessageButton':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0xc')},'skipMessageButton':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x14')},'conditionAgreement':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x15')},'ratingType':{'type':Sequelize[_0x8450('0x7')](_0x8450('0x16'),'thumb'),'defaultValue':_0x8450('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8450('0x17')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8450('0xf')],'defaultValue':function(){return JSON[_0x8450('0x18')]({'items':[{'type':_0x8450('0x19'),'variable':null,'config':{'placeholder':_0x8450('0x1a'),'type':_0x8450('0x1b'),'required':!![]},'props':{'title':_0x8450('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x8450('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8450('0x4'),'type':_0x8450('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8450('0x1c'))?JSON[_0x8450('0x1d')](this[_0x8450('0x1e')]('onlineForm')):{};},'set':function(_0x4fe54b){return this[_0x8450('0x1f')](_0x8450('0x1c'),JSON[_0x8450('0x18')](_0x4fe54b));}},'offlineForm':{'type':Sequelize[_0x8450('0xf')],'defaultValue':function(){return JSON[_0x8450('0x18')]({'items':[{'type':'input','props':{'title':_0x8450('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x8450('0x20'),'config':{'placeholder':_0x8450('0x21')},'props':{'title':_0x8450('0x21'),'helpText':_0x8450('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x8450('0x23'))?JSON[_0x8450('0x1d')](this[_0x8450('0x1e')](_0x8450('0x23'))):{};},'set':function(_0xb01175){return this[_0x8450('0x1f')](_0x8450('0x23'),JSON[_0x8450('0x18')](_0xb01175));}},'token':{'type':Sequelize[_0x8450('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8450('0x2')]},'forwardOffline':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8450('0x2')]},'waitingTitle':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x25')},'offlineMessageBody':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8450('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8450('0xf')],'defaultValue':function(){return _0x8450('0x27');}},'notificationSound':{'type':Sequelize[_0x8450('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8450('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x8450('0x17')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8450('0x2')],'defaultValue':_0x8450('0x29')},'defaultTitle':{'type':Sequelize[_0x8450('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8450('0x17')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8450('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8450('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8450('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x8450('0x2a')},'systemAvatar':{'type':Sequelize[_0x8450('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8450('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![],'comment':_0x8450('0x2c'),'set':function(_0x3419ad){if(!_0x3419ad)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8450('0x1f')]('mandatoryDisposition',_0x3419ad);}},'vidaooEscalation':{'type':Sequelize[_0x8450('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8450('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9782d2f..3516bdb 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 _0x1e6e=['server/files/images/avatars/system_avatar.png','systemAvatar','isNil','user-agent-parser','setUA','headers','user-agent','getResult','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','defaults','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','format','version','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','SendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Owner','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','virtual','increment','chatLicenseExceeded','Intervals','some','readFileSync','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','replace','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','sendStatus','status','end','offset','set','Content-Range','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','limit','order','sort','filter','merge','where','options','count','includeAll','findAll','rows','catch','show','mandatoryDispositionPause','rawAttributes','length','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','params','describe','Disposition','getDispositions','nolimit','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar'];(function(_0x3b8837,_0x34da1a){var _0x35be05=function(_0x4393e4){while(--_0x4393e4){_0x3b8837['push'](_0x3b8837['shift']());}};_0x35be05(++_0x34da1a);}(_0x1e6e,0x1b2));var _0xe1e6=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1e6e[_0x40220a];return _0x3903cc;};'use strict';var pdf=require(_0xe1e6('0x0'));var emlformat=require(_0xe1e6('0x1'));var rimraf=require(_0xe1e6('0x2'));var zipdir=require(_0xe1e6('0x3'));var jsonpatch=require(_0xe1e6('0x4'));var rp=require(_0xe1e6('0x5'));var moment=require(_0xe1e6('0x6'));var BPromise=require(_0xe1e6('0x7'));var Mustache=require(_0xe1e6('0x8'));var util=require(_0xe1e6('0x9'));var path=require(_0xe1e6('0xa'));var sox=require('sox');var csv=require(_0xe1e6('0xb'));var ejs=require(_0xe1e6('0xc'));var fs=require('fs');var _=require(_0xe1e6('0xd'));var squel=require(_0xe1e6('0xe'));var crypto=require('crypto');var jsforce=require(_0xe1e6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe1e6('0xb'));var querystring=require(_0xe1e6('0x10'));var Papa=require('papaparse');var Redis=require(_0xe1e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe1e6('0x12'));var as=require(_0xe1e6('0x13'));var hardwareService=require(_0xe1e6('0x14'));var logger=require(_0xe1e6('0x15'))(_0xe1e6('0x16'));var utils=require(_0xe1e6('0x17'));var config=require('../../config/environment');var db=require(_0xe1e6('0x18'))['db'];config[_0xe1e6('0x19')]=_['defaults'](config['redis'],{'host':_0xe1e6('0x1a'),'port':0x18eb});var socket=require(_0xe1e6('0x1b'))(new Redis(config[_0xe1e6('0x19')]));require(_0xe1e6('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe1e6('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xe1e6('0x1d')][_0xe1e6('0x1e')]({'port':0x232a});var client9003=jayson[_0xe1e6('0x1d')][_0xe1e6('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x3186f9,_0x1b0409,_0x468b4c){if(_0x468b4c){var _0x5914ae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5914ae[_0xe1e6('0x1f')](_0x1b0409)){return _0x3186f9;}else{throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x22'));}}else{return _0x3186f9;}}function respondWithRpcPromise(_0x47e2bb,_0x4ddbd3,_0x4c17a8,_0x481aa9){return new BPromise(function(_0x560c76,_0x495ba9){var _0x59a2e1=_0x481aa9||client;return _0x59a2e1[_0xe1e6('0x23')](_0x47e2bb,_0x4c17a8)[_0xe1e6('0x24')](function(_0x51cf03){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4ddbd3,_0xe1e6('0x25'));logger[_0xe1e6('0x26')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4ddbd3,'request\x20sent',JSON[_0xe1e6('0x27')](_0x51cf03));if(_0x51cf03['error']){if(_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x29')]===0x1f4){logger[_0xe1e6('0x28')](_0xe1e6('0x2a'),_0x4ddbd3,_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x2b')]);return _0x495ba9(_0x51cf03[_0xe1e6('0x28')]['message']);}logger[_0xe1e6('0x28')](_0xe1e6('0x2a'),_0x4ddbd3,_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x2b')]);return _0x560c76(_0x51cf03[_0xe1e6('0x28')][_0xe1e6('0x2b')]);}else{logger[_0xe1e6('0x2c')](_0xe1e6('0x2a'),_0x4ddbd3,_0xe1e6('0x25'));_0x560c76(_0x51cf03[_0xe1e6('0x2d')]['message']);}})['catch'](function(_0x1a1da3){logger['error'](_0xe1e6('0x2a'),_0x4ddbd3,_0x1a1da3);_0x495ba9(_0x1a1da3);});});}function respondWithStatusCode(_0x27c7fb,_0x339dea){_0x339dea=_0x339dea||0xcc;return function(_0x91ed04){if(_0x91ed04){return _0x27c7fb[_0xe1e6('0x2e')](_0x339dea);}return _0x27c7fb[_0xe1e6('0x2f')](_0x339dea)[_0xe1e6('0x30')]();};}function respondWithResult(_0xf1806d,_0x4f64b2){_0x4f64b2=_0x4f64b2||0xc8;return function(_0x2403b9){if(_0x2403b9){return _0xf1806d[_0xe1e6('0x2f')](_0x4f64b2)['json'](_0x2403b9);}};}function respondWithFilteredResult(_0xb2fbc5,_0x45f807){return function(_0x285c20){if(_0x285c20){var _0x576826=_0x285c20['count'],_0x464595=_0x45f807[_0xe1e6('0x31')],_0x579402=_0x45f807[_0xe1e6('0x31')]+_0x45f807['limit'],_0x1dc6f1;if(_0x579402>=_0x576826){_0x579402=_0x576826;_0x1dc6f1=0xc8;}else{_0x1dc6f1=0xce;}_0xb2fbc5['status'](_0x1dc6f1);return _0xb2fbc5[_0xe1e6('0x32')](_0xe1e6('0x33'),_0x464595+'-'+_0x579402+'/'+_0x576826)['json'](_0x285c20);}return null;};}function patchUpdates(_0x18ddd9){return function(_0x43a607){try{jsonpatch['apply'](_0x43a607,_0x18ddd9,!![]);}catch(_0x50b4b3){return BPromise[_0xe1e6('0x34')](_0x50b4b3);}return _0x43a607[_0xe1e6('0x35')]();};}function saveUpdates(_0x2b0698,_0x96cdb0){return function(_0x25baa6){if(_0x25baa6){return _0x25baa6[_0xe1e6('0x36')](_0x2b0698)[_0xe1e6('0x24')](function(_0x46f7c3){return _0x46f7c3;});}return null;};}function removeEntity(_0x5b7d2a,_0x542879){return function(_0x4cd1a6){if(_0x4cd1a6){return _0x4cd1a6[_0xe1e6('0x37')]()['then'](function(){var _0x5c4a40=_0x4cd1a6[_0xe1e6('0x38')]({'plain':!![]});var _0x22ddc9=_0xe1e6('0x39');return db[_0xe1e6('0x3a')][_0xe1e6('0x37')]({'where':{'type':_0x22ddc9,'resourceId':_0x5c4a40['id']}})[_0xe1e6('0x24')](function(){return _0x4cd1a6;});})['then'](function(){_0x5b7d2a['status'](0xcc)[_0xe1e6('0x30')]();});}};}function handleEntityNotFound(_0x442c06,_0x53e68f){return function(_0x1578cb){if(!_0x1578cb){_0x442c06['sendStatus'](0x194);}return _0x1578cb;};}function handleError(_0x5a9246,_0x9353c9){_0x9353c9=_0x9353c9||0x1f4;return function(_0x41358d){logger[_0xe1e6('0x28')](_0x41358d[_0xe1e6('0x3b')]);if(_0x41358d[_0xe1e6('0x3c')]){delete _0x41358d[_0xe1e6('0x3c')];}_0x5a9246[_0xe1e6('0x2f')](_0x9353c9)[_0xe1e6('0x3d')](_0x41358d);};}exports[_0xe1e6('0x3e')]=function(_0x592ad1,_0x4eae18){var _0x2b58a2={'include':[{'model':db[_0xe1e6('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1eaef2={},_0x5ecc1b={'count':0x0,'rows':[]};var _0x3b8525=_[_0xe1e6('0x40')](db[_0xe1e6('0x41')]['rawAttributes'],function(_0x39b0d5){return{'name':_0x39b0d5[_0xe1e6('0x42')],'type':_0x39b0d5[_0xe1e6('0x43')][_0xe1e6('0x44')]};});_0x1eaef2['model']=_['map'](_0x3b8525,_0xe1e6('0x3c'));_0x1eaef2[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x592ad1[_0xe1e6('0x45')]);_0x1eaef2[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x1eaef2['model'],_0x1eaef2['query']);_0x2b58a2[_0xe1e6('0x49')]=_['intersection'](_0x1eaef2[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x592ad1[_0xe1e6('0x45')]['fields']));_0x2b58a2[_0xe1e6('0x49')]=_0x2b58a2[_0xe1e6('0x49')]['length']?_0x2b58a2[_0xe1e6('0x49')]:_0x1eaef2[_0xe1e6('0x4a')];if(!_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x4c')]('nolimit')){_0x2b58a2[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x592ad1[_0xe1e6('0x45')]['limit']);_0x2b58a2[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x2b58a2[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x592ad1[_0xe1e6('0x45')]['sort']);_0x2b58a2['where']=qs['filters'](_['pick'](_0x592ad1[_0xe1e6('0x45')],_0x1eaef2[_0xe1e6('0x47')]),_0x3b8525);if(_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x50')]){_0x2b58a2['where']=_[_0xe1e6('0x51')](_0x2b58a2[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x3b8525,function(_0x20b67e){if(_0x20b67e[_0xe1e6('0x43')]!=='VIRTUAL'){var _0x49b9d7={};_0x49b9d7[_0x20b67e[_0xe1e6('0x3c')]]={'$like':'%'+_0x592ad1[_0xe1e6('0x45')][_0xe1e6('0x50')]+'%'};return _0x49b9d7;}})});}_0x2b58a2=_[_0xe1e6('0x51')]({},_0x2b58a2,_0x592ad1[_0xe1e6('0x53')]);var _0x3b0d86={'where':_0x2b58a2[_0xe1e6('0x52')]};return db[_0xe1e6('0x41')][_0xe1e6('0x54')](_0x3b0d86)[_0xe1e6('0x24')](function(_0x3fdbd0){_0x5ecc1b['count']=_0x3fdbd0;if(_0x592ad1['query'][_0xe1e6('0x55')]){_0x2b58a2['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xe1e6('0x56')](_0x2b58a2);})[_0xe1e6('0x24')](function(_0x45ec1f){_0x5ecc1b[_0xe1e6('0x57')]=_0x45ec1f;return _0x5ecc1b;})[_0xe1e6('0x24')](respondWithFilteredResult(_0x4eae18,_0x2b58a2))[_0xe1e6('0x58')](handleError(_0x4eae18,null));};exports[_0xe1e6('0x59')]=function(_0x1e0015,_0x373298){var _0x1cd19b={'raw':![],'where':{'id':_0x1e0015['params']['id']},'include':[{'model':db[_0xe1e6('0x3f')],'as':_0xe1e6('0x5a')}]},_0x1cbb3b={};_0x1cbb3b[_0xe1e6('0x4a')]=_['keys'](db[_0xe1e6('0x41')][_0xe1e6('0x5b')]);_0x1cbb3b[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x1e0015[_0xe1e6('0x45')]);_0x1cbb3b[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x1cbb3b['model'],_0x1cbb3b[_0xe1e6('0x45')]);_0x1cd19b[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x1cbb3b[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x1e0015[_0xe1e6('0x45')]['fields']));_0x1cd19b[_0xe1e6('0x49')]=_0x1cd19b[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x1cd19b[_0xe1e6('0x49')]:_0x1cbb3b[_0xe1e6('0x4a')];if(_0x1e0015[_0xe1e6('0x45')][_0xe1e6('0x55')]){_0x1cd19b[_0xe1e6('0x5d')]=[{'all':!![]}];}_0x1cd19b=_['merge']({},_0x1cd19b,_0x1e0015['options']);return db['ChatWebsite'][_0xe1e6('0x5e')](_0x1cd19b)[_0xe1e6('0x24')](handleEntityNotFound(_0x373298,null))[_0xe1e6('0x24')](respondWithResult(_0x373298,null))[_0xe1e6('0x58')](handleError(_0x373298,null));};exports[_0xe1e6('0x5f')]=function(_0x584b66,_0x3a4043){return db[_0xe1e6('0x41')][_0xe1e6('0x5f')](_0x584b66['body'],{})[_0xe1e6('0x24')](function(_0x5bae2c){var _0x4d9246=_0x584b66[_0xe1e6('0x60')][_0xe1e6('0x38')]({'plain':!![]});if(!_0x4d9246)throw new Error(_0xe1e6('0x61'));if(_0x4d9246[_0xe1e6('0x62')]==='user'){var _0x1dd256=_0x5bae2c[_0xe1e6('0x38')]({'plain':!![]});var _0x1d5323=_0xe1e6('0x39');return db[_0xe1e6('0x63')]['find']({'where':{'name':_0x1d5323,'userProfileId':_0x4d9246['userProfileId']},'raw':!![]})[_0xe1e6('0x24')](function(_0x4de68e){if(_0x4de68e&&_0x4de68e[_0xe1e6('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x1dd256['name'],'resourceId':_0x1dd256['id'],'type':_0x4de68e[_0xe1e6('0x3c')],'sectionId':_0x4de68e['id']},{})[_0xe1e6('0x24')](function(){return _0x5bae2c;});}else{return _0x5bae2c;}})[_0xe1e6('0x58')](function(_0x393731){logger[_0xe1e6('0x28')](_0xe1e6('0x65'),_0x393731);throw _0x393731;});}return _0x5bae2c;})['then'](respondWithResult(_0x3a4043,0xc9))[_0xe1e6('0x58')](handleError(_0x3a4043,null));};exports[_0xe1e6('0x36')]=function(_0x4cfb02,_0x23db95){if(_0x4cfb02[_0xe1e6('0x66')]['id']){delete _0x4cfb02['body']['id'];}return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x4cfb02['params']['id']},'include':[{'model':db[_0xe1e6('0x3f')],'as':_0xe1e6('0x5a')}]})[_0xe1e6('0x24')](handleEntityNotFound(_0x23db95,null))[_0xe1e6('0x24')](saveUpdates(_0x4cfb02[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x23db95,null))['catch'](handleError(_0x23db95,null));};exports['destroy']=function(_0x3f2847,_0x2701f7){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x3f2847[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2701f7,null))[_0xe1e6('0x24')](removeEntity(_0x2701f7,null))[_0xe1e6('0x58')](handleError(_0x2701f7,null));};exports[_0xe1e6('0x68')]=function(_0x3500f1,_0x499882){return db['ChatWebsite'][_0xe1e6('0x68')]()[_0xe1e6('0x24')](respondWithResult(_0x499882,null))[_0xe1e6('0x58')](handleError(_0x499882,null));};exports['addDisposition']=function(_0x2bd6e8,_0x32ae90,_0x361c34){if(_0x2bd6e8[_0xe1e6('0x66')]['id']){delete _0x2bd6e8[_0xe1e6('0x66')]['id'];}return db['ChatWebsite'][_0xe1e6('0x5e')]({'where':{'id':_0x2bd6e8[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x32ae90,null))['then'](function(_0x910001){if(_0x910001){_0x2bd6e8['body']['ChatWebsiteId']=_0x910001['id'];return db[_0xe1e6('0x69')][_0xe1e6('0x5f')](_0x2bd6e8[_0xe1e6('0x66')]);}})['then'](respondWithResult(_0x32ae90,null))[_0xe1e6('0x58')](handleError(_0x32ae90,null));};exports[_0xe1e6('0x6a')]=function(_0xe4f251,_0x3e9362,_0x63ef4e){var _0x1a0c9e={'raw':![],'where':{}};var _0x23f0e1={};var _0x2cf668={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')]['findOne']({'where':{'id':_0xe4f251[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x3e9362,null))['then'](function(_0x1cd422){if(_0x1cd422){_0x23f0e1['model']=_['keys'](db[_0xe1e6('0x69')][_0xe1e6('0x5b')]);_0x23f0e1[_0xe1e6('0x45')]=_['keys'](_0xe4f251[_0xe1e6('0x45')]);_0x23f0e1[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x23f0e1[_0xe1e6('0x4a')],_0x23f0e1[_0xe1e6('0x45')]);_0x1a0c9e['attributes']=_[_0xe1e6('0x48')](_0x23f0e1[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0xe4f251['query'][_0xe1e6('0x4b')]));_0x1a0c9e[_0xe1e6('0x49')]=_0x1a0c9e['attributes'][_0xe1e6('0x5c')]?_0x1a0c9e[_0xe1e6('0x49')]:_0x23f0e1[_0xe1e6('0x4a')];if(!_0xe4f251['query'][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x1a0c9e[_0xe1e6('0x4d')]=qs['limit'](_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0x1a0c9e['offset']=qs[_0xe1e6('0x31')](_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x1a0c9e['order']=qs[_0xe1e6('0x4f')](_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x4f')]);_0x1a0c9e[_0xe1e6('0x52')]=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0xe4f251['query'],_0x23f0e1[_0xe1e6('0x47')]));_0x1a0c9e[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0x1cd422['id'];if(_0xe4f251[_0xe1e6('0x45')]['filter']){_0x1a0c9e[_0xe1e6('0x52')]=_[_0xe1e6('0x51')](_0x1a0c9e[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x1a0c9e[_0xe1e6('0x49')],function(_0x46eefb){var _0x3993b4={};_0x3993b4[_0x46eefb]={'$like':'%'+_0xe4f251['query'][_0xe1e6('0x50')]+'%'};return _0x3993b4;})});}_0x1a0c9e=_[_0xe1e6('0x51')]({},_0x1a0c9e,_0xe4f251['options']);return db['Disposition']['count']({'where':_0x1a0c9e[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x4bfac1){_0x2cf668[_0xe1e6('0x54')]=_0x4bfac1;if(_0xe4f251[_0xe1e6('0x45')][_0xe1e6('0x55')]){_0x1a0c9e['include']=[{'all':!![]}];}return db['Disposition'][_0xe1e6('0x56')](_0x1a0c9e);})[_0xe1e6('0x24')](function(_0x59a59b){_0x2cf668[_0xe1e6('0x57')]=_0x59a59b;return _0x2cf668;});}})[_0xe1e6('0x24')](respondWithFilteredResult(_0x3e9362,_0x1a0c9e))[_0xe1e6('0x58')](handleError(_0x3e9362,null));};exports['removeDispositions']=function(_0x4a84fb,_0x255fbb,_0x2e8f5f){return db['ChatWebsite'][_0xe1e6('0x5e')]({'where':{'id':_0x4a84fb[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x255fbb,null))['then'](function(_0x59505b){if(_0x59505b){return _0x59505b[_0xe1e6('0x6e')](_0x4a84fb[_0xe1e6('0x45')][_0xe1e6('0x6f')]);}})[_0xe1e6('0x24')](respondWithStatusCode(_0x255fbb,null))[_0xe1e6('0x58')](handleError(_0x255fbb,null));};exports[_0xe1e6('0x70')]=function(_0x17791a,_0x3162e9,_0x474bfb){if(_0x17791a['body']['id']){delete _0x17791a[_0xe1e6('0x66')]['id'];}return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x17791a[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x3162e9,null))['then'](function(_0xb9c578){if(_0xb9c578){_0x17791a['body'][_0xe1e6('0x6d')]=_0xb9c578['id'];return db[_0xe1e6('0x71')]['create'](_0x17791a[_0xe1e6('0x66')]);}})[_0xe1e6('0x24')](respondWithResult(_0x3162e9,null))['catch'](handleError(_0x3162e9,null));};exports['getAnswers']=function(_0x386a48,_0x227b21,_0x4c7e13){var _0x4ed266={'raw':![],'where':{}};var _0x1d0952={};var _0x50fa05={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x386a48[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x227b21,null))[_0xe1e6('0x24')](function(_0x15391c){if(_0x15391c){_0x1d0952[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db[_0xe1e6('0x71')]['rawAttributes']);_0x1d0952['query']=_[_0xe1e6('0x46')](_0x386a48[_0xe1e6('0x45')]);_0x1d0952[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x1d0952[_0xe1e6('0x4a')],_0x1d0952[_0xe1e6('0x45')]);_0x4ed266['attributes']=_[_0xe1e6('0x48')](_0x1d0952[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x386a48[_0xe1e6('0x45')][_0xe1e6('0x4b')]));_0x4ed266['attributes']=_0x4ed266[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x4ed266[_0xe1e6('0x49')]:_0x1d0952['model'];if(!_0x386a48[_0xe1e6('0x45')][_0xe1e6('0x4c')]('nolimit')){_0x4ed266[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x386a48[_0xe1e6('0x45')]['limit']);_0x4ed266[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x386a48[_0xe1e6('0x45')]['offset']);}_0x4ed266['order']=qs[_0xe1e6('0x4f')](_0x386a48['query'][_0xe1e6('0x4f')]);_0x4ed266[_0xe1e6('0x52')]=qs['filters'](_[_0xe1e6('0x6c')](_0x386a48['query'],_0x1d0952[_0xe1e6('0x47')]));_0x4ed266[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0x15391c['id'];if(_0x386a48['query'][_0xe1e6('0x50')]){_0x4ed266['where']=_[_0xe1e6('0x51')](_0x4ed266[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x4ed266[_0xe1e6('0x49')],function(_0x4299ca){var _0x47493b={};_0x47493b[_0x4299ca]={'$like':'%'+_0x386a48[_0xe1e6('0x45')][_0xe1e6('0x50')]+'%'};return _0x47493b;})});}_0x4ed266=_['merge']({},_0x4ed266,_0x386a48[_0xe1e6('0x53')]);return db[_0xe1e6('0x71')][_0xe1e6('0x54')]({'where':_0x4ed266[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x5c7295){_0x50fa05[_0xe1e6('0x54')]=_0x5c7295;if(_0x386a48['query'][_0xe1e6('0x55')]){_0x4ed266[_0xe1e6('0x5d')]=[{'all':!![]}];}return db[_0xe1e6('0x71')][_0xe1e6('0x56')](_0x4ed266);})[_0xe1e6('0x24')](function(_0x249926){_0x50fa05[_0xe1e6('0x57')]=_0x249926;return _0x50fa05;});}})['then'](respondWithFilteredResult(_0x227b21,_0x4ed266))['catch'](handleError(_0x227b21,null));};exports[_0xe1e6('0x73')]=function(_0x3aa0a4,_0x229a83,_0x52be82){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x3aa0a4[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x229a83,null))[_0xe1e6('0x24')](function(_0x391f89){if(_0x391f89){return _0x391f89[_0xe1e6('0x73')](_0x3aa0a4['query'][_0xe1e6('0x6f')]);}})[_0xe1e6('0x24')](respondWithStatusCode(_0x229a83,null))[_0xe1e6('0x58')](handleError(_0x229a83,null));};exports[_0xe1e6('0x74')]=function(_0x785ec0,_0x2a091b,_0x3136dd){_0x785ec0[_0xe1e6('0x66')]['sitepic']=_0x785ec0[_0xe1e6('0x75')][_0xe1e6('0x76')];return db[_0xe1e6('0x41')]['find']({'where':{'id':_0x785ec0['params']['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2a091b,null))[_0xe1e6('0x24')](saveUpdates(_0x785ec0[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x2a091b,null))[_0xe1e6('0x58')](handleError(_0x2a091b,null));};exports[_0xe1e6('0x77')]=function(_0x46e02e,_0x24843b,_0x25654c){_0x46e02e[_0xe1e6('0x66')]['agentAvatar']=_0x46e02e[_0xe1e6('0x75')][_0xe1e6('0x76')];return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x46e02e[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x24843b,null))[_0xe1e6('0x24')](saveUpdates(_0x46e02e[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x24843b,null))[_0xe1e6('0x58')](handleError(_0x24843b,null));};exports[_0xe1e6('0x78')]=function(_0x25f280,_0xe84be8,_0x2ced72){_0x25f280['body'][_0xe1e6('0x79')]=_0x25f280[_0xe1e6('0x75')][_0xe1e6('0x76')];return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x25f280[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0xe84be8,null))[_0xe1e6('0x24')](saveUpdates(_0x25f280['body'],null))['then'](respondWithResult(_0xe84be8,null))[_0xe1e6('0x58')](handleError(_0xe84be8,null));};exports[_0xe1e6('0x7a')]=function(_0x1a0e6d,_0x206037,_0x185bb4){_0x1a0e6d[_0xe1e6('0x66')]['systemAvatar']=_0x1a0e6d['file'][_0xe1e6('0x76')];return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x1a0e6d['params']['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x206037,null))[_0xe1e6('0x24')](saveUpdates(_0x1a0e6d[_0xe1e6('0x66')],null))[_0xe1e6('0x24')](respondWithResult(_0x206037,null))[_0xe1e6('0x58')](handleError(_0x206037,null));};exports[_0xe1e6('0x7b')]=function(_0x44dbcc,_0x27b034,_0x31775d){var _0x35dfa8=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x7e'));var _0x51da48={'where':{'id':_0x44dbcc[_0xe1e6('0x67')]['id']},'attributes':['id',_0xe1e6('0x7f')],'raw':!![]};var _0x43d4a6=![];return require(_0xe1e6('0x80'))[_0xe1e6('0x81')]()[_0xe1e6('0x24')](function(_0xa5b1b0){if(_0xa5b1b0){_0x43d4a6=_0xa5b1b0[_0xe1e6('0x82')];}})[_0xe1e6('0x24')](function(){return db['ChatWebsite'][_0xe1e6('0x5e')](_0x51da48);})[_0xe1e6('0x24')](handleEntityNotFound(_0x27b034,null))[_0xe1e6('0x24')](function(_0x38d6a7){if(_0x38d6a7){if(!_['isNil'](_0x38d6a7[_0xe1e6('0x7f')])){if(fs[_0xe1e6('0x83')](path[_0xe1e6('0x7c')](config['root'],_0xe1e6('0x84'),_0x38d6a7[_0xe1e6('0x7f')]))&&_0x43d4a6){_0x35dfa8=path['join'](config[_0xe1e6('0x7d')],_0xe1e6('0x84'),_0x38d6a7[_0xe1e6('0x7f')]);}}return _0x27b034[_0xe1e6('0x85')](_0x35dfa8);}})[_0xe1e6('0x58')](handleError(_0x27b034,null));};exports['getAvatar']=function(_0x4f72a6,_0x1ce853,_0x171c55){var _0x444497=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],'server/files/images/avatars/default_avatar.png');var _0x203c6b={'where':{'id':_0x4f72a6[_0xe1e6('0x67')]['id']},'attributes':['id',_0xe1e6('0x86')],'raw':!![]};return db[_0xe1e6('0x41')][_0xe1e6('0x5e')](_0x203c6b)[_0xe1e6('0x24')](handleEntityNotFound(_0x1ce853,null))[_0xe1e6('0x24')](function(_0x29c36f){if(_0x29c36f){if(!_['isNil'](_0x29c36f[_0xe1e6('0x86')])){if(fs['existsSync'](path[_0xe1e6('0x7c')](config['root'],'server/files/images/avatars/',_0x29c36f[_0xe1e6('0x86')]))){_0x444497=path['join'](config[_0xe1e6('0x7d')],'server/files/images/avatars/',_0x29c36f[_0xe1e6('0x86')]);}}return _0x1ce853[_0xe1e6('0x85')](_0x444497);}})[_0xe1e6('0x58')](handleError(_0x1ce853,null));};exports[_0xe1e6('0x87')]=function(_0x2b5696,_0x200f0e,_0x384cac){var _0x4c67ef=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x88'));var _0x28bb6c={'where':{'id':_0x2b5696[_0xe1e6('0x67')]['id']},'attributes':['id','customerAvatar',_0xe1e6('0x89')],'raw':!![]};return db[_0xe1e6('0x41')][_0xe1e6('0x5e')](_0x28bb6c)[_0xe1e6('0x24')](handleEntityNotFound(_0x200f0e,null))[_0xe1e6('0x24')](function(_0x36f1d7){if(_0x36f1d7){if(!_['isNil'](_0x36f1d7[_0xe1e6('0x79')])){if(fs[_0xe1e6('0x83')](path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x8a'),_0x36f1d7[_0xe1e6('0x79')]))&&_0x36f1d7[_0xe1e6('0x89')]){_0x4c67ef=path['join'](config['root'],_0xe1e6('0x8a'),_0x36f1d7['customerAvatar']);}}return _0x200f0e['download'](_0x4c67ef);}})[_0xe1e6('0x58')](handleError(_0x200f0e,null));};exports[_0xe1e6('0x8b')]=function(_0x3cda66,_0x5334ee,_0x214c85){var _0x2e852b=path['join'](config[_0xe1e6('0x7d')],_0xe1e6('0x8c'));var _0x53fa65={'where':{'id':_0x3cda66[_0xe1e6('0x67')]['id']},'attributes':['id',_0xe1e6('0x8d')],'raw':!![]};return db['ChatWebsite'][_0xe1e6('0x5e')](_0x53fa65)[_0xe1e6('0x24')](handleEntityNotFound(_0x5334ee,null))[_0xe1e6('0x24')](function(_0x120d1d){if(_0x120d1d){if(!_[_0xe1e6('0x8e')](_0x120d1d[_0xe1e6('0x8d')])){if(fs['existsSync'](path[_0xe1e6('0x7c')](config['root'],_0xe1e6('0x8a'),_0x120d1d[_0xe1e6('0x8d')]))){_0x2e852b=path[_0xe1e6('0x7c')](config[_0xe1e6('0x7d')],_0xe1e6('0x8a'),_0x120d1d['systemAvatar']);}}return _0x5334ee['download'](_0x2e852b);}})[_0xe1e6('0x58')](handleError(_0x5334ee,null));};exports['notify']=function(_0xa120f8,_0x2488b5,_0x3f2c35){var _0x57c310=require(_0xe1e6('0x8f'));var _0x412069=new _0x57c310();var _0x46d173=_0x412069[_0xe1e6('0x90')](_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0x92')])[_0xe1e6('0x93')]();var _0x314f66={'body':_0xa120f8[_0xe1e6('0x66')],'channel':'chat'};var _0x313e4a=[];var _0x2b8f9a=[];var _0x1a0449={};var _0x333730=![];return db['CmContact'][_0xe1e6('0x68')]()['then'](function(_0x3c38d5){if(!_0x3c38d5){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x94'));}_0x313e4a=_[_0xe1e6('0x95')](_['keys'](_0x3c38d5),['createdAt',_0xe1e6('0x96')]);_0x2b8f9a=_['difference'](_[_0xe1e6('0x46')](_0x3c38d5),[_0xe1e6('0x97'),'updatedAt',_0xe1e6('0x98'),_0xe1e6('0x99')]);if(_0xa120f8[_0xe1e6('0x66')]['id']){delete _0xa120f8['body']['id'];}if(_['isNil'](_0xa120f8[_0xe1e6('0x66')]['from'])){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x9a'));}if(_['isNil'](_0xa120f8['body'][_0xe1e6('0x66')])||_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x66')]===''){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x9b'));}if(_['isNil'](_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9c')])){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b8f9a);}if(!_[_0xe1e6('0x9d')](_0x2b8f9a,_0xa120f8['body']['mapKey'])){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x9e')+_0x2b8f9a);}_0x1a0449[_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9c')]]=_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9f')];})['then'](function(){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0xa120f8[_0xe1e6('0x67')]['id']},'include':[{'model':db[_0xe1e6('0xa0')],'as':_0xe1e6('0xa1'),'include':[{'model':db[_0xe1e6('0xa2')],'as':_0xe1e6('0xa3'),'where':_0x1a0449,'limit':0x1,'order':[[_0xe1e6('0x96'),_0xe1e6('0xa4')]]}]},{'model':db[_0xe1e6('0xa5')],'as':'Applications'}]});})[_0xe1e6('0x24')](handleEntityNotFound(_0x2488b5,null))['then'](function(_0x137dda){if(_0x137dda&&_0x137dda[_0xe1e6('0xa1')]){_0x314f66['account']=_0x137dda;_0x314f66['applications']=_0x137dda[_0xe1e6('0xa6')];_0x314f66['list']=_0x137dda[_0xe1e6('0xa1')];_0x314f66[_0xe1e6('0xa7')]=_[_0xe1e6('0xa8')](_0x314f66[_0xe1e6('0xa7')],[_0xe1e6('0xa9')],[_0xe1e6('0xaa')]);if(_0x314f66['account'][_0xe1e6('0xa6')]){delete _0x314f66[_0xe1e6('0xab')]['Applications'];}if(_0x314f66[_0xe1e6('0xab')][_0xe1e6('0xa1')]&&_0x314f66[_0xe1e6('0xab')][_0xe1e6('0xa1')][_0xe1e6('0xa3')]['length']){return _0x314f66[_0xe1e6('0xab')][_0xe1e6('0xa1')][_0xe1e6('0xa3')][0x0];}var _0x1aa4ba=_[_0xe1e6('0xac')](_0xa120f8[_0xe1e6('0x66')],{'firstName':_0xa120f8['body'][_0xe1e6('0x9f')],'ListId':_0x137dda[_0xe1e6('0x99')]});_0x1aa4ba[_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0x9c')]]=_0xa120f8['body'][_0xe1e6('0x9f')];return db[_0xe1e6('0xa2')][_0xe1e6('0x5f')](_0x1aa4ba,{'fields':_0x313e4a,'raw':!![]});}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2488b5,null))[_0xe1e6('0x24')](function(_0x5dca6f){_0x314f66[_0xe1e6('0xad')]=_0x5dca6f;var _0x21e337=_0xa120f8[_0xe1e6('0x66')]['customerIp'];if(_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0xae')]){_0x21e337=_0xa120f8[_0xe1e6('0x91')]['cf-connecting-ip'];}else if(_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0xaf')]){_0x21e337=_['first'](_0xa120f8['headers'][_0xe1e6('0xaf')][_0xe1e6('0xb0')](','));}if(_0x5dca6f){var _0x4f3aa1={'ContactId':_0x5dca6f['id'],'ChatWebsiteId':_0xa120f8[_0xe1e6('0x67')]['id'],'from':(_0x5dca6f[_0xe1e6('0xb1')]||'')+'\x20'+(_0x5dca6f[_0xe1e6('0xb2')]||''),'customerIp':_0x21e337,'customerPort':_0xa120f8[_0xe1e6('0x91')]['x-real-port']?_0xa120f8[_0xe1e6('0x91')][_0xe1e6('0xb3')]:null,'referer':_0xa120f8['body']['referer'],'browserName':_0x46d173[_0xe1e6('0xb4')]['name']&&_0x46d173[_0xe1e6('0xb4')]['version']?util[_0xe1e6('0xb5')]('%s\x20%s',_0x46d173[_0xe1e6('0xb4')][_0xe1e6('0x3c')],_0x46d173['browser'][_0xe1e6('0xb6')]):'unknown','browserVersion':_0x46d173[_0xe1e6('0xb4')][_0xe1e6('0xb6')]||_0xe1e6('0xb7'),'osName':util[_0xe1e6('0xb5')](_0xe1e6('0xb8'),_0x46d173['os'][_0xe1e6('0x3c')],_0x46d173['os'][_0xe1e6('0xb6')]),'osVersion':_0x46d173['os'][_0xe1e6('0xb6')],'deviceModel':_0x46d173['device'][_0xe1e6('0x4a')]&&_0x46d173[_0xe1e6('0xb9')]['vendor']?util[_0xe1e6('0xb5')](_0xe1e6('0xba'),_0x46d173['device']['model'],_0x46d173['device']['vendor'],_0x46d173[_0xe1e6('0xb9')][_0xe1e6('0x43')]):null,'deviceVendor':_0x46d173[_0xe1e6('0xb9')][_0xe1e6('0xbb')],'deviceType':_0x46d173[_0xe1e6('0xb9')][_0xe1e6('0x43')],'formData':JSON[_0xe1e6('0x27')](_0xa120f8[_0xe1e6('0x66')])};var _0x40f2d9={'ChatWebsiteId':_0xa120f8[_0xe1e6('0x67')]['id'],'closed':![]};if(_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xbc')]){_0x40f2d9[_0xe1e6('0xbc')]=_0xa120f8['body'][_0xe1e6('0xbc')];return db[_0xe1e6('0xbd')][_0xe1e6('0x5e')]({'where':_0x40f2d9})[_0xe1e6('0x24')](function(_0x2aea75){if(_0x2aea75){return[_0x2aea75,![]];}_0x4f3aa1['threadId']=_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xbc')];_0x4f3aa1[_0xe1e6('0xbe')]=_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xbe')];return db[_0xe1e6('0xbd')][_0xe1e6('0x5f')](_0x4f3aa1)[_0xe1e6('0x24')](function(_0x45ecaf){return[_0x45ecaf,!![]];});});}_0x40f2d9[_0xe1e6('0xbf')]=_0x5dca6f['id'];if(_0xa120f8['body'][_0xe1e6('0xc0')]&&_0xa120f8['body']['interaction']['id']){_0x40f2d9['id']=_0xa120f8[_0xe1e6('0x66')]['interaction']['id'];return db[_0xe1e6('0xbd')][_0xe1e6('0x5e')]({'where':_0x40f2d9})['then'](function(_0x3bf0b9){if(_0x3bf0b9){return[_0x3bf0b9,![]];}return db[_0xe1e6('0xbd')][_0xe1e6('0x5f')](_0x4f3aa1)[_0xe1e6('0x24')](function(_0x845fb8){return[_0x845fb8,!![]];});});}return db[_0xe1e6('0xbd')][_0xe1e6('0x5f')](_0x4f3aa1)[_0xe1e6('0x24')](function(_0x37137e){return[_0x37137e,!![]];});}})[_0xe1e6('0xc1')](function(_0x101218,_0x26bbd1){if(_0x101218){_0x333730=_0x26bbd1;if(!_0x26bbd1){var _0x226d15={'from':(_0x314f66[_0xe1e6('0xad')][_0xe1e6('0xb1')]||'')+'\x20'+(_0x314f66['contact'][_0xe1e6('0xb2')]||'')};if(_0xa120f8['body']['threadId']&&_0xa120f8[_0xe1e6('0x66')][_0xe1e6('0xc2')]&&_0xa120f8['body']['threadId']!=_0xa120f8['body']['messageId']){_0x226d15[_0xe1e6('0xbc')]=_0xa120f8[_0xe1e6('0x66')]['messageId'];}return _0x101218[_0xe1e6('0x36')](_0x226d15);}else{return _0x101218;}}})[_0xe1e6('0x24')](function(_0x1fa896){_0x314f66[_0xe1e6('0xc0')]=_0x1fa896[_0xe1e6('0x38')]({'plain':!![]});_0x314f66[_0xe1e6('0xc0')][_0xe1e6('0xc3')]=_0x333730;if(_0x314f66[_0xe1e6('0xc0')]['created']){if(_0x314f66['account'][_0xe1e6('0xc4')]){_0x314f66[_0xe1e6('0xa7')][_0xe1e6('0xc5')]({'id':0x0,'priority':_0x314f66[_0xe1e6('0xa7')][_0xe1e6('0x5c')]+0x1,'app':'close','appdata':_0xe1e6('0xc6'),'interval':_0xe1e6('0xc7')});}}return db['ChatMessage']['create']({'body':_0xa120f8[_0xe1e6('0x66')]['body'],'ChatWebsiteId':_0xa120f8[_0xe1e6('0x67')]['id'],'ChatInteractionId':_0x1fa896['id'],'direction':'in','ContactId':_0x314f66[_0xe1e6('0xad')]['id'],'AttachmentId':_0xa120f8[_0xe1e6('0x66')]['AttachmentId']});})['then'](function(_0x32d4e3){_0x314f66['message']=_0x32d4e3;if(_0x314f66['interaction'][_0xe1e6('0xc8')]){return db[_0xe1e6('0xc9')][_0xe1e6('0x5e')]({'attributes':['id',_0xe1e6('0x3c')],'where':{'id':_0x314f66[_0xe1e6('0xc0')][_0xe1e6('0xc8')]}})['then'](function(_0x1a0e65){if(_0x1a0e65){_0x314f66['applications'][_0xe1e6('0xca')]({'id':0x0,'priority':0x0,'app':_0xe1e6('0xcb'),'appdata':_0x1a0e65[_0xe1e6('0x3c')]+','+(_0x314f66[_0xe1e6('0xab')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x314f66[_0xe1e6('0xcc')]=!![];}return respondWithRpcPromise(_0xe1e6('0xcd'),_0xe1e6('0xce'),_0x314f66);});}return respondWithRpcPromise(_0xe1e6('0xcd'),_0xe1e6('0xce'),_0x314f66);})['then'](function(_0x2d07e6){respondWithRpcPromise('EventManager',_0xe1e6('0xcf'),{'event':_0xe1e6('0xd0'),'message':_0x2d07e6},client9002);return _0x2d07e6;})[_0xe1e6('0x24')](respondWithResult(_0x2488b5,null))[_0xe1e6('0x58')](handleError(_0x2488b5,null));};exports[_0xe1e6('0xd1')]=function(_0x6fa068,_0x1c5035,_0xc7cb2e){var _0x568b8d,_0x2ee6bc,_0x3c58fd;var _0x45255f=[];var _0x3319d3=[];var _0x4299a7={};return db[_0xe1e6('0xa2')]['describe']()[_0xe1e6('0x24')](function(_0x46a86f){if(!_0x46a86f){throw new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0x94'));}_0x3319d3=_[_0xe1e6('0x95')](_['keys'](_0x46a86f),['createdAt','updatedAt']);_0x45255f=_[_0xe1e6('0x95')](_[_0xe1e6('0x46')](_0x46a86f),[_0xe1e6('0x97'),_0xe1e6('0x96'),_0xe1e6('0x98'),'ListId']);if(_0x6fa068[_0xe1e6('0x66')]['id']){delete _0x6fa068[_0xe1e6('0x66')]['id'];}if(_['isNil'](_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')])){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)[_0xe1e6('0x3d')](new db[(_0xe1e6('0x20'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x66')])||_0x6fa068[_0xe1e6('0x66')]['body']===''){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)[_0xe1e6('0x3d')](new db['Sequelize'][(_0xe1e6('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe1e6('0x8e')](_0x6fa068['body'][_0xe1e6('0xd2')])){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)['send'](new db[(_0xe1e6('0x20'))][(_0xe1e6('0x21'))](_0xe1e6('0xd3')+_0x45255f));}if(!_[_0xe1e6('0x9d')](_0x45255f,_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0xd2')])){throw _0x1c5035[_0xe1e6('0x2f')](0x1f4)['send'](new db['Sequelize'][(_0xe1e6('0x21'))](_0xe1e6('0xd4')+_0x45255f));}_0x4299a7[_0x6fa068['body'][_0xe1e6('0xd2')]]=_0x6fa068['body'][_0xe1e6('0x9f')];})[_0xe1e6('0x24')](function(){return db['ChatWebsite'][_0xe1e6('0x5e')]({'where':{'id':_0x6fa068[_0xe1e6('0x67')]['id']},'include':[{'model':db[_0xe1e6('0xa0')],'as':_0xe1e6('0xa1')}]});})[_0xe1e6('0x24')](handleEntityNotFound(_0x1c5035,null))[_0xe1e6('0x24')](function(_0x1ca193){if(_0x1ca193&&_0x1ca193[_0xe1e6('0xa1')]){_0x2ee6bc=_0x1ca193;var _0x271923=_[_0xe1e6('0xac')](_0x6fa068[_0xe1e6('0x66')],{'firstName':_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')],'phone':_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')],'ListId':_0x1ca193['ListId']});_0x271923[_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0xd2')]]=_0x6fa068[_0xe1e6('0x66')][_0xe1e6('0x9f')];return db[_0xe1e6('0xa2')][_0xe1e6('0xd5')]({'where':_0x4299a7,'defaults':_0x271923});}})[_0xe1e6('0xc1')](function(_0x18b72f){if(_0x18b72f){_0x3c58fd=_0x18b72f;var _0x5af0bf=fs['readFileSync'](path['join'](config[_0xe1e6('0x7d')],_0xe1e6('0xd6')),_0xe1e6('0xd7'));var _0x3e837a=ejs[_0xe1e6('0xd8')](_0x5af0bf,{'body':_[_0xe1e6('0xd9')](_0x6fa068[_0xe1e6('0x66')]['body']),'bodyTitle':_0x2ee6bc[_0xe1e6('0xda')]});return db['ChatOfflineMessage'][_0xe1e6('0x5f')]({'body':_0x3e837a,'ContactId':_0x18b72f['id'],'ChatWebsiteId':_0x2ee6bc['id']});}})[_0xe1e6('0x24')](function(_0x318ef5){if(_0x318ef5){_0x568b8d=_0x318ef5;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe1e6('0xdb')],'as':_0xe1e6('0xdc'),'raw':!![]}]});}})[_0xe1e6('0x24')](function(_0x5388fe){if(_0x5388fe&&_0x5388fe[_0xe1e6('0xdc')]&&_0x2ee6bc[_0xe1e6('0xdd')]){var _0x16fa17={'tls':{'rejectUnauthorized':![]}};if(_0x5388fe[_0xe1e6('0xdc')]['service']){_0x16fa17['service']=_0x5388fe['Smtp'][_0xe1e6('0xde')];}else{_0x16fa17[_0xe1e6('0xdf')]=_0x5388fe['Smtp'][_0xe1e6('0xdf')];_0x16fa17['port']=_0x5388fe[_0xe1e6('0xdc')][_0xe1e6('0xe0')];_0x16fa17[_0xe1e6('0xe1')]=_0x5388fe[_0xe1e6('0xdc')][_0xe1e6('0xe1')];}if(_0x5388fe['Smtp'][_0xe1e6('0xe2')]){_0x16fa17['auth']={'user':_0x5388fe[_0xe1e6('0xdc')][_0xe1e6('0x60')],'pass':_0x5388fe['Smtp']['pass']};}return respondWithRpcPromise(_0xe1e6('0xe3'),'sendMail',{'account':_0x16fa17,'message':{'from':util[_0xe1e6('0xb5')](_0xe1e6('0xe4'),_0x5388fe[_0xe1e6('0x3c')],_0x5388fe[_0xe1e6('0xe5')]||_0x5388fe['Smtp'][_0xe1e6('0x60')]),'to':_0x2ee6bc['forwardOfflineAddress'],'subject':_0x2ee6bc['offlineMessageSubject'],'text':_0x568b8d[_0xe1e6('0x66')]}},client9003)['then'](function(){return _0x568b8d;})[_0xe1e6('0x58')](function(_0x5b48fe){console[_0xe1e6('0x28')](_0x5b48fe);});}})[_0xe1e6('0x24')](function(){if(_0x568b8d){return _0x568b8d;}})['then'](respondWithResult(_0x1c5035,null))['catch'](handleError(_0x1c5035,null));};exports[_0xe1e6('0xe6')]=function(_0x5b73ba,_0x169be0,_0x41bacf){return db[_0xe1e6('0xbd')][_0xe1e6('0x5e')]({'where':{'id':_0x5b73ba[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x169be0,null))[_0xe1e6('0x24')](function(_0x3f89b4){if(_0x3f89b4){return _0x3f89b4[_0xe1e6('0xe6')](_0x5b73ba[_0xe1e6('0x66')]['ids'],_[_0xe1e6('0xe7')](_0x5b73ba[_0xe1e6('0x66')],[_0xe1e6('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x169be0,null))[_0xe1e6('0x58')](handleError(_0x169be0,null));};exports[_0xe1e6('0xe8')]=function(_0x3cd924,_0x21f9be,_0x16961b){var _0x55bdf9={'raw':![],'where':{}};var _0x3ce3e9={};var _0xc251d3={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x3cd924[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x21f9be,null))[_0xe1e6('0x24')](function(_0xdb667f){if(_0xdb667f){_0x3ce3e9[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db[_0xe1e6('0xbd')][_0xe1e6('0x5b')]);_0x3ce3e9[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x3cd924[_0xe1e6('0x45')]);_0x3ce3e9[_0xe1e6('0x47')]=_['intersection'](_0x3ce3e9[_0xe1e6('0x4a')],_0x3ce3e9[_0xe1e6('0x45')]);_0x55bdf9[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x3ce3e9[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x3cd924['query']['fields']));_0x55bdf9['attributes']=_0x55bdf9[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x55bdf9[_0xe1e6('0x49')]:_0x3ce3e9['model'];if(!_0x3cd924[_0xe1e6('0x45')]['hasOwnProperty']('nolimit')){_0x55bdf9['limit']=qs['limit'](_0x3cd924[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0x55bdf9[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x3cd924[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x55bdf9[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x3cd924['query'][_0xe1e6('0x4f')]);_0x55bdf9['where']=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0x3cd924[_0xe1e6('0x45')],_0x3ce3e9[_0xe1e6('0x47')]));_0x55bdf9[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0xdb667f['id'];if(_0x3cd924['query'][_0xe1e6('0x50')]){_0x55bdf9['where']=_[_0xe1e6('0x51')](_0x55bdf9[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x55bdf9[_0xe1e6('0x49')],function(_0x3320c5){var _0x1d2579={};_0x1d2579[_0x3320c5]={'$like':'%'+_0x3cd924['query'][_0xe1e6('0x50')]+'%'};return _0x1d2579;})});}_0x55bdf9=_[_0xe1e6('0x51')]({},_0x55bdf9,_0x3cd924[_0xe1e6('0x53')]);return db[_0xe1e6('0xbd')]['count']({'where':_0x55bdf9[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x9c9cef){_0xc251d3[_0xe1e6('0x54')]=_0x9c9cef;if(_0x3cd924[_0xe1e6('0x45')]['includeAll']){_0x55bdf9['include']=[{'model':db[_0xe1e6('0xa2')],'as':'Contact','required':![]},{'model':db[_0xe1e6('0xc9')],'as':_0xe1e6('0xe9'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xe1e6('0xea')],'as':_0xe1e6('0xeb'),'attributes':['id','name',_0xe1e6('0xec')],'where':_0x3cd924[_0xe1e6('0x45')][_0xe1e6('0xed')]?{'id':_0x3cd924[_0xe1e6('0x45')]['tag']}:undefined,'required':_0x3cd924['query'][_0xe1e6('0xed')]?!![]:![]}];}return db[_0xe1e6('0xbd')]['findAll'](_0x55bdf9);})['then'](function(_0x63d579){_0xc251d3['rows']=_0x63d579;return _0xc251d3;});}})[_0xe1e6('0x24')](respondWithFilteredResult(_0x21f9be,_0x55bdf9))[_0xe1e6('0x58')](handleError(_0x21f9be,null));};function iftimePromise(_0xa42f42,_0x51a842){return respondWithRpcPromise('Command',_0xe1e6('0xee'),{'command':_0x51a842[_0xe1e6('0xef')]?util[_0xe1e6('0xb5')](_0xe1e6('0xf0'),_0xa42f42[_0xe1e6('0xf1')],_0x51a842[_0xe1e6('0xef')]):util['format'](_0xe1e6('0xf2'),_0xa42f42[_0xe1e6('0xf1')])},client9002)[_0xe1e6('0x24')](function(_0x285837){var _0x2f598f=_0x285837&&_0x285837['indexOf'](_0xe1e6('0xf3'))>=0x0?!![]:![];logger[_0xe1e6('0x2c')](_0xe1e6('0xf4'),_0x51a842['id'],_0xa42f42['id'],_0xa42f42['interval'],_0x2f598f?_0xe1e6('0xf5'):_0xe1e6('0xf6'),_0x51a842[_0xe1e6('0xef')]?_0x51a842[_0xe1e6('0xef')]:_0xe1e6('0xf7'));return _0x2f598f;})[_0xe1e6('0x58')](function(_0xa43deb){logger[_0xe1e6('0x28')](_0xe1e6('0xf4'),_0x51a842['id'],_0xa42f42['id'],_0xa42f42['interval'],util[_0xe1e6('0xf8')](_0xa43deb,{'showHidden':![],'depth':null}),_0x51a842[_0xe1e6('0xef')]?_0x51a842['timezone']:_0xe1e6('0xf7'));return![];});}exports[_0xe1e6('0xee')]=function(_0x9be0b5,_0x2bb241,_0x10fcf5){var _0x2c2973=0x0;var _0x14b91e=0x0;var _0x4d6962=![];var _0xe0fd9c;var _0x3215e8;return db['ChatWebsite']['find']({'where':{'id':_0x9be0b5[_0xe1e6('0x67')]['id']},'include':[{'model':db['Interval'],'as':_0xe1e6('0xf9'),'include':[{'model':db[_0xe1e6('0xf9')],'as':'Intervals','attributes':['id',_0xe1e6('0xf1')],'raw':!![]}]}]})[_0xe1e6('0x24')](handleEntityNotFound(_0x2bb241,null))[_0xe1e6('0x24')](function(_0x27fd77){if(_0x27fd77){_0xe0fd9c=_0x27fd77;return _0x27fd77['getProactiveActions']({'raw':!![]});}})[_0xe1e6('0x24')](function(_0x57da25){if(_0xe0fd9c){if(_0x57da25){_0x3215e8=_0x57da25;}}return require(_0xe1e6('0x80'))[_0xe1e6('0x81')]();})[_0xe1e6('0x24')](function(_0x434c21){if(_0x434c21){_0x14b91e=_0x434c21[_0xe1e6('0xfa')];_0x4d6962=_0x434c21[_0xe1e6('0x82')];}})[_0xe1e6('0x24')](function(){return db[_0xe1e6('0xbd')][_0xe1e6('0x54')]({'where':{'closed':![]}});})[_0xe1e6('0x24')](function(_0x23d4a6){_0x2c2973=_0x23d4a6;if(_0x14b91e&&_0x23d4a6>_0x14b91e){return db['License'][_0xe1e6('0x72')]({'where':{'id':0x1}})[_0xe1e6('0x24')](function(_0xadd835){if(_0xadd835){_0xadd835[_0xe1e6('0xfb')](_0xe1e6('0xfc'));}});}})[_0xe1e6('0x24')](function(){if(_0xe0fd9c[_0xe1e6('0xf9')]&&_0xe0fd9c[_0xe1e6('0xf9')][_0xe1e6('0xfd')]){var _0x3fde06=[];for(var _0x35acc2=0x0;_0x35acc2<_0xe0fd9c[_0xe1e6('0xf9')][_0xe1e6('0xfd')][_0xe1e6('0x5c')];_0x35acc2++){var _0xabdcf=_0xe0fd9c[_0xe1e6('0xf9')][_0xe1e6('0xfd')][_0x35acc2][_0xe1e6('0x38')]({'plain':!![]});_0x3fde06[_0xe1e6('0xc5')](iftimePromise(_0xabdcf,_0xe0fd9c));}return BPromise['all'](_0x3fde06)[_0xe1e6('0x24')](function(_0x3bcd2e){return _[_0xe1e6('0xfe')](_0x3bcd2e);});}else{return!![];}})['then'](function(_0x3dae3a){var _0x2a6305=fs[_0xe1e6('0xff')](path[_0xe1e6('0x7c')](config['root'],_0xe1e6('0x100')),'utf8');var _0x307cba={'remote':_0xe0fd9c[_0xe1e6('0x101')],'query':querystring['stringify'](_['merge'](_0xe0fd9c[_0xe1e6('0x38')]({'plain':!![]}),{'customerIp':_0x9be0b5['headers'][_0xe1e6('0xaf')]||_0x9be0b5[_0xe1e6('0x91')]['x-real-ip']||_0x9be0b5[_0xe1e6('0x102')][_0xe1e6('0x103')]||_0x9be0b5['ip'],'referer':_0x9be0b5[_0xe1e6('0x91')][_0xe1e6('0x104')],'openedInteractions':_0x2c2973,'maxInteractions':_0x14b91e,'virtual':_0x4d6962[_0xe1e6('0xfa')],'online':_0x3dae3a,'custom':_0x4d6962}))[_0xe1e6('0x105')](/'/g,'\x5c\x27')};_0x2bb241['send'](ejs[_0xe1e6('0xd8')](Mustache[_0xe1e6('0xd8')](_0x2a6305,_0x307cba),{'proactiveActions':_0x3215e8,'alignment':_0xe0fd9c['alignment'],'verticalAlignment':_0xe0fd9c[_0xe1e6('0x106')],'div_color':_0xe0fd9c[_0xe1e6('0xec')],'text_color':_0xe0fd9c[_0xe1e6('0x107')]}));})[_0xe1e6('0x58')](handleError(_0x2bb241,null));};exports[_0xe1e6('0x108')]=function(_0x50c5c2,_0x28aede,_0x379c04){return db[_0xe1e6('0x41')]['findOne']({'where':{'id':_0x50c5c2['params']['id']}})['then'](handleEntityNotFound(_0x28aede,null))[_0xe1e6('0x24')](function(_0x49cc48){if(_0x49cc48){return db[_0xe1e6('0x109')]['transaction'](function(_0x304ff5){return db['ChatApplication'][_0xe1e6('0x37')]({'where':{'ChatWebsiteId':_0x50c5c2[_0xe1e6('0x67')]['id']},'transaction':_0x304ff5})['then'](function(_0x29beef){var _0x4702a0=_[_0xe1e6('0x40')](_0x50c5c2[_0xe1e6('0x66')],function(_0x32638d){_0x32638d[_0xe1e6('0x6d')]=_0x50c5c2[_0xe1e6('0x67')]['id'];return _0x32638d;});return db[_0xe1e6('0xa5')][_0xe1e6('0x10a')](_0x4702a0,{'transaction':_0x304ff5});});})['then'](function(){return db[_0xe1e6('0xa5')][_0xe1e6('0x10b')]({'where':{'ChatWebsiteId':_0x50c5c2[_0xe1e6('0x67')]['id']},'order':'priority'});});}})[_0xe1e6('0x24')](respondWithResult(_0x28aede,null))[_0xe1e6('0x58')](handleError(_0x28aede,null));};exports['getApplications']=function(_0x24861b,_0x46bdd3,_0x2af581){var _0x52689a={};var _0x5efab1={};var _0x1834d2;var _0x35c85c;return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x24861b[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x46bdd3,null))[_0xe1e6('0x24')](function(_0x24fbf5){if(_0x24fbf5){_0x1834d2=_0x24fbf5;_0x5efab1['model']=_[_0xe1e6('0x46')](db['ChatApplication'][_0xe1e6('0x5b')]);_0x5efab1[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x24861b[_0xe1e6('0x45')]);_0x5efab1[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x5efab1[_0xe1e6('0x4a')],_0x5efab1[_0xe1e6('0x45')]);_0x52689a['attributes']=_[_0xe1e6('0x48')](_0x5efab1[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x24861b[_0xe1e6('0x45')][_0xe1e6('0x4b')]));_0x52689a['attributes']=_0x52689a[_0xe1e6('0x49')][_0xe1e6('0x5c')]?_0x52689a[_0xe1e6('0x49')]:_0x5efab1[_0xe1e6('0x4a')];_0x52689a[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x24861b['query'][_0xe1e6('0x4f')]);_0x52689a[_0xe1e6('0x52')]=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0x24861b[_0xe1e6('0x45')],_0x5efab1[_0xe1e6('0x47')]));if(_0x24861b['query'][_0xe1e6('0x50')]){_0x52689a[_0xe1e6('0x52')]=_[_0xe1e6('0x51')](_0x52689a[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x52689a[_0xe1e6('0x49')],function(_0x240fd9){var _0x6c240={};_0x6c240[_0x240fd9]={'$like':'%'+_0x24861b['query']['filter']+'%'};return _0x6c240;})});}_0x52689a=_['merge']({},_0x52689a,_0x24861b[_0xe1e6('0x53')]);return _0x1834d2[_0xe1e6('0x10c')](_0x52689a);}})[_0xe1e6('0x24')](function(_0xb14bff){if(_0xb14bff){_0x35c85c=_0xb14bff[_0xe1e6('0x5c')];if(!_0x24861b[_0xe1e6('0x45')][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x52689a['limit']=qs[_0xe1e6('0x4d')](_0x24861b['query'][_0xe1e6('0x4d')]);_0x52689a[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x24861b['query'][_0xe1e6('0x31')]);}return _0x1834d2['getApplications'](_0x52689a);}})[_0xe1e6('0x24')](function(_0x47a2c2){if(_0x47a2c2){return _0x47a2c2?{'count':_0x35c85c,'rows':_0x47a2c2}:null;}})[_0xe1e6('0x24')](respondWithResult(_0x46bdd3,null))[_0xe1e6('0x58')](handleError(_0x46bdd3,null));};exports[_0xe1e6('0x10d')]=function(_0x217529,_0x11b38b,_0x550aa8){return db[_0xe1e6('0x10e')][_0xe1e6('0x5e')]({'where':{'id':_0x217529[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x11b38b,null))['then'](function(_0x225a0e){if(_0x225a0e){return _0x225a0e[_0xe1e6('0x10d')](_0x217529[_0xe1e6('0x66')][_0xe1e6('0x6f')],_[_0xe1e6('0xe7')](_0x217529[_0xe1e6('0x66')],[_0xe1e6('0x6f'),'id'])||{});}})[_0xe1e6('0x24')](respondWithResult(_0x11b38b,null))[_0xe1e6('0x58')](handleError(_0x11b38b,null));};exports['getProactiveActions']=function(_0x5494a3,_0x3863ec,_0x50e703){var _0xafa87={};var _0x6fa73a={};var _0x5b7d32;var _0x1fe500;return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x5494a3[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0x3863ec,null))[_0xe1e6('0x24')](function(_0x450d90){if(_0x450d90){_0x5b7d32=_0x450d90;_0x6fa73a[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db['ChatProactiveAction'][_0xe1e6('0x5b')]);_0x6fa73a['query']=_[_0xe1e6('0x46')](_0x5494a3['query']);_0x6fa73a[_0xe1e6('0x47')]=_['intersection'](_0x6fa73a[_0xe1e6('0x4a')],_0x6fa73a[_0xe1e6('0x45')]);_0xafa87[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x6fa73a[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x5494a3['query']['fields']));_0xafa87['attributes']=_0xafa87['attributes'][_0xe1e6('0x5c')]?_0xafa87[_0xe1e6('0x49')]:_0x6fa73a[_0xe1e6('0x4a')];_0xafa87[_0xe1e6('0x4e')]=qs[_0xe1e6('0x4f')](_0x5494a3[_0xe1e6('0x45')][_0xe1e6('0x4f')]);_0xafa87['where']=qs['filters'](_[_0xe1e6('0x6c')](_0x5494a3[_0xe1e6('0x45')],_0x6fa73a[_0xe1e6('0x47')]));if(_0x5494a3[_0xe1e6('0x45')]['filter']){_0xafa87['where']=_['merge'](_0xafa87[_0xe1e6('0x52')],{'$or':_['map'](_0xafa87[_0xe1e6('0x49')],function(_0x11e091){var _0x31d734={};_0x31d734[_0x11e091]={'$like':'%'+_0x5494a3['query']['filter']+'%'};return _0x31d734;})});}_0xafa87=_['merge']({},_0xafa87,_0x5494a3['options']);return _0x5b7d32[_0xe1e6('0x10f')](_0xafa87);}})[_0xe1e6('0x24')](function(_0x29e94c){if(_0x29e94c){_0x1fe500=_0x29e94c[_0xe1e6('0x5c')];if(!_0x5494a3[_0xe1e6('0x45')]['hasOwnProperty'](_0xe1e6('0x6b'))){_0xafa87[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x5494a3[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0xafa87['offset']=qs[_0xe1e6('0x31')](_0x5494a3[_0xe1e6('0x45')]['offset']);}return _0x5b7d32['getProactiveActions'](_0xafa87);}})['then'](function(_0x4af4d3){if(_0x4af4d3){return _0x4af4d3?{'count':_0x1fe500,'rows':_0x4af4d3}:null;}})['then'](respondWithResult(_0x3863ec,null))['catch'](handleError(_0x3863ec,null));};exports[_0xe1e6('0x110')]=function(_0x22acf2,_0x41846b,_0x1aa751){var _0x43af74=_0x22acf2['query']['online']===_0xe1e6('0x111')?_0xe1e6('0x112'):_0xe1e6('0x113');return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'attributes':['id',_0x43af74],'where':{'id':_0x22acf2[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0x41846b,null))[_0xe1e6('0x24')](function(_0x195100){if(_0x195100){var _0x150516=_0x195100[_0x43af74];var _0x454a48=_0x150516&&_0x150516[_0xe1e6('0x114')]?_0x150516[_0xe1e6('0x114')]:[];_0x41846b[_0xe1e6('0x3d')]({'fromKey':_[_0xe1e6('0x8e')](_0x150516[_0xe1e6('0x115')])?undefined:_0x150516[_0xe1e6('0x115')],'count':_0x454a48[_0xe1e6('0x5c')],'rows':_0x454a48});}})[_0xe1e6('0x58')](handleError(_0x41846b,null));};exports['getOfflineMessages']=function(_0x581162,_0x32fbe0,_0x32b225){var _0x57c99f={'raw':![],'where':{}};var _0x57ad4b={};var _0x659c5a={'count':0x0,'rows':[]};return db[_0xe1e6('0x41')][_0xe1e6('0x72')]({'where':{'id':_0x581162['params']['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x32fbe0,null))[_0xe1e6('0x24')](function(_0x468308){if(_0x468308){_0x57ad4b[_0xe1e6('0x4a')]=_['keys'](db['ChatOfflineMessage'][_0xe1e6('0x5b')]);_0x57ad4b[_0xe1e6('0x45')]=_[_0xe1e6('0x46')](_0x581162[_0xe1e6('0x45')]);_0x57ad4b[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x57ad4b['model'],_0x57ad4b[_0xe1e6('0x45')]);_0x57c99f[_0xe1e6('0x49')]=_['intersection'](_0x57ad4b[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4b')]));_0x57c99f[_0xe1e6('0x49')]=_0x57c99f[_0xe1e6('0x49')]['length']?_0x57c99f['attributes']:_0x57ad4b[_0xe1e6('0x4a')];if(!_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x57c99f[_0xe1e6('0x4d')]=qs['limit'](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4d')]);_0x57c99f[_0xe1e6('0x31')]=qs['offset'](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x31')]);}_0x57c99f[_0xe1e6('0x4e')]=qs['sort'](_0x581162[_0xe1e6('0x45')][_0xe1e6('0x4f')]);_0x57c99f[_0xe1e6('0x52')]=qs[_0xe1e6('0x47')](_[_0xe1e6('0x6c')](_0x581162['query'],_0x57ad4b[_0xe1e6('0x47')]));_0x57c99f[_0xe1e6('0x52')][_0xe1e6('0x6d')]=_0x468308['id'];if(_0x581162['query'][_0xe1e6('0x50')]){_0x57c99f['where']=_[_0xe1e6('0x51')](_0x57c99f['where'],{'$or':_[_0xe1e6('0x40')](_0x57c99f[_0xe1e6('0x49')],function(_0x35b25d){var _0x18a635={};_0x18a635[_0x35b25d]={'$like':'%'+_0x581162['query'][_0xe1e6('0x50')]+'%'};return _0x18a635;})});}_0x57c99f=_['merge']({},_0x57c99f,_0x581162[_0xe1e6('0x53')]);return db[_0xe1e6('0x116')][_0xe1e6('0x54')]({'where':_0x57c99f[_0xe1e6('0x52')]})[_0xe1e6('0x24')](function(_0x278703){_0x659c5a[_0xe1e6('0x54')]=_0x278703;if(_0x581162['query']['includeAll']){_0x57c99f[_0xe1e6('0x5d')]=[{'all':!![]}];}else{_0x57c99f[_0xe1e6('0x5d')]=[{'model':db['CmContact'],'as':_0xe1e6('0x117'),'required':![]}];}return db[_0xe1e6('0x116')][_0xe1e6('0x56')](_0x57c99f);})[_0xe1e6('0x24')](function(_0x433ff1){_0x659c5a[_0xe1e6('0x57')]=_0x433ff1;return _0x659c5a;});}})['then'](respondWithFilteredResult(_0x32fbe0,_0x57c99f))['catch'](handleError(_0x32fbe0,null));};exports[_0xe1e6('0x118')]=function(_0x2a59b8,_0x300d4d,_0x24be92){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x2a59b8[_0xe1e6('0x67')]['id']}})['then'](handleEntityNotFound(_0x300d4d,null))[_0xe1e6('0x24')](function(_0x4246dd){if(_0x4246dd){return _0x4246dd[_0xe1e6('0x118')](_0x2a59b8[_0xe1e6('0x66')]['ids'],_[_0xe1e6('0xe7')](_0x2a59b8[_0xe1e6('0x66')],[_0xe1e6('0x6f'),'id'])||{})[_0xe1e6('0xc1')](function(_0x53de22){for(var _0x16854b=0x0;_0x16854b<_0x2a59b8[_0xe1e6('0x66')][_0xe1e6('0x6f')]['length'];_0x16854b+=0x1){socket['emit'](_0xe1e6('0x119'),{'UserId':_0x2a59b8[_0xe1e6('0x66')]['ids'][_0x16854b],'ChatWebsiteId':_0x2a59b8[_0xe1e6('0x67')]['id']});}return _0x53de22;});}})[_0xe1e6('0x24')](respondWithResult(_0x300d4d,null))[_0xe1e6('0x58')](handleError(_0x300d4d,null));};exports['removeAgents']=function(_0x3f3543,_0x2377bd,_0x2f6852){return db[_0xe1e6('0x41')][_0xe1e6('0x5e')]({'where':{'id':_0x3f3543[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x2377bd,null))[_0xe1e6('0x24')](function(_0x36aff1){if(_0x36aff1){return _0x36aff1[_0xe1e6('0x11a')](_0x3f3543['query']['ids'])[_0xe1e6('0x24')](function(){if(_[_0xe1e6('0x11b')](_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')])){for(var _0xb87c8d=0x0;_0xb87c8d<_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')][_0xe1e6('0x5c')];_0xb87c8d+=0x1){socket[_0xe1e6('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')][_0xb87c8d]),'ChatWebsiteId':Number(_0x3f3543[_0xe1e6('0x67')]['id'])});}}else{socket[_0xe1e6('0x11c')](_0xe1e6('0x11d'),{'UserId':Number(_0x3f3543[_0xe1e6('0x45')][_0xe1e6('0x6f')]),'ChatWebsiteId':Number(_0x3f3543['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2377bd,null))[_0xe1e6('0x58')](handleError(_0x2377bd,null));};exports[_0xe1e6('0x11e')]=function(_0x3c7f65,_0x6810f,_0x455047){var _0x2aa92b={};var _0x38ae7f={};var _0x16b967;var _0xcd945e;return db[_0xe1e6('0x41')]['findOne']({'where':{'id':_0x3c7f65[_0xe1e6('0x67')]['id']}})[_0xe1e6('0x24')](handleEntityNotFound(_0x6810f,null))[_0xe1e6('0x24')](function(_0x495857){if(_0x495857){_0x16b967=_0x495857;_0x38ae7f[_0xe1e6('0x4a')]=_[_0xe1e6('0x46')](db[_0xe1e6('0xc9')][_0xe1e6('0x5b')]);_0x38ae7f[_0xe1e6('0x45')]=_['keys'](_0x3c7f65['query']);_0x38ae7f[_0xe1e6('0x47')]=_[_0xe1e6('0x48')](_0x38ae7f[_0xe1e6('0x4a')],_0x38ae7f[_0xe1e6('0x45')]);_0x2aa92b[_0xe1e6('0x49')]=_[_0xe1e6('0x48')](_0x38ae7f[_0xe1e6('0x4a')],qs[_0xe1e6('0x4b')](_0x3c7f65['query'][_0xe1e6('0x4b')]));_0x2aa92b[_0xe1e6('0x49')]=_0x2aa92b['attributes'][_0xe1e6('0x5c')]?_0x2aa92b[_0xe1e6('0x49')]:_0x38ae7f[_0xe1e6('0x4a')];_0x2aa92b['order']=qs[_0xe1e6('0x4f')](_0x3c7f65['query'][_0xe1e6('0x4f')]);_0x2aa92b[_0xe1e6('0x52')]=qs['filters'](_[_0xe1e6('0x6c')](_0x3c7f65[_0xe1e6('0x45')],_0x38ae7f[_0xe1e6('0x47')]));if(_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x50')]){_0x2aa92b[_0xe1e6('0x52')]=_[_0xe1e6('0x51')](_0x2aa92b[_0xe1e6('0x52')],{'$or':_[_0xe1e6('0x40')](_0x2aa92b['attributes'],function(_0x5f3e33){var _0x5d15c0={};_0x5d15c0[_0x5f3e33]={'$like':'%'+_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x50')]+'%'};return _0x5d15c0;})});}_0x2aa92b=_['merge']({},_0x2aa92b,_0x3c7f65[_0xe1e6('0x53')]);return _0x16b967[_0xe1e6('0x11e')](_0x2aa92b);}})[_0xe1e6('0x24')](function(_0x5024a5){if(_0x5024a5){_0xcd945e=_0x5024a5[_0xe1e6('0x5c')];if(!_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x4c')](_0xe1e6('0x6b'))){_0x2aa92b[_0xe1e6('0x4d')]=qs[_0xe1e6('0x4d')](_0x3c7f65['query'][_0xe1e6('0x4d')]);_0x2aa92b[_0xe1e6('0x31')]=qs[_0xe1e6('0x31')](_0x3c7f65[_0xe1e6('0x45')][_0xe1e6('0x31')]);}return _0x16b967[_0xe1e6('0x11e')](_0x2aa92b);}})[_0xe1e6('0x24')](function(_0xf5409f){if(_0xf5409f){return _0xf5409f?{'count':_0xcd945e,'rows':_0xf5409f}:null;}})['then'](respondWithResult(_0x6810f,null))[_0xe1e6('0x58')](handleError(_0x6810f,null));}; \ No newline at end of file +var _0x0ca4=['removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','describe','addDisposition','Disposition','getDispositions','order','ChatWebsiteId','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','notify','user-agent-parser','setUA','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','ListId','contact','customerIp','headers','cf-connecting-ip','first','x-forwarded-for','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','ChatInteraction','threadId','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','include','Contact','User','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','all','utf8','connection','remoteAddress','alignment','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit'];(function(_0x394739,_0x19ce1e){var _0x48d11e=function(_0x570c40){while(--_0x570c40){_0x394739['push'](_0x394739['shift']());}};_0x48d11e(++_0x19ce1e);}(_0x0ca4,0x11b));var _0x40ca=function(_0x4084d8,_0x5ca4eb){_0x4084d8=_0x4084d8-0x0;var _0x1535da=_0x0ca4[_0x4084d8];return _0x1535da;};'use strict';var pdf=require(_0x40ca('0x0'));var emlformat=require(_0x40ca('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40ca('0x3'));var Mustache=require(_0x40ca('0x4'));var util=require(_0x40ca('0x5'));var path=require(_0x40ca('0x6'));var sox=require(_0x40ca('0x7'));var csv=require('to-csv');var ejs=require(_0x40ca('0x8'));var fs=require('fs');var _=require(_0x40ca('0x9'));var squel=require(_0x40ca('0xa'));var crypto=require('crypto');var jsforce=require(_0x40ca('0xb'));var deskjs=require(_0x40ca('0xc'));var toCsv=require(_0x40ca('0xd'));var querystring=require(_0x40ca('0xe'));var Papa=require(_0x40ca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40ca('0x10'));var as=require(_0x40ca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x40ca('0x12'));var utils=require(_0x40ca('0x13'));var config=require(_0x40ca('0x14'));var db=require(_0x40ca('0x15'))['db'];config['redis']=_[_0x40ca('0x16')](config[_0x40ca('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40ca('0x17')]));require(_0x40ca('0x18'))[_0x40ca('0x19')](socket);var jayson=require(_0x40ca('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x40ca('0x1b')]['http']({'port':0x232a});var client9003=jayson['client'][_0x40ca('0x1c')]({'port':0x232b});function checkPasswordPattern(_0xd03941,_0x11f507,_0x4d1bbf){if(_0x4d1bbf){var _0x4d4cf6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d4cf6[_0x40ca('0x1d')](_0x11f507)){return _0xd03941;}else{throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xd03941;}}function respondWithRpcPromise(_0x3ba2b6,_0x3afba8,_0x2a5ba4,_0x5698e6){return new BPromise(function(_0x5131bd,_0x156d14){var _0x4ae37e=_0x5698e6||client;return _0x4ae37e[_0x40ca('0x20')](_0x3ba2b6,_0x2a5ba4)[_0x40ca('0x21')](function(_0x50dcf1){logger[_0x40ca('0x22')](_0x40ca('0x23'),_0x3afba8,'request\x20sent');logger[_0x40ca('0x24')](_0x40ca('0x25'),_0x3afba8,_0x40ca('0x26'),JSON[_0x40ca('0x27')](_0x50dcf1));if(_0x50dcf1[_0x40ca('0x28')]){if(_0x50dcf1[_0x40ca('0x28')]['code']===0x1f4){logger[_0x40ca('0x28')](_0x40ca('0x23'),_0x3afba8,_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);return _0x156d14(_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);}logger[_0x40ca('0x28')](_0x40ca('0x23'),_0x3afba8,_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);return _0x5131bd(_0x50dcf1[_0x40ca('0x28')][_0x40ca('0x29')]);}else{logger[_0x40ca('0x22')](_0x40ca('0x23'),_0x3afba8,_0x40ca('0x26'));_0x5131bd(_0x50dcf1['result'][_0x40ca('0x29')]);}})['catch'](function(_0x4f3b1e){logger[_0x40ca('0x28')](_0x40ca('0x23'),_0x3afba8,_0x4f3b1e);_0x156d14(_0x4f3b1e);});});}function respondWithStatusCode(_0x234f60,_0x16d401){_0x16d401=_0x16d401||0xcc;return function(_0x4dc5e0){if(_0x4dc5e0){return _0x234f60[_0x40ca('0x2a')](_0x16d401);}return _0x234f60[_0x40ca('0x2b')](_0x16d401)[_0x40ca('0x2c')]();};}function respondWithResult(_0x4be511,_0x13ba13){_0x13ba13=_0x13ba13||0xc8;return function(_0x3476f2){if(_0x3476f2){return _0x4be511[_0x40ca('0x2b')](_0x13ba13)[_0x40ca('0x2d')](_0x3476f2);}};}function respondWithFilteredResult(_0x2672cb,_0x5a5168){return function(_0xf5c329){if(_0xf5c329){var _0x13de2e=_0xf5c329[_0x40ca('0x2e')],_0x2d326b=_0x5a5168[_0x40ca('0x2f')],_0x4cf670=_0x5a5168['offset']+_0x5a5168[_0x40ca('0x30')],_0x5addc4;if(_0x4cf670>=_0x13de2e){_0x4cf670=_0x13de2e;_0x5addc4=0xc8;}else{_0x5addc4=0xce;}_0x2672cb['status'](_0x5addc4);return _0x2672cb[_0x40ca('0x31')](_0x40ca('0x32'),_0x2d326b+'-'+_0x4cf670+'/'+_0x13de2e)['json'](_0xf5c329);}return null;};}function patchUpdates(_0x16ff38){return function(_0x285a8f){try{jsonpatch[_0x40ca('0x33')](_0x285a8f,_0x16ff38,!![]);}catch(_0x1023f6){return BPromise[_0x40ca('0x34')](_0x1023f6);}return _0x285a8f[_0x40ca('0x35')]();};}function saveUpdates(_0x12d2aa,_0xb58674){return function(_0x1754aa){if(_0x1754aa){return _0x1754aa[_0x40ca('0x36')](_0x12d2aa)[_0x40ca('0x21')](function(_0x105750){return _0x105750;});}return null;};}function removeEntity(_0x4a1f7f,_0x1a2ac4){return function(_0x23b867){if(_0x23b867){return _0x23b867['destroy']()[_0x40ca('0x21')](function(){var _0x3bac4e=_0x23b867['get']({'plain':!![]});var _0x380181=_0x40ca('0x37');return db[_0x40ca('0x38')][_0x40ca('0x39')]({'where':{'type':_0x380181,'resourceId':_0x3bac4e['id']}})[_0x40ca('0x21')](function(){return _0x23b867;});})[_0x40ca('0x21')](function(){_0x4a1f7f['status'](0xcc)[_0x40ca('0x2c')]();});}};}function handleEntityNotFound(_0xfe1a40,_0x4569a3){return function(_0x4af607){if(!_0x4af607){_0xfe1a40[_0x40ca('0x2a')](0x194);}return _0x4af607;};}function handleError(_0x37b102,_0x2a0c07){_0x2a0c07=_0x2a0c07||0x1f4;return function(_0x5dcd3d){logger[_0x40ca('0x28')](_0x5dcd3d[_0x40ca('0x3a')]);if(_0x5dcd3d[_0x40ca('0x3b')]){delete _0x5dcd3d[_0x40ca('0x3b')];}_0x37b102[_0x40ca('0x2b')](_0x2a0c07)[_0x40ca('0x3c')](_0x5dcd3d);};}exports[_0x40ca('0x3d')]=function(_0x586305,_0x4b5136){var _0x3ef452={'include':[{'model':db[_0x40ca('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1bad01={},_0x8a50fd={'count':0x0,'rows':[]};var _0x23a1ab=_[_0x40ca('0x3f')](db[_0x40ca('0x40')][_0x40ca('0x41')],function(_0x46f864){return{'name':_0x46f864[_0x40ca('0x42')],'type':_0x46f864[_0x40ca('0x43')]['key']};});_0x1bad01['model']=_[_0x40ca('0x3f')](_0x23a1ab,_0x40ca('0x3b'));_0x1bad01['query']=_[_0x40ca('0x44')](_0x586305[_0x40ca('0x45')]);_0x1bad01[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x1bad01['model'],_0x1bad01[_0x40ca('0x45')]);_0x3ef452[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x1bad01[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x586305['query']['fields']));_0x3ef452[_0x40ca('0x48')]=_0x3ef452[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x3ef452[_0x40ca('0x48')]:_0x1bad01[_0x40ca('0x49')];if(!_0x586305['query'][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x3ef452[_0x40ca('0x30')]=qs['limit'](_0x586305[_0x40ca('0x45')][_0x40ca('0x30')]);_0x3ef452[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x586305['query'][_0x40ca('0x2f')]);}_0x3ef452['order']=qs[_0x40ca('0x4e')](_0x586305[_0x40ca('0x45')][_0x40ca('0x4e')]);_0x3ef452[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x586305[_0x40ca('0x45')],_0x1bad01[_0x40ca('0x46')]),_0x23a1ab);if(_0x586305[_0x40ca('0x45')]['filter']){_0x3ef452[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x3ef452['where'],{'$or':_[_0x40ca('0x3f')](_0x23a1ab,function(_0x1dd9c0){if(_0x1dd9c0[_0x40ca('0x43')]!=='VIRTUAL'){var _0xc78031={};_0xc78031[_0x1dd9c0['name']]={'$like':'%'+_0x586305[_0x40ca('0x45')][_0x40ca('0x52')]+'%'};return _0xc78031;}})});}_0x3ef452=_[_0x40ca('0x51')]({},_0x3ef452,_0x586305[_0x40ca('0x53')]);var _0xbe46ae={'where':_0x3ef452[_0x40ca('0x4f')]};return db[_0x40ca('0x40')][_0x40ca('0x2e')](_0xbe46ae)['then'](function(_0x4f4aeb){_0x8a50fd['count']=_0x4f4aeb;if(_0x586305['query']['includeAll']){_0x3ef452['include']=[{'all':!![]}];}return db[_0x40ca('0x40')][_0x40ca('0x54')](_0x3ef452);})[_0x40ca('0x21')](function(_0x4e07ef){_0x8a50fd[_0x40ca('0x55')]=_0x4e07ef;return _0x8a50fd;})[_0x40ca('0x21')](respondWithFilteredResult(_0x4b5136,_0x3ef452))[_0x40ca('0x56')](handleError(_0x4b5136,null));};exports[_0x40ca('0x57')]=function(_0x1fb451,_0x15efb2){var _0x3da76d={'raw':![],'where':{'id':_0x1fb451[_0x40ca('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x40ca('0x59')}]},_0x15a77f={};_0x15a77f['model']=_[_0x40ca('0x44')](db['ChatWebsite'][_0x40ca('0x41')]);_0x15a77f[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x1fb451[_0x40ca('0x45')]);_0x15a77f[_0x40ca('0x46')]=_['intersection'](_0x15a77f['model'],_0x15a77f['query']);_0x3da76d[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x15a77f['model'],qs[_0x40ca('0x4a')](_0x1fb451['query'][_0x40ca('0x4a')]));_0x3da76d[_0x40ca('0x48')]=_0x3da76d[_0x40ca('0x48')]['length']?_0x3da76d[_0x40ca('0x48')]:_0x15a77f[_0x40ca('0x49')];if(_0x1fb451[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x3da76d['include']=[{'all':!![]}];}_0x3da76d=_[_0x40ca('0x51')]({},_0x3da76d,_0x1fb451[_0x40ca('0x53')]);return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x3da76d)[_0x40ca('0x21')](handleEntityNotFound(_0x15efb2,null))[_0x40ca('0x21')](respondWithResult(_0x15efb2,null))[_0x40ca('0x56')](handleError(_0x15efb2,null));};exports['create']=function(_0x2bcfde,_0x453efd){return db[_0x40ca('0x40')]['create'](_0x2bcfde[_0x40ca('0x5c')],{})['then'](function(_0x196e5a){var _0x2ec317=_0x2bcfde[_0x40ca('0x5d')][_0x40ca('0x5e')]({'plain':!![]});if(!_0x2ec317)throw new Error(_0x40ca('0x5f'));if(_0x2ec317[_0x40ca('0x60')]===_0x40ca('0x5d')){var _0x5342a6=_0x196e5a['get']({'plain':!![]});var _0x514c97='ChatWebsites';return db[_0x40ca('0x61')][_0x40ca('0x5b')]({'where':{'name':_0x514c97,'userProfileId':_0x2ec317['userProfileId']},'raw':!![]})[_0x40ca('0x21')](function(_0x319ae5){if(_0x319ae5&&_0x319ae5[_0x40ca('0x62')]===0x0){return db[_0x40ca('0x38')][_0x40ca('0x63')]({'name':_0x5342a6[_0x40ca('0x3b')],'resourceId':_0x5342a6['id'],'type':_0x319ae5[_0x40ca('0x3b')],'sectionId':_0x319ae5['id']},{})[_0x40ca('0x21')](function(){return _0x196e5a;});}else{return _0x196e5a;}})['catch'](function(_0x389af2){logger[_0x40ca('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x389af2);throw _0x389af2;});}return _0x196e5a;})[_0x40ca('0x21')](respondWithResult(_0x453efd,0xc9))['catch'](handleError(_0x453efd,null));};exports[_0x40ca('0x36')]=function(_0x4b422b,_0x21f825){if(_0x4b422b['body']['id']){delete _0x4b422b['body']['id'];}return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x4b422b[_0x40ca('0x58')]['id']},'include':[{'model':db[_0x40ca('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x40ca('0x21')](handleEntityNotFound(_0x21f825,null))[_0x40ca('0x21')](saveUpdates(_0x4b422b[_0x40ca('0x5c')],null))[_0x40ca('0x21')](respondWithResult(_0x21f825,null))[_0x40ca('0x56')](handleError(_0x21f825,null));};exports[_0x40ca('0x39')]=function(_0x4afc77,_0x36d156){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x4afc77['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x36d156,null))['then'](removeEntity(_0x36d156,null))[_0x40ca('0x56')](handleError(_0x36d156,null));};exports[_0x40ca('0x64')]=function(_0x54de4b,_0x3905db){return db[_0x40ca('0x40')][_0x40ca('0x64')]()['then'](respondWithResult(_0x3905db,null))[_0x40ca('0x56')](handleError(_0x3905db,null));};exports[_0x40ca('0x65')]=function(_0x5f402c,_0x3684bf,_0x56d54e){if(_0x5f402c[_0x40ca('0x5c')]['id']){delete _0x5f402c[_0x40ca('0x5c')]['id'];}return db[_0x40ca('0x40')]['find']({'where':{'id':_0x5f402c[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x3684bf,null))['then'](function(_0x12d019){if(_0x12d019){_0x5f402c[_0x40ca('0x5c')]['ChatWebsiteId']=_0x12d019['id'];return db[_0x40ca('0x66')][_0x40ca('0x63')](_0x5f402c[_0x40ca('0x5c')]);}})['then'](respondWithResult(_0x3684bf,null))[_0x40ca('0x56')](handleError(_0x3684bf,null));};exports[_0x40ca('0x67')]=function(_0xd55183,_0x1995b0,_0x6e1014){var _0x58496d={'raw':![],'where':{}};var _0x1ceeea={};var _0x5d1f68={'count':0x0,'rows':[]};return db[_0x40ca('0x40')]['findOne']({'where':{'id':_0xd55183[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x1995b0,null))[_0x40ca('0x21')](function(_0x58c080){if(_0x58c080){_0x1ceeea[_0x40ca('0x49')]=_[_0x40ca('0x44')](db[_0x40ca('0x66')]['rawAttributes']);_0x1ceeea[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0xd55183[_0x40ca('0x45')]);_0x1ceeea['filters']=_[_0x40ca('0x47')](_0x1ceeea['model'],_0x1ceeea['query']);_0x58496d[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x1ceeea[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0xd55183[_0x40ca('0x45')][_0x40ca('0x4a')]));_0x58496d[_0x40ca('0x48')]=_0x58496d[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x58496d[_0x40ca('0x48')]:_0x1ceeea[_0x40ca('0x49')];if(!_0xd55183['query'][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x58496d[_0x40ca('0x30')]=qs['limit'](_0xd55183[_0x40ca('0x45')]['limit']);_0x58496d[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0xd55183[_0x40ca('0x45')][_0x40ca('0x2f')]);}_0x58496d[_0x40ca('0x68')]=qs[_0x40ca('0x4e')](_0xd55183['query'][_0x40ca('0x4e')]);_0x58496d[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0xd55183[_0x40ca('0x45')],_0x1ceeea[_0x40ca('0x46')]));_0x58496d[_0x40ca('0x4f')][_0x40ca('0x69')]=_0x58c080['id'];if(_0xd55183[_0x40ca('0x45')]['filter']){_0x58496d[_0x40ca('0x4f')]=_['merge'](_0x58496d[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x58496d[_0x40ca('0x48')],function(_0x1d0c00){var _0x443116={};_0x443116[_0x1d0c00]={'$like':'%'+_0xd55183[_0x40ca('0x45')][_0x40ca('0x52')]+'%'};return _0x443116;})});}_0x58496d=_['merge']({},_0x58496d,_0xd55183['options']);return db[_0x40ca('0x66')][_0x40ca('0x2e')]({'where':_0x58496d['where']})['then'](function(_0x2073be){_0x5d1f68['count']=_0x2073be;if(_0xd55183[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x58496d['include']=[{'all':!![]}];}return db[_0x40ca('0x66')]['findAll'](_0x58496d);})['then'](function(_0x5f2828){_0x5d1f68[_0x40ca('0x55')]=_0x5f2828;return _0x5d1f68;});}})['then'](respondWithFilteredResult(_0x1995b0,_0x58496d))[_0x40ca('0x56')](handleError(_0x1995b0,null));};exports['removeDispositions']=function(_0x21c1a0,_0x482a5d,_0x58e9a4){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x21c1a0['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x482a5d,null))[_0x40ca('0x21')](function(_0x4f2d95){if(_0x4f2d95){return _0x4f2d95['removeDispositions'](_0x21c1a0['query'][_0x40ca('0x6a')]);}})[_0x40ca('0x21')](respondWithStatusCode(_0x482a5d,null))[_0x40ca('0x56')](handleError(_0x482a5d,null));};exports[_0x40ca('0x6b')]=function(_0x44fefe,_0xf1c76d,_0x5fd37){if(_0x44fefe['body']['id']){delete _0x44fefe['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x44fefe[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0xf1c76d,null))[_0x40ca('0x21')](function(_0x51bf46){if(_0x51bf46){_0x44fefe[_0x40ca('0x5c')][_0x40ca('0x69')]=_0x51bf46['id'];return db[_0x40ca('0x6c')][_0x40ca('0x63')](_0x44fefe['body']);}})[_0x40ca('0x21')](respondWithResult(_0xf1c76d,null))['catch'](handleError(_0xf1c76d,null));};exports[_0x40ca('0x6d')]=function(_0x2da6a3,_0x314485,_0xb9567c){var _0x5a8682={'raw':![],'where':{}};var _0x1dd635={};var _0xc3d73e={'count':0x0,'rows':[]};return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x2da6a3['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x314485,null))['then'](function(_0x4ff957){if(_0x4ff957){_0x1dd635['model']=_['keys'](db[_0x40ca('0x6c')]['rawAttributes']);_0x1dd635[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x2da6a3['query']);_0x1dd635[_0x40ca('0x46')]=_['intersection'](_0x1dd635['model'],_0x1dd635[_0x40ca('0x45')]);_0x5a8682[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x1dd635[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x4a')]));_0x5a8682['attributes']=_0x5a8682['attributes'][_0x40ca('0x4b')]?_0x5a8682[_0x40ca('0x48')]:_0x1dd635[_0x40ca('0x49')];if(!_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x4c')]('nolimit')){_0x5a8682['limit']=qs[_0x40ca('0x30')](_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x30')]);_0x5a8682['offset']=qs[_0x40ca('0x2f')](_0x2da6a3[_0x40ca('0x45')]['offset']);}_0x5a8682[_0x40ca('0x68')]=qs[_0x40ca('0x4e')](_0x2da6a3['query'][_0x40ca('0x4e')]);_0x5a8682[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x2da6a3[_0x40ca('0x45')],_0x1dd635[_0x40ca('0x46')]));_0x5a8682['where'][_0x40ca('0x69')]=_0x4ff957['id'];if(_0x2da6a3[_0x40ca('0x45')]['filter']){_0x5a8682[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x5a8682[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x5a8682['attributes'],function(_0x1eda7e){var _0x377b60={};_0x377b60[_0x1eda7e]={'$like':'%'+_0x2da6a3[_0x40ca('0x45')]['filter']+'%'};return _0x377b60;})});}_0x5a8682=_[_0x40ca('0x51')]({},_0x5a8682,_0x2da6a3[_0x40ca('0x53')]);return db[_0x40ca('0x6c')][_0x40ca('0x2e')]({'where':_0x5a8682[_0x40ca('0x4f')]})['then'](function(_0x57fc8e){_0xc3d73e['count']=_0x57fc8e;if(_0x2da6a3[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x5a8682['include']=[{'all':!![]}];}return db[_0x40ca('0x6c')][_0x40ca('0x54')](_0x5a8682);})[_0x40ca('0x21')](function(_0x4fbaf0){_0xc3d73e[_0x40ca('0x55')]=_0x4fbaf0;return _0xc3d73e;});}})[_0x40ca('0x21')](respondWithFilteredResult(_0x314485,_0x5a8682))[_0x40ca('0x56')](handleError(_0x314485,null));};exports[_0x40ca('0x6f')]=function(_0x50f50f,_0x4c5e3c,_0x5608cf){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x50f50f[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x4c5e3c,null))['then'](function(_0x2e7c04){if(_0x2e7c04){return _0x2e7c04['removeAnswers'](_0x50f50f['query'][_0x40ca('0x6a')]);}})[_0x40ca('0x21')](respondWithStatusCode(_0x4c5e3c,null))[_0x40ca('0x56')](handleError(_0x4c5e3c,null));};exports[_0x40ca('0x70')]=function(_0x11eb33,_0x3feaea,_0x3c257b){_0x11eb33[_0x40ca('0x5c')][_0x40ca('0x71')]=_0x11eb33[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x11eb33[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x3feaea,null))['then'](saveUpdates(_0x11eb33['body'],null))[_0x40ca('0x21')](respondWithResult(_0x3feaea,null))[_0x40ca('0x56')](handleError(_0x3feaea,null));};exports['addAvatar']=function(_0x218675,_0x28c4fa,_0x555546){_0x218675[_0x40ca('0x5c')][_0x40ca('0x74')]=_0x218675[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x218675[_0x40ca('0x58')]['id']}})['then'](handleEntityNotFound(_0x28c4fa,null))[_0x40ca('0x21')](saveUpdates(_0x218675['body'],null))[_0x40ca('0x21')](respondWithResult(_0x28c4fa,null))[_0x40ca('0x56')](handleError(_0x28c4fa,null));};exports['addCustomerAvatar']=function(_0xb9fe90,_0x68dae0,_0x3cf8c5){_0xb9fe90[_0x40ca('0x5c')][_0x40ca('0x75')]=_0xb9fe90[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')]['find']({'where':{'id':_0xb9fe90['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x68dae0,null))[_0x40ca('0x21')](saveUpdates(_0xb9fe90[_0x40ca('0x5c')],null))[_0x40ca('0x21')](respondWithResult(_0x68dae0,null))[_0x40ca('0x56')](handleError(_0x68dae0,null));};exports['addSystemAvatar']=function(_0x24671e,_0x46afe3,_0x1b80c7){_0x24671e['body'][_0x40ca('0x76')]=_0x24671e[_0x40ca('0x72')][_0x40ca('0x73')];return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x24671e['params']['id']}})['then'](handleEntityNotFound(_0x46afe3,null))[_0x40ca('0x21')](saveUpdates(_0x24671e['body'],null))[_0x40ca('0x21')](respondWithResult(_0x46afe3,null))['catch'](handleError(_0x46afe3,null));};exports['getLogo']=function(_0x52cb30,_0x297904,_0x4345e6){var _0x1edf95=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x79'));var _0x1e4233={'where':{'id':_0x52cb30[_0x40ca('0x58')]['id']},'attributes':['id',_0x40ca('0x71')],'raw':!![]};var _0x16be03=![];return require(_0x40ca('0x7a'))[_0x40ca('0x7b')]()[_0x40ca('0x21')](function(_0x40a072){if(_0x40a072){_0x16be03=_0x40a072[_0x40ca('0x7c')];}})['then'](function(){return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x1e4233);})[_0x40ca('0x21')](handleEntityNotFound(_0x297904,null))['then'](function(_0x405aaf){if(_0x405aaf){if(!_[_0x40ca('0x7d')](_0x405aaf[_0x40ca('0x71')])){if(fs['existsSync'](path[_0x40ca('0x77')](config['root'],'server/files/images/logos/',_0x405aaf[_0x40ca('0x71')]))&&_0x16be03){_0x1edf95=path[_0x40ca('0x77')](config['root'],_0x40ca('0x7e'),_0x405aaf[_0x40ca('0x71')]);}}return _0x297904[_0x40ca('0x7f')](_0x1edf95);}})[_0x40ca('0x56')](handleError(_0x297904,null));};exports[_0x40ca('0x80')]=function(_0x234a2a,_0x413af7,_0x1941d6){var _0x3b5b8a=path[_0x40ca('0x77')](config[_0x40ca('0x78')],'server/files/images/avatars/default_avatar.png');var _0x2afb84={'where':{'id':_0x234a2a[_0x40ca('0x58')]['id']},'attributes':['id',_0x40ca('0x74')],'raw':!![]};return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x2afb84)['then'](handleEntityNotFound(_0x413af7,null))[_0x40ca('0x21')](function(_0x2c957f){if(_0x2c957f){if(!_['isNil'](_0x2c957f['agentAvatar'])){if(fs['existsSync'](path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x2c957f[_0x40ca('0x74')]))){_0x3b5b8a=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x2c957f['agentAvatar']);}}return _0x413af7['download'](_0x3b5b8a);}})[_0x40ca('0x56')](handleError(_0x413af7,null));};exports[_0x40ca('0x82')]=function(_0x26ee96,_0x12e4ba,_0x59b0e6){var _0x1a4a94=path['join'](config['root'],_0x40ca('0x83'));var _0x4be97c={'where':{'id':_0x26ee96['params']['id']},'attributes':['id',_0x40ca('0x75'),_0x40ca('0x84')],'raw':!![]};return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0x4be97c)[_0x40ca('0x21')](handleEntityNotFound(_0x12e4ba,null))[_0x40ca('0x21')](function(_0x3e6e16){if(_0x3e6e16){if(!_[_0x40ca('0x7d')](_0x3e6e16[_0x40ca('0x75')])){if(fs[_0x40ca('0x85')](path[_0x40ca('0x77')](config[_0x40ca('0x78')],'server/files/images/avatars/',_0x3e6e16[_0x40ca('0x75')]))&&_0x3e6e16[_0x40ca('0x84')]){_0x1a4a94=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x3e6e16[_0x40ca('0x75')]);}}return _0x12e4ba[_0x40ca('0x7f')](_0x1a4a94);}})[_0x40ca('0x56')](handleError(_0x12e4ba,null));};exports['getSystemAvatar']=function(_0x53a653,_0x26fb16,_0x8f43d4){var _0x27a30c=path['join'](config[_0x40ca('0x78')],'server/files/images/avatars/system_avatar.png');var _0xb5a8a9={'where':{'id':_0x53a653[_0x40ca('0x58')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x40ca('0x40')][_0x40ca('0x5b')](_0xb5a8a9)['then'](handleEntityNotFound(_0x26fb16,null))[_0x40ca('0x21')](function(_0x5b7434){if(_0x5b7434){if(!_['isNil'](_0x5b7434[_0x40ca('0x76')])){if(fs['existsSync'](path[_0x40ca('0x77')](config['root'],_0x40ca('0x81'),_0x5b7434[_0x40ca('0x76')]))){_0x27a30c=path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0x81'),_0x5b7434[_0x40ca('0x76')]);}}return _0x26fb16['download'](_0x27a30c);}})['catch'](handleError(_0x26fb16,null));};exports[_0x40ca('0x86')]=function(_0x2f199d,_0x2c09e2,_0x4842a6){var _0xc0e400=require(_0x40ca('0x87'));var _0xd8f752=new _0xc0e400();var _0x568577=_0xd8f752[_0x40ca('0x88')](_0x2f199d['headers']['user-agent'])['getResult']();var _0x2b3289={'body':_0x2f199d['body'],'channel':_0x40ca('0x89')};var _0x23db5e=[];var _0x380943=[];var _0x146bad={};var _0x52482e=![];return db[_0x40ca('0x8a')]['describe']()[_0x40ca('0x21')](function(_0x17b5bd){if(!_0x17b5bd){throw new db['Sequelize'][(_0x40ca('0x1f'))](_0x40ca('0x8b'));}_0x23db5e=_[_0x40ca('0x8c')](_['keys'](_0x17b5bd),[_0x40ca('0x8d'),_0x40ca('0x8e')]);_0x380943=_['difference'](_[_0x40ca('0x44')](_0x17b5bd),['createdAt',_0x40ca('0x8e'),'CompanyId','ListId']);if(_0x2f199d['body']['id']){delete _0x2f199d['body']['id'];}if(_[_0x40ca('0x7d')](_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')])){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x90'));}if(_[_0x40ca('0x7d')](_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x5c')])||_0x2f199d['body'][_0x40ca('0x5c')]===''){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x91'));}if(_[_0x40ca('0x7d')](_0x2f199d['body'][_0x40ca('0x92')])){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x93')+_0x380943);}if(!_[_0x40ca('0x94')](_0x380943,_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x92')])){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x380943);}_0x146bad[_0x2f199d['body'][_0x40ca('0x92')]]=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')];})[_0x40ca('0x21')](function(){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x2f199d[_0x40ca('0x58')]['id']},'include':[{'model':db[_0x40ca('0x95')],'as':_0x40ca('0x96'),'include':[{'model':db[_0x40ca('0x8a')],'as':_0x40ca('0x97'),'where':_0x146bad,'limit':0x1,'order':[[_0x40ca('0x8e'),'DESC']]}]},{'model':db[_0x40ca('0x98')],'as':_0x40ca('0x99')}]});})[_0x40ca('0x21')](handleEntityNotFound(_0x2c09e2,null))[_0x40ca('0x21')](function(_0x5400b4){if(_0x5400b4&&_0x5400b4[_0x40ca('0x96')]){_0x2b3289['account']=_0x5400b4;_0x2b3289[_0x40ca('0x9a')]=_0x5400b4[_0x40ca('0x99')];_0x2b3289[_0x40ca('0x9b')]=_0x5400b4[_0x40ca('0x96')];_0x2b3289[_0x40ca('0x9a')]=_[_0x40ca('0x9c')](_0x2b3289[_0x40ca('0x9a')],[_0x40ca('0x9d')],[_0x40ca('0x9e')]);if(_0x2b3289[_0x40ca('0x9f')]['Applications']){delete _0x2b3289[_0x40ca('0x9f')][_0x40ca('0x99')];}if(_0x2b3289[_0x40ca('0x9f')]['List']&&_0x2b3289[_0x40ca('0x9f')][_0x40ca('0x96')][_0x40ca('0x97')]['length']){return _0x2b3289['account'][_0x40ca('0x96')][_0x40ca('0x97')][0x0];}var _0x5e29b3=_[_0x40ca('0x16')](_0x2f199d[_0x40ca('0x5c')],{'firstName':_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')],'ListId':_0x5400b4[_0x40ca('0xa0')]});_0x5e29b3[_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x92')]]=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x8f')];return db[_0x40ca('0x8a')][_0x40ca('0x63')](_0x5e29b3,{'fields':_0x23db5e,'raw':!![]});}})[_0x40ca('0x21')](handleEntityNotFound(_0x2c09e2,null))[_0x40ca('0x21')](function(_0x6ac821){_0x2b3289[_0x40ca('0xa1')]=_0x6ac821;var _0x12242c=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xa2')];if(_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa4')]){_0x12242c=_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa4')];}else if(_0x2f199d[_0x40ca('0xa3')]['x-forwarded-for']){_0x12242c=_[_0x40ca('0xa5')](_0x2f199d['headers'][_0x40ca('0xa6')]['split'](','));}if(_0x6ac821){var _0x2b9c9c={'ContactId':_0x6ac821['id'],'ChatWebsiteId':_0x2f199d['params']['id'],'from':(_0x6ac821['firstName']||'')+'\x20'+(_0x6ac821[_0x40ca('0xa7')]||''),'customerIp':_0x12242c,'customerPort':_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa8')]?_0x2f199d[_0x40ca('0xa3')][_0x40ca('0xa8')]:null,'referer':_0x2f199d['body'][_0x40ca('0xa9')],'browserName':_0x568577[_0x40ca('0xaa')][_0x40ca('0x3b')]&&_0x568577['browser']['version']?util[_0x40ca('0xab')](_0x40ca('0xac'),_0x568577['browser'][_0x40ca('0x3b')],_0x568577[_0x40ca('0xaa')][_0x40ca('0xad')]):_0x40ca('0xae'),'browserVersion':_0x568577['browser'][_0x40ca('0xad')]||_0x40ca('0xae'),'osName':util[_0x40ca('0xab')](_0x40ca('0xac'),_0x568577['os'][_0x40ca('0x3b')],_0x568577['os'][_0x40ca('0xad')]),'osVersion':_0x568577['os']['version'],'deviceModel':_0x568577['device'][_0x40ca('0x49')]&&_0x568577[_0x40ca('0xaf')]['vendor']?util[_0x40ca('0xab')]('%s\x20%s\x20%s',_0x568577['device'][_0x40ca('0x49')],_0x568577[_0x40ca('0xaf')]['vendor'],_0x568577['device'][_0x40ca('0x43')]):null,'deviceVendor':_0x568577['device'][_0x40ca('0xb0')],'deviceType':_0x568577['device'][_0x40ca('0x43')],'formData':JSON[_0x40ca('0x27')](_0x2f199d[_0x40ca('0x5c')])};var _0x2271de={'ChatWebsiteId':_0x2f199d['params']['id'],'closed':![]};if(_0x2f199d['body']['threadId']){_0x2271de['threadId']=_0x2f199d[_0x40ca('0x5c')]['threadId'];return db[_0x40ca('0xb1')][_0x40ca('0x5b')]({'where':_0x2271de})[_0x40ca('0x21')](function(_0x19e8e7){if(_0x19e8e7){return[_0x19e8e7,![]];}_0x2b9c9c[_0x40ca('0xb2')]=_0x2f199d[_0x40ca('0x5c')]['threadId'];_0x2b9c9c[_0x40ca('0xb3')]=_0x2f199d['body']['externalUrl'];return db[_0x40ca('0xb1')][_0x40ca('0x63')](_0x2b9c9c)[_0x40ca('0x21')](function(_0x5193b7){return[_0x5193b7,!![]];});});}_0x2271de[_0x40ca('0xb4')]=_0x6ac821['id'];if(_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb5')]&&_0x2f199d[_0x40ca('0x5c')]['interaction']['id']){_0x2271de['id']=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb5')]['id'];return db[_0x40ca('0xb1')]['find']({'where':_0x2271de})[_0x40ca('0x21')](function(_0x4ff042){if(_0x4ff042){return[_0x4ff042,![]];}return db[_0x40ca('0xb1')][_0x40ca('0x63')](_0x2b9c9c)[_0x40ca('0x21')](function(_0x1a526d){return[_0x1a526d,!![]];});});}return db[_0x40ca('0xb1')][_0x40ca('0x63')](_0x2b9c9c)[_0x40ca('0x21')](function(_0x3911e0){return[_0x3911e0,!![]];});}})['spread'](function(_0x4405c5,_0x5181ce){if(_0x4405c5){_0x52482e=_0x5181ce;if(!_0x5181ce){var _0x1f8a08={'from':(_0x2b3289[_0x40ca('0xa1')]['firstName']||'')+'\x20'+(_0x2b3289[_0x40ca('0xa1')][_0x40ca('0xa7')]||'')};if(_0x2f199d['body'][_0x40ca('0xb2')]&&_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb6')]&&_0x2f199d['body'][_0x40ca('0xb2')]!=_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xb6')]){_0x1f8a08[_0x40ca('0xb2')]=_0x2f199d['body']['messageId'];}return _0x4405c5[_0x40ca('0x36')](_0x1f8a08);}else{return _0x4405c5;}}})[_0x40ca('0x21')](function(_0x5072d0){_0x2b3289['interaction']=_0x5072d0['get']({'plain':!![]});_0x2b3289['interaction'][_0x40ca('0xb7')]=_0x52482e;if(_0x2b3289[_0x40ca('0xb5')][_0x40ca('0xb7')]){if(_0x2b3289['account'][_0x40ca('0xb8')]){_0x2b3289[_0x40ca('0x9a')][_0x40ca('0xb9')]({'id':0x0,'priority':_0x2b3289[_0x40ca('0x9a')]['length']+0x1,'app':_0x40ca('0xba'),'appdata':_0x40ca('0xbb'),'interval':_0x40ca('0xbc')});}}return db[_0x40ca('0xbd')][_0x40ca('0x63')]({'body':_0x2f199d[_0x40ca('0x5c')][_0x40ca('0x5c')],'ChatWebsiteId':_0x2f199d[_0x40ca('0x58')]['id'],'ChatInteractionId':_0x5072d0['id'],'direction':'in','ContactId':_0x2b3289['contact']['id'],'AttachmentId':_0x2f199d[_0x40ca('0x5c')][_0x40ca('0xbe')]});})['then'](function(_0x33b6bd){_0x2b3289[_0x40ca('0x29')]=_0x33b6bd;if(_0x2b3289['interaction'][_0x40ca('0xbf')]){return db['User'][_0x40ca('0x5b')]({'attributes':['id',_0x40ca('0x3b')],'where':{'id':_0x2b3289[_0x40ca('0xb5')][_0x40ca('0xbf')]}})['then'](function(_0x1de895){if(_0x1de895){_0x2b3289['applications'][_0x40ca('0xc0')]({'id':0x0,'priority':0x0,'app':_0x40ca('0xc1'),'appdata':_0x1de895[_0x40ca('0x3b')]+','+(_0x2b3289['account'][_0x40ca('0xc2')]||0xa),'interval':_0x40ca('0xbc')});_0x2b3289['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x40ca('0xc3'),_0x2b3289);});}return respondWithRpcPromise(_0x40ca('0xc4'),_0x40ca('0xc3'),_0x2b3289);})[_0x40ca('0x21')](function(_0x40942e){respondWithRpcPromise(_0x40ca('0xc5'),_0x40ca('0xc5'),{'event':_0x40ca('0x86'),'message':_0x40942e},client9002);return _0x40942e;})[_0x40ca('0x21')](respondWithResult(_0x2c09e2,null))[_0x40ca('0x56')](handleError(_0x2c09e2,null));};exports[_0x40ca('0xc6')]=function(_0x151e01,_0x142fb9,_0x584eb7){var _0x56f3e6,_0x440e8f,_0xd16b;var _0x34653c=[];var _0x402f11=[];var _0xf0c0ba={};return db['CmContact'][_0x40ca('0x64')]()['then'](function(_0x5e9517){if(!_0x5e9517){throw new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x8b'));}_0x402f11=_['difference'](_[_0x40ca('0x44')](_0x5e9517),[_0x40ca('0x8d'),_0x40ca('0x8e')]);_0x34653c=_['difference'](_['keys'](_0x5e9517),[_0x40ca('0x8d'),_0x40ca('0x8e'),_0x40ca('0xc7'),_0x40ca('0xa0')]);if(_0x151e01[_0x40ca('0x5c')]['id']){delete _0x151e01['body']['id'];}if(_[_0x40ca('0x7d')](_0x151e01[_0x40ca('0x5c')]['from'])){throw _0x142fb9[_0x40ca('0x2b')](0x1f4)[_0x40ca('0x3c')](new db[(_0x40ca('0x1e'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x40ca('0x7d')](_0x151e01['body'][_0x40ca('0x5c')])||_0x151e01[_0x40ca('0x5c')][_0x40ca('0x5c')]===''){throw _0x142fb9['status'](0x1f4)[_0x40ca('0x3c')](new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0x91')));}if(_['isNil'](_0x151e01[_0x40ca('0x5c')][_0x40ca('0xc8')])){throw _0x142fb9['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x40ca('0xc9')+_0x34653c));}if(!_[_0x40ca('0x94')](_0x34653c,_0x151e01[_0x40ca('0x5c')]['mapKeyOffline'])){throw _0x142fb9[_0x40ca('0x2b')](0x1f4)[_0x40ca('0x3c')](new db[(_0x40ca('0x1e'))][(_0x40ca('0x1f'))](_0x40ca('0xca')+_0x34653c));}_0xf0c0ba[_0x151e01[_0x40ca('0x5c')]['mapKeyOffline']]=_0x151e01[_0x40ca('0x5c')][_0x40ca('0x8f')];})[_0x40ca('0x21')](function(){return db[_0x40ca('0x40')]['find']({'where':{'id':_0x151e01['params']['id']},'include':[{'model':db['CmList'],'as':_0x40ca('0x96')}]});})['then'](handleEntityNotFound(_0x142fb9,null))['then'](function(_0x590832){if(_0x590832&&_0x590832['List']){_0x440e8f=_0x590832;var _0x1cce75=_[_0x40ca('0x16')](_0x151e01[_0x40ca('0x5c')],{'firstName':_0x151e01[_0x40ca('0x5c')][_0x40ca('0x8f')],'phone':_0x151e01['body'][_0x40ca('0x8f')],'ListId':_0x590832['ListId']});_0x1cce75[_0x151e01['body'][_0x40ca('0xc8')]]=_0x151e01[_0x40ca('0x5c')]['from'];return db[_0x40ca('0x8a')][_0x40ca('0xcb')]({'where':_0xf0c0ba,'defaults':_0x1cce75});}})[_0x40ca('0xcc')](function(_0x1239af){if(_0x1239af){_0xd16b=_0x1239af;var _0x3698b5=fs[_0x40ca('0xcd')](path[_0x40ca('0x77')](config[_0x40ca('0x78')],_0x40ca('0xce')),'utf8');var _0x308d91=ejs[_0x40ca('0xcf')](_0x3698b5,{'body':_[_0x40ca('0xd0')](_0x151e01['body']['body']),'bodyTitle':_0x440e8f[_0x40ca('0xd1')]});return db['ChatOfflineMessage'][_0x40ca('0x63')]({'body':_0x308d91,'ContactId':_0x1239af['id'],'ChatWebsiteId':_0x440e8f['id']});}})['then'](function(_0x13875e){if(_0x13875e){_0x56f3e6=_0x13875e;return db[_0x40ca('0xd2')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x40ca('0xd3')],'as':_0x40ca('0xd4'),'raw':!![]}]});}})[_0x40ca('0x21')](function(_0x573c58){if(_0x573c58&&_0x573c58[_0x40ca('0xd4')]&&_0x440e8f[_0x40ca('0xd5')]){var _0xfa47e6={'tls':{'rejectUnauthorized':![]}};if(_0x573c58['Smtp'][_0x40ca('0xd6')]){_0xfa47e6[_0x40ca('0xd6')]=_0x573c58[_0x40ca('0xd4')][_0x40ca('0xd6')];}else{_0xfa47e6[_0x40ca('0xd7')]=_0x573c58[_0x40ca('0xd4')][_0x40ca('0xd7')];_0xfa47e6[_0x40ca('0xd8')]=_0x573c58['Smtp'][_0x40ca('0xd8')];_0xfa47e6['secure']=_0x573c58['Smtp'][_0x40ca('0xd9')];}if(_0x573c58[_0x40ca('0xd4')][_0x40ca('0xda')]){_0xfa47e6[_0x40ca('0xdb')]={'user':_0x573c58[_0x40ca('0xd4')][_0x40ca('0x5d')],'pass':_0x573c58[_0x40ca('0xd4')][_0x40ca('0xdc')]};}return respondWithRpcPromise(_0x40ca('0xdd'),_0x40ca('0xde'),{'account':_0xfa47e6,'message':{'from':util['format'](_0x40ca('0xdf'),_0x573c58['name'],_0x573c58[_0x40ca('0xe0')]||_0x573c58[_0x40ca('0xd4')][_0x40ca('0x5d')]),'to':_0x440e8f[_0x40ca('0xd5')],'subject':_0x440e8f[_0x40ca('0xe1')],'text':_0x56f3e6['body']}},client9003)[_0x40ca('0x21')](function(){return _0x56f3e6;})[_0x40ca('0x56')](function(_0x2eba0d){console['error'](_0x2eba0d);});}})[_0x40ca('0x21')](function(){if(_0x56f3e6){return _0x56f3e6;}})['then'](respondWithResult(_0x142fb9,null))['catch'](handleError(_0x142fb9,null));};exports[_0x40ca('0xe2')]=function(_0x4b62c1,_0x54483c,_0x457a35){return db[_0x40ca('0xb1')]['find']({'where':{'id':_0x4b62c1['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x54483c,null))['then'](function(_0x4ba8db){if(_0x4ba8db){return _0x4ba8db[_0x40ca('0xe2')](_0x4b62c1[_0x40ca('0x5c')][_0x40ca('0x6a')],_[_0x40ca('0xe3')](_0x4b62c1[_0x40ca('0x5c')],['ids','id'])||{});}})[_0x40ca('0x21')](respondWithResult(_0x54483c,null))[_0x40ca('0x56')](handleError(_0x54483c,null));};exports['getInteractions']=function(_0x834b5,_0x34f075,_0x123a24){var _0x2a8b97={'raw':![],'where':{}};var _0x39ad98={};var _0x355818={'count':0x0,'rows':[]};return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x834b5[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x34f075,null))[_0x40ca('0x21')](function(_0x41ad52){if(_0x41ad52){_0x39ad98['model']=_[_0x40ca('0x44')](db[_0x40ca('0xb1')][_0x40ca('0x41')]);_0x39ad98[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x834b5['query']);_0x39ad98['filters']=_[_0x40ca('0x47')](_0x39ad98[_0x40ca('0x49')],_0x39ad98[_0x40ca('0x45')]);_0x2a8b97[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x39ad98[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x834b5[_0x40ca('0x45')][_0x40ca('0x4a')]));_0x2a8b97[_0x40ca('0x48')]=_0x2a8b97[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x2a8b97[_0x40ca('0x48')]:_0x39ad98[_0x40ca('0x49')];if(!_0x834b5[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x2a8b97[_0x40ca('0x30')]=qs[_0x40ca('0x30')](_0x834b5[_0x40ca('0x45')][_0x40ca('0x30')]);_0x2a8b97[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x834b5[_0x40ca('0x45')]['offset']);}_0x2a8b97['order']=qs[_0x40ca('0x4e')](_0x834b5[_0x40ca('0x45')][_0x40ca('0x4e')]);_0x2a8b97[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x834b5[_0x40ca('0x45')],_0x39ad98[_0x40ca('0x46')]));_0x2a8b97[_0x40ca('0x4f')][_0x40ca('0x69')]=_0x41ad52['id'];if(_0x834b5['query'][_0x40ca('0x52')]){_0x2a8b97['where']=_[_0x40ca('0x51')](_0x2a8b97[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x2a8b97[_0x40ca('0x48')],function(_0x10437d){var _0x380013={};_0x380013[_0x10437d]={'$like':'%'+_0x834b5[_0x40ca('0x45')]['filter']+'%'};return _0x380013;})});}_0x2a8b97=_['merge']({},_0x2a8b97,_0x834b5['options']);return db['ChatInteraction']['count']({'where':_0x2a8b97[_0x40ca('0x4f')]})['then'](function(_0x1e4c6b){_0x355818[_0x40ca('0x2e')]=_0x1e4c6b;if(_0x834b5[_0x40ca('0x45')][_0x40ca('0x5a')]){_0x2a8b97[_0x40ca('0xe4')]=[{'model':db[_0x40ca('0x8a')],'as':_0x40ca('0xe5'),'required':![]},{'model':db[_0x40ca('0xe6')],'as':'Owner','attributes':[_0x40ca('0x3b'),_0x40ca('0xe7'),_0x40ca('0xe8')],'required':![]},{'model':db[_0x40ca('0xe9')],'as':_0x40ca('0xea'),'attributes':['id',_0x40ca('0x3b'),_0x40ca('0xeb')],'where':_0x834b5[_0x40ca('0x45')][_0x40ca('0xec')]?{'id':_0x834b5[_0x40ca('0x45')][_0x40ca('0xec')]}:undefined,'required':_0x834b5[_0x40ca('0x45')][_0x40ca('0xec')]?!![]:![]}];}return db['ChatInteraction'][_0x40ca('0x54')](_0x2a8b97);})[_0x40ca('0x21')](function(_0x19409d){_0x355818[_0x40ca('0x55')]=_0x19409d;return _0x355818;});}})[_0x40ca('0x21')](respondWithFilteredResult(_0x34f075,_0x2a8b97))[_0x40ca('0x56')](handleError(_0x34f075,null));};function iftimePromise(_0x91b92b,_0x129afa){return respondWithRpcPromise(_0x40ca('0xed'),'getSnippet',{'command':_0x129afa[_0x40ca('0xee')]?util['format'](_0x40ca('0xef'),_0x91b92b[_0x40ca('0xf0')],_0x129afa['timezone']):util[_0x40ca('0xab')](_0x40ca('0xf1'),_0x91b92b[_0x40ca('0xf0')])},client9002)[_0x40ca('0x21')](function(_0x3e1ac1){var _0x1e7e2c=_0x3e1ac1&&_0x3e1ac1[_0x40ca('0xf2')](_0x40ca('0xf3'))>=0x0?!![]:![];logger[_0x40ca('0x22')](_0x40ca('0xf4'),_0x129afa['id'],_0x91b92b['id'],_0x91b92b[_0x40ca('0xf0')],_0x1e7e2c?_0x40ca('0xf5'):_0x40ca('0xf6'),_0x129afa[_0x40ca('0xee')]?_0x129afa[_0x40ca('0xee')]:_0x40ca('0xf7'));return _0x1e7e2c;})[_0x40ca('0x56')](function(_0x1feb86){logger['error'](_0x40ca('0xf4'),_0x129afa['id'],_0x91b92b['id'],_0x91b92b['interval'],util[_0x40ca('0xf8')](_0x1feb86,{'showHidden':![],'depth':null}),_0x129afa[_0x40ca('0xee')]?_0x129afa[_0x40ca('0xee')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x3aba72,_0x16d783,_0x150655){var _0x3e169d=0x0;var _0x37bf0f=0x0;var _0x53f867=![];var _0x13502b;var _0x397c3d;return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x3aba72['params']['id']},'include':[{'model':db['Interval'],'as':_0x40ca('0xf9'),'include':[{'model':db[_0x40ca('0xf9')],'as':_0x40ca('0xfa'),'attributes':['id',_0x40ca('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x16d783,null))['then'](function(_0xba2c69){if(_0xba2c69){_0x13502b=_0xba2c69;return _0xba2c69['getProactiveActions']({'raw':!![]});}})[_0x40ca('0x21')](function(_0x49de3d){if(_0x13502b){if(_0x49de3d){_0x397c3d=_0x49de3d;}}return require(_0x40ca('0x7a'))[_0x40ca('0x7b')]();})[_0x40ca('0x21')](function(_0x124723){if(_0x124723){_0x37bf0f=_0x124723[_0x40ca('0xfb')];_0x53f867=_0x124723['custom'];}})[_0x40ca('0x21')](function(){return db[_0x40ca('0xb1')][_0x40ca('0x2e')]({'where':{'closed':![]}});})[_0x40ca('0x21')](function(_0x42536e){_0x3e169d=_0x42536e;if(_0x37bf0f&&_0x42536e>_0x37bf0f){return db[_0x40ca('0xfc')][_0x40ca('0x6e')]({'where':{'id':0x1}})[_0x40ca('0x21')](function(_0x4ca099){if(_0x4ca099){_0x4ca099['increment'](_0x40ca('0xfd'));}});}})['then'](function(){if(_0x13502b[_0x40ca('0xf9')]&&_0x13502b[_0x40ca('0xf9')][_0x40ca('0xfa')]){var _0x2a5efb=[];for(var _0x4d2bb3=0x0;_0x4d2bb3<_0x13502b['Interval'][_0x40ca('0xfa')][_0x40ca('0x4b')];_0x4d2bb3++){var _0x418a04=_0x13502b[_0x40ca('0xf9')][_0x40ca('0xfa')][_0x4d2bb3][_0x40ca('0x5e')]({'plain':!![]});_0x2a5efb[_0x40ca('0xb9')](iftimePromise(_0x418a04,_0x13502b));}return BPromise[_0x40ca('0xfe')](_0x2a5efb)['then'](function(_0x54f1fa){return _['some'](_0x54f1fa);});}else{return!![];}})['then'](function(_0x5eebaf){var _0x53ab21=fs[_0x40ca('0xcd')](path[_0x40ca('0x77')](config[_0x40ca('0x78')],'server/files/chat/iframe.js'),_0x40ca('0xff'));var _0x332607={'remote':_0x13502b['remote'],'query':querystring['stringify'](_[_0x40ca('0x51')](_0x13502b[_0x40ca('0x5e')]({'plain':!![]}),{'customerIp':_0x3aba72[_0x40ca('0xa3')]['x-forwarded-for']||_0x3aba72[_0x40ca('0xa3')]['x-real-ip']||_0x3aba72[_0x40ca('0x100')][_0x40ca('0x101')]||_0x3aba72['ip'],'referer':_0x3aba72[_0x40ca('0xa3')]['referer'],'openedInteractions':_0x3e169d,'maxInteractions':_0x37bf0f,'virtual':_0x53f867['virtual'],'online':_0x5eebaf,'custom':_0x53f867}))['replace'](/'/g,'\x5c\x27')};_0x16d783[_0x40ca('0x3c')](ejs[_0x40ca('0xcf')](Mustache[_0x40ca('0xcf')](_0x53ab21,_0x332607),{'proactiveActions':_0x397c3d,'alignment':_0x13502b[_0x40ca('0x102')],'verticalAlignment':_0x13502b[_0x40ca('0x103')],'div_color':_0x13502b[_0x40ca('0xeb')],'text_color':_0x13502b[_0x40ca('0x104')]}));})[_0x40ca('0x56')](handleError(_0x16d783,null));};exports[_0x40ca('0x105')]=function(_0x25a93f,_0x4a76c1,_0xdfc4a){return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x25a93f[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x4a76c1,null))[_0x40ca('0x21')](function(_0x4b946f){if(_0x4b946f){return db[_0x40ca('0x106')]['transaction'](function(_0x108a7e){return db[_0x40ca('0x98')][_0x40ca('0x39')]({'where':{'ChatWebsiteId':_0x25a93f[_0x40ca('0x58')]['id']},'transaction':_0x108a7e})[_0x40ca('0x21')](function(_0x116d59){var _0x5f24d1=_[_0x40ca('0x3f')](_0x25a93f[_0x40ca('0x5c')],function(_0x4e5d22){_0x4e5d22['ChatWebsiteId']=_0x25a93f[_0x40ca('0x58')]['id'];return _0x4e5d22;});return db[_0x40ca('0x98')][_0x40ca('0x107')](_0x5f24d1,{'transaction':_0x108a7e});});})[_0x40ca('0x21')](function(){return db[_0x40ca('0x98')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x25a93f[_0x40ca('0x58')]['id']},'order':_0x40ca('0x9d')});});}})[_0x40ca('0x21')](respondWithResult(_0x4a76c1,null))[_0x40ca('0x56')](handleError(_0x4a76c1,null));};exports[_0x40ca('0x108')]=function(_0x39066e,_0x1439cc,_0x21694f){var _0x5b2423={};var _0x586ee2={};var _0x40d135;var _0x36eb13;return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x39066e[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x1439cc,null))[_0x40ca('0x21')](function(_0x1e0eac){if(_0x1e0eac){_0x40d135=_0x1e0eac;_0x586ee2[_0x40ca('0x49')]=_[_0x40ca('0x44')](db[_0x40ca('0x98')][_0x40ca('0x41')]);_0x586ee2[_0x40ca('0x45')]=_[_0x40ca('0x44')](_0x39066e[_0x40ca('0x45')]);_0x586ee2[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x586ee2[_0x40ca('0x49')],_0x586ee2[_0x40ca('0x45')]);_0x5b2423[_0x40ca('0x48')]=_['intersection'](_0x586ee2[_0x40ca('0x49')],qs['fields'](_0x39066e[_0x40ca('0x45')]['fields']));_0x5b2423[_0x40ca('0x48')]=_0x5b2423[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x5b2423[_0x40ca('0x48')]:_0x586ee2[_0x40ca('0x49')];_0x5b2423['order']=qs[_0x40ca('0x4e')](_0x39066e[_0x40ca('0x45')][_0x40ca('0x4e')]);_0x5b2423[_0x40ca('0x4f')]=qs['filters'](_[_0x40ca('0x50')](_0x39066e[_0x40ca('0x45')],_0x586ee2[_0x40ca('0x46')]));if(_0x39066e['query'][_0x40ca('0x52')]){_0x5b2423[_0x40ca('0x4f')]=_['merge'](_0x5b2423[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x5b2423[_0x40ca('0x48')],function(_0x5ef614){var _0x29b5aa={};_0x29b5aa[_0x5ef614]={'$like':'%'+_0x39066e[_0x40ca('0x45')][_0x40ca('0x52')]+'%'};return _0x29b5aa;})});}_0x5b2423=_[_0x40ca('0x51')]({},_0x5b2423,_0x39066e[_0x40ca('0x53')]);return _0x40d135[_0x40ca('0x108')](_0x5b2423);}})['then'](function(_0x5154d9){if(_0x5154d9){_0x36eb13=_0x5154d9[_0x40ca('0x4b')];if(!_0x39066e[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x5b2423[_0x40ca('0x30')]=qs[_0x40ca('0x30')](_0x39066e[_0x40ca('0x45')][_0x40ca('0x30')]);_0x5b2423['offset']=qs[_0x40ca('0x2f')](_0x39066e[_0x40ca('0x45')][_0x40ca('0x2f')]);}return _0x40d135[_0x40ca('0x108')](_0x5b2423);}})[_0x40ca('0x21')](function(_0x3e1943){if(_0x3e1943){return _0x3e1943?{'count':_0x36eb13,'rows':_0x3e1943}:null;}})[_0x40ca('0x21')](respondWithResult(_0x1439cc,null))[_0x40ca('0x56')](handleError(_0x1439cc,null));};exports[_0x40ca('0x109')]=function(_0x1d26fd,_0x4858f0,_0x28b709){return db[_0x40ca('0x10a')][_0x40ca('0x5b')]({'where':{'id':_0x1d26fd['params']['id']}})['then'](handleEntityNotFound(_0x4858f0,null))[_0x40ca('0x21')](function(_0x14a21e){if(_0x14a21e){return _0x14a21e[_0x40ca('0x109')](_0x1d26fd['body'][_0x40ca('0x6a')],_[_0x40ca('0xe3')](_0x1d26fd[_0x40ca('0x5c')],[_0x40ca('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x4858f0,null))[_0x40ca('0x56')](handleError(_0x4858f0,null));};exports[_0x40ca('0x10b')]=function(_0x1984cc,_0xed4183,_0x2c3e9e){var _0x25e0b3={};var _0x46d66e={};var _0x5f196f;var _0x395329;return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x1984cc[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0xed4183,null))[_0x40ca('0x21')](function(_0x7cbbeb){if(_0x7cbbeb){_0x5f196f=_0x7cbbeb;_0x46d66e[_0x40ca('0x49')]=_[_0x40ca('0x44')](db['ChatProactiveAction'][_0x40ca('0x41')]);_0x46d66e[_0x40ca('0x45')]=_['keys'](_0x1984cc[_0x40ca('0x45')]);_0x46d66e[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x46d66e[_0x40ca('0x49')],_0x46d66e['query']);_0x25e0b3['attributes']=_['intersection'](_0x46d66e[_0x40ca('0x49')],qs[_0x40ca('0x4a')](_0x1984cc[_0x40ca('0x45')]['fields']));_0x25e0b3[_0x40ca('0x48')]=_0x25e0b3[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x25e0b3[_0x40ca('0x48')]:_0x46d66e[_0x40ca('0x49')];_0x25e0b3['order']=qs['sort'](_0x1984cc[_0x40ca('0x45')]['sort']);_0x25e0b3['where']=qs[_0x40ca('0x46')](_[_0x40ca('0x50')](_0x1984cc[_0x40ca('0x45')],_0x46d66e[_0x40ca('0x46')]));if(_0x1984cc[_0x40ca('0x45')][_0x40ca('0x52')]){_0x25e0b3['where']=_[_0x40ca('0x51')](_0x25e0b3[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x25e0b3['attributes'],function(_0x423256){var _0x4bd655={};_0x4bd655[_0x423256]={'$like':'%'+_0x1984cc['query'][_0x40ca('0x52')]+'%'};return _0x4bd655;})});}_0x25e0b3=_[_0x40ca('0x51')]({},_0x25e0b3,_0x1984cc[_0x40ca('0x53')]);return _0x5f196f[_0x40ca('0x10b')](_0x25e0b3);}})[_0x40ca('0x21')](function(_0x2d445f){if(_0x2d445f){_0x395329=_0x2d445f['length'];if(!_0x1984cc[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x25e0b3['limit']=qs[_0x40ca('0x30')](_0x1984cc['query'][_0x40ca('0x30')]);_0x25e0b3[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x1984cc[_0x40ca('0x45')][_0x40ca('0x2f')]);}return _0x5f196f[_0x40ca('0x10b')](_0x25e0b3);}})[_0x40ca('0x21')](function(_0x14dd1f){if(_0x14dd1f){return _0x14dd1f?{'count':_0x395329,'rows':_0x14dd1f}:null;}})[_0x40ca('0x21')](respondWithResult(_0xed4183,null))[_0x40ca('0x56')](handleError(_0xed4183,null));};exports[_0x40ca('0x10c')]=function(_0x25d191,_0x47d71a,_0xdfff8f){var _0x5e5cd8=_0x25d191['query']['online']==='false'?_0x40ca('0x10d'):_0x40ca('0x10e');return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'attributes':['id',_0x5e5cd8],'where':{'id':_0x25d191[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x47d71a,null))[_0x40ca('0x21')](function(_0x3f57f0){if(_0x3f57f0){var _0xd5549c=_0x3f57f0[_0x5e5cd8];var _0x3cc65e=_0xd5549c&&_0xd5549c[_0x40ca('0x10f')]?_0xd5549c[_0x40ca('0x10f')]:[];_0x47d71a[_0x40ca('0x3c')]({'fromKey':_[_0x40ca('0x7d')](_0xd5549c['fromKey'])?undefined:_0xd5549c[_0x40ca('0x110')],'count':_0x3cc65e['length'],'rows':_0x3cc65e});}})['catch'](handleError(_0x47d71a,null));};exports[_0x40ca('0x111')]=function(_0x3e81e2,_0x1683b3,_0xa6a60a){var _0x3dac2a={'raw':![],'where':{}};var _0x11076a={};var _0x3ea4dd={'count':0x0,'rows':[]};return db[_0x40ca('0x40')]['findOne']({'where':{'id':_0x3e81e2[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x1683b3,null))[_0x40ca('0x21')](function(_0x324ae9){if(_0x324ae9){_0x11076a[_0x40ca('0x49')]=_[_0x40ca('0x44')](db[_0x40ca('0x112')]['rawAttributes']);_0x11076a['query']=_[_0x40ca('0x44')](_0x3e81e2[_0x40ca('0x45')]);_0x11076a[_0x40ca('0x46')]=_['intersection'](_0x11076a[_0x40ca('0x49')],_0x11076a['query']);_0x3dac2a['attributes']=_[_0x40ca('0x47')](_0x11076a[_0x40ca('0x49')],qs['fields'](_0x3e81e2[_0x40ca('0x45')]['fields']));_0x3dac2a[_0x40ca('0x48')]=_0x3dac2a[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x3dac2a['attributes']:_0x11076a[_0x40ca('0x49')];if(!_0x3e81e2[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x3dac2a[_0x40ca('0x30')]=qs['limit'](_0x3e81e2[_0x40ca('0x45')]['limit']);_0x3dac2a[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x3e81e2[_0x40ca('0x45')][_0x40ca('0x2f')]);}_0x3dac2a[_0x40ca('0x68')]=qs[_0x40ca('0x4e')](_0x3e81e2['query'][_0x40ca('0x4e')]);_0x3dac2a['where']=qs[_0x40ca('0x46')](_['pick'](_0x3e81e2[_0x40ca('0x45')],_0x11076a[_0x40ca('0x46')]));_0x3dac2a[_0x40ca('0x4f')][_0x40ca('0x69')]=_0x324ae9['id'];if(_0x3e81e2[_0x40ca('0x45')][_0x40ca('0x52')]){_0x3dac2a[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x3dac2a[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x3dac2a[_0x40ca('0x48')],function(_0x5b7887){var _0x2e9923={};_0x2e9923[_0x5b7887]={'$like':'%'+_0x3e81e2[_0x40ca('0x45')]['filter']+'%'};return _0x2e9923;})});}_0x3dac2a=_['merge']({},_0x3dac2a,_0x3e81e2[_0x40ca('0x53')]);return db[_0x40ca('0x112')][_0x40ca('0x2e')]({'where':_0x3dac2a['where']})[_0x40ca('0x21')](function(_0x22dc79){_0x3ea4dd['count']=_0x22dc79;if(_0x3e81e2[_0x40ca('0x45')]['includeAll']){_0x3dac2a['include']=[{'all':!![]}];}else{_0x3dac2a[_0x40ca('0xe4')]=[{'model':db[_0x40ca('0x8a')],'as':_0x40ca('0xe5'),'required':![]}];}return db[_0x40ca('0x112')]['findAll'](_0x3dac2a);})[_0x40ca('0x21')](function(_0x2d5504){_0x3ea4dd[_0x40ca('0x55')]=_0x2d5504;return _0x3ea4dd;});}})[_0x40ca('0x21')](respondWithFilteredResult(_0x1683b3,_0x3dac2a))['catch'](handleError(_0x1683b3,null));};exports['addAgents']=function(_0x11d0db,_0x5ed070,_0x18cec0){return db[_0x40ca('0x40')]['find']({'where':{'id':_0x11d0db[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x5ed070,null))['then'](function(_0x28d923){if(_0x28d923){return _0x28d923[_0x40ca('0x113')](_0x11d0db[_0x40ca('0x5c')][_0x40ca('0x6a')],_[_0x40ca('0xe3')](_0x11d0db[_0x40ca('0x5c')],[_0x40ca('0x6a'),'id'])||{})['spread'](function(_0x32dc45){for(var _0x1119d7=0x0;_0x1119d7<_0x11d0db[_0x40ca('0x5c')][_0x40ca('0x6a')][_0x40ca('0x4b')];_0x1119d7+=0x1){socket[_0x40ca('0x114')]('userChatWebsite:save',{'UserId':_0x11d0db[_0x40ca('0x5c')]['ids'][_0x1119d7],'ChatWebsiteId':_0x11d0db[_0x40ca('0x58')]['id']});}return _0x32dc45;});}})['then'](respondWithResult(_0x5ed070,null))[_0x40ca('0x56')](handleError(_0x5ed070,null));};exports[_0x40ca('0x115')]=function(_0x226f47,_0x20e429,_0x7cdfc1){return db[_0x40ca('0x40')][_0x40ca('0x5b')]({'where':{'id':_0x226f47['params']['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0x20e429,null))[_0x40ca('0x21')](function(_0xcb29db){if(_0xcb29db){return _0xcb29db['removeAgents'](_0x226f47[_0x40ca('0x45')][_0x40ca('0x6a')])['then'](function(){if(_['isArray'](_0x226f47[_0x40ca('0x45')][_0x40ca('0x6a')])){for(var _0x38c628=0x0;_0x38c628<_0x226f47['query'][_0x40ca('0x6a')][_0x40ca('0x4b')];_0x38c628+=0x1){socket[_0x40ca('0x114')](_0x40ca('0x116'),{'UserId':Number(_0x226f47[_0x40ca('0x45')]['ids'][_0x38c628]),'ChatWebsiteId':Number(_0x226f47['params']['id'])});}}else{socket[_0x40ca('0x114')](_0x40ca('0x116'),{'UserId':Number(_0x226f47[_0x40ca('0x45')][_0x40ca('0x6a')]),'ChatWebsiteId':Number(_0x226f47['params']['id'])});}});}})[_0x40ca('0x21')](respondWithStatusCode(_0x20e429,null))['catch'](handleError(_0x20e429,null));};exports[_0x40ca('0x117')]=function(_0x3d57c2,_0xba91bf,_0x17daa0){var _0x5a7a3a={};var _0x20335f={};var _0x1e9212;var _0x5e0de8;return db[_0x40ca('0x40')][_0x40ca('0x6e')]({'where':{'id':_0x3d57c2[_0x40ca('0x58')]['id']}})[_0x40ca('0x21')](handleEntityNotFound(_0xba91bf,null))[_0x40ca('0x21')](function(_0x551874){if(_0x551874){_0x1e9212=_0x551874;_0x20335f['model']=_['keys'](db['User'][_0x40ca('0x41')]);_0x20335f['query']=_[_0x40ca('0x44')](_0x3d57c2[_0x40ca('0x45')]);_0x20335f[_0x40ca('0x46')]=_['intersection'](_0x20335f['model'],_0x20335f[_0x40ca('0x45')]);_0x5a7a3a[_0x40ca('0x48')]=_[_0x40ca('0x47')](_0x20335f['model'],qs[_0x40ca('0x4a')](_0x3d57c2[_0x40ca('0x45')]['fields']));_0x5a7a3a['attributes']=_0x5a7a3a[_0x40ca('0x48')][_0x40ca('0x4b')]?_0x5a7a3a[_0x40ca('0x48')]:_0x20335f[_0x40ca('0x49')];_0x5a7a3a['order']=qs['sort'](_0x3d57c2[_0x40ca('0x45')]['sort']);_0x5a7a3a[_0x40ca('0x4f')]=qs[_0x40ca('0x46')](_['pick'](_0x3d57c2[_0x40ca('0x45')],_0x20335f[_0x40ca('0x46')]));if(_0x3d57c2[_0x40ca('0x45')][_0x40ca('0x52')]){_0x5a7a3a[_0x40ca('0x4f')]=_[_0x40ca('0x51')](_0x5a7a3a[_0x40ca('0x4f')],{'$or':_[_0x40ca('0x3f')](_0x5a7a3a[_0x40ca('0x48')],function(_0x32b9fc){var _0x57995e={};_0x57995e[_0x32b9fc]={'$like':'%'+_0x3d57c2['query'][_0x40ca('0x52')]+'%'};return _0x57995e;})});}_0x5a7a3a=_[_0x40ca('0x51')]({},_0x5a7a3a,_0x3d57c2[_0x40ca('0x53')]);return _0x1e9212[_0x40ca('0x117')](_0x5a7a3a);}})[_0x40ca('0x21')](function(_0x100d26){if(_0x100d26){_0x5e0de8=_0x100d26[_0x40ca('0x4b')];if(!_0x3d57c2[_0x40ca('0x45')][_0x40ca('0x4c')](_0x40ca('0x4d'))){_0x5a7a3a[_0x40ca('0x30')]=qs[_0x40ca('0x30')](_0x3d57c2[_0x40ca('0x45')]['limit']);_0x5a7a3a[_0x40ca('0x2f')]=qs['offset'](_0x3d57c2[_0x40ca('0x45')][_0x40ca('0x2f')]);}return _0x1e9212['getAgents'](_0x5a7a3a);}})['then'](function(_0x989487){if(_0x989487){return _0x989487?{'count':_0x5e0de8,'rows':_0x989487}:null;}})[_0x40ca('0x21')](respondWithResult(_0xba91bf,null))['catch'](handleError(_0xba91bf,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e3ce751..ae8e4c6 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 _0xf380=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0xf380,0xb9));var _0x0f38=function(_0x3656aa,_0x14f8b8){_0x3656aa=_0x3656aa-0x0;var _0x513a85=_0xf380[_0x3656aa];return _0x513a85;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x0f38('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0f38('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f38('0x2'),'afterDestroy':_0x0f38('0x3')};function emitEvent(_0x3bb0e3){return function(_0x38db31,_0x2ad344,_0x2e9c9d){ChatWebsiteEvents[_0x0f38('0x4')](_0x3bb0e3+':'+_0x38db31['id'],_0x38db31);ChatWebsiteEvents[_0x0f38('0x4')](_0x3bb0e3,_0x38db31);_0x2e9c9d(null);};}for(var e in events){if(events[_0x0f38('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x0f38('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x15a9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove'];(function(_0x1e2a32,_0x49a001){var _0x4aba08=function(_0x181df3){while(--_0x181df3){_0x1e2a32['push'](_0x1e2a32['shift']());}};_0x4aba08(++_0x49a001);}(_0x15a9,0x18a));var _0x915a=function(_0x500386,_0xec060b){_0x500386=_0x500386-0x0;var _0x37748d=_0x15a9[_0x500386];return _0x37748d;};'use strict';var EventEmitter=require(_0x915a('0x0'));var ChatWebsite=require(_0x915a('0x1'))['db'][_0x915a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x915a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x915a('0x4'),'afterDestroy':_0x915a('0x5')};function emitEvent(_0x310621){return function(_0x186578,_0x4607a4,_0x351141){ChatWebsiteEvents[_0x915a('0x6')](_0x310621+':'+_0x186578['id'],_0x186578);ChatWebsiteEvents[_0x915a('0x6')](_0x310621,_0x186578);_0x351141(null);};}for(var e in events){if(events[_0x915a('0x7')](e)){var event=events[e];ChatWebsite[_0x915a('0x8')](e,emitEvent(event));}}module[_0x915a('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9017201..a128d64 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 _0x1da6=['exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x1da6,0x7c));var _0x61da=function(_0x3034ce,_0x1421b6){_0x3034ce=_0x3034ce-0x0;var _0x4bc0e3=_0x1da6[_0x3034ce];return _0x4bc0e3;};'use strict';var _=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var logger=require(_0x61da('0x2'))(_0x61da('0x3'));var moment=require(_0x61da('0x4'));var BPromise=require(_0x61da('0x5'));var rp=require(_0x61da('0x6'));var fs=require('fs');var path=require(_0x61da('0x7'));var rimraf=require(_0x61da('0x8'));var config=require(_0x61da('0x9'));var attributes=require(_0x61da('0xa'));module[_0x61da('0xb')]=function(_0x16cd66,_0x2c40c6){return _0x16cd66[_0x61da('0xc')](_0x61da('0xd'),attributes,{'tableName':_0x61da('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0cc=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','api','request-promise','path'];(function(_0x608459,_0x47590c){var _0x498929=function(_0x40bf9c){while(--_0x40bf9c){_0x608459['push'](_0x608459['shift']());}};_0x498929(++_0x47590c);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x41b92f,_0xf6a8e7){_0x41b92f=_0x41b92f-0x0;var _0x5e62c4=_0xf0cc[_0x41b92f];return _0x5e62c4;};'use strict';var _=require(_0xcf0c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf0c('0x2'));var fs=require('fs');var path=require(_0xcf0c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf0c('0x4'));module[_0xcf0c('0x5')]=function(_0x1a6003,_0x497363){return _0x1a6003[_0xcf0c('0x6')](_0xcf0c('0x7'),attributes,{'tableName':_0xcf0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 495bdd2..4faa5fb 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 _0x47c5=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x546ecb,_0x457191){var _0x97f7bc=function(_0x5655af){while(--_0x5655af){_0x546ecb['push'](_0x546ecb['shift']());}};_0x97f7bc(++_0x457191);}(_0x47c5,0x165));var _0x547c=function(_0x560964,_0x2c0ad6){_0x560964=_0x560964-0x0;var _0xe78f82=_0x47c5[_0x560964];return _0xe78f82;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});} \ No newline at end of file +var _0xd117=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x763b48,_0x6e731a){var _0x357067=function(_0x319eb5){while(--_0x319eb5){_0x763b48['push'](_0x763b48['shift']());}};_0x357067(++_0x6e731a);}(_0xd117,0x182));var _0x7d11=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0xd117[_0x4d093a];return _0x5d7227;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});config[_0x7d11('0xe')]=_[_0x7d11('0xf')](config['redis'],{'host':_0x7d11('0x10'),'port':0x18eb});var socket=require(_0x7d11('0x11'))(new Redis(config[_0x7d11('0xe')]));require('./chatWebsite.socket')[_0x7d11('0x12')](socket);function respondWithRpcPromise(_0x30cc64,_0xb2889b,_0x4ed7ae){return new BPromise(function(_0x37047f,_0x48b0f1){return client['request'](_0x30cc64,_0x4ed7ae)[_0x7d11('0x13')](function(_0x5c6d5d){logger['info'](_0x7d11('0x14'),_0xb2889b,'request\x20sent');logger[_0x7d11('0x15')](_0x7d11('0x16'),_0xb2889b,'request\x20sent',JSON[_0x7d11('0x17')](_0x5c6d5d));if(_0x5c6d5d[_0x7d11('0x18')]){if(_0x5c6d5d['error'][_0x7d11('0x19')]===0x1f4){logger[_0x7d11('0x18')](_0x7d11('0x14'),_0xb2889b,_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);return _0x48b0f1(_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);}logger[_0x7d11('0x18')]('ChatWebsite,\x20%s,\x20%s',_0xb2889b,_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);return _0x37047f(_0x5c6d5d[_0x7d11('0x18')][_0x7d11('0x1a')]);}else{logger[_0x7d11('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0xb2889b,_0x7d11('0x1c'));_0x37047f(_0x5c6d5d[_0x7d11('0x1d')]['message']);}})['catch'](function(_0x2ca3a2){logger['error'](_0x7d11('0x14'),_0xb2889b,_0x2ca3a2);_0x48b0f1(_0x2ca3a2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1df9a7c..a36ef7d 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x212b03,_0x1f1b50){var _0x423115=function(_0x35ab9d){while(--_0x35ab9d){_0x212b03['push'](_0x212b03['shift']());}};_0x423115(++_0x1f1b50);}(_0xb10b,0x12a));var _0xbb10=function(_0x291276,_0x5a4690){_0x291276=_0x291276-0x0;var _0x303ab3=_0xb10b[_0x291276];return _0x303ab3;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x262323,_0x4a81f1){var _0xa963c3=function(_0x5c715e){while(--_0x5c715e){_0x262323['push'](_0x262323['shift']());}};_0xa963c3(++_0x4a81f1);}(_0xb10b,0x12a));var _0xbb10=function(_0x81fc31,_0x151260){_0x81fc31=_0x81fc31-0x0;var _0x3c1234=_0xb10b[_0x81fc31];return _0x3c1234;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 62c2bc5..9a75f68 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 _0xab31=['describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/canned_answers','addAnswer','join','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','diskStorage','root','server/files/images/avatars/','now','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get'];(function(_0x46abc7,_0x588588){var _0x2e64e6=function(_0x4b925c){while(--_0x4b925c){_0x46abc7['push'](_0x46abc7['shift']());}};_0x2e64e6(++_0x588588);}(_0xab31,0xb7));var _0x1ab3=function(_0x1b858f,_0x3c4368){_0x1b858f=_0x1b858f-0x0;var _0x22d781=_0xab31[_0x1b858f];return _0x22d781;};'use strict';var multer=require(_0x1ab3('0x0'));var util=require('util');var path=require(_0x1ab3('0x1'));var timeout=require(_0x1ab3('0x2'));var express=require(_0x1ab3('0x3'));var router=express[_0x1ab3('0x4')]();var auth=require(_0x1ab3('0x5'));var interaction=require(_0x1ab3('0x6'));var config=require(_0x1ab3('0x7'));var controller=require(_0x1ab3('0x8'));router['get']('/',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0xa')]);router[_0x1ab3('0xb')]('/describe',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0xc')]);router[_0x1ab3('0xb')](_0x1ab3('0xd'),auth['isAuthenticated'](),controller[_0x1ab3('0xe')]);router[_0x1ab3('0xb')](_0x1ab3('0xf'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x10')]);router[_0x1ab3('0xb')]('/:id/canned_answers',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x11')]);router[_0x1ab3('0xb')](_0x1ab3('0x12'),controller['getLogo']);router['get'](_0x1ab3('0x13'),controller['getAvatar']);router['get']('/:id/customer_avatar',controller[_0x1ab3('0x14')]);router[_0x1ab3('0xb')](_0x1ab3('0x15'),controller[_0x1ab3('0x16')]);router['get'](_0x1ab3('0x17'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x18')]);router['get'](_0x1ab3('0x19'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x1a')]);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x1ab3('0x1b')]);router['get']('/:id/fields',controller['getFields']);router[_0x1ab3('0xb')](_0x1ab3('0x1c'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x1d')]);router['get'](_0x1ab3('0x1e'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x1f')]);router['post']('/',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x20')]);router['post'](_0x1ab3('0xf'),auth[_0x1ab3('0x9')](),controller['addDisposition']);router[_0x1ab3('0x21')](_0x1ab3('0x22'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x10083f,_0x1b92c2,_0x229635){_0x229635(null,path[_0x1ab3('0x24')](config['root'],_0x1ab3('0x25')));},'filename':function(_0xc5a0a7,_0x4a48f7,_0x63d698){_0x63d698(null,util[_0x1ab3('0x26')](_0x1ab3('0x27'),Date['now'](),_0x4a48f7[_0x1ab3('0x28')]));}})});router[_0x1ab3('0x21')](_0x1ab3('0x12'),upload[_0x1ab3('0x29')]('file'),controller[_0x1ab3('0x2a')]);var upload=multer({'storage':multer[_0x1ab3('0x2b')]({'destination':function(_0x265a34,_0x27e416,_0xf86e95){_0xf86e95(null,path[_0x1ab3('0x24')](config[_0x1ab3('0x2c')],_0x1ab3('0x2d')));},'filename':function(_0x2261a1,_0x1e2bca,_0x4ea82e){_0x4ea82e(null,util[_0x1ab3('0x26')]('%s-%s',Date[_0x1ab3('0x2e')](),_0x1e2bca[_0x1ab3('0x28')]));}})});router[_0x1ab3('0x21')](_0x1ab3('0x13'),upload[_0x1ab3('0x29')](_0x1ab3('0x2f')),controller[_0x1ab3('0x30')]);var upload=multer({'storage':multer[_0x1ab3('0x2b')]({'destination':function(_0x2d3aaf,_0x5636fb,_0x15b5cb){_0x15b5cb(null,path[_0x1ab3('0x24')](config[_0x1ab3('0x2c')],_0x1ab3('0x2d')));},'filename':function(_0x14919f,_0x410f62,_0x32a1bc){_0x32a1bc(null,util[_0x1ab3('0x26')](_0x1ab3('0x27'),Date[_0x1ab3('0x2e')](),_0x410f62['originalname']));}})});router[_0x1ab3('0x21')](_0x1ab3('0x31'),upload['single'](_0x1ab3('0x2f')),controller[_0x1ab3('0x32')]);var upload=multer({'storage':multer[_0x1ab3('0x2b')]({'destination':function(_0x2fb514,_0x47fac8,_0xb0e1e){_0xb0e1e(null,path[_0x1ab3('0x24')](config[_0x1ab3('0x2c')],_0x1ab3('0x2d')));},'filename':function(_0x31b165,_0x24269c,_0xb9e7a1){_0xb9e7a1(null,util[_0x1ab3('0x26')]('%s-%s',Date[_0x1ab3('0x2e')](),_0x24269c[_0x1ab3('0x28')]));}})});router[_0x1ab3('0x21')](_0x1ab3('0x15'),upload[_0x1ab3('0x29')](_0x1ab3('0x2f')),controller[_0x1ab3('0x33')]);router['post']('/:id/notify',controller['notify']);router[_0x1ab3('0x21')](_0x1ab3('0x34'),controller[_0x1ab3('0x35')]);router[_0x1ab3('0x21')](_0x1ab3('0x17'),auth['isAuthenticated'](),controller[_0x1ab3('0x36')]);router[_0x1ab3('0x21')]('/:id/applications',auth['isAuthenticated'](),controller[_0x1ab3('0x37')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x1ab3('0x38')]);router['post'](_0x1ab3('0x1e'),auth['isAuthenticated'](),controller[_0x1ab3('0x39')]);router[_0x1ab3('0x3a')](_0x1ab3('0xd'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3b')]);router[_0x1ab3('0x3c')](_0x1ab3('0xd'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3d')]);router[_0x1ab3('0x3c')](_0x1ab3('0xf'),auth[_0x1ab3('0x9')](),controller['removeDispositions']);router[_0x1ab3('0x3c')]('/:id/canned_answers',auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3e')]);router['delete'](_0x1ab3('0x1e'),auth[_0x1ab3('0x9')](),controller[_0x1ab3('0x3f')]);module[_0x1ab3('0x40')]=router; \ No newline at end of file +var _0x0e4b=['file','addLogo','join','server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','now','originalname','single'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x0e4b,0x99));var _0xb0e4=function(_0x2e69d9,_0x4c664f){_0x2e69d9=_0x2e69d9-0x0;var _0x53f49a=_0x0e4b[_0x2e69d9];return _0x53f49a;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require('path');var timeout=require(_0xb0e4('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb0e4('0x3'));var interaction=require(_0xb0e4('0x4'));var config=require(_0xb0e4('0x5'));var controller=require(_0xb0e4('0x6'));router[_0xb0e4('0x7')]('/',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x9')]);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x8')](),controller['describe']);router[_0xb0e4('0x7')](_0xb0e4('0xb'),auth[_0xb0e4('0x8')](),controller['show']);router[_0xb0e4('0x7')]('/:id/dispositions',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0xc')]);router[_0xb0e4('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xb0e4('0x7')](_0xb0e4('0xd'),controller[_0xb0e4('0xe')]);router[_0xb0e4('0x7')]('/:id/avatar',controller[_0xb0e4('0xf')]);router[_0xb0e4('0x7')]('/:id/customer_avatar',controller[_0xb0e4('0x10')]);router['get'](_0xb0e4('0x11'),controller[_0xb0e4('0x12')]);router[_0xb0e4('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xb0e4('0x13')]);router[_0xb0e4('0x7')](_0xb0e4('0x14'),controller[_0xb0e4('0x15')]);router[_0xb0e4('0x7')](_0xb0e4('0x16'),auth[_0xb0e4('0x8')](),controller['getApplications']);router[_0xb0e4('0x7')](_0xb0e4('0x17'),auth[_0xb0e4('0x8')](),controller['getProactiveActions']);router[_0xb0e4('0x7')]('/:id/fields',controller[_0xb0e4('0x18')]);router[_0xb0e4('0x7')](_0xb0e4('0x19'),auth['isAuthenticated'](),controller[_0xb0e4('0x1a')]);router['get'](_0xb0e4('0x1b'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0e4('0x1d')]);router[_0xb0e4('0x1e')](_0xb0e4('0x1f'),auth['isAuthenticated'](),controller[_0xb0e4('0x20')]);router[_0xb0e4('0x1e')](_0xb0e4('0x21'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x22')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x5d6e67,_0x8a9e7,_0x2faa25){_0x2faa25(null,path['join'](config[_0xb0e4('0x24')],_0xb0e4('0x25')));},'filename':function(_0x27a285,_0x43745e,_0x4dac58){_0x4dac58(null,util[_0xb0e4('0x26')]('%s-%s',Date[_0xb0e4('0x27')](),_0x43745e[_0xb0e4('0x28')]));}})});router['post'](_0xb0e4('0xd'),upload[_0xb0e4('0x29')](_0xb0e4('0x2a')),controller[_0xb0e4('0x2b')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x212eba,_0x5862d1,_0x400792){_0x400792(null,path[_0xb0e4('0x2c')](config[_0xb0e4('0x24')],_0xb0e4('0x2d')));},'filename':function(_0x4c037e,_0x5cb78a,_0xfe9881){_0xfe9881(null,util[_0xb0e4('0x26')](_0xb0e4('0x2e'),Date[_0xb0e4('0x27')](),_0x5cb78a[_0xb0e4('0x28')]));}})});router[_0xb0e4('0x1e')](_0xb0e4('0x2f'),upload[_0xb0e4('0x29')](_0xb0e4('0x2a')),controller[_0xb0e4('0x30')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x3b9962,_0x54667a,_0x43575c){_0x43575c(null,path[_0xb0e4('0x2c')](config['root'],_0xb0e4('0x2d')));},'filename':function(_0x3d6d14,_0x102dc3,_0x1e78c4){_0x1e78c4(null,util[_0xb0e4('0x26')](_0xb0e4('0x2e'),Date[_0xb0e4('0x27')](),_0x102dc3[_0xb0e4('0x28')]));}})});router[_0xb0e4('0x1e')](_0xb0e4('0x31'),upload['single'](_0xb0e4('0x2a')),controller[_0xb0e4('0x32')]);var upload=multer({'storage':multer[_0xb0e4('0x23')]({'destination':function(_0x2dc8af,_0x21198f,_0x3d1c5f){_0x3d1c5f(null,path[_0xb0e4('0x2c')](config[_0xb0e4('0x24')],_0xb0e4('0x2d')));},'filename':function(_0x187eba,_0x6d55ea,_0x5bbef7){_0x5bbef7(null,util[_0xb0e4('0x26')](_0xb0e4('0x2e'),Date[_0xb0e4('0x27')](),_0x6d55ea['originalname']));}})});router[_0xb0e4('0x1e')](_0xb0e4('0x11'),upload['single'](_0xb0e4('0x2a')),controller[_0xb0e4('0x33')]);router['post']('/:id/notify',controller[_0xb0e4('0x34')]);router[_0xb0e4('0x1e')]('/:id/offline',controller[_0xb0e4('0x35')]);router[_0xb0e4('0x1e')](_0xb0e4('0x36'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x37')]);router[_0xb0e4('0x1e')](_0xb0e4('0x16'),auth['isAuthenticated'](),controller[_0xb0e4('0x38')]);router[_0xb0e4('0x1e')]('/:id/proactive_actions',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x39')]);router[_0xb0e4('0x1e')](_0xb0e4('0x1b'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x3a')]);router['put'](_0xb0e4('0xb'),auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x3b')]);router['delete']('/:id',auth[_0xb0e4('0x8')](),controller[_0xb0e4('0x3c')]);router['delete'](_0xb0e4('0x1f'),auth[_0xb0e4('0x8')](),controller['removeDispositions']);router[_0xb0e4('0x3d')](_0xb0e4('0x21'),auth['isAuthenticated'](),controller[_0xb0e4('0x3e')]);router[_0xb0e4('0x3d')](_0xb0e4('0x1b'),auth['isAuthenticated'](),controller[_0xb0e4('0x3f')]);module[_0xb0e4('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ae9b6c2..08e7635 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 _0x24ce=['ENUM','AmazonAWS','exports','STRING'];(function(_0x59fec8,_0x2a864){var _0x22f12e=function(_0x5c5d53){while(--_0x5c5d53){_0x59fec8['push'](_0x59fec8['shift']());}};_0x22f12e(++_0x2a864);}(_0x24ce,0x1de));var _0xe24c=function(_0x3724a4,_0x11c5df){_0x3724a4=_0x3724a4-0x0;var _0x3ea1c9=_0x24ce[_0x3724a4];return _0x3ea1c9;};'use strict';var Sequelize=require('sequelize');module[_0xe24c('0x0')]={'name':{'type':Sequelize[_0xe24c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe24c('0x2')](_0xe24c('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe24c('0x1')]}}; \ No newline at end of file +var _0x1939=['AmazonAWS','sequelize','STRING','ENUM'];(function(_0x556d7e,_0x3a6198){var _0x3b9332=function(_0xc5a16c){while(--_0xc5a16c){_0x556d7e['push'](_0x556d7e['shift']());}};_0x3b9332(++_0x3a6198);}(_0x1939,0x1d1));var _0x9193=function(_0x1e0d9a,_0x214450){_0x1e0d9a=_0x1e0d9a-0x0;var _0x36cbe0=_0x1939[_0x1e0d9a];return _0x36cbe0;};'use strict';var Sequelize=require(_0x9193('0x0'));module['exports']={'name':{'type':Sequelize[_0x9193('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9193('0x2')](_0x9193('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x9193('0x1')]},'data2':{'type':Sequelize[_0x9193('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 785d114..2e918e2 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 _0xef83=['error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','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','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy'];(function(_0x2caadd,_0x4d26b4){var _0x509c79=function(_0x50bb80){while(--_0x50bb80){_0x2caadd['push'](_0x2caadd['shift']());}};_0x509c79(++_0x4d26b4);}(_0xef83,0x150));var _0x3ef8=function(_0x1829c6,_0x4d98fd){_0x1829c6=_0x1829c6-0x0;var _0x19a7a0=_0xef83[_0x1829c6];return _0x19a7a0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ef8('0x0'));var rimraf=require(_0x3ef8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ef8('0x2'));var rp=require('request-promise');var moment=require(_0x3ef8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ef8('0x4'));var util=require('util');var path=require(_0x3ef8('0x5'));var sox=require(_0x3ef8('0x6'));var csv=require('to-csv');var ejs=require(_0x3ef8('0x7'));var fs=require('fs');var _=require(_0x3ef8('0x8'));var squel=require(_0x3ef8('0x9'));var crypto=require(_0x3ef8('0xa'));var jsforce=require(_0x3ef8('0xb'));var deskjs=require(_0x3ef8('0xc'));var toCsv=require(_0x3ef8('0xd'));var querystring=require(_0x3ef8('0xe'));var Papa=require(_0x3ef8('0xf'));var Redis=require(_0x3ef8('0x10'));var authService=require(_0x3ef8('0x11'));var qs=require(_0x3ef8('0x12'));var as=require(_0x3ef8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ef8('0x14'))(_0x3ef8('0x15'));var utils=require(_0x3ef8('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4ab6f,_0x130378){_0x130378=_0x130378||0xcc;return function(_0x593d78){if(_0x593d78){return _0xf4ab6f[_0x3ef8('0x17')](_0x130378);}return _0xf4ab6f[_0x3ef8('0x18')](_0x130378)[_0x3ef8('0x19')]();};}function respondWithResult(_0x3346bf,_0x5d914){_0x5d914=_0x5d914||0xc8;return function(_0xa4438f){if(_0xa4438f){return _0x3346bf[_0x3ef8('0x18')](_0x5d914)[_0x3ef8('0x1a')](_0xa4438f);}};}function respondWithFilteredResult(_0x4cd285,_0x529d91){return function(_0x3e9c3b){if(_0x3e9c3b){var _0x146df0=_0x3e9c3b['count'],_0x1af001=_0x529d91[_0x3ef8('0x1b')],_0x5e653c=_0x529d91[_0x3ef8('0x1b')]+_0x529d91['limit'],_0x286388;if(_0x5e653c>=_0x146df0){_0x5e653c=_0x146df0;_0x286388=0xc8;}else{_0x286388=0xce;}_0x4cd285[_0x3ef8('0x18')](_0x286388);return _0x4cd285[_0x3ef8('0x1c')](_0x3ef8('0x1d'),_0x1af001+'-'+_0x5e653c+'/'+_0x146df0)['json'](_0x3e9c3b);}return null;};}function patchUpdates(_0x16799f){return function(_0x468e20){try{jsonpatch['apply'](_0x468e20,_0x16799f,!![]);}catch(_0x5f428a){return BPromise[_0x3ef8('0x1e')](_0x5f428a);}return _0x468e20[_0x3ef8('0x1f')]();};}function saveUpdates(_0x4b6f1d,_0x33280d){return function(_0x2e7d44){if(_0x2e7d44){return _0x2e7d44['update'](_0x4b6f1d)[_0x3ef8('0x20')](function(_0x1f938f){return _0x1f938f;});}return null;};}function removeEntity(_0x13fa92,_0x5f7770){return function(_0x339a75){if(_0x339a75){return _0x339a75[_0x3ef8('0x21')]()['then'](function(){_0x13fa92['status'](0xcc)[_0x3ef8('0x19')]();});}};}function handleEntityNotFound(_0x165a03,_0x5b9dbf){return function(_0xbaf9d4){if(!_0xbaf9d4){_0x165a03[_0x3ef8('0x17')](0x194);}return _0xbaf9d4;};}function handleError(_0x31174a,_0x491dff){_0x491dff=_0x491dff||0x1f4;return function(_0x16a984){logger[_0x3ef8('0x22')](_0x16a984[_0x3ef8('0x23')]);if(_0x16a984['name']){delete _0x16a984[_0x3ef8('0x24')];}_0x31174a[_0x3ef8('0x18')](_0x491dff)[_0x3ef8('0x25')](_0x16a984);};}exports[_0x3ef8('0x26')]=function(_0x811080,_0x511e89){var _0x28d348={},_0x2313d0={},_0xf3b3f5={'count':0x0,'rows':[]};var _0x33b255=_[_0x3ef8('0x27')](db[_0x3ef8('0x28')][_0x3ef8('0x29')],function(_0x24f483){return{'name':_0x24f483[_0x3ef8('0x2a')],'type':_0x24f483[_0x3ef8('0x2b')][_0x3ef8('0x2c')]};});_0x2313d0['model']=_[_0x3ef8('0x27')](_0x33b255,_0x3ef8('0x24'));_0x2313d0[_0x3ef8('0x2d')]=_['keys'](_0x811080['query']);_0x2313d0[_0x3ef8('0x2e')]=_[_0x3ef8('0x2f')](_0x2313d0[_0x3ef8('0x30')],_0x2313d0[_0x3ef8('0x2d')]);_0x28d348['attributes']=_[_0x3ef8('0x2f')](_0x2313d0['model'],qs['fields'](_0x811080[_0x3ef8('0x2d')]['fields']));_0x28d348[_0x3ef8('0x31')]=_0x28d348[_0x3ef8('0x31')][_0x3ef8('0x32')]?_0x28d348[_0x3ef8('0x31')]:_0x2313d0[_0x3ef8('0x30')];if(!_0x811080[_0x3ef8('0x2d')][_0x3ef8('0x33')]('nolimit')){_0x28d348[_0x3ef8('0x34')]=qs[_0x3ef8('0x34')](_0x811080[_0x3ef8('0x2d')][_0x3ef8('0x34')]);_0x28d348['offset']=qs[_0x3ef8('0x1b')](_0x811080[_0x3ef8('0x2d')][_0x3ef8('0x1b')]);}_0x28d348[_0x3ef8('0x35')]=qs[_0x3ef8('0x36')](_0x811080['query'][_0x3ef8('0x36')]);_0x28d348[_0x3ef8('0x37')]=qs['filters'](_[_0x3ef8('0x38')](_0x811080[_0x3ef8('0x2d')],_0x2313d0['filters']),_0x33b255);if(_0x811080['query'][_0x3ef8('0x39')]){_0x28d348[_0x3ef8('0x37')]=_[_0x3ef8('0x3a')](_0x28d348[_0x3ef8('0x37')],{'$or':_[_0x3ef8('0x27')](_0x33b255,function(_0x42dc9d){if(_0x42dc9d[_0x3ef8('0x2b')]!==_0x3ef8('0x3b')){var _0x2d2ffd={};_0x2d2ffd[_0x42dc9d[_0x3ef8('0x24')]]={'$like':'%'+_0x811080['query'][_0x3ef8('0x39')]+'%'};return _0x2d2ffd;}})});}_0x28d348=_['merge']({},_0x28d348,_0x811080[_0x3ef8('0x3c')]);var _0x54cfd0={'where':_0x28d348[_0x3ef8('0x37')]};return db[_0x3ef8('0x28')][_0x3ef8('0x3d')](_0x54cfd0)[_0x3ef8('0x20')](function(_0xd36ee0){_0xf3b3f5[_0x3ef8('0x3d')]=_0xd36ee0;if(_0x811080[_0x3ef8('0x2d')]['includeAll']){_0x28d348[_0x3ef8('0x3e')]=[{'all':!![]}];}return db[_0x3ef8('0x28')][_0x3ef8('0x3f')](_0x28d348);})['then'](function(_0x2f5117){_0xf3b3f5[_0x3ef8('0x40')]=_0x2f5117;return _0xf3b3f5;})['then'](respondWithFilteredResult(_0x511e89,_0x28d348))[_0x3ef8('0x41')](handleError(_0x511e89,null));};exports[_0x3ef8('0x42')]=function(_0x5220af,_0x697f83){var _0x350721={'raw':!![],'where':{'id':_0x5220af[_0x3ef8('0x43')]['id']}},_0x293aa4={};_0x293aa4[_0x3ef8('0x30')]=_[_0x3ef8('0x44')](db[_0x3ef8('0x28')][_0x3ef8('0x29')]);_0x293aa4[_0x3ef8('0x2d')]=_[_0x3ef8('0x44')](_0x5220af[_0x3ef8('0x2d')]);_0x293aa4[_0x3ef8('0x2e')]=_[_0x3ef8('0x2f')](_0x293aa4[_0x3ef8('0x30')],_0x293aa4[_0x3ef8('0x2d')]);_0x350721[_0x3ef8('0x31')]=_[_0x3ef8('0x2f')](_0x293aa4['model'],qs['fields'](_0x5220af[_0x3ef8('0x2d')]['fields']));_0x350721[_0x3ef8('0x31')]=_0x350721[_0x3ef8('0x31')][_0x3ef8('0x32')]?_0x350721[_0x3ef8('0x31')]:_0x293aa4['model'];if(_0x5220af[_0x3ef8('0x2d')][_0x3ef8('0x45')]){_0x350721[_0x3ef8('0x3e')]=[{'all':!![]}];}_0x350721=_[_0x3ef8('0x3a')]({},_0x350721,_0x5220af[_0x3ef8('0x3c')]);return db[_0x3ef8('0x28')][_0x3ef8('0x46')](_0x350721)[_0x3ef8('0x20')](handleEntityNotFound(_0x697f83,null))['then'](respondWithResult(_0x697f83,null))[_0x3ef8('0x41')](handleError(_0x697f83,null));};exports[_0x3ef8('0x47')]=function(_0x4b6e66,_0x219eea){return db[_0x3ef8('0x28')]['create'](_0x4b6e66[_0x3ef8('0x48')],{})[_0x3ef8('0x20')](respondWithResult(_0x219eea,0xc9))[_0x3ef8('0x41')](handleError(_0x219eea,null));};exports[_0x3ef8('0x49')]=function(_0x3c8efb,_0x13389f){if(_0x3c8efb['body']['id']){delete _0x3c8efb[_0x3ef8('0x48')]['id'];}return db[_0x3ef8('0x28')][_0x3ef8('0x46')]({'where':{'id':_0x3c8efb[_0x3ef8('0x43')]['id']}})['then'](handleEntityNotFound(_0x13389f,null))[_0x3ef8('0x20')](saveUpdates(_0x3c8efb[_0x3ef8('0x48')],null))[_0x3ef8('0x20')](respondWithResult(_0x13389f,null))['catch'](handleError(_0x13389f,null));};exports[_0x3ef8('0x21')]=function(_0x545b31,_0x5a4466){return db[_0x3ef8('0x28')][_0x3ef8('0x46')]({'where':{'id':_0x545b31[_0x3ef8('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a4466,null))['then'](removeEntity(_0x5a4466,null))[_0x3ef8('0x41')](handleError(_0x5a4466,null));}; \ No newline at end of file +var _0x7cce=['querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','apply','reject','update','destroy','then','error','stack','name','send','CloudProvider','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','intersection','find','create','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7cce,0x1c7));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe7cc('0x0'));var emlformat=require(_0xe7cc('0x1'));var rimraf=require(_0xe7cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cc('0x3'));var rp=require(_0xe7cc('0x4'));var moment=require('moment');var BPromise=require(_0xe7cc('0x5'));var Mustache=require(_0xe7cc('0x6'));var util=require(_0xe7cc('0x7'));var path=require(_0xe7cc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7cc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe7cc('0xa'));var crypto=require(_0xe7cc('0xb'));var jsforce=require(_0xe7cc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe7cc('0xd'));var querystring=require(_0xe7cc('0xe'));var Papa=require('papaparse');var Redis=require(_0xe7cc('0xf'));var authService=require(_0xe7cc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7cc('0x11'));var logger=require(_0xe7cc('0x12'))(_0xe7cc('0x13'));var utils=require(_0xe7cc('0x14'));var config=require(_0xe7cc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140ad1,_0x1b4cd0){_0x1b4cd0=_0x1b4cd0||0xcc;return function(_0x2a0093){if(_0x2a0093){return _0x140ad1[_0xe7cc('0x16')](_0x1b4cd0);}return _0x140ad1[_0xe7cc('0x17')](_0x1b4cd0)[_0xe7cc('0x18')]();};}function respondWithResult(_0x41f26c,_0x1a839a){_0x1a839a=_0x1a839a||0xc8;return function(_0x5c2684){if(_0x5c2684){return _0x41f26c['status'](_0x1a839a)['json'](_0x5c2684);}};}function respondWithFilteredResult(_0x330a72,_0x1ff4c1){return function(_0x3af319){if(_0x3af319){var _0x539e64=_0x3af319['count'],_0x2e0029=_0x1ff4c1[_0xe7cc('0x19')],_0x5247c9=_0x1ff4c1[_0xe7cc('0x19')]+_0x1ff4c1['limit'],_0x33c2bb;if(_0x5247c9>=_0x539e64){_0x5247c9=_0x539e64;_0x33c2bb=0xc8;}else{_0x33c2bb=0xce;}_0x330a72[_0xe7cc('0x17')](_0x33c2bb);return _0x330a72[_0xe7cc('0x1a')]('Content-Range',_0x2e0029+'-'+_0x5247c9+'/'+_0x539e64)['json'](_0x3af319);}return null;};}function patchUpdates(_0x3f4302){return function(_0x1c42a2){try{jsonpatch[_0xe7cc('0x1b')](_0x1c42a2,_0x3f4302,!![]);}catch(_0x51032e){return BPromise[_0xe7cc('0x1c')](_0x51032e);}return _0x1c42a2['save']();};}function saveUpdates(_0x4123e5,_0x4e4316){return function(_0x542304){if(_0x542304){return _0x542304[_0xe7cc('0x1d')](_0x4123e5)['then'](function(_0xdbf09f){return _0xdbf09f;});}return null;};}function removeEntity(_0x581f99,_0x22282d){return function(_0x107766){if(_0x107766){return _0x107766[_0xe7cc('0x1e')]()[_0xe7cc('0x1f')](function(){_0x581f99[_0xe7cc('0x17')](0xcc)[_0xe7cc('0x18')]();});}};}function handleEntityNotFound(_0x365996,_0x4ab7f8){return function(_0x4b764d){if(!_0x4b764d){_0x365996[_0xe7cc('0x16')](0x194);}return _0x4b764d;};}function handleError(_0x2b255a,_0xd9c9e2){_0xd9c9e2=_0xd9c9e2||0x1f4;return function(_0x1b7e7e){logger[_0xe7cc('0x20')](_0x1b7e7e[_0xe7cc('0x21')]);if(_0x1b7e7e['name']){delete _0x1b7e7e[_0xe7cc('0x22')];}_0x2b255a[_0xe7cc('0x17')](_0xd9c9e2)[_0xe7cc('0x23')](_0x1b7e7e);};}exports['index']=function(_0x25547b,_0x3488f4){var _0x34ba62={},_0x3e26c9={},_0x4c86c4={'count':0x0,'rows':[]};var _0x3ad286=_['map'](db[_0xe7cc('0x24')]['rawAttributes'],function(_0x105411){return{'name':_0x105411['fieldName'],'type':_0x105411[_0xe7cc('0x25')]['key']};});_0x3e26c9[_0xe7cc('0x26')]=_['map'](_0x3ad286,_0xe7cc('0x22'));_0x3e26c9[_0xe7cc('0x27')]=_['keys'](_0x25547b[_0xe7cc('0x27')]);_0x3e26c9[_0xe7cc('0x28')]=_['intersection'](_0x3e26c9['model'],_0x3e26c9[_0xe7cc('0x27')]);_0x34ba62[_0xe7cc('0x29')]=_['intersection'](_0x3e26c9['model'],qs['fields'](_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2a')]));_0x34ba62[_0xe7cc('0x29')]=_0x34ba62[_0xe7cc('0x29')][_0xe7cc('0x2b')]?_0x34ba62[_0xe7cc('0x29')]:_0x3e26c9[_0xe7cc('0x26')];if(!_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2c')](_0xe7cc('0x2d'))){_0x34ba62[_0xe7cc('0x2e')]=qs[_0xe7cc('0x2e')](_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2e')]);_0x34ba62[_0xe7cc('0x19')]=qs['offset'](_0x25547b['query'][_0xe7cc('0x19')]);}_0x34ba62['order']=qs[_0xe7cc('0x2f')](_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x2f')]);_0x34ba62[_0xe7cc('0x30')]=qs[_0xe7cc('0x28')](_[_0xe7cc('0x31')](_0x25547b[_0xe7cc('0x27')],_0x3e26c9[_0xe7cc('0x28')]),_0x3ad286);if(_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x32')]){_0x34ba62[_0xe7cc('0x30')]=_[_0xe7cc('0x33')](_0x34ba62['where'],{'$or':_[_0xe7cc('0x34')](_0x3ad286,function(_0x566154){if(_0x566154[_0xe7cc('0x25')]!==_0xe7cc('0x35')){var _0x531482={};_0x531482[_0x566154[_0xe7cc('0x22')]]={'$like':'%'+_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x32')]+'%'};return _0x531482;}})});}_0x34ba62=_[_0xe7cc('0x33')]({},_0x34ba62,_0x25547b[_0xe7cc('0x36')]);var _0x4e81da={'where':_0x34ba62[_0xe7cc('0x30')]};return db[_0xe7cc('0x24')][_0xe7cc('0x37')](_0x4e81da)[_0xe7cc('0x1f')](function(_0x5c1ae4){_0x4c86c4[_0xe7cc('0x37')]=_0x5c1ae4;if(_0x25547b[_0xe7cc('0x27')][_0xe7cc('0x38')]){_0x34ba62[_0xe7cc('0x39')]=[{'all':!![]}];}return db[_0xe7cc('0x24')]['findAll'](_0x34ba62);})[_0xe7cc('0x1f')](function(_0x11e40d){_0x4c86c4[_0xe7cc('0x3a')]=_0x11e40d;return _0x4c86c4;})[_0xe7cc('0x1f')](respondWithFilteredResult(_0x3488f4,_0x34ba62))['catch'](handleError(_0x3488f4,null));};exports[_0xe7cc('0x3b')]=function(_0x74fa8d,_0x4342ec){var _0x5a18a5={'raw':!![],'where':{'id':_0x74fa8d[_0xe7cc('0x3c')]['id']}},_0x2a0756={};_0x2a0756[_0xe7cc('0x26')]=_[_0xe7cc('0x3d')](db['CloudProvider']['rawAttributes']);_0x2a0756[_0xe7cc('0x27')]=_[_0xe7cc('0x3d')](_0x74fa8d[_0xe7cc('0x27')]);_0x2a0756['filters']=_[_0xe7cc('0x3e')](_0x2a0756[_0xe7cc('0x26')],_0x2a0756['query']);_0x5a18a5['attributes']=_[_0xe7cc('0x3e')](_0x2a0756[_0xe7cc('0x26')],qs[_0xe7cc('0x2a')](_0x74fa8d[_0xe7cc('0x27')][_0xe7cc('0x2a')]));_0x5a18a5[_0xe7cc('0x29')]=_0x5a18a5['attributes'][_0xe7cc('0x2b')]?_0x5a18a5[_0xe7cc('0x29')]:_0x2a0756[_0xe7cc('0x26')];if(_0x74fa8d[_0xe7cc('0x27')][_0xe7cc('0x38')]){_0x5a18a5[_0xe7cc('0x39')]=[{'all':!![]}];}_0x5a18a5=_[_0xe7cc('0x33')]({},_0x5a18a5,_0x74fa8d['options']);return db['CloudProvider'][_0xe7cc('0x3f')](_0x5a18a5)[_0xe7cc('0x1f')](handleEntityNotFound(_0x4342ec,null))['then'](respondWithResult(_0x4342ec,null))['catch'](handleError(_0x4342ec,null));};exports['create']=function(_0x481280,_0x2c94a1){return db['CloudProvider'][_0xe7cc('0x40')](_0x481280['body'],{})[_0xe7cc('0x1f')](respondWithResult(_0x2c94a1,0xc9))[_0xe7cc('0x41')](handleError(_0x2c94a1,null));};exports['update']=function(_0x31aa41,_0x1eddf9){if(_0x31aa41[_0xe7cc('0x42')]['id']){delete _0x31aa41[_0xe7cc('0x42')]['id'];}return db[_0xe7cc('0x24')][_0xe7cc('0x3f')]({'where':{'id':_0x31aa41[_0xe7cc('0x3c')]['id']}})[_0xe7cc('0x1f')](handleEntityNotFound(_0x1eddf9,null))[_0xe7cc('0x1f')](saveUpdates(_0x31aa41[_0xe7cc('0x42')],null))['then'](respondWithResult(_0x1eddf9,null))[_0xe7cc('0x41')](handleError(_0x1eddf9,null));};exports[_0xe7cc('0x1e')]=function(_0x4235d9,_0x3fff5e){return db['CloudProvider'][_0xe7cc('0x3f')]({'where':{'id':_0x4235d9[_0xe7cc('0x3c')]['id']}})[_0xe7cc('0x1f')](handleEntityNotFound(_0x3fff5e,null))[_0xe7cc('0x1f')](removeEntity(_0x3fff5e,null))[_0xe7cc('0x41')](handleError(_0x3fff5e,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e6a6682..2f24b5e 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 _0x9055=['../../config/environment','./cloudProvider.attributes','define','cloud_providers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x222550,_0x3c0a0c){var _0x58ac61=function(_0x4f7201){while(--_0x4f7201){_0x222550['push'](_0x222550['shift']());}};_0x58ac61(++_0x3c0a0c);}(_0x9055,0x1dd));var _0x5905=function(_0x409b87,_0x5ef488){_0x409b87=_0x409b87-0x0;var _0x46fa68=_0x9055[_0x409b87];return _0x46fa68;};'use strict';var _=require(_0x5905('0x0'));var util=require(_0x5905('0x1'));var logger=require(_0x5905('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5905('0x3'));var rp=require(_0x5905('0x4'));var fs=require('fs');var path=require(_0x5905('0x5'));var rimraf=require(_0x5905('0x6'));var config=require(_0x5905('0x7'));var attributes=require(_0x5905('0x8'));module['exports']=function(_0x1d7fd9,_0x4f48f2){return _0x1d7fd9[_0x5905('0x9')]('CloudProvider',attributes,{'tableName':_0x5905('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c7f=['path','../../config/environment','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x0c7f,0x162));var _0xf0c7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0c7f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf0c7('0x0'));var util=require(_0xf0c7('0x1'));var logger=require(_0xf0c7('0x2'))(_0xf0c7('0x3'));var moment=require('moment');var BPromise=require(_0xf0c7('0x4'));var rp=require(_0xf0c7('0x5'));var fs=require('fs');var path=require(_0xf0c7('0x6'));var rimraf=require('rimraf');var config=require(_0xf0c7('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0xff7039,_0x3bb885){return _0xff7039['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 4b5bcf1..77f6ee4 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 _0x2fc1=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x3e8776,_0x240200){var _0x1fde7e=function(_0x47ee22){while(--_0x47ee22){_0x3e8776['push'](_0x3e8776['shift']());}};_0x1fde7e(++_0x240200);}(_0x2fc1,0x8e));var _0x12fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x12fc('0x0'));var util=require(_0x12fc('0x1'));var moment=require(_0x12fc('0x2'));var BPromise=require(_0x12fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x12fc('0x5'));var logger=require('../../config/logger')(_0x12fc('0x6'));var config=require(_0x12fc('0x7'));var jayson=require(_0x12fc('0x8'));var client=jayson[_0x12fc('0x9')][_0x12fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b2d89,_0x719b0a,_0x5e0da7){return new BPromise(function(_0x5df479,_0x5ddac5){return client[_0x12fc('0xb')](_0x3b2d89,_0x5e0da7)[_0x12fc('0xc')](function(_0x2c4dfc){logger[_0x12fc('0xd')](_0x12fc('0xe'),_0x719b0a,_0x12fc('0xf'));logger['debug'](_0x12fc('0x10'),_0x719b0a,_0x12fc('0xf'),JSON['stringify'](_0x2c4dfc));if(_0x2c4dfc['error']){if(_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x12')]===0x1f4){logger[_0x12fc('0x11')]('CloudProvider,\x20%s,\x20%s',_0x719b0a,_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x13')]);return _0x5ddac5(_0x2c4dfc[_0x12fc('0x11')]['message']);}logger[_0x12fc('0x11')]('CloudProvider,\x20%s,\x20%s',_0x719b0a,_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x13')]);return _0x5df479(_0x2c4dfc[_0x12fc('0x11')][_0x12fc('0x13')]);}else{logger[_0x12fc('0xd')]('CloudProvider,\x20%s,\x20%s',_0x719b0a,_0x12fc('0xf'));_0x5df479(_0x2c4dfc[_0x12fc('0x14')][_0x12fc('0x13')]);}})['catch'](function(_0x3d0fb7){logger['error'](_0x12fc('0xe'),_0x719b0a,_0x3d0fb7);_0x5ddac5(_0x3d0fb7);});});} \ No newline at end of file +var _0x8839=['client','http','request','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x259ce8,_0x798276){var _0x5ef5c2=function(_0x1bb84e){while(--_0x1bb84e){_0x259ce8['push'](_0x259ce8['shift']());}};_0x5ef5c2(++_0x798276);}(_0x8839,0x1d5));var _0x9883=function(_0x470caf,_0x3f28d5){_0x470caf=_0x470caf-0x0;var _0x3b30d4=_0x8839[_0x470caf];return _0x3b30d4;};'use strict';var _=require('lodash');var util=require(_0x9883('0x0'));var moment=require('moment');var BPromise=require(_0x9883('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9883('0x2'));var logger=require(_0x9883('0x3'))(_0x9883('0x4'));var config=require('../../config/environment');var jayson=require(_0x9883('0x5'));var client=jayson[_0x9883('0x6')][_0x9883('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x478c8e,_0x32c0cc,_0x4a995f){return new BPromise(function(_0x29e8d9,_0x5d34e1){return client[_0x9883('0x8')](_0x478c8e,_0x4a995f)['then'](function(_0x487ac0){logger[_0x9883('0x9')]('CloudProvider,\x20%s,\x20%s',_0x32c0cc,'request\x20sent');logger[_0x9883('0xa')](_0x9883('0xb'),_0x32c0cc,_0x9883('0xc'),JSON['stringify'](_0x487ac0));if(_0x487ac0[_0x9883('0xd')]){if(_0x487ac0[_0x9883('0xd')][_0x9883('0xe')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x32c0cc,_0x487ac0[_0x9883('0xd')][_0x9883('0xf')]);return _0x5d34e1(_0x487ac0[_0x9883('0xd')][_0x9883('0xf')]);}logger[_0x9883('0xd')]('CloudProvider,\x20%s,\x20%s',_0x32c0cc,_0x487ac0[_0x9883('0xd')]['message']);return _0x29e8d9(_0x487ac0[_0x9883('0xd')]['message']);}else{logger[_0x9883('0x9')](_0x9883('0x10'),_0x32c0cc,_0x9883('0xc'));_0x29e8d9(_0x487ac0[_0x9883('0x11')]['message']);}})[_0x9883('0x12')](function(_0x6a13bf){logger[_0x9883('0xd')]('CloudProvider,\x20%s,\x20%s',_0x32c0cc,_0x6a13bf);_0x5d34e1(_0x6a13bf);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c8198c2..c763fdc 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 _0xd888=['isAuthenticated','show','post','create','put','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x21c71f,_0x927cd3){var _0x3903dd=function(_0x47f8ad){while(--_0x47f8ad){_0x21c71f['push'](_0x21c71f['shift']());}};_0x3903dd(++_0x927cd3);}(_0xd888,0x198));var _0x8d88=function(_0x272d10,_0x25b188){_0x272d10=_0x272d10-0x0;var _0x5162b6=_0xd888[_0x272d10];return _0x5162b6;};'use strict';var multer=require('multer');var util=require(_0x8d88('0x0'));var path=require(_0x8d88('0x1'));var timeout=require(_0x8d88('0x2'));var express=require(_0x8d88('0x3'));var router=express[_0x8d88('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d88('0x5'));var config=require(_0x8d88('0x6'));var controller=require('./cloudProvider.controller');router[_0x8d88('0x7')]('/',auth[_0x8d88('0x8')](),controller['index']);router[_0x8d88('0x7')]('/:id',auth[_0x8d88('0x8')](),controller[_0x8d88('0x9')]);router[_0x8d88('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d88('0xb')]);router[_0x8d88('0xc')](_0x8d88('0xd'),auth[_0x8d88('0x8')](),controller['update']);router[_0x8d88('0xe')](_0x8d88('0xd'),auth[_0x8d88('0x8')](),controller['destroy']);module[_0x8d88('0xf')]=router; \ No newline at end of file +var _0x8314=['isAuthenticated','index','/:id','show','create','delete','destroy','multer','util','express','../../components/auth/service','../../config/environment','./cloudProvider.controller','get'];(function(_0x2e4733,_0x2adff9){var _0x1ebab4=function(_0x1323cb){while(--_0x1323cb){_0x2e4733['push'](_0x2e4733['shift']());}};_0x1ebab4(++_0x2adff9);}(_0x8314,0xbd));var _0x4831=function(_0x42b70c,_0x5c7579){_0x42b70c=_0x42b70c-0x0;var _0x3a1173=_0x8314[_0x42b70c];return _0x3a1173;};'use strict';var multer=require(_0x4831('0x0'));var util=require(_0x4831('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4831('0x2'));var router=express['Router']();var auth=require(_0x4831('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4831('0x4'));var controller=require(_0x4831('0x5'));router[_0x4831('0x6')]('/',auth[_0x4831('0x7')](),controller[_0x4831('0x8')]);router['get'](_0x4831('0x9'),auth[_0x4831('0x7')](),controller[_0x4831('0xa')]);router['post']('/',auth[_0x4831('0x7')](),controller[_0x4831('0xb')]);router['put'](_0x4831('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4831('0xc')](_0x4831('0x9'),auth[_0x4831('0x7')](),controller[_0x4831('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7ef643f..7b04ebe 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 _0xe1be=['sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe1be,0xab));var _0xee1b=function(_0x68ae65,_0x12cdb2){_0x68ae65=_0x68ae65-0x0;var _0x108c42=_0xe1be[_0x68ae65];return _0x108c42;};'use strict';var Sequelize=require(_0xee1b('0x0'));module[_0xee1b('0x1')]={'name':{'type':Sequelize[_0xee1b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xee1b('0x2')]},'companyId':{'type':Sequelize[_0xee1b('0x2')]},'website':{'type':Sequelize[_0xee1b('0x2')]},'phone':{'type':Sequelize[_0xee1b('0x2')]},'fax':{'type':Sequelize[_0xee1b('0x2')]},'type':{'type':Sequelize[_0xee1b('0x2')]},'street':{'type':Sequelize[_0xee1b('0x2')]},'postalCode':{'type':Sequelize[_0xee1b('0x2')]},'city':{'type':Sequelize[_0xee1b('0x2')]},'country':{'type':Sequelize[_0xee1b('0x2')]},'email':{'type':Sequelize[_0xee1b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xee1b('0x2')]},'sStreet':{'type':Sequelize[_0xee1b('0x2')]},'sPostalCode':{'type':Sequelize[_0xee1b('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xee1b('0x2')]},'description':{'type':Sequelize[_0xee1b('0x2')]}}; \ No newline at end of file +var _0xfc29=['exports','STRING','name','sequelize'];(function(_0x49d622,_0x594a0b){var _0x7c523d=function(_0x189ed4){while(--_0x189ed4){_0x49d622['push'](_0x49d622['shift']());}};_0x7c523d(++_0x594a0b);}(_0xfc29,0xbf));var _0x9fc2=function(_0x3ef8b5,_0x496a36){_0x3ef8b5=_0x3ef8b5-0x0;var _0x595f22=_0xfc29[_0x3ef8b5];return _0x595f22;};'use strict';var Sequelize=require(_0x9fc2('0x0'));module[_0x9fc2('0x1')]={'name':{'type':Sequelize[_0x9fc2('0x2')],'unique':_0x9fc2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x9fc2('0x2')]},'website':{'type':Sequelize[_0x9fc2('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9fc2('0x2')]},'type':{'type':Sequelize[_0x9fc2('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9fc2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9fc2('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9fc2('0x2')]},'sStreet':{'type':Sequelize[_0x9fc2('0x2')]},'sPostalCode':{'type':Sequelize[_0x9fc2('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x9fc2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 339fa50..37c9833 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 _0x84ff=['save','update','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','map','filter','count','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addContacts','ids','omit','getContacts','CmContact','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x84ff,0x1df));var _0xf84f=function(_0x1487fa,_0x124d57){_0x1487fa=_0x1487fa-0x0;var _0x8af541=_0x84ff[_0x1487fa];return _0x8af541;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf84f('0x0'));var rimraf=require(_0xf84f('0x1'));var zipdir=require(_0xf84f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf84f('0x3'));var moment=require(_0xf84f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf84f('0x5'));var sox=require('sox');var csv=require(_0xf84f('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf84f('0x7'));var squel=require(_0xf84f('0x8'));var crypto=require(_0xf84f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf84f('0xa'));var toCsv=require(_0xf84f('0x6'));var querystring=require(_0xf84f('0xb'));var Papa=require(_0xf84f('0xc'));var Redis=require(_0xf84f('0xd'));var authService=require(_0xf84f('0xe'));var qs=require(_0xf84f('0xf'));var as=require(_0xf84f('0x10'));var hardwareService=require(_0xf84f('0x11'));var logger=require(_0xf84f('0x12'))(_0xf84f('0x13'));var utils=require(_0xf84f('0x14'));var config=require(_0xf84f('0x15'));var db=require(_0xf84f('0x16'))['db'];function respondWithStatusCode(_0x22f790,_0x235c94){_0x235c94=_0x235c94||0xcc;return function(_0x1ba0e0){if(_0x1ba0e0){return _0x22f790[_0xf84f('0x17')](_0x235c94);}return _0x22f790['status'](_0x235c94)[_0xf84f('0x18')]();};}function respondWithResult(_0xf9ef15,_0x57beee){_0x57beee=_0x57beee||0xc8;return function(_0x235da0){if(_0x235da0){return _0xf9ef15[_0xf84f('0x19')](_0x57beee)[_0xf84f('0x1a')](_0x235da0);}};}function respondWithFilteredResult(_0x218fc0,_0x59c318){return function(_0x397f4a){if(_0x397f4a){var _0x37402a=_0x397f4a['count'],_0x823726=_0x59c318[_0xf84f('0x1b')],_0x371074=_0x59c318[_0xf84f('0x1b')]+_0x59c318['limit'],_0x13d908;if(_0x371074>=_0x37402a){_0x371074=_0x37402a;_0x13d908=0xc8;}else{_0x13d908=0xce;}_0x218fc0['status'](_0x13d908);return _0x218fc0[_0xf84f('0x1c')]('Content-Range',_0x823726+'-'+_0x371074+'/'+_0x37402a)[_0xf84f('0x1a')](_0x397f4a);}return null;};}function patchUpdates(_0x1432d5){return function(_0x7f7f6f){try{jsonpatch[_0xf84f('0x1d')](_0x7f7f6f,_0x1432d5,!![]);}catch(_0x3eab29){return BPromise[_0xf84f('0x1e')](_0x3eab29);}return _0x7f7f6f[_0xf84f('0x1f')]();};}function saveUpdates(_0x5bf6ac,_0x12b5c8){return function(_0x4511c1){if(_0x4511c1){return _0x4511c1[_0xf84f('0x20')](_0x5bf6ac)[_0xf84f('0x21')](function(_0x510119){return _0x510119;});}return null;};}function removeEntity(_0x2ee82f,_0x23461e){return function(_0x1b76e2){if(_0x1b76e2){return _0x1b76e2['destroy']()[_0xf84f('0x21')](function(){var _0x336fd3=_0x1b76e2[_0xf84f('0x22')]({'plain':!![]});var _0x161e5e=_0xf84f('0x23');return db[_0xf84f('0x24')]['destroy']({'where':{'type':_0x161e5e,'resourceId':_0x336fd3['id']}})['then'](function(){return _0x1b76e2;});})['then'](function(){_0x2ee82f[_0xf84f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ab3c,_0x2801fe){return function(_0x1717dd){if(!_0x1717dd){_0x34ab3c[_0xf84f('0x17')](0x194);}return _0x1717dd;};}function handleError(_0x5de861,_0x117285){_0x117285=_0x117285||0x1f4;return function(_0x13adf2){logger[_0xf84f('0x25')](_0x13adf2[_0xf84f('0x26')]);if(_0x13adf2[_0xf84f('0x27')]){delete _0x13adf2[_0xf84f('0x27')];}_0x5de861['status'](_0x117285)[_0xf84f('0x28')](_0x13adf2);};}exports[_0xf84f('0x29')]=function(_0x5b2380,_0x26c8cb){var _0x4e71b9={},_0x1fe35c={},_0x26ef1e={'count':0x0,'rows':[]};return db[_0xf84f('0x2a')][_0xf84f('0x2b')]()[_0xf84f('0x21')](function(_0x26cb64){_0x1fe35c[_0xf84f('0x2c')]=_[_0xf84f('0x2d')](_0x26cb64);_0x1fe35c[_0xf84f('0x2e')]=_[_0xf84f('0x2d')](_0x5b2380['query']);_0x1fe35c[_0xf84f('0x2f')]=_[_0xf84f('0x30')](_0x1fe35c[_0xf84f('0x2c')],_0x1fe35c[_0xf84f('0x2e')]);_0x4e71b9[_0xf84f('0x31')]=_['intersection'](_0x1fe35c[_0xf84f('0x2c')],qs[_0xf84f('0x32')](_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x32')]));_0x4e71b9[_0xf84f('0x31')]=_0x4e71b9[_0xf84f('0x31')][_0xf84f('0x33')]?_0x4e71b9[_0xf84f('0x31')]:_0x1fe35c[_0xf84f('0x2c')];if(!_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x34')](_0xf84f('0x35'))){_0x4e71b9['limit']=qs[_0xf84f('0x36')](_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x36')]);_0x4e71b9['offset']=qs[_0xf84f('0x1b')](_0x5b2380['query'][_0xf84f('0x1b')]);}_0x4e71b9['order']=qs['sort'](_0x5b2380[_0xf84f('0x2e')][_0xf84f('0x37')]);_0x4e71b9[_0xf84f('0x38')]=qs[_0xf84f('0x2f')](_[_0xf84f('0x39')](_0x5b2380['query'],_0x1fe35c[_0xf84f('0x2f')]),_0x26cb64);if(_0x5b2380[_0xf84f('0x2e')]['filter']){_0x4e71b9[_0xf84f('0x38')]=_[_0xf84f('0x3a')](_0x4e71b9[_0xf84f('0x38')],{'$or':_[_0xf84f('0x3b')](_0x4e71b9['attributes'],function(_0x5c8ad9){var _0x51a0a6={};_0x51a0a6[_0x5c8ad9]={'$like':'%'+_0x5b2380['query'][_0xf84f('0x3c')]+'%'};return _0x51a0a6;})});}_0x4e71b9=_['merge']({},_0x4e71b9,_0x5b2380['options']);var _0x184c6d={'where':_0x4e71b9[_0xf84f('0x38')]};return db['CmCompany'][_0xf84f('0x3d')](_0x184c6d)[_0xf84f('0x21')](function(_0x4a692e){_0x26ef1e[_0xf84f('0x3d')]=_0x4a692e;if(_0x5b2380[_0xf84f('0x2e')]['includeAll']){_0x4e71b9[_0xf84f('0x3e')]=[{'all':!![]}];}return db[_0xf84f('0x2a')][_0xf84f('0x3f')](_0x4e71b9);})[_0xf84f('0x21')](function(_0x15a0de){_0x26ef1e['rows']=_0x15a0de;return _0x26ef1e;})[_0xf84f('0x21')](respondWithFilteredResult(_0x26c8cb,_0x4e71b9))[_0xf84f('0x40')](handleError(_0x26c8cb,null));})[_0xf84f('0x40')](handleError(_0x26c8cb,null));};exports[_0xf84f('0x41')]=function(_0x485d29,_0x578841){var _0x146e7a={'raw':![],'where':{'id':_0x485d29[_0xf84f('0x42')]['id']}},_0x2926ca={};_0x2926ca[_0xf84f('0x2c')]=_[_0xf84f('0x2d')](db[_0xf84f('0x2a')][_0xf84f('0x43')]);_0x2926ca[_0xf84f('0x2e')]=_['keys'](_0x485d29[_0xf84f('0x2e')]);_0x2926ca['filters']=_['intersection'](_0x2926ca[_0xf84f('0x2c')],_0x2926ca[_0xf84f('0x2e')]);_0x146e7a['attributes']=_[_0xf84f('0x30')](_0x2926ca[_0xf84f('0x2c')],qs['fields'](_0x485d29['query'][_0xf84f('0x32')]));_0x146e7a['attributes']=_0x146e7a[_0xf84f('0x31')][_0xf84f('0x33')]?_0x146e7a[_0xf84f('0x31')]:_0x2926ca[_0xf84f('0x2c')];if(_0x485d29[_0xf84f('0x2e')][_0xf84f('0x44')]){_0x146e7a[_0xf84f('0x3e')]=[{'all':!![]}];}_0x146e7a=_[_0xf84f('0x3a')]({},_0x146e7a,_0x485d29[_0xf84f('0x45')]);return db[_0xf84f('0x2a')][_0xf84f('0x46')](_0x146e7a)[_0xf84f('0x21')](handleEntityNotFound(_0x578841,null))['then'](respondWithResult(_0x578841,null))[_0xf84f('0x40')](handleError(_0x578841,null));};exports[_0xf84f('0x47')]=function(_0x42634f,_0x4d3343){return db[_0xf84f('0x2a')]['create'](_0x42634f[_0xf84f('0x48')],{})[_0xf84f('0x21')](function(_0x105cab){var _0x3831be=_0x42634f[_0xf84f('0x49')][_0xf84f('0x22')]({'plain':!![]});if(!_0x3831be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3831be[_0xf84f('0x4a')]==='user'){var _0x6bd5a1=_0x105cab[_0xf84f('0x22')]({'plain':!![]});var _0x17eac5=_0xf84f('0x23');return db[_0xf84f('0x4b')][_0xf84f('0x46')]({'where':{'name':_0x17eac5,'userProfileId':_0x3831be[_0xf84f('0x4c')]},'raw':!![]})[_0xf84f('0x21')](function(_0x38dd35){if(_0x38dd35&&_0x38dd35[_0xf84f('0x4d')]===0x0){return db[_0xf84f('0x24')]['create']({'name':_0x6bd5a1[_0xf84f('0x27')],'resourceId':_0x6bd5a1['id'],'type':_0x38dd35['name'],'sectionId':_0x38dd35['id']},{})[_0xf84f('0x21')](function(){return _0x105cab;});}else{return _0x105cab;}})['catch'](function(_0xa486de){logger[_0xf84f('0x25')](_0xf84f('0x4e'),_0xa486de);throw _0xa486de;});}return _0x105cab;})[_0xf84f('0x21')](respondWithResult(_0x4d3343,0xc9))['catch'](handleError(_0x4d3343,null));};exports[_0xf84f('0x20')]=function(_0x265e0f,_0x16c9e9){if(_0x265e0f[_0xf84f('0x48')]['id']){delete _0x265e0f[_0xf84f('0x48')]['id'];}return db[_0xf84f('0x2a')][_0xf84f('0x46')]({'where':{'id':_0x265e0f[_0xf84f('0x42')]['id']}})[_0xf84f('0x21')](handleEntityNotFound(_0x16c9e9,null))[_0xf84f('0x21')](saveUpdates(_0x265e0f[_0xf84f('0x48')],null))[_0xf84f('0x21')](respondWithResult(_0x16c9e9,null))[_0xf84f('0x40')](handleError(_0x16c9e9,null));};exports[_0xf84f('0x4f')]=function(_0x12a5a7,_0x2fc38b){return db[_0xf84f('0x2a')][_0xf84f('0x46')]({'where':{'id':_0x12a5a7[_0xf84f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fc38b,null))['then'](removeEntity(_0x2fc38b,null))[_0xf84f('0x40')](handleError(_0x2fc38b,null));};exports[_0xf84f('0x2b')]=function(_0x328515,_0x36950a){return db[_0xf84f('0x2a')][_0xf84f('0x2b')]()[_0xf84f('0x21')](respondWithResult(_0x36950a,null))['catch'](handleError(_0x36950a,null));};exports[_0xf84f('0x50')]=function(_0x3917c9,_0x110029,_0x567e7f){return db['CmContact'][_0xf84f('0x46')]({'where':{'id':_0x3917c9[_0xf84f('0x42')]['id']}})[_0xf84f('0x21')](handleEntityNotFound(_0x110029,null))[_0xf84f('0x21')](function(_0x52e13f){if(_0x52e13f){return _0x52e13f['addContacts'](_0x3917c9['body'][_0xf84f('0x51')],_[_0xf84f('0x52')](_0x3917c9['body'],[_0xf84f('0x51'),'id'])||{});}})[_0xf84f('0x21')](respondWithResult(_0x110029,null))['catch'](handleError(_0x110029,null));};exports[_0xf84f('0x53')]=function(_0x505e80,_0x279596,_0x451d6a){var _0x2f7272={};var _0x424372={};var _0x55aaf0;var _0xc72fde;return db[_0xf84f('0x2a')]['findOne']({'where':{'id':_0x505e80['params']['id']}})[_0xf84f('0x21')](handleEntityNotFound(_0x279596,null))[_0xf84f('0x21')](function(_0x143a73){if(_0x143a73){_0x55aaf0=_0x143a73;_0x424372['model']=_[_0xf84f('0x2d')](db[_0xf84f('0x54')]['rawAttributes']);_0x424372['query']=_[_0xf84f('0x2d')](_0x505e80['query']);_0x424372[_0xf84f('0x2f')]=_[_0xf84f('0x30')](_0x424372[_0xf84f('0x2c')],_0x424372[_0xf84f('0x2e')]);_0x2f7272['attributes']=_[_0xf84f('0x30')](_0x424372[_0xf84f('0x2c')],qs['fields'](_0x505e80[_0xf84f('0x2e')][_0xf84f('0x32')]));_0x2f7272['attributes']=_0x2f7272['attributes'][_0xf84f('0x33')]?_0x2f7272[_0xf84f('0x31')]:_0x424372[_0xf84f('0x2c')];_0x2f7272['order']=qs[_0xf84f('0x37')](_0x505e80[_0xf84f('0x2e')]['sort']);_0x2f7272[_0xf84f('0x38')]=qs[_0xf84f('0x2f')](_[_0xf84f('0x39')](_0x505e80[_0xf84f('0x2e')],_0x424372[_0xf84f('0x2f')]));if(_0x505e80[_0xf84f('0x2e')][_0xf84f('0x3c')]){_0x2f7272[_0xf84f('0x38')]=_[_0xf84f('0x3a')](_0x2f7272[_0xf84f('0x38')],{'$or':_[_0xf84f('0x3b')](_0x2f7272['attributes'],function(_0x424a21){var _0x3bf31e={};_0x3bf31e[_0x424a21]={'$like':'%'+_0x505e80[_0xf84f('0x2e')][_0xf84f('0x3c')]+'%'};return _0x3bf31e;})});}_0x2f7272=_['merge']({},_0x2f7272,_0x505e80[_0xf84f('0x45')]);return _0x55aaf0['getContacts'](_0x2f7272);}})[_0xf84f('0x21')](function(_0x36c108){if(_0x36c108){_0xc72fde=_0x36c108['length'];if(!_0x505e80[_0xf84f('0x2e')][_0xf84f('0x34')](_0xf84f('0x35'))){_0x2f7272['limit']=qs[_0xf84f('0x36')](_0x505e80[_0xf84f('0x2e')][_0xf84f('0x36')]);_0x2f7272['offset']=qs[_0xf84f('0x1b')](_0x505e80[_0xf84f('0x2e')][_0xf84f('0x1b')]);}return _0x55aaf0[_0xf84f('0x53')](_0x2f7272);}})['then'](function(_0x49a98f){if(_0x49a98f){return _0x49a98f?{'count':_0xc72fde,'rows':_0x49a98f}:null;}})[_0xf84f('0x21')](respondWithResult(_0x279596,null))[_0xf84f('0x40')](handleError(_0x279596,null));}; \ No newline at end of file +var _0xb9d1=['json','count','offset','set','Content-Range','reject','save','then','get','Companies','UserProfileResource','sendStatus','error','name','send','index','CmCompany','describe','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addContacts','CmContact','ids','omit','getContacts','findOne','length','options','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x56e4c4,_0x18da67){var _0x1136d1=function(_0x3f7bbe){while(--_0x3f7bbe){_0x56e4c4['push'](_0x56e4c4['shift']());}};_0x1136d1(++_0x18da67);}(_0xb9d1,0xea));var _0x1b9d=function(_0x5991fc,_0x24a425){_0x5991fc=_0x5991fc-0x0;var _0x2c4646=_0xb9d1[_0x5991fc];return _0x2c4646;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b9d('0x0'));var rimraf=require(_0x1b9d('0x1'));var zipdir=require(_0x1b9d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b9d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b9d('0x4'));var util=require(_0x1b9d('0x5'));var path=require('path');var sox=require(_0x1b9d('0x6'));var csv=require(_0x1b9d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b9d('0x8'));var squel=require(_0x1b9d('0x9'));var crypto=require(_0x1b9d('0xa'));var jsforce=require(_0x1b9d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1b9d('0x7'));var querystring=require(_0x1b9d('0xc'));var Papa=require(_0x1b9d('0xd'));var Redis=require(_0x1b9d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1b9d('0xf'));var as=require(_0x1b9d('0x10'));var hardwareService=require(_0x1b9d('0x11'));var logger=require('../../config/logger')(_0x1b9d('0x12'));var utils=require(_0x1b9d('0x13'));var config=require(_0x1b9d('0x14'));var db=require(_0x1b9d('0x15'))['db'];function respondWithStatusCode(_0x2a3f73,_0x57eebe){_0x57eebe=_0x57eebe||0xcc;return function(_0x51b221){if(_0x51b221){return _0x2a3f73['sendStatus'](_0x57eebe);}return _0x2a3f73[_0x1b9d('0x16')](_0x57eebe)[_0x1b9d('0x17')]();};}function respondWithResult(_0x43bd6e,_0x53279b){_0x53279b=_0x53279b||0xc8;return function(_0x336ff6){if(_0x336ff6){return _0x43bd6e[_0x1b9d('0x16')](_0x53279b)[_0x1b9d('0x18')](_0x336ff6);}};}function respondWithFilteredResult(_0x547a87,_0x50738b){return function(_0x57bc57){if(_0x57bc57){var _0x50f9b4=_0x57bc57[_0x1b9d('0x19')],_0x20ce5e=_0x50738b[_0x1b9d('0x1a')],_0x46cf15=_0x50738b[_0x1b9d('0x1a')]+_0x50738b['limit'],_0x100fa3;if(_0x46cf15>=_0x50f9b4){_0x46cf15=_0x50f9b4;_0x100fa3=0xc8;}else{_0x100fa3=0xce;}_0x547a87['status'](_0x100fa3);return _0x547a87[_0x1b9d('0x1b')](_0x1b9d('0x1c'),_0x20ce5e+'-'+_0x46cf15+'/'+_0x50f9b4)['json'](_0x57bc57);}return null;};}function patchUpdates(_0x3c6d3a){return function(_0x3712c6){try{jsonpatch['apply'](_0x3712c6,_0x3c6d3a,!![]);}catch(_0x9b137d){return BPromise[_0x1b9d('0x1d')](_0x9b137d);}return _0x3712c6[_0x1b9d('0x1e')]();};}function saveUpdates(_0x2c7587,_0x2940a0){return function(_0x42ed0b){if(_0x42ed0b){return _0x42ed0b['update'](_0x2c7587)[_0x1b9d('0x1f')](function(_0x45660b){return _0x45660b;});}return null;};}function removeEntity(_0x52e8a2,_0x1fe7ff){return function(_0x2e5d20){if(_0x2e5d20){return _0x2e5d20['destroy']()[_0x1b9d('0x1f')](function(){var _0x21bddf=_0x2e5d20[_0x1b9d('0x20')]({'plain':!![]});var _0x46d89c=_0x1b9d('0x21');return db[_0x1b9d('0x22')]['destroy']({'where':{'type':_0x46d89c,'resourceId':_0x21bddf['id']}})[_0x1b9d('0x1f')](function(){return _0x2e5d20;});})[_0x1b9d('0x1f')](function(){_0x52e8a2[_0x1b9d('0x16')](0xcc)[_0x1b9d('0x17')]();});}};}function handleEntityNotFound(_0x14cbf7,_0x3b0b9e){return function(_0x409af7){if(!_0x409af7){_0x14cbf7[_0x1b9d('0x23')](0x194);}return _0x409af7;};}function handleError(_0xa400c8,_0x17d0c0){_0x17d0c0=_0x17d0c0||0x1f4;return function(_0x3d989c){logger[_0x1b9d('0x24')](_0x3d989c['stack']);if(_0x3d989c['name']){delete _0x3d989c[_0x1b9d('0x25')];}_0xa400c8[_0x1b9d('0x16')](_0x17d0c0)[_0x1b9d('0x26')](_0x3d989c);};}exports[_0x1b9d('0x27')]=function(_0x560848,_0xf7452e){var _0xff36ad={},_0x15108d={},_0x328683={'count':0x0,'rows':[]};return db[_0x1b9d('0x28')][_0x1b9d('0x29')]()[_0x1b9d('0x1f')](function(_0x177a03){_0x15108d[_0x1b9d('0x2a')]=_[_0x1b9d('0x2b')](_0x177a03);_0x15108d[_0x1b9d('0x2c')]=_[_0x1b9d('0x2b')](_0x560848[_0x1b9d('0x2c')]);_0x15108d['filters']=_[_0x1b9d('0x2d')](_0x15108d[_0x1b9d('0x2a')],_0x15108d[_0x1b9d('0x2c')]);_0xff36ad['attributes']=_[_0x1b9d('0x2d')](_0x15108d[_0x1b9d('0x2a')],qs[_0x1b9d('0x2e')](_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x2e')]));_0xff36ad['attributes']=_0xff36ad[_0x1b9d('0x2f')]['length']?_0xff36ad[_0x1b9d('0x2f')]:_0x15108d[_0x1b9d('0x2a')];if(!_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x30')](_0x1b9d('0x31'))){_0xff36ad[_0x1b9d('0x32')]=qs[_0x1b9d('0x32')](_0x560848['query'][_0x1b9d('0x32')]);_0xff36ad[_0x1b9d('0x1a')]=qs[_0x1b9d('0x1a')](_0x560848['query'][_0x1b9d('0x1a')]);}_0xff36ad[_0x1b9d('0x33')]=qs[_0x1b9d('0x34')](_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x34')]);_0xff36ad[_0x1b9d('0x35')]=qs[_0x1b9d('0x36')](_[_0x1b9d('0x37')](_0x560848['query'],_0x15108d[_0x1b9d('0x36')]),_0x177a03);if(_0x560848[_0x1b9d('0x2c')]['filter']){_0xff36ad[_0x1b9d('0x35')]=_[_0x1b9d('0x38')](_0xff36ad[_0x1b9d('0x35')],{'$or':_[_0x1b9d('0x39')](_0xff36ad[_0x1b9d('0x2f')],function(_0x5837c0){var _0x8b7451={};_0x8b7451[_0x5837c0]={'$like':'%'+_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x3a')]+'%'};return _0x8b7451;})});}_0xff36ad=_[_0x1b9d('0x38')]({},_0xff36ad,_0x560848['options']);var _0x4fb9ea={'where':_0xff36ad[_0x1b9d('0x35')]};return db['CmCompany'][_0x1b9d('0x19')](_0x4fb9ea)[_0x1b9d('0x1f')](function(_0x55c9f8){_0x328683['count']=_0x55c9f8;if(_0x560848[_0x1b9d('0x2c')][_0x1b9d('0x3b')]){_0xff36ad[_0x1b9d('0x3c')]=[{'all':!![]}];}return db[_0x1b9d('0x28')][_0x1b9d('0x3d')](_0xff36ad);})['then'](function(_0xfb3736){_0x328683[_0x1b9d('0x3e')]=_0xfb3736;return _0x328683;})[_0x1b9d('0x1f')](respondWithFilteredResult(_0xf7452e,_0xff36ad))[_0x1b9d('0x3f')](handleError(_0xf7452e,null));})[_0x1b9d('0x3f')](handleError(_0xf7452e,null));};exports[_0x1b9d('0x40')]=function(_0x46d32c,_0xa6fc5){var _0xec7013={'raw':![],'where':{'id':_0x46d32c[_0x1b9d('0x41')]['id']}},_0x343470={};_0x343470['model']=_['keys'](db[_0x1b9d('0x28')][_0x1b9d('0x42')]);_0x343470[_0x1b9d('0x2c')]=_[_0x1b9d('0x2b')](_0x46d32c[_0x1b9d('0x2c')]);_0x343470[_0x1b9d('0x36')]=_[_0x1b9d('0x2d')](_0x343470[_0x1b9d('0x2a')],_0x343470['query']);_0xec7013[_0x1b9d('0x2f')]=_['intersection'](_0x343470[_0x1b9d('0x2a')],qs[_0x1b9d('0x2e')](_0x46d32c[_0x1b9d('0x2c')][_0x1b9d('0x2e')]));_0xec7013['attributes']=_0xec7013[_0x1b9d('0x2f')]['length']?_0xec7013[_0x1b9d('0x2f')]:_0x343470[_0x1b9d('0x2a')];if(_0x46d32c['query'][_0x1b9d('0x3b')]){_0xec7013['include']=[{'all':!![]}];}_0xec7013=_[_0x1b9d('0x38')]({},_0xec7013,_0x46d32c['options']);return db['CmCompany'][_0x1b9d('0x43')](_0xec7013)['then'](handleEntityNotFound(_0xa6fc5,null))['then'](respondWithResult(_0xa6fc5,null))[_0x1b9d('0x3f')](handleError(_0xa6fc5,null));};exports['create']=function(_0x1743b8,_0xeee9eb){return db[_0x1b9d('0x28')][_0x1b9d('0x44')](_0x1743b8[_0x1b9d('0x45')],{})[_0x1b9d('0x1f')](function(_0x40de83){var _0x3b5b49=_0x1743b8[_0x1b9d('0x46')][_0x1b9d('0x20')]({'plain':!![]});if(!_0x3b5b49)throw new Error(_0x1b9d('0x47'));if(_0x3b5b49[_0x1b9d('0x48')]===_0x1b9d('0x46')){var _0x5226a0=_0x40de83['get']({'plain':!![]});var _0x3a784f=_0x1b9d('0x21');return db[_0x1b9d('0x49')][_0x1b9d('0x43')]({'where':{'name':_0x3a784f,'userProfileId':_0x3b5b49['userProfileId']},'raw':!![]})[_0x1b9d('0x1f')](function(_0x4f92b8){if(_0x4f92b8&&_0x4f92b8[_0x1b9d('0x4a')]===0x0){return db[_0x1b9d('0x22')][_0x1b9d('0x44')]({'name':_0x5226a0[_0x1b9d('0x25')],'resourceId':_0x5226a0['id'],'type':_0x4f92b8[_0x1b9d('0x25')],'sectionId':_0x4f92b8['id']},{})[_0x1b9d('0x1f')](function(){return _0x40de83;});}else{return _0x40de83;}})['catch'](function(_0x4833b3){logger[_0x1b9d('0x24')](_0x1b9d('0x4b'),_0x4833b3);throw _0x4833b3;});}return _0x40de83;})[_0x1b9d('0x1f')](respondWithResult(_0xeee9eb,0xc9))[_0x1b9d('0x3f')](handleError(_0xeee9eb,null));};exports[_0x1b9d('0x4c')]=function(_0x2d6f0f,_0x3ae85d){if(_0x2d6f0f[_0x1b9d('0x45')]['id']){delete _0x2d6f0f[_0x1b9d('0x45')]['id'];}return db[_0x1b9d('0x28')][_0x1b9d('0x43')]({'where':{'id':_0x2d6f0f['params']['id']}})[_0x1b9d('0x1f')](handleEntityNotFound(_0x3ae85d,null))[_0x1b9d('0x1f')](saveUpdates(_0x2d6f0f[_0x1b9d('0x45')],null))[_0x1b9d('0x1f')](respondWithResult(_0x3ae85d,null))[_0x1b9d('0x3f')](handleError(_0x3ae85d,null));};exports[_0x1b9d('0x4d')]=function(_0x520f99,_0x550248){return db[_0x1b9d('0x28')]['find']({'where':{'id':_0x520f99[_0x1b9d('0x41')]['id']}})[_0x1b9d('0x1f')](handleEntityNotFound(_0x550248,null))[_0x1b9d('0x1f')](removeEntity(_0x550248,null))[_0x1b9d('0x3f')](handleError(_0x550248,null));};exports['describe']=function(_0xfdf7cd,_0x10147c){return db[_0x1b9d('0x28')][_0x1b9d('0x29')]()[_0x1b9d('0x1f')](respondWithResult(_0x10147c,null))[_0x1b9d('0x3f')](handleError(_0x10147c,null));};exports[_0x1b9d('0x4e')]=function(_0x528ad8,_0x9f41f1,_0x1fc3a9){return db[_0x1b9d('0x4f')][_0x1b9d('0x43')]({'where':{'id':_0x528ad8[_0x1b9d('0x41')]['id']}})['then'](handleEntityNotFound(_0x9f41f1,null))['then'](function(_0x22df1f){if(_0x22df1f){return _0x22df1f[_0x1b9d('0x4e')](_0x528ad8[_0x1b9d('0x45')][_0x1b9d('0x50')],_[_0x1b9d('0x51')](_0x528ad8[_0x1b9d('0x45')],['ids','id'])||{});}})[_0x1b9d('0x1f')](respondWithResult(_0x9f41f1,null))[_0x1b9d('0x3f')](handleError(_0x9f41f1,null));};exports[_0x1b9d('0x52')]=function(_0x48014e,_0x4d353f,_0x294ea3){var _0x3c3fcf={};var _0x24adec={};var _0x1d3f3a;var _0x32dd11;return db[_0x1b9d('0x28')][_0x1b9d('0x53')]({'where':{'id':_0x48014e['params']['id']}})[_0x1b9d('0x1f')](handleEntityNotFound(_0x4d353f,null))[_0x1b9d('0x1f')](function(_0x28c91c){if(_0x28c91c){_0x1d3f3a=_0x28c91c;_0x24adec[_0x1b9d('0x2a')]=_['keys'](db['CmContact'][_0x1b9d('0x42')]);_0x24adec[_0x1b9d('0x2c')]=_['keys'](_0x48014e[_0x1b9d('0x2c')]);_0x24adec[_0x1b9d('0x36')]=_[_0x1b9d('0x2d')](_0x24adec[_0x1b9d('0x2a')],_0x24adec[_0x1b9d('0x2c')]);_0x3c3fcf[_0x1b9d('0x2f')]=_[_0x1b9d('0x2d')](_0x24adec[_0x1b9d('0x2a')],qs['fields'](_0x48014e[_0x1b9d('0x2c')]['fields']));_0x3c3fcf['attributes']=_0x3c3fcf[_0x1b9d('0x2f')][_0x1b9d('0x54')]?_0x3c3fcf[_0x1b9d('0x2f')]:_0x24adec[_0x1b9d('0x2a')];_0x3c3fcf[_0x1b9d('0x33')]=qs[_0x1b9d('0x34')](_0x48014e[_0x1b9d('0x2c')][_0x1b9d('0x34')]);_0x3c3fcf[_0x1b9d('0x35')]=qs['filters'](_[_0x1b9d('0x37')](_0x48014e['query'],_0x24adec['filters']));if(_0x48014e[_0x1b9d('0x2c')][_0x1b9d('0x3a')]){_0x3c3fcf[_0x1b9d('0x35')]=_['merge'](_0x3c3fcf[_0x1b9d('0x35')],{'$or':_[_0x1b9d('0x39')](_0x3c3fcf[_0x1b9d('0x2f')],function(_0x4cc4dc){var _0x3ba64c={};_0x3ba64c[_0x4cc4dc]={'$like':'%'+_0x48014e['query'][_0x1b9d('0x3a')]+'%'};return _0x3ba64c;})});}_0x3c3fcf=_[_0x1b9d('0x38')]({},_0x3c3fcf,_0x48014e[_0x1b9d('0x55')]);return _0x1d3f3a[_0x1b9d('0x52')](_0x3c3fcf);}})[_0x1b9d('0x1f')](function(_0x334e1e){if(_0x334e1e){_0x32dd11=_0x334e1e[_0x1b9d('0x54')];if(!_0x48014e[_0x1b9d('0x2c')]['hasOwnProperty'](_0x1b9d('0x31'))){_0x3c3fcf[_0x1b9d('0x32')]=qs[_0x1b9d('0x32')](_0x48014e[_0x1b9d('0x2c')][_0x1b9d('0x32')]);_0x3c3fcf[_0x1b9d('0x1a')]=qs['offset'](_0x48014e['query'][_0x1b9d('0x1a')]);}return _0x1d3f3a[_0x1b9d('0x52')](_0x3c3fcf);}})[_0x1b9d('0x1f')](function(_0x5601da){if(_0x5601da){return _0x5601da?{'count':_0x32dd11,'rows':_0x5601da}:null;}})['then'](respondWithResult(_0x4d353f,null))[_0x1b9d('0x3f')](handleError(_0x4d353f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 50c1407..1ef11cf 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 _0x4b85=['path','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','api','moment'];(function(_0x5d77f6,_0x55c6dc){var _0x4d97d9=function(_0x2cd9ca){while(--_0x2cd9ca){_0x5d77f6['push'](_0x5d77f6['shift']());}};_0x4d97d9(++_0x55c6dc);}(_0x4b85,0x92));var _0x54b8=function(_0x2efc77,_0x3bf951){_0x2efc77=_0x2efc77-0x0;var _0x724beb=_0x4b85[_0x2efc77];return _0x724beb;};'use strict';var _=require(_0x54b8('0x0'));var util=require(_0x54b8('0x1'));var logger=require('../../config/logger')(_0x54b8('0x2'));var moment=require(_0x54b8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x54b8('0x4'));var rimraf=require('rimraf');var config=require(_0x54b8('0x5'));var attributes=require('./cmCompany.attributes');module[_0x54b8('0x6')]=function(_0xaaa5a3,_0x1720ab){return _0xaaa5a3[_0x54b8('0x7')](_0x54b8('0x8'),attributes,{'tableName':_0x54b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ef5=['../../config/logger','api','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','util'];(function(_0x466cc2,_0x5abbb0){var _0x2da337=function(_0x45a434){while(--_0x45a434){_0x466cc2['push'](_0x466cc2['shift']());}};_0x2da337(++_0x5abbb0);}(_0x6ef5,0x121));var _0x56ef=function(_0x57750c,_0x5e74b1){_0x57750c=_0x57750c-0x0;var _0x1ea9be=_0x6ef5[_0x57750c];return _0x1ea9be;};'use strict';var _=require('lodash');var util=require(_0x56ef('0x0'));var logger=require(_0x56ef('0x1'))(_0x56ef('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56ef('0x4'));var config=require(_0x56ef('0x5'));var attributes=require(_0x56ef('0x6'));module[_0x56ef('0x7')]=function(_0x5d6c1b,_0x24c31b){return _0x5d6c1b['define'](_0x56ef('0x8'),attributes,{'tableName':_0x56ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 60f744e..5bdd747 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 _0x77d1=['jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x77d1,0xe8));var _0x177d=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x77d1[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x177d('0x0'));var util=require(_0x177d('0x1'));var moment=require(_0x177d('0x2'));var BPromise=require(_0x177d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x177d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x177d('0x5'))(_0x177d('0x6'));var config=require(_0x177d('0x7'));var jayson=require(_0x177d('0x8'));var client=jayson['client'][_0x177d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc0c3c2,_0x5196e8,_0x5d84f7){return new BPromise(function(_0x482d0b,_0xd011ac){return client[_0x177d('0xa')](_0xc0c3c2,_0x5d84f7)[_0x177d('0xb')](function(_0x4b026c){logger[_0x177d('0xc')](_0x177d('0xd'),_0x5196e8,_0x177d('0xe'));logger[_0x177d('0xf')](_0x177d('0x10'),_0x5196e8,_0x177d('0xe'),JSON['stringify'](_0x4b026c));if(_0x4b026c[_0x177d('0x11')]){if(_0x4b026c[_0x177d('0x11')]['code']===0x1f4){logger['error'](_0x177d('0xd'),_0x5196e8,_0x4b026c[_0x177d('0x11')][_0x177d('0x12')]);return _0xd011ac(_0x4b026c[_0x177d('0x11')][_0x177d('0x12')]);}logger[_0x177d('0x11')]('CmCompany,\x20%s,\x20%s',_0x5196e8,_0x4b026c[_0x177d('0x11')]['message']);return _0x482d0b(_0x4b026c['error'][_0x177d('0x12')]);}else{logger[_0x177d('0xc')]('CmCompany,\x20%s,\x20%s',_0x5196e8,'request\x20sent');_0x482d0b(_0x4b026c['result'][_0x177d('0x12')]);}})[_0x177d('0x13')](function(_0x168c1c){logger[_0x177d('0x11')]('CmCompany,\x20%s,\x20%s',_0x5196e8,_0x168c1c);_0xd011ac(_0x168c1c);});});} \ No newline at end of file +var _0x5779=['code','CmCompany,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','error'];(function(_0x107836,_0x255ebc){var _0x6946d2=function(_0x220ab6){while(--_0x220ab6){_0x107836['push'](_0x107836['shift']());}};_0x6946d2(++_0x255ebc);}(_0x5779,0x1cf));var _0x9577=function(_0x309606,_0x49545b){_0x309606=_0x309606-0x0;var _0x41dc3b=_0x5779[_0x309606];return _0x41dc3b;};'use strict';var _=require(_0x9577('0x0'));var util=require(_0x9577('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9577('0x2'));var fs=require('fs');var Redis=require(_0x9577('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9577('0x4'));var logger=require('../../config/logger')(_0x9577('0x5'));var config=require(_0x9577('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9577('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ac17c,_0x552d54,_0x3395c7){return new BPromise(function(_0x35eee8,_0x3c251a){return client[_0x9577('0x8')](_0x1ac17c,_0x3395c7)[_0x9577('0x9')](function(_0x61e621){logger['info']('CmCompany,\x20%s,\x20%s',_0x552d54,_0x9577('0xa'));logger[_0x9577('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x552d54,_0x9577('0xa'),JSON['stringify'](_0x61e621));if(_0x61e621['error']){if(_0x61e621[_0x9577('0xc')][_0x9577('0xd')]===0x1f4){logger[_0x9577('0xc')](_0x9577('0xe'),_0x552d54,_0x61e621[_0x9577('0xc')][_0x9577('0xf')]);return _0x3c251a(_0x61e621[_0x9577('0xc')][_0x9577('0xf')]);}logger['error'](_0x9577('0xe'),_0x552d54,_0x61e621[_0x9577('0xc')][_0x9577('0xf')]);return _0x35eee8(_0x61e621['error']['message']);}else{logger[_0x9577('0x10')](_0x9577('0xe'),_0x552d54,_0x9577('0xa'));_0x35eee8(_0x61e621['result']['message']);}})['catch'](function(_0x19f4d0){logger['error'](_0x9577('0xe'),_0x552d54,_0x19f4d0);_0x3c251a(_0x19f4d0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d9ca445..573d1e2 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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','addContacts','put','update','destroy','exports','path','connect-timeout'];(function(_0x2a0c36,_0x3491c2){var _0x291001=function(_0x10b002){while(--_0x10b002){_0x2a0c36['push'](_0x2a0c36['shift']());}};_0x291001(++_0x3491c2);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','create','addContacts','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4bbf30,_0x4ed295){var _0x1aeae8=function(_0x5a46ca){while(--_0x5a46ca){_0x4bbf30['push'](_0x4bbf30['shift']());}};_0x1aeae8(++_0x4ed295);}(_0x008c,0x188));var _0xc008=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0x008c[_0x28ac84];return _0x10c42a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0xf'),auth[_0xc008('0xa')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x13')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ae26528..2faa83f 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 _0x7184=['INTEGER','DATE','NOW','lodash','sequelize','STRING'];(function(_0x5d4db4,_0x233574){var _0x25b0c0=function(_0x106574){while(--_0x106574){_0x5d4db4['push'](_0x5d4db4['shift']());}};_0x25b0c0(++_0x233574);}(_0x7184,0xd5));var _0x4718=function(_0xdb628e,_0x103e9a){_0xdb628e=_0xdb628e-0x0;var _0x493aa5=_0x7184[_0xdb628e];return _0x493aa5;};'use strict';var _=require(_0x4718('0x0'));var Sequelize=require(_0x4718('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x4718('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4718('0x2')]},'postalCode':{'type':Sequelize[_0x4718('0x2')]},'city':{'type':Sequelize[_0x4718('0x2')]},'country':{'type':Sequelize[_0x4718('0x2')]},'dateOfBirth':{'type':Sequelize[_0x4718('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x4718('0x2')]},'mobile':{'type':Sequelize[_0x4718('0x2')]},'fax':{'type':Sequelize[_0x4718('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x4718('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x4718('0x2')]},'twitter':{'type':Sequelize[_0x4718('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4718('0x2')]},'viber':{'type':Sequelize[_0x4718('0x2')]},'line':{'type':Sequelize[_0x4718('0x2')]},'wechat':{'type':Sequelize[_0x4718('0x2')]},'telegram':{'type':Sequelize[_0x4718('0x2')]},'UserId':{'type':Sequelize[_0x4718('0x3')]},'priority':{'type':Sequelize[_0x4718('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4718('0x4')],'defaultValue':Sequelize[_0x4718('0x5')]},'dialTimezone':{'type':Sequelize[_0x4718('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5a9e=['STRING','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5a9e,0x15b));var _0xe5a9=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x5a9e[_0x4d8789];return _0x404e41;};'use strict';var _=require(_0xe5a9('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xe5a9('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe5a9('0x1')]},'street':{'type':Sequelize[_0xe5a9('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe5a9('0x1')]},'country':{'type':Sequelize[_0xe5a9('0x1')]},'dateOfBirth':{'type':Sequelize[_0xe5a9('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xe5a9('0x1')]},'mobile':{'type':Sequelize[_0xe5a9('0x1')]},'fax':{'type':Sequelize[_0xe5a9('0x1')]},'email':{'type':Sequelize[_0xe5a9('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xe5a9('0x1')]},'fb_data':{'type':Sequelize[_0xe5a9('0x1')]},'twitter':{'type':Sequelize[_0xe5a9('0x1')]},'skype':{'type':Sequelize[_0xe5a9('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe5a9('0x1')]},'telegram':{'type':Sequelize[_0xe5a9('0x1')]},'UserId':{'type':Sequelize[_0xe5a9('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xe5a9('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe5a9('0x4')],'defaultValue':Sequelize[_0xe5a9('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xe5a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7fd7fbb..e5fa9ab 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 _0x7c10=['getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','chmodSync','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','upload','path','parse','meta','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','CmContact','describe','then','keys','startsWith','cf_','push','CmCustomField','findOne','all','length','fieldType','query','filters','model','attributes','fields','hasOwnProperty','limit','order','sort','pick','select','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','datetime','type','text','start','end','filter','Contact','isEmpty','ListId','where','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','SELECT','clone','DESC','having','t.id\x20IN\x20?','some','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','params','tags','columnName','displayName','body','findAll','get','mergeWith','isArray','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','duplicates','$or','spread','error','show','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','phone','getTags','rawAttributes','intersection','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','rows','include','getHopperFinals'];(function(_0x2f8619,_0x37b95f){var _0x75cef8=function(_0x3003c5){while(--_0x3003c5){_0x2f8619['push'](_0x2f8619['shift']());}};_0x75cef8(++_0x37b95f);}(_0x7c10,0x10a));var _0x07c1=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7c10[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require(_0x07c1('0x0'));var emlformat=require(_0x07c1('0x1'));var rimraf=require(_0x07c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07c1('0x3'));var rp=require(_0x07c1('0x4'));var moment=require('moment');var BPromise=require(_0x07c1('0x5'));var Mustache=require(_0x07c1('0x6'));var util=require(_0x07c1('0x7'));var path=require('path');var sox=require(_0x07c1('0x8'));var csv=require(_0x07c1('0x9'));var ejs=require(_0x07c1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x07c1('0xb'));var crypto=require(_0x07c1('0xc'));var jsforce=require(_0x07c1('0xd'));var deskjs=require(_0x07c1('0xe'));var toCsv=require(_0x07c1('0x9'));var querystring=require('querystring');var Papa=require(_0x07c1('0xf'));var Redis=require(_0x07c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07c1('0x11'));var as=require(_0x07c1('0x12'));var hardwareService=require(_0x07c1('0x13'));var logger=require('../../config/logger')(_0x07c1('0x14'));var utils=require(_0x07c1('0x15'));var config=require(_0x07c1('0x16'));var db=require(_0x07c1('0x17'))['db'];config[_0x07c1('0x18')]=_[_0x07c1('0x19')](config[_0x07c1('0x18')],{'host':_0x07c1('0x1a'),'port':0x18eb});var socket=require(_0x07c1('0x1b'))(new Redis(config[_0x07c1('0x18')]));require('./cmContact.socket')[_0x07c1('0x1c')](socket);function respondWithStatusCode(_0x44ff2e,_0x846eff){_0x846eff=_0x846eff||0xcc;return function(_0x1c884c){if(_0x1c884c){return _0x44ff2e['sendStatus'](_0x846eff);}return _0x44ff2e[_0x07c1('0x1d')](_0x846eff)['end']();};}function respondWithResult(_0xc1cf30,_0x59ea48){_0x59ea48=_0x59ea48||0xc8;return function(_0x56c62a){if(_0x56c62a){return _0xc1cf30['status'](_0x59ea48)[_0x07c1('0x1e')](_0x56c62a);}};}function respondWithFilteredResult(_0x321802,_0x363a54){return function(_0x58e121){if(_0x58e121){var _0x3eff1c=_0x58e121[_0x07c1('0x1f')],_0x4f0313=_0x363a54[_0x07c1('0x20')],_0x37bd4f=_0x363a54[_0x07c1('0x20')]+_0x363a54['limit'],_0x380d93;if(_0x37bd4f>=_0x3eff1c){_0x37bd4f=_0x3eff1c;_0x380d93=0xc8;}else{_0x380d93=0xce;}_0x321802['status'](_0x380d93);return _0x321802[_0x07c1('0x21')](_0x07c1('0x22'),_0x4f0313+'-'+_0x37bd4f+'/'+_0x3eff1c)[_0x07c1('0x1e')](_0x58e121);}return null;};}function patchUpdates(_0x454ef4){return function(_0x20d22e){try{jsonpatch['apply'](_0x20d22e,_0x454ef4,!![]);}catch(_0x5a80b1){return BPromise[_0x07c1('0x23')](_0x5a80b1);}return _0x20d22e[_0x07c1('0x24')]();};}function saveUpdates(_0x1633bc,_0x19f3a5){return function(_0xcb0425){if(_0xcb0425){return _0xcb0425[_0x07c1('0x25')](_0x1633bc)['then'](function(_0x4f71c5){return _0x4f71c5;});}return null;};}function removeEntity(_0x312575,_0x15c276){return function(_0x23dd31){if(_0x23dd31){return _0x23dd31[_0x07c1('0x26')]()['then'](function(){_0x312575[_0x07c1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20ee08,_0xcb4d6c){return function(_0x3b5cab){if(!_0x3b5cab){_0x20ee08[_0x07c1('0x27')](0x194);}return _0x3b5cab;};}function handleError(_0x2ef1d0,_0x8e8a60){_0x8e8a60=_0x8e8a60||0x1f4;return function(_0x65b039){logger['error'](_0x65b039[_0x07c1('0x28')]);if(_0x65b039[_0x07c1('0x29')]){delete _0x65b039[_0x07c1('0x29')];}_0x2ef1d0[_0x07c1('0x1d')](_0x8e8a60)[_0x07c1('0x2a')](_0x65b039);};}exports[_0x07c1('0x2b')]=function(_0x5f279f,_0x3f8977){var _0x438cef={},_0x4e7f93={},_0x16939={'count':0x0,'rows':[]};return db[_0x07c1('0x2c')][_0x07c1('0x2d')]()[_0x07c1('0x2e')](function(_0x402c7e){var _0x2a3237=[];for(var _0x1c75d6=0x0;_0x1c75d60x1){_0x3d9220['or'](_0x07c1('0x6c'),qs['getFullTextValue'](_0x55541e),null);}else{if(qs['isNumeric'](_0x55541e)){_0x3d9220['or'](_0x07c1('0x6d'),_0x55541e+'%');_0x3d9220['or'](_0x07c1('0x6e'),_0x55541e+'%');_0x3d9220['or']('c.mobile\x20LIKE\x20?',_0x55541e+'%');_0x3d9220['or'](_0x07c1('0x6f'),_0x55541e+'%');}else if(qs[_0x07c1('0x70')](_0x55541e)){_0x3d9220['or'](_0x07c1('0x71'),_0x55541e+'%');}else{_0x3d9220['or'](_0x07c1('0x72'),'%'+_0x55541e+'%');_0x3d9220['or'](_0x07c1('0x73'),'%'+_0x55541e+'%');_0x3d9220['or']('c.email\x20LIKE\x20?','%'+_0x55541e+'%');}}}}_0xa89129[_0x07c1('0x64')](_0x3d9220);_0xa89129[_0x07c1('0x74')](_0x07c1('0x75'));var _0xbe66be={'type':db['Sequelize']['QueryTypes'][_0x07c1('0x76')],'raw':!![]};var _0x2fffe0=_0xa89129[_0x07c1('0x77')]()[_0x07c1('0x43')]('c.id');if(_0x438cef[_0x07c1('0x3f')]){_0x438cef[_0x07c1('0x3f')][_0x07c1('0x57')](function(_0x1ec9ff){_0xa89129['order']('c.'+_0x1ec9ff[0x0],_0x1ec9ff[0x1]===_0x07c1('0x78')?![]:!![]);});}if(!_[_0x07c1('0x62')](_0x15edf4)){_0xa89129[_0x07c1('0x79')](_0x44800b);_0x2fffe0[_0x07c1('0x64')](_0x07c1('0x7a'),_0x15edf4);}BPromise['resolve']()[_0x07c1('0x2e')](function(){if(_0x34dfe6&&!_[_0x07c1('0x7b')](_0x34dfe6[_0x07c1('0x51')],[_0x07c1('0x43'),'User'])){return _0x5f279f[_0x07c1('0x7c')][_0x07c1('0x7d')]({'attributes':['id'],'raw':!![]})[_0x07c1('0x2e')](function(_0x5caddd){if(_[_0x07c1('0x62')](_0x5caddd)){_0x2fffe0[_0x07c1('0x64')](_0x07c1('0x7e'));_0xa89129['where']('c.ListId\x20IS\x20NULL');}else{_0x2fffe0['where']('c.ListId\x20IN\x20?',_[_0x07c1('0x56')](_0x5caddd,'id'));_0xa89129[_0x07c1('0x64')](_0x07c1('0x65'),_[_0x07c1('0x56')](_0x5caddd,'id'));}});}else{return;}})[_0x07c1('0x2e')](function(){db[_0x07c1('0x7f')][_0x07c1('0x38')](_0x2fffe0[_0x07c1('0x80')](),_0xbe66be)[_0x07c1('0x2e')](function(_0xbb6f3a){_0x16939['count']=_0xbb6f3a[_0x07c1('0x36')];if(_0x16939['count']===0x0)return[];return db[_0x07c1('0x7f')][_0x07c1('0x38')](_0x3f13ae['toString'](),_0xbe66be);})[_0x07c1('0x2e')](function(_0x540841){_0x267d29=_[_0x07c1('0x81')](_0x540841,'id');_0xbe66be=_[_0x07c1('0x82')](_0xbe66be,{'model':db[_0x07c1('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5f279f[_0x07c1('0x38')][_0x07c1('0x3c')]){_0x438cef['attributes'][_0x07c1('0x57')](function(_0x15e2e5){_0xa89129[_0x07c1('0x43')]('c.'+_0x15e2e5);});}else{_0xa89129[_0x07c1('0x43')](_0x07c1('0x75'));_0xa89129[_0x07c1('0x43')](_0x07c1('0x83'));_0xa89129[_0x07c1('0x43')](_0x07c1('0x84'));_0xa89129[_0x07c1('0x43')](_0x07c1('0x85'));_0xa89129['field'](_0x07c1('0x86'));_0xa89129['field'](_0x07c1('0x87'));_0xa89129['field'](_0x07c1('0x88'));_0xa89129['field']('c.ListId');_0xa89129['field']('c.deletedAt');_0xa89129[_0x07c1('0x43')](_0x07c1('0x89'),_0x07c1('0x8a'));}if(_0x438cef[_0x07c1('0x3e')])_0xa89129[_0x07c1('0x3e')](_0x438cef[_0x07c1('0x3e')]);if(_0x438cef[_0x07c1('0x20')])_0xa89129[_0x07c1('0x20')](_0x438cef['offset']);return db[_0x07c1('0x7f')]['query'](_0xa89129[_0x07c1('0x80')](),_0xbe66be);})['then'](function(_0x529a22){_0x529a22['forEach'](function(_0x5dd3a5){if(_0x5dd3a5[_0x07c1('0x8a')]){_0x5dd3a5[_0x07c1('0x8b')]=[];_0x5dd3a5[_0x07c1('0x8a')]['split'](',')[_0x07c1('0x57')](function(_0x58c638){_0x5dd3a5[_0x07c1('0x8b')][_0x07c1('0x32')](_0x267d29[_0x58c638]);});}delete _0x5dd3a5[_0x07c1('0x8a')];});_0x16939['rows']=_0x529a22;return _0x16939;})[_0x07c1('0x2e')](respondWithFilteredResult(_0x3f8977,_0x438cef));});})[_0x07c1('0x8c')](handleError(_0x3f8977,null));};exports['destroy']=function(_0x2f572d,_0x5b27d0){return db[_0x07c1('0x2c')][_0x07c1('0x52')]({'where':{'id':_0x2f572d[_0x07c1('0x8d')]['id']}})[_0x07c1('0x2e')](handleEntityNotFound(_0x5b27d0,null))[_0x07c1('0x2e')](removeEntity(_0x5b27d0,null))[_0x07c1('0x8c')](handleError(_0x5b27d0,null));};exports['describe']=function(_0x457b30,_0x17a513){return db['CmContact'][_0x07c1('0x2d')]()[_0x07c1('0x2e')](function(_0x22afc4){delete _0x22afc4[_0x07c1('0x8e')];for(var _0x494fc6=0x0;_0x494fc6=_0x4d72a9){_0x4a908f=_0x4d72a9;_0x2d5c6b=0xc8;}else{_0x2d5c6b=0xce;}_0xddd17b[_0xccc8('0x1f')](_0x2d5c6b);return _0xddd17b[_0xccc8('0x22')](_0xccc8('0x23'),_0x241db6+'-'+_0x4a908f+'/'+_0x4d72a9)[_0xccc8('0x20')](_0x27fced);}return null;};}function patchUpdates(_0x30ff64){return function(_0x28a2e6){try{jsonpatch[_0xccc8('0x24')](_0x28a2e6,_0x30ff64,!![]);}catch(_0x31cb75){return BPromise[_0xccc8('0x25')](_0x31cb75);}return _0x28a2e6[_0xccc8('0x26')]();};}function saveUpdates(_0x308666,_0xecb3b7){return function(_0x352d1a){if(_0x352d1a){return _0x352d1a[_0xccc8('0x27')](_0x308666)[_0xccc8('0x28')](function(_0xc460fc){return _0xc460fc;});}return null;};}function removeEntity(_0x24fcd0,_0xc68f9d){return function(_0x5539a8){if(_0x5539a8){return _0x5539a8['destroy']()[_0xccc8('0x28')](function(){_0x24fcd0[_0xccc8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfd17,_0x18c3bb){return function(_0x2692fb){if(!_0x2692fb){_0x4bfd17[_0xccc8('0x1e')](0x194);}return _0x2692fb;};}function handleError(_0x1edc13,_0x69c928){_0x69c928=_0x69c928||0x1f4;return function(_0x3cc072){logger[_0xccc8('0x29')](_0x3cc072[_0xccc8('0x2a')]);if(_0x3cc072[_0xccc8('0x2b')]){delete _0x3cc072[_0xccc8('0x2b')];}_0x1edc13[_0xccc8('0x1f')](_0x69c928)['send'](_0x3cc072);};}exports[_0xccc8('0x2c')]=function(_0x3b548c,_0x233b86){var _0x437ba8={},_0x29ee3a={},_0x4d40e9={'count':0x0,'rows':[]};return db[_0xccc8('0x2d')][_0xccc8('0x2e')]()[_0xccc8('0x28')](function(_0x3121b0){var _0x694f55=[];for(var _0x21e45c=0x0;_0x21e45c0x1){_0x6f1f35['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xccc8('0x72')](_0x24324e),null);}else{if(qs[_0xccc8('0x73')](_0x24324e)){_0x6f1f35['or']('c.id\x20LIKE\x20?',_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x74'),_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x75'),_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x76'),_0x24324e+'%');}else if(qs[_0xccc8('0x77')](_0x24324e)){_0x6f1f35['or']('c.email\x20LIKE\x20?',_0x24324e+'%');}else{_0x6f1f35['or']('c.firstName\x20LIKE\x20?','%'+_0x24324e+'%');_0x6f1f35['or'](_0xccc8('0x78'),'%'+_0x24324e+'%');_0x6f1f35['or']('c.email\x20LIKE\x20?','%'+_0x24324e+'%');}}}}_0x329774[_0xccc8('0x4b')](_0x6f1f35);_0x329774['group']('c.id');var _0x67427={'type':db['Sequelize'][_0xccc8('0x79')][_0xccc8('0x7a')],'raw':!![]};var _0x2fb150=_0x329774[_0xccc8('0x7b')]()[_0xccc8('0x41')]('c.id');if(_0x437ba8['order']){_0x437ba8[_0xccc8('0x3d')]['forEach'](function(_0x11b672){_0x329774['order']('c.'+_0x11b672[0x0],_0x11b672[0x1]===_0xccc8('0x7c')?![]:!![]);});}if(!_[_0xccc8('0x67')](_0x116868)){_0x329774[_0xccc8('0x7d')](_0x39355b);_0x2fb150[_0xccc8('0x4b')](_0xccc8('0x7e'),_0x116868);}BPromise[_0xccc8('0x7f')]()[_0xccc8('0x28')](function(){if(_0x37d8ec&&!_[_0xccc8('0x80')](_0x37d8ec[_0xccc8('0x51')],['field','User'])){return _0x3b548c[_0xccc8('0x81')]['getLists']({'attributes':['id'],'raw':!![]})[_0xccc8('0x28')](function(_0x3680d8){if(_[_0xccc8('0x67')](_0x3680d8)){_0x2fb150[_0xccc8('0x4b')]('c.ListId\x20IS\x20NULL');_0x329774[_0xccc8('0x4b')]('c.ListId\x20IS\x20NULL');}else{_0x2fb150[_0xccc8('0x4b')]('c.ListId\x20IN\x20?',_[_0xccc8('0x62')](_0x3680d8,'id'));_0x329774[_0xccc8('0x4b')](_0xccc8('0x6a'),_[_0xccc8('0x62')](_0x3680d8,'id'));}});}else{return;}})[_0xccc8('0x28')](function(){db[_0xccc8('0x82')][_0xccc8('0x37')](_0x2fb150['toString'](),_0x67427)[_0xccc8('0x28')](function(_0x58b7e7){_0x4d40e9[_0xccc8('0x83')]=_0x58b7e7[_0xccc8('0x35')];if(_0x4d40e9['count']===0x0)return[];return db[_0xccc8('0x82')][_0xccc8('0x37')](_0x56130f['toString'](),_0x67427);})['then'](function(_0x535edb){_0x2ec093=_[_0xccc8('0x84')](_0x535edb,'id');_0x67427=_['merge'](_0x67427,{'model':db[_0xccc8('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b548c[_0xccc8('0x37')][_0xccc8('0x39')]){_0x437ba8[_0xccc8('0x85')][_0xccc8('0x68')](function(_0x4a256f){_0x329774['field']('c.'+_0x4a256f);});}else{_0x329774[_0xccc8('0x41')]('c.id');_0x329774['field']('c.firstName');_0x329774[_0xccc8('0x41')]('c.lastName');_0x329774[_0xccc8('0x41')](_0xccc8('0x86'));_0x329774[_0xccc8('0x41')](_0xccc8('0x87'));_0x329774[_0xccc8('0x41')](_0xccc8('0x88'));_0x329774['field'](_0xccc8('0x89'));_0x329774[_0xccc8('0x41')](_0xccc8('0x8a'));_0x329774[_0xccc8('0x41')](_0xccc8('0x8b'));_0x329774[_0xccc8('0x41')](_0xccc8('0x8c'),_0xccc8('0x8d'));}if(_0x437ba8[_0xccc8('0x3c')])_0x329774[_0xccc8('0x3c')](_0x437ba8[_0xccc8('0x3c')]);if(_0x437ba8[_0xccc8('0x21')])_0x329774[_0xccc8('0x21')](_0x437ba8[_0xccc8('0x21')]);return db['sequelize'][_0xccc8('0x37')](_0x329774[_0xccc8('0x8e')](),_0x67427);})[_0xccc8('0x28')](function(_0x2ea00c){_0x2ea00c[_0xccc8('0x68')](function(_0x3a4b12){if(_0x3a4b12['TagIds']){_0x3a4b12[_0xccc8('0x8f')]=[];_0x3a4b12[_0xccc8('0x8d')][_0xccc8('0x55')](',')[_0xccc8('0x68')](function(_0x64ac97){_0x3a4b12[_0xccc8('0x8f')][_0xccc8('0x31')](_0x2ec093[_0x64ac97]);});}delete _0x3a4b12[_0xccc8('0x8d')];});_0x4d40e9[_0xccc8('0x90')]=_0x2ea00c;return _0x4d40e9;})[_0xccc8('0x28')](respondWithFilteredResult(_0x233b86,_0x437ba8));});})['catch'](handleError(_0x233b86,null));};exports[_0xccc8('0x91')]=function(_0x558c26,_0x28cceb){return db[_0xccc8('0x2d')][_0xccc8('0x53')]({'where':{'id':_0x558c26[_0xccc8('0x92')]['id']}})[_0xccc8('0x28')](handleEntityNotFound(_0x28cceb,null))['then'](removeEntity(_0x28cceb,null))[_0xccc8('0x93')](handleError(_0x28cceb,null));};exports['describe']=function(_0x1c658b,_0x100822){return db[_0xccc8('0x2d')][_0xccc8('0x2e')]()[_0xccc8('0x28')](function(_0x27a1c2){delete _0x27a1c2[_0xccc8('0x94')];for(var _0x574499=0x0;_0x574499{}\s\\|]/g,'-');_0x2aed27(null,util['format'](_0x4f49('0x1e'),path[_0x4f49('0x1f')](_0x416893[_0x4f49('0x1c')],path['extname'](_0x416893[_0x4f49('0x1c')])),Date[_0x4f49('0x20')](),path[_0x4f49('0x21')](_0x416893[_0x4f49('0x1c')])));}})});router[_0x4f49('0x16')](_0x4f49('0x22'),upload['single']('file'),controller[_0x4f49('0x23')]);var upload=multer({'storage':multer[_0x4f49('0x24')]({'destination':function(_0x4fedbb,_0x408552,_0x2c1519){_0x2c1519(null,path[_0x4f49('0x19')](config['root'],_0x4f49('0x1b')));},'filename':function(_0x2eed1c,_0x298785,_0x148153){_0x298785[_0x4f49('0x1c')]=_0x298785[_0x4f49('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x148153(null,util['format'](_0x4f49('0x1e'),path[_0x4f49('0x1f')](_0x298785[_0x4f49('0x1c')],path['extname'](_0x298785[_0x4f49('0x1c')])),Date[_0x4f49('0x20')](),path[_0x4f49('0x21')](_0x298785['originalname'])));}})});router['post'](_0x4f49('0x25'),upload[_0x4f49('0x26')](_0x4f49('0x27')),controller['upload']);router[_0x4f49('0x16')](_0x4f49('0x28'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x29')]);router[_0x4f49('0x2a')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x2b')]);router[_0x4f49('0x2c')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x2d')]);module[_0x4f49('0x2e')]=router; \ No newline at end of file +var _0x425d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/merge','merge','post','/create_many','bulkCreate','setTags','diskStorage','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','file','uploadCsv','join','/upload','single','upload','/upload/:id','import','put'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x425d,0x1e0));var _0xd425=function(_0x3416d9,_0x6a56f9){_0x3416d9=_0x3416d9-0x0;var _0x589ad9=_0x425d[_0x3416d9];return _0x589ad9;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./cmContact.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x8')](_0xd425('0x10'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);router[_0xd425('0x8')](_0xd425('0x12'),auth[_0xd425('0x9')](),controller[_0xd425('0x13')]);router[_0xd425('0x8')](_0xd425('0x14'),auth[_0xd425('0x9')](),controller[_0xd425('0x15')]);router['get'](_0xd425('0x16'),auth[_0xd425('0x9')](),controller[_0xd425('0x17')]);router['post'](_0xd425('0x18'),auth[_0xd425('0x9')](),controller[_0xd425('0x19')]);router[_0xd425('0x1a')]('/',auth[_0xd425('0x9')](),controller['create']);router[_0xd425('0x1a')](_0xd425('0x1b'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);router['post'](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0x1d')]);var upload=multer({'storage':multer[_0xd425('0x1e')]({'destination':function(_0x4e88fa,_0x58a0c1,_0x5debc3){_0x5debc3(null,path['join'](config[_0xd425('0x1f')],_0xd425('0x20')));},'filename':function(_0x3c98db,_0x5e797a,_0x355af0){_0x5e797a[_0xd425('0x21')]=_0x5e797a['originalname'][_0xd425('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x355af0(null,util[_0xd425('0x23')](_0xd425('0x24'),path[_0xd425('0x25')](_0x5e797a[_0xd425('0x21')],path[_0xd425('0x26')](_0x5e797a[_0xd425('0x21')])),Date[_0xd425('0x27')](),path[_0xd425('0x26')](_0x5e797a[_0xd425('0x21')])));}})});router[_0xd425('0x1a')](_0xd425('0x28'),upload['single'](_0xd425('0x29')),controller[_0xd425('0x2a')]);var upload=multer({'storage':multer[_0xd425('0x1e')]({'destination':function(_0x1908a5,_0x2afcdb,_0x400dd7){_0x400dd7(null,path[_0xd425('0x2b')](config['root'],_0xd425('0x20')));},'filename':function(_0x177de2,_0x1d8861,_0x57c950){_0x1d8861[_0xd425('0x21')]=_0x1d8861[_0xd425('0x21')][_0xd425('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57c950(null,util[_0xd425('0x23')](_0xd425('0x24'),path[_0xd425('0x25')](_0x1d8861[_0xd425('0x21')],path[_0xd425('0x26')](_0x1d8861[_0xd425('0x21')])),Date[_0xd425('0x27')](),path['extname'](_0x1d8861[_0xd425('0x21')])));}})});router[_0xd425('0x1a')](_0xd425('0x2c'),upload[_0xd425('0x2d')](_0xd425('0x29')),controller[_0xd425('0x2e')]);router[_0xd425('0x1a')](_0xd425('0x2f'),auth[_0xd425('0x9')](),controller[_0xd425('0x30')]);router[_0xd425('0x31')]('/:id',auth[_0xd425('0x9')](),controller[_0xd425('0x32')]);router[_0xd425('0x33')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller['destroy']);module[_0xd425('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index cb8db02..0756416 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 _0x3714=['INTEGER','sequelize','exports','STRING'];(function(_0x14d175,_0x230bf7){var _0x2946e9=function(_0x417219){while(--_0x417219){_0x14d175['push'](_0x14d175['shift']());}};_0x2946e9(++_0x230bf7);}(_0x3714,0x95));var _0x4371=function(_0x1352f8,_0x7a1f6f){_0x1352f8=_0x1352f8-0x0;var _0x399e93=_0x3714[_0x1352f8];return _0x399e93;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x4371('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4371('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4371('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x4371('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x1cb9=['STRING','sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5b45ef,_0x491101){_0x5b45ef=_0x5b45ef-0x0;var _0x54b98b=_0x1cb9[_0x5b45ef];return _0x54b98b;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x91cb('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x91cb('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x91cb('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x91cb('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x91cb('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d6796ec..f9510c8 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 _0x7e1e=['filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','CmContactHasItems','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','index','map','CmContactHasItem','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0x1b72a6,_0x41b8f7){var _0x3208fa=function(_0xb218b1){while(--_0xb218b1){_0x1b72a6['push'](_0x1b72a6['shift']());}};_0x3208fa(++_0x41b8f7);}(_0x7e1e,0x147));var _0xe7e1=function(_0x37f11e,_0x19e262){_0x37f11e=_0x37f11e-0x0;var _0x2c5d8a=_0x7e1e[_0x37f11e];return _0x2c5d8a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe7e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7e1('0x1'));var jsonpatch=require(_0xe7e1('0x2'));var rp=require(_0xe7e1('0x3'));var moment=require('moment');var BPromise=require(_0xe7e1('0x4'));var Mustache=require(_0xe7e1('0x5'));var util=require(_0xe7e1('0x6'));var path=require(_0xe7e1('0x7'));var sox=require('sox');var csv=require(_0xe7e1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe7e1('0x9'));var squel=require('squel');var crypto=require(_0xe7e1('0xa'));var jsforce=require(_0xe7e1('0xb'));var deskjs=require(_0xe7e1('0xc'));var toCsv=require(_0xe7e1('0x8'));var querystring=require(_0xe7e1('0xd'));var Papa=require(_0xe7e1('0xe'));var Redis=require(_0xe7e1('0xf'));var authService=require(_0xe7e1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe7e1('0x11'));var hardwareService=require(_0xe7e1('0x12'));var logger=require(_0xe7e1('0x13'))(_0xe7e1('0x14'));var utils=require('../../config/utils');var config=require(_0xe7e1('0x15'));var db=require(_0xe7e1('0x16'))['db'];function respondWithStatusCode(_0x1c362e,_0x2b529c){_0x2b529c=_0x2b529c||0xcc;return function(_0x4e108a){if(_0x4e108a){return _0x1c362e[_0xe7e1('0x17')](_0x2b529c);}return _0x1c362e[_0xe7e1('0x18')](_0x2b529c)[_0xe7e1('0x19')]();};}function respondWithResult(_0x1e2fdc,_0x2df967){_0x2df967=_0x2df967||0xc8;return function(_0x1e993f){if(_0x1e993f){return _0x1e2fdc[_0xe7e1('0x18')](_0x2df967)['json'](_0x1e993f);}};}function respondWithFilteredResult(_0x484bfa,_0x294ccf){return function(_0x3df224){if(_0x3df224){var _0x416258=_0x3df224[_0xe7e1('0x1a')],_0xddf9e0=_0x294ccf[_0xe7e1('0x1b')],_0x15fc5e=_0x294ccf[_0xe7e1('0x1b')]+_0x294ccf[_0xe7e1('0x1c')],_0x3c5178;if(_0x15fc5e>=_0x416258){_0x15fc5e=_0x416258;_0x3c5178=0xc8;}else{_0x3c5178=0xce;}_0x484bfa[_0xe7e1('0x18')](_0x3c5178);return _0x484bfa['set'](_0xe7e1('0x1d'),_0xddf9e0+'-'+_0x15fc5e+'/'+_0x416258)[_0xe7e1('0x1e')](_0x3df224);}return null;};}function patchUpdates(_0x4df349){return function(_0x168dfa){try{jsonpatch[_0xe7e1('0x1f')](_0x168dfa,_0x4df349,!![]);}catch(_0x1ebf7d){return BPromise[_0xe7e1('0x20')](_0x1ebf7d);}return _0x168dfa[_0xe7e1('0x21')]();};}function saveUpdates(_0x52b613,_0x57e32e){return function(_0x105b4f){if(_0x105b4f){return _0x105b4f[_0xe7e1('0x22')](_0x52b613)['then'](function(_0x202df0){return _0x202df0;});}return null;};}function removeEntity(_0x1f4639,_0x109db6){return function(_0x5baa24){if(_0x5baa24){return _0x5baa24[_0xe7e1('0x23')]()[_0xe7e1('0x24')](function(){var _0xa8e4e8=_0x5baa24[_0xe7e1('0x25')]({'plain':!![]});var _0x4576c0='CmContactHasItems';return db[_0xe7e1('0x26')][_0xe7e1('0x23')]({'where':{'type':_0x4576c0,'resourceId':_0xa8e4e8['id']}})['then'](function(){return _0x5baa24;});})[_0xe7e1('0x24')](function(){_0x1f4639[_0xe7e1('0x18')](0xcc)[_0xe7e1('0x19')]();});}};}function handleEntityNotFound(_0x281494,_0x433ce0){return function(_0x2f89e8){if(!_0x2f89e8){_0x281494['sendStatus'](0x194);}return _0x2f89e8;};}function handleError(_0x26db90,_0x3690ab){_0x3690ab=_0x3690ab||0x1f4;return function(_0x10962e){logger[_0xe7e1('0x27')](_0x10962e['stack']);if(_0x10962e['name']){delete _0x10962e[_0xe7e1('0x28')];}_0x26db90[_0xe7e1('0x18')](_0x3690ab)['send'](_0x10962e);};}exports[_0xe7e1('0x29')]=function(_0x3c06a6,_0x1e42c2){var _0xa09331={},_0x37deb7={},_0x2b136f={'count':0x0,'rows':[]};var _0xdaac25=_[_0xe7e1('0x2a')](db[_0xe7e1('0x2b')]['rawAttributes'],function(_0x801ab5){return{'name':_0x801ab5[_0xe7e1('0x2c')],'type':_0x801ab5[_0xe7e1('0x2d')]['key']};});_0x37deb7[_0xe7e1('0x2e')]=_['map'](_0xdaac25,'name');_0x37deb7[_0xe7e1('0x2f')]=_[_0xe7e1('0x30')](_0x3c06a6['query']);_0x37deb7['filters']=_[_0xe7e1('0x31')](_0x37deb7['model'],_0x37deb7[_0xe7e1('0x2f')]);_0xa09331['attributes']=_[_0xe7e1('0x31')](_0x37deb7['model'],qs[_0xe7e1('0x32')](_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x32')]));_0xa09331[_0xe7e1('0x33')]=_0xa09331[_0xe7e1('0x33')][_0xe7e1('0x34')]?_0xa09331['attributes']:_0x37deb7[_0xe7e1('0x2e')];if(!_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x35')]('nolimit')){_0xa09331[_0xe7e1('0x1c')]=qs['limit'](_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x1c')]);_0xa09331[_0xe7e1('0x1b')]=qs[_0xe7e1('0x1b')](_0x3c06a6[_0xe7e1('0x2f')]['offset']);}_0xa09331[_0xe7e1('0x36')]=qs[_0xe7e1('0x37')](_0x3c06a6['query'][_0xe7e1('0x37')]);_0xa09331[_0xe7e1('0x38')]=qs['filters'](_[_0xe7e1('0x39')](_0x3c06a6['query'],_0x37deb7[_0xe7e1('0x3a')]),_0xdaac25);if(_0x3c06a6['query'][_0xe7e1('0x3b')]){_0xa09331[_0xe7e1('0x38')]=_[_0xe7e1('0x3c')](_0xa09331[_0xe7e1('0x38')],{'$or':_[_0xe7e1('0x2a')](_0xdaac25,function(_0x4ed0a9){if(_0x4ed0a9[_0xe7e1('0x2d')]!==_0xe7e1('0x3d')){var _0xca996d={};_0xca996d[_0x4ed0a9[_0xe7e1('0x28')]]={'$like':'%'+_0x3c06a6['query']['filter']+'%'};return _0xca996d;}})});}_0xa09331=_['merge']({},_0xa09331,_0x3c06a6[_0xe7e1('0x3e')]);var _0x843ccb={'where':_0xa09331[_0xe7e1('0x38')]};return db[_0xe7e1('0x2b')][_0xe7e1('0x1a')](_0x843ccb)[_0xe7e1('0x24')](function(_0x3c396e){_0x2b136f['count']=_0x3c396e;if(_0x3c06a6[_0xe7e1('0x2f')][_0xe7e1('0x3f')]){_0xa09331['include']=[{'all':!![]}];}return db[_0xe7e1('0x2b')]['findAll'](_0xa09331);})[_0xe7e1('0x24')](function(_0x484dcf){_0x2b136f[_0xe7e1('0x40')]=_0x484dcf;return _0x2b136f;})[_0xe7e1('0x24')](respondWithFilteredResult(_0x1e42c2,_0xa09331))[_0xe7e1('0x41')](handleError(_0x1e42c2,null));};exports[_0xe7e1('0x42')]=function(_0x4a58ec,_0x2d05b0){var _0x7f8019={'raw':!![],'where':{'id':_0x4a58ec[_0xe7e1('0x43')]['id']}},_0xf24532={};_0xf24532['model']=_[_0xe7e1('0x30')](db['CmContactHasItem'][_0xe7e1('0x44')]);_0xf24532[_0xe7e1('0x2f')]=_[_0xe7e1('0x30')](_0x4a58ec[_0xe7e1('0x2f')]);_0xf24532[_0xe7e1('0x3a')]=_[_0xe7e1('0x31')](_0xf24532[_0xe7e1('0x2e')],_0xf24532[_0xe7e1('0x2f')]);_0x7f8019[_0xe7e1('0x33')]=_[_0xe7e1('0x31')](_0xf24532['model'],qs[_0xe7e1('0x32')](_0x4a58ec[_0xe7e1('0x2f')][_0xe7e1('0x32')]));_0x7f8019[_0xe7e1('0x33')]=_0x7f8019['attributes'][_0xe7e1('0x34')]?_0x7f8019[_0xe7e1('0x33')]:_0xf24532['model'];if(_0x4a58ec['query']['includeAll']){_0x7f8019[_0xe7e1('0x45')]=[{'all':!![]}];}_0x7f8019=_[_0xe7e1('0x3c')]({},_0x7f8019,_0x4a58ec[_0xe7e1('0x3e')]);return db[_0xe7e1('0x2b')][_0xe7e1('0x46')](_0x7f8019)[_0xe7e1('0x24')](handleEntityNotFound(_0x2d05b0,null))[_0xe7e1('0x24')](respondWithResult(_0x2d05b0,null))[_0xe7e1('0x41')](handleError(_0x2d05b0,null));};exports[_0xe7e1('0x47')]=function(_0xe481f0,_0x36ccea){return db[_0xe7e1('0x2b')][_0xe7e1('0x47')](_0xe481f0[_0xe7e1('0x48')],{})[_0xe7e1('0x24')](function(_0x4d7a25){var _0x5330a8=_0xe481f0[_0xe7e1('0x49')][_0xe7e1('0x25')]({'plain':!![]});if(!_0x5330a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5330a8['role']===_0xe7e1('0x49')){var _0x1c250d=_0x4d7a25[_0xe7e1('0x25')]({'plain':!![]});var _0x3056a1=_0xe7e1('0x4a');return db['UserProfileSection'][_0xe7e1('0x46')]({'where':{'name':_0x3056a1,'userProfileId':_0x5330a8['userProfileId']},'raw':!![]})[_0xe7e1('0x24')](function(_0x433756){if(_0x433756&&_0x433756[_0xe7e1('0x4b')]===0x0){return db['UserProfileResource'][_0xe7e1('0x47')]({'name':_0x1c250d[_0xe7e1('0x28')],'resourceId':_0x1c250d['id'],'type':_0x433756[_0xe7e1('0x28')],'sectionId':_0x433756['id']},{})[_0xe7e1('0x24')](function(){return _0x4d7a25;});}else{return _0x4d7a25;}})[_0xe7e1('0x41')](function(_0x35fa7f){logger[_0xe7e1('0x27')](_0xe7e1('0x4c'),_0x35fa7f);throw _0x35fa7f;});}return _0x4d7a25;})[_0xe7e1('0x24')](respondWithResult(_0x36ccea,0xc9))[_0xe7e1('0x41')](handleError(_0x36ccea,null));};exports[_0xe7e1('0x22')]=function(_0x141022,_0x338c67){if(_0x141022['body']['id']){delete _0x141022[_0xe7e1('0x48')]['id'];}return db[_0xe7e1('0x2b')][_0xe7e1('0x46')]({'where':{'id':_0x141022[_0xe7e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x338c67,null))[_0xe7e1('0x24')](saveUpdates(_0x141022[_0xe7e1('0x48')],null))['then'](respondWithResult(_0x338c67,null))[_0xe7e1('0x41')](handleError(_0x338c67,null));};exports[_0xe7e1('0x23')]=function(_0x4f357c,_0x378279){return db[_0xe7e1('0x2b')][_0xe7e1('0x46')]({'where':{'id':_0x4f357c[_0xe7e1('0x43')]['id']}})[_0xe7e1('0x24')](handleEntityNotFound(_0x378279,null))[_0xe7e1('0x24')](removeEntity(_0x378279,null))[_0xe7e1('0x41')](handleError(_0x378279,null));}; \ No newline at end of file +var _0x5a68=['sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x44c9e3,_0x370f9c){var _0x2df2a6=function(_0x1a65b8){while(--_0x1a65b8){_0x44c9e3['push'](_0x44c9e3['shift']());}};_0x2df2a6(++_0x370f9c);}(_0x5a68,0x139));var _0x85a6=function(_0x19ce06,_0x3aa4bc){_0x19ce06=_0x19ce06-0x0;var _0xd88686=_0x5a68[_0x19ce06];return _0xd88686;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x85a6('0x0'));var rimraf=require(_0x85a6('0x1'));var zipdir=require(_0x85a6('0x2'));var jsonpatch=require(_0x85a6('0x3'));var rp=require(_0x85a6('0x4'));var moment=require(_0x85a6('0x5'));var BPromise=require(_0x85a6('0x6'));var Mustache=require(_0x85a6('0x7'));var util=require('util');var path=require(_0x85a6('0x8'));var sox=require(_0x85a6('0x9'));var csv=require(_0x85a6('0xa'));var ejs=require(_0x85a6('0xb'));var fs=require('fs');var _=require(_0x85a6('0xc'));var squel=require(_0x85a6('0xd'));var crypto=require(_0x85a6('0xe'));var jsforce=require(_0x85a6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x85a6('0xa'));var querystring=require(_0x85a6('0x10'));var Papa=require(_0x85a6('0x11'));var Redis=require(_0x85a6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x85a6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85a6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x85a6('0x15'));var db=require(_0x85a6('0x16'))['db'];function respondWithStatusCode(_0x59be26,_0x12ad3e){_0x12ad3e=_0x12ad3e||0xcc;return function(_0x3a80d0){if(_0x3a80d0){return _0x59be26[_0x85a6('0x17')](_0x12ad3e);}return _0x59be26[_0x85a6('0x18')](_0x12ad3e)[_0x85a6('0x19')]();};}function respondWithResult(_0x699f5e,_0x56a700){_0x56a700=_0x56a700||0xc8;return function(_0x8eff8d){if(_0x8eff8d){return _0x699f5e[_0x85a6('0x18')](_0x56a700)[_0x85a6('0x1a')](_0x8eff8d);}};}function respondWithFilteredResult(_0x3ba004,_0x436414){return function(_0x4d050a){if(_0x4d050a){var _0x54ff8e=_0x4d050a[_0x85a6('0x1b')],_0x5a775d=_0x436414[_0x85a6('0x1c')],_0xc4928d=_0x436414[_0x85a6('0x1c')]+_0x436414['limit'],_0x5815bc;if(_0xc4928d>=_0x54ff8e){_0xc4928d=_0x54ff8e;_0x5815bc=0xc8;}else{_0x5815bc=0xce;}_0x3ba004[_0x85a6('0x18')](_0x5815bc);return _0x3ba004[_0x85a6('0x1d')]('Content-Range',_0x5a775d+'-'+_0xc4928d+'/'+_0x54ff8e)[_0x85a6('0x1a')](_0x4d050a);}return null;};}function patchUpdates(_0x2e7dbb){return function(_0x2bd285){try{jsonpatch[_0x85a6('0x1e')](_0x2bd285,_0x2e7dbb,!![]);}catch(_0x1f2b4e){return BPromise[_0x85a6('0x1f')](_0x1f2b4e);}return _0x2bd285[_0x85a6('0x20')]();};}function saveUpdates(_0x116c20,_0x2b8fe1){return function(_0x12e9f0){if(_0x12e9f0){return _0x12e9f0['update'](_0x116c20)[_0x85a6('0x21')](function(_0x124b0d){return _0x124b0d;});}return null;};}function removeEntity(_0x318b5e,_0x186d2f){return function(_0x2fc84d){if(_0x2fc84d){return _0x2fc84d[_0x85a6('0x22')]()['then'](function(){var _0x5ef52e=_0x2fc84d[_0x85a6('0x23')]({'plain':!![]});var _0x1318e9=_0x85a6('0x24');return db[_0x85a6('0x25')][_0x85a6('0x22')]({'where':{'type':_0x1318e9,'resourceId':_0x5ef52e['id']}})[_0x85a6('0x21')](function(){return _0x2fc84d;});})[_0x85a6('0x21')](function(){_0x318b5e[_0x85a6('0x18')](0xcc)[_0x85a6('0x19')]();});}};}function handleEntityNotFound(_0x361ec3,_0xfebc7f){return function(_0x162b75){if(!_0x162b75){_0x361ec3[_0x85a6('0x17')](0x194);}return _0x162b75;};}function handleError(_0x39dca1,_0x5211cc){_0x5211cc=_0x5211cc||0x1f4;return function(_0x4697f8){logger[_0x85a6('0x26')](_0x4697f8[_0x85a6('0x27')]);if(_0x4697f8[_0x85a6('0x28')]){delete _0x4697f8[_0x85a6('0x28')];}_0x39dca1[_0x85a6('0x18')](_0x5211cc)['send'](_0x4697f8);};}exports[_0x85a6('0x29')]=function(_0x10a7c8,_0x3fa984){var _0x15f008={},_0x9ebf72={},_0x9f1a78={'count':0x0,'rows':[]};var _0x4b4991=_[_0x85a6('0x2a')](db['CmContactHasItem'][_0x85a6('0x2b')],function(_0x5a7048){return{'name':_0x5a7048[_0x85a6('0x2c')],'type':_0x5a7048[_0x85a6('0x2d')][_0x85a6('0x2e')]};});_0x9ebf72[_0x85a6('0x2f')]=_[_0x85a6('0x2a')](_0x4b4991,'name');_0x9ebf72[_0x85a6('0x30')]=_['keys'](_0x10a7c8['query']);_0x9ebf72[_0x85a6('0x31')]=_['intersection'](_0x9ebf72[_0x85a6('0x2f')],_0x9ebf72[_0x85a6('0x30')]);_0x15f008['attributes']=_[_0x85a6('0x32')](_0x9ebf72[_0x85a6('0x2f')],qs[_0x85a6('0x33')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x33')]));_0x15f008['attributes']=_0x15f008[_0x85a6('0x34')][_0x85a6('0x35')]?_0x15f008[_0x85a6('0x34')]:_0x9ebf72[_0x85a6('0x2f')];if(!_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x36')](_0x85a6('0x37'))){_0x15f008[_0x85a6('0x38')]=qs[_0x85a6('0x38')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x38')]);_0x15f008[_0x85a6('0x1c')]=qs[_0x85a6('0x1c')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x1c')]);}_0x15f008[_0x85a6('0x39')]=qs[_0x85a6('0x3a')](_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x3a')]);_0x15f008[_0x85a6('0x3b')]=qs[_0x85a6('0x31')](_[_0x85a6('0x3c')](_0x10a7c8[_0x85a6('0x30')],_0x9ebf72[_0x85a6('0x31')]),_0x4b4991);if(_0x10a7c8['query'][_0x85a6('0x3d')]){_0x15f008[_0x85a6('0x3b')]=_[_0x85a6('0x3e')](_0x15f008[_0x85a6('0x3b')],{'$or':_[_0x85a6('0x2a')](_0x4b4991,function(_0x4dfa7a){if(_0x4dfa7a[_0x85a6('0x2d')]!=='VIRTUAL'){var _0x2d1b3e={};_0x2d1b3e[_0x4dfa7a['name']]={'$like':'%'+_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x3d')]+'%'};return _0x2d1b3e;}})});}_0x15f008=_[_0x85a6('0x3e')]({},_0x15f008,_0x10a7c8[_0x85a6('0x3f')]);var _0x550875={'where':_0x15f008[_0x85a6('0x3b')]};return db[_0x85a6('0x40')][_0x85a6('0x1b')](_0x550875)['then'](function(_0x22a1bc){_0x9f1a78[_0x85a6('0x1b')]=_0x22a1bc;if(_0x10a7c8[_0x85a6('0x30')][_0x85a6('0x41')]){_0x15f008[_0x85a6('0x42')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x85a6('0x43')](_0x15f008);})[_0x85a6('0x21')](function(_0x192998){_0x9f1a78[_0x85a6('0x44')]=_0x192998;return _0x9f1a78;})[_0x85a6('0x21')](respondWithFilteredResult(_0x3fa984,_0x15f008))[_0x85a6('0x45')](handleError(_0x3fa984,null));};exports[_0x85a6('0x46')]=function(_0x832b3,_0x31fcc8){var _0xaee134={'raw':!![],'where':{'id':_0x832b3['params']['id']}},_0x230973={};_0x230973['model']=_[_0x85a6('0x47')](db[_0x85a6('0x40')]['rawAttributes']);_0x230973[_0x85a6('0x30')]=_[_0x85a6('0x47')](_0x832b3['query']);_0x230973[_0x85a6('0x31')]=_[_0x85a6('0x32')](_0x230973[_0x85a6('0x2f')],_0x230973[_0x85a6('0x30')]);_0xaee134[_0x85a6('0x34')]=_['intersection'](_0x230973[_0x85a6('0x2f')],qs[_0x85a6('0x33')](_0x832b3[_0x85a6('0x30')][_0x85a6('0x33')]));_0xaee134[_0x85a6('0x34')]=_0xaee134[_0x85a6('0x34')][_0x85a6('0x35')]?_0xaee134['attributes']:_0x230973[_0x85a6('0x2f')];if(_0x832b3['query'][_0x85a6('0x41')]){_0xaee134[_0x85a6('0x42')]=[{'all':!![]}];}_0xaee134=_[_0x85a6('0x3e')]({},_0xaee134,_0x832b3['options']);return db[_0x85a6('0x40')][_0x85a6('0x48')](_0xaee134)[_0x85a6('0x21')](handleEntityNotFound(_0x31fcc8,null))[_0x85a6('0x21')](respondWithResult(_0x31fcc8,null))[_0x85a6('0x45')](handleError(_0x31fcc8,null));};exports['create']=function(_0x214e27,_0x19505f){return db['CmContactHasItem'][_0x85a6('0x49')](_0x214e27['body'],{})[_0x85a6('0x21')](function(_0x225b95){var _0x5ad76=_0x214e27[_0x85a6('0x4a')]['get']({'plain':!![]});if(!_0x5ad76)throw new Error(_0x85a6('0x4b'));if(_0x5ad76[_0x85a6('0x4c')]===_0x85a6('0x4a')){var _0xedc7ee=_0x225b95[_0x85a6('0x23')]({'plain':!![]});var _0x1840c5=_0x85a6('0x24');return db[_0x85a6('0x4d')]['find']({'where':{'name':_0x1840c5,'userProfileId':_0x5ad76[_0x85a6('0x4e')]},'raw':!![]})[_0x85a6('0x21')](function(_0x5ae8a9){if(_0x5ae8a9&&_0x5ae8a9[_0x85a6('0x4f')]===0x0){return db['UserProfileResource'][_0x85a6('0x49')]({'name':_0xedc7ee[_0x85a6('0x28')],'resourceId':_0xedc7ee['id'],'type':_0x5ae8a9[_0x85a6('0x28')],'sectionId':_0x5ae8a9['id']},{})[_0x85a6('0x21')](function(){return _0x225b95;});}else{return _0x225b95;}})[_0x85a6('0x45')](function(_0x4bcc0d){logger[_0x85a6('0x26')](_0x85a6('0x50'),_0x4bcc0d);throw _0x4bcc0d;});}return _0x225b95;})[_0x85a6('0x21')](respondWithResult(_0x19505f,0xc9))[_0x85a6('0x45')](handleError(_0x19505f,null));};exports[_0x85a6('0x51')]=function(_0x36cadf,_0x170fb5){if(_0x36cadf[_0x85a6('0x52')]['id']){delete _0x36cadf[_0x85a6('0x52')]['id'];}return db[_0x85a6('0x40')][_0x85a6('0x48')]({'where':{'id':_0x36cadf[_0x85a6('0x53')]['id']}})[_0x85a6('0x21')](handleEntityNotFound(_0x170fb5,null))['then'](saveUpdates(_0x36cadf[_0x85a6('0x52')],null))[_0x85a6('0x21')](respondWithResult(_0x170fb5,null))['catch'](handleError(_0x170fb5,null));};exports[_0x85a6('0x22')]=function(_0x50ee91,_0x3ad056){return db['CmContactHasItem'][_0x85a6('0x48')]({'where':{'id':_0x50ee91[_0x85a6('0x53')]['id']}})[_0x85a6('0x21')](handleEntityNotFound(_0x3ad056,null))[_0x85a6('0x21')](removeEntity(_0x3ad056,null))[_0x85a6('0x45')](handleError(_0x3ad056,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8f5e492..e018480 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 _0x0309=['rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0309,0x165));var _0x9030=function(_0x1f72be,_0x44647e){_0x1f72be=_0x1f72be-0x0;var _0x289390=_0x0309[_0x1f72be];return _0x289390;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('CmContactHasItem',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x4da6ba,_0x554ea7){_0x4da6ba=_0x4da6ba-0x0;var _0x4b8317=_0xfdbd[_0x4da6ba];return _0x4b8317;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index fb27381..ae86c3c 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 _0xf6be=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x34f2a4,_0x5bb81d){var _0x4aa1f2=function(_0x1c4a45){while(--_0x1c4a45){_0x34f2a4['push'](_0x34f2a4['shift']());}};_0x4aa1f2(++_0x5bb81d);}(_0xf6be,0x80));var _0xef6b=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xf6be[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0xef6b('0x0'));var util=require('util');var moment=require(_0xef6b('0x1'));var BPromise=require('bluebird');var rs=require(_0xef6b('0x2'));var fs=require('fs');var Redis=require(_0xef6b('0x3'));var db=require(_0xef6b('0x4'))['db'];var utils=require(_0xef6b('0x5'));var logger=require(_0xef6b('0x6'))(_0xef6b('0x7'));var config=require(_0xef6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef6b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d0ab,_0x3c14f3,_0x36eac5){return new BPromise(function(_0x21dca0,_0x53aa82){return client[_0xef6b('0xa')](_0x11d0ab,_0x36eac5)[_0xef6b('0xb')](function(_0x310d77){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x3c14f3,_0xef6b('0xc'));logger[_0xef6b('0xd')](_0xef6b('0xe'),_0x3c14f3,_0xef6b('0xc'),JSON['stringify'](_0x310d77));if(_0x310d77[_0xef6b('0xf')]){if(_0x310d77['error']['code']===0x1f4){logger[_0xef6b('0xf')](_0xef6b('0x10'),_0x3c14f3,_0x310d77[_0xef6b('0xf')]['message']);return _0x53aa82(_0x310d77[_0xef6b('0xf')][_0xef6b('0x11')]);}logger['error'](_0xef6b('0x10'),_0x3c14f3,_0x310d77[_0xef6b('0xf')][_0xef6b('0x11')]);return _0x21dca0(_0x310d77[_0xef6b('0xf')][_0xef6b('0x11')]);}else{logger['info'](_0xef6b('0x10'),_0x3c14f3,_0xef6b('0xc'));_0x21dca0(_0x310d77[_0xef6b('0x12')]['message']);}})[_0xef6b('0x13')](function(_0x331442){logger[_0xef6b('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x3c14f3,_0x331442);_0x53aa82(_0x331442);});});} \ No newline at end of file +var _0xa404=['CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa404,0x159));var _0x4a40=function(_0x3ab711,_0x31b57e){_0x3ab711=_0x3ab711-0x0;var _0x514470=_0xa404[_0x3ab711];return _0x514470;};'use strict';var _=require(_0x4a40('0x0'));var util=require(_0x4a40('0x1'));var moment=require(_0x4a40('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a40('0x4'));var logger=require(_0x4a40('0x5'))('rpc');var config=require(_0x4a40('0x6'));var jayson=require(_0x4a40('0x7'));var client=jayson[_0x4a40('0x8')][_0x4a40('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be9d0,_0x1255d5,_0x2eb044){return new BPromise(function(_0x100a8a,_0x5e2833){return client['request'](_0x1be9d0,_0x2eb044)[_0x4a40('0xa')](function(_0x23b06b){logger[_0x4a40('0xb')](_0x4a40('0xc'),_0x1255d5,'request\x20sent');logger[_0x4a40('0xd')](_0x4a40('0xe'),_0x1255d5,'request\x20sent',JSON[_0x4a40('0xf')](_0x23b06b));if(_0x23b06b[_0x4a40('0x10')]){if(_0x23b06b[_0x4a40('0x10')][_0x4a40('0x11')]===0x1f4){logger[_0x4a40('0x10')](_0x4a40('0xc'),_0x1255d5,_0x23b06b['error'][_0x4a40('0x12')]);return _0x5e2833(_0x23b06b['error'][_0x4a40('0x12')]);}logger[_0x4a40('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x1255d5,_0x23b06b[_0x4a40('0x10')]['message']);return _0x100a8a(_0x23b06b[_0x4a40('0x10')][_0x4a40('0x12')]);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x1255d5,_0x4a40('0x13'));_0x100a8a(_0x23b06b[_0x4a40('0x14')][_0x4a40('0x12')]);}})['catch'](function(_0x3bb989){logger[_0x4a40('0x10')](_0x4a40('0xc'),_0x1255d5,_0x3bb989);_0x5e2833(_0x3bb989);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 225ec51..7f35063 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 _0x23ae=['update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','create','put'];(function(_0x320d0a,_0x13cdf3){var _0x431c97=function(_0x52df40){while(--_0x52df40){_0x320d0a['push'](_0x320d0a['shift']());}};_0x431c97(++_0x13cdf3);}(_0x23ae,0x1b6));var _0xe23a=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0x23ae[_0xadc7d9];return _0x915ca1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe23a('0x0'));var timeout=require(_0xe23a('0x1'));var express=require('express');var router=express[_0xe23a('0x2')]();var auth=require(_0xe23a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe23a('0x4'));var controller=require(_0xe23a('0x5'));router[_0xe23a('0x6')]('/',auth[_0xe23a('0x7')](),controller['index']);router[_0xe23a('0x6')](_0xe23a('0x8'),auth[_0xe23a('0x7')](),controller[_0xe23a('0x9')]);router['post']('/',auth[_0xe23a('0x7')](),controller[_0xe23a('0xa')]);router[_0xe23a('0xb')](_0xe23a('0x8'),auth[_0xe23a('0x7')](),controller[_0xe23a('0xc')]);router['delete'](_0xe23a('0x8'),auth[_0xe23a('0x7')](),controller[_0xe23a('0xd')]);module[_0xe23a('0xe')]=router; \ No newline at end of file +var _0x370a=['create','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x4f2d97,_0x178903){var _0x2c1dbc=function(_0x274556){while(--_0x274556){_0x4f2d97['push'](_0x4f2d97['shift']());}};_0x2c1dbc(++_0x178903);}(_0x370a,0x194));var _0xa370=function(_0x53e576,_0x230268){_0x53e576=_0x53e576-0x0;var _0x20cc61=_0x370a[_0x53e576];return _0x20cc61;};'use strict';var multer=require('multer');var util=require(_0xa370('0x0'));var path=require(_0xa370('0x1'));var timeout=require(_0xa370('0x2'));var express=require(_0xa370('0x3'));var router=express['Router']();var auth=require(_0xa370('0x4'));var interaction=require(_0xa370('0x5'));var config=require(_0xa370('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xa370('0x7')]('/',auth[_0xa370('0x8')](),controller['index']);router[_0xa370('0x7')](_0xa370('0x9'),auth[_0xa370('0x8')](),controller[_0xa370('0xa')]);router[_0xa370('0xb')]('/',auth['isAuthenticated'](),controller[_0xa370('0xc')]);router['put'](_0xa370('0x9'),auth[_0xa370('0x8')](),controller[_0xa370('0xd')]);router['delete']('/:id',auth[_0xa370('0x8')](),controller[_0xa370('0xe')]);module[_0xa370('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 9562a53..44e0e79 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 _0xbd4a=['exports','STRING','sequelize'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xbd4a,0xbf));var _0xabd4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbd4a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xabd4('0x0'));module[_0xabd4('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0xabd4('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x3af3=['sequelize','INTEGER'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x3af3,0x12a));var _0x33af=function(_0x39c12e,_0x585534){_0x39c12e=_0x39c12e-0x0;var _0x58dbf4=_0x3af3[_0x39c12e];return _0x58dbf4;};'use strict';var Sequelize=require(_0x33af('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x33af('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index aac11fe..435d7b7 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 _0x89aa=['where','filters','merge','type','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','CmContactHasPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','length','sort'];(function(_0x218727,_0x5a4879){var _0x34537a=function(_0xbb3cb2){while(--_0xbb3cb2){_0x218727['push'](_0x218727['shift']());}};_0x34537a(++_0x5a4879);}(_0x89aa,0xec));var _0xa89a=function(_0x417081,_0x21e877){_0x417081=_0x417081-0x0;var _0x2204c7=_0x89aa[_0x417081];return _0x2204c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa89a('0x0'));var rimraf=require(_0xa89a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa89a('0x2'));var rp=require('request-promise');var moment=require(_0xa89a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa89a('0x4'));var util=require(_0xa89a('0x5'));var path=require(_0xa89a('0x6'));var sox=require(_0xa89a('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('jsforce');var deskjs=require(_0xa89a('0x8'));var toCsv=require(_0xa89a('0x9'));var querystring=require(_0xa89a('0xa'));var Papa=require(_0xa89a('0xb'));var Redis=require('ioredis');var authService=require(_0xa89a('0xc'));var qs=require(_0xa89a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa89a('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xa89a('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d433a,_0x548eed){_0x548eed=_0x548eed||0xcc;return function(_0x3c0eb4){if(_0x3c0eb4){return _0x3d433a[_0xa89a('0x10')](_0x548eed);}return _0x3d433a[_0xa89a('0x11')](_0x548eed)[_0xa89a('0x12')]();};}function respondWithResult(_0x14b5fb,_0x121638){_0x121638=_0x121638||0xc8;return function(_0x3b0804){if(_0x3b0804){return _0x14b5fb['status'](_0x121638)[_0xa89a('0x13')](_0x3b0804);}};}function respondWithFilteredResult(_0x242349,_0xd9f5b3){return function(_0x5e3738){if(_0x5e3738){var _0x1b7115=_0x5e3738[_0xa89a('0x14')],_0x338446=_0xd9f5b3[_0xa89a('0x15')],_0x2ecb3a=_0xd9f5b3[_0xa89a('0x15')]+_0xd9f5b3[_0xa89a('0x16')],_0xc78546;if(_0x2ecb3a>=_0x1b7115){_0x2ecb3a=_0x1b7115;_0xc78546=0xc8;}else{_0xc78546=0xce;}_0x242349[_0xa89a('0x11')](_0xc78546);return _0x242349['set']('Content-Range',_0x338446+'-'+_0x2ecb3a+'/'+_0x1b7115)[_0xa89a('0x13')](_0x5e3738);}return null;};}function patchUpdates(_0x5551c0){return function(_0x3ee3a9){try{jsonpatch[_0xa89a('0x17')](_0x3ee3a9,_0x5551c0,!![]);}catch(_0xdf6c12){return BPromise[_0xa89a('0x18')](_0xdf6c12);}return _0x3ee3a9[_0xa89a('0x19')]();};}function saveUpdates(_0x322396,_0x172ee4){return function(_0x30aad2){if(_0x30aad2){return _0x30aad2[_0xa89a('0x1a')](_0x322396)[_0xa89a('0x1b')](function(_0x192065){return _0x192065;});}return null;};}function removeEntity(_0x33a522,_0x3d7b0a){return function(_0x47e6f7){if(_0x47e6f7){return _0x47e6f7['destroy']()[_0xa89a('0x1b')](function(){var _0x20ee5e=_0x47e6f7['get']({'plain':!![]});var _0xde8382=_0xa89a('0x1c');return db[_0xa89a('0x1d')][_0xa89a('0x1e')]({'where':{'type':_0xde8382,'resourceId':_0x20ee5e['id']}})[_0xa89a('0x1b')](function(){return _0x47e6f7;});})[_0xa89a('0x1b')](function(){_0x33a522[_0xa89a('0x11')](0xcc)[_0xa89a('0x12')]();});}};}function handleEntityNotFound(_0x8f86a3,_0x40be14){return function(_0x151073){if(!_0x151073){_0x8f86a3[_0xa89a('0x10')](0x194);}return _0x151073;};}function handleError(_0x57bc51,_0x5a901a){_0x5a901a=_0x5a901a||0x1f4;return function(_0x55591c){logger[_0xa89a('0x1f')](_0x55591c[_0xa89a('0x20')]);if(_0x55591c[_0xa89a('0x21')]){delete _0x55591c[_0xa89a('0x21')];}_0x57bc51[_0xa89a('0x11')](_0x5a901a)[_0xa89a('0x22')](_0x55591c);};}exports[_0xa89a('0x23')]=function(_0xb93bec,_0x59ae45){var _0x22d1ed={},_0x3600dd={},_0x34b1cb={'count':0x0,'rows':[]};var _0x3fe05d=_[_0xa89a('0x24')](db[_0xa89a('0x25')][_0xa89a('0x26')],function(_0x3daf4b){return{'name':_0x3daf4b[_0xa89a('0x27')],'type':_0x3daf4b['type']['key']};});_0x3600dd['model']=_[_0xa89a('0x24')](_0x3fe05d,'name');_0x3600dd[_0xa89a('0x28')]=_[_0xa89a('0x29')](_0xb93bec['query']);_0x3600dd['filters']=_[_0xa89a('0x2a')](_0x3600dd[_0xa89a('0x2b')],_0x3600dd[_0xa89a('0x28')]);_0x22d1ed['attributes']=_[_0xa89a('0x2a')](_0x3600dd[_0xa89a('0x2b')],qs[_0xa89a('0x2c')](_0xb93bec['query']['fields']));_0x22d1ed[_0xa89a('0x2d')]=_0x22d1ed[_0xa89a('0x2d')][_0xa89a('0x2e')]?_0x22d1ed[_0xa89a('0x2d')]:_0x3600dd['model'];if(!_0xb93bec[_0xa89a('0x28')]['hasOwnProperty']('nolimit')){_0x22d1ed[_0xa89a('0x16')]=qs[_0xa89a('0x16')](_0xb93bec['query'][_0xa89a('0x16')]);_0x22d1ed[_0xa89a('0x15')]=qs[_0xa89a('0x15')](_0xb93bec[_0xa89a('0x28')][_0xa89a('0x15')]);}_0x22d1ed['order']=qs[_0xa89a('0x2f')](_0xb93bec[_0xa89a('0x28')][_0xa89a('0x2f')]);_0x22d1ed[_0xa89a('0x30')]=qs[_0xa89a('0x31')](_['pick'](_0xb93bec[_0xa89a('0x28')],_0x3600dd[_0xa89a('0x31')]),_0x3fe05d);if(_0xb93bec[_0xa89a('0x28')]['filter']){_0x22d1ed[_0xa89a('0x30')]=_[_0xa89a('0x32')](_0x22d1ed['where'],{'$or':_[_0xa89a('0x24')](_0x3fe05d,function(_0x4768b9){if(_0x4768b9[_0xa89a('0x33')]!=='VIRTUAL'){var _0x3808be={};_0x3808be[_0x4768b9[_0xa89a('0x21')]]={'$like':'%'+_0xb93bec[_0xa89a('0x28')][_0xa89a('0x34')]+'%'};return _0x3808be;}})});}_0x22d1ed=_['merge']({},_0x22d1ed,_0xb93bec['options']);var _0x2b49a4={'where':_0x22d1ed[_0xa89a('0x30')]};return db['CmContactHasPhone'][_0xa89a('0x14')](_0x2b49a4)[_0xa89a('0x1b')](function(_0x50d31f){_0x34b1cb[_0xa89a('0x14')]=_0x50d31f;if(_0xb93bec[_0xa89a('0x28')][_0xa89a('0x35')]){_0x22d1ed[_0xa89a('0x36')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xa89a('0x37')](_0x22d1ed);})[_0xa89a('0x1b')](function(_0xddc096){_0x34b1cb[_0xa89a('0x38')]=_0xddc096;return _0x34b1cb;})['then'](respondWithFilteredResult(_0x59ae45,_0x22d1ed))[_0xa89a('0x39')](handleError(_0x59ae45,null));};exports[_0xa89a('0x3a')]=function(_0x82d067,_0x1638fa){var _0x4e6485={'raw':!![],'where':{'id':_0x82d067[_0xa89a('0x3b')]['id']}},_0x4b0372={};_0x4b0372['model']=_[_0xa89a('0x29')](db[_0xa89a('0x25')][_0xa89a('0x26')]);_0x4b0372[_0xa89a('0x28')]=_['keys'](_0x82d067[_0xa89a('0x28')]);_0x4b0372[_0xa89a('0x31')]=_[_0xa89a('0x2a')](_0x4b0372[_0xa89a('0x2b')],_0x4b0372[_0xa89a('0x28')]);_0x4e6485[_0xa89a('0x2d')]=_[_0xa89a('0x2a')](_0x4b0372[_0xa89a('0x2b')],qs[_0xa89a('0x2c')](_0x82d067[_0xa89a('0x28')][_0xa89a('0x2c')]));_0x4e6485['attributes']=_0x4e6485[_0xa89a('0x2d')][_0xa89a('0x2e')]?_0x4e6485['attributes']:_0x4b0372['model'];if(_0x82d067[_0xa89a('0x28')][_0xa89a('0x35')]){_0x4e6485['include']=[{'all':!![]}];}_0x4e6485=_['merge']({},_0x4e6485,_0x82d067[_0xa89a('0x3c')]);return db[_0xa89a('0x25')][_0xa89a('0x3d')](_0x4e6485)[_0xa89a('0x1b')](handleEntityNotFound(_0x1638fa,null))[_0xa89a('0x1b')](respondWithResult(_0x1638fa,null))[_0xa89a('0x39')](handleError(_0x1638fa,null));};exports['create']=function(_0x1d653c,_0x3e6734){return db['CmContactHasPhone'][_0xa89a('0x3e')](_0x1d653c[_0xa89a('0x3f')],{})[_0xa89a('0x1b')](function(_0x2f6006){var _0x6cf93=_0x1d653c[_0xa89a('0x40')][_0xa89a('0x41')]({'plain':!![]});if(!_0x6cf93)throw new Error(_0xa89a('0x42'));if(_0x6cf93[_0xa89a('0x43')]===_0xa89a('0x40')){var _0xe0ab0e=_0x2f6006['get']({'plain':!![]});var _0x334103=_0xa89a('0x1c');return db[_0xa89a('0x44')][_0xa89a('0x3d')]({'where':{'name':_0x334103,'userProfileId':_0x6cf93[_0xa89a('0x45')]},'raw':!![]})[_0xa89a('0x1b')](function(_0x47c335){if(_0x47c335&&_0x47c335['autoAssociation']===0x0){return db[_0xa89a('0x1d')][_0xa89a('0x3e')]({'name':_0xe0ab0e[_0xa89a('0x21')],'resourceId':_0xe0ab0e['id'],'type':_0x47c335['name'],'sectionId':_0x47c335['id']},{})[_0xa89a('0x1b')](function(){return _0x2f6006;});}else{return _0x2f6006;}})['catch'](function(_0x2e70e9){logger[_0xa89a('0x1f')](_0xa89a('0x46'),_0x2e70e9);throw _0x2e70e9;});}return _0x2f6006;})[_0xa89a('0x1b')](respondWithResult(_0x3e6734,0xc9))['catch'](handleError(_0x3e6734,null));};exports['update']=function(_0x1254d3,_0x2234db){if(_0x1254d3['body']['id']){delete _0x1254d3[_0xa89a('0x3f')]['id'];}return db['CmContactHasPhone']['find']({'where':{'id':_0x1254d3['params']['id']}})[_0xa89a('0x1b')](handleEntityNotFound(_0x2234db,null))['then'](saveUpdates(_0x1254d3['body'],null))['then'](respondWithResult(_0x2234db,null))['catch'](handleError(_0x2234db,null));};exports['destroy']=function(_0x1b452b,_0x203da9){return db[_0xa89a('0x25')]['find']({'where':{'id':_0x1b452b[_0xa89a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x203da9,null))[_0xa89a('0x1b')](removeEntity(_0x203da9,null))[_0xa89a('0x39')](handleError(_0x203da9,null));}; \ No newline at end of file +var _0xd587=['offset','limit','apply','update','then','destroy','CmContactHasPhones','end','stack','name','send','index','map','CmContactHasPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','intersection','create','user','get','role','UserProfileSection','find','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count'];(function(_0x1e0c8d,_0x334e6a){var _0x418fc3=function(_0x2fec5e){while(--_0x2fec5e){_0x1e0c8d['push'](_0x1e0c8d['shift']());}};_0x418fc3(++_0x334e6a);}(_0xd587,0x11b));var _0x7d58=function(_0x634259,_0x47238e){_0x634259=_0x634259-0x0;var _0xce619d=_0xd587[_0x634259];return _0xce619d;};'use strict';var pdf=require(_0x7d58('0x0'));var emlformat=require(_0x7d58('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7d58('0x2'));var rp=require(_0x7d58('0x3'));var moment=require(_0x7d58('0x4'));var BPromise=require(_0x7d58('0x5'));var Mustache=require(_0x7d58('0x6'));var util=require(_0x7d58('0x7'));var path=require('path');var sox=require(_0x7d58('0x8'));var csv=require(_0x7d58('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7d58('0xa'));var crypto=require('crypto');var jsforce=require(_0x7d58('0xb'));var deskjs=require(_0x7d58('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d58('0xd'));var Redis=require('ioredis');var authService=require(_0x7d58('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7d58('0xf'));var hardwareService=require(_0x7d58('0x10'));var logger=require(_0x7d58('0x11'))('api');var utils=require(_0x7d58('0x12'));var config=require(_0x7d58('0x13'));var db=require(_0x7d58('0x14'))['db'];function respondWithStatusCode(_0x39532e,_0x551d4c){_0x551d4c=_0x551d4c||0xcc;return function(_0x4b4d13){if(_0x4b4d13){return _0x39532e[_0x7d58('0x15')](_0x551d4c);}return _0x39532e[_0x7d58('0x16')](_0x551d4c)['end']();};}function respondWithResult(_0x5a6878,_0x2f28f8){_0x2f28f8=_0x2f28f8||0xc8;return function(_0x297728){if(_0x297728){return _0x5a6878['status'](_0x2f28f8)[_0x7d58('0x17')](_0x297728);}};}function respondWithFilteredResult(_0x16147e,_0x70edc0){return function(_0x5be93d){if(_0x5be93d){var _0x6a4694=_0x5be93d[_0x7d58('0x18')],_0x563d51=_0x70edc0[_0x7d58('0x19')],_0x400f06=_0x70edc0['offset']+_0x70edc0[_0x7d58('0x1a')],_0x1257b4;if(_0x400f06>=_0x6a4694){_0x400f06=_0x6a4694;_0x1257b4=0xc8;}else{_0x1257b4=0xce;}_0x16147e[_0x7d58('0x16')](_0x1257b4);return _0x16147e['set']('Content-Range',_0x563d51+'-'+_0x400f06+'/'+_0x6a4694)[_0x7d58('0x17')](_0x5be93d);}return null;};}function patchUpdates(_0x3559a6){return function(_0x237d40){try{jsonpatch[_0x7d58('0x1b')](_0x237d40,_0x3559a6,!![]);}catch(_0x4a8b9a){return BPromise['reject'](_0x4a8b9a);}return _0x237d40['save']();};}function saveUpdates(_0x45a85c,_0xb77f43){return function(_0x367a76){if(_0x367a76){return _0x367a76[_0x7d58('0x1c')](_0x45a85c)[_0x7d58('0x1d')](function(_0x1ee491){return _0x1ee491;});}return null;};}function removeEntity(_0x4e2b3e,_0x2011f1){return function(_0x5631dc){if(_0x5631dc){return _0x5631dc[_0x7d58('0x1e')]()[_0x7d58('0x1d')](function(){var _0x26fb76=_0x5631dc['get']({'plain':!![]});var _0x5851dd=_0x7d58('0x1f');return db['UserProfileResource'][_0x7d58('0x1e')]({'where':{'type':_0x5851dd,'resourceId':_0x26fb76['id']}})['then'](function(){return _0x5631dc;});})[_0x7d58('0x1d')](function(){_0x4e2b3e[_0x7d58('0x16')](0xcc)[_0x7d58('0x20')]();});}};}function handleEntityNotFound(_0x596081,_0x1d2b5d){return function(_0x3057b0){if(!_0x3057b0){_0x596081[_0x7d58('0x15')](0x194);}return _0x3057b0;};}function handleError(_0x53107c,_0x36170e){_0x36170e=_0x36170e||0x1f4;return function(_0x2ca645){logger['error'](_0x2ca645[_0x7d58('0x21')]);if(_0x2ca645[_0x7d58('0x22')]){delete _0x2ca645['name'];}_0x53107c[_0x7d58('0x16')](_0x36170e)[_0x7d58('0x23')](_0x2ca645);};}exports[_0x7d58('0x24')]=function(_0x500aad,_0xdd82c0){var _0x531093={},_0x10f2fb={},_0x3a789a={'count':0x0,'rows':[]};var _0x4cd1a0=_[_0x7d58('0x25')](db[_0x7d58('0x26')][_0x7d58('0x27')],function(_0x139959){return{'name':_0x139959[_0x7d58('0x28')],'type':_0x139959[_0x7d58('0x29')][_0x7d58('0x2a')]};});_0x10f2fb[_0x7d58('0x2b')]=_[_0x7d58('0x25')](_0x4cd1a0,_0x7d58('0x22'));_0x10f2fb[_0x7d58('0x2c')]=_[_0x7d58('0x2d')](_0x500aad[_0x7d58('0x2c')]);_0x10f2fb[_0x7d58('0x2e')]=_['intersection'](_0x10f2fb['model'],_0x10f2fb['query']);_0x531093[_0x7d58('0x2f')]=_['intersection'](_0x10f2fb[_0x7d58('0x2b')],qs[_0x7d58('0x30')](_0x500aad[_0x7d58('0x2c')]['fields']));_0x531093[_0x7d58('0x2f')]=_0x531093['attributes'][_0x7d58('0x31')]?_0x531093[_0x7d58('0x2f')]:_0x10f2fb[_0x7d58('0x2b')];if(!_0x500aad[_0x7d58('0x2c')][_0x7d58('0x32')](_0x7d58('0x33'))){_0x531093[_0x7d58('0x1a')]=qs[_0x7d58('0x1a')](_0x500aad[_0x7d58('0x2c')][_0x7d58('0x1a')]);_0x531093[_0x7d58('0x19')]=qs['offset'](_0x500aad[_0x7d58('0x2c')][_0x7d58('0x19')]);}_0x531093['order']=qs['sort'](_0x500aad[_0x7d58('0x2c')][_0x7d58('0x34')]);_0x531093[_0x7d58('0x35')]=qs[_0x7d58('0x2e')](_[_0x7d58('0x36')](_0x500aad['query'],_0x10f2fb[_0x7d58('0x2e')]),_0x4cd1a0);if(_0x500aad[_0x7d58('0x2c')][_0x7d58('0x37')]){_0x531093[_0x7d58('0x35')]=_[_0x7d58('0x38')](_0x531093[_0x7d58('0x35')],{'$or':_[_0x7d58('0x25')](_0x4cd1a0,function(_0x3a6155){if(_0x3a6155[_0x7d58('0x29')]!==_0x7d58('0x39')){var _0x40ebe8={};_0x40ebe8[_0x3a6155[_0x7d58('0x22')]]={'$like':'%'+_0x500aad[_0x7d58('0x2c')][_0x7d58('0x37')]+'%'};return _0x40ebe8;}})});}_0x531093=_[_0x7d58('0x38')]({},_0x531093,_0x500aad[_0x7d58('0x3a')]);var _0x590ca0={'where':_0x531093['where']};return db[_0x7d58('0x26')][_0x7d58('0x18')](_0x590ca0)[_0x7d58('0x1d')](function(_0xc6f381){_0x3a789a[_0x7d58('0x18')]=_0xc6f381;if(_0x500aad[_0x7d58('0x2c')][_0x7d58('0x3b')]){_0x531093[_0x7d58('0x3c')]=[{'all':!![]}];}return db[_0x7d58('0x26')]['findAll'](_0x531093);})[_0x7d58('0x1d')](function(_0x28d7c9){_0x3a789a[_0x7d58('0x3d')]=_0x28d7c9;return _0x3a789a;})['then'](respondWithFilteredResult(_0xdd82c0,_0x531093))['catch'](handleError(_0xdd82c0,null));};exports[_0x7d58('0x3e')]=function(_0x272cce,_0x1fff53){var _0x293ba9={'raw':!![],'where':{'id':_0x272cce['params']['id']}},_0x3d41c9={};_0x3d41c9[_0x7d58('0x2b')]=_['keys'](db[_0x7d58('0x26')][_0x7d58('0x27')]);_0x3d41c9[_0x7d58('0x2c')]=_[_0x7d58('0x2d')](_0x272cce[_0x7d58('0x2c')]);_0x3d41c9['filters']=_[_0x7d58('0x3f')](_0x3d41c9[_0x7d58('0x2b')],_0x3d41c9['query']);_0x293ba9['attributes']=_['intersection'](_0x3d41c9['model'],qs['fields'](_0x272cce[_0x7d58('0x2c')]['fields']));_0x293ba9[_0x7d58('0x2f')]=_0x293ba9[_0x7d58('0x2f')][_0x7d58('0x31')]?_0x293ba9[_0x7d58('0x2f')]:_0x3d41c9[_0x7d58('0x2b')];if(_0x272cce[_0x7d58('0x2c')][_0x7d58('0x3b')]){_0x293ba9[_0x7d58('0x3c')]=[{'all':!![]}];}_0x293ba9=_['merge']({},_0x293ba9,_0x272cce[_0x7d58('0x3a')]);return db[_0x7d58('0x26')]['find'](_0x293ba9)[_0x7d58('0x1d')](handleEntityNotFound(_0x1fff53,null))[_0x7d58('0x1d')](respondWithResult(_0x1fff53,null))['catch'](handleError(_0x1fff53,null));};exports[_0x7d58('0x40')]=function(_0x3ab83f,_0x355337){return db[_0x7d58('0x26')]['create'](_0x3ab83f['body'],{})[_0x7d58('0x1d')](function(_0x2196ce){var _0x2aad08=_0x3ab83f[_0x7d58('0x41')][_0x7d58('0x42')]({'plain':!![]});if(!_0x2aad08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2aad08[_0x7d58('0x43')]==='user'){var _0x326574=_0x2196ce[_0x7d58('0x42')]({'plain':!![]});var _0x2d3bed=_0x7d58('0x1f');return db[_0x7d58('0x44')][_0x7d58('0x45')]({'where':{'name':_0x2d3bed,'userProfileId':_0x2aad08['userProfileId']},'raw':!![]})[_0x7d58('0x1d')](function(_0x1b4105){if(_0x1b4105&&_0x1b4105[_0x7d58('0x46')]===0x0){return db[_0x7d58('0x47')][_0x7d58('0x40')]({'name':_0x326574[_0x7d58('0x22')],'resourceId':_0x326574['id'],'type':_0x1b4105[_0x7d58('0x22')],'sectionId':_0x1b4105['id']},{})['then'](function(){return _0x2196ce;});}else{return _0x2196ce;}})[_0x7d58('0x48')](function(_0x2eef8a){logger[_0x7d58('0x49')](_0x7d58('0x4a'),_0x2eef8a);throw _0x2eef8a;});}return _0x2196ce;})[_0x7d58('0x1d')](respondWithResult(_0x355337,0xc9))[_0x7d58('0x48')](handleError(_0x355337,null));};exports[_0x7d58('0x1c')]=function(_0x48ba2a,_0x394150){if(_0x48ba2a[_0x7d58('0x4b')]['id']){delete _0x48ba2a[_0x7d58('0x4b')]['id'];}return db[_0x7d58('0x26')][_0x7d58('0x45')]({'where':{'id':_0x48ba2a[_0x7d58('0x4c')]['id']}})['then'](handleEntityNotFound(_0x394150,null))[_0x7d58('0x1d')](saveUpdates(_0x48ba2a[_0x7d58('0x4b')],null))[_0x7d58('0x1d')](respondWithResult(_0x394150,null))['catch'](handleError(_0x394150,null));};exports[_0x7d58('0x1e')]=function(_0x4da0bd,_0x5ecdcf){return db[_0x7d58('0x26')][_0x7d58('0x45')]({'where':{'id':_0x4da0bd[_0x7d58('0x4c')]['id']}})[_0x7d58('0x1d')](handleEntityNotFound(_0x5ecdcf,null))[_0x7d58('0x1d')](removeEntity(_0x5ecdcf,null))[_0x7d58('0x48')](handleError(_0x5ecdcf,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 8f50094..fc334af 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 _0xf72b=['./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x467cc1,_0x2efb98){var _0x23041a=function(_0x4c59bd){while(--_0x4c59bd){_0x467cc1['push'](_0x467cc1['shift']());}};_0x23041a(++_0x2efb98);}(_0xf72b,0x1d9));var _0xbf72=function(_0x1d9d88,_0x1b41c9){_0x1d9d88=_0x1d9d88-0x0;var _0x39ee63=_0xf72b[_0x1d9d88];return _0x39ee63;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd187=['cm_contact_has_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define'];(function(_0x5f02ba,_0x5c4427){var _0x45b6d9=function(_0x5b35b8){while(--_0x5b35b8){_0x5f02ba['push'](_0x5f02ba['shift']());}};_0x45b6d9(++_0x5c4427);}(_0xd187,0x90));var _0x7d18=function(_0x31ec29,_0x58915c){_0x31ec29=_0x31ec29-0x0;var _0x3275fc=_0xd187[_0x31ec29];return _0x3275fc;};'use strict';var _=require(_0x7d18('0x0'));var util=require(_0x7d18('0x1'));var logger=require(_0x7d18('0x2'))('api');var moment=require(_0x7d18('0x3'));var BPromise=require(_0x7d18('0x4'));var rp=require(_0x7d18('0x5'));var fs=require('fs');var path=require(_0x7d18('0x6'));var rimraf=require(_0x7d18('0x7'));var config=require(_0x7d18('0x8'));var attributes=require(_0x7d18('0x9'));module[_0x7d18('0xa')]=function(_0x520109,_0x30e2bd){return _0x520109[_0x7d18('0xb')]('CmContactHasPhone',attributes,{'tableName':_0x7d18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 82d5ea8..4cde4ae 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 _0xd677=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd677,0x88));var _0x7d67=function(_0xc048e2,_0x3825ef){_0xc048e2=_0xc048e2-0x0;var _0x4012ed=_0xd677[_0xc048e2];return _0x4012ed;};'use strict';var _=require(_0x7d67('0x0'));var util=require('util');var moment=require(_0x7d67('0x1'));var BPromise=require(_0x7d67('0x2'));var rs=require(_0x7d67('0x3'));var fs=require('fs');var Redis=require(_0x7d67('0x4'));var db=require(_0x7d67('0x5'))['db'];var utils=require(_0x7d67('0x6'));var logger=require('../../config/logger')(_0x7d67('0x7'));var config=require(_0x7d67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d67('0x9')][_0x7d67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x203640,_0x34b0dd,_0x4f6fae){return new BPromise(function(_0x32952a,_0x2e5f25){return client[_0x7d67('0xb')](_0x203640,_0x4f6fae)[_0x7d67('0xc')](function(_0x33cd51){logger['info'](_0x7d67('0xd'),_0x34b0dd,_0x7d67('0xe'));logger[_0x7d67('0xf')](_0x7d67('0x10'),_0x34b0dd,_0x7d67('0xe'),JSON[_0x7d67('0x11')](_0x33cd51));if(_0x33cd51[_0x7d67('0x12')]){if(_0x33cd51[_0x7d67('0x12')][_0x7d67('0x13')]===0x1f4){logger[_0x7d67('0x12')](_0x7d67('0xd'),_0x34b0dd,_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);return _0x2e5f25(_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);}logger[_0x7d67('0x12')]('CmContactHasPhone,\x20%s,\x20%s',_0x34b0dd,_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);return _0x32952a(_0x33cd51[_0x7d67('0x12')][_0x7d67('0x14')]);}else{logger['info'](_0x7d67('0xd'),_0x34b0dd,'request\x20sent');_0x32952a(_0x33cd51[_0x7d67('0x15')][_0x7d67('0x14')]);}})[_0x7d67('0x16')](function(_0x3d5572){logger['error'](_0x7d67('0xd'),_0x34b0dd,_0x3d5572);_0x2e5f25(_0x3d5572);});});} \ No newline at end of file +var _0x2342=['request','info','CmContactHasPhone,\x20%s,\x20%s','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xeb8b1c,_0x59fee9){var _0x37fb25=function(_0x171691){while(--_0x171691){_0xeb8b1c['push'](_0xeb8b1c['shift']());}};_0x37fb25(++_0x59fee9);}(_0x2342,0xdf));var _0x2234=function(_0x23903b,_0xcdfff){_0x23903b=_0x23903b-0x0;var _0x2a76f6=_0x2342[_0x23903b];return _0x2a76f6;};'use strict';var _=require('lodash');var util=require(_0x2234('0x0'));var moment=require(_0x2234('0x1'));var BPromise=require(_0x2234('0x2'));var rs=require(_0x2234('0x3'));var fs=require('fs');var Redis=require(_0x2234('0x4'));var db=require(_0x2234('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2234('0x6'))('rpc');var config=require(_0x2234('0x7'));var jayson=require(_0x2234('0x8'));var client=jayson[_0x2234('0x9')][_0x2234('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43181a,_0x3de78b,_0x3e5197){return new BPromise(function(_0x519100,_0x3c0b6e){return client[_0x2234('0xb')](_0x43181a,_0x3e5197)['then'](function(_0x5469fe){logger[_0x2234('0xc')](_0x2234('0xd'),_0x3de78b,'request\x20sent');logger['debug'](_0x2234('0xe'),_0x3de78b,_0x2234('0xf'),JSON['stringify'](_0x5469fe));if(_0x5469fe[_0x2234('0x10')]){if(_0x5469fe['error']['code']===0x1f4){logger[_0x2234('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x3de78b,_0x5469fe[_0x2234('0x10')]['message']);return _0x3c0b6e(_0x5469fe[_0x2234('0x10')][_0x2234('0x11')]);}logger[_0x2234('0x10')](_0x2234('0xd'),_0x3de78b,_0x5469fe[_0x2234('0x10')][_0x2234('0x11')]);return _0x519100(_0x5469fe['error'][_0x2234('0x11')]);}else{logger[_0x2234('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x3de78b,'request\x20sent');_0x519100(_0x5469fe['result'][_0x2234('0x11')]);}})['catch'](function(_0x1049f0){logger[_0x2234('0x10')](_0x2234('0xd'),_0x3de78b,_0x1049f0);_0x3c0b6e(_0x1049f0);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 4267a48..284e884 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 _0xa572=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','isAuthenticated','post','put','/:id','update'];(function(_0x23b671,_0x37c762){var _0x49689f=function(_0x49e395){while(--_0x49e395){_0x23b671['push'](_0x23b671['shift']());}};_0x49689f(++_0x37c762);}(_0xa572,0x1a5));var _0x2a57=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0xa572[_0x4ca333];return _0x13b2e1;};'use strict';var multer=require(_0x2a57('0x0'));var util=require(_0x2a57('0x1'));var path=require(_0x2a57('0x2'));var timeout=require(_0x2a57('0x3'));var express=require(_0x2a57('0x4'));var router=express[_0x2a57('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2a57('0x6'));var config=require(_0x2a57('0x7'));var controller=require(_0x2a57('0x8'));router[_0x2a57('0x9')]('/',auth['isAuthenticated'](),controller[_0x2a57('0xa')]);router[_0x2a57('0x9')]('/:id',auth[_0x2a57('0xb')](),controller['show']);router[_0x2a57('0xc')]('/',auth[_0x2a57('0xb')](),controller['create']);router[_0x2a57('0xd')](_0x2a57('0xe'),auth[_0x2a57('0xb')](),controller[_0x2a57('0xf')]);router[_0x2a57('0x10')]('/:id',auth[_0x2a57('0xb')](),controller[_0x2a57('0x11')]);module[_0x2a57('0x12')]=router; \ No newline at end of file +var _0x7b1a=['create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller','isAuthenticated','get','/:id','show','post'];(function(_0x2f762f,_0x5abc1d){var _0x24669b=function(_0xadf02b){while(--_0xadf02b){_0x2f762f['push'](_0x2f762f['shift']());}};_0x24669b(++_0x5abc1d);}(_0x7b1a,0xdd));var _0xa7b1=function(_0x5dee75,_0x25bc35){_0x5dee75=_0x5dee75-0x0;var _0x2d7837=_0x7b1a[_0x5dee75];return _0x2d7837;};'use strict';var multer=require(_0xa7b1('0x0'));var util=require('util');var path=require(_0xa7b1('0x1'));var timeout=require(_0xa7b1('0x2'));var express=require(_0xa7b1('0x3'));var router=express[_0xa7b1('0x4')]();var auth=require(_0xa7b1('0x5'));var interaction=require(_0xa7b1('0x6'));var config=require('../../config/environment');var controller=require(_0xa7b1('0x7'));router['get']('/',auth[_0xa7b1('0x8')](),controller['index']);router[_0xa7b1('0x9')](_0xa7b1('0xa'),auth['isAuthenticated'](),controller[_0xa7b1('0xb')]);router[_0xa7b1('0xc')]('/',auth[_0xa7b1('0x8')](),controller[_0xa7b1('0xd')]);router[_0xa7b1('0xe')](_0xa7b1('0xa'),auth[_0xa7b1('0x8')](),controller['update']);router[_0xa7b1('0xf')]('/:id',auth[_0xa7b1('0x8')](),controller[_0xa7b1('0x10')]);module[_0xa7b1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8c8624c..014d7f0 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 _0xfd93=['stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray'];(function(_0x4f5547,_0xffd557){var _0x5a69ce=function(_0x384b92){while(--_0x384b92){_0x4f5547['push'](_0x4f5547['shift']());}};_0x5a69ce(++_0xffd557);}(_0xfd93,0x101));var _0x3fd9=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xfd93[_0x4d05a0];return _0x4c999c;};'use strict';var Sequelize=require(_0x3fd9('0x0'));var _=require(_0x3fd9('0x1'));module[_0x3fd9('0x2')]={'name':{'type':Sequelize[_0x3fd9('0x3')],'get':function(_0x2dfd17){return this[_0x3fd9('0x4')](_0x3fd9('0x5'));}},'alias':{'type':Sequelize[_0x3fd9('0x6')],'allowNull':![],'set':function(_0x3e919b){this[_0x3fd9('0x7')]('alias',_0x3e919b?_0x3e919b:this['getDataValue'](_0x3fd9('0x8')));}},'type':{'type':Sequelize[_0x3fd9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3fd9('0x9')](_0x3fd9('0xa')),'get':function(){if(this[_0x3fd9('0x4')]('type')===_0x3fd9('0xb')){return JSON[_0x3fd9('0xc')](this[_0x3fd9('0x4')](_0x3fd9('0xd')));}else{return this['getDataValue'](_0x3fd9('0xd'));}},'set':function(_0x1325c1){if(Array[_0x3fd9('0xe')](_0x1325c1)){this[_0x3fd9('0x7')](_0x3fd9('0xd'),JSON[_0x3fd9('0xf')](_0x1325c1));}else{this[_0x3fd9('0x7')](_0x3fd9('0xd'),_0x1325c1);}}},'required':{'type':Sequelize[_0x3fd9('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x720a=['alias','name','TEXT','type','values','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue'];(function(_0x81d9b4,_0x74c503){var _0x5051f6=function(_0x5eb9bb){while(--_0x5eb9bb){_0x81d9b4['push'](_0x81d9b4['shift']());}};_0x5051f6(++_0x74c503);}(_0x720a,0x13e));var _0xa720=function(_0x455d63,_0x2ee072){_0x455d63=_0x455d63-0x0;var _0x368dcf=_0x720a[_0x455d63];return _0x368dcf;};'use strict';var Sequelize=require(_0xa720('0x0'));var _=require('lodash');module[_0xa720('0x1')]={'name':{'type':Sequelize[_0xa720('0x2')],'get':function(_0x4b01c3){return this[_0xa720('0x3')]('alias');}},'alias':{'type':Sequelize[_0xa720('0x4')],'allowNull':![],'set':function(_0x2aa50e){this[_0xa720('0x5')](_0xa720('0x6'),_0x2aa50e?_0x2aa50e:this[_0xa720('0x3')](_0xa720('0x7')));}},'type':{'type':Sequelize[_0xa720('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa720('0x8')]('long'),'get':function(){if(this[_0xa720('0x3')](_0xa720('0x9'))==='select'){return JSON['parse'](this['getDataValue']('values'));}else{return this[_0xa720('0x3')](_0xa720('0xa'));}},'set':function(_0x5d049f){if(Array['isArray'](_0x5d049f)){this[_0xa720('0x5')]('values',JSON['stringify'](_0x5d049f));}else{this[_0xa720('0x5')](_0xa720('0xa'),_0x5d049f);}}},'required':{'type':Sequelize[_0xa720('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 504ed66..9966fdb 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 _0xa0dd=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','CmCustomField','rawAttributes','type','key','differenceBy','keys','query','filters'];(function(_0x4dab8e,_0x2de10b){var _0x2eacf5=function(_0x413a7a){while(--_0x413a7a){_0x4dab8e['push'](_0x4dab8e['shift']());}};_0x2eacf5(++_0x2de10b);}(_0xa0dd,0x172));var _0xda0d=function(_0x3d9cef,_0x13bc7a){_0x3d9cef=_0x3d9cef-0x0;var _0x45aad9=_0xa0dd[_0x3d9cef];return _0x45aad9;};'use strict';var pdf=require(_0xda0d('0x0'));var emlformat=require(_0xda0d('0x1'));var rimraf=require(_0xda0d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda0d('0x3'));var rp=require(_0xda0d('0x4'));var moment=require(_0xda0d('0x5'));var BPromise=require(_0xda0d('0x6'));var Mustache=require(_0xda0d('0x7'));var util=require(_0xda0d('0x8'));var path=require(_0xda0d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xda0d('0xa'));var squel=require(_0xda0d('0xb'));var crypto=require(_0xda0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xda0d('0xd'));var querystring=require(_0xda0d('0xe'));var Papa=require('papaparse');var Redis=require(_0xda0d('0xf'));var authService=require(_0xda0d('0x10'));var qs=require(_0xda0d('0x11'));var as=require(_0xda0d('0x12'));var hardwareService=require(_0xda0d('0x13'));var logger=require(_0xda0d('0x14'))(_0xda0d('0x15'));var utils=require('../../config/utils');var config=require(_0xda0d('0x16'));var db=require(_0xda0d('0x17'))['db'];function respondWithStatusCode(_0x478e4e,_0x3edc5f){_0x3edc5f=_0x3edc5f||0xcc;return function(_0x1bb803){if(_0x1bb803){return _0x478e4e[_0xda0d('0x18')](_0x3edc5f);}return _0x478e4e[_0xda0d('0x19')](_0x3edc5f)[_0xda0d('0x1a')]();};}function respondWithResult(_0x5a2666,_0x2186f4){_0x2186f4=_0x2186f4||0xc8;return function(_0x15c417){if(_0x15c417){return _0x5a2666[_0xda0d('0x19')](_0x2186f4)[_0xda0d('0x1b')](_0x15c417);}};}function respondWithFilteredResult(_0x437748,_0x1b3d9f){return function(_0x51fc3f){if(_0x51fc3f){var _0x3f68b9=_0x51fc3f[_0xda0d('0x1c')],_0x155fcb=_0x1b3d9f[_0xda0d('0x1d')],_0x50b544=_0x1b3d9f[_0xda0d('0x1d')]+_0x1b3d9f[_0xda0d('0x1e')],_0x2e27da;if(_0x50b544>=_0x3f68b9){_0x50b544=_0x3f68b9;_0x2e27da=0xc8;}else{_0x2e27da=0xce;}_0x437748[_0xda0d('0x19')](_0x2e27da);return _0x437748[_0xda0d('0x1f')](_0xda0d('0x20'),_0x155fcb+'-'+_0x50b544+'/'+_0x3f68b9)[_0xda0d('0x1b')](_0x51fc3f);}return null;};}function patchUpdates(_0x18d4da){return function(_0x5f2c19){try{jsonpatch[_0xda0d('0x21')](_0x5f2c19,_0x18d4da,!![]);}catch(_0x1b65a9){return BPromise[_0xda0d('0x22')](_0x1b65a9);}return _0x5f2c19[_0xda0d('0x23')]();};}function saveUpdates(_0x683fc6,_0xdda438){return function(_0x5fb9a2){if(_0x5fb9a2){return _0x5fb9a2[_0xda0d('0x24')](_0x683fc6)[_0xda0d('0x25')](function(_0x57c3e0){return _0x57c3e0;});}return null;};}function removeEntity(_0x14e3d5,_0x23ec7d){return function(_0x4b8910){if(_0x4b8910){return _0x4b8910[_0xda0d('0x26')]()[_0xda0d('0x25')](function(){_0x14e3d5[_0xda0d('0x19')](0xcc)[_0xda0d('0x1a')]();});}};}function handleEntityNotFound(_0x365947,_0x2e89fe){return function(_0x36a387){if(!_0x36a387){_0x365947['sendStatus'](0x194);}return _0x36a387;};}function handleError(_0x3d6034,_0x5562b1){_0x5562b1=_0x5562b1||0x1f4;return function(_0x280b0f){logger['error'](_0x280b0f[_0xda0d('0x27')]);if(_0x280b0f['name']){delete _0x280b0f[_0xda0d('0x28')];}_0x3d6034[_0xda0d('0x19')](_0x5562b1)['send'](_0x280b0f);};}exports['index']=function(_0x45ebc0,_0x2035be){var _0x7335d7={},_0x19042b={},_0xb48a71={'count':0x0,'rows':[]};var _0x401af7=_[_0xda0d('0x29')](db[_0xda0d('0x2a')][_0xda0d('0x2b')],function(_0x32c9b8){return{'name':_0x32c9b8['fieldName'],'type':_0x32c9b8[_0xda0d('0x2c')][_0xda0d('0x2d')]};});_0x19042b['model']=_[_0xda0d('0x2e')](_['map'](_0x401af7,'name'),[_0xda0d('0x28')]);_0x19042b['query']=_[_0xda0d('0x2f')](_0x45ebc0[_0xda0d('0x30')]);_0x19042b[_0xda0d('0x31')]=_[_0xda0d('0x32')](_0x19042b[_0xda0d('0x33')],_0x19042b[_0xda0d('0x30')]);_0x7335d7[_0xda0d('0x34')]=_[_0xda0d('0x32')](_0x19042b['model'],qs[_0xda0d('0x35')](_0x45ebc0['query'][_0xda0d('0x35')]));_0x7335d7[_0xda0d('0x34')]=_0x7335d7['attributes'][_0xda0d('0x36')]?_0x7335d7[_0xda0d('0x34')]:_0x19042b[_0xda0d('0x33')];if(!_0x45ebc0['query'][_0xda0d('0x37')]('nolimit')){_0x7335d7[_0xda0d('0x1e')]=qs[_0xda0d('0x1e')](_0x45ebc0['query'][_0xda0d('0x1e')]);_0x7335d7[_0xda0d('0x1d')]=qs['offset'](_0x45ebc0['query'][_0xda0d('0x1d')]);}_0x7335d7[_0xda0d('0x38')]=qs[_0xda0d('0x39')](_0x45ebc0['query'][_0xda0d('0x39')]);_0x7335d7[_0xda0d('0x3a')]=qs[_0xda0d('0x31')](_[_0xda0d('0x3b')](_0x45ebc0[_0xda0d('0x30')],_0x19042b[_0xda0d('0x31')]),_0x401af7);if(_0x45ebc0['query'][_0xda0d('0x3c')]){_0x7335d7[_0xda0d('0x3a')]=_[_0xda0d('0x3d')](_0x7335d7[_0xda0d('0x3a')],{'$or':_[_0xda0d('0x29')](_0x401af7,function(_0x7164c3){if(_0x7164c3[_0xda0d('0x2c')]!==_0xda0d('0x3e')){var _0x514d25={};_0x514d25[_0x7164c3[_0xda0d('0x28')]]={'$like':'%'+_0x45ebc0[_0xda0d('0x30')]['filter']+'%'};return _0x514d25;}})});}_0x7335d7=_[_0xda0d('0x3d')]({},_0x7335d7,_0x45ebc0[_0xda0d('0x3f')]);var _0x44933d={'where':_0x7335d7[_0xda0d('0x3a')]};return db[_0xda0d('0x2a')][_0xda0d('0x1c')](_0x44933d)[_0xda0d('0x25')](function(_0x26e1cf){_0xb48a71[_0xda0d('0x1c')]=_0x26e1cf;if(_0x45ebc0[_0xda0d('0x30')]['includeAll']){_0x7335d7['include']=[{'all':!![]}];}return db[_0xda0d('0x2a')]['findAll'](_0x7335d7);})[_0xda0d('0x25')](function(_0x3cb237){_0xb48a71[_0xda0d('0x40')]=_0x3cb237;return _0xb48a71;})[_0xda0d('0x25')](respondWithFilteredResult(_0x2035be,_0x7335d7))[_0xda0d('0x41')](handleError(_0x2035be,null));};exports[_0xda0d('0x42')]=function(_0x53da8f,_0x32b94c){var _0x4bbb7f={'raw':!![],'where':{'id':_0x53da8f['params']['id']}},_0xf8565={};_0xf8565[_0xda0d('0x33')]=_[_0xda0d('0x2f')](db[_0xda0d('0x2a')][_0xda0d('0x2b')]);_0xf8565[_0xda0d('0x30')]=_[_0xda0d('0x2f')](_0x53da8f[_0xda0d('0x30')]);_0xf8565[_0xda0d('0x31')]=_[_0xda0d('0x32')](_0xf8565[_0xda0d('0x33')],_0xf8565[_0xda0d('0x30')]);_0x4bbb7f[_0xda0d('0x34')]=_[_0xda0d('0x32')](_0xf8565[_0xda0d('0x33')],qs[_0xda0d('0x35')](_0x53da8f[_0xda0d('0x30')][_0xda0d('0x35')]));_0x4bbb7f[_0xda0d('0x34')]=_0x4bbb7f[_0xda0d('0x34')][_0xda0d('0x36')]?_0x4bbb7f[_0xda0d('0x34')]:_0xf8565[_0xda0d('0x33')];if(_0x53da8f[_0xda0d('0x30')][_0xda0d('0x43')]){_0x4bbb7f[_0xda0d('0x44')]=[{'all':!![]}];}_0x4bbb7f=_[_0xda0d('0x3d')]({},_0x4bbb7f,_0x53da8f[_0xda0d('0x3f')]);return db[_0xda0d('0x2a')][_0xda0d('0x45')](_0x4bbb7f)[_0xda0d('0x25')](handleEntityNotFound(_0x32b94c,null))[_0xda0d('0x25')](respondWithResult(_0x32b94c,null))[_0xda0d('0x41')](handleError(_0x32b94c,null));};exports['update']=function(_0x749af8,_0xf59f53){if(_0x749af8['body']['id']){delete _0x749af8[_0xda0d('0x46')]['id'];}return db[_0xda0d('0x2a')]['find']({'where':{'id':_0x749af8[_0xda0d('0x47')]['id']}})[_0xda0d('0x25')](handleEntityNotFound(_0xf59f53,null))[_0xda0d('0x25')](saveUpdates(_0x749af8['body'],null))[_0xda0d('0x25')](respondWithResult(_0xf59f53,null))[_0xda0d('0x41')](handleError(_0xf59f53,null));};exports[_0xda0d('0x26')]=function(_0x383d8a,_0x30205b){return db['CmCustomField'][_0xda0d('0x45')]({'where':{'id':_0x383d8a[_0xda0d('0x47')]['id']}})[_0xda0d('0x25')](handleEntityNotFound(_0x30205b,null))[_0xda0d('0x25')](removeEntity(_0x30205b,null))[_0xda0d('0x41')](handleError(_0x30205b,null));};exports[_0xda0d('0x48')]=function(_0xf0ad7f,_0x18f16a){var _0x4e6778;return db[_0xda0d('0x49')][_0xda0d('0x4a')](function(_0xecd2b7){return db[_0xda0d('0x2a')][_0xda0d('0x48')](_0xf0ad7f[_0xda0d('0x46')],{'transaction':_0xecd2b7})[_0xda0d('0x25')](function(_0x404111){_0x4e6778=_0x404111;var _0x1c8d2f={'type':db[_0xda0d('0x4b')][_0xda0d('0x4c')],'transaction':_0xecd2b7};switch(_0xf0ad7f[_0xda0d('0x46')][_0xda0d('0x2c')]){case _0xda0d('0x4d'):_0x1c8d2f[_0xda0d('0x2c')]=db[_0xda0d('0x4b')][_0xda0d('0x4c')];break;case _0xda0d('0x4e'):_0x1c8d2f[_0xda0d('0x2c')]=db[_0xda0d('0x4b')][_0xda0d('0x4f')];break;case'switch':_0x1c8d2f[_0xda0d('0x2c')]=db[_0xda0d('0x4b')]['BOOLEAN'];_0x1c8d2f[_0xda0d('0x50')]=![];break;default:}return db[_0xda0d('0x49')][_0xda0d('0x51')][_0xda0d('0x52')]('cm_contacts',util['format'](_0xda0d('0x53'),_0x4e6778['id']),_0x1c8d2f);})[_0xda0d('0x25')](function(){return _0x4e6778;});})['then'](respondWithResult(_0x18f16a,0xc9))['catch'](handleError(_0x18f16a,null));}; \ No newline at end of file +var _0x80a2=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','update','body','find','destroy','create','sequelize','TEXT','Sequelize','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x335136,_0x131d00){var _0x234b60=function(_0x1ba3a8){while(--_0x1ba3a8){_0x335136['push'](_0x335136['shift']());}};_0x234b60(++_0x131d00);}(_0x80a2,0xf9));var _0x280a=function(_0x2e8935,_0x15d23b){_0x2e8935=_0x2e8935-0x0;var _0x57b7f5=_0x80a2[_0x2e8935];return _0x57b7f5;};'use strict';var pdf=require(_0x280a('0x0'));var emlformat=require(_0x280a('0x1'));var rimraf=require(_0x280a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x280a('0x3'));var rp=require(_0x280a('0x4'));var moment=require(_0x280a('0x5'));var BPromise=require(_0x280a('0x6'));var Mustache=require(_0x280a('0x7'));var util=require(_0x280a('0x8'));var path=require(_0x280a('0x9'));var sox=require(_0x280a('0xa'));var csv=require(_0x280a('0xb'));var ejs=require(_0x280a('0xc'));var fs=require('fs');var _=require(_0x280a('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x280a('0xb'));var querystring=require(_0x280a('0xe'));var Papa=require(_0x280a('0xf'));var Redis=require(_0x280a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x280a('0x11'));var as=require(_0x280a('0x12'));var hardwareService=require(_0x280a('0x13'));var logger=require('../../config/logger')(_0x280a('0x14'));var utils=require(_0x280a('0x15'));var config=require(_0x280a('0x16'));var db=require(_0x280a('0x17'))['db'];function respondWithStatusCode(_0x244c47,_0x335848){_0x335848=_0x335848||0xcc;return function(_0x5e140f){if(_0x5e140f){return _0x244c47[_0x280a('0x18')](_0x335848);}return _0x244c47[_0x280a('0x19')](_0x335848)[_0x280a('0x1a')]();};}function respondWithResult(_0x529a4e,_0x59a81a){_0x59a81a=_0x59a81a||0xc8;return function(_0x914798){if(_0x914798){return _0x529a4e['status'](_0x59a81a)[_0x280a('0x1b')](_0x914798);}};}function respondWithFilteredResult(_0x22f93f,_0x2fb53b){return function(_0x48fcfb){if(_0x48fcfb){var _0x329124=_0x48fcfb[_0x280a('0x1c')],_0x148252=_0x2fb53b[_0x280a('0x1d')],_0x17e1ed=_0x2fb53b[_0x280a('0x1d')]+_0x2fb53b['limit'],_0x54ca29;if(_0x17e1ed>=_0x329124){_0x17e1ed=_0x329124;_0x54ca29=0xc8;}else{_0x54ca29=0xce;}_0x22f93f[_0x280a('0x19')](_0x54ca29);return _0x22f93f[_0x280a('0x1e')](_0x280a('0x1f'),_0x148252+'-'+_0x17e1ed+'/'+_0x329124)[_0x280a('0x1b')](_0x48fcfb);}return null;};}function patchUpdates(_0x96f3c6){return function(_0x51a025){try{jsonpatch[_0x280a('0x20')](_0x51a025,_0x96f3c6,!![]);}catch(_0x6a53b5){return BPromise[_0x280a('0x21')](_0x6a53b5);}return _0x51a025[_0x280a('0x22')]();};}function saveUpdates(_0x572add,_0x2d30c3){return function(_0x5d56f2){if(_0x5d56f2){return _0x5d56f2['update'](_0x572add)[_0x280a('0x23')](function(_0x4f28a6){return _0x4f28a6;});}return null;};}function removeEntity(_0x5225f3,_0x376983){return function(_0x179107){if(_0x179107){return _0x179107['destroy']()[_0x280a('0x23')](function(){_0x5225f3[_0x280a('0x19')](0xcc)[_0x280a('0x1a')]();});}};}function handleEntityNotFound(_0x411322,_0x2873b0){return function(_0x1a2936){if(!_0x1a2936){_0x411322[_0x280a('0x18')](0x194);}return _0x1a2936;};}function handleError(_0x28f505,_0x444db7){_0x444db7=_0x444db7||0x1f4;return function(_0x5823e2){logger['error'](_0x5823e2[_0x280a('0x24')]);if(_0x5823e2[_0x280a('0x25')]){delete _0x5823e2[_0x280a('0x25')];}_0x28f505[_0x280a('0x19')](_0x444db7)['send'](_0x5823e2);};}exports[_0x280a('0x26')]=function(_0x2ab4a0,_0x50acce){var _0x1e59e8={},_0x3a759e={},_0x1eec6e={'count':0x0,'rows':[]};var _0x2cf2a8=_[_0x280a('0x27')](db[_0x280a('0x28')][_0x280a('0x29')],function(_0x4141f9){return{'name':_0x4141f9[_0x280a('0x2a')],'type':_0x4141f9[_0x280a('0x2b')][_0x280a('0x2c')]};});_0x3a759e[_0x280a('0x2d')]=_['differenceBy'](_['map'](_0x2cf2a8,_0x280a('0x25')),[_0x280a('0x25')]);_0x3a759e[_0x280a('0x2e')]=_[_0x280a('0x2f')](_0x2ab4a0['query']);_0x3a759e[_0x280a('0x30')]=_[_0x280a('0x31')](_0x3a759e[_0x280a('0x2d')],_0x3a759e[_0x280a('0x2e')]);_0x1e59e8[_0x280a('0x32')]=_[_0x280a('0x31')](_0x3a759e['model'],qs[_0x280a('0x33')](_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x33')]));_0x1e59e8[_0x280a('0x32')]=_0x1e59e8[_0x280a('0x32')][_0x280a('0x34')]?_0x1e59e8[_0x280a('0x32')]:_0x3a759e[_0x280a('0x2d')];if(!_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x35')](_0x280a('0x36'))){_0x1e59e8['limit']=qs[_0x280a('0x37')](_0x2ab4a0[_0x280a('0x2e')]['limit']);_0x1e59e8['offset']=qs[_0x280a('0x1d')](_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x1d')]);}_0x1e59e8[_0x280a('0x38')]=qs[_0x280a('0x39')](_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x39')]);_0x1e59e8[_0x280a('0x3a')]=qs[_0x280a('0x30')](_['pick'](_0x2ab4a0[_0x280a('0x2e')],_0x3a759e[_0x280a('0x30')]),_0x2cf2a8);if(_0x2ab4a0[_0x280a('0x2e')][_0x280a('0x3b')]){_0x1e59e8[_0x280a('0x3a')]=_[_0x280a('0x3c')](_0x1e59e8[_0x280a('0x3a')],{'$or':_['map'](_0x2cf2a8,function(_0x41c89f){if(_0x41c89f[_0x280a('0x2b')]!==_0x280a('0x3d')){var _0xf43d1d={};_0xf43d1d[_0x41c89f[_0x280a('0x25')]]={'$like':'%'+_0x2ab4a0[_0x280a('0x2e')]['filter']+'%'};return _0xf43d1d;}})});}_0x1e59e8=_[_0x280a('0x3c')]({},_0x1e59e8,_0x2ab4a0[_0x280a('0x3e')]);var _0x335e02={'where':_0x1e59e8[_0x280a('0x3a')]};return db['CmCustomField'][_0x280a('0x1c')](_0x335e02)[_0x280a('0x23')](function(_0x56f4d2){_0x1eec6e[_0x280a('0x1c')]=_0x56f4d2;if(_0x2ab4a0[_0x280a('0x2e')]['includeAll']){_0x1e59e8[_0x280a('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x280a('0x40')](_0x1e59e8);})['then'](function(_0x51e9ee){_0x1eec6e[_0x280a('0x41')]=_0x51e9ee;return _0x1eec6e;})['then'](respondWithFilteredResult(_0x50acce,_0x1e59e8))[_0x280a('0x42')](handleError(_0x50acce,null));};exports[_0x280a('0x43')]=function(_0x27619d,_0x1c1eb6){var _0x403da1={'raw':!![],'where':{'id':_0x27619d[_0x280a('0x44')]['id']}},_0x5b0074={};_0x5b0074[_0x280a('0x2d')]=_[_0x280a('0x2f')](db[_0x280a('0x28')]['rawAttributes']);_0x5b0074['query']=_[_0x280a('0x2f')](_0x27619d[_0x280a('0x2e')]);_0x5b0074['filters']=_['intersection'](_0x5b0074[_0x280a('0x2d')],_0x5b0074[_0x280a('0x2e')]);_0x403da1[_0x280a('0x32')]=_[_0x280a('0x31')](_0x5b0074[_0x280a('0x2d')],qs[_0x280a('0x33')](_0x27619d[_0x280a('0x2e')][_0x280a('0x33')]));_0x403da1['attributes']=_0x403da1[_0x280a('0x32')]['length']?_0x403da1['attributes']:_0x5b0074[_0x280a('0x2d')];if(_0x27619d[_0x280a('0x2e')][_0x280a('0x45')]){_0x403da1[_0x280a('0x3f')]=[{'all':!![]}];}_0x403da1=_[_0x280a('0x3c')]({},_0x403da1,_0x27619d[_0x280a('0x3e')]);return db[_0x280a('0x28')]['find'](_0x403da1)[_0x280a('0x23')](handleEntityNotFound(_0x1c1eb6,null))[_0x280a('0x23')](respondWithResult(_0x1c1eb6,null))[_0x280a('0x42')](handleError(_0x1c1eb6,null));};exports[_0x280a('0x46')]=function(_0x292cd5,_0xeab8ad){if(_0x292cd5[_0x280a('0x47')]['id']){delete _0x292cd5[_0x280a('0x47')]['id'];}return db[_0x280a('0x28')][_0x280a('0x48')]({'where':{'id':_0x292cd5[_0x280a('0x44')]['id']}})[_0x280a('0x23')](handleEntityNotFound(_0xeab8ad,null))['then'](saveUpdates(_0x292cd5[_0x280a('0x47')],null))[_0x280a('0x23')](respondWithResult(_0xeab8ad,null))['catch'](handleError(_0xeab8ad,null));};exports[_0x280a('0x49')]=function(_0x43a74b,_0x40c735){return db[_0x280a('0x28')]['find']({'where':{'id':_0x43a74b[_0x280a('0x44')]['id']}})[_0x280a('0x23')](handleEntityNotFound(_0x40c735,null))[_0x280a('0x23')](removeEntity(_0x40c735,null))['catch'](handleError(_0x40c735,null));};exports[_0x280a('0x4a')]=function(_0x3d7faa,_0x1ec663){var _0x48c7fa;return db[_0x280a('0x4b')]['transaction'](function(_0x3940b5){return db[_0x280a('0x28')][_0x280a('0x4a')](_0x3d7faa[_0x280a('0x47')],{'transaction':_0x3940b5})[_0x280a('0x23')](function(_0x115882){_0x48c7fa=_0x115882;var _0x37a564={'type':db['Sequelize'][_0x280a('0x4c')],'transaction':_0x3940b5};switch(_0x3d7faa[_0x280a('0x47')][_0x280a('0x2b')]){case'text':_0x37a564[_0x280a('0x2b')]=db[_0x280a('0x4d')]['TEXT'];break;case _0x280a('0x4e'):_0x37a564[_0x280a('0x2b')]=db[_0x280a('0x4d')]['INTEGER'];break;case _0x280a('0x4f'):_0x37a564[_0x280a('0x2b')]=db['Sequelize']['BOOLEAN'];_0x37a564[_0x280a('0x50')]=![];break;default:}return db[_0x280a('0x4b')][_0x280a('0x51')][_0x280a('0x52')](_0x280a('0x53'),util['format'](_0x280a('0x54'),_0x48c7fa['id']),_0x37a564);})[_0x280a('0x23')](function(){return _0x48c7fa;});})['then'](respondWithResult(_0x1ec663,0xc9))[_0x280a('0x42')](handleError(_0x1ec663,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3c4a5a8..3ba79a0 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 _0x153c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields'];(function(_0x1ba480,_0x6586a8){var _0x7ce11f=function(_0x3bfb9d){while(--_0x3bfb9d){_0x1ba480['push'](_0x1ba480['shift']());}};_0x7ce11f(++_0x6586a8);}(_0x153c,0x8c));var _0xc153=function(_0x1deb62,_0xc72101){_0x1deb62=_0x1deb62-0x0;var _0x54271b=_0x153c[_0x1deb62];return _0x54271b;};'use strict';var _=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var logger=require(_0xc153('0x2'))(_0xc153('0x3'));var moment=require('moment');var BPromise=require(_0xc153('0x4'));var rp=require(_0xc153('0x5'));var fs=require('fs');var path=require(_0xc153('0x6'));var rimraf=require(_0xc153('0x7'));var config=require(_0xc153('0x8'));var attributes=require(_0xc153('0x9'));module[_0xc153('0xa')]=function(_0x58f5c5,_0x267a79){return _0x58f5c5[_0xc153('0xb')](_0xc153('0xc'),attributes,{'tableName':_0xc153('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01a6=['rimraf','./cmCustomField.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a1da5,_0x5ef670){var _0x294b22=function(_0x4f2bfd){while(--_0x4f2bfd){_0x5a1da5['push'](_0x5a1da5['shift']());}};_0x294b22(++_0x5ef670);}(_0x01a6,0x162));var _0x601a=function(_0xadfb98,_0x1370cf){_0xadfb98=_0xadfb98-0x0;var _0x11c795=_0x01a6[_0xadfb98];return _0x11c795;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index f7a16b4..918c2b1 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 _0x984b=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x52b56c,_0x1eb8f9){var _0x2db252=function(_0xec0cb0){while(--_0xec0cb0){_0x52b56c['push'](_0x52b56c['shift']());}};_0x2db252(++_0x1eb8f9);}(_0x984b,0xee));var _0xb984=function(_0x2fb217,_0x43c114){_0x2fb217=_0x2fb217-0x0;var _0x5c6e11=_0x984b[_0x2fb217];return _0x5c6e11;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file +var _0x5db8=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5db8,0xbb));var _0x85db=function(_0x12a612,_0x2a147e){_0x12a612=_0x12a612-0x0;var _0x20eea8=_0x5db8[_0x12a612];return _0x20eea8;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bc4f153..4cc7d66 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 _0x87cd=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','path','express'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x87cd,0xe6));var _0xd87c=function(_0x3e18a6,_0x5f2dcf){_0x3e18a6=_0x3e18a6-0x0;var _0x52fa2e=_0x87cd[_0x3e18a6];return _0x52fa2e;};'use strict';var multer=require(_0xd87c('0x0'));var util=require(_0xd87c('0x1'));var path=require(_0xd87c('0x2'));var timeout=require('connect-timeout');var express=require(_0xd87c('0x3'));var router=express[_0xd87c('0x4')]();var auth=require(_0xd87c('0x5'));var interaction=require(_0xd87c('0x6'));var config=require(_0xd87c('0x7'));var controller=require(_0xd87c('0x8'));router[_0xd87c('0x9')]('/',auth[_0xd87c('0xa')](),controller[_0xd87c('0xb')]);router[_0xd87c('0x9')](_0xd87c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd87c('0xd')]('/',auth[_0xd87c('0xa')](),controller[_0xd87c('0xe')]);router[_0xd87c('0xf')]('/:id',auth[_0xd87c('0xa')](),controller[_0xd87c('0x10')]);router[_0xd87c('0x11')]('/:id',auth[_0xd87c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2993=['/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index'];(function(_0x3987ab,_0x3bcf53){var _0x7d0155=function(_0x265fc0){while(--_0x265fc0){_0x3987ab['push'](_0x3987ab['shift']());}};_0x7d0155(++_0x3bcf53);}(_0x2993,0xb1));var _0x3299=function(_0x247498,_0x33dfc3){_0x247498=_0x247498-0x0;var _0x4fa03a=_0x2993[_0x247498];return _0x4fa03a;};'use strict';var multer=require(_0x3299('0x0'));var util=require(_0x3299('0x1'));var path=require(_0x3299('0x2'));var timeout=require(_0x3299('0x3'));var express=require(_0x3299('0x4'));var router=express[_0x3299('0x5')]();var auth=require(_0x3299('0x6'));var interaction=require(_0x3299('0x7'));var config=require(_0x3299('0x8'));var controller=require(_0x3299('0x9'));router[_0x3299('0xa')]('/',auth[_0x3299('0xb')](),controller[_0x3299('0xc')]);router[_0x3299('0xa')](_0x3299('0xd'),auth[_0x3299('0xb')](),controller['show']);router[_0x3299('0xe')]('/',auth['isAuthenticated'](),controller[_0x3299('0xf')]);router[_0x3299('0x10')](_0x3299('0xd'),auth[_0x3299('0xb')](),controller['update']);router[_0x3299('0x11')](_0x3299('0xd'),auth[_0x3299('0xb')](),controller['destroy']);module[_0x3299('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a677ef5..50af830 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 _0xf494=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format'];(function(_0x1966e0,_0xe513a4){var _0x1caff2=function(_0x491368){while(--_0x491368){_0x1966e0['push'](_0x1966e0['shift']());}};_0x1caff2(++_0xe513a4);}(_0xf494,0x1c6));var _0x4f49=function(_0x317698,_0xd8d128){_0x317698=_0x317698-0x0;var _0x2c8969=_0xf494[_0x317698];return _0x2c8969;};'use strict';var moment=require(_0x4f49('0x0'));var Sequelize=require(_0x4f49('0x1'));module[_0x4f49('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4f49('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4f49('0x4')],'defaultValue':moment()[_0x4f49('0x5')](_0x4f49('0x6'))},'countbusyretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4f49('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4f49('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4f49('0x4')]},'priority':{'type':Sequelize[_0x4f49('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4f49('0x7')],'unique':_0x4f49('0x9')},'ListId':{'type':Sequelize[_0x4f49('0x7')],'unique':_0x4f49('0x9')},'UserId':{'type':Sequelize[_0x4f49('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4f49('0x7')],'unique':_0x4f49('0x9')},'CampaignId':{'type':Sequelize[_0x4f49('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f49('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba34=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','INTEGER','DATE'];(function(_0x526bd3,_0x4fdb69){var _0x31bb48=function(_0x85e42){while(--_0x85e42){_0x526bd3['push'](_0x526bd3['shift']());}};_0x31bb48(++_0x4fdb69);}(_0xba34,0x119));var _0x4ba3=function(_0x32b19e,_0x1ad05d){_0x32b19e=_0x32b19e-0x0;var _0x2d595d=_0xba34[_0x32b19e];return _0x2d595d;};'use strict';var moment=require(_0x4ba3('0x0'));var Sequelize=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'phone':{'type':Sequelize[_0x4ba3('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ba3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4ba3('0x6')]},'priority':{'type':Sequelize[_0x4ba3('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4ba3('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'ListId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'UserId':{'type':Sequelize[_0x4ba3('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x4ba3('0x5')],'unique':_0x4ba3('0x7')},'CampaignId':{'type':Sequelize[_0x4ba3('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ba3('0x5')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 6e31435..73b530a 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 _0x4ff5=['dialActive','getOpenContacts','outbound','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','utcOffset','getTimezone','timezones','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','rows','catch','show','keys','include','merge','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','omit','createdAt','state','membername','user','UserId','deleted','deletedat','phone','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','findOne','scheduledat','LOCK','UPDATE','Contact','Company','List','Queue'];(function(_0x2664a5,_0x3dcd55){var _0x1d154c=function(_0x3e72ea){while(--_0x3e72ea){_0x2664a5['push'](_0x2664a5['shift']());}};_0x1d154c(++_0x3dcd55);}(_0x4ff5,0x9e));var _0x54ff=function(_0x3bf7c7,_0x3bf784){_0x3bf7c7=_0x3bf7c7-0x0;var _0x519fbc=_0x4ff5[_0x3bf7c7];return _0x519fbc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x54ff('0x0'));var rimraf=require(_0x54ff('0x1'));var zipdir=require(_0x54ff('0x2'));var jsonpatch=require(_0x54ff('0x3'));var rp=require(_0x54ff('0x4'));var moment=require(_0x54ff('0x5'));var BPromise=require(_0x54ff('0x6'));var Mustache=require(_0x54ff('0x7'));var util=require(_0x54ff('0x8'));var path=require(_0x54ff('0x9'));var sox=require('sox');var csv=require(_0x54ff('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x54ff('0xb'));var squel=require(_0x54ff('0xc'));var crypto=require(_0x54ff('0xd'));var jsforce=require(_0x54ff('0xe'));var deskjs=require(_0x54ff('0xf'));var toCsv=require(_0x54ff('0xa'));var querystring=require(_0x54ff('0x10'));var Papa=require(_0x54ff('0x11'));var Redis=require(_0x54ff('0x12'));var shared=require(_0x54ff('0x13'));var authService=require(_0x54ff('0x14'));var qs=require(_0x54ff('0x15'));var as=require(_0x54ff('0x16'));var hardwareService=require(_0x54ff('0x17'));var logger=require(_0x54ff('0x18'))(_0x54ff('0x19'));var utils=require(_0x54ff('0x1a'));var config=require('../../config/environment');var db=require(_0x54ff('0x1b'))['db'];function respondWithStatusCode(_0x4b53f7,_0x280fcd){_0x280fcd=_0x280fcd||0xcc;return function(_0x544e3a){if(_0x544e3a){return _0x4b53f7[_0x54ff('0x1c')](_0x280fcd);}return _0x4b53f7[_0x54ff('0x1d')](_0x280fcd)[_0x54ff('0x1e')]();};}function respondWithResult(_0x5ee9f0,_0x134f57){_0x134f57=_0x134f57||0xc8;return function(_0x40a479){if(_0x40a479){return _0x5ee9f0[_0x54ff('0x1d')](_0x134f57)[_0x54ff('0x1f')](_0x40a479);}};}function respondWithFilteredResult(_0x198e3c,_0x3a349a){return function(_0x2b56b6){if(_0x2b56b6){var _0xc80601=_0x2b56b6[_0x54ff('0x20')],_0x156530=_0x3a349a['offset'],_0x11d802=_0x3a349a[_0x54ff('0x21')]+_0x3a349a['limit'],_0x383c6;if(_0x11d802>=_0xc80601){_0x11d802=_0xc80601;_0x383c6=0xc8;}else{_0x383c6=0xce;}_0x198e3c['status'](_0x383c6);return _0x198e3c[_0x54ff('0x22')](_0x54ff('0x23'),_0x156530+'-'+_0x11d802+'/'+_0xc80601)[_0x54ff('0x1f')](_0x2b56b6);}return null;};}function patchUpdates(_0x2c1f01){return function(_0xd60aee){try{jsonpatch['apply'](_0xd60aee,_0x2c1f01,!![]);}catch(_0x514319){return BPromise[_0x54ff('0x24')](_0x514319);}return _0xd60aee[_0x54ff('0x25')]();};}function saveUpdates(_0x4e52fb,_0x2bb1f3){return function(_0x59c936){if(_0x59c936){return _0x59c936[_0x54ff('0x26')](_0x4e52fb)['then'](function(_0x49719b){return _0x49719b;});}return null;};}function removeEntity(_0x47a90a,_0x453862){return function(_0xb60aed){if(_0xb60aed){return _0xb60aed['destroy']()['then'](function(){_0x47a90a['status'](0xcc)[_0x54ff('0x1e')]();});}};}function handleEntityNotFound(_0x424851,_0x2a146a){return function(_0x3ee4b3){if(!_0x3ee4b3){_0x424851['sendStatus'](0x194);}return _0x3ee4b3;};}function handleError(_0x12db16,_0x301685){_0x301685=_0x301685||0x1f4;return function(_0x245ffe){logger['error'](_0x245ffe['stack']);if(_0x245ffe[_0x54ff('0x27')]){delete _0x245ffe[_0x54ff('0x27')];}_0x12db16['status'](_0x301685)['send'](_0x245ffe);};}exports[_0x54ff('0x28')]=function(_0x1cdd39,_0x3d7ba3){var _0x4f64c1={},_0x10f35a={},_0x11f060={'count':0x0,'rows':[]};var _0x2e1602=_[_0x54ff('0x29')](db[_0x54ff('0x2a')][_0x54ff('0x2b')],function(_0x10afc1){return{'name':_0x10afc1[_0x54ff('0x2c')],'type':_0x10afc1[_0x54ff('0x2d')][_0x54ff('0x2e')]};});_0x10f35a[_0x54ff('0x2f')]=_['map'](_0x2e1602,_0x54ff('0x27'));_0x10f35a[_0x54ff('0x30')]=_['keys'](_0x1cdd39['query']);_0x10f35a['filters']=_['intersection'](_0x10f35a[_0x54ff('0x2f')],_0x10f35a[_0x54ff('0x30')]);_0x10f35a[_0x54ff('0x31')]=_[_0x54ff('0x32')](_0x10f35a[_0x54ff('0x31')],['$and',_0x54ff('0x33'),_0x54ff('0x34'),_0x54ff('0x35'),_0x54ff('0x36'),_0x54ff('0x37'),_0x54ff('0x38'),_0x54ff('0x39'),_0x54ff('0x3a'),_0x54ff('0x3b'),'$notBetween',_0x54ff('0x3c'),_0x54ff('0x3d'),_0x54ff('0x3e'),_0x54ff('0x3f'),'$iLike','$notILike',_0x54ff('0x3e'),_0x54ff('0x40'),'$contains',_0x54ff('0x41'),_0x54ff('0x42')]);_0x4f64c1[_0x54ff('0x43')]=_[_0x54ff('0x44')](_0x10f35a[_0x54ff('0x2f')],qs[_0x54ff('0x45')](_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x45')]));_0x4f64c1[_0x54ff('0x43')]=_0x4f64c1[_0x54ff('0x43')][_0x54ff('0x46')]?_0x4f64c1[_0x54ff('0x43')]:_0x10f35a[_0x54ff('0x2f')];if(!_0x1cdd39['query'][_0x54ff('0x47')]('nolimit')){_0x4f64c1[_0x54ff('0x48')]=qs['limit'](_0x1cdd39[_0x54ff('0x30')]['limit']);_0x4f64c1[_0x54ff('0x21')]=qs[_0x54ff('0x21')](_0x1cdd39[_0x54ff('0x30')]['offset']);}_0x4f64c1[_0x54ff('0x49')]=qs[_0x54ff('0x4a')](_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x4a')]);_0x4f64c1[_0x54ff('0x4b')]=qs[_0x54ff('0x31')](_[_0x54ff('0x4c')](_0x1cdd39[_0x54ff('0x30')],_0x10f35a[_0x54ff('0x31')]),_0x2e1602);if(_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x4d')]){_0x4f64c1[_0x54ff('0x4b')]=_['merge'](_0x4f64c1[_0x54ff('0x4b')],{'$or':_[_0x54ff('0x29')](_0x2e1602,function(_0x595818){if(_0x595818[_0x54ff('0x2d')]!==_0x54ff('0x4e')){var _0x1cf595={};_0x1cf595[_0x595818[_0x54ff('0x27')]]={'$like':'%'+_0x1cdd39['query'][_0x54ff('0x4d')]+'%'};return _0x1cf595;}})});}_0x4f64c1=_['merge']({},_0x4f64c1,_0x1cdd39[_0x54ff('0x4f')]);var _0x5e8e07={'where':_0x4f64c1[_0x54ff('0x4b')]};return db[_0x54ff('0x2a')][_0x54ff('0x20')](_0x5e8e07)[_0x54ff('0x50')](function(_0x2b1cbc){_0x11f060[_0x54ff('0x20')]=_0x2b1cbc;if(_0x1cdd39[_0x54ff('0x30')][_0x54ff('0x51')]){_0x4f64c1['include']=[{'all':!![]}];}return db[_0x54ff('0x2a')]['findAll'](_0x4f64c1);})['then'](function(_0x2598cc){_0x11f060[_0x54ff('0x52')]=_0x2598cc;return _0x11f060;})[_0x54ff('0x50')](respondWithFilteredResult(_0x3d7ba3,_0x4f64c1))[_0x54ff('0x53')](handleError(_0x3d7ba3,null));};exports[_0x54ff('0x54')]=function(_0x38b6ef,_0x11b943){var _0x512e06={'raw':!![],'where':{'id':_0x38b6ef['params']['id']}},_0x3023e0={};_0x3023e0['model']=_[_0x54ff('0x55')](db[_0x54ff('0x2a')][_0x54ff('0x2b')]);_0x3023e0[_0x54ff('0x30')]=_['keys'](_0x38b6ef['query']);_0x3023e0['filters']=_[_0x54ff('0x44')](_0x3023e0[_0x54ff('0x2f')],_0x3023e0[_0x54ff('0x30')]);_0x512e06[_0x54ff('0x43')]=_[_0x54ff('0x44')](_0x3023e0['model'],qs[_0x54ff('0x45')](_0x38b6ef[_0x54ff('0x30')][_0x54ff('0x45')]));_0x512e06[_0x54ff('0x43')]=_0x512e06['attributes']['length']?_0x512e06[_0x54ff('0x43')]:_0x3023e0[_0x54ff('0x2f')];if(_0x38b6ef[_0x54ff('0x30')][_0x54ff('0x51')]){_0x512e06[_0x54ff('0x56')]=[{'all':!![]}];}_0x512e06=_[_0x54ff('0x57')]({},_0x512e06,_0x38b6ef[_0x54ff('0x4f')]);return db['CmHopper'][_0x54ff('0x58')](_0x512e06)[_0x54ff('0x50')](handleEntityNotFound(_0x11b943,null))[_0x54ff('0x50')](respondWithResult(_0x11b943,null))[_0x54ff('0x53')](handleError(_0x11b943,null));};exports['create']=function(_0x3d89fe,_0x52c4d9){return db[_0x54ff('0x2a')][_0x54ff('0x59')](_0x3d89fe[_0x54ff('0x5a')],{})[_0x54ff('0x50')](respondWithResult(_0x52c4d9,0xc9))[_0x54ff('0x53')](handleError(_0x52c4d9,null));};exports['update']=function(_0x143054,_0xcf1e0){if(_0x143054[_0x54ff('0x5a')]['id']){delete _0x143054[_0x54ff('0x5a')]['id'];}return db['CmHopper'][_0x54ff('0x58')]({'where':{'id':_0x143054[_0x54ff('0x5b')]['id']}})[_0x54ff('0x50')](handleEntityNotFound(_0xcf1e0,null))[_0x54ff('0x50')](saveUpdates(_0x143054[_0x54ff('0x5a')],null))[_0x54ff('0x50')](respondWithResult(_0xcf1e0,null))[_0x54ff('0x53')](handleError(_0xcf1e0,null));};exports[_0x54ff('0x5c')]=function(_0x5e4234,_0x475c39){return db['CmHopper'][_0x54ff('0x5c')]()['then'](respondWithResult(_0x475c39,null))[_0x54ff('0x53')](handleError(_0x475c39,null));};exports[_0x54ff('0x5d')]=function(_0x324a27,_0x3af23b){var _0x9c9483;return db['CmHopper']['find']({'where':{'id':_0x324a27['params']['id']}})[_0x54ff('0x50')](handleEntityNotFound(_0x3af23b,null))['then'](function(_0x83a2cc){if(_0x83a2cc){return _0x83a2cc[_0x54ff('0x5d')]()[_0x54ff('0x50')](function(_0x1b71c5){return _0x1b71c5;});}})[_0x54ff('0x50')](function(_0x3214c7){_0x9c9483=_0x3214c7;if(_0x3214c7){if(_0x3214c7[_0x54ff('0x5e')]||_0x3214c7['CampaignId']){return db[_0x3214c7[_0x54ff('0x5e')]?_0x54ff('0x5f'):_0x54ff('0x60')][_0x54ff('0x58')]({'where':{'id':_0x3214c7[_0x54ff('0x5e')]?_0x3214c7[_0x54ff('0x5e')]:_0x3214c7['CampaignId']},'attributes':['id',_0x54ff('0x27')],'raw':!![]});}}})[_0x54ff('0x50')](function(_0x1a51a3){var _0x1d7838={};if(_0x1a51a3){_[_0x54ff('0x57')](_0x1d7838,_[_0x54ff('0x61')](_0x9c9483['dataValues'],[_0x54ff('0x62'),'updatedAt','id']));_0x1d7838[_0x54ff('0x63')]=0x15;_0x1d7838['statedesc']='deleted';_0x1d7838['campaign']=_0x1a51a3[_0x54ff('0x27')];_0x1d7838[_0x54ff('0x64')]=_0x324a27[_0x54ff('0x65')]['name'];_0x1d7838[_0x54ff('0x66')]=_0x324a27[_0x54ff('0x65')]['id'];_0x1d7838[_0x54ff('0x67')]=!![];_0x1d7838[_0x54ff('0x68')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1d7838['calleridnum']=_0x9c9483[_0x54ff('0x69')];_0x1d7838[_0x54ff('0x6a')]=_0x9c9483['VoiceQueueId']?_0x54ff('0x6b'):'ivr';return db['CmContact'][_0x54ff('0x58')]({'where':{'id':_0x1d7838[_0x54ff('0x6c')]},'attributes':[_0x54ff('0x6d'),_0x54ff('0x6e')]})['then'](function(_0x13cf99){if(!_['isNil'](_0x3af23b)&&!_[_0x54ff('0x6f')](_0x13cf99[_0x54ff('0x6d')])){_0x1d7838[_0x54ff('0x70')]=_0x13cf99['firstName'];if(!_[_0x54ff('0x6f')](_0x13cf99[_0x54ff('0x6e')])){_0x1d7838['calleridname']+='\x20'+_0x13cf99[_0x54ff('0x6e')];}}})['finally'](function(){return db[_0x54ff('0x71')][_0x54ff('0x59')](_0x1d7838);});}})[_0x54ff('0x50')](function(){return _0x3af23b['status'](0xcc)[_0x54ff('0x1e')]();})[_0x54ff('0x53')](handleError(_0x3af23b,null));};exports['getPreview']=function(_0x36d831,_0xb0b091,_0x3dcade){var _0x206419=[];return db[_0x54ff('0x72')][_0x54ff('0x5c')]()[_0x54ff('0x50')](function(_0x152279){_0x206419=_[_0x54ff('0x55')](_0x152279);return _0x36d831[_0x54ff('0x65')][_0x54ff('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x54ff('0x74')},'attributes':['id',_0x54ff('0x75')],'raw':!![]});})[_0x54ff('0x50')](function(_0x20a60b){if(_0x20a60b&&_0x20a60b['length']){return db[_0x54ff('0x76')][_0x54ff('0x77')](function(_0x1a7d55){var _0x32f888={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x54ff('0x78')](_0x54ff('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x20a60b,'id')},'$or':[{'UserId':null},{'UserId':_0x36d831[_0x54ff('0x65')]['id']}]};var _0x1fbc49=[];if(_0x36d831[_0x54ff('0x5a')]['direction']&&_0x36d831[_0x54ff('0x5a')][_0x54ff('0x7a')]===_0x54ff('0x7b')){if(!_['isEmpty'](_0x36d831['body']['hopperIds'])){_0x32f888['id']={'$in':_0x36d831['body'][_0x54ff('0x7c')]};}_0x1fbc49=[[_0x54ff('0x7d'),_0x54ff('0x7e')],['scheduledAt',_0x20a60b[0x0][_0x54ff('0x75')]===_0x54ff('0x7e')?_0x54ff('0x7f'):'ASC'],db[_0x54ff('0x76')][_0x54ff('0x80')](_0x54ff('0x81')),['id',_0x54ff('0x7f')]];}else{if(!_[_0x54ff('0x82')](_0x36d831['body'][_0x54ff('0x7c')])){_0x32f888['id']={'$notIn':_0x36d831[_0x54ff('0x5a')][_0x54ff('0x7c')]};}_0x1fbc49=[[_0x54ff('0x7d'),_0x54ff('0x7f')],[_0x54ff('0x83'),_0x20a60b[0x0]['dialOrderByScheduledAt']],db[_0x54ff('0x76')][_0x54ff('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x54ff('0x7e')]];}return db[_0x54ff('0x2a')][_0x54ff('0x84')]({'attributes':['id',_0x54ff('0x85')],'where':_0x32f888,'order':_0x1fbc49,'transaction':_0x1a7d55,'lock':_0x1a7d55[_0x54ff('0x86')][_0x54ff('0x87')],'include':[{'model':db[_0x54ff('0x72')],'as':_0x54ff('0x88'),'attributes':_0x206419,'include':[{'model':db['CmCompany'],'as':_0x54ff('0x89'),'attributes':['id',_0x54ff('0x27')]}]},{'model':db['CmList'],'as':_0x54ff('0x8a'),'attributes':['id',_0x54ff('0x27')]},{'model':db[_0x54ff('0x5f')],'as':_0x54ff('0x8b'),'attributes':['id','name',_0x54ff('0x8c')]}]})[_0x54ff('0x50')](function(_0x263e42){if(_0x263e42){return _0x263e42[_0x54ff('0x26')]({'UserId':_0x36d831[_0x54ff('0x65')]['id']},{'transaction':_0x1a7d55});}});});}})['then'](handleEntityNotFound(_0xb0b091,null))[_0x54ff('0x50')](respondWithResult(_0xb0b091,null))['catch'](handleError(_0xb0b091,null));};exports[_0x54ff('0x8d')]=function(_0x3a9c2e,_0x4280de,_0xf2042e){return _0x3a9c2e[_0x54ff('0x65')][_0x54ff('0x73')]({'where':{'type':_0x54ff('0x8e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x21787f){if(_0x21787f&&_0x21787f[_0x54ff('0x46')]){return db[_0x54ff('0x2a')][_0x54ff('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x21787f,'id')},'$or':[{'UserId':null},{'UserId':_0x3a9c2e[_0x54ff('0x65')]['id']}]}});}return 0x0;})[_0x54ff('0x50')](function(_0x3605b4){if(!_[_0x54ff('0x6f')](_0x3605b4)&&_['isNumber'](_0x3605b4)){return _0x4280de[_0x54ff('0x1d')](0xc8)[_0x54ff('0x1f')]({'contacts':_0x3605b4});}else{logger[_0x54ff('0x8f')](_0x54ff('0x90'),_0x54ff('0x8d'),0x194,_0x54ff('0x91'));_0x4280de[_0x54ff('0x1c')](0x194);}})[_0x54ff('0x53')](handleError(_0x4280de,null));};exports['getTimezones']=function(_0x1bc9fb,_0xa8fbcd,_0x40a875){var _0x55fbd0=shared['timezones'];var _0x12b509=[];_['map'](_0x55fbd0,function(_0x511f71){_0x12b509['push']({'id':_0x511f71[_0x54ff('0x27')],'name':_0x511f71[_0x54ff('0x27')],'utcOffset':_0x511f71[_0x54ff('0x92')]});});return _0xa8fbcd['status'](0xc8)[_0x54ff('0x1f')]({'tz':_0x12b509});};exports[_0x54ff('0x93')]=function(_0x1d9f16,_0x5b4a3a,_0x409403){var _0x4b9292=shared[_0x54ff('0x94')];var _0x5bef4e={};if(!_['isNil'](_0x4b9292[_0x1d9f16[_0x54ff('0x5a')]['id']]))_0x5bef4e=_0x4b9292[_0x1d9f16[_0x54ff('0x5a')]['id']];return _0x5b4a3a[_0x54ff('0x1d')](0xc8)[_0x54ff('0x1f')](_0x5bef4e);}; \ No newline at end of file +var _0x3da5=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$lt','$lte','$not','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$any','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','CmHopper','findAll','rows','show','params','length','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','calleridnum','phone','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','html-pdf','eml-format','rimraf','request-promise','moment'];(function(_0x3fc611,_0x4d72cf){var _0x59661b=function(_0x4d5af0){while(--_0x4d5af0){_0x3fc611['push'](_0x3fc611['shift']());}};_0x59661b(++_0x4d72cf);}(_0x3da5,0x12b));var _0x53da=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x3da5[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x53da('0x0'));var emlformat=require(_0x53da('0x1'));var rimraf=require(_0x53da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x53da('0x3'));var moment=require(_0x53da('0x4'));var BPromise=require(_0x53da('0x5'));var Mustache=require(_0x53da('0x6'));var util=require(_0x53da('0x7'));var path=require('path');var sox=require(_0x53da('0x8'));var csv=require(_0x53da('0x9'));var ejs=require(_0x53da('0xa'));var fs=require('fs');var _=require(_0x53da('0xb'));var squel=require(_0x53da('0xc'));var crypto=require(_0x53da('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53da('0xe'));var Papa=require(_0x53da('0xf'));var Redis=require(_0x53da('0x10'));var shared=require(_0x53da('0x11'));var authService=require(_0x53da('0x12'));var qs=require(_0x53da('0x13'));var as=require(_0x53da('0x14'));var hardwareService=require(_0x53da('0x15'));var logger=require(_0x53da('0x16'))(_0x53da('0x17'));var utils=require(_0x53da('0x18'));var config=require(_0x53da('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20dd38,_0x147954){_0x147954=_0x147954||0xcc;return function(_0x15514d){if(_0x15514d){return _0x20dd38[_0x53da('0x19')](_0x147954);}return _0x20dd38[_0x53da('0x1a')](_0x147954)[_0x53da('0x1b')]();};}function respondWithResult(_0x454df3,_0xfe5ba2){_0xfe5ba2=_0xfe5ba2||0xc8;return function(_0x45b9bb){if(_0x45b9bb){return _0x454df3[_0x53da('0x1a')](_0xfe5ba2)[_0x53da('0x1c')](_0x45b9bb);}};}function respondWithFilteredResult(_0x50519a,_0xd84971){return function(_0x15e8c7){if(_0x15e8c7){var _0x597e6b=_0x15e8c7[_0x53da('0x1d')],_0x40bb7e=_0xd84971[_0x53da('0x1e')],_0x541975=_0xd84971[_0x53da('0x1e')]+_0xd84971[_0x53da('0x1f')],_0x54097f;if(_0x541975>=_0x597e6b){_0x541975=_0x597e6b;_0x54097f=0xc8;}else{_0x54097f=0xce;}_0x50519a[_0x53da('0x1a')](_0x54097f);return _0x50519a[_0x53da('0x20')](_0x53da('0x21'),_0x40bb7e+'-'+_0x541975+'/'+_0x597e6b)['json'](_0x15e8c7);}return null;};}function patchUpdates(_0x4196cf){return function(_0x53ba8f){try{jsonpatch['apply'](_0x53ba8f,_0x4196cf,!![]);}catch(_0x14e17d){return BPromise['reject'](_0x14e17d);}return _0x53ba8f[_0x53da('0x22')]();};}function saveUpdates(_0x2273e2,_0x59d1da){return function(_0xbb4ce8){if(_0xbb4ce8){return _0xbb4ce8[_0x53da('0x23')](_0x2273e2)[_0x53da('0x24')](function(_0x34aa06){return _0x34aa06;});}return null;};}function removeEntity(_0x34af8d,_0x58d645){return function(_0x5bb2b7){if(_0x5bb2b7){return _0x5bb2b7[_0x53da('0x25')]()[_0x53da('0x24')](function(){_0x34af8d[_0x53da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9a12,_0x4b0487){return function(_0x3b6a90){if(!_0x3b6a90){_0x5b9a12[_0x53da('0x19')](0x194);}return _0x3b6a90;};}function handleError(_0x3763d1,_0x57fe3f){_0x57fe3f=_0x57fe3f||0x1f4;return function(_0x101b51){logger[_0x53da('0x26')](_0x101b51['stack']);if(_0x101b51[_0x53da('0x27')]){delete _0x101b51[_0x53da('0x27')];}_0x3763d1[_0x53da('0x1a')](_0x57fe3f)[_0x53da('0x28')](_0x101b51);};}exports['index']=function(_0x5053d9,_0x230f2a){var _0x5684eb={},_0x5d04e6={},_0x5df533={'count':0x0,'rows':[]};var _0x151d04=_[_0x53da('0x29')](db['CmHopper'][_0x53da('0x2a')],function(_0xe012df){return{'name':_0xe012df[_0x53da('0x2b')],'type':_0xe012df[_0x53da('0x2c')][_0x53da('0x2d')]};});_0x5d04e6[_0x53da('0x2e')]=_[_0x53da('0x29')](_0x151d04,'name');_0x5d04e6[_0x53da('0x2f')]=_[_0x53da('0x30')](_0x5053d9[_0x53da('0x2f')]);_0x5d04e6[_0x53da('0x31')]=_['intersection'](_0x5d04e6[_0x53da('0x2e')],_0x5d04e6[_0x53da('0x2f')]);_0x5d04e6[_0x53da('0x31')]=_[_0x53da('0x32')](_0x5d04e6[_0x53da('0x31')],[_0x53da('0x33'),_0x53da('0x34'),'$gt','$gte',_0x53da('0x35'),_0x53da('0x36'),'$ne','$eq',_0x53da('0x37'),'$between',_0x53da('0x38'),_0x53da('0x39'),'$notIn',_0x53da('0x3a'),'$notLike',_0x53da('0x3b'),_0x53da('0x3c'),_0x53da('0x3a'),_0x53da('0x3d'),_0x53da('0x3e'),'$contained',_0x53da('0x3f')]);_0x5684eb['attributes']=_[_0x53da('0x40')](_0x5d04e6[_0x53da('0x2e')],qs[_0x53da('0x41')](_0x5053d9[_0x53da('0x2f')][_0x53da('0x41')]));_0x5684eb[_0x53da('0x42')]=_0x5684eb['attributes']['length']?_0x5684eb[_0x53da('0x42')]:_0x5d04e6[_0x53da('0x2e')];if(!_0x5053d9[_0x53da('0x2f')][_0x53da('0x43')](_0x53da('0x44'))){_0x5684eb[_0x53da('0x1f')]=qs[_0x53da('0x1f')](_0x5053d9['query'][_0x53da('0x1f')]);_0x5684eb[_0x53da('0x1e')]=qs[_0x53da('0x1e')](_0x5053d9[_0x53da('0x2f')][_0x53da('0x1e')]);}_0x5684eb[_0x53da('0x45')]=qs[_0x53da('0x46')](_0x5053d9[_0x53da('0x2f')]['sort']);_0x5684eb[_0x53da('0x47')]=qs[_0x53da('0x31')](_[_0x53da('0x48')](_0x5053d9[_0x53da('0x2f')],_0x5d04e6['filters']),_0x151d04);if(_0x5053d9['query']['filter']){_0x5684eb[_0x53da('0x47')]=_[_0x53da('0x49')](_0x5684eb[_0x53da('0x47')],{'$or':_['map'](_0x151d04,function(_0x317c98){if(_0x317c98[_0x53da('0x2c')]!==_0x53da('0x4a')){var _0x2d194c={};_0x2d194c[_0x317c98[_0x53da('0x27')]]={'$like':'%'+_0x5053d9['query'][_0x53da('0x4b')]+'%'};return _0x2d194c;}})});}_0x5684eb=_['merge']({},_0x5684eb,_0x5053d9[_0x53da('0x4c')]);var _0x5314c5={'where':_0x5684eb[_0x53da('0x47')]};return db['CmHopper'][_0x53da('0x1d')](_0x5314c5)[_0x53da('0x24')](function(_0x39a09a){_0x5df533[_0x53da('0x1d')]=_0x39a09a;if(_0x5053d9[_0x53da('0x2f')][_0x53da('0x4d')]){_0x5684eb[_0x53da('0x4e')]=[{'all':!![]}];}return db[_0x53da('0x4f')][_0x53da('0x50')](_0x5684eb);})[_0x53da('0x24')](function(_0x499bfe){_0x5df533[_0x53da('0x51')]=_0x499bfe;return _0x5df533;})[_0x53da('0x24')](respondWithFilteredResult(_0x230f2a,_0x5684eb))['catch'](handleError(_0x230f2a,null));};exports[_0x53da('0x52')]=function(_0x10c695,_0x1cc1ee){var _0x5cd8ae={'raw':!![],'where':{'id':_0x10c695[_0x53da('0x53')]['id']}},_0xed9ed8={};_0xed9ed8[_0x53da('0x2e')]=_[_0x53da('0x30')](db[_0x53da('0x4f')][_0x53da('0x2a')]);_0xed9ed8[_0x53da('0x2f')]=_[_0x53da('0x30')](_0x10c695[_0x53da('0x2f')]);_0xed9ed8['filters']=_[_0x53da('0x40')](_0xed9ed8[_0x53da('0x2e')],_0xed9ed8[_0x53da('0x2f')]);_0x5cd8ae[_0x53da('0x42')]=_['intersection'](_0xed9ed8['model'],qs[_0x53da('0x41')](_0x10c695[_0x53da('0x2f')][_0x53da('0x41')]));_0x5cd8ae['attributes']=_0x5cd8ae[_0x53da('0x42')][_0x53da('0x54')]?_0x5cd8ae['attributes']:_0xed9ed8[_0x53da('0x2e')];if(_0x10c695[_0x53da('0x2f')][_0x53da('0x4d')]){_0x5cd8ae[_0x53da('0x4e')]=[{'all':!![]}];}_0x5cd8ae=_[_0x53da('0x49')]({},_0x5cd8ae,_0x10c695[_0x53da('0x4c')]);return db[_0x53da('0x4f')][_0x53da('0x55')](_0x5cd8ae)['then'](handleEntityNotFound(_0x1cc1ee,null))['then'](respondWithResult(_0x1cc1ee,null))[_0x53da('0x56')](handleError(_0x1cc1ee,null));};exports['create']=function(_0x4e7cd8,_0xf1c6b1){return db[_0x53da('0x4f')][_0x53da('0x57')](_0x4e7cd8[_0x53da('0x58')],{})[_0x53da('0x24')](respondWithResult(_0xf1c6b1,0xc9))[_0x53da('0x56')](handleError(_0xf1c6b1,null));};exports[_0x53da('0x23')]=function(_0x209242,_0x545ade){if(_0x209242[_0x53da('0x58')]['id']){delete _0x209242[_0x53da('0x58')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x209242[_0x53da('0x53')]['id']}})[_0x53da('0x24')](handleEntityNotFound(_0x545ade,null))[_0x53da('0x24')](saveUpdates(_0x209242[_0x53da('0x58')],null))[_0x53da('0x24')](respondWithResult(_0x545ade,null))[_0x53da('0x56')](handleError(_0x545ade,null));};exports[_0x53da('0x59')]=function(_0xb20c24,_0x1288d1){return db[_0x53da('0x4f')][_0x53da('0x59')]()[_0x53da('0x24')](respondWithResult(_0x1288d1,null))[_0x53da('0x56')](handleError(_0x1288d1,null));};exports[_0x53da('0x25')]=function(_0x34f789,_0x17cd37){var _0x241e7d;return db[_0x53da('0x4f')][_0x53da('0x55')]({'where':{'id':_0x34f789[_0x53da('0x53')]['id']}})[_0x53da('0x24')](handleEntityNotFound(_0x17cd37,null))['then'](function(_0x35f2d0){if(_0x35f2d0){return _0x35f2d0['destroy']()[_0x53da('0x24')](function(_0x234780){return _0x234780;});}})[_0x53da('0x24')](function(_0x285886){_0x241e7d=_0x285886;if(_0x285886){if(_0x285886[_0x53da('0x5a')]||_0x285886[_0x53da('0x5b')]){return db[_0x285886[_0x53da('0x5a')]?_0x53da('0x5c'):_0x53da('0x5d')][_0x53da('0x55')]({'where':{'id':_0x285886['VoiceQueueId']?_0x285886[_0x53da('0x5a')]:_0x285886[_0x53da('0x5b')]},'attributes':['id',_0x53da('0x27')],'raw':!![]});}}})['then'](function(_0x1fb19a){var _0x5ab3e0={};if(_0x1fb19a){_[_0x53da('0x49')](_0x5ab3e0,_[_0x53da('0x5e')](_0x241e7d[_0x53da('0x5f')],[_0x53da('0x60'),_0x53da('0x61'),'id']));_0x5ab3e0[_0x53da('0x62')]=0x15;_0x5ab3e0[_0x53da('0x63')]=_0x53da('0x64');_0x5ab3e0['campaign']=_0x1fb19a[_0x53da('0x27')];_0x5ab3e0[_0x53da('0x65')]=_0x34f789[_0x53da('0x66')][_0x53da('0x27')];_0x5ab3e0[_0x53da('0x67')]=_0x34f789['user']['id'];_0x5ab3e0[_0x53da('0x64')]=!![];_0x5ab3e0['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5ab3e0[_0x53da('0x68')]=_0x241e7d[_0x53da('0x69')];_0x5ab3e0[_0x53da('0x6a')]=_0x241e7d['VoiceQueueId']?_0x53da('0x6b'):_0x53da('0x6c');return db[_0x53da('0x6d')]['find']({'where':{'id':_0x5ab3e0['ContactId']},'attributes':['firstName',_0x53da('0x6e')]})['then'](function(_0x3ab4d2){if(!_[_0x53da('0x6f')](_0x17cd37)&&!_['isNil'](_0x3ab4d2[_0x53da('0x70')])){_0x5ab3e0[_0x53da('0x71')]=_0x3ab4d2[_0x53da('0x70')];if(!_[_0x53da('0x6f')](_0x3ab4d2['lastName'])){_0x5ab3e0[_0x53da('0x71')]+='\x20'+_0x3ab4d2[_0x53da('0x6e')];}}})[_0x53da('0x72')](function(){return db[_0x53da('0x73')]['create'](_0x5ab3e0);});}})[_0x53da('0x24')](function(){return _0x17cd37[_0x53da('0x1a')](0xcc)[_0x53da('0x1b')]();})[_0x53da('0x56')](handleError(_0x17cd37,null));};exports['getPreview']=function(_0x1f624d,_0x5cde1d,_0x5007c1){var _0x560117=[];return db[_0x53da('0x6d')][_0x53da('0x59')]()[_0x53da('0x24')](function(_0x5674ad){_0x560117=_[_0x53da('0x30')](_0x5674ad);return _0x1f624d[_0x53da('0x66')][_0x53da('0x74')]({'where':{'type':_0x53da('0x75'),'dialActive':!![],'dialMethod':_0x53da('0x76')},'attributes':['id',_0x53da('0x77')],'raw':!![]});})[_0x53da('0x24')](function(_0xebd108){if(_0xebd108&&_0xebd108[_0x53da('0x54')]){return db[_0x53da('0x78')]['transaction'](function(_0x209012){var _0x17d45a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x53da('0x79')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x53da('0x29')](_0xebd108,'id')},'$or':[{'UserId':null},{'UserId':_0x1f624d['user']['id']}]};var _0x2b5c8c=[];if(_0x1f624d[_0x53da('0x58')]['direction']&&_0x1f624d[_0x53da('0x58')][_0x53da('0x7a')]===_0x53da('0x7b')){if(!_[_0x53da('0x7c')](_0x1f624d['body'][_0x53da('0x7d')])){_0x17d45a['id']={'$in':_0x1f624d[_0x53da('0x58')][_0x53da('0x7d')]};}_0x2b5c8c=[[_0x53da('0x7e'),_0x53da('0x7f')],[_0x53da('0x80'),_0xebd108[0x0][_0x53da('0x77')]==='ASC'?_0x53da('0x81'):_0x53da('0x7f')],db['sequelize']['literal'](_0x53da('0x82')),['id','DESC']];}else{if(!_[_0x53da('0x7c')](_0x1f624d['body']['hopperIds'])){_0x17d45a['id']={'$notIn':_0x1f624d[_0x53da('0x58')][_0x53da('0x7d')]};}_0x2b5c8c=[[_0x53da('0x7e'),_0x53da('0x81')],[_0x53da('0x80'),_0xebd108[0x0][_0x53da('0x77')]],db['sequelize'][_0x53da('0x83')](_0x53da('0x84')),['id',_0x53da('0x7f')]];}return db['CmHopper'][_0x53da('0x85')]({'attributes':['id',_0x53da('0x86')],'where':_0x17d45a,'order':_0x2b5c8c,'transaction':_0x209012,'lock':_0x209012[_0x53da('0x87')][_0x53da('0x88')],'include':[{'model':db[_0x53da('0x6d')],'as':_0x53da('0x89'),'attributes':_0x560117,'include':[{'model':db[_0x53da('0x8a')],'as':_0x53da('0x8b'),'attributes':['id',_0x53da('0x27')]}]},{'model':db[_0x53da('0x8c')],'as':_0x53da('0x8d'),'attributes':['id',_0x53da('0x27')]},{'model':db['VoiceQueue'],'as':_0x53da('0x8e'),'attributes':['id',_0x53da('0x27'),_0x53da('0x8f')]}]})[_0x53da('0x24')](function(_0x276abf){if(_0x276abf){return _0x276abf[_0x53da('0x23')]({'UserId':_0x1f624d[_0x53da('0x66')]['id']},{'transaction':_0x209012});}});});}})[_0x53da('0x24')](handleEntityNotFound(_0x5cde1d,null))[_0x53da('0x24')](respondWithResult(_0x5cde1d,null))[_0x53da('0x56')](handleError(_0x5cde1d,null));};exports[_0x53da('0x90')]=function(_0x17d332,_0x250523,_0x3bcce2){return _0x17d332['user'][_0x53da('0x74')]({'where':{'type':_0x53da('0x75'),'dialActive':!![],'dialMethod':_0x53da('0x76')},'attributes':['id'],'raw':!![]})[_0x53da('0x24')](function(_0x4a91f9){if(_0x4a91f9&&_0x4a91f9['length']){return db['CmHopper'][_0x53da('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x53da('0x79')](_0x53da('0x91'))},'VoiceQueueId':{'$in':_[_0x53da('0x29')](_0x4a91f9,'id')},'$or':[{'UserId':null},{'UserId':_0x17d332[_0x53da('0x66')]['id']}]}});}return 0x0;})[_0x53da('0x24')](function(_0xbc9f0a){if(!_[_0x53da('0x6f')](_0xbc9f0a)&&_[_0x53da('0x92')](_0xbc9f0a)){return _0x250523[_0x53da('0x1a')](0xc8)[_0x53da('0x1c')]({'contacts':_0xbc9f0a});}else{logger[_0x53da('0x26')](_0x53da('0x93'),_0x53da('0x90'),0x194,_0x53da('0x94'));_0x250523['sendStatus'](0x194);}})[_0x53da('0x56')](handleError(_0x250523,null));};exports['getTimezones']=function(_0x34ff78,_0xbdf6ab,_0x82a3a4){var _0x26aa1b=shared[_0x53da('0x95')];var _0x3e5501=[];_['map'](_0x26aa1b,function(_0x4cfb69){_0x3e5501[_0x53da('0x96')]({'id':_0x4cfb69[_0x53da('0x27')],'name':_0x4cfb69['name'],'utcOffset':_0x4cfb69[_0x53da('0x97')]});});return _0xbdf6ab[_0x53da('0x1a')](0xc8)[_0x53da('0x1c')]({'tz':_0x3e5501});};exports['getTimezone']=function(_0x2a76f9,_0x257599,_0x2e6257){var _0x36f0a8=shared[_0x53da('0x95')];var _0x9b417b={};if(!_['isNil'](_0x36f0a8[_0x2a76f9[_0x53da('0x58')]['id']]))_0x9b417b=_0x36f0a8[_0x2a76f9[_0x53da('0x58')]['id']];return _0x257599[_0x53da('0x1a')](0xc8)['json'](_0x9b417b);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 33fd68e..d927388 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 _0x061c=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x061c,0x183));var _0xc061=function(_0x4407ac,_0x43a383){_0x4407ac=_0x4407ac-0x0;var _0x517fff=_0x061c[_0x4407ac];return _0x517fff;};'use strict';var _=require(_0xc061('0x0'));var util=require('util');var logger=require(_0xc061('0x1'))(_0xc061('0x2'));var moment=require(_0xc061('0x3'));var BPromise=require('bluebird');var rp=require(_0xc061('0x4'));var fs=require('fs');var path=require(_0xc061('0x5'));var rimraf=require(_0xc061('0x6'));var config=require(_0xc061('0x7'));var attributes=require('./cmHopper.attributes');module[_0xc061('0x8')]=function(_0x2861dd,_0x2200ff){return _0x2861dd[_0xc061('0x9')](_0xc061('0xa'),attributes,{'tableName':_0xc061('0xb'),'paranoid':![],'indexes':[{'name':_0xc061('0xc'),'fields':[_0xc061('0xc')]},{'name':'phone','fields':[_0xc061('0xd')]},{'name':'priority','fields':[_0xc061('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf331=['cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','request-promise','path','../../config/environment','exports','CmHopper'];(function(_0x3811d4,_0x2abdfb){var _0x3f1fae=function(_0x5b8908){while(--_0x5b8908){_0x3811d4['push'](_0x3811d4['shift']());}};_0x3f1fae(++_0x2abdfb);}(_0xf331,0x122));var _0x1f33=function(_0x5d9a47,_0x30f5aa){_0x5d9a47=_0x5d9a47-0x0;var _0x712351=_0xf331[_0x5d9a47];return _0x712351;};'use strict';var _=require(_0x1f33('0x0'));var util=require(_0x1f33('0x1'));var logger=require('../../config/logger')(_0x1f33('0x2'));var moment=require(_0x1f33('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f33('0x4'));var fs=require('fs');var path=require(_0x1f33('0x5'));var rimraf=require('rimraf');var config=require(_0x1f33('0x6'));var attributes=require('./cmHopper.attributes');module[_0x1f33('0x7')]=function(_0x237382,_0x1089aa){return _0x237382['define'](_0x1f33('0x8'),attributes,{'tableName':_0x1f33('0x9'),'paranoid':![],'indexes':[{'name':_0x1f33('0xa'),'fields':['scheduledat']},{'name':_0x1f33('0xb'),'fields':[_0x1f33('0xb')]},{'name':_0x1f33('0xc'),'fields':[_0x1f33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8a11e44..e1383f7 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 _0x9576=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmHopper,\x20%s,\x20%s','result','GetCmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowCmHopper','catch','CreateCmHopper','UpdateCmHopper','CmHopper','update','body','DestroyCmHopper','GetContactDialer','describe','LOCK','CmContact','Contact','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','order','UPDATE','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','log','req\x20value','DESC','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9576,0x182));var _0x6957=function(_0x498de6,_0x2911f6){_0x498de6=_0x498de6-0x0;var _0x42c788=_0x9576[_0x498de6];return _0x42c788;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6d8af8,_0x3425fe,_0x70b8c4){return new BPromise(function(_0x2e5727,_0x6397fe){return client[_0x6957('0xb')](_0x6d8af8,_0x70b8c4)['then'](function(_0x28a4c6){logger[_0x6957('0xc')]('CmHopper,\x20%s,\x20%s',_0x3425fe,'request\x20sent');logger[_0x6957('0xd')](_0x6957('0xe'),_0x3425fe,_0x6957('0xf'),JSON[_0x6957('0x10')](_0x28a4c6));if(_0x28a4c6[_0x6957('0x11')]){if(_0x28a4c6[_0x6957('0x11')][_0x6957('0x12')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x3425fe,_0x28a4c6['error'][_0x6957('0x13')]);return _0x6397fe(_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);}logger[_0x6957('0x11')](_0x6957('0x14'),_0x3425fe,_0x28a4c6[_0x6957('0x11')][_0x6957('0x13')]);return _0x2e5727(_0x28a4c6['error']['message']);}else{logger['info'](_0x6957('0x14'),_0x3425fe,_0x6957('0xf'));_0x2e5727(_0x28a4c6[_0x6957('0x15')][_0x6957('0x13')]);}})['catch'](function(_0x14422d){logger['error'](_0x6957('0x14'),_0x3425fe,_0x14422d);_0x6397fe(_0x14422d);});});}exports[_0x6957('0x16')]=function(_0x49aa31){var _0x2ccd8e=this;return new Promise(function(_0x448ff6,_0x26b577){return db['CmHopper'][_0x6957('0x17')]({'raw':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x49aa31[_0x6957('0x18')]?_0x49aa31['options']['attributes']||null:null,'limit':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1b')]||null:null,'include':_0x49aa31[_0x6957('0x18')]?_0x49aa31[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x49aa31[_0x6957('0x18')]['include'],function(_0x2b2dcd){return{'model':db[_0x2b2dcd[_0x6957('0x1e')]],'as':_0x2b2dcd['as'],'attributes':_0x2b2dcd[_0x6957('0x1f')],'include':_0x2b2dcd[_0x6957('0x1c')]?_['map'](_0x2b2dcd['include'],function(_0xa1e6af){return{'model':db[_0xa1e6af[_0x6957('0x1e')]],'as':_0xa1e6af['as'],'attributes':_0xa1e6af['attributes'],'include':_0xa1e6af['include']?_[_0x6957('0x1d')](_0xa1e6af[_0x6957('0x1c')],function(_0x3bc22f){return{'model':db[_0x3bc22f['model']],'as':_0x3bc22f['as'],'attributes':_0x3bc22f[_0x6957('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6957('0x20')](function(_0x35ba67){logger[_0x6957('0xc')](_0x6957('0x16'),_0x49aa31);logger[_0x6957('0xd')](_0x6957('0x16'),_0x49aa31,JSON[_0x6957('0x10')](_0x35ba67));_0x448ff6(_0x35ba67);})['catch'](function(_0x2e7fe1){logger[_0x6957('0x11')](_0x6957('0x16'),_0x2e7fe1[_0x6957('0x13')],_0x49aa31);_0x26b577(_0x2ccd8e[_0x6957('0x11')](0x1f4,_0x2e7fe1[_0x6957('0x13')]));});});};exports[_0x6957('0x21')]=function(_0xef7f63){var _0x1300b1=this;return new Promise(function(_0x28994a,_0x3de770){return db['CmHopper']['find']({'raw':_0xef7f63[_0x6957('0x18')]?_0xef7f63[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0xef7f63[_0x6957('0x18')]?_0xef7f63['options'][_0x6957('0x1a')]||null:null,'attributes':_0xef7f63[_0x6957('0x18')]?_0xef7f63[_0x6957('0x18')]['attributes']||null:null,'include':_0xef7f63['options']?_0xef7f63[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0xef7f63['options'][_0x6957('0x1c')],function(_0x1d40a7){return{'model':db[_0x1d40a7[_0x6957('0x1e')]],'as':_0x1d40a7['as'],'attributes':_0x1d40a7[_0x6957('0x1f')],'include':_0x1d40a7[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x1d40a7[_0x6957('0x1c')],function(_0xcbfba9){return{'model':db[_0xcbfba9[_0x6957('0x1e')]],'as':_0xcbfba9['as'],'attributes':_0xcbfba9['attributes'],'include':_0xcbfba9[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0xcbfba9[_0x6957('0x1c')],function(_0x5edcae){return{'model':db[_0x5edcae['model']],'as':_0x5edcae['as'],'attributes':_0x5edcae['attributes']};}):[]};}):[]};}):[]:[]})[_0x6957('0x20')](function(_0x59a58e){logger['info'](_0x6957('0x21'),_0xef7f63);logger[_0x6957('0xd')]('ShowCmHopper',_0xef7f63,JSON['stringify'](_0x59a58e));_0x28994a(_0x59a58e);})[_0x6957('0x22')](function(_0x1fa233){logger[_0x6957('0x11')](_0x6957('0x21'),_0x1fa233[_0x6957('0x13')],_0xef7f63);_0x3de770(_0x1300b1['error'](0x1f4,_0x1fa233[_0x6957('0x13')]));});});};exports['CreateCmHopper']=function(_0x52f86c){var _0x57cfa7=this;return new Promise(function(_0x5ab079,_0x570fd6){return db['CmHopper']['create'](_0x52f86c['body'],{'raw':_0x52f86c['options']?_0x52f86c[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![]})[_0x6957('0x20')](function(_0x330c5c){logger[_0x6957('0xc')](_0x6957('0x23'),_0x52f86c);logger[_0x6957('0xd')](_0x6957('0x23'),_0x52f86c,JSON['stringify'](_0x330c5c));_0x5ab079(_0x330c5c);})[_0x6957('0x22')](function(_0x570450){logger[_0x6957('0x11')](_0x6957('0x23'),_0x570450[_0x6957('0x13')],_0x52f86c);_0x570fd6(_0x57cfa7[_0x6957('0x11')](0x1f4,_0x570450[_0x6957('0x13')]));});});};exports[_0x6957('0x24')]=function(_0x170084){var _0x16575e=this;return new Promise(function(_0x18fb2a,_0x35fa2d){return db[_0x6957('0x25')][_0x6957('0x26')](_0x170084[_0x6957('0x27')],{'raw':_0x170084[_0x6957('0x18')]?_0x170084[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170084['options']?_0x170084[_0x6957('0x18')]['where']||null:null,'attributes':_0x170084['options']?_0x170084[_0x6957('0x18')]['attributes']||null:null,'limit':_0x170084['options']?_0x170084[_0x6957('0x18')][_0x6957('0x1b')]||null:null})[_0x6957('0x20')](function(_0x345dd1){logger[_0x6957('0xc')](_0x6957('0x24'),_0x170084);logger[_0x6957('0xd')](_0x6957('0x24'),_0x170084,JSON[_0x6957('0x10')](_0x345dd1));_0x18fb2a(_0x345dd1);})[_0x6957('0x22')](function(_0x51e907){logger['error'](_0x6957('0x24'),_0x51e907['message'],_0x170084);_0x35fa2d(_0x16575e[_0x6957('0x11')](0x1f4,_0x51e907[_0x6957('0x13')]));});});};exports['DestroyCmHopper']=function(_0xd49c13){var _0x3a4b6c=this;return new Promise(function(_0x2ffb11,_0x5461d8){return db[_0x6957('0x25')]['destroy']({'where':_0xd49c13[_0x6957('0x18')]?_0xd49c13[_0x6957('0x18')][_0x6957('0x1a')]||null:null})[_0x6957('0x20')](function(_0x4fb888){logger[_0x6957('0xc')](_0x6957('0x28'),_0xd49c13);logger['debug'](_0x6957('0x28'),_0xd49c13,JSON[_0x6957('0x10')](_0x4fb888));_0x2ffb11(_0x4fb888);})[_0x6957('0x22')](function(_0x118616){logger['error']('DestroyCmHopper',_0x118616[_0x6957('0x13')],_0xd49c13);_0x5461d8(_0x3a4b6c[_0x6957('0x11')](0x1f4,_0x118616[_0x6957('0x13')]));});});};exports[_0x6957('0x29')]=function(_0x519e0c){var _0x1681f9=this;return new Promise(function(_0x4ca6dc,_0x10fac5){return db['CmContact'][_0x6957('0x2a')]()['then'](function(_0x354ace){return db['sequelize']['transaction'](function(_0x274d40){return db[_0x6957('0x25')][_0x6957('0x17')]({'where':_0x519e0c[_0x6957('0x18')]?_0x519e0c[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x519e0c[_0x6957('0x18')]?_0x519e0c[_0x6957('0x18')][_0x6957('0x1f')]||null:null,'limit':_0x519e0c[_0x6957('0x18')]?_0x519e0c['options'][_0x6957('0x1b')]||null:null,'order':_0x519e0c[_0x6957('0x18')]?_0x519e0c[_0x6957('0x18')]['order']||null:null,'transaction':_0x274d40,'lock':_0x274d40[_0x6957('0x2b')]['UPDATE'],'include':[{'model':db[_0x6957('0x2c')],'as':_0x6957('0x2d'),'attributes':_['keys'](_0x354ace)},{'model':db[_0x6957('0x2e')],'as':_0x6957('0x2f'),'attributes':['id',_0x6957('0x30'),_0x6957('0x31')]}]})[_0x6957('0x20')](function(_0x3eba40){var _0x3963fb=[];var _0x4543e7=[];for(var _0x596f95=0x0;_0x596f95<_0x3eba40[_0x6957('0x32')];_0x596f95+=0x1){if(!_0x4543e7['includes'](_0x3eba40[_0x596f95][_0x6957('0x33')])){_0x4543e7[_0x6957('0x34')](_0x3eba40[_0x596f95][_0x6957('0x33')]);_0x3963fb['push'](_0x3eba40[_0x596f95][_0x6957('0x26')](_0x519e0c[_0x6957('0x27')],{'transaction':_0x274d40}));}}return BPromise[_0x6957('0x35')](_0x3963fb);});})['then'](function(_0x574d1e){logger[_0x6957('0xc')](_0x6957('0x29'),_0x519e0c);logger[_0x6957('0xd')]('GetContactDialer',_0x519e0c,JSON[_0x6957('0x10')](_0x574d1e));_0x4ca6dc(_0x574d1e);})['catch'](function(_0x6b9d9e){logger[_0x6957('0x11')](_0x6957('0x29'),_0x6b9d9e['message'],_0x519e0c);_0x10fac5(_0x1681f9[_0x6957('0x11')](0x1f4,_0x6b9d9e['message']));});});});};exports[_0x6957('0x36')]=function(_0x23d1a3){var _0x4d91d4=this;return new Promise(function(_0x221b5a,_0x455770){return db[_0x6957('0x37')][_0x6957('0x38')](function(_0x5ce857){return db[_0x6957('0x39')]['create'](_0x23d1a3['body'],{'raw':_0x23d1a3[_0x6957('0x18')]?_0x23d1a3['options'][_0x6957('0x19')]===undefined?!![]:![]:!![],'transaction':_0x5ce857})[_0x6957('0x20')](function(){return db[_0x6957('0x25')][_0x6957('0x3a')]({'where':_0x23d1a3[_0x6957('0x18')]?_0x23d1a3[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'transaction':_0x5ce857});});})['then'](function(_0x345372){logger[_0x6957('0xc')](_0x6957('0x36'),_0x23d1a3);logger[_0x6957('0xd')]('MoveContactManagedDialer',_0x23d1a3,JSON[_0x6957('0x10')](_0x345372));_0x221b5a(_0x345372);})[_0x6957('0x22')](function(_0x1542ed){logger[_0x6957('0x11')]('MoveContactManagedDialer',_0x1542ed[_0x6957('0x13')],_0x23d1a3);_0x455770(_0x4d91d4[_0x6957('0x11')](0x1f4,_0x1542ed[_0x6957('0x13')]));});});};exports[_0x6957('0x3b')]=function(_0x5e3cb5){var _0x770dd3=this;return new Promise(function(_0x16babe,_0x463df2){return db[_0x6957('0x25')][_0x6957('0x17')]({'raw':_0x5e3cb5[_0x6957('0x18')]?_0x5e3cb5[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x5e3cb5['options']?_0x5e3cb5['options'][_0x6957('0x1a')]||null:null,'attributes':[[db[_0x6957('0x37')]['fn'](_0x6957('0x3c'),db[_0x6957('0x37')]['fn']('IF',db[_0x6957('0x37')][_0x6957('0x3d')](_0x6957('0x3e')+util[_0x6957('0x3f')](_0x6957('0x40'),moment()['format'](_0x6957('0x41')))+_0x6957('0x42')))),'contactsRescheduled']]})['then'](function(_0x1077ea){logger[_0x6957('0xc')](_0x6957('0x3b'),_0x5e3cb5);logger[_0x6957('0xd')](_0x6957('0x3b'),_0x5e3cb5,JSON[_0x6957('0x10')](_0x1077ea));_0x16babe(_0x1077ea);})[_0x6957('0x22')](function(_0x5ae056){logger[_0x6957('0x11')]('CountReScheduled',_0x5ae056[_0x6957('0x13')],_0x5e3cb5);_0x463df2(_0x770dd3[_0x6957('0x11')](0x1f4,_0x5ae056['message']));});});};exports['GetContactRecallMe']=function(_0x1ed255){var _0x4eb586=this;return new Promise(function(_0xc94667,_0x3c5195){return db[_0x6957('0x2c')][_0x6957('0x2a')]()[_0x6957('0x20')](function(_0x1b3a87){return db[_0x6957('0x37')]['transaction'](function(_0x20e0e2){return db['CmHopper']['findAll']({'where':_0x1ed255['options']?_0x1ed255[_0x6957('0x18')][_0x6957('0x1a')]||null:null,'attributes':_0x1ed255['options']?_0x1ed255[_0x6957('0x18')][_0x6957('0x1f')]||null:null,'limit':0x1,'order':_0x1ed255['options']?_0x1ed255[_0x6957('0x18')][_0x6957('0x43')]||null:null,'group':db['CmHopper'][_0x6957('0x33')],'transaction':_0x20e0e2,'lock':_0x20e0e2[_0x6957('0x2b')][_0x6957('0x44')],'include':_0x1ed255[_0x6957('0x18')]?_0x1ed255[_0x6957('0x18')][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x1ed255['options'][_0x6957('0x1c')],function(_0x4a7701){return{'model':db[_0x4a7701['model']],'as':_0x4a7701['as'],'attributes':_0x4a7701[_0x6957('0x1f')],'include':_0x4a7701[_0x6957('0x1c')]?_['map'](_0x4a7701[_0x6957('0x1c')],function(_0x4c5803){return{'model':db[_0x4c5803['model']],'as':_0x4c5803['as'],'attributes':_0x4c5803[_0x6957('0x1f')],'include':_0x4c5803['include']?_[_0x6957('0x1d')](_0x4c5803['include'],function(_0x1c768d){return{'model':db[_0x1c768d['model']],'as':_0x1c768d['as'],'attributes':_0x1c768d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x130cb8){var _0x5bb0c7=[];for(var _0x5d4174=0x0;_0x5d4174<_0x130cb8[_0x6957('0x32')];_0x5d4174+=0x1){_0x5bb0c7['push'](_0x130cb8[_0x5d4174][_0x6957('0x26')](_0x1ed255['body'],{'transaction':_0x20e0e2}));}return BPromise[_0x6957('0x35')](_0x5bb0c7);});})['then'](function(_0x21ea52){logger[_0x6957('0xc')](_0x6957('0x45'),_0x1ed255);logger[_0x6957('0xd')](_0x6957('0x45'),_0x1ed255,JSON[_0x6957('0x10')](_0x21ea52));_0xc94667(_0x21ea52);})[_0x6957('0x22')](function(_0x369916){logger[_0x6957('0x11')](_0x6957('0x45'),_0x369916[_0x6957('0x13')],_0x1ed255);_0x3c5195(_0x4eb586[_0x6957('0x11')](0x1f4,_0x369916[_0x6957('0x13')]));});});});};exports[_0x6957('0x46')]=function(_0x189fdb){var _0x4b6015=this;return new Promise(function(_0x71eb06,_0x8ad2b4){db[_0x6957('0x2c')]['describe']()['then'](function(_0x59b090){return db[_0x6957('0x25')][_0x6957('0x17')]({'raw':_0x189fdb[_0x6957('0x18')]?_0x189fdb[_0x6957('0x18')][_0x6957('0x19')]===undefined?!![]:![]:!![],'where':_0x189fdb[_0x6957('0x18')]?_0x189fdb['options']['where']||null:null,'attributes':_0x189fdb[_0x6957('0x18')]?_0x189fdb[_0x6957('0x18')][_0x6957('0x1f')]||null:null,'limit':_0x189fdb[_0x6957('0x18')]?_0x189fdb[_0x6957('0x18')][_0x6957('0x1b')]||null:null,'include':_0x189fdb['options']?_0x189fdb['options'][_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x189fdb[_0x6957('0x18')][_0x6957('0x1c')],function(_0x2feb45){return{'model':db[_0x2feb45[_0x6957('0x1e')]],'as':_0x2feb45['as'],'attributes':_0x2feb45['as']===_0x6957('0x2d')?_[_0x6957('0x47')](_0x59b090):_0x2feb45[_0x6957('0x1f')],'include':_0x2feb45['include']?_[_0x6957('0x1d')](_0x2feb45['include'],function(_0x3383ab){return{'model':db[_0x3383ab[_0x6957('0x1e')]],'as':_0x3383ab['as'],'attributes':_0x3383ab[_0x6957('0x1f')],'include':_0x3383ab[_0x6957('0x1c')]?_[_0x6957('0x1d')](_0x3383ab[_0x6957('0x1c')],function(_0x43931b){return{'model':db[_0x43931b['model']],'as':_0x43931b['as'],'attributes':_0x43931b[_0x6957('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x323cd7){logger[_0x6957('0xc')](_0x6957('0x16'),_0x189fdb);logger[_0x6957('0xd')](_0x6957('0x16'),_0x189fdb,JSON[_0x6957('0x10')](_0x323cd7));_0x71eb06(_0x323cd7);})[_0x6957('0x22')](function(_0x2ec15f){logger[_0x6957('0x11')](_0x6957('0x16'),_0x2ec15f[_0x6957('0x13')],_0x189fdb);_0x8ad2b4(_0x4b6015[_0x6957('0x11')](0x1f4,_0x2ec15f[_0x6957('0x13')]));});});});};exports[_0x6957('0x48')]=function(_0x552607){console[_0x6957('0x49')](_0x6957('0x4a'),_0x552607);var _0x486c55=this;return new Promise(function(_0x2949b5,_0x1c30f9){return db[_0x6957('0x2c')]['findOne']({'raw':!![],'where':{'phone':_0x552607[_0x6957('0x27')]['phone']},'attributes':['id'],'order':[['id',_0x6957('0x4b')]]})[_0x6957('0x20')](function(_0x469cb0){console[_0x6957('0x49')](_0x6957('0x4c'),_0x469cb0);logger[_0x6957('0xc')]('getContactByPhone',_0x552607);logger[_0x6957('0xd')]('getContactByPhone',_0x552607,JSON[_0x6957('0x10')](_0x469cb0));_0x2949b5(_0x469cb0);})[_0x6957('0x22')](function(_0x157717){logger[_0x6957('0x11')](_0x6957('0x4d'),_0x157717[_0x6957('0x13')],_0x552607);_0x1c30f9(_0x486c55[_0x6957('0x11')](0x1f4,_0x157717[_0x6957('0x13')]));});});}; \ No newline at end of file +var _0xeb0d=['`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','GetContactRecallMe','UserId','LOCK','UPDATE','GetCmHopperPreview','GetContactByPhone','log','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','findAll','options','raw','attributes','limit','include','map','model','stringify','find','where','ShowCmHopper','CreateCmHopper','CmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','User','Agent','name','voicePause','length','includes','push','update','all','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x4c7481,_0x2d86d5){_0x4c7481=_0x4c7481-0x0;var _0x46d188=_0xeb0d[_0x4c7481];return _0x46d188;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdeb0('0x1'));var fs=require('fs');var Redis=require(_0xdeb0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x3'));var logger=require(_0xdeb0('0x4'))(_0xdeb0('0x5'));var config=require(_0xdeb0('0x6'));var jayson=require(_0xdeb0('0x7'));var client=jayson[_0xdeb0('0x8')][_0xdeb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ebaa,_0x55ffce,_0x28a1a4){return new BPromise(function(_0x16b36b,_0x541d8b){return client[_0xdeb0('0xa')](_0x27ebaa,_0x28a1a4)[_0xdeb0('0xb')](function(_0x3336a6){logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,_0xdeb0('0xe'));logger[_0xdeb0('0xf')](_0xdeb0('0x10'),_0x55ffce,'request\x20sent',JSON['stringify'](_0x3336a6));if(_0x3336a6[_0xdeb0('0x11')]){if(_0x3336a6['error'][_0xdeb0('0x12')]===0x1f4){logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);return _0x541d8b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6['error'][_0xdeb0('0x13')]);return _0x16b36b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,'request\x20sent');_0x16b36b(_0x3336a6[_0xdeb0('0x14')]['message']);}})[_0xdeb0('0x15')](function(_0x473fb9){logger[_0xdeb0('0x11')]('CmHopper,\x20%s,\x20%s',_0x55ffce,_0x473fb9);_0x541d8b(_0x473fb9);});});}exports[_0xdeb0('0x16')]=function(_0x51e7ee){var _0x7f30d2=this;return new Promise(function(_0x2b1efa,_0x7ad25c){return db['CmHopper'][_0xdeb0('0x17')]({'raw':_0x51e7ee['options']?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'where':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')]['where']||null:null,'attributes':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x1a')]||null:null,'limit':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null,'include':_0x51e7ee[_0xdeb0('0x18')]?_0x51e7ee[_0xdeb0('0x18')][_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x51e7ee[_0xdeb0('0x18')]['include'],function(_0x566f1f){return{'model':db[_0x566f1f['model']],'as':_0x566f1f['as'],'attributes':_0x566f1f[_0xdeb0('0x1a')],'include':_0x566f1f['include']?_['map'](_0x566f1f['include'],function(_0x38bd4d){return{'model':db[_0x38bd4d[_0xdeb0('0x1e')]],'as':_0x38bd4d['as'],'attributes':_0x38bd4d[_0xdeb0('0x1a')],'include':_0x38bd4d[_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x38bd4d[_0xdeb0('0x1c')],function(_0x19456b){return{'model':db[_0x19456b[_0xdeb0('0x1e')]],'as':_0x19456b['as'],'attributes':_0x19456b[_0xdeb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x191824){logger[_0xdeb0('0xc')](_0xdeb0('0x16'),_0x51e7ee);logger[_0xdeb0('0xf')](_0xdeb0('0x16'),_0x51e7ee,JSON[_0xdeb0('0x1f')](_0x191824));_0x2b1efa(_0x191824);})[_0xdeb0('0x15')](function(_0x59cc01){logger[_0xdeb0('0x11')](_0xdeb0('0x16'),_0x59cc01['message'],_0x51e7ee);_0x7ad25c(_0x7f30d2[_0xdeb0('0x11')](0x1f4,_0x59cc01['message']));});});};exports['ShowCmHopper']=function(_0x1d338){var _0x2085c2=this;return new Promise(function(_0x32ec24,_0x2572d0){return db['CmHopper'][_0xdeb0('0x20')]({'raw':_0x1d338[_0xdeb0('0x18')]?_0x1d338[_0xdeb0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1d338[_0xdeb0('0x18')]?_0x1d338['options'][_0xdeb0('0x21')]||null:null,'attributes':_0x1d338[_0xdeb0('0x18')]?_0x1d338[_0xdeb0('0x18')]['attributes']||null:null,'include':_0x1d338[_0xdeb0('0x18')]?_0x1d338['options'][_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x1d338[_0xdeb0('0x18')][_0xdeb0('0x1c')],function(_0x3983b2){return{'model':db[_0x3983b2[_0xdeb0('0x1e')]],'as':_0x3983b2['as'],'attributes':_0x3983b2['attributes'],'include':_0x3983b2[_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x3983b2[_0xdeb0('0x1c')],function(_0x4c0411){return{'model':db[_0x4c0411[_0xdeb0('0x1e')]],'as':_0x4c0411['as'],'attributes':_0x4c0411[_0xdeb0('0x1a')],'include':_0x4c0411['include']?_[_0xdeb0('0x1d')](_0x4c0411[_0xdeb0('0x1c')],function(_0x3db036){return{'model':db[_0x3db036[_0xdeb0('0x1e')]],'as':_0x3db036['as'],'attributes':_0x3db036[_0xdeb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x57297c){logger[_0xdeb0('0xc')](_0xdeb0('0x22'),_0x1d338);logger[_0xdeb0('0xf')](_0xdeb0('0x22'),_0x1d338,JSON['stringify'](_0x57297c));_0x32ec24(_0x57297c);})[_0xdeb0('0x15')](function(_0x4be7f0){logger[_0xdeb0('0x11')](_0xdeb0('0x22'),_0x4be7f0[_0xdeb0('0x13')],_0x1d338);_0x2572d0(_0x2085c2[_0xdeb0('0x11')](0x1f4,_0x4be7f0['message']));});});};exports[_0xdeb0('0x23')]=function(_0x9ac6a3){var _0x1ddbee=this;return new Promise(function(_0x443c04,_0x435048){return db[_0xdeb0('0x24')][_0xdeb0('0x25')](_0x9ac6a3[_0xdeb0('0x26')],{'raw':_0x9ac6a3[_0xdeb0('0x18')]?_0x9ac6a3[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3123cc){logger[_0xdeb0('0xc')]('CreateCmHopper',_0x9ac6a3);logger[_0xdeb0('0xf')](_0xdeb0('0x23'),_0x9ac6a3,JSON[_0xdeb0('0x1f')](_0x3123cc));_0x443c04(_0x3123cc);})[_0xdeb0('0x15')](function(_0x4a824c){logger[_0xdeb0('0x11')](_0xdeb0('0x23'),_0x4a824c['message'],_0x9ac6a3);_0x435048(_0x1ddbee[_0xdeb0('0x11')](0x1f4,_0x4a824c['message']));});});};exports[_0xdeb0('0x27')]=function(_0x1b7acc){var _0x47e246=this;return new Promise(function(_0x104b70,_0x87cd00){return db['CmHopper']['update'](_0x1b7acc[_0xdeb0('0x26')],{'raw':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc[_0xdeb0('0x18')]['where']||null:null,'attributes':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc['options'][_0xdeb0('0x1a')]||null:null,'limit':_0x1b7acc[_0xdeb0('0x18')]?_0x1b7acc[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null})['then'](function(_0x2d45b9){logger[_0xdeb0('0xc')](_0xdeb0('0x27'),_0x1b7acc);logger[_0xdeb0('0xf')](_0xdeb0('0x27'),_0x1b7acc,JSON[_0xdeb0('0x1f')](_0x2d45b9));_0x104b70(_0x2d45b9);})[_0xdeb0('0x15')](function(_0x1f1ff7){logger[_0xdeb0('0x11')]('UpdateCmHopper',_0x1f1ff7[_0xdeb0('0x13')],_0x1b7acc);_0x87cd00(_0x47e246[_0xdeb0('0x11')](0x1f4,_0x1f1ff7[_0xdeb0('0x13')]));});});};exports[_0xdeb0('0x28')]=function(_0x3a35bf){var _0xda0062=this;return new Promise(function(_0x5894e8,_0x4a440){return db[_0xdeb0('0x24')][_0xdeb0('0x29')]({'where':_0x3a35bf['options']?_0x3a35bf[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null})[_0xdeb0('0xb')](function(_0x8ffedd){logger[_0xdeb0('0xc')]('DestroyCmHopper',_0x3a35bf);logger[_0xdeb0('0xf')](_0xdeb0('0x28'),_0x3a35bf,JSON[_0xdeb0('0x1f')](_0x8ffedd));_0x5894e8(_0x8ffedd);})[_0xdeb0('0x15')](function(_0x2e7fc9){logger['error']('DestroyCmHopper',_0x2e7fc9[_0xdeb0('0x13')],_0x3a35bf);_0x4a440(_0xda0062[_0xdeb0('0x11')](0x1f4,_0x2e7fc9['message']));});});};exports[_0xdeb0('0x2a')]=function(_0x5af87f){var _0xb9ba14=this;return new Promise(function(_0x106119,_0xcdfb83){return db[_0xdeb0('0x2b')][_0xdeb0('0x2c')]()['then'](function(_0x2de391){return db[_0xdeb0('0x2d')][_0xdeb0('0x2e')](function(_0x2d0ea9){return db[_0xdeb0('0x24')]['findAll']({'where':_0x5af87f['options']?_0x5af87f[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'attributes':_0x5af87f[_0xdeb0('0x18')]?_0x5af87f[_0xdeb0('0x18')][_0xdeb0('0x1a')]||null:null,'limit':_0x5af87f[_0xdeb0('0x18')]?_0x5af87f[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null,'order':_0x5af87f[_0xdeb0('0x18')]?_0x5af87f['options'][_0xdeb0('0x2f')]||null:null,'transaction':_0x2d0ea9,'lock':_0x2d0ea9['LOCK']['UPDATE'],'include':[{'model':db[_0xdeb0('0x2b')],'as':'Contact','attributes':_['keys'](_0x2de391)},{'model':db[_0xdeb0('0x30')],'as':_0xdeb0('0x31'),'attributes':['id',_0xdeb0('0x32'),_0xdeb0('0x33')]}]})[_0xdeb0('0xb')](function(_0x4cc0ea){var _0x141550=[];var _0x530fb2=[];for(var _0x549422=0x0;_0x549422<_0x4cc0ea[_0xdeb0('0x34')];_0x549422+=0x1){if(!_0x530fb2[_0xdeb0('0x35')](_0x4cc0ea[_0x549422]['UserId'])){_0x530fb2['push'](_0x4cc0ea[_0x549422]['UserId']);_0x141550[_0xdeb0('0x36')](_0x4cc0ea[_0x549422][_0xdeb0('0x37')](_0x5af87f[_0xdeb0('0x26')],{'transaction':_0x2d0ea9}));}}return BPromise[_0xdeb0('0x38')](_0x141550);});})['then'](function(_0x4e04ed){logger[_0xdeb0('0xc')](_0xdeb0('0x2a'),_0x5af87f);logger[_0xdeb0('0xf')](_0xdeb0('0x2a'),_0x5af87f,JSON[_0xdeb0('0x1f')](_0x4e04ed));_0x106119(_0x4e04ed);})['catch'](function(_0x379f97){logger['error'](_0xdeb0('0x2a'),_0x379f97[_0xdeb0('0x13')],_0x5af87f);_0xcdfb83(_0xb9ba14[_0xdeb0('0x11')](0x1f4,_0x379f97[_0xdeb0('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x27f610){var _0x297352=this;return new Promise(function(_0x366a92,_0x5e9476){return db['sequelize'][_0xdeb0('0x2e')](function(_0x45d2fb){return db[_0xdeb0('0x39')][_0xdeb0('0x25')](_0x27f610[_0xdeb0('0x26')],{'raw':_0x27f610['options']?_0x27f610['options'][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'transaction':_0x45d2fb})['then'](function(){return db[_0xdeb0('0x24')][_0xdeb0('0x29')]({'where':_0x27f610[_0xdeb0('0x18')]?_0x27f610[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'transaction':_0x45d2fb});});})[_0xdeb0('0xb')](function(_0x31044a){logger[_0xdeb0('0xc')](_0xdeb0('0x3a'),_0x27f610);logger[_0xdeb0('0xf')](_0xdeb0('0x3a'),_0x27f610,JSON[_0xdeb0('0x1f')](_0x31044a));_0x366a92(_0x31044a);})[_0xdeb0('0x15')](function(_0x5d2c09){logger['error'](_0xdeb0('0x3a'),_0x5d2c09[_0xdeb0('0x13')],_0x27f610);_0x5e9476(_0x297352['error'](0x1f4,_0x5d2c09['message']));});});};exports[_0xdeb0('0x3b')]=function(_0x3920df){var _0xaacfa9=this;return new Promise(function(_0x1acd83,_0x3a7530){return db[_0xdeb0('0x24')][_0xdeb0('0x17')]({'raw':_0x3920df[_0xdeb0('0x18')]?_0x3920df[_0xdeb0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3920df[_0xdeb0('0x18')]?_0x3920df[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'attributes':[[db[_0xdeb0('0x2d')]['fn'](_0xdeb0('0x3c'),db[_0xdeb0('0x2d')]['fn']('IF',db[_0xdeb0('0x2d')][_0xdeb0('0x3d')](_0xdeb0('0x3e')+util[_0xdeb0('0x3f')]('\x22%s\x22',moment()[_0xdeb0('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xdeb0('0x40')))),'contactsRescheduled']]})['then'](function(_0x321f3e){logger['info'](_0xdeb0('0x3b'),_0x3920df);logger[_0xdeb0('0xf')]('CountReScheduled',_0x3920df,JSON[_0xdeb0('0x1f')](_0x321f3e));_0x1acd83(_0x321f3e);})[_0xdeb0('0x15')](function(_0x389a99){logger[_0xdeb0('0x11')](_0xdeb0('0x3b'),_0x389a99[_0xdeb0('0x13')],_0x3920df);_0x3a7530(_0xaacfa9[_0xdeb0('0x11')](0x1f4,_0x389a99[_0xdeb0('0x13')]));});});};exports[_0xdeb0('0x41')]=function(_0x383c53){var _0x4853b9=this;return new Promise(function(_0x4cc359,_0x53d617){return db[_0xdeb0('0x2b')][_0xdeb0('0x2c')]()[_0xdeb0('0xb')](function(_0xafd946){return db[_0xdeb0('0x2d')][_0xdeb0('0x2e')](function(_0x1418e7){return db['CmHopper'][_0xdeb0('0x17')]({'where':_0x383c53[_0xdeb0('0x18')]?_0x383c53['options']['where']||null:null,'attributes':_0x383c53[_0xdeb0('0x18')]?_0x383c53[_0xdeb0('0x18')][_0xdeb0('0x1a')]||null:null,'limit':0x1,'order':_0x383c53[_0xdeb0('0x18')]?_0x383c53[_0xdeb0('0x18')][_0xdeb0('0x2f')]||null:null,'group':db['CmHopper'][_0xdeb0('0x42')],'transaction':_0x1418e7,'lock':_0x1418e7[_0xdeb0('0x43')][_0xdeb0('0x44')],'include':_0x383c53[_0xdeb0('0x18')]?_0x383c53[_0xdeb0('0x18')]['include']?_['map'](_0x383c53[_0xdeb0('0x18')]['include'],function(_0x470845){return{'model':db[_0x470845[_0xdeb0('0x1e')]],'as':_0x470845['as'],'attributes':_0x470845[_0xdeb0('0x1a')],'include':_0x470845[_0xdeb0('0x1c')]?_['map'](_0x470845[_0xdeb0('0x1c')],function(_0x5c7ba2){return{'model':db[_0x5c7ba2[_0xdeb0('0x1e')]],'as':_0x5c7ba2['as'],'attributes':_0x5c7ba2[_0xdeb0('0x1a')],'include':_0x5c7ba2['include']?_['map'](_0x5c7ba2['include'],function(_0x2a64d1){return{'model':db[_0x2a64d1[_0xdeb0('0x1e')]],'as':_0x2a64d1['as'],'attributes':_0x2a64d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x2e2e50){var _0x2a3b29=[];for(var _0x303638=0x0;_0x303638<_0x2e2e50['length'];_0x303638+=0x1){_0x2a3b29[_0xdeb0('0x36')](_0x2e2e50[_0x303638][_0xdeb0('0x37')](_0x383c53[_0xdeb0('0x26')],{'transaction':_0x1418e7}));}return BPromise[_0xdeb0('0x38')](_0x2a3b29);});})[_0xdeb0('0xb')](function(_0x203d89){logger['info'](_0xdeb0('0x41'),_0x383c53);logger['debug'](_0xdeb0('0x41'),_0x383c53,JSON['stringify'](_0x203d89));_0x4cc359(_0x203d89);})[_0xdeb0('0x15')](function(_0x3ec9b4){logger[_0xdeb0('0x11')](_0xdeb0('0x41'),_0x3ec9b4[_0xdeb0('0x13')],_0x383c53);_0x53d617(_0x4853b9[_0xdeb0('0x11')](0x1f4,_0x3ec9b4[_0xdeb0('0x13')]));});});});};exports[_0xdeb0('0x45')]=function(_0x124bdc){var _0x566547=this;return new Promise(function(_0x2e19a0,_0x3957be){db[_0xdeb0('0x2b')][_0xdeb0('0x2c')]()['then'](function(_0x288e10){return db[_0xdeb0('0x24')][_0xdeb0('0x17')]({'raw':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')][_0xdeb0('0x19')]===undefined?!![]:![]:!![],'where':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')][_0xdeb0('0x21')]||null:null,'attributes':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')]['attributes']||null:null,'limit':_0x124bdc[_0xdeb0('0x18')]?_0x124bdc[_0xdeb0('0x18')][_0xdeb0('0x1b')]||null:null,'include':_0x124bdc['options']?_0x124bdc['options'][_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x124bdc['options']['include'],function(_0x7f5d0c){return{'model':db[_0x7f5d0c[_0xdeb0('0x1e')]],'as':_0x7f5d0c['as'],'attributes':_0x7f5d0c['as']==='Contact'?_['keys'](_0x288e10):_0x7f5d0c[_0xdeb0('0x1a')],'include':_0x7f5d0c[_0xdeb0('0x1c')]?_[_0xdeb0('0x1d')](_0x7f5d0c['include'],function(_0x5b2188){return{'model':db[_0x5b2188[_0xdeb0('0x1e')]],'as':_0x5b2188['as'],'attributes':_0x5b2188['attributes'],'include':_0x5b2188[_0xdeb0('0x1c')]?_['map'](_0x5b2188[_0xdeb0('0x1c')],function(_0x41949c){return{'model':db[_0x41949c[_0xdeb0('0x1e')]],'as':_0x41949c['as'],'attributes':_0x41949c[_0xdeb0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeb0('0xb')](function(_0x255cf1){logger[_0xdeb0('0xc')](_0xdeb0('0x16'),_0x124bdc);logger[_0xdeb0('0xf')]('GetCmHopper',_0x124bdc,JSON['stringify'](_0x255cf1));_0x2e19a0(_0x255cf1);})[_0xdeb0('0x15')](function(_0x3a6fe9){logger['error']('GetCmHopper',_0x3a6fe9['message'],_0x124bdc);_0x3957be(_0x566547[_0xdeb0('0x11')](0x1f4,_0x3a6fe9[_0xdeb0('0x13')]));});});});};exports[_0xdeb0('0x46')]=function(_0x234de1){console[_0xdeb0('0x47')]('req\x20value',_0x234de1);}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 27bcd58..e084bb4 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 _0xdc97=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','getPreview','/timezone','getTimezone','put'];(function(_0x54ce88,_0x19778e){var _0x475fea=function(_0x43d9c2){while(--_0x43d9c2){_0x54ce88['push'](_0x54ce88['shift']());}};_0x475fea(++_0x19778e);}(_0xdc97,0x13b));var _0x7dc9=function(_0xa47489,_0x5d6b82){_0xa47489=_0xa47489-0x0;var _0x3d19d1=_0xdc97[_0xa47489];return _0x3d19d1;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var auth=require(_0x7dc9('0x4'));var interaction=require(_0x7dc9('0x5'));var config=require('../../config/environment');var controller=require(_0x7dc9('0x6'));router[_0x7dc9('0x7')]('/',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x9')]);router['get'](_0x7dc9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7dc9('0x7')](_0x7dc9('0xb'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xc')]);router[_0x7dc9('0x7')]('/timezones',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0x7')](_0x7dc9('0xe'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/preview',auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x11')]);router['post'](_0x7dc9('0x12'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x13')]);router[_0x7dc9('0x14')](_0x7dc9('0xe'),auth[_0x7dc9('0x8')](),controller['update']);router[_0x7dc9('0x15')](_0x7dc9('0xe'),auth[_0x7dc9('0x8')](),controller[_0x7dc9('0x16')]);module[_0x7dc9('0x17')]=router; \ No newline at end of file +var _0x7fbe=['/timezone','getTimezone','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','create','/preview','getPreview'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x20936e,_0x4d5283){_0x20936e=_0x20936e-0x0;var _0x50a212=_0x7fbe[_0x20936e];return _0x50a212;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/timezones',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0x8')](_0xe7fb('0xf'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x11')](_0xe7fb('0x13'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x11')](_0xe7fb('0x15'),auth['isAuthenticated'](),controller[_0xe7fb('0x16')]);router[_0xe7fb('0x17')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x18')]);router['delete'](_0xe7fb('0xf'),auth['isAuthenticated'](),controller[_0xe7fb('0x19')]);module[_0xe7fb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 435692b..d76dff2 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 _0xed47=['INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xed47,0x189));var _0x7ed4=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0xed47[_0x592d48];return _0x5d789e;};'use strict';var moment=require(_0x7ed4('0x0'));var Sequelize=require('sequelize');module[_0x7ed4('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x7ed4('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7ed4('0x4')],'defaultValue':moment()['format'](_0x7ed4('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7ed4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f3d=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','DATE','format'];(function(_0x5fd7ed,_0x4afe7e){var _0xb1326b=function(_0x1f4077){while(--_0x1f4077){_0x5fd7ed['push'](_0x5fd7ed['shift']());}};_0xb1326b(++_0x4afe7e);}(_0x0f3d,0x78));var _0xd0f3=function(_0x19e583,_0x3861a8){_0x19e583=_0x19e583-0x0;var _0x324103=_0x0f3d[_0x19e583];return _0x324103;};'use strict';var moment=require(_0xd0f3('0x0'));var Sequelize=require(_0xd0f3('0x1'));module[_0xd0f3('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xd0f3('0x4')],'defaultValue':moment()[_0xd0f3('0x5')](_0xd0f3('0x6'))},'countbusyretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd0f3('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d1ebcef..aac307f 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 _0x422a=['CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','catch','show','params','rawAttributes','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','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','save','update','then','destroy','get'];(function(_0x43d8c3,_0x5951eb){var _0x248aa0=function(_0x15b630){while(--_0x15b630){_0x43d8c3['push'](_0x43d8c3['shift']());}};_0x248aa0(++_0x5951eb);}(_0x422a,0x78));var _0xa422=function(_0x570f01,_0x30784e){_0x570f01=_0x570f01-0x0;var _0xeb1117=_0x422a[_0x570f01];return _0xeb1117;};'use strict';var pdf=require(_0xa422('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa422('0x1'));var zipdir=require(_0xa422('0x2'));var jsonpatch=require(_0xa422('0x3'));var rp=require('request-promise');var moment=require(_0xa422('0x4'));var BPromise=require(_0xa422('0x5'));var Mustache=require(_0xa422('0x6'));var util=require(_0xa422('0x7'));var path=require(_0xa422('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa422('0x9'));var fs=require('fs');var _=require(_0xa422('0xa'));var squel=require('squel');var crypto=require(_0xa422('0xb'));var jsforce=require(_0xa422('0xc'));var deskjs=require(_0xa422('0xd'));var toCsv=require(_0xa422('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa422('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa422('0x10'));var logger=require(_0xa422('0x11'))(_0xa422('0x12'));var utils=require(_0xa422('0x13'));var config=require(_0xa422('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c043e,_0x5c777c){_0x5c777c=_0x5c777c||0xcc;return function(_0x4f6754){if(_0x4f6754){return _0x4c043e[_0xa422('0x15')](_0x5c777c);}return _0x4c043e[_0xa422('0x16')](_0x5c777c)[_0xa422('0x17')]();};}function respondWithResult(_0x2edeef,_0x396817){_0x396817=_0x396817||0xc8;return function(_0x275677){if(_0x275677){return _0x2edeef[_0xa422('0x16')](_0x396817)['json'](_0x275677);}};}function respondWithFilteredResult(_0xf4c04d,_0x184b63){return function(_0x3a7d1b){if(_0x3a7d1b){var _0x5e838c=_0x3a7d1b['count'],_0x2f06aa=_0x184b63[_0xa422('0x18')],_0x1a404c=_0x184b63['offset']+_0x184b63[_0xa422('0x19')],_0x5e00ca;if(_0x1a404c>=_0x5e838c){_0x1a404c=_0x5e838c;_0x5e00ca=0xc8;}else{_0x5e00ca=0xce;}_0xf4c04d['status'](_0x5e00ca);return _0xf4c04d[_0xa422('0x1a')](_0xa422('0x1b'),_0x2f06aa+'-'+_0x1a404c+'/'+_0x5e838c)[_0xa422('0x1c')](_0x3a7d1b);}return null;};}function patchUpdates(_0x58976c){return function(_0x48d43d){try{jsonpatch['apply'](_0x48d43d,_0x58976c,!![]);}catch(_0x2f85aa){return BPromise['reject'](_0x2f85aa);}return _0x48d43d[_0xa422('0x1d')]();};}function saveUpdates(_0x26c028,_0x8bf9e3){return function(_0x38df30){if(_0x38df30){return _0x38df30[_0xa422('0x1e')](_0x26c028)[_0xa422('0x1f')](function(_0x222246){return _0x222246;});}return null;};}function removeEntity(_0x322c0b,_0x3cbb6a){return function(_0x5ec3d8){if(_0x5ec3d8){return _0x5ec3d8[_0xa422('0x20')]()[_0xa422('0x1f')](function(){var _0x38d5fb=_0x5ec3d8[_0xa422('0x21')]({'plain':!![]});var _0x3b4fcf=_0xa422('0x22');return db[_0xa422('0x23')][_0xa422('0x20')]({'where':{'type':_0x3b4fcf,'resourceId':_0x38d5fb['id']}})[_0xa422('0x1f')](function(){return _0x5ec3d8;});})[_0xa422('0x1f')](function(){_0x322c0b[_0xa422('0x16')](0xcc)[_0xa422('0x17')]();});}};}function handleEntityNotFound(_0xa60c3d,_0x14e528){return function(_0x48b8ca){if(!_0x48b8ca){_0xa60c3d[_0xa422('0x15')](0x194);}return _0x48b8ca;};}function handleError(_0x24ec17,_0x4f29b6){_0x4f29b6=_0x4f29b6||0x1f4;return function(_0x10d445){logger['error'](_0x10d445[_0xa422('0x24')]);if(_0x10d445[_0xa422('0x25')]){delete _0x10d445[_0xa422('0x25')];}_0x24ec17[_0xa422('0x16')](_0x4f29b6)[_0xa422('0x26')](_0x10d445);};}exports[_0xa422('0x27')]=function(_0x4e466e,_0x188f5e){var _0x50db2e={},_0x17fb54={},_0x523df9={'count':0x0,'rows':[]};var _0x36afee=_[_0xa422('0x28')](db[_0xa422('0x29')]['rawAttributes'],function(_0x3a148d){return{'name':_0x3a148d['fieldName'],'type':_0x3a148d[_0xa422('0x2a')]['key']};});_0x17fb54[_0xa422('0x2b')]=_[_0xa422('0x28')](_0x36afee,'name');_0x17fb54[_0xa422('0x2c')]=_[_0xa422('0x2d')](_0x4e466e['query']);_0x17fb54[_0xa422('0x2e')]=_[_0xa422('0x2f')](_0x17fb54[_0xa422('0x2b')],_0x17fb54[_0xa422('0x2c')]);_0x50db2e[_0xa422('0x30')]=_[_0xa422('0x2f')](_0x17fb54['model'],qs[_0xa422('0x31')](_0x4e466e[_0xa422('0x2c')]['fields']));_0x50db2e[_0xa422('0x30')]=_0x50db2e[_0xa422('0x30')][_0xa422('0x32')]?_0x50db2e['attributes']:_0x17fb54[_0xa422('0x2b')];if(!_0x4e466e[_0xa422('0x2c')]['hasOwnProperty'](_0xa422('0x33'))){_0x50db2e[_0xa422('0x19')]=qs[_0xa422('0x19')](_0x4e466e[_0xa422('0x2c')][_0xa422('0x19')]);_0x50db2e[_0xa422('0x18')]=qs['offset'](_0x4e466e['query']['offset']);}_0x50db2e[_0xa422('0x34')]=qs[_0xa422('0x35')](_0x4e466e[_0xa422('0x2c')][_0xa422('0x35')]);_0x50db2e[_0xa422('0x36')]=qs['filters'](_[_0xa422('0x37')](_0x4e466e[_0xa422('0x2c')],_0x17fb54['filters']),_0x36afee);if(_0x4e466e['query']['filter']){_0x50db2e[_0xa422('0x36')]=_[_0xa422('0x38')](_0x50db2e[_0xa422('0x36')],{'$or':_['map'](_0x36afee,function(_0x2ab716){if(_0x2ab716[_0xa422('0x2a')]!=='VIRTUAL'){var _0x9441cc={};_0x9441cc[_0x2ab716['name']]={'$like':'%'+_0x4e466e[_0xa422('0x2c')][_0xa422('0x39')]+'%'};return _0x9441cc;}})});}_0x50db2e=_[_0xa422('0x38')]({},_0x50db2e,_0x4e466e[_0xa422('0x3a')]);var _0x4f1baf={'where':_0x50db2e[_0xa422('0x36')]};return db[_0xa422('0x29')][_0xa422('0x3b')](_0x4f1baf)[_0xa422('0x1f')](function(_0x3ac4fc){_0x523df9[_0xa422('0x3b')]=_0x3ac4fc;if(_0x4e466e['query'][_0xa422('0x3c')]){_0x50db2e[_0xa422('0x3d')]=[{'all':!![]}];}return db[_0xa422('0x29')]['findAll'](_0x50db2e);})[_0xa422('0x1f')](function(_0x112518){_0x523df9['rows']=_0x112518;return _0x523df9;})[_0xa422('0x1f')](respondWithFilteredResult(_0x188f5e,_0x50db2e))[_0xa422('0x3e')](handleError(_0x188f5e,null));};exports[_0xa422('0x3f')]=function(_0x59c2cd,_0x171a42){var _0x43bccc={'raw':!![],'where':{'id':_0x59c2cd[_0xa422('0x40')]['id']}},_0x5c4022={};_0x5c4022[_0xa422('0x2b')]=_['keys'](db['CmHopperAdditionalPhone'][_0xa422('0x41')]);_0x5c4022['query']=_[_0xa422('0x2d')](_0x59c2cd[_0xa422('0x2c')]);_0x5c4022['filters']=_[_0xa422('0x2f')](_0x5c4022[_0xa422('0x2b')],_0x5c4022[_0xa422('0x2c')]);_0x43bccc[_0xa422('0x30')]=_[_0xa422('0x2f')](_0x5c4022[_0xa422('0x2b')],qs[_0xa422('0x31')](_0x59c2cd[_0xa422('0x2c')]['fields']));_0x43bccc[_0xa422('0x30')]=_0x43bccc['attributes'][_0xa422('0x32')]?_0x43bccc[_0xa422('0x30')]:_0x5c4022['model'];if(_0x59c2cd['query'][_0xa422('0x3c')]){_0x43bccc['include']=[{'all':!![]}];}_0x43bccc=_['merge']({},_0x43bccc,_0x59c2cd['options']);return db['CmHopperAdditionalPhone'][_0xa422('0x42')](_0x43bccc)['then'](handleEntityNotFound(_0x171a42,null))[_0xa422('0x1f')](respondWithResult(_0x171a42,null))[_0xa422('0x3e')](handleError(_0x171a42,null));};exports[_0xa422('0x43')]=function(_0x226366,_0xf24077){return db[_0xa422('0x29')][_0xa422('0x43')](_0x226366[_0xa422('0x44')],{})[_0xa422('0x1f')](function(_0x402fb6){var _0x4a653d=_0x226366[_0xa422('0x45')][_0xa422('0x21')]({'plain':!![]});if(!_0x4a653d)throw new Error(_0xa422('0x46'));if(_0x4a653d[_0xa422('0x47')]===_0xa422('0x45')){var _0x19b945=_0x402fb6[_0xa422('0x21')]({'plain':!![]});var _0x2ad944=_0xa422('0x22');return db[_0xa422('0x48')][_0xa422('0x42')]({'where':{'name':_0x2ad944,'userProfileId':_0x4a653d[_0xa422('0x49')]},'raw':!![]})['then'](function(_0x1b7d10){if(_0x1b7d10&&_0x1b7d10[_0xa422('0x4a')]===0x0){return db[_0xa422('0x23')]['create']({'name':_0x19b945[_0xa422('0x25')],'resourceId':_0x19b945['id'],'type':_0x1b7d10['name'],'sectionId':_0x1b7d10['id']},{})[_0xa422('0x1f')](function(){return _0x402fb6;});}else{return _0x402fb6;}})[_0xa422('0x3e')](function(_0x3c5d3a){logger[_0xa422('0x4b')](_0xa422('0x4c'),_0x3c5d3a);throw _0x3c5d3a;});}return _0x402fb6;})[_0xa422('0x1f')](respondWithResult(_0xf24077,0xc9))[_0xa422('0x3e')](handleError(_0xf24077,null));};exports[_0xa422('0x1e')]=function(_0x20b65b,_0x4c73f5){if(_0x20b65b[_0xa422('0x44')]['id']){delete _0x20b65b[_0xa422('0x44')]['id'];}return db[_0xa422('0x29')][_0xa422('0x42')]({'where':{'id':_0x20b65b[_0xa422('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c73f5,null))[_0xa422('0x1f')](saveUpdates(_0x20b65b['body'],null))[_0xa422('0x1f')](respondWithResult(_0x4c73f5,null))[_0xa422('0x3e')](handleError(_0x4c73f5,null));};exports[_0xa422('0x20')]=function(_0x2a73a3,_0x4ff222){return db[_0xa422('0x29')][_0xa422('0x42')]({'where':{'id':_0x2a73a3[_0xa422('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ff222,null))['then'](removeEntity(_0x4ff222,null))[_0xa422('0x3e')](handleError(_0x4ff222,null));}; \ No newline at end of file +var _0x9785=['moment','mustache','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise'];(function(_0x530056,_0x22980e){var _0x12645c=function(_0x42a88a){while(--_0x42a88a){_0x530056['push'](_0x530056['shift']());}};_0x12645c(++_0x22980e);}(_0x9785,0xe3));var _0x5978=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9785[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x5978('0x0'));var emlformat=require(_0x5978('0x1'));var rimraf=require(_0x5978('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5978('0x3'));var moment=require(_0x5978('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5978('0x5'));var util=require('util');var path=require(_0x5978('0x6'));var sox=require(_0x5978('0x7'));var csv=require(_0x5978('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5978('0x9'));var squel=require(_0x5978('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5978('0x8'));var querystring=require(_0x5978('0xb'));var Papa=require(_0x5978('0xc'));var Redis=require(_0x5978('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5978('0xe'));var as=require(_0x5978('0xf'));var hardwareService=require(_0x5978('0x10'));var logger=require(_0x5978('0x11'))(_0x5978('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5978('0x13'))['db'];function respondWithStatusCode(_0x5e8244,_0x3e94d3){_0x3e94d3=_0x3e94d3||0xcc;return function(_0x56c13a){if(_0x56c13a){return _0x5e8244[_0x5978('0x14')](_0x3e94d3);}return _0x5e8244[_0x5978('0x15')](_0x3e94d3)[_0x5978('0x16')]();};}function respondWithResult(_0x489402,_0x5015a6){_0x5015a6=_0x5015a6||0xc8;return function(_0x54fc5e){if(_0x54fc5e){return _0x489402[_0x5978('0x15')](_0x5015a6)[_0x5978('0x17')](_0x54fc5e);}};}function respondWithFilteredResult(_0x3d2508,_0x205058){return function(_0x3e9862){if(_0x3e9862){var _0x38eb2d=_0x3e9862[_0x5978('0x18')],_0x567b9e=_0x205058[_0x5978('0x19')],_0x37adee=_0x205058['offset']+_0x205058[_0x5978('0x1a')],_0x432701;if(_0x37adee>=_0x38eb2d){_0x37adee=_0x38eb2d;_0x432701=0xc8;}else{_0x432701=0xce;}_0x3d2508[_0x5978('0x15')](_0x432701);return _0x3d2508[_0x5978('0x1b')]('Content-Range',_0x567b9e+'-'+_0x37adee+'/'+_0x38eb2d)[_0x5978('0x17')](_0x3e9862);}return null;};}function patchUpdates(_0xd5c817){return function(_0x1ed087){try{jsonpatch['apply'](_0x1ed087,_0xd5c817,!![]);}catch(_0x249852){return BPromise[_0x5978('0x1c')](_0x249852);}return _0x1ed087[_0x5978('0x1d')]();};}function saveUpdates(_0x124fde,_0x29dd2d){return function(_0x2f3027){if(_0x2f3027){return _0x2f3027[_0x5978('0x1e')](_0x124fde)['then'](function(_0xd872b6){return _0xd872b6;});}return null;};}function removeEntity(_0x3183a1,_0x51a888){return function(_0x290702){if(_0x290702){return _0x290702[_0x5978('0x1f')]()[_0x5978('0x20')](function(){var _0x52ffca=_0x290702[_0x5978('0x21')]({'plain':!![]});var _0x1e6fff=_0x5978('0x22');return db[_0x5978('0x23')][_0x5978('0x1f')]({'where':{'type':_0x1e6fff,'resourceId':_0x52ffca['id']}})[_0x5978('0x20')](function(){return _0x290702;});})[_0x5978('0x20')](function(){_0x3183a1[_0x5978('0x15')](0xcc)[_0x5978('0x16')]();});}};}function handleEntityNotFound(_0x14db28,_0x3ca4ea){return function(_0x5a20d0){if(!_0x5a20d0){_0x14db28['sendStatus'](0x194);}return _0x5a20d0;};}function handleError(_0x343b7e,_0x734cef){_0x734cef=_0x734cef||0x1f4;return function(_0x4e0fd4){logger[_0x5978('0x24')](_0x4e0fd4['stack']);if(_0x4e0fd4['name']){delete _0x4e0fd4[_0x5978('0x25')];}_0x343b7e[_0x5978('0x15')](_0x734cef)[_0x5978('0x26')](_0x4e0fd4);};}exports[_0x5978('0x27')]=function(_0x2f04a7,_0x461b2f){var _0x18e143={},_0x4c0c02={},_0x1ab651={'count':0x0,'rows':[]};var _0xc4aa8c=_['map'](db[_0x5978('0x28')][_0x5978('0x29')],function(_0x251814){return{'name':_0x251814[_0x5978('0x2a')],'type':_0x251814[_0x5978('0x2b')][_0x5978('0x2c')]};});_0x4c0c02[_0x5978('0x2d')]=_[_0x5978('0x2e')](_0xc4aa8c,'name');_0x4c0c02['query']=_[_0x5978('0x2f')](_0x2f04a7['query']);_0x4c0c02[_0x5978('0x30')]=_[_0x5978('0x31')](_0x4c0c02[_0x5978('0x2d')],_0x4c0c02[_0x5978('0x32')]);_0x18e143['attributes']=_['intersection'](_0x4c0c02[_0x5978('0x2d')],qs[_0x5978('0x33')](_0x2f04a7[_0x5978('0x32')]['fields']));_0x18e143[_0x5978('0x34')]=_0x18e143[_0x5978('0x34')]['length']?_0x18e143[_0x5978('0x34')]:_0x4c0c02['model'];if(!_0x2f04a7[_0x5978('0x32')][_0x5978('0x35')](_0x5978('0x36'))){_0x18e143['limit']=qs[_0x5978('0x1a')](_0x2f04a7['query'][_0x5978('0x1a')]);_0x18e143['offset']=qs[_0x5978('0x19')](_0x2f04a7[_0x5978('0x32')]['offset']);}_0x18e143[_0x5978('0x37')]=qs['sort'](_0x2f04a7['query'][_0x5978('0x38')]);_0x18e143[_0x5978('0x39')]=qs[_0x5978('0x30')](_[_0x5978('0x3a')](_0x2f04a7[_0x5978('0x32')],_0x4c0c02[_0x5978('0x30')]),_0xc4aa8c);if(_0x2f04a7[_0x5978('0x32')][_0x5978('0x3b')]){_0x18e143['where']=_[_0x5978('0x3c')](_0x18e143[_0x5978('0x39')],{'$or':_[_0x5978('0x2e')](_0xc4aa8c,function(_0x29ada6){if(_0x29ada6[_0x5978('0x2b')]!==_0x5978('0x3d')){var _0x335873={};_0x335873[_0x29ada6[_0x5978('0x25')]]={'$like':'%'+_0x2f04a7[_0x5978('0x32')][_0x5978('0x3b')]+'%'};return _0x335873;}})});}_0x18e143=_[_0x5978('0x3c')]({},_0x18e143,_0x2f04a7[_0x5978('0x3e')]);var _0x5f4580={'where':_0x18e143[_0x5978('0x39')]};return db[_0x5978('0x28')][_0x5978('0x18')](_0x5f4580)[_0x5978('0x20')](function(_0x5296a7){_0x1ab651['count']=_0x5296a7;if(_0x2f04a7[_0x5978('0x32')][_0x5978('0x3f')]){_0x18e143[_0x5978('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x18e143);})[_0x5978('0x20')](function(_0x7ceba1){_0x1ab651[_0x5978('0x41')]=_0x7ceba1;return _0x1ab651;})[_0x5978('0x20')](respondWithFilteredResult(_0x461b2f,_0x18e143))[_0x5978('0x42')](handleError(_0x461b2f,null));};exports[_0x5978('0x43')]=function(_0x3bfd90,_0x1f982f){var _0x43f7d7={'raw':!![],'where':{'id':_0x3bfd90[_0x5978('0x44')]['id']}},_0x33e868={};_0x33e868['model']=_['keys'](db[_0x5978('0x28')][_0x5978('0x29')]);_0x33e868[_0x5978('0x32')]=_[_0x5978('0x2f')](_0x3bfd90[_0x5978('0x32')]);_0x33e868[_0x5978('0x30')]=_[_0x5978('0x31')](_0x33e868['model'],_0x33e868['query']);_0x43f7d7[_0x5978('0x34')]=_[_0x5978('0x31')](_0x33e868[_0x5978('0x2d')],qs['fields'](_0x3bfd90[_0x5978('0x32')]['fields']));_0x43f7d7[_0x5978('0x34')]=_0x43f7d7[_0x5978('0x34')]['length']?_0x43f7d7['attributes']:_0x33e868[_0x5978('0x2d')];if(_0x3bfd90['query'][_0x5978('0x3f')]){_0x43f7d7[_0x5978('0x40')]=[{'all':!![]}];}_0x43f7d7=_['merge']({},_0x43f7d7,_0x3bfd90[_0x5978('0x3e')]);return db[_0x5978('0x28')][_0x5978('0x45')](_0x43f7d7)[_0x5978('0x20')](handleEntityNotFound(_0x1f982f,null))[_0x5978('0x20')](respondWithResult(_0x1f982f,null))[_0x5978('0x42')](handleError(_0x1f982f,null));};exports[_0x5978('0x46')]=function(_0x59a444,_0x32aceb){return db['CmHopperAdditionalPhone'][_0x5978('0x46')](_0x59a444[_0x5978('0x47')],{})[_0x5978('0x20')](function(_0xf0065){var _0x2e56ec=_0x59a444[_0x5978('0x48')][_0x5978('0x21')]({'plain':!![]});if(!_0x2e56ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e56ec[_0x5978('0x49')]==='user'){var _0x1215a0=_0xf0065[_0x5978('0x21')]({'plain':!![]});var _0x39183b=_0x5978('0x22');return db['UserProfileSection'][_0x5978('0x45')]({'where':{'name':_0x39183b,'userProfileId':_0x2e56ec[_0x5978('0x4a')]},'raw':!![]})[_0x5978('0x20')](function(_0x107024){if(_0x107024&&_0x107024[_0x5978('0x4b')]===0x0){return db['UserProfileResource'][_0x5978('0x46')]({'name':_0x1215a0[_0x5978('0x25')],'resourceId':_0x1215a0['id'],'type':_0x107024[_0x5978('0x25')],'sectionId':_0x107024['id']},{})[_0x5978('0x20')](function(){return _0xf0065;});}else{return _0xf0065;}})['catch'](function(_0x382aad){logger['error'](_0x5978('0x4c'),_0x382aad);throw _0x382aad;});}return _0xf0065;})['then'](respondWithResult(_0x32aceb,0xc9))['catch'](handleError(_0x32aceb,null));};exports[_0x5978('0x1e')]=function(_0x5dbb07,_0x1f6a11){if(_0x5dbb07[_0x5978('0x47')]['id']){delete _0x5dbb07[_0x5978('0x47')]['id'];}return db[_0x5978('0x28')][_0x5978('0x45')]({'where':{'id':_0x5dbb07[_0x5978('0x44')]['id']}})[_0x5978('0x20')](handleEntityNotFound(_0x1f6a11,null))['then'](saveUpdates(_0x5dbb07[_0x5978('0x47')],null))[_0x5978('0x20')](respondWithResult(_0x1f6a11,null))[_0x5978('0x42')](handleError(_0x1f6a11,null));};exports[_0x5978('0x1f')]=function(_0x24e4da,_0x184934){return db[_0x5978('0x28')]['find']({'where':{'id':_0x24e4da['params']['id']}})[_0x5978('0x20')](handleEntityNotFound(_0x184934,null))['then'](removeEntity(_0x184934,null))[_0x5978('0x42')](handleError(_0x184934,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 065ae8d..7429d48 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 _0xc472=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4c81f9,_0x2abb01){var _0x5622e1=function(_0x49cd7c){while(--_0x49cd7c){_0x4c81f9['push'](_0x4c81f9['shift']());}};_0x5622e1(++_0x2abb01);}(_0xc472,0x1a9));var _0x2c47=function(_0x3e3f27,_0x2c2ecf){_0x3e3f27=_0x3e3f27-0x0;var _0x15c868=_0xc472[_0x3e3f27];return _0x15c868;};'use strict';var _=require(_0x2c47('0x0'));var util=require(_0x2c47('0x1'));var logger=require(_0x2c47('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2c47('0x3'));var rp=require(_0x2c47('0x4'));var fs=require('fs');var path=require(_0x2c47('0x5'));var rimraf=require(_0x2c47('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c47('0x7'));module[_0x2c47('0x8')]=function(_0x1fa968,_0x5bea5b){return _0x1fa968[_0x2c47('0x9')](_0x2c47('0xa'),attributes,{'tableName':_0x2c47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x210f=['moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','util','../../config/logger','api'];(function(_0x22ef19,_0x4d5f4c){var _0x11c09e=function(_0x4cc30a){while(--_0x4cc30a){_0x22ef19['push'](_0x22ef19['shift']());}};_0x11c09e(++_0x4d5f4c);}(_0x210f,0x1c9));var _0xf210=function(_0xd275f8,_0x542c91){_0xd275f8=_0xd275f8-0x0;var _0x280b70=_0x210f[_0xd275f8];return _0x280b70;};'use strict';var _=require('lodash');var util=require(_0xf210('0x0'));var logger=require(_0xf210('0x1'))(_0xf210('0x2'));var moment=require(_0xf210('0x3'));var BPromise=require('bluebird');var rp=require(_0xf210('0x4'));var fs=require('fs');var path=require(_0xf210('0x5'));var rimraf=require(_0xf210('0x6'));var config=require(_0xf210('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xf210('0x8')]=function(_0x4924d8,_0x491265){return _0x4924d8['define'](_0xf210('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 8c83473..71b67ca 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 _0x0303=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countdropretry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','createdAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','bluebird','randomstring','ioredis'];(function(_0x4bd9da,_0x3d6e93){var _0x3f7605=function(_0x10cee8){while(--_0x10cee8){_0x4bd9da['push'](_0x4bd9da['shift']());}};_0x3f7605(++_0x3d6e93);}(_0x0303,0x159));var _0x3030=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x0303[_0x55821d];return _0x58ea8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3030('0x0'));var rs=require(_0x3030('0x1'));var fs=require('fs');var Redis=require(_0x3030('0x2'));var db=require(_0x3030('0x3'))['db'];var utils=require(_0x3030('0x4'));var logger=require('../../config/logger')(_0x3030('0x5'));var config=require(_0x3030('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aaa69,_0x4b8e2f,_0x4e3a16){return new BPromise(function(_0x2805f7,_0x178a19){return client[_0x3030('0x7')](_0x5aaa69,_0x4e3a16)[_0x3030('0x8')](function(_0x2cf3e7){logger['info'](_0x3030('0x9'),_0x4b8e2f,_0x3030('0xa'));logger[_0x3030('0xb')](_0x3030('0xc'),_0x4b8e2f,'request\x20sent',JSON[_0x3030('0xd')](_0x2cf3e7));if(_0x2cf3e7[_0x3030('0xe')]){if(_0x2cf3e7['error'][_0x3030('0xf')]===0x1f4){logger[_0x3030('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b8e2f,_0x2cf3e7['error'][_0x3030('0x10')]);return _0x178a19(_0x2cf3e7[_0x3030('0xe')][_0x3030('0x10')]);}logger[_0x3030('0xe')](_0x3030('0x9'),_0x4b8e2f,_0x2cf3e7['error'][_0x3030('0x10')]);return _0x2805f7(_0x2cf3e7[_0x3030('0xe')][_0x3030('0x10')]);}else{logger[_0x3030('0x11')](_0x3030('0x9'),_0x4b8e2f,_0x3030('0xa'));_0x2805f7(_0x2cf3e7[_0x3030('0x12')][_0x3030('0x10')]);}})[_0x3030('0x13')](function(_0x1f0861){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4b8e2f,_0x1f0861);_0x178a19(_0x1f0861);});});}exports[_0x3030('0x14')]=function(_0xddeadd){var _0x393bfa=this;return new Promise(function(_0x328a33,_0x3afcd8){return db['CmHopper'][_0x3030('0x15')]({'raw':!![],'where':{'ContactId':_0xddeadd[_0x3030('0x16')][_0x3030('0x17')],'ListId':_0xddeadd[_0x3030('0x16')][_0x3030('0x18')],'VoiceQueueId':_0xddeadd[_0x3030('0x16')][_0x3030('0x19')]===undefined?null:_0xddeadd[_0x3030('0x16')][_0x3030('0x19')],'CampaignId':_0xddeadd[_0x3030('0x16')]['CampaignId']===undefined?null:_0xddeadd['body'][_0x3030('0x1a')]}})[_0x3030('0x8')](function(_0x3868c7){if(_0x3868c7!=null){return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x3868c7['id'],'OrderBy':{'$gt':_0x3868c7['OrderBy']}},'order':[[_0x3030('0x1c'),'ASC']]})[_0x3030('0x8')](function(_0x5d6124){var _0x1e10c4=0x0;if(_0x5d6124){if(_0x5d6124[_0x3030('0x1d')]+_0x5d6124[_0x3030('0x1e')]+_0x5d6124[_0x3030('0x1f')]+_0x5d6124[_0x3030('0x20')]+_0x5d6124['countdropretry']+_0x5d6124[_0x3030('0x21')]+_0x5d6124[_0x3030('0x22')]+_0x5d6124[_0x3030('0x23')]<_0xddeadd[_0x3030('0x24')][_0x3030('0x25')])_0x1e10c4=0x1;_0x328a33({'additional':_0x1e10c4});}else{return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x3868c7['id']},'order':[[_0x3030('0x1c'),_0x3030('0x26')]]})[_0x3030('0x8')](function(_0x5af1e9){var _0x5d7d14=0x0;if(_0x5af1e9){if(_0x5af1e9[_0x3030('0x1d')]+_0x5af1e9[_0x3030('0x1e')]+_0x5af1e9[_0x3030('0x1f')]+_0x5af1e9[_0x3030('0x20')]+_0x5af1e9[_0x3030('0x27')]+_0x5af1e9[_0x3030('0x21')]+_0x5af1e9['countmachineretry']+_0x5af1e9['countagentrejectretry']<_0xddeadd['entity'][_0x3030('0x25')])_0x5d7d14=0x1;_0x328a33({'additional':_0x5d7d14});}else{_0x328a33({'additional':0x0});}})['catch'](function(_0xdeb0b1){logger['error'](_0x3030('0x14'),_0xdeb0b1['message'],_0xddeadd);_0x3afcd8(_0x393bfa['error'](0x1f4,_0xdeb0b1[_0x3030('0x10')]));});}})['catch'](function(_0x104542){logger[_0x3030('0xe')]('VerifyAdditionalPhones',_0x104542[_0x3030('0x10')],_0xddeadd);_0x3afcd8(_0x393bfa['error'](0x1f4,_0x104542[_0x3030('0x10')]));});}else _0x328a33({'additional':0x0});});});};exports[_0x3030('0x28')]=function(_0x32e1e6){var _0x55311e=this;return new Promise(function(_0x5c9d79,_0x5c7581){return db[_0x3030('0x29')][_0x3030('0x15')]({'raw':!![],'where':{'ContactId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x17')],'ListId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x18')],'VoiceQueueId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x19')]===undefined?null:_0x32e1e6[_0x3030('0x16')][_0x3030('0x19')],'CampaignId':_0x32e1e6[_0x3030('0x16')][_0x3030('0x1a')]===undefined?null:_0x32e1e6['body'][_0x3030('0x1a')]}})[_0x3030('0x8')](function(_0x2e2d8b){if(_0x2e2d8b!=null){return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2e2d8b['id'],'OrderBy':{'$gt':_0x2e2d8b[_0x3030('0x1c')]}},'order':[[_0x3030('0x1c'),'ASC']]})[_0x3030('0x8')](function(_0x33f37a){if(_0x33f37a)return activateAdditionalPhone(_0x2e2d8b,_0x32e1e6[_0x3030('0x16')],_0x33f37a,_0x32e1e6[_0x3030('0x2a')],_0x32e1e6[_0x3030('0x2b')])[_0x3030('0x8')](function(_0x4e4221){_0x5c9d79(_0x4e4221);});else{return db[_0x3030('0x1b')][_0x3030('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2e2d8b['id']},'order':[['OrderBy',_0x3030('0x26')]]})[_0x3030('0x8')](function(_0x2fd269){if(_0x2fd269)return activateAdditionalPhone(_0x2e2d8b,_0x32e1e6['body'],_0x2fd269,_0x32e1e6[_0x3030('0x2a')],_0x32e1e6['waitTime'])[_0x3030('0x8')](function(_0x205abc){_0x5c9d79(_0x205abc);});else{_0x5c9d79({'id':_0x2e2d8b['id'],'phone':''});}})[_0x3030('0x13')](function(_0x1da2ab){logger[_0x3030('0xe')](_0x3030('0x14'),_0x1da2ab[_0x3030('0x10')],_0x32e1e6);_0x5c7581(_0x55311e['error'](0x1f4,_0x1da2ab[_0x3030('0x10')]));});}})[_0x3030('0x13')](function(_0x931184){logger[_0x3030('0xe')](_0x3030('0x14'),_0x931184[_0x3030('0x10')],_0x32e1e6);_0x5c7581(_0x55311e[_0x3030('0xe')](0x1f4,_0x931184[_0x3030('0x10')]));});}else _0x5c9d79(0x1);});});};function activateAdditionalPhone(_0x33ee5a,_0x57a7d9,_0x4084d0,_0x2a3ceb,_0x17a90a){return new Promise(function(_0x330f65,_0x269a34){logger[_0x3030('0x11')](_0x3030('0x14'),_0x4084d0);var _0x1a000b;if(moment()>moment(_0x4084d0[_0x3030('0x2c')])){_0x1a000b=moment()[_0x3030('0x2d')](_0x17a90a||0x3,'minutes');}else{if(_0x4084d0[_0x3030('0x1c')]==0x0){_0x1a000b=moment(_0x4084d0['scheduledat']);}else{_0x1a000b=moment()['add'](_0x17a90a||0x3,_0x3030('0x2e'));}}var _0x363fc1={'phone':_0x33ee5a[_0x3030('0x2f')],'active':0x0,'OrderBy':_[_0x3030('0x30')](_0x33ee5a[_0x3030('0x1c')])?0x0:_0x33ee5a['OrderBy'],'scheduledat':moment()[_0x3030('0x2d')](_0x2a3ceb||0x1,_0x3030('0x2e')),'countbusyretry':_0x57a7d9[_0x3030('0x1d')],'countcongestionretry':_0x57a7d9[_0x3030('0x1e')],'countnoanswerretry':_0x57a7d9[_0x3030('0x1f')],'countnosuchnumberretry':_0x57a7d9['countnosuchnumberretry'],'countdropretry':_0x57a7d9[_0x3030('0x27')],'countabandonedretry':_0x57a7d9[_0x3030('0x21')],'countmachineretry':_0x57a7d9[_0x3030('0x22')],'countagentrejectretry':_0x57a7d9[_0x3030('0x23')],'createdAt':_0x57a7d9['createdAt'],'updatedAt':_0x57a7d9[_0x3030('0x31')]};var _0x25fc9a={'CmHopperId':_0x33ee5a['id'],'phone':_0x4084d0[_0x3030('0x2f')],'active':0x0,'OrderBy':_[_0x3030('0x30')](_0x4084d0['OrderBy'])?0x0:_0x4084d0[_0x3030('0x1c')],'scheduledat':_0x1a000b,'countbusyretry':_0x4084d0[_0x3030('0x1d')],'countcongestionretry':_0x4084d0['countcongestionretry'],'countnoanswerretry':_0x4084d0[_0x3030('0x1f')],'countnosuchnumberretry':_0x57a7d9[_0x3030('0x20')],'countdropretry':_0x57a7d9[_0x3030('0x27')],'countabandonedretry':_0x57a7d9[_0x3030('0x21')],'countmachineretry':_0x57a7d9[_0x3030('0x22')],'countagentrejectretry':_0x57a7d9[_0x3030('0x23')],'createdAt':_0x4084d0[_0x3030('0x32')],'updatedAt':_0x4084d0[_0x3030('0x31')]};logger['info'](_0x3030('0x33'),_0x363fc1);logger[_0x3030('0x11')](_0x3030('0x34'),_0x25fc9a);return db[_0x3030('0x35')][_0x3030('0x36')](function(_0x3a15ab){return db[_0x3030('0x1b')][_0x3030('0x37')](_0x363fc1,{'where':{'id':_0x4084d0['id']}},{'transaction':_0x3a15ab})[_0x3030('0x8')](function(){return db['CmHopper']['update'](_0x25fc9a,{'where':{'id':_0x33ee5a['id']}},{'transaction':_0x3a15ab});});})['then'](function(_0x240719){_0x330f65({'id':_0x33ee5a['id'],'phone':_0x4084d0[_0x3030('0x2f')]});})[_0x3030('0x13')](function(_0x1a5aab){logger[_0x3030('0xe')]('VerifyAdditionalPhones',_0x1a5aab[_0x3030('0x10')],req);_0x269a34(_this[_0x3030('0xe')](0x1f4,_0x1a5aab[_0x3030('0x10')]));});});}exports[_0x3030('0x38')]=function(_0x21be7a){var _0xef2fde=this;return new Promise(function(_0x1789ab,_0x302c01){return db['CmHopper'][_0x3030('0x37')](_0x21be7a[_0x3030('0x16')][_0x3030('0x39')],{'where':{'id':_0x21be7a[_0x3030('0x16')]['id']}})[_0x3030('0x8')](function(_0x4d9aef){_0x1789ab(_0x4d9aef);})[_0x3030('0x13')](function(_0x293a3b){logger[_0x3030('0xe')](_0x3030('0x38'),_0x293a3b[_0x3030('0x10')],_0x21be7a);_0x302c01(_0xef2fde[_0x3030('0xe')](0x1f4,_0x293a3b[_0x3030('0x10')]));});});}; \ No newline at end of file +var _0xc32b=['countmachineretry','countagentrejectretry','entity','countabandonedretry','dialGlobalMaxRetry','VerifyAdditionalPhones','CmHopper','duration','waitTime','info','scheduledat','add','minutes','phone','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','transaction','update','IncrementPreviewCounters','field','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x554a48,_0x3b0b29){var _0x4cd1dc=function(_0x420dff){while(--_0x420dff){_0x554a48['push'](_0x554a48['shift']());}};_0x4cd1dc(++_0x3b0b29);}(_0xc32b,0x87));var _0xbc32=function(_0x56bf85,_0x142e1b){_0x56bf85=_0x56bf85-0x0;var _0xaf04aa=_0xc32b[_0x56bf85];return _0xaf04aa;};'use strict';var _=require('lodash');var util=require(_0xbc32('0x0'));var moment=require(_0xbc32('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc32('0x2'));var fs=require('fs');var Redis=require(_0xbc32('0x3'));var db=require(_0xbc32('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc32('0x5'))(_0xbc32('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc32('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28d205,_0x53ade5,_0x4be09a){return new BPromise(function(_0x7c2bb7,_0x1498f4){return client[_0xbc32('0x8')](_0x28d205,_0x4be09a)['then'](function(_0xbaaa98){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53ade5,_0xbc32('0x9'));logger[_0xbc32('0xa')](_0xbc32('0xb'),_0x53ade5,'request\x20sent',JSON['stringify'](_0xbaaa98));if(_0xbaaa98[_0xbc32('0xc')]){if(_0xbaaa98[_0xbc32('0xc')][_0xbc32('0xd')]===0x1f4){logger[_0xbc32('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53ade5,_0xbaaa98[_0xbc32('0xc')]['message']);return _0x1498f4(_0xbaaa98[_0xbc32('0xc')][_0xbc32('0xe')]);}logger[_0xbc32('0xc')](_0xbc32('0xf'),_0x53ade5,_0xbaaa98[_0xbc32('0xc')]['message']);return _0x7c2bb7(_0xbaaa98[_0xbc32('0xc')][_0xbc32('0xe')]);}else{logger['info'](_0xbc32('0xf'),_0x53ade5,_0xbc32('0x9'));_0x7c2bb7(_0xbaaa98[_0xbc32('0x10')][_0xbc32('0xe')]);}})[_0xbc32('0x11')](function(_0x11d27f){logger[_0xbc32('0xc')](_0xbc32('0xf'),_0x53ade5,_0x11d27f);_0x1498f4(_0x11d27f);});});}exports['VerifyAdditionalPhones']=function(_0x3f9c24){var _0x3adabd=this;return new Promise(function(_0x100efc,_0x51607f){return db['CmHopper'][_0xbc32('0x12')]({'raw':!![],'where':{'ContactId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x14')],'ListId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x15')],'VoiceQueueId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x16')]===undefined?null:_0x3f9c24['body']['VoiceQueueId'],'CampaignId':_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x17')]===undefined?null:_0x3f9c24[_0xbc32('0x13')][_0xbc32('0x17')]}})[_0xbc32('0x18')](function(_0x37e6f5){if(_0x37e6f5!=null){return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x37e6f5['id'],'OrderBy':{'$gt':_0x37e6f5['OrderBy']}},'order':[[_0xbc32('0x1a'),_0xbc32('0x1b')]]})[_0xbc32('0x18')](function(_0xef3245){var _0x15b9be=0x0;if(_0xef3245){if(_0xef3245[_0xbc32('0x1c')]+_0xef3245[_0xbc32('0x1d')]+_0xef3245[_0xbc32('0x1e')]+_0xef3245[_0xbc32('0x1f')]+_0xef3245[_0xbc32('0x20')]+_0xef3245['countabandonedretry']+_0xef3245[_0xbc32('0x21')]+_0xef3245[_0xbc32('0x22')]<_0x3f9c24[_0xbc32('0x23')]['dialGlobalMaxRetry'])_0x15b9be=0x1;_0x100efc({'additional':_0x15b9be});}else{return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x37e6f5['id']},'order':[[_0xbc32('0x1a'),'ASC']]})[_0xbc32('0x18')](function(_0x3662f4){var _0x3e735f=0x0;if(_0x3662f4){if(_0x3662f4[_0xbc32('0x1c')]+_0x3662f4[_0xbc32('0x1d')]+_0x3662f4[_0xbc32('0x1e')]+_0x3662f4[_0xbc32('0x1f')]+_0x3662f4[_0xbc32('0x20')]+_0x3662f4[_0xbc32('0x24')]+_0x3662f4['countmachineretry']+_0x3662f4[_0xbc32('0x22')]<_0x3f9c24[_0xbc32('0x23')][_0xbc32('0x25')])_0x3e735f=0x1;_0x100efc({'additional':_0x3e735f});}else{_0x100efc({'additional':0x0});}})[_0xbc32('0x11')](function(_0x15b7f9){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x15b7f9[_0xbc32('0xe')],_0x3f9c24);_0x51607f(_0x3adabd[_0xbc32('0xc')](0x1f4,_0x15b7f9['message']));});}})[_0xbc32('0x11')](function(_0x1cffed){logger['error'](_0xbc32('0x26'),_0x1cffed[_0xbc32('0xe')],_0x3f9c24);_0x51607f(_0x3adabd[_0xbc32('0xc')](0x1f4,_0x1cffed[_0xbc32('0xe')]));});}else _0x100efc({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5a79f6){var _0x31f989=this;return new Promise(function(_0x38a829,_0x1a4f03){return db[_0xbc32('0x27')][_0xbc32('0x12')]({'raw':!![],'where':{'ContactId':_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x14')],'ListId':_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x15')],'VoiceQueueId':_0x5a79f6['body']['VoiceQueueId']===undefined?null:_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x16')],'CampaignId':_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x17')]===undefined?null:_0x5a79f6[_0xbc32('0x13')][_0xbc32('0x17')]}})[_0xbc32('0x18')](function(_0x1b0547){if(_0x1b0547!=null){return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x1b0547['id'],'OrderBy':{'$gt':_0x1b0547['OrderBy']}},'order':[[_0xbc32('0x1a'),'ASC']]})['then'](function(_0x70f07b){if(_0x70f07b)return activateAdditionalPhone(_0x1b0547,_0x5a79f6[_0xbc32('0x13')],_0x70f07b,_0x5a79f6[_0xbc32('0x28')],_0x5a79f6[_0xbc32('0x29')])[_0xbc32('0x18')](function(_0x23c617){_0x38a829(_0x23c617);});else{return db[_0xbc32('0x19')][_0xbc32('0x12')]({'raw':!![],'where':{'CmHopperId':_0x1b0547['id']},'order':[[_0xbc32('0x1a'),_0xbc32('0x1b')]]})[_0xbc32('0x18')](function(_0x5c61e0){if(_0x5c61e0)return activateAdditionalPhone(_0x1b0547,_0x5a79f6['body'],_0x5c61e0,_0x5a79f6[_0xbc32('0x28')],_0x5a79f6[_0xbc32('0x29')])[_0xbc32('0x18')](function(_0x1cfedb){_0x38a829(_0x1cfedb);});else{_0x38a829({'id':_0x1b0547['id'],'phone':''});}})[_0xbc32('0x11')](function(_0x42f620){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x42f620['message'],_0x5a79f6);_0x1a4f03(_0x31f989[_0xbc32('0xc')](0x1f4,_0x42f620[_0xbc32('0xe')]));});}})[_0xbc32('0x11')](function(_0x4e170a){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x4e170a['message'],_0x5a79f6);_0x1a4f03(_0x31f989['error'](0x1f4,_0x4e170a['message']));});}else _0x38a829(0x1);});});};function activateAdditionalPhone(_0x359e8b,_0x393705,_0x357796,_0x31a385,_0x4be729){return new Promise(function(_0x308db2,_0x24c437){logger[_0xbc32('0x2a')]('VerifyAdditionalPhones',_0x357796);var _0x5e1175;if(moment()>moment(_0x357796[_0xbc32('0x2b')])){_0x5e1175=moment()[_0xbc32('0x2c')](_0x4be729||0x3,_0xbc32('0x2d'));}else{if(_0x357796[_0xbc32('0x1a')]==0x0){_0x5e1175=moment(_0x357796[_0xbc32('0x2b')]);}else{_0x5e1175=moment()[_0xbc32('0x2c')](_0x4be729||0x3,_0xbc32('0x2d'));}}var _0x2b55b7={'phone':_0x359e8b[_0xbc32('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x359e8b[_0xbc32('0x1a')])?0x0:_0x359e8b['OrderBy'],'scheduledat':moment()['add'](_0x31a385||0x1,_0xbc32('0x2d')),'countbusyretry':_0x393705[_0xbc32('0x1c')],'countcongestionretry':_0x393705['countcongestionretry'],'countnoanswerretry':_0x393705[_0xbc32('0x1e')],'countnosuchnumberretry':_0x393705[_0xbc32('0x1f')],'countdropretry':_0x393705['countdropretry'],'countabandonedretry':_0x393705[_0xbc32('0x24')],'countmachineretry':_0x393705[_0xbc32('0x21')],'countagentrejectretry':_0x393705['countagentrejectretry'],'createdAt':_0x393705[_0xbc32('0x2f')],'updatedAt':_0x393705[_0xbc32('0x30')]};var _0x184d78={'CmHopperId':_0x359e8b['id'],'phone':_0x357796['phone'],'active':0x0,'OrderBy':_[_0xbc32('0x31')](_0x357796[_0xbc32('0x1a')])?0x0:_0x357796[_0xbc32('0x1a')],'scheduledat':_0x5e1175,'countbusyretry':_0x357796[_0xbc32('0x1c')],'countcongestionretry':_0x357796[_0xbc32('0x1d')],'countnoanswerretry':_0x357796[_0xbc32('0x1e')],'countnosuchnumberretry':_0x393705['countnosuchnumberretry'],'countdropretry':_0x393705[_0xbc32('0x20')],'countabandonedretry':_0x393705[_0xbc32('0x24')],'countmachineretry':_0x393705['countmachineretry'],'countagentrejectretry':_0x393705['countagentrejectretry'],'createdAt':_0x357796[_0xbc32('0x2f')],'updatedAt':_0x357796[_0xbc32('0x30')]};logger['info'](_0xbc32('0x32'),_0x2b55b7);logger[_0xbc32('0x2a')](_0xbc32('0x33'),_0x184d78);return db['sequelize'][_0xbc32('0x34')](function(_0x35f83f){return db[_0xbc32('0x19')]['update'](_0x2b55b7,{'where':{'id':_0x357796['id']}},{'transaction':_0x35f83f})['then'](function(){return db[_0xbc32('0x27')][_0xbc32('0x35')](_0x184d78,{'where':{'id':_0x359e8b['id']}},{'transaction':_0x35f83f});});})[_0xbc32('0x18')](function(_0x1417fa){_0x308db2({'id':_0x359e8b['id'],'phone':_0x357796[_0xbc32('0x2e')]});})['catch'](function(_0x51986f){logger[_0xbc32('0xc')](_0xbc32('0x26'),_0x51986f[_0xbc32('0xe')],req);_0x24c437(_this['error'](0x1f4,_0x51986f[_0xbc32('0xe')]));});});}exports[_0xbc32('0x36')]=function(_0xd4df7c){var _0x4bccb5=this;return new Promise(function(_0x4734e0,_0x394443){return db[_0xbc32('0x27')][_0xbc32('0x35')](_0xd4df7c['body'][_0xbc32('0x37')],{'where':{'id':_0xd4df7c[_0xbc32('0x13')]['id']}})['then'](function(_0x515573){_0x4734e0(_0x515573);})[_0xbc32('0x11')](function(_0x5df7cb){logger[_0xbc32('0xc')]('IncrementPreviewCounters',_0x5df7cb[_0xbc32('0xe')],_0xd4df7c);_0x394443(_0x4bccb5[_0xbc32('0xc')](0x1f4,_0x5df7cb[_0xbc32('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 0413254..c7f63a3 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 _0x2480=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','./cmHopperAdditionalPhone.controller','get'];(function(_0x4737b9,_0x5a83c5){var _0xe396e0=function(_0x54fe52){while(--_0x54fe52){_0x4737b9['push'](_0x4737b9['shift']());}};_0xe396e0(++_0x5a83c5);}(_0x2480,0x1c9));var _0x0248=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2480[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x0248('0x0'));var path=require(_0x0248('0x1'));var timeout=require(_0x0248('0x2'));var express=require(_0x0248('0x3'));var router=express[_0x0248('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0248('0x5'));router[_0x0248('0x6')]('/',auth[_0x0248('0x7')](),controller['index']);router[_0x0248('0x6')](_0x0248('0x8'),auth['isAuthenticated'](),controller[_0x0248('0x9')]);router[_0x0248('0xa')]('/',auth[_0x0248('0x7')](),controller[_0x0248('0xb')]);router[_0x0248('0xc')](_0x0248('0x8'),auth[_0x0248('0x7')](),controller[_0x0248('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0248('0xe')]);module[_0x0248('0xf')]=router; \ No newline at end of file +var _0x3be2=['Router','../../components/auth/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x24388a,_0x232d93){var _0x22f686=function(_0x5f5473){while(--_0x5f5473){_0x24388a['push'](_0x24388a['shift']());}};_0x22f686(++_0x232d93);}(_0x3be2,0x18d));var _0x23be=function(_0x5eecc3,_0x353e41){_0x5eecc3=_0x5eecc3-0x0;var _0x157680=_0x3be2[_0x5eecc3];return _0x157680;};'use strict';var multer=require(_0x23be('0x0'));var util=require('util');var path=require(_0x23be('0x1'));var timeout=require(_0x23be('0x2'));var express=require('express');var router=express[_0x23be('0x3')]();var auth=require(_0x23be('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x23be('0x5'));router[_0x23be('0x6')]('/',auth[_0x23be('0x7')](),controller['index']);router[_0x23be('0x6')](_0x23be('0x8'),auth[_0x23be('0x7')](),controller[_0x23be('0x9')]);router[_0x23be('0xa')]('/',auth[_0x23be('0x7')](),controller[_0x23be('0xb')]);router[_0x23be('0xc')]('/:id',auth[_0x23be('0x7')](),controller[_0x23be('0xd')]);router['delete']('/:id',auth[_0x23be('0x7')](),controller[_0x23be('0xe')]);module[_0x23be('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 941e055..88cbc1d 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 _0x6305=['INTEGER','moment','sequelize','STRING','contactListQueue'];(function(_0x468f75,_0x21cae8){var _0x4697ba=function(_0x285bc4){while(--_0x285bc4){_0x468f75['push'](_0x468f75['shift']());}};_0x4697ba(++_0x21cae8);}(_0x6305,0x178));var _0x5630=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x6305[_0x47e7cb];return _0x2a8874;};'use strict';var moment=require(_0x5630('0x0'));var Sequelize=require(_0x5630('0x1'));module['exports']={'phone':{'type':Sequelize[_0x5630('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5630('0x3')},'ListId':{'type':Sequelize[_0x5630('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x5630('0x3')}}; \ No newline at end of file +var _0x65ba=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0x108ae5,_0x2650fd){var _0x58ea1f=function(_0x5a778a){while(--_0x5a778a){_0x108ae5['push'](_0x108ae5['shift']());}};_0x58ea1f(++_0x2650fd);}(_0x65ba,0x149));var _0xa65b=function(_0x16ff0e,_0x4e7dc6){_0x16ff0e=_0x16ff0e-0x0;var _0x95bd68=_0x65ba[_0x16ff0e];return _0x95bd68;};'use strict';var moment=require(_0xa65b('0x0'));var Sequelize=require(_0xa65b('0x1'));module[_0xa65b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa65b('0x3')],'unique':_0xa65b('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa65b('0x4')},'VoiceQueueId':{'type':Sequelize[_0xa65b('0x3')],'unique':_0xa65b('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0e51131..cd1e055 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(_0x1f2f18,_0x204085){var _0x2950d1=function(_0x2c6253){while(--_0x2c6253){_0x1f2f18['push'](_0x1f2f18['shift']());}};_0x2950d1(++_0x204085);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var 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(_0x1fbd8f,_0x429bbb){var _0x13c30b=function(_0x2ff77e){while(--_0x2ff77e){_0x1fbd8f['push'](_0x1fbd8f['shift']());}};_0x13c30b(++_0x429bbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3ea3d78..210a510 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 _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x3ee7c4,_0x4b75d4){var _0x370dde=function(_0x321215){while(--_0x321215){_0x3ee7c4['push'](_0x3ee7c4['shift']());}};_0x370dde(++_0x4b75d4);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack'];(function(_0x3b9a30,_0x2564e9){var _0xd6ddf0=function(_0x2b967f){while(--_0x2b967f){_0x3b9a30['push'](_0x3b9a30['shift']());}};_0xd6ddf0(++_0x2564e9);}(_0x34e8,0x12c));var _0x834e=function(_0x37890d,_0x5bd9d3){_0x37890d=_0x37890d-0x0;var _0x132039=_0x34e8[_0x37890d];return _0x132039;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 26c6c11..2868998 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 _0xa50f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetCmHopperBlack','CmHopperBlack','options','attributes','limit','include','map','model','stringify','catch','UpdateCmHopperBlack','body','raw','where','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x3dec17,_0x54285d){var _0x1e3c0f=function(_0x568f8a){while(--_0x568f8a){_0x3dec17['push'](_0x3dec17['shift']());}};_0x1e3c0f(++_0x54285d);}(_0xa50f,0x8d));var _0xfa50=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa50f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xfa50('0x0'));var util=require(_0xfa50('0x1'));var moment=require(_0xfa50('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa50('0x3'))['db'];var utils=require(_0xfa50('0x4'));var logger=require(_0xfa50('0x5'))(_0xfa50('0x6'));var config=require(_0xfa50('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa50('0x8')][_0xfa50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45b039,_0x94ae8c,_0x5c9dec){return new BPromise(function(_0x27b0a5,_0x254bba){return client[_0xfa50('0xa')](_0x45b039,_0x5c9dec)[_0xfa50('0xb')](function(_0x1e2652){logger[_0xfa50('0xc')](_0xfa50('0xd'),_0x94ae8c,'request\x20sent');logger[_0xfa50('0xe')](_0xfa50('0xf'),_0x94ae8c,_0xfa50('0x10'),JSON['stringify'](_0x1e2652));if(_0x1e2652[_0xfa50('0x11')]){if(_0x1e2652['error'][_0xfa50('0x12')]===0x1f4){logger['error'](_0xfa50('0xd'),_0x94ae8c,_0x1e2652[_0xfa50('0x11')]['message']);return _0x254bba(_0x1e2652[_0xfa50('0x11')][_0xfa50('0x13')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x94ae8c,_0x1e2652['error']['message']);return _0x27b0a5(_0x1e2652[_0xfa50('0x11')][_0xfa50('0x13')]);}else{logger[_0xfa50('0xc')](_0xfa50('0xd'),_0x94ae8c,'request\x20sent');_0x27b0a5(_0x1e2652['result'][_0xfa50('0x13')]);}})['catch'](function(_0x270947){logger[_0xfa50('0x11')](_0xfa50('0xd'),_0x94ae8c,_0x270947);_0x254bba(_0x270947);});});}exports[_0xfa50('0x14')]=function(_0x2f88cc){var _0x2928f1=this;return new Promise(function(_0x40c618,_0x437501){return db[_0xfa50('0x15')]['findAll']({'raw':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc[_0xfa50('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc['options']['where']||null:null,'attributes':_0x2f88cc['options']?_0x2f88cc[_0xfa50('0x16')][_0xfa50('0x17')]||null:null,'limit':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc['options'][_0xfa50('0x18')]||null:null,'include':_0x2f88cc[_0xfa50('0x16')]?_0x2f88cc['options'][_0xfa50('0x19')]?_[_0xfa50('0x1a')](_0x2f88cc[_0xfa50('0x16')][_0xfa50('0x19')],function(_0x164dbf){return{'model':db[_0x164dbf[_0xfa50('0x1b')]],'as':_0x164dbf['as'],'attributes':_0x164dbf[_0xfa50('0x17')],'include':_0x164dbf[_0xfa50('0x19')]?_[_0xfa50('0x1a')](_0x164dbf[_0xfa50('0x19')],function(_0x2b0993){return{'model':db[_0x2b0993[_0xfa50('0x1b')]],'as':_0x2b0993['as'],'attributes':_0x2b0993['attributes'],'include':_0x2b0993[_0xfa50('0x19')]?_[_0xfa50('0x1a')](_0x2b0993[_0xfa50('0x19')],function(_0x34e112){return{'model':db[_0x34e112[_0xfa50('0x1b')]],'as':_0x34e112['as'],'attributes':_0x34e112[_0xfa50('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfa50('0xb')](function(_0x43dae2){logger[_0xfa50('0xc')](_0xfa50('0x14'),_0x2f88cc);logger['debug'](_0xfa50('0x14'),_0x2f88cc,JSON[_0xfa50('0x1c')](_0x43dae2));_0x40c618(_0x43dae2);})[_0xfa50('0x1d')](function(_0x27e2a9){logger[_0xfa50('0x11')]('GetCmHopperBlack',_0x27e2a9[_0xfa50('0x13')],_0x2f88cc);_0x437501(_0x2928f1['error'](0x1f4,_0x27e2a9[_0xfa50('0x13')]));});});};exports[_0xfa50('0x1e')]=function(_0x82524f){var _0x28136c=this;return new Promise(function(_0xcf8b25,_0x2a8432){return db[_0xfa50('0x15')]['update'](_0x82524f[_0xfa50('0x1f')],{'raw':_0x82524f['options']?_0x82524f[_0xfa50('0x16')][_0xfa50('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x82524f['options']?_0x82524f[_0xfa50('0x16')][_0xfa50('0x21')]||null:null,'attributes':_0x82524f[_0xfa50('0x16')]?_0x82524f[_0xfa50('0x16')]['attributes']||null:null,'limit':_0x82524f[_0xfa50('0x16')]?_0x82524f[_0xfa50('0x16')]['limit']||null:null})[_0xfa50('0xb')](function(_0x28fff0){logger[_0xfa50('0xc')]('UpdateCmHopperBlack',_0x82524f);logger[_0xfa50('0xe')](_0xfa50('0x1e'),_0x82524f,JSON[_0xfa50('0x1c')](_0x28fff0));_0xcf8b25(_0x28fff0);})['catch'](function(_0xb18937){logger[_0xfa50('0x11')](_0xfa50('0x1e'),_0xb18937[_0xfa50('0x13')],_0x82524f);_0x2a8432(_0x28136c[_0xfa50('0x11')](0x1f4,_0xb18937[_0xfa50('0x13')]));});});};exports[_0xfa50('0x22')]=function(_0x5d08b2){var _0x2b3012=this;return new Promise(function(_0x9d5458,_0x1d220b){return db['CmHopperBlack'][_0xfa50('0x23')]({'where':_0x5d08b2['options']?_0x5d08b2[_0xfa50('0x16')][_0xfa50('0x21')]||null:null})[_0xfa50('0xb')](function(_0x140988){logger['info'](_0xfa50('0x22'),_0x5d08b2);logger['debug']('DestroyCmHopperBlack',_0x5d08b2,JSON['stringify'](_0x140988));_0x9d5458(_0x140988);})[_0xfa50('0x1d')](function(_0x4b7d3d){logger['error'](_0xfa50('0x22'),_0x4b7d3d[_0xfa50('0x13')],_0x5d08b2);_0x1d220b(_0x2b3012[_0xfa50('0x11')](0x1f4,_0x4b7d3d[_0xfa50('0x13')]));});});}; \ No newline at end of file +var _0x83f2=['code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','stringify','DestroyCmHopperBlack','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error'];(function(_0x5894c0,_0x577c35){var _0x31f9aa=function(_0x56a1a8){while(--_0x56a1a8){_0x5894c0['push'](_0x5894c0['shift']());}};_0x31f9aa(++_0x577c35);}(_0x83f2,0x117));var _0x283f=function(_0x5e112f,_0x361e47){_0x5e112f=_0x5e112f-0x0;var _0x45d990=_0x83f2[_0x5e112f];return _0x45d990;};'use strict';var _=require(_0x283f('0x0'));var util=require(_0x283f('0x1'));var moment=require('moment');var BPromise=require(_0x283f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x283f('0x3'));var db=require(_0x283f('0x4'))['db'];var utils=require(_0x283f('0x5'));var logger=require('../../config/logger')(_0x283f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x283f('0x7')][_0x283f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23ab8e,_0x3699f7,_0x15d61a){return new BPromise(function(_0x1ba217,_0x4ce28b){return client[_0x283f('0x9')](_0x23ab8e,_0x15d61a)[_0x283f('0xa')](function(_0x35acd){logger[_0x283f('0xb')](_0x283f('0xc'),_0x3699f7,_0x283f('0xd'));logger[_0x283f('0xe')](_0x283f('0xf'),_0x3699f7,_0x283f('0xd'),JSON['stringify'](_0x35acd));if(_0x35acd[_0x283f('0x10')]){if(_0x35acd[_0x283f('0x10')][_0x283f('0x11')]===0x1f4){logger[_0x283f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3699f7,_0x35acd[_0x283f('0x10')][_0x283f('0x12')]);return _0x4ce28b(_0x35acd[_0x283f('0x10')][_0x283f('0x12')]);}logger[_0x283f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3699f7,_0x35acd['error'][_0x283f('0x12')]);return _0x1ba217(_0x35acd['error']['message']);}else{logger[_0x283f('0xb')](_0x283f('0xc'),_0x3699f7,_0x283f('0xd'));_0x1ba217(_0x35acd[_0x283f('0x13')][_0x283f('0x12')]);}})[_0x283f('0x14')](function(_0xbf76bd){logger[_0x283f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3699f7,_0xbf76bd);_0x4ce28b(_0xbf76bd);});});}exports[_0x283f('0x15')]=function(_0x3d536b){var _0x17eb18=this;return new Promise(function(_0x30ffc8,_0xf8fc9c){return db[_0x283f('0x16')][_0x283f('0x17')]({'raw':_0x3d536b[_0x283f('0x18')]?_0x3d536b[_0x283f('0x18')][_0x283f('0x19')]===undefined?!![]:![]:!![],'where':_0x3d536b['options']?_0x3d536b['options'][_0x283f('0x1a')]||null:null,'attributes':_0x3d536b['options']?_0x3d536b[_0x283f('0x18')][_0x283f('0x1b')]||null:null,'limit':_0x3d536b[_0x283f('0x18')]?_0x3d536b['options'][_0x283f('0x1c')]||null:null,'include':_0x3d536b[_0x283f('0x18')]?_0x3d536b['options'][_0x283f('0x1d')]?_[_0x283f('0x1e')](_0x3d536b['options'][_0x283f('0x1d')],function(_0x358072){return{'model':db[_0x358072[_0x283f('0x1f')]],'as':_0x358072['as'],'attributes':_0x358072[_0x283f('0x1b')],'include':_0x358072[_0x283f('0x1d')]?_[_0x283f('0x1e')](_0x358072[_0x283f('0x1d')],function(_0x2291eb){return{'model':db[_0x2291eb[_0x283f('0x1f')]],'as':_0x2291eb['as'],'attributes':_0x2291eb[_0x283f('0x1b')],'include':_0x2291eb['include']?_[_0x283f('0x1e')](_0x2291eb[_0x283f('0x1d')],function(_0x3a42e4){return{'model':db[_0x3a42e4['model']],'as':_0x3a42e4['as'],'attributes':_0x3a42e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x283f('0xa')](function(_0x3546d3){logger[_0x283f('0xb')]('GetCmHopperBlack',_0x3d536b);logger[_0x283f('0xe')](_0x283f('0x15'),_0x3d536b,JSON['stringify'](_0x3546d3));_0x30ffc8(_0x3546d3);})[_0x283f('0x14')](function(_0x37850d){logger[_0x283f('0x10')](_0x283f('0x15'),_0x37850d[_0x283f('0x12')],_0x3d536b);_0xf8fc9c(_0x17eb18[_0x283f('0x10')](0x1f4,_0x37850d['message']));});});};exports[_0x283f('0x20')]=function(_0x4a555b){var _0x54a66a=this;return new Promise(function(_0x57db9f,_0x3f439b){return db[_0x283f('0x16')][_0x283f('0x21')](_0x4a555b[_0x283f('0x22')],{'raw':_0x4a555b[_0x283f('0x18')]?_0x4a555b[_0x283f('0x18')][_0x283f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a555b[_0x283f('0x18')]?_0x4a555b['options']['where']||null:null,'attributes':_0x4a555b['options']?_0x4a555b[_0x283f('0x18')][_0x283f('0x1b')]||null:null,'limit':_0x4a555b[_0x283f('0x18')]?_0x4a555b[_0x283f('0x18')][_0x283f('0x1c')]||null:null})[_0x283f('0xa')](function(_0x1932f5){logger[_0x283f('0xb')](_0x283f('0x20'),_0x4a555b);logger[_0x283f('0xe')]('UpdateCmHopperBlack',_0x4a555b,JSON[_0x283f('0x23')](_0x1932f5));_0x57db9f(_0x1932f5);})['catch'](function(_0x38a46e){logger[_0x283f('0x10')](_0x283f('0x20'),_0x38a46e[_0x283f('0x12')],_0x4a555b);_0x3f439b(_0x54a66a[_0x283f('0x10')](0x1f4,_0x38a46e[_0x283f('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x8990d0){var _0x1c33cb=this;return new Promise(function(_0x2e6edc,_0xa793cf){return db[_0x283f('0x16')]['destroy']({'where':_0x8990d0['options']?_0x8990d0[_0x283f('0x18')]['where']||null:null})[_0x283f('0xa')](function(_0x48e7aa){logger['info'](_0x283f('0x24'),_0x8990d0);logger[_0x283f('0xe')](_0x283f('0x24'),_0x8990d0,JSON[_0x283f('0x23')](_0x48e7aa));_0x2e6edc(_0x48e7aa);})[_0x283f('0x14')](function(_0x154ea1){logger[_0x283f('0x10')](_0x283f('0x24'),_0x154ea1[_0x283f('0x12')],_0x8990d0);_0xa793cf(_0x1c33cb[_0x283f('0x10')](0x1f4,_0x154ea1[_0x283f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 85e2b32..24941e7 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 _0x7bae=['index','/describe','describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x516286,_0x4805f2){var _0x41d434=function(_0x17c825){while(--_0x17c825){_0x516286['push'](_0x516286['shift']());}};_0x41d434(++_0x4805f2);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x7bae[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7ba('0x3'));var config=require(_0xe7ba('0x4'));var controller=require(_0xe7ba('0x5'));router[_0xe7ba('0x6')]('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x8')]);router[_0xe7ba('0x6')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xa')]);router[_0xe7ba('0x6')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xc')]);router['put'](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xd')]);router[_0xe7ba('0xe')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xf')]);module[_0xe7ba('0x10')]=router; \ No newline at end of file +var _0xd2ea=['isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x3b757f,_0x2ef4e3){var _0x1a8a72=function(_0x1986ff){while(--_0x1986ff){_0x3b757f['push'](_0x3b757f['shift']());}};_0x1a8a72(++_0x2ef4e3);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5d0f5e,_0x3e15c8){_0x5d0f5e=_0x5d0f5e-0x0;var _0x556ddd=_0xd2ea[_0x5d0f5e];return _0x556ddd;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['get'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['show']);router[_0xad2e('0xf')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')](_0xad2e('0xe'),auth['isAuthenticated'](),controller[_0xad2e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 08f4c5b..f8f5786 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 _0x25f3=['STRING','getDataValue','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','DATE'];(function(_0x333d99,_0x87dd42){var _0x41c679=function(_0xae20f){while(--_0xae20f){_0x333d99['push'](_0x333d99['shift']());}};_0x41c679(++_0x87dd42);}(_0x25f3,0x8b));var _0x325f=function(_0x28798e,_0x284ab3){_0x28798e=_0x28798e-0x0;var _0x48b1c0=_0x25f3[_0x28798e];return _0x48b1c0;};'use strict';var Sequelize=require(_0x325f('0x0'));var moment=require(_0x325f('0x1'));module['exports']={'state':{'type':Sequelize[_0x325f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x325f('0x3')]},'countbusyretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x325f('0x4')]},'calleridnum':{'type':Sequelize[_0x325f('0x4')]},'calleridname':{'type':Sequelize[_0x325f('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x325f('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x325f('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x325f('0x4')]},'campaign':{'type':Sequelize[_0x325f('0x4')]},'campaigntype':{'type':Sequelize[_0x325f('0x4')]},'membername':{'type':Sequelize[_0x325f('0x4')]},'reason':{'type':Sequelize[_0x325f('0x4')]},'disposition':{'type':Sequelize[_0x325f('0x4')]},'dispositionat':{'type':Sequelize[_0x325f('0x3')],'set':function(_0x219bdf){var _0x266953=this[_0x325f('0x5')]('endtime');if(_0x266953&&_0x219bdf){this[_0x325f('0x6')]('followuptime',moment(_0x219bdf)[_0x325f('0x7')](moment(_0x266953),_0x325f('0x8')));}return this[_0x325f('0x6')](_0x325f('0x9'),_0x219bdf);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x325f('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x325f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x325f('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x325f('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x325f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d4e=['endtime','followuptime','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0xf5802e,_0x346340){var _0x55133d=function(_0x306b00){while(--_0x306b00){_0xf5802e['push'](_0xf5802e['shift']());}};_0x55133d(++_0x346340);}(_0x8d4e,0x165));var _0xe8d4=function(_0x157ce2,_0x2365a3){_0x157ce2=_0x157ce2-0x0;var _0x333d76=_0x8d4e[_0x157ce2];return _0x333d76;};'use strict';var Sequelize=require(_0xe8d4('0x0'));var moment=require(_0xe8d4('0x1'));module[_0xe8d4('0x2')]={'state':{'type':Sequelize[_0xe8d4('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xe8d4('0x4')]},'scheduledat':{'type':Sequelize[_0xe8d4('0x5')]},'countbusyretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe8d4('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe8d4('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe8d4('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe8d4('0x5')]},'answertime':{'type':Sequelize[_0xe8d4('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe8d4('0x4')]},'campaigntype':{'type':Sequelize[_0xe8d4('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xe8d4('0x5')],'set':function(_0x5b14ee){var _0x193939=this[_0xe8d4('0x6')](_0xe8d4('0x7'));if(_0x193939&&_0x5b14ee){this['setDataValue'](_0xe8d4('0x8'),moment(_0x5b14ee)['diff'](moment(_0x193939),_0xe8d4('0x9')));}return this[_0xe8d4('0xa')](_0xe8d4('0xb'),_0x5b14ee);}},'amd':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe8d4('0x5')]},'callback':{'type':Sequelize[_0xe8d4('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe8d4('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe8d4('0x5')]},'deleted':{'type':Sequelize[_0xe8d4('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe8d4('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe8d4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe8d4('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index ab46edc..57e1c43 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 _0x39e6=['field','phone','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','CampaignId','html-pdf','rimraf','request-promise','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','then','includeAll','include','catch','params','rawAttributes','intersection','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x39e6,0x9e));var _0x639e=function(_0x418263,_0x4da860){_0x418263=_0x418263-0x0;var _0x3481df=_0x39e6[_0x418263];return _0x3481df;};'use strict';var pdf=require(_0x639e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x639e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x639e('0x2'));var moment=require(_0x639e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x639e('0x4'));var util=require(_0x639e('0x5'));var path=require(_0x639e('0x6'));var sox=require(_0x639e('0x7'));var csv=require(_0x639e('0x8'));var ejs=require(_0x639e('0x9'));var fs=require('fs');var _=require(_0x639e('0xa'));var squel=require(_0x639e('0xb'));var crypto=require(_0x639e('0xc'));var jsforce=require(_0x639e('0xd'));var deskjs=require(_0x639e('0xe'));var toCsv=require(_0x639e('0x8'));var querystring=require(_0x639e('0xf'));var Papa=require(_0x639e('0x10'));var Redis=require(_0x639e('0x11'));var authService=require(_0x639e('0x12'));var qs=require(_0x639e('0x13'));var as=require(_0x639e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x639e('0x15'));var utils=require(_0x639e('0x16'));var config=require(_0x639e('0x17'));var db=require(_0x639e('0x18'))['db'];function respondWithStatusCode(_0x1be347,_0x16117b){_0x16117b=_0x16117b||0xcc;return function(_0x30b490){if(_0x30b490){return _0x1be347['sendStatus'](_0x16117b);}return _0x1be347['status'](_0x16117b)[_0x639e('0x19')]();};}function respondWithResult(_0x3a1693,_0x89302c){_0x89302c=_0x89302c||0xc8;return function(_0x199fb5){if(_0x199fb5){return _0x3a1693[_0x639e('0x1a')](_0x89302c)[_0x639e('0x1b')](_0x199fb5);}};}function respondWithFilteredResult(_0x55728e,_0x31826a){return function(_0x20bfbb){if(_0x20bfbb){var _0x23f0f9=_0x20bfbb['count'],_0x4077c5=_0x31826a[_0x639e('0x1c')],_0x4fa3fa=_0x31826a[_0x639e('0x1c')]+_0x31826a[_0x639e('0x1d')],_0x6dd912;if(_0x4fa3fa>=_0x23f0f9){_0x4fa3fa=_0x23f0f9;_0x6dd912=0xc8;}else{_0x6dd912=0xce;}_0x55728e[_0x639e('0x1a')](_0x6dd912);return _0x55728e[_0x639e('0x1e')](_0x639e('0x1f'),_0x4077c5+'-'+_0x4fa3fa+'/'+_0x23f0f9)['json'](_0x20bfbb);}return null;};}function patchUpdates(_0x1e8310){return function(_0x34baca){try{jsonpatch[_0x639e('0x20')](_0x34baca,_0x1e8310,!![]);}catch(_0x1da55e){return BPromise['reject'](_0x1da55e);}return _0x34baca[_0x639e('0x21')]();};}function saveUpdates(_0xdf47a5,_0x44dd33){return function(_0x149472){if(_0x149472){return _0x149472[_0x639e('0x22')](_0xdf47a5)['then'](function(_0xf31cf7){return _0xf31cf7;});}return null;};}function removeEntity(_0x35565b,_0x4f4421){return function(_0x25ead8){if(_0x25ead8){return _0x25ead8['destroy']()['then'](function(){_0x35565b[_0x639e('0x1a')](0xcc)[_0x639e('0x19')]();});}};}function handleEntityNotFound(_0x3ab673,_0x24e1ad){return function(_0x211fcb){if(!_0x211fcb){_0x3ab673['sendStatus'](0x194);}return _0x211fcb;};}function handleError(_0x2b699c,_0x3647d9){_0x3647d9=_0x3647d9||0x1f4;return function(_0x39b44f){logger[_0x639e('0x23')](_0x39b44f[_0x639e('0x24')]);if(_0x39b44f['name']){delete _0x39b44f[_0x639e('0x25')];}_0x2b699c[_0x639e('0x1a')](_0x3647d9)[_0x639e('0x26')](_0x39b44f);};}exports[_0x639e('0x27')]=function(_0x5b5b8c,_0x2ae3b7){var _0x282d87={},_0x13ef2b={},_0x49b921={'count':0x0,'rows':[]};var _0xefbf1c=_['map'](db[_0x639e('0x28')]['rawAttributes'],function(_0x525a1f){return{'name':_0x525a1f[_0x639e('0x29')],'type':_0x525a1f[_0x639e('0x2a')][_0x639e('0x2b')]};});_0x13ef2b[_0x639e('0x2c')]=_[_0x639e('0x2d')](_0xefbf1c,_0x639e('0x25'));_0x13ef2b['query']=_[_0x639e('0x2e')](_0x5b5b8c[_0x639e('0x2f')]);_0x13ef2b['filters']=_['intersection'](_0x13ef2b[_0x639e('0x2c')],_0x13ef2b[_0x639e('0x2f')]);_0x282d87[_0x639e('0x30')]=_['intersection'](_0x13ef2b[_0x639e('0x2c')],qs['fields'](_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x31')]));_0x282d87[_0x639e('0x30')]=_0x282d87['attributes'][_0x639e('0x32')]?_0x282d87['attributes']:_0x13ef2b[_0x639e('0x2c')];if(!_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x33')]('nolimit')){_0x282d87[_0x639e('0x1d')]=qs[_0x639e('0x1d')](_0x5b5b8c[_0x639e('0x2f')]['limit']);_0x282d87[_0x639e('0x1c')]=qs['offset'](_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x1c')]);}_0x282d87[_0x639e('0x34')]=qs[_0x639e('0x35')](_0x5b5b8c[_0x639e('0x2f')]['sort']);_0x282d87[_0x639e('0x36')]=qs[_0x639e('0x37')](_[_0x639e('0x38')](_0x5b5b8c[_0x639e('0x2f')],_0x13ef2b['filters']),_0xefbf1c);if(_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x39')]){_0x282d87[_0x639e('0x36')]=_['merge'](_0x282d87[_0x639e('0x36')],{'$or':_['map'](_0xefbf1c,function(_0x463aa7){if(_0x463aa7[_0x639e('0x2a')]!==_0x639e('0x3a')){var _0x4541cc={};_0x4541cc[_0x463aa7[_0x639e('0x25')]]={'$like':'%'+_0x5b5b8c[_0x639e('0x2f')]['filter']+'%'};return _0x4541cc;}})});}_0x282d87=_[_0x639e('0x3b')]({},_0x282d87,_0x5b5b8c[_0x639e('0x3c')]);var _0x55a8e2={'where':_0x282d87[_0x639e('0x36')]};return db['CmHopperFinal'][_0x639e('0x3d')](_0x55a8e2)[_0x639e('0x3e')](function(_0x3ba300){_0x49b921[_0x639e('0x3d')]=_0x3ba300;if(_0x5b5b8c[_0x639e('0x2f')][_0x639e('0x3f')]){_0x282d87[_0x639e('0x40')]=[{'all':!![]}];}return db[_0x639e('0x28')]['findAll'](_0x282d87);})['then'](function(_0x490045){_0x49b921['rows']=_0x490045;return _0x49b921;})[_0x639e('0x3e')](respondWithFilteredResult(_0x2ae3b7,_0x282d87))[_0x639e('0x41')](handleError(_0x2ae3b7,null));};exports['show']=function(_0x2fa730,_0x3f13ec){var _0x16a792={'raw':!![],'where':{'id':_0x2fa730[_0x639e('0x42')]['id']}},_0x54f0c9={};_0x54f0c9[_0x639e('0x2c')]=_[_0x639e('0x2e')](db[_0x639e('0x28')][_0x639e('0x43')]);_0x54f0c9[_0x639e('0x2f')]=_[_0x639e('0x2e')](_0x2fa730[_0x639e('0x2f')]);_0x54f0c9[_0x639e('0x37')]=_['intersection'](_0x54f0c9[_0x639e('0x2c')],_0x54f0c9[_0x639e('0x2f')]);_0x16a792[_0x639e('0x30')]=_[_0x639e('0x44')](_0x54f0c9[_0x639e('0x2c')],qs[_0x639e('0x31')](_0x2fa730['query'][_0x639e('0x31')]));_0x16a792[_0x639e('0x30')]=_0x16a792[_0x639e('0x30')][_0x639e('0x32')]?_0x16a792[_0x639e('0x30')]:_0x54f0c9[_0x639e('0x2c')];if(_0x2fa730[_0x639e('0x2f')][_0x639e('0x3f')]){_0x16a792[_0x639e('0x40')]=[{'all':!![]}];}_0x16a792=_[_0x639e('0x3b')]({},_0x16a792,_0x2fa730[_0x639e('0x3c')]);return db[_0x639e('0x28')]['find'](_0x16a792)[_0x639e('0x3e')](handleEntityNotFound(_0x3f13ec,null))['then'](respondWithResult(_0x3f13ec,null))['catch'](handleError(_0x3f13ec,null));};exports[_0x639e('0x45')]=function(_0x106f47,_0x44a3e5){return db[_0x639e('0x28')][_0x639e('0x45')]()['then'](respondWithResult(_0x44a3e5,null))[_0x639e('0x41')](handleError(_0x44a3e5,null));};exports[_0x639e('0x22')]=function(_0x56ecea,_0x32000e){if(_0x56ecea[_0x639e('0x46')][_0x639e('0x47')]){delete _0x56ecea['body'][_0x639e('0x47')];}return db[_0x639e('0x28')][_0x639e('0x48')]({'where':{'uniqueid':_0x56ecea[_0x639e('0x42')]['id']}})['then'](handleEntityNotFound(_0x32000e,null))[_0x639e('0x3e')](saveUpdates(_0x56ecea['body'],null))[_0x639e('0x3e')](respondWithResult(_0x32000e,null))['catch'](handleError(_0x32000e,null));};exports[_0x639e('0x49')]=function(_0x413ebd,_0x4398d0,_0x8f10f2){return db[_0x639e('0x28')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x413ebd[_0x639e('0x42')]['id']},'attributes':[[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4d')))),_0x639e('0x4e')],[db['sequelize']['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4f')))),_0x639e('0x50')],[db['sequelize']['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x639e('0x4c')](_0x639e('0x51')))),_0x639e('0x52')],[db[_0x639e('0x4a')]['fn']('COUNT',db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x639e('0x53')],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x54')))),'dropContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')]['literal'](_0x639e('0x55')))),_0x639e('0x56')],[db[_0x639e('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x639e('0x4c')](_0x639e('0x57')))),'reCallContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x58')))),_0x639e('0x59')]]})[_0x639e('0x3e')](handleEntityNotFound(_0x4398d0,null))['then'](respondWithResult(_0x4398d0,null))[_0x639e('0x41')](handleError(_0x4398d0,null));};exports[_0x639e('0x5a')]=function(_0x496fe5,_0x560ac1,_0x368619){return db['CmHopperFinal'][_0x639e('0x5b')]({'raw':![],'where':{'CampaignId':_0x496fe5[_0x639e('0x42')]['id']},'attributes':[[db[_0x639e('0x4a')]['fn']('COUNT',db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4d')))),'noSuchContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x4f')))),_0x639e('0x50')],[db[_0x639e('0x4a')]['fn']('COUNT',db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')](_0x639e('0x51')))),_0x639e('0x52')],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')][_0x639e('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x639e('0x5c')],[db['sequelize']['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x639e('0x56')],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x639e('0x4c')](_0x639e('0x57')))),'reCallContacts'],[db[_0x639e('0x4a')]['fn'](_0x639e('0x4b'),db[_0x639e('0x4a')]['fn']('IF',db[_0x639e('0x4a')]['literal'](_0x639e('0x58')))),_0x639e('0x59')]]})[_0x639e('0x3e')](handleEntityNotFound(_0x560ac1,null))[_0x639e('0x3e')](respondWithResult(_0x560ac1,null))['catch'](handleError(_0x560ac1,null));};exports[_0x639e('0x5d')]=function(_0x1b3d07,_0x1bd708,_0x3c945c){return db[_0x639e('0x5e')]['find']({'where':{'id':_0x1b3d07[_0x639e('0x42')]['id']}})[_0x639e('0x3e')](handleEntityNotFound(_0x1bd708,null))[_0x639e('0x3e')](function(_0x156e51){var _0x2aa53b;if(_0x156e51){_0x2aa53b=squel[_0x639e('0x5f')]()[_0x639e('0x60')](_0x639e('0x61'))[_0x639e('0x62')](['phone',_0x639e('0x63'),_0x639e('0x64'),_0x639e('0x65'),_0x639e('0x66'),_0x639e('0x67'),'updatedAt'],squel['select']()[_0x639e('0x68')]('ANY_VALUE(calleridnum)',_0x639e('0x69'))[_0x639e('0x68')]('NOW()',_0x639e('0x63'))[_0x639e('0x68')](_0x639e('0x6a'),_0x639e('0x64'))['field'](_0x639e('0x6b'),_0x639e('0x65'))[_0x639e('0x68')](_0x639e('0x6c'),'VoiceQueueId')[_0x639e('0x68')]('NOW()',_0x639e('0x67'))[_0x639e('0x68')](_0x639e('0x6d'),'updatedAt')[_0x639e('0x6e')](_0x639e('0x6f'))[_0x639e('0x36')](_0x639e('0x70'),_0x1b3d07[_0x639e('0x42')]['id']['toString']())['where'](_0x639e('0x71'),_0x1b3d07[_0x639e('0x46')][_0x639e('0x72')][_0x639e('0x73')]())[_0x639e('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x639e('0x36')](_0x639e('0x74'),squel[_0x639e('0x75')]()[_0x639e('0x68')](_0x639e('0x69'))[_0x639e('0x6e')](_0x639e('0x61'))[_0x639e('0x36')]('VoiceQueueId\x20=\x20?',_0x1b3d07['params']['id']['toString']()))[_0x639e('0x36')](_0x639e('0x74'),squel[_0x639e('0x75')]()[_0x639e('0x68')](_0x639e('0x76'))[_0x639e('0x6e')](_0x639e('0x6f'))['where'](_0x639e('0x70'),_0x1b3d07['params']['id'][_0x639e('0x73')]())[_0x639e('0x36')](_0x639e('0x77')))[_0x639e('0x78')]('ContactId'))[_0x639e('0x73')]();return db[_0x639e('0x4a')][_0x639e('0x2f')](_0x2aa53b);}return[];})[_0x639e('0x3e')](respondWithResult(_0x1bd708,null))['catch'](handleError(_0x1bd708,null));};exports[_0x639e('0x79')]=function(_0xd66e73,_0x356d88,_0x1732f8){return db['Campaign'][_0x639e('0x48')]({'where':{'id':_0xd66e73[_0x639e('0x42')]['id']}})['then'](handleEntityNotFound(_0x356d88,null))[_0x639e('0x3e')](function(_0x527dd3){var _0x294922;if(_0x527dd3){_0x294922=squel[_0x639e('0x5f')]()[_0x639e('0x60')](_0x639e('0x61'))[_0x639e('0x62')](['phone',_0x639e('0x63'),_0x639e('0x64'),_0x639e('0x65'),'CampaignId',_0x639e('0x67'),_0x639e('0x7a')],squel[_0x639e('0x75')]()['field'](_0x639e('0x7b'),_0x639e('0x69'))[_0x639e('0x68')](_0x639e('0x6d'),_0x639e('0x63'))[_0x639e('0x68')](_0x639e('0x6a'),_0x639e('0x64'))[_0x639e('0x68')](_0x639e('0x6b'),_0x639e('0x65'))[_0x639e('0x68')](_0x639e('0x7c'),'CampaignId')[_0x639e('0x68')]('NOW()',_0x639e('0x67'))[_0x639e('0x68')](_0x639e('0x6d'),_0x639e('0x7a'))[_0x639e('0x6e')]('cm_hopper_final')[_0x639e('0x36')](_0x639e('0x7d'),_0xd66e73[_0x639e('0x42')]['id'][_0x639e('0x73')]())[_0x639e('0x36')](_0x639e('0x71'),_0xd66e73[_0x639e('0x46')][_0x639e('0x72')][_0x639e('0x73')]())[_0x639e('0x36')](_0x639e('0x7e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x639e('0x75')]()[_0x639e('0x68')](_0x639e('0x69'))['from'](_0x639e('0x61'))[_0x639e('0x36')](_0x639e('0x7d'),_0xd66e73['params']['id'][_0x639e('0x73')]()))[_0x639e('0x36')](_0x639e('0x74'),squel['select']()[_0x639e('0x68')](_0x639e('0x76'))[_0x639e('0x6e')](_0x639e('0x6f'))[_0x639e('0x36')](_0x639e('0x7d'),_0xd66e73[_0x639e('0x42')]['id'][_0x639e('0x73')]())['where'](_0x639e('0x77')))['group'](_0x639e('0x64')))[_0x639e('0x73')]();return db[_0x639e('0x4a')][_0x639e('0x2f')](_0x294922);}return[];})['then'](respondWithResult(_0x356d88,null))[_0x639e('0x41')](handleError(_0x356d88,null));};exports[_0x639e('0x7f')]=function(_0x56b313,_0x47bf07,_0xedca5f){return db[_0x639e('0x80')][_0x639e('0x81')]({'where':{'VoiceQueueId':_0x56b313[_0x639e('0x46')][_0x639e('0x66')],'CampaignId':_0x56b313[_0x639e('0x46')][_0x639e('0x82')],'ContactId':_0x56b313[_0x639e('0x46')][_0x639e('0x64')]}})['then'](handleEntityNotFound(_0x47bf07,null))[_0x639e('0x3e')](function(_0x3a51e1){if(_0x3a51e1){return _0x3a51e1;}return null;})[_0x639e('0x3e')](respondWithResult(_0x47bf07,null))[_0x639e('0x41')](handleError(_0x47bf07,null));}; \ No newline at end of file +var _0x082a=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','rows','catch','show','params','intersection','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','sequelize','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','fromQuery','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','offset','limit','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes'];(function(_0x17e78b,_0x2431b3){var _0x1062b4=function(_0x585802){while(--_0x585802){_0x17e78b['push'](_0x17e78b['shift']());}};_0x1062b4(++_0x2431b3);}(_0x082a,0x154));var _0xa082=function(_0x187290,_0x109d7b){_0x187290=_0x187290-0x0;var _0x5bb0c0=_0x082a[_0x187290];return _0x5bb0c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa082('0x0'));var rimraf=require(_0xa082('0x1'));var zipdir=require(_0xa082('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa082('0x3'));var moment=require(_0xa082('0x4'));var BPromise=require(_0xa082('0x5'));var Mustache=require(_0xa082('0x6'));var util=require(_0xa082('0x7'));var path=require('path');var sox=require(_0xa082('0x8'));var csv=require('to-csv');var ejs=require(_0xa082('0x9'));var fs=require('fs');var _=require(_0xa082('0xa'));var squel=require('squel');var crypto=require(_0xa082('0xb'));var jsforce=require(_0xa082('0xc'));var deskjs=require(_0xa082('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa082('0xe'));var Papa=require(_0xa082('0xf'));var Redis=require(_0xa082('0x10'));var authService=require(_0xa082('0x11'));var qs=require(_0xa082('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa082('0x13'));var logger=require(_0xa082('0x14'))(_0xa082('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa082('0x16'))['db'];function respondWithStatusCode(_0x18d742,_0x473b1d){_0x473b1d=_0x473b1d||0xcc;return function(_0x2f6591){if(_0x2f6591){return _0x18d742['sendStatus'](_0x473b1d);}return _0x18d742[_0xa082('0x17')](_0x473b1d)[_0xa082('0x18')]();};}function respondWithResult(_0xe0276,_0x23bd57){_0x23bd57=_0x23bd57||0xc8;return function(_0x867ef4){if(_0x867ef4){return _0xe0276[_0xa082('0x17')](_0x23bd57)['json'](_0x867ef4);}};}function respondWithFilteredResult(_0xc56d7,_0x1eb38a){return function(_0x5cce12){if(_0x5cce12){var _0x20b6f8=_0x5cce12['count'],_0x13b93f=_0x1eb38a['offset'],_0x32cb5a=_0x1eb38a[_0xa082('0x19')]+_0x1eb38a[_0xa082('0x1a')],_0x3766fa;if(_0x32cb5a>=_0x20b6f8){_0x32cb5a=_0x20b6f8;_0x3766fa=0xc8;}else{_0x3766fa=0xce;}_0xc56d7['status'](_0x3766fa);return _0xc56d7[_0xa082('0x1b')]('Content-Range',_0x13b93f+'-'+_0x32cb5a+'/'+_0x20b6f8)[_0xa082('0x1c')](_0x5cce12);}return null;};}function patchUpdates(_0x284376){return function(_0x127b29){try{jsonpatch[_0xa082('0x1d')](_0x127b29,_0x284376,!![]);}catch(_0x58b29f){return BPromise[_0xa082('0x1e')](_0x58b29f);}return _0x127b29[_0xa082('0x1f')]();};}function saveUpdates(_0x48f656,_0x24befc){return function(_0x8904c7){if(_0x8904c7){return _0x8904c7[_0xa082('0x20')](_0x48f656)[_0xa082('0x21')](function(_0x50a196){return _0x50a196;});}return null;};}function removeEntity(_0x1be195,_0x56eb67){return function(_0x1a10ba){if(_0x1a10ba){return _0x1a10ba[_0xa082('0x22')]()['then'](function(){_0x1be195[_0xa082('0x17')](0xcc)[_0xa082('0x18')]();});}};}function handleEntityNotFound(_0x4fdc57,_0x505d27){return function(_0x36eded){if(!_0x36eded){_0x4fdc57[_0xa082('0x23')](0x194);}return _0x36eded;};}function handleError(_0x29d1db,_0x313a26){_0x313a26=_0x313a26||0x1f4;return function(_0x425b5d){logger[_0xa082('0x24')](_0x425b5d[_0xa082('0x25')]);if(_0x425b5d[_0xa082('0x26')]){delete _0x425b5d[_0xa082('0x26')];}_0x29d1db[_0xa082('0x17')](_0x313a26)[_0xa082('0x27')](_0x425b5d);};}exports[_0xa082('0x28')]=function(_0x3032d2,_0x2d6170){var _0x21730e={},_0x3e604e={},_0x3e9115={'count':0x0,'rows':[]};var _0x3e4971=_[_0xa082('0x29')](db[_0xa082('0x2a')][_0xa082('0x2b')],function(_0x3369ae){return{'name':_0x3369ae[_0xa082('0x2c')],'type':_0x3369ae[_0xa082('0x2d')][_0xa082('0x2e')]};});_0x3e604e[_0xa082('0x2f')]=_['map'](_0x3e4971,_0xa082('0x26'));_0x3e604e[_0xa082('0x30')]=_[_0xa082('0x31')](_0x3032d2[_0xa082('0x30')]);_0x3e604e[_0xa082('0x32')]=_['intersection'](_0x3e604e[_0xa082('0x2f')],_0x3e604e[_0xa082('0x30')]);_0x21730e['attributes']=_['intersection'](_0x3e604e['model'],qs[_0xa082('0x33')](_0x3032d2[_0xa082('0x30')][_0xa082('0x33')]));_0x21730e[_0xa082('0x34')]=_0x21730e[_0xa082('0x34')][_0xa082('0x35')]?_0x21730e[_0xa082('0x34')]:_0x3e604e[_0xa082('0x2f')];if(!_0x3032d2[_0xa082('0x30')][_0xa082('0x36')](_0xa082('0x37'))){_0x21730e[_0xa082('0x1a')]=qs[_0xa082('0x1a')](_0x3032d2['query']['limit']);_0x21730e['offset']=qs[_0xa082('0x19')](_0x3032d2[_0xa082('0x30')][_0xa082('0x19')]);}_0x21730e['order']=qs['sort'](_0x3032d2[_0xa082('0x30')][_0xa082('0x38')]);_0x21730e[_0xa082('0x39')]=qs['filters'](_[_0xa082('0x3a')](_0x3032d2['query'],_0x3e604e[_0xa082('0x32')]),_0x3e4971);if(_0x3032d2[_0xa082('0x30')]['filter']){_0x21730e[_0xa082('0x39')]=_[_0xa082('0x3b')](_0x21730e['where'],{'$or':_[_0xa082('0x29')](_0x3e4971,function(_0x4afed7){if(_0x4afed7[_0xa082('0x2d')]!==_0xa082('0x3c')){var _0x32b1ae={};_0x32b1ae[_0x4afed7[_0xa082('0x26')]]={'$like':'%'+_0x3032d2[_0xa082('0x30')][_0xa082('0x3d')]+'%'};return _0x32b1ae;}})});}_0x21730e=_[_0xa082('0x3b')]({},_0x21730e,_0x3032d2['options']);var _0xa942c9={'where':_0x21730e[_0xa082('0x39')]};return db[_0xa082('0x2a')][_0xa082('0x3e')](_0xa942c9)[_0xa082('0x21')](function(_0x1a2286){_0x3e9115[_0xa082('0x3e')]=_0x1a2286;if(_0x3032d2['query'][_0xa082('0x3f')]){_0x21730e['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x21730e);})[_0xa082('0x21')](function(_0x26bc65){_0x3e9115[_0xa082('0x40')]=_0x26bc65;return _0x3e9115;})['then'](respondWithFilteredResult(_0x2d6170,_0x21730e))[_0xa082('0x41')](handleError(_0x2d6170,null));};exports[_0xa082('0x42')]=function(_0x3438a7,_0x4db21b){var _0x54e284={'raw':!![],'where':{'id':_0x3438a7[_0xa082('0x43')]['id']}},_0x3a4d82={};_0x3a4d82[_0xa082('0x2f')]=_[_0xa082('0x31')](db[_0xa082('0x2a')][_0xa082('0x2b')]);_0x3a4d82[_0xa082('0x30')]=_[_0xa082('0x31')](_0x3438a7['query']);_0x3a4d82[_0xa082('0x32')]=_[_0xa082('0x44')](_0x3a4d82[_0xa082('0x2f')],_0x3a4d82[_0xa082('0x30')]);_0x54e284[_0xa082('0x34')]=_[_0xa082('0x44')](_0x3a4d82[_0xa082('0x2f')],qs[_0xa082('0x33')](_0x3438a7[_0xa082('0x30')]['fields']));_0x54e284[_0xa082('0x34')]=_0x54e284[_0xa082('0x34')][_0xa082('0x35')]?_0x54e284['attributes']:_0x3a4d82[_0xa082('0x2f')];if(_0x3438a7[_0xa082('0x30')][_0xa082('0x3f')]){_0x54e284['include']=[{'all':!![]}];}_0x54e284=_[_0xa082('0x3b')]({},_0x54e284,_0x3438a7[_0xa082('0x45')]);return db[_0xa082('0x2a')][_0xa082('0x46')](_0x54e284)[_0xa082('0x21')](handleEntityNotFound(_0x4db21b,null))['then'](respondWithResult(_0x4db21b,null))['catch'](handleError(_0x4db21b,null));};exports[_0xa082('0x47')]=function(_0x44bb00,_0x49ae44){return db[_0xa082('0x2a')]['describe']()['then'](respondWithResult(_0x49ae44,null))['catch'](handleError(_0x49ae44,null));};exports[_0xa082('0x20')]=function(_0x3003e9,_0x2d554a){if(_0x3003e9[_0xa082('0x48')]['uniqueid']){delete _0x3003e9[_0xa082('0x48')][_0xa082('0x49')];}return db[_0xa082('0x2a')][_0xa082('0x46')]({'where':{'uniqueid':_0x3003e9[_0xa082('0x43')]['id']}})[_0xa082('0x21')](handleEntityNotFound(_0x2d554a,null))[_0xa082('0x21')](saveUpdates(_0x3003e9[_0xa082('0x48')],null))[_0xa082('0x21')](respondWithResult(_0x2d554a,null))[_0xa082('0x41')](handleError(_0x2d554a,null));};exports[_0xa082('0x4a')]=function(_0x2b1092,_0x3ef24a,_0x12c21d){return db[_0xa082('0x2a')][_0xa082('0x4b')]({'raw':![],'where':{'VoiceQueueId':_0x2b1092[_0xa082('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xa082('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xa082('0x4d')](_0xa082('0x4e')))),_0xa082('0x4f')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x51')))),_0xa082('0x52')],[db[_0xa082('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa082('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0xa082('0x53')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db['sequelize']['fn']('IF',db[_0xa082('0x50')][_0xa082('0x4d')](_0xa082('0x54')))),_0xa082('0x55')],[db['sequelize']['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x56')))),_0xa082('0x57')],[db['sequelize']['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')][_0xa082('0x4d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa082('0x58')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x59')))),_0xa082('0x5a')],[db[_0xa082('0x50')]['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x5b')))),_0xa082('0x5c')]]})['then'](handleEntityNotFound(_0x3ef24a,null))[_0xa082('0x21')](respondWithResult(_0x3ef24a,null))[_0xa082('0x41')](handleError(_0x3ef24a,null));};exports[_0xa082('0x5d')]=function(_0x26fb84,_0x432fd4,_0x9825d5){return db['CmHopperFinal'][_0xa082('0x4b')]({'raw':![],'where':{'CampaignId':_0x26fb84[_0xa082('0x43')]['id']},'attributes':[[db[_0xa082('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x4e')))),'noSuchContacts'],[db[_0xa082('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa082('0x51')))),'noAnswerContacts'],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x5e')))),_0xa082('0x53')],[db[_0xa082('0x50')]['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x54')))),_0xa082('0x55')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db['sequelize'][_0xa082('0x4d')](_0xa082('0x56')))),_0xa082('0x57')],[db['sequelize']['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')][_0xa082('0x4d')](_0xa082('0x5f')))),_0xa082('0x58')],[db[_0xa082('0x50')]['fn'](_0xa082('0x4c'),db[_0xa082('0x50')]['fn']('IF',db[_0xa082('0x50')]['literal'](_0xa082('0x59')))),_0xa082('0x5a')],[db[_0xa082('0x50')]['fn']('COUNT',db[_0xa082('0x50')]['fn']('IF',db['sequelize'][_0xa082('0x4d')](_0xa082('0x5b')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x432fd4,null))[_0xa082('0x21')](respondWithResult(_0x432fd4,null))[_0xa082('0x41')](handleError(_0x432fd4,null));};exports[_0xa082('0x60')]=function(_0x3bd4a0,_0xd5345e,_0x3cf75c){return db['VoiceQueue'][_0xa082('0x46')]({'where':{'id':_0x3bd4a0['params']['id']}})['then'](handleEntityNotFound(_0xd5345e,null))['then'](function(_0x963bed){var _0x205b31;if(_0x963bed){_0x205b31=squel[_0xa082('0x61')]()[_0xa082('0x62')](_0xa082('0x63'))['fromQuery']([_0xa082('0x64'),_0xa082('0x65'),_0xa082('0x66'),_0xa082('0x67'),_0xa082('0x68'),_0xa082('0x69'),_0xa082('0x6a')],squel[_0xa082('0x6b')]()[_0xa082('0x6c')](_0xa082('0x6d'),_0xa082('0x64'))[_0xa082('0x6c')](_0xa082('0x6e'),'scheduledAt')[_0xa082('0x6c')](_0xa082('0x6f'),'ContactId')[_0xa082('0x6c')](_0xa082('0x70'),_0xa082('0x67'))[_0xa082('0x6c')](_0xa082('0x71'),_0xa082('0x68'))[_0xa082('0x6c')](_0xa082('0x6e'),'createdAt')['field'](_0xa082('0x6e'),'updatedAt')['from'](_0xa082('0x72'))[_0xa082('0x39')](_0xa082('0x73'),_0x3bd4a0[_0xa082('0x43')]['id'][_0xa082('0x74')]())[_0xa082('0x39')]('state\x20=\x20?',_0x3bd4a0[_0xa082('0x48')][_0xa082('0x75')][_0xa082('0x74')]())[_0xa082('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xa082('0x39')](_0xa082('0x76'),squel[_0xa082('0x6b')]()['field'](_0xa082('0x64'))[_0xa082('0x77')]('cm_hopper')['where'](_0xa082('0x73'),_0x3bd4a0[_0xa082('0x43')]['id'][_0xa082('0x74')]()))[_0xa082('0x39')](_0xa082('0x76'),squel[_0xa082('0x6b')]()[_0xa082('0x6c')](_0xa082('0x78'))[_0xa082('0x77')]('cm_hopper_final')[_0xa082('0x39')](_0xa082('0x73'),_0x3bd4a0['params']['id'][_0xa082('0x74')]())[_0xa082('0x39')](_0xa082('0x79')))[_0xa082('0x7a')]('ContactId'))['toString']();return db[_0xa082('0x50')][_0xa082('0x30')](_0x205b31);}return[];})['then'](respondWithResult(_0xd5345e,null))[_0xa082('0x41')](handleError(_0xd5345e,null));};exports[_0xa082('0x7b')]=function(_0x2551ad,_0x3e6bf4,_0x162b0b){return db['Campaign'][_0xa082('0x46')]({'where':{'id':_0x2551ad[_0xa082('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e6bf4,null))['then'](function(_0x536369){var _0x48e0c0;if(_0x536369){_0x48e0c0=squel[_0xa082('0x61')]()[_0xa082('0x62')](_0xa082('0x63'))[_0xa082('0x7c')]([_0xa082('0x64'),'scheduledAt',_0xa082('0x66'),_0xa082('0x67'),_0xa082('0x7d'),_0xa082('0x69'),_0xa082('0x6a')],squel['select']()[_0xa082('0x6c')](_0xa082('0x6d'),'phone')[_0xa082('0x6c')]('NOW()','scheduledAt')[_0xa082('0x6c')](_0xa082('0x6f'),_0xa082('0x66'))[_0xa082('0x6c')](_0xa082('0x70'),_0xa082('0x67'))[_0xa082('0x6c')]('ANY_VALUE(CampaignId)',_0xa082('0x7d'))[_0xa082('0x6c')](_0xa082('0x6e'),_0xa082('0x69'))[_0xa082('0x6c')](_0xa082('0x6e'),'updatedAt')[_0xa082('0x77')](_0xa082('0x72'))[_0xa082('0x39')](_0xa082('0x7e'),_0x2551ad[_0xa082('0x43')]['id']['toString']())[_0xa082('0x39')](_0xa082('0x7f'),_0x2551ad[_0xa082('0x48')]['state'][_0xa082('0x74')]())[_0xa082('0x39')](_0xa082('0x80'))[_0xa082('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa082('0x6b')]()['field']('phone')['from'](_0xa082('0x63'))[_0xa082('0x39')](_0xa082('0x7e'),_0x2551ad[_0xa082('0x43')]['id'][_0xa082('0x74')]()))[_0xa082('0x39')](_0xa082('0x76'),squel['select']()[_0xa082('0x6c')](_0xa082('0x78'))[_0xa082('0x77')](_0xa082('0x72'))['where'](_0xa082('0x7e'),_0x2551ad[_0xa082('0x43')]['id'][_0xa082('0x74')]())[_0xa082('0x39')](_0xa082('0x79')))[_0xa082('0x7a')](_0xa082('0x66')))[_0xa082('0x74')]();return db[_0xa082('0x50')][_0xa082('0x30')](_0x48e0c0);}return[];})[_0xa082('0x21')](respondWithResult(_0x3e6bf4,null))['catch'](handleError(_0x3e6bf4,null));};exports[_0xa082('0x81')]=function(_0x4e5a65,_0xfe7fd6,_0xd1cdbb){return db[_0xa082('0x82')]['findOne']({'where':{'VoiceQueueId':_0x4e5a65['body'][_0xa082('0x68')],'CampaignId':_0x4e5a65[_0xa082('0x48')][_0xa082('0x7d')],'ContactId':_0x4e5a65[_0xa082('0x48')][_0xa082('0x66')]}})[_0xa082('0x21')](handleEntityNotFound(_0xfe7fd6,null))[_0xa082('0x21')](function(_0x82f5fc){if(_0x82f5fc){return _0x82f5fc;}return null;})[_0xa082('0x21')](respondWithResult(_0xfe7fd6,null))[_0xa082('0x41')](handleError(_0xfe7fd6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ddfd86f..c88ede8 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 _0x16e4=['api','moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x16e4,0x97));var _0x416e=function(_0x12dcf9,_0x47c679){_0x12dcf9=_0x12dcf9-0x0;var _0x2e02cf=_0x16e4[_0x12dcf9];return _0x2e02cf;};'use strict';var _=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var logger=require(_0x416e('0x2'))(_0x416e('0x3'));var moment=require(_0x416e('0x4'));var BPromise=require(_0x416e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x416e('0x6'));var rimraf=require('rimraf');var config=require(_0x416e('0x7'));var attributes=require(_0x416e('0x8'));module['exports']=function(_0x1dad5d,_0x2f7484){return _0x1dad5d[_0x416e('0x9')](_0x416e('0xa'),attributes,{'tableName':_0x416e('0xb'),'paranoid':![],'indexes':[{'name':_0x416e('0xc'),'fields':[_0x416e('0xc')]},{'name':_0x416e('0xd'),'fields':[_0x416e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2504=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x5e4e99,_0x410870){var _0x200520=function(_0x4af77c){while(--_0x4af77c){_0x5e4e99['push'](_0x5e4e99['shift']());}};_0x200520(++_0x410870);}(_0x2504,0xee));var _0x4250=function(_0x21e3af,_0x26127a){_0x21e3af=_0x21e3af-0x0;var _0x1a6048=_0x2504[_0x21e3af];return _0x1a6048;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var rp=require(_0x4250('0x6'));var fs=require('fs');var path=require(_0x4250('0x7'));var rimraf=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var attributes=require(_0x4250('0xa'));module[_0x4250('0xb')]=function(_0x493da9,_0x473cb8){return _0x493da9['define']('CmHopperFinal',attributes,{'tableName':_0x4250('0xc'),'paranoid':![],'indexes':[{'name':_0x4250('0xd'),'fields':[_0x4250('0xd')]},{'name':_0x4250('0xe'),'fields':[_0x4250('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 11bb210..d1e4822 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 _0xcbc3=['create','body','options','CreateCmHopperFinal','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperFinal'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0xcbc3,0x1a5));var _0x3cbc=function(_0x1121b1,_0x4e40f2){_0x1121b1=_0x1121b1-0x0;var _0x5bf648=_0xcbc3[_0x1121b1];return _0x5bf648;};'use strict';var _=require(_0x3cbc('0x0'));var util=require(_0x3cbc('0x1'));var moment=require('moment');var BPromise=require(_0x3cbc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cbc('0x3'))['db'];var utils=require(_0x3cbc('0x4'));var logger=require(_0x3cbc('0x5'))('rpc');var config=require(_0x3cbc('0x6'));var jayson=require(_0x3cbc('0x7'));var client=jayson[_0x3cbc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59faa8,_0x2d2add,_0x595796){return new BPromise(function(_0x2e072,_0x3cb26d){return client[_0x3cbc('0x9')](_0x59faa8,_0x595796)[_0x3cbc('0xa')](function(_0x4f70de){logger[_0x3cbc('0xb')](_0x3cbc('0xc'),_0x2d2add,_0x3cbc('0xd'));logger[_0x3cbc('0xe')](_0x3cbc('0xf'),_0x2d2add,'request\x20sent',JSON['stringify'](_0x4f70de));if(_0x4f70de['error']){if(_0x4f70de[_0x3cbc('0x10')]['code']===0x1f4){logger[_0x3cbc('0x10')](_0x3cbc('0xc'),_0x2d2add,_0x4f70de[_0x3cbc('0x10')][_0x3cbc('0x11')]);return _0x3cb26d(_0x4f70de[_0x3cbc('0x10')]['message']);}logger[_0x3cbc('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x2d2add,_0x4f70de[_0x3cbc('0x10')][_0x3cbc('0x11')]);return _0x2e072(_0x4f70de[_0x3cbc('0x10')]['message']);}else{logger[_0x3cbc('0xb')](_0x3cbc('0xc'),_0x2d2add,_0x3cbc('0xd'));_0x2e072(_0x4f70de[_0x3cbc('0x12')][_0x3cbc('0x11')]);}})[_0x3cbc('0x13')](function(_0x5dfa15){logger['error'](_0x3cbc('0xc'),_0x2d2add,_0x5dfa15);_0x3cb26d(_0x5dfa15);});});}exports['CreateCmHopperFinal']=function(_0x29548e){var _0x2483dd=this;return new Promise(function(_0x4cdb83,_0x5bed87){return db[_0x3cbc('0x14')][_0x3cbc('0x15')](_0x29548e[_0x3cbc('0x16')],{'raw':_0x29548e[_0x3cbc('0x17')]?_0x29548e[_0x3cbc('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3cbc('0xa')](function(_0x498896){logger['info'](_0x3cbc('0x18'),_0x29548e);logger[_0x3cbc('0xe')](_0x3cbc('0x18'),_0x29548e,JSON[_0x3cbc('0x19')](_0x498896));_0x4cdb83(_0x498896);})['catch'](function(_0x59a57a){logger[_0x3cbc('0x10')](_0x3cbc('0x18'),_0x59a57a[_0x3cbc('0x11')],_0x29548e);_0x5bed87(_0x2483dd[_0x3cbc('0x10')](0x1f4,_0x59a57a[_0x3cbc('0x11')]));});});}; \ No newline at end of file +var _0x322f=['body','options','CreateCmHopperFinal','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','catch','CmHopperFinal','create'];(function(_0xdd914f,_0xfa6cd4){var _0x1ee80a=function(_0x483a05){while(--_0x483a05){_0xdd914f['push'](_0xdd914f['shift']());}};_0x1ee80a(++_0xfa6cd4);}(_0x322f,0x1bd));var _0xf322=function(_0x12336a,_0x2085c5){_0x12336a=_0x12336a-0x0;var _0x21d342=_0x322f[_0x12336a];return _0x21d342;};'use strict';var _=require(_0xf322('0x0'));var util=require(_0xf322('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf322('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf322('0x3'));var logger=require(_0xf322('0x4'))(_0xf322('0x5'));var config=require(_0xf322('0x6'));var jayson=require(_0xf322('0x7'));var client=jayson[_0xf322('0x8')][_0xf322('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31a86e,_0xefc004,_0x511723){return new BPromise(function(_0xbcdf7b,_0x5460db){return client[_0xf322('0xa')](_0x31a86e,_0x511723)['then'](function(_0x505a23){logger[_0xf322('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0xefc004,_0xf322('0xc'));logger[_0xf322('0xd')](_0xf322('0xe'),_0xefc004,_0xf322('0xc'),JSON[_0xf322('0xf')](_0x505a23));if(_0x505a23[_0xf322('0x10')]){if(_0x505a23[_0xf322('0x10')][_0xf322('0x11')]===0x1f4){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);return _0x5460db(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}logger['error'](_0xf322('0x12'),_0xefc004,_0x505a23[_0xf322('0x10')]['message']);return _0xbcdf7b(_0x505a23[_0xf322('0x10')][_0xf322('0x13')]);}else{logger[_0xf322('0xb')](_0xf322('0x12'),_0xefc004,_0xf322('0xc'));_0xbcdf7b(_0x505a23['result'][_0xf322('0x13')]);}})[_0xf322('0x14')](function(_0x56253f){logger[_0xf322('0x10')](_0xf322('0x12'),_0xefc004,_0x56253f);_0x5460db(_0x56253f);});});}exports['CreateCmHopperFinal']=function(_0x5800ff){var _0x37b853=this;return new Promise(function(_0x5e738a,_0x58b863){return db[_0xf322('0x15')][_0xf322('0x16')](_0x5800ff[_0xf322('0x17')],{'raw':_0x5800ff[_0xf322('0x18')]?_0x5800ff[_0xf322('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7034ff){logger[_0xf322('0xb')](_0xf322('0x19'),_0x5800ff);logger[_0xf322('0xd')](_0xf322('0x19'),_0x5800ff,JSON[_0xf322('0xf')](_0x7034ff));_0x5e738a(_0x7034ff);})[_0xf322('0x14')](function(_0x263aac){logger[_0xf322('0x10')](_0xf322('0x19'),_0x263aac['message'],_0x5800ff);_0x58b863(_0x37b853[_0xf322('0x10')](0x1f4,_0x263aac[_0xf322('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e227df5..60e1170 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 _0x6b87=['post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','put','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x51aee3,_0x30c7e4){var _0x346280=function(_0x456939){while(--_0x456939){_0x51aee3['push'](_0x51aee3['shift']());}};_0x346280(++_0x30c7e4);}(_0x6b87,0x166));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x76b8('0x0'));var util=require(_0x76b8('0x1'));var path=require(_0x76b8('0x2'));var timeout=require(_0x76b8('0x3'));var express=require('express');var router=express[_0x76b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76b8('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x76b8('0x6')]('/',auth[_0x76b8('0x7')](),controller[_0x76b8('0x8')]);router[_0x76b8('0x6')](_0x76b8('0x9'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xa')]);router[_0x76b8('0x6')](_0x76b8('0xb'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xc')]);router[_0x76b8('0x6')](_0x76b8('0xd'),auth[_0x76b8('0x7')](),controller[_0x76b8('0xe')]);router[_0x76b8('0x6')](_0x76b8('0xf'),auth[_0x76b8('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x76b8('0x10')](_0x76b8('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x76b8('0x10')](_0x76b8('0x12'),auth[_0x76b8('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x76b8('0x10')](_0x76b8('0x13'),auth[_0x76b8('0x7')](),controller['checkContactHopper']);router[_0x76b8('0x14')](_0x76b8('0xb'),auth[_0x76b8('0x7')](),controller['update']);module[_0x76b8('0x15')]=router; \ No newline at end of file +var _0x7fa6=['checkContactHopper','put','multer','path','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','describe','/:id','show','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/checkContactHopper'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7fa6,0x189));var _0x67fa=function(_0x339cf5,_0x62e7ef){_0x339cf5=_0x339cf5-0x0;var _0x535dd5=_0x7fa6[_0x339cf5];return _0x535dd5;};'use strict';var multer=require(_0x67fa('0x0'));var util=require('util');var path=require(_0x67fa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x67fa('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x67fa('0x3'));var controller=require(_0x67fa('0x4'));router['get']('/',auth[_0x67fa('0x5')](),controller['index']);router[_0x67fa('0x6')](_0x67fa('0x7'),auth[_0x67fa('0x5')](),controller[_0x67fa('0x8')]);router[_0x67fa('0x6')](_0x67fa('0x9'),auth[_0x67fa('0x5')](),controller[_0x67fa('0xa')]);router[_0x67fa('0x6')]('/voice/queue/countAttributes/:id',auth[_0x67fa('0x5')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x67fa('0x6')](_0x67fa('0xb'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x67fa('0xc')](_0x67fa('0xd'),auth[_0x67fa('0x5')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x67fa('0xc')](_0x67fa('0xe'),auth['isAuthenticated'](),controller[_0x67fa('0xf')]);router[_0x67fa('0x10')](_0x67fa('0x9'),auth[_0x67fa('0x5')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 10de981..c3236f9 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 _0x59cf=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x59cf,0xe7));var _0xf59c=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x59cf[_0x903228];return _0xcec81d;};'use strict';var Sequelize=require(_0xf59c('0x0'));module[_0xf59c('0x1')]={'state':{'type':Sequelize[_0xf59c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf59c('0x3')]},'scheduledat':{'type':Sequelize[_0xf59c('0x4')]},'countbusyretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf59c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf59c('0x3')]},'starttime':{'type':Sequelize[_0xf59c('0x4')]},'responsetime':{'type':Sequelize[_0xf59c('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf59c('0x4')]},'ringtime':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf59c('0x3')]},'amd':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf59c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf59c('0x4')]},'recallme':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf59c('0x4')]},'edited':{'type':Sequelize[_0xf59c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf59c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6cc6=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x5afe4f,_0x1bfa27){var _0x32a023=function(_0x160f46){while(--_0x160f46){_0x5afe4f['push'](_0x5afe4f['shift']());}};_0x32a023(++_0x1bfa27);}(_0x6cc6,0x198));var _0x66cc=function(_0x360352,_0x4e8da8){_0x360352=_0x360352-0x0;var _0xa6c2a9=_0x6cc6[_0x360352];return _0xa6c2a9;};'use strict';var Sequelize=require(_0x66cc('0x0'));module[_0x66cc('0x1')]={'state':{'type':Sequelize[_0x66cc('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x66cc('0x3')]},'countbusyretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x66cc('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x66cc('0x3')]},'responsetime':{'type':Sequelize[_0x66cc('0x3')]},'answertime':{'type':Sequelize[_0x66cc('0x3')]},'droptime':{'type':Sequelize[_0x66cc('0x3')]},'endtime':{'type':Sequelize[_0x66cc('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x66cc('0x4')]},'campaign':{'type':Sequelize[_0x66cc('0x4')]},'campaigntype':{'type':Sequelize[_0x66cc('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x66cc('0x4')]},'amd':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x66cc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x66cc('0x3')]},'recallme':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x66cc('0x3')]},'edited':{'type':Sequelize[_0x66cc('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x66cc('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x66cc('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 362d820..59dc25e 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 _0xd56f=['path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','reject','then','destroy','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','catch','show','includeAll','find','create','body','describe','update','uniqueid','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0xd56f,0x161));var _0xfd56=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xd56f[_0x47242d];return _0x30273a;};'use strict';var pdf=require(_0xfd56('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfd56('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd56('0x2'));var rp=require(_0xfd56('0x3'));var moment=require(_0xfd56('0x4'));var BPromise=require(_0xfd56('0x5'));var Mustache=require(_0xfd56('0x6'));var util=require('util');var path=require(_0xfd56('0x7'));var sox=require(_0xfd56('0x8'));var csv=require('to-csv');var ejs=require(_0xfd56('0x9'));var fs=require('fs');var _=require(_0xfd56('0xa'));var squel=require(_0xfd56('0xb'));var crypto=require(_0xfd56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd56('0xd'));var toCsv=require(_0xfd56('0xe'));var querystring=require(_0xfd56('0xf'));var Papa=require(_0xfd56('0x10'));var Redis=require(_0xfd56('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfd56('0x12'));var as=require(_0xfd56('0x13'));var hardwareService=require(_0xfd56('0x14'));var logger=require(_0xfd56('0x15'))(_0xfd56('0x16'));var utils=require(_0xfd56('0x17'));var config=require(_0xfd56('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4218aa,_0x217852){_0x217852=_0x217852||0xcc;return function(_0x211164){if(_0x211164){return _0x4218aa[_0xfd56('0x19')](_0x217852);}return _0x4218aa[_0xfd56('0x1a')](_0x217852)['end']();};}function respondWithResult(_0x3b72c0,_0x3d8ae1){_0x3d8ae1=_0x3d8ae1||0xc8;return function(_0x1f5bc4){if(_0x1f5bc4){return _0x3b72c0['status'](_0x3d8ae1)[_0xfd56('0x1b')](_0x1f5bc4);}};}function respondWithFilteredResult(_0x1fb205,_0x498ff6){return function(_0x5ad6d6){if(_0x5ad6d6){var _0x16054b=_0x5ad6d6['count'],_0xd28c5f=_0x498ff6[_0xfd56('0x1c')],_0x378b2b=_0x498ff6['offset']+_0x498ff6['limit'],_0x4dcb2e;if(_0x378b2b>=_0x16054b){_0x378b2b=_0x16054b;_0x4dcb2e=0xc8;}else{_0x4dcb2e=0xce;}_0x1fb205['status'](_0x4dcb2e);return _0x1fb205['set']('Content-Range',_0xd28c5f+'-'+_0x378b2b+'/'+_0x16054b)[_0xfd56('0x1b')](_0x5ad6d6);}return null;};}function patchUpdates(_0x5470e8){return function(_0x50fa07){try{jsonpatch['apply'](_0x50fa07,_0x5470e8,!![]);}catch(_0x439003){return BPromise[_0xfd56('0x1d')](_0x439003);}return _0x50fa07['save']();};}function saveUpdates(_0x46fede,_0xcb695d){return function(_0x4e4cbd){if(_0x4e4cbd){return _0x4e4cbd['update'](_0x46fede)[_0xfd56('0x1e')](function(_0x220992){return _0x220992;});}return null;};}function removeEntity(_0x5f20f4,_0x50b076){return function(_0x2240b8){if(_0x2240b8){return _0x2240b8[_0xfd56('0x1f')]()[_0xfd56('0x1e')](function(){_0x5f20f4['status'](0xcc)[_0xfd56('0x20')]();});}};}function handleEntityNotFound(_0x1bdc61,_0x58b6f0){return function(_0x5b0729){if(!_0x5b0729){_0x1bdc61[_0xfd56('0x19')](0x194);}return _0x5b0729;};}function handleError(_0x534323,_0x7f92cf){_0x7f92cf=_0x7f92cf||0x1f4;return function(_0x32a08b){logger[_0xfd56('0x21')](_0x32a08b[_0xfd56('0x22')]);if(_0x32a08b[_0xfd56('0x23')]){delete _0x32a08b[_0xfd56('0x23')];}_0x534323[_0xfd56('0x1a')](_0x7f92cf)['send'](_0x32a08b);};}exports[_0xfd56('0x24')]=function(_0x3acaa0,_0x34b2e9){var _0x3111e2={},_0x49edca={},_0xfce12={'count':0x0,'rows':[]};var _0x370e64=_[_0xfd56('0x25')](db[_0xfd56('0x26')][_0xfd56('0x27')],function(_0x3bc01e){return{'name':_0x3bc01e[_0xfd56('0x28')],'type':_0x3bc01e[_0xfd56('0x29')][_0xfd56('0x2a')]};});_0x49edca[_0xfd56('0x2b')]=_[_0xfd56('0x25')](_0x370e64,_0xfd56('0x23'));_0x49edca[_0xfd56('0x2c')]=_[_0xfd56('0x2d')](_0x3acaa0[_0xfd56('0x2c')]);_0x49edca[_0xfd56('0x2e')]=_[_0xfd56('0x2f')](_0x49edca[_0xfd56('0x2b')],_0x49edca[_0xfd56('0x2c')]);_0x3111e2[_0xfd56('0x30')]=_[_0xfd56('0x2f')](_0x49edca[_0xfd56('0x2b')],qs[_0xfd56('0x31')](_0x3acaa0['query'][_0xfd56('0x31')]));_0x3111e2[_0xfd56('0x30')]=_0x3111e2[_0xfd56('0x30')]['length']?_0x3111e2[_0xfd56('0x30')]:_0x49edca[_0xfd56('0x2b')];if(!_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x32')](_0xfd56('0x33'))){_0x3111e2[_0xfd56('0x34')]=qs['limit'](_0x3acaa0['query'][_0xfd56('0x34')]);_0x3111e2[_0xfd56('0x1c')]=qs[_0xfd56('0x1c')](_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x1c')]);}_0x3111e2[_0xfd56('0x35')]=qs[_0xfd56('0x36')](_0x3acaa0['query']['sort']);_0x3111e2[_0xfd56('0x37')]=qs['filters'](_[_0xfd56('0x38')](_0x3acaa0['query'],_0x49edca[_0xfd56('0x2e')]),_0x370e64);if(_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x39')]){_0x3111e2['where']=_[_0xfd56('0x3a')](_0x3111e2[_0xfd56('0x37')],{'$or':_[_0xfd56('0x25')](_0x370e64,function(_0x4c6a5f){if(_0x4c6a5f[_0xfd56('0x29')]!==_0xfd56('0x3b')){var _0x4a9dac={};_0x4a9dac[_0x4c6a5f['name']]={'$like':'%'+_0x3acaa0[_0xfd56('0x2c')][_0xfd56('0x39')]+'%'};return _0x4a9dac;}})});}_0x3111e2=_[_0xfd56('0x3a')]({},_0x3111e2,_0x3acaa0[_0xfd56('0x3c')]);var _0x1603d8={'where':_0x3111e2[_0xfd56('0x37')]};return db['CmHopperHistory'][_0xfd56('0x3d')](_0x1603d8)[_0xfd56('0x1e')](function(_0x240cba){_0xfce12[_0xfd56('0x3d')]=_0x240cba;if(_0x3acaa0[_0xfd56('0x2c')]['includeAll']){_0x3111e2['include']=[{'all':!![]}];}return db[_0xfd56('0x26')][_0xfd56('0x3e')](_0x3111e2);})[_0xfd56('0x1e')](function(_0x50ed59){_0xfce12['rows']=_0x50ed59;return _0xfce12;})['then'](respondWithFilteredResult(_0x34b2e9,_0x3111e2))[_0xfd56('0x3f')](handleError(_0x34b2e9,null));};exports[_0xfd56('0x40')]=function(_0x19d19b,_0x23f236){var _0xa623c7={'raw':!![],'where':{'id':_0x19d19b['params']['id']}},_0x2a3a3c={};_0x2a3a3c[_0xfd56('0x2b')]=_[_0xfd56('0x2d')](db[_0xfd56('0x26')][_0xfd56('0x27')]);_0x2a3a3c[_0xfd56('0x2c')]=_[_0xfd56('0x2d')](_0x19d19b[_0xfd56('0x2c')]);_0x2a3a3c['filters']=_['intersection'](_0x2a3a3c[_0xfd56('0x2b')],_0x2a3a3c[_0xfd56('0x2c')]);_0xa623c7[_0xfd56('0x30')]=_['intersection'](_0x2a3a3c[_0xfd56('0x2b')],qs[_0xfd56('0x31')](_0x19d19b[_0xfd56('0x2c')][_0xfd56('0x31')]));_0xa623c7[_0xfd56('0x30')]=_0xa623c7['attributes']['length']?_0xa623c7[_0xfd56('0x30')]:_0x2a3a3c[_0xfd56('0x2b')];if(_0x19d19b[_0xfd56('0x2c')][_0xfd56('0x41')]){_0xa623c7['include']=[{'all':!![]}];}_0xa623c7=_[_0xfd56('0x3a')]({},_0xa623c7,_0x19d19b[_0xfd56('0x3c')]);return db[_0xfd56('0x26')][_0xfd56('0x42')](_0xa623c7)['then'](handleEntityNotFound(_0x23f236,null))[_0xfd56('0x1e')](respondWithResult(_0x23f236,null))[_0xfd56('0x3f')](handleError(_0x23f236,null));};exports[_0xfd56('0x43')]=function(_0x90b1b0,_0x1a9ebe){return db['CmHopperHistory'][_0xfd56('0x43')](_0x90b1b0[_0xfd56('0x44')],{})[_0xfd56('0x1e')](respondWithResult(_0x1a9ebe,0xc9))[_0xfd56('0x3f')](handleError(_0x1a9ebe,null));};exports[_0xfd56('0x45')]=function(_0x5f3229,_0x1eefe5){return db[_0xfd56('0x26')][_0xfd56('0x45')]()['then'](respondWithResult(_0x1eefe5,null))[_0xfd56('0x3f')](handleError(_0x1eefe5,null));};exports[_0xfd56('0x46')]=function(_0x57f735,_0x5aa0ab){if(_0x57f735['body'][_0xfd56('0x47')]){delete _0x57f735['body']['uniqueid'];}return db[_0xfd56('0x26')][_0xfd56('0x42')]({'where':{'uniqueid':_0x57f735['params']['id']}})[_0xfd56('0x1e')](handleEntityNotFound(_0x5aa0ab,null))['then'](saveUpdates(_0x57f735[_0xfd56('0x44')],null))[_0xfd56('0x1e')](respondWithResult(_0x5aa0ab,null))[_0xfd56('0x3f')](handleError(_0x5aa0ab,null));}; \ No newline at end of file +var _0x5cf6=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','describe','uniqueid','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','filter'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5cf6,0x1df));var _0x65cf=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5cf6[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x65cf('0x0'));var emlformat=require(_0x65cf('0x1'));var rimraf=require(_0x65cf('0x2'));var zipdir=require(_0x65cf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65cf('0x4'));var moment=require(_0x65cf('0x5'));var BPromise=require(_0x65cf('0x6'));var Mustache=require('mustache');var util=require(_0x65cf('0x7'));var path=require(_0x65cf('0x8'));var sox=require(_0x65cf('0x9'));var csv=require(_0x65cf('0xa'));var ejs=require(_0x65cf('0xb'));var fs=require('fs');var _=require(_0x65cf('0xc'));var squel=require(_0x65cf('0xd'));var crypto=require(_0x65cf('0xe'));var jsforce=require(_0x65cf('0xf'));var deskjs=require(_0x65cf('0x10'));var toCsv=require(_0x65cf('0xa'));var querystring=require(_0x65cf('0x11'));var Papa=require(_0x65cf('0x12'));var Redis=require('ioredis');var authService=require(_0x65cf('0x13'));var qs=require(_0x65cf('0x14'));var as=require(_0x65cf('0x15'));var hardwareService=require(_0x65cf('0x16'));var logger=require(_0x65cf('0x17'))('api');var utils=require(_0x65cf('0x18'));var config=require(_0x65cf('0x19'));var db=require(_0x65cf('0x1a'))['db'];function respondWithStatusCode(_0x563453,_0x288f81){_0x288f81=_0x288f81||0xcc;return function(_0x26151a){if(_0x26151a){return _0x563453[_0x65cf('0x1b')](_0x288f81);}return _0x563453[_0x65cf('0x1c')](_0x288f81)[_0x65cf('0x1d')]();};}function respondWithResult(_0x4f9e37,_0x6571f7){_0x6571f7=_0x6571f7||0xc8;return function(_0x247996){if(_0x247996){return _0x4f9e37[_0x65cf('0x1c')](_0x6571f7)['json'](_0x247996);}};}function respondWithFilteredResult(_0x423c98,_0xb2e89a){return function(_0x3e32c1){if(_0x3e32c1){var _0x5b61d2=_0x3e32c1[_0x65cf('0x1e')],_0x45a35a=_0xb2e89a['offset'],_0x281346=_0xb2e89a['offset']+_0xb2e89a[_0x65cf('0x1f')],_0x869f83;if(_0x281346>=_0x5b61d2){_0x281346=_0x5b61d2;_0x869f83=0xc8;}else{_0x869f83=0xce;}_0x423c98[_0x65cf('0x1c')](_0x869f83);return _0x423c98[_0x65cf('0x20')](_0x65cf('0x21'),_0x45a35a+'-'+_0x281346+'/'+_0x5b61d2)['json'](_0x3e32c1);}return null;};}function patchUpdates(_0x1e5f2f){return function(_0x275a5e){try{jsonpatch[_0x65cf('0x22')](_0x275a5e,_0x1e5f2f,!![]);}catch(_0x203cd9){return BPromise[_0x65cf('0x23')](_0x203cd9);}return _0x275a5e['save']();};}function saveUpdates(_0x5826a7,_0x26635f){return function(_0xa14773){if(_0xa14773){return _0xa14773[_0x65cf('0x24')](_0x5826a7)['then'](function(_0xa9b146){return _0xa9b146;});}return null;};}function removeEntity(_0x57fe4b,_0x1cf691){return function(_0x5e978f){if(_0x5e978f){return _0x5e978f[_0x65cf('0x25')]()[_0x65cf('0x26')](function(){_0x57fe4b[_0x65cf('0x1c')](0xcc)[_0x65cf('0x1d')]();});}};}function handleEntityNotFound(_0x1f41ec,_0x28485b){return function(_0x5c97c5){if(!_0x5c97c5){_0x1f41ec['sendStatus'](0x194);}return _0x5c97c5;};}function handleError(_0x1c1a39,_0x3c1c8d){_0x3c1c8d=_0x3c1c8d||0x1f4;return function(_0x113c67){logger['error'](_0x113c67[_0x65cf('0x27')]);if(_0x113c67[_0x65cf('0x28')]){delete _0x113c67[_0x65cf('0x28')];}_0x1c1a39[_0x65cf('0x1c')](_0x3c1c8d)[_0x65cf('0x29')](_0x113c67);};}exports[_0x65cf('0x2a')]=function(_0x262ed8,_0x4c1d2f){var _0xf240d5={},_0x5da90b={},_0x361683={'count':0x0,'rows':[]};var _0x225db7=_[_0x65cf('0x2b')](db[_0x65cf('0x2c')][_0x65cf('0x2d')],function(_0x54b2fa){return{'name':_0x54b2fa['fieldName'],'type':_0x54b2fa[_0x65cf('0x2e')][_0x65cf('0x2f')]};});_0x5da90b['model']=_[_0x65cf('0x2b')](_0x225db7,_0x65cf('0x28'));_0x5da90b[_0x65cf('0x30')]=_['keys'](_0x262ed8['query']);_0x5da90b[_0x65cf('0x31')]=_[_0x65cf('0x32')](_0x5da90b[_0x65cf('0x33')],_0x5da90b[_0x65cf('0x30')]);_0xf240d5[_0x65cf('0x34')]=_[_0x65cf('0x32')](_0x5da90b[_0x65cf('0x33')],qs[_0x65cf('0x35')](_0x262ed8[_0x65cf('0x30')][_0x65cf('0x35')]));_0xf240d5[_0x65cf('0x34')]=_0xf240d5[_0x65cf('0x34')]['length']?_0xf240d5['attributes']:_0x5da90b[_0x65cf('0x33')];if(!_0x262ed8['query'][_0x65cf('0x36')](_0x65cf('0x37'))){_0xf240d5[_0x65cf('0x1f')]=qs[_0x65cf('0x1f')](_0x262ed8[_0x65cf('0x30')][_0x65cf('0x1f')]);_0xf240d5[_0x65cf('0x38')]=qs[_0x65cf('0x38')](_0x262ed8[_0x65cf('0x30')]['offset']);}_0xf240d5[_0x65cf('0x39')]=qs[_0x65cf('0x3a')](_0x262ed8['query'][_0x65cf('0x3a')]);_0xf240d5['where']=qs[_0x65cf('0x31')](_['pick'](_0x262ed8['query'],_0x5da90b[_0x65cf('0x31')]),_0x225db7);if(_0x262ed8['query'][_0x65cf('0x3b')]){_0xf240d5[_0x65cf('0x3c')]=_[_0x65cf('0x3d')](_0xf240d5[_0x65cf('0x3c')],{'$or':_[_0x65cf('0x2b')](_0x225db7,function(_0x4be09b){if(_0x4be09b[_0x65cf('0x2e')]!==_0x65cf('0x3e')){var _0x3af7c3={};_0x3af7c3[_0x4be09b[_0x65cf('0x28')]]={'$like':'%'+_0x262ed8['query'][_0x65cf('0x3b')]+'%'};return _0x3af7c3;}})});}_0xf240d5=_['merge']({},_0xf240d5,_0x262ed8[_0x65cf('0x3f')]);var _0x1ff245={'where':_0xf240d5[_0x65cf('0x3c')]};return db['CmHopperHistory'][_0x65cf('0x1e')](_0x1ff245)[_0x65cf('0x26')](function(_0x2b7a14){_0x361683[_0x65cf('0x1e')]=_0x2b7a14;if(_0x262ed8['query'][_0x65cf('0x40')]){_0xf240d5[_0x65cf('0x41')]=[{'all':!![]}];}return db[_0x65cf('0x2c')][_0x65cf('0x42')](_0xf240d5);})['then'](function(_0x459f19){_0x361683[_0x65cf('0x43')]=_0x459f19;return _0x361683;})[_0x65cf('0x26')](respondWithFilteredResult(_0x4c1d2f,_0xf240d5))[_0x65cf('0x44')](handleError(_0x4c1d2f,null));};exports['show']=function(_0x342d9f,_0x25113e){var _0x470967={'raw':!![],'where':{'id':_0x342d9f['params']['id']}},_0xac7ad0={};_0xac7ad0[_0x65cf('0x33')]=_['keys'](db[_0x65cf('0x2c')][_0x65cf('0x2d')]);_0xac7ad0['query']=_[_0x65cf('0x45')](_0x342d9f[_0x65cf('0x30')]);_0xac7ad0[_0x65cf('0x31')]=_[_0x65cf('0x32')](_0xac7ad0['model'],_0xac7ad0['query']);_0x470967[_0x65cf('0x34')]=_[_0x65cf('0x32')](_0xac7ad0[_0x65cf('0x33')],qs[_0x65cf('0x35')](_0x342d9f[_0x65cf('0x30')][_0x65cf('0x35')]));_0x470967[_0x65cf('0x34')]=_0x470967[_0x65cf('0x34')][_0x65cf('0x46')]?_0x470967[_0x65cf('0x34')]:_0xac7ad0['model'];if(_0x342d9f[_0x65cf('0x30')]['includeAll']){_0x470967[_0x65cf('0x41')]=[{'all':!![]}];}_0x470967=_[_0x65cf('0x3d')]({},_0x470967,_0x342d9f['options']);return db[_0x65cf('0x2c')][_0x65cf('0x47')](_0x470967)[_0x65cf('0x26')](handleEntityNotFound(_0x25113e,null))['then'](respondWithResult(_0x25113e,null))[_0x65cf('0x44')](handleError(_0x25113e,null));};exports[_0x65cf('0x48')]=function(_0x32a63e,_0x15c795){return db[_0x65cf('0x2c')][_0x65cf('0x48')](_0x32a63e[_0x65cf('0x49')],{})[_0x65cf('0x26')](respondWithResult(_0x15c795,0xc9))['catch'](handleError(_0x15c795,null));};exports[_0x65cf('0x4a')]=function(_0x20bd6d,_0x2ba7bd){return db['CmHopperHistory'][_0x65cf('0x4a')]()['then'](respondWithResult(_0x2ba7bd,null))[_0x65cf('0x44')](handleError(_0x2ba7bd,null));};exports[_0x65cf('0x24')]=function(_0x8ef5d7,_0x4a728c){if(_0x8ef5d7[_0x65cf('0x49')]['uniqueid']){delete _0x8ef5d7['body'][_0x65cf('0x4b')];}return db[_0x65cf('0x2c')]['find']({'where':{'uniqueid':_0x8ef5d7[_0x65cf('0x4c')]['id']}})[_0x65cf('0x26')](handleEntityNotFound(_0x4a728c,null))[_0x65cf('0x26')](saveUpdates(_0x8ef5d7[_0x65cf('0x49')],null))['then'](respondWithResult(_0x4a728c,null))[_0x65cf('0x44')](handleError(_0x4a728c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 25539c3..a336449 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 _0x13ca=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','endtime'];(function(_0x3fd64f,_0x57c478){var _0x2d1ca2=function(_0x28e5ff){while(--_0x28e5ff){_0x3fd64f['push'](_0x3fd64f['shift']());}};_0x2d1ca2(++_0x57c478);}(_0x13ca,0x9d));var _0xa13c=function(_0x95c262,_0x2843cd){_0x95c262=_0x95c262-0x0;var _0x2dc3cb=_0x13ca[_0x95c262];return _0x2dc3cb;};'use strict';var _=require(_0xa13c('0x0'));var util=require(_0xa13c('0x1'));var logger=require('../../config/logger')(_0xa13c('0x2'));var moment=require(_0xa13c('0x3'));var BPromise=require(_0xa13c('0x4'));var rp=require(_0xa13c('0x5'));var fs=require('fs');var path=require(_0xa13c('0x6'));var rimraf=require(_0xa13c('0x7'));var config=require(_0xa13c('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xa13c('0x9')]=function(_0x2b5f11,_0x43756f){return _0x2b5f11[_0xa13c('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xa13c('0xb'),'fields':[_0xa13c('0xb')]},{'name':_0xa13c('0xc'),'fields':[_0xa13c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd537=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','api','bluebird','path','rimraf'];(function(_0x6e4fa0,_0x5eebd1){var _0x347582=function(_0x1d9dd1){while(--_0x1d9dd1){_0x6e4fa0['push'](_0x6e4fa0['shift']());}};_0x347582(++_0x5eebd1);}(_0xd537,0x103));var _0x7d53=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xd537[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x7d53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d53('0x1'));var moment=require('moment');var BPromise=require(_0x7d53('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d53('0x3'));var rimraf=require(_0x7d53('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d53('0x5'));module[_0x7d53('0x6')]=function(_0x33e6ea,_0x2f974f){return _0x33e6ea[_0x7d53('0x7')](_0x7d53('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x7d53('0x9'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x7d53('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index af178ae..b750ee8 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 _0x5eb8=['raw','then','CreateCmHopperHistory','stringify','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopperHistory','create','body','options'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5222d9,_0x12496d){_0x5222d9=_0x5222d9-0x0;var _0x16b0d5=_0x5eb8[_0x5222d9];return _0x16b0d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateCmHopperHistory']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateCmHopperHistory',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});};exports[_0x85eb('0x1d')]=function(_0x1426c8){var _0x3f7a4d=this;return new Promise(function(_0x28b87d,_0x312b3e){return db[_0x85eb('0x15')]['findAll']({'raw':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![],'where':_0x1426c8[_0x85eb('0x18')]?_0x1426c8[_0x85eb('0x18')]['where']||null:null,'attributes':[[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')][_0x85eb('0x20')]('id')),_0x85eb('0x21')],[db[_0x85eb('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x24')))),_0x85eb('0x25')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x26'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x27')))),_0x85eb('0x28')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x26'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x29')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x340745){logger[_0x85eb('0xd')](_0x85eb('0x1d'),_0x1426c8);logger[_0x85eb('0x10')](_0x85eb('0x1d'),_0x1426c8,JSON[_0x85eb('0x1c')](_0x340745));_0x28b87d(_0x340745);})[_0x85eb('0x14')](function(_0x35f092){logger[_0x85eb('0x12')](_0x85eb('0x1d'),_0x35f092[_0x85eb('0x13')],_0x1426c8);_0x312b3e(_0x3f7a4d[_0x85eb('0x12')](0x1f4,_0x35f092[_0x85eb('0x13')]));});});};exports[_0x85eb('0x2a')]=function(_0x4b69a7){var _0x4361e2=this;return new Promise(function(_0x3dfe74,_0x58f091){return db['CmHopperHistory'][_0x85eb('0x2b')]({'raw':_0x4b69a7[_0x85eb('0x18')]?_0x4b69a7['options'][_0x85eb('0x19')]===undefined?!![]:![]:!![],'where':_0x4b69a7['options']?_0x4b69a7[_0x85eb('0x18')]['where']||null:null,'attributes':[[_0x85eb('0x2c'),'name'],[db[_0x85eb('0x1e')]['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x2d')))),'outboundNoSuchCallsDay'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db['sequelize']['fn']('IF',db[_0x85eb('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x85eb('0x2e')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x85eb('0x22')))),_0x85eb('0x2f')],[db['sequelize']['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x30')))),_0x85eb('0x31')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x32')))),_0x85eb('0x33')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x36')))),_0x85eb('0x37')],[db[_0x85eb('0x1e')]['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x38')))),_0x85eb('0x39')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x3a')))),_0x85eb('0x3b')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal'](_0x85eb('0x3c')))),_0x85eb('0x3d')],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x3e')))),_0x85eb('0x3f')],[db['sequelize']['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x85eb('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x85eb('0x1e')]['fn']('IF',db['sequelize'][_0x85eb('0x23')](_0x85eb('0x40')))),'outboundReCallsDay']],'group':['campaign']})[_0x85eb('0x1a')](function(_0x249511){logger[_0x85eb('0xd')](_0x85eb('0x2a'),_0x4b69a7);logger[_0x85eb('0x10')]('GetVoiceQueueHopperHistory',_0x4b69a7,JSON[_0x85eb('0x1c')](_0x249511));_0x3dfe74(_0x249511);})[_0x85eb('0x14')](function(_0x270bb2){logger[_0x85eb('0x12')](_0x85eb('0x2a'),_0x270bb2['message'],_0x4b69a7);_0x58f091(_0x4361e2[_0x85eb('0x12')](0x1f4,_0x270bb2['message']));});});};exports[_0x85eb('0x41')]=function(_0x40d846){var _0x4ee529=this;return new Promise(function(_0x341ddb,_0xd04f24){return db[_0x85eb('0x15')][_0x85eb('0x2b')]({'raw':_0x40d846[_0x85eb('0x18')]?_0x40d846[_0x85eb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40d846[_0x85eb('0x18')]?_0x40d846['options'][_0x85eb('0x42')]||null:null,'attributes':[[_0x85eb('0x2c'),'name'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db['sequelize'][_0x85eb('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x85eb('0x1e')]['fn'](_0x85eb('0x1f'),db[_0x85eb('0x1e')]['fn']('IF',db[_0x85eb('0x1e')][_0x85eb('0x23')](_0x85eb('0x22')))),'ivrAnswerCallsDay']],'group':[_0x85eb('0x2c')]})[_0x85eb('0x1a')](function(_0x1d3204){logger[_0x85eb('0xd')](_0x85eb('0x41'),_0x40d846);logger[_0x85eb('0x10')](_0x85eb('0x41'),_0x40d846,JSON[_0x85eb('0x1c')](_0x1d3204));_0x341ddb(_0x1d3204);})[_0x85eb('0x14')](function(_0x13cc2a){logger[_0x85eb('0x12')]('GetCampaignHopperHistory',_0x13cc2a[_0x85eb('0x13')],_0x40d846);_0xd04f24(_0x4ee529[_0x85eb('0x12')](0x1f4,_0x13cc2a[_0x85eb('0x13')]));});});}; \ No newline at end of file +var _0x34b7=['stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','name','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x34b7,0x196));var _0x734b=function(_0x533ca6,_0x4ed3fb){_0x533ca6=_0x533ca6-0x0;var _0x34f0bd=_0x34b7[_0x533ca6];return _0x34f0bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateCmHopperHistory',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x46d432['options']?_0x46d432['options'][_0x734b('0x1e')]||null:null,'attributes':[[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')][_0x734b('0x20')]('id')),_0x734b('0x21')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x23')))),_0x734b('0x24')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x26')))),_0x734b('0x27')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x28')))),_0x734b('0x29')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2b')))),_0x734b('0x2c')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0x734b('0x1b')](function(_0x5e2444){logger[_0x734b('0xa')](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x5e2444));_0x26eccf(_0x5e2444);})[_0x734b('0x14')](function(_0x55bd2e){logger['error'](_0x734b('0x1c'),_0x55bd2e['message'],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x55bd2e['message']));});});};exports[_0x734b('0x2e')]=function(_0x4b30eb){var _0x1875f1=this;return new Promise(function(_0x5ea4a0,_0x37d891){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb['options'][_0x734b('0x1e')]||null:null,'attributes':[[_0x734b('0x2f'),'name'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x30')))),_0x734b('0x31')],[db['sequelize']['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x32')))),_0x734b('0x33')],[db[_0x734b('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x34')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x35')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x36')))),'outboundCongestionCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x734b('0x37')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x734b('0x38')],[db['sequelize']['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x39')))),_0x734b('0x3a')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x3b')))),_0x734b('0x3c')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x734b('0x3d')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x3e')))),'outboundRejectCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x3f')))),_0x734b('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0x734b('0x41')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x734b('0x42')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0xe605be){logger['info'](_0x734b('0x2e'),_0x4b30eb);logger[_0x734b('0xc')](_0x734b('0x2e'),_0x4b30eb,JSON[_0x734b('0xe')](_0xe605be));_0x5ea4a0(_0xe605be);})['catch'](function(_0x27f0ff){logger['error'](_0x734b('0x2e'),_0x27f0ff[_0x734b('0x12')],_0x4b30eb);_0x37d891(_0x1875f1[_0x734b('0xf')](0x1f4,_0x27f0ff[_0x734b('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x2b9da7){var _0x1af382=this;return new Promise(function(_0x5b9adc,_0x541e70){return db[_0x734b('0x16')]['findAll']({'raw':_0x2b9da7[_0x734b('0x19')]?_0x2b9da7[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b9da7['options']?_0x2b9da7[_0x734b('0x19')]['where']||null:null,'attributes':[[_0x734b('0x2f'),_0x734b('0x43')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db['sequelize'][_0x734b('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x44')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0x257a87){logger['info'](_0x734b('0x45'),_0x2b9da7);logger['debug'](_0x734b('0x45'),_0x2b9da7,JSON[_0x734b('0xe')](_0x257a87));_0x5b9adc(_0x257a87);})[_0x734b('0x14')](function(_0x4dbff2){logger[_0x734b('0xf')](_0x734b('0x45'),_0x4dbff2[_0x734b('0x12')],_0x2b9da7);_0x541e70(_0x1af382[_0x734b('0xf')](0x1f4,_0x4dbff2[_0x734b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4d04ec9..01ff43a 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 _0xdb3e=['update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x5a3718,_0x50ee3b){var _0x132206=function(_0x4c0ac4){while(--_0x4c0ac4){_0x5a3718['push'](_0x5a3718['shift']());}};_0x132206(++_0x50ee3b);}(_0xdb3e,0x1e2));var _0xedb3=function(_0x2e62a6,_0x3206a1){_0x2e62a6=_0x2e62a6-0x0;var _0x541d90=_0xdb3e[_0x2e62a6];return _0x541d90;};'use strict';var multer=require('multer');var util=require(_0xedb3('0x0'));var path=require('path');var timeout=require(_0xedb3('0x1'));var express=require(_0xedb3('0x2'));var router=express[_0xedb3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xedb3('0x4'));var config=require(_0xedb3('0x5'));var controller=require(_0xedb3('0x6'));router[_0xedb3('0x7')]('/',auth[_0xedb3('0x8')](),controller[_0xedb3('0x9')]);router[_0xedb3('0x7')](_0xedb3('0xa'),auth[_0xedb3('0x8')](),controller['describe']);router['get'](_0xedb3('0xb'),auth[_0xedb3('0x8')](),controller['show']);router[_0xedb3('0xc')]('/',auth[_0xedb3('0x8')](),controller[_0xedb3('0xd')]);router['put'](_0xedb3('0xb'),auth[_0xedb3('0x8')](),controller[_0xedb3('0xe')]);module[_0xedb3('0xf')]=router; \ No newline at end of file +var _0x694d=['/:id','post','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./cmHopperHistory.controller','isAuthenticated','index','get','/describe'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x694d,0x16c));var _0xd694=function(_0x3d98fc,_0x3430b5){_0x3d98fc=_0x3d98fc-0x0;var _0x1bb912=_0x694d[_0x3d98fc];return _0x1bb912;};'use strict';var multer=require(_0xd694('0x0'));var util=require(_0xd694('0x1'));var path=require(_0xd694('0x2'));var timeout=require(_0xd694('0x3'));var express=require('express');var router=express[_0xd694('0x4')]();var auth=require(_0xd694('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd694('0x6'));router['get']('/',auth[_0xd694('0x7')](),controller[_0xd694('0x8')]);router[_0xd694('0x9')](_0xd694('0xa'),auth[_0xd694('0x7')](),controller['describe']);router[_0xd694('0x9')](_0xd694('0xb'),auth[_0xd694('0x7')](),controller['show']);router[_0xd694('0xc')]('/',auth[_0xd694('0x7')](),controller['create']);router['put'](_0xd694('0xb'),auth[_0xd694('0x7')](),controller[_0xd694('0xd')]);module[_0xd694('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index aad8aff..5393a33 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 _0x3b27=['name','sequelize','exports','STRING'];(function(_0x48f2e3,_0x4c8fef){var _0x106263=function(_0x1432d8){while(--_0x1432d8){_0x48f2e3['push'](_0x48f2e3['shift']());}};_0x106263(++_0x4c8fef);}(_0x3b27,0xd1));var _0x73b2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x3b27[_0x556927];return _0x5f1235;};'use strict';var Sequelize=require(_0x73b2('0x0'));module[_0x73b2('0x1')]={'name':{'type':Sequelize[_0x73b2('0x2')],'unique':_0x73b2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x73b2('0x2')]},'dialPrefix':{'type':Sequelize[_0x73b2('0x2')]}}; \ No newline at end of file +var _0xdb92=['STRING','name','sequelize','exports'];(function(_0x1bd588,_0x3d22e9){var _0x2e3666=function(_0x4b8694){while(--_0x4b8694){_0x1bd588['push'](_0x1bd588['shift']());}};_0x2e3666(++_0x3d22e9);}(_0xdb92,0x96));var _0x2db9=function(_0x117640,_0x4ac313){_0x117640=_0x117640-0x0;var _0x1f4000=_0xdb92[_0x117640];return _0x1f4000;};'use strict';var Sequelize=require(_0x2db9('0x0'));module[_0x2db9('0x1')]={'name':{'type':Sequelize[_0x2db9('0x2')],'unique':_0x2db9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2db9('0x2')]},'dialPrefix':{'type':Sequelize[_0x2db9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 55e9b93..b6f71db 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 _0x1ab8=['json','count','offset','set','then','get','Lists','destroy','error','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','update','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','tags','isArray','join','each','CmContact','omit','success','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','options','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','addCustomField','Sequelize','TEXT','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status'];(function(_0x4c808f,_0x574779){var _0x4ff320=function(_0x4e2b0a){while(--_0x4e2b0a){_0x4c808f['push'](_0x4c808f['shift']());}};_0x4ff320(++_0x574779);}(_0x1ab8,0x17b));var _0x81ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1ab8[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81ab('0x1'));var jsonpatch=require(_0x81ab('0x2'));var rp=require(_0x81ab('0x3'));var moment=require(_0x81ab('0x4'));var BPromise=require(_0x81ab('0x5'));var Mustache=require(_0x81ab('0x6'));var util=require('util');var path=require(_0x81ab('0x7'));var sox=require(_0x81ab('0x8'));var csv=require(_0x81ab('0x9'));var ejs=require(_0x81ab('0xa'));var fs=require('fs');var _=require(_0x81ab('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81ab('0xc'));var toCsv=require(_0x81ab('0x9'));var querystring=require(_0x81ab('0xd'));var Papa=require(_0x81ab('0xe'));var Redis=require(_0x81ab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x81ab('0x10'));var as=require(_0x81ab('0x11'));var hardwareService=require(_0x81ab('0x12'));var logger=require(_0x81ab('0x13'))('api');var utils=require(_0x81ab('0x14'));var config=require(_0x81ab('0x15'));var db=require(_0x81ab('0x16'))['db'];config['redis']=_['defaults'](config[_0x81ab('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x81ab('0x18'))(new Redis(config[_0x81ab('0x17')]));require('./cmList.socket')[_0x81ab('0x19')](socket);function respondWithStatusCode(_0x2a62c1,_0x333924){_0x333924=_0x333924||0xcc;return function(_0x4b83d0){if(_0x4b83d0){return _0x2a62c1[_0x81ab('0x1a')](_0x333924);}return _0x2a62c1['status'](_0x333924)[_0x81ab('0x1b')]();};}function respondWithResult(_0x5128dc,_0x4af848){_0x4af848=_0x4af848||0xc8;return function(_0x511b3c){if(_0x511b3c){return _0x5128dc[_0x81ab('0x1c')](_0x4af848)[_0x81ab('0x1d')](_0x511b3c);}};}function respondWithFilteredResult(_0x5575f2,_0x1d7bf9){return function(_0x164cdd){if(_0x164cdd){var _0x18fe28=_0x164cdd[_0x81ab('0x1e')],_0x3ad441=_0x1d7bf9['offset'],_0x22581a=_0x1d7bf9[_0x81ab('0x1f')]+_0x1d7bf9['limit'],_0x8d0282;if(_0x22581a>=_0x18fe28){_0x22581a=_0x18fe28;_0x8d0282=0xc8;}else{_0x8d0282=0xce;}_0x5575f2[_0x81ab('0x1c')](_0x8d0282);return _0x5575f2[_0x81ab('0x20')]('Content-Range',_0x3ad441+'-'+_0x22581a+'/'+_0x18fe28)[_0x81ab('0x1d')](_0x164cdd);}return null;};}function patchUpdates(_0x51e82a){return function(_0x58ae14){try{jsonpatch['apply'](_0x58ae14,_0x51e82a,!![]);}catch(_0x16f6a1){return BPromise['reject'](_0x16f6a1);}return _0x58ae14['save']();};}function saveUpdates(_0x3b11a0,_0x1c9426){return function(_0x1a4b28){if(_0x1a4b28){return _0x1a4b28['update'](_0x3b11a0)[_0x81ab('0x21')](function(_0x271f7d){return _0x271f7d;});}return null;};}function removeEntity(_0x7ef796,_0x387d48){return function(_0x673315){if(_0x673315){return _0x673315['destroy']()[_0x81ab('0x21')](function(){var _0x513e92=_0x673315[_0x81ab('0x22')]({'plain':!![]});var _0x3cdb97=_0x81ab('0x23');return db['UserProfileResource'][_0x81ab('0x24')]({'where':{'type':_0x3cdb97,'resourceId':_0x513e92['id']}})[_0x81ab('0x21')](function(){return _0x673315;});})['then'](function(){_0x7ef796[_0x81ab('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb6286,_0x54d7e3){return function(_0x305871){if(!_0x305871){_0xdb6286['sendStatus'](0x194);}return _0x305871;};}function handleError(_0x2904c2,_0x35533b){_0x35533b=_0x35533b||0x1f4;return function(_0x3caf6f){logger[_0x81ab('0x25')](_0x3caf6f['stack']);if(_0x3caf6f[_0x81ab('0x26')]){delete _0x3caf6f[_0x81ab('0x26')];}_0x2904c2[_0x81ab('0x1c')](_0x35533b)[_0x81ab('0x27')](_0x3caf6f);};}exports[_0x81ab('0x28')]=function(_0x340237,_0x95a250){var _0x2e157c={},_0xa541b4={},_0x4ce780={'count':0x0,'rows':[]};var _0x54c391=_[_0x81ab('0x29')](db[_0x81ab('0x2a')][_0x81ab('0x2b')],function(_0x25f6bf){return{'name':_0x25f6bf[_0x81ab('0x2c')],'type':_0x25f6bf['type'][_0x81ab('0x2d')]};});_0xa541b4[_0x81ab('0x2e')]=_['map'](_0x54c391,'name');_0xa541b4[_0x81ab('0x2f')]=_['keys'](_0x340237[_0x81ab('0x2f')]);_0xa541b4[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0xa541b4[_0x81ab('0x2e')],_0xa541b4[_0x81ab('0x2f')]);_0x2e157c[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0xa541b4['model'],qs[_0x81ab('0x33')](_0x340237[_0x81ab('0x2f')]['fields']));_0x2e157c['attributes']=_0x2e157c[_0x81ab('0x32')][_0x81ab('0x34')]?_0x2e157c[_0x81ab('0x32')]:_0xa541b4[_0x81ab('0x2e')];if(!_0x340237[_0x81ab('0x2f')][_0x81ab('0x35')](_0x81ab('0x36'))){_0x2e157c[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0x340237['query']['limit']);_0x2e157c['offset']=qs[_0x81ab('0x1f')](_0x340237[_0x81ab('0x2f')][_0x81ab('0x1f')]);}_0x2e157c[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x340237[_0x81ab('0x2f')][_0x81ab('0x39')]);_0x2e157c[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x340237[_0x81ab('0x2f')],_0xa541b4[_0x81ab('0x30')]),_0x54c391);if(_0x340237['query'][_0x81ab('0x3c')]){_0x2e157c['where']=_[_0x81ab('0x3d')](_0x2e157c[_0x81ab('0x3a')],{'$or':_['map'](_0x54c391,function(_0x30101f){if(_0x30101f[_0x81ab('0x3e')]!=='VIRTUAL'){var _0x51a492={};_0x51a492[_0x30101f[_0x81ab('0x26')]]={'$like':'%'+_0x340237['query'][_0x81ab('0x3c')]+'%'};return _0x51a492;}})});}_0x2e157c=_[_0x81ab('0x3d')]({},_0x2e157c,_0x340237['options']);var _0x3c142f={'where':_0x2e157c[_0x81ab('0x3a')]};return db[_0x81ab('0x2a')][_0x81ab('0x1e')](_0x3c142f)['then'](function(_0x44b63d){_0x4ce780[_0x81ab('0x1e')]=_0x44b63d;if(_0x340237[_0x81ab('0x2f')][_0x81ab('0x3f')]){_0x2e157c[_0x81ab('0x40')]=[{'all':!![]}];}return db[_0x81ab('0x2a')][_0x81ab('0x41')](_0x2e157c);})[_0x81ab('0x21')](function(_0x2b4358){_0x4ce780[_0x81ab('0x42')]=_0x2b4358;return _0x4ce780;})[_0x81ab('0x21')](respondWithFilteredResult(_0x95a250,_0x2e157c))[_0x81ab('0x43')](handleError(_0x95a250,null));};exports['show']=function(_0x4e465d,_0x2dbccc){var _0x23329c={'raw':![],'where':{'id':_0x4e465d['params']['id']}},_0x471a37={};_0x471a37['model']=_[_0x81ab('0x44')](db[_0x81ab('0x2a')]['rawAttributes']);_0x471a37['query']=_[_0x81ab('0x44')](_0x4e465d[_0x81ab('0x2f')]);_0x471a37[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x471a37[_0x81ab('0x2e')],_0x471a37[_0x81ab('0x2f')]);_0x23329c[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x471a37[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x4e465d[_0x81ab('0x2f')][_0x81ab('0x33')]));_0x23329c['attributes']=_0x23329c['attributes']['length']?_0x23329c['attributes']:_0x471a37[_0x81ab('0x2e')];if(_0x4e465d[_0x81ab('0x2f')][_0x81ab('0x3f')]){_0x23329c[_0x81ab('0x40')]=[{'all':!![]}];}_0x23329c=_['merge']({},_0x23329c,_0x4e465d['options']);return db[_0x81ab('0x2a')][_0x81ab('0x45')](_0x23329c)[_0x81ab('0x21')](handleEntityNotFound(_0x2dbccc,null))['then'](respondWithResult(_0x2dbccc,null))['catch'](handleError(_0x2dbccc,null));};exports[_0x81ab('0x46')]=function(_0x46aa44,_0x177379){return db[_0x81ab('0x2a')][_0x81ab('0x46')](_0x46aa44[_0x81ab('0x47')],{})['then'](function(_0x2650d4){var _0x4a44ab=_0x46aa44[_0x81ab('0x48')][_0x81ab('0x22')]({'plain':!![]});if(!_0x4a44ab)throw new Error(_0x81ab('0x49'));if(_0x4a44ab[_0x81ab('0x4a')]===_0x81ab('0x48')){var _0x2dfac6=_0x2650d4[_0x81ab('0x22')]({'plain':!![]});var _0x55226f=_0x81ab('0x23');return db[_0x81ab('0x4b')][_0x81ab('0x45')]({'where':{'name':_0x55226f,'userProfileId':_0x4a44ab['userProfileId']},'raw':!![]})['then'](function(_0x2a356f){if(_0x2a356f&&_0x2a356f['autoAssociation']===0x0){return db[_0x81ab('0x4c')][_0x81ab('0x46')]({'name':_0x2dfac6['name'],'resourceId':_0x2dfac6['id'],'type':_0x2a356f['name'],'sectionId':_0x2a356f['id']},{})[_0x81ab('0x21')](function(){return _0x2650d4;});}else{return _0x2650d4;}})[_0x81ab('0x43')](function(_0x515017){logger[_0x81ab('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x515017);throw _0x515017;});}return _0x2650d4;})[_0x81ab('0x21')](respondWithResult(_0x177379,0xc9))['catch'](handleError(_0x177379,null));};exports[_0x81ab('0x4d')]=function(_0x47c818,_0x4d33f2){if(_0x47c818[_0x81ab('0x47')]['id']){delete _0x47c818[_0x81ab('0x47')]['id'];}return db['CmList'][_0x81ab('0x45')]({'where':{'id':_0x47c818[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x4d33f2,null))[_0x81ab('0x21')](saveUpdates(_0x47c818['body'],null))['then'](respondWithResult(_0x4d33f2,null))['catch'](handleError(_0x4d33f2,null));};exports['destroy']=function(_0x434419,_0x3188ae){return db['CmList'][_0x81ab('0x45')]({'where':{'id':_0x434419['params']['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x3188ae,null))[_0x81ab('0x21')](removeEntity(_0x3188ae,null))[_0x81ab('0x43')](handleError(_0x3188ae,null));};exports[_0x81ab('0x4f')]=function(_0x38065a,_0x1f594c){return db['CmList']['describe']()[_0x81ab('0x21')](respondWithResult(_0x1f594c,null))[_0x81ab('0x43')](handleError(_0x1f594c,null));};exports[_0x81ab('0x50')]=function(_0x36995f,_0x583048,_0x515ec8){if(_0x36995f[_0x81ab('0x47')]['id']){delete _0x36995f[_0x81ab('0x47')]['id'];}return db['CmList'][_0x81ab('0x45')]({'where':{'id':_0x36995f[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x583048,null))[_0x81ab('0x21')](function(_0x48c59e){if(_0x48c59e){_0x36995f[_0x81ab('0x47')][_0x81ab('0x51')]=_0x48c59e['id'];return db['Disposition'][_0x81ab('0x46')](_0x36995f[_0x81ab('0x47')]);}})[_0x81ab('0x21')](respondWithResult(_0x583048,null))['catch'](handleError(_0x583048,null));};exports[_0x81ab('0x52')]=function(_0x3bb4c5,_0x2d091d,_0x54e015){var _0xb4a095={'raw':![],'where':{}};var _0x369b40={};var _0x1c82d5={'count':0x0,'rows':[]};return db['CmList'][_0x81ab('0x53')]({'where':{'id':_0x3bb4c5['params']['id']}})['then'](handleEntityNotFound(_0x2d091d,null))[_0x81ab('0x21')](function(_0x367d55){if(_0x367d55){_0x369b40[_0x81ab('0x2e')]=_['keys'](db['Disposition'][_0x81ab('0x2b')]);_0x369b40[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0x3bb4c5[_0x81ab('0x2f')]);_0x369b40[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x369b40[_0x81ab('0x2e')],_0x369b40[_0x81ab('0x2f')]);_0xb4a095[_0x81ab('0x32')]=_['intersection'](_0x369b40[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x33')]));_0xb4a095[_0x81ab('0x32')]=_0xb4a095[_0x81ab('0x32')][_0x81ab('0x34')]?_0xb4a095[_0x81ab('0x32')]:_0x369b40['model'];if(!_0x3bb4c5['query'][_0x81ab('0x35')](_0x81ab('0x36'))){_0xb4a095['limit']=qs[_0x81ab('0x37')](_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x37')]);_0xb4a095[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0x3bb4c5['query'][_0x81ab('0x1f')]);}_0xb4a095[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x3bb4c5['query'][_0x81ab('0x39')]);_0xb4a095['where']=qs['filters'](_[_0x81ab('0x3b')](_0x3bb4c5[_0x81ab('0x2f')],_0x369b40['filters']));_0xb4a095[_0x81ab('0x3a')][_0x81ab('0x51')]=_0x367d55['id'];if(_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x3c')]){_0xb4a095[_0x81ab('0x3a')]=_[_0x81ab('0x3d')](_0xb4a095['where'],{'$or':_[_0x81ab('0x29')](_0xb4a095[_0x81ab('0x32')],function(_0x2c98d0){var _0x4c02a6={};_0x4c02a6[_0x2c98d0]={'$like':'%'+_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x3c')]+'%'};return _0x4c02a6;})});}_0xb4a095=_[_0x81ab('0x3d')]({},_0xb4a095,_0x3bb4c5['options']);return db[_0x81ab('0x54')][_0x81ab('0x1e')]({'where':_0xb4a095[_0x81ab('0x3a')]})[_0x81ab('0x21')](function(_0x362c63){_0x1c82d5[_0x81ab('0x1e')]=_0x362c63;if(_0x3bb4c5[_0x81ab('0x2f')][_0x81ab('0x3f')]){_0xb4a095[_0x81ab('0x40')]=[{'all':!![]}];}return db['Disposition'][_0x81ab('0x41')](_0xb4a095);})[_0x81ab('0x21')](function(_0xe82610){_0x1c82d5['rows']=_0xe82610;return _0x1c82d5;});}})[_0x81ab('0x21')](respondWithFilteredResult(_0x2d091d,_0xb4a095))[_0x81ab('0x43')](handleError(_0x2d091d,null));};exports[_0x81ab('0x55')]=function(_0x23330b,_0x314492,_0xff23cd){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x23330b[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x314492,null))['then'](function(_0xc74d12){if(_0xc74d12){return _0xc74d12[_0x81ab('0x55')](_0x23330b[_0x81ab('0x2f')][_0x81ab('0x56')]);}})['then'](respondWithStatusCode(_0x314492,null))[_0x81ab('0x43')](handleError(_0x314492,null));};exports[_0x81ab('0x57')]=function(_0x16d849,_0x382da1,_0x3e5434){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x16d849[_0x81ab('0x4e')]['id']}})['then'](handleEntityNotFound(_0x382da1,null))[_0x81ab('0x21')](function(_0xade6e2){if(_0xade6e2){var _0x53d25f=[];var _0x357693={'success':[],'errors':[]};return db['CmContact'][_0x81ab('0x4f')]()[_0x81ab('0x21')](function(_0x39c51d){if(_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')]&&_[_0x81ab('0x59')](_0x16d849['body']['tags'])){if(_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')][_0x81ab('0x34')]){_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')]=_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')][_0x81ab('0x5a')](';')+';';}else{_0x16d849['body'][_0x81ab('0x58')]=null;}}else{_0x16d849[_0x81ab('0x47')][_0x81ab('0x58')]=null;}if(_0x16d849[_0x81ab('0x47')]&&_['isArray'](_0x16d849[_0x81ab('0x47')])){for(var _0x5157c6=0x0;_0x5157c6<_0x16d849['body'][_0x81ab('0x34')];_0x5157c6+=0x1){_0x16d849['body'][_0x5157c6][_0x81ab('0x51')]=_0x16d849[_0x81ab('0x4e')]['id'];_0x53d25f['push'](_0x16d849[_0x81ab('0x47')][_0x5157c6]);}return BPromise[_0x81ab('0x5b')](_0x53d25f,function(_0x2e7edd){return db[_0x81ab('0x5c')]['create'](_[_0x81ab('0x5d')](_0x2e7edd,[_0x81ab('0x56'),'id'])||{},{'fields':_[_0x81ab('0x44')](_0x39c51d),'raw':!![]})[_0x81ab('0x21')](function(_0x4fb7b5){_0x357693[_0x81ab('0x5e')][_0x81ab('0x5f')](_0x4fb7b5[_0x81ab('0x60')]);})[_0x81ab('0x43')](function(_0x5411c5){_0x357693['errors']['push']({'data':_0x2e7edd,'error':_0x5411c5[_0x81ab('0x61')]});});})[_0x81ab('0x21')](function(_0x619af5){return _0x357693;})['catch'](function(_0x535d57){return _0x535d57;});}else{_0x382da1[_0x81ab('0x1c')](0x190)[_0x81ab('0x1d')]({'message':_0x81ab('0x62')});}});}})[_0x81ab('0x21')](respondWithResult(_0x382da1,null))[_0x81ab('0x43')](handleError(_0x382da1,null));};exports[_0x81ab('0x63')]=function(_0x4a04db,_0x290b15,_0x23146c){var _0x2bec97;return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x4a04db['params']['id']},'include':[{'model':db[_0x81ab('0x64')],'as':_0x81ab('0x65')}]})[_0x81ab('0x21')](handleEntityNotFound(_0x290b15,null))[_0x81ab('0x21')](function(_0x854214){if(_0x854214){_0x2bec97=_0x854214;return db[_0x81ab('0x5c')]['rawAttributes'];}})[_0x81ab('0x21')](function(_0x387889){if(_0x387889){var _0x6821c3={};var _0x327517={};_0x327517[_0x81ab('0x2e')]=_[_0x81ab('0x66')](_[_0x81ab('0x44')](_0x387889),_[_0x81ab('0x29')](_0x2bec97[_0x81ab('0x65')],function(_0x3e8e8a){return util[_0x81ab('0x67')](_0x81ab('0x68'),_0x3e8e8a['id']);}));_0x327517[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0x4a04db[_0x81ab('0x2f')]);_0x327517[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x327517[_0x81ab('0x2e')],_0x327517['query']);_0x6821c3[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x327517[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x4a04db[_0x81ab('0x2f')]['fields']));_0x6821c3[_0x81ab('0x32')]=_0x6821c3[_0x81ab('0x32')]['length']?_0x6821c3[_0x81ab('0x32')]:_0x327517[_0x81ab('0x2e')];if(!_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x35')]('nolimit')){_0x6821c3[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x37')]);_0x6821c3[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x1f')]);}_0x6821c3[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x39')]);_0x6821c3[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x4a04db[_0x81ab('0x2f')],_0x327517['filters']));_0x6821c3[_0x81ab('0x69')]=!![];if(_0x4a04db[_0x81ab('0x2f')][_0x81ab('0x3c')]){_0x6821c3['where']=_[_0x81ab('0x3d')](_0x6821c3[_0x81ab('0x3a')],{'$or':_[_0x81ab('0x29')](_0x6821c3[_0x81ab('0x32')],function(_0x2c33f3){var _0x20d318={};_0x20d318[_0x2c33f3]={'$like':'%'+_0x4a04db[_0x81ab('0x2f')]['filter']+'%'};return _0x20d318;})});}_0x6821c3=_[_0x81ab('0x3d')]({},_0x6821c3,_0x4a04db[_0x81ab('0x6a')]);return _0x2bec97['getContacts'](_0x6821c3);}})[_0x81ab('0x21')](respondWithResult(_0x290b15,null))['catch'](handleError(_0x290b15,null));};exports[_0x81ab('0x6b')]=function(_0x1d6372,_0x54a0de,_0xd92eaf){var _0x2d3515;return db[_0x81ab('0x2a')]['find']({'where':{'id':_0x1d6372[_0x81ab('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x81ab('0x65')}]})['then'](handleEntityNotFound(_0x54a0de,null))['then'](function(_0x5c00f7){if(_0x5c00f7){_0x2d3515=_0x5c00f7;return db['CmContact'][_0x81ab('0x2b')];}})[_0x81ab('0x21')](function(_0x151506){if(_0x151506){var _0xf83b35={};var _0x19fa34={};_0x19fa34['model']=_['concat'](_[_0x81ab('0x44')](_0x151506),_[_0x81ab('0x29')](_0x2d3515[_0x81ab('0x65')],function(_0xa3dfb9){return util[_0x81ab('0x67')](_0x81ab('0x68'),_0xa3dfb9['id']);}));_0x19fa34[_0x81ab('0x2f')]=_['keys'](_0x1d6372[_0x81ab('0x2f')]);_0x19fa34[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x19fa34[_0x81ab('0x2e')],_0x19fa34[_0x81ab('0x2f')]);_0xf83b35[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x19fa34[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x1d6372[_0x81ab('0x2f')]['fields']));_0xf83b35[_0x81ab('0x32')]=_0xf83b35[_0x81ab('0x32')]['length']?_0xf83b35[_0x81ab('0x32')]:_0x19fa34[_0x81ab('0x2e')];if(!_0x1d6372[_0x81ab('0x2f')][_0x81ab('0x35')]('nolimit')){_0xf83b35[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0x1d6372['query']['limit']);_0xf83b35[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0x1d6372['query'][_0x81ab('0x1f')]);}_0xf83b35[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0x1d6372[_0x81ab('0x2f')][_0x81ab('0x39')]);_0xf83b35['where']=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x1d6372[_0x81ab('0x2f')],_0x19fa34[_0x81ab('0x30')]));_0xf83b35['raw']=!![];if(_0x1d6372['query'][_0x81ab('0x3c')]){_0xf83b35[_0x81ab('0x3a')]=_[_0x81ab('0x3d')](_0xf83b35['where'],{'$or':_['map'](_0xf83b35['attributes'],function(_0x5accca){var _0x1c2d04={};_0x1c2d04[_0x5accca]={'$like':'%'+_0x1d6372['query'][_0x81ab('0x3c')]+'%'};return _0x1c2d04;})});}_0xf83b35=_[_0x81ab('0x3d')]({},_0xf83b35,_0x1d6372['options']);return _0x2d3515[_0x81ab('0x63')](_0xf83b35);}})[_0x81ab('0x21')](function(_0x31df63){if(!_[_0x81ab('0x6c')](_0x31df63)){var _0x50b30c=toCsv(_0x31df63);var _0x485194=Date[_0x81ab('0x6d')]();fs[_0x81ab('0x6e')](util[_0x81ab('0x67')](_0x81ab('0x6f'),_0x2d3515['id'],_0x485194),_0x50b30c);_0x54a0de['setHeader'](_0x81ab('0x70'),_0x81ab('0x71')+util[_0x81ab('0x67')]('list_%d_%s.csv',_0x2d3515['id'],_0x485194));_0x54a0de[_0x81ab('0x72')](_0x81ab('0x73'),_0x81ab('0x74'));return _0x54a0de[_0x81ab('0x75')](util[_0x81ab('0x67')](_0x81ab('0x6f'),_0x2d3515['id'],_0x485194));}else{return _0x54a0de[_0x81ab('0x1a')](0xcc);}})['catch'](handleError(_0x54a0de,null));};exports[_0x81ab('0x76')]=function(_0x296f4f,_0x4463e5,_0x39868a){var _0x42e174;delete _0x296f4f['body']['id'];return db[_0x81ab('0x2a')][_0x81ab('0x53')]({'where':{'id':_0x296f4f['params']['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x4463e5,null))[_0x81ab('0x21')](function(_0x2259f7){if(_0x2259f7){return db['sequelize']['transaction'](function(_0x34e513){return db[_0x81ab('0x64')][_0x81ab('0x46')](_0x296f4f[_0x81ab('0x47')],{'transaction':_0x34e513})[_0x81ab('0x21')](function(_0x372d13){_0x42e174=_0x372d13;return _0x2259f7['addCustomFields'](_0x372d13,{'transaction':_0x34e513});})['then'](function(){var _0x4c56b8={'type':db[_0x81ab('0x77')][_0x81ab('0x78')],'transaction':_0x34e513};switch(_0x296f4f[_0x81ab('0x47')][_0x81ab('0x3e')]){case'text':_0x4c56b8[_0x81ab('0x3e')]=db[_0x81ab('0x77')][_0x81ab('0x78')];break;case'number':_0x4c56b8[_0x81ab('0x3e')]=db['Sequelize']['INTEGER'];break;case'switch':_0x4c56b8[_0x81ab('0x3e')]=db[_0x81ab('0x77')][_0x81ab('0x79')];_0x4c56b8[_0x81ab('0x7a')]=![];break;default:}return db['sequelize'][_0x81ab('0x7b')][_0x81ab('0x7c')](_0x81ab('0x7d'),util['format'](_0x81ab('0x7e'),_0x42e174['id']),_0x4c56b8);})[_0x81ab('0x21')](function(){return _0x42e174;});});}})[_0x81ab('0x21')](respondWithResult(_0x4463e5,null))[_0x81ab('0x43')](handleError(_0x4463e5,null));};exports[_0x81ab('0x7f')]=function(_0x46b28c,_0x49ee13,_0x32e1e6){var _0x407829={};var _0x52ffcf={};var _0x532137;var _0x17bd96;return db['CmList'][_0x81ab('0x53')]({'where':{'id':_0x46b28c[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x49ee13,null))[_0x81ab('0x21')](function(_0x19b351){if(_0x19b351){_0x532137=_0x19b351;_0x52ffcf[_0x81ab('0x2e')]=_['keys'](db[_0x81ab('0x64')][_0x81ab('0x2b')]);_0x52ffcf[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0x46b28c[_0x81ab('0x2f')]);_0x52ffcf[_0x81ab('0x30')]=_[_0x81ab('0x31')](_0x52ffcf[_0x81ab('0x2e')],_0x52ffcf[_0x81ab('0x2f')]);_0x407829[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0x52ffcf[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0x46b28c[_0x81ab('0x2f')][_0x81ab('0x33')]));_0x407829[_0x81ab('0x32')]=_0x407829[_0x81ab('0x32')]['length']?_0x407829[_0x81ab('0x32')]:_0x52ffcf[_0x81ab('0x2e')];_0x407829['order']=qs[_0x81ab('0x39')](_0x46b28c[_0x81ab('0x2f')][_0x81ab('0x39')]);_0x407829[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0x46b28c['query'],_0x52ffcf[_0x81ab('0x30')]));_0x407829['where']=_[_0x81ab('0x3d')](_0x407829[_0x81ab('0x3a')],{'$or':[{'ListId':_0x19b351['id']},{'ListId':null}]});if(_0x46b28c['query'][_0x81ab('0x3c')]){_0x407829[_0x81ab('0x3a')]=_['merge'](_0x407829['where'],{'$or':_[_0x81ab('0x29')](_0x407829['attributes'],function(_0x5318ab){var _0xd002a8={};_0xd002a8[_0x5318ab]={'$like':'%'+_0x46b28c[_0x81ab('0x2f')][_0x81ab('0x3c')]+'%'};return _0xd002a8;})});}_0x407829=_[_0x81ab('0x3d')]({},_0x407829,_0x46b28c[_0x81ab('0x6a')]);return db[_0x81ab('0x64')][_0x81ab('0x80')](_0x407829);}})[_0x81ab('0x21')](respondWithResult(_0x49ee13,null))['catch'](handleError(_0x49ee13,null));};exports[_0x81ab('0x81')]=function(_0x25251d,_0x41419a,_0xf83adc){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x25251d[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x41419a,null))[_0x81ab('0x21')](function(_0x32ff7f){if(_0x32ff7f){return _0x32ff7f[_0x81ab('0x81')](_0x25251d['body'][_0x81ab('0x56')],_['omit'](_0x25251d[_0x81ab('0x47')],[_0x81ab('0x56'),'id'])||{})[_0x81ab('0x82')](function(_0x5082a6){for(var _0x1f893b=0x0;_0x1f893b<_0x25251d['body'][_0x81ab('0x56')][_0x81ab('0x34')];_0x1f893b+=0x1){socket[_0x81ab('0x83')](_0x81ab('0x84'),{'UserId':_0x25251d[_0x81ab('0x47')][_0x81ab('0x56')][_0x1f893b],'CmListId':_0x25251d['params']['id']});}return _0x5082a6;});}})[_0x81ab('0x21')](respondWithResult(_0x41419a,null))[_0x81ab('0x43')](handleError(_0x41419a,null));};exports[_0x81ab('0x85')]=function(_0x207425,_0x3b3186,_0x5174cf){return db[_0x81ab('0x2a')][_0x81ab('0x45')]({'where':{'id':_0x207425[_0x81ab('0x4e')]['id']}})[_0x81ab('0x21')](handleEntityNotFound(_0x3b3186,null))[_0x81ab('0x21')](function(_0x53b0d3){if(_0x53b0d3){return _0x53b0d3[_0x81ab('0x85')](_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')])[_0x81ab('0x21')](function(){if(_[_0x81ab('0x59')](_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')])){for(var _0x56fe3b=0x0;_0x56fe3b<_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')]['length'];_0x56fe3b+=0x1){socket['emit'](_0x81ab('0x86'),{'UserId':Number(_0x207425[_0x81ab('0x2f')][_0x81ab('0x56')][_0x56fe3b]),'CmListId':Number(_0x207425[_0x81ab('0x4e')]['id'])});}}else{socket[_0x81ab('0x83')](_0x81ab('0x86'),{'UserId':Number(_0x207425['query']['ids']),'CmListId':Number(_0x207425['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b3186,null))['catch'](handleError(_0x3b3186,null));};exports[_0x81ab('0x87')]=function(_0xfcd308,_0x4068c4,_0x463f16){var _0x551f2d={};var _0xb8ebe9={};var _0x283555;var _0x194c98;return db['CmList'][_0x81ab('0x53')]({'where':{'id':_0xfcd308['params']['id']}})['then'](handleEntityNotFound(_0x4068c4,null))[_0x81ab('0x21')](function(_0xa01d94){if(_0xa01d94){_0x283555=_0xa01d94;_0xb8ebe9['model']=_[_0x81ab('0x44')](db['User'][_0x81ab('0x2b')]);_0xb8ebe9[_0x81ab('0x2f')]=_[_0x81ab('0x44')](_0xfcd308[_0x81ab('0x2f')]);_0xb8ebe9['filters']=_[_0x81ab('0x31')](_0xb8ebe9[_0x81ab('0x2e')],_0xb8ebe9['query']);_0x551f2d[_0x81ab('0x32')]=_[_0x81ab('0x31')](_0xb8ebe9[_0x81ab('0x2e')],qs[_0x81ab('0x33')](_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x33')]));_0x551f2d[_0x81ab('0x32')]=_0x551f2d[_0x81ab('0x32')][_0x81ab('0x34')]?_0x551f2d[_0x81ab('0x32')]:_0xb8ebe9[_0x81ab('0x2e')];_0x551f2d[_0x81ab('0x38')]=qs[_0x81ab('0x39')](_0xfcd308[_0x81ab('0x2f')]['sort']);_0x551f2d[_0x81ab('0x3a')]=qs[_0x81ab('0x30')](_[_0x81ab('0x3b')](_0xfcd308[_0x81ab('0x2f')],_0xb8ebe9['filters']));if(_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x3c')]){_0x551f2d[_0x81ab('0x3a')]=_[_0x81ab('0x3d')](_0x551f2d[_0x81ab('0x3a')],{'$or':_[_0x81ab('0x29')](_0x551f2d['attributes'],function(_0x2d5d22){var _0x22db7e={};_0x22db7e[_0x2d5d22]={'$like':'%'+_0xfcd308[_0x81ab('0x2f')]['filter']+'%'};return _0x22db7e;})});}_0x551f2d=_[_0x81ab('0x3d')]({},_0x551f2d,_0xfcd308[_0x81ab('0x6a')]);return _0x283555[_0x81ab('0x87')](_0x551f2d);}})['then'](function(_0x57a67e){if(_0x57a67e){_0x194c98=_0x57a67e[_0x81ab('0x34')];if(!_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x35')](_0x81ab('0x36'))){_0x551f2d[_0x81ab('0x37')]=qs[_0x81ab('0x37')](_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x37')]);_0x551f2d[_0x81ab('0x1f')]=qs[_0x81ab('0x1f')](_0xfcd308[_0x81ab('0x2f')][_0x81ab('0x1f')]);}return _0x283555[_0x81ab('0x87')](_0x551f2d);}})[_0x81ab('0x21')](function(_0x406e3a){if(_0x406e3a){return _0x406e3a?{'count':_0x194c98,'rows':_0x406e3a}:null;}})[_0x81ab('0x21')](respondWithResult(_0x4068c4,null))['catch'](handleError(_0x4068c4,null));}; \ No newline at end of file +var _0x4ad5=['socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','Lists','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','CmList','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','BOOLEAN','defaultValue','cf_%s','getCustomFields','findAndCountAll','addAgents','ids','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','redis','defaults','localhost'];(function(_0x58b57a,_0x3f8a60){var _0x31f1d0=function(_0x48c7f6){while(--_0x48c7f6){_0x58b57a['push'](_0x58b57a['shift']());}};_0x31f1d0(++_0x3f8a60);}(_0x4ad5,0x106));var _0x54ad=function(_0x1f4d04,_0x4fb79c){_0x1f4d04=_0x1f4d04-0x0;var _0x13ff3e=_0x4ad5[_0x1f4d04];return _0x13ff3e;};'use strict';var pdf=require(_0x54ad('0x0'));var emlformat=require(_0x54ad('0x1'));var rimraf=require(_0x54ad('0x2'));var zipdir=require(_0x54ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54ad('0x4'));var moment=require(_0x54ad('0x5'));var BPromise=require(_0x54ad('0x6'));var Mustache=require(_0x54ad('0x7'));var util=require(_0x54ad('0x8'));var path=require(_0x54ad('0x9'));var sox=require(_0x54ad('0xa'));var csv=require('to-csv');var ejs=require(_0x54ad('0xb'));var fs=require('fs');var _=require(_0x54ad('0xc'));var squel=require(_0x54ad('0xd'));var crypto=require('crypto');var jsforce=require(_0x54ad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x54ad('0xf'));var querystring=require(_0x54ad('0x10'));var Papa=require(_0x54ad('0x11'));var Redis=require(_0x54ad('0x12'));var authService=require(_0x54ad('0x13'));var qs=require(_0x54ad('0x14'));var as=require(_0x54ad('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x54ad('0x16'))['db'];config[_0x54ad('0x17')]=_[_0x54ad('0x18')](config['redis'],{'host':_0x54ad('0x19'),'port':0x18eb});var socket=require(_0x54ad('0x1a'))(new Redis(config[_0x54ad('0x17')]));require(_0x54ad('0x1b'))[_0x54ad('0x1c')](socket);function respondWithStatusCode(_0x5cac01,_0x4d7fc0){_0x4d7fc0=_0x4d7fc0||0xcc;return function(_0x263bd5){if(_0x263bd5){return _0x5cac01[_0x54ad('0x1d')](_0x4d7fc0);}return _0x5cac01[_0x54ad('0x1e')](_0x4d7fc0)[_0x54ad('0x1f')]();};}function respondWithResult(_0x5640a8,_0x43d6ec){_0x43d6ec=_0x43d6ec||0xc8;return function(_0x17a400){if(_0x17a400){return _0x5640a8[_0x54ad('0x1e')](_0x43d6ec)[_0x54ad('0x20')](_0x17a400);}};}function respondWithFilteredResult(_0x279f23,_0x164633){return function(_0x229b78){if(_0x229b78){var _0x25e011=_0x229b78[_0x54ad('0x21')],_0x46259c=_0x164633[_0x54ad('0x22')],_0x1a0dc8=_0x164633['offset']+_0x164633[_0x54ad('0x23')],_0x2411c8;if(_0x1a0dc8>=_0x25e011){_0x1a0dc8=_0x25e011;_0x2411c8=0xc8;}else{_0x2411c8=0xce;}_0x279f23['status'](_0x2411c8);return _0x279f23[_0x54ad('0x24')](_0x54ad('0x25'),_0x46259c+'-'+_0x1a0dc8+'/'+_0x25e011)[_0x54ad('0x20')](_0x229b78);}return null;};}function patchUpdates(_0x2c9a84){return function(_0x5cdbc0){try{jsonpatch[_0x54ad('0x26')](_0x5cdbc0,_0x2c9a84,!![]);}catch(_0x5bdbd2){return BPromise[_0x54ad('0x27')](_0x5bdbd2);}return _0x5cdbc0['save']();};}function saveUpdates(_0x98f699,_0x4f3c6b){return function(_0x21e0c4){if(_0x21e0c4){return _0x21e0c4[_0x54ad('0x28')](_0x98f699)['then'](function(_0x3fc894){return _0x3fc894;});}return null;};}function removeEntity(_0x52c24d,_0x3ad7c3){return function(_0x406c15){if(_0x406c15){return _0x406c15[_0x54ad('0x29')]()[_0x54ad('0x2a')](function(){var _0x3bfc59=_0x406c15['get']({'plain':!![]});var _0x393850=_0x54ad('0x2b');return db['UserProfileResource'][_0x54ad('0x29')]({'where':{'type':_0x393850,'resourceId':_0x3bfc59['id']}})[_0x54ad('0x2a')](function(){return _0x406c15;});})[_0x54ad('0x2a')](function(){_0x52c24d['status'](0xcc)[_0x54ad('0x1f')]();});}};}function handleEntityNotFound(_0x5263ec,_0x3ade67){return function(_0x36f139){if(!_0x36f139){_0x5263ec[_0x54ad('0x1d')](0x194);}return _0x36f139;};}function handleError(_0x4db25c,_0x459999){_0x459999=_0x459999||0x1f4;return function(_0x21065f){logger[_0x54ad('0x2c')](_0x21065f[_0x54ad('0x2d')]);if(_0x21065f[_0x54ad('0x2e')]){delete _0x21065f[_0x54ad('0x2e')];}_0x4db25c['status'](_0x459999)[_0x54ad('0x2f')](_0x21065f);};}exports['index']=function(_0x3f15f3,_0x3bb9f3){var _0x286f6a={},_0x4ffbba={},_0x26f4ad={'count':0x0,'rows':[]};var _0x58dd7c=_[_0x54ad('0x30')](db['CmList'][_0x54ad('0x31')],function(_0x46b9eb){return{'name':_0x46b9eb[_0x54ad('0x32')],'type':_0x46b9eb['type'][_0x54ad('0x33')]};});_0x4ffbba[_0x54ad('0x34')]=_['map'](_0x58dd7c,_0x54ad('0x2e'));_0x4ffbba[_0x54ad('0x35')]=_[_0x54ad('0x36')](_0x3f15f3['query']);_0x4ffbba[_0x54ad('0x37')]=_[_0x54ad('0x38')](_0x4ffbba[_0x54ad('0x34')],_0x4ffbba[_0x54ad('0x35')]);_0x286f6a['attributes']=_['intersection'](_0x4ffbba['model'],qs[_0x54ad('0x39')](_0x3f15f3['query']['fields']));_0x286f6a[_0x54ad('0x3a')]=_0x286f6a[_0x54ad('0x3a')][_0x54ad('0x3b')]?_0x286f6a['attributes']:_0x4ffbba['model'];if(!_0x3f15f3['query'][_0x54ad('0x3c')](_0x54ad('0x3d'))){_0x286f6a['limit']=qs['limit'](_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x23')]);_0x286f6a[_0x54ad('0x22')]=qs[_0x54ad('0x22')](_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x286f6a[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x3f')]);_0x286f6a[_0x54ad('0x40')]=qs[_0x54ad('0x37')](_[_0x54ad('0x41')](_0x3f15f3[_0x54ad('0x35')],_0x4ffbba['filters']),_0x58dd7c);if(_0x3f15f3['query'][_0x54ad('0x42')]){_0x286f6a['where']=_[_0x54ad('0x43')](_0x286f6a[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x58dd7c,function(_0x38684b){if(_0x38684b[_0x54ad('0x44')]!=='VIRTUAL'){var _0x5c3aae={};_0x5c3aae[_0x38684b['name']]={'$like':'%'+_0x3f15f3[_0x54ad('0x35')][_0x54ad('0x42')]+'%'};return _0x5c3aae;}})});}_0x286f6a=_[_0x54ad('0x43')]({},_0x286f6a,_0x3f15f3[_0x54ad('0x45')]);var _0x49d1a3={'where':_0x286f6a[_0x54ad('0x40')]};return db[_0x54ad('0x46')][_0x54ad('0x21')](_0x49d1a3)[_0x54ad('0x2a')](function(_0x39ffaa){_0x26f4ad['count']=_0x39ffaa;if(_0x3f15f3['query'][_0x54ad('0x47')]){_0x286f6a[_0x54ad('0x48')]=[{'all':!![]}];}return db[_0x54ad('0x46')][_0x54ad('0x49')](_0x286f6a);})['then'](function(_0xcd3beb){_0x26f4ad[_0x54ad('0x4a')]=_0xcd3beb;return _0x26f4ad;})[_0x54ad('0x2a')](respondWithFilteredResult(_0x3bb9f3,_0x286f6a))[_0x54ad('0x4b')](handleError(_0x3bb9f3,null));};exports[_0x54ad('0x4c')]=function(_0x587053,_0x541a18){var _0x48c309={'raw':![],'where':{'id':_0x587053[_0x54ad('0x4d')]['id']}},_0x5e7d90={};_0x5e7d90[_0x54ad('0x34')]=_[_0x54ad('0x36')](db['CmList'][_0x54ad('0x31')]);_0x5e7d90['query']=_[_0x54ad('0x36')](_0x587053['query']);_0x5e7d90['filters']=_[_0x54ad('0x38')](_0x5e7d90[_0x54ad('0x34')],_0x5e7d90[_0x54ad('0x35')]);_0x48c309[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x5e7d90[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x587053[_0x54ad('0x35')][_0x54ad('0x39')]));_0x48c309[_0x54ad('0x3a')]=_0x48c309[_0x54ad('0x3a')][_0x54ad('0x3b')]?_0x48c309['attributes']:_0x5e7d90[_0x54ad('0x34')];if(_0x587053['query'][_0x54ad('0x47')]){_0x48c309[_0x54ad('0x48')]=[{'all':!![]}];}_0x48c309=_['merge']({},_0x48c309,_0x587053[_0x54ad('0x45')]);return db['CmList']['find'](_0x48c309)[_0x54ad('0x2a')](handleEntityNotFound(_0x541a18,null))[_0x54ad('0x2a')](respondWithResult(_0x541a18,null))[_0x54ad('0x4b')](handleError(_0x541a18,null));};exports['create']=function(_0x5399a8,_0x5888b6){return db['CmList'][_0x54ad('0x4e')](_0x5399a8[_0x54ad('0x4f')],{})[_0x54ad('0x2a')](function(_0x685975){var _0x232d3a=_0x5399a8[_0x54ad('0x50')][_0x54ad('0x51')]({'plain':!![]});if(!_0x232d3a)throw new Error(_0x54ad('0x52'));if(_0x232d3a[_0x54ad('0x53')]===_0x54ad('0x50')){var _0x3ccb21=_0x685975[_0x54ad('0x51')]({'plain':!![]});var _0x3b593d='Lists';return db['UserProfileSection'][_0x54ad('0x54')]({'where':{'name':_0x3b593d,'userProfileId':_0x232d3a[_0x54ad('0x55')]},'raw':!![]})[_0x54ad('0x2a')](function(_0x306a60){if(_0x306a60&&_0x306a60[_0x54ad('0x56')]===0x0){return db[_0x54ad('0x57')][_0x54ad('0x4e')]({'name':_0x3ccb21['name'],'resourceId':_0x3ccb21['id'],'type':_0x306a60[_0x54ad('0x2e')],'sectionId':_0x306a60['id']},{})[_0x54ad('0x2a')](function(){return _0x685975;});}else{return _0x685975;}})[_0x54ad('0x4b')](function(_0x54827a){logger[_0x54ad('0x2c')](_0x54ad('0x58'),_0x54827a);throw _0x54827a;});}return _0x685975;})['then'](respondWithResult(_0x5888b6,0xc9))[_0x54ad('0x4b')](handleError(_0x5888b6,null));};exports[_0x54ad('0x28')]=function(_0x347e61,_0x5675ff){if(_0x347e61[_0x54ad('0x4f')]['id']){delete _0x347e61['body']['id'];}return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x347e61[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x5675ff,null))['then'](saveUpdates(_0x347e61[_0x54ad('0x4f')],null))[_0x54ad('0x2a')](respondWithResult(_0x5675ff,null))['catch'](handleError(_0x5675ff,null));};exports[_0x54ad('0x29')]=function(_0x53be50,_0x4fc8eb){return db[_0x54ad('0x46')]['find']({'where':{'id':_0x53be50['params']['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x4fc8eb,null))[_0x54ad('0x2a')](removeEntity(_0x4fc8eb,null))[_0x54ad('0x4b')](handleError(_0x4fc8eb,null));};exports[_0x54ad('0x59')]=function(_0x2872af,_0x4da60a){return db['CmList'][_0x54ad('0x59')]()[_0x54ad('0x2a')](respondWithResult(_0x4da60a,null))[_0x54ad('0x4b')](handleError(_0x4da60a,null));};exports[_0x54ad('0x5a')]=function(_0x129b0c,_0x2c722b,_0x32f110){if(_0x129b0c['body']['id']){delete _0x129b0c[_0x54ad('0x4f')]['id'];}return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x129b0c[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x2c722b,null))[_0x54ad('0x2a')](function(_0x21797d){if(_0x21797d){_0x129b0c[_0x54ad('0x4f')][_0x54ad('0x5b')]=_0x21797d['id'];return db[_0x54ad('0x5c')][_0x54ad('0x4e')](_0x129b0c[_0x54ad('0x4f')]);}})[_0x54ad('0x2a')](respondWithResult(_0x2c722b,null))[_0x54ad('0x4b')](handleError(_0x2c722b,null));};exports['getDispositions']=function(_0x13bc33,_0x2121a7,_0x51a9d7){var _0x4a4de1={'raw':![],'where':{}};var _0x2c35c1={};var _0x5affae={'count':0x0,'rows':[]};return db[_0x54ad('0x46')][_0x54ad('0x5d')]({'where':{'id':_0x13bc33[_0x54ad('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2121a7,null))[_0x54ad('0x2a')](function(_0x1d466b){if(_0x1d466b){_0x2c35c1[_0x54ad('0x34')]=_['keys'](db[_0x54ad('0x5c')]['rawAttributes']);_0x2c35c1['query']=_['keys'](_0x13bc33[_0x54ad('0x35')]);_0x2c35c1['filters']=_['intersection'](_0x2c35c1[_0x54ad('0x34')],_0x2c35c1[_0x54ad('0x35')]);_0x4a4de1['attributes']=_[_0x54ad('0x38')](_0x2c35c1[_0x54ad('0x34')],qs['fields'](_0x13bc33[_0x54ad('0x35')][_0x54ad('0x39')]));_0x4a4de1[_0x54ad('0x3a')]=_0x4a4de1['attributes'][_0x54ad('0x3b')]?_0x4a4de1['attributes']:_0x2c35c1[_0x54ad('0x34')];if(!_0x13bc33[_0x54ad('0x35')][_0x54ad('0x3c')]('nolimit')){_0x4a4de1[_0x54ad('0x23')]=qs['limit'](_0x13bc33['query']['limit']);_0x4a4de1[_0x54ad('0x22')]=qs['offset'](_0x13bc33[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x4a4de1[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x13bc33[_0x54ad('0x35')][_0x54ad('0x3f')]);_0x4a4de1['where']=qs[_0x54ad('0x37')](_['pick'](_0x13bc33['query'],_0x2c35c1[_0x54ad('0x37')]));_0x4a4de1['where'][_0x54ad('0x5b')]=_0x1d466b['id'];if(_0x13bc33[_0x54ad('0x35')][_0x54ad('0x42')]){_0x4a4de1[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x4a4de1[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x4a4de1[_0x54ad('0x3a')],function(_0x41d0e7){var _0x370011={};_0x370011[_0x41d0e7]={'$like':'%'+_0x13bc33['query']['filter']+'%'};return _0x370011;})});}_0x4a4de1=_[_0x54ad('0x43')]({},_0x4a4de1,_0x13bc33['options']);return db['Disposition'][_0x54ad('0x21')]({'where':_0x4a4de1[_0x54ad('0x40')]})[_0x54ad('0x2a')](function(_0x4c3e5d){_0x5affae['count']=_0x4c3e5d;if(_0x13bc33[_0x54ad('0x35')][_0x54ad('0x47')]){_0x4a4de1[_0x54ad('0x48')]=[{'all':!![]}];}return db[_0x54ad('0x5c')][_0x54ad('0x49')](_0x4a4de1);})[_0x54ad('0x2a')](function(_0x44fab6){_0x5affae[_0x54ad('0x4a')]=_0x44fab6;return _0x5affae;});}})[_0x54ad('0x2a')](respondWithFilteredResult(_0x2121a7,_0x4a4de1))[_0x54ad('0x4b')](handleError(_0x2121a7,null));};exports[_0x54ad('0x5e')]=function(_0x460f20,_0x1f4619,_0x18dca3){return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x460f20[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x1f4619,null))['then'](function(_0x183eef){if(_0x183eef){return _0x183eef[_0x54ad('0x5e')](_0x460f20[_0x54ad('0x35')]['ids']);}})[_0x54ad('0x2a')](respondWithStatusCode(_0x1f4619,null))[_0x54ad('0x4b')](handleError(_0x1f4619,null));};exports[_0x54ad('0x5f')]=function(_0x58b90a,_0x1f23f9,_0x2a6580){return db[_0x54ad('0x46')]['find']({'where':{'id':_0x58b90a[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x1f23f9,null))['then'](function(_0x1a031b){if(_0x1a031b){var _0x164787=[];var _0x4334fb={'success':[],'errors':[]};return db[_0x54ad('0x60')]['describe']()[_0x54ad('0x2a')](function(_0x127a88){if(_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]&&_[_0x54ad('0x62')](_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')])){if(_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')][_0x54ad('0x3b')]){_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]=_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')][_0x54ad('0x63')](';')+';';}else{_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]=null;}}else{_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x61')]=null;}if(_0x58b90a[_0x54ad('0x4f')]&&_['isArray'](_0x58b90a[_0x54ad('0x4f')])){for(var _0xfe4cbf=0x0;_0xfe4cbf<_0x58b90a[_0x54ad('0x4f')][_0x54ad('0x3b')];_0xfe4cbf+=0x1){_0x58b90a[_0x54ad('0x4f')][_0xfe4cbf][_0x54ad('0x5b')]=_0x58b90a[_0x54ad('0x4d')]['id'];_0x164787[_0x54ad('0x64')](_0x58b90a[_0x54ad('0x4f')][_0xfe4cbf]);}return BPromise['each'](_0x164787,function(_0xe20736){return db['CmContact'][_0x54ad('0x4e')](_[_0x54ad('0x65')](_0xe20736,['ids','id'])||{},{'fields':_[_0x54ad('0x36')](_0x127a88),'raw':!![]})['then'](function(_0x1f477a){_0x4334fb['success'][_0x54ad('0x64')](_0x1f477a[_0x54ad('0x66')]);})[_0x54ad('0x4b')](function(_0x2d2b7d){_0x4334fb['errors'][_0x54ad('0x64')]({'data':_0xe20736,'error':_0x2d2b7d[_0x54ad('0x67')]});});})[_0x54ad('0x2a')](function(_0x2195f7){return _0x4334fb;})[_0x54ad('0x4b')](function(_0x20711e){return _0x20711e;});}else{_0x1f23f9[_0x54ad('0x1e')](0x190)[_0x54ad('0x20')]({'message':_0x54ad('0x68')});}});}})[_0x54ad('0x2a')](respondWithResult(_0x1f23f9,null))[_0x54ad('0x4b')](handleError(_0x1f23f9,null));};exports[_0x54ad('0x69')]=function(_0x489c23,_0x3736bf,_0x3feca7){var _0x383db0;return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x489c23[_0x54ad('0x4d')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x54ad('0x6a')}]})[_0x54ad('0x2a')](handleEntityNotFound(_0x3736bf,null))[_0x54ad('0x2a')](function(_0x1c32f0){if(_0x1c32f0){_0x383db0=_0x1c32f0;return db[_0x54ad('0x60')][_0x54ad('0x31')];}})[_0x54ad('0x2a')](function(_0x3dad5c){if(_0x3dad5c){var _0x1d96a1={};var _0x190cd9={};_0x190cd9[_0x54ad('0x34')]=_[_0x54ad('0x6b')](_[_0x54ad('0x36')](_0x3dad5c),_[_0x54ad('0x30')](_0x383db0[_0x54ad('0x6a')],function(_0xcaacc1){return util[_0x54ad('0x6c')](_0x54ad('0x6d'),_0xcaacc1['id']);}));_0x190cd9[_0x54ad('0x35')]=_[_0x54ad('0x36')](_0x489c23[_0x54ad('0x35')]);_0x190cd9['filters']=_['intersection'](_0x190cd9[_0x54ad('0x34')],_0x190cd9['query']);_0x1d96a1[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x190cd9[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x39')]));_0x1d96a1['attributes']=_0x1d96a1[_0x54ad('0x3a')][_0x54ad('0x3b')]?_0x1d96a1[_0x54ad('0x3a')]:_0x190cd9[_0x54ad('0x34')];if(!_0x489c23['query']['hasOwnProperty']('nolimit')){_0x1d96a1[_0x54ad('0x23')]=qs[_0x54ad('0x23')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x23')]);_0x1d96a1['offset']=qs[_0x54ad('0x22')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x1d96a1[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x489c23[_0x54ad('0x35')][_0x54ad('0x3f')]);_0x1d96a1[_0x54ad('0x40')]=qs[_0x54ad('0x37')](_[_0x54ad('0x41')](_0x489c23[_0x54ad('0x35')],_0x190cd9[_0x54ad('0x37')]));_0x1d96a1[_0x54ad('0x6e')]=!![];if(_0x489c23[_0x54ad('0x35')][_0x54ad('0x42')]){_0x1d96a1[_0x54ad('0x40')]=_['merge'](_0x1d96a1[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x1d96a1[_0x54ad('0x3a')],function(_0x3de2ae){var _0x120251={};_0x120251[_0x3de2ae]={'$like':'%'+_0x489c23[_0x54ad('0x35')][_0x54ad('0x42')]+'%'};return _0x120251;})});}_0x1d96a1=_[_0x54ad('0x43')]({},_0x1d96a1,_0x489c23['options']);return _0x383db0[_0x54ad('0x69')](_0x1d96a1);}})[_0x54ad('0x2a')](respondWithResult(_0x3736bf,null))[_0x54ad('0x4b')](handleError(_0x3736bf,null));};exports[_0x54ad('0x6f')]=function(_0x178363,_0x5e2649,_0x45e5b4){var _0x3f405e;return db[_0x54ad('0x46')][_0x54ad('0x54')]({'where':{'id':_0x178363[_0x54ad('0x4d')]['id']},'include':[{'model':db[_0x54ad('0x70')],'as':_0x54ad('0x6a')}]})[_0x54ad('0x2a')](handleEntityNotFound(_0x5e2649,null))[_0x54ad('0x2a')](function(_0x54e5df){if(_0x54e5df){_0x3f405e=_0x54e5df;return db[_0x54ad('0x60')][_0x54ad('0x31')];}})[_0x54ad('0x2a')](function(_0x56e8e6){if(_0x56e8e6){var _0x53d372={};var _0x3386f4={};_0x3386f4['model']=_[_0x54ad('0x6b')](_[_0x54ad('0x36')](_0x56e8e6),_[_0x54ad('0x30')](_0x3f405e[_0x54ad('0x6a')],function(_0x59f768){return util['format'](_0x54ad('0x6d'),_0x59f768['id']);}));_0x3386f4[_0x54ad('0x35')]=_['keys'](_0x178363[_0x54ad('0x35')]);_0x3386f4['filters']=_[_0x54ad('0x38')](_0x3386f4[_0x54ad('0x34')],_0x3386f4[_0x54ad('0x35')]);_0x53d372[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x3386f4[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x178363[_0x54ad('0x35')][_0x54ad('0x39')]));_0x53d372[_0x54ad('0x3a')]=_0x53d372['attributes'][_0x54ad('0x3b')]?_0x53d372[_0x54ad('0x3a')]:_0x3386f4[_0x54ad('0x34')];if(!_0x178363[_0x54ad('0x35')]['hasOwnProperty'](_0x54ad('0x3d'))){_0x53d372[_0x54ad('0x23')]=qs[_0x54ad('0x23')](_0x178363[_0x54ad('0x35')][_0x54ad('0x23')]);_0x53d372[_0x54ad('0x22')]=qs[_0x54ad('0x22')](_0x178363[_0x54ad('0x35')][_0x54ad('0x22')]);}_0x53d372['order']=qs[_0x54ad('0x3f')](_0x178363['query'][_0x54ad('0x3f')]);_0x53d372[_0x54ad('0x40')]=qs['filters'](_[_0x54ad('0x41')](_0x178363[_0x54ad('0x35')],_0x3386f4['filters']));_0x53d372['raw']=!![];if(_0x178363[_0x54ad('0x35')]['filter']){_0x53d372[_0x54ad('0x40')]=_['merge'](_0x53d372[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x53d372['attributes'],function(_0x55a9d0){var _0x44ba38={};_0x44ba38[_0x55a9d0]={'$like':'%'+_0x178363[_0x54ad('0x35')]['filter']+'%'};return _0x44ba38;})});}_0x53d372=_[_0x54ad('0x43')]({},_0x53d372,_0x178363['options']);return _0x3f405e[_0x54ad('0x69')](_0x53d372);}})[_0x54ad('0x2a')](function(_0x4f4ca4){if(!_[_0x54ad('0x71')](_0x4f4ca4)){var _0x1c4880=toCsv(_0x4f4ca4);var _0x19709e=Date[_0x54ad('0x72')]();fs[_0x54ad('0x73')](util[_0x54ad('0x6c')](_0x54ad('0x74'),_0x3f405e['id'],_0x19709e),_0x1c4880);_0x5e2649[_0x54ad('0x75')](_0x54ad('0x76'),'attachment;\x20filename='+util[_0x54ad('0x6c')](_0x54ad('0x77'),_0x3f405e['id'],_0x19709e));_0x5e2649[_0x54ad('0x75')](_0x54ad('0x78'),_0x54ad('0x79'));return _0x5e2649[_0x54ad('0x7a')](util[_0x54ad('0x6c')](_0x54ad('0x74'),_0x3f405e['id'],_0x19709e));}else{return _0x5e2649[_0x54ad('0x1d')](0xcc);}})[_0x54ad('0x4b')](handleError(_0x5e2649,null));};exports[_0x54ad('0x7b')]=function(_0x550acf,_0x33d2af,_0x5c8249){var _0x47d474;delete _0x550acf[_0x54ad('0x4f')]['id'];return db[_0x54ad('0x46')][_0x54ad('0x5d')]({'where':{'id':_0x550acf[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x33d2af,null))[_0x54ad('0x2a')](function(_0x50cbb2){if(_0x50cbb2){return db[_0x54ad('0x7c')][_0x54ad('0x7d')](function(_0x5d54b7){return db[_0x54ad('0x70')][_0x54ad('0x4e')](_0x550acf[_0x54ad('0x4f')],{'transaction':_0x5d54b7})[_0x54ad('0x2a')](function(_0x1ea85e){_0x47d474=_0x1ea85e;return _0x50cbb2[_0x54ad('0x7e')](_0x1ea85e,{'transaction':_0x5d54b7});})[_0x54ad('0x2a')](function(){var _0x3d85b4={'type':db[_0x54ad('0x7f')][_0x54ad('0x80')],'transaction':_0x5d54b7};switch(_0x550acf[_0x54ad('0x4f')]['type']){case'text':_0x3d85b4['type']=db['Sequelize'][_0x54ad('0x80')];break;case _0x54ad('0x81'):_0x3d85b4[_0x54ad('0x44')]=db[_0x54ad('0x7f')]['INTEGER'];break;case'switch':_0x3d85b4[_0x54ad('0x44')]=db[_0x54ad('0x7f')][_0x54ad('0x82')];_0x3d85b4[_0x54ad('0x83')]=![];break;default:}return db[_0x54ad('0x7c')]['queryInterface']['addColumn']('cm_contacts',util[_0x54ad('0x6c')](_0x54ad('0x84'),_0x47d474['id']),_0x3d85b4);})[_0x54ad('0x2a')](function(){return _0x47d474;});});}})[_0x54ad('0x2a')](respondWithResult(_0x33d2af,null))['catch'](handleError(_0x33d2af,null));};exports[_0x54ad('0x85')]=function(_0x198159,_0x2ab9ed,_0x559ff1){var _0x5b8b7d={};var _0x595028={};var _0x674cf6;var _0x75ab3;return db[_0x54ad('0x46')]['findOne']({'where':{'id':_0x198159[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x2ab9ed,null))[_0x54ad('0x2a')](function(_0x12b3e6){if(_0x12b3e6){_0x674cf6=_0x12b3e6;_0x595028[_0x54ad('0x34')]=_['keys'](db[_0x54ad('0x70')][_0x54ad('0x31')]);_0x595028['query']=_[_0x54ad('0x36')](_0x198159['query']);_0x595028[_0x54ad('0x37')]=_[_0x54ad('0x38')](_0x595028[_0x54ad('0x34')],_0x595028['query']);_0x5b8b7d[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x595028[_0x54ad('0x34')],qs['fields'](_0x198159[_0x54ad('0x35')][_0x54ad('0x39')]));_0x5b8b7d[_0x54ad('0x3a')]=_0x5b8b7d['attributes'][_0x54ad('0x3b')]?_0x5b8b7d[_0x54ad('0x3a')]:_0x595028[_0x54ad('0x34')];_0x5b8b7d['order']=qs[_0x54ad('0x3f')](_0x198159['query'][_0x54ad('0x3f')]);_0x5b8b7d[_0x54ad('0x40')]=qs[_0x54ad('0x37')](_[_0x54ad('0x41')](_0x198159['query'],_0x595028[_0x54ad('0x37')]));_0x5b8b7d[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x5b8b7d[_0x54ad('0x40')],{'$or':[{'ListId':_0x12b3e6['id']},{'ListId':null}]});if(_0x198159[_0x54ad('0x35')][_0x54ad('0x42')]){_0x5b8b7d[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x5b8b7d[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x5b8b7d[_0x54ad('0x3a')],function(_0x5f1fc4){var _0x31d074={};_0x31d074[_0x5f1fc4]={'$like':'%'+_0x198159['query']['filter']+'%'};return _0x31d074;})});}_0x5b8b7d=_[_0x54ad('0x43')]({},_0x5b8b7d,_0x198159[_0x54ad('0x45')]);return db[_0x54ad('0x70')][_0x54ad('0x86')](_0x5b8b7d);}})[_0x54ad('0x2a')](respondWithResult(_0x2ab9ed,null))[_0x54ad('0x4b')](handleError(_0x2ab9ed,null));};exports[_0x54ad('0x87')]=function(_0x12259b,_0x5d8d2f,_0x2b7f7a){return db['CmList'][_0x54ad('0x54')]({'where':{'id':_0x12259b['params']['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x5d8d2f,null))[_0x54ad('0x2a')](function(_0x50683b){if(_0x50683b){return _0x50683b[_0x54ad('0x87')](_0x12259b[_0x54ad('0x4f')][_0x54ad('0x88')],_[_0x54ad('0x65')](_0x12259b[_0x54ad('0x4f')],[_0x54ad('0x88'),'id'])||{})[_0x54ad('0x89')](function(_0x4a9ad0){for(var _0x9c0c12=0x0;_0x9c0c12<_0x12259b['body']['ids'][_0x54ad('0x3b')];_0x9c0c12+=0x1){socket[_0x54ad('0x8a')](_0x54ad('0x8b'),{'UserId':_0x12259b['body'][_0x54ad('0x88')][_0x9c0c12],'CmListId':_0x12259b[_0x54ad('0x4d')]['id']});}return _0x4a9ad0;});}})['then'](respondWithResult(_0x5d8d2f,null))[_0x54ad('0x4b')](handleError(_0x5d8d2f,null));};exports[_0x54ad('0x8c')]=function(_0x5b9145,_0x26c542,_0x82551e){return db['CmList'][_0x54ad('0x54')]({'where':{'id':_0x5b9145[_0x54ad('0x4d')]['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x26c542,null))[_0x54ad('0x2a')](function(_0x4d9eda){if(_0x4d9eda){return _0x4d9eda[_0x54ad('0x8c')](_0x5b9145[_0x54ad('0x35')][_0x54ad('0x88')])[_0x54ad('0x2a')](function(){if(_[_0x54ad('0x62')](_0x5b9145['query'][_0x54ad('0x88')])){for(var _0x1f4ee8=0x0;_0x1f4ee8<_0x5b9145[_0x54ad('0x35')]['ids'][_0x54ad('0x3b')];_0x1f4ee8+=0x1){socket[_0x54ad('0x8a')](_0x54ad('0x8d'),{'UserId':Number(_0x5b9145['query'][_0x54ad('0x88')][_0x1f4ee8]),'CmListId':Number(_0x5b9145[_0x54ad('0x4d')]['id'])});}}else{socket['emit'](_0x54ad('0x8d'),{'UserId':Number(_0x5b9145[_0x54ad('0x35')][_0x54ad('0x88')]),'CmListId':Number(_0x5b9145['params']['id'])});}});}})['then'](respondWithStatusCode(_0x26c542,null))['catch'](handleError(_0x26c542,null));};exports[_0x54ad('0x8e')]=function(_0x161941,_0x59f385,_0x33561f){var _0x3da7d9={};var _0x2ad5c1={};var _0x265942;var _0x4c1278;return db[_0x54ad('0x46')][_0x54ad('0x5d')]({'where':{'id':_0x161941['params']['id']}})[_0x54ad('0x2a')](handleEntityNotFound(_0x59f385,null))[_0x54ad('0x2a')](function(_0x27ff18){if(_0x27ff18){_0x265942=_0x27ff18;_0x2ad5c1['model']=_['keys'](db[_0x54ad('0x8f')][_0x54ad('0x31')]);_0x2ad5c1[_0x54ad('0x35')]=_[_0x54ad('0x36')](_0x161941[_0x54ad('0x35')]);_0x2ad5c1[_0x54ad('0x37')]=_['intersection'](_0x2ad5c1['model'],_0x2ad5c1['query']);_0x3da7d9[_0x54ad('0x3a')]=_[_0x54ad('0x38')](_0x2ad5c1[_0x54ad('0x34')],qs[_0x54ad('0x39')](_0x161941['query'][_0x54ad('0x39')]));_0x3da7d9['attributes']=_0x3da7d9[_0x54ad('0x3a')]['length']?_0x3da7d9['attributes']:_0x2ad5c1[_0x54ad('0x34')];_0x3da7d9[_0x54ad('0x3e')]=qs[_0x54ad('0x3f')](_0x161941[_0x54ad('0x35')]['sort']);_0x3da7d9['where']=qs['filters'](_[_0x54ad('0x41')](_0x161941[_0x54ad('0x35')],_0x2ad5c1[_0x54ad('0x37')]));if(_0x161941[_0x54ad('0x35')][_0x54ad('0x42')]){_0x3da7d9[_0x54ad('0x40')]=_[_0x54ad('0x43')](_0x3da7d9[_0x54ad('0x40')],{'$or':_[_0x54ad('0x30')](_0x3da7d9[_0x54ad('0x3a')],function(_0x1c5959){var _0x4ac771={};_0x4ac771[_0x1c5959]={'$like':'%'+_0x161941[_0x54ad('0x35')]['filter']+'%'};return _0x4ac771;})});}_0x3da7d9=_['merge']({},_0x3da7d9,_0x161941[_0x54ad('0x45')]);return _0x265942['getAgents'](_0x3da7d9);}})[_0x54ad('0x2a')](function(_0xaf60bb){if(_0xaf60bb){_0x4c1278=_0xaf60bb[_0x54ad('0x3b')];if(!_0x161941[_0x54ad('0x35')]['hasOwnProperty'](_0x54ad('0x3d'))){_0x3da7d9['limit']=qs[_0x54ad('0x23')](_0x161941['query'][_0x54ad('0x23')]);_0x3da7d9[_0x54ad('0x22')]=qs[_0x54ad('0x22')](_0x161941[_0x54ad('0x35')][_0x54ad('0x22')]);}return _0x265942[_0x54ad('0x8e')](_0x3da7d9);}})[_0x54ad('0x2a')](function(_0x1d59b4){if(_0x1d59b4){return _0x1d59b4?{'count':_0x4c1278,'rows':_0x1d59b4}:null;}})[_0x54ad('0x2a')](respondWithResult(_0x59f385,null))[_0x54ad('0x4b')](handleError(_0x59f385,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9682915..79e520b 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 _0x2cba=['update','remove','emit','hasOwnProperty','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x114db7,_0x3c3d4b){var _0x391c20=function(_0x2c9a57){while(--_0x2c9a57){_0x114db7['push'](_0x114db7['shift']());}};_0x391c20(++_0x3c3d4b);}(_0x2cba,0xaf));var _0xa2cb=function(_0x428802,_0x31689d){_0x428802=_0x428802-0x0;var _0x11be43=_0x2cba[_0x428802];return _0x11be43;};'use strict';var EventEmitter=require(_0xa2cb('0x0'));var CmList=require(_0xa2cb('0x1'))['db'][_0xa2cb('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xa2cb('0x3')](0x0);var events={'afterCreate':_0xa2cb('0x4'),'afterUpdate':_0xa2cb('0x5'),'afterDestroy':_0xa2cb('0x6')};function emitEvent(_0x175e4d){return function(_0x3802c5,_0x42f7dd,_0xa44540){CmListEvents[_0xa2cb('0x7')](_0x175e4d+':'+_0x3802c5['id'],_0x3802c5);CmListEvents[_0xa2cb('0x7')](_0x175e4d,_0x3802c5);_0xa44540(null);};}for(var e in events){if(events[_0xa2cb('0x8')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x47f7=['save','emit','hasOwnProperty','hook'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x47f7,0x158));var _0x747f=function(_0x44b904,_0x41a5cf){_0x44b904=_0x44b904-0x0;var _0x314d4d=_0x47f7[_0x44b904];return _0x314d4d;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x747f('0x0'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3898b5){return function(_0x22c26c,_0x32a888,_0x2eb2c5){CmListEvents['emit'](_0x3898b5+':'+_0x22c26c['id'],_0x22c26c);CmListEvents[_0x747f('0x1')](_0x3898b5,_0x22c26c);_0x2eb2c5(null);};}for(var e in events){if(events[_0x747f('0x2')](e)){var event=events[e];CmList[_0x747f('0x3')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4b90462..05a7854 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 _0x7e07=['api','bluebird','request-promise','path','../../config/environment','exports','define','CmList','lodash','util','../../config/logger'];(function(_0x341e52,_0x1ee60c){var _0x5d2890=function(_0x5ce075){while(--_0x5ce075){_0x341e52['push'](_0x341e52['shift']());}};_0x5d2890(++_0x1ee60c);}(_0x7e07,0x15d));var _0x77e0=function(_0x246f80,_0x3e1148){_0x246f80=_0x246f80-0x0;var _0x5dd512=_0x7e07[_0x246f80];return _0x5dd512;};'use strict';var _=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var logger=require(_0x77e0('0x2'))(_0x77e0('0x3'));var moment=require('moment');var BPromise=require(_0x77e0('0x4'));var rp=require(_0x77e0('0x5'));var fs=require('fs');var path=require(_0x77e0('0x6'));var rimraf=require('rimraf');var config=require(_0x77e0('0x7'));var attributes=require('./cmList.attributes');module[_0x77e0('0x8')]=function(_0x39b3e1,_0x528077){return _0x39b3e1[_0x77e0('0x9')](_0x77e0('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e3e=['CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes','exports','define'];(function(_0xcf883a,_0x58484a){var _0x360562=function(_0x1a8528){while(--_0x1a8528){_0xcf883a['push'](_0xcf883a['shift']());}};_0x360562(++_0x58484a);}(_0x5e3e,0x1d6));var _0xe5e3=function(_0xe34ce5,_0x1a08c7){_0xe34ce5=_0xe34ce5-0x0;var _0x3067ec=_0x5e3e[_0xe34ce5];return _0x3067ec;};'use strict';var _=require(_0xe5e3('0x0'));var util=require(_0xe5e3('0x1'));var logger=require(_0xe5e3('0x2'))('api');var moment=require(_0xe5e3('0x3'));var BPromise=require(_0xe5e3('0x4'));var rp=require(_0xe5e3('0x5'));var fs=require('fs');var path=require(_0xe5e3('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e3('0x7'));var attributes=require(_0xe5e3('0x8'));module[_0xe5e3('0x9')]=function(_0x570df2,_0x2ed6f5){return _0x570df2[_0xe5e3('0xa')](_0xe5e3('0xb'),attributes,{'tableName':_0xe5e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 6718bf1..fdad1a6 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 _0xcf42=['rpc','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmList,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5db688,_0xe12614){var _0x388437=function(_0x195ae6){while(--_0x195ae6){_0x5db688['push'](_0x5db688['shift']());}};_0x388437(++_0xe12614);}(_0xcf42,0x1f0));var _0x2cf4=function(_0x34a355,_0x2031f8){_0x34a355=_0x34a355-0x0;var _0x3338b6=_0xcf42[_0x34a355];return _0x3338b6;};'use strict';var _=require('lodash');var util=require(_0x2cf4('0x0'));var moment=require(_0x2cf4('0x1'));var BPromise=require(_0x2cf4('0x2'));var rs=require(_0x2cf4('0x3'));var fs=require('fs');var Redis=require(_0x2cf4('0x4'));var db=require(_0x2cf4('0x5'))['db'];var utils=require(_0x2cf4('0x6'));var logger=require(_0x2cf4('0x7'))(_0x2cf4('0x8'));var config=require('../../config/environment');var jayson=require(_0x2cf4('0x9'));var client=jayson[_0x2cf4('0xa')][_0x2cf4('0xb')]({'port':0x232a});config[_0x2cf4('0xc')]=_[_0x2cf4('0xd')](config['redis'],{'host':_0x2cf4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cf4('0xc')]));require(_0x2cf4('0xf'))[_0x2cf4('0x10')](socket);function respondWithRpcPromise(_0x2764df,_0xa95b9e,_0x3a1dec){return new BPromise(function(_0x4e10be,_0x48c289){return client[_0x2cf4('0x11')](_0x2764df,_0x3a1dec)[_0x2cf4('0x12')](function(_0x59fb5d){logger['info']('CmList,\x20%s,\x20%s',_0xa95b9e,'request\x20sent');logger['debug'](_0x2cf4('0x13'),_0xa95b9e,_0x2cf4('0x14'),JSON[_0x2cf4('0x15')](_0x59fb5d));if(_0x59fb5d[_0x2cf4('0x16')]){if(_0x59fb5d[_0x2cf4('0x16')]['code']===0x1f4){logger['error'](_0x2cf4('0x17'),_0xa95b9e,_0x59fb5d[_0x2cf4('0x16')][_0x2cf4('0x18')]);return _0x48c289(_0x59fb5d[_0x2cf4('0x16')]['message']);}logger[_0x2cf4('0x16')]('CmList,\x20%s,\x20%s',_0xa95b9e,_0x59fb5d['error'][_0x2cf4('0x18')]);return _0x4e10be(_0x59fb5d['error'][_0x2cf4('0x18')]);}else{logger[_0x2cf4('0x19')]('CmList,\x20%s,\x20%s',_0xa95b9e,_0x2cf4('0x14'));_0x4e10be(_0x59fb5d[_0x2cf4('0x1a')][_0x2cf4('0x18')]);}})[_0x2cf4('0x1b')](function(_0x4643d9){logger[_0x2cf4('0x16')]('CmList,\x20%s,\x20%s',_0xa95b9e,_0x4643d9);_0x48c289(_0x4643d9);});});} \ No newline at end of file +var _0x21b4=['debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x18f10a,_0x35f5a7){var _0xd7c3c9=function(_0x5afef){while(--_0x5afef){_0x18f10a['push'](_0x18f10a['shift']());}};_0xd7c3c9(++_0x35f5a7);}(_0x21b4,0x116));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x421b('0x0'));var util=require('util');var moment=require(_0x421b('0x1'));var BPromise=require(_0x421b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x421b('0x3'));var db=require(_0x421b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x421b('0x5'))(_0x421b('0x6'));var config=require(_0x421b('0x7'));var jayson=require(_0x421b('0x8'));var client=jayson[_0x421b('0x9')][_0x421b('0xa')]({'port':0x232a});config[_0x421b('0xb')]=_[_0x421b('0xc')](config[_0x421b('0xb')],{'host':_0x421b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x421b('0xb')]));require(_0x421b('0xe'))[_0x421b('0xf')](socket);function respondWithRpcPromise(_0x596703,_0x2ac5d4,_0x5778eb){return new BPromise(function(_0x48e051,_0x4bd2ba){return client[_0x421b('0x10')](_0x596703,_0x5778eb)['then'](function(_0x1d1f80){logger['info'](_0x421b('0x11'),_0x2ac5d4,_0x421b('0x12'));logger[_0x421b('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x2ac5d4,'request\x20sent',JSON[_0x421b('0x14')](_0x1d1f80));if(_0x1d1f80[_0x421b('0x15')]){if(_0x1d1f80['error'][_0x421b('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2ac5d4,_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);return _0x4bd2ba(_0x1d1f80['error'][_0x421b('0x17')]);}logger[_0x421b('0x15')]('CmList,\x20%s,\x20%s',_0x2ac5d4,_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);return _0x48e051(_0x1d1f80[_0x421b('0x15')][_0x421b('0x17')]);}else{logger[_0x421b('0x18')](_0x421b('0x11'),_0x2ac5d4,_0x421b('0x12'));_0x48e051(_0x1d1f80[_0x421b('0x19')][_0x421b('0x17')]);}})[_0x421b('0x1a')](function(_0x3df829){logger[_0x421b('0x15')](_0x421b('0x11'),_0x2ac5d4,_0x3df829);_0x4bd2ba(_0x3df829);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c675420..2f118b8 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 _0xc949=['cmList:','./cmList.events','remove','update','emit','removeListener','register','length'];(function(_0x40f713,_0x179bee){var _0x467aed=function(_0xdff5f9){while(--_0xdff5f9){_0x40f713['push'](_0x40f713['shift']());}};_0x467aed(++_0x179bee);}(_0xc949,0x181));var _0x9c94=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xc949[_0x1da04e];return _0xdd8c41;};'use strict';var CmListEvents=require(_0x9c94('0x0'));var events=['save',_0x9c94('0x1'),_0x9c94('0x2')];function createListener(_0x209cd8,_0x27613f){return function(_0x54facf){_0x27613f[_0x9c94('0x3')](_0x209cd8,_0x54facf);};}function removeListener(_0x231762,_0x528a17){return function(){CmListEvents[_0x9c94('0x4')](_0x231762,_0x528a17);};}exports[_0x9c94('0x5')]=function(_0x46d560){for(var _0x1357ac=0x0,_0x57fcd7=events[_0x9c94('0x6')];_0x1357ac<_0x57fcd7;_0x1357ac++){var _0x360e7b=events[_0x1357ac];var _0x25ecd0=createListener(_0x9c94('0x7')+_0x360e7b,_0x46d560);CmListEvents['on'](_0x360e7b,_0x25ecd0);}}; \ No newline at end of file +var _0x687b=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x261d17,_0x115fe1){var _0x5a50da=function(_0x409fc0){while(--_0x409fc0){_0x261d17['push'](_0x261d17['shift']());}};_0x5a50da(++_0x115fe1);}(_0x687b,0x14a));var _0xb687=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0x687b[_0x282916];return _0x317b39;};'use strict';var CmListEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){CmListEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);CmListEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ba71c44..26e730e 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 _0xcbd7=['getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','/:id/contacts','addContacts','addCustomField','destroy','delete','removeDispositions','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions'];(function(_0x1232f9,_0x5aa500){var _0x43f173=function(_0x3ff4a5){while(--_0x3ff4a5){_0x1232f9['push'](_0x1232f9['shift']());}};_0x43f173(++_0x5aa500);}(_0xcbd7,0x197));var _0x7cbd=function(_0x27b1ac,_0x19a301){_0x27b1ac=_0x27b1ac-0x0;var _0x2ac1f3=_0xcbd7[_0x27b1ac];return _0x2ac1f3;};'use strict';var multer=require('multer');var util=require(_0x7cbd('0x0'));var path=require('path');var timeout=require(_0x7cbd('0x1'));var express=require('express');var router=express[_0x7cbd('0x2')]();var auth=require(_0x7cbd('0x3'));var interaction=require(_0x7cbd('0x4'));var config=require('../../config/environment');var controller=require(_0x7cbd('0x5'));router[_0x7cbd('0x6')]('/',auth[_0x7cbd('0x7')](),controller['index']);router[_0x7cbd('0x6')](_0x7cbd('0x8'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x9')]);router[_0x7cbd('0x6')](_0x7cbd('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7cbd('0xb'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xc')]);router[_0x7cbd('0x6')]('/:id/contacts',auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xd')]);router['get'](_0x7cbd('0xe'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0xf')]);router[_0x7cbd('0x6')](_0x7cbd('0x10'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x11')]);router[_0x7cbd('0x6')](_0x7cbd('0x12'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x13')]);router['post']('/',auth[_0x7cbd('0x7')](),controller['create']);router[_0x7cbd('0x14')](_0x7cbd('0xb'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x15')]);router[_0x7cbd('0x14')](_0x7cbd('0x16'),auth['isAuthenticated'](),controller[_0x7cbd('0x17')]);router[_0x7cbd('0x14')](_0x7cbd('0x10'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x18')]);router[_0x7cbd('0x14')](_0x7cbd('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7cbd('0xa'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x19')]);router[_0x7cbd('0x1a')](_0x7cbd('0xb'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x1b')]);router[_0x7cbd('0x1a')](_0x7cbd('0x12'),auth[_0x7cbd('0x7')](),controller[_0x7cbd('0x1c')]);module[_0x7cbd('0x1d')]=router; \ No newline at end of file +var _0x901e=['removeAgents','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addCustomField','addAgents','put','update','delete','removeDispositions'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x901e,0x1a1));var _0xe901=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x901e[_0x14490c];return _0x2f6825;};'use strict';var multer=require(_0xe901('0x0'));var util=require(_0xe901('0x1'));var path=require(_0xe901('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe901('0x3')]();var auth=require(_0xe901('0x4'));var interaction=require(_0xe901('0x5'));var config=require('../../config/environment');var controller=require(_0xe901('0x6'));router[_0xe901('0x7')]('/',auth['isAuthenticated'](),controller[_0xe901('0x8')]);router['get'](_0xe901('0x9'),auth[_0xe901('0xa')](),controller[_0xe901('0xb')]);router[_0xe901('0x7')](_0xe901('0xc'),auth['isAuthenticated'](),controller[_0xe901('0xd')]);router[_0xe901('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe901('0xe')]);router[_0xe901('0x7')](_0xe901('0xf'),auth[_0xe901('0xa')](),controller[_0xe901('0x10')]);router[_0xe901('0x7')](_0xe901('0x11'),auth[_0xe901('0xa')](),controller[_0xe901('0x12')]);router[_0xe901('0x7')](_0xe901('0x13'),auth[_0xe901('0xa')](),controller[_0xe901('0x14')]);router[_0xe901('0x7')](_0xe901('0x15'),auth[_0xe901('0xa')](),controller['getAgents']);router[_0xe901('0x16')]('/',auth[_0xe901('0xa')](),controller[_0xe901('0x17')]);router[_0xe901('0x16')](_0xe901('0x18'),auth[_0xe901('0xa')](),controller['addDisposition']);router[_0xe901('0x16')](_0xe901('0xf'),auth[_0xe901('0xa')](),controller['addContacts']);router[_0xe901('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe901('0x19')]);router['post'](_0xe901('0x15'),auth[_0xe901('0xa')](),controller[_0xe901('0x1a')]);router[_0xe901('0x1b')](_0xe901('0xc'),auth[_0xe901('0xa')](),controller[_0xe901('0x1c')]);router[_0xe901('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xe901('0x1d')](_0xe901('0x18'),auth[_0xe901('0xa')](),controller[_0xe901('0x1e')]);router[_0xe901('0x1d')]('/:id/users',auth[_0xe901('0xa')](),controller[_0xe901('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 155dea4..1f41017 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x7664d9,_0x24e562){var _0x3b9def=function(_0x56e7fe){while(--_0x56e7fe){_0x7664d9['push'](_0x7664d9['shift']());}};_0x3b9def(++_0x24e562);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x38695b,_0x2fa3cb){var _0x5b36dd=function(_0x155f18){while(--_0x155f18){_0x38695b['push'](_0x38695b['shift']());}};_0x5b36dd(++_0x2fa3cb);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 8389267..c0754c2 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 _0x44d5=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','then','stack','name','send','body','Condition','find','catch','destroy','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x195919,_0x177c79){var _0x2aa39d=function(_0x31841c){while(--_0x31841c){_0x195919['push'](_0x195919['shift']());}};_0x2aa39d(++_0x177c79);}(_0x44d5,0xa1));var _0x544d=function(_0x15f603,_0x19466a){_0x15f603=_0x15f603-0x0;var _0x26fd2e=_0x44d5[_0x15f603];return _0x26fd2e;};'use strict';var pdf=require(_0x544d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x544d('0x1'));var jsonpatch=require(_0x544d('0x2'));var rp=require(_0x544d('0x3'));var moment=require(_0x544d('0x4'));var BPromise=require(_0x544d('0x5'));var Mustache=require(_0x544d('0x6'));var util=require('util');var path=require(_0x544d('0x7'));var sox=require(_0x544d('0x8'));var csv=require(_0x544d('0x9'));var ejs=require(_0x544d('0xa'));var fs=require('fs');var _=require(_0x544d('0xb'));var squel=require(_0x544d('0xc'));var crypto=require(_0x544d('0xd'));var jsforce=require(_0x544d('0xe'));var deskjs=require(_0x544d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x544d('0x10'));var Papa=require(_0x544d('0x11'));var Redis=require(_0x544d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x544d('0x13'));var hardwareService=require(_0x544d('0x14'));var logger=require('../../config/logger')(_0x544d('0x15'));var utils=require(_0x544d('0x16'));var config=require(_0x544d('0x17'));var db=require(_0x544d('0x18'))['db'];function respondWithStatusCode(_0x4d6add,_0x27a6c7){_0x27a6c7=_0x27a6c7||0xcc;return function(_0xae4d82){if(_0xae4d82){return _0x4d6add[_0x544d('0x19')](_0x27a6c7);}return _0x4d6add[_0x544d('0x1a')](_0x27a6c7)[_0x544d('0x1b')]();};}function respondWithResult(_0x20fe25,_0xb30740){_0xb30740=_0xb30740||0xc8;return function(_0x3ea2fb){if(_0x3ea2fb){return _0x20fe25['status'](_0xb30740)[_0x544d('0x1c')](_0x3ea2fb);}};}function respondWithFilteredResult(_0x99057,_0xadbded){return function(_0x46ea34){if(_0x46ea34){var _0x2cf1ed=_0x46ea34[_0x544d('0x1d')],_0x5af934=_0xadbded['offset'],_0x28e341=_0xadbded['offset']+_0xadbded['limit'],_0x348f76;if(_0x28e341>=_0x2cf1ed){_0x28e341=_0x2cf1ed;_0x348f76=0xc8;}else{_0x348f76=0xce;}_0x99057[_0x544d('0x1a')](_0x348f76);return _0x99057[_0x544d('0x1e')](_0x544d('0x1f'),_0x5af934+'-'+_0x28e341+'/'+_0x2cf1ed)[_0x544d('0x1c')](_0x46ea34);}return null;};}function patchUpdates(_0x3922d9){return function(_0x57f384){try{jsonpatch[_0x544d('0x20')](_0x57f384,_0x3922d9,!![]);}catch(_0x5ac330){return BPromise['reject'](_0x5ac330);}return _0x57f384[_0x544d('0x21')]();};}function saveUpdates(_0x472589,_0x3d847d){return function(_0x395ebb){if(_0x395ebb){return _0x395ebb[_0x544d('0x22')](_0x472589)[_0x544d('0x23')](function(_0x142fb){return _0x142fb;});}return null;};}function removeEntity(_0x4681d2,_0x5bbc86){return function(_0x1bb8a5){if(_0x1bb8a5){return _0x1bb8a5['destroy']()[_0x544d('0x23')](function(){_0x4681d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420f37,_0x583b8f){return function(_0x4d4d0d){if(!_0x4d4d0d){_0x420f37['sendStatus'](0x194);}return _0x4d4d0d;};}function handleError(_0x3b1f52,_0xef93c2){_0xef93c2=_0xef93c2||0x1f4;return function(_0x4617a0){logger['error'](_0x4617a0[_0x544d('0x24')]);if(_0x4617a0[_0x544d('0x25')]){delete _0x4617a0['name'];}_0x3b1f52[_0x544d('0x1a')](_0xef93c2)[_0x544d('0x26')](_0x4617a0);};}exports[_0x544d('0x22')]=function(_0x11c952,_0x30e737){if(_0x11c952[_0x544d('0x27')]['id']){delete _0x11c952[_0x544d('0x27')]['id'];}return db[_0x544d('0x28')][_0x544d('0x29')]({'where':{'id':_0x11c952['params']['id']}})[_0x544d('0x23')](handleEntityNotFound(_0x30e737,null))['then'](saveUpdates(_0x11c952[_0x544d('0x27')],null))[_0x544d('0x23')](respondWithResult(_0x30e737,null))[_0x544d('0x2a')](handleError(_0x30e737,null));};exports[_0x544d('0x2b')]=function(_0x45d105,_0x19d78b){return db['Condition'][_0x544d('0x29')]({'where':{'id':_0x45d105[_0x544d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x19d78b,null))[_0x544d('0x23')](removeEntity(_0x19d78b,null))['catch'](handleError(_0x19d78b,null));}; \ No newline at end of file +var _0xc4e1=['squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','json','status','set','apply','reject','save','update','destroy','end','error','stack','name','send','body','Condition','params','then','catch','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash'];(function(_0x17e61b,_0x39ff4f){var _0x1e75b4=function(_0x2b574e){while(--_0x2b574e){_0x17e61b['push'](_0x17e61b['shift']());}};_0x1e75b4(++_0x39ff4f);}(_0xc4e1,0x172));var _0x1c4e=function(_0x350e37,_0x3653d8){_0x350e37=_0x350e37-0x0;var _0x10eff5=_0xc4e1[_0x350e37];return _0x10eff5;};'use strict';var pdf=require(_0x1c4e('0x0'));var emlformat=require(_0x1c4e('0x1'));var rimraf=require(_0x1c4e('0x2'));var zipdir=require(_0x1c4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c4e('0x4'));var moment=require('moment');var BPromise=require(_0x1c4e('0x5'));var Mustache=require('mustache');var util=require(_0x1c4e('0x6'));var path=require('path');var sox=require(_0x1c4e('0x7'));var csv=require(_0x1c4e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c4e('0x9'));var squel=require(_0x1c4e('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c4e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c4e('0xc'));var Papa=require('papaparse');var Redis=require(_0x1c4e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1c4e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c4e('0x10'));var db=require(_0x1c4e('0x11'))['db'];function respondWithStatusCode(_0x25aa73,_0x4f4eec){_0x4f4eec=_0x4f4eec||0xcc;return function(_0x275b90){if(_0x275b90){return _0x25aa73[_0x1c4e('0x12')](_0x4f4eec);}return _0x25aa73['status'](_0x4f4eec)['end']();};}function respondWithResult(_0x4f72ee,_0x119d51){_0x119d51=_0x119d51||0xc8;return function(_0x2b6459){if(_0x2b6459){return _0x4f72ee['status'](_0x119d51)[_0x1c4e('0x13')](_0x2b6459);}};}function respondWithFilteredResult(_0x39d06e,_0x10555f){return function(_0x31708b){if(_0x31708b){var _0x2d55bb=_0x31708b['count'],_0x4b12b3=_0x10555f['offset'],_0x17259a=_0x10555f['offset']+_0x10555f['limit'],_0x3d4bd4;if(_0x17259a>=_0x2d55bb){_0x17259a=_0x2d55bb;_0x3d4bd4=0xc8;}else{_0x3d4bd4=0xce;}_0x39d06e[_0x1c4e('0x14')](_0x3d4bd4);return _0x39d06e[_0x1c4e('0x15')]('Content-Range',_0x4b12b3+'-'+_0x17259a+'/'+_0x2d55bb)[_0x1c4e('0x13')](_0x31708b);}return null;};}function patchUpdates(_0x366529){return function(_0x3b0b4a){try{jsonpatch[_0x1c4e('0x16')](_0x3b0b4a,_0x366529,!![]);}catch(_0x101b27){return BPromise[_0x1c4e('0x17')](_0x101b27);}return _0x3b0b4a[_0x1c4e('0x18')]();};}function saveUpdates(_0x1e9b11,_0x24a1c7){return function(_0x491fdb){if(_0x491fdb){return _0x491fdb[_0x1c4e('0x19')](_0x1e9b11)['then'](function(_0x29b574){return _0x29b574;});}return null;};}function removeEntity(_0x1aebaa,_0x300b16){return function(_0x1353e4){if(_0x1353e4){return _0x1353e4[_0x1c4e('0x1a')]()['then'](function(){_0x1aebaa[_0x1c4e('0x14')](0xcc)[_0x1c4e('0x1b')]();});}};}function handleEntityNotFound(_0x20f93d,_0x41bbe6){return function(_0x18ee91){if(!_0x18ee91){_0x20f93d[_0x1c4e('0x12')](0x194);}return _0x18ee91;};}function handleError(_0x58c9d1,_0x3a52a0){_0x3a52a0=_0x3a52a0||0x1f4;return function(_0x1ea890){logger[_0x1c4e('0x1c')](_0x1ea890[_0x1c4e('0x1d')]);if(_0x1ea890[_0x1c4e('0x1e')]){delete _0x1ea890[_0x1c4e('0x1e')];}_0x58c9d1['status'](_0x3a52a0)[_0x1c4e('0x1f')](_0x1ea890);};}exports[_0x1c4e('0x19')]=function(_0x5925aa,_0x256e72){if(_0x5925aa[_0x1c4e('0x20')]['id']){delete _0x5925aa[_0x1c4e('0x20')]['id'];}return db[_0x1c4e('0x21')]['find']({'where':{'id':_0x5925aa[_0x1c4e('0x22')]['id']}})[_0x1c4e('0x23')](handleEntityNotFound(_0x256e72,null))[_0x1c4e('0x23')](saveUpdates(_0x5925aa['body'],null))[_0x1c4e('0x23')](respondWithResult(_0x256e72,null))[_0x1c4e('0x24')](handleError(_0x256e72,null));};exports[_0x1c4e('0x1a')]=function(_0x1b354c,_0x5bcb92){return db[_0x1c4e('0x21')][_0x1c4e('0x25')]({'where':{'id':_0x1b354c[_0x1c4e('0x22')]['id']}})[_0x1c4e('0x23')](handleEntityNotFound(_0x5bcb92,null))['then'](removeEntity(_0x5bcb92,null))['catch'](handleError(_0x5bcb92,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index cbf8b86..8c96c99 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 _0xf73b=['bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x1dc01f,_0x157a75){var _0x298041=function(_0x47fce1){while(--_0x47fce1){_0x1dc01f['push'](_0x1dc01f['shift']());}};_0x298041(++_0x157a75);}(_0xf73b,0x95));var _0xbf73=function(_0x56fa56,_0x5a0c7d){_0x56fa56=_0x56fa56-0x0;var _0x35d445=_0xf73b[_0x56fa56];return _0x35d445;};'use strict';var _=require(_0xbf73('0x0'));var util=require(_0xbf73('0x1'));var logger=require(_0xbf73('0x2'))(_0xbf73('0x3'));var moment=require(_0xbf73('0x4'));var BPromise=require(_0xbf73('0x5'));var rp=require(_0xbf73('0x6'));var fs=require('fs');var path=require(_0xbf73('0x7'));var rimraf=require(_0xbf73('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf73('0x9'));module[_0xbf73('0xa')]=function(_0x394e45,_0x45eb54){return _0x394e45[_0xbf73('0xb')](_0xbf73('0xc'),attributes,{'tableName':_0xbf73('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x688a=['exports','define','Condition','lodash','util','api','moment','bluebird','../../config/environment','./condition.attributes'];(function(_0x3ab5a7,_0x41642a){var _0x3029ff=function(_0x630ff7){while(--_0x630ff7){_0x3ab5a7['push'](_0x3ab5a7['shift']());}};_0x3029ff(++_0x41642a);}(_0x688a,0x67));var _0xa688=function(_0x5650ee,_0x21b5a4){_0x5650ee=_0x5650ee-0x0;var _0x3fd65c=_0x688a[_0x5650ee];return _0x3fd65c;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var logger=require('../../config/logger')(_0xa688('0x2'));var moment=require(_0xa688('0x3'));var BPromise=require(_0xa688('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa688('0x5'));var attributes=require(_0xa688('0x6'));module[_0xa688('0x7')]=function(_0x31f5a6,_0x3c8fcd){return _0x31f5a6[_0xa688('0x8')](_0xa688('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 5b02c85..89aee37 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 _0xf1dc=['jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xc4553d,_0x50cf13){var _0xeff54f=function(_0x49bf94){while(--_0x49bf94){_0xc4553d['push'](_0xc4553d['shift']());}};_0xeff54f(++_0x50cf13);}(_0xf1dc,0x157));var _0xcf1d=function(_0xcefb4,_0x46cbf8){_0xcefb4=_0xcefb4-0x0;var _0x29e43f=_0xf1dc[_0xcefb4];return _0x29e43f;};'use strict';var _=require(_0xcf1d('0x0'));var util=require(_0xcf1d('0x1'));var moment=require(_0xcf1d('0x2'));var BPromise=require(_0xcf1d('0x3'));var rs=require(_0xcf1d('0x4'));var fs=require('fs');var Redis=require(_0xcf1d('0x5'));var db=require(_0xcf1d('0x6'))['db'];var utils=require(_0xcf1d('0x7'));var logger=require('../../config/logger')(_0xcf1d('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf1d('0x9'));var client=jayson['client'][_0xcf1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d01a4,_0x4f9399,_0x44117a){return new BPromise(function(_0x1c48a7,_0x2ad006){return client[_0xcf1d('0xb')](_0x2d01a4,_0x44117a)[_0xcf1d('0xc')](function(_0x13d398){logger[_0xcf1d('0xd')](_0xcf1d('0xe'),_0x4f9399,_0xcf1d('0xf'));logger[_0xcf1d('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x4f9399,_0xcf1d('0xf'),JSON[_0xcf1d('0x11')](_0x13d398));if(_0x13d398[_0xcf1d('0x12')]){if(_0x13d398['error'][_0xcf1d('0x13')]===0x1f4){logger['error'](_0xcf1d('0xe'),_0x4f9399,_0x13d398[_0xcf1d('0x12')][_0xcf1d('0x14')]);return _0x2ad006(_0x13d398[_0xcf1d('0x12')][_0xcf1d('0x14')]);}logger[_0xcf1d('0x12')]('Condition,\x20%s,\x20%s',_0x4f9399,_0x13d398[_0xcf1d('0x12')][_0xcf1d('0x14')]);return _0x1c48a7(_0x13d398[_0xcf1d('0x12')]['message']);}else{logger[_0xcf1d('0xd')](_0xcf1d('0xe'),_0x4f9399,_0xcf1d('0xf'));_0x1c48a7(_0x13d398[_0xcf1d('0x15')]['message']);}})['catch'](function(_0x1d7037){logger[_0xcf1d('0x12')](_0xcf1d('0xe'),_0x4f9399,_0x1d7037);_0x2ad006(_0x1d7037);});});} \ No newline at end of file +var _0xd723=['http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0xd723,0x1af));var _0x3d72=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd723[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x3d72('0x0'));var util=require('util');var moment=require(_0x3d72('0x1'));var BPromise=require(_0x3d72('0x2'));var rs=require(_0x3d72('0x3'));var fs=require('fs');var Redis=require(_0x3d72('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d72('0x5'))(_0x3d72('0x6'));var config=require(_0x3d72('0x7'));var jayson=require(_0x3d72('0x8'));var client=jayson['client'][_0x3d72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593005,_0x4b0a8d,_0x40a53b){return new BPromise(function(_0x4044f6,_0x2cc90a){return client[_0x3d72('0xa')](_0x593005,_0x40a53b)[_0x3d72('0xb')](function(_0x1f74c){logger['info'](_0x3d72('0xc'),_0x4b0a8d,_0x3d72('0xd'));logger[_0x3d72('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x4b0a8d,_0x3d72('0xd'),JSON[_0x3d72('0xf')](_0x1f74c));if(_0x1f74c[_0x3d72('0x10')]){if(_0x1f74c[_0x3d72('0x10')]['code']===0x1f4){logger[_0x3d72('0x10')]('Condition,\x20%s,\x20%s',_0x4b0a8d,_0x1f74c['error'][_0x3d72('0x11')]);return _0x2cc90a(_0x1f74c['error'][_0x3d72('0x11')]);}logger[_0x3d72('0x10')]('Condition,\x20%s,\x20%s',_0x4b0a8d,_0x1f74c[_0x3d72('0x10')][_0x3d72('0x11')]);return _0x4044f6(_0x1f74c[_0x3d72('0x10')][_0x3d72('0x11')]);}else{logger['info'](_0x3d72('0xc'),_0x4b0a8d,_0x3d72('0xd'));_0x4044f6(_0x1f74c[_0x3d72('0x12')][_0x3d72('0x11')]);}})[_0x3d72('0x13')](function(_0x3f384d){logger[_0x3d72('0x10')](_0x3d72('0xc'),_0x4b0a8d,_0x3f384d);_0x2cc90a(_0x3f384d);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 62f5d95..6565714 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 _0x8d31=['Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','destroy','multer','util','path','express'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x8d31,0x1c4));var _0x18d3=function(_0x43537e,_0x508c24){_0x43537e=_0x43537e-0x0;var _0x2465ee=_0x8d31[_0x43537e];return _0x2465ee;};'use strict';var multer=require(_0x18d3('0x0'));var util=require(_0x18d3('0x1'));var path=require(_0x18d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x18d3('0x3'));var router=express[_0x18d3('0x4')]();var auth=require(_0x18d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x18d3('0x6'));var controller=require(_0x18d3('0x7'));router[_0x18d3('0x8')](_0x18d3('0x9'),auth[_0x18d3('0xa')](),controller['update']);router['delete'](_0x18d3('0x9'),auth[_0x18d3('0xa')](),controller[_0x18d3('0xb')]);module['exports']=router; \ No newline at end of file +var _0x5c3e=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5c3e,0x95));var _0xe5c3=function(_0x4ece16,_0x580a80){_0x4ece16=_0x4ece16-0x0;var _0x272152=_0x5c3e[_0x4ece16];return _0x272152;};'use strict';var multer=require(_0xe5c3('0x0'));var util=require('util');var path=require(_0xe5c3('0x1'));var timeout=require(_0xe5c3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe5c3('0x3'));var interaction=require(_0xe5c3('0x4'));var config=require(_0xe5c3('0x5'));var controller=require('./condition.controller');router[_0xe5c3('0x6')](_0xe5c3('0x7'),auth[_0xe5c3('0x8')](),controller[_0xe5c3('0x9')]);router[_0xe5c3('0xa')](_0xe5c3('0x7'),auth[_0xe5c3('0x8')](),controller[_0xe5c3('0xb')]);module[_0xe5c3('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 6a06279..c5649e6 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 _0xae1c=['STRING','INTEGER'];(function(_0x254dc7,_0xd6b6d0){var _0x16a3c4=function(_0x2ee67c){while(--_0x2ee67c){_0x254dc7['push'](_0x254dc7['shift']());}};_0x16a3c4(++_0xd6b6d0);}(_0xae1c,0xff));var _0xcae1=function(_0x5a8c9f,_0x4affdd){_0x5a8c9f=_0x5a8c9f-0x0;var _0x6efc96=_0xae1c[_0x5a8c9f];return _0x6efc96;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xcae1('0x0')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xcae1('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x394e=['STRING','sequelize','exports','name','INTEGER'];(function(_0x35000d,_0xc8945c){var _0x2b856f=function(_0x3d8eb2){while(--_0x3d8eb2){_0x35000d['push'](_0x35000d['shift']());}};_0x2b856f(++_0xc8945c);}(_0x394e,0x88));var _0xe394=function(_0x3a0aef,_0x4815f2){_0x3a0aef=_0x3a0aef-0x0;var _0x837448=_0x394e[_0x3a0aef];return _0x837448;};'use strict';var Sequelize=require(_0xe394('0x0'));module[_0xe394('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe394('0x2')},'OrderBy':{'type':Sequelize[_0xe394('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe394('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index f831dfa..7487615 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 _0x9c44=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','error','name','send','map','ContactItemType','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x37e0f6,_0x16d9d2){var _0xe5bfc6=function(_0x563419){while(--_0x563419){_0x37e0f6['push'](_0x37e0f6['shift']());}};_0xe5bfc6(++_0x16d9d2);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']),_0x29f835);if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':!![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x1f')]=function(_0x156748,_0x25d174){if(_0x156748[_0x49c4('0x43')]['id']){delete _0x156748[_0x49c4('0x43')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x156748[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x25d174,null))['then'](saveUpdates(_0x156748['body'],null))[_0x49c4('0x20')](respondWithResult(_0x25d174,null))['catch'](handleError(_0x25d174,null));};exports['destroy']=function(_0x3208c2,_0x4081a5){return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x3208c2[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x4081a5,null))[_0x49c4('0x20')](removeEntity(_0x4081a5,null))['catch'](handleError(_0x4081a5,null));}; \ No newline at end of file +var _0x34e8=['then','ContactItemTypes','destroy','sendStatus','error','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x44922f,_0x4500fd){_0x44922f=_0x44922f-0x0;var _0x3d0d2f=_0x34e8[_0x44922f];return _0x3d0d2f;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']),_0xb5bc06);if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x4a')]=function(_0x30568e,_0x40ff5a){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x30568e[_0x834e('0x4b')],{})[_0x834e('0x28')](function(_0x1419eb){var _0x390c45=_0x30568e[_0x834e('0x4c')][_0x834e('0x4d')]({'plain':!![]});if(!_0x390c45)throw new Error(_0x834e('0x4e'));if(_0x390c45[_0x834e('0x4f')]===_0x834e('0x4c')){var _0x1a3855=_0x1419eb[_0x834e('0x4d')]({'plain':!![]});var _0x32b8f7=_0x834e('0x29');return db[_0x834e('0x50')]['find']({'where':{'name':_0x32b8f7,'userProfileId':_0x390c45[_0x834e('0x51')]},'raw':!![]})[_0x834e('0x28')](function(_0x4e73e0){if(_0x4e73e0&&_0x4e73e0[_0x834e('0x52')]===0x0){return db[_0x834e('0x53')]['create']({'name':_0x1a3855[_0x834e('0x2e')],'resourceId':_0x1a3855['id'],'type':_0x4e73e0[_0x834e('0x2e')],'sectionId':_0x4e73e0['id']},{})[_0x834e('0x28')](function(){return _0x1419eb;});}else{return _0x1419eb;}})[_0x834e('0x46')](function(_0x4288e4){logger[_0x834e('0x2c')](_0x834e('0x54'),_0x4288e4);throw _0x4288e4;});}return _0x1419eb;})['then'](respondWithResult(_0x40ff5a,0xc9))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){if(_0x3e0550[_0x834e('0x4b')]['id']){delete _0x3e0550[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x3e0550['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x363675,null))['then'](saveUpdates(_0x3e0550[_0x834e('0x4b')],null))['then'](respondWithResult(_0x363675,null))[_0x834e('0x46')](handleError(_0x363675,null));};exports['destroy']=function(_0x527eef,_0x6c0b29){return db[_0x834e('0x30')]['find']({'where':{'id':_0x527eef['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x6c0b29,null))[_0x834e('0x28')](removeEntity(_0x6c0b29,null))[_0x834e('0x46')](handleError(_0x6c0b29,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9306120..9b26b47 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 _0x873a=['lodash','util','../../config/logger','moment','path','rimraf','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types'];(function(_0xbdf03f,_0x595215){var _0x2bbe9e=function(_0x59fbd4){while(--_0x59fbd4){_0xbdf03f['push'](_0xbdf03f['shift']());}};_0x2bbe9e(++_0x595215);}(_0x873a,0x1c2));var _0xa873=function(_0x6472ed,_0x2ae443){_0x6472ed=_0x6472ed-0x0;var _0x23ab07=_0x873a[_0x6472ed];return _0x23ab07;};'use strict';var _=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var logger=require(_0xa873('0x2'))('api');var moment=require(_0xa873('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa873('0x4'));var rimraf=require(_0xa873('0x5'));var config=require('../../config/environment');var attributes=require(_0xa873('0x6'));module[_0xa873('0x7')]=function(_0x5c0d74,_0x370b8a){return _0x5c0d74['define'](_0xa873('0x8'),attributes,{'tableName':_0xa873('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cfd=['bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cfd,0x170));var _0xd4cf=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4cfd[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xd4cf('0x0'));var util=require(_0xd4cf('0x1'));var logger=require('../../config/logger')(_0xd4cf('0x2'));var moment=require(_0xd4cf('0x3'));var BPromise=require(_0xd4cf('0x4'));var rp=require(_0xd4cf('0x5'));var fs=require('fs');var path=require(_0xd4cf('0x6'));var rimraf=require(_0xd4cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4cf('0x8'));module[_0xd4cf('0x9')]=function(_0x23710d,_0x108507){return _0x23710d[_0xd4cf('0xa')](_0xd4cf('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index e17d4f2..3a586e9 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 _0x6075=['result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x6075,0x142));var _0x5607=function(_0x5bc299,_0x203221){_0x5bc299=_0x5bc299-0x0;var _0x1cd31a=_0x6075[_0x5bc299];return _0x1cd31a;};'use strict';var _=require(_0x5607('0x0'));var util=require(_0x5607('0x1'));var moment=require('moment');var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5607('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5607('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5607('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a8d9,_0x49f0f2,_0x415836){return new BPromise(function(_0x5f92ad,_0xbdf802){return client[_0x5607('0x7')](_0x34a8d9,_0x415836)[_0x5607('0x8')](function(_0x2aec99){logger[_0x5607('0x9')](_0x5607('0xa'),_0x49f0f2,_0x5607('0xb'));logger[_0x5607('0xc')](_0x5607('0xd'),_0x49f0f2,_0x5607('0xb'),JSON[_0x5607('0xe')](_0x2aec99));if(_0x2aec99['error']){if(_0x2aec99[_0x5607('0xf')][_0x5607('0x10')]===0x1f4){logger[_0x5607('0xf')]('ContactItemType,\x20%s,\x20%s',_0x49f0f2,_0x2aec99[_0x5607('0xf')][_0x5607('0x11')]);return _0xbdf802(_0x2aec99['error'][_0x5607('0x11')]);}logger[_0x5607('0xf')]('ContactItemType,\x20%s,\x20%s',_0x49f0f2,_0x2aec99[_0x5607('0xf')]['message']);return _0x5f92ad(_0x2aec99[_0x5607('0xf')][_0x5607('0x11')]);}else{logger[_0x5607('0x9')](_0x5607('0xa'),_0x49f0f2,_0x5607('0xb'));_0x5f92ad(_0x2aec99[_0x5607('0x12')][_0x5607('0x11')]);}})[_0x5607('0x13')](function(_0x156060){logger[_0x5607('0xf')](_0x5607('0xa'),_0x49f0f2,_0x156060);_0xbdf802(_0x156060);});});} \ No newline at end of file +var _0x303a=['ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x303a,0x1a0));var _0xa303=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x303a[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('ContactItemType,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('ContactItemType,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('ContactItemType,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 24933d4..97cdd94 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 _0x79a2=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x2cec5c,_0x1c452d){var _0x4920c4=function(_0x5edf2e){while(--_0x5edf2e){_0x2cec5c['push'](_0x2cec5c['shift']());}};_0x4920c4(++_0x1c452d);}(_0x79a2,0x1a3));var _0x279a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x79a2[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x279a('0x0'));var util=require(_0x279a('0x1'));var path=require(_0x279a('0x2'));var timeout=require(_0x279a('0x3'));var express=require(_0x279a('0x4'));var router=express[_0x279a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x279a('0x6'));var config=require(_0x279a('0x7'));var controller=require(_0x279a('0x8'));router[_0x279a('0x9')]('/',auth[_0x279a('0xa')](),controller['index']);router[_0x279a('0x9')](_0x279a('0xb'),auth[_0x279a('0xa')](),controller[_0x279a('0xc')]);router[_0x279a('0xd')]('/',auth[_0x279a('0xa')](),controller[_0x279a('0xe')]);router['put'](_0x279a('0xb'),auth[_0x279a('0xa')](),controller[_0x279a('0xf')]);router[_0x279a('0x10')](_0x279a('0xb'),auth[_0x279a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd90b=['/:id','show','post','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index'];(function(_0xa66c1,_0x20f3e4){var _0x8693e7=function(_0x571790){while(--_0x571790){_0xa66c1['push'](_0xa66c1['shift']());}};_0x8693e7(++_0x20f3e4);}(_0xd90b,0xb6));var _0xbd90=function(_0x46572e,_0x5c0146){_0x46572e=_0x46572e-0x0;var _0x5995ee=_0xd90b[_0x46572e];return _0x5995ee;};'use strict';var multer=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var path=require('path');var timeout=require(_0xbd90('0x2'));var express=require(_0xbd90('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd90('0x4'));var config=require(_0xbd90('0x5'));var controller=require(_0xbd90('0x6'));router[_0xbd90('0x7')]('/',auth[_0xbd90('0x8')](),controller[_0xbd90('0x9')]);router['get'](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller[_0xbd90('0xb')]);router[_0xbd90('0xc')]('/',auth[_0xbd90('0x8')](),controller['create']);router['put'](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller['update']);router[_0xbd90('0xd')]('/:id',auth[_0xbd90('0x8')](),controller[_0xbd90('0xe')]);module[_0xbd90('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5745c5c..b35c9b6 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 _0x4a99=['sequelize','name','STRING'];(function(_0x2ad5a6,_0x42ff60){var _0x13267f=function(_0x5ca534){while(--_0x5ca534){_0x2ad5a6['push'](_0x2ad5a6['shift']());}};_0x13267f(++_0x42ff60);}(_0x4a99,0x1aa));var _0x94a9=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4a99[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x94a9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94a9('0x1')},'description':{'type':Sequelize[_0x94a9('0x2')]}}; \ No newline at end of file +var _0xdf67=['exports','STRING','name','sequelize'];(function(_0x2def91,_0x26f1e8){var _0x5e85d3=function(_0x3b2641){while(--_0x3b2641){_0x2def91['push'](_0x2def91['shift']());}};_0x5e85d3(++_0x26f1e8);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7df6('0x0'));module[_0x7df6('0x1')]={'name':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'unique':_0x7df6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0ccd82b..333b614 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 _0x64f9=['counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','filter','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','offset','limit','set','apply','save','update','then','get','CustomDashboards','end','error','stack','send','map','Dashboard','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','createdAt','updatedAt','omit','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize'];(function(_0x37817f,_0x3f242b){var _0x6e2a0b=function(_0x3b33e4){while(--_0x3b33e4){_0x37817f['push'](_0x37817f['shift']());}};_0x6e2a0b(++_0x3f242b);}(_0x64f9,0x17c));var _0x964f=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x64f9[_0x1d426f];return _0x17f71a;};'use strict';var pdf=require(_0x964f('0x0'));var emlformat=require(_0x964f('0x1'));var rimraf=require(_0x964f('0x2'));var zipdir=require(_0x964f('0x3'));var jsonpatch=require(_0x964f('0x4'));var rp=require(_0x964f('0x5'));var moment=require(_0x964f('0x6'));var BPromise=require(_0x964f('0x7'));var Mustache=require(_0x964f('0x8'));var util=require(_0x964f('0x9'));var path=require(_0x964f('0xa'));var sox=require('sox');var csv=require(_0x964f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x964f('0xc'));var squel=require(_0x964f('0xd'));var crypto=require(_0x964f('0xe'));var jsforce=require(_0x964f('0xf'));var deskjs=require(_0x964f('0x10'));var toCsv=require(_0x964f('0xb'));var querystring=require(_0x964f('0x11'));var Papa=require(_0x964f('0x12'));var Redis=require('ioredis');var authService=require(_0x964f('0x13'));var qs=require(_0x964f('0x14'));var as=require(_0x964f('0x15'));var hardwareService=require(_0x964f('0x16'));var logger=require('../../config/logger')(_0x964f('0x17'));var utils=require(_0x964f('0x18'));var config=require(_0x964f('0x19'));var db=require(_0x964f('0x1a'))['db'];config[_0x964f('0x1b')]=_[_0x964f('0x1c')](config[_0x964f('0x1b')],{'host':_0x964f('0x1d'),'port':0x18eb});var socket=require(_0x964f('0x1e'))(new Redis(config[_0x964f('0x1b')]));require(_0x964f('0x1f'))['register'](socket);function respondWithStatusCode(_0x1b4cd9,_0x5b3938){_0x5b3938=_0x5b3938||0xcc;return function(_0x5bc93f){if(_0x5bc93f){return _0x1b4cd9[_0x964f('0x20')](_0x5b3938);}return _0x1b4cd9[_0x964f('0x21')](_0x5b3938)['end']();};}function respondWithResult(_0x49aa68,_0x4f6f5f){_0x4f6f5f=_0x4f6f5f||0xc8;return function(_0x401539){if(_0x401539){return _0x49aa68[_0x964f('0x21')](_0x4f6f5f)[_0x964f('0x22')](_0x401539);}};}function respondWithFilteredResult(_0x1b1647,_0x220d58){return function(_0x1b212c){if(_0x1b212c){var _0x275b12=_0x1b212c['count'],_0x1899e8=_0x220d58[_0x964f('0x23')],_0x261dbc=_0x220d58[_0x964f('0x23')]+_0x220d58[_0x964f('0x24')],_0x122201;if(_0x261dbc>=_0x275b12){_0x261dbc=_0x275b12;_0x122201=0xc8;}else{_0x122201=0xce;}_0x1b1647[_0x964f('0x21')](_0x122201);return _0x1b1647[_0x964f('0x25')]('Content-Range',_0x1899e8+'-'+_0x261dbc+'/'+_0x275b12)[_0x964f('0x22')](_0x1b212c);}return null;};}function patchUpdates(_0x18de55){return function(_0x48358a){try{jsonpatch[_0x964f('0x26')](_0x48358a,_0x18de55,!![]);}catch(_0x1e3f0a){return BPromise['reject'](_0x1e3f0a);}return _0x48358a[_0x964f('0x27')]();};}function saveUpdates(_0x4a9acb,_0x155646){return function(_0x3240c4){if(_0x3240c4){return _0x3240c4[_0x964f('0x28')](_0x4a9acb)[_0x964f('0x29')](function(_0x46936b){return _0x46936b;});}return null;};}function removeEntity(_0x2bf709,_0x3ca7c3){return function(_0x2238d6){if(_0x2238d6){return _0x2238d6['destroy']()[_0x964f('0x29')](function(){var _0x228702=_0x2238d6[_0x964f('0x2a')]({'plain':!![]});var _0x142f16=_0x964f('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x142f16,'resourceId':_0x228702['id']}})[_0x964f('0x29')](function(){return _0x2238d6;});})[_0x964f('0x29')](function(){_0x2bf709[_0x964f('0x21')](0xcc)[_0x964f('0x2c')]();});}};}function handleEntityNotFound(_0xa4d7f5,_0x14f740){return function(_0xcbc026){if(!_0xcbc026){_0xa4d7f5[_0x964f('0x20')](0x194);}return _0xcbc026;};}function handleError(_0x3d61e3,_0x2ddd7d){_0x2ddd7d=_0x2ddd7d||0x1f4;return function(_0x62189f){logger[_0x964f('0x2d')](_0x62189f[_0x964f('0x2e')]);if(_0x62189f['name']){delete _0x62189f['name'];}_0x3d61e3['status'](_0x2ddd7d)[_0x964f('0x2f')](_0x62189f);};}exports['index']=function(_0x5a0201,_0x4d0c15){var _0x285a52={},_0x12e618={},_0x2da33a={'count':0x0,'rows':[]};var _0x4b515c=_[_0x964f('0x30')](db[_0x964f('0x31')][_0x964f('0x32')],function(_0x18de38){return{'name':_0x18de38['fieldName'],'type':_0x18de38[_0x964f('0x33')][_0x964f('0x34')]};});_0x12e618['model']=_[_0x964f('0x30')](_0x4b515c,_0x964f('0x35'));_0x12e618[_0x964f('0x36')]=_[_0x964f('0x37')](_0x5a0201[_0x964f('0x36')]);_0x12e618[_0x964f('0x38')]=_[_0x964f('0x39')](_0x12e618[_0x964f('0x3a')],_0x12e618[_0x964f('0x36')]);_0x285a52[_0x964f('0x3b')]=_[_0x964f('0x39')](_0x12e618[_0x964f('0x3a')],qs['fields'](_0x5a0201['query'][_0x964f('0x3c')]));_0x285a52['attributes']=_0x285a52['attributes'][_0x964f('0x3d')]?_0x285a52[_0x964f('0x3b')]:_0x12e618['model'];if(!_0x5a0201[_0x964f('0x36')]['hasOwnProperty'](_0x964f('0x3e'))){_0x285a52[_0x964f('0x24')]=qs[_0x964f('0x24')](_0x5a0201['query'][_0x964f('0x24')]);_0x285a52[_0x964f('0x23')]=qs[_0x964f('0x23')](_0x5a0201[_0x964f('0x36')][_0x964f('0x23')]);}_0x285a52['order']=qs[_0x964f('0x3f')](_0x5a0201['query'][_0x964f('0x3f')]);_0x285a52[_0x964f('0x40')]=qs['filters'](_[_0x964f('0x41')](_0x5a0201[_0x964f('0x36')],_0x12e618[_0x964f('0x38')]),_0x4b515c);if(_0x5a0201[_0x964f('0x36')]['filter']){_0x285a52[_0x964f('0x40')]=_['merge'](_0x285a52['where'],{'$or':_[_0x964f('0x30')](_0x4b515c,function(_0x1a6965){if(_0x1a6965[_0x964f('0x33')]!==_0x964f('0x42')){var _0x46f706={};_0x46f706[_0x1a6965[_0x964f('0x35')]]={'$like':'%'+_0x5a0201['query']['filter']+'%'};return _0x46f706;}})});}_0x285a52=_[_0x964f('0x43')]({},_0x285a52,_0x5a0201[_0x964f('0x44')]);var _0x417a11={'where':_0x285a52[_0x964f('0x40')]};return db['Dashboard'][_0x964f('0x45')](_0x417a11)[_0x964f('0x29')](function(_0x25911b){_0x2da33a[_0x964f('0x45')]=_0x25911b;if(_0x5a0201[_0x964f('0x36')][_0x964f('0x46')]){_0x285a52[_0x964f('0x47')]=[{'all':!![]}];}return db[_0x964f('0x31')][_0x964f('0x48')](_0x285a52);})[_0x964f('0x29')](function(_0x47e8e5){_0x2da33a['rows']=_0x47e8e5;return _0x2da33a;})[_0x964f('0x29')](respondWithFilteredResult(_0x4d0c15,_0x285a52))[_0x964f('0x49')](handleError(_0x4d0c15,null));};exports['show']=function(_0x5e4718,_0x26c736){var _0x40bf36={'raw':![],'where':{'id':_0x5e4718[_0x964f('0x4a')]['id']}},_0x5f44fc={};_0x5f44fc[_0x964f('0x3a')]=_[_0x964f('0x37')](db[_0x964f('0x31')]['rawAttributes']);_0x5f44fc[_0x964f('0x36')]=_[_0x964f('0x37')](_0x5e4718[_0x964f('0x36')]);_0x5f44fc[_0x964f('0x38')]=_['intersection'](_0x5f44fc['model'],_0x5f44fc['query']);_0x40bf36[_0x964f('0x3b')]=_[_0x964f('0x39')](_0x5f44fc[_0x964f('0x3a')],qs[_0x964f('0x3c')](_0x5e4718[_0x964f('0x36')][_0x964f('0x3c')]));_0x40bf36[_0x964f('0x3b')]=_0x40bf36[_0x964f('0x3b')][_0x964f('0x3d')]?_0x40bf36['attributes']:_0x5f44fc[_0x964f('0x3a')];if(_0x5e4718['query'][_0x964f('0x46')]){_0x40bf36[_0x964f('0x47')]=[{'all':!![]}];}_0x40bf36=_['merge']({},_0x40bf36,_0x5e4718['options']);return db[_0x964f('0x31')][_0x964f('0x4b')](_0x40bf36)[_0x964f('0x29')](handleEntityNotFound(_0x26c736,null))[_0x964f('0x29')](respondWithResult(_0x26c736,null))['catch'](handleError(_0x26c736,null));};exports[_0x964f('0x4c')]=function(_0x1acab7,_0x15fa5d){return db[_0x964f('0x31')][_0x964f('0x4c')](_0x1acab7['body'],{})['then'](function(_0x3c2e3f){var _0x358dd0=_0x1acab7[_0x964f('0x4d')][_0x964f('0x2a')]({'plain':!![]});if(!_0x358dd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x358dd0[_0x964f('0x4e')]===_0x964f('0x4d')){var _0x436478=_0x3c2e3f[_0x964f('0x2a')]({'plain':!![]});var _0x4372d2=_0x964f('0x2b');return db[_0x964f('0x4f')][_0x964f('0x4b')]({'where':{'name':_0x4372d2,'userProfileId':_0x358dd0[_0x964f('0x50')]},'raw':!![]})[_0x964f('0x29')](function(_0x3f536c){if(_0x3f536c&&_0x3f536c[_0x964f('0x51')]===0x0){return db[_0x964f('0x52')]['create']({'name':_0x436478[_0x964f('0x35')],'resourceId':_0x436478['id'],'type':_0x3f536c[_0x964f('0x35')],'sectionId':_0x3f536c['id']},{})['then'](function(){return _0x3c2e3f;});}else{return _0x3c2e3f;}})[_0x964f('0x49')](function(_0x4a292e){logger[_0x964f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a292e);throw _0x4a292e;});}return _0x3c2e3f;})['then'](respondWithResult(_0x15fa5d,0xc9))[_0x964f('0x49')](handleError(_0x15fa5d,null));};exports[_0x964f('0x53')]=function(_0x351bd1,_0x296a98){var _0x2e66db={'where':{'id':_0x351bd1[_0x964f('0x4a')]['id']}},_0x342d75={};_0x342d75['model']=_[_0x964f('0x37')](db['Dashboard']['rawAttributes']);_0x2e66db[_0x964f('0x3b')]=_[_0x964f('0x39')](_0x342d75['model'],qs[_0x964f('0x3c')](_0x351bd1[_0x964f('0x36')][_0x964f('0x3c')]));_0x2e66db[_0x964f('0x3b')]=_0x2e66db[_0x964f('0x3b')]['length']?_0x2e66db[_0x964f('0x3b')]:_0x342d75['model'];if(_0x351bd1['query'][_0x964f('0x46')]){_0x2e66db['include']=[{'all':!![]}];}_0x2e66db=_[_0x964f('0x43')]({},_0x2e66db,_0x351bd1[_0x964f('0x44')]);return db[_0x964f('0x31')][_0x964f('0x4b')](_0x2e66db)[_0x964f('0x29')](handleEntityNotFound(_0x296a98,null))[_0x964f('0x29')](function(_0x333110){if(_0x333110){var _0x216a31=_0x333110['get']({'plain':!![]});_0x216a31=qs['omit'](_0x216a31,['id',_0x964f('0x54'),_0x964f('0x55')]);_0x351bd1['body']=_[_0x964f('0x56')](_0x351bd1[_0x964f('0x57')],['id',_0x964f('0x54'),_0x964f('0x55')]);return db['Dashboard'][_0x964f('0x4c')](_[_0x964f('0x43')](_0x216a31,_0x351bd1[_0x964f('0x57')]),{'include':_0x351bd1[_0x964f('0x36')][_0x964f('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x37e7f4){var _0xaa5d1c=_0x351bd1[_0x964f('0x4d')][_0x964f('0x2a')]({'plain':!![]});if(!_0xaa5d1c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa5d1c[_0x964f('0x4e')]==='user'){var _0x522300=_0x37e7f4['get']({'plain':!![]});var _0x10deaf=_0x964f('0x2b');return db[_0x964f('0x4f')][_0x964f('0x4b')]({'where':{'name':_0x10deaf,'userProfileId':_0xaa5d1c[_0x964f('0x50')]},'raw':!![]})['then'](function(_0x2c4e2e){if(_0x2c4e2e&&_0x2c4e2e[_0x964f('0x51')]===0x0){return db[_0x964f('0x52')][_0x964f('0x4c')]({'name':_0x522300[_0x964f('0x35')],'resourceId':_0x522300['id'],'type':_0x2c4e2e[_0x964f('0x35')],'sectionId':_0x2c4e2e['id']},{})['then'](function(){return _0x37e7f4;});}else{return _0x37e7f4;}})[_0x964f('0x49')](function(_0x9009bf){logger[_0x964f('0x2d')](_0x964f('0x58'),_0x9009bf);throw _0x9009bf;});}return _0x37e7f4;});}})[_0x964f('0x29')](respondWithResult(_0x296a98,0xc9))[_0x964f('0x49')](handleError(_0x296a98,null));};exports[_0x964f('0x28')]=function(_0x5c79f4,_0x30cff4){if(_0x5c79f4[_0x964f('0x57')]['id']){delete _0x5c79f4['body']['id'];}return db[_0x964f('0x31')][_0x964f('0x4b')]({'where':{'id':_0x5c79f4[_0x964f('0x4a')]['id']}})[_0x964f('0x29')](handleEntityNotFound(_0x30cff4,null))[_0x964f('0x29')](saveUpdates(_0x5c79f4['body'],null))[_0x964f('0x29')](respondWithResult(_0x30cff4,null))['catch'](handleError(_0x30cff4,null));};exports['destroy']=function(_0x342394,_0x20b637){return db[_0x964f('0x31')][_0x964f('0x4b')]({'where':{'id':_0x342394[_0x964f('0x4a')]['id']}})[_0x964f('0x29')](handleEntityNotFound(_0x20b637,null))[_0x964f('0x29')](removeEntity(_0x20b637,null))[_0x964f('0x49')](handleError(_0x20b637,null));};function widgetAttributes(_0x569e6d){try{switch(_0x569e6d[_0x964f('0x33')]){case _0x964f('0x59'):return[{'name':_0x964f('0x5a'),'value':_0x569e6d[_0x964f('0x5a')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||_0x964f('0x5d')}];case _0x964f('0x5e'):return[{'name':_0x964f('0x5f'),'value':_0x569e6d[_0x964f('0x5f')]||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||''}];case'clock':return[{'name':_0x964f('0x60'),'value':_0x569e6d['attrHourFormat']||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x964f('0x61'),'value':_0x569e6d[_0x964f('0x61')]||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d['attrs'][0x1][_0x964f('0x5c')]:undefined)||_0x964f('0x62')},{'name':'attrFontSize','value':_0x569e6d[_0x964f('0x63')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x2]?_0x569e6d[_0x964f('0x5b')][0x2][_0x964f('0x5c')]:undefined)||0xc}];case _0x964f('0x64'):return[{'name':_0x964f('0x65'),'value':_0x569e6d[_0x964f('0x65')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d['attrs'][0x0]?_0x569e6d['attrs'][0x0]['value']:undefined)||_0x964f('0x66')},{'name':_0x964f('0x67'),'value':_0x569e6d[_0x964f('0x67')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d[_0x964f('0x5b')][0x1][_0x964f('0x5c')]:undefined)||[]},{'name':_0x964f('0x63'),'value':_0x569e6d['attrFontSize']||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x2]?_0x569e6d[_0x964f('0x5b')][0x2]['value']:undefined)||0x14}];case _0x964f('0x68'):case'pie-chart':return[{'name':_0x964f('0x69'),'value':_0x569e6d['attrSerie1']||(_0x569e6d['attrs']&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x5c')]:undefined)||_0x964f('0x66')},{'name':'attrSerie2','value':_0x569e6d[_0x964f('0x6a')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d[_0x964f('0x5b')][0x1]['value']:undefined)||null},{'name':_0x964f('0x6b'),'value':_0x569e6d['attrSerie3']||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x2]?_0x569e6d['attrs'][0x2][_0x964f('0x5c')]:undefined)||null},{'name':_0x964f('0x67'),'value':_0x569e6d[_0x964f('0x67')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x3]?_0x569e6d[_0x964f('0x5b')][0x3][_0x964f('0x5c')]:undefined)||[]}];case _0x964f('0x6c'):return[{'name':'attrReport','type':_0x569e6d[_0x964f('0x6d')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0][_0x964f('0x33')]:undefined)||null,'value':_0x569e6d[_0x964f('0x6e')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x0]?_0x569e6d[_0x964f('0x5b')][0x0]['value']:undefined)||null},{'name':_0x964f('0x6f'),'value':_0x569e6d[_0x964f('0x6f')]||(_0x569e6d[_0x964f('0x5b')]&&_0x569e6d[_0x964f('0x5b')][0x1]?_0x569e6d[_0x964f('0x5b')][0x1][_0x964f('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x52396f){logger['error'](_0x964f('0x70'),JSON[_0x964f('0x71')](_0x52396f));return[];}}exports[_0x964f('0x72')]=function(_0xac6ce9,_0x499371,_0x4576f7){if(_0xac6ce9[_0x964f('0x57')]['id']){delete _0xac6ce9[_0x964f('0x57')]['id'];}return db[_0x964f('0x31')][_0x964f('0x4b')]({'where':{'id':_0xac6ce9['params']['id']}})[_0x964f('0x29')](handleEntityNotFound(_0x499371,null))[_0x964f('0x29')](function(_0x3bb637){if(_0x3bb637){_0xac6ce9[_0x964f('0x57')]['DashboardId']=_0x3bb637['id'];_0xac6ce9[_0x964f('0x57')][_0x964f('0x5b')]=widgetAttributes(_0xac6ce9[_0x964f('0x57')]);return db[_0x964f('0x73')][_0x964f('0x4c')](_0xac6ce9['body']);}})[_0x964f('0x29')](respondWithResult(_0x499371,null))[_0x964f('0x49')](handleError(_0x499371,null));};exports[_0x964f('0x74')]=function(_0x2a5d59,_0xc30766,_0x5e5cb6){var _0x6189ea={};var _0x54320d={};var _0x5869ee;var _0x4b4deb;return db[_0x964f('0x31')][_0x964f('0x75')]({'where':{'id':_0x2a5d59[_0x964f('0x4a')]['id']}})[_0x964f('0x29')](handleEntityNotFound(_0xc30766,null))['then'](function(_0x421d64){if(_0x421d64){_0x5869ee=_0x421d64;_0x54320d['model']=_['keys'](db[_0x964f('0x73')][_0x964f('0x32')]);_0x54320d[_0x964f('0x36')]=_[_0x964f('0x37')](_0x2a5d59['query']);_0x54320d[_0x964f('0x38')]=_['intersection'](_0x54320d[_0x964f('0x3a')],_0x54320d['query']);_0x6189ea['attributes']=_['intersection'](_0x54320d[_0x964f('0x3a')],qs[_0x964f('0x3c')](_0x2a5d59[_0x964f('0x36')][_0x964f('0x3c')]));_0x6189ea[_0x964f('0x3b')]=_0x6189ea[_0x964f('0x3b')][_0x964f('0x3d')]?_0x6189ea[_0x964f('0x3b')]:_0x54320d[_0x964f('0x3a')];_0x6189ea['order']=qs[_0x964f('0x3f')](_0x2a5d59[_0x964f('0x36')][_0x964f('0x3f')]);_0x6189ea[_0x964f('0x40')]=qs[_0x964f('0x38')](_[_0x964f('0x41')](_0x2a5d59['query'],_0x54320d['filters']));if(_0x2a5d59[_0x964f('0x36')][_0x964f('0x76')]){_0x6189ea[_0x964f('0x40')]=_[_0x964f('0x43')](_0x6189ea[_0x964f('0x40')],{'$or':_[_0x964f('0x30')](_0x6189ea[_0x964f('0x3b')],function(_0x1dc99b){var _0x3e8185={};_0x3e8185[_0x1dc99b]={'$like':'%'+_0x2a5d59[_0x964f('0x36')][_0x964f('0x76')]+'%'};return _0x3e8185;})});}_0x6189ea=_[_0x964f('0x43')]({},_0x6189ea,_0x2a5d59[_0x964f('0x44')]);return _0x5869ee[_0x964f('0x74')](_0x6189ea);}})[_0x964f('0x29')](function(_0x343985){if(_0x343985){_0x4b4deb=_0x343985['length'];if(!_0x2a5d59[_0x964f('0x36')][_0x964f('0x77')]('nolimit')){_0x6189ea['limit']=qs[_0x964f('0x24')](_0x2a5d59['query'][_0x964f('0x24')]);_0x6189ea[_0x964f('0x23')]=qs[_0x964f('0x23')](_0x2a5d59[_0x964f('0x36')][_0x964f('0x23')]);}return _0x5869ee[_0x964f('0x74')](_0x6189ea);}})[_0x964f('0x29')](function(_0xea5717){if(_0xea5717){return _0xea5717?{'count':_0x4b4deb,'rows':_0xea5717}:null;}})[_0x964f('0x29')](respondWithResult(_0xc30766,null))[_0x964f('0x49')](handleError(_0xc30766,null));}; \ No newline at end of file +var _0x20de=['attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','catch','params','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x20de,0x1e6));var _0xe20d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x20de[_0x255d5b];return _0x3e141a;};'use strict';var pdf=require(_0xe20d('0x0'));var emlformat=require(_0xe20d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe20d('0x2'));var jsonpatch=require(_0xe20d('0x3'));var rp=require(_0xe20d('0x4'));var moment=require(_0xe20d('0x5'));var BPromise=require(_0xe20d('0x6'));var Mustache=require(_0xe20d('0x7'));var util=require(_0xe20d('0x8'));var path=require(_0xe20d('0x9'));var sox=require(_0xe20d('0xa'));var csv=require(_0xe20d('0xb'));var ejs=require(_0xe20d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe20d('0xd'));var jsforce=require(_0xe20d('0xe'));var deskjs=require(_0xe20d('0xf'));var toCsv=require(_0xe20d('0xb'));var querystring=require('querystring');var Papa=require(_0xe20d('0x10'));var Redis=require('ioredis');var authService=require(_0xe20d('0x11'));var qs=require(_0xe20d('0x12'));var as=require(_0xe20d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe20d('0x14'));var utils=require('../../config/utils');var config=require(_0xe20d('0x15'));var db=require(_0xe20d('0x16'))['db'];config['redis']=_[_0xe20d('0x17')](config[_0xe20d('0x18')],{'host':_0xe20d('0x19'),'port':0x18eb});var socket=require(_0xe20d('0x1a'))(new Redis(config[_0xe20d('0x18')]));require(_0xe20d('0x1b'))[_0xe20d('0x1c')](socket);function respondWithStatusCode(_0x3bda00,_0x46f09e){_0x46f09e=_0x46f09e||0xcc;return function(_0x1527dc){if(_0x1527dc){return _0x3bda00[_0xe20d('0x1d')](_0x46f09e);}return _0x3bda00[_0xe20d('0x1e')](_0x46f09e)['end']();};}function respondWithResult(_0x4670c0,_0x21bf7e){_0x21bf7e=_0x21bf7e||0xc8;return function(_0x571bc8){if(_0x571bc8){return _0x4670c0[_0xe20d('0x1e')](_0x21bf7e)[_0xe20d('0x1f')](_0x571bc8);}};}function respondWithFilteredResult(_0x4fe803,_0x202737){return function(_0x56ec99){if(_0x56ec99){var _0x58e96f=_0x56ec99[_0xe20d('0x20')],_0x3b475a=_0x202737['offset'],_0x24965f=_0x202737[_0xe20d('0x21')]+_0x202737[_0xe20d('0x22')],_0x140f01;if(_0x24965f>=_0x58e96f){_0x24965f=_0x58e96f;_0x140f01=0xc8;}else{_0x140f01=0xce;}_0x4fe803[_0xe20d('0x1e')](_0x140f01);return _0x4fe803['set'](_0xe20d('0x23'),_0x3b475a+'-'+_0x24965f+'/'+_0x58e96f)['json'](_0x56ec99);}return null;};}function patchUpdates(_0x55096c){return function(_0x2dbe8a){try{jsonpatch[_0xe20d('0x24')](_0x2dbe8a,_0x55096c,!![]);}catch(_0x5a4cb2){return BPromise[_0xe20d('0x25')](_0x5a4cb2);}return _0x2dbe8a['save']();};}function saveUpdates(_0x2b349e,_0x5f2ec0){return function(_0x1390c3){if(_0x1390c3){return _0x1390c3['update'](_0x2b349e)[_0xe20d('0x26')](function(_0x4ed0fa){return _0x4ed0fa;});}return null;};}function removeEntity(_0x4f700b,_0x1e4bfe){return function(_0x5354b4){if(_0x5354b4){return _0x5354b4['destroy']()[_0xe20d('0x26')](function(){var _0x5178ed=_0x5354b4[_0xe20d('0x27')]({'plain':!![]});var _0x328b78=_0xe20d('0x28');return db[_0xe20d('0x29')]['destroy']({'where':{'type':_0x328b78,'resourceId':_0x5178ed['id']}})[_0xe20d('0x26')](function(){return _0x5354b4;});})[_0xe20d('0x26')](function(){_0x4f700b[_0xe20d('0x1e')](0xcc)[_0xe20d('0x2a')]();});}};}function handleEntityNotFound(_0x2b85b7,_0x3f390d){return function(_0x483691){if(!_0x483691){_0x2b85b7[_0xe20d('0x1d')](0x194);}return _0x483691;};}function handleError(_0x5093aa,_0x3b083a){_0x3b083a=_0x3b083a||0x1f4;return function(_0x259a9b){logger[_0xe20d('0x2b')](_0x259a9b[_0xe20d('0x2c')]);if(_0x259a9b[_0xe20d('0x2d')]){delete _0x259a9b[_0xe20d('0x2d')];}_0x5093aa[_0xe20d('0x1e')](_0x3b083a)[_0xe20d('0x2e')](_0x259a9b);};}exports[_0xe20d('0x2f')]=function(_0x19fc0b,_0x3b948b){var _0x49979c={},_0x365ab8={},_0x4382c6={'count':0x0,'rows':[]};var _0x4b7e4a=_['map'](db[_0xe20d('0x30')][_0xe20d('0x31')],function(_0x4899fd){return{'name':_0x4899fd[_0xe20d('0x32')],'type':_0x4899fd[_0xe20d('0x33')][_0xe20d('0x34')]};});_0x365ab8[_0xe20d('0x35')]=_[_0xe20d('0x36')](_0x4b7e4a,_0xe20d('0x2d'));_0x365ab8[_0xe20d('0x37')]=_[_0xe20d('0x38')](_0x19fc0b[_0xe20d('0x37')]);_0x365ab8[_0xe20d('0x39')]=_[_0xe20d('0x3a')](_0x365ab8[_0xe20d('0x35')],_0x365ab8[_0xe20d('0x37')]);_0x49979c['attributes']=_[_0xe20d('0x3a')](_0x365ab8[_0xe20d('0x35')],qs[_0xe20d('0x3b')](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x3b')]));_0x49979c['attributes']=_0x49979c['attributes'][_0xe20d('0x3c')]?_0x49979c[_0xe20d('0x3d')]:_0x365ab8[_0xe20d('0x35')];if(!_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x3e')]('nolimit')){_0x49979c[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x22')]);_0x49979c[_0xe20d('0x21')]=qs[_0xe20d('0x21')](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x21')]);}_0x49979c[_0xe20d('0x3f')]=qs['sort'](_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x40')]);_0x49979c[_0xe20d('0x41')]=qs['filters'](_[_0xe20d('0x42')](_0x19fc0b['query'],_0x365ab8[_0xe20d('0x39')]),_0x4b7e4a);if(_0x19fc0b[_0xe20d('0x37')][_0xe20d('0x43')]){_0x49979c[_0xe20d('0x41')]=_['merge'](_0x49979c[_0xe20d('0x41')],{'$or':_[_0xe20d('0x36')](_0x4b7e4a,function(_0x284a5a){if(_0x284a5a['type']!==_0xe20d('0x44')){var _0x2a3442={};_0x2a3442[_0x284a5a['name']]={'$like':'%'+_0x19fc0b['query'][_0xe20d('0x43')]+'%'};return _0x2a3442;}})});}_0x49979c=_['merge']({},_0x49979c,_0x19fc0b[_0xe20d('0x45')]);var _0x5a917c={'where':_0x49979c[_0xe20d('0x41')]};return db[_0xe20d('0x30')][_0xe20d('0x20')](_0x5a917c)[_0xe20d('0x26')](function(_0xe797ff){_0x4382c6[_0xe20d('0x20')]=_0xe797ff;if(_0x19fc0b[_0xe20d('0x37')]['includeAll']){_0x49979c[_0xe20d('0x46')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x49979c);})[_0xe20d('0x26')](function(_0x526877){_0x4382c6['rows']=_0x526877;return _0x4382c6;})[_0xe20d('0x26')](respondWithFilteredResult(_0x3b948b,_0x49979c))[_0xe20d('0x47')](handleError(_0x3b948b,null));};exports['show']=function(_0x2898f2,_0x137ec9){var _0x3717b5={'raw':![],'where':{'id':_0x2898f2[_0xe20d('0x48')]['id']}},_0x42c86f={};_0x42c86f[_0xe20d('0x35')]=_[_0xe20d('0x38')](db['Dashboard'][_0xe20d('0x31')]);_0x42c86f['query']=_[_0xe20d('0x38')](_0x2898f2[_0xe20d('0x37')]);_0x42c86f['filters']=_[_0xe20d('0x3a')](_0x42c86f[_0xe20d('0x35')],_0x42c86f[_0xe20d('0x37')]);_0x3717b5['attributes']=_[_0xe20d('0x3a')](_0x42c86f[_0xe20d('0x35')],qs[_0xe20d('0x3b')](_0x2898f2['query']['fields']));_0x3717b5[_0xe20d('0x3d')]=_0x3717b5[_0xe20d('0x3d')][_0xe20d('0x3c')]?_0x3717b5[_0xe20d('0x3d')]:_0x42c86f[_0xe20d('0x35')];if(_0x2898f2[_0xe20d('0x37')][_0xe20d('0x49')]){_0x3717b5[_0xe20d('0x46')]=[{'all':!![]}];}_0x3717b5=_[_0xe20d('0x4a')]({},_0x3717b5,_0x2898f2[_0xe20d('0x45')]);return db['Dashboard'][_0xe20d('0x4b')](_0x3717b5)[_0xe20d('0x26')](handleEntityNotFound(_0x137ec9,null))[_0xe20d('0x26')](respondWithResult(_0x137ec9,null))[_0xe20d('0x47')](handleError(_0x137ec9,null));};exports[_0xe20d('0x4c')]=function(_0x4ac935,_0x5eb31c){return db[_0xe20d('0x30')][_0xe20d('0x4c')](_0x4ac935['body'],{})[_0xe20d('0x26')](function(_0x3ccb47){var _0x4c2a43=_0x4ac935[_0xe20d('0x4d')]['get']({'plain':!![]});if(!_0x4c2a43)throw new Error(_0xe20d('0x4e'));if(_0x4c2a43[_0xe20d('0x4f')]==='user'){var _0x29108f=_0x3ccb47['get']({'plain':!![]});var _0x471a19=_0xe20d('0x28');return db[_0xe20d('0x50')][_0xe20d('0x4b')]({'where':{'name':_0x471a19,'userProfileId':_0x4c2a43[_0xe20d('0x51')]},'raw':!![]})[_0xe20d('0x26')](function(_0x3e1fb9){if(_0x3e1fb9&&_0x3e1fb9[_0xe20d('0x52')]===0x0){return db['UserProfileResource'][_0xe20d('0x4c')]({'name':_0x29108f['name'],'resourceId':_0x29108f['id'],'type':_0x3e1fb9[_0xe20d('0x2d')],'sectionId':_0x3e1fb9['id']},{})[_0xe20d('0x26')](function(){return _0x3ccb47;});}else{return _0x3ccb47;}})[_0xe20d('0x47')](function(_0x1f80e9){logger[_0xe20d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f80e9);throw _0x1f80e9;});}return _0x3ccb47;})[_0xe20d('0x26')](respondWithResult(_0x5eb31c,0xc9))[_0xe20d('0x47')](handleError(_0x5eb31c,null));};exports[_0xe20d('0x53')]=function(_0x250d18,_0x475ff1){var _0x4ea215={'where':{'id':_0x250d18[_0xe20d('0x48')]['id']}},_0x34ae4c={};_0x34ae4c['model']=_[_0xe20d('0x38')](db[_0xe20d('0x30')][_0xe20d('0x31')]);_0x4ea215[_0xe20d('0x3d')]=_['intersection'](_0x34ae4c[_0xe20d('0x35')],qs['fields'](_0x250d18[_0xe20d('0x37')][_0xe20d('0x3b')]));_0x4ea215[_0xe20d('0x3d')]=_0x4ea215['attributes'][_0xe20d('0x3c')]?_0x4ea215[_0xe20d('0x3d')]:_0x34ae4c[_0xe20d('0x35')];if(_0x250d18[_0xe20d('0x37')]['includeAll']){_0x4ea215[_0xe20d('0x46')]=[{'all':!![]}];}_0x4ea215=_[_0xe20d('0x4a')]({},_0x4ea215,_0x250d18[_0xe20d('0x45')]);return db[_0xe20d('0x30')]['find'](_0x4ea215)[_0xe20d('0x26')](handleEntityNotFound(_0x475ff1,null))['then'](function(_0x30afac){if(_0x30afac){var _0x7050b0=_0x30afac[_0xe20d('0x27')]({'plain':!![]});_0x7050b0=qs[_0xe20d('0x54')](_0x7050b0,['id',_0xe20d('0x55'),_0xe20d('0x56')]);_0x250d18[_0xe20d('0x57')]=_['omit'](_0x250d18[_0xe20d('0x57')],['id',_0xe20d('0x55'),_0xe20d('0x56')]);return db[_0xe20d('0x30')][_0xe20d('0x4c')](_[_0xe20d('0x4a')](_0x7050b0,_0x250d18[_0xe20d('0x57')]),{'include':_0x250d18[_0xe20d('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xe20d('0x26')](function(_0x5ac4e5){var _0x2d81c6=_0x250d18[_0xe20d('0x4d')][_0xe20d('0x27')]({'plain':!![]});if(!_0x2d81c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d81c6['role']===_0xe20d('0x4d')){var _0x33352f=_0x5ac4e5[_0xe20d('0x27')]({'plain':!![]});var _0x1762df=_0xe20d('0x28');return db[_0xe20d('0x50')][_0xe20d('0x4b')]({'where':{'name':_0x1762df,'userProfileId':_0x2d81c6['userProfileId']},'raw':!![]})[_0xe20d('0x26')](function(_0x116d9e){if(_0x116d9e&&_0x116d9e[_0xe20d('0x52')]===0x0){return db[_0xe20d('0x29')][_0xe20d('0x4c')]({'name':_0x33352f[_0xe20d('0x2d')],'resourceId':_0x33352f['id'],'type':_0x116d9e[_0xe20d('0x2d')],'sectionId':_0x116d9e['id']},{})[_0xe20d('0x26')](function(){return _0x5ac4e5;});}else{return _0x5ac4e5;}})[_0xe20d('0x47')](function(_0x329c82){logger[_0xe20d('0x2b')](_0xe20d('0x58'),_0x329c82);throw _0x329c82;});}return _0x5ac4e5;});}})['then'](respondWithResult(_0x475ff1,0xc9))['catch'](handleError(_0x475ff1,null));};exports[_0xe20d('0x59')]=function(_0x5e2eca,_0x21929e){if(_0x5e2eca[_0xe20d('0x57')]['id']){delete _0x5e2eca[_0xe20d('0x57')]['id'];}return db[_0xe20d('0x30')]['find']({'where':{'id':_0x5e2eca[_0xe20d('0x48')]['id']}})[_0xe20d('0x26')](handleEntityNotFound(_0x21929e,null))['then'](saveUpdates(_0x5e2eca['body'],null))[_0xe20d('0x26')](respondWithResult(_0x21929e,null))[_0xe20d('0x47')](handleError(_0x21929e,null));};exports[_0xe20d('0x5a')]=function(_0xb7f62e,_0x14cd81){return db[_0xe20d('0x30')][_0xe20d('0x4b')]({'where':{'id':_0xb7f62e[_0xe20d('0x48')]['id']}})['then'](handleEntityNotFound(_0x14cd81,null))[_0xe20d('0x26')](removeEntity(_0x14cd81,null))[_0xe20d('0x47')](handleError(_0x14cd81,null));};function widgetAttributes(_0x142f0e){try{switch(_0x142f0e['type']){case _0xe20d('0x5b'):return[{'name':_0xe20d('0x5c'),'value':_0x142f0e[_0xe20d('0x5c')]||(_0x142f0e['attrs']&&_0x142f0e['attrs'][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x5e')]:undefined)||_0xe20d('0x5f')}];case'custom':return[{'name':_0xe20d('0x60'),'value':_0x142f0e[_0xe20d('0x60')]||(_0x142f0e['attrs']&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x5e')]:undefined)||''}];case'clock':return[{'name':_0xe20d('0x61'),'value':_0x142f0e[_0xe20d('0x61')]||(_0x142f0e['attrs']&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e['attrs'][0x0][_0xe20d('0x5e')]:undefined)||_0xe20d('0x62')},{'name':_0xe20d('0x63'),'value':_0x142f0e['attrTimezone']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1][_0xe20d('0x5e')]:undefined)||_0xe20d('0x64')},{'name':'attrFontSize','value':_0x142f0e['attrFontSize']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x2]?_0x142f0e[_0xe20d('0x5d')][0x2]['value']:undefined)||0xc}];case _0xe20d('0x65'):return[{'name':'attrMetric','value':_0x142f0e[_0xe20d('0x66')]||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e['attrs'][0x0]?_0x142f0e['attrs'][0x0]['value']:undefined)||_0xe20d('0x67')},{'name':_0xe20d('0x68'),'value':_0x142f0e['attrVoiceQueues']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1][_0xe20d('0x5e')]:undefined)||[]},{'name':_0xe20d('0x69'),'value':_0x142f0e[_0xe20d('0x69')]||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x2]?_0x142f0e['attrs'][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xe20d('0x6a'):return[{'name':'attrSerie1','value':_0x142f0e['attrSerie1']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e['attrs'][0x0]['value']:undefined)||_0xe20d('0x67')},{'name':_0xe20d('0x6b'),'value':_0x142f0e['attrSerie2']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1][_0xe20d('0x5e')]:undefined)||null},{'name':_0xe20d('0x6c'),'value':_0x142f0e[_0xe20d('0x6c')]||(_0x142f0e['attrs']&&_0x142f0e['attrs'][0x2]?_0x142f0e[_0xe20d('0x5d')][0x2][_0xe20d('0x5e')]:undefined)||null},{'name':_0xe20d('0x68'),'value':_0x142f0e[_0xe20d('0x68')]||(_0x142f0e['attrs']&&_0x142f0e[_0xe20d('0x5d')][0x3]?_0x142f0e[_0xe20d('0x5d')][0x3][_0xe20d('0x5e')]:undefined)||[]}];case _0xe20d('0x6d'):return[{'name':_0xe20d('0x6e'),'type':_0x142f0e[_0xe20d('0x6f')]||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x33')]:undefined)||null,'value':_0x142f0e['attrReport']||(_0x142f0e[_0xe20d('0x5d')]&&_0x142f0e[_0xe20d('0x5d')][0x0]?_0x142f0e[_0xe20d('0x5d')][0x0][_0xe20d('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x142f0e[_0xe20d('0x70')]||(_0x142f0e['attrs']&&_0x142f0e['attrs'][0x1]?_0x142f0e[_0xe20d('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x363543){logger[_0xe20d('0x2b')]('widgetAttributes:\x20%s',JSON[_0xe20d('0x71')](_0x363543));return[];}}exports[_0xe20d('0x72')]=function(_0x28d76c,_0x31de99,_0x4eba01){if(_0x28d76c[_0xe20d('0x57')]['id']){delete _0x28d76c['body']['id'];}return db[_0xe20d('0x30')][_0xe20d('0x4b')]({'where':{'id':_0x28d76c[_0xe20d('0x48')]['id']}})[_0xe20d('0x26')](handleEntityNotFound(_0x31de99,null))[_0xe20d('0x26')](function(_0x5fb79a){if(_0x5fb79a){_0x28d76c[_0xe20d('0x57')]['DashboardId']=_0x5fb79a['id'];_0x28d76c[_0xe20d('0x57')][_0xe20d('0x5d')]=widgetAttributes(_0x28d76c[_0xe20d('0x57')]);return db[_0xe20d('0x73')][_0xe20d('0x4c')](_0x28d76c[_0xe20d('0x57')]);}})[_0xe20d('0x26')](respondWithResult(_0x31de99,null))[_0xe20d('0x47')](handleError(_0x31de99,null));};exports[_0xe20d('0x74')]=function(_0x37e246,_0x144384,_0x6b58a1){var _0x590cf0={};var _0x4d2671={};var _0x496bdb;var _0x3bbd59;return db['Dashboard']['findOne']({'where':{'id':_0x37e246[_0xe20d('0x48')]['id']}})[_0xe20d('0x26')](handleEntityNotFound(_0x144384,null))[_0xe20d('0x26')](function(_0x6c2e8e){if(_0x6c2e8e){_0x496bdb=_0x6c2e8e;_0x4d2671[_0xe20d('0x35')]=_['keys'](db['DashboardItem'][_0xe20d('0x31')]);_0x4d2671[_0xe20d('0x37')]=_[_0xe20d('0x38')](_0x37e246[_0xe20d('0x37')]);_0x4d2671[_0xe20d('0x39')]=_[_0xe20d('0x3a')](_0x4d2671[_0xe20d('0x35')],_0x4d2671[_0xe20d('0x37')]);_0x590cf0['attributes']=_[_0xe20d('0x3a')](_0x4d2671['model'],qs[_0xe20d('0x3b')](_0x37e246['query'][_0xe20d('0x3b')]));_0x590cf0['attributes']=_0x590cf0[_0xe20d('0x3d')]['length']?_0x590cf0[_0xe20d('0x3d')]:_0x4d2671[_0xe20d('0x35')];_0x590cf0[_0xe20d('0x3f')]=qs['sort'](_0x37e246[_0xe20d('0x37')][_0xe20d('0x40')]);_0x590cf0[_0xe20d('0x41')]=qs[_0xe20d('0x39')](_['pick'](_0x37e246[_0xe20d('0x37')],_0x4d2671[_0xe20d('0x39')]));if(_0x37e246[_0xe20d('0x37')][_0xe20d('0x43')]){_0x590cf0[_0xe20d('0x41')]=_[_0xe20d('0x4a')](_0x590cf0[_0xe20d('0x41')],{'$or':_['map'](_0x590cf0[_0xe20d('0x3d')],function(_0x3cd898){var _0xf89868={};_0xf89868[_0x3cd898]={'$like':'%'+_0x37e246[_0xe20d('0x37')][_0xe20d('0x43')]+'%'};return _0xf89868;})});}_0x590cf0=_['merge']({},_0x590cf0,_0x37e246[_0xe20d('0x45')]);return _0x496bdb[_0xe20d('0x74')](_0x590cf0);}})[_0xe20d('0x26')](function(_0x3cf1e9){if(_0x3cf1e9){_0x3bbd59=_0x3cf1e9[_0xe20d('0x3c')];if(!_0x37e246[_0xe20d('0x37')][_0xe20d('0x3e')]('nolimit')){_0x590cf0[_0xe20d('0x22')]=qs[_0xe20d('0x22')](_0x37e246[_0xe20d('0x37')][_0xe20d('0x22')]);_0x590cf0[_0xe20d('0x21')]=qs[_0xe20d('0x21')](_0x37e246[_0xe20d('0x37')][_0xe20d('0x21')]);}return _0x496bdb[_0xe20d('0x74')](_0x590cf0);}})[_0xe20d('0x26')](function(_0x29fcdd){if(_0x29fcdd){return _0x29fcdd?{'count':_0x3bbd59,'rows':_0x29fcdd}:null;}})['then'](respondWithResult(_0x144384,null))[_0xe20d('0x47')](handleError(_0x144384,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 11042cc..e2ed45e 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 _0x9137=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x9137,0x126));var _0x7913=function(_0x677920,_0x1e3e6a){_0x677920=_0x677920-0x0;var _0x1c593b=_0x9137[_0x677920];return _0x1c593b;};'use strict';var EventEmitter=require(_0x7913('0x0'));var Dashboard=require(_0x7913('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7913('0x2')](0x0);var events={'afterCreate':_0x7913('0x3'),'afterUpdate':'update','afterDestroy':_0x7913('0x4')};function emitEvent(_0x43c0fb){return function(_0x298b0a,_0x2f182b,_0x334fde){DashboardEvents[_0x7913('0x5')](_0x43c0fb+':'+_0x298b0a['id'],_0x298b0a);DashboardEvents[_0x7913('0x5')](_0x43c0fb,_0x298b0a);_0x334fde(null);};}for(var e in events){if(events[_0x7913('0x6')](e)){var event=events[e];Dashboard[_0x7913('0x7')](e,emitEvent(event));}}module[_0x7913('0x8')]=DashboardEvents; \ No newline at end of file +var _0x3b82=['emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','update','remove'];(function(_0x1a78d6,_0x140c67){var _0x30884a=function(_0x585924){while(--_0x585924){_0x1a78d6['push'](_0x1a78d6['shift']());}};_0x30884a(++_0x140c67);}(_0x3b82,0x159));var _0x23b8=function(_0x1b7d9c,_0x59b000){_0x1b7d9c=_0x1b7d9c-0x0;var _0x439e9d=_0x3b82[_0x1b7d9c];return _0x439e9d;};'use strict';var EventEmitter=require(_0x23b8('0x0'));var Dashboard=require(_0x23b8('0x1'))['db'][_0x23b8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x23b8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x23b8('0x4'),'afterDestroy':_0x23b8('0x5')};function emitEvent(_0x149eee){return function(_0x207fe5,_0x4009e9,_0x2de21c){DashboardEvents[_0x23b8('0x6')](_0x149eee+':'+_0x207fe5['id'],_0x207fe5);DashboardEvents['emit'](_0x149eee,_0x207fe5);_0x2de21c(null);};}for(var e in events){if(events[_0x23b8('0x7')](e)){var event=events[e];Dashboard[_0x23b8('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f3f0359..82cebd6 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 _0x83e7=['rimraf','exports','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x83e7,0x1e2));var _0x783e=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0x83e7[_0x895358];return _0x26e26e;};'use strict';var _=require(_0x783e('0x0'));var util=require('util');var logger=require(_0x783e('0x1'))(_0x783e('0x2'));var moment=require('moment');var BPromise=require(_0x783e('0x3'));var rp=require(_0x783e('0x4'));var fs=require('fs');var path=require(_0x783e('0x5'));var rimraf=require(_0x783e('0x6'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x783e('0x7')]=function(_0x35ef4a,_0x9daaec){return _0x35ef4a['define']('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a44=['define','Dashboard','dashboards','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5a44,0x1bd));var _0x45a4=function(_0x45d538,_0x45ece3){_0x45d538=_0x45d538-0x0;var _0x37f23b=_0x5a44[_0x45d538];return _0x37f23b;};'use strict';var _=require('lodash');var util=require(_0x45a4('0x0'));var logger=require(_0x45a4('0x1'))(_0x45a4('0x2'));var moment=require(_0x45a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x45a4('0x4'));var fs=require('fs');var path=require(_0x45a4('0x5'));var rimraf=require(_0x45a4('0x6'));var config=require(_0x45a4('0x7'));var attributes=require(_0x45a4('0x8'));module[_0x45a4('0x9')]=function(_0x5d4e61,_0x52d573){return _0x5d4e61[_0x45a4('0xa')](_0x45a4('0xb'),attributes,{'tableName':_0x45a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 2af894d..939e81f 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 _0xbf52=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x3737c5,_0x1d420c){var _0x5d2b1c=function(_0x6567ae){while(--_0x6567ae){_0x3737c5['push'](_0x3737c5['shift']());}};_0x5d2b1c(++_0x1d420c);}(_0xbf52,0x1a8));var _0x2bf5=function(_0x623c6f,_0x34e2ef){_0x623c6f=_0x623c6f-0x0;var _0x3c7fa1=_0xbf52[_0x623c6f];return _0x3c7fa1;};'use strict';var _=require('lodash');var util=require(_0x2bf5('0x0'));var moment=require('moment');var BPromise=require(_0x2bf5('0x1'));var rs=require(_0x2bf5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bf5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2bf5('0x4'));var config=require(_0x2bf5('0x5'));var jayson=require(_0x2bf5('0x6'));var client=jayson[_0x2bf5('0x7')][_0x2bf5('0x8')]({'port':0x232a});config[_0x2bf5('0x9')]=_[_0x2bf5('0xa')](config[_0x2bf5('0x9')],{'host':_0x2bf5('0xb'),'port':0x18eb});var socket=require(_0x2bf5('0xc'))(new Redis(config['redis']));require(_0x2bf5('0xd'))['register'](socket);function respondWithRpcPromise(_0x16ebe4,_0x3d4ed3,_0x2e4e31){return new BPromise(function(_0x4ec8ab,_0x393e2d){return client[_0x2bf5('0xe')](_0x16ebe4,_0x2e4e31)[_0x2bf5('0xf')](function(_0x8db7d8){logger[_0x2bf5('0x10')](_0x2bf5('0x11'),_0x3d4ed3,_0x2bf5('0x12'));logger[_0x2bf5('0x13')](_0x2bf5('0x14'),_0x3d4ed3,_0x2bf5('0x12'),JSON['stringify'](_0x8db7d8));if(_0x8db7d8[_0x2bf5('0x15')]){if(_0x8db7d8['error'][_0x2bf5('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x3d4ed3,_0x8db7d8[_0x2bf5('0x15')][_0x2bf5('0x17')]);return _0x393e2d(_0x8db7d8['error'][_0x2bf5('0x17')]);}logger[_0x2bf5('0x15')](_0x2bf5('0x11'),_0x3d4ed3,_0x8db7d8[_0x2bf5('0x15')][_0x2bf5('0x17')]);return _0x4ec8ab(_0x8db7d8[_0x2bf5('0x15')][_0x2bf5('0x17')]);}else{logger[_0x2bf5('0x10')](_0x2bf5('0x11'),_0x3d4ed3,_0x2bf5('0x12'));_0x4ec8ab(_0x8db7d8[_0x2bf5('0x18')][_0x2bf5('0x17')]);}})[_0x2bf5('0x19')](function(_0x782322){logger[_0x2bf5('0x15')](_0x2bf5('0x11'),_0x3d4ed3,_0x782322);_0x393e2d(_0x782322);});});} \ No newline at end of file +var _0xad1b=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xad1b,0x164));var _0xbad1=function(_0x539422,_0x394efd){_0x539422=_0x539422-0x0;var _0x25129f=_0xad1b[_0x539422];return _0x25129f;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var moment=require('moment');var BPromise=require(_0xbad1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbad1('0x3'));var db=require(_0xbad1('0x4'))['db'];var utils=require(_0xbad1('0x5'));var logger=require('../../config/logger')(_0xbad1('0x6'));var config=require(_0xbad1('0x7'));var jayson=require(_0xbad1('0x8'));var client=jayson[_0xbad1('0x9')][_0xbad1('0xa')]({'port':0x232a});config[_0xbad1('0xb')]=_[_0xbad1('0xc')](config[_0xbad1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbad1('0xd'))(new Redis(config['redis']));require(_0xbad1('0xe'))[_0xbad1('0xf')](socket);function respondWithRpcPromise(_0x310ffc,_0xb71e78,_0x34c5bc){return new BPromise(function(_0x15cafb,_0xf70661){return client[_0xbad1('0x10')](_0x310ffc,_0x34c5bc)[_0xbad1('0x11')](function(_0x18df7a){logger[_0xbad1('0x12')]('Dashboard,\x20%s,\x20%s',_0xb71e78,'request\x20sent');logger[_0xbad1('0x13')](_0xbad1('0x14'),_0xb71e78,_0xbad1('0x15'),JSON[_0xbad1('0x16')](_0x18df7a));if(_0x18df7a[_0xbad1('0x17')]){if(_0x18df7a[_0xbad1('0x17')]['code']===0x1f4){logger[_0xbad1('0x17')]('Dashboard,\x20%s,\x20%s',_0xb71e78,_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);return _0xf70661(_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);}logger[_0xbad1('0x17')](_0xbad1('0x19'),_0xb71e78,_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);return _0x15cafb(_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);}else{logger[_0xbad1('0x12')](_0xbad1('0x19'),_0xb71e78,_0xbad1('0x15'));_0x15cafb(_0x18df7a[_0xbad1('0x1a')]['message']);}})[_0xbad1('0x1b')](function(_0x5c242b){logger[_0xbad1('0x17')](_0xbad1('0x19'),_0xb71e78,_0x5c242b);_0xf70661(_0x5c242b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 34d345c..4e38d15 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 _0x12ba=['save','remove','update','emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x12ba,0x137));var _0xa12b=function(_0x59e19d,_0x189496){_0x59e19d=_0x59e19d-0x0;var _0x4215d6=_0x12ba[_0x59e19d];return _0x4215d6;};'use strict';var DashboardEvents=require(_0xa12b('0x0'));var events=[_0xa12b('0x1'),_0xa12b('0x2'),_0xa12b('0x3')];function createListener(_0x17362f,_0x25e0be){return function(_0x5949d0){_0x25e0be[_0xa12b('0x4')](_0x17362f,_0x5949d0);};}function removeListener(_0x5bfce8,_0x15d9e3){return function(){DashboardEvents[_0xa12b('0x5')](_0x5bfce8,_0x15d9e3);};}exports[_0xa12b('0x6')]=function(_0x2a3fc1){for(var _0x349bba=0x0,_0x2a47f3=events['length'];_0x349bba<_0x2a47f3;_0x349bba++){var _0x13a28f=events[_0x349bba];var _0x2a2811=createListener(_0xa12b('0x7')+_0x13a28f,_0x2a3fc1);DashboardEvents['on'](_0x13a28f,_0x2a2811);}}; \ No newline at end of file +var _0x33d3=['dashboard:','./dashboard.events','save','remove','emit','removeListener','register'];(function(_0x5fcc94,_0x3a1b8b){var _0x117f38=function(_0x402f0c){while(--_0x402f0c){_0x5fcc94['push'](_0x5fcc94['shift']());}};_0x117f38(++_0x3a1b8b);}(_0x33d3,0x1e4));var _0x333d=function(_0x4a4c78,_0x13d5b7){_0x4a4c78=_0x4a4c78-0x0;var _0xd58f32=_0x33d3[_0x4a4c78];return _0xd58f32;};'use strict';var DashboardEvents=require(_0x333d('0x0'));var events=[_0x333d('0x1'),_0x333d('0x2'),'update'];function createListener(_0x47310c,_0x5914ff){return function(_0xf25239){_0x5914ff[_0x333d('0x3')](_0x47310c,_0xf25239);};}function removeListener(_0x5975b8,_0x491cad){return function(){DashboardEvents[_0x333d('0x4')](_0x5975b8,_0x491cad);};}exports[_0x333d('0x5')]=function(_0x4517c7){for(var _0x2f45dd=0x0,_0x3ffd4f=events['length'];_0x2f45dd<_0x3ffd4f;_0x2f45dd++){var _0x23d1a7=events[_0x2f45dd];var _0x4414f4=createListener(_0x333d('0x6')+_0x23d1a7,_0x4517c7);DashboardEvents['on'](_0x23d1a7,_0x4414f4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bf1ed51..7351597 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0xe706,0xa3));var _0x6e70=function(_0x3462ae,_0x225598){_0x3462ae=_0x3462ae-0x0;var _0x587dd6=_0xe706[_0x3462ae];return _0x587dd6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e11dd94..aee52a3 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 _0xe47d=['parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x1ff8c7,_0x3c1a52){var _0x20957e=function(_0x2d0ac4){while(--_0x2d0ac4){_0x1ff8c7['push'](_0x1ff8c7['shift']());}};_0x20957e(++_0x3c1a52);}(_0xe47d,0x107));var _0xde47=function(_0x35d06a,_0x81abc0){_0x35d06a=_0x35d06a-0x0;var _0x3cf8a5=_0xe47d[_0x35d06a];return _0x3cf8a5;};'use strict';var Sequelize=require(_0xde47('0x0'));var squel=require(_0xde47('0x1'));var _=require(_0xde47('0x2'));module[_0xde47('0x3')]={'title':{'type':Sequelize[_0xde47('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xde47('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xde47('0x5')](_0xde47('0x6')),'get':function(){try{return JSON[_0xde47('0x7')](this[_0xde47('0x8')]('attrs'));}catch(_0x4d6e72){return[];}},'set':function(_0x29c03a){try{this[_0xde47('0x9')](_0xde47('0xa'),JSON[_0xde47('0xb')](_0x29c03a));}catch(_0x4adfeb){this[_0xde47('0x9')](_0xde47('0xa'),JSON[_0xde47('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xde47('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xde47('0xc')]},'background':{'type':Sequelize[_0xde47('0x4')],'allowNull':![],'defaultValue':_0xde47('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xde47('0x4')],'allowNull':![],'defaultValue':_0xde47('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xde47('0x4')]}}; \ No newline at end of file +var _0xa6be=['lodash','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel'];(function(_0x4d8882,_0x59866c){var _0x22fd7c=function(_0x20c815){while(--_0x20c815){_0x4d8882['push'](_0x4d8882['shift']());}};_0x22fd7c(++_0x59866c);}(_0xa6be,0x8d));var _0xea6b=function(_0x587ada,_0x16c2c4){_0x587ada=_0x587ada-0x0;var _0x302624=_0xa6be[_0x587ada];return _0x302624;};'use strict';var Sequelize=require(_0xea6b('0x0'));var squel=require(_0xea6b('0x1'));var _=require(_0xea6b('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xea6b('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xea6b('0x4')](_0xea6b('0x5')),'get':function(){try{return JSON[_0xea6b('0x6')](this[_0xea6b('0x7')](_0xea6b('0x8')));}catch(_0x3de832){return[];}},'set':function(_0x14f76c){try{this['setDataValue'](_0xea6b('0x8'),JSON[_0xea6b('0x9')](_0x14f76c));}catch(_0x543d6f){this[_0xea6b('0xa')](_0xea6b('0x8'),JSON[_0xea6b('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xea6b('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xea6b('0x3')],'allowNull':![],'defaultValue':_0xea6b('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xea6b('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xea6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8cbfe7b..ed073ab 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 _0x2991=['https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','end','status','json','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2991,0x186));var _0x1299=function(_0x1e7aaf,_0x119b16){_0x1e7aaf=_0x1e7aaf-0x0;var _0x4f14ed=_0x2991[_0x1e7aaf];return _0x4f14ed;};'use strict';var pdf=require(_0x1299('0x0'));var emlformat=require(_0x1299('0x1'));var rimraf=require(_0x1299('0x2'));var zipdir=require(_0x1299('0x3'));var jsonpatch=require(_0x1299('0x4'));var rp=require(_0x1299('0x5'));var moment=require(_0x1299('0x6'));var BPromise=require(_0x1299('0x7'));var Mustache=require(_0x1299('0x8'));var util=require(_0x1299('0x9'));var path=require(_0x1299('0xa'));var sox=require(_0x1299('0xb'));var csv=require(_0x1299('0xc'));var ejs=require(_0x1299('0xd'));var fs=require('fs');var _=require(_0x1299('0xe'));var squel=require(_0x1299('0xf'));var crypto=require(_0x1299('0x10'));var jsforce=require(_0x1299('0x11'));var deskjs=require(_0x1299('0x12'));var toCsv=require(_0x1299('0xc'));var querystring=require('querystring');var Papa=require(_0x1299('0x13'));var Redis=require('ioredis');var authService=require(_0x1299('0x14'));var qs=require(_0x1299('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1299('0x16'));var logger=require(_0x1299('0x17'))(_0x1299('0x18'));var utils=require(_0x1299('0x19'));var config=require(_0x1299('0x1a'));var db=require('../../mysqldb')['db'];config[_0x1299('0x1b')]=_[_0x1299('0x1c')](config[_0x1299('0x1b')],{'host':_0x1299('0x1d'),'port':0x18eb});var socket=require(_0x1299('0x1e'))(new Redis(config[_0x1299('0x1b')]));require(_0x1299('0x1f'))['register'](socket);function respondWithStatusCode(_0x5bbfbc,_0x4af732){_0x4af732=_0x4af732||0xcc;return function(_0x34514c){if(_0x34514c){return _0x5bbfbc['sendStatus'](_0x4af732);}return _0x5bbfbc['status'](_0x4af732)[_0x1299('0x20')]();};}function respondWithResult(_0x2af28d,_0x40b6ee){_0x40b6ee=_0x40b6ee||0xc8;return function(_0x474fec){if(_0x474fec){return _0x2af28d[_0x1299('0x21')](_0x40b6ee)[_0x1299('0x22')](_0x474fec);}};}function respondWithFilteredResult(_0x1abc02,_0x5df4a6){return function(_0x3f67e1){if(_0x3f67e1){var _0x291d68=_0x3f67e1[_0x1299('0x23')],_0x5d88e6=_0x5df4a6[_0x1299('0x24')],_0x2dbbab=_0x5df4a6[_0x1299('0x24')]+_0x5df4a6['limit'],_0x1e9bdd;if(_0x2dbbab>=_0x291d68){_0x2dbbab=_0x291d68;_0x1e9bdd=0xc8;}else{_0x1e9bdd=0xce;}_0x1abc02[_0x1299('0x21')](_0x1e9bdd);return _0x1abc02[_0x1299('0x25')]('Content-Range',_0x5d88e6+'-'+_0x2dbbab+'/'+_0x291d68)[_0x1299('0x22')](_0x3f67e1);}return null;};}function patchUpdates(_0x1d683a){return function(_0x4e50e1){try{jsonpatch[_0x1299('0x26')](_0x4e50e1,_0x1d683a,!![]);}catch(_0x43ed8a){return BPromise[_0x1299('0x27')](_0x43ed8a);}return _0x4e50e1[_0x1299('0x28')]();};}function saveUpdates(_0xdb86e,_0x267d12){return function(_0xf17549){if(_0xf17549){return _0xf17549[_0x1299('0x29')](_0xdb86e)['then'](function(_0x2aa976){return _0x2aa976;});}return null;};}function removeEntity(_0x17c85f,_0x3c99a4){return function(_0x761275){if(_0x761275){return _0x761275[_0x1299('0x2a')]()[_0x1299('0x2b')](function(){_0x17c85f[_0x1299('0x21')](0xcc)[_0x1299('0x20')]();});}};}function handleEntityNotFound(_0x35f6e7,_0x1d3785){return function(_0x19a55e){if(!_0x19a55e){_0x35f6e7['sendStatus'](0x194);}return _0x19a55e;};}function handleError(_0x132bad,_0x8dfccb){_0x8dfccb=_0x8dfccb||0x1f4;return function(_0x2c32e6){logger[_0x1299('0x2c')](_0x2c32e6[_0x1299('0x2d')]);if(_0x2c32e6[_0x1299('0x2e')]){delete _0x2c32e6[_0x1299('0x2e')];}_0x132bad[_0x1299('0x21')](_0x8dfccb)[_0x1299('0x2f')](_0x2c32e6);};}exports[_0x1299('0x30')]=function(_0x4713ce,_0x4c40eb){var _0x48ac68={'raw':![],'where':{'id':_0x4713ce[_0x1299('0x31')]['id']}},_0x2ea7af={};_0x2ea7af[_0x1299('0x32')]=_['keys'](db[_0x1299('0x33')][_0x1299('0x34')]);_0x2ea7af[_0x1299('0x35')]=_[_0x1299('0x36')](_0x4713ce[_0x1299('0x35')]);_0x2ea7af[_0x1299('0x37')]=_[_0x1299('0x38')](_0x2ea7af['model'],_0x2ea7af['query']);_0x48ac68[_0x1299('0x39')]=_[_0x1299('0x38')](_0x2ea7af['model'],qs[_0x1299('0x3a')](_0x4713ce[_0x1299('0x35')]['fields']));_0x48ac68[_0x1299('0x39')]=_0x48ac68['attributes'][_0x1299('0x3b')]?_0x48ac68[_0x1299('0x39')]:_0x2ea7af[_0x1299('0x32')];if(_0x4713ce[_0x1299('0x35')][_0x1299('0x3c')]){_0x48ac68[_0x1299('0x3d')]=[{'all':!![]}];}_0x48ac68=_['merge']({},_0x48ac68,_0x4713ce[_0x1299('0x3e')]);return db[_0x1299('0x33')][_0x1299('0x3f')](_0x48ac68)[_0x1299('0x2b')](handleEntityNotFound(_0x4c40eb,null))[_0x1299('0x2b')](respondWithResult(_0x4c40eb,null))[_0x1299('0x40')](handleError(_0x4c40eb,null));};exports[_0x1299('0x2a')]=function(_0x2f49ed,_0xf17884){return db[_0x1299('0x33')]['find']({'where':{'id':_0x2f49ed['params']['id']}})[_0x1299('0x2b')](handleEntityNotFound(_0xf17884,null))[_0x1299('0x2b')](removeEntity(_0xf17884,null))[_0x1299('0x40')](handleError(_0xf17884,null));};function widgetAttributes(_0x5eb18c){try{switch(_0x5eb18c[_0x1299('0x41')]){case _0x1299('0x42'):return[{'name':_0x1299('0x43'),'value':_0x5eb18c[_0x1299('0x43')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||_0x1299('0x46')}];case'custom':return[{'name':_0x1299('0x47'),'value':_0x5eb18c[_0x1299('0x47')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||''}];case _0x1299('0x48'):return[{'name':_0x1299('0x49'),'value':_0x5eb18c['attrHourFormat']||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||'HH:mm:ss'},{'name':_0x1299('0x4a'),'value':_0x5eb18c[_0x1299('0x4a')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c['attrs'][0x1][_0x1299('0x45')]:undefined)||_0x1299('0x4b')},{'name':_0x1299('0x4c'),'value':_0x5eb18c[_0x1299('0x4c')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x2]?_0x5eb18c[_0x1299('0x44')][0x2][_0x1299('0x45')]:undefined)||0xc}];case'counter':return[{'name':_0x1299('0x4d'),'value':_0x5eb18c[_0x1299('0x4d')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||'total'},{'name':_0x1299('0x4e'),'value':_0x5eb18c[_0x1299('0x4e')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c['attrs'][0x1]['value']:undefined)||[]},{'name':_0x1299('0x4c'),'value':_0x5eb18c[_0x1299('0x4c')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x2]?_0x5eb18c[_0x1299('0x44')][0x2][_0x1299('0x45')]:undefined)||0x14}];case _0x1299('0x4f'):case _0x1299('0x50'):return[{'name':_0x1299('0x51'),'value':_0x5eb18c[_0x1299('0x51')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0]['value']:undefined)||_0x1299('0x52')},{'name':_0x1299('0x53'),'value':_0x5eb18c[_0x1299('0x53')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c[_0x1299('0x44')][0x1][_0x1299('0x45')]:undefined)||null},{'name':_0x1299('0x54'),'value':_0x5eb18c[_0x1299('0x54')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x2]?_0x5eb18c[_0x1299('0x44')][0x2][_0x1299('0x45')]:undefined)||null},{'name':_0x1299('0x4e'),'value':_0x5eb18c['attrVoiceQueues']||(_0x5eb18c['attrs']&&_0x5eb18c[_0x1299('0x44')][0x3]?_0x5eb18c['attrs'][0x3][_0x1299('0x45')]:undefined)||[]}];case _0x1299('0x55'):return[{'name':_0x1299('0x56'),'type':_0x5eb18c[_0x1299('0x57')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c['attrs'][0x0]?_0x5eb18c['attrs'][0x0][_0x1299('0x41')]:undefined)||null,'value':_0x5eb18c['attrReport']||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x0]?_0x5eb18c[_0x1299('0x44')][0x0][_0x1299('0x45')]:undefined)||null},{'name':_0x1299('0x58'),'value':_0x5eb18c[_0x1299('0x58')]||(_0x5eb18c[_0x1299('0x44')]&&_0x5eb18c[_0x1299('0x44')][0x1]?_0x5eb18c[_0x1299('0x44')][0x1][_0x1299('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x46aa8e){logger[_0x1299('0x2c')]('widgetAttributes:\x20%s',JSON[_0x1299('0x59')](_0x46aa8e));return[];}}exports[_0x1299('0x5a')]=function(_0x527d63,_0x44112b){if(_0x527d63[_0x1299('0x5b')]){_0x527d63[_0x1299('0x5b')]['attrs']=widgetAttributes(_0x527d63[_0x1299('0x5b')]);}return db[_0x1299('0x33')]['create'](_0x527d63[_0x1299('0x5b')],{})[_0x1299('0x2b')](respondWithResult(_0x44112b,0xc9))['catch'](handleError(_0x44112b,null));};exports[_0x1299('0x29')]=function(_0x5b5411,_0xdb2be9){if(_0x5b5411[_0x1299('0x5b')]['id']){delete _0x5b5411['body']['id'];}_0x5b5411[_0x1299('0x5b')][_0x1299('0x44')]=widgetAttributes(_0x5b5411[_0x1299('0x5b')]);return db[_0x1299('0x33')][_0x1299('0x3f')]({'where':{'id':_0x5b5411['params']['id']}})[_0x1299('0x2b')](handleEntityNotFound(_0xdb2be9,null))[_0x1299('0x2b')](saveUpdates(_0x5b5411[_0x1299('0x5b')],null))['then'](respondWithResult(_0xdb2be9,null))[_0x1299('0x40')](handleError(_0xdb2be9,null));}; \ No newline at end of file +var _0x5ff1=['set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','include','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','status','end','json','offset'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5ff1,0x1d2));var _0x15ff=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x5ff1[_0x480bc8];return _0x28c245;};'use strict';var pdf=require(_0x15ff('0x0'));var emlformat=require(_0x15ff('0x1'));var rimraf=require(_0x15ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15ff('0x3'));var rp=require(_0x15ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15ff('0x5'));var util=require('util');var path=require(_0x15ff('0x6'));var sox=require(_0x15ff('0x7'));var csv=require(_0x15ff('0x8'));var ejs=require(_0x15ff('0x9'));var fs=require('fs');var _=require(_0x15ff('0xa'));var squel=require('squel');var crypto=require(_0x15ff('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x15ff('0x8'));var querystring=require(_0x15ff('0xc'));var Papa=require(_0x15ff('0xd'));var Redis=require(_0x15ff('0xe'));var authService=require(_0x15ff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x15ff('0x10'));var hardwareService=require(_0x15ff('0x11'));var logger=require(_0x15ff('0x12'))(_0x15ff('0x13'));var utils=require(_0x15ff('0x14'));var config=require(_0x15ff('0x15'));var db=require(_0x15ff('0x16'))['db'];config[_0x15ff('0x17')]=_[_0x15ff('0x18')](config[_0x15ff('0x17')],{'host':_0x15ff('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15ff('0x17')]));require(_0x15ff('0x1a'))[_0x15ff('0x1b')](socket);function respondWithStatusCode(_0x2939f5,_0xb4724e){_0xb4724e=_0xb4724e||0xcc;return function(_0x50fbdc){if(_0x50fbdc){return _0x2939f5['sendStatus'](_0xb4724e);}return _0x2939f5[_0x15ff('0x1c')](_0xb4724e)[_0x15ff('0x1d')]();};}function respondWithResult(_0x327801,_0x30b344){_0x30b344=_0x30b344||0xc8;return function(_0x40854b){if(_0x40854b){return _0x327801['status'](_0x30b344)[_0x15ff('0x1e')](_0x40854b);}};}function respondWithFilteredResult(_0x59231a,_0x28b2de){return function(_0x3bc915){if(_0x3bc915){var _0x136c82=_0x3bc915['count'],_0x39bc94=_0x28b2de[_0x15ff('0x1f')],_0x1ada0b=_0x28b2de['offset']+_0x28b2de['limit'],_0x10f7fb;if(_0x1ada0b>=_0x136c82){_0x1ada0b=_0x136c82;_0x10f7fb=0xc8;}else{_0x10f7fb=0xce;}_0x59231a[_0x15ff('0x1c')](_0x10f7fb);return _0x59231a[_0x15ff('0x20')](_0x15ff('0x21'),_0x39bc94+'-'+_0x1ada0b+'/'+_0x136c82)[_0x15ff('0x1e')](_0x3bc915);}return null;};}function patchUpdates(_0x416841){return function(_0x311a81){try{jsonpatch[_0x15ff('0x22')](_0x311a81,_0x416841,!![]);}catch(_0x3d4c65){return BPromise[_0x15ff('0x23')](_0x3d4c65);}return _0x311a81['save']();};}function saveUpdates(_0x3938dc,_0x3c9327){return function(_0x39c229){if(_0x39c229){return _0x39c229[_0x15ff('0x24')](_0x3938dc)[_0x15ff('0x25')](function(_0x2cc7e4){return _0x2cc7e4;});}return null;};}function removeEntity(_0x14a080,_0x1e6077){return function(_0x3f13de){if(_0x3f13de){return _0x3f13de['destroy']()['then'](function(){_0x14a080['status'](0xcc)[_0x15ff('0x1d')]();});}};}function handleEntityNotFound(_0x26017c,_0x401e8c){return function(_0x4c92da){if(!_0x4c92da){_0x26017c[_0x15ff('0x26')](0x194);}return _0x4c92da;};}function handleError(_0x481998,_0x8b9209){_0x8b9209=_0x8b9209||0x1f4;return function(_0x4cd11b){logger['error'](_0x4cd11b[_0x15ff('0x27')]);if(_0x4cd11b[_0x15ff('0x28')]){delete _0x4cd11b[_0x15ff('0x28')];}_0x481998['status'](_0x8b9209)[_0x15ff('0x29')](_0x4cd11b);};}exports['show']=function(_0x7c7be9,_0x218641){var _0x145e25={'raw':![],'where':{'id':_0x7c7be9['params']['id']}},_0x33deae={};_0x33deae[_0x15ff('0x2a')]=_[_0x15ff('0x2b')](db[_0x15ff('0x2c')][_0x15ff('0x2d')]);_0x33deae[_0x15ff('0x2e')]=_[_0x15ff('0x2b')](_0x7c7be9[_0x15ff('0x2e')]);_0x33deae['filters']=_[_0x15ff('0x2f')](_0x33deae[_0x15ff('0x2a')],_0x33deae[_0x15ff('0x2e')]);_0x145e25[_0x15ff('0x30')]=_[_0x15ff('0x2f')](_0x33deae[_0x15ff('0x2a')],qs['fields'](_0x7c7be9[_0x15ff('0x2e')][_0x15ff('0x31')]));_0x145e25[_0x15ff('0x30')]=_0x145e25[_0x15ff('0x30')][_0x15ff('0x32')]?_0x145e25[_0x15ff('0x30')]:_0x33deae[_0x15ff('0x2a')];if(_0x7c7be9[_0x15ff('0x2e')]['includeAll']){_0x145e25[_0x15ff('0x33')]=[{'all':!![]}];}_0x145e25=_['merge']({},_0x145e25,_0x7c7be9['options']);return db[_0x15ff('0x2c')][_0x15ff('0x34')](_0x145e25)[_0x15ff('0x25')](handleEntityNotFound(_0x218641,null))[_0x15ff('0x25')](respondWithResult(_0x218641,null))[_0x15ff('0x35')](handleError(_0x218641,null));};exports[_0x15ff('0x36')]=function(_0x2f8ba8,_0x42f7e7){return db['DashboardItem'][_0x15ff('0x34')]({'where':{'id':_0x2f8ba8['params']['id']}})[_0x15ff('0x25')](handleEntityNotFound(_0x42f7e7,null))[_0x15ff('0x25')](removeEntity(_0x42f7e7,null))[_0x15ff('0x35')](handleError(_0x42f7e7,null));};function widgetAttributes(_0x2b7901){try{switch(_0x2b7901[_0x15ff('0x37')]){case _0x15ff('0x38'):return[{'name':'attrUrl','value':_0x2b7901[_0x15ff('0x39')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||_0x15ff('0x3c')}];case _0x15ff('0x3d'):return[{'name':'attrPath','value':_0x2b7901['attrPath']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||''}];case _0x15ff('0x3e'):return[{'name':_0x15ff('0x3f'),'value':_0x2b7901['attrHourFormat']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901['attrs'][0x0]?_0x2b7901['attrs'][0x0][_0x15ff('0x3b')]:undefined)||_0x15ff('0x40')},{'name':_0x15ff('0x41'),'value':_0x2b7901[_0x15ff('0x41')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901['attrs'][0x1][_0x15ff('0x3b')]:undefined)||'0.00'},{'name':_0x15ff('0x42'),'value':_0x2b7901['attrFontSize']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x2]?_0x2b7901[_0x15ff('0x3a')][0x2][_0x15ff('0x3b')]:undefined)||0xc}];case'counter':return[{'name':_0x15ff('0x43'),'value':_0x2b7901[_0x15ff('0x43')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0]['value']:undefined)||_0x15ff('0x44')},{'name':_0x15ff('0x45'),'value':_0x2b7901['attrVoiceQueues']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901[_0x15ff('0x3a')][0x1]['value']:undefined)||[]},{'name':_0x15ff('0x42'),'value':_0x2b7901[_0x15ff('0x42')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x2]?_0x2b7901['attrs'][0x2][_0x15ff('0x3b')]:undefined)||0x14}];case _0x15ff('0x46'):case _0x15ff('0x47'):return[{'name':'attrSerie1','value':_0x2b7901['attrSerie1']||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||_0x15ff('0x44')},{'name':_0x15ff('0x48'),'value':_0x2b7901[_0x15ff('0x48')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901['attrs'][0x1][_0x15ff('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0x2b7901[_0x15ff('0x49')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x2]?_0x2b7901['attrs'][0x2]['value']:undefined)||null},{'name':_0x15ff('0x45'),'value':_0x2b7901[_0x15ff('0x45')]||(_0x2b7901[_0x15ff('0x3a')]&&_0x2b7901[_0x15ff('0x3a')][0x3]?_0x2b7901[_0x15ff('0x3a')][0x3][_0x15ff('0x3b')]:undefined)||[]}];case'web-report':return[{'name':_0x15ff('0x4a'),'type':_0x2b7901[_0x15ff('0x4b')]||(_0x2b7901['attrs']&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901['attrs'][0x0][_0x15ff('0x37')]:undefined)||null,'value':_0x2b7901[_0x15ff('0x4a')]||(_0x2b7901['attrs']&&_0x2b7901[_0x15ff('0x3a')][0x0]?_0x2b7901[_0x15ff('0x3a')][0x0][_0x15ff('0x3b')]:undefined)||null},{'name':'attrRefresh','value':_0x2b7901[_0x15ff('0x4c')]||(_0x2b7901['attrs']&&_0x2b7901[_0x15ff('0x3a')][0x1]?_0x2b7901['attrs'][0x1][_0x15ff('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x4802c9){logger[_0x15ff('0x4d')](_0x15ff('0x4e'),JSON[_0x15ff('0x4f')](_0x4802c9));return[];}}exports[_0x15ff('0x50')]=function(_0x42a661,_0x26e6b7){if(_0x42a661[_0x15ff('0x51')]){_0x42a661[_0x15ff('0x51')][_0x15ff('0x3a')]=widgetAttributes(_0x42a661[_0x15ff('0x51')]);}return db[_0x15ff('0x2c')][_0x15ff('0x50')](_0x42a661[_0x15ff('0x51')],{})[_0x15ff('0x25')](respondWithResult(_0x26e6b7,0xc9))['catch'](handleError(_0x26e6b7,null));};exports[_0x15ff('0x24')]=function(_0xdc919c,_0x3f2242){if(_0xdc919c[_0x15ff('0x51')]['id']){delete _0xdc919c['body']['id'];}_0xdc919c[_0x15ff('0x51')][_0x15ff('0x3a')]=widgetAttributes(_0xdc919c[_0x15ff('0x51')]);return db[_0x15ff('0x2c')][_0x15ff('0x34')]({'where':{'id':_0xdc919c[_0x15ff('0x52')]['id']}})[_0x15ff('0x25')](handleEntityNotFound(_0x3f2242,null))['then'](saveUpdates(_0xdc919c[_0x15ff('0x51')],null))[_0x15ff('0x25')](respondWithResult(_0x3f2242,null))[_0x15ff('0x35')](handleError(_0x3f2242,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 17baf77..824f5c5 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 _0xe606=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xe606,0x11c));var _0x6e60=function(_0x5321ab,_0x3efaca){_0x5321ab=_0x5321ab-0x0;var _0x3991ad=_0xe606[_0x5321ab];return _0x3991ad;};'use strict';var EventEmitter=require(_0x6e60('0x0'));var DashboardItem=require(_0x6e60('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e60('0x2'),'afterUpdate':_0x6e60('0x3'),'afterDestroy':_0x6e60('0x4')};function emitEvent(_0x21c43c){return function(_0x1f6b93,_0x576367,_0x520516){DashboardItemEvents['emit'](_0x21c43c+':'+_0x1f6b93['id'],_0x1f6b93);DashboardItemEvents[_0x6e60('0x5')](_0x21c43c,_0x1f6b93);_0x520516(null);};}for(var e in events){if(events[_0x6e60('0x6')](e)){var event=events[e];DashboardItem[_0x6e60('0x7')](e,emitEvent(event));}}module[_0x6e60('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xb479=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0xb479,0x1ee));var _0x9b47=function(_0x259815,_0x32fc32){_0x259815=_0x259815-0x0;var _0xf6a65b=_0xb479[_0x259815];return _0xf6a65b;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x9b47('0x0'))['db'][_0x9b47('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9b47('0x2')](0x0);var events={'afterCreate':_0x9b47('0x3'),'afterUpdate':_0x9b47('0x4'),'afterDestroy':_0x9b47('0x5')};function emitEvent(_0x1bb180){return function(_0x600234,_0x21a8e6,_0x2365b7){DashboardItemEvents[_0x9b47('0x6')](_0x1bb180+':'+_0x600234['id'],_0x600234);DashboardItemEvents['emit'](_0x1bb180,_0x600234);_0x2365b7(null);};}for(var e in events){if(events[_0x9b47('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x9b47('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 11e8a13..05694dc 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 _0x9648=['dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x356085,_0x5ed3ae){var _0x5acb73=function(_0x35b6bc){while(--_0x35b6bc){_0x356085['push'](_0x356085['shift']());}};_0x5acb73(++_0x5ed3ae);}(_0x9648,0x1eb));var _0x8964=function(_0x15378c,_0x183c5a){_0x15378c=_0x15378c-0x0;var _0x58d36c=_0x9648[_0x15378c];return _0x58d36c;};'use strict';var _=require(_0x8964('0x0'));var util=require(_0x8964('0x1'));var logger=require(_0x8964('0x2'))(_0x8964('0x3'));var moment=require('moment');var BPromise=require(_0x8964('0x4'));var rp=require(_0x8964('0x5'));var fs=require('fs');var path=require(_0x8964('0x6'));var rimraf=require(_0x8964('0x7'));var config=require(_0x8964('0x8'));var attributes=require(_0x8964('0x9'));module[_0x8964('0xa')]=function(_0x48576d,_0x3c2fb3){return _0x48576d[_0x8964('0xb')](_0x8964('0xc'),attributes,{'tableName':_0x8964('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf2c=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x451f8a,_0x30a7e9){var _0x279417=function(_0x1f240d){while(--_0x1f240d){_0x451f8a['push'](_0x451f8a['shift']());}};_0x279417(++_0x30a7e9);}(_0xdf2c,0x174));var _0xcdf2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdf2c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xcdf2('0x0'));var util=require(_0xcdf2('0x1'));var logger=require('../../config/logger')(_0xcdf2('0x2'));var moment=require(_0xcdf2('0x3'));var BPromise=require(_0xcdf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdf2('0x5'));var rimraf=require(_0xcdf2('0x6'));var config=require(_0xcdf2('0x7'));var attributes=require(_0xcdf2('0x8'));module['exports']=function(_0x25dc0b,_0xbaf75c){return _0x25dc0b[_0xcdf2('0x9')](_0xcdf2('0xa'),attributes,{'tableName':_0xcdf2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 83d74c7..8f5f6cb 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 _0xad52=['socket.io-emitter','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3cc693,_0x45ca5b){var _0x309578=function(_0x48980e){while(--_0x48980e){_0x3cc693['push'](_0x3cc693['shift']());}};_0x309578(++_0x45ca5b);}(_0xad52,0x13a));var _0x2ad5=function(_0x5cdf4b,_0x1122f7){_0x5cdf4b=_0x5cdf4b-0x0;var _0x3a1171=_0xad52[_0x5cdf4b];return _0x3a1171;};'use strict';var _=require(_0x2ad5('0x0'));var util=require(_0x2ad5('0x1'));var moment=require(_0x2ad5('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ad5('0x3'));var fs=require('fs');var Redis=require(_0x2ad5('0x4'));var db=require(_0x2ad5('0x5'))['db'];var utils=require(_0x2ad5('0x6'));var logger=require(_0x2ad5('0x7'))(_0x2ad5('0x8'));var config=require('../../config/environment');var jayson=require(_0x2ad5('0x9'));var client=jayson['client'][_0x2ad5('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2ad5('0xb'))(new Redis(config[_0x2ad5('0xc')]));require(_0x2ad5('0xd'))[_0x2ad5('0xe')](socket);function respondWithRpcPromise(_0x3f8283,_0x163823,_0x3a7395){return new BPromise(function(_0x1ccf35,_0x4e9e42){return client[_0x2ad5('0xf')](_0x3f8283,_0x3a7395)[_0x2ad5('0x10')](function(_0x2049b0){logger[_0x2ad5('0x11')](_0x2ad5('0x12'),_0x163823,'request\x20sent');logger[_0x2ad5('0x13')](_0x2ad5('0x14'),_0x163823,'request\x20sent',JSON['stringify'](_0x2049b0));if(_0x2049b0['error']){if(_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x16')]===0x1f4){logger['error'](_0x2ad5('0x12'),_0x163823,_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x17')]);return _0x4e9e42(_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x17')]);}logger[_0x2ad5('0x15')](_0x2ad5('0x12'),_0x163823,_0x2049b0[_0x2ad5('0x15')][_0x2ad5('0x17')]);return _0x1ccf35(_0x2049b0['error'][_0x2ad5('0x17')]);}else{logger['info'](_0x2ad5('0x12'),_0x163823,'request\x20sent');_0x1ccf35(_0x2049b0['result'][_0x2ad5('0x17')]);}})[_0x2ad5('0x18')](function(_0x4321a7){logger[_0x2ad5('0x15')](_0x2ad5('0x12'),_0x163823,_0x4321a7);_0x4e9e42(_0x4321a7);});});} \ No newline at end of file +var _0xeee2=['client','redis','defaults','localhost','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x331297,_0x1b26aa){var _0x39dcc5=function(_0x19fdfe){while(--_0x19fdfe){_0x331297['push'](_0x331297['shift']());}};_0x39dcc5(++_0x1b26aa);}(_0xeee2,0x86));var _0x2eee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeee2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2eee('0x0'));var util=require(_0x2eee('0x1'));var moment=require(_0x2eee('0x2'));var BPromise=require(_0x2eee('0x3'));var rs=require(_0x2eee('0x4'));var fs=require('fs');var Redis=require(_0x2eee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2eee('0x6'));var logger=require(_0x2eee('0x7'))('rpc');var config=require(_0x2eee('0x8'));var jayson=require(_0x2eee('0x9'));var client=jayson[_0x2eee('0xa')]['http']({'port':0x232a});config[_0x2eee('0xb')]=_[_0x2eee('0xc')](config[_0x2eee('0xb')],{'host':_0x2eee('0xd'),'port':0x18eb});var socket=require(_0x2eee('0xe'))(new Redis(config[_0x2eee('0xb')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x193838,_0x263718,_0x35f469){return new BPromise(function(_0x48d900,_0x5074b9){return client[_0x2eee('0xf')](_0x193838,_0x35f469)['then'](function(_0x1c85dd){logger[_0x2eee('0x10')](_0x2eee('0x11'),_0x263718,_0x2eee('0x12'));logger[_0x2eee('0x13')](_0x2eee('0x14'),_0x263718,_0x2eee('0x12'),JSON['stringify'](_0x1c85dd));if(_0x1c85dd[_0x2eee('0x15')]){if(_0x1c85dd[_0x2eee('0x15')][_0x2eee('0x16')]===0x1f4){logger['error'](_0x2eee('0x11'),_0x263718,_0x1c85dd[_0x2eee('0x15')]['message']);return _0x5074b9(_0x1c85dd['error']['message']);}logger[_0x2eee('0x15')](_0x2eee('0x11'),_0x263718,_0x1c85dd[_0x2eee('0x15')][_0x2eee('0x17')]);return _0x48d900(_0x1c85dd[_0x2eee('0x15')][_0x2eee('0x17')]);}else{logger[_0x2eee('0x10')](_0x2eee('0x11'),_0x263718,_0x2eee('0x12'));_0x48d900(_0x1c85dd['result'][_0x2eee('0x17')]);}})['catch'](function(_0x40e42e){logger[_0x2eee('0x15')](_0x2eee('0x11'),_0x263718,_0x40e42e);_0x5074b9(_0x40e42e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1dedb00..3446896 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 _0x7163=['remove','update','removeListener','register','length','dashboardItem:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7163,0x187));var _0x3716=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x7163[_0x2283dc];return _0x16db90;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x3716('0x0'),_0x3716('0x1'),_0x3716('0x2')];function createListener(_0x3fcb65,_0x139331){return function(_0xac73c5){_0x139331['emit'](_0x3fcb65,_0xac73c5);};}function removeListener(_0x30b045,_0x413e94){return function(){DashboardItemEvents[_0x3716('0x3')](_0x30b045,_0x413e94);};}exports[_0x3716('0x4')]=function(_0x4e6693){for(var _0x4af449=0x0,_0x516a6d=events[_0x3716('0x5')];_0x4af449<_0x516a6d;_0x4af449++){var _0x1f2212=events[_0x4af449];var _0x6a60e2=createListener(_0x3716('0x6')+_0x1f2212,_0x4e6693);DashboardItemEvents['on'](_0x1f2212,_0x6a60e2);}}; \ No newline at end of file +var _0xd12f=['removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0xd81983,_0x4e5e04){var _0x157067=function(_0x5f170e){while(--_0x5f170e){_0xd81983['push'](_0xd81983['shift']());}};_0x157067(++_0x4e5e04);}(_0xd12f,0x8b));var _0xfd12=function(_0x552971,_0x3e6f5d){_0x552971=_0x552971-0x0;var _0x2aae9f=_0xd12f[_0x552971];return _0x2aae9f;};'use strict';var DashboardItemEvents=require(_0xfd12('0x0'));var events=[_0xfd12('0x1'),_0xfd12('0x2'),_0xfd12('0x3')];function createListener(_0x3e9e09,_0x2b93bc){return function(_0x81d8ef){_0x2b93bc[_0xfd12('0x4')](_0x3e9e09,_0x81d8ef);};}function removeListener(_0x6f18ee,_0x38a6b3){return function(){DashboardItemEvents[_0xfd12('0x5')](_0x6f18ee,_0x38a6b3);};}exports[_0xfd12('0x6')]=function(_0x522129){for(var _0x137ab1=0x0,_0x75424b=events['length'];_0x137ab1<_0x75424b;_0x137ab1++){var _0x25bc09=events[_0x137ab1];var _0xd9ec55=createListener(_0xfd12('0x7')+_0x25bc09,_0x522129);DashboardItemEvents['on'](_0x25bc09,_0xd9ec55);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 006a307..36073b4 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 _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x54e333,_0x4ba478){_0x54e333=_0x54e333-0x0;var _0x47279e=_0xf2ca[_0x54e333];return _0x47279e;};'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'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0x53ec=['../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5b96cf,_0x287514){var _0x1b878e=function(_0x3bb40c){while(--_0x3bb40c){_0x5b96cf['push'](_0x5b96cf['shift']());}};_0x1b878e(++_0x287514);}(_0x53ec,0x192));var _0xc53e=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0x53ec[_0x4745d9];return _0x38f2ac;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/:id',auth[_0xc53e('0x9')](),controller['show']);router[_0xc53e('0xa')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0xb')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xf')]);module[_0xc53e('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f5c2ca0..18410db 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 _0xb2c5=['exports','STRING','sequelize'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xb2c5,0x9b));var _0x5b2c=function(_0x38c6ff,_0x442ac9){_0x38c6ff=_0x38c6ff-0x0;var _0xfbea01=_0xb2c5[_0x38c6ff];return _0xfbea01;};'use strict';var Sequelize=require(_0x5b2c('0x0'));module[_0x5b2c('0x1')]={'name':{'type':Sequelize[_0x5b2c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x55f1=['sequelize','exports','STRING'];(function(_0x1cdaa5,_0xf3b67){var _0x58675c=function(_0x36f762){while(--_0x36f762){_0x1cdaa5['push'](_0x1cdaa5['shift']());}};_0x58675c(++_0xf3b67);}(_0x55f1,0x1d7));var _0x155f=function(_0x188998,_0x2a082e){_0x188998=_0x188998-0x0;var _0x17801b=_0x55f1[_0x188998];return _0x17801b;};'use strict';var Sequelize=require(_0x155f('0x0'));module[_0x155f('0x1')]={'name':{'type':Sequelize[_0x155f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c6c800f..b82a638 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 _0xef62=['offset','set','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','send','Disposition','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x30ddf3,_0x7a86f6){var _0x694bdf=function(_0x3d2401){while(--_0x3d2401){_0x30ddf3['push'](_0x30ddf3['shift']());}};_0x694bdf(++_0x7a86f6);}(_0xef62,0xd4));var _0x2ef6=function(_0x91b429,_0x4594af){_0x91b429=_0x91b429-0x0;var _0x1ccb72=_0xef62[_0x91b429];return _0x1ccb72;};'use strict';var pdf=require(_0x2ef6('0x0'));var emlformat=require(_0x2ef6('0x1'));var rimraf=require(_0x2ef6('0x2'));var zipdir=require(_0x2ef6('0x3'));var jsonpatch=require(_0x2ef6('0x4'));var rp=require('request-promise');var moment=require(_0x2ef6('0x5'));var BPromise=require(_0x2ef6('0x6'));var Mustache=require(_0x2ef6('0x7'));var util=require(_0x2ef6('0x8'));var path=require(_0x2ef6('0x9'));var sox=require(_0x2ef6('0xa'));var csv=require('to-csv');var ejs=require(_0x2ef6('0xb'));var fs=require('fs');var _=require(_0x2ef6('0xc'));var squel=require(_0x2ef6('0xd'));var crypto=require(_0x2ef6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2ef6('0xf'));var toCsv=require(_0x2ef6('0x10'));var querystring=require(_0x2ef6('0x11'));var Papa=require(_0x2ef6('0x12'));var Redis=require(_0x2ef6('0x13'));var authService=require(_0x2ef6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef6('0x15'));var hardwareService=require(_0x2ef6('0x16'));var logger=require('../../config/logger')(_0x2ef6('0x17'));var utils=require(_0x2ef6('0x18'));var config=require(_0x2ef6('0x19'));var db=require(_0x2ef6('0x1a'))['db'];function respondWithStatusCode(_0x2b40a6,_0x2bb220){_0x2bb220=_0x2bb220||0xcc;return function(_0x5674c7){if(_0x5674c7){return _0x2b40a6[_0x2ef6('0x1b')](_0x2bb220);}return _0x2b40a6[_0x2ef6('0x1c')](_0x2bb220)[_0x2ef6('0x1d')]();};}function respondWithResult(_0x2667b5,_0x34a667){_0x34a667=_0x34a667||0xc8;return function(_0x8ce1cd){if(_0x8ce1cd){return _0x2667b5[_0x2ef6('0x1c')](_0x34a667)['json'](_0x8ce1cd);}};}function respondWithFilteredResult(_0x246a47,_0x5993cc){return function(_0x2b2ddc){if(_0x2b2ddc){var _0x2ff824=_0x2b2ddc[_0x2ef6('0x1e')],_0x42adab=_0x5993cc['offset'],_0x540cfb=_0x5993cc[_0x2ef6('0x1f')]+_0x5993cc['limit'],_0x29569a;if(_0x540cfb>=_0x2ff824){_0x540cfb=_0x2ff824;_0x29569a=0xc8;}else{_0x29569a=0xce;}_0x246a47[_0x2ef6('0x1c')](_0x29569a);return _0x246a47[_0x2ef6('0x20')]('Content-Range',_0x42adab+'-'+_0x540cfb+'/'+_0x2ff824)['json'](_0x2b2ddc);}return null;};}function patchUpdates(_0x405a35){return function(_0xb6d202){try{jsonpatch[_0x2ef6('0x21')](_0xb6d202,_0x405a35,!![]);}catch(_0x14d0aa){return BPromise['reject'](_0x14d0aa);}return _0xb6d202[_0x2ef6('0x22')]();};}function saveUpdates(_0x15ba61,_0x4fb7d2){return function(_0x362343){if(_0x362343){return _0x362343[_0x2ef6('0x23')](_0x15ba61)[_0x2ef6('0x24')](function(_0x450d40){return _0x450d40;});}return null;};}function removeEntity(_0x4286a8,_0x51836d){return function(_0x464bb8){if(_0x464bb8){return _0x464bb8[_0x2ef6('0x25')]()['then'](function(){var _0x42bb16=_0x464bb8[_0x2ef6('0x26')]({'plain':!![]});var _0xe02214=_0x2ef6('0x27');return db[_0x2ef6('0x28')][_0x2ef6('0x25')]({'where':{'type':_0xe02214,'resourceId':_0x42bb16['id']}})[_0x2ef6('0x24')](function(){return _0x464bb8;});})[_0x2ef6('0x24')](function(){_0x4286a8[_0x2ef6('0x1c')](0xcc)[_0x2ef6('0x1d')]();});}};}function handleEntityNotFound(_0x5b23f7,_0x1ef371){return function(_0x3ba958){if(!_0x3ba958){_0x5b23f7['sendStatus'](0x194);}return _0x3ba958;};}function handleError(_0x266b75,_0x21a7bf){_0x21a7bf=_0x21a7bf||0x1f4;return function(_0x5be675){logger[_0x2ef6('0x29')](_0x5be675[_0x2ef6('0x2a')]);if(_0x5be675['name']){delete _0x5be675['name'];}_0x266b75[_0x2ef6('0x1c')](_0x21a7bf)[_0x2ef6('0x2b')](_0x5be675);};}exports['index']=function(_0x27406e,_0x3f4154){var _0x58e47b={},_0x49af66={},_0x2d138b={'count':0x0,'rows':[]};var _0x20c750=_['map'](db[_0x2ef6('0x2c')][_0x2ef6('0x2d')],function(_0x228382){return{'name':_0x228382[_0x2ef6('0x2e')],'type':_0x228382[_0x2ef6('0x2f')][_0x2ef6('0x30')]};});_0x49af66[_0x2ef6('0x31')]=_[_0x2ef6('0x32')](_0x20c750,_0x2ef6('0x33'));_0x49af66[_0x2ef6('0x34')]=_['keys'](_0x27406e[_0x2ef6('0x34')]);_0x49af66[_0x2ef6('0x35')]=_['intersection'](_0x49af66[_0x2ef6('0x31')],_0x49af66['query']);_0x58e47b['attributes']=_[_0x2ef6('0x36')](_0x49af66[_0x2ef6('0x31')],qs[_0x2ef6('0x37')](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x37')]));_0x58e47b['attributes']=_0x58e47b[_0x2ef6('0x38')][_0x2ef6('0x39')]?_0x58e47b[_0x2ef6('0x38')]:_0x49af66[_0x2ef6('0x31')];if(!_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x3a')]('nolimit')){_0x58e47b[_0x2ef6('0x3b')]=qs[_0x2ef6('0x3b')](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x3b')]);_0x58e47b[_0x2ef6('0x1f')]=qs[_0x2ef6('0x1f')](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x1f')]);}_0x58e47b['order']=qs['sort'](_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x3c')]);_0x58e47b['where']=qs['filters'](_[_0x2ef6('0x3d')](_0x27406e['query'],_0x49af66[_0x2ef6('0x35')]),_0x20c750);if(_0x27406e[_0x2ef6('0x34')]['filter']){_0x58e47b[_0x2ef6('0x3e')]=_[_0x2ef6('0x3f')](_0x58e47b[_0x2ef6('0x3e')],{'$or':_['map'](_0x20c750,function(_0x1aa930){if(_0x1aa930[_0x2ef6('0x2f')]!==_0x2ef6('0x40')){var _0x4caa5e={};_0x4caa5e[_0x1aa930[_0x2ef6('0x33')]]={'$like':'%'+_0x27406e[_0x2ef6('0x34')][_0x2ef6('0x41')]+'%'};return _0x4caa5e;}})});}_0x58e47b=_['merge']({},_0x58e47b,_0x27406e[_0x2ef6('0x42')]);var _0x3a5e3f={'where':_0x58e47b[_0x2ef6('0x3e')]};return db[_0x2ef6('0x2c')][_0x2ef6('0x1e')](_0x3a5e3f)[_0x2ef6('0x24')](function(_0x380232){_0x2d138b[_0x2ef6('0x1e')]=_0x380232;if(_0x27406e['query'][_0x2ef6('0x43')]){_0x58e47b['include']=[{'all':!![]}];}return db[_0x2ef6('0x2c')]['findAll'](_0x58e47b);})[_0x2ef6('0x24')](function(_0x1bc2f9){_0x2d138b[_0x2ef6('0x44')]=_0x1bc2f9;return _0x2d138b;})[_0x2ef6('0x24')](respondWithFilteredResult(_0x3f4154,_0x58e47b))[_0x2ef6('0x45')](handleError(_0x3f4154,null));};exports[_0x2ef6('0x46')]=function(_0x359fcd,_0x554c96){var _0x573533={'raw':!![],'where':{'id':_0x359fcd[_0x2ef6('0x47')]['id']}},_0x182552={};_0x182552['model']=_[_0x2ef6('0x48')](db[_0x2ef6('0x2c')][_0x2ef6('0x2d')]);_0x182552[_0x2ef6('0x34')]=_[_0x2ef6('0x48')](_0x359fcd[_0x2ef6('0x34')]);_0x182552['filters']=_[_0x2ef6('0x36')](_0x182552[_0x2ef6('0x31')],_0x182552[_0x2ef6('0x34')]);_0x573533[_0x2ef6('0x38')]=_['intersection'](_0x182552['model'],qs[_0x2ef6('0x37')](_0x359fcd[_0x2ef6('0x34')]['fields']));_0x573533[_0x2ef6('0x38')]=_0x573533[_0x2ef6('0x38')][_0x2ef6('0x39')]?_0x573533[_0x2ef6('0x38')]:_0x182552['model'];if(_0x359fcd[_0x2ef6('0x34')][_0x2ef6('0x43')]){_0x573533['include']=[{'all':!![]}];}_0x573533=_[_0x2ef6('0x3f')]({},_0x573533,_0x359fcd[_0x2ef6('0x42')]);return db[_0x2ef6('0x2c')][_0x2ef6('0x49')](_0x573533)[_0x2ef6('0x24')](handleEntityNotFound(_0x554c96,null))[_0x2ef6('0x24')](respondWithResult(_0x554c96,null))[_0x2ef6('0x45')](handleError(_0x554c96,null));};exports[_0x2ef6('0x4a')]=function(_0x26d343,_0x4ad9bc){return db['Disposition']['create'](_0x26d343[_0x2ef6('0x4b')],{})[_0x2ef6('0x24')](function(_0x3fcc43){var _0xb0ee18=_0x26d343['user'][_0x2ef6('0x26')]({'plain':!![]});if(!_0xb0ee18)throw new Error(_0x2ef6('0x4c'));if(_0xb0ee18[_0x2ef6('0x4d')]===_0x2ef6('0x4e')){var _0x3964a3=_0x3fcc43[_0x2ef6('0x26')]({'plain':!![]});var _0x293e52=_0x2ef6('0x27');return db[_0x2ef6('0x4f')][_0x2ef6('0x49')]({'where':{'name':_0x293e52,'userProfileId':_0xb0ee18['userProfileId']},'raw':!![]})['then'](function(_0x4d76bf){if(_0x4d76bf&&_0x4d76bf['autoAssociation']===0x0){return db[_0x2ef6('0x28')][_0x2ef6('0x4a')]({'name':_0x3964a3[_0x2ef6('0x33')],'resourceId':_0x3964a3['id'],'type':_0x4d76bf[_0x2ef6('0x33')],'sectionId':_0x4d76bf['id']},{})[_0x2ef6('0x24')](function(){return _0x3fcc43;});}else{return _0x3fcc43;}})[_0x2ef6('0x45')](function(_0x57f501){logger[_0x2ef6('0x29')](_0x2ef6('0x50'),_0x57f501);throw _0x57f501;});}return _0x3fcc43;})[_0x2ef6('0x24')](respondWithResult(_0x4ad9bc,0xc9))[_0x2ef6('0x45')](handleError(_0x4ad9bc,null));};exports[_0x2ef6('0x23')]=function(_0x268abe,_0x41cacb){if(_0x268abe[_0x2ef6('0x4b')]['id']){delete _0x268abe[_0x2ef6('0x4b')]['id'];}return db['Disposition'][_0x2ef6('0x49')]({'where':{'id':_0x268abe[_0x2ef6('0x47')]['id']}})['then'](handleEntityNotFound(_0x41cacb,null))['then'](saveUpdates(_0x268abe[_0x2ef6('0x4b')],null))[_0x2ef6('0x24')](respondWithResult(_0x41cacb,null))['catch'](handleError(_0x41cacb,null));};exports[_0x2ef6('0x25')]=function(_0x4a2393,_0x14581c){return db[_0x2ef6('0x2c')][_0x2ef6('0x49')]({'where':{'id':_0x4a2393['params']['id']}})['then'](handleEntityNotFound(_0x14581c,null))['then'](removeEntity(_0x14581c,null))[_0x2ef6('0x45')](handleError(_0x14581c,null));}; \ No newline at end of file +var _0x04e3=['name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Disposition','includeAll','include','findAll','catch','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','Dispositions','end','error','stack'];(function(_0xff1723,_0x3935bd){var _0x390d6c=function(_0x37d2ce){while(--_0x37d2ce){_0xff1723['push'](_0xff1723['shift']());}};_0x390d6c(++_0x3935bd);}(_0x04e3,0x115));var _0x304e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x04e3[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x304e('0x0'));var zipdir=require(_0x304e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x304e('0x2'));var moment=require(_0x304e('0x3'));var BPromise=require(_0x304e('0x4'));var Mustache=require(_0x304e('0x5'));var util=require(_0x304e('0x6'));var path=require(_0x304e('0x7'));var sox=require(_0x304e('0x8'));var csv=require(_0x304e('0x9'));var ejs=require(_0x304e('0xa'));var fs=require('fs');var _=require(_0x304e('0xb'));var squel=require(_0x304e('0xc'));var crypto=require(_0x304e('0xd'));var jsforce=require(_0x304e('0xe'));var deskjs=require(_0x304e('0xf'));var toCsv=require(_0x304e('0x9'));var querystring=require(_0x304e('0x10'));var Papa=require(_0x304e('0x11'));var Redis=require('ioredis');var authService=require(_0x304e('0x12'));var qs=require(_0x304e('0x13'));var as=require(_0x304e('0x14'));var hardwareService=require(_0x304e('0x15'));var logger=require(_0x304e('0x16'))(_0x304e('0x17'));var utils=require(_0x304e('0x18'));var config=require(_0x304e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb9c461,_0x21b9c2){_0x21b9c2=_0x21b9c2||0xcc;return function(_0x5a41dc){if(_0x5a41dc){return _0xb9c461[_0x304e('0x1a')](_0x21b9c2);}return _0xb9c461[_0x304e('0x1b')](_0x21b9c2)['end']();};}function respondWithResult(_0x581bf3,_0x4fd970){_0x4fd970=_0x4fd970||0xc8;return function(_0x2e930c){if(_0x2e930c){return _0x581bf3[_0x304e('0x1b')](_0x4fd970)['json'](_0x2e930c);}};}function respondWithFilteredResult(_0x5b079a,_0xc2e936){return function(_0x332696){if(_0x332696){var _0x45cd3c=_0x332696[_0x304e('0x1c')],_0x1f5b8c=_0xc2e936[_0x304e('0x1d')],_0x1c7cec=_0xc2e936[_0x304e('0x1d')]+_0xc2e936[_0x304e('0x1e')],_0x35b339;if(_0x1c7cec>=_0x45cd3c){_0x1c7cec=_0x45cd3c;_0x35b339=0xc8;}else{_0x35b339=0xce;}_0x5b079a[_0x304e('0x1b')](_0x35b339);return _0x5b079a[_0x304e('0x1f')](_0x304e('0x20'),_0x1f5b8c+'-'+_0x1c7cec+'/'+_0x45cd3c)[_0x304e('0x21')](_0x332696);}return null;};}function patchUpdates(_0x518784){return function(_0x369ac9){try{jsonpatch['apply'](_0x369ac9,_0x518784,!![]);}catch(_0xe69e4e){return BPromise[_0x304e('0x22')](_0xe69e4e);}return _0x369ac9['save']();};}function saveUpdates(_0x5da3fc,_0x50d5a1){return function(_0x4c039b){if(_0x4c039b){return _0x4c039b[_0x304e('0x23')](_0x5da3fc)[_0x304e('0x24')](function(_0x480457){return _0x480457;});}return null;};}function removeEntity(_0x100505,_0xa84ba9){return function(_0x25faf1){if(_0x25faf1){return _0x25faf1[_0x304e('0x25')]()[_0x304e('0x24')](function(){var _0x5e7ec9=_0x25faf1[_0x304e('0x26')]({'plain':!![]});var _0x4b4c9e=_0x304e('0x27');return db['UserProfileResource'][_0x304e('0x25')]({'where':{'type':_0x4b4c9e,'resourceId':_0x5e7ec9['id']}})[_0x304e('0x24')](function(){return _0x25faf1;});})[_0x304e('0x24')](function(){_0x100505[_0x304e('0x1b')](0xcc)[_0x304e('0x28')]();});}};}function handleEntityNotFound(_0x969746,_0x1303b2){return function(_0x2f24a8){if(!_0x2f24a8){_0x969746[_0x304e('0x1a')](0x194);}return _0x2f24a8;};}function handleError(_0x3536be,_0x495993){_0x495993=_0x495993||0x1f4;return function(_0x51746e){logger[_0x304e('0x29')](_0x51746e[_0x304e('0x2a')]);if(_0x51746e[_0x304e('0x2b')]){delete _0x51746e['name'];}_0x3536be[_0x304e('0x1b')](_0x495993)[_0x304e('0x2c')](_0x51746e);};}exports['index']=function(_0x2a8435,_0x1df23c){var _0x30549c={},_0x413fb5={},_0x2cd4c3={'count':0x0,'rows':[]};var _0x1ea51f=_[_0x304e('0x2d')](db['Disposition'][_0x304e('0x2e')],function(_0x5771c5){return{'name':_0x5771c5[_0x304e('0x2f')],'type':_0x5771c5[_0x304e('0x30')]['key']};});_0x413fb5[_0x304e('0x31')]=_[_0x304e('0x2d')](_0x1ea51f,'name');_0x413fb5['query']=_[_0x304e('0x32')](_0x2a8435[_0x304e('0x33')]);_0x413fb5[_0x304e('0x34')]=_[_0x304e('0x35')](_0x413fb5[_0x304e('0x31')],_0x413fb5[_0x304e('0x33')]);_0x30549c[_0x304e('0x36')]=_[_0x304e('0x35')](_0x413fb5['model'],qs[_0x304e('0x37')](_0x2a8435['query']['fields']));_0x30549c['attributes']=_0x30549c[_0x304e('0x36')][_0x304e('0x38')]?_0x30549c['attributes']:_0x413fb5[_0x304e('0x31')];if(!_0x2a8435[_0x304e('0x33')][_0x304e('0x39')](_0x304e('0x3a'))){_0x30549c[_0x304e('0x1e')]=qs['limit'](_0x2a8435[_0x304e('0x33')][_0x304e('0x1e')]);_0x30549c[_0x304e('0x1d')]=qs[_0x304e('0x1d')](_0x2a8435[_0x304e('0x33')][_0x304e('0x1d')]);}_0x30549c[_0x304e('0x3b')]=qs[_0x304e('0x3c')](_0x2a8435[_0x304e('0x33')][_0x304e('0x3c')]);_0x30549c['where']=qs[_0x304e('0x34')](_[_0x304e('0x3d')](_0x2a8435[_0x304e('0x33')],_0x413fb5[_0x304e('0x34')]),_0x1ea51f);if(_0x2a8435[_0x304e('0x33')][_0x304e('0x3e')]){_0x30549c['where']=_['merge'](_0x30549c[_0x304e('0x3f')],{'$or':_[_0x304e('0x2d')](_0x1ea51f,function(_0x155cbd){if(_0x155cbd[_0x304e('0x30')]!=='VIRTUAL'){var _0x3e1806={};_0x3e1806[_0x155cbd[_0x304e('0x2b')]]={'$like':'%'+_0x2a8435[_0x304e('0x33')]['filter']+'%'};return _0x3e1806;}})});}_0x30549c=_[_0x304e('0x40')]({},_0x30549c,_0x2a8435[_0x304e('0x41')]);var _0x2c711c={'where':_0x30549c[_0x304e('0x3f')]};return db[_0x304e('0x42')][_0x304e('0x1c')](_0x2c711c)[_0x304e('0x24')](function(_0x585d56){_0x2cd4c3[_0x304e('0x1c')]=_0x585d56;if(_0x2a8435[_0x304e('0x33')][_0x304e('0x43')]){_0x30549c[_0x304e('0x44')]=[{'all':!![]}];}return db[_0x304e('0x42')][_0x304e('0x45')](_0x30549c);})[_0x304e('0x24')](function(_0x5c65c1){_0x2cd4c3['rows']=_0x5c65c1;return _0x2cd4c3;})[_0x304e('0x24')](respondWithFilteredResult(_0x1df23c,_0x30549c))[_0x304e('0x46')](handleError(_0x1df23c,null));};exports['show']=function(_0x2b7e09,_0x237d1c){var _0x4265ca={'raw':!![],'where':{'id':_0x2b7e09['params']['id']}},_0xcfe30c={};_0xcfe30c['model']=_[_0x304e('0x32')](db[_0x304e('0x42')][_0x304e('0x2e')]);_0xcfe30c[_0x304e('0x33')]=_[_0x304e('0x32')](_0x2b7e09[_0x304e('0x33')]);_0xcfe30c[_0x304e('0x34')]=_['intersection'](_0xcfe30c[_0x304e('0x31')],_0xcfe30c['query']);_0x4265ca['attributes']=_[_0x304e('0x35')](_0xcfe30c[_0x304e('0x31')],qs['fields'](_0x2b7e09[_0x304e('0x33')]['fields']));_0x4265ca[_0x304e('0x36')]=_0x4265ca['attributes']['length']?_0x4265ca['attributes']:_0xcfe30c[_0x304e('0x31')];if(_0x2b7e09[_0x304e('0x33')][_0x304e('0x43')]){_0x4265ca['include']=[{'all':!![]}];}_0x4265ca=_[_0x304e('0x40')]({},_0x4265ca,_0x2b7e09['options']);return db[_0x304e('0x42')]['find'](_0x4265ca)[_0x304e('0x24')](handleEntityNotFound(_0x237d1c,null))[_0x304e('0x24')](respondWithResult(_0x237d1c,null))['catch'](handleError(_0x237d1c,null));};exports[_0x304e('0x47')]=function(_0x30fa84,_0x5e2134){return db[_0x304e('0x42')]['create'](_0x30fa84['body'],{})[_0x304e('0x24')](function(_0xbeedf7){var _0x16af38=_0x30fa84[_0x304e('0x48')][_0x304e('0x26')]({'plain':!![]});if(!_0x16af38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16af38[_0x304e('0x49')]===_0x304e('0x48')){var _0x11126a=_0xbeedf7[_0x304e('0x26')]({'plain':!![]});var _0x29c4ee='Dispositions';return db[_0x304e('0x4a')][_0x304e('0x4b')]({'where':{'name':_0x29c4ee,'userProfileId':_0x16af38['userProfileId']},'raw':!![]})[_0x304e('0x24')](function(_0x257133){if(_0x257133&&_0x257133[_0x304e('0x4c')]===0x0){return db['UserProfileResource'][_0x304e('0x47')]({'name':_0x11126a[_0x304e('0x2b')],'resourceId':_0x11126a['id'],'type':_0x257133['name'],'sectionId':_0x257133['id']},{})['then'](function(){return _0xbeedf7;});}else{return _0xbeedf7;}})[_0x304e('0x46')](function(_0xf526dd){logger['error'](_0x304e('0x4d'),_0xf526dd);throw _0xf526dd;});}return _0xbeedf7;})[_0x304e('0x24')](respondWithResult(_0x5e2134,0xc9))[_0x304e('0x46')](handleError(_0x5e2134,null));};exports[_0x304e('0x23')]=function(_0x5e6d4f,_0x58f64a){if(_0x5e6d4f[_0x304e('0x4e')]['id']){delete _0x5e6d4f[_0x304e('0x4e')]['id'];}return db[_0x304e('0x42')]['find']({'where':{'id':_0x5e6d4f[_0x304e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x58f64a,null))[_0x304e('0x24')](saveUpdates(_0x5e6d4f['body'],null))[_0x304e('0x24')](respondWithResult(_0x58f64a,null))[_0x304e('0x46')](handleError(_0x58f64a,null));};exports['destroy']=function(_0x5de073,_0x1aaea6){return db['Disposition']['find']({'where':{'id':_0x5de073[_0x304e('0x4f')]['id']}})[_0x304e('0x24')](handleEntityNotFound(_0x1aaea6,null))[_0x304e('0x24')](removeEntity(_0x1aaea6,null))[_0x304e('0x46')](handleError(_0x1aaea6,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 46918c6..997194c 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 _0x591a=['WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x5be89e,_0x33a526){var _0x2808e6=function(_0x437e02){while(--_0x437e02){_0x5be89e['push'](_0x5be89e['shift']());}};_0x2808e6(++_0x33a526);}(_0x591a,0x18d));var _0xa591=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x591a[_0x34f701];return _0x3e2429;};'use strict';var _=require(_0xa591('0x0'));var util=require(_0xa591('0x1'));var logger=require(_0xa591('0x2'))(_0xa591('0x3'));var moment=require('moment');var BPromise=require(_0xa591('0x4'));var rp=require(_0xa591('0x5'));var fs=require('fs');var path=require(_0xa591('0x6'));var rimraf=require(_0xa591('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xa591('0x8')]=function(_0x5a9341,_0x36d854){return _0x5a9341[_0xa591('0x9')](_0xa591('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xa591('0xb'),'fields':[_0xa591('0xc'),_0xa591('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xa591('0xc'),_0xa591('0xe')]},{'unique':!![],'name':_0xa591('0xf'),'fields':['name',_0xa591('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0xa591('0xc'),_0xa591('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0xa591('0x12')]},{'unique':!![],'name':_0xa591('0x13'),'fields':[_0xa591('0xc'),_0xa591('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xa591('0xc'),_0xa591('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c8f=['name','ListId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0xe74afb,_0x2c9ae4){var _0x1cdd92=function(_0x2f3d22){while(--_0x2f3d22){_0xe74afb['push'](_0xe74afb['shift']());}};_0x1cdd92(++_0x2c9ae4);}(_0x5c8f,0x1a8));var _0xf5c8=function(_0x4b699c,_0x4728b9){_0x4b699c=_0x4b699c-0x0;var _0x43d390=_0x5c8f[_0x4b699c];return _0x43d390;};'use strict';var _=require(_0xf5c8('0x0'));var util=require(_0xf5c8('0x1'));var logger=require(_0xf5c8('0x2'))(_0xf5c8('0x3'));var moment=require(_0xf5c8('0x4'));var BPromise=require(_0xf5c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5c8('0x6'));var rimraf=require(_0xf5c8('0x7'));var config=require(_0xf5c8('0x8'));var attributes=require(_0xf5c8('0x9'));module['exports']=function(_0x2d8b8e,_0x4f64b0){return _0x2d8b8e[_0xf5c8('0xa')](_0xf5c8('0xb'),attributes,{'tableName':_0xf5c8('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xf5c8('0xd'),_0xf5c8('0xe')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xf5c8('0xf'),'fields':['name',_0xf5c8('0x10')]},{'unique':!![],'name':_0xf5c8('0x11'),'fields':[_0xf5c8('0xd'),_0xf5c8('0x12')]},{'unique':!![],'name':_0xf5c8('0x13'),'fields':[_0xf5c8('0xd'),_0xf5c8('0x14')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xf5c8('0x15')]},{'unique':!![],'name':_0xf5c8('0x16'),'fields':[_0xf5c8('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f31c566..9b06652 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 _0xc212=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','Disposition,\x20%s,\x20%s','lodash'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0xc212,0xef));var _0x2c21=function(_0x1c1b18,_0x56e6ee){_0x1c1b18=_0x1c1b18-0x0;var _0x278327=_0xc212[_0x1c1b18];return _0x278327;};'use strict';var _=require(_0x2c21('0x0'));var util=require(_0x2c21('0x1'));var moment=require('moment');var BPromise=require(_0x2c21('0x2'));var rs=require(_0x2c21('0x3'));var fs=require('fs');var Redis=require(_0x2c21('0x4'));var db=require(_0x2c21('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c21('0x6'));var config=require(_0x2c21('0x7'));var jayson=require(_0x2c21('0x8'));var client=jayson[_0x2c21('0x9')][_0x2c21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56efc4,_0x2e0aad,_0x3ae7f1){return new BPromise(function(_0x25caa1,_0x2c304d){return client[_0x2c21('0xb')](_0x56efc4,_0x3ae7f1)[_0x2c21('0xc')](function(_0x19c6c9){logger[_0x2c21('0xd')]('Disposition,\x20%s,\x20%s',_0x2e0aad,_0x2c21('0xe'));logger[_0x2c21('0xf')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2e0aad,_0x2c21('0xe'),JSON[_0x2c21('0x10')](_0x19c6c9));if(_0x19c6c9[_0x2c21('0x11')]){if(_0x19c6c9[_0x2c21('0x11')]['code']===0x1f4){logger[_0x2c21('0x11')]('Disposition,\x20%s,\x20%s',_0x2e0aad,_0x19c6c9[_0x2c21('0x11')]['message']);return _0x2c304d(_0x19c6c9[_0x2c21('0x11')][_0x2c21('0x12')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x2e0aad,_0x19c6c9['error'][_0x2c21('0x12')]);return _0x25caa1(_0x19c6c9[_0x2c21('0x11')][_0x2c21('0x12')]);}else{logger['info'](_0x2c21('0x13'),_0x2e0aad,_0x2c21('0xe'));_0x25caa1(_0x19c6c9['result']['message']);}})['catch'](function(_0x4d32f7){logger[_0x2c21('0x11')](_0x2c21('0x13'),_0x2e0aad,_0x4d32f7);_0x2c304d(_0x4d32f7);});});} \ No newline at end of file +var _0x0fed=['stringify','error','Disposition,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x184cbc,_0xa97898){var _0x5aba8d=function(_0x28aac5){while(--_0x28aac5){_0x184cbc['push'](_0x184cbc['shift']());}};_0x5aba8d(++_0xa97898);}(_0x0fed,0x72));var _0xd0fe=function(_0x22730b,_0x3aafcd){_0x22730b=_0x22730b-0x0;var _0x20af64=_0x0fed[_0x22730b];return _0x20af64;};'use strict';var _=require(_0xd0fe('0x0'));var util=require(_0xd0fe('0x1'));var moment=require('moment');var BPromise=require(_0xd0fe('0x2'));var rs=require(_0xd0fe('0x3'));var fs=require('fs');var Redis=require(_0xd0fe('0x4'));var db=require(_0xd0fe('0x5'))['db'];var utils=require(_0xd0fe('0x6'));var logger=require('../../config/logger')(_0xd0fe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd0fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267e84,_0x1c7f47,_0x3766e7){return new BPromise(function(_0x4119e2,_0x5d76e5){return client['request'](_0x267e84,_0x3766e7)[_0xd0fe('0x9')](function(_0x50a810){logger['info']('Disposition,\x20%s,\x20%s',_0x1c7f47,'request\x20sent');logger['debug'](_0xd0fe('0xa'),_0x1c7f47,_0xd0fe('0xb'),JSON[_0xd0fe('0xc')](_0x50a810));if(_0x50a810['error']){if(_0x50a810[_0xd0fe('0xd')]['code']===0x1f4){logger[_0xd0fe('0xd')](_0xd0fe('0xe'),_0x1c7f47,_0x50a810[_0xd0fe('0xd')]['message']);return _0x5d76e5(_0x50a810[_0xd0fe('0xd')][_0xd0fe('0xf')]);}logger[_0xd0fe('0xd')](_0xd0fe('0xe'),_0x1c7f47,_0x50a810[_0xd0fe('0xd')]['message']);return _0x4119e2(_0x50a810[_0xd0fe('0xd')][_0xd0fe('0xf')]);}else{logger['info'](_0xd0fe('0xe'),_0x1c7f47,_0xd0fe('0xb'));_0x4119e2(_0x50a810[_0xd0fe('0x10')][_0xd0fe('0xf')]);}})[_0xd0fe('0x11')](function(_0x3c6c22){logger[_0xd0fe('0xd')]('Disposition,\x20%s,\x20%s',_0x1c7f47,_0x3c6c22);_0x5d76e5(_0x3c6c22);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 43835c5..b5caf2d 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 _0xa866=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util'];(function(_0x35a547,_0x5507a7){var _0x485b9f=function(_0x53b2ef){while(--_0x53b2ef){_0x35a547['push'](_0x35a547['shift']());}};_0x485b9f(++_0x5507a7);}(_0xa866,0x6a));var _0x6a86=function(_0x1d7d5c,_0x40b80e){_0x1d7d5c=_0x1d7d5c-0x0;var _0x5dfe7b=_0xa866[_0x1d7d5c];return _0x5dfe7b;};'use strict';var multer=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var path=require(_0x6a86('0x2'));var timeout=require(_0x6a86('0x3'));var express=require(_0x6a86('0x4'));var router=express['Router']();var auth=require(_0x6a86('0x5'));var interaction=require(_0x6a86('0x6'));var config=require(_0x6a86('0x7'));var controller=require('./disposition.controller');router[_0x6a86('0x8')]('/',auth[_0x6a86('0x9')](),controller[_0x6a86('0xa')]);router['get'](_0x6a86('0xb'),auth[_0x6a86('0x9')](),controller[_0x6a86('0xc')]);router[_0x6a86('0xd')]('/',auth[_0x6a86('0x9')](),controller[_0x6a86('0xe')]);router[_0x6a86('0xf')](_0x6a86('0xb'),auth[_0x6a86('0x9')](),controller['update']);router[_0x6a86('0x10')](_0x6a86('0xb'),auth[_0x6a86('0x9')](),controller['destroy']);module[_0x6a86('0x11')]=router; \ No newline at end of file +var _0xd237=['../../config/environment','./disposition.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xd237,0x14f));var _0x7d23=function(_0x18bd98,_0x56d69d){_0x18bd98=_0x18bd98-0x0;var _0x404e0c=_0xd237[_0x18bd98];return _0x404e0c;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require(_0x7d23('0x3'));var express=require('express');var router=express[_0x7d23('0x4')]();var auth=require(_0x7d23('0x5'));var interaction=require(_0x7d23('0x6'));var config=require(_0x7d23('0x7'));var controller=require(_0x7d23('0x8'));router[_0x7d23('0x9')]('/',auth['isAuthenticated'](),controller[_0x7d23('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7d23('0xb')]);router[_0x7d23('0xc')]('/',auth[_0x7d23('0xd')](),controller[_0x7d23('0xe')]);router[_0x7d23('0xf')](_0x7d23('0x10'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x11')]);router['delete'](_0x7d23('0x10'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d4923a6..d710236 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 _0x80f9=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','ENUM','14400','INTEGER','IAX','DADHI','KHOMP','SIP'];(function(_0x197949,_0x5c89e3){var _0x3b6fcb=function(_0xe15c26){while(--_0xe15c26){_0x197949['push'](_0x197949['shift']());}};_0x3b6fcb(++_0x5c89e3);}(_0x80f9,0xc6));var _0x980f=function(_0x11b3d4,_0x2692eb){_0x11b3d4=_0x11b3d4-0x0;var _0xfd5f99=_0x80f9[_0x11b3d4];return _0xfd5f99;};'use strict';var Sequelize=require(_0x980f('0x0'));module[_0x980f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x980f('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x980f('0x3'),'no'),'defaultValue':_0x980f('0x3')},'headerinfo':{'type':Sequelize[_0x980f('0x2')],'defaultValue':_0x980f('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x980f('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x980f('0x6'),_0x980f('0x7'),_0x980f('0x8'),_0x980f('0x9'),_0x980f('0xa'),'14400'),'defaultValue':_0x980f('0x7')},'maxrate':{'type':Sequelize[_0x980f('0xb')](_0x980f('0x6'),_0x980f('0x7'),'7200',_0x980f('0x9'),'12000',_0x980f('0xc')),'defaultValue':_0x980f('0xc')},'modem':{'type':Sequelize[_0x980f('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x980f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x980f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x980f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x980f('0xb')]('SIP',_0x980f('0xe'),_0x980f('0xf'),_0x980f('0x10')),'defaultValue':_0x980f('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x980f('0x12')],'defaultValue':function(){return _0x980f('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x980f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x980f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x980f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x980f('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x980f('0x14')],'defaultValue':![],'comment':_0x980f('0x15'),'set':function(_0x393d1c){if(!_0x393d1c)this[_0x980f('0x16')](_0x980f('0x17'),null);this[_0x980f('0x16')]('mandatoryDisposition',_0x393d1c);}}}; \ No newline at end of file +var _0xdb41=['SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER'];(function(_0x2790fd,_0xbc208b){var _0x5eb880=function(_0x5686f9){while(--_0x5686f9){_0x2790fd['push'](_0x2790fd['shift']());}};_0x5eb880(++_0xbc208b);}(_0xdb41,0x111));var _0x1db4=function(_0x5bf9fd,_0x3f1d89){_0x5bf9fd=_0x5bf9fd-0x0;var _0x3563ce=_0xdb41[_0x5bf9fd];return _0x3563ce;};'use strict';var Sequelize=require(_0x1db4('0x0'));module[_0x1db4('0x1')]={'name':{'type':Sequelize[_0x1db4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1db4('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1db4('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1db4('0x4')},'localstationid':{'type':Sequelize[_0x1db4('0x2')],'unique':_0x1db4('0x5')},'minrate':{'type':Sequelize[_0x1db4('0x6')](_0x1db4('0x7'),_0x1db4('0x8'),_0x1db4('0x9'),_0x1db4('0xa'),'12000',_0x1db4('0xb')),'defaultValue':_0x1db4('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x1db4('0x7'),_0x1db4('0x8'),'7200',_0x1db4('0xa'),_0x1db4('0xc'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x1db4('0x2')],'defaultValue':_0x1db4('0xd')},'gateway':{'type':Sequelize[_0x1db4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1db4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1db4('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x1db4('0xf'),_0x1db4('0x10'),_0x1db4('0x11'),_0x1db4('0x12')),'defaultValue':_0x1db4('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1db4('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1db4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1db4('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1db4('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xdd2042){if(!_0xdd2042)this[_0x1db4('0x15')](_0x1db4('0x16'),null);this[_0x1db4('0x15')](_0x1db4('0x17'),_0xdd2042);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1195d7f..92f60c4 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 _0x29eb=['includeAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','FaxApplication','bulkCreate','priority','getApplications','context','exten','app','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','http','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','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','describe','Disposition','getDispositions','findOne','FaxAccountId','count'];(function(_0x1ac5e9,_0x321509){var _0x5e92dc=function(_0xdacf6e){while(--_0xdacf6e){_0x1ac5e9['push'](_0x1ac5e9['shift']());}};_0x5e92dc(++_0x321509);}(_0x29eb,0x11f));var _0xb29e=function(_0x125166,_0xd7e07e){_0x125166=_0x125166-0x0;var _0x4b5856=_0x29eb[_0x125166];return _0x4b5856;};'use strict';var pdf=require(_0xb29e('0x0'));var emlformat=require(_0xb29e('0x1'));var rimraf=require(_0xb29e('0x2'));var zipdir=require(_0xb29e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb29e('0x4'));var moment=require(_0xb29e('0x5'));var BPromise=require(_0xb29e('0x6'));var Mustache=require('mustache');var util=require(_0xb29e('0x7'));var path=require(_0xb29e('0x8'));var sox=require(_0xb29e('0x9'));var csv=require(_0xb29e('0xa'));var ejs=require(_0xb29e('0xb'));var fs=require('fs');var _=require(_0xb29e('0xc'));var squel=require(_0xb29e('0xd'));var crypto=require(_0xb29e('0xe'));var jsforce=require(_0xb29e('0xf'));var deskjs=require(_0xb29e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb29e('0x11'));var authService=require(_0xb29e('0x12'));var qs=require(_0xb29e('0x13'));var as=require(_0xb29e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb29e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb29e('0x16')]=_[_0xb29e('0x17')](config[_0xb29e('0x16')],{'host':_0xb29e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb29e('0x16')]));require(_0xb29e('0x19'))[_0xb29e('0x1a')](socket);var jayson=require(_0xb29e('0x1b'));var client=jayson['client'][_0xb29e('0x1c')]({'port':0x232c});var client9002=jayson[_0xb29e('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x370aa2,_0x419eb7,_0xc62791){if(_0xc62791){var _0x408a96=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x408a96[_0xb29e('0x1e')](_0x419eb7)){return _0x370aa2;}else{throw new db['Sequelize']['ValidationError'](_0xb29e('0x1f'));}}else{return _0x370aa2;}}function respondWithRpcPromise(_0x39cb7d,_0x9185dc,_0x893e71,_0x556edf){return new BPromise(function(_0xb8efa9,_0x4b01b8){var _0x2dcf96=_0x556edf||client;return _0x2dcf96['request'](_0x39cb7d,_0x893e71)[_0xb29e('0x20')](function(_0x2d53e2){logger[_0xb29e('0x21')]('FaxAccount,\x20%s,\x20%s',_0x9185dc,_0xb29e('0x22'));logger[_0xb29e('0x23')](_0xb29e('0x24'),_0x9185dc,_0xb29e('0x22'),JSON[_0xb29e('0x25')](_0x2d53e2));if(_0x2d53e2[_0xb29e('0x26')]){if(_0x2d53e2[_0xb29e('0x26')][_0xb29e('0x27')]===0x1f4){logger[_0xb29e('0x26')](_0xb29e('0x28'),_0x9185dc,_0x2d53e2['error'][_0xb29e('0x29')]);return _0x4b01b8(_0x2d53e2[_0xb29e('0x26')][_0xb29e('0x29')]);}logger['error'](_0xb29e('0x28'),_0x9185dc,_0x2d53e2[_0xb29e('0x26')]['message']);return _0xb8efa9(_0x2d53e2[_0xb29e('0x26')][_0xb29e('0x29')]);}else{logger[_0xb29e('0x21')](_0xb29e('0x28'),_0x9185dc,_0xb29e('0x22'));_0xb8efa9(_0x2d53e2['result']['message']);}})[_0xb29e('0x2a')](function(_0x2022b7){logger[_0xb29e('0x26')](_0xb29e('0x28'),_0x9185dc,_0x2022b7);_0x4b01b8(_0x2022b7);});});}function respondWithStatusCode(_0x118e0e,_0x463ff){_0x463ff=_0x463ff||0xcc;return function(_0x27f771){if(_0x27f771){return _0x118e0e[_0xb29e('0x2b')](_0x463ff);}return _0x118e0e[_0xb29e('0x2c')](_0x463ff)['end']();};}function respondWithResult(_0x1408e1,_0x40bf79){_0x40bf79=_0x40bf79||0xc8;return function(_0x4ff5b2){if(_0x4ff5b2){return _0x1408e1[_0xb29e('0x2c')](_0x40bf79)[_0xb29e('0x2d')](_0x4ff5b2);}};}function respondWithFilteredResult(_0x576b73,_0x2c0e66){return function(_0x320828){if(_0x320828){var _0x2f0751=_0x320828['count'],_0x24d991=_0x2c0e66[_0xb29e('0x2e')],_0x1ead8d=_0x2c0e66[_0xb29e('0x2e')]+_0x2c0e66[_0xb29e('0x2f')],_0x4d347a;if(_0x1ead8d>=_0x2f0751){_0x1ead8d=_0x2f0751;_0x4d347a=0xc8;}else{_0x4d347a=0xce;}_0x576b73[_0xb29e('0x2c')](_0x4d347a);return _0x576b73[_0xb29e('0x30')](_0xb29e('0x31'),_0x24d991+'-'+_0x1ead8d+'/'+_0x2f0751)[_0xb29e('0x2d')](_0x320828);}return null;};}function patchUpdates(_0x2e6baf){return function(_0x34b6cb){try{jsonpatch['apply'](_0x34b6cb,_0x2e6baf,!![]);}catch(_0x397b58){return BPromise[_0xb29e('0x32')](_0x397b58);}return _0x34b6cb[_0xb29e('0x33')]();};}function saveUpdates(_0x279108,_0x3137f2){return function(_0x2b94dd){if(_0x2b94dd){return _0x2b94dd[_0xb29e('0x34')](_0x279108)[_0xb29e('0x20')](function(_0xab88e6){return _0xab88e6;});}return null;};}function removeEntity(_0x460f79,_0x19add8){return function(_0x13e338){if(_0x13e338){return _0x13e338[_0xb29e('0x35')]()[_0xb29e('0x20')](function(){var _0x193156=_0x13e338[_0xb29e('0x36')]({'plain':!![]});var _0x1c281c=_0xb29e('0x37');return db[_0xb29e('0x38')][_0xb29e('0x35')]({'where':{'type':_0x1c281c,'resourceId':_0x193156['id']}})['then'](function(){return _0x13e338;});})['then'](function(){_0x460f79[_0xb29e('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa743c1,_0x260286){return function(_0x3fdc33){if(!_0x3fdc33){_0xa743c1['sendStatus'](0x194);}return _0x3fdc33;};}function handleError(_0x59aed5,_0x5d80ba){_0x5d80ba=_0x5d80ba||0x1f4;return function(_0x12363b){logger['error'](_0x12363b[_0xb29e('0x39')]);if(_0x12363b[_0xb29e('0x3a')]){delete _0x12363b['name'];}_0x59aed5[_0xb29e('0x2c')](_0x5d80ba)['send'](_0x12363b);};}exports[_0xb29e('0x3b')]=function(_0x4da8da,_0x30425d){var _0x51ee2c={'include':[{'model':db[_0xb29e('0x3c')],'as':_0xb29e('0x3d')}]},_0x41108f={},_0x5a405c={'count':0x0,'rows':[]};var _0x43c708=_['map'](db[_0xb29e('0x3e')][_0xb29e('0x3f')],function(_0x10d1fd){return{'name':_0x10d1fd[_0xb29e('0x40')],'type':_0x10d1fd[_0xb29e('0x41')][_0xb29e('0x42')]};});_0x41108f[_0xb29e('0x43')]=_[_0xb29e('0x44')](_0x43c708,'name');_0x41108f[_0xb29e('0x45')]=_['keys'](_0x4da8da['query']);_0x41108f[_0xb29e('0x46')]=_[_0xb29e('0x47')](_0x41108f[_0xb29e('0x43')],_0x41108f['query']);_0x51ee2c[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x41108f[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x4da8da[_0xb29e('0x45')][_0xb29e('0x49')]));_0x51ee2c[_0xb29e('0x48')]=_0x51ee2c[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x51ee2c[_0xb29e('0x48')]:_0x41108f['model'];if(!_0x4da8da[_0xb29e('0x45')][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x51ee2c['limit']=qs[_0xb29e('0x2f')](_0x4da8da['query']['limit']);_0x51ee2c[_0xb29e('0x2e')]=qs['offset'](_0x4da8da['query'][_0xb29e('0x2e')]);}_0x51ee2c[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x4da8da[_0xb29e('0x45')][_0xb29e('0x4e')]);_0x51ee2c[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x4da8da[_0xb29e('0x45')],_0x41108f[_0xb29e('0x46')]),_0x43c708);if(_0x4da8da['query']['filter']){_0x51ee2c[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x51ee2c[_0xb29e('0x4f')],{'$or':_[_0xb29e('0x44')](_0x43c708,function(_0x1d366a){if(_0x1d366a[_0xb29e('0x41')]!==_0xb29e('0x52')){var _0x126f25={};_0x126f25[_0x1d366a[_0xb29e('0x3a')]]={'$like':'%'+_0x4da8da[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x126f25;}})});}_0x51ee2c=_[_0xb29e('0x51')]({},_0x51ee2c,_0x4da8da[_0xb29e('0x54')]);var _0x5057ba={'where':_0x51ee2c[_0xb29e('0x4f')]};return db[_0xb29e('0x3e')]['count'](_0x5057ba)[_0xb29e('0x20')](function(_0x3708f7){_0x5a405c['count']=_0x3708f7;if(_0x4da8da[_0xb29e('0x45')]['includeAll']){_0x51ee2c[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0x3e')][_0xb29e('0x56')](_0x51ee2c);})['then'](function(_0x35d698){_0x5a405c[_0xb29e('0x57')]=_0x35d698;return _0x5a405c;})['then'](respondWithFilteredResult(_0x30425d,_0x51ee2c))[_0xb29e('0x2a')](handleError(_0x30425d,null));};exports[_0xb29e('0x58')]=function(_0x3d0926,_0x51cf46){var _0x43d15b={'raw':![],'where':{'id':_0x3d0926[_0xb29e('0x59')]['id']},'include':[{'model':db[_0xb29e('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5c55e7={};_0x5c55e7['model']=_[_0xb29e('0x5a')](db['FaxAccount'][_0xb29e('0x3f')]);_0x5c55e7['query']=_[_0xb29e('0x5a')](_0x3d0926['query']);_0x5c55e7[_0xb29e('0x46')]=_[_0xb29e('0x47')](_0x5c55e7[_0xb29e('0x43')],_0x5c55e7['query']);_0x43d15b[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x5c55e7[_0xb29e('0x43')],qs['fields'](_0x3d0926[_0xb29e('0x45')]['fields']));_0x43d15b[_0xb29e('0x48')]=_0x43d15b['attributes'][_0xb29e('0x4a')]?_0x43d15b[_0xb29e('0x48')]:_0x5c55e7[_0xb29e('0x43')];if(_0x3d0926[_0xb29e('0x45')]['includeAll']){_0x43d15b['include']=[{'all':!![]}];}_0x43d15b=_[_0xb29e('0x51')]({},_0x43d15b,_0x3d0926['options']);return db[_0xb29e('0x3e')][_0xb29e('0x5b')](_0x43d15b)[_0xb29e('0x20')](handleEntityNotFound(_0x51cf46,null))['then'](respondWithResult(_0x51cf46,null))[_0xb29e('0x2a')](handleError(_0x51cf46,null));};exports[_0xb29e('0x5c')]=function(_0x1d2438,_0x2e7c38){return db[_0xb29e('0x3e')]['create'](_0x1d2438[_0xb29e('0x5d')],{})[_0xb29e('0x20')](function(_0x5a5624){var _0x93cb84=_0x1d2438[_0xb29e('0x5e')][_0xb29e('0x36')]({'plain':!![]});if(!_0x93cb84)throw new Error(_0xb29e('0x5f'));if(_0x93cb84[_0xb29e('0x60')]==='user'){var _0x36da60=_0x5a5624[_0xb29e('0x36')]({'plain':!![]});var _0x4314e5=_0xb29e('0x37');return db[_0xb29e('0x61')][_0xb29e('0x5b')]({'where':{'name':_0x4314e5,'userProfileId':_0x93cb84[_0xb29e('0x62')]},'raw':!![]})[_0xb29e('0x20')](function(_0x2d95d1){if(_0x2d95d1&&_0x2d95d1[_0xb29e('0x63')]===0x0){return db[_0xb29e('0x38')]['create']({'name':_0x36da60[_0xb29e('0x3a')],'resourceId':_0x36da60['id'],'type':_0x2d95d1['name'],'sectionId':_0x2d95d1['id']},{})[_0xb29e('0x20')](function(){return _0x5a5624;});}else{return _0x5a5624;}})[_0xb29e('0x2a')](function(_0x3f6842){logger['error'](_0xb29e('0x64'),_0x3f6842);throw _0x3f6842;});}return _0x5a5624;})[_0xb29e('0x20')](respondWithResult(_0x2e7c38,0xc9))[_0xb29e('0x2a')](handleError(_0x2e7c38,null));};exports['update']=function(_0x4ba35e,_0x41819a){if(_0x4ba35e[_0xb29e('0x5d')]['id']){delete _0x4ba35e[_0xb29e('0x5d')]['id'];}return db[_0xb29e('0x3e')][_0xb29e('0x5b')]({'where':{'id':_0x4ba35e[_0xb29e('0x59')]['id']},'include':[{'model':db[_0xb29e('0x3c')],'as':_0xb29e('0x3d')}]})['then'](handleEntityNotFound(_0x41819a,null))[_0xb29e('0x20')](saveUpdates(_0x4ba35e[_0xb29e('0x5d')],null))[_0xb29e('0x20')](respondWithResult(_0x41819a,null))[_0xb29e('0x2a')](handleError(_0x41819a,null));};exports['destroy']=function(_0x390c85,_0x4de06b){return db[_0xb29e('0x3e')][_0xb29e('0x5b')]({'where':{'id':_0x390c85[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x4de06b,null))[_0xb29e('0x20')](removeEntity(_0x4de06b,null))['catch'](handleError(_0x4de06b,null));};exports[_0xb29e('0x65')]=function(_0x52ed26,_0x132f78){return db[_0xb29e('0x3e')][_0xb29e('0x65')]()[_0xb29e('0x20')](respondWithResult(_0x132f78,null))['catch'](handleError(_0x132f78,null));};exports['addDisposition']=function(_0x3ca5e8,_0x177bae,_0x3fa650){if(_0x3ca5e8[_0xb29e('0x5d')]['id']){delete _0x3ca5e8[_0xb29e('0x5d')]['id'];}return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x3ca5e8[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x177bae,null))[_0xb29e('0x20')](function(_0x2885ab){if(_0x2885ab){_0x3ca5e8[_0xb29e('0x5d')]['FaxAccountId']=_0x2885ab['id'];return db[_0xb29e('0x66')][_0xb29e('0x5c')](_0x3ca5e8[_0xb29e('0x5d')]);}})[_0xb29e('0x20')](respondWithResult(_0x177bae,null))['catch'](handleError(_0x177bae,null));};exports[_0xb29e('0x67')]=function(_0x5bf3ec,_0x5e697d,_0x597450){var _0x209606={'raw':![],'where':{}};var _0x1950cd={};var _0xea04cc={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb29e('0x68')]({'where':{'id':_0x5bf3ec[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x5e697d,null))[_0xb29e('0x20')](function(_0x3dd509){if(_0x3dd509){_0x1950cd[_0xb29e('0x43')]=_[_0xb29e('0x5a')](db[_0xb29e('0x66')][_0xb29e('0x3f')]);_0x1950cd['query']=_['keys'](_0x5bf3ec[_0xb29e('0x45')]);_0x1950cd['filters']=_[_0xb29e('0x47')](_0x1950cd['model'],_0x1950cd[_0xb29e('0x45')]);_0x209606[_0xb29e('0x48')]=_['intersection'](_0x1950cd[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x49')]));_0x209606[_0xb29e('0x48')]=_0x209606[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x209606['attributes']:_0x1950cd[_0xb29e('0x43')];if(!_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x209606[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x5bf3ec['query']['limit']);_0x209606[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x2e')]);}_0x209606[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x4e')]);_0x209606[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_['pick'](_0x5bf3ec[_0xb29e('0x45')],_0x1950cd[_0xb29e('0x46')]));_0x209606[_0xb29e('0x4f')][_0xb29e('0x69')]=_0x3dd509['id'];if(_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x53')]){_0x209606[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x209606['where'],{'$or':_['map'](_0x209606[_0xb29e('0x48')],function(_0x3b3660){var _0x1c6828={};_0x1c6828[_0x3b3660]={'$like':'%'+_0x5bf3ec[_0xb29e('0x45')]['filter']+'%'};return _0x1c6828;})});}_0x209606=_[_0xb29e('0x51')]({},_0x209606,_0x5bf3ec[_0xb29e('0x54')]);return db[_0xb29e('0x66')][_0xb29e('0x6a')]({'where':_0x209606[_0xb29e('0x4f')]})['then'](function(_0x26fe4f){_0xea04cc['count']=_0x26fe4f;if(_0x5bf3ec[_0xb29e('0x45')][_0xb29e('0x6b')]){_0x209606[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0x66')]['findAll'](_0x209606);})[_0xb29e('0x20')](function(_0x509f32){_0xea04cc[_0xb29e('0x57')]=_0x509f32;return _0xea04cc;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x5e697d,_0x209606))[_0xb29e('0x2a')](handleError(_0x5e697d,null));};exports[_0xb29e('0x6c')]=function(_0x4c8d30,_0x5a372f,_0x3e4794){return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x4c8d30[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a372f,null))[_0xb29e('0x20')](function(_0x17ccc0){if(_0x17ccc0){return _0x17ccc0[_0xb29e('0x6c')](_0x4c8d30['query']['ids']);}})[_0xb29e('0x20')](respondWithStatusCode(_0x5a372f,null))[_0xb29e('0x2a')](handleError(_0x5a372f,null));};exports[_0xb29e('0x6d')]=function(_0x2ad25a,_0x4a3004,_0x1766f7){if(_0x2ad25a[_0xb29e('0x5d')]['id']){delete _0x2ad25a['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2ad25a['params']['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x4a3004,null))['then'](function(_0xe515c2){if(_0xe515c2){_0x2ad25a[_0xb29e('0x5d')][_0xb29e('0x69')]=_0xe515c2['id'];return db[_0xb29e('0x6e')][_0xb29e('0x5c')](_0x2ad25a[_0xb29e('0x5d')]);}})['then'](respondWithResult(_0x4a3004,null))['catch'](handleError(_0x4a3004,null));};exports['getAnswers']=function(_0x3ffb3c,_0x3b3316,_0x4dd3d){var _0x2d7d84={'raw':![],'where':{}};var _0x19de7a={};var _0x4c2298={'count':0x0,'rows':[]};return db[_0xb29e('0x3e')][_0xb29e('0x68')]({'where':{'id':_0x3ffb3c[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x3b3316,null))[_0xb29e('0x20')](function(_0x2f9669){if(_0x2f9669){_0x19de7a[_0xb29e('0x43')]=_['keys'](db[_0xb29e('0x6e')][_0xb29e('0x3f')]);_0x19de7a[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x3ffb3c['query']);_0x19de7a['filters']=_[_0xb29e('0x47')](_0x19de7a['model'],_0x19de7a['query']);_0x2d7d84['attributes']=_[_0xb29e('0x47')](_0x19de7a[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x3ffb3c[_0xb29e('0x45')][_0xb29e('0x49')]));_0x2d7d84[_0xb29e('0x48')]=_0x2d7d84[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x2d7d84[_0xb29e('0x48')]:_0x19de7a[_0xb29e('0x43')];if(!_0x3ffb3c['query'][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x2d7d84[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x3ffb3c[_0xb29e('0x45')]['limit']);_0x2d7d84[_0xb29e('0x2e')]=qs['offset'](_0x3ffb3c['query']['offset']);}_0x2d7d84[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x3ffb3c[_0xb29e('0x45')]['sort']);_0x2d7d84['where']=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x3ffb3c['query'],_0x19de7a[_0xb29e('0x46')]));_0x2d7d84[_0xb29e('0x4f')][_0xb29e('0x69')]=_0x2f9669['id'];if(_0x3ffb3c[_0xb29e('0x45')]['filter']){_0x2d7d84[_0xb29e('0x4f')]=_['merge'](_0x2d7d84['where'],{'$or':_[_0xb29e('0x44')](_0x2d7d84[_0xb29e('0x48')],function(_0x562d88){var _0x1ec9d2={};_0x1ec9d2[_0x562d88]={'$like':'%'+_0x3ffb3c[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x1ec9d2;})});}_0x2d7d84=_['merge']({},_0x2d7d84,_0x3ffb3c['options']);return db[_0xb29e('0x6e')]['count']({'where':_0x2d7d84['where']})[_0xb29e('0x20')](function(_0x500df4){_0x4c2298['count']=_0x500df4;if(_0x3ffb3c[_0xb29e('0x45')][_0xb29e('0x6b')]){_0x2d7d84[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0x6e')][_0xb29e('0x56')](_0x2d7d84);})[_0xb29e('0x20')](function(_0x3c4957){_0x4c2298[_0xb29e('0x57')]=_0x3c4957;return _0x4c2298;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x3b3316,_0x2d7d84))[_0xb29e('0x2a')](handleError(_0x3b3316,null));};exports[_0xb29e('0x6f')]=function(_0x457ab1,_0xa0175e,_0x1fe317){return db['FaxAccount'][_0xb29e('0x5b')]({'where':{'id':_0x457ab1[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0xa0175e,null))[_0xb29e('0x20')](function(_0x26b3f9){if(_0x26b3f9){return _0x26b3f9[_0xb29e('0x6f')](_0x457ab1[_0xb29e('0x45')][_0xb29e('0x70')]);}})[_0xb29e('0x20')](respondWithStatusCode(_0xa0175e,null))[_0xb29e('0x2a')](handleError(_0xa0175e,null));};exports[_0xb29e('0x71')]=function(_0x4f91b7,_0x402dd1,_0x4fbcb1){return db[_0xb29e('0x72')][_0xb29e('0x5b')]({'where':{'id':_0x4f91b7[_0xb29e('0x59')]['id']}})['then'](handleEntityNotFound(_0x402dd1,null))['then'](function(_0x2441f6){if(_0x2441f6){return _0x2441f6[_0xb29e('0x71')](_0x4f91b7[_0xb29e('0x5d')][_0xb29e('0x70')],_[_0xb29e('0x73')](_0x4f91b7[_0xb29e('0x5d')],['ids','id'])||{});}})[_0xb29e('0x20')](respondWithResult(_0x402dd1,null))[_0xb29e('0x2a')](handleError(_0x402dd1,null));};exports[_0xb29e('0x74')]=function(_0x282aeb,_0x339cf1,_0x4795b0){var _0x228a1f={'raw':![],'where':{}};var _0x451b34={};var _0x2fc6b4={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb29e('0x68')]({'where':{'id':_0x282aeb['params']['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x339cf1,null))[_0xb29e('0x20')](function(_0x5bc4af){if(_0x5bc4af){_0x451b34['model']=_[_0xb29e('0x5a')](db[_0xb29e('0x72')][_0xb29e('0x3f')]);_0x451b34['query']=_[_0xb29e('0x5a')](_0x282aeb[_0xb29e('0x45')]);_0x451b34['filters']=_[_0xb29e('0x47')](_0x451b34[_0xb29e('0x43')],_0x451b34['query']);_0x228a1f[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x451b34[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x282aeb[_0xb29e('0x45')]['fields']));_0x228a1f[_0xb29e('0x48')]=_0x228a1f['attributes'][_0xb29e('0x4a')]?_0x228a1f[_0xb29e('0x48')]:_0x451b34[_0xb29e('0x43')];if(!_0x282aeb[_0xb29e('0x45')][_0xb29e('0x4b')](_0xb29e('0x4c'))){_0x228a1f[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x282aeb[_0xb29e('0x45')][_0xb29e('0x2f')]);_0x228a1f[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x282aeb[_0xb29e('0x45')][_0xb29e('0x2e')]);}_0x228a1f[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x282aeb[_0xb29e('0x45')][_0xb29e('0x4e')]);_0x228a1f[_0xb29e('0x4f')]=qs['filters'](_[_0xb29e('0x50')](_0x282aeb[_0xb29e('0x45')],_0x451b34[_0xb29e('0x46')]));_0x228a1f['where'][_0xb29e('0x69')]=_0x5bc4af['id'];if(_0x282aeb[_0xb29e('0x45')][_0xb29e('0x53')]){_0x228a1f['where']=_[_0xb29e('0x51')](_0x228a1f[_0xb29e('0x4f')],{'$or':_[_0xb29e('0x44')](_0x228a1f[_0xb29e('0x48')],function(_0x3840db){var _0x1ced13={};_0x1ced13[_0x3840db]={'$like':'%'+_0x282aeb[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x1ced13;})});}_0x228a1f=_[_0xb29e('0x51')]({},_0x228a1f,_0x282aeb[_0xb29e('0x54')]);return db[_0xb29e('0x72')][_0xb29e('0x6a')]({'where':_0x228a1f[_0xb29e('0x4f')]})[_0xb29e('0x20')](function(_0x9cdb2c){_0x2fc6b4[_0xb29e('0x6a')]=_0x9cdb2c;if(_0x282aeb[_0xb29e('0x45')]['includeAll']){_0x228a1f[_0xb29e('0x55')]=[{'model':db[_0xb29e('0x75')],'as':_0xb29e('0x76'),'required':![]},{'model':db[_0xb29e('0x77')],'as':'Owner','attributes':[_0xb29e('0x3a'),_0xb29e('0x78'),_0xb29e('0x79')],'required':![]},{'model':db[_0xb29e('0x7a')],'as':_0xb29e('0x7b'),'attributes':['id','name',_0xb29e('0x7c')],'where':_0x282aeb[_0xb29e('0x45')]['tag']?{'id':_0x282aeb['query'][_0xb29e('0x7d')]}:undefined,'required':_0x282aeb[_0xb29e('0x45')][_0xb29e('0x7d')]?!![]:![]}];}return db[_0xb29e('0x72')][_0xb29e('0x56')](_0x228a1f);})[_0xb29e('0x20')](function(_0x3da448){_0x2fc6b4[_0xb29e('0x57')]=_0x3da448;return _0x2fc6b4;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x339cf1,_0x228a1f))[_0xb29e('0x2a')](handleError(_0x339cf1,null));};exports[_0xb29e('0x7e')]=function(_0x3c8a47,_0x2eeb02,_0x59d936){return db[_0xb29e('0x3e')][_0xb29e('0x68')]({'where':{'id':_0x3c8a47[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x2eeb02,null))[_0xb29e('0x20')](function(_0x4da2b3){if(_0x4da2b3){return db['sequelize']['transaction'](function(_0x247f6b){return db['FaxApplication'][_0xb29e('0x35')]({'where':{'FaxAccountId':_0x3c8a47[_0xb29e('0x59')]['id']},'transaction':_0x247f6b})[_0xb29e('0x20')](function(_0x27fe75){var _0x3c2dc5=_['map'](_0x3c8a47[_0xb29e('0x5d')],function(_0x4af790){_0x4af790[_0xb29e('0x69')]=_0x3c8a47[_0xb29e('0x59')]['id'];return _0x4af790;});return db[_0xb29e('0x7f')][_0xb29e('0x80')](_0x3c2dc5,{'transaction':_0x247f6b});});})[_0xb29e('0x20')](function(){return db[_0xb29e('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x3c8a47[_0xb29e('0x59')]['id']},'order':_0xb29e('0x81')});});}})[_0xb29e('0x20')](respondWithResult(_0x2eeb02,null))[_0xb29e('0x2a')](handleError(_0x2eeb02,null));};exports['getApplications']=function(_0x3dd921,_0x35ad26,_0x2533b5){var _0x3d518e={};var _0x3a8810={};var _0x15d1d3;var _0xe0110c;return db['FaxAccount']['findOne']({'where':{'id':_0x3dd921[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x35ad26,null))['then'](function(_0x3ca2a3){if(_0x3ca2a3){_0x15d1d3=_0x3ca2a3;_0x3a8810['model']=_[_0xb29e('0x5a')](db['FaxApplication'][_0xb29e('0x3f')]);_0x3a8810[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x3dd921[_0xb29e('0x45')]);_0x3a8810['filters']=_[_0xb29e('0x47')](_0x3a8810[_0xb29e('0x43')],_0x3a8810[_0xb29e('0x45')]);_0x3d518e[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x3a8810[_0xb29e('0x43')],qs['fields'](_0x3dd921['query'][_0xb29e('0x49')]));_0x3d518e[_0xb29e('0x48')]=_0x3d518e[_0xb29e('0x48')][_0xb29e('0x4a')]?_0x3d518e['attributes']:_0x3a8810['model'];_0x3d518e[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x3dd921[_0xb29e('0x45')]['sort']);_0x3d518e[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x3dd921[_0xb29e('0x45')],_0x3a8810['filters']));if(_0x3dd921[_0xb29e('0x45')][_0xb29e('0x53')]){_0x3d518e[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x3d518e['where'],{'$or':_[_0xb29e('0x44')](_0x3d518e[_0xb29e('0x48')],function(_0x5cf7a1){var _0x71b0cd={};_0x71b0cd[_0x5cf7a1]={'$like':'%'+_0x3dd921[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x71b0cd;})});}_0x3d518e=_[_0xb29e('0x51')]({},_0x3d518e,_0x3dd921[_0xb29e('0x54')]);return _0x15d1d3[_0xb29e('0x82')](_0x3d518e);}})['then'](function(_0x2a8506){if(_0x2a8506){_0xe0110c=_0x2a8506[_0xb29e('0x4a')];if(!_0x3dd921['query']['hasOwnProperty'](_0xb29e('0x4c'))){_0x3d518e[_0xb29e('0x2f')]=qs[_0xb29e('0x2f')](_0x3dd921['query']['limit']);_0x3d518e[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x3dd921[_0xb29e('0x45')][_0xb29e('0x2e')]);}return _0x15d1d3['getApplications'](_0x3d518e);}})[_0xb29e('0x20')](function(_0x19c89b){if(_0x19c89b){return _0x19c89b?{'count':_0xe0110c,'rows':_0x19c89b}:null;}})['then'](respondWithResult(_0x35ad26,null))[_0xb29e('0x2a')](handleError(_0x35ad26,null));};function Extension(_0x181c25,_0x2c9dcf,_0x100a45,_0x197b04){this[_0xb29e('0x83')]='from-voip-provider';this[_0xb29e('0x84')]=_0x181c25['localstationid'];this[_0xb29e('0x85')]=_0x197b04;this[_0xb29e('0x41')]='system';this[_0xb29e('0x86')]=_0xb29e('0x87');this[_0xb29e('0x69')]=_0x181c25['id'];this['priority']=_0x2c9dcf;this['appdata']=_0x100a45;}function createExtensionsReciveFax(_0x1eb70f){var _0x28a8b2=0x1;var _0x4a1061=[];_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,'',_0xb29e('0x89')));_0x28a8b2+=0x1;_0x4a1061['push'](new Extension(_0x1eb70f,_0x28a8b2,_0xb29e('0x8a'),'Set'));_0x28a8b2+=0x1;for(var _0x1c03fb in _0x1eb70f){if(_0x1eb70f[_0xb29e('0x4b')](_0x1c03fb)&&(_0x1c03fb==='ecm'||_0x1c03fb===_0xb29e('0x8b')||_0x1c03fb===_0xb29e('0x8c')||_0x1c03fb===_0xb29e('0x8d')||_0x1c03fb===_0xb29e('0x8e')||_0x1c03fb===_0xb29e('0x8f')||_0x1c03fb===_0xb29e('0x90')||_0x1c03fb===_0xb29e('0x91')||_0x1c03fb===_0xb29e('0x92'))){_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,'FAXOPT('+_0x1c03fb+')='+_0x1eb70f[_0x1c03fb],_0xb29e('0x93')));_0x28a8b2+=0x1;}}_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,'6',_0xb29e('0x94')));_0x28a8b2+=0x1;_0x4a1061[_0xb29e('0x88')](new Extension(_0x1eb70f,_0x28a8b2,_0xb29e('0x95'),_0xb29e('0x96')));_0x28a8b2=0x0;return _0x4a1061;}exports[_0xb29e('0x97')]=function(_0x4d8ced,_0x2ee538,_0x4caad5){var _0x255203;return db[_0xb29e('0x98')][_0xb29e('0x99')](function(_0x47e9e7){return db['FaxAccount'][_0xb29e('0x5c')](_0x4d8ced[_0xb29e('0x5d')],{'transaction':_0x47e9e7})['then'](function(_0xf65fb9){_0x255203=_0xf65fb9[_0xb29e('0x36')]({'plain':!![]});return db[_0xb29e('0x9a')][_0xb29e('0x80')](createExtensionsReciveFax(_0x255203),{'transaction':_0x47e9e7});});})[_0xb29e('0x20')](function(){return _0x255203;})[_0xb29e('0x20')](respondWithResult(_0x2ee538,null))[_0xb29e('0x2a')](handleError(_0x2ee538,null));};exports[_0xb29e('0x9b')]=function(_0x5664d8,_0x1ccbe1,_0x2654ec){var _0x2451b2;return db[_0xb29e('0x98')][_0xb29e('0x99')](function(_0x591f3e){return db['FaxAccount']['update'](_0x5664d8[_0xb29e('0x5d')],{'where':{'id':_0x5664d8[_0xb29e('0x5d')]['id']},'transaction':_0x591f3e})[_0xb29e('0x20')](function(_0x4fb319){return db['VoiceExtension'][_0xb29e('0x35')]({'where':{'FaxAccountId':_0x5664d8[_0xb29e('0x5d')]['id']},'transaction':_0x591f3e})[_0xb29e('0x20')](function(_0x16e5df){return db[_0xb29e('0x9a')][_0xb29e('0x80')](createExtensionsReciveFax(_[_0xb29e('0x73')](_0x5664d8[_0xb29e('0x5d')],[_0xb29e('0x9c'),_0xb29e('0x42'),_0xb29e('0x9d'),_0xb29e('0x9e'),_0xb29e('0x9f'),'ListId'])),{'transaction':_0x591f3e});});});})['then'](function(){return db['FaxAccount']['findById'](_0x5664d8[_0xb29e('0x5d')]['id']);})[_0xb29e('0x20')](respondWithResult(_0x1ccbe1,null))[_0xb29e('0x2a')](handleError(_0x1ccbe1,null));};exports[_0xb29e('0xa0')]=function(_0x505025,_0x1c56b8,_0x56ce0c){var _0x4bfdaf={'raw':!![],'where':{}};var _0xaacc43={};var _0x576722={'count':0x0,'rows':[]};return db[_0xb29e('0x3e')][_0xb29e('0x68')]({'where':{'id':_0x505025[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x1c56b8,null))[_0xb29e('0x20')](function(_0x1fe3b3){if(_0x1fe3b3){_0xaacc43['model']=_['keys'](db[_0xb29e('0xa1')]['rawAttributes']);_0xaacc43[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x505025[_0xb29e('0x45')]);_0xaacc43['filters']=_[_0xb29e('0x47')](_0xaacc43[_0xb29e('0x43')],_0xaacc43[_0xb29e('0x45')]);_0x4bfdaf['attributes']=_[_0xb29e('0x47')](_0xaacc43['model'],qs[_0xb29e('0x49')](_0x505025[_0xb29e('0x45')][_0xb29e('0x49')]));_0x4bfdaf[_0xb29e('0x48')]=_0x4bfdaf['attributes'][_0xb29e('0x4a')]?_0x4bfdaf['attributes']:_0xaacc43[_0xb29e('0x43')];if(!_0x505025[_0xb29e('0x45')][_0xb29e('0x4b')]('nolimit')){_0x4bfdaf[_0xb29e('0x2f')]=qs['limit'](_0x505025[_0xb29e('0x45')]['limit']);_0x4bfdaf[_0xb29e('0x2e')]=qs[_0xb29e('0x2e')](_0x505025[_0xb29e('0x45')][_0xb29e('0x2e')]);}_0x4bfdaf[_0xb29e('0x4d')]=qs[_0xb29e('0x4e')](_0x505025['query'][_0xb29e('0x4e')]);_0x4bfdaf[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_['pick'](_0x505025[_0xb29e('0x45')],_0xaacc43[_0xb29e('0x46')]));_0x4bfdaf[_0xb29e('0x4f')]['FaxAccountId']=_0x1fe3b3['id'];if(_0x505025[_0xb29e('0x45')][_0xb29e('0x53')]){_0x4bfdaf[_0xb29e('0x4f')]=_[_0xb29e('0x51')](_0x4bfdaf['where'],{'$or':_[_0xb29e('0x44')](_0x4bfdaf[_0xb29e('0x48')],function(_0x1e6999){var _0x1f6ef5={};_0x1f6ef5[_0x1e6999]={'$like':'%'+_0x505025[_0xb29e('0x45')][_0xb29e('0x53')]+'%'};return _0x1f6ef5;})});}if(_0x505025[_0xb29e('0x45')][_0xb29e('0xa2')]){var _0x2ad843=_0x505025[_0xb29e('0x45')][_0xb29e('0xa2')][_0xb29e('0xa3')](',');var _0x5dc90c={};_0x5dc90c[_0x2ad843[0x0]]={'$gte':moment(_0x2ad843[0x1])['format'](_0xb29e('0xa4'))};_0x4bfdaf[_0xb29e('0x4f')]=_['merge'](_0x4bfdaf[_0xb29e('0x4f')],_0x5dc90c);}_0x4bfdaf=_[_0xb29e('0x51')]({},_0x4bfdaf,_0x505025[_0xb29e('0x54')]);return db[_0xb29e('0xa1')]['count']({'where':_0x4bfdaf[_0xb29e('0x4f')]})['then'](function(_0x2b96bb){_0x576722[_0xb29e('0x6a')]=_0x2b96bb;if(_0x505025[_0xb29e('0x45')][_0xb29e('0x6b')]){_0x4bfdaf[_0xb29e('0x55')]=[{'all':!![]}];}return db[_0xb29e('0xa1')]['findAll'](_0x4bfdaf);})[_0xb29e('0x20')](function(_0x55283e){_0x576722[_0xb29e('0x57')]=_0x55283e;return _0x576722;});}})[_0xb29e('0x20')](respondWithFilteredResult(_0x1c56b8,_0x4bfdaf))[_0xb29e('0x2a')](handleError(_0x1c56b8,null));};exports['send']=function(_0x344453,_0x3a3892,_0x52de83){var _0x4c221d,_0xadb5fa={},_0x3bfe4e;if(_0x344453[_0xb29e('0x5d')]['to']){_0x3bfe4e=_0x344453[_0xb29e('0x5d')]['to'][0x0];}return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x344453['params']['id']},'include':[{'model':db['CmList'],'as':_0xb29e('0xa5'),'include':[{'model':db['CmContact'],'as':_0xb29e('0xa6'),'where':{'fax':_0x3bfe4e},'limit':0x1,'order':[['updatedAt',_0xb29e('0xa7')]]}]}]})[_0xb29e('0x20')](handleEntityNotFound(_0x3a3892,null))[_0xb29e('0x20')](function(_0x16d2f0){_0x4c221d=_0x16d2f0;if(_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')]&&_0x344453['body']['attachments'][_0xb29e('0x4a')]){for(var _0x5d5c52=0x0;_0x5d5c52<_0x344453['body'][_0xb29e('0xa8')]['length'];_0x5d5c52+=0x1){_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][_0x5d5c52]={'filename':_0x344453['body'][_0xb29e('0xa8')][_0x5d5c52][_0xb29e('0x3a')],'id':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][_0x5d5c52]['id'],'path':path[_0xb29e('0xa9')](config[_0xb29e('0xaa')],_0xb29e('0xab'),_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][_0x5d5c52]['basename'])};}}return respondWithRpcPromise(_0xb29e('0xac'),_0xb29e('0xac'),{'FaxAccountId':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x59')]['id'])?undefined:_0x344453[_0xb29e('0x59')]['id'],'path':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0][_0xb29e('0x8')])?undefined:_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['path'],'fax':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')]['to'][0x0])?undefined:_0x344453[_0xb29e('0x5d')]['to'][0x0]},client9002);})[_0xb29e('0x20')](function(){if(_0x4c221d){if(_['isNil'](_0x344453[_0xb29e('0x5d')]['from'])){_0x344453[_0xb29e('0x5d')][_0xb29e('0xae')]=util[_0xb29e('0xaf')](_0xb29e('0xb0'),_0x4c221d['name'],_0x4c221d[_0xb29e('0xb1')]);}if(_0x4c221d[_0xb29e('0xa5')]){if(_0x4c221d[_0xb29e('0xa5')][_0xb29e('0xa6')][_0xb29e('0x4a')]){return _0x4c221d[_0xb29e('0xa5')]['Contacts'][0x0];}else{return db[_0xb29e('0x75')][_0xb29e('0x5c')](_['defaults'](_0x344453[_0xb29e('0x5d')],{'firstName':_0x344453[_0xb29e('0x5d')]['to'][0x0],'phone':_0x344453[_0xb29e('0x5d')]['to'][0x0],'fax':_0x344453['body']['to'][0x0],'ListId':_0x4c221d[_0xb29e('0xb2')]}));}}else{throw new Error(_0xb29e('0xb3'));}}else{throw new Error(_0xb29e('0xb4'));}})[_0xb29e('0x20')](function(_0x55de3e){if(_0x55de3e){return db['FaxInteraction'][_0xb29e('0x5b')]({'where':{'ContactId':_0x55de3e['id'],'closed':![],'FaxAccountId':_0x4c221d['id']}})['then'](function(_0x22c9de){if(_0x22c9de){return[_0x22c9de,![]];}return db[_0xb29e('0x72')][_0xb29e('0x5c')]({'UserId':_0x344453[_0xb29e('0x5e')]['id'],'ContactId':_0x55de3e['id'],'FaxAccountId':_0x4c221d['id'],'fax':_0x344453[_0xb29e('0x5d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xb29e('0x51')](_0x344453[_0xb29e('0x5d')],{'read':![],'body':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['filename'],'FaxAccountId':_0x4c221d['id'],'UserId':_0x344453[_0xb29e('0x5e')]['id'],'ContactId':_0x55de3e['id'],'AttachmentId':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xb29e('0xa1')],'as':_0xb29e('0xb5')}]})['then'](function(_0x59f991){return[_0x59f991,!![]];});});}else{throw new Error(_0xb29e('0xb6'));}})[_0xb29e('0xb7')](function(_0x33a7b0,_0x5c2182){if(_0x5c2182){return _0x33a7b0;}return db[_0xb29e('0xa1')][_0xb29e('0x5c')]({'direction':_0xb29e('0xb8'),'read':![],'body':_0x344453['body']['attachments'][0x0][_0xb29e('0xb9')],'FaxAccountId':_0x4c221d['id'],'FaxInteractionId':_0x33a7b0['id'],'UserId':_0x344453[_0xb29e('0x5e')]['id'],'ContactId':_0x33a7b0[_0xb29e('0xba')],'AttachmentId':_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['id']})[_0xb29e('0x20')](function(_0x1eaca0){_0x33a7b0[_0xb29e('0xbb')]['Messages']=[];_0x33a7b0['dataValues'][_0xb29e('0xb5')][_0xb29e('0x88')](_0x1eaca0[_0xb29e('0xbb')]);return _0x33a7b0;});})[_0xb29e('0x20')](function(_0x1e1b8e){respondWithRpcPromise(_0xb29e('0xbc'),_0xb29e('0xbc'),{'FaxAccountId':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x59')]['id'])?undefined:_0x344453[_0xb29e('0x59')]['id'],'path':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0][_0xb29e('0x8')])?undefined:_0x344453[_0xb29e('0x5d')][_0xb29e('0xa8')][0x0]['path'],'fax':_[_0xb29e('0xad')](_0x344453[_0xb29e('0x5d')]['to'][0x0])?undefined:_0x344453[_0xb29e('0x5d')]['to'][0x0],'AttachmentId':_0x344453[_0xb29e('0x5d')]['attachments'][0x0]['id']},client9002)[_0xb29e('0x20')](function(_0x5a6d4b){logger[_0xb29e('0x21')](_0xb29e('0xbd'),_0x5a6d4b);})[_0xb29e('0x2a')](function(_0x562651){logger[_0xb29e('0x21')]('SendFaxRpc,\x20%s',_0x562651);});return _0x1e1b8e;})[_0xb29e('0x20')](respondWithResult(_0x3a3892,null))[_0xb29e('0x2a')](handleError(_0x3a3892,null));};exports[_0xb29e('0xbe')]=function(_0x4fad7a,_0x2c15e9,_0x1430b6){return db[_0xb29e('0x3e')][_0xb29e('0x5b')]({'where':{'id':_0x4fad7a[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x2c15e9,null))['then'](function(_0x338474){if(_0x338474){return _0x338474['addAgents'](_0x4fad7a['body'][_0xb29e('0x70')],_[_0xb29e('0x73')](_0x4fad7a[_0xb29e('0x5d')],['ids','id'])||{})[_0xb29e('0xb7')](function(_0x177204){for(var _0xdd281=0x0;_0xdd281<_0x4fad7a[_0xb29e('0x5d')][_0xb29e('0x70')][_0xb29e('0x4a')];_0xdd281+=0x1){socket[_0xb29e('0xbf')](_0xb29e('0xc0'),{'UserId':_0x4fad7a['body']['ids'][_0xdd281],'FaxAccountId':_0x4fad7a[_0xb29e('0x59')]['id']});}return _0x177204;});}})[_0xb29e('0x20')](respondWithResult(_0x2c15e9,null))['catch'](handleError(_0x2c15e9,null));};exports['removeAgents']=function(_0x228dec,_0x1066ba,_0x16d7d4){return db[_0xb29e('0x3e')]['find']({'where':{'id':_0x228dec[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x1066ba,null))[_0xb29e('0x20')](function(_0x126486){if(_0x126486){return _0x126486[_0xb29e('0xc1')](_0x228dec[_0xb29e('0x45')][_0xb29e('0x70')])[_0xb29e('0x20')](function(){if(_[_0xb29e('0xc2')](_0x228dec[_0xb29e('0x45')]['ids'])){for(var _0x42d646=0x0;_0x42d646<_0x228dec[_0xb29e('0x45')]['ids'][_0xb29e('0x4a')];_0x42d646+=0x1){socket[_0xb29e('0xbf')](_0xb29e('0xc3'),{'UserId':Number(_0x228dec[_0xb29e('0x45')][_0xb29e('0x70')][_0x42d646]),'FaxAccountId':Number(_0x228dec[_0xb29e('0x59')]['id'])});}}else{socket['emit'](_0xb29e('0xc3'),{'UserId':Number(_0x228dec[_0xb29e('0x45')]['ids']),'FaxAccountId':Number(_0x228dec[_0xb29e('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1066ba,null))[_0xb29e('0x2a')](handleError(_0x1066ba,null));};exports[_0xb29e('0xc4')]=function(_0x466f2b,_0x3664d1,_0x447f95){var _0xaa67ff={};var _0x172e08={};var _0x14fb3e;var _0x4d8e56;return db[_0xb29e('0x3e')]['findOne']({'where':{'id':_0x466f2b[_0xb29e('0x59')]['id']}})[_0xb29e('0x20')](handleEntityNotFound(_0x3664d1,null))[_0xb29e('0x20')](function(_0x15fece){if(_0x15fece){_0x14fb3e=_0x15fece;_0x172e08[_0xb29e('0x43')]=_[_0xb29e('0x5a')](db[_0xb29e('0x77')][_0xb29e('0x3f')]);_0x172e08[_0xb29e('0x45')]=_[_0xb29e('0x5a')](_0x466f2b[_0xb29e('0x45')]);_0x172e08[_0xb29e('0x46')]=_[_0xb29e('0x47')](_0x172e08[_0xb29e('0x43')],_0x172e08['query']);_0xaa67ff[_0xb29e('0x48')]=_[_0xb29e('0x47')](_0x172e08[_0xb29e('0x43')],qs[_0xb29e('0x49')](_0x466f2b[_0xb29e('0x45')][_0xb29e('0x49')]));_0xaa67ff[_0xb29e('0x48')]=_0xaa67ff[_0xb29e('0x48')]['length']?_0xaa67ff[_0xb29e('0x48')]:_0x172e08[_0xb29e('0x43')];_0xaa67ff['order']=qs[_0xb29e('0x4e')](_0x466f2b['query'][_0xb29e('0x4e')]);_0xaa67ff[_0xb29e('0x4f')]=qs[_0xb29e('0x46')](_[_0xb29e('0x50')](_0x466f2b[_0xb29e('0x45')],_0x172e08[_0xb29e('0x46')]));if(_0x466f2b[_0xb29e('0x45')][_0xb29e('0x53')]){_0xaa67ff[_0xb29e('0x4f')]=_['merge'](_0xaa67ff['where'],{'$or':_['map'](_0xaa67ff[_0xb29e('0x48')],function(_0x26b00f){var _0x35bd2e={};_0x35bd2e[_0x26b00f]={'$like':'%'+_0x466f2b['query'][_0xb29e('0x53')]+'%'};return _0x35bd2e;})});}_0xaa67ff=_[_0xb29e('0x51')]({},_0xaa67ff,_0x466f2b['options']);return _0x14fb3e[_0xb29e('0xc4')](_0xaa67ff);}})[_0xb29e('0x20')](function(_0x1d923e){if(_0x1d923e){_0x4d8e56=_0x1d923e[_0xb29e('0x4a')];if(!_0x466f2b[_0xb29e('0x45')]['hasOwnProperty']('nolimit')){_0xaa67ff[_0xb29e('0x2f')]=qs['limit'](_0x466f2b[_0xb29e('0x45')][_0xb29e('0x2f')]);_0xaa67ff['offset']=qs[_0xb29e('0x2e')](_0x466f2b[_0xb29e('0x45')][_0xb29e('0x2e')]);}return _0x14fb3e[_0xb29e('0xc4')](_0xaa67ff);}})['then'](function(_0x41c6a9){if(_0x41c6a9){return _0x41c6a9?{'count':_0x4d8e56,'rows':_0x41c6a9}:null;}})[_0xb29e('0x20')](respondWithResult(_0x3664d1,null))[_0xb29e('0x2a')](handleError(_0x3664d1,null));}; \ No newline at end of file +var _0x6e5f=['socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','FaxAccountId','Disposition','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','length','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','createdAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','user','Messages','Contact\x20not\x20found','spread','out','filename','dataValues','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x6e5f,0xab));var _0xf6e5=function(_0x16aba5,_0x22727d){_0x16aba5=_0x16aba5-0x0;var _0x15bb97=_0x6e5f[_0x16aba5];return _0x15bb97;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf6e5('0x0'));var zipdir=require(_0xf6e5('0x1'));var jsonpatch=require(_0xf6e5('0x2'));var rp=require('request-promise');var moment=require(_0xf6e5('0x3'));var BPromise=require(_0xf6e5('0x4'));var Mustache=require('mustache');var util=require(_0xf6e5('0x5'));var path=require('path');var sox=require(_0xf6e5('0x6'));var csv=require(_0xf6e5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf6e5('0x8'));var squel=require(_0xf6e5('0x9'));var crypto=require(_0xf6e5('0xa'));var jsforce=require(_0xf6e5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf6e5('0x7'));var querystring=require(_0xf6e5('0xc'));var Papa=require(_0xf6e5('0xd'));var Redis=require(_0xf6e5('0xe'));var authService=require(_0xf6e5('0xf'));var qs=require(_0xf6e5('0x10'));var as=require(_0xf6e5('0x11'));var hardwareService=require(_0xf6e5('0x12'));var logger=require(_0xf6e5('0x13'))('api');var utils=require(_0xf6e5('0x14'));var config=require('../../config/environment');var db=require(_0xf6e5('0x15'))['db'];config[_0xf6e5('0x16')]=_[_0xf6e5('0x17')](config['redis'],{'host':_0xf6e5('0x18'),'port':0x18eb});var socket=require(_0xf6e5('0x19'))(new Redis(config[_0xf6e5('0x16')]));require('./faxAccount.socket')[_0xf6e5('0x1a')](socket);var jayson=require(_0xf6e5('0x1b'));var client=jayson[_0xf6e5('0x1c')][_0xf6e5('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xf6e5('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x464b51,_0xa9359b,_0x5956ea){if(_0x5956ea){var _0x579224=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x579224[_0xf6e5('0x1e')](_0xa9359b)){return _0x464b51;}else{throw new db[(_0xf6e5('0x1f'))]['ValidationError'](_0xf6e5('0x20'));}}else{return _0x464b51;}}function respondWithRpcPromise(_0x2a8755,_0x4f4c99,_0x75899a,_0x11c17a){return new BPromise(function(_0x1c78e6,_0x9ce8d5){var _0x16df23=_0x11c17a||client;return _0x16df23['request'](_0x2a8755,_0x75899a)['then'](function(_0x408690){logger[_0xf6e5('0x21')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0xf6e5('0x22'));logger[_0xf6e5('0x23')](_0xf6e5('0x24'),_0x4f4c99,_0xf6e5('0x22'),JSON[_0xf6e5('0x25')](_0x408690));if(_0x408690['error']){if(_0x408690['error'][_0xf6e5('0x26')]===0x1f4){logger[_0xf6e5('0x27')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);return _0x9ce8d5(_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);}logger[_0xf6e5('0x27')](_0xf6e5('0x29'),_0x4f4c99,_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);return _0x1c78e6(_0x408690[_0xf6e5('0x27')][_0xf6e5('0x28')]);}else{logger[_0xf6e5('0x21')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0xf6e5('0x22'));_0x1c78e6(_0x408690[_0xf6e5('0x2a')][_0xf6e5('0x28')]);}})[_0xf6e5('0x2b')](function(_0x59913e){logger[_0xf6e5('0x27')]('FaxAccount,\x20%s,\x20%s',_0x4f4c99,_0x59913e);_0x9ce8d5(_0x59913e);});});}function respondWithStatusCode(_0x24f1ea,_0x2816e1){_0x2816e1=_0x2816e1||0xcc;return function(_0x532a20){if(_0x532a20){return _0x24f1ea[_0xf6e5('0x2c')](_0x2816e1);}return _0x24f1ea['status'](_0x2816e1)[_0xf6e5('0x2d')]();};}function respondWithResult(_0x21a87b,_0x6bdd04){_0x6bdd04=_0x6bdd04||0xc8;return function(_0x2393de){if(_0x2393de){return _0x21a87b[_0xf6e5('0x2e')](_0x6bdd04)[_0xf6e5('0x2f')](_0x2393de);}};}function respondWithFilteredResult(_0x36b967,_0x545715){return function(_0x22d6cb){if(_0x22d6cb){var _0x1de43f=_0x22d6cb['count'],_0x4a852f=_0x545715[_0xf6e5('0x30')],_0x44aed6=_0x545715[_0xf6e5('0x30')]+_0x545715[_0xf6e5('0x31')],_0x491cf5;if(_0x44aed6>=_0x1de43f){_0x44aed6=_0x1de43f;_0x491cf5=0xc8;}else{_0x491cf5=0xce;}_0x36b967[_0xf6e5('0x2e')](_0x491cf5);return _0x36b967[_0xf6e5('0x32')](_0xf6e5('0x33'),_0x4a852f+'-'+_0x44aed6+'/'+_0x1de43f)[_0xf6e5('0x2f')](_0x22d6cb);}return null;};}function patchUpdates(_0x4bfde8){return function(_0xca4d0){try{jsonpatch['apply'](_0xca4d0,_0x4bfde8,!![]);}catch(_0x5c9fc7){return BPromise['reject'](_0x5c9fc7);}return _0xca4d0[_0xf6e5('0x34')]();};}function saveUpdates(_0x3b48a9,_0x39000d){return function(_0x544e1f){if(_0x544e1f){return _0x544e1f[_0xf6e5('0x35')](_0x3b48a9)[_0xf6e5('0x36')](function(_0x16e144){return _0x16e144;});}return null;};}function removeEntity(_0x47274a,_0x58aa20){return function(_0x223176){if(_0x223176){return _0x223176['destroy']()[_0xf6e5('0x36')](function(){var _0x4d07d6=_0x223176[_0xf6e5('0x37')]({'plain':!![]});var _0x544a86=_0xf6e5('0x38');return db[_0xf6e5('0x39')][_0xf6e5('0x3a')]({'where':{'type':_0x544a86,'resourceId':_0x4d07d6['id']}})['then'](function(){return _0x223176;});})[_0xf6e5('0x36')](function(){_0x47274a['status'](0xcc)[_0xf6e5('0x2d')]();});}};}function handleEntityNotFound(_0x2beb75,_0x1910b7){return function(_0xddfd25){if(!_0xddfd25){_0x2beb75[_0xf6e5('0x2c')](0x194);}return _0xddfd25;};}function handleError(_0x43f5bb,_0x4fb617){_0x4fb617=_0x4fb617||0x1f4;return function(_0x230b8e){logger['error'](_0x230b8e[_0xf6e5('0x3b')]);if(_0x230b8e[_0xf6e5('0x3c')]){delete _0x230b8e[_0xf6e5('0x3c')];}_0x43f5bb['status'](_0x4fb617)[_0xf6e5('0x3d')](_0x230b8e);};}exports['index']=function(_0x5226d8,_0xd3f126){var _0x17550f={'include':[{'model':db[_0xf6e5('0x3e')],'as':_0xf6e5('0x3f')}]},_0x4775ca={},_0x54889a={'count':0x0,'rows':[]};var _0x22612e=_[_0xf6e5('0x40')](db[_0xf6e5('0x41')][_0xf6e5('0x42')],function(_0x363313){return{'name':_0x363313['fieldName'],'type':_0x363313[_0xf6e5('0x43')][_0xf6e5('0x44')]};});_0x4775ca['model']=_[_0xf6e5('0x40')](_0x22612e,'name');_0x4775ca[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x5226d8[_0xf6e5('0x45')]);_0x4775ca[_0xf6e5('0x47')]=_[_0xf6e5('0x48')](_0x4775ca['model'],_0x4775ca[_0xf6e5('0x45')]);_0x17550f[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x4775ca[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x5226d8[_0xf6e5('0x45')]['fields']));_0x17550f[_0xf6e5('0x49')]=_0x17550f[_0xf6e5('0x49')]['length']?_0x17550f[_0xf6e5('0x49')]:_0x4775ca[_0xf6e5('0x4a')];if(!_0x5226d8['query'][_0xf6e5('0x4c')](_0xf6e5('0x4d'))){_0x17550f['limit']=qs[_0xf6e5('0x31')](_0x5226d8[_0xf6e5('0x45')]['limit']);_0x17550f[_0xf6e5('0x30')]=qs['offset'](_0x5226d8[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x17550f[_0xf6e5('0x4e')]=qs[_0xf6e5('0x4f')](_0x5226d8[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x17550f['where']=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x5226d8[_0xf6e5('0x45')],_0x4775ca[_0xf6e5('0x47')]),_0x22612e);if(_0x5226d8['query'][_0xf6e5('0x51')]){_0x17550f[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x17550f[_0xf6e5('0x52')],{'$or':_['map'](_0x22612e,function(_0x20872a){if(_0x20872a[_0xf6e5('0x43')]!==_0xf6e5('0x54')){var _0x3ecc0f={};_0x3ecc0f[_0x20872a[_0xf6e5('0x3c')]]={'$like':'%'+_0x5226d8[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x3ecc0f;}})});}_0x17550f=_[_0xf6e5('0x53')]({},_0x17550f,_0x5226d8[_0xf6e5('0x55')]);var _0x5c170f={'where':_0x17550f[_0xf6e5('0x52')]};return db[_0xf6e5('0x41')][_0xf6e5('0x56')](_0x5c170f)['then'](function(_0x248989){_0x54889a[_0xf6e5('0x56')]=_0x248989;if(_0x5226d8['query'][_0xf6e5('0x57')]){_0x17550f['include']=[{'all':!![]}];}return db[_0xf6e5('0x41')][_0xf6e5('0x58')](_0x17550f);})['then'](function(_0x337834){_0x54889a[_0xf6e5('0x59')]=_0x337834;return _0x54889a;})[_0xf6e5('0x36')](respondWithFilteredResult(_0xd3f126,_0x17550f))[_0xf6e5('0x2b')](handleError(_0xd3f126,null));};exports[_0xf6e5('0x5a')]=function(_0x78f732,_0x3f35d9){var _0x381698={'raw':![],'where':{'id':_0x78f732[_0xf6e5('0x5b')]['id']},'include':[{'model':db[_0xf6e5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x51257e={};_0x51257e['model']=_[_0xf6e5('0x46')](db[_0xf6e5('0x41')][_0xf6e5('0x42')]);_0x51257e[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x78f732[_0xf6e5('0x45')]);_0x51257e[_0xf6e5('0x47')]=_[_0xf6e5('0x48')](_0x51257e[_0xf6e5('0x4a')],_0x51257e[_0xf6e5('0x45')]);_0x381698[_0xf6e5('0x49')]=_['intersection'](_0x51257e['model'],qs[_0xf6e5('0x4b')](_0x78f732[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0x381698[_0xf6e5('0x49')]=_0x381698[_0xf6e5('0x49')]['length']?_0x381698[_0xf6e5('0x49')]:_0x51257e[_0xf6e5('0x4a')];if(_0x78f732[_0xf6e5('0x45')]['includeAll']){_0x381698['include']=[{'all':!![]}];}_0x381698=_[_0xf6e5('0x53')]({},_0x381698,_0x78f732[_0xf6e5('0x55')]);return db[_0xf6e5('0x41')][_0xf6e5('0x5c')](_0x381698)[_0xf6e5('0x36')](handleEntityNotFound(_0x3f35d9,null))[_0xf6e5('0x36')](respondWithResult(_0x3f35d9,null))[_0xf6e5('0x2b')](handleError(_0x3f35d9,null));};exports['create']=function(_0x4bf0ee,_0x281a25){return db[_0xf6e5('0x41')][_0xf6e5('0x5d')](_0x4bf0ee[_0xf6e5('0x5e')],{})[_0xf6e5('0x36')](function(_0x3b6a76){var _0x35b87d=_0x4bf0ee['user'][_0xf6e5('0x37')]({'plain':!![]});if(!_0x35b87d)throw new Error(_0xf6e5('0x5f'));if(_0x35b87d[_0xf6e5('0x60')]==='user'){var _0x54b0bc=_0x3b6a76[_0xf6e5('0x37')]({'plain':!![]});var _0x588c91=_0xf6e5('0x38');return db[_0xf6e5('0x61')]['find']({'where':{'name':_0x588c91,'userProfileId':_0x35b87d[_0xf6e5('0x62')]},'raw':!![]})[_0xf6e5('0x36')](function(_0x3e3153){if(_0x3e3153&&_0x3e3153[_0xf6e5('0x63')]===0x0){return db[_0xf6e5('0x39')][_0xf6e5('0x5d')]({'name':_0x54b0bc[_0xf6e5('0x3c')],'resourceId':_0x54b0bc['id'],'type':_0x3e3153[_0xf6e5('0x3c')],'sectionId':_0x3e3153['id']},{})[_0xf6e5('0x36')](function(){return _0x3b6a76;});}else{return _0x3b6a76;}})[_0xf6e5('0x2b')](function(_0x563337){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x563337);throw _0x563337;});}return _0x3b6a76;})[_0xf6e5('0x36')](respondWithResult(_0x281a25,0xc9))['catch'](handleError(_0x281a25,null));};exports[_0xf6e5('0x35')]=function(_0x53ac7f,_0x5dfe54){if(_0x53ac7f[_0xf6e5('0x5e')]['id']){delete _0x53ac7f[_0xf6e5('0x5e')]['id'];}return db['FaxAccount'][_0xf6e5('0x5c')]({'where':{'id':_0x53ac7f[_0xf6e5('0x5b')]['id']},'include':[{'model':db[_0xf6e5('0x3e')],'as':_0xf6e5('0x3f')}]})['then'](handleEntityNotFound(_0x5dfe54,null))[_0xf6e5('0x36')](saveUpdates(_0x53ac7f['body'],null))[_0xf6e5('0x36')](respondWithResult(_0x5dfe54,null))[_0xf6e5('0x2b')](handleError(_0x5dfe54,null));};exports['destroy']=function(_0xc5777c,_0x50aaf9){return db[_0xf6e5('0x41')]['find']({'where':{'id':_0xc5777c[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x50aaf9,null))['then'](removeEntity(_0x50aaf9,null))[_0xf6e5('0x2b')](handleError(_0x50aaf9,null));};exports['describe']=function(_0x28cc9a,_0x46f6a0){return db[_0xf6e5('0x41')][_0xf6e5('0x64')]()[_0xf6e5('0x36')](respondWithResult(_0x46f6a0,null))[_0xf6e5('0x2b')](handleError(_0x46f6a0,null));};exports['addDisposition']=function(_0x629e7a,_0x4fe5b4,_0x2af69a){if(_0x629e7a[_0xf6e5('0x5e')]['id']){delete _0x629e7a[_0xf6e5('0x5e')]['id'];}return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x629e7a['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x4fe5b4,null))[_0xf6e5('0x36')](function(_0x17d626){if(_0x17d626){_0x629e7a[_0xf6e5('0x5e')][_0xf6e5('0x65')]=_0x17d626['id'];return db[_0xf6e5('0x66')]['create'](_0x629e7a[_0xf6e5('0x5e')]);}})['then'](respondWithResult(_0x4fe5b4,null))[_0xf6e5('0x2b')](handleError(_0x4fe5b4,null));};exports['getDispositions']=function(_0x3e982a,_0x5a32d5,_0x462b8a){var _0x4fc6b7={'raw':![],'where':{}};var _0x1c51ba={};var _0xe3fed6={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3e982a['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x5a32d5,null))[_0xf6e5('0x36')](function(_0x2eecc4){if(_0x2eecc4){_0x1c51ba[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db['Disposition'][_0xf6e5('0x42')]);_0x1c51ba['query']=_['keys'](_0x3e982a[_0xf6e5('0x45')]);_0x1c51ba[_0xf6e5('0x47')]=_['intersection'](_0x1c51ba['model'],_0x1c51ba[_0xf6e5('0x45')]);_0x4fc6b7[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x1c51ba[_0xf6e5('0x4a')],qs['fields'](_0x3e982a['query'][_0xf6e5('0x4b')]));_0x4fc6b7['attributes']=_0x4fc6b7[_0xf6e5('0x49')]['length']?_0x4fc6b7[_0xf6e5('0x49')]:_0x1c51ba[_0xf6e5('0x4a')];if(!_0x3e982a[_0xf6e5('0x45')]['hasOwnProperty'](_0xf6e5('0x4d'))){_0x4fc6b7[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0x4fc6b7[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x4fc6b7[_0xf6e5('0x4e')]=qs['sort'](_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x4fc6b7[_0xf6e5('0x52')]=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x3e982a[_0xf6e5('0x45')],_0x1c51ba[_0xf6e5('0x47')]));_0x4fc6b7[_0xf6e5('0x52')]['FaxAccountId']=_0x2eecc4['id'];if(_0x3e982a['query'][_0xf6e5('0x51')]){_0x4fc6b7[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x4fc6b7['where'],{'$or':_[_0xf6e5('0x40')](_0x4fc6b7[_0xf6e5('0x49')],function(_0x82603d){var _0xd8fa8b={};_0xd8fa8b[_0x82603d]={'$like':'%'+_0x3e982a[_0xf6e5('0x45')]['filter']+'%'};return _0xd8fa8b;})});}_0x4fc6b7=_[_0xf6e5('0x53')]({},_0x4fc6b7,_0x3e982a[_0xf6e5('0x55')]);return db[_0xf6e5('0x66')][_0xf6e5('0x56')]({'where':_0x4fc6b7[_0xf6e5('0x52')]})['then'](function(_0x1facf5){_0xe3fed6[_0xf6e5('0x56')]=_0x1facf5;if(_0x3e982a[_0xf6e5('0x45')][_0xf6e5('0x57')]){_0x4fc6b7[_0xf6e5('0x67')]=[{'all':!![]}];}return db[_0xf6e5('0x66')]['findAll'](_0x4fc6b7);})[_0xf6e5('0x36')](function(_0x247568){_0xe3fed6[_0xf6e5('0x59')]=_0x247568;return _0xe3fed6;});}})['then'](respondWithFilteredResult(_0x5a32d5,_0x4fc6b7))[_0xf6e5('0x2b')](handleError(_0x5a32d5,null));};exports[_0xf6e5('0x68')]=function(_0x3ec9af,_0x5e59c8,_0x3df4bd){return db['FaxAccount']['find']({'where':{'id':_0x3ec9af[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x5e59c8,null))['then'](function(_0x19db8){if(_0x19db8){return _0x19db8['removeDispositions'](_0x3ec9af['query'][_0xf6e5('0x69')]);}})[_0xf6e5('0x36')](respondWithStatusCode(_0x5e59c8,null))[_0xf6e5('0x2b')](handleError(_0x5e59c8,null));};exports[_0xf6e5('0x6a')]=function(_0x36be6f,_0x3b0def,_0x9546b7){if(_0x36be6f['body']['id']){delete _0x36be6f[_0xf6e5('0x5e')]['id'];}return db[_0xf6e5('0x41')]['find']({'where':{'id':_0x36be6f['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x3b0def,null))[_0xf6e5('0x36')](function(_0x2c4fd3){if(_0x2c4fd3){_0x36be6f[_0xf6e5('0x5e')][_0xf6e5('0x65')]=_0x2c4fd3['id'];return db[_0xf6e5('0x6b')][_0xf6e5('0x5d')](_0x36be6f[_0xf6e5('0x5e')]);}})['then'](respondWithResult(_0x3b0def,null))[_0xf6e5('0x2b')](handleError(_0x3b0def,null));};exports[_0xf6e5('0x6c')]=function(_0x3fdc8b,_0x34f0e2,_0x17aef5){var _0x2a8c4b={'raw':![],'where':{}};var _0x4371a6={};var _0x31079d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf6e5('0x6d')]({'where':{'id':_0x3fdc8b[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x34f0e2,null))[_0xf6e5('0x36')](function(_0x6011ec){if(_0x6011ec){_0x4371a6['model']=_[_0xf6e5('0x46')](db[_0xf6e5('0x6b')][_0xf6e5('0x42')]);_0x4371a6[_0xf6e5('0x45')]=_['keys'](_0x3fdc8b['query']);_0x4371a6[_0xf6e5('0x47')]=_['intersection'](_0x4371a6[_0xf6e5('0x4a')],_0x4371a6[_0xf6e5('0x45')]);_0x2a8c4b[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x4371a6[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x3fdc8b['query'][_0xf6e5('0x4b')]));_0x2a8c4b[_0xf6e5('0x49')]=_0x2a8c4b[_0xf6e5('0x49')]['length']?_0x2a8c4b[_0xf6e5('0x49')]:_0x4371a6[_0xf6e5('0x4a')];if(!_0x3fdc8b[_0xf6e5('0x45')]['hasOwnProperty'](_0xf6e5('0x4d'))){_0x2a8c4b[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x3fdc8b['query']['limit']);_0x2a8c4b[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x3fdc8b['query'][_0xf6e5('0x30')]);}_0x2a8c4b[_0xf6e5('0x4e')]=qs[_0xf6e5('0x4f')](_0x3fdc8b[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x2a8c4b['where']=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x3fdc8b[_0xf6e5('0x45')],_0x4371a6[_0xf6e5('0x47')]));_0x2a8c4b[_0xf6e5('0x52')][_0xf6e5('0x65')]=_0x6011ec['id'];if(_0x3fdc8b[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x2a8c4b[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x2a8c4b['where'],{'$or':_[_0xf6e5('0x40')](_0x2a8c4b[_0xf6e5('0x49')],function(_0x585765){var _0x3b925c={};_0x3b925c[_0x585765]={'$like':'%'+_0x3fdc8b[_0xf6e5('0x45')]['filter']+'%'};return _0x3b925c;})});}_0x2a8c4b=_[_0xf6e5('0x53')]({},_0x2a8c4b,_0x3fdc8b[_0xf6e5('0x55')]);return db[_0xf6e5('0x6b')]['count']({'where':_0x2a8c4b[_0xf6e5('0x52')]})[_0xf6e5('0x36')](function(_0x582436){_0x31079d[_0xf6e5('0x56')]=_0x582436;if(_0x3fdc8b[_0xf6e5('0x45')][_0xf6e5('0x57')]){_0x2a8c4b[_0xf6e5('0x67')]=[{'all':!![]}];}return db[_0xf6e5('0x6b')][_0xf6e5('0x58')](_0x2a8c4b);})['then'](function(_0x48ccf0){_0x31079d['rows']=_0x48ccf0;return _0x31079d;});}})[_0xf6e5('0x36')](respondWithFilteredResult(_0x34f0e2,_0x2a8c4b))[_0xf6e5('0x2b')](handleError(_0x34f0e2,null));};exports[_0xf6e5('0x6e')]=function(_0x13c8d9,_0x470a78,_0x1de177){return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x13c8d9[_0xf6e5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x470a78,null))['then'](function(_0x17170a){if(_0x17170a){return _0x17170a[_0xf6e5('0x6e')](_0x13c8d9[_0xf6e5('0x45')][_0xf6e5('0x69')]);}})[_0xf6e5('0x36')](respondWithStatusCode(_0x470a78,null))[_0xf6e5('0x2b')](handleError(_0x470a78,null));};exports[_0xf6e5('0x6f')]=function(_0x470190,_0x429807,_0x1c9c69){return db['FaxInteraction'][_0xf6e5('0x5c')]({'where':{'id':_0x470190[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x429807,null))[_0xf6e5('0x36')](function(_0x59d6c0){if(_0x59d6c0){return _0x59d6c0[_0xf6e5('0x6f')](_0x470190[_0xf6e5('0x5e')][_0xf6e5('0x69')],_['omit'](_0x470190[_0xf6e5('0x5e')],['ids','id'])||{});}})[_0xf6e5('0x36')](respondWithResult(_0x429807,null))[_0xf6e5('0x2b')](handleError(_0x429807,null));};exports[_0xf6e5('0x70')]=function(_0x2a43ff,_0x41d4e6,_0x1f9e48){var _0x18bc53={'raw':![],'where':{}};var _0x20b776={};var _0x2d653a={'count':0x0,'rows':[]};return db[_0xf6e5('0x41')][_0xf6e5('0x6d')]({'where':{'id':_0x2a43ff['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x41d4e6,null))['then'](function(_0x4de5be){if(_0x4de5be){_0x20b776[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db[_0xf6e5('0x71')][_0xf6e5('0x42')]);_0x20b776[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x2a43ff[_0xf6e5('0x45')]);_0x20b776[_0xf6e5('0x47')]=_[_0xf6e5('0x48')](_0x20b776[_0xf6e5('0x4a')],_0x20b776[_0xf6e5('0x45')]);_0x18bc53[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x20b776[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0x18bc53[_0xf6e5('0x49')]=_0x18bc53[_0xf6e5('0x49')]['length']?_0x18bc53['attributes']:_0x20b776[_0xf6e5('0x4a')];if(!_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x4c')](_0xf6e5('0x4d'))){_0x18bc53['limit']=qs[_0xf6e5('0x31')](_0x2a43ff['query'][_0xf6e5('0x31')]);_0x18bc53[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x18bc53['order']=qs[_0xf6e5('0x4f')](_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x18bc53[_0xf6e5('0x52')]=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x2a43ff['query'],_0x20b776[_0xf6e5('0x47')]));_0x18bc53['where'][_0xf6e5('0x65')]=_0x4de5be['id'];if(_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x18bc53[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x18bc53[_0xf6e5('0x52')],{'$or':_[_0xf6e5('0x40')](_0x18bc53[_0xf6e5('0x49')],function(_0x502904){var _0x4ef08d={};_0x4ef08d[_0x502904]={'$like':'%'+_0x2a43ff['query']['filter']+'%'};return _0x4ef08d;})});}_0x18bc53=_[_0xf6e5('0x53')]({},_0x18bc53,_0x2a43ff[_0xf6e5('0x55')]);return db[_0xf6e5('0x71')][_0xf6e5('0x56')]({'where':_0x18bc53['where']})['then'](function(_0x94f6c3){_0x2d653a[_0xf6e5('0x56')]=_0x94f6c3;if(_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x57')]){_0x18bc53['include']=[{'model':db[_0xf6e5('0x72')],'as':_0xf6e5('0x73'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xf6e5('0x3c'),'fullname',_0xf6e5('0x74')],'required':![]},{'model':db[_0xf6e5('0x75')],'as':_0xf6e5('0x76'),'attributes':['id',_0xf6e5('0x3c'),_0xf6e5('0x77')],'where':_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x78')]?{'id':_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x78')]}:undefined,'required':_0x2a43ff[_0xf6e5('0x45')][_0xf6e5('0x78')]?!![]:![]}];}return db[_0xf6e5('0x71')]['findAll'](_0x18bc53);})['then'](function(_0x2fd261){_0x2d653a['rows']=_0x2fd261;return _0x2d653a;});}})['then'](respondWithFilteredResult(_0x41d4e6,_0x18bc53))[_0xf6e5('0x2b')](handleError(_0x41d4e6,null));};exports[_0xf6e5('0x79')]=function(_0xb79b7d,_0x53e2b2,_0x3c234c){return db[_0xf6e5('0x41')]['findOne']({'where':{'id':_0xb79b7d[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x53e2b2,null))['then'](function(_0x254203){if(_0x254203){return db[_0xf6e5('0x7a')][_0xf6e5('0x7b')](function(_0x8b677){return db[_0xf6e5('0x7c')][_0xf6e5('0x3a')]({'where':{'FaxAccountId':_0xb79b7d[_0xf6e5('0x5b')]['id']},'transaction':_0x8b677})['then'](function(_0x1b1f65){var _0x33eafc=_[_0xf6e5('0x40')](_0xb79b7d['body'],function(_0x8dd96){_0x8dd96[_0xf6e5('0x65')]=_0xb79b7d[_0xf6e5('0x5b')]['id'];return _0x8dd96;});return db[_0xf6e5('0x7c')][_0xf6e5('0x7d')](_0x33eafc,{'transaction':_0x8b677});});})['then'](function(){return db[_0xf6e5('0x7c')][_0xf6e5('0x7e')]({'where':{'FaxAccountId':_0xb79b7d[_0xf6e5('0x5b')]['id']},'order':'priority'});});}})[_0xf6e5('0x36')](respondWithResult(_0x53e2b2,null))['catch'](handleError(_0x53e2b2,null));};exports['getApplications']=function(_0x5d6bc7,_0x5aad0b,_0x559d42){var _0xb039cd={};var _0x115cc1={};var _0x376d42;var _0x37c7e1;return db['FaxAccount'][_0xf6e5('0x6d')]({'where':{'id':_0x5d6bc7['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x5aad0b,null))[_0xf6e5('0x36')](function(_0x117553){if(_0x117553){_0x376d42=_0x117553;_0x115cc1[_0xf6e5('0x4a')]=_['keys'](db[_0xf6e5('0x7c')]['rawAttributes']);_0x115cc1[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x5d6bc7['query']);_0x115cc1[_0xf6e5('0x47')]=_['intersection'](_0x115cc1['model'],_0x115cc1['query']);_0xb039cd[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x115cc1[_0xf6e5('0x4a')],qs[_0xf6e5('0x4b')](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0xb039cd[_0xf6e5('0x49')]=_0xb039cd['attributes']['length']?_0xb039cd[_0xf6e5('0x49')]:_0x115cc1['model'];_0xb039cd[_0xf6e5('0x4e')]=qs['sort'](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0xb039cd[_0xf6e5('0x52')]=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x5d6bc7['query'],_0x115cc1['filters']));if(_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0xb039cd['where']=_['merge'](_0xb039cd[_0xf6e5('0x52')],{'$or':_[_0xf6e5('0x40')](_0xb039cd[_0xf6e5('0x49')],function(_0x3112b3){var _0x351885={};_0x351885[_0x3112b3]={'$like':'%'+_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x351885;})});}_0xb039cd=_[_0xf6e5('0x53')]({},_0xb039cd,_0x5d6bc7[_0xf6e5('0x55')]);return _0x376d42['getApplications'](_0xb039cd);}})[_0xf6e5('0x36')](function(_0x59b622){if(_0x59b622){_0x37c7e1=_0x59b622[_0xf6e5('0x7f')];if(!_0x5d6bc7['query'][_0xf6e5('0x4c')]('nolimit')){_0xb039cd[_0xf6e5('0x31')]=qs['limit'](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0xb039cd[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x5d6bc7[_0xf6e5('0x45')][_0xf6e5('0x30')]);}return _0x376d42['getApplications'](_0xb039cd);}})[_0xf6e5('0x36')](function(_0x313632){if(_0x313632){return _0x313632?{'count':_0x37c7e1,'rows':_0x313632}:null;}})[_0xf6e5('0x36')](respondWithResult(_0x5aad0b,null))[_0xf6e5('0x2b')](handleError(_0x5aad0b,null));};function Extension(_0x2c1c43,_0x267a2d,_0x295ddb,_0x38c59c){this[_0xf6e5('0x80')]=_0xf6e5('0x81');this[_0xf6e5('0x82')]=_0x2c1c43[_0xf6e5('0x83')];this[_0xf6e5('0x84')]=_0x38c59c;this['type']=_0xf6e5('0x85');this[_0xf6e5('0x86')]=_0xf6e5('0x87');this[_0xf6e5('0x65')]=_0x2c1c43['id'];this['priority']=_0x267a2d;this[_0xf6e5('0x88')]=_0x295ddb;}function createExtensionsReciveFax(_0x43f6de){var _0x3b3887=0x1;var _0x3f8fe6=[];_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,'',_0xf6e5('0x8a')));_0x3b3887+=0x1;_0x3f8fe6['push'](new Extension(_0x43f6de,_0x3b3887,_0xf6e5('0x8b'),_0xf6e5('0x8c')));_0x3b3887+=0x1;for(var _0x25ba7c in _0x43f6de){if(_0x43f6de[_0xf6e5('0x4c')](_0x25ba7c)&&(_0x25ba7c===_0xf6e5('0x8d')||_0x25ba7c===_0xf6e5('0x83')||_0x25ba7c===_0xf6e5('0x8e')||_0x25ba7c===_0xf6e5('0x8f')||_0x25ba7c===_0xf6e5('0x90')||_0x25ba7c===_0xf6e5('0x91')||_0x25ba7c===_0xf6e5('0x92')||_0x25ba7c==='modem'||_0x25ba7c===_0xf6e5('0x93'))){_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,_0xf6e5('0x94')+_0x25ba7c+')='+_0x43f6de[_0x25ba7c],_0xf6e5('0x8c')));_0x3b3887+=0x1;}}_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,'6',_0xf6e5('0x95')));_0x3b3887+=0x1;_0x3f8fe6[_0xf6e5('0x89')](new Extension(_0x43f6de,_0x3b3887,_0xf6e5('0x96'),_0xf6e5('0x97')));_0x3b3887=0x0;return _0x3f8fe6;}exports[_0xf6e5('0x98')]=function(_0x96dcbe,_0x255deb,_0x4522b9){var _0x14d65d;return db[_0xf6e5('0x7a')]['transaction'](function(_0x7ac217){return db[_0xf6e5('0x41')][_0xf6e5('0x5d')](_0x96dcbe[_0xf6e5('0x5e')],{'transaction':_0x7ac217})['then'](function(_0x50bc0a){_0x14d65d=_0x50bc0a[_0xf6e5('0x37')]({'plain':!![]});return db['VoiceExtension'][_0xf6e5('0x7d')](createExtensionsReciveFax(_0x14d65d),{'transaction':_0x7ac217});});})[_0xf6e5('0x36')](function(){return _0x14d65d;})['then'](respondWithResult(_0x255deb,null))['catch'](handleError(_0x255deb,null));};exports[_0xf6e5('0x99')]=function(_0x52a043,_0x104069,_0x15da10){var _0x4296a4;return db[_0xf6e5('0x7a')][_0xf6e5('0x7b')](function(_0x35999e){return db['FaxAccount']['update'](_0x52a043[_0xf6e5('0x5e')],{'where':{'id':_0x52a043[_0xf6e5('0x5e')]['id']},'transaction':_0x35999e})[_0xf6e5('0x36')](function(_0xc00791){return db[_0xf6e5('0x9a')][_0xf6e5('0x3a')]({'where':{'FaxAccountId':_0x52a043['body']['id']},'transaction':_0x35999e})[_0xf6e5('0x36')](function(_0x2101b8){return db[_0xf6e5('0x9a')][_0xf6e5('0x7d')](createExtensionsReciveFax(_[_0xf6e5('0x9b')](_0x52a043[_0xf6e5('0x5e')],[_0xf6e5('0x9c'),_0xf6e5('0x44'),_0xf6e5('0x9d'),'updatedAt',_0xf6e5('0x9e'),_0xf6e5('0x9f')])),{'transaction':_0x35999e});});});})[_0xf6e5('0x36')](function(){return db['FaxAccount'][_0xf6e5('0xa0')](_0x52a043['body']['id']);})['then'](respondWithResult(_0x104069,null))[_0xf6e5('0x2b')](handleError(_0x104069,null));};exports['getMessages']=function(_0x32f708,_0x364bc3,_0x47e8f9){var _0x442741={'raw':!![],'where':{}};var _0x34ec6c={};var _0x480858={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf6e5('0x6d')]({'where':{'id':_0x32f708[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x364bc3,null))[_0xf6e5('0x36')](function(_0x140d6b){if(_0x140d6b){_0x34ec6c[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db['FaxMessage']['rawAttributes']);_0x34ec6c[_0xf6e5('0x45')]=_['keys'](_0x32f708['query']);_0x34ec6c['filters']=_[_0xf6e5('0x48')](_0x34ec6c['model'],_0x34ec6c[_0xf6e5('0x45')]);_0x442741[_0xf6e5('0x49')]=_['intersection'](_0x34ec6c[_0xf6e5('0x4a')],qs['fields'](_0x32f708[_0xf6e5('0x45')]['fields']));_0x442741[_0xf6e5('0x49')]=_0x442741['attributes'][_0xf6e5('0x7f')]?_0x442741['attributes']:_0x34ec6c[_0xf6e5('0x4a')];if(!_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x4c')]('nolimit')){_0x442741[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0x442741[_0xf6e5('0x30')]=qs[_0xf6e5('0x30')](_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x30')]);}_0x442741[_0xf6e5('0x4e')]=qs['sort'](_0x32f708[_0xf6e5('0x45')]['sort']);_0x442741[_0xf6e5('0x52')]=qs['filters'](_[_0xf6e5('0x50')](_0x32f708[_0xf6e5('0x45')],_0x34ec6c[_0xf6e5('0x47')]));_0x442741[_0xf6e5('0x52')][_0xf6e5('0x65')]=_0x140d6b['id'];if(_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x442741[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x442741['where'],{'$or':_['map'](_0x442741[_0xf6e5('0x49')],function(_0x7f4477){var _0x37d637={};_0x37d637[_0x7f4477]={'$like':'%'+_0x32f708[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x37d637;})});}if(_0x32f708['query'][_0xf6e5('0xa1')]){var _0x546758=_0x32f708['query'][_0xf6e5('0xa1')][_0xf6e5('0xa2')](',');var _0x1a1f28={};_0x1a1f28[_0x546758[0x0]]={'$gte':moment(_0x546758[0x1])[_0xf6e5('0xa3')](_0xf6e5('0xa4'))};_0x442741['where']=_['merge'](_0x442741['where'],_0x1a1f28);}_0x442741=_['merge']({},_0x442741,_0x32f708[_0xf6e5('0x55')]);return db[_0xf6e5('0xa5')][_0xf6e5('0x56')]({'where':_0x442741['where']})['then'](function(_0x3eda95){_0x480858[_0xf6e5('0x56')]=_0x3eda95;if(_0x32f708['query'][_0xf6e5('0x57')]){_0x442741[_0xf6e5('0x67')]=[{'all':!![]}];}return db[_0xf6e5('0xa5')][_0xf6e5('0x58')](_0x442741);})[_0xf6e5('0x36')](function(_0x4448c3){_0x480858[_0xf6e5('0x59')]=_0x4448c3;return _0x480858;});}})[_0xf6e5('0x36')](respondWithFilteredResult(_0x364bc3,_0x442741))[_0xf6e5('0x2b')](handleError(_0x364bc3,null));};exports[_0xf6e5('0x3d')]=function(_0x4c100b,_0x4faade,_0x436ce6){var _0x9821b9,_0x42aab3={},_0x453455;if(_0x4c100b[_0xf6e5('0x5e')]['to']){_0x453455=_0x4c100b['body']['to'][0x0];}return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x4c100b[_0xf6e5('0x5b')]['id']},'include':[{'model':db[_0xf6e5('0xa6')],'as':_0xf6e5('0xa7'),'include':[{'model':db[_0xf6e5('0x72')],'as':'Contacts','where':{'fax':_0x453455},'limit':0x1,'order':[[_0xf6e5('0xa8'),_0xf6e5('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x4faade,null))['then'](function(_0x47b10a){_0x9821b9=_0x47b10a;if(_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')]&&_0x4c100b['body']['attachments'][_0xf6e5('0x7f')]){for(var _0x4cb56b=0x0;_0x4cb56b<_0x4c100b['body'][_0xf6e5('0xaa')]['length'];_0x4cb56b+=0x1){_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][_0x4cb56b]={'filename':_0x4c100b['body'][_0xf6e5('0xaa')][_0x4cb56b][_0xf6e5('0x3c')],'id':_0x4c100b[_0xf6e5('0x5e')]['attachments'][_0x4cb56b]['id'],'path':path[_0xf6e5('0xab')](config['root'],_0xf6e5('0xac'),_0x4c100b['body']['attachments'][_0x4cb56b][_0xf6e5('0xad')])};}}return respondWithRpcPromise(_0xf6e5('0xae'),_0xf6e5('0xae'),{'FaxAccountId':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5b')]['id'])?undefined:_0x4c100b['params']['id'],'path':_[_0xf6e5('0xaf')](_0x4c100b['body']['attachments'][0x0][_0xf6e5('0xb0')])?undefined:_0x4c100b[_0xf6e5('0x5e')]['attachments'][0x0][_0xf6e5('0xb0')],'fax':_['isNil'](_0x4c100b['body']['to'][0x0])?undefined:_0x4c100b[_0xf6e5('0x5e')]['to'][0x0]},client9002);})[_0xf6e5('0x36')](function(){if(_0x9821b9){if(_['isNil'](_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xb1')])){_0x4c100b['body'][_0xf6e5('0xb1')]=util[_0xf6e5('0xa3')](_0xf6e5('0xb2'),_0x9821b9[_0xf6e5('0x3c')],_0x9821b9[_0xf6e5('0xb3')]);}if(_0x9821b9[_0xf6e5('0xa7')]){if(_0x9821b9['List']['Contacts']['length']){return _0x9821b9[_0xf6e5('0xa7')][_0xf6e5('0xb4')][0x0];}else{return db[_0xf6e5('0x72')][_0xf6e5('0x5d')](_['defaults'](_0x4c100b['body'],{'firstName':_0x4c100b['body']['to'][0x0],'phone':_0x4c100b[_0xf6e5('0x5e')]['to'][0x0],'fax':_0x4c100b[_0xf6e5('0x5e')]['to'][0x0],'ListId':_0x9821b9[_0xf6e5('0x9f')]}));}}else{throw new Error(_0xf6e5('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xf6e5('0x36')](function(_0x274531){if(_0x274531){return db[_0xf6e5('0x71')][_0xf6e5('0x5c')]({'where':{'ContactId':_0x274531['id'],'closed':![],'FaxAccountId':_0x9821b9['id']}})['then'](function(_0x39b2f3){if(_0x39b2f3){return[_0x39b2f3,![]];}return db['FaxInteraction']['create']({'UserId':_0x4c100b[_0xf6e5('0xb6')]['id'],'ContactId':_0x274531['id'],'FaxAccountId':_0x9821b9['id'],'fax':_0x4c100b['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf6e5('0x53')](_0x4c100b[_0xf6e5('0x5e')],{'read':![],'body':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0]['filename'],'FaxAccountId':_0x9821b9['id'],'UserId':_0x4c100b[_0xf6e5('0xb6')]['id'],'ContactId':_0x274531['id'],'AttachmentId':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xf6e5('0xa5')],'as':_0xf6e5('0xb7')}]})[_0xf6e5('0x36')](function(_0x500135){return[_0x500135,!![]];});});}else{throw new Error(_0xf6e5('0xb8'));}})[_0xf6e5('0xb9')](function(_0x57a6cc,_0x13eac7){if(_0x13eac7){return _0x57a6cc;}return db['FaxMessage']['create']({'direction':_0xf6e5('0xba'),'read':![],'body':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0][_0xf6e5('0xbb')],'FaxAccountId':_0x9821b9['id'],'FaxInteractionId':_0x57a6cc['id'],'UserId':_0x4c100b[_0xf6e5('0xb6')]['id'],'ContactId':_0x57a6cc['ContactId'],'AttachmentId':_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0]['id']})['then'](function(_0x14c387){_0x57a6cc['dataValues'][_0xf6e5('0xb7')]=[];_0x57a6cc[_0xf6e5('0xbc')][_0xf6e5('0xb7')]['push'](_0x14c387[_0xf6e5('0xbc')]);return _0x57a6cc;});})['then'](function(_0x10691c){respondWithRpcPromise(_0xf6e5('0xbd'),_0xf6e5('0xbd'),{'FaxAccountId':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5b')]['id'])?undefined:_0x4c100b['params']['id'],'path':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0][_0xf6e5('0xb0')])?undefined:_0x4c100b[_0xf6e5('0x5e')][_0xf6e5('0xaa')][0x0][_0xf6e5('0xb0')],'fax':_[_0xf6e5('0xaf')](_0x4c100b[_0xf6e5('0x5e')]['to'][0x0])?undefined:_0x4c100b[_0xf6e5('0x5e')]['to'][0x0],'AttachmentId':_0x4c100b['body']['attachments'][0x0]['id']},client9002)[_0xf6e5('0x36')](function(_0x9c8f9b){logger[_0xf6e5('0x21')]('SendFaxRpc,\x20%s',_0x9c8f9b);})[_0xf6e5('0x2b')](function(_0x2ae3d5){logger[_0xf6e5('0x21')]('SendFaxRpc,\x20%s',_0x2ae3d5);});return _0x10691c;})[_0xf6e5('0x36')](respondWithResult(_0x4faade,null))[_0xf6e5('0x2b')](handleError(_0x4faade,null));};exports[_0xf6e5('0xbe')]=function(_0x3f1a77,_0x4946fc,_0x1b5465){return db[_0xf6e5('0x41')][_0xf6e5('0x5c')]({'where':{'id':_0x3f1a77['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x4946fc,null))[_0xf6e5('0x36')](function(_0x5c37ea){if(_0x5c37ea){return _0x5c37ea['addAgents'](_0x3f1a77['body'][_0xf6e5('0x69')],_['omit'](_0x3f1a77[_0xf6e5('0x5e')],[_0xf6e5('0x69'),'id'])||{})['spread'](function(_0x81f445){for(var _0xe35836=0x0;_0xe35836<_0x3f1a77[_0xf6e5('0x5e')][_0xf6e5('0x69')]['length'];_0xe35836+=0x1){socket[_0xf6e5('0xbf')]('userFaxAccount:save',{'UserId':_0x3f1a77[_0xf6e5('0x5e')][_0xf6e5('0x69')][_0xe35836],'FaxAccountId':_0x3f1a77[_0xf6e5('0x5b')]['id']});}return _0x81f445;});}})['then'](respondWithResult(_0x4946fc,null))[_0xf6e5('0x2b')](handleError(_0x4946fc,null));};exports[_0xf6e5('0xc0')]=function(_0x1e89bd,_0x4d39d6,_0x201108){return db['FaxAccount']['find']({'where':{'id':_0x1e89bd[_0xf6e5('0x5b')]['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x4d39d6,null))[_0xf6e5('0x36')](function(_0xc92105){if(_0xc92105){return _0xc92105[_0xf6e5('0xc0')](_0x1e89bd[_0xf6e5('0x45')][_0xf6e5('0x69')])[_0xf6e5('0x36')](function(){if(_[_0xf6e5('0xc1')](_0x1e89bd['query']['ids'])){for(var _0x41c22f=0x0;_0x41c22f<_0x1e89bd[_0xf6e5('0x45')][_0xf6e5('0x69')][_0xf6e5('0x7f')];_0x41c22f+=0x1){socket[_0xf6e5('0xbf')](_0xf6e5('0xc2'),{'UserId':Number(_0x1e89bd['query'][_0xf6e5('0x69')][_0x41c22f]),'FaxAccountId':Number(_0x1e89bd['params']['id'])});}}else{socket[_0xf6e5('0xbf')](_0xf6e5('0xc2'),{'UserId':Number(_0x1e89bd['query']['ids']),'FaxAccountId':Number(_0x1e89bd['params']['id'])});}});}})[_0xf6e5('0x36')](respondWithStatusCode(_0x4d39d6,null))['catch'](handleError(_0x4d39d6,null));};exports[_0xf6e5('0xc3')]=function(_0x228d35,_0x358554,_0x2f39b8){var _0x406db1={};var _0x2b0048={};var _0x48c64a;var _0x11c327;return db[_0xf6e5('0x41')][_0xf6e5('0x6d')]({'where':{'id':_0x228d35['params']['id']}})[_0xf6e5('0x36')](handleEntityNotFound(_0x358554,null))['then'](function(_0x1f368f){if(_0x1f368f){_0x48c64a=_0x1f368f;_0x2b0048[_0xf6e5('0x4a')]=_[_0xf6e5('0x46')](db['User'][_0xf6e5('0x42')]);_0x2b0048[_0xf6e5('0x45')]=_[_0xf6e5('0x46')](_0x228d35[_0xf6e5('0x45')]);_0x2b0048['filters']=_[_0xf6e5('0x48')](_0x2b0048[_0xf6e5('0x4a')],_0x2b0048[_0xf6e5('0x45')]);_0x406db1[_0xf6e5('0x49')]=_[_0xf6e5('0x48')](_0x2b0048[_0xf6e5('0x4a')],qs['fields'](_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x4b')]));_0x406db1[_0xf6e5('0x49')]=_0x406db1[_0xf6e5('0x49')]['length']?_0x406db1[_0xf6e5('0x49')]:_0x2b0048['model'];_0x406db1[_0xf6e5('0x4e')]=qs[_0xf6e5('0x4f')](_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x4f')]);_0x406db1['where']=qs[_0xf6e5('0x47')](_[_0xf6e5('0x50')](_0x228d35['query'],_0x2b0048['filters']));if(_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x51')]){_0x406db1[_0xf6e5('0x52')]=_[_0xf6e5('0x53')](_0x406db1[_0xf6e5('0x52')],{'$or':_[_0xf6e5('0x40')](_0x406db1[_0xf6e5('0x49')],function(_0x4246fa){var _0x52aa0e={};_0x52aa0e[_0x4246fa]={'$like':'%'+_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x51')]+'%'};return _0x52aa0e;})});}_0x406db1=_[_0xf6e5('0x53')]({},_0x406db1,_0x228d35[_0xf6e5('0x55')]);return _0x48c64a[_0xf6e5('0xc3')](_0x406db1);}})['then'](function(_0x89478f){if(_0x89478f){_0x11c327=_0x89478f[_0xf6e5('0x7f')];if(!_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x4c')](_0xf6e5('0x4d'))){_0x406db1[_0xf6e5('0x31')]=qs[_0xf6e5('0x31')](_0x228d35[_0xf6e5('0x45')][_0xf6e5('0x31')]);_0x406db1['offset']=qs[_0xf6e5('0x30')](_0x228d35['query'][_0xf6e5('0x30')]);}return _0x48c64a['getAgents'](_0x406db1);}})[_0xf6e5('0x36')](function(_0x507a7c){if(_0x507a7c){return _0x507a7c?{'count':_0x11c327,'rows':_0x507a7c}:null;}})[_0xf6e5('0x36')](respondWithResult(_0x358554,null))['catch'](handleError(_0x358554,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f83a0ec..ca4f9ad 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 _0xb7d8=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','save'];(function(_0x3c3ccc,_0x419870){var _0x26ec55=function(_0x3ec764){while(--_0x3ec764){_0x3c3ccc['push'](_0x3c3ccc['shift']());}};_0x26ec55(++_0x419870);}(_0xb7d8,0x7c));var _0x8b7d=function(_0x170e2f,_0xae68e4){_0x170e2f=_0x170e2f-0x0;var _0x265067=_0xb7d8[_0x170e2f];return _0x265067;};'use strict';var EventEmitter=require(_0x8b7d('0x0'));var FaxAccount=require(_0x8b7d('0x1'))['db'][_0x8b7d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b7d('0x3'),'afterUpdate':'update','afterDestroy':_0x8b7d('0x4')};function emitEvent(_0x14c112){return function(_0x32cea7,_0x10a459,_0x5d9974){FaxAccountEvents[_0x8b7d('0x5')](_0x14c112+':'+_0x32cea7['id'],_0x32cea7);FaxAccountEvents[_0x8b7d('0x5')](_0x14c112,_0x32cea7);_0x5d9974(null);};}for(var e in events){if(events[_0x8b7d('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x8b7d('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x350c=['exports','../../mysqldb','FaxAccount','save','update','emit','hasOwnProperty','hook'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x350c,0x1c1));var _0xc350=function(_0x5ec365,_0x51c23b){_0x5ec365=_0x5ec365-0x0;var _0x5d09a5=_0x350c[_0x5ec365];return _0x5d09a5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xc350('0x0'))['db'][_0xc350('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc350('0x2'),'afterUpdate':_0xc350('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5349ac){return function(_0x581968,_0x2846bb,_0x4e83b3){FaxAccountEvents['emit'](_0x5349ac+':'+_0x581968['id'],_0x581968);FaxAccountEvents[_0xc350('0x4')](_0x5349ac,_0x581968);_0x4e83b3(null);};}for(var e in events){if(events[_0xc350('0x5')](e)){var event=events[e];FaxAccount[_0xc350('0x6')](e,emitEvent(event));}}module[_0xc350('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 64adb41..9a93b46 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 _0x4fd5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x2ecd74,_0x43247c){var _0x2d6a1d=function(_0x3c0571){while(--_0x3c0571){_0x2ecd74['push'](_0x2ecd74['shift']());}};_0x2d6a1d(++_0x43247c);}(_0x4fd5,0x15d));var _0x54fd=function(_0x2d1691,_0x146891){_0x2d1691=_0x2d1691-0x0;var _0x320eb4=_0x4fd5[_0x2d1691];return _0x320eb4;};'use strict';var _=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var logger=require(_0x54fd('0x2'))(_0x54fd('0x3'));var moment=require(_0x54fd('0x4'));var BPromise=require(_0x54fd('0x5'));var rp=require(_0x54fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54fd('0x7'));var config=require(_0x54fd('0x8'));var attributes=require(_0x54fd('0x9'));module[_0x54fd('0xa')]=function(_0x27932d,_0x259cdf){return _0x27932d[_0x54fd('0xb')](_0x54fd('0xc'),attributes,{'tableName':_0x54fd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0953=['util','../../config/logger','api','moment','request-promise','path','exports','define','fax_accounts'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x0953,0x171));var _0x3095=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x0953[_0xd0cd0b];return _0x59cced;};'use strict';var _=require('lodash');var util=require(_0x3095('0x0'));var logger=require(_0x3095('0x1'))(_0x3095('0x2'));var moment=require(_0x3095('0x3'));var BPromise=require('bluebird');var rp=require(_0x3095('0x4'));var fs=require('fs');var path=require(_0x3095('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x3095('0x6')]=function(_0x132b66,_0x242a0d){return _0x132b66[_0x3095('0x7')]('FaxAccount',attributes,{'tableName':_0x3095('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 00729ce..83f7e13 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 _0x376b=['redis','defaults','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','get','account','applications','Applications','orderBy','priority','length','from','mapKey','contact','fax','FaxInteraction','create','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x376b,0x1c0));var _0xb376=function(_0x2692f8,_0x31f1b2){_0x2692f8=_0x2692f8-0x0;var _0x560968=_0x376b[_0x2692f8];return _0x560968;};'use strict';var _=require(_0xb376('0x0'));var util=require('util');var moment=require(_0xb376('0x1'));var BPromise=require('bluebird');var rs=require(_0xb376('0x2'));var fs=require('fs');var Redis=require(_0xb376('0x3'));var db=require(_0xb376('0x4'))['db'];var utils=require(_0xb376('0x5'));var logger=require(_0xb376('0x6'))(_0xb376('0x7'));var config=require(_0xb376('0x8'));var jayson=require(_0xb376('0x9'));var client=jayson[_0xb376('0xa')][_0xb376('0xb')]({'port':0x232c});config[_0xb376('0xc')]=_[_0xb376('0xd')](config['redis'],{'host':_0xb376('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb376('0xc')]));require(_0xb376('0xf'))[_0xb376('0x10')](socket);function respondWithRpcPromise(_0x2d42ce,_0x255bcf,_0x734b69){return new BPromise(function(_0x578146,_0x48e340){return client['request'](_0x2d42ce,_0x734b69)[_0xb376('0x11')](function(_0x21df00){logger['info'](_0xb376('0x12'),_0x255bcf,_0xb376('0x13'));logger[_0xb376('0x14')](_0xb376('0x15'),_0x255bcf,_0xb376('0x13'),JSON[_0xb376('0x16')](_0x21df00));if(_0x21df00[_0xb376('0x17')]){if(_0x21df00[_0xb376('0x17')][_0xb376('0x18')]===0x1f4){logger['error'](_0xb376('0x12'),_0x255bcf,_0x21df00[_0xb376('0x17')][_0xb376('0x19')]);return _0x48e340(_0x21df00['error'][_0xb376('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x255bcf,_0x21df00[_0xb376('0x17')]['message']);return _0x578146(_0x21df00[_0xb376('0x17')][_0xb376('0x19')]);}else{logger[_0xb376('0x1a')](_0xb376('0x12'),_0x255bcf,_0xb376('0x13'));_0x578146(_0x21df00[_0xb376('0x1b')][_0xb376('0x19')]);}})['catch'](function(_0x1ccc81){logger['error'](_0xb376('0x12'),_0x255bcf,_0x1ccc81);_0x48e340(_0x1ccc81);});});}exports['GetFaxAccount']=function(_0x125e6d){var _0x2c9cb7=this;return new Promise(function(_0x14e436,_0x573ed4){return db['FaxAccount'][_0xb376('0x1c')]({'raw':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')][_0xb376('0x1e')]===undefined?!![]:![]:!![],'where':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')][_0xb376('0x1f')]||null:null,'attributes':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')][_0xb376('0x20')]||null:null,'limit':_0x125e6d[_0xb376('0x1d')]?_0x125e6d[_0xb376('0x1d')]['limit']||null:null,'include':_0x125e6d['options']?_0x125e6d[_0xb376('0x1d')][_0xb376('0x21')]?_[_0xb376('0x22')](_0x125e6d[_0xb376('0x1d')][_0xb376('0x21')],function(_0x3c0ac6){return{'model':db[_0x3c0ac6[_0xb376('0x23')]],'as':_0x3c0ac6['as'],'attributes':_0x3c0ac6[_0xb376('0x20')],'include':_0x3c0ac6[_0xb376('0x21')]?_['map'](_0x3c0ac6[_0xb376('0x21')],function(_0x2cf9ab){return{'model':db[_0x2cf9ab[_0xb376('0x23')]],'as':_0x2cf9ab['as'],'attributes':_0x2cf9ab[_0xb376('0x20')],'include':_0x2cf9ab[_0xb376('0x21')]?_[_0xb376('0x22')](_0x2cf9ab['include'],function(_0x4d60be){return{'model':db[_0x4d60be[_0xb376('0x23')]],'as':_0x4d60be['as'],'attributes':_0x4d60be[_0xb376('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f31e){logger[_0xb376('0x1a')](_0xb376('0x24'),_0x125e6d);logger[_0xb376('0x14')](_0xb376('0x24'),_0x125e6d,JSON['stringify'](_0x28f31e));_0x14e436(_0x28f31e);})[_0xb376('0x25')](function(_0x24c0a3){logger['error'](_0xb376('0x24'),_0x24c0a3[_0xb376('0x19')],_0x125e6d);_0x573ed4(_0x2c9cb7[_0xb376('0x17')](0x1f4,_0x24c0a3[_0xb376('0x19')]));});});};exports[_0xb376('0x26')]=function(_0x2862fa,_0x502802,_0xdd2a1d){var _0x2ee07f=this;return new Promise(function(_0x5a6849,_0x3cdcbd){var _0x441305={'body':_0x2862fa[_0xb376('0x27')],'channel':'fax'};var _0x3fe0eb=[];var _0x1616a6=[];var _0xc27d97={};return db['CmContact'][_0xb376('0x28')]()[_0xb376('0x11')](function(_0x50b959){if(!_0x50b959){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))]('no\x20available\x20attributes');}_0x3fe0eb=_[_0xb376('0x2b')](_[_0xb376('0x2c')](_0x50b959),[_0xb376('0x2d'),'updatedAt']);_0x1616a6=_['difference'](_['keys'](_0x50b959),[_0xb376('0x2d'),_0xb376('0x2e'),'CompanyId',_0xb376('0x2f')]);if(_0x2862fa[_0xb376('0x27')]['id']){delete _0x2862fa[_0xb376('0x27')]['id'];}if(_[_0xb376('0x30')](_0x2862fa['body']['from'])){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))](_0xb376('0x31'));}if(_[_0xb376('0x30')](_0x2862fa['body']['body'])||_0x2862fa['body'][_0xb376('0x27')]===''){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))](_0xb376('0x32'));}if(_[_0xb376('0x30')](_0x2862fa[_0xb376('0x27')]['mapKey'])){throw new db[(_0xb376('0x29'))][(_0xb376('0x2a'))](_0xb376('0x33')+_0x1616a6);}if(!_[_0xb376('0x34')](_0x1616a6,_0x2862fa[_0xb376('0x27')]['mapKey'])){throw new db[(_0xb376('0x29'))]['ValidationError'](_0xb376('0x35')+_0x1616a6);}_0xc27d97[_0x2862fa[_0xb376('0x27')]['mapKey']]=_0x2862fa['body']['from'];})[_0xb376('0x11')](function(){return db[_0xb376('0x36')][_0xb376('0x37')]({'where':{'id':_0x2862fa['account']['id']},'include':[{'model':db[_0xb376('0x38')],'as':_0xb376('0x39'),'include':[{'model':db[_0xb376('0x3a')],'as':_0xb376('0x3b'),'where':_0xc27d97,'limit':0x1,'order':[[_0xb376('0x2e'),_0xb376('0x3c')]]}]},{'model':db[_0xb376('0x3d')],'as':'Applications'}]});})[_0xb376('0x11')](function(_0x3a1a2b){if(_0x3a1a2b&&_0x3a1a2b[_0xb376('0x39')]){var _0x62c600=_0x3a1a2b[_0xb376('0x3e')]({'plain':!![]});_0x441305[_0xb376('0x3f')]=_0x62c600;_0x441305[_0xb376('0x40')]=_0x62c600[_0xb376('0x41')];_0x441305['list']=_0x62c600[_0xb376('0x39')];_0x441305['applications']=_[_0xb376('0x42')](_0x441305['applications'],[_0xb376('0x43')],['asc']);if(_0x441305[_0xb376('0x3f')][_0xb376('0x41')]){delete _0x441305[_0xb376('0x3f')][_0xb376('0x41')];}if(_0x441305['account'][_0xb376('0x39')]&&_0x441305[_0xb376('0x3f')]['List'][_0xb376('0x3b')][_0xb376('0x44')]){return _0x441305[_0xb376('0x3f')][_0xb376('0x39')][_0xb376('0x3b')][0x0];}var _0xb7a241=_['defaults'](_0x2862fa[_0xb376('0x27')],{'firstName':_0x2862fa[_0xb376('0x27')][_0xb376('0x45')],'ListId':_0x62c600['ListId']});_0xb7a241[_0x2862fa[_0xb376('0x27')][_0xb376('0x46')]]=_0x2862fa[_0xb376('0x27')][_0xb376('0x45')];return db['CmContact']['create'](_0xb7a241,{'fields':_0x3fe0eb,'raw':!![]});}})[_0xb376('0x11')](function(_0x28ddf4){_0x441305[_0xb376('0x47')]=_0x28ddf4;if(_0x28ddf4){var _0x76630e={'ContactId':_0x28ddf4['id'],'FaxAccountId':_0x2862fa[_0xb376('0x3f')]['id'],'fax':_0x28ddf4[_0xb376('0x48')]};return db[_0xb376('0x49')][_0xb376('0x37')]({'where':{'ContactId':_0x28ddf4['id'],'closed':![],'FaxAccountId':_0x2862fa[_0xb376('0x3f')]['id']}})[_0xb376('0x11')](function(_0xc2acc6){if(_0xc2acc6){return[_0xc2acc6,![]];}return db['FaxInteraction'][_0xb376('0x4a')](_0x76630e)[_0xb376('0x11')](function(_0x51213b){return[_0x51213b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb376('0x4b')](function(_0x3210c8,_0x5c6266){var _0x56a81d=_0x3210c8['get']({'plain':!![]});if(_0x5c6266){if(_0x441305[_0xb376('0x3f')][_0xb376('0x4c')]){_0x441305[_0xb376('0x40')][_0xb376('0x4d')]({'id':0x0,'priority':_0x441305[_0xb376('0x40')][_0xb376('0x44')]+0x1,'app':_0xb376('0x4e'),'appdata':_0xb376('0x4f'),'interval':_0xb376('0x50')});}_0x56a81d[_0xb376('0x51')]=!![];}else{_0x56a81d['created']=![];}_0x441305['interaction']=_0x56a81d;return db[_0xb376('0x52')]['create']({'body':_0x2862fa[_0xb376('0x27')][_0xb376('0x27')],'FaxAccountId':_0x2862fa[_0xb376('0x3f')]['id'],'FaxInteractionId':_0x3210c8['id'],'direction':'in','ContactId':_0x3210c8[_0xb376('0x53')],'AttachmentId':_0x2862fa[_0xb376('0x27')]['AttachmentId']});})[_0xb376('0x11')](function(_0x1930e0){_0x441305[_0xb376('0x19')]=_0x1930e0;if(_0x441305[_0xb376('0x54')][_0xb376('0x55')]){return db[_0xb376('0x56')][_0xb376('0x37')]({'attributes':['id','name'],'where':{'id':_0x441305['interaction']['UserId']}})[_0xb376('0x11')](function(_0x234581){if(_0x234581){_0x441305[_0xb376('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb376('0x57'),'appdata':_0x234581[_0xb376('0x58')]+','+(_0x441305['account'][_0xb376('0x59')]||0xa),'interval':_0xb376('0x50')});}return respondWithRpcPromise(_0xb376('0x5a'),_0xb376('0x5b'),_0x441305);});}return respondWithRpcPromise(_0xb376('0x5a'),'startRouting',_0x441305);})[_0xb376('0x11')](function(_0x329dd7){_0x5a6849(_0x329dd7);})['catch'](function(_0x22cea1){_0x3cdcbd(_0x2ee07f[_0xb376('0x17')](0x1f4,_0x22cea1[_0xb376('0x19')]));});});}; \ No newline at end of file +var _0xe181=['Contact\x20not\x20found','get','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','list','applications','orderBy','asc','from','create','contact','fax','FaxInteraction'];(function(_0x3c9c2e,_0x1e7d40){var _0x269196=function(_0x1cb3c7){while(--_0x1cb3c7){_0x3c9c2e['push'](_0x3c9c2e['shift']());}};_0x269196(++_0x1e7d40);}(_0xe181,0x68));var _0x1e18=function(_0x19b56f,_0x4cbbd9){_0x19b56f=_0x19b56f-0x0;var _0x1e69f9=_0xe181[_0x19b56f];return _0x1e69f9;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232c});config[_0x1e18('0xa')]=_[_0x1e18('0xb')](config[_0x1e18('0xa')],{'host':_0x1e18('0xc'),'port':0x18eb});var socket=require(_0x1e18('0xd'))(new Redis(config['redis']));require(_0x1e18('0xe'))[_0x1e18('0xf')](socket);function respondWithRpcPromise(_0x40e5e9,_0x363da4,_0x19d0bc){return new BPromise(function(_0x56ad80,_0x56f13a){return client[_0x1e18('0x10')](_0x40e5e9,_0x19d0bc)[_0x1e18('0x11')](function(_0xa3eecd){logger[_0x1e18('0x12')](_0x1e18('0x13'),_0x363da4,_0x1e18('0x14'));logger[_0x1e18('0x15')](_0x1e18('0x16'),_0x363da4,'request\x20sent',JSON[_0x1e18('0x17')](_0xa3eecd));if(_0xa3eecd['error']){if(_0xa3eecd[_0x1e18('0x18')]['code']===0x1f4){logger[_0x1e18('0x18')](_0x1e18('0x13'),_0x363da4,_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);return _0x56f13a(_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);}logger[_0x1e18('0x18')](_0x1e18('0x13'),_0x363da4,_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);return _0x56ad80(_0xa3eecd[_0x1e18('0x18')][_0x1e18('0x19')]);}else{logger[_0x1e18('0x12')](_0x1e18('0x13'),_0x363da4,_0x1e18('0x14'));_0x56ad80(_0xa3eecd['result'][_0x1e18('0x19')]);}})[_0x1e18('0x1a')](function(_0xea095a){logger[_0x1e18('0x18')](_0x1e18('0x13'),_0x363da4,_0xea095a);_0x56f13a(_0xea095a);});});}exports[_0x1e18('0x1b')]=function(_0x3a6229){var _0x22fada=this;return new Promise(function(_0x2e849d,_0x22baca){return db[_0x1e18('0x1c')][_0x1e18('0x1d')]({'raw':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')][_0x1e18('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')]['where']||null:null,'attributes':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')][_0x1e18('0x20')]||null:null,'limit':_0x3a6229['options']?_0x3a6229[_0x1e18('0x1e')][_0x1e18('0x21')]||null:null,'include':_0x3a6229[_0x1e18('0x1e')]?_0x3a6229[_0x1e18('0x1e')]['include']?_['map'](_0x3a6229[_0x1e18('0x1e')]['include'],function(_0x5bb03c){return{'model':db[_0x5bb03c['model']],'as':_0x5bb03c['as'],'attributes':_0x5bb03c[_0x1e18('0x20')],'include':_0x5bb03c[_0x1e18('0x22')]?_[_0x1e18('0x23')](_0x5bb03c[_0x1e18('0x22')],function(_0x3a95c1){return{'model':db[_0x3a95c1[_0x1e18('0x24')]],'as':_0x3a95c1['as'],'attributes':_0x3a95c1[_0x1e18('0x20')],'include':_0x3a95c1[_0x1e18('0x22')]?_[_0x1e18('0x23')](_0x3a95c1[_0x1e18('0x22')],function(_0x1015a3){return{'model':db[_0x1015a3[_0x1e18('0x24')]],'as':_0x1015a3['as'],'attributes':_0x1015a3[_0x1e18('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1e18('0x11')](function(_0x558d01){logger[_0x1e18('0x12')]('GetFaxAccount',_0x3a6229);logger[_0x1e18('0x15')](_0x1e18('0x1b'),_0x3a6229,JSON[_0x1e18('0x17')](_0x558d01));_0x2e849d(_0x558d01);})[_0x1e18('0x1a')](function(_0x2828dc){logger[_0x1e18('0x18')](_0x1e18('0x1b'),_0x2828dc[_0x1e18('0x19')],_0x3a6229);_0x22baca(_0x22fada['error'](0x1f4,_0x2828dc[_0x1e18('0x19')]));});});};exports[_0x1e18('0x25')]=function(_0x5d4df9,_0xd83059,_0x29a6c8){var _0x415d7b=this;return new Promise(function(_0x4cf595,_0x40fd04){var _0x5597ab={'body':_0x5d4df9['body'],'channel':'fax'};var _0xa4fe9e=[];var _0x48b89f=[];var _0x2a1fd1={};return db[_0x1e18('0x26')][_0x1e18('0x27')]()['then'](function(_0x4a569d){if(!_0x4a569d){throw new db[(_0x1e18('0x28'))][(_0x1e18('0x29'))](_0x1e18('0x2a'));}_0xa4fe9e=_[_0x1e18('0x2b')](_[_0x1e18('0x2c')](_0x4a569d),[_0x1e18('0x2d'),_0x1e18('0x2e')]);_0x48b89f=_[_0x1e18('0x2b')](_[_0x1e18('0x2c')](_0x4a569d),[_0x1e18('0x2d'),_0x1e18('0x2e'),_0x1e18('0x2f'),'ListId']);if(_0x5d4df9['body']['id']){delete _0x5d4df9[_0x1e18('0x30')]['id'];}if(_[_0x1e18('0x31')](_0x5d4df9[_0x1e18('0x30')]['from'])){throw new db[(_0x1e18('0x28'))]['ValidationError'](_0x1e18('0x32'));}if(_['isNil'](_0x5d4df9['body'][_0x1e18('0x30')])||_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x30')]===''){throw new db[(_0x1e18('0x28'))][(_0x1e18('0x29'))](_0x1e18('0x33'));}if(_['isNil'](_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x34')])){throw new db[(_0x1e18('0x28'))][(_0x1e18('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48b89f);}if(!_[_0x1e18('0x35')](_0x48b89f,_0x5d4df9['body'][_0x1e18('0x34')])){throw new db[(_0x1e18('0x28'))]['ValidationError'](_0x1e18('0x36')+_0x48b89f);}_0x2a1fd1[_0x5d4df9[_0x1e18('0x30')]['mapKey']]=_0x5d4df9['body']['from'];})[_0x1e18('0x11')](function(){return db[_0x1e18('0x1c')][_0x1e18('0x37')]({'where':{'id':_0x5d4df9[_0x1e18('0x38')]['id']},'include':[{'model':db[_0x1e18('0x39')],'as':_0x1e18('0x3a'),'include':[{'model':db[_0x1e18('0x26')],'as':_0x1e18('0x3b'),'where':_0x2a1fd1,'limit':0x1,'order':[[_0x1e18('0x2e'),_0x1e18('0x3c')]]}]},{'model':db[_0x1e18('0x3d')],'as':'Applications'}]});})[_0x1e18('0x11')](function(_0x5cc2e5){if(_0x5cc2e5&&_0x5cc2e5[_0x1e18('0x3a')]){var _0xcb599a=_0x5cc2e5['get']({'plain':!![]});_0x5597ab['account']=_0xcb599a;_0x5597ab['applications']=_0xcb599a[_0x1e18('0x3e')];_0x5597ab[_0x1e18('0x3f')]=_0xcb599a['List'];_0x5597ab[_0x1e18('0x40')]=_[_0x1e18('0x41')](_0x5597ab['applications'],['priority'],[_0x1e18('0x42')]);if(_0x5597ab[_0x1e18('0x38')][_0x1e18('0x3e')]){delete _0x5597ab[_0x1e18('0x38')][_0x1e18('0x3e')];}if(_0x5597ab[_0x1e18('0x38')][_0x1e18('0x3a')]&&_0x5597ab[_0x1e18('0x38')][_0x1e18('0x3a')][_0x1e18('0x3b')]['length']){return _0x5597ab['account'][_0x1e18('0x3a')][_0x1e18('0x3b')][0x0];}var _0x14baa4=_[_0x1e18('0xb')](_0x5d4df9[_0x1e18('0x30')],{'firstName':_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x43')],'ListId':_0xcb599a['ListId']});_0x14baa4[_0x5d4df9['body']['mapKey']]=_0x5d4df9[_0x1e18('0x30')][_0x1e18('0x43')];return db[_0x1e18('0x26')][_0x1e18('0x44')](_0x14baa4,{'fields':_0xa4fe9e,'raw':!![]});}})[_0x1e18('0x11')](function(_0x214b01){_0x5597ab[_0x1e18('0x45')]=_0x214b01;if(_0x214b01){var _0x190af4={'ContactId':_0x214b01['id'],'FaxAccountId':_0x5d4df9[_0x1e18('0x38')]['id'],'fax':_0x214b01[_0x1e18('0x46')]};return db[_0x1e18('0x47')][_0x1e18('0x37')]({'where':{'ContactId':_0x214b01['id'],'closed':![],'FaxAccountId':_0x5d4df9[_0x1e18('0x38')]['id']}})[_0x1e18('0x11')](function(_0x6b0367){if(_0x6b0367){return[_0x6b0367,![]];}return db[_0x1e18('0x47')][_0x1e18('0x44')](_0x190af4)[_0x1e18('0x11')](function(_0x56e30b){return[_0x56e30b,!![]];});});}else{throw new Error(_0x1e18('0x48'));}})['spread'](function(_0x3e2880,_0x17a8ac){var _0x215aa2=_0x3e2880[_0x1e18('0x49')]({'plain':!![]});if(_0x17a8ac){if(_0x5597ab[_0x1e18('0x38')]['autoclose']){_0x5597ab['applications'][_0x1e18('0x4a')]({'id':0x0,'priority':_0x5597ab[_0x1e18('0x40')]['length']+0x1,'app':_0x1e18('0x4b'),'appdata':_0x1e18('0x4c'),'interval':_0x1e18('0x4d')});}_0x215aa2['created']=!![];}else{_0x215aa2[_0x1e18('0x4e')]=![];}_0x5597ab[_0x1e18('0x4f')]=_0x215aa2;return db[_0x1e18('0x50')][_0x1e18('0x44')]({'body':_0x5d4df9[_0x1e18('0x30')]['body'],'FaxAccountId':_0x5d4df9[_0x1e18('0x38')]['id'],'FaxInteractionId':_0x3e2880['id'],'direction':'in','ContactId':_0x3e2880['ContactId'],'AttachmentId':_0x5d4df9['body'][_0x1e18('0x51')]});})[_0x1e18('0x11')](function(_0x157981){_0x5597ab[_0x1e18('0x19')]=_0x157981;if(_0x5597ab[_0x1e18('0x4f')][_0x1e18('0x52')]){return db['User'][_0x1e18('0x37')]({'attributes':['id',_0x1e18('0x53')],'where':{'id':_0x5597ab[_0x1e18('0x4f')]['UserId']}})[_0x1e18('0x11')](function(_0x939d13){if(_0x939d13){_0x5597ab['applications'][_0x1e18('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x939d13[_0x1e18('0x53')]+','+(_0x5597ab[_0x1e18('0x38')][_0x1e18('0x55')]||0xa),'interval':_0x1e18('0x4d')});}return respondWithRpcPromise(_0x1e18('0x56'),_0x1e18('0x57'),_0x5597ab);});}return respondWithRpcPromise(_0x1e18('0x56'),_0x1e18('0x57'),_0x5597ab);})['then'](function(_0x3ab3b8){_0x4cf595(_0x3ab3b8);})[_0x1e18('0x1a')](function(_0x5a5881){_0x40fd04(_0x415d7b[_0x1e18('0x18')](0x1f4,_0x5a5881['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1cb2664..97ffbda 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 _0x7278=['length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x7278,0x161));var _0x8727=function(_0x269362,_0x5173e6){_0x269362=_0x269362-0x0;var _0x48ee4e=_0x7278[_0x269362];return _0x48ee4e;};'use strict';var FaxAccountEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){FaxAccountEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);FaxAccountEvents['on'](_0xffd783,_0x435911);}}; \ No newline at end of file +var _0x524e=['remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x7e021d,_0x3da738){var _0x3315bb=function(_0x3ae8ff){while(--_0x3ae8ff){_0x7e021d['push'](_0x7e021d['shift']());}};_0x3315bb(++_0x3da738);}(_0x524e,0x15e));var _0xe524=function(_0x4d4d72,_0x25c086){_0x4d4d72=_0x4d4d72-0x0;var _0xf22826=_0x524e[_0x4d4d72];return _0xf22826;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xe524('0x0'),_0xe524('0x1')];function createListener(_0xc5f6b5,_0x29e619){return function(_0x699159){_0x29e619[_0xe524('0x2')](_0xc5f6b5,_0x699159);};}function removeListener(_0xabd694,_0x32c90b){return function(){FaxAccountEvents[_0xe524('0x3')](_0xabd694,_0x32c90b);};}exports[_0xe524('0x4')]=function(_0x4f75d6){for(var _0xaaeaa9=0x0,_0x41e1a3=events[_0xe524('0x5')];_0xaaeaa9<_0x41e1a3;_0xaaeaa9++){var _0x533c14=events[_0xaaeaa9];var _0x384935=createListener(_0xe524('0x6')+_0x533c14,_0x4f75d6);FaxAccountEvents['on'](_0x533c14,_0x384935);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 75bad22..c75a685 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 _0xfe3c=['/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x403be2,_0x1d4b99){var _0x252fe4=function(_0xe04bbc){while(--_0xe04bbc){_0x403be2['push'](_0x403be2['shift']());}};_0x252fe4(++_0x1d4b99);}(_0xfe3c,0x76));var _0xcfe3=function(_0x422941,_0xe77aac){_0x422941=_0x422941-0x0;var _0x4729d1=_0xfe3c[_0x422941];return _0x4729d1;};'use strict';var multer=require(_0xcfe3('0x0'));var util=require(_0xcfe3('0x1'));var path=require(_0xcfe3('0x2'));var timeout=require(_0xcfe3('0x3'));var express=require(_0xcfe3('0x4'));var router=express[_0xcfe3('0x5')]();var auth=require(_0xcfe3('0x6'));var interaction=require(_0xcfe3('0x7'));var config=require(_0xcfe3('0x8'));var controller=require(_0xcfe3('0x9'));router[_0xcfe3('0xa')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0xb')]);router[_0xcfe3('0xa')](_0xcfe3('0xc'),auth[_0xcfe3('0xd')](),controller['describe']);router[_0xcfe3('0xa')](_0xcfe3('0xe'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0xf')]);router['get'](_0xcfe3('0x10'),auth['isAuthenticated'](),controller[_0xcfe3('0x11')]);router[_0xcfe3('0xa')]('/:id/canned_answers',auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x12')]);router[_0xcfe3('0xa')](_0xcfe3('0x13'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x14')]);router['get'](_0xcfe3('0x15'),auth['isAuthenticated'](),controller['getApplications']);router[_0xcfe3('0xa')](_0xcfe3('0x16'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x17')]);router['get'](_0xcfe3('0x18'),auth[_0xcfe3('0xd')](),controller['getAgents']);router[_0xcfe3('0x19')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0x1a')]);router[_0xcfe3('0x19')](_0xcfe3('0x10'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x1b')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xcfe3('0x13'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x1c')]);router['post']('/:id/applications',auth[_0xcfe3('0xd')](),controller['addApplications']);router[_0xcfe3('0x19')](_0xcfe3('0x1d'),auth['isAuthenticated'](),controller[_0xcfe3('0x1e')]);router[_0xcfe3('0x19')](_0xcfe3('0x1f'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x20')]);router[_0xcfe3('0x19')](_0xcfe3('0x21'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x22')]);router[_0xcfe3('0x19')](_0xcfe3('0x18'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x23')]);router[_0xcfe3('0x24')](_0xcfe3('0xe'),auth['isAuthenticated'](),controller[_0xcfe3('0x25')]);router[_0xcfe3('0x26')]('/:id',auth['isAuthenticated'](),controller[_0xcfe3('0x27')]);router[_0xcfe3('0x26')](_0xcfe3('0x10'),auth[_0xcfe3('0xd')](),controller['removeDispositions']);router[_0xcfe3('0x26')](_0xcfe3('0x28'),auth[_0xcfe3('0xd')](),controller[_0xcfe3('0x29')]);router[_0xcfe3('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0xcfe3('0x2a')]);module[_0xcfe3('0x2b')]=router; \ No newline at end of file +var _0x6a69=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','delete','removeAnswers','removeAgents','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a69,0x17f));var _0x96a6=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x6a69[_0x3da832];return _0xe602f2;};'use strict';var multer=require(_0x96a6('0x0'));var util=require(_0x96a6('0x1'));var path=require(_0x96a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x96a6('0x3'));var router=express['Router']();var auth=require(_0x96a6('0x4'));var interaction=require(_0x96a6('0x5'));var config=require(_0x96a6('0x6'));var controller=require('./faxAccount.controller');router[_0x96a6('0x7')]('/',auth[_0x96a6('0x8')](),controller[_0x96a6('0x9')]);router[_0x96a6('0x7')]('/describe',auth[_0x96a6('0x8')](),controller[_0x96a6('0xa')]);router[_0x96a6('0x7')](_0x96a6('0xb'),auth[_0x96a6('0x8')](),controller[_0x96a6('0xc')]);router[_0x96a6('0x7')]('/:id/dispositions',auth[_0x96a6('0x8')](),controller['getDispositions']);router[_0x96a6('0x7')](_0x96a6('0xd'),auth[_0x96a6('0x8')](),controller[_0x96a6('0xe')]);router[_0x96a6('0x7')]('/:id/interactions',auth[_0x96a6('0x8')](),controller[_0x96a6('0xf')]);router[_0x96a6('0x7')](_0x96a6('0x10'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x11')]);router[_0x96a6('0x7')](_0x96a6('0x12'),auth[_0x96a6('0x8')](),controller['getMessages']);router[_0x96a6('0x7')](_0x96a6('0x13'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x14')]);router[_0x96a6('0x15')]('/',auth['isAuthenticated'](),controller[_0x96a6('0x16')]);router[_0x96a6('0x15')](_0x96a6('0x17'),auth['isAuthenticated'](),controller[_0x96a6('0x18')]);router[_0x96a6('0x15')](_0x96a6('0xd'),auth[_0x96a6('0x8')](),controller['addAnswer']);router[_0x96a6('0x15')]('/:id/interactions',auth[_0x96a6('0x8')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x96a6('0x19')]);router[_0x96a6('0x15')]('/addaccountapplications',auth[_0x96a6('0x8')](),controller['addAccountApplications']);router['post'](_0x96a6('0x1a'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x1b')]);router['post']('/:id/send',auth[_0x96a6('0x8')](),controller['send']);router['post']('/:id/users',auth[_0x96a6('0x8')](),controller[_0x96a6('0x1c')]);router[_0x96a6('0x1d')](_0x96a6('0xb'),auth[_0x96a6('0x8')](),controller[_0x96a6('0x1e')]);router[_0x96a6('0x1f')]('/:id',auth[_0x96a6('0x8')](),controller['destroy']);router[_0x96a6('0x1f')](_0x96a6('0x17'),auth[_0x96a6('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x96a6('0x8')](),controller[_0x96a6('0x20')]);router[_0x96a6('0x1f')]('/:id/users',auth[_0x96a6('0x8')](),controller[_0x96a6('0x21')]);module[_0x96a6('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6d80060..0847059 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 _0x6636=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x6636,0x119));var _0x6663=function(_0x5444c4,_0x123c56){_0x5444c4=_0x5444c4-0x0;var _0x371206=_0x6636[_0x5444c4];return _0x371206;};'use strict';var Sequelize=require(_0x6663('0x0'));module[_0x6663('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':_0x6663('0x3')},'appdata':{'type':Sequelize[_0x6663('0x4')]()},'description':{'type':Sequelize[_0x6663('0x2')]},'interval':{'type':Sequelize[_0x6663('0x2')],'defaultValue':_0x6663('0x5')}}; \ No newline at end of file +var _0x9d76=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0x9d76,0x76));var _0x69d7=function(_0x19335c,_0x2eeaba){_0x19335c=_0x19335c-0x0;var _0x107875=_0x9d76[_0x19335c];return _0x107875;};'use strict';var Sequelize=require(_0x69d7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x69d7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x69d7('0x2')],'allowNull':![],'defaultValue':_0x69d7('0x3')},'appdata':{'type':Sequelize[_0x69d7('0x4')]()},'description':{'type':Sequelize[_0x69d7('0x2')]},'interval':{'type':Sequelize[_0x69d7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index cda9dc3..ba0754d 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 _0x1261=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','update','find','destroy','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','key','map','query','intersection'];(function(_0x547d24,_0x21514a){var _0x49b3ab=function(_0x2ac36d){while(--_0x2ac36d){_0x547d24['push'](_0x547d24['shift']());}};_0x49b3ab(++_0x21514a);}(_0x1261,0x144));var _0x1126=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x1261[_0x2134b7];return _0x6c5914;};'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'];function respondWithStatusCode(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xcc;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x17')](_0xd26a32);}return _0x1b364a[_0x1126('0x18')](_0xd26a32)[_0x1126('0x19')]();};}function respondWithResult(_0x2048ad,_0x43850b){_0x43850b=_0x43850b||0xc8;return function(_0x53a8f0){if(_0x53a8f0){return _0x2048ad['status'](_0x43850b)[_0x1126('0x1a')](_0x53a8f0);}};}function respondWithFilteredResult(_0x154e20,_0x279455){return function(_0x4be0c6){if(_0x4be0c6){var _0x45149c=_0x4be0c6[_0x1126('0x1b')],_0x4794a7=_0x279455['offset'],_0x35fe9f=_0x279455[_0x1126('0x1c')]+_0x279455[_0x1126('0x1d')],_0x42f379;if(_0x35fe9f>=_0x45149c){_0x35fe9f=_0x45149c;_0x42f379=0xc8;}else{_0x42f379=0xce;}_0x154e20['status'](_0x42f379);return _0x154e20['set'](_0x1126('0x1e'),_0x4794a7+'-'+_0x35fe9f+'/'+_0x45149c)[_0x1126('0x1a')](_0x4be0c6);}return null;};}function patchUpdates(_0x58d11a){return function(_0x548359){try{jsonpatch[_0x1126('0x1f')](_0x548359,_0x58d11a,!![]);}catch(_0x58b109){return BPromise[_0x1126('0x20')](_0x58b109);}return _0x548359[_0x1126('0x21')]();};}function saveUpdates(_0x2f70ac,_0x54400a){return function(_0x2a08ba){if(_0x2a08ba){return _0x2a08ba['update'](_0x2f70ac)['then'](function(_0x30f6b3){return _0x30f6b3;});}return null;};}function removeEntity(_0x3a9bed,_0x25b24b){return function(_0x36d254){if(_0x36d254){return _0x36d254['destroy']()[_0x1126('0x22')](function(){_0x3a9bed[_0x1126('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(!_0x529dd9){_0x2175fa['sendStatus'](0x194);}return _0x529dd9;};}function handleError(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0x1f4;return function(_0x329914){logger[_0x1126('0x23')](_0x329914[_0x1126('0x24')]);if(_0x329914[_0x1126('0x25')]){delete _0x329914[_0x1126('0x25')];}_0x2199d9[_0x1126('0x18')](_0x15bcc3)['send'](_0x329914);};}exports[_0x1126('0x26')]=function(_0x375e59,_0xa293f4){var _0x5ddf63={},_0x541bc9={},_0xeb7d89={'count':0x0,'rows':[]};var _0x39bf0e=_['map'](db[_0x1126('0x27')][_0x1126('0x28')],function(_0x4a334a){return{'name':_0x4a334a[_0x1126('0x29')],'type':_0x4a334a['type'][_0x1126('0x2a')]};});_0x541bc9['model']=_[_0x1126('0x2b')](_0x39bf0e,'name');_0x541bc9[_0x1126('0x2c')]=_['keys'](_0x375e59['query']);_0x541bc9['filters']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],_0x541bc9[_0x1126('0x2c')]);_0x5ddf63['attributes']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],qs['fields'](_0x375e59[_0x1126('0x2c')][_0x1126('0x2f')]));_0x5ddf63[_0x1126('0x30')]=_0x5ddf63[_0x1126('0x30')]['length']?_0x5ddf63['attributes']:_0x541bc9[_0x1126('0x2e')];if(!_0x375e59[_0x1126('0x2c')][_0x1126('0x31')](_0x1126('0x32'))){_0x5ddf63['limit']=qs[_0x1126('0x1d')](_0x375e59[_0x1126('0x2c')][_0x1126('0x1d')]);_0x5ddf63[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x375e59['query'][_0x1126('0x1c')]);}_0x5ddf63[_0x1126('0x33')]=qs[_0x1126('0x34')](_0x375e59[_0x1126('0x2c')]['sort']);_0x5ddf63['where']=qs[_0x1126('0x35')](_[_0x1126('0x36')](_0x375e59['query'],_0x541bc9[_0x1126('0x35')]),_0x39bf0e);if(_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]){_0x5ddf63['where']=_['merge'](_0x5ddf63[_0x1126('0x38')],{'$or':_[_0x1126('0x2b')](_0x39bf0e,function(_0x3aa08f){if(_0x3aa08f[_0x1126('0x39')]!=='VIRTUAL'){var _0x428d3d={};_0x428d3d[_0x3aa08f['name']]={'$like':'%'+_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]+'%'};return _0x428d3d;}})});}_0x5ddf63=_[_0x1126('0x3a')]({},_0x5ddf63,_0x375e59[_0x1126('0x3b')]);var _0x57e5d2={'where':_0x5ddf63['where']};return db[_0x1126('0x27')][_0x1126('0x1b')](_0x57e5d2)[_0x1126('0x22')](function(_0x397e3b){_0xeb7d89[_0x1126('0x1b')]=_0x397e3b;if(_0x375e59[_0x1126('0x2c')][_0x1126('0x3c')]){_0x5ddf63['include']=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x3d')](_0x5ddf63);})[_0x1126('0x22')](function(_0xf3a0bd){_0xeb7d89[_0x1126('0x3e')]=_0xf3a0bd;return _0xeb7d89;})['then'](respondWithFilteredResult(_0xa293f4,_0x5ddf63))['catch'](handleError(_0xa293f4,null));};exports[_0x1126('0x3f')]=function(_0x219bcc,_0xcee9de){var _0x21c38e={'raw':!![],'where':{'id':_0x219bcc[_0x1126('0x40')]['id']}},_0x18b496={};_0x18b496['model']=_['keys'](db['FaxApplication'][_0x1126('0x28')]);_0x18b496['query']=_[_0x1126('0x41')](_0x219bcc[_0x1126('0x2c')]);_0x18b496[_0x1126('0x35')]=_[_0x1126('0x2d')](_0x18b496['model'],_0x18b496['query']);_0x21c38e[_0x1126('0x30')]=_[_0x1126('0x2d')](_0x18b496[_0x1126('0x2e')],qs['fields'](_0x219bcc[_0x1126('0x2c')]['fields']));_0x21c38e[_0x1126('0x30')]=_0x21c38e['attributes'][_0x1126('0x42')]?_0x21c38e[_0x1126('0x30')]:_0x18b496[_0x1126('0x2e')];if(_0x219bcc['query'][_0x1126('0x3c')]){_0x21c38e[_0x1126('0x43')]=[{'all':!![]}];}_0x21c38e=_[_0x1126('0x3a')]({},_0x21c38e,_0x219bcc['options']);return db['FaxApplication']['find'](_0x21c38e)[_0x1126('0x22')](handleEntityNotFound(_0xcee9de,null))['then'](respondWithResult(_0xcee9de,null))[_0x1126('0x44')](handleError(_0xcee9de,null));};exports['create']=function(_0x2f45b9,_0x323499){return db[_0x1126('0x27')][_0x1126('0x45')](_0x2f45b9[_0x1126('0x46')],{})['then'](respondWithResult(_0x323499,0xc9))[_0x1126('0x44')](handleError(_0x323499,null));};exports[_0x1126('0x47')]=function(_0x5111d3,_0x1a15f8){if(_0x5111d3[_0x1126('0x46')]['id']){delete _0x5111d3['body']['id'];}return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x5111d3['params']['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x1a15f8,null))[_0x1126('0x22')](saveUpdates(_0x5111d3[_0x1126('0x46')],null))['then'](respondWithResult(_0x1a15f8,null))[_0x1126('0x44')](handleError(_0x1a15f8,null));};exports[_0x1126('0x49')]=function(_0x411c89,_0x5878bb){return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x411c89[_0x1126('0x40')]['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x5878bb,null))['then'](removeEntity(_0x5878bb,null))[_0x1126('0x44')](handleError(_0x5878bb,null));}; \ No newline at end of file +var _0xabce=['offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','FaxApplication','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xabce,0x103));var _0xeabc=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xabce[_0x1eda20];return _0x31b953;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['FaxApplication'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['FaxApplication'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':!![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index dda1fc8..0374f71 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 _0xfae0=['request-promise','rimraf','../../config/environment','define','fax_applications','lodash','util','api','moment','bluebird'];(function(_0x103d9d,_0x454dea){var _0x13bd9c=function(_0x227761){while(--_0x227761){_0x103d9d['push'](_0x103d9d['shift']());}};_0x13bd9c(++_0x454dea);}(_0xfae0,0x19f));var _0x0fae=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0xfae0[_0x1433df];return _0x49fade;};'use strict';var _=require(_0x0fae('0x0'));var util=require(_0x0fae('0x1'));var logger=require('../../config/logger')(_0x0fae('0x2'));var moment=require(_0x0fae('0x3'));var BPromise=require(_0x0fae('0x4'));var rp=require(_0x0fae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fae('0x6'));var config=require(_0x0fae('0x7'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x41a1f1,_0x25d67f){return _0x41a1f1[_0x0fae('0x8')]('FaxApplication',attributes,{'tableName':_0x0fae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x788f=['define','FaxApplication','fax_applications','utf8mb4','lodash','util','api','moment','path','rimraf','./faxApplication.attributes','exports'];(function(_0x420a7c,_0x3ef0bc){var _0x311c52=function(_0x217b82){while(--_0x217b82){_0x420a7c['push'](_0x420a7c['shift']());}};_0x311c52(++_0x3ef0bc);}(_0x788f,0x19c));var _0xf788=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x788f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf788('0x0'));var util=require(_0xf788('0x1'));var logger=require('../../config/logger')(_0xf788('0x2'));var moment=require(_0xf788('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf788('0x4'));var rimraf=require(_0xf788('0x5'));var config=require('../../config/environment');var attributes=require(_0xf788('0x6'));module[_0xf788('0x7')]=function(_0x37937f,_0x437ad){return _0x37937f[_0xf788('0x8')](_0xf788('0x9'),attributes,{'tableName':_0xf788('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf788('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f2b4324..e7415d1 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 _0xc67a=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw','where','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2bd280,_0x312b76){var _0x807559=function(_0x31ecda){while(--_0x31ecda){_0x2bd280['push'](_0x2bd280['shift']());}};_0x807559(++_0x312b76);}(_0xc67a,0x122));var _0xac67=function(_0x4c3bcf,_0x5c02aa){_0x4c3bcf=_0x4c3bcf-0x0;var _0xdfe560=_0xc67a[_0x4c3bcf];return _0xdfe560;};'use strict';var _=require(_0xac67('0x0'));var util=require(_0xac67('0x1'));var moment=require(_0xac67('0x2'));var BPromise=require(_0xac67('0x3'));var rs=require(_0xac67('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac67('0x5'));var logger=require(_0xac67('0x6'))(_0xac67('0x7'));var config=require(_0xac67('0x8'));var jayson=require(_0xac67('0x9'));var client=jayson[_0xac67('0xa')][_0xac67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaa9f6a,_0x20c7ca,_0x19e380){return new BPromise(function(_0x967db2,_0x37e83d){return client[_0xac67('0xc')](_0xaa9f6a,_0x19e380)[_0xac67('0xd')](function(_0x5c615a){logger[_0xac67('0xe')](_0xac67('0xf'),_0x20c7ca,_0xac67('0x10'));logger[_0xac67('0x11')](_0xac67('0x12'),_0x20c7ca,'request\x20sent',JSON[_0xac67('0x13')](_0x5c615a));if(_0x5c615a[_0xac67('0x14')]){if(_0x5c615a[_0xac67('0x14')][_0xac67('0x15')]===0x1f4){logger[_0xac67('0x14')](_0xac67('0xf'),_0x20c7ca,_0x5c615a[_0xac67('0x14')]['message']);return _0x37e83d(_0x5c615a[_0xac67('0x14')][_0xac67('0x16')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x20c7ca,_0x5c615a[_0xac67('0x14')]['message']);return _0x967db2(_0x5c615a[_0xac67('0x14')][_0xac67('0x16')]);}else{logger[_0xac67('0xe')](_0xac67('0xf'),_0x20c7ca,_0xac67('0x10'));_0x967db2(_0x5c615a[_0xac67('0x17')][_0xac67('0x16')]);}})[_0xac67('0x18')](function(_0x347553){logger[_0xac67('0x14')](_0xac67('0xf'),_0x20c7ca,_0x347553);_0x37e83d(_0x347553);});});}exports['UpdateFaxApplication']=function(_0x1b4329){var _0x147e6e=this;return new Promise(function(_0x1f7e2f,_0x40783a){return db[_0xac67('0x19')][_0xac67('0x1a')](_0x1b4329[_0xac67('0x1b')],{'raw':_0x1b4329[_0xac67('0x1c')]?_0x1b4329['options'][_0xac67('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4329['options']?_0x1b4329[_0xac67('0x1c')][_0xac67('0x1e')]||null:null,'attributes':_0x1b4329[_0xac67('0x1c')]?_0x1b4329['options']['attributes']||null:null,'limit':_0x1b4329[_0xac67('0x1c')]?_0x1b4329[_0xac67('0x1c')][_0xac67('0x1f')]||null:null})[_0xac67('0xd')](function(_0x58bfc9){logger[_0xac67('0xe')](_0xac67('0x20'),_0x1b4329);logger[_0xac67('0x11')](_0xac67('0x20'),_0x1b4329,JSON[_0xac67('0x13')](_0x58bfc9));_0x1f7e2f(_0x58bfc9);})[_0xac67('0x18')](function(_0x2aedf2){logger[_0xac67('0x14')](_0xac67('0x20'),_0x2aedf2['message'],_0x1b4329);_0x40783a(_0x147e6e[_0xac67('0x14')](0x1f4,_0x2aedf2[_0xac67('0x16')]));});});}; \ No newline at end of file +var _0x3156=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3156,0x19f));var _0x6315=function(_0x31218f,_0x3af9bf){_0x31218f=_0x31218f-0x0;var _0x1439c7=_0x3156[_0x31218f];return _0x1439c7;};'use strict';var _=require(_0x6315('0x0'));var util=require(_0x6315('0x1'));var moment=require(_0x6315('0x2'));var BPromise=require(_0x6315('0x3'));var rs=require(_0x6315('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6315('0x5'))['db'];var utils=require(_0x6315('0x6'));var logger=require(_0x6315('0x7'))(_0x6315('0x8'));var config=require('../../config/environment');var jayson=require(_0x6315('0x9'));var client=jayson[_0x6315('0xa')][_0x6315('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47dc63,_0x59e15e,_0x59a0d6){return new BPromise(function(_0x3e11ce,_0x434dd3){return client[_0x6315('0xc')](_0x47dc63,_0x59a0d6)[_0x6315('0xd')](function(_0x5ce2b5){logger[_0x6315('0xe')](_0x6315('0xf'),_0x59e15e,_0x6315('0x10'));logger[_0x6315('0x11')](_0x6315('0x12'),_0x59e15e,_0x6315('0x10'),JSON['stringify'](_0x5ce2b5));if(_0x5ce2b5[_0x6315('0x13')]){if(_0x5ce2b5[_0x6315('0x13')][_0x6315('0x14')]===0x1f4){logger[_0x6315('0x13')](_0x6315('0xf'),_0x59e15e,_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);return _0x434dd3(_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);}logger[_0x6315('0x13')](_0x6315('0xf'),_0x59e15e,_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);return _0x3e11ce(_0x5ce2b5[_0x6315('0x13')][_0x6315('0x15')]);}else{logger[_0x6315('0xe')](_0x6315('0xf'),_0x59e15e,'request\x20sent');_0x3e11ce(_0x5ce2b5[_0x6315('0x16')][_0x6315('0x15')]);}})[_0x6315('0x17')](function(_0x2e92ed){logger[_0x6315('0x13')](_0x6315('0xf'),_0x59e15e,_0x2e92ed);_0x434dd3(_0x2e92ed);});});}exports[_0x6315('0x18')]=function(_0x2ee69b){var _0x6c79f0=this;return new Promise(function(_0x5f5266,_0x5d2dc2){return db[_0x6315('0x19')][_0x6315('0x1a')](_0x2ee69b[_0x6315('0x1b')],{'raw':_0x2ee69b[_0x6315('0x1c')]?_0x2ee69b[_0x6315('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee69b[_0x6315('0x1c')]?_0x2ee69b[_0x6315('0x1c')][_0x6315('0x1d')]||null:null,'attributes':_0x2ee69b['options']?_0x2ee69b[_0x6315('0x1c')][_0x6315('0x1e')]||null:null,'limit':_0x2ee69b[_0x6315('0x1c')]?_0x2ee69b['options'][_0x6315('0x1f')]||null:null})[_0x6315('0xd')](function(_0x4e9919){logger[_0x6315('0xe')](_0x6315('0x18'),_0x2ee69b);logger[_0x6315('0x11')](_0x6315('0x18'),_0x2ee69b,JSON[_0x6315('0x20')](_0x4e9919));_0x5f5266(_0x4e9919);})[_0x6315('0x17')](function(_0x33b4d3){logger[_0x6315('0x13')]('UpdateFaxApplication',_0x33b4d3['message'],_0x2ee69b);_0x5d2dc2(_0x6c79f0['error'](0x1f4,_0x33b4d3[_0x6315('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7cec849..9db3482 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 _0xabce=['post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','show'];(function(_0x52e251,_0x3b6303){var _0x5eee63=function(_0xf1cd77){while(--_0xf1cd77){_0x52e251['push'](_0x52e251['shift']());}};_0x5eee63(++_0x3b6303);}(_0xabce,0x103));var _0xeabc=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xabce[_0x53cf8e];return _0x459197;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeabc('0x8')]);router['get'](_0xeabc('0x9'),auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')]('/',auth[_0xeabc('0xc')](),controller['create']);router[_0xeabc('0xd')](_0xeabc('0x9'),auth[_0xeabc('0xc')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0x9'),auth[_0xeabc('0xc')](),controller[_0xeabc('0x10')]);module[_0xeabc('0x11')]=router; \ No newline at end of file +var _0xf494=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0xccd514,_0x5b927d){var _0x343b73=function(_0x4f3711){while(--_0x4f3711){_0xccd514['push'](_0xccd514['shift']());}};_0x343b73(++_0x5b927d);}(_0xf494,0x1c6));var _0x4f49=function(_0x479457,_0x37d45a){_0x479457=_0x479457-0x0;var _0x115ed8=_0xf494[_0x479457];return _0x115ed8;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0xd')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xc'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1008b0e..cf730aa 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 _0x6955=['out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x570ac2,_0x4dd57d){var _0x36b004=function(_0x25f2c8){while(--_0x25f2c8){_0x570ac2['push'](_0x570ac2['shift']());}};_0x36b004(++_0x4dd57d);}(_0x6955,0x128));var _0x5695=function(_0x1089e0,_0x89a7f3){_0x1089e0=_0x1089e0-0x0;var _0xc2421e=_0x6955[_0x1089e0];return _0xc2421e;};'use strict';var Sequelize=require(_0x5695('0x0'));module['exports']={'closed':{'type':Sequelize[_0x5695('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5695('0x2')]},'disposition':{'type':Sequelize[_0x5695('0x3')]},'note':{'type':Sequelize[_0x5695('0x3')]},'read1stAt':{'type':Sequelize[_0x5695('0x2')]},'fax':{'type':Sequelize[_0x5695('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5695('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5695('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5695('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6573=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x47f20d,_0x1099b4){var _0x41b61c=function(_0x3cd19c){while(--_0x3cd19c){_0x47f20d['push'](_0x47f20d['shift']());}};_0x41b61c(++_0x1099b4);}(_0x6573,0xce));var _0x3657=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6573[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3657('0x0')]={'closed':{'type':Sequelize[_0x3657('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3657('0x2')]},'disposition':{'type':Sequelize[_0x3657('0x3')]},'note':{'type':Sequelize[_0x3657('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x3657('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3657('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3657('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3657('0x4')]('in',_0x3657('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index af4a797..de2cc85 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 _0xb10d=['key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','where','filters','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','forEach','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','unreadMessages','a.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','include','options','create','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','nolimit','sort','pick','format','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createWriteStream','err','unlinkSync','html-pdf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','FaxInteraction','rawAttributes','fieldName','type'];(function(_0x55c193,_0x3dc41a){var _0x56f621=function(_0xb184fb){while(--_0xb184fb){_0x55c193['push'](_0x55c193['shift']());}};_0x56f621(++_0x3dc41a);}(_0xb10d,0x17f));var _0xdb10=function(_0x5b97dc,_0x40d43e){_0x5b97dc=_0x5b97dc-0x0;var _0x44d434=_0xb10d[_0x5b97dc];return _0x44d434;};'use strict';var pdf=require(_0xdb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb10('0x1'));var zipdir=require(_0xdb10('0x2'));var jsonpatch=require(_0xdb10('0x3'));var rp=require(_0xdb10('0x4'));var moment=require(_0xdb10('0x5'));var BPromise=require(_0xdb10('0x6'));var Mustache=require(_0xdb10('0x7'));var util=require(_0xdb10('0x8'));var path=require(_0xdb10('0x9'));var sox=require(_0xdb10('0xa'));var csv=require(_0xdb10('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb10('0xc'));var squel=require(_0xdb10('0xd'));var crypto=require(_0xdb10('0xe'));var jsforce=require(_0xdb10('0xf'));var deskjs=require(_0xdb10('0x10'));var toCsv=require(_0xdb10('0xb'));var querystring=require(_0xdb10('0x11'));var Papa=require(_0xdb10('0x12'));var Redis=require(_0xdb10('0x13'));var authService=require(_0xdb10('0x14'));var qs=require(_0xdb10('0x15'));var as=require(_0xdb10('0x16'));var hardwareService=require(_0xdb10('0x17'));var logger=require(_0xdb10('0x18'))(_0xdb10('0x19'));var utils=require(_0xdb10('0x1a'));var config=require(_0xdb10('0x1b'));var db=require(_0xdb10('0x1c'))['db'];config[_0xdb10('0x1d')]=_[_0xdb10('0x1e')](config[_0xdb10('0x1d')],{'host':_0xdb10('0x1f'),'port':0x18eb});var socket=require(_0xdb10('0x20'))(new Redis(config[_0xdb10('0x1d')]));require('./faxInteraction.socket')[_0xdb10('0x21')](socket);function respondWithStatusCode(_0x1daa95,_0xf8cc1){_0xf8cc1=_0xf8cc1||0xcc;return function(_0x3efe0e){if(_0x3efe0e){return _0x1daa95[_0xdb10('0x22')](_0xf8cc1);}return _0x1daa95[_0xdb10('0x23')](_0xf8cc1)['end']();};}function respondWithResult(_0x161e0d,_0x21393b){_0x21393b=_0x21393b||0xc8;return function(_0x506de3){if(_0x506de3){return _0x161e0d[_0xdb10('0x23')](_0x21393b)[_0xdb10('0x24')](_0x506de3);}};}function respondWithFilteredResult(_0x5b484e,_0xe826ef){return function(_0x52ccdd){if(_0x52ccdd){var _0xbf36da=_0x52ccdd[_0xdb10('0x25')],_0x4964aa=_0xe826ef[_0xdb10('0x26')],_0x3b9f45=_0xe826ef['offset']+_0xe826ef[_0xdb10('0x27')],_0xe1d26e;if(_0x3b9f45>=_0xbf36da){_0x3b9f45=_0xbf36da;_0xe1d26e=0xc8;}else{_0xe1d26e=0xce;}_0x5b484e[_0xdb10('0x23')](_0xe1d26e);return _0x5b484e[_0xdb10('0x28')](_0xdb10('0x29'),_0x4964aa+'-'+_0x3b9f45+'/'+_0xbf36da)['json'](_0x52ccdd);}return null;};}function patchUpdates(_0xcb38eb){return function(_0x138afd){try{jsonpatch[_0xdb10('0x2a')](_0x138afd,_0xcb38eb,!![]);}catch(_0xda224e){return BPromise[_0xdb10('0x2b')](_0xda224e);}return _0x138afd[_0xdb10('0x2c')]();};}function saveUpdates(_0x145497,_0x30baba){return function(_0x8d5fb4){if(_0x8d5fb4){return _0x8d5fb4['update'](_0x145497)[_0xdb10('0x2d')](function(_0x148f2b){return _0x148f2b;});}return null;};}function removeEntity(_0x5ba42a,_0x249e94){return function(_0x7e43d){if(_0x7e43d){return _0x7e43d[_0xdb10('0x2e')]()[_0xdb10('0x2d')](function(){_0x5ba42a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc65e60,_0x53e626){return function(_0x2d67aa){if(!_0x2d67aa){_0xc65e60[_0xdb10('0x22')](0x194);}return _0x2d67aa;};}function handleError(_0x39116e,_0x4db7ba){_0x4db7ba=_0x4db7ba||0x1f4;return function(_0xea9ba7){logger[_0xdb10('0x2f')](_0xea9ba7[_0xdb10('0x30')]);if(_0xea9ba7[_0xdb10('0x31')]){delete _0xea9ba7[_0xdb10('0x31')];}_0x39116e[_0xdb10('0x23')](_0x4db7ba)[_0xdb10('0x32')](_0xea9ba7);};}function getInteractionUsers(_0x2a9ecd,_0xa48d52){return new BPromise(function(_0x42ef28,_0x3627ae){try{if(_0xa48d52[_0x2a9ecd['id']]){_0x2a9ecd[_0xdb10('0x33')]=_[_0xdb10('0x34')](_0xa48d52[_0x2a9ecd['id']],function(_0x413af0){return{'id':_0x413af0['id'],'fullname':_0x413af0[_0xdb10('0x35')]};});}}catch(_0xfa535a){_0x3627ae(_0xfa535a);}_0x42ef28(_0x2a9ecd);});}function getInteractionTags(_0x4a68a9,_0x176a92){return new BPromise(function(_0x162f07,_0x29ad5a){try{if(_0x4a68a9[_0xdb10('0x36')]){_0x4a68a9[_0xdb10('0x37')]=[];_0x4a68a9[_0xdb10('0x36')][_0xdb10('0x38')](',')['forEach'](function(_0x1b2d93){_0x4a68a9[_0xdb10('0x37')][_0xdb10('0x39')](_0x176a92[_0x1b2d93]);});}delete _0x4a68a9['TagIds'];}catch(_0x5bb47f){_0x29ad5a(_0x5bb47f);}_0x162f07(_0x4a68a9);});}function updateFaxInteraction(_0x4d8224,_0x47a08f,_0x3891ea){return new BPromise(function(_0x20995d,_0x5aa891){return getInteractionUsers(_0x4d8224,_0x3891ea)['then'](function(_0x510be0){return getInteractionTags(_0x510be0,_0x47a08f);})[_0xdb10('0x2d')](function(_0x5bb6de){_0x20995d(_0x5bb6de);})[_0xdb10('0x3a')](function(_0x391021){_0x5aa891(_0x391021);});});}exports['index']=function(_0x1efbf0,_0x31de80){var _0x25391d={},_0x59b8f4={},_0x22fdde={'count':0x0,'rows':[]};var _0xc399ab=_[_0xdb10('0x34')](db[_0xdb10('0x3b')][_0xdb10('0x3c')],function(_0xef31d4){return{'name':_0xef31d4[_0xdb10('0x3d')],'type':_0xef31d4[_0xdb10('0x3e')][_0xdb10('0x3f')]};});_0x59b8f4[_0xdb10('0x40')]=_[_0xdb10('0x34')](_0xc399ab,_0xdb10('0x31'));_0x59b8f4[_0xdb10('0x41')]=_[_0xdb10('0x42')](_0x1efbf0['query']);_0x59b8f4['filters']=_[_0xdb10('0x43')](_0x59b8f4[_0xdb10('0x40')],_0x59b8f4[_0xdb10('0x41')]);_0x25391d[_0xdb10('0x44')]=_[_0xdb10('0x43')](_0x59b8f4[_0xdb10('0x40')],qs[_0xdb10('0x45')](_0x1efbf0['query']['fields']));_0x25391d[_0xdb10('0x44')]=_0x25391d['attributes']['length']?_0x25391d['attributes']:_0x59b8f4[_0xdb10('0x40')];if(!_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x46')]('nolimit')){_0x25391d[_0xdb10('0x27')]=qs[_0xdb10('0x27')](_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x27')]);_0x25391d[_0xdb10('0x26')]=qs[_0xdb10('0x26')](_0x1efbf0['query'][_0xdb10('0x26')]);}_0x25391d[_0xdb10('0x47')]=qs['sort'](_0x1efbf0[_0xdb10('0x41')]['sort']);_0x25391d[_0xdb10('0x48')]=qs['filters'](_['pick'](_0x1efbf0[_0xdb10('0x41')],_0x59b8f4[_0xdb10('0x49')]),_0xc399ab);var _0x7009e1=[];var _0x477391=squel[_0xdb10('0x4a')]()[_0xdb10('0x4b')]('id')[_0xdb10('0x4b')](_0xdb10('0x31'))[_0xdb10('0x4b')]('color')['from'](_0xdb10('0x4c'));var _0x5c88b2=squel[_0xdb10('0x4a')]()[_0xdb10('0x4b')](_0xdb10('0x4d'))['field'](_0xdb10('0x4e'))[_0xdb10('0x4b')](_0xdb10('0x4f'))[_0xdb10('0x50')](_0xdb10('0x51'),'ui')[_0xdb10('0x52')](_0xdb10('0x53'),'u',_0xdb10('0x54'));var _0x3fcb18=squel[_0xdb10('0x4a')]()[_0xdb10('0x50')](_0xdb10('0x55'),'i')['left_join'](_0xdb10('0x56'),'c',_0xdb10('0x57'))[_0xdb10('0x52')]('users','o',_0xdb10('0x58'))[_0xdb10('0x52')](_0xdb10('0x59'),'a',_0xdb10('0x5a'))[_0xdb10('0x52')](_0xdb10('0x5b'),'me',_0xdb10('0x5c'))['left_join']('fax_interaction_has_tags','it',_0xdb10('0x5d'))[_0xdb10('0x52')](_0xdb10('0x4c'),'t',_0xdb10('0x5e'));var _0x3b2bc9=squel[_0xdb10('0x5f')]();var _0xf2392a=[];var _0x398669=squel[_0xdb10('0x5f')]();var _0x17dfaa;if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x60')]){_0x17dfaa=as[_0xdb10('0x61')](_0x1efbf0['query']['search']);var _0x31c899=_0x17dfaa[_0xdb10('0x62')];for(var _0x312717=0x0;_0x312717<_0x17dfaa[_0xdb10('0x63')][_0xdb10('0x64')];_0x312717++){var _0x12bd00=_0x17dfaa['conditions'][_0x312717];var _0x4ff1b1='i';var _0x51aa5b=_[_0xdb10('0x65')](_0xc399ab,[_0xdb10('0x31'),_0x12bd00[_0xdb10('0x4b')]]);if(!_0x51aa5b){switch(_0x12bd00[_0xdb10('0x4b')]){case'unreadMessages':if(_0x12bd00['value']==0x1){_0x3fcb18['having']('`'+_0x12bd00[_0xdb10('0x4b')]+_0xdb10('0x66'));}else{_0x3fcb18['having']('`'+_0x12bd00['field']+'`\x20>\x200');}break;case _0xdb10('0x67'):if(_0x12bd00[_0xdb10('0x68')]===_0xdb10('0x69')){if(_0x12bd00['value']['split']('\x20')[_0xdb10('0x64')]>0x1){_0x3b2bc9[_0x31c899](_0xdb10('0x6a'),qs[_0xdb10('0x6b')](_0x12bd00[_0xdb10('0x6c')]),null);}else{var _0x2f2b6f='%'+_0x12bd00['value']+'%';_0x3b2bc9[_0x31c899](_0xdb10('0x6d'),_0x2f2b6f,_0x2f2b6f,_0x2f2b6f);}}else{_0x51aa5b=_['find'](_0xc399ab,[_0xdb10('0x31'),_0xdb10('0x6e')]);_0x12bd00['field']=_0xdb10('0x6e');_0x46bdc4=as[_0xdb10('0x6f')](_0x4ff1b1,_0x51aa5b['type'],_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x71')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x72')]);}break;case _0xdb10('0x73'):var _0x55ed89=_0x12bd00['value']['split'](',')[_0xdb10('0x34')](function(_0x48a08b){return Number(_0x48a08b);});_0x55ed89[_0xdb10('0x74')](function(_0x1a7d29){_0x398669['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1a7d29+',%');});_0xf2392a=_['union'](_0xf2392a,_0x55ed89);break;case _0xdb10('0x75'):if(_0x12bd00[_0xdb10('0x68')]===_0xdb10('0x69')){_0x3b2bc9[_0x31c899](_0xdb10('0x76'),'%'+_0x12bd00['value']+'%',null);}else{_0x51aa5b=_[_0xdb10('0x65')](_0xc399ab,[_0xdb10('0x31'),_0xdb10('0x77')]);_0x12bd00[_0xdb10('0x4b')]=_0xdb10('0x77');_0x46bdc4=as[_0xdb10('0x6f')](_0x4ff1b1,_0x51aa5b[_0xdb10('0x3e')],_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x71')],_0x46bdc4['value'][_0xdb10('0x72')]);}break;case _0xdb10('0x78'):_0x46bdc4=as[_0xdb10('0x6f')]('me',null,_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4['value'][_0xdb10('0x71')],_0x46bdc4['value'][_0xdb10('0x72')]);break;}}else{var _0x46bdc4=as[_0xdb10('0x6f')](_0x4ff1b1,_0x51aa5b['type'],_0x12bd00);_0x3b2bc9[_0x31c899](_0x46bdc4[_0xdb10('0x70')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x71')],_0x46bdc4[_0xdb10('0x6c')][_0xdb10('0x72')]);}}}else{var _0x299976=_(_0x1efbf0[_0xdb10('0x41')])[_0xdb10('0x42')]()[_0xdb10('0x34')](function(_0x4ad2f7){return _['some'](_0xc399ab,[_0xdb10('0x31'),_0x4ad2f7])?_0x4ad2f7:undefined;})[_0xdb10('0x79')]()[_0xdb10('0x6c')]();if(!_[_0xdb10('0x7a')](_0x299976)){_0x299976[_0xdb10('0x74')](function(_0x31933b){if(_0x31933b==='FaxAccountId'){_0x3fcb18[_0xdb10('0x48')](_0xdb10('0x7b'),[][_0xdb10('0x7c')](_0x1efbf0['query'][_0x31933b]));}else if(_0x31933b===_0xdb10('0x7d')){var _0x315e29=JSON[_0xdb10('0x7e')](_0x1efbf0[_0xdb10('0x41')][_0x31933b])[_0xdb10('0x7f')];var _0x35b25c=JSON[_0xdb10('0x7e')](_0x1efbf0[_0xdb10('0x41')][_0x31933b])['$lte'];_0x3fcb18[_0xdb10('0x48')](_0xdb10('0x80'),_0x315e29,_0x35b25c);}else{if(_0x1efbf0[_0xdb10('0x41')][_0x31933b]===_0xdb10('0x81')){_0x3fcb18[_0xdb10('0x48')]('i.'+_0x31933b+_0xdb10('0x82'));}else{_0x3fcb18[_0xdb10('0x48')]('i.'+_0x31933b+_0xdb10('0x83'),_0x1efbf0[_0xdb10('0x41')][_0x31933b]);}}});}if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x84')]){if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x84')]==0x1){_0x3fcb18[_0xdb10('0x85')](_0xdb10('0x86'));}else{_0x3fcb18[_0xdb10('0x85')](_0xdb10('0x87'));}}if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x88')]){_0xf2392a=_['isArray'](_0x1efbf0['query']['tag'])?_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x88')]:new Array(_0x1efbf0['query'][_0xdb10('0x88')]);_0xf2392a[_0xdb10('0x74')](function(_0x5936fa){_0x398669['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5936fa+',%');});}if(_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x89')]){var _0x4eab70=_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x89')]['replace']('\x5c','\x5c\x5c')[_0xdb10('0x8a')]('\x27\x27',_0xdb10('0x8b'));if(qs[_0xdb10('0x8c')](_0x4eab70)){_0x3b2bc9['or'](_0xdb10('0x8d'),_0x4eab70+'%')['or'](_0xdb10('0x8e'),_0x4eab70+'%');}_0x3b2bc9['or'](_0xdb10('0x8f'),_0x4eab70+'%');}}_0x3fcb18[_0xdb10('0x48')](_0x3b2bc9);_0x3fcb18[_0xdb10('0x90')](_0xdb10('0x91'));var _0x2da03b={'type':db['Sequelize']['QueryTypes'][_0xdb10('0x92')],'raw':!![]};var _0x215a58=_0x3fcb18[_0xdb10('0x93')]();_0x215a58['field']('i.id');_0x215a58[_0xdb10('0x4b')](_0xdb10('0x94'),'unreadMessages');if(_0x25391d[_0xdb10('0x47')]){_0x25391d[_0xdb10('0x47')][_0xdb10('0x74')](function(_0x3aec3c){_0x3fcb18[_0xdb10('0x47')]('i.'+_0x3aec3c[0x0],_0x3aec3c[0x1]===_0xdb10('0x95')?![]:!![]);});}if(!_[_0xdb10('0x7a')](_0xf2392a)){_0x3fcb18[_0xdb10('0x85')](_0x398669);_0x215a58['where'](_0xdb10('0x96'),_0xf2392a);}BPromise[_0xdb10('0x97')]()[_0xdb10('0x2d')](function(){if(!_0x17dfaa){if(_0x1efbf0['query'][_0xdb10('0x98')]||_0x1efbf0[_0xdb10('0x41')][_0xdb10('0x99')])return;_0x215a58[_0xdb10('0x48')](_0xdb10('0x9a'));_0x3fcb18['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x1efbf0[_0xdb10('0x9b')][_0xdb10('0x9c')]({'attributes':['id'],'raw':!![]})[_0xdb10('0x2d')](function(_0x31ae51){if(_[_0xdb10('0x7a')](_0x31ae51)){_0x215a58[_0xdb10('0x48')](_0xdb10('0x9d'));_0x3fcb18['where'](_0xdb10('0x9d'));}else{_0x215a58[_0xdb10('0x48')](_0xdb10('0x7b'),_[_0xdb10('0x34')](_0x31ae51,'id'));_0x3fcb18[_0xdb10('0x48')](_0xdb10('0x7b'),_[_0xdb10('0x34')](_0x31ae51,'id'));}});})[_0xdb10('0x2d')](function(){db[_0xdb10('0x9e')][_0xdb10('0x41')](_0x215a58[_0xdb10('0x9f')](),_0x2da03b)[_0xdb10('0x2d')](function(_0x4d6b9a){_0x22fdde[_0xdb10('0x25')]=_0x4d6b9a[_0xdb10('0x64')];if(_0x22fdde[_0xdb10('0x25')]===0x0)return[];return db[_0xdb10('0x9e')][_0xdb10('0x41')](_0x477391['toString'](),_0x2da03b)['then'](function(_0x366b54){_0x7009e1=_[_0xdb10('0xa0')](_0x366b54,'id');_0x2da03b=_[_0xdb10('0xa1')](_0x2da03b,{'model':db[_0xdb10('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1efbf0['query'][_0xdb10('0x45')]){_0x25391d[_0xdb10('0x44')][_0xdb10('0x74')](function(_0x138ec7){_0x3fcb18[_0xdb10('0x4b')]('i.'+_0x138ec7);});}else{_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0x94'),_0xdb10('0xa2'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa3'),'Account.key');_0x3fcb18['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa4'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa5'),_0xdb10('0xa6'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa7'),_0xdb10('0xa8'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xa9'),_0xdb10('0xaa'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xab'),_0xdb10('0xac'));_0x3fcb18[_0xdb10('0x4b')]('c.mobile',_0xdb10('0xad'));_0x3fcb18['field'](_0xdb10('0xae'),_0xdb10('0xaf'));_0x3fcb18[_0xdb10('0x4b')]('o.fullname',_0xdb10('0xb0'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xb1'),_0xdb10('0xb2'));_0x3fcb18[_0xdb10('0x4b')](_0xdb10('0xb3'),'TagIds');}if(_0x25391d[_0xdb10('0x27')])_0x3fcb18[_0xdb10('0x27')](_0x25391d[_0xdb10('0x27')]);if(_0x25391d[_0xdb10('0x26')])_0x3fcb18[_0xdb10('0x26')](_0x25391d[_0xdb10('0x26')]);return db['sequelize'][_0xdb10('0x41')](_0x3fcb18[_0xdb10('0x9f')](),_0x2da03b);})[_0xdb10('0x2d')](function(_0x42b12f){_0x5c88b2[_0xdb10('0x48')](_0xdb10('0xb4'),_['map'](_0x42b12f,'id'));return db[_0xdb10('0x9e')][_0xdb10('0x41')](_0x5c88b2[_0xdb10('0x9f')](),_0x2da03b)[_0xdb10('0x2d')](function(_0x325fa6){var _0x45ea99=_[_0xdb10('0xb5')](_0x325fa6,_0xdb10('0xb6'));var _0x278011=[];_0x42b12f['forEach'](function(_0x40991a){_0x278011[_0xdb10('0x39')](updateFaxInteraction(_0x40991a,_0x7009e1,_0x45ea99));});return BPromise[_0xdb10('0xb7')](_0x278011);});});})[_0xdb10('0x2d')](function(_0x344097){_0x22fdde[_0xdb10('0xb8')]=_0x344097;return _0x22fdde;})['then'](respondWithFilteredResult(_0x31de80,_0x25391d));})[_0xdb10('0x3a')](handleError(_0x31de80,null));};exports[_0xdb10('0xb9')]=function(_0xfad854,_0x1bb9e9){var _0x4f0f73={'raw':![],'where':{'id':_0xfad854[_0xdb10('0xba')]['id']}},_0x55c35d={};_0x55c35d[_0xdb10('0x40')]=_[_0xdb10('0x42')](db['FaxInteraction'][_0xdb10('0x3c')]);_0x55c35d['query']=_[_0xdb10('0x42')](_0xfad854['query']);_0x55c35d[_0xdb10('0x49')]=_['intersection'](_0x55c35d[_0xdb10('0x40')],_0x55c35d[_0xdb10('0x41')]);_0x4f0f73[_0xdb10('0x44')]=_[_0xdb10('0x43')](_0x55c35d[_0xdb10('0x40')],qs[_0xdb10('0x45')](_0xfad854[_0xdb10('0x41')][_0xdb10('0x45')]));_0x4f0f73[_0xdb10('0x44')]=_0x4f0f73['attributes'][_0xdb10('0x64')]?_0x4f0f73['attributes']:_0x55c35d['model'];if(_0xfad854['query']['includeAll']){_0x4f0f73[_0xdb10('0xbb')]=[{'all':!![]}];}_0x4f0f73=_[_0xdb10('0xa1')]({},_0x4f0f73,_0xfad854[_0xdb10('0xbc')]);return db[_0xdb10('0x3b')][_0xdb10('0x65')](_0x4f0f73)[_0xdb10('0x2d')](handleEntityNotFound(_0x1bb9e9,null))[_0xdb10('0x2d')](respondWithResult(_0x1bb9e9,null))[_0xdb10('0x3a')](handleError(_0x1bb9e9,null));};exports['create']=function(_0x29ed6a,_0x555dd9){return db[_0xdb10('0x3b')][_0xdb10('0xbd')](_0x29ed6a[_0xdb10('0x78')],{})['then'](respondWithResult(_0x555dd9,0xc9))[_0xdb10('0x3a')](handleError(_0x555dd9,null));};exports['update']=function(_0x6bfc0b,_0x3c2ef7){if(_0x6bfc0b[_0xdb10('0x78')]['id']){delete _0x6bfc0b[_0xdb10('0x78')]['id'];}return db['FaxInteraction'][_0xdb10('0x65')]({'where':{'id':_0x6bfc0b[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x3c2ef7,null))[_0xdb10('0x2d')](saveUpdates(_0x6bfc0b[_0xdb10('0x78')],null))['then'](respondWithResult(_0x3c2ef7,null))[_0xdb10('0x3a')](handleError(_0x3c2ef7,null));};exports[_0xdb10('0x2e')]=function(_0x1f980a,_0x15010f){return db['FaxInteraction'][_0xdb10('0x65')]({'where':{'id':_0x1f980a['params']['id']}})['then'](handleEntityNotFound(_0x15010f,null))['then'](removeEntity(_0x15010f,null))[_0xdb10('0x3a')](handleError(_0x15010f,null));};exports[_0xdb10('0xbe')]=function(_0x428caa,_0x548415){return db[_0xdb10('0x3b')][_0xdb10('0xbe')]()[_0xdb10('0x2d')](respondWithResult(_0x548415,null))[_0xdb10('0x3a')](handleError(_0x548415,null));};exports[_0xdb10('0xbf')]=function(_0x187733,_0x2a9206,_0x4e1bee){return db[_0xdb10('0xc0')]['find']({'where':{'id':_0x187733[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x2a9206,null))['then'](function(_0x5709fa){if(_0x5709fa){return _0x5709fa[_0xdb10('0xbf')](_0x187733[_0xdb10('0x78')]['ids'],_[_0xdb10('0xc1')](_0x187733['body'],[_0xdb10('0xc2'),'id'])||{});}})[_0xdb10('0x2d')](respondWithResult(_0x2a9206,null))[_0xdb10('0x3a')](handleError(_0x2a9206,null));};exports[_0xdb10('0xc3')]=function(_0x2f40ad,_0x5da3a1,_0xbb8d60){var _0x1e45e3={'raw':![],'where':{}};var _0x2eec59={};var _0x237f77={'count':0x0,'rows':[]};return db[_0xdb10('0x3b')][_0xdb10('0xc4')]({'where':{'id':_0x2f40ad[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x5da3a1,null))[_0xdb10('0x2d')](function(_0x363ea4){if(_0x363ea4){_0x2eec59[_0xdb10('0x40')]=_[_0xdb10('0x42')](db['FaxMessage'][_0xdb10('0x3c')]);_0x2eec59['query']=_[_0xdb10('0x42')](_0x2f40ad[_0xdb10('0x41')]);_0x2eec59['filters']=_[_0xdb10('0x43')](_0x2eec59[_0xdb10('0x40')],_0x2eec59['query']);_0x1e45e3[_0xdb10('0x44')]=_[_0xdb10('0x43')](_0x2eec59[_0xdb10('0x40')],qs['fields'](_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x45')]));_0x1e45e3[_0xdb10('0x44')]=_0x1e45e3['attributes'][_0xdb10('0x64')]?_0x1e45e3['attributes']:_0x2eec59[_0xdb10('0x40')];if(!_0x2f40ad[_0xdb10('0x41')]['hasOwnProperty'](_0xdb10('0xc5'))){_0x1e45e3[_0xdb10('0x27')]=qs['limit'](_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x27')]);_0x1e45e3[_0xdb10('0x26')]=qs['offset'](_0x2f40ad[_0xdb10('0x41')]['offset']);}_0x1e45e3[_0xdb10('0x47')]=qs['sort'](_0x2f40ad[_0xdb10('0x41')][_0xdb10('0xc6')]);_0x1e45e3['where']=qs[_0xdb10('0x49')](_[_0xdb10('0xc7')](_0x2f40ad[_0xdb10('0x41')],_0x2eec59[_0xdb10('0x49')]));_0x1e45e3[_0xdb10('0x48')][_0xdb10('0xb6')]=_0x363ea4['id'];if(_0x2f40ad[_0xdb10('0x41')]['filter']){_0x1e45e3['where']=_[_0xdb10('0xa1')](_0x1e45e3[_0xdb10('0x48')],{'$or':_['map'](_0x1e45e3[_0xdb10('0x44')],function(_0x1dd4f7){var _0xb0ebba={};_0xb0ebba[_0x1dd4f7]={'$like':'%'+_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x89')]+'%'};return _0xb0ebba;})});}if(_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x7f')]){var _0x49aca5=_0x2f40ad[_0xdb10('0x41')][_0xdb10('0x7f')]['split'](',');var _0x53dc27={};_0x53dc27[_0x49aca5[0x0]]={'$gte':moment(_0x49aca5[0x1])[_0xdb10('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1e45e3[_0xdb10('0x48')]=_[_0xdb10('0xa1')](_0x1e45e3[_0xdb10('0x48')],_0x53dc27);}_0x1e45e3=_[_0xdb10('0xa1')]({},_0x1e45e3,_0x2f40ad[_0xdb10('0xbc')]);return db['FaxMessage']['count']({'where':_0x1e45e3['where']})['then'](function(_0xcaa3f2){_0x237f77[_0xdb10('0x25')]=_0xcaa3f2;if(_0x2f40ad['query']['includeAll']){_0x1e45e3['include']=[{'all':!![]}];}return db['FaxMessage'][_0xdb10('0xc9')](_0x1e45e3);})['then'](function(_0x39ccd5){_0x237f77[_0xdb10('0xb8')]=_0x39ccd5;return _0x237f77;});}})[_0xdb10('0x2d')](respondWithFilteredResult(_0x5da3a1,_0x1e45e3))['catch'](handleError(_0x5da3a1,null));};exports[_0xdb10('0xca')]=function(_0x4de46d,_0x10d81d,_0x5f12d3){return db['FaxInteraction'][_0xdb10('0x65')]({'where':{'id':_0x4de46d[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x10d81d,null))[_0xdb10('0x2d')](function(_0x54025e){if(_0x54025e){return _0x54025e[_0xdb10('0xcb')](_0x4de46d['body'][_0xdb10('0xc2')],_['omit'](_0x4de46d[_0xdb10('0x78')],[_0xdb10('0xc2'),'id'])||{})[_0xdb10('0xcc')](function(){return db[_0xdb10('0x73')][_0xdb10('0xc9')]({'attributes':['id','name','color'],'where':{'id':_0x4de46d[_0xdb10('0x78')][_0xdb10('0xc2')]}});})[_0xdb10('0x2d')](function(_0x4461ff){socket['emit'](_0xdb10('0xcd'),{'id':Number(_0x4de46d['params']['id']),'tags':_0x4461ff||[]});return{'id':Number(_0x4de46d[_0xdb10('0xba')]['id']),'tags':_0x4461ff||[]};});}})[_0xdb10('0x2d')](respondWithResult(_0x10d81d,null))[_0xdb10('0x3a')](handleError(_0x10d81d,null));};exports[_0xdb10('0xce')]=function(_0x52794a,_0x3d45ea,_0x46b109){return db[_0xdb10('0x3b')][_0xdb10('0x65')]({'where':{'id':_0x52794a[_0xdb10('0xba')]['id']}})[_0xdb10('0x2d')](handleEntityNotFound(_0x3d45ea,null))[_0xdb10('0x2d')](function(_0x5645fd){if(_0x5645fd){return _0x5645fd['removeTags'](_0x52794a['query']['ids']);}})[_0xdb10('0x2d')](respondWithStatusCode(_0x3d45ea,null))[_0xdb10('0x3a')](handleError(_0x3d45ea,null));};exports[_0xdb10('0xcf')]=function(_0x4d9a10,_0x16b86c){var _0x5154b0=moment()[_0xdb10('0xd0')]()['toString']();var _0x29b4aa=path[_0xdb10('0xd1')](config[_0xdb10('0xd2')],_0xdb10('0xd3'),_0xdb10('0xd4'),'tmp');var _0x41383e=path[_0xdb10('0xd1')](config[_0xdb10('0xd2')],_0xdb10('0xd3'),_0xdb10('0xd4'),_0xdb10('0xd5'));var _0xeaf912=path[_0xdb10('0xd1')](_0x29b4aa,_0x5154b0);var _0x35edd8=util[_0xdb10('0xc8')](_0xdb10('0xd6'),_0x4d9a10[_0xdb10('0xba')]['id'],_0x5154b0);var _0x32ed1c=path[_0xdb10('0xd1')](_0x29b4aa,_0x35edd8);var _0x66cefd=[];_0x66cefd[_0xdb10('0x39')]({'model':db[_0xdb10('0xd7')],'as':_0xdb10('0xd7'),'raw':!![]});var _0x3dd0f4=[{'model':db[_0xdb10('0xc0')],'as':'Messages','attributes':['id',_0xdb10('0x78'),_0xdb10('0x7d')],'include':_0x66cefd}];return db[_0xdb10('0x3b')]['find']({'where':{'id':_0x4d9a10[_0xdb10('0xba')]['id']},'include':_0x3dd0f4})[_0xdb10('0x2d')](handleEntityNotFound(_0x16b86c,null))['then'](function(_0x511050){if(_0x511050&&_0x511050[_0xdb10('0xd8')]){var _0x52e78b=_0x511050[_0xdb10('0xd9')]({'plain':!![]});fs['mkdirSync'](_0xeaf912);for(var _0x57c0a9=0x0;_0x57c0a9<_0x52e78b[_0xdb10('0xd8')][_0xdb10('0x64')];_0x57c0a9++){var _0x1e7e11=_0x52e78b['Messages'][_0x57c0a9]['Attachment'];if(_0x1e7e11){var _0x55745b=path[_0xdb10('0xd1')](_0x41383e,_0x1e7e11[_0xdb10('0xda')]);if(fs[_0xdb10('0xdb')](_0x55745b)){fs['createReadStream'](_0x55745b)['pipe'](fs[_0xdb10('0xdc')](path[_0xdb10('0xd1')](_0xeaf912,_0x1e7e11[_0xdb10('0xda')])));}}}return BPromise[_0xdb10('0x97')]()[_0xdb10('0x2d')](function(){return new BPromise(function(_0x3e01af,_0xdd9608){zipdir(_0xeaf912,{'saveTo':_0x32ed1c},function(_0xe8dba,_0x189e37){if(_0xe8dba)return _0xdd9608(_0xe8dba);return _0x3e01af(_0x189e37);});})[_0xdb10('0x2d')](function(){return new BPromise(function(_0x2312f7,_0x3422bc){rimraf(_0xeaf912,function(_0x46f707){if(_0x46f707)_0x3422bc(_0x46f707);return _0x2312f7();});});})[_0xdb10('0x2d')](function(){return _0x16b86c[_0xdb10('0xcf')](_0x32ed1c,_0x35edd8,function(_0x518eab){if(_0x518eab){console['log'](_0xdb10('0xdd'),_0x518eab);}else{fs[_0xdb10('0xde')](_0x32ed1c);}});});});}else{return _0x16b86c['sendStatus'](0xc8);}})[_0xdb10('0x3a')](handleError(_0x16b86c,null));}; \ No newline at end of file +var _0xf17f=['toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','includeAll','create','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','Attachment','Messages','createdAt','get','mkdirSync','existsSync','pipe','createWriteStream','basename','log','err','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','register','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','FaxInteraction','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','text','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize'];(function(_0x256d6f,_0x393056){var _0x5a72b6=function(_0x275d23){while(--_0x275d23){_0x256d6f['push'](_0x256d6f['shift']());}};_0x5a72b6(++_0x393056);}(_0xf17f,0x113));var _0xff17=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0xf17f[_0x2f37e0];return _0x43ccce;};'use strict';var pdf=require(_0xff17('0x0'));var emlformat=require(_0xff17('0x1'));var rimraf=require(_0xff17('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff17('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff17('0x4'));var Mustache=require(_0xff17('0x5'));var util=require(_0xff17('0x6'));var path=require(_0xff17('0x7'));var sox=require('sox');var csv=require(_0xff17('0x8'));var ejs=require(_0xff17('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xff17('0xa'));var crypto=require(_0xff17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xff17('0xc'));var toCsv=require(_0xff17('0x8'));var querystring=require(_0xff17('0xd'));var Papa=require('papaparse');var Redis=require(_0xff17('0xe'));var authService=require(_0xff17('0xf'));var qs=require(_0xff17('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff17('0x11'));var logger=require(_0xff17('0x12'))(_0xff17('0x13'));var utils=require(_0xff17('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xff17('0x15')]=_[_0xff17('0x16')](config[_0xff17('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xff17('0x17'))(new Redis(config[_0xff17('0x15')]));require('./faxInteraction.socket')[_0xff17('0x18')](socket);function respondWithStatusCode(_0x4218bc,_0x4e3435){_0x4e3435=_0x4e3435||0xcc;return function(_0x5721de){if(_0x5721de){return _0x4218bc['sendStatus'](_0x4e3435);}return _0x4218bc[_0xff17('0x19')](_0x4e3435)['end']();};}function respondWithResult(_0x2f501a,_0x2a6d05){_0x2a6d05=_0x2a6d05||0xc8;return function(_0x249641){if(_0x249641){return _0x2f501a[_0xff17('0x19')](_0x2a6d05)[_0xff17('0x1a')](_0x249641);}};}function respondWithFilteredResult(_0x4f3962,_0x15bc8b){return function(_0x173592){if(_0x173592){var _0x6365e8=_0x173592[_0xff17('0x1b')],_0x594830=_0x15bc8b[_0xff17('0x1c')],_0x5c33b8=_0x15bc8b['offset']+_0x15bc8b['limit'],_0x1950ff;if(_0x5c33b8>=_0x6365e8){_0x5c33b8=_0x6365e8;_0x1950ff=0xc8;}else{_0x1950ff=0xce;}_0x4f3962['status'](_0x1950ff);return _0x4f3962['set'](_0xff17('0x1d'),_0x594830+'-'+_0x5c33b8+'/'+_0x6365e8)['json'](_0x173592);}return null;};}function patchUpdates(_0x12f10f){return function(_0x3794f0){try{jsonpatch[_0xff17('0x1e')](_0x3794f0,_0x12f10f,!![]);}catch(_0x4c5366){return BPromise[_0xff17('0x1f')](_0x4c5366);}return _0x3794f0[_0xff17('0x20')]();};}function saveUpdates(_0x5ab76c,_0x583240){return function(_0x29f655){if(_0x29f655){return _0x29f655[_0xff17('0x21')](_0x5ab76c)[_0xff17('0x22')](function(_0x5cd3be){return _0x5cd3be;});}return null;};}function removeEntity(_0x594018,_0x20f5f3){return function(_0xecd4cb){if(_0xecd4cb){return _0xecd4cb[_0xff17('0x23')]()[_0xff17('0x22')](function(){_0x594018['status'](0xcc)[_0xff17('0x24')]();});}};}function handleEntityNotFound(_0x3904bb,_0x5ad4df){return function(_0x294aa2){if(!_0x294aa2){_0x3904bb[_0xff17('0x25')](0x194);}return _0x294aa2;};}function handleError(_0x509d30,_0x301511){_0x301511=_0x301511||0x1f4;return function(_0x512f7b){logger['error'](_0x512f7b['stack']);if(_0x512f7b[_0xff17('0x26')]){delete _0x512f7b[_0xff17('0x26')];}_0x509d30[_0xff17('0x19')](_0x301511)[_0xff17('0x27')](_0x512f7b);};}function getInteractionUsers(_0x3a4b8d,_0x1d3fbf){return new BPromise(function(_0xa80345,_0x21dcbf){try{if(_0x1d3fbf[_0x3a4b8d['id']]){_0x3a4b8d[_0xff17('0x28')]=_[_0xff17('0x29')](_0x1d3fbf[_0x3a4b8d['id']],function(_0x52f588){return{'id':_0x52f588['id'],'fullname':_0x52f588[_0xff17('0x2a')]};});}}catch(_0x7d745a){_0x21dcbf(_0x7d745a);}_0xa80345(_0x3a4b8d);});}function getInteractionTags(_0x2fe2bc,_0x15c0be){return new BPromise(function(_0x28a29b,_0x164be8){try{if(_0x2fe2bc[_0xff17('0x2b')]){_0x2fe2bc[_0xff17('0x2c')]=[];_0x2fe2bc[_0xff17('0x2b')][_0xff17('0x2d')](',')[_0xff17('0x2e')](function(_0x2223ae){_0x2fe2bc[_0xff17('0x2c')][_0xff17('0x2f')](_0x15c0be[_0x2223ae]);});}delete _0x2fe2bc[_0xff17('0x2b')];}catch(_0x139391){_0x164be8(_0x139391);}_0x28a29b(_0x2fe2bc);});}function updateFaxInteraction(_0x15b852,_0x3791dd,_0x3abebf){return new BPromise(function(_0x3de4e8,_0x58e0e6){return getInteractionUsers(_0x15b852,_0x3abebf)[_0xff17('0x22')](function(_0x596dee){return getInteractionTags(_0x596dee,_0x3791dd);})[_0xff17('0x22')](function(_0x4c57d7){_0x3de4e8(_0x4c57d7);})['catch'](function(_0x4f94c3){_0x58e0e6(_0x4f94c3);});});}exports['index']=function(_0x3fe813,_0x266ba7){var _0x55907e={},_0x36be5c={},_0x4073ba={'count':0x0,'rows':[]};var _0x5e6504=_[_0xff17('0x29')](db[_0xff17('0x30')][_0xff17('0x31')],function(_0x4daa4e){return{'name':_0x4daa4e['fieldName'],'type':_0x4daa4e[_0xff17('0x32')][_0xff17('0x33')]};});_0x36be5c[_0xff17('0x34')]=_[_0xff17('0x29')](_0x5e6504,_0xff17('0x26'));_0x36be5c['query']=_['keys'](_0x3fe813[_0xff17('0x35')]);_0x36be5c['filters']=_[_0xff17('0x36')](_0x36be5c['model'],_0x36be5c[_0xff17('0x35')]);_0x55907e[_0xff17('0x37')]=_[_0xff17('0x36')](_0x36be5c[_0xff17('0x34')],qs[_0xff17('0x38')](_0x3fe813[_0xff17('0x35')]['fields']));_0x55907e[_0xff17('0x37')]=_0x55907e[_0xff17('0x37')]['length']?_0x55907e[_0xff17('0x37')]:_0x36be5c[_0xff17('0x34')];if(!_0x3fe813[_0xff17('0x35')][_0xff17('0x39')](_0xff17('0x3a'))){_0x55907e['limit']=qs['limit'](_0x3fe813['query']['limit']);_0x55907e[_0xff17('0x1c')]=qs[_0xff17('0x1c')](_0x3fe813[_0xff17('0x35')]['offset']);}_0x55907e['order']=qs[_0xff17('0x3b')](_0x3fe813[_0xff17('0x35')]['sort']);_0x55907e[_0xff17('0x3c')]=qs[_0xff17('0x3d')](_[_0xff17('0x3e')](_0x3fe813[_0xff17('0x35')],_0x36be5c[_0xff17('0x3d')]),_0x5e6504);var _0x6e8ebd=[];var _0x3f0046=squel[_0xff17('0x3f')]()['field']('id')[_0xff17('0x40')](_0xff17('0x26'))[_0xff17('0x40')](_0xff17('0x41'))[_0xff17('0x42')](_0xff17('0x43'));var _0x2ece1f=squel['select']()[_0xff17('0x40')]('u.id')['field'](_0xff17('0x44'))[_0xff17('0x40')](_0xff17('0x45'))[_0xff17('0x42')](_0xff17('0x46'),'ui')[_0xff17('0x47')]('users','u',_0xff17('0x48'));var _0x30f955=squel[_0xff17('0x3f')]()['from']('fax_interactions','i')[_0xff17('0x47')](_0xff17('0x49'),'c',_0xff17('0x4a'))[_0xff17('0x47')](_0xff17('0x4b'),'o',_0xff17('0x4c'))[_0xff17('0x47')](_0xff17('0x4d'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0xff17('0x4e'),'me',_0xff17('0x4f'))[_0xff17('0x47')](_0xff17('0x50'),'it',_0xff17('0x51'))['left_join'](_0xff17('0x43'),'t',_0xff17('0x52'));var _0xa9579b=squel[_0xff17('0x53')]();var _0xb280f7=[];var _0x580789=squel[_0xff17('0x53')]();var _0x39ea5a;if(_0x3fe813[_0xff17('0x35')][_0xff17('0x54')]){_0x39ea5a=as['parseSearch'](_0x3fe813[_0xff17('0x35')][_0xff17('0x54')]);var _0x3bb632=_0x39ea5a[_0xff17('0x55')];for(var _0x4b0d98=0x0;_0x4b0d98<_0x39ea5a[_0xff17('0x56')][_0xff17('0x57')];_0x4b0d98++){var _0x2d6350=_0x39ea5a['conditions'][_0x4b0d98];var _0x3ff171='i';var _0x5778a8=_['find'](_0x5e6504,[_0xff17('0x26'),_0x2d6350['field']]);if(!_0x5778a8){switch(_0x2d6350[_0xff17('0x40')]){case _0xff17('0x58'):if(_0x2d6350[_0xff17('0x59')]==0x1){_0x30f955[_0xff17('0x5a')]('`'+_0x2d6350[_0xff17('0x40')]+_0xff17('0x5b'));}else{_0x30f955[_0xff17('0x5a')]('`'+_0x2d6350[_0xff17('0x40')]+'`\x20>\x200');}break;case _0xff17('0x5c'):if(_0x2d6350['operator']===_0xff17('0x5d')){if(_0x2d6350['value'][_0xff17('0x2d')]('\x20')[_0xff17('0x57')]>0x1){_0xa9579b[_0x3bb632](_0xff17('0x5e'),qs['getFullTextValue'](_0x2d6350[_0xff17('0x59')]),null);}else{var _0x39414c='%'+_0x2d6350[_0xff17('0x59')]+'%';_0xa9579b[_0x3bb632](_0xff17('0x5f'),_0x39414c,_0x39414c,_0x39414c);}}else{_0x5778a8=_[_0xff17('0x60')](_0x5e6504,['name','ContactId']);_0x2d6350[_0xff17('0x40')]=_0xff17('0x61');_0x2f760f=as[_0xff17('0x62')](_0x3ff171,_0x5778a8[_0xff17('0x32')],_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f['text'],_0x2f760f['value'][_0xff17('0x63')],_0x2f760f['value']['end']);}break;case _0xff17('0x64'):var _0x5ca08b=_0x2d6350[_0xff17('0x59')][_0xff17('0x2d')](',')[_0xff17('0x29')](function(_0x41df03){return Number(_0x41df03);});_0x5ca08b[_0xff17('0x2e')](function(_0x3e4dce){_0x580789['or'](_0xff17('0x65'),'%,'+_0x3e4dce+',%');});_0xb280f7=_[_0xff17('0x66')](_0xb280f7,_0x5ca08b);break;case _0xff17('0x67'):if(_0x2d6350[_0xff17('0x68')]===_0xff17('0x5d')){_0xa9579b[_0x3bb632]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2d6350[_0xff17('0x59')]+'%',null);}else{_0x5778a8=_[_0xff17('0x60')](_0x5e6504,['name',_0xff17('0x69')]);_0x2d6350['field']=_0xff17('0x69');_0x2f760f=as[_0xff17('0x62')](_0x3ff171,_0x5778a8[_0xff17('0x32')],_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f['text'],_0x2f760f[_0xff17('0x59')][_0xff17('0x63')],_0x2f760f[_0xff17('0x59')][_0xff17('0x24')]);}break;case _0xff17('0x6a'):_0x2f760f=as['buildExpression']('me',null,_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f[_0xff17('0x6b')],_0x2f760f[_0xff17('0x59')][_0xff17('0x63')],_0x2f760f[_0xff17('0x59')][_0xff17('0x24')]);break;}}else{var _0x2f760f=as['buildExpression'](_0x3ff171,_0x5778a8['type'],_0x2d6350);_0xa9579b[_0x3bb632](_0x2f760f[_0xff17('0x6b')],_0x2f760f[_0xff17('0x59')][_0xff17('0x63')],_0x2f760f[_0xff17('0x59')][_0xff17('0x24')]);}}}else{var _0x44d161=_(_0x3fe813[_0xff17('0x35')])[_0xff17('0x6c')]()[_0xff17('0x29')](function(_0x3f44b9){return _[_0xff17('0x6d')](_0x5e6504,[_0xff17('0x26'),_0x3f44b9])?_0x3f44b9:undefined;})[_0xff17('0x6e')]()['value']();if(!_['isEmpty'](_0x44d161)){_0x44d161[_0xff17('0x2e')](function(_0x59bfab){if(_0x59bfab===_0xff17('0x6f')){_0x30f955[_0xff17('0x3c')](_0xff17('0x70'),[][_0xff17('0x71')](_0x3fe813['query'][_0x59bfab]));}else if(_0x59bfab==='createdAt'){var _0x1d5dcf=JSON[_0xff17('0x72')](_0x3fe813['query'][_0x59bfab])[_0xff17('0x73')];var _0x536f6b=JSON[_0xff17('0x72')](_0x3fe813[_0xff17('0x35')][_0x59bfab])['$lte'];_0x30f955[_0xff17('0x3c')](_0xff17('0x74'),_0x1d5dcf,_0x536f6b);}else{if(_0x3fe813[_0xff17('0x35')][_0x59bfab]===_0xff17('0x75')){_0x30f955[_0xff17('0x3c')]('i.'+_0x59bfab+'\x20IS\x20NULL');}else{_0x30f955['where']('i.'+_0x59bfab+'\x20=\x20?',_0x3fe813['query'][_0x59bfab]);}}});}if(_0x3fe813[_0xff17('0x35')]['read']){if(_0x3fe813['query'][_0xff17('0x76')]==0x1){_0x30f955['having'](_0xff17('0x77'));}else{_0x30f955[_0xff17('0x5a')](_0xff17('0x78'));}}if(_0x3fe813['query'][_0xff17('0x79')]){_0xb280f7=_[_0xff17('0x7a')](_0x3fe813[_0xff17('0x35')]['tag'])?_0x3fe813[_0xff17('0x35')]['tag']:new Array(_0x3fe813[_0xff17('0x35')][_0xff17('0x79')]);_0xb280f7[_0xff17('0x2e')](function(_0x7515d2){_0x580789['or'](_0xff17('0x65'),'%,'+_0x7515d2+',%');});}if(_0x3fe813['query']['filter']){var _0x19e9b5=_0x3fe813[_0xff17('0x35')][_0xff17('0x7b')][_0xff17('0x7c')]('\x5c','\x5c\x5c')[_0xff17('0x7c')]('\x27\x27',_0xff17('0x7d'));if(qs[_0xff17('0x7e')](_0x19e9b5)){_0xa9579b['or'](_0xff17('0x7f'),_0x19e9b5+'%')['or'](_0xff17('0x80'),_0x19e9b5+'%');}_0xa9579b['or'](_0xff17('0x81'),_0x19e9b5+'%');}}_0x30f955['where'](_0xa9579b);_0x30f955['group'](_0xff17('0x82'));var _0x3b2f39={'type':db[_0xff17('0x83')]['QueryTypes'][_0xff17('0x84')],'raw':!![]};var _0x51dcc0=_0x30f955[_0xff17('0x85')]();_0x51dcc0[_0xff17('0x40')](_0xff17('0x82'));_0x51dcc0[_0xff17('0x40')](_0xff17('0x86'),_0xff17('0x58'));if(_0x55907e[_0xff17('0x87')]){_0x55907e[_0xff17('0x87')]['forEach'](function(_0x1f8a3f){_0x30f955[_0xff17('0x87')]('i.'+_0x1f8a3f[0x0],_0x1f8a3f[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xb280f7)){_0x30f955[_0xff17('0x5a')](_0x580789);_0x51dcc0[_0xff17('0x3c')]('t.id\x20IN\x20?',_0xb280f7);}BPromise[_0xff17('0x88')]()[_0xff17('0x22')](function(){if(!_0x39ea5a){if(_0x3fe813[_0xff17('0x35')]['FaxAccountId']||_0x3fe813['query'][_0xff17('0x89')])return;_0x51dcc0['where'](_0xff17('0x8a'));_0x30f955[_0xff17('0x3c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3fe813[_0xff17('0x8b')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xff17('0x22')](function(_0x5c925e){if(_[_0xff17('0x8c')](_0x5c925e)){_0x51dcc0[_0xff17('0x3c')](_0xff17('0x8d'));_0x30f955[_0xff17('0x3c')](_0xff17('0x8d'));}else{_0x51dcc0[_0xff17('0x3c')](_0xff17('0x70'),_['map'](_0x5c925e,'id'));_0x30f955[_0xff17('0x3c')]('i.FaxAccountId\x20IN\x20?',_[_0xff17('0x29')](_0x5c925e,'id'));}});})[_0xff17('0x22')](function(){db[_0xff17('0x8e')][_0xff17('0x35')](_0x51dcc0[_0xff17('0x8f')](),_0x3b2f39)[_0xff17('0x22')](function(_0x34e880){_0x4073ba[_0xff17('0x1b')]=_0x34e880[_0xff17('0x57')];if(_0x4073ba['count']===0x0)return[];return db[_0xff17('0x8e')]['query'](_0x3f0046['toString'](),_0x3b2f39)[_0xff17('0x22')](function(_0x2bc0c3){_0x6e8ebd=_[_0xff17('0x90')](_0x2bc0c3,'id');_0x3b2f39=_[_0xff17('0x91')](_0x3b2f39,{'model':db[_0xff17('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fe813[_0xff17('0x35')][_0xff17('0x38')]){_0x55907e['attributes'][_0xff17('0x2e')](function(_0x574523){_0x30f955[_0xff17('0x40')]('i.'+_0x574523);});}else{_0x30f955[_0xff17('0x40')](_0xff17('0x86'),'unreadMessages');_0x30f955[_0xff17('0x40')](_0xff17('0x92'),_0xff17('0x93'));_0x30f955['field'](_0xff17('0x94'),_0xff17('0x95'));_0x30f955[_0xff17('0x40')](_0xff17('0x96'));_0x30f955[_0xff17('0x40')]('c.firstName',_0xff17('0x97'));_0x30f955['field'](_0xff17('0x98'),_0xff17('0x99'));_0x30f955[_0xff17('0x40')](_0xff17('0x9a'),_0xff17('0x9b'));_0x30f955[_0xff17('0x40')](_0xff17('0x9c'),_0xff17('0x9d'));_0x30f955['field'](_0xff17('0x9e'),'Contact.mobile');_0x30f955[_0xff17('0x40')]('c.fax',_0xff17('0x9f'));_0x30f955[_0xff17('0x40')]('o.fullname',_0xff17('0xa0'));_0x30f955[_0xff17('0x40')](_0xff17('0xa1'),_0xff17('0xa2'));_0x30f955[_0xff17('0x40')](_0xff17('0xa3'),_0xff17('0x2b'));}if(_0x55907e[_0xff17('0xa4')])_0x30f955['limit'](_0x55907e[_0xff17('0xa4')]);if(_0x55907e['offset'])_0x30f955[_0xff17('0x1c')](_0x55907e['offset']);return db[_0xff17('0x8e')][_0xff17('0x35')](_0x30f955[_0xff17('0x8f')](),_0x3b2f39);})['then'](function(_0x434d86){_0x2ece1f[_0xff17('0x3c')](_0xff17('0xa5'),_[_0xff17('0x29')](_0x434d86,'id'));return db[_0xff17('0x8e')][_0xff17('0x35')](_0x2ece1f['toString'](),_0x3b2f39)[_0xff17('0x22')](function(_0xb0a877){var _0x37d21d=_[_0xff17('0xa6')](_0xb0a877,_0xff17('0xa7'));var _0xf5d6cc=[];_0x434d86[_0xff17('0x2e')](function(_0x2cc4dd){_0xf5d6cc[_0xff17('0x2f')](updateFaxInteraction(_0x2cc4dd,_0x6e8ebd,_0x37d21d));});return BPromise[_0xff17('0xa8')](_0xf5d6cc);});});})[_0xff17('0x22')](function(_0x54fe1f){_0x4073ba[_0xff17('0xa9')]=_0x54fe1f;return _0x4073ba;})['then'](respondWithFilteredResult(_0x266ba7,_0x55907e));})[_0xff17('0xaa')](handleError(_0x266ba7,null));};exports['show']=function(_0x1bca60,_0x24ee10){var _0x679ad1={'raw':![],'where':{'id':_0x1bca60[_0xff17('0xab')]['id']}},_0x45ff3b={};_0x45ff3b[_0xff17('0x34')]=_['keys'](db[_0xff17('0x30')][_0xff17('0x31')]);_0x45ff3b[_0xff17('0x35')]=_[_0xff17('0x6c')](_0x1bca60[_0xff17('0x35')]);_0x45ff3b[_0xff17('0x3d')]=_[_0xff17('0x36')](_0x45ff3b[_0xff17('0x34')],_0x45ff3b['query']);_0x679ad1[_0xff17('0x37')]=_[_0xff17('0x36')](_0x45ff3b[_0xff17('0x34')],qs[_0xff17('0x38')](_0x1bca60[_0xff17('0x35')]['fields']));_0x679ad1[_0xff17('0x37')]=_0x679ad1[_0xff17('0x37')][_0xff17('0x57')]?_0x679ad1[_0xff17('0x37')]:_0x45ff3b[_0xff17('0x34')];if(_0x1bca60['query'][_0xff17('0xac')]){_0x679ad1['include']=[{'all':!![]}];}_0x679ad1=_[_0xff17('0x91')]({},_0x679ad1,_0x1bca60['options']);return db[_0xff17('0x30')][_0xff17('0x60')](_0x679ad1)['then'](handleEntityNotFound(_0x24ee10,null))[_0xff17('0x22')](respondWithResult(_0x24ee10,null))[_0xff17('0xaa')](handleError(_0x24ee10,null));};exports['create']=function(_0x38318e,_0x551054){return db['FaxInteraction'][_0xff17('0xad')](_0x38318e['body'],{})[_0xff17('0x22')](respondWithResult(_0x551054,0xc9))[_0xff17('0xaa')](handleError(_0x551054,null));};exports[_0xff17('0x21')]=function(_0x47ee49,_0x23cb76){if(_0x47ee49[_0xff17('0x6a')]['id']){delete _0x47ee49[_0xff17('0x6a')]['id'];}return db[_0xff17('0x30')][_0xff17('0x60')]({'where':{'id':_0x47ee49['params']['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x23cb76,null))[_0xff17('0x22')](saveUpdates(_0x47ee49[_0xff17('0x6a')],null))[_0xff17('0x22')](respondWithResult(_0x23cb76,null))[_0xff17('0xaa')](handleError(_0x23cb76,null));};exports[_0xff17('0x23')]=function(_0x1cf8dd,_0x5e5990){return db[_0xff17('0x30')][_0xff17('0x60')]({'where':{'id':_0x1cf8dd[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x5e5990,null))['then'](removeEntity(_0x5e5990,null))['catch'](handleError(_0x5e5990,null));};exports[_0xff17('0xae')]=function(_0x26b31d,_0x4f0be5){return db[_0xff17('0x30')][_0xff17('0xae')]()[_0xff17('0x22')](respondWithResult(_0x4f0be5,null))[_0xff17('0xaa')](handleError(_0x4f0be5,null));};exports[_0xff17('0xaf')]=function(_0xe765e8,_0x429b4b,_0x53a469){return db['FaxMessage']['find']({'where':{'id':_0xe765e8[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x429b4b,null))['then'](function(_0x2dc12b){if(_0x2dc12b){return _0x2dc12b['addMessage'](_0xe765e8['body']['ids'],_[_0xff17('0xb0')](_0xe765e8[_0xff17('0x6a')],[_0xff17('0xb1'),'id'])||{});}})[_0xff17('0x22')](respondWithResult(_0x429b4b,null))['catch'](handleError(_0x429b4b,null));};exports[_0xff17('0xb2')]=function(_0x4ebfe9,_0x2b23c2,_0x16bd3f){var _0x2448a1={'raw':![],'where':{}};var _0x5affc0={};var _0x2261a7={'count':0x0,'rows':[]};return db[_0xff17('0x30')][_0xff17('0xb3')]({'where':{'id':_0x4ebfe9[_0xff17('0xab')]['id']}})['then'](handleEntityNotFound(_0x2b23c2,null))[_0xff17('0x22')](function(_0x480b07){if(_0x480b07){_0x5affc0[_0xff17('0x34')]=_[_0xff17('0x6c')](db[_0xff17('0xb4')]['rawAttributes']);_0x5affc0[_0xff17('0x35')]=_[_0xff17('0x6c')](_0x4ebfe9[_0xff17('0x35')]);_0x5affc0[_0xff17('0x3d')]=_[_0xff17('0x36')](_0x5affc0['model'],_0x5affc0[_0xff17('0x35')]);_0x2448a1[_0xff17('0x37')]=_[_0xff17('0x36')](_0x5affc0[_0xff17('0x34')],qs[_0xff17('0x38')](_0x4ebfe9[_0xff17('0x35')][_0xff17('0x38')]));_0x2448a1[_0xff17('0x37')]=_0x2448a1[_0xff17('0x37')][_0xff17('0x57')]?_0x2448a1[_0xff17('0x37')]:_0x5affc0[_0xff17('0x34')];if(!_0x4ebfe9[_0xff17('0x35')][_0xff17('0x39')]('nolimit')){_0x2448a1[_0xff17('0xa4')]=qs['limit'](_0x4ebfe9[_0xff17('0x35')][_0xff17('0xa4')]);_0x2448a1[_0xff17('0x1c')]=qs['offset'](_0x4ebfe9[_0xff17('0x35')][_0xff17('0x1c')]);}_0x2448a1[_0xff17('0x87')]=qs[_0xff17('0x3b')](_0x4ebfe9[_0xff17('0x35')][_0xff17('0x3b')]);_0x2448a1[_0xff17('0x3c')]=qs[_0xff17('0x3d')](_[_0xff17('0x3e')](_0x4ebfe9[_0xff17('0x35')],_0x5affc0[_0xff17('0x3d')]));_0x2448a1[_0xff17('0x3c')][_0xff17('0xa7')]=_0x480b07['id'];if(_0x4ebfe9[_0xff17('0x35')][_0xff17('0x7b')]){_0x2448a1[_0xff17('0x3c')]=_['merge'](_0x2448a1[_0xff17('0x3c')],{'$or':_[_0xff17('0x29')](_0x2448a1['attributes'],function(_0xf1293){var _0x4da336={};_0x4da336[_0xf1293]={'$like':'%'+_0x4ebfe9[_0xff17('0x35')][_0xff17('0x7b')]+'%'};return _0x4da336;})});}if(_0x4ebfe9[_0xff17('0x35')][_0xff17('0x73')]){var _0x259439=_0x4ebfe9[_0xff17('0x35')][_0xff17('0x73')]['split'](',');var _0x56997c={};_0x56997c[_0x259439[0x0]]={'$gte':moment(_0x259439[0x1])[_0xff17('0xb5')](_0xff17('0xb6'))};_0x2448a1[_0xff17('0x3c')]=_[_0xff17('0x91')](_0x2448a1[_0xff17('0x3c')],_0x56997c);}_0x2448a1=_[_0xff17('0x91')]({},_0x2448a1,_0x4ebfe9[_0xff17('0xb7')]);return db[_0xff17('0xb4')]['count']({'where':_0x2448a1[_0xff17('0x3c')]})[_0xff17('0x22')](function(_0x155043){_0x2261a7[_0xff17('0x1b')]=_0x155043;if(_0x4ebfe9[_0xff17('0x35')]['includeAll']){_0x2448a1['include']=[{'all':!![]}];}return db['FaxMessage'][_0xff17('0xb8')](_0x2448a1);})[_0xff17('0x22')](function(_0x2420a0){_0x2261a7['rows']=_0x2420a0;return _0x2261a7;});}})[_0xff17('0x22')](respondWithFilteredResult(_0x2b23c2,_0x2448a1))[_0xff17('0xaa')](handleError(_0x2b23c2,null));};exports[_0xff17('0xb9')]=function(_0x552cb7,_0x4c9484,_0x1f4f91){return db[_0xff17('0x30')][_0xff17('0x60')]({'where':{'id':_0x552cb7[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x4c9484,null))[_0xff17('0x22')](function(_0x51af6b){if(_0x51af6b){return _0x51af6b['setTags'](_0x552cb7[_0xff17('0x6a')][_0xff17('0xb1')],_['omit'](_0x552cb7[_0xff17('0x6a')],[_0xff17('0xb1'),'id'])||{})[_0xff17('0xba')](function(){return db[_0xff17('0x64')][_0xff17('0xb8')]({'attributes':['id',_0xff17('0x26'),_0xff17('0x41')],'where':{'id':_0x552cb7[_0xff17('0x6a')][_0xff17('0xb1')]}});})['then'](function(_0x4ab22e){socket[_0xff17('0xbb')](_0xff17('0xbc'),{'id':Number(_0x552cb7['params']['id']),'tags':_0x4ab22e||[]});return{'id':Number(_0x552cb7['params']['id']),'tags':_0x4ab22e||[]};});}})[_0xff17('0x22')](respondWithResult(_0x4c9484,null))['catch'](handleError(_0x4c9484,null));};exports[_0xff17('0xbd')]=function(_0x66a1a8,_0x110a8a,_0x56711c){return db['FaxInteraction'][_0xff17('0x60')]({'where':{'id':_0x66a1a8[_0xff17('0xab')]['id']}})[_0xff17('0x22')](handleEntityNotFound(_0x110a8a,null))[_0xff17('0x22')](function(_0x21eef2){if(_0x21eef2){return _0x21eef2['removeTags'](_0x66a1a8[_0xff17('0x35')]['ids']);}})[_0xff17('0x22')](respondWithStatusCode(_0x110a8a,null))[_0xff17('0xaa')](handleError(_0x110a8a,null));};exports[_0xff17('0xbe')]=function(_0x1ad959,_0x400701){var _0xb00e1f=moment()[_0xff17('0xbf')]()[_0xff17('0x8f')]();var _0x4cec66=path['join'](config['root'],_0xff17('0xc0'),_0xff17('0xc1'),_0xff17('0xc2'));var _0x13c055=path[_0xff17('0xc3')](config[_0xff17('0xc4')],_0xff17('0xc0'),_0xff17('0xc1'),_0xff17('0xc5'));var _0x3181e4=path['join'](_0x4cec66,_0xb00e1f);var _0x200404=util[_0xff17('0xb5')]('transcript-%d-%s.zip',_0x1ad959['params']['id'],_0xb00e1f);var _0x1c43e0=path['join'](_0x4cec66,_0x200404);var _0x43764e=[];_0x43764e[_0xff17('0x2f')]({'model':db[_0xff17('0xc6')],'as':'Attachment','raw':!![]});var _0x5a1c78=[{'model':db[_0xff17('0xb4')],'as':_0xff17('0xc7'),'attributes':['id',_0xff17('0x6a'),_0xff17('0xc8')],'include':_0x43764e}];return db['FaxInteraction']['find']({'where':{'id':_0x1ad959[_0xff17('0xab')]['id']},'include':_0x5a1c78})[_0xff17('0x22')](handleEntityNotFound(_0x400701,null))[_0xff17('0x22')](function(_0x1ada5b){if(_0x1ada5b&&_0x1ada5b[_0xff17('0xc7')]){var _0x5f3890=_0x1ada5b[_0xff17('0xc9')]({'plain':!![]});fs[_0xff17('0xca')](_0x3181e4);for(var _0x3a12c8=0x0;_0x3a12c8<_0x5f3890['Messages'][_0xff17('0x57')];_0x3a12c8++){var _0x2279b7=_0x5f3890[_0xff17('0xc7')][_0x3a12c8][_0xff17('0xc6')];if(_0x2279b7){var _0x19ddbc=path[_0xff17('0xc3')](_0x13c055,_0x2279b7['basename']);if(fs[_0xff17('0xcb')](_0x19ddbc)){fs['createReadStream'](_0x19ddbc)[_0xff17('0xcc')](fs[_0xff17('0xcd')](path['join'](_0x3181e4,_0x2279b7[_0xff17('0xce')])));}}}return BPromise[_0xff17('0x88')]()[_0xff17('0x22')](function(){return new BPromise(function(_0x5a56c8,_0x3f3765){zipdir(_0x3181e4,{'saveTo':_0x1c43e0},function(_0x545acb,_0xbe32ae){if(_0x545acb)return _0x3f3765(_0x545acb);return _0x5a56c8(_0xbe32ae);});})[_0xff17('0x22')](function(){return new BPromise(function(_0x26082f,_0x2bdb47){rimraf(_0x3181e4,function(_0x341512){if(_0x341512)_0x2bdb47(_0x341512);return _0x26082f();});});})[_0xff17('0x22')](function(){return _0x400701['download'](_0x1c43e0,_0x200404,function(_0x97d1de){if(_0x97d1de){console[_0xff17('0xcf')](_0xff17('0xd0'),_0x97d1de);}else{fs['unlinkSync'](_0x1c43e0);}});});});}else{return _0x400701[_0xff17('0x25')](0xc8);}})['catch'](handleError(_0x400701,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index bd96c99..2e40515 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x4af449,_0x5675af){var _0x1c0899=function(_0x3d3a2){while(--_0x3d3a2){_0x4af449['push'](_0x4af449['shift']());}};_0x1c0899(++_0x5675af);}(_0x326f,0xd1));var _0xf326=function(_0x3a80e6,_0x2f0e55){_0x3a80e6=_0x3a80e6-0x0;var _0x7f6678=_0x326f[_0x3a80e6];return _0x7f6678;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b0062ab..446a25f 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 _0x6f0d=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define'];(function(_0x399f3f,_0x4bd01b){var _0xb636e2=function(_0x3e0e19){while(--_0x3e0e19){_0x399f3f['push'](_0x399f3f['shift']());}};_0xb636e2(++_0x4bd01b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x408b9e,_0x5b5170){_0x408b9e=_0x408b9e-0x0;var _0x3d33ac=_0x6f0d[_0x408b9e];return _0x3d33ac;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a48a0,_0x4c4916,_0x507048){if(_0x1a48a0[_0xd6f0('0xc')](_0xd6f0('0xd'))){_0x1a48a0[_0xd6f0('0xe')]=moment()[_0xd6f0('0xf')](_0xd6f0('0x10'));}_0x507048(null,_0x1a48a0);}}});}; \ No newline at end of file +var _0xaa88=['./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xaa88,0x137));var _0x8aa8=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xaa88[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27c08d,_0x40826f,_0x4adfb9){if(_0x27c08d[_0x8aa8('0xc')](_0x8aa8('0xd'))){_0x27c08d[_0x8aa8('0xe')]=moment()['format'](_0x8aa8('0xf'));}_0x4adfb9(null,_0x27c08d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d8c33c9..4c78079 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 _0xc2c1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','update','options','raw','attributes','limit','UpdateFaxInteraction','where','addTags','body','ids','AddTags','lodash','util'];(function(_0xd10d51,_0x37eb56){var _0x5e7b61=function(_0x296125){while(--_0x296125){_0xd10d51['push'](_0xd10d51['shift']());}};_0x5e7b61(++_0x37eb56);}(_0xc2c1,0xee));var _0x1c2c=function(_0x49058f,_0x429511){_0x49058f=_0x49058f-0x0;var _0x32bcd6=_0xc2c1[_0x49058f];return _0x32bcd6;};'use strict';var _=require(_0x1c2c('0x0'));var util=require(_0x1c2c('0x1'));var moment=require(_0x1c2c('0x2'));var BPromise=require(_0x1c2c('0x3'));var rs=require(_0x1c2c('0x4'));var fs=require('fs');var Redis=require(_0x1c2c('0x5'));var db=require(_0x1c2c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c2c('0x7'))(_0x1c2c('0x8'));var config=require(_0x1c2c('0x9'));var jayson=require(_0x1c2c('0xa'));var client=jayson['client'][_0x1c2c('0xb')]({'port':0x232a});config[_0x1c2c('0xc')]=_[_0x1c2c('0xd')](config['redis'],{'host':_0x1c2c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c2c('0xc')]));require(_0x1c2c('0xf'))[_0x1c2c('0x10')](socket);function respondWithRpcPromise(_0x4b677f,_0x3623f2,_0x30d347){return new BPromise(function(_0x45cd89,_0xe7726e){return client['request'](_0x4b677f,_0x30d347)[_0x1c2c('0x11')](function(_0x3ce4fe){logger['info'](_0x1c2c('0x12'),_0x3623f2,'request\x20sent');logger[_0x1c2c('0x13')](_0x1c2c('0x14'),_0x3623f2,'request\x20sent',JSON[_0x1c2c('0x15')](_0x3ce4fe));if(_0x3ce4fe[_0x1c2c('0x16')]){if(_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x17')]===0x1f4){logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x3623f2,_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);return _0xe7726e(_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);}logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x3623f2,_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);return _0x45cd89(_0x3ce4fe[_0x1c2c('0x16')][_0x1c2c('0x18')]);}else{logger[_0x1c2c('0x19')](_0x1c2c('0x12'),_0x3623f2,_0x1c2c('0x1a'));_0x45cd89(_0x3ce4fe[_0x1c2c('0x1b')][_0x1c2c('0x18')]);}})[_0x1c2c('0x1c')](function(_0xbd719a){logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x3623f2,_0xbd719a);_0xe7726e(_0xbd719a);});});}exports['UpdateFaxInteraction']=function(_0x300c66){var _0x488a28=this;return new Promise(function(_0x521289,_0x1480d6){return db['FaxInteraction'][_0x1c2c('0x1d')](_0x300c66['body'],{'raw':_0x300c66[_0x1c2c('0x1e')]?_0x300c66[_0x1c2c('0x1e')][_0x1c2c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300c66['options']?_0x300c66['options']['where']||null:null,'attributes':_0x300c66[_0x1c2c('0x1e')]?_0x300c66[_0x1c2c('0x1e')][_0x1c2c('0x20')]||null:null,'limit':_0x300c66[_0x1c2c('0x1e')]?_0x300c66['options'][_0x1c2c('0x21')]||null:null})[_0x1c2c('0x11')](function(_0x10839f){logger[_0x1c2c('0x19')]('UpdateFaxInteraction',_0x300c66);logger[_0x1c2c('0x13')](_0x1c2c('0x22'),_0x300c66,JSON[_0x1c2c('0x15')](_0x10839f));_0x521289(_0x10839f);})[_0x1c2c('0x1c')](function(_0x3af0bd){logger['error']('UpdateFaxInteraction',_0x3af0bd[_0x1c2c('0x18')],_0x300c66);_0x1480d6(_0x488a28[_0x1c2c('0x16')](0x1f4,_0x3af0bd[_0x1c2c('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x3b671f){return new Promise(function(_0x4fd2eb,_0x1d43c4){return db['FaxInteraction']['find']({'where':_0x3b671f[_0x1c2c('0x1e')]?_0x3b671f['options'][_0x1c2c('0x23')]||null:null})['then'](function(_0x31681a){if(_0x31681a){return _0x31681a[_0x1c2c('0x24')](_0x3b671f[_0x1c2c('0x25')][_0x1c2c('0x26')],_['omit'](_0x3b671f[_0x1c2c('0x25')],[_0x1c2c('0x26'),'id'])||{});}})['spread'](function(_0x593729){logger[_0x1c2c('0x19')]('AddTags',_0x3b671f);logger['debug'](_0x1c2c('0x27'),_0x3b671f,JSON[_0x1c2c('0x15')](_0x593729));_0x4fd2eb(_0x593729);})[_0x1c2c('0x1c')](function(_0x53a835){logger[_0x1c2c('0x16')](_0x1c2c('0x27'),_0x53a835[_0x1c2c('0x18')],_0x3b671f);_0x1d43c4(_this[_0x1c2c('0x16')](0x1f4,_0x53a835[_0x1c2c('0x18')]));});});}; \ No newline at end of file +var _0x8b09=['FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','register','then','FaxInteraction,\x20%s,\x20%s','debug'];(function(_0x2be46e,_0x2db9ac){var _0xfa7f30=function(_0x303d9b){while(--_0x303d9b){_0x2be46e['push'](_0x2be46e['shift']());}};_0xfa7f30(++_0x2db9ac);}(_0x8b09,0x1a2));var _0x98b0=function(_0x1d649b,_0x522270){_0x1d649b=_0x1d649b-0x0;var _0x516d26=_0x8b09[_0x1d649b];return _0x516d26;};'use strict';var _=require(_0x98b0('0x0'));var util=require(_0x98b0('0x1'));var moment=require(_0x98b0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98b0('0x3'));var logger=require(_0x98b0('0x4'))(_0x98b0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x98b0('0x6')]({'port':0x232a});config[_0x98b0('0x7')]=_['defaults'](config[_0x98b0('0x7')],{'host':_0x98b0('0x8'),'port':0x18eb});var socket=require(_0x98b0('0x9'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x98b0('0xa')](socket);function respondWithRpcPromise(_0x5d42e6,_0x39323a,_0x3995af){return new BPromise(function(_0xecd25,_0x28fdde){return client['request'](_0x5d42e6,_0x3995af)[_0x98b0('0xb')](function(_0x196037){logger['info'](_0x98b0('0xc'),_0x39323a,'request\x20sent');logger[_0x98b0('0xd')](_0x98b0('0xe'),_0x39323a,_0x98b0('0xf'),JSON['stringify'](_0x196037));if(_0x196037['error']){if(_0x196037['error'][_0x98b0('0x10')]===0x1f4){logger['error'](_0x98b0('0xc'),_0x39323a,_0x196037[_0x98b0('0x11')][_0x98b0('0x12')]);return _0x28fdde(_0x196037[_0x98b0('0x11')][_0x98b0('0x12')]);}logger[_0x98b0('0x11')](_0x98b0('0xc'),_0x39323a,_0x196037[_0x98b0('0x11')][_0x98b0('0x12')]);return _0xecd25(_0x196037['error'][_0x98b0('0x12')]);}else{logger[_0x98b0('0x13')](_0x98b0('0xc'),_0x39323a,_0x98b0('0xf'));_0xecd25(_0x196037['result'][_0x98b0('0x12')]);}})[_0x98b0('0x14')](function(_0x1f15a9){logger[_0x98b0('0x11')](_0x98b0('0xc'),_0x39323a,_0x1f15a9);_0x28fdde(_0x1f15a9);});});}exports[_0x98b0('0x15')]=function(_0x4e1cdd){var _0x1dea5d=this;return new Promise(function(_0x3f3c0e,_0x1a5a78){return db[_0x98b0('0x16')][_0x98b0('0x17')](_0x4e1cdd[_0x98b0('0x18')],{'raw':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd[_0x98b0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd['options'][_0x98b0('0x1a')]||null:null,'attributes':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd[_0x98b0('0x19')]['attributes']||null:null,'limit':_0x4e1cdd[_0x98b0('0x19')]?_0x4e1cdd[_0x98b0('0x19')][_0x98b0('0x1b')]||null:null})['then'](function(_0x22a2d6){logger['info'](_0x98b0('0x15'),_0x4e1cdd);logger[_0x98b0('0xd')](_0x98b0('0x15'),_0x4e1cdd,JSON[_0x98b0('0x1c')](_0x22a2d6));_0x3f3c0e(_0x22a2d6);})['catch'](function(_0x5f5cad){logger[_0x98b0('0x11')](_0x98b0('0x15'),_0x5f5cad[_0x98b0('0x12')],_0x4e1cdd);_0x1a5a78(_0x1dea5d[_0x98b0('0x11')](0x1f4,_0x5f5cad[_0x98b0('0x12')]));});});};exports[_0x98b0('0x1d')]=function(_0x2ee018){return new Promise(function(_0x1f2be4,_0x4f3c14){return db['FaxInteraction'][_0x98b0('0x1e')]({'where':_0x2ee018['options']?_0x2ee018['options']['where']||null:null})[_0x98b0('0xb')](function(_0x581a7f){if(_0x581a7f){return _0x581a7f[_0x98b0('0x1f')](_0x2ee018['body'][_0x98b0('0x20')],_[_0x98b0('0x21')](_0x2ee018[_0x98b0('0x18')],[_0x98b0('0x20'),'id'])||{});}})[_0x98b0('0x22')](function(_0x57294a){logger[_0x98b0('0x13')](_0x98b0('0x23'),_0x2ee018);logger[_0x98b0('0xd')]('AddTags',_0x2ee018,JSON[_0x98b0('0x1c')](_0x57294a));_0x1f2be4(_0x57294a);})[_0x98b0('0x14')](function(_0x442d64){logger[_0x98b0('0x11')](_0x98b0('0x23'),_0x442d64[_0x98b0('0x12')],_0x2ee018);_0x4f3c14(_this['error'](0x1f4,_0x442d64[_0x98b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f3b5a60..feaebf4 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 _0xf33a=['emit','./faxInteraction.events','save','remove','update'];(function(_0x3e0a39,_0xa284fd){var _0x5c90a1=function(_0x570e1f){while(--_0x570e1f){_0x3e0a39['push'](_0x3e0a39['shift']());}};_0x5c90a1(++_0xa284fd);}(_0xf33a,0x79));var _0xaf33=function(_0xa8fff6,_0x366f9a){_0xa8fff6=_0xa8fff6-0x0;var _0x3c2a16=_0xf33a[_0xa8fff6];return _0x3c2a16;};'use strict';var FaxInteractionEvents=require(_0xaf33('0x0'));var events=[_0xaf33('0x1'),_0xaf33('0x2'),_0xaf33('0x3')];function createListener(_0x3a8d83,_0x336a50){return function(_0x22c9e3){_0x336a50[_0xaf33('0x4')](_0x3a8d83,_0x22c9e3);};}function removeListener(_0x2ecc53,_0x5e31a7){return function(){FaxInteractionEvents['removeListener'](_0x2ecc53,_0x5e31a7);};}exports['register']=function(_0xf450b3){for(var _0x7917c5=0x0,_0x1c941c=events['length'];_0x7917c5<_0x1c941c;_0x7917c5++){var _0x13a8f0=events[_0x7917c5];var _0xd3ae04=createListener('faxInteraction:'+_0x13a8f0,_0xf450b3);FaxInteractionEvents['on'](_0x13a8f0,_0xd3ae04);}}; \ No newline at end of file +var _0x684e=['removeListener','length','./faxInteraction.events','save','remove','update','emit'];(function(_0x3d45ce,_0x3ea46a){var _0x5defe5=function(_0x1f95c0){while(--_0x1f95c0){_0x3d45ce['push'](_0x3d45ce['shift']());}};_0x5defe5(++_0x3ea46a);}(_0x684e,0x1a6));var _0xe684=function(_0x25ba25,_0x3f3ee7){_0x25ba25=_0x25ba25-0x0;var _0x3dd671=_0x684e[_0x25ba25];return _0x3dd671;};'use strict';var FaxInteractionEvents=require(_0xe684('0x0'));var events=[_0xe684('0x1'),_0xe684('0x2'),_0xe684('0x3')];function createListener(_0x398dac,_0x26e7c4){return function(_0x560f03){_0x26e7c4[_0xe684('0x4')](_0x398dac,_0x560f03);};}function removeListener(_0x2fb612,_0xcf8b30){return function(){FaxInteractionEvents[_0xe684('0x5')](_0x2fb612,_0xcf8b30);};}exports['register']=function(_0x41dbaf){for(var _0xcb9bc2=0x0,_0x3d67ab=events[_0xe684('0x6')];_0xcb9bc2<_0x3d67ab;_0xcb9bc2++){var _0x5af74d=events[_0xcb9bc2];var _0x48173e=createListener('faxInteraction:'+_0x5af74d,_0x41dbaf);FaxInteractionEvents['on'](_0x5af74d,_0x48173e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7709dd3..0308d38 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 _0x12c9=['update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe','download','post','/:id/messages','addMessage','fax','faxinteraction:addtags','put','/:id','tracked','faxinteraction:update'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x12c9,0x1c9));var _0x912c=function(_0x5e5b30,_0x1d922f){_0x5e5b30=_0x5e5b30-0x0;var _0x249e28=_0x12c9[_0x5e5b30];return _0x249e28;};'use strict';var multer=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var path=require(_0x912c('0x2'));var timeout=require(_0x912c('0x3'));var express=require(_0x912c('0x4'));var router=express['Router']();var auth=require(_0x912c('0x5'));var interaction=require(_0x912c('0x6'));var config=require(_0x912c('0x7'));var controller=require(_0x912c('0x8'));router[_0x912c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x912c('0x9')](_0x912c('0xa'),auth[_0x912c('0xb')](),controller[_0x912c('0xc')]);router[_0x912c('0x9')]('/:id',auth[_0x912c('0xb')](),controller['show']);router[_0x912c('0x9')]('/:id/messages',auth[_0x912c('0xb')](),controller['getMessages']);router[_0x912c('0x9')]('/:id/download',auth[_0x912c('0xb')](),controller[_0x912c('0xd')]);router['post']('/',auth[_0x912c('0xb')](),controller['create']);router[_0x912c('0xe')](_0x912c('0xf'),auth[_0x912c('0xb')](),controller[_0x912c('0x10')]);router[_0x912c('0xe')]('/:id/tags',auth[_0x912c('0xb')](),interaction['tracked'](_0x912c('0x11'),_0x912c('0x12')),controller['addTags']);router[_0x912c('0x13')](_0x912c('0x14'),auth[_0x912c('0xb')](),interaction[_0x912c('0x15')](_0x912c('0x11'),_0x912c('0x16')),controller[_0x912c('0x17')]);router[_0x912c('0x18')](_0x912c('0x14'),auth[_0x912c('0xb')](),interaction['tracked'](_0x912c('0x11'),_0x912c('0x19')),controller[_0x912c('0x1a')]);router[_0x912c('0x18')](_0x912c('0x1b'),auth[_0x912c('0xb')](),controller[_0x912c('0x1c')]);module[_0x912c('0x1d')]=router; \ No newline at end of file +var _0xcb18=['./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:destroy','destroy','removeTags','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20236b,_0x5c9ecf){var _0x6743f7=function(_0x20538a){while(--_0x20538a){_0x20236b['push'](_0x20236b['shift']());}};_0x6743f7(++_0x5c9ecf);}(_0xcb18,0x159));var _0x8cb1=function(_0x3dec59,_0x3007d2){_0x3dec59=_0x3dec59-0x0;var _0x98c338=_0xcb18[_0x3dec59];return _0x98c338;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var auth=require(_0x8cb1('0x2'));var interaction=require(_0x8cb1('0x3'));var config=require(_0x8cb1('0x4'));var controller=require(_0x8cb1('0x5'));router[_0x8cb1('0x6')]('/',auth[_0x8cb1('0x7')](),controller['index']);router[_0x8cb1('0x6')](_0x8cb1('0x8'),auth['isAuthenticated'](),controller[_0x8cb1('0x9')]);router['get'](_0x8cb1('0xa'),auth[_0x8cb1('0x7')](),controller['show']);router[_0x8cb1('0x6')](_0x8cb1('0xb'),auth[_0x8cb1('0x7')](),controller[_0x8cb1('0xc')]);router[_0x8cb1('0x6')]('/:id/download',auth[_0x8cb1('0x7')](),controller[_0x8cb1('0xd')]);router[_0x8cb1('0xe')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0xf')]);router[_0x8cb1('0xe')](_0x8cb1('0xb'),auth[_0x8cb1('0x7')](),controller[_0x8cb1('0x10')]);router[_0x8cb1('0xe')]('/:id/tags',auth[_0x8cb1('0x7')](),interaction['tracked'](_0x8cb1('0x11'),_0x8cb1('0x12')),controller[_0x8cb1('0x13')]);router[_0x8cb1('0x14')](_0x8cb1('0xa'),auth[_0x8cb1('0x7')](),interaction['tracked'](_0x8cb1('0x11'),'faxinteraction:update'),controller['update']);router['delete'](_0x8cb1('0xa'),auth[_0x8cb1('0x7')](),interaction[_0x8cb1('0x15')]('fax',_0x8cb1('0x16')),controller[_0x8cb1('0x17')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x8cb1('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f4992ff..6ad5593 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 _0x65c2=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x65c2,0x1cf));var _0x265c=function(_0x1399d1,_0x40b592){_0x1399d1=_0x1399d1-0x0;var _0x2ce4b2=_0x65c2[_0x1399d1];return _0x2ce4b2;};'use strict';var Sequelize=require(_0x265c('0x0'));module[_0x265c('0x1')]={'body':{'type':Sequelize[_0x265c('0x2')](_0x265c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x265c('0x4')]('in',_0x265c('0x5')),'defaultValue':_0x265c('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x265c('0x6')]}}; \ No newline at end of file +var _0x0840=['TEXT','medium','BOOLEAN','out','sequelize','exports'];(function(_0x1a52c9,_0x1167a1){var _0x2a486b=function(_0x31914c){while(--_0x31914c){_0x1a52c9['push'](_0x1a52c9['shift']());}};_0x2a486b(++_0x1167a1);}(_0x0840,0x13c));var _0x0084=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x0840[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require(_0x0084('0x0'));module[_0x0084('0x1')]={'body':{'type':Sequelize[_0x0084('0x2')](_0x0084('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0084('0x5')),'defaultValue':_0x0084('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 380b2a3..0f22546 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 _0x7f5d=['defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','FaxMessage','findAll','rows','catch','show','params','includeAll','find','body','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','interaction','get','info','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','ContactId','findOne','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0xe89e13,_0x2e7b4c){var _0x208190=function(_0x5e4167){while(--_0x5e4167){_0xe89e13['push'](_0xe89e13['shift']());}};_0x208190(++_0x2e7b4c);}(_0x7f5d,0xf5));var _0xd7f5=function(_0x330518,_0x30bb6b){_0x330518=_0x330518-0x0;var _0x12d432=_0x7f5d[_0x330518];return _0x12d432;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7f5('0x0'));var rimraf=require(_0xd7f5('0x1'));var zipdir=require(_0xd7f5('0x2'));var jsonpatch=require(_0xd7f5('0x3'));var rp=require(_0xd7f5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7f5('0x5'));var util=require(_0xd7f5('0x6'));var path=require('path');var sox=require(_0xd7f5('0x7'));var csv=require(_0xd7f5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7f5('0x9'));var squel=require(_0xd7f5('0xa'));var crypto=require(_0xd7f5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd7f5('0x8'));var querystring=require(_0xd7f5('0xc'));var Papa=require(_0xd7f5('0xd'));var Redis=require(_0xd7f5('0xe'));var authService=require(_0xd7f5('0xf'));var qs=require(_0xd7f5('0x10'));var as=require(_0xd7f5('0x11'));var hardwareService=require(_0xd7f5('0x12'));var logger=require(_0xd7f5('0x13'))(_0xd7f5('0x14'));var utils=require(_0xd7f5('0x15'));var config=require(_0xd7f5('0x16'));var db=require(_0xd7f5('0x17'))['db'];config[_0xd7f5('0x18')]=_[_0xd7f5('0x19')](config[_0xd7f5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7f5('0x1a'))(new Redis(config[_0xd7f5('0x18')]));require(_0xd7f5('0x1b'))[_0xd7f5('0x1c')](socket);var jayson=require(_0xd7f5('0x1d'));var client=jayson['client'][_0xd7f5('0x1e')]({'port':0x232c});var client9002=jayson[_0xd7f5('0x1f')][_0xd7f5('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4d5ffd,_0x47c3e3,_0x50377b){if(_0x50377b){var _0x2b330b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b330b[_0xd7f5('0x20')](_0x47c3e3)){return _0x4d5ffd;}else{throw new db['Sequelize']['ValidationError'](_0xd7f5('0x21'));}}else{return _0x4d5ffd;}}function respondWithRpcPromise(_0x368b72,_0x1fdeb7,_0x503dfd,_0x5f45d8){return new BPromise(function(_0x2ea5ea,_0x14418f){var _0x56d4cd=_0x5f45d8||client;return _0x56d4cd['request'](_0x368b72,_0x503dfd)[_0xd7f5('0x22')](function(_0x2c7e3e){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fdeb7,'request\x20sent');logger[_0xd7f5('0x23')](_0xd7f5('0x24'),_0x1fdeb7,_0xd7f5('0x25'),JSON[_0xd7f5('0x26')](_0x2c7e3e));if(_0x2c7e3e[_0xd7f5('0x27')]){if(_0x2c7e3e[_0xd7f5('0x27')][_0xd7f5('0x28')]===0x1f4){logger[_0xd7f5('0x27')](_0xd7f5('0x29'),_0x1fdeb7,_0x2c7e3e[_0xd7f5('0x27')][_0xd7f5('0x2a')]);return _0x14418f(_0x2c7e3e['error'][_0xd7f5('0x2a')]);}logger[_0xd7f5('0x27')](_0xd7f5('0x29'),_0x1fdeb7,_0x2c7e3e[_0xd7f5('0x27')][_0xd7f5('0x2a')]);return _0x2ea5ea(_0x2c7e3e['error'][_0xd7f5('0x2a')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fdeb7,_0xd7f5('0x25'));_0x2ea5ea(_0x2c7e3e[_0xd7f5('0x2b')][_0xd7f5('0x2a')]);}})['catch'](function(_0x330e33){logger[_0xd7f5('0x27')](_0xd7f5('0x29'),_0x1fdeb7,_0x330e33);_0x14418f(_0x330e33);});});}function respondWithStatusCode(_0x215658,_0x422534){_0x422534=_0x422534||0xcc;return function(_0x342b8e){if(_0x342b8e){return _0x215658[_0xd7f5('0x2c')](_0x422534);}return _0x215658[_0xd7f5('0x2d')](_0x422534)[_0xd7f5('0x2e')]();};}function respondWithResult(_0x43099a,_0x438136){_0x438136=_0x438136||0xc8;return function(_0x329afe){if(_0x329afe){return _0x43099a[_0xd7f5('0x2d')](_0x438136)['json'](_0x329afe);}};}function respondWithFilteredResult(_0x2c03ee,_0xf1315){return function(_0x2e40fa){if(_0x2e40fa){var _0x11a166=_0x2e40fa[_0xd7f5('0x2f')],_0x21ca5e=_0xf1315[_0xd7f5('0x30')],_0x42852b=_0xf1315[_0xd7f5('0x30')]+_0xf1315[_0xd7f5('0x31')],_0x5eabd2;if(_0x42852b>=_0x11a166){_0x42852b=_0x11a166;_0x5eabd2=0xc8;}else{_0x5eabd2=0xce;}_0x2c03ee[_0xd7f5('0x2d')](_0x5eabd2);return _0x2c03ee[_0xd7f5('0x32')](_0xd7f5('0x33'),_0x21ca5e+'-'+_0x42852b+'/'+_0x11a166)[_0xd7f5('0x34')](_0x2e40fa);}return null;};}function patchUpdates(_0x21273a){return function(_0xae2ebb){try{jsonpatch[_0xd7f5('0x35')](_0xae2ebb,_0x21273a,!![]);}catch(_0x3c0cc5){return BPromise['reject'](_0x3c0cc5);}return _0xae2ebb[_0xd7f5('0x36')]();};}function saveUpdates(_0x1e3f40,_0x5186ba){return function(_0x215d8f){if(_0x215d8f){return _0x215d8f[_0xd7f5('0x37')](_0x1e3f40)[_0xd7f5('0x22')](function(_0x3f2e80){return _0x3f2e80;});}return null;};}function removeEntity(_0x96bc9d,_0x11081){return function(_0x54262e){if(_0x54262e){return _0x54262e[_0xd7f5('0x38')]()[_0xd7f5('0x22')](function(){_0x96bc9d[_0xd7f5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326d9f,_0x29721d){return function(_0xb2d322){if(!_0xb2d322){_0x326d9f[_0xd7f5('0x2c')](0x194);}return _0xb2d322;};}function handleError(_0x520c4b,_0x4234f1){_0x4234f1=_0x4234f1||0x1f4;return function(_0x22cdeb){logger[_0xd7f5('0x27')](_0x22cdeb[_0xd7f5('0x39')]);if(_0x22cdeb[_0xd7f5('0x3a')]){delete _0x22cdeb['name'];}_0x520c4b[_0xd7f5('0x2d')](_0x4234f1)['send'](_0x22cdeb);};}exports['index']=function(_0x170442,_0x4bd143){var _0x224411={},_0x11a3da={},_0x15c586={'count':0x0,'rows':[]};var _0x25d4d3=_[_0xd7f5('0x3b')](db['FaxMessage'][_0xd7f5('0x3c')],function(_0x4d2957){return{'name':_0x4d2957[_0xd7f5('0x3d')],'type':_0x4d2957[_0xd7f5('0x3e')][_0xd7f5('0x3f')]};});_0x11a3da[_0xd7f5('0x40')]=_['map'](_0x25d4d3,'name');_0x11a3da['query']=_[_0xd7f5('0x41')](_0x170442[_0xd7f5('0x42')]);_0x11a3da[_0xd7f5('0x43')]=_[_0xd7f5('0x44')](_0x11a3da[_0xd7f5('0x40')],_0x11a3da[_0xd7f5('0x42')]);_0x224411['attributes']=_[_0xd7f5('0x44')](_0x11a3da[_0xd7f5('0x40')],qs[_0xd7f5('0x45')](_0x170442['query'][_0xd7f5('0x45')]));_0x224411['attributes']=_0x224411[_0xd7f5('0x46')][_0xd7f5('0x47')]?_0x224411[_0xd7f5('0x46')]:_0x11a3da[_0xd7f5('0x40')];if(!_0x170442[_0xd7f5('0x42')][_0xd7f5('0x48')](_0xd7f5('0x49'))){_0x224411['limit']=qs[_0xd7f5('0x31')](_0x170442[_0xd7f5('0x42')][_0xd7f5('0x31')]);_0x224411[_0xd7f5('0x30')]=qs[_0xd7f5('0x30')](_0x170442[_0xd7f5('0x42')][_0xd7f5('0x30')]);}_0x224411[_0xd7f5('0x4a')]=qs[_0xd7f5('0x4b')](_0x170442[_0xd7f5('0x42')][_0xd7f5('0x4b')]);_0x224411[_0xd7f5('0x4c')]=qs['filters'](_['pick'](_0x170442[_0xd7f5('0x42')],_0x11a3da[_0xd7f5('0x43')]),_0x25d4d3);if(_0x170442[_0xd7f5('0x42')][_0xd7f5('0x4d')]){_0x224411['where']=_[_0xd7f5('0x4e')](_0x224411[_0xd7f5('0x4c')],{'$or':_[_0xd7f5('0x3b')](_0x25d4d3,function(_0xcfb929){if(_0xcfb929['type']!=='VIRTUAL'){var _0x28a686={};_0x28a686[_0xcfb929[_0xd7f5('0x3a')]]={'$like':'%'+_0x170442['query'][_0xd7f5('0x4d')]+'%'};return _0x28a686;}})});}_0x224411=_[_0xd7f5('0x4e')]({},_0x224411,_0x170442[_0xd7f5('0x4f')]);var _0x2cb2d1={'where':_0x224411[_0xd7f5('0x4c')]};return db['FaxMessage']['count'](_0x2cb2d1)[_0xd7f5('0x22')](function(_0x503d97){_0x15c586['count']=_0x503d97;if(_0x170442[_0xd7f5('0x42')]['includeAll']){_0x224411[_0xd7f5('0x50')]=[{'all':!![]}];}return db[_0xd7f5('0x51')][_0xd7f5('0x52')](_0x224411);})[_0xd7f5('0x22')](function(_0x1e75ca){_0x15c586[_0xd7f5('0x53')]=_0x1e75ca;return _0x15c586;})['then'](respondWithFilteredResult(_0x4bd143,_0x224411))[_0xd7f5('0x54')](handleError(_0x4bd143,null));};exports[_0xd7f5('0x55')]=function(_0x21cbb0,_0x542a49){var _0x4b236a={'raw':!![],'where':{'id':_0x21cbb0[_0xd7f5('0x56')]['id']}},_0x1dfdef={};_0x1dfdef[_0xd7f5('0x40')]=_[_0xd7f5('0x41')](db['FaxMessage'][_0xd7f5('0x3c')]);_0x1dfdef[_0xd7f5('0x42')]=_[_0xd7f5('0x41')](_0x21cbb0[_0xd7f5('0x42')]);_0x1dfdef[_0xd7f5('0x43')]=_[_0xd7f5('0x44')](_0x1dfdef[_0xd7f5('0x40')],_0x1dfdef[_0xd7f5('0x42')]);_0x4b236a['attributes']=_[_0xd7f5('0x44')](_0x1dfdef[_0xd7f5('0x40')],qs[_0xd7f5('0x45')](_0x21cbb0[_0xd7f5('0x42')][_0xd7f5('0x45')]));_0x4b236a['attributes']=_0x4b236a[_0xd7f5('0x46')][_0xd7f5('0x47')]?_0x4b236a[_0xd7f5('0x46')]:_0x1dfdef[_0xd7f5('0x40')];if(_0x21cbb0[_0xd7f5('0x42')][_0xd7f5('0x57')]){_0x4b236a['include']=[{'all':!![]}];}_0x4b236a=_[_0xd7f5('0x4e')]({},_0x4b236a,_0x21cbb0[_0xd7f5('0x4f')]);return db[_0xd7f5('0x51')][_0xd7f5('0x58')](_0x4b236a)[_0xd7f5('0x22')](handleEntityNotFound(_0x542a49,null))[_0xd7f5('0x22')](respondWithResult(_0x542a49,null))[_0xd7f5('0x54')](handleError(_0x542a49,null));};exports[_0xd7f5('0x37')]=function(_0x413c39,_0x4bee4c){if(_0x413c39[_0xd7f5('0x59')]['id']){delete _0x413c39['body']['id'];}return db['FaxMessage'][_0xd7f5('0x58')]({'where':{'id':_0x413c39[_0xd7f5('0x56')]['id']}})[_0xd7f5('0x22')](handleEntityNotFound(_0x4bee4c,null))[_0xd7f5('0x22')](saveUpdates(_0x413c39[_0xd7f5('0x59')],null))['then'](respondWithResult(_0x4bee4c,null))[_0xd7f5('0x54')](handleError(_0x4bee4c,null));};exports[_0xd7f5('0x38')]=function(_0x4ea770,_0x132100){return db['FaxMessage']['find']({'where':{'id':_0x4ea770[_0xd7f5('0x56')]['id']}})['then'](handleEntityNotFound(_0x132100,null))[_0xd7f5('0x22')](removeEntity(_0x132100,null))[_0xd7f5('0x54')](handleError(_0x132100,null));};exports[_0xd7f5('0x5a')]=function(_0x40851d,_0x3b7196){return db[_0xd7f5('0x51')][_0xd7f5('0x5a')]()[_0xd7f5('0x22')](respondWithResult(_0x3b7196,null))[_0xd7f5('0x54')](handleError(_0x3b7196,null));};var interaction_log=require('../../config/logger')(_0xd7f5('0x5b'));exports[_0xd7f5('0x5c')]=function(_0x4c2193,_0xa9789b,_0x3a03ac){var _0x53ceb0={'channel':_0xd7f5('0x5d')};if(_0x4c2193[_0xd7f5('0x59')]['id']){delete _0x4c2193['body']['id'];}_0x4c2193[_0xd7f5('0x59')]['read']=!![];_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x5e')]=moment()[_0xd7f5('0x5f')](_0xd7f5('0x60'));_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x61')]=_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x61')]||_0x4c2193[_0xd7f5('0x62')]['id'];return db[_0xd7f5('0x51')]['find']({'where':{'id':_0x4c2193[_0xd7f5('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xd7f5('0x63')],'as':_0xd7f5('0x64')}]})[_0xd7f5('0x22')](handleEntityNotFound(_0xa9789b,null))[_0xd7f5('0x22')](saveUpdates(_0x4c2193[_0xd7f5('0x59')],null))['then'](function(_0x51db33){if(_0x51db33){_0x53ceb0[_0xd7f5('0x2a')]=_0x51db33['get']({'plain':!![]});return db[_0xd7f5('0x65')][_0xd7f5('0x58')]({'where':{'id':_0x51db33[_0xd7f5('0x66')]}});}return null;})[_0xd7f5('0x22')](handleEntityNotFound(_0xa9789b,null))['then'](function(_0xeda450){if(_0xeda450){return _0xeda450[_0xd7f5('0x37')]({'UserId':_0x4c2193['body'][_0xd7f5('0x61')],'read1stAt':_[_0xd7f5('0x67')](_0xeda450['read1stAt'])?moment()[_0xd7f5('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd7f5('0x22')](function(_0x42a477){if(_0x42a477){_0x53ceb0[_0xd7f5('0x68')]=_0x42a477[_0xd7f5('0x69')]({'plain':!![]});interaction_log[_0xd7f5('0x6a')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c2193[_0xd7f5('0x62')]['id'],_0x4c2193[_0xd7f5('0x62')]['name'],_0x4c2193['user'][_0xd7f5('0x6b')],_0x53ceb0[_0xd7f5('0x68')]['id'],_0x4c2193[_0xd7f5('0x59')]?JSON[_0xd7f5('0x26')](_0x4c2193['body']):_0xd7f5('0x6c'));return respondWithRpcPromise(_0xd7f5('0x6d'),'acceptMessage',_0x53ceb0);}return null;})['then'](function(_0x2bfd8d){if(_0x2bfd8d){if(_0x4c2193[_0xd7f5('0x59')][_0xd7f5('0x6e')]){_0x53ceb0[_0xd7f5('0x2a')]['interface']=util[_0xd7f5('0x5f')](_0xd7f5('0x6f'),_0x4c2193[_0xd7f5('0x62')][_0xd7f5('0x3a')]);_0x53ceb0['message'][_0xd7f5('0x70')]=_0x53ceb0[_0xd7f5('0x70')];_0x53ceb0['message'][_0xd7f5('0x71')]=_0xd7f5('0x5c');return respondWithRpcPromise(_0xd7f5('0x72'),_0xd7f5('0x72'),{'event':_0xd7f5('0x73'),'message':_0x53ceb0[_0xd7f5('0x2a')]},client9002)[_0xd7f5('0x22')](function(){return _0x53ceb0;});}return _0x53ceb0;}return null;})[_0xd7f5('0x22')](respondWithResult(_0xa9789b,null))['catch'](handleError(_0xa9789b,null));};var interaction_log=require(_0xd7f5('0x13'))(_0xd7f5('0x5b'));exports[_0xd7f5('0x74')]=function(_0x2a31e1,_0x33408a,_0x367940){var _0x4a0a99={'agent':{},'channel':_0xd7f5('0x5d')};if(_0x2a31e1['body']['id']){delete _0x2a31e1[_0xd7f5('0x59')]['id'];}_0x2a31e1['body']['UserId']=_0x2a31e1[_0xd7f5('0x59')][_0xd7f5('0x61')]||_0x2a31e1['user']['id'];_0x4a0a99[_0xd7f5('0x75')]['id']=_0x2a31e1[_0xd7f5('0x59')][_0xd7f5('0x61')];return db[_0xd7f5('0x51')][_0xd7f5('0x58')]({'where':{'id':_0x2a31e1[_0xd7f5('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33408a,null))[_0xd7f5('0x22')](function(_0x2e0feb){if(_0x2e0feb){_0x4a0a99['message']=_0x2e0feb[_0xd7f5('0x69')]({'plain':!![]});return db[_0xd7f5('0x65')][_0xd7f5('0x58')]({'where':{'id':_0x2e0feb['FaxInteractionId']}});}return null;})[_0xd7f5('0x22')](handleEntityNotFound(_0x33408a,null))['then'](function(_0x392398){if(_0x392398){_0x4a0a99[_0xd7f5('0x68')]=_0x392398[_0xd7f5('0x69')]({'plain':!![]});interaction_log[_0xd7f5('0x6a')](_0xd7f5('0x76'),_0x2a31e1[_0xd7f5('0x62')]['id'],_0x2a31e1[_0xd7f5('0x62')][_0xd7f5('0x3a')],_0x2a31e1[_0xd7f5('0x62')][_0xd7f5('0x6b')],_0x4a0a99[_0xd7f5('0x68')]['id'],_0x2a31e1['body']?JSON['stringify'](_0x2a31e1[_0xd7f5('0x59')]):'null');return respondWithRpcPromise(_0xd7f5('0x77'),_0xd7f5('0x78'),_0x4a0a99);}return null;})[_0xd7f5('0x22')](function(_0x264beb){if(_0x264beb){_0x264beb[_0xd7f5('0x2a')]['interface']=util[_0xd7f5('0x5f')](_0xd7f5('0x6f'),_0x2a31e1[_0xd7f5('0x62')][_0xd7f5('0x3a')]);_0x264beb[_0xd7f5('0x2a')][_0xd7f5('0x70')]=_0x4a0a99[_0xd7f5('0x70')];_0x264beb['message'][_0xd7f5('0x71')]='reject';respondWithRpcPromise(_0xd7f5('0x72'),'EventManager',{'event':_0xd7f5('0x79'),'message':_0x264beb[_0xd7f5('0x2a')]},client9002);return _0x4a0a99;}return null;})[_0xd7f5('0x22')](respondWithResult(_0x33408a,null))[_0xd7f5('0x54')](handleError(_0x33408a,null));};exports[_0xd7f5('0x7a')]=function(_0xabb394,_0x40a2c1){var _0x354aaa;return db[_0xd7f5('0x51')][_0xd7f5('0x7a')](_0xabb394[_0xd7f5('0x59')],{})[_0xd7f5('0x22')](function(_0x4eab69){_0x354aaa=_0x4eab69;return db[_0xd7f5('0x63')]['findOne']({'where':{'id':_0x354aaa[_0xd7f5('0x7b')]}});})[_0xd7f5('0x22')](function(_0x1bde5e){if(_[_0xd7f5('0x67')](_0x1bde5e)){return;}else{_0x354aaa[_0xd7f5('0x5d')]=_0x1bde5e[_0xd7f5('0x5d')];return db['Attachment'][_0xd7f5('0x7c')]({'where':{'id':_0x354aaa[_0xd7f5('0x7d')]}});}})['then'](function(_0x5c01f3){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xd7f5('0x67')](_0xabb394[_0xd7f5('0x59')])?undefined:_0xabb394[_0xd7f5('0x59')][_0xd7f5('0x7e')],'path':_['isNil'](_0x5c01f3)?undefined:util[_0xd7f5('0x5f')](_0xd7f5('0x7f'),_0x5c01f3[_0xd7f5('0x80')]),'fax':_[_0xd7f5('0x67')](_0x354aaa[_0xd7f5('0x5d')])?undefined:_0x354aaa[_0xd7f5('0x5d')],'AttachmentId':_0x354aaa[_0xd7f5('0x7d')]},client9002);})[_0xd7f5('0x22')](respondWithResult(_0x40a2c1,0xc9))[_0xd7f5('0x54')](handleError(_0x40a2c1,null));};exports[_0xd7f5('0x81')]=function(_0x4a07b6,_0x221798){var _0xbf80b6=path[_0xd7f5('0x82')](config['root'],_0xd7f5('0x83'),_0xd7f5('0x84'),_0xd7f5('0x85'));return db[_0xd7f5('0x51')][_0xd7f5('0x58')]({'where':{'id':_0x4a07b6[_0xd7f5('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xd7f5('0x86')}]})[_0xd7f5('0x22')](handleEntityNotFound(_0x221798,null))[_0xd7f5('0x22')](function(_0x3a6702){if(_0x3a6702){return _0x221798[_0xd7f5('0x81')](path[_0xd7f5('0x82')](_0xbf80b6,_0x3a6702['Attachment'][_0xd7f5('0x80')]));}})[_0xd7f5('0x54')](handleError(_0x221798,null));}; \ No newline at end of file +var _0x786a=['EventManager','reject','agent','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','basename','root','server','files','attachments','Attachment','join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','status','json','count','offset','set','Content-Range','save','update','destroy','end','sendStatus','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0x786a,0x12c));var _0xa786=function(_0x5d3ef0,_0x58f63e){_0x5d3ef0=_0x5d3ef0-0x0;var _0x5a6ae3=_0x786a[_0x5d3ef0];return _0x5a6ae3;};'use strict';var pdf=require(_0xa786('0x0'));var emlformat=require(_0xa786('0x1'));var rimraf=require(_0xa786('0x2'));var zipdir=require(_0xa786('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa786('0x4'));var moment=require(_0xa786('0x5'));var BPromise=require(_0xa786('0x6'));var Mustache=require(_0xa786('0x7'));var util=require(_0xa786('0x8'));var path=require(_0xa786('0x9'));var sox=require('sox');var csv=require(_0xa786('0xa'));var ejs=require(_0xa786('0xb'));var fs=require('fs');var _=require(_0xa786('0xc'));var squel=require('squel');var crypto=require(_0xa786('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa786('0xa'));var querystring=require(_0xa786('0xe'));var Papa=require(_0xa786('0xf'));var Redis=require(_0xa786('0x10'));var authService=require(_0xa786('0x11'));var qs=require(_0xa786('0x12'));var as=require(_0xa786('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa786('0x14'))(_0xa786('0x15'));var utils=require('../../config/utils');var config=require(_0xa786('0x16'));var db=require(_0xa786('0x17'))['db'];config['redis']=_[_0xa786('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa786('0x19'))(new Redis(config['redis']));require(_0xa786('0x1a'))[_0xa786('0x1b')](socket);var jayson=require(_0xa786('0x1c'));var client=jayson[_0xa786('0x1d')][_0xa786('0x1e')]({'port':0x232c});var client9002=jayson[_0xa786('0x1d')][_0xa786('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x828375,_0x5745a5,_0x392ac8){if(_0x392ac8){var _0x4195f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4195f3[_0xa786('0x1f')](_0x5745a5)){return _0x828375;}else{throw new db[(_0xa786('0x20'))]['ValidationError'](_0xa786('0x21'));}}else{return _0x828375;}}function respondWithRpcPromise(_0x2e2ca9,_0xc4616,_0xe2985c,_0x3e544c){return new BPromise(function(_0x26769b,_0x53f69c){var _0x5d855b=_0x3e544c||client;return _0x5d855b[_0xa786('0x22')](_0x2e2ca9,_0xe2985c)[_0xa786('0x23')](function(_0x535cbc){logger['info']('FaxMessage,\x20%s,\x20%s',_0xc4616,_0xa786('0x24'));logger[_0xa786('0x25')](_0xa786('0x26'),_0xc4616,_0xa786('0x24'),JSON['stringify'](_0x535cbc));if(_0x535cbc['error']){if(_0x535cbc[_0xa786('0x27')][_0xa786('0x28')]===0x1f4){logger['error'](_0xa786('0x29'),_0xc4616,_0x535cbc[_0xa786('0x27')][_0xa786('0x2a')]);return _0x53f69c(_0x535cbc[_0xa786('0x27')][_0xa786('0x2a')]);}logger[_0xa786('0x27')](_0xa786('0x29'),_0xc4616,_0x535cbc['error'][_0xa786('0x2a')]);return _0x26769b(_0x535cbc['error'][_0xa786('0x2a')]);}else{logger[_0xa786('0x2b')]('FaxMessage,\x20%s,\x20%s',_0xc4616,_0xa786('0x24'));_0x26769b(_0x535cbc['result'][_0xa786('0x2a')]);}})[_0xa786('0x2c')](function(_0x17264e){logger[_0xa786('0x27')](_0xa786('0x29'),_0xc4616,_0x17264e);_0x53f69c(_0x17264e);});});}function respondWithStatusCode(_0x40b318,_0x14d757){_0x14d757=_0x14d757||0xcc;return function(_0x3cff0c){if(_0x3cff0c){return _0x40b318['sendStatus'](_0x14d757);}return _0x40b318['status'](_0x14d757)['end']();};}function respondWithResult(_0x1f1bae,_0xa4df48){_0xa4df48=_0xa4df48||0xc8;return function(_0x3c03b7){if(_0x3c03b7){return _0x1f1bae[_0xa786('0x2d')](_0xa4df48)[_0xa786('0x2e')](_0x3c03b7);}};}function respondWithFilteredResult(_0x1bebd3,_0x4b23b8){return function(_0xa8efaf){if(_0xa8efaf){var _0x2506fb=_0xa8efaf[_0xa786('0x2f')],_0x11743d=_0x4b23b8[_0xa786('0x30')],_0x15b05a=_0x4b23b8['offset']+_0x4b23b8['limit'],_0x505480;if(_0x15b05a>=_0x2506fb){_0x15b05a=_0x2506fb;_0x505480=0xc8;}else{_0x505480=0xce;}_0x1bebd3['status'](_0x505480);return _0x1bebd3[_0xa786('0x31')](_0xa786('0x32'),_0x11743d+'-'+_0x15b05a+'/'+_0x2506fb)[_0xa786('0x2e')](_0xa8efaf);}return null;};}function patchUpdates(_0x36c72e){return function(_0x1cc9c9){try{jsonpatch['apply'](_0x1cc9c9,_0x36c72e,!![]);}catch(_0x2b040f){return BPromise['reject'](_0x2b040f);}return _0x1cc9c9[_0xa786('0x33')]();};}function saveUpdates(_0x37cc45,_0xe6e5e3){return function(_0x5aecdd){if(_0x5aecdd){return _0x5aecdd[_0xa786('0x34')](_0x37cc45)[_0xa786('0x23')](function(_0x47698d){return _0x47698d;});}return null;};}function removeEntity(_0x296eb8,_0x1b873a){return function(_0x469d5f){if(_0x469d5f){return _0x469d5f[_0xa786('0x35')]()[_0xa786('0x23')](function(){_0x296eb8[_0xa786('0x2d')](0xcc)[_0xa786('0x36')]();});}};}function handleEntityNotFound(_0x2eca21,_0x2c3042){return function(_0x301bac){if(!_0x301bac){_0x2eca21[_0xa786('0x37')](0x194);}return _0x301bac;};}function handleError(_0x3172ff,_0x137ffb){_0x137ffb=_0x137ffb||0x1f4;return function(_0x8f073c){logger[_0xa786('0x27')](_0x8f073c['stack']);if(_0x8f073c[_0xa786('0x38')]){delete _0x8f073c[_0xa786('0x38')];}_0x3172ff[_0xa786('0x2d')](_0x137ffb)[_0xa786('0x39')](_0x8f073c);};}exports[_0xa786('0x3a')]=function(_0x26bcdd,_0x40fe22){var _0x33e02e={},_0x24674b={},_0x480d9f={'count':0x0,'rows':[]};var _0xf5b3fa=_[_0xa786('0x3b')](db[_0xa786('0x3c')]['rawAttributes'],function(_0x5411c0){return{'name':_0x5411c0[_0xa786('0x3d')],'type':_0x5411c0[_0xa786('0x3e')][_0xa786('0x3f')]};});_0x24674b[_0xa786('0x40')]=_['map'](_0xf5b3fa,_0xa786('0x38'));_0x24674b[_0xa786('0x41')]=_[_0xa786('0x42')](_0x26bcdd[_0xa786('0x41')]);_0x24674b['filters']=_[_0xa786('0x43')](_0x24674b[_0xa786('0x40')],_0x24674b[_0xa786('0x41')]);_0x33e02e['attributes']=_['intersection'](_0x24674b[_0xa786('0x40')],qs[_0xa786('0x44')](_0x26bcdd[_0xa786('0x41')][_0xa786('0x44')]));_0x33e02e[_0xa786('0x45')]=_0x33e02e[_0xa786('0x45')][_0xa786('0x46')]?_0x33e02e[_0xa786('0x45')]:_0x24674b[_0xa786('0x40')];if(!_0x26bcdd[_0xa786('0x41')][_0xa786('0x47')](_0xa786('0x48'))){_0x33e02e[_0xa786('0x49')]=qs[_0xa786('0x49')](_0x26bcdd[_0xa786('0x41')]['limit']);_0x33e02e[_0xa786('0x30')]=qs[_0xa786('0x30')](_0x26bcdd[_0xa786('0x41')][_0xa786('0x30')]);}_0x33e02e[_0xa786('0x4a')]=qs[_0xa786('0x4b')](_0x26bcdd[_0xa786('0x41')][_0xa786('0x4b')]);_0x33e02e[_0xa786('0x4c')]=qs[_0xa786('0x4d')](_['pick'](_0x26bcdd[_0xa786('0x41')],_0x24674b[_0xa786('0x4d')]),_0xf5b3fa);if(_0x26bcdd['query'][_0xa786('0x4e')]){_0x33e02e['where']=_['merge'](_0x33e02e[_0xa786('0x4c')],{'$or':_['map'](_0xf5b3fa,function(_0x4576ce){if(_0x4576ce[_0xa786('0x3e')]!=='VIRTUAL'){var _0xf6564e={};_0xf6564e[_0x4576ce[_0xa786('0x38')]]={'$like':'%'+_0x26bcdd[_0xa786('0x41')][_0xa786('0x4e')]+'%'};return _0xf6564e;}})});}_0x33e02e=_[_0xa786('0x4f')]({},_0x33e02e,_0x26bcdd[_0xa786('0x50')]);var _0x4092f8={'where':_0x33e02e[_0xa786('0x4c')]};return db[_0xa786('0x3c')][_0xa786('0x2f')](_0x4092f8)[_0xa786('0x23')](function(_0x34bcd1){_0x480d9f['count']=_0x34bcd1;if(_0x26bcdd[_0xa786('0x41')][_0xa786('0x51')]){_0x33e02e[_0xa786('0x52')]=[{'all':!![]}];}return db[_0xa786('0x3c')][_0xa786('0x53')](_0x33e02e);})[_0xa786('0x23')](function(_0x4da4ff){_0x480d9f[_0xa786('0x54')]=_0x4da4ff;return _0x480d9f;})['then'](respondWithFilteredResult(_0x40fe22,_0x33e02e))['catch'](handleError(_0x40fe22,null));};exports[_0xa786('0x55')]=function(_0x318c6b,_0x2a4624){var _0x818247={'raw':!![],'where':{'id':_0x318c6b[_0xa786('0x56')]['id']}},_0x4c5bef={};_0x4c5bef[_0xa786('0x40')]=_['keys'](db['FaxMessage'][_0xa786('0x57')]);_0x4c5bef[_0xa786('0x41')]=_[_0xa786('0x42')](_0x318c6b[_0xa786('0x41')]);_0x4c5bef[_0xa786('0x4d')]=_[_0xa786('0x43')](_0x4c5bef[_0xa786('0x40')],_0x4c5bef[_0xa786('0x41')]);_0x818247[_0xa786('0x45')]=_[_0xa786('0x43')](_0x4c5bef[_0xa786('0x40')],qs[_0xa786('0x44')](_0x318c6b['query']['fields']));_0x818247[_0xa786('0x45')]=_0x818247['attributes'][_0xa786('0x46')]?_0x818247[_0xa786('0x45')]:_0x4c5bef['model'];if(_0x318c6b[_0xa786('0x41')][_0xa786('0x51')]){_0x818247[_0xa786('0x52')]=[{'all':!![]}];}_0x818247=_[_0xa786('0x4f')]({},_0x818247,_0x318c6b['options']);return db[_0xa786('0x3c')][_0xa786('0x58')](_0x818247)[_0xa786('0x23')](handleEntityNotFound(_0x2a4624,null))[_0xa786('0x23')](respondWithResult(_0x2a4624,null))[_0xa786('0x2c')](handleError(_0x2a4624,null));};exports[_0xa786('0x34')]=function(_0x45c513,_0x1396f2){if(_0x45c513[_0xa786('0x59')]['id']){delete _0x45c513[_0xa786('0x59')]['id'];}return db['FaxMessage'][_0xa786('0x58')]({'where':{'id':_0x45c513['params']['id']}})[_0xa786('0x23')](handleEntityNotFound(_0x1396f2,null))[_0xa786('0x23')](saveUpdates(_0x45c513[_0xa786('0x59')],null))[_0xa786('0x23')](respondWithResult(_0x1396f2,null))['catch'](handleError(_0x1396f2,null));};exports[_0xa786('0x35')]=function(_0x4805b2,_0x108322){return db['FaxMessage'][_0xa786('0x58')]({'where':{'id':_0x4805b2[_0xa786('0x56')]['id']}})[_0xa786('0x23')](handleEntityNotFound(_0x108322,null))['then'](removeEntity(_0x108322,null))[_0xa786('0x2c')](handleError(_0x108322,null));};exports[_0xa786('0x5a')]=function(_0x2c4cd9,_0x136f86){return db['FaxMessage']['describe']()[_0xa786('0x23')](respondWithResult(_0x136f86,null))[_0xa786('0x2c')](handleError(_0x136f86,null));};var interaction_log=require(_0xa786('0x14'))(_0xa786('0x5b'));exports[_0xa786('0x5c')]=function(_0x5108bc,_0xd5e757,_0x3a994d){var _0x266197={'channel':_0xa786('0x5d')};if(_0x5108bc[_0xa786('0x59')]['id']){delete _0x5108bc[_0xa786('0x59')]['id'];}_0x5108bc['body'][_0xa786('0x5e')]=!![];_0x5108bc[_0xa786('0x59')][_0xa786('0x5f')]=moment()[_0xa786('0x60')](_0xa786('0x61'));_0x5108bc['body'][_0xa786('0x62')]=_0x5108bc[_0xa786('0x59')][_0xa786('0x62')]||_0x5108bc[_0xa786('0x63')]['id'];return db[_0xa786('0x3c')][_0xa786('0x58')]({'where':{'id':_0x5108bc[_0xa786('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa786('0x64')],'as':_0xa786('0x65')}]})['then'](handleEntityNotFound(_0xd5e757,null))['then'](saveUpdates(_0x5108bc['body'],null))[_0xa786('0x23')](function(_0x2a6ad3){if(_0x2a6ad3){_0x266197['message']=_0x2a6ad3['get']({'plain':!![]});return db[_0xa786('0x66')][_0xa786('0x58')]({'where':{'id':_0x2a6ad3[_0xa786('0x67')]}});}return null;})[_0xa786('0x23')](handleEntityNotFound(_0xd5e757,null))[_0xa786('0x23')](function(_0x3070a2){if(_0x3070a2){return _0x3070a2[_0xa786('0x34')]({'UserId':_0x5108bc['body'][_0xa786('0x62')],'read1stAt':_[_0xa786('0x68')](_0x3070a2[_0xa786('0x69')])?moment()[_0xa786('0x60')](_0xa786('0x61')):undefined});}return null;})[_0xa786('0x23')](function(_0x1f95d1){if(_0x1f95d1){_0x266197['interaction']=_0x1f95d1[_0xa786('0x6a')]({'plain':!![]});interaction_log[_0xa786('0x2b')](_0xa786('0x6b'),_0x5108bc['user']['id'],_0x5108bc[_0xa786('0x63')][_0xa786('0x38')],_0x5108bc[_0xa786('0x63')][_0xa786('0x6c')],_0x266197['interaction']['id'],_0x5108bc[_0xa786('0x59')]?JSON[_0xa786('0x6d')](_0x5108bc['body']):'null');return respondWithRpcPromise(_0xa786('0x6e'),_0xa786('0x6f'),_0x266197);}return null;})[_0xa786('0x23')](function(_0x13ec2e){if(_0x13ec2e){if(_0x5108bc['body'][_0xa786('0x70')]){_0x266197[_0xa786('0x2a')][_0xa786('0x71')]=util['format'](_0xa786('0x72'),_0x5108bc[_0xa786('0x63')][_0xa786('0x38')]);_0x266197[_0xa786('0x2a')][_0xa786('0x73')]=_0x266197[_0xa786('0x73')];_0x266197[_0xa786('0x2a')][_0xa786('0x74')]='accept';return respondWithRpcPromise(_0xa786('0x75'),'EventManager',{'event':'acceptmessage','message':_0x266197[_0xa786('0x2a')]},client9002)[_0xa786('0x23')](function(){return _0x266197;});}return _0x266197;}return null;})[_0xa786('0x23')](respondWithResult(_0xd5e757,null))[_0xa786('0x2c')](handleError(_0xd5e757,null));};var interaction_log=require(_0xa786('0x14'))(_0xa786('0x5b'));exports[_0xa786('0x76')]=function(_0x5a9b1a,_0x5870d4,_0x5f4437){var _0x2a365d={'agent':{},'channel':_0xa786('0x5d')};if(_0x5a9b1a[_0xa786('0x59')]['id']){delete _0x5a9b1a[_0xa786('0x59')]['id'];}_0x5a9b1a[_0xa786('0x59')][_0xa786('0x62')]=_0x5a9b1a['body'][_0xa786('0x62')]||_0x5a9b1a['user']['id'];_0x2a365d[_0xa786('0x77')]['id']=_0x5a9b1a['body'][_0xa786('0x62')];return db[_0xa786('0x3c')][_0xa786('0x58')]({'where':{'id':_0x5a9b1a[_0xa786('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5870d4,null))[_0xa786('0x23')](function(_0x551415){if(_0x551415){_0x2a365d[_0xa786('0x2a')]=_0x551415[_0xa786('0x6a')]({'plain':!![]});return db[_0xa786('0x66')]['find']({'where':{'id':_0x551415[_0xa786('0x67')]}});}return null;})[_0xa786('0x23')](handleEntityNotFound(_0x5870d4,null))['then'](function(_0x12cef6){if(_0x12cef6){_0x2a365d[_0xa786('0x78')]=_0x12cef6[_0xa786('0x6a')]({'plain':!![]});interaction_log['info'](_0xa786('0x79'),_0x5a9b1a['user']['id'],_0x5a9b1a['user']['name'],_0x5a9b1a[_0xa786('0x63')]['role'],_0x2a365d[_0xa786('0x78')]['id'],_0x5a9b1a[_0xa786('0x59')]?JSON[_0xa786('0x6d')](_0x5a9b1a[_0xa786('0x59')]):_0xa786('0x7a'));return respondWithRpcPromise(_0xa786('0x7b'),_0xa786('0x7c'),_0x2a365d);}return null;})[_0xa786('0x23')](function(_0x169f40){if(_0x169f40){_0x169f40['message'][_0xa786('0x71')]=util[_0xa786('0x60')](_0xa786('0x72'),_0x5a9b1a['user']['name']);_0x169f40[_0xa786('0x2a')]['channel']=_0x2a365d['channel'];_0x169f40[_0xa786('0x2a')][_0xa786('0x74')]=_0xa786('0x76');respondWithRpcPromise(_0xa786('0x75'),_0xa786('0x75'),{'event':_0xa786('0x7d'),'message':_0x169f40['message']},client9002);return _0x2a365d;}return null;})[_0xa786('0x23')](respondWithResult(_0x5870d4,null))[_0xa786('0x2c')](handleError(_0x5870d4,null));};exports[_0xa786('0x7e')]=function(_0x5f4bf6,_0x91a4f7){var _0xe11433;return db[_0xa786('0x3c')][_0xa786('0x7e')](_0x5f4bf6[_0xa786('0x59')],{})['then'](function(_0x3faff6){_0xe11433=_0x3faff6;return db[_0xa786('0x64')][_0xa786('0x7f')]({'where':{'id':_0xe11433[_0xa786('0x80')]}});})['then'](function(_0x313af1){if(_['isNil'](_0x313af1)){return;}else{_0xe11433[_0xa786('0x5d')]=_0x313af1[_0xa786('0x5d')];return db['Attachment']['findOne']({'where':{'id':_0xe11433[_0xa786('0x81')]}});}})[_0xa786('0x23')](function(_0x20dc0c){return respondWithRpcPromise(_0xa786('0x82'),_0xa786('0x82'),{'FaxAccountId':_[_0xa786('0x68')](_0x5f4bf6['body'])?undefined:_0x5f4bf6[_0xa786('0x59')][_0xa786('0x83')],'path':_[_0xa786('0x68')](_0x20dc0c)?undefined:util[_0xa786('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x20dc0c[_0xa786('0x84')]),'fax':_[_0xa786('0x68')](_0xe11433['fax'])?undefined:_0xe11433[_0xa786('0x5d')],'AttachmentId':_0xe11433['AttachmentId']},client9002);})[_0xa786('0x23')](respondWithResult(_0x91a4f7,0xc9))[_0xa786('0x2c')](handleError(_0x91a4f7,null));};exports['download']=function(_0x5ef33e,_0xbdfecc){var _0x59c9fe=path['join'](config[_0xa786('0x85')],_0xa786('0x86'),_0xa786('0x87'),_0xa786('0x88'));return db['FaxMessage'][_0xa786('0x58')]({'where':{'id':_0x5ef33e[_0xa786('0x56')]['id']},'include':[{'model':db[_0xa786('0x89')],'as':'Attachment'}]})[_0xa786('0x23')](handleEntityNotFound(_0xbdfecc,null))[_0xa786('0x23')](function(_0x4ab04c){if(_0x4ab04c){return _0xbdfecc['download'](path[_0xa786('0x8a')](_0x59c9fe,_0x4ab04c['Attachment'][_0xa786('0x84')]));}})['catch'](handleError(_0xbdfecc,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 7096e52..115d889 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x34e8,0x12c));var _0x834e=function(_0x5f2cbc,_0x282246){_0x5f2cbc=_0x5f2cbc-0x0;var _0x4f0351=_0x34e8[_0x5f2cbc];return _0x4f0351;};'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 +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x18770f,_0x2342c7){_0x18770f=_0x18770f-0x0;var _0x4a7e99=_0xe14b[_0x18770f];return _0x4a7e99;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e15acdd..6391259 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 _0x9dfb=['body','get','toLowerCase','out','secret','isNil','FaxInteraction','findOne','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','fti_fax_messages'];(function(_0x68a0b0,_0x2bba91){var _0x4b4ee6=function(_0x36f6da){while(--_0x36f6da){_0x68a0b0['push'](_0x68a0b0['shift']());}};_0x4b4ee6(++_0x2bba91);}(_0x9dfb,0x1a0));var _0xb9df=function(_0x1ac359,_0x53a9ba){_0x1ac359=_0x1ac359-0x0;var _0x35a575=_0x9dfb[_0x1ac359];return _0x35a575;};'use strict';var _=require('lodash');var util=require(_0xb9df('0x0'));var logger=require('../../config/logger')(_0xb9df('0x1'));var moment=require(_0xb9df('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9df('0x3'));var rimraf=require(_0xb9df('0x4'));var config=require(_0xb9df('0x5'));var attributes=require(_0xb9df('0x6'));module['exports']=function(_0x529414,_0x33174a){return _0x529414[_0xb9df('0x7')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb9df('0x8'),'fields':[_0xb9df('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25186d,_0x33e0ed,_0x3f1acd){var _0x5b3c3c=_0x529414['models'];var _0x2eaed4=_0x25186d[_0xb9df('0xa')]({'plain':!![]});if(_0x2eaed4['direction'][_0xb9df('0xb')]()==='in'||_0x2eaed4['direction'][_0xb9df('0xb')]()===_0xb9df('0xc')&&!_0x2eaed4[_0xb9df('0xd')]&&!_[_0xb9df('0xe')](_0x2eaed4['UserId'])){_0x5b3c3c[_0xb9df('0xf')][_0xb9df('0x10')]({'where':{'id':_0x2eaed4['FaxInteractionId']}})[_0xb9df('0x11')](function(_0x43dcec){if(_0x43dcec){_0x43dcec[_0xb9df('0x12')]({'lastMsgAt':_0x2eaed4[_0xb9df('0x13')],'lastMsgDirection':_0x2eaed4[_0xb9df('0x14')][_0xb9df('0xb')]()});}})[_0xb9df('0x15')](function(_0x3f5e35){console[_0xb9df('0x16')](_0x3f5e35);});}_0x3f1acd();}},'charset':_0xb9df('0x17'),'collate':_0xb9df('0x18')});}; \ No newline at end of file +var _0xe5b6=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error'];(function(_0x2e1ae1,_0x100544){var _0x203ccf=function(_0x209a5d){while(--_0x209a5d){_0x2e1ae1['push'](_0x2e1ae1['shift']());}};_0x203ccf(++_0x100544);}(_0xe5b6,0x1c4));var _0x6e5b=function(_0x37d54b,_0x206aa8){_0x37d54b=_0x37d54b-0x0;var _0x432046=_0xe5b6[_0x37d54b];return _0x432046;};'use strict';var _=require(_0x6e5b('0x0'));var util=require('util');var logger=require(_0x6e5b('0x1'))(_0x6e5b('0x2'));var moment=require(_0x6e5b('0x3'));var BPromise=require(_0x6e5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e5b('0x5'));var rimraf=require(_0x6e5b('0x6'));var config=require(_0x6e5b('0x7'));var attributes=require(_0x6e5b('0x8'));module[_0x6e5b('0x9')]=function(_0x376553,_0x2155a4){return _0x376553[_0x6e5b('0xa')](_0x6e5b('0xb'),attributes,{'tableName':_0x6e5b('0xc'),'paranoid':![],'indexes':[{'name':_0x6e5b('0xd'),'fields':[_0x6e5b('0xe')],'type':_0x6e5b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c3326,_0x105fa0,_0x166483){var _0x48c131=_0x376553['models'];var _0x3be583=_0x2c3326[_0x6e5b('0x10')]({'plain':!![]});if(_0x3be583[_0x6e5b('0x11')][_0x6e5b('0x12')]()==='in'||_0x3be583[_0x6e5b('0x11')]['toLowerCase']()==='out'&&!_0x3be583[_0x6e5b('0x13')]&&!_[_0x6e5b('0x14')](_0x3be583[_0x6e5b('0x15')])){_0x48c131[_0x6e5b('0x16')][_0x6e5b('0x17')]({'where':{'id':_0x3be583[_0x6e5b('0x18')]}})[_0x6e5b('0x19')](function(_0x5973f){if(_0x5973f){_0x5973f['update']({'lastMsgAt':_0x3be583[_0x6e5b('0x1a')],'lastMsgDirection':_0x3be583['direction'][_0x6e5b('0x12')]()});}})['catch'](function(_0x27ea64){console[_0x6e5b('0x1b')](_0x27ea64);});}_0x166483();}},'charset':_0x6e5b('0x1c'),'collate':_0x6e5b('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2a8131b..1189f34 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 _0xbe85=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','register','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','catch','CreateFaxMessage','FaxMessage','create','options','raw','UpdateFaxMessage','body','where','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1c9942,_0xe5dda3){var _0x3e0172=function(_0x3c8491){while(--_0x3c8491){_0x1c9942['push'](_0x1c9942['shift']());}};_0x3e0172(++_0xe5dda3);}(_0xbe85,0x19c));var _0x5be8=function(_0x1ff9f5,_0x310c70){_0x1ff9f5=_0x1ff9f5-0x0;var _0x3606ff=_0xbe85[_0x1ff9f5];return _0x3606ff;};'use strict';var _=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var moment=require(_0x5be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x5be8('0x3'));var fs=require('fs');var Redis=require(_0x5be8('0x4'));var db=require(_0x5be8('0x5'))['db'];var utils=require(_0x5be8('0x6'));var logger=require(_0x5be8('0x7'))(_0x5be8('0x8'));var config=require(_0x5be8('0x9'));var jayson=require(_0x5be8('0xa'));var client=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232a});config[_0x5be8('0xd')]=_[_0x5be8('0xe')](config[_0x5be8('0xd')],{'host':_0x5be8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5be8('0x10'))[_0x5be8('0x11')](socket);function respondWithRpcPromise(_0x1bd278,_0x40cf01,_0x182c0f){return new BPromise(function(_0x41e55d,_0x54c052){return client[_0x5be8('0x12')](_0x1bd278,_0x182c0f)[_0x5be8('0x13')](function(_0x50a107){logger['info']('FaxMessage,\x20%s,\x20%s',_0x40cf01,_0x5be8('0x14'));logger['debug'](_0x5be8('0x15'),_0x40cf01,_0x5be8('0x14'),JSON[_0x5be8('0x16')](_0x50a107));if(_0x50a107[_0x5be8('0x17')]){if(_0x50a107[_0x5be8('0x17')][_0x5be8('0x18')]===0x1f4){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x54c052(_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x41e55d(_0x50a107['error'][_0x5be8('0x1a')]);}else{logger[_0x5be8('0x1b')](_0x5be8('0x19'),_0x40cf01,'request\x20sent');_0x41e55d(_0x50a107['result'][_0x5be8('0x1a')]);}})[_0x5be8('0x1c')](function(_0x29515f){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x29515f);_0x54c052(_0x29515f);});});}exports[_0x5be8('0x1d')]=function(_0x342cb9){var _0x36b4a0=this;return new Promise(function(_0x58b54a,_0x55f63b){return db[_0x5be8('0x1e')][_0x5be8('0x1f')](_0x342cb9['body'],{'raw':_0x342cb9[_0x5be8('0x20')]?_0x342cb9[_0x5be8('0x20')][_0x5be8('0x21')]===undefined?!![]:![]:!![]})[_0x5be8('0x13')](function(_0x490e28){logger['info'](_0x5be8('0x1d'),_0x342cb9);logger['debug']('CreateFaxMessage',_0x342cb9,JSON['stringify'](_0x490e28));_0x58b54a(_0x490e28);})[_0x5be8('0x1c')](function(_0xf73049){logger[_0x5be8('0x17')]('CreateFaxMessage',_0xf73049[_0x5be8('0x1a')],_0x342cb9);_0x55f63b(_0x36b4a0[_0x5be8('0x17')](0x1f4,_0xf73049[_0x5be8('0x1a')]));});});};exports[_0x5be8('0x22')]=function(_0x5545b4){var _0x1ae1a2=this;return new Promise(function(_0x21dc5c,_0x164fa9){return db[_0x5be8('0x1e')]['update'](_0x5545b4[_0x5be8('0x23')],{'raw':_0x5545b4['options']?_0x5545b4[_0x5be8('0x20')][_0x5be8('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5545b4[_0x5be8('0x20')]?_0x5545b4[_0x5be8('0x20')][_0x5be8('0x24')]||null:null,'attributes':_0x5545b4['options']?_0x5545b4[_0x5be8('0x20')]['attributes']||null:null,'limit':_0x5545b4['options']?_0x5545b4['options']['limit']||null:null})[_0x5be8('0x13')](function(_0x2dee53){logger[_0x5be8('0x1b')](_0x5be8('0x22'),_0x5545b4);logger[_0x5be8('0x25')](_0x5be8('0x22'),_0x5545b4,JSON[_0x5be8('0x16')](_0x2dee53));_0x21dc5c(_0x2dee53);})[_0x5be8('0x1c')](function(_0x5080b2){logger['error'](_0x5be8('0x22'),_0x5080b2[_0x5be8('0x1a')],_0x5545b4);_0x164fa9(_0x1ae1a2['error'](0x1f4,_0x5080b2[_0x5be8('0x1a')]));});});}; \ No newline at end of file +var _0x705f=['info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','create','options','CreateFaxMessage','debug','stringify','UpdateFaxMessage','FaxMessage','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then'];(function(_0x32fe5b,_0x464e33){var _0x2440e5=function(_0x43522f){while(--_0x43522f){_0x32fe5b['push'](_0x32fe5b['shift']());}};_0x2440e5(++_0x464e33);}(_0x705f,0x1c2));var _0xf705=function(_0x2007cf,_0x42a0c1){_0x2007cf=_0x2007cf-0x0;var _0x60255c=_0x705f[_0x2007cf];return _0x60255c;};'use strict';var _=require(_0xf705('0x0'));var util=require(_0xf705('0x1'));var moment=require(_0xf705('0x2'));var BPromise=require(_0xf705('0x3'));var rs=require(_0xf705('0x4'));var fs=require('fs');var Redis=require(_0xf705('0x5'));var db=require(_0xf705('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf705('0x7'))(_0xf705('0x8'));var config=require('../../config/environment');var jayson=require(_0xf705('0x9'));var client=jayson[_0xf705('0xa')][_0xf705('0xb')]({'port':0x232a});config['redis']=_[_0xf705('0xc')](config[_0xf705('0xd')],{'host':_0xf705('0xe'),'port':0x18eb});var socket=require(_0xf705('0xf'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xf705('0x10')](socket);function respondWithRpcPromise(_0x2c9268,_0x2a0f7d,_0x4543fe){return new BPromise(function(_0x1ee8ed,_0x388e62){return client['request'](_0x2c9268,_0x4543fe)[_0xf705('0x11')](function(_0x21fe93){logger[_0xf705('0x12')](_0xf705('0x13'),_0x2a0f7d,_0xf705('0x14'));logger['debug'](_0xf705('0x15'),_0x2a0f7d,_0xf705('0x14'),JSON['stringify'](_0x21fe93));if(_0x21fe93[_0xf705('0x16')]){if(_0x21fe93[_0xf705('0x16')]['code']===0x1f4){logger[_0xf705('0x16')](_0xf705('0x13'),_0x2a0f7d,_0x21fe93[_0xf705('0x16')]['message']);return _0x388e62(_0x21fe93['error']['message']);}logger[_0xf705('0x16')]('FaxMessage,\x20%s,\x20%s',_0x2a0f7d,_0x21fe93[_0xf705('0x16')][_0xf705('0x17')]);return _0x1ee8ed(_0x21fe93[_0xf705('0x16')][_0xf705('0x17')]);}else{logger['info'](_0xf705('0x13'),_0x2a0f7d,'request\x20sent');_0x1ee8ed(_0x21fe93['result']['message']);}})[_0xf705('0x18')](function(_0x59231a){logger[_0xf705('0x16')]('FaxMessage,\x20%s,\x20%s',_0x2a0f7d,_0x59231a);_0x388e62(_0x59231a);});});}exports['CreateFaxMessage']=function(_0x10af1d){var _0x407aae=this;return new Promise(function(_0x194104,_0x2b993c){return db['FaxMessage'][_0xf705('0x19')](_0x10af1d['body'],{'raw':_0x10af1d[_0xf705('0x1a')]?_0x10af1d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2322ad){logger['info'](_0xf705('0x1b'),_0x10af1d);logger[_0xf705('0x1c')](_0xf705('0x1b'),_0x10af1d,JSON[_0xf705('0x1d')](_0x2322ad));_0x194104(_0x2322ad);})[_0xf705('0x18')](function(_0x1a8b6e){logger['error'](_0xf705('0x1b'),_0x1a8b6e[_0xf705('0x17')],_0x10af1d);_0x2b993c(_0x407aae[_0xf705('0x16')](0x1f4,_0x1a8b6e[_0xf705('0x17')]));});});};exports[_0xf705('0x1e')]=function(_0xbf7932){var _0x2f524f=this;return new Promise(function(_0x37279d,_0x100704){return db[_0xf705('0x1f')][_0xf705('0x20')](_0xbf7932['body'],{'raw':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')][_0xf705('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')][_0xf705('0x22')]||null:null,'attributes':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')]['attributes']||null:null,'limit':_0xbf7932[_0xf705('0x1a')]?_0xbf7932[_0xf705('0x1a')][_0xf705('0x23')]||null:null})['then'](function(_0x4630e4){logger[_0xf705('0x12')](_0xf705('0x1e'),_0xbf7932);logger[_0xf705('0x1c')](_0xf705('0x1e'),_0xbf7932,JSON['stringify'](_0x4630e4));_0x37279d(_0x4630e4);})[_0xf705('0x18')](function(_0x2aa156){logger[_0xf705('0x16')](_0xf705('0x1e'),_0x2aa156[_0xf705('0x17')],_0xbf7932);_0x100704(_0x2f524f[_0xf705('0x16')](0x1f4,_0x2aa156['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4afcaf9..852da57 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(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8655bcc..8cb13f1 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 _0xa100=['/:id','show','/:id/download','download','post','tracked','create','put','update','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x5322a1,_0x16a3bf){var _0x24d538=function(_0x51f436){while(--_0x51f436){_0x5322a1['push'](_0x5322a1['shift']());}};_0x24d538(++_0x16a3bf);}(_0xa100,0x1b1));var _0x0a10=function(_0x529724,_0xf7985d){_0x529724=_0x529724-0x0;var _0x4c0aa5=_0xa100[_0x529724];return _0x4c0aa5;};'use strict';var multer=require(_0x0a10('0x0'));var util=require(_0x0a10('0x1'));var path=require(_0x0a10('0x2'));var timeout=require(_0x0a10('0x3'));var express=require(_0x0a10('0x4'));var router=express[_0x0a10('0x5')]();var auth=require(_0x0a10('0x6'));var interaction=require(_0x0a10('0x7'));var config=require(_0x0a10('0x8'));var controller=require(_0x0a10('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0a10('0xa')]);router[_0x0a10('0xb')](_0x0a10('0xc'),auth[_0x0a10('0xd')](),controller[_0x0a10('0xe')]);router['get'](_0x0a10('0xf'),auth[_0x0a10('0xd')](),controller[_0x0a10('0x10')]);router[_0x0a10('0xb')](_0x0a10('0x11'),auth[_0x0a10('0xd')](),controller[_0x0a10('0x12')]);router[_0x0a10('0x13')]('/',auth[_0x0a10('0xd')](),interaction[_0x0a10('0x14')]('fax','faxmessage:create'),controller[_0x0a10('0x15')]);router[_0x0a10('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0a10('0x17')]);router[_0x0a10('0x16')]('/:id/accept',auth[_0x0a10('0xd')](),controller[_0x0a10('0x18')]);router['put']('/:id/reject',auth[_0x0a10('0xd')](),controller['reject']);router[_0x0a10('0x19')]('/:id',auth[_0x0a10('0xd')](),controller[_0x0a10('0x1a')]);module[_0x0a10('0x1b')]=router; \ No newline at end of file +var _0xa886=['show','download','post','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id'];(function(_0x378a46,_0x7ffbf5){var _0x14c107=function(_0x19100e){while(--_0x19100e){_0x378a46['push'](_0x378a46['shift']());}};_0x14c107(++_0x7ffbf5);}(_0xa886,0x193));var _0x6a88=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xa886[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x6a88('0x0'));var path=require(_0x6a88('0x1'));var timeout=require(_0x6a88('0x2'));var express=require(_0x6a88('0x3'));var router=express[_0x6a88('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a88('0x5'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0x6a88('0x6')]('/',auth[_0x6a88('0x7')](),controller[_0x6a88('0x8')]);router['get'](_0x6a88('0x9'),auth[_0x6a88('0x7')](),controller['describe']);router[_0x6a88('0x6')](_0x6a88('0xa'),auth[_0x6a88('0x7')](),controller[_0x6a88('0xb')]);router[_0x6a88('0x6')]('/:id/download',auth[_0x6a88('0x7')](),controller[_0x6a88('0xc')]);router[_0x6a88('0xd')]('/',auth[_0x6a88('0x7')](),interaction['tracked'](_0x6a88('0xe'),_0x6a88('0xf')),controller[_0x6a88('0x10')]);router[_0x6a88('0x11')]('/:id',auth[_0x6a88('0x7')](),controller[_0x6a88('0x12')]);router[_0x6a88('0x11')]('/:id/accept',auth[_0x6a88('0x7')](),controller[_0x6a88('0x13')]);router[_0x6a88('0x11')](_0x6a88('0x14'),auth[_0x6a88('0x7')](),controller[_0x6a88('0x15')]);router[_0x6a88('0x16')](_0x6a88('0xa'),auth[_0x6a88('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2fd835c..67454a3 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 _0x08d2=['rrmemory','beepall','sequelize','name','STRING','INTEGER'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x08d2,0x182));var _0x208d=function(_0x116e6f,_0x3c33cb){_0x116e6f=_0x116e6f-0x0;var _0x2ed403=_0x08d2[_0x116e6f];return _0x2ed403;};'use strict';var Sequelize=require(_0x208d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x208d('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x208d('0x2')]},'timeout':{'type':Sequelize[_0x208d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x208d('0x4'),_0x208d('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x208d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x198a=['exports','STRING','INTEGER','beepall','roundrobin','sequelize'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x198a,0x19d));var _0xa198=function(_0x2bd86a,_0x56e109){_0x2bd86a=_0x2bd86a-0x0;var _0x11ae96=_0x198a[_0x2bd86a];return _0x11ae96;};'use strict';var Sequelize=require(_0xa198('0x0'));module[_0xa198('0x1')]={'name':{'type':Sequelize[_0xa198('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa198('0x2')]},'timeout':{'type':Sequelize[_0xa198('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xa198('0x4'),_0xa198('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa198('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9e9f368..24ba5b1 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 _0x35c0=['util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','UserFaxQueue','order','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','from','team_has_fax_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeAgents','userFaxQueue:remove','omit','spread','userFaxQueue:save','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3d7b31,_0x173c74){var _0xc5a32f=function(_0x5cd0f9){while(--_0x5cd0f9){_0x3d7b31['push'](_0x3d7b31['shift']());}};_0xc5a32f(++_0x173c74);}(_0x35c0,0x10d));var _0x035c=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x35c0[_0x60878f];return _0x1fbefb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x035c('0x0'));var rimraf=require(_0x035c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x035c('0x2'));var rp=require(_0x035c('0x3'));var moment=require(_0x035c('0x4'));var BPromise=require(_0x035c('0x5'));var Mustache=require(_0x035c('0x6'));var util=require(_0x035c('0x7'));var path=require(_0x035c('0x8'));var sox=require(_0x035c('0x9'));var csv=require(_0x035c('0xa'));var ejs=require(_0x035c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x035c('0xc'));var jsforce=require(_0x035c('0xd'));var deskjs=require(_0x035c('0xe'));var toCsv=require(_0x035c('0xa'));var querystring=require('querystring');var Papa=require(_0x035c('0xf'));var Redis=require(_0x035c('0x10'));var authService=require(_0x035c('0x11'));var qs=require(_0x035c('0x12'));var as=require(_0x035c('0x13'));var hardwareService=require(_0x035c('0x14'));var logger=require(_0x035c('0x15'))(_0x035c('0x16'));var utils=require(_0x035c('0x17'));var config=require(_0x035c('0x18'));var db=require(_0x035c('0x19'))['db'];config[_0x035c('0x1a')]=_[_0x035c('0x1b')](config[_0x035c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0xcf7f6f,_0x12c503){_0x12c503=_0x12c503||0xcc;return function(_0x447234){if(_0x447234){return _0xcf7f6f[_0x035c('0x1c')](_0x12c503);}return _0xcf7f6f[_0x035c('0x1d')](_0x12c503)[_0x035c('0x1e')]();};}function respondWithResult(_0x452f28,_0x341fdf){_0x341fdf=_0x341fdf||0xc8;return function(_0x196fc6){if(_0x196fc6){return _0x452f28[_0x035c('0x1d')](_0x341fdf)[_0x035c('0x1f')](_0x196fc6);}};}function respondWithFilteredResult(_0x5988e8,_0x5d4b32){return function(_0x308937){if(_0x308937){var _0x58c80e=_0x308937[_0x035c('0x20')],_0x264dc1=_0x5d4b32[_0x035c('0x21')],_0x2c521a=_0x5d4b32['offset']+_0x5d4b32[_0x035c('0x22')],_0x273236;if(_0x2c521a>=_0x58c80e){_0x2c521a=_0x58c80e;_0x273236=0xc8;}else{_0x273236=0xce;}_0x5988e8[_0x035c('0x1d')](_0x273236);return _0x5988e8[_0x035c('0x23')](_0x035c('0x24'),_0x264dc1+'-'+_0x2c521a+'/'+_0x58c80e)[_0x035c('0x1f')](_0x308937);}return null;};}function patchUpdates(_0x43f521){return function(_0x489e29){try{jsonpatch['apply'](_0x489e29,_0x43f521,!![]);}catch(_0x118d78){return BPromise[_0x035c('0x25')](_0x118d78);}return _0x489e29[_0x035c('0x26')]();};}function saveUpdates(_0x45d850,_0x2627ff){return function(_0x38ba37){if(_0x38ba37){return _0x38ba37[_0x035c('0x27')](_0x45d850)[_0x035c('0x28')](function(_0x8bbdc9){return _0x8bbdc9;});}return null;};}function removeEntity(_0x4944ec,_0x5d4002){return function(_0x54b581){if(_0x54b581){return _0x54b581['destroy']()[_0x035c('0x28')](function(){var _0x540157=_0x54b581[_0x035c('0x29')]({'plain':!![]});var _0x190c08=_0x035c('0x2a');return db[_0x035c('0x2b')][_0x035c('0x2c')]({'where':{'type':_0x190c08,'resourceId':_0x540157['id']}})['then'](function(){return _0x54b581;});})[_0x035c('0x28')](function(){_0x4944ec['status'](0xcc)[_0x035c('0x1e')]();});}};}function handleEntityNotFound(_0x3988d6,_0x59d918){return function(_0x3e72c5){if(!_0x3e72c5){_0x3988d6[_0x035c('0x1c')](0x194);}return _0x3e72c5;};}function handleError(_0x5ccb3f,_0x2a58e8){_0x2a58e8=_0x2a58e8||0x1f4;return function(_0x4591db){logger[_0x035c('0x2d')](_0x4591db[_0x035c('0x2e')]);if(_0x4591db[_0x035c('0x2f')]){delete _0x4591db[_0x035c('0x2f')];}_0x5ccb3f[_0x035c('0x1d')](_0x2a58e8)[_0x035c('0x30')](_0x4591db);};}exports[_0x035c('0x31')]=function(_0x5d9b66,_0x51737b){var _0x3c6d99={},_0xdc2553={},_0x3b2761={'count':0x0,'rows':[]};var _0x7b82e7=_[_0x035c('0x32')](db[_0x035c('0x33')][_0x035c('0x34')],function(_0x417ea3){return{'name':_0x417ea3[_0x035c('0x35')],'type':_0x417ea3[_0x035c('0x36')][_0x035c('0x37')]};});_0xdc2553[_0x035c('0x38')]=_[_0x035c('0x32')](_0x7b82e7,'name');_0xdc2553['query']=_[_0x035c('0x39')](_0x5d9b66[_0x035c('0x3a')]);_0xdc2553[_0x035c('0x3b')]=_['intersection'](_0xdc2553['model'],_0xdc2553[_0x035c('0x3a')]);_0x3c6d99['attributes']=_[_0x035c('0x3c')](_0xdc2553[_0x035c('0x38')],qs['fields'](_0x5d9b66['query'][_0x035c('0x3d')]));_0x3c6d99[_0x035c('0x3e')]=_0x3c6d99[_0x035c('0x3e')][_0x035c('0x3f')]?_0x3c6d99[_0x035c('0x3e')]:_0xdc2553[_0x035c('0x38')];if(!_0x5d9b66[_0x035c('0x3a')]['hasOwnProperty'](_0x035c('0x40'))){_0x3c6d99[_0x035c('0x22')]=qs[_0x035c('0x22')](_0x5d9b66['query'][_0x035c('0x22')]);_0x3c6d99['offset']=qs[_0x035c('0x21')](_0x5d9b66[_0x035c('0x3a')][_0x035c('0x21')]);}_0x3c6d99['order']=qs[_0x035c('0x41')](_0x5d9b66[_0x035c('0x3a')][_0x035c('0x41')]);_0x3c6d99[_0x035c('0x42')]=qs[_0x035c('0x3b')](_['pick'](_0x5d9b66['query'],_0xdc2553[_0x035c('0x3b')]),_0x7b82e7);if(_0x5d9b66[_0x035c('0x3a')][_0x035c('0x43')]){_0x3c6d99[_0x035c('0x42')]=_['merge'](_0x3c6d99[_0x035c('0x42')],{'$or':_['map'](_0x7b82e7,function(_0x52d5bd){if(_0x52d5bd[_0x035c('0x36')]!==_0x035c('0x44')){var _0x3b8c28={};_0x3b8c28[_0x52d5bd[_0x035c('0x2f')]]={'$like':'%'+_0x5d9b66[_0x035c('0x3a')][_0x035c('0x43')]+'%'};return _0x3b8c28;}})});}_0x3c6d99=_[_0x035c('0x45')]({},_0x3c6d99,_0x5d9b66[_0x035c('0x46')]);var _0x26c90e={'where':_0x3c6d99[_0x035c('0x42')]};return db['FaxQueue'][_0x035c('0x20')](_0x26c90e)[_0x035c('0x28')](function(_0x505a09){_0x3b2761[_0x035c('0x20')]=_0x505a09;if(_0x5d9b66[_0x035c('0x3a')][_0x035c('0x47')]){_0x3c6d99[_0x035c('0x48')]=[{'all':!![]}];}return db[_0x035c('0x33')][_0x035c('0x49')](_0x3c6d99);})[_0x035c('0x28')](function(_0x56f832){_0x3b2761[_0x035c('0x4a')]=_0x56f832;return _0x3b2761;})[_0x035c('0x28')](respondWithFilteredResult(_0x51737b,_0x3c6d99))[_0x035c('0x4b')](handleError(_0x51737b,null));};exports[_0x035c('0x4c')]=function(_0x3fd504,_0xc8755c){var _0x262054={'raw':!![],'where':{'id':_0x3fd504[_0x035c('0x4d')]['id']}},_0x32b5ab={};_0x32b5ab[_0x035c('0x38')]=_[_0x035c('0x39')](db[_0x035c('0x33')][_0x035c('0x34')]);_0x32b5ab[_0x035c('0x3a')]=_[_0x035c('0x39')](_0x3fd504[_0x035c('0x3a')]);_0x32b5ab[_0x035c('0x3b')]=_['intersection'](_0x32b5ab['model'],_0x32b5ab[_0x035c('0x3a')]);_0x262054[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x32b5ab[_0x035c('0x38')],qs[_0x035c('0x3d')](_0x3fd504[_0x035c('0x3a')][_0x035c('0x3d')]));_0x262054[_0x035c('0x3e')]=_0x262054['attributes'][_0x035c('0x3f')]?_0x262054[_0x035c('0x3e')]:_0x32b5ab[_0x035c('0x38')];if(_0x3fd504[_0x035c('0x3a')][_0x035c('0x47')]){_0x262054[_0x035c('0x48')]=[{'all':!![]}];}_0x262054=_[_0x035c('0x45')]({},_0x262054,_0x3fd504[_0x035c('0x46')]);return db[_0x035c('0x33')][_0x035c('0x4e')](_0x262054)['then'](handleEntityNotFound(_0xc8755c,null))[_0x035c('0x28')](respondWithResult(_0xc8755c,null))['catch'](handleError(_0xc8755c,null));};exports['create']=function(_0x13cb65,_0xe1c824){return db[_0x035c('0x33')][_0x035c('0x4f')](_0x13cb65[_0x035c('0x50')],{})['then'](function(_0x1b27c8){var _0x2c6cd7=_0x13cb65[_0x035c('0x51')][_0x035c('0x29')]({'plain':!![]});if(!_0x2c6cd7)throw new Error(_0x035c('0x52'));if(_0x2c6cd7[_0x035c('0x53')]==='user'){var _0x32bc84=_0x1b27c8['get']({'plain':!![]});var _0x2d47fc=_0x035c('0x2a');return db[_0x035c('0x54')][_0x035c('0x4e')]({'where':{'name':_0x2d47fc,'userProfileId':_0x2c6cd7[_0x035c('0x55')]},'raw':!![]})[_0x035c('0x28')](function(_0x4042e2){if(_0x4042e2&&_0x4042e2[_0x035c('0x56')]===0x0){return db[_0x035c('0x2b')][_0x035c('0x4f')]({'name':_0x32bc84[_0x035c('0x2f')],'resourceId':_0x32bc84['id'],'type':_0x4042e2['name'],'sectionId':_0x4042e2['id']},{})[_0x035c('0x28')](function(){return _0x1b27c8;});}else{return _0x1b27c8;}})[_0x035c('0x4b')](function(_0x6db39c){logger[_0x035c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6db39c);throw _0x6db39c;});}return _0x1b27c8;})[_0x035c('0x28')](respondWithResult(_0xe1c824,0xc9))[_0x035c('0x4b')](handleError(_0xe1c824,null));};exports['update']=function(_0x523161,_0x2be6db){if(_0x523161[_0x035c('0x50')]['id']){delete _0x523161[_0x035c('0x50')]['id'];}return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x523161[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2be6db,null))[_0x035c('0x28')](saveUpdates(_0x523161[_0x035c('0x50')],null))[_0x035c('0x28')](respondWithResult(_0x2be6db,null))[_0x035c('0x4b')](handleError(_0x2be6db,null));};exports['destroy']=function(_0x2ae327,_0x43e2cc){return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x2ae327[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43e2cc,null))[_0x035c('0x28')](removeEntity(_0x43e2cc,null))[_0x035c('0x4b')](handleError(_0x43e2cc,null));};exports['describe']=function(_0x39be24,_0x5d4abe){return db[_0x035c('0x33')]['describe']()[_0x035c('0x28')](respondWithResult(_0x5d4abe,null))[_0x035c('0x4b')](handleError(_0x5d4abe,null));};exports[_0x035c('0x57')]=function(_0x40ae3d,_0x1ed68f,_0x3485d1){var _0x272681={'raw':!![],'where':{}},_0x1eb58b={},_0x130f1d;return db[_0x035c('0x33')]['findOne']({'where':{'id':_0x40ae3d[_0x035c('0x4d')]['id']}})[_0x035c('0x28')](handleEntityNotFound(_0x1ed68f,null))['then'](function(_0x2f9b80){if(_0x2f9b80){_0x130f1d=_0x2f9b80[_0x035c('0x29')]({'plain':!![]});_0x1eb58b[_0x035c('0x38')]=_['keys'](db[_0x035c('0x58')][_0x035c('0x34')]);_0x1eb58b[_0x035c('0x3a')]=_[_0x035c('0x39')](_0x40ae3d['query']);_0x1eb58b['filters']=_['intersection'](_0x1eb58b[_0x035c('0x38')],_0x1eb58b[_0x035c('0x3a')]);_0x272681[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x1eb58b['model'],qs[_0x035c('0x3d')](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x3d')]));_0x272681['attributes']=_0x272681['attributes'][_0x035c('0x3f')]?_0x272681[_0x035c('0x3e')]:_0x1eb58b[_0x035c('0x38')];if(!_0x40ae3d[_0x035c('0x3a')]['hasOwnProperty'](_0x035c('0x40'))){_0x272681['limit']=qs['limit'](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x22')]);_0x272681[_0x035c('0x21')]=qs[_0x035c('0x21')](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x21')]);}_0x272681[_0x035c('0x59')]=qs['sort'](_0x40ae3d[_0x035c('0x3a')][_0x035c('0x41')]);_0x272681[_0x035c('0x42')]=qs['filters'](_['pick'](_0x40ae3d[_0x035c('0x3a')],_0x1eb58b[_0x035c('0x3b')]));_0x272681[_0x035c('0x42')]['FaxQueueId']=_0x2f9b80['id'];if(_0x40ae3d['query'][_0x035c('0x43')]){_0x272681[_0x035c('0x42')]=_[_0x035c('0x45')](_0x272681[_0x035c('0x42')],{'$or':_[_0x035c('0x32')](_0x272681[_0x035c('0x3e')],function(_0x12fa05){var _0x23d23a={};_0x23d23a[_0x12fa05]={'$like':'%'+_0x40ae3d['query'][_0x035c('0x43')]+'%'};return _0x23d23a;})});}_0x272681=_[_0x035c('0x45')]({},_0x272681,_0x40ae3d[_0x035c('0x46')]);return db[_0x035c('0x58')][_0x035c('0x49')](_0x272681);}})[_0x035c('0x28')](function(_0x23044f){if(_0x23044f){return db[_0x035c('0x5a')][_0x035c('0x5b')]({'where':{'id':_[_0x035c('0x32')](_0x23044f,_0x035c('0x5c')),'role':_0x035c('0x5d')},'attributes':['id',_0x035c('0x2f'),_0x035c('0x5e'),_0x035c('0x5f'),_0x035c('0x60')]});}})[_0x035c('0x28')](function(_0x46a5af){if(_0x46a5af){return{'count':_0x46a5af['count'],'rows':_[_0x035c('0x32')](_0x46a5af[_0x035c('0x4a')],function(_0x171b46){return{'membername':_0x171b46[_0x035c('0x2f')],'UserId':_0x171b46['id'],'queue_name':_0x130f1d[_0x035c('0x2f')],'FaxQueueId':_0x130f1d['id'],'interface':util[_0x035c('0x61')]('%s/%s',_0x035c('0x62'),_0x171b46[_0x035c('0x2f')]),'penalty':0x0,'paused':_0x171b46[_0x035c('0x5e')],'createdAt':_0x171b46[_0x035c('0x60')],'updatedAt':_0x171b46[_0x035c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ed68f,_0x272681))[_0x035c('0x4b')](handleError(_0x1ed68f,null));};exports[_0x035c('0x63')]=function(_0x2bf3d4,_0x405ab7,_0x5a1ca4){var _0x515097={};var _0x21577f={};var _0x3a9ac5;var _0x5bb73a;return db[_0x035c('0x33')]['findOne']({'where':{'id':_0x2bf3d4[_0x035c('0x4d')]['id']}})[_0x035c('0x28')](handleEntityNotFound(_0x405ab7,null))[_0x035c('0x28')](function(_0x39905c){if(_0x39905c){_0x3a9ac5=_0x39905c;_0x21577f[_0x035c('0x38')]=_[_0x035c('0x39')](db[_0x035c('0x64')][_0x035c('0x34')]);_0x21577f[_0x035c('0x3a')]=_['keys'](_0x2bf3d4[_0x035c('0x3a')]);_0x21577f[_0x035c('0x3b')]=_[_0x035c('0x3c')](_0x21577f[_0x035c('0x38')],_0x21577f[_0x035c('0x3a')]);_0x515097[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x21577f[_0x035c('0x38')],qs['fields'](_0x2bf3d4['query']['fields']));_0x515097[_0x035c('0x3e')]=_0x515097[_0x035c('0x3e')][_0x035c('0x3f')]?_0x515097[_0x035c('0x3e')]:_0x21577f['model'];_0x515097[_0x035c('0x59')]=qs[_0x035c('0x41')](_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x41')]);_0x515097[_0x035c('0x42')]=qs[_0x035c('0x3b')](_[_0x035c('0x65')](_0x2bf3d4['query'],_0x21577f[_0x035c('0x3b')]));if(_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x43')]){_0x515097[_0x035c('0x42')]=_[_0x035c('0x45')](_0x515097[_0x035c('0x42')],{'$or':_[_0x035c('0x32')](_0x515097['attributes'],function(_0x39516f){var _0x18c5ec={};_0x18c5ec[_0x39516f]={'$like':'%'+_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x43')]+'%'};return _0x18c5ec;})});}_0x515097=_['merge']({},_0x515097,_0x2bf3d4[_0x035c('0x46')]);return _0x3a9ac5[_0x035c('0x63')](_0x515097);}})[_0x035c('0x28')](function(_0x1fb7a7){if(_0x1fb7a7){_0x5bb73a=_0x1fb7a7['length'];if(!_0x2bf3d4[_0x035c('0x3a')]['hasOwnProperty'](_0x035c('0x40'))){_0x515097['limit']=qs[_0x035c('0x22')](_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x22')]);_0x515097[_0x035c('0x21')]=qs[_0x035c('0x21')](_0x2bf3d4[_0x035c('0x3a')][_0x035c('0x21')]);}return _0x3a9ac5[_0x035c('0x63')](_0x515097);}})[_0x035c('0x28')](function(_0x552118){if(_0x552118){return _0x552118?{'count':_0x5bb73a,'rows':_0x552118}:null;}})['then'](respondWithResult(_0x405ab7,null))[_0x035c('0x4b')](handleError(_0x405ab7,null));};exports[_0x035c('0x66')]=function(_0x48ecf3,_0x58b716,_0x30ed86){var _0x1f3eb5=_0x48ecf3[_0x035c('0x50')][_0x035c('0x67')];return db[_0x035c('0x64')][_0x035c('0x49')]({'where':{'id':_0x1f3eb5},'attributes':['id'],'include':[{'model':db[_0x035c('0x5a')],'as':_0x035c('0x68'),'attributes':['id',_0x035c('0x2f'),_0x035c('0x69'),_0x035c('0x6a'),_0x035c('0x6b')],'raw':!![]}]})[_0x035c('0x28')](function(_0x13d697){if(_0x13d697){var _0x44d87c=_[_0x035c('0x6c')](_0x13d697,function(_0x5e3133){var _0x5c8dbd=_0x5e3133[_0x035c('0x29')]({'plain':!![]});return _0x5c8dbd['Agents'];});return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x48ecf3[_0x035c('0x4d')]['id']}})['then'](function(_0x587705){return db[_0x035c('0x6d')][_0x035c('0x6e')](function(_0x20fd3a){return _0x587705[_0x035c('0x66')](_0x1f3eb5,{'transaction':_0x20fd3a})['then'](function(){return BPromise['each'](_0x44d87c,function(_0x793434){return db['UserFaxQueue'][_0x035c('0x6f')]({'where':{'UserId':_0x793434['id'],'FaxQueueId':_0x48ecf3[_0x035c('0x4d')]['id']},'transaction':_0x20fd3a});});})[_0x035c('0x28')](function(){_0x44d87c[_0x035c('0x70')](function(_0x2a6134){socket[_0x035c('0x71')]('userFaxQueue:save',{'UserId':_0x2a6134['id'],'FaxQueueId':_0x587705['id']});});});});});}})[_0x035c('0x28')](respondWithStatusCode(_0x58b716,null))['catch'](handleError(_0x58b716,null));};exports[_0x035c('0x72')]=function(_0x1cdf5d,_0x19ed57,_0x537249){return db[_0x035c('0x64')][_0x035c('0x49')]({'where':{'id':_0x1cdf5d[_0x035c('0x3a')][_0x035c('0x67')]},'attributes':['id'],'include':[{'model':db[_0x035c('0x5a')],'as':_0x035c('0x68'),'attributes':['id'],'raw':!![]}]})[_0x035c('0x28')](handleEntityNotFound(_0x19ed57,null))[_0x035c('0x28')](function(_0x1704a1){var _0x823f2a=_[_0x035c('0x32')](_0x1704a1,'id');var _0xb760e6=[];var _0x2ca079=[];var _0x45133a=squel['select']();_0x45133a['field']('tq.TeamId')[_0x035c('0x73')](_0x035c('0x74'),'tq')[_0x035c('0x75')](_0x035c('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x1cdf5d[_0x035c('0x4d')]['id']);for(var _0x54fdba=0x0;_0x54fdba<_0x1704a1[_0x035c('0x3f')];_0x54fdba+=0x1){let _0x41228f=_0x1704a1[_0x54fdba];for(var _0x7e9466=0x0;_0x7e9466<_0x41228f[_0x035c('0x68')][_0x035c('0x3f')];_0x7e9466+=0x1){let _0x46bb1f=_0x41228f['Agents'][_0x7e9466];var _0x37b7b2=_0x45133a[_0x035c('0x77')]();_0x37b7b2[_0x035c('0x42')](_0x035c('0x78'),_0x46bb1f['id']);_0x2ca079[_0x035c('0x79')](db['sequelize'][_0x035c('0x3a')](_0x37b7b2[_0x035c('0x7a')](),{'type':db[_0x035c('0x6d')][_0x035c('0x7b')][_0x035c('0x7c')]})[_0x035c('0x28')](function(_0x2d4124){if(_0x2d4124[_0x035c('0x3f')]===0x1){return _0x46bb1f['id'];}else{var _0x4e527c=_[_0x035c('0x7d')](_[_0x035c('0x32')](_0x2d4124,_0x035c('0x7e')),function(_0xb68049){return _[_0x035c('0x7f')](_0x823f2a,_0xb68049);});if(_0x4e527c){return _0x46bb1f['id'];}}}));}}return BPromise[_0x035c('0x80')](_0x2ca079)[_0x035c('0x28')](function(_0x5c4cc1){_0xb760e6=_(_0xb760e6)[_0x035c('0x81')](_0x5c4cc1)['compact']()[_0x035c('0x82')]();return db['FaxQueue'][_0x035c('0x4e')]({'where':{'id':_0x1cdf5d[_0x035c('0x4d')]['id']}})[_0x035c('0x28')](function(_0x1a7e5c){return db[_0x035c('0x6d')][_0x035c('0x6e')](function(_0xdb4f17){return _0x1a7e5c[_0x035c('0x72')](_0x1cdf5d[_0x035c('0x3a')][_0x035c('0x67')],{'transaction':_0xdb4f17})[_0x035c('0x28')](function(){if(!_['isEmpty'](_0xb760e6)){return _0x1a7e5c[_0x035c('0x83')](_0xb760e6,{'transaction':_0xdb4f17});}})['then'](function(){_0xb760e6[_0x035c('0x70')](function(_0x304cd2){socket[_0x035c('0x71')](_0x035c('0x84'),{'UserId':_0x304cd2,'FaxQueueId':_0x1a7e5c['id']});});});});});});})[_0x035c('0x28')](respondWithStatusCode(_0x19ed57,null))['catch'](handleError(_0x19ed57,null));};exports['addAgents']=function(_0x51a815,_0x4f0100,_0x14ab56){return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x51a815['params']['id']}})['then'](handleEntityNotFound(_0x4f0100,null))['then'](function(_0x78d0e2){if(_0x78d0e2){return _0x78d0e2['addAgents'](_0x51a815[_0x035c('0x50')][_0x035c('0x67')],_[_0x035c('0x85')](_0x51a815['body'],[_0x035c('0x67'),'id'])||{})[_0x035c('0x86')](function(_0x932467){for(var _0x25ba41=0x0;_0x25ba41<_0x51a815[_0x035c('0x50')][_0x035c('0x67')][_0x035c('0x3f')];_0x25ba41+=0x1){socket[_0x035c('0x71')](_0x035c('0x87'),{'UserId':_0x51a815[_0x035c('0x50')][_0x035c('0x67')][_0x25ba41],'FaxQueueId':_0x51a815[_0x035c('0x4d')]['id']});}return _0x932467;});}})['then'](respondWithResult(_0x4f0100,null))['catch'](handleError(_0x4f0100,null));};exports[_0x035c('0x83')]=function(_0x2273da,_0x5b09f4,_0x6af247){return db[_0x035c('0x33')][_0x035c('0x4e')]({'where':{'id':_0x2273da[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b09f4,null))[_0x035c('0x28')](function(_0x39f923){if(_0x39f923){return _0x39f923[_0x035c('0x83')](_0x2273da[_0x035c('0x3a')]['ids'])['then'](function(){if(_['isArray'](_0x2273da['query'][_0x035c('0x67')])){for(var _0x51fd26=0x0;_0x51fd26<_0x2273da['query']['ids'][_0x035c('0x3f')];_0x51fd26+=0x1){socket[_0x035c('0x71')](_0x035c('0x84'),{'UserId':Number(_0x2273da[_0x035c('0x3a')][_0x035c('0x67')][_0x51fd26]),'FaxQueueId':Number(_0x2273da[_0x035c('0x4d')]['id'])});}}else{socket[_0x035c('0x71')](_0x035c('0x84'),{'UserId':Number(_0x2273da[_0x035c('0x3a')][_0x035c('0x67')]),'FaxQueueId':Number(_0x2273da[_0x035c('0x4d')]['id'])});}});}})[_0x035c('0x28')](respondWithStatusCode(_0x5b09f4,null))[_0x035c('0x4b')](handleError(_0x5b09f4,null));};exports[_0x035c('0x88')]=function(_0x5d03ad,_0x3d2f55,_0x547492){var _0xd9d127={};var _0x245346={};var _0x2edbab;var _0x208df3;return db[_0x035c('0x33')]['findOne']({'where':{'id':_0x5d03ad[_0x035c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3d2f55,null))[_0x035c('0x28')](function(_0x5c540d){if(_0x5c540d){_0x2edbab=_0x5c540d;_0x245346[_0x035c('0x38')]=_[_0x035c('0x39')](db[_0x035c('0x5a')][_0x035c('0x34')]);_0x245346['query']=_[_0x035c('0x39')](_0x5d03ad[_0x035c('0x3a')]);_0x245346[_0x035c('0x3b')]=_['intersection'](_0x245346[_0x035c('0x38')],_0x245346[_0x035c('0x3a')]);_0xd9d127[_0x035c('0x3e')]=_[_0x035c('0x3c')](_0x245346[_0x035c('0x38')],qs[_0x035c('0x3d')](_0x5d03ad[_0x035c('0x3a')][_0x035c('0x3d')]));_0xd9d127[_0x035c('0x3e')]=_0xd9d127[_0x035c('0x3e')][_0x035c('0x3f')]?_0xd9d127[_0x035c('0x3e')]:_0x245346[_0x035c('0x38')];_0xd9d127['order']=qs['sort'](_0x5d03ad[_0x035c('0x3a')][_0x035c('0x41')]);_0xd9d127[_0x035c('0x42')]=qs[_0x035c('0x3b')](_[_0x035c('0x65')](_0x5d03ad[_0x035c('0x3a')],_0x245346['filters']));if(_0x5d03ad[_0x035c('0x3a')][_0x035c('0x43')]){_0xd9d127['where']=_['merge'](_0xd9d127[_0x035c('0x42')],{'$or':_['map'](_0xd9d127['attributes'],function(_0x11a36a){var _0x946e4e={};_0x946e4e[_0x11a36a]={'$like':'%'+_0x5d03ad[_0x035c('0x3a')][_0x035c('0x43')]+'%'};return _0x946e4e;})});}_0xd9d127=_[_0x035c('0x45')]({},_0xd9d127,_0x5d03ad[_0x035c('0x46')]);return _0x2edbab[_0x035c('0x88')](_0xd9d127);}})[_0x035c('0x28')](function(_0x3463df){if(_0x3463df){_0x208df3=_0x3463df[_0x035c('0x3f')];if(!_0x5d03ad[_0x035c('0x3a')][_0x035c('0x89')](_0x035c('0x40'))){_0xd9d127[_0x035c('0x22')]=qs[_0x035c('0x22')](_0x5d03ad['query'][_0x035c('0x22')]);_0xd9d127['offset']=qs['offset'](_0x5d03ad[_0x035c('0x3a')]['offset']);}return _0x2edbab[_0x035c('0x88')](_0xd9d127);}})[_0x035c('0x28')](function(_0x5bcbe2){if(_0x5bcbe2){return _0x5bcbe2?{'count':_0x208df3,'rows':_0x5bcbe2}:null;}})[_0x035c('0x28')](respondWithResult(_0x3d2f55,null))['catch'](handleError(_0x3d2f55,null));}; \ No newline at end of file +var _0x5a13=['faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','keys','include','find','create','user','get','FaxQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','findAll','User','findAndCountAll'];(function(_0x277180,_0x4e9546){var _0x1f25fb=function(_0x5d1b77){while(--_0x5d1b77){_0x277180['push'](_0x277180['shift']());}};_0x1f25fb(++_0x4e9546);}(_0x5a13,0x145));var _0x35a1=function(_0x361908,_0xaef2c6){_0x361908=_0x361908-0x0;var _0x207fd4=_0x5a13[_0x361908];return _0x207fd4;};'use strict';var pdf=require(_0x35a1('0x0'));var emlformat=require(_0x35a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35a1('0x2'));var jsonpatch=require(_0x35a1('0x3'));var rp=require(_0x35a1('0x4'));var moment=require(_0x35a1('0x5'));var BPromise=require(_0x35a1('0x6'));var Mustache=require(_0x35a1('0x7'));var util=require(_0x35a1('0x8'));var path=require(_0x35a1('0x9'));var sox=require(_0x35a1('0xa'));var csv=require(_0x35a1('0xb'));var ejs=require(_0x35a1('0xc'));var fs=require('fs');var _=require(_0x35a1('0xd'));var squel=require(_0x35a1('0xe'));var crypto=require(_0x35a1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35a1('0x10'));var Papa=require(_0x35a1('0x11'));var Redis=require('ioredis');var authService=require(_0x35a1('0x12'));var qs=require(_0x35a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x35a1('0x16'))['db'];config['redis']=_[_0x35a1('0x17')](config['redis'],{'host':_0x35a1('0x18'),'port':0x18eb});var socket=require(_0x35a1('0x19'))(new Redis(config[_0x35a1('0x1a')]));require(_0x35a1('0x1b'))[_0x35a1('0x1c')](socket);function respondWithStatusCode(_0xa149d0,_0x20d868){_0x20d868=_0x20d868||0xcc;return function(_0x42de36){if(_0x42de36){return _0xa149d0[_0x35a1('0x1d')](_0x20d868);}return _0xa149d0[_0x35a1('0x1e')](_0x20d868)[_0x35a1('0x1f')]();};}function respondWithResult(_0x41939f,_0x2f93be){_0x2f93be=_0x2f93be||0xc8;return function(_0x44c755){if(_0x44c755){return _0x41939f[_0x35a1('0x1e')](_0x2f93be)[_0x35a1('0x20')](_0x44c755);}};}function respondWithFilteredResult(_0x9bdc,_0x2b22b4){return function(_0x3e7b28){if(_0x3e7b28){var _0x1de373=_0x3e7b28[_0x35a1('0x21')],_0x5e4317=_0x2b22b4[_0x35a1('0x22')],_0x3b17dc=_0x2b22b4[_0x35a1('0x22')]+_0x2b22b4[_0x35a1('0x23')],_0xbeb751;if(_0x3b17dc>=_0x1de373){_0x3b17dc=_0x1de373;_0xbeb751=0xc8;}else{_0xbeb751=0xce;}_0x9bdc[_0x35a1('0x1e')](_0xbeb751);return _0x9bdc[_0x35a1('0x24')](_0x35a1('0x25'),_0x5e4317+'-'+_0x3b17dc+'/'+_0x1de373)['json'](_0x3e7b28);}return null;};}function patchUpdates(_0x473186){return function(_0xf089dd){try{jsonpatch['apply'](_0xf089dd,_0x473186,!![]);}catch(_0xfce076){return BPromise[_0x35a1('0x26')](_0xfce076);}return _0xf089dd['save']();};}function saveUpdates(_0xc13bad,_0x5a1742){return function(_0x28af51){if(_0x28af51){return _0x28af51[_0x35a1('0x27')](_0xc13bad)[_0x35a1('0x28')](function(_0x5e42cf){return _0x5e42cf;});}return null;};}function removeEntity(_0x1ced16,_0x2b87a1){return function(_0x48f1bd){if(_0x48f1bd){return _0x48f1bd['destroy']()['then'](function(){var _0x35ad8a=_0x48f1bd['get']({'plain':!![]});var _0x5408a7='FaxQueues';return db[_0x35a1('0x29')][_0x35a1('0x2a')]({'where':{'type':_0x5408a7,'resourceId':_0x35ad8a['id']}})[_0x35a1('0x28')](function(){return _0x48f1bd;});})[_0x35a1('0x28')](function(){_0x1ced16['status'](0xcc)[_0x35a1('0x1f')]();});}};}function handleEntityNotFound(_0x34b3d8,_0x3c552c){return function(_0x1b777e){if(!_0x1b777e){_0x34b3d8[_0x35a1('0x1d')](0x194);}return _0x1b777e;};}function handleError(_0x426623,_0x3d3453){_0x3d3453=_0x3d3453||0x1f4;return function(_0x24bb2d){logger[_0x35a1('0x2b')](_0x24bb2d[_0x35a1('0x2c')]);if(_0x24bb2d[_0x35a1('0x2d')]){delete _0x24bb2d[_0x35a1('0x2d')];}_0x426623[_0x35a1('0x1e')](_0x3d3453)[_0x35a1('0x2e')](_0x24bb2d);};}exports[_0x35a1('0x2f')]=function(_0x4b74b3,_0x9720a4){var _0x379819={},_0x10b65e={},_0xd79e92={'count':0x0,'rows':[]};var _0x4382f4=_[_0x35a1('0x30')](db[_0x35a1('0x31')][_0x35a1('0x32')],function(_0x2609ab){return{'name':_0x2609ab[_0x35a1('0x33')],'type':_0x2609ab[_0x35a1('0x34')]['key']};});_0x10b65e['model']=_[_0x35a1('0x30')](_0x4382f4,'name');_0x10b65e[_0x35a1('0x35')]=_['keys'](_0x4b74b3[_0x35a1('0x35')]);_0x10b65e[_0x35a1('0x36')]=_[_0x35a1('0x37')](_0x10b65e[_0x35a1('0x38')],_0x10b65e[_0x35a1('0x35')]);_0x379819[_0x35a1('0x39')]=_[_0x35a1('0x37')](_0x10b65e[_0x35a1('0x38')],qs[_0x35a1('0x3a')](_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x3a')]));_0x379819['attributes']=_0x379819[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x379819[_0x35a1('0x39')]:_0x10b65e['model'];if(!_0x4b74b3['query']['hasOwnProperty']('nolimit')){_0x379819['limit']=qs['limit'](_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x23')]);_0x379819[_0x35a1('0x22')]=qs[_0x35a1('0x22')](_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x22')]);}_0x379819[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0x4b74b3['query'][_0x35a1('0x3d')]);_0x379819['where']=qs[_0x35a1('0x36')](_[_0x35a1('0x3e')](_0x4b74b3[_0x35a1('0x35')],_0x10b65e[_0x35a1('0x36')]),_0x4382f4);if(_0x4b74b3[_0x35a1('0x35')]['filter']){_0x379819[_0x35a1('0x3f')]=_[_0x35a1('0x40')](_0x379819[_0x35a1('0x3f')],{'$or':_['map'](_0x4382f4,function(_0x599295){if(_0x599295[_0x35a1('0x34')]!==_0x35a1('0x41')){var _0x22230b={};_0x22230b[_0x599295[_0x35a1('0x2d')]]={'$like':'%'+_0x4b74b3['query'][_0x35a1('0x42')]+'%'};return _0x22230b;}})});}_0x379819=_['merge']({},_0x379819,_0x4b74b3[_0x35a1('0x43')]);var _0x5afe04={'where':_0x379819[_0x35a1('0x3f')]};return db[_0x35a1('0x31')]['count'](_0x5afe04)['then'](function(_0x221136){_0xd79e92['count']=_0x221136;if(_0x4b74b3[_0x35a1('0x35')][_0x35a1('0x44')]){_0x379819['include']=[{'all':!![]}];}return db[_0x35a1('0x31')]['findAll'](_0x379819);})[_0x35a1('0x28')](function(_0x4c4c21){_0xd79e92[_0x35a1('0x45')]=_0x4c4c21;return _0xd79e92;})['then'](respondWithFilteredResult(_0x9720a4,_0x379819))[_0x35a1('0x46')](handleError(_0x9720a4,null));};exports['show']=function(_0x3453ee,_0x4edec7){var _0x171209={'raw':!![],'where':{'id':_0x3453ee[_0x35a1('0x47')]['id']}},_0x260f29={};_0x260f29[_0x35a1('0x38')]=_[_0x35a1('0x48')](db[_0x35a1('0x31')][_0x35a1('0x32')]);_0x260f29['query']=_[_0x35a1('0x48')](_0x3453ee[_0x35a1('0x35')]);_0x260f29[_0x35a1('0x36')]=_[_0x35a1('0x37')](_0x260f29[_0x35a1('0x38')],_0x260f29[_0x35a1('0x35')]);_0x171209['attributes']=_[_0x35a1('0x37')](_0x260f29[_0x35a1('0x38')],qs[_0x35a1('0x3a')](_0x3453ee[_0x35a1('0x35')][_0x35a1('0x3a')]));_0x171209['attributes']=_0x171209[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x171209[_0x35a1('0x39')]:_0x260f29[_0x35a1('0x38')];if(_0x3453ee['query'][_0x35a1('0x44')]){_0x171209[_0x35a1('0x49')]=[{'all':!![]}];}_0x171209=_[_0x35a1('0x40')]({},_0x171209,_0x3453ee[_0x35a1('0x43')]);return db[_0x35a1('0x31')][_0x35a1('0x4a')](_0x171209)[_0x35a1('0x28')](handleEntityNotFound(_0x4edec7,null))['then'](respondWithResult(_0x4edec7,null))['catch'](handleError(_0x4edec7,null));};exports[_0x35a1('0x4b')]=function(_0x34805f,_0x2d2bb6){return db[_0x35a1('0x31')]['create'](_0x34805f['body'],{})[_0x35a1('0x28')](function(_0x43c5a8){var _0x19123f=_0x34805f[_0x35a1('0x4c')]['get']({'plain':!![]});if(!_0x19123f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19123f['role']===_0x35a1('0x4c')){var _0x5d7f55=_0x43c5a8[_0x35a1('0x4d')]({'plain':!![]});var _0x26e358=_0x35a1('0x4e');return db[_0x35a1('0x4f')][_0x35a1('0x4a')]({'where':{'name':_0x26e358,'userProfileId':_0x19123f[_0x35a1('0x50')]},'raw':!![]})[_0x35a1('0x28')](function(_0x1fed77){if(_0x1fed77&&_0x1fed77['autoAssociation']===0x0){return db[_0x35a1('0x29')][_0x35a1('0x4b')]({'name':_0x5d7f55[_0x35a1('0x2d')],'resourceId':_0x5d7f55['id'],'type':_0x1fed77['name'],'sectionId':_0x1fed77['id']},{})['then'](function(){return _0x43c5a8;});}else{return _0x43c5a8;}})['catch'](function(_0x5b156a){logger[_0x35a1('0x2b')](_0x35a1('0x51'),_0x5b156a);throw _0x5b156a;});}return _0x43c5a8;})[_0x35a1('0x28')](respondWithResult(_0x2d2bb6,0xc9))[_0x35a1('0x46')](handleError(_0x2d2bb6,null));};exports[_0x35a1('0x27')]=function(_0x358cbf,_0x3369c1){if(_0x358cbf[_0x35a1('0x52')]['id']){delete _0x358cbf[_0x35a1('0x52')]['id'];}return db[_0x35a1('0x31')]['find']({'where':{'id':_0x358cbf[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3369c1,null))[_0x35a1('0x28')](saveUpdates(_0x358cbf['body'],null))['then'](respondWithResult(_0x3369c1,null))[_0x35a1('0x46')](handleError(_0x3369c1,null));};exports['destroy']=function(_0x1a6979,_0xb5b4e3){return db[_0x35a1('0x31')]['find']({'where':{'id':_0x1a6979['params']['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0xb5b4e3,null))['then'](removeEntity(_0xb5b4e3,null))['catch'](handleError(_0xb5b4e3,null));};exports[_0x35a1('0x53')]=function(_0x4b3e29,_0x1cec5e){return db[_0x35a1('0x31')][_0x35a1('0x53')]()[_0x35a1('0x28')](respondWithResult(_0x1cec5e,null))[_0x35a1('0x46')](handleError(_0x1cec5e,null));};exports[_0x35a1('0x54')]=function(_0x152572,_0x23ea8f,_0xd54b59){var _0x2ab62f={'raw':!![],'where':{}},_0x31851d={},_0x5a6b4e;return db[_0x35a1('0x31')][_0x35a1('0x55')]({'where':{'id':_0x152572[_0x35a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x23ea8f,null))[_0x35a1('0x28')](function(_0xa85658){if(_0xa85658){_0x5a6b4e=_0xa85658[_0x35a1('0x4d')]({'plain':!![]});_0x31851d[_0x35a1('0x38')]=_[_0x35a1('0x48')](db[_0x35a1('0x56')][_0x35a1('0x32')]);_0x31851d[_0x35a1('0x35')]=_[_0x35a1('0x48')](_0x152572[_0x35a1('0x35')]);_0x31851d[_0x35a1('0x36')]=_[_0x35a1('0x37')](_0x31851d['model'],_0x31851d[_0x35a1('0x35')]);_0x2ab62f[_0x35a1('0x39')]=_[_0x35a1('0x37')](_0x31851d[_0x35a1('0x38')],qs['fields'](_0x152572['query'][_0x35a1('0x3a')]));_0x2ab62f[_0x35a1('0x39')]=_0x2ab62f[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x2ab62f[_0x35a1('0x39')]:_0x31851d[_0x35a1('0x38')];if(!_0x152572[_0x35a1('0x35')]['hasOwnProperty'](_0x35a1('0x57'))){_0x2ab62f['limit']=qs['limit'](_0x152572[_0x35a1('0x35')][_0x35a1('0x23')]);_0x2ab62f['offset']=qs['offset'](_0x152572[_0x35a1('0x35')][_0x35a1('0x22')]);}_0x2ab62f[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0x152572[_0x35a1('0x35')][_0x35a1('0x3d')]);_0x2ab62f[_0x35a1('0x3f')]=qs[_0x35a1('0x36')](_['pick'](_0x152572[_0x35a1('0x35')],_0x31851d[_0x35a1('0x36')]));_0x2ab62f[_0x35a1('0x3f')][_0x35a1('0x58')]=_0xa85658['id'];if(_0x152572[_0x35a1('0x35')][_0x35a1('0x42')]){_0x2ab62f[_0x35a1('0x3f')]=_[_0x35a1('0x40')](_0x2ab62f[_0x35a1('0x3f')],{'$or':_[_0x35a1('0x30')](_0x2ab62f[_0x35a1('0x39')],function(_0x4befb3){var _0x10997c={};_0x10997c[_0x4befb3]={'$like':'%'+_0x152572[_0x35a1('0x35')]['filter']+'%'};return _0x10997c;})});}_0x2ab62f=_[_0x35a1('0x40')]({},_0x2ab62f,_0x152572[_0x35a1('0x43')]);return db[_0x35a1('0x56')][_0x35a1('0x59')](_0x2ab62f);}})[_0x35a1('0x28')](function(_0x3d1198){if(_0x3d1198){return db[_0x35a1('0x5a')][_0x35a1('0x5b')]({'where':{'id':_[_0x35a1('0x30')](_0x3d1198,'UserId'),'role':'agent'},'attributes':['id',_0x35a1('0x2d'),_0x35a1('0x5c'),_0x35a1('0x5d'),_0x35a1('0x5e')]});}})['then'](function(_0x3c37d8){if(_0x3c37d8){return{'count':_0x3c37d8[_0x35a1('0x21')],'rows':_[_0x35a1('0x30')](_0x3c37d8[_0x35a1('0x45')],function(_0x10f603){return{'membername':_0x10f603[_0x35a1('0x2d')],'UserId':_0x10f603['id'],'queue_name':_0x5a6b4e[_0x35a1('0x2d')],'FaxQueueId':_0x5a6b4e['id'],'interface':util[_0x35a1('0x5f')](_0x35a1('0x60'),_0x35a1('0x61'),_0x10f603[_0x35a1('0x2d')]),'penalty':0x0,'paused':_0x10f603['faxPause'],'createdAt':_0x10f603[_0x35a1('0x5e')],'updatedAt':_0x10f603[_0x35a1('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x23ea8f,_0x2ab62f))[_0x35a1('0x46')](handleError(_0x23ea8f,null));};exports[_0x35a1('0x62')]=function(_0x3fe7fa,_0x3717d4,_0x4e19ac){var _0xe4fe48={};var _0x3e57a4={};var _0x2e7195;var _0xa7d769;return db[_0x35a1('0x31')][_0x35a1('0x55')]({'where':{'id':_0x3fe7fa[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3717d4,null))[_0x35a1('0x28')](function(_0x5dbbad){if(_0x5dbbad){_0x2e7195=_0x5dbbad;_0x3e57a4['model']=_['keys'](db[_0x35a1('0x63')][_0x35a1('0x32')]);_0x3e57a4[_0x35a1('0x35')]=_[_0x35a1('0x48')](_0x3fe7fa[_0x35a1('0x35')]);_0x3e57a4[_0x35a1('0x36')]=_['intersection'](_0x3e57a4['model'],_0x3e57a4[_0x35a1('0x35')]);_0xe4fe48[_0x35a1('0x39')]=_[_0x35a1('0x37')](_0x3e57a4['model'],qs[_0x35a1('0x3a')](_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x3a')]));_0xe4fe48[_0x35a1('0x39')]=_0xe4fe48['attributes']['length']?_0xe4fe48[_0x35a1('0x39')]:_0x3e57a4[_0x35a1('0x38')];_0xe4fe48['order']=qs[_0x35a1('0x3d')](_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x3d')]);_0xe4fe48[_0x35a1('0x3f')]=qs['filters'](_[_0x35a1('0x3e')](_0x3fe7fa[_0x35a1('0x35')],_0x3e57a4['filters']));if(_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x42')]){_0xe4fe48[_0x35a1('0x3f')]=_['merge'](_0xe4fe48[_0x35a1('0x3f')],{'$or':_[_0x35a1('0x30')](_0xe4fe48[_0x35a1('0x39')],function(_0xbcd000){var _0x269b3e={};_0x269b3e[_0xbcd000]={'$like':'%'+_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x42')]+'%'};return _0x269b3e;})});}_0xe4fe48=_[_0x35a1('0x40')]({},_0xe4fe48,_0x3fe7fa[_0x35a1('0x43')]);return _0x2e7195[_0x35a1('0x62')](_0xe4fe48);}})[_0x35a1('0x28')](function(_0x120fac){if(_0x120fac){_0xa7d769=_0x120fac[_0x35a1('0x3b')];if(!_0x3fe7fa[_0x35a1('0x35')][_0x35a1('0x64')](_0x35a1('0x57'))){_0xe4fe48['limit']=qs[_0x35a1('0x23')](_0x3fe7fa['query'][_0x35a1('0x23')]);_0xe4fe48[_0x35a1('0x22')]=qs['offset'](_0x3fe7fa[_0x35a1('0x35')]['offset']);}return _0x2e7195['getTeams'](_0xe4fe48);}})['then'](function(_0x10c8dc){if(_0x10c8dc){return _0x10c8dc?{'count':_0xa7d769,'rows':_0x10c8dc}:null;}})[_0x35a1('0x28')](respondWithResult(_0x3717d4,null))['catch'](handleError(_0x3717d4,null));};exports[_0x35a1('0x65')]=function(_0x265cdb,_0x3621c8,_0x2d6242){var _0x2dbed8=_0x265cdb[_0x35a1('0x52')][_0x35a1('0x66')];return db[_0x35a1('0x63')][_0x35a1('0x59')]({'where':{'id':_0x2dbed8},'attributes':['id'],'include':[{'model':db[_0x35a1('0x5a')],'as':'Agents','attributes':['id',_0x35a1('0x2d'),'online',_0x35a1('0x67'),_0x35a1('0x68')],'raw':!![]}]})[_0x35a1('0x28')](function(_0x403115){if(_0x403115){var _0x38d8c1=_[_0x35a1('0x69')](_0x403115,function(_0x365f44){var _0x453f6d=_0x365f44[_0x35a1('0x4d')]({'plain':!![]});return _0x453f6d[_0x35a1('0x6a')];});return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0x265cdb[_0x35a1('0x47')]['id']}})['then'](function(_0x5e735d){return db[_0x35a1('0x6b')]['transaction'](function(_0xb1118d){return _0x5e735d[_0x35a1('0x65')](_0x2dbed8,{'transaction':_0xb1118d})[_0x35a1('0x28')](function(){return BPromise[_0x35a1('0x6c')](_0x38d8c1,function(_0x497838){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x497838['id'],'FaxQueueId':_0x265cdb[_0x35a1('0x47')]['id']},'transaction':_0xb1118d});});})[_0x35a1('0x28')](function(){_0x38d8c1[_0x35a1('0x6d')](function(_0x33fa71){socket[_0x35a1('0x6e')](_0x35a1('0x6f'),{'UserId':_0x33fa71['id'],'FaxQueueId':_0x5e735d['id']});});});});});}})['then'](respondWithStatusCode(_0x3621c8,null))[_0x35a1('0x46')](handleError(_0x3621c8,null));};exports[_0x35a1('0x70')]=function(_0xe32c07,_0x10984e,_0x2c08e9){return db['Team'][_0x35a1('0x59')]({'where':{'id':_0xe32c07['query'][_0x35a1('0x66')]},'attributes':['id'],'include':[{'model':db[_0x35a1('0x5a')],'as':_0x35a1('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10984e,null))[_0x35a1('0x28')](function(_0x4ca0f5){var _0x1dec8a=_[_0x35a1('0x30')](_0x4ca0f5,'id');var _0x140281=[];var _0x21449e=[];var _0xb60e1=squel[_0x35a1('0x71')]();_0xb60e1[_0x35a1('0x72')](_0x35a1('0x73'))['from']('team_has_fax_queues','tq')['join'](_0x35a1('0x74'),'ut',_0x35a1('0x75'))[_0x35a1('0x3f')](_0x35a1('0x76'),_0xe32c07[_0x35a1('0x47')]['id']);for(var _0x5ec513=0x0;_0x5ec513<_0x4ca0f5['length'];_0x5ec513+=0x1){let _0x2f6860=_0x4ca0f5[_0x5ec513];for(var _0x2ec879=0x0;_0x2ec879<_0x2f6860[_0x35a1('0x6a')][_0x35a1('0x3b')];_0x2ec879+=0x1){let _0x578a61=_0x2f6860['Agents'][_0x2ec879];var _0x3a0115=_0xb60e1[_0x35a1('0x77')]();_0x3a0115[_0x35a1('0x3f')](_0x35a1('0x78'),_0x578a61['id']);_0x21449e[_0x35a1('0x79')](db[_0x35a1('0x6b')][_0x35a1('0x35')](_0x3a0115[_0x35a1('0x7a')](),{'type':db[_0x35a1('0x6b')][_0x35a1('0x7b')][_0x35a1('0x7c')]})[_0x35a1('0x28')](function(_0x24d168){if(_0x24d168[_0x35a1('0x3b')]===0x1){return _0x578a61['id'];}else{var _0x3cebc6=_[_0x35a1('0x7d')](_['map'](_0x24d168,_0x35a1('0x7e')),function(_0x3af5f8){return _[_0x35a1('0x7f')](_0x1dec8a,_0x3af5f8);});if(_0x3cebc6){return _0x578a61['id'];}}}));}}return BPromise['all'](_0x21449e)[_0x35a1('0x28')](function(_0x27f1f7){_0x140281=_(_0x140281)[_0x35a1('0x80')](_0x27f1f7)[_0x35a1('0x81')]()['value']();return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0xe32c07[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](function(_0x525467){return db[_0x35a1('0x6b')][_0x35a1('0x82')](function(_0x4dea99){return _0x525467[_0x35a1('0x70')](_0xe32c07['query'][_0x35a1('0x66')],{'transaction':_0x4dea99})[_0x35a1('0x28')](function(){if(!_[_0x35a1('0x83')](_0x140281)){return _0x525467[_0x35a1('0x84')](_0x140281,{'transaction':_0x4dea99});}})[_0x35a1('0x28')](function(){_0x140281[_0x35a1('0x6d')](function(_0x3f4f47){socket[_0x35a1('0x6e')](_0x35a1('0x85'),{'UserId':_0x3f4f47,'FaxQueueId':_0x525467['id']});});});});});});})[_0x35a1('0x28')](respondWithStatusCode(_0x10984e,null))[_0x35a1('0x46')](handleError(_0x10984e,null));};exports[_0x35a1('0x86')]=function(_0x260483,_0x138ad1,_0xdd3b08){return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0x260483[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x138ad1,null))['then'](function(_0xbce060){if(_0xbce060){return _0xbce060['addAgents'](_0x260483[_0x35a1('0x52')][_0x35a1('0x66')],_[_0x35a1('0x87')](_0x260483[_0x35a1('0x52')],[_0x35a1('0x66'),'id'])||{})[_0x35a1('0x88')](function(_0x1a56cf){for(var _0x34e210=0x0;_0x34e210<_0x260483[_0x35a1('0x52')][_0x35a1('0x66')][_0x35a1('0x3b')];_0x34e210+=0x1){socket['emit'](_0x35a1('0x6f'),{'UserId':_0x260483[_0x35a1('0x52')]['ids'][_0x34e210],'FaxQueueId':_0x260483['params']['id']});}return _0x1a56cf;});}})[_0x35a1('0x28')](respondWithResult(_0x138ad1,null))[_0x35a1('0x46')](handleError(_0x138ad1,null));};exports[_0x35a1('0x84')]=function(_0x48e853,_0x146c7a,_0x5654a3){return db[_0x35a1('0x31')][_0x35a1('0x4a')]({'where':{'id':_0x48e853[_0x35a1('0x47')]['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x146c7a,null))[_0x35a1('0x28')](function(_0x3e0ae6){if(_0x3e0ae6){return _0x3e0ae6[_0x35a1('0x84')](_0x48e853[_0x35a1('0x35')][_0x35a1('0x66')])['then'](function(){if(_[_0x35a1('0x89')](_0x48e853[_0x35a1('0x35')][_0x35a1('0x66')])){for(var _0x4a8f2f=0x0;_0x4a8f2f<_0x48e853['query'][_0x35a1('0x66')][_0x35a1('0x3b')];_0x4a8f2f+=0x1){socket[_0x35a1('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x48e853[_0x35a1('0x35')]['ids'][_0x4a8f2f]),'FaxQueueId':Number(_0x48e853[_0x35a1('0x47')]['id'])});}}else{socket[_0x35a1('0x6e')](_0x35a1('0x85'),{'UserId':Number(_0x48e853[_0x35a1('0x35')]['ids']),'FaxQueueId':Number(_0x48e853[_0x35a1('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x146c7a,null))[_0x35a1('0x46')](handleError(_0x146c7a,null));};exports['getAgents']=function(_0xeedeea,_0x3caea6,_0x1dd36b){var _0x16e621={};var _0x272032={};var _0x523aba;var _0x46db8a;return db[_0x35a1('0x31')]['findOne']({'where':{'id':_0xeedeea['params']['id']}})[_0x35a1('0x28')](handleEntityNotFound(_0x3caea6,null))[_0x35a1('0x28')](function(_0x437c27){if(_0x437c27){_0x523aba=_0x437c27;_0x272032[_0x35a1('0x38')]=_[_0x35a1('0x48')](db[_0x35a1('0x5a')][_0x35a1('0x32')]);_0x272032[_0x35a1('0x35')]=_[_0x35a1('0x48')](_0xeedeea[_0x35a1('0x35')]);_0x272032['filters']=_[_0x35a1('0x37')](_0x272032[_0x35a1('0x38')],_0x272032['query']);_0x16e621['attributes']=_[_0x35a1('0x37')](_0x272032[_0x35a1('0x38')],qs['fields'](_0xeedeea[_0x35a1('0x35')][_0x35a1('0x3a')]));_0x16e621[_0x35a1('0x39')]=_0x16e621[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x16e621[_0x35a1('0x39')]:_0x272032['model'];_0x16e621[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0xeedeea['query']['sort']);_0x16e621[_0x35a1('0x3f')]=qs['filters'](_[_0x35a1('0x3e')](_0xeedeea[_0x35a1('0x35')],_0x272032[_0x35a1('0x36')]));if(_0xeedeea[_0x35a1('0x35')][_0x35a1('0x42')]){_0x16e621[_0x35a1('0x3f')]=_[_0x35a1('0x40')](_0x16e621[_0x35a1('0x3f')],{'$or':_[_0x35a1('0x30')](_0x16e621[_0x35a1('0x39')],function(_0xfadebf){var _0x1eef50={};_0x1eef50[_0xfadebf]={'$like':'%'+_0xeedeea['query'][_0x35a1('0x42')]+'%'};return _0x1eef50;})});}_0x16e621=_['merge']({},_0x16e621,_0xeedeea[_0x35a1('0x43')]);return _0x523aba[_0x35a1('0x8a')](_0x16e621);}})[_0x35a1('0x28')](function(_0x5b7da0){if(_0x5b7da0){_0x46db8a=_0x5b7da0[_0x35a1('0x3b')];if(!_0xeedeea[_0x35a1('0x35')][_0x35a1('0x64')](_0x35a1('0x57'))){_0x16e621[_0x35a1('0x23')]=qs[_0x35a1('0x23')](_0xeedeea[_0x35a1('0x35')][_0x35a1('0x23')]);_0x16e621[_0x35a1('0x22')]=qs['offset'](_0xeedeea[_0x35a1('0x35')][_0x35a1('0x22')]);}return _0x523aba[_0x35a1('0x8a')](_0x16e621);}})[_0x35a1('0x28')](function(_0x2239c7){if(_0x2239c7){return _0x2239c7?{'count':_0x46db8a,'rows':_0x2239c7}:null;}})[_0x35a1('0x28')](respondWithResult(_0x3caea6,null))[_0x35a1('0x46')](handleError(_0x3caea6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ffd1ddb..40cfff9 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 _0xcb0a=['update','emit','hook','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xcb0a,0x96));var _0xacb0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcb0a[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xacb0('0x0'))['db'][_0xacb0('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xacb0('0x2')](0x0);var events={'afterCreate':_0xacb0('0x3'),'afterUpdate':_0xacb0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x509bfa){return function(_0xd6b7d8,_0x484131,_0x2c889b){FaxQueueEvents[_0xacb0('0x5')](_0x509bfa+':'+_0xd6b7d8['id'],_0xd6b7d8);FaxQueueEvents[_0xacb0('0x5')](_0x509bfa,_0xd6b7d8);_0x2c889b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xacb0('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x7de0=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x2f4c99,_0x733841){var _0xd1ef71=function(_0x24cf81){while(--_0x24cf81){_0x2f4c99['push'](_0x2f4c99['shift']());}};_0xd1ef71(++_0x733841);}(_0x7de0,0x187));var _0x07de=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7de0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x07de('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x07de('0x1')](0x0);var events={'afterCreate':_0x07de('0x2'),'afterUpdate':_0x07de('0x3'),'afterDestroy':_0x07de('0x4')};function emitEvent(_0x3dda60){return function(_0x51e1a6,_0x193da6,_0x426c15){FaxQueueEvents['emit'](_0x3dda60+':'+_0x51e1a6['id'],_0x51e1a6);FaxQueueEvents[_0x07de('0x5')](_0x3dda60,_0x51e1a6);_0x426c15(null);};}for(var e in events){if(events[_0x07de('0x6')](e)){var event=events[e];FaxQueue[_0x07de('0x7')](e,emitEvent(event));}}module[_0x07de('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 91959d6..a1e5e46 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 _0xabdf=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x535246,_0x20318e){var _0x13d5d4=function(_0x3e828e){while(--_0x3e828e){_0x535246['push'](_0x535246['shift']());}};_0x13d5d4(++_0x20318e);}(_0xabdf,0x184));var _0xfabd=function(_0x1ddb7a,_0x51994e){_0x1ddb7a=_0x1ddb7a-0x0;var _0x4ae029=_0xabdf[_0x1ddb7a];return _0x4ae029;};'use strict';var _=require(_0xfabd('0x0'));var util=require(_0xfabd('0x1'));var logger=require(_0xfabd('0x2'))(_0xfabd('0x3'));var moment=require(_0xfabd('0x4'));var BPromise=require(_0xfabd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfabd('0x6'));var rimraf=require('rimraf');var config=require(_0xfabd('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x59c404,_0x2b563a){return _0x59c404[_0xfabd('0x8')](_0xfabd('0x9'),attributes,{'tableName':_0xfabd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04fd=['define','fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x1ae8a5,_0xb27194){var _0x4ed281=function(_0x1ecf69){while(--_0x1ecf69){_0x1ae8a5['push'](_0x1ae8a5['shift']());}};_0x4ed281(++_0xb27194);}(_0x04fd,0x14c));var _0xd04f=function(_0x5443b7,_0x504c2b){_0x5443b7=_0x5443b7-0x0;var _0x4c198f=_0x04fd[_0x5443b7];return _0x4c198f;};'use strict';var _=require(_0xd04f('0x0'));var util=require('util');var logger=require(_0xd04f('0x1'))(_0xd04f('0x2'));var moment=require(_0xd04f('0x3'));var BPromise=require(_0xd04f('0x4'));var rp=require(_0xd04f('0x5'));var fs=require('fs');var path=require(_0xd04f('0x6'));var rimraf=require(_0xd04f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd04f('0x8'));module['exports']=function(_0x15864b,_0x2344a1){return _0x15864b[_0xd04f('0x9')]('FaxQueue',attributes,{'tableName':_0xd04f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 28feaa0..68b6e0b 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 _0x7318=['include','map','model','then','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxQueue.socket','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes'];(function(_0x47eaec,_0x587b76){var _0x15e9f4=function(_0x5466fd){while(--_0x5466fd){_0x47eaec['push'](_0x47eaec['shift']());}};_0x15e9f4(++_0x587b76);}(_0x7318,0x18d));var _0x8731=function(_0x1178fe,_0x1c1a22){_0x1178fe=_0x1178fe-0x0;var _0x4fa293=_0x7318[_0x1178fe];return _0x4fa293;};'use strict';var _=require(_0x8731('0x0'));var util=require(_0x8731('0x1'));var moment=require(_0x8731('0x2'));var BPromise=require(_0x8731('0x3'));var rs=require(_0x8731('0x4'));var fs=require('fs');var Redis=require(_0x8731('0x5'));var db=require(_0x8731('0x6'))['db'];var utils=require(_0x8731('0x7'));var logger=require(_0x8731('0x8'))(_0x8731('0x9'));var config=require('../../config/environment');var jayson=require(_0x8731('0xa'));var client=jayson[_0x8731('0xb')]['http']({'port':0x232a});config[_0x8731('0xc')]=_[_0x8731('0xd')](config['redis'],{'host':_0x8731('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8731('0xc')]));require(_0x8731('0xf'))['register'](socket);function respondWithRpcPromise(_0x3f25e6,_0x302268,_0xa1a0a9){return new BPromise(function(_0xedeaa4,_0x449410){return client['request'](_0x3f25e6,_0xa1a0a9)['then'](function(_0x579f94){logger[_0x8731('0x10')](_0x8731('0x11'),_0x302268,_0x8731('0x12'));logger[_0x8731('0x13')](_0x8731('0x14'),_0x302268,_0x8731('0x12'),JSON[_0x8731('0x15')](_0x579f94));if(_0x579f94[_0x8731('0x16')]){if(_0x579f94[_0x8731('0x16')][_0x8731('0x17')]===0x1f4){logger['error'](_0x8731('0x11'),_0x302268,_0x579f94['error']['message']);return _0x449410(_0x579f94[_0x8731('0x16')][_0x8731('0x18')]);}logger[_0x8731('0x16')]('FaxQueue,\x20%s,\x20%s',_0x302268,_0x579f94['error'][_0x8731('0x18')]);return _0xedeaa4(_0x579f94['error'][_0x8731('0x18')]);}else{logger[_0x8731('0x10')](_0x8731('0x11'),_0x302268,_0x8731('0x12'));_0xedeaa4(_0x579f94[_0x8731('0x19')]['message']);}})[_0x8731('0x1a')](function(_0x2413b9){logger[_0x8731('0x16')](_0x8731('0x11'),_0x302268,_0x2413b9);_0x449410(_0x2413b9);});});}exports['GetFaxQueue']=function(_0x544465){var _0x2bfccf=this;return new Promise(function(_0x5f32b0,_0x12072d){return db['FaxQueue'][_0x8731('0x1b')]({'raw':_0x544465[_0x8731('0x1c')]?_0x544465['options'][_0x8731('0x1d')]===undefined?!![]:![]:!![],'where':_0x544465[_0x8731('0x1c')]?_0x544465[_0x8731('0x1c')][_0x8731('0x1e')]||null:null,'attributes':_0x544465[_0x8731('0x1c')]?_0x544465['options'][_0x8731('0x1f')]||null:null,'limit':_0x544465[_0x8731('0x1c')]?_0x544465[_0x8731('0x1c')]['limit']||null:null,'include':_0x544465[_0x8731('0x1c')]?_0x544465[_0x8731('0x1c')][_0x8731('0x20')]?_[_0x8731('0x21')](_0x544465[_0x8731('0x1c')][_0x8731('0x20')],function(_0x32207d){return{'model':db[_0x32207d[_0x8731('0x22')]],'as':_0x32207d['as'],'attributes':_0x32207d[_0x8731('0x1f')],'include':_0x32207d[_0x8731('0x20')]?_[_0x8731('0x21')](_0x32207d[_0x8731('0x20')],function(_0x231727){return{'model':db[_0x231727['model']],'as':_0x231727['as'],'attributes':_0x231727[_0x8731('0x1f')],'include':_0x231727['include']?_[_0x8731('0x21')](_0x231727[_0x8731('0x20')],function(_0x290860){return{'model':db[_0x290860[_0x8731('0x22')]],'as':_0x290860['as'],'attributes':_0x290860[_0x8731('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8731('0x23')](function(_0x4d2780){logger[_0x8731('0x10')](_0x8731('0x24'),_0x544465);logger[_0x8731('0x13')](_0x8731('0x24'),_0x544465,JSON[_0x8731('0x15')](_0x4d2780));_0x5f32b0(_0x4d2780);})['catch'](function(_0x3f89a){logger['error'](_0x8731('0x24'),_0x3f89a['message'],_0x544465);_0x12072d(_0x2bfccf[_0x8731('0x16')](0x1f4,_0x3f89a[_0x8731('0x18')]));});});};exports[_0x8731('0x25')]=function(_0x2c4d1f){var _0x431abd=this;return new Promise(function(_0x149497,_0x4e989e){return db['FaxQueue'][_0x8731('0x26')]({'raw':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x1e')]||null:null,'attributes':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x1f')]||null:null,'include':_0x2c4d1f[_0x8731('0x1c')]?_0x2c4d1f['options']['include']?_[_0x8731('0x21')](_0x2c4d1f[_0x8731('0x1c')][_0x8731('0x20')],function(_0x4cfbf3){return{'model':db[_0x4cfbf3['model']],'as':_0x4cfbf3['as'],'attributes':_0x4cfbf3[_0x8731('0x1f')],'include':_0x4cfbf3['include']?_[_0x8731('0x21')](_0x4cfbf3[_0x8731('0x20')],function(_0x157050){return{'model':db[_0x157050['model']],'as':_0x157050['as'],'attributes':_0x157050[_0x8731('0x1f')],'include':_0x157050[_0x8731('0x20')]?_[_0x8731('0x21')](_0x157050[_0x8731('0x20')],function(_0x4b1067){return{'model':db[_0x4b1067[_0x8731('0x22')]],'as':_0x4b1067['as'],'attributes':_0x4b1067['attributes']};}):[]};}):[]};}):[]:[]})[_0x8731('0x23')](function(_0x1ee107){logger['info'](_0x8731('0x25'),_0x2c4d1f);logger[_0x8731('0x13')]('ShowFaxQueue',_0x2c4d1f,JSON[_0x8731('0x15')](_0x1ee107));_0x149497(_0x1ee107);})[_0x8731('0x1a')](function(_0x127a84){logger['error'](_0x8731('0x25'),_0x127a84['message'],_0x2c4d1f);_0x4e989e(_0x431abd[_0x8731('0x16')](0x1f4,_0x127a84['message']));});});}; \ No newline at end of file +var _0xba7f=['info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','map','model','include','then','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','request'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xba7f,0xee));var _0xfba7=function(_0x2152e0,_0x99ca91){_0x2152e0=_0x2152e0-0x0;var _0x22127d=_0xba7f[_0x2152e0];return _0x22127d;};'use strict';var _=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var moment=require(_0xfba7('0x2'));var BPromise=require(_0xfba7('0x3'));var rs=require(_0xfba7('0x4'));var fs=require('fs');var Redis=require(_0xfba7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfba7('0x6'))(_0xfba7('0x7'));var config=require(_0xfba7('0x8'));var jayson=require(_0xfba7('0x9'));var client=jayson[_0xfba7('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfba7('0xb')],{'host':_0xfba7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x244aa4,_0x551939,_0x2c79c6){return new BPromise(function(_0x3d73bf,_0x21809b){return client[_0xfba7('0xd')](_0x244aa4,_0x2c79c6)['then'](function(_0x2dcb9d){logger[_0xfba7('0xe')](_0xfba7('0xf'),_0x551939,_0xfba7('0x10'));logger[_0xfba7('0x11')](_0xfba7('0x12'),_0x551939,_0xfba7('0x10'),JSON[_0xfba7('0x13')](_0x2dcb9d));if(_0x2dcb9d['error']){if(_0x2dcb9d[_0xfba7('0x14')][_0xfba7('0x15')]===0x1f4){logger['error'](_0xfba7('0xf'),_0x551939,_0x2dcb9d['error']['message']);return _0x21809b(_0x2dcb9d['error'][_0xfba7('0x16')]);}logger[_0xfba7('0x14')]('FaxQueue,\x20%s,\x20%s',_0x551939,_0x2dcb9d[_0xfba7('0x14')]['message']);return _0x3d73bf(_0x2dcb9d[_0xfba7('0x14')][_0xfba7('0x16')]);}else{logger[_0xfba7('0xe')](_0xfba7('0xf'),_0x551939,_0xfba7('0x10'));_0x3d73bf(_0x2dcb9d['result']['message']);}})[_0xfba7('0x17')](function(_0x49e9d4){logger[_0xfba7('0x14')](_0xfba7('0xf'),_0x551939,_0x49e9d4);_0x21809b(_0x49e9d4);});});}exports[_0xfba7('0x18')]=function(_0x5237d5){var _0x12c31c=this;return new Promise(function(_0x2ecc1b,_0x5a391c){return db[_0xfba7('0x19')]['findAll']({'raw':_0x5237d5['options']?_0x5237d5[_0xfba7('0x1a')][_0xfba7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5['options'][_0xfba7('0x1c')]||null:null,'attributes':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5[_0xfba7('0x1a')][_0xfba7('0x1d')]||null:null,'limit':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5[_0xfba7('0x1a')][_0xfba7('0x1e')]||null:null,'include':_0x5237d5[_0xfba7('0x1a')]?_0x5237d5['options']['include']?_[_0xfba7('0x1f')](_0x5237d5[_0xfba7('0x1a')]['include'],function(_0x400fa2){return{'model':db[_0x400fa2['model']],'as':_0x400fa2['as'],'attributes':_0x400fa2['attributes'],'include':_0x400fa2['include']?_['map'](_0x400fa2['include'],function(_0x4a0351){return{'model':db[_0x4a0351[_0xfba7('0x20')]],'as':_0x4a0351['as'],'attributes':_0x4a0351['attributes'],'include':_0x4a0351[_0xfba7('0x21')]?_[_0xfba7('0x1f')](_0x4a0351[_0xfba7('0x21')],function(_0x53f903){return{'model':db[_0x53f903[_0xfba7('0x20')]],'as':_0x53f903['as'],'attributes':_0x53f903[_0xfba7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfba7('0x22')](function(_0x12d7cb){logger[_0xfba7('0xe')]('GetFaxQueue',_0x5237d5);logger[_0xfba7('0x11')](_0xfba7('0x18'),_0x5237d5,JSON[_0xfba7('0x13')](_0x12d7cb));_0x2ecc1b(_0x12d7cb);})[_0xfba7('0x17')](function(_0x20e524){logger[_0xfba7('0x14')](_0xfba7('0x18'),_0x20e524[_0xfba7('0x16')],_0x5237d5);_0x5a391c(_0x12c31c[_0xfba7('0x14')](0x1f4,_0x20e524[_0xfba7('0x16')]));});});};exports[_0xfba7('0x23')]=function(_0x2fb3b7){var _0x58a016=this;return new Promise(function(_0x4643ec,_0x2e65d2){return db['FaxQueue']['find']({'raw':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x1c')]||null:null,'attributes':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x1d')]||null:null,'include':_0x2fb3b7[_0xfba7('0x1a')]?_0x2fb3b7['options'][_0xfba7('0x21')]?_['map'](_0x2fb3b7[_0xfba7('0x1a')][_0xfba7('0x21')],function(_0x543a76){return{'model':db[_0x543a76[_0xfba7('0x20')]],'as':_0x543a76['as'],'attributes':_0x543a76[_0xfba7('0x1d')],'include':_0x543a76[_0xfba7('0x21')]?_[_0xfba7('0x1f')](_0x543a76[_0xfba7('0x21')],function(_0x32e8ad){return{'model':db[_0x32e8ad[_0xfba7('0x20')]],'as':_0x32e8ad['as'],'attributes':_0x32e8ad[_0xfba7('0x1d')],'include':_0x32e8ad[_0xfba7('0x21')]?_['map'](_0x32e8ad[_0xfba7('0x21')],function(_0x58534c){return{'model':db[_0x58534c['model']],'as':_0x58534c['as'],'attributes':_0x58534c[_0xfba7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfba7('0x22')](function(_0xabab5d){logger[_0xfba7('0xe')](_0xfba7('0x23'),_0x2fb3b7);logger[_0xfba7('0x11')](_0xfba7('0x23'),_0x2fb3b7,JSON['stringify'](_0xabab5d));_0x4643ec(_0xabab5d);})['catch'](function(_0x41b41d){logger['error'](_0xfba7('0x23'),_0x41b41d[_0xfba7('0x16')],_0x2fb3b7);_0x2e65d2(_0x58a016[_0xfba7('0x14')](0x1f4,_0x41b41d[_0xfba7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b7be8d6..945b243 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 _0xa53f=['./faxQueue.events','update','removeListener','length'];(function(_0x26ce99,_0x51c44a){var _0x69dd3d=function(_0x3dc2d9){while(--_0x3dc2d9){_0x26ce99['push'](_0x26ce99['shift']());}};_0x69dd3d(++_0x51c44a);}(_0xa53f,0xa8));var _0xfa53=function(_0x571ad8,_0x455385){_0x571ad8=_0x571ad8-0x0;var _0x2e0723=_0xa53f[_0x571ad8];return _0x2e0723;};'use strict';var FaxQueueEvents=require(_0xfa53('0x0'));var events=['save','remove',_0xfa53('0x1')];function createListener(_0x19a96f,_0x3b8de0){return function(_0x1c38d2){_0x3b8de0['emit'](_0x19a96f,_0x1c38d2);};}function removeListener(_0x373acc,_0x437ce6){return function(){FaxQueueEvents[_0xfa53('0x2')](_0x373acc,_0x437ce6);};}exports['register']=function(_0x44a384){for(var _0x276376=0x0,_0x35f8c4=events[_0xfa53('0x3')];_0x276376<_0x35f8c4;_0x276376++){var _0x2f9494=events[_0x276376];var _0x4e967c=createListener('faxQueue:'+_0x2f9494,_0x44a384);FaxQueueEvents['on'](_0x2f9494,_0x4e967c);}}; \ No newline at end of file +var _0x893a=['update','register','length','./faxQueue.events','save'];(function(_0x54105,_0x12af79){var _0x56ea83=function(_0x37f1e6){while(--_0x37f1e6){_0x54105['push'](_0x54105['shift']());}};_0x56ea83(++_0x12af79);}(_0x893a,0x7b));var _0xa893=function(_0x14ddc4,_0x3847a3){_0x14ddc4=_0x14ddc4-0x0;var _0x28e482=_0x893a[_0x14ddc4];return _0x28e482;};'use strict';var FaxQueueEvents=require(_0xa893('0x0'));var events=[_0xa893('0x1'),'remove',_0xa893('0x2')];function createListener(_0x4fbcd3,_0x479477){return function(_0x214f16){_0x479477['emit'](_0x4fbcd3,_0x214f16);};}function removeListener(_0xd75a00,_0x2f6324){return function(){FaxQueueEvents['removeListener'](_0xd75a00,_0x2f6324);};}exports[_0xa893('0x3')]=function(_0x38b214){for(var _0xc9c8b=0x0,_0x591982=events[_0xa893('0x4')];_0xc9c8b<_0x591982;_0xc9c8b++){var _0x40829c=events[_0xc9c8b];var _0x548831=createListener('faxQueue:'+_0x40829c,_0x38b214);FaxQueueEvents['on'](_0x40829c,_0x548831);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7b311a3..5c8c493 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(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3364fc,_0x559233){_0x3364fc=_0x3364fc-0x0;var _0x10df36=_0xb10b[_0x3364fc];return _0x10df36;};'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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x2b89dc,_0x8bfa42){var _0x412762=function(_0x42dc39){while(--_0x42dc39){_0x2b89dc['push'](_0x2b89dc['shift']());}};_0x412762(++_0x8bfa42);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 35718cd..64cac34 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 _0x2569=['STRING','DATE','moment','exports'];(function(_0x4c3b60,_0x324bd4){var _0x4b0f05=function(_0x1562fd){while(--_0x1562fd){_0x4c3b60['push'](_0x4c3b60['shift']());}};_0x4b0f05(++_0x324bd4);}(_0x2569,0x172));var _0x9256=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0x2569[_0x582d5a];return _0x5625ef;};'use strict';var moment=require(_0x9256('0x0'));var Sequelize=require('sequelize');module[_0x9256('0x1')]={'uniqueid':{'type':Sequelize[_0x9256('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9256('0x3')]},'leaveAt':{'type':Sequelize[_0x9256('0x3')]},'acceptAt':{'type':Sequelize[_0x9256('0x3')]},'exitAt':{'type':Sequelize[_0x9256('0x3')]},'reason':{'type':Sequelize[_0x9256('0x2')]}}; \ No newline at end of file +var _0x2391=['DATE','moment','sequelize','STRING'];(function(_0x59f756,_0x5f4d70){var _0x1d4d3b=function(_0x2c903a){while(--_0x2c903a){_0x59f756['push'](_0x59f756['shift']());}};_0x1d4d3b(++_0x5f4d70);}(_0x2391,0xb5));var _0x1239=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2391[_0x491a7f];return _0x3d8f44;};'use strict';var moment=require(_0x1239('0x0'));var Sequelize=require(_0x1239('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1239('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1239('0x2')]},'joinAt':{'type':Sequelize[_0x1239('0x3')]},'leaveAt':{'type':Sequelize[_0x1239('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1239('0x3')]},'reason':{'type':Sequelize[_0x1239('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0d8a571..74ea658 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 _0x9817=['index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','create','body','update','find','destroy','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send'];(function(_0x53c779,_0xd4aacd){var _0x2859d5=function(_0x229252){while(--_0x229252){_0x53c779['push'](_0x53c779['shift']());}};_0x2859d5(++_0xd4aacd);}(_0x9817,0x109));var _0x7981=function(_0x9f5610,_0x29f657){_0x9f5610=_0x9f5610-0x0;var _0x206d77=_0x9817[_0x9f5610];return _0x206d77;};'use strict';var pdf=require(_0x7981('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7981('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7981('0x2'));var moment=require(_0x7981('0x3'));var BPromise=require(_0x7981('0x4'));var Mustache=require(_0x7981('0x5'));var util=require('util');var path=require(_0x7981('0x6'));var sox=require('sox');var csv=require(_0x7981('0x7'));var ejs=require(_0x7981('0x8'));var fs=require('fs');var _=require(_0x7981('0x9'));var squel=require(_0x7981('0xa'));var crypto=require(_0x7981('0xb'));var jsforce=require(_0x7981('0xc'));var deskjs=require(_0x7981('0xd'));var toCsv=require(_0x7981('0x7'));var querystring=require(_0x7981('0xe'));var Papa=require(_0x7981('0xf'));var Redis=require(_0x7981('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7981('0x11'));var as=require(_0x7981('0x12'));var hardwareService=require(_0x7981('0x13'));var logger=require('../../config/logger')(_0x7981('0x14'));var utils=require(_0x7981('0x15'));var config=require('../../config/environment');var db=require(_0x7981('0x16'))['db'];function respondWithStatusCode(_0x2b1053,_0x3c9c36){_0x3c9c36=_0x3c9c36||0xcc;return function(_0x13d0bc){if(_0x13d0bc){return _0x2b1053['sendStatus'](_0x3c9c36);}return _0x2b1053[_0x7981('0x17')](_0x3c9c36)[_0x7981('0x18')]();};}function respondWithResult(_0xf977dd,_0x5e6390){_0x5e6390=_0x5e6390||0xc8;return function(_0x420574){if(_0x420574){return _0xf977dd[_0x7981('0x17')](_0x5e6390)[_0x7981('0x19')](_0x420574);}};}function respondWithFilteredResult(_0x302c31,_0x2fa329){return function(_0x32b71d){if(_0x32b71d){var _0x5c72af=_0x32b71d['count'],_0x271666=_0x2fa329[_0x7981('0x1a')],_0x1a65a4=_0x2fa329[_0x7981('0x1a')]+_0x2fa329[_0x7981('0x1b')],_0x3ba54f;if(_0x1a65a4>=_0x5c72af){_0x1a65a4=_0x5c72af;_0x3ba54f=0xc8;}else{_0x3ba54f=0xce;}_0x302c31[_0x7981('0x17')](_0x3ba54f);return _0x302c31[_0x7981('0x1c')](_0x7981('0x1d'),_0x271666+'-'+_0x1a65a4+'/'+_0x5c72af)[_0x7981('0x19')](_0x32b71d);}return null;};}function patchUpdates(_0x4276bd){return function(_0x52bef6){try{jsonpatch[_0x7981('0x1e')](_0x52bef6,_0x4276bd,!![]);}catch(_0x33badc){return BPromise[_0x7981('0x1f')](_0x33badc);}return _0x52bef6[_0x7981('0x20')]();};}function saveUpdates(_0x624654,_0x204fc5){return function(_0x3398a2){if(_0x3398a2){return _0x3398a2['update'](_0x624654)[_0x7981('0x21')](function(_0x1f5a3b){return _0x1f5a3b;});}return null;};}function removeEntity(_0x2b2bdd,_0xcd7898){return function(_0x4b053c){if(_0x4b053c){return _0x4b053c['destroy']()[_0x7981('0x21')](function(){_0x2b2bdd[_0x7981('0x17')](0xcc)[_0x7981('0x18')]();});}};}function handleEntityNotFound(_0x4bb43a,_0x35c8ca){return function(_0x302a53){if(!_0x302a53){_0x4bb43a[_0x7981('0x22')](0x194);}return _0x302a53;};}function handleError(_0x3be557,_0x188b0d){_0x188b0d=_0x188b0d||0x1f4;return function(_0x5c3172){logger[_0x7981('0x23')](_0x5c3172[_0x7981('0x24')]);if(_0x5c3172[_0x7981('0x25')]){delete _0x5c3172[_0x7981('0x25')];}_0x3be557[_0x7981('0x17')](_0x188b0d)[_0x7981('0x26')](_0x5c3172);};}exports[_0x7981('0x27')]=function(_0x56575a,_0x4c09ab){var _0x127712={},_0x4a2882={},_0x1d56c0={'count':0x0,'rows':[]};var _0xd63930=_[_0x7981('0x28')](db[_0x7981('0x29')][_0x7981('0x2a')],function(_0x4110e6){return{'name':_0x4110e6[_0x7981('0x2b')],'type':_0x4110e6[_0x7981('0x2c')][_0x7981('0x2d')]};});_0x4a2882[_0x7981('0x2e')]=_['map'](_0xd63930,_0x7981('0x25'));_0x4a2882[_0x7981('0x2f')]=_[_0x7981('0x30')](_0x56575a[_0x7981('0x2f')]);_0x4a2882[_0x7981('0x31')]=_[_0x7981('0x32')](_0x4a2882[_0x7981('0x2e')],_0x4a2882[_0x7981('0x2f')]);_0x127712[_0x7981('0x33')]=_[_0x7981('0x32')](_0x4a2882[_0x7981('0x2e')],qs[_0x7981('0x34')](_0x56575a[_0x7981('0x2f')][_0x7981('0x34')]));_0x127712[_0x7981('0x33')]=_0x127712[_0x7981('0x33')][_0x7981('0x35')]?_0x127712[_0x7981('0x33')]:_0x4a2882[_0x7981('0x2e')];if(!_0x56575a[_0x7981('0x2f')][_0x7981('0x36')](_0x7981('0x37'))){_0x127712['limit']=qs[_0x7981('0x1b')](_0x56575a[_0x7981('0x2f')][_0x7981('0x1b')]);_0x127712[_0x7981('0x1a')]=qs[_0x7981('0x1a')](_0x56575a[_0x7981('0x2f')][_0x7981('0x1a')]);}_0x127712[_0x7981('0x38')]=qs['sort'](_0x56575a[_0x7981('0x2f')][_0x7981('0x39')]);_0x127712[_0x7981('0x3a')]=qs[_0x7981('0x31')](_[_0x7981('0x3b')](_0x56575a[_0x7981('0x2f')],_0x4a2882[_0x7981('0x31')]),_0xd63930);if(_0x56575a['query'][_0x7981('0x3c')]){_0x127712[_0x7981('0x3a')]=_[_0x7981('0x3d')](_0x127712['where'],{'$or':_[_0x7981('0x28')](_0xd63930,function(_0x32217a){if(_0x32217a[_0x7981('0x2c')]!=='VIRTUAL'){var _0x46b0de={};_0x46b0de[_0x32217a[_0x7981('0x25')]]={'$like':'%'+_0x56575a[_0x7981('0x2f')][_0x7981('0x3c')]+'%'};return _0x46b0de;}})});}_0x127712=_['merge']({},_0x127712,_0x56575a[_0x7981('0x3e')]);var _0x4f4cc2={'where':_0x127712[_0x7981('0x3a')]};return db[_0x7981('0x29')][_0x7981('0x3f')](_0x4f4cc2)[_0x7981('0x21')](function(_0x4d351f){_0x1d56c0['count']=_0x4d351f;if(_0x56575a['query'][_0x7981('0x40')]){_0x127712[_0x7981('0x41')]=[{'all':!![]}];}return db[_0x7981('0x29')][_0x7981('0x42')](_0x127712);})[_0x7981('0x21')](function(_0x164ba2){_0x1d56c0[_0x7981('0x43')]=_0x164ba2;return _0x1d56c0;})[_0x7981('0x21')](respondWithFilteredResult(_0x4c09ab,_0x127712))[_0x7981('0x44')](handleError(_0x4c09ab,null));};exports['show']=function(_0x393183,_0x1d2e11){var _0x4ae7b3={'raw':!![],'where':{'id':_0x393183[_0x7981('0x45')]['id']}},_0x2bbf01={};_0x2bbf01['model']=_[_0x7981('0x30')](db[_0x7981('0x29')][_0x7981('0x2a')]);_0x2bbf01[_0x7981('0x2f')]=_[_0x7981('0x30')](_0x393183[_0x7981('0x2f')]);_0x2bbf01[_0x7981('0x31')]=_[_0x7981('0x32')](_0x2bbf01[_0x7981('0x2e')],_0x2bbf01['query']);_0x4ae7b3[_0x7981('0x33')]=_['intersection'](_0x2bbf01[_0x7981('0x2e')],qs[_0x7981('0x34')](_0x393183[_0x7981('0x2f')][_0x7981('0x34')]));_0x4ae7b3[_0x7981('0x33')]=_0x4ae7b3[_0x7981('0x33')]['length']?_0x4ae7b3[_0x7981('0x33')]:_0x2bbf01['model'];if(_0x393183[_0x7981('0x2f')][_0x7981('0x40')]){_0x4ae7b3[_0x7981('0x41')]=[{'all':!![]}];}_0x4ae7b3=_[_0x7981('0x3d')]({},_0x4ae7b3,_0x393183[_0x7981('0x3e')]);return db[_0x7981('0x29')]['find'](_0x4ae7b3)[_0x7981('0x21')](handleEntityNotFound(_0x1d2e11,null))[_0x7981('0x21')](respondWithResult(_0x1d2e11,null))[_0x7981('0x44')](handleError(_0x1d2e11,null));};exports[_0x7981('0x46')]=function(_0x36b476,_0x5c9538){return db[_0x7981('0x29')][_0x7981('0x46')](_0x36b476[_0x7981('0x47')],{})[_0x7981('0x21')](respondWithResult(_0x5c9538,0xc9))[_0x7981('0x44')](handleError(_0x5c9538,null));};exports[_0x7981('0x48')]=function(_0x32f0ba,_0x2044a5){if(_0x32f0ba[_0x7981('0x47')]['id']){delete _0x32f0ba[_0x7981('0x47')]['id'];}return db[_0x7981('0x29')][_0x7981('0x49')]({'where':{'id':_0x32f0ba[_0x7981('0x45')]['id']}})[_0x7981('0x21')](handleEntityNotFound(_0x2044a5,null))[_0x7981('0x21')](saveUpdates(_0x32f0ba['body'],null))[_0x7981('0x21')](respondWithResult(_0x2044a5,null))[_0x7981('0x44')](handleError(_0x2044a5,null));};exports[_0x7981('0x4a')]=function(_0x78fe3f,_0x38d859){return db[_0x7981('0x29')][_0x7981('0x49')]({'where':{'id':_0x78fe3f['params']['id']}})['then'](handleEntityNotFound(_0x38d859,null))[_0x7981('0x21')](removeEntity(_0x38d859,null))[_0x7981('0x44')](handleError(_0x38d859,null));};exports[_0x7981('0x4b')]=function(_0x53605a,_0x49c385){return db[_0x7981('0x29')][_0x7981('0x4b')]()[_0x7981('0x21')](respondWithResult(_0x49c385,null))[_0x7981('0x44')](handleError(_0x49c385,null));}; \ No newline at end of file +var _0x62d1=['includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','FaxQueueReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x5e146f,_0x5c04f9){var _0x44ce4d=function(_0xb4744f){while(--_0xb4744f){_0x5e146f['push'](_0x5e146f['shift']());}};_0x44ce4d(++_0x5c04f9);}(_0x62d1,0x18e));var _0x162d=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0x62d1[_0x2f2d88];return _0x4742ee;};'use strict';var pdf=require(_0x162d('0x0'));var emlformat=require(_0x162d('0x1'));var rimraf=require(_0x162d('0x2'));var zipdir=require(_0x162d('0x3'));var jsonpatch=require(_0x162d('0x4'));var rp=require(_0x162d('0x5'));var moment=require(_0x162d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x162d('0x7'));var util=require(_0x162d('0x8'));var path=require(_0x162d('0x9'));var sox=require(_0x162d('0xa'));var csv=require(_0x162d('0xb'));var ejs=require(_0x162d('0xc'));var fs=require('fs');var _=require(_0x162d('0xd'));var squel=require(_0x162d('0xe'));var crypto=require('crypto');var jsforce=require(_0x162d('0xf'));var deskjs=require(_0x162d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x162d('0x11'));var Papa=require(_0x162d('0x12'));var Redis=require(_0x162d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x162d('0x14'));var logger=require(_0x162d('0x15'))(_0x162d('0x16'));var utils=require(_0x162d('0x17'));var config=require('../../config/environment');var db=require(_0x162d('0x18'))['db'];function respondWithStatusCode(_0x3709fe,_0x23a3d8){_0x23a3d8=_0x23a3d8||0xcc;return function(_0x2e4d77){if(_0x2e4d77){return _0x3709fe[_0x162d('0x19')](_0x23a3d8);}return _0x3709fe[_0x162d('0x1a')](_0x23a3d8)['end']();};}function respondWithResult(_0x3e39c3,_0x3a19fd){_0x3a19fd=_0x3a19fd||0xc8;return function(_0x10a01e){if(_0x10a01e){return _0x3e39c3['status'](_0x3a19fd)[_0x162d('0x1b')](_0x10a01e);}};}function respondWithFilteredResult(_0x371be7,_0x45a2f4){return function(_0xf0a5d5){if(_0xf0a5d5){var _0x4b3b42=_0xf0a5d5[_0x162d('0x1c')],_0x42c685=_0x45a2f4[_0x162d('0x1d')],_0x36a53e=_0x45a2f4[_0x162d('0x1d')]+_0x45a2f4[_0x162d('0x1e')],_0x3d1264;if(_0x36a53e>=_0x4b3b42){_0x36a53e=_0x4b3b42;_0x3d1264=0xc8;}else{_0x3d1264=0xce;}_0x371be7['status'](_0x3d1264);return _0x371be7[_0x162d('0x1f')](_0x162d('0x20'),_0x42c685+'-'+_0x36a53e+'/'+_0x4b3b42)[_0x162d('0x1b')](_0xf0a5d5);}return null;};}function patchUpdates(_0x829428){return function(_0x34a02b){try{jsonpatch[_0x162d('0x21')](_0x34a02b,_0x829428,!![]);}catch(_0x138481){return BPromise[_0x162d('0x22')](_0x138481);}return _0x34a02b[_0x162d('0x23')]();};}function saveUpdates(_0x9b84ba,_0x1b3eb9){return function(_0x4e28f2){if(_0x4e28f2){return _0x4e28f2['update'](_0x9b84ba)[_0x162d('0x24')](function(_0x4300c2){return _0x4300c2;});}return null;};}function removeEntity(_0x45e17e,_0x355592){return function(_0xa4406e){if(_0xa4406e){return _0xa4406e['destroy']()[_0x162d('0x24')](function(){_0x45e17e['status'](0xcc)[_0x162d('0x25')]();});}};}function handleEntityNotFound(_0x168092,_0x2f9f90){return function(_0x543b2c){if(!_0x543b2c){_0x168092[_0x162d('0x19')](0x194);}return _0x543b2c;};}function handleError(_0x1559a2,_0x2407bb){_0x2407bb=_0x2407bb||0x1f4;return function(_0x22527d){logger[_0x162d('0x26')](_0x22527d[_0x162d('0x27')]);if(_0x22527d[_0x162d('0x28')]){delete _0x22527d[_0x162d('0x28')];}_0x1559a2[_0x162d('0x1a')](_0x2407bb)[_0x162d('0x29')](_0x22527d);};}exports['index']=function(_0x45b9d6,_0x15fbc1){var _0x1769d3={},_0x5e649a={},_0x26699c={'count':0x0,'rows':[]};var _0x66f3bc=_[_0x162d('0x2a')](db[_0x162d('0x2b')]['rawAttributes'],function(_0x27aab4){return{'name':_0x27aab4[_0x162d('0x2c')],'type':_0x27aab4['type'][_0x162d('0x2d')]};});_0x5e649a[_0x162d('0x2e')]=_[_0x162d('0x2a')](_0x66f3bc,'name');_0x5e649a[_0x162d('0x2f')]=_[_0x162d('0x30')](_0x45b9d6['query']);_0x5e649a[_0x162d('0x31')]=_['intersection'](_0x5e649a['model'],_0x5e649a[_0x162d('0x2f')]);_0x1769d3[_0x162d('0x32')]=_[_0x162d('0x33')](_0x5e649a[_0x162d('0x2e')],qs[_0x162d('0x34')](_0x45b9d6[_0x162d('0x2f')]['fields']));_0x1769d3[_0x162d('0x32')]=_0x1769d3['attributes'][_0x162d('0x35')]?_0x1769d3['attributes']:_0x5e649a['model'];if(!_0x45b9d6['query'][_0x162d('0x36')](_0x162d('0x37'))){_0x1769d3['limit']=qs['limit'](_0x45b9d6[_0x162d('0x2f')]['limit']);_0x1769d3[_0x162d('0x1d')]=qs['offset'](_0x45b9d6[_0x162d('0x2f')][_0x162d('0x1d')]);}_0x1769d3[_0x162d('0x38')]=qs['sort'](_0x45b9d6[_0x162d('0x2f')]['sort']);_0x1769d3[_0x162d('0x39')]=qs[_0x162d('0x31')](_[_0x162d('0x3a')](_0x45b9d6[_0x162d('0x2f')],_0x5e649a[_0x162d('0x31')]),_0x66f3bc);if(_0x45b9d6[_0x162d('0x2f')][_0x162d('0x3b')]){_0x1769d3[_0x162d('0x39')]=_[_0x162d('0x3c')](_0x1769d3[_0x162d('0x39')],{'$or':_[_0x162d('0x2a')](_0x66f3bc,function(_0x4cd8b7){if(_0x4cd8b7[_0x162d('0x3d')]!==_0x162d('0x3e')){var _0x5a69b0={};_0x5a69b0[_0x4cd8b7['name']]={'$like':'%'+_0x45b9d6[_0x162d('0x2f')][_0x162d('0x3b')]+'%'};return _0x5a69b0;}})});}_0x1769d3=_[_0x162d('0x3c')]({},_0x1769d3,_0x45b9d6[_0x162d('0x3f')]);var _0x3ce237={'where':_0x1769d3[_0x162d('0x39')]};return db[_0x162d('0x2b')][_0x162d('0x1c')](_0x3ce237)['then'](function(_0x5938e4){_0x26699c['count']=_0x5938e4;if(_0x45b9d6[_0x162d('0x2f')][_0x162d('0x40')]){_0x1769d3[_0x162d('0x41')]=[{'all':!![]}];}return db[_0x162d('0x2b')][_0x162d('0x42')](_0x1769d3);})['then'](function(_0x517301){_0x26699c[_0x162d('0x43')]=_0x517301;return _0x26699c;})[_0x162d('0x24')](respondWithFilteredResult(_0x15fbc1,_0x1769d3))[_0x162d('0x44')](handleError(_0x15fbc1,null));};exports[_0x162d('0x45')]=function(_0x272088,_0x388ebf){var _0x1a99a8={'raw':!![],'where':{'id':_0x272088['params']['id']}},_0x50b5a8={};_0x50b5a8[_0x162d('0x2e')]=_[_0x162d('0x30')](db['FaxQueueReport'][_0x162d('0x46')]);_0x50b5a8[_0x162d('0x2f')]=_['keys'](_0x272088[_0x162d('0x2f')]);_0x50b5a8[_0x162d('0x31')]=_['intersection'](_0x50b5a8[_0x162d('0x2e')],_0x50b5a8['query']);_0x1a99a8[_0x162d('0x32')]=_[_0x162d('0x33')](_0x50b5a8[_0x162d('0x2e')],qs['fields'](_0x272088[_0x162d('0x2f')][_0x162d('0x34')]));_0x1a99a8[_0x162d('0x32')]=_0x1a99a8[_0x162d('0x32')][_0x162d('0x35')]?_0x1a99a8[_0x162d('0x32')]:_0x50b5a8['model'];if(_0x272088[_0x162d('0x2f')][_0x162d('0x40')]){_0x1a99a8[_0x162d('0x41')]=[{'all':!![]}];}_0x1a99a8=_[_0x162d('0x3c')]({},_0x1a99a8,_0x272088[_0x162d('0x3f')]);return db[_0x162d('0x2b')][_0x162d('0x47')](_0x1a99a8)[_0x162d('0x24')](handleEntityNotFound(_0x388ebf,null))['then'](respondWithResult(_0x388ebf,null))[_0x162d('0x44')](handleError(_0x388ebf,null));};exports[_0x162d('0x48')]=function(_0x2d6caf,_0x30ef30){return db[_0x162d('0x2b')]['create'](_0x2d6caf[_0x162d('0x49')],{})['then'](respondWithResult(_0x30ef30,0xc9))[_0x162d('0x44')](handleError(_0x30ef30,null));};exports[_0x162d('0x4a')]=function(_0x1cb9b4,_0x3a808c){if(_0x1cb9b4[_0x162d('0x49')]['id']){delete _0x1cb9b4[_0x162d('0x49')]['id'];}return db['FaxQueueReport'][_0x162d('0x47')]({'where':{'id':_0x1cb9b4[_0x162d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a808c,null))[_0x162d('0x24')](saveUpdates(_0x1cb9b4[_0x162d('0x49')],null))[_0x162d('0x24')](respondWithResult(_0x3a808c,null))[_0x162d('0x44')](handleError(_0x3a808c,null));};exports['destroy']=function(_0x438cd9,_0x569739){return db['FaxQueueReport']['find']({'where':{'id':_0x438cd9['params']['id']}})[_0x162d('0x24')](handleEntityNotFound(_0x569739,null))[_0x162d('0x24')](removeEntity(_0x569739,null))[_0x162d('0x44')](handleError(_0x569739,null));};exports[_0x162d('0x4c')]=function(_0x30ea0c,_0x4b3fd4){return db[_0x162d('0x2b')][_0x162d('0x4c')]()[_0x162d('0x24')](respondWithResult(_0x4b3fd4,null))[_0x162d('0x44')](handleError(_0x4b3fd4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9475160..bb2c283 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 _0xf65d=['path','exports','define','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x234a7b,_0x4d22ca){var _0x21aef1=function(_0x289d67){while(--_0x289d67){_0x234a7b['push'](_0x234a7b['shift']());}};_0x21aef1(++_0x4d22ca);}(_0xf65d,0x9f));var _0xdf65=function(_0xe24841,_0x2c0f66){_0xe24841=_0xe24841-0x0;var _0x2e41b3=_0xf65d[_0xe24841];return _0x2e41b3;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('FaxQueueReport',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[{'name':_0xdf65('0xa'),'fields':[_0xdf65('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d68=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','report_fax_queue','uniqueid'];(function(_0xfa4ca1,_0x3e7106){var _0x2cdbb6=function(_0x21fd92){while(--_0x21fd92){_0xfa4ca1['push'](_0xfa4ca1['shift']());}};_0x2cdbb6(++_0x3e7106);}(_0x4d68,0x1c3));var _0x84d6=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x4d68[_0x503790];return _0x388092;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var logger=require(_0x84d6('0x2'))(_0x84d6('0x3'));var moment=require(_0x84d6('0x4'));var BPromise=require(_0x84d6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84d6('0x6'));var rimraf=require('rimraf');var config=require(_0x84d6('0x7'));var attributes=require('./faxQueueReport.attributes');module[_0x84d6('0x8')]=function(_0x368a18,_0x20957c){return _0x368a18['define']('FaxQueueReport',attributes,{'tableName':_0x84d6('0x9'),'paranoid':![],'indexes':[{'name':_0x84d6('0xa'),'fields':[_0x84d6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 65999b3..fc36a81 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 _0x997b=['result','catch','CreateFaxQueueReport','FaxQueueReport','create','UpdateFaxQueueReport','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x997b,0x175));var _0xb997=function(_0x487bce,_0xd11228){_0x487bce=_0x487bce-0x0;var _0x17ba7a=_0x997b[_0x487bce];return _0x17ba7a;};'use strict';var _=require(_0xb997('0x0'));var util=require(_0xb997('0x1'));var moment=require(_0xb997('0x2'));var BPromise=require(_0xb997('0x3'));var rs=require(_0xb997('0x4'));var fs=require('fs');var Redis=require(_0xb997('0x5'));var db=require(_0xb997('0x6'))['db'];var utils=require(_0xb997('0x7'));var logger=require(_0xb997('0x8'))('rpc');var config=require(_0xb997('0x9'));var jayson=require(_0xb997('0xa'));var client=jayson[_0xb997('0xb')][_0xb997('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x498122,_0x45da65,_0x1b5275){return new BPromise(function(_0x255656,_0x3852b2){return client[_0xb997('0xd')](_0x498122,_0x1b5275)[_0xb997('0xe')](function(_0x4f92ae){logger[_0xb997('0xf')](_0xb997('0x10'),_0x45da65,'request\x20sent');logger[_0xb997('0x11')](_0xb997('0x12'),_0x45da65,_0xb997('0x13'),JSON['stringify'](_0x4f92ae));if(_0x4f92ae['error']){if(_0x4f92ae['error'][_0xb997('0x14')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x45da65,_0x4f92ae['error'][_0xb997('0x15')]);return _0x3852b2(_0x4f92ae[_0xb997('0x16')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x45da65,_0x4f92ae[_0xb997('0x16')][_0xb997('0x15')]);return _0x255656(_0x4f92ae[_0xb997('0x16')][_0xb997('0x15')]);}else{logger[_0xb997('0xf')](_0xb997('0x10'),_0x45da65,_0xb997('0x13'));_0x255656(_0x4f92ae[_0xb997('0x17')][_0xb997('0x15')]);}})[_0xb997('0x18')](function(_0x1ba356){logger['error'](_0xb997('0x10'),_0x45da65,_0x1ba356);_0x3852b2(_0x1ba356);});});}exports[_0xb997('0x19')]=function(_0x40e438){var _0x3e83b8=this;return new Promise(function(_0x4d1342,_0x27804a){return db[_0xb997('0x1a')][_0xb997('0x1b')](_0x40e438['body'],{'raw':_0x40e438['options']?_0x40e438['options']['raw']===undefined?!![]:![]:!![]})[_0xb997('0xe')](function(_0x51e9e5){logger[_0xb997('0xf')](_0xb997('0x19'),_0x40e438);logger['debug'](_0xb997('0x19'),_0x40e438,JSON['stringify'](_0x51e9e5));_0x4d1342(_0x51e9e5);})['catch'](function(_0xf143ec){logger[_0xb997('0x16')](_0xb997('0x19'),_0xf143ec['message'],_0x40e438);_0x27804a(_0x3e83b8[_0xb997('0x16')](0x1f4,_0xf143ec[_0xb997('0x15')]));});});};exports[_0xb997('0x1c')]=function(_0x5ce52b){var _0x1626e1=this;return new Promise(function(_0x441b20,_0x316bff){return db[_0xb997('0x1a')][_0xb997('0x1d')](_0x5ce52b[_0xb997('0x1e')],{'raw':_0x5ce52b[_0xb997('0x1f')]?_0x5ce52b['options'][_0xb997('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce52b[_0xb997('0x1f')]?_0x5ce52b[_0xb997('0x1f')][_0xb997('0x21')]||null:null,'attributes':_0x5ce52b[_0xb997('0x1f')]?_0x5ce52b[_0xb997('0x1f')][_0xb997('0x22')]||null:null,'limit':_0x5ce52b['options']?_0x5ce52b[_0xb997('0x1f')][_0xb997('0x23')]||null:null})['then'](function(_0x2401b2){logger[_0xb997('0xf')](_0xb997('0x1c'),_0x5ce52b);logger[_0xb997('0x11')](_0xb997('0x1c'),_0x5ce52b,JSON['stringify'](_0x2401b2));_0x441b20(_0x2401b2);})[_0xb997('0x18')](function(_0x2f7d85){logger['error'](_0xb997('0x1c'),_0x2f7d85[_0xb997('0x15')],_0x5ce52b);_0x316bff(_0x1626e1[_0xb997('0x16')](0x1f4,_0x2f7d85[_0xb997('0x15')]));});});}; \ No newline at end of file +var _0xa1de=['jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e01eb,_0x5d0613){var _0x326402=function(_0x4040a9){while(--_0x4040a9){_0x3e01eb['push'](_0x3e01eb['shift']());}};_0x326402(++_0x5d0613);}(_0xa1de,0xae));var _0xea1d=function(_0x3394b4,_0x4d8898){_0x3394b4=_0x3394b4-0x0;var _0x2acad2=_0xa1de[_0x3394b4];return _0x2acad2;};'use strict';var _=require(_0xea1d('0x0'));var util=require(_0xea1d('0x1'));var moment=require(_0xea1d('0x2'));var BPromise=require(_0xea1d('0x3'));var rs=require(_0xea1d('0x4'));var fs=require('fs');var Redis=require(_0xea1d('0x5'));var db=require(_0xea1d('0x6'))['db'];var utils=require(_0xea1d('0x7'));var logger=require(_0xea1d('0x8'))(_0xea1d('0x9'));var config=require(_0xea1d('0xa'));var jayson=require(_0xea1d('0xb'));var client=jayson['client'][_0xea1d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd28cf5,_0x2a54a3,_0x1011c1){return new BPromise(function(_0x4c1629,_0x2d8638){return client[_0xea1d('0xd')](_0xd28cf5,_0x1011c1)[_0xea1d('0xe')](function(_0x3d5830){logger[_0xea1d('0xf')](_0xea1d('0x10'),_0x2a54a3,_0xea1d('0x11'));logger[_0xea1d('0x12')](_0xea1d('0x13'),_0x2a54a3,_0xea1d('0x11'),JSON['stringify'](_0x3d5830));if(_0x3d5830[_0xea1d('0x14')]){if(_0x3d5830[_0xea1d('0x14')][_0xea1d('0x15')]===0x1f4){logger[_0xea1d('0x14')](_0xea1d('0x10'),_0x2a54a3,_0x3d5830[_0xea1d('0x14')]['message']);return _0x2d8638(_0x3d5830['error'][_0xea1d('0x16')]);}logger[_0xea1d('0x14')](_0xea1d('0x10'),_0x2a54a3,_0x3d5830[_0xea1d('0x14')][_0xea1d('0x16')]);return _0x4c1629(_0x3d5830[_0xea1d('0x14')][_0xea1d('0x16')]);}else{logger['info'](_0xea1d('0x10'),_0x2a54a3,_0xea1d('0x11'));_0x4c1629(_0x3d5830[_0xea1d('0x17')][_0xea1d('0x16')]);}})[_0xea1d('0x18')](function(_0x311d8c){logger[_0xea1d('0x14')](_0xea1d('0x10'),_0x2a54a3,_0x311d8c);_0x2d8638(_0x311d8c);});});}exports[_0xea1d('0x19')]=function(_0x23c593){var _0x455679=this;return new Promise(function(_0x419739,_0x58c8f3){return db['FaxQueueReport'][_0xea1d('0x1a')](_0x23c593[_0xea1d('0x1b')],{'raw':_0x23c593[_0xea1d('0x1c')]?_0x23c593['options'][_0xea1d('0x1d')]===undefined?!![]:![]:!![]})[_0xea1d('0xe')](function(_0x4952cd){logger[_0xea1d('0xf')](_0xea1d('0x19'),_0x23c593);logger[_0xea1d('0x12')](_0xea1d('0x19'),_0x23c593,JSON[_0xea1d('0x1e')](_0x4952cd));_0x419739(_0x4952cd);})[_0xea1d('0x18')](function(_0x54cc86){logger[_0xea1d('0x14')]('CreateFaxQueueReport',_0x54cc86['message'],_0x23c593);_0x58c8f3(_0x455679[_0xea1d('0x14')](0x1f4,_0x54cc86[_0xea1d('0x16')]));});});};exports[_0xea1d('0x1f')]=function(_0x6d5b4a){var _0x2ae1cf=this;return new Promise(function(_0x6fc2c3,_0x1bfa11){return db[_0xea1d('0x20')][_0xea1d('0x21')](_0x6d5b4a[_0xea1d('0x1b')],{'raw':_0x6d5b4a['options']?_0x6d5b4a['options'][_0xea1d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6d5b4a['options']?_0x6d5b4a['options'][_0xea1d('0x22')]||null:null,'attributes':_0x6d5b4a[_0xea1d('0x1c')]?_0x6d5b4a[_0xea1d('0x1c')][_0xea1d('0x23')]||null:null,'limit':_0x6d5b4a['options']?_0x6d5b4a[_0xea1d('0x1c')][_0xea1d('0x24')]||null:null})['then'](function(_0x13dd33){logger[_0xea1d('0xf')](_0xea1d('0x1f'),_0x6d5b4a);logger[_0xea1d('0x12')](_0xea1d('0x1f'),_0x6d5b4a,JSON['stringify'](_0x13dd33));_0x6fc2c3(_0x13dd33);})['catch'](function(_0x183ed4){logger[_0xea1d('0x14')](_0xea1d('0x1f'),_0x183ed4[_0xea1d('0x16')],_0x6d5b4a);_0x1bfa11(_0x2ae1cf[_0xea1d('0x14')](0x1f4,_0x183ed4[_0xea1d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b7ed02a..325d20c 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 _0x16b9=['Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','/:id','post','create','put','delete','exports','multer','path','connect-timeout','express'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x16b9,0x73));var _0x916b=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x16b9[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x916b('0x0'));var util=require('util');var path=require(_0x916b('0x1'));var timeout=require(_0x916b('0x2'));var express=require(_0x916b('0x3'));var router=express[_0x916b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x916b('0x5'));var config=require(_0x916b('0x6'));var controller=require(_0x916b('0x7'));router[_0x916b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x916b('0x9'),auth[_0x916b('0xa')](),controller['describe']);router[_0x916b('0x8')](_0x916b('0xb'),auth[_0x916b('0xa')](),controller['show']);router[_0x916b('0xc')]('/',auth[_0x916b('0xa')](),controller[_0x916b('0xd')]);router[_0x916b('0xe')](_0x916b('0xb'),auth[_0x916b('0xa')](),controller['update']);router[_0x916b('0xf')]('/:id',auth[_0x916b('0xa')](),controller['destroy']);module[_0x916b('0x10')]=router; \ No newline at end of file +var _0xd135=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xd135,0x196));var _0x5d13=function(_0x302b92,_0x392123){_0x302b92=_0x302b92-0x0;var _0x4922f6=_0xd135[_0x302b92];return _0x4922f6;};'use strict';var multer=require('multer');var util=require(_0x5d13('0x0'));var path=require(_0x5d13('0x1'));var timeout=require(_0x5d13('0x2'));var express=require(_0x5d13('0x3'));var router=express[_0x5d13('0x4')]();var auth=require(_0x5d13('0x5'));var interaction=require(_0x5d13('0x6'));var config=require(_0x5d13('0x7'));var controller=require(_0x5d13('0x8'));router[_0x5d13('0x9')]('/',auth[_0x5d13('0xa')](),controller[_0x5d13('0xb')]);router[_0x5d13('0x9')](_0x5d13('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5d13('0x9')](_0x5d13('0xd'),auth[_0x5d13('0xa')](),controller[_0x5d13('0xe')]);router[_0x5d13('0xf')]('/',auth[_0x5d13('0xa')](),controller[_0x5d13('0x10')]);router[_0x5d13('0x11')]('/:id',auth[_0x5d13('0xa')](),controller[_0x5d13('0x12')]);router[_0x5d13('0x13')](_0x5d13('0xd'),auth[_0x5d13('0xa')](),controller['destroy']);module[_0x5d13('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 793bd11..bcb6da7 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 _0x4dd4=['exports','STRING','ENUM','account','queue','DATE','NOW','moment'];(function(_0x1b6c0c,_0x51ef20){var _0x178991=function(_0x3b6f64){while(--_0x3b6f64){_0x1b6c0c['push'](_0x1b6c0c['shift']());}};_0x178991(++_0x51ef20);}(_0x4dd4,0x1d7));var _0x44dd=function(_0x3c5da1,_0x52b72c){_0x3c5da1=_0x3c5da1-0x0;var _0x8d2d23=_0x4dd4[_0x3c5da1];return _0x8d2d23;};'use strict';var moment=require(_0x44dd('0x0'));var Sequelize=require('sequelize');module[_0x44dd('0x1')]={'uniqueid':{'type':Sequelize[_0x44dd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x44dd('0x3')](_0x44dd('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x44dd('0x5')},'transferredAt':{'type':Sequelize[_0x44dd('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x44dd('0x7')]}}; \ No newline at end of file +var _0xfada=['sequelize','exports','ENUM','account','agent','queue','NOW'];(function(_0x13993c,_0x4bead3){var _0x7b7f50=function(_0x5ab11e){while(--_0x5ab11e){_0x13993c['push'](_0x13993c['shift']());}};_0x7b7f50(++_0x4bead3);}(_0xfada,0xe7));var _0xafad=function(_0x1fcdcf,_0x49382e){_0x1fcdcf=_0x1fcdcf-0x0;var _0x3a7a86=_0xfada[_0x1fcdcf];return _0x3a7a86;};'use strict';var moment=require('moment');var Sequelize=require(_0xafad('0x0'));module[_0xafad('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xafad('0x2')](_0xafad('0x3'),_0xafad('0x4'),_0xafad('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xafad('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 02f9728..1efa794 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(_0x3f533b,_0x3b57aa){var _0x290edb=function(_0x45985c){while(--_0x45985c){_0x3f533b['push'](_0x3f533b['shift']());}};_0x290edb(++_0x3b57aa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'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 _0x2032=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','intersection','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x5837ac,_0x24188e){var _0xa6da77=function(_0x4a4cfa){while(--_0x4a4cfa){_0x5837ac['push'](_0x5837ac['shift']());}};_0xa6da77(++_0x24188e);}(_0x2032,0xd9));var _0x2203=function(_0x39f9e0,_0xfa7ca){_0x39f9e0=_0x39f9e0-0x0;var _0x4cfddf=_0x2032[_0x39f9e0];return _0x4cfddf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require(_0x2203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2203('0x3'));var moment=require(_0x2203('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2203('0x5'));var util=require(_0x2203('0x6'));var path=require(_0x2203('0x7'));var sox=require(_0x2203('0x8'));var csv=require(_0x2203('0x9'));var ejs=require(_0x2203('0xa'));var fs=require('fs');var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var db=require(_0x2203('0x16'))['db'];function respondWithStatusCode(_0x1abb51,_0x4b9376){_0x4b9376=_0x4b9376||0xcc;return function(_0x583bc7){if(_0x583bc7){return _0x1abb51['sendStatus'](_0x4b9376);}return _0x1abb51['status'](_0x4b9376)['end']();};}function respondWithResult(_0x238772,_0x538b30){_0x538b30=_0x538b30||0xc8;return function(_0x592e47){if(_0x592e47){return _0x238772[_0x2203('0x17')](_0x538b30)[_0x2203('0x18')](_0x592e47);}};}function respondWithFilteredResult(_0x1c1ead,_0x41af85){return function(_0x226209){if(_0x226209){var _0x3fe0a8=_0x226209[_0x2203('0x19')],_0x2c36e6=_0x41af85['offset'],_0x2c085c=_0x41af85[_0x2203('0x1a')]+_0x41af85[_0x2203('0x1b')],_0xdf9d0b;if(_0x2c085c>=_0x3fe0a8){_0x2c085c=_0x3fe0a8;_0xdf9d0b=0xc8;}else{_0xdf9d0b=0xce;}_0x1c1ead['status'](_0xdf9d0b);return _0x1c1ead[_0x2203('0x1c')](_0x2203('0x1d'),_0x2c36e6+'-'+_0x2c085c+'/'+_0x3fe0a8)['json'](_0x226209);}return null;};}function patchUpdates(_0x30c6f7){return function(_0x5ee83c){try{jsonpatch[_0x2203('0x1e')](_0x5ee83c,_0x30c6f7,!![]);}catch(_0x310b8c){return BPromise[_0x2203('0x1f')](_0x310b8c);}return _0x5ee83c[_0x2203('0x20')]();};}function saveUpdates(_0x15cb1a,_0x449039){return function(_0x538c23){if(_0x538c23){return _0x538c23[_0x2203('0x21')](_0x15cb1a)['then'](function(_0x5ac866){return _0x5ac866;});}return null;};}function removeEntity(_0x15f543,_0x496d82){return function(_0x3b8ef9){if(_0x3b8ef9){return _0x3b8ef9[_0x2203('0x22')]()['then'](function(){_0x15f543[_0x2203('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8da9,_0x226374){return function(_0x2718f5){if(!_0x2718f5){_0x5c8da9[_0x2203('0x23')](0x194);}return _0x2718f5;};}function handleError(_0xfd0970,_0x1244f4){_0x1244f4=_0x1244f4||0x1f4;return function(_0x3114ef){logger[_0x2203('0x24')](_0x3114ef[_0x2203('0x25')]);if(_0x3114ef['name']){delete _0x3114ef[_0x2203('0x26')];}_0xfd0970[_0x2203('0x17')](_0x1244f4)[_0x2203('0x27')](_0x3114ef);};}exports['index']=function(_0xb2071b,_0x1cec17){var _0x5c5fd3={},_0xd6e109={},_0xd91f5d={'count':0x0,'rows':[]};var _0x1c6a77=_[_0x2203('0x28')](db[_0x2203('0x29')][_0x2203('0x2a')],function(_0x9c53f){return{'name':_0x9c53f['fieldName'],'type':_0x9c53f[_0x2203('0x2b')][_0x2203('0x2c')]};});_0xd6e109[_0x2203('0x2d')]=_[_0x2203('0x28')](_0x1c6a77,'name');_0xd6e109[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0xb2071b[_0x2203('0x2e')]);_0xd6e109[_0x2203('0x30')]=_['intersection'](_0xd6e109[_0x2203('0x2d')],_0xd6e109[_0x2203('0x2e')]);_0x5c5fd3['attributes']=_['intersection'](_0xd6e109[_0x2203('0x2d')],qs['fields'](_0xb2071b['query'][_0x2203('0x31')]));_0x5c5fd3[_0x2203('0x32')]=_0x5c5fd3[_0x2203('0x32')][_0x2203('0x33')]?_0x5c5fd3[_0x2203('0x32')]:_0xd6e109['model'];if(!_0xb2071b[_0x2203('0x2e')][_0x2203('0x34')]('nolimit')){_0x5c5fd3[_0x2203('0x1b')]=qs[_0x2203('0x1b')](_0xb2071b[_0x2203('0x2e')][_0x2203('0x1b')]);_0x5c5fd3[_0x2203('0x1a')]=qs[_0x2203('0x1a')](_0xb2071b[_0x2203('0x2e')][_0x2203('0x1a')]);}_0x5c5fd3[_0x2203('0x35')]=qs['sort'](_0xb2071b[_0x2203('0x2e')][_0x2203('0x36')]);_0x5c5fd3['where']=qs['filters'](_[_0x2203('0x37')](_0xb2071b['query'],_0xd6e109[_0x2203('0x30')]),_0x1c6a77);if(_0xb2071b[_0x2203('0x2e')][_0x2203('0x38')]){_0x5c5fd3['where']=_['merge'](_0x5c5fd3[_0x2203('0x39')],{'$or':_['map'](_0x1c6a77,function(_0x2d0365){if(_0x2d0365['type']!==_0x2203('0x3a')){var _0x4b6fc5={};_0x4b6fc5[_0x2d0365[_0x2203('0x26')]]={'$like':'%'+_0xb2071b[_0x2203('0x2e')][_0x2203('0x38')]+'%'};return _0x4b6fc5;}})});}_0x5c5fd3=_[_0x2203('0x3b')]({},_0x5c5fd3,_0xb2071b[_0x2203('0x3c')]);var _0x5436d2={'where':_0x5c5fd3['where']};return db['FaxTransferReport'][_0x2203('0x19')](_0x5436d2)[_0x2203('0x3d')](function(_0x323798){_0xd91f5d[_0x2203('0x19')]=_0x323798;if(_0xb2071b[_0x2203('0x2e')][_0x2203('0x3e')]){_0x5c5fd3[_0x2203('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x2203('0x40')](_0x5c5fd3);})[_0x2203('0x3d')](function(_0x108fde){_0xd91f5d[_0x2203('0x41')]=_0x108fde;return _0xd91f5d;})['then'](respondWithFilteredResult(_0x1cec17,_0x5c5fd3))['catch'](handleError(_0x1cec17,null));};exports[_0x2203('0x42')]=function(_0x5494a1,_0x330303){var _0x446209={'raw':!![],'where':{'id':_0x5494a1['params']['id']}},_0x132091={};_0x132091['model']=_[_0x2203('0x2f')](db[_0x2203('0x29')][_0x2203('0x2a')]);_0x132091[_0x2203('0x2e')]=_[_0x2203('0x2f')](_0x5494a1[_0x2203('0x2e')]);_0x132091['filters']=_[_0x2203('0x43')](_0x132091[_0x2203('0x2d')],_0x132091[_0x2203('0x2e')]);_0x446209[_0x2203('0x32')]=_[_0x2203('0x43')](_0x132091[_0x2203('0x2d')],qs[_0x2203('0x31')](_0x5494a1[_0x2203('0x2e')][_0x2203('0x31')]));_0x446209[_0x2203('0x32')]=_0x446209['attributes'][_0x2203('0x33')]?_0x446209[_0x2203('0x32')]:_0x132091[_0x2203('0x2d')];if(_0x5494a1[_0x2203('0x2e')]['includeAll']){_0x446209['include']=[{'all':!![]}];}_0x446209=_[_0x2203('0x3b')]({},_0x446209,_0x5494a1['options']);return db[_0x2203('0x29')][_0x2203('0x44')](_0x446209)[_0x2203('0x3d')](handleEntityNotFound(_0x330303,null))[_0x2203('0x3d')](respondWithResult(_0x330303,null))['catch'](handleError(_0x330303,null));};exports[_0x2203('0x45')]=function(_0x102803,_0x5cd8c6){return db[_0x2203('0x29')][_0x2203('0x45')](_0x102803[_0x2203('0x46')],{})[_0x2203('0x3d')](respondWithResult(_0x5cd8c6,0xc9))['catch'](handleError(_0x5cd8c6,null));};exports['update']=function(_0x21b8ab,_0x5707c8){if(_0x21b8ab['body']['id']){delete _0x21b8ab[_0x2203('0x46')]['id'];}return db[_0x2203('0x29')][_0x2203('0x44')]({'where':{'id':_0x21b8ab['params']['id']}})['then'](handleEntityNotFound(_0x5707c8,null))[_0x2203('0x3d')](saveUpdates(_0x21b8ab[_0x2203('0x46')],null))[_0x2203('0x3d')](respondWithResult(_0x5707c8,null))[_0x2203('0x47')](handleError(_0x5707c8,null));};exports[_0x2203('0x22')]=function(_0x21fd78,_0x4a7f4e){return db[_0x2203('0x29')]['find']({'where':{'id':_0x21fd78[_0x2203('0x48')]['id']}})[_0x2203('0x3d')](handleEntityNotFound(_0x4a7f4e,null))[_0x2203('0x3d')](removeEntity(_0x4a7f4e,null))[_0x2203('0x47')](handleError(_0x4a7f4e,null));};exports['describe']=function(_0x506795,_0x30d503){return db[_0x2203('0x29')][_0x2203('0x49')]()[_0x2203('0x3d')](respondWithResult(_0x30d503,null))['catch'](handleError(_0x30d503,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fc56cf5..309336d 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 _0x4dc0=['bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','define','uniqueid','../../config/logger','api','moment'];(function(_0x19903c,_0x5192e4){var _0x222a6c=function(_0x2121ae){while(--_0x2121ae){_0x19903c['push'](_0x19903c['shift']());}};_0x222a6c(++_0x5192e4);}(_0x4dc0,0x13d));var _0x04dc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4dc0[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x04dc('0x0'))(_0x04dc('0x1'));var moment=require(_0x04dc('0x2'));var BPromise=require(_0x04dc('0x3'));var rp=require(_0x04dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04dc('0x5'));var config=require(_0x04dc('0x6'));var attributes=require(_0x04dc('0x7'));module['exports']=function(_0x224df5,_0x40b21a){return _0x224df5[_0x04dc('0x8')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x04dc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3dc=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x27f6d0,_0x397e9a){var _0x3ab309=function(_0x28ce26){while(--_0x28ce26){_0x27f6d0['push'](_0x27f6d0['shift']());}};_0x3ab309(++_0x397e9a);}(_0xe3dc,0x1e7));var _0xce3d=function(_0x4d2854,_0x3d7688){_0x4d2854=_0x4d2854-0x0;var _0x108402=_0xe3dc[_0x4d2854];return _0x108402;};'use strict';var _=require(_0xce3d('0x0'));var util=require(_0xce3d('0x1'));var logger=require(_0xce3d('0x2'))(_0xce3d('0x3'));var moment=require(_0xce3d('0x4'));var BPromise=require(_0xce3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce3d('0x6'));var rimraf=require(_0xce3d('0x7'));var config=require(_0xce3d('0x8'));var attributes=require(_0xce3d('0x9'));module[_0xce3d('0xa')]=function(_0x4f4fb7,_0x24f824){return _0x4f4fb7[_0xce3d('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xce3d('0xc'),'fields':[_0xce3d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ad3f14a..541d22e 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 _0x6e39=['FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1662b6,_0x31276f){var _0xafb667=function(_0x17d816){while(--_0x17d816){_0x1662b6['push'](_0x1662b6['shift']());}};_0xafb667(++_0x31276f);}(_0x6e39,0x169));var _0x96e3=function(_0x52ced7,_0x33f680){_0x52ced7=_0x52ced7-0x0;var _0xde7fb=_0x6e39[_0x52ced7];return _0xde7fb;};'use strict';var _=require('lodash');var util=require(_0x96e3('0x0'));var moment=require(_0x96e3('0x1'));var BPromise=require(_0x96e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96e3('0x4'));var logger=require(_0x96e3('0x5'))(_0x96e3('0x6'));var config=require(_0x96e3('0x7'));var jayson=require(_0x96e3('0x8'));var client=jayson[_0x96e3('0x9')][_0x96e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d8f,_0x45bc94,_0x28d4e8){return new BPromise(function(_0x507a99,_0x34dd5d){return client[_0x96e3('0xb')](_0x1c5d8f,_0x28d4e8)[_0x96e3('0xc')](function(_0x41e2c6){logger['info'](_0x96e3('0xd'),_0x45bc94,'request\x20sent');logger['debug'](_0x96e3('0xe'),_0x45bc94,'request\x20sent',JSON[_0x96e3('0xf')](_0x41e2c6));if(_0x41e2c6[_0x96e3('0x10')]){if(_0x41e2c6['error'][_0x96e3('0x11')]===0x1f4){logger[_0x96e3('0x10')](_0x96e3('0xd'),_0x45bc94,_0x41e2c6[_0x96e3('0x10')][_0x96e3('0x12')]);return _0x34dd5d(_0x41e2c6[_0x96e3('0x10')][_0x96e3('0x12')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x45bc94,_0x41e2c6[_0x96e3('0x10')]['message']);return _0x507a99(_0x41e2c6[_0x96e3('0x10')]['message']);}else{logger[_0x96e3('0x13')](_0x96e3('0xd'),_0x45bc94,_0x96e3('0x14'));_0x507a99(_0x41e2c6['result'][_0x96e3('0x12')]);}})[_0x96e3('0x15')](function(_0x2b2535){logger[_0x96e3('0x10')](_0x96e3('0xd'),_0x45bc94,_0x2b2535);_0x34dd5d(_0x2b2535);});});} \ No newline at end of file +var _0xe313=['message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28c301,_0x49d078){var _0x342017=function(_0x1f7179){while(--_0x1f7179){_0x28c301['push'](_0x28c301['shift']());}};_0x342017(++_0x49d078);}(_0xe313,0x137));var _0x3e31=function(_0x2d036c,_0x2eec5e){_0x2d036c=_0x2d036c-0x0;var _0x480523=_0xe313[_0x2d036c];return _0x480523;};'use strict';var _=require('lodash');var util=require(_0x3e31('0x0'));var moment=require(_0x3e31('0x1'));var BPromise=require(_0x3e31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e31('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e31('0x4'));var logger=require(_0x3e31('0x5'))(_0x3e31('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e31('0x7'));var client=jayson['client'][_0x3e31('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xba35b8,_0x5aa864,_0x1ce77d){return new BPromise(function(_0x2aec54,_0x3c0e19){return client[_0x3e31('0x9')](_0xba35b8,_0x1ce77d)[_0x3e31('0xa')](function(_0x2c5eb3){logger[_0x3e31('0xb')](_0x3e31('0xc'),_0x5aa864,_0x3e31('0xd'));logger[_0x3e31('0xe')](_0x3e31('0xf'),_0x5aa864,_0x3e31('0xd'),JSON[_0x3e31('0x10')](_0x2c5eb3));if(_0x2c5eb3[_0x3e31('0x11')]){if(_0x2c5eb3['error'][_0x3e31('0x12')]===0x1f4){logger[_0x3e31('0x11')](_0x3e31('0xc'),_0x5aa864,_0x2c5eb3[_0x3e31('0x11')]['message']);return _0x3c0e19(_0x2c5eb3[_0x3e31('0x11')]['message']);}logger[_0x3e31('0x11')](_0x3e31('0xc'),_0x5aa864,_0x2c5eb3[_0x3e31('0x11')][_0x3e31('0x13')]);return _0x2aec54(_0x2c5eb3[_0x3e31('0x11')][_0x3e31('0x13')]);}else{logger[_0x3e31('0xb')](_0x3e31('0xc'),_0x5aa864,_0x3e31('0xd'));_0x2aec54(_0x2c5eb3[_0x3e31('0x14')][_0x3e31('0x13')]);}})[_0x3e31('0x15')](function(_0x4b5372){logger['error'](_0x3e31('0xc'),_0x5aa864,_0x4b5372);_0x3c0e19(_0x4b5372);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 81ff6c8..108b887 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 _0xe77e=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','show','delete','destroy','exports','multer'];(function(_0x465ccf,_0x486b3d){var _0x1d1bce=function(_0x469c1f){while(--_0x469c1f){_0x465ccf['push'](_0x465ccf['shift']());}};_0x1d1bce(++_0x486b3d);}(_0xe77e,0x1a8));var _0xee77=function(_0x5e0d05,_0x27706f){_0x5e0d05=_0x5e0d05-0x0;var _0x21a290=_0xe77e[_0x5e0d05];return _0x21a290;};'use strict';var multer=require(_0xee77('0x0'));var util=require(_0xee77('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee77('0x2'));var router=express[_0xee77('0x3')]();var auth=require(_0xee77('0x4'));var interaction=require(_0xee77('0x5'));var config=require(_0xee77('0x6'));var controller=require(_0xee77('0x7'));router[_0xee77('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee77('0x8')](_0xee77('0x9'),auth['isAuthenticated'](),controller[_0xee77('0xa')]);router[_0xee77('0x8')](_0xee77('0xb'),auth[_0xee77('0xc')](),controller[_0xee77('0xd')]);router['post']('/',auth[_0xee77('0xc')](),controller['create']);router['put'](_0xee77('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xee77('0xe')]('/:id',auth[_0xee77('0xc')](),controller[_0xee77('0xf')]);module[_0xee77('0x10')]=router; \ No newline at end of file +var _0xdcd5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','describe','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x45f183,_0x38187b){var _0x361e64=function(_0x1ab07f){while(--_0x1ab07f){_0x45f183['push'](_0x45f183['shift']());}};_0x361e64(++_0x38187b);}(_0xdcd5,0x95));var _0x5dcd=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0xdcd5[_0x32d414];return _0x4e0bca;};'use strict';var multer=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var path=require(_0x5dcd('0x2'));var timeout=require(_0x5dcd('0x3'));var express=require(_0x5dcd('0x4'));var router=express[_0x5dcd('0x5')]();var auth=require(_0x5dcd('0x6'));var interaction=require(_0x5dcd('0x7'));var config=require(_0x5dcd('0x8'));var controller=require(_0x5dcd('0x9'));router[_0x5dcd('0xa')]('/',auth['isAuthenticated'](),controller[_0x5dcd('0xb')]);router[_0x5dcd('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5dcd('0xc')]);router[_0x5dcd('0xa')](_0x5dcd('0xd'),auth['isAuthenticated'](),controller[_0x5dcd('0xe')]);router[_0x5dcd('0xf')]('/',auth[_0x5dcd('0x10')](),controller['create']);router[_0x5dcd('0x11')](_0x5dcd('0xd'),auth[_0x5dcd('0x10')](),controller[_0x5dcd('0x12')]);router[_0x5dcd('0x13')](_0x5dcd('0xd'),auth[_0x5dcd('0x10')](),controller[_0x5dcd('0x14')]);module[_0x5dcd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 037beb7..3af1ed2 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 _0x5577=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5577,0x1b4));var _0x7557=function(_0x5a7b0e,_0x4794cf){_0x5a7b0e=_0x5a7b0e-0x0;var _0x452a68=_0x5577[_0x5a7b0e];return _0x452a68;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var auth=require(_0x7557('0x4'));var interaction=require(_0x7557('0x5'));var config=require(_0x7557('0x6'));var controller=require(_0x7557('0x7'));router[_0x7557('0x8')]('/',auth['isAuthenticated'](),controller[_0x7557('0x9')]);router[_0x7557('0x8')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller[_0x7557('0xc')]);router[_0x7557('0x8')](_0x7557('0xd'),auth[_0x7557('0xb')](),controller[_0x7557('0xe')]);router[_0x7557('0x8')](_0x7557('0xf'),auth[_0x7557('0xb')](),controller[_0x7557('0x10')]);router[_0x7557('0x11')]('/',auth[_0x7557('0xb')](),controller['create']);router['post'](_0x7557('0xd'),auth[_0x7557('0xb')](),controller[_0x7557('0x12')]);router[_0x7557('0x13')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller[_0x7557('0x14')]);router[_0x7557('0x15')](_0x7557('0xa'),auth[_0x7557('0xb')](),controller['destroy']);module[_0x7557('0x16')]=router; \ No newline at end of file +var _0x60c2=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x473e0b,_0x2a2b26){var _0x4e68bb=function(_0x95d2a1){while(--_0x95d2a1){_0x473e0b['push'](_0x473e0b['shift']());}};_0x4e68bb(++_0x2a2b26);}(_0x60c2,0x8f));var _0x260c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60c2[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var auth=require(_0x260c('0x5'));var interaction=require(_0x260c('0x6'));var config=require(_0x260c('0x7'));var controller=require(_0x260c('0x8'));router[_0x260c('0x9')]('/',auth[_0x260c('0xa')](),controller[_0x260c('0xb')]);router['get'](_0x260c('0xc'),auth[_0x260c('0xa')](),controller[_0x260c('0xd')]);router[_0x260c('0x9')]('/:id/configurations',auth[_0x260c('0xa')](),controller[_0x260c('0xe')]);router[_0x260c('0x9')](_0x260c('0xf'),auth[_0x260c('0xa')](),controller[_0x260c('0x10')]);router[_0x260c('0x11')]('/',auth['isAuthenticated'](),controller[_0x260c('0x12')]);router[_0x260c('0x11')](_0x260c('0x13'),auth['isAuthenticated'](),controller[_0x260c('0x14')]);router[_0x260c('0x15')](_0x260c('0xc'),auth['isAuthenticated'](),controller[_0x260c('0x16')]);router[_0x260c('0x17')](_0x260c('0xc'),auth[_0x260c('0xa')](),controller[_0x260c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 41a8507..8cd1798 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 _0x8414=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x6ca7e8,_0xe79539){var _0x3dfbe=function(_0x25a9d8){while(--_0x25a9d8){_0x6ca7e8['push'](_0x6ca7e8['shift']());}};_0x3dfbe(++_0xe79539);}(_0x8414,0xb8));var _0x4841=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x8414[_0x2e04ef];return _0x5722b0;};'use strict';var Sequelize=require(_0x4841('0x0'));module[_0x4841('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4841('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4841('0x2')]},'authType':{'type':Sequelize[_0x4841('0x3')](_0x4841('0x4')),'defaultValue':_0x4841('0x4')},'password':{'type':Sequelize[_0x4841('0x2')]},'consumerKey':{'type':Sequelize[_0x4841('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4841('0x2')]},'tokenSecret':{'type':Sequelize[_0x4841('0x2')]},'serverUrl':{'type':Sequelize[_0x4841('0x2')]},'type':{'type':Sequelize[_0x4841('0x3')](_0x4841('0x5'),_0x4841('0x6')),'defaultValue':_0x4841('0x5')}}; \ No newline at end of file +var _0xb32d=['integrationTab','newTab','sequelize','STRING','ENUM','basic'];(function(_0x47fd0f,_0x264551){var _0x6d6f9c=function(_0x455311){while(--_0x455311){_0x47fd0f['push'](_0x47fd0f['shift']());}};_0x6d6f9c(++_0x264551);}(_0xb32d,0xc2));var _0xdb32=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xb32d[_0x2e3dfc];return _0x4b1245;};'use strict';var Sequelize=require(_0xdb32('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb32('0x1')]},'description':{'type':Sequelize[_0xdb32('0x1')]},'username':{'type':Sequelize[_0xdb32('0x1')]},'remoteUri':{'type':Sequelize[_0xdb32('0x1')]},'authType':{'type':Sequelize[_0xdb32('0x2')](_0xdb32('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xdb32('0x1')]},'consumerSecret':{'type':Sequelize[_0xdb32('0x1')]},'token':{'type':Sequelize[_0xdb32('0x1')]},'tokenSecret':{'type':Sequelize[_0xdb32('0x1')]},'serverUrl':{'type':Sequelize[_0xdb32('0x1')]},'type':{'type':Sequelize[_0xdb32('0x2')](_0xdb32('0x4'),_0xdb32('0x5')),'defaultValue':_0xdb32('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 55835fe..5cf2982 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 _0xea39=['getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','toString','base64','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','catch','status','end','json','count','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','create','body','find','findOne','DeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects'];(function(_0x143146,_0x8a7852){var _0x3e9b16=function(_0x428a81){while(--_0x428a81){_0x143146['push'](_0x143146['shift']());}};_0x3e9b16(++_0x8a7852);}(_0xea39,0x9d));var _0x9ea3=function(_0x23869c,_0x4d26c4){_0x23869c=_0x23869c-0x0;var _0x3733b7=_0xea39[_0x23869c];return _0x3733b7;};'use strict';var pdf=require(_0x9ea3('0x0'));var emlformat=require(_0x9ea3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9ea3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ea3('0x3'));var moment=require(_0x9ea3('0x4'));var BPromise=require(_0x9ea3('0x5'));var Mustache=require('mustache');var util=require(_0x9ea3('0x6'));var path=require(_0x9ea3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ea3('0x8'));var fs=require('fs');var _=require(_0x9ea3('0x9'));var squel=require(_0x9ea3('0xa'));var crypto=require(_0x9ea3('0xb'));var jsforce=require(_0x9ea3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ea3('0xd'));var Papa=require(_0x9ea3('0xe'));var Redis=require(_0x9ea3('0xf'));var authService=require(_0x9ea3('0x10'));var qs=require(_0x9ea3('0x11'));var as=require(_0x9ea3('0x12'));var hardwareService=require(_0x9ea3('0x13'));var logger=require(_0x9ea3('0x14'))('api');var utils=require(_0x9ea3('0x15'));var config=require(_0x9ea3('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9ea3('0x17'));var client=jayson[_0x9ea3('0x18')][_0x9ea3('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2a4878,_0x37caf0,_0x475cdd){if(_0x475cdd){var _0x21234a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21234a[_0x9ea3('0x1a')](_0x37caf0)){return _0x2a4878;}else{throw new db['Sequelize'][(_0x9ea3('0x1b'))](_0x9ea3('0x1c'));}}else{return _0x2a4878;}}function respondWithRpcPromise(_0x5c605d,_0x5db2d6,_0x1b8a7d,_0x3b1d8a){return new BPromise(function(_0x120c3c,_0x41b21c){var _0xa27b1e=_0x3b1d8a||client;return _0xa27b1e['request'](_0x5c605d,_0x1b8a7d)[_0x9ea3('0x1d')](function(_0x10a98f){logger[_0x9ea3('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5db2d6,_0x9ea3('0x1f'));logger[_0x9ea3('0x20')](_0x9ea3('0x21'),_0x5db2d6,_0x9ea3('0x1f'),JSON[_0x9ea3('0x22')](_0x10a98f));if(_0x10a98f[_0x9ea3('0x23')]){if(_0x10a98f['error'][_0x9ea3('0x24')]===0x1f4){logger[_0x9ea3('0x23')]('DeskAccount,\x20%s,\x20%s',_0x5db2d6,_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);return _0x41b21c(_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);}logger['error'](_0x9ea3('0x26'),_0x5db2d6,_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);return _0x120c3c(_0x10a98f[_0x9ea3('0x23')][_0x9ea3('0x25')]);}else{logger[_0x9ea3('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5db2d6,_0x9ea3('0x1f'));_0x120c3c(_0x10a98f['result'][_0x9ea3('0x25')]);}})[_0x9ea3('0x27')](function(_0x4599a5){logger[_0x9ea3('0x23')](_0x9ea3('0x26'),_0x5db2d6,_0x4599a5);_0x41b21c(_0x4599a5);});});}function respondWithStatusCode(_0x3fdd1f,_0x3bbc8){_0x3bbc8=_0x3bbc8||0xcc;return function(_0xfdbe55){if(_0xfdbe55){return _0x3fdd1f['sendStatus'](_0x3bbc8);}return _0x3fdd1f[_0x9ea3('0x28')](_0x3bbc8)[_0x9ea3('0x29')]();};}function respondWithResult(_0x776e80,_0x75fd7){_0x75fd7=_0x75fd7||0xc8;return function(_0x5a01db){if(_0x5a01db){return _0x776e80[_0x9ea3('0x28')](_0x75fd7)[_0x9ea3('0x2a')](_0x5a01db);}};}function respondWithFilteredResult(_0x385490,_0x28d700){return function(_0x358fe2){if(_0x358fe2){var _0x168875=_0x358fe2[_0x9ea3('0x2b')],_0x3383d3=_0x28d700['offset'],_0x127667=_0x28d700['offset']+_0x28d700['limit'],_0x27d77f;if(_0x127667>=_0x168875){_0x127667=_0x168875;_0x27d77f=0xc8;}else{_0x27d77f=0xce;}_0x385490[_0x9ea3('0x28')](_0x27d77f);return _0x385490[_0x9ea3('0x2c')]('Content-Range',_0x3383d3+'-'+_0x127667+'/'+_0x168875)[_0x9ea3('0x2a')](_0x358fe2);}return null;};}function patchUpdates(_0xee8501){return function(_0x5a707f){try{jsonpatch[_0x9ea3('0x2d')](_0x5a707f,_0xee8501,!![]);}catch(_0x157766){return BPromise[_0x9ea3('0x2e')](_0x157766);}return _0x5a707f[_0x9ea3('0x2f')]();};}function saveUpdates(_0x4d2d8d,_0x2eb32e){return function(_0xa51ca2){if(_0xa51ca2){return _0xa51ca2[_0x9ea3('0x30')](_0x4d2d8d)['then'](function(_0x5e4d36){return _0x5e4d36;});}return null;};}function removeEntity(_0x344116,_0xd97250){return function(_0x5423d7){if(_0x5423d7){return _0x5423d7[_0x9ea3('0x31')]()['then'](function(){_0x344116[_0x9ea3('0x28')](0xcc)[_0x9ea3('0x29')]();});}};}function handleEntityNotFound(_0x125fc2,_0x6eb891){return function(_0x583956){if(!_0x583956){_0x125fc2[_0x9ea3('0x32')](0x194);}return _0x583956;};}function handleError(_0x12629f,_0x488dd1){_0x488dd1=_0x488dd1||0x1f4;return function(_0x187dfc){logger[_0x9ea3('0x23')](_0x187dfc[_0x9ea3('0x33')]);if(_0x187dfc['name']){delete _0x187dfc[_0x9ea3('0x34')];}_0x12629f[_0x9ea3('0x28')](_0x488dd1)[_0x9ea3('0x35')](_0x187dfc);};}exports[_0x9ea3('0x36')]=function(_0x1f6e6c,_0x38dae6){var _0x3ba0ef={},_0x12f665={},_0x3c3840={'count':0x0,'rows':[]};var _0x3b39a9=_[_0x9ea3('0x37')](db[_0x9ea3('0x38')][_0x9ea3('0x39')],function(_0x23c587){return{'name':_0x23c587['fieldName'],'type':_0x23c587[_0x9ea3('0x3a')][_0x9ea3('0x3b')]};});_0x12f665[_0x9ea3('0x3c')]=_['map'](_0x3b39a9,_0x9ea3('0x34'));_0x12f665[_0x9ea3('0x3d')]=_[_0x9ea3('0x3e')](_0x1f6e6c[_0x9ea3('0x3d')]);_0x12f665[_0x9ea3('0x3f')]=_[_0x9ea3('0x40')](_0x12f665[_0x9ea3('0x3c')],_0x12f665['query']);_0x3ba0ef['attributes']=_[_0x9ea3('0x40')](_0x12f665[_0x9ea3('0x3c')],qs[_0x9ea3('0x41')](_0x1f6e6c['query'][_0x9ea3('0x41')]));_0x3ba0ef[_0x9ea3('0x42')]=_0x3ba0ef['attributes'][_0x9ea3('0x43')]?_0x3ba0ef['attributes']:_0x12f665[_0x9ea3('0x3c')];if(!_0x1f6e6c['query'][_0x9ea3('0x44')]('nolimit')){_0x3ba0ef[_0x9ea3('0x45')]=qs[_0x9ea3('0x45')](_0x1f6e6c['query'][_0x9ea3('0x45')]);_0x3ba0ef['offset']=qs['offset'](_0x1f6e6c['query'][_0x9ea3('0x46')]);}_0x3ba0ef[_0x9ea3('0x47')]=qs[_0x9ea3('0x48')](_0x1f6e6c[_0x9ea3('0x3d')]['sort']);_0x3ba0ef[_0x9ea3('0x49')]=qs[_0x9ea3('0x3f')](_[_0x9ea3('0x4a')](_0x1f6e6c[_0x9ea3('0x3d')],_0x12f665[_0x9ea3('0x3f')]),_0x3b39a9);if(_0x1f6e6c[_0x9ea3('0x3d')][_0x9ea3('0x4b')]){_0x3ba0ef[_0x9ea3('0x49')]=_[_0x9ea3('0x4c')](_0x3ba0ef['where'],{'$or':_['map'](_0x3b39a9,function(_0x335c2d){if(_0x335c2d[_0x9ea3('0x3a')]!=='VIRTUAL'){var _0x33f2c1={};_0x33f2c1[_0x335c2d['name']]={'$like':'%'+_0x1f6e6c[_0x9ea3('0x3d')][_0x9ea3('0x4b')]+'%'};return _0x33f2c1;}})});}_0x3ba0ef=_['merge']({},_0x3ba0ef,_0x1f6e6c[_0x9ea3('0x4d')]);var _0x3e65a8={'where':_0x3ba0ef[_0x9ea3('0x49')]};return db['DeskAccount'][_0x9ea3('0x2b')](_0x3e65a8)['then'](function(_0xb0868c){_0x3c3840['count']=_0xb0868c;if(_0x1f6e6c['query'][_0x9ea3('0x4e')]){_0x3ba0ef[_0x9ea3('0x4f')]=[{'all':!![]}];}return db[_0x9ea3('0x38')][_0x9ea3('0x50')](_0x3ba0ef);})['then'](function(_0x2ae3fb){_0x3c3840['rows']=_0x2ae3fb;return _0x3c3840;})[_0x9ea3('0x1d')](respondWithFilteredResult(_0x38dae6,_0x3ba0ef))[_0x9ea3('0x27')](handleError(_0x38dae6,null));};exports[_0x9ea3('0x51')]=function(_0x5a2fc6,_0x7f9005){var _0x3a959d={'raw':![],'where':{'id':_0x5a2fc6[_0x9ea3('0x52')]['id']}},_0x1ffd5d={};_0x1ffd5d[_0x9ea3('0x3c')]=_[_0x9ea3('0x3e')](db['DeskAccount']['rawAttributes']);_0x1ffd5d[_0x9ea3('0x3d')]=_[_0x9ea3('0x3e')](_0x5a2fc6[_0x9ea3('0x3d')]);_0x1ffd5d[_0x9ea3('0x3f')]=_[_0x9ea3('0x40')](_0x1ffd5d[_0x9ea3('0x3c')],_0x1ffd5d[_0x9ea3('0x3d')]);_0x3a959d[_0x9ea3('0x42')]=_[_0x9ea3('0x40')](_0x1ffd5d[_0x9ea3('0x3c')],qs[_0x9ea3('0x41')](_0x5a2fc6[_0x9ea3('0x3d')][_0x9ea3('0x41')]));_0x3a959d[_0x9ea3('0x42')]=_0x3a959d['attributes'][_0x9ea3('0x43')]?_0x3a959d[_0x9ea3('0x42')]:_0x1ffd5d[_0x9ea3('0x3c')];if(_0x5a2fc6['query'][_0x9ea3('0x4e')]){_0x3a959d[_0x9ea3('0x4f')]=[{'all':!![]}];}_0x3a959d=_[_0x9ea3('0x4c')]({},_0x3a959d,_0x5a2fc6[_0x9ea3('0x4d')]);return db[_0x9ea3('0x38')]['find'](_0x3a959d)['then'](handleEntityNotFound(_0x7f9005,null))[_0x9ea3('0x1d')](respondWithResult(_0x7f9005,null))[_0x9ea3('0x27')](handleError(_0x7f9005,null));};exports[_0x9ea3('0x53')]=function(_0xb851b0,_0x2964b1){return db[_0x9ea3('0x38')][_0x9ea3('0x53')](_0xb851b0[_0x9ea3('0x54')],{})[_0x9ea3('0x1d')](respondWithResult(_0x2964b1,0xc9))[_0x9ea3('0x27')](handleError(_0x2964b1,null));};exports[_0x9ea3('0x30')]=function(_0x5a9091,_0x478939){if(_0x5a9091['body']['id']){delete _0x5a9091[_0x9ea3('0x54')]['id'];}return db[_0x9ea3('0x38')][_0x9ea3('0x55')]({'where':{'id':_0x5a9091[_0x9ea3('0x52')]['id']}})['then'](handleEntityNotFound(_0x478939,null))[_0x9ea3('0x1d')](saveUpdates(_0x5a9091[_0x9ea3('0x54')],null))[_0x9ea3('0x1d')](respondWithResult(_0x478939,null))[_0x9ea3('0x27')](handleError(_0x478939,null));};exports[_0x9ea3('0x31')]=function(_0xdd88d3,_0x27e5f4){return db[_0x9ea3('0x38')][_0x9ea3('0x55')]({'where':{'id':_0xdd88d3['params']['id']}})[_0x9ea3('0x1d')](handleEntityNotFound(_0x27e5f4,null))[_0x9ea3('0x1d')](removeEntity(_0x27e5f4,null))[_0x9ea3('0x27')](handleError(_0x27e5f4,null));};exports['getConfigurations']=function(_0x51a42f,_0x32f722,_0x280d18){var _0x29367d={};var _0x405303={};var _0x4988b1;var _0x573b2b;return db[_0x9ea3('0x38')][_0x9ea3('0x56')]({'where':{'id':_0x51a42f[_0x9ea3('0x52')]['id']}})[_0x9ea3('0x1d')](handleEntityNotFound(_0x32f722,null))['then'](function(_0x52b197){if(_0x52b197){_0x4988b1=_0x52b197;_0x405303[_0x9ea3('0x3c')]=_['keys'](db[_0x9ea3('0x57')][_0x9ea3('0x39')]);_0x405303[_0x9ea3('0x3d')]=_[_0x9ea3('0x3e')](_0x51a42f[_0x9ea3('0x3d')]);_0x405303[_0x9ea3('0x3f')]=_[_0x9ea3('0x40')](_0x405303[_0x9ea3('0x3c')],_0x405303[_0x9ea3('0x3d')]);_0x29367d[_0x9ea3('0x42')]=_[_0x9ea3('0x40')](_0x405303[_0x9ea3('0x3c')],qs[_0x9ea3('0x41')](_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x41')]));_0x29367d[_0x9ea3('0x42')]=_0x29367d[_0x9ea3('0x42')][_0x9ea3('0x43')]?_0x29367d['attributes']:_0x405303[_0x9ea3('0x3c')];_0x29367d['order']=qs['sort'](_0x51a42f['query'][_0x9ea3('0x48')]);_0x29367d[_0x9ea3('0x49')]=qs['filters'](_[_0x9ea3('0x4a')](_0x51a42f['query'],_0x405303[_0x9ea3('0x3f')]));if(_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x4b')]){_0x29367d[_0x9ea3('0x49')]=_['merge'](_0x29367d[_0x9ea3('0x49')],{'$or':_['map'](_0x29367d[_0x9ea3('0x42')],function(_0x22032d){var _0x5f5c2e={};_0x5f5c2e[_0x22032d]={'$like':'%'+_0x51a42f[_0x9ea3('0x3d')]['filter']+'%'};return _0x5f5c2e;})});}_0x29367d=_['merge']({},_0x29367d,_0x51a42f['options']);return _0x4988b1[_0x9ea3('0x58')](_0x29367d);}})['then'](function(_0x40dc41){if(_0x40dc41){_0x573b2b=_0x40dc41[_0x9ea3('0x43')];if(!_0x51a42f[_0x9ea3('0x3d')]['hasOwnProperty'](_0x9ea3('0x59'))){_0x29367d[_0x9ea3('0x45')]=qs[_0x9ea3('0x45')](_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x45')]);_0x29367d['offset']=qs[_0x9ea3('0x46')](_0x51a42f[_0x9ea3('0x3d')][_0x9ea3('0x46')]);}return _0x4988b1[_0x9ea3('0x58')](_0x29367d);}})[_0x9ea3('0x1d')](function(_0x547549){if(_0x547549){return _0x547549?{'count':_0x573b2b,'rows':_0x547549}:null;}})['then'](respondWithResult(_0x32f722,null))[_0x9ea3('0x27')](handleError(_0x32f722,null));};exports[_0x9ea3('0x5a')]=function(_0x41ad00,_0x40bc6d,_0x5850a9){if(_0x41ad00['body']['id']){delete _0x41ad00['body']['id'];}return db['DeskAccount'][_0x9ea3('0x56')]({'where':{'id':_0x41ad00['params']['id']}})[_0x9ea3('0x1d')](handleEntityNotFound(_0x40bc6d,null))[_0x9ea3('0x1d')](function(_0x2475e7){if(_0x2475e7){_0x41ad00['body'][_0x9ea3('0x5b')]=_0x2475e7['id'];_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5c')]=integrations[_0x9ea3('0x5d')](_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5e')],_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x3a')]);_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5f')]=integrations[_0x9ea3('0x60')](_0x41ad00[_0x9ea3('0x54')][_0x9ea3('0x5e')],_0x41ad00['body'][_0x9ea3('0x3a')]);return db['DeskConfiguration'][_0x9ea3('0x53')](_0x41ad00[_0x9ea3('0x54')],{'include':[{'model':db[_0x9ea3('0x61')],'as':_0x9ea3('0x5c')},{'model':db[_0x9ea3('0x61')],'as':'Descriptions'}]});}return null;})[_0x9ea3('0x1d')](respondWithResult(_0x40bc6d,null))[_0x9ea3('0x27')](handleError(_0x40bc6d,null));};exports[_0x9ea3('0x62')]=function(_0x120d6b,_0x18ac3c,_0x4b4f23){var _0x189d6d=[{'name':_0x9ea3('0x63'),'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 _0x3fdc9a='';return db[_0x9ea3('0x38')]['findOne']({'where':{'id':_0x120d6b[_0x9ea3('0x52')]['id']},'attributes':['id',_0x9ea3('0x64'),'authType','username',_0x9ea3('0x65'),_0x9ea3('0x66'),'consumerSecret',_0x9ea3('0x67'),_0x9ea3('0x68')]})[_0x9ea3('0x1d')](handleEntityNotFound(_0x18ac3c,null))[_0x9ea3('0x1d')](function(_0x124156){if(_0x124156){_0x3fdc9a=_0x124156[_0x9ea3('0x64')];var _0x50cb09=_0x3fdc9a[_0x9ea3('0x69')](-0x1);if(_0x50cb09==='/'){_0x3fdc9a=_0x3fdc9a[_0x9ea3('0x6a')](0x0,_0x3fdc9a[_0x9ea3('0x6b')](_0x50cb09));}var _0x133e8c={'method':'GET','uri':util[_0x9ea3('0x6c')](_0x9ea3('0x6d'),_0x3fdc9a),'headers':{'Content-Type':_0x9ea3('0x6e'),'Accept':_0x9ea3('0x6e')},'json':!![]};if(_0x124156['authType']===_0x9ea3('0x6f')){_0x133e8c[_0x9ea3('0x70')][_0x9ea3('0x71')]=util['format'](_0x9ea3('0x72'),new Buffer(util[_0x9ea3('0x6c')]('%s:%s',_0x124156[_0x9ea3('0x73')],_0x124156[_0x9ea3('0x65')]))[_0x9ea3('0x74')](_0x9ea3('0x75')));}return rp(_0x133e8c)['then'](function(_0x45d0e1){return _0x189d6d['concat'](_[_0x9ea3('0x37')](_0x45d0e1[_0x9ea3('0x76')][_0x9ea3('0x77')],function(_0x40204c){return{'id':_0x40204c['name'],'name':_0x40204c[_0x9ea3('0x34')],'type':_0x40204c[_0x9ea3('0x3a')],'active':_0x40204c[_0x9ea3('0x78')],'label':_0x40204c[_0x9ea3('0x79')],'custom':!![]};}));});}})[_0x9ea3('0x1d')](function(_0x4d4dc8){return{'count':_0x4d4dc8[_0x9ea3('0x43')],'rows':_0x4d4dc8};})[_0x9ea3('0x1d')](respondWithResult(_0x18ac3c,null))[_0x9ea3('0x27')](function(_0x89d35c){var _0x80d13e=_0x120d6b[_0x9ea3('0x3d')][_0x9ea3('0x1a')]?0x1f4:_0x89d35c['statusCode']||0x1f4;logger[_0x9ea3('0x23')](_0x9ea3('0x7a'),_0x9ea3('0x62'),_0x80d13e,JSON[_0x9ea3('0x22')](_0x89d35c));delete _0x89d35c[_0x9ea3('0x34')];if(_0x80d13e===0x191){_0x80d13e=0x190;}_0x18ac3c[_0x9ea3('0x28')](_0x80d13e)[_0x9ea3('0x35')](_0x120d6b[_0x9ea3('0x3d')][_0x9ea3('0x1a')]?{'message':_0x9ea3('0x7b'),'statusCode':_0x89d35c[_0x9ea3('0x7c')]}:_0x89d35c);});}; \ No newline at end of file +var _0x0471=['count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','filter','options','where','includeAll','findAll','rows','params','include','create','body','find','getConfigurations','findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','priority','remoteUri','authType','username','password','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','entries','active','label','test','getFields','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0471,0x145));var _0x1047=function(_0x25de1c,_0x23978f){_0x25de1c=_0x25de1c-0x0;var _0x3170f0=_0x0471[_0x25de1c];return _0x3170f0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1047('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1047('0x1'));var rp=require(_0x1047('0x2'));var moment=require(_0x1047('0x3'));var BPromise=require(_0x1047('0x4'));var Mustache=require(_0x1047('0x5'));var util=require(_0x1047('0x6'));var path=require(_0x1047('0x7'));var sox=require(_0x1047('0x8'));var csv=require('to-csv');var ejs=require(_0x1047('0x9'));var fs=require('fs');var _=require(_0x1047('0xa'));var squel=require(_0x1047('0xb'));var crypto=require(_0x1047('0xc'));var jsforce=require(_0x1047('0xd'));var deskjs=require(_0x1047('0xe'));var toCsv=require(_0x1047('0xf'));var querystring=require('querystring');var Papa=require(_0x1047('0x10'));var Redis=require('ioredis');var authService=require(_0x1047('0x11'));var qs=require(_0x1047('0x12'));var as=require(_0x1047('0x13'));var hardwareService=require(_0x1047('0x14'));var logger=require(_0x1047('0x15'))(_0x1047('0x16'));var utils=require('../../config/utils');var config=require(_0x1047('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1047('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x1047('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x354264,_0x11a724,_0x113fab){if(_0x113fab){var _0x3fdbd7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fdbd7['test'](_0x11a724)){return _0x354264;}else{throw new db['Sequelize'][(_0x1047('0x1a'))](_0x1047('0x1b'));}}else{return _0x354264;}}function respondWithRpcPromise(_0x17d3be,_0x53d4bf,_0x5556d1,_0x298011){return new BPromise(function(_0x2fa4f6,_0x59507b){var _0x3ac7d3=_0x298011||client;return _0x3ac7d3[_0x1047('0x1c')](_0x17d3be,_0x5556d1)[_0x1047('0x1d')](function(_0x337f01){logger[_0x1047('0x1e')](_0x1047('0x1f'),_0x53d4bf,'request\x20sent');logger[_0x1047('0x20')](_0x1047('0x21'),_0x53d4bf,'request\x20sent',JSON[_0x1047('0x22')](_0x337f01));if(_0x337f01[_0x1047('0x23')]){if(_0x337f01['error']['code']===0x1f4){logger[_0x1047('0x23')](_0x1047('0x1f'),_0x53d4bf,_0x337f01['error']['message']);return _0x59507b(_0x337f01[_0x1047('0x23')][_0x1047('0x24')]);}logger[_0x1047('0x23')]('DeskAccount,\x20%s,\x20%s',_0x53d4bf,_0x337f01[_0x1047('0x23')][_0x1047('0x24')]);return _0x2fa4f6(_0x337f01[_0x1047('0x23')][_0x1047('0x24')]);}else{logger['info'](_0x1047('0x1f'),_0x53d4bf,_0x1047('0x25'));_0x2fa4f6(_0x337f01[_0x1047('0x26')][_0x1047('0x24')]);}})[_0x1047('0x27')](function(_0x31f4c9){logger[_0x1047('0x23')](_0x1047('0x1f'),_0x53d4bf,_0x31f4c9);_0x59507b(_0x31f4c9);});});}function respondWithStatusCode(_0x4a11a0,_0x32a013){_0x32a013=_0x32a013||0xcc;return function(_0x5911e1){if(_0x5911e1){return _0x4a11a0[_0x1047('0x28')](_0x32a013);}return _0x4a11a0[_0x1047('0x29')](_0x32a013)[_0x1047('0x2a')]();};}function respondWithResult(_0x41cb7b,_0x18854f){_0x18854f=_0x18854f||0xc8;return function(_0x35be73){if(_0x35be73){return _0x41cb7b[_0x1047('0x29')](_0x18854f)[_0x1047('0x2b')](_0x35be73);}};}function respondWithFilteredResult(_0x4f397f,_0x1a65dd){return function(_0x1c2c4f){if(_0x1c2c4f){var _0x36e245=_0x1c2c4f[_0x1047('0x2c')],_0x9881c0=_0x1a65dd[_0x1047('0x2d')],_0x53646e=_0x1a65dd[_0x1047('0x2d')]+_0x1a65dd[_0x1047('0x2e')],_0x269d72;if(_0x53646e>=_0x36e245){_0x53646e=_0x36e245;_0x269d72=0xc8;}else{_0x269d72=0xce;}_0x4f397f[_0x1047('0x29')](_0x269d72);return _0x4f397f[_0x1047('0x2f')](_0x1047('0x30'),_0x9881c0+'-'+_0x53646e+'/'+_0x36e245)[_0x1047('0x2b')](_0x1c2c4f);}return null;};}function patchUpdates(_0x10d5cc){return function(_0x5aaa96){try{jsonpatch[_0x1047('0x31')](_0x5aaa96,_0x10d5cc,!![]);}catch(_0x4f01ba){return BPromise['reject'](_0x4f01ba);}return _0x5aaa96[_0x1047('0x32')]();};}function saveUpdates(_0x80cf4c,_0x449884){return function(_0x332df0){if(_0x332df0){return _0x332df0[_0x1047('0x33')](_0x80cf4c)['then'](function(_0x9c4f4f){return _0x9c4f4f;});}return null;};}function removeEntity(_0x5517f0,_0x330f65){return function(_0x5233cf){if(_0x5233cf){return _0x5233cf[_0x1047('0x34')]()[_0x1047('0x1d')](function(){_0x5517f0[_0x1047('0x29')](0xcc)[_0x1047('0x2a')]();});}};}function handleEntityNotFound(_0x4a3e5d,_0x3502a6){return function(_0x4af919){if(!_0x4af919){_0x4a3e5d['sendStatus'](0x194);}return _0x4af919;};}function handleError(_0x46a197,_0x524cf5){_0x524cf5=_0x524cf5||0x1f4;return function(_0x41c84f){logger[_0x1047('0x23')](_0x41c84f[_0x1047('0x35')]);if(_0x41c84f[_0x1047('0x36')]){delete _0x41c84f[_0x1047('0x36')];}_0x46a197['status'](_0x524cf5)['send'](_0x41c84f);};}exports['index']=function(_0x5aa541,_0x1945ce){var _0x2a6310={},_0x1fc1f6={},_0x15f8c3={'count':0x0,'rows':[]};var _0x146e0f=_[_0x1047('0x37')](db[_0x1047('0x38')][_0x1047('0x39')],function(_0x3d8964){return{'name':_0x3d8964[_0x1047('0x3a')],'type':_0x3d8964[_0x1047('0x3b')][_0x1047('0x3c')]};});_0x1fc1f6[_0x1047('0x3d')]=_['map'](_0x146e0f,'name');_0x1fc1f6[_0x1047('0x3e')]=_[_0x1047('0x3f')](_0x5aa541[_0x1047('0x3e')]);_0x1fc1f6[_0x1047('0x40')]=_[_0x1047('0x41')](_0x1fc1f6['model'],_0x1fc1f6[_0x1047('0x3e')]);_0x2a6310['attributes']=_[_0x1047('0x41')](_0x1fc1f6[_0x1047('0x3d')],qs[_0x1047('0x42')](_0x5aa541['query'][_0x1047('0x42')]));_0x2a6310['attributes']=_0x2a6310[_0x1047('0x43')][_0x1047('0x44')]?_0x2a6310[_0x1047('0x43')]:_0x1fc1f6[_0x1047('0x3d')];if(!_0x5aa541[_0x1047('0x3e')][_0x1047('0x45')](_0x1047('0x46'))){_0x2a6310[_0x1047('0x2e')]=qs['limit'](_0x5aa541['query'][_0x1047('0x2e')]);_0x2a6310['offset']=qs['offset'](_0x5aa541[_0x1047('0x3e')][_0x1047('0x2d')]);}_0x2a6310[_0x1047('0x47')]=qs['sort'](_0x5aa541[_0x1047('0x3e')]['sort']);_0x2a6310['where']=qs[_0x1047('0x40')](_[_0x1047('0x48')](_0x5aa541[_0x1047('0x3e')],_0x1fc1f6[_0x1047('0x40')]),_0x146e0f);if(_0x5aa541['query']['filter']){_0x2a6310['where']=_[_0x1047('0x49')](_0x2a6310['where'],{'$or':_['map'](_0x146e0f,function(_0x2d9456){if(_0x2d9456[_0x1047('0x3b')]!=='VIRTUAL'){var _0x3d8ac8={};_0x3d8ac8[_0x2d9456[_0x1047('0x36')]]={'$like':'%'+_0x5aa541[_0x1047('0x3e')][_0x1047('0x4a')]+'%'};return _0x3d8ac8;}})});}_0x2a6310=_[_0x1047('0x49')]({},_0x2a6310,_0x5aa541[_0x1047('0x4b')]);var _0x21249a={'where':_0x2a6310[_0x1047('0x4c')]};return db['DeskAccount'][_0x1047('0x2c')](_0x21249a)['then'](function(_0x138f88){_0x15f8c3[_0x1047('0x2c')]=_0x138f88;if(_0x5aa541[_0x1047('0x3e')][_0x1047('0x4d')]){_0x2a6310['include']=[{'all':!![]}];}return db[_0x1047('0x38')][_0x1047('0x4e')](_0x2a6310);})[_0x1047('0x1d')](function(_0x58fe53){_0x15f8c3[_0x1047('0x4f')]=_0x58fe53;return _0x15f8c3;})[_0x1047('0x1d')](respondWithFilteredResult(_0x1945ce,_0x2a6310))[_0x1047('0x27')](handleError(_0x1945ce,null));};exports['show']=function(_0x88f27a,_0x179708){var _0x2f80d5={'raw':![],'where':{'id':_0x88f27a[_0x1047('0x50')]['id']}},_0x2c23e4={};_0x2c23e4[_0x1047('0x3d')]=_[_0x1047('0x3f')](db[_0x1047('0x38')]['rawAttributes']);_0x2c23e4[_0x1047('0x3e')]=_['keys'](_0x88f27a[_0x1047('0x3e')]);_0x2c23e4['filters']=_[_0x1047('0x41')](_0x2c23e4[_0x1047('0x3d')],_0x2c23e4[_0x1047('0x3e')]);_0x2f80d5[_0x1047('0x43')]=_[_0x1047('0x41')](_0x2c23e4[_0x1047('0x3d')],qs[_0x1047('0x42')](_0x88f27a['query'][_0x1047('0x42')]));_0x2f80d5[_0x1047('0x43')]=_0x2f80d5[_0x1047('0x43')][_0x1047('0x44')]?_0x2f80d5[_0x1047('0x43')]:_0x2c23e4['model'];if(_0x88f27a['query'][_0x1047('0x4d')]){_0x2f80d5[_0x1047('0x51')]=[{'all':!![]}];}_0x2f80d5=_[_0x1047('0x49')]({},_0x2f80d5,_0x88f27a['options']);return db['DeskAccount']['find'](_0x2f80d5)[_0x1047('0x1d')](handleEntityNotFound(_0x179708,null))[_0x1047('0x1d')](respondWithResult(_0x179708,null))[_0x1047('0x27')](handleError(_0x179708,null));};exports[_0x1047('0x52')]=function(_0x3631f8,_0x453087){return db[_0x1047('0x38')][_0x1047('0x52')](_0x3631f8[_0x1047('0x53')],{})[_0x1047('0x1d')](respondWithResult(_0x453087,0xc9))['catch'](handleError(_0x453087,null));};exports[_0x1047('0x33')]=function(_0x5dcc77,_0x39aefd){if(_0x5dcc77['body']['id']){delete _0x5dcc77[_0x1047('0x53')]['id'];}return db[_0x1047('0x38')][_0x1047('0x54')]({'where':{'id':_0x5dcc77['params']['id']}})['then'](handleEntityNotFound(_0x39aefd,null))[_0x1047('0x1d')](saveUpdates(_0x5dcc77['body'],null))[_0x1047('0x1d')](respondWithResult(_0x39aefd,null))['catch'](handleError(_0x39aefd,null));};exports[_0x1047('0x34')]=function(_0x3a3df9,_0x5a8893){return db['DeskAccount']['find']({'where':{'id':_0x3a3df9[_0x1047('0x50')]['id']}})[_0x1047('0x1d')](handleEntityNotFound(_0x5a8893,null))[_0x1047('0x1d')](removeEntity(_0x5a8893,null))[_0x1047('0x27')](handleError(_0x5a8893,null));};exports[_0x1047('0x55')]=function(_0x5dea3e,_0x46c6e1,_0x579a63){var _0x2907ec={};var _0x3da49c={};var _0x173075;var _0x3dd765;return db['DeskAccount'][_0x1047('0x56')]({'where':{'id':_0x5dea3e['params']['id']}})[_0x1047('0x1d')](handleEntityNotFound(_0x46c6e1,null))[_0x1047('0x1d')](function(_0xba2a72){if(_0xba2a72){_0x173075=_0xba2a72;_0x3da49c[_0x1047('0x3d')]=_[_0x1047('0x3f')](db[_0x1047('0x57')][_0x1047('0x39')]);_0x3da49c[_0x1047('0x3e')]=_[_0x1047('0x3f')](_0x5dea3e[_0x1047('0x3e')]);_0x3da49c[_0x1047('0x40')]=_[_0x1047('0x41')](_0x3da49c[_0x1047('0x3d')],_0x3da49c[_0x1047('0x3e')]);_0x2907ec[_0x1047('0x43')]=_['intersection'](_0x3da49c[_0x1047('0x3d')],qs[_0x1047('0x42')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x42')]));_0x2907ec[_0x1047('0x43')]=_0x2907ec[_0x1047('0x43')]['length']?_0x2907ec[_0x1047('0x43')]:_0x3da49c[_0x1047('0x3d')];_0x2907ec['order']=qs[_0x1047('0x58')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x58')]);_0x2907ec[_0x1047('0x4c')]=qs[_0x1047('0x40')](_[_0x1047('0x48')](_0x5dea3e[_0x1047('0x3e')],_0x3da49c[_0x1047('0x40')]));if(_0x5dea3e[_0x1047('0x3e')][_0x1047('0x4a')]){_0x2907ec['where']=_[_0x1047('0x49')](_0x2907ec[_0x1047('0x4c')],{'$or':_['map'](_0x2907ec[_0x1047('0x43')],function(_0x12f8eb){var _0x228b50={};_0x228b50[_0x12f8eb]={'$like':'%'+_0x5dea3e[_0x1047('0x3e')][_0x1047('0x4a')]+'%'};return _0x228b50;})});}_0x2907ec=_[_0x1047('0x49')]({},_0x2907ec,_0x5dea3e[_0x1047('0x4b')]);return _0x173075['getConfigurations'](_0x2907ec);}})[_0x1047('0x1d')](function(_0x5cea27){if(_0x5cea27){_0x3dd765=_0x5cea27[_0x1047('0x44')];if(!_0x5dea3e[_0x1047('0x3e')][_0x1047('0x45')](_0x1047('0x46'))){_0x2907ec['limit']=qs[_0x1047('0x2e')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x2e')]);_0x2907ec[_0x1047('0x2d')]=qs[_0x1047('0x2d')](_0x5dea3e[_0x1047('0x3e')][_0x1047('0x2d')]);}return _0x173075[_0x1047('0x55')](_0x2907ec);}})[_0x1047('0x1d')](function(_0x437e3a){if(_0x437e3a){return _0x437e3a?{'count':_0x3dd765,'rows':_0x437e3a}:null;}})[_0x1047('0x1d')](respondWithResult(_0x46c6e1,null))[_0x1047('0x27')](handleError(_0x46c6e1,null));};exports[_0x1047('0x59')]=function(_0x5a721a,_0x3c172b,_0x7afa44){if(_0x5a721a[_0x1047('0x53')]['id']){delete _0x5a721a[_0x1047('0x53')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5a721a[_0x1047('0x50')]['id']}})[_0x1047('0x1d')](handleEntityNotFound(_0x3c172b,null))[_0x1047('0x1d')](function(_0x2e340e){if(_0x2e340e){_0x5a721a['body'][_0x1047('0x5a')]=_0x2e340e['id'];_0x5a721a['body'][_0x1047('0x5b')]=integrations[_0x1047('0x5c')](_0x5a721a['body']['channel'],_0x5a721a[_0x1047('0x53')][_0x1047('0x3b')]);_0x5a721a['body'][_0x1047('0x5d')]=integrations[_0x1047('0x5e')](_0x5a721a[_0x1047('0x53')][_0x1047('0x5f')],_0x5a721a[_0x1047('0x53')][_0x1047('0x3b')]);return db[_0x1047('0x57')][_0x1047('0x52')](_0x5a721a['body'],{'include':[{'model':db[_0x1047('0x60')],'as':_0x1047('0x5b')},{'model':db[_0x1047('0x60')],'as':_0x1047('0x5d')}]});}return null;})['then'](respondWithResult(_0x3c172b,null))[_0x1047('0x27')](handleError(_0x3c172b,null));};exports['getFields']=function(_0xcbba60,_0x44574b,_0x1e73da){var _0x255982=[{'name':'priority','label':_0x1047('0x61'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4d2999='';return db[_0x1047('0x38')]['findOne']({'where':{'id':_0xcbba60['params']['id']},'attributes':['id',_0x1047('0x62'),_0x1047('0x63'),_0x1047('0x64'),_0x1047('0x65'),'consumerKey','consumerSecret',_0x1047('0x66'),'tokenSecret']})[_0x1047('0x1d')](handleEntityNotFound(_0x44574b,null))[_0x1047('0x1d')](function(_0x54b2c2){if(_0x54b2c2){_0x4d2999=_0x54b2c2[_0x1047('0x62')];var _0x29ee08=_0x4d2999['slice'](-0x1);if(_0x29ee08==='/'){_0x4d2999=_0x4d2999[_0x1047('0x67')](0x0,_0x4d2999[_0x1047('0x68')](_0x29ee08));}var _0x11f07f={'method':_0x1047('0x69'),'uri':util[_0x1047('0x6a')](_0x1047('0x6b'),_0x4d2999),'headers':{'Content-Type':_0x1047('0x6c'),'Accept':'application/json'},'json':!![]};if(_0x54b2c2[_0x1047('0x63')]===_0x1047('0x6d')){_0x11f07f[_0x1047('0x6e')][_0x1047('0x6f')]=util[_0x1047('0x6a')](_0x1047('0x70'),new Buffer(util['format'](_0x1047('0x71'),_0x54b2c2[_0x1047('0x64')],_0x54b2c2[_0x1047('0x65')]))[_0x1047('0x72')]('base64'));}return rp(_0x11f07f)[_0x1047('0x1d')](function(_0x1cc892){return _0x255982[_0x1047('0x73')](_[_0x1047('0x37')](_0x1cc892['_embedded'][_0x1047('0x74')],function(_0x326908){return{'id':_0x326908[_0x1047('0x36')],'name':_0x326908['name'],'type':_0x326908[_0x1047('0x3b')],'active':_0x326908[_0x1047('0x75')],'label':_0x326908[_0x1047('0x76')],'custom':!![]};}));});}})[_0x1047('0x1d')](function(_0x593e00){return{'count':_0x593e00[_0x1047('0x44')],'rows':_0x593e00};})[_0x1047('0x1d')](respondWithResult(_0x44574b,null))['catch'](function(_0xd64c0d){var _0x1ac7e3=_0xcbba60[_0x1047('0x3e')][_0x1047('0x77')]?0x1f4:_0xd64c0d['statusCode']||0x1f4;logger[_0x1047('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x1047('0x78'),_0x1ac7e3,JSON[_0x1047('0x22')](_0xd64c0d));delete _0xd64c0d[_0x1047('0x36')];if(_0x1ac7e3===0x191){_0x1ac7e3=0x190;}_0x44574b[_0x1047('0x29')](_0x1ac7e3)[_0x1047('0x79')](_0xcbba60[_0x1047('0x3e')][_0x1047('0x77')]?{'message':_0x1047('0x7a'),'statusCode':_0xd64c0d['statusCode']}:_0xd64c0d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0e9ce5d..7257e90 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 _0x2ae0=['DeskAccount','int_desk_accounts','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0x2ae0,0x161));var _0x02ae=function(_0x415e13,_0x19623a){_0x415e13=_0x415e13-0x0;var _0xa3a89=_0x2ae0[_0x415e13];return _0xa3a89;};'use strict';var _=require(_0x02ae('0x0'));var util=require(_0x02ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x02ae('0x2'));var BPromise=require(_0x02ae('0x3'));var rp=require(_0x02ae('0x4'));var fs=require('fs');var path=require(_0x02ae('0x5'));var rimraf=require('rimraf');var config=require(_0x02ae('0x6'));var attributes=require(_0x02ae('0x7'));var integrations=require(_0x02ae('0x8'));module[_0x02ae('0x9')]=function(_0x32c0b8,_0x25edc3){return _0x32c0b8[_0x02ae('0xa')](_0x02ae('0xb'),attributes,{'tableName':_0x02ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85b9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x261db1,_0xb737fe){var _0xcb49fe=function(_0x26c78f){while(--_0x26c78f){_0x261db1['push'](_0x261db1['shift']());}};_0xcb49fe(++_0xb737fe);}(_0x85b9,0xc1));var _0x985b=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x85b9[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x985b('0x0'));var util=require(_0x985b('0x1'));var logger=require(_0x985b('0x2'))('api');var moment=require(_0x985b('0x3'));var BPromise=require(_0x985b('0x4'));var rp=require(_0x985b('0x5'));var fs=require('fs');var path=require(_0x985b('0x6'));var rimraf=require(_0x985b('0x7'));var config=require(_0x985b('0x8'));var attributes=require(_0x985b('0x9'));var integrations=require(_0x985b('0xa'));module[_0x985b('0xb')]=function(_0x53c76f,_0x2e7e33){return _0x53c76f[_0x985b('0xc')](_0x985b('0xd'),attributes,{'tableName':_0x985b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index c128880..3754a96 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 _0xe51d=['GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowDeskAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x5aec33,_0x402923){var _0x1f3ce5=function(_0x23e95c){while(--_0x23e95c){_0x5aec33['push'](_0x5aec33['shift']());}};_0x1f3ce5(++_0x402923);}(_0xe51d,0x1e3));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde51('0x0'));var util=require(_0xde51('0x1'));var moment=require('moment');var BPromise=require(_0xde51('0x2'));var rs=require(_0xde51('0x3'));var fs=require('fs');var Redis=require(_0xde51('0x4'));var db=require(_0xde51('0x5'))['db'];var utils=require(_0xde51('0x6'));var logger=require(_0xde51('0x7'))('rpc');var config=require(_0xde51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde51('0x9')][_0xde51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a94fa,_0x4bbf0d,_0x1d6da5){return new BPromise(function(_0x202460,_0x942e97){return client[_0xde51('0xb')](_0x4a94fa,_0x1d6da5)['then'](function(_0x4bf2f0){logger['info'](_0xde51('0xc'),_0x4bbf0d,_0xde51('0xd'));logger[_0xde51('0xe')](_0xde51('0xf'),_0x4bbf0d,_0xde51('0xd'),JSON['stringify'](_0x4bf2f0));if(_0x4bf2f0[_0xde51('0x10')]){if(_0x4bf2f0[_0xde51('0x10')]['code']===0x1f4){logger[_0xde51('0x10')](_0xde51('0xc'),_0x4bbf0d,_0x4bf2f0[_0xde51('0x10')][_0xde51('0x11')]);return _0x942e97(_0x4bf2f0[_0xde51('0x10')][_0xde51('0x11')]);}logger[_0xde51('0x10')](_0xde51('0xc'),_0x4bbf0d,_0x4bf2f0[_0xde51('0x10')]['message']);return _0x202460(_0x4bf2f0[_0xde51('0x10')][_0xde51('0x11')]);}else{logger[_0xde51('0x12')](_0xde51('0xc'),_0x4bbf0d,'request\x20sent');_0x202460(_0x4bf2f0[_0xde51('0x13')][_0xde51('0x11')]);}})[_0xde51('0x14')](function(_0x21f37e){logger[_0xde51('0x10')](_0xde51('0xc'),_0x4bbf0d,_0x21f37e);_0x942e97(_0x21f37e);});});}exports[_0xde51('0x15')]=function(_0x4ffe64){var _0x2d2108=this;return new Promise(function(_0x16191f,_0x41e12d){return db[_0xde51('0x16')][_0xde51('0x17')]({'raw':_0x4ffe64['options']?_0x4ffe64[_0xde51('0x18')][_0xde51('0x19')]===undefined?!![]:![]:!![],'where':_0x4ffe64[_0xde51('0x18')]?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1a')]||null:null,'attributes':_0x4ffe64['options']?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1b')]||null:null,'limit':_0x4ffe64['options']?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1c')]||null:null,'include':_0x4ffe64[_0xde51('0x18')]?_0x4ffe64[_0xde51('0x18')][_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x4ffe64[_0xde51('0x18')][_0xde51('0x1d')],function(_0x58b9fd){return{'model':db[_0x58b9fd['model']],'as':_0x58b9fd['as'],'attributes':_0x58b9fd[_0xde51('0x1b')],'include':_0x58b9fd[_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x58b9fd[_0xde51('0x1d')],function(_0xee3b47){return{'model':db[_0xee3b47['model']],'as':_0xee3b47['as'],'attributes':_0xee3b47['attributes'],'include':_0xee3b47[_0xde51('0x1d')]?_[_0xde51('0x1e')](_0xee3b47[_0xde51('0x1d')],function(_0x516c14){return{'model':db[_0x516c14[_0xde51('0x1f')]],'as':_0x516c14['as'],'attributes':_0x516c14['attributes']};}):[]};}):[]};}):[]:[]})[_0xde51('0x20')](function(_0x580bdd){logger[_0xde51('0x12')]('GetDeskAccount',_0x4ffe64);logger[_0xde51('0xe')](_0xde51('0x15'),_0x4ffe64,JSON['stringify'](_0x580bdd));_0x16191f(_0x580bdd);})[_0xde51('0x14')](function(_0x3eb00a){logger[_0xde51('0x10')](_0xde51('0x15'),_0x3eb00a[_0xde51('0x11')],_0x4ffe64);_0x41e12d(_0x2d2108['error'](0x1f4,_0x3eb00a[_0xde51('0x11')]));});});};exports['ShowDeskAccount']=function(_0x2c1b02){var _0x3aff61=this;return new Promise(function(_0x36f7e0,_0x5c7431){return db['DeskAccount'][_0xde51('0x21')]({'raw':_0x2c1b02['options']?_0x2c1b02['options'][_0xde51('0x19')]===undefined?!![]:![]:!![],'where':_0x2c1b02['options']?_0x2c1b02['options'][_0xde51('0x1a')]||null:null,'attributes':_0x2c1b02['options']?_0x2c1b02['options']['attributes']||null:null,'include':_0x2c1b02[_0xde51('0x18')]?_0x2c1b02[_0xde51('0x18')][_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x2c1b02['options'][_0xde51('0x1d')],function(_0x14a1e8){return{'model':db[_0x14a1e8[_0xde51('0x1f')]],'as':_0x14a1e8['as'],'attributes':_0x14a1e8[_0xde51('0x1b')],'include':_0x14a1e8[_0xde51('0x1d')]?_['map'](_0x14a1e8[_0xde51('0x1d')],function(_0x3921dc){return{'model':db[_0x3921dc[_0xde51('0x1f')]],'as':_0x3921dc['as'],'attributes':_0x3921dc['attributes'],'include':_0x3921dc[_0xde51('0x1d')]?_[_0xde51('0x1e')](_0x3921dc[_0xde51('0x1d')],function(_0x34969e){return{'model':db[_0x34969e[_0xde51('0x1f')]],'as':_0x34969e['as'],'attributes':_0x34969e['attributes']};}):[]};}):[]};}):[]:[]})[_0xde51('0x20')](function(_0x2c7528){logger[_0xde51('0x12')](_0xde51('0x22'),_0x2c1b02);logger[_0xde51('0xe')](_0xde51('0x22'),_0x2c1b02,JSON[_0xde51('0x23')](_0x2c7528));_0x36f7e0(_0x2c7528);})[_0xde51('0x14')](function(_0x21775c){logger[_0xde51('0x10')](_0xde51('0x22'),_0x21775c['message'],_0x2c1b02);_0x5c7431(_0x3aff61[_0xde51('0x10')](0x1f4,_0x21775c['message']));});});}; \ No newline at end of file +var _0x8de7=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','catch','find','where','ShowDeskAccount','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47a37b,_0x2ff605){var _0x2eee95=function(_0x2ed799){while(--_0x2ed799){_0x47a37b['push'](_0x47a37b['shift']());}};_0x2eee95(++_0x2ff605);}(_0x8de7,0x7a));var _0x78de=function(_0x377912,_0x4779d3){_0x377912=_0x377912-0x0;var _0x58f193=_0x8de7[_0x377912];return _0x58f193;};'use strict';var _=require(_0x78de('0x0'));var util=require('util');var moment=require(_0x78de('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78de('0x2'));var db=require(_0x78de('0x3'))['db'];var utils=require(_0x78de('0x4'));var logger=require('../../config/logger')(_0x78de('0x5'));var config=require(_0x78de('0x6'));var jayson=require(_0x78de('0x7'));var client=jayson[_0x78de('0x8')][_0x78de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ef3a,_0x49cda1,_0x5633eb){return new BPromise(function(_0xd75f2d,_0x378d30){return client['request'](_0x40ef3a,_0x5633eb)['then'](function(_0x98799d){logger[_0x78de('0xa')](_0x78de('0xb'),_0x49cda1,_0x78de('0xc'));logger[_0x78de('0xd')](_0x78de('0xe'),_0x49cda1,'request\x20sent',JSON[_0x78de('0xf')](_0x98799d));if(_0x98799d['error']){if(_0x98799d[_0x78de('0x10')][_0x78de('0x11')]===0x1f4){logger[_0x78de('0x10')](_0x78de('0xb'),_0x49cda1,_0x98799d[_0x78de('0x10')][_0x78de('0x12')]);return _0x378d30(_0x98799d['error'][_0x78de('0x12')]);}logger[_0x78de('0x10')](_0x78de('0xb'),_0x49cda1,_0x98799d[_0x78de('0x10')][_0x78de('0x12')]);return _0xd75f2d(_0x98799d[_0x78de('0x10')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x49cda1,_0x78de('0xc'));_0xd75f2d(_0x98799d['result'][_0x78de('0x12')]);}})['catch'](function(_0x54dd74){logger[_0x78de('0x10')](_0x78de('0xb'),_0x49cda1,_0x54dd74);_0x378d30(_0x54dd74);});});}exports[_0x78de('0x13')]=function(_0x4dac16){var _0x395578=this;return new Promise(function(_0x5abfee,_0x271d16){return db[_0x78de('0x14')][_0x78de('0x15')]({'raw':_0x4dac16[_0x78de('0x16')]?_0x4dac16['options'][_0x78de('0x17')]===undefined?!![]:![]:!![],'where':_0x4dac16['options']?_0x4dac16['options']['where']||null:null,'attributes':_0x4dac16[_0x78de('0x16')]?_0x4dac16[_0x78de('0x16')][_0x78de('0x18')]||null:null,'limit':_0x4dac16[_0x78de('0x16')]?_0x4dac16[_0x78de('0x16')][_0x78de('0x19')]||null:null,'include':_0x4dac16[_0x78de('0x16')]?_0x4dac16[_0x78de('0x16')][_0x78de('0x1a')]?_['map'](_0x4dac16['options']['include'],function(_0x1d4fd8){return{'model':db[_0x1d4fd8[_0x78de('0x1b')]],'as':_0x1d4fd8['as'],'attributes':_0x1d4fd8[_0x78de('0x18')],'include':_0x1d4fd8[_0x78de('0x1a')]?_[_0x78de('0x1c')](_0x1d4fd8['include'],function(_0x1ac812){return{'model':db[_0x1ac812[_0x78de('0x1b')]],'as':_0x1ac812['as'],'attributes':_0x1ac812[_0x78de('0x18')],'include':_0x1ac812['include']?_[_0x78de('0x1c')](_0x1ac812[_0x78de('0x1a')],function(_0x588ec4){return{'model':db[_0x588ec4[_0x78de('0x1b')]],'as':_0x588ec4['as'],'attributes':_0x588ec4[_0x78de('0x18')]};}):[]};}):[]};}):[]:[]})[_0x78de('0x1d')](function(_0x4e839f){logger[_0x78de('0xa')](_0x78de('0x13'),_0x4dac16);logger[_0x78de('0xd')](_0x78de('0x13'),_0x4dac16,JSON[_0x78de('0xf')](_0x4e839f));_0x5abfee(_0x4e839f);})[_0x78de('0x1e')](function(_0x47b5bd){logger[_0x78de('0x10')]('GetDeskAccount',_0x47b5bd[_0x78de('0x12')],_0x4dac16);_0x271d16(_0x395578[_0x78de('0x10')](0x1f4,_0x47b5bd['message']));});});};exports['ShowDeskAccount']=function(_0x29392f){var _0x206956=this;return new Promise(function(_0x526d25,_0x44148c){return db[_0x78de('0x14')][_0x78de('0x1f')]({'raw':_0x29392f['options']?_0x29392f['options'][_0x78de('0x17')]===undefined?!![]:![]:!![],'where':_0x29392f[_0x78de('0x16')]?_0x29392f['options'][_0x78de('0x20')]||null:null,'attributes':_0x29392f[_0x78de('0x16')]?_0x29392f[_0x78de('0x16')]['attributes']||null:null,'include':_0x29392f['options']?_0x29392f[_0x78de('0x16')][_0x78de('0x1a')]?_['map'](_0x29392f[_0x78de('0x16')][_0x78de('0x1a')],function(_0x1d8003){return{'model':db[_0x1d8003[_0x78de('0x1b')]],'as':_0x1d8003['as'],'attributes':_0x1d8003[_0x78de('0x18')],'include':_0x1d8003['include']?_['map'](_0x1d8003[_0x78de('0x1a')],function(_0x5790d7){return{'model':db[_0x5790d7[_0x78de('0x1b')]],'as':_0x5790d7['as'],'attributes':_0x5790d7[_0x78de('0x18')],'include':_0x5790d7['include']?_[_0x78de('0x1c')](_0x5790d7[_0x78de('0x1a')],function(_0x3545b3){return{'model':db[_0x3545b3[_0x78de('0x1b')]],'as':_0x3545b3['as'],'attributes':_0x3545b3[_0x78de('0x18')]};}):[]};}):[]};}):[]:[]})[_0x78de('0x1d')](function(_0x1d64b1){logger['info'](_0x78de('0x21'),_0x29392f);logger[_0x78de('0xd')](_0x78de('0x21'),_0x29392f,JSON[_0x78de('0xf')](_0x1d64b1));_0x526d25(_0x1d64b1);})[_0x78de('0x1e')](function(_0x1d3dbb){logger['error'](_0x78de('0x21'),_0x1d3dbb['message'],_0x29392f);_0x44148c(_0x206956[_0x78de('0x10')](0x1f4,_0x1d3dbb['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7b792eb..b837291 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 _0x6f44=['getTags','post','create','setTags','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x6f44,0x1ea));var _0x46f4=function(_0x39a9fd,_0x504964){_0x39a9fd=_0x39a9fd-0x0;var _0x4da98b=_0x6f44[_0x39a9fd];return _0x4da98b;};'use strict';var multer=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var path=require('path');var timeout=require(_0x46f4('0x2'));var express=require(_0x46f4('0x3'));var router=express[_0x46f4('0x4')]();var auth=require(_0x46f4('0x5'));var interaction=require(_0x46f4('0x6'));var config=require(_0x46f4('0x7'));var controller=require(_0x46f4('0x8'));router[_0x46f4('0x9')]('/',auth[_0x46f4('0xa')](),controller['index']);router[_0x46f4('0x9')](_0x46f4('0xb'),auth[_0x46f4('0xa')](),controller['show']);router['get'](_0x46f4('0xc'),auth[_0x46f4('0xa')](),controller['getFields']);router[_0x46f4('0x9')]('/:id/subjects',auth[_0x46f4('0xa')](),controller['getSubjects']);router[_0x46f4('0x9')](_0x46f4('0xd'),auth[_0x46f4('0xa')](),controller[_0x46f4('0xe')]);router[_0x46f4('0x9')](_0x46f4('0xf'),auth[_0x46f4('0xa')](),controller[_0x46f4('0x10')]);router[_0x46f4('0x11')]('/',auth[_0x46f4('0xa')](),controller[_0x46f4('0x12')]);router[_0x46f4('0x11')]('/:id/tags',auth[_0x46f4('0xa')](),controller[_0x46f4('0x13')]);router['put'](_0x46f4('0xb'),auth[_0x46f4('0xa')](),controller[_0x46f4('0x14')]);router['delete'](_0x46f4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x46f4('0x15')]=router; \ No newline at end of file +var _0x9f0e=['setTags','update','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x201af5,_0xc91123){var _0x35c62f=function(_0x1b0b9d){while(--_0x1b0b9d){_0x201af5['push'](_0x201af5['shift']());}};_0x35c62f(++_0xc91123);}(_0x9f0e,0x116));var _0xe9f0=function(_0xe1ccd9,_0xacc0ee){_0xe1ccd9=_0xe1ccd9-0x0;var _0x51b73f=_0x9f0e[_0xe1ccd9];return _0x51b73f;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var controller=require(_0xe9f0('0x7'));router[_0xe9f0('0x8')]('/',auth[_0xe9f0('0x9')](),controller['index']);router['get'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xb')]);router['get'](_0xe9f0('0xc'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x8')](_0xe9f0('0xe'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x8')](_0xe9f0('0x10'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x8')](_0xe9f0('0x12'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);router['post']('/',auth[_0xe9f0('0x9')](),controller[_0xe9f0('0x14')]);router[_0xe9f0('0x15')](_0xe9f0('0x12'),auth['isAuthenticated'](),controller[_0xe9f0('0x16')]);router['put'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0x17')]);router['delete'](_0xe9f0('0xa'),auth[_0xe9f0('0x9')](),controller[_0xe9f0('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 12ece0d..a8ef182 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 _0xb7c2=['sequelize','exports','STRING'];(function(_0x53c35c,_0x454f9f){var _0x698bd8=function(_0x86e843){while(--_0x86e843){_0x53c35c['push'](_0x53c35c['shift']());}};_0x698bd8(++_0x454f9f);}(_0xb7c2,0x1ef));var _0x2b7c=function(_0x3d4179,_0x301ec9){_0x3d4179=_0x3d4179-0x0;var _0x3e5f4d=_0xb7c2[_0x3d4179];return _0x3e5f4d;};'use strict';var Sequelize=require(_0x2b7c('0x0'));module[_0x2b7c('0x1')]={'name':{'type':Sequelize[_0x2b7c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30f3=['exports','STRING','sequelize'];(function(_0x2ecb89,_0xcbaeac){var _0x46bd2f=function(_0x52619c){while(--_0x52619c){_0x2ecb89['push'](_0x2ecb89['shift']());}};_0x46bd2f(++_0xcbaeac);}(_0x30f3,0xbf));var _0x330f=function(_0x65397d,_0xf997ae){_0x65397d=_0x65397d-0x0;var _0x357509=_0x30f3[_0x65397d];return _0x357509;};'use strict';var Sequelize=require(_0x330f('0x0'));module[_0x330f('0x1')]={'name':{'type':Sequelize[_0x330f('0x2')]},'description':{'type':Sequelize[_0x330f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9fa6b0c..e090176 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 _0x2029=['../../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~!@#$%^&-_=+[{]}.','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','count','offset','limit','set','json','reject','save','update','destroy','status','stack','name','index','DeskConfiguration','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','findAll','show','params','includeAll','include','options','find','create','body','getFields','findOne','order','pick','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x220d5b,_0x290a1f){var _0x54ce5f=function(_0x11b979){while(--_0x11b979){_0x220d5b['push'](_0x220d5b['shift']());}};_0x54ce5f(++_0x290a1f);}(_0x2029,0x171));var _0x9202=function(_0x1419ef,_0x3ee45b){_0x1419ef=_0x1419ef-0x0;var _0x386d16=_0x2029[_0x1419ef];return _0x386d16;};'use strict';var pdf=require(_0x9202('0x0'));var emlformat=require(_0x9202('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9202('0x2'));var jsonpatch=require(_0x9202('0x3'));var rp=require(_0x9202('0x4'));var moment=require(_0x9202('0x5'));var BPromise=require(_0x9202('0x6'));var Mustache=require(_0x9202('0x7'));var util=require(_0x9202('0x8'));var path=require(_0x9202('0x9'));var sox=require(_0x9202('0xa'));var csv=require(_0x9202('0xb'));var ejs=require(_0x9202('0xc'));var fs=require('fs');var _=require(_0x9202('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9202('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9202('0xb'));var querystring=require(_0x9202('0xf'));var Papa=require('papaparse');var Redis=require(_0x9202('0x10'));var authService=require(_0x9202('0x11'));var qs=require(_0x9202('0x12'));var as=require(_0x9202('0x13'));var hardwareService=require(_0x9202('0x14'));var logger=require(_0x9202('0x15'))(_0x9202('0x16'));var utils=require(_0x9202('0x17'));var config=require(_0x9202('0x18'));var db=require(_0x9202('0x19'))['db'];var jayson=require(_0x9202('0x1a'));var client=jayson[_0x9202('0x1b')][_0x9202('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x946c29,_0x1890ac,_0x4093bc){if(_0x4093bc){var _0x152ef0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x152ef0['test'](_0x1890ac)){return _0x946c29;}else{throw new db[(_0x9202('0x1d'))][(_0x9202('0x1e'))](_0x9202('0x1f'));}}else{return _0x946c29;}}function respondWithRpcPromise(_0xb5ecc3,_0x24e938,_0x141a17,_0x1ca7a3){return new BPromise(function(_0x1bb4c1,_0x8c1319){var _0x420245=_0x1ca7a3||client;return _0x420245['request'](_0xb5ecc3,_0x141a17)[_0x9202('0x20')](function(_0x1c3243){logger[_0x9202('0x21')](_0x9202('0x22'),_0x24e938,_0x9202('0x23'));logger[_0x9202('0x24')](_0x9202('0x25'),_0x24e938,_0x9202('0x23'),JSON[_0x9202('0x26')](_0x1c3243));if(_0x1c3243['error']){if(_0x1c3243['error'][_0x9202('0x27')]===0x1f4){logger[_0x9202('0x28')](_0x9202('0x22'),_0x24e938,_0x1c3243[_0x9202('0x28')]['message']);return _0x8c1319(_0x1c3243[_0x9202('0x28')]['message']);}logger[_0x9202('0x28')](_0x9202('0x22'),_0x24e938,_0x1c3243['error'][_0x9202('0x29')]);return _0x1bb4c1(_0x1c3243['error'][_0x9202('0x29')]);}else{logger[_0x9202('0x21')](_0x9202('0x22'),_0x24e938,_0x9202('0x23'));_0x1bb4c1(_0x1c3243[_0x9202('0x2a')][_0x9202('0x29')]);}})[_0x9202('0x2b')](function(_0x47de09){logger[_0x9202('0x28')](_0x9202('0x22'),_0x24e938,_0x47de09);_0x8c1319(_0x47de09);});});}function respondWithStatusCode(_0x2dab50,_0x2f4988){_0x2f4988=_0x2f4988||0xcc;return function(_0x3e722a){if(_0x3e722a){return _0x2dab50[_0x9202('0x2c')](_0x2f4988);}return _0x2dab50['status'](_0x2f4988)[_0x9202('0x2d')]();};}function respondWithResult(_0x2484ef,_0x3ecfc6){_0x3ecfc6=_0x3ecfc6||0xc8;return function(_0x5082b6){if(_0x5082b6){return _0x2484ef['status'](_0x3ecfc6)['json'](_0x5082b6);}};}function respondWithFilteredResult(_0x2be839,_0x17d7e8){return function(_0x228092){if(_0x228092){var _0x5459a0=_0x228092[_0x9202('0x2e')],_0x195589=_0x17d7e8[_0x9202('0x2f')],_0x5e9ca2=_0x17d7e8[_0x9202('0x2f')]+_0x17d7e8[_0x9202('0x30')],_0x35186d;if(_0x5e9ca2>=_0x5459a0){_0x5e9ca2=_0x5459a0;_0x35186d=0xc8;}else{_0x35186d=0xce;}_0x2be839['status'](_0x35186d);return _0x2be839[_0x9202('0x31')]('Content-Range',_0x195589+'-'+_0x5e9ca2+'/'+_0x5459a0)[_0x9202('0x32')](_0x228092);}return null;};}function patchUpdates(_0x390f8f){return function(_0x5d92ff){try{jsonpatch['apply'](_0x5d92ff,_0x390f8f,!![]);}catch(_0x52a964){return BPromise[_0x9202('0x33')](_0x52a964);}return _0x5d92ff[_0x9202('0x34')]();};}function saveUpdates(_0x251254,_0x3766ce){return function(_0x4ff7a4){if(_0x4ff7a4){return _0x4ff7a4[_0x9202('0x35')](_0x251254)[_0x9202('0x20')](function(_0x15591f){return _0x15591f;});}return null;};}function removeEntity(_0x4e7c30,_0x2de068){return function(_0x2a1178){if(_0x2a1178){return _0x2a1178[_0x9202('0x36')]()[_0x9202('0x20')](function(){_0x4e7c30[_0x9202('0x37')](0xcc)[_0x9202('0x2d')]();});}};}function handleEntityNotFound(_0xa4564a,_0x46d641){return function(_0x1c3070){if(!_0x1c3070){_0xa4564a[_0x9202('0x2c')](0x194);}return _0x1c3070;};}function handleError(_0x26697a,_0x3f34ca){_0x3f34ca=_0x3f34ca||0x1f4;return function(_0x243a64){logger['error'](_0x243a64[_0x9202('0x38')]);if(_0x243a64[_0x9202('0x39')]){delete _0x243a64['name'];}_0x26697a[_0x9202('0x37')](_0x3f34ca)['send'](_0x243a64);};}exports[_0x9202('0x3a')]=function(_0x265220,_0x3308e4){var _0x3c4c1f={},_0xd688c6={},_0x538109={'count':0x0,'rows':[]};var _0x3c394b=_['map'](db[_0x9202('0x3b')][_0x9202('0x3c')],function(_0x844134){return{'name':_0x844134[_0x9202('0x3d')],'type':_0x844134['type']['key']};});_0xd688c6['model']=_[_0x9202('0x3e')](_0x3c394b,_0x9202('0x39'));_0xd688c6[_0x9202('0x3f')]=_[_0x9202('0x40')](_0x265220[_0x9202('0x3f')]);_0xd688c6['filters']=_[_0x9202('0x41')](_0xd688c6[_0x9202('0x42')],_0xd688c6[_0x9202('0x3f')]);_0x3c4c1f[_0x9202('0x43')]=_[_0x9202('0x41')](_0xd688c6['model'],qs[_0x9202('0x44')](_0x265220[_0x9202('0x3f')][_0x9202('0x44')]));_0x3c4c1f[_0x9202('0x43')]=_0x3c4c1f[_0x9202('0x43')][_0x9202('0x45')]?_0x3c4c1f['attributes']:_0xd688c6[_0x9202('0x42')];if(!_0x265220[_0x9202('0x3f')][_0x9202('0x46')](_0x9202('0x47'))){_0x3c4c1f[_0x9202('0x30')]=qs['limit'](_0x265220[_0x9202('0x3f')][_0x9202('0x30')]);_0x3c4c1f[_0x9202('0x2f')]=qs[_0x9202('0x2f')](_0x265220['query'][_0x9202('0x2f')]);}_0x3c4c1f['order']=qs[_0x9202('0x48')](_0x265220[_0x9202('0x3f')]['sort']);_0x3c4c1f['where']=qs[_0x9202('0x49')](_['pick'](_0x265220[_0x9202('0x3f')],_0xd688c6[_0x9202('0x49')]),_0x3c394b);if(_0x265220[_0x9202('0x3f')][_0x9202('0x4a')]){_0x3c4c1f[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x3c4c1f['where'],{'$or':_[_0x9202('0x3e')](_0x3c394b,function(_0x2336ac){if(_0x2336ac[_0x9202('0x4d')]!==_0x9202('0x4e')){var _0x4e841e={};_0x4e841e[_0x2336ac['name']]={'$like':'%'+_0x265220[_0x9202('0x3f')][_0x9202('0x4a')]+'%'};return _0x4e841e;}})});}_0x3c4c1f=_[_0x9202('0x4c')]({},_0x3c4c1f,_0x265220['options']);var _0x5edc12={'where':_0x3c4c1f['where']};return db[_0x9202('0x3b')][_0x9202('0x2e')](_0x5edc12)[_0x9202('0x20')](function(_0x171017){_0x538109[_0x9202('0x2e')]=_0x171017;if(_0x265220[_0x9202('0x3f')]['includeAll']){_0x3c4c1f['include']=[{'all':!![]}];}return db[_0x9202('0x3b')][_0x9202('0x4f')](_0x3c4c1f);})[_0x9202('0x20')](function(_0x20d10e){_0x538109['rows']=_0x20d10e;return _0x538109;})['then'](respondWithFilteredResult(_0x3308e4,_0x3c4c1f))['catch'](handleError(_0x3308e4,null));};exports[_0x9202('0x50')]=function(_0x411c3a,_0x4b9d05){var _0x2b12a7={'raw':![],'where':{'id':_0x411c3a[_0x9202('0x51')]['id']}},_0xa8e09e={};_0xa8e09e[_0x9202('0x42')]=_[_0x9202('0x40')](db[_0x9202('0x3b')][_0x9202('0x3c')]);_0xa8e09e['query']=_[_0x9202('0x40')](_0x411c3a[_0x9202('0x3f')]);_0xa8e09e[_0x9202('0x49')]=_['intersection'](_0xa8e09e[_0x9202('0x42')],_0xa8e09e[_0x9202('0x3f')]);_0x2b12a7[_0x9202('0x43')]=_[_0x9202('0x41')](_0xa8e09e['model'],qs[_0x9202('0x44')](_0x411c3a['query'][_0x9202('0x44')]));_0x2b12a7[_0x9202('0x43')]=_0x2b12a7[_0x9202('0x43')][_0x9202('0x45')]?_0x2b12a7[_0x9202('0x43')]:_0xa8e09e[_0x9202('0x42')];if(_0x411c3a[_0x9202('0x3f')][_0x9202('0x52')]){_0x2b12a7[_0x9202('0x53')]=[{'all':!![]}];}_0x2b12a7=_[_0x9202('0x4c')]({},_0x2b12a7,_0x411c3a[_0x9202('0x54')]);return db[_0x9202('0x3b')][_0x9202('0x55')](_0x2b12a7)[_0x9202('0x20')](handleEntityNotFound(_0x4b9d05,null))[_0x9202('0x20')](respondWithResult(_0x4b9d05,null))[_0x9202('0x2b')](handleError(_0x4b9d05,null));};exports[_0x9202('0x56')]=function(_0x5cbe49,_0x5e072c){return db[_0x9202('0x3b')]['create'](_0x5cbe49['body'],{})[_0x9202('0x20')](respondWithResult(_0x5e072c,0xc9))[_0x9202('0x2b')](handleError(_0x5e072c,null));};exports[_0x9202('0x35')]=function(_0xd02f28,_0x4adf29){if(_0xd02f28[_0x9202('0x57')]['id']){delete _0xd02f28[_0x9202('0x57')]['id'];}return db[_0x9202('0x3b')][_0x9202('0x55')]({'where':{'id':_0xd02f28[_0x9202('0x51')]['id']}})['then'](handleEntityNotFound(_0x4adf29,null))[_0x9202('0x20')](saveUpdates(_0xd02f28[_0x9202('0x57')],null))[_0x9202('0x20')](respondWithResult(_0x4adf29,null))[_0x9202('0x2b')](handleError(_0x4adf29,null));};exports['destroy']=function(_0x15c753,_0x5babf6){return db[_0x9202('0x3b')][_0x9202('0x55')]({'where':{'id':_0x15c753[_0x9202('0x51')]['id']}})['then'](handleEntityNotFound(_0x5babf6,null))[_0x9202('0x20')](removeEntity(_0x5babf6,null))[_0x9202('0x2b')](handleError(_0x5babf6,null));};exports[_0x9202('0x58')]=function(_0x3a9a34,_0x5b68bf,_0x48ada5){var _0x295d41={};var _0x301c80={};var _0x126357;var _0x6e1b88;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x3a9a34['params']['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x5b68bf,null))[_0x9202('0x20')](function(_0x5689cf){if(_0x5689cf){_0x126357=_0x5689cf;_0x301c80[_0x9202('0x42')]=_[_0x9202('0x40')](db['DeskField']['rawAttributes']);_0x301c80[_0x9202('0x3f')]=_['keys'](_0x3a9a34['query']);_0x301c80[_0x9202('0x49')]=_[_0x9202('0x41')](_0x301c80[_0x9202('0x42')],_0x301c80[_0x9202('0x3f')]);_0x295d41[_0x9202('0x43')]=_[_0x9202('0x41')](_0x301c80[_0x9202('0x42')],qs[_0x9202('0x44')](_0x3a9a34[_0x9202('0x3f')][_0x9202('0x44')]));_0x295d41[_0x9202('0x43')]=_0x295d41[_0x9202('0x43')][_0x9202('0x45')]?_0x295d41[_0x9202('0x43')]:_0x301c80[_0x9202('0x42')];_0x295d41[_0x9202('0x5a')]=qs[_0x9202('0x48')](_0x3a9a34[_0x9202('0x3f')]['sort']);_0x295d41[_0x9202('0x4b')]=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x3a9a34[_0x9202('0x3f')],_0x301c80[_0x9202('0x49')]));if(_0x3a9a34['query'][_0x9202('0x4a')]){_0x295d41[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x295d41[_0x9202('0x4b')],{'$or':_['map'](_0x295d41[_0x9202('0x43')],function(_0x5822d9){var _0x2f0e69={};_0x2f0e69[_0x5822d9]={'$like':'%'+_0x3a9a34[_0x9202('0x3f')]['filter']+'%'};return _0x2f0e69;})});}_0x295d41=_[_0x9202('0x4c')]({},_0x295d41,_0x3a9a34[_0x9202('0x54')]);return _0x126357['getFields'](_0x295d41);}})[_0x9202('0x20')](function(_0x12b935){if(_0x12b935){_0x6e1b88=_0x12b935[_0x9202('0x45')];if(!_0x3a9a34[_0x9202('0x3f')][_0x9202('0x46')](_0x9202('0x47'))){_0x295d41[_0x9202('0x30')]=qs[_0x9202('0x30')](_0x3a9a34['query']['limit']);_0x295d41[_0x9202('0x2f')]=qs[_0x9202('0x2f')](_0x3a9a34[_0x9202('0x3f')][_0x9202('0x2f')]);}return _0x126357[_0x9202('0x58')](_0x295d41);}})[_0x9202('0x20')](function(_0x44d876){if(_0x44d876){return _0x44d876?{'count':_0x6e1b88,'rows':_0x44d876}:null;}})['then'](respondWithResult(_0x5b68bf,null))[_0x9202('0x2b')](handleError(_0x5b68bf,null));};exports[_0x9202('0x5c')]=function(_0x3bca3b,_0x562719,_0x3edf89){var _0x393bfa={};var _0x1ab82f={};var _0x5f5259;var _0x248123;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x3bca3b['params']['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x562719,null))[_0x9202('0x20')](function(_0x588b45){if(_0x588b45){_0x5f5259=_0x588b45;_0x1ab82f[_0x9202('0x42')]=_[_0x9202('0x40')](db[_0x9202('0x5d')][_0x9202('0x3c')]);_0x1ab82f[_0x9202('0x3f')]=_['keys'](_0x3bca3b[_0x9202('0x3f')]);_0x1ab82f[_0x9202('0x49')]=_[_0x9202('0x41')](_0x1ab82f[_0x9202('0x42')],_0x1ab82f[_0x9202('0x3f')]);_0x393bfa[_0x9202('0x43')]=_[_0x9202('0x41')](_0x1ab82f[_0x9202('0x42')],qs[_0x9202('0x44')](_0x3bca3b['query']['fields']));_0x393bfa[_0x9202('0x43')]=_0x393bfa['attributes'][_0x9202('0x45')]?_0x393bfa[_0x9202('0x43')]:_0x1ab82f[_0x9202('0x42')];_0x393bfa['order']=qs[_0x9202('0x48')](_0x3bca3b[_0x9202('0x3f')][_0x9202('0x48')]);_0x393bfa['where']=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x3bca3b[_0x9202('0x3f')],_0x1ab82f[_0x9202('0x49')]));if(_0x3bca3b[_0x9202('0x3f')]['filter']){_0x393bfa[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x393bfa[_0x9202('0x4b')],{'$or':_[_0x9202('0x3e')](_0x393bfa[_0x9202('0x43')],function(_0x520dc9){var _0x151838={};_0x151838[_0x520dc9]={'$like':'%'+_0x3bca3b[_0x9202('0x3f')]['filter']+'%'};return _0x151838;})});}_0x393bfa=_[_0x9202('0x4c')]({},_0x393bfa,_0x3bca3b[_0x9202('0x54')]);return _0x5f5259[_0x9202('0x5c')](_0x393bfa);}})[_0x9202('0x20')](function(_0x3a5f6f){if(_0x3a5f6f){_0x248123=_0x3a5f6f[_0x9202('0x45')];if(!_0x3bca3b[_0x9202('0x3f')][_0x9202('0x46')](_0x9202('0x47'))){_0x393bfa[_0x9202('0x30')]=qs[_0x9202('0x30')](_0x3bca3b[_0x9202('0x3f')][_0x9202('0x30')]);_0x393bfa[_0x9202('0x2f')]=qs[_0x9202('0x2f')](_0x3bca3b['query'][_0x9202('0x2f')]);}return _0x5f5259[_0x9202('0x5c')](_0x393bfa);}})[_0x9202('0x20')](function(_0x19d53c){if(_0x19d53c){return _0x19d53c?{'count':_0x248123,'rows':_0x19d53c}:null;}})[_0x9202('0x20')](respondWithResult(_0x562719,null))['catch'](handleError(_0x562719,null));};exports[_0x9202('0x5e')]=function(_0x1163ee,_0x261d84,_0x256bcb){var _0x1c31a1={};var _0x4f6273={};var _0x170dff;var _0x174a61;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x1163ee[_0x9202('0x51')]['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x261d84,null))['then'](function(_0x2dc7f8){if(_0x2dc7f8){_0x170dff=_0x2dc7f8;_0x4f6273['model']=_['keys'](db[_0x9202('0x5d')][_0x9202('0x3c')]);_0x4f6273['query']=_[_0x9202('0x40')](_0x1163ee[_0x9202('0x3f')]);_0x4f6273[_0x9202('0x49')]=_['intersection'](_0x4f6273[_0x9202('0x42')],_0x4f6273[_0x9202('0x3f')]);_0x1c31a1['attributes']=_[_0x9202('0x41')](_0x4f6273[_0x9202('0x42')],qs[_0x9202('0x44')](_0x1163ee[_0x9202('0x3f')][_0x9202('0x44')]));_0x1c31a1[_0x9202('0x43')]=_0x1c31a1[_0x9202('0x43')][_0x9202('0x45')]?_0x1c31a1['attributes']:_0x4f6273[_0x9202('0x42')];_0x1c31a1[_0x9202('0x5a')]=qs[_0x9202('0x48')](_0x1163ee[_0x9202('0x3f')][_0x9202('0x48')]);_0x1c31a1[_0x9202('0x4b')]=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x1163ee[_0x9202('0x3f')],_0x4f6273[_0x9202('0x49')]));if(_0x1163ee[_0x9202('0x3f')][_0x9202('0x4a')]){_0x1c31a1[_0x9202('0x4b')]=_['merge'](_0x1c31a1['where'],{'$or':_[_0x9202('0x3e')](_0x1c31a1[_0x9202('0x43')],function(_0x5e5022){var _0x51a71a={};_0x51a71a[_0x5e5022]={'$like':'%'+_0x1163ee[_0x9202('0x3f')][_0x9202('0x4a')]+'%'};return _0x51a71a;})});}_0x1c31a1=_['merge']({},_0x1c31a1,_0x1163ee['options']);return _0x170dff['getDescriptions'](_0x1c31a1);}})[_0x9202('0x20')](function(_0x532b62){if(_0x532b62){_0x174a61=_0x532b62['length'];if(!_0x1163ee['query'][_0x9202('0x46')](_0x9202('0x47'))){_0x1c31a1[_0x9202('0x30')]=qs[_0x9202('0x30')](_0x1163ee['query'][_0x9202('0x30')]);_0x1c31a1[_0x9202('0x2f')]=qs['offset'](_0x1163ee['query'][_0x9202('0x2f')]);}return _0x170dff[_0x9202('0x5e')](_0x1c31a1);}})['then'](function(_0x2ce334){if(_0x2ce334){return _0x2ce334?{'count':_0x174a61,'rows':_0x2ce334}:null;}})['then'](respondWithResult(_0x261d84,null))[_0x9202('0x2b')](handleError(_0x261d84,null));};exports[_0x9202('0x5f')]=function(_0x21eb5e,_0x13c520,_0x5b9d7d){var _0x147b39={};var _0x4c0651={};var _0x4bc960;var _0x840677;return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x21eb5e[_0x9202('0x51')]['id']}})['then'](handleEntityNotFound(_0x13c520,null))[_0x9202('0x20')](function(_0x126651){if(_0x126651){_0x4bc960=_0x126651;_0x4c0651[_0x9202('0x42')]=_[_0x9202('0x40')](db[_0x9202('0x60')]['rawAttributes']);_0x4c0651[_0x9202('0x3f')]=_['keys'](_0x21eb5e['query']);_0x4c0651[_0x9202('0x49')]=_[_0x9202('0x41')](_0x4c0651[_0x9202('0x42')],_0x4c0651[_0x9202('0x3f')]);_0x147b39[_0x9202('0x43')]=_[_0x9202('0x41')](_0x4c0651[_0x9202('0x42')],qs[_0x9202('0x44')](_0x21eb5e['query'][_0x9202('0x44')]));_0x147b39[_0x9202('0x43')]=_0x147b39['attributes'][_0x9202('0x45')]?_0x147b39['attributes']:_0x4c0651[_0x9202('0x42')];_0x147b39['order']=qs[_0x9202('0x48')](_0x21eb5e[_0x9202('0x3f')][_0x9202('0x48')]);_0x147b39[_0x9202('0x4b')]=qs[_0x9202('0x49')](_[_0x9202('0x5b')](_0x21eb5e[_0x9202('0x3f')],_0x4c0651['filters']));if(_0x21eb5e[_0x9202('0x3f')]['filter']){_0x147b39[_0x9202('0x4b')]=_[_0x9202('0x4c')](_0x147b39[_0x9202('0x4b')],{'$or':_['map'](_0x147b39[_0x9202('0x43')],function(_0x1ccfc6){var _0x58ac24={};_0x58ac24[_0x1ccfc6]={'$like':'%'+_0x21eb5e[_0x9202('0x3f')][_0x9202('0x4a')]+'%'};return _0x58ac24;})});}_0x147b39=_[_0x9202('0x4c')]({},_0x147b39,_0x21eb5e['options']);return _0x4bc960['getTags'](_0x147b39);}})['then'](function(_0xb299ac){if(_0xb299ac){_0x840677=_0xb299ac[_0x9202('0x45')];if(!_0x21eb5e[_0x9202('0x3f')][_0x9202('0x46')]('nolimit')){_0x147b39['limit']=qs['limit'](_0x21eb5e[_0x9202('0x3f')][_0x9202('0x30')]);_0x147b39['offset']=qs[_0x9202('0x2f')](_0x21eb5e[_0x9202('0x3f')]['offset']);}return _0x4bc960[_0x9202('0x5f')](_0x147b39);}})[_0x9202('0x20')](function(_0x42c6b8){if(_0x42c6b8){return _0x42c6b8?{'count':_0x840677,'rows':_0x42c6b8}:null;}})[_0x9202('0x20')](respondWithResult(_0x13c520,null))[_0x9202('0x2b')](handleError(_0x13c520,null));};exports[_0x9202('0x61')]=function(_0x317071,_0x39fd5c,_0x5197ec){if(_0x317071[_0x9202('0x57')]['id']){delete _0x317071[_0x9202('0x57')]['id'];}return db[_0x9202('0x3b')][_0x9202('0x59')]({'where':{'id':_0x317071[_0x9202('0x51')]['id']}})[_0x9202('0x20')](handleEntityNotFound(_0x39fd5c,null))[_0x9202('0x20')](function(_0x482e80){if(_0x482e80){return _0x482e80[_0x9202('0x61')](_0x317071[_0x9202('0x57')]['ids']||[]);}return null;})[_0x9202('0x20')](respondWithResult(_0x39fd5c,null))[_0x9202('0x2b')](handleError(_0x39fd5c,null));}; \ No newline at end of file +var _0xa854=['message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','create','body','find','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x5330b7,_0xd242d4){var _0x520a2e=function(_0x10fbc8){while(--_0x10fbc8){_0x5330b7['push'](_0x5330b7['shift']());}};_0x520a2e(++_0xd242d4);}(_0xa854,0x103));var _0x4a85=function(_0x38429d,_0x47f999){_0x38429d=_0x38429d-0x0;var _0x376053=_0xa854[_0x38429d];return _0x376053;};'use strict';var pdf=require(_0x4a85('0x0'));var emlformat=require(_0x4a85('0x1'));var rimraf=require(_0x4a85('0x2'));var zipdir=require(_0x4a85('0x3'));var jsonpatch=require(_0x4a85('0x4'));var rp=require('request-promise');var moment=require(_0x4a85('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4a85('0x6'));var util=require('util');var path=require(_0x4a85('0x7'));var sox=require(_0x4a85('0x8'));var csv=require('to-csv');var ejs=require(_0x4a85('0x9'));var fs=require('fs');var _=require(_0x4a85('0xa'));var squel=require('squel');var crypto=require(_0x4a85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4a85('0xc'));var toCsv=require(_0x4a85('0xd'));var querystring=require(_0x4a85('0xe'));var Papa=require(_0x4a85('0xf'));var Redis=require(_0x4a85('0x10'));var authService=require(_0x4a85('0x11'));var qs=require(_0x4a85('0x12'));var as=require(_0x4a85('0x13'));var hardwareService=require(_0x4a85('0x14'));var logger=require('../../config/logger')(_0x4a85('0x15'));var utils=require(_0x4a85('0x16'));var config=require(_0x4a85('0x17'));var db=require(_0x4a85('0x18'))['db'];var jayson=require(_0x4a85('0x19'));var client=jayson[_0x4a85('0x1a')][_0x4a85('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x42088d,_0x32d2c1,_0x5e8b82){if(_0x5e8b82){var _0x35e857=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35e857[_0x4a85('0x1c')](_0x32d2c1)){return _0x42088d;}else{throw new db[(_0x4a85('0x1d'))][(_0x4a85('0x1e'))](_0x4a85('0x1f'));}}else{return _0x42088d;}}function respondWithRpcPromise(_0x1249d2,_0x34743a,_0x256a3c,_0x1922cb){return new BPromise(function(_0x397f4a,_0x6f362b){var _0x52504e=_0x1922cb||client;return _0x52504e[_0x4a85('0x20')](_0x1249d2,_0x256a3c)[_0x4a85('0x21')](function(_0x5c9b9f){logger[_0x4a85('0x22')](_0x4a85('0x23'),_0x34743a,_0x4a85('0x24'));logger['debug'](_0x4a85('0x25'),_0x34743a,_0x4a85('0x24'),JSON[_0x4a85('0x26')](_0x5c9b9f));if(_0x5c9b9f['error']){if(_0x5c9b9f['error'][_0x4a85('0x27')]===0x1f4){logger[_0x4a85('0x28')](_0x4a85('0x23'),_0x34743a,_0x5c9b9f[_0x4a85('0x28')][_0x4a85('0x29')]);return _0x6f362b(_0x5c9b9f[_0x4a85('0x28')][_0x4a85('0x29')]);}logger[_0x4a85('0x28')]('DeskConfiguration,\x20%s,\x20%s',_0x34743a,_0x5c9b9f['error']['message']);return _0x397f4a(_0x5c9b9f[_0x4a85('0x28')][_0x4a85('0x29')]);}else{logger[_0x4a85('0x22')](_0x4a85('0x23'),_0x34743a,'request\x20sent');_0x397f4a(_0x5c9b9f[_0x4a85('0x2a')][_0x4a85('0x29')]);}})[_0x4a85('0x2b')](function(_0x3f3894){logger[_0x4a85('0x28')]('DeskConfiguration,\x20%s,\x20%s',_0x34743a,_0x3f3894);_0x6f362b(_0x3f3894);});});}function respondWithStatusCode(_0x1075e2,_0x1a9a8c){_0x1a9a8c=_0x1a9a8c||0xcc;return function(_0x1b3f6b){if(_0x1b3f6b){return _0x1075e2[_0x4a85('0x2c')](_0x1a9a8c);}return _0x1075e2[_0x4a85('0x2d')](_0x1a9a8c)[_0x4a85('0x2e')]();};}function respondWithResult(_0x4a34d5,_0x462656){_0x462656=_0x462656||0xc8;return function(_0x343dfe){if(_0x343dfe){return _0x4a34d5[_0x4a85('0x2d')](_0x462656)['json'](_0x343dfe);}};}function respondWithFilteredResult(_0x20246b,_0x51d51d){return function(_0x470803){if(_0x470803){var _0x1b91ec=_0x470803[_0x4a85('0x2f')],_0x264515=_0x51d51d[_0x4a85('0x30')],_0x3ade10=_0x51d51d[_0x4a85('0x30')]+_0x51d51d['limit'],_0x4596c6;if(_0x3ade10>=_0x1b91ec){_0x3ade10=_0x1b91ec;_0x4596c6=0xc8;}else{_0x4596c6=0xce;}_0x20246b[_0x4a85('0x2d')](_0x4596c6);return _0x20246b['set'](_0x4a85('0x31'),_0x264515+'-'+_0x3ade10+'/'+_0x1b91ec)[_0x4a85('0x32')](_0x470803);}return null;};}function patchUpdates(_0x4fee4f){return function(_0xb42819){try{jsonpatch[_0x4a85('0x33')](_0xb42819,_0x4fee4f,!![]);}catch(_0x2ac470){return BPromise[_0x4a85('0x34')](_0x2ac470);}return _0xb42819[_0x4a85('0x35')]();};}function saveUpdates(_0x181dfa,_0x16a1b5){return function(_0x3af5e7){if(_0x3af5e7){return _0x3af5e7[_0x4a85('0x36')](_0x181dfa)[_0x4a85('0x21')](function(_0x327a1c){return _0x327a1c;});}return null;};}function removeEntity(_0x3612e7,_0x5326a8){return function(_0x3e6e50){if(_0x3e6e50){return _0x3e6e50[_0x4a85('0x37')]()[_0x4a85('0x21')](function(){_0x3612e7[_0x4a85('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x825687,_0x5c838d){return function(_0x474e95){if(!_0x474e95){_0x825687[_0x4a85('0x2c')](0x194);}return _0x474e95;};}function handleError(_0x3441af,_0x41827f){_0x41827f=_0x41827f||0x1f4;return function(_0x46fcb5){logger['error'](_0x46fcb5[_0x4a85('0x38')]);if(_0x46fcb5[_0x4a85('0x39')]){delete _0x46fcb5['name'];}_0x3441af[_0x4a85('0x2d')](_0x41827f)[_0x4a85('0x3a')](_0x46fcb5);};}exports[_0x4a85('0x3b')]=function(_0x5ca719,_0x2d15f7){var _0x2eddef={},_0x3672ff={},_0x3d716c={'count':0x0,'rows':[]};var _0x1e55cf=_[_0x4a85('0x3c')](db[_0x4a85('0x3d')][_0x4a85('0x3e')],function(_0x7d6302){return{'name':_0x7d6302['fieldName'],'type':_0x7d6302[_0x4a85('0x3f')][_0x4a85('0x40')]};});_0x3672ff[_0x4a85('0x41')]=_['map'](_0x1e55cf,_0x4a85('0x39'));_0x3672ff['query']=_[_0x4a85('0x42')](_0x5ca719[_0x4a85('0x43')]);_0x3672ff['filters']=_[_0x4a85('0x44')](_0x3672ff[_0x4a85('0x41')],_0x3672ff[_0x4a85('0x43')]);_0x2eddef['attributes']=_['intersection'](_0x3672ff[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x5ca719['query']['fields']));_0x2eddef['attributes']=_0x2eddef[_0x4a85('0x46')][_0x4a85('0x47')]?_0x2eddef['attributes']:_0x3672ff['model'];if(!_0x5ca719[_0x4a85('0x43')][_0x4a85('0x48')](_0x4a85('0x49'))){_0x2eddef[_0x4a85('0x4a')]=qs[_0x4a85('0x4a')](_0x5ca719[_0x4a85('0x43')][_0x4a85('0x4a')]);_0x2eddef[_0x4a85('0x30')]=qs['offset'](_0x5ca719['query'][_0x4a85('0x30')]);}_0x2eddef['order']=qs['sort'](_0x5ca719[_0x4a85('0x43')][_0x4a85('0x4b')]);_0x2eddef[_0x4a85('0x4c')]=qs[_0x4a85('0x4d')](_[_0x4a85('0x4e')](_0x5ca719[_0x4a85('0x43')],_0x3672ff[_0x4a85('0x4d')]),_0x1e55cf);if(_0x5ca719[_0x4a85('0x43')]['filter']){_0x2eddef['where']=_[_0x4a85('0x4f')](_0x2eddef[_0x4a85('0x4c')],{'$or':_[_0x4a85('0x3c')](_0x1e55cf,function(_0x320d3f){if(_0x320d3f[_0x4a85('0x3f')]!=='VIRTUAL'){var _0x488a21={};_0x488a21[_0x320d3f[_0x4a85('0x39')]]={'$like':'%'+_0x5ca719[_0x4a85('0x43')][_0x4a85('0x50')]+'%'};return _0x488a21;}})});}_0x2eddef=_[_0x4a85('0x4f')]({},_0x2eddef,_0x5ca719[_0x4a85('0x51')]);var _0x4248fe={'where':_0x2eddef[_0x4a85('0x4c')]};return db[_0x4a85('0x3d')][_0x4a85('0x2f')](_0x4248fe)[_0x4a85('0x21')](function(_0x20e24c){_0x3d716c[_0x4a85('0x2f')]=_0x20e24c;if(_0x5ca719[_0x4a85('0x43')]['includeAll']){_0x2eddef[_0x4a85('0x52')]=[{'all':!![]}];}return db[_0x4a85('0x3d')][_0x4a85('0x53')](_0x2eddef);})['then'](function(_0x1b330a){_0x3d716c[_0x4a85('0x54')]=_0x1b330a;return _0x3d716c;})['then'](respondWithFilteredResult(_0x2d15f7,_0x2eddef))[_0x4a85('0x2b')](handleError(_0x2d15f7,null));};exports[_0x4a85('0x55')]=function(_0x4c8154,_0x5cfa99){var _0x10b0e1={'raw':![],'where':{'id':_0x4c8154[_0x4a85('0x56')]['id']}},_0x5724fb={};_0x5724fb[_0x4a85('0x41')]=_[_0x4a85('0x42')](db[_0x4a85('0x3d')][_0x4a85('0x3e')]);_0x5724fb[_0x4a85('0x43')]=_['keys'](_0x4c8154['query']);_0x5724fb[_0x4a85('0x4d')]=_[_0x4a85('0x44')](_0x5724fb[_0x4a85('0x41')],_0x5724fb[_0x4a85('0x43')]);_0x10b0e1[_0x4a85('0x46')]=_[_0x4a85('0x44')](_0x5724fb[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x4c8154[_0x4a85('0x43')][_0x4a85('0x45')]));_0x10b0e1[_0x4a85('0x46')]=_0x10b0e1[_0x4a85('0x46')][_0x4a85('0x47')]?_0x10b0e1[_0x4a85('0x46')]:_0x5724fb['model'];if(_0x4c8154[_0x4a85('0x43')][_0x4a85('0x57')]){_0x10b0e1['include']=[{'all':!![]}];}_0x10b0e1=_['merge']({},_0x10b0e1,_0x4c8154[_0x4a85('0x51')]);return db[_0x4a85('0x3d')]['find'](_0x10b0e1)[_0x4a85('0x21')](handleEntityNotFound(_0x5cfa99,null))[_0x4a85('0x21')](respondWithResult(_0x5cfa99,null))['catch'](handleError(_0x5cfa99,null));};exports[_0x4a85('0x58')]=function(_0x5d5db3,_0x3578bd){return db[_0x4a85('0x3d')][_0x4a85('0x58')](_0x5d5db3[_0x4a85('0x59')],{})[_0x4a85('0x21')](respondWithResult(_0x3578bd,0xc9))[_0x4a85('0x2b')](handleError(_0x3578bd,null));};exports[_0x4a85('0x36')]=function(_0x35cc3c,_0x1363d4){if(_0x35cc3c['body']['id']){delete _0x35cc3c[_0x4a85('0x59')]['id'];}return db[_0x4a85('0x3d')][_0x4a85('0x5a')]({'where':{'id':_0x35cc3c[_0x4a85('0x56')]['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x1363d4,null))['then'](saveUpdates(_0x35cc3c[_0x4a85('0x59')],null))['then'](respondWithResult(_0x1363d4,null))[_0x4a85('0x2b')](handleError(_0x1363d4,null));};exports[_0x4a85('0x37')]=function(_0x37d9e0,_0x4a5dcb){return db[_0x4a85('0x3d')][_0x4a85('0x5a')]({'where':{'id':_0x37d9e0[_0x4a85('0x56')]['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x4a5dcb,null))[_0x4a85('0x21')](removeEntity(_0x4a5dcb,null))[_0x4a85('0x2b')](handleError(_0x4a5dcb,null));};exports['getFields']=function(_0x4cfb30,_0x83b49e,_0x183020){var _0x16fd6e={};var _0x2af2a0={};var _0x24126a;var _0x47f640;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x4cfb30[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x83b49e,null))['then'](function(_0x430114){if(_0x430114){_0x24126a=_0x430114;_0x2af2a0[_0x4a85('0x41')]=_[_0x4a85('0x42')](db[_0x4a85('0x5c')][_0x4a85('0x3e')]);_0x2af2a0[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0x4cfb30[_0x4a85('0x43')]);_0x2af2a0['filters']=_[_0x4a85('0x44')](_0x2af2a0[_0x4a85('0x41')],_0x2af2a0['query']);_0x16fd6e['attributes']=_[_0x4a85('0x44')](_0x2af2a0[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x4cfb30['query'][_0x4a85('0x45')]));_0x16fd6e[_0x4a85('0x46')]=_0x16fd6e[_0x4a85('0x46')][_0x4a85('0x47')]?_0x16fd6e[_0x4a85('0x46')]:_0x2af2a0[_0x4a85('0x41')];_0x16fd6e[_0x4a85('0x5d')]=qs[_0x4a85('0x4b')](_0x4cfb30[_0x4a85('0x43')]['sort']);_0x16fd6e[_0x4a85('0x4c')]=qs[_0x4a85('0x4d')](_['pick'](_0x4cfb30[_0x4a85('0x43')],_0x2af2a0[_0x4a85('0x4d')]));if(_0x4cfb30[_0x4a85('0x43')]['filter']){_0x16fd6e['where']=_[_0x4a85('0x4f')](_0x16fd6e[_0x4a85('0x4c')],{'$or':_[_0x4a85('0x3c')](_0x16fd6e[_0x4a85('0x46')],function(_0x2e3471){var _0x5523df={};_0x5523df[_0x2e3471]={'$like':'%'+_0x4cfb30['query']['filter']+'%'};return _0x5523df;})});}_0x16fd6e=_[_0x4a85('0x4f')]({},_0x16fd6e,_0x4cfb30[_0x4a85('0x51')]);return _0x24126a[_0x4a85('0x5e')](_0x16fd6e);}})[_0x4a85('0x21')](function(_0x156472){if(_0x156472){_0x47f640=_0x156472['length'];if(!_0x4cfb30[_0x4a85('0x43')][_0x4a85('0x48')](_0x4a85('0x49'))){_0x16fd6e['limit']=qs[_0x4a85('0x4a')](_0x4cfb30[_0x4a85('0x43')]['limit']);_0x16fd6e[_0x4a85('0x30')]=qs['offset'](_0x4cfb30[_0x4a85('0x43')][_0x4a85('0x30')]);}return _0x24126a[_0x4a85('0x5e')](_0x16fd6e);}})[_0x4a85('0x21')](function(_0x107cb1){if(_0x107cb1){return _0x107cb1?{'count':_0x47f640,'rows':_0x107cb1}:null;}})[_0x4a85('0x21')](respondWithResult(_0x83b49e,null))[_0x4a85('0x2b')](handleError(_0x83b49e,null));};exports[_0x4a85('0x5f')]=function(_0x56b9f3,_0x293ecf,_0x22da45){var _0x381209={};var _0x405bbb={};var _0x501b76;var _0x728ced;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x56b9f3[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x293ecf,null))[_0x4a85('0x21')](function(_0x18412e){if(_0x18412e){_0x501b76=_0x18412e;_0x405bbb[_0x4a85('0x41')]=_[_0x4a85('0x42')](db[_0x4a85('0x5c')]['rawAttributes']);_0x405bbb[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0x56b9f3[_0x4a85('0x43')]);_0x405bbb[_0x4a85('0x4d')]=_[_0x4a85('0x44')](_0x405bbb['model'],_0x405bbb[_0x4a85('0x43')]);_0x381209[_0x4a85('0x46')]=_[_0x4a85('0x44')](_0x405bbb[_0x4a85('0x41')],qs['fields'](_0x56b9f3['query'][_0x4a85('0x45')]));_0x381209[_0x4a85('0x46')]=_0x381209['attributes']['length']?_0x381209[_0x4a85('0x46')]:_0x405bbb[_0x4a85('0x41')];_0x381209[_0x4a85('0x5d')]=qs[_0x4a85('0x4b')](_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x4b')]);_0x381209[_0x4a85('0x4c')]=qs['filters'](_[_0x4a85('0x4e')](_0x56b9f3[_0x4a85('0x43')],_0x405bbb[_0x4a85('0x4d')]));if(_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x50')]){_0x381209[_0x4a85('0x4c')]=_[_0x4a85('0x4f')](_0x381209['where'],{'$or':_[_0x4a85('0x3c')](_0x381209[_0x4a85('0x46')],function(_0x4b668a){var _0x283dd2={};_0x283dd2[_0x4b668a]={'$like':'%'+_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x50')]+'%'};return _0x283dd2;})});}_0x381209=_[_0x4a85('0x4f')]({},_0x381209,_0x56b9f3[_0x4a85('0x51')]);return _0x501b76[_0x4a85('0x5f')](_0x381209);}})[_0x4a85('0x21')](function(_0x526cac){if(_0x526cac){_0x728ced=_0x526cac[_0x4a85('0x47')];if(!_0x56b9f3['query'][_0x4a85('0x48')]('nolimit')){_0x381209[_0x4a85('0x4a')]=qs[_0x4a85('0x4a')](_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x4a')]);_0x381209[_0x4a85('0x30')]=qs[_0x4a85('0x30')](_0x56b9f3[_0x4a85('0x43')][_0x4a85('0x30')]);}return _0x501b76[_0x4a85('0x5f')](_0x381209);}})[_0x4a85('0x21')](function(_0x49e5a0){if(_0x49e5a0){return _0x49e5a0?{'count':_0x728ced,'rows':_0x49e5a0}:null;}})['then'](respondWithResult(_0x293ecf,null))[_0x4a85('0x2b')](handleError(_0x293ecf,null));};exports[_0x4a85('0x60')]=function(_0x4e8e9d,_0x27988e,_0x4eed){var _0x3f2296={};var _0x3c18f1={};var _0x36756e;var _0x52ac4a;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x4e8e9d['params']['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x27988e,null))[_0x4a85('0x21')](function(_0x1450c9){if(_0x1450c9){_0x36756e=_0x1450c9;_0x3c18f1['model']=_[_0x4a85('0x42')](db[_0x4a85('0x5c')][_0x4a85('0x3e')]);_0x3c18f1[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0x4e8e9d[_0x4a85('0x43')]);_0x3c18f1[_0x4a85('0x4d')]=_[_0x4a85('0x44')](_0x3c18f1[_0x4a85('0x41')],_0x3c18f1[_0x4a85('0x43')]);_0x3f2296[_0x4a85('0x46')]=_[_0x4a85('0x44')](_0x3c18f1[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0x4e8e9d['query'][_0x4a85('0x45')]));_0x3f2296[_0x4a85('0x46')]=_0x3f2296['attributes'][_0x4a85('0x47')]?_0x3f2296['attributes']:_0x3c18f1[_0x4a85('0x41')];_0x3f2296[_0x4a85('0x5d')]=qs['sort'](_0x4e8e9d['query']['sort']);_0x3f2296[_0x4a85('0x4c')]=qs[_0x4a85('0x4d')](_[_0x4a85('0x4e')](_0x4e8e9d[_0x4a85('0x43')],_0x3c18f1[_0x4a85('0x4d')]));if(_0x4e8e9d[_0x4a85('0x43')]['filter']){_0x3f2296['where']=_['merge'](_0x3f2296[_0x4a85('0x4c')],{'$or':_['map'](_0x3f2296['attributes'],function(_0x456698){var _0x10ed31={};_0x10ed31[_0x456698]={'$like':'%'+_0x4e8e9d[_0x4a85('0x43')]['filter']+'%'};return _0x10ed31;})});}_0x3f2296=_[_0x4a85('0x4f')]({},_0x3f2296,_0x4e8e9d[_0x4a85('0x51')]);return _0x36756e['getDescriptions'](_0x3f2296);}})[_0x4a85('0x21')](function(_0x25cfaf){if(_0x25cfaf){_0x52ac4a=_0x25cfaf['length'];if(!_0x4e8e9d[_0x4a85('0x43')][_0x4a85('0x48')](_0x4a85('0x49'))){_0x3f2296['limit']=qs[_0x4a85('0x4a')](_0x4e8e9d[_0x4a85('0x43')]['limit']);_0x3f2296['offset']=qs[_0x4a85('0x30')](_0x4e8e9d[_0x4a85('0x43')][_0x4a85('0x30')]);}return _0x36756e[_0x4a85('0x60')](_0x3f2296);}})['then'](function(_0x299a81){if(_0x299a81){return _0x299a81?{'count':_0x52ac4a,'rows':_0x299a81}:null;}})['then'](respondWithResult(_0x27988e,null))[_0x4a85('0x2b')](handleError(_0x27988e,null));};exports['getTags']=function(_0xe209f6,_0x53d4a5,_0x391517){var _0x239af2={};var _0x5c5b15={};var _0x27f28c;var _0x58bc27;return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0xe209f6['params']['id']}})[_0x4a85('0x21')](handleEntityNotFound(_0x53d4a5,null))[_0x4a85('0x21')](function(_0x1ac145){if(_0x1ac145){_0x27f28c=_0x1ac145;_0x5c5b15[_0x4a85('0x41')]=_[_0x4a85('0x42')](db['Tag'][_0x4a85('0x3e')]);_0x5c5b15[_0x4a85('0x43')]=_[_0x4a85('0x42')](_0xe209f6[_0x4a85('0x43')]);_0x5c5b15['filters']=_['intersection'](_0x5c5b15[_0x4a85('0x41')],_0x5c5b15[_0x4a85('0x43')]);_0x239af2['attributes']=_[_0x4a85('0x44')](_0x5c5b15[_0x4a85('0x41')],qs[_0x4a85('0x45')](_0xe209f6[_0x4a85('0x43')][_0x4a85('0x45')]));_0x239af2[_0x4a85('0x46')]=_0x239af2['attributes'][_0x4a85('0x47')]?_0x239af2[_0x4a85('0x46')]:_0x5c5b15[_0x4a85('0x41')];_0x239af2['order']=qs[_0x4a85('0x4b')](_0xe209f6[_0x4a85('0x43')][_0x4a85('0x4b')]);_0x239af2[_0x4a85('0x4c')]=qs['filters'](_[_0x4a85('0x4e')](_0xe209f6[_0x4a85('0x43')],_0x5c5b15['filters']));if(_0xe209f6[_0x4a85('0x43')][_0x4a85('0x50')]){_0x239af2['where']=_[_0x4a85('0x4f')](_0x239af2[_0x4a85('0x4c')],{'$or':_[_0x4a85('0x3c')](_0x239af2[_0x4a85('0x46')],function(_0x503fea){var _0x314cfc={};_0x314cfc[_0x503fea]={'$like':'%'+_0xe209f6[_0x4a85('0x43')][_0x4a85('0x50')]+'%'};return _0x314cfc;})});}_0x239af2=_[_0x4a85('0x4f')]({},_0x239af2,_0xe209f6[_0x4a85('0x51')]);return _0x27f28c[_0x4a85('0x61')](_0x239af2);}})['then'](function(_0x8f0b9c){if(_0x8f0b9c){_0x58bc27=_0x8f0b9c[_0x4a85('0x47')];if(!_0xe209f6[_0x4a85('0x43')]['hasOwnProperty'](_0x4a85('0x49'))){_0x239af2[_0x4a85('0x4a')]=qs[_0x4a85('0x4a')](_0xe209f6[_0x4a85('0x43')][_0x4a85('0x4a')]);_0x239af2[_0x4a85('0x30')]=qs['offset'](_0xe209f6['query']['offset']);}return _0x27f28c[_0x4a85('0x61')](_0x239af2);}})['then'](function(_0x13fcf9){if(_0x13fcf9){return _0x13fcf9?{'count':_0x58bc27,'rows':_0x13fcf9}:null;}})['then'](respondWithResult(_0x53d4a5,null))[_0x4a85('0x2b')](handleError(_0x53d4a5,null));};exports['setTags']=function(_0x26879b,_0x92172d,_0x26e332){if(_0x26879b['body']['id']){delete _0x26879b['body']['id'];}return db[_0x4a85('0x3d')][_0x4a85('0x5b')]({'where':{'id':_0x26879b[_0x4a85('0x56')]['id']}})['then'](handleEntityNotFound(_0x92172d,null))[_0x4a85('0x21')](function(_0x5cfc81){if(_0x5cfc81){return _0x5cfc81[_0x4a85('0x62')](_0x26879b[_0x4a85('0x59')][_0x4a85('0x63')]||[]);}return null;})[_0x4a85('0x21')](respondWithResult(_0x92172d,null))[_0x4a85('0x2b')](handleError(_0x92172d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a6ab784..6061111 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 _0x2e36=['define','DeskConfiguration','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2e36,0x175));var _0x62e3=function(_0x2ae9d8,_0x1f6962){_0x2ae9d8=_0x2ae9d8-0x0;var _0x3e5022=_0x2e36[_0x2ae9d8];return _0x3e5022;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62e3('0x0'))('api');var moment=require(_0x62e3('0x1'));var BPromise=require(_0x62e3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62e3('0x3'));var rimraf=require('rimraf');var config=require(_0x62e3('0x4'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x534c05,_0x350867){return _0x534c05[_0x62e3('0x5')](_0x62e3('0x6'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd75f=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','int_desk_configurations','lodash','util'];(function(_0x472ffe,_0x4ba6f2){var _0x5e50ef=function(_0x4a1a92){while(--_0x4a1a92){_0x472ffe['push'](_0x472ffe['shift']());}};_0x5e50ef(++_0x4ba6f2);}(_0xd75f,0xe5));var _0xfd75=function(_0x5f1ea0,_0x3b52a9){_0x5f1ea0=_0x5f1ea0-0x0;var _0x40c961=_0xd75f[_0x5f1ea0];return _0x40c961;};'use strict';var _=require(_0xfd75('0x0'));var util=require(_0xfd75('0x1'));var logger=require(_0xfd75('0x2'))(_0xfd75('0x3'));var moment=require(_0xfd75('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd75('0x6'));var config=require(_0xfd75('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xfd75('0x8')]=function(_0xc0003c,_0xdc0203){return _0xc0003c[_0xfd75('0x9')]('DeskConfiguration',attributes,{'tableName':_0xfd75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 6582b33..8ad22d2 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 _0xe9ad=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x13fafd,_0x2f939d){var _0x2ae7b3=function(_0x2146f0){while(--_0x2146f0){_0x13fafd['push'](_0x13fafd['shift']());}};_0x2ae7b3(++_0x2f939d);}(_0xe9ad,0x82));var _0xde9a=function(_0xa24985,_0x1d2c15){_0xa24985=_0xa24985-0x0;var _0x2f7c36=_0xe9ad[_0xa24985];return _0x2f7c36;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var moment=require(_0xde9a('0x2'));var BPromise=require(_0xde9a('0x3'));var rs=require(_0xde9a('0x4'));var fs=require('fs');var Redis=require(_0xde9a('0x5'));var db=require(_0xde9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xde9a('0x7'))(_0xde9a('0x8'));var config=require(_0xde9a('0x9'));var jayson=require(_0xde9a('0xa'));var client=jayson['client'][_0xde9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb666,_0xd47b9c,_0x5d4412){return new BPromise(function(_0x45d4a7,_0x17f89b){return client[_0xde9a('0xc')](_0x2bb666,_0x5d4412)[_0xde9a('0xd')](function(_0x297975){logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));logger[_0xde9a('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xd47b9c,_0xde9a('0x10'),JSON[_0xde9a('0x12')](_0x297975));if(_0x297975[_0xde9a('0x13')]){if(_0x297975[_0xde9a('0x13')][_0xde9a('0x14')]===0x1f4){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x17f89b(_0x297975['error'][_0xde9a('0x15')]);}logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x45d4a7(_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);}else{logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));_0x45d4a7(_0x297975[_0xde9a('0x16')][_0xde9a('0x15')]);}})[_0xde9a('0x17')](function(_0x39e1d0){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x39e1d0);_0x17f89b(_0x39e1d0);});});} \ No newline at end of file +var _0x6599=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x1edbbf,_0x4e554b){var _0x2b578d=function(_0x11a22d){while(--_0x11a22d){_0x1edbbf['push'](_0x1edbbf['shift']());}};_0x2b578d(++_0x4e554b);}(_0x6599,0xb0));var _0x9659=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x6599[_0x4fdcc0];return _0xc0ce94;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478dfa,_0x4e4402,_0xabdd12){return new BPromise(function(_0x14cb81,_0x4d0a52){return client[_0x9659('0xa')](_0x478dfa,_0xabdd12)['then'](function(_0x23f34a){logger[_0x9659('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x4e4402,_0x9659('0xc'));logger[_0x9659('0xd')](_0x9659('0xe'),_0x4e4402,'request\x20sent',JSON[_0x9659('0xf')](_0x23f34a));if(_0x23f34a['error']){if(_0x23f34a[_0x9659('0x10')][_0x9659('0x11')]===0x1f4){logger[_0x9659('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x4d0a52(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x14cb81(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}else{logger[_0x9659('0xb')](_0x9659('0x13'),_0x4e4402,_0x9659('0xc'));_0x14cb81(_0x23f34a[_0x9659('0x14')]['message']);}})[_0x9659('0x15')](function(_0xd1ab56){logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0xd1ab56);_0x4d0a52(_0xd1ab56);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d125647..ab2239c 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 _0xd4e7=['connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x5e2c70,_0x108e64){var _0x1e6cbc=function(_0x46e5fd){while(--_0x46e5fd){_0x5e2c70['push'](_0x5e2c70['shift']());}};_0x1e6cbc(++_0x108e64);}(_0xd4e7,0x8d));var _0x7d4e=function(_0x46a533,_0x5dcce4){_0x46a533=_0x46a533-0x0;var _0x3cb28f=_0xd4e7[_0x46a533];return _0x3cb28f;};'use strict';var multer=require(_0x7d4e('0x0'));var util=require(_0x7d4e('0x1'));var path=require(_0x7d4e('0x2'));var timeout=require(_0x7d4e('0x3'));var express=require(_0x7d4e('0x4'));var router=express['Router']();var auth=require(_0x7d4e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d4e('0x6'));var controller=require(_0x7d4e('0x7'));router[_0x7d4e('0x8')]('/',auth[_0x7d4e('0x9')](),controller[_0x7d4e('0xa')]);router['get'](_0x7d4e('0xb'),auth[_0x7d4e('0x9')](),controller[_0x7d4e('0xc')]);router[_0x7d4e('0xd')]('/',auth[_0x7d4e('0x9')](),controller[_0x7d4e('0xe')]);router[_0x7d4e('0xf')](_0x7d4e('0xb'),auth[_0x7d4e('0x9')](),controller[_0x7d4e('0x10')]);router['delete']('/:id',auth[_0x7d4e('0x9')](),controller[_0x7d4e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf3ac=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xf3ac,0x159));var _0xcf3a=function(_0x1a6bfb,_0x4adeaa){_0x1a6bfb=_0x1a6bfb-0x0;var _0x32ac3a=_0xf3ac[_0x1a6bfb];return _0x32ac3a;};'use strict';var multer=require(_0xcf3a('0x0'));var util=require(_0xcf3a('0x1'));var path=require(_0xcf3a('0x2'));var timeout=require(_0xcf3a('0x3'));var express=require('express');var router=express[_0xcf3a('0x4')]();var auth=require(_0xcf3a('0x5'));var interaction=require(_0xcf3a('0x6'));var config=require(_0xcf3a('0x7'));var controller=require('./intDeskField.controller');router[_0xcf3a('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf3a('0x9')]);router['get'](_0xcf3a('0xa'),auth['isAuthenticated'](),controller[_0xcf3a('0xb')]);router[_0xcf3a('0xc')]('/',auth[_0xcf3a('0xd')](),controller[_0xcf3a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcf3a('0xf')](_0xcf3a('0xa'),auth[_0xcf3a('0xd')](),controller[_0xcf3a('0x10')]);module[_0xcf3a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8554ac6..6b35006 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 _0xabe5=['ENUM','string','customVariable','STRING','variable','BOOLEAN','exports'];(function(_0x5023b1,_0x43e3e4){var _0x5978a8=function(_0x29a345){while(--_0x29a345){_0x5023b1['push'](_0x5023b1['shift']());}};_0x5978a8(++_0x43e3e4);}(_0xabe5,0x7d));var _0x5abe=function(_0x477c24,_0x37ded2){_0x477c24=_0x477c24-0x0;var _0x9d8cf9=_0xabe5[_0x477c24];return _0x9d8cf9;};'use strict';var Sequelize=require('sequelize');module[_0x5abe('0x0')]={'type':{'type':Sequelize[_0x5abe('0x1')](_0x5abe('0x2'),'variable',_0x5abe('0x3'),'keyValue'),'defaultValue':_0x5abe('0x2')},'content':{'type':Sequelize[_0x5abe('0x4')]},'key':{'type':Sequelize[_0x5abe('0x4')]},'keyType':{'type':Sequelize[_0x5abe('0x1')](_0x5abe('0x2'),_0x5abe('0x5'),_0x5abe('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5abe('0x4')]},'customField':{'type':Sequelize[_0x5abe('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5abe('0x4')]}}; \ No newline at end of file +var _0xe0da=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x2388c9,_0x34f067){var _0x231203=function(_0x1f593f){while(--_0x1f593f){_0x2388c9['push'](_0x2388c9['shift']());}};_0x231203(++_0x34f067);}(_0xe0da,0x100));var _0xae0d=function(_0x4bcc07,_0x1caf6d){_0x4bcc07=_0x4bcc07-0x0;var _0xdfacab=_0xe0da[_0x4bcc07];return _0xdfacab;};'use strict';var Sequelize=require(_0xae0d('0x0'));module[_0xae0d('0x1')]={'type':{'type':Sequelize[_0xae0d('0x2')](_0xae0d('0x3'),_0xae0d('0x4'),_0xae0d('0x5'),_0xae0d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xae0d('0x7')]},'key':{'type':Sequelize[_0xae0d('0x7')]},'keyType':{'type':Sequelize[_0xae0d('0x2')]('string',_0xae0d('0x4'),_0xae0d('0x5'))},'keyContent':{'type':Sequelize[_0xae0d('0x7')]},'idField':{'type':Sequelize[_0xae0d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index debc247..16cc3fc 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 _0x1ae2=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','end','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1ae2,0xd0));var _0x21ae=function(_0x946d03,_0x3beb5a){_0x946d03=_0x946d03-0x0;var _0x564292=_0x1ae2[_0x946d03];return _0x564292;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21ae('0x0'));var rimraf=require(_0x21ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21ae('0x2'));var rp=require('request-promise');var moment=require(_0x21ae('0x3'));var BPromise=require(_0x21ae('0x4'));var Mustache=require(_0x21ae('0x5'));var util=require(_0x21ae('0x6'));var path=require(_0x21ae('0x7'));var sox=require(_0x21ae('0x8'));var csv=require('to-csv');var ejs=require(_0x21ae('0x9'));var fs=require('fs');var _=require(_0x21ae('0xa'));var squel=require(_0x21ae('0xb'));var crypto=require(_0x21ae('0xc'));var jsforce=require(_0x21ae('0xd'));var deskjs=require(_0x21ae('0xe'));var toCsv=require(_0x21ae('0xf'));var querystring=require(_0x21ae('0x10'));var Papa=require(_0x21ae('0x11'));var Redis=require(_0x21ae('0x12'));var authService=require(_0x21ae('0x13'));var qs=require(_0x21ae('0x14'));var as=require(_0x21ae('0x15'));var hardwareService=require(_0x21ae('0x16'));var logger=require('../../config/logger')(_0x21ae('0x17'));var utils=require(_0x21ae('0x18'));var config=require(_0x21ae('0x19'));var db=require(_0x21ae('0x1a'))['db'];function respondWithStatusCode(_0x7fe681,_0xa77e2a){_0xa77e2a=_0xa77e2a||0xcc;return function(_0x397226){if(_0x397226){return _0x7fe681[_0x21ae('0x1b')](_0xa77e2a);}return _0x7fe681['status'](_0xa77e2a)['end']();};}function respondWithResult(_0x47772e,_0x231ffc){_0x231ffc=_0x231ffc||0xc8;return function(_0x3541e8){if(_0x3541e8){return _0x47772e[_0x21ae('0x1c')](_0x231ffc)[_0x21ae('0x1d')](_0x3541e8);}};}function respondWithFilteredResult(_0x493d4b,_0x20a818){return function(_0x542941){if(_0x542941){var _0x4aa242=_0x542941[_0x21ae('0x1e')],_0x5a3478=_0x20a818[_0x21ae('0x1f')],_0x21bc9e=_0x20a818[_0x21ae('0x1f')]+_0x20a818[_0x21ae('0x20')],_0x57e55c;if(_0x21bc9e>=_0x4aa242){_0x21bc9e=_0x4aa242;_0x57e55c=0xc8;}else{_0x57e55c=0xce;}_0x493d4b[_0x21ae('0x1c')](_0x57e55c);return _0x493d4b[_0x21ae('0x21')]('Content-Range',_0x5a3478+'-'+_0x21bc9e+'/'+_0x4aa242)['json'](_0x542941);}return null;};}function patchUpdates(_0x26bf7c){return function(_0x3d6f0a){try{jsonpatch[_0x21ae('0x22')](_0x3d6f0a,_0x26bf7c,!![]);}catch(_0x4e8f88){return BPromise['reject'](_0x4e8f88);}return _0x3d6f0a[_0x21ae('0x23')]();};}function saveUpdates(_0x4d1ca0,_0x1d3bc2){return function(_0xf6f6fb){if(_0xf6f6fb){return _0xf6f6fb[_0x21ae('0x24')](_0x4d1ca0)[_0x21ae('0x25')](function(_0x46eac6){return _0x46eac6;});}return null;};}function removeEntity(_0x4ae1b1,_0x584043){return function(_0x426632){if(_0x426632){return _0x426632[_0x21ae('0x26')]()[_0x21ae('0x25')](function(){_0x4ae1b1[_0x21ae('0x1c')](0xcc)[_0x21ae('0x27')]();});}};}function handleEntityNotFound(_0x3de78b,_0x12a105){return function(_0x5b7e9e){if(!_0x5b7e9e){_0x3de78b[_0x21ae('0x1b')](0x194);}return _0x5b7e9e;};}function handleError(_0x5d5b0c,_0x45dabd){_0x45dabd=_0x45dabd||0x1f4;return function(_0x331dff){logger[_0x21ae('0x28')](_0x331dff[_0x21ae('0x29')]);if(_0x331dff[_0x21ae('0x2a')]){delete _0x331dff['name'];}_0x5d5b0c[_0x21ae('0x1c')](_0x45dabd)[_0x21ae('0x2b')](_0x331dff);};}exports['index']=function(_0x50112a,_0x452aac){var _0x37e6d5={},_0x182894={},_0x2e86ed={'count':0x0,'rows':[]};var _0x2b2d6d=_['map'](db[_0x21ae('0x2c')][_0x21ae('0x2d')],function(_0x2099b4){return{'name':_0x2099b4[_0x21ae('0x2e')],'type':_0x2099b4[_0x21ae('0x2f')][_0x21ae('0x30')]};});_0x182894['model']=_['map'](_0x2b2d6d,_0x21ae('0x2a'));_0x182894[_0x21ae('0x31')]=_[_0x21ae('0x32')](_0x50112a[_0x21ae('0x31')]);_0x182894['filters']=_[_0x21ae('0x33')](_0x182894['model'],_0x182894[_0x21ae('0x31')]);_0x37e6d5[_0x21ae('0x34')]=_[_0x21ae('0x33')](_0x182894[_0x21ae('0x35')],qs[_0x21ae('0x36')](_0x50112a[_0x21ae('0x31')][_0x21ae('0x36')]));_0x37e6d5['attributes']=_0x37e6d5['attributes']['length']?_0x37e6d5[_0x21ae('0x34')]:_0x182894[_0x21ae('0x35')];if(!_0x50112a[_0x21ae('0x31')][_0x21ae('0x37')](_0x21ae('0x38'))){_0x37e6d5[_0x21ae('0x20')]=qs[_0x21ae('0x20')](_0x50112a[_0x21ae('0x31')][_0x21ae('0x20')]);_0x37e6d5['offset']=qs['offset'](_0x50112a[_0x21ae('0x31')][_0x21ae('0x1f')]);}_0x37e6d5['order']=qs['sort'](_0x50112a[_0x21ae('0x31')][_0x21ae('0x39')]);_0x37e6d5[_0x21ae('0x3a')]=qs[_0x21ae('0x3b')](_[_0x21ae('0x3c')](_0x50112a['query'],_0x182894[_0x21ae('0x3b')]),_0x2b2d6d);if(_0x50112a['query'][_0x21ae('0x3d')]){_0x37e6d5['where']=_[_0x21ae('0x3e')](_0x37e6d5[_0x21ae('0x3a')],{'$or':_[_0x21ae('0x3f')](_0x2b2d6d,function(_0x2bba61){if(_0x2bba61[_0x21ae('0x2f')]!==_0x21ae('0x40')){var _0x398b5b={};_0x398b5b[_0x2bba61[_0x21ae('0x2a')]]={'$like':'%'+_0x50112a[_0x21ae('0x31')][_0x21ae('0x3d')]+'%'};return _0x398b5b;}})});}_0x37e6d5=_[_0x21ae('0x3e')]({},_0x37e6d5,_0x50112a[_0x21ae('0x41')]);var _0x571668={'where':_0x37e6d5[_0x21ae('0x3a')]};return db[_0x21ae('0x2c')]['count'](_0x571668)[_0x21ae('0x25')](function(_0x3ee7ed){_0x2e86ed[_0x21ae('0x1e')]=_0x3ee7ed;if(_0x50112a[_0x21ae('0x31')]['includeAll']){_0x37e6d5[_0x21ae('0x42')]=[{'all':!![]}];}return db['DeskField'][_0x21ae('0x43')](_0x37e6d5);})['then'](function(_0x27a3c4){_0x2e86ed[_0x21ae('0x44')]=_0x27a3c4;return _0x2e86ed;})[_0x21ae('0x25')](respondWithFilteredResult(_0x452aac,_0x37e6d5))[_0x21ae('0x45')](handleError(_0x452aac,null));};exports['show']=function(_0x28116f,_0x322303){var _0x55b7e7={'raw':!![],'where':{'id':_0x28116f[_0x21ae('0x46')]['id']}},_0x459011={};_0x459011[_0x21ae('0x35')]=_[_0x21ae('0x32')](db[_0x21ae('0x2c')][_0x21ae('0x2d')]);_0x459011['query']=_[_0x21ae('0x32')](_0x28116f[_0x21ae('0x31')]);_0x459011[_0x21ae('0x3b')]=_[_0x21ae('0x33')](_0x459011[_0x21ae('0x35')],_0x459011[_0x21ae('0x31')]);_0x55b7e7[_0x21ae('0x34')]=_[_0x21ae('0x33')](_0x459011[_0x21ae('0x35')],qs[_0x21ae('0x36')](_0x28116f[_0x21ae('0x31')][_0x21ae('0x36')]));_0x55b7e7[_0x21ae('0x34')]=_0x55b7e7[_0x21ae('0x34')]['length']?_0x55b7e7[_0x21ae('0x34')]:_0x459011[_0x21ae('0x35')];if(_0x28116f[_0x21ae('0x31')][_0x21ae('0x47')]){_0x55b7e7[_0x21ae('0x42')]=[{'all':!![]}];}_0x55b7e7=_[_0x21ae('0x3e')]({},_0x55b7e7,_0x28116f[_0x21ae('0x41')]);return db[_0x21ae('0x2c')][_0x21ae('0x48')](_0x55b7e7)[_0x21ae('0x25')](handleEntityNotFound(_0x322303,null))[_0x21ae('0x25')](respondWithResult(_0x322303,null))[_0x21ae('0x45')](handleError(_0x322303,null));};exports[_0x21ae('0x49')]=function(_0x597828,_0x231257){return db[_0x21ae('0x2c')]['create'](_0x597828[_0x21ae('0x4a')],{})[_0x21ae('0x25')](respondWithResult(_0x231257,0xc9))[_0x21ae('0x45')](handleError(_0x231257,null));};exports['update']=function(_0x3e519e,_0x47ee69){if(_0x3e519e[_0x21ae('0x4a')]['id']){delete _0x3e519e['body']['id'];}return db['DeskField'][_0x21ae('0x48')]({'where':{'id':_0x3e519e[_0x21ae('0x46')]['id']}})[_0x21ae('0x25')](handleEntityNotFound(_0x47ee69,null))[_0x21ae('0x25')](saveUpdates(_0x3e519e[_0x21ae('0x4a')],null))[_0x21ae('0x25')](respondWithResult(_0x47ee69,null))[_0x21ae('0x45')](handleError(_0x47ee69,null));};exports[_0x21ae('0x26')]=function(_0x558423,_0x59ec58){return db[_0x21ae('0x2c')]['find']({'where':{'id':_0x558423[_0x21ae('0x46')]['id']}})[_0x21ae('0x25')](handleEntityNotFound(_0x59ec58,null))['then'](removeEntity(_0x59ec58,null))[_0x21ae('0x45')](handleError(_0x59ec58,null));}; \ No newline at end of file +var _0x0dee=['destroy','error','stack','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','DeskField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x505901,_0x1bd014){var _0x12c5ae=function(_0xcdb91e){while(--_0xcdb91e){_0x505901['push'](_0x505901['shift']());}};_0x12c5ae(++_0x1bd014);}(_0x0dee,0x135));var _0xe0de=function(_0x26dc7a,_0x25871e){_0x26dc7a=_0x26dc7a-0x0;var _0x510bd1=_0x0dee[_0x26dc7a];return _0x510bd1;};'use strict';var pdf=require(_0xe0de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0de('0x2'));var rp=require(_0xe0de('0x3'));var moment=require(_0xe0de('0x4'));var BPromise=require(_0xe0de('0x5'));var Mustache=require(_0xe0de('0x6'));var util=require(_0xe0de('0x7'));var path=require('path');var sox=require(_0xe0de('0x8'));var csv=require(_0xe0de('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe0de('0xa'));var crypto=require(_0xe0de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe0de('0xc'));var toCsv=require(_0xe0de('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe0de('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe0de('0xe'));var hardwareService=require(_0xe0de('0xf'));var logger=require(_0xe0de('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xe0de('0x11'));var db=require(_0xe0de('0x12'))['db'];function respondWithStatusCode(_0xccd33f,_0x30c39c){_0x30c39c=_0x30c39c||0xcc;return function(_0x3d3ff5){if(_0x3d3ff5){return _0xccd33f[_0xe0de('0x13')](_0x30c39c);}return _0xccd33f[_0xe0de('0x14')](_0x30c39c)['end']();};}function respondWithResult(_0x1a3f2c,_0x6a0b78){_0x6a0b78=_0x6a0b78||0xc8;return function(_0x29910d){if(_0x29910d){return _0x1a3f2c[_0xe0de('0x14')](_0x6a0b78)[_0xe0de('0x15')](_0x29910d);}};}function respondWithFilteredResult(_0xfedb38,_0x156cb0){return function(_0x463904){if(_0x463904){var _0x2b771d=_0x463904[_0xe0de('0x16')],_0x1ca1a4=_0x156cb0[_0xe0de('0x17')],_0x316e6e=_0x156cb0['offset']+_0x156cb0[_0xe0de('0x18')],_0x240e3c;if(_0x316e6e>=_0x2b771d){_0x316e6e=_0x2b771d;_0x240e3c=0xc8;}else{_0x240e3c=0xce;}_0xfedb38[_0xe0de('0x14')](_0x240e3c);return _0xfedb38[_0xe0de('0x19')](_0xe0de('0x1a'),_0x1ca1a4+'-'+_0x316e6e+'/'+_0x2b771d)[_0xe0de('0x15')](_0x463904);}return null;};}function patchUpdates(_0x63df4a){return function(_0x3f50bb){try{jsonpatch[_0xe0de('0x1b')](_0x3f50bb,_0x63df4a,!![]);}catch(_0x9700e){return BPromise['reject'](_0x9700e);}return _0x3f50bb[_0xe0de('0x1c')]();};}function saveUpdates(_0x23fb22,_0x1d57c9){return function(_0x59dccc){if(_0x59dccc){return _0x59dccc[_0xe0de('0x1d')](_0x23fb22)[_0xe0de('0x1e')](function(_0x1e6f01){return _0x1e6f01;});}return null;};}function removeEntity(_0x1e0aea,_0x3b2353){return function(_0x291946){if(_0x291946){return _0x291946[_0xe0de('0x1f')]()[_0xe0de('0x1e')](function(){_0x1e0aea[_0xe0de('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d813d,_0x5a4052){return function(_0xf76adb){if(!_0xf76adb){_0x3d813d[_0xe0de('0x13')](0x194);}return _0xf76adb;};}function handleError(_0x407ca3,_0x5d8551){_0x5d8551=_0x5d8551||0x1f4;return function(_0x34494c){logger[_0xe0de('0x20')](_0x34494c[_0xe0de('0x21')]);if(_0x34494c[_0xe0de('0x22')]){delete _0x34494c['name'];}_0x407ca3[_0xe0de('0x14')](_0x5d8551)[_0xe0de('0x23')](_0x34494c);};}exports['index']=function(_0x310771,_0x41726d){var _0x314df4={},_0xa0993b={},_0x4c2eb5={'count':0x0,'rows':[]};var _0x5a7fb2=_['map'](db['DeskField']['rawAttributes'],function(_0x21a1c2){return{'name':_0x21a1c2[_0xe0de('0x24')],'type':_0x21a1c2[_0xe0de('0x25')][_0xe0de('0x26')]};});_0xa0993b[_0xe0de('0x27')]=_[_0xe0de('0x28')](_0x5a7fb2,_0xe0de('0x22'));_0xa0993b[_0xe0de('0x29')]=_[_0xe0de('0x2a')](_0x310771['query']);_0xa0993b[_0xe0de('0x2b')]=_[_0xe0de('0x2c')](_0xa0993b['model'],_0xa0993b[_0xe0de('0x29')]);_0x314df4[_0xe0de('0x2d')]=_[_0xe0de('0x2c')](_0xa0993b['model'],qs['fields'](_0x310771['query'][_0xe0de('0x2e')]));_0x314df4[_0xe0de('0x2d')]=_0x314df4[_0xe0de('0x2d')][_0xe0de('0x2f')]?_0x314df4[_0xe0de('0x2d')]:_0xa0993b['model'];if(!_0x310771['query'][_0xe0de('0x30')]('nolimit')){_0x314df4[_0xe0de('0x18')]=qs['limit'](_0x310771[_0xe0de('0x29')][_0xe0de('0x18')]);_0x314df4['offset']=qs['offset'](_0x310771[_0xe0de('0x29')][_0xe0de('0x17')]);}_0x314df4[_0xe0de('0x31')]=qs[_0xe0de('0x32')](_0x310771[_0xe0de('0x29')][_0xe0de('0x32')]);_0x314df4[_0xe0de('0x33')]=qs['filters'](_[_0xe0de('0x34')](_0x310771['query'],_0xa0993b[_0xe0de('0x2b')]),_0x5a7fb2);if(_0x310771[_0xe0de('0x29')]['filter']){_0x314df4[_0xe0de('0x33')]=_[_0xe0de('0x35')](_0x314df4[_0xe0de('0x33')],{'$or':_[_0xe0de('0x28')](_0x5a7fb2,function(_0x2854a2){if(_0x2854a2[_0xe0de('0x25')]!=='VIRTUAL'){var _0xb477b5={};_0xb477b5[_0x2854a2[_0xe0de('0x22')]]={'$like':'%'+_0x310771[_0xe0de('0x29')][_0xe0de('0x36')]+'%'};return _0xb477b5;}})});}_0x314df4=_[_0xe0de('0x35')]({},_0x314df4,_0x310771[_0xe0de('0x37')]);var _0x288d83={'where':_0x314df4[_0xe0de('0x33')]};return db[_0xe0de('0x38')][_0xe0de('0x16')](_0x288d83)[_0xe0de('0x1e')](function(_0xf97f71){_0x4c2eb5['count']=_0xf97f71;if(_0x310771[_0xe0de('0x29')][_0xe0de('0x39')]){_0x314df4[_0xe0de('0x3a')]=[{'all':!![]}];}return db[_0xe0de('0x38')][_0xe0de('0x3b')](_0x314df4);})[_0xe0de('0x1e')](function(_0x3fd179){_0x4c2eb5[_0xe0de('0x3c')]=_0x3fd179;return _0x4c2eb5;})[_0xe0de('0x1e')](respondWithFilteredResult(_0x41726d,_0x314df4))[_0xe0de('0x3d')](handleError(_0x41726d,null));};exports[_0xe0de('0x3e')]=function(_0x2dd66a,_0x2098b0){var _0x271537={'raw':!![],'where':{'id':_0x2dd66a[_0xe0de('0x3f')]['id']}},_0x2f4c2d={};_0x2f4c2d['model']=_[_0xe0de('0x2a')](db[_0xe0de('0x38')][_0xe0de('0x40')]);_0x2f4c2d[_0xe0de('0x29')]=_[_0xe0de('0x2a')](_0x2dd66a[_0xe0de('0x29')]);_0x2f4c2d['filters']=_[_0xe0de('0x2c')](_0x2f4c2d[_0xe0de('0x27')],_0x2f4c2d[_0xe0de('0x29')]);_0x271537[_0xe0de('0x2d')]=_[_0xe0de('0x2c')](_0x2f4c2d['model'],qs['fields'](_0x2dd66a['query'][_0xe0de('0x2e')]));_0x271537[_0xe0de('0x2d')]=_0x271537['attributes'][_0xe0de('0x2f')]?_0x271537[_0xe0de('0x2d')]:_0x2f4c2d[_0xe0de('0x27')];if(_0x2dd66a[_0xe0de('0x29')]['includeAll']){_0x271537[_0xe0de('0x3a')]=[{'all':!![]}];}_0x271537=_[_0xe0de('0x35')]({},_0x271537,_0x2dd66a['options']);return db[_0xe0de('0x38')][_0xe0de('0x41')](_0x271537)['then'](handleEntityNotFound(_0x2098b0,null))['then'](respondWithResult(_0x2098b0,null))[_0xe0de('0x3d')](handleError(_0x2098b0,null));};exports[_0xe0de('0x42')]=function(_0x361e08,_0x5e79c5){return db[_0xe0de('0x38')][_0xe0de('0x42')](_0x361e08[_0xe0de('0x43')],{})[_0xe0de('0x1e')](respondWithResult(_0x5e79c5,0xc9))[_0xe0de('0x3d')](handleError(_0x5e79c5,null));};exports[_0xe0de('0x1d')]=function(_0x1bcbef,_0x203662){if(_0x1bcbef[_0xe0de('0x43')]['id']){delete _0x1bcbef[_0xe0de('0x43')]['id'];}return db[_0xe0de('0x38')][_0xe0de('0x41')]({'where':{'id':_0x1bcbef[_0xe0de('0x3f')]['id']}})[_0xe0de('0x1e')](handleEntityNotFound(_0x203662,null))[_0xe0de('0x1e')](saveUpdates(_0x1bcbef[_0xe0de('0x43')],null))[_0xe0de('0x1e')](respondWithResult(_0x203662,null))[_0xe0de('0x3d')](handleError(_0x203662,null));};exports[_0xe0de('0x1f')]=function(_0x30b28c,_0x9f969c){return db['DeskField']['find']({'where':{'id':_0x30b28c[_0xe0de('0x3f')]['id']}})['then'](handleEntityNotFound(_0x9f969c,null))['then'](removeEntity(_0x9f969c,null))[_0xe0de('0x3d')](handleError(_0x9f969c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6b34443..81c37d8 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 _0xdaf1=['util','../../config/logger','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','lodash'];(function(_0x3a12c5,_0x205b5c){var _0x1998e7=function(_0x1ea775){while(--_0x1ea775){_0x3a12c5['push'](_0x3a12c5['shift']());}};_0x1998e7(++_0x205b5c);}(_0xdaf1,0x1df));var _0x1daf=function(_0x59a45f,_0x3e530c){_0x59a45f=_0x59a45f-0x0;var _0x9479ea=_0xdaf1[_0x59a45f];return _0x9479ea;};'use strict';var _=require(_0x1daf('0x0'));var util=require(_0x1daf('0x1'));var logger=require(_0x1daf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1daf('0x3'));var rp=require(_0x1daf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1daf('0x5'));var config=require('../../config/environment');var attributes=require(_0x1daf('0x6'));module[_0x1daf('0x7')]=function(_0x217316,_0xf47071){return _0x217316[_0x1daf('0x8')]('DeskField',attributes,{'tableName':_0x1daf('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x1daf('0xa'),_0x1daf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3585=['api','bluebird','path','rimraf','../../config/environment','exports','DeskField','desk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x33ba98,_0x536552){var _0x31cf7b=function(_0x221874){while(--_0x221874){_0x33ba98['push'](_0x33ba98['shift']());}};_0x31cf7b(++_0x536552);}(_0x3585,0x11e));var _0x5358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3585[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5358('0x0'));var logger=require(_0x5358('0x1'))(_0x5358('0x2'));var moment=require('moment');var BPromise=require(_0x5358('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5358('0x4'));var rimraf=require(_0x5358('0x5'));var config=require(_0x5358('0x6'));var attributes=require('./intDeskField.attributes');module[_0x5358('0x7')]=function(_0x16e04a,_0x313b1d){return _0x16e04a['define'](_0x5358('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x5358('0x9'),'fields':[_0x5358('0xa'),_0x5358('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e3485b3..1c795ec 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 _0x1534=['client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x1534,0x188));var _0x4153=function(_0x28cb75,_0x3f187c){_0x28cb75=_0x28cb75-0x0;var _0x4c0f9e=_0x1534[_0x28cb75];return _0x4c0f9e;};'use strict';var _=require(_0x4153('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4153('0x1'));var rs=require(_0x4153('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4153('0x3'))['db'];var utils=require(_0x4153('0x4'));var logger=require('../../config/logger')(_0x4153('0x5'));var config=require(_0x4153('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4153('0x7')][_0x4153('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f24ee,_0x37da8b,_0x142fae){return new BPromise(function(_0x7f1577,_0x44df6c){return client['request'](_0x1f24ee,_0x142fae)[_0x4153('0x9')](function(_0xffa2d0){logger[_0x4153('0xa')](_0x4153('0xb'),_0x37da8b,_0x4153('0xc'));logger[_0x4153('0xd')](_0x4153('0xe'),_0x37da8b,_0x4153('0xc'),JSON[_0x4153('0xf')](_0xffa2d0));if(_0xffa2d0[_0x4153('0x10')]){if(_0xffa2d0[_0x4153('0x10')][_0x4153('0x11')]===0x1f4){logger[_0x4153('0x10')]('DeskField,\x20%s,\x20%s',_0x37da8b,_0xffa2d0[_0x4153('0x10')][_0x4153('0x12')]);return _0x44df6c(_0xffa2d0[_0x4153('0x10')][_0x4153('0x12')]);}logger[_0x4153('0x10')](_0x4153('0xb'),_0x37da8b,_0xffa2d0['error'][_0x4153('0x12')]);return _0x7f1577(_0xffa2d0[_0x4153('0x10')]['message']);}else{logger[_0x4153('0xa')]('DeskField,\x20%s,\x20%s',_0x37da8b,_0x4153('0xc'));_0x7f1577(_0xffa2d0[_0x4153('0x13')]['message']);}})[_0x4153('0x14')](function(_0x5ce6e8){logger[_0x4153('0x10')](_0x4153('0xb'),_0x37da8b,_0x5ce6e8);_0x44df6c(_0x5ce6e8);});});} \ No newline at end of file +var _0x7bac=['info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2ac7fd,_0xbccc19){var _0x520996=function(_0x4e9a7b){while(--_0x4e9a7b){_0x2ac7fd['push'](_0x2ac7fd['shift']());}};_0x520996(++_0xbccc19);}(_0x7bac,0x181));var _0xc7ba=function(_0x1c3315,_0x5a8bec){_0x1c3315=_0x1c3315-0x0;var _0x2f7954=_0x7bac[_0x1c3315];return _0x2f7954;};'use strict';var _=require(_0xc7ba('0x0'));var util=require(_0xc7ba('0x1'));var moment=require(_0xc7ba('0x2'));var BPromise=require(_0xc7ba('0x3'));var rs=require(_0xc7ba('0x4'));var fs=require('fs');var Redis=require(_0xc7ba('0x5'));var db=require(_0xc7ba('0x6'))['db'];var utils=require(_0xc7ba('0x7'));var logger=require(_0xc7ba('0x8'))(_0xc7ba('0x9'));var config=require(_0xc7ba('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc7ba('0xb')][_0xc7ba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1390cb,_0x191ad8,_0x55b0cf){return new BPromise(function(_0x48fed2,_0x533c41){return client[_0xc7ba('0xd')](_0x1390cb,_0x55b0cf)[_0xc7ba('0xe')](function(_0xeff114){logger[_0xc7ba('0xf')](_0xc7ba('0x10'),_0x191ad8,'request\x20sent');logger[_0xc7ba('0x11')](_0xc7ba('0x12'),_0x191ad8,_0xc7ba('0x13'),JSON['stringify'](_0xeff114));if(_0xeff114['error']){if(_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x15')]===0x1f4){logger[_0xc7ba('0x14')](_0xc7ba('0x10'),_0x191ad8,_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x16')]);return _0x533c41(_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x16')]);}logger['error'](_0xc7ba('0x10'),_0x191ad8,_0xeff114[_0xc7ba('0x14')][_0xc7ba('0x16')]);return _0x48fed2(_0xeff114[_0xc7ba('0x14')]['message']);}else{logger['info'](_0xc7ba('0x10'),_0x191ad8,_0xc7ba('0x13'));_0x48fed2(_0xeff114[_0xc7ba('0x17')][_0xc7ba('0x16')]);}})[_0xc7ba('0x18')](function(_0xb245f2){logger[_0xc7ba('0x14')](_0xc7ba('0x10'),_0x191ad8,_0xb245f2);_0x533c41(_0xb245f2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0d680df..68b12ed 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 _0xaf5c=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','util','path','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0x18b269,_0x4b9725){var _0x20807b=function(_0x259048){while(--_0x259048){_0x18b269['push'](_0x18b269['shift']());}};_0x20807b(++_0x4b9725);}(_0xaf5c,0x19a));var _0xcaf5=function(_0x111c0a,_0x33d4b9){_0x111c0a=_0x111c0a-0x0;var _0x29d61b=_0xaf5c[_0x111c0a];return _0x29d61b;};'use strict';var multer=require('multer');var util=require(_0xcaf5('0x0'));var path=require(_0xcaf5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcaf5('0x2'));var config=require(_0xcaf5('0x3'));var controller=require(_0xcaf5('0x4'));router[_0xcaf5('0x5')]('/',auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x7')]);router[_0xcaf5('0x5')](_0xcaf5('0x8'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x9')]);router['get'](_0xcaf5('0xa'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0xb')]);router[_0xcaf5('0x5')](_0xcaf5('0xc'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0xd')]);router[_0xcaf5('0xe')]('/',auth[_0xcaf5('0x6')](),controller['create']);router['post'](_0xcaf5('0xa'),auth['isAuthenticated'](),controller[_0xcaf5('0xf')]);router['put'](_0xcaf5('0x8'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x10')]);router[_0xcaf5('0x11')](_0xcaf5('0x8'),auth[_0xcaf5('0x6')](),controller[_0xcaf5('0x12')]);module[_0xcaf5('0x13')]=router; \ No newline at end of file +var _0xd602=['update','delete','/:id','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations','getFields','addConfiguration'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd602,0x115));var _0x2d60=function(_0x3c3ae7,_0x25ed21){_0x3c3ae7=_0x3c3ae7-0x0;var _0x4c53a7=_0xd602[_0x3c3ae7];return _0x4c53a7;};'use strict';var multer=require('multer');var util=require(_0x2d60('0x0'));var path=require('path');var timeout=require(_0x2d60('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2d60('0x2'));var config=require(_0x2d60('0x3'));var controller=require(_0x2d60('0x4'));router[_0x2d60('0x5')]('/',auth[_0x2d60('0x6')](),controller['index']);router[_0x2d60('0x5')]('/:id',auth[_0x2d60('0x6')](),controller[_0x2d60('0x7')]);router[_0x2d60('0x5')](_0x2d60('0x8'),auth[_0x2d60('0x6')](),controller['getConfigurations']);router[_0x2d60('0x5')]('/:id/fields',auth[_0x2d60('0x6')](),controller[_0x2d60('0x9')]);router['post']('/',auth[_0x2d60('0x6')](),controller['create']);router['post'](_0x2d60('0x8'),auth[_0x2d60('0x6')](),controller[_0x2d60('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2d60('0xb')]);router[_0x2d60('0xc')](_0x2d60('0xd'),auth[_0x2d60('0x6')](),controller[_0x2d60('0xe')]);module[_0x2d60('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e1d9392..e7768de 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 _0x0001=['STRING','sequelize','exports'];(function(_0x31ea7b,_0x52965c){var _0x32d30a=function(_0x418936){while(--_0x418936){_0x31ea7b['push'](_0x31ea7b['shift']());}};_0x32d30a(++_0x52965c);}(_0x0001,0x193));var _0x1000=function(_0x326cdc,_0x49807d){_0x326cdc=_0x326cdc-0x0;var _0x43d037=_0x0001[_0x326cdc];return _0x43d037;};'use strict';var Sequelize=require(_0x1000('0x0'));module[_0x1000('0x1')]={'name':{'type':Sequelize[_0x1000('0x2')]},'username':{'type':Sequelize[_0x1000('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1000('0x2')]},'tenantId':{'type':Sequelize[_0x1000('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1000('0x2')]},'serverUrl':{'type':Sequelize[_0x1000('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc8ac=['STRING','sequelize','exports'];(function(_0x5e20e0,_0x345246){var _0x2e0630=function(_0x2fa0e2){while(--_0x2fa0e2){_0x5e20e0['push'](_0x5e20e0['shift']());}};_0x2e0630(++_0x345246);}(_0xc8ac,0xb5));var _0xcc8a=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xc8ac[_0x1b51ea];return _0x18bbdc;};'use strict';var Sequelize=require(_0xcc8a('0x0'));module[_0xcc8a('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcc8a('0x2')]},'password':{'type':Sequelize[_0xcc8a('0x2')]},'remoteUri':{'type':Sequelize[_0xcc8a('0x2')]},'tenantId':{'type':Sequelize[_0xcc8a('0x2')]},'clientId':{'type':Sequelize[_0xcc8a('0x2')]},'clientSecret':{'type':Sequelize[_0xcc8a('0x2')]},'serverUrl':{'type':Sequelize[_0xcc8a('0x2')]},'description':{'type':Sequelize[_0xcc8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9e9e4bb..d923202 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 _0x6462=['contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','OptionSet','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../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','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','params','length','find','create','body','destroy','findOne','Dynamics365Configuration','order','hasOwnProperty','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','contactidyominame'];(function(_0x4c55c2,_0x5dde7e){var _0x469bab=function(_0x28a72f){while(--_0x28a72f){_0x4c55c2['push'](_0x4c55c2['shift']());}};_0x469bab(++_0x5dde7e);}(_0x6462,0x65));var _0x2646=function(_0x4626ad,_0x43f817){_0x4626ad=_0x4626ad-0x0;var _0x2b8b0d=_0x6462[_0x4626ad];return _0x2b8b0d;};'use strict';var pdf=require(_0x2646('0x0'));var emlformat=require(_0x2646('0x1'));var rimraf=require(_0x2646('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2646('0x3'));var moment=require(_0x2646('0x4'));var BPromise=require(_0x2646('0x5'));var Mustache=require(_0x2646('0x6'));var util=require(_0x2646('0x7'));var path=require(_0x2646('0x8'));var sox=require(_0x2646('0x9'));var csv=require('to-csv');var ejs=require(_0x2646('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2646('0xb'));var crypto=require(_0x2646('0xc'));var jsforce=require(_0x2646('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2646('0xe'));var querystring=require(_0x2646('0xf'));var Papa=require(_0x2646('0x10'));var Redis=require(_0x2646('0x11'));var authService=require(_0x2646('0x12'));var qs=require(_0x2646('0x13'));var as=require(_0x2646('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2646('0x15'));var utils=require(_0x2646('0x16'));var config=require('../../config/environment');var db=require(_0x2646('0x17'))['db'];var integrations=require(_0x2646('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x2646('0x19')][_0x2646('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x44b42d,_0x3ff7ad,_0x1efb7d){if(_0x1efb7d){var _0x341ac7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x341ac7[_0x2646('0x1b')](_0x3ff7ad)){return _0x44b42d;}else{throw new db['Sequelize'][(_0x2646('0x1c'))](_0x2646('0x1d'));}}else{return _0x44b42d;}}function respondWithRpcPromise(_0x6ed4d3,_0x12dc5f,_0x23d8e0,_0x5541d1){return new BPromise(function(_0x363d6a,_0x38a75c){var _0x439f72=_0x5541d1||client;return _0x439f72[_0x2646('0x1e')](_0x6ed4d3,_0x23d8e0)[_0x2646('0x1f')](function(_0x524002){logger['info'](_0x2646('0x20'),_0x12dc5f,_0x2646('0x21'));logger[_0x2646('0x22')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x12dc5f,_0x2646('0x21'),JSON[_0x2646('0x23')](_0x524002));if(_0x524002['error']){if(_0x524002['error'][_0x2646('0x24')]===0x1f4){logger[_0x2646('0x25')](_0x2646('0x20'),_0x12dc5f,_0x524002[_0x2646('0x25')]['message']);return _0x38a75c(_0x524002[_0x2646('0x25')][_0x2646('0x26')]);}logger[_0x2646('0x25')](_0x2646('0x20'),_0x12dc5f,_0x524002['error'][_0x2646('0x26')]);return _0x363d6a(_0x524002[_0x2646('0x25')][_0x2646('0x26')]);}else{logger[_0x2646('0x27')]('Dynamics365Account,\x20%s,\x20%s',_0x12dc5f,_0x2646('0x21'));_0x363d6a(_0x524002[_0x2646('0x28')][_0x2646('0x26')]);}})[_0x2646('0x29')](function(_0x10bf1b){logger[_0x2646('0x25')](_0x2646('0x20'),_0x12dc5f,_0x10bf1b);_0x38a75c(_0x10bf1b);});});}function respondWithStatusCode(_0xe30a03,_0x1d5368){_0x1d5368=_0x1d5368||0xcc;return function(_0x11bd37){if(_0x11bd37){return _0xe30a03[_0x2646('0x2a')](_0x1d5368);}return _0xe30a03[_0x2646('0x2b')](_0x1d5368)[_0x2646('0x2c')]();};}function respondWithResult(_0x1a87de,_0x356841){_0x356841=_0x356841||0xc8;return function(_0x1e038f){if(_0x1e038f){return _0x1a87de['status'](_0x356841)[_0x2646('0x2d')](_0x1e038f);}};}function respondWithFilteredResult(_0x44fb34,_0x100ca6){return function(_0x37012c){if(_0x37012c){var _0x42f730=_0x37012c[_0x2646('0x2e')],_0xf66307=_0x100ca6[_0x2646('0x2f')],_0x130cda=_0x100ca6[_0x2646('0x2f')]+_0x100ca6[_0x2646('0x30')],_0x22feab;if(_0x130cda>=_0x42f730){_0x130cda=_0x42f730;_0x22feab=0xc8;}else{_0x22feab=0xce;}_0x44fb34[_0x2646('0x2b')](_0x22feab);return _0x44fb34['set'](_0x2646('0x31'),_0xf66307+'-'+_0x130cda+'/'+_0x42f730)[_0x2646('0x2d')](_0x37012c);}return null;};}function patchUpdates(_0x115645){return function(_0x2e0e3f){try{jsonpatch[_0x2646('0x32')](_0x2e0e3f,_0x115645,!![]);}catch(_0x53a949){return BPromise[_0x2646('0x33')](_0x53a949);}return _0x2e0e3f[_0x2646('0x34')]();};}function saveUpdates(_0x400f60,_0x7b239f){return function(_0xd0f920){if(_0xd0f920){return _0xd0f920[_0x2646('0x35')](_0x400f60)[_0x2646('0x1f')](function(_0x53d214){return _0x53d214;});}return null;};}function removeEntity(_0x4f3f7c,_0x2a2b27){return function(_0x2241a8){if(_0x2241a8){return _0x2241a8['destroy']()[_0x2646('0x1f')](function(){_0x4f3f7c[_0x2646('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52247c,_0x33fc9a){return function(_0x117b2a){if(!_0x117b2a){_0x52247c[_0x2646('0x2a')](0x194);}return _0x117b2a;};}function handleError(_0x43baa6,_0x20f914){_0x20f914=_0x20f914||0x1f4;return function(_0x3f51eb){logger['error'](_0x3f51eb[_0x2646('0x36')]);if(_0x3f51eb[_0x2646('0x37')]){delete _0x3f51eb['name'];}_0x43baa6['status'](_0x20f914)[_0x2646('0x38')](_0x3f51eb);};}exports[_0x2646('0x39')]=function(_0x5d40a9,_0x484079){var _0x341e0a={},_0x41012e={},_0x1560fc={'count':0x0,'rows':[]};var _0x5e42f2=_[_0x2646('0x3a')](db['Dynamics365Account'][_0x2646('0x3b')],function(_0x58642a){return{'name':_0x58642a['fieldName'],'type':_0x58642a[_0x2646('0x3c')][_0x2646('0x3d')]};});_0x41012e[_0x2646('0x3e')]=_['map'](_0x5e42f2,'name');_0x41012e[_0x2646('0x3f')]=_[_0x2646('0x40')](_0x5d40a9[_0x2646('0x3f')]);_0x41012e[_0x2646('0x41')]=_['intersection'](_0x41012e[_0x2646('0x3e')],_0x41012e[_0x2646('0x3f')]);_0x341e0a[_0x2646('0x42')]=_[_0x2646('0x43')](_0x41012e[_0x2646('0x3e')],qs['fields'](_0x5d40a9[_0x2646('0x3f')][_0x2646('0x44')]));_0x341e0a[_0x2646('0x42')]=_0x341e0a[_0x2646('0x42')]['length']?_0x341e0a[_0x2646('0x42')]:_0x41012e[_0x2646('0x3e')];if(!_0x5d40a9[_0x2646('0x3f')]['hasOwnProperty'](_0x2646('0x45'))){_0x341e0a[_0x2646('0x30')]=qs[_0x2646('0x30')](_0x5d40a9[_0x2646('0x3f')][_0x2646('0x30')]);_0x341e0a[_0x2646('0x2f')]=qs[_0x2646('0x2f')](_0x5d40a9[_0x2646('0x3f')]['offset']);}_0x341e0a['order']=qs['sort'](_0x5d40a9[_0x2646('0x3f')]['sort']);_0x341e0a[_0x2646('0x46')]=qs[_0x2646('0x41')](_[_0x2646('0x47')](_0x5d40a9['query'],_0x41012e[_0x2646('0x41')]),_0x5e42f2);if(_0x5d40a9[_0x2646('0x3f')][_0x2646('0x48')]){_0x341e0a[_0x2646('0x46')]=_[_0x2646('0x49')](_0x341e0a[_0x2646('0x46')],{'$or':_[_0x2646('0x3a')](_0x5e42f2,function(_0x36846a){if(_0x36846a[_0x2646('0x3c')]!==_0x2646('0x4a')){var _0x4e628d={};_0x4e628d[_0x36846a[_0x2646('0x37')]]={'$like':'%'+_0x5d40a9[_0x2646('0x3f')][_0x2646('0x48')]+'%'};return _0x4e628d;}})});}_0x341e0a=_[_0x2646('0x49')]({},_0x341e0a,_0x5d40a9[_0x2646('0x4b')]);var _0x452ab1={'where':_0x341e0a[_0x2646('0x46')]};return db[_0x2646('0x4c')]['count'](_0x452ab1)[_0x2646('0x1f')](function(_0x310d18){_0x1560fc[_0x2646('0x2e')]=_0x310d18;if(_0x5d40a9[_0x2646('0x3f')][_0x2646('0x4d')]){_0x341e0a[_0x2646('0x4e')]=[{'all':!![]}];}return db[_0x2646('0x4c')][_0x2646('0x4f')](_0x341e0a);})[_0x2646('0x1f')](function(_0x208cbe){_0x1560fc[_0x2646('0x50')]=_0x208cbe;return _0x1560fc;})[_0x2646('0x1f')](respondWithFilteredResult(_0x484079,_0x341e0a))['catch'](handleError(_0x484079,null));};exports['show']=function(_0x40547f,_0x116cf9){var _0x1333ea={'raw':![],'where':{'id':_0x40547f[_0x2646('0x51')]['id']}},_0x2801d1={};_0x2801d1[_0x2646('0x3e')]=_[_0x2646('0x40')](db[_0x2646('0x4c')]['rawAttributes']);_0x2801d1[_0x2646('0x3f')]=_[_0x2646('0x40')](_0x40547f[_0x2646('0x3f')]);_0x2801d1['filters']=_['intersection'](_0x2801d1['model'],_0x2801d1[_0x2646('0x3f')]);_0x1333ea['attributes']=_[_0x2646('0x43')](_0x2801d1[_0x2646('0x3e')],qs[_0x2646('0x44')](_0x40547f[_0x2646('0x3f')]['fields']));_0x1333ea[_0x2646('0x42')]=_0x1333ea[_0x2646('0x42')][_0x2646('0x52')]?_0x1333ea['attributes']:_0x2801d1[_0x2646('0x3e')];if(_0x40547f[_0x2646('0x3f')][_0x2646('0x4d')]){_0x1333ea[_0x2646('0x4e')]=[{'all':!![]}];}_0x1333ea=_[_0x2646('0x49')]({},_0x1333ea,_0x40547f[_0x2646('0x4b')]);return db['Dynamics365Account'][_0x2646('0x53')](_0x1333ea)[_0x2646('0x1f')](handleEntityNotFound(_0x116cf9,null))[_0x2646('0x1f')](respondWithResult(_0x116cf9,null))['catch'](handleError(_0x116cf9,null));};exports[_0x2646('0x54')]=function(_0x25bfaa,_0x2ba72a){return db[_0x2646('0x4c')][_0x2646('0x54')](_0x25bfaa[_0x2646('0x55')],{})[_0x2646('0x1f')](respondWithResult(_0x2ba72a,0xc9))[_0x2646('0x29')](handleError(_0x2ba72a,null));};exports[_0x2646('0x35')]=function(_0x5c33d8,_0x5321ea){if(_0x5c33d8['body']['id']){delete _0x5c33d8[_0x2646('0x55')]['id'];}return db[_0x2646('0x4c')][_0x2646('0x53')]({'where':{'id':_0x5c33d8[_0x2646('0x51')]['id']}})['then'](handleEntityNotFound(_0x5321ea,null))[_0x2646('0x1f')](saveUpdates(_0x5c33d8[_0x2646('0x55')],null))[_0x2646('0x1f')](respondWithResult(_0x5321ea,null))['catch'](handleError(_0x5321ea,null));};exports[_0x2646('0x56')]=function(_0x52cb05,_0x68dd9b){return db[_0x2646('0x4c')][_0x2646('0x53')]({'where':{'id':_0x52cb05[_0x2646('0x51')]['id']}})['then'](handleEntityNotFound(_0x68dd9b,null))[_0x2646('0x1f')](removeEntity(_0x68dd9b,null))[_0x2646('0x29')](handleError(_0x68dd9b,null));};exports['getConfigurations']=function(_0x544cbb,_0xe837c,_0xb43f2b){var _0x46f28f={};var _0x2b0f6a={};var _0xe56fdd;var _0x4e0a63;return db[_0x2646('0x4c')][_0x2646('0x57')]({'where':{'id':_0x544cbb[_0x2646('0x51')]['id']}})[_0x2646('0x1f')](handleEntityNotFound(_0xe837c,null))['then'](function(_0x5b4314){if(_0x5b4314){_0xe56fdd=_0x5b4314;_0x2b0f6a[_0x2646('0x3e')]=_[_0x2646('0x40')](db[_0x2646('0x58')][_0x2646('0x3b')]);_0x2b0f6a[_0x2646('0x3f')]=_[_0x2646('0x40')](_0x544cbb[_0x2646('0x3f')]);_0x2b0f6a[_0x2646('0x41')]=_[_0x2646('0x43')](_0x2b0f6a[_0x2646('0x3e')],_0x2b0f6a[_0x2646('0x3f')]);_0x46f28f[_0x2646('0x42')]=_['intersection'](_0x2b0f6a[_0x2646('0x3e')],qs[_0x2646('0x44')](_0x544cbb[_0x2646('0x3f')]['fields']));_0x46f28f['attributes']=_0x46f28f[_0x2646('0x42')]['length']?_0x46f28f[_0x2646('0x42')]:_0x2b0f6a[_0x2646('0x3e')];_0x46f28f[_0x2646('0x59')]=qs['sort'](_0x544cbb[_0x2646('0x3f')]['sort']);_0x46f28f[_0x2646('0x46')]=qs[_0x2646('0x41')](_['pick'](_0x544cbb[_0x2646('0x3f')],_0x2b0f6a[_0x2646('0x41')]));if(_0x544cbb[_0x2646('0x3f')][_0x2646('0x48')]){_0x46f28f[_0x2646('0x46')]=_[_0x2646('0x49')](_0x46f28f['where'],{'$or':_[_0x2646('0x3a')](_0x46f28f[_0x2646('0x42')],function(_0x4a9894){var _0x732cb0={};_0x732cb0[_0x4a9894]={'$like':'%'+_0x544cbb[_0x2646('0x3f')]['filter']+'%'};return _0x732cb0;})});}_0x46f28f=_[_0x2646('0x49')]({},_0x46f28f,_0x544cbb[_0x2646('0x4b')]);return _0xe56fdd['getConfigurations'](_0x46f28f);}})['then'](function(_0x4c2854){if(_0x4c2854){_0x4e0a63=_0x4c2854[_0x2646('0x52')];if(!_0x544cbb[_0x2646('0x3f')][_0x2646('0x5a')](_0x2646('0x45'))){_0x46f28f[_0x2646('0x30')]=qs['limit'](_0x544cbb[_0x2646('0x3f')][_0x2646('0x30')]);_0x46f28f['offset']=qs[_0x2646('0x2f')](_0x544cbb[_0x2646('0x3f')]['offset']);}return _0xe56fdd[_0x2646('0x5b')](_0x46f28f);}})[_0x2646('0x1f')](function(_0x136b79){if(_0x136b79){return _0x136b79?{'count':_0x4e0a63,'rows':_0x136b79}:null;}})[_0x2646('0x1f')](respondWithResult(_0xe837c,null))[_0x2646('0x29')](handleError(_0xe837c,null));};exports[_0x2646('0x5c')]=function(_0x4ea60c,_0x5ef519,_0x35c5e3){if(_0x4ea60c['body']['id']){delete _0x4ea60c[_0x2646('0x55')]['id'];}return db[_0x2646('0x4c')][_0x2646('0x57')]({'where':{'id':_0x4ea60c[_0x2646('0x51')]['id']}})[_0x2646('0x1f')](handleEntityNotFound(_0x5ef519,null))[_0x2646('0x1f')](function(_0x1ca3cf){if(_0x1ca3cf){_0x4ea60c['body']['AccountId']=_0x1ca3cf['id'];_0x4ea60c[_0x2646('0x55')][_0x2646('0x5d')]=integrations[_0x2646('0x5e')](_0x4ea60c[_0x2646('0x55')]['channel'],_0x4ea60c[_0x2646('0x55')][_0x2646('0x3c')]);_0x4ea60c[_0x2646('0x55')][_0x2646('0x5f')]=integrations[_0x2646('0x60')](_0x4ea60c['body'][_0x2646('0x61')],_0x4ea60c[_0x2646('0x55')][_0x2646('0x3c')]);return db[_0x2646('0x58')][_0x2646('0x54')](_0x4ea60c[_0x2646('0x55')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x2646('0x5f')}]});}return null;})[_0x2646('0x1f')](respondWithResult(_0x5ef519,null))[_0x2646('0x29')](handleError(_0x5ef519,null));};exports[_0x2646('0x62')]=function(_0x4c9b1e,_0x101b60,_0x517917){var _0x2650d2=_0x4c9b1e[_0x2646('0x3f')][_0x2646('0x63')];var _0x162afc=_0x2650d2===_0x2646('0x64')?_0x2646('0x65'):_0x2646('0x66');var _0x3767f3='';var _0x10b96c='';var _0x2f1d6e='';var _0x311442='';var _0xdb7b7d='';var _0x241d79='';var _0x3219ba='';var _0x2ec6d5='';var _0xcc425f=[_0x2646('0x67'),_0x2646('0x68'),_0x2646('0x69'),_0x2646('0x6a'),_0x2646('0x6b'),_0x2646('0x6c'),_0x2646('0x6d'),_0x2646('0x6e'),_0x2646('0x6f'),_0x2646('0x70')];var _0x5234f7=[_0x2646('0x71'),'accountidyominame','actualserviceunits','billedserviceunits','contactidname',_0x2646('0x72'),_0x2646('0x73'),_0x2646('0x74'),_0x2646('0x75'),_0x2646('0x76'),_0x2646('0x77'),_0x2646('0x78'),'createdon','createdonbehalfbyname',_0x2646('0x79'),'customeridname',_0x2646('0x7a'),'customeridyominame',_0x2646('0x7b'),_0x2646('0x7c'),_0x2646('0x7d'),'entityimage_url',_0x2646('0x7e'),_0x2646('0x7f'),_0x2646('0x80'),'followupby','importsequencenumber',_0x2646('0x81'),_0x2646('0x82'),_0x2646('0x83'),_0x2646('0x84'),_0x2646('0x85'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x2646('0x86'),_0x2646('0x87'),_0x2646('0x88'),_0x2646('0x89'),_0x2646('0x8a'),'msdyn_iotalertname',_0x2646('0x8b'),_0x2646('0x8c'),_0x2646('0x8d'),_0x2646('0x8e'),'owneridtype',_0x2646('0x8f'),_0x2646('0x90'),_0x2646('0x91'),_0x2646('0x92'),_0x2646('0x93'),_0x2646('0x94'),_0x2646('0x95'),_0x2646('0x96'),_0x2646('0x97'),'responseby','responsiblecontactidname',_0x2646('0x98'),_0x2646('0x99'),'slainvokedidname',_0x2646('0x9a'),'socialprofileidname',_0x2646('0x9b'),'statuscode',_0x2646('0x9c'),'ticketnumber',_0x2646('0x9d'),_0x2646('0x9e'),_0x2646('0x9f'),_0x2646('0xa0'),_0x2646('0xa1')];var _0x3f028b=_0xcc425f[_0x2646('0xa2')](_0x5234f7);return db[_0x2646('0x4c')]['findOne']({'where':{'id':_0x4c9b1e['params']['id']},'attributes':['id',_0x2646('0xa3'),_0x2646('0xa4'),_0x2646('0xa5'),'tenantId','clientId',_0x2646('0xa6')]})['then'](handleEntityNotFound(_0x101b60,null))['then'](function(_0x20ef86){if(_0x20ef86){_0x2ec6d5=_0x20ef86['remoteUri'];var _0x427925=_0x2ec6d5[_0x2646('0xa7')](-0x1);if(_0x427925==='/'){_0x2ec6d5=_0x2ec6d5[_0x2646('0xa8')](0x0,_0x2ec6d5[_0x2646('0xa9')](_0x427925));}_0x3219ba=util['format'](_0x2646('0xaa'),_0x2ec6d5);var _0x12e1e7={'method':_0x2646('0xab'),'uri':_0x2646('0xac')+_0x20ef86['tenantId']+_0x2646('0xad'),'form':{'client_id':_0x20ef86['clientId'],'resource':_0x2ec6d5,'username':_0x20ef86['username'],'password':_0x20ef86[_0x2646('0xa4')],'grant_type':_0x2646('0xa4'),'client_secret':_0x20ef86[_0x2646('0xa6')]},'json':!![]};return rp(_0x12e1e7);}})[_0x2646('0x1f')](function(_0x1f2fac){_0x241d79=_0x1f2fac[_0x2646('0xae')];var _0x49c016={'method':'GET','uri':encodeURI(_0x3219ba+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x162afc+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x241d79,'If-None-Match':null,'OData-Version':_0x2646('0xaf')},'json':!![]};return rp(_0x49c016);})[_0x2646('0x1f')](function(_0x2e49c8){var _0x1bb86d=_0x2e49c8[_0x2646('0xb0')][0x0];var _0x5706e9=_0x1bb86d[_0x2646('0xb1')];var _0x537db6={'method':_0x2646('0xb2'),'uri':_0x3219ba+_0x2646('0xb3')+_0x5706e9+_0x2646('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x241d79,'If-None-Match':null,'OData-Version':_0x2646('0xaf')},'json':!![]};return rp(_0x537db6);})['then'](function(_0x2219c2){_0x3767f3=_0x2219c2;_0x10b96c=_0x3767f3[_0x2646('0xb5')];_0x10b96c=_[_0x2646('0xb6')](_0x10b96c,function(_0x150552){return!_0x3f028b[_0x2646('0xb7')](_0x150552[_0x2646('0xb8')]);});var _0x1b21e0=[];var _0x300df1=[];_0x10b96c[_0x2646('0xb9')](function(_0x5e3de7){if(_0x5e3de7[_0x2646('0xba')]){var _0x57d58e=_0x5e3de7[_0x2646('0xba')][_0x2646('0xa8')](_0x5e3de7[_0x2646('0xba')][_0x2646('0xa9')]('.')+0x1);if(_0x57d58e===_0x2646('0xbb')){_0x1b21e0[_0x2646('0xbc')](getSelectList(_0x3219ba,_0x2650d2,_0x300df1,_0x3767f3[_0x2646('0xb1')],_0x5e3de7[_0x2646('0xb1')],_0x241d79));}}});return Promise[_0x2646('0xbd')](_0x1b21e0);})[_0x2646('0x1f')](function(_0x130a3f){_0x2f1d6e=_0x130a3f[0x0];var _0x4beb12=[];var _0x20f4fb=[];_0x10b96c['forEach'](function(_0x12e1f7){if(!_[_0x2646('0xbe')](_0x12e1f7['@odata.type'])){var _0x36169c=_0x12e1f7[_0x2646('0xba')]['substring'](_0x12e1f7['@odata.type']['lastIndexOf']('.')+0x1);if(_0x36169c===_0x2646('0xbf')){_0x4beb12[_0x2646('0xbc')](getBooleanList(_0x3219ba,_0x2650d2,_0x20f4fb,_0x3767f3[_0x2646('0xb1')],_0x12e1f7[_0x2646('0xb1')],_0x241d79));}}});return Promise['all'](_0x4beb12);})[_0x2646('0x1f')](function(_0x54d5a2){_0x311442=_0x54d5a2[0x0];var _0x3c6726=[];var _0x582cf4=[];_0x10b96c[_0x2646('0xb9')](function(_0x5822f2){if(_0x5822f2[_0x2646('0xba')]){var _0x18df41=_0x5822f2['@odata.type']['substring'](_0x5822f2[_0x2646('0xba')][_0x2646('0xa9')]('.')+0x1);if(_0x18df41===_0x2646('0xc0')||_0x18df41==='DoubleAttributeMetadata'||_0x18df41===_0x2646('0xc1')||_0x18df41===_0x2646('0xc2')||_0x18df41===_0x2646('0xc3')||_0x18df41===_0x2646('0xc4')||_0x18df41===_0x2646('0xc5')||_0x18df41===_0x2646('0xc6')||_0x18df41===_0x2646('0xc7')||_0x18df41===_0x2646('0xc8')){_0x3c6726[_0x2646('0xbc')](getInputList(_0x3219ba,_0x2650d2,_0x18df41,_0x582cf4,_0x3767f3[_0x2646('0xb1')],_0x5822f2[_0x2646('0xb1')],_0x241d79));}}});return Promise[_0x2646('0xbd')](_0x3c6726);})[_0x2646('0x1f')](function(_0x29e450){_0xdb7b7d=_0x29e450[0x0];var _0x324cde=_0x2f1d6e[_0x2646('0xa2')](_0x311442)[_0x2646('0xa2')](_0xdb7b7d);var _0x128f33={'count':_0x324cde[_0x2646('0x52')],'rows':_0x324cde};return _0x128f33;})[_0x2646('0x1f')](respondWithResult(_0x101b60,null))[_0x2646('0x29')](function(_0x50bab5){var _0x223bd6=_0x4c9b1e[_0x2646('0x3f')][_0x2646('0x1b')]?0x1f4:_0x50bab5[_0x2646('0xc9')]||0x1f4;logger[_0x2646('0x25')](_0x50bab5[_0x2646('0x36')]);delete _0x50bab5['name'];if(_0x223bd6===0x191){_0x223bd6=0x190;}_0x101b60[_0x2646('0x2b')](_0x223bd6)['send'](_0x4c9b1e[_0x2646('0x3f')][_0x2646('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x50bab5[_0x2646('0xc9')]}:_0x50bab5);});};function getSelectList(_0x221276,_0x2657f2,_0x4c9715,_0x2bfd2c,_0x51250a,_0x2bfa6f){var _0x4996bc={'method':_0x2646('0xb2'),'uri':_0x221276+_0x2646('0xb3')+_0x2bfd2c+_0x2646('0xca')+_0x51250a+_0x2646('0xcb')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2646('0xcc')+_0x2bfa6f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4996bc)[_0x2646('0x1f')](function(_0x382fc6){var _0x18343f=[];var _0xdf5217=_0x382fc6[_0x2646('0xcd')][_0x2646('0xce')];_0xdf5217[_0x2646('0xb9')](function(_0x29d90a){_0x18343f['push']({'name':_0x29d90a[_0x2646('0xcf')]['UserLocalizedLabel'][_0x2646('0xcf')],'value':String(_0x29d90a[_0x2646('0xd0')])});});var _0x2b1c17={'id':_0x2657f2+'_'+_0x382fc6['LogicalName'],'name':_0x382fc6['DisplayName'][_0x2646('0xd1')][_0x2646('0xcf')],'custom':![],'options':_0x18343f};_0x4c9715[_0x2646('0xbc')](_0x2b1c17);return _0x4c9715;});}function getBooleanList(_0x8ff716,_0x23c43f,_0x8cc770,_0x4eb60d,_0x91ef2c,_0x29d72a){var _0xc78985={'method':_0x2646('0xb2'),'uri':_0x8ff716+_0x2646('0xb3')+_0x4eb60d+_0x2646('0xca')+_0x91ef2c+_0x2646('0xd2'),'headers':{'Authorization':_0x2646('0xcc')+_0x29d72a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xc78985)[_0x2646('0x1f')](function(_0x4986cd){var _0x27a0b7=[];_0x27a0b7[_0x2646('0xbc')]({'name':_0x4986cd[_0x2646('0xcd')][_0x2646('0xd3')][_0x2646('0xcf')]['UserLocalizedLabel'][_0x2646('0xcf')],'value':'true'},{'name':_0x4986cd[_0x2646('0xcd')][_0x2646('0xd4')]['Label'][_0x2646('0xd1')][_0x2646('0xcf')],'value':_0x2646('0xd5')});var _0x4eec94={'id':_0x23c43f+'_'+_0x4986cd[_0x2646('0xb8')],'name':_0x4986cd[_0x2646('0xd6')][_0x2646('0xd1')][_0x2646('0xcf')],'custom':![],'options':_0x27a0b7};_0x8cc770[_0x2646('0xbc')](_0x4eec94);return _0x8cc770;});}function getInputList(_0x53afb8,_0x471a8d,_0x31f9d1,_0x2b5b0e,_0x34053a,_0x130be9,_0x22c1fa){var _0x22e7a5={'method':_0x2646('0xb2'),'uri':_0x53afb8+_0x2646('0xb3')+_0x34053a+_0x2646('0xca')+_0x130be9+')/Microsoft.Dynamics.CRM.'+_0x31f9d1+_0x2646('0xd7'),'headers':{'Authorization':_0x2646('0xcc')+_0x22c1fa,'If-None-Match':null,'OData-Version':_0x2646('0xaf')},'json':!![]};return rp(_0x22e7a5)[_0x2646('0x1f')](function(_0x325d5a){var _0x34cf74={'id':_0x471a8d+'_'+_0x325d5a[_0x2646('0xb8')],'name':_0x325d5a[_0x2646('0xd6')]['UserLocalizedLabel']?_0x325d5a[_0x2646('0xd6')][_0x2646('0xd1')][_0x2646('0xcf')]:_0x325d5a[_0x2646('0xb8')],'custom':![],'options':[]};_0x2b5b0e[_0x2646('0xbc')](_0x34cf74);return _0x2b5b0e;});} \ No newline at end of file +var _0x5005=['../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','Dynamics365Account','findAll','catch','show','params','find','create','body','destroy','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','Label','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x5005,0xbf));var _0x5500=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x5005[_0x43576f];return _0x4d2466;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5500('0x0'));var rimraf=require(_0x5500('0x1'));var zipdir=require(_0x5500('0x2'));var jsonpatch=require(_0x5500('0x3'));var rp=require(_0x5500('0x4'));var moment=require(_0x5500('0x5'));var BPromise=require(_0x5500('0x6'));var Mustache=require(_0x5500('0x7'));var util=require(_0x5500('0x8'));var path=require('path');var sox=require(_0x5500('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5500('0xa'));var crypto=require('crypto');var jsforce=require(_0x5500('0xb'));var deskjs=require(_0x5500('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5500('0xd'));var Papa=require(_0x5500('0xe'));var Redis=require(_0x5500('0xf'));var authService=require(_0x5500('0x10'));var qs=require(_0x5500('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5500('0x12'));var logger=require('../../config/logger')(_0x5500('0x13'));var utils=require(_0x5500('0x14'));var config=require(_0x5500('0x15'));var db=require(_0x5500('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5500('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x209332,_0x4d0582,_0x1af582){if(_0x1af582){var _0x2a8525=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a8525[_0x5500('0x18')](_0x4d0582)){return _0x209332;}else{throw new db[(_0x5500('0x19'))][(_0x5500('0x1a'))](_0x5500('0x1b'));}}else{return _0x209332;}}function respondWithRpcPromise(_0x2a1588,_0x444dd6,_0x3349b7,_0x53f816){return new BPromise(function(_0x471933,_0x3e742e){var _0x41b5c3=_0x53f816||client;return _0x41b5c3[_0x5500('0x1c')](_0x2a1588,_0x3349b7)[_0x5500('0x1d')](function(_0x528083){logger[_0x5500('0x1e')](_0x5500('0x1f'),_0x444dd6,_0x5500('0x20'));logger[_0x5500('0x21')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x444dd6,_0x5500('0x20'),JSON['stringify'](_0x528083));if(_0x528083[_0x5500('0x22')]){if(_0x528083['error'][_0x5500('0x23')]===0x1f4){logger[_0x5500('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x444dd6,_0x528083['error']['message']);return _0x3e742e(_0x528083[_0x5500('0x22')][_0x5500('0x24')]);}logger[_0x5500('0x22')](_0x5500('0x1f'),_0x444dd6,_0x528083[_0x5500('0x22')][_0x5500('0x24')]);return _0x471933(_0x528083[_0x5500('0x22')][_0x5500('0x24')]);}else{logger[_0x5500('0x1e')](_0x5500('0x1f'),_0x444dd6,'request\x20sent');_0x471933(_0x528083['result'][_0x5500('0x24')]);}})['catch'](function(_0x743209){logger[_0x5500('0x22')](_0x5500('0x1f'),_0x444dd6,_0x743209);_0x3e742e(_0x743209);});});}function respondWithStatusCode(_0x2e6bc2,_0xb29b7d){_0xb29b7d=_0xb29b7d||0xcc;return function(_0x5a3946){if(_0x5a3946){return _0x2e6bc2[_0x5500('0x25')](_0xb29b7d);}return _0x2e6bc2[_0x5500('0x26')](_0xb29b7d)[_0x5500('0x27')]();};}function respondWithResult(_0x131c20,_0x2fae8c){_0x2fae8c=_0x2fae8c||0xc8;return function(_0x5b3564){if(_0x5b3564){return _0x131c20[_0x5500('0x26')](_0x2fae8c)[_0x5500('0x28')](_0x5b3564);}};}function respondWithFilteredResult(_0x5525a5,_0x2a219){return function(_0x1ab3b0){if(_0x1ab3b0){var _0x5d5c44=_0x1ab3b0[_0x5500('0x29')],_0x34ecc6=_0x2a219['offset'],_0x3b77d3=_0x2a219[_0x5500('0x2a')]+_0x2a219[_0x5500('0x2b')],_0x5c94e9;if(_0x3b77d3>=_0x5d5c44){_0x3b77d3=_0x5d5c44;_0x5c94e9=0xc8;}else{_0x5c94e9=0xce;}_0x5525a5[_0x5500('0x26')](_0x5c94e9);return _0x5525a5[_0x5500('0x2c')](_0x5500('0x2d'),_0x34ecc6+'-'+_0x3b77d3+'/'+_0x5d5c44)['json'](_0x1ab3b0);}return null;};}function patchUpdates(_0x33ee80){return function(_0x4c17c2){try{jsonpatch['apply'](_0x4c17c2,_0x33ee80,!![]);}catch(_0x57d018){return BPromise[_0x5500('0x2e')](_0x57d018);}return _0x4c17c2[_0x5500('0x2f')]();};}function saveUpdates(_0x1fe78b,_0x425e9e){return function(_0x43a7c3){if(_0x43a7c3){return _0x43a7c3[_0x5500('0x30')](_0x1fe78b)[_0x5500('0x1d')](function(_0x4f7029){return _0x4f7029;});}return null;};}function removeEntity(_0x495dfe,_0x5396ea){return function(_0x1c9d0b){if(_0x1c9d0b){return _0x1c9d0b['destroy']()['then'](function(){_0x495dfe[_0x5500('0x26')](0xcc)[_0x5500('0x27')]();});}};}function handleEntityNotFound(_0x1c910e,_0x4a09ca){return function(_0x109bf2){if(!_0x109bf2){_0x1c910e[_0x5500('0x25')](0x194);}return _0x109bf2;};}function handleError(_0x52b77a,_0x4a91a7){_0x4a91a7=_0x4a91a7||0x1f4;return function(_0x5a6ea2){logger[_0x5500('0x22')](_0x5a6ea2['stack']);if(_0x5a6ea2[_0x5500('0x31')]){delete _0x5a6ea2[_0x5500('0x31')];}_0x52b77a[_0x5500('0x26')](_0x4a91a7)[_0x5500('0x32')](_0x5a6ea2);};}exports[_0x5500('0x33')]=function(_0xf776d6,_0x215267){var _0x55ba95={},_0x56d584={},_0x4c1449={'count':0x0,'rows':[]};var _0x36cace=_[_0x5500('0x34')](db['Dynamics365Account'][_0x5500('0x35')],function(_0x536d61){return{'name':_0x536d61['fieldName'],'type':_0x536d61[_0x5500('0x36')][_0x5500('0x37')]};});_0x56d584[_0x5500('0x38')]=_[_0x5500('0x34')](_0x36cace,_0x5500('0x31'));_0x56d584[_0x5500('0x39')]=_[_0x5500('0x3a')](_0xf776d6[_0x5500('0x39')]);_0x56d584['filters']=_[_0x5500('0x3b')](_0x56d584[_0x5500('0x38')],_0x56d584[_0x5500('0x39')]);_0x55ba95[_0x5500('0x3c')]=_['intersection'](_0x56d584[_0x5500('0x38')],qs[_0x5500('0x3d')](_0xf776d6[_0x5500('0x39')][_0x5500('0x3d')]));_0x55ba95[_0x5500('0x3c')]=_0x55ba95['attributes'][_0x5500('0x3e')]?_0x55ba95[_0x5500('0x3c')]:_0x56d584['model'];if(!_0xf776d6[_0x5500('0x39')][_0x5500('0x3f')]('nolimit')){_0x55ba95['limit']=qs[_0x5500('0x2b')](_0xf776d6[_0x5500('0x39')][_0x5500('0x2b')]);_0x55ba95[_0x5500('0x2a')]=qs['offset'](_0xf776d6[_0x5500('0x39')][_0x5500('0x2a')]);}_0x55ba95[_0x5500('0x40')]=qs['sort'](_0xf776d6[_0x5500('0x39')][_0x5500('0x41')]);_0x55ba95[_0x5500('0x42')]=qs['filters'](_[_0x5500('0x43')](_0xf776d6['query'],_0x56d584[_0x5500('0x44')]),_0x36cace);if(_0xf776d6['query']['filter']){_0x55ba95[_0x5500('0x42')]=_[_0x5500('0x45')](_0x55ba95[_0x5500('0x42')],{'$or':_[_0x5500('0x34')](_0x36cace,function(_0x5a2946){if(_0x5a2946[_0x5500('0x36')]!==_0x5500('0x46')){var _0x4f99d1={};_0x4f99d1[_0x5a2946[_0x5500('0x31')]]={'$like':'%'+_0xf776d6[_0x5500('0x39')][_0x5500('0x47')]+'%'};return _0x4f99d1;}})});}_0x55ba95=_[_0x5500('0x45')]({},_0x55ba95,_0xf776d6[_0x5500('0x48')]);var _0x326686={'where':_0x55ba95[_0x5500('0x42')]};return db['Dynamics365Account'][_0x5500('0x29')](_0x326686)[_0x5500('0x1d')](function(_0x17a18d){_0x4c1449['count']=_0x17a18d;if(_0xf776d6[_0x5500('0x39')][_0x5500('0x49')]){_0x55ba95[_0x5500('0x4a')]=[{'all':!![]}];}return db[_0x5500('0x4b')][_0x5500('0x4c')](_0x55ba95);})[_0x5500('0x1d')](function(_0x34ac45){_0x4c1449['rows']=_0x34ac45;return _0x4c1449;})[_0x5500('0x1d')](respondWithFilteredResult(_0x215267,_0x55ba95))[_0x5500('0x4d')](handleError(_0x215267,null));};exports[_0x5500('0x4e')]=function(_0x49801c,_0xaf6db4){var _0x337c05={'raw':![],'where':{'id':_0x49801c[_0x5500('0x4f')]['id']}},_0x4bd62b={};_0x4bd62b[_0x5500('0x38')]=_[_0x5500('0x3a')](db[_0x5500('0x4b')][_0x5500('0x35')]);_0x4bd62b[_0x5500('0x39')]=_[_0x5500('0x3a')](_0x49801c[_0x5500('0x39')]);_0x4bd62b[_0x5500('0x44')]=_[_0x5500('0x3b')](_0x4bd62b[_0x5500('0x38')],_0x4bd62b[_0x5500('0x39')]);_0x337c05[_0x5500('0x3c')]=_[_0x5500('0x3b')](_0x4bd62b[_0x5500('0x38')],qs[_0x5500('0x3d')](_0x49801c[_0x5500('0x39')][_0x5500('0x3d')]));_0x337c05[_0x5500('0x3c')]=_0x337c05[_0x5500('0x3c')][_0x5500('0x3e')]?_0x337c05[_0x5500('0x3c')]:_0x4bd62b[_0x5500('0x38')];if(_0x49801c[_0x5500('0x39')][_0x5500('0x49')]){_0x337c05[_0x5500('0x4a')]=[{'all':!![]}];}_0x337c05=_['merge']({},_0x337c05,_0x49801c[_0x5500('0x48')]);return db['Dynamics365Account'][_0x5500('0x50')](_0x337c05)['then'](handleEntityNotFound(_0xaf6db4,null))['then'](respondWithResult(_0xaf6db4,null))[_0x5500('0x4d')](handleError(_0xaf6db4,null));};exports[_0x5500('0x51')]=function(_0x3cf5a5,_0x3cd4bc){return db[_0x5500('0x4b')][_0x5500('0x51')](_0x3cf5a5[_0x5500('0x52')],{})['then'](respondWithResult(_0x3cd4bc,0xc9))[_0x5500('0x4d')](handleError(_0x3cd4bc,null));};exports[_0x5500('0x30')]=function(_0x41a11d,_0x1878d5){if(_0x41a11d[_0x5500('0x52')]['id']){delete _0x41a11d[_0x5500('0x52')]['id'];}return db[_0x5500('0x4b')][_0x5500('0x50')]({'where':{'id':_0x41a11d[_0x5500('0x4f')]['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x1878d5,null))['then'](saveUpdates(_0x41a11d[_0x5500('0x52')],null))[_0x5500('0x1d')](respondWithResult(_0x1878d5,null))[_0x5500('0x4d')](handleError(_0x1878d5,null));};exports[_0x5500('0x53')]=function(_0x2e8814,_0x56a826){return db[_0x5500('0x4b')]['find']({'where':{'id':_0x2e8814['params']['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x56a826,null))[_0x5500('0x1d')](removeEntity(_0x56a826,null))[_0x5500('0x4d')](handleError(_0x56a826,null));};exports['getConfigurations']=function(_0x86bca7,_0x2a727c,_0x3686eb){var _0x20626a={};var _0x47321d={};var _0x292ca5;var _0x4cfadd;return db[_0x5500('0x4b')][_0x5500('0x54')]({'where':{'id':_0x86bca7['params']['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x2a727c,null))[_0x5500('0x1d')](function(_0x13b406){if(_0x13b406){_0x292ca5=_0x13b406;_0x47321d[_0x5500('0x38')]=_[_0x5500('0x3a')](db[_0x5500('0x55')]['rawAttributes']);_0x47321d[_0x5500('0x39')]=_[_0x5500('0x3a')](_0x86bca7[_0x5500('0x39')]);_0x47321d[_0x5500('0x44')]=_[_0x5500('0x3b')](_0x47321d[_0x5500('0x38')],_0x47321d[_0x5500('0x39')]);_0x20626a[_0x5500('0x3c')]=_['intersection'](_0x47321d[_0x5500('0x38')],qs[_0x5500('0x3d')](_0x86bca7[_0x5500('0x39')]['fields']));_0x20626a['attributes']=_0x20626a[_0x5500('0x3c')]['length']?_0x20626a[_0x5500('0x3c')]:_0x47321d[_0x5500('0x38')];_0x20626a['order']=qs[_0x5500('0x41')](_0x86bca7[_0x5500('0x39')]['sort']);_0x20626a[_0x5500('0x42')]=qs[_0x5500('0x44')](_['pick'](_0x86bca7['query'],_0x47321d['filters']));if(_0x86bca7['query'][_0x5500('0x47')]){_0x20626a['where']=_[_0x5500('0x45')](_0x20626a[_0x5500('0x42')],{'$or':_[_0x5500('0x34')](_0x20626a['attributes'],function(_0x1d88a){var _0x273d6f={};_0x273d6f[_0x1d88a]={'$like':'%'+_0x86bca7[_0x5500('0x39')][_0x5500('0x47')]+'%'};return _0x273d6f;})});}_0x20626a=_[_0x5500('0x45')]({},_0x20626a,_0x86bca7['options']);return _0x292ca5[_0x5500('0x56')](_0x20626a);}})[_0x5500('0x1d')](function(_0x27d080){if(_0x27d080){_0x4cfadd=_0x27d080[_0x5500('0x3e')];if(!_0x86bca7['query'][_0x5500('0x3f')]('nolimit')){_0x20626a['limit']=qs['limit'](_0x86bca7[_0x5500('0x39')]['limit']);_0x20626a[_0x5500('0x2a')]=qs[_0x5500('0x2a')](_0x86bca7['query'][_0x5500('0x2a')]);}return _0x292ca5[_0x5500('0x56')](_0x20626a);}})[_0x5500('0x1d')](function(_0x330d2a){if(_0x330d2a){return _0x330d2a?{'count':_0x4cfadd,'rows':_0x330d2a}:null;}})[_0x5500('0x1d')](respondWithResult(_0x2a727c,null))[_0x5500('0x4d')](handleError(_0x2a727c,null));};exports[_0x5500('0x57')]=function(_0x209796,_0x2d93ea,_0x107d40){if(_0x209796[_0x5500('0x52')]['id']){delete _0x209796[_0x5500('0x52')]['id'];}return db[_0x5500('0x4b')][_0x5500('0x54')]({'where':{'id':_0x209796[_0x5500('0x4f')]['id']}})[_0x5500('0x1d')](handleEntityNotFound(_0x2d93ea,null))['then'](function(_0x3273d5){if(_0x3273d5){_0x209796[_0x5500('0x52')][_0x5500('0x58')]=_0x3273d5['id'];_0x209796[_0x5500('0x52')][_0x5500('0x59')]=integrations['getSubjects'](_0x209796[_0x5500('0x52')][_0x5500('0x5a')],_0x209796[_0x5500('0x52')]['type']);_0x209796[_0x5500('0x52')][_0x5500('0x5b')]=integrations[_0x5500('0x5c')](_0x209796[_0x5500('0x52')][_0x5500('0x5a')],_0x209796[_0x5500('0x52')][_0x5500('0x36')]);return db[_0x5500('0x55')][_0x5500('0x51')](_0x209796[_0x5500('0x52')],{'include':[{'model':db[_0x5500('0x5d')],'as':_0x5500('0x59')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x5500('0x1d')](respondWithResult(_0x2d93ea,null))[_0x5500('0x4d')](handleError(_0x2d93ea,null));};exports[_0x5500('0x5e')]=function(_0x4aaa04,_0x1c6473,_0xf8a2ee){var _0x962441=_0x4aaa04[_0x5500('0x39')][_0x5500('0x5f')];var _0x39e0b5=_0x962441===_0x5500('0x60')?_0x5500('0x61'):_0x5500('0x62');var _0x555f7a='';var _0x2cbd34='';var _0xdbffa0='';var _0x4575b3='';var _0x770102='';var _0x1c8e9c='';var _0x2c61bf='';var _0x28f252='';var _0x304f54=[_0x5500('0x63'),_0x5500('0x64'),'customerid',_0x5500('0x65'),_0x5500('0x66'),_0x5500('0x67'),'phonenumber',_0x5500('0x68'),_0x5500('0x69'),_0x5500('0x6a')];var _0x1a1a3a=[_0x5500('0x6b'),_0x5500('0x6c'),_0x5500('0x6d'),_0x5500('0x6e'),_0x5500('0x6f'),_0x5500('0x70'),_0x5500('0x71'),_0x5500('0x72'),_0x5500('0x73'),_0x5500('0x74'),_0x5500('0x75'),_0x5500('0x76'),_0x5500('0x77'),_0x5500('0x78'),_0x5500('0x79'),'customeridname',_0x5500('0x7a'),_0x5500('0x7b'),_0x5500('0x7c'),'entitlementidname',_0x5500('0x7d'),_0x5500('0x7e'),'escalatedon',_0x5500('0x7f'),_0x5500('0x80'),_0x5500('0x81'),'importsequencenumber',_0x5500('0x82'),'kbarticleidname',_0x5500('0x83'),'masteridname',_0x5500('0x84'),_0x5500('0x85'),_0x5500('0x86'),_0x5500('0x87'),_0x5500('0x88'),_0x5500('0x89'),_0x5500('0x8a'),_0x5500('0x8b'),_0x5500('0x8c'),_0x5500('0x8d'),_0x5500('0x8e'),'overriddencreatedon','owneridname',_0x5500('0x8f'),_0x5500('0x90'),_0x5500('0x91'),'primarycontactidname','primarycontactidyominame',_0x5500('0x92'),_0x5500('0x93'),_0x5500('0x94'),_0x5500('0x95'),_0x5500('0x96'),_0x5500('0x97'),_0x5500('0x98'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x5500('0x99'),_0x5500('0x9a'),'statecode',_0x5500('0x9b'),_0x5500('0x9c'),'ticketnumber',_0x5500('0x9d'),_0x5500('0x9e'),_0x5500('0x9f'),_0x5500('0xa0'),'versionnumber'];var _0x360691=_0x304f54[_0x5500('0xa1')](_0x1a1a3a);return db[_0x5500('0x4b')][_0x5500('0x54')]({'where':{'id':_0x4aaa04[_0x5500('0x4f')]['id']},'attributes':['id','username',_0x5500('0xa2'),'remoteUri',_0x5500('0xa3'),_0x5500('0xa4'),_0x5500('0xa5')]})[_0x5500('0x1d')](handleEntityNotFound(_0x1c6473,null))[_0x5500('0x1d')](function(_0x4b68f2){if(_0x4b68f2){_0x28f252=_0x4b68f2[_0x5500('0xa6')];var _0x48fb89=_0x28f252[_0x5500('0xa7')](-0x1);if(_0x48fb89==='/'){_0x28f252=_0x28f252[_0x5500('0xa8')](0x0,_0x28f252[_0x5500('0xa9')](_0x48fb89));}_0x2c61bf=util[_0x5500('0xaa')](_0x5500('0xab'),_0x28f252);var _0xf47ceb={'method':_0x5500('0xac'),'uri':'https://login.microsoftonline.com/'+_0x4b68f2[_0x5500('0xa3')]+'/oauth2/token','form':{'client_id':_0x4b68f2[_0x5500('0xa4')],'resource':_0x28f252,'username':_0x4b68f2[_0x5500('0xad')],'password':_0x4b68f2[_0x5500('0xa2')],'grant_type':'password','client_secret':_0x4b68f2[_0x5500('0xa5')]},'json':!![]};return rp(_0xf47ceb);}})[_0x5500('0x1d')](function(_0x58af4d){_0x1c8e9c=_0x58af4d[_0x5500('0xae')];var _0x24bf67={'method':_0x5500('0xaf'),'uri':encodeURI(_0x2c61bf+_0x5500('0xb0')+_0x39e0b5+'\x27'),'headers':{'Authorization':_0x5500('0xb1')+_0x1c8e9c,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0x24bf67);})['then'](function(_0x2754f2){var _0x5f4b43=_0x2754f2[_0x5500('0xb3')][0x0];var _0x3b6087=_0x5f4b43[_0x5500('0xb4')];var _0x3f5425={'method':_0x5500('0xaf'),'uri':_0x2c61bf+_0x5500('0xb5')+_0x3b6087+_0x5500('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x1c8e9c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f5425);})[_0x5500('0x1d')](function(_0x3bf745){_0x555f7a=_0x3bf745;_0x2cbd34=_0x555f7a[_0x5500('0xb7')];_0x2cbd34=_[_0x5500('0xb8')](_0x2cbd34,function(_0xa8d63d){return!_0x360691[_0x5500('0xb9')](_0xa8d63d['LogicalName']);});var _0x12bade=[];var _0x22ecd2=[];_0x2cbd34[_0x5500('0xba')](function(_0x21f45c){if(_0x21f45c['@odata.type']){var _0x2a3a5e=_0x21f45c['@odata.type']['substring'](_0x21f45c[_0x5500('0xbb')][_0x5500('0xa9')]('.')+0x1);if(_0x2a3a5e==='PicklistAttributeMetadata'){_0x12bade[_0x5500('0xbc')](getSelectList(_0x2c61bf,_0x962441,_0x22ecd2,_0x555f7a[_0x5500('0xb4')],_0x21f45c[_0x5500('0xb4')],_0x1c8e9c));}}});return Promise[_0x5500('0xbd')](_0x12bade);})[_0x5500('0x1d')](function(_0x50302a){_0xdbffa0=_0x50302a[0x0];var _0x1112fe=[];var _0x4e0ae0=[];_0x2cbd34[_0x5500('0xba')](function(_0x2d1134){if(!_[_0x5500('0xbe')](_0x2d1134[_0x5500('0xbb')])){var _0x5111ed=_0x2d1134[_0x5500('0xbb')][_0x5500('0xa8')](_0x2d1134[_0x5500('0xbb')][_0x5500('0xa9')]('.')+0x1);if(_0x5111ed===_0x5500('0xbf')){_0x1112fe[_0x5500('0xbc')](getBooleanList(_0x2c61bf,_0x962441,_0x4e0ae0,_0x555f7a[_0x5500('0xb4')],_0x2d1134[_0x5500('0xb4')],_0x1c8e9c));}}});return Promise[_0x5500('0xbd')](_0x1112fe);})[_0x5500('0x1d')](function(_0x5779b5){_0x4575b3=_0x5779b5[0x0];var _0x2cf391=[];var _0xe26a60=[];_0x2cbd34['forEach'](function(_0x5d190f){if(_0x5d190f[_0x5500('0xbb')]){var _0x55de39=_0x5d190f[_0x5500('0xbb')][_0x5500('0xa8')](_0x5d190f['@odata.type'][_0x5500('0xa9')]('.')+0x1);if(_0x55de39==='StringAttributeMetadata'||_0x55de39===_0x5500('0xc0')||_0x55de39===_0x5500('0xc1')||_0x55de39==='IntegerAttributeMetadata'||_0x55de39===_0x5500('0xc2')||_0x55de39==='DateTimeAttributeMetadata'||_0x55de39===_0x5500('0xc3')||_0x55de39===_0x5500('0xc4')||_0x55de39===_0x5500('0xc5')||_0x55de39===_0x5500('0xc6')){_0x2cf391[_0x5500('0xbc')](getInputList(_0x2c61bf,_0x962441,_0x55de39,_0xe26a60,_0x555f7a[_0x5500('0xb4')],_0x5d190f[_0x5500('0xb4')],_0x1c8e9c));}}});return Promise[_0x5500('0xbd')](_0x2cf391);})[_0x5500('0x1d')](function(_0x49a243){_0x770102=_0x49a243[0x0];var _0x12e79d=_0xdbffa0[_0x5500('0xa1')](_0x4575b3)[_0x5500('0xa1')](_0x770102);var _0x1aa23d={'count':_0x12e79d[_0x5500('0x3e')],'rows':_0x12e79d};return _0x1aa23d;})[_0x5500('0x1d')](respondWithResult(_0x1c6473,null))[_0x5500('0x4d')](function(_0x2e310b){var _0x5bf2bd=_0x4aaa04['query'][_0x5500('0x18')]?0x1f4:_0x2e310b[_0x5500('0xc7')]||0x1f4;logger[_0x5500('0x22')](_0x2e310b['stack']);delete _0x2e310b['name'];if(_0x5bf2bd===0x191){_0x5bf2bd=0x190;}_0x1c6473['status'](_0x5bf2bd)[_0x5500('0x32')](_0x4aaa04[_0x5500('0x39')][_0x5500('0x18')]?{'message':_0x5500('0xc8'),'statusCode':_0x2e310b[_0x5500('0xc7')]}:_0x2e310b);});};function getSelectList(_0x371f1c,_0x505630,_0x48db64,_0x5dfccf,_0x585375,_0x328666){var _0x489281={'method':'GET','uri':_0x371f1c+'EntityDefinitions('+_0x5dfccf+_0x5500('0xc9')+_0x585375+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x5500('0xb1')+_0x328666,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0x489281)['then'](function(_0xb0ba82){var _0xa3241=[];var _0x20e037=_0xb0ba82['OptionSet']['Options'];_0x20e037[_0x5500('0xba')](function(_0x59889a){_0xa3241['push']({'name':_0x59889a[_0x5500('0xca')]['UserLocalizedLabel'][_0x5500('0xca')],'value':String(_0x59889a['Value'])});});var _0x54bf92={'id':_0x505630+'_'+_0xb0ba82[_0x5500('0xcb')],'name':_0xb0ba82[_0x5500('0xcc')][_0x5500('0xcd')][_0x5500('0xca')],'custom':![],'options':_0xa3241};_0x48db64[_0x5500('0xbc')](_0x54bf92);return _0x48db64;});}function getBooleanList(_0x4414d3,_0x153e1b,_0x2634ed,_0x476d6f,_0x5455e6,_0x2a83e3){var _0x29898e={'method':_0x5500('0xaf'),'uri':_0x4414d3+_0x5500('0xb5')+_0x476d6f+')/Attributes('+_0x5455e6+_0x5500('0xce'),'headers':{'Authorization':_0x5500('0xb1')+_0x2a83e3,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0x29898e)[_0x5500('0x1d')](function(_0x33a495){var _0x2427f5=[];_0x2427f5['push']({'name':_0x33a495['OptionSet'][_0x5500('0xcf')][_0x5500('0xca')][_0x5500('0xcd')][_0x5500('0xca')],'value':_0x5500('0xd0')},{'name':_0x33a495[_0x5500('0xd1')][_0x5500('0xd2')][_0x5500('0xca')]['UserLocalizedLabel'][_0x5500('0xca')],'value':'false'});var _0xd186ac={'id':_0x153e1b+'_'+_0x33a495[_0x5500('0xcb')],'name':_0x33a495[_0x5500('0xcc')][_0x5500('0xcd')]['Label'],'custom':![],'options':_0x2427f5};_0x2634ed[_0x5500('0xbc')](_0xd186ac);return _0x2634ed;});}function getInputList(_0x4e4c82,_0x30130e,_0x111f4c,_0x47aba8,_0x1ee00d,_0x2f3724,_0x1d5ce5){var _0xcd17be={'method':_0x5500('0xaf'),'uri':_0x4e4c82+_0x5500('0xb5')+_0x1ee00d+')/Attributes('+_0x2f3724+')/Microsoft.Dynamics.CRM.'+_0x111f4c+_0x5500('0xd3'),'headers':{'Authorization':_0x5500('0xb1')+_0x1d5ce5,'If-None-Match':null,'OData-Version':_0x5500('0xb2')},'json':!![]};return rp(_0xcd17be)[_0x5500('0x1d')](function(_0x109c93){var _0x3a82d1={'id':_0x30130e+'_'+_0x109c93[_0x5500('0xcb')],'name':_0x109c93[_0x5500('0xcc')]['UserLocalizedLabel']?_0x109c93['DisplayName'][_0x5500('0xcd')]['Label']:_0x109c93['LogicalName'],'custom':![],'options':[]};_0x47aba8[_0x5500('0xbc')](_0x3a82d1);return _0x47aba8;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e250dbd..7ec90ab 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 _0xe20c=['bluebird','rimraf','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe20c,0x9f));var _0xce20=function(_0x23adae,_0x200c34){_0x23adae=_0x23adae-0x0;var _0x52a03d=_0xe20c[_0x23adae];return _0x52a03d;};'use strict';var _=require(_0xce20('0x0'));var util=require('util');var logger=require(_0xce20('0x1'))('api');var moment=require(_0xce20('0x2'));var BPromise=require(_0xce20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce20('0x4'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0xce20('0x5')]=function(_0x5a901c,_0x115fae){return _0x5a901c[_0xce20('0x6')](_0xce20('0x7'),attributes,{'tableName':_0xce20('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf712=['../../config/logger','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1a1e57,_0x2cb6fd){var _0x177217=function(_0x403342){while(--_0x403342){_0x1a1e57['push'](_0x1a1e57['shift']());}};_0x177217(++_0x2cb6fd);}(_0xf712,0x195));var _0x2f71=function(_0x347d87,_0x18316a){_0x347d87=_0x347d87-0x0;var _0x5be66c=_0xf712[_0x347d87];return _0x5be66c;};'use strict';var _=require(_0x2f71('0x0'));var util=require(_0x2f71('0x1'));var logger=require(_0x2f71('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f71('0x4'));var config=require(_0x2f71('0x5'));var attributes=require(_0x2f71('0x6'));var integrations=require(_0x2f71('0x7'));module[_0x2f71('0x8')]=function(_0x14369d,_0x1e91c4){return _0x14369d['define'](_0x2f71('0x9'),attributes,{'tableName':_0x2f71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 440f843..f1f186b 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 _0x29eb=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','model','map','then','catch','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug'];(function(_0x2d6763,_0x62f43a){var _0x45c885=function(_0x59bfc0){while(--_0x59bfc0){_0x2d6763['push'](_0x2d6763['shift']());}};_0x45c885(++_0x62f43a);}(_0x29eb,0x1c5));var _0xb29e=function(_0x16fb70,_0x3e97f1){_0x16fb70=_0x16fb70-0x0;var _0x2e1aa1=_0x29eb[_0x16fb70];return _0x2e1aa1;};'use strict';var _=require(_0xb29e('0x0'));var util=require(_0xb29e('0x1'));var moment=require(_0xb29e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb29e('0x3'));var fs=require('fs');var Redis=require(_0xb29e('0x4'));var db=require(_0xb29e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb29e('0x6'))('rpc');var config=require(_0xb29e('0x7'));var jayson=require(_0xb29e('0x8'));var client=jayson[_0xb29e('0x9')][_0xb29e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dde31,_0x3032c3,_0x5bf1ae){return new BPromise(function(_0x1995ab,_0x29758f){return client[_0xb29e('0xb')](_0x4dde31,_0x5bf1ae)['then'](function(_0x551851){logger[_0xb29e('0xc')](_0xb29e('0xd'),_0x3032c3,'request\x20sent');logger[_0xb29e('0xe')](_0xb29e('0xf'),_0x3032c3,'request\x20sent',JSON[_0xb29e('0x10')](_0x551851));if(_0x551851[_0xb29e('0x11')]){if(_0x551851[_0xb29e('0x11')][_0xb29e('0x12')]===0x1f4){logger[_0xb29e('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x3032c3,_0x551851[_0xb29e('0x11')]['message']);return _0x29758f(_0x551851['error']['message']);}logger[_0xb29e('0x11')](_0xb29e('0xd'),_0x3032c3,_0x551851[_0xb29e('0x11')][_0xb29e('0x13')]);return _0x1995ab(_0x551851[_0xb29e('0x11')][_0xb29e('0x13')]);}else{logger['info'](_0xb29e('0xd'),_0x3032c3,_0xb29e('0x14'));_0x1995ab(_0x551851[_0xb29e('0x15')][_0xb29e('0x13')]);}})['catch'](function(_0x523341){logger[_0xb29e('0x11')](_0xb29e('0xd'),_0x3032c3,_0x523341);_0x29758f(_0x523341);});});}exports[_0xb29e('0x16')]=function(_0x355521){var _0x6049e=this;return new Promise(function(_0x107fa4,_0x426cfb){return db[_0xb29e('0x17')][_0xb29e('0x18')]({'raw':_0x355521[_0xb29e('0x19')]?_0x355521['options'][_0xb29e('0x1a')]===undefined?!![]:![]:!![],'where':_0x355521[_0xb29e('0x19')]?_0x355521[_0xb29e('0x19')]['where']||null:null,'attributes':_0x355521[_0xb29e('0x19')]?_0x355521['options'][_0xb29e('0x1b')]||null:null,'limit':_0x355521[_0xb29e('0x19')]?_0x355521[_0xb29e('0x19')][_0xb29e('0x1c')]||null:null,'include':_0x355521[_0xb29e('0x19')]?_0x355521[_0xb29e('0x19')][_0xb29e('0x1d')]?_['map'](_0x355521['options'][_0xb29e('0x1d')],function(_0xcb568b){return{'model':db[_0xcb568b[_0xb29e('0x1e')]],'as':_0xcb568b['as'],'attributes':_0xcb568b[_0xb29e('0x1b')],'include':_0xcb568b[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0xcb568b[_0xb29e('0x1d')],function(_0x5b8cee){return{'model':db[_0x5b8cee['model']],'as':_0x5b8cee['as'],'attributes':_0x5b8cee[_0xb29e('0x1b')],'include':_0x5b8cee[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0x5b8cee['include'],function(_0x58dfdc){return{'model':db[_0x58dfdc['model']],'as':_0x58dfdc['as'],'attributes':_0x58dfdc[_0xb29e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb29e('0x20')](function(_0x19a1a9){logger[_0xb29e('0xc')](_0xb29e('0x16'),_0x355521);logger[_0xb29e('0xe')](_0xb29e('0x16'),_0x355521,JSON[_0xb29e('0x10')](_0x19a1a9));_0x107fa4(_0x19a1a9);})[_0xb29e('0x21')](function(_0xc08c05){logger['error'](_0xb29e('0x16'),_0xc08c05[_0xb29e('0x13')],_0x355521);_0x426cfb(_0x6049e[_0xb29e('0x11')](0x1f4,_0xc08c05['message']));});});};exports[_0xb29e('0x22')]=function(_0xd56beb){var _0xc0d1f=this;return new Promise(function(_0x287609,_0x5448df){return db[_0xb29e('0x17')][_0xb29e('0x23')]({'raw':_0xd56beb[_0xb29e('0x19')]?_0xd56beb[_0xb29e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd56beb[_0xb29e('0x19')]?_0xd56beb[_0xb29e('0x19')]['where']||null:null,'attributes':_0xd56beb[_0xb29e('0x19')]?_0xd56beb['options'][_0xb29e('0x1b')]||null:null,'include':_0xd56beb['options']?_0xd56beb[_0xb29e('0x19')]['include']?_[_0xb29e('0x1f')](_0xd56beb['options'][_0xb29e('0x1d')],function(_0x52e051){return{'model':db[_0x52e051[_0xb29e('0x1e')]],'as':_0x52e051['as'],'attributes':_0x52e051['attributes'],'include':_0x52e051[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0x52e051['include'],function(_0x4f0ae2){return{'model':db[_0x4f0ae2[_0xb29e('0x1e')]],'as':_0x4f0ae2['as'],'attributes':_0x4f0ae2['attributes'],'include':_0x4f0ae2[_0xb29e('0x1d')]?_[_0xb29e('0x1f')](_0x4f0ae2[_0xb29e('0x1d')],function(_0x524451){return{'model':db[_0x524451['model']],'as':_0x524451['as'],'attributes':_0x524451[_0xb29e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f3bd){logger[_0xb29e('0xc')]('ShowDynamics365Account',_0xd56beb);logger[_0xb29e('0xe')]('ShowDynamics365Account',_0xd56beb,JSON['stringify'](_0x14f3bd));_0x287609(_0x14f3bd);})['catch'](function(_0xca5fde){logger[_0xb29e('0x11')]('ShowDynamics365Account',_0xca5fde[_0xb29e('0x13')],_0xd56beb);_0x5448df(_0xc0d1f[_0xb29e('0x11')](0x1f4,_0xca5fde[_0xb29e('0x13')]));});});}; \ No newline at end of file +var _0xffd6=['options','raw','limit','include','model','attributes','ShowDynamics365Account','Dynamics365Account','find','where','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','findAll'];(function(_0x3feb8a,_0x47c784){var _0x4523ca=function(_0x4fba86){while(--_0x4fba86){_0x3feb8a['push'](_0x3feb8a['shift']());}};_0x4523ca(++_0x47c784);}(_0xffd6,0x97));var _0x6ffd=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xffd6[_0x46428c];return _0x16a677;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122b71,_0xeefe34,_0x2445a0){return new BPromise(function(_0x1fbbe6,_0x1d8b50){return client['request'](_0x122b71,_0x2445a0)[_0x6ffd('0xa')](function(_0x417f34){logger['info'](_0x6ffd('0xb'),_0xeefe34,_0x6ffd('0xc'));logger[_0x6ffd('0xd')](_0x6ffd('0xe'),_0xeefe34,_0x6ffd('0xc'),JSON[_0x6ffd('0xf')](_0x417f34));if(_0x417f34[_0x6ffd('0x10')]){if(_0x417f34['error'][_0x6ffd('0x11')]===0x1f4){logger[_0x6ffd('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0xeefe34,_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);return _0x1d8b50(_0x417f34[_0x6ffd('0x10')][_0x6ffd('0x12')]);}logger['error'](_0x6ffd('0xb'),_0xeefe34,_0x417f34['error'][_0x6ffd('0x12')]);return _0x1fbbe6(_0x417f34['error'][_0x6ffd('0x12')]);}else{logger[_0x6ffd('0x13')](_0x6ffd('0xb'),_0xeefe34,'request\x20sent');_0x1fbbe6(_0x417f34[_0x6ffd('0x14')][_0x6ffd('0x12')]);}})[_0x6ffd('0x15')](function(_0x3394b2){logger[_0x6ffd('0x10')](_0x6ffd('0xb'),_0xeefe34,_0x3394b2);_0x1d8b50(_0x3394b2);});});}exports[_0x6ffd('0x16')]=function(_0x889a4b){var _0x545576=this;return new Promise(function(_0x11a609,_0x56c541){return db['Dynamics365Account'][_0x6ffd('0x17')]({'raw':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b['options'][_0x6ffd('0x19')]===undefined?!![]:![]:!![],'where':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b['options']['where']||null:null,'attributes':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b[_0x6ffd('0x18')]['attributes']||null:null,'limit':_0x889a4b[_0x6ffd('0x18')]?_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1a')]||null:null,'include':_0x889a4b['options']?_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1b')]?_['map'](_0x889a4b[_0x6ffd('0x18')][_0x6ffd('0x1b')],function(_0x50c19a){return{'model':db[_0x50c19a[_0x6ffd('0x1c')]],'as':_0x50c19a['as'],'attributes':_0x50c19a[_0x6ffd('0x1d')],'include':_0x50c19a[_0x6ffd('0x1b')]?_['map'](_0x50c19a[_0x6ffd('0x1b')],function(_0x3e5726){return{'model':db[_0x3e5726[_0x6ffd('0x1c')]],'as':_0x3e5726['as'],'attributes':_0x3e5726['attributes'],'include':_0x3e5726[_0x6ffd('0x1b')]?_['map'](_0x3e5726[_0x6ffd('0x1b')],function(_0x43269c){return{'model':db[_0x43269c['model']],'as':_0x43269c['as'],'attributes':_0x43269c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ffd('0xa')](function(_0x2a0391){logger[_0x6ffd('0x13')]('GetDynamics365Account',_0x889a4b);logger['debug'](_0x6ffd('0x16'),_0x889a4b,JSON['stringify'](_0x2a0391));_0x11a609(_0x2a0391);})[_0x6ffd('0x15')](function(_0x20c007){logger['error'](_0x6ffd('0x16'),_0x20c007[_0x6ffd('0x12')],_0x889a4b);_0x56c541(_0x545576[_0x6ffd('0x10')](0x1f4,_0x20c007[_0x6ffd('0x12')]));});});};exports[_0x6ffd('0x1e')]=function(_0x31c609){var _0x225c66=this;return new Promise(function(_0xccb8c,_0x17f627){return db[_0x6ffd('0x1f')][_0x6ffd('0x20')]({'raw':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x31c609['options']?_0x31c609['options'][_0x6ffd('0x21')]||null:null,'attributes':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1d')]||null:null,'include':_0x31c609[_0x6ffd('0x18')]?_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1b')]?_[_0x6ffd('0x22')](_0x31c609[_0x6ffd('0x18')][_0x6ffd('0x1b')],function(_0x26394c){return{'model':db[_0x26394c[_0x6ffd('0x1c')]],'as':_0x26394c['as'],'attributes':_0x26394c[_0x6ffd('0x1d')],'include':_0x26394c['include']?_[_0x6ffd('0x22')](_0x26394c[_0x6ffd('0x1b')],function(_0x2efc20){return{'model':db[_0x2efc20[_0x6ffd('0x1c')]],'as':_0x2efc20['as'],'attributes':_0x2efc20['attributes'],'include':_0x2efc20[_0x6ffd('0x1b')]?_['map'](_0x2efc20['include'],function(_0x617d52){return{'model':db[_0x617d52[_0x6ffd('0x1c')]],'as':_0x617d52['as'],'attributes':_0x617d52[_0x6ffd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6ffd('0xa')](function(_0x55e9b4){logger[_0x6ffd('0x13')]('ShowDynamics365Account',_0x31c609);logger[_0x6ffd('0xd')](_0x6ffd('0x1e'),_0x31c609,JSON[_0x6ffd('0xf')](_0x55e9b4));_0xccb8c(_0x55e9b4);})[_0x6ffd('0x15')](function(_0x23fae4){logger['error']('ShowDynamics365Account',_0x23fae4[_0x6ffd('0x12')],_0x31c609);_0x17f627(_0x225c66['error'](0x1f4,_0x23fae4[_0x6ffd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9130141..b968ff5 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 _0xfbef=['update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x10bead,_0x192426){var _0x1f0a31=function(_0x73f138){while(--_0x73f138){_0x10bead['push'](_0x10bead['shift']());}};_0x1f0a31(++_0x192426);}(_0xfbef,0x101));var _0xffbe=function(_0x6436e7,_0x58ff32){_0x6436e7=_0x6436e7-0x0;var _0xcd4ad0=_0xfbef[_0x6436e7];return _0xcd4ad0;};'use strict';var multer=require(_0xffbe('0x0'));var util=require('util');var path=require(_0xffbe('0x1'));var timeout=require('connect-timeout');var express=require(_0xffbe('0x2'));var router=express[_0xffbe('0x3')]();var auth=require(_0xffbe('0x4'));var interaction=require(_0xffbe('0x5'));var config=require(_0xffbe('0x6'));var controller=require(_0xffbe('0x7'));router[_0xffbe('0x8')]('/',auth[_0xffbe('0x9')](),controller['index']);router[_0xffbe('0x8')](_0xffbe('0xa'),auth[_0xffbe('0x9')](),controller[_0xffbe('0xb')]);router[_0xffbe('0x8')](_0xffbe('0xc'),auth[_0xffbe('0x9')](),controller[_0xffbe('0xd')]);router[_0xffbe('0x8')]('/:id/subjects',auth[_0xffbe('0x9')](),controller[_0xffbe('0xe')]);router[_0xffbe('0x8')](_0xffbe('0xf'),auth['isAuthenticated'](),controller[_0xffbe('0x10')]);router[_0xffbe('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xffbe('0x12')](_0xffbe('0xa'),auth[_0xffbe('0x9')](),controller[_0xffbe('0x13')]);router[_0xffbe('0x14')](_0xffbe('0xa'),auth['isAuthenticated'](),controller[_0xffbe('0x15')]);module[_0xffbe('0x16')]=router; \ No newline at end of file +var _0x5e8f=['index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put','/:id','delete','exports','multer','util','express','../../components/auth/service','./intDynamics365Configuration.controller','get'];(function(_0x2c59ea,_0xe7fa31){var _0x4b2f72=function(_0x296fc4){while(--_0x296fc4){_0x2c59ea['push'](_0x2c59ea['shift']());}};_0x4b2f72(++_0xe7fa31);}(_0x5e8f,0x198));var _0xf5e8=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x5e8f[_0x356127];return _0x5d4c75;};'use strict';var multer=require(_0xf5e8('0x0'));var util=require(_0xf5e8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf5e8('0x2'));var router=express['Router']();var auth=require(_0xf5e8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5e8('0x4'));router[_0xf5e8('0x5')]('/',auth['isAuthenticated'](),controller[_0xf5e8('0x6')]);router[_0xf5e8('0x5')]('/:id',auth[_0xf5e8('0x7')](),controller['show']);router[_0xf5e8('0x5')](_0xf5e8('0x8'),auth['isAuthenticated'](),controller[_0xf5e8('0x9')]);router[_0xf5e8('0x5')](_0xf5e8('0xa'),auth[_0xf5e8('0x7')](),controller[_0xf5e8('0xb')]);router[_0xf5e8('0x5')]('/:id/descriptions',auth[_0xf5e8('0x7')](),controller['getDescriptions']);router[_0xf5e8('0xc')]('/',auth['isAuthenticated'](),controller[_0xf5e8('0xd')]);router[_0xf5e8('0xe')](_0xf5e8('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf5e8('0x10')](_0xf5e8('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 68d8eaf..845cbe9 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 _0x3b72=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0xf3d5a0,_0x4c3828){var _0x1c3150=function(_0x4bb41b){while(--_0x4bb41b){_0xf3d5a0['push'](_0xf3d5a0['shift']());}};_0x1c3150(++_0x4c3828);}(_0x3b72,0x1de));var _0x23b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23b7('0x0'));module[_0x23b7('0x1')]={'name':{'type':Sequelize[_0x23b7('0x2')]},'description':{'type':Sequelize[_0x23b7('0x2')]},'ticketType':{'type':Sequelize[_0x23b7('0x3')](_0x23b7('0x4'),_0x23b7('0x5')),'defaultValue':_0x23b7('0x4')}}; \ No newline at end of file +var _0x4b9a=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x29bf3e,_0x5bc130){var _0x59a8ff=function(_0x2e0868){while(--_0x2e0868){_0x29bf3e['push'](_0x29bf3e['shift']());}};_0x59a8ff(++_0x5bc130);}(_0x4b9a,0x1b3));var _0xa4b9=function(_0x4c5d02,_0x2d72f0){_0x4c5d02=_0x4c5d02-0x0;var _0x345c58=_0x4b9a[_0x4c5d02];return _0x345c58;};'use strict';var Sequelize=require(_0xa4b9('0x0'));module[_0xa4b9('0x1')]={'name':{'type':Sequelize[_0xa4b9('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xa4b9('0x3')](_0xa4b9('0x4'),_0xa4b9('0x5')),'defaultValue':_0xa4b9('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index bbfc95c..86e0fdc 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 _0xe2ac=['../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','end','name','index','map','Dynamics365Configuration','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','findAll','show','params','include','options','find','catch','create','body','findOne','Dynamics365Field','rawAttributes','getFields','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xe03e58,_0x4e4d7a){var _0xd7b19=function(_0x11ea57){while(--_0x11ea57){_0xe03e58['push'](_0xe03e58['shift']());}};_0xd7b19(++_0x4e4d7a);}(_0xe2ac,0xa0));var _0xce2a=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xe2ac[_0x80d733];return _0x435868;};'use strict';var pdf=require(_0xce2a('0x0'));var emlformat=require(_0xce2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xce2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce2a('0x3'));var Mustache=require('mustache');var util=require(_0xce2a('0x4'));var path=require(_0xce2a('0x5'));var sox=require(_0xce2a('0x6'));var csv=require(_0xce2a('0x7'));var ejs=require(_0xce2a('0x8'));var fs=require('fs');var _=require(_0xce2a('0x9'));var squel=require(_0xce2a('0xa'));var crypto=require(_0xce2a('0xb'));var jsforce=require(_0xce2a('0xc'));var deskjs=require(_0xce2a('0xd'));var toCsv=require(_0xce2a('0x7'));var querystring=require('querystring');var Papa=require(_0xce2a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce2a('0xf'));var as=require(_0xce2a('0x10'));var hardwareService=require(_0xce2a('0x11'));var logger=require(_0xce2a('0x12'))(_0xce2a('0x13'));var utils=require(_0xce2a('0x14'));var config=require('../../config/environment');var db=require(_0xce2a('0x15'))['db'];var jayson=require(_0xce2a('0x16'));var client=jayson['client'][_0xce2a('0x17')]({'port':0x232a});function checkPasswordPattern(_0x351fea,_0x9e22bc,_0x39b2ad){if(_0x39b2ad){var _0x33c362=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c362[_0xce2a('0x18')](_0x9e22bc)){return _0x351fea;}else{throw new db[(_0xce2a('0x19'))][(_0xce2a('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 _0x351fea;}}function respondWithRpcPromise(_0x17772a,_0x434053,_0x4fd806,_0x551600){return new BPromise(function(_0x155352,_0x112cc4){var _0x503859=_0x551600||client;return _0x503859[_0xce2a('0x1b')](_0x17772a,_0x4fd806)['then'](function(_0x165bfb){logger[_0xce2a('0x1c')](_0xce2a('0x1d'),_0x434053,_0xce2a('0x1e'));logger[_0xce2a('0x1f')](_0xce2a('0x20'),_0x434053,'request\x20sent',JSON[_0xce2a('0x21')](_0x165bfb));if(_0x165bfb[_0xce2a('0x22')]){if(_0x165bfb[_0xce2a('0x22')][_0xce2a('0x23')]===0x1f4){logger['error'](_0xce2a('0x1d'),_0x434053,_0x165bfb[_0xce2a('0x22')][_0xce2a('0x24')]);return _0x112cc4(_0x165bfb[_0xce2a('0x22')][_0xce2a('0x24')]);}logger[_0xce2a('0x22')](_0xce2a('0x1d'),_0x434053,_0x165bfb['error'][_0xce2a('0x24')]);return _0x155352(_0x165bfb[_0xce2a('0x22')]['message']);}else{logger[_0xce2a('0x1c')](_0xce2a('0x1d'),_0x434053,'request\x20sent');_0x155352(_0x165bfb['result']['message']);}})['catch'](function(_0x4a8f9c){logger[_0xce2a('0x22')](_0xce2a('0x1d'),_0x434053,_0x4a8f9c);_0x112cc4(_0x4a8f9c);});});}function respondWithStatusCode(_0x3e4a8d,_0x59d38f){_0x59d38f=_0x59d38f||0xcc;return function(_0x4cfa0b){if(_0x4cfa0b){return _0x3e4a8d[_0xce2a('0x25')](_0x59d38f);}return _0x3e4a8d['status'](_0x59d38f)['end']();};}function respondWithResult(_0x3f8b9b,_0x5a39a6){_0x5a39a6=_0x5a39a6||0xc8;return function(_0x11eed6){if(_0x11eed6){return _0x3f8b9b[_0xce2a('0x26')](_0x5a39a6)[_0xce2a('0x27')](_0x11eed6);}};}function respondWithFilteredResult(_0x2baf74,_0x3ca6e2){return function(_0x5270f3){if(_0x5270f3){var _0x4f01f9=_0x5270f3['count'],_0x36f4bb=_0x3ca6e2[_0xce2a('0x28')],_0x2d391b=_0x3ca6e2[_0xce2a('0x28')]+_0x3ca6e2[_0xce2a('0x29')],_0xe11799;if(_0x2d391b>=_0x4f01f9){_0x2d391b=_0x4f01f9;_0xe11799=0xc8;}else{_0xe11799=0xce;}_0x2baf74[_0xce2a('0x26')](_0xe11799);return _0x2baf74['set'](_0xce2a('0x2a'),_0x36f4bb+'-'+_0x2d391b+'/'+_0x4f01f9)[_0xce2a('0x27')](_0x5270f3);}return null;};}function patchUpdates(_0x253969){return function(_0x4f910e){try{jsonpatch[_0xce2a('0x2b')](_0x4f910e,_0x253969,!![]);}catch(_0x532018){return BPromise['reject'](_0x532018);}return _0x4f910e[_0xce2a('0x2c')]();};}function saveUpdates(_0x5aa6a2,_0x4657e1){return function(_0x1b81e7){if(_0x1b81e7){return _0x1b81e7[_0xce2a('0x2d')](_0x5aa6a2)[_0xce2a('0x2e')](function(_0x1b2785){return _0x1b2785;});}return null;};}function removeEntity(_0xbedf2b,_0xf8f1cd){return function(_0x36b9aa){if(_0x36b9aa){return _0x36b9aa[_0xce2a('0x2f')]()['then'](function(){_0xbedf2b['status'](0xcc)[_0xce2a('0x30')]();});}};}function handleEntityNotFound(_0x24c89b,_0x3fd2a3){return function(_0x1003de){if(!_0x1003de){_0x24c89b[_0xce2a('0x25')](0x194);}return _0x1003de;};}function handleError(_0x1fa525,_0x5c4a6a){_0x5c4a6a=_0x5c4a6a||0x1f4;return function(_0x131153){logger[_0xce2a('0x22')](_0x131153['stack']);if(_0x131153[_0xce2a('0x31')]){delete _0x131153[_0xce2a('0x31')];}_0x1fa525[_0xce2a('0x26')](_0x5c4a6a)['send'](_0x131153);};}exports[_0xce2a('0x32')]=function(_0x53a978,_0x226dd6){var _0x62b332={},_0x59d9c5={},_0x71b415={'count':0x0,'rows':[]};var _0x5445e9=_[_0xce2a('0x33')](db[_0xce2a('0x34')]['rawAttributes'],function(_0x26773f){return{'name':_0x26773f[_0xce2a('0x35')],'type':_0x26773f['type'][_0xce2a('0x36')]};});_0x59d9c5[_0xce2a('0x37')]=_[_0xce2a('0x33')](_0x5445e9,_0xce2a('0x31'));_0x59d9c5['query']=_[_0xce2a('0x38')](_0x53a978[_0xce2a('0x39')]);_0x59d9c5[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x59d9c5[_0xce2a('0x37')],_0x59d9c5[_0xce2a('0x39')]);_0x62b332[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x59d9c5[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x53a978[_0xce2a('0x39')]['fields']));_0x62b332['attributes']=_0x62b332['attributes'][_0xce2a('0x3e')]?_0x62b332['attributes']:_0x59d9c5[_0xce2a('0x37')];if(!_0x53a978['query']['hasOwnProperty'](_0xce2a('0x3f'))){_0x62b332[_0xce2a('0x29')]=qs[_0xce2a('0x29')](_0x53a978['query'][_0xce2a('0x29')]);_0x62b332['offset']=qs[_0xce2a('0x28')](_0x53a978[_0xce2a('0x39')][_0xce2a('0x28')]);}_0x62b332[_0xce2a('0x40')]=qs[_0xce2a('0x41')](_0x53a978[_0xce2a('0x39')][_0xce2a('0x41')]);_0x62b332['where']=qs[_0xce2a('0x3a')](_[_0xce2a('0x42')](_0x53a978['query'],_0x59d9c5['filters']),_0x5445e9);if(_0x53a978[_0xce2a('0x39')][_0xce2a('0x43')]){_0x62b332[_0xce2a('0x44')]=_[_0xce2a('0x45')](_0x62b332['where'],{'$or':_[_0xce2a('0x33')](_0x5445e9,function(_0x3a4b13){if(_0x3a4b13[_0xce2a('0x46')]!==_0xce2a('0x47')){var _0x4ee26b={};_0x4ee26b[_0x3a4b13[_0xce2a('0x31')]]={'$like':'%'+_0x53a978[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x4ee26b;}})});}_0x62b332=_[_0xce2a('0x45')]({},_0x62b332,_0x53a978['options']);var _0x165de9={'where':_0x62b332[_0xce2a('0x44')]};return db['Dynamics365Configuration'][_0xce2a('0x48')](_0x165de9)[_0xce2a('0x2e')](function(_0x1ec74a){_0x71b415[_0xce2a('0x48')]=_0x1ec74a;if(_0x53a978['query'][_0xce2a('0x49')]){_0x62b332['include']=[{'all':!![]}];}return db[_0xce2a('0x34')][_0xce2a('0x4a')](_0x62b332);})[_0xce2a('0x2e')](function(_0x3976b2){_0x71b415['rows']=_0x3976b2;return _0x71b415;})['then'](respondWithFilteredResult(_0x226dd6,_0x62b332))['catch'](handleError(_0x226dd6,null));};exports[_0xce2a('0x4b')]=function(_0x2c7f72,_0x2b7222){var _0x431d1c={'raw':![],'where':{'id':_0x2c7f72[_0xce2a('0x4c')]['id']}},_0x2cf442={};_0x2cf442[_0xce2a('0x37')]=_[_0xce2a('0x38')](db['Dynamics365Configuration']['rawAttributes']);_0x2cf442['query']=_[_0xce2a('0x38')](_0x2c7f72[_0xce2a('0x39')]);_0x2cf442[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x2cf442['model'],_0x2cf442[_0xce2a('0x39')]);_0x431d1c[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x2cf442[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x2c7f72['query']['fields']));_0x431d1c['attributes']=_0x431d1c[_0xce2a('0x3c')][_0xce2a('0x3e')]?_0x431d1c[_0xce2a('0x3c')]:_0x2cf442[_0xce2a('0x37')];if(_0x2c7f72[_0xce2a('0x39')][_0xce2a('0x49')]){_0x431d1c[_0xce2a('0x4d')]=[{'all':!![]}];}_0x431d1c=_[_0xce2a('0x45')]({},_0x431d1c,_0x2c7f72[_0xce2a('0x4e')]);return db[_0xce2a('0x34')][_0xce2a('0x4f')](_0x431d1c)['then'](handleEntityNotFound(_0x2b7222,null))[_0xce2a('0x2e')](respondWithResult(_0x2b7222,null))[_0xce2a('0x50')](handleError(_0x2b7222,null));};exports[_0xce2a('0x51')]=function(_0x3901c7,_0x2feb06){return db['Dynamics365Configuration'][_0xce2a('0x51')](_0x3901c7[_0xce2a('0x52')],{})[_0xce2a('0x2e')](respondWithResult(_0x2feb06,0xc9))[_0xce2a('0x50')](handleError(_0x2feb06,null));};exports[_0xce2a('0x2d')]=function(_0x4f41dd,_0x4ed31f){if(_0x4f41dd[_0xce2a('0x52')]['id']){delete _0x4f41dd['body']['id'];}return db[_0xce2a('0x34')][_0xce2a('0x4f')]({'where':{'id':_0x4f41dd[_0xce2a('0x4c')]['id']}})[_0xce2a('0x2e')](handleEntityNotFound(_0x4ed31f,null))[_0xce2a('0x2e')](saveUpdates(_0x4f41dd['body'],null))['then'](respondWithResult(_0x4ed31f,null))[_0xce2a('0x50')](handleError(_0x4ed31f,null));};exports[_0xce2a('0x2f')]=function(_0x1d6140,_0x2f07c7){return db[_0xce2a('0x34')]['find']({'where':{'id':_0x1d6140['params']['id']}})['then'](handleEntityNotFound(_0x2f07c7,null))[_0xce2a('0x2e')](removeEntity(_0x2f07c7,null))[_0xce2a('0x50')](handleError(_0x2f07c7,null));};exports['getFields']=function(_0x2f25a8,_0x54625a,_0x16c2e1){var _0xe4e220={};var _0x2dab2f={};var _0x18c18e;var _0x16549a;return db[_0xce2a('0x34')][_0xce2a('0x53')]({'where':{'id':_0x2f25a8[_0xce2a('0x4c')]['id']}})[_0xce2a('0x2e')](handleEntityNotFound(_0x54625a,null))['then'](function(_0x32fcba){if(_0x32fcba){_0x18c18e=_0x32fcba;_0x2dab2f[_0xce2a('0x37')]=_[_0xce2a('0x38')](db[_0xce2a('0x54')][_0xce2a('0x55')]);_0x2dab2f[_0xce2a('0x39')]=_[_0xce2a('0x38')](_0x2f25a8[_0xce2a('0x39')]);_0x2dab2f['filters']=_[_0xce2a('0x3b')](_0x2dab2f[_0xce2a('0x37')],_0x2dab2f['query']);_0xe4e220[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x2dab2f[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x3d')]));_0xe4e220[_0xce2a('0x3c')]=_0xe4e220[_0xce2a('0x3c')]['length']?_0xe4e220[_0xce2a('0x3c')]:_0x2dab2f['model'];_0xe4e220['order']=qs[_0xce2a('0x41')](_0x2f25a8['query']['sort']);_0xe4e220[_0xce2a('0x44')]=qs['filters'](_[_0xce2a('0x42')](_0x2f25a8[_0xce2a('0x39')],_0x2dab2f[_0xce2a('0x3a')]));if(_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x43')]){_0xe4e220['where']=_[_0xce2a('0x45')](_0xe4e220[_0xce2a('0x44')],{'$or':_['map'](_0xe4e220[_0xce2a('0x3c')],function(_0x3ba2b8){var _0x41ddd3={};_0x41ddd3[_0x3ba2b8]={'$like':'%'+_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x41ddd3;})});}_0xe4e220=_[_0xce2a('0x45')]({},_0xe4e220,_0x2f25a8[_0xce2a('0x4e')]);return _0x18c18e[_0xce2a('0x56')](_0xe4e220);}})['then'](function(_0x7e990f){if(_0x7e990f){_0x16549a=_0x7e990f[_0xce2a('0x3e')];if(!_0x2f25a8[_0xce2a('0x39')]['hasOwnProperty']('nolimit')){_0xe4e220[_0xce2a('0x29')]=qs[_0xce2a('0x29')](_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x29')]);_0xe4e220['offset']=qs[_0xce2a('0x28')](_0x2f25a8[_0xce2a('0x39')][_0xce2a('0x28')]);}return _0x18c18e[_0xce2a('0x56')](_0xe4e220);}})[_0xce2a('0x2e')](function(_0x4676c8){if(_0x4676c8){return _0x4676c8?{'count':_0x16549a,'rows':_0x4676c8}:null;}})['then'](respondWithResult(_0x54625a,null))[_0xce2a('0x50')](handleError(_0x54625a,null));};exports['getSubjects']=function(_0x18a3ca,_0x22c7b0,_0xe6dc1c){var _0x44c0f2={};var _0x38b6b9={};var _0x20310a;var _0x239855;return db[_0xce2a('0x34')]['findOne']({'where':{'id':_0x18a3ca['params']['id']}})[_0xce2a('0x2e')](handleEntityNotFound(_0x22c7b0,null))['then'](function(_0x170a1f){if(_0x170a1f){_0x20310a=_0x170a1f;_0x38b6b9[_0xce2a('0x37')]=_['keys'](db['Dynamics365Field'][_0xce2a('0x55')]);_0x38b6b9[_0xce2a('0x39')]=_['keys'](_0x18a3ca['query']);_0x38b6b9[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x38b6b9[_0xce2a('0x37')],_0x38b6b9[_0xce2a('0x39')]);_0x44c0f2[_0xce2a('0x3c')]=_[_0xce2a('0x3b')](_0x38b6b9[_0xce2a('0x37')],qs[_0xce2a('0x3d')](_0x18a3ca['query']['fields']));_0x44c0f2['attributes']=_0x44c0f2[_0xce2a('0x3c')][_0xce2a('0x3e')]?_0x44c0f2[_0xce2a('0x3c')]:_0x38b6b9[_0xce2a('0x37')];_0x44c0f2[_0xce2a('0x40')]=qs['sort'](_0x18a3ca['query']['sort']);_0x44c0f2[_0xce2a('0x44')]=qs[_0xce2a('0x3a')](_[_0xce2a('0x42')](_0x18a3ca[_0xce2a('0x39')],_0x38b6b9[_0xce2a('0x3a')]));if(_0x18a3ca['query'][_0xce2a('0x43')]){_0x44c0f2[_0xce2a('0x44')]=_[_0xce2a('0x45')](_0x44c0f2['where'],{'$or':_['map'](_0x44c0f2['attributes'],function(_0x4e9b8c){var _0x5a0b19={};_0x5a0b19[_0x4e9b8c]={'$like':'%'+_0x18a3ca[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x5a0b19;})});}_0x44c0f2=_[_0xce2a('0x45')]({},_0x44c0f2,_0x18a3ca[_0xce2a('0x4e')]);return _0x20310a['getSubjects'](_0x44c0f2);}})['then'](function(_0x307441){if(_0x307441){_0x239855=_0x307441['length'];if(!_0x18a3ca[_0xce2a('0x39')][_0xce2a('0x57')](_0xce2a('0x3f'))){_0x44c0f2['limit']=qs[_0xce2a('0x29')](_0x18a3ca['query'][_0xce2a('0x29')]);_0x44c0f2[_0xce2a('0x28')]=qs[_0xce2a('0x28')](_0x18a3ca['query'][_0xce2a('0x28')]);}return _0x20310a[_0xce2a('0x58')](_0x44c0f2);}})[_0xce2a('0x2e')](function(_0xffb3de){if(_0xffb3de){return _0xffb3de?{'count':_0x239855,'rows':_0xffb3de}:null;}})[_0xce2a('0x2e')](respondWithResult(_0x22c7b0,null))[_0xce2a('0x50')](handleError(_0x22c7b0,null));};exports[_0xce2a('0x59')]=function(_0x3759bb,_0x2887d2,_0x1bfe23){var _0x35597c={};var _0x5cb2f3={};var _0x4e4f4a;var _0x48efdf;return db[_0xce2a('0x34')][_0xce2a('0x53')]({'where':{'id':_0x3759bb['params']['id']}})['then'](handleEntityNotFound(_0x2887d2,null))['then'](function(_0x1a8bd8){if(_0x1a8bd8){_0x4e4f4a=_0x1a8bd8;_0x5cb2f3[_0xce2a('0x37')]=_[_0xce2a('0x38')](db[_0xce2a('0x54')]['rawAttributes']);_0x5cb2f3[_0xce2a('0x39')]=_[_0xce2a('0x38')](_0x3759bb[_0xce2a('0x39')]);_0x5cb2f3[_0xce2a('0x3a')]=_[_0xce2a('0x3b')](_0x5cb2f3['model'],_0x5cb2f3['query']);_0x35597c[_0xce2a('0x3c')]=_['intersection'](_0x5cb2f3[_0xce2a('0x37')],qs['fields'](_0x3759bb['query'][_0xce2a('0x3d')]));_0x35597c[_0xce2a('0x3c')]=_0x35597c['attributes'][_0xce2a('0x3e')]?_0x35597c[_0xce2a('0x3c')]:_0x5cb2f3['model'];_0x35597c[_0xce2a('0x40')]=qs['sort'](_0x3759bb['query'][_0xce2a('0x41')]);_0x35597c['where']=qs[_0xce2a('0x3a')](_['pick'](_0x3759bb['query'],_0x5cb2f3[_0xce2a('0x3a')]));if(_0x3759bb['query'][_0xce2a('0x43')]){_0x35597c[_0xce2a('0x44')]=_['merge'](_0x35597c[_0xce2a('0x44')],{'$or':_['map'](_0x35597c[_0xce2a('0x3c')],function(_0x2d79ec){var _0x46fddd={};_0x46fddd[_0x2d79ec]={'$like':'%'+_0x3759bb[_0xce2a('0x39')][_0xce2a('0x43')]+'%'};return _0x46fddd;})});}_0x35597c=_['merge']({},_0x35597c,_0x3759bb[_0xce2a('0x4e')]);return _0x4e4f4a['getDescriptions'](_0x35597c);}})[_0xce2a('0x2e')](function(_0x63a6f8){if(_0x63a6f8){_0x48efdf=_0x63a6f8[_0xce2a('0x3e')];if(!_0x3759bb[_0xce2a('0x39')]['hasOwnProperty'](_0xce2a('0x3f'))){_0x35597c[_0xce2a('0x29')]=qs[_0xce2a('0x29')](_0x3759bb[_0xce2a('0x39')]['limit']);_0x35597c[_0xce2a('0x28')]=qs[_0xce2a('0x28')](_0x3759bb[_0xce2a('0x39')]['offset']);}return _0x4e4f4a[_0xce2a('0x59')](_0x35597c);}})['then'](function(_0x34cbcc){if(_0x34cbcc){return _0x34cbcc?{'count':_0x48efdf,'rows':_0x34cbcc}:null;}})[_0xce2a('0x2e')](respondWithResult(_0x2887d2,null))[_0xce2a('0x50')](handleError(_0x2887d2,null));}; \ No newline at end of file +var _0xc0dc=['keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','rawAttributes','find','create','body','params','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','save','update','then','name','send','index','map','Dynamics365Configuration','type','key','model','query'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0xc0dc,0x1d1));var _0xcc0d=function(_0xef4c88,_0xad688d){_0xef4c88=_0xef4c88-0x0;var _0x43c2a8=_0xc0dc[_0xef4c88];return _0x43c2a8;};'use strict';var pdf=require(_0xcc0d('0x0'));var emlformat=require(_0xcc0d('0x1'));var rimraf=require(_0xcc0d('0x2'));var zipdir=require(_0xcc0d('0x3'));var jsonpatch=require(_0xcc0d('0x4'));var rp=require('request-promise');var moment=require(_0xcc0d('0x5'));var BPromise=require(_0xcc0d('0x6'));var Mustache=require(_0xcc0d('0x7'));var util=require('util');var path=require(_0xcc0d('0x8'));var sox=require(_0xcc0d('0x9'));var csv=require(_0xcc0d('0xa'));var ejs=require(_0xcc0d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcc0d('0xd'));var toCsv=require(_0xcc0d('0xa'));var querystring=require(_0xcc0d('0xe'));var Papa=require(_0xcc0d('0xf'));var Redis=require(_0xcc0d('0x10'));var authService=require(_0xcc0d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc0d('0x12'))(_0xcc0d('0x13'));var utils=require(_0xcc0d('0x14'));var config=require(_0xcc0d('0x15'));var db=require(_0xcc0d('0x16'))['db'];var jayson=require(_0xcc0d('0x17'));var client=jayson[_0xcc0d('0x18')][_0xcc0d('0x19')]({'port':0x232a});function checkPasswordPattern(_0x520fea,_0x544b13,_0x3510c8){if(_0x3510c8){var _0x592dad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x592dad['test'](_0x544b13)){return _0x520fea;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x520fea;}}function respondWithRpcPromise(_0x35f914,_0x55c5f7,_0x2a7175,_0x17069c){return new BPromise(function(_0xfd03d2,_0x13502e){var _0xf83a0d=_0x17069c||client;return _0xf83a0d[_0xcc0d('0x1a')](_0x35f914,_0x2a7175)['then'](function(_0x3e3623){logger[_0xcc0d('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x55c5f7,_0xcc0d('0x1c'));logger[_0xcc0d('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x55c5f7,'request\x20sent',JSON[_0xcc0d('0x1e')](_0x3e3623));if(_0x3e3623[_0xcc0d('0x1f')]){if(_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x20')]===0x1f4){logger[_0xcc0d('0x1f')](_0xcc0d('0x21'),_0x55c5f7,_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);return _0x13502e(_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);}logger[_0xcc0d('0x1f')](_0xcc0d('0x21'),_0x55c5f7,_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);return _0xfd03d2(_0x3e3623[_0xcc0d('0x1f')][_0xcc0d('0x22')]);}else{logger[_0xcc0d('0x1b')](_0xcc0d('0x21'),_0x55c5f7,_0xcc0d('0x1c'));_0xfd03d2(_0x3e3623[_0xcc0d('0x23')][_0xcc0d('0x22')]);}})[_0xcc0d('0x24')](function(_0x44453a){logger[_0xcc0d('0x1f')](_0xcc0d('0x21'),_0x55c5f7,_0x44453a);_0x13502e(_0x44453a);});});}function respondWithStatusCode(_0x3210d5,_0x1c4bab){_0x1c4bab=_0x1c4bab||0xcc;return function(_0x5ae964){if(_0x5ae964){return _0x3210d5[_0xcc0d('0x25')](_0x1c4bab);}return _0x3210d5['status'](_0x1c4bab)[_0xcc0d('0x26')]();};}function respondWithResult(_0x2dfe10,_0x5a7188){_0x5a7188=_0x5a7188||0xc8;return function(_0x2414d2){if(_0x2414d2){return _0x2dfe10[_0xcc0d('0x27')](_0x5a7188)[_0xcc0d('0x28')](_0x2414d2);}};}function respondWithFilteredResult(_0x51a3d8,_0x2705d8){return function(_0x1fd377){if(_0x1fd377){var _0x5944ac=_0x1fd377[_0xcc0d('0x29')],_0x528e0b=_0x2705d8[_0xcc0d('0x2a')],_0x48d4a1=_0x2705d8['offset']+_0x2705d8[_0xcc0d('0x2b')],_0xedfce1;if(_0x48d4a1>=_0x5944ac){_0x48d4a1=_0x5944ac;_0xedfce1=0xc8;}else{_0xedfce1=0xce;}_0x51a3d8[_0xcc0d('0x27')](_0xedfce1);return _0x51a3d8['set'](_0xcc0d('0x2c'),_0x528e0b+'-'+_0x48d4a1+'/'+_0x5944ac)[_0xcc0d('0x28')](_0x1fd377);}return null;};}function patchUpdates(_0x443acb){return function(_0x299ce7){try{jsonpatch['apply'](_0x299ce7,_0x443acb,!![]);}catch(_0x5a2dd3){return BPromise['reject'](_0x5a2dd3);}return _0x299ce7[_0xcc0d('0x2d')]();};}function saveUpdates(_0x5273d1,_0x4256b8){return function(_0x19bc08){if(_0x19bc08){return _0x19bc08[_0xcc0d('0x2e')](_0x5273d1)[_0xcc0d('0x2f')](function(_0x2f0b48){return _0x2f0b48;});}return null;};}function removeEntity(_0x199ec2,_0x221371){return function(_0xc8584e){if(_0xc8584e){return _0xc8584e['destroy']()['then'](function(){_0x199ec2[_0xcc0d('0x27')](0xcc)[_0xcc0d('0x26')]();});}};}function handleEntityNotFound(_0x160a3e,_0x39c285){return function(_0x5118b8){if(!_0x5118b8){_0x160a3e[_0xcc0d('0x25')](0x194);}return _0x5118b8;};}function handleError(_0x2dfb27,_0x5aecd8){_0x5aecd8=_0x5aecd8||0x1f4;return function(_0x5dffd3){logger[_0xcc0d('0x1f')](_0x5dffd3['stack']);if(_0x5dffd3[_0xcc0d('0x30')]){delete _0x5dffd3['name'];}_0x2dfb27[_0xcc0d('0x27')](_0x5aecd8)[_0xcc0d('0x31')](_0x5dffd3);};}exports[_0xcc0d('0x32')]=function(_0x44388e,_0xdb337){var _0x395db0={},_0x7624f9={},_0x1a3bd5={'count':0x0,'rows':[]};var _0x5832a9=_[_0xcc0d('0x33')](db[_0xcc0d('0x34')]['rawAttributes'],function(_0x306acf){return{'name':_0x306acf['fieldName'],'type':_0x306acf[_0xcc0d('0x35')][_0xcc0d('0x36')]};});_0x7624f9[_0xcc0d('0x37')]=_['map'](_0x5832a9,_0xcc0d('0x30'));_0x7624f9[_0xcc0d('0x38')]=_[_0xcc0d('0x39')](_0x44388e['query']);_0x7624f9[_0xcc0d('0x3a')]=_['intersection'](_0x7624f9['model'],_0x7624f9[_0xcc0d('0x38')]);_0x395db0[_0xcc0d('0x3b')]=_[_0xcc0d('0x3c')](_0x7624f9['model'],qs[_0xcc0d('0x3d')](_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x3d')]));_0x395db0[_0xcc0d('0x3b')]=_0x395db0[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x395db0[_0xcc0d('0x3b')]:_0x7624f9[_0xcc0d('0x37')];if(!_0x44388e['query']['hasOwnProperty'](_0xcc0d('0x3f'))){_0x395db0[_0xcc0d('0x2b')]=qs[_0xcc0d('0x2b')](_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x2b')]);_0x395db0['offset']=qs[_0xcc0d('0x2a')](_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x2a')]);}_0x395db0[_0xcc0d('0x40')]=qs[_0xcc0d('0x41')](_0x44388e[_0xcc0d('0x38')]['sort']);_0x395db0[_0xcc0d('0x42')]=qs[_0xcc0d('0x3a')](_[_0xcc0d('0x43')](_0x44388e[_0xcc0d('0x38')],_0x7624f9[_0xcc0d('0x3a')]),_0x5832a9);if(_0x44388e['query'][_0xcc0d('0x44')]){_0x395db0['where']=_[_0xcc0d('0x45')](_0x395db0['where'],{'$or':_[_0xcc0d('0x33')](_0x5832a9,function(_0x410c6e){if(_0x410c6e['type']!==_0xcc0d('0x46')){var _0x45f7a0={};_0x45f7a0[_0x410c6e[_0xcc0d('0x30')]]={'$like':'%'+_0x44388e[_0xcc0d('0x38')][_0xcc0d('0x44')]+'%'};return _0x45f7a0;}})});}_0x395db0=_['merge']({},_0x395db0,_0x44388e[_0xcc0d('0x47')]);var _0x2232d2={'where':_0x395db0[_0xcc0d('0x42')]};return db[_0xcc0d('0x34')][_0xcc0d('0x29')](_0x2232d2)[_0xcc0d('0x2f')](function(_0x54fd59){_0x1a3bd5['count']=_0x54fd59;if(_0x44388e['query']['includeAll']){_0x395db0[_0xcc0d('0x48')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xcc0d('0x49')](_0x395db0);})[_0xcc0d('0x2f')](function(_0x132ecd){_0x1a3bd5[_0xcc0d('0x4a')]=_0x132ecd;return _0x1a3bd5;})['then'](respondWithFilteredResult(_0xdb337,_0x395db0))['catch'](handleError(_0xdb337,null));};exports['show']=function(_0x584a74,_0x75c0c7){var _0x176239={'raw':![],'where':{'id':_0x584a74['params']['id']}},_0x46d3f7={};_0x46d3f7[_0xcc0d('0x37')]=_[_0xcc0d('0x39')](db['Dynamics365Configuration'][_0xcc0d('0x4b')]);_0x46d3f7[_0xcc0d('0x38')]=_[_0xcc0d('0x39')](_0x584a74[_0xcc0d('0x38')]);_0x46d3f7[_0xcc0d('0x3a')]=_[_0xcc0d('0x3c')](_0x46d3f7['model'],_0x46d3f7[_0xcc0d('0x38')]);_0x176239[_0xcc0d('0x3b')]=_['intersection'](_0x46d3f7[_0xcc0d('0x37')],qs[_0xcc0d('0x3d')](_0x584a74[_0xcc0d('0x38')][_0xcc0d('0x3d')]));_0x176239['attributes']=_0x176239[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x176239[_0xcc0d('0x3b')]:_0x46d3f7[_0xcc0d('0x37')];if(_0x584a74[_0xcc0d('0x38')]['includeAll']){_0x176239[_0xcc0d('0x48')]=[{'all':!![]}];}_0x176239=_[_0xcc0d('0x45')]({},_0x176239,_0x584a74[_0xcc0d('0x47')]);return db[_0xcc0d('0x34')][_0xcc0d('0x4c')](_0x176239)[_0xcc0d('0x2f')](handleEntityNotFound(_0x75c0c7,null))[_0xcc0d('0x2f')](respondWithResult(_0x75c0c7,null))[_0xcc0d('0x24')](handleError(_0x75c0c7,null));};exports[_0xcc0d('0x4d')]=function(_0x7a965b,_0x338e28){return db[_0xcc0d('0x34')][_0xcc0d('0x4d')](_0x7a965b['body'],{})[_0xcc0d('0x2f')](respondWithResult(_0x338e28,0xc9))[_0xcc0d('0x24')](handleError(_0x338e28,null));};exports['update']=function(_0x3aa1ed,_0x4653ba){if(_0x3aa1ed[_0xcc0d('0x4e')]['id']){delete _0x3aa1ed['body']['id'];}return db['Dynamics365Configuration'][_0xcc0d('0x4c')]({'where':{'id':_0x3aa1ed[_0xcc0d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4653ba,null))[_0xcc0d('0x2f')](saveUpdates(_0x3aa1ed[_0xcc0d('0x4e')],null))['then'](respondWithResult(_0x4653ba,null))['catch'](handleError(_0x4653ba,null));};exports[_0xcc0d('0x50')]=function(_0x438301,_0x3d0c26){return db[_0xcc0d('0x34')][_0xcc0d('0x4c')]({'where':{'id':_0x438301[_0xcc0d('0x4f')]['id']}})[_0xcc0d('0x2f')](handleEntityNotFound(_0x3d0c26,null))['then'](removeEntity(_0x3d0c26,null))[_0xcc0d('0x24')](handleError(_0x3d0c26,null));};exports[_0xcc0d('0x51')]=function(_0x58e3f5,_0x2c2d21,_0x23e333){var _0x17934d={};var _0x35dca1={};var _0x5c3cc0;var _0x48eee0;return db[_0xcc0d('0x34')]['findOne']({'where':{'id':_0x58e3f5[_0xcc0d('0x4f')]['id']}})[_0xcc0d('0x2f')](handleEntityNotFound(_0x2c2d21,null))[_0xcc0d('0x2f')](function(_0x308b54){if(_0x308b54){_0x5c3cc0=_0x308b54;_0x35dca1['model']=_['keys'](db[_0xcc0d('0x52')][_0xcc0d('0x4b')]);_0x35dca1[_0xcc0d('0x38')]=_[_0xcc0d('0x39')](_0x58e3f5['query']);_0x35dca1[_0xcc0d('0x3a')]=_['intersection'](_0x35dca1[_0xcc0d('0x37')],_0x35dca1[_0xcc0d('0x38')]);_0x17934d[_0xcc0d('0x3b')]=_[_0xcc0d('0x3c')](_0x35dca1['model'],qs[_0xcc0d('0x3d')](_0x58e3f5[_0xcc0d('0x38')]['fields']));_0x17934d[_0xcc0d('0x3b')]=_0x17934d[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x17934d[_0xcc0d('0x3b')]:_0x35dca1[_0xcc0d('0x37')];_0x17934d['order']=qs[_0xcc0d('0x41')](_0x58e3f5[_0xcc0d('0x38')][_0xcc0d('0x41')]);_0x17934d['where']=qs[_0xcc0d('0x3a')](_['pick'](_0x58e3f5['query'],_0x35dca1[_0xcc0d('0x3a')]));if(_0x58e3f5[_0xcc0d('0x38')][_0xcc0d('0x44')]){_0x17934d['where']=_['merge'](_0x17934d[_0xcc0d('0x42')],{'$or':_['map'](_0x17934d[_0xcc0d('0x3b')],function(_0xc098e5){var _0x37298e={};_0x37298e[_0xc098e5]={'$like':'%'+_0x58e3f5['query'][_0xcc0d('0x44')]+'%'};return _0x37298e;})});}_0x17934d=_[_0xcc0d('0x45')]({},_0x17934d,_0x58e3f5['options']);return _0x5c3cc0['getFields'](_0x17934d);}})[_0xcc0d('0x2f')](function(_0xeeb60a){if(_0xeeb60a){_0x48eee0=_0xeeb60a[_0xcc0d('0x3e')];if(!_0x58e3f5[_0xcc0d('0x38')]['hasOwnProperty'](_0xcc0d('0x3f'))){_0x17934d['limit']=qs[_0xcc0d('0x2b')](_0x58e3f5[_0xcc0d('0x38')][_0xcc0d('0x2b')]);_0x17934d[_0xcc0d('0x2a')]=qs[_0xcc0d('0x2a')](_0x58e3f5[_0xcc0d('0x38')]['offset']);}return _0x5c3cc0[_0xcc0d('0x51')](_0x17934d);}})[_0xcc0d('0x2f')](function(_0xf5ddea){if(_0xf5ddea){return _0xf5ddea?{'count':_0x48eee0,'rows':_0xf5ddea}:null;}})[_0xcc0d('0x2f')](respondWithResult(_0x2c2d21,null))[_0xcc0d('0x24')](handleError(_0x2c2d21,null));};exports['getSubjects']=function(_0x4e169f,_0x3b2fe7,_0x2fc377){var _0x1d6c1b={};var _0x2219bf={};var _0x596956;var _0x48495d;return db[_0xcc0d('0x34')]['findOne']({'where':{'id':_0x4e169f[_0xcc0d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b2fe7,null))[_0xcc0d('0x2f')](function(_0x4c8bb5){if(_0x4c8bb5){_0x596956=_0x4c8bb5;_0x2219bf[_0xcc0d('0x37')]=_['keys'](db[_0xcc0d('0x52')][_0xcc0d('0x4b')]);_0x2219bf[_0xcc0d('0x38')]=_['keys'](_0x4e169f[_0xcc0d('0x38')]);_0x2219bf[_0xcc0d('0x3a')]=_['intersection'](_0x2219bf[_0xcc0d('0x37')],_0x2219bf[_0xcc0d('0x38')]);_0x1d6c1b[_0xcc0d('0x3b')]=_[_0xcc0d('0x3c')](_0x2219bf[_0xcc0d('0x37')],qs[_0xcc0d('0x3d')](_0x4e169f['query'][_0xcc0d('0x3d')]));_0x1d6c1b[_0xcc0d('0x3b')]=_0x1d6c1b[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x1d6c1b[_0xcc0d('0x3b')]:_0x2219bf['model'];_0x1d6c1b['order']=qs['sort'](_0x4e169f['query'][_0xcc0d('0x41')]);_0x1d6c1b[_0xcc0d('0x42')]=qs['filters'](_[_0xcc0d('0x43')](_0x4e169f[_0xcc0d('0x38')],_0x2219bf['filters']));if(_0x4e169f['query'][_0xcc0d('0x44')]){_0x1d6c1b[_0xcc0d('0x42')]=_[_0xcc0d('0x45')](_0x1d6c1b[_0xcc0d('0x42')],{'$or':_[_0xcc0d('0x33')](_0x1d6c1b['attributes'],function(_0x58d34e){var _0x5e90b1={};_0x5e90b1[_0x58d34e]={'$like':'%'+_0x4e169f[_0xcc0d('0x38')]['filter']+'%'};return _0x5e90b1;})});}_0x1d6c1b=_[_0xcc0d('0x45')]({},_0x1d6c1b,_0x4e169f[_0xcc0d('0x47')]);return _0x596956[_0xcc0d('0x53')](_0x1d6c1b);}})[_0xcc0d('0x2f')](function(_0xb44bfa){if(_0xb44bfa){_0x48495d=_0xb44bfa['length'];if(!_0x4e169f['query']['hasOwnProperty'](_0xcc0d('0x3f'))){_0x1d6c1b[_0xcc0d('0x2b')]=qs[_0xcc0d('0x2b')](_0x4e169f[_0xcc0d('0x38')][_0xcc0d('0x2b')]);_0x1d6c1b['offset']=qs[_0xcc0d('0x2a')](_0x4e169f['query']['offset']);}return _0x596956[_0xcc0d('0x53')](_0x1d6c1b);}})[_0xcc0d('0x2f')](function(_0x873a2a){if(_0x873a2a){return _0x873a2a?{'count':_0x48495d,'rows':_0x873a2a}:null;}})['then'](respondWithResult(_0x3b2fe7,null))['catch'](handleError(_0x3b2fe7,null));};exports['getDescriptions']=function(_0x524d52,_0x2ee904,_0x2fbcd1){var _0x3b809b={};var _0x3b09a9={};var _0x319b69;var _0x4fde72;return db['Dynamics365Configuration'][_0xcc0d('0x54')]({'where':{'id':_0x524d52['params']['id']}})['then'](handleEntityNotFound(_0x2ee904,null))[_0xcc0d('0x2f')](function(_0x42ea0b){if(_0x42ea0b){_0x319b69=_0x42ea0b;_0x3b09a9[_0xcc0d('0x37')]=_[_0xcc0d('0x39')](db[_0xcc0d('0x52')][_0xcc0d('0x4b')]);_0x3b09a9[_0xcc0d('0x38')]=_['keys'](_0x524d52[_0xcc0d('0x38')]);_0x3b09a9[_0xcc0d('0x3a')]=_[_0xcc0d('0x3c')](_0x3b09a9[_0xcc0d('0x37')],_0x3b09a9[_0xcc0d('0x38')]);_0x3b809b['attributes']=_[_0xcc0d('0x3c')](_0x3b09a9['model'],qs[_0xcc0d('0x3d')](_0x524d52[_0xcc0d('0x38')]['fields']));_0x3b809b[_0xcc0d('0x3b')]=_0x3b809b[_0xcc0d('0x3b')][_0xcc0d('0x3e')]?_0x3b809b['attributes']:_0x3b09a9['model'];_0x3b809b[_0xcc0d('0x40')]=qs['sort'](_0x524d52['query']['sort']);_0x3b809b[_0xcc0d('0x42')]=qs[_0xcc0d('0x3a')](_['pick'](_0x524d52[_0xcc0d('0x38')],_0x3b09a9[_0xcc0d('0x3a')]));if(_0x524d52['query'][_0xcc0d('0x44')]){_0x3b809b['where']=_[_0xcc0d('0x45')](_0x3b809b[_0xcc0d('0x42')],{'$or':_[_0xcc0d('0x33')](_0x3b809b[_0xcc0d('0x3b')],function(_0x628742){var _0x3d6fcd={};_0x3d6fcd[_0x628742]={'$like':'%'+_0x524d52[_0xcc0d('0x38')][_0xcc0d('0x44')]+'%'};return _0x3d6fcd;})});}_0x3b809b=_[_0xcc0d('0x45')]({},_0x3b809b,_0x524d52[_0xcc0d('0x47')]);return _0x319b69[_0xcc0d('0x55')](_0x3b809b);}})[_0xcc0d('0x2f')](function(_0x4105af){if(_0x4105af){_0x4fde72=_0x4105af[_0xcc0d('0x3e')];if(!_0x524d52[_0xcc0d('0x38')][_0xcc0d('0x56')](_0xcc0d('0x3f'))){_0x3b809b[_0xcc0d('0x2b')]=qs[_0xcc0d('0x2b')](_0x524d52[_0xcc0d('0x38')]['limit']);_0x3b809b[_0xcc0d('0x2a')]=qs[_0xcc0d('0x2a')](_0x524d52[_0xcc0d('0x38')][_0xcc0d('0x2a')]);}return _0x319b69[_0xcc0d('0x55')](_0x3b809b);}})['then'](function(_0x47916e){if(_0x47916e){return _0x47916e?{'count':_0x4fde72,'rows':_0x47916e}:null;}})['then'](respondWithResult(_0x2ee904,null))[_0xcc0d('0x24')](handleError(_0x2ee904,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f771531..96ad58e 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 _0xf7d7=['int_dynamics365_configurations','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x40c656,_0x27b0fa){var _0x553a28=function(_0x49ce84){while(--_0x49ce84){_0x40c656['push'](_0x40c656['shift']());}};_0x553a28(++_0x27b0fa);}(_0xf7d7,0x160));var _0x7f7d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xf7d7[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x7f7d('0x0'));var util=require('util');var logger=require(_0x7f7d('0x1'))('api');var moment=require(_0x7f7d('0x2'));var BPromise=require(_0x7f7d('0x3'));var rp=require(_0x7f7d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f7d('0x5'));var config=require(_0x7f7d('0x6'));var attributes=require(_0x7f7d('0x7'));module['exports']=function(_0x3389b9,_0x10052b){return _0x3389b9['define']('Dynamics365Configuration',attributes,{'tableName':_0x7f7d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7112=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','api','moment','bluebird','request-promise'];(function(_0x453159,_0x2273cf){var _0x2757da=function(_0x3bad39){while(--_0x3bad39){_0x453159['push'](_0x453159['shift']());}};_0x2757da(++_0x2273cf);}(_0x7112,0x1b3));var _0x2711=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7112[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2711('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2711('0x1'));var moment=require(_0x2711('0x2'));var BPromise=require(_0x2711('0x3'));var rp=require(_0x2711('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2711('0x5'));var config=require(_0x2711('0x6'));var attributes=require(_0x2711('0x7'));module['exports']=function(_0x364c53,_0x4005d3){return _0x364c53[_0x2711('0x8')](_0x2711('0x9'),attributes,{'tableName':_0x2711('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 0ed26d5..5e6cc8f 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 _0x346b=['../../config/logger','rpc','../../config/environment','client','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xb5a7ae,_0xafd8c7){var _0x326866=function(_0x3d18ee){while(--_0x3d18ee){_0xb5a7ae['push'](_0xb5a7ae['shift']());}};_0x326866(++_0xafd8c7);}(_0x346b,0xa9));var _0xb346=function(_0x792447,_0x33dd2d){_0x792447=_0x792447-0x0;var _0x332fa7=_0x346b[_0x792447];return _0x332fa7;};'use strict';var _=require(_0xb346('0x0'));var util=require(_0xb346('0x1'));var moment=require(_0xb346('0x2'));var BPromise=require(_0xb346('0x3'));var rs=require(_0xb346('0x4'));var fs=require('fs');var Redis=require(_0xb346('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb346('0x6'));var logger=require(_0xb346('0x7'))(_0xb346('0x8'));var config=require(_0xb346('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb346('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289cb4,_0x400dfb,_0x53e92d){return new BPromise(function(_0x28cdeb,_0x3a87c9){return client['request'](_0x289cb4,_0x53e92d)[_0xb346('0xb')](function(_0x45f000){logger[_0xb346('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x400dfb,'request\x20sent');logger[_0xb346('0xd')](_0xb346('0xe'),_0x400dfb,_0xb346('0xf'),JSON[_0xb346('0x10')](_0x45f000));if(_0x45f000[_0xb346('0x11')]){if(_0x45f000[_0xb346('0x11')][_0xb346('0x12')]===0x1f4){logger[_0xb346('0x11')](_0xb346('0x13'),_0x400dfb,_0x45f000['error'][_0xb346('0x14')]);return _0x3a87c9(_0x45f000[_0xb346('0x11')][_0xb346('0x14')]);}logger[_0xb346('0x11')](_0xb346('0x13'),_0x400dfb,_0x45f000[_0xb346('0x11')][_0xb346('0x14')]);return _0x28cdeb(_0x45f000['error']['message']);}else{logger[_0xb346('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x400dfb,'request\x20sent');_0x28cdeb(_0x45f000[_0xb346('0x15')]['message']);}})['catch'](function(_0x552aa0){logger[_0xb346('0x11')](_0xb346('0x13'),_0x400dfb,_0x552aa0);_0x3a87c9(_0x552aa0);});});} \ No newline at end of file +var _0x4688=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x358bf3,_0x40ec1f){var _0x248106=function(_0x2eb1f3){while(--_0x2eb1f3){_0x358bf3['push'](_0x358bf3['shift']());}};_0x248106(++_0x40ec1f);}(_0x4688,0x177));var _0x8468=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x4688[_0x2418e0];return _0x55ffbf;};'use strict';var _=require(_0x8468('0x0'));var util=require('util');var moment=require(_0x8468('0x1'));var BPromise=require(_0x8468('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8468('0x3'));var db=require(_0x8468('0x4'))['db'];var utils=require(_0x8468('0x5'));var logger=require(_0x8468('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8468('0x7'));var client=jayson[_0x8468('0x8')][_0x8468('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fa119,_0x1276c4,_0x6f169a){return new BPromise(function(_0x41b08f,_0x1ca2e6){return client[_0x8468('0xa')](_0x3fa119,_0x6f169a)['then'](function(_0x154d83){logger[_0x8468('0xb')](_0x8468('0xc'),_0x1276c4,_0x8468('0xd'));logger[_0x8468('0xe')](_0x8468('0xf'),_0x1276c4,'request\x20sent',JSON['stringify'](_0x154d83));if(_0x154d83[_0x8468('0x10')]){if(_0x154d83[_0x8468('0x10')][_0x8468('0x11')]===0x1f4){logger[_0x8468('0x10')](_0x8468('0xc'),_0x1276c4,_0x154d83[_0x8468('0x10')][_0x8468('0x12')]);return _0x1ca2e6(_0x154d83[_0x8468('0x10')][_0x8468('0x12')]);}logger[_0x8468('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1276c4,_0x154d83[_0x8468('0x10')][_0x8468('0x12')]);return _0x41b08f(_0x154d83['error']['message']);}else{logger[_0x8468('0xb')](_0x8468('0xc'),_0x1276c4,_0x8468('0xd'));_0x41b08f(_0x154d83[_0x8468('0x13')]['message']);}})[_0x8468('0x14')](function(_0x1441c0){logger[_0x8468('0x10')](_0x8468('0xc'),_0x1276c4,_0x1441c0);_0x1ca2e6(_0x1441c0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 56c9fa7..9d21571 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 _0x24cd=['create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x2e7ad1,_0x576131){var _0x30b661=function(_0x1e5f6b){while(--_0x1e5f6b){_0x2e7ad1['push'](_0x2e7ad1['shift']());}};_0x30b661(++_0x576131);}(_0x24cd,0x83));var _0xd24c=function(_0x5ebbfd,_0x44dc4b){_0x5ebbfd=_0x5ebbfd-0x0;var _0x576a7a=_0x24cd[_0x5ebbfd];return _0x576a7a;};'use strict';var multer=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var path=require('path');var timeout=require(_0xd24c('0x2'));var express=require('express');var router=express[_0xd24c('0x3')]();var auth=require(_0xd24c('0x4'));var interaction=require(_0xd24c('0x5'));var config=require('../../config/environment');var controller=require(_0xd24c('0x6'));router[_0xd24c('0x7')]('/',auth['isAuthenticated'](),controller[_0xd24c('0x8')]);router[_0xd24c('0x7')](_0xd24c('0x9'),auth[_0xd24c('0xa')](),controller[_0xd24c('0xb')]);router[_0xd24c('0xc')]('/',auth[_0xd24c('0xa')](),controller[_0xd24c('0xd')]);router['put']('/:id',auth[_0xd24c('0xa')](),controller[_0xd24c('0xe')]);router[_0xd24c('0xf')](_0xd24c('0x9'),auth[_0xd24c('0xa')](),controller[_0xd24c('0x10')]);module[_0xd24c('0x11')]=router; \ No newline at end of file +var _0xe28e=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0xa7f58b,_0xf501d3){var _0x53b602=function(_0x359cd2){while(--_0x359cd2){_0xa7f58b['push'](_0xa7f58b['shift']());}};_0x53b602(++_0xf501d3);}(_0xe28e,0x1ba));var _0xee28=function(_0x9dac4e,_0x4dc161){_0x9dac4e=_0x9dac4e-0x0;var _0x476a71=_0xe28e[_0x9dac4e];return _0x476a71;};'use strict';var multer=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var path=require(_0xee28('0x2'));var timeout=require(_0xee28('0x3'));var express=require(_0xee28('0x4'));var router=express[_0xee28('0x5')]();var auth=require(_0xee28('0x6'));var interaction=require(_0xee28('0x7'));var config=require(_0xee28('0x8'));var controller=require(_0xee28('0x9'));router[_0xee28('0xa')]('/',auth[_0xee28('0xb')](),controller[_0xee28('0xc')]);router['get'](_0xee28('0xd'),auth[_0xee28('0xb')](),controller[_0xee28('0xe')]);router[_0xee28('0xf')]('/',auth[_0xee28('0xb')](),controller[_0xee28('0x10')]);router[_0xee28('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee28('0x12')](_0xee28('0xd'),auth['isAuthenticated'](),controller[_0xee28('0x13')]);module[_0xee28('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 090158f..f2413ac 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 _0x0726=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','string','STRING'];(function(_0x2542a4,_0x3bd718){var _0x50e701=function(_0xeb3dd3){while(--_0xeb3dd3){_0x2542a4['push'](_0x2542a4['shift']());}};_0x50e701(++_0x3bd718);}(_0x0726,0x131));var _0x6072=function(_0x1bf953,_0x35a003){_0x1bf953=_0x1bf953-0x0;var _0x36c284=_0x0726[_0x1bf953];return _0x36c284;};'use strict';var Sequelize=require(_0x6072('0x0'));module[_0x6072('0x1')]={'type':{'type':Sequelize[_0x6072('0x2')]('string',_0x6072('0x3'),_0x6072('0x4'),'keyValue'),'defaultValue':_0x6072('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6072('0x2')]('string','variable',_0x6072('0x4'))},'keyContent':{'type':Sequelize[_0x6072('0x6')]},'idField':{'type':Sequelize[_0x6072('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6072('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1145=['STRING','variable','customVariable','sequelize','exports','ENUM','string'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x1145,0xc7));var _0x5114=function(_0x2f02d9,_0x4d3dc7){_0x2f02d9=_0x2f02d9-0x0;var _0x31c00d=_0x1145[_0x2f02d9];return _0x31c00d;};'use strict';var Sequelize=require(_0x5114('0x0'));module[_0x5114('0x1')]={'type':{'type':Sequelize[_0x5114('0x2')]('string','variable','customVariable','keyValue'),'defaultValue':_0x5114('0x3')},'content':{'type':Sequelize[_0x5114('0x4')]},'key':{'type':Sequelize[_0x5114('0x4')]},'keyType':{'type':Sequelize[_0x5114('0x2')](_0x5114('0x3'),_0x5114('0x5'),_0x5114('0x6'))},'keyContent':{'type':Sequelize[_0x5114('0x4')]},'idField':{'type':Sequelize[_0x5114('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5114('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b29df99..b26cfb3 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 _0x616c=['intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','Dynamics365Field','fieldName','type','key','model','map','query','keys','filters'];(function(_0x316cc8,_0xe51797){var _0x143cd5=function(_0x6c99b9){while(--_0x6c99b9){_0x316cc8['push'](_0x316cc8['shift']());}};_0x143cd5(++_0xe51797);}(_0x616c,0x1b6));var _0xc616=function(_0x22daae,_0x44e3d2){_0x22daae=_0x22daae-0x0;var _0x17a413=_0x616c[_0x22daae];return _0x17a413;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc616('0x0'));var rimraf=require(_0xc616('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc616('0x2'));var rp=require(_0xc616('0x3'));var moment=require(_0xc616('0x4'));var BPromise=require(_0xc616('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc616('0x6'));var sox=require(_0xc616('0x7'));var csv=require(_0xc616('0x8'));var ejs=require(_0xc616('0x9'));var fs=require('fs');var _=require(_0xc616('0xa'));var squel=require(_0xc616('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc616('0xc'));var toCsv=require(_0xc616('0x8'));var querystring=require('querystring');var Papa=require(_0xc616('0xd'));var Redis=require('ioredis');var authService=require(_0xc616('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc616('0xf'));var logger=require(_0xc616('0x10'))(_0xc616('0x11'));var utils=require('../../config/utils');var config=require(_0xc616('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2266e7,_0xb8de2a){_0xb8de2a=_0xb8de2a||0xcc;return function(_0x1fb7a1){if(_0x1fb7a1){return _0x2266e7[_0xc616('0x13')](_0xb8de2a);}return _0x2266e7[_0xc616('0x14')](_0xb8de2a)['end']();};}function respondWithResult(_0x242ee5,_0x5e1993){_0x5e1993=_0x5e1993||0xc8;return function(_0x17e829){if(_0x17e829){return _0x242ee5[_0xc616('0x14')](_0x5e1993)[_0xc616('0x15')](_0x17e829);}};}function respondWithFilteredResult(_0xc013d7,_0x3c0307){return function(_0x5a5393){if(_0x5a5393){var _0xa07335=_0x5a5393[_0xc616('0x16')],_0x1738ff=_0x3c0307[_0xc616('0x17')],_0x3ace46=_0x3c0307['offset']+_0x3c0307[_0xc616('0x18')],_0x739a74;if(_0x3ace46>=_0xa07335){_0x3ace46=_0xa07335;_0x739a74=0xc8;}else{_0x739a74=0xce;}_0xc013d7['status'](_0x739a74);return _0xc013d7[_0xc616('0x19')](_0xc616('0x1a'),_0x1738ff+'-'+_0x3ace46+'/'+_0xa07335)[_0xc616('0x15')](_0x5a5393);}return null;};}function patchUpdates(_0x3ebe9c){return function(_0x51c773){try{jsonpatch[_0xc616('0x1b')](_0x51c773,_0x3ebe9c,!![]);}catch(_0x5809ca){return BPromise['reject'](_0x5809ca);}return _0x51c773[_0xc616('0x1c')]();};}function saveUpdates(_0x28710a,_0x4756e4){return function(_0xf51b1c){if(_0xf51b1c){return _0xf51b1c[_0xc616('0x1d')](_0x28710a)[_0xc616('0x1e')](function(_0x2a7506){return _0x2a7506;});}return null;};}function removeEntity(_0x35a024,_0x1ae9da){return function(_0x461e40){if(_0x461e40){return _0x461e40['destroy']()[_0xc616('0x1e')](function(){_0x35a024['status'](0xcc)[_0xc616('0x1f')]();});}};}function handleEntityNotFound(_0x1696b5,_0x1828f3){return function(_0x229cbd){if(!_0x229cbd){_0x1696b5['sendStatus'](0x194);}return _0x229cbd;};}function handleError(_0x3cff52,_0x10b121){_0x10b121=_0x10b121||0x1f4;return function(_0xe4a1cd){logger[_0xc616('0x20')](_0xe4a1cd[_0xc616('0x21')]);if(_0xe4a1cd['name']){delete _0xe4a1cd[_0xc616('0x22')];}_0x3cff52['status'](_0x10b121)[_0xc616('0x23')](_0xe4a1cd);};}exports['index']=function(_0x246a98,_0x44c71a){var _0x4e18d1={},_0x455eb0={},_0x26df5a={'count':0x0,'rows':[]};var _0x45a71e=_['map'](db[_0xc616('0x24')]['rawAttributes'],function(_0xb1e98a){return{'name':_0xb1e98a[_0xc616('0x25')],'type':_0xb1e98a[_0xc616('0x26')][_0xc616('0x27')]};});_0x455eb0[_0xc616('0x28')]=_[_0xc616('0x29')](_0x45a71e,_0xc616('0x22'));_0x455eb0[_0xc616('0x2a')]=_[_0xc616('0x2b')](_0x246a98['query']);_0x455eb0[_0xc616('0x2c')]=_[_0xc616('0x2d')](_0x455eb0['model'],_0x455eb0[_0xc616('0x2a')]);_0x4e18d1[_0xc616('0x2e')]=_[_0xc616('0x2d')](_0x455eb0[_0xc616('0x28')],qs['fields'](_0x246a98[_0xc616('0x2a')]['fields']));_0x4e18d1['attributes']=_0x4e18d1['attributes']['length']?_0x4e18d1[_0xc616('0x2e')]:_0x455eb0[_0xc616('0x28')];if(!_0x246a98[_0xc616('0x2a')][_0xc616('0x2f')](_0xc616('0x30'))){_0x4e18d1[_0xc616('0x18')]=qs[_0xc616('0x18')](_0x246a98[_0xc616('0x2a')][_0xc616('0x18')]);_0x4e18d1[_0xc616('0x17')]=qs[_0xc616('0x17')](_0x246a98[_0xc616('0x2a')][_0xc616('0x17')]);}_0x4e18d1['order']=qs['sort'](_0x246a98[_0xc616('0x2a')][_0xc616('0x31')]);_0x4e18d1['where']=qs['filters'](_[_0xc616('0x32')](_0x246a98['query'],_0x455eb0['filters']),_0x45a71e);if(_0x246a98['query'][_0xc616('0x33')]){_0x4e18d1[_0xc616('0x34')]=_['merge'](_0x4e18d1['where'],{'$or':_[_0xc616('0x29')](_0x45a71e,function(_0xfcc75){if(_0xfcc75[_0xc616('0x26')]!==_0xc616('0x35')){var _0x4e7a46={};_0x4e7a46[_0xfcc75[_0xc616('0x22')]]={'$like':'%'+_0x246a98[_0xc616('0x2a')]['filter']+'%'};return _0x4e7a46;}})});}_0x4e18d1=_[_0xc616('0x36')]({},_0x4e18d1,_0x246a98[_0xc616('0x37')]);var _0x3e4bc3={'where':_0x4e18d1['where']};return db[_0xc616('0x24')][_0xc616('0x16')](_0x3e4bc3)[_0xc616('0x1e')](function(_0x162280){_0x26df5a[_0xc616('0x16')]=_0x162280;if(_0x246a98[_0xc616('0x2a')][_0xc616('0x38')]){_0x4e18d1[_0xc616('0x39')]=[{'all':!![]}];}return db[_0xc616('0x24')][_0xc616('0x3a')](_0x4e18d1);})[_0xc616('0x1e')](function(_0x2c2638){_0x26df5a[_0xc616('0x3b')]=_0x2c2638;return _0x26df5a;})[_0xc616('0x1e')](respondWithFilteredResult(_0x44c71a,_0x4e18d1))[_0xc616('0x3c')](handleError(_0x44c71a,null));};exports[_0xc616('0x3d')]=function(_0x5194a6,_0x50b701){var _0x3e4ff1={'raw':!![],'where':{'id':_0x5194a6[_0xc616('0x3e')]['id']}},_0x4440a2={};_0x4440a2[_0xc616('0x28')]=_[_0xc616('0x2b')](db[_0xc616('0x24')][_0xc616('0x3f')]);_0x4440a2[_0xc616('0x2a')]=_[_0xc616('0x2b')](_0x5194a6[_0xc616('0x2a')]);_0x4440a2[_0xc616('0x2c')]=_['intersection'](_0x4440a2[_0xc616('0x28')],_0x4440a2[_0xc616('0x2a')]);_0x3e4ff1['attributes']=_[_0xc616('0x2d')](_0x4440a2[_0xc616('0x28')],qs[_0xc616('0x40')](_0x5194a6[_0xc616('0x2a')][_0xc616('0x40')]));_0x3e4ff1[_0xc616('0x2e')]=_0x3e4ff1['attributes']['length']?_0x3e4ff1[_0xc616('0x2e')]:_0x4440a2[_0xc616('0x28')];if(_0x5194a6[_0xc616('0x2a')]['includeAll']){_0x3e4ff1[_0xc616('0x39')]=[{'all':!![]}];}_0x3e4ff1=_[_0xc616('0x36')]({},_0x3e4ff1,_0x5194a6['options']);return db['Dynamics365Field'][_0xc616('0x41')](_0x3e4ff1)[_0xc616('0x1e')](handleEntityNotFound(_0x50b701,null))[_0xc616('0x1e')](respondWithResult(_0x50b701,null))['catch'](handleError(_0x50b701,null));};exports[_0xc616('0x42')]=function(_0x3c0fc0,_0xbbb8bd){return db['Dynamics365Field']['create'](_0x3c0fc0['body'],{})['then'](respondWithResult(_0xbbb8bd,0xc9))[_0xc616('0x3c')](handleError(_0xbbb8bd,null));};exports[_0xc616('0x1d')]=function(_0x42193c,_0x54fff1){if(_0x42193c[_0xc616('0x43')]['id']){delete _0x42193c['body']['id'];}return db['Dynamics365Field'][_0xc616('0x41')]({'where':{'id':_0x42193c[_0xc616('0x3e')]['id']}})['then'](handleEntityNotFound(_0x54fff1,null))[_0xc616('0x1e')](saveUpdates(_0x42193c[_0xc616('0x43')],null))[_0xc616('0x1e')](respondWithResult(_0x54fff1,null))[_0xc616('0x3c')](handleError(_0x54fff1,null));};exports[_0xc616('0x44')]=function(_0x4e3281,_0x2fd069){return db[_0xc616('0x24')][_0xc616('0x41')]({'where':{'id':_0x4e3281[_0xc616('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2fd069,null))[_0xc616('0x1e')](removeEntity(_0x2fd069,null))[_0xc616('0x3c')](handleError(_0x2fd069,null));}; \ No newline at end of file +var _0x2313=['hasOwnProperty','nolimit','order','sort','where','map','filter','merge','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','body','html-pdf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x5c1255,_0xe7aeff){var _0x1824d8=function(_0x3791f3){while(--_0x3791f3){_0x5c1255['push'](_0x5c1255['shift']());}};_0x1824d8(++_0xe7aeff);}(_0x2313,0x191));var _0x3231=function(_0x5bf4a7,_0x226831){_0x5bf4a7=_0x5bf4a7-0x0;var _0x3a8736=_0x2313[_0x5bf4a7];return _0x3a8736;};'use strict';var pdf=require(_0x3231('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3231('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3231('0x2'));var moment=require(_0x3231('0x3'));var BPromise=require(_0x3231('0x4'));var Mustache=require('mustache');var util=require(_0x3231('0x5'));var path=require('path');var sox=require(_0x3231('0x6'));var csv=require(_0x3231('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3231('0x8'));var squel=require(_0x3231('0x9'));var crypto=require(_0x3231('0xa'));var jsforce=require(_0x3231('0xb'));var deskjs=require(_0x3231('0xc'));var toCsv=require(_0x3231('0x7'));var querystring=require(_0x3231('0xd'));var Papa=require(_0x3231('0xe'));var Redis=require(_0x3231('0xf'));var authService=require(_0x3231('0x10'));var qs=require(_0x3231('0x11'));var as=require(_0x3231('0x12'));var hardwareService=require(_0x3231('0x13'));var logger=require(_0x3231('0x14'))(_0x3231('0x15'));var utils=require(_0x3231('0x16'));var config=require(_0x3231('0x17'));var db=require(_0x3231('0x18'))['db'];function respondWithStatusCode(_0x3330e8,_0x143d6c){_0x143d6c=_0x143d6c||0xcc;return function(_0x4cd784){if(_0x4cd784){return _0x3330e8[_0x3231('0x19')](_0x143d6c);}return _0x3330e8[_0x3231('0x1a')](_0x143d6c)['end']();};}function respondWithResult(_0x50e909,_0x32f0bf){_0x32f0bf=_0x32f0bf||0xc8;return function(_0x5c1e28){if(_0x5c1e28){return _0x50e909[_0x3231('0x1a')](_0x32f0bf)[_0x3231('0x1b')](_0x5c1e28);}};}function respondWithFilteredResult(_0x1253e6,_0x378015){return function(_0x538db9){if(_0x538db9){var _0x58f108=_0x538db9[_0x3231('0x1c')],_0x41eaa2=_0x378015[_0x3231('0x1d')],_0x46deaf=_0x378015[_0x3231('0x1d')]+_0x378015[_0x3231('0x1e')],_0x158bec;if(_0x46deaf>=_0x58f108){_0x46deaf=_0x58f108;_0x158bec=0xc8;}else{_0x158bec=0xce;}_0x1253e6['status'](_0x158bec);return _0x1253e6[_0x3231('0x1f')](_0x3231('0x20'),_0x41eaa2+'-'+_0x46deaf+'/'+_0x58f108)[_0x3231('0x1b')](_0x538db9);}return null;};}function patchUpdates(_0x3bc550){return function(_0x4d2c85){try{jsonpatch['apply'](_0x4d2c85,_0x3bc550,!![]);}catch(_0x57098a){return BPromise[_0x3231('0x21')](_0x57098a);}return _0x4d2c85[_0x3231('0x22')]();};}function saveUpdates(_0x5a028d,_0x4c0f7c){return function(_0x5cb4d3){if(_0x5cb4d3){return _0x5cb4d3[_0x3231('0x23')](_0x5a028d)[_0x3231('0x24')](function(_0x589902){return _0x589902;});}return null;};}function removeEntity(_0x2cffd9,_0x1e80f1){return function(_0x446eba){if(_0x446eba){return _0x446eba[_0x3231('0x25')]()[_0x3231('0x24')](function(){_0x2cffd9[_0x3231('0x1a')](0xcc)[_0x3231('0x26')]();});}};}function handleEntityNotFound(_0x1e4eb4,_0x2332f1){return function(_0x13a616){if(!_0x13a616){_0x1e4eb4[_0x3231('0x19')](0x194);}return _0x13a616;};}function handleError(_0x29b84d,_0x779c27){_0x779c27=_0x779c27||0x1f4;return function(_0x141aa9){logger[_0x3231('0x27')](_0x141aa9[_0x3231('0x28')]);if(_0x141aa9[_0x3231('0x29')]){delete _0x141aa9['name'];}_0x29b84d[_0x3231('0x1a')](_0x779c27)[_0x3231('0x2a')](_0x141aa9);};}exports[_0x3231('0x2b')]=function(_0x3ba011,_0x231824){var _0x1a6980={},_0x19f10b={},_0x738635={'count':0x0,'rows':[]};var _0x2170a5=_['map'](db[_0x3231('0x2c')][_0x3231('0x2d')],function(_0x146707){return{'name':_0x146707[_0x3231('0x2e')],'type':_0x146707[_0x3231('0x2f')][_0x3231('0x30')]};});_0x19f10b[_0x3231('0x31')]=_['map'](_0x2170a5,_0x3231('0x29'));_0x19f10b[_0x3231('0x32')]=_['keys'](_0x3ba011[_0x3231('0x32')]);_0x19f10b[_0x3231('0x33')]=_[_0x3231('0x34')](_0x19f10b['model'],_0x19f10b[_0x3231('0x32')]);_0x1a6980[_0x3231('0x35')]=_[_0x3231('0x34')](_0x19f10b[_0x3231('0x31')],qs[_0x3231('0x36')](_0x3ba011[_0x3231('0x32')][_0x3231('0x36')]));_0x1a6980[_0x3231('0x35')]=_0x1a6980[_0x3231('0x35')]['length']?_0x1a6980[_0x3231('0x35')]:_0x19f10b[_0x3231('0x31')];if(!_0x3ba011['query'][_0x3231('0x37')](_0x3231('0x38'))){_0x1a6980[_0x3231('0x1e')]=qs['limit'](_0x3ba011[_0x3231('0x32')]['limit']);_0x1a6980[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x3ba011['query'][_0x3231('0x1d')]);}_0x1a6980[_0x3231('0x39')]=qs[_0x3231('0x3a')](_0x3ba011[_0x3231('0x32')]['sort']);_0x1a6980[_0x3231('0x3b')]=qs[_0x3231('0x33')](_['pick'](_0x3ba011[_0x3231('0x32')],_0x19f10b['filters']),_0x2170a5);if(_0x3ba011['query']['filter']){_0x1a6980[_0x3231('0x3b')]=_['merge'](_0x1a6980[_0x3231('0x3b')],{'$or':_[_0x3231('0x3c')](_0x2170a5,function(_0x3cd445){if(_0x3cd445[_0x3231('0x2f')]!=='VIRTUAL'){var _0x3bdafc={};_0x3bdafc[_0x3cd445['name']]={'$like':'%'+_0x3ba011[_0x3231('0x32')][_0x3231('0x3d')]+'%'};return _0x3bdafc;}})});}_0x1a6980=_[_0x3231('0x3e')]({},_0x1a6980,_0x3ba011[_0x3231('0x3f')]);var _0x48003f={'where':_0x1a6980['where']};return db[_0x3231('0x2c')][_0x3231('0x1c')](_0x48003f)['then'](function(_0x4202e0){_0x738635[_0x3231('0x1c')]=_0x4202e0;if(_0x3ba011[_0x3231('0x32')]['includeAll']){_0x1a6980['include']=[{'all':!![]}];}return db[_0x3231('0x2c')][_0x3231('0x40')](_0x1a6980);})[_0x3231('0x24')](function(_0x36fab6){_0x738635[_0x3231('0x41')]=_0x36fab6;return _0x738635;})[_0x3231('0x24')](respondWithFilteredResult(_0x231824,_0x1a6980))[_0x3231('0x42')](handleError(_0x231824,null));};exports[_0x3231('0x43')]=function(_0x56f302,_0x2187d2){var _0x2a20b5={'raw':!![],'where':{'id':_0x56f302[_0x3231('0x44')]['id']}},_0x12c7c3={};_0x12c7c3[_0x3231('0x31')]=_[_0x3231('0x45')](db[_0x3231('0x2c')][_0x3231('0x2d')]);_0x12c7c3[_0x3231('0x32')]=_[_0x3231('0x45')](_0x56f302[_0x3231('0x32')]);_0x12c7c3[_0x3231('0x33')]=_['intersection'](_0x12c7c3[_0x3231('0x31')],_0x12c7c3[_0x3231('0x32')]);_0x2a20b5[_0x3231('0x35')]=_[_0x3231('0x34')](_0x12c7c3[_0x3231('0x31')],qs[_0x3231('0x36')](_0x56f302['query'][_0x3231('0x36')]));_0x2a20b5['attributes']=_0x2a20b5[_0x3231('0x35')][_0x3231('0x46')]?_0x2a20b5[_0x3231('0x35')]:_0x12c7c3[_0x3231('0x31')];if(_0x56f302[_0x3231('0x32')][_0x3231('0x47')]){_0x2a20b5[_0x3231('0x48')]=[{'all':!![]}];}_0x2a20b5=_[_0x3231('0x3e')]({},_0x2a20b5,_0x56f302[_0x3231('0x3f')]);return db[_0x3231('0x2c')][_0x3231('0x49')](_0x2a20b5)['then'](handleEntityNotFound(_0x2187d2,null))[_0x3231('0x24')](respondWithResult(_0x2187d2,null))[_0x3231('0x42')](handleError(_0x2187d2,null));};exports['create']=function(_0x2cbf51,_0xee5ff0){return db['Dynamics365Field'][_0x3231('0x4a')](_0x2cbf51[_0x3231('0x4b')],{})[_0x3231('0x24')](respondWithResult(_0xee5ff0,0xc9))[_0x3231('0x42')](handleError(_0xee5ff0,null));};exports['update']=function(_0x3a78b7,_0xd30486){if(_0x3a78b7['body']['id']){delete _0x3a78b7[_0x3231('0x4b')]['id'];}return db[_0x3231('0x2c')][_0x3231('0x49')]({'where':{'id':_0x3a78b7[_0x3231('0x44')]['id']}})[_0x3231('0x24')](handleEntityNotFound(_0xd30486,null))[_0x3231('0x24')](saveUpdates(_0x3a78b7[_0x3231('0x4b')],null))[_0x3231('0x24')](respondWithResult(_0xd30486,null))[_0x3231('0x42')](handleError(_0xd30486,null));};exports[_0x3231('0x25')]=function(_0x164044,_0x44a47c){return db[_0x3231('0x2c')][_0x3231('0x49')]({'where':{'id':_0x164044[_0x3231('0x44')]['id']}})[_0x3231('0x24')](handleEntityNotFound(_0x44a47c,null))[_0x3231('0x24')](removeEntity(_0x44a47c,null))[_0x3231('0x42')](handleError(_0x44a47c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f076e87..a001970 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 _0x72d6=['int_dynamics365_fields','dynamics365_unique_index','idField','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field'];(function(_0x4436c1,_0x4e15a7){var _0x2ae479=function(_0x29c431){while(--_0x29c431){_0x4436c1['push'](_0x4436c1['shift']());}};_0x2ae479(++_0x4e15a7);}(_0x72d6,0x12e));var _0x672d=function(_0x4b0114,_0x1c3c3b){_0x4b0114=_0x4b0114-0x0;var _0x32dab9=_0x72d6[_0x4b0114];return _0x32dab9;};'use strict';var _=require('lodash');var util=require(_0x672d('0x0'));var logger=require(_0x672d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x672d('0x2'));var rp=require(_0x672d('0x3'));var fs=require('fs');var path=require(_0x672d('0x4'));var rimraf=require(_0x672d('0x5'));var config=require(_0x672d('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x672d('0x7')]=function(_0x2fb2d1,_0x265f6a){return _0x2fb2d1[_0x672d('0x8')](_0x672d('0x9'),attributes,{'tableName':_0x672d('0xa'),'paranoid':![],'indexes':[{'name':_0x672d('0xb'),'fields':[_0x672d('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb34d=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','lodash','api','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb34d,0x9d));var _0xdb34=function(_0x4cc652,_0xa34aa5){_0x4cc652=_0x4cc652-0x0;var _0x496a8b=_0xb34d[_0x4cc652];return _0x496a8b;};'use strict';var _=require(_0xdb34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb34('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb34('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb34('0x3'));var config=require(_0xdb34('0x4'));var attributes=require(_0xdb34('0x5'));module[_0xdb34('0x6')]=function(_0x1c21eb,_0x3184bd){return _0x1c21eb[_0xdb34('0x7')](_0xdb34('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xdb34('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 5d739d6..e805c9b 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 _0xd2f5=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x578be3,_0x2d34e3){var _0x13f09c=function(_0x174037){while(--_0x174037){_0x578be3['push'](_0x578be3['shift']());}};_0x13f09c(++_0x2d34e3);}(_0xd2f5,0x144));var _0x5d2f=function(_0x28abff,_0x324278){_0x28abff=_0x28abff-0x0;var _0x385903=_0xd2f5[_0x28abff];return _0x385903;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});} \ No newline at end of file +var _0x363e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x363e,0x179));var _0xe363=function(_0xe5410d,_0x4cf8fd){_0xe5410d=_0xe5410d-0x0;var _0x1669ee=_0x363e[_0xe5410d];return _0x1669ee;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe10b,_0x1fc808,_0x30bffc){return new BPromise(function(_0xc5df66,_0x29d330){return client['request'](_0x4fe10b,_0x30bffc)[_0xe363('0xd')](function(_0x308de7){logger[_0xe363('0xe')](_0xe363('0xf'),_0x1fc808,_0xe363('0x10'));logger[_0xe363('0x11')](_0xe363('0x12'),_0x1fc808,'request\x20sent',JSON[_0xe363('0x13')](_0x308de7));if(_0x308de7[_0xe363('0x14')]){if(_0x308de7['error'][_0xe363('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0x29d330(_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);}logger[_0xe363('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0xc5df66(_0x308de7['error'][_0xe363('0x16')]);}else{logger[_0xe363('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0xe363('0x10'));_0xc5df66(_0x308de7[_0xe363('0x17')]['message']);}})[_0xe363('0x18')](function(_0xc94d0a){logger['error'](_0xe363('0xf'),_0x1fc808,_0xc94d0a);_0x29d330(_0xc94d0a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 388546f..c061958 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 _0xcdaf=['./intFreshdeskAccount.controller','get','index','isAuthenticated','/:id/configurations','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xcdaf,0x19e));var _0xfcda=function(_0x54e4dc,_0x3278c6){_0x54e4dc=_0x54e4dc-0x0;var _0x72c6c=_0xcdaf[_0x54e4dc];return _0x72c6c;};'use strict';var multer=require(_0xfcda('0x0'));var util=require('util');var path=require(_0xfcda('0x1'));var timeout=require('connect-timeout');var express=require(_0xfcda('0x2'));var router=express[_0xfcda('0x3')]();var auth=require(_0xfcda('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfcda('0x5'));var controller=require(_0xfcda('0x6'));router[_0xfcda('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcda('0x8')]);router[_0xfcda('0x7')]('/:id',auth[_0xfcda('0x9')](),controller['show']);router[_0xfcda('0x7')](_0xfcda('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xfcda('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfcda('0xc')]);router[_0xfcda('0xd')](_0xfcda('0xa'),auth['isAuthenticated'](),controller[_0xfcda('0xe')]);router[_0xfcda('0xf')](_0xfcda('0x10'),auth[_0xfcda('0x9')](),controller[_0xfcda('0x11')]);router[_0xfcda('0x12')](_0xfcda('0x10'),auth[_0xfcda('0x9')](),controller[_0xfcda('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd4a3=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x68c5e3,_0x39cc2a){var _0x105064=function(_0x3dd11b){while(--_0x3dd11b){_0x68c5e3['push'](_0x68c5e3['shift']());}};_0x105064(++_0x39cc2a);}(_0xd4a3,0x145));var _0x3d4a=function(_0x204346,_0x838e13){_0x204346=_0x204346-0x0;var _0x26a327=_0xd4a3[_0x204346];return _0x26a327;};'use strict';var multer=require(_0x3d4a('0x0'));var util=require('util');var path=require(_0x3d4a('0x1'));var timeout=require(_0x3d4a('0x2'));var express=require(_0x3d4a('0x3'));var router=express['Router']();var auth=require(_0x3d4a('0x4'));var interaction=require(_0x3d4a('0x5'));var config=require(_0x3d4a('0x6'));var controller=require(_0x3d4a('0x7'));router[_0x3d4a('0x8')]('/',auth[_0x3d4a('0x9')](),controller[_0x3d4a('0xa')]);router[_0x3d4a('0x8')](_0x3d4a('0xb'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0xc')]);router[_0x3d4a('0x8')](_0x3d4a('0xd'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0xe')]);router[_0x3d4a('0x8')](_0x3d4a('0xf'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x10')]);router[_0x3d4a('0x11')]('/',auth['isAuthenticated'](),controller[_0x3d4a('0x12')]);router[_0x3d4a('0x11')]('/:id/configurations',auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x13')]);router[_0x3d4a('0x14')](_0x3d4a('0xb'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x15')]);router[_0x3d4a('0x16')](_0x3d4a('0xb'),auth[_0x3d4a('0x9')](),controller[_0x3d4a('0x17')]);module[_0x3d4a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index da38284..a8c95a0 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x3d197f,_0x3186d3){var _0x37c656=function(_0x3dcc81){while(--_0x3dcc81){_0x3d197f['push'](_0x3d197f['shift']());}};_0x37c656(++_0x3186d3);}(_0x6a95,0x1db));var _0x56a9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6a95[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file +var _0x3f96=['exports','STRING','remoteUri','sequelize'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0x3f96,0x1d3));var _0x63f9=function(_0x2dee30,_0x4d1fd2){_0x2dee30=_0x2dee30-0x0;var _0x37495f=_0x3f96[_0x2dee30];return _0x37495f;};'use strict';var Sequelize=require(_0x63f9('0x0'));module[_0x63f9('0x1')]={'name':{'type':Sequelize[_0x63f9('0x2')]},'description':{'type':Sequelize[_0x63f9('0x2')]},'username':{'type':Sequelize[_0x63f9('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x63f9('0x2')]},'remoteUri':{'type':Sequelize[_0x63f9('0x2')],'unique':_0x63f9('0x3')},'serverUrl':{'type':Sequelize[_0x63f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index af74ebc..eaf9230 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 _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x236b6d,_0x8e2ccf){var _0x594d60=function(_0x1eee4a){while(--_0x1eee4a){_0x236b6d['push'](_0x236b6d['shift']());}};_0x594d60(++_0x8e2ccf);}(_0xe14b,0x93));var _0xbe14=function(_0x277180,_0x3a33c3){_0x277180=_0x277180-0x0;var _0x45cd8f=_0xe14b[_0x277180];return _0x45cd8f;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file +var _0xf494=['set','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','agent','description','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','status','end','count','limit'];(function(_0x19e3c9,_0x2fb0c3){var _0x377fc9=function(_0x5bd928){while(--_0x5bd928){_0x19e3c9['push'](_0x19e3c9['shift']());}};_0x377fc9(++_0x2fb0c3);}(_0xf494,0x1c6));var _0x4f49=function(_0x544979,_0x49cc6b){_0x544979=_0x544979-0x0;var _0x3c8d11=_0xf494[_0x544979];return _0x3c8d11;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f49('0x18'));var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x111a8b,_0x1b9145,_0x2efe49){if(_0x2efe49){var _0x1a0f1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0f1e[_0x4f49('0x1b')](_0x1b9145)){return _0x111a8b;}else{throw new db[(_0x4f49('0x1c'))]['ValidationError'](_0x4f49('0x1d'));}}else{return _0x111a8b;}}function respondWithRpcPromise(_0x1f2d0d,_0x415e83,_0x5878f4,_0x5bdfaf){return new BPromise(function(_0x2f0a0d,_0x2ecaaa){var _0x74886e=_0x5bdfaf||client;return _0x74886e['request'](_0x1f2d0d,_0x5878f4)[_0x4f49('0x1e')](function(_0x399be7){logger[_0x4f49('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x415e83,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x415e83,_0x4f49('0x20'),JSON[_0x4f49('0x21')](_0x399be7));if(_0x399be7[_0x4f49('0x22')]){if(_0x399be7[_0x4f49('0x22')]['code']===0x1f4){logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);return _0x2ecaaa(_0x399be7[_0x4f49('0x22')]['message']);}logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')]['message']);return _0x2f0a0d(_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);}else{logger[_0x4f49('0x1f')](_0x4f49('0x23'),_0x415e83,_0x4f49('0x20'));_0x2f0a0d(_0x399be7[_0x4f49('0x25')]['message']);}})['catch'](function(_0x3a947b){logger[_0x4f49('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x415e83,_0x3a947b);_0x2ecaaa(_0x3a947b);});});}function respondWithStatusCode(_0x408552,_0x2c1519){_0x2c1519=_0x2c1519||0xcc;return function(_0x35f8e0){if(_0x35f8e0){return _0x408552['sendStatus'](_0x2c1519);}return _0x408552[_0x4f49('0x26')](_0x2c1519)[_0x4f49('0x27')]();};}function respondWithResult(_0x298785,_0x148153){_0x148153=_0x148153||0xc8;return function(_0xfefbab){if(_0xfefbab){return _0x298785[_0x4f49('0x26')](_0x148153)['json'](_0xfefbab);}};}function respondWithFilteredResult(_0x50c571,_0x239f44){return function(_0x2c00ee){if(_0x2c00ee){var _0x605c91=_0x2c00ee[_0x4f49('0x28')],_0x560050=_0x239f44['offset'],_0x3cbfbd=_0x239f44['offset']+_0x239f44[_0x4f49('0x29')],_0x206203;if(_0x3cbfbd>=_0x605c91){_0x3cbfbd=_0x605c91;_0x206203=0xc8;}else{_0x206203=0xce;}_0x50c571[_0x4f49('0x26')](_0x206203);return _0x50c571[_0x4f49('0x2a')]('Content-Range',_0x560050+'-'+_0x3cbfbd+'/'+_0x605c91)[_0x4f49('0x2b')](_0x2c00ee);}return null;};}function patchUpdates(_0x35aa33){return function(_0x173657){try{jsonpatch[_0x4f49('0x2c')](_0x173657,_0x35aa33,!![]);}catch(_0x3e103b){return BPromise[_0x4f49('0x2d')](_0x3e103b);}return _0x173657[_0x4f49('0x2e')]();};}function saveUpdates(_0x45ae19,_0x1f38d3){return function(_0x310ee2){if(_0x310ee2){return _0x310ee2[_0x4f49('0x2f')](_0x45ae19)[_0x4f49('0x1e')](function(_0x29ff83){return _0x29ff83;});}return null;};}function removeEntity(_0x6625cd,_0x135d17){return function(_0x97ef98){if(_0x97ef98){return _0x97ef98[_0x4f49('0x30')]()[_0x4f49('0x1e')](function(){_0x6625cd[_0x4f49('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d0d2,_0x46b7ba){return function(_0x24f568){if(!_0x24f568){_0x45d0d2[_0x4f49('0x31')](0x194);}return _0x24f568;};}function handleError(_0x1c3af8,_0x15e82b){_0x15e82b=_0x15e82b||0x1f4;return function(_0x2cbe4e){logger[_0x4f49('0x22')](_0x2cbe4e[_0x4f49('0x32')]);if(_0x2cbe4e[_0x4f49('0x33')]){delete _0x2cbe4e[_0x4f49('0x33')];}_0x1c3af8[_0x4f49('0x26')](_0x15e82b)[_0x4f49('0x34')](_0x2cbe4e);};}exports['index']=function(_0x371282,_0x27b7a9){var _0x36000a={},_0x26014f={},_0x1c1e9b={'count':0x0,'rows':[]};var _0x3ee818=_[_0x4f49('0x35')](db[_0x4f49('0x36')][_0x4f49('0x37')],function(_0xf8c377){return{'name':_0xf8c377[_0x4f49('0x38')],'type':_0xf8c377[_0x4f49('0x39')][_0x4f49('0x3a')]};});_0x26014f[_0x4f49('0x3b')]=_['map'](_0x3ee818,_0x4f49('0x33'));_0x26014f[_0x4f49('0x3c')]=_['keys'](_0x371282[_0x4f49('0x3c')]);_0x26014f[_0x4f49('0x3d')]=_['intersection'](_0x26014f[_0x4f49('0x3b')],_0x26014f[_0x4f49('0x3c')]);_0x36000a[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x26014f[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x371282[_0x4f49('0x3c')]['fields']));_0x36000a['attributes']=_0x36000a['attributes'][_0x4f49('0x41')]?_0x36000a[_0x4f49('0x3e')]:_0x26014f[_0x4f49('0x3b')];if(!_0x371282[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x36000a[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x371282[_0x4f49('0x3c')]['limit']);_0x36000a['offset']=qs[_0x4f49('0x44')](_0x371282[_0x4f49('0x3c')][_0x4f49('0x44')]);}_0x36000a['order']=qs[_0x4f49('0x45')](_0x371282['query']['sort']);_0x36000a[_0x4f49('0x46')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x47')](_0x371282['query'],_0x26014f[_0x4f49('0x3d')]),_0x3ee818);if(_0x371282[_0x4f49('0x3c')]['filter']){_0x36000a[_0x4f49('0x46')]=_['merge'](_0x36000a[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x3ee818,function(_0x133f39){if(_0x133f39['type']!==_0x4f49('0x48')){var _0x1e5f0b={};_0x1e5f0b[_0x133f39[_0x4f49('0x33')]]={'$like':'%'+_0x371282[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x1e5f0b;}})});}_0x36000a=_[_0x4f49('0x4a')]({},_0x36000a,_0x371282[_0x4f49('0x4b')]);var _0x356785={'where':_0x36000a[_0x4f49('0x46')]};return db[_0x4f49('0x36')]['count'](_0x356785)[_0x4f49('0x1e')](function(_0x44bf1d){_0x1c1e9b['count']=_0x44bf1d;if(_0x371282[_0x4f49('0x3c')]['includeAll']){_0x36000a[_0x4f49('0x4c')]=[{'all':!![]}];}return db[_0x4f49('0x36')][_0x4f49('0x4d')](_0x36000a);})[_0x4f49('0x1e')](function(_0x4a91ec){_0x1c1e9b[_0x4f49('0x4e')]=_0x4a91ec;return _0x1c1e9b;})[_0x4f49('0x1e')](respondWithFilteredResult(_0x27b7a9,_0x36000a))[_0x4f49('0x4f')](handleError(_0x27b7a9,null));};exports[_0x4f49('0x50')]=function(_0x3ec266,_0x72ea05){var _0x37fdb7={'raw':![],'where':{'id':_0x3ec266[_0x4f49('0x51')]['id']}},_0xd282c={};_0xd282c[_0x4f49('0x3b')]=_[_0x4f49('0x52')](db[_0x4f49('0x36')][_0x4f49('0x37')]);_0xd282c[_0x4f49('0x3c')]=_[_0x4f49('0x52')](_0x3ec266[_0x4f49('0x3c')]);_0xd282c['filters']=_['intersection'](_0xd282c[_0x4f49('0x3b')],_0xd282c[_0x4f49('0x3c')]);_0x37fdb7[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0xd282c[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x3ec266[_0x4f49('0x3c')]['fields']));_0x37fdb7[_0x4f49('0x3e')]=_0x37fdb7['attributes'][_0x4f49('0x41')]?_0x37fdb7[_0x4f49('0x3e')]:_0xd282c[_0x4f49('0x3b')];if(_0x3ec266[_0x4f49('0x3c')]['includeAll']){_0x37fdb7[_0x4f49('0x4c')]=[{'all':!![]}];}_0x37fdb7=_['merge']({},_0x37fdb7,_0x3ec266['options']);return db[_0x4f49('0x36')][_0x4f49('0x53')](_0x37fdb7)[_0x4f49('0x1e')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x1e')](respondWithResult(_0x72ea05,null))['catch'](handleError(_0x72ea05,null));};exports['create']=function(_0xd7f47b,_0x291a45){return db['FreshdeskAccount'][_0x4f49('0x54')](_0xd7f47b['body'],{})['then'](respondWithResult(_0x291a45,0xc9))[_0x4f49('0x4f')](handleError(_0x291a45,null));};exports['update']=function(_0xfa7dd6,_0x492aaa){if(_0xfa7dd6[_0x4f49('0x55')]['id']){delete _0xfa7dd6[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0xfa7dd6[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x492aaa,null))[_0x4f49('0x1e')](saveUpdates(_0xfa7dd6[_0x4f49('0x55')],null))['then'](respondWithResult(_0x492aaa,null))[_0x4f49('0x4f')](handleError(_0x492aaa,null));};exports['destroy']=function(_0x213608,_0x1f640d){return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0x213608[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1f640d,null))['then'](removeEntity(_0x1f640d,null))[_0x4f49('0x4f')](handleError(_0x1f640d,null));};exports[_0x4f49('0x56')]=function(_0x5e3568,_0x5d2b3c,_0x121c04){var _0x447dde={};var _0x2e0df5={};var _0x2409f1;var _0x19a788;return db['FreshdeskAccount'][_0x4f49('0x57')]({'where':{'id':_0x5e3568['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x5d2b3c,null))[_0x4f49('0x1e')](function(_0x2a2b0d){if(_0x2a2b0d){_0x2409f1=_0x2a2b0d;_0x2e0df5['model']=_[_0x4f49('0x52')](db[_0x4f49('0x58')][_0x4f49('0x37')]);_0x2e0df5[_0x4f49('0x3c')]=_['keys'](_0x5e3568[_0x4f49('0x3c')]);_0x2e0df5[_0x4f49('0x3d')]=_['intersection'](_0x2e0df5[_0x4f49('0x3b')],_0x2e0df5[_0x4f49('0x3c')]);_0x447dde[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x2e0df5[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x40')]));_0x447dde['attributes']=_0x447dde[_0x4f49('0x3e')][_0x4f49('0x41')]?_0x447dde[_0x4f49('0x3e')]:_0x2e0df5[_0x4f49('0x3b')];_0x447dde[_0x4f49('0x59')]=qs[_0x4f49('0x45')](_0x5e3568[_0x4f49('0x3c')]['sort']);_0x447dde[_0x4f49('0x46')]=qs['filters'](_[_0x4f49('0x47')](_0x5e3568[_0x4f49('0x3c')],_0x2e0df5[_0x4f49('0x3d')]));if(_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]){_0x447dde[_0x4f49('0x46')]=_[_0x4f49('0x4a')](_0x447dde[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x447dde[_0x4f49('0x3e')],function(_0x545552){var _0x2f9f2e={};_0x2f9f2e[_0x545552]={'$like':'%'+_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x2f9f2e;})});}_0x447dde=_[_0x4f49('0x4a')]({},_0x447dde,_0x5e3568['options']);return _0x2409f1['getConfigurations'](_0x447dde);}})[_0x4f49('0x1e')](function(_0x5e4879){if(_0x5e4879){_0x19a788=_0x5e4879[_0x4f49('0x41')];if(!_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x447dde[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x29')]);_0x447dde[_0x4f49('0x44')]=qs[_0x4f49('0x44')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x44')]);}return _0x2409f1[_0x4f49('0x56')](_0x447dde);}})[_0x4f49('0x1e')](function(_0x234984){if(_0x234984){return _0x234984?{'count':_0x19a788,'rows':_0x234984}:null;}})[_0x4f49('0x1e')](respondWithResult(_0x5d2b3c,null))[_0x4f49('0x4f')](handleError(_0x5d2b3c,null));};exports[_0x4f49('0x5a')]=function(_0x1f9161,_0x1434ea,_0x2c3962){if(_0x1f9161[_0x4f49('0x55')]['id']){delete _0x1f9161[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x1f9161['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x31df7f){if(_0x31df7f){_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5b')]=_0x31df7f['id'];_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5c')]=integrations[_0x4f49('0x5d')](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')]['type']);_0x1f9161['body'][_0x4f49('0x5f')]=integrations['getDescriptions'](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')][_0x4f49('0x39')]);return db[_0x4f49('0x58')]['create'](_0x1f9161['body'],{'include':[{'model':db[_0x4f49('0x60')],'as':_0x4f49('0x5c')},{'model':db['FreshdeskField'],'as':_0x4f49('0x5f')}]});}return null;})[_0x4f49('0x1e')](respondWithResult(_0x1434ea,null))['catch'](handleError(_0x1434ea,null));};exports[_0x4f49('0x61')]=function(_0x5b88aa,_0x121972,_0x160cf8){var _0x544356='';return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x5b88aa[_0x4f49('0x51')]['id']},'attributes':['id',_0x4f49('0x62'),_0x4f49('0x63')]})[_0x4f49('0x1e')](handleEntityNotFound(_0x121972,null))['then'](function(_0x25ed14){if(_0x25ed14){_0x544356=_0x25ed14['remoteUri'];var _0x3ecc94=_0x544356['slice'](-0x1);if(_0x3ecc94==='/'){_0x544356=_0x544356[_0x4f49('0x64')](0x0,_0x544356['lastIndexOf'](_0x3ecc94));}return rp({'method':_0x4f49('0x65'),'uri':util[_0x4f49('0x66')](_0x4f49('0x67'),_0x544356,_0x4f49('0x68')),'headers':{'Authorization':util['format'](_0x4f49('0x69'),new Buffer(util['format'](_0x4f49('0x6a'),_0x25ed14['apiKey']))[_0x4f49('0x6b')]('base64'))},'json':!![]});}})['then'](function(_0x329a49){if(_0x329a49){var _0x20b2be=[_0x4f49('0x6c'),'subject',_0x4f49('0x6d'),_0x4f49('0x6e'),'status','priority','group',_0x4f49('0x6f'),_0x4f49('0x70'),_0x4f49('0x71'),_0x4f49('0x72')];_[_0x4f49('0x73')](_0x329a49,function(_0x517144){return _0x20b2be[_0x4f49('0x74')](_0x517144[_0x4f49('0x33')])||!_0x517144[_0x4f49('0x75')]&&_0x517144['type']!==_0x4f49('0x76')&&_0x517144[_0x4f49('0x39')]!==_0x4f49('0x77');});return{'count':_0x329a49[_0x4f49('0x41')],'rows':_['map'](_0x329a49,function(_0x249799){return{'id':_0x249799[_0x4f49('0x33')],'name':_0x249799[_0x4f49('0x78')],'custom':!_0x249799[_0x4f49('0x75')],'options':_0x249799[_0x4f49('0x79')]?_['map'](_0x249799[_0x4f49('0x79')],function(_0x32539c){return{'name':_['capitalize'](_0x32539c),'value':_0x32539c};}):[]};})};}})[_0x4f49('0x1e')](respondWithResult(_0x121972,null))['catch'](function(_0x351a33){var _0x4d72a0=_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x1b')]?0x1f4:_0x351a33[_0x4f49('0x7a')]||0x1f4;logger[_0x4f49('0x22')](_0x4f49('0x7b'),'getFields',_0x4d72a0,JSON[_0x4f49('0x21')](_0x351a33));delete _0x351a33[_0x4f49('0x33')];if(_0x4d72a0===0x191){_0x4d72a0=0x190;}_0x121972[_0x4f49('0x26')](_0x4d72a0)[_0x4f49('0x34')](_0x5b88aa['query'][_0x4f49('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x351a33[_0x4f49('0x7a')]}:_0x351a33);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2bd16ae..e61f361 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 _0x7cd3=['bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x7cd3,0x181));var _0x37cd=function(_0x364b18,_0x395041){_0x364b18=_0x364b18-0x0;var _0x152136=_0x7cd3[_0x364b18];return _0x152136;};'use strict';var _=require(_0x37cd('0x0'));var util=require(_0x37cd('0x1'));var logger=require(_0x37cd('0x2'))(_0x37cd('0x3'));var moment=require(_0x37cd('0x4'));var BPromise=require(_0x37cd('0x5'));var rp=require(_0x37cd('0x6'));var fs=require('fs');var path=require(_0x37cd('0x7'));var rimraf=require('rimraf');var config=require(_0x37cd('0x8'));var attributes=require(_0x37cd('0x9'));var integrations=require(_0x37cd('0xa'));module[_0x37cd('0xb')]=function(_0x4545b2,_0x3642bc){return _0x4545b2[_0x37cd('0xc')](_0x37cd('0xd'),attributes,{'tableName':_0x37cd('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d60=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x46c035,_0x259c5c){var _0xedfa0a=function(_0x17814b){while(--_0x17814b){_0x46c035['push'](_0x46c035['shift']());}};_0xedfa0a(++_0x259c5c);}(_0x9d60,0x11b));var _0x09d6=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x9d60[_0x284a61];return _0x220e3c;};'use strict';var _=require(_0x09d6('0x0'));var util=require(_0x09d6('0x1'));var logger=require(_0x09d6('0x2'))(_0x09d6('0x3'));var moment=require('moment');var BPromise=require(_0x09d6('0x4'));var rp=require(_0x09d6('0x5'));var fs=require('fs');var path=require(_0x09d6('0x6'));var rimraf=require(_0x09d6('0x7'));var config=require(_0x09d6('0x8'));var attributes=require(_0x09d6('0x9'));var integrations=require(_0x09d6('0xa'));module[_0x09d6('0xb')]=function(_0x13d4b4,_0x54df3a){return _0x13d4b4[_0x09d6('0xc')](_0x09d6('0xd'),attributes,{'tableName':_0x09d6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5cb15e2..ed2794c 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 _0x8dec=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','then','util','moment','bluebird'];(function(_0x3eff5f,_0x188324){var _0x25b74f=function(_0x21f957){while(--_0x21f957){_0x3eff5f['push'](_0x3eff5f['shift']());}};_0x25b74f(++_0x188324);}(_0x8dec,0xd5));var _0xc8de=function(_0x1c17e3,_0x5995b9){_0x1c17e3=_0x1c17e3-0x0;var _0x54a18b=_0x8dec[_0x1c17e3];return _0x54a18b;};'use strict';var _=require('lodash');var util=require(_0xc8de('0x0'));var moment=require(_0xc8de('0x1'));var BPromise=require(_0xc8de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8de('0x3'));var db=require(_0xc8de('0x4'))['db'];var utils=require(_0xc8de('0x5'));var logger=require('../../config/logger')(_0xc8de('0x6'));var config=require(_0xc8de('0x7'));var jayson=require(_0xc8de('0x8'));var client=jayson[_0xc8de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc4495b,_0x519b86,_0x12eed1){return new BPromise(function(_0x5f39e6,_0x5024a5){return client[_0xc8de('0xa')](_0xc4495b,_0x12eed1)['then'](function(_0x2fa913){logger[_0xc8de('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x519b86,_0xc8de('0xc'));logger[_0xc8de('0xd')](_0xc8de('0xe'),_0x519b86,_0xc8de('0xc'),JSON[_0xc8de('0xf')](_0x2fa913));if(_0x2fa913['error']){if(_0x2fa913[_0xc8de('0x10')][_0xc8de('0x11')]===0x1f4){logger[_0xc8de('0x10')](_0xc8de('0x12'),_0x519b86,_0x2fa913['error'][_0xc8de('0x13')]);return _0x5024a5(_0x2fa913['error'][_0xc8de('0x13')]);}logger[_0xc8de('0x10')](_0xc8de('0x12'),_0x519b86,_0x2fa913['error'][_0xc8de('0x13')]);return _0x5f39e6(_0x2fa913[_0xc8de('0x10')]['message']);}else{logger[_0xc8de('0xb')](_0xc8de('0x12'),_0x519b86,_0xc8de('0xc'));_0x5f39e6(_0x2fa913[_0xc8de('0x14')][_0xc8de('0x13')]);}})[_0xc8de('0x15')](function(_0x2897b3){logger['error'](_0xc8de('0x12'),_0x519b86,_0x2897b3);_0x5024a5(_0x2897b3);});});}exports[_0xc8de('0x16')]=function(_0x5a6b9c){var _0x33a596=this;return new Promise(function(_0x55d9a3,_0x32b432){return db[_0xc8de('0x17')][_0xc8de('0x18')]({'raw':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c['options'][_0xc8de('0x1b')]||null:null,'attributes':_0x5a6b9c['options']?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1c')]||null:null,'limit':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1d')]||null:null,'include':_0x5a6b9c[_0xc8de('0x19')]?_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1e')]?_['map'](_0x5a6b9c[_0xc8de('0x19')][_0xc8de('0x1e')],function(_0x33cc4d){return{'model':db[_0x33cc4d['model']],'as':_0x33cc4d['as'],'attributes':_0x33cc4d['attributes'],'include':_0x33cc4d[_0xc8de('0x1e')]?_[_0xc8de('0x1f')](_0x33cc4d[_0xc8de('0x1e')],function(_0x323ad1){return{'model':db[_0x323ad1[_0xc8de('0x20')]],'as':_0x323ad1['as'],'attributes':_0x323ad1[_0xc8de('0x1c')],'include':_0x323ad1[_0xc8de('0x1e')]?_['map'](_0x323ad1[_0xc8de('0x1e')],function(_0x2d3e56){return{'model':db[_0x2d3e56[_0xc8de('0x20')]],'as':_0x2d3e56['as'],'attributes':_0x2d3e56['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35b5d5){logger[_0xc8de('0xb')]('GetFreshdeskAccount',_0x5a6b9c);logger[_0xc8de('0xd')](_0xc8de('0x16'),_0x5a6b9c,JSON[_0xc8de('0xf')](_0x35b5d5));_0x55d9a3(_0x35b5d5);})['catch'](function(_0x3aec63){logger[_0xc8de('0x10')](_0xc8de('0x16'),_0x3aec63[_0xc8de('0x13')],_0x5a6b9c);_0x32b432(_0x33a596[_0xc8de('0x10')](0x1f4,_0x3aec63[_0xc8de('0x13')]));});});};exports[_0xc8de('0x21')]=function(_0x1861da){var _0x17d92b=this;return new Promise(function(_0x493bcc,_0x2ec58d){return db[_0xc8de('0x17')][_0xc8de('0x22')]({'raw':_0x1861da[_0xc8de('0x19')]?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1a')]===undefined?!![]:![]:!![],'where':_0x1861da['options']?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1b')]||null:null,'attributes':_0x1861da[_0xc8de('0x19')]?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1c')]||null:null,'include':_0x1861da['options']?_0x1861da[_0xc8de('0x19')][_0xc8de('0x1e')]?_[_0xc8de('0x1f')](_0x1861da[_0xc8de('0x19')]['include'],function(_0x22dbfa){return{'model':db[_0x22dbfa[_0xc8de('0x20')]],'as':_0x22dbfa['as'],'attributes':_0x22dbfa[_0xc8de('0x1c')],'include':_0x22dbfa[_0xc8de('0x1e')]?_[_0xc8de('0x1f')](_0x22dbfa['include'],function(_0x514a1d){return{'model':db[_0x514a1d['model']],'as':_0x514a1d['as'],'attributes':_0x514a1d[_0xc8de('0x1c')],'include':_0x514a1d[_0xc8de('0x1e')]?_['map'](_0x514a1d[_0xc8de('0x1e')],function(_0xb2092c){return{'model':db[_0xb2092c[_0xc8de('0x20')]],'as':_0xb2092c['as'],'attributes':_0xb2092c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8de('0x23')](function(_0x2e7110){logger[_0xc8de('0xb')](_0xc8de('0x21'),_0x1861da);logger['debug'](_0xc8de('0x21'),_0x1861da,JSON[_0xc8de('0xf')](_0x2e7110));_0x493bcc(_0x2e7110);})[_0xc8de('0x15')](function(_0x5946a9){logger['error']('ShowFreshdeskAccount',_0x5946a9[_0xc8de('0x13')],_0x1861da);_0x2ec58d(_0x17d92b[_0xc8de('0x10')](0x1f4,_0x5946a9[_0xc8de('0x13')]));});});}; \ No newline at end of file +var _0xd085=['FreshdeskAccount','findAll','options','limit','include','map','model','attributes','ShowFreshdeskAccount','raw','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFreshdeskAccount'];(function(_0x5c9fee,_0x1d9db8){var _0x280fa1=function(_0x5796f2){while(--_0x5796f2){_0x5c9fee['push'](_0x5c9fee['shift']());}};_0x280fa1(++_0x1d9db8);}(_0xd085,0xab));var _0x5d08=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0xd085[_0x3b594b];return _0x1ea5f8;};'use strict';var _=require(_0x5d08('0x0'));var util=require('util');var moment=require(_0x5d08('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d08('0x2'));var fs=require('fs');var Redis=require(_0x5d08('0x3'));var db=require(_0x5d08('0x4'))['db'];var utils=require(_0x5d08('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d08('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x537b93,_0x5f0478,_0x32b66c){return new BPromise(function(_0x22133c,_0x5692c9){return client[_0x5d08('0x7')](_0x537b93,_0x32b66c)[_0x5d08('0x8')](function(_0x43572d){logger[_0x5d08('0x9')](_0x5d08('0xa'),_0x5f0478,'request\x20sent');logger[_0x5d08('0xb')](_0x5d08('0xc'),_0x5f0478,'request\x20sent',JSON[_0x5d08('0xd')](_0x43572d));if(_0x43572d[_0x5d08('0xe')]){if(_0x43572d[_0x5d08('0xe')][_0x5d08('0xf')]===0x1f4){logger[_0x5d08('0xe')](_0x5d08('0xa'),_0x5f0478,_0x43572d[_0x5d08('0xe')][_0x5d08('0x10')]);return _0x5692c9(_0x43572d['error'][_0x5d08('0x10')]);}logger[_0x5d08('0xe')](_0x5d08('0xa'),_0x5f0478,_0x43572d[_0x5d08('0xe')][_0x5d08('0x10')]);return _0x22133c(_0x43572d[_0x5d08('0xe')][_0x5d08('0x10')]);}else{logger['info'](_0x5d08('0xa'),_0x5f0478,_0x5d08('0x11'));_0x22133c(_0x43572d[_0x5d08('0x12')][_0x5d08('0x10')]);}})[_0x5d08('0x13')](function(_0x1b08eb){logger[_0x5d08('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5f0478,_0x1b08eb);_0x5692c9(_0x1b08eb);});});}exports[_0x5d08('0x14')]=function(_0x29e032){var _0x4f1f64=this;return new Promise(function(_0x2640e6,_0x12676d){return db[_0x5d08('0x15')][_0x5d08('0x16')]({'raw':_0x29e032[_0x5d08('0x17')]?_0x29e032[_0x5d08('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x29e032['options']?_0x29e032[_0x5d08('0x17')]['where']||null:null,'attributes':_0x29e032[_0x5d08('0x17')]?_0x29e032[_0x5d08('0x17')]['attributes']||null:null,'limit':_0x29e032['options']?_0x29e032['options'][_0x5d08('0x18')]||null:null,'include':_0x29e032[_0x5d08('0x17')]?_0x29e032[_0x5d08('0x17')][_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x29e032[_0x5d08('0x17')][_0x5d08('0x19')],function(_0x231cef){return{'model':db[_0x231cef[_0x5d08('0x1b')]],'as':_0x231cef['as'],'attributes':_0x231cef['attributes'],'include':_0x231cef[_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x231cef[_0x5d08('0x19')],function(_0xcb8568){return{'model':db[_0xcb8568[_0x5d08('0x1b')]],'as':_0xcb8568['as'],'attributes':_0xcb8568['attributes'],'include':_0xcb8568[_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0xcb8568[_0x5d08('0x19')],function(_0x39ca62){return{'model':db[_0x39ca62['model']],'as':_0x39ca62['as'],'attributes':_0x39ca62[_0x5d08('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5d08('0x8')](function(_0x511c03){logger[_0x5d08('0x9')]('GetFreshdeskAccount',_0x29e032);logger['debug'](_0x5d08('0x14'),_0x29e032,JSON[_0x5d08('0xd')](_0x511c03));_0x2640e6(_0x511c03);})[_0x5d08('0x13')](function(_0x106abb){logger[_0x5d08('0xe')](_0x5d08('0x14'),_0x106abb['message'],_0x29e032);_0x12676d(_0x4f1f64[_0x5d08('0xe')](0x1f4,_0x106abb[_0x5d08('0x10')]));});});};exports[_0x5d08('0x1d')]=function(_0x1ff5b2){var _0x2fb5d1=this;return new Promise(function(_0x28e3f1,_0xe006b2){return db[_0x5d08('0x15')]['find']({'raw':_0x1ff5b2[_0x5d08('0x17')]?_0x1ff5b2[_0x5d08('0x17')][_0x5d08('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ff5b2[_0x5d08('0x17')]?_0x1ff5b2[_0x5d08('0x17')][_0x5d08('0x1f')]||null:null,'attributes':_0x1ff5b2['options']?_0x1ff5b2[_0x5d08('0x17')]['attributes']||null:null,'include':_0x1ff5b2['options']?_0x1ff5b2[_0x5d08('0x17')][_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x1ff5b2[_0x5d08('0x17')]['include'],function(_0x406a6b){return{'model':db[_0x406a6b[_0x5d08('0x1b')]],'as':_0x406a6b['as'],'attributes':_0x406a6b[_0x5d08('0x1c')],'include':_0x406a6b[_0x5d08('0x19')]?_[_0x5d08('0x1a')](_0x406a6b[_0x5d08('0x19')],function(_0x2d1228){return{'model':db[_0x2d1228[_0x5d08('0x1b')]],'as':_0x2d1228['as'],'attributes':_0x2d1228[_0x5d08('0x1c')],'include':_0x2d1228['include']?_['map'](_0x2d1228['include'],function(_0x48ed08){return{'model':db[_0x48ed08['model']],'as':_0x48ed08['as'],'attributes':_0x48ed08[_0x5d08('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27d90d){logger[_0x5d08('0x9')](_0x5d08('0x1d'),_0x1ff5b2);logger[_0x5d08('0xb')]('ShowFreshdeskAccount',_0x1ff5b2,JSON[_0x5d08('0xd')](_0x27d90d));_0x28e3f1(_0x27d90d);})[_0x5d08('0x13')](function(_0x5f3fba){logger['error'](_0x5d08('0x1d'),_0x5f3fba[_0x5d08('0x10')],_0x1ff5b2);_0xe006b2(_0x2fb5d1['error'](0x1f4,_0x5f3fba[_0x5d08('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ef0bfd2..cbc58dd 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 _0xbb18=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','util','path','express'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xbb18,0xa5));var _0x8bb1=function(_0x33a21a,_0x22d1a8){_0x33a21a=_0x33a21a-0x0;var _0x4c628e=_0xbb18[_0x33a21a];return _0x4c628e;};'use strict';var multer=require('multer');var util=require(_0x8bb1('0x0'));var path=require(_0x8bb1('0x1'));var timeout=require('connect-timeout');var express=require(_0x8bb1('0x2'));var router=express['Router']();var auth=require(_0x8bb1('0x3'));var interaction=require(_0x8bb1('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x8bb1('0x5')]('/',auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x7')]);router['get']('/:id',auth[_0x8bb1('0x6')](),controller['show']);router['get'](_0x8bb1('0x8'),auth['isAuthenticated'](),controller[_0x8bb1('0x9')]);router[_0x8bb1('0x5')](_0x8bb1('0xa'),auth[_0x8bb1('0x6')](),controller['getSubjects']);router[_0x8bb1('0x5')](_0x8bb1('0xb'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0xc')]);router['get'](_0x8bb1('0xd'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8bb1('0xf')]);router[_0x8bb1('0x10')](_0x8bb1('0xd'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x11')]);router[_0x8bb1('0x12')](_0x8bb1('0x13'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x14')]);router[_0x8bb1('0x15')](_0x8bb1('0x13'),auth[_0x8bb1('0x6')](),controller[_0x8bb1('0x16')]);module[_0x8bb1('0x17')]=router; \ No newline at end of file +var _0xfa53=['/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','get','index','show'];(function(_0x275ea0,_0x2d0dd5){var _0x57b859=function(_0x5b31d5){while(--_0x5b31d5){_0x275ea0['push'](_0x275ea0['shift']());}};_0x57b859(++_0x2d0dd5);}(_0xfa53,0x16f));var _0x3fa5=function(_0x171e3a,_0x3f02c7){_0x171e3a=_0x171e3a-0x0;var _0x576990=_0xfa53[_0x171e3a];return _0x576990;};'use strict';var multer=require(_0x3fa5('0x0'));var util=require(_0x3fa5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3fa5('0x2'));var router=express['Router']();var auth=require(_0x3fa5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3fa5('0x4'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x3fa5('0x5')]('/',auth['isAuthenticated'](),controller[_0x3fa5('0x6')]);router[_0x3fa5('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3fa5('0x7')]);router[_0x3fa5('0x5')](_0x3fa5('0x8'),auth['isAuthenticated'](),controller[_0x3fa5('0x9')]);router[_0x3fa5('0x5')](_0x3fa5('0xa'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0xc')]);router[_0x3fa5('0x5')](_0x3fa5('0xd'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0xe')]);router['get']('/:id/tags',auth[_0x3fa5('0xb')](),controller['getTags']);router[_0x3fa5('0xf')]('/',auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x10')]);router[_0x3fa5('0xf')](_0x3fa5('0x11'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x12')]);router[_0x3fa5('0x13')](_0x3fa5('0x14'),auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x15')]);router[_0x3fa5('0x16')]('/:id',auth[_0x3fa5('0xb')](),controller[_0x3fa5('0x17')]);module[_0x3fa5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0313fdd..2df46c2 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 _0xace1=['STRING'];(function(_0x58d20c,_0x487de4){var _0x432d05=function(_0x44615c){while(--_0x44615c){_0x58d20c['push'](_0x58d20c['shift']());}};_0x432d05(++_0x487de4);}(_0xace1,0x133));var _0x1ace=function(_0xab3ec4,_0x3432fc){_0xab3ec4=_0xab3ec4-0x0;var _0x584c03=_0xace1[_0xab3ec4];return _0x584c03;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ace('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85bc=['STRING','sequelize','exports'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0x85bc,0xf4));var _0xc85b=function(_0x1cb511,_0x5f068a){_0x1cb511=_0x1cb511-0x0;var _0x374758=_0x85bc[_0x1cb511];return _0x374758;};'use strict';var Sequelize=require(_0xc85b('0x0'));module[_0xc85b('0x1')]={'name':{'type':Sequelize[_0xc85b('0x2')]},'description':{'type':Sequelize[_0xc85b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index dcc1eef..4cb2def 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 _0x6075=['keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','intersection','options','find','create','body','destroy','params','getFields','getSubjects','findOne','FreshdeskField','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','update','sendStatus','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x1e7dea,_0x387392){var _0x181ab8=function(_0xe23965){while(--_0xe23965){_0x1e7dea['push'](_0x1e7dea['shift']());}};_0x181ab8(++_0x387392);}(_0x6075,0x191));var _0x5607=function(_0x434e47,_0x530195){_0x434e47=_0x434e47-0x0;var _0x2acbdc=_0x6075[_0x434e47];return _0x2acbdc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5607('0x0'));var rimraf=require(_0x5607('0x1'));var zipdir=require(_0x5607('0x2'));var jsonpatch=require(_0x5607('0x3'));var rp=require(_0x5607('0x4'));var moment=require(_0x5607('0x5'));var BPromise=require(_0x5607('0x6'));var Mustache=require(_0x5607('0x7'));var util=require(_0x5607('0x8'));var path=require('path');var sox=require(_0x5607('0x9'));var csv=require(_0x5607('0xa'));var ejs=require(_0x5607('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5607('0xc'));var jsforce=require(_0x5607('0xd'));var deskjs=require(_0x5607('0xe'));var toCsv=require(_0x5607('0xa'));var querystring=require(_0x5607('0xf'));var Papa=require('papaparse');var Redis=require(_0x5607('0x10'));var authService=require(_0x5607('0x11'));var qs=require(_0x5607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5607('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5607('0x14'));var config=require(_0x5607('0x15'));var db=require(_0x5607('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5607('0x17')][_0x5607('0x18')]({'port':0x232a});function checkPasswordPattern(_0xc534bd,_0x39fc33,_0xe6368d){if(_0xe6368d){var _0x33c436=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c436[_0x5607('0x19')](_0x39fc33)){return _0xc534bd;}else{throw new db[(_0x5607('0x1a'))][(_0x5607('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 _0xc534bd;}}function respondWithRpcPromise(_0x1b0720,_0x275c5d,_0xe3e004,_0x505b12){return new BPromise(function(_0x556397,_0x3f149e){var _0x50e498=_0x505b12||client;return _0x50e498[_0x5607('0x1c')](_0x1b0720,_0xe3e004)[_0x5607('0x1d')](function(_0x1fa238){logger[_0x5607('0x1e')](_0x5607('0x1f'),_0x275c5d,_0x5607('0x20'));logger['debug'](_0x5607('0x21'),_0x275c5d,'request\x20sent',JSON[_0x5607('0x22')](_0x1fa238));if(_0x1fa238[_0x5607('0x23')]){if(_0x1fa238[_0x5607('0x23')]['code']===0x1f4){logger[_0x5607('0x23')](_0x5607('0x1f'),_0x275c5d,_0x1fa238[_0x5607('0x23')]['message']);return _0x3f149e(_0x1fa238[_0x5607('0x23')][_0x5607('0x24')]);}logger[_0x5607('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x275c5d,_0x1fa238[_0x5607('0x23')]['message']);return _0x556397(_0x1fa238['error'][_0x5607('0x24')]);}else{logger[_0x5607('0x1e')](_0x5607('0x1f'),_0x275c5d,_0x5607('0x20'));_0x556397(_0x1fa238[_0x5607('0x25')][_0x5607('0x24')]);}})[_0x5607('0x26')](function(_0x20918c){logger[_0x5607('0x23')](_0x5607('0x1f'),_0x275c5d,_0x20918c);_0x3f149e(_0x20918c);});});}function respondWithStatusCode(_0x593df7,_0x20ae60){_0x20ae60=_0x20ae60||0xcc;return function(_0x27e144){if(_0x27e144){return _0x593df7['sendStatus'](_0x20ae60);}return _0x593df7[_0x5607('0x27')](_0x20ae60)[_0x5607('0x28')]();};}function respondWithResult(_0xdb07c8,_0x400827){_0x400827=_0x400827||0xc8;return function(_0x447042){if(_0x447042){return _0xdb07c8[_0x5607('0x27')](_0x400827)[_0x5607('0x29')](_0x447042);}};}function respondWithFilteredResult(_0x3a6e65,_0x570e62){return function(_0xcd4e9f){if(_0xcd4e9f){var _0x309ede=_0xcd4e9f[_0x5607('0x2a')],_0x51b7d5=_0x570e62[_0x5607('0x2b')],_0x5932ae=_0x570e62[_0x5607('0x2b')]+_0x570e62[_0x5607('0x2c')],_0x12f58f;if(_0x5932ae>=_0x309ede){_0x5932ae=_0x309ede;_0x12f58f=0xc8;}else{_0x12f58f=0xce;}_0x3a6e65['status'](_0x12f58f);return _0x3a6e65[_0x5607('0x2d')]('Content-Range',_0x51b7d5+'-'+_0x5932ae+'/'+_0x309ede)[_0x5607('0x29')](_0xcd4e9f);}return null;};}function patchUpdates(_0x15a1a2){return function(_0x2c90e3){try{jsonpatch['apply'](_0x2c90e3,_0x15a1a2,!![]);}catch(_0x326c51){return BPromise['reject'](_0x326c51);}return _0x2c90e3[_0x5607('0x2e')]();};}function saveUpdates(_0x290982,_0x2f9a0a){return function(_0x1e4fee){if(_0x1e4fee){return _0x1e4fee[_0x5607('0x2f')](_0x290982)['then'](function(_0x3def3e){return _0x3def3e;});}return null;};}function removeEntity(_0x4ccf5b,_0x123f2c){return function(_0x284e22){if(_0x284e22){return _0x284e22['destroy']()[_0x5607('0x1d')](function(){_0x4ccf5b[_0x5607('0x27')](0xcc)[_0x5607('0x28')]();});}};}function handleEntityNotFound(_0x5ee39c,_0x26e651){return function(_0x9e21bd){if(!_0x9e21bd){_0x5ee39c[_0x5607('0x30')](0x194);}return _0x9e21bd;};}function handleError(_0x4ef3c3,_0x5d55cf){_0x5d55cf=_0x5d55cf||0x1f4;return function(_0x3478dc){logger[_0x5607('0x23')](_0x3478dc['stack']);if(_0x3478dc[_0x5607('0x31')]){delete _0x3478dc[_0x5607('0x31')];}_0x4ef3c3[_0x5607('0x27')](_0x5d55cf)['send'](_0x3478dc);};}exports[_0x5607('0x32')]=function(_0x540152,_0x2ed4c2){var _0x287430={},_0x2f7a6d={},_0x4b56bb={'count':0x0,'rows':[]};var _0x5f0df4=_['map'](db[_0x5607('0x33')][_0x5607('0x34')],function(_0x341b93){return{'name':_0x341b93[_0x5607('0x35')],'type':_0x341b93[_0x5607('0x36')][_0x5607('0x37')]};});_0x2f7a6d[_0x5607('0x38')]=_[_0x5607('0x39')](_0x5f0df4,'name');_0x2f7a6d[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x540152[_0x5607('0x3a')]);_0x2f7a6d[_0x5607('0x3c')]=_['intersection'](_0x2f7a6d[_0x5607('0x38')],_0x2f7a6d[_0x5607('0x3a')]);_0x287430['attributes']=_['intersection'](_0x2f7a6d[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x540152[_0x5607('0x3a')]['fields']));_0x287430['attributes']=_0x287430['attributes'][_0x5607('0x3e')]?_0x287430[_0x5607('0x3f')]:_0x2f7a6d[_0x5607('0x38')];if(!_0x540152['query'][_0x5607('0x40')](_0x5607('0x41'))){_0x287430[_0x5607('0x2c')]=qs[_0x5607('0x2c')](_0x540152[_0x5607('0x3a')][_0x5607('0x2c')]);_0x287430[_0x5607('0x2b')]=qs['offset'](_0x540152['query'][_0x5607('0x2b')]);}_0x287430[_0x5607('0x42')]=qs[_0x5607('0x43')](_0x540152['query'][_0x5607('0x43')]);_0x287430[_0x5607('0x44')]=qs['filters'](_[_0x5607('0x45')](_0x540152[_0x5607('0x3a')],_0x2f7a6d['filters']),_0x5f0df4);if(_0x540152['query'][_0x5607('0x46')]){_0x287430[_0x5607('0x44')]=_[_0x5607('0x47')](_0x287430['where'],{'$or':_[_0x5607('0x39')](_0x5f0df4,function(_0x722d16){if(_0x722d16['type']!==_0x5607('0x48')){var _0x19a596={};_0x19a596[_0x722d16['name']]={'$like':'%'+_0x540152[_0x5607('0x3a')][_0x5607('0x46')]+'%'};return _0x19a596;}})});}_0x287430=_[_0x5607('0x47')]({},_0x287430,_0x540152['options']);var _0x2dd1f8={'where':_0x287430[_0x5607('0x44')]};return db[_0x5607('0x33')][_0x5607('0x2a')](_0x2dd1f8)[_0x5607('0x1d')](function(_0x517cc5){_0x4b56bb[_0x5607('0x2a')]=_0x517cc5;if(_0x540152[_0x5607('0x3a')][_0x5607('0x49')]){_0x287430[_0x5607('0x4a')]=[{'all':!![]}];}return db[_0x5607('0x33')]['findAll'](_0x287430);})[_0x5607('0x1d')](function(_0x5c9b68){_0x4b56bb[_0x5607('0x4b')]=_0x5c9b68;return _0x4b56bb;})[_0x5607('0x1d')](respondWithFilteredResult(_0x2ed4c2,_0x287430))[_0x5607('0x26')](handleError(_0x2ed4c2,null));};exports[_0x5607('0x4c')]=function(_0x1b52b3,_0x416060){var _0x4a904b={'raw':![],'where':{'id':_0x1b52b3['params']['id']}},_0x5c0339={};_0x5c0339[_0x5607('0x38')]=_[_0x5607('0x3b')](db['FreshdeskConfiguration'][_0x5607('0x34')]);_0x5c0339[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x1b52b3[_0x5607('0x3a')]);_0x5c0339[_0x5607('0x3c')]=_[_0x5607('0x4d')](_0x5c0339[_0x5607('0x38')],_0x5c0339[_0x5607('0x3a')]);_0x4a904b[_0x5607('0x3f')]=_[_0x5607('0x4d')](_0x5c0339[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x1b52b3[_0x5607('0x3a')][_0x5607('0x3d')]));_0x4a904b[_0x5607('0x3f')]=_0x4a904b[_0x5607('0x3f')][_0x5607('0x3e')]?_0x4a904b['attributes']:_0x5c0339[_0x5607('0x38')];if(_0x1b52b3['query'][_0x5607('0x49')]){_0x4a904b[_0x5607('0x4a')]=[{'all':!![]}];}_0x4a904b=_[_0x5607('0x47')]({},_0x4a904b,_0x1b52b3[_0x5607('0x4e')]);return db[_0x5607('0x33')][_0x5607('0x4f')](_0x4a904b)['then'](handleEntityNotFound(_0x416060,null))[_0x5607('0x1d')](respondWithResult(_0x416060,null))['catch'](handleError(_0x416060,null));};exports['create']=function(_0x26c892,_0x46a119){return db[_0x5607('0x33')][_0x5607('0x50')](_0x26c892['body'],{})[_0x5607('0x1d')](respondWithResult(_0x46a119,0xc9))['catch'](handleError(_0x46a119,null));};exports[_0x5607('0x2f')]=function(_0x44fb73,_0x87fed5){if(_0x44fb73[_0x5607('0x51')]['id']){delete _0x44fb73['body']['id'];}return db[_0x5607('0x33')][_0x5607('0x4f')]({'where':{'id':_0x44fb73['params']['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x87fed5,null))['then'](saveUpdates(_0x44fb73[_0x5607('0x51')],null))[_0x5607('0x1d')](respondWithResult(_0x87fed5,null))[_0x5607('0x26')](handleError(_0x87fed5,null));};exports[_0x5607('0x52')]=function(_0x46a44c,_0x4c6785){return db[_0x5607('0x33')][_0x5607('0x4f')]({'where':{'id':_0x46a44c[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x4c6785,null))['then'](removeEntity(_0x4c6785,null))[_0x5607('0x26')](handleError(_0x4c6785,null));};exports[_0x5607('0x54')]=function(_0x4fdf0e,_0x4da3f9,_0x42bc03){var _0xb679d3={};var _0x2a1c29={};var _0x352f97;var _0x2721f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4fdf0e[_0x5607('0x53')]['id']}})['then'](handleEntityNotFound(_0x4da3f9,null))[_0x5607('0x1d')](function(_0x50162a){if(_0x50162a){_0x352f97=_0x50162a;_0x2a1c29['model']=_['keys'](db['FreshdeskField'][_0x5607('0x34')]);_0x2a1c29[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x4fdf0e[_0x5607('0x3a')]);_0x2a1c29[_0x5607('0x3c')]=_[_0x5607('0x4d')](_0x2a1c29[_0x5607('0x38')],_0x2a1c29['query']);_0xb679d3[_0x5607('0x3f')]=_[_0x5607('0x4d')](_0x2a1c29[_0x5607('0x38')],qs['fields'](_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x3d')]));_0xb679d3['attributes']=_0xb679d3[_0x5607('0x3f')]['length']?_0xb679d3[_0x5607('0x3f')]:_0x2a1c29[_0x5607('0x38')];_0xb679d3['order']=qs[_0x5607('0x43')](_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x43')]);_0xb679d3[_0x5607('0x44')]=qs[_0x5607('0x3c')](_[_0x5607('0x45')](_0x4fdf0e[_0x5607('0x3a')],_0x2a1c29['filters']));if(_0x4fdf0e['query'][_0x5607('0x46')]){_0xb679d3[_0x5607('0x44')]=_[_0x5607('0x47')](_0xb679d3[_0x5607('0x44')],{'$or':_[_0x5607('0x39')](_0xb679d3[_0x5607('0x3f')],function(_0x252ce7){var _0x30d982={};_0x30d982[_0x252ce7]={'$like':'%'+_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x46')]+'%'};return _0x30d982;})});}_0xb679d3=_['merge']({},_0xb679d3,_0x4fdf0e[_0x5607('0x4e')]);return _0x352f97['getFields'](_0xb679d3);}})[_0x5607('0x1d')](function(_0x112e71){if(_0x112e71){_0x2721f=_0x112e71[_0x5607('0x3e')];if(!_0x4fdf0e['query']['hasOwnProperty'](_0x5607('0x41'))){_0xb679d3['limit']=qs['limit'](_0x4fdf0e['query']['limit']);_0xb679d3[_0x5607('0x2b')]=qs[_0x5607('0x2b')](_0x4fdf0e[_0x5607('0x3a')][_0x5607('0x2b')]);}return _0x352f97[_0x5607('0x54')](_0xb679d3);}})[_0x5607('0x1d')](function(_0x3aba9c){if(_0x3aba9c){return _0x3aba9c?{'count':_0x2721f,'rows':_0x3aba9c}:null;}})['then'](respondWithResult(_0x4da3f9,null))[_0x5607('0x26')](handleError(_0x4da3f9,null));};exports[_0x5607('0x55')]=function(_0x39ff6b,_0x3c9502,_0x190a13){var _0x5e746c={};var _0x150dcd={};var _0xf440e3;var _0x37308e;return db['FreshdeskConfiguration'][_0x5607('0x56')]({'where':{'id':_0x39ff6b[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x3c9502,null))['then'](function(_0x345fbd){if(_0x345fbd){_0xf440e3=_0x345fbd;_0x150dcd[_0x5607('0x38')]=_[_0x5607('0x3b')](db[_0x5607('0x57')]['rawAttributes']);_0x150dcd[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x39ff6b[_0x5607('0x3a')]);_0x150dcd[_0x5607('0x3c')]=_[_0x5607('0x4d')](_0x150dcd[_0x5607('0x38')],_0x150dcd[_0x5607('0x3a')]);_0x5e746c[_0x5607('0x3f')]=_['intersection'](_0x150dcd['model'],qs[_0x5607('0x3d')](_0x39ff6b[_0x5607('0x3a')][_0x5607('0x3d')]));_0x5e746c[_0x5607('0x3f')]=_0x5e746c[_0x5607('0x3f')][_0x5607('0x3e')]?_0x5e746c['attributes']:_0x150dcd[_0x5607('0x38')];_0x5e746c[_0x5607('0x42')]=qs[_0x5607('0x43')](_0x39ff6b[_0x5607('0x3a')][_0x5607('0x43')]);_0x5e746c[_0x5607('0x44')]=qs[_0x5607('0x3c')](_[_0x5607('0x45')](_0x39ff6b['query'],_0x150dcd[_0x5607('0x3c')]));if(_0x39ff6b[_0x5607('0x3a')]['filter']){_0x5e746c['where']=_[_0x5607('0x47')](_0x5e746c['where'],{'$or':_[_0x5607('0x39')](_0x5e746c['attributes'],function(_0x5e9b53){var _0x212564={};_0x212564[_0x5e9b53]={'$like':'%'+_0x39ff6b[_0x5607('0x3a')]['filter']+'%'};return _0x212564;})});}_0x5e746c=_['merge']({},_0x5e746c,_0x39ff6b[_0x5607('0x4e')]);return _0xf440e3['getSubjects'](_0x5e746c);}})['then'](function(_0x27adef){if(_0x27adef){_0x37308e=_0x27adef[_0x5607('0x3e')];if(!_0x39ff6b[_0x5607('0x3a')]['hasOwnProperty'](_0x5607('0x41'))){_0x5e746c['limit']=qs[_0x5607('0x2c')](_0x39ff6b[_0x5607('0x3a')][_0x5607('0x2c')]);_0x5e746c[_0x5607('0x2b')]=qs[_0x5607('0x2b')](_0x39ff6b['query'][_0x5607('0x2b')]);}return _0xf440e3['getSubjects'](_0x5e746c);}})[_0x5607('0x1d')](function(_0x4a2384){if(_0x4a2384){return _0x4a2384?{'count':_0x37308e,'rows':_0x4a2384}:null;}})[_0x5607('0x1d')](respondWithResult(_0x3c9502,null))[_0x5607('0x26')](handleError(_0x3c9502,null));};exports[_0x5607('0x58')]=function(_0x35f3f6,_0x581cee,_0x1470a6){var _0x866192={};var _0x34e1c3={};var _0x462dd5;var _0x357c25;return db[_0x5607('0x33')][_0x5607('0x56')]({'where':{'id':_0x35f3f6[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x581cee,null))[_0x5607('0x1d')](function(_0x16e5da){if(_0x16e5da){_0x462dd5=_0x16e5da;_0x34e1c3[_0x5607('0x38')]=_[_0x5607('0x3b')](db[_0x5607('0x57')][_0x5607('0x34')]);_0x34e1c3[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x35f3f6[_0x5607('0x3a')]);_0x34e1c3['filters']=_[_0x5607('0x4d')](_0x34e1c3['model'],_0x34e1c3[_0x5607('0x3a')]);_0x866192['attributes']=_[_0x5607('0x4d')](_0x34e1c3[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x35f3f6[_0x5607('0x3a')][_0x5607('0x3d')]));_0x866192[_0x5607('0x3f')]=_0x866192[_0x5607('0x3f')][_0x5607('0x3e')]?_0x866192[_0x5607('0x3f')]:_0x34e1c3['model'];_0x866192['order']=qs[_0x5607('0x43')](_0x35f3f6[_0x5607('0x3a')][_0x5607('0x43')]);_0x866192[_0x5607('0x44')]=qs[_0x5607('0x3c')](_[_0x5607('0x45')](_0x35f3f6[_0x5607('0x3a')],_0x34e1c3['filters']));if(_0x35f3f6['query'][_0x5607('0x46')]){_0x866192['where']=_['merge'](_0x866192[_0x5607('0x44')],{'$or':_[_0x5607('0x39')](_0x866192[_0x5607('0x3f')],function(_0x1488ec){var _0x5f672c={};_0x5f672c[_0x1488ec]={'$like':'%'+_0x35f3f6[_0x5607('0x3a')][_0x5607('0x46')]+'%'};return _0x5f672c;})});}_0x866192=_[_0x5607('0x47')]({},_0x866192,_0x35f3f6[_0x5607('0x4e')]);return _0x462dd5[_0x5607('0x58')](_0x866192);}})[_0x5607('0x1d')](function(_0x4a638d){if(_0x4a638d){_0x357c25=_0x4a638d[_0x5607('0x3e')];if(!_0x35f3f6[_0x5607('0x3a')][_0x5607('0x40')](_0x5607('0x41'))){_0x866192[_0x5607('0x2c')]=qs[_0x5607('0x2c')](_0x35f3f6[_0x5607('0x3a')][_0x5607('0x2c')]);_0x866192[_0x5607('0x2b')]=qs['offset'](_0x35f3f6['query']['offset']);}return _0x462dd5[_0x5607('0x58')](_0x866192);}})[_0x5607('0x1d')](function(_0xee9c0b){if(_0xee9c0b){return _0xee9c0b?{'count':_0x357c25,'rows':_0xee9c0b}:null;}})[_0x5607('0x1d')](respondWithResult(_0x581cee,null))[_0x5607('0x26')](handleError(_0x581cee,null));};exports[_0x5607('0x59')]=function(_0x321197,_0x4a6072,_0x3a28cd){var _0x3c8b56={};var _0xad467={};var _0x1e9af2;var _0x265fa3;return db[_0x5607('0x33')][_0x5607('0x56')]({'where':{'id':_0x321197[_0x5607('0x53')]['id']}})[_0x5607('0x1d')](handleEntityNotFound(_0x4a6072,null))[_0x5607('0x1d')](function(_0x3a38f4){if(_0x3a38f4){_0x1e9af2=_0x3a38f4;_0xad467['model']=_[_0x5607('0x3b')](db[_0x5607('0x5a')][_0x5607('0x34')]);_0xad467[_0x5607('0x3a')]=_[_0x5607('0x3b')](_0x321197[_0x5607('0x3a')]);_0xad467['filters']=_[_0x5607('0x4d')](_0xad467[_0x5607('0x38')],_0xad467[_0x5607('0x3a')]);_0x3c8b56[_0x5607('0x3f')]=_['intersection'](_0xad467[_0x5607('0x38')],qs[_0x5607('0x3d')](_0x321197['query']['fields']));_0x3c8b56[_0x5607('0x3f')]=_0x3c8b56['attributes'][_0x5607('0x3e')]?_0x3c8b56['attributes']:_0xad467[_0x5607('0x38')];_0x3c8b56[_0x5607('0x42')]=qs['sort'](_0x321197['query'][_0x5607('0x43')]);_0x3c8b56[_0x5607('0x44')]=qs[_0x5607('0x3c')](_['pick'](_0x321197['query'],_0xad467[_0x5607('0x3c')]));if(_0x321197[_0x5607('0x3a')][_0x5607('0x46')]){_0x3c8b56[_0x5607('0x44')]=_[_0x5607('0x47')](_0x3c8b56['where'],{'$or':_['map'](_0x3c8b56[_0x5607('0x3f')],function(_0x204f8d){var _0x20ed37={};_0x20ed37[_0x204f8d]={'$like':'%'+_0x321197[_0x5607('0x3a')]['filter']+'%'};return _0x20ed37;})});}_0x3c8b56=_[_0x5607('0x47')]({},_0x3c8b56,_0x321197['options']);return _0x1e9af2[_0x5607('0x59')](_0x3c8b56);}})[_0x5607('0x1d')](function(_0x1b5e38){if(_0x1b5e38){_0x265fa3=_0x1b5e38['length'];if(!_0x321197[_0x5607('0x3a')][_0x5607('0x40')](_0x5607('0x41'))){_0x3c8b56[_0x5607('0x2c')]=qs[_0x5607('0x2c')](_0x321197[_0x5607('0x3a')][_0x5607('0x2c')]);_0x3c8b56['offset']=qs['offset'](_0x321197['query'][_0x5607('0x2b')]);}return _0x1e9af2[_0x5607('0x59')](_0x3c8b56);}})['then'](function(_0x492d51){if(_0x492d51){return _0x492d51?{'count':_0x265fa3,'rows':_0x492d51}:null;}})[_0x5607('0x1d')](respondWithResult(_0x4a6072,null))[_0x5607('0x26')](handleError(_0x4a6072,null));};exports['setTags']=function(_0x146aa3,_0x4ac325,_0xaebb49){if(_0x146aa3['body']['id']){delete _0x146aa3['body']['id'];}return db[_0x5607('0x33')][_0x5607('0x56')]({'where':{'id':_0x146aa3['params']['id']}})['then'](handleEntityNotFound(_0x4ac325,null))[_0x5607('0x1d')](function(_0xc0add5){if(_0xc0add5){return _0xc0add5['setTags'](_0x146aa3[_0x5607('0x51')][_0x5607('0x5b')]||[]);}return null;})[_0x5607('0x1d')](respondWithResult(_0x4ac325,null))['catch'](handleError(_0x4ac325,null));}; \ No newline at end of file +var _0x03d2=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','count','includeAll','include','rows','show','params','find','create','body','destroy','getFields','FreshdeskField','getSubjects','findOne','rawAttributes','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','stack','name','send','index','map'];(function(_0x36b717,_0x46d71e){var _0x121337=function(_0x108b7b){while(--_0x108b7b){_0x36b717['push'](_0x36b717['shift']());}};_0x121337(++_0x46d71e);}(_0x03d2,0xe3));var _0x203d=function(_0x4dc17e,_0x2cdc03){_0x4dc17e=_0x4dc17e-0x0;var _0xf33afe=_0x03d2[_0x4dc17e];return _0xf33afe;};'use strict';var pdf=require(_0x203d('0x0'));var emlformat=require(_0x203d('0x1'));var rimraf=require(_0x203d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x203d('0x3'));var moment=require(_0x203d('0x4'));var BPromise=require(_0x203d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x203d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x203d('0x7'));var fs=require('fs');var _=require(_0x203d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x203d('0x9'));var toCsv=require('to-csv');var querystring=require(_0x203d('0xa'));var Papa=require(_0x203d('0xb'));var Redis=require('ioredis');var authService=require(_0x203d('0xc'));var qs=require(_0x203d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x203d('0xe'));var logger=require(_0x203d('0xf'))(_0x203d('0x10'));var utils=require('../../config/utils');var config=require(_0x203d('0x11'));var db=require(_0x203d('0x12'))['db'];var jayson=require(_0x203d('0x13'));var client=jayson[_0x203d('0x14')][_0x203d('0x15')]({'port':0x232a});function checkPasswordPattern(_0x1fbd04,_0x150fd6,_0x12a090){if(_0x12a090){var _0x275019=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x275019[_0x203d('0x16')](_0x150fd6)){return _0x1fbd04;}else{throw new db[(_0x203d('0x17'))][(_0x203d('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1fbd04;}}function respondWithRpcPromise(_0x399e4e,_0x5e7c7f,_0x4c3e54,_0x144ef5){return new BPromise(function(_0x1eabfb,_0x2e44da){var _0x5d7dbc=_0x144ef5||client;return _0x5d7dbc[_0x203d('0x19')](_0x399e4e,_0x4c3e54)[_0x203d('0x1a')](function(_0x33b4ba){logger[_0x203d('0x1b')](_0x203d('0x1c'),_0x5e7c7f,_0x203d('0x1d'));logger['debug'](_0x203d('0x1e'),_0x5e7c7f,_0x203d('0x1d'),JSON[_0x203d('0x1f')](_0x33b4ba));if(_0x33b4ba[_0x203d('0x20')]){if(_0x33b4ba[_0x203d('0x20')][_0x203d('0x21')]===0x1f4){logger[_0x203d('0x20')](_0x203d('0x1c'),_0x5e7c7f,_0x33b4ba[_0x203d('0x20')]['message']);return _0x2e44da(_0x33b4ba[_0x203d('0x20')][_0x203d('0x22')]);}logger[_0x203d('0x20')](_0x203d('0x1c'),_0x5e7c7f,_0x33b4ba['error'][_0x203d('0x22')]);return _0x1eabfb(_0x33b4ba[_0x203d('0x20')]['message']);}else{logger[_0x203d('0x1b')](_0x203d('0x1c'),_0x5e7c7f,_0x203d('0x1d'));_0x1eabfb(_0x33b4ba[_0x203d('0x23')]['message']);}})[_0x203d('0x24')](function(_0x32e8ab){logger[_0x203d('0x20')](_0x203d('0x1c'),_0x5e7c7f,_0x32e8ab);_0x2e44da(_0x32e8ab);});});}function respondWithStatusCode(_0x93387f,_0x5c2c98){_0x5c2c98=_0x5c2c98||0xcc;return function(_0x55a70e){if(_0x55a70e){return _0x93387f[_0x203d('0x25')](_0x5c2c98);}return _0x93387f[_0x203d('0x26')](_0x5c2c98)[_0x203d('0x27')]();};}function respondWithResult(_0x45c113,_0x1e8e03){_0x1e8e03=_0x1e8e03||0xc8;return function(_0x5270f5){if(_0x5270f5){return _0x45c113[_0x203d('0x26')](_0x1e8e03)[_0x203d('0x28')](_0x5270f5);}};}function respondWithFilteredResult(_0x250d75,_0x41c4b9){return function(_0x13dce3){if(_0x13dce3){var _0x1efddb=_0x13dce3['count'],_0x30181e=_0x41c4b9[_0x203d('0x29')],_0x22f7ea=_0x41c4b9['offset']+_0x41c4b9[_0x203d('0x2a')],_0x39c731;if(_0x22f7ea>=_0x1efddb){_0x22f7ea=_0x1efddb;_0x39c731=0xc8;}else{_0x39c731=0xce;}_0x250d75[_0x203d('0x26')](_0x39c731);return _0x250d75[_0x203d('0x2b')](_0x203d('0x2c'),_0x30181e+'-'+_0x22f7ea+'/'+_0x1efddb)[_0x203d('0x28')](_0x13dce3);}return null;};}function patchUpdates(_0x594bbe){return function(_0x44e7c0){try{jsonpatch['apply'](_0x44e7c0,_0x594bbe,!![]);}catch(_0x51891f){return BPromise['reject'](_0x51891f);}return _0x44e7c0[_0x203d('0x2d')]();};}function saveUpdates(_0x52590e,_0x3c8b06){return function(_0x39d1da){if(_0x39d1da){return _0x39d1da[_0x203d('0x2e')](_0x52590e)['then'](function(_0x12ff03){return _0x12ff03;});}return null;};}function removeEntity(_0x9cfdc8,_0x259947){return function(_0x18201f){if(_0x18201f){return _0x18201f['destroy']()[_0x203d('0x1a')](function(){_0x9cfdc8['status'](0xcc)[_0x203d('0x27')]();});}};}function handleEntityNotFound(_0x3ff44f,_0x300d40){return function(_0x4e667c){if(!_0x4e667c){_0x3ff44f['sendStatus'](0x194);}return _0x4e667c;};}function handleError(_0x4747a6,_0x1d5af0){_0x1d5af0=_0x1d5af0||0x1f4;return function(_0x5e2d23){logger[_0x203d('0x20')](_0x5e2d23[_0x203d('0x2f')]);if(_0x5e2d23[_0x203d('0x30')]){delete _0x5e2d23[_0x203d('0x30')];}_0x4747a6[_0x203d('0x26')](_0x1d5af0)[_0x203d('0x31')](_0x5e2d23);};}exports[_0x203d('0x32')]=function(_0x230df9,_0x21f8d3){var _0x4e6cec={},_0x48d913={},_0x192aba={'count':0x0,'rows':[]};var _0x3e4d7f=_[_0x203d('0x33')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x18e7d3){return{'name':_0x18e7d3[_0x203d('0x34')],'type':_0x18e7d3[_0x203d('0x35')][_0x203d('0x36')]};});_0x48d913[_0x203d('0x37')]=_[_0x203d('0x33')](_0x3e4d7f,_0x203d('0x30'));_0x48d913[_0x203d('0x38')]=_[_0x203d('0x39')](_0x230df9[_0x203d('0x38')]);_0x48d913[_0x203d('0x3a')]=_[_0x203d('0x3b')](_0x48d913[_0x203d('0x37')],_0x48d913[_0x203d('0x38')]);_0x4e6cec[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0x48d913[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x230df9[_0x203d('0x38')][_0x203d('0x3d')]));_0x4e6cec[_0x203d('0x3c')]=_0x4e6cec['attributes'][_0x203d('0x3e')]?_0x4e6cec[_0x203d('0x3c')]:_0x48d913[_0x203d('0x37')];if(!_0x230df9[_0x203d('0x38')][_0x203d('0x3f')](_0x203d('0x40'))){_0x4e6cec[_0x203d('0x2a')]=qs['limit'](_0x230df9['query'][_0x203d('0x2a')]);_0x4e6cec[_0x203d('0x29')]=qs[_0x203d('0x29')](_0x230df9[_0x203d('0x38')][_0x203d('0x29')]);}_0x4e6cec[_0x203d('0x41')]=qs['sort'](_0x230df9[_0x203d('0x38')][_0x203d('0x42')]);_0x4e6cec[_0x203d('0x43')]=qs[_0x203d('0x3a')](_[_0x203d('0x44')](_0x230df9[_0x203d('0x38')],_0x48d913['filters']),_0x3e4d7f);if(_0x230df9['query'][_0x203d('0x45')]){_0x4e6cec[_0x203d('0x43')]=_[_0x203d('0x46')](_0x4e6cec['where'],{'$or':_['map'](_0x3e4d7f,function(_0x573985){if(_0x573985[_0x203d('0x35')]!==_0x203d('0x47')){var _0x1d3652={};_0x1d3652[_0x573985[_0x203d('0x30')]]={'$like':'%'+_0x230df9[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x1d3652;}})});}_0x4e6cec=_[_0x203d('0x46')]({},_0x4e6cec,_0x230df9[_0x203d('0x48')]);var _0x3852f8={'where':_0x4e6cec[_0x203d('0x43')]};return db[_0x203d('0x49')][_0x203d('0x4a')](_0x3852f8)[_0x203d('0x1a')](function(_0x5786b9){_0x192aba[_0x203d('0x4a')]=_0x5786b9;if(_0x230df9[_0x203d('0x38')][_0x203d('0x4b')]){_0x4e6cec[_0x203d('0x4c')]=[{'all':!![]}];}return db[_0x203d('0x49')]['findAll'](_0x4e6cec);})[_0x203d('0x1a')](function(_0x3624e3){_0x192aba[_0x203d('0x4d')]=_0x3624e3;return _0x192aba;})[_0x203d('0x1a')](respondWithFilteredResult(_0x21f8d3,_0x4e6cec))[_0x203d('0x24')](handleError(_0x21f8d3,null));};exports[_0x203d('0x4e')]=function(_0x5a88b2,_0x248680){var _0x176db9={'raw':![],'where':{'id':_0x5a88b2[_0x203d('0x4f')]['id']}},_0x494b29={};_0x494b29[_0x203d('0x37')]=_[_0x203d('0x39')](db[_0x203d('0x49')]['rawAttributes']);_0x494b29[_0x203d('0x38')]=_['keys'](_0x5a88b2[_0x203d('0x38')]);_0x494b29[_0x203d('0x3a')]=_[_0x203d('0x3b')](_0x494b29[_0x203d('0x37')],_0x494b29[_0x203d('0x38')]);_0x176db9['attributes']=_['intersection'](_0x494b29[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x5a88b2[_0x203d('0x38')]['fields']));_0x176db9[_0x203d('0x3c')]=_0x176db9[_0x203d('0x3c')][_0x203d('0x3e')]?_0x176db9[_0x203d('0x3c')]:_0x494b29[_0x203d('0x37')];if(_0x5a88b2['query']['includeAll']){_0x176db9['include']=[{'all':!![]}];}_0x176db9=_[_0x203d('0x46')]({},_0x176db9,_0x5a88b2[_0x203d('0x48')]);return db[_0x203d('0x49')][_0x203d('0x50')](_0x176db9)[_0x203d('0x1a')](handleEntityNotFound(_0x248680,null))['then'](respondWithResult(_0x248680,null))[_0x203d('0x24')](handleError(_0x248680,null));};exports[_0x203d('0x51')]=function(_0x19412d,_0x1c94f2){return db[_0x203d('0x49')]['create'](_0x19412d[_0x203d('0x52')],{})['then'](respondWithResult(_0x1c94f2,0xc9))['catch'](handleError(_0x1c94f2,null));};exports[_0x203d('0x2e')]=function(_0x91b97f,_0x529143){if(_0x91b97f[_0x203d('0x52')]['id']){delete _0x91b97f['body']['id'];}return db[_0x203d('0x49')][_0x203d('0x50')]({'where':{'id':_0x91b97f[_0x203d('0x4f')]['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0x529143,null))[_0x203d('0x1a')](saveUpdates(_0x91b97f['body'],null))['then'](respondWithResult(_0x529143,null))[_0x203d('0x24')](handleError(_0x529143,null));};exports[_0x203d('0x53')]=function(_0x5803c0,_0x2bd9bb){return db[_0x203d('0x49')][_0x203d('0x50')]({'where':{'id':_0x5803c0['params']['id']}})['then'](handleEntityNotFound(_0x2bd9bb,null))[_0x203d('0x1a')](removeEntity(_0x2bd9bb,null))[_0x203d('0x24')](handleError(_0x2bd9bb,null));};exports[_0x203d('0x54')]=function(_0x3be9a2,_0xa73ea4,_0x342d55){var _0x437928={};var _0xf9ca6a={};var _0x5c952d;var _0x5de1b5;return db[_0x203d('0x49')]['findOne']({'where':{'id':_0x3be9a2['params']['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0xa73ea4,null))[_0x203d('0x1a')](function(_0x4a378c){if(_0x4a378c){_0x5c952d=_0x4a378c;_0xf9ca6a['model']=_['keys'](db[_0x203d('0x55')]['rawAttributes']);_0xf9ca6a[_0x203d('0x38')]=_[_0x203d('0x39')](_0x3be9a2[_0x203d('0x38')]);_0xf9ca6a[_0x203d('0x3a')]=_[_0x203d('0x3b')](_0xf9ca6a[_0x203d('0x37')],_0xf9ca6a[_0x203d('0x38')]);_0x437928[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0xf9ca6a[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x3be9a2[_0x203d('0x38')][_0x203d('0x3d')]));_0x437928[_0x203d('0x3c')]=_0x437928['attributes'][_0x203d('0x3e')]?_0x437928[_0x203d('0x3c')]:_0xf9ca6a['model'];_0x437928[_0x203d('0x41')]=qs[_0x203d('0x42')](_0x3be9a2['query'][_0x203d('0x42')]);_0x437928[_0x203d('0x43')]=qs[_0x203d('0x3a')](_[_0x203d('0x44')](_0x3be9a2[_0x203d('0x38')],_0xf9ca6a[_0x203d('0x3a')]));if(_0x3be9a2[_0x203d('0x38')]['filter']){_0x437928['where']=_[_0x203d('0x46')](_0x437928[_0x203d('0x43')],{'$or':_[_0x203d('0x33')](_0x437928[_0x203d('0x3c')],function(_0x195a4c){var _0x4b77cc={};_0x4b77cc[_0x195a4c]={'$like':'%'+_0x3be9a2[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x4b77cc;})});}_0x437928=_['merge']({},_0x437928,_0x3be9a2['options']);return _0x5c952d[_0x203d('0x54')](_0x437928);}})['then'](function(_0x5aba64){if(_0x5aba64){_0x5de1b5=_0x5aba64[_0x203d('0x3e')];if(!_0x3be9a2[_0x203d('0x38')][_0x203d('0x3f')](_0x203d('0x40'))){_0x437928[_0x203d('0x2a')]=qs[_0x203d('0x2a')](_0x3be9a2[_0x203d('0x38')]['limit']);_0x437928['offset']=qs['offset'](_0x3be9a2['query'][_0x203d('0x29')]);}return _0x5c952d[_0x203d('0x54')](_0x437928);}})[_0x203d('0x1a')](function(_0x25bb7d){if(_0x25bb7d){return _0x25bb7d?{'count':_0x5de1b5,'rows':_0x25bb7d}:null;}})['then'](respondWithResult(_0xa73ea4,null))[_0x203d('0x24')](handleError(_0xa73ea4,null));};exports[_0x203d('0x56')]=function(_0x51c99a,_0x1213be,_0x43e161){var _0x36f603={};var _0x3b618a={};var _0x4bcb88;var _0x4999be;return db[_0x203d('0x49')][_0x203d('0x57')]({'where':{'id':_0x51c99a[_0x203d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1213be,null))['then'](function(_0x273b50){if(_0x273b50){_0x4bcb88=_0x273b50;_0x3b618a[_0x203d('0x37')]=_[_0x203d('0x39')](db[_0x203d('0x55')][_0x203d('0x58')]);_0x3b618a[_0x203d('0x38')]=_[_0x203d('0x39')](_0x51c99a[_0x203d('0x38')]);_0x3b618a['filters']=_[_0x203d('0x3b')](_0x3b618a[_0x203d('0x37')],_0x3b618a['query']);_0x36f603[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0x3b618a[_0x203d('0x37')],qs['fields'](_0x51c99a['query']['fields']));_0x36f603[_0x203d('0x3c')]=_0x36f603[_0x203d('0x3c')][_0x203d('0x3e')]?_0x36f603[_0x203d('0x3c')]:_0x3b618a[_0x203d('0x37')];_0x36f603['order']=qs[_0x203d('0x42')](_0x51c99a[_0x203d('0x38')][_0x203d('0x42')]);_0x36f603[_0x203d('0x43')]=qs['filters'](_['pick'](_0x51c99a[_0x203d('0x38')],_0x3b618a['filters']));if(_0x51c99a[_0x203d('0x38')]['filter']){_0x36f603[_0x203d('0x43')]=_[_0x203d('0x46')](_0x36f603[_0x203d('0x43')],{'$or':_['map'](_0x36f603['attributes'],function(_0x20e3f1){var _0x24485b={};_0x24485b[_0x20e3f1]={'$like':'%'+_0x51c99a[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x24485b;})});}_0x36f603=_[_0x203d('0x46')]({},_0x36f603,_0x51c99a[_0x203d('0x48')]);return _0x4bcb88[_0x203d('0x56')](_0x36f603);}})[_0x203d('0x1a')](function(_0x1290ab){if(_0x1290ab){_0x4999be=_0x1290ab[_0x203d('0x3e')];if(!_0x51c99a['query'][_0x203d('0x3f')](_0x203d('0x40'))){_0x36f603[_0x203d('0x2a')]=qs[_0x203d('0x2a')](_0x51c99a['query'][_0x203d('0x2a')]);_0x36f603[_0x203d('0x29')]=qs[_0x203d('0x29')](_0x51c99a[_0x203d('0x38')][_0x203d('0x29')]);}return _0x4bcb88[_0x203d('0x56')](_0x36f603);}})[_0x203d('0x1a')](function(_0x457910){if(_0x457910){return _0x457910?{'count':_0x4999be,'rows':_0x457910}:null;}})[_0x203d('0x1a')](respondWithResult(_0x1213be,null))['catch'](handleError(_0x1213be,null));};exports[_0x203d('0x59')]=function(_0x4b7589,_0x3a71c9,_0x3ad7bb){var _0x558b57={};var _0x2fc846={};var _0x3241e8;var _0x23aa27;return db[_0x203d('0x49')]['findOne']({'where':{'id':_0x4b7589[_0x203d('0x4f')]['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0x3a71c9,null))[_0x203d('0x1a')](function(_0x3dddfd){if(_0x3dddfd){_0x3241e8=_0x3dddfd;_0x2fc846[_0x203d('0x37')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2fc846[_0x203d('0x38')]=_[_0x203d('0x39')](_0x4b7589[_0x203d('0x38')]);_0x2fc846[_0x203d('0x3a')]=_['intersection'](_0x2fc846[_0x203d('0x37')],_0x2fc846[_0x203d('0x38')]);_0x558b57[_0x203d('0x3c')]=_[_0x203d('0x3b')](_0x2fc846[_0x203d('0x37')],qs[_0x203d('0x3d')](_0x4b7589[_0x203d('0x38')][_0x203d('0x3d')]));_0x558b57[_0x203d('0x3c')]=_0x558b57[_0x203d('0x3c')][_0x203d('0x3e')]?_0x558b57['attributes']:_0x2fc846['model'];_0x558b57['order']=qs[_0x203d('0x42')](_0x4b7589['query'][_0x203d('0x42')]);_0x558b57['where']=qs[_0x203d('0x3a')](_[_0x203d('0x44')](_0x4b7589[_0x203d('0x38')],_0x2fc846['filters']));if(_0x4b7589[_0x203d('0x38')][_0x203d('0x45')]){_0x558b57[_0x203d('0x43')]=_[_0x203d('0x46')](_0x558b57['where'],{'$or':_[_0x203d('0x33')](_0x558b57[_0x203d('0x3c')],function(_0xd95fa3){var _0x3e312d={};_0x3e312d[_0xd95fa3]={'$like':'%'+_0x4b7589[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x3e312d;})});}_0x558b57=_[_0x203d('0x46')]({},_0x558b57,_0x4b7589[_0x203d('0x48')]);return _0x3241e8[_0x203d('0x59')](_0x558b57);}})[_0x203d('0x1a')](function(_0x52ac6f){if(_0x52ac6f){_0x23aa27=_0x52ac6f[_0x203d('0x3e')];if(!_0x4b7589['query'][_0x203d('0x3f')](_0x203d('0x40'))){_0x558b57['limit']=qs['limit'](_0x4b7589[_0x203d('0x38')][_0x203d('0x2a')]);_0x558b57[_0x203d('0x29')]=qs['offset'](_0x4b7589[_0x203d('0x38')][_0x203d('0x29')]);}return _0x3241e8[_0x203d('0x59')](_0x558b57);}})['then'](function(_0x2e03f1){if(_0x2e03f1){return _0x2e03f1?{'count':_0x23aa27,'rows':_0x2e03f1}:null;}})[_0x203d('0x1a')](respondWithResult(_0x3a71c9,null))[_0x203d('0x24')](handleError(_0x3a71c9,null));};exports[_0x203d('0x5a')]=function(_0x959727,_0x573457,_0x575e27){var _0x372404={};var _0x1e05cf={};var _0x35317c;var _0xad90a6;return db[_0x203d('0x49')][_0x203d('0x57')]({'where':{'id':_0x959727[_0x203d('0x4f')]['id']}})[_0x203d('0x1a')](handleEntityNotFound(_0x573457,null))[_0x203d('0x1a')](function(_0x1c8d05){if(_0x1c8d05){_0x35317c=_0x1c8d05;_0x1e05cf[_0x203d('0x37')]=_[_0x203d('0x39')](db['Tag'][_0x203d('0x58')]);_0x1e05cf[_0x203d('0x38')]=_[_0x203d('0x39')](_0x959727[_0x203d('0x38')]);_0x1e05cf[_0x203d('0x3a')]=_['intersection'](_0x1e05cf[_0x203d('0x37')],_0x1e05cf[_0x203d('0x38')]);_0x372404[_0x203d('0x3c')]=_['intersection'](_0x1e05cf[_0x203d('0x37')],qs['fields'](_0x959727[_0x203d('0x38')][_0x203d('0x3d')]));_0x372404['attributes']=_0x372404['attributes'][_0x203d('0x3e')]?_0x372404[_0x203d('0x3c')]:_0x1e05cf['model'];_0x372404[_0x203d('0x41')]=qs[_0x203d('0x42')](_0x959727[_0x203d('0x38')][_0x203d('0x42')]);_0x372404[_0x203d('0x43')]=qs['filters'](_[_0x203d('0x44')](_0x959727[_0x203d('0x38')],_0x1e05cf['filters']));if(_0x959727[_0x203d('0x38')]['filter']){_0x372404[_0x203d('0x43')]=_['merge'](_0x372404[_0x203d('0x43')],{'$or':_[_0x203d('0x33')](_0x372404[_0x203d('0x3c')],function(_0x41b175){var _0x43dfa1={};_0x43dfa1[_0x41b175]={'$like':'%'+_0x959727[_0x203d('0x38')][_0x203d('0x45')]+'%'};return _0x43dfa1;})});}_0x372404=_[_0x203d('0x46')]({},_0x372404,_0x959727['options']);return _0x35317c['getTags'](_0x372404);}})[_0x203d('0x1a')](function(_0x1eee0a){if(_0x1eee0a){_0xad90a6=_0x1eee0a['length'];if(!_0x959727['query'][_0x203d('0x3f')](_0x203d('0x40'))){_0x372404[_0x203d('0x2a')]=qs[_0x203d('0x2a')](_0x959727[_0x203d('0x38')]['limit']);_0x372404[_0x203d('0x29')]=qs[_0x203d('0x29')](_0x959727[_0x203d('0x38')]['offset']);}return _0x35317c['getTags'](_0x372404);}})[_0x203d('0x1a')](function(_0x46307c){if(_0x46307c){return _0x46307c?{'count':_0xad90a6,'rows':_0x46307c}:null;}})[_0x203d('0x1a')](respondWithResult(_0x573457,null))[_0x203d('0x24')](handleError(_0x573457,null));};exports[_0x203d('0x5b')]=function(_0x25b5c7,_0x265d3d,_0x3d1897){if(_0x25b5c7[_0x203d('0x52')]['id']){delete _0x25b5c7['body']['id'];}return db[_0x203d('0x49')][_0x203d('0x57')]({'where':{'id':_0x25b5c7[_0x203d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x265d3d,null))[_0x203d('0x1a')](function(_0x263ba8){if(_0x263ba8){return _0x263ba8[_0x203d('0x5b')](_0x25b5c7[_0x203d('0x52')][_0x203d('0x5c')]||[]);}return null;})[_0x203d('0x1a')](respondWithResult(_0x265d3d,null))[_0x203d('0x24')](handleError(_0x265d3d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8e080bb..efc1436 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xc06638,_0x68dc26){_0xc06638=_0xc06638-0x0;var _0x34e96c=_0x7fbe[_0xc06638];return _0x34e96c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x214505,_0x3930a7){var _0x442256=function(_0x15cc36){while(--_0x15cc36){_0x214505['push'](_0x214505['shift']());}};_0x442256(++_0x3930a7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x5fc3[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 8079966..201e38d 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 _0xa467=['result','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa467,0x87));var _0x7a46=function(_0x31f495,_0x319897){_0x31f495=_0x31f495-0x0;var _0x1370b3=_0xa467[_0x31f495];return _0x1370b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a46('0x0'));var BPromise=require(_0x7a46('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a46('0x2'))['db'];var utils=require(_0x7a46('0x3'));var logger=require('../../config/logger')(_0x7a46('0x4'));var config=require('../../config/environment');var jayson=require(_0x7a46('0x5'));var client=jayson[_0x7a46('0x6')][_0x7a46('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc88e64,_0x1ccd6e,_0x42ffb5){return new BPromise(function(_0x2fce3b,_0xde1baf){return client[_0x7a46('0x8')](_0xc88e64,_0x42ffb5)['then'](function(_0x59ac81){logger[_0x7a46('0x9')](_0x7a46('0xa'),_0x1ccd6e,'request\x20sent');logger[_0x7a46('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ccd6e,_0x7a46('0xc'),JSON[_0x7a46('0xd')](_0x59ac81));if(_0x59ac81[_0x7a46('0xe')]){if(_0x59ac81[_0x7a46('0xe')][_0x7a46('0xf')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ccd6e,_0x59ac81[_0x7a46('0xe')][_0x7a46('0x10')]);return _0xde1baf(_0x59ac81['error'][_0x7a46('0x10')]);}logger[_0x7a46('0xe')](_0x7a46('0xa'),_0x1ccd6e,_0x59ac81[_0x7a46('0xe')][_0x7a46('0x10')]);return _0x2fce3b(_0x59ac81[_0x7a46('0xe')][_0x7a46('0x10')]);}else{logger[_0x7a46('0x9')](_0x7a46('0xa'),_0x1ccd6e,_0x7a46('0xc'));_0x2fce3b(_0x59ac81[_0x7a46('0x11')][_0x7a46('0x10')]);}})[_0x7a46('0x12')](function(_0x58d402){logger[_0x7a46('0xe')](_0x7a46('0xa'),_0x1ccd6e,_0x58d402);_0xde1baf(_0x58d402);});});} \ No newline at end of file +var _0x2a1b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe60533,_0x2f1209){var _0x4377e3=function(_0x1125fc){while(--_0x1125fc){_0xe60533['push'](_0xe60533['shift']());}};_0x4377e3(++_0x2f1209);}(_0x2a1b,0x9a));var _0xb2a1=function(_0x424e22,_0x5a12c9){_0x424e22=_0x424e22-0x0;var _0xc7d454=_0x2a1b[_0x424e22];return _0xc7d454;};'use strict';var _=require(_0xb2a1('0x0'));var util=require(_0xb2a1('0x1'));var moment=require(_0xb2a1('0x2'));var BPromise=require(_0xb2a1('0x3'));var rs=require(_0xb2a1('0x4'));var fs=require('fs');var Redis=require(_0xb2a1('0x5'));var db=require(_0xb2a1('0x6'))['db'];var utils=require(_0xb2a1('0x7'));var logger=require(_0xb2a1('0x8'))(_0xb2a1('0x9'));var config=require(_0xb2a1('0xa'));var jayson=require(_0xb2a1('0xb'));var client=jayson[_0xb2a1('0xc')][_0xb2a1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x32b77d,_0x2d60c1,_0x33e825){return new BPromise(function(_0x391e6e,_0x467650){return client[_0xb2a1('0xe')](_0x32b77d,_0x33e825)[_0xb2a1('0xf')](function(_0x5d0f56){logger[_0xb2a1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2d60c1,_0xb2a1('0x11'));logger[_0xb2a1('0x12')](_0xb2a1('0x13'),_0x2d60c1,'request\x20sent',JSON[_0xb2a1('0x14')](_0x5d0f56));if(_0x5d0f56[_0xb2a1('0x15')]){if(_0x5d0f56[_0xb2a1('0x15')][_0xb2a1('0x16')]===0x1f4){logger[_0xb2a1('0x15')](_0xb2a1('0x17'),_0x2d60c1,_0x5d0f56['error'][_0xb2a1('0x18')]);return _0x467650(_0x5d0f56['error'][_0xb2a1('0x18')]);}logger[_0xb2a1('0x15')](_0xb2a1('0x17'),_0x2d60c1,_0x5d0f56[_0xb2a1('0x15')][_0xb2a1('0x18')]);return _0x391e6e(_0x5d0f56['error'][_0xb2a1('0x18')]);}else{logger[_0xb2a1('0x10')](_0xb2a1('0x17'),_0x2d60c1,_0xb2a1('0x11'));_0x391e6e(_0x5d0f56[_0xb2a1('0x19')]['message']);}})[_0xb2a1('0x1a')](function(_0x28a9db){logger[_0xb2a1('0x15')](_0xb2a1('0x17'),_0x2d60c1,_0x28a9db);_0x467650(_0x28a9db);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9876d9b..575a23c 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(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0xedd9,0xfc));var _0x9edd=function(_0x143734,_0x98f1aa){_0x143734=_0x143734-0x0;var _0x4313d1=_0xedd9[_0x143734];return _0x4313d1;};'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 _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x52efaa,_0x53c68a){var _0x525109=function(_0x4efe4d){while(--_0x4efe4d){_0x52efaa['push'](_0x52efaa['shift']());}};_0x525109(++_0x53c68a);}(_0x008c,0x188));var _0xc008=function(_0x6942e0,_0x131e6d){_0x6942e0=_0x6942e0-0x0;var _0xb86490=_0x008c[_0x6942e0];return _0xb86490;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8eee9f4..4fc4b51 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 _0xf7df=['variable','customVariable','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x5878b3,_0x5239ae){var _0x200ee4=function(_0x5c0906){while(--_0x5c0906){_0x5878b3['push'](_0x5878b3['shift']());}};_0x200ee4(++_0x5239ae);}(_0xf7df,0x10e));var _0xff7d=function(_0x1aa1dc,_0x2ab261){_0x1aa1dc=_0x1aa1dc-0x0;var _0x4130c8=_0xf7df[_0x1aa1dc];return _0x4130c8;};'use strict';var Sequelize=require(_0xff7d('0x0'));module['exports']={'type':{'type':Sequelize[_0xff7d('0x1')](_0xff7d('0x2'),_0xff7d('0x3'),_0xff7d('0x4'),'keyValue'),'defaultValue':_0xff7d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xff7d('0x5')]},'keyType':{'type':Sequelize[_0xff7d('0x1')]('string',_0xff7d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xff7d('0x5')]},'nameField':{'type':Sequelize[_0xff7d('0x5')]},'customField':{'type':Sequelize[_0xff7d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xff7d('0x5')]}}; \ No newline at end of file +var _0x6f49=['string','variable','customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6f49,0xa6));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x96f4('0x0')]={'type':{'type':Sequelize[_0x96f4('0x1')](_0x96f4('0x2'),_0x96f4('0x3'),_0x96f4('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x96f4('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x96f4('0x2'),_0x96f4('0x3'),_0x96f4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x96f4('0x5')]},'nameField':{'type':Sequelize[_0x96f4('0x5')]},'customField':{'type':Sequelize[_0x96f4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x96f4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3744440..4e41b8f 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 _0x380f=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x380f,0x1ed));var _0xf380=function(_0x130a1e,_0x3e86d6){_0x130a1e=_0x130a1e-0x0;var _0x1c8e9e=_0x380f[_0x130a1e];return _0x1c8e9e;};'use strict';var pdf=require(_0xf380('0x0'));var emlformat=require(_0xf380('0x1'));var rimraf=require(_0xf380('0x2'));var zipdir=require(_0xf380('0x3'));var jsonpatch=require(_0xf380('0x4'));var rp=require(_0xf380('0x5'));var moment=require('moment');var BPromise=require(_0xf380('0x6'));var Mustache=require(_0xf380('0x7'));var util=require('util');var path=require(_0xf380('0x8'));var sox=require(_0xf380('0x9'));var csv=require('to-csv');var ejs=require(_0xf380('0xa'));var fs=require('fs');var _=require(_0xf380('0xb'));var squel=require(_0xf380('0xc'));var crypto=require(_0xf380('0xd'));var jsforce=require(_0xf380('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf380('0xf'));var querystring=require(_0xf380('0x10'));var Papa=require(_0xf380('0x11'));var Redis=require('ioredis');var authService=require(_0xf380('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf380('0x13'));var hardwareService=require(_0xf380('0x14'));var logger=require(_0xf380('0x15'))(_0xf380('0x16'));var utils=require(_0xf380('0x17'));var config=require(_0xf380('0x18'));var db=require(_0xf380('0x19'))['db'];function respondWithStatusCode(_0x2b7e1b,_0xaceb28){_0xaceb28=_0xaceb28||0xcc;return function(_0x395078){if(_0x395078){return _0x2b7e1b[_0xf380('0x1a')](_0xaceb28);}return _0x2b7e1b[_0xf380('0x1b')](_0xaceb28)[_0xf380('0x1c')]();};}function respondWithResult(_0x1ecc11,_0x54a866){_0x54a866=_0x54a866||0xc8;return function(_0x541da5){if(_0x541da5){return _0x1ecc11[_0xf380('0x1b')](_0x54a866)['json'](_0x541da5);}};}function respondWithFilteredResult(_0x5694c8,_0x10da88){return function(_0x24aeaa){if(_0x24aeaa){var _0x435aab=_0x24aeaa[_0xf380('0x1d')],_0xc09eb1=_0x10da88['offset'],_0x1620f3=_0x10da88[_0xf380('0x1e')]+_0x10da88[_0xf380('0x1f')],_0x95a00e;if(_0x1620f3>=_0x435aab){_0x1620f3=_0x435aab;_0x95a00e=0xc8;}else{_0x95a00e=0xce;}_0x5694c8[_0xf380('0x1b')](_0x95a00e);return _0x5694c8[_0xf380('0x20')](_0xf380('0x21'),_0xc09eb1+'-'+_0x1620f3+'/'+_0x435aab)[_0xf380('0x22')](_0x24aeaa);}return null;};}function patchUpdates(_0x8208d5){return function(_0x3968b9){try{jsonpatch['apply'](_0x3968b9,_0x8208d5,!![]);}catch(_0x3df124){return BPromise['reject'](_0x3df124);}return _0x3968b9[_0xf380('0x23')]();};}function saveUpdates(_0x59a0c8,_0x1d4d4e){return function(_0x2246b2){if(_0x2246b2){return _0x2246b2['update'](_0x59a0c8)[_0xf380('0x24')](function(_0x1b6b59){return _0x1b6b59;});}return null;};}function removeEntity(_0x4c9836,_0x5cf849){return function(_0x56ae92){if(_0x56ae92){return _0x56ae92['destroy']()[_0xf380('0x24')](function(){_0x4c9836[_0xf380('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff5c3,_0x53c324){return function(_0x2c1562){if(!_0x2c1562){_0x1ff5c3['sendStatus'](0x194);}return _0x2c1562;};}function handleError(_0x138b6b,_0x3e2260){_0x3e2260=_0x3e2260||0x1f4;return function(_0x581b1c){logger[_0xf380('0x25')](_0x581b1c[_0xf380('0x26')]);if(_0x581b1c[_0xf380('0x27')]){delete _0x581b1c['name'];}_0x138b6b['status'](_0x3e2260)[_0xf380('0x28')](_0x581b1c);};}exports['index']=function(_0x57a03a,_0x31eab8){var _0x5f19e9={},_0x23a22e={},_0x1dfbb5={'count':0x0,'rows':[]};var _0x5e414c=_[_0xf380('0x29')](db[_0xf380('0x2a')][_0xf380('0x2b')],function(_0x1aec70){return{'name':_0x1aec70[_0xf380('0x2c')],'type':_0x1aec70[_0xf380('0x2d')][_0xf380('0x2e')]};});_0x23a22e['model']=_[_0xf380('0x29')](_0x5e414c,_0xf380('0x27'));_0x23a22e[_0xf380('0x2f')]=_[_0xf380('0x30')](_0x57a03a['query']);_0x23a22e[_0xf380('0x31')]=_[_0xf380('0x32')](_0x23a22e[_0xf380('0x33')],_0x23a22e[_0xf380('0x2f')]);_0x5f19e9[_0xf380('0x34')]=_[_0xf380('0x32')](_0x23a22e['model'],qs[_0xf380('0x35')](_0x57a03a['query'][_0xf380('0x35')]));_0x5f19e9['attributes']=_0x5f19e9['attributes'][_0xf380('0x36')]?_0x5f19e9[_0xf380('0x34')]:_0x23a22e[_0xf380('0x33')];if(!_0x57a03a[_0xf380('0x2f')][_0xf380('0x37')](_0xf380('0x38'))){_0x5f19e9[_0xf380('0x1f')]=qs[_0xf380('0x1f')](_0x57a03a[_0xf380('0x2f')][_0xf380('0x1f')]);_0x5f19e9[_0xf380('0x1e')]=qs[_0xf380('0x1e')](_0x57a03a['query'][_0xf380('0x1e')]);}_0x5f19e9[_0xf380('0x39')]=qs[_0xf380('0x3a')](_0x57a03a[_0xf380('0x2f')][_0xf380('0x3a')]);_0x5f19e9['where']=qs[_0xf380('0x31')](_[_0xf380('0x3b')](_0x57a03a[_0xf380('0x2f')],_0x23a22e[_0xf380('0x31')]),_0x5e414c);if(_0x57a03a['query']['filter']){_0x5f19e9[_0xf380('0x3c')]=_[_0xf380('0x3d')](_0x5f19e9['where'],{'$or':_[_0xf380('0x29')](_0x5e414c,function(_0x197d3d){if(_0x197d3d[_0xf380('0x2d')]!=='VIRTUAL'){var _0x3c10c0={};_0x3c10c0[_0x197d3d[_0xf380('0x27')]]={'$like':'%'+_0x57a03a[_0xf380('0x2f')]['filter']+'%'};return _0x3c10c0;}})});}_0x5f19e9=_[_0xf380('0x3d')]({},_0x5f19e9,_0x57a03a['options']);var _0x253c28={'where':_0x5f19e9[_0xf380('0x3c')]};return db[_0xf380('0x2a')][_0xf380('0x1d')](_0x253c28)['then'](function(_0x105d8b){_0x1dfbb5['count']=_0x105d8b;if(_0x57a03a[_0xf380('0x2f')][_0xf380('0x3e')]){_0x5f19e9[_0xf380('0x3f')]=[{'all':!![]}];}return db[_0xf380('0x2a')][_0xf380('0x40')](_0x5f19e9);})[_0xf380('0x24')](function(_0x2f3d8f){_0x1dfbb5[_0xf380('0x41')]=_0x2f3d8f;return _0x1dfbb5;})[_0xf380('0x24')](respondWithFilteredResult(_0x31eab8,_0x5f19e9))['catch'](handleError(_0x31eab8,null));};exports[_0xf380('0x42')]=function(_0x1e27a8,_0x9ab3d9){var _0x272d00={'raw':!![],'where':{'id':_0x1e27a8[_0xf380('0x43')]['id']}},_0x4e111d={};_0x4e111d[_0xf380('0x33')]=_[_0xf380('0x30')](db['FreshdeskField']['rawAttributes']);_0x4e111d[_0xf380('0x2f')]=_[_0xf380('0x30')](_0x1e27a8[_0xf380('0x2f')]);_0x4e111d['filters']=_[_0xf380('0x32')](_0x4e111d[_0xf380('0x33')],_0x4e111d[_0xf380('0x2f')]);_0x272d00['attributes']=_['intersection'](_0x4e111d[_0xf380('0x33')],qs['fields'](_0x1e27a8['query'][_0xf380('0x35')]));_0x272d00[_0xf380('0x34')]=_0x272d00[_0xf380('0x34')][_0xf380('0x36')]?_0x272d00[_0xf380('0x34')]:_0x4e111d[_0xf380('0x33')];if(_0x1e27a8[_0xf380('0x2f')][_0xf380('0x3e')]){_0x272d00[_0xf380('0x3f')]=[{'all':!![]}];}_0x272d00=_[_0xf380('0x3d')]({},_0x272d00,_0x1e27a8[_0xf380('0x44')]);return db[_0xf380('0x2a')][_0xf380('0x45')](_0x272d00)['then'](handleEntityNotFound(_0x9ab3d9,null))[_0xf380('0x24')](respondWithResult(_0x9ab3d9,null))[_0xf380('0x46')](handleError(_0x9ab3d9,null));};exports[_0xf380('0x47')]=function(_0x5a2d5d,_0x555a51){return db[_0xf380('0x2a')][_0xf380('0x47')](_0x5a2d5d[_0xf380('0x48')],{})[_0xf380('0x24')](respondWithResult(_0x555a51,0xc9))[_0xf380('0x46')](handleError(_0x555a51,null));};exports[_0xf380('0x49')]=function(_0x2fb8d1,_0x420d23){if(_0x2fb8d1[_0xf380('0x48')]['id']){delete _0x2fb8d1['body']['id'];}return db['FreshdeskField'][_0xf380('0x45')]({'where':{'id':_0x2fb8d1[_0xf380('0x43')]['id']}})[_0xf380('0x24')](handleEntityNotFound(_0x420d23,null))[_0xf380('0x24')](saveUpdates(_0x2fb8d1[_0xf380('0x48')],null))[_0xf380('0x24')](respondWithResult(_0x420d23,null))[_0xf380('0x46')](handleError(_0x420d23,null));};exports['destroy']=function(_0x1411bf,_0x3aeb17){return db[_0xf380('0x2a')]['find']({'where':{'id':_0x1411bf[_0xf380('0x43')]['id']}})[_0xf380('0x24')](handleEntityNotFound(_0x3aeb17,null))[_0xf380('0x24')](removeEntity(_0x3aeb17,null))['catch'](handleError(_0x3aeb17,null));}; \ No newline at end of file +var _0x5c67=['util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','Content-Range','update','then','destroy','stack','send','index','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x172e0a,_0x15d22a){var _0x4baf16=function(_0xcbd5e5){while(--_0xcbd5e5){_0x172e0a['push'](_0x172e0a['shift']());}};_0x4baf16(++_0x15d22a);}(_0x5c67,0x114));var _0x75c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c67[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x75c6('0x0'));var rimraf=require(_0x75c6('0x1'));var zipdir=require(_0x75c6('0x2'));var jsonpatch=require(_0x75c6('0x3'));var rp=require(_0x75c6('0x4'));var moment=require(_0x75c6('0x5'));var BPromise=require(_0x75c6('0x6'));var Mustache=require(_0x75c6('0x7'));var util=require(_0x75c6('0x8'));var path=require(_0x75c6('0x9'));var sox=require(_0x75c6('0xa'));var csv=require(_0x75c6('0xb'));var ejs=require(_0x75c6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x75c6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x75c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x75c6('0xf'));var Papa=require('papaparse');var Redis=require(_0x75c6('0x10'));var authService=require(_0x75c6('0x11'));var qs=require(_0x75c6('0x12'));var as=require(_0x75c6('0x13'));var hardwareService=require(_0x75c6('0x14'));var logger=require(_0x75c6('0x15'))(_0x75c6('0x16'));var utils=require(_0x75c6('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10013b,_0x5126cb){_0x5126cb=_0x5126cb||0xcc;return function(_0x2f8ab0){if(_0x2f8ab0){return _0x10013b[_0x75c6('0x18')](_0x5126cb);}return _0x10013b[_0x75c6('0x19')](_0x5126cb)[_0x75c6('0x1a')]();};}function respondWithResult(_0x4e5308,_0x425555){_0x425555=_0x425555||0xc8;return function(_0x563758){if(_0x563758){return _0x4e5308[_0x75c6('0x19')](_0x425555)[_0x75c6('0x1b')](_0x563758);}};}function respondWithFilteredResult(_0x1eb66c,_0x1608f6){return function(_0x645a17){if(_0x645a17){var _0x4b8567=_0x645a17[_0x75c6('0x1c')],_0x211e35=_0x1608f6[_0x75c6('0x1d')],_0x106343=_0x1608f6[_0x75c6('0x1d')]+_0x1608f6['limit'],_0x4924fb;if(_0x106343>=_0x4b8567){_0x106343=_0x4b8567;_0x4924fb=0xc8;}else{_0x4924fb=0xce;}_0x1eb66c['status'](_0x4924fb);return _0x1eb66c['set'](_0x75c6('0x1e'),_0x211e35+'-'+_0x106343+'/'+_0x4b8567)['json'](_0x645a17);}return null;};}function patchUpdates(_0x239c90){return function(_0x13490c){try{jsonpatch['apply'](_0x13490c,_0x239c90,!![]);}catch(_0x50784b){return BPromise['reject'](_0x50784b);}return _0x13490c['save']();};}function saveUpdates(_0x59357d,_0x1f42b8){return function(_0x1d6851){if(_0x1d6851){return _0x1d6851[_0x75c6('0x1f')](_0x59357d)[_0x75c6('0x20')](function(_0x562be1){return _0x562be1;});}return null;};}function removeEntity(_0x51fd5b,_0x1767e7){return function(_0x2755e4){if(_0x2755e4){return _0x2755e4[_0x75c6('0x21')]()['then'](function(){_0x51fd5b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x418e93,_0x2aed3e){return function(_0x54cee3){if(!_0x54cee3){_0x418e93['sendStatus'](0x194);}return _0x54cee3;};}function handleError(_0x4c80ae,_0x48223d){_0x48223d=_0x48223d||0x1f4;return function(_0x3bb423){logger['error'](_0x3bb423[_0x75c6('0x22')]);if(_0x3bb423['name']){delete _0x3bb423['name'];}_0x4c80ae[_0x75c6('0x19')](_0x48223d)[_0x75c6('0x23')](_0x3bb423);};}exports[_0x75c6('0x24')]=function(_0x98f5c8,_0x313c47){var _0x7e4da6={},_0x29f7ea={},_0x53d5e3={'count':0x0,'rows':[]};var _0x3dc170=_[_0x75c6('0x25')](db['FreshdeskField']['rawAttributes'],function(_0x511b17){return{'name':_0x511b17['fieldName'],'type':_0x511b17[_0x75c6('0x26')][_0x75c6('0x27')]};});_0x29f7ea[_0x75c6('0x28')]=_[_0x75c6('0x25')](_0x3dc170,_0x75c6('0x29'));_0x29f7ea[_0x75c6('0x2a')]=_[_0x75c6('0x2b')](_0x98f5c8['query']);_0x29f7ea[_0x75c6('0x2c')]=_[_0x75c6('0x2d')](_0x29f7ea[_0x75c6('0x28')],_0x29f7ea[_0x75c6('0x2a')]);_0x7e4da6[_0x75c6('0x2e')]=_[_0x75c6('0x2d')](_0x29f7ea['model'],qs[_0x75c6('0x2f')](_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x2f')]));_0x7e4da6[_0x75c6('0x2e')]=_0x7e4da6[_0x75c6('0x2e')][_0x75c6('0x30')]?_0x7e4da6[_0x75c6('0x2e')]:_0x29f7ea[_0x75c6('0x28')];if(!_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x31')](_0x75c6('0x32'))){_0x7e4da6[_0x75c6('0x33')]=qs['limit'](_0x98f5c8[_0x75c6('0x2a')]['limit']);_0x7e4da6[_0x75c6('0x1d')]=qs[_0x75c6('0x1d')](_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x1d')]);}_0x7e4da6['order']=qs[_0x75c6('0x34')](_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x34')]);_0x7e4da6['where']=qs['filters'](_[_0x75c6('0x35')](_0x98f5c8[_0x75c6('0x2a')],_0x29f7ea[_0x75c6('0x2c')]),_0x3dc170);if(_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x36')]){_0x7e4da6[_0x75c6('0x37')]=_[_0x75c6('0x38')](_0x7e4da6['where'],{'$or':_[_0x75c6('0x25')](_0x3dc170,function(_0x4b4196){if(_0x4b4196[_0x75c6('0x26')]!==_0x75c6('0x39')){var _0x17fd9c={};_0x17fd9c[_0x4b4196[_0x75c6('0x29')]]={'$like':'%'+_0x98f5c8[_0x75c6('0x2a')]['filter']+'%'};return _0x17fd9c;}})});}_0x7e4da6=_[_0x75c6('0x38')]({},_0x7e4da6,_0x98f5c8[_0x75c6('0x3a')]);var _0x13256c={'where':_0x7e4da6[_0x75c6('0x37')]};return db[_0x75c6('0x3b')][_0x75c6('0x1c')](_0x13256c)[_0x75c6('0x20')](function(_0x4e323d){_0x53d5e3['count']=_0x4e323d;if(_0x98f5c8[_0x75c6('0x2a')][_0x75c6('0x3c')]){_0x7e4da6[_0x75c6('0x3d')]=[{'all':!![]}];}return db[_0x75c6('0x3b')][_0x75c6('0x3e')](_0x7e4da6);})['then'](function(_0x10a54b){_0x53d5e3[_0x75c6('0x3f')]=_0x10a54b;return _0x53d5e3;})[_0x75c6('0x20')](respondWithFilteredResult(_0x313c47,_0x7e4da6))[_0x75c6('0x40')](handleError(_0x313c47,null));};exports[_0x75c6('0x41')]=function(_0x6fe866,_0x417dd0){var _0x2215ec={'raw':!![],'where':{'id':_0x6fe866[_0x75c6('0x42')]['id']}},_0x3591e8={};_0x3591e8[_0x75c6('0x28')]=_['keys'](db[_0x75c6('0x3b')][_0x75c6('0x43')]);_0x3591e8[_0x75c6('0x2a')]=_[_0x75c6('0x2b')](_0x6fe866[_0x75c6('0x2a')]);_0x3591e8[_0x75c6('0x2c')]=_[_0x75c6('0x2d')](_0x3591e8['model'],_0x3591e8[_0x75c6('0x2a')]);_0x2215ec[_0x75c6('0x2e')]=_[_0x75c6('0x2d')](_0x3591e8['model'],qs[_0x75c6('0x2f')](_0x6fe866[_0x75c6('0x2a')][_0x75c6('0x2f')]));_0x2215ec['attributes']=_0x2215ec['attributes']['length']?_0x2215ec[_0x75c6('0x2e')]:_0x3591e8['model'];if(_0x6fe866[_0x75c6('0x2a')][_0x75c6('0x3c')]){_0x2215ec[_0x75c6('0x3d')]=[{'all':!![]}];}_0x2215ec=_['merge']({},_0x2215ec,_0x6fe866['options']);return db[_0x75c6('0x3b')][_0x75c6('0x44')](_0x2215ec)['then'](handleEntityNotFound(_0x417dd0,null))[_0x75c6('0x20')](respondWithResult(_0x417dd0,null))[_0x75c6('0x40')](handleError(_0x417dd0,null));};exports[_0x75c6('0x45')]=function(_0x3306d0,_0x2d9fff){return db[_0x75c6('0x3b')]['create'](_0x3306d0['body'],{})['then'](respondWithResult(_0x2d9fff,0xc9))[_0x75c6('0x40')](handleError(_0x2d9fff,null));};exports[_0x75c6('0x1f')]=function(_0x5c60fc,_0x1c2570){if(_0x5c60fc['body']['id']){delete _0x5c60fc[_0x75c6('0x46')]['id'];}return db[_0x75c6('0x3b')][_0x75c6('0x44')]({'where':{'id':_0x5c60fc[_0x75c6('0x42')]['id']}})[_0x75c6('0x20')](handleEntityNotFound(_0x1c2570,null))[_0x75c6('0x20')](saveUpdates(_0x5c60fc[_0x75c6('0x46')],null))[_0x75c6('0x20')](respondWithResult(_0x1c2570,null))['catch'](handleError(_0x1c2570,null));};exports[_0x75c6('0x21')]=function(_0x5aa44e,_0xee91f5){return db[_0x75c6('0x3b')][_0x75c6('0x44')]({'where':{'id':_0x5aa44e['params']['id']}})[_0x75c6('0x20')](handleEntityNotFound(_0xee91f5,null))[_0x75c6('0x20')](removeEntity(_0xee91f5,null))['catch'](handleError(_0xee91f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index fbc446a..da4329a 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 _0x494e=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x2d69e7,_0x3bd855){var _0x53cfb6=function(_0x5112c3){while(--_0x5112c3){_0x2d69e7['push'](_0x2d69e7['shift']());}};_0x53cfb6(++_0x3bd855);}(_0x494e,0x138));var _0xe494=function(_0x43446c,_0x23b7a8){_0x43446c=_0x43446c-0x0;var _0x491333=_0x494e[_0x43446c];return _0x491333;};'use strict';var _=require(_0xe494('0x0'));var util=require(_0xe494('0x1'));var logger=require(_0xe494('0x2'))(_0xe494('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe494('0x4'));var rimraf=require(_0xe494('0x5'));var config=require(_0xe494('0x6'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0xffac36,_0x16ef61){return _0xffac36[_0xe494('0x7')](_0xe494('0x8'),attributes,{'tableName':_0xe494('0x9'),'paranoid':![],'indexes':[{'name':_0xe494('0xa'),'fields':[_0xe494('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3b7=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x574430,_0x5d5152){var _0x4f6fb3=function(_0x2b4fe3){while(--_0x2b4fe3){_0x574430['push'](_0x574430['shift']());}};_0x4f6fb3(++_0x5d5152);}(_0xd3b7,0x1c6));var _0x7d3b=function(_0x32413f,_0x26e699){_0x32413f=_0x32413f-0x0;var _0x58508a=_0xd3b7[_0x32413f];return _0x58508a;};'use strict';var _=require(_0x7d3b('0x0'));var util=require(_0x7d3b('0x1'));var logger=require(_0x7d3b('0x2'))(_0x7d3b('0x3'));var moment=require('moment');var BPromise=require(_0x7d3b('0x4'));var rp=require(_0x7d3b('0x5'));var fs=require('fs');var path=require(_0x7d3b('0x6'));var rimraf=require('rimraf');var config=require(_0x7d3b('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x7d3b('0x8')]=function(_0x237bbd,_0x259d3e){return _0x237bbd['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x7d3b('0x9'),'fields':[_0x7d3b('0xa'),_0x7d3b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index bd1c71c..2f25283 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(_0x5ce23c,_0x3ceb6d){var _0xa819cc=function(_0x2a4020){while(--_0x2a4020){_0x5ce23c['push'](_0x5ce23c['shift']());}};_0xa819cc(++_0x3ceb6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0xb10b[_0x542f45];return _0x38c609;};'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(_0x516d66,_0x469cf9){var _0x338780=function(_0x124898){while(--_0x124898){_0x516d66['push'](_0x516d66['shift']());}};_0x338780(++_0x469cf9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f4b06,_0x3e5997){_0x5f4b06=_0x5f4b06-0x0;var _0x55cc05=_0xb10b[_0x5f4b06];return _0x55cc05;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 1c88074..a405a0a 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 _0xce74=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x44b38b,_0x4daf41){var _0x5b80f7=function(_0x1e8bc5){while(--_0x1e8bc5){_0x44b38b['push'](_0x44b38b['shift']());}};_0x5b80f7(++_0x4daf41);}(_0xce74,0xec));var _0x4ce7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xce74[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x4ce7('0x0'));var util=require('util');var path=require(_0x4ce7('0x1'));var timeout=require(_0x4ce7('0x2'));var express=require(_0x4ce7('0x3'));var router=express[_0x4ce7('0x4')]();var auth=require(_0x4ce7('0x5'));var interaction=require(_0x4ce7('0x6'));var config=require(_0x4ce7('0x7'));var controller=require(_0x4ce7('0x8'));router[_0x4ce7('0x9')]('/',auth[_0x4ce7('0xa')](),controller[_0x4ce7('0xb')]);router[_0x4ce7('0x9')](_0x4ce7('0xc'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0xd')]);router['get'](_0x4ce7('0xe'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0xf')]);router['get'](_0x4ce7('0x10'),auth['isAuthenticated'](),controller[_0x4ce7('0x11')]);router[_0x4ce7('0x12')]('/',auth[_0x4ce7('0xa')](),controller['create']);router[_0x4ce7('0x12')](_0x4ce7('0xe'),auth['isAuthenticated'](),controller[_0x4ce7('0x13')]);router[_0x4ce7('0x14')](_0x4ce7('0xc'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0x15')]);router['delete'](_0x4ce7('0xc'),auth[_0x4ce7('0xa')](),controller[_0x4ce7('0x16')]);module[_0x4ce7('0x17')]=router; \ No newline at end of file +var _0xbf89=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','get','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xbf89,0x190));var _0x9bf8=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xbf89[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9bf8('0x0'));var timeout=require(_0x9bf8('0x1'));var express=require(_0x9bf8('0x2'));var router=express[_0x9bf8('0x3')]();var auth=require(_0x9bf8('0x4'));var interaction=require(_0x9bf8('0x5'));var config=require(_0x9bf8('0x6'));var controller=require(_0x9bf8('0x7'));router['get']('/',auth[_0x9bf8('0x8')](),controller[_0x9bf8('0x9')]);router['get'](_0x9bf8('0xa'),auth[_0x9bf8('0x8')](),controller['show']);router['get'](_0x9bf8('0xb'),auth[_0x9bf8('0x8')](),controller[_0x9bf8('0xc')]);router[_0x9bf8('0xd')](_0x9bf8('0xe'),auth[_0x9bf8('0x8')](),controller['getFields']);router[_0x9bf8('0xf')]('/',auth[_0x9bf8('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x9bf8('0x10')]);router[_0x9bf8('0x11')](_0x9bf8('0xa'),auth['isAuthenticated'](),controller[_0x9bf8('0x12')]);router[_0x9bf8('0x13')](_0x9bf8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9bf8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d600d40..de33ca7 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 _0x556a=['username','remoteUri','sequelize','exports','STRING'];(function(_0x41869c,_0x142214){var _0x571b61=function(_0x45b6b8){while(--_0x45b6b8){_0x41869c['push'](_0x41869c['shift']());}};_0x571b61(++_0x142214);}(_0x556a,0x1dd));var _0xa556=function(_0x54d67e,_0x9ba63f){_0x54d67e=_0x54d67e-0x0;var _0x1e3dc2=_0x556a[_0x54d67e];return _0x1e3dc2;};'use strict';var Sequelize=require(_0xa556('0x0'));module[_0xa556('0x1')]={'name':{'type':Sequelize[_0xa556('0x2')]},'description':{'type':Sequelize[_0xa556('0x2')]},'username':{'type':Sequelize[_0xa556('0x2')],'unique':_0xa556('0x3')},'apiKey':{'type':Sequelize[_0xa556('0x2')]},'remoteUri':{'type':Sequelize[_0xa556('0x2')],'unique':_0xa556('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1aab=['STRING','remoteUri','sequelize','exports'];(function(_0x47990b,_0xf722d6){var _0x57bb0a=function(_0x26b8d0){while(--_0x26b8d0){_0x47990b['push'](_0x47990b['shift']());}};_0x57bb0a(++_0xf722d6);}(_0x1aab,0x122));var _0xb1aa=function(_0x4ac7f6,_0x3087d7){_0x4ac7f6=_0x4ac7f6-0x0;var _0x2cae4b=_0x1aab[_0x4ac7f6];return _0x2cae4b;};'use strict';var Sequelize=require(_0xb1aa('0x0'));module[_0xb1aa('0x1')]={'name':{'type':Sequelize[_0xb1aa('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb1aa('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xb1aa('0x2')]},'remoteUri':{'type':Sequelize[_0xb1aa('0x2')],'unique':_0xb1aa('0x3')},'serverUrl':{'type':Sequelize[_0xb1aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 8a71f34..6105781 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 _0x7271=['sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','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','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../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','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x32bbb1,_0xa0e27e){var _0x42b415=function(_0x23f4e2){while(--_0x23f4e2){_0x32bbb1['push'](_0x32bbb1['shift']());}};_0x42b415(++_0xa0e27e);}(_0x7271,0x1ed));var _0x1727=function(_0x254f00,_0x50c844){_0x254f00=_0x254f00-0x0;var _0x7ba98e=_0x7271[_0x254f00];return _0x7ba98e;};'use strict';var pdf=require(_0x1727('0x0'));var emlformat=require(_0x1727('0x1'));var rimraf=require(_0x1727('0x2'));var zipdir=require(_0x1727('0x3'));var jsonpatch=require(_0x1727('0x4'));var rp=require('request-promise');var moment=require(_0x1727('0x5'));var BPromise=require(_0x1727('0x6'));var Mustache=require(_0x1727('0x7'));var util=require(_0x1727('0x8'));var path=require(_0x1727('0x9'));var sox=require('sox');var csv=require(_0x1727('0xa'));var ejs=require(_0x1727('0xb'));var fs=require('fs');var _=require(_0x1727('0xc'));var squel=require(_0x1727('0xd'));var crypto=require(_0x1727('0xe'));var jsforce=require(_0x1727('0xf'));var deskjs=require(_0x1727('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1727('0x11'));var Papa=require('papaparse');var Redis=require(_0x1727('0x12'));var authService=require(_0x1727('0x13'));var qs=require(_0x1727('0x14'));var as=require(_0x1727('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1727('0x16'))(_0x1727('0x17'));var utils=require('../../config/utils');var config=require(_0x1727('0x18'));var db=require(_0x1727('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1727('0x1a'));var client=jayson[_0x1727('0x1b')][_0x1727('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x191e4b,_0x3e31f0,_0x264166){if(_0x264166){var _0x24fcb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24fcb3[_0x1727('0x1d')](_0x3e31f0)){return _0x191e4b;}else{throw new db['Sequelize'][(_0x1727('0x1e'))](_0x1727('0x1f'));}}else{return _0x191e4b;}}function respondWithRpcPromise(_0x46afbe,_0x14bd62,_0x258ceb,_0x380a73){return new BPromise(function(_0x42ca39,_0x1f69d1){var _0x453d16=_0x380a73||client;return _0x453d16[_0x1727('0x20')](_0x46afbe,_0x258ceb)['then'](function(_0x19699e){logger[_0x1727('0x21')](_0x1727('0x22'),_0x14bd62,'request\x20sent');logger['debug'](_0x1727('0x23'),_0x14bd62,_0x1727('0x24'),JSON[_0x1727('0x25')](_0x19699e));if(_0x19699e[_0x1727('0x26')]){if(_0x19699e[_0x1727('0x26')]['code']===0x1f4){logger[_0x1727('0x26')](_0x1727('0x22'),_0x14bd62,_0x19699e[_0x1727('0x26')][_0x1727('0x27')]);return _0x1f69d1(_0x19699e['error'][_0x1727('0x27')]);}logger[_0x1727('0x26')](_0x1727('0x22'),_0x14bd62,_0x19699e['error'][_0x1727('0x27')]);return _0x42ca39(_0x19699e[_0x1727('0x26')][_0x1727('0x27')]);}else{logger[_0x1727('0x21')](_0x1727('0x22'),_0x14bd62,'request\x20sent');_0x42ca39(_0x19699e['result'][_0x1727('0x27')]);}})[_0x1727('0x28')](function(_0x2c56dd){logger[_0x1727('0x26')](_0x1727('0x22'),_0x14bd62,_0x2c56dd);_0x1f69d1(_0x2c56dd);});});}function respondWithStatusCode(_0x432a8a,_0x5db9ca){_0x5db9ca=_0x5db9ca||0xcc;return function(_0x4eddc9){if(_0x4eddc9){return _0x432a8a['sendStatus'](_0x5db9ca);}return _0x432a8a[_0x1727('0x29')](_0x5db9ca)[_0x1727('0x2a')]();};}function respondWithResult(_0x1b87c2,_0xa41c6b){_0xa41c6b=_0xa41c6b||0xc8;return function(_0xe5e5ec){if(_0xe5e5ec){return _0x1b87c2['status'](_0xa41c6b)[_0x1727('0x2b')](_0xe5e5ec);}};}function respondWithFilteredResult(_0x53ffc6,_0x502db0){return function(_0x493247){if(_0x493247){var _0x3d33de=_0x493247['count'],_0x4ec26a=_0x502db0[_0x1727('0x2c')],_0x2ee20d=_0x502db0[_0x1727('0x2c')]+_0x502db0[_0x1727('0x2d')],_0x5b1977;if(_0x2ee20d>=_0x3d33de){_0x2ee20d=_0x3d33de;_0x5b1977=0xc8;}else{_0x5b1977=0xce;}_0x53ffc6[_0x1727('0x29')](_0x5b1977);return _0x53ffc6[_0x1727('0x2e')](_0x1727('0x2f'),_0x4ec26a+'-'+_0x2ee20d+'/'+_0x3d33de)[_0x1727('0x2b')](_0x493247);}return null;};}function patchUpdates(_0x3e1f68){return function(_0x2b6533){try{jsonpatch[_0x1727('0x30')](_0x2b6533,_0x3e1f68,!![]);}catch(_0x3a5721){return BPromise[_0x1727('0x31')](_0x3a5721);}return _0x2b6533[_0x1727('0x32')]();};}function saveUpdates(_0x41bbbf,_0x547425){return function(_0x3e7044){if(_0x3e7044){return _0x3e7044['update'](_0x41bbbf)[_0x1727('0x33')](function(_0x5a6e3c){return _0x5a6e3c;});}return null;};}function removeEntity(_0x42dc69,_0x57eccf){return function(_0x784f65){if(_0x784f65){return _0x784f65[_0x1727('0x34')]()[_0x1727('0x33')](function(){_0x42dc69[_0x1727('0x29')](0xcc)[_0x1727('0x2a')]();});}};}function handleEntityNotFound(_0x3dcbdd,_0x5a9639){return function(_0x4ef486){if(!_0x4ef486){_0x3dcbdd['sendStatus'](0x194);}return _0x4ef486;};}function handleError(_0x1253f8,_0x32f030){_0x32f030=_0x32f030||0x1f4;return function(_0x28702f){logger[_0x1727('0x26')](_0x28702f[_0x1727('0x35')]);if(_0x28702f[_0x1727('0x36')]){delete _0x28702f[_0x1727('0x36')];}_0x1253f8['status'](_0x32f030)['send'](_0x28702f);};}exports[_0x1727('0x37')]=function(_0x1aa408,_0x31b60d){var _0x3270c2={},_0x386f32={},_0x235402={'count':0x0,'rows':[]};var _0xdd759=_['map'](db[_0x1727('0x38')][_0x1727('0x39')],function(_0x1fbc8a){return{'name':_0x1fbc8a[_0x1727('0x3a')],'type':_0x1fbc8a[_0x1727('0x3b')][_0x1727('0x3c')]};});_0x386f32[_0x1727('0x3d')]=_[_0x1727('0x3e')](_0xdd759,'name');_0x386f32['query']=_[_0x1727('0x3f')](_0x1aa408['query']);_0x386f32[_0x1727('0x40')]=_[_0x1727('0x41')](_0x386f32[_0x1727('0x3d')],_0x386f32[_0x1727('0x42')]);_0x3270c2[_0x1727('0x43')]=_['intersection'](_0x386f32[_0x1727('0x3d')],qs[_0x1727('0x44')](_0x1aa408[_0x1727('0x42')]['fields']));_0x3270c2[_0x1727('0x43')]=_0x3270c2['attributes'][_0x1727('0x45')]?_0x3270c2[_0x1727('0x43')]:_0x386f32[_0x1727('0x3d')];if(!_0x1aa408[_0x1727('0x42')][_0x1727('0x46')](_0x1727('0x47'))){_0x3270c2[_0x1727('0x2d')]=qs[_0x1727('0x2d')](_0x1aa408['query'][_0x1727('0x2d')]);_0x3270c2['offset']=qs[_0x1727('0x2c')](_0x1aa408['query']['offset']);}_0x3270c2['order']=qs[_0x1727('0x48')](_0x1aa408[_0x1727('0x42')][_0x1727('0x48')]);_0x3270c2[_0x1727('0x49')]=qs[_0x1727('0x40')](_[_0x1727('0x4a')](_0x1aa408['query'],_0x386f32[_0x1727('0x40')]),_0xdd759);if(_0x1aa408[_0x1727('0x42')][_0x1727('0x4b')]){_0x3270c2['where']=_['merge'](_0x3270c2[_0x1727('0x49')],{'$or':_[_0x1727('0x3e')](_0xdd759,function(_0x5aa2fd){if(_0x5aa2fd[_0x1727('0x3b')]!==_0x1727('0x4c')){var _0x2f0a92={};_0x2f0a92[_0x5aa2fd[_0x1727('0x36')]]={'$like':'%'+_0x1aa408['query'][_0x1727('0x4b')]+'%'};return _0x2f0a92;}})});}_0x3270c2=_[_0x1727('0x4d')]({},_0x3270c2,_0x1aa408[_0x1727('0x4e')]);var _0xd371bf={'where':_0x3270c2['where']};return db['FreshsalesAccount'][_0x1727('0x4f')](_0xd371bf)[_0x1727('0x33')](function(_0x1b39d1){_0x235402[_0x1727('0x4f')]=_0x1b39d1;if(_0x1aa408[_0x1727('0x42')]['includeAll']){_0x3270c2[_0x1727('0x50')]=[{'all':!![]}];}return db[_0x1727('0x38')][_0x1727('0x51')](_0x3270c2);})[_0x1727('0x33')](function(_0x45dc30){_0x235402[_0x1727('0x52')]=_0x45dc30;return _0x235402;})[_0x1727('0x33')](respondWithFilteredResult(_0x31b60d,_0x3270c2))[_0x1727('0x28')](handleError(_0x31b60d,null));};exports[_0x1727('0x53')]=function(_0x530b9b,_0x902c59){var _0x2435c7={'raw':![],'where':{'id':_0x530b9b[_0x1727('0x54')]['id']}},_0x815dc4={};_0x815dc4[_0x1727('0x3d')]=_[_0x1727('0x3f')](db[_0x1727('0x38')]['rawAttributes']);_0x815dc4[_0x1727('0x42')]=_['keys'](_0x530b9b[_0x1727('0x42')]);_0x815dc4[_0x1727('0x40')]=_['intersection'](_0x815dc4[_0x1727('0x3d')],_0x815dc4[_0x1727('0x42')]);_0x2435c7[_0x1727('0x43')]=_[_0x1727('0x41')](_0x815dc4['model'],qs[_0x1727('0x44')](_0x530b9b[_0x1727('0x42')][_0x1727('0x44')]));_0x2435c7['attributes']=_0x2435c7[_0x1727('0x43')][_0x1727('0x45')]?_0x2435c7[_0x1727('0x43')]:_0x815dc4[_0x1727('0x3d')];if(_0x530b9b[_0x1727('0x42')][_0x1727('0x55')]){_0x2435c7[_0x1727('0x50')]=[{'all':!![]}];}_0x2435c7=_['merge']({},_0x2435c7,_0x530b9b['options']);return db[_0x1727('0x38')][_0x1727('0x56')](_0x2435c7)[_0x1727('0x33')](handleEntityNotFound(_0x902c59,null))[_0x1727('0x33')](respondWithResult(_0x902c59,null))[_0x1727('0x28')](handleError(_0x902c59,null));};exports[_0x1727('0x57')]=function(_0x1ea7f5,_0x384761){return db[_0x1727('0x38')][_0x1727('0x57')](_0x1ea7f5[_0x1727('0x58')],{})[_0x1727('0x33')](respondWithResult(_0x384761,0xc9))[_0x1727('0x28')](handleError(_0x384761,null));};exports['update']=function(_0x25b99b,_0x5b72e3){if(_0x25b99b[_0x1727('0x58')]['id']){delete _0x25b99b[_0x1727('0x58')]['id'];}return db[_0x1727('0x38')]['find']({'where':{'id':_0x25b99b[_0x1727('0x54')]['id']}})[_0x1727('0x33')](handleEntityNotFound(_0x5b72e3,null))[_0x1727('0x33')](saveUpdates(_0x25b99b[_0x1727('0x58')],null))[_0x1727('0x33')](respondWithResult(_0x5b72e3,null))[_0x1727('0x28')](handleError(_0x5b72e3,null));};exports['destroy']=function(_0x36ba88,_0x3fae45){return db[_0x1727('0x38')][_0x1727('0x56')]({'where':{'id':_0x36ba88[_0x1727('0x54')]['id']}})[_0x1727('0x33')](handleEntityNotFound(_0x3fae45,null))[_0x1727('0x33')](removeEntity(_0x3fae45,null))['catch'](handleError(_0x3fae45,null));};exports[_0x1727('0x59')]=function(_0x3166ad,_0x3108a6,_0x5b86de){var _0x2dfdb9={};var _0x4ee735={};var _0x1a1c0d;var _0x31296a;return db[_0x1727('0x38')]['findOne']({'where':{'id':_0x3166ad['params']['id']}})['then'](handleEntityNotFound(_0x3108a6,null))[_0x1727('0x33')](function(_0x4ab5d6){if(_0x4ab5d6){_0x1a1c0d=_0x4ab5d6;_0x4ee735[_0x1727('0x3d')]=_[_0x1727('0x3f')](db['FreshsalesConfiguration']['rawAttributes']);_0x4ee735[_0x1727('0x42')]=_[_0x1727('0x3f')](_0x3166ad[_0x1727('0x42')]);_0x4ee735[_0x1727('0x40')]=_['intersection'](_0x4ee735[_0x1727('0x3d')],_0x4ee735[_0x1727('0x42')]);_0x2dfdb9[_0x1727('0x43')]=_[_0x1727('0x41')](_0x4ee735[_0x1727('0x3d')],qs['fields'](_0x3166ad[_0x1727('0x42')][_0x1727('0x44')]));_0x2dfdb9[_0x1727('0x43')]=_0x2dfdb9[_0x1727('0x43')][_0x1727('0x45')]?_0x2dfdb9[_0x1727('0x43')]:_0x4ee735[_0x1727('0x3d')];_0x2dfdb9['order']=qs[_0x1727('0x48')](_0x3166ad['query'][_0x1727('0x48')]);_0x2dfdb9['where']=qs[_0x1727('0x40')](_[_0x1727('0x4a')](_0x3166ad[_0x1727('0x42')],_0x4ee735[_0x1727('0x40')]));if(_0x3166ad[_0x1727('0x42')][_0x1727('0x4b')]){_0x2dfdb9[_0x1727('0x49')]=_['merge'](_0x2dfdb9['where'],{'$or':_[_0x1727('0x3e')](_0x2dfdb9['attributes'],function(_0x363828){var _0x55da69={};_0x55da69[_0x363828]={'$like':'%'+_0x3166ad['query']['filter']+'%'};return _0x55da69;})});}_0x2dfdb9=_['merge']({},_0x2dfdb9,_0x3166ad[_0x1727('0x4e')]);return _0x1a1c0d[_0x1727('0x59')](_0x2dfdb9);}})[_0x1727('0x33')](function(_0xd137d0){if(_0xd137d0){_0x31296a=_0xd137d0[_0x1727('0x45')];if(!_0x3166ad['query'][_0x1727('0x46')](_0x1727('0x47'))){_0x2dfdb9[_0x1727('0x2d')]=qs[_0x1727('0x2d')](_0x3166ad[_0x1727('0x42')]['limit']);_0x2dfdb9[_0x1727('0x2c')]=qs['offset'](_0x3166ad[_0x1727('0x42')][_0x1727('0x2c')]);}return _0x1a1c0d[_0x1727('0x59')](_0x2dfdb9);}})[_0x1727('0x33')](function(_0x20871b){if(_0x20871b){return _0x20871b?{'count':_0x31296a,'rows':_0x20871b}:null;}})[_0x1727('0x33')](respondWithResult(_0x3108a6,null))[_0x1727('0x28')](handleError(_0x3108a6,null));};exports[_0x1727('0x5a')]=function(_0x2da3e8,_0x4db080,_0x5c1f43){if(_0x2da3e8[_0x1727('0x58')]['id']){delete _0x2da3e8[_0x1727('0x58')]['id'];}return db[_0x1727('0x38')][_0x1727('0x5b')]({'where':{'id':_0x2da3e8[_0x1727('0x54')]['id']}})['then'](handleEntityNotFound(_0x4db080,null))[_0x1727('0x33')](function(_0x3c54f8){if(_0x3c54f8){_0x2da3e8['body'][_0x1727('0x5c')]=_0x3c54f8['id'];_0x2da3e8['body'][_0x1727('0x5d')]=integrations[_0x1727('0x5e')](_0x2da3e8['body'][_0x1727('0x5f')],_0x2da3e8[_0x1727('0x58')][_0x1727('0x3b')]);_0x2da3e8[_0x1727('0x58')][_0x1727('0x60')]=integrations['getDescriptions'](_0x2da3e8['body'][_0x1727('0x5f')],_0x2da3e8[_0x1727('0x58')][_0x1727('0x3b')]);return db[_0x1727('0x61')]['create'](_0x2da3e8[_0x1727('0x58')],{'include':[{'model':db[_0x1727('0x62')],'as':_0x1727('0x5d')},{'model':db[_0x1727('0x62')],'as':_0x1727('0x60')}]});}return null;})[_0x1727('0x33')](respondWithResult(_0x4db080,null))[_0x1727('0x28')](handleError(_0x4db080,null));};exports[_0x1727('0x63')]=function(_0x2973e8,_0x4745d9,_0x582f1e){var _0x24c27c='';var _0x3e1d26='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x2973e8[_0x1727('0x54')]['id']},'attributes':['id',_0x1727('0x64'),_0x1727('0x65'),'apiKey']})[_0x1727('0x33')](handleEntityNotFound(_0x4745d9,null))[_0x1727('0x33')](function(_0x4f5d29){if(_0x4f5d29){_0x3e1d26=_0x4f5d29[_0x1727('0x64')];_0x24c27c=_0x4f5d29[_0x1727('0x65')];var _0x2a9f65=_0x4f5d29['remoteUri'][_0x1727('0x66')](-0x1);if(_0x2a9f65==='/'){_0x24c27c=_0x24c27c[_0x1727('0x67')](0x0,_0x24c27c['lastIndexOf'](_0x2a9f65));}return rp({'method':'GET','uri':util['format'](_0x1727('0x68'),_0x24c27c,_0x1727('0x69')),'headers':{'Authorization':_0x1727('0x6a')+_0x4f5d29[_0x1727('0x6b')]},'json':!![]});}})[_0x1727('0x33')](function(_0xd6441d){if(_0xd6441d){var _0x14ffab=_0xd6441d[_0x1727('0x6c')];var _0x4f1fd5=![];var _0x22b2f0=null;for(_0x22b2f0=0x0;_0x22b2f0<_0x14ffab[_0x1727('0x45')];_0x22b2f0++){if(_0x14ffab[_0x22b2f0][_0x1727('0x6d')]===_0x3e1d26){_0x4f1fd5=!![];}}if(_0x4f1fd5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1727('0x6e')});}}})[_0x1727('0x33')](respondWithResult(_0x4745d9,null))[_0x1727('0x28')](function(_0x444bbd){var _0x463721=_0x2973e8[_0x1727('0x42')][_0x1727('0x1d')]?0x1f4:_0x444bbd['statusCode']||0x1f4;logger[_0x1727('0x26')](_0x1727('0x6f'),_0x1727('0x63'),_0x463721,JSON['stringify'](_0x444bbd));delete _0x444bbd['name'];if(_0x463721===0x191){_0x463721=0x190;}_0x4745d9[_0x1727('0x29')](_0x463721)['send'](_0x2973e8[_0x1727('0x42')][_0x1727('0x1d')]?{'message':_0x1727('0x70'),'statusCode':_0x444bbd['statusCode']}:_0x444bbd);});}; \ No newline at end of file +var _0xd55e=['FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','end','sendStatus','stack','name','map','FreshsalesAccount','rawAttributes','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','body','find','getConfigurations','findOne','keys','addConfiguration','AccountId','Descriptions','getDescriptions','channel'];(function(_0x3ae9ea,_0x1f5605){var _0xdcbf71=function(_0x37ee92){while(--_0x37ee92){_0x3ae9ea['push'](_0x3ae9ea['shift']());}};_0xdcbf71(++_0x1f5605);}(_0xd55e,0x158));var _0xed55=function(_0x50d52e,_0x25c3a7){_0x50d52e=_0x50d52e-0x0;var _0x45bf12=_0xd55e[_0x50d52e];return _0x45bf12;};'use strict';var pdf=require(_0xed55('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed55('0x1'));var zipdir=require(_0xed55('0x2'));var jsonpatch=require(_0xed55('0x3'));var rp=require('request-promise');var moment=require(_0xed55('0x4'));var BPromise=require(_0xed55('0x5'));var Mustache=require(_0xed55('0x6'));var util=require(_0xed55('0x7'));var path=require(_0xed55('0x8'));var sox=require(_0xed55('0x9'));var csv=require(_0xed55('0xa'));var ejs=require(_0xed55('0xb'));var fs=require('fs');var _=require(_0xed55('0xc'));var squel=require(_0xed55('0xd'));var crypto=require(_0xed55('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed55('0xa'));var querystring=require('querystring');var Papa=require(_0xed55('0xf'));var Redis=require(_0xed55('0x10'));var authService=require(_0xed55('0x11'));var qs=require(_0xed55('0x12'));var as=require(_0xed55('0x13'));var hardwareService=require(_0xed55('0x14'));var logger=require(_0xed55('0x15'))('api');var utils=require(_0xed55('0x16'));var config=require(_0xed55('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xed55('0x18'));var jayson=require(_0xed55('0x19'));var client=jayson['client'][_0xed55('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1648b0,_0x378819,_0x2df464){if(_0x2df464){var _0x79aa21=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x79aa21[_0xed55('0x1b')](_0x378819)){return _0x1648b0;}else{throw new db[(_0xed55('0x1c'))][(_0xed55('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1648b0;}}function respondWithRpcPromise(_0x24b9e2,_0x1603f6,_0x2120d4,_0x60ddd1){return new BPromise(function(_0x529921,_0x334405){var _0x5d92b0=_0x60ddd1||client;return _0x5d92b0[_0xed55('0x1e')](_0x24b9e2,_0x2120d4)[_0xed55('0x1f')](function(_0x2de28a){logger[_0xed55('0x20')](_0xed55('0x21'),_0x1603f6,_0xed55('0x22'));logger[_0xed55('0x23')](_0xed55('0x24'),_0x1603f6,_0xed55('0x22'),JSON['stringify'](_0x2de28a));if(_0x2de28a[_0xed55('0x25')]){if(_0x2de28a['error'][_0xed55('0x26')]===0x1f4){logger['error'](_0xed55('0x21'),_0x1603f6,_0x2de28a[_0xed55('0x25')][_0xed55('0x27')]);return _0x334405(_0x2de28a[_0xed55('0x25')][_0xed55('0x27')]);}logger[_0xed55('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x1603f6,_0x2de28a[_0xed55('0x25')]['message']);return _0x529921(_0x2de28a['error'][_0xed55('0x27')]);}else{logger['info'](_0xed55('0x21'),_0x1603f6,_0xed55('0x22'));_0x529921(_0x2de28a[_0xed55('0x28')][_0xed55('0x27')]);}})['catch'](function(_0x247b8a){logger[_0xed55('0x25')](_0xed55('0x21'),_0x1603f6,_0x247b8a);_0x334405(_0x247b8a);});});}function respondWithStatusCode(_0x12b9fc,_0x3f6e84){_0x3f6e84=_0x3f6e84||0xcc;return function(_0x535a7a){if(_0x535a7a){return _0x12b9fc['sendStatus'](_0x3f6e84);}return _0x12b9fc[_0xed55('0x29')](_0x3f6e84)['end']();};}function respondWithResult(_0xa76d8d,_0x5a4aec){_0x5a4aec=_0x5a4aec||0xc8;return function(_0xb43f69){if(_0xb43f69){return _0xa76d8d[_0xed55('0x29')](_0x5a4aec)[_0xed55('0x2a')](_0xb43f69);}};}function respondWithFilteredResult(_0x194153,_0x1105cb){return function(_0x172f2f){if(_0x172f2f){var _0x5d754a=_0x172f2f[_0xed55('0x2b')],_0xbb94c2=_0x1105cb[_0xed55('0x2c')],_0x501580=_0x1105cb[_0xed55('0x2c')]+_0x1105cb[_0xed55('0x2d')],_0x24a43e;if(_0x501580>=_0x5d754a){_0x501580=_0x5d754a;_0x24a43e=0xc8;}else{_0x24a43e=0xce;}_0x194153['status'](_0x24a43e);return _0x194153['set'](_0xed55('0x2e'),_0xbb94c2+'-'+_0x501580+'/'+_0x5d754a)[_0xed55('0x2a')](_0x172f2f);}return null;};}function patchUpdates(_0x309d75){return function(_0x5be7f6){try{jsonpatch[_0xed55('0x2f')](_0x5be7f6,_0x309d75,!![]);}catch(_0x58868c){return BPromise[_0xed55('0x30')](_0x58868c);}return _0x5be7f6['save']();};}function saveUpdates(_0x5b9417,_0x390819){return function(_0x1c2136){if(_0x1c2136){return _0x1c2136[_0xed55('0x31')](_0x5b9417)[_0xed55('0x1f')](function(_0x34bc5a){return _0x34bc5a;});}return null;};}function removeEntity(_0x1a906d,_0x55eef0){return function(_0x4602e5){if(_0x4602e5){return _0x4602e5[_0xed55('0x32')]()['then'](function(){_0x1a906d['status'](0xcc)[_0xed55('0x33')]();});}};}function handleEntityNotFound(_0x4b92fc,_0x29c08f){return function(_0x5d8023){if(!_0x5d8023){_0x4b92fc[_0xed55('0x34')](0x194);}return _0x5d8023;};}function handleError(_0x68ebf6,_0x1d1606){_0x1d1606=_0x1d1606||0x1f4;return function(_0x49c033){logger['error'](_0x49c033[_0xed55('0x35')]);if(_0x49c033[_0xed55('0x36')]){delete _0x49c033[_0xed55('0x36')];}_0x68ebf6[_0xed55('0x29')](_0x1d1606)['send'](_0x49c033);};}exports['index']=function(_0x924160,_0x108977){var _0x5172a8={},_0x293536={},_0x1f1e3f={'count':0x0,'rows':[]};var _0x22e289=_[_0xed55('0x37')](db[_0xed55('0x38')][_0xed55('0x39')],function(_0x526707){return{'name':_0x526707['fieldName'],'type':_0x526707['type'][_0xed55('0x3a')]};});_0x293536[_0xed55('0x3b')]=_[_0xed55('0x37')](_0x22e289,_0xed55('0x36'));_0x293536[_0xed55('0x3c')]=_['keys'](_0x924160[_0xed55('0x3c')]);_0x293536['filters']=_['intersection'](_0x293536[_0xed55('0x3b')],_0x293536[_0xed55('0x3c')]);_0x5172a8['attributes']=_[_0xed55('0x3d')](_0x293536[_0xed55('0x3b')],qs[_0xed55('0x3e')](_0x924160['query']['fields']));_0x5172a8[_0xed55('0x3f')]=_0x5172a8[_0xed55('0x3f')]['length']?_0x5172a8[_0xed55('0x3f')]:_0x293536[_0xed55('0x3b')];if(!_0x924160[_0xed55('0x3c')][_0xed55('0x40')](_0xed55('0x41'))){_0x5172a8[_0xed55('0x2d')]=qs[_0xed55('0x2d')](_0x924160['query'][_0xed55('0x2d')]);_0x5172a8['offset']=qs[_0xed55('0x2c')](_0x924160[_0xed55('0x3c')][_0xed55('0x2c')]);}_0x5172a8[_0xed55('0x42')]=qs['sort'](_0x924160[_0xed55('0x3c')][_0xed55('0x43')]);_0x5172a8[_0xed55('0x44')]=qs[_0xed55('0x45')](_['pick'](_0x924160['query'],_0x293536[_0xed55('0x45')]),_0x22e289);if(_0x924160[_0xed55('0x3c')]['filter']){_0x5172a8[_0xed55('0x44')]=_[_0xed55('0x46')](_0x5172a8[_0xed55('0x44')],{'$or':_['map'](_0x22e289,function(_0x3e944a){if(_0x3e944a[_0xed55('0x47')]!==_0xed55('0x48')){var _0x1b68a0={};_0x1b68a0[_0x3e944a['name']]={'$like':'%'+_0x924160[_0xed55('0x3c')][_0xed55('0x49')]+'%'};return _0x1b68a0;}})});}_0x5172a8=_['merge']({},_0x5172a8,_0x924160[_0xed55('0x4a')]);var _0x297c09={'where':_0x5172a8[_0xed55('0x44')]};return db[_0xed55('0x38')]['count'](_0x297c09)[_0xed55('0x1f')](function(_0xe13b5c){_0x1f1e3f[_0xed55('0x2b')]=_0xe13b5c;if(_0x924160[_0xed55('0x3c')][_0xed55('0x4b')]){_0x5172a8[_0xed55('0x4c')]=[{'all':!![]}];}return db[_0xed55('0x38')]['findAll'](_0x5172a8);})[_0xed55('0x1f')](function(_0x30c153){_0x1f1e3f[_0xed55('0x4d')]=_0x30c153;return _0x1f1e3f;})[_0xed55('0x1f')](respondWithFilteredResult(_0x108977,_0x5172a8))[_0xed55('0x4e')](handleError(_0x108977,null));};exports[_0xed55('0x4f')]=function(_0x14544e,_0x46ee95){var _0xccf3b7={'raw':![],'where':{'id':_0x14544e[_0xed55('0x50')]['id']}},_0x1c9418={};_0x1c9418['model']=_['keys'](db[_0xed55('0x38')][_0xed55('0x39')]);_0x1c9418[_0xed55('0x3c')]=_['keys'](_0x14544e[_0xed55('0x3c')]);_0x1c9418[_0xed55('0x45')]=_[_0xed55('0x3d')](_0x1c9418[_0xed55('0x3b')],_0x1c9418['query']);_0xccf3b7['attributes']=_[_0xed55('0x3d')](_0x1c9418[_0xed55('0x3b')],qs[_0xed55('0x3e')](_0x14544e[_0xed55('0x3c')][_0xed55('0x3e')]));_0xccf3b7[_0xed55('0x3f')]=_0xccf3b7[_0xed55('0x3f')][_0xed55('0x51')]?_0xccf3b7[_0xed55('0x3f')]:_0x1c9418[_0xed55('0x3b')];if(_0x14544e['query'][_0xed55('0x4b')]){_0xccf3b7[_0xed55('0x4c')]=[{'all':!![]}];}_0xccf3b7=_[_0xed55('0x46')]({},_0xccf3b7,_0x14544e['options']);return db['FreshsalesAccount']['find'](_0xccf3b7)['then'](handleEntityNotFound(_0x46ee95,null))['then'](respondWithResult(_0x46ee95,null))['catch'](handleError(_0x46ee95,null));};exports['create']=function(_0x1c7067,_0x5e7cef){return db[_0xed55('0x38')]['create'](_0x1c7067[_0xed55('0x52')],{})[_0xed55('0x1f')](respondWithResult(_0x5e7cef,0xc9))[_0xed55('0x4e')](handleError(_0x5e7cef,null));};exports[_0xed55('0x31')]=function(_0x2a0ffe,_0x6449f2){if(_0x2a0ffe[_0xed55('0x52')]['id']){delete _0x2a0ffe['body']['id'];}return db[_0xed55('0x38')][_0xed55('0x53')]({'where':{'id':_0x2a0ffe[_0xed55('0x50')]['id']}})[_0xed55('0x1f')](handleEntityNotFound(_0x6449f2,null))[_0xed55('0x1f')](saveUpdates(_0x2a0ffe[_0xed55('0x52')],null))[_0xed55('0x1f')](respondWithResult(_0x6449f2,null))[_0xed55('0x4e')](handleError(_0x6449f2,null));};exports[_0xed55('0x32')]=function(_0x1413f2,_0x4ce42b){return db[_0xed55('0x38')][_0xed55('0x53')]({'where':{'id':_0x1413f2[_0xed55('0x50')]['id']}})[_0xed55('0x1f')](handleEntityNotFound(_0x4ce42b,null))[_0xed55('0x1f')](removeEntity(_0x4ce42b,null))[_0xed55('0x4e')](handleError(_0x4ce42b,null));};exports[_0xed55('0x54')]=function(_0x26119d,_0xd08c83,_0x209af6){var _0x2c645b={};var _0x53a607={};var _0x1da7eb;var _0x40aad5;return db[_0xed55('0x38')][_0xed55('0x55')]({'where':{'id':_0x26119d[_0xed55('0x50')]['id']}})['then'](handleEntityNotFound(_0xd08c83,null))[_0xed55('0x1f')](function(_0x5d921a){if(_0x5d921a){_0x1da7eb=_0x5d921a;_0x53a607[_0xed55('0x3b')]=_[_0xed55('0x56')](db['FreshsalesConfiguration'][_0xed55('0x39')]);_0x53a607['query']=_[_0xed55('0x56')](_0x26119d[_0xed55('0x3c')]);_0x53a607[_0xed55('0x45')]=_[_0xed55('0x3d')](_0x53a607['model'],_0x53a607[_0xed55('0x3c')]);_0x2c645b[_0xed55('0x3f')]=_[_0xed55('0x3d')](_0x53a607[_0xed55('0x3b')],qs['fields'](_0x26119d[_0xed55('0x3c')][_0xed55('0x3e')]));_0x2c645b[_0xed55('0x3f')]=_0x2c645b[_0xed55('0x3f')][_0xed55('0x51')]?_0x2c645b[_0xed55('0x3f')]:_0x53a607['model'];_0x2c645b[_0xed55('0x42')]=qs[_0xed55('0x43')](_0x26119d[_0xed55('0x3c')][_0xed55('0x43')]);_0x2c645b[_0xed55('0x44')]=qs['filters'](_['pick'](_0x26119d[_0xed55('0x3c')],_0x53a607[_0xed55('0x45')]));if(_0x26119d[_0xed55('0x3c')][_0xed55('0x49')]){_0x2c645b[_0xed55('0x44')]=_['merge'](_0x2c645b['where'],{'$or':_[_0xed55('0x37')](_0x2c645b[_0xed55('0x3f')],function(_0x5daa69){var _0x50b840={};_0x50b840[_0x5daa69]={'$like':'%'+_0x26119d['query'][_0xed55('0x49')]+'%'};return _0x50b840;})});}_0x2c645b=_[_0xed55('0x46')]({},_0x2c645b,_0x26119d['options']);return _0x1da7eb[_0xed55('0x54')](_0x2c645b);}})['then'](function(_0xc80755){if(_0xc80755){_0x40aad5=_0xc80755['length'];if(!_0x26119d[_0xed55('0x3c')][_0xed55('0x40')](_0xed55('0x41'))){_0x2c645b[_0xed55('0x2d')]=qs[_0xed55('0x2d')](_0x26119d['query'][_0xed55('0x2d')]);_0x2c645b[_0xed55('0x2c')]=qs[_0xed55('0x2c')](_0x26119d[_0xed55('0x3c')][_0xed55('0x2c')]);}return _0x1da7eb[_0xed55('0x54')](_0x2c645b);}})[_0xed55('0x1f')](function(_0x3faae9){if(_0x3faae9){return _0x3faae9?{'count':_0x40aad5,'rows':_0x3faae9}:null;}})[_0xed55('0x1f')](respondWithResult(_0xd08c83,null))['catch'](handleError(_0xd08c83,null));};exports[_0xed55('0x57')]=function(_0x2db7a4,_0x308c65,_0x443c49){if(_0x2db7a4[_0xed55('0x52')]['id']){delete _0x2db7a4[_0xed55('0x52')]['id'];}return db[_0xed55('0x38')]['findOne']({'where':{'id':_0x2db7a4[_0xed55('0x50')]['id']}})[_0xed55('0x1f')](handleEntityNotFound(_0x308c65,null))[_0xed55('0x1f')](function(_0x51ec0f){if(_0x51ec0f){_0x2db7a4[_0xed55('0x52')][_0xed55('0x58')]=_0x51ec0f['id'];_0x2db7a4['body']['Subjects']=integrations['getSubjects'](_0x2db7a4[_0xed55('0x52')]['channel'],_0x2db7a4[_0xed55('0x52')]['type']);_0x2db7a4['body'][_0xed55('0x59')]=integrations[_0xed55('0x5a')](_0x2db7a4[_0xed55('0x52')][_0xed55('0x5b')],_0x2db7a4[_0xed55('0x52')][_0xed55('0x47')]);return db['FreshsalesConfiguration']['create'](_0x2db7a4[_0xed55('0x52')],{'include':[{'model':db[_0xed55('0x5c')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xed55('0x59')}]});}return null;})[_0xed55('0x1f')](respondWithResult(_0x308c65,null))[_0xed55('0x4e')](handleError(_0x308c65,null));};exports[_0xed55('0x5d')]=function(_0x283bb2,_0x38aca7,_0x5a21da){var _0x409779='';var _0x5cda44='';return db[_0xed55('0x38')]['findOne']({'where':{'id':_0x283bb2['params']['id']},'attributes':['id',_0xed55('0x5e'),_0xed55('0x5f'),'apiKey']})[_0xed55('0x1f')](handleEntityNotFound(_0x38aca7,null))[_0xed55('0x1f')](function(_0x5b38fd){if(_0x5b38fd){_0x5cda44=_0x5b38fd[_0xed55('0x5e')];_0x409779=_0x5b38fd['remoteUri'];var _0x58c5ec=_0x5b38fd[_0xed55('0x5f')][_0xed55('0x60')](-0x1);if(_0x58c5ec==='/'){_0x409779=_0x409779[_0xed55('0x61')](0x0,_0x409779[_0xed55('0x62')](_0x58c5ec));}return rp({'method':'GET','uri':util[_0xed55('0x63')](_0xed55('0x64'),_0x409779,_0xed55('0x65')),'headers':{'Authorization':_0xed55('0x66')+_0x5b38fd[_0xed55('0x67')]},'json':!![]});}})[_0xed55('0x1f')](function(_0x2bc888){if(_0x2bc888){var _0x1054be=_0x2bc888[_0xed55('0x68')];var _0x3b64e0=![];var _0x1b9ff7=null;for(_0x1b9ff7=0x0;_0x1b9ff7<_0x1054be[_0xed55('0x51')];_0x1b9ff7++){if(_0x1054be[_0x1b9ff7][_0xed55('0x69')]===_0x5cda44){_0x3b64e0=!![];}}if(_0x3b64e0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xed55('0x1f')](respondWithResult(_0x38aca7,null))[_0xed55('0x4e')](function(_0x501d){var _0x396c47=_0x283bb2[_0xed55('0x3c')][_0xed55('0x1b')]?0x1f4:_0x501d[_0xed55('0x6a')]||0x1f4;logger[_0xed55('0x25')](_0xed55('0x6b'),'getFields',_0x396c47,JSON['stringify'](_0x501d));delete _0x501d[_0xed55('0x36')];if(_0x396c47===0x191){_0x396c47=0x190;}_0x38aca7[_0xed55('0x29')](_0x396c47)[_0xed55('0x6c')](_0x283bb2[_0xed55('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x501d[_0xed55('0x6a')]}:_0x501d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index d223054..bd51708 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 _0x4b84=['rimraf','../../config/environment','define','int_freshsales_accounts','lodash','util','moment','path'];(function(_0x25e903,_0x56e206){var _0xd19732=function(_0x21cb8f){while(--_0x21cb8f){_0x25e903['push'](_0x25e903['shift']());}};_0xd19732(++_0x56e206);}(_0x4b84,0x1cc));var _0x44b8=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x4b84[_0x45346d];return _0x5ce7ca;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x996a8b,_0x54274b){return _0x996a8b[_0x44b8('0x6')]('FreshsalesAccount',attributes,{'tableName':_0x44b8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf021=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x20bf3e,_0x11e986){var _0x306e05=function(_0x52f762){while(--_0x52f762){_0x20bf3e['push'](_0x20bf3e['shift']());}};_0x306e05(++_0x11e986);}(_0xf021,0x18f));var _0x1f02=function(_0x1188a8,_0xc1498d){_0x1188a8=_0x1188a8-0x0;var _0x50c1c1=_0xf021[_0x1188a8];return _0x50c1c1;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1f02('0x8')]=function(_0x56b275,_0x383d0b){return _0x56b275[_0x1f02('0x9')](_0x1f02('0xa'),attributes,{'tableName':_0x1f02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 97d03cc..530f97f 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 _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x5ee90e,_0x21f2bc){var _0x5ec85b=function(_0x4e715b){while(--_0x4e715b){_0x5ee90e['push'](_0x5ee90e['shift']());}};_0x5ec85b(++_0x21f2bc);}(_0x68b3,0x1d8));var _0x368b=function(_0x8c086c,_0x2beb7a){_0x8c086c=_0x8c086c-0x0;var _0x2a5b55=_0x68b3[_0x8c086c];return _0x2a5b55;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file +var _0x082a=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','map','model','include','debug','ShowFreshsalesAccount','find'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0x082a,0x154));var _0xa082=function(_0xbb76c7,_0x2621a2){_0xbb76c7=_0xbb76c7-0x0;var _0x369de3=_0x082a[_0xbb76c7];return _0x369de3;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var moment=require(_0xa082('0x1'));var BPromise=require(_0xa082('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa082('0x3'));var db=require(_0xa082('0x4'))['db'];var utils=require(_0xa082('0x5'));var logger=require(_0xa082('0x6'))(_0xa082('0x7'));var config=require('../../config/environment');var jayson=require(_0xa082('0x8'));var client=jayson['client'][_0xa082('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41030c,_0x5ae561,_0x31c98d){return new BPromise(function(_0x193550,_0x382b03){return client['request'](_0x41030c,_0x31c98d)[_0xa082('0xa')](function(_0xafc3c1){logger[_0xa082('0xb')](_0xa082('0xc'),_0x5ae561,_0xa082('0xd'));logger['debug'](_0xa082('0xe'),_0x5ae561,_0xa082('0xd'),JSON[_0xa082('0xf')](_0xafc3c1));if(_0xafc3c1['error']){if(_0xafc3c1['error'][_0xa082('0x10')]===0x1f4){logger[_0xa082('0x11')](_0xa082('0xc'),_0x5ae561,_0xafc3c1[_0xa082('0x11')]['message']);return _0x382b03(_0xafc3c1[_0xa082('0x11')][_0xa082('0x12')]);}logger[_0xa082('0x11')](_0xa082('0xc'),_0x5ae561,_0xafc3c1[_0xa082('0x11')][_0xa082('0x12')]);return _0x193550(_0xafc3c1['error'][_0xa082('0x12')]);}else{logger[_0xa082('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x5ae561,_0xa082('0xd'));_0x193550(_0xafc3c1[_0xa082('0x13')][_0xa082('0x12')]);}})[_0xa082('0x14')](function(_0x507d9c){logger['error'](_0xa082('0xc'),_0x5ae561,_0x507d9c);_0x382b03(_0x507d9c);});});}exports[_0xa082('0x15')]=function(_0x507043){var _0x3c32cc=this;return new Promise(function(_0x536ffa,_0xeaa1ce){return db[_0xa082('0x16')][_0xa082('0x17')]({'raw':_0x507043[_0xa082('0x18')]?_0x507043['options'][_0xa082('0x19')]===undefined?!![]:![]:!![],'where':_0x507043[_0xa082('0x18')]?_0x507043['options'][_0xa082('0x1a')]||null:null,'attributes':_0x507043[_0xa082('0x18')]?_0x507043[_0xa082('0x18')][_0xa082('0x1b')]||null:null,'limit':_0x507043['options']?_0x507043[_0xa082('0x18')]['limit']||null:null,'include':_0x507043[_0xa082('0x18')]?_0x507043[_0xa082('0x18')]['include']?_[_0xa082('0x1c')](_0x507043[_0xa082('0x18')]['include'],function(_0x505d27){return{'model':db[_0x505d27[_0xa082('0x1d')]],'as':_0x505d27['as'],'attributes':_0x505d27[_0xa082('0x1b')],'include':_0x505d27[_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x505d27[_0xa082('0x1e')],function(_0x11d847){return{'model':db[_0x11d847[_0xa082('0x1d')]],'as':_0x11d847['as'],'attributes':_0x11d847[_0xa082('0x1b')],'include':_0x11d847[_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x11d847[_0xa082('0x1e')],function(_0x3ae84a){return{'model':db[_0x3ae84a[_0xa082('0x1d')]],'as':_0x3ae84a['as'],'attributes':_0x3ae84a[_0xa082('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa082('0xa')](function(_0x3e604e){logger[_0xa082('0xb')](_0xa082('0x15'),_0x507043);logger[_0xa082('0x1f')](_0xa082('0x15'),_0x507043,JSON[_0xa082('0xf')](_0x3e604e));_0x536ffa(_0x3e604e);})[_0xa082('0x14')](function(_0x208120){logger[_0xa082('0x11')](_0xa082('0x15'),_0x208120[_0xa082('0x12')],_0x507043);_0xeaa1ce(_0x3c32cc['error'](0x1f4,_0x208120[_0xa082('0x12')]));});});};exports[_0xa082('0x20')]=function(_0x8f2543){var _0x329bb2=this;return new Promise(function(_0x220905,_0x5e41a0){return db[_0xa082('0x16')][_0xa082('0x21')]({'raw':_0x8f2543['options']?_0x8f2543['options']['raw']===undefined?!![]:![]:!![],'where':_0x8f2543[_0xa082('0x18')]?_0x8f2543[_0xa082('0x18')][_0xa082('0x1a')]||null:null,'attributes':_0x8f2543[_0xa082('0x18')]?_0x8f2543[_0xa082('0x18')][_0xa082('0x1b')]||null:null,'include':_0x8f2543[_0xa082('0x18')]?_0x8f2543[_0xa082('0x18')][_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x8f2543[_0xa082('0x18')][_0xa082('0x1e')],function(_0x15fa68){return{'model':db[_0x15fa68['model']],'as':_0x15fa68['as'],'attributes':_0x15fa68['attributes'],'include':_0x15fa68['include']?_[_0xa082('0x1c')](_0x15fa68[_0xa082('0x1e')],function(_0x411757){return{'model':db[_0x411757['model']],'as':_0x411757['as'],'attributes':_0x411757['attributes'],'include':_0x411757[_0xa082('0x1e')]?_[_0xa082('0x1c')](_0x411757[_0xa082('0x1e')],function(_0x4f0824){return{'model':db[_0x4f0824[_0xa082('0x1d')]],'as':_0x4f0824['as'],'attributes':_0x4f0824['attributes']};}):[]};}):[]};}):[]:[]})[_0xa082('0xa')](function(_0x42037c){logger['info'](_0xa082('0x20'),_0x8f2543);logger[_0xa082('0x1f')]('ShowFreshsalesAccount',_0x8f2543,JSON[_0xa082('0xf')](_0x42037c));_0x220905(_0x42037c);})['catch'](function(_0x214bf4){logger[_0xa082('0x11')](_0xa082('0x20'),_0x214bf4[_0xa082('0x12')],_0x8f2543);_0x5e41a0(_0x329bb2[_0xa082('0x11')](0x1f4,_0x214bf4[_0xa082('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8795465..24a7366 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 _0xe2c8=['get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','put','update','delete','destroy','exports','util','connect-timeout','express','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index'];(function(_0x53410d,_0x25f272){var _0x3d1bc3=function(_0x46f08d){while(--_0x46f08d){_0x53410d['push'](_0x53410d['shift']());}};_0x3d1bc3(++_0x25f272);}(_0xe2c8,0xc1));var _0x8e2c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe2c8[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require(_0x8e2c('0x0'));var path=require('path');var timeout=require(_0x8e2c('0x1'));var express=require(_0x8e2c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e2c('0x3'));var controller=require(_0x8e2c('0x4'));router['get']('/',auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x6')]);router[_0x8e2c('0x7')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x9')]);router['get'](_0x8e2c('0xa'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0xb')]);router[_0x8e2c('0x7')](_0x8e2c('0xc'),auth[_0x8e2c('0x5')](),controller['getDescriptions']);router[_0x8e2c('0x7')](_0x8e2c('0xd'),auth['isAuthenticated'](),controller[_0x8e2c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8e2c('0xf')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x10')]);router[_0x8e2c('0x11')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x12')]);module[_0x8e2c('0x13')]=router; \ No newline at end of file +var _0x76bc=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76bc,0x163));var _0xc76b=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x76bc[_0x59e821];return _0x5333f6;};'use strict';var multer=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var path=require(_0xc76b('0x2'));var timeout=require(_0xc76b('0x3'));var express=require(_0xc76b('0x4'));var router=express[_0xc76b('0x5')]();var auth=require(_0xc76b('0x6'));var interaction=require(_0xc76b('0x7'));var config=require('../../config/environment');var controller=require(_0xc76b('0x8'));router[_0xc76b('0x9')]('/',auth[_0xc76b('0xa')](),controller[_0xc76b('0xb')]);router[_0xc76b('0x9')](_0xc76b('0xc'),auth[_0xc76b('0xa')](),controller[_0xc76b('0xd')]);router['get'](_0xc76b('0xe'),auth[_0xc76b('0xa')](),controller['getSubjects']);router[_0xc76b('0x9')](_0xc76b('0xf'),auth[_0xc76b('0xa')](),controller[_0xc76b('0x10')]);router[_0xc76b('0x9')](_0xc76b('0x11'),auth[_0xc76b('0xa')](),controller['getFields']);router['post']('/',auth[_0xc76b('0xa')](),controller[_0xc76b('0x12')]);router[_0xc76b('0x13')](_0xc76b('0xc'),auth[_0xc76b('0xa')](),controller[_0xc76b('0x14')]);router[_0xc76b('0x15')](_0xc76b('0xc'),auth[_0xc76b('0xa')](),controller[_0xc76b('0x16')]);module[_0xc76b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index be1af73..0b63202 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 _0x177e=['sequelize','exports','STRING'];(function(_0x9dea41,_0xb3d105){var _0x668640=function(_0x4c38fb){while(--_0x4c38fb){_0x9dea41['push'](_0x9dea41['shift']());}};_0x668640(++_0xb3d105);}(_0x177e,0x78));var _0xe177=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x177e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe177('0x0'));module[_0xe177('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe177('0x2')]}}; \ No newline at end of file +var _0xbf83=['exports','sequelize'];(function(_0x29b3aa,_0x50f51f){var _0x303bbb=function(_0x299dcd){while(--_0x299dcd){_0x29b3aa['push'](_0x29b3aa['shift']());}};_0x303bbb(++_0x50f51f);}(_0xbf83,0x1b9));var _0x3bf8=function(_0x3df652,_0x4258f9){_0x3df652=_0x3df652-0x0;var _0x4f2e74=_0xbf83[_0x3df652];return _0x4f2e74;};'use strict';var Sequelize=require(_0x3bf8('0x0'));module[_0x3bf8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ccf9489..5c38b00 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 _0x989d=['message','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','FreshsalesConfiguration','findAll','rows','catch','show','find','create','body','update','destroy','params','getSubjects','FreshsalesField','pick','hasOwnProperty','getDescriptions','findOne','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x383801,_0x14052a){var _0x25b7b3=function(_0xf84277){while(--_0xf84277){_0x383801['push'](_0x383801['shift']());}};_0x25b7b3(++_0x14052a);}(_0x989d,0x18b));var _0xd989=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x989d[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0xd989('0x0'));var emlformat=require(_0xd989('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd989('0x2'));var jsonpatch=require(_0xd989('0x3'));var rp=require(_0xd989('0x4'));var moment=require(_0xd989('0x5'));var BPromise=require(_0xd989('0x6'));var Mustache=require(_0xd989('0x7'));var util=require(_0xd989('0x8'));var path=require(_0xd989('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd989('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd989('0xb'));var crypto=require('crypto');var jsforce=require(_0xd989('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd989('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd989('0xe'));var as=require(_0xd989('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd989('0x10'));var db=require(_0xd989('0x11'))['db'];var jayson=require(_0xd989('0x12'));var client=jayson[_0xd989('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x1291f9,_0x25e426,_0x1b08e4){if(_0x1b08e4){var _0x3c27c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c27c7[_0xd989('0x14')](_0x25e426)){return _0x1291f9;}else{throw new db['Sequelize'][(_0xd989('0x15'))](_0xd989('0x16'));}}else{return _0x1291f9;}}function respondWithRpcPromise(_0x4e134c,_0x3aef8a,_0x2c8ced,_0x145ddc){return new BPromise(function(_0x335a75,_0x1066bf){var _0x53f805=_0x145ddc||client;return _0x53f805[_0xd989('0x17')](_0x4e134c,_0x2c8ced)['then'](function(_0x303b7f){logger[_0xd989('0x18')](_0xd989('0x19'),_0x3aef8a,_0xd989('0x1a'));logger[_0xd989('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3aef8a,_0xd989('0x1a'),JSON[_0xd989('0x1c')](_0x303b7f));if(_0x303b7f[_0xd989('0x1d')]){if(_0x303b7f['error']['code']===0x1f4){logger[_0xd989('0x1d')](_0xd989('0x19'),_0x3aef8a,_0x303b7f[_0xd989('0x1d')]['message']);return _0x1066bf(_0x303b7f[_0xd989('0x1d')][_0xd989('0x1e')]);}logger[_0xd989('0x1d')](_0xd989('0x19'),_0x3aef8a,_0x303b7f[_0xd989('0x1d')][_0xd989('0x1e')]);return _0x335a75(_0x303b7f[_0xd989('0x1d')][_0xd989('0x1e')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3aef8a,_0xd989('0x1a'));_0x335a75(_0x303b7f['result'][_0xd989('0x1e')]);}})['catch'](function(_0x2ee247){logger[_0xd989('0x1d')](_0xd989('0x19'),_0x3aef8a,_0x2ee247);_0x1066bf(_0x2ee247);});});}function respondWithStatusCode(_0x2aa3c9,_0xdc9b6a){_0xdc9b6a=_0xdc9b6a||0xcc;return function(_0x3a1fc7){if(_0x3a1fc7){return _0x2aa3c9['sendStatus'](_0xdc9b6a);}return _0x2aa3c9['status'](_0xdc9b6a)[_0xd989('0x1f')]();};}function respondWithResult(_0x160340,_0x584062){_0x584062=_0x584062||0xc8;return function(_0x126bd0){if(_0x126bd0){return _0x160340[_0xd989('0x20')](_0x584062)[_0xd989('0x21')](_0x126bd0);}};}function respondWithFilteredResult(_0x4cb6c3,_0xf4ac6c){return function(_0x1b8637){if(_0x1b8637){var _0x52430c=_0x1b8637[_0xd989('0x22')],_0x39a40e=_0xf4ac6c[_0xd989('0x23')],_0x45a386=_0xf4ac6c[_0xd989('0x23')]+_0xf4ac6c[_0xd989('0x24')],_0x4662df;if(_0x45a386>=_0x52430c){_0x45a386=_0x52430c;_0x4662df=0xc8;}else{_0x4662df=0xce;}_0x4cb6c3['status'](_0x4662df);return _0x4cb6c3[_0xd989('0x25')](_0xd989('0x26'),_0x39a40e+'-'+_0x45a386+'/'+_0x52430c)[_0xd989('0x21')](_0x1b8637);}return null;};}function patchUpdates(_0x56f680){return function(_0x3a5812){try{jsonpatch[_0xd989('0x27')](_0x3a5812,_0x56f680,!![]);}catch(_0x24aaff){return BPromise[_0xd989('0x28')](_0x24aaff);}return _0x3a5812['save']();};}function saveUpdates(_0x1c313a,_0x2c8e15){return function(_0x56b53f){if(_0x56b53f){return _0x56b53f['update'](_0x1c313a)[_0xd989('0x29')](function(_0x9fc2fa){return _0x9fc2fa;});}return null;};}function removeEntity(_0x4a18c0,_0x3204ad){return function(_0x4fe8c9){if(_0x4fe8c9){return _0x4fe8c9['destroy']()['then'](function(){_0x4a18c0[_0xd989('0x20')](0xcc)[_0xd989('0x1f')]();});}};}function handleEntityNotFound(_0x340793,_0x486d86){return function(_0x2ff538){if(!_0x2ff538){_0x340793[_0xd989('0x2a')](0x194);}return _0x2ff538;};}function handleError(_0x3f7775,_0x214209){_0x214209=_0x214209||0x1f4;return function(_0x1570c0){logger[_0xd989('0x1d')](_0x1570c0[_0xd989('0x2b')]);if(_0x1570c0[_0xd989('0x2c')]){delete _0x1570c0['name'];}_0x3f7775['status'](_0x214209)['send'](_0x1570c0);};}exports['index']=function(_0x34c164,_0x5ab658){var _0x1b1d44={},_0x4ab1f4={},_0x2205c6={'count':0x0,'rows':[]};var _0x682c3f=_[_0xd989('0x2d')](db['FreshsalesConfiguration'][_0xd989('0x2e')],function(_0x3c365f){return{'name':_0x3c365f[_0xd989('0x2f')],'type':_0x3c365f[_0xd989('0x30')][_0xd989('0x31')]};});_0x4ab1f4[_0xd989('0x32')]=_[_0xd989('0x2d')](_0x682c3f,_0xd989('0x2c'));_0x4ab1f4[_0xd989('0x33')]=_[_0xd989('0x34')](_0x34c164[_0xd989('0x33')]);_0x4ab1f4[_0xd989('0x35')]=_[_0xd989('0x36')](_0x4ab1f4[_0xd989('0x32')],_0x4ab1f4[_0xd989('0x33')]);_0x1b1d44[_0xd989('0x37')]=_[_0xd989('0x36')](_0x4ab1f4[_0xd989('0x32')],qs[_0xd989('0x38')](_0x34c164['query'][_0xd989('0x38')]));_0x1b1d44[_0xd989('0x37')]=_0x1b1d44['attributes'][_0xd989('0x39')]?_0x1b1d44['attributes']:_0x4ab1f4[_0xd989('0x32')];if(!_0x34c164['query']['hasOwnProperty'](_0xd989('0x3a'))){_0x1b1d44[_0xd989('0x24')]=qs[_0xd989('0x24')](_0x34c164[_0xd989('0x33')][_0xd989('0x24')]);_0x1b1d44['offset']=qs[_0xd989('0x23')](_0x34c164[_0xd989('0x33')][_0xd989('0x23')]);}_0x1b1d44[_0xd989('0x3b')]=qs[_0xd989('0x3c')](_0x34c164[_0xd989('0x33')]['sort']);_0x1b1d44[_0xd989('0x3d')]=qs['filters'](_['pick'](_0x34c164[_0xd989('0x33')],_0x4ab1f4[_0xd989('0x35')]),_0x682c3f);if(_0x34c164['query'][_0xd989('0x3e')]){_0x1b1d44[_0xd989('0x3d')]=_['merge'](_0x1b1d44[_0xd989('0x3d')],{'$or':_[_0xd989('0x2d')](_0x682c3f,function(_0x3d8417){if(_0x3d8417['type']!==_0xd989('0x3f')){var _0x4b8a2b={};_0x4b8a2b[_0x3d8417[_0xd989('0x2c')]]={'$like':'%'+_0x34c164[_0xd989('0x33')]['filter']+'%'};return _0x4b8a2b;}})});}_0x1b1d44=_[_0xd989('0x40')]({},_0x1b1d44,_0x34c164[_0xd989('0x41')]);var _0x39da85={'where':_0x1b1d44['where']};return db['FreshsalesConfiguration'][_0xd989('0x22')](_0x39da85)[_0xd989('0x29')](function(_0x1d8044){_0x2205c6['count']=_0x1d8044;if(_0x34c164[_0xd989('0x33')]['includeAll']){_0x1b1d44[_0xd989('0x42')]=[{'all':!![]}];}return db[_0xd989('0x43')][_0xd989('0x44')](_0x1b1d44);})[_0xd989('0x29')](function(_0x4a723e){_0x2205c6[_0xd989('0x45')]=_0x4a723e;return _0x2205c6;})[_0xd989('0x29')](respondWithFilteredResult(_0x5ab658,_0x1b1d44))[_0xd989('0x46')](handleError(_0x5ab658,null));};exports[_0xd989('0x47')]=function(_0x531685,_0x1a1786){var _0x4e787c={'raw':![],'where':{'id':_0x531685['params']['id']}},_0x243ca8={};_0x243ca8[_0xd989('0x32')]=_[_0xd989('0x34')](db[_0xd989('0x43')][_0xd989('0x2e')]);_0x243ca8['query']=_[_0xd989('0x34')](_0x531685[_0xd989('0x33')]);_0x243ca8[_0xd989('0x35')]=_[_0xd989('0x36')](_0x243ca8['model'],_0x243ca8[_0xd989('0x33')]);_0x4e787c[_0xd989('0x37')]=_[_0xd989('0x36')](_0x243ca8[_0xd989('0x32')],qs['fields'](_0x531685[_0xd989('0x33')][_0xd989('0x38')]));_0x4e787c[_0xd989('0x37')]=_0x4e787c['attributes'][_0xd989('0x39')]?_0x4e787c['attributes']:_0x243ca8['model'];if(_0x531685[_0xd989('0x33')]['includeAll']){_0x4e787c['include']=[{'all':!![]}];}_0x4e787c=_[_0xd989('0x40')]({},_0x4e787c,_0x531685['options']);return db[_0xd989('0x43')][_0xd989('0x48')](_0x4e787c)[_0xd989('0x29')](handleEntityNotFound(_0x1a1786,null))[_0xd989('0x29')](respondWithResult(_0x1a1786,null))[_0xd989('0x46')](handleError(_0x1a1786,null));};exports[_0xd989('0x49')]=function(_0x17a1da,_0x403c37){return db[_0xd989('0x43')][_0xd989('0x49')](_0x17a1da[_0xd989('0x4a')],{})[_0xd989('0x29')](respondWithResult(_0x403c37,0xc9))[_0xd989('0x46')](handleError(_0x403c37,null));};exports[_0xd989('0x4b')]=function(_0x56d463,_0x584d26){if(_0x56d463['body']['id']){delete _0x56d463[_0xd989('0x4a')]['id'];}return db[_0xd989('0x43')]['find']({'where':{'id':_0x56d463['params']['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x584d26,null))[_0xd989('0x29')](saveUpdates(_0x56d463[_0xd989('0x4a')],null))['then'](respondWithResult(_0x584d26,null))[_0xd989('0x46')](handleError(_0x584d26,null));};exports[_0xd989('0x4c')]=function(_0x3a2b5d,_0x340b42){return db[_0xd989('0x43')][_0xd989('0x48')]({'where':{'id':_0x3a2b5d[_0xd989('0x4d')]['id']}})['then'](handleEntityNotFound(_0x340b42,null))[_0xd989('0x29')](removeEntity(_0x340b42,null))[_0xd989('0x46')](handleError(_0x340b42,null));};exports[_0xd989('0x4e')]=function(_0x3ae0d2,_0x5d0523,_0x48421f){var _0xd58159={};var _0x88c27c={};var _0x185b47;var _0x5e1e75;return db[_0xd989('0x43')]['findOne']({'where':{'id':_0x3ae0d2[_0xd989('0x4d')]['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x5d0523,null))[_0xd989('0x29')](function(_0x4eda03){if(_0x4eda03){_0x185b47=_0x4eda03;_0x88c27c[_0xd989('0x32')]=_['keys'](db[_0xd989('0x4f')][_0xd989('0x2e')]);_0x88c27c['query']=_[_0xd989('0x34')](_0x3ae0d2[_0xd989('0x33')]);_0x88c27c[_0xd989('0x35')]=_['intersection'](_0x88c27c[_0xd989('0x32')],_0x88c27c[_0xd989('0x33')]);_0xd58159['attributes']=_['intersection'](_0x88c27c[_0xd989('0x32')],qs[_0xd989('0x38')](_0x3ae0d2['query']['fields']));_0xd58159['attributes']=_0xd58159[_0xd989('0x37')][_0xd989('0x39')]?_0xd58159[_0xd989('0x37')]:_0x88c27c['model'];_0xd58159[_0xd989('0x3b')]=qs[_0xd989('0x3c')](_0x3ae0d2['query'][_0xd989('0x3c')]);_0xd58159['where']=qs[_0xd989('0x35')](_[_0xd989('0x50')](_0x3ae0d2[_0xd989('0x33')],_0x88c27c[_0xd989('0x35')]));if(_0x3ae0d2[_0xd989('0x33')][_0xd989('0x3e')]){_0xd58159[_0xd989('0x3d')]=_[_0xd989('0x40')](_0xd58159['where'],{'$or':_['map'](_0xd58159[_0xd989('0x37')],function(_0x1998ae){var _0x4c075a={};_0x4c075a[_0x1998ae]={'$like':'%'+_0x3ae0d2[_0xd989('0x33')][_0xd989('0x3e')]+'%'};return _0x4c075a;})});}_0xd58159=_[_0xd989('0x40')]({},_0xd58159,_0x3ae0d2[_0xd989('0x41')]);return _0x185b47[_0xd989('0x4e')](_0xd58159);}})[_0xd989('0x29')](function(_0x5547ca){if(_0x5547ca){_0x5e1e75=_0x5547ca['length'];if(!_0x3ae0d2['query'][_0xd989('0x51')]('nolimit')){_0xd58159[_0xd989('0x24')]=qs['limit'](_0x3ae0d2[_0xd989('0x33')][_0xd989('0x24')]);_0xd58159[_0xd989('0x23')]=qs['offset'](_0x3ae0d2[_0xd989('0x33')][_0xd989('0x23')]);}return _0x185b47['getSubjects'](_0xd58159);}})[_0xd989('0x29')](function(_0x385e72){if(_0x385e72){return _0x385e72?{'count':_0x5e1e75,'rows':_0x385e72}:null;}})[_0xd989('0x29')](respondWithResult(_0x5d0523,null))[_0xd989('0x46')](handleError(_0x5d0523,null));};exports[_0xd989('0x52')]=function(_0x5ca3f4,_0x14bb2f,_0x2d7d55){var _0x894303={};var _0x1dfc35={};var _0x12e03f;var _0x397e46;return db[_0xd989('0x43')][_0xd989('0x53')]({'where':{'id':_0x5ca3f4[_0xd989('0x4d')]['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x14bb2f,null))[_0xd989('0x29')](function(_0x1489bd){if(_0x1489bd){_0x12e03f=_0x1489bd;_0x1dfc35[_0xd989('0x32')]=_['keys'](db[_0xd989('0x4f')][_0xd989('0x2e')]);_0x1dfc35['query']=_[_0xd989('0x34')](_0x5ca3f4[_0xd989('0x33')]);_0x1dfc35[_0xd989('0x35')]=_[_0xd989('0x36')](_0x1dfc35['model'],_0x1dfc35[_0xd989('0x33')]);_0x894303[_0xd989('0x37')]=_[_0xd989('0x36')](_0x1dfc35[_0xd989('0x32')],qs[_0xd989('0x38')](_0x5ca3f4['query'][_0xd989('0x38')]));_0x894303[_0xd989('0x37')]=_0x894303[_0xd989('0x37')][_0xd989('0x39')]?_0x894303[_0xd989('0x37')]:_0x1dfc35[_0xd989('0x32')];_0x894303['order']=qs[_0xd989('0x3c')](_0x5ca3f4[_0xd989('0x33')][_0xd989('0x3c')]);_0x894303[_0xd989('0x3d')]=qs[_0xd989('0x35')](_[_0xd989('0x50')](_0x5ca3f4['query'],_0x1dfc35[_0xd989('0x35')]));if(_0x5ca3f4[_0xd989('0x33')][_0xd989('0x3e')]){_0x894303[_0xd989('0x3d')]=_[_0xd989('0x40')](_0x894303[_0xd989('0x3d')],{'$or':_[_0xd989('0x2d')](_0x894303[_0xd989('0x37')],function(_0x1cc78a){var _0x5c4ad3={};_0x5c4ad3[_0x1cc78a]={'$like':'%'+_0x5ca3f4[_0xd989('0x33')][_0xd989('0x3e')]+'%'};return _0x5c4ad3;})});}_0x894303=_['merge']({},_0x894303,_0x5ca3f4[_0xd989('0x41')]);return _0x12e03f[_0xd989('0x52')](_0x894303);}})['then'](function(_0x337393){if(_0x337393){_0x397e46=_0x337393[_0xd989('0x39')];if(!_0x5ca3f4['query']['hasOwnProperty'](_0xd989('0x3a'))){_0x894303[_0xd989('0x24')]=qs[_0xd989('0x24')](_0x5ca3f4['query'][_0xd989('0x24')]);_0x894303[_0xd989('0x23')]=qs[_0xd989('0x23')](_0x5ca3f4[_0xd989('0x33')][_0xd989('0x23')]);}return _0x12e03f['getDescriptions'](_0x894303);}})[_0xd989('0x29')](function(_0x2b123c){if(_0x2b123c){return _0x2b123c?{'count':_0x397e46,'rows':_0x2b123c}:null;}})[_0xd989('0x29')](respondWithResult(_0x14bb2f,null))['catch'](handleError(_0x14bb2f,null));};exports[_0xd989('0x54')]=function(_0x26aa67,_0x352adf,_0x55ba4b){var _0x162108={};var _0xcd5b32={};var _0x345a75;var _0x5132cf;return db['FreshsalesConfiguration'][_0xd989('0x53')]({'where':{'id':_0x26aa67[_0xd989('0x4d')]['id']}})[_0xd989('0x29')](handleEntityNotFound(_0x352adf,null))[_0xd989('0x29')](function(_0xfe76e2){if(_0xfe76e2){_0x345a75=_0xfe76e2;_0xcd5b32[_0xd989('0x32')]=_[_0xd989('0x34')](db[_0xd989('0x4f')][_0xd989('0x2e')]);_0xcd5b32['query']=_[_0xd989('0x34')](_0x26aa67['query']);_0xcd5b32['filters']=_['intersection'](_0xcd5b32['model'],_0xcd5b32[_0xd989('0x33')]);_0x162108['attributes']=_[_0xd989('0x36')](_0xcd5b32[_0xd989('0x32')],qs['fields'](_0x26aa67['query'][_0xd989('0x38')]));_0x162108['attributes']=_0x162108[_0xd989('0x37')][_0xd989('0x39')]?_0x162108[_0xd989('0x37')]:_0xcd5b32[_0xd989('0x32')];_0x162108[_0xd989('0x3b')]=qs['sort'](_0x26aa67[_0xd989('0x33')][_0xd989('0x3c')]);_0x162108['where']=qs[_0xd989('0x35')](_[_0xd989('0x50')](_0x26aa67[_0xd989('0x33')],_0xcd5b32[_0xd989('0x35')]));if(_0x26aa67[_0xd989('0x33')]['filter']){_0x162108[_0xd989('0x3d')]=_[_0xd989('0x40')](_0x162108[_0xd989('0x3d')],{'$or':_[_0xd989('0x2d')](_0x162108[_0xd989('0x37')],function(_0x755262){var _0x129422={};_0x129422[_0x755262]={'$like':'%'+_0x26aa67[_0xd989('0x33')][_0xd989('0x3e')]+'%'};return _0x129422;})});}_0x162108=_['merge']({},_0x162108,_0x26aa67['options']);return _0x345a75['getFields'](_0x162108);}})[_0xd989('0x29')](function(_0x99b627){if(_0x99b627){_0x5132cf=_0x99b627['length'];if(!_0x26aa67[_0xd989('0x33')][_0xd989('0x51')]('nolimit')){_0x162108['limit']=qs[_0xd989('0x24')](_0x26aa67[_0xd989('0x33')][_0xd989('0x24')]);_0x162108[_0xd989('0x23')]=qs[_0xd989('0x23')](_0x26aa67[_0xd989('0x33')][_0xd989('0x23')]);}return _0x345a75[_0xd989('0x54')](_0x162108);}})[_0xd989('0x29')](function(_0x3f3ebe){if(_0x3f3ebe){return _0x3f3ebe?{'count':_0x5132cf,'rows':_0x3f3ebe}:null;}})[_0xd989('0x29')](respondWithResult(_0x352adf,null))[_0xd989('0x46')](handleError(_0x352adf,null));}; \ No newline at end of file +var _0xf720=['moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','includeAll','find','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','html-pdf','eml-format','zip-dir','request-promise'];(function(_0xf27369,_0x2e357e){var _0x5437e7=function(_0x2f4836){while(--_0x2f4836){_0xf27369['push'](_0xf27369['shift']());}};_0x5437e7(++_0x2e357e);}(_0xf720,0x17c));var _0x0f72=function(_0x577e8d,_0x5aa635){_0x577e8d=_0x577e8d-0x0;var _0x252ae2=_0xf720[_0x577e8d];return _0x252ae2;};'use strict';var pdf=require(_0x0f72('0x0'));var emlformat=require(_0x0f72('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0f72('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f72('0x3'));var moment=require(_0x0f72('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f72('0x5'));var util=require(_0x0f72('0x6'));var path=require(_0x0f72('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0f72('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f72('0x9'));var crypto=require(_0x0f72('0xa'));var jsforce=require(_0x0f72('0xb'));var deskjs=require(_0x0f72('0xc'));var toCsv=require(_0x0f72('0xd'));var querystring=require(_0x0f72('0xe'));var Papa=require(_0x0f72('0xf'));var Redis=require(_0x0f72('0x10'));var authService=require(_0x0f72('0x11'));var qs=require(_0x0f72('0x12'));var as=require(_0x0f72('0x13'));var hardwareService=require(_0x0f72('0x14'));var logger=require(_0x0f72('0x15'))(_0x0f72('0x16'));var utils=require(_0x0f72('0x17'));var config=require(_0x0f72('0x18'));var db=require(_0x0f72('0x19'))['db'];var jayson=require(_0x0f72('0x1a'));var client=jayson[_0x0f72('0x1b')][_0x0f72('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3f54b6,_0x89c4b0,_0x3ea9e6){if(_0x3ea9e6){var _0x37a36f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37a36f[_0x0f72('0x1d')](_0x89c4b0)){return _0x3f54b6;}else{throw new db['Sequelize'][(_0x0f72('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3f54b6;}}function respondWithRpcPromise(_0x19dbda,_0x5d463c,_0x206ead,_0x181c5f){return new BPromise(function(_0x7286e5,_0xb9861d){var _0x1d6acb=_0x181c5f||client;return _0x1d6acb[_0x0f72('0x1f')](_0x19dbda,_0x206ead)['then'](function(_0x451353){logger[_0x0f72('0x20')](_0x0f72('0x21'),_0x5d463c,'request\x20sent');logger[_0x0f72('0x22')](_0x0f72('0x23'),_0x5d463c,'request\x20sent',JSON['stringify'](_0x451353));if(_0x451353[_0x0f72('0x24')]){if(_0x451353[_0x0f72('0x24')][_0x0f72('0x25')]===0x1f4){logger['error'](_0x0f72('0x21'),_0x5d463c,_0x451353[_0x0f72('0x24')][_0x0f72('0x26')]);return _0xb9861d(_0x451353[_0x0f72('0x24')][_0x0f72('0x26')]);}logger[_0x0f72('0x24')](_0x0f72('0x21'),_0x5d463c,_0x451353[_0x0f72('0x24')][_0x0f72('0x26')]);return _0x7286e5(_0x451353[_0x0f72('0x24')]['message']);}else{logger[_0x0f72('0x20')](_0x0f72('0x21'),_0x5d463c,'request\x20sent');_0x7286e5(_0x451353[_0x0f72('0x27')][_0x0f72('0x26')]);}})[_0x0f72('0x28')](function(_0x189b0d){logger[_0x0f72('0x24')](_0x0f72('0x21'),_0x5d463c,_0x189b0d);_0xb9861d(_0x189b0d);});});}function respondWithStatusCode(_0x49bc3a,_0x358c20){_0x358c20=_0x358c20||0xcc;return function(_0x4a5781){if(_0x4a5781){return _0x49bc3a[_0x0f72('0x29')](_0x358c20);}return _0x49bc3a[_0x0f72('0x2a')](_0x358c20)[_0x0f72('0x2b')]();};}function respondWithResult(_0x3c2c8d,_0x178f38){_0x178f38=_0x178f38||0xc8;return function(_0x3d9f63){if(_0x3d9f63){return _0x3c2c8d['status'](_0x178f38)[_0x0f72('0x2c')](_0x3d9f63);}};}function respondWithFilteredResult(_0x22695c,_0x400893){return function(_0x1316a6){if(_0x1316a6){var _0x3608ad=_0x1316a6[_0x0f72('0x2d')],_0x3ae32d=_0x400893['offset'],_0x3f77e2=_0x400893[_0x0f72('0x2e')]+_0x400893[_0x0f72('0x2f')],_0x4077aa;if(_0x3f77e2>=_0x3608ad){_0x3f77e2=_0x3608ad;_0x4077aa=0xc8;}else{_0x4077aa=0xce;}_0x22695c[_0x0f72('0x2a')](_0x4077aa);return _0x22695c[_0x0f72('0x30')](_0x0f72('0x31'),_0x3ae32d+'-'+_0x3f77e2+'/'+_0x3608ad)['json'](_0x1316a6);}return null;};}function patchUpdates(_0x4999f0){return function(_0x411785){try{jsonpatch[_0x0f72('0x32')](_0x411785,_0x4999f0,!![]);}catch(_0x25da2f){return BPromise[_0x0f72('0x33')](_0x25da2f);}return _0x411785['save']();};}function saveUpdates(_0xa14ddb,_0xd91595){return function(_0x12c540){if(_0x12c540){return _0x12c540[_0x0f72('0x34')](_0xa14ddb)[_0x0f72('0x35')](function(_0x519406){return _0x519406;});}return null;};}function removeEntity(_0x1bada0,_0x831c8a){return function(_0x4fc745){if(_0x4fc745){return _0x4fc745[_0x0f72('0x36')]()[_0x0f72('0x35')](function(){_0x1bada0[_0x0f72('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15de0,_0x5f0b13){return function(_0x43adf0){if(!_0x43adf0){_0x15de0[_0x0f72('0x29')](0x194);}return _0x43adf0;};}function handleError(_0x3cc414,_0xab732a){_0xab732a=_0xab732a||0x1f4;return function(_0x5f1ed2){logger[_0x0f72('0x24')](_0x5f1ed2[_0x0f72('0x37')]);if(_0x5f1ed2[_0x0f72('0x38')]){delete _0x5f1ed2['name'];}_0x3cc414[_0x0f72('0x2a')](_0xab732a)[_0x0f72('0x39')](_0x5f1ed2);};}exports[_0x0f72('0x3a')]=function(_0x5b051d,_0x20c69c){var _0xb86059={},_0x3f5cd7={},_0x17c275={'count':0x0,'rows':[]};var _0x3f8029=_['map'](db[_0x0f72('0x3b')][_0x0f72('0x3c')],function(_0x302dc3){return{'name':_0x302dc3['fieldName'],'type':_0x302dc3[_0x0f72('0x3d')][_0x0f72('0x3e')]};});_0x3f5cd7[_0x0f72('0x3f')]=_[_0x0f72('0x40')](_0x3f8029,'name');_0x3f5cd7['query']=_[_0x0f72('0x41')](_0x5b051d[_0x0f72('0x42')]);_0x3f5cd7[_0x0f72('0x43')]=_['intersection'](_0x3f5cd7[_0x0f72('0x3f')],_0x3f5cd7[_0x0f72('0x42')]);_0xb86059[_0x0f72('0x44')]=_[_0x0f72('0x45')](_0x3f5cd7[_0x0f72('0x3f')],qs[_0x0f72('0x46')](_0x5b051d['query'][_0x0f72('0x46')]));_0xb86059[_0x0f72('0x44')]=_0xb86059['attributes'][_0x0f72('0x47')]?_0xb86059[_0x0f72('0x44')]:_0x3f5cd7['model'];if(!_0x5b051d[_0x0f72('0x42')][_0x0f72('0x48')](_0x0f72('0x49'))){_0xb86059['limit']=qs[_0x0f72('0x2f')](_0x5b051d[_0x0f72('0x42')]['limit']);_0xb86059[_0x0f72('0x2e')]=qs[_0x0f72('0x2e')](_0x5b051d[_0x0f72('0x42')]['offset']);}_0xb86059[_0x0f72('0x4a')]=qs[_0x0f72('0x4b')](_0x5b051d['query'][_0x0f72('0x4b')]);_0xb86059[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_['pick'](_0x5b051d['query'],_0x3f5cd7[_0x0f72('0x43')]),_0x3f8029);if(_0x5b051d['query']['filter']){_0xb86059['where']=_[_0x0f72('0x4d')](_0xb86059[_0x0f72('0x4c')],{'$or':_[_0x0f72('0x40')](_0x3f8029,function(_0x343a56){if(_0x343a56[_0x0f72('0x3d')]!==_0x0f72('0x4e')){var _0x507395={};_0x507395[_0x343a56[_0x0f72('0x38')]]={'$like':'%'+_0x5b051d[_0x0f72('0x42')][_0x0f72('0x4f')]+'%'};return _0x507395;}})});}_0xb86059=_[_0x0f72('0x4d')]({},_0xb86059,_0x5b051d[_0x0f72('0x50')]);var _0x198b5f={'where':_0xb86059[_0x0f72('0x4c')]};return db[_0x0f72('0x3b')][_0x0f72('0x2d')](_0x198b5f)[_0x0f72('0x35')](function(_0x27d1be){_0x17c275['count']=_0x27d1be;if(_0x5b051d[_0x0f72('0x42')]['includeAll']){_0xb86059[_0x0f72('0x51')]=[{'all':!![]}];}return db[_0x0f72('0x3b')][_0x0f72('0x52')](_0xb86059);})[_0x0f72('0x35')](function(_0x169a5a){_0x17c275[_0x0f72('0x53')]=_0x169a5a;return _0x17c275;})[_0x0f72('0x35')](respondWithFilteredResult(_0x20c69c,_0xb86059))[_0x0f72('0x28')](handleError(_0x20c69c,null));};exports[_0x0f72('0x54')]=function(_0x29be22,_0x58f216){var _0x573d8e={'raw':![],'where':{'id':_0x29be22['params']['id']}},_0x5b5620={};_0x5b5620['model']=_[_0x0f72('0x41')](db['FreshsalesConfiguration']['rawAttributes']);_0x5b5620[_0x0f72('0x42')]=_['keys'](_0x29be22['query']);_0x5b5620['filters']=_['intersection'](_0x5b5620[_0x0f72('0x3f')],_0x5b5620[_0x0f72('0x42')]);_0x573d8e[_0x0f72('0x44')]=_[_0x0f72('0x45')](_0x5b5620[_0x0f72('0x3f')],qs['fields'](_0x29be22[_0x0f72('0x42')][_0x0f72('0x46')]));_0x573d8e['attributes']=_0x573d8e['attributes'][_0x0f72('0x47')]?_0x573d8e[_0x0f72('0x44')]:_0x5b5620[_0x0f72('0x3f')];if(_0x29be22[_0x0f72('0x42')][_0x0f72('0x55')]){_0x573d8e['include']=[{'all':!![]}];}_0x573d8e=_[_0x0f72('0x4d')]({},_0x573d8e,_0x29be22['options']);return db[_0x0f72('0x3b')][_0x0f72('0x56')](_0x573d8e)['then'](handleEntityNotFound(_0x58f216,null))[_0x0f72('0x35')](respondWithResult(_0x58f216,null))[_0x0f72('0x28')](handleError(_0x58f216,null));};exports[_0x0f72('0x57')]=function(_0x556c3c,_0x227ae2){return db[_0x0f72('0x3b')]['create'](_0x556c3c['body'],{})['then'](respondWithResult(_0x227ae2,0xc9))[_0x0f72('0x28')](handleError(_0x227ae2,null));};exports[_0x0f72('0x34')]=function(_0x2d26a8,_0x3b12df){if(_0x2d26a8[_0x0f72('0x58')]['id']){delete _0x2d26a8['body']['id'];}return db[_0x0f72('0x3b')]['find']({'where':{'id':_0x2d26a8[_0x0f72('0x59')]['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x3b12df,null))[_0x0f72('0x35')](saveUpdates(_0x2d26a8[_0x0f72('0x58')],null))[_0x0f72('0x35')](respondWithResult(_0x3b12df,null))[_0x0f72('0x28')](handleError(_0x3b12df,null));};exports[_0x0f72('0x36')]=function(_0x5ab526,_0x555c21){return db['FreshsalesConfiguration'][_0x0f72('0x56')]({'where':{'id':_0x5ab526['params']['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x555c21,null))[_0x0f72('0x35')](removeEntity(_0x555c21,null))[_0x0f72('0x28')](handleError(_0x555c21,null));};exports[_0x0f72('0x5a')]=function(_0x380168,_0x5dd058,_0x131413){var _0x2ef177={};var _0x3dd5f1={};var _0x1f4d33;var _0xf60326;return db['FreshsalesConfiguration'][_0x0f72('0x5b')]({'where':{'id':_0x380168[_0x0f72('0x59')]['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x5dd058,null))[_0x0f72('0x35')](function(_0x4492ae){if(_0x4492ae){_0x1f4d33=_0x4492ae;_0x3dd5f1[_0x0f72('0x3f')]=_[_0x0f72('0x41')](db[_0x0f72('0x5c')][_0x0f72('0x3c')]);_0x3dd5f1['query']=_[_0x0f72('0x41')](_0x380168['query']);_0x3dd5f1[_0x0f72('0x43')]=_['intersection'](_0x3dd5f1[_0x0f72('0x3f')],_0x3dd5f1[_0x0f72('0x42')]);_0x2ef177[_0x0f72('0x44')]=_[_0x0f72('0x45')](_0x3dd5f1[_0x0f72('0x3f')],qs[_0x0f72('0x46')](_0x380168['query']['fields']));_0x2ef177[_0x0f72('0x44')]=_0x2ef177[_0x0f72('0x44')][_0x0f72('0x47')]?_0x2ef177[_0x0f72('0x44')]:_0x3dd5f1[_0x0f72('0x3f')];_0x2ef177['order']=qs[_0x0f72('0x4b')](_0x380168[_0x0f72('0x42')][_0x0f72('0x4b')]);_0x2ef177[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_[_0x0f72('0x5d')](_0x380168[_0x0f72('0x42')],_0x3dd5f1[_0x0f72('0x43')]));if(_0x380168[_0x0f72('0x42')]['filter']){_0x2ef177[_0x0f72('0x4c')]=_[_0x0f72('0x4d')](_0x2ef177[_0x0f72('0x4c')],{'$or':_['map'](_0x2ef177['attributes'],function(_0x33032a){var _0x53be05={};_0x53be05[_0x33032a]={'$like':'%'+_0x380168[_0x0f72('0x42')][_0x0f72('0x4f')]+'%'};return _0x53be05;})});}_0x2ef177=_[_0x0f72('0x4d')]({},_0x2ef177,_0x380168['options']);return _0x1f4d33[_0x0f72('0x5a')](_0x2ef177);}})[_0x0f72('0x35')](function(_0x5af345){if(_0x5af345){_0xf60326=_0x5af345[_0x0f72('0x47')];if(!_0x380168[_0x0f72('0x42')][_0x0f72('0x48')](_0x0f72('0x49'))){_0x2ef177[_0x0f72('0x2f')]=qs[_0x0f72('0x2f')](_0x380168['query']['limit']);_0x2ef177[_0x0f72('0x2e')]=qs['offset'](_0x380168[_0x0f72('0x42')][_0x0f72('0x2e')]);}return _0x1f4d33[_0x0f72('0x5a')](_0x2ef177);}})[_0x0f72('0x35')](function(_0x2176cb){if(_0x2176cb){return _0x2176cb?{'count':_0xf60326,'rows':_0x2176cb}:null;}})[_0x0f72('0x35')](respondWithResult(_0x5dd058,null))[_0x0f72('0x28')](handleError(_0x5dd058,null));};exports[_0x0f72('0x5e')]=function(_0x58ae22,_0x69947a,_0x3f186b){var _0x269c05={};var _0xd23596={};var _0x2212e7;var _0x646c8a;return db[_0x0f72('0x3b')][_0x0f72('0x5b')]({'where':{'id':_0x58ae22['params']['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x69947a,null))['then'](function(_0x4ff713){if(_0x4ff713){_0x2212e7=_0x4ff713;_0xd23596['model']=_[_0x0f72('0x41')](db[_0x0f72('0x5c')][_0x0f72('0x3c')]);_0xd23596[_0x0f72('0x42')]=_['keys'](_0x58ae22[_0x0f72('0x42')]);_0xd23596[_0x0f72('0x43')]=_['intersection'](_0xd23596['model'],_0xd23596[_0x0f72('0x42')]);_0x269c05['attributes']=_[_0x0f72('0x45')](_0xd23596[_0x0f72('0x3f')],qs[_0x0f72('0x46')](_0x58ae22[_0x0f72('0x42')]['fields']));_0x269c05[_0x0f72('0x44')]=_0x269c05[_0x0f72('0x44')]['length']?_0x269c05['attributes']:_0xd23596[_0x0f72('0x3f')];_0x269c05[_0x0f72('0x4a')]=qs[_0x0f72('0x4b')](_0x58ae22['query'][_0x0f72('0x4b')]);_0x269c05[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_['pick'](_0x58ae22[_0x0f72('0x42')],_0xd23596[_0x0f72('0x43')]));if(_0x58ae22[_0x0f72('0x42')][_0x0f72('0x4f')]){_0x269c05[_0x0f72('0x4c')]=_[_0x0f72('0x4d')](_0x269c05[_0x0f72('0x4c')],{'$or':_['map'](_0x269c05['attributes'],function(_0x4fb8b8){var _0x37fb85={};_0x37fb85[_0x4fb8b8]={'$like':'%'+_0x58ae22[_0x0f72('0x42')][_0x0f72('0x4f')]+'%'};return _0x37fb85;})});}_0x269c05=_[_0x0f72('0x4d')]({},_0x269c05,_0x58ae22[_0x0f72('0x50')]);return _0x2212e7[_0x0f72('0x5e')](_0x269c05);}})['then'](function(_0x56facf){if(_0x56facf){_0x646c8a=_0x56facf[_0x0f72('0x47')];if(!_0x58ae22[_0x0f72('0x42')]['hasOwnProperty']('nolimit')){_0x269c05[_0x0f72('0x2f')]=qs['limit'](_0x58ae22['query'][_0x0f72('0x2f')]);_0x269c05[_0x0f72('0x2e')]=qs['offset'](_0x58ae22[_0x0f72('0x42')][_0x0f72('0x2e')]);}return _0x2212e7['getDescriptions'](_0x269c05);}})[_0x0f72('0x35')](function(_0x4fc6e4){if(_0x4fc6e4){return _0x4fc6e4?{'count':_0x646c8a,'rows':_0x4fc6e4}:null;}})[_0x0f72('0x35')](respondWithResult(_0x69947a,null))[_0x0f72('0x28')](handleError(_0x69947a,null));};exports[_0x0f72('0x5f')]=function(_0x22e2d3,_0x36f406,_0x18ab3b){var _0x21eb32={};var _0x1a22bf={};var _0x368c6e;var _0x3c0ede;return db[_0x0f72('0x3b')][_0x0f72('0x5b')]({'where':{'id':_0x22e2d3[_0x0f72('0x59')]['id']}})[_0x0f72('0x35')](handleEntityNotFound(_0x36f406,null))['then'](function(_0x40e1ff){if(_0x40e1ff){_0x368c6e=_0x40e1ff;_0x1a22bf[_0x0f72('0x3f')]=_[_0x0f72('0x41')](db[_0x0f72('0x5c')][_0x0f72('0x3c')]);_0x1a22bf[_0x0f72('0x42')]=_[_0x0f72('0x41')](_0x22e2d3[_0x0f72('0x42')]);_0x1a22bf[_0x0f72('0x43')]=_[_0x0f72('0x45')](_0x1a22bf[_0x0f72('0x3f')],_0x1a22bf['query']);_0x21eb32[_0x0f72('0x44')]=_['intersection'](_0x1a22bf[_0x0f72('0x3f')],qs['fields'](_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x46')]));_0x21eb32['attributes']=_0x21eb32['attributes'][_0x0f72('0x47')]?_0x21eb32['attributes']:_0x1a22bf[_0x0f72('0x3f')];_0x21eb32['order']=qs[_0x0f72('0x4b')](_0x22e2d3[_0x0f72('0x42')]['sort']);_0x21eb32[_0x0f72('0x4c')]=qs[_0x0f72('0x43')](_[_0x0f72('0x5d')](_0x22e2d3['query'],_0x1a22bf[_0x0f72('0x43')]));if(_0x22e2d3['query'][_0x0f72('0x4f')]){_0x21eb32[_0x0f72('0x4c')]=_[_0x0f72('0x4d')](_0x21eb32['where'],{'$or':_[_0x0f72('0x40')](_0x21eb32[_0x0f72('0x44')],function(_0x5b0fe4){var _0x53a8e5={};_0x53a8e5[_0x5b0fe4]={'$like':'%'+_0x22e2d3['query'][_0x0f72('0x4f')]+'%'};return _0x53a8e5;})});}_0x21eb32=_[_0x0f72('0x4d')]({},_0x21eb32,_0x22e2d3[_0x0f72('0x50')]);return _0x368c6e[_0x0f72('0x5f')](_0x21eb32);}})[_0x0f72('0x35')](function(_0x5584fc){if(_0x5584fc){_0x3c0ede=_0x5584fc[_0x0f72('0x47')];if(!_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x48')](_0x0f72('0x49'))){_0x21eb32[_0x0f72('0x2f')]=qs[_0x0f72('0x2f')](_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x2f')]);_0x21eb32['offset']=qs[_0x0f72('0x2e')](_0x22e2d3[_0x0f72('0x42')][_0x0f72('0x2e')]);}return _0x368c6e[_0x0f72('0x5f')](_0x21eb32);}})['then'](function(_0x1050ff){if(_0x1050ff){return _0x1050ff?{'count':_0x3c0ede,'rows':_0x1050ff}:null;}})[_0x0f72('0x35')](respondWithResult(_0x36f406,null))['catch'](handleError(_0x36f406,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1d0b02f..195d1c1 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 _0x6bea=['path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash','../../config/logger','moment','request-promise'];(function(_0x58cced,_0x37d2cd){var _0x49a8d2=function(_0x60b56a){while(--_0x60b56a){_0x58cced['push'](_0x58cced['shift']());}};_0x49a8d2(++_0x37d2cd);}(_0x6bea,0x149));var _0xa6be=function(_0x3b0c8e,_0x35e752){_0x3b0c8e=_0x3b0c8e-0x0;var _0x57fdee=_0x6bea[_0x3b0c8e];return _0x57fdee;};'use strict';var _=require(_0xa6be('0x0'));var util=require('util');var logger=require(_0xa6be('0x1'))('api');var moment=require(_0xa6be('0x2'));var BPromise=require('bluebird');var rp=require(_0xa6be('0x3'));var fs=require('fs');var path=require(_0xa6be('0x4'));var rimraf=require('rimraf');var config=require(_0xa6be('0x5'));var attributes=require(_0xa6be('0x6'));module[_0xa6be('0x7')]=function(_0x4a528d,_0x20e4da){return _0x4a528d['define']('FreshsalesConfiguration',attributes,{'tableName':_0xa6be('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a44=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a44,0x17b));var _0x45a4=function(_0x2ed90a,_0x456af3){_0x2ed90a=_0x2ed90a-0x0;var _0x51f786=_0x5a44[_0x2ed90a];return _0x51f786;};'use strict';var _=require(_0x45a4('0x0'));var util=require('util');var logger=require(_0x45a4('0x1'))(_0x45a4('0x2'));var moment=require(_0x45a4('0x3'));var BPromise=require(_0x45a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45a4('0x5'));var rimraf=require(_0x45a4('0x6'));var config=require(_0x45a4('0x7'));var attributes=require(_0x45a4('0x8'));module[_0x45a4('0x9')]=function(_0x468f6d,_0x417006){return _0x468f6d[_0x45a4('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x45a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 16250a1..3ddf9e0 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 _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x16d2,0x123));var _0x216d=function(_0x209f41,_0x10d7c3){_0x209f41=_0x209f41-0x0;var _0x323b6f=_0x16d2[_0x209f41];return _0x323b6f;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});} \ No newline at end of file +var _0xdf79=['stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xdf79,0xa7));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9df7('0x0'));var BPromise=require(_0x9df7('0x1'));var rs=require(_0x9df7('0x2'));var fs=require('fs');var Redis=require(_0x9df7('0x3'));var db=require(_0x9df7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9df7('0x5'));var client=jayson[_0x9df7('0x6')][_0x9df7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39f3c2,_0x5cf73b,_0x21d177){return new BPromise(function(_0x4cc7d5,_0x1663c8){return client['request'](_0x39f3c2,_0x21d177)[_0x9df7('0x8')](function(_0x1d86ed){logger[_0x9df7('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5cf73b,_0x9df7('0xa'));logger[_0x9df7('0xb')](_0x9df7('0xc'),_0x5cf73b,'request\x20sent',JSON[_0x9df7('0xd')](_0x1d86ed));if(_0x1d86ed[_0x9df7('0xe')]){if(_0x1d86ed[_0x9df7('0xe')][_0x9df7('0xf')]===0x1f4){logger[_0x9df7('0xe')](_0x9df7('0x10'),_0x5cf73b,_0x1d86ed[_0x9df7('0xe')][_0x9df7('0x11')]);return _0x1663c8(_0x1d86ed[_0x9df7('0xe')][_0x9df7('0x11')]);}logger[_0x9df7('0xe')](_0x9df7('0x10'),_0x5cf73b,_0x1d86ed['error']['message']);return _0x4cc7d5(_0x1d86ed[_0x9df7('0xe')][_0x9df7('0x11')]);}else{logger[_0x9df7('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5cf73b,_0x9df7('0xa'));_0x4cc7d5(_0x1d86ed['result']['message']);}})['catch'](function(_0x47241b){logger[_0x9df7('0xe')](_0x9df7('0x10'),_0x5cf73b,_0x47241b);_0x1663c8(_0x47241b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c3f6892..0add123 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 _0x0458=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4942aa,_0xd6e51){var _0x1f3fac=function(_0x2987f9){while(--_0x2987f9){_0x4942aa['push'](_0x4942aa['shift']());}};_0x1f3fac(++_0xd6e51);}(_0x0458,0x12e));var _0x8045=function(_0x7d818f,_0x58f761){_0x7d818f=_0x7d818f-0x0;var _0x5d2cee=_0x0458[_0x7d818f];return _0x5d2cee;};'use strict';var multer=require(_0x8045('0x0'));var util=require(_0x8045('0x1'));var path=require(_0x8045('0x2'));var timeout=require(_0x8045('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8045('0x4'));var config=require(_0x8045('0x5'));var controller=require(_0x8045('0x6'));router[_0x8045('0x7')]('/',auth[_0x8045('0x8')](),controller[_0x8045('0x9')]);router[_0x8045('0x7')](_0x8045('0xa'),auth[_0x8045('0x8')](),controller[_0x8045('0xb')]);router[_0x8045('0xc')]('/',auth[_0x8045('0x8')](),controller[_0x8045('0xd')]);router[_0x8045('0xe')](_0x8045('0xa'),auth[_0x8045('0x8')](),controller['update']);router['delete'](_0x8045('0xa'),auth[_0x8045('0x8')](),controller[_0x8045('0xf')]);module[_0x8045('0x10')]=router; \ No newline at end of file +var _0xd369=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','create','put','/:id','update','delete','exports','multer'];(function(_0x577b0,_0x5721ff){var _0x2c2060=function(_0x58c5cc){while(--_0x58c5cc){_0x577b0['push'](_0x577b0['shift']());}};_0x2c2060(++_0x5721ff);}(_0xd369,0x1a8));var _0x9d36=function(_0x49ecfc,_0x165580){_0x49ecfc=_0x49ecfc-0x0;var _0x219944=_0xd369[_0x49ecfc];return _0x219944;};'use strict';var multer=require(_0x9d36('0x0'));var util=require(_0x9d36('0x1'));var path=require('path');var timeout=require(_0x9d36('0x2'));var express=require(_0x9d36('0x3'));var router=express[_0x9d36('0x4')]();var auth=require(_0x9d36('0x5'));var interaction=require(_0x9d36('0x6'));var config=require(_0x9d36('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x9d36('0x8')](),controller[_0x9d36('0x9')]);router[_0x9d36('0xa')]('/:id',auth[_0x9d36('0x8')](),controller['show']);router['post']('/',auth[_0x9d36('0x8')](),controller[_0x9d36('0xb')]);router[_0x9d36('0xc')](_0x9d36('0xd'),auth['isAuthenticated'](),controller[_0x9d36('0xe')]);router[_0x9d36('0xf')]('/:id',auth[_0x9d36('0x8')](),controller['destroy']);module[_0x9d36('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 451d703..909ef53 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 _0xe0da=['string','customVariable','ENUM','STRING','BOOLEAN','sequelize','exports'];(function(_0x4b0d6c,_0x207221){var _0x1be295=function(_0x46048a){while(--_0x46048a){_0x4b0d6c['push'](_0x4b0d6c['shift']());}};_0x1be295(++_0x207221);}(_0xe0da,0xd0));var _0xae0d=function(_0x4df36b,_0x34c82e){_0x4df36b=_0x4df36b-0x0;var _0x31abaa=_0xe0da[_0x4df36b];return _0x31abaa;};'use strict';var Sequelize=require(_0xae0d('0x0'));module[_0xae0d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xae0d('0x2'),'variable',_0xae0d('0x3'),'keyValue'),'defaultValue':_0xae0d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xae0d('0x4')](_0xae0d('0x2'),'variable',_0xae0d('0x3'))},'keyContent':{'type':Sequelize[_0xae0d('0x5')]},'idField':{'type':Sequelize[_0xae0d('0x5')]},'nameField':{'type':Sequelize[_0xae0d('0x5')]},'customField':{'type':Sequelize[_0xae0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae0d('0x5')]}}; \ No newline at end of file +var _0x66cf=['string','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x4519e5,_0x22c44b){var _0x10e4f9=function(_0x2a2106){while(--_0x2a2106){_0x4519e5['push'](_0x4519e5['shift']());}};_0x10e4f9(++_0x22c44b);}(_0x66cf,0x1a2));var _0xf66c=function(_0x1ab6da,_0x1b2a2b){_0x1ab6da=_0x1ab6da-0x0;var _0x12cc6a=_0x66cf[_0x1ab6da];return _0x12cc6a;};'use strict';var Sequelize=require(_0xf66c('0x0'));module['exports']={'type':{'type':Sequelize[_0xf66c('0x1')](_0xf66c('0x2'),'variable',_0xf66c('0x3'),_0xf66c('0x4')),'defaultValue':_0xf66c('0x2')},'content':{'type':Sequelize[_0xf66c('0x5')]},'key':{'type':Sequelize[_0xf66c('0x5')]},'keyType':{'type':Sequelize[_0xf66c('0x1')](_0xf66c('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf66c('0x5')]},'idField':{'type':Sequelize[_0xf66c('0x5')]},'nameField':{'type':Sequelize[_0xf66c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c6cde01..fb74140 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 _0xe955=['../../config/logger','../../config/utils','../../config/environment','status','end','count','offset','Content-Range','apply','update','then','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','FreshsalesField','includeAll','include','findAll','rows','params','keys','find','create','body','catch','html-pdf','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2d719c,_0x59b346){var _0x16c7e8=function(_0x2cd5a8){while(--_0x2cd5a8){_0x2d719c['push'](_0x2d719c['shift']());}};_0x16c7e8(++_0x59b346);}(_0xe955,0x150));var _0x5e95=function(_0x4b5133,_0x30dfca){_0x4b5133=_0x4b5133-0x0;var _0x415ac4=_0xe955[_0x4b5133];return _0x415ac4;};'use strict';var pdf=require(_0x5e95('0x0'));var emlformat=require(_0x5e95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e95('0x2'));var jsonpatch=require(_0x5e95('0x3'));var rp=require(_0x5e95('0x4'));var moment=require(_0x5e95('0x5'));var BPromise=require(_0x5e95('0x6'));var Mustache=require(_0x5e95('0x7'));var util=require(_0x5e95('0x8'));var path=require(_0x5e95('0x9'));var sox=require(_0x5e95('0xa'));var csv=require(_0x5e95('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e95('0xc'));var squel=require(_0x5e95('0xd'));var crypto=require(_0x5e95('0xe'));var jsforce=require(_0x5e95('0xf'));var deskjs=require(_0x5e95('0x10'));var toCsv=require(_0x5e95('0xb'));var querystring=require(_0x5e95('0x11'));var Papa=require(_0x5e95('0x12'));var Redis=require(_0x5e95('0x13'));var authService=require(_0x5e95('0x14'));var qs=require(_0x5e95('0x15'));var as=require(_0x5e95('0x16'));var hardwareService=require(_0x5e95('0x17'));var logger=require(_0x5e95('0x18'))('api');var utils=require(_0x5e95('0x19'));var config=require(_0x5e95('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4074eb,_0x3cb638){_0x3cb638=_0x3cb638||0xcc;return function(_0x2051e0){if(_0x2051e0){return _0x4074eb['sendStatus'](_0x3cb638);}return _0x4074eb[_0x5e95('0x1b')](_0x3cb638)[_0x5e95('0x1c')]();};}function respondWithResult(_0x4cec65,_0x2ba4d3){_0x2ba4d3=_0x2ba4d3||0xc8;return function(_0x474578){if(_0x474578){return _0x4cec65[_0x5e95('0x1b')](_0x2ba4d3)['json'](_0x474578);}};}function respondWithFilteredResult(_0x2cc79b,_0x2e93e5){return function(_0x53ca7b){if(_0x53ca7b){var _0x4b85bd=_0x53ca7b[_0x5e95('0x1d')],_0x8ec118=_0x2e93e5[_0x5e95('0x1e')],_0x1c462d=_0x2e93e5[_0x5e95('0x1e')]+_0x2e93e5['limit'],_0x52c014;if(_0x1c462d>=_0x4b85bd){_0x1c462d=_0x4b85bd;_0x52c014=0xc8;}else{_0x52c014=0xce;}_0x2cc79b[_0x5e95('0x1b')](_0x52c014);return _0x2cc79b['set'](_0x5e95('0x1f'),_0x8ec118+'-'+_0x1c462d+'/'+_0x4b85bd)['json'](_0x53ca7b);}return null;};}function patchUpdates(_0x25a1aa){return function(_0x85a799){try{jsonpatch[_0x5e95('0x20')](_0x85a799,_0x25a1aa,!![]);}catch(_0x5ae8a4){return BPromise['reject'](_0x5ae8a4);}return _0x85a799['save']();};}function saveUpdates(_0x10917f,_0x316228){return function(_0x456e30){if(_0x456e30){return _0x456e30[_0x5e95('0x21')](_0x10917f)[_0x5e95('0x22')](function(_0x444374){return _0x444374;});}return null;};}function removeEntity(_0x53bba3,_0x5e9838){return function(_0x5a21f9){if(_0x5a21f9){return _0x5a21f9[_0x5e95('0x23')]()[_0x5e95('0x22')](function(){_0x53bba3[_0x5e95('0x1b')](0xcc)[_0x5e95('0x1c')]();});}};}function handleEntityNotFound(_0x38f3db,_0xead2fe){return function(_0x26891d){if(!_0x26891d){_0x38f3db[_0x5e95('0x24')](0x194);}return _0x26891d;};}function handleError(_0x2ccfb2,_0x18e5fb){_0x18e5fb=_0x18e5fb||0x1f4;return function(_0xbecdcc){logger[_0x5e95('0x25')](_0xbecdcc[_0x5e95('0x26')]);if(_0xbecdcc['name']){delete _0xbecdcc['name'];}_0x2ccfb2[_0x5e95('0x1b')](_0x18e5fb)[_0x5e95('0x27')](_0xbecdcc);};}exports[_0x5e95('0x28')]=function(_0x133013,_0x2dd7d1){var _0x53bcfc={},_0x25da6f={},_0x1228dc={'count':0x0,'rows':[]};var _0x3b9f68=_['map'](db['FreshsalesField'][_0x5e95('0x29')],function(_0x563fb8){return{'name':_0x563fb8[_0x5e95('0x2a')],'type':_0x563fb8[_0x5e95('0x2b')][_0x5e95('0x2c')]};});_0x25da6f[_0x5e95('0x2d')]=_[_0x5e95('0x2e')](_0x3b9f68,_0x5e95('0x2f'));_0x25da6f[_0x5e95('0x30')]=_['keys'](_0x133013[_0x5e95('0x30')]);_0x25da6f[_0x5e95('0x31')]=_['intersection'](_0x25da6f[_0x5e95('0x2d')],_0x25da6f['query']);_0x53bcfc[_0x5e95('0x32')]=_[_0x5e95('0x33')](_0x25da6f[_0x5e95('0x2d')],qs['fields'](_0x133013[_0x5e95('0x30')][_0x5e95('0x34')]));_0x53bcfc['attributes']=_0x53bcfc[_0x5e95('0x32')][_0x5e95('0x35')]?_0x53bcfc[_0x5e95('0x32')]:_0x25da6f[_0x5e95('0x2d')];if(!_0x133013[_0x5e95('0x30')][_0x5e95('0x36')]('nolimit')){_0x53bcfc[_0x5e95('0x37')]=qs[_0x5e95('0x37')](_0x133013[_0x5e95('0x30')][_0x5e95('0x37')]);_0x53bcfc[_0x5e95('0x1e')]=qs[_0x5e95('0x1e')](_0x133013[_0x5e95('0x30')][_0x5e95('0x1e')]);}_0x53bcfc[_0x5e95('0x38')]=qs['sort'](_0x133013['query'][_0x5e95('0x39')]);_0x53bcfc[_0x5e95('0x3a')]=qs[_0x5e95('0x31')](_['pick'](_0x133013[_0x5e95('0x30')],_0x25da6f['filters']),_0x3b9f68);if(_0x133013['query'][_0x5e95('0x3b')]){_0x53bcfc[_0x5e95('0x3a')]=_[_0x5e95('0x3c')](_0x53bcfc[_0x5e95('0x3a')],{'$or':_[_0x5e95('0x2e')](_0x3b9f68,function(_0xe0722d){if(_0xe0722d[_0x5e95('0x2b')]!=='VIRTUAL'){var _0x139c80={};_0x139c80[_0xe0722d[_0x5e95('0x2f')]]={'$like':'%'+_0x133013['query'][_0x5e95('0x3b')]+'%'};return _0x139c80;}})});}_0x53bcfc=_[_0x5e95('0x3c')]({},_0x53bcfc,_0x133013['options']);var _0x393304={'where':_0x53bcfc[_0x5e95('0x3a')]};return db[_0x5e95('0x3d')]['count'](_0x393304)[_0x5e95('0x22')](function(_0x2839fe){_0x1228dc[_0x5e95('0x1d')]=_0x2839fe;if(_0x133013[_0x5e95('0x30')][_0x5e95('0x3e')]){_0x53bcfc[_0x5e95('0x3f')]=[{'all':!![]}];}return db[_0x5e95('0x3d')][_0x5e95('0x40')](_0x53bcfc);})[_0x5e95('0x22')](function(_0x2bf0ea){_0x1228dc[_0x5e95('0x41')]=_0x2bf0ea;return _0x1228dc;})[_0x5e95('0x22')](respondWithFilteredResult(_0x2dd7d1,_0x53bcfc))['catch'](handleError(_0x2dd7d1,null));};exports['show']=function(_0x396cb3,_0xc992a5){var _0x14bf26={'raw':!![],'where':{'id':_0x396cb3[_0x5e95('0x42')]['id']}},_0x4a5a9d={};_0x4a5a9d[_0x5e95('0x2d')]=_[_0x5e95('0x43')](db['FreshsalesField'][_0x5e95('0x29')]);_0x4a5a9d[_0x5e95('0x30')]=_[_0x5e95('0x43')](_0x396cb3[_0x5e95('0x30')]);_0x4a5a9d['filters']=_[_0x5e95('0x33')](_0x4a5a9d[_0x5e95('0x2d')],_0x4a5a9d[_0x5e95('0x30')]);_0x14bf26[_0x5e95('0x32')]=_['intersection'](_0x4a5a9d[_0x5e95('0x2d')],qs[_0x5e95('0x34')](_0x396cb3[_0x5e95('0x30')]['fields']));_0x14bf26[_0x5e95('0x32')]=_0x14bf26[_0x5e95('0x32')][_0x5e95('0x35')]?_0x14bf26['attributes']:_0x4a5a9d[_0x5e95('0x2d')];if(_0x396cb3[_0x5e95('0x30')][_0x5e95('0x3e')]){_0x14bf26[_0x5e95('0x3f')]=[{'all':!![]}];}_0x14bf26=_[_0x5e95('0x3c')]({},_0x14bf26,_0x396cb3['options']);return db[_0x5e95('0x3d')][_0x5e95('0x44')](_0x14bf26)[_0x5e95('0x22')](handleEntityNotFound(_0xc992a5,null))['then'](respondWithResult(_0xc992a5,null))['catch'](handleError(_0xc992a5,null));};exports[_0x5e95('0x45')]=function(_0x2ab55e,_0x4cc8f1){return db[_0x5e95('0x3d')]['create'](_0x2ab55e[_0x5e95('0x46')],{})[_0x5e95('0x22')](respondWithResult(_0x4cc8f1,0xc9))[_0x5e95('0x47')](handleError(_0x4cc8f1,null));};exports[_0x5e95('0x21')]=function(_0x291a60,_0x1db2b8){if(_0x291a60[_0x5e95('0x46')]['id']){delete _0x291a60[_0x5e95('0x46')]['id'];}return db[_0x5e95('0x3d')][_0x5e95('0x44')]({'where':{'id':_0x291a60['params']['id']}})[_0x5e95('0x22')](handleEntityNotFound(_0x1db2b8,null))[_0x5e95('0x22')](saveUpdates(_0x291a60['body'],null))[_0x5e95('0x22')](respondWithResult(_0x1db2b8,null))[_0x5e95('0x47')](handleError(_0x1db2b8,null));};exports[_0x5e95('0x23')]=function(_0x156ae6,_0x17cda7){return db['FreshsalesField']['find']({'where':{'id':_0x156ae6[_0x5e95('0x42')]['id']}})[_0x5e95('0x22')](handleEntityNotFound(_0x17cda7,null))[_0x5e95('0x22')](removeEntity(_0x17cda7,null))[_0x5e95('0x47')](handleError(_0x17cda7,null));}; \ No newline at end of file +var _0x79b7=['includeAll','include','catch','show','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','FreshsalesField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x550a09,_0x54b8dc){var _0x4ca9cd=function(_0x233661){while(--_0x233661){_0x550a09['push'](_0x550a09['shift']());}};_0x4ca9cd(++_0x54b8dc);}(_0x79b7,0x131));var _0x779b=function(_0x26072b,_0x377151){_0x26072b=_0x26072b-0x0;var _0x3afa1f=_0x79b7[_0x26072b];return _0x3afa1f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x779b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x779b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x779b('0x2'));var moment=require(_0x779b('0x3'));var BPromise=require(_0x779b('0x4'));var Mustache=require(_0x779b('0x5'));var util=require(_0x779b('0x6'));var path=require(_0x779b('0x7'));var sox=require(_0x779b('0x8'));var csv=require('to-csv');var ejs=require(_0x779b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x779b('0xa'));var crypto=require(_0x779b('0xb'));var jsforce=require(_0x779b('0xc'));var deskjs=require(_0x779b('0xd'));var toCsv=require(_0x779b('0xe'));var querystring=require(_0x779b('0xf'));var Papa=require(_0x779b('0x10'));var Redis=require(_0x779b('0x11'));var authService=require(_0x779b('0x12'));var qs=require(_0x779b('0x13'));var as=require(_0x779b('0x14'));var hardwareService=require(_0x779b('0x15'));var logger=require(_0x779b('0x16'))('api');var utils=require(_0x779b('0x17'));var config=require(_0x779b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f83f9,_0x221f26){_0x221f26=_0x221f26||0xcc;return function(_0x54504b){if(_0x54504b){return _0x1f83f9[_0x779b('0x19')](_0x221f26);}return _0x1f83f9[_0x779b('0x1a')](_0x221f26)[_0x779b('0x1b')]();};}function respondWithResult(_0x15c824,_0x1a28b6){_0x1a28b6=_0x1a28b6||0xc8;return function(_0x315aa3){if(_0x315aa3){return _0x15c824[_0x779b('0x1a')](_0x1a28b6)[_0x779b('0x1c')](_0x315aa3);}};}function respondWithFilteredResult(_0x534b7b,_0x523a34){return function(_0x451cab){if(_0x451cab){var _0x5e8fdd=_0x451cab[_0x779b('0x1d')],_0x20fdbc=_0x523a34['offset'],_0x4180af=_0x523a34[_0x779b('0x1e')]+_0x523a34[_0x779b('0x1f')],_0x1fb9cd;if(_0x4180af>=_0x5e8fdd){_0x4180af=_0x5e8fdd;_0x1fb9cd=0xc8;}else{_0x1fb9cd=0xce;}_0x534b7b[_0x779b('0x1a')](_0x1fb9cd);return _0x534b7b[_0x779b('0x20')](_0x779b('0x21'),_0x20fdbc+'-'+_0x4180af+'/'+_0x5e8fdd)[_0x779b('0x1c')](_0x451cab);}return null;};}function patchUpdates(_0x2338f9){return function(_0x2a8135){try{jsonpatch[_0x779b('0x22')](_0x2a8135,_0x2338f9,!![]);}catch(_0x425e12){return BPromise['reject'](_0x425e12);}return _0x2a8135[_0x779b('0x23')]();};}function saveUpdates(_0x4c1779,_0x2ba291){return function(_0x2a0833){if(_0x2a0833){return _0x2a0833[_0x779b('0x24')](_0x4c1779)['then'](function(_0x3ef096){return _0x3ef096;});}return null;};}function removeEntity(_0x5c8d29,_0x5b956c){return function(_0x1b6b4c){if(_0x1b6b4c){return _0x1b6b4c[_0x779b('0x25')]()[_0x779b('0x26')](function(){_0x5c8d29[_0x779b('0x1a')](0xcc)[_0x779b('0x1b')]();});}};}function handleEntityNotFound(_0x1a8896,_0x1eee36){return function(_0x12cab3){if(!_0x12cab3){_0x1a8896['sendStatus'](0x194);}return _0x12cab3;};}function handleError(_0x126d19,_0x20dc2c){_0x20dc2c=_0x20dc2c||0x1f4;return function(_0x4d0d31){logger[_0x779b('0x27')](_0x4d0d31['stack']);if(_0x4d0d31[_0x779b('0x28')]){delete _0x4d0d31[_0x779b('0x28')];}_0x126d19[_0x779b('0x1a')](_0x20dc2c)[_0x779b('0x29')](_0x4d0d31);};}exports[_0x779b('0x2a')]=function(_0x37df42,_0x270d33){var _0x1a29b2={},_0x33e240={},_0x539b5a={'count':0x0,'rows':[]};var _0x34662d=_['map'](db[_0x779b('0x2b')]['rawAttributes'],function(_0x481a6f){return{'name':_0x481a6f[_0x779b('0x2c')],'type':_0x481a6f[_0x779b('0x2d')][_0x779b('0x2e')]};});_0x33e240[_0x779b('0x2f')]=_[_0x779b('0x30')](_0x34662d,_0x779b('0x28'));_0x33e240[_0x779b('0x31')]=_[_0x779b('0x32')](_0x37df42['query']);_0x33e240[_0x779b('0x33')]=_[_0x779b('0x34')](_0x33e240[_0x779b('0x2f')],_0x33e240[_0x779b('0x31')]);_0x1a29b2[_0x779b('0x35')]=_['intersection'](_0x33e240['model'],qs[_0x779b('0x36')](_0x37df42[_0x779b('0x31')]['fields']));_0x1a29b2[_0x779b('0x35')]=_0x1a29b2[_0x779b('0x35')]['length']?_0x1a29b2[_0x779b('0x35')]:_0x33e240[_0x779b('0x2f')];if(!_0x37df42[_0x779b('0x31')][_0x779b('0x37')](_0x779b('0x38'))){_0x1a29b2[_0x779b('0x1f')]=qs[_0x779b('0x1f')](_0x37df42[_0x779b('0x31')][_0x779b('0x1f')]);_0x1a29b2[_0x779b('0x1e')]=qs[_0x779b('0x1e')](_0x37df42[_0x779b('0x31')][_0x779b('0x1e')]);}_0x1a29b2[_0x779b('0x39')]=qs[_0x779b('0x3a')](_0x37df42[_0x779b('0x31')][_0x779b('0x3a')]);_0x1a29b2[_0x779b('0x3b')]=qs['filters'](_[_0x779b('0x3c')](_0x37df42['query'],_0x33e240[_0x779b('0x33')]),_0x34662d);if(_0x37df42[_0x779b('0x31')]['filter']){_0x1a29b2[_0x779b('0x3b')]=_[_0x779b('0x3d')](_0x1a29b2[_0x779b('0x3b')],{'$or':_[_0x779b('0x30')](_0x34662d,function(_0x16c748){if(_0x16c748[_0x779b('0x2d')]!==_0x779b('0x3e')){var _0x2b6138={};_0x2b6138[_0x16c748[_0x779b('0x28')]]={'$like':'%'+_0x37df42['query'][_0x779b('0x3f')]+'%'};return _0x2b6138;}})});}_0x1a29b2=_[_0x779b('0x3d')]({},_0x1a29b2,_0x37df42[_0x779b('0x40')]);var _0x344252={'where':_0x1a29b2['where']};return db[_0x779b('0x2b')]['count'](_0x344252)[_0x779b('0x26')](function(_0x3c245d){_0x539b5a[_0x779b('0x1d')]=_0x3c245d;if(_0x37df42['query'][_0x779b('0x41')]){_0x1a29b2[_0x779b('0x42')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x1a29b2);})[_0x779b('0x26')](function(_0x13258c){_0x539b5a['rows']=_0x13258c;return _0x539b5a;})[_0x779b('0x26')](respondWithFilteredResult(_0x270d33,_0x1a29b2))[_0x779b('0x43')](handleError(_0x270d33,null));};exports[_0x779b('0x44')]=function(_0x4a5e25,_0x1af27b){var _0x3d67f1={'raw':!![],'where':{'id':_0x4a5e25[_0x779b('0x45')]['id']}},_0xfdb76e={};_0xfdb76e['model']=_[_0x779b('0x32')](db[_0x779b('0x2b')]['rawAttributes']);_0xfdb76e[_0x779b('0x31')]=_[_0x779b('0x32')](_0x4a5e25[_0x779b('0x31')]);_0xfdb76e[_0x779b('0x33')]=_['intersection'](_0xfdb76e[_0x779b('0x2f')],_0xfdb76e[_0x779b('0x31')]);_0x3d67f1[_0x779b('0x35')]=_[_0x779b('0x34')](_0xfdb76e[_0x779b('0x2f')],qs['fields'](_0x4a5e25[_0x779b('0x31')][_0x779b('0x36')]));_0x3d67f1['attributes']=_0x3d67f1[_0x779b('0x35')][_0x779b('0x46')]?_0x3d67f1[_0x779b('0x35')]:_0xfdb76e[_0x779b('0x2f')];if(_0x4a5e25['query'][_0x779b('0x41')]){_0x3d67f1['include']=[{'all':!![]}];}_0x3d67f1=_[_0x779b('0x3d')]({},_0x3d67f1,_0x4a5e25[_0x779b('0x40')]);return db['FreshsalesField'][_0x779b('0x47')](_0x3d67f1)[_0x779b('0x26')](handleEntityNotFound(_0x1af27b,null))[_0x779b('0x26')](respondWithResult(_0x1af27b,null))[_0x779b('0x43')](handleError(_0x1af27b,null));};exports[_0x779b('0x48')]=function(_0x190a0f,_0x38efca){return db[_0x779b('0x2b')][_0x779b('0x48')](_0x190a0f[_0x779b('0x49')],{})[_0x779b('0x26')](respondWithResult(_0x38efca,0xc9))[_0x779b('0x43')](handleError(_0x38efca,null));};exports[_0x779b('0x24')]=function(_0x4b5016,_0x567872){if(_0x4b5016[_0x779b('0x49')]['id']){delete _0x4b5016[_0x779b('0x49')]['id'];}return db[_0x779b('0x2b')]['find']({'where':{'id':_0x4b5016[_0x779b('0x45')]['id']}})[_0x779b('0x26')](handleEntityNotFound(_0x567872,null))['then'](saveUpdates(_0x4b5016[_0x779b('0x49')],null))[_0x779b('0x26')](respondWithResult(_0x567872,null))['catch'](handleError(_0x567872,null));};exports[_0x779b('0x25')]=function(_0x3ef526,_0x2209a9){return db['FreshsalesField'][_0x779b('0x47')]({'where':{'id':_0x3ef526[_0x779b('0x45')]['id']}})[_0x779b('0x26')](handleEntityNotFound(_0x2209a9,null))[_0x779b('0x26')](removeEntity(_0x2209a9,null))[_0x779b('0x43')](handleError(_0x2209a9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 49dfc35..7c09ea1 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 _0x426f=['util','../../config/logger','api','bluebird','request-promise','rimraf','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField','FieldId','lodash'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x426f,0x77));var _0xf426=function(_0x3f097c,_0x32f99f){_0x3f097c=_0x3f097c-0x0;var _0x524678=_0x426f[_0x3f097c];return _0x524678;};'use strict';var _=require(_0xf426('0x0'));var util=require(_0xf426('0x1'));var logger=require(_0xf426('0x2'))(_0xf426('0x3'));var moment=require('moment');var BPromise=require(_0xf426('0x4'));var rp=require(_0xf426('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf426('0x6'));var config=require('../../config/environment');var attributes=require(_0xf426('0x7'));module[_0xf426('0x8')]=function(_0x5a003a,_0x42d481){return _0x5a003a['define']('FreshsalesField',attributes,{'tableName':_0xf426('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf426('0xa'),_0xf426('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdda=['path','../../config/environment','./intFreshsalesField.attributes','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xfdda,0x156));var _0xafdd=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0xfdda[_0x5d9c37];return _0x1ba9eb;};'use strict';var _=require(_0xafdd('0x0'));var util=require(_0xafdd('0x1'));var logger=require(_0xafdd('0x2'))(_0xafdd('0x3'));var moment=require('moment');var BPromise=require(_0xafdd('0x4'));var rp=require(_0xafdd('0x5'));var fs=require('fs');var path=require(_0xafdd('0x6'));var rimraf=require('rimraf');var config=require(_0xafdd('0x7'));var attributes=require(_0xafdd('0x8'));module['exports']=function(_0x18ac12,_0x523597){return _0x18ac12['define']('FreshsalesField',attributes,{'tableName':_0xafdd('0x9'),'paranoid':![],'indexes':[{'name':_0xafdd('0xa'),'fields':['idField',_0xafdd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 8148adc..2b05c75 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 _0xb1a5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb1a5,0x1cd));var _0x5b1a=function(_0x1ca9e2,_0x1508b0){_0x1ca9e2=_0x1ca9e2-0x0;var _0x15996c=_0xb1a5[_0x1ca9e2];return _0x15996c;};'use strict';var _=require(_0x5b1a('0x0'));var util=require('util');var moment=require(_0x5b1a('0x1'));var BPromise=require(_0x5b1a('0x2'));var rs=require(_0x5b1a('0x3'));var fs=require('fs');var Redis=require(_0x5b1a('0x4'));var db=require(_0x5b1a('0x5'))['db'];var utils=require(_0x5b1a('0x6'));var logger=require(_0x5b1a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5b1a('0x8'));var client=jayson[_0x5b1a('0x9')][_0x5b1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20ecde,_0x55786e,_0x137a15){return new BPromise(function(_0x3dfb03,_0x2fda43){return client[_0x5b1a('0xb')](_0x20ecde,_0x137a15)['then'](function(_0x474505){logger[_0x5b1a('0xc')](_0x5b1a('0xd'),_0x55786e,'request\x20sent');logger[_0x5b1a('0xe')](_0x5b1a('0xf'),_0x55786e,_0x5b1a('0x10'),JSON[_0x5b1a('0x11')](_0x474505));if(_0x474505[_0x5b1a('0x12')]){if(_0x474505[_0x5b1a('0x12')][_0x5b1a('0x13')]===0x1f4){logger['error'](_0x5b1a('0xd'),_0x55786e,_0x474505['error'][_0x5b1a('0x14')]);return _0x2fda43(_0x474505['error'][_0x5b1a('0x14')]);}logger[_0x5b1a('0x12')](_0x5b1a('0xd'),_0x55786e,_0x474505['error'][_0x5b1a('0x14')]);return _0x3dfb03(_0x474505[_0x5b1a('0x12')][_0x5b1a('0x14')]);}else{logger[_0x5b1a('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x55786e,_0x5b1a('0x10'));_0x3dfb03(_0x474505['result']['message']);}})['catch'](function(_0x48ec6d){logger[_0x5b1a('0x12')](_0x5b1a('0xd'),_0x55786e,_0x48ec6d);_0x2fda43(_0x48ec6d);});});} \ No newline at end of file +var _0x35f9=['client','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xe74694,_0x45838e){var _0x1bab95=function(_0xf6f063){while(--_0xf6f063){_0xe74694['push'](_0xe74694['shift']());}};_0x1bab95(++_0x45838e);}(_0x35f9,0x1d7));var _0x935f=function(_0x26231c,_0x2a572b){_0x26231c=_0x26231c-0x0;var _0x5b4937=_0x35f9[_0x26231c];return _0x5b4937;};'use strict';var _=require(_0x935f('0x0'));var util=require('util');var moment=require(_0x935f('0x1'));var BPromise=require(_0x935f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x935f('0x3'));var db=require(_0x935f('0x4'))['db'];var utils=require(_0x935f('0x5'));var logger=require(_0x935f('0x6'))(_0x935f('0x7'));var config=require('../../config/environment');var jayson=require(_0x935f('0x8'));var client=jayson[_0x935f('0x9')][_0x935f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59cc63,_0x355b1a,_0x23683f){return new BPromise(function(_0x51a9f8,_0x3c92bb){return client['request'](_0x59cc63,_0x23683f)[_0x935f('0xb')](function(_0x532564){logger['info'](_0x935f('0xc'),_0x355b1a,_0x935f('0xd'));logger['debug'](_0x935f('0xe'),_0x355b1a,_0x935f('0xd'),JSON[_0x935f('0xf')](_0x532564));if(_0x532564[_0x935f('0x10')]){if(_0x532564[_0x935f('0x10')][_0x935f('0x11')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x355b1a,_0x532564[_0x935f('0x10')][_0x935f('0x12')]);return _0x3c92bb(_0x532564[_0x935f('0x10')][_0x935f('0x12')]);}logger[_0x935f('0x10')](_0x935f('0xc'),_0x355b1a,_0x532564[_0x935f('0x10')][_0x935f('0x12')]);return _0x51a9f8(_0x532564['error'][_0x935f('0x12')]);}else{logger['info'](_0x935f('0xc'),_0x355b1a,_0x935f('0xd'));_0x51a9f8(_0x532564['result'][_0x935f('0x12')]);}})[_0x935f('0x13')](function(_0x565882){logger[_0x935f('0x10')](_0x935f('0xc'),_0x355b1a,_0x565882);_0x3c92bb(_0x565882);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c816997..aaa7112 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 _0xcfab=['addConfiguration','put','delete','destroy','exports','multer','path','express','../../components/auth/service','./intSalesforceAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations'];(function(_0x52bed8,_0x28fae3){var _0x2ea74e=function(_0x459068){while(--_0x459068){_0x52bed8['push'](_0x52bed8['shift']());}};_0x2ea74e(++_0x28fae3);}(_0xcfab,0x1e0));var _0xbcfa=function(_0x14e754,_0x5eea21){_0x14e754=_0x14e754-0x0;var _0x9e18a1=_0xcfab[_0x14e754];return _0x9e18a1;};'use strict';var multer=require(_0xbcfa('0x0'));var util=require('util');var path=require(_0xbcfa('0x1'));var timeout=require('connect-timeout');var express=require(_0xbcfa('0x2'));var router=express['Router']();var auth=require(_0xbcfa('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbcfa('0x4'));router[_0xbcfa('0x5')]('/',auth[_0xbcfa('0x6')](),controller['index']);router[_0xbcfa('0x5')](_0xbcfa('0x7'),auth[_0xbcfa('0x6')](),controller[_0xbcfa('0x8')]);router['get']('/:id/configurations',auth[_0xbcfa('0x6')](),controller[_0xbcfa('0x9')]);router['get'](_0xbcfa('0xa'),auth['isAuthenticated'](),controller[_0xbcfa('0xb')]);router[_0xbcfa('0xc')]('/',auth[_0xbcfa('0x6')](),controller['create']);router[_0xbcfa('0xc')](_0xbcfa('0xd'),auth['isAuthenticated'](),controller[_0xbcfa('0xe')]);router[_0xbcfa('0xf')]('/:id',auth[_0xbcfa('0x6')](),controller['update']);router[_0xbcfa('0x10')](_0xbcfa('0x7'),auth[_0xbcfa('0x6')](),controller[_0xbcfa('0x11')]);module[_0xbcfa('0x12')]=router; \ No newline at end of file +var _0x83e0=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x83e0,0x1b0));var _0x083e=function(_0x567e1e,_0x247b98){_0x567e1e=_0x567e1e-0x0;var _0xae1bab=_0x83e0[_0x567e1e];return _0xae1bab;};'use strict';var multer=require(_0x083e('0x0'));var util=require('util');var path=require(_0x083e('0x1'));var timeout=require(_0x083e('0x2'));var express=require(_0x083e('0x3'));var router=express[_0x083e('0x4')]();var auth=require(_0x083e('0x5'));var interaction=require(_0x083e('0x6'));var config=require('../../config/environment');var controller=require(_0x083e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x083e('0x8')]);router['get'](_0x083e('0x9'),auth[_0x083e('0xa')](),controller[_0x083e('0xb')]);router[_0x083e('0xc')](_0x083e('0xd'),auth[_0x083e('0xa')](),controller[_0x083e('0xe')]);router[_0x083e('0xc')](_0x083e('0xf'),auth[_0x083e('0xa')](),controller[_0x083e('0x10')]);router[_0x083e('0x11')]('/',auth['isAuthenticated'](),controller[_0x083e('0x12')]);router[_0x083e('0x11')](_0x083e('0xd'),auth[_0x083e('0xa')](),controller[_0x083e('0x13')]);router[_0x083e('0x14')]('/:id',auth[_0x083e('0xa')](),controller[_0x083e('0x15')]);router[_0x083e('0x16')](_0x083e('0x9'),auth[_0x083e('0xa')](),controller['destroy']);module[_0x083e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 2d4b356..5788dc8 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 _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file +var _0x1cb9=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x29fdb7,_0x37b629){var _0x3387e7=function(_0x3ee352){while(--_0x3ee352){_0x29fdb7['push'](_0x29fdb7['shift']());}};_0x3387e7(++_0x37b629);}(_0x1cb9,0x14e));var _0x91cb=function(_0x18b548,_0x531de3){_0x18b548=_0x18b548-0x0;var _0x89de38=_0x1cb9[_0x18b548];return _0x89de38;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')]},'description':{'type':Sequelize[_0x91cb('0x1')]},'username':{'type':Sequelize[_0x91cb('0x1')],'unique':_0x91cb('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x91cb('0x1')]},'clientId':{'type':Sequelize[_0x91cb('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x91cb('0x1')]},'serverUrl':{'type':Sequelize[_0x91cb('0x1')]},'type':{'type':Sequelize[_0x91cb('0x3')](_0x91cb('0x4'),_0x91cb('0x5')),'defaultValue':_0x91cb('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a509cf3..42b4718 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 _0x725a=['test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','merge','filter','count','includeAll','include','SalesforceAccount','findAll','show','params','options','find','create','body','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','Descriptions','channel','SalesforceField','getFields','Task','clientSecret','password','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','username','concat','securityToken','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Status','Type','Case','Origin','Reason','Priority','IsEscalated','remove','label','custom','picklistValues','value','boolean','True','false','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http'];(function(_0xf0cb1e,_0x56f865){var _0x3819d9=function(_0x530548){while(--_0x530548){_0xf0cb1e['push'](_0xf0cb1e['shift']());}};_0x3819d9(++_0x56f865);}(_0x725a,0x17e));var _0xa725=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x725a[_0x4851ff];return _0x26773b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa725('0x0'));var zipdir=require(_0xa725('0x1'));var jsonpatch=require(_0xa725('0x2'));var rp=require(_0xa725('0x3'));var moment=require(_0xa725('0x4'));var BPromise=require(_0xa725('0x5'));var Mustache=require(_0xa725('0x6'));var util=require('util');var path=require(_0xa725('0x7'));var sox=require(_0xa725('0x8'));var csv=require('to-csv');var ejs=require(_0xa725('0x9'));var fs=require('fs');var _=require(_0xa725('0xa'));var squel=require(_0xa725('0xb'));var crypto=require(_0xa725('0xc'));var jsforce=require(_0xa725('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa725('0xe'));var Papa=require('papaparse');var Redis=require(_0xa725('0xf'));var authService=require(_0xa725('0x10'));var qs=require(_0xa725('0x11'));var as=require(_0xa725('0x12'));var hardwareService=require(_0xa725('0x13'));var logger=require('../../config/logger')(_0xa725('0x14'));var utils=require('../../config/utils');var config=require(_0xa725('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa725('0x16'));var jayson=require(_0xa725('0x17'));var client=jayson[_0xa725('0x18')][_0xa725('0x19')]({'port':0x232a});function checkPasswordPattern(_0x22e94f,_0x4946d4,_0x1a5701){if(_0x1a5701){var _0x569751=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x569751[_0xa725('0x1a')](_0x4946d4)){return _0x22e94f;}else{throw new db[(_0xa725('0x1b'))][(_0xa725('0x1c'))](_0xa725('0x1d'));}}else{return _0x22e94f;}}function respondWithRpcPromise(_0x9f934b,_0x4e6502,_0x31da58,_0x3a7524){return new BPromise(function(_0x18475f,_0x45007a){var _0x2b8d73=_0x3a7524||client;return _0x2b8d73[_0xa725('0x1e')](_0x9f934b,_0x31da58)[_0xa725('0x1f')](function(_0x3d5846){logger[_0xa725('0x20')](_0xa725('0x21'),_0x4e6502,_0xa725('0x22'));logger[_0xa725('0x23')](_0xa725('0x24'),_0x4e6502,_0xa725('0x22'),JSON[_0xa725('0x25')](_0x3d5846));if(_0x3d5846[_0xa725('0x26')]){if(_0x3d5846[_0xa725('0x26')][_0xa725('0x27')]===0x1f4){logger[_0xa725('0x26')](_0xa725('0x21'),_0x4e6502,_0x3d5846[_0xa725('0x26')][_0xa725('0x28')]);return _0x45007a(_0x3d5846[_0xa725('0x26')][_0xa725('0x28')]);}logger['error'](_0xa725('0x21'),_0x4e6502,_0x3d5846['error'][_0xa725('0x28')]);return _0x18475f(_0x3d5846[_0xa725('0x26')]['message']);}else{logger['info'](_0xa725('0x21'),_0x4e6502,_0xa725('0x22'));_0x18475f(_0x3d5846[_0xa725('0x29')][_0xa725('0x28')]);}})[_0xa725('0x2a')](function(_0x388184){logger[_0xa725('0x26')](_0xa725('0x21'),_0x4e6502,_0x388184);_0x45007a(_0x388184);});});}function respondWithStatusCode(_0x5092f7,_0x2f7d79){_0x2f7d79=_0x2f7d79||0xcc;return function(_0x4d7998){if(_0x4d7998){return _0x5092f7[_0xa725('0x2b')](_0x2f7d79);}return _0x5092f7['status'](_0x2f7d79)[_0xa725('0x2c')]();};}function respondWithResult(_0x4dfdf5,_0x207ee5){_0x207ee5=_0x207ee5||0xc8;return function(_0x43270c){if(_0x43270c){return _0x4dfdf5[_0xa725('0x2d')](_0x207ee5)[_0xa725('0x2e')](_0x43270c);}};}function respondWithFilteredResult(_0x56672f,_0x2b539b){return function(_0x1e9d6e){if(_0x1e9d6e){var _0x9d2908=_0x1e9d6e['count'],_0x410a3c=_0x2b539b[_0xa725('0x2f')],_0x32e306=_0x2b539b[_0xa725('0x2f')]+_0x2b539b['limit'],_0x113157;if(_0x32e306>=_0x9d2908){_0x32e306=_0x9d2908;_0x113157=0xc8;}else{_0x113157=0xce;}_0x56672f[_0xa725('0x2d')](_0x113157);return _0x56672f[_0xa725('0x30')](_0xa725('0x31'),_0x410a3c+'-'+_0x32e306+'/'+_0x9d2908)['json'](_0x1e9d6e);}return null;};}function patchUpdates(_0x3b5e49){return function(_0x50f6ab){try{jsonpatch[_0xa725('0x32')](_0x50f6ab,_0x3b5e49,!![]);}catch(_0x521d89){return BPromise[_0xa725('0x33')](_0x521d89);}return _0x50f6ab[_0xa725('0x34')]();};}function saveUpdates(_0x44322a,_0x406ce8){return function(_0x33f5a7){if(_0x33f5a7){return _0x33f5a7[_0xa725('0x35')](_0x44322a)['then'](function(_0x2ebe39){return _0x2ebe39;});}return null;};}function removeEntity(_0x179900,_0x497dc7){return function(_0x16b931){if(_0x16b931){return _0x16b931[_0xa725('0x36')]()[_0xa725('0x1f')](function(){_0x179900[_0xa725('0x2d')](0xcc)[_0xa725('0x2c')]();});}};}function handleEntityNotFound(_0x95d09f,_0x5051ae){return function(_0x49ef99){if(!_0x49ef99){_0x95d09f[_0xa725('0x2b')](0x194);}return _0x49ef99;};}function handleError(_0x2803b,_0x4a539f){_0x4a539f=_0x4a539f||0x1f4;return function(_0x2c0d2b){logger[_0xa725('0x26')](_0x2c0d2b['stack']);if(_0x2c0d2b[_0xa725('0x37')]){delete _0x2c0d2b[_0xa725('0x37')];}_0x2803b[_0xa725('0x2d')](_0x4a539f)[_0xa725('0x38')](_0x2c0d2b);};}exports[_0xa725('0x39')]=function(_0x34e5d5,_0x1eb096){var _0x414c73={},_0x5e63b7={},_0x365041={'count':0x0,'rows':[]};var _0x8b2a1e=_['map'](db['SalesforceAccount'][_0xa725('0x3a')],function(_0x408a8f){return{'name':_0x408a8f['fieldName'],'type':_0x408a8f[_0xa725('0x3b')]['key']};});_0x5e63b7[_0xa725('0x3c')]=_[_0xa725('0x3d')](_0x8b2a1e,_0xa725('0x37'));_0x5e63b7[_0xa725('0x3e')]=_[_0xa725('0x3f')](_0x34e5d5[_0xa725('0x3e')]);_0x5e63b7[_0xa725('0x40')]=_['intersection'](_0x5e63b7[_0xa725('0x3c')],_0x5e63b7[_0xa725('0x3e')]);_0x414c73[_0xa725('0x41')]=_[_0xa725('0x42')](_0x5e63b7['model'],qs[_0xa725('0x43')](_0x34e5d5[_0xa725('0x3e')][_0xa725('0x43')]));_0x414c73['attributes']=_0x414c73[_0xa725('0x41')][_0xa725('0x44')]?_0x414c73[_0xa725('0x41')]:_0x5e63b7[_0xa725('0x3c')];if(!_0x34e5d5[_0xa725('0x3e')]['hasOwnProperty']('nolimit')){_0x414c73[_0xa725('0x45')]=qs['limit'](_0x34e5d5[_0xa725('0x3e')][_0xa725('0x45')]);_0x414c73[_0xa725('0x2f')]=qs[_0xa725('0x2f')](_0x34e5d5['query'][_0xa725('0x2f')]);}_0x414c73[_0xa725('0x46')]=qs[_0xa725('0x47')](_0x34e5d5['query'][_0xa725('0x47')]);_0x414c73[_0xa725('0x48')]=qs[_0xa725('0x40')](_[_0xa725('0x49')](_0x34e5d5[_0xa725('0x3e')],_0x5e63b7[_0xa725('0x40')]),_0x8b2a1e);if(_0x34e5d5['query']['filter']){_0x414c73[_0xa725('0x48')]=_[_0xa725('0x4a')](_0x414c73['where'],{'$or':_[_0xa725('0x3d')](_0x8b2a1e,function(_0x52d348){if(_0x52d348[_0xa725('0x3b')]!=='VIRTUAL'){var _0x9225e={};_0x9225e[_0x52d348[_0xa725('0x37')]]={'$like':'%'+_0x34e5d5[_0xa725('0x3e')][_0xa725('0x4b')]+'%'};return _0x9225e;}})});}_0x414c73=_['merge']({},_0x414c73,_0x34e5d5['options']);var _0x305e99={'where':_0x414c73['where']};return db['SalesforceAccount'][_0xa725('0x4c')](_0x305e99)[_0xa725('0x1f')](function(_0x2e5de5){_0x365041[_0xa725('0x4c')]=_0x2e5de5;if(_0x34e5d5[_0xa725('0x3e')][_0xa725('0x4d')]){_0x414c73[_0xa725('0x4e')]=[{'all':!![]}];}return db[_0xa725('0x4f')][_0xa725('0x50')](_0x414c73);})['then'](function(_0x3f97b5){_0x365041['rows']=_0x3f97b5;return _0x365041;})[_0xa725('0x1f')](respondWithFilteredResult(_0x1eb096,_0x414c73))['catch'](handleError(_0x1eb096,null));};exports[_0xa725('0x51')]=function(_0x392569,_0x31f142){var _0x17d095={'raw':![],'where':{'id':_0x392569[_0xa725('0x52')]['id']}},_0x241e42={};_0x241e42['model']=_[_0xa725('0x3f')](db['SalesforceAccount'][_0xa725('0x3a')]);_0x241e42[_0xa725('0x3e')]=_[_0xa725('0x3f')](_0x392569['query']);_0x241e42[_0xa725('0x40')]=_[_0xa725('0x42')](_0x241e42[_0xa725('0x3c')],_0x241e42[_0xa725('0x3e')]);_0x17d095[_0xa725('0x41')]=_[_0xa725('0x42')](_0x241e42['model'],qs[_0xa725('0x43')](_0x392569[_0xa725('0x3e')]['fields']));_0x17d095[_0xa725('0x41')]=_0x17d095[_0xa725('0x41')][_0xa725('0x44')]?_0x17d095['attributes']:_0x241e42[_0xa725('0x3c')];if(_0x392569[_0xa725('0x3e')]['includeAll']){_0x17d095['include']=[{'all':!![]}];}_0x17d095=_[_0xa725('0x4a')]({},_0x17d095,_0x392569[_0xa725('0x53')]);return db[_0xa725('0x4f')][_0xa725('0x54')](_0x17d095)[_0xa725('0x1f')](handleEntityNotFound(_0x31f142,null))[_0xa725('0x1f')](respondWithResult(_0x31f142,null))[_0xa725('0x2a')](handleError(_0x31f142,null));};exports[_0xa725('0x55')]=function(_0x2f020d,_0x46cd25){return db[_0xa725('0x4f')]['create'](_0x2f020d[_0xa725('0x56')],{})['then'](respondWithResult(_0x46cd25,0xc9))[_0xa725('0x2a')](handleError(_0x46cd25,null));};exports[_0xa725('0x35')]=function(_0x77afd2,_0x597692){if(_0x77afd2['body']['id']){delete _0x77afd2['body']['id'];}return db['SalesforceAccount'][_0xa725('0x54')]({'where':{'id':_0x77afd2[_0xa725('0x52')]['id']}})[_0xa725('0x1f')](handleEntityNotFound(_0x597692,null))['then'](saveUpdates(_0x77afd2[_0xa725('0x56')],null))['then'](respondWithResult(_0x597692,null))[_0xa725('0x2a')](handleError(_0x597692,null));};exports['destroy']=function(_0x597e93,_0x3e9ab5){return db['SalesforceAccount'][_0xa725('0x54')]({'where':{'id':_0x597e93['params']['id']}})[_0xa725('0x1f')](handleEntityNotFound(_0x3e9ab5,null))[_0xa725('0x1f')](removeEntity(_0x3e9ab5,null))[_0xa725('0x2a')](handleError(_0x3e9ab5,null));};exports[_0xa725('0x57')]=function(_0xcbdd49,_0x5095f2,_0x435f4d){var _0xd7617f={};var _0x180bbb={};var _0x16356a;var _0x5b5093;return db[_0xa725('0x4f')]['findOne']({'where':{'id':_0xcbdd49['params']['id']}})['then'](handleEntityNotFound(_0x5095f2,null))[_0xa725('0x1f')](function(_0x28c8ab){if(_0x28c8ab){_0x16356a=_0x28c8ab;_0x180bbb['model']=_[_0xa725('0x3f')](db[_0xa725('0x58')][_0xa725('0x3a')]);_0x180bbb['query']=_[_0xa725('0x3f')](_0xcbdd49[_0xa725('0x3e')]);_0x180bbb['filters']=_[_0xa725('0x42')](_0x180bbb[_0xa725('0x3c')],_0x180bbb['query']);_0xd7617f[_0xa725('0x41')]=_[_0xa725('0x42')](_0x180bbb[_0xa725('0x3c')],qs[_0xa725('0x43')](_0xcbdd49['query'][_0xa725('0x43')]));_0xd7617f[_0xa725('0x41')]=_0xd7617f[_0xa725('0x41')][_0xa725('0x44')]?_0xd7617f[_0xa725('0x41')]:_0x180bbb['model'];_0xd7617f[_0xa725('0x46')]=qs[_0xa725('0x47')](_0xcbdd49[_0xa725('0x3e')]['sort']);_0xd7617f[_0xa725('0x48')]=qs[_0xa725('0x40')](_['pick'](_0xcbdd49[_0xa725('0x3e')],_0x180bbb[_0xa725('0x40')]));if(_0xcbdd49[_0xa725('0x3e')][_0xa725('0x4b')]){_0xd7617f[_0xa725('0x48')]=_[_0xa725('0x4a')](_0xd7617f['where'],{'$or':_[_0xa725('0x3d')](_0xd7617f[_0xa725('0x41')],function(_0x406fe5){var _0x41ff54={};_0x41ff54[_0x406fe5]={'$like':'%'+_0xcbdd49[_0xa725('0x3e')][_0xa725('0x4b')]+'%'};return _0x41ff54;})});}_0xd7617f=_[_0xa725('0x4a')]({},_0xd7617f,_0xcbdd49['options']);return _0x16356a[_0xa725('0x57')](_0xd7617f);}})[_0xa725('0x1f')](function(_0x4cfa6f){if(_0x4cfa6f){_0x5b5093=_0x4cfa6f[_0xa725('0x44')];if(!_0xcbdd49['query'][_0xa725('0x59')]('nolimit')){_0xd7617f[_0xa725('0x45')]=qs[_0xa725('0x45')](_0xcbdd49[_0xa725('0x3e')][_0xa725('0x45')]);_0xd7617f[_0xa725('0x2f')]=qs[_0xa725('0x2f')](_0xcbdd49[_0xa725('0x3e')][_0xa725('0x2f')]);}return _0x16356a[_0xa725('0x57')](_0xd7617f);}})[_0xa725('0x1f')](function(_0x583644){if(_0x583644){return _0x583644?{'count':_0x5b5093,'rows':_0x583644}:null;}})[_0xa725('0x1f')](respondWithResult(_0x5095f2,null))['catch'](handleError(_0x5095f2,null));};exports[_0xa725('0x5a')]=function(_0x19adbb,_0x3f0b3a,_0x1d758b){if(_0x19adbb[_0xa725('0x56')]['id']){delete _0x19adbb[_0xa725('0x56')]['id'];}return db[_0xa725('0x4f')][_0xa725('0x5b')]({'where':{'id':_0x19adbb[_0xa725('0x52')]['id']}})[_0xa725('0x1f')](handleEntityNotFound(_0x3f0b3a,null))[_0xa725('0x1f')](function(_0x4cfcc3){if(_0x4cfcc3){_0x19adbb[_0xa725('0x56')][_0xa725('0x5c')]=_0x4cfcc3['id'];_0x19adbb[_0xa725('0x56')][_0xa725('0x5d')]=integrations['getSubjects'](_0x19adbb['body']['channel'],_0x19adbb[_0xa725('0x56')]['type']);_0x19adbb['body'][_0xa725('0x5e')]=integrations['getDescriptions'](_0x19adbb[_0xa725('0x56')][_0xa725('0x5f')],_0x19adbb[_0xa725('0x56')]['type']);return db['SalesforceConfiguration'][_0xa725('0x55')](_0x19adbb['body'],{'include':[{'model':db[_0xa725('0x60')],'as':_0xa725('0x5d')},{'model':db[_0xa725('0x60')],'as':_0xa725('0x5e')}]});}return null;})[_0xa725('0x1f')](respondWithResult(_0x3f0b3a,null))[_0xa725('0x2a')](handleError(_0x3f0b3a,null));};exports[_0xa725('0x61')]=function(_0x349b24,_0x233492,_0x5b2b7c){var _0x1de5ff;var _0x5dc24d='';var _0x5753dc=_0xa725('0x62');return db['SalesforceAccount'][_0xa725('0x5b')]({'where':{'id':_0x349b24[_0xa725('0x52')]['id']},'attributes':['id','remoteUri','clientId',_0xa725('0x63'),'username',_0xa725('0x64'),'securityToken']})['then'](handleEntityNotFound(_0x233492,null))['then'](function(_0x264395){if(_0x264395){_0x5dc24d=_0x264395[_0xa725('0x65')];var _0x556e8e=_0x5dc24d[_0xa725('0x66')](-0x1);if(_0x556e8e==='/'){_0x5dc24d=_0x5dc24d[_0xa725('0x67')](0x0,_0x5dc24d[_0xa725('0x68')](_0x556e8e));}_0x1de5ff=new jsforce[(_0xa725('0x69'))]({'oauth2':{'loginUrl':_0x5dc24d,'clientId':_0x264395[_0xa725('0x6a')],'clientSecret':_0x264395[_0xa725('0x63')]}});return _0x1de5ff[_0xa725('0x6b')](_0x264395[_0xa725('0x6c')],_0x264395['password'][_0xa725('0x6d')](_0x264395[_0xa725('0x6e')]));}})['then'](function(_0x266ba6){if(_0x266ba6){if(!_[_0xa725('0x6f')](_0x349b24['query'][_0xa725('0x70')])){_0x5753dc=_0x349b24[_0xa725('0x3e')]['ticketType'];}return _0x1de5ff[_0xa725('0x71')](_0x5753dc)[_0xa725('0x72')]();}})[_0xa725('0x1f')](function(_0x40388c){var _0x349f77=['CallDisposition',_0xa725('0x73'),_0xa725('0x74'),_0xa725('0x75'),_0xa725('0x76'),'Priority',_0xa725('0x77'),_0xa725('0x78')];if(!_['isNil'](_0x349b24[_0xa725('0x3e')][_0xa725('0x70')])&&_0x349b24[_0xa725('0x3e')]['ticketType']===_0xa725('0x79')){_0x349f77=['Type',_0xa725('0x7a'),_0xa725('0x7b'),'Status',_0xa725('0x7c'),_0xa725('0x7d'),'SuppliedName','SuppliedCompany'];}if(_0x40388c){_[_0xa725('0x7e')](_0x40388c[_0xa725('0x43')],function(_0x74f95f){return _0x74f95f['custom']===![]&&!_0x349f77['includes'](_0x74f95f[_0xa725('0x37')]);});return{'count':_0x40388c['fields'][_0xa725('0x44')],'rows':_['map'](_0x40388c[_0xa725('0x43')],function(_0xf71c5d){return{'id':_0xf71c5d['name'],'name':_0xf71c5d[_0xa725('0x7f')],'custom':_0xf71c5d[_0xa725('0x80')],'options':_0xf71c5d[_0xa725('0x81')][_0xa725('0x44')]>0x0?_[_0xa725('0x3d')](_0xf71c5d[_0xa725('0x81')],function(_0x13d4da){return{'name':_0x13d4da[_0xa725('0x7f')],'value':_0x13d4da[_0xa725('0x82')]};}):_0xf71c5d['type']==_0xa725('0x83')?[{'name':_0xa725('0x84'),'value':'true'},{'name':'False','value':_0xa725('0x85')}]:[]};})};}})[_0xa725('0x1f')](respondWithResult(_0x233492,null))[_0xa725('0x2a')](function(_0x30ce7b){var _0x4d106b=_0x349b24[_0xa725('0x3e')]['test']?0x1f4:_0x30ce7b[_0xa725('0x86')]||0x1f4;logger[_0xa725('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4d106b,JSON[_0xa725('0x25')](_0x30ce7b));delete _0x30ce7b[_0xa725('0x37')];if(_0x4d106b===0x191){_0x4d106b=0x190;}_0x233492['status'](_0x4d106b)['send'](_0x349b24[_0xa725('0x3e')][_0xa725('0x1a')]?{'message':_0xa725('0x87'),'statusCode':_0x30ce7b['statusCode']}:_0x30ce7b);});}; \ No newline at end of file +var _0x67ea=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','save','update','then','destroy','stack','name','send','map','SalesforceAccount','fieldName','type','key','model','query','intersection','fields','attributes','length','sort','filters','pick','filter','where','merge','includeAll','rows','show','params','keys','rawAttributes','include','find','create','body','findOne','order','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','password','securityToken','slice','login','username','concat','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Type','Origin','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x67ea,0x18d));var _0xa67e=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x67ea[_0x1dd82f];return _0x353ca4;};'use strict';var pdf=require(_0xa67e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa67e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa67e('0x2'));var moment=require(_0xa67e('0x3'));var BPromise=require(_0xa67e('0x4'));var Mustache=require(_0xa67e('0x5'));var util=require(_0xa67e('0x6'));var path=require(_0xa67e('0x7'));var sox=require(_0xa67e('0x8'));var csv=require('to-csv');var ejs=require(_0xa67e('0x9'));var fs=require('fs');var _=require(_0xa67e('0xa'));var squel=require(_0xa67e('0xb'));var crypto=require('crypto');var jsforce=require(_0xa67e('0xc'));var deskjs=require(_0xa67e('0xd'));var toCsv=require(_0xa67e('0xe'));var querystring=require(_0xa67e('0xf'));var Papa=require(_0xa67e('0x10'));var Redis=require(_0xa67e('0x11'));var authService=require(_0xa67e('0x12'));var qs=require(_0xa67e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67e('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa67e('0x15'));var db=require(_0xa67e('0x16'))['db'];var integrations=require(_0xa67e('0x17'));var jayson=require(_0xa67e('0x18'));var client=jayson['client'][_0xa67e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x489a7c,_0x3e264d,_0x37f4af){if(_0x37f4af){var _0xeaa4d9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xeaa4d9[_0xa67e('0x1a')](_0x3e264d)){return _0x489a7c;}else{throw new db[(_0xa67e('0x1b'))][(_0xa67e('0x1c'))](_0xa67e('0x1d'));}}else{return _0x489a7c;}}function respondWithRpcPromise(_0x45ef65,_0x5047dd,_0x3c82dd,_0x2aa5d6){return new BPromise(function(_0x252177,_0x294bc0){var _0x1222e5=_0x2aa5d6||client;return _0x1222e5[_0xa67e('0x1e')](_0x45ef65,_0x3c82dd)['then'](function(_0x1c0ff2){logger[_0xa67e('0x1f')](_0xa67e('0x20'),_0x5047dd,_0xa67e('0x21'));logger[_0xa67e('0x22')](_0xa67e('0x23'),_0x5047dd,'request\x20sent',JSON[_0xa67e('0x24')](_0x1c0ff2));if(_0x1c0ff2[_0xa67e('0x25')]){if(_0x1c0ff2[_0xa67e('0x25')][_0xa67e('0x26')]===0x1f4){logger['error'](_0xa67e('0x20'),_0x5047dd,_0x1c0ff2[_0xa67e('0x25')][_0xa67e('0x27')]);return _0x294bc0(_0x1c0ff2[_0xa67e('0x25')][_0xa67e('0x27')]);}logger[_0xa67e('0x25')]('SalesforceAccount,\x20%s,\x20%s',_0x5047dd,_0x1c0ff2['error']['message']);return _0x252177(_0x1c0ff2[_0xa67e('0x25')]['message']);}else{logger['info'](_0xa67e('0x20'),_0x5047dd,_0xa67e('0x21'));_0x252177(_0x1c0ff2[_0xa67e('0x28')][_0xa67e('0x27')]);}})[_0xa67e('0x29')](function(_0x596efb){logger[_0xa67e('0x25')](_0xa67e('0x20'),_0x5047dd,_0x596efb);_0x294bc0(_0x596efb);});});}function respondWithStatusCode(_0xf1b772,_0xfb39fe){_0xfb39fe=_0xfb39fe||0xcc;return function(_0x2472fb){if(_0x2472fb){return _0xf1b772[_0xa67e('0x2a')](_0xfb39fe);}return _0xf1b772[_0xa67e('0x2b')](_0xfb39fe)[_0xa67e('0x2c')]();};}function respondWithResult(_0x54b76e,_0x211130){_0x211130=_0x211130||0xc8;return function(_0x14ecdb){if(_0x14ecdb){return _0x54b76e['status'](_0x211130)[_0xa67e('0x2d')](_0x14ecdb);}};}function respondWithFilteredResult(_0x4a2dfe,_0x2ea80c){return function(_0x2f2ee9){if(_0x2f2ee9){var _0x275d7c=_0x2f2ee9[_0xa67e('0x2e')],_0x35d2ac=_0x2ea80c[_0xa67e('0x2f')],_0x17a241=_0x2ea80c['offset']+_0x2ea80c[_0xa67e('0x30')],_0x1d223d;if(_0x17a241>=_0x275d7c){_0x17a241=_0x275d7c;_0x1d223d=0xc8;}else{_0x1d223d=0xce;}_0x4a2dfe['status'](_0x1d223d);return _0x4a2dfe['set']('Content-Range',_0x35d2ac+'-'+_0x17a241+'/'+_0x275d7c)['json'](_0x2f2ee9);}return null;};}function patchUpdates(_0x4edbe2){return function(_0x32346b){try{jsonpatch['apply'](_0x32346b,_0x4edbe2,!![]);}catch(_0x17e1fe){return BPromise['reject'](_0x17e1fe);}return _0x32346b[_0xa67e('0x31')]();};}function saveUpdates(_0x5bd951,_0x138c9b){return function(_0x3f93a4){if(_0x3f93a4){return _0x3f93a4[_0xa67e('0x32')](_0x5bd951)[_0xa67e('0x33')](function(_0x306c6f){return _0x306c6f;});}return null;};}function removeEntity(_0x4dbc82,_0x4d847e){return function(_0x46bbe7){if(_0x46bbe7){return _0x46bbe7[_0xa67e('0x34')]()[_0xa67e('0x33')](function(){_0x4dbc82['status'](0xcc)[_0xa67e('0x2c')]();});}};}function handleEntityNotFound(_0x2c8641,_0x498c8e){return function(_0x408611){if(!_0x408611){_0x2c8641[_0xa67e('0x2a')](0x194);}return _0x408611;};}function handleError(_0x34fbac,_0x51f790){_0x51f790=_0x51f790||0x1f4;return function(_0x4fcd12){logger[_0xa67e('0x25')](_0x4fcd12[_0xa67e('0x35')]);if(_0x4fcd12['name']){delete _0x4fcd12[_0xa67e('0x36')];}_0x34fbac[_0xa67e('0x2b')](_0x51f790)[_0xa67e('0x37')](_0x4fcd12);};}exports['index']=function(_0x2ed4ec,_0x52f648){var _0x4b1872={},_0x5d0d17={},_0x3f917b={'count':0x0,'rows':[]};var _0x1769bb=_[_0xa67e('0x38')](db[_0xa67e('0x39')]['rawAttributes'],function(_0x40b23f){return{'name':_0x40b23f[_0xa67e('0x3a')],'type':_0x40b23f[_0xa67e('0x3b')][_0xa67e('0x3c')]};});_0x5d0d17[_0xa67e('0x3d')]=_[_0xa67e('0x38')](_0x1769bb,_0xa67e('0x36'));_0x5d0d17[_0xa67e('0x3e')]=_['keys'](_0x2ed4ec[_0xa67e('0x3e')]);_0x5d0d17['filters']=_[_0xa67e('0x3f')](_0x5d0d17['model'],_0x5d0d17[_0xa67e('0x3e')]);_0x4b1872['attributes']=_[_0xa67e('0x3f')](_0x5d0d17[_0xa67e('0x3d')],qs[_0xa67e('0x40')](_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x40')]));_0x4b1872[_0xa67e('0x41')]=_0x4b1872[_0xa67e('0x41')][_0xa67e('0x42')]?_0x4b1872[_0xa67e('0x41')]:_0x5d0d17[_0xa67e('0x3d')];if(!_0x2ed4ec[_0xa67e('0x3e')]['hasOwnProperty']('nolimit')){_0x4b1872['limit']=qs[_0xa67e('0x30')](_0x2ed4ec['query'][_0xa67e('0x30')]);_0x4b1872[_0xa67e('0x2f')]=qs[_0xa67e('0x2f')](_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x2f')]);}_0x4b1872['order']=qs[_0xa67e('0x43')](_0x2ed4ec['query'][_0xa67e('0x43')]);_0x4b1872['where']=qs[_0xa67e('0x44')](_[_0xa67e('0x45')](_0x2ed4ec[_0xa67e('0x3e')],_0x5d0d17[_0xa67e('0x44')]),_0x1769bb);if(_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x46')]){_0x4b1872[_0xa67e('0x47')]=_[_0xa67e('0x48')](_0x4b1872[_0xa67e('0x47')],{'$or':_[_0xa67e('0x38')](_0x1769bb,function(_0x381bad){if(_0x381bad[_0xa67e('0x3b')]!=='VIRTUAL'){var _0x343406={};_0x343406[_0x381bad[_0xa67e('0x36')]]={'$like':'%'+_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x46')]+'%'};return _0x343406;}})});}_0x4b1872=_[_0xa67e('0x48')]({},_0x4b1872,_0x2ed4ec['options']);var _0x3e63af={'where':_0x4b1872[_0xa67e('0x47')]};return db[_0xa67e('0x39')][_0xa67e('0x2e')](_0x3e63af)[_0xa67e('0x33')](function(_0x3bb131){_0x3f917b[_0xa67e('0x2e')]=_0x3bb131;if(_0x2ed4ec[_0xa67e('0x3e')][_0xa67e('0x49')]){_0x4b1872['include']=[{'all':!![]}];}return db[_0xa67e('0x39')]['findAll'](_0x4b1872);})[_0xa67e('0x33')](function(_0x16b218){_0x3f917b[_0xa67e('0x4a')]=_0x16b218;return _0x3f917b;})['then'](respondWithFilteredResult(_0x52f648,_0x4b1872))[_0xa67e('0x29')](handleError(_0x52f648,null));};exports[_0xa67e('0x4b')]=function(_0xe45d74,_0x15dee7){var _0x350492={'raw':![],'where':{'id':_0xe45d74[_0xa67e('0x4c')]['id']}},_0x1d8fcd={};_0x1d8fcd['model']=_[_0xa67e('0x4d')](db[_0xa67e('0x39')][_0xa67e('0x4e')]);_0x1d8fcd[_0xa67e('0x3e')]=_[_0xa67e('0x4d')](_0xe45d74[_0xa67e('0x3e')]);_0x1d8fcd[_0xa67e('0x44')]=_[_0xa67e('0x3f')](_0x1d8fcd[_0xa67e('0x3d')],_0x1d8fcd[_0xa67e('0x3e')]);_0x350492[_0xa67e('0x41')]=_[_0xa67e('0x3f')](_0x1d8fcd['model'],qs[_0xa67e('0x40')](_0xe45d74['query'][_0xa67e('0x40')]));_0x350492[_0xa67e('0x41')]=_0x350492[_0xa67e('0x41')][_0xa67e('0x42')]?_0x350492['attributes']:_0x1d8fcd[_0xa67e('0x3d')];if(_0xe45d74[_0xa67e('0x3e')][_0xa67e('0x49')]){_0x350492[_0xa67e('0x4f')]=[{'all':!![]}];}_0x350492=_[_0xa67e('0x48')]({},_0x350492,_0xe45d74['options']);return db['SalesforceAccount'][_0xa67e('0x50')](_0x350492)[_0xa67e('0x33')](handleEntityNotFound(_0x15dee7,null))[_0xa67e('0x33')](respondWithResult(_0x15dee7,null))[_0xa67e('0x29')](handleError(_0x15dee7,null));};exports['create']=function(_0x36454c,_0x264900){return db[_0xa67e('0x39')][_0xa67e('0x51')](_0x36454c[_0xa67e('0x52')],{})[_0xa67e('0x33')](respondWithResult(_0x264900,0xc9))[_0xa67e('0x29')](handleError(_0x264900,null));};exports['update']=function(_0x844780,_0x23d352){if(_0x844780[_0xa67e('0x52')]['id']){delete _0x844780['body']['id'];}return db[_0xa67e('0x39')][_0xa67e('0x50')]({'where':{'id':_0x844780[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x23d352,null))['then'](saveUpdates(_0x844780[_0xa67e('0x52')],null))[_0xa67e('0x33')](respondWithResult(_0x23d352,null))[_0xa67e('0x29')](handleError(_0x23d352,null));};exports[_0xa67e('0x34')]=function(_0x3df250,_0x4c109e){return db[_0xa67e('0x39')][_0xa67e('0x50')]({'where':{'id':_0x3df250[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x4c109e,null))[_0xa67e('0x33')](removeEntity(_0x4c109e,null))[_0xa67e('0x29')](handleError(_0x4c109e,null));};exports['getConfigurations']=function(_0x4bf225,_0x3abd93,_0x1fe86e){var _0x2a2422={};var _0x468aa7={};var _0x2ab219;var _0x4c2e9c;return db[_0xa67e('0x39')][_0xa67e('0x53')]({'where':{'id':_0x4bf225[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x3abd93,null))[_0xa67e('0x33')](function(_0x3026d7){if(_0x3026d7){_0x2ab219=_0x3026d7;_0x468aa7['model']=_[_0xa67e('0x4d')](db['SalesforceConfiguration'][_0xa67e('0x4e')]);_0x468aa7[_0xa67e('0x3e')]=_[_0xa67e('0x4d')](_0x4bf225[_0xa67e('0x3e')]);_0x468aa7[_0xa67e('0x44')]=_['intersection'](_0x468aa7[_0xa67e('0x3d')],_0x468aa7[_0xa67e('0x3e')]);_0x2a2422['attributes']=_[_0xa67e('0x3f')](_0x468aa7[_0xa67e('0x3d')],qs['fields'](_0x4bf225[_0xa67e('0x3e')]['fields']));_0x2a2422[_0xa67e('0x41')]=_0x2a2422[_0xa67e('0x41')][_0xa67e('0x42')]?_0x2a2422['attributes']:_0x468aa7[_0xa67e('0x3d')];_0x2a2422[_0xa67e('0x54')]=qs['sort'](_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x43')]);_0x2a2422['where']=qs['filters'](_[_0xa67e('0x45')](_0x4bf225[_0xa67e('0x3e')],_0x468aa7[_0xa67e('0x44')]));if(_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x46')]){_0x2a2422[_0xa67e('0x47')]=_[_0xa67e('0x48')](_0x2a2422[_0xa67e('0x47')],{'$or':_['map'](_0x2a2422[_0xa67e('0x41')],function(_0x2d7bb1){var _0x1b2750={};_0x1b2750[_0x2d7bb1]={'$like':'%'+_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x46')]+'%'};return _0x1b2750;})});}_0x2a2422=_[_0xa67e('0x48')]({},_0x2a2422,_0x4bf225['options']);return _0x2ab219[_0xa67e('0x55')](_0x2a2422);}})[_0xa67e('0x33')](function(_0x45d20b){if(_0x45d20b){_0x4c2e9c=_0x45d20b['length'];if(!_0x4bf225['query'][_0xa67e('0x56')](_0xa67e('0x57'))){_0x2a2422[_0xa67e('0x30')]=qs[_0xa67e('0x30')](_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x30')]);_0x2a2422['offset']=qs[_0xa67e('0x2f')](_0x4bf225[_0xa67e('0x3e')][_0xa67e('0x2f')]);}return _0x2ab219[_0xa67e('0x55')](_0x2a2422);}})[_0xa67e('0x33')](function(_0x46aba8){if(_0x46aba8){return _0x46aba8?{'count':_0x4c2e9c,'rows':_0x46aba8}:null;}})[_0xa67e('0x33')](respondWithResult(_0x3abd93,null))[_0xa67e('0x29')](handleError(_0x3abd93,null));};exports[_0xa67e('0x58')]=function(_0x55c1fb,_0x25001e,_0x28a5b6){if(_0x55c1fb['body']['id']){delete _0x55c1fb[_0xa67e('0x52')]['id'];}return db[_0xa67e('0x39')][_0xa67e('0x53')]({'where':{'id':_0x55c1fb[_0xa67e('0x4c')]['id']}})[_0xa67e('0x33')](handleEntityNotFound(_0x25001e,null))[_0xa67e('0x33')](function(_0x5bd8f1){if(_0x5bd8f1){_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x59')]=_0x5bd8f1['id'];_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x5a')]=integrations['getSubjects'](_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x5b')],_0x55c1fb[_0xa67e('0x52')][_0xa67e('0x3b')]);_0x55c1fb['body'][_0xa67e('0x5c')]=integrations[_0xa67e('0x5d')](_0x55c1fb['body'][_0xa67e('0x5b')],_0x55c1fb[_0xa67e('0x52')]['type']);return db['SalesforceConfiguration']['create'](_0x55c1fb['body'],{'include':[{'model':db[_0xa67e('0x5e')],'as':'Subjects'},{'model':db[_0xa67e('0x5e')],'as':_0xa67e('0x5c')}]});}return null;})['then'](respondWithResult(_0x25001e,null))[_0xa67e('0x29')](handleError(_0x25001e,null));};exports[_0xa67e('0x5f')]=function(_0x4d208d,_0x1bb981,_0x1eb9d0){var _0x2f08de;var _0x2f3bb0='';var _0x38e232=_0xa67e('0x60');return db['SalesforceAccount'][_0xa67e('0x53')]({'where':{'id':_0x4d208d[_0xa67e('0x4c')]['id']},'attributes':['id',_0xa67e('0x61'),_0xa67e('0x62'),'clientSecret','username',_0xa67e('0x63'),_0xa67e('0x64')]})['then'](handleEntityNotFound(_0x1bb981,null))['then'](function(_0x202322){if(_0x202322){_0x2f3bb0=_0x202322[_0xa67e('0x61')];var _0x414330=_0x2f3bb0[_0xa67e('0x65')](-0x1);if(_0x414330==='/'){_0x2f3bb0=_0x2f3bb0['substring'](0x0,_0x2f3bb0['lastIndexOf'](_0x414330));}_0x2f08de=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2f3bb0,'clientId':_0x202322[_0xa67e('0x62')],'clientSecret':_0x202322['clientSecret']}});return _0x2f08de[_0xa67e('0x66')](_0x202322[_0xa67e('0x67')],_0x202322[_0xa67e('0x63')][_0xa67e('0x68')](_0x202322[_0xa67e('0x64')]));}})[_0xa67e('0x33')](function(_0x4af0b4){if(_0x4af0b4){if(!_[_0xa67e('0x69')](_0x4d208d['query']['ticketType'])){_0x38e232=_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x6a')];}return _0x2f08de[_0xa67e('0x6b')](_0x38e232)[_0xa67e('0x6c')]();}})[_0xa67e('0x33')](function(_0x20a28d){var _0x2a0e9e=['CallDisposition',_0xa67e('0x6d'),_0xa67e('0x6e'),_0xa67e('0x6f'),_0xa67e('0x70'),'Priority','Status',_0xa67e('0x71')];if(!_[_0xa67e('0x69')](_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x6a')])&&_0x4d208d[_0xa67e('0x3e')]['ticketType']==='Case'){_0x2a0e9e=['Type',_0xa67e('0x72'),_0xa67e('0x73'),'Status',_0xa67e('0x74'),_0xa67e('0x75'),_0xa67e('0x76'),_0xa67e('0x77')];}if(_0x20a28d){_[_0xa67e('0x78')](_0x20a28d[_0xa67e('0x40')],function(_0x1af21d){return _0x1af21d[_0xa67e('0x79')]===![]&&!_0x2a0e9e[_0xa67e('0x7a')](_0x1af21d[_0xa67e('0x36')]);});return{'count':_0x20a28d[_0xa67e('0x40')]['length'],'rows':_['map'](_0x20a28d[_0xa67e('0x40')],function(_0x28a14e){return{'id':_0x28a14e[_0xa67e('0x36')],'name':_0x28a14e[_0xa67e('0x7b')],'custom':_0x28a14e['custom'],'options':_0x28a14e['picklistValues'][_0xa67e('0x42')]>0x0?_[_0xa67e('0x38')](_0x28a14e[_0xa67e('0x7c')],function(_0x2b420f){return{'name':_0x2b420f[_0xa67e('0x7b')],'value':_0x2b420f['value']};}):_0x28a14e[_0xa67e('0x3b')]==_0xa67e('0x7d')?[{'name':_0xa67e('0x7e'),'value':_0xa67e('0x7f')},{'name':_0xa67e('0x80'),'value':_0xa67e('0x81')}]:[]};})};}})[_0xa67e('0x33')](respondWithResult(_0x1bb981,null))[_0xa67e('0x29')](function(_0x4adcaf){var _0x160a7a=_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x1a')]?0x1f4:_0x4adcaf[_0xa67e('0x82')]||0x1f4;logger['error'](_0xa67e('0x83'),_0xa67e('0x5f'),_0x160a7a,JSON[_0xa67e('0x24')](_0x4adcaf));delete _0x4adcaf[_0xa67e('0x36')];if(_0x160a7a===0x191){_0x160a7a=0x190;}_0x1bb981['status'](_0x160a7a)['send'](_0x4d208d[_0xa67e('0x3e')][_0xa67e('0x1a')]?{'message':_0xa67e('0x84'),'statusCode':_0x4adcaf[_0xa67e('0x82')]}:_0x4adcaf);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 959ae3a..a227a2c 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 _0x86cc=['bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','util','../../config/logger','api','moment'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x86cc,0x80));var _0xc86c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86cc[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc86c('0x0'));var logger=require(_0xc86c('0x1'))(_0xc86c('0x2'));var moment=require(_0xc86c('0x3'));var BPromise=require(_0xc86c('0x4'));var rp=require(_0xc86c('0x5'));var fs=require('fs');var path=require(_0xc86c('0x6'));var rimraf=require('rimraf');var config=require(_0xc86c('0x7'));var attributes=require(_0xc86c('0x8'));var integrations=require(_0xc86c('0x9'));module[_0xc86c('0xa')]=function(_0x4321fe,_0x5a39dd){return _0x4321fe['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c66=['moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','api'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0x9c66,0x1c1));var _0x69c6=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x9c66[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x69c6('0x0'));var moment=require(_0x69c6('0x1'));var BPromise=require(_0x69c6('0x2'));var rp=require(_0x69c6('0x3'));var fs=require('fs');var path=require(_0x69c6('0x4'));var rimraf=require(_0x69c6('0x5'));var config=require('../../config/environment');var attributes=require(_0x69c6('0x6'));var integrations=require(_0x69c6('0x7'));module['exports']=function(_0x526217,_0x51df3c){return _0x526217['define'](_0x69c6('0x8'),attributes,{'tableName':_0x69c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 6fcad69..3a1bbea 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 _0x579c=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a0b31,_0x189c2b){var _0x11ca69=function(_0x64044c){while(--_0x64044c){_0x3a0b31['push'](_0x3a0b31['shift']());}};_0x11ca69(++_0x189c2b);}(_0x579c,0xda));var _0xc579=function(_0x3dcc23,_0xd0e196){_0x3dcc23=_0x3dcc23-0x0;var _0x10f2a9=_0x579c[_0x3dcc23];return _0x10f2a9;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});}exports[_0xc579('0x18')]=function(_0x33d341){var _0xbbbe3e=this;return new Promise(function(_0x3da8a1,_0xa41248){return db[_0xc579('0x19')]['findAll']({'raw':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1b')]||null:null,'attributes':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'limit':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['limit']||null:null,'include':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x33d341[_0xc579('0x1a')]['include'],function(_0x3634f2){return{'model':db[_0x3634f2[_0xc579('0x1f')]],'as':_0x3634f2['as'],'attributes':_0x3634f2[_0xc579('0x1c')],'include':_0x3634f2['include']?_[_0xc579('0x1e')](_0x3634f2['include'],function(_0x4610c2){return{'model':db[_0x4610c2[_0xc579('0x1f')]],'as':_0x4610c2['as'],'attributes':_0x4610c2[_0xc579('0x1c')],'include':_0x4610c2['include']?_[_0xc579('0x1e')](_0x4610c2['include'],function(_0x532b33){return{'model':db[_0x532b33['model']],'as':_0x532b33['as'],'attributes':_0x532b33[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0xfdbb73){logger[_0xc579('0xe')](_0xc579('0x18'),_0x33d341);logger[_0xc579('0x10')](_0xc579('0x18'),_0x33d341,JSON['stringify'](_0xfdbb73));_0x3da8a1(_0xfdbb73);})['catch'](function(_0x4a5f6){logger['error'](_0xc579('0x18'),_0x4a5f6[_0xc579('0x16')],_0x33d341);_0xa41248(_0xbbbe3e[_0xc579('0x14')](0x1f4,_0x4a5f6[_0xc579('0x16')]));});});};exports[_0xc579('0x20')]=function(_0x156bf5){var _0x45e6a3=this;return new Promise(function(_0x133d08,_0x49b48f){return db[_0xc579('0x19')][_0xc579('0x21')]({'raw':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x156bf5['options']?_0x156bf5[_0xc579('0x1a')]['where']||null:null,'attributes':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'include':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['include']?_[_0xc579('0x1e')](_0x156bf5['options'][_0xc579('0x1d')],function(_0x473000){return{'model':db[_0x473000['model']],'as':_0x473000['as'],'attributes':_0x473000[_0xc579('0x1c')],'include':_0x473000[_0xc579('0x1d')]?_['map'](_0x473000['include'],function(_0x37bce9){return{'model':db[_0x37bce9[_0xc579('0x1f')]],'as':_0x37bce9['as'],'attributes':_0x37bce9['attributes'],'include':_0x37bce9[_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x37bce9['include'],function(_0x32589a){return{'model':db[_0x32589a['model']],'as':_0x32589a['as'],'attributes':_0x32589a[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0x5c6f38){logger[_0xc579('0xe')](_0xc579('0x20'),_0x156bf5);logger[_0xc579('0x10')](_0xc579('0x20'),_0x156bf5,JSON[_0xc579('0x13')](_0x5c6f38));_0x133d08(_0x5c6f38);})[_0xc579('0x17')](function(_0x59ae89){logger[_0xc579('0x14')](_0xc579('0x20'),_0x59ae89['message'],_0x156bf5);_0x49b48f(_0x45e6a3[_0xc579('0x14')](0x1f4,_0x59ae89[_0xc579('0x16')]));});});}; \ No newline at end of file +var _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','debug','find','where','ShowSalesforceAccount'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x222f,0x1a4));var _0xf222=function(_0x87d3ec,_0x387888){_0x87d3ec=_0x87d3ec-0x0;var _0x5f3f6f=_0x222f[_0x87d3ec];return _0x5f3f6f;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['findAll']({'raw':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x8783ab[_0xf222('0x18')]?_0x8783ab['options']['where']||null:null,'attributes':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'limit':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1b')]||null:null,'include':_0x8783ab['options']?_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')],function(_0x2d18ab){return{'model':db[_0x2d18ab[_0xf222('0x1e')]],'as':_0x2d18ab['as'],'attributes':_0x2d18ab[_0xf222('0x1a')],'include':_0x2d18ab['include']?_[_0xf222('0x1d')](_0x2d18ab[_0xf222('0x1c')],function(_0x1883c1){return{'model':db[_0x1883c1[_0xf222('0x1e')]],'as':_0x1883c1['as'],'attributes':_0x1883c1[_0xf222('0x1a')],'include':_0x1883c1[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x1883c1[_0xf222('0x1c')],function(_0x15bf4e){return{'model':db[_0x15bf4e[_0xf222('0x1e')]],'as':_0x15bf4e['as'],'attributes':_0x15bf4e[_0xf222('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b2b1){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1f')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x14b2b1));_0x12a2e4(_0x14b2b1);})[_0xf222('0x15')](function(_0x1b928b){logger[_0xf222('0x11')]('GetSalesforceAccount',_0x1b928b[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x1b928b[_0xf222('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x3ccc9e){var _0x5d5963=this;return new Promise(function(_0x40c7e7,_0x27a8cc){return db[_0xf222('0x17')][_0xf222('0x20')]({'raw':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x3ccc9e['options']?_0x3ccc9e['options'][_0xf222('0x21')]||null:null,'attributes':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'include':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')]['include']?_[_0xf222('0x1d')](_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1c')],function(_0x57c862){return{'model':db[_0x57c862[_0xf222('0x1e')]],'as':_0x57c862['as'],'attributes':_0x57c862[_0xf222('0x1a')],'include':_0x57c862[_0xf222('0x1c')]?_['map'](_0x57c862[_0xf222('0x1c')],function(_0x21e20a){return{'model':db[_0x21e20a[_0xf222('0x1e')]],'as':_0x21e20a['as'],'attributes':_0x21e20a['attributes'],'include':_0x21e20a[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x21e20a[_0xf222('0x1c')],function(_0x2b838c){return{'model':db[_0x2b838c[_0xf222('0x1e')]],'as':_0x2b838c['as'],'attributes':_0x2b838c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf222('0xb')](function(_0x542123){logger[_0xf222('0xc')](_0xf222('0x22'),_0x3ccc9e);logger[_0xf222('0x1f')]('ShowSalesforceAccount',_0x3ccc9e,JSON[_0xf222('0x10')](_0x542123));_0x40c7e7(_0x542123);})[_0xf222('0x15')](function(_0x54a10d){logger[_0xf222('0x11')]('ShowSalesforceAccount',_0x54a10d[_0xf222('0x13')],_0x3ccc9e);_0x27a8cc(_0x5d5963[_0xf222('0x11')](0x1f4,_0x54a10d[_0xf222('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f86e6db..5a96bb1 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 _0x104d=['isAuthenticated','index','/:id/fields','getSubjects','/:id/descriptions','put','delete','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','get'];(function(_0x9ad8b,_0xd6b992){var _0x2e8a20=function(_0x2c22b4){while(--_0x2c22b4){_0x9ad8b['push'](_0x9ad8b['shift']());}};_0x2e8a20(++_0xd6b992);}(_0x104d,0x11a));var _0xd104=function(_0x3c7ead,_0x22c422){_0x3c7ead=_0x3c7ead-0x0;var _0x44a340=_0x104d[_0x3c7ead];return _0x44a340;};'use strict';var multer=require(_0xd104('0x0'));var util=require(_0xd104('0x1'));var path=require(_0xd104('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd104('0x3')]();var auth=require(_0xd104('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd104('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0xd104('0x6')]('/',auth[_0xd104('0x7')](),controller[_0xd104('0x8')]);router[_0xd104('0x6')]('/:id',auth[_0xd104('0x7')](),controller['show']);router[_0xd104('0x6')](_0xd104('0x9'),auth[_0xd104('0x7')](),controller['getFields']);router[_0xd104('0x6')]('/:id/subjects',auth[_0xd104('0x7')](),controller[_0xd104('0xa')]);router[_0xd104('0x6')](_0xd104('0xb'),auth[_0xd104('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0xd104('0x7')](),controller['create']);router[_0xd104('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd104('0xd')](_0xd104('0xe'),auth[_0xd104('0x7')](),controller[_0xd104('0xf')]);module[_0xd104('0x10')]=router; \ No newline at end of file +var _0x15ac=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','multer','util'];(function(_0x92354d,_0xcbd1ac){var _0x57f449=function(_0x19658f){while(--_0x19658f){_0x92354d['push'](_0x92354d['shift']());}};_0x57f449(++_0xcbd1ac);}(_0x15ac,0xda));var _0xc15a=function(_0xf40a8a,_0x4474b2){_0xf40a8a=_0xf40a8a-0x0;var _0x13f1c4=_0x15ac[_0xf40a8a];return _0x13f1c4;};'use strict';var multer=require(_0xc15a('0x0'));var util=require(_0xc15a('0x1'));var path=require('path');var timeout=require(_0xc15a('0x2'));var express=require(_0xc15a('0x3'));var router=express[_0xc15a('0x4')]();var auth=require(_0xc15a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc15a('0x6'));var controller=require(_0xc15a('0x7'));router[_0xc15a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc15a('0x9')]);router['get'](_0xc15a('0xa'),auth[_0xc15a('0xb')](),controller[_0xc15a('0xc')]);router[_0xc15a('0x8')](_0xc15a('0xd'),auth['isAuthenticated'](),controller[_0xc15a('0xe')]);router[_0xc15a('0x8')](_0xc15a('0xf'),auth[_0xc15a('0xb')](),controller['getSubjects']);router[_0xc15a('0x8')](_0xc15a('0x10'),auth[_0xc15a('0xb')](),controller[_0xc15a('0x11')]);router[_0xc15a('0x12')]('/',auth[_0xc15a('0xb')](),controller[_0xc15a('0x13')]);router['put'](_0xc15a('0xa'),auth[_0xc15a('0xb')](),controller['update']);router[_0xc15a('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc15a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1a8daf9..d3aaff2 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 _0xe189=['Task','contact','lead','nothing','sequelize','ENUM','Case'];(function(_0x3eac67,_0x59ff3b){var _0x5af74b=function(_0x40d189){while(--_0x40d189){_0x3eac67['push'](_0x3eac67['shift']());}};_0x5af74b(++_0x59ff3b);}(_0xe189,0xcf));var _0x9e18=function(_0x27e621,_0x1168ea){_0x27e621=_0x27e621-0x0;var _0x28e0e0=_0xe189[_0x27e621];return _0x28e0e0;};'use strict';var Sequelize=require(_0x9e18('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9e18('0x1')]('Task',_0x9e18('0x2')),'defaultValue':_0x9e18('0x3')},'moduleSearch':{'type':Sequelize[_0x9e18('0x1')]('contact_lead',_0x9e18('0x4'),_0x9e18('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9e18('0x1')](_0x9e18('0x6'),_0x9e18('0x4'),'lead'),'defaultValue':'lead'}}; \ No newline at end of file +var _0x3da7=['ENUM','Task','contact_lead','lead','nothing','contact','STRING'];(function(_0x26fbce,_0x2bf009){var _0x1871d2=function(_0x533094){while(--_0x533094){_0x26fbce['push'](_0x26fbce['shift']());}};_0x1871d2(++_0x2bf009);}(_0x3da7,0x1aa));var _0x73da=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x3da7[_0x34ad72];return _0x5c9aa8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x73da('0x0')]},'description':{'type':Sequelize[_0x73da('0x0')]},'ticketType':{'type':Sequelize[_0x73da('0x1')](_0x73da('0x2'),'Case'),'defaultValue':_0x73da('0x2')},'moduleSearch':{'type':Sequelize[_0x73da('0x1')](_0x73da('0x3'),'contact',_0x73da('0x4')),'defaultValue':_0x73da('0x3')},'moduleCreate':{'type':Sequelize[_0x73da('0x1')](_0x73da('0x5'),_0x73da('0x6'),_0x73da('0x4')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4611e45..4bc80e8 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 _0xe111=['catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','stack','name','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','rawAttributes','create','body','update','find','destroy','getFields','length','getSubjects','SalesforceField','getDescriptions','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x316a51,_0x531e7c){var _0x5c57fb=function(_0x9da271){while(--_0x9da271){_0x316a51['push'](_0x316a51['shift']());}};_0x5c57fb(++_0x531e7c);}(_0xe111,0x99));var _0x1e11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe111[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1e11('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1e11('0x1'));var zipdir=require(_0x1e11('0x2'));var jsonpatch=require(_0x1e11('0x3'));var rp=require(_0x1e11('0x4'));var moment=require(_0x1e11('0x5'));var BPromise=require(_0x1e11('0x6'));var Mustache=require(_0x1e11('0x7'));var util=require(_0x1e11('0x8'));var path=require(_0x1e11('0x9'));var sox=require(_0x1e11('0xa'));var csv=require(_0x1e11('0xb'));var ejs=require(_0x1e11('0xc'));var fs=require('fs');var _=require(_0x1e11('0xd'));var squel=require(_0x1e11('0xe'));var crypto=require(_0x1e11('0xf'));var jsforce=require(_0x1e11('0x10'));var deskjs=require(_0x1e11('0x11'));var toCsv=require(_0x1e11('0xb'));var querystring=require(_0x1e11('0x12'));var Papa=require(_0x1e11('0x13'));var Redis=require(_0x1e11('0x14'));var authService=require(_0x1e11('0x15'));var qs=require(_0x1e11('0x16'));var as=require(_0x1e11('0x17'));var hardwareService=require(_0x1e11('0x18'));var logger=require(_0x1e11('0x19'))(_0x1e11('0x1a'));var utils=require(_0x1e11('0x1b'));var config=require(_0x1e11('0x1c'));var db=require(_0x1e11('0x1d'))['db'];var jayson=require(_0x1e11('0x1e'));var client=jayson[_0x1e11('0x1f')][_0x1e11('0x20')]({'port':0x232a});function checkPasswordPattern(_0x4e4fdc,_0x5e056b,_0xc13170){if(_0xc13170){var _0x3bd009=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3bd009[_0x1e11('0x21')](_0x5e056b)){return _0x4e4fdc;}else{throw new db[(_0x1e11('0x22'))][(_0x1e11('0x23'))](_0x1e11('0x24'));}}else{return _0x4e4fdc;}}function respondWithRpcPromise(_0x2c874b,_0x5a2610,_0x392316,_0x5747a2){return new BPromise(function(_0x211676,_0x5183e1){var _0x532330=_0x5747a2||client;return _0x532330['request'](_0x2c874b,_0x392316)[_0x1e11('0x25')](function(_0x44d068){logger[_0x1e11('0x26')](_0x1e11('0x27'),_0x5a2610,_0x1e11('0x28'));logger['debug'](_0x1e11('0x29'),_0x5a2610,_0x1e11('0x28'),JSON[_0x1e11('0x2a')](_0x44d068));if(_0x44d068[_0x1e11('0x2b')]){if(_0x44d068['error'][_0x1e11('0x2c')]===0x1f4){logger[_0x1e11('0x2b')](_0x1e11('0x27'),_0x5a2610,_0x44d068[_0x1e11('0x2b')][_0x1e11('0x2d')]);return _0x5183e1(_0x44d068[_0x1e11('0x2b')][_0x1e11('0x2d')]);}logger['error'](_0x1e11('0x27'),_0x5a2610,_0x44d068[_0x1e11('0x2b')]['message']);return _0x211676(_0x44d068['error'][_0x1e11('0x2d')]);}else{logger[_0x1e11('0x26')](_0x1e11('0x27'),_0x5a2610,_0x1e11('0x28'));_0x211676(_0x44d068[_0x1e11('0x2e')][_0x1e11('0x2d')]);}})[_0x1e11('0x2f')](function(_0xa39dd){logger['error'](_0x1e11('0x27'),_0x5a2610,_0xa39dd);_0x5183e1(_0xa39dd);});});}function respondWithStatusCode(_0x50b205,_0x5dc61c){_0x5dc61c=_0x5dc61c||0xcc;return function(_0x4c7dd2){if(_0x4c7dd2){return _0x50b205[_0x1e11('0x30')](_0x5dc61c);}return _0x50b205[_0x1e11('0x31')](_0x5dc61c)[_0x1e11('0x32')]();};}function respondWithResult(_0x11a39b,_0x29975f){_0x29975f=_0x29975f||0xc8;return function(_0x43299b){if(_0x43299b){return _0x11a39b[_0x1e11('0x31')](_0x29975f)['json'](_0x43299b);}};}function respondWithFilteredResult(_0xf7c35,_0x3f0767){return function(_0x1a4e0e){if(_0x1a4e0e){var _0xd4ceb0=_0x1a4e0e[_0x1e11('0x33')],_0x2abb28=_0x3f0767[_0x1e11('0x34')],_0x37ebcb=_0x3f0767[_0x1e11('0x34')]+_0x3f0767[_0x1e11('0x35')],_0x52079a;if(_0x37ebcb>=_0xd4ceb0){_0x37ebcb=_0xd4ceb0;_0x52079a=0xc8;}else{_0x52079a=0xce;}_0xf7c35[_0x1e11('0x31')](_0x52079a);return _0xf7c35[_0x1e11('0x36')]('Content-Range',_0x2abb28+'-'+_0x37ebcb+'/'+_0xd4ceb0)[_0x1e11('0x37')](_0x1a4e0e);}return null;};}function patchUpdates(_0x27e61b){return function(_0x404e3f){try{jsonpatch[_0x1e11('0x38')](_0x404e3f,_0x27e61b,!![]);}catch(_0x58d747){return BPromise[_0x1e11('0x39')](_0x58d747);}return _0x404e3f[_0x1e11('0x3a')]();};}function saveUpdates(_0x22c870,_0x5a8bf1){return function(_0x2b50a8){if(_0x2b50a8){return _0x2b50a8['update'](_0x22c870)[_0x1e11('0x25')](function(_0x425d37){return _0x425d37;});}return null;};}function removeEntity(_0x411e66,_0x2a56d9){return function(_0xf8a5ed){if(_0xf8a5ed){return _0xf8a5ed['destroy']()[_0x1e11('0x25')](function(){_0x411e66[_0x1e11('0x31')](0xcc)[_0x1e11('0x32')]();});}};}function handleEntityNotFound(_0x587f5f,_0x190ecd){return function(_0x4e122f){if(!_0x4e122f){_0x587f5f[_0x1e11('0x30')](0x194);}return _0x4e122f;};}function handleError(_0x24ce8a,_0x4ddf7f){_0x4ddf7f=_0x4ddf7f||0x1f4;return function(_0x4ff2e9){logger[_0x1e11('0x2b')](_0x4ff2e9[_0x1e11('0x3b')]);if(_0x4ff2e9['name']){delete _0x4ff2e9[_0x1e11('0x3c')];}_0x24ce8a[_0x1e11('0x31')](_0x4ddf7f)['send'](_0x4ff2e9);};}exports['index']=function(_0x51154b,_0x1710f0){var _0x5ce5c6={},_0x4f5c36={},_0x30894e={'count':0x0,'rows':[]};var _0x3bc488=_[_0x1e11('0x3d')](db[_0x1e11('0x3e')]['rawAttributes'],function(_0x5d74ce){return{'name':_0x5d74ce[_0x1e11('0x3f')],'type':_0x5d74ce[_0x1e11('0x40')][_0x1e11('0x41')]};});_0x4f5c36[_0x1e11('0x42')]=_[_0x1e11('0x3d')](_0x3bc488,_0x1e11('0x3c'));_0x4f5c36['query']=_[_0x1e11('0x43')](_0x51154b[_0x1e11('0x44')]);_0x4f5c36[_0x1e11('0x45')]=_[_0x1e11('0x46')](_0x4f5c36['model'],_0x4f5c36[_0x1e11('0x44')]);_0x5ce5c6['attributes']=_[_0x1e11('0x46')](_0x4f5c36[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x51154b[_0x1e11('0x44')][_0x1e11('0x47')]));_0x5ce5c6[_0x1e11('0x48')]=_0x5ce5c6['attributes']['length']?_0x5ce5c6[_0x1e11('0x48')]:_0x4f5c36[_0x1e11('0x42')];if(!_0x51154b['query'][_0x1e11('0x49')](_0x1e11('0x4a'))){_0x5ce5c6[_0x1e11('0x35')]=qs['limit'](_0x51154b[_0x1e11('0x44')][_0x1e11('0x35')]);_0x5ce5c6[_0x1e11('0x34')]=qs[_0x1e11('0x34')](_0x51154b[_0x1e11('0x44')]['offset']);}_0x5ce5c6[_0x1e11('0x4b')]=qs[_0x1e11('0x4c')](_0x51154b[_0x1e11('0x44')]['sort']);_0x5ce5c6[_0x1e11('0x4d')]=qs[_0x1e11('0x45')](_[_0x1e11('0x4e')](_0x51154b[_0x1e11('0x44')],_0x4f5c36['filters']),_0x3bc488);if(_0x51154b[_0x1e11('0x44')]['filter']){_0x5ce5c6[_0x1e11('0x4d')]=_[_0x1e11('0x4f')](_0x5ce5c6[_0x1e11('0x4d')],{'$or':_['map'](_0x3bc488,function(_0x239b06){if(_0x239b06[_0x1e11('0x40')]!==_0x1e11('0x50')){var _0x8b3e61={};_0x8b3e61[_0x239b06[_0x1e11('0x3c')]]={'$like':'%'+_0x51154b[_0x1e11('0x44')][_0x1e11('0x51')]+'%'};return _0x8b3e61;}})});}_0x5ce5c6=_[_0x1e11('0x4f')]({},_0x5ce5c6,_0x51154b[_0x1e11('0x52')]);var _0x161387={'where':_0x5ce5c6[_0x1e11('0x4d')]};return db['SalesforceConfiguration'][_0x1e11('0x33')](_0x161387)['then'](function(_0x2758a0){_0x30894e[_0x1e11('0x33')]=_0x2758a0;if(_0x51154b[_0x1e11('0x44')][_0x1e11('0x53')]){_0x5ce5c6[_0x1e11('0x54')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x5ce5c6);})[_0x1e11('0x25')](function(_0x1c6ff7){_0x30894e[_0x1e11('0x55')]=_0x1c6ff7;return _0x30894e;})[_0x1e11('0x25')](respondWithFilteredResult(_0x1710f0,_0x5ce5c6))[_0x1e11('0x2f')](handleError(_0x1710f0,null));};exports[_0x1e11('0x56')]=function(_0x450edf,_0x5919a6){var _0x49c20d={'raw':![],'where':{'id':_0x450edf[_0x1e11('0x57')]['id']}},_0x5702eb={};_0x5702eb['model']=_[_0x1e11('0x43')](db[_0x1e11('0x3e')][_0x1e11('0x58')]);_0x5702eb[_0x1e11('0x44')]=_[_0x1e11('0x43')](_0x450edf['query']);_0x5702eb[_0x1e11('0x45')]=_['intersection'](_0x5702eb[_0x1e11('0x42')],_0x5702eb[_0x1e11('0x44')]);_0x49c20d[_0x1e11('0x48')]=_[_0x1e11('0x46')](_0x5702eb[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x450edf[_0x1e11('0x44')][_0x1e11('0x47')]));_0x49c20d[_0x1e11('0x48')]=_0x49c20d[_0x1e11('0x48')]['length']?_0x49c20d[_0x1e11('0x48')]:_0x5702eb[_0x1e11('0x42')];if(_0x450edf[_0x1e11('0x44')][_0x1e11('0x53')]){_0x49c20d['include']=[{'all':!![]}];}_0x49c20d=_[_0x1e11('0x4f')]({},_0x49c20d,_0x450edf['options']);return db[_0x1e11('0x3e')]['find'](_0x49c20d)[_0x1e11('0x25')](handleEntityNotFound(_0x5919a6,null))[_0x1e11('0x25')](respondWithResult(_0x5919a6,null))[_0x1e11('0x2f')](handleError(_0x5919a6,null));};exports[_0x1e11('0x59')]=function(_0x4152b6,_0x1fc03f){return db['SalesforceConfiguration'][_0x1e11('0x59')](_0x4152b6[_0x1e11('0x5a')],{})[_0x1e11('0x25')](respondWithResult(_0x1fc03f,0xc9))[_0x1e11('0x2f')](handleError(_0x1fc03f,null));};exports[_0x1e11('0x5b')]=function(_0x36c0ca,_0x2a6d69){if(_0x36c0ca[_0x1e11('0x5a')]['id']){delete _0x36c0ca[_0x1e11('0x5a')]['id'];}return db['SalesforceConfiguration'][_0x1e11('0x5c')]({'where':{'id':_0x36c0ca[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x2a6d69,null))[_0x1e11('0x25')](saveUpdates(_0x36c0ca['body'],null))[_0x1e11('0x25')](respondWithResult(_0x2a6d69,null))[_0x1e11('0x2f')](handleError(_0x2a6d69,null));};exports[_0x1e11('0x5d')]=function(_0x1ce110,_0x5f2e0c){return db[_0x1e11('0x3e')]['find']({'where':{'id':_0x1ce110[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x5f2e0c,null))[_0x1e11('0x25')](removeEntity(_0x5f2e0c,null))[_0x1e11('0x2f')](handleError(_0x5f2e0c,null));};exports[_0x1e11('0x5e')]=function(_0x32550d,_0x211f37,_0x55acf8){var _0x5d2175={};var _0x36a31a={};var _0x55f0d8;var _0xd3f722;return db[_0x1e11('0x3e')]['findOne']({'where':{'id':_0x32550d[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x211f37,null))[_0x1e11('0x25')](function(_0x3eb99d){if(_0x3eb99d){_0x55f0d8=_0x3eb99d;_0x36a31a[_0x1e11('0x42')]=_[_0x1e11('0x43')](db['SalesforceField'][_0x1e11('0x58')]);_0x36a31a[_0x1e11('0x44')]=_[_0x1e11('0x43')](_0x32550d[_0x1e11('0x44')]);_0x36a31a['filters']=_['intersection'](_0x36a31a[_0x1e11('0x42')],_0x36a31a[_0x1e11('0x44')]);_0x5d2175['attributes']=_[_0x1e11('0x46')](_0x36a31a[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x32550d[_0x1e11('0x44')][_0x1e11('0x47')]));_0x5d2175[_0x1e11('0x48')]=_0x5d2175['attributes']['length']?_0x5d2175[_0x1e11('0x48')]:_0x36a31a[_0x1e11('0x42')];_0x5d2175['order']=qs[_0x1e11('0x4c')](_0x32550d[_0x1e11('0x44')][_0x1e11('0x4c')]);_0x5d2175[_0x1e11('0x4d')]=qs[_0x1e11('0x45')](_[_0x1e11('0x4e')](_0x32550d[_0x1e11('0x44')],_0x36a31a['filters']));if(_0x32550d[_0x1e11('0x44')][_0x1e11('0x51')]){_0x5d2175['where']=_[_0x1e11('0x4f')](_0x5d2175[_0x1e11('0x4d')],{'$or':_[_0x1e11('0x3d')](_0x5d2175['attributes'],function(_0x1b714d){var _0x57de4f={};_0x57de4f[_0x1b714d]={'$like':'%'+_0x32550d[_0x1e11('0x44')][_0x1e11('0x51')]+'%'};return _0x57de4f;})});}_0x5d2175=_[_0x1e11('0x4f')]({},_0x5d2175,_0x32550d[_0x1e11('0x52')]);return _0x55f0d8[_0x1e11('0x5e')](_0x5d2175);}})[_0x1e11('0x25')](function(_0x29bf3a){if(_0x29bf3a){_0xd3f722=_0x29bf3a[_0x1e11('0x5f')];if(!_0x32550d[_0x1e11('0x44')][_0x1e11('0x49')](_0x1e11('0x4a'))){_0x5d2175['limit']=qs[_0x1e11('0x35')](_0x32550d[_0x1e11('0x44')][_0x1e11('0x35')]);_0x5d2175[_0x1e11('0x34')]=qs['offset'](_0x32550d[_0x1e11('0x44')][_0x1e11('0x34')]);}return _0x55f0d8['getFields'](_0x5d2175);}})[_0x1e11('0x25')](function(_0x30d815){if(_0x30d815){return _0x30d815?{'count':_0xd3f722,'rows':_0x30d815}:null;}})['then'](respondWithResult(_0x211f37,null))[_0x1e11('0x2f')](handleError(_0x211f37,null));};exports[_0x1e11('0x60')]=function(_0x3dcd52,_0x1db35b,_0x516af5){var _0x513b67={};var _0x5d12f9={};var _0x52d2fd;var _0x7b676d;return db[_0x1e11('0x3e')]['findOne']({'where':{'id':_0x3dcd52[_0x1e11('0x57')]['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0x1db35b,null))[_0x1e11('0x25')](function(_0x3ccda6){if(_0x3ccda6){_0x52d2fd=_0x3ccda6;_0x5d12f9[_0x1e11('0x42')]=_['keys'](db[_0x1e11('0x61')]['rawAttributes']);_0x5d12f9[_0x1e11('0x44')]=_[_0x1e11('0x43')](_0x3dcd52[_0x1e11('0x44')]);_0x5d12f9['filters']=_[_0x1e11('0x46')](_0x5d12f9['model'],_0x5d12f9['query']);_0x513b67['attributes']=_['intersection'](_0x5d12f9['model'],qs[_0x1e11('0x47')](_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x47')]));_0x513b67[_0x1e11('0x48')]=_0x513b67['attributes'][_0x1e11('0x5f')]?_0x513b67[_0x1e11('0x48')]:_0x5d12f9[_0x1e11('0x42')];_0x513b67['order']=qs['sort'](_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x4c')]);_0x513b67[_0x1e11('0x4d')]=qs[_0x1e11('0x45')](_[_0x1e11('0x4e')](_0x3dcd52[_0x1e11('0x44')],_0x5d12f9[_0x1e11('0x45')]));if(_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x51')]){_0x513b67['where']=_[_0x1e11('0x4f')](_0x513b67[_0x1e11('0x4d')],{'$or':_[_0x1e11('0x3d')](_0x513b67[_0x1e11('0x48')],function(_0x1b8979){var _0x4da38e={};_0x4da38e[_0x1b8979]={'$like':'%'+_0x3dcd52['query'][_0x1e11('0x51')]+'%'};return _0x4da38e;})});}_0x513b67=_[_0x1e11('0x4f')]({},_0x513b67,_0x3dcd52[_0x1e11('0x52')]);return _0x52d2fd[_0x1e11('0x60')](_0x513b67);}})[_0x1e11('0x25')](function(_0x61c6e0){if(_0x61c6e0){_0x7b676d=_0x61c6e0[_0x1e11('0x5f')];if(!_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x49')](_0x1e11('0x4a'))){_0x513b67['limit']=qs['limit'](_0x3dcd52[_0x1e11('0x44')][_0x1e11('0x35')]);_0x513b67[_0x1e11('0x34')]=qs['offset'](_0x3dcd52[_0x1e11('0x44')]['offset']);}return _0x52d2fd['getSubjects'](_0x513b67);}})['then'](function(_0x137ed3){if(_0x137ed3){return _0x137ed3?{'count':_0x7b676d,'rows':_0x137ed3}:null;}})[_0x1e11('0x25')](respondWithResult(_0x1db35b,null))[_0x1e11('0x2f')](handleError(_0x1db35b,null));};exports[_0x1e11('0x62')]=function(_0x3012db,_0xfe1a15,_0x30c5d5){var _0x46d28a={};var _0xb5d039={};var _0x280d84;var _0x45d8b1;return db[_0x1e11('0x3e')][_0x1e11('0x63')]({'where':{'id':_0x3012db['params']['id']}})[_0x1e11('0x25')](handleEntityNotFound(_0xfe1a15,null))[_0x1e11('0x25')](function(_0x49570d){if(_0x49570d){_0x280d84=_0x49570d;_0xb5d039[_0x1e11('0x42')]=_['keys'](db['SalesforceField'][_0x1e11('0x58')]);_0xb5d039[_0x1e11('0x44')]=_['keys'](_0x3012db[_0x1e11('0x44')]);_0xb5d039['filters']=_[_0x1e11('0x46')](_0xb5d039[_0x1e11('0x42')],_0xb5d039['query']);_0x46d28a[_0x1e11('0x48')]=_[_0x1e11('0x46')](_0xb5d039[_0x1e11('0x42')],qs[_0x1e11('0x47')](_0x3012db[_0x1e11('0x44')]['fields']));_0x46d28a[_0x1e11('0x48')]=_0x46d28a[_0x1e11('0x48')][_0x1e11('0x5f')]?_0x46d28a[_0x1e11('0x48')]:_0xb5d039[_0x1e11('0x42')];_0x46d28a[_0x1e11('0x4b')]=qs[_0x1e11('0x4c')](_0x3012db[_0x1e11('0x44')][_0x1e11('0x4c')]);_0x46d28a[_0x1e11('0x4d')]=qs['filters'](_[_0x1e11('0x4e')](_0x3012db[_0x1e11('0x44')],_0xb5d039[_0x1e11('0x45')]));if(_0x3012db[_0x1e11('0x44')][_0x1e11('0x51')]){_0x46d28a[_0x1e11('0x4d')]=_[_0x1e11('0x4f')](_0x46d28a[_0x1e11('0x4d')],{'$or':_[_0x1e11('0x3d')](_0x46d28a[_0x1e11('0x48')],function(_0x49e314){var _0x48cd9d={};_0x48cd9d[_0x49e314]={'$like':'%'+_0x3012db[_0x1e11('0x44')][_0x1e11('0x51')]+'%'};return _0x48cd9d;})});}_0x46d28a=_[_0x1e11('0x4f')]({},_0x46d28a,_0x3012db['options']);return _0x280d84[_0x1e11('0x62')](_0x46d28a);}})['then'](function(_0x46a470){if(_0x46a470){_0x45d8b1=_0x46a470['length'];if(!_0x3012db['query'][_0x1e11('0x49')]('nolimit')){_0x46d28a['limit']=qs[_0x1e11('0x35')](_0x3012db[_0x1e11('0x44')][_0x1e11('0x35')]);_0x46d28a['offset']=qs[_0x1e11('0x34')](_0x3012db['query'][_0x1e11('0x34')]);}return _0x280d84['getDescriptions'](_0x46d28a);}})[_0x1e11('0x25')](function(_0x414933){if(_0x414933){return _0x414933?{'count':_0x45d8b1,'rows':_0x414933}:null;}})[_0x1e11('0x25')](respondWithResult(_0xfe1a15,null))[_0x1e11('0x2f')](handleError(_0xfe1a15,null));}; \ No newline at end of file +var _0x64d9=['mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceConfiguration','count','include','findAll','show','keys','includeAll','find','create','body','update','params','destroy','getFields','order','nolimit','SalesforceField','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x64d9,0x1d9));var _0x964d=function(_0x2c8d38,_0x3aaa34){_0x2c8d38=_0x2c8d38-0x0;var _0xf9c6fd=_0x64d9[_0x2c8d38];return _0xf9c6fd;};'use strict';var pdf=require(_0x964d('0x0'));var emlformat=require(_0x964d('0x1'));var rimraf=require(_0x964d('0x2'));var zipdir=require(_0x964d('0x3'));var jsonpatch=require(_0x964d('0x4'));var rp=require('request-promise');var moment=require(_0x964d('0x5'));var BPromise=require(_0x964d('0x6'));var Mustache=require(_0x964d('0x7'));var util=require(_0x964d('0x8'));var path=require(_0x964d('0x9'));var sox=require(_0x964d('0xa'));var csv=require('to-csv');var ejs=require(_0x964d('0xb'));var fs=require('fs');var _=require(_0x964d('0xc'));var squel=require('squel');var crypto=require(_0x964d('0xd'));var jsforce=require(_0x964d('0xe'));var deskjs=require(_0x964d('0xf'));var toCsv=require(_0x964d('0x10'));var querystring=require(_0x964d('0x11'));var Papa=require(_0x964d('0x12'));var Redis=require(_0x964d('0x13'));var authService=require(_0x964d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x964d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x964d('0x16'))(_0x964d('0x17'));var utils=require(_0x964d('0x18'));var config=require(_0x964d('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x964d('0x1a'));var client=jayson[_0x964d('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x496ed3,_0xcfd583,_0x315ee5){if(_0x315ee5){var _0x42ca54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42ca54['test'](_0xcfd583)){return _0x496ed3;}else{throw new db[(_0x964d('0x1c'))]['ValidationError'](_0x964d('0x1d'));}}else{return _0x496ed3;}}function respondWithRpcPromise(_0x3fb4de,_0x222361,_0x3e0971,_0x4c929d){return new BPromise(function(_0x4aef26,_0x27d5c8){var _0x53fe3c=_0x4c929d||client;return _0x53fe3c[_0x964d('0x1e')](_0x3fb4de,_0x3e0971)['then'](function(_0x4e44e2){logger[_0x964d('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x222361,_0x964d('0x20'));logger['debug'](_0x964d('0x21'),_0x222361,'request\x20sent',JSON[_0x964d('0x22')](_0x4e44e2));if(_0x4e44e2['error']){if(_0x4e44e2[_0x964d('0x23')]['code']===0x1f4){logger[_0x964d('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x222361,_0x4e44e2[_0x964d('0x23')]['message']);return _0x27d5c8(_0x4e44e2[_0x964d('0x23')][_0x964d('0x24')]);}logger['error'](_0x964d('0x25'),_0x222361,_0x4e44e2[_0x964d('0x23')][_0x964d('0x24')]);return _0x4aef26(_0x4e44e2['error']['message']);}else{logger[_0x964d('0x1f')](_0x964d('0x25'),_0x222361,_0x964d('0x20'));_0x4aef26(_0x4e44e2[_0x964d('0x26')]['message']);}})[_0x964d('0x27')](function(_0x4f971e){logger[_0x964d('0x23')](_0x964d('0x25'),_0x222361,_0x4f971e);_0x27d5c8(_0x4f971e);});});}function respondWithStatusCode(_0x2a9492,_0xfec22c){_0xfec22c=_0xfec22c||0xcc;return function(_0x45179e){if(_0x45179e){return _0x2a9492[_0x964d('0x28')](_0xfec22c);}return _0x2a9492[_0x964d('0x29')](_0xfec22c)[_0x964d('0x2a')]();};}function respondWithResult(_0x5cfb2e,_0x2da5a0){_0x2da5a0=_0x2da5a0||0xc8;return function(_0x23dfb6){if(_0x23dfb6){return _0x5cfb2e['status'](_0x2da5a0)[_0x964d('0x2b')](_0x23dfb6);}};}function respondWithFilteredResult(_0x31fc1c,_0x5dbb5c){return function(_0x30f835){if(_0x30f835){var _0x419961=_0x30f835['count'],_0x23ff9d=_0x5dbb5c[_0x964d('0x2c')],_0x5c7471=_0x5dbb5c[_0x964d('0x2c')]+_0x5dbb5c[_0x964d('0x2d')],_0x24adac;if(_0x5c7471>=_0x419961){_0x5c7471=_0x419961;_0x24adac=0xc8;}else{_0x24adac=0xce;}_0x31fc1c['status'](_0x24adac);return _0x31fc1c[_0x964d('0x2e')](_0x964d('0x2f'),_0x23ff9d+'-'+_0x5c7471+'/'+_0x419961)[_0x964d('0x2b')](_0x30f835);}return null;};}function patchUpdates(_0x428259){return function(_0x4a0406){try{jsonpatch[_0x964d('0x30')](_0x4a0406,_0x428259,!![]);}catch(_0x4b580e){return BPromise[_0x964d('0x31')](_0x4b580e);}return _0x4a0406[_0x964d('0x32')]();};}function saveUpdates(_0x542a8b,_0x58620d){return function(_0x217eae){if(_0x217eae){return _0x217eae['update'](_0x542a8b)[_0x964d('0x33')](function(_0x5d68de){return _0x5d68de;});}return null;};}function removeEntity(_0x54a28a,_0x2b8bf1){return function(_0x410cd4){if(_0x410cd4){return _0x410cd4['destroy']()[_0x964d('0x33')](function(){_0x54a28a[_0x964d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x166e72,_0x19e770){return function(_0x23317c){if(!_0x23317c){_0x166e72[_0x964d('0x28')](0x194);}return _0x23317c;};}function handleError(_0x18e785,_0x1e14d8){_0x1e14d8=_0x1e14d8||0x1f4;return function(_0x106a22){logger[_0x964d('0x23')](_0x106a22[_0x964d('0x34')]);if(_0x106a22['name']){delete _0x106a22[_0x964d('0x35')];}_0x18e785['status'](_0x1e14d8)[_0x964d('0x36')](_0x106a22);};}exports[_0x964d('0x37')]=function(_0x200cda,_0x42b51d){var _0x13f501={},_0x289c26={},_0xe904ff={'count':0x0,'rows':[]};var _0x75c7ae=_[_0x964d('0x38')](db['SalesforceConfiguration'][_0x964d('0x39')],function(_0x59d9e0){return{'name':_0x59d9e0[_0x964d('0x3a')],'type':_0x59d9e0['type'][_0x964d('0x3b')]};});_0x289c26[_0x964d('0x3c')]=_[_0x964d('0x38')](_0x75c7ae,_0x964d('0x35'));_0x289c26[_0x964d('0x3d')]=_['keys'](_0x200cda[_0x964d('0x3d')]);_0x289c26[_0x964d('0x3e')]=_[_0x964d('0x3f')](_0x289c26[_0x964d('0x3c')],_0x289c26[_0x964d('0x3d')]);_0x13f501[_0x964d('0x40')]=_[_0x964d('0x3f')](_0x289c26['model'],qs[_0x964d('0x41')](_0x200cda[_0x964d('0x3d')][_0x964d('0x41')]));_0x13f501[_0x964d('0x40')]=_0x13f501[_0x964d('0x40')][_0x964d('0x42')]?_0x13f501['attributes']:_0x289c26[_0x964d('0x3c')];if(!_0x200cda[_0x964d('0x3d')][_0x964d('0x43')]('nolimit')){_0x13f501[_0x964d('0x2d')]=qs[_0x964d('0x2d')](_0x200cda[_0x964d('0x3d')][_0x964d('0x2d')]);_0x13f501[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x200cda[_0x964d('0x3d')][_0x964d('0x2c')]);}_0x13f501['order']=qs[_0x964d('0x44')](_0x200cda[_0x964d('0x3d')]['sort']);_0x13f501[_0x964d('0x45')]=qs[_0x964d('0x3e')](_[_0x964d('0x46')](_0x200cda[_0x964d('0x3d')],_0x289c26[_0x964d('0x3e')]),_0x75c7ae);if(_0x200cda['query'][_0x964d('0x47')]){_0x13f501[_0x964d('0x45')]=_[_0x964d('0x48')](_0x13f501[_0x964d('0x45')],{'$or':_[_0x964d('0x38')](_0x75c7ae,function(_0x520ac3){if(_0x520ac3[_0x964d('0x49')]!==_0x964d('0x4a')){var _0x4ebae6={};_0x4ebae6[_0x520ac3[_0x964d('0x35')]]={'$like':'%'+_0x200cda[_0x964d('0x3d')][_0x964d('0x47')]+'%'};return _0x4ebae6;}})});}_0x13f501=_[_0x964d('0x48')]({},_0x13f501,_0x200cda[_0x964d('0x4b')]);var _0x2edfc0={'where':_0x13f501[_0x964d('0x45')]};return db[_0x964d('0x4c')][_0x964d('0x4d')](_0x2edfc0)[_0x964d('0x33')](function(_0x106df2){_0xe904ff[_0x964d('0x4d')]=_0x106df2;if(_0x200cda[_0x964d('0x3d')]['includeAll']){_0x13f501[_0x964d('0x4e')]=[{'all':!![]}];}return db[_0x964d('0x4c')][_0x964d('0x4f')](_0x13f501);})[_0x964d('0x33')](function(_0x42e453){_0xe904ff['rows']=_0x42e453;return _0xe904ff;})[_0x964d('0x33')](respondWithFilteredResult(_0x42b51d,_0x13f501))[_0x964d('0x27')](handleError(_0x42b51d,null));};exports[_0x964d('0x50')]=function(_0x56cc64,_0x46f3fa){var _0x3053e4={'raw':![],'where':{'id':_0x56cc64['params']['id']}},_0x442c5d={};_0x442c5d[_0x964d('0x3c')]=_[_0x964d('0x51')](db[_0x964d('0x4c')][_0x964d('0x39')]);_0x442c5d[_0x964d('0x3d')]=_[_0x964d('0x51')](_0x56cc64[_0x964d('0x3d')]);_0x442c5d['filters']=_[_0x964d('0x3f')](_0x442c5d[_0x964d('0x3c')],_0x442c5d[_0x964d('0x3d')]);_0x3053e4['attributes']=_[_0x964d('0x3f')](_0x442c5d[_0x964d('0x3c')],qs[_0x964d('0x41')](_0x56cc64['query']['fields']));_0x3053e4[_0x964d('0x40')]=_0x3053e4['attributes']['length']?_0x3053e4[_0x964d('0x40')]:_0x442c5d[_0x964d('0x3c')];if(_0x56cc64['query'][_0x964d('0x52')]){_0x3053e4[_0x964d('0x4e')]=[{'all':!![]}];}_0x3053e4=_[_0x964d('0x48')]({},_0x3053e4,_0x56cc64[_0x964d('0x4b')]);return db[_0x964d('0x4c')][_0x964d('0x53')](_0x3053e4)[_0x964d('0x33')](handleEntityNotFound(_0x46f3fa,null))[_0x964d('0x33')](respondWithResult(_0x46f3fa,null))['catch'](handleError(_0x46f3fa,null));};exports['create']=function(_0x4d57c1,_0x217d23){return db[_0x964d('0x4c')][_0x964d('0x54')](_0x4d57c1[_0x964d('0x55')],{})['then'](respondWithResult(_0x217d23,0xc9))[_0x964d('0x27')](handleError(_0x217d23,null));};exports[_0x964d('0x56')]=function(_0x184182,_0x3efa5e){if(_0x184182[_0x964d('0x55')]['id']){delete _0x184182[_0x964d('0x55')]['id'];}return db[_0x964d('0x4c')][_0x964d('0x53')]({'where':{'id':_0x184182[_0x964d('0x57')]['id']}})[_0x964d('0x33')](handleEntityNotFound(_0x3efa5e,null))[_0x964d('0x33')](saveUpdates(_0x184182[_0x964d('0x55')],null))['then'](respondWithResult(_0x3efa5e,null))[_0x964d('0x27')](handleError(_0x3efa5e,null));};exports[_0x964d('0x58')]=function(_0x15fed1,_0x33da21){return db[_0x964d('0x4c')][_0x964d('0x53')]({'where':{'id':_0x15fed1[_0x964d('0x57')]['id']}})['then'](handleEntityNotFound(_0x33da21,null))['then'](removeEntity(_0x33da21,null))['catch'](handleError(_0x33da21,null));};exports[_0x964d('0x59')]=function(_0x347da4,_0x46c3dd,_0x5ec12c){var _0x13f46c={};var _0x568b0b={};var _0x41485a;var _0x1b19e2;return db[_0x964d('0x4c')]['findOne']({'where':{'id':_0x347da4[_0x964d('0x57')]['id']}})[_0x964d('0x33')](handleEntityNotFound(_0x46c3dd,null))['then'](function(_0x41ba8d){if(_0x41ba8d){_0x41485a=_0x41ba8d;_0x568b0b[_0x964d('0x3c')]=_[_0x964d('0x51')](db['SalesforceField'][_0x964d('0x39')]);_0x568b0b[_0x964d('0x3d')]=_['keys'](_0x347da4[_0x964d('0x3d')]);_0x568b0b[_0x964d('0x3e')]=_[_0x964d('0x3f')](_0x568b0b[_0x964d('0x3c')],_0x568b0b[_0x964d('0x3d')]);_0x13f46c['attributes']=_[_0x964d('0x3f')](_0x568b0b[_0x964d('0x3c')],qs[_0x964d('0x41')](_0x347da4[_0x964d('0x3d')][_0x964d('0x41')]));_0x13f46c[_0x964d('0x40')]=_0x13f46c[_0x964d('0x40')][_0x964d('0x42')]?_0x13f46c[_0x964d('0x40')]:_0x568b0b[_0x964d('0x3c')];_0x13f46c[_0x964d('0x5a')]=qs[_0x964d('0x44')](_0x347da4[_0x964d('0x3d')][_0x964d('0x44')]);_0x13f46c['where']=qs[_0x964d('0x3e')](_[_0x964d('0x46')](_0x347da4[_0x964d('0x3d')],_0x568b0b[_0x964d('0x3e')]));if(_0x347da4[_0x964d('0x3d')][_0x964d('0x47')]){_0x13f46c['where']=_[_0x964d('0x48')](_0x13f46c['where'],{'$or':_[_0x964d('0x38')](_0x13f46c[_0x964d('0x40')],function(_0x113c12){var _0x15f282={};_0x15f282[_0x113c12]={'$like':'%'+_0x347da4['query']['filter']+'%'};return _0x15f282;})});}_0x13f46c=_[_0x964d('0x48')]({},_0x13f46c,_0x347da4[_0x964d('0x4b')]);return _0x41485a[_0x964d('0x59')](_0x13f46c);}})[_0x964d('0x33')](function(_0xa953b0){if(_0xa953b0){_0x1b19e2=_0xa953b0[_0x964d('0x42')];if(!_0x347da4['query']['hasOwnProperty'](_0x964d('0x5b'))){_0x13f46c[_0x964d('0x2d')]=qs[_0x964d('0x2d')](_0x347da4[_0x964d('0x3d')][_0x964d('0x2d')]);_0x13f46c[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x347da4[_0x964d('0x3d')][_0x964d('0x2c')]);}return _0x41485a[_0x964d('0x59')](_0x13f46c);}})['then'](function(_0x306edd){if(_0x306edd){return _0x306edd?{'count':_0x1b19e2,'rows':_0x306edd}:null;}})[_0x964d('0x33')](respondWithResult(_0x46c3dd,null))[_0x964d('0x27')](handleError(_0x46c3dd,null));};exports['getSubjects']=function(_0x3895da,_0x46aa2b,_0x370350){var _0x34392f={};var _0x5f32f2={};var _0x28e082;var _0x2e9f3d;return db[_0x964d('0x4c')]['findOne']({'where':{'id':_0x3895da[_0x964d('0x57')]['id']}})['then'](handleEntityNotFound(_0x46aa2b,null))['then'](function(_0xf6a56e){if(_0xf6a56e){_0x28e082=_0xf6a56e;_0x5f32f2[_0x964d('0x3c')]=_['keys'](db[_0x964d('0x5c')][_0x964d('0x39')]);_0x5f32f2[_0x964d('0x3d')]=_[_0x964d('0x51')](_0x3895da[_0x964d('0x3d')]);_0x5f32f2[_0x964d('0x3e')]=_[_0x964d('0x3f')](_0x5f32f2['model'],_0x5f32f2[_0x964d('0x3d')]);_0x34392f[_0x964d('0x40')]=_[_0x964d('0x3f')](_0x5f32f2['model'],qs[_0x964d('0x41')](_0x3895da[_0x964d('0x3d')]['fields']));_0x34392f['attributes']=_0x34392f[_0x964d('0x40')][_0x964d('0x42')]?_0x34392f[_0x964d('0x40')]:_0x5f32f2[_0x964d('0x3c')];_0x34392f[_0x964d('0x5a')]=qs[_0x964d('0x44')](_0x3895da[_0x964d('0x3d')][_0x964d('0x44')]);_0x34392f['where']=qs['filters'](_['pick'](_0x3895da[_0x964d('0x3d')],_0x5f32f2[_0x964d('0x3e')]));if(_0x3895da[_0x964d('0x3d')][_0x964d('0x47')]){_0x34392f[_0x964d('0x45')]=_[_0x964d('0x48')](_0x34392f[_0x964d('0x45')],{'$or':_[_0x964d('0x38')](_0x34392f[_0x964d('0x40')],function(_0x2dbe05){var _0x6f5491={};_0x6f5491[_0x2dbe05]={'$like':'%'+_0x3895da['query'][_0x964d('0x47')]+'%'};return _0x6f5491;})});}_0x34392f=_[_0x964d('0x48')]({},_0x34392f,_0x3895da[_0x964d('0x4b')]);return _0x28e082[_0x964d('0x5d')](_0x34392f);}})[_0x964d('0x33')](function(_0x320eb4){if(_0x320eb4){_0x2e9f3d=_0x320eb4[_0x964d('0x42')];if(!_0x3895da[_0x964d('0x3d')]['hasOwnProperty'](_0x964d('0x5b'))){_0x34392f[_0x964d('0x2d')]=qs['limit'](_0x3895da[_0x964d('0x3d')][_0x964d('0x2d')]);_0x34392f[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x3895da[_0x964d('0x3d')][_0x964d('0x2c')]);}return _0x28e082[_0x964d('0x5d')](_0x34392f);}})['then'](function(_0x139c22){if(_0x139c22){return _0x139c22?{'count':_0x2e9f3d,'rows':_0x139c22}:null;}})[_0x964d('0x33')](respondWithResult(_0x46aa2b,null))[_0x964d('0x27')](handleError(_0x46aa2b,null));};exports[_0x964d('0x5e')]=function(_0x289faa,_0x354ffa,_0x577c37){var _0x110bf5={};var _0x52cede={};var _0x5207c9;var _0x13df0b;return db['SalesforceConfiguration'][_0x964d('0x5f')]({'where':{'id':_0x289faa[_0x964d('0x57')]['id']}})[_0x964d('0x33')](handleEntityNotFound(_0x354ffa,null))[_0x964d('0x33')](function(_0x57b668){if(_0x57b668){_0x5207c9=_0x57b668;_0x52cede[_0x964d('0x3c')]=_[_0x964d('0x51')](db[_0x964d('0x5c')][_0x964d('0x39')]);_0x52cede[_0x964d('0x3d')]=_[_0x964d('0x51')](_0x289faa[_0x964d('0x3d')]);_0x52cede[_0x964d('0x3e')]=_['intersection'](_0x52cede[_0x964d('0x3c')],_0x52cede[_0x964d('0x3d')]);_0x110bf5[_0x964d('0x40')]=_['intersection'](_0x52cede[_0x964d('0x3c')],qs[_0x964d('0x41')](_0x289faa[_0x964d('0x3d')]['fields']));_0x110bf5[_0x964d('0x40')]=_0x110bf5['attributes']['length']?_0x110bf5[_0x964d('0x40')]:_0x52cede[_0x964d('0x3c')];_0x110bf5[_0x964d('0x5a')]=qs['sort'](_0x289faa[_0x964d('0x3d')][_0x964d('0x44')]);_0x110bf5[_0x964d('0x45')]=qs[_0x964d('0x3e')](_[_0x964d('0x46')](_0x289faa[_0x964d('0x3d')],_0x52cede[_0x964d('0x3e')]));if(_0x289faa['query'][_0x964d('0x47')]){_0x110bf5['where']=_['merge'](_0x110bf5[_0x964d('0x45')],{'$or':_[_0x964d('0x38')](_0x110bf5['attributes'],function(_0x3a8501){var _0x57a400={};_0x57a400[_0x3a8501]={'$like':'%'+_0x289faa[_0x964d('0x3d')][_0x964d('0x47')]+'%'};return _0x57a400;})});}_0x110bf5=_[_0x964d('0x48')]({},_0x110bf5,_0x289faa['options']);return _0x5207c9['getDescriptions'](_0x110bf5);}})[_0x964d('0x33')](function(_0x54302b){if(_0x54302b){_0x13df0b=_0x54302b[_0x964d('0x42')];if(!_0x289faa[_0x964d('0x3d')][_0x964d('0x43')]('nolimit')){_0x110bf5[_0x964d('0x2d')]=qs[_0x964d('0x2d')](_0x289faa['query'][_0x964d('0x2d')]);_0x110bf5[_0x964d('0x2c')]=qs[_0x964d('0x2c')](_0x289faa['query']['offset']);}return _0x5207c9[_0x964d('0x5e')](_0x110bf5);}})[_0x964d('0x33')](function(_0x31035b){if(_0x31035b){return _0x31035b?{'count':_0x13df0b,'rows':_0x31035b}:null;}})[_0x964d('0x33')](respondWithResult(_0x354ffa,null))[_0x964d('0x27')](handleError(_0x354ffa,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 90b79f9..543c65a 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 _0x6182=['path','rimraf','../../config/environment','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1bae8f,_0x426d31){var _0x591da3=function(_0x2facc8){while(--_0x2facc8){_0x1bae8f['push'](_0x1bae8f['shift']());}};_0x591da3(++_0x426d31);}(_0x6182,0x145));var _0x2618=function(_0x2ff273,_0x2f3e29){_0x2ff273=_0x2ff273-0x0;var _0x1a38d5=_0x6182[_0x2ff273];return _0x1a38d5;};'use strict';var _=require(_0x2618('0x0'));var util=require(_0x2618('0x1'));var logger=require(_0x2618('0x2'))(_0x2618('0x3'));var moment=require(_0x2618('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2618('0x5'));var rimraf=require(_0x2618('0x6'));var config=require(_0x2618('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x1727b5,_0x257cbe){return _0x1727b5[_0x2618('0x8')](_0x2618('0x9'),attributes,{'tableName':_0x2618('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfbf=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xdfbf,0xaa));var _0xfdfb=function(_0x346655,_0x2832d1){_0x346655=_0x346655-0x0;var _0x25483e=_0xdfbf[_0x346655];return _0x25483e;};'use strict';var _=require('lodash');var util=require(_0xfdfb('0x0'));var logger=require(_0xfdfb('0x1'))(_0xfdfb('0x2'));var moment=require('moment');var BPromise=require(_0xfdfb('0x3'));var rp=require(_0xfdfb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdfb('0x5'));var config=require(_0xfdfb('0x6'));var attributes=require(_0xfdfb('0x7'));module[_0xfdfb('0x8')]=function(_0x41223e,_0x174304){return _0x41223e['define'](_0xfdfb('0x9'),attributes,{'tableName':_0xfdfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index d59e164..9fa51cc 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 _0xcb4f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis'];(function(_0x3032d9,_0x3b875d){var _0x348b3a=function(_0x2d73e5){while(--_0x2d73e5){_0x3032d9['push'](_0x3032d9['shift']());}};_0x348b3a(++_0x3b875d);}(_0xcb4f,0xe3));var _0xfcb4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xcb4f[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xfcb4('0x0'));var util=require(_0xfcb4('0x1'));var moment=require('moment');var BPromise=require(_0xfcb4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcb4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcb4('0x4'));var logger=require(_0xfcb4('0x5'))(_0xfcb4('0x6'));var config=require(_0xfcb4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcb4('0x8')][_0xfcb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4853a4,_0x484e0f,_0x4c0e4b){return new BPromise(function(_0x3205ba,_0x5e5ce8){return client['request'](_0x4853a4,_0x4c0e4b)['then'](function(_0x2d511c){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x484e0f,_0xfcb4('0xa'));logger[_0xfcb4('0xb')](_0xfcb4('0xc'),_0x484e0f,_0xfcb4('0xa'),JSON[_0xfcb4('0xd')](_0x2d511c));if(_0x2d511c['error']){if(_0x2d511c[_0xfcb4('0xe')][_0xfcb4('0xf')]===0x1f4){logger[_0xfcb4('0xe')](_0xfcb4('0x10'),_0x484e0f,_0x2d511c[_0xfcb4('0xe')][_0xfcb4('0x11')]);return _0x5e5ce8(_0x2d511c[_0xfcb4('0xe')]['message']);}logger[_0xfcb4('0xe')](_0xfcb4('0x10'),_0x484e0f,_0x2d511c[_0xfcb4('0xe')]['message']);return _0x3205ba(_0x2d511c['error'][_0xfcb4('0x11')]);}else{logger[_0xfcb4('0x12')](_0xfcb4('0x10'),_0x484e0f,_0xfcb4('0xa'));_0x3205ba(_0x2d511c[_0xfcb4('0x13')][_0xfcb4('0x11')]);}})[_0xfcb4('0x14')](function(_0x5baaee){logger[_0xfcb4('0xe')](_0xfcb4('0x10'),_0x484e0f,_0x5baaee);_0x5e5ce8(_0x5baaee);});});} \ No newline at end of file +var _0x1ad9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x5b9b40,_0x3a7e77){var _0x51423d=function(_0x197719){while(--_0x197719){_0x5b9b40['push'](_0x5b9b40['shift']());}};_0x51423d(++_0x3a7e77);}(_0x1ad9,0x88));var _0x91ad=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x1ad9[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x91ad('0x0'));var util=require(_0x91ad('0x1'));var moment=require(_0x91ad('0x2'));var BPromise=require(_0x91ad('0x3'));var rs=require(_0x91ad('0x4'));var fs=require('fs');var Redis=require(_0x91ad('0x5'));var db=require(_0x91ad('0x6'))['db'];var utils=require(_0x91ad('0x7'));var logger=require(_0x91ad('0x8'))(_0x91ad('0x9'));var config=require(_0x91ad('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38e8bd,_0x4f7712,_0x1fd8cf){return new BPromise(function(_0x18bbac,_0x4d9d4e){return client[_0x91ad('0xb')](_0x38e8bd,_0x1fd8cf)[_0x91ad('0xc')](function(_0x4f8b97){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0x91ad('0xd'));logger[_0x91ad('0xe')](_0x91ad('0xf'),_0x4f7712,_0x91ad('0xd'),JSON[_0x91ad('0x10')](_0x4f8b97));if(_0x4f8b97[_0x91ad('0x11')]){if(_0x4f8b97['error'][_0x91ad('0x12')]===0x1f4){logger[_0x91ad('0x11')](_0x91ad('0x13'),_0x4f7712,_0x4f8b97['error'][_0x91ad('0x14')]);return _0x4d9d4e(_0x4f8b97[_0x91ad('0x11')][_0x91ad('0x14')]);}logger[_0x91ad('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0x4f8b97[_0x91ad('0x11')][_0x91ad('0x14')]);return _0x18bbac(_0x4f8b97[_0x91ad('0x11')][_0x91ad('0x14')]);}else{logger[_0x91ad('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0x91ad('0xd'));_0x18bbac(_0x4f8b97['result']['message']);}})[_0x91ad('0x16')](function(_0xc65b66){logger[_0x91ad('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f7712,_0xc65b66);_0x4d9d4e(_0xc65b66);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a67b5bd..c436f76 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x687b,0x14a));var _0xb687=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x687b[_0x3f0b30];return _0x2748a5;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0x82c4=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x82c4,0x1ca));var _0x482c=function(_0x37ea17,_0x58c122){_0x37ea17=_0x37ea17-0x0;var _0x4c6387=_0x82c4[_0x37ea17];return _0x4c6387;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var auth=require(_0x482c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x482c('0x7'));var controller=require('./intSalesforceField.controller');router[_0x482c('0x8')]('/',auth['isAuthenticated'](),controller[_0x482c('0x9')]);router['get'](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xc')]);router[_0x482c('0xd')]('/',auth[_0x482c('0xb')](),controller['create']);router[_0x482c('0xe')](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xf')]);router[_0x482c('0x10')](_0x482c('0xa'),auth['isAuthenticated'](),controller[_0x482c('0x11')]);module[_0x482c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c98b9bf..b22ca36 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 _0x2215=['ENUM','variable','string','STRING','customVariable'];(function(_0x31bc44,_0x4d32e2){var _0x40307c=function(_0x16c3f9){while(--_0x16c3f9){_0x31bc44['push'](_0x31bc44['shift']());}};_0x40307c(++_0x4d32e2);}(_0x2215,0x1ae));var _0x5221=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2215[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5221('0x0')]('string',_0x5221('0x1'),'customVariable','keyValue'),'defaultValue':_0x5221('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5221('0x3')]},'keyType':{'type':Sequelize[_0x5221('0x0')](_0x5221('0x2'),_0x5221('0x1'),_0x5221('0x4'))},'keyContent':{'type':Sequelize[_0x5221('0x3')]},'idField':{'type':Sequelize[_0x5221('0x3')]},'variableName':{'type':Sequelize[_0x5221('0x3')]}}; \ No newline at end of file +var _0x1686=['customVariable','keyValue','string','STRING','ENUM','sequelize','exports','variable'];(function(_0x2926c4,_0x4e27b5){var _0x1208c1=function(_0x428d9b){while(--_0x428d9b){_0x2926c4['push'](_0x2926c4['shift']());}};_0x1208c1(++_0x4e27b5);}(_0x1686,0x1d5));var _0x6168=function(_0x334f7d,_0x13f7a0){_0x334f7d=_0x334f7d-0x0;var _0x38b00d=_0x1686[_0x334f7d];return _0x38b00d;};'use strict';var Sequelize=require(_0x6168('0x0'));module[_0x6168('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x6168('0x2'),_0x6168('0x3'),_0x6168('0x4')),'defaultValue':_0x6168('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6168('0x6')]},'keyType':{'type':Sequelize[_0x6168('0x7')]('string',_0x6168('0x2'),_0x6168('0x3'))},'keyContent':{'type':Sequelize[_0x6168('0x6')]},'idField':{'type':Sequelize[_0x6168('0x6')]},'variableName':{'type':Sequelize[_0x6168('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 066638e..be89864 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 _0x3576=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','offset','limit','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceField','rawAttributes','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3576,0x128));var _0x6357=function(_0x551b79,_0x4cb4b5){_0x551b79=_0x551b79-0x0;var _0x160fe7=_0x3576[_0x551b79];return _0x160fe7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6357('0x0'));var jsonpatch=require(_0x6357('0x1'));var rp=require(_0x6357('0x2'));var moment=require('moment');var BPromise=require(_0x6357('0x3'));var Mustache=require(_0x6357('0x4'));var util=require(_0x6357('0x5'));var path=require(_0x6357('0x6'));var sox=require('sox');var csv=require(_0x6357('0x7'));var ejs=require(_0x6357('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6357('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6357('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6357('0xb'));var Papa=require(_0x6357('0xc'));var Redis=require('ioredis');var authService=require(_0x6357('0xd'));var qs=require(_0x6357('0xe'));var as=require(_0x6357('0xf'));var hardwareService=require(_0x6357('0x10'));var logger=require(_0x6357('0x11'))(_0x6357('0x12'));var utils=require(_0x6357('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1833e9,_0x5efbde){_0x5efbde=_0x5efbde||0xcc;return function(_0x27fea0){if(_0x27fea0){return _0x1833e9['sendStatus'](_0x5efbde);}return _0x1833e9['status'](_0x5efbde)[_0x6357('0x14')]();};}function respondWithResult(_0x23d970,_0x133e5c){_0x133e5c=_0x133e5c||0xc8;return function(_0x181980){if(_0x181980){return _0x23d970[_0x6357('0x15')](_0x133e5c)['json'](_0x181980);}};}function respondWithFilteredResult(_0xe15006,_0x47a02b){return function(_0x1aeade){if(_0x1aeade){var _0x2b0ff2=_0x1aeade['count'],_0x5c0ac8=_0x47a02b[_0x6357('0x16')],_0xe5dbea=_0x47a02b[_0x6357('0x16')]+_0x47a02b[_0x6357('0x17')],_0x401cdd;if(_0xe5dbea>=_0x2b0ff2){_0xe5dbea=_0x2b0ff2;_0x401cdd=0xc8;}else{_0x401cdd=0xce;}_0xe15006['status'](_0x401cdd);return _0xe15006['set']('Content-Range',_0x5c0ac8+'-'+_0xe5dbea+'/'+_0x2b0ff2)['json'](_0x1aeade);}return null;};}function patchUpdates(_0x46240a){return function(_0x5b9785){try{jsonpatch[_0x6357('0x18')](_0x5b9785,_0x46240a,!![]);}catch(_0xa6d382){return BPromise[_0x6357('0x19')](_0xa6d382);}return _0x5b9785[_0x6357('0x1a')]();};}function saveUpdates(_0x498d75,_0x3643f7){return function(_0x4b03f3){if(_0x4b03f3){return _0x4b03f3[_0x6357('0x1b')](_0x498d75)[_0x6357('0x1c')](function(_0x33d0fe){return _0x33d0fe;});}return null;};}function removeEntity(_0x4b1848,_0x3d4fac){return function(_0x15e8b9){if(_0x15e8b9){return _0x15e8b9[_0x6357('0x1d')]()['then'](function(){_0x4b1848[_0x6357('0x15')](0xcc)[_0x6357('0x14')]();});}};}function handleEntityNotFound(_0x35826f,_0xbe95a3){return function(_0x3c7abe){if(!_0x3c7abe){_0x35826f[_0x6357('0x1e')](0x194);}return _0x3c7abe;};}function handleError(_0x268bb7,_0x5257b0){_0x5257b0=_0x5257b0||0x1f4;return function(_0x5ca7cf){logger['error'](_0x5ca7cf[_0x6357('0x1f')]);if(_0x5ca7cf['name']){delete _0x5ca7cf[_0x6357('0x20')];}_0x268bb7[_0x6357('0x15')](_0x5257b0)[_0x6357('0x21')](_0x5ca7cf);};}exports[_0x6357('0x22')]=function(_0x51dd6d,_0x3a44bf){var _0x80b55c={},_0x422a8c={},_0x234afc={'count':0x0,'rows':[]};var _0x4bf136=_[_0x6357('0x23')](db[_0x6357('0x24')][_0x6357('0x25')],function(_0x27ae94){return{'name':_0x27ae94['fieldName'],'type':_0x27ae94['type']['key']};});_0x422a8c[_0x6357('0x26')]=_[_0x6357('0x23')](_0x4bf136,_0x6357('0x20'));_0x422a8c['query']=_[_0x6357('0x27')](_0x51dd6d[_0x6357('0x28')]);_0x422a8c[_0x6357('0x29')]=_[_0x6357('0x2a')](_0x422a8c['model'],_0x422a8c['query']);_0x80b55c['attributes']=_[_0x6357('0x2a')](_0x422a8c[_0x6357('0x26')],qs[_0x6357('0x2b')](_0x51dd6d['query'][_0x6357('0x2b')]));_0x80b55c[_0x6357('0x2c')]=_0x80b55c[_0x6357('0x2c')][_0x6357('0x2d')]?_0x80b55c[_0x6357('0x2c')]:_0x422a8c[_0x6357('0x26')];if(!_0x51dd6d[_0x6357('0x28')][_0x6357('0x2e')](_0x6357('0x2f'))){_0x80b55c[_0x6357('0x17')]=qs[_0x6357('0x17')](_0x51dd6d[_0x6357('0x28')][_0x6357('0x17')]);_0x80b55c['offset']=qs['offset'](_0x51dd6d[_0x6357('0x28')][_0x6357('0x16')]);}_0x80b55c['order']=qs[_0x6357('0x30')](_0x51dd6d[_0x6357('0x28')][_0x6357('0x30')]);_0x80b55c[_0x6357('0x31')]=qs['filters'](_[_0x6357('0x32')](_0x51dd6d[_0x6357('0x28')],_0x422a8c[_0x6357('0x29')]),_0x4bf136);if(_0x51dd6d[_0x6357('0x28')][_0x6357('0x33')]){_0x80b55c['where']=_[_0x6357('0x34')](_0x80b55c['where'],{'$or':_[_0x6357('0x23')](_0x4bf136,function(_0xf26b63){if(_0xf26b63[_0x6357('0x35')]!==_0x6357('0x36')){var _0x34537b={};_0x34537b[_0xf26b63[_0x6357('0x20')]]={'$like':'%'+_0x51dd6d[_0x6357('0x28')][_0x6357('0x33')]+'%'};return _0x34537b;}})});}_0x80b55c=_['merge']({},_0x80b55c,_0x51dd6d[_0x6357('0x37')]);var _0x13db95={'where':_0x80b55c['where']};return db['SalesforceField'][_0x6357('0x38')](_0x13db95)[_0x6357('0x1c')](function(_0x49f540){_0x234afc[_0x6357('0x38')]=_0x49f540;if(_0x51dd6d[_0x6357('0x28')][_0x6357('0x39')]){_0x80b55c[_0x6357('0x3a')]=[{'all':!![]}];}return db[_0x6357('0x24')][_0x6357('0x3b')](_0x80b55c);})[_0x6357('0x1c')](function(_0x296663){_0x234afc[_0x6357('0x3c')]=_0x296663;return _0x234afc;})[_0x6357('0x1c')](respondWithFilteredResult(_0x3a44bf,_0x80b55c))[_0x6357('0x3d')](handleError(_0x3a44bf,null));};exports[_0x6357('0x3e')]=function(_0x2fd211,_0x42cb9f){var _0x38c8eb={'raw':!![],'where':{'id':_0x2fd211[_0x6357('0x3f')]['id']}},_0x2770b9={};_0x2770b9[_0x6357('0x26')]=_[_0x6357('0x27')](db[_0x6357('0x24')]['rawAttributes']);_0x2770b9['query']=_[_0x6357('0x27')](_0x2fd211[_0x6357('0x28')]);_0x2770b9[_0x6357('0x29')]=_[_0x6357('0x2a')](_0x2770b9[_0x6357('0x26')],_0x2770b9[_0x6357('0x28')]);_0x38c8eb[_0x6357('0x2c')]=_[_0x6357('0x2a')](_0x2770b9[_0x6357('0x26')],qs[_0x6357('0x2b')](_0x2fd211[_0x6357('0x28')][_0x6357('0x2b')]));_0x38c8eb[_0x6357('0x2c')]=_0x38c8eb[_0x6357('0x2c')][_0x6357('0x2d')]?_0x38c8eb['attributes']:_0x2770b9[_0x6357('0x26')];if(_0x2fd211['query'][_0x6357('0x39')]){_0x38c8eb['include']=[{'all':!![]}];}_0x38c8eb=_[_0x6357('0x34')]({},_0x38c8eb,_0x2fd211[_0x6357('0x37')]);return db[_0x6357('0x24')][_0x6357('0x40')](_0x38c8eb)[_0x6357('0x1c')](handleEntityNotFound(_0x42cb9f,null))[_0x6357('0x1c')](respondWithResult(_0x42cb9f,null))[_0x6357('0x3d')](handleError(_0x42cb9f,null));};exports['create']=function(_0x353753,_0x38013b){return db[_0x6357('0x24')][_0x6357('0x41')](_0x353753[_0x6357('0x42')],{})[_0x6357('0x1c')](respondWithResult(_0x38013b,0xc9))['catch'](handleError(_0x38013b,null));};exports[_0x6357('0x1b')]=function(_0x16547e,_0x43325c){if(_0x16547e[_0x6357('0x42')]['id']){delete _0x16547e[_0x6357('0x42')]['id'];}return db['SalesforceField'][_0x6357('0x40')]({'where':{'id':_0x16547e[_0x6357('0x3f')]['id']}})[_0x6357('0x1c')](handleEntityNotFound(_0x43325c,null))['then'](saveUpdates(_0x16547e[_0x6357('0x42')],null))[_0x6357('0x1c')](respondWithResult(_0x43325c,null))['catch'](handleError(_0x43325c,null));};exports[_0x6357('0x1d')]=function(_0x451a76,_0x510de9){return db[_0x6357('0x24')][_0x6357('0x40')]({'where':{'id':_0x451a76[_0x6357('0x3f')]['id']}})['then'](handleEntityNotFound(_0x510de9,null))[_0x6357('0x1c')](removeEntity(_0x510de9,null))[_0x6357('0x3d')](handleError(_0x510de9,null));}; \ No newline at end of file +var _0xabf5=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','SalesforceField','includeAll','include','findAll','rows','show','params','options','catch','create','body','update','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox'];(function(_0x162671,_0x12fbe0){var _0x4faa6a=function(_0x3c4e50){while(--_0x3c4e50){_0x162671['push'](_0x162671['shift']());}};_0x4faa6a(++_0x12fbe0);}(_0xabf5,0x16f));var _0x5abf=function(_0x2a815d,_0x5516be){_0x2a815d=_0x2a815d-0x0;var _0x35d5c6=_0xabf5[_0x2a815d];return _0x35d5c6;};'use strict';var pdf=require(_0x5abf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5abf('0x1'));var zipdir=require(_0x5abf('0x2'));var jsonpatch=require(_0x5abf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5abf('0x4'));var Mustache=require('mustache');var util=require(_0x5abf('0x5'));var path=require(_0x5abf('0x6'));var sox=require(_0x5abf('0x7'));var csv=require(_0x5abf('0x8'));var ejs=require(_0x5abf('0x9'));var fs=require('fs');var _=require(_0x5abf('0xa'));var squel=require(_0x5abf('0xb'));var crypto=require(_0x5abf('0xc'));var jsforce=require(_0x5abf('0xd'));var deskjs=require(_0x5abf('0xe'));var toCsv=require(_0x5abf('0x8'));var querystring=require(_0x5abf('0xf'));var Papa=require(_0x5abf('0x10'));var Redis=require(_0x5abf('0x11'));var authService=require(_0x5abf('0x12'));var qs=require(_0x5abf('0x13'));var as=require(_0x5abf('0x14'));var hardwareService=require(_0x5abf('0x15'));var logger=require(_0x5abf('0x16'))(_0x5abf('0x17'));var utils=require(_0x5abf('0x18'));var config=require(_0x5abf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe9d1,_0x3fddcf){_0x3fddcf=_0x3fddcf||0xcc;return function(_0x2029be){if(_0x2029be){return _0x3fe9d1[_0x5abf('0x1a')](_0x3fddcf);}return _0x3fe9d1['status'](_0x3fddcf)[_0x5abf('0x1b')]();};}function respondWithResult(_0x12f441,_0xf773ea){_0xf773ea=_0xf773ea||0xc8;return function(_0x2736c1){if(_0x2736c1){return _0x12f441['status'](_0xf773ea)[_0x5abf('0x1c')](_0x2736c1);}};}function respondWithFilteredResult(_0x135069,_0x34e731){return function(_0x1e027c){if(_0x1e027c){var _0x1b89b0=_0x1e027c[_0x5abf('0x1d')],_0x56b3cf=_0x34e731[_0x5abf('0x1e')],_0x5a2018=_0x34e731[_0x5abf('0x1e')]+_0x34e731[_0x5abf('0x1f')],_0xb034e;if(_0x5a2018>=_0x1b89b0){_0x5a2018=_0x1b89b0;_0xb034e=0xc8;}else{_0xb034e=0xce;}_0x135069[_0x5abf('0x20')](_0xb034e);return _0x135069[_0x5abf('0x21')](_0x5abf('0x22'),_0x56b3cf+'-'+_0x5a2018+'/'+_0x1b89b0)[_0x5abf('0x1c')](_0x1e027c);}return null;};}function patchUpdates(_0x433a7e){return function(_0x5c1f3f){try{jsonpatch['apply'](_0x5c1f3f,_0x433a7e,!![]);}catch(_0x432874){return BPromise[_0x5abf('0x23')](_0x432874);}return _0x5c1f3f[_0x5abf('0x24')]();};}function saveUpdates(_0x3e45d3,_0x42e1fa){return function(_0x2eeb50){if(_0x2eeb50){return _0x2eeb50['update'](_0x3e45d3)[_0x5abf('0x25')](function(_0x28bdb9){return _0x28bdb9;});}return null;};}function removeEntity(_0x3c3ce5,_0x17c9cc){return function(_0x345af3){if(_0x345af3){return _0x345af3[_0x5abf('0x26')]()[_0x5abf('0x25')](function(){_0x3c3ce5[_0x5abf('0x20')](0xcc)[_0x5abf('0x1b')]();});}};}function handleEntityNotFound(_0x5de97c,_0xaa29e8){return function(_0x31e4d0){if(!_0x31e4d0){_0x5de97c[_0x5abf('0x1a')](0x194);}return _0x31e4d0;};}function handleError(_0x5b1979,_0x36e431){_0x36e431=_0x36e431||0x1f4;return function(_0xa047a0){logger['error'](_0xa047a0[_0x5abf('0x27')]);if(_0xa047a0[_0x5abf('0x28')]){delete _0xa047a0[_0x5abf('0x28')];}_0x5b1979[_0x5abf('0x20')](_0x36e431)[_0x5abf('0x29')](_0xa047a0);};}exports[_0x5abf('0x2a')]=function(_0x1ba373,_0x400b64){var _0x12e905={},_0x331255={},_0x13c7c3={'count':0x0,'rows':[]};var _0x4fddf1=_[_0x5abf('0x2b')](db['SalesforceField'][_0x5abf('0x2c')],function(_0xbf518b){return{'name':_0xbf518b[_0x5abf('0x2d')],'type':_0xbf518b[_0x5abf('0x2e')][_0x5abf('0x2f')]};});_0x331255[_0x5abf('0x30')]=_[_0x5abf('0x2b')](_0x4fddf1,'name');_0x331255['query']=_[_0x5abf('0x31')](_0x1ba373['query']);_0x331255[_0x5abf('0x32')]=_[_0x5abf('0x33')](_0x331255[_0x5abf('0x30')],_0x331255[_0x5abf('0x34')]);_0x12e905[_0x5abf('0x35')]=_['intersection'](_0x331255['model'],qs['fields'](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x36')]));_0x12e905[_0x5abf('0x35')]=_0x12e905['attributes'][_0x5abf('0x37')]?_0x12e905['attributes']:_0x331255[_0x5abf('0x30')];if(!_0x1ba373['query'][_0x5abf('0x38')]('nolimit')){_0x12e905[_0x5abf('0x1f')]=qs[_0x5abf('0x1f')](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x1f')]);_0x12e905[_0x5abf('0x1e')]=qs[_0x5abf('0x1e')](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x1e')]);}_0x12e905['order']=qs[_0x5abf('0x39')](_0x1ba373[_0x5abf('0x34')][_0x5abf('0x39')]);_0x12e905[_0x5abf('0x3a')]=qs[_0x5abf('0x32')](_[_0x5abf('0x3b')](_0x1ba373[_0x5abf('0x34')],_0x331255[_0x5abf('0x32')]),_0x4fddf1);if(_0x1ba373[_0x5abf('0x34')][_0x5abf('0x3c')]){_0x12e905[_0x5abf('0x3a')]=_[_0x5abf('0x3d')](_0x12e905[_0x5abf('0x3a')],{'$or':_[_0x5abf('0x2b')](_0x4fddf1,function(_0x68b0de){if(_0x68b0de[_0x5abf('0x2e')]!=='VIRTUAL'){var _0x93bc2={};_0x93bc2[_0x68b0de['name']]={'$like':'%'+_0x1ba373[_0x5abf('0x34')][_0x5abf('0x3c')]+'%'};return _0x93bc2;}})});}_0x12e905=_[_0x5abf('0x3d')]({},_0x12e905,_0x1ba373['options']);var _0x14e974={'where':_0x12e905[_0x5abf('0x3a')]};return db[_0x5abf('0x3e')][_0x5abf('0x1d')](_0x14e974)[_0x5abf('0x25')](function(_0x547dba){_0x13c7c3[_0x5abf('0x1d')]=_0x547dba;if(_0x1ba373['query'][_0x5abf('0x3f')]){_0x12e905[_0x5abf('0x40')]=[{'all':!![]}];}return db[_0x5abf('0x3e')][_0x5abf('0x41')](_0x12e905);})['then'](function(_0x404b9d){_0x13c7c3[_0x5abf('0x42')]=_0x404b9d;return _0x13c7c3;})[_0x5abf('0x25')](respondWithFilteredResult(_0x400b64,_0x12e905))['catch'](handleError(_0x400b64,null));};exports[_0x5abf('0x43')]=function(_0x18b7b2,_0x4040de){var _0x1d0010={'raw':!![],'where':{'id':_0x18b7b2[_0x5abf('0x44')]['id']}},_0x52964f={};_0x52964f['model']=_['keys'](db[_0x5abf('0x3e')]['rawAttributes']);_0x52964f[_0x5abf('0x34')]=_[_0x5abf('0x31')](_0x18b7b2['query']);_0x52964f[_0x5abf('0x32')]=_[_0x5abf('0x33')](_0x52964f[_0x5abf('0x30')],_0x52964f[_0x5abf('0x34')]);_0x1d0010[_0x5abf('0x35')]=_['intersection'](_0x52964f['model'],qs[_0x5abf('0x36')](_0x18b7b2[_0x5abf('0x34')][_0x5abf('0x36')]));_0x1d0010['attributes']=_0x1d0010[_0x5abf('0x35')][_0x5abf('0x37')]?_0x1d0010[_0x5abf('0x35')]:_0x52964f[_0x5abf('0x30')];if(_0x18b7b2[_0x5abf('0x34')]['includeAll']){_0x1d0010[_0x5abf('0x40')]=[{'all':!![]}];}_0x1d0010=_['merge']({},_0x1d0010,_0x18b7b2[_0x5abf('0x45')]);return db[_0x5abf('0x3e')]['find'](_0x1d0010)[_0x5abf('0x25')](handleEntityNotFound(_0x4040de,null))[_0x5abf('0x25')](respondWithResult(_0x4040de,null))[_0x5abf('0x46')](handleError(_0x4040de,null));};exports[_0x5abf('0x47')]=function(_0x190172,_0x5a8e2b){return db[_0x5abf('0x3e')][_0x5abf('0x47')](_0x190172[_0x5abf('0x48')],{})[_0x5abf('0x25')](respondWithResult(_0x5a8e2b,0xc9))['catch'](handleError(_0x5a8e2b,null));};exports[_0x5abf('0x49')]=function(_0x53c274,_0x29edf0){if(_0x53c274[_0x5abf('0x48')]['id']){delete _0x53c274[_0x5abf('0x48')]['id'];}return db[_0x5abf('0x3e')][_0x5abf('0x4a')]({'where':{'id':_0x53c274['params']['id']}})[_0x5abf('0x25')](handleEntityNotFound(_0x29edf0,null))[_0x5abf('0x25')](saveUpdates(_0x53c274['body'],null))['then'](respondWithResult(_0x29edf0,null))[_0x5abf('0x46')](handleError(_0x29edf0,null));};exports[_0x5abf('0x26')]=function(_0x343f71,_0x512cd8){return db[_0x5abf('0x3e')][_0x5abf('0x4a')]({'where':{'id':_0x343f71[_0x5abf('0x44')]['id']}})[_0x5abf('0x25')](handleEntityNotFound(_0x512cd8,null))[_0x5abf('0x25')](removeEntity(_0x512cd8,null))[_0x5abf('0x46')](handleError(_0x512cd8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6598f2b..84275c1 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 _0xe053=['define','SalesforceField','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','./intSalesforceField.attributes','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe053,0xac));var _0x3e05=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xe053[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0x3e05('0x0'));var util=require('util');var logger=require(_0x3e05('0x1'))(_0x3e05('0x2'));var moment=require(_0x3e05('0x3'));var BPromise=require(_0x3e05('0x4'));var rp=require(_0x3e05('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e05('0x6'));module[_0x3e05('0x7')]=function(_0x5b5bad,_0x4c44e4){return _0x5b5bad[_0x3e05('0x8')](_0x3e05('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x3e05('0xa'),'fields':[_0x3e05('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce55=['path','rimraf','exports','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xce55,0x10e));var _0x5ce5=function(_0x1f34d3,_0x3e2bb7){_0x1f34d3=_0x1f34d3-0x0;var _0x42313a=_0xce55[_0x1f34d3];return _0x42313a;};'use strict';var _=require(_0x5ce5('0x0'));var util=require(_0x5ce5('0x1'));var logger=require('../../config/logger')(_0x5ce5('0x2'));var moment=require(_0x5ce5('0x3'));var BPromise=require(_0x5ce5('0x4'));var rp=require(_0x5ce5('0x5'));var fs=require('fs');var path=require(_0x5ce5('0x6'));var rimraf=require(_0x5ce5('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x5ce5('0x8')]=function(_0x567cb3,_0x584fd8){return _0x567cb3['define']('SalesforceField',attributes,{'tableName':_0x5ce5('0x9'),'paranoid':![],'indexes':[{'name':_0x5ce5('0xa'),'fields':['idField',_0x5ce5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 47fd4b0..9bd3255 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 _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3c42ff,_0x45ee1f){var _0x4c0f6d=function(_0x3ec265){while(--_0x3ec265){_0x3c42ff['push'](_0x3c42ff['shift']());}};_0x4c0f6d(++_0x45ee1f);}(_0x5b02,0xe9));var _0x25b0=function(_0x53c44e,_0x559a30){_0x53c44e=_0x53c44e-0x0;var _0x12bb0e=_0x5b02[_0x53c44e];return _0x12bb0e;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x91a7=['message','SalesforceField,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x1550ed,_0x589486){var _0x5b5add=function(_0x2a2549){while(--_0x2a2549){_0x1550ed['push'](_0x1550ed['shift']());}};_0x5b5add(++_0x589486);}(_0x91a7,0xe7));var _0x791a=function(_0x1bcbcc,_0x462637){_0x1bcbcc=_0x1bcbcc-0x0;var _0x414fa3=_0x91a7[_0x1bcbcc];return _0x414fa3;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 599ddee..0d26932 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 _0xc3b5=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','get','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy'];(function(_0x3429c4,_0x4560ea){var _0x10048c=function(_0x21ce51){while(--_0x21ce51){_0x3429c4['push'](_0x3429c4['shift']());}};_0x10048c(++_0x4560ea);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x28e38b,_0x8faa02){_0x28e38b=_0x28e38b-0x0;var _0x5a8d5d=_0xc3b5[_0x28e38b];return _0x5a8d5d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var auth=require(_0x5c3b('0x4'));var interaction=require(_0x5c3b('0x5'));var config=require(_0x5c3b('0x6'));var controller=require(_0x5c3b('0x7'));router['get']('/',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x9')]);router['get'](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0xb')]);router[_0x5c3b('0xc')]('/:id/configurations',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xc')](_0x5c3b('0xe'),auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')]('/',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x11')]);router[_0x5c3b('0x10')]('/:id/configurations',auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x12')]);router['put'](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller['update']);router[_0x5c3b('0x13')](_0x5c3b('0xa'),auth[_0x5c3b('0x8')](),controller[_0x5c3b('0x14')]);module[_0x5c3b('0x15')]=router; \ No newline at end of file +var _0xc923=['put','update','multer','util','path','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration'];(function(_0x1f1b03,_0x18dea7){var _0x30d8e5=function(_0x5b3ce4){while(--_0x5b3ce4){_0x1f1b03['push'](_0x1f1b03['shift']());}};_0x30d8e5(++_0x18dea7);}(_0xc923,0x1ef));var _0x3c92=function(_0x5c1876,_0x8f7f57){_0x5c1876=_0x5c1876-0x0;var _0x400a10=_0xc923[_0x5c1876];return _0x400a10;};'use strict';var multer=require(_0x3c92('0x0'));var util=require(_0x3c92('0x1'));var path=require(_0x3c92('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c92('0x3'));var controller=require(_0x3c92('0x4'));router[_0x3c92('0x5')]('/',auth[_0x3c92('0x6')](),controller[_0x3c92('0x7')]);router[_0x3c92('0x5')](_0x3c92('0x8'),auth[_0x3c92('0x6')](),controller[_0x3c92('0x9')]);router['get'](_0x3c92('0xa'),auth[_0x3c92('0x6')](),controller[_0x3c92('0xb')]);router[_0x3c92('0x5')]('/:id/fields',auth[_0x3c92('0x6')](),controller['getFields']);router[_0x3c92('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c92('0xd')]);router[_0x3c92('0xc')](_0x3c92('0xa'),auth[_0x3c92('0x6')](),controller[_0x3c92('0xe')]);router[_0x3c92('0xf')]('/:id',auth[_0x3c92('0x6')](),controller[_0x3c92('0x10')]);router['delete'](_0x3c92('0x8'),auth[_0x3c92('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 539da81..a9ac170 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 _0xd40a=['STRING','username','sequelize'];(function(_0x4521d2,_0x2afd4f){var _0xdf24e3=function(_0x27c807){while(--_0x27c807){_0x4521d2['push'](_0x4521d2['shift']());}};_0xdf24e3(++_0x2afd4f);}(_0xd40a,0x176));var _0xad40=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd40a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xad40('0x0'));module['exports']={'name':{'type':Sequelize[_0xad40('0x1')]},'description':{'type':Sequelize[_0xad40('0x1')]},'username':{'type':Sequelize[_0xad40('0x1')],'unique':_0xad40('0x2')},'password':{'type':Sequelize[_0xad40('0x1')]},'email':{'type':Sequelize[_0xad40('0x1')]},'remoteUri':{'type':Sequelize[_0xad40('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xad40('0x1')]}}; \ No newline at end of file +var _0x42ae=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3c24c3,_0x39888b){var _0x23e5e0=function(_0x3b2415){while(--_0x3b2415){_0x3c24c3['push'](_0x3c24c3['shift']());}};_0x23e5e0(++_0x39888b);}(_0x42ae,0x137));var _0xe42a=function(_0x48aaca,_0x140945){_0x48aaca=_0x48aaca-0x0;var _0xac5ed9=_0x42ae[_0x48aaca];return _0xac5ed9;};'use strict';var Sequelize=require(_0xe42a('0x0'));module[_0xe42a('0x1')]={'name':{'type':Sequelize[_0xe42a('0x2')]},'description':{'type':Sequelize[_0xe42a('0x2')]},'username':{'type':Sequelize[_0xe42a('0x2')],'unique':_0xe42a('0x3')},'password':{'type':Sequelize[_0xe42a('0x2')]},'email':{'type':Sequelize[_0xe42a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe42a('0x4')},'serverUrl':{'type':Sequelize[_0xe42a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d5ff073..5ff4aa6 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 _0x6a08=['description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','boolean','True','sys_choice?sysparm_query=name=incident^element=','inactive','false','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','http','ValidationError','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','ServicenowAccount','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','Subjects','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_by','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list'];(function(_0x359b3a,_0x5d3cd1){var _0x3524db=function(_0x44d76a){while(--_0x44d76a){_0x359b3a['push'](_0x359b3a['shift']());}};_0x3524db(++_0x5d3cd1);}(_0x6a08,0xee));var _0x86a0=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x6a08[_0x2786ea];return _0x5c38e5;};'use strict';var pdf=require(_0x86a0('0x0'));var emlformat=require(_0x86a0('0x1'));var rimraf=require(_0x86a0('0x2'));var zipdir=require(_0x86a0('0x3'));var jsonpatch=require(_0x86a0('0x4'));var rp=require(_0x86a0('0x5'));var moment=require(_0x86a0('0x6'));var BPromise=require(_0x86a0('0x7'));var Mustache=require(_0x86a0('0x8'));var util=require(_0x86a0('0x9'));var path=require(_0x86a0('0xa'));var sox=require(_0x86a0('0xb'));var csv=require(_0x86a0('0xc'));var ejs=require(_0x86a0('0xd'));var fs=require('fs');var _=require(_0x86a0('0xe'));var squel=require(_0x86a0('0xf'));var crypto=require('crypto');var jsforce=require(_0x86a0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x86a0('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86a0('0x11'));var authService=require(_0x86a0('0x12'));var qs=require(_0x86a0('0x13'));var as=require(_0x86a0('0x14'));var hardwareService=require(_0x86a0('0x15'));var logger=require('../../config/logger')(_0x86a0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x86a0('0x17'))['db'];var integrations=require(_0x86a0('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x86a0('0x19')]({'port':0x232a});function checkPasswordPattern(_0x45977b,_0x44b791,_0x2b73b6){if(_0x2b73b6){var _0x2a4c5f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a4c5f['test'](_0x44b791)){return _0x45977b;}else{throw new db['Sequelize'][(_0x86a0('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 _0x45977b;}}function respondWithRpcPromise(_0x49a6cf,_0x134bc6,_0x20cd5f,_0x5c8d28){return new BPromise(function(_0x34ccae,_0x3ac7a5){var _0x4708d1=_0x5c8d28||client;return _0x4708d1[_0x86a0('0x1b')](_0x49a6cf,_0x20cd5f)['then'](function(_0x555dba){logger[_0x86a0('0x1c')](_0x86a0('0x1d'),_0x134bc6,_0x86a0('0x1e'));logger[_0x86a0('0x1f')](_0x86a0('0x20'),_0x134bc6,'request\x20sent',JSON[_0x86a0('0x21')](_0x555dba));if(_0x555dba[_0x86a0('0x22')]){if(_0x555dba[_0x86a0('0x22')]['code']===0x1f4){logger[_0x86a0('0x22')](_0x86a0('0x1d'),_0x134bc6,_0x555dba['error'][_0x86a0('0x23')]);return _0x3ac7a5(_0x555dba['error']['message']);}logger['error'](_0x86a0('0x1d'),_0x134bc6,_0x555dba['error']['message']);return _0x34ccae(_0x555dba[_0x86a0('0x22')]['message']);}else{logger[_0x86a0('0x1c')](_0x86a0('0x1d'),_0x134bc6,_0x86a0('0x1e'));_0x34ccae(_0x555dba[_0x86a0('0x24')][_0x86a0('0x23')]);}})[_0x86a0('0x25')](function(_0x5945cb){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x134bc6,_0x5945cb);_0x3ac7a5(_0x5945cb);});});}function respondWithStatusCode(_0x162838,_0x4c0046){_0x4c0046=_0x4c0046||0xcc;return function(_0x111694){if(_0x111694){return _0x162838[_0x86a0('0x26')](_0x4c0046);}return _0x162838[_0x86a0('0x27')](_0x4c0046)[_0x86a0('0x28')]();};}function respondWithResult(_0x3f630d,_0xd1403b){_0xd1403b=_0xd1403b||0xc8;return function(_0x5579fb){if(_0x5579fb){return _0x3f630d[_0x86a0('0x27')](_0xd1403b)[_0x86a0('0x29')](_0x5579fb);}};}function respondWithFilteredResult(_0x43bb76,_0x2defc8){return function(_0x5081e7){if(_0x5081e7){var _0x2f5e6e=_0x5081e7[_0x86a0('0x2a')],_0x1b821c=_0x2defc8[_0x86a0('0x2b')],_0x2d59cc=_0x2defc8[_0x86a0('0x2b')]+_0x2defc8['limit'],_0x13a4a0;if(_0x2d59cc>=_0x2f5e6e){_0x2d59cc=_0x2f5e6e;_0x13a4a0=0xc8;}else{_0x13a4a0=0xce;}_0x43bb76['status'](_0x13a4a0);return _0x43bb76[_0x86a0('0x2c')](_0x86a0('0x2d'),_0x1b821c+'-'+_0x2d59cc+'/'+_0x2f5e6e)[_0x86a0('0x29')](_0x5081e7);}return null;};}function patchUpdates(_0x1c1b54){return function(_0x133c29){try{jsonpatch[_0x86a0('0x2e')](_0x133c29,_0x1c1b54,!![]);}catch(_0x28c77d){return BPromise[_0x86a0('0x2f')](_0x28c77d);}return _0x133c29[_0x86a0('0x30')]();};}function saveUpdates(_0x8cf143,_0x4505f8){return function(_0xa5eb94){if(_0xa5eb94){return _0xa5eb94['update'](_0x8cf143)[_0x86a0('0x31')](function(_0x2aab48){return _0x2aab48;});}return null;};}function removeEntity(_0x4b863a,_0x48dd95){return function(_0x47420a){if(_0x47420a){return _0x47420a[_0x86a0('0x32')]()[_0x86a0('0x31')](function(){_0x4b863a[_0x86a0('0x27')](0xcc)[_0x86a0('0x28')]();});}};}function handleEntityNotFound(_0x95cb0,_0x37cf92){return function(_0x32f13e){if(!_0x32f13e){_0x95cb0[_0x86a0('0x26')](0x194);}return _0x32f13e;};}function handleError(_0x4f92d7,_0x308625){_0x308625=_0x308625||0x1f4;return function(_0x33411d){logger[_0x86a0('0x22')](_0x33411d[_0x86a0('0x33')]);if(_0x33411d[_0x86a0('0x34')]){delete _0x33411d[_0x86a0('0x34')];}_0x4f92d7[_0x86a0('0x27')](_0x308625)[_0x86a0('0x35')](_0x33411d);};}exports[_0x86a0('0x36')]=function(_0x367ce6,_0x36ff70){var _0x1e8837={},_0x3931bf={},_0x43cdbb={'count':0x0,'rows':[]};var _0x3d4eb1=_['map'](db[_0x86a0('0x37')][_0x86a0('0x38')],function(_0x1a6d9d){return{'name':_0x1a6d9d['fieldName'],'type':_0x1a6d9d[_0x86a0('0x39')][_0x86a0('0x3a')]};});_0x3931bf[_0x86a0('0x3b')]=_[_0x86a0('0x3c')](_0x3d4eb1,'name');_0x3931bf[_0x86a0('0x3d')]=_['keys'](_0x367ce6[_0x86a0('0x3d')]);_0x3931bf[_0x86a0('0x3e')]=_['intersection'](_0x3931bf[_0x86a0('0x3b')],_0x3931bf['query']);_0x1e8837[_0x86a0('0x3f')]=_[_0x86a0('0x40')](_0x3931bf[_0x86a0('0x3b')],qs[_0x86a0('0x41')](_0x367ce6['query']['fields']));_0x1e8837['attributes']=_0x1e8837[_0x86a0('0x3f')][_0x86a0('0x42')]?_0x1e8837[_0x86a0('0x3f')]:_0x3931bf[_0x86a0('0x3b')];if(!_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x43')]('nolimit')){_0x1e8837['limit']=qs[_0x86a0('0x44')](_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x44')]);_0x1e8837['offset']=qs[_0x86a0('0x2b')](_0x367ce6['query'][_0x86a0('0x2b')]);}_0x1e8837[_0x86a0('0x45')]=qs[_0x86a0('0x46')](_0x367ce6['query'][_0x86a0('0x46')]);_0x1e8837[_0x86a0('0x47')]=qs[_0x86a0('0x3e')](_['pick'](_0x367ce6[_0x86a0('0x3d')],_0x3931bf[_0x86a0('0x3e')]),_0x3d4eb1);if(_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x48')]){_0x1e8837['where']=_[_0x86a0('0x49')](_0x1e8837[_0x86a0('0x47')],{'$or':_['map'](_0x3d4eb1,function(_0x56ec72){if(_0x56ec72[_0x86a0('0x39')]!=='VIRTUAL'){var _0x204ff6={};_0x204ff6[_0x56ec72[_0x86a0('0x34')]]={'$like':'%'+_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x48')]+'%'};return _0x204ff6;}})});}_0x1e8837=_[_0x86a0('0x49')]({},_0x1e8837,_0x367ce6[_0x86a0('0x4a')]);var _0x1bcff8={'where':_0x1e8837[_0x86a0('0x47')]};return db['ServicenowAccount']['count'](_0x1bcff8)[_0x86a0('0x31')](function(_0x268c54){_0x43cdbb[_0x86a0('0x2a')]=_0x268c54;if(_0x367ce6[_0x86a0('0x3d')][_0x86a0('0x4b')]){_0x1e8837[_0x86a0('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x86a0('0x4d')](_0x1e8837);})[_0x86a0('0x31')](function(_0x15894f){_0x43cdbb[_0x86a0('0x4e')]=_0x15894f;return _0x43cdbb;})[_0x86a0('0x31')](respondWithFilteredResult(_0x36ff70,_0x1e8837))['catch'](handleError(_0x36ff70,null));};exports[_0x86a0('0x4f')]=function(_0x139280,_0x2e9982){var _0x3f7f8f={'raw':![],'where':{'id':_0x139280[_0x86a0('0x50')]['id']}},_0x4db435={};_0x4db435[_0x86a0('0x3b')]=_[_0x86a0('0x51')](db[_0x86a0('0x37')][_0x86a0('0x38')]);_0x4db435['query']=_[_0x86a0('0x51')](_0x139280[_0x86a0('0x3d')]);_0x4db435['filters']=_[_0x86a0('0x40')](_0x4db435[_0x86a0('0x3b')],_0x4db435[_0x86a0('0x3d')]);_0x3f7f8f[_0x86a0('0x3f')]=_[_0x86a0('0x40')](_0x4db435[_0x86a0('0x3b')],qs[_0x86a0('0x41')](_0x139280[_0x86a0('0x3d')][_0x86a0('0x41')]));_0x3f7f8f[_0x86a0('0x3f')]=_0x3f7f8f[_0x86a0('0x3f')][_0x86a0('0x42')]?_0x3f7f8f['attributes']:_0x4db435[_0x86a0('0x3b')];if(_0x139280[_0x86a0('0x3d')][_0x86a0('0x4b')]){_0x3f7f8f['include']=[{'all':!![]}];}_0x3f7f8f=_[_0x86a0('0x49')]({},_0x3f7f8f,_0x139280[_0x86a0('0x4a')]);return db['ServicenowAccount'][_0x86a0('0x52')](_0x3f7f8f)[_0x86a0('0x31')](handleEntityNotFound(_0x2e9982,null))[_0x86a0('0x31')](respondWithResult(_0x2e9982,null))[_0x86a0('0x25')](handleError(_0x2e9982,null));};exports[_0x86a0('0x53')]=function(_0x5b264b,_0x203159){return db[_0x86a0('0x37')][_0x86a0('0x53')](_0x5b264b[_0x86a0('0x54')],{})['then'](respondWithResult(_0x203159,0xc9))[_0x86a0('0x25')](handleError(_0x203159,null));};exports['update']=function(_0x480497,_0x1c051f){if(_0x480497['body']['id']){delete _0x480497[_0x86a0('0x54')]['id'];}return db[_0x86a0('0x37')][_0x86a0('0x52')]({'where':{'id':_0x480497[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0x1c051f,null))[_0x86a0('0x31')](saveUpdates(_0x480497[_0x86a0('0x54')],null))[_0x86a0('0x31')](respondWithResult(_0x1c051f,null))[_0x86a0('0x25')](handleError(_0x1c051f,null));};exports[_0x86a0('0x32')]=function(_0x484784,_0x45afbd){return db['ServicenowAccount'][_0x86a0('0x52')]({'where':{'id':_0x484784[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0x45afbd,null))[_0x86a0('0x31')](removeEntity(_0x45afbd,null))[_0x86a0('0x25')](handleError(_0x45afbd,null));};exports[_0x86a0('0x55')]=function(_0x47d7ba,_0xf90486,_0x2893e6){var _0x399f08={};var _0x2c678a={};var _0x294de3;var _0x470cb0;return db[_0x86a0('0x37')]['findOne']({'where':{'id':_0x47d7ba[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0xf90486,null))[_0x86a0('0x31')](function(_0x3f2da8){if(_0x3f2da8){_0x294de3=_0x3f2da8;_0x2c678a[_0x86a0('0x3b')]=_['keys'](db['ServicenowConfiguration'][_0x86a0('0x38')]);_0x2c678a['query']=_[_0x86a0('0x51')](_0x47d7ba['query']);_0x2c678a[_0x86a0('0x3e')]=_[_0x86a0('0x40')](_0x2c678a[_0x86a0('0x3b')],_0x2c678a[_0x86a0('0x3d')]);_0x399f08[_0x86a0('0x3f')]=_[_0x86a0('0x40')](_0x2c678a[_0x86a0('0x3b')],qs[_0x86a0('0x41')](_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x41')]));_0x399f08[_0x86a0('0x3f')]=_0x399f08[_0x86a0('0x3f')]['length']?_0x399f08[_0x86a0('0x3f')]:_0x2c678a['model'];_0x399f08[_0x86a0('0x45')]=qs['sort'](_0x47d7ba[_0x86a0('0x3d')]['sort']);_0x399f08['where']=qs[_0x86a0('0x3e')](_['pick'](_0x47d7ba['query'],_0x2c678a[_0x86a0('0x3e')]));if(_0x47d7ba['query'][_0x86a0('0x48')]){_0x399f08['where']=_[_0x86a0('0x49')](_0x399f08['where'],{'$or':_[_0x86a0('0x3c')](_0x399f08[_0x86a0('0x3f')],function(_0x32ed49){var _0x1a1de3={};_0x1a1de3[_0x32ed49]={'$like':'%'+_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x48')]+'%'};return _0x1a1de3;})});}_0x399f08=_[_0x86a0('0x49')]({},_0x399f08,_0x47d7ba[_0x86a0('0x4a')]);return _0x294de3['getConfigurations'](_0x399f08);}})[_0x86a0('0x31')](function(_0x270cf7){if(_0x270cf7){_0x470cb0=_0x270cf7[_0x86a0('0x42')];if(!_0x47d7ba['query'][_0x86a0('0x43')](_0x86a0('0x56'))){_0x399f08[_0x86a0('0x44')]=qs[_0x86a0('0x44')](_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x44')]);_0x399f08[_0x86a0('0x2b')]=qs[_0x86a0('0x2b')](_0x47d7ba[_0x86a0('0x3d')][_0x86a0('0x2b')]);}return _0x294de3['getConfigurations'](_0x399f08);}})[_0x86a0('0x31')](function(_0x284f08){if(_0x284f08){return _0x284f08?{'count':_0x470cb0,'rows':_0x284f08}:null;}})[_0x86a0('0x31')](respondWithResult(_0xf90486,null))[_0x86a0('0x25')](handleError(_0xf90486,null));};exports[_0x86a0('0x57')]=function(_0x2e8190,_0x7bbb91,_0x479cf3){if(_0x2e8190[_0x86a0('0x54')]['id']){delete _0x2e8190['body']['id'];}return db[_0x86a0('0x37')][_0x86a0('0x58')]({'where':{'id':_0x2e8190[_0x86a0('0x50')]['id']}})[_0x86a0('0x31')](handleEntityNotFound(_0x7bbb91,null))[_0x86a0('0x31')](function(_0x3d7811){if(_0x3d7811){_0x2e8190[_0x86a0('0x54')][_0x86a0('0x59')]=_0x3d7811['id'];_0x2e8190[_0x86a0('0x54')]['Subjects']=integrations[_0x86a0('0x5a')](_0x2e8190[_0x86a0('0x54')][_0x86a0('0x5b')],_0x2e8190[_0x86a0('0x54')][_0x86a0('0x39')]);_0x2e8190[_0x86a0('0x54')]['Descriptions']=integrations[_0x86a0('0x5c')](_0x2e8190[_0x86a0('0x54')][_0x86a0('0x5b')],_0x2e8190[_0x86a0('0x54')][_0x86a0('0x39')]);return db['ServicenowConfiguration'][_0x86a0('0x53')](_0x2e8190[_0x86a0('0x54')],{'include':[{'model':db['ServicenowField'],'as':_0x86a0('0x5d')},{'model':db[_0x86a0('0x5e')],'as':_0x86a0('0x5f')}]});}return null;})[_0x86a0('0x31')](respondWithResult(_0x7bbb91,null))[_0x86a0('0x25')](handleError(_0x7bbb91,null));};exports['getFields']=function(_0x45a869,_0x5940e5,_0x4462c3){var _0x3216e0=[_0x86a0('0x60'),_0x86a0('0x61'),_0x86a0('0x62'),_0x86a0('0x63'),_0x86a0('0x64'),_0x86a0('0x65'),_0x86a0('0x66'),_0x86a0('0x67'),'category'];var _0x2a784d=[_0x86a0('0x68'),_0x86a0('0x60'),_0x86a0('0x69'),_0x86a0('0x6a'),_0x86a0('0x6b'),_0x86a0('0x6c'),_0x86a0('0x6d'),_0x86a0('0x61'),_0x86a0('0x6e'),_0x86a0('0x6f'),_0x86a0('0x70'),'sys_updated_by',_0x86a0('0x71'),_0x86a0('0x72'),'sys_created_on','sys_domain','state',_0x86a0('0x73'),_0x86a0('0x62'),_0x86a0('0x45'),'calendar_stc','closed_at',_0x86a0('0x74'),_0x86a0('0x75'),_0x86a0('0x76'),_0x86a0('0x77'),'work_notes_list',_0x86a0('0x78'),_0x86a0('0x79'),_0x86a0('0x7a'),_0x86a0('0x7b'),'time_worked',_0x86a0('0x7c'),'opened_at',_0x86a0('0x7d'),_0x86a0('0x7e'),_0x86a0('0x7f'),_0x86a0('0x80'),_0x86a0('0x81'),_0x86a0('0x82'),_0x86a0('0x83'),_0x86a0('0x63'),'work_notes','short_description',_0x86a0('0x64'),_0x86a0('0x84'),_0x86a0('0x85'),_0x86a0('0x86'),_0x86a0('0x87'),_0x86a0('0x88'),_0x86a0('0x89'),_0x86a0('0x8a'),_0x86a0('0x8b'),_0x86a0('0x65'),_0x86a0('0x8c'),_0x86a0('0x8d'),_0x86a0('0x8e'),_0x86a0('0x8f'),_0x86a0('0x90'),_0x86a0('0x91'),'contact_type',_0x86a0('0x92'),_0x86a0('0x66'),'urgency',_0x86a0('0x93'),_0x86a0('0x94'),'reassignment_count',_0x86a0('0x95'),_0x86a0('0x96'),_0x86a0('0x67'),_0x86a0('0x97'),_0x86a0('0x98'),_0x86a0('0x99'),'comments_and_work_notes',_0x86a0('0x9a'),_0x86a0('0x9b'),_0x86a0('0x9c'),'sys_tags','escalation','upon_approval',_0x86a0('0x9d'),_0x86a0('0x9e'),'category'];var _0xec001a='';var _0x5597f8='';var _0x23ad30=[];var _0x342aef='';var _0x404d7d='';var _0x21d410=[];var _0x70baa8='';var _0x48d44d='';var _0x57290f={};var _0x3efcaf='';return db[_0x86a0('0x37')][_0x86a0('0x58')]({'where':{'id':_0x45a869[_0x86a0('0x50')]['id']},'attributes':['id',_0x86a0('0x9f'),_0x86a0('0xa0'),'email',_0x86a0('0xa1'),_0x86a0('0xa2')]})[_0x86a0('0x31')](handleEntityNotFound(_0x5940e5,null))[_0x86a0('0x31')](function(_0x1d8391){if(_0x1d8391){_0x3efcaf=_0x1d8391['remoteUri'];var _0x3c7113=_0x3efcaf[_0x86a0('0xa3')](-0x1);if(_0x3c7113==='/'){_0x3efcaf=_0x3efcaf[_0x86a0('0xa4')](0x0,_0x3efcaf['lastIndexOf'](_0x3c7113));}_0x48d44d=util['format'](_0x86a0('0xa5'),_0x3efcaf);_0x70baa8=util[_0x86a0('0xa6')](_0x86a0('0xa7'),_0x3efcaf);_0x57290f={'user':_0x1d8391[_0x86a0('0x9f')],'pass':_0x1d8391[_0x86a0('0xa0')]};var _0x30d37e={'method':_0x86a0('0xa8'),'uri':_0x48d44d+_0x86a0('0xa9'),'auth':_0x57290f,'json':!![]};return rp(_0x30d37e);}})[_0x86a0('0x31')](function(_0x4c59ab){if(_0x4c59ab['result']['length']>0x0){_0xec001a=_0x4c59ab['result'];}console[_0x86a0('0xaa')]('incident\x20table\x20objects',_0xec001a);_0x21d410=[];_0x5597f8=Object[_0x86a0('0xab')]([],_0xec001a);_[_0x86a0('0xac')](_0x5597f8,function(_0x3045f9){return!_0x3216e0[_0x86a0('0xad')](_0x3045f9[_0x86a0('0x34')]);});_0x5597f8[_0x86a0('0xae')](function(_0x37ba01){var _0x5197b8=createFieldObject(_0x70baa8,_0x57290f,_0x37ba01[_0x86a0('0xaf')],_0x37ba01[_0x86a0('0x34')],_0x37ba01[_0x86a0('0xb0')],![]);_0x21d410[_0x86a0('0xb1')](_0x5197b8);});return Promise[_0x86a0('0xb2')](_0x21d410);})[_0x86a0('0x31')](function(_0x4ab47c){_0x23ad30=_0x4ab47c;_0x342aef=Object[_0x86a0('0xab')]([],_0xec001a);console['log'](_0x86a0('0xb3'),_0xec001a);_[_0x86a0('0xac')](_0x342aef,function(_0x50db66){return _0x2a784d[_0x86a0('0xad')](_0x50db66[_0x86a0('0x34')]);});console[_0x86a0('0xaa')](_0x86a0('0xb4'),_0x342aef);_0x21d410=[];_0x342aef['forEach'](function(_0xbd72fc){var _0x44f845=createFieldObject(_0x70baa8,_0x57290f,_0xbd72fc[_0x86a0('0xaf')],_0xbd72fc[_0x86a0('0x34')],_0xbd72fc['label'],!![]);_0x21d410[_0x86a0('0xb1')](_0x44f845);});return Promise[_0x86a0('0xb2')](_0x21d410);})['then'](function(_0xe6d12f){_0x404d7d=_0xe6d12f;var _0x196a26=_0x23ad30['concat'](_0x404d7d);return{'count':_0x196a26[_0x86a0('0x42')],'rows':_0x196a26};})[_0x86a0('0x31')](respondWithResult(_0x5940e5,null))[_0x86a0('0x25')](function(_0x506384){console['log']('ServiceNow\x20error:\x20'+_0x506384);var _0x5f3213=_0x45a869[_0x86a0('0x3d')][_0x86a0('0xb5')]?0x1f4:_0x506384['statusCode']||0x1f4;logger[_0x86a0('0x22')](_0x506384[_0x86a0('0x33')]);delete _0x506384[_0x86a0('0x34')];if(_0x5f3213===0x191){_0x5f3213=0x190;}_0x5940e5[_0x86a0('0x27')](_0x5f3213)['send'](_0x45a869['query'][_0x86a0('0xb5')]?{'message':'Wrong\x20credentials','statusCode':_0x506384[_0x86a0('0xb6')]}:_0x506384);});};function createFieldObject(_0xef4a83,_0x2fa35b,_0x2c08bf,_0x371e8d,_0x23edbf,_0x2912c2){return new Promise(function(_0x269c50,_0xd70653){var _0x9d00a2={'id':_0x371e8d,'name':_0x23edbf,'custom':_0x2912c2};if(_0x2c08bf===_0x86a0('0xb7')){_0x9d00a2['options']=[{'name':_0x86a0('0xb8'),'value':'true'},{'name':'False','value':'false'}];_0x269c50(_0x9d00a2);}else{var _0x4a04fe={'method':_0x86a0('0xa8'),'uri':_0xef4a83+_0x86a0('0xb9')+_0x371e8d,'auth':_0x2fa35b,'json':!![]};return rp(_0x4a04fe)[_0x86a0('0x31')](function(_0x531be4){var _0x4ff578=[];if(_0x531be4[_0x86a0('0x24')]['length']>0x0){_0x531be4['result']['forEach'](function(_0x1ce7c0){if(_0x1ce7c0[_0x86a0('0xba')]===_0x86a0('0xbb')){var _0x49c507={'name':_0x1ce7c0[_0x86a0('0xb0')],'value':_0x1ce7c0['value']};_0x4ff578[_0x86a0('0xb1')](_0x49c507);}});}_0x9d00a2[_0x86a0('0x4a')]=_0x4ff578;if(_0x9d00a2[_0x86a0('0x4a')]['length']>0x0){_0x269c50(_0x9d00a2);}else{if(_0x2912c2==![]){_0x269c50();}else{_0x269c50(_0x9d00a2);}}});}});} \ No newline at end of file +var _0x3022=['inactive','value','html-pdf','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','ServicenowAccount','includeAll','include','findAll','rows','show','params','create','body','find','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','severity','category','parent','caused_by','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','statusCode','Wrong\x20credentials','boolean','True','False','false'];(function(_0x24686a,_0x4b929b){var _0x38fdb0=function(_0x4f1b16){while(--_0x4f1b16){_0x24686a['push'](_0x24686a['shift']());}};_0x38fdb0(++_0x4b929b);}(_0x3022,0xc1));var _0x2302=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x3022[_0x2fc012];return _0x2891f9;};'use strict';var pdf=require(_0x2302('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2302('0x1'));var zipdir=require(_0x2302('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2302('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2302('0x4'));var util=require(_0x2302('0x5'));var path=require('path');var sox=require(_0x2302('0x6'));var csv=require(_0x2302('0x7'));var ejs=require(_0x2302('0x8'));var fs=require('fs');var _=require(_0x2302('0x9'));var squel=require(_0x2302('0xa'));var crypto=require(_0x2302('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2302('0x7'));var querystring=require(_0x2302('0xc'));var Papa=require(_0x2302('0xd'));var Redis=require('ioredis');var authService=require(_0x2302('0xe'));var qs=require(_0x2302('0xf'));var as=require(_0x2302('0x10'));var hardwareService=require(_0x2302('0x11'));var logger=require(_0x2302('0x12'))(_0x2302('0x13'));var utils=require('../../config/utils');var config=require(_0x2302('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2302('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x2302('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x457f36,_0x3dbc67,_0x2692a0){if(_0x2692a0){var _0x45be16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45be16[_0x2302('0x17')](_0x3dbc67)){return _0x457f36;}else{throw new db[(_0x2302('0x18'))][(_0x2302('0x19'))](_0x2302('0x1a'));}}else{return _0x457f36;}}function respondWithRpcPromise(_0x2ae09b,_0x1f6601,_0x55ee81,_0x1e0b78){return new BPromise(function(_0x165a96,_0x4d16b7){var _0x2cada8=_0x1e0b78||client;return _0x2cada8['request'](_0x2ae09b,_0x55ee81)['then'](function(_0x59232f){logger[_0x2302('0x1b')](_0x2302('0x1c'),_0x1f6601,_0x2302('0x1d'));logger[_0x2302('0x1e')](_0x2302('0x1f'),_0x1f6601,_0x2302('0x1d'),JSON[_0x2302('0x20')](_0x59232f));if(_0x59232f[_0x2302('0x21')]){if(_0x59232f[_0x2302('0x21')]['code']===0x1f4){logger[_0x2302('0x21')](_0x2302('0x1c'),_0x1f6601,_0x59232f['error']['message']);return _0x4d16b7(_0x59232f['error'][_0x2302('0x22')]);}logger[_0x2302('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x1f6601,_0x59232f[_0x2302('0x21')][_0x2302('0x22')]);return _0x165a96(_0x59232f[_0x2302('0x21')]['message']);}else{logger[_0x2302('0x1b')](_0x2302('0x1c'),_0x1f6601,_0x2302('0x1d'));_0x165a96(_0x59232f['result'][_0x2302('0x22')]);}})[_0x2302('0x23')](function(_0xfb0439){logger[_0x2302('0x21')](_0x2302('0x1c'),_0x1f6601,_0xfb0439);_0x4d16b7(_0xfb0439);});});}function respondWithStatusCode(_0x1414f1,_0x5c22ca){_0x5c22ca=_0x5c22ca||0xcc;return function(_0x4f4b13){if(_0x4f4b13){return _0x1414f1[_0x2302('0x24')](_0x5c22ca);}return _0x1414f1[_0x2302('0x25')](_0x5c22ca)[_0x2302('0x26')]();};}function respondWithResult(_0x4cb342,_0x321d99){_0x321d99=_0x321d99||0xc8;return function(_0xb77d19){if(_0xb77d19){return _0x4cb342[_0x2302('0x25')](_0x321d99)[_0x2302('0x27')](_0xb77d19);}};}function respondWithFilteredResult(_0x16c1fc,_0x12ea1){return function(_0x3b3b9a){if(_0x3b3b9a){var _0x12462b=_0x3b3b9a[_0x2302('0x28')],_0x449118=_0x12ea1[_0x2302('0x29')],_0x6755e7=_0x12ea1[_0x2302('0x29')]+_0x12ea1[_0x2302('0x2a')],_0x424492;if(_0x6755e7>=_0x12462b){_0x6755e7=_0x12462b;_0x424492=0xc8;}else{_0x424492=0xce;}_0x16c1fc[_0x2302('0x25')](_0x424492);return _0x16c1fc[_0x2302('0x2b')](_0x2302('0x2c'),_0x449118+'-'+_0x6755e7+'/'+_0x12462b)[_0x2302('0x27')](_0x3b3b9a);}return null;};}function patchUpdates(_0x5b1dc8){return function(_0x37676f){try{jsonpatch[_0x2302('0x2d')](_0x37676f,_0x5b1dc8,!![]);}catch(_0x27979a){return BPromise[_0x2302('0x2e')](_0x27979a);}return _0x37676f[_0x2302('0x2f')]();};}function saveUpdates(_0x103093,_0x4bbf7b){return function(_0x56b376){if(_0x56b376){return _0x56b376[_0x2302('0x30')](_0x103093)[_0x2302('0x31')](function(_0x4eeaa5){return _0x4eeaa5;});}return null;};}function removeEntity(_0x115f1f,_0x4bda8f){return function(_0x56ecb1){if(_0x56ecb1){return _0x56ecb1[_0x2302('0x32')]()['then'](function(){_0x115f1f[_0x2302('0x25')](0xcc)[_0x2302('0x26')]();});}};}function handleEntityNotFound(_0x4bfae7,_0x12a999){return function(_0x45baaa){if(!_0x45baaa){_0x4bfae7['sendStatus'](0x194);}return _0x45baaa;};}function handleError(_0x41b297,_0x5d1931){_0x5d1931=_0x5d1931||0x1f4;return function(_0xcda7e3){logger[_0x2302('0x21')](_0xcda7e3[_0x2302('0x33')]);if(_0xcda7e3[_0x2302('0x34')]){delete _0xcda7e3[_0x2302('0x34')];}_0x41b297['status'](_0x5d1931)[_0x2302('0x35')](_0xcda7e3);};}exports['index']=function(_0x3ec396,_0x1b67ff){var _0x4b5955={},_0x9e0766={},_0x87f506={'count':0x0,'rows':[]};var _0x74b325=_[_0x2302('0x36')](db['ServicenowAccount'][_0x2302('0x37')],function(_0x3775c5){return{'name':_0x3775c5['fieldName'],'type':_0x3775c5['type'][_0x2302('0x38')]};});_0x9e0766[_0x2302('0x39')]=_[_0x2302('0x36')](_0x74b325,_0x2302('0x34'));_0x9e0766[_0x2302('0x3a')]=_[_0x2302('0x3b')](_0x3ec396['query']);_0x9e0766[_0x2302('0x3c')]=_['intersection'](_0x9e0766[_0x2302('0x39')],_0x9e0766[_0x2302('0x3a')]);_0x4b5955[_0x2302('0x3d')]=_[_0x2302('0x3e')](_0x9e0766[_0x2302('0x39')],qs[_0x2302('0x3f')](_0x3ec396[_0x2302('0x3a')][_0x2302('0x3f')]));_0x4b5955[_0x2302('0x3d')]=_0x4b5955[_0x2302('0x3d')][_0x2302('0x40')]?_0x4b5955[_0x2302('0x3d')]:_0x9e0766[_0x2302('0x39')];if(!_0x3ec396[_0x2302('0x3a')][_0x2302('0x41')](_0x2302('0x42'))){_0x4b5955['limit']=qs[_0x2302('0x2a')](_0x3ec396[_0x2302('0x3a')]['limit']);_0x4b5955[_0x2302('0x29')]=qs['offset'](_0x3ec396['query'][_0x2302('0x29')]);}_0x4b5955[_0x2302('0x43')]=qs[_0x2302('0x44')](_0x3ec396[_0x2302('0x3a')]['sort']);_0x4b5955[_0x2302('0x45')]=qs['filters'](_['pick'](_0x3ec396[_0x2302('0x3a')],_0x9e0766['filters']),_0x74b325);if(_0x3ec396['query'][_0x2302('0x46')]){_0x4b5955[_0x2302('0x45')]=_[_0x2302('0x47')](_0x4b5955[_0x2302('0x45')],{'$or':_[_0x2302('0x36')](_0x74b325,function(_0x1f9c75){if(_0x1f9c75[_0x2302('0x48')]!=='VIRTUAL'){var _0x3f8565={};_0x3f8565[_0x1f9c75[_0x2302('0x34')]]={'$like':'%'+_0x3ec396['query'][_0x2302('0x46')]+'%'};return _0x3f8565;}})});}_0x4b5955=_[_0x2302('0x47')]({},_0x4b5955,_0x3ec396[_0x2302('0x49')]);var _0x311f1d={'where':_0x4b5955[_0x2302('0x45')]};return db[_0x2302('0x4a')][_0x2302('0x28')](_0x311f1d)[_0x2302('0x31')](function(_0x109f84){_0x87f506[_0x2302('0x28')]=_0x109f84;if(_0x3ec396[_0x2302('0x3a')][_0x2302('0x4b')]){_0x4b5955[_0x2302('0x4c')]=[{'all':!![]}];}return db[_0x2302('0x4a')][_0x2302('0x4d')](_0x4b5955);})[_0x2302('0x31')](function(_0x3562a9){_0x87f506[_0x2302('0x4e')]=_0x3562a9;return _0x87f506;})[_0x2302('0x31')](respondWithFilteredResult(_0x1b67ff,_0x4b5955))[_0x2302('0x23')](handleError(_0x1b67ff,null));};exports[_0x2302('0x4f')]=function(_0x5654a7,_0x592c04){var _0x4b1c91={'raw':![],'where':{'id':_0x5654a7[_0x2302('0x50')]['id']}},_0x142766={};_0x142766[_0x2302('0x39')]=_[_0x2302('0x3b')](db[_0x2302('0x4a')]['rawAttributes']);_0x142766[_0x2302('0x3a')]=_[_0x2302('0x3b')](_0x5654a7[_0x2302('0x3a')]);_0x142766['filters']=_['intersection'](_0x142766[_0x2302('0x39')],_0x142766[_0x2302('0x3a')]);_0x4b1c91[_0x2302('0x3d')]=_['intersection'](_0x142766['model'],qs[_0x2302('0x3f')](_0x5654a7[_0x2302('0x3a')][_0x2302('0x3f')]));_0x4b1c91[_0x2302('0x3d')]=_0x4b1c91[_0x2302('0x3d')]['length']?_0x4b1c91[_0x2302('0x3d')]:_0x142766['model'];if(_0x5654a7[_0x2302('0x3a')]['includeAll']){_0x4b1c91[_0x2302('0x4c')]=[{'all':!![]}];}_0x4b1c91=_['merge']({},_0x4b1c91,_0x5654a7[_0x2302('0x49')]);return db['ServicenowAccount']['find'](_0x4b1c91)[_0x2302('0x31')](handleEntityNotFound(_0x592c04,null))['then'](respondWithResult(_0x592c04,null))[_0x2302('0x23')](handleError(_0x592c04,null));};exports[_0x2302('0x51')]=function(_0x4a177e,_0x2838e0){return db['ServicenowAccount'][_0x2302('0x51')](_0x4a177e['body'],{})['then'](respondWithResult(_0x2838e0,0xc9))[_0x2302('0x23')](handleError(_0x2838e0,null));};exports[_0x2302('0x30')]=function(_0x4bdb5d,_0x4beec3){if(_0x4bdb5d[_0x2302('0x52')]['id']){delete _0x4bdb5d[_0x2302('0x52')]['id'];}return db['ServicenowAccount'][_0x2302('0x53')]({'where':{'id':_0x4bdb5d[_0x2302('0x50')]['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x4beec3,null))['then'](saveUpdates(_0x4bdb5d[_0x2302('0x52')],null))['then'](respondWithResult(_0x4beec3,null))[_0x2302('0x23')](handleError(_0x4beec3,null));};exports[_0x2302('0x32')]=function(_0x315c05,_0x452c6c){return db[_0x2302('0x4a')][_0x2302('0x53')]({'where':{'id':_0x315c05[_0x2302('0x50')]['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x452c6c,null))[_0x2302('0x31')](removeEntity(_0x452c6c,null))[_0x2302('0x23')](handleError(_0x452c6c,null));};exports['getConfigurations']=function(_0x2f6fb4,_0x9ee10f,_0x19c162){var _0x3202ff={};var _0x426945={};var _0x3d451e;var _0x4fff7a;return db[_0x2302('0x4a')][_0x2302('0x54')]({'where':{'id':_0x2f6fb4[_0x2302('0x50')]['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x9ee10f,null))['then'](function(_0xc7ed1e){if(_0xc7ed1e){_0x3d451e=_0xc7ed1e;_0x426945[_0x2302('0x39')]=_[_0x2302('0x3b')](db[_0x2302('0x55')][_0x2302('0x37')]);_0x426945[_0x2302('0x3a')]=_[_0x2302('0x3b')](_0x2f6fb4[_0x2302('0x3a')]);_0x426945[_0x2302('0x3c')]=_['intersection'](_0x426945[_0x2302('0x39')],_0x426945[_0x2302('0x3a')]);_0x3202ff['attributes']=_['intersection'](_0x426945[_0x2302('0x39')],qs['fields'](_0x2f6fb4[_0x2302('0x3a')]['fields']));_0x3202ff[_0x2302('0x3d')]=_0x3202ff['attributes'][_0x2302('0x40')]?_0x3202ff[_0x2302('0x3d')]:_0x426945[_0x2302('0x39')];_0x3202ff[_0x2302('0x43')]=qs[_0x2302('0x44')](_0x2f6fb4[_0x2302('0x3a')][_0x2302('0x44')]);_0x3202ff['where']=qs[_0x2302('0x3c')](_[_0x2302('0x56')](_0x2f6fb4[_0x2302('0x3a')],_0x426945[_0x2302('0x3c')]));if(_0x2f6fb4[_0x2302('0x3a')][_0x2302('0x46')]){_0x3202ff['where']=_[_0x2302('0x47')](_0x3202ff['where'],{'$or':_['map'](_0x3202ff[_0x2302('0x3d')],function(_0x2617ec){var _0x5793ae={};_0x5793ae[_0x2617ec]={'$like':'%'+_0x2f6fb4[_0x2302('0x3a')][_0x2302('0x46')]+'%'};return _0x5793ae;})});}_0x3202ff=_[_0x2302('0x47')]({},_0x3202ff,_0x2f6fb4[_0x2302('0x49')]);return _0x3d451e[_0x2302('0x57')](_0x3202ff);}})[_0x2302('0x31')](function(_0x55a4f4){if(_0x55a4f4){_0x4fff7a=_0x55a4f4[_0x2302('0x40')];if(!_0x2f6fb4[_0x2302('0x3a')]['hasOwnProperty'](_0x2302('0x42'))){_0x3202ff[_0x2302('0x2a')]=qs[_0x2302('0x2a')](_0x2f6fb4[_0x2302('0x3a')]['limit']);_0x3202ff[_0x2302('0x29')]=qs[_0x2302('0x29')](_0x2f6fb4[_0x2302('0x3a')]['offset']);}return _0x3d451e['getConfigurations'](_0x3202ff);}})['then'](function(_0x251b80){if(_0x251b80){return _0x251b80?{'count':_0x4fff7a,'rows':_0x251b80}:null;}})[_0x2302('0x31')](respondWithResult(_0x9ee10f,null))[_0x2302('0x23')](handleError(_0x9ee10f,null));};exports[_0x2302('0x58')]=function(_0x5db548,_0x511e3a,_0x16f973){if(_0x5db548['body']['id']){delete _0x5db548[_0x2302('0x52')]['id'];}return db[_0x2302('0x4a')][_0x2302('0x54')]({'where':{'id':_0x5db548['params']['id']}})[_0x2302('0x31')](handleEntityNotFound(_0x511e3a,null))[_0x2302('0x31')](function(_0x17715e){if(_0x17715e){_0x5db548[_0x2302('0x52')][_0x2302('0x59')]=_0x17715e['id'];_0x5db548['body'][_0x2302('0x5a')]=integrations['getSubjects'](_0x5db548['body']['channel'],_0x5db548[_0x2302('0x52')][_0x2302('0x48')]);_0x5db548[_0x2302('0x52')][_0x2302('0x5b')]=integrations[_0x2302('0x5c')](_0x5db548[_0x2302('0x52')][_0x2302('0x5d')],_0x5db548['body'][_0x2302('0x48')]);return db[_0x2302('0x55')]['create'](_0x5db548[_0x2302('0x52')],{'include':[{'model':db['ServicenowField'],'as':_0x2302('0x5a')},{'model':db[_0x2302('0x5e')],'as':_0x2302('0x5b')}]});}return null;})[_0x2302('0x31')](respondWithResult(_0x511e3a,null))[_0x2302('0x23')](handleError(_0x511e3a,null));};exports[_0x2302('0x5f')]=function(_0x1ded29,_0x5a8c9c,_0x4a40e7){var _0x35790b=[_0x2302('0x60'),_0x2302('0x61'),_0x2302('0x62'),_0x2302('0x63'),_0x2302('0x64'),'notify','incident_state',_0x2302('0x65'),_0x2302('0x66')];var _0x2ce8cb=[_0x2302('0x67'),'made_sla',_0x2302('0x68'),'watch_list',_0x2302('0x69'),'sys_updated_on',_0x2302('0x6a'),_0x2302('0x61'),_0x2302('0x6b'),_0x2302('0x6c'),_0x2302('0x6d'),_0x2302('0x6e'),_0x2302('0x6f'),_0x2302('0x70'),_0x2302('0x71'),'sys_domain',_0x2302('0x72'),_0x2302('0x73'),'knowledge','order','calendar_stc',_0x2302('0x74'),_0x2302('0x75'),_0x2302('0x76'),_0x2302('0x77'),_0x2302('0x78'),_0x2302('0x79'),_0x2302('0x7a'),'priority',_0x2302('0x7b'),_0x2302('0x7c'),_0x2302('0x7d'),_0x2302('0x7e'),'opened_at',_0x2302('0x7f'),_0x2302('0x80'),_0x2302('0x81'),'reopened_time',_0x2302('0x82'),_0x2302('0x83'),'approval_set','subcategory','work_notes',_0x2302('0x84'),'close_code',_0x2302('0x85'),_0x2302('0x86'),_0x2302('0x87'),_0x2302('0x88'),_0x2302('0x89'),'additional_assignee_list',_0x2302('0x8a'),_0x2302('0x8b'),_0x2302('0x8c'),_0x2302('0x8d'),'close_notes',_0x2302('0x8e'),_0x2302('0x8f'),_0x2302('0x90'),'sys_id',_0x2302('0x91'),_0x2302('0x92'),'incident_state','urgency','problem_id',_0x2302('0x93'),'reassignment_count',_0x2302('0x94'),'assigned_to',_0x2302('0x65'),'comments',_0x2302('0x95'),_0x2302('0x96'),_0x2302('0x97'),_0x2302('0x98'),_0x2302('0x99'),_0x2302('0x9a'),'sys_tags',_0x2302('0x9b'),_0x2302('0x9c'),'correlation_id',_0x2302('0x9d'),_0x2302('0x66')];var _0x210caa='';var _0x406ce7='';var _0x1610ff=[];var _0x13a676='';var _0x35c3fe='';var _0x1b2ddc=[];var _0x1140a8='';var _0x9f7993='';var _0x674f6={};var _0x277ee3='';return db[_0x2302('0x4a')][_0x2302('0x54')]({'where':{'id':_0x1ded29['params']['id']},'attributes':['id',_0x2302('0x9e'),_0x2302('0x9f'),_0x2302('0xa0'),_0x2302('0xa1'),_0x2302('0xa2')]})[_0x2302('0x31')](handleEntityNotFound(_0x5a8c9c,null))['then'](function(_0x31218f){if(_0x31218f){_0x277ee3=_0x31218f[_0x2302('0xa1')];var _0x2b0b0f=_0x277ee3[_0x2302('0xa3')](-0x1);if(_0x2b0b0f==='/'){_0x277ee3=_0x277ee3[_0x2302('0xa4')](0x0,_0x277ee3[_0x2302('0xa5')](_0x2b0b0f));}_0x9f7993=util[_0x2302('0xa6')](_0x2302('0xa7'),_0x277ee3);_0x1140a8=util[_0x2302('0xa6')]('%s/api/now/table/',_0x277ee3);_0x674f6={'user':_0x31218f['username'],'pass':_0x31218f['password']};var _0x1a28af={'method':_0x2302('0xa8'),'uri':_0x9f7993+_0x2302('0xa9'),'auth':_0x674f6,'json':!![]};return rp(_0x1a28af);}})[_0x2302('0x31')](function(_0xb10a18){if(_0xb10a18[_0x2302('0xaa')][_0x2302('0x40')]>0x0){_0x210caa=_0xb10a18['result'];}console[_0x2302('0xab')](_0x2302('0xac'),_0x210caa);_0x1b2ddc=[];_0x406ce7=Object[_0x2302('0xad')]([],_0x210caa);_[_0x2302('0xae')](_0x406ce7,function(_0x4206bc){return!_0x35790b['includes'](_0x4206bc['name']);});_0x406ce7['forEach'](function(_0x1f1334){var _0x267034=createFieldObject(_0x1140a8,_0x674f6,_0x1f1334[_0x2302('0xaf')],_0x1f1334[_0x2302('0x34')],_0x1f1334[_0x2302('0xb0')],![]);_0x1b2ddc[_0x2302('0xb1')](_0x267034);});return Promise[_0x2302('0xb2')](_0x1b2ddc);})[_0x2302('0x31')](function(_0x5ab1bc){_0x1610ff=_0x5ab1bc;_0x13a676=Object[_0x2302('0xad')]([],_0x210caa);console['log'](_0x2302('0xb3'),_0x210caa);_[_0x2302('0xae')](_0x13a676,function(_0x4e0b7f){return _0x2ce8cb[_0x2302('0xb4')](_0x4e0b7f[_0x2302('0x34')]);});console['log'](_0x2302('0xb5'),_0x13a676);_0x1b2ddc=[];_0x13a676[_0x2302('0xb6')](function(_0x8955b5){var _0x5ee68b=createFieldObject(_0x1140a8,_0x674f6,_0x8955b5[_0x2302('0xaf')],_0x8955b5[_0x2302('0x34')],_0x8955b5[_0x2302('0xb0')],!![]);_0x1b2ddc[_0x2302('0xb1')](_0x5ee68b);});return Promise[_0x2302('0xb2')](_0x1b2ddc);})[_0x2302('0x31')](function(_0x21aeba){_0x35c3fe=_0x21aeba;var _0x19b79b=_0x1610ff['concat'](_0x35c3fe);return{'count':_0x19b79b['length'],'rows':_0x19b79b};})[_0x2302('0x31')](respondWithResult(_0x5a8c9c,null))[_0x2302('0x23')](function(_0x45a18d){console['log']('ServiceNow\x20error:\x20'+_0x45a18d);var _0x932ed3=_0x1ded29['query']['test']?0x1f4:_0x45a18d[_0x2302('0xb7')]||0x1f4;logger[_0x2302('0x21')](_0x45a18d[_0x2302('0x33')]);delete _0x45a18d[_0x2302('0x34')];if(_0x932ed3===0x191){_0x932ed3=0x190;}_0x5a8c9c['status'](_0x932ed3)[_0x2302('0x35')](_0x1ded29['query']['test']?{'message':_0x2302('0xb8'),'statusCode':_0x45a18d['statusCode']}:_0x45a18d);});};function createFieldObject(_0x22b98e,_0x231921,_0x27245c,_0x1051cf,_0x29b8eb,_0x1b4a03){return new Promise(function(_0x3fe351,_0x17d8b9){var _0x292beb={'id':_0x1051cf,'name':_0x29b8eb,'custom':_0x1b4a03};if(_0x27245c===_0x2302('0xb9')){_0x292beb['options']=[{'name':_0x2302('0xba'),'value':'true'},{'name':_0x2302('0xbb'),'value':_0x2302('0xbc')}];_0x3fe351(_0x292beb);}else{var _0x153e85={'method':_0x2302('0xa8'),'uri':_0x22b98e+'sys_choice?sysparm_query=name=incident^element='+_0x1051cf,'auth':_0x231921,'json':!![]};return rp(_0x153e85)['then'](function(_0x6c6d71){var _0xd5d85b=[];if(_0x6c6d71[_0x2302('0xaa')]['length']>0x0){_0x6c6d71[_0x2302('0xaa')][_0x2302('0xb6')](function(_0x475252){if(_0x475252[_0x2302('0xbd')]==='false'){var _0x198c61={'name':_0x475252[_0x2302('0xb0')],'value':_0x475252[_0x2302('0xbe')]};_0xd5d85b[_0x2302('0xb1')](_0x198c61);}});}_0x292beb[_0x2302('0x49')]=_0xd5d85b;if(_0x292beb['options']['length']>0x0){_0x3fe351(_0x292beb);}else{if(_0x1b4a03==![]){_0x3fe351();}else{_0x3fe351(_0x292beb);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5712c8c..befa8ea 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 _0xbad8=['../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0xa400b2,_0x59f736){var _0x326df3=function(_0x414c5a){while(--_0x414c5a){_0xa400b2['push'](_0xa400b2['shift']());}};_0x326df3(++_0x59f736);}(_0xbad8,0x179));var _0x8bad=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0xbad8[_0x3c2666];return _0x10c814;};'use strict';var _=require(_0x8bad('0x0'));var util=require(_0x8bad('0x1'));var logger=require('../../config/logger')(_0x8bad('0x2'));var moment=require(_0x8bad('0x3'));var BPromise=require(_0x8bad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bad('0x5'));var rimraf=require(_0x8bad('0x6'));var config=require(_0x8bad('0x7'));var attributes=require(_0x8bad('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8bad('0x9')]=function(_0x55c261,_0x58bd57){return _0x55c261[_0x8bad('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8bad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e5=['./intServicenowAccount.attributes','exports','define','ServicenowAccount','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0x44e5,0x1f3));var _0x544e=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x44e5[_0x39479f];return _0x4a6d96;};'use strict';var _=require(_0x544e('0x0'));var util=require(_0x544e('0x1'));var logger=require('../../config/logger')(_0x544e('0x2'));var moment=require(_0x544e('0x3'));var BPromise=require('bluebird');var rp=require(_0x544e('0x4'));var fs=require('fs');var path=require(_0x544e('0x5'));var rimraf=require(_0x544e('0x6'));var config=require('../../config/environment');var attributes=require(_0x544e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x544e('0x8')]=function(_0x186b24,_0x57ceb4){return _0x186b24[_0x544e('0x9')](_0x544e('0xa'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index c4806cb..ae8104d 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 _0x1ad6=['message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','catch','ShowServicenowAccount','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s'];(function(_0x4519f4,_0x5312fc){var _0x39cff9=function(_0x134199){while(--_0x134199){_0x4519f4['push'](_0x4519f4['shift']());}};_0x39cff9(++_0x5312fc);}(_0x1ad6,0x1dc));var _0x61ad=function(_0xa024b0,_0x104860){_0xa024b0=_0xa024b0-0x0;var _0x351d71=_0x1ad6[_0xa024b0];return _0x351d71;};'use strict';var _=require('lodash');var util=require(_0x61ad('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61ad('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ad('0x2'))['db'];var utils=require(_0x61ad('0x3'));var logger=require(_0x61ad('0x4'))(_0x61ad('0x5'));var config=require(_0x61ad('0x6'));var jayson=require(_0x61ad('0x7'));var client=jayson[_0x61ad('0x8')][_0x61ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32b347,_0x4dc97c,_0x27ac8b){return new BPromise(function(_0x5c8584,_0xd076cd){return client[_0x61ad('0xa')](_0x32b347,_0x27ac8b)[_0x61ad('0xb')](function(_0x572358){logger[_0x61ad('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4dc97c,'request\x20sent');logger[_0x61ad('0xd')](_0x61ad('0xe'),_0x4dc97c,_0x61ad('0xf'),JSON[_0x61ad('0x10')](_0x572358));if(_0x572358[_0x61ad('0x11')]){if(_0x572358[_0x61ad('0x11')]['code']===0x1f4){logger[_0x61ad('0x11')](_0x61ad('0x12'),_0x4dc97c,_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);return _0xd076cd(_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);}logger[_0x61ad('0x11')](_0x61ad('0x12'),_0x4dc97c,_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);return _0x5c8584(_0x572358[_0x61ad('0x11')][_0x61ad('0x13')]);}else{logger[_0x61ad('0xc')](_0x61ad('0x12'),_0x4dc97c,_0x61ad('0xf'));_0x5c8584(_0x572358[_0x61ad('0x14')]['message']);}})['catch'](function(_0x23b08c){logger[_0x61ad('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4dc97c,_0x23b08c);_0xd076cd(_0x23b08c);});});}exports[_0x61ad('0x15')]=function(_0x201a4b){var _0x31a4ed=this;return new Promise(function(_0x54b4fa,_0x1f449f){return db[_0x61ad('0x16')][_0x61ad('0x17')]({'raw':_0x201a4b[_0x61ad('0x18')]?_0x201a4b[_0x61ad('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x201a4b['options']?_0x201a4b[_0x61ad('0x18')][_0x61ad('0x19')]||null:null,'attributes':_0x201a4b[_0x61ad('0x18')]?_0x201a4b[_0x61ad('0x18')][_0x61ad('0x1a')]||null:null,'limit':_0x201a4b['options']?_0x201a4b[_0x61ad('0x18')]['limit']||null:null,'include':_0x201a4b['options']?_0x201a4b['options'][_0x61ad('0x1b')]?_[_0x61ad('0x1c')](_0x201a4b['options']['include'],function(_0x2a9fc2){return{'model':db[_0x2a9fc2[_0x61ad('0x1d')]],'as':_0x2a9fc2['as'],'attributes':_0x2a9fc2[_0x61ad('0x1a')],'include':_0x2a9fc2['include']?_[_0x61ad('0x1c')](_0x2a9fc2[_0x61ad('0x1b')],function(_0x47cdfd){return{'model':db[_0x47cdfd[_0x61ad('0x1d')]],'as':_0x47cdfd['as'],'attributes':_0x47cdfd[_0x61ad('0x1a')],'include':_0x47cdfd[_0x61ad('0x1b')]?_[_0x61ad('0x1c')](_0x47cdfd[_0x61ad('0x1b')],function(_0x1fe6f6){return{'model':db[_0x1fe6f6[_0x61ad('0x1d')]],'as':_0x1fe6f6['as'],'attributes':_0x1fe6f6[_0x61ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x61ad('0xb')](function(_0x2dc490){logger['info'](_0x61ad('0x15'),_0x201a4b);logger[_0x61ad('0xd')]('GetServicenowAccount',_0x201a4b,JSON[_0x61ad('0x10')](_0x2dc490));_0x54b4fa(_0x2dc490);})[_0x61ad('0x1e')](function(_0x5ed3f7){logger['error'](_0x61ad('0x15'),_0x5ed3f7['message'],_0x201a4b);_0x1f449f(_0x31a4ed[_0x61ad('0x11')](0x1f4,_0x5ed3f7[_0x61ad('0x13')]));});});};exports[_0x61ad('0x1f')]=function(_0x32f65c){var _0x595c57=this;return new Promise(function(_0x293b40,_0x167a02){return db[_0x61ad('0x16')][_0x61ad('0x20')]({'raw':_0x32f65c['options']?_0x32f65c[_0x61ad('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x32f65c[_0x61ad('0x18')]?_0x32f65c[_0x61ad('0x18')][_0x61ad('0x19')]||null:null,'attributes':_0x32f65c[_0x61ad('0x18')]?_0x32f65c[_0x61ad('0x18')][_0x61ad('0x1a')]||null:null,'include':_0x32f65c['options']?_0x32f65c[_0x61ad('0x18')][_0x61ad('0x1b')]?_[_0x61ad('0x1c')](_0x32f65c[_0x61ad('0x18')][_0x61ad('0x1b')],function(_0x4fc64){return{'model':db[_0x4fc64[_0x61ad('0x1d')]],'as':_0x4fc64['as'],'attributes':_0x4fc64[_0x61ad('0x1a')],'include':_0x4fc64[_0x61ad('0x1b')]?_['map'](_0x4fc64[_0x61ad('0x1b')],function(_0x118aaf){return{'model':db[_0x118aaf[_0x61ad('0x1d')]],'as':_0x118aaf['as'],'attributes':_0x118aaf[_0x61ad('0x1a')],'include':_0x118aaf[_0x61ad('0x1b')]?_['map'](_0x118aaf[_0x61ad('0x1b')],function(_0x24ca70){return{'model':db[_0x24ca70[_0x61ad('0x1d')]],'as':_0x24ca70['as'],'attributes':_0x24ca70[_0x61ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x61ad('0xb')](function(_0x3d7aca){logger[_0x61ad('0xc')](_0x61ad('0x1f'),_0x32f65c);logger[_0x61ad('0xd')](_0x61ad('0x1f'),_0x32f65c,JSON[_0x61ad('0x10')](_0x3d7aca));_0x293b40(_0x3d7aca);})[_0x61ad('0x1e')](function(_0x3c815c){logger[_0x61ad('0x11')](_0x61ad('0x1f'),_0x3c815c[_0x61ad('0x13')],_0x32f65c);_0x167a02(_0x595c57[_0x61ad('0x11')](0x1f4,_0x3c815c[_0x61ad('0x13')]));});});}; \ No newline at end of file +var _0x8c05=['message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d782b,_0x423255){var _0x4112fc=function(_0x58e7ee){while(--_0x58e7ee){_0x1d782b['push'](_0x1d782b['shift']());}};_0x4112fc(++_0x423255);}(_0x8c05,0x1a9));var _0x58c0=function(_0x22629d,_0x52081e){_0x22629d=_0x22629d-0x0;var _0x518a87=_0x8c05[_0x22629d];return _0x518a87;};'use strict';var _=require(_0x58c0('0x0'));var util=require(_0x58c0('0x1'));var moment=require(_0x58c0('0x2'));var BPromise=require(_0x58c0('0x3'));var rs=require(_0x58c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58c0('0x5'))['db'];var utils=require(_0x58c0('0x6'));var logger=require(_0x58c0('0x7'))(_0x58c0('0x8'));var config=require(_0x58c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58c0('0xa')][_0x58c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfcda7,_0x246615,_0xbb5cc1){return new BPromise(function(_0x1efc54,_0x2fc661){return client['request'](_0xfcda7,_0xbb5cc1)['then'](function(_0x4a0d43){logger[_0x58c0('0xc')](_0x58c0('0xd'),_0x246615,'request\x20sent');logger[_0x58c0('0xe')](_0x58c0('0xf'),_0x246615,'request\x20sent',JSON[_0x58c0('0x10')](_0x4a0d43));if(_0x4a0d43[_0x58c0('0x11')]){if(_0x4a0d43[_0x58c0('0x11')][_0x58c0('0x12')]===0x1f4){logger[_0x58c0('0x11')](_0x58c0('0xd'),_0x246615,_0x4a0d43['error'][_0x58c0('0x13')]);return _0x2fc661(_0x4a0d43['error']['message']);}logger[_0x58c0('0x11')](_0x58c0('0xd'),_0x246615,_0x4a0d43[_0x58c0('0x11')][_0x58c0('0x13')]);return _0x1efc54(_0x4a0d43['error']['message']);}else{logger[_0x58c0('0xc')](_0x58c0('0xd'),_0x246615,_0x58c0('0x14'));_0x1efc54(_0x4a0d43[_0x58c0('0x15')][_0x58c0('0x13')]);}})[_0x58c0('0x16')](function(_0x468db4){logger[_0x58c0('0x11')](_0x58c0('0xd'),_0x246615,_0x468db4);_0x2fc661(_0x468db4);});});}exports[_0x58c0('0x17')]=function(_0xcd3b1){var _0x3cd4ce=this;return new Promise(function(_0x296d68,_0x13a7b0){return db[_0x58c0('0x18')][_0x58c0('0x19')]({'raw':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x1b')]===undefined?!![]:![]:!![],'where':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x1c')]||null:null,'attributes':_0xcd3b1['options']?_0xcd3b1['options'][_0x58c0('0x1d')]||null:null,'limit':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x1e')]||null:null,'include':_0xcd3b1[_0x58c0('0x1a')]?_0xcd3b1[_0x58c0('0x1a')]['include']?_[_0x58c0('0x1f')](_0xcd3b1[_0x58c0('0x1a')][_0x58c0('0x20')],function(_0x18ff22){return{'model':db[_0x18ff22[_0x58c0('0x21')]],'as':_0x18ff22['as'],'attributes':_0x18ff22[_0x58c0('0x1d')],'include':_0x18ff22[_0x58c0('0x20')]?_['map'](_0x18ff22[_0x58c0('0x20')],function(_0x5cbcd0){return{'model':db[_0x5cbcd0[_0x58c0('0x21')]],'as':_0x5cbcd0['as'],'attributes':_0x5cbcd0[_0x58c0('0x1d')],'include':_0x5cbcd0['include']?_[_0x58c0('0x1f')](_0x5cbcd0[_0x58c0('0x20')],function(_0x5947a9){return{'model':db[_0x5947a9['model']],'as':_0x5947a9['as'],'attributes':_0x5947a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x58c0('0x22')](function(_0x47fa64){logger[_0x58c0('0xc')](_0x58c0('0x17'),_0xcd3b1);logger[_0x58c0('0xe')]('GetServicenowAccount',_0xcd3b1,JSON[_0x58c0('0x10')](_0x47fa64));_0x296d68(_0x47fa64);})['catch'](function(_0x3f0626){logger['error'](_0x58c0('0x17'),_0x3f0626['message'],_0xcd3b1);_0x13a7b0(_0x3cd4ce[_0x58c0('0x11')](0x1f4,_0x3f0626['message']));});});};exports[_0x58c0('0x23')]=function(_0x2d4e4f){var _0x178d20=this;return new Promise(function(_0xb0365e,_0x3f9b04){return db['ServicenowAccount'][_0x58c0('0x24')]({'raw':_0x2d4e4f[_0x58c0('0x1a')]?_0x2d4e4f[_0x58c0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d4e4f[_0x58c0('0x1a')]?_0x2d4e4f['options'][_0x58c0('0x1c')]||null:null,'attributes':_0x2d4e4f[_0x58c0('0x1a')]?_0x2d4e4f[_0x58c0('0x1a')][_0x58c0('0x1d')]||null:null,'include':_0x2d4e4f['options']?_0x2d4e4f[_0x58c0('0x1a')][_0x58c0('0x20')]?_[_0x58c0('0x1f')](_0x2d4e4f[_0x58c0('0x1a')]['include'],function(_0x3715d0){return{'model':db[_0x3715d0[_0x58c0('0x21')]],'as':_0x3715d0['as'],'attributes':_0x3715d0[_0x58c0('0x1d')],'include':_0x3715d0['include']?_[_0x58c0('0x1f')](_0x3715d0[_0x58c0('0x20')],function(_0x2e742d){return{'model':db[_0x2e742d[_0x58c0('0x21')]],'as':_0x2e742d['as'],'attributes':_0x2e742d[_0x58c0('0x1d')],'include':_0x2e742d[_0x58c0('0x20')]?_[_0x58c0('0x1f')](_0x2e742d[_0x58c0('0x20')],function(_0x2d3a61){return{'model':db[_0x2d3a61['model']],'as':_0x2d3a61['as'],'attributes':_0x2d3a61['attributes']};}):[]};}):[]};}):[]:[]})[_0x58c0('0x22')](function(_0xbe6b0c){logger[_0x58c0('0xc')](_0x58c0('0x23'),_0x2d4e4f);logger[_0x58c0('0xe')](_0x58c0('0x23'),_0x2d4e4f,JSON[_0x58c0('0x10')](_0xbe6b0c));_0xb0365e(_0xbe6b0c);})['catch'](function(_0x646f8b){logger[_0x58c0('0x11')](_0x58c0('0x23'),_0x646f8b['message'],_0x2d4e4f);_0x3f9b04(_0x178d20['error'](0x1f4,_0x646f8b[_0x58c0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index c2e1add..7637f4d 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 _0x2faa=['/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x107d12,_0x1fc016){var _0x4ecd5b=function(_0x5db5c2){while(--_0x5db5c2){_0x107d12['push'](_0x107d12['shift']());}};_0x4ecd5b(++_0x1fc016);}(_0x2faa,0xb4));var _0xa2fa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2faa[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xa2fa('0x0'));var util=require(_0xa2fa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa2fa('0x2'));var router=express['Router']();var auth=require(_0xa2fa('0x3'));var interaction=require(_0xa2fa('0x4'));var config=require(_0xa2fa('0x5'));var controller=require(_0xa2fa('0x6'));router[_0xa2fa('0x7')]('/',auth[_0xa2fa('0x8')](),controller['index']);router[_0xa2fa('0x7')](_0xa2fa('0x9'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0xa')]);router[_0xa2fa('0x7')](_0xa2fa('0xb'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0xc')]);router['get'](_0xa2fa('0xd'),auth[_0xa2fa('0x8')](),controller['getSubjects']);router[_0xa2fa('0x7')]('/:id/descriptions',auth[_0xa2fa('0x8')](),controller[_0xa2fa('0xe')]);router[_0xa2fa('0xf')]('/',auth[_0xa2fa('0x8')](),controller[_0xa2fa('0x10')]);router[_0xa2fa('0x11')](_0xa2fa('0x9'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0x12')]);router[_0xa2fa('0x13')](_0xa2fa('0x9'),auth[_0xa2fa('0x8')](),controller[_0xa2fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3152=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','show','/:id/fields'];(function(_0x38b80b,_0x589b3b){var _0x500f68=function(_0x2fa796){while(--_0x2fa796){_0x38b80b['push'](_0x38b80b['shift']());}};_0x500f68(++_0x589b3b);}(_0x3152,0x135));var _0x2315=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x3152[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0x2315('0x0'));var util=require(_0x2315('0x1'));var path=require(_0x2315('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2315('0x3')]();var auth=require(_0x2315('0x4'));var interaction=require(_0x2315('0x5'));var config=require(_0x2315('0x6'));var controller=require(_0x2315('0x7'));router[_0x2315('0x8')]('/',auth['isAuthenticated'](),controller[_0x2315('0x9')]);router[_0x2315('0x8')](_0x2315('0xa'),auth['isAuthenticated'](),controller[_0x2315('0xb')]);router['get'](_0x2315('0xc'),auth[_0x2315('0xd')](),controller[_0x2315('0xe')]);router[_0x2315('0x8')](_0x2315('0xf'),auth[_0x2315('0xd')](),controller[_0x2315('0x10')]);router['get'](_0x2315('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2315('0x12')]('/',auth[_0x2315('0xd')](),controller[_0x2315('0x13')]);router['put'](_0x2315('0xa'),auth[_0x2315('0xd')](),controller[_0x2315('0x14')]);router[_0x2315('0x15')](_0x2315('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2315('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index a33ca27..aaf165f 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 _0x2717=['STRING','sequelize','exports'];(function(_0x592ef9,_0x5ee38e){var _0x2b2ef4=function(_0x416d69){while(--_0x416d69){_0x592ef9['push'](_0x592ef9['shift']());}};_0x2b2ef4(++_0x5ee38e);}(_0x2717,0xd6));var _0x7271=function(_0x45840d,_0x361695){_0x45840d=_0x45840d-0x0;var _0x58a8f2=_0x2717[_0x45840d];return _0x58a8f2;};'use strict';var Sequelize=require(_0x7271('0x0'));module[_0x7271('0x1')]={'name':{'type':Sequelize[_0x7271('0x2')]},'description':{'type':Sequelize[_0x7271('0x2')]}}; \ No newline at end of file +var _0xda9c=['sequelize','exports','STRING'];(function(_0x29cde2,_0x3b0a07){var _0x36932a=function(_0x1d2824){while(--_0x1d2824){_0x29cde2['push'](_0x29cde2['shift']());}};_0x36932a(++_0x3b0a07);}(_0xda9c,0x10e));var _0xcda9=function(_0x50d6ef,_0x895eb9){_0x50d6ef=_0x50d6ef-0x0;var _0x6e3872=_0xda9c[_0x50d6ef];return _0x6e3872;};'use strict';var Sequelize=require(_0xcda9('0x0'));module[_0xcda9('0x1')]={'name':{'type':Sequelize[_0xcda9('0x2')]},'description':{'type':Sequelize[_0xcda9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8e41bca..20be00d 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 _0xd8b0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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~!@#$%^&-_=+[{]}.','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','limit','set','Content-Range','save','update','destroy','status','stack','name','send','ServicenowConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','findOne','length','order','pick','options','getFields','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring'];(function(_0x26d1c1,_0x143bcd){var _0x2f7b9d=function(_0x4d3548){while(--_0x4d3548){_0x26d1c1['push'](_0x26d1c1['shift']());}};_0x2f7b9d(++_0x143bcd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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'];var jayson=require(_0x0d8b('0x16'));var client=jayson[_0x0d8b('0x17')][_0x0d8b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x32bb1a,_0x15dd0f,_0x31a8cc){if(_0x31a8cc){var _0x1d4bbc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d4bbc[_0x0d8b('0x19')](_0x15dd0f)){return _0x32bb1a;}else{throw new db[(_0x0d8b('0x1a'))][(_0x0d8b('0x1b'))](_0x0d8b('0x1c'));}}else{return _0x32bb1a;}}function respondWithRpcPromise(_0x2d4e1c,_0x4f6f21,_0x23eb7b,_0xa86349){return new BPromise(function(_0x17f7df,_0xe2e167){var _0x2cb03c=_0xa86349||client;return _0x2cb03c['request'](_0x2d4e1c,_0x23eb7b)[_0x0d8b('0x1d')](function(_0x4586c2){logger[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0x4f6f21,_0x0d8b('0x20'));logger[_0x0d8b('0x21')](_0x0d8b('0x22'),_0x4f6f21,_0x0d8b('0x20'),JSON['stringify'](_0x4586c2));if(_0x4586c2[_0x0d8b('0x23')]){if(_0x4586c2[_0x0d8b('0x23')][_0x0d8b('0x24')]===0x1f4){logger[_0x0d8b('0x23')](_0x0d8b('0x1f'),_0x4f6f21,_0x4586c2[_0x0d8b('0x23')][_0x0d8b('0x25')]);return _0xe2e167(_0x4586c2[_0x0d8b('0x23')]['message']);}logger['error'](_0x0d8b('0x1f'),_0x4f6f21,_0x4586c2['error']['message']);return _0x17f7df(_0x4586c2['error'][_0x0d8b('0x25')]);}else{logger[_0x0d8b('0x1e')](_0x0d8b('0x1f'),_0x4f6f21,_0x0d8b('0x20'));_0x17f7df(_0x4586c2[_0x0d8b('0x26')][_0x0d8b('0x25')]);}})[_0x0d8b('0x27')](function(_0x4562cb){logger[_0x0d8b('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4f6f21,_0x4562cb);_0xe2e167(_0x4562cb);});});}function respondWithStatusCode(_0xe8bbee,_0x4463ee){_0x4463ee=_0x4463ee||0xcc;return function(_0x5363e3){if(_0x5363e3){return _0xe8bbee[_0x0d8b('0x28')](_0x4463ee);}return _0xe8bbee['status'](_0x4463ee)[_0x0d8b('0x29')]();};}function respondWithResult(_0x234bdd,_0xa2af02){_0xa2af02=_0xa2af02||0xc8;return function(_0x4fe6f9){if(_0x4fe6f9){return _0x234bdd['status'](_0xa2af02)[_0x0d8b('0x2a')](_0x4fe6f9);}};}function respondWithFilteredResult(_0x3ef745,_0x4c05ee){return function(_0xcbc4ac){if(_0xcbc4ac){var _0x59aa83=_0xcbc4ac['count'],_0x1b2b59=_0x4c05ee[_0x0d8b('0x2b')],_0x4b59e5=_0x4c05ee['offset']+_0x4c05ee[_0x0d8b('0x2c')],_0x97050a;if(_0x4b59e5>=_0x59aa83){_0x4b59e5=_0x59aa83;_0x97050a=0xc8;}else{_0x97050a=0xce;}_0x3ef745['status'](_0x97050a);return _0x3ef745[_0x0d8b('0x2d')](_0x0d8b('0x2e'),_0x1b2b59+'-'+_0x4b59e5+'/'+_0x59aa83)[_0x0d8b('0x2a')](_0xcbc4ac);}return null;};}function patchUpdates(_0x56120a){return function(_0x4c80a2){try{jsonpatch['apply'](_0x4c80a2,_0x56120a,!![]);}catch(_0x4e8992){return BPromise['reject'](_0x4e8992);}return _0x4c80a2[_0x0d8b('0x2f')]();};}function saveUpdates(_0x54f6f3,_0x5d05fc){return function(_0x36017a){if(_0x36017a){return _0x36017a[_0x0d8b('0x30')](_0x54f6f3)[_0x0d8b('0x1d')](function(_0xdeee5d){return _0xdeee5d;});}return null;};}function removeEntity(_0x183220,_0xeaa769){return function(_0x4a99d3){if(_0x4a99d3){return _0x4a99d3[_0x0d8b('0x31')]()['then'](function(){_0x183220[_0x0d8b('0x32')](0xcc)[_0x0d8b('0x29')]();});}};}function handleEntityNotFound(_0x4b3ea0,_0xb18586){return function(_0x23f7f6){if(!_0x23f7f6){_0x4b3ea0[_0x0d8b('0x28')](0x194);}return _0x23f7f6;};}function handleError(_0x4f2ed2,_0x113318){_0x113318=_0x113318||0x1f4;return function(_0x2c507e){logger[_0x0d8b('0x23')](_0x2c507e[_0x0d8b('0x33')]);if(_0x2c507e[_0x0d8b('0x34')]){delete _0x2c507e['name'];}_0x4f2ed2[_0x0d8b('0x32')](_0x113318)[_0x0d8b('0x35')](_0x2c507e);};}exports['index']=function(_0x1180ac,_0x3cc3ee){var _0x188af2={},_0x974b9b={},_0x373544={'count':0x0,'rows':[]};var _0x519088=_['map'](db[_0x0d8b('0x36')]['rawAttributes'],function(_0x531c55){return{'name':_0x531c55[_0x0d8b('0x37')],'type':_0x531c55[_0x0d8b('0x38')][_0x0d8b('0x39')]};});_0x974b9b[_0x0d8b('0x3a')]=_[_0x0d8b('0x3b')](_0x519088,_0x0d8b('0x34'));_0x974b9b['query']=_[_0x0d8b('0x3c')](_0x1180ac[_0x0d8b('0x3d')]);_0x974b9b[_0x0d8b('0x3e')]=_[_0x0d8b('0x3f')](_0x974b9b[_0x0d8b('0x3a')],_0x974b9b[_0x0d8b('0x3d')]);_0x188af2[_0x0d8b('0x40')]=_['intersection'](_0x974b9b[_0x0d8b('0x3a')],qs[_0x0d8b('0x41')](_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x188af2['attributes']=_0x188af2[_0x0d8b('0x40')]['length']?_0x188af2[_0x0d8b('0x40')]:_0x974b9b[_0x0d8b('0x3a')];if(!_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x42')](_0x0d8b('0x43'))){_0x188af2[_0x0d8b('0x2c')]=qs[_0x0d8b('0x2c')](_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x2c')]);_0x188af2[_0x0d8b('0x2b')]=qs['offset'](_0x1180ac['query']['offset']);}_0x188af2['order']=qs['sort'](_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x44')]);_0x188af2[_0x0d8b('0x45')]=qs['filters'](_['pick'](_0x1180ac[_0x0d8b('0x3d')],_0x974b9b[_0x0d8b('0x3e')]),_0x519088);if(_0x1180ac[_0x0d8b('0x3d')]['filter']){_0x188af2[_0x0d8b('0x45')]=_[_0x0d8b('0x46')](_0x188af2['where'],{'$or':_['map'](_0x519088,function(_0x372740){if(_0x372740['type']!==_0x0d8b('0x47')){var _0x5a96b1={};_0x5a96b1[_0x372740['name']]={'$like':'%'+_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x5a96b1;}})});}_0x188af2=_['merge']({},_0x188af2,_0x1180ac['options']);var _0x59b8e9={'where':_0x188af2['where']};return db[_0x0d8b('0x36')][_0x0d8b('0x49')](_0x59b8e9)[_0x0d8b('0x1d')](function(_0x490eda){_0x373544[_0x0d8b('0x49')]=_0x490eda;if(_0x1180ac[_0x0d8b('0x3d')][_0x0d8b('0x4a')]){_0x188af2[_0x0d8b('0x4b')]=[{'all':!![]}];}return db[_0x0d8b('0x36')][_0x0d8b('0x4c')](_0x188af2);})[_0x0d8b('0x1d')](function(_0x1d5067){_0x373544[_0x0d8b('0x4d')]=_0x1d5067;return _0x373544;})[_0x0d8b('0x1d')](respondWithFilteredResult(_0x3cc3ee,_0x188af2))[_0x0d8b('0x27')](handleError(_0x3cc3ee,null));};exports[_0x0d8b('0x4e')]=function(_0x84ef1c,_0x3e569b){var _0x570af8={'raw':![],'where':{'id':_0x84ef1c[_0x0d8b('0x4f')]['id']}},_0xdfcf32={};_0xdfcf32[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db['ServicenowConfiguration'][_0x0d8b('0x50')]);_0xdfcf32['query']=_['keys'](_0x84ef1c[_0x0d8b('0x3d')]);_0xdfcf32[_0x0d8b('0x3e')]=_[_0x0d8b('0x3f')](_0xdfcf32[_0x0d8b('0x3a')],_0xdfcf32['query']);_0x570af8[_0x0d8b('0x40')]=_[_0x0d8b('0x3f')](_0xdfcf32[_0x0d8b('0x3a')],qs[_0x0d8b('0x41')](_0x84ef1c[_0x0d8b('0x3d')]['fields']));_0x570af8['attributes']=_0x570af8['attributes']['length']?_0x570af8[_0x0d8b('0x40')]:_0xdfcf32[_0x0d8b('0x3a')];if(_0x84ef1c['query']['includeAll']){_0x570af8[_0x0d8b('0x4b')]=[{'all':!![]}];}_0x570af8=_[_0x0d8b('0x46')]({},_0x570af8,_0x84ef1c['options']);return db['ServicenowConfiguration'][_0x0d8b('0x51')](_0x570af8)[_0x0d8b('0x1d')](handleEntityNotFound(_0x3e569b,null))[_0x0d8b('0x1d')](respondWithResult(_0x3e569b,null))[_0x0d8b('0x27')](handleError(_0x3e569b,null));};exports[_0x0d8b('0x52')]=function(_0x506a79,_0x2de903){return db[_0x0d8b('0x36')]['create'](_0x506a79['body'],{})[_0x0d8b('0x1d')](respondWithResult(_0x2de903,0xc9))[_0x0d8b('0x27')](handleError(_0x2de903,null));};exports['update']=function(_0x55a489,_0xb8be3b){if(_0x55a489[_0x0d8b('0x53')]['id']){delete _0x55a489[_0x0d8b('0x53')]['id'];}return db[_0x0d8b('0x36')]['find']({'where':{'id':_0x55a489[_0x0d8b('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb8be3b,null))['then'](saveUpdates(_0x55a489[_0x0d8b('0x53')],null))[_0x0d8b('0x1d')](respondWithResult(_0xb8be3b,null))['catch'](handleError(_0xb8be3b,null));};exports['destroy']=function(_0x44ed23,_0x3d7161){return db[_0x0d8b('0x36')][_0x0d8b('0x51')]({'where':{'id':_0x44ed23[_0x0d8b('0x4f')]['id']}})[_0x0d8b('0x1d')](handleEntityNotFound(_0x3d7161,null))[_0x0d8b('0x1d')](removeEntity(_0x3d7161,null))[_0x0d8b('0x27')](handleError(_0x3d7161,null));};exports['getFields']=function(_0x24a859,_0x37dc9f,_0x3a3d33){var _0x3c7efb={};var _0x3fb9ea={};var _0x47104e;var _0x70c8c4;return db[_0x0d8b('0x36')][_0x0d8b('0x54')]({'where':{'id':_0x24a859['params']['id']}})[_0x0d8b('0x1d')](handleEntityNotFound(_0x37dc9f,null))[_0x0d8b('0x1d')](function(_0x180b7b){if(_0x180b7b){_0x47104e=_0x180b7b;_0x3fb9ea[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db['ServicenowField'][_0x0d8b('0x50')]);_0x3fb9ea[_0x0d8b('0x3d')]=_[_0x0d8b('0x3c')](_0x24a859[_0x0d8b('0x3d')]);_0x3fb9ea[_0x0d8b('0x3e')]=_['intersection'](_0x3fb9ea['model'],_0x3fb9ea[_0x0d8b('0x3d')]);_0x3c7efb[_0x0d8b('0x40')]=_[_0x0d8b('0x3f')](_0x3fb9ea[_0x0d8b('0x3a')],qs['fields'](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x3c7efb[_0x0d8b('0x40')]=_0x3c7efb['attributes'][_0x0d8b('0x55')]?_0x3c7efb['attributes']:_0x3fb9ea[_0x0d8b('0x3a')];_0x3c7efb[_0x0d8b('0x56')]=qs[_0x0d8b('0x44')](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x44')]);_0x3c7efb[_0x0d8b('0x45')]=qs['filters'](_[_0x0d8b('0x57')](_0x24a859['query'],_0x3fb9ea[_0x0d8b('0x3e')]));if(_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x48')]){_0x3c7efb[_0x0d8b('0x45')]=_['merge'](_0x3c7efb[_0x0d8b('0x45')],{'$or':_[_0x0d8b('0x3b')](_0x3c7efb[_0x0d8b('0x40')],function(_0x2332fc){var _0x2ccdae={};_0x2ccdae[_0x2332fc]={'$like':'%'+_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x2ccdae;})});}_0x3c7efb=_[_0x0d8b('0x46')]({},_0x3c7efb,_0x24a859[_0x0d8b('0x58')]);return _0x47104e[_0x0d8b('0x59')](_0x3c7efb);}})['then'](function(_0x4ee1e8){if(_0x4ee1e8){_0x70c8c4=_0x4ee1e8[_0x0d8b('0x55')];if(!_0x24a859[_0x0d8b('0x3d')]['hasOwnProperty'](_0x0d8b('0x43'))){_0x3c7efb['limit']=qs['limit'](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x2c')]);_0x3c7efb['offset']=qs['offset'](_0x24a859[_0x0d8b('0x3d')][_0x0d8b('0x2b')]);}return _0x47104e[_0x0d8b('0x59')](_0x3c7efb);}})[_0x0d8b('0x1d')](function(_0x2ab72b){if(_0x2ab72b){return _0x2ab72b?{'count':_0x70c8c4,'rows':_0x2ab72b}:null;}})[_0x0d8b('0x1d')](respondWithResult(_0x37dc9f,null))[_0x0d8b('0x27')](handleError(_0x37dc9f,null));};exports['getSubjects']=function(_0x1ca60c,_0x5878c2,_0x1a203e){var _0x2c6242={};var _0x2bb690={};var _0x14a34b;var _0x49f610;return db[_0x0d8b('0x36')]['findOne']({'where':{'id':_0x1ca60c[_0x0d8b('0x4f')]['id']}})[_0x0d8b('0x1d')](handleEntityNotFound(_0x5878c2,null))[_0x0d8b('0x1d')](function(_0x2ebea3){if(_0x2ebea3){_0x14a34b=_0x2ebea3;_0x2bb690[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db[_0x0d8b('0x5a')][_0x0d8b('0x50')]);_0x2bb690[_0x0d8b('0x3d')]=_[_0x0d8b('0x3c')](_0x1ca60c['query']);_0x2bb690[_0x0d8b('0x3e')]=_['intersection'](_0x2bb690[_0x0d8b('0x3a')],_0x2bb690[_0x0d8b('0x3d')]);_0x2c6242['attributes']=_[_0x0d8b('0x3f')](_0x2bb690['model'],qs[_0x0d8b('0x41')](_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x2c6242[_0x0d8b('0x40')]=_0x2c6242[_0x0d8b('0x40')][_0x0d8b('0x55')]?_0x2c6242[_0x0d8b('0x40')]:_0x2bb690[_0x0d8b('0x3a')];_0x2c6242['order']=qs[_0x0d8b('0x44')](_0x1ca60c[_0x0d8b('0x3d')]['sort']);_0x2c6242[_0x0d8b('0x45')]=qs[_0x0d8b('0x3e')](_[_0x0d8b('0x57')](_0x1ca60c[_0x0d8b('0x3d')],_0x2bb690[_0x0d8b('0x3e')]));if(_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x48')]){_0x2c6242[_0x0d8b('0x45')]=_[_0x0d8b('0x46')](_0x2c6242[_0x0d8b('0x45')],{'$or':_[_0x0d8b('0x3b')](_0x2c6242[_0x0d8b('0x40')],function(_0x50c0ff){var _0x1ece98={};_0x1ece98[_0x50c0ff]={'$like':'%'+_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x1ece98;})});}_0x2c6242=_['merge']({},_0x2c6242,_0x1ca60c['options']);return _0x14a34b[_0x0d8b('0x5b')](_0x2c6242);}})[_0x0d8b('0x1d')](function(_0x2c55bc){if(_0x2c55bc){_0x49f610=_0x2c55bc['length'];if(!_0x1ca60c['query'][_0x0d8b('0x42')](_0x0d8b('0x43'))){_0x2c6242[_0x0d8b('0x2c')]=qs[_0x0d8b('0x2c')](_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x2c')]);_0x2c6242[_0x0d8b('0x2b')]=qs[_0x0d8b('0x2b')](_0x1ca60c[_0x0d8b('0x3d')][_0x0d8b('0x2b')]);}return _0x14a34b[_0x0d8b('0x5b')](_0x2c6242);}})[_0x0d8b('0x1d')](function(_0x3b060e){if(_0x3b060e){return _0x3b060e?{'count':_0x49f610,'rows':_0x3b060e}:null;}})['then'](respondWithResult(_0x5878c2,null))[_0x0d8b('0x27')](handleError(_0x5878c2,null));};exports[_0x0d8b('0x5c')]=function(_0x48c965,_0x51c41b,_0x1a1029){var _0x1dad9f={};var _0x3573b4={};var _0x14b1b8;var _0x23e2e0;return db[_0x0d8b('0x36')]['findOne']({'where':{'id':_0x48c965['params']['id']}})['then'](handleEntityNotFound(_0x51c41b,null))[_0x0d8b('0x1d')](function(_0xce759e){if(_0xce759e){_0x14b1b8=_0xce759e;_0x3573b4[_0x0d8b('0x3a')]=_[_0x0d8b('0x3c')](db[_0x0d8b('0x5a')][_0x0d8b('0x50')]);_0x3573b4['query']=_[_0x0d8b('0x3c')](_0x48c965[_0x0d8b('0x3d')]);_0x3573b4['filters']=_[_0x0d8b('0x3f')](_0x3573b4['model'],_0x3573b4[_0x0d8b('0x3d')]);_0x1dad9f[_0x0d8b('0x40')]=_[_0x0d8b('0x3f')](_0x3573b4[_0x0d8b('0x3a')],qs[_0x0d8b('0x41')](_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x41')]));_0x1dad9f[_0x0d8b('0x40')]=_0x1dad9f[_0x0d8b('0x40')][_0x0d8b('0x55')]?_0x1dad9f[_0x0d8b('0x40')]:_0x3573b4[_0x0d8b('0x3a')];_0x1dad9f['order']=qs['sort'](_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x44')]);_0x1dad9f[_0x0d8b('0x45')]=qs[_0x0d8b('0x3e')](_[_0x0d8b('0x57')](_0x48c965[_0x0d8b('0x3d')],_0x3573b4[_0x0d8b('0x3e')]));if(_0x48c965['query'][_0x0d8b('0x48')]){_0x1dad9f['where']=_[_0x0d8b('0x46')](_0x1dad9f['where'],{'$or':_['map'](_0x1dad9f[_0x0d8b('0x40')],function(_0x460a36){var _0x25d99f={};_0x25d99f[_0x460a36]={'$like':'%'+_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x48')]+'%'};return _0x25d99f;})});}_0x1dad9f=_[_0x0d8b('0x46')]({},_0x1dad9f,_0x48c965[_0x0d8b('0x58')]);return _0x14b1b8[_0x0d8b('0x5c')](_0x1dad9f);}})[_0x0d8b('0x1d')](function(_0x20a8b6){if(_0x20a8b6){_0x23e2e0=_0x20a8b6[_0x0d8b('0x55')];if(!_0x48c965[_0x0d8b('0x3d')]['hasOwnProperty'](_0x0d8b('0x43'))){_0x1dad9f[_0x0d8b('0x2c')]=qs[_0x0d8b('0x2c')](_0x48c965['query']['limit']);_0x1dad9f[_0x0d8b('0x2b')]=qs[_0x0d8b('0x2b')](_0x48c965[_0x0d8b('0x3d')][_0x0d8b('0x2b')]);}return _0x14b1b8[_0x0d8b('0x5c')](_0x1dad9f);}})[_0x0d8b('0x1d')](function(_0x5648eb){if(_0x5648eb){return _0x5648eb?{'count':_0x23e2e0,'rows':_0x5648eb}:null;}})[_0x0d8b('0x1d')](respondWithResult(_0x51c41b,null))[_0x0d8b('0x27')](handleError(_0x51c41b,null));}; \ No newline at end of file +var _0xb62e=['body','getFields','findOne','ServicenowField','options','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','apply','reject','save','destroy','sendStatus','stack','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','name','filter','merge','include','ServicenowConfiguration','findAll','show','params','rawAttributes','includeAll','find','catch','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var db=require(_0xeb62('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xeb62('0x1a')][_0xeb62('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x27671e,_0x6822bc,_0x55a629){if(_0x55a629){var _0x333126=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x333126[_0xeb62('0x1c')](_0x6822bc)){return _0x27671e;}else{throw new db[(_0xeb62('0x1d'))]['ValidationError'](_0xeb62('0x1e'));}}else{return _0x27671e;}}function respondWithRpcPromise(_0x195837,_0x2fd4c7,_0x4ce9fa,_0x1f6a1f){return new BPromise(function(_0x15b3e8,_0x184106){var _0x353e2c=_0x1f6a1f||client;return _0x353e2c[_0xeb62('0x1f')](_0x195837,_0x4ce9fa)[_0xeb62('0x20')](function(_0x1fb460){logger[_0xeb62('0x21')](_0xeb62('0x22'),_0x2fd4c7,_0xeb62('0x23'));logger[_0xeb62('0x24')](_0xeb62('0x25'),_0x2fd4c7,_0xeb62('0x23'),JSON['stringify'](_0x1fb460));if(_0x1fb460[_0xeb62('0x26')]){if(_0x1fb460[_0xeb62('0x26')][_0xeb62('0x27')]===0x1f4){logger[_0xeb62('0x26')](_0xeb62('0x22'),_0x2fd4c7,_0x1fb460[_0xeb62('0x26')][_0xeb62('0x28')]);return _0x184106(_0x1fb460['error']['message']);}logger[_0xeb62('0x26')](_0xeb62('0x22'),_0x2fd4c7,_0x1fb460[_0xeb62('0x26')][_0xeb62('0x28')]);return _0x15b3e8(_0x1fb460[_0xeb62('0x26')]['message']);}else{logger['info'](_0xeb62('0x22'),_0x2fd4c7,_0xeb62('0x23'));_0x15b3e8(_0x1fb460[_0xeb62('0x29')][_0xeb62('0x28')]);}})['catch'](function(_0x4e92f5){logger[_0xeb62('0x26')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2fd4c7,_0x4e92f5);_0x184106(_0x4e92f5);});});}function respondWithStatusCode(_0x448327,_0x4b0f46){_0x4b0f46=_0x4b0f46||0xcc;return function(_0xfe3e16){if(_0xfe3e16){return _0x448327['sendStatus'](_0x4b0f46);}return _0x448327[_0xeb62('0x2a')](_0x4b0f46)[_0xeb62('0x2b')]();};}function respondWithResult(_0x46d1bb,_0x4e4268){_0x4e4268=_0x4e4268||0xc8;return function(_0x3ef784){if(_0x3ef784){return _0x46d1bb[_0xeb62('0x2a')](_0x4e4268)[_0xeb62('0x2c')](_0x3ef784);}};}function respondWithFilteredResult(_0xe8872c,_0x42f486){return function(_0x360efd){if(_0x360efd){var _0x511202=_0x360efd[_0xeb62('0x2d')],_0x192517=_0x42f486[_0xeb62('0x2e')],_0x1616ee=_0x42f486[_0xeb62('0x2e')]+_0x42f486[_0xeb62('0x2f')],_0x57169a;if(_0x1616ee>=_0x511202){_0x1616ee=_0x511202;_0x57169a=0xc8;}else{_0x57169a=0xce;}_0xe8872c[_0xeb62('0x2a')](_0x57169a);return _0xe8872c['set']('Content-Range',_0x192517+'-'+_0x1616ee+'/'+_0x511202)[_0xeb62('0x2c')](_0x360efd);}return null;};}function patchUpdates(_0x357cf4){return function(_0x1607ef){try{jsonpatch[_0xeb62('0x30')](_0x1607ef,_0x357cf4,!![]);}catch(_0x42b197){return BPromise[_0xeb62('0x31')](_0x42b197);}return _0x1607ef[_0xeb62('0x32')]();};}function saveUpdates(_0x4be25d,_0x411062){return function(_0x47a94b){if(_0x47a94b){return _0x47a94b['update'](_0x4be25d)[_0xeb62('0x20')](function(_0x286455){return _0x286455;});}return null;};}function removeEntity(_0x4978e8,_0x1ade38){return function(_0x4bcfce){if(_0x4bcfce){return _0x4bcfce[_0xeb62('0x33')]()[_0xeb62('0x20')](function(){_0x4978e8['status'](0xcc)[_0xeb62('0x2b')]();});}};}function handleEntityNotFound(_0xe2589,_0x5914c9){return function(_0x1b3a60){if(!_0x1b3a60){_0xe2589[_0xeb62('0x34')](0x194);}return _0x1b3a60;};}function handleError(_0x38b116,_0x2203cb){_0x2203cb=_0x2203cb||0x1f4;return function(_0x513dd8){logger[_0xeb62('0x26')](_0x513dd8[_0xeb62('0x35')]);if(_0x513dd8['name']){delete _0x513dd8['name'];}_0x38b116[_0xeb62('0x2a')](_0x2203cb)[_0xeb62('0x36')](_0x513dd8);};}exports['index']=function(_0x338ab7,_0x30cff0){var _0x11eadb={},_0x1f839a={},_0x21f604={'count':0x0,'rows':[]};var _0x15387a=_[_0xeb62('0x37')](db['ServicenowConfiguration']['rawAttributes'],function(_0x3306e3){return{'name':_0x3306e3[_0xeb62('0x38')],'type':_0x3306e3[_0xeb62('0x39')][_0xeb62('0x3a')]};});_0x1f839a['model']=_[_0xeb62('0x37')](_0x15387a,'name');_0x1f839a[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x338ab7[_0xeb62('0x3b')]);_0x1f839a[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x1f839a[_0xeb62('0x3f')],_0x1f839a[_0xeb62('0x3b')]);_0x11eadb[_0xeb62('0x40')]=_['intersection'](_0x1f839a[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x11eadb['attributes']=_0x11eadb['attributes'][_0xeb62('0x42')]?_0x11eadb[_0xeb62('0x40')]:_0x1f839a['model'];if(!_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x43')]('nolimit')){_0x11eadb[_0xeb62('0x2f')]=qs['limit'](_0x338ab7[_0xeb62('0x3b')]['limit']);_0x11eadb[_0xeb62('0x2e')]=qs['offset'](_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x2e')]);}_0x11eadb[_0xeb62('0x44')]=qs['sort'](_0x338ab7['query'][_0xeb62('0x45')]);_0x11eadb[_0xeb62('0x46')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x338ab7[_0xeb62('0x3b')],_0x1f839a['filters']),_0x15387a);if(_0x338ab7[_0xeb62('0x3b')]['filter']){_0x11eadb[_0xeb62('0x46')]=_['merge'](_0x11eadb[_0xeb62('0x46')],{'$or':_['map'](_0x15387a,function(_0x26c77d){if(_0x26c77d['type']!==_0xeb62('0x48')){var _0x4624e7={};_0x4624e7[_0x26c77d[_0xeb62('0x49')]]={'$like':'%'+_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x4624e7;}})});}_0x11eadb=_[_0xeb62('0x4b')]({},_0x11eadb,_0x338ab7['options']);var _0x19af97={'where':_0x11eadb[_0xeb62('0x46')]};return db['ServicenowConfiguration']['count'](_0x19af97)['then'](function(_0x4d4c5a){_0x21f604[_0xeb62('0x2d')]=_0x4d4c5a;if(_0x338ab7[_0xeb62('0x3b')]['includeAll']){_0x11eadb[_0xeb62('0x4c')]=[{'all':!![]}];}return db[_0xeb62('0x4d')][_0xeb62('0x4e')](_0x11eadb);})[_0xeb62('0x20')](function(_0x39595c){_0x21f604['rows']=_0x39595c;return _0x21f604;})[_0xeb62('0x20')](respondWithFilteredResult(_0x30cff0,_0x11eadb))['catch'](handleError(_0x30cff0,null));};exports[_0xeb62('0x4f')]=function(_0x2cf2b5,_0x7fb53f){var _0x18c40d={'raw':![],'where':{'id':_0x2cf2b5[_0xeb62('0x50')]['id']}},_0x1f2d87={};_0x1f2d87[_0xeb62('0x3f')]=_[_0xeb62('0x3c')](db[_0xeb62('0x4d')][_0xeb62('0x51')]);_0x1f2d87[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x2cf2b5['query']);_0x1f2d87[_0xeb62('0x3d')]=_['intersection'](_0x1f2d87['model'],_0x1f2d87[_0xeb62('0x3b')]);_0x18c40d[_0xeb62('0x40')]=_['intersection'](_0x1f2d87[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x2cf2b5['query'][_0xeb62('0x41')]));_0x18c40d[_0xeb62('0x40')]=_0x18c40d[_0xeb62('0x40')][_0xeb62('0x42')]?_0x18c40d[_0xeb62('0x40')]:_0x1f2d87[_0xeb62('0x3f')];if(_0x2cf2b5[_0xeb62('0x3b')][_0xeb62('0x52')]){_0x18c40d['include']=[{'all':!![]}];}_0x18c40d=_[_0xeb62('0x4b')]({},_0x18c40d,_0x2cf2b5['options']);return db[_0xeb62('0x4d')][_0xeb62('0x53')](_0x18c40d)[_0xeb62('0x20')](handleEntityNotFound(_0x7fb53f,null))[_0xeb62('0x20')](respondWithResult(_0x7fb53f,null))[_0xeb62('0x54')](handleError(_0x7fb53f,null));};exports[_0xeb62('0x55')]=function(_0xc3aee0,_0xf12d72){return db['ServicenowConfiguration']['create'](_0xc3aee0['body'],{})['then'](respondWithResult(_0xf12d72,0xc9))[_0xeb62('0x54')](handleError(_0xf12d72,null));};exports['update']=function(_0x3876ca,_0x5c0e7f){if(_0x3876ca[_0xeb62('0x56')]['id']){delete _0x3876ca[_0xeb62('0x56')]['id'];}return db[_0xeb62('0x4d')]['find']({'where':{'id':_0x3876ca[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x5c0e7f,null))['then'](saveUpdates(_0x3876ca[_0xeb62('0x56')],null))[_0xeb62('0x20')](respondWithResult(_0x5c0e7f,null))[_0xeb62('0x54')](handleError(_0x5c0e7f,null));};exports[_0xeb62('0x33')]=function(_0x55370c,_0x3be3e1){return db[_0xeb62('0x4d')]['find']({'where':{'id':_0x55370c[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x3be3e1,null))[_0xeb62('0x20')](removeEntity(_0x3be3e1,null))[_0xeb62('0x54')](handleError(_0x3be3e1,null));};exports[_0xeb62('0x57')]=function(_0x46da69,_0x3e55bf,_0x1b354d){var _0x222d0c={};var _0x1db841={};var _0x130153;var _0x15c93f;return db[_0xeb62('0x4d')][_0xeb62('0x58')]({'where':{'id':_0x46da69[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x3e55bf,null))['then'](function(_0x5550b6){if(_0x5550b6){_0x130153=_0x5550b6;_0x1db841['model']=_['keys'](db[_0xeb62('0x59')]['rawAttributes']);_0x1db841[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x46da69[_0xeb62('0x3b')]);_0x1db841[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x1db841[_0xeb62('0x3f')],_0x1db841[_0xeb62('0x3b')]);_0x222d0c[_0xeb62('0x40')]=_[_0xeb62('0x3e')](_0x1db841[_0xeb62('0x3f')],qs['fields'](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x222d0c[_0xeb62('0x40')]=_0x222d0c[_0xeb62('0x40')]['length']?_0x222d0c[_0xeb62('0x40')]:_0x1db841[_0xeb62('0x3f')];_0x222d0c[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x45')]);_0x222d0c[_0xeb62('0x46')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x46da69[_0xeb62('0x3b')],_0x1db841[_0xeb62('0x3d')]));if(_0x46da69['query'][_0xeb62('0x4a')]){_0x222d0c[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x222d0c[_0xeb62('0x46')],{'$or':_[_0xeb62('0x37')](_0x222d0c[_0xeb62('0x40')],function(_0x388b31){var _0x1dcc91={};_0x1dcc91[_0x388b31]={'$like':'%'+_0x46da69[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x1dcc91;})});}_0x222d0c=_['merge']({},_0x222d0c,_0x46da69[_0xeb62('0x5a')]);return _0x130153[_0xeb62('0x57')](_0x222d0c);}})[_0xeb62('0x20')](function(_0xdd124f){if(_0xdd124f){_0x15c93f=_0xdd124f['length'];if(!_0x46da69[_0xeb62('0x3b')][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x222d0c[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x46da69[_0xeb62('0x3b')]['limit']);_0x222d0c[_0xeb62('0x2e')]=qs[_0xeb62('0x2e')](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x130153[_0xeb62('0x57')](_0x222d0c);}})[_0xeb62('0x20')](function(_0x2e4502){if(_0x2e4502){return _0x2e4502?{'count':_0x15c93f,'rows':_0x2e4502}:null;}})[_0xeb62('0x20')](respondWithResult(_0x3e55bf,null))[_0xeb62('0x54')](handleError(_0x3e55bf,null));};exports[_0xeb62('0x5c')]=function(_0x1c3cb0,_0x1bf4f2,_0x1cbf33){var _0x129d44={};var _0xddc862={};var _0x2bbbff;var _0x4eb152;return db[_0xeb62('0x4d')]['findOne']({'where':{'id':_0x1c3cb0[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x1bf4f2,null))['then'](function(_0x2d8bbe){if(_0x2d8bbe){_0x2bbbff=_0x2d8bbe;_0xddc862[_0xeb62('0x3f')]=_[_0xeb62('0x3c')](db[_0xeb62('0x59')][_0xeb62('0x51')]);_0xddc862[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x1c3cb0[_0xeb62('0x3b')]);_0xddc862[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0xddc862[_0xeb62('0x3f')],_0xddc862[_0xeb62('0x3b')]);_0x129d44[_0xeb62('0x40')]=_['intersection'](_0xddc862[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x1c3cb0['query'][_0xeb62('0x41')]));_0x129d44['attributes']=_0x129d44[_0xeb62('0x40')][_0xeb62('0x42')]?_0x129d44[_0xeb62('0x40')]:_0xddc862[_0xeb62('0x3f')];_0x129d44[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x1c3cb0['query'][_0xeb62('0x45')]);_0x129d44['where']=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x1c3cb0[_0xeb62('0x3b')],_0xddc862[_0xeb62('0x3d')]));if(_0x1c3cb0[_0xeb62('0x3b')]['filter']){_0x129d44[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x129d44[_0xeb62('0x46')],{'$or':_['map'](_0x129d44[_0xeb62('0x40')],function(_0x3ad496){var _0x8a8ef3={};_0x8a8ef3[_0x3ad496]={'$like':'%'+_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x8a8ef3;})});}_0x129d44=_[_0xeb62('0x4b')]({},_0x129d44,_0x1c3cb0['options']);return _0x2bbbff['getSubjects'](_0x129d44);}})['then'](function(_0x50590b){if(_0x50590b){_0x4eb152=_0x50590b['length'];if(!_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x129d44[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x2f')]);_0x129d44[_0xeb62('0x2e')]=qs[_0xeb62('0x2e')](_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x2bbbff[_0xeb62('0x5c')](_0x129d44);}})['then'](function(_0x71c47b){if(_0x71c47b){return _0x71c47b?{'count':_0x4eb152,'rows':_0x71c47b}:null;}})[_0xeb62('0x20')](respondWithResult(_0x1bf4f2,null))[_0xeb62('0x54')](handleError(_0x1bf4f2,null));};exports[_0xeb62('0x5d')]=function(_0x25106d,_0x2f43d6,_0x30c8e0){var _0x214fd0={};var _0x1bb222={};var _0x33b16b;var _0x124847;return db[_0xeb62('0x4d')][_0xeb62('0x58')]({'where':{'id':_0x25106d[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x2f43d6,null))[_0xeb62('0x20')](function(_0x29648f){if(_0x29648f){_0x33b16b=_0x29648f;_0x1bb222[_0xeb62('0x3f')]=_['keys'](db[_0xeb62('0x59')]['rawAttributes']);_0x1bb222[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x25106d['query']);_0x1bb222[_0xeb62('0x3d')]=_['intersection'](_0x1bb222['model'],_0x1bb222[_0xeb62('0x3b')]);_0x214fd0[_0xeb62('0x40')]=_[_0xeb62('0x3e')](_0x1bb222[_0xeb62('0x3f')],qs['fields'](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x214fd0['attributes']=_0x214fd0[_0xeb62('0x40')][_0xeb62('0x42')]?_0x214fd0[_0xeb62('0x40')]:_0x1bb222[_0xeb62('0x3f')];_0x214fd0[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x45')]);_0x214fd0['where']=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x25106d['query'],_0x1bb222[_0xeb62('0x3d')]));if(_0x25106d['query']['filter']){_0x214fd0[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x214fd0[_0xeb62('0x46')],{'$or':_[_0xeb62('0x37')](_0x214fd0[_0xeb62('0x40')],function(_0x5072fd){var _0x3da53a={};_0x3da53a[_0x5072fd]={'$like':'%'+_0x25106d[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x3da53a;})});}_0x214fd0=_[_0xeb62('0x4b')]({},_0x214fd0,_0x25106d[_0xeb62('0x5a')]);return _0x33b16b[_0xeb62('0x5d')](_0x214fd0);}})[_0xeb62('0x20')](function(_0x50170b){if(_0x50170b){_0x124847=_0x50170b['length'];if(!_0x25106d['query'][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x214fd0[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x25106d['query'][_0xeb62('0x2f')]);_0x214fd0['offset']=qs['offset'](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x33b16b['getDescriptions'](_0x214fd0);}})[_0xeb62('0x20')](function(_0x53aa1c){if(_0x53aa1c){return _0x53aa1c?{'count':_0x124847,'rows':_0x53aa1c}:null;}})[_0xeb62('0x20')](respondWithResult(_0x2f43d6,null))[_0xeb62('0x54')](handleError(_0x2f43d6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index cdc01cf..aa8de59 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 _0x0f1c=['request-promise','path','../../config/environment','int_servicenow_configurations','lodash','../../config/logger','api','moment'];(function(_0x49710d,_0x561fb5){var _0x464572=function(_0x3f3df8){while(--_0x3f3df8){_0x49710d['push'](_0x49710d['shift']());}};_0x464572(++_0x561fb5);}(_0x0f1c,0x17c));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0f1('0x0'));var util=require('util');var logger=require(_0xc0f1('0x1'))(_0xc0f1('0x2'));var moment=require(_0xc0f1('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0f1('0x4'));var fs=require('fs');var path=require(_0xc0f1('0x5'));var rimraf=require('rimraf');var config=require(_0xc0f1('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x22f099,_0x2658d4){return _0x22f099['define']('ServicenowConfiguration',attributes,{'tableName':_0xc0f1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf55=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x1a0016,_0x3d80e1){var _0x2945df=function(_0x2e82b2){while(--_0x2e82b2){_0x1a0016['push'](_0x1a0016['shift']());}};_0x2945df(++_0x3d80e1);}(_0xaf55,0x1e0));var _0x5af5=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xaf55[_0xd09668];return _0x68726;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var logger=require(_0x5af5('0x2'))(_0x5af5('0x3'));var moment=require(_0x5af5('0x4'));var BPromise=require(_0x5af5('0x5'));var rp=require(_0x5af5('0x6'));var fs=require('fs');var path=require(_0x5af5('0x7'));var rimraf=require(_0x5af5('0x8'));var config=require(_0x5af5('0x9'));var attributes=require(_0x5af5('0xa'));module[_0x5af5('0xb')]=function(_0x16b6a0,_0x872cb0){return _0x16b6a0[_0x5af5('0xc')](_0x5af5('0xd'),attributes,{'tableName':_0x5af5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 2b30ccd..0ffa537 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 _0x6470=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4a9a58,_0x8671ee){var _0x5c6e6f=function(_0x62d046){while(--_0x62d046){_0x4a9a58['push'](_0x4a9a58['shift']());}};_0x5c6e6f(++_0x8671ee);}(_0x6470,0x76));var _0x0647=function(_0x416d32,_0x1c3ecb){_0x416d32=_0x416d32-0x0;var _0x267982=_0x6470[_0x416d32];return _0x267982;};'use strict';var _=require(_0x0647('0x0'));var util=require('util');var moment=require(_0x0647('0x1'));var BPromise=require(_0x0647('0x2'));var rs=require(_0x0647('0x3'));var fs=require('fs');var Redis=require(_0x0647('0x4'));var db=require(_0x0647('0x5'))['db'];var utils=require(_0x0647('0x6'));var logger=require(_0x0647('0x7'))(_0x0647('0x8'));var config=require(_0x0647('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0647('0xa')][_0x0647('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c4fcb,_0x214ecd,_0x4b7e0f){return new BPromise(function(_0x4b9bc2,_0x3065c4){return client[_0x0647('0xc')](_0x1c4fcb,_0x4b7e0f)['then'](function(_0x37f74a){logger[_0x0647('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x214ecd,_0x0647('0xe'));logger[_0x0647('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x214ecd,_0x0647('0xe'),JSON[_0x0647('0x10')](_0x37f74a));if(_0x37f74a['error']){if(_0x37f74a[_0x0647('0x11')][_0x0647('0x12')]===0x1f4){logger[_0x0647('0x11')](_0x0647('0x13'),_0x214ecd,_0x37f74a[_0x0647('0x11')][_0x0647('0x14')]);return _0x3065c4(_0x37f74a[_0x0647('0x11')][_0x0647('0x14')]);}logger[_0x0647('0x11')](_0x0647('0x13'),_0x214ecd,_0x37f74a[_0x0647('0x11')][_0x0647('0x14')]);return _0x4b9bc2(_0x37f74a['error'][_0x0647('0x14')]);}else{logger[_0x0647('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x214ecd,_0x0647('0xe'));_0x4b9bc2(_0x37f74a[_0x0647('0x15')][_0x0647('0x14')]);}})[_0x0647('0x16')](function(_0x545f6a){logger[_0x0647('0x11')](_0x0647('0x13'),_0x214ecd,_0x545f6a);_0x3065c4(_0x545f6a);});});} \ No newline at end of file +var _0x7736=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x187ef8,_0x178007){var _0x47a915=function(_0x1a8925){while(--_0x1a8925){_0x187ef8['push'](_0x187ef8['shift']());}};_0x47a915(++_0x178007);}(_0x7736,0x113));var _0x6773=function(_0x1b0281,_0x507883){_0x1b0281=_0x1b0281-0x0;var _0x4fc6ef=_0x7736[_0x1b0281];return _0x4fc6ef;};'use strict';var _=require(_0x6773('0x0'));var util=require(_0x6773('0x1'));var moment=require('moment');var BPromise=require(_0x6773('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6773('0x3'));var db=require(_0x6773('0x4'))['db'];var utils=require(_0x6773('0x5'));var logger=require(_0x6773('0x6'))(_0x6773('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6773('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2238f2,_0x60a529,_0x3e886e){return new BPromise(function(_0x1dc555,_0x1d120b){return client[_0x6773('0x9')](_0x2238f2,_0x3e886e)['then'](function(_0x1ee04b){logger[_0x6773('0xa')](_0x6773('0xb'),_0x60a529,_0x6773('0xc'));logger[_0x6773('0xd')](_0x6773('0xe'),_0x60a529,_0x6773('0xc'),JSON[_0x6773('0xf')](_0x1ee04b));if(_0x1ee04b[_0x6773('0x10')]){if(_0x1ee04b[_0x6773('0x10')]['code']===0x1f4){logger[_0x6773('0x10')](_0x6773('0xb'),_0x60a529,_0x1ee04b[_0x6773('0x10')][_0x6773('0x11')]);return _0x1d120b(_0x1ee04b[_0x6773('0x10')][_0x6773('0x11')]);}logger[_0x6773('0x10')](_0x6773('0xb'),_0x60a529,_0x1ee04b['error']['message']);return _0x1dc555(_0x1ee04b['error'][_0x6773('0x11')]);}else{logger[_0x6773('0xa')](_0x6773('0xb'),_0x60a529,'request\x20sent');_0x1dc555(_0x1ee04b[_0x6773('0x12')][_0x6773('0x11')]);}})['catch'](function(_0x33cdee){logger['error'](_0x6773('0xb'),_0x60a529,_0x33cdee);_0x1d120b(_0x33cdee);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3aca06f..d108fb5 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 _0xe60b=['multer','util','path','connect-timeout','../../config/environment','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x22590f,_0x16dcf5){var _0x374208=function(_0x143f67){while(--_0x143f67){_0x22590f['push'](_0x22590f['shift']());}};_0x374208(++_0x16dcf5);}(_0xe60b,0x100));var _0xbe60=function(_0x4bee59,_0x3c5751){_0x4bee59=_0x4bee59-0x0;var _0x1b9d18=_0xe60b[_0x4bee59];return _0x1b9d18;};'use strict';var multer=require(_0xbe60('0x0'));var util=require(_0xbe60('0x1'));var path=require(_0xbe60('0x2'));var timeout=require(_0xbe60('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe60('0x4'));var controller=require('./intServicenowField.controller');router[_0xbe60('0x5')]('/',auth['isAuthenticated'](),controller[_0xbe60('0x6')]);router[_0xbe60('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xbe60('0x7')]);router[_0xbe60('0x8')]('/',auth[_0xbe60('0x9')](),controller[_0xbe60('0xa')]);router[_0xbe60('0xb')](_0xbe60('0xc'),auth['isAuthenticated'](),controller[_0xbe60('0xd')]);router[_0xbe60('0xe')](_0xbe60('0xc'),auth[_0xbe60('0x9')](),controller[_0xbe60('0xf')]);module['exports']=router; \ No newline at end of file +var _0x86ab=['isAuthenticated','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intServicenowField.controller','get','/:id','post'];(function(_0x466325,_0x162cdd){var _0xf91863=function(_0x2c028b){while(--_0x2c028b){_0x466325['push'](_0x466325['shift']());}};_0xf91863(++_0x162cdd);}(_0x86ab,0xa5));var _0xb86a=function(_0x2410cf,_0x15f99f){_0x2410cf=_0x2410cf-0x0;var _0x268162=_0x86ab[_0x2410cf];return _0x268162;};'use strict';var multer=require(_0xb86a('0x0'));var util=require(_0xb86a('0x1'));var path=require(_0xb86a('0x2'));var timeout=require(_0xb86a('0x3'));var express=require(_0xb86a('0x4'));var router=express[_0xb86a('0x5')]();var auth=require(_0xb86a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb86a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb86a('0x8')](_0xb86a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb86a('0xa')]('/',auth[_0xb86a('0xb')](),controller['create']);router[_0xb86a('0xc')](_0xb86a('0x9'),auth[_0xb86a('0xb')](),controller[_0xb86a('0xd')]);router[_0xb86a('0xe')]('/:id',auth[_0xb86a('0xb')](),controller['destroy']);module[_0xb86a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f41a306..ad63c21 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 _0xf26a=['customVariable','BOOLEAN','sequelize','exports','variable','keyValue','string','STRING','ENUM'];(function(_0x2aea4f,_0x5b6f9b){var _0x2648bf=function(_0x8e4b93){while(--_0x8e4b93){_0x2aea4f['push'](_0x2aea4f['shift']());}};_0x2648bf(++_0x5b6f9b);}(_0xf26a,0x158));var _0xaf26=function(_0x289572,_0x16fcf8){_0x289572=_0x289572-0x0;var _0x5851f1=_0xf26a[_0x289572];return _0x5851f1;};'use strict';var Sequelize=require(_0xaf26('0x0'));module[_0xaf26('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xaf26('0x2'),'customVariable',_0xaf26('0x3')),'defaultValue':_0xaf26('0x4')},'content':{'type':Sequelize[_0xaf26('0x5')]},'key':{'type':Sequelize[_0xaf26('0x5')]},'keyType':{'type':Sequelize[_0xaf26('0x6')](_0xaf26('0x4'),_0xaf26('0x2'),_0xaf26('0x7'))},'keyContent':{'type':Sequelize[_0xaf26('0x5')]},'idField':{'type':Sequelize[_0xaf26('0x5')]},'nameField':{'type':Sequelize[_0xaf26('0x5')]},'customField':{'type':Sequelize[_0xaf26('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf26('0x5')]}}; \ No newline at end of file +var _0x5455=['ENUM','exports','string','customVariable','keyValue','STRING'];(function(_0x2f49b0,_0x484ffe){var _0x211b48=function(_0x3c376d){while(--_0x3c376d){_0x2f49b0['push'](_0x2f49b0['shift']());}};_0x211b48(++_0x484ffe);}(_0x5455,0x17b));var _0x5545=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5455[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module[_0x5545('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5545('0x1'),'variable',_0x5545('0x2'),_0x5545('0x3')),'defaultValue':_0x5545('0x1')},'content':{'type':Sequelize[_0x5545('0x4')]},'key':{'type':Sequelize[_0x5545('0x4')]},'keyType':{'type':Sequelize[_0x5545('0x5')](_0x5545('0x1'),'variable',_0x5545('0x2'))},'keyContent':{'type':Sequelize[_0x5545('0x4')]},'idField':{'type':Sequelize[_0x5545('0x4')]},'nameField':{'type':Sequelize[_0x5545('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5545('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 917ab6f..50ebb96 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(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x55ae99,_0x5ab789){var _0x4297e1=function(_0x33ee69){while(--_0x33ee69){_0x55ae99['push'](_0x55ae99['shift']());}};_0x4297e1(++_0x5ab789);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8763f33..b8e04fe 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 _0xe840=['rimraf','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x39b482,_0x1924b2){var _0x3cf423=function(_0x3e5746){while(--_0x3e5746){_0x39b482['push'](_0x39b482['shift']());}};_0x3cf423(++_0x1924b2);}(_0xe840,0x1b4));var _0x0e84=function(_0x4eb8cc,_0x4ee1dc){_0x4eb8cc=_0x4eb8cc-0x0;var _0x2f59ee=_0xe840[_0x4eb8cc];return _0x2f59ee;};'use strict';var _=require('lodash');var util=require(_0x0e84('0x0'));var logger=require(_0x0e84('0x1'))(_0x0e84('0x2'));var moment=require(_0x0e84('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e84('0x4'));var fs=require('fs');var path=require(_0x0e84('0x5'));var rimraf=require(_0x0e84('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e84('0x7'));module[_0x0e84('0x8')]=function(_0x1d46e0,_0x528b82){return _0x1d46e0['define']('ServicenowField',attributes,{'tableName':_0x0e84('0x9'),'paranoid':![],'indexes':[{'name':_0x0e84('0xa'),'fields':[_0x0e84('0xb'),_0x0e84('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc124=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc124,0x91));var _0x4c12=function(_0x2ea4b9,_0x27259b){_0x2ea4b9=_0x2ea4b9-0x0;var _0x1ea2f6=_0xc124[_0x2ea4b9];return _0x1ea2f6;};'use strict';var _=require('lodash');var util=require(_0x4c12('0x0'));var logger=require(_0x4c12('0x1'))(_0x4c12('0x2'));var moment=require(_0x4c12('0x3'));var BPromise=require(_0x4c12('0x4'));var rp=require(_0x4c12('0x5'));var fs=require('fs');var path=require(_0x4c12('0x6'));var rimraf=require(_0x4c12('0x7'));var config=require(_0x4c12('0x8'));var attributes=require(_0x4c12('0x9'));module['exports']=function(_0x15fb88,_0x12ad1a){return _0x15fb88[_0x4c12('0xa')]('ServicenowField',attributes,{'tableName':_0x4c12('0xb'),'paranoid':![],'indexes':[{'name':_0x4c12('0xc'),'fields':[_0x4c12('0xd'),_0x4c12('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 9e672ea..5643d78 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 _0xaa01=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xaa01,0x17f));var _0x1aa0=function(_0x3d9956,_0x1cdb82){_0x3d9956=_0x3d9956-0x0;var _0x33fa56=_0xaa01[_0x3d9956];return _0x33fa56;};'use strict';var _=require('lodash');var util=require(_0x1aa0('0x0'));var moment=require(_0x1aa0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1aa0('0x2'));var db=require(_0x1aa0('0x3'))['db'];var utils=require(_0x1aa0('0x4'));var logger=require(_0x1aa0('0x5'))(_0x1aa0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1aa0('0x7')][_0x1aa0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x399e62,_0x131013,_0x3d1161){return new BPromise(function(_0x2694ba,_0x448a37){return client[_0x1aa0('0x9')](_0x399e62,_0x3d1161)[_0x1aa0('0xa')](function(_0x3abfd3){logger[_0x1aa0('0xb')](_0x1aa0('0xc'),_0x131013,_0x1aa0('0xd'));logger[_0x1aa0('0xe')](_0x1aa0('0xf'),_0x131013,'request\x20sent',JSON[_0x1aa0('0x10')](_0x3abfd3));if(_0x3abfd3[_0x1aa0('0x11')]){if(_0x3abfd3['error'][_0x1aa0('0x12')]===0x1f4){logger[_0x1aa0('0x11')]('ServicenowField,\x20%s,\x20%s',_0x131013,_0x3abfd3[_0x1aa0('0x11')]['message']);return _0x448a37(_0x3abfd3[_0x1aa0('0x11')]['message']);}logger[_0x1aa0('0x11')](_0x1aa0('0xc'),_0x131013,_0x3abfd3[_0x1aa0('0x11')][_0x1aa0('0x13')]);return _0x2694ba(_0x3abfd3['error'][_0x1aa0('0x13')]);}else{logger['info'](_0x1aa0('0xc'),_0x131013,_0x1aa0('0xd'));_0x2694ba(_0x3abfd3[_0x1aa0('0x14')][_0x1aa0('0x13')]);}})[_0x1aa0('0x15')](function(_0x31a2d7){logger[_0x1aa0('0x11')](_0x1aa0('0xc'),_0x131013,_0x31a2d7);_0x448a37(_0x31a2d7);});});} \ No newline at end of file +var _0x6363=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','ServicenowField,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3f9d54,_0x5df593){var _0x2d68a0=function(_0x3c9874){while(--_0x3c9874){_0x3f9d54['push'](_0x3f9d54['shift']());}};_0x2d68a0(++_0x5df593);}(_0x6363,0x194));var _0x3636=function(_0x1982cb,_0x31d47c){_0x1982cb=_0x1982cb-0x0;var _0x41ca87=_0x6363[_0x1982cb];return _0x41ca87;};'use strict';var _=require('lodash');var util=require(_0x3636('0x0'));var moment=require(_0x3636('0x1'));var BPromise=require(_0x3636('0x2'));var rs=require(_0x3636('0x3'));var fs=require('fs');var Redis=require(_0x3636('0x4'));var db=require(_0x3636('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3636('0x6'));var config=require(_0x3636('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3636('0x8')][_0x3636('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x228fe6,_0x17badc,_0x3b01e1){return new BPromise(function(_0x592f52,_0x430e19){return client['request'](_0x228fe6,_0x3b01e1)[_0x3636('0xa')](function(_0x34035c){logger[_0x3636('0xb')](_0x3636('0xc'),_0x17badc,'request\x20sent');logger[_0x3636('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x17badc,_0x3636('0xe'),JSON[_0x3636('0xf')](_0x34035c));if(_0x34035c[_0x3636('0x10')]){if(_0x34035c[_0x3636('0x10')][_0x3636('0x11')]===0x1f4){logger[_0x3636('0x10')]('ServicenowField,\x20%s,\x20%s',_0x17badc,_0x34035c['error'][_0x3636('0x12')]);return _0x430e19(_0x34035c['error'][_0x3636('0x12')]);}logger['error'](_0x3636('0xc'),_0x17badc,_0x34035c[_0x3636('0x10')]['message']);return _0x592f52(_0x34035c[_0x3636('0x10')][_0x3636('0x12')]);}else{logger[_0x3636('0xb')](_0x3636('0xc'),_0x17badc,_0x3636('0xe'));_0x592f52(_0x34035c['result']['message']);}})[_0x3636('0x13')](function(_0x55d801){logger[_0x3636('0x10')](_0x3636('0xc'),_0x17badc,_0x55d801);_0x430e19(_0x55d801);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 59a9cec..b748ce1 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 _0xa132=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id'];(function(_0x5ae715,_0x379a3e){var _0x407d2d=function(_0x5e2964){while(--_0x5e2964){_0x5ae715['push'](_0x5ae715['shift']());}};_0x407d2d(++_0x379a3e);}(_0xa132,0x1e1));var _0x2a13=function(_0x1ade91,_0x48f178){_0x1ade91=_0x1ade91-0x0;var _0x2c35d2=_0xa132[_0x1ade91];return _0x2c35d2;};'use strict';var multer=require(_0x2a13('0x0'));var util=require(_0x2a13('0x1'));var path=require(_0x2a13('0x2'));var timeout=require(_0x2a13('0x3'));var express=require(_0x2a13('0x4'));var router=express[_0x2a13('0x5')]();var auth=require(_0x2a13('0x6'));var interaction=require(_0x2a13('0x7'));var config=require(_0x2a13('0x8'));var controller=require(_0x2a13('0x9'));router[_0x2a13('0xa')]('/',auth['isAuthenticated'](),controller[_0x2a13('0xb')]);router['get'](_0x2a13('0xc'),auth[_0x2a13('0xd')](),controller[_0x2a13('0xe')]);router[_0x2a13('0xa')](_0x2a13('0xf'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x10')]);router[_0x2a13('0xa')](_0x2a13('0x11'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x12')]);router[_0x2a13('0x13')]('/',auth[_0x2a13('0xd')](),controller[_0x2a13('0x14')]);router[_0x2a13('0x13')]('/:id/configurations',auth[_0x2a13('0xd')](),controller[_0x2a13('0x15')]);router[_0x2a13('0x16')](_0x2a13('0xc'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x17')]);router['delete'](_0x2a13('0xc'),auth[_0x2a13('0xd')](),controller[_0x2a13('0x18')]);module[_0x2a13('0x19')]=router; \ No newline at end of file +var _0x8142=['Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x13d749,_0x274ca2){var _0x2277f4=function(_0x188d96){while(--_0x188d96){_0x13d749['push'](_0x13d749['shift']());}};_0x2277f4(++_0x274ca2);}(_0x8142,0x1c3));var _0x2814=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x8142[_0x57eb2d];return _0xd8e18;};'use strict';var multer=require(_0x2814('0x0'));var util=require(_0x2814('0x1'));var path=require(_0x2814('0x2'));var timeout=require(_0x2814('0x3'));var express=require(_0x2814('0x4'));var router=express[_0x2814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2814('0x6'));var config=require(_0x2814('0x7'));var controller=require(_0x2814('0x8'));router[_0x2814('0x9')]('/',auth[_0x2814('0xa')](),controller[_0x2814('0xb')]);router[_0x2814('0x9')](_0x2814('0xc'),auth[_0x2814('0xa')](),controller[_0x2814('0xd')]);router[_0x2814('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x2814('0xe'),auth[_0x2814('0xa')](),controller[_0x2814('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2814('0x10')]);router[_0x2814('0x11')](_0x2814('0x12'),auth[_0x2814('0xa')](),controller[_0x2814('0x13')]);router[_0x2814('0x14')](_0x2814('0xc'),auth[_0x2814('0xa')](),controller[_0x2814('0x15')]);router[_0x2814('0x16')]('/:id',auth[_0x2814('0xa')](),controller['destroy']);module[_0x2814('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 8057813..24a8486 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 _0xdcf4=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4824c1,_0x12548d){var _0x1972f0=function(_0x1940c2){while(--_0x1940c2){_0x4824c1['push'](_0x4824c1['shift']());}};_0x1972f0(++_0x12548d);}(_0xdcf4,0x126));var _0x4dcf=function(_0x268ea7,_0x2e2dcf){_0x268ea7=_0x268ea7-0x0;var _0x5d9117=_0xdcf4[_0x268ea7];return _0x5d9117;};'use strict';var Sequelize=require(_0x4dcf('0x0'));module[_0x4dcf('0x1')]={'name':{'type':Sequelize[_0x4dcf('0x2')]},'description':{'type':Sequelize[_0x4dcf('0x2')]},'username':{'type':Sequelize[_0x4dcf('0x2')],'unique':_0x4dcf('0x3')},'password':{'type':Sequelize[_0x4dcf('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4dcf('0x4')},'serverUrl':{'type':Sequelize[_0x4dcf('0x2')]}}; \ No newline at end of file +var _0xe6ec=['sequelize','exports','STRING','remoteUri'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe6ec,0x1cc));var _0xce6e=function(_0x15e63a,_0x512bc7){_0x15e63a=_0x15e63a-0x0;var _0x5085b5=_0xe6ec[_0x15e63a];return _0x5085b5;};'use strict';var Sequelize=require(_0xce6e('0x0'));module[_0xce6e('0x1')]={'name':{'type':Sequelize[_0xce6e('0x2')]},'description':{'type':Sequelize[_0xce6e('0x2')]},'username':{'type':Sequelize[_0xce6e('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xce6e('0x2')]},'remoteUri':{'type':Sequelize[_0xce6e('0x2')],'unique':_0xce6e('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 91a3360..c2fafa4 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 _0x05b6=['status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','create','body','find','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','module_fields','label','endsWith','values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x05b6,0x168));var _0x605b=function(_0x5cce5a,_0x298d54){_0x5cce5a=_0x5cce5a-0x0;var _0x354e33=_0x05b6[_0x5cce5a];return _0x354e33;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x605b('0x0'));var rimraf=require(_0x605b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x605b('0x2'));var rp=require(_0x605b('0x3'));var moment=require(_0x605b('0x4'));var BPromise=require(_0x605b('0x5'));var Mustache=require('mustache');var util=require(_0x605b('0x6'));var path=require(_0x605b('0x7'));var sox=require(_0x605b('0x8'));var csv=require(_0x605b('0x9'));var ejs=require(_0x605b('0xa'));var fs=require('fs');var _=require(_0x605b('0xb'));var squel=require(_0x605b('0xc'));var crypto=require(_0x605b('0xd'));var jsforce=require(_0x605b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x605b('0xf'));var Papa=require(_0x605b('0x10'));var Redis=require(_0x605b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x605b('0x12'));var as=require(_0x605b('0x13'));var hardwareService=require(_0x605b('0x14'));var logger=require(_0x605b('0x15'))('api');var utils=require(_0x605b('0x16'));var config=require(_0x605b('0x17'));var db=require(_0x605b('0x18'))['db'];var integrations=require(_0x605b('0x19'));var jayson=require(_0x605b('0x1a'));var client=jayson[_0x605b('0x1b')][_0x605b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x572a44,_0x7e9e21,_0x1f5e14){if(_0x1f5e14){var _0xdb3dc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdb3dc4['test'](_0x7e9e21)){return _0x572a44;}else{throw new db[(_0x605b('0x1d'))]['ValidationError'](_0x605b('0x1e'));}}else{return _0x572a44;}}function respondWithRpcPromise(_0x4aa544,_0x10d90b,_0x8fc191,_0x41e21f){return new BPromise(function(_0x433b85,_0x3da235){var _0x3849b2=_0x41e21f||client;return _0x3849b2[_0x605b('0x1f')](_0x4aa544,_0x8fc191)[_0x605b('0x20')](function(_0x1a6ef5){logger['info'](_0x605b('0x21'),_0x10d90b,_0x605b('0x22'));logger[_0x605b('0x23')](_0x605b('0x24'),_0x10d90b,'request\x20sent',JSON[_0x605b('0x25')](_0x1a6ef5));if(_0x1a6ef5[_0x605b('0x26')]){if(_0x1a6ef5[_0x605b('0x26')][_0x605b('0x27')]===0x1f4){logger[_0x605b('0x26')](_0x605b('0x21'),_0x10d90b,_0x1a6ef5[_0x605b('0x26')][_0x605b('0x28')]);return _0x3da235(_0x1a6ef5[_0x605b('0x26')][_0x605b('0x28')]);}logger[_0x605b('0x26')](_0x605b('0x21'),_0x10d90b,_0x1a6ef5['error'][_0x605b('0x28')]);return _0x433b85(_0x1a6ef5[_0x605b('0x26')][_0x605b('0x28')]);}else{logger[_0x605b('0x29')]('SugarcrmAccount,\x20%s,\x20%s',_0x10d90b,_0x605b('0x22'));_0x433b85(_0x1a6ef5[_0x605b('0x2a')][_0x605b('0x28')]);}})[_0x605b('0x2b')](function(_0x1d732a){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x10d90b,_0x1d732a);_0x3da235(_0x1d732a);});});}function respondWithStatusCode(_0xcfa230,_0x1b5496){_0x1b5496=_0x1b5496||0xcc;return function(_0x3dba78){if(_0x3dba78){return _0xcfa230[_0x605b('0x2c')](_0x1b5496);}return _0xcfa230[_0x605b('0x2d')](_0x1b5496)[_0x605b('0x2e')]();};}function respondWithResult(_0x12f1e,_0x218540){_0x218540=_0x218540||0xc8;return function(_0x551926){if(_0x551926){return _0x12f1e[_0x605b('0x2d')](_0x218540)['json'](_0x551926);}};}function respondWithFilteredResult(_0xe8cf13,_0x4fb6cb){return function(_0x2b049b){if(_0x2b049b){var _0x4647c8=_0x2b049b[_0x605b('0x2f')],_0x3b32c5=_0x4fb6cb[_0x605b('0x30')],_0x3cf470=_0x4fb6cb['offset']+_0x4fb6cb['limit'],_0x4090d8;if(_0x3cf470>=_0x4647c8){_0x3cf470=_0x4647c8;_0x4090d8=0xc8;}else{_0x4090d8=0xce;}_0xe8cf13['status'](_0x4090d8);return _0xe8cf13['set'](_0x605b('0x31'),_0x3b32c5+'-'+_0x3cf470+'/'+_0x4647c8)[_0x605b('0x32')](_0x2b049b);}return null;};}function patchUpdates(_0x5ed6a5){return function(_0x15dfdf){try{jsonpatch[_0x605b('0x33')](_0x15dfdf,_0x5ed6a5,!![]);}catch(_0x2ba960){return BPromise[_0x605b('0x34')](_0x2ba960);}return _0x15dfdf[_0x605b('0x35')]();};}function saveUpdates(_0x3c8029,_0x5c1b43){return function(_0x397264){if(_0x397264){return _0x397264[_0x605b('0x36')](_0x3c8029)[_0x605b('0x20')](function(_0x2bd0b9){return _0x2bd0b9;});}return null;};}function removeEntity(_0x4581ec,_0xe3d35a){return function(_0x16a5ed){if(_0x16a5ed){return _0x16a5ed[_0x605b('0x37')]()['then'](function(){_0x4581ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x203237,_0x4320df){return function(_0x48d6a9){if(!_0x48d6a9){_0x203237[_0x605b('0x2c')](0x194);}return _0x48d6a9;};}function handleError(_0x2c2324,_0x54c8bd){_0x54c8bd=_0x54c8bd||0x1f4;return function(_0x1114af){logger[_0x605b('0x26')](_0x1114af[_0x605b('0x38')]);if(_0x1114af[_0x605b('0x39')]){delete _0x1114af[_0x605b('0x39')];}_0x2c2324[_0x605b('0x2d')](_0x54c8bd)[_0x605b('0x3a')](_0x1114af);};}exports[_0x605b('0x3b')]=function(_0x2788e0,_0x423891){var _0x40529c={},_0x160689={},_0x242df1={'count':0x0,'rows':[]};var _0x360591=_[_0x605b('0x3c')](db[_0x605b('0x3d')][_0x605b('0x3e')],function(_0x185236){return{'name':_0x185236['fieldName'],'type':_0x185236[_0x605b('0x3f')][_0x605b('0x40')]};});_0x160689[_0x605b('0x41')]=_[_0x605b('0x3c')](_0x360591,_0x605b('0x39'));_0x160689[_0x605b('0x42')]=_[_0x605b('0x43')](_0x2788e0['query']);_0x160689[_0x605b('0x44')]=_[_0x605b('0x45')](_0x160689['model'],_0x160689[_0x605b('0x42')]);_0x40529c['attributes']=_[_0x605b('0x45')](_0x160689[_0x605b('0x41')],qs['fields'](_0x2788e0[_0x605b('0x42')][_0x605b('0x46')]));_0x40529c[_0x605b('0x47')]=_0x40529c[_0x605b('0x47')]['length']?_0x40529c[_0x605b('0x47')]:_0x160689[_0x605b('0x41')];if(!_0x2788e0[_0x605b('0x42')][_0x605b('0x48')](_0x605b('0x49'))){_0x40529c[_0x605b('0x4a')]=qs[_0x605b('0x4a')](_0x2788e0[_0x605b('0x42')][_0x605b('0x4a')]);_0x40529c[_0x605b('0x30')]=qs[_0x605b('0x30')](_0x2788e0[_0x605b('0x42')][_0x605b('0x30')]);}_0x40529c[_0x605b('0x4b')]=qs[_0x605b('0x4c')](_0x2788e0[_0x605b('0x42')][_0x605b('0x4c')]);_0x40529c[_0x605b('0x4d')]=qs[_0x605b('0x44')](_[_0x605b('0x4e')](_0x2788e0['query'],_0x160689['filters']),_0x360591);if(_0x2788e0['query'][_0x605b('0x4f')]){_0x40529c['where']=_[_0x605b('0x50')](_0x40529c['where'],{'$or':_[_0x605b('0x3c')](_0x360591,function(_0x1f8d51){if(_0x1f8d51[_0x605b('0x3f')]!==_0x605b('0x51')){var _0x51cc57={};_0x51cc57[_0x1f8d51[_0x605b('0x39')]]={'$like':'%'+_0x2788e0['query'][_0x605b('0x4f')]+'%'};return _0x51cc57;}})});}_0x40529c=_[_0x605b('0x50')]({},_0x40529c,_0x2788e0[_0x605b('0x52')]);var _0x58b50b={'where':_0x40529c[_0x605b('0x4d')]};return db[_0x605b('0x3d')][_0x605b('0x2f')](_0x58b50b)['then'](function(_0x5bfb80){_0x242df1[_0x605b('0x2f')]=_0x5bfb80;if(_0x2788e0[_0x605b('0x42')][_0x605b('0x53')]){_0x40529c[_0x605b('0x54')]=[{'all':!![]}];}return db[_0x605b('0x3d')]['findAll'](_0x40529c);})['then'](function(_0x37e92f){_0x242df1[_0x605b('0x55')]=_0x37e92f;return _0x242df1;})['then'](respondWithFilteredResult(_0x423891,_0x40529c))['catch'](handleError(_0x423891,null));};exports[_0x605b('0x56')]=function(_0x1c1cfe,_0x35d934){var _0x487f32={'raw':![],'where':{'id':_0x1c1cfe[_0x605b('0x57')]['id']}},_0x50e431={};_0x50e431[_0x605b('0x41')]=_[_0x605b('0x43')](db[_0x605b('0x3d')][_0x605b('0x3e')]);_0x50e431[_0x605b('0x42')]=_[_0x605b('0x43')](_0x1c1cfe[_0x605b('0x42')]);_0x50e431['filters']=_[_0x605b('0x45')](_0x50e431['model'],_0x50e431['query']);_0x487f32[_0x605b('0x47')]=_[_0x605b('0x45')](_0x50e431['model'],qs['fields'](_0x1c1cfe['query'][_0x605b('0x46')]));_0x487f32[_0x605b('0x47')]=_0x487f32['attributes'][_0x605b('0x58')]?_0x487f32['attributes']:_0x50e431[_0x605b('0x41')];if(_0x1c1cfe['query']['includeAll']){_0x487f32['include']=[{'all':!![]}];}_0x487f32=_[_0x605b('0x50')]({},_0x487f32,_0x1c1cfe[_0x605b('0x52')]);return db[_0x605b('0x3d')]['find'](_0x487f32)[_0x605b('0x20')](handleEntityNotFound(_0x35d934,null))[_0x605b('0x20')](respondWithResult(_0x35d934,null))['catch'](handleError(_0x35d934,null));};exports[_0x605b('0x59')]=function(_0x21197b,_0x1c5d6b){return db[_0x605b('0x3d')][_0x605b('0x59')](_0x21197b[_0x605b('0x5a')],{})[_0x605b('0x20')](respondWithResult(_0x1c5d6b,0xc9))['catch'](handleError(_0x1c5d6b,null));};exports['update']=function(_0x7ab35a,_0x52a646){if(_0x7ab35a[_0x605b('0x5a')]['id']){delete _0x7ab35a[_0x605b('0x5a')]['id'];}return db[_0x605b('0x3d')][_0x605b('0x5b')]({'where':{'id':_0x7ab35a[_0x605b('0x57')]['id']}})[_0x605b('0x20')](handleEntityNotFound(_0x52a646,null))[_0x605b('0x20')](saveUpdates(_0x7ab35a[_0x605b('0x5a')],null))['then'](respondWithResult(_0x52a646,null))[_0x605b('0x2b')](handleError(_0x52a646,null));};exports[_0x605b('0x37')]=function(_0x56d159,_0x384f24){return db[_0x605b('0x3d')][_0x605b('0x5b')]({'where':{'id':_0x56d159[_0x605b('0x57')]['id']}})['then'](handleEntityNotFound(_0x384f24,null))['then'](removeEntity(_0x384f24,null))[_0x605b('0x2b')](handleError(_0x384f24,null));};exports['getConfigurations']=function(_0x14a085,_0x997da,_0x37de25){var _0x16437f={};var _0x319239={};var _0x19b37f;var _0x36cddf;return db[_0x605b('0x3d')][_0x605b('0x5c')]({'where':{'id':_0x14a085[_0x605b('0x57')]['id']}})[_0x605b('0x20')](handleEntityNotFound(_0x997da,null))['then'](function(_0x29972c){if(_0x29972c){_0x19b37f=_0x29972c;_0x319239[_0x605b('0x41')]=_[_0x605b('0x43')](db[_0x605b('0x5d')][_0x605b('0x3e')]);_0x319239[_0x605b('0x42')]=_[_0x605b('0x43')](_0x14a085[_0x605b('0x42')]);_0x319239[_0x605b('0x44')]=_[_0x605b('0x45')](_0x319239['model'],_0x319239[_0x605b('0x42')]);_0x16437f[_0x605b('0x47')]=_[_0x605b('0x45')](_0x319239['model'],qs[_0x605b('0x46')](_0x14a085['query']['fields']));_0x16437f[_0x605b('0x47')]=_0x16437f[_0x605b('0x47')][_0x605b('0x58')]?_0x16437f[_0x605b('0x47')]:_0x319239[_0x605b('0x41')];_0x16437f[_0x605b('0x4b')]=qs['sort'](_0x14a085['query']['sort']);_0x16437f['where']=qs['filters'](_[_0x605b('0x4e')](_0x14a085[_0x605b('0x42')],_0x319239[_0x605b('0x44')]));if(_0x14a085[_0x605b('0x42')]['filter']){_0x16437f[_0x605b('0x4d')]=_[_0x605b('0x50')](_0x16437f[_0x605b('0x4d')],{'$or':_[_0x605b('0x3c')](_0x16437f[_0x605b('0x47')],function(_0x595894){var _0xf24c78={};_0xf24c78[_0x595894]={'$like':'%'+_0x14a085[_0x605b('0x42')]['filter']+'%'};return _0xf24c78;})});}_0x16437f=_['merge']({},_0x16437f,_0x14a085[_0x605b('0x52')]);return _0x19b37f[_0x605b('0x5e')](_0x16437f);}})['then'](function(_0x3847ae){if(_0x3847ae){_0x36cddf=_0x3847ae[_0x605b('0x58')];if(!_0x14a085[_0x605b('0x42')][_0x605b('0x48')](_0x605b('0x49'))){_0x16437f[_0x605b('0x4a')]=qs[_0x605b('0x4a')](_0x14a085['query'][_0x605b('0x4a')]);_0x16437f[_0x605b('0x30')]=qs[_0x605b('0x30')](_0x14a085['query'][_0x605b('0x30')]);}return _0x19b37f[_0x605b('0x5e')](_0x16437f);}})[_0x605b('0x20')](function(_0x2e8a22){if(_0x2e8a22){return _0x2e8a22?{'count':_0x36cddf,'rows':_0x2e8a22}:null;}})['then'](respondWithResult(_0x997da,null))[_0x605b('0x2b')](handleError(_0x997da,null));};exports[_0x605b('0x5f')]=function(_0x2732f4,_0x23342f,_0x5f1c29){if(_0x2732f4[_0x605b('0x5a')]['id']){delete _0x2732f4[_0x605b('0x5a')]['id'];}return db[_0x605b('0x3d')][_0x605b('0x5c')]({'where':{'id':_0x2732f4[_0x605b('0x57')]['id']}})['then'](handleEntityNotFound(_0x23342f,null))[_0x605b('0x20')](function(_0x3f9e81){if(_0x3f9e81){_0x2732f4[_0x605b('0x5a')][_0x605b('0x60')]=_0x3f9e81['id'];_0x2732f4[_0x605b('0x5a')][_0x605b('0x61')]=integrations[_0x605b('0x62')](_0x2732f4['body'][_0x605b('0x63')],_0x2732f4['body']['type']);_0x2732f4[_0x605b('0x5a')][_0x605b('0x64')]=integrations['getDescriptions'](_0x2732f4[_0x605b('0x5a')][_0x605b('0x63')],_0x2732f4[_0x605b('0x5a')][_0x605b('0x3f')]);return db['SugarcrmConfiguration'][_0x605b('0x59')](_0x2732f4[_0x605b('0x5a')],{'include':[{'model':db['SugarcrmField'],'as':_0x605b('0x61')},{'model':db[_0x605b('0x65')],'as':_0x605b('0x64')}]});}return null;})['then'](respondWithResult(_0x23342f,null))['catch'](handleError(_0x23342f,null));};exports[_0x605b('0x66')]=function(_0x56aeea,_0x415df6,_0x8bcec9){var _0x320e97='';var _0x316e56=['id',_0x605b('0x39'),_0x605b('0x67'),_0x605b('0x68'),_0x605b('0x69'),'date_start',_0x605b('0x6a'),_0x605b('0x6b'),_0x605b('0x6c'),_0x605b('0x6d'),_0x605b('0x6e'),_0x605b('0x6f')];return db[_0x605b('0x3d')][_0x605b('0x5c')]({'where':{'id':_0x56aeea[_0x605b('0x57')]['id']},'attributes':['id',_0x605b('0x70'),_0x605b('0x71'),'remoteUri']})[_0x605b('0x20')](handleEntityNotFound(_0x415df6,null))[_0x605b('0x20')](function(_0x4f1ea3){if(_0x4f1ea3){_0x320e97=_0x4f1ea3[_0x605b('0x72')];var _0x3aee29=_0x320e97[_0x605b('0x73')](-0x1);if(_0x3aee29==='/'){_0x320e97=_0x320e97[_0x605b('0x74')](0x0,_0x320e97['lastIndexOf'](_0x3aee29));}return rp({'method':_0x605b('0x75'),'uri':util['format'](_0x605b('0x76'),_0x320e97,_0x605b('0x77')),'json':!![],'form':{'method':_0x605b('0x78'),'input_type':_0x605b('0x79'),'response_type':'JSON','rest_data':JSON[_0x605b('0x25')]({'user_auth':{'user_name':_0x4f1ea3[_0x605b('0x70')],'password':_0x4f1ea3[_0x605b('0x71')],'encryption':_0x605b('0x7a')},'application':_0x605b('0x7b')})}});}})[_0x605b('0x20')](function(_0xaea776){if(_0xaea776&&_0xaea776[_0x605b('0x39')]!==_0x605b('0x7c')&&_0xaea776[_0x605b('0x39')]!=='Password\x20Expired'){return rp({'method':_0x605b('0x75'),'uri':util['format'](_0x605b('0x76'),_0x320e97,_0x605b('0x77')),'json':!![],'form':{'method':_0x605b('0x7d'),'input_type':'JSON','response_type':_0x605b('0x79'),'rest_data':JSON[_0x605b('0x25')]({'session':_0xaea776['id'],'module_name':_0x605b('0x7e')})}})[_0x605b('0x20')](function(_0xd00b0){if(_0xd00b0){var _0x42fb8d=_['values'](_0xd00b0[_0x605b('0x7f')]);_['remove'](_0x42fb8d,function(_0x10d766){return _0x316e56['includes'](_0x10d766[_0x605b('0x39')]);});return{'count':_0x42fb8d[_0x605b('0x58')],'rows':_[_0x605b('0x3c')](_0x42fb8d,function(_0x6b538b){return{'id':_0x6b538b[_0x605b('0x39')],'name':_0x6b538b[_0x605b('0x80')],'custom':_[_0x605b('0x81')](_0x6b538b[_0x605b('0x39')],'_c')?!![]:![],'options':_0x6b538b['options']?_[_0x605b('0x3c')](_[_0x605b('0x82')](_0x6b538b[_0x605b('0x52')]),function(_0x19d39b){return{'name':_0x19d39b['value'],'value':_0x19d39b['name']};}):[]};})};}})[_0x605b('0x20')](respondWithResult(_0x415df6,null))['catch'](function(_0x1261de){var _0x39ec16=_0x56aeea[_0x605b('0x42')][_0x605b('0x83')]?0x1f4:_0x1261de['statusCode']||0x1f4;logger[_0x605b('0x26')](_0x605b('0x84'),_0x605b('0x66'),_0x39ec16,JSON[_0x605b('0x25')](_0x1261de));delete _0x1261de['name'];if(_0x39ec16===0x191){_0x39ec16=0x190;}_0x415df6[_0x605b('0x2d')](_0x39ec16)['send'](_0x56aeea[_0x605b('0x42')][_0x605b('0x83')]?{'message':_0x605b('0x85'),'statusCode':_0x1261de[_0x605b('0x86')]}:_0x1261de);});}else{var _0x295481=0x1f4;_0x415df6[_0x605b('0x2d')](_0x295481)[_0x605b('0x3a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xe0b2=['api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','SugarcrmAccount','count','include','rows','show','params','includeAll','merge','options','create','body','find','findOne','length','order','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','Calls','values','module_fields','includes','endsWith','value','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x191da3,_0x29e356){var _0x49c9aa=function(_0x4b1dde){while(--_0x4b1dde){_0x191da3['push'](_0x191da3['shift']());}};_0x49c9aa(++_0x29e356);}(_0xe0b2,0xec));var _0x2e0b=function(_0x42e956,_0x26c976){_0x42e956=_0x42e956-0x0;var _0x28b298=_0xe0b2[_0x42e956];return _0x28b298;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2e0b('0x0'));var rimraf=require(_0x2e0b('0x1'));var zipdir=require(_0x2e0b('0x2'));var jsonpatch=require(_0x2e0b('0x3'));var rp=require(_0x2e0b('0x4'));var moment=require(_0x2e0b('0x5'));var BPromise=require(_0x2e0b('0x6'));var Mustache=require('mustache');var util=require(_0x2e0b('0x7'));var path=require(_0x2e0b('0x8'));var sox=require(_0x2e0b('0x9'));var csv=require(_0x2e0b('0xa'));var ejs=require(_0x2e0b('0xb'));var fs=require('fs');var _=require(_0x2e0b('0xc'));var squel=require('squel');var crypto=require(_0x2e0b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2e0b('0xe'));var toCsv=require(_0x2e0b('0xa'));var querystring=require(_0x2e0b('0xf'));var Papa=require(_0x2e0b('0x10'));var Redis=require(_0x2e0b('0x11'));var authService=require(_0x2e0b('0x12'));var qs=require(_0x2e0b('0x13'));var as=require(_0x2e0b('0x14'));var hardwareService=require(_0x2e0b('0x15'));var logger=require('../../config/logger')(_0x2e0b('0x16'));var utils=require(_0x2e0b('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x2e0b('0x18'));var jayson=require(_0x2e0b('0x19'));var client=jayson[_0x2e0b('0x1a')][_0x2e0b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2a7d19,_0x36f31d,_0x1a0456){if(_0x1a0456){var _0x3d789f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d789f[_0x2e0b('0x1c')](_0x36f31d)){return _0x2a7d19;}else{throw new db[(_0x2e0b('0x1d'))][(_0x2e0b('0x1e'))](_0x2e0b('0x1f'));}}else{return _0x2a7d19;}}function respondWithRpcPromise(_0x5d0d0c,_0x5a5022,_0x4a7c04,_0x1cb1fe){return new BPromise(function(_0x4bcc46,_0x391f62){var _0x426879=_0x1cb1fe||client;return _0x426879['request'](_0x5d0d0c,_0x4a7c04)['then'](function(_0x5b9374){logger[_0x2e0b('0x20')](_0x2e0b('0x21'),_0x5a5022,_0x2e0b('0x22'));logger[_0x2e0b('0x23')](_0x2e0b('0x24'),_0x5a5022,'request\x20sent',JSON[_0x2e0b('0x25')](_0x5b9374));if(_0x5b9374['error']){if(_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x27')]===0x1f4){logger['error'](_0x2e0b('0x21'),_0x5a5022,_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x28')]);return _0x391f62(_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x28')]);}logger['error'](_0x2e0b('0x21'),_0x5a5022,_0x5b9374['error']['message']);return _0x4bcc46(_0x5b9374[_0x2e0b('0x26')][_0x2e0b('0x28')]);}else{logger[_0x2e0b('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x5a5022,_0x2e0b('0x22'));_0x4bcc46(_0x5b9374[_0x2e0b('0x29')][_0x2e0b('0x28')]);}})[_0x2e0b('0x2a')](function(_0x28ecc4){logger[_0x2e0b('0x26')](_0x2e0b('0x21'),_0x5a5022,_0x28ecc4);_0x391f62(_0x28ecc4);});});}function respondWithStatusCode(_0x263170,_0x501e7d){_0x501e7d=_0x501e7d||0xcc;return function(_0x5d61f7){if(_0x5d61f7){return _0x263170['sendStatus'](_0x501e7d);}return _0x263170[_0x2e0b('0x2b')](_0x501e7d)[_0x2e0b('0x2c')]();};}function respondWithResult(_0x1cda21,_0x452080){_0x452080=_0x452080||0xc8;return function(_0x275204){if(_0x275204){return _0x1cda21[_0x2e0b('0x2b')](_0x452080)[_0x2e0b('0x2d')](_0x275204);}};}function respondWithFilteredResult(_0x482cb0,_0x3ddb07){return function(_0x12cca8){if(_0x12cca8){var _0x63c043=_0x12cca8['count'],_0x397c30=_0x3ddb07['offset'],_0x5e19c6=_0x3ddb07[_0x2e0b('0x2e')]+_0x3ddb07[_0x2e0b('0x2f')],_0x2049a6;if(_0x5e19c6>=_0x63c043){_0x5e19c6=_0x63c043;_0x2049a6=0xc8;}else{_0x2049a6=0xce;}_0x482cb0[_0x2e0b('0x2b')](_0x2049a6);return _0x482cb0[_0x2e0b('0x30')]('Content-Range',_0x397c30+'-'+_0x5e19c6+'/'+_0x63c043)['json'](_0x12cca8);}return null;};}function patchUpdates(_0x517509){return function(_0x4316e9){try{jsonpatch[_0x2e0b('0x31')](_0x4316e9,_0x517509,!![]);}catch(_0x2cbfbd){return BPromise[_0x2e0b('0x32')](_0x2cbfbd);}return _0x4316e9[_0x2e0b('0x33')]();};}function saveUpdates(_0x2c3afe,_0x4ef4ef){return function(_0x257572){if(_0x257572){return _0x257572[_0x2e0b('0x34')](_0x2c3afe)[_0x2e0b('0x35')](function(_0x5c0e15){return _0x5c0e15;});}return null;};}function removeEntity(_0x127124,_0x5bd943){return function(_0x29d3b4){if(_0x29d3b4){return _0x29d3b4[_0x2e0b('0x36')]()['then'](function(){_0x127124[_0x2e0b('0x2b')](0xcc)[_0x2e0b('0x2c')]();});}};}function handleEntityNotFound(_0x4565f2,_0x4390a2){return function(_0x30264f){if(!_0x30264f){_0x4565f2['sendStatus'](0x194);}return _0x30264f;};}function handleError(_0x1268fb,_0xe1c827){_0xe1c827=_0xe1c827||0x1f4;return function(_0x200c96){logger[_0x2e0b('0x26')](_0x200c96['stack']);if(_0x200c96[_0x2e0b('0x37')]){delete _0x200c96['name'];}_0x1268fb['status'](_0xe1c827)['send'](_0x200c96);};}exports[_0x2e0b('0x38')]=function(_0x11053e,_0x8456d3){var _0x3a47c0={},_0x345caf={},_0x334f37={'count':0x0,'rows':[]};var _0x1d80cd=_[_0x2e0b('0x39')](db['SugarcrmAccount'][_0x2e0b('0x3a')],function(_0x8571df){return{'name':_0x8571df[_0x2e0b('0x3b')],'type':_0x8571df[_0x2e0b('0x3c')][_0x2e0b('0x3d')]};});_0x345caf[_0x2e0b('0x3e')]=_['map'](_0x1d80cd,'name');_0x345caf[_0x2e0b('0x3f')]=_[_0x2e0b('0x40')](_0x11053e[_0x2e0b('0x3f')]);_0x345caf[_0x2e0b('0x41')]=_[_0x2e0b('0x42')](_0x345caf['model'],_0x345caf[_0x2e0b('0x3f')]);_0x3a47c0[_0x2e0b('0x43')]=_[_0x2e0b('0x42')](_0x345caf['model'],qs[_0x2e0b('0x44')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x44')]));_0x3a47c0[_0x2e0b('0x43')]=_0x3a47c0[_0x2e0b('0x43')]['length']?_0x3a47c0[_0x2e0b('0x43')]:_0x345caf['model'];if(!_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x45')](_0x2e0b('0x46'))){_0x3a47c0[_0x2e0b('0x2f')]=qs[_0x2e0b('0x2f')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x2f')]);_0x3a47c0['offset']=qs[_0x2e0b('0x2e')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x2e')]);}_0x3a47c0['order']=qs[_0x2e0b('0x47')](_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x47')]);_0x3a47c0[_0x2e0b('0x48')]=qs[_0x2e0b('0x41')](_[_0x2e0b('0x49')](_0x11053e['query'],_0x345caf['filters']),_0x1d80cd);if(_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x4a')]){_0x3a47c0['where']=_['merge'](_0x3a47c0[_0x2e0b('0x48')],{'$or':_[_0x2e0b('0x39')](_0x1d80cd,function(_0x286082){if(_0x286082[_0x2e0b('0x3c')]!==_0x2e0b('0x4b')){var _0x3c16a7={};_0x3c16a7[_0x286082['name']]={'$like':'%'+_0x11053e[_0x2e0b('0x3f')][_0x2e0b('0x4a')]+'%'};return _0x3c16a7;}})});}_0x3a47c0=_['merge']({},_0x3a47c0,_0x11053e['options']);var _0x188524={'where':_0x3a47c0[_0x2e0b('0x48')]};return db[_0x2e0b('0x4c')]['count'](_0x188524)[_0x2e0b('0x35')](function(_0x3c900f){_0x334f37[_0x2e0b('0x4d')]=_0x3c900f;if(_0x11053e[_0x2e0b('0x3f')]['includeAll']){_0x3a47c0[_0x2e0b('0x4e')]=[{'all':!![]}];}return db[_0x2e0b('0x4c')]['findAll'](_0x3a47c0);})[_0x2e0b('0x35')](function(_0x3e12f2){_0x334f37[_0x2e0b('0x4f')]=_0x3e12f2;return _0x334f37;})[_0x2e0b('0x35')](respondWithFilteredResult(_0x8456d3,_0x3a47c0))[_0x2e0b('0x2a')](handleError(_0x8456d3,null));};exports[_0x2e0b('0x50')]=function(_0x2ba22b,_0x64d1b6){var _0x2e7635={'raw':![],'where':{'id':_0x2ba22b[_0x2e0b('0x51')]['id']}},_0x4c5212={};_0x4c5212[_0x2e0b('0x3e')]=_[_0x2e0b('0x40')](db[_0x2e0b('0x4c')][_0x2e0b('0x3a')]);_0x4c5212[_0x2e0b('0x3f')]=_[_0x2e0b('0x40')](_0x2ba22b[_0x2e0b('0x3f')]);_0x4c5212[_0x2e0b('0x41')]=_['intersection'](_0x4c5212['model'],_0x4c5212[_0x2e0b('0x3f')]);_0x2e7635['attributes']=_[_0x2e0b('0x42')](_0x4c5212[_0x2e0b('0x3e')],qs[_0x2e0b('0x44')](_0x2ba22b[_0x2e0b('0x3f')]['fields']));_0x2e7635[_0x2e0b('0x43')]=_0x2e7635[_0x2e0b('0x43')]['length']?_0x2e7635[_0x2e0b('0x43')]:_0x4c5212[_0x2e0b('0x3e')];if(_0x2ba22b['query'][_0x2e0b('0x52')]){_0x2e7635[_0x2e0b('0x4e')]=[{'all':!![]}];}_0x2e7635=_[_0x2e0b('0x53')]({},_0x2e7635,_0x2ba22b[_0x2e0b('0x54')]);return db['SugarcrmAccount']['find'](_0x2e7635)[_0x2e0b('0x35')](handleEntityNotFound(_0x64d1b6,null))[_0x2e0b('0x35')](respondWithResult(_0x64d1b6,null))['catch'](handleError(_0x64d1b6,null));};exports[_0x2e0b('0x55')]=function(_0x4ad530,_0x23f894){return db[_0x2e0b('0x4c')]['create'](_0x4ad530[_0x2e0b('0x56')],{})[_0x2e0b('0x35')](respondWithResult(_0x23f894,0xc9))[_0x2e0b('0x2a')](handleError(_0x23f894,null));};exports['update']=function(_0x46fda0,_0x2d84bb){if(_0x46fda0[_0x2e0b('0x56')]['id']){delete _0x46fda0[_0x2e0b('0x56')]['id'];}return db[_0x2e0b('0x4c')][_0x2e0b('0x57')]({'where':{'id':_0x46fda0[_0x2e0b('0x51')]['id']}})[_0x2e0b('0x35')](handleEntityNotFound(_0x2d84bb,null))[_0x2e0b('0x35')](saveUpdates(_0x46fda0[_0x2e0b('0x56')],null))[_0x2e0b('0x35')](respondWithResult(_0x2d84bb,null))['catch'](handleError(_0x2d84bb,null));};exports[_0x2e0b('0x36')]=function(_0x17ce40,_0x998be6){return db['SugarcrmAccount']['find']({'where':{'id':_0x17ce40[_0x2e0b('0x51')]['id']}})[_0x2e0b('0x35')](handleEntityNotFound(_0x998be6,null))[_0x2e0b('0x35')](removeEntity(_0x998be6,null))['catch'](handleError(_0x998be6,null));};exports['getConfigurations']=function(_0x308e71,_0x4333b7,_0x4b44e4){var _0x28fdec={};var _0x48309b={};var _0x3a7e5c;var _0x349f20;return db['SugarcrmAccount'][_0x2e0b('0x58')]({'where':{'id':_0x308e71[_0x2e0b('0x51')]['id']}})['then'](handleEntityNotFound(_0x4333b7,null))['then'](function(_0x9fcab4){if(_0x9fcab4){_0x3a7e5c=_0x9fcab4;_0x48309b[_0x2e0b('0x3e')]=_[_0x2e0b('0x40')](db['SugarcrmConfiguration'][_0x2e0b('0x3a')]);_0x48309b[_0x2e0b('0x3f')]=_['keys'](_0x308e71[_0x2e0b('0x3f')]);_0x48309b[_0x2e0b('0x41')]=_[_0x2e0b('0x42')](_0x48309b['model'],_0x48309b[_0x2e0b('0x3f')]);_0x28fdec['attributes']=_[_0x2e0b('0x42')](_0x48309b[_0x2e0b('0x3e')],qs['fields'](_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x44')]));_0x28fdec['attributes']=_0x28fdec['attributes'][_0x2e0b('0x59')]?_0x28fdec[_0x2e0b('0x43')]:_0x48309b[_0x2e0b('0x3e')];_0x28fdec[_0x2e0b('0x5a')]=qs['sort'](_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x47')]);_0x28fdec[_0x2e0b('0x48')]=qs[_0x2e0b('0x41')](_[_0x2e0b('0x49')](_0x308e71['query'],_0x48309b['filters']));if(_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x4a')]){_0x28fdec[_0x2e0b('0x48')]=_['merge'](_0x28fdec[_0x2e0b('0x48')],{'$or':_[_0x2e0b('0x39')](_0x28fdec[_0x2e0b('0x43')],function(_0x534bd6){var _0x5088dc={};_0x5088dc[_0x534bd6]={'$like':'%'+_0x308e71[_0x2e0b('0x3f')][_0x2e0b('0x4a')]+'%'};return _0x5088dc;})});}_0x28fdec=_[_0x2e0b('0x53')]({},_0x28fdec,_0x308e71[_0x2e0b('0x54')]);return _0x3a7e5c[_0x2e0b('0x5b')](_0x28fdec);}})[_0x2e0b('0x35')](function(_0x2b2438){if(_0x2b2438){_0x349f20=_0x2b2438[_0x2e0b('0x59')];if(!_0x308e71['query'][_0x2e0b('0x45')](_0x2e0b('0x46'))){_0x28fdec[_0x2e0b('0x2f')]=qs['limit'](_0x308e71['query'][_0x2e0b('0x2f')]);_0x28fdec[_0x2e0b('0x2e')]=qs[_0x2e0b('0x2e')](_0x308e71['query'][_0x2e0b('0x2e')]);}return _0x3a7e5c['getConfigurations'](_0x28fdec);}})['then'](function(_0x36d507){if(_0x36d507){return _0x36d507?{'count':_0x349f20,'rows':_0x36d507}:null;}})[_0x2e0b('0x35')](respondWithResult(_0x4333b7,null))[_0x2e0b('0x2a')](handleError(_0x4333b7,null));};exports[_0x2e0b('0x5c')]=function(_0x554042,_0x958f2a,_0x529588){if(_0x554042[_0x2e0b('0x56')]['id']){delete _0x554042[_0x2e0b('0x56')]['id'];}return db[_0x2e0b('0x4c')]['findOne']({'where':{'id':_0x554042['params']['id']}})[_0x2e0b('0x35')](handleEntityNotFound(_0x958f2a,null))[_0x2e0b('0x35')](function(_0x253898){if(_0x253898){_0x554042[_0x2e0b('0x56')][_0x2e0b('0x5d')]=_0x253898['id'];_0x554042[_0x2e0b('0x56')][_0x2e0b('0x5e')]=integrations['getSubjects'](_0x554042[_0x2e0b('0x56')]['channel'],_0x554042['body'][_0x2e0b('0x3c')]);_0x554042[_0x2e0b('0x56')]['Descriptions']=integrations[_0x2e0b('0x5f')](_0x554042[_0x2e0b('0x56')]['channel'],_0x554042['body']['type']);return db['SugarcrmConfiguration'][_0x2e0b('0x55')](_0x554042[_0x2e0b('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0x2e0b('0x5e')},{'model':db[_0x2e0b('0x60')],'as':_0x2e0b('0x61')}]});}return null;})[_0x2e0b('0x35')](respondWithResult(_0x958f2a,null))[_0x2e0b('0x2a')](handleError(_0x958f2a,null));};exports[_0x2e0b('0x62')]=function(_0x42ca0c,_0xc5d79f,_0x254d38){var _0x49eb2b='';var _0xc3e643=['id',_0x2e0b('0x37'),_0x2e0b('0x63'),_0x2e0b('0x64'),_0x2e0b('0x65'),'date_start',_0x2e0b('0x66'),_0x2e0b('0x67'),'parent_id',_0x2e0b('0x68'),_0x2e0b('0x69'),_0x2e0b('0x6a')];return db[_0x2e0b('0x4c')][_0x2e0b('0x58')]({'where':{'id':_0x42ca0c[_0x2e0b('0x51')]['id']},'attributes':['id',_0x2e0b('0x6b'),_0x2e0b('0x6c'),_0x2e0b('0x6d')]})['then'](handleEntityNotFound(_0xc5d79f,null))[_0x2e0b('0x35')](function(_0x4695de){if(_0x4695de){_0x49eb2b=_0x4695de[_0x2e0b('0x6d')];var _0x5d677d=_0x49eb2b['slice'](-0x1);if(_0x5d677d==='/'){_0x49eb2b=_0x49eb2b[_0x2e0b('0x6e')](0x0,_0x49eb2b[_0x2e0b('0x6f')](_0x5d677d));}return rp({'method':_0x2e0b('0x70'),'uri':util['format'](_0x2e0b('0x71'),_0x49eb2b,_0x2e0b('0x72')),'json':!![],'form':{'method':'login','input_type':_0x2e0b('0x73'),'response_type':_0x2e0b('0x73'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4695de[_0x2e0b('0x6b')],'password':_0x4695de['password'],'encryption':_0x2e0b('0x74')},'application':_0x2e0b('0x75')})}});}})[_0x2e0b('0x35')](function(_0x34a5f){if(_0x34a5f&&_0x34a5f['name']!==_0x2e0b('0x76')&&_0x34a5f['name']!=='Password\x20Expired'){return rp({'method':_0x2e0b('0x70'),'uri':util[_0x2e0b('0x77')](_0x2e0b('0x71'),_0x49eb2b,_0x2e0b('0x72')),'json':!![],'form':{'method':_0x2e0b('0x78'),'input_type':_0x2e0b('0x73'),'response_type':'JSON','rest_data':JSON[_0x2e0b('0x25')]({'session':_0x34a5f['id'],'module_name':_0x2e0b('0x79')})}})[_0x2e0b('0x35')](function(_0x273e24){if(_0x273e24){var _0x5352e5=_[_0x2e0b('0x7a')](_0x273e24[_0x2e0b('0x7b')]);_['remove'](_0x5352e5,function(_0x234dee){return _0xc3e643[_0x2e0b('0x7c')](_0x234dee[_0x2e0b('0x37')]);});return{'count':_0x5352e5['length'],'rows':_[_0x2e0b('0x39')](_0x5352e5,function(_0x5d7f0e){return{'id':_0x5d7f0e[_0x2e0b('0x37')],'name':_0x5d7f0e['label'],'custom':_[_0x2e0b('0x7d')](_0x5d7f0e['name'],'_c')?!![]:![],'options':_0x5d7f0e[_0x2e0b('0x54')]?_[_0x2e0b('0x39')](_['values'](_0x5d7f0e['options']),function(_0x1bdd11){return{'name':_0x1bdd11[_0x2e0b('0x7e')],'value':_0x1bdd11[_0x2e0b('0x37')]};}):[]};})};}})[_0x2e0b('0x35')](respondWithResult(_0xc5d79f,null))['catch'](function(_0x312bc1){var _0x2e0b83=_0x42ca0c[_0x2e0b('0x3f')][_0x2e0b('0x1c')]?0x1f4:_0x312bc1[_0x2e0b('0x7f')]||0x1f4;logger[_0x2e0b('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2e0b83,JSON[_0x2e0b('0x25')](_0x312bc1));delete _0x312bc1[_0x2e0b('0x37')];if(_0x2e0b83===0x191){_0x2e0b83=0x190;}_0xc5d79f[_0x2e0b('0x2b')](_0x2e0b83)[_0x2e0b('0x80')](_0x42ca0c[_0x2e0b('0x3f')][_0x2e0b('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x312bc1[_0x2e0b('0x7f')]}:_0x312bc1);});}else{var _0x72c7a8=0x1f4;_0xc5d79f[_0x2e0b('0x2b')](_0x72c7a8)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index b08d242..c16d495 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 _0x57df=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xe6f321,_0x172136){var _0x4fc9f7=function(_0x2a2093){while(--_0x2a2093){_0xe6f321['push'](_0xe6f321['shift']());}};_0x4fc9f7(++_0x172136);}(_0x57df,0x17f));var _0xf57d=function(_0x400e1a,_0x3290d1){_0x400e1a=_0x400e1a-0x0;var _0xca5554=_0x57df[_0x400e1a];return _0xca5554;};'use strict';var _=require(_0xf57d('0x0'));var util=require(_0xf57d('0x1'));var logger=require(_0xf57d('0x2'))(_0xf57d('0x3'));var moment=require('moment');var BPromise=require(_0xf57d('0x4'));var rp=require(_0xf57d('0x5'));var fs=require('fs');var path=require(_0xf57d('0x6'));var rimraf=require(_0xf57d('0x7'));var config=require(_0xf57d('0x8'));var attributes=require(_0xf57d('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf57d('0xa')]=function(_0x30ec7c,_0x3b08cd){return _0x30ec7c['define'](_0xf57d('0xb'),attributes,{'tableName':_0xf57d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19ae=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','define'];(function(_0x3cffe7,_0x4d784f){var _0x2b7e9e=function(_0x10deaa){while(--_0x10deaa){_0x3cffe7['push'](_0x3cffe7['shift']());}};_0x2b7e9e(++_0x4d784f);}(_0x19ae,0x199));var _0xe19a=function(_0x6e359a,_0x4eed80){_0x6e359a=_0x6e359a-0x0;var _0x4034f0=_0x19ae[_0x6e359a];return _0x4034f0;};'use strict';var _=require(_0xe19a('0x0'));var util=require(_0xe19a('0x1'));var logger=require(_0xe19a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe19a('0x3'));var rp=require(_0xe19a('0x4'));var fs=require('fs');var path=require(_0xe19a('0x5'));var rimraf=require('rimraf');var config=require(_0xe19a('0x6'));var attributes=require(_0xe19a('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3566da,_0x2b54f3){return _0x3566da[_0xe19a('0x8')](_0xe19a('0x9'),attributes,{'tableName':_0xe19a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index c3f2135..23849d0 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 _0x1588=['model','ShowSugarcrmAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map'];(function(_0x5f2327,_0x123bcd){var _0x304698=function(_0x5eb594){while(--_0x5eb594){_0x5f2327['push'](_0x5f2327['shift']());}};_0x304698(++_0x123bcd);}(_0x1588,0x1bd));var _0x8158=function(_0x297b73,_0x3c58ef){_0x297b73=_0x297b73-0x0;var _0x2c5cda=_0x1588[_0x297b73];return _0x2c5cda;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8158('0x0'));var rs=require(_0x8158('0x1'));var fs=require('fs');var Redis=require(_0x8158('0x2'));var db=require(_0x8158('0x3'))['db'];var utils=require(_0x8158('0x4'));var logger=require(_0x8158('0x5'))('rpc');var config=require(_0x8158('0x6'));var jayson=require(_0x8158('0x7'));var client=jayson['client'][_0x8158('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x569df0,_0x15b445,_0x584e66){return new BPromise(function(_0x4400b4,_0x377cd1){return client[_0x8158('0x9')](_0x569df0,_0x584e66)[_0x8158('0xa')](function(_0x5b089d){logger[_0x8158('0xb')](_0x8158('0xc'),_0x15b445,'request\x20sent');logger[_0x8158('0xd')](_0x8158('0xe'),_0x15b445,_0x8158('0xf'),JSON[_0x8158('0x10')](_0x5b089d));if(_0x5b089d[_0x8158('0x11')]){if(_0x5b089d[_0x8158('0x11')][_0x8158('0x12')]===0x1f4){logger['error'](_0x8158('0xc'),_0x15b445,_0x5b089d['error']['message']);return _0x377cd1(_0x5b089d[_0x8158('0x11')]['message']);}logger['error'](_0x8158('0xc'),_0x15b445,_0x5b089d[_0x8158('0x11')][_0x8158('0x13')]);return _0x4400b4(_0x5b089d['error'][_0x8158('0x13')]);}else{logger[_0x8158('0xb')](_0x8158('0xc'),_0x15b445,'request\x20sent');_0x4400b4(_0x5b089d[_0x8158('0x14')][_0x8158('0x13')]);}})[_0x8158('0x15')](function(_0x175de3){logger[_0x8158('0x11')](_0x8158('0xc'),_0x15b445,_0x175de3);_0x377cd1(_0x175de3);});});}exports[_0x8158('0x16')]=function(_0x1a86e0){var _0x5b97b0=this;return new Promise(function(_0x999559,_0x23093e){return db[_0x8158('0x17')]['findAll']({'raw':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x19')]===undefined?!![]:![]:!![],'where':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0['options'][_0x8158('0x1a')]||null:null,'attributes':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x1b')]||null:null,'limit':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x1c')]||null:null,'include':_0x1a86e0[_0x8158('0x18')]?_0x1a86e0[_0x8158('0x18')][_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x1a86e0[_0x8158('0x18')][_0x8158('0x1d')],function(_0x2474d2){return{'model':db[_0x2474d2['model']],'as':_0x2474d2['as'],'attributes':_0x2474d2[_0x8158('0x1b')],'include':_0x2474d2[_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x2474d2[_0x8158('0x1d')],function(_0x362dbe){return{'model':db[_0x362dbe[_0x8158('0x1f')]],'as':_0x362dbe['as'],'attributes':_0x362dbe[_0x8158('0x1b')],'include':_0x362dbe[_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x362dbe['include'],function(_0x87656f){return{'model':db[_0x87656f[_0x8158('0x1f')]],'as':_0x87656f['as'],'attributes':_0x87656f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5998f0){logger[_0x8158('0xb')](_0x8158('0x16'),_0x1a86e0);logger[_0x8158('0xd')](_0x8158('0x16'),_0x1a86e0,JSON[_0x8158('0x10')](_0x5998f0));_0x999559(_0x5998f0);})[_0x8158('0x15')](function(_0x1b5a14){logger['error'](_0x8158('0x16'),_0x1b5a14['message'],_0x1a86e0);_0x23093e(_0x5b97b0[_0x8158('0x11')](0x1f4,_0x1b5a14[_0x8158('0x13')]));});});};exports[_0x8158('0x20')]=function(_0x4cd8c1){var _0x488c21=this;return new Promise(function(_0x5734fe,_0x176ed8){return db[_0x8158('0x17')][_0x8158('0x21')]({'raw':_0x4cd8c1['options']?_0x4cd8c1['options'][_0x8158('0x19')]===undefined?!![]:![]:!![],'where':_0x4cd8c1[_0x8158('0x18')]?_0x4cd8c1[_0x8158('0x18')][_0x8158('0x1a')]||null:null,'attributes':_0x4cd8c1[_0x8158('0x18')]?_0x4cd8c1['options']['attributes']||null:null,'include':_0x4cd8c1[_0x8158('0x18')]?_0x4cd8c1['options'][_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x4cd8c1['options'][_0x8158('0x1d')],function(_0x15de3e){return{'model':db[_0x15de3e[_0x8158('0x1f')]],'as':_0x15de3e['as'],'attributes':_0x15de3e['attributes'],'include':_0x15de3e[_0x8158('0x1d')]?_[_0x8158('0x1e')](_0x15de3e[_0x8158('0x1d')],function(_0xacfcbb){return{'model':db[_0xacfcbb[_0x8158('0x1f')]],'as':_0xacfcbb['as'],'attributes':_0xacfcbb['attributes'],'include':_0xacfcbb['include']?_[_0x8158('0x1e')](_0xacfcbb[_0x8158('0x1d')],function(_0x3742ba){return{'model':db[_0x3742ba['model']],'as':_0x3742ba['as'],'attributes':_0x3742ba[_0x8158('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8158('0xa')](function(_0xde6780){logger['info'](_0x8158('0x20'),_0x4cd8c1);logger[_0x8158('0xd')](_0x8158('0x20'),_0x4cd8c1,JSON['stringify'](_0xde6780));_0x5734fe(_0xde6780);})[_0x8158('0x15')](function(_0x131841){logger[_0x8158('0x11')](_0x8158('0x20'),_0x131841['message'],_0x4cd8c1);_0x176ed8(_0x488c21[_0x8158('0x11')](0x1f4,_0x131841[_0x8158('0x13')]));});});}; \ No newline at end of file +var _0x1fb9=['GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','map','include','model','info','ShowSugarcrmAccount','find','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x5b8c28,_0x219f5f){var _0x4a36ec=function(_0x297c4e){while(--_0x297c4e){_0x5b8c28['push'](_0x5b8c28['shift']());}};_0x4a36ec(++_0x219f5f);}(_0x1fb9,0xc7));var _0x91fb=function(_0x39e227,_0x21fa81){_0x39e227=_0x39e227-0x0;var _0x558d73=_0x1fb9[_0x39e227];return _0x558d73;};'use strict';var _=require('lodash');var util=require(_0x91fb('0x0'));var moment=require(_0x91fb('0x1'));var BPromise=require(_0x91fb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91fb('0x3'));var db=require(_0x91fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91fb('0x5'))('rpc');var config=require(_0x91fb('0x6'));var jayson=require(_0x91fb('0x7'));var client=jayson[_0x91fb('0x8')][_0x91fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ae3eb,_0x2ac16d,_0x804d3d){return new BPromise(function(_0x426a99,_0x5ef135){return client['request'](_0x1ae3eb,_0x804d3d)[_0x91fb('0xa')](function(_0x44fec9){logger['info'](_0x91fb('0xb'),_0x2ac16d,_0x91fb('0xc'));logger[_0x91fb('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2ac16d,'request\x20sent',JSON[_0x91fb('0xe')](_0x44fec9));if(_0x44fec9['error']){if(_0x44fec9['error']['code']===0x1f4){logger[_0x91fb('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ac16d,_0x44fec9[_0x91fb('0xf')]['message']);return _0x5ef135(_0x44fec9[_0x91fb('0xf')]['message']);}logger[_0x91fb('0xf')](_0x91fb('0xb'),_0x2ac16d,_0x44fec9['error'][_0x91fb('0x10')]);return _0x426a99(_0x44fec9[_0x91fb('0xf')][_0x91fb('0x10')]);}else{logger['info'](_0x91fb('0xb'),_0x2ac16d,_0x91fb('0xc'));_0x426a99(_0x44fec9[_0x91fb('0x11')][_0x91fb('0x10')]);}})['catch'](function(_0x2d50f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2ac16d,_0x2d50f4);_0x5ef135(_0x2d50f4);});});}exports[_0x91fb('0x12')]=function(_0x554aca){var _0x34c6c2=this;return new Promise(function(_0x5ecbf1,_0x223331){return db[_0x91fb('0x13')]['findAll']({'raw':_0x554aca['options']?_0x554aca['options']['raw']===undefined?!![]:![]:!![],'where':_0x554aca[_0x91fb('0x14')]?_0x554aca[_0x91fb('0x14')][_0x91fb('0x15')]||null:null,'attributes':_0x554aca[_0x91fb('0x14')]?_0x554aca[_0x91fb('0x14')][_0x91fb('0x16')]||null:null,'limit':_0x554aca['options']?_0x554aca[_0x91fb('0x14')][_0x91fb('0x17')]||null:null,'include':_0x554aca[_0x91fb('0x14')]?_0x554aca[_0x91fb('0x14')]['include']?_[_0x91fb('0x18')](_0x554aca['options'][_0x91fb('0x19')],function(_0x5b5433){return{'model':db[_0x5b5433[_0x91fb('0x1a')]],'as':_0x5b5433['as'],'attributes':_0x5b5433[_0x91fb('0x16')],'include':_0x5b5433[_0x91fb('0x19')]?_['map'](_0x5b5433[_0x91fb('0x19')],function(_0x410f15){return{'model':db[_0x410f15[_0x91fb('0x1a')]],'as':_0x410f15['as'],'attributes':_0x410f15[_0x91fb('0x16')],'include':_0x410f15[_0x91fb('0x19')]?_[_0x91fb('0x18')](_0x410f15['include'],function(_0x379686){return{'model':db[_0x379686[_0x91fb('0x1a')]],'as':_0x379686['as'],'attributes':_0x379686[_0x91fb('0x16')]};}):[]};}):[]};}):[]:[]})[_0x91fb('0xa')](function(_0x44506d){logger[_0x91fb('0x1b')](_0x91fb('0x12'),_0x554aca);logger[_0x91fb('0xd')]('GetSugarcrmAccount',_0x554aca,JSON[_0x91fb('0xe')](_0x44506d));_0x5ecbf1(_0x44506d);})['catch'](function(_0x36e42e){logger[_0x91fb('0xf')](_0x91fb('0x12'),_0x36e42e[_0x91fb('0x10')],_0x554aca);_0x223331(_0x34c6c2['error'](0x1f4,_0x36e42e[_0x91fb('0x10')]));});});};exports[_0x91fb('0x1c')]=function(_0x32cdb7){var _0x590b7b=this;return new Promise(function(_0x25a31d,_0x5d3dd9){return db[_0x91fb('0x13')][_0x91fb('0x1d')]({'raw':_0x32cdb7['options']?_0x32cdb7['options']['raw']===undefined?!![]:![]:!![],'where':_0x32cdb7[_0x91fb('0x14')]?_0x32cdb7['options'][_0x91fb('0x15')]||null:null,'attributes':_0x32cdb7[_0x91fb('0x14')]?_0x32cdb7['options'][_0x91fb('0x16')]||null:null,'include':_0x32cdb7[_0x91fb('0x14')]?_0x32cdb7['options'][_0x91fb('0x19')]?_[_0x91fb('0x18')](_0x32cdb7[_0x91fb('0x14')]['include'],function(_0x280d79){return{'model':db[_0x280d79['model']],'as':_0x280d79['as'],'attributes':_0x280d79[_0x91fb('0x16')],'include':_0x280d79['include']?_[_0x91fb('0x18')](_0x280d79[_0x91fb('0x19')],function(_0x2e5ad5){return{'model':db[_0x2e5ad5['model']],'as':_0x2e5ad5['as'],'attributes':_0x2e5ad5[_0x91fb('0x16')],'include':_0x2e5ad5[_0x91fb('0x19')]?_['map'](_0x2e5ad5[_0x91fb('0x19')],function(_0x32116b){return{'model':db[_0x32116b['model']],'as':_0x32116b['as'],'attributes':_0x32116b['attributes']};}):[]};}):[]};}):[]:[]})[_0x91fb('0xa')](function(_0x451e0c){logger[_0x91fb('0x1b')](_0x91fb('0x1c'),_0x32cdb7);logger[_0x91fb('0xd')](_0x91fb('0x1c'),_0x32cdb7,JSON[_0x91fb('0xe')](_0x451e0c));_0x25a31d(_0x451e0c);})[_0x91fb('0x1e')](function(_0x159c33){logger[_0x91fb('0xf')](_0x91fb('0x1c'),_0x159c33[_0x91fb('0x10')],_0x32cdb7);_0x5d3dd9(_0x590b7b[_0x91fb('0xf')](0x1f4,_0x159c33[_0x91fb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e0bd2b9..d3129c5 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 _0x2c7a=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59c942,_0x4779f2){var _0x4091a0=function(_0x5e97ac){while(--_0x5e97ac){_0x59c942['push'](_0x59c942['shift']());}};_0x4091a0(++_0x4779f2);}(_0x2c7a,0xd5));var _0xa2c7=function(_0xf88794,_0x34ab04){_0xf88794=_0xf88794-0x0;var _0x53e972=_0x2c7a[_0xf88794];return _0x53e972;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa2c7('0x0'));var timeout=require(_0xa2c7('0x1'));var express=require(_0xa2c7('0x2'));var router=express[_0xa2c7('0x3')]();var auth=require(_0xa2c7('0x4'));var interaction=require(_0xa2c7('0x5'));var config=require(_0xa2c7('0x6'));var controller=require(_0xa2c7('0x7'));router[_0xa2c7('0x8')]('/',auth[_0xa2c7('0x9')](),controller[_0xa2c7('0xa')]);router[_0xa2c7('0x8')](_0xa2c7('0xb'),auth[_0xa2c7('0x9')](),controller[_0xa2c7('0xc')]);router[_0xa2c7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa2c7('0xd')]);router[_0xa2c7('0x8')](_0xa2c7('0xe'),auth[_0xa2c7('0x9')](),controller['getSubjects']);router[_0xa2c7('0x8')](_0xa2c7('0xf'),auth[_0xa2c7('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xa2c7('0x10')]);router[_0xa2c7('0x11')]('/:id',auth[_0xa2c7('0x9')](),controller[_0xa2c7('0x12')]);router[_0xa2c7('0x13')](_0xa2c7('0xb'),auth['isAuthenticated'](),controller[_0xa2c7('0x14')]);module[_0xa2c7('0x15')]=router; \ No newline at end of file +var _0x0cf7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','util'];(function(_0xc7d3c1,_0x318b7d){var _0x5ad8df=function(_0x49a8a1){while(--_0x49a8a1){_0xc7d3c1['push'](_0xc7d3c1['shift']());}};_0x5ad8df(++_0x318b7d);}(_0x0cf7,0x186));var _0x70cf=function(_0x25e050,_0x8c3e56){_0x25e050=_0x25e050-0x0;var _0x42ec1d=_0x0cf7[_0x25e050];return _0x42ec1d;};'use strict';var multer=require('multer');var util=require(_0x70cf('0x0'));var path=require(_0x70cf('0x1'));var timeout=require(_0x70cf('0x2'));var express=require(_0x70cf('0x3'));var router=express[_0x70cf('0x4')]();var auth=require(_0x70cf('0x5'));var interaction=require(_0x70cf('0x6'));var config=require(_0x70cf('0x7'));var controller=require(_0x70cf('0x8'));router[_0x70cf('0x9')]('/',auth[_0x70cf('0xa')](),controller[_0x70cf('0xb')]);router['get'](_0x70cf('0xc'),auth['isAuthenticated'](),controller[_0x70cf('0xd')]);router[_0x70cf('0x9')]('/:id/fields',auth[_0x70cf('0xa')](),controller[_0x70cf('0xe')]);router[_0x70cf('0x9')]('/:id/subjects',auth[_0x70cf('0xa')](),controller[_0x70cf('0xf')]);router['get'](_0x70cf('0x10'),auth['isAuthenticated'](),controller[_0x70cf('0x11')]);router[_0x70cf('0x12')]('/',auth[_0x70cf('0xa')](),controller[_0x70cf('0x13')]);router['put'](_0x70cf('0xc'),auth[_0x70cf('0xa')](),controller[_0x70cf('0x14')]);router['delete']('/:id',auth[_0x70cf('0xa')](),controller[_0x70cf('0x15')]);module[_0x70cf('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 1079aaa..2c4848e 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 _0xa9a6=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9a6,0x1de));var _0x6a9a=function(_0x622b5f,_0x3f99d0){_0x622b5f=_0x622b5f-0x0;var _0x596bcf=_0xa9a6[_0x622b5f];return _0x596bcf;};'use strict';var Sequelize=require(_0x6a9a('0x0'));module[_0x6a9a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6a9a('0x2')]}}; \ No newline at end of file +var _0xd5ca=['sequelize','STRING'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd5ca,0x6a));var _0xad5c=function(_0x20480a,_0x338c7b){_0x20480a=_0x20480a-0x0;var _0x158914=_0xd5ca[_0x20480a];return _0x158914;};'use strict';var Sequelize=require(_0xad5c('0x0'));module['exports']={'name':{'type':Sequelize[_0xad5c('0x1')]},'description':{'type':Sequelize[_0xad5c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6f99c26..e3fc67f 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 _0x9b70=['attributes','fields','length','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','create','body','params','getFields','SugarcrmField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs','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','../../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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','key','query','keys','filters','intersection','model'];(function(_0x32945c,_0x4a8553){var _0x7d896d=function(_0x1cf76e){while(--_0x1cf76e){_0x32945c['push'](_0x32945c['shift']());}};_0x7d896d(++_0x4a8553);}(_0x9b70,0x1f3));var _0x09b7=function(_0x426ab0,_0x13c67d){_0x426ab0=_0x426ab0-0x0;var _0x3bdb3d=_0x9b70[_0x426ab0];return _0x3bdb3d;};'use strict';var pdf=require(_0x09b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x09b7('0x1'));var zipdir=require(_0x09b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09b7('0x3'));var moment=require(_0x09b7('0x4'));var BPromise=require(_0x09b7('0x5'));var Mustache=require(_0x09b7('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x09b7('0x7'));var fs=require('fs');var _=require(_0x09b7('0x8'));var squel=require(_0x09b7('0x9'));var crypto=require(_0x09b7('0xa'));var jsforce=require(_0x09b7('0xb'));var deskjs=require(_0x09b7('0xc'));var toCsv=require(_0x09b7('0xd'));var querystring=require(_0x09b7('0xe'));var Papa=require(_0x09b7('0xf'));var Redis=require(_0x09b7('0x10'));var authService=require(_0x09b7('0x11'));var qs=require(_0x09b7('0x12'));var as=require(_0x09b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09b7('0x14'))(_0x09b7('0x15'));var utils=require(_0x09b7('0x16'));var config=require('../../config/environment');var db=require(_0x09b7('0x17'))['db'];var jayson=require(_0x09b7('0x18'));var client=jayson['client'][_0x09b7('0x19')]({'port':0x232a});function checkPasswordPattern(_0x18382a,_0x4dca65,_0x1db241){if(_0x1db241){var _0x23de42=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x23de42[_0x09b7('0x1a')](_0x4dca65)){return _0x18382a;}else{throw new db[(_0x09b7('0x1b'))][(_0x09b7('0x1c'))](_0x09b7('0x1d'));}}else{return _0x18382a;}}function respondWithRpcPromise(_0x77d3dc,_0x49a73f,_0x1dcc7c,_0x376bf9){return new BPromise(function(_0x52410f,_0x59e666){var _0x2b70eb=_0x376bf9||client;return _0x2b70eb[_0x09b7('0x1e')](_0x77d3dc,_0x1dcc7c)['then'](function(_0x54a39e){logger['info'](_0x09b7('0x1f'),_0x49a73f,_0x09b7('0x20'));logger[_0x09b7('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x49a73f,_0x09b7('0x20'),JSON[_0x09b7('0x22')](_0x54a39e));if(_0x54a39e[_0x09b7('0x23')]){if(_0x54a39e[_0x09b7('0x23')][_0x09b7('0x24')]===0x1f4){logger[_0x09b7('0x23')](_0x09b7('0x1f'),_0x49a73f,_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);return _0x59e666(_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);}logger['error'](_0x09b7('0x1f'),_0x49a73f,_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);return _0x52410f(_0x54a39e[_0x09b7('0x23')][_0x09b7('0x25')]);}else{logger['info'](_0x09b7('0x1f'),_0x49a73f,_0x09b7('0x20'));_0x52410f(_0x54a39e[_0x09b7('0x26')]['message']);}})[_0x09b7('0x27')](function(_0xce8ae8){logger[_0x09b7('0x23')](_0x09b7('0x1f'),_0x49a73f,_0xce8ae8);_0x59e666(_0xce8ae8);});});}function respondWithStatusCode(_0x20aaa4,_0x5c0d96){_0x5c0d96=_0x5c0d96||0xcc;return function(_0xfa986e){if(_0xfa986e){return _0x20aaa4[_0x09b7('0x28')](_0x5c0d96);}return _0x20aaa4[_0x09b7('0x29')](_0x5c0d96)[_0x09b7('0x2a')]();};}function respondWithResult(_0x21dd51,_0x16b48d){_0x16b48d=_0x16b48d||0xc8;return function(_0x42195b){if(_0x42195b){return _0x21dd51['status'](_0x16b48d)[_0x09b7('0x2b')](_0x42195b);}};}function respondWithFilteredResult(_0x21c4ef,_0x27b181){return function(_0x1a94b6){if(_0x1a94b6){var _0x538cd3=_0x1a94b6[_0x09b7('0x2c')],_0x11e804=_0x27b181[_0x09b7('0x2d')],_0x52c5e7=_0x27b181[_0x09b7('0x2d')]+_0x27b181['limit'],_0x23a2ba;if(_0x52c5e7>=_0x538cd3){_0x52c5e7=_0x538cd3;_0x23a2ba=0xc8;}else{_0x23a2ba=0xce;}_0x21c4ef[_0x09b7('0x29')](_0x23a2ba);return _0x21c4ef[_0x09b7('0x2e')](_0x09b7('0x2f'),_0x11e804+'-'+_0x52c5e7+'/'+_0x538cd3)['json'](_0x1a94b6);}return null;};}function patchUpdates(_0x247e77){return function(_0x1b2b86){try{jsonpatch[_0x09b7('0x30')](_0x1b2b86,_0x247e77,!![]);}catch(_0x198cc8){return BPromise[_0x09b7('0x31')](_0x198cc8);}return _0x1b2b86['save']();};}function saveUpdates(_0x35315c,_0xaabf5c){return function(_0x2df63d){if(_0x2df63d){return _0x2df63d[_0x09b7('0x32')](_0x35315c)[_0x09b7('0x33')](function(_0x2fc1ad){return _0x2fc1ad;});}return null;};}function removeEntity(_0x1cd5ce,_0x48fcaf){return function(_0x1d6d5c){if(_0x1d6d5c){return _0x1d6d5c[_0x09b7('0x34')]()[_0x09b7('0x33')](function(){_0x1cd5ce[_0x09b7('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e3fe3,_0xc49430){return function(_0x39b3b7){if(!_0x39b3b7){_0x7e3fe3[_0x09b7('0x28')](0x194);}return _0x39b3b7;};}function handleError(_0x2ff8c4,_0xffdf19){_0xffdf19=_0xffdf19||0x1f4;return function(_0x7f1481){logger[_0x09b7('0x23')](_0x7f1481[_0x09b7('0x35')]);if(_0x7f1481[_0x09b7('0x36')]){delete _0x7f1481[_0x09b7('0x36')];}_0x2ff8c4[_0x09b7('0x29')](_0xffdf19)[_0x09b7('0x37')](_0x7f1481);};}exports['index']=function(_0x5397d3,_0xdca0af){var _0x403f4a={},_0xfe09a1={},_0x4d0722={'count':0x0,'rows':[]};var _0x3ca0b5=_[_0x09b7('0x38')](db[_0x09b7('0x39')][_0x09b7('0x3a')],function(_0x2a9004){return{'name':_0x2a9004['fieldName'],'type':_0x2a9004['type'][_0x09b7('0x3b')]};});_0xfe09a1['model']=_[_0x09b7('0x38')](_0x3ca0b5,'name');_0xfe09a1[_0x09b7('0x3c')]=_[_0x09b7('0x3d')](_0x5397d3[_0x09b7('0x3c')]);_0xfe09a1[_0x09b7('0x3e')]=_[_0x09b7('0x3f')](_0xfe09a1[_0x09b7('0x40')],_0xfe09a1['query']);_0x403f4a[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0xfe09a1[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x42')]));_0x403f4a[_0x09b7('0x41')]=_0x403f4a['attributes'][_0x09b7('0x43')]?_0x403f4a['attributes']:_0xfe09a1[_0x09b7('0x40')];if(!_0x5397d3['query']['hasOwnProperty']('nolimit')){_0x403f4a[_0x09b7('0x44')]=qs['limit'](_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x403f4a[_0x09b7('0x2d')]=qs[_0x09b7('0x2d')](_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x2d')]);}_0x403f4a[_0x09b7('0x45')]=qs[_0x09b7('0x46')](_0x5397d3['query']['sort']);_0x403f4a[_0x09b7('0x47')]=qs[_0x09b7('0x3e')](_[_0x09b7('0x48')](_0x5397d3[_0x09b7('0x3c')],_0xfe09a1[_0x09b7('0x3e')]),_0x3ca0b5);if(_0x5397d3[_0x09b7('0x3c')]['filter']){_0x403f4a[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x403f4a[_0x09b7('0x47')],{'$or':_[_0x09b7('0x38')](_0x3ca0b5,function(_0x57bc0f){if(_0x57bc0f[_0x09b7('0x4a')]!==_0x09b7('0x4b')){var _0x4ebb0b={};_0x4ebb0b[_0x57bc0f[_0x09b7('0x36')]]={'$like':'%'+_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x4c')]+'%'};return _0x4ebb0b;}})});}_0x403f4a=_[_0x09b7('0x49')]({},_0x403f4a,_0x5397d3[_0x09b7('0x4d')]);var _0x986e12={'where':_0x403f4a[_0x09b7('0x47')]};return db[_0x09b7('0x39')][_0x09b7('0x2c')](_0x986e12)['then'](function(_0x16d6b5){_0x4d0722[_0x09b7('0x2c')]=_0x16d6b5;if(_0x5397d3[_0x09b7('0x3c')][_0x09b7('0x4e')]){_0x403f4a[_0x09b7('0x4f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x09b7('0x50')](_0x403f4a);})[_0x09b7('0x33')](function(_0x494c8f){_0x4d0722[_0x09b7('0x51')]=_0x494c8f;return _0x4d0722;})['then'](respondWithFilteredResult(_0xdca0af,_0x403f4a))['catch'](handleError(_0xdca0af,null));};exports[_0x09b7('0x52')]=function(_0x354ea4,_0x3d931){var _0x4c95df={'raw':![],'where':{'id':_0x354ea4['params']['id']}},_0x5b2a42={};_0x5b2a42[_0x09b7('0x40')]=_[_0x09b7('0x3d')](db[_0x09b7('0x39')][_0x09b7('0x3a')]);_0x5b2a42['query']=_['keys'](_0x354ea4['query']);_0x5b2a42['filters']=_[_0x09b7('0x3f')](_0x5b2a42[_0x09b7('0x40')],_0x5b2a42['query']);_0x4c95df[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0x5b2a42[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x354ea4[_0x09b7('0x3c')][_0x09b7('0x42')]));_0x4c95df[_0x09b7('0x41')]=_0x4c95df[_0x09b7('0x41')][_0x09b7('0x43')]?_0x4c95df['attributes']:_0x5b2a42[_0x09b7('0x40')];if(_0x354ea4[_0x09b7('0x3c')][_0x09b7('0x4e')]){_0x4c95df[_0x09b7('0x4f')]=[{'all':!![]}];}_0x4c95df=_['merge']({},_0x4c95df,_0x354ea4[_0x09b7('0x4d')]);return db[_0x09b7('0x39')][_0x09b7('0x53')](_0x4c95df)['then'](handleEntityNotFound(_0x3d931,null))[_0x09b7('0x33')](respondWithResult(_0x3d931,null))['catch'](handleError(_0x3d931,null));};exports[_0x09b7('0x54')]=function(_0x2849b5,_0x46d3ed){return db[_0x09b7('0x39')][_0x09b7('0x54')](_0x2849b5[_0x09b7('0x55')],{})[_0x09b7('0x33')](respondWithResult(_0x46d3ed,0xc9))[_0x09b7('0x27')](handleError(_0x46d3ed,null));};exports[_0x09b7('0x32')]=function(_0x593333,_0x2f0db6){if(_0x593333[_0x09b7('0x55')]['id']){delete _0x593333[_0x09b7('0x55')]['id'];}return db['SugarcrmConfiguration'][_0x09b7('0x53')]({'where':{'id':_0x593333[_0x09b7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f0db6,null))[_0x09b7('0x33')](saveUpdates(_0x593333[_0x09b7('0x55')],null))[_0x09b7('0x33')](respondWithResult(_0x2f0db6,null))[_0x09b7('0x27')](handleError(_0x2f0db6,null));};exports[_0x09b7('0x34')]=function(_0x446a75,_0x413583){return db[_0x09b7('0x39')][_0x09b7('0x53')]({'where':{'id':_0x446a75[_0x09b7('0x56')]['id']}})['then'](handleEntityNotFound(_0x413583,null))[_0x09b7('0x33')](removeEntity(_0x413583,null))['catch'](handleError(_0x413583,null));};exports[_0x09b7('0x57')]=function(_0x3f7ba5,_0x5885cf,_0x48e0a6){var _0x4e91d4={};var _0x4dc01e={};var _0x209c44;var _0x18d50e;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3f7ba5[_0x09b7('0x56')]['id']}})[_0x09b7('0x33')](handleEntityNotFound(_0x5885cf,null))[_0x09b7('0x33')](function(_0x19ed21){if(_0x19ed21){_0x209c44=_0x19ed21;_0x4dc01e['model']=_['keys'](db[_0x09b7('0x58')][_0x09b7('0x3a')]);_0x4dc01e[_0x09b7('0x3c')]=_['keys'](_0x3f7ba5[_0x09b7('0x3c')]);_0x4dc01e[_0x09b7('0x3e')]=_[_0x09b7('0x3f')](_0x4dc01e[_0x09b7('0x40')],_0x4dc01e[_0x09b7('0x3c')]);_0x4e91d4[_0x09b7('0x41')]=_['intersection'](_0x4dc01e[_0x09b7('0x40')],qs['fields'](_0x3f7ba5['query'][_0x09b7('0x42')]));_0x4e91d4[_0x09b7('0x41')]=_0x4e91d4[_0x09b7('0x41')][_0x09b7('0x43')]?_0x4e91d4['attributes']:_0x4dc01e[_0x09b7('0x40')];_0x4e91d4[_0x09b7('0x45')]=qs['sort'](_0x3f7ba5[_0x09b7('0x3c')]['sort']);_0x4e91d4[_0x09b7('0x47')]=qs[_0x09b7('0x3e')](_[_0x09b7('0x48')](_0x3f7ba5['query'],_0x4dc01e[_0x09b7('0x3e')]));if(_0x3f7ba5[_0x09b7('0x3c')]['filter']){_0x4e91d4[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x4e91d4[_0x09b7('0x47')],{'$or':_['map'](_0x4e91d4['attributes'],function(_0x1cdef1){var _0x3dfef0={};_0x3dfef0[_0x1cdef1]={'$like':'%'+_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x4c')]+'%'};return _0x3dfef0;})});}_0x4e91d4=_[_0x09b7('0x49')]({},_0x4e91d4,_0x3f7ba5['options']);return _0x209c44[_0x09b7('0x57')](_0x4e91d4);}})['then'](function(_0x22102e){if(_0x22102e){_0x18d50e=_0x22102e['length'];if(!_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x59')](_0x09b7('0x5a'))){_0x4e91d4[_0x09b7('0x44')]=qs[_0x09b7('0x44')](_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x4e91d4[_0x09b7('0x2d')]=qs[_0x09b7('0x2d')](_0x3f7ba5[_0x09b7('0x3c')][_0x09b7('0x2d')]);}return _0x209c44[_0x09b7('0x57')](_0x4e91d4);}})[_0x09b7('0x33')](function(_0x22d065){if(_0x22d065){return _0x22d065?{'count':_0x18d50e,'rows':_0x22d065}:null;}})['then'](respondWithResult(_0x5885cf,null))[_0x09b7('0x27')](handleError(_0x5885cf,null));};exports[_0x09b7('0x5b')]=function(_0x4cd01b,_0x4646f0,_0x57def3){var _0x46be0a={};var _0x303b4b={};var _0x4113d5;var _0x27fd40;return db[_0x09b7('0x39')][_0x09b7('0x5c')]({'where':{'id':_0x4cd01b[_0x09b7('0x56')]['id']}})[_0x09b7('0x33')](handleEntityNotFound(_0x4646f0,null))[_0x09b7('0x33')](function(_0x1a1d94){if(_0x1a1d94){_0x4113d5=_0x1a1d94;_0x303b4b[_0x09b7('0x40')]=_[_0x09b7('0x3d')](db['SugarcrmField']['rawAttributes']);_0x303b4b[_0x09b7('0x3c')]=_[_0x09b7('0x3d')](_0x4cd01b['query']);_0x303b4b['filters']=_[_0x09b7('0x3f')](_0x303b4b['model'],_0x303b4b[_0x09b7('0x3c')]);_0x46be0a[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0x303b4b[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x4cd01b['query'][_0x09b7('0x42')]));_0x46be0a[_0x09b7('0x41')]=_0x46be0a[_0x09b7('0x41')]['length']?_0x46be0a[_0x09b7('0x41')]:_0x303b4b[_0x09b7('0x40')];_0x46be0a[_0x09b7('0x45')]=qs[_0x09b7('0x46')](_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x46')]);_0x46be0a['where']=qs[_0x09b7('0x3e')](_[_0x09b7('0x48')](_0x4cd01b['query'],_0x303b4b[_0x09b7('0x3e')]));if(_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x4c')]){_0x46be0a[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x46be0a[_0x09b7('0x47')],{'$or':_['map'](_0x46be0a[_0x09b7('0x41')],function(_0x48743e){var _0x558079={};_0x558079[_0x48743e]={'$like':'%'+_0x4cd01b['query'][_0x09b7('0x4c')]+'%'};return _0x558079;})});}_0x46be0a=_[_0x09b7('0x49')]({},_0x46be0a,_0x4cd01b[_0x09b7('0x4d')]);return _0x4113d5[_0x09b7('0x5b')](_0x46be0a);}})[_0x09b7('0x33')](function(_0x12d212){if(_0x12d212){_0x27fd40=_0x12d212['length'];if(!_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x59')](_0x09b7('0x5a'))){_0x46be0a[_0x09b7('0x44')]=qs['limit'](_0x4cd01b[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x46be0a['offset']=qs[_0x09b7('0x2d')](_0x4cd01b['query']['offset']);}return _0x4113d5[_0x09b7('0x5b')](_0x46be0a);}})[_0x09b7('0x33')](function(_0x6e4343){if(_0x6e4343){return _0x6e4343?{'count':_0x27fd40,'rows':_0x6e4343}:null;}})[_0x09b7('0x33')](respondWithResult(_0x4646f0,null))[_0x09b7('0x27')](handleError(_0x4646f0,null));};exports[_0x09b7('0x5d')]=function(_0x28c73a,_0x2d0b0b,_0x820abd){var _0x109407={};var _0x50d136={};var _0x4ba32c;var _0x2a90a0;return db[_0x09b7('0x39')]['findOne']({'where':{'id':_0x28c73a[_0x09b7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d0b0b,null))['then'](function(_0x475812){if(_0x475812){_0x4ba32c=_0x475812;_0x50d136['model']=_['keys'](db[_0x09b7('0x58')]['rawAttributes']);_0x50d136[_0x09b7('0x3c')]=_[_0x09b7('0x3d')](_0x28c73a[_0x09b7('0x3c')]);_0x50d136['filters']=_[_0x09b7('0x3f')](_0x50d136[_0x09b7('0x40')],_0x50d136['query']);_0x109407[_0x09b7('0x41')]=_[_0x09b7('0x3f')](_0x50d136[_0x09b7('0x40')],qs[_0x09b7('0x42')](_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x42')]));_0x109407[_0x09b7('0x41')]=_0x109407['attributes']['length']?_0x109407[_0x09b7('0x41')]:_0x50d136[_0x09b7('0x40')];_0x109407[_0x09b7('0x45')]=qs[_0x09b7('0x46')](_0x28c73a['query'][_0x09b7('0x46')]);_0x109407[_0x09b7('0x47')]=qs['filters'](_[_0x09b7('0x48')](_0x28c73a['query'],_0x50d136['filters']));if(_0x28c73a['query'][_0x09b7('0x4c')]){_0x109407[_0x09b7('0x47')]=_[_0x09b7('0x49')](_0x109407[_0x09b7('0x47')],{'$or':_[_0x09b7('0x38')](_0x109407[_0x09b7('0x41')],function(_0x377a01){var _0x29dd2e={};_0x29dd2e[_0x377a01]={'$like':'%'+_0x28c73a[_0x09b7('0x3c')]['filter']+'%'};return _0x29dd2e;})});}_0x109407=_[_0x09b7('0x49')]({},_0x109407,_0x28c73a[_0x09b7('0x4d')]);return _0x4ba32c['getDescriptions'](_0x109407);}})[_0x09b7('0x33')](function(_0x3d3af9){if(_0x3d3af9){_0x2a90a0=_0x3d3af9[_0x09b7('0x43')];if(!_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x59')](_0x09b7('0x5a'))){_0x109407['limit']=qs[_0x09b7('0x44')](_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x44')]);_0x109407[_0x09b7('0x2d')]=qs[_0x09b7('0x2d')](_0x28c73a[_0x09b7('0x3c')][_0x09b7('0x2d')]);}return _0x4ba32c['getDescriptions'](_0x109407);}})[_0x09b7('0x33')](function(_0x34dce2){if(_0x34dce2){return _0x34dce2?{'count':_0x2a90a0,'rows':_0x34dce2}:null;}})[_0x09b7('0x33')](respondWithResult(_0x2d0b0b,null))[_0x09b7('0x27')](handleError(_0x2d0b0b,null));}; \ No newline at end of file +var _0x2b3e=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','end','count','offset','limit','set','Content-Range','reject','save','destroy','sendStatus','stack','name','send','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','update','params','getFields','findOne','SugarcrmField','rawAttributes','order','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x5ab1fc,_0x377cb2){var _0x53cb78=function(_0x1cff17){while(--_0x1cff17){_0x5ab1fc['push'](_0x5ab1fc['shift']());}};_0x53cb78(++_0x377cb2);}(_0x2b3e,0x1d9));var _0xe2b3=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x2b3e[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0xe2b3('0x0'));var emlformat=require(_0xe2b3('0x1'));var rimraf=require(_0xe2b3('0x2'));var zipdir=require(_0xe2b3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2b3('0x4'));var moment=require(_0xe2b3('0x5'));var BPromise=require(_0xe2b3('0x6'));var Mustache=require(_0xe2b3('0x7'));var util=require('util');var path=require(_0xe2b3('0x8'));var sox=require(_0xe2b3('0x9'));var csv=require('to-csv');var ejs=require(_0xe2b3('0xa'));var fs=require('fs');var _=require(_0xe2b3('0xb'));var squel=require(_0xe2b3('0xc'));var crypto=require(_0xe2b3('0xd'));var jsforce=require(_0xe2b3('0xe'));var deskjs=require(_0xe2b3('0xf'));var toCsv=require(_0xe2b3('0x10'));var querystring=require(_0xe2b3('0x11'));var Papa=require(_0xe2b3('0x12'));var Redis=require(_0xe2b3('0x13'));var authService=require(_0xe2b3('0x14'));var qs=require(_0xe2b3('0x15'));var as=require(_0xe2b3('0x16'));var hardwareService=require(_0xe2b3('0x17'));var logger=require(_0xe2b3('0x18'))('api');var utils=require(_0xe2b3('0x19'));var config=require(_0xe2b3('0x1a'));var db=require(_0xe2b3('0x1b'))['db'];var jayson=require(_0xe2b3('0x1c'));var client=jayson['client'][_0xe2b3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1d421b,_0x17f193,_0x5f4bcb){if(_0x5f4bcb){var _0x4b47e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b47e5[_0xe2b3('0x1e')](_0x17f193)){return _0x1d421b;}else{throw new db[(_0xe2b3('0x1f'))][(_0xe2b3('0x20'))](_0xe2b3('0x21'));}}else{return _0x1d421b;}}function respondWithRpcPromise(_0x5d1d0a,_0x46112e,_0x1a0189,_0x2bf367){return new BPromise(function(_0x3fdecb,_0x2d3c17){var _0x58f6ce=_0x2bf367||client;return _0x58f6ce[_0xe2b3('0x22')](_0x5d1d0a,_0x1a0189)[_0xe2b3('0x23')](function(_0x2e5c3a){logger[_0xe2b3('0x24')](_0xe2b3('0x25'),_0x46112e,'request\x20sent');logger['debug'](_0xe2b3('0x26'),_0x46112e,_0xe2b3('0x27'),JSON['stringify'](_0x2e5c3a));if(_0x2e5c3a[_0xe2b3('0x28')]){if(_0x2e5c3a[_0xe2b3('0x28')][_0xe2b3('0x29')]===0x1f4){logger[_0xe2b3('0x28')](_0xe2b3('0x25'),_0x46112e,_0x2e5c3a[_0xe2b3('0x28')][_0xe2b3('0x2a')]);return _0x2d3c17(_0x2e5c3a['error'][_0xe2b3('0x2a')]);}logger[_0xe2b3('0x28')](_0xe2b3('0x25'),_0x46112e,_0x2e5c3a[_0xe2b3('0x28')]['message']);return _0x3fdecb(_0x2e5c3a[_0xe2b3('0x28')]['message']);}else{logger[_0xe2b3('0x24')](_0xe2b3('0x25'),_0x46112e,_0xe2b3('0x27'));_0x3fdecb(_0x2e5c3a[_0xe2b3('0x2b')]['message']);}})['catch'](function(_0x5ededf){logger[_0xe2b3('0x28')](_0xe2b3('0x25'),_0x46112e,_0x5ededf);_0x2d3c17(_0x5ededf);});});}function respondWithStatusCode(_0x3217c4,_0x1b23f2){_0x1b23f2=_0x1b23f2||0xcc;return function(_0x734634){if(_0x734634){return _0x3217c4['sendStatus'](_0x1b23f2);}return _0x3217c4[_0xe2b3('0x2c')](_0x1b23f2)[_0xe2b3('0x2d')]();};}function respondWithResult(_0x3327b9,_0x10aded){_0x10aded=_0x10aded||0xc8;return function(_0x4a4645){if(_0x4a4645){return _0x3327b9[_0xe2b3('0x2c')](_0x10aded)['json'](_0x4a4645);}};}function respondWithFilteredResult(_0x4ffc34,_0x457da9){return function(_0x408a46){if(_0x408a46){var _0x5750a0=_0x408a46[_0xe2b3('0x2e')],_0x2c3fca=_0x457da9[_0xe2b3('0x2f')],_0x5e5637=_0x457da9['offset']+_0x457da9[_0xe2b3('0x30')],_0x40b7d4;if(_0x5e5637>=_0x5750a0){_0x5e5637=_0x5750a0;_0x40b7d4=0xc8;}else{_0x40b7d4=0xce;}_0x4ffc34[_0xe2b3('0x2c')](_0x40b7d4);return _0x4ffc34[_0xe2b3('0x31')](_0xe2b3('0x32'),_0x2c3fca+'-'+_0x5e5637+'/'+_0x5750a0)['json'](_0x408a46);}return null;};}function patchUpdates(_0x51b11a){return function(_0x431fb9){try{jsonpatch['apply'](_0x431fb9,_0x51b11a,!![]);}catch(_0x293e9d){return BPromise[_0xe2b3('0x33')](_0x293e9d);}return _0x431fb9[_0xe2b3('0x34')]();};}function saveUpdates(_0xda1f15,_0x50a80d){return function(_0x2dba94){if(_0x2dba94){return _0x2dba94['update'](_0xda1f15)[_0xe2b3('0x23')](function(_0x2bf2f6){return _0x2bf2f6;});}return null;};}function removeEntity(_0x15a987,_0x533c44){return function(_0x3789fa){if(_0x3789fa){return _0x3789fa[_0xe2b3('0x35')]()[_0xe2b3('0x23')](function(){_0x15a987[_0xe2b3('0x2c')](0xcc)[_0xe2b3('0x2d')]();});}};}function handleEntityNotFound(_0x19cf86,_0x367227){return function(_0x4e7692){if(!_0x4e7692){_0x19cf86[_0xe2b3('0x36')](0x194);}return _0x4e7692;};}function handleError(_0x12839d,_0x5de9b0){_0x5de9b0=_0x5de9b0||0x1f4;return function(_0x5a47e8){logger[_0xe2b3('0x28')](_0x5a47e8[_0xe2b3('0x37')]);if(_0x5a47e8[_0xe2b3('0x38')]){delete _0x5a47e8[_0xe2b3('0x38')];}_0x12839d['status'](_0x5de9b0)[_0xe2b3('0x39')](_0x5a47e8);};}exports['index']=function(_0x55407e,_0x369ac2){var _0x453ed0={},_0xa5579={},_0x3005a9={'count':0x0,'rows':[]};var _0x26611b=_[_0xe2b3('0x3a')](db[_0xe2b3('0x3b')]['rawAttributes'],function(_0x539d4a){return{'name':_0x539d4a[_0xe2b3('0x3c')],'type':_0x539d4a[_0xe2b3('0x3d')][_0xe2b3('0x3e')]};});_0xa5579[_0xe2b3('0x3f')]=_[_0xe2b3('0x3a')](_0x26611b,'name');_0xa5579[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x55407e[_0xe2b3('0x40')]);_0xa5579[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0xa5579[_0xe2b3('0x3f')],_0xa5579['query']);_0x453ed0['attributes']=_[_0xe2b3('0x43')](_0xa5579[_0xe2b3('0x3f')],qs[_0xe2b3('0x44')](_0x55407e[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x453ed0[_0xe2b3('0x45')]=_0x453ed0[_0xe2b3('0x45')][_0xe2b3('0x46')]?_0x453ed0['attributes']:_0xa5579[_0xe2b3('0x3f')];if(!_0x55407e[_0xe2b3('0x40')][_0xe2b3('0x47')](_0xe2b3('0x48'))){_0x453ed0['limit']=qs['limit'](_0x55407e[_0xe2b3('0x40')]['limit']);_0x453ed0[_0xe2b3('0x2f')]=qs['offset'](_0x55407e[_0xe2b3('0x40')][_0xe2b3('0x2f')]);}_0x453ed0['order']=qs[_0xe2b3('0x49')](_0x55407e[_0xe2b3('0x40')]['sort']);_0x453ed0[_0xe2b3('0x4a')]=qs['filters'](_[_0xe2b3('0x4b')](_0x55407e[_0xe2b3('0x40')],_0xa5579[_0xe2b3('0x42')]),_0x26611b);if(_0x55407e['query'][_0xe2b3('0x4c')]){_0x453ed0[_0xe2b3('0x4a')]=_[_0xe2b3('0x4d')](_0x453ed0[_0xe2b3('0x4a')],{'$or':_['map'](_0x26611b,function(_0x451381){if(_0x451381['type']!==_0xe2b3('0x4e')){var _0x2d74bb={};_0x2d74bb[_0x451381[_0xe2b3('0x38')]]={'$like':'%'+_0x55407e[_0xe2b3('0x40')]['filter']+'%'};return _0x2d74bb;}})});}_0x453ed0=_[_0xe2b3('0x4d')]({},_0x453ed0,_0x55407e[_0xe2b3('0x4f')]);var _0x29d952={'where':_0x453ed0[_0xe2b3('0x4a')]};return db[_0xe2b3('0x3b')]['count'](_0x29d952)[_0xe2b3('0x23')](function(_0x137f76){_0x3005a9[_0xe2b3('0x2e')]=_0x137f76;if(_0x55407e[_0xe2b3('0x40')]['includeAll']){_0x453ed0[_0xe2b3('0x50')]=[{'all':!![]}];}return db[_0xe2b3('0x3b')][_0xe2b3('0x51')](_0x453ed0);})['then'](function(_0x57aee5){_0x3005a9['rows']=_0x57aee5;return _0x3005a9;})['then'](respondWithFilteredResult(_0x369ac2,_0x453ed0))[_0xe2b3('0x52')](handleError(_0x369ac2,null));};exports[_0xe2b3('0x53')]=function(_0x11b523,_0x574c5e){var _0xb62c8a={'raw':![],'where':{'id':_0x11b523['params']['id']}},_0x1e40db={};_0x1e40db['model']=_[_0xe2b3('0x41')](db[_0xe2b3('0x3b')]['rawAttributes']);_0x1e40db[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x11b523[_0xe2b3('0x40')]);_0x1e40db[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x1e40db[_0xe2b3('0x3f')],_0x1e40db[_0xe2b3('0x40')]);_0xb62c8a['attributes']=_[_0xe2b3('0x43')](_0x1e40db['model'],qs[_0xe2b3('0x44')](_0x11b523[_0xe2b3('0x40')]['fields']));_0xb62c8a[_0xe2b3('0x45')]=_0xb62c8a[_0xe2b3('0x45')][_0xe2b3('0x46')]?_0xb62c8a[_0xe2b3('0x45')]:_0x1e40db[_0xe2b3('0x3f')];if(_0x11b523['query'][_0xe2b3('0x54')]){_0xb62c8a[_0xe2b3('0x50')]=[{'all':!![]}];}_0xb62c8a=_['merge']({},_0xb62c8a,_0x11b523[_0xe2b3('0x4f')]);return db[_0xe2b3('0x3b')][_0xe2b3('0x55')](_0xb62c8a)[_0xe2b3('0x23')](handleEntityNotFound(_0x574c5e,null))[_0xe2b3('0x23')](respondWithResult(_0x574c5e,null))[_0xe2b3('0x52')](handleError(_0x574c5e,null));};exports['create']=function(_0x20c6e8,_0x15e35d){return db[_0xe2b3('0x3b')][_0xe2b3('0x56')](_0x20c6e8[_0xe2b3('0x57')],{})[_0xe2b3('0x23')](respondWithResult(_0x15e35d,0xc9))[_0xe2b3('0x52')](handleError(_0x15e35d,null));};exports[_0xe2b3('0x58')]=function(_0x109219,_0x51e6f0){if(_0x109219['body']['id']){delete _0x109219['body']['id'];}return db[_0xe2b3('0x3b')][_0xe2b3('0x55')]({'where':{'id':_0x109219[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x51e6f0,null))['then'](saveUpdates(_0x109219[_0xe2b3('0x57')],null))[_0xe2b3('0x23')](respondWithResult(_0x51e6f0,null))[_0xe2b3('0x52')](handleError(_0x51e6f0,null));};exports[_0xe2b3('0x35')]=function(_0x3a22c7,_0x1e594b){return db[_0xe2b3('0x3b')][_0xe2b3('0x55')]({'where':{'id':_0x3a22c7[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x1e594b,null))[_0xe2b3('0x23')](removeEntity(_0x1e594b,null))[_0xe2b3('0x52')](handleError(_0x1e594b,null));};exports[_0xe2b3('0x5a')]=function(_0x26f57b,_0x59a2b9,_0x2c46bb){var _0x5b25ea={};var _0x21fb44={};var _0x1eae05;var _0x35ae78;return db[_0xe2b3('0x3b')][_0xe2b3('0x5b')]({'where':{'id':_0x26f57b[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x59a2b9,null))[_0xe2b3('0x23')](function(_0x167f73){if(_0x167f73){_0x1eae05=_0x167f73;_0x21fb44[_0xe2b3('0x3f')]=_[_0xe2b3('0x41')](db[_0xe2b3('0x5c')][_0xe2b3('0x5d')]);_0x21fb44[_0xe2b3('0x40')]=_['keys'](_0x26f57b[_0xe2b3('0x40')]);_0x21fb44[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x21fb44['model'],_0x21fb44[_0xe2b3('0x40')]);_0x5b25ea[_0xe2b3('0x45')]=_[_0xe2b3('0x43')](_0x21fb44[_0xe2b3('0x3f')],qs[_0xe2b3('0x44')](_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x5b25ea[_0xe2b3('0x45')]=_0x5b25ea['attributes'][_0xe2b3('0x46')]?_0x5b25ea[_0xe2b3('0x45')]:_0x21fb44[_0xe2b3('0x3f')];_0x5b25ea[_0xe2b3('0x5e')]=qs[_0xe2b3('0x49')](_0x26f57b[_0xe2b3('0x40')]['sort']);_0x5b25ea[_0xe2b3('0x4a')]=qs['filters'](_['pick'](_0x26f57b[_0xe2b3('0x40')],_0x21fb44[_0xe2b3('0x42')]));if(_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x4c')]){_0x5b25ea[_0xe2b3('0x4a')]=_[_0xe2b3('0x4d')](_0x5b25ea[_0xe2b3('0x4a')],{'$or':_[_0xe2b3('0x3a')](_0x5b25ea[_0xe2b3('0x45')],function(_0x25c0b9){var _0x302692={};_0x302692[_0x25c0b9]={'$like':'%'+_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x4c')]+'%'};return _0x302692;})});}_0x5b25ea=_[_0xe2b3('0x4d')]({},_0x5b25ea,_0x26f57b[_0xe2b3('0x4f')]);return _0x1eae05[_0xe2b3('0x5a')](_0x5b25ea);}})[_0xe2b3('0x23')](function(_0x437101){if(_0x437101){_0x35ae78=_0x437101[_0xe2b3('0x46')];if(!_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x47')](_0xe2b3('0x48'))){_0x5b25ea[_0xe2b3('0x30')]=qs['limit'](_0x26f57b[_0xe2b3('0x40')][_0xe2b3('0x30')]);_0x5b25ea[_0xe2b3('0x2f')]=qs[_0xe2b3('0x2f')](_0x26f57b['query'][_0xe2b3('0x2f')]);}return _0x1eae05[_0xe2b3('0x5a')](_0x5b25ea);}})[_0xe2b3('0x23')](function(_0x473f6c){if(_0x473f6c){return _0x473f6c?{'count':_0x35ae78,'rows':_0x473f6c}:null;}})[_0xe2b3('0x23')](respondWithResult(_0x59a2b9,null))[_0xe2b3('0x52')](handleError(_0x59a2b9,null));};exports['getSubjects']=function(_0x302bd2,_0x1c22f8,_0x1e234d){var _0x2f53fd={};var _0x2dc72b={};var _0x354db8;var _0x583189;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x302bd2['params']['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x1c22f8,null))[_0xe2b3('0x23')](function(_0x35bcf8){if(_0x35bcf8){_0x354db8=_0x35bcf8;_0x2dc72b[_0xe2b3('0x3f')]=_[_0xe2b3('0x41')](db[_0xe2b3('0x5c')][_0xe2b3('0x5d')]);_0x2dc72b[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x302bd2[_0xe2b3('0x40')]);_0x2dc72b[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x2dc72b[_0xe2b3('0x3f')],_0x2dc72b['query']);_0x2f53fd[_0xe2b3('0x45')]=_[_0xe2b3('0x43')](_0x2dc72b[_0xe2b3('0x3f')],qs[_0xe2b3('0x44')](_0x302bd2[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x2f53fd[_0xe2b3('0x45')]=_0x2f53fd[_0xe2b3('0x45')]['length']?_0x2f53fd[_0xe2b3('0x45')]:_0x2dc72b[_0xe2b3('0x3f')];_0x2f53fd[_0xe2b3('0x5e')]=qs[_0xe2b3('0x49')](_0x302bd2[_0xe2b3('0x40')][_0xe2b3('0x49')]);_0x2f53fd[_0xe2b3('0x4a')]=qs['filters'](_[_0xe2b3('0x4b')](_0x302bd2[_0xe2b3('0x40')],_0x2dc72b[_0xe2b3('0x42')]));if(_0x302bd2[_0xe2b3('0x40')]['filter']){_0x2f53fd['where']=_[_0xe2b3('0x4d')](_0x2f53fd['where'],{'$or':_[_0xe2b3('0x3a')](_0x2f53fd[_0xe2b3('0x45')],function(_0x293eeb){var _0x2a3f27={};_0x2a3f27[_0x293eeb]={'$like':'%'+_0x302bd2[_0xe2b3('0x40')]['filter']+'%'};return _0x2a3f27;})});}_0x2f53fd=_[_0xe2b3('0x4d')]({},_0x2f53fd,_0x302bd2[_0xe2b3('0x4f')]);return _0x354db8[_0xe2b3('0x5f')](_0x2f53fd);}})[_0xe2b3('0x23')](function(_0xd5f0d3){if(_0xd5f0d3){_0x583189=_0xd5f0d3[_0xe2b3('0x46')];if(!_0x302bd2[_0xe2b3('0x40')]['hasOwnProperty'](_0xe2b3('0x48'))){_0x2f53fd['limit']=qs[_0xe2b3('0x30')](_0x302bd2[_0xe2b3('0x40')][_0xe2b3('0x30')]);_0x2f53fd[_0xe2b3('0x2f')]=qs[_0xe2b3('0x2f')](_0x302bd2[_0xe2b3('0x40')]['offset']);}return _0x354db8[_0xe2b3('0x5f')](_0x2f53fd);}})[_0xe2b3('0x23')](function(_0x2290fa){if(_0x2290fa){return _0x2290fa?{'count':_0x583189,'rows':_0x2290fa}:null;}})[_0xe2b3('0x23')](respondWithResult(_0x1c22f8,null))['catch'](handleError(_0x1c22f8,null));};exports[_0xe2b3('0x60')]=function(_0x2ee2fd,_0x5ec5f3,_0x23ee41){var _0x5ce558={};var _0x5a7404={};var _0x5b513c;var _0x3f89c2;return db[_0xe2b3('0x3b')][_0xe2b3('0x5b')]({'where':{'id':_0x2ee2fd[_0xe2b3('0x59')]['id']}})[_0xe2b3('0x23')](handleEntityNotFound(_0x5ec5f3,null))[_0xe2b3('0x23')](function(_0x6801c2){if(_0x6801c2){_0x5b513c=_0x6801c2;_0x5a7404[_0xe2b3('0x3f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x5a7404[_0xe2b3('0x40')]=_[_0xe2b3('0x41')](_0x2ee2fd[_0xe2b3('0x40')]);_0x5a7404[_0xe2b3('0x42')]=_[_0xe2b3('0x43')](_0x5a7404[_0xe2b3('0x3f')],_0x5a7404[_0xe2b3('0x40')]);_0x5ce558[_0xe2b3('0x45')]=_[_0xe2b3('0x43')](_0x5a7404['model'],qs[_0xe2b3('0x44')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x44')]));_0x5ce558[_0xe2b3('0x45')]=_0x5ce558[_0xe2b3('0x45')][_0xe2b3('0x46')]?_0x5ce558[_0xe2b3('0x45')]:_0x5a7404[_0xe2b3('0x3f')];_0x5ce558['order']=qs[_0xe2b3('0x49')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x49')]);_0x5ce558[_0xe2b3('0x4a')]=qs['filters'](_[_0xe2b3('0x4b')](_0x2ee2fd[_0xe2b3('0x40')],_0x5a7404[_0xe2b3('0x42')]));if(_0x2ee2fd[_0xe2b3('0x40')]['filter']){_0x5ce558[_0xe2b3('0x4a')]=_[_0xe2b3('0x4d')](_0x5ce558[_0xe2b3('0x4a')],{'$or':_[_0xe2b3('0x3a')](_0x5ce558[_0xe2b3('0x45')],function(_0x1352bd){var _0xd6e6a7={};_0xd6e6a7[_0x1352bd]={'$like':'%'+_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x4c')]+'%'};return _0xd6e6a7;})});}_0x5ce558=_[_0xe2b3('0x4d')]({},_0x5ce558,_0x2ee2fd['options']);return _0x5b513c[_0xe2b3('0x60')](_0x5ce558);}})[_0xe2b3('0x23')](function(_0x3dfde2){if(_0x3dfde2){_0x3f89c2=_0x3dfde2['length'];if(!_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x47')](_0xe2b3('0x48'))){_0x5ce558['limit']=qs[_0xe2b3('0x30')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x30')]);_0x5ce558['offset']=qs[_0xe2b3('0x2f')](_0x2ee2fd[_0xe2b3('0x40')][_0xe2b3('0x2f')]);}return _0x5b513c[_0xe2b3('0x60')](_0x5ce558);}})[_0xe2b3('0x23')](function(_0x36943d){if(_0x36943d){return _0x36943d?{'count':_0x3f89c2,'rows':_0x36943d}:null;}})[_0xe2b3('0x23')](respondWithResult(_0x5ec5f3,null))[_0xe2b3('0x52')](handleError(_0x5ec5f3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2734965..cba643f 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 _0xb76e=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','api'];(function(_0x3d3345,_0x16e522){var _0x2684b2=function(_0x4c46f){while(--_0x4c46f){_0x3d3345['push'](_0x3d3345['shift']());}};_0x2684b2(++_0x16e522);}(_0xb76e,0xb8));var _0xeb76=function(_0x41be1a,_0x152cf2){_0x41be1a=_0x41be1a-0x0;var _0x4c9cad=_0xb76e[_0x41be1a];return _0x4c9cad;};'use strict';var _=require(_0xeb76('0x0'));var util=require(_0xeb76('0x1'));var logger=require('../../config/logger')(_0xeb76('0x2'));var moment=require('moment');var BPromise=require(_0xeb76('0x3'));var rp=require(_0xeb76('0x4'));var fs=require('fs');var path=require(_0xeb76('0x5'));var rimraf=require(_0xeb76('0x6'));var config=require(_0xeb76('0x7'));var attributes=require(_0xeb76('0x8'));module[_0xeb76('0x9')]=function(_0x5d49ed,_0x397e00){return _0x5d49ed['define'](_0xeb76('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cc8=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x12d6ba,_0x2e6236){var _0x41a75a=function(_0x47a7b4){while(--_0x47a7b4){_0x12d6ba['push'](_0x12d6ba['shift']());}};_0x41a75a(++_0x2e6236);}(_0x9cc8,0x70));var _0x89cc=function(_0x2aead6,_0x54a533){_0x2aead6=_0x2aead6-0x0;var _0x1cc19a=_0x9cc8[_0x2aead6];return _0x1cc19a;};'use strict';var _=require(_0x89cc('0x0'));var util=require(_0x89cc('0x1'));var logger=require(_0x89cc('0x2'))(_0x89cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89cc('0x4'));var rimraf=require('rimraf');var config=require(_0x89cc('0x5'));var attributes=require(_0x89cc('0x6'));module[_0x89cc('0x7')]=function(_0x1b9bd5,_0x1505be){return _0x1b9bd5[_0x89cc('0x8')](_0x89cc('0x9'),attributes,{'tableName':_0x89cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index bb03ac8..3c5f0ad 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 _0xf73e=['message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc69fda,_0x367f93){var _0x721842=function(_0x521bf7){while(--_0x521bf7){_0xc69fda['push'](_0xc69fda['shift']());}};_0x721842(++_0x367f93);}(_0xf73e,0x10a));var _0xef73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf73e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef73('0x0'));var BPromise=require(_0xef73('0x1'));var rs=require(_0xef73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef73('0x3'))['db'];var utils=require(_0xef73('0x4'));var logger=require(_0xef73('0x5'))(_0xef73('0x6'));var config=require(_0xef73('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef73('0x8')][_0xef73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x420a1f,_0x379897,_0x930f9a){return new BPromise(function(_0x5943f6,_0x501552){return client[_0xef73('0xa')](_0x420a1f,_0x930f9a)[_0xef73('0xb')](function(_0x3e638c){logger[_0xef73('0xc')](_0xef73('0xd'),_0x379897,_0xef73('0xe'));logger[_0xef73('0xf')](_0xef73('0x10'),_0x379897,_0xef73('0xe'),JSON[_0xef73('0x11')](_0x3e638c));if(_0x3e638c['error']){if(_0x3e638c[_0xef73('0x12')][_0xef73('0x13')]===0x1f4){logger[_0xef73('0x12')](_0xef73('0xd'),_0x379897,_0x3e638c[_0xef73('0x12')][_0xef73('0x14')]);return _0x501552(_0x3e638c[_0xef73('0x12')][_0xef73('0x14')]);}logger['error'](_0xef73('0xd'),_0x379897,_0x3e638c[_0xef73('0x12')]['message']);return _0x5943f6(_0x3e638c[_0xef73('0x12')][_0xef73('0x14')]);}else{logger[_0xef73('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x379897,_0xef73('0xe'));_0x5943f6(_0x3e638c['result'][_0xef73('0x14')]);}})[_0xef73('0x15')](function(_0x2a6971){logger[_0xef73('0x12')](_0xef73('0xd'),_0x379897,_0x2a6971);_0x501552(_0x2a6971);});});} \ No newline at end of file +var _0xb50d=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x55ccbd,_0x3a60db){var _0x322b67=function(_0x4b5ddd){while(--_0x4b5ddd){_0x55ccbd['push'](_0x55ccbd['shift']());}};_0x322b67(++_0x3a60db);}(_0xb50d,0x15d));var _0xdb50=function(_0x459507,_0x4a5814){_0x459507=_0x459507-0x0;var _0x9a71e6=_0xb50d[_0x459507];return _0x9a71e6;};'use strict';var _=require(_0xdb50('0x0'));var util=require(_0xdb50('0x1'));var moment=require('moment');var BPromise=require(_0xdb50('0x2'));var rs=require(_0xdb50('0x3'));var fs=require('fs');var Redis=require(_0xdb50('0x4'));var db=require(_0xdb50('0x5'))['db'];var utils=require(_0xdb50('0x6'));var logger=require('../../config/logger')(_0xdb50('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb50('0x8'));var client=jayson[_0xdb50('0x9')][_0xdb50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21eecb,_0xb57950,_0x4b8ac9){return new BPromise(function(_0x3b37ad,_0x5396b2){return client[_0xdb50('0xb')](_0x21eecb,_0x4b8ac9)[_0xdb50('0xc')](function(_0x462cb6){logger[_0xdb50('0xd')](_0xdb50('0xe'),_0xb57950,_0xdb50('0xf'));logger[_0xdb50('0x10')](_0xdb50('0x11'),_0xb57950,_0xdb50('0xf'),JSON[_0xdb50('0x12')](_0x462cb6));if(_0x462cb6[_0xdb50('0x13')]){if(_0x462cb6[_0xdb50('0x13')][_0xdb50('0x14')]===0x1f4){logger[_0xdb50('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xb57950,_0x462cb6['error'][_0xdb50('0x15')]);return _0x5396b2(_0x462cb6[_0xdb50('0x13')][_0xdb50('0x15')]);}logger[_0xdb50('0x13')](_0xdb50('0xe'),_0xb57950,_0x462cb6[_0xdb50('0x13')][_0xdb50('0x15')]);return _0x3b37ad(_0x462cb6[_0xdb50('0x13')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xb57950,_0xdb50('0xf'));_0x3b37ad(_0x462cb6[_0xdb50('0x16')][_0xdb50('0x15')]);}})[_0xdb50('0x17')](function(_0x454bcd){logger['error'](_0xdb50('0xe'),_0xb57950,_0x454bcd);_0x5396b2(_0x454bcd);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index db94ba1..321a996 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 _0xa34f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x88ba09,_0xd9c21b){var _0x173410=function(_0x13c200){while(--_0x13c200){_0x88ba09['push'](_0x88ba09['shift']());}};_0x173410(++_0xd9c21b);}(_0xa34f,0x189));var _0xfa34=function(_0x57d2bd,_0x57664d){_0x57d2bd=_0x57d2bd-0x0;var _0x3e58ff=_0xa34f[_0x57d2bd];return _0x3e58ff;};'use strict';var multer=require(_0xfa34('0x0'));var util=require(_0xfa34('0x1'));var path=require(_0xfa34('0x2'));var timeout=require(_0xfa34('0x3'));var express=require(_0xfa34('0x4'));var router=express[_0xfa34('0x5')]();var auth=require(_0xfa34('0x6'));var interaction=require(_0xfa34('0x7'));var config=require(_0xfa34('0x8'));var controller=require('./intSugarcrmField.controller');router[_0xfa34('0x9')]('/',auth[_0xfa34('0xa')](),controller['index']);router[_0xfa34('0x9')](_0xfa34('0xb'),auth['isAuthenticated'](),controller[_0xfa34('0xc')]);router[_0xfa34('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa34('0xe')]);router['put'](_0xfa34('0xb'),auth[_0xfa34('0xa')](),controller[_0xfa34('0xf')]);router[_0xfa34('0x10')](_0xfa34('0xb'),auth[_0xfa34('0xa')](),controller[_0xfa34('0x11')]);module[_0xfa34('0x12')]=router; \ No newline at end of file +var _0xf4ca=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id'];(function(_0xe41fb4,_0x52bcab){var _0x2d126c=function(_0x3720d2){while(--_0x3720d2){_0xe41fb4['push'](_0xe41fb4['shift']());}};_0x2d126c(++_0x52bcab);}(_0xf4ca,0xb6));var _0xaf4c=function(_0x3451e0,_0x23d8e1){_0x3451e0=_0x3451e0-0x0;var _0x5bc322=_0xf4ca[_0x3451e0];return _0x5bc322;};'use strict';var multer=require(_0xaf4c('0x0'));var util=require(_0xaf4c('0x1'));var path=require(_0xaf4c('0x2'));var timeout=require(_0xaf4c('0x3'));var express=require(_0xaf4c('0x4'));var router=express[_0xaf4c('0x5')]();var auth=require(_0xaf4c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf4c('0x7'));var controller=require(_0xaf4c('0x8'));router[_0xaf4c('0x9')]('/',auth[_0xaf4c('0xa')](),controller[_0xaf4c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xaf4c('0xc')]);router[_0xaf4c('0xd')]('/',auth[_0xaf4c('0xa')](),controller[_0xaf4c('0xe')]);router['put']('/:id',auth[_0xaf4c('0xa')](),controller[_0xaf4c('0xf')]);router[_0xaf4c('0x10')](_0xaf4c('0x11'),auth[_0xaf4c('0xa')](),controller[_0xaf4c('0x12')]);module[_0xaf4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1c44100..29e80ee 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 _0x7fb0=['exports','ENUM','string','variable','STRING','BOOLEAN','sequelize'];(function(_0x59c7a7,_0x5798f4){var _0x1ac66e=function(_0x4a8801){while(--_0x4a8801){_0x59c7a7['push'](_0x59c7a7['shift']());}};_0x1ac66e(++_0x5798f4);}(_0x7fb0,0x99));var _0x07fb=function(_0x49cc8c,_0x48a839){_0x49cc8c=_0x49cc8c-0x0;var _0x30eb9e=_0x7fb0[_0x49cc8c];return _0x30eb9e;};'use strict';var Sequelize=require(_0x07fb('0x0'));module[_0x07fb('0x1')]={'type':{'type':Sequelize[_0x07fb('0x2')](_0x07fb('0x3'),_0x07fb('0x4'),'customVariable','keyValue'),'defaultValue':_0x07fb('0x3')},'content':{'type':Sequelize[_0x07fb('0x5')]},'key':{'type':Sequelize[_0x07fb('0x5')]},'keyType':{'type':Sequelize[_0x07fb('0x2')](_0x07fb('0x3'),_0x07fb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x07fb('0x5')]},'idField':{'type':Sequelize[_0x07fb('0x5')]},'nameField':{'type':Sequelize[_0x07fb('0x5')]},'customField':{'type':Sequelize[_0x07fb('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07fb('0x5')]}}; \ No newline at end of file +var _0x5ed2=['sequelize','ENUM','string','customVariable','keyValue','STRING'];(function(_0x25c4c8,_0x1970a3){var _0x571173=function(_0x2bf317){while(--_0x2bf317){_0x25c4c8['push'](_0x25c4c8['shift']());}};_0x571173(++_0x1970a3);}(_0x5ed2,0x114));var _0x25ed=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x5ed2[_0x46ec32];return _0x338f60;};'use strict';var Sequelize=require(_0x25ed('0x0'));module['exports']={'type':{'type':Sequelize[_0x25ed('0x1')](_0x25ed('0x2'),'variable',_0x25ed('0x3'),_0x25ed('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25ed('0x5')]},'key':{'type':Sequelize[_0x25ed('0x5')]},'keyType':{'type':Sequelize[_0x25ed('0x1')](_0x25ed('0x2'),'variable',_0x25ed('0x3'))},'keyContent':{'type':Sequelize[_0x25ed('0x5')]},'idField':{'type':Sequelize[_0x25ed('0x5')]},'nameField':{'type':Sequelize[_0x25ed('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c76d228..4ad0041 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 _0x67fa=['options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','length','include'];(function(_0x389a61,_0x20216c){var _0x1acde9=function(_0x3c72d3){while(--_0x3c72d3){_0x389a61['push'](_0x389a61['shift']());}};_0x1acde9(++_0x20216c);}(_0x67fa,0xd6));var _0xa67f=function(_0x44263c,_0x430afa){_0x44263c=_0x44263c-0x0;var _0x54e798=_0x67fa[_0x44263c];return _0x54e798;};'use strict';var pdf=require(_0xa67f('0x0'));var emlformat=require(_0xa67f('0x1'));var rimraf=require(_0xa67f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa67f('0x3'));var rp=require(_0xa67f('0x4'));var moment=require('moment');var BPromise=require(_0xa67f('0x5'));var Mustache=require(_0xa67f('0x6'));var util=require('util');var path=require(_0xa67f('0x7'));var sox=require(_0xa67f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa67f('0x9'));var squel=require(_0xa67f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa67f('0xb'));var toCsv=require(_0xa67f('0xc'));var querystring=require('querystring');var Papa=require(_0xa67f('0xd'));var Redis=require(_0xa67f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa67f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67f('0x10'));var logger=require('../../config/logger')(_0xa67f('0x11'));var utils=require(_0xa67f('0x12'));var config=require(_0xa67f('0x13'));var db=require(_0xa67f('0x14'))['db'];function respondWithStatusCode(_0x493695,_0x4f2f59){_0x4f2f59=_0x4f2f59||0xcc;return function(_0x196643){if(_0x196643){return _0x493695[_0xa67f('0x15')](_0x4f2f59);}return _0x493695[_0xa67f('0x16')](_0x4f2f59)[_0xa67f('0x17')]();};}function respondWithResult(_0x1b651b,_0x46479e){_0x46479e=_0x46479e||0xc8;return function(_0x41e0bc){if(_0x41e0bc){return _0x1b651b[_0xa67f('0x16')](_0x46479e)[_0xa67f('0x18')](_0x41e0bc);}};}function respondWithFilteredResult(_0x5c048c,_0x3f6073){return function(_0xb85cc1){if(_0xb85cc1){var _0x74bece=_0xb85cc1[_0xa67f('0x19')],_0x2bfa1a=_0x3f6073[_0xa67f('0x1a')],_0x3b0ac5=_0x3f6073[_0xa67f('0x1a')]+_0x3f6073[_0xa67f('0x1b')],_0x3aa44f;if(_0x3b0ac5>=_0x74bece){_0x3b0ac5=_0x74bece;_0x3aa44f=0xc8;}else{_0x3aa44f=0xce;}_0x5c048c[_0xa67f('0x16')](_0x3aa44f);return _0x5c048c[_0xa67f('0x1c')]('Content-Range',_0x2bfa1a+'-'+_0x3b0ac5+'/'+_0x74bece)[_0xa67f('0x18')](_0xb85cc1);}return null;};}function patchUpdates(_0x4de50d){return function(_0x4a9bc){try{jsonpatch['apply'](_0x4a9bc,_0x4de50d,!![]);}catch(_0x3e2a1d){return BPromise[_0xa67f('0x1d')](_0x3e2a1d);}return _0x4a9bc[_0xa67f('0x1e')]();};}function saveUpdates(_0x45e330,_0x3259c8){return function(_0x33b8b5){if(_0x33b8b5){return _0x33b8b5[_0xa67f('0x1f')](_0x45e330)[_0xa67f('0x20')](function(_0x3f5323){return _0x3f5323;});}return null;};}function removeEntity(_0x47a22e,_0x4bc39c){return function(_0x1f8ca0){if(_0x1f8ca0){return _0x1f8ca0[_0xa67f('0x21')]()[_0xa67f('0x20')](function(){_0x47a22e[_0xa67f('0x16')](0xcc)[_0xa67f('0x17')]();});}};}function handleEntityNotFound(_0x327679,_0x3b9873){return function(_0x5abf8c){if(!_0x5abf8c){_0x327679[_0xa67f('0x15')](0x194);}return _0x5abf8c;};}function handleError(_0x12fdbd,_0x1fb473){_0x1fb473=_0x1fb473||0x1f4;return function(_0x19a321){logger[_0xa67f('0x22')](_0x19a321['stack']);if(_0x19a321[_0xa67f('0x23')]){delete _0x19a321[_0xa67f('0x23')];}_0x12fdbd[_0xa67f('0x16')](_0x1fb473)[_0xa67f('0x24')](_0x19a321);};}exports[_0xa67f('0x25')]=function(_0x227469,_0x55ab41){var _0x2d5971={},_0x1ea111={},_0x58689b={'count':0x0,'rows':[]};var _0x4ddf39=_[_0xa67f('0x26')](db[_0xa67f('0x27')][_0xa67f('0x28')],function(_0x224574){return{'name':_0x224574[_0xa67f('0x29')],'type':_0x224574[_0xa67f('0x2a')][_0xa67f('0x2b')]};});_0x1ea111['model']=_[_0xa67f('0x26')](_0x4ddf39,_0xa67f('0x23'));_0x1ea111[_0xa67f('0x2c')]=_[_0xa67f('0x2d')](_0x227469[_0xa67f('0x2c')]);_0x1ea111['filters']=_[_0xa67f('0x2e')](_0x1ea111['model'],_0x1ea111[_0xa67f('0x2c')]);_0x2d5971[_0xa67f('0x2f')]=_[_0xa67f('0x2e')](_0x1ea111[_0xa67f('0x30')],qs[_0xa67f('0x31')](_0x227469[_0xa67f('0x2c')]['fields']));_0x2d5971[_0xa67f('0x2f')]=_0x2d5971['attributes']['length']?_0x2d5971[_0xa67f('0x2f')]:_0x1ea111['model'];if(!_0x227469[_0xa67f('0x2c')][_0xa67f('0x32')](_0xa67f('0x33'))){_0x2d5971[_0xa67f('0x1b')]=qs['limit'](_0x227469[_0xa67f('0x2c')][_0xa67f('0x1b')]);_0x2d5971[_0xa67f('0x1a')]=qs[_0xa67f('0x1a')](_0x227469['query']['offset']);}_0x2d5971[_0xa67f('0x34')]=qs[_0xa67f('0x35')](_0x227469['query'][_0xa67f('0x35')]);_0x2d5971[_0xa67f('0x36')]=qs[_0xa67f('0x37')](_['pick'](_0x227469[_0xa67f('0x2c')],_0x1ea111['filters']),_0x4ddf39);if(_0x227469[_0xa67f('0x2c')][_0xa67f('0x38')]){_0x2d5971[_0xa67f('0x36')]=_[_0xa67f('0x39')](_0x2d5971[_0xa67f('0x36')],{'$or':_[_0xa67f('0x26')](_0x4ddf39,function(_0x4bfb35){if(_0x4bfb35[_0xa67f('0x2a')]!==_0xa67f('0x3a')){var _0x232882={};_0x232882[_0x4bfb35['name']]={'$like':'%'+_0x227469[_0xa67f('0x2c')][_0xa67f('0x38')]+'%'};return _0x232882;}})});}_0x2d5971=_['merge']({},_0x2d5971,_0x227469['options']);var _0x10714a={'where':_0x2d5971[_0xa67f('0x36')]};return db['SugarcrmField'][_0xa67f('0x19')](_0x10714a)[_0xa67f('0x20')](function(_0x32cc41){_0x58689b[_0xa67f('0x19')]=_0x32cc41;if(_0x227469['query'][_0xa67f('0x3b')]){_0x2d5971['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xa67f('0x3c')](_0x2d5971);})[_0xa67f('0x20')](function(_0x28575c){_0x58689b['rows']=_0x28575c;return _0x58689b;})['then'](respondWithFilteredResult(_0x55ab41,_0x2d5971))[_0xa67f('0x3d')](handleError(_0x55ab41,null));};exports[_0xa67f('0x3e')]=function(_0x1113ad,_0xe62382){var _0x435512={'raw':!![],'where':{'id':_0x1113ad[_0xa67f('0x3f')]['id']}},_0x2d01a7={};_0x2d01a7[_0xa67f('0x30')]=_[_0xa67f('0x2d')](db[_0xa67f('0x27')][_0xa67f('0x28')]);_0x2d01a7[_0xa67f('0x2c')]=_[_0xa67f('0x2d')](_0x1113ad[_0xa67f('0x2c')]);_0x2d01a7[_0xa67f('0x37')]=_[_0xa67f('0x2e')](_0x2d01a7[_0xa67f('0x30')],_0x2d01a7[_0xa67f('0x2c')]);_0x435512[_0xa67f('0x2f')]=_[_0xa67f('0x2e')](_0x2d01a7[_0xa67f('0x30')],qs['fields'](_0x1113ad['query'][_0xa67f('0x31')]));_0x435512[_0xa67f('0x2f')]=_0x435512[_0xa67f('0x2f')][_0xa67f('0x40')]?_0x435512[_0xa67f('0x2f')]:_0x2d01a7['model'];if(_0x1113ad[_0xa67f('0x2c')][_0xa67f('0x3b')]){_0x435512[_0xa67f('0x41')]=[{'all':!![]}];}_0x435512=_[_0xa67f('0x39')]({},_0x435512,_0x1113ad[_0xa67f('0x42')]);return db[_0xa67f('0x27')][_0xa67f('0x43')](_0x435512)[_0xa67f('0x20')](handleEntityNotFound(_0xe62382,null))['then'](respondWithResult(_0xe62382,null))[_0xa67f('0x3d')](handleError(_0xe62382,null));};exports['create']=function(_0x2630f2,_0x207e76){return db[_0xa67f('0x27')][_0xa67f('0x44')](_0x2630f2[_0xa67f('0x45')],{})[_0xa67f('0x20')](respondWithResult(_0x207e76,0xc9))[_0xa67f('0x3d')](handleError(_0x207e76,null));};exports[_0xa67f('0x1f')]=function(_0x28fdb6,_0x561e63){if(_0x28fdb6[_0xa67f('0x45')]['id']){delete _0x28fdb6[_0xa67f('0x45')]['id'];}return db[_0xa67f('0x27')][_0xa67f('0x43')]({'where':{'id':_0x28fdb6[_0xa67f('0x3f')]['id']}})[_0xa67f('0x20')](handleEntityNotFound(_0x561e63,null))[_0xa67f('0x20')](saveUpdates(_0x28fdb6[_0xa67f('0x45')],null))[_0xa67f('0x20')](respondWithResult(_0x561e63,null))[_0xa67f('0x3d')](handleError(_0x561e63,null));};exports[_0xa67f('0x21')]=function(_0x4b90e8,_0x38749b){return db[_0xa67f('0x27')][_0xa67f('0x43')]({'where':{'id':_0x4b90e8['params']['id']}})[_0xa67f('0x20')](handleEntityNotFound(_0x38749b,null))['then'](removeEntity(_0x38749b,null))[_0xa67f('0x3d')](handleError(_0x38749b,null));}; \ No newline at end of file +var _0x35a1=['reject','save','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','findAll','then','catch','show','params','rawAttributes','length','include','find','SugarcrmField','create','body','update','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply'];(function(_0x4f66,_0x4c4a2e){var _0x4e3d42=function(_0xcbd4b0){while(--_0xcbd4b0){_0x4f66['push'](_0x4f66['shift']());}};_0x4e3d42(++_0x4c4a2e);}(_0x35a1,0x14e));var _0x135a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x35a1[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x135a('0x0'));var emlformat=require(_0x135a('0x1'));var rimraf=require(_0x135a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x135a('0x3'));var rp=require('request-promise');var moment=require(_0x135a('0x4'));var BPromise=require(_0x135a('0x5'));var Mustache=require(_0x135a('0x6'));var util=require(_0x135a('0x7'));var path=require(_0x135a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x135a('0x9'));var fs=require('fs');var _=require(_0x135a('0xa'));var squel=require('squel');var crypto=require(_0x135a('0xb'));var jsforce=require(_0x135a('0xc'));var deskjs=require(_0x135a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x135a('0xe'));var Papa=require(_0x135a('0xf'));var Redis=require(_0x135a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x135a('0x11'));var as=require(_0x135a('0x12'));var hardwareService=require(_0x135a('0x13'));var logger=require(_0x135a('0x14'))(_0x135a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x135a('0x16'))['db'];function respondWithStatusCode(_0x3d9133,_0x5adff4){_0x5adff4=_0x5adff4||0xcc;return function(_0x39a50a){if(_0x39a50a){return _0x3d9133[_0x135a('0x17')](_0x5adff4);}return _0x3d9133['status'](_0x5adff4)[_0x135a('0x18')]();};}function respondWithResult(_0x5f0667,_0x5e4d3f){_0x5e4d3f=_0x5e4d3f||0xc8;return function(_0x21d7ee){if(_0x21d7ee){return _0x5f0667[_0x135a('0x19')](_0x5e4d3f)[_0x135a('0x1a')](_0x21d7ee);}};}function respondWithFilteredResult(_0x37ef45,_0x3874ff){return function(_0x2e6a2b){if(_0x2e6a2b){var _0x3cf5be=_0x2e6a2b['count'],_0x1c19b8=_0x3874ff[_0x135a('0x1b')],_0x3a0613=_0x3874ff[_0x135a('0x1b')]+_0x3874ff[_0x135a('0x1c')],_0x2f3345;if(_0x3a0613>=_0x3cf5be){_0x3a0613=_0x3cf5be;_0x2f3345=0xc8;}else{_0x2f3345=0xce;}_0x37ef45[_0x135a('0x19')](_0x2f3345);return _0x37ef45['set'](_0x135a('0x1d'),_0x1c19b8+'-'+_0x3a0613+'/'+_0x3cf5be)[_0x135a('0x1a')](_0x2e6a2b);}return null;};}function patchUpdates(_0x30c421){return function(_0x851e37){try{jsonpatch[_0x135a('0x1e')](_0x851e37,_0x30c421,!![]);}catch(_0x44341f){return BPromise[_0x135a('0x1f')](_0x44341f);}return _0x851e37[_0x135a('0x20')]();};}function saveUpdates(_0x1c1d63,_0x3634be){return function(_0x16b811){if(_0x16b811){return _0x16b811['update'](_0x1c1d63)['then'](function(_0x109817){return _0x109817;});}return null;};}function removeEntity(_0x295759,_0x370de5){return function(_0x1d32d6){if(_0x1d32d6){return _0x1d32d6['destroy']()['then'](function(){_0x295759[_0x135a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8443,_0x10174f){return function(_0x2a4f61){if(!_0x2a4f61){_0x5d8443[_0x135a('0x17')](0x194);}return _0x2a4f61;};}function handleError(_0x4c28b6,_0x85d6e6){_0x85d6e6=_0x85d6e6||0x1f4;return function(_0x11f517){logger[_0x135a('0x21')](_0x11f517[_0x135a('0x22')]);if(_0x11f517[_0x135a('0x23')]){delete _0x11f517[_0x135a('0x23')];}_0x4c28b6[_0x135a('0x19')](_0x85d6e6)[_0x135a('0x24')](_0x11f517);};}exports[_0x135a('0x25')]=function(_0x4280c9,_0x25a7ff){var _0xf0b8f9={},_0x79bb6c={},_0x1cf198={'count':0x0,'rows':[]};var _0x110e9e=_[_0x135a('0x26')](db['SugarcrmField']['rawAttributes'],function(_0x29cc47){return{'name':_0x29cc47[_0x135a('0x27')],'type':_0x29cc47[_0x135a('0x28')][_0x135a('0x29')]};});_0x79bb6c[_0x135a('0x2a')]=_[_0x135a('0x26')](_0x110e9e,_0x135a('0x23'));_0x79bb6c['query']=_[_0x135a('0x2b')](_0x4280c9[_0x135a('0x2c')]);_0x79bb6c[_0x135a('0x2d')]=_[_0x135a('0x2e')](_0x79bb6c[_0x135a('0x2a')],_0x79bb6c['query']);_0xf0b8f9[_0x135a('0x2f')]=_[_0x135a('0x2e')](_0x79bb6c['model'],qs['fields'](_0x4280c9[_0x135a('0x2c')][_0x135a('0x30')]));_0xf0b8f9[_0x135a('0x2f')]=_0xf0b8f9[_0x135a('0x2f')]['length']?_0xf0b8f9['attributes']:_0x79bb6c[_0x135a('0x2a')];if(!_0x4280c9[_0x135a('0x2c')][_0x135a('0x31')](_0x135a('0x32'))){_0xf0b8f9[_0x135a('0x1c')]=qs[_0x135a('0x1c')](_0x4280c9[_0x135a('0x2c')][_0x135a('0x1c')]);_0xf0b8f9['offset']=qs[_0x135a('0x1b')](_0x4280c9[_0x135a('0x2c')][_0x135a('0x1b')]);}_0xf0b8f9[_0x135a('0x33')]=qs['sort'](_0x4280c9[_0x135a('0x2c')][_0x135a('0x34')]);_0xf0b8f9[_0x135a('0x35')]=qs[_0x135a('0x2d')](_['pick'](_0x4280c9[_0x135a('0x2c')],_0x79bb6c[_0x135a('0x2d')]),_0x110e9e);if(_0x4280c9[_0x135a('0x2c')][_0x135a('0x36')]){_0xf0b8f9[_0x135a('0x35')]=_[_0x135a('0x37')](_0xf0b8f9[_0x135a('0x35')],{'$or':_[_0x135a('0x26')](_0x110e9e,function(_0x5e1e93){if(_0x5e1e93['type']!=='VIRTUAL'){var _0x53e1bb={};_0x53e1bb[_0x5e1e93[_0x135a('0x23')]]={'$like':'%'+_0x4280c9[_0x135a('0x2c')]['filter']+'%'};return _0x53e1bb;}})});}_0xf0b8f9=_[_0x135a('0x37')]({},_0xf0b8f9,_0x4280c9[_0x135a('0x38')]);var _0x293e46={'where':_0xf0b8f9[_0x135a('0x35')]};return db['SugarcrmField'][_0x135a('0x39')](_0x293e46)['then'](function(_0x118a47){_0x1cf198[_0x135a('0x39')]=_0x118a47;if(_0x4280c9[_0x135a('0x2c')][_0x135a('0x3a')]){_0xf0b8f9['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x135a('0x3b')](_0xf0b8f9);})[_0x135a('0x3c')](function(_0x48b6fa){_0x1cf198['rows']=_0x48b6fa;return _0x1cf198;})[_0x135a('0x3c')](respondWithFilteredResult(_0x25a7ff,_0xf0b8f9))[_0x135a('0x3d')](handleError(_0x25a7ff,null));};exports[_0x135a('0x3e')]=function(_0x25c2ab,_0x390bf4){var _0x1d02d6={'raw':!![],'where':{'id':_0x25c2ab[_0x135a('0x3f')]['id']}},_0x51abcd={};_0x51abcd['model']=_['keys'](db['SugarcrmField'][_0x135a('0x40')]);_0x51abcd['query']=_[_0x135a('0x2b')](_0x25c2ab['query']);_0x51abcd[_0x135a('0x2d')]=_['intersection'](_0x51abcd['model'],_0x51abcd[_0x135a('0x2c')]);_0x1d02d6[_0x135a('0x2f')]=_[_0x135a('0x2e')](_0x51abcd['model'],qs[_0x135a('0x30')](_0x25c2ab['query'][_0x135a('0x30')]));_0x1d02d6[_0x135a('0x2f')]=_0x1d02d6[_0x135a('0x2f')][_0x135a('0x41')]?_0x1d02d6[_0x135a('0x2f')]:_0x51abcd['model'];if(_0x25c2ab[_0x135a('0x2c')][_0x135a('0x3a')]){_0x1d02d6[_0x135a('0x42')]=[{'all':!![]}];}_0x1d02d6=_[_0x135a('0x37')]({},_0x1d02d6,_0x25c2ab[_0x135a('0x38')]);return db['SugarcrmField'][_0x135a('0x43')](_0x1d02d6)[_0x135a('0x3c')](handleEntityNotFound(_0x390bf4,null))[_0x135a('0x3c')](respondWithResult(_0x390bf4,null))[_0x135a('0x3d')](handleError(_0x390bf4,null));};exports['create']=function(_0x202980,_0x37575f){return db[_0x135a('0x44')][_0x135a('0x45')](_0x202980[_0x135a('0x46')],{})['then'](respondWithResult(_0x37575f,0xc9))[_0x135a('0x3d')](handleError(_0x37575f,null));};exports[_0x135a('0x47')]=function(_0x4e00e9,_0x363da6){if(_0x4e00e9[_0x135a('0x46')]['id']){delete _0x4e00e9['body']['id'];}return db['SugarcrmField'][_0x135a('0x43')]({'where':{'id':_0x4e00e9['params']['id']}})['then'](handleEntityNotFound(_0x363da6,null))['then'](saveUpdates(_0x4e00e9[_0x135a('0x46')],null))[_0x135a('0x3c')](respondWithResult(_0x363da6,null))['catch'](handleError(_0x363da6,null));};exports[_0x135a('0x48')]=function(_0x2d3a3b,_0xc28943){return db[_0x135a('0x44')][_0x135a('0x43')]({'where':{'id':_0x2d3a3b[_0x135a('0x3f')]['id']}})[_0x135a('0x3c')](handleEntityNotFound(_0xc28943,null))['then'](removeEntity(_0xc28943,null))[_0x135a('0x3d')](handleError(_0xc28943,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ff99af3..a7d2154 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 _0x260c=['api','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x260c,0xe1));var _0xc260=function(_0x410b42,_0x11e633){_0x410b42=_0x410b42-0x0;var _0x22d0e8=_0x260c[_0x410b42];return _0x22d0e8;};'use strict';var _=require(_0xc260('0x0'));var util=require(_0xc260('0x1'));var logger=require(_0xc260('0x2'))(_0xc260('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc260('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc260('0x5'));var config=require(_0xc260('0x6'));var attributes=require(_0xc260('0x7'));module[_0xc260('0x8')]=function(_0x309025,_0x4f9196){return _0x309025['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xc260('0x9'),'fields':[_0xc260('0xa'),_0xc260('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa842=['../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','util'];(function(_0x5c6951,_0x507abb){var _0x5ee145=function(_0x4f8b75){while(--_0x4f8b75){_0x5c6951['push'](_0x5c6951['shift']());}};_0x5ee145(++_0x507abb);}(_0xa842,0xd6));var _0x2a84=function(_0x422ca5,_0x1324d9){_0x422ca5=_0x422ca5-0x0;var _0x216f45=_0xa842[_0x422ca5];return _0x216f45;};'use strict';var _=require(_0x2a84('0x0'));var util=require(_0x2a84('0x1'));var logger=require(_0x2a84('0x2'))('api');var moment=require(_0x2a84('0x3'));var BPromise=require(_0x2a84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a84('0x5'));var rimraf=require('rimraf');var config=require(_0x2a84('0x6'));var attributes=require(_0x2a84('0x7'));module[_0x2a84('0x8')]=function(_0xe1cdb,_0x5f27b2){return _0xe1cdb['define'](_0x2a84('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x2a84('0xa'),'fields':['idField',_0x2a84('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 2bf424b..e46328e 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(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x0b0e[_0x39157f];return _0x1ae4e2;};'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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x17bb21,_0x369098){var _0x2956a6=function(_0x3e5ecf){while(--_0x3e5ecf){_0x17bb21['push'](_0x17bb21['shift']());}};_0x2956a6(++_0x369098);}(_0x14a0,0x8e));var _0x014a=function(_0x18265c,_0xfae450){_0x18265c=_0x18265c-0x0;var _0xf60565=_0x14a0[_0x18265c];return _0xf60565;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8aee629..ec934de 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 _0xb3e7=['show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x1957d0,_0x152fc8){var _0x53d6dc=function(_0x51c7a5){while(--_0x51c7a5){_0x1957d0['push'](_0x1957d0['shift']());}};_0x53d6dc(++_0x152fc8);}(_0xb3e7,0xc4));var _0x7b3e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb3e7[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x7b3e('0x0'));var util=require(_0x7b3e('0x1'));var path=require(_0x7b3e('0x2'));var timeout=require(_0x7b3e('0x3'));var express=require(_0x7b3e('0x4'));var router=express[_0x7b3e('0x5')]();var auth=require(_0x7b3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7b3e('0x7'));var controller=require(_0x7b3e('0x8'));router[_0x7b3e('0x9')]('/',auth[_0x7b3e('0xa')](),controller['index']);router[_0x7b3e('0x9')]('/:id',auth[_0x7b3e('0xa')](),controller[_0x7b3e('0xb')]);router[_0x7b3e('0x9')]('/:id/configurations',auth[_0x7b3e('0xa')](),controller['getConfigurations']);router[_0x7b3e('0x9')](_0x7b3e('0xc'),auth[_0x7b3e('0xa')](),controller[_0x7b3e('0xd')]);router[_0x7b3e('0xe')]('/',auth[_0x7b3e('0xa')](),controller[_0x7b3e('0xf')]);router[_0x7b3e('0xe')](_0x7b3e('0x10'),auth[_0x7b3e('0xa')](),controller[_0x7b3e('0x11')]);router[_0x7b3e('0x12')](_0x7b3e('0x13'),auth[_0x7b3e('0xa')](),controller[_0x7b3e('0x14')]);router[_0x7b3e('0x15')]('/:id',auth[_0x7b3e('0xa')](),controller[_0x7b3e('0x16')]);module['exports']=router; \ No newline at end of file +var _0xdc12=['path','connect-timeout','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','update','delete','destroy','exports'];(function(_0x2feb80,_0x2908ce){var _0x2279bf=function(_0x38f306){while(--_0x38f306){_0x2feb80['push'](_0x2feb80['shift']());}};_0x2279bf(++_0x2908ce);}(_0xdc12,0x156));var _0x2dc1=function(_0x512739,_0x19bf89){_0x512739=_0x512739-0x0;var _0x56ab67=_0xdc12[_0x512739];return _0x56ab67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2dc1('0x0'));var timeout=require(_0x2dc1('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2dc1('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2dc1('0x3'));var controller=require(_0x2dc1('0x4'));router['get']('/',auth[_0x2dc1('0x5')](),controller['index']);router['get'](_0x2dc1('0x6'),auth['isAuthenticated'](),controller[_0x2dc1('0x7')]);router[_0x2dc1('0x8')](_0x2dc1('0x9'),auth['isAuthenticated'](),controller[_0x2dc1('0xa')]);router[_0x2dc1('0x8')](_0x2dc1('0xb'),auth[_0x2dc1('0x5')](),controller[_0x2dc1('0xc')]);router['post']('/',auth[_0x2dc1('0x5')](),controller[_0x2dc1('0xd')]);router['post'](_0x2dc1('0x9'),auth[_0x2dc1('0x5')](),controller['addConfiguration']);router[_0x2dc1('0xe')](_0x2dc1('0x6'),auth['isAuthenticated'](),controller[_0x2dc1('0xf')]);router[_0x2dc1('0x10')](_0x2dc1('0x6'),auth[_0x2dc1('0x5')](),controller[_0x2dc1('0x11')]);module[_0x2dc1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3cb886d..c5971d7 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 _0xa676=['STRING','HelpDesk','sequelize'];(function(_0x4d9b75,_0x345223){var _0x17aed5=function(_0x4e5ade){while(--_0x4e5ade){_0x4d9b75['push'](_0x4d9b75['shift']());}};_0x17aed5(++_0x345223);}(_0xa676,0x18e));var _0x6a67=function(_0xa186c6,_0x40b25b){_0xa186c6=_0xa186c6-0x0;var _0x2d4693=_0xa676[_0xa186c6];return _0x2d4693;};'use strict';var Sequelize=require(_0x6a67('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6a67('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![],'defaultValue':_0x6a67('0x2')},'remoteUri':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6a67('0x1')]},'accessKey':{'type':Sequelize[_0x6a67('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc876=['STRING','HelpDesk'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0xc876,0x9e));var _0x6c87=function(_0x845eea,_0x5b60dd){_0x845eea=_0x845eea-0x0;var _0x3d07dc=_0xc876[_0x845eea];return _0x3d07dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6c87('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6c87('0x0')],'allowNull':![],'defaultValue':_0x6c87('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6c87('0x0')]},'accessKey':{'type':Sequelize[_0x6c87('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5eeb795..6af3d51 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 _0x66d4=['../../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~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','name','send','index','map','VtigerAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','create','body','update','find','getConfigurations','rawAttributes','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','format','%s/webservice.php','getchallenge','login','success','describe','sessionName','reference','owner','includes','picklist','picklistValues','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0xc0c398,_0x2175df){var _0x3ed77c=function(_0x570628){while(--_0x570628){_0xc0c398['push'](_0xc0c398['shift']());}};_0x3ed77c(++_0x2175df);}(_0x66d4,0xd5));var _0x466d=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x66d4[_0x209ec9];return _0x129b1b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x466d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x466d('0x1'));var moment=require(_0x466d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x466d('0x3'));var util=require('util');var path=require(_0x466d('0x4'));var sox=require('sox');var csv=require(_0x466d('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x466d('0x6'));var squel=require(_0x466d('0x7'));var crypto=require(_0x466d('0x8'));var jsforce=require(_0x466d('0x9'));var deskjs=require(_0x466d('0xa'));var toCsv=require(_0x466d('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x466d('0xb'));var authService=require(_0x466d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x466d('0xd'));var hardwareService=require(_0x466d('0xe'));var logger=require(_0x466d('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x466d('0x10'));var db=require(_0x466d('0x11'))['db'];var integrations=require(_0x466d('0x12'));var jayson=require(_0x466d('0x13'));var client=jayson[_0x466d('0x14')][_0x466d('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2c3c3f,_0x5c7c86,_0x3c08a9){if(_0x3c08a9){var _0x2ba1f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ba1f0[_0x466d('0x16')](_0x5c7c86)){return _0x2c3c3f;}else{throw new db['Sequelize'][(_0x466d('0x17'))](_0x466d('0x18'));}}else{return _0x2c3c3f;}}function respondWithRpcPromise(_0x4a6c5a,_0x5bbf2f,_0x3b9e4b,_0x1305c6){return new BPromise(function(_0xcc40f4,_0x3ce831){var _0x2e1971=_0x1305c6||client;return _0x2e1971[_0x466d('0x19')](_0x4a6c5a,_0x3b9e4b)[_0x466d('0x1a')](function(_0x3bcdb0){logger[_0x466d('0x1b')](_0x466d('0x1c'),_0x5bbf2f,_0x466d('0x1d'));logger['debug'](_0x466d('0x1e'),_0x5bbf2f,'request\x20sent',JSON[_0x466d('0x1f')](_0x3bcdb0));if(_0x3bcdb0[_0x466d('0x20')]){if(_0x3bcdb0[_0x466d('0x20')][_0x466d('0x21')]===0x1f4){logger[_0x466d('0x20')](_0x466d('0x1c'),_0x5bbf2f,_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);return _0x3ce831(_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);}logger[_0x466d('0x20')](_0x466d('0x1c'),_0x5bbf2f,_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);return _0xcc40f4(_0x3bcdb0[_0x466d('0x20')][_0x466d('0x22')]);}else{logger[_0x466d('0x1b')]('VtigerAccount,\x20%s,\x20%s',_0x5bbf2f,_0x466d('0x1d'));_0xcc40f4(_0x3bcdb0[_0x466d('0x23')][_0x466d('0x22')]);}})[_0x466d('0x24')](function(_0x2bb8e0){logger[_0x466d('0x20')](_0x466d('0x1c'),_0x5bbf2f,_0x2bb8e0);_0x3ce831(_0x2bb8e0);});});}function respondWithStatusCode(_0x1f20fc,_0x24a9a8){_0x24a9a8=_0x24a9a8||0xcc;return function(_0x5d2437){if(_0x5d2437){return _0x1f20fc['sendStatus'](_0x24a9a8);}return _0x1f20fc['status'](_0x24a9a8)['end']();};}function respondWithResult(_0x2a95c1,_0x58f201){_0x58f201=_0x58f201||0xc8;return function(_0x300041){if(_0x300041){return _0x2a95c1[_0x466d('0x25')](_0x58f201)['json'](_0x300041);}};}function respondWithFilteredResult(_0xe9518b,_0x1a6aab){return function(_0x435fb8){if(_0x435fb8){var _0x5c7489=_0x435fb8['count'],_0x2934be=_0x1a6aab[_0x466d('0x26')],_0x49e3fa=_0x1a6aab[_0x466d('0x26')]+_0x1a6aab[_0x466d('0x27')],_0x4e0540;if(_0x49e3fa>=_0x5c7489){_0x49e3fa=_0x5c7489;_0x4e0540=0xc8;}else{_0x4e0540=0xce;}_0xe9518b[_0x466d('0x25')](_0x4e0540);return _0xe9518b[_0x466d('0x28')](_0x466d('0x29'),_0x2934be+'-'+_0x49e3fa+'/'+_0x5c7489)['json'](_0x435fb8);}return null;};}function patchUpdates(_0x59e1e5){return function(_0x237b0c){try{jsonpatch[_0x466d('0x2a')](_0x237b0c,_0x59e1e5,!![]);}catch(_0x5d430b){return BPromise[_0x466d('0x2b')](_0x5d430b);}return _0x237b0c[_0x466d('0x2c')]();};}function saveUpdates(_0x25cca9,_0x235b13){return function(_0x20fe84){if(_0x20fe84){return _0x20fe84['update'](_0x25cca9)[_0x466d('0x1a')](function(_0x511116){return _0x511116;});}return null;};}function removeEntity(_0xd8a22e,_0x39d57a){return function(_0x136bba){if(_0x136bba){return _0x136bba[_0x466d('0x2d')]()[_0x466d('0x1a')](function(){_0xd8a22e[_0x466d('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8a746,_0x1066f7){return function(_0x7a2e90){if(!_0x7a2e90){_0xf8a746[_0x466d('0x2e')](0x194);}return _0x7a2e90;};}function handleError(_0x531fb4,_0x216189){_0x216189=_0x216189||0x1f4;return function(_0x4071b9){logger['error'](_0x4071b9['stack']);if(_0x4071b9[_0x466d('0x2f')]){delete _0x4071b9[_0x466d('0x2f')];}_0x531fb4[_0x466d('0x25')](_0x216189)[_0x466d('0x30')](_0x4071b9);};}exports[_0x466d('0x31')]=function(_0x542945,_0x54ede){var _0x1cf9db={},_0x58fa9e={},_0x53ff91={'count':0x0,'rows':[]};var _0x596e70=_[_0x466d('0x32')](db[_0x466d('0x33')]['rawAttributes'],function(_0x3d34c5){return{'name':_0x3d34c5['fieldName'],'type':_0x3d34c5[_0x466d('0x34')][_0x466d('0x35')]};});_0x58fa9e[_0x466d('0x36')]=_[_0x466d('0x32')](_0x596e70,'name');_0x58fa9e[_0x466d('0x37')]=_[_0x466d('0x38')](_0x542945[_0x466d('0x37')]);_0x58fa9e[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x58fa9e[_0x466d('0x36')],_0x58fa9e[_0x466d('0x37')]);_0x1cf9db[_0x466d('0x3b')]=_['intersection'](_0x58fa9e['model'],qs[_0x466d('0x3c')](_0x542945[_0x466d('0x37')]['fields']));_0x1cf9db['attributes']=_0x1cf9db[_0x466d('0x3b')][_0x466d('0x3d')]?_0x1cf9db[_0x466d('0x3b')]:_0x58fa9e['model'];if(!_0x542945['query']['hasOwnProperty']('nolimit')){_0x1cf9db['limit']=qs['limit'](_0x542945[_0x466d('0x37')]['limit']);_0x1cf9db[_0x466d('0x26')]=qs['offset'](_0x542945[_0x466d('0x37')]['offset']);}_0x1cf9db['order']=qs['sort'](_0x542945['query'][_0x466d('0x3e')]);_0x1cf9db[_0x466d('0x3f')]=qs[_0x466d('0x39')](_[_0x466d('0x40')](_0x542945['query'],_0x58fa9e['filters']),_0x596e70);if(_0x542945[_0x466d('0x37')][_0x466d('0x41')]){_0x1cf9db['where']=_[_0x466d('0x42')](_0x1cf9db[_0x466d('0x3f')],{'$or':_[_0x466d('0x32')](_0x596e70,function(_0x26d7de){if(_0x26d7de[_0x466d('0x34')]!==_0x466d('0x43')){var _0x2607e0={};_0x2607e0[_0x26d7de[_0x466d('0x2f')]]={'$like':'%'+_0x542945[_0x466d('0x37')][_0x466d('0x41')]+'%'};return _0x2607e0;}})});}_0x1cf9db=_[_0x466d('0x42')]({},_0x1cf9db,_0x542945[_0x466d('0x44')]);var _0x6b0b4f={'where':_0x1cf9db['where']};return db['VtigerAccount'][_0x466d('0x45')](_0x6b0b4f)[_0x466d('0x1a')](function(_0xc87bdd){_0x53ff91[_0x466d('0x45')]=_0xc87bdd;if(_0x542945[_0x466d('0x37')]['includeAll']){_0x1cf9db['include']=[{'all':!![]}];}return db[_0x466d('0x33')][_0x466d('0x46')](_0x1cf9db);})[_0x466d('0x1a')](function(_0x1e50a0){_0x53ff91[_0x466d('0x47')]=_0x1e50a0;return _0x53ff91;})[_0x466d('0x1a')](respondWithFilteredResult(_0x54ede,_0x1cf9db))['catch'](handleError(_0x54ede,null));};exports[_0x466d('0x48')]=function(_0x2ef420,_0x75b2ea){var _0x481961={'raw':![],'where':{'id':_0x2ef420[_0x466d('0x49')]['id']}},_0x20d897={};_0x20d897[_0x466d('0x36')]=_['keys'](db[_0x466d('0x33')]['rawAttributes']);_0x20d897[_0x466d('0x37')]=_[_0x466d('0x38')](_0x2ef420[_0x466d('0x37')]);_0x20d897[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x20d897[_0x466d('0x36')],_0x20d897[_0x466d('0x37')]);_0x481961[_0x466d('0x3b')]=_[_0x466d('0x3a')](_0x20d897[_0x466d('0x36')],qs[_0x466d('0x3c')](_0x2ef420[_0x466d('0x37')][_0x466d('0x3c')]));_0x481961[_0x466d('0x3b')]=_0x481961[_0x466d('0x3b')]['length']?_0x481961[_0x466d('0x3b')]:_0x20d897[_0x466d('0x36')];if(_0x2ef420[_0x466d('0x37')]['includeAll']){_0x481961['include']=[{'all':!![]}];}_0x481961=_['merge']({},_0x481961,_0x2ef420[_0x466d('0x44')]);return db[_0x466d('0x33')]['find'](_0x481961)[_0x466d('0x1a')](handleEntityNotFound(_0x75b2ea,null))[_0x466d('0x1a')](respondWithResult(_0x75b2ea,null))[_0x466d('0x24')](handleError(_0x75b2ea,null));};exports[_0x466d('0x4a')]=function(_0x141111,_0x145f08){return db[_0x466d('0x33')][_0x466d('0x4a')](_0x141111[_0x466d('0x4b')],{})['then'](respondWithResult(_0x145f08,0xc9))[_0x466d('0x24')](handleError(_0x145f08,null));};exports[_0x466d('0x4c')]=function(_0x4d3a48,_0x224f54){if(_0x4d3a48[_0x466d('0x4b')]['id']){delete _0x4d3a48[_0x466d('0x4b')]['id'];}return db[_0x466d('0x33')][_0x466d('0x4d')]({'where':{'id':_0x4d3a48[_0x466d('0x49')]['id']}})[_0x466d('0x1a')](handleEntityNotFound(_0x224f54,null))[_0x466d('0x1a')](saveUpdates(_0x4d3a48[_0x466d('0x4b')],null))[_0x466d('0x1a')](respondWithResult(_0x224f54,null))['catch'](handleError(_0x224f54,null));};exports['destroy']=function(_0x1091c9,_0x1ff354){return db['VtigerAccount']['find']({'where':{'id':_0x1091c9[_0x466d('0x49')]['id']}})[_0x466d('0x1a')](handleEntityNotFound(_0x1ff354,null))[_0x466d('0x1a')](removeEntity(_0x1ff354,null))['catch'](handleError(_0x1ff354,null));};exports[_0x466d('0x4e')]=function(_0x4e6c17,_0x4b2482,_0x527598){var _0x468fb1={};var _0x14b752={};var _0x5151f5;var _0x579705;return db[_0x466d('0x33')]['findOne']({'where':{'id':_0x4e6c17['params']['id']}})['then'](handleEntityNotFound(_0x4b2482,null))[_0x466d('0x1a')](function(_0x453982){if(_0x453982){_0x5151f5=_0x453982;_0x14b752['model']=_['keys'](db['VtigerConfiguration'][_0x466d('0x4f')]);_0x14b752['query']=_[_0x466d('0x38')](_0x4e6c17[_0x466d('0x37')]);_0x14b752[_0x466d('0x39')]=_[_0x466d('0x3a')](_0x14b752[_0x466d('0x36')],_0x14b752['query']);_0x468fb1[_0x466d('0x3b')]=_['intersection'](_0x14b752[_0x466d('0x36')],qs[_0x466d('0x3c')](_0x4e6c17[_0x466d('0x37')]['fields']));_0x468fb1[_0x466d('0x3b')]=_0x468fb1['attributes'][_0x466d('0x3d')]?_0x468fb1[_0x466d('0x3b')]:_0x14b752[_0x466d('0x36')];_0x468fb1[_0x466d('0x50')]=qs[_0x466d('0x3e')](_0x4e6c17['query'][_0x466d('0x3e')]);_0x468fb1[_0x466d('0x3f')]=qs['filters'](_['pick'](_0x4e6c17[_0x466d('0x37')],_0x14b752['filters']));if(_0x4e6c17[_0x466d('0x37')][_0x466d('0x41')]){_0x468fb1[_0x466d('0x3f')]=_[_0x466d('0x42')](_0x468fb1[_0x466d('0x3f')],{'$or':_[_0x466d('0x32')](_0x468fb1[_0x466d('0x3b')],function(_0x2d57a2){var _0x2c44c2={};_0x2c44c2[_0x2d57a2]={'$like':'%'+_0x4e6c17['query'][_0x466d('0x41')]+'%'};return _0x2c44c2;})});}_0x468fb1=_['merge']({},_0x468fb1,_0x4e6c17['options']);return _0x5151f5['getConfigurations'](_0x468fb1);}})['then'](function(_0x1db206){if(_0x1db206){_0x579705=_0x1db206[_0x466d('0x3d')];if(!_0x4e6c17['query']['hasOwnProperty']('nolimit')){_0x468fb1['limit']=qs[_0x466d('0x27')](_0x4e6c17[_0x466d('0x37')][_0x466d('0x27')]);_0x468fb1['offset']=qs[_0x466d('0x26')](_0x4e6c17[_0x466d('0x37')][_0x466d('0x26')]);}return _0x5151f5[_0x466d('0x4e')](_0x468fb1);}})['then'](function(_0x1879e4){if(_0x1879e4){return _0x1879e4?{'count':_0x579705,'rows':_0x1879e4}:null;}})[_0x466d('0x1a')](respondWithResult(_0x4b2482,null))[_0x466d('0x24')](handleError(_0x4b2482,null));};exports[_0x466d('0x51')]=function(_0x27f767,_0x384062,_0x117442){if(_0x27f767['body']['id']){delete _0x27f767['body']['id'];}return db[_0x466d('0x33')][_0x466d('0x52')]({'where':{'id':_0x27f767[_0x466d('0x49')]['id']}})[_0x466d('0x1a')](handleEntityNotFound(_0x384062,null))['then'](function(_0x1fd968){if(_0x1fd968){_0x27f767['body'][_0x466d('0x53')]=_0x1fd968['id'];_0x27f767['body'][_0x466d('0x54')]=integrations['getSubjects'](_0x27f767['body'][_0x466d('0x55')],_0x27f767['body'][_0x466d('0x34')]);_0x27f767[_0x466d('0x4b')][_0x466d('0x56')]=integrations[_0x466d('0x57')](_0x27f767[_0x466d('0x4b')][_0x466d('0x55')],_0x27f767[_0x466d('0x4b')][_0x466d('0x34')]);return db[_0x466d('0x58')][_0x466d('0x4a')](_0x27f767[_0x466d('0x4b')],{'include':[{'model':db['VtigerField'],'as':_0x466d('0x54')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x384062,null))[_0x466d('0x24')](handleError(_0x384062,null));};var md5=require(_0x466d('0x59'));exports[_0x466d('0x5a')]=function(_0x498b7a,_0x1f272f,_0x1fe8c4){var _0x5886c4=null;var _0x719891=null;var _0xefdfe9=null;var _0x61eb2=null;var _0x384d2e='';return db[_0x466d('0x33')][_0x466d('0x52')]({'where':{'id':_0x498b7a['params']['id']},'attributes':['id',_0x466d('0x2f'),_0x466d('0x5b'),_0x466d('0x5c'),'moduleName',_0x466d('0x5d'),_0x466d('0x5e'),_0x466d('0x5f')]})[_0x466d('0x1a')](handleEntityNotFound(_0x1f272f,null))[_0x466d('0x1a')](function(_0x2c844){if(_0x2c844){_0x5886c4=_0x2c844[_0x466d('0x5b')];_0x719891=_0x2c844[_0x466d('0x5f')];_0xefdfe9=_0x2c844[_0x466d('0x60')];_0x384d2e=_0x2c844['remoteUri'];var _0x9efbea=_0x384d2e[_0x466d('0x61')](-0x1);if(_0x9efbea==='/'){_0x384d2e=_0x384d2e[_0x466d('0x62')](0x0,_0x384d2e['lastIndexOf'](_0x9efbea));}_0x61eb2=util[_0x466d('0x63')](_0x466d('0x64'),_0x384d2e);var _0x484978={'method':'GET','uri':_0x61eb2,'qs':{'operation':_0x466d('0x65'),'username':_0x2c844[_0x466d('0x5b')]},'json':!![]};return rp(_0x484978);}})['then'](function(_0x138de1){if(_0x138de1['success']){var _0x15a696={'method':'POST','uri':_0x61eb2,'form':{'operation':_0x466d('0x66'),'username':_0x5886c4,'accessKey':md5(_0x138de1[_0x466d('0x23')]['token']+_0x719891)},'json':!![]};return rp(_0x15a696);}})['then'](function(_0x189653){if(_0x189653[_0x466d('0x67')]){var _0xfd32e7={'method':'GET','uri':_0x61eb2,'qs':{'operation':_0x466d('0x68'),'username':_0x5886c4,'sessionName':_0x189653[_0x466d('0x23')][_0x466d('0x69')],'elementType':_0xefdfe9},'json':!![]};return rp(_0xfd32e7);}})[_0x466d('0x1a')](function(_0x73fc8){if(_0x73fc8['success']){var _0x2e1151=['autogenerated',_0x466d('0x6a'),_0x466d('0x6b')];_['remove'](_0x73fc8[_0x466d('0x23')][_0x466d('0x3c')],function(_0x3305c7){return _0x2e1151[_0x466d('0x6c')](_0x3305c7['type'][_0x466d('0x2f')]);});_['remove'](_0x73fc8[_0x466d('0x23')]['fields'],function(_0x24af72){return _0x24af72['editable']==='false';});return{'count':_0x73fc8[_0x466d('0x23')][_0x466d('0x3c')][_0x466d('0x3d')],'rows':_[_0x466d('0x32')](_0x73fc8[_0x466d('0x23')][_0x466d('0x3c')],function(_0x544e8a){return{'id':_0x544e8a[_0x466d('0x2f')],'name':_0x544e8a['label'],'custom':_['startsWith'](_0x544e8a['name'],'cf_')?!![]:![],'options':_0x544e8a['type'][_0x466d('0x2f')]===_0x466d('0x6d')&&_0x544e8a['type'][_0x466d('0x6e')][_0x466d('0x3d')]>0x0?_[_0x466d('0x32')](_0x544e8a[_0x466d('0x34')][_0x466d('0x6e')],function(_0x483e43){return{'name':_0x483e43[_0x466d('0x6f')],'value':_0x483e43[_0x466d('0x70')]};}):[]};})};}})[_0x466d('0x1a')](respondWithResult(_0x1f272f,null))[_0x466d('0x24')](function(_0x4eb86a){console['log']('vTiger\x20error:\x20'+_0x4eb86a);var _0x35d28f=_0x498b7a[_0x466d('0x37')]['test']?0x1f4:_0x4eb86a[_0x466d('0x71')]||0x1f4;logger[_0x466d('0x20')](_0x466d('0x72'),_0x466d('0x5a'),_0x35d28f,JSON['stringify'](_0x4eb86a));delete _0x4eb86a[_0x466d('0x2f')];if(_0x35d28f===0x191){_0x35d28f=0x190;}_0x1f272f['status'](_0x35d28f)[_0x466d('0x30')](_0x498b7a[_0x466d('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4eb86a['statusCode']}:_0x4eb86a);});}; \ No newline at end of file +var _0xdd0e=['addConfiguration','AccountId','Subjects','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','substring','lastIndexOf','format','getchallenge','success','POST','login','token','sessionName','autogenerated','reference','includes','startsWith','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','set','Content-Range','apply','destroy','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','offset','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','keys','fields','includeAll','options','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','pick','nolimit'];(function(_0x440bc8,_0x3d1650){var _0x22883b=function(_0x134319){while(--_0x134319){_0x440bc8['push'](_0x440bc8['shift']());}};_0x22883b(++_0x3d1650);}(_0xdd0e,0x113));var _0xedd0=function(_0x1d94ba,_0x204592){_0x1d94ba=_0x1d94ba-0x0;var _0x17fb76=_0xdd0e[_0x1d94ba];return _0x17fb76;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xedd0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xedd0('0x1'));var Mustache=require('mustache');var util=require(_0xedd0('0x2'));var path=require(_0xedd0('0x3'));var sox=require(_0xedd0('0x4'));var csv=require(_0xedd0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xedd0('0x6'));var squel=require(_0xedd0('0x7'));var crypto=require(_0xedd0('0x8'));var jsforce=require(_0xedd0('0x9'));var deskjs=require(_0xedd0('0xa'));var toCsv=require(_0xedd0('0x5'));var querystring=require(_0xedd0('0xb'));var Papa=require(_0xedd0('0xc'));var Redis=require(_0xedd0('0xd'));var authService=require(_0xedd0('0xe'));var qs=require(_0xedd0('0xf'));var as=require(_0xedd0('0x10'));var hardwareService=require(_0xedd0('0x11'));var logger=require('../../config/logger')(_0xedd0('0x12'));var utils=require(_0xedd0('0x13'));var config=require(_0xedd0('0x14'));var db=require(_0xedd0('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xedd0('0x16'));var client=jayson[_0xedd0('0x17')][_0xedd0('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5ba56c,_0x3f354b,_0x1d8280){if(_0x1d8280){var _0x396e8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x396e8f['test'](_0x3f354b)){return _0x5ba56c;}else{throw new db[(_0xedd0('0x19'))][(_0xedd0('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5ba56c;}}function respondWithRpcPromise(_0x437a19,_0x128480,_0x43df90,_0xf599d9){return new BPromise(function(_0x45dbfb,_0x5b57ce){var _0x442e01=_0xf599d9||client;return _0x442e01[_0xedd0('0x1b')](_0x437a19,_0x43df90)['then'](function(_0x1a8a64){logger[_0xedd0('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x128480,'request\x20sent');logger[_0xedd0('0x1d')](_0xedd0('0x1e'),_0x128480,_0xedd0('0x1f'),JSON[_0xedd0('0x20')](_0x1a8a64));if(_0x1a8a64['error']){if(_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x22')]===0x1f4){logger['error'](_0xedd0('0x23'),_0x128480,_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);return _0x5b57ce(_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);}logger[_0xedd0('0x21')](_0xedd0('0x23'),_0x128480,_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);return _0x45dbfb(_0x1a8a64[_0xedd0('0x21')][_0xedd0('0x24')]);}else{logger[_0xedd0('0x1c')](_0xedd0('0x23'),_0x128480,'request\x20sent');_0x45dbfb(_0x1a8a64[_0xedd0('0x25')][_0xedd0('0x24')]);}})['catch'](function(_0x574cde){logger[_0xedd0('0x21')](_0xedd0('0x23'),_0x128480,_0x574cde);_0x5b57ce(_0x574cde);});});}function respondWithStatusCode(_0x4e5549,_0x4ec837){_0x4ec837=_0x4ec837||0xcc;return function(_0x1fe25c){if(_0x1fe25c){return _0x4e5549[_0xedd0('0x26')](_0x4ec837);}return _0x4e5549['status'](_0x4ec837)[_0xedd0('0x27')]();};}function respondWithResult(_0x308ed2,_0x18ecfb){_0x18ecfb=_0x18ecfb||0xc8;return function(_0x1e78a9){if(_0x1e78a9){return _0x308ed2[_0xedd0('0x28')](_0x18ecfb)[_0xedd0('0x29')](_0x1e78a9);}};}function respondWithFilteredResult(_0x6427e3,_0x839505){return function(_0x5a2156){if(_0x5a2156){var _0x58e110=_0x5a2156[_0xedd0('0x2a')],_0x5b6a71=_0x839505['offset'],_0x3377cd=_0x839505['offset']+_0x839505['limit'],_0x21ea15;if(_0x3377cd>=_0x58e110){_0x3377cd=_0x58e110;_0x21ea15=0xc8;}else{_0x21ea15=0xce;}_0x6427e3[_0xedd0('0x28')](_0x21ea15);return _0x6427e3[_0xedd0('0x2b')](_0xedd0('0x2c'),_0x5b6a71+'-'+_0x3377cd+'/'+_0x58e110)[_0xedd0('0x29')](_0x5a2156);}return null;};}function patchUpdates(_0x2d0114){return function(_0x33369f){try{jsonpatch[_0xedd0('0x2d')](_0x33369f,_0x2d0114,!![]);}catch(_0x5aa6c4){return BPromise['reject'](_0x5aa6c4);}return _0x33369f['save']();};}function saveUpdates(_0xa33973,_0x4a9fcb){return function(_0x34c714){if(_0x34c714){return _0x34c714['update'](_0xa33973)['then'](function(_0x254b20){return _0x254b20;});}return null;};}function removeEntity(_0x3dce30,_0x46ada4){return function(_0x17bcdc){if(_0x17bcdc){return _0x17bcdc[_0xedd0('0x2e')]()[_0xedd0('0x2f')](function(){_0x3dce30[_0xedd0('0x28')](0xcc)[_0xedd0('0x27')]();});}};}function handleEntityNotFound(_0x4bb658,_0x193e37){return function(_0x35feb6){if(!_0x35feb6){_0x4bb658[_0xedd0('0x26')](0x194);}return _0x35feb6;};}function handleError(_0x2861f2,_0x37667f){_0x37667f=_0x37667f||0x1f4;return function(_0x376c1b){logger[_0xedd0('0x21')](_0x376c1b['stack']);if(_0x376c1b[_0xedd0('0x30')]){delete _0x376c1b['name'];}_0x2861f2['status'](_0x37667f)[_0xedd0('0x31')](_0x376c1b);};}exports[_0xedd0('0x32')]=function(_0x30b8f3,_0x2f4ea4){var _0x5578ad={},_0x907291={},_0x59a205={'count':0x0,'rows':[]};var _0x18bd9c=_[_0xedd0('0x33')](db[_0xedd0('0x34')][_0xedd0('0x35')],function(_0x23aa82){return{'name':_0x23aa82[_0xedd0('0x36')],'type':_0x23aa82[_0xedd0('0x37')]['key']};});_0x907291[_0xedd0('0x38')]=_[_0xedd0('0x33')](_0x18bd9c,_0xedd0('0x30'));_0x907291[_0xedd0('0x39')]=_['keys'](_0x30b8f3['query']);_0x907291[_0xedd0('0x3a')]=_[_0xedd0('0x3b')](_0x907291[_0xedd0('0x38')],_0x907291[_0xedd0('0x39')]);_0x5578ad[_0xedd0('0x3c')]=_['intersection'](_0x907291[_0xedd0('0x38')],qs['fields'](_0x30b8f3['query']['fields']));_0x5578ad[_0xedd0('0x3c')]=_0x5578ad[_0xedd0('0x3c')][_0xedd0('0x3d')]?_0x5578ad[_0xedd0('0x3c')]:_0x907291['model'];if(!_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x3e')]('nolimit')){_0x5578ad[_0xedd0('0x3f')]=qs[_0xedd0('0x3f')](_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x3f')]);_0x5578ad[_0xedd0('0x40')]=qs['offset'](_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x40')]);}_0x5578ad[_0xedd0('0x41')]=qs['sort'](_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x42')]);_0x5578ad[_0xedd0('0x43')]=qs['filters'](_['pick'](_0x30b8f3['query'],_0x907291[_0xedd0('0x3a')]),_0x18bd9c);if(_0x30b8f3[_0xedd0('0x39')][_0xedd0('0x44')]){_0x5578ad['where']=_[_0xedd0('0x45')](_0x5578ad[_0xedd0('0x43')],{'$or':_[_0xedd0('0x33')](_0x18bd9c,function(_0xff1c68){if(_0xff1c68['type']!==_0xedd0('0x46')){var _0x53f9cb={};_0x53f9cb[_0xff1c68[_0xedd0('0x30')]]={'$like':'%'+_0x30b8f3['query'][_0xedd0('0x44')]+'%'};return _0x53f9cb;}})});}_0x5578ad=_[_0xedd0('0x45')]({},_0x5578ad,_0x30b8f3['options']);var _0x344dab={'where':_0x5578ad[_0xedd0('0x43')]};return db['VtigerAccount']['count'](_0x344dab)['then'](function(_0x200bb5){_0x59a205[_0xedd0('0x2a')]=_0x200bb5;if(_0x30b8f3[_0xedd0('0x39')]['includeAll']){_0x5578ad[_0xedd0('0x47')]=[{'all':!![]}];}return db[_0xedd0('0x34')]['findAll'](_0x5578ad);})[_0xedd0('0x2f')](function(_0x54d440){_0x59a205[_0xedd0('0x48')]=_0x54d440;return _0x59a205;})[_0xedd0('0x2f')](respondWithFilteredResult(_0x2f4ea4,_0x5578ad))[_0xedd0('0x49')](handleError(_0x2f4ea4,null));};exports[_0xedd0('0x4a')]=function(_0x3c63b7,_0xe85b8c){var _0x5270c6={'raw':![],'where':{'id':_0x3c63b7['params']['id']}},_0xdc9014={};_0xdc9014[_0xedd0('0x38')]=_[_0xedd0('0x4b')](db['VtigerAccount'][_0xedd0('0x35')]);_0xdc9014[_0xedd0('0x39')]=_[_0xedd0('0x4b')](_0x3c63b7[_0xedd0('0x39')]);_0xdc9014[_0xedd0('0x3a')]=_[_0xedd0('0x3b')](_0xdc9014[_0xedd0('0x38')],_0xdc9014[_0xedd0('0x39')]);_0x5270c6['attributes']=_[_0xedd0('0x3b')](_0xdc9014[_0xedd0('0x38')],qs[_0xedd0('0x4c')](_0x3c63b7[_0xedd0('0x39')][_0xedd0('0x4c')]));_0x5270c6['attributes']=_0x5270c6[_0xedd0('0x3c')][_0xedd0('0x3d')]?_0x5270c6[_0xedd0('0x3c')]:_0xdc9014[_0xedd0('0x38')];if(_0x3c63b7[_0xedd0('0x39')][_0xedd0('0x4d')]){_0x5270c6['include']=[{'all':!![]}];}_0x5270c6=_[_0xedd0('0x45')]({},_0x5270c6,_0x3c63b7[_0xedd0('0x4e')]);return db[_0xedd0('0x34')]['find'](_0x5270c6)[_0xedd0('0x2f')](handleEntityNotFound(_0xe85b8c,null))['then'](respondWithResult(_0xe85b8c,null))[_0xedd0('0x49')](handleError(_0xe85b8c,null));};exports['create']=function(_0x845132,_0x46a4c6){return db['VtigerAccount'][_0xedd0('0x4f')](_0x845132[_0xedd0('0x50')],{})[_0xedd0('0x2f')](respondWithResult(_0x46a4c6,0xc9))[_0xedd0('0x49')](handleError(_0x46a4c6,null));};exports['update']=function(_0x401319,_0x3ca742){if(_0x401319[_0xedd0('0x50')]['id']){delete _0x401319[_0xedd0('0x50')]['id'];}return db[_0xedd0('0x34')][_0xedd0('0x51')]({'where':{'id':_0x401319['params']['id']}})['then'](handleEntityNotFound(_0x3ca742,null))[_0xedd0('0x2f')](saveUpdates(_0x401319[_0xedd0('0x50')],null))[_0xedd0('0x2f')](respondWithResult(_0x3ca742,null))[_0xedd0('0x49')](handleError(_0x3ca742,null));};exports[_0xedd0('0x2e')]=function(_0x5239ed,_0x2b00ec){return db['VtigerAccount'][_0xedd0('0x51')]({'where':{'id':_0x5239ed[_0xedd0('0x52')]['id']}})[_0xedd0('0x2f')](handleEntityNotFound(_0x2b00ec,null))['then'](removeEntity(_0x2b00ec,null))[_0xedd0('0x49')](handleError(_0x2b00ec,null));};exports[_0xedd0('0x53')]=function(_0x16f7b3,_0x466168,_0x543019){var _0x36b491={};var _0x224b79={};var _0x387a7c;var _0x5792e5;return db['VtigerAccount'][_0xedd0('0x54')]({'where':{'id':_0x16f7b3['params']['id']}})[_0xedd0('0x2f')](handleEntityNotFound(_0x466168,null))[_0xedd0('0x2f')](function(_0x3de56c){if(_0x3de56c){_0x387a7c=_0x3de56c;_0x224b79[_0xedd0('0x38')]=_[_0xedd0('0x4b')](db[_0xedd0('0x55')]['rawAttributes']);_0x224b79[_0xedd0('0x39')]=_['keys'](_0x16f7b3['query']);_0x224b79[_0xedd0('0x3a')]=_[_0xedd0('0x3b')](_0x224b79[_0xedd0('0x38')],_0x224b79[_0xedd0('0x39')]);_0x36b491['attributes']=_[_0xedd0('0x3b')](_0x224b79[_0xedd0('0x38')],qs[_0xedd0('0x4c')](_0x16f7b3['query'][_0xedd0('0x4c')]));_0x36b491[_0xedd0('0x3c')]=_0x36b491['attributes']['length']?_0x36b491[_0xedd0('0x3c')]:_0x224b79['model'];_0x36b491[_0xedd0('0x41')]=qs['sort'](_0x16f7b3[_0xedd0('0x39')]['sort']);_0x36b491['where']=qs[_0xedd0('0x3a')](_[_0xedd0('0x56')](_0x16f7b3[_0xedd0('0x39')],_0x224b79[_0xedd0('0x3a')]));if(_0x16f7b3[_0xedd0('0x39')][_0xedd0('0x44')]){_0x36b491['where']=_[_0xedd0('0x45')](_0x36b491[_0xedd0('0x43')],{'$or':_[_0xedd0('0x33')](_0x36b491[_0xedd0('0x3c')],function(_0x107bf4){var _0x340fa8={};_0x340fa8[_0x107bf4]={'$like':'%'+_0x16f7b3['query']['filter']+'%'};return _0x340fa8;})});}_0x36b491=_[_0xedd0('0x45')]({},_0x36b491,_0x16f7b3[_0xedd0('0x4e')]);return _0x387a7c[_0xedd0('0x53')](_0x36b491);}})[_0xedd0('0x2f')](function(_0x49b7fa){if(_0x49b7fa){_0x5792e5=_0x49b7fa[_0xedd0('0x3d')];if(!_0x16f7b3[_0xedd0('0x39')][_0xedd0('0x3e')](_0xedd0('0x57'))){_0x36b491['limit']=qs['limit'](_0x16f7b3[_0xedd0('0x39')][_0xedd0('0x3f')]);_0x36b491[_0xedd0('0x40')]=qs['offset'](_0x16f7b3['query'][_0xedd0('0x40')]);}return _0x387a7c[_0xedd0('0x53')](_0x36b491);}})['then'](function(_0x54ecd2){if(_0x54ecd2){return _0x54ecd2?{'count':_0x5792e5,'rows':_0x54ecd2}:null;}})[_0xedd0('0x2f')](respondWithResult(_0x466168,null))['catch'](handleError(_0x466168,null));};exports[_0xedd0('0x58')]=function(_0x2dd45e,_0x29ad5d,_0x575da5){if(_0x2dd45e[_0xedd0('0x50')]['id']){delete _0x2dd45e[_0xedd0('0x50')]['id'];}return db[_0xedd0('0x34')][_0xedd0('0x54')]({'where':{'id':_0x2dd45e['params']['id']}})[_0xedd0('0x2f')](handleEntityNotFound(_0x29ad5d,null))[_0xedd0('0x2f')](function(_0x36d02a){if(_0x36d02a){_0x2dd45e['body'][_0xedd0('0x59')]=_0x36d02a['id'];_0x2dd45e['body'][_0xedd0('0x5a')]=integrations['getSubjects'](_0x2dd45e['body']['channel'],_0x2dd45e[_0xedd0('0x50')][_0xedd0('0x37')]);_0x2dd45e[_0xedd0('0x50')][_0xedd0('0x5b')]=integrations['getDescriptions'](_0x2dd45e[_0xedd0('0x50')]['channel'],_0x2dd45e[_0xedd0('0x50')][_0xedd0('0x37')]);return db['VtigerConfiguration'][_0xedd0('0x4f')](_0x2dd45e[_0xedd0('0x50')],{'include':[{'model':db['VtigerField'],'as':_0xedd0('0x5a')},{'model':db[_0xedd0('0x5c')],'as':'Descriptions'}]});}return null;})[_0xedd0('0x2f')](respondWithResult(_0x29ad5d,null))[_0xedd0('0x49')](handleError(_0x29ad5d,null));};var md5=require(_0xedd0('0x5d'));exports[_0xedd0('0x5e')]=function(_0x4ed40a,_0x30a234,_0x32710d){var _0x129211=null;var _0x1cb808=null;var _0x3a2de1=null;var _0xa76bd=null;var _0x94ede='';return db[_0xedd0('0x34')][_0xedd0('0x54')]({'where':{'id':_0x4ed40a[_0xedd0('0x52')]['id']},'attributes':['id',_0xedd0('0x30'),_0xedd0('0x5f'),'description',_0xedd0('0x60'),_0xedd0('0x61'),_0xedd0('0x62'),'accessKey']})[_0xedd0('0x2f')](handleEntityNotFound(_0x30a234,null))['then'](function(_0x5b52d6){if(_0x5b52d6){_0x129211=_0x5b52d6[_0xedd0('0x5f')];_0x1cb808=_0x5b52d6['accessKey'];_0x3a2de1=_0x5b52d6[_0xedd0('0x60')];_0x94ede=_0x5b52d6[_0xedd0('0x61')];var _0x1cc5a6=_0x94ede['slice'](-0x1);if(_0x1cc5a6==='/'){_0x94ede=_0x94ede[_0xedd0('0x63')](0x0,_0x94ede[_0xedd0('0x64')](_0x1cc5a6));}_0xa76bd=util[_0xedd0('0x65')]('%s/webservice.php',_0x94ede);var _0x37d5a0={'method':'GET','uri':_0xa76bd,'qs':{'operation':_0xedd0('0x66'),'username':_0x5b52d6[_0xedd0('0x5f')]},'json':!![]};return rp(_0x37d5a0);}})[_0xedd0('0x2f')](function(_0x5d357c){if(_0x5d357c[_0xedd0('0x67')]){var _0x3db722={'method':_0xedd0('0x68'),'uri':_0xa76bd,'form':{'operation':_0xedd0('0x69'),'username':_0x129211,'accessKey':md5(_0x5d357c[_0xedd0('0x25')][_0xedd0('0x6a')]+_0x1cb808)},'json':!![]};return rp(_0x3db722);}})[_0xedd0('0x2f')](function(_0x4a7b32){if(_0x4a7b32[_0xedd0('0x67')]){var _0x2c6c3f={'method':'GET','uri':_0xa76bd,'qs':{'operation':'describe','username':_0x129211,'sessionName':_0x4a7b32['result'][_0xedd0('0x6b')],'elementType':_0x3a2de1},'json':!![]};return rp(_0x2c6c3f);}})[_0xedd0('0x2f')](function(_0x1a22ba){if(_0x1a22ba[_0xedd0('0x67')]){var _0x28dae3=[_0xedd0('0x6c'),_0xedd0('0x6d'),'owner'];_['remove'](_0x1a22ba[_0xedd0('0x25')][_0xedd0('0x4c')],function(_0xbd6c82){return _0x28dae3[_0xedd0('0x6e')](_0xbd6c82['type'][_0xedd0('0x30')]);});_['remove'](_0x1a22ba[_0xedd0('0x25')][_0xedd0('0x4c')],function(_0x4cf96e){return _0x4cf96e['editable']==='false';});return{'count':_0x1a22ba[_0xedd0('0x25')][_0xedd0('0x4c')][_0xedd0('0x3d')],'rows':_[_0xedd0('0x33')](_0x1a22ba[_0xedd0('0x25')]['fields'],function(_0xf8d6ae){return{'id':_0xf8d6ae[_0xedd0('0x30')],'name':_0xf8d6ae['label'],'custom':_[_0xedd0('0x6f')](_0xf8d6ae[_0xedd0('0x30')],'cf_')?!![]:![],'options':_0xf8d6ae[_0xedd0('0x37')][_0xedd0('0x30')]===_0xedd0('0x70')&&_0xf8d6ae[_0xedd0('0x37')][_0xedd0('0x71')][_0xedd0('0x3d')]>0x0?_[_0xedd0('0x33')](_0xf8d6ae['type'][_0xedd0('0x71')],function(_0x7aa6e4){return{'name':_0x7aa6e4[_0xedd0('0x72')],'value':_0x7aa6e4[_0xedd0('0x73')]};}):[]};})};}})[_0xedd0('0x2f')](respondWithResult(_0x30a234,null))[_0xedd0('0x49')](function(_0x274661){console[_0xedd0('0x74')]('vTiger\x20error:\x20'+_0x274661);var _0x40526e=_0x4ed40a[_0xedd0('0x39')]['test']?0x1f4:_0x274661[_0xedd0('0x75')]||0x1f4;logger[_0xedd0('0x21')](_0xedd0('0x76'),_0xedd0('0x5e'),_0x40526e,JSON[_0xedd0('0x20')](_0x274661));delete _0x274661[_0xedd0('0x30')];if(_0x40526e===0x191){_0x40526e=0x190;}_0x30a234[_0xedd0('0x28')](_0x40526e)[_0xedd0('0x31')](_0x4ed40a[_0xedd0('0x39')][_0xedd0('0x77')]?{'message':_0xedd0('0x78'),'statusCode':_0x274661[_0xedd0('0x75')]}:_0x274661);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index af833f4..8534d8f 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 _0xd1e7=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x569dc7,_0x32e487){var _0x2f7c48=function(_0x2e4d2d){while(--_0x2e4d2d){_0x569dc7['push'](_0x569dc7['shift']());}};_0x2f7c48(++_0x32e487);}(_0xd1e7,0x1d4));var _0x7d1e=function(_0x250fb1,_0x69bfe0){_0x250fb1=_0x250fb1-0x0;var _0x4e05d5=_0xd1e7[_0x250fb1];return _0x4e05d5;};'use strict';var _=require(_0x7d1e('0x0'));var util=require(_0x7d1e('0x1'));var logger=require(_0x7d1e('0x2'))(_0x7d1e('0x3'));var moment=require(_0x7d1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d1e('0x6'));var config=require(_0x7d1e('0x7'));var attributes=require(_0x7d1e('0x8'));var integrations=require(_0x7d1e('0x9'));module[_0x7d1e('0xa')]=function(_0x52cde9,_0x59a23a){return _0x52cde9['define'](_0x7d1e('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9803=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x23d552,_0x3fe415){var _0x142f15=function(_0x448851){while(--_0x448851){_0x23d552['push'](_0x23d552['shift']());}};_0x142f15(++_0x3fe415);}(_0x9803,0x9a));var _0x3980=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9803[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var logger=require(_0x3980('0x2'))(_0x3980('0x3'));var moment=require(_0x3980('0x4'));var BPromise=require(_0x3980('0x5'));var rp=require(_0x3980('0x6'));var fs=require('fs');var path=require(_0x3980('0x7'));var rimraf=require(_0x3980('0x8'));var config=require(_0x3980('0x9'));var attributes=require(_0x3980('0xa'));var integrations=require(_0x3980('0xb'));module[_0x3980('0xc')]=function(_0x2916d7,_0x517bed){return _0x2916d7[_0x3980('0xd')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0b87104..7a00810 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 _0xfb7c=['map','attributes','model','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount','findAll','raw','options','where','limit','include'];(function(_0x492b8b,_0x47a69f){var _0x1b0bea=function(_0x5476e7){while(--_0x5476e7){_0x492b8b['push'](_0x492b8b['shift']());}};_0x1b0bea(++_0x47a69f);}(_0xfb7c,0x178));var _0xcfb7=function(_0x12a451,_0x4dfa3d){_0x12a451=_0x12a451-0x0;var _0x55c4fa=_0xfb7c[_0x12a451];return _0x55c4fa;};'use strict';var _=require(_0xcfb7('0x0'));var util=require(_0xcfb7('0x1'));var moment=require(_0xcfb7('0x2'));var BPromise=require(_0xcfb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfb7('0x4'));var db=require(_0xcfb7('0x5'))['db'];var utils=require(_0xcfb7('0x6'));var logger=require(_0xcfb7('0x7'))(_0xcfb7('0x8'));var config=require(_0xcfb7('0x9'));var jayson=require(_0xcfb7('0xa'));var client=jayson[_0xcfb7('0xb')][_0xcfb7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe4463a,_0xa8a7e5,_0xac314b){return new BPromise(function(_0x3b9d94,_0x4c8fbd){return client[_0xcfb7('0xd')](_0xe4463a,_0xac314b)[_0xcfb7('0xe')](function(_0x1ae21e){logger[_0xcfb7('0xf')](_0xcfb7('0x10'),_0xa8a7e5,_0xcfb7('0x11'));logger[_0xcfb7('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xa8a7e5,_0xcfb7('0x11'),JSON[_0xcfb7('0x13')](_0x1ae21e));if(_0x1ae21e[_0xcfb7('0x14')]){if(_0x1ae21e['error']['code']===0x1f4){logger[_0xcfb7('0x14')](_0xcfb7('0x10'),_0xa8a7e5,_0x1ae21e[_0xcfb7('0x14')][_0xcfb7('0x15')]);return _0x4c8fbd(_0x1ae21e[_0xcfb7('0x14')][_0xcfb7('0x15')]);}logger[_0xcfb7('0x14')]('VtigerAccount,\x20%s,\x20%s',_0xa8a7e5,_0x1ae21e['error'][_0xcfb7('0x15')]);return _0x3b9d94(_0x1ae21e[_0xcfb7('0x14')]['message']);}else{logger[_0xcfb7('0xf')](_0xcfb7('0x10'),_0xa8a7e5,'request\x20sent');_0x3b9d94(_0x1ae21e[_0xcfb7('0x16')][_0xcfb7('0x15')]);}})[_0xcfb7('0x17')](function(_0x54a2e6){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xa8a7e5,_0x54a2e6);_0x4c8fbd(_0x54a2e6);});});}exports[_0xcfb7('0x18')]=function(_0x49b458){var _0xbbc516=this;return new Promise(function(_0x4ca167,_0x21b308){return db['VtigerAccount'][_0xcfb7('0x19')]({'raw':_0x49b458['options']?_0x49b458['options'][_0xcfb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x49b458['options']?_0x49b458[_0xcfb7('0x1b')][_0xcfb7('0x1c')]||null:null,'attributes':_0x49b458[_0xcfb7('0x1b')]?_0x49b458[_0xcfb7('0x1b')]['attributes']||null:null,'limit':_0x49b458['options']?_0x49b458[_0xcfb7('0x1b')][_0xcfb7('0x1d')]||null:null,'include':_0x49b458[_0xcfb7('0x1b')]?_0x49b458['options'][_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x49b458[_0xcfb7('0x1b')][_0xcfb7('0x1e')],function(_0x2b13f4){return{'model':db[_0x2b13f4['model']],'as':_0x2b13f4['as'],'attributes':_0x2b13f4[_0xcfb7('0x20')],'include':_0x2b13f4[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x2b13f4[_0xcfb7('0x1e')],function(_0x142b30){return{'model':db[_0x142b30[_0xcfb7('0x21')]],'as':_0x142b30['as'],'attributes':_0x142b30[_0xcfb7('0x20')],'include':_0x142b30[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x142b30[_0xcfb7('0x1e')],function(_0x53cfa7){return{'model':db[_0x53cfa7[_0xcfb7('0x21')]],'as':_0x53cfa7['as'],'attributes':_0x53cfa7[_0xcfb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcfb7('0xe')](function(_0x54b9b1){logger[_0xcfb7('0xf')](_0xcfb7('0x18'),_0x49b458);logger[_0xcfb7('0x12')](_0xcfb7('0x18'),_0x49b458,JSON[_0xcfb7('0x13')](_0x54b9b1));_0x4ca167(_0x54b9b1);})[_0xcfb7('0x17')](function(_0x381c43){logger[_0xcfb7('0x14')](_0xcfb7('0x18'),_0x381c43['message'],_0x49b458);_0x21b308(_0xbbc516[_0xcfb7('0x14')](0x1f4,_0x381c43[_0xcfb7('0x15')]));});});};exports[_0xcfb7('0x22')]=function(_0x32d39b){var _0xeb360e=this;return new Promise(function(_0x40495c,_0x1caacd){return db[_0xcfb7('0x23')][_0xcfb7('0x24')]({'raw':_0x32d39b[_0xcfb7('0x1b')]?_0x32d39b['options'][_0xcfb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x32d39b['options']?_0x32d39b[_0xcfb7('0x1b')]['where']||null:null,'attributes':_0x32d39b[_0xcfb7('0x1b')]?_0x32d39b[_0xcfb7('0x1b')][_0xcfb7('0x20')]||null:null,'include':_0x32d39b[_0xcfb7('0x1b')]?_0x32d39b['options'][_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x32d39b[_0xcfb7('0x1b')]['include'],function(_0x40aeaa){return{'model':db[_0x40aeaa[_0xcfb7('0x21')]],'as':_0x40aeaa['as'],'attributes':_0x40aeaa[_0xcfb7('0x20')],'include':_0x40aeaa[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x40aeaa[_0xcfb7('0x1e')],function(_0x369f83){return{'model':db[_0x369f83[_0xcfb7('0x21')]],'as':_0x369f83['as'],'attributes':_0x369f83['attributes'],'include':_0x369f83[_0xcfb7('0x1e')]?_[_0xcfb7('0x1f')](_0x369f83['include'],function(_0x1dee1a){return{'model':db[_0x1dee1a[_0xcfb7('0x21')]],'as':_0x1dee1a['as'],'attributes':_0x1dee1a[_0xcfb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcfb7('0xe')](function(_0x2f210d){logger[_0xcfb7('0xf')](_0xcfb7('0x22'),_0x32d39b);logger['debug'](_0xcfb7('0x22'),_0x32d39b,JSON[_0xcfb7('0x13')](_0x2f210d));_0x40495c(_0x2f210d);})[_0xcfb7('0x17')](function(_0x32a539){logger[_0xcfb7('0x14')](_0xcfb7('0x22'),_0x32a539[_0xcfb7('0x15')],_0x32d39b);_0x1caacd(_0xeb360e[_0xcfb7('0x14')](0x1f4,_0x32a539[_0xcfb7('0x15')]));});});}; \ No newline at end of file +var _0xeb27=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','include','model','map','find','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x15acf0,_0x513460){var _0x45e482=function(_0x313c38){while(--_0x313c38){_0x15acf0['push'](_0x15acf0['shift']());}};_0x45e482(++_0x513460);}(_0xeb27,0x132));var _0x7eb2=function(_0x51f736,_0x5879f2){_0x51f736=_0x51f736-0x0;var _0x7f45=_0xeb27[_0x51f736];return _0x7f45;};'use strict';var _=require(_0x7eb2('0x0'));var util=require('util');var moment=require(_0x7eb2('0x1'));var BPromise=require('bluebird');var rs=require(_0x7eb2('0x2'));var fs=require('fs');var Redis=require(_0x7eb2('0x3'));var db=require(_0x7eb2('0x4'))['db'];var utils=require(_0x7eb2('0x5'));var logger=require(_0x7eb2('0x6'))(_0x7eb2('0x7'));var config=require(_0x7eb2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7eb2('0x9')][_0x7eb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeee496,_0x4695c4,_0x20fa75){return new BPromise(function(_0x1df6d4,_0x3d25d7){return client[_0x7eb2('0xb')](_0xeee496,_0x20fa75)[_0x7eb2('0xc')](function(_0x185c65){logger[_0x7eb2('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4695c4,_0x7eb2('0xe'));logger[_0x7eb2('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4695c4,_0x7eb2('0xe'),JSON[_0x7eb2('0x10')](_0x185c65));if(_0x185c65[_0x7eb2('0x11')]){if(_0x185c65['error'][_0x7eb2('0x12')]===0x1f4){logger[_0x7eb2('0x11')](_0x7eb2('0x13'),_0x4695c4,_0x185c65[_0x7eb2('0x11')][_0x7eb2('0x14')]);return _0x3d25d7(_0x185c65['error'][_0x7eb2('0x14')]);}logger[_0x7eb2('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4695c4,_0x185c65[_0x7eb2('0x11')]['message']);return _0x1df6d4(_0x185c65['error'][_0x7eb2('0x14')]);}else{logger[_0x7eb2('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4695c4,'request\x20sent');_0x1df6d4(_0x185c65[_0x7eb2('0x15')][_0x7eb2('0x14')]);}})[_0x7eb2('0x16')](function(_0x7cc120){logger[_0x7eb2('0x11')](_0x7eb2('0x13'),_0x4695c4,_0x7cc120);_0x3d25d7(_0x7cc120);});});}exports[_0x7eb2('0x17')]=function(_0x20b18f){var _0x9a5ba0=this;return new Promise(function(_0x567c22,_0x522f45){return db[_0x7eb2('0x18')]['findAll']({'raw':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1a')]===undefined?!![]:![]:!![],'where':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1b')]||null:null,'attributes':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f['options'][_0x7eb2('0x1c')]||null:null,'limit':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1d')]||null:null,'include':_0x20b18f[_0x7eb2('0x19')]?_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1e')]?_['map'](_0x20b18f[_0x7eb2('0x19')][_0x7eb2('0x1e')],function(_0x587690){return{'model':db[_0x587690[_0x7eb2('0x1f')]],'as':_0x587690['as'],'attributes':_0x587690[_0x7eb2('0x1c')],'include':_0x587690[_0x7eb2('0x1e')]?_[_0x7eb2('0x20')](_0x587690[_0x7eb2('0x1e')],function(_0x28949d){return{'model':db[_0x28949d[_0x7eb2('0x1f')]],'as':_0x28949d['as'],'attributes':_0x28949d['attributes'],'include':_0x28949d['include']?_[_0x7eb2('0x20')](_0x28949d['include'],function(_0x29c9cd){return{'model':db[_0x29c9cd[_0x7eb2('0x1f')]],'as':_0x29c9cd['as'],'attributes':_0x29c9cd[_0x7eb2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7eb2('0xc')](function(_0x5d2b13){logger[_0x7eb2('0xd')]('GetVtigerAccount',_0x20b18f);logger[_0x7eb2('0xf')](_0x7eb2('0x17'),_0x20b18f,JSON[_0x7eb2('0x10')](_0x5d2b13));_0x567c22(_0x5d2b13);})['catch'](function(_0x1fda35){logger[_0x7eb2('0x11')](_0x7eb2('0x17'),_0x1fda35['message'],_0x20b18f);_0x522f45(_0x9a5ba0['error'](0x1f4,_0x1fda35[_0x7eb2('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3fabaf){var _0x305283=this;return new Promise(function(_0x19f22d,_0x64fc11){return db[_0x7eb2('0x18')][_0x7eb2('0x21')]({'raw':_0x3fabaf['options']?_0x3fabaf[_0x7eb2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3fabaf['options']?_0x3fabaf[_0x7eb2('0x19')]['where']||null:null,'attributes':_0x3fabaf['options']?_0x3fabaf[_0x7eb2('0x19')][_0x7eb2('0x1c')]||null:null,'include':_0x3fabaf[_0x7eb2('0x19')]?_0x3fabaf[_0x7eb2('0x19')][_0x7eb2('0x1e')]?_[_0x7eb2('0x20')](_0x3fabaf['options'][_0x7eb2('0x1e')],function(_0x2d3512){return{'model':db[_0x2d3512[_0x7eb2('0x1f')]],'as':_0x2d3512['as'],'attributes':_0x2d3512[_0x7eb2('0x1c')],'include':_0x2d3512['include']?_[_0x7eb2('0x20')](_0x2d3512['include'],function(_0x3a1079){return{'model':db[_0x3a1079[_0x7eb2('0x1f')]],'as':_0x3a1079['as'],'attributes':_0x3a1079[_0x7eb2('0x1c')],'include':_0x3a1079['include']?_['map'](_0x3a1079[_0x7eb2('0x1e')],function(_0x557ebd){return{'model':db[_0x557ebd[_0x7eb2('0x1f')]],'as':_0x557ebd['as'],'attributes':_0x557ebd[_0x7eb2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7eb2('0xc')](function(_0x590180){logger[_0x7eb2('0xd')](_0x7eb2('0x22'),_0x3fabaf);logger[_0x7eb2('0xf')]('ShowVtigerAccount',_0x3fabaf,JSON['stringify'](_0x590180));_0x19f22d(_0x590180);})[_0x7eb2('0x16')](function(_0xaf894b){logger['error'](_0x7eb2('0x22'),_0xaf894b[_0x7eb2('0x14')],_0x3fabaf);_0x64fc11(_0x305283[_0x7eb2('0x11')](0x1f4,_0xaf894b[_0x7eb2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 68ec766..95ee931 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(_0x2a3ba0,_0x292f24){var _0x38846e=function(_0x3affec){while(--_0x3affec){_0x2a3ba0['push'](_0x2a3ba0['shift']());}};_0x38846e(++_0x292f24);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0xb10b[_0x3f670b];return _0x1c0978;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x1087ce,_0x2dde76){var _0x9edc66=function(_0x325abb){while(--_0x325abb){_0x1087ce['push'](_0x1087ce['shift']());}};_0x9edc66(++_0x2dde76);}(_0xb10b,0x12a));var _0xbb10=function(_0x22de09,_0x3db597){_0x22de09=_0x22de09-0x0;var _0x4a13dc=_0xb10b[_0x22de09];return _0x4a13dc;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e933ab0..eaba070 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 _0x4c0e=['sequelize','exports'];(function(_0x426465,_0x434114){var _0x16e021=function(_0x21399f){while(--_0x21399f){_0x426465['push'](_0x426465['shift']());}};_0x16e021(++_0x434114);}(_0x4c0e,0x134));var _0xe4c0=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0x4c0e[_0x214d54];return _0x44ca46;};'use strict';var Sequelize=require(_0xe4c0('0x0'));module[_0xe4c0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c25=['sequelize','STRING'];(function(_0x614504,_0x458975){var _0x2e34d1=function(_0x46951d){while(--_0x46951d){_0x614504['push'](_0x614504['shift']());}};_0x2e34d1(++_0x458975);}(_0x9c25,0xf2));var _0x59c2=function(_0x665870,_0x42ab57){_0x665870=_0x665870-0x0;var _0x317721=_0x9c25[_0x665870];return _0x317721;};'use strict';var Sequelize=require(_0x59c2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x59c2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4dba15f..46127df 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 _0x8443=['bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../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~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','params','find','create','body','destroy','getFields','findOne','order','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','moment'];(function(_0xf3c8e2,_0x317530){var _0x3372a3=function(_0xca45eb){while(--_0xca45eb){_0xf3c8e2['push'](_0xf3c8e2['shift']());}};_0x3372a3(++_0x317530);}(_0x8443,0x101));var _0x3844=function(_0xcc8729,_0x57b762){_0xcc8729=_0xcc8729-0x0;var _0xbbcdba=_0x8443[_0xcc8729];return _0xbbcdba;};'use strict';var pdf=require(_0x3844('0x0'));var emlformat=require(_0x3844('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3844('0x2'));var rp=require('request-promise');var moment=require(_0x3844('0x3'));var BPromise=require(_0x3844('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3844('0x5'));var sox=require('sox');var csv=require(_0x3844('0x6'));var ejs=require(_0x3844('0x7'));var fs=require('fs');var _=require(_0x3844('0x8'));var squel=require(_0x3844('0x9'));var crypto=require(_0x3844('0xa'));var jsforce=require(_0x3844('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3844('0x6'));var querystring=require(_0x3844('0xc'));var Papa=require(_0x3844('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3844('0xe'));var hardwareService=require(_0x3844('0xf'));var logger=require('../../config/logger')(_0x3844('0x10'));var utils=require(_0x3844('0x11'));var config=require(_0x3844('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3844('0x13'));var client=jayson['client'][_0x3844('0x14')]({'port':0x232a});function checkPasswordPattern(_0x2d094c,_0x1bebe6,_0x3ec62c){if(_0x3ec62c){var _0x42c6de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42c6de[_0x3844('0x15')](_0x1bebe6)){return _0x2d094c;}else{throw new db[(_0x3844('0x16'))][(_0x3844('0x17'))](_0x3844('0x18'));}}else{return _0x2d094c;}}function respondWithRpcPromise(_0x2d679a,_0x21f8ce,_0x1e3152,_0x2a1ed4){return new BPromise(function(_0xc6b803,_0x5666d8){var _0x374954=_0x2a1ed4||client;return _0x374954[_0x3844('0x19')](_0x2d679a,_0x1e3152)[_0x3844('0x1a')](function(_0x4ebfd6){logger[_0x3844('0x1b')](_0x3844('0x1c'),_0x21f8ce,_0x3844('0x1d'));logger['debug'](_0x3844('0x1e'),_0x21f8ce,_0x3844('0x1d'),JSON[_0x3844('0x1f')](_0x4ebfd6));if(_0x4ebfd6[_0x3844('0x20')]){if(_0x4ebfd6[_0x3844('0x20')]['code']===0x1f4){logger[_0x3844('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x21f8ce,_0x4ebfd6[_0x3844('0x20')]['message']);return _0x5666d8(_0x4ebfd6[_0x3844('0x20')][_0x3844('0x21')]);}logger[_0x3844('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x21f8ce,_0x4ebfd6[_0x3844('0x20')]['message']);return _0xc6b803(_0x4ebfd6[_0x3844('0x20')]['message']);}else{logger[_0x3844('0x1b')](_0x3844('0x1c'),_0x21f8ce,'request\x20sent');_0xc6b803(_0x4ebfd6[_0x3844('0x22')][_0x3844('0x21')]);}})[_0x3844('0x23')](function(_0x4d6265){logger['error'](_0x3844('0x1c'),_0x21f8ce,_0x4d6265);_0x5666d8(_0x4d6265);});});}function respondWithStatusCode(_0x531fa3,_0xf8a6a){_0xf8a6a=_0xf8a6a||0xcc;return function(_0x479ee8){if(_0x479ee8){return _0x531fa3[_0x3844('0x24')](_0xf8a6a);}return _0x531fa3[_0x3844('0x25')](_0xf8a6a)['end']();};}function respondWithResult(_0x5e30ab,_0x434b81){_0x434b81=_0x434b81||0xc8;return function(_0x2fa2ff){if(_0x2fa2ff){return _0x5e30ab[_0x3844('0x25')](_0x434b81)[_0x3844('0x26')](_0x2fa2ff);}};}function respondWithFilteredResult(_0x1fa521,_0x4da78a){return function(_0x4c0731){if(_0x4c0731){var _0x13c285=_0x4c0731[_0x3844('0x27')],_0x567f20=_0x4da78a[_0x3844('0x28')],_0x592947=_0x4da78a[_0x3844('0x28')]+_0x4da78a[_0x3844('0x29')],_0x40bf24;if(_0x592947>=_0x13c285){_0x592947=_0x13c285;_0x40bf24=0xc8;}else{_0x40bf24=0xce;}_0x1fa521[_0x3844('0x25')](_0x40bf24);return _0x1fa521[_0x3844('0x2a')](_0x3844('0x2b'),_0x567f20+'-'+_0x592947+'/'+_0x13c285)[_0x3844('0x26')](_0x4c0731);}return null;};}function patchUpdates(_0x8abc42){return function(_0x4f0c17){try{jsonpatch[_0x3844('0x2c')](_0x4f0c17,_0x8abc42,!![]);}catch(_0xece6cd){return BPromise[_0x3844('0x2d')](_0xece6cd);}return _0x4f0c17[_0x3844('0x2e')]();};}function saveUpdates(_0xcba2cc,_0xbfc6b6){return function(_0x38eb97){if(_0x38eb97){return _0x38eb97[_0x3844('0x2f')](_0xcba2cc)[_0x3844('0x1a')](function(_0x31939e){return _0x31939e;});}return null;};}function removeEntity(_0x595c12,_0x2fe6eb){return function(_0x5ac749){if(_0x5ac749){return _0x5ac749['destroy']()[_0x3844('0x1a')](function(){_0x595c12[_0x3844('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcba253,_0x4a0f05){return function(_0x14fa93){if(!_0x14fa93){_0xcba253[_0x3844('0x24')](0x194);}return _0x14fa93;};}function handleError(_0x520edb,_0x1f1515){_0x1f1515=_0x1f1515||0x1f4;return function(_0x5a77d4){logger[_0x3844('0x20')](_0x5a77d4[_0x3844('0x30')]);if(_0x5a77d4[_0x3844('0x31')]){delete _0x5a77d4[_0x3844('0x31')];}_0x520edb[_0x3844('0x25')](_0x1f1515)['send'](_0x5a77d4);};}exports[_0x3844('0x32')]=function(_0x1793f6,_0xa29b2){var _0x133e6b={},_0x539cf8={},_0x1eb4a2={'count':0x0,'rows':[]};var _0x13987a=_[_0x3844('0x33')](db['VtigerConfiguration'][_0x3844('0x34')],function(_0x55145f){return{'name':_0x55145f[_0x3844('0x35')],'type':_0x55145f[_0x3844('0x36')][_0x3844('0x37')]};});_0x539cf8[_0x3844('0x38')]=_['map'](_0x13987a,_0x3844('0x31'));_0x539cf8[_0x3844('0x39')]=_[_0x3844('0x3a')](_0x1793f6[_0x3844('0x39')]);_0x539cf8[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x539cf8[_0x3844('0x38')],_0x539cf8['query']);_0x133e6b[_0x3844('0x3d')]=_[_0x3844('0x3c')](_0x539cf8['model'],qs[_0x3844('0x3e')](_0x1793f6[_0x3844('0x39')][_0x3844('0x3e')]));_0x133e6b['attributes']=_0x133e6b['attributes'][_0x3844('0x3f')]?_0x133e6b[_0x3844('0x3d')]:_0x539cf8[_0x3844('0x38')];if(!_0x1793f6['query']['hasOwnProperty'](_0x3844('0x40'))){_0x133e6b['limit']=qs[_0x3844('0x29')](_0x1793f6[_0x3844('0x39')]['limit']);_0x133e6b[_0x3844('0x28')]=qs[_0x3844('0x28')](_0x1793f6[_0x3844('0x39')]['offset']);}_0x133e6b['order']=qs['sort'](_0x1793f6['query'][_0x3844('0x41')]);_0x133e6b[_0x3844('0x42')]=qs[_0x3844('0x3b')](_[_0x3844('0x43')](_0x1793f6[_0x3844('0x39')],_0x539cf8[_0x3844('0x3b')]),_0x13987a);if(_0x1793f6[_0x3844('0x39')][_0x3844('0x44')]){_0x133e6b[_0x3844('0x42')]=_[_0x3844('0x45')](_0x133e6b[_0x3844('0x42')],{'$or':_[_0x3844('0x33')](_0x13987a,function(_0x45132a){if(_0x45132a['type']!==_0x3844('0x46')){var _0x8284b7={};_0x8284b7[_0x45132a[_0x3844('0x31')]]={'$like':'%'+_0x1793f6[_0x3844('0x39')][_0x3844('0x44')]+'%'};return _0x8284b7;}})});}_0x133e6b=_[_0x3844('0x45')]({},_0x133e6b,_0x1793f6[_0x3844('0x47')]);var _0x33f243={'where':_0x133e6b[_0x3844('0x42')]};return db[_0x3844('0x48')][_0x3844('0x27')](_0x33f243)[_0x3844('0x1a')](function(_0x25a9b){_0x1eb4a2[_0x3844('0x27')]=_0x25a9b;if(_0x1793f6['query'][_0x3844('0x49')]){_0x133e6b[_0x3844('0x4a')]=[{'all':!![]}];}return db[_0x3844('0x48')][_0x3844('0x4b')](_0x133e6b);})[_0x3844('0x1a')](function(_0x16e402){_0x1eb4a2[_0x3844('0x4c')]=_0x16e402;return _0x1eb4a2;})[_0x3844('0x1a')](respondWithFilteredResult(_0xa29b2,_0x133e6b))[_0x3844('0x23')](handleError(_0xa29b2,null));};exports['show']=function(_0x12bd05,_0x47193c){var _0x41acff={'raw':![],'where':{'id':_0x12bd05[_0x3844('0x4d')]['id']}},_0x8ea6c5={};_0x8ea6c5[_0x3844('0x38')]=_['keys'](db[_0x3844('0x48')][_0x3844('0x34')]);_0x8ea6c5[_0x3844('0x39')]=_[_0x3844('0x3a')](_0x12bd05[_0x3844('0x39')]);_0x8ea6c5[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x8ea6c5[_0x3844('0x38')],_0x8ea6c5[_0x3844('0x39')]);_0x41acff[_0x3844('0x3d')]=_[_0x3844('0x3c')](_0x8ea6c5[_0x3844('0x38')],qs[_0x3844('0x3e')](_0x12bd05[_0x3844('0x39')][_0x3844('0x3e')]));_0x41acff['attributes']=_0x41acff[_0x3844('0x3d')][_0x3844('0x3f')]?_0x41acff[_0x3844('0x3d')]:_0x8ea6c5[_0x3844('0x38')];if(_0x12bd05['query']['includeAll']){_0x41acff[_0x3844('0x4a')]=[{'all':!![]}];}_0x41acff=_[_0x3844('0x45')]({},_0x41acff,_0x12bd05['options']);return db[_0x3844('0x48')][_0x3844('0x4e')](_0x41acff)[_0x3844('0x1a')](handleEntityNotFound(_0x47193c,null))[_0x3844('0x1a')](respondWithResult(_0x47193c,null))[_0x3844('0x23')](handleError(_0x47193c,null));};exports[_0x3844('0x4f')]=function(_0x3532da,_0x172848){return db[_0x3844('0x48')][_0x3844('0x4f')](_0x3532da['body'],{})[_0x3844('0x1a')](respondWithResult(_0x172848,0xc9))['catch'](handleError(_0x172848,null));};exports[_0x3844('0x2f')]=function(_0x4d1c09,_0x3c56e8){if(_0x4d1c09[_0x3844('0x50')]['id']){delete _0x4d1c09[_0x3844('0x50')]['id'];}return db[_0x3844('0x48')]['find']({'where':{'id':_0x4d1c09['params']['id']}})['then'](handleEntityNotFound(_0x3c56e8,null))[_0x3844('0x1a')](saveUpdates(_0x4d1c09[_0x3844('0x50')],null))[_0x3844('0x1a')](respondWithResult(_0x3c56e8,null))[_0x3844('0x23')](handleError(_0x3c56e8,null));};exports[_0x3844('0x51')]=function(_0x46c848,_0x4f9cc0){return db[_0x3844('0x48')][_0x3844('0x4e')]({'where':{'id':_0x46c848['params']['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x4f9cc0,null))[_0x3844('0x1a')](removeEntity(_0x4f9cc0,null))['catch'](handleError(_0x4f9cc0,null));};exports[_0x3844('0x52')]=function(_0x538d2b,_0x5ba770,_0x2c4edc){var _0x4c32e2={};var _0x5ce1e8={};var _0x86169f;var _0x166afd;return db[_0x3844('0x48')][_0x3844('0x53')]({'where':{'id':_0x538d2b[_0x3844('0x4d')]['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x5ba770,null))['then'](function(_0x44772b){if(_0x44772b){_0x86169f=_0x44772b;_0x5ce1e8[_0x3844('0x38')]=_['keys'](db['VtigerField']['rawAttributes']);_0x5ce1e8['query']=_[_0x3844('0x3a')](_0x538d2b[_0x3844('0x39')]);_0x5ce1e8['filters']=_[_0x3844('0x3c')](_0x5ce1e8['model'],_0x5ce1e8[_0x3844('0x39')]);_0x4c32e2[_0x3844('0x3d')]=_[_0x3844('0x3c')](_0x5ce1e8[_0x3844('0x38')],qs[_0x3844('0x3e')](_0x538d2b[_0x3844('0x39')][_0x3844('0x3e')]));_0x4c32e2[_0x3844('0x3d')]=_0x4c32e2[_0x3844('0x3d')][_0x3844('0x3f')]?_0x4c32e2[_0x3844('0x3d')]:_0x5ce1e8[_0x3844('0x38')];_0x4c32e2[_0x3844('0x54')]=qs[_0x3844('0x41')](_0x538d2b['query'][_0x3844('0x41')]);_0x4c32e2[_0x3844('0x42')]=qs[_0x3844('0x3b')](_[_0x3844('0x43')](_0x538d2b[_0x3844('0x39')],_0x5ce1e8[_0x3844('0x3b')]));if(_0x538d2b[_0x3844('0x39')][_0x3844('0x44')]){_0x4c32e2[_0x3844('0x42')]=_[_0x3844('0x45')](_0x4c32e2[_0x3844('0x42')],{'$or':_['map'](_0x4c32e2['attributes'],function(_0x118878){var _0x171e9e={};_0x171e9e[_0x118878]={'$like':'%'+_0x538d2b[_0x3844('0x39')][_0x3844('0x44')]+'%'};return _0x171e9e;})});}_0x4c32e2=_[_0x3844('0x45')]({},_0x4c32e2,_0x538d2b[_0x3844('0x47')]);return _0x86169f['getFields'](_0x4c32e2);}})[_0x3844('0x1a')](function(_0x11ddb6){if(_0x11ddb6){_0x166afd=_0x11ddb6[_0x3844('0x3f')];if(!_0x538d2b[_0x3844('0x39')]['hasOwnProperty'](_0x3844('0x40'))){_0x4c32e2[_0x3844('0x29')]=qs['limit'](_0x538d2b[_0x3844('0x39')][_0x3844('0x29')]);_0x4c32e2['offset']=qs['offset'](_0x538d2b[_0x3844('0x39')]['offset']);}return _0x86169f[_0x3844('0x52')](_0x4c32e2);}})['then'](function(_0x918e7f){if(_0x918e7f){return _0x918e7f?{'count':_0x166afd,'rows':_0x918e7f}:null;}})['then'](respondWithResult(_0x5ba770,null))[_0x3844('0x23')](handleError(_0x5ba770,null));};exports['getSubjects']=function(_0xc74f0f,_0x276ffa,_0x17755b){var _0x380d47={};var _0x4f52f5={};var _0x558d96;var _0x29def9;return db[_0x3844('0x48')][_0x3844('0x53')]({'where':{'id':_0xc74f0f[_0x3844('0x4d')]['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x276ffa,null))[_0x3844('0x1a')](function(_0x4a9403){if(_0x4a9403){_0x558d96=_0x4a9403;_0x4f52f5['model']=_[_0x3844('0x3a')](db['VtigerField']['rawAttributes']);_0x4f52f5[_0x3844('0x39')]=_[_0x3844('0x3a')](_0xc74f0f['query']);_0x4f52f5[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x4f52f5[_0x3844('0x38')],_0x4f52f5['query']);_0x380d47['attributes']=_[_0x3844('0x3c')](_0x4f52f5[_0x3844('0x38')],qs[_0x3844('0x3e')](_0xc74f0f['query']['fields']));_0x380d47[_0x3844('0x3d')]=_0x380d47[_0x3844('0x3d')]['length']?_0x380d47[_0x3844('0x3d')]:_0x4f52f5[_0x3844('0x38')];_0x380d47[_0x3844('0x54')]=qs[_0x3844('0x41')](_0xc74f0f[_0x3844('0x39')][_0x3844('0x41')]);_0x380d47['where']=qs['filters'](_['pick'](_0xc74f0f[_0x3844('0x39')],_0x4f52f5[_0x3844('0x3b')]));if(_0xc74f0f['query'][_0x3844('0x44')]){_0x380d47['where']=_[_0x3844('0x45')](_0x380d47['where'],{'$or':_[_0x3844('0x33')](_0x380d47[_0x3844('0x3d')],function(_0x2980ec){var _0x582f02={};_0x582f02[_0x2980ec]={'$like':'%'+_0xc74f0f['query'][_0x3844('0x44')]+'%'};return _0x582f02;})});}_0x380d47=_['merge']({},_0x380d47,_0xc74f0f[_0x3844('0x47')]);return _0x558d96[_0x3844('0x55')](_0x380d47);}})['then'](function(_0x5c6640){if(_0x5c6640){_0x29def9=_0x5c6640['length'];if(!_0xc74f0f['query']['hasOwnProperty'](_0x3844('0x40'))){_0x380d47[_0x3844('0x29')]=qs['limit'](_0xc74f0f[_0x3844('0x39')][_0x3844('0x29')]);_0x380d47[_0x3844('0x28')]=qs[_0x3844('0x28')](_0xc74f0f[_0x3844('0x39')][_0x3844('0x28')]);}return _0x558d96[_0x3844('0x55')](_0x380d47);}})['then'](function(_0xde7c89){if(_0xde7c89){return _0xde7c89?{'count':_0x29def9,'rows':_0xde7c89}:null;}})[_0x3844('0x1a')](respondWithResult(_0x276ffa,null))[_0x3844('0x23')](handleError(_0x276ffa,null));};exports[_0x3844('0x56')]=function(_0x402a7c,_0x205fd5,_0x272c09){var _0x16907f={};var _0x195ed1={};var _0x4d042c;var _0x179f77;return db[_0x3844('0x48')]['findOne']({'where':{'id':_0x402a7c['params']['id']}})[_0x3844('0x1a')](handleEntityNotFound(_0x205fd5,null))[_0x3844('0x1a')](function(_0x3563a2){if(_0x3563a2){_0x4d042c=_0x3563a2;_0x195ed1[_0x3844('0x38')]=_[_0x3844('0x3a')](db['VtigerField'][_0x3844('0x34')]);_0x195ed1[_0x3844('0x39')]=_[_0x3844('0x3a')](_0x402a7c[_0x3844('0x39')]);_0x195ed1[_0x3844('0x3b')]=_[_0x3844('0x3c')](_0x195ed1[_0x3844('0x38')],_0x195ed1['query']);_0x16907f['attributes']=_[_0x3844('0x3c')](_0x195ed1[_0x3844('0x38')],qs['fields'](_0x402a7c[_0x3844('0x39')][_0x3844('0x3e')]));_0x16907f[_0x3844('0x3d')]=_0x16907f['attributes'][_0x3844('0x3f')]?_0x16907f[_0x3844('0x3d')]:_0x195ed1['model'];_0x16907f['order']=qs[_0x3844('0x41')](_0x402a7c['query'][_0x3844('0x41')]);_0x16907f[_0x3844('0x42')]=qs[_0x3844('0x3b')](_[_0x3844('0x43')](_0x402a7c['query'],_0x195ed1[_0x3844('0x3b')]));if(_0x402a7c[_0x3844('0x39')][_0x3844('0x44')]){_0x16907f[_0x3844('0x42')]=_[_0x3844('0x45')](_0x16907f[_0x3844('0x42')],{'$or':_[_0x3844('0x33')](_0x16907f['attributes'],function(_0x129a20){var _0x1057af={};_0x1057af[_0x129a20]={'$like':'%'+_0x402a7c[_0x3844('0x39')][_0x3844('0x44')]+'%'};return _0x1057af;})});}_0x16907f=_['merge']({},_0x16907f,_0x402a7c['options']);return _0x4d042c[_0x3844('0x56')](_0x16907f);}})[_0x3844('0x1a')](function(_0x3993b5){if(_0x3993b5){_0x179f77=_0x3993b5[_0x3844('0x3f')];if(!_0x402a7c['query']['hasOwnProperty'](_0x3844('0x40'))){_0x16907f[_0x3844('0x29')]=qs[_0x3844('0x29')](_0x402a7c[_0x3844('0x39')]['limit']);_0x16907f['offset']=qs[_0x3844('0x28')](_0x402a7c[_0x3844('0x39')]['offset']);}return _0x4d042c[_0x3844('0x56')](_0x16907f);}})[_0x3844('0x1a')](function(_0x42b2d0){if(_0x42b2d0){return _0x42b2d0?{'count':_0x179f77,'rows':_0x42b2d0}:null;}})['then'](respondWithResult(_0x205fd5,null))[_0x3844('0x23')](handleError(_0x205fd5,null));}; \ No newline at end of file +var _0xd25d=['where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','getFields','findOne','VtigerField','intersection','order','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd25d,0x19f));var _0xdd25=function(_0x254f29,_0x20247e){_0x254f29=_0x254f29-0x0;var _0xda409c=_0xd25d[_0x254f29];return _0xda409c;};'use strict';var pdf=require(_0xdd25('0x0'));var emlformat=require(_0xdd25('0x1'));var rimraf=require(_0xdd25('0x2'));var zipdir=require(_0xdd25('0x3'));var jsonpatch=require(_0xdd25('0x4'));var rp=require(_0xdd25('0x5'));var moment=require('moment');var BPromise=require(_0xdd25('0x6'));var Mustache=require(_0xdd25('0x7'));var util=require(_0xdd25('0x8'));var path=require(_0xdd25('0x9'));var sox=require(_0xdd25('0xa'));var csv=require('to-csv');var ejs=require(_0xdd25('0xb'));var fs=require('fs');var _=require(_0xdd25('0xc'));var squel=require('squel');var crypto=require(_0xdd25('0xd'));var jsforce=require(_0xdd25('0xe'));var deskjs=require(_0xdd25('0xf'));var toCsv=require(_0xdd25('0x10'));var querystring=require(_0xdd25('0x11'));var Papa=require(_0xdd25('0x12'));var Redis=require(_0xdd25('0x13'));var authService=require(_0xdd25('0x14'));var qs=require(_0xdd25('0x15'));var as=require(_0xdd25('0x16'));var hardwareService=require(_0xdd25('0x17'));var logger=require(_0xdd25('0x18'))(_0xdd25('0x19'));var utils=require(_0xdd25('0x1a'));var config=require(_0xdd25('0x1b'));var db=require(_0xdd25('0x1c'))['db'];var jayson=require(_0xdd25('0x1d'));var client=jayson[_0xdd25('0x1e')][_0xdd25('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x17893a,_0x2b7038,_0x582c93){if(_0x582c93){var _0x2f37cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f37cb['test'](_0x2b7038)){return _0x17893a;}else{throw new db[(_0xdd25('0x20'))][(_0xdd25('0x21'))](_0xdd25('0x22'));}}else{return _0x17893a;}}function respondWithRpcPromise(_0xed061e,_0x333627,_0x596bd5,_0x1bf2b1){return new BPromise(function(_0x5d31e0,_0x26acaa){var _0x2a2bbc=_0x1bf2b1||client;return _0x2a2bbc[_0xdd25('0x23')](_0xed061e,_0x596bd5)[_0xdd25('0x24')](function(_0x4c0036){logger[_0xdd25('0x25')](_0xdd25('0x26'),_0x333627,_0xdd25('0x27'));logger['debug'](_0xdd25('0x28'),_0x333627,'request\x20sent',JSON[_0xdd25('0x29')](_0x4c0036));if(_0x4c0036[_0xdd25('0x2a')]){if(_0x4c0036['error'][_0xdd25('0x2b')]===0x1f4){logger[_0xdd25('0x2a')](_0xdd25('0x26'),_0x333627,_0x4c0036[_0xdd25('0x2a')][_0xdd25('0x2c')]);return _0x26acaa(_0x4c0036[_0xdd25('0x2a')]['message']);}logger[_0xdd25('0x2a')](_0xdd25('0x26'),_0x333627,_0x4c0036[_0xdd25('0x2a')]['message']);return _0x5d31e0(_0x4c0036[_0xdd25('0x2a')][_0xdd25('0x2c')]);}else{logger[_0xdd25('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0x333627,_0xdd25('0x27'));_0x5d31e0(_0x4c0036[_0xdd25('0x2d')][_0xdd25('0x2c')]);}})[_0xdd25('0x2e')](function(_0xb62447){logger[_0xdd25('0x2a')]('VtigerConfiguration,\x20%s,\x20%s',_0x333627,_0xb62447);_0x26acaa(_0xb62447);});});}function respondWithStatusCode(_0x5af086,_0x3fd611){_0x3fd611=_0x3fd611||0xcc;return function(_0x4a980c){if(_0x4a980c){return _0x5af086[_0xdd25('0x2f')](_0x3fd611);}return _0x5af086[_0xdd25('0x30')](_0x3fd611)[_0xdd25('0x31')]();};}function respondWithResult(_0x1866cb,_0x16709a){_0x16709a=_0x16709a||0xc8;return function(_0x1b17af){if(_0x1b17af){return _0x1866cb[_0xdd25('0x30')](_0x16709a)['json'](_0x1b17af);}};}function respondWithFilteredResult(_0x2402c0,_0x3bd0b4){return function(_0x58dafd){if(_0x58dafd){var _0x4a3298=_0x58dafd[_0xdd25('0x32')],_0x3be342=_0x3bd0b4[_0xdd25('0x33')],_0x28edcf=_0x3bd0b4[_0xdd25('0x33')]+_0x3bd0b4[_0xdd25('0x34')],_0x19dc18;if(_0x28edcf>=_0x4a3298){_0x28edcf=_0x4a3298;_0x19dc18=0xc8;}else{_0x19dc18=0xce;}_0x2402c0['status'](_0x19dc18);return _0x2402c0[_0xdd25('0x35')](_0xdd25('0x36'),_0x3be342+'-'+_0x28edcf+'/'+_0x4a3298)['json'](_0x58dafd);}return null;};}function patchUpdates(_0x2a0e17){return function(_0x37312e){try{jsonpatch[_0xdd25('0x37')](_0x37312e,_0x2a0e17,!![]);}catch(_0x281b91){return BPromise[_0xdd25('0x38')](_0x281b91);}return _0x37312e['save']();};}function saveUpdates(_0x124567,_0x54ee56){return function(_0x349ada){if(_0x349ada){return _0x349ada[_0xdd25('0x39')](_0x124567)['then'](function(_0x2a9382){return _0x2a9382;});}return null;};}function removeEntity(_0x1985fa,_0x266569){return function(_0x195c25){if(_0x195c25){return _0x195c25['destroy']()[_0xdd25('0x24')](function(){_0x1985fa[_0xdd25('0x30')](0xcc)[_0xdd25('0x31')]();});}};}function handleEntityNotFound(_0x3759d0,_0x485605){return function(_0x1e83b6){if(!_0x1e83b6){_0x3759d0[_0xdd25('0x2f')](0x194);}return _0x1e83b6;};}function handleError(_0x23ac1b,_0x1f5825){_0x1f5825=_0x1f5825||0x1f4;return function(_0x7e995f){logger[_0xdd25('0x2a')](_0x7e995f[_0xdd25('0x3a')]);if(_0x7e995f[_0xdd25('0x3b')]){delete _0x7e995f[_0xdd25('0x3b')];}_0x23ac1b[_0xdd25('0x30')](_0x1f5825)['send'](_0x7e995f);};}exports[_0xdd25('0x3c')]=function(_0x9967be,_0x103a6e){var _0x1f5e6={},_0x255504={},_0x4ece25={'count':0x0,'rows':[]};var _0x523e20=_[_0xdd25('0x3d')](db[_0xdd25('0x3e')][_0xdd25('0x3f')],function(_0x75cab){return{'name':_0x75cab[_0xdd25('0x40')],'type':_0x75cab[_0xdd25('0x41')][_0xdd25('0x42')]};});_0x255504[_0xdd25('0x43')]=_[_0xdd25('0x3d')](_0x523e20,_0xdd25('0x3b'));_0x255504[_0xdd25('0x44')]=_['keys'](_0x9967be[_0xdd25('0x44')]);_0x255504['filters']=_['intersection'](_0x255504['model'],_0x255504[_0xdd25('0x44')]);_0x1f5e6[_0xdd25('0x45')]=_['intersection'](_0x255504[_0xdd25('0x43')],qs[_0xdd25('0x46')](_0x9967be[_0xdd25('0x44')][_0xdd25('0x46')]));_0x1f5e6['attributes']=_0x1f5e6[_0xdd25('0x45')][_0xdd25('0x47')]?_0x1f5e6[_0xdd25('0x45')]:_0x255504[_0xdd25('0x43')];if(!_0x9967be[_0xdd25('0x44')][_0xdd25('0x48')](_0xdd25('0x49'))){_0x1f5e6[_0xdd25('0x34')]=qs[_0xdd25('0x34')](_0x9967be[_0xdd25('0x44')]['limit']);_0x1f5e6[_0xdd25('0x33')]=qs[_0xdd25('0x33')](_0x9967be[_0xdd25('0x44')][_0xdd25('0x33')]);}_0x1f5e6['order']=qs[_0xdd25('0x4a')](_0x9967be[_0xdd25('0x44')][_0xdd25('0x4a')]);_0x1f5e6[_0xdd25('0x4b')]=qs[_0xdd25('0x4c')](_['pick'](_0x9967be['query'],_0x255504[_0xdd25('0x4c')]),_0x523e20);if(_0x9967be[_0xdd25('0x44')][_0xdd25('0x4d')]){_0x1f5e6[_0xdd25('0x4b')]=_['merge'](_0x1f5e6[_0xdd25('0x4b')],{'$or':_[_0xdd25('0x3d')](_0x523e20,function(_0x1bf0b9){if(_0x1bf0b9[_0xdd25('0x41')]!==_0xdd25('0x4e')){var _0x4a824e={};_0x4a824e[_0x1bf0b9[_0xdd25('0x3b')]]={'$like':'%'+_0x9967be[_0xdd25('0x44')][_0xdd25('0x4d')]+'%'};return _0x4a824e;}})});}_0x1f5e6=_[_0xdd25('0x4f')]({},_0x1f5e6,_0x9967be[_0xdd25('0x50')]);var _0x255192={'where':_0x1f5e6[_0xdd25('0x4b')]};return db[_0xdd25('0x3e')][_0xdd25('0x32')](_0x255192)[_0xdd25('0x24')](function(_0x265257){_0x4ece25[_0xdd25('0x32')]=_0x265257;if(_0x9967be[_0xdd25('0x44')][_0xdd25('0x51')]){_0x1f5e6[_0xdd25('0x52')]=[{'all':!![]}];}return db[_0xdd25('0x3e')][_0xdd25('0x53')](_0x1f5e6);})[_0xdd25('0x24')](function(_0x56d6d5){_0x4ece25[_0xdd25('0x54')]=_0x56d6d5;return _0x4ece25;})['then'](respondWithFilteredResult(_0x103a6e,_0x1f5e6))[_0xdd25('0x2e')](handleError(_0x103a6e,null));};exports['show']=function(_0x4b83de,_0x359e20){var _0x1aaa1c={'raw':![],'where':{'id':_0x4b83de[_0xdd25('0x55')]['id']}},_0x3d343c={};_0x3d343c[_0xdd25('0x43')]=_[_0xdd25('0x56')](db[_0xdd25('0x3e')][_0xdd25('0x3f')]);_0x3d343c['query']=_['keys'](_0x4b83de[_0xdd25('0x44')]);_0x3d343c[_0xdd25('0x4c')]=_['intersection'](_0x3d343c[_0xdd25('0x43')],_0x3d343c[_0xdd25('0x44')]);_0x1aaa1c['attributes']=_['intersection'](_0x3d343c['model'],qs[_0xdd25('0x46')](_0x4b83de[_0xdd25('0x44')][_0xdd25('0x46')]));_0x1aaa1c[_0xdd25('0x45')]=_0x1aaa1c[_0xdd25('0x45')]['length']?_0x1aaa1c['attributes']:_0x3d343c[_0xdd25('0x43')];if(_0x4b83de[_0xdd25('0x44')][_0xdd25('0x51')]){_0x1aaa1c[_0xdd25('0x52')]=[{'all':!![]}];}_0x1aaa1c=_['merge']({},_0x1aaa1c,_0x4b83de[_0xdd25('0x50')]);return db[_0xdd25('0x3e')][_0xdd25('0x57')](_0x1aaa1c)[_0xdd25('0x24')](handleEntityNotFound(_0x359e20,null))[_0xdd25('0x24')](respondWithResult(_0x359e20,null))[_0xdd25('0x2e')](handleError(_0x359e20,null));};exports[_0xdd25('0x58')]=function(_0x54d443,_0x40305b){return db[_0xdd25('0x3e')][_0xdd25('0x58')](_0x54d443['body'],{})[_0xdd25('0x24')](respondWithResult(_0x40305b,0xc9))[_0xdd25('0x2e')](handleError(_0x40305b,null));};exports[_0xdd25('0x39')]=function(_0x29bd81,_0x157fa7){if(_0x29bd81['body']['id']){delete _0x29bd81[_0xdd25('0x59')]['id'];}return db[_0xdd25('0x3e')][_0xdd25('0x57')]({'where':{'id':_0x29bd81['params']['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x157fa7,null))['then'](saveUpdates(_0x29bd81[_0xdd25('0x59')],null))[_0xdd25('0x24')](respondWithResult(_0x157fa7,null))[_0xdd25('0x2e')](handleError(_0x157fa7,null));};exports['destroy']=function(_0x554865,_0x26e3a1){return db[_0xdd25('0x3e')]['find']({'where':{'id':_0x554865['params']['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x26e3a1,null))[_0xdd25('0x24')](removeEntity(_0x26e3a1,null))[_0xdd25('0x2e')](handleError(_0x26e3a1,null));};exports[_0xdd25('0x5a')]=function(_0x67613a,_0x84407b,_0x24c126){var _0x2970df={};var _0x456f84={};var _0x20cb2a;var _0x40e136;return db['VtigerConfiguration'][_0xdd25('0x5b')]({'where':{'id':_0x67613a[_0xdd25('0x55')]['id']}})['then'](handleEntityNotFound(_0x84407b,null))[_0xdd25('0x24')](function(_0x536597){if(_0x536597){_0x20cb2a=_0x536597;_0x456f84[_0xdd25('0x43')]=_[_0xdd25('0x56')](db[_0xdd25('0x5c')]['rawAttributes']);_0x456f84[_0xdd25('0x44')]=_[_0xdd25('0x56')](_0x67613a[_0xdd25('0x44')]);_0x456f84[_0xdd25('0x4c')]=_[_0xdd25('0x5d')](_0x456f84[_0xdd25('0x43')],_0x456f84[_0xdd25('0x44')]);_0x2970df[_0xdd25('0x45')]=_[_0xdd25('0x5d')](_0x456f84['model'],qs[_0xdd25('0x46')](_0x67613a[_0xdd25('0x44')]['fields']));_0x2970df[_0xdd25('0x45')]=_0x2970df[_0xdd25('0x45')][_0xdd25('0x47')]?_0x2970df[_0xdd25('0x45')]:_0x456f84[_0xdd25('0x43')];_0x2970df[_0xdd25('0x5e')]=qs[_0xdd25('0x4a')](_0x67613a['query'][_0xdd25('0x4a')]);_0x2970df[_0xdd25('0x4b')]=qs[_0xdd25('0x4c')](_['pick'](_0x67613a['query'],_0x456f84['filters']));if(_0x67613a['query'][_0xdd25('0x4d')]){_0x2970df[_0xdd25('0x4b')]=_[_0xdd25('0x4f')](_0x2970df['where'],{'$or':_[_0xdd25('0x3d')](_0x2970df[_0xdd25('0x45')],function(_0x33bfc3){var _0x20c5d5={};_0x20c5d5[_0x33bfc3]={'$like':'%'+_0x67613a[_0xdd25('0x44')][_0xdd25('0x4d')]+'%'};return _0x20c5d5;})});}_0x2970df=_[_0xdd25('0x4f')]({},_0x2970df,_0x67613a[_0xdd25('0x50')]);return _0x20cb2a[_0xdd25('0x5a')](_0x2970df);}})['then'](function(_0x2a1254){if(_0x2a1254){_0x40e136=_0x2a1254[_0xdd25('0x47')];if(!_0x67613a[_0xdd25('0x44')][_0xdd25('0x48')](_0xdd25('0x49'))){_0x2970df['limit']=qs[_0xdd25('0x34')](_0x67613a['query'][_0xdd25('0x34')]);_0x2970df[_0xdd25('0x33')]=qs['offset'](_0x67613a['query']['offset']);}return _0x20cb2a['getFields'](_0x2970df);}})[_0xdd25('0x24')](function(_0x42552a){if(_0x42552a){return _0x42552a?{'count':_0x40e136,'rows':_0x42552a}:null;}})[_0xdd25('0x24')](respondWithResult(_0x84407b,null))['catch'](handleError(_0x84407b,null));};exports['getSubjects']=function(_0x64ae10,_0x3b066b,_0x7aab9e){var _0x271e38={};var _0xfc687b={};var _0x1b99d1;var _0x10a071;return db[_0xdd25('0x3e')]['findOne']({'where':{'id':_0x64ae10['params']['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x3b066b,null))[_0xdd25('0x24')](function(_0x3dca46){if(_0x3dca46){_0x1b99d1=_0x3dca46;_0xfc687b[_0xdd25('0x43')]=_['keys'](db[_0xdd25('0x5c')][_0xdd25('0x3f')]);_0xfc687b[_0xdd25('0x44')]=_[_0xdd25('0x56')](_0x64ae10[_0xdd25('0x44')]);_0xfc687b[_0xdd25('0x4c')]=_['intersection'](_0xfc687b[_0xdd25('0x43')],_0xfc687b['query']);_0x271e38[_0xdd25('0x45')]=_[_0xdd25('0x5d')](_0xfc687b[_0xdd25('0x43')],qs[_0xdd25('0x46')](_0x64ae10[_0xdd25('0x44')][_0xdd25('0x46')]));_0x271e38[_0xdd25('0x45')]=_0x271e38[_0xdd25('0x45')][_0xdd25('0x47')]?_0x271e38[_0xdd25('0x45')]:_0xfc687b[_0xdd25('0x43')];_0x271e38[_0xdd25('0x5e')]=qs['sort'](_0x64ae10[_0xdd25('0x44')][_0xdd25('0x4a')]);_0x271e38[_0xdd25('0x4b')]=qs['filters'](_[_0xdd25('0x5f')](_0x64ae10['query'],_0xfc687b[_0xdd25('0x4c')]));if(_0x64ae10['query'][_0xdd25('0x4d')]){_0x271e38['where']=_[_0xdd25('0x4f')](_0x271e38[_0xdd25('0x4b')],{'$or':_[_0xdd25('0x3d')](_0x271e38[_0xdd25('0x45')],function(_0x40c38c){var _0x1b953b={};_0x1b953b[_0x40c38c]={'$like':'%'+_0x64ae10[_0xdd25('0x44')][_0xdd25('0x4d')]+'%'};return _0x1b953b;})});}_0x271e38=_['merge']({},_0x271e38,_0x64ae10[_0xdd25('0x50')]);return _0x1b99d1[_0xdd25('0x60')](_0x271e38);}})[_0xdd25('0x24')](function(_0x309079){if(_0x309079){_0x10a071=_0x309079[_0xdd25('0x47')];if(!_0x64ae10['query']['hasOwnProperty'](_0xdd25('0x49'))){_0x271e38['limit']=qs[_0xdd25('0x34')](_0x64ae10[_0xdd25('0x44')]['limit']);_0x271e38[_0xdd25('0x33')]=qs[_0xdd25('0x33')](_0x64ae10[_0xdd25('0x44')][_0xdd25('0x33')]);}return _0x1b99d1['getSubjects'](_0x271e38);}})[_0xdd25('0x24')](function(_0x39a06b){if(_0x39a06b){return _0x39a06b?{'count':_0x10a071,'rows':_0x39a06b}:null;}})[_0xdd25('0x24')](respondWithResult(_0x3b066b,null))[_0xdd25('0x2e')](handleError(_0x3b066b,null));};exports['getDescriptions']=function(_0x189087,_0x1a2973,_0x135868){var _0x245f5e={};var _0xaa5504={};var _0x10d7d5;var _0x5db13b;return db[_0xdd25('0x3e')]['findOne']({'where':{'id':_0x189087[_0xdd25('0x55')]['id']}})[_0xdd25('0x24')](handleEntityNotFound(_0x1a2973,null))[_0xdd25('0x24')](function(_0x46913f){if(_0x46913f){_0x10d7d5=_0x46913f;_0xaa5504[_0xdd25('0x43')]=_[_0xdd25('0x56')](db[_0xdd25('0x5c')]['rawAttributes']);_0xaa5504['query']=_[_0xdd25('0x56')](_0x189087[_0xdd25('0x44')]);_0xaa5504[_0xdd25('0x4c')]=_['intersection'](_0xaa5504['model'],_0xaa5504['query']);_0x245f5e[_0xdd25('0x45')]=_[_0xdd25('0x5d')](_0xaa5504[_0xdd25('0x43')],qs[_0xdd25('0x46')](_0x189087[_0xdd25('0x44')][_0xdd25('0x46')]));_0x245f5e[_0xdd25('0x45')]=_0x245f5e['attributes'][_0xdd25('0x47')]?_0x245f5e[_0xdd25('0x45')]:_0xaa5504[_0xdd25('0x43')];_0x245f5e[_0xdd25('0x5e')]=qs['sort'](_0x189087[_0xdd25('0x44')]['sort']);_0x245f5e[_0xdd25('0x4b')]=qs[_0xdd25('0x4c')](_[_0xdd25('0x5f')](_0x189087[_0xdd25('0x44')],_0xaa5504[_0xdd25('0x4c')]));if(_0x189087[_0xdd25('0x44')][_0xdd25('0x4d')]){_0x245f5e[_0xdd25('0x4b')]=_[_0xdd25('0x4f')](_0x245f5e[_0xdd25('0x4b')],{'$or':_[_0xdd25('0x3d')](_0x245f5e['attributes'],function(_0xfeb076){var _0x268e09={};_0x268e09[_0xfeb076]={'$like':'%'+_0x189087['query']['filter']+'%'};return _0x268e09;})});}_0x245f5e=_['merge']({},_0x245f5e,_0x189087[_0xdd25('0x50')]);return _0x10d7d5[_0xdd25('0x61')](_0x245f5e);}})[_0xdd25('0x24')](function(_0x4d11c7){if(_0x4d11c7){_0x5db13b=_0x4d11c7['length'];if(!_0x189087[_0xdd25('0x44')][_0xdd25('0x48')](_0xdd25('0x49'))){_0x245f5e[_0xdd25('0x34')]=qs['limit'](_0x189087[_0xdd25('0x44')][_0xdd25('0x34')]);_0x245f5e[_0xdd25('0x33')]=qs[_0xdd25('0x33')](_0x189087[_0xdd25('0x44')][_0xdd25('0x33')]);}return _0x10d7d5[_0xdd25('0x61')](_0x245f5e);}})[_0xdd25('0x24')](function(_0x371095){if(_0x371095){return _0x371095?{'count':_0x5db13b,'rows':_0x371095}:null;}})['then'](respondWithResult(_0x1a2973,null))[_0xdd25('0x2e')](handleError(_0x1a2973,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c92ef98..9258089 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 _0x8da7=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x4f3f68,_0x1ddcfe){var _0x5d157b=function(_0x1a0438){while(--_0x1a0438){_0x4f3f68['push'](_0x4f3f68['shift']());}};_0x5d157b(++_0x1ddcfe);}(_0x8da7,0xba));var _0x78da=function(_0x2abd63,_0x18f09d){_0x2abd63=_0x2abd63-0x0;var _0x35568c=_0x8da7[_0x2abd63];return _0x35568c;};'use strict';var _=require(_0x78da('0x0'));var util=require(_0x78da('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x78da('0x2'));var BPromise=require(_0x78da('0x3'));var rp=require(_0x78da('0x4'));var fs=require('fs');var path=require(_0x78da('0x5'));var rimraf=require(_0x78da('0x6'));var config=require(_0x78da('0x7'));var attributes=require(_0x78da('0x8'));module[_0x78da('0x9')]=function(_0x5c5fcc,_0x1fb4b0){return _0x5c5fcc[_0x78da('0xa')](_0x78da('0xb'),attributes,{'tableName':_0x78da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdddf=['path','../../config/environment','./intVtigerConfiguration.attributes','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x17d69e,_0x27717d){var _0x4b153f=function(_0x542e11){while(--_0x542e11){_0x17d69e['push'](_0x17d69e['shift']());}};_0x4b153f(++_0x27717d);}(_0xdddf,0xf6));var _0xfddd=function(_0x15e4c6,_0x5b2648){_0x15e4c6=_0x15e4c6-0x0;var _0x2e42bc=_0xdddf[_0x15e4c6];return _0x2e42bc;};'use strict';var _=require(_0xfddd('0x0'));var util=require(_0xfddd('0x1'));var logger=require(_0xfddd('0x2'))(_0xfddd('0x3'));var moment=require(_0xfddd('0x4'));var BPromise=require(_0xfddd('0x5'));var rp=require(_0xfddd('0x6'));var fs=require('fs');var path=require(_0xfddd('0x7'));var rimraf=require('rimraf');var config=require(_0xfddd('0x8'));var attributes=require(_0xfddd('0x9'));module['exports']=function(_0x393e44,_0x5c81e2){return _0x393e44['define']('VtigerConfiguration',attributes,{'tableName':_0xfddd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 538ab3b..396c7ac 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 _0xea8f=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then'];(function(_0x299818,_0xc31e75){var _0x10aad3=function(_0x158dac){while(--_0x158dac){_0x299818['push'](_0x299818['shift']());}};_0x10aad3(++_0xc31e75);}(_0xea8f,0x171));var _0xfea8=function(_0x4b4931,_0x133090){_0x4b4931=_0x4b4931-0x0;var _0x295a54=_0xea8f[_0x4b4931];return _0x295a54;};'use strict';var _=require(_0xfea8('0x0'));var util=require('util');var moment=require(_0xfea8('0x1'));var BPromise=require(_0xfea8('0x2'));var rs=require(_0xfea8('0x3'));var fs=require('fs');var Redis=require(_0xfea8('0x4'));var db=require(_0xfea8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfea8('0x6'))(_0xfea8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfea8('0x8')][_0xfea8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc2a7,_0xbc750d,_0x29bc5e){return new BPromise(function(_0x30caf6,_0x4c82a2){return client['request'](_0x1fc2a7,_0x29bc5e)[_0xfea8('0xa')](function(_0x4ba64e){logger[_0xfea8('0xb')](_0xfea8('0xc'),_0xbc750d,_0xfea8('0xd'));logger['debug'](_0xfea8('0xe'),_0xbc750d,'request\x20sent',JSON[_0xfea8('0xf')](_0x4ba64e));if(_0x4ba64e[_0xfea8('0x10')]){if(_0x4ba64e[_0xfea8('0x10')]['code']===0x1f4){logger[_0xfea8('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xbc750d,_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);return _0x4c82a2(_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);}logger['error'](_0xfea8('0xc'),_0xbc750d,_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);return _0x30caf6(_0x4ba64e[_0xfea8('0x10')][_0xfea8('0x11')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xbc750d,'request\x20sent');_0x30caf6(_0x4ba64e[_0xfea8('0x12')][_0xfea8('0x11')]);}})['catch'](function(_0x1cd130){logger[_0xfea8('0x10')](_0xfea8('0xc'),_0xbc750d,_0x1cd130);_0x4c82a2(_0x1cd130);});});} \ No newline at end of file +var _0x7f8b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3c67f3,_0x5a6706){var _0x2c2233=function(_0x2294c0){while(--_0x2294c0){_0x3c67f3['push'](_0x3c67f3['shift']());}};_0x2c2233(++_0x5a6706);}(_0x7f8b,0x1f2));var _0xb7f8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f8b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xb7f8('0x0'));var moment=require(_0xb7f8('0x1'));var BPromise=require(_0xb7f8('0x2'));var rs=require(_0xb7f8('0x3'));var fs=require('fs');var Redis=require(_0xb7f8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7f8('0x5'));var logger=require(_0xb7f8('0x6'))(_0xb7f8('0x7'));var config=require(_0xb7f8('0x8'));var jayson=require(_0xb7f8('0x9'));var client=jayson[_0xb7f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6b075d,_0x170488,_0x63655b){return new BPromise(function(_0x139a8d,_0x130f77){return client['request'](_0x6b075d,_0x63655b)[_0xb7f8('0xb')](function(_0x1003ad){logger[_0xb7f8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x170488,'request\x20sent');logger['debug'](_0xb7f8('0xd'),_0x170488,'request\x20sent',JSON['stringify'](_0x1003ad));if(_0x1003ad[_0xb7f8('0xe')]){if(_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0xf')]===0x1f4){logger[_0xb7f8('0xe')](_0xb7f8('0x10'),_0x170488,_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0x11')]);return _0x130f77(_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0x11')]);}logger[_0xb7f8('0xe')](_0xb7f8('0x10'),_0x170488,_0x1003ad['error'][_0xb7f8('0x11')]);return _0x139a8d(_0x1003ad[_0xb7f8('0xe')][_0xb7f8('0x11')]);}else{logger[_0xb7f8('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x170488,_0xb7f8('0x12'));_0x139a8d(_0x1003ad[_0xb7f8('0x13')]['message']);}})[_0xb7f8('0x14')](function(_0xc11863){logger[_0xb7f8('0xe')](_0xb7f8('0x10'),_0x170488,_0xc11863);_0x130f77(_0xc11863);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 119323c..9e87144 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 _0x84e5=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x49bf38,_0x42c116){var _0xb76377=function(_0x4284b4){while(--_0x4284b4){_0x49bf38['push'](_0x49bf38['shift']());}};_0xb76377(++_0x42c116);}(_0x84e5,0xc4));var _0x584e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x84e5[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x584e('0x0'));var util=require(_0x584e('0x1'));var path=require(_0x584e('0x2'));var timeout=require('connect-timeout');var express=require(_0x584e('0x3'));var router=express[_0x584e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x584e('0x5'));var config=require(_0x584e('0x6'));var controller=require(_0x584e('0x7'));router['get']('/',auth[_0x584e('0x8')](),controller['index']);router['get']('/:id',auth[_0x584e('0x8')](),controller[_0x584e('0x9')]);router[_0x584e('0xa')]('/',auth['isAuthenticated'](),controller[_0x584e('0xb')]);router[_0x584e('0xc')](_0x584e('0xd'),auth[_0x584e('0x8')](),controller[_0x584e('0xe')]);router[_0x584e('0xf')](_0x584e('0xd'),auth[_0x584e('0x8')](),controller[_0x584e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4e6b=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x507d76,_0xaf77ff){var _0x48e2e8=function(_0x1b33f5){while(--_0x1b33f5){_0x507d76['push'](_0x507d76['shift']());}};_0x48e2e8(++_0xaf77ff);}(_0x4e6b,0xbb));var _0xb4e6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4e6b[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var path=require(_0xb4e6('0x2'));var timeout=require(_0xb4e6('0x3'));var express=require(_0xb4e6('0x4'));var router=express[_0xb4e6('0x5')]();var auth=require(_0xb4e6('0x6'));var interaction=require(_0xb4e6('0x7'));var config=require(_0xb4e6('0x8'));var controller=require(_0xb4e6('0x9'));router[_0xb4e6('0xa')]('/',auth[_0xb4e6('0xb')](),controller[_0xb4e6('0xc')]);router[_0xb4e6('0xa')](_0xb4e6('0xd'),auth[_0xb4e6('0xb')](),controller[_0xb4e6('0xe')]);router[_0xb4e6('0xf')]('/',auth[_0xb4e6('0xb')](),controller[_0xb4e6('0x10')]);router[_0xb4e6('0x11')]('/:id',auth[_0xb4e6('0xb')](),controller[_0xb4e6('0x12')]);router[_0xb4e6('0x13')](_0xb4e6('0xd'),auth[_0xb4e6('0xb')](),controller[_0xb4e6('0x14')]);module[_0xb4e6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 659b3a3..74a5438 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 _0x4d33=['keyValue','STRING','ENUM','variable','BOOLEAN','exports','string'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4d33,0x1cc));var _0x34d3=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x4d33[_0x16bb4b];return _0x8aeb84;};'use strict';var Sequelize=require('sequelize');module[_0x34d3('0x0')]={'type':{'type':Sequelize['ENUM'](_0x34d3('0x1'),'variable','customVariable',_0x34d3('0x2')),'defaultValue':_0x34d3('0x1')},'content':{'type':Sequelize[_0x34d3('0x3')]},'key':{'type':Sequelize[_0x34d3('0x3')]},'keyType':{'type':Sequelize[_0x34d3('0x4')](_0x34d3('0x1'),_0x34d3('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x34d3('0x3')]},'idField':{'type':Sequelize[_0x34d3('0x3')]},'nameField':{'type':Sequelize[_0x34d3('0x3')]},'customField':{'type':Sequelize[_0x34d3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6453=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x5bbdfc,_0xb09d1a){var _0x76076c=function(_0x18ca3a){while(--_0x18ca3a){_0x5bbdfc['push'](_0x5bbdfc['shift']());}};_0x76076c(++_0xb09d1a);}(_0x6453,0x88));var _0x3645=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x6453[_0x1f7413];return _0x2d2775;};'use strict';var Sequelize=require(_0x3645('0x0'));module[_0x3645('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3645('0x2'),_0x3645('0x3'),_0x3645('0x4'),_0x3645('0x5')),'defaultValue':_0x3645('0x2')},'content':{'type':Sequelize[_0x3645('0x6')]},'key':{'type':Sequelize[_0x3645('0x6')]},'keyType':{'type':Sequelize[_0x3645('0x7')](_0x3645('0x2'),_0x3645('0x3'),_0x3645('0x4'))},'keyContent':{'type':Sequelize[_0x3645('0x6')]},'idField':{'type':Sequelize[_0x3645('0x6')]},'nameField':{'type':Sequelize[_0x3645('0x6')]},'customField':{'type':Sequelize[_0x3645('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3645('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 132ffe0..e3c20c0 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 _0xbcc3=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbcc3,0x86));var _0x3bcc=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0xbcc3[_0x43026b];return _0x4a96cd;};'use strict';var pdf=require(_0x3bcc('0x0'));var emlformat=require(_0x3bcc('0x1'));var rimraf=require(_0x3bcc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bcc('0x3'));var rp=require(_0x3bcc('0x4'));var moment=require('moment');var BPromise=require(_0x3bcc('0x5'));var Mustache=require(_0x3bcc('0x6'));var util=require(_0x3bcc('0x7'));var path=require(_0x3bcc('0x8'));var sox=require(_0x3bcc('0x9'));var csv=require(_0x3bcc('0xa'));var ejs=require(_0x3bcc('0xb'));var fs=require('fs');var _=require(_0x3bcc('0xc'));var squel=require(_0x3bcc('0xd'));var crypto=require('crypto');var jsforce=require(_0x3bcc('0xe'));var deskjs=require(_0x3bcc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3bcc('0x10'));var Papa=require(_0x3bcc('0x11'));var Redis=require(_0x3bcc('0x12'));var authService=require(_0x3bcc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3bcc('0x14'));var hardwareService=require(_0x3bcc('0x15'));var logger=require(_0x3bcc('0x16'))(_0x3bcc('0x17'));var utils=require(_0x3bcc('0x18'));var config=require('../../config/environment');var db=require(_0x3bcc('0x19'))['db'];function respondWithStatusCode(_0x39a685,_0x1a476f){_0x1a476f=_0x1a476f||0xcc;return function(_0x5474ee){if(_0x5474ee){return _0x39a685[_0x3bcc('0x1a')](_0x1a476f);}return _0x39a685[_0x3bcc('0x1b')](_0x1a476f)[_0x3bcc('0x1c')]();};}function respondWithResult(_0x442b08,_0x525bc6){_0x525bc6=_0x525bc6||0xc8;return function(_0x396e29){if(_0x396e29){return _0x442b08[_0x3bcc('0x1b')](_0x525bc6)[_0x3bcc('0x1d')](_0x396e29);}};}function respondWithFilteredResult(_0x54fe83,_0x5291f8){return function(_0x5f04d1){if(_0x5f04d1){var _0x507859=_0x5f04d1[_0x3bcc('0x1e')],_0x213f15=_0x5291f8['offset'],_0x33e5c5=_0x5291f8[_0x3bcc('0x1f')]+_0x5291f8[_0x3bcc('0x20')],_0x16681e;if(_0x33e5c5>=_0x507859){_0x33e5c5=_0x507859;_0x16681e=0xc8;}else{_0x16681e=0xce;}_0x54fe83[_0x3bcc('0x1b')](_0x16681e);return _0x54fe83['set']('Content-Range',_0x213f15+'-'+_0x33e5c5+'/'+_0x507859)[_0x3bcc('0x1d')](_0x5f04d1);}return null;};}function patchUpdates(_0x3d69da){return function(_0x60957a){try{jsonpatch['apply'](_0x60957a,_0x3d69da,!![]);}catch(_0x505b85){return BPromise['reject'](_0x505b85);}return _0x60957a[_0x3bcc('0x21')]();};}function saveUpdates(_0x26fce1,_0x1b3f1a){return function(_0x15f93a){if(_0x15f93a){return _0x15f93a[_0x3bcc('0x22')](_0x26fce1)[_0x3bcc('0x23')](function(_0x16fbd1){return _0x16fbd1;});}return null;};}function removeEntity(_0x9c25bc,_0x47f3ae){return function(_0x1529f3){if(_0x1529f3){return _0x1529f3[_0x3bcc('0x24')]()['then'](function(){_0x9c25bc[_0x3bcc('0x1b')](0xcc)[_0x3bcc('0x1c')]();});}};}function handleEntityNotFound(_0x1a0723,_0x43beca){return function(_0x187401){if(!_0x187401){_0x1a0723[_0x3bcc('0x1a')](0x194);}return _0x187401;};}function handleError(_0x22298b,_0x2a428b){_0x2a428b=_0x2a428b||0x1f4;return function(_0x2ddb22){logger[_0x3bcc('0x25')](_0x2ddb22[_0x3bcc('0x26')]);if(_0x2ddb22[_0x3bcc('0x27')]){delete _0x2ddb22['name'];}_0x22298b['status'](_0x2a428b)[_0x3bcc('0x28')](_0x2ddb22);};}exports['index']=function(_0x51a492,_0x55fe5a){var _0x2af150={},_0xce4e3b={},_0x5ebbe4={'count':0x0,'rows':[]};var _0x22006c=_[_0x3bcc('0x29')](db[_0x3bcc('0x2a')][_0x3bcc('0x2b')],function(_0xe10252){return{'name':_0xe10252[_0x3bcc('0x2c')],'type':_0xe10252['type'][_0x3bcc('0x2d')]};});_0xce4e3b[_0x3bcc('0x2e')]=_['map'](_0x22006c,'name');_0xce4e3b[_0x3bcc('0x2f')]=_[_0x3bcc('0x30')](_0x51a492[_0x3bcc('0x2f')]);_0xce4e3b[_0x3bcc('0x31')]=_[_0x3bcc('0x32')](_0xce4e3b[_0x3bcc('0x2e')],_0xce4e3b[_0x3bcc('0x2f')]);_0x2af150[_0x3bcc('0x33')]=_[_0x3bcc('0x32')](_0xce4e3b[_0x3bcc('0x2e')],qs[_0x3bcc('0x34')](_0x51a492[_0x3bcc('0x2f')]['fields']));_0x2af150[_0x3bcc('0x33')]=_0x2af150[_0x3bcc('0x33')][_0x3bcc('0x35')]?_0x2af150[_0x3bcc('0x33')]:_0xce4e3b[_0x3bcc('0x2e')];if(!_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x36')](_0x3bcc('0x37'))){_0x2af150[_0x3bcc('0x20')]=qs[_0x3bcc('0x20')](_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x20')]);_0x2af150[_0x3bcc('0x1f')]=qs['offset'](_0x51a492['query'][_0x3bcc('0x1f')]);}_0x2af150[_0x3bcc('0x38')]=qs[_0x3bcc('0x39')](_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x39')]);_0x2af150[_0x3bcc('0x3a')]=qs[_0x3bcc('0x31')](_['pick'](_0x51a492[_0x3bcc('0x2f')],_0xce4e3b[_0x3bcc('0x31')]),_0x22006c);if(_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x3b')]){_0x2af150[_0x3bcc('0x3a')]=_[_0x3bcc('0x3c')](_0x2af150[_0x3bcc('0x3a')],{'$or':_[_0x3bcc('0x29')](_0x22006c,function(_0x11789b){if(_0x11789b['type']!==_0x3bcc('0x3d')){var _0x74af1e={};_0x74af1e[_0x11789b[_0x3bcc('0x27')]]={'$like':'%'+_0x51a492[_0x3bcc('0x2f')][_0x3bcc('0x3b')]+'%'};return _0x74af1e;}})});}_0x2af150=_[_0x3bcc('0x3c')]({},_0x2af150,_0x51a492[_0x3bcc('0x3e')]);var _0x1ca79b={'where':_0x2af150['where']};return db[_0x3bcc('0x2a')][_0x3bcc('0x1e')](_0x1ca79b)[_0x3bcc('0x23')](function(_0x3e61b3){_0x5ebbe4[_0x3bcc('0x1e')]=_0x3e61b3;if(_0x51a492[_0x3bcc('0x2f')]['includeAll']){_0x2af150[_0x3bcc('0x3f')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x2af150);})[_0x3bcc('0x23')](function(_0x3e4e37){_0x5ebbe4[_0x3bcc('0x40')]=_0x3e4e37;return _0x5ebbe4;})[_0x3bcc('0x23')](respondWithFilteredResult(_0x55fe5a,_0x2af150))[_0x3bcc('0x41')](handleError(_0x55fe5a,null));};exports[_0x3bcc('0x42')]=function(_0x2ed8bf,_0x5efcb7){var _0x5a5c23={'raw':!![],'where':{'id':_0x2ed8bf['params']['id']}},_0x20094f={};_0x20094f[_0x3bcc('0x2e')]=_['keys'](db['VtigerField'][_0x3bcc('0x2b')]);_0x20094f[_0x3bcc('0x2f')]=_['keys'](_0x2ed8bf[_0x3bcc('0x2f')]);_0x20094f[_0x3bcc('0x31')]=_[_0x3bcc('0x32')](_0x20094f['model'],_0x20094f[_0x3bcc('0x2f')]);_0x5a5c23[_0x3bcc('0x33')]=_['intersection'](_0x20094f[_0x3bcc('0x2e')],qs[_0x3bcc('0x34')](_0x2ed8bf['query'][_0x3bcc('0x34')]));_0x5a5c23['attributes']=_0x5a5c23[_0x3bcc('0x33')][_0x3bcc('0x35')]?_0x5a5c23['attributes']:_0x20094f[_0x3bcc('0x2e')];if(_0x2ed8bf[_0x3bcc('0x2f')][_0x3bcc('0x43')]){_0x5a5c23[_0x3bcc('0x3f')]=[{'all':!![]}];}_0x5a5c23=_['merge']({},_0x5a5c23,_0x2ed8bf[_0x3bcc('0x3e')]);return db[_0x3bcc('0x2a')][_0x3bcc('0x44')](_0x5a5c23)[_0x3bcc('0x23')](handleEntityNotFound(_0x5efcb7,null))[_0x3bcc('0x23')](respondWithResult(_0x5efcb7,null))[_0x3bcc('0x41')](handleError(_0x5efcb7,null));};exports[_0x3bcc('0x45')]=function(_0x486be6,_0x5b7f7f){return db[_0x3bcc('0x2a')][_0x3bcc('0x45')](_0x486be6[_0x3bcc('0x46')],{})[_0x3bcc('0x23')](respondWithResult(_0x5b7f7f,0xc9))[_0x3bcc('0x41')](handleError(_0x5b7f7f,null));};exports[_0x3bcc('0x22')]=function(_0x46fe47,_0x84cb0){if(_0x46fe47[_0x3bcc('0x46')]['id']){delete _0x46fe47[_0x3bcc('0x46')]['id'];}return db[_0x3bcc('0x2a')][_0x3bcc('0x44')]({'where':{'id':_0x46fe47['params']['id']}})[_0x3bcc('0x23')](handleEntityNotFound(_0x84cb0,null))[_0x3bcc('0x23')](saveUpdates(_0x46fe47[_0x3bcc('0x46')],null))['then'](respondWithResult(_0x84cb0,null))[_0x3bcc('0x41')](handleError(_0x84cb0,null));};exports[_0x3bcc('0x24')]=function(_0x552f52,_0x3255c7){return db['VtigerField']['find']({'where':{'id':_0x552f52[_0x3bcc('0x47')]['id']}})[_0x3bcc('0x23')](handleEntityNotFound(_0x3255c7,null))[_0x3bcc('0x23')](removeEntity(_0x3255c7,null))[_0x3bcc('0x41')](handleError(_0x3255c7,null));}; \ No newline at end of file +var _0xb941=['save','update','then','destroy','name','send','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','params','find','create','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb941,0x1ec));var _0x1b94=function(_0x2c55dd,_0x2f6d3f){_0x2c55dd=_0x2c55dd-0x0;var _0xc886bd=_0xb941[_0x2c55dd];return _0xc886bd;};'use strict';var pdf=require(_0x1b94('0x0'));var emlformat=require(_0x1b94('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1b94('0x2'));var jsonpatch=require(_0x1b94('0x3'));var rp=require('request-promise');var moment=require(_0x1b94('0x4'));var BPromise=require(_0x1b94('0x5'));var Mustache=require(_0x1b94('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1b94('0x7'));var ejs=require(_0x1b94('0x8'));var fs=require('fs');var _=require(_0x1b94('0x9'));var squel=require(_0x1b94('0xa'));var crypto=require('crypto');var jsforce=require(_0x1b94('0xb'));var deskjs=require(_0x1b94('0xc'));var toCsv=require(_0x1b94('0x7'));var querystring=require(_0x1b94('0xd'));var Papa=require(_0x1b94('0xe'));var Redis=require(_0x1b94('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1b94('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b94('0x11'))(_0x1b94('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1b94('0x13'))['db'];function respondWithStatusCode(_0x2c6614,_0x42bd8f){_0x42bd8f=_0x42bd8f||0xcc;return function(_0x3a0cce){if(_0x3a0cce){return _0x2c6614[_0x1b94('0x14')](_0x42bd8f);}return _0x2c6614[_0x1b94('0x15')](_0x42bd8f)[_0x1b94('0x16')]();};}function respondWithResult(_0xb60da7,_0x4aa3e0){_0x4aa3e0=_0x4aa3e0||0xc8;return function(_0x58aa86){if(_0x58aa86){return _0xb60da7[_0x1b94('0x15')](_0x4aa3e0)['json'](_0x58aa86);}};}function respondWithFilteredResult(_0x33fcd7,_0x51c556){return function(_0x476969){if(_0x476969){var _0x376a52=_0x476969[_0x1b94('0x17')],_0x5411d3=_0x51c556[_0x1b94('0x18')],_0x1d49d1=_0x51c556[_0x1b94('0x18')]+_0x51c556[_0x1b94('0x19')],_0x272431;if(_0x1d49d1>=_0x376a52){_0x1d49d1=_0x376a52;_0x272431=0xc8;}else{_0x272431=0xce;}_0x33fcd7[_0x1b94('0x15')](_0x272431);return _0x33fcd7[_0x1b94('0x1a')]('Content-Range',_0x5411d3+'-'+_0x1d49d1+'/'+_0x376a52)['json'](_0x476969);}return null;};}function patchUpdates(_0x437ff3){return function(_0x1f5342){try{jsonpatch['apply'](_0x1f5342,_0x437ff3,!![]);}catch(_0x117d80){return BPromise[_0x1b94('0x1b')](_0x117d80);}return _0x1f5342[_0x1b94('0x1c')]();};}function saveUpdates(_0x245b87,_0x1b26fc){return function(_0xbd8b0){if(_0xbd8b0){return _0xbd8b0[_0x1b94('0x1d')](_0x245b87)[_0x1b94('0x1e')](function(_0x4a6e22){return _0x4a6e22;});}return null;};}function removeEntity(_0x2a5b54,_0x59db95){return function(_0x2f9f03){if(_0x2f9f03){return _0x2f9f03[_0x1b94('0x1f')]()[_0x1b94('0x1e')](function(){_0x2a5b54[_0x1b94('0x15')](0xcc)[_0x1b94('0x16')]();});}};}function handleEntityNotFound(_0x456ffe,_0x3a035d){return function(_0x52f73d){if(!_0x52f73d){_0x456ffe['sendStatus'](0x194);}return _0x52f73d;};}function handleError(_0x27360b,_0x1b75c1){_0x1b75c1=_0x1b75c1||0x1f4;return function(_0x2cb693){logger['error'](_0x2cb693['stack']);if(_0x2cb693[_0x1b94('0x20')]){delete _0x2cb693[_0x1b94('0x20')];}_0x27360b['status'](_0x1b75c1)[_0x1b94('0x21')](_0x2cb693);};}exports['index']=function(_0x1b847,_0xe7657c){var _0x3fedc7={},_0x267d70={},_0x24afd8={'count':0x0,'rows':[]};var _0x7c2220=_['map'](db[_0x1b94('0x22')][_0x1b94('0x23')],function(_0x2c1514){return{'name':_0x2c1514[_0x1b94('0x24')],'type':_0x2c1514[_0x1b94('0x25')][_0x1b94('0x26')]};});_0x267d70[_0x1b94('0x27')]=_['map'](_0x7c2220,_0x1b94('0x20'));_0x267d70['query']=_[_0x1b94('0x28')](_0x1b847[_0x1b94('0x29')]);_0x267d70[_0x1b94('0x2a')]=_[_0x1b94('0x2b')](_0x267d70[_0x1b94('0x27')],_0x267d70[_0x1b94('0x29')]);_0x3fedc7['attributes']=_[_0x1b94('0x2b')](_0x267d70[_0x1b94('0x27')],qs[_0x1b94('0x2c')](_0x1b847[_0x1b94('0x29')][_0x1b94('0x2c')]));_0x3fedc7['attributes']=_0x3fedc7[_0x1b94('0x2d')][_0x1b94('0x2e')]?_0x3fedc7[_0x1b94('0x2d')]:_0x267d70['model'];if(!_0x1b847[_0x1b94('0x29')][_0x1b94('0x2f')](_0x1b94('0x30'))){_0x3fedc7['limit']=qs[_0x1b94('0x19')](_0x1b847[_0x1b94('0x29')][_0x1b94('0x19')]);_0x3fedc7[_0x1b94('0x18')]=qs[_0x1b94('0x18')](_0x1b847[_0x1b94('0x29')]['offset']);}_0x3fedc7[_0x1b94('0x31')]=qs['sort'](_0x1b847[_0x1b94('0x29')][_0x1b94('0x32')]);_0x3fedc7[_0x1b94('0x33')]=qs[_0x1b94('0x2a')](_[_0x1b94('0x34')](_0x1b847['query'],_0x267d70[_0x1b94('0x2a')]),_0x7c2220);if(_0x1b847['query'][_0x1b94('0x35')]){_0x3fedc7[_0x1b94('0x33')]=_[_0x1b94('0x36')](_0x3fedc7[_0x1b94('0x33')],{'$or':_[_0x1b94('0x37')](_0x7c2220,function(_0x20910f){if(_0x20910f[_0x1b94('0x25')]!==_0x1b94('0x38')){var _0x12ccbe={};_0x12ccbe[_0x20910f['name']]={'$like':'%'+_0x1b847[_0x1b94('0x29')][_0x1b94('0x35')]+'%'};return _0x12ccbe;}})});}_0x3fedc7=_[_0x1b94('0x36')]({},_0x3fedc7,_0x1b847[_0x1b94('0x39')]);var _0x5c1330={'where':_0x3fedc7['where']};return db['VtigerField'][_0x1b94('0x17')](_0x5c1330)[_0x1b94('0x1e')](function(_0x3e0582){_0x24afd8[_0x1b94('0x17')]=_0x3e0582;if(_0x1b847[_0x1b94('0x29')]['includeAll']){_0x3fedc7[_0x1b94('0x3a')]=[{'all':!![]}];}return db[_0x1b94('0x22')][_0x1b94('0x3b')](_0x3fedc7);})[_0x1b94('0x1e')](function(_0x5451b5){_0x24afd8['rows']=_0x5451b5;return _0x24afd8;})[_0x1b94('0x1e')](respondWithFilteredResult(_0xe7657c,_0x3fedc7))['catch'](handleError(_0xe7657c,null));};exports['show']=function(_0x12536d,_0x327962){var _0x2a595e={'raw':!![],'where':{'id':_0x12536d[_0x1b94('0x3c')]['id']}},_0x15c1be={};_0x15c1be[_0x1b94('0x27')]=_[_0x1b94('0x28')](db[_0x1b94('0x22')][_0x1b94('0x23')]);_0x15c1be[_0x1b94('0x29')]=_[_0x1b94('0x28')](_0x12536d[_0x1b94('0x29')]);_0x15c1be['filters']=_['intersection'](_0x15c1be[_0x1b94('0x27')],_0x15c1be['query']);_0x2a595e[_0x1b94('0x2d')]=_[_0x1b94('0x2b')](_0x15c1be[_0x1b94('0x27')],qs[_0x1b94('0x2c')](_0x12536d[_0x1b94('0x29')][_0x1b94('0x2c')]));_0x2a595e[_0x1b94('0x2d')]=_0x2a595e[_0x1b94('0x2d')][_0x1b94('0x2e')]?_0x2a595e[_0x1b94('0x2d')]:_0x15c1be[_0x1b94('0x27')];if(_0x12536d[_0x1b94('0x29')]['includeAll']){_0x2a595e[_0x1b94('0x3a')]=[{'all':!![]}];}_0x2a595e=_[_0x1b94('0x36')]({},_0x2a595e,_0x12536d['options']);return db[_0x1b94('0x22')][_0x1b94('0x3d')](_0x2a595e)['then'](handleEntityNotFound(_0x327962,null))[_0x1b94('0x1e')](respondWithResult(_0x327962,null))['catch'](handleError(_0x327962,null));};exports[_0x1b94('0x3e')]=function(_0x300894,_0x46351c){return db[_0x1b94('0x22')]['create'](_0x300894[_0x1b94('0x3f')],{})[_0x1b94('0x1e')](respondWithResult(_0x46351c,0xc9))[_0x1b94('0x40')](handleError(_0x46351c,null));};exports[_0x1b94('0x1d')]=function(_0x14e2b6,_0x5ca8e6){if(_0x14e2b6[_0x1b94('0x3f')]['id']){delete _0x14e2b6[_0x1b94('0x3f')]['id'];}return db[_0x1b94('0x22')]['find']({'where':{'id':_0x14e2b6[_0x1b94('0x3c')]['id']}})[_0x1b94('0x1e')](handleEntityNotFound(_0x5ca8e6,null))[_0x1b94('0x1e')](saveUpdates(_0x14e2b6[_0x1b94('0x3f')],null))[_0x1b94('0x1e')](respondWithResult(_0x5ca8e6,null))[_0x1b94('0x40')](handleError(_0x5ca8e6,null));};exports[_0x1b94('0x1f')]=function(_0x4266b5,_0x5d9135){return db[_0x1b94('0x22')][_0x1b94('0x3d')]({'where':{'id':_0x4266b5[_0x1b94('0x3c')]['id']}})[_0x1b94('0x1e')](handleEntityNotFound(_0x5d9135,null))['then'](removeEntity(_0x5d9135,null))[_0x1b94('0x40')](handleError(_0x5d9135,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e519c85..83d059b 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(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x51b19b,_0x5015d2){_0x51b19b=_0x51b19b-0x0;var _0x1a3cd6=_0xf3cd[_0x51b19b];return _0x1a3cd6;};'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 _0xaa88=['int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField'];(function(_0x544f46,_0x168b65){var _0x21e7f2=function(_0x4e22a8){while(--_0x4e22a8){_0x544f46['push'](_0x544f46['shift']());}};_0x21e7f2(++_0x168b65);}(_0xaa88,0x137));var _0x8aa8=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0xaa88[_0x91d019];return _0x19de1f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[{'name':_0x8aa8('0xc'),'fields':[_0x8aa8('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6f04ce2..6d125fc 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 _0x5454=['stringify','error','code','message','result','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5454,0x15b));var _0x4545=function(_0x38796c,_0x1fd608){_0x38796c=_0x38796c-0x0;var _0x53683a=_0x5454[_0x38796c];return _0x53683a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4545('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4545('0x1'));var logger=require(_0x4545('0x2'))(_0x4545('0x3'));var config=require(_0x4545('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4545('0x5')][_0x4545('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6fd3bb,_0xc79c57,_0x3f1134){return new BPromise(function(_0x1fd7e5,_0x1c5649){return client[_0x4545('0x7')](_0x6fd3bb,_0x3f1134)[_0x4545('0x8')](function(_0x3e2526){logger[_0x4545('0x9')](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));logger['debug'](_0x4545('0xc'),_0xc79c57,_0x4545('0xb'),JSON[_0x4545('0xd')](_0x3e2526));if(_0x3e2526[_0x4545('0xe')]){if(_0x3e2526[_0x4545('0xe')][_0x4545('0xf')]===0x1f4){logger['error'](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1c5649(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1fd7e5(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}else{logger['info'](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));_0x1fd7e5(_0x3e2526[_0x4545('0x11')][_0x4545('0x10')]);}})['catch'](function(_0x4a5bdf){logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x4a5bdf);_0x1c5649(_0x4a5bdf);});});} \ No newline at end of file +var _0x4c4d=['lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0xcadf4c,_0x32eb3b){_0xcadf4c=_0xcadf4c-0x0;var _0x29001e=_0x4c4d[_0xcadf4c];return _0x29001e;};'use strict';var _=require(_0xd4c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4c4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4c4('0x2'));var logger=require(_0xd4c4('0x3'))(_0xd4c4('0x4'));var config=require(_0xd4c4('0x5'));var jayson=require(_0xd4c4('0x6'));var client=jayson[_0xd4c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421581,_0x463c30,_0x1691e5){return new BPromise(function(_0xbe6e8d,_0x350f8f){return client['request'](_0x421581,_0x1691e5)[_0xd4c4('0x8')](function(_0xf97702){logger[_0xd4c4('0x9')](_0xd4c4('0xa'),_0x463c30,_0xd4c4('0xb'));logger[_0xd4c4('0xc')](_0xd4c4('0xd'),_0x463c30,_0xd4c4('0xb'),JSON[_0xd4c4('0xe')](_0xf97702));if(_0xf97702['error']){if(_0xf97702[_0xd4c4('0xf')]['code']===0x1f4){logger[_0xd4c4('0xf')](_0xd4c4('0xa'),_0x463c30,_0xf97702['error'][_0xd4c4('0x10')]);return _0x350f8f(_0xf97702['error']['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x463c30,_0xf97702[_0xd4c4('0xf')][_0xd4c4('0x10')]);return _0xbe6e8d(_0xf97702['error'][_0xd4c4('0x10')]);}else{logger[_0xd4c4('0x9')](_0xd4c4('0xa'),_0x463c30,_0xd4c4('0xb'));_0xbe6e8d(_0xf97702[_0xd4c4('0x11')][_0xd4c4('0x10')]);}})[_0xd4c4('0x12')](function(_0x3d514c){logger[_0xd4c4('0xf')]('VtigerField,\x20%s,\x20%s',_0x463c30,_0x3d514c);_0x350f8f(_0x3d514c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0fb3bd2..33ad419 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 _0xa04b=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x2158eb,_0x398886){var _0xaa3a7a=function(_0x4b339e){while(--_0x4b339e){_0x2158eb['push'](_0x2158eb['shift']());}};_0xaa3a7a(++_0x398886);}(_0xa04b,0x15f));var _0xba04=function(_0x29d39d,_0x49425c){_0x29d39d=_0x29d39d-0x0;var _0x4beb88=_0xa04b[_0x29d39d];return _0x4beb88;};'use strict';var multer=require(_0xba04('0x0'));var util=require('util');var path=require(_0xba04('0x1'));var timeout=require(_0xba04('0x2'));var express=require(_0xba04('0x3'));var router=express[_0xba04('0x4')]();var auth=require(_0xba04('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba04('0x6'));var controller=require(_0xba04('0x7'));router[_0xba04('0x8')]('/',auth[_0xba04('0x9')](),controller['index']);router[_0xba04('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xba04('0xa')]);router[_0xba04('0x8')](_0xba04('0xb'),auth[_0xba04('0x9')](),controller[_0xba04('0xc')]);router[_0xba04('0x8')](_0xba04('0xd'),auth[_0xba04('0x9')](),controller[_0xba04('0xe')]);router[_0xba04('0xf')]('/',auth[_0xba04('0x9')](),controller['create']);router[_0xba04('0xf')]('/:id/configurations',auth[_0xba04('0x9')](),controller[_0xba04('0x10')]);router[_0xba04('0x11')](_0xba04('0x12'),auth[_0xba04('0x9')](),controller['update']);router['delete'](_0xba04('0x12'),auth['isAuthenticated'](),controller[_0xba04('0x13')]);module['exports']=router; \ No newline at end of file +var _0xabdc=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8ef77e,_0x45d725){var _0x275ce2=function(_0x4faf39){while(--_0x4faf39){_0x8ef77e['push'](_0x8ef77e['shift']());}};_0x275ce2(++_0x45d725);}(_0xabdc,0x1de));var _0xcabd=function(_0x30c24f,_0x2d8c00){_0x30c24f=_0x30c24f-0x0;var _0x9cc496=_0xabdc[_0x30c24f];return _0x9cc496;};'use strict';var multer=require('multer');var util=require(_0xcabd('0x0'));var path=require(_0xcabd('0x1'));var timeout=require(_0xcabd('0x2'));var express=require(_0xcabd('0x3'));var router=express[_0xcabd('0x4')]();var auth=require(_0xcabd('0x5'));var interaction=require(_0xcabd('0x6'));var config=require(_0xcabd('0x7'));var controller=require(_0xcabd('0x8'));router[_0xcabd('0x9')]('/',auth[_0xcabd('0xa')](),controller[_0xcabd('0xb')]);router[_0xcabd('0x9')]('/:id',auth[_0xcabd('0xa')](),controller[_0xcabd('0xc')]);router['get'](_0xcabd('0xd'),auth[_0xcabd('0xa')](),controller[_0xcabd('0xe')]);router['get'](_0xcabd('0xf'),auth['isAuthenticated'](),controller[_0xcabd('0x10')]);router[_0xcabd('0x11')]('/',auth[_0xcabd('0xa')](),controller['create']);router['post'](_0xcabd('0xd'),auth[_0xcabd('0xa')](),controller['addConfiguration']);router[_0xcabd('0x12')](_0xcabd('0x13'),auth[_0xcabd('0xa')](),controller[_0xcabd('0x14')]);router['delete']('/:id',auth[_0xcabd('0xa')](),controller['destroy']);module[_0xcabd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ee2ed75..fa5a1f6 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 _0xb0f7=['username','ENUM','password','token','integrationTab','newTab','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0f7,0xae));var _0x7b0f=function(_0x545b34,_0x261f32){_0x545b34=_0x545b34-0x0;var _0x544fe3=_0xb0f7[_0x545b34];return _0x544fe3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7b0f('0x0')]},'description':{'type':Sequelize[_0x7b0f('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x7b0f('0x1')},'password':{'type':Sequelize[_0x7b0f('0x0')]},'token':{'type':Sequelize[_0x7b0f('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x7b0f('0x2')](_0x7b0f('0x3'),_0x7b0f('0x4')),'defaultValue':_0x7b0f('0x3')},'serverUrl':{'type':Sequelize[_0x7b0f('0x0')]},'type':{'type':Sequelize[_0x7b0f('0x2')](_0x7b0f('0x5'),_0x7b0f('0x6')),'defaultValue':_0x7b0f('0x5')}}; \ No newline at end of file +var _0xdde3=['ENUM','password','token','integrationTab','newTab','sequelize','exports','username','STRING','remoteUri'];(function(_0x2fa811,_0x192e2a){var _0x21f99a=function(_0x2a3dc4){while(--_0x2a3dc4){_0x2fa811['push'](_0x2fa811['shift']());}};_0x21f99a(++_0x192e2a);}(_0xdde3,0xf5));var _0x3dde=function(_0x240928,_0x4d8979){_0x240928=_0x240928-0x0;var _0x3d17cd=_0xdde3[_0x240928];return _0x3d17cd;};'use strict';var Sequelize=require(_0x3dde('0x0'));module[_0x3dde('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3dde('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3dde('0x3')]},'remoteUri':{'type':Sequelize[_0x3dde('0x3')],'unique':_0x3dde('0x4')},'authType':{'type':Sequelize[_0x3dde('0x5')](_0x3dde('0x6'),_0x3dde('0x7')),'defaultValue':_0x3dde('0x6')},'serverUrl':{'type':Sequelize[_0x3dde('0x3')]},'type':{'type':Sequelize[_0x3dde('0x5')](_0x3dde('0x8'),_0x3dde('0x9')),'defaultValue':_0x3dde('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c7f1390..4115cc1 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 _0x7550=['send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','findOne','ZendeskConfiguration','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','authType','headers','Basic\x20%s','toString','base64','Unknown\x20authentication\x20type','subject','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../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','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name'];(function(_0x333965,_0x16e0f5){var _0x50290e=function(_0x1e7c60){while(--_0x1e7c60){_0x333965['push'](_0x333965['shift']());}};_0x50290e(++_0x16e0f5);}(_0x7550,0x155));var _0x0755=function(_0x4cdeed,_0x22eda2){_0x4cdeed=_0x4cdeed-0x0;var _0x3e7fec=_0x7550[_0x4cdeed];return _0x3e7fec;};'use strict';var pdf=require(_0x0755('0x0'));var emlformat=require(_0x0755('0x1'));var rimraf=require(_0x0755('0x2'));var zipdir=require(_0x0755('0x3'));var jsonpatch=require(_0x0755('0x4'));var rp=require(_0x0755('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0755('0x6'));var path=require(_0x0755('0x7'));var sox=require(_0x0755('0x8'));var csv=require(_0x0755('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0755('0xa'));var crypto=require(_0x0755('0xb'));var jsforce=require(_0x0755('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0755('0x9'));var querystring=require('querystring');var Papa=require(_0x0755('0xd'));var Redis=require(_0x0755('0xe'));var authService=require(_0x0755('0xf'));var qs=require(_0x0755('0x10'));var as=require(_0x0755('0x11'));var hardwareService=require(_0x0755('0x12'));var logger=require(_0x0755('0x13'))(_0x0755('0x14'));var utils=require(_0x0755('0x15'));var config=require(_0x0755('0x16'));var db=require(_0x0755('0x17'))['db'];var integrations=require(_0x0755('0x18'));var jayson=require(_0x0755('0x19'));var client=jayson[_0x0755('0x1a')][_0x0755('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3629fa,_0x36ea9a,_0x22eb49){if(_0x22eb49){var _0x45c196=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45c196['test'](_0x36ea9a)){return _0x3629fa;}else{throw new db[(_0x0755('0x1c'))][(_0x0755('0x1d'))](_0x0755('0x1e'));}}else{return _0x3629fa;}}function respondWithRpcPromise(_0x11f549,_0x3bd4e3,_0x2ceb7e,_0x512308){return new BPromise(function(_0x110472,_0x33dec3){var _0x11064d=_0x512308||client;return _0x11064d[_0x0755('0x1f')](_0x11f549,_0x2ceb7e)['then'](function(_0x548e80){logger[_0x0755('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x3bd4e3,_0x0755('0x21'));logger[_0x0755('0x22')](_0x0755('0x23'),_0x3bd4e3,_0x0755('0x21'),JSON[_0x0755('0x24')](_0x548e80));if(_0x548e80[_0x0755('0x25')]){if(_0x548e80[_0x0755('0x25')][_0x0755('0x26')]===0x1f4){logger[_0x0755('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x3bd4e3,_0x548e80[_0x0755('0x25')]['message']);return _0x33dec3(_0x548e80['error'][_0x0755('0x27')]);}logger['error'](_0x0755('0x28'),_0x3bd4e3,_0x548e80[_0x0755('0x25')]['message']);return _0x110472(_0x548e80[_0x0755('0x25')][_0x0755('0x27')]);}else{logger[_0x0755('0x20')](_0x0755('0x28'),_0x3bd4e3,'request\x20sent');_0x110472(_0x548e80[_0x0755('0x29')][_0x0755('0x27')]);}})[_0x0755('0x2a')](function(_0x4127d1){logger[_0x0755('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x3bd4e3,_0x4127d1);_0x33dec3(_0x4127d1);});});}function respondWithStatusCode(_0x162b50,_0x570708){_0x570708=_0x570708||0xcc;return function(_0x4cf328){if(_0x4cf328){return _0x162b50['sendStatus'](_0x570708);}return _0x162b50[_0x0755('0x2b')](_0x570708)[_0x0755('0x2c')]();};}function respondWithResult(_0x56d476,_0x384ac3){_0x384ac3=_0x384ac3||0xc8;return function(_0x4cca52){if(_0x4cca52){return _0x56d476[_0x0755('0x2b')](_0x384ac3)[_0x0755('0x2d')](_0x4cca52);}};}function respondWithFilteredResult(_0x9759da,_0x42a236){return function(_0x3e5aed){if(_0x3e5aed){var _0x45b7f2=_0x3e5aed['count'],_0x33687c=_0x42a236[_0x0755('0x2e')],_0xa4d81e=_0x42a236[_0x0755('0x2e')]+_0x42a236[_0x0755('0x2f')],_0x313801;if(_0xa4d81e>=_0x45b7f2){_0xa4d81e=_0x45b7f2;_0x313801=0xc8;}else{_0x313801=0xce;}_0x9759da[_0x0755('0x2b')](_0x313801);return _0x9759da[_0x0755('0x30')](_0x0755('0x31'),_0x33687c+'-'+_0xa4d81e+'/'+_0x45b7f2)['json'](_0x3e5aed);}return null;};}function patchUpdates(_0x4ef082){return function(_0xea4315){try{jsonpatch[_0x0755('0x32')](_0xea4315,_0x4ef082,!![]);}catch(_0x2f00c9){return BPromise[_0x0755('0x33')](_0x2f00c9);}return _0xea4315[_0x0755('0x34')]();};}function saveUpdates(_0x5d63a4,_0x21bcbf){return function(_0x5835b7){if(_0x5835b7){return _0x5835b7[_0x0755('0x35')](_0x5d63a4)['then'](function(_0xc45577){return _0xc45577;});}return null;};}function removeEntity(_0x117e8a,_0x4a024e){return function(_0x11a84d){if(_0x11a84d){return _0x11a84d[_0x0755('0x36')]()[_0x0755('0x37')](function(){_0x117e8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d51eb,_0x191e00){return function(_0x4edb46){if(!_0x4edb46){_0x3d51eb[_0x0755('0x38')](0x194);}return _0x4edb46;};}function handleError(_0x48e86a,_0x46f9f2){_0x46f9f2=_0x46f9f2||0x1f4;return function(_0x4e9292){logger[_0x0755('0x25')](_0x4e9292['stack']);if(_0x4e9292['name']){delete _0x4e9292[_0x0755('0x39')];}_0x48e86a['status'](_0x46f9f2)[_0x0755('0x3a')](_0x4e9292);};}exports[_0x0755('0x3b')]=function(_0x10ffd0,_0x40a407){var _0x1f8abe={},_0x447a91={},_0x6ba7dd={'count':0x0,'rows':[]};var _0x12ad35=_[_0x0755('0x3c')](db[_0x0755('0x3d')]['rawAttributes'],function(_0x443178){return{'name':_0x443178[_0x0755('0x3e')],'type':_0x443178[_0x0755('0x3f')][_0x0755('0x40')]};});_0x447a91[_0x0755('0x41')]=_['map'](_0x12ad35,_0x0755('0x39'));_0x447a91[_0x0755('0x42')]=_[_0x0755('0x43')](_0x10ffd0[_0x0755('0x42')]);_0x447a91[_0x0755('0x44')]=_[_0x0755('0x45')](_0x447a91[_0x0755('0x41')],_0x447a91[_0x0755('0x42')]);_0x1f8abe[_0x0755('0x46')]=_[_0x0755('0x45')](_0x447a91[_0x0755('0x41')],qs[_0x0755('0x47')](_0x10ffd0[_0x0755('0x42')][_0x0755('0x47')]));_0x1f8abe['attributes']=_0x1f8abe[_0x0755('0x46')][_0x0755('0x48')]?_0x1f8abe[_0x0755('0x46')]:_0x447a91['model'];if(!_0x10ffd0[_0x0755('0x42')][_0x0755('0x49')](_0x0755('0x4a'))){_0x1f8abe[_0x0755('0x2f')]=qs[_0x0755('0x2f')](_0x10ffd0[_0x0755('0x42')][_0x0755('0x2f')]);_0x1f8abe['offset']=qs[_0x0755('0x2e')](_0x10ffd0[_0x0755('0x42')][_0x0755('0x2e')]);}_0x1f8abe[_0x0755('0x4b')]=qs[_0x0755('0x4c')](_0x10ffd0['query']['sort']);_0x1f8abe[_0x0755('0x4d')]=qs['filters'](_['pick'](_0x10ffd0[_0x0755('0x42')],_0x447a91[_0x0755('0x44')]),_0x12ad35);if(_0x10ffd0[_0x0755('0x42')][_0x0755('0x4e')]){_0x1f8abe[_0x0755('0x4d')]=_[_0x0755('0x4f')](_0x1f8abe['where'],{'$or':_['map'](_0x12ad35,function(_0x54e7af){if(_0x54e7af[_0x0755('0x3f')]!==_0x0755('0x50')){var _0x2f7d8b={};_0x2f7d8b[_0x54e7af['name']]={'$like':'%'+_0x10ffd0[_0x0755('0x42')]['filter']+'%'};return _0x2f7d8b;}})});}_0x1f8abe=_['merge']({},_0x1f8abe,_0x10ffd0[_0x0755('0x51')]);var _0xcee10a={'where':_0x1f8abe[_0x0755('0x4d')]};return db[_0x0755('0x3d')]['count'](_0xcee10a)['then'](function(_0xf64ecd){_0x6ba7dd['count']=_0xf64ecd;if(_0x10ffd0[_0x0755('0x42')][_0x0755('0x52')]){_0x1f8abe[_0x0755('0x53')]=[{'all':!![]}];}return db[_0x0755('0x3d')]['findAll'](_0x1f8abe);})['then'](function(_0x2ab643){_0x6ba7dd[_0x0755('0x54')]=_0x2ab643;return _0x6ba7dd;})[_0x0755('0x37')](respondWithFilteredResult(_0x40a407,_0x1f8abe))[_0x0755('0x2a')](handleError(_0x40a407,null));};exports[_0x0755('0x55')]=function(_0x4f2ac3,_0x489ca6){var _0xacf217={'raw':![],'where':{'id':_0x4f2ac3[_0x0755('0x56')]['id']}},_0x4321cb={};_0x4321cb['model']=_[_0x0755('0x43')](db[_0x0755('0x3d')]['rawAttributes']);_0x4321cb[_0x0755('0x42')]=_[_0x0755('0x43')](_0x4f2ac3['query']);_0x4321cb[_0x0755('0x44')]=_[_0x0755('0x45')](_0x4321cb['model'],_0x4321cb['query']);_0xacf217[_0x0755('0x46')]=_[_0x0755('0x45')](_0x4321cb[_0x0755('0x41')],qs[_0x0755('0x47')](_0x4f2ac3[_0x0755('0x42')][_0x0755('0x47')]));_0xacf217['attributes']=_0xacf217[_0x0755('0x46')][_0x0755('0x48')]?_0xacf217[_0x0755('0x46')]:_0x4321cb['model'];if(_0x4f2ac3[_0x0755('0x42')]['includeAll']){_0xacf217[_0x0755('0x53')]=[{'all':!![]}];}_0xacf217=_[_0x0755('0x4f')]({},_0xacf217,_0x4f2ac3[_0x0755('0x51')]);return db[_0x0755('0x3d')][_0x0755('0x57')](_0xacf217)[_0x0755('0x37')](handleEntityNotFound(_0x489ca6,null))[_0x0755('0x37')](respondWithResult(_0x489ca6,null))['catch'](handleError(_0x489ca6,null));};exports['create']=function(_0x212631,_0x347ba5){return db[_0x0755('0x3d')][_0x0755('0x58')](_0x212631[_0x0755('0x59')],{})[_0x0755('0x37')](respondWithResult(_0x347ba5,0xc9))[_0x0755('0x2a')](handleError(_0x347ba5,null));};exports[_0x0755('0x35')]=function(_0x24ae8c,_0x30b1a){if(_0x24ae8c[_0x0755('0x59')]['id']){delete _0x24ae8c[_0x0755('0x59')]['id'];}return db[_0x0755('0x3d')][_0x0755('0x57')]({'where':{'id':_0x24ae8c[_0x0755('0x56')]['id']}})['then'](handleEntityNotFound(_0x30b1a,null))[_0x0755('0x37')](saveUpdates(_0x24ae8c[_0x0755('0x59')],null))[_0x0755('0x37')](respondWithResult(_0x30b1a,null))[_0x0755('0x2a')](handleError(_0x30b1a,null));};exports[_0x0755('0x36')]=function(_0x5f17ca,_0x231886){return db[_0x0755('0x3d')][_0x0755('0x57')]({'where':{'id':_0x5f17ca['params']['id']}})[_0x0755('0x37')](handleEntityNotFound(_0x231886,null))[_0x0755('0x37')](removeEntity(_0x231886,null))[_0x0755('0x2a')](handleError(_0x231886,null));};exports['getConfigurations']=function(_0x23500a,_0x4a02b0,_0x4e79ce){var _0x4545ac={};var _0x19daed={};var _0x1ff01b;var _0x43b9f4;return db['ZendeskAccount'][_0x0755('0x5a')]({'where':{'id':_0x23500a[_0x0755('0x56')]['id']}})[_0x0755('0x37')](handleEntityNotFound(_0x4a02b0,null))[_0x0755('0x37')](function(_0x347a93){if(_0x347a93){_0x1ff01b=_0x347a93;_0x19daed['model']=_[_0x0755('0x43')](db[_0x0755('0x5b')][_0x0755('0x5c')]);_0x19daed['query']=_[_0x0755('0x43')](_0x23500a[_0x0755('0x42')]);_0x19daed[_0x0755('0x44')]=_[_0x0755('0x45')](_0x19daed[_0x0755('0x41')],_0x19daed[_0x0755('0x42')]);_0x4545ac[_0x0755('0x46')]=_['intersection'](_0x19daed[_0x0755('0x41')],qs['fields'](_0x23500a[_0x0755('0x42')]['fields']));_0x4545ac['attributes']=_0x4545ac[_0x0755('0x46')]['length']?_0x4545ac[_0x0755('0x46')]:_0x19daed[_0x0755('0x41')];_0x4545ac[_0x0755('0x4b')]=qs[_0x0755('0x4c')](_0x23500a[_0x0755('0x42')][_0x0755('0x4c')]);_0x4545ac['where']=qs[_0x0755('0x44')](_[_0x0755('0x5d')](_0x23500a[_0x0755('0x42')],_0x19daed[_0x0755('0x44')]));if(_0x23500a[_0x0755('0x42')][_0x0755('0x4e')]){_0x4545ac['where']=_[_0x0755('0x4f')](_0x4545ac[_0x0755('0x4d')],{'$or':_[_0x0755('0x3c')](_0x4545ac[_0x0755('0x46')],function(_0x19bb71){var _0x2e39e0={};_0x2e39e0[_0x19bb71]={'$like':'%'+_0x23500a[_0x0755('0x42')]['filter']+'%'};return _0x2e39e0;})});}_0x4545ac=_[_0x0755('0x4f')]({},_0x4545ac,_0x23500a[_0x0755('0x51')]);return _0x1ff01b[_0x0755('0x5e')](_0x4545ac);}})[_0x0755('0x37')](function(_0x54b905){if(_0x54b905){_0x43b9f4=_0x54b905['length'];if(!_0x23500a[_0x0755('0x42')][_0x0755('0x49')]('nolimit')){_0x4545ac[_0x0755('0x2f')]=qs[_0x0755('0x2f')](_0x23500a['query'][_0x0755('0x2f')]);_0x4545ac[_0x0755('0x2e')]=qs[_0x0755('0x2e')](_0x23500a[_0x0755('0x42')][_0x0755('0x2e')]);}return _0x1ff01b['getConfigurations'](_0x4545ac);}})['then'](function(_0xade233){if(_0xade233){return _0xade233?{'count':_0x43b9f4,'rows':_0xade233}:null;}})[_0x0755('0x37')](respondWithResult(_0x4a02b0,null))[_0x0755('0x2a')](handleError(_0x4a02b0,null));};exports[_0x0755('0x5f')]=function(_0x578091,_0x501c6f,_0x5e5c75){if(_0x578091['body']['id']){delete _0x578091[_0x0755('0x59')]['id'];}return db[_0x0755('0x3d')]['findOne']({'where':{'id':_0x578091[_0x0755('0x56')]['id']}})[_0x0755('0x37')](handleEntityNotFound(_0x501c6f,null))[_0x0755('0x37')](function(_0x35e959){if(_0x35e959){_0x578091[_0x0755('0x59')][_0x0755('0x60')]=_0x35e959['id'];_0x578091[_0x0755('0x59')][_0x0755('0x61')]=integrations[_0x0755('0x62')](_0x578091[_0x0755('0x59')]['channel'],_0x578091[_0x0755('0x59')][_0x0755('0x3f')]);_0x578091[_0x0755('0x59')][_0x0755('0x63')]=integrations[_0x0755('0x64')](_0x578091['body'][_0x0755('0x65')],_0x578091['body'][_0x0755('0x3f')]);return db[_0x0755('0x5b')][_0x0755('0x58')](_0x578091[_0x0755('0x59')],{'include':[{'model':db[_0x0755('0x66')],'as':'Subjects'},{'model':db[_0x0755('0x66')],'as':_0x0755('0x63')}]});}return null;})['then'](respondWithResult(_0x501c6f,null))[_0x0755('0x2a')](handleError(_0x501c6f,null));};exports[_0x0755('0x67')]=function(_0x14461a,_0x2a3ca9,_0x14f4c9){var _0x42ad3e='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x14461a['params']['id']},'attributes':['id',_0x0755('0x68'),_0x0755('0x69'),_0x0755('0x6a'),'authType',_0x0755('0x6b')]})[_0x0755('0x37')](handleEntityNotFound(_0x2a3ca9,null))['then'](function(_0x56f257){if(_0x56f257){_0x42ad3e=_0x56f257[_0x0755('0x6b')];var _0x169cc4=_0x42ad3e[_0x0755('0x6c')](-0x1);if(_0x169cc4==='/'){_0x42ad3e=_0x42ad3e[_0x0755('0x6d')](0x0,_0x42ad3e['lastIndexOf'](_0x169cc4));}var _0x10abd8={'method':_0x0755('0x6e'),'uri':util[_0x0755('0x6f')](_0x0755('0x70'),_0x42ad3e,'ticket_fields'),'json':!![]};switch(_0x56f257[_0x0755('0x71')]){case _0x0755('0x69'):_0x10abd8[_0x0755('0x72')]={'Authorization':util[_0x0755('0x6f')](_0x0755('0x73'),new Buffer(util[_0x0755('0x6f')]('%s:%s',_0x56f257[_0x0755('0x68')],_0x56f257[_0x0755('0x69')]))[_0x0755('0x74')]('base64'))};break;case _0x0755('0x6a'):_0x10abd8[_0x0755('0x72')]={'Authorization':util[_0x0755('0x6f')](_0x0755('0x73'),new Buffer(util[_0x0755('0x6f')]('%s/token:%s',_0x56f257['username'],_0x56f257[_0x0755('0x6a')]))[_0x0755('0x74')](_0x0755('0x75')))};break;default:throw new db[(_0x0755('0x1c'))][(_0x0755('0x1d'))](_0x0755('0x76'));}return rp(_0x10abd8);}})[_0x0755('0x37')](function(_0x38840e){if(_0x38840e){var _0x4e2f80=[_0x0755('0x77'),'description',_0x0755('0x78'),_0x0755('0x79')];_[_0x0755('0x7a')](_0x38840e[_0x0755('0x7b')],function(_0x357db5){return _0x4e2f80[_0x0755('0x7c')](_0x357db5['type']);});return{'count':_0x38840e[_0x0755('0x7b')]['length'],'rows':_[_0x0755('0x3c')](_0x38840e[_0x0755('0x7b')],function(_0x5cf28e){return{'id':_0x5cf28e['id'],'name':_0x5cf28e[_0x0755('0x7d')]>0x7?_0x5cf28e[_0x0755('0x7e')]:_0x5cf28e[_0x0755('0x3f')],'custom':_0x5cf28e[_0x0755('0x7d')]>0x7?!![]:![],'options':_0x5cf28e[_0x0755('0x7f')]?_0x5cf28e[_0x0755('0x7f')]:_0x5cf28e['custom_field_options']?_0x5cf28e[_0x0755('0x80')]:[]};})};}})[_0x0755('0x37')](respondWithResult(_0x2a3ca9,null))[_0x0755('0x2a')](function(_0x9a60c1){var _0x32da32=_0x14461a[_0x0755('0x42')][_0x0755('0x81')]?0x1f4:_0x9a60c1[_0x0755('0x82')]||0x1f4;logger[_0x0755('0x25')](_0x0755('0x83'),_0x0755('0x67'),_0x32da32,JSON[_0x0755('0x24')](_0x9a60c1));delete _0x9a60c1[_0x0755('0x39')];if(_0x32da32===0x191){_0x32da32=0x190;}_0x2a3ca9['status'](_0x32da32)[_0x0755('0x3a')](_0x14461a['query'][_0x0755('0x81')]?{'message':_0x0755('0x84'),'statusCode':_0x9a60c1[_0x0755('0x82')]}:_0x9a60c1);});}; \ No newline at end of file +var _0xff58=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','Content-Range','apply','reject','save','update','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','ZendeskAccount','findAll','rows','catch','show','params','keys','filters','find','create','body','destroy','findOne','pick','merge','getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','getFields','username','password','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','title','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','html-pdf','eml-format'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xff58,0xf8));var _0x8ff5=function(_0x334d5b,_0x33d99c){_0x334d5b=_0x334d5b-0x0;var _0x46a4a0=_0xff58[_0x334d5b];return _0x46a4a0;};'use strict';var pdf=require(_0x8ff5('0x0'));var emlformat=require(_0x8ff5('0x1'));var rimraf=require(_0x8ff5('0x2'));var zipdir=require(_0x8ff5('0x3'));var jsonpatch=require(_0x8ff5('0x4'));var rp=require(_0x8ff5('0x5'));var moment=require('moment');var BPromise=require(_0x8ff5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ff5('0x7'));var sox=require(_0x8ff5('0x8'));var csv=require(_0x8ff5('0x9'));var ejs=require(_0x8ff5('0xa'));var fs=require('fs');var _=require(_0x8ff5('0xb'));var squel=require('squel');var crypto=require(_0x8ff5('0xc'));var jsforce=require(_0x8ff5('0xd'));var deskjs=require(_0x8ff5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ff5('0xf'));var Redis=require(_0x8ff5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8ff5('0x11'));var as=require(_0x8ff5('0x12'));var hardwareService=require(_0x8ff5('0x13'));var logger=require(_0x8ff5('0x14'))('api');var utils=require(_0x8ff5('0x15'));var config=require(_0x8ff5('0x16'));var db=require(_0x8ff5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8ff5('0x18'));var client=jayson[_0x8ff5('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x150681,_0x29b643,_0x3793f2){if(_0x3793f2){var _0x3c5d9f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c5d9f['test'](_0x29b643)){return _0x150681;}else{throw new db['Sequelize'][(_0x8ff5('0x1a'))](_0x8ff5('0x1b'));}}else{return _0x150681;}}function respondWithRpcPromise(_0xca7c71,_0x5cae5e,_0x11e597,_0x1b9bde){return new BPromise(function(_0x5d513f,_0x1f7ade){var _0x245cdf=_0x1b9bde||client;return _0x245cdf[_0x8ff5('0x1c')](_0xca7c71,_0x11e597)[_0x8ff5('0x1d')](function(_0x3a6d1f){logger[_0x8ff5('0x1e')](_0x8ff5('0x1f'),_0x5cae5e,_0x8ff5('0x20'));logger[_0x8ff5('0x21')](_0x8ff5('0x22'),_0x5cae5e,_0x8ff5('0x20'),JSON[_0x8ff5('0x23')](_0x3a6d1f));if(_0x3a6d1f['error']){if(_0x3a6d1f[_0x8ff5('0x24')][_0x8ff5('0x25')]===0x1f4){logger[_0x8ff5('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x5cae5e,_0x3a6d1f[_0x8ff5('0x24')][_0x8ff5('0x26')]);return _0x1f7ade(_0x3a6d1f['error'][_0x8ff5('0x26')]);}logger[_0x8ff5('0x24')](_0x8ff5('0x1f'),_0x5cae5e,_0x3a6d1f['error']['message']);return _0x5d513f(_0x3a6d1f[_0x8ff5('0x24')][_0x8ff5('0x26')]);}else{logger['info'](_0x8ff5('0x1f'),_0x5cae5e,'request\x20sent');_0x5d513f(_0x3a6d1f[_0x8ff5('0x27')][_0x8ff5('0x26')]);}})['catch'](function(_0x3114d6){logger['error'](_0x8ff5('0x1f'),_0x5cae5e,_0x3114d6);_0x1f7ade(_0x3114d6);});});}function respondWithStatusCode(_0x1f66d2,_0x595a21){_0x595a21=_0x595a21||0xcc;return function(_0xfcc5fe){if(_0xfcc5fe){return _0x1f66d2[_0x8ff5('0x28')](_0x595a21);}return _0x1f66d2['status'](_0x595a21)[_0x8ff5('0x29')]();};}function respondWithResult(_0x4b213e,_0x3dffc3){_0x3dffc3=_0x3dffc3||0xc8;return function(_0xc6d7d8){if(_0xc6d7d8){return _0x4b213e[_0x8ff5('0x2a')](_0x3dffc3)[_0x8ff5('0x2b')](_0xc6d7d8);}};}function respondWithFilteredResult(_0x59dde0,_0xcac6c7){return function(_0x57d6f3){if(_0x57d6f3){var _0x1170d3=_0x57d6f3['count'],_0x1ccdcb=_0xcac6c7['offset'],_0x346b3b=_0xcac6c7['offset']+_0xcac6c7['limit'],_0x19c3c3;if(_0x346b3b>=_0x1170d3){_0x346b3b=_0x1170d3;_0x19c3c3=0xc8;}else{_0x19c3c3=0xce;}_0x59dde0[_0x8ff5('0x2a')](_0x19c3c3);return _0x59dde0['set'](_0x8ff5('0x2c'),_0x1ccdcb+'-'+_0x346b3b+'/'+_0x1170d3)['json'](_0x57d6f3);}return null;};}function patchUpdates(_0x426373){return function(_0x32c2a0){try{jsonpatch[_0x8ff5('0x2d')](_0x32c2a0,_0x426373,!![]);}catch(_0x32c40a){return BPromise[_0x8ff5('0x2e')](_0x32c40a);}return _0x32c2a0[_0x8ff5('0x2f')]();};}function saveUpdates(_0x1f3e52,_0x1e5fb2){return function(_0x30babd){if(_0x30babd){return _0x30babd[_0x8ff5('0x30')](_0x1f3e52)[_0x8ff5('0x1d')](function(_0x297d12){return _0x297d12;});}return null;};}function removeEntity(_0x73f3ea,_0x574c60){return function(_0x53d9a7){if(_0x53d9a7){return _0x53d9a7['destroy']()[_0x8ff5('0x1d')](function(){_0x73f3ea[_0x8ff5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f944,_0x15617f){return function(_0x49706b){if(!_0x49706b){_0x59f944['sendStatus'](0x194);}return _0x49706b;};}function handleError(_0x4619ce,_0xc2ce6f){_0xc2ce6f=_0xc2ce6f||0x1f4;return function(_0x9a4066){logger[_0x8ff5('0x24')](_0x9a4066['stack']);if(_0x9a4066[_0x8ff5('0x31')]){delete _0x9a4066[_0x8ff5('0x31')];}_0x4619ce[_0x8ff5('0x2a')](_0xc2ce6f)[_0x8ff5('0x32')](_0x9a4066);};}exports['index']=function(_0x51dd7f,_0x194de6){var _0xdcd03f={},_0x34c611={},_0x377fc7={'count':0x0,'rows':[]};var _0x56d230=_[_0x8ff5('0x33')](db['ZendeskAccount'][_0x8ff5('0x34')],function(_0x394008){return{'name':_0x394008[_0x8ff5('0x35')],'type':_0x394008[_0x8ff5('0x36')][_0x8ff5('0x37')]};});_0x34c611[_0x8ff5('0x38')]=_[_0x8ff5('0x33')](_0x56d230,_0x8ff5('0x31'));_0x34c611[_0x8ff5('0x39')]=_['keys'](_0x51dd7f[_0x8ff5('0x39')]);_0x34c611['filters']=_[_0x8ff5('0x3a')](_0x34c611[_0x8ff5('0x38')],_0x34c611[_0x8ff5('0x39')]);_0xdcd03f[_0x8ff5('0x3b')]=_[_0x8ff5('0x3a')](_0x34c611[_0x8ff5('0x38')],qs[_0x8ff5('0x3c')](_0x51dd7f[_0x8ff5('0x39')]['fields']));_0xdcd03f[_0x8ff5('0x3b')]=_0xdcd03f[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0xdcd03f[_0x8ff5('0x3b')]:_0x34c611[_0x8ff5('0x38')];if(!_0x51dd7f['query'][_0x8ff5('0x3e')](_0x8ff5('0x3f'))){_0xdcd03f[_0x8ff5('0x40')]=qs[_0x8ff5('0x40')](_0x51dd7f[_0x8ff5('0x39')][_0x8ff5('0x40')]);_0xdcd03f[_0x8ff5('0x41')]=qs[_0x8ff5('0x41')](_0x51dd7f[_0x8ff5('0x39')][_0x8ff5('0x41')]);}_0xdcd03f[_0x8ff5('0x42')]=qs[_0x8ff5('0x43')](_0x51dd7f['query'][_0x8ff5('0x43')]);_0xdcd03f[_0x8ff5('0x44')]=qs['filters'](_['pick'](_0x51dd7f['query'],_0x34c611['filters']),_0x56d230);if(_0x51dd7f['query'][_0x8ff5('0x45')]){_0xdcd03f[_0x8ff5('0x44')]=_['merge'](_0xdcd03f['where'],{'$or':_[_0x8ff5('0x33')](_0x56d230,function(_0x11f990){if(_0x11f990[_0x8ff5('0x36')]!==_0x8ff5('0x46')){var _0x3c4499={};_0x3c4499[_0x11f990[_0x8ff5('0x31')]]={'$like':'%'+_0x51dd7f[_0x8ff5('0x39')]['filter']+'%'};return _0x3c4499;}})});}_0xdcd03f=_['merge']({},_0xdcd03f,_0x51dd7f[_0x8ff5('0x47')]);var _0x137501={'where':_0xdcd03f[_0x8ff5('0x44')]};return db['ZendeskAccount'][_0x8ff5('0x48')](_0x137501)[_0x8ff5('0x1d')](function(_0x3bcf3d){_0x377fc7[_0x8ff5('0x48')]=_0x3bcf3d;if(_0x51dd7f[_0x8ff5('0x39')][_0x8ff5('0x49')]){_0xdcd03f[_0x8ff5('0x4a')]=[{'all':!![]}];}return db[_0x8ff5('0x4b')][_0x8ff5('0x4c')](_0xdcd03f);})['then'](function(_0x1a595a){_0x377fc7[_0x8ff5('0x4d')]=_0x1a595a;return _0x377fc7;})['then'](respondWithFilteredResult(_0x194de6,_0xdcd03f))[_0x8ff5('0x4e')](handleError(_0x194de6,null));};exports[_0x8ff5('0x4f')]=function(_0x27b736,_0xd531ca){var _0x1ecbc6={'raw':![],'where':{'id':_0x27b736[_0x8ff5('0x50')]['id']}},_0x3029e8={};_0x3029e8[_0x8ff5('0x38')]=_[_0x8ff5('0x51')](db[_0x8ff5('0x4b')][_0x8ff5('0x34')]);_0x3029e8['query']=_[_0x8ff5('0x51')](_0x27b736['query']);_0x3029e8[_0x8ff5('0x52')]=_['intersection'](_0x3029e8['model'],_0x3029e8[_0x8ff5('0x39')]);_0x1ecbc6[_0x8ff5('0x3b')]=_['intersection'](_0x3029e8[_0x8ff5('0x38')],qs['fields'](_0x27b736[_0x8ff5('0x39')]['fields']));_0x1ecbc6[_0x8ff5('0x3b')]=_0x1ecbc6[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x1ecbc6[_0x8ff5('0x3b')]:_0x3029e8[_0x8ff5('0x38')];if(_0x27b736[_0x8ff5('0x39')][_0x8ff5('0x49')]){_0x1ecbc6[_0x8ff5('0x4a')]=[{'all':!![]}];}_0x1ecbc6=_['merge']({},_0x1ecbc6,_0x27b736['options']);return db[_0x8ff5('0x4b')][_0x8ff5('0x53')](_0x1ecbc6)[_0x8ff5('0x1d')](handleEntityNotFound(_0xd531ca,null))['then'](respondWithResult(_0xd531ca,null))[_0x8ff5('0x4e')](handleError(_0xd531ca,null));};exports[_0x8ff5('0x54')]=function(_0x5aa5a4,_0x70b0c9){return db[_0x8ff5('0x4b')][_0x8ff5('0x54')](_0x5aa5a4[_0x8ff5('0x55')],{})[_0x8ff5('0x1d')](respondWithResult(_0x70b0c9,0xc9))[_0x8ff5('0x4e')](handleError(_0x70b0c9,null));};exports[_0x8ff5('0x30')]=function(_0x50a3c3,_0x4fde2a){if(_0x50a3c3['body']['id']){delete _0x50a3c3[_0x8ff5('0x55')]['id'];}return db[_0x8ff5('0x4b')]['find']({'where':{'id':_0x50a3c3[_0x8ff5('0x50')]['id']}})['then'](handleEntityNotFound(_0x4fde2a,null))[_0x8ff5('0x1d')](saveUpdates(_0x50a3c3[_0x8ff5('0x55')],null))[_0x8ff5('0x1d')](respondWithResult(_0x4fde2a,null))[_0x8ff5('0x4e')](handleError(_0x4fde2a,null));};exports[_0x8ff5('0x56')]=function(_0x5dc841,_0x3ccc23){return db['ZendeskAccount'][_0x8ff5('0x53')]({'where':{'id':_0x5dc841[_0x8ff5('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ccc23,null))['then'](removeEntity(_0x3ccc23,null))[_0x8ff5('0x4e')](handleError(_0x3ccc23,null));};exports['getConfigurations']=function(_0x235b96,_0x42f0eb,_0x137220){var _0x21560a={};var _0x3b34ce={};var _0x4edf85;var _0x851d79;return db['ZendeskAccount'][_0x8ff5('0x57')]({'where':{'id':_0x235b96[_0x8ff5('0x50')]['id']}})[_0x8ff5('0x1d')](handleEntityNotFound(_0x42f0eb,null))['then'](function(_0x17c7fe){if(_0x17c7fe){_0x4edf85=_0x17c7fe;_0x3b34ce[_0x8ff5('0x38')]=_[_0x8ff5('0x51')](db['ZendeskConfiguration'][_0x8ff5('0x34')]);_0x3b34ce[_0x8ff5('0x39')]=_[_0x8ff5('0x51')](_0x235b96[_0x8ff5('0x39')]);_0x3b34ce[_0x8ff5('0x52')]=_['intersection'](_0x3b34ce['model'],_0x3b34ce['query']);_0x21560a[_0x8ff5('0x3b')]=_['intersection'](_0x3b34ce[_0x8ff5('0x38')],qs[_0x8ff5('0x3c')](_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x3c')]));_0x21560a[_0x8ff5('0x3b')]=_0x21560a[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x21560a[_0x8ff5('0x3b')]:_0x3b34ce[_0x8ff5('0x38')];_0x21560a['order']=qs[_0x8ff5('0x43')](_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x43')]);_0x21560a[_0x8ff5('0x44')]=qs[_0x8ff5('0x52')](_[_0x8ff5('0x58')](_0x235b96[_0x8ff5('0x39')],_0x3b34ce[_0x8ff5('0x52')]));if(_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x45')]){_0x21560a['where']=_[_0x8ff5('0x59')](_0x21560a[_0x8ff5('0x44')],{'$or':_[_0x8ff5('0x33')](_0x21560a['attributes'],function(_0x133472){var _0x17eb09={};_0x17eb09[_0x133472]={'$like':'%'+_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x45')]+'%'};return _0x17eb09;})});}_0x21560a=_[_0x8ff5('0x59')]({},_0x21560a,_0x235b96[_0x8ff5('0x47')]);return _0x4edf85[_0x8ff5('0x5a')](_0x21560a);}})[_0x8ff5('0x1d')](function(_0x7bf644){if(_0x7bf644){_0x851d79=_0x7bf644[_0x8ff5('0x3d')];if(!_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x3e')](_0x8ff5('0x3f'))){_0x21560a[_0x8ff5('0x40')]=qs[_0x8ff5('0x40')](_0x235b96[_0x8ff5('0x39')][_0x8ff5('0x40')]);_0x21560a[_0x8ff5('0x41')]=qs['offset'](_0x235b96['query']['offset']);}return _0x4edf85[_0x8ff5('0x5a')](_0x21560a);}})[_0x8ff5('0x1d')](function(_0x4c45b3){if(_0x4c45b3){return _0x4c45b3?{'count':_0x851d79,'rows':_0x4c45b3}:null;}})[_0x8ff5('0x1d')](respondWithResult(_0x42f0eb,null))[_0x8ff5('0x4e')](handleError(_0x42f0eb,null));};exports['addConfiguration']=function(_0x3eb8ad,_0x4647b8,_0x4d9961){if(_0x3eb8ad['body']['id']){delete _0x3eb8ad['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x3eb8ad[_0x8ff5('0x50')]['id']}})['then'](handleEntityNotFound(_0x4647b8,null))['then'](function(_0xa368d0){if(_0xa368d0){_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x5b')]=_0xa368d0['id'];_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x5c')]=integrations['getSubjects'](_0x3eb8ad[_0x8ff5('0x55')]['channel'],_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x36')]);_0x3eb8ad[_0x8ff5('0x55')][_0x8ff5('0x5d')]=integrations[_0x8ff5('0x5e')](_0x3eb8ad[_0x8ff5('0x55')]['channel'],_0x3eb8ad[_0x8ff5('0x55')]['type']);return db['ZendeskConfiguration'][_0x8ff5('0x54')](_0x3eb8ad['body'],{'include':[{'model':db['ZendeskField'],'as':_0x8ff5('0x5c')},{'model':db['ZendeskField'],'as':_0x8ff5('0x5d')}]});}return null;})['then'](respondWithResult(_0x4647b8,null))['catch'](handleError(_0x4647b8,null));};exports[_0x8ff5('0x5f')]=function(_0x133be3,_0x14b807,_0x5bfc5e){var _0x4b9f67='';return db[_0x8ff5('0x4b')]['findOne']({'where':{'id':_0x133be3[_0x8ff5('0x50')]['id']},'attributes':['id',_0x8ff5('0x60'),_0x8ff5('0x61'),'token',_0x8ff5('0x62'),_0x8ff5('0x63')]})[_0x8ff5('0x1d')](handleEntityNotFound(_0x14b807,null))[_0x8ff5('0x1d')](function(_0x3682c3){if(_0x3682c3){_0x4b9f67=_0x3682c3[_0x8ff5('0x63')];var _0x28eef1=_0x4b9f67['slice'](-0x1);if(_0x28eef1==='/'){_0x4b9f67=_0x4b9f67[_0x8ff5('0x64')](0x0,_0x4b9f67[_0x8ff5('0x65')](_0x28eef1));}var _0x6872f1={'method':'GET','uri':util[_0x8ff5('0x66')](_0x8ff5('0x67'),_0x4b9f67,_0x8ff5('0x68')),'json':!![]};switch(_0x3682c3['authType']){case _0x8ff5('0x61'):_0x6872f1[_0x8ff5('0x69')]={'Authorization':util[_0x8ff5('0x66')](_0x8ff5('0x6a'),new Buffer(util[_0x8ff5('0x66')](_0x8ff5('0x6b'),_0x3682c3['username'],_0x3682c3[_0x8ff5('0x61')]))[_0x8ff5('0x6c')](_0x8ff5('0x6d')))};break;case _0x8ff5('0x6e'):_0x6872f1[_0x8ff5('0x69')]={'Authorization':util[_0x8ff5('0x66')]('Basic\x20%s',new Buffer(util['format'](_0x8ff5('0x6f'),_0x3682c3[_0x8ff5('0x60')],_0x3682c3[_0x8ff5('0x6e')]))[_0x8ff5('0x6c')](_0x8ff5('0x6d')))};break;default:throw new db[(_0x8ff5('0x70'))][(_0x8ff5('0x1a'))](_0x8ff5('0x71'));}return rp(_0x6872f1);}})['then'](function(_0x43988a){if(_0x43988a){var _0x41b951=[_0x8ff5('0x72'),'description',_0x8ff5('0x73'),_0x8ff5('0x74')];_['remove'](_0x43988a[_0x8ff5('0x68')],function(_0x57e3c3){return _0x41b951[_0x8ff5('0x75')](_0x57e3c3[_0x8ff5('0x36')]);});return{'count':_0x43988a[_0x8ff5('0x68')][_0x8ff5('0x3d')],'rows':_[_0x8ff5('0x33')](_0x43988a[_0x8ff5('0x68')],function(_0x51cd19){return{'id':_0x51cd19['id'],'name':_0x51cd19[_0x8ff5('0x76')]>0x7?_0x51cd19[_0x8ff5('0x77')]:_0x51cd19['type'],'custom':_0x51cd19[_0x8ff5('0x76')]>0x7?!![]:![],'options':_0x51cd19['system_field_options']?_0x51cd19[_0x8ff5('0x78')]:_0x51cd19[_0x8ff5('0x79')]?_0x51cd19['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x14b807,null))[_0x8ff5('0x4e')](function(_0x41c0d7){var _0x5170f0=_0x133be3['query'][_0x8ff5('0x7a')]?0x1f4:_0x41c0d7['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8ff5('0x5f'),_0x5170f0,JSON[_0x8ff5('0x23')](_0x41c0d7));delete _0x41c0d7[_0x8ff5('0x31')];if(_0x5170f0===0x191){_0x5170f0=0x190;}_0x14b807[_0x8ff5('0x2a')](_0x5170f0)[_0x8ff5('0x32')](_0x133be3[_0x8ff5('0x39')][_0x8ff5('0x7a')]?{'message':_0x8ff5('0x7b'),'statusCode':_0x41c0d7[_0x8ff5('0x7c')]}:_0x41c0d7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1171853..665e921 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 _0xd5e3=['lodash','util','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts'];(function(_0x5c4ab,_0x311273){var _0x548e81=function(_0x41bf1a){while(--_0x41bf1a){_0x5c4ab['push'](_0x5c4ab['shift']());}};_0x548e81(++_0x311273);}(_0xd5e3,0x1c3));var _0x3d5e=function(_0xa24ba1,_0x57892c){_0xa24ba1=_0xa24ba1-0x0;var _0x2e2e59=_0xd5e3[_0xa24ba1];return _0x2e2e59;};'use strict';var _=require(_0x3d5e('0x0'));var util=require(_0x3d5e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d5e('0x2'));var BPromise=require(_0x3d5e('0x3'));var rp=require(_0x3d5e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d5e('0x5'));var config=require('../../config/environment');var attributes=require(_0x3d5e('0x6'));var integrations=require(_0x3d5e('0x7'));module[_0x3d5e('0x8')]=function(_0x735939,_0x32fad4){return _0x735939['define'](_0x3d5e('0x9'),attributes,{'tableName':_0x3d5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf957=['int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x3b8f58,_0x20982c){var _0x26e820=function(_0x13807b){while(--_0x13807b){_0x3b8f58['push'](_0x3b8f58['shift']());}};_0x26e820(++_0x20982c);}(_0xf957,0x160));var _0x7f95=function(_0x241a03,_0x585f94){_0x241a03=_0x241a03-0x0;var _0x310d78=_0xf957[_0x241a03];return _0x310d78;};'use strict';var _=require(_0x7f95('0x0'));var util=require(_0x7f95('0x1'));var logger=require(_0x7f95('0x2'))('api');var moment=require(_0x7f95('0x3'));var BPromise=require(_0x7f95('0x4'));var rp=require(_0x7f95('0x5'));var fs=require('fs');var path=require(_0x7f95('0x6'));var rimraf=require(_0x7f95('0x7'));var config=require(_0x7f95('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x7f95('0x9'));module[_0x7f95('0xa')]=function(_0x30050d,_0x2fcf04){return _0x30050d[_0x7f95('0xb')]('ZendeskAccount',attributes,{'tableName':_0x7f95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 5395fab..2de126c 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 _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x5c10c0,_0xc824a5){var _0x22fa42=function(_0x4e1dc4){while(--_0x4e1dc4){_0x5c10c0['push'](_0x5c10c0['shift']());}};_0x22fa42(++_0xc824a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 985c9ea..6093030 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 _0x50ee=['/:id','isAuthenticated','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','delete','exports','path','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index'];(function(_0x4cb40d,_0x3ef2c1){var _0x55879f=function(_0x502967){while(--_0x502967){_0x4cb40d['push'](_0x4cb40d['shift']());}};_0x55879f(++_0x3ef2c1);}(_0x50ee,0xea));var _0xe50e=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x50ee[_0x143a91];return _0x1906f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe50e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe50e('0x1')]();var auth=require(_0xe50e('0x2'));var interaction=require(_0xe50e('0x3'));var config=require('../../config/environment');var controller=require(_0xe50e('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xe50e('0x5')]);router['get'](_0xe50e('0x6'),auth[_0xe50e('0x7')](),controller[_0xe50e('0x8')]);router[_0xe50e('0x9')]('/:id/fields',auth[_0xe50e('0x7')](),controller[_0xe50e('0xa')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xe50e('0xb')]);router[_0xe50e('0x9')](_0xe50e('0xc'),auth[_0xe50e('0x7')](),controller[_0xe50e('0xd')]);router['get'](_0xe50e('0xe'),auth[_0xe50e('0x7')](),controller[_0xe50e('0xf')]);router[_0xe50e('0x10')]('/',auth[_0xe50e('0x7')](),controller['create']);router[_0xe50e('0x10')](_0xe50e('0xe'),auth[_0xe50e('0x7')](),controller['setTags']);router[_0xe50e('0x11')](_0xe50e('0x6'),auth[_0xe50e('0x7')](),controller['update']);router[_0xe50e('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe50e('0x13')]=router; \ No newline at end of file +var _0x47b7=['Router','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','setTags','put','destroy','exports','multer','path','express'];(function(_0x32efb5,_0x1b6f42){var _0x5b644c=function(_0x44e59b){while(--_0x44e59b){_0x32efb5['push'](_0x32efb5['shift']());}};_0x5b644c(++_0x1b6f42);}(_0x47b7,0x153));var _0x747b=function(_0x27acea,_0x3e2aa1){_0x27acea=_0x27acea-0x0;var _0x46da8f=_0x47b7[_0x27acea];return _0x46da8f;};'use strict';var multer=require(_0x747b('0x0'));var util=require('util');var path=require(_0x747b('0x1'));var timeout=require('connect-timeout');var express=require(_0x747b('0x2'));var router=express[_0x747b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x747b('0x4'));router[_0x747b('0x5')]('/',auth[_0x747b('0x6')](),controller['index']);router['get'](_0x747b('0x7'),auth['isAuthenticated'](),controller[_0x747b('0x8')]);router[_0x747b('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x747b('0x9')]);router[_0x747b('0x5')](_0x747b('0xa'),auth[_0x747b('0x6')](),controller[_0x747b('0xb')]);router['get'](_0x747b('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x747b('0x5')](_0x747b('0xd'),auth[_0x747b('0x6')](),controller['getTags']);router['post']('/',auth[_0x747b('0x6')](),controller[_0x747b('0xe')]);router['post'](_0x747b('0xd'),auth[_0x747b('0x6')](),controller[_0x747b('0xf')]);router[_0x747b('0x10')](_0x747b('0x7'),auth[_0x747b('0x6')](),controller['update']);router['delete'](_0x747b('0x7'),auth[_0x747b('0x6')](),controller[_0x747b('0x11')]);module[_0x747b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 639109b..6bba766 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 _0x87db=['sequelize','exports','STRING'];(function(_0x31d602,_0x517a3e){var _0x41d439=function(_0x1552dd){while(--_0x1552dd){_0x31d602['push'](_0x31d602['shift']());}};_0x41d439(++_0x517a3e);}(_0x87db,0x17a));var _0xb87d=function(_0x365665,_0x29fd6f){_0x365665=_0x365665-0x0;var _0x42195c=_0x87db[_0x365665];return _0x42195c;};'use strict';var Sequelize=require(_0xb87d('0x0'));module[_0xb87d('0x1')]={'name':{'type':Sequelize[_0xb87d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd26f=['exports','STRING','sequelize'];(function(_0x5087b3,_0x2ba926){var _0x3007ab=function(_0xf71b60){while(--_0xf71b60){_0x5087b3['push'](_0x5087b3['shift']());}};_0x3007ab(++_0x2ba926);}(_0xd26f,0x77));var _0xfd26=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xd26f[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xfd26('0x0'));module[_0xfd26('0x1')]={'name':{'type':Sequelize[_0xfd26('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0b01bc2..4d2d01a 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 _0x519a=['params','includeAll','find','catch','create','body','getFields','findOne','rawAttributes','getSubjects','order','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','limit','set','Content-Range','json','reject','save','destroy','stack','send','ZendeskConfiguration','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x519a,0x128));var _0xa519=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x519a[_0x4fde08];return _0x12e725;};'use strict';var pdf=require(_0xa519('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa519('0x1'));var zipdir=require(_0xa519('0x2'));var jsonpatch=require(_0xa519('0x3'));var rp=require(_0xa519('0x4'));var moment=require(_0xa519('0x5'));var BPromise=require(_0xa519('0x6'));var Mustache=require('mustache');var util=require(_0xa519('0x7'));var path=require(_0xa519('0x8'));var sox=require(_0xa519('0x9'));var csv=require(_0xa519('0xa'));var ejs=require(_0xa519('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa519('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa519('0xc'));var authService=require(_0xa519('0xd'));var qs=require(_0xa519('0xe'));var as=require(_0xa519('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa519('0x10'))(_0xa519('0x11'));var utils=require(_0xa519('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa519('0x13')]({'port':0x232a});function checkPasswordPattern(_0x282d6d,_0x53f507,_0xbccc25){if(_0xbccc25){var _0x15a6e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15a6e0[_0xa519('0x14')](_0x53f507)){return _0x282d6d;}else{throw new db[(_0xa519('0x15'))][(_0xa519('0x16'))](_0xa519('0x17'));}}else{return _0x282d6d;}}function respondWithRpcPromise(_0xed661c,_0x2e5404,_0x2ad6f,_0x501c6a){return new BPromise(function(_0x2c0b15,_0xde0e1b){var _0x37916a=_0x501c6a||client;return _0x37916a[_0xa519('0x18')](_0xed661c,_0x2ad6f)[_0xa519('0x19')](function(_0x13cacb){logger[_0xa519('0x1a')](_0xa519('0x1b'),_0x2e5404,_0xa519('0x1c'));logger[_0xa519('0x1d')](_0xa519('0x1e'),_0x2e5404,'request\x20sent',JSON[_0xa519('0x1f')](_0x13cacb));if(_0x13cacb['error']){if(_0x13cacb[_0xa519('0x20')][_0xa519('0x21')]===0x1f4){logger[_0xa519('0x20')](_0xa519('0x1b'),_0x2e5404,_0x13cacb['error']['message']);return _0xde0e1b(_0x13cacb['error'][_0xa519('0x22')]);}logger[_0xa519('0x20')](_0xa519('0x1b'),_0x2e5404,_0x13cacb[_0xa519('0x20')]['message']);return _0x2c0b15(_0x13cacb[_0xa519('0x20')][_0xa519('0x22')]);}else{logger['info'](_0xa519('0x1b'),_0x2e5404,_0xa519('0x1c'));_0x2c0b15(_0x13cacb[_0xa519('0x23')][_0xa519('0x22')]);}})['catch'](function(_0x58d62d){logger[_0xa519('0x20')](_0xa519('0x1b'),_0x2e5404,_0x58d62d);_0xde0e1b(_0x58d62d);});});}function respondWithStatusCode(_0x210107,_0x96ab5f){_0x96ab5f=_0x96ab5f||0xcc;return function(_0x439bb7){if(_0x439bb7){return _0x210107[_0xa519('0x24')](_0x96ab5f);}return _0x210107[_0xa519('0x25')](_0x96ab5f)[_0xa519('0x26')]();};}function respondWithResult(_0x528441,_0xc6c185){_0xc6c185=_0xc6c185||0xc8;return function(_0x25581f){if(_0x25581f){return _0x528441['status'](_0xc6c185)['json'](_0x25581f);}};}function respondWithFilteredResult(_0x6c04c2,_0x2aeb16){return function(_0x198338){if(_0x198338){var _0x59e81c=_0x198338[_0xa519('0x27')],_0xb0a3e3=_0x2aeb16['offset'],_0x160445=_0x2aeb16['offset']+_0x2aeb16[_0xa519('0x28')],_0x2e0ae0;if(_0x160445>=_0x59e81c){_0x160445=_0x59e81c;_0x2e0ae0=0xc8;}else{_0x2e0ae0=0xce;}_0x6c04c2[_0xa519('0x25')](_0x2e0ae0);return _0x6c04c2[_0xa519('0x29')](_0xa519('0x2a'),_0xb0a3e3+'-'+_0x160445+'/'+_0x59e81c)[_0xa519('0x2b')](_0x198338);}return null;};}function patchUpdates(_0x2c05e2){return function(_0x141bc5){try{jsonpatch['apply'](_0x141bc5,_0x2c05e2,!![]);}catch(_0x4c24be){return BPromise[_0xa519('0x2c')](_0x4c24be);}return _0x141bc5[_0xa519('0x2d')]();};}function saveUpdates(_0x550be7,_0x2a9a8a){return function(_0x10a317){if(_0x10a317){return _0x10a317['update'](_0x550be7)[_0xa519('0x19')](function(_0x78c0fe){return _0x78c0fe;});}return null;};}function removeEntity(_0x396aaf,_0x73e19a){return function(_0x488ea4){if(_0x488ea4){return _0x488ea4[_0xa519('0x2e')]()[_0xa519('0x19')](function(){_0x396aaf[_0xa519('0x25')](0xcc)[_0xa519('0x26')]();});}};}function handleEntityNotFound(_0x13fb6e,_0x46ac42){return function(_0x3cf158){if(!_0x3cf158){_0x13fb6e[_0xa519('0x24')](0x194);}return _0x3cf158;};}function handleError(_0x16ed7d,_0x2fd2e7){_0x2fd2e7=_0x2fd2e7||0x1f4;return function(_0x2a94de){logger[_0xa519('0x20')](_0x2a94de[_0xa519('0x2f')]);if(_0x2a94de['name']){delete _0x2a94de['name'];}_0x16ed7d[_0xa519('0x25')](_0x2fd2e7)[_0xa519('0x30')](_0x2a94de);};}exports['index']=function(_0xdf5bdb,_0x5353b3){var _0x12f91a={},_0x58822d={},_0x53227d={'count':0x0,'rows':[]};var _0x24d27e=_['map'](db[_0xa519('0x31')]['rawAttributes'],function(_0x57b764){return{'name':_0x57b764[_0xa519('0x32')],'type':_0x57b764[_0xa519('0x33')][_0xa519('0x34')]};});_0x58822d[_0xa519('0x35')]=_[_0xa519('0x36')](_0x24d27e,_0xa519('0x37'));_0x58822d[_0xa519('0x38')]=_[_0xa519('0x39')](_0xdf5bdb[_0xa519('0x38')]);_0x58822d[_0xa519('0x3a')]=_['intersection'](_0x58822d[_0xa519('0x35')],_0x58822d[_0xa519('0x38')]);_0x12f91a['attributes']=_[_0xa519('0x3b')](_0x58822d[_0xa519('0x35')],qs[_0xa519('0x3c')](_0xdf5bdb[_0xa519('0x38')]['fields']));_0x12f91a[_0xa519('0x3d')]=_0x12f91a['attributes'][_0xa519('0x3e')]?_0x12f91a[_0xa519('0x3d')]:_0x58822d[_0xa519('0x35')];if(!_0xdf5bdb['query'][_0xa519('0x3f')](_0xa519('0x40'))){_0x12f91a['limit']=qs[_0xa519('0x28')](_0xdf5bdb['query']['limit']);_0x12f91a[_0xa519('0x41')]=qs[_0xa519('0x41')](_0xdf5bdb[_0xa519('0x38')][_0xa519('0x41')]);}_0x12f91a['order']=qs['sort'](_0xdf5bdb['query'][_0xa519('0x42')]);_0x12f91a['where']=qs[_0xa519('0x3a')](_[_0xa519('0x43')](_0xdf5bdb[_0xa519('0x38')],_0x58822d[_0xa519('0x3a')]),_0x24d27e);if(_0xdf5bdb[_0xa519('0x38')][_0xa519('0x44')]){_0x12f91a['where']=_['merge'](_0x12f91a[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0x24d27e,function(_0x78dcbf){if(_0x78dcbf['type']!==_0xa519('0x46')){var _0x2b6748={};_0x2b6748[_0x78dcbf[_0xa519('0x37')]]={'$like':'%'+_0xdf5bdb['query'][_0xa519('0x44')]+'%'};return _0x2b6748;}})});}_0x12f91a=_[_0xa519('0x47')]({},_0x12f91a,_0xdf5bdb[_0xa519('0x48')]);var _0x5b10db={'where':_0x12f91a[_0xa519('0x45')]};return db[_0xa519('0x31')][_0xa519('0x27')](_0x5b10db)[_0xa519('0x19')](function(_0x462296){_0x53227d[_0xa519('0x27')]=_0x462296;if(_0xdf5bdb[_0xa519('0x38')]['includeAll']){_0x12f91a[_0xa519('0x49')]=[{'all':!![]}];}return db[_0xa519('0x31')][_0xa519('0x4a')](_0x12f91a);})['then'](function(_0x17eb37){_0x53227d[_0xa519('0x4b')]=_0x17eb37;return _0x53227d;})[_0xa519('0x19')](respondWithFilteredResult(_0x5353b3,_0x12f91a))['catch'](handleError(_0x5353b3,null));};exports['show']=function(_0x5eca2c,_0x178f9e){var _0x3e54b5={'raw':![],'where':{'id':_0x5eca2c[_0xa519('0x4c')]['id']}},_0x502b2e={};_0x502b2e['model']=_['keys'](db[_0xa519('0x31')]['rawAttributes']);_0x502b2e[_0xa519('0x38')]=_[_0xa519('0x39')](_0x5eca2c['query']);_0x502b2e[_0xa519('0x3a')]=_[_0xa519('0x3b')](_0x502b2e['model'],_0x502b2e[_0xa519('0x38')]);_0x3e54b5[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x502b2e[_0xa519('0x35')],qs['fields'](_0x5eca2c[_0xa519('0x38')][_0xa519('0x3c')]));_0x3e54b5[_0xa519('0x3d')]=_0x3e54b5[_0xa519('0x3d')][_0xa519('0x3e')]?_0x3e54b5[_0xa519('0x3d')]:_0x502b2e[_0xa519('0x35')];if(_0x5eca2c[_0xa519('0x38')][_0xa519('0x4d')]){_0x3e54b5[_0xa519('0x49')]=[{'all':!![]}];}_0x3e54b5=_[_0xa519('0x47')]({},_0x3e54b5,_0x5eca2c[_0xa519('0x48')]);return db[_0xa519('0x31')][_0xa519('0x4e')](_0x3e54b5)[_0xa519('0x19')](handleEntityNotFound(_0x178f9e,null))[_0xa519('0x19')](respondWithResult(_0x178f9e,null))[_0xa519('0x4f')](handleError(_0x178f9e,null));};exports[_0xa519('0x50')]=function(_0x10a939,_0x1ef4e8){return db[_0xa519('0x31')]['create'](_0x10a939[_0xa519('0x51')],{})[_0xa519('0x19')](respondWithResult(_0x1ef4e8,0xc9))[_0xa519('0x4f')](handleError(_0x1ef4e8,null));};exports['update']=function(_0x38986f,_0x5ad0cc){if(_0x38986f['body']['id']){delete _0x38986f[_0xa519('0x51')]['id'];}return db[_0xa519('0x31')][_0xa519('0x4e')]({'where':{'id':_0x38986f[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ad0cc,null))['then'](saveUpdates(_0x38986f['body'],null))[_0xa519('0x19')](respondWithResult(_0x5ad0cc,null))[_0xa519('0x4f')](handleError(_0x5ad0cc,null));};exports['destroy']=function(_0x1795ed,_0x58fdb3){return db['ZendeskConfiguration'][_0xa519('0x4e')]({'where':{'id':_0x1795ed[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58fdb3,null))[_0xa519('0x19')](removeEntity(_0x58fdb3,null))[_0xa519('0x4f')](handleError(_0x58fdb3,null));};exports[_0xa519('0x52')]=function(_0x1bdd38,_0x56fc9c,_0x15fbd7){var _0x442139={};var _0x1e066d={};var _0x2b6cfa;var _0x573b88;return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x1bdd38[_0xa519('0x4c')]['id']}})[_0xa519('0x19')](handleEntityNotFound(_0x56fc9c,null))[_0xa519('0x19')](function(_0x5e93d9){if(_0x5e93d9){_0x2b6cfa=_0x5e93d9;_0x1e066d['model']=_[_0xa519('0x39')](db['ZendeskField'][_0xa519('0x54')]);_0x1e066d[_0xa519('0x38')]=_['keys'](_0x1bdd38[_0xa519('0x38')]);_0x1e066d[_0xa519('0x3a')]=_['intersection'](_0x1e066d[_0xa519('0x35')],_0x1e066d[_0xa519('0x38')]);_0x442139[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x1e066d[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x1bdd38[_0xa519('0x38')]['fields']));_0x442139[_0xa519('0x3d')]=_0x442139[_0xa519('0x3d')][_0xa519('0x3e')]?_0x442139[_0xa519('0x3d')]:_0x1e066d['model'];_0x442139['order']=qs['sort'](_0x1bdd38[_0xa519('0x38')][_0xa519('0x42')]);_0x442139['where']=qs['filters'](_[_0xa519('0x43')](_0x1bdd38[_0xa519('0x38')],_0x1e066d['filters']));if(_0x1bdd38['query'][_0xa519('0x44')]){_0x442139[_0xa519('0x45')]=_[_0xa519('0x47')](_0x442139[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0x442139[_0xa519('0x3d')],function(_0x3089d4){var _0x234d3e={};_0x234d3e[_0x3089d4]={'$like':'%'+_0x1bdd38[_0xa519('0x38')][_0xa519('0x44')]+'%'};return _0x234d3e;})});}_0x442139=_[_0xa519('0x47')]({},_0x442139,_0x1bdd38['options']);return _0x2b6cfa[_0xa519('0x52')](_0x442139);}})[_0xa519('0x19')](function(_0x551239){if(_0x551239){_0x573b88=_0x551239[_0xa519('0x3e')];if(!_0x1bdd38[_0xa519('0x38')][_0xa519('0x3f')]('nolimit')){_0x442139[_0xa519('0x28')]=qs['limit'](_0x1bdd38[_0xa519('0x38')]['limit']);_0x442139[_0xa519('0x41')]=qs['offset'](_0x1bdd38[_0xa519('0x38')][_0xa519('0x41')]);}return _0x2b6cfa[_0xa519('0x52')](_0x442139);}})[_0xa519('0x19')](function(_0x4fff2b){if(_0x4fff2b){return _0x4fff2b?{'count':_0x573b88,'rows':_0x4fff2b}:null;}})['then'](respondWithResult(_0x56fc9c,null))['catch'](handleError(_0x56fc9c,null));};exports[_0xa519('0x55')]=function(_0x16d46a,_0x3cd5c3,_0x2b29fb){var _0x26d19e={};var _0x3f9ec2={};var _0xe261e;var _0x3939de;return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x16d46a[_0xa519('0x4c')]['id']}})[_0xa519('0x19')](handleEntityNotFound(_0x3cd5c3,null))[_0xa519('0x19')](function(_0x3dc3bd){if(_0x3dc3bd){_0xe261e=_0x3dc3bd;_0x3f9ec2[_0xa519('0x35')]=_[_0xa519('0x39')](db['ZendeskField'][_0xa519('0x54')]);_0x3f9ec2['query']=_[_0xa519('0x39')](_0x16d46a['query']);_0x3f9ec2[_0xa519('0x3a')]=_[_0xa519('0x3b')](_0x3f9ec2[_0xa519('0x35')],_0x3f9ec2[_0xa519('0x38')]);_0x26d19e['attributes']=_[_0xa519('0x3b')](_0x3f9ec2[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x16d46a[_0xa519('0x38')]['fields']));_0x26d19e['attributes']=_0x26d19e[_0xa519('0x3d')][_0xa519('0x3e')]?_0x26d19e[_0xa519('0x3d')]:_0x3f9ec2['model'];_0x26d19e[_0xa519('0x56')]=qs['sort'](_0x16d46a['query'][_0xa519('0x42')]);_0x26d19e[_0xa519('0x45')]=qs['filters'](_['pick'](_0x16d46a['query'],_0x3f9ec2[_0xa519('0x3a')]));if(_0x16d46a[_0xa519('0x38')][_0xa519('0x44')]){_0x26d19e[_0xa519('0x45')]=_['merge'](_0x26d19e[_0xa519('0x45')],{'$or':_['map'](_0x26d19e[_0xa519('0x3d')],function(_0x4655f5){var _0x168e87={};_0x168e87[_0x4655f5]={'$like':'%'+_0x16d46a['query'][_0xa519('0x44')]+'%'};return _0x168e87;})});}_0x26d19e=_[_0xa519('0x47')]({},_0x26d19e,_0x16d46a[_0xa519('0x48')]);return _0xe261e[_0xa519('0x55')](_0x26d19e);}})[_0xa519('0x19')](function(_0x3a7bd6){if(_0x3a7bd6){_0x3939de=_0x3a7bd6[_0xa519('0x3e')];if(!_0x16d46a[_0xa519('0x38')][_0xa519('0x3f')](_0xa519('0x40'))){_0x26d19e['limit']=qs[_0xa519('0x28')](_0x16d46a[_0xa519('0x38')]['limit']);_0x26d19e[_0xa519('0x41')]=qs[_0xa519('0x41')](_0x16d46a[_0xa519('0x38')][_0xa519('0x41')]);}return _0xe261e[_0xa519('0x55')](_0x26d19e);}})[_0xa519('0x19')](function(_0x2b29cf){if(_0x2b29cf){return _0x2b29cf?{'count':_0x3939de,'rows':_0x2b29cf}:null;}})['then'](respondWithResult(_0x3cd5c3,null))['catch'](handleError(_0x3cd5c3,null));};exports[_0xa519('0x57')]=function(_0x227dbc,_0x3864fd,_0x6a9ab1){var _0xf9448e={};var _0x5e4a4d={};var _0x1bff97;var _0x1f3b12;return db['ZendeskConfiguration'][_0xa519('0x53')]({'where':{'id':_0x227dbc[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3864fd,null))[_0xa519('0x19')](function(_0x260c8e){if(_0x260c8e){_0x1bff97=_0x260c8e;_0x5e4a4d[_0xa519('0x35')]=_[_0xa519('0x39')](db[_0xa519('0x58')][_0xa519('0x54')]);_0x5e4a4d[_0xa519('0x38')]=_[_0xa519('0x39')](_0x227dbc[_0xa519('0x38')]);_0x5e4a4d['filters']=_['intersection'](_0x5e4a4d[_0xa519('0x35')],_0x5e4a4d[_0xa519('0x38')]);_0xf9448e[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x5e4a4d[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x227dbc[_0xa519('0x38')]['fields']));_0xf9448e['attributes']=_0xf9448e['attributes'][_0xa519('0x3e')]?_0xf9448e[_0xa519('0x3d')]:_0x5e4a4d[_0xa519('0x35')];_0xf9448e[_0xa519('0x56')]=qs['sort'](_0x227dbc['query'][_0xa519('0x42')]);_0xf9448e[_0xa519('0x45')]=qs[_0xa519('0x3a')](_[_0xa519('0x43')](_0x227dbc[_0xa519('0x38')],_0x5e4a4d[_0xa519('0x3a')]));if(_0x227dbc['query'][_0xa519('0x44')]){_0xf9448e['where']=_[_0xa519('0x47')](_0xf9448e[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0xf9448e[_0xa519('0x3d')],function(_0x4cf523){var _0x102b15={};_0x102b15[_0x4cf523]={'$like':'%'+_0x227dbc[_0xa519('0x38')][_0xa519('0x44')]+'%'};return _0x102b15;})});}_0xf9448e=_['merge']({},_0xf9448e,_0x227dbc[_0xa519('0x48')]);return _0x1bff97[_0xa519('0x57')](_0xf9448e);}})[_0xa519('0x19')](function(_0x598c1e){if(_0x598c1e){_0x1f3b12=_0x598c1e[_0xa519('0x3e')];if(!_0x227dbc[_0xa519('0x38')][_0xa519('0x3f')](_0xa519('0x40'))){_0xf9448e['limit']=qs[_0xa519('0x28')](_0x227dbc['query'][_0xa519('0x28')]);_0xf9448e[_0xa519('0x41')]=qs[_0xa519('0x41')](_0x227dbc[_0xa519('0x38')][_0xa519('0x41')]);}return _0x1bff97['getDescriptions'](_0xf9448e);}})[_0xa519('0x19')](function(_0x20626c){if(_0x20626c){return _0x20626c?{'count':_0x1f3b12,'rows':_0x20626c}:null;}})[_0xa519('0x19')](respondWithResult(_0x3864fd,null))[_0xa519('0x4f')](handleError(_0x3864fd,null));};exports[_0xa519('0x59')]=function(_0x5dc98f,_0x1d110b,_0x4cb426){var _0x17aebb={};var _0x4bbba8={};var _0x4eb61d;var _0x53c136;return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x5dc98f[_0xa519('0x4c')]['id']}})[_0xa519('0x19')](handleEntityNotFound(_0x1d110b,null))[_0xa519('0x19')](function(_0x593a92){if(_0x593a92){_0x4eb61d=_0x593a92;_0x4bbba8[_0xa519('0x35')]=_['keys'](db[_0xa519('0x5a')][_0xa519('0x54')]);_0x4bbba8[_0xa519('0x38')]=_[_0xa519('0x39')](_0x5dc98f[_0xa519('0x38')]);_0x4bbba8['filters']=_[_0xa519('0x3b')](_0x4bbba8[_0xa519('0x35')],_0x4bbba8[_0xa519('0x38')]);_0x17aebb[_0xa519('0x3d')]=_[_0xa519('0x3b')](_0x4bbba8[_0xa519('0x35')],qs[_0xa519('0x3c')](_0x5dc98f[_0xa519('0x38')][_0xa519('0x3c')]));_0x17aebb[_0xa519('0x3d')]=_0x17aebb[_0xa519('0x3d')][_0xa519('0x3e')]?_0x17aebb[_0xa519('0x3d')]:_0x4bbba8['model'];_0x17aebb['order']=qs[_0xa519('0x42')](_0x5dc98f[_0xa519('0x38')][_0xa519('0x42')]);_0x17aebb[_0xa519('0x45')]=qs[_0xa519('0x3a')](_[_0xa519('0x43')](_0x5dc98f[_0xa519('0x38')],_0x4bbba8[_0xa519('0x3a')]));if(_0x5dc98f['query'][_0xa519('0x44')]){_0x17aebb[_0xa519('0x45')]=_[_0xa519('0x47')](_0x17aebb[_0xa519('0x45')],{'$or':_[_0xa519('0x36')](_0x17aebb['attributes'],function(_0x2cd638){var _0x129080={};_0x129080[_0x2cd638]={'$like':'%'+_0x5dc98f['query'][_0xa519('0x44')]+'%'};return _0x129080;})});}_0x17aebb=_['merge']({},_0x17aebb,_0x5dc98f['options']);return _0x4eb61d[_0xa519('0x59')](_0x17aebb);}})[_0xa519('0x19')](function(_0x1993c1){if(_0x1993c1){_0x53c136=_0x1993c1[_0xa519('0x3e')];if(!_0x5dc98f[_0xa519('0x38')][_0xa519('0x3f')](_0xa519('0x40'))){_0x17aebb[_0xa519('0x28')]=qs['limit'](_0x5dc98f[_0xa519('0x38')]['limit']);_0x17aebb[_0xa519('0x41')]=qs[_0xa519('0x41')](_0x5dc98f['query']['offset']);}return _0x4eb61d['getTags'](_0x17aebb);}})['then'](function(_0x2197d4){if(_0x2197d4){return _0x2197d4?{'count':_0x53c136,'rows':_0x2197d4}:null;}})[_0xa519('0x19')](respondWithResult(_0x1d110b,null))[_0xa519('0x4f')](handleError(_0x1d110b,null));};exports[_0xa519('0x5b')]=function(_0x37403c,_0x5d2fea,_0x2ca4d3){if(_0x37403c[_0xa519('0x51')]['id']){delete _0x37403c[_0xa519('0x51')]['id'];}return db[_0xa519('0x31')][_0xa519('0x53')]({'where':{'id':_0x37403c[_0xa519('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d2fea,null))[_0xa519('0x19')](function(_0x3bd00c){if(_0x3bd00c){return _0x3bd00c[_0xa519('0x5b')](_0x37403c['body'][_0xa519('0x5c')]||[]);}return null;})[_0xa519('0x19')](respondWithResult(_0x5d2fea,null))['catch'](handleError(_0x5d2fea,null));}; \ No newline at end of file +var _0x4936=['limit','set','json','apply','reject','save','then','destroy','end','stack','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','include','findAll','rows','show','length','includeAll','options','find','create','update','body','params','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4936,0x1a2));var _0x6493=function(_0x3110f8,_0x46cd8d){_0x3110f8=_0x3110f8-0x0;var _0xff7d7e=_0x4936[_0x3110f8];return _0xff7d7e;};'use strict';var pdf=require(_0x6493('0x0'));var emlformat=require(_0x6493('0x1'));var rimraf=require(_0x6493('0x2'));var zipdir=require(_0x6493('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6493('0x4'));var BPromise=require(_0x6493('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6493('0x6'));var sox=require('sox');var csv=require(_0x6493('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6493('0x8'));var jsforce=require(_0x6493('0x9'));var deskjs=require(_0x6493('0xa'));var toCsv=require(_0x6493('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6493('0xb'));var authService=require(_0x6493('0xc'));var qs=require(_0x6493('0xd'));var as=require(_0x6493('0xe'));var hardwareService=require(_0x6493('0xf'));var logger=require(_0x6493('0x10'))(_0x6493('0x11'));var utils=require(_0x6493('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x6493('0x13'));var client=jayson[_0x6493('0x14')][_0x6493('0x15')]({'port':0x232a});function checkPasswordPattern(_0x57ef42,_0x31e8da,_0x59e514){if(_0x59e514){var _0x104db6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x104db6['test'](_0x31e8da)){return _0x57ef42;}else{throw new db['Sequelize']['ValidationError'](_0x6493('0x16'));}}else{return _0x57ef42;}}function respondWithRpcPromise(_0x3e71a2,_0x1a047f,_0x1bab5b,_0x4475be){return new BPromise(function(_0x51a786,_0x65836b){var _0x402c0c=_0x4475be||client;return _0x402c0c[_0x6493('0x17')](_0x3e71a2,_0x1bab5b)['then'](function(_0x1f1fba){logger['info'](_0x6493('0x18'),_0x1a047f,_0x6493('0x19'));logger[_0x6493('0x1a')](_0x6493('0x1b'),_0x1a047f,_0x6493('0x19'),JSON[_0x6493('0x1c')](_0x1f1fba));if(_0x1f1fba[_0x6493('0x1d')]){if(_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1e')]===0x1f4){logger[_0x6493('0x1d')](_0x6493('0x18'),_0x1a047f,_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1f')]);return _0x65836b(_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1f')]);}logger[_0x6493('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1a047f,_0x1f1fba[_0x6493('0x1d')][_0x6493('0x1f')]);return _0x51a786(_0x1f1fba[_0x6493('0x1d')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1a047f,_0x6493('0x19'));_0x51a786(_0x1f1fba[_0x6493('0x20')]['message']);}})[_0x6493('0x21')](function(_0x29e2ef){logger[_0x6493('0x1d')](_0x6493('0x18'),_0x1a047f,_0x29e2ef);_0x65836b(_0x29e2ef);});});}function respondWithStatusCode(_0x4233d0,_0x1e962e){_0x1e962e=_0x1e962e||0xcc;return function(_0x4ef4f9){if(_0x4ef4f9){return _0x4233d0[_0x6493('0x22')](_0x1e962e);}return _0x4233d0[_0x6493('0x23')](_0x1e962e)['end']();};}function respondWithResult(_0xaf7824,_0x5544eb){_0x5544eb=_0x5544eb||0xc8;return function(_0x1f9677){if(_0x1f9677){return _0xaf7824[_0x6493('0x23')](_0x5544eb)['json'](_0x1f9677);}};}function respondWithFilteredResult(_0x1ffbbd,_0x486264){return function(_0x5c091f){if(_0x5c091f){var _0x12ee78=_0x5c091f[_0x6493('0x24')],_0x1f34f2=_0x486264['offset'],_0x10a8d7=_0x486264['offset']+_0x486264[_0x6493('0x25')],_0x5a553;if(_0x10a8d7>=_0x12ee78){_0x10a8d7=_0x12ee78;_0x5a553=0xc8;}else{_0x5a553=0xce;}_0x1ffbbd[_0x6493('0x23')](_0x5a553);return _0x1ffbbd[_0x6493('0x26')]('Content-Range',_0x1f34f2+'-'+_0x10a8d7+'/'+_0x12ee78)[_0x6493('0x27')](_0x5c091f);}return null;};}function patchUpdates(_0x522909){return function(_0x5063aa){try{jsonpatch[_0x6493('0x28')](_0x5063aa,_0x522909,!![]);}catch(_0x26b6cc){return BPromise[_0x6493('0x29')](_0x26b6cc);}return _0x5063aa[_0x6493('0x2a')]();};}function saveUpdates(_0x18441e,_0x2ca304){return function(_0x47c0e9){if(_0x47c0e9){return _0x47c0e9['update'](_0x18441e)[_0x6493('0x2b')](function(_0x143fe6){return _0x143fe6;});}return null;};}function removeEntity(_0x35be17,_0x315cfe){return function(_0x13555b){if(_0x13555b){return _0x13555b[_0x6493('0x2c')]()['then'](function(){_0x35be17[_0x6493('0x23')](0xcc)[_0x6493('0x2d')]();});}};}function handleEntityNotFound(_0x824e2f,_0x4b47e8){return function(_0xf87881){if(!_0xf87881){_0x824e2f['sendStatus'](0x194);}return _0xf87881;};}function handleError(_0x2ad3ae,_0x297635){_0x297635=_0x297635||0x1f4;return function(_0x2cffe7){logger['error'](_0x2cffe7[_0x6493('0x2e')]);if(_0x2cffe7['name']){delete _0x2cffe7['name'];}_0x2ad3ae[_0x6493('0x23')](_0x297635)['send'](_0x2cffe7);};}exports[_0x6493('0x2f')]=function(_0x4fa5e9,_0x4adaca){var _0x5d88b9={},_0x1b0a2f={},_0x5879a4={'count':0x0,'rows':[]};var _0x1ddbd5=_[_0x6493('0x30')](db[_0x6493('0x31')][_0x6493('0x32')],function(_0x5f3ff8){return{'name':_0x5f3ff8[_0x6493('0x33')],'type':_0x5f3ff8[_0x6493('0x34')]['key']};});_0x1b0a2f[_0x6493('0x35')]=_[_0x6493('0x30')](_0x1ddbd5,_0x6493('0x36'));_0x1b0a2f[_0x6493('0x37')]=_[_0x6493('0x38')](_0x4fa5e9[_0x6493('0x37')]);_0x1b0a2f[_0x6493('0x39')]=_['intersection'](_0x1b0a2f[_0x6493('0x35')],_0x1b0a2f['query']);_0x5d88b9[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x1b0a2f[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x4fa5e9['query'][_0x6493('0x3c')]));_0x5d88b9['attributes']=_0x5d88b9[_0x6493('0x3a')]['length']?_0x5d88b9[_0x6493('0x3a')]:_0x1b0a2f[_0x6493('0x35')];if(!_0x4fa5e9['query'][_0x6493('0x3d')](_0x6493('0x3e'))){_0x5d88b9[_0x6493('0x25')]=qs[_0x6493('0x25')](_0x4fa5e9['query'][_0x6493('0x25')]);_0x5d88b9[_0x6493('0x3f')]=qs['offset'](_0x4fa5e9['query'][_0x6493('0x3f')]);}_0x5d88b9[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x4fa5e9['query'][_0x6493('0x41')]);_0x5d88b9[_0x6493('0x42')]=qs[_0x6493('0x39')](_['pick'](_0x4fa5e9[_0x6493('0x37')],_0x1b0a2f[_0x6493('0x39')]),_0x1ddbd5);if(_0x4fa5e9[_0x6493('0x37')][_0x6493('0x43')]){_0x5d88b9[_0x6493('0x42')]=_[_0x6493('0x44')](_0x5d88b9[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x1ddbd5,function(_0x14412b){if(_0x14412b['type']!=='VIRTUAL'){var _0x531686={};_0x531686[_0x14412b['name']]={'$like':'%'+_0x4fa5e9[_0x6493('0x37')][_0x6493('0x43')]+'%'};return _0x531686;}})});}_0x5d88b9=_[_0x6493('0x44')]({},_0x5d88b9,_0x4fa5e9['options']);var _0x295f80={'where':_0x5d88b9[_0x6493('0x42')]};return db[_0x6493('0x31')]['count'](_0x295f80)[_0x6493('0x2b')](function(_0x43585a){_0x5879a4[_0x6493('0x24')]=_0x43585a;if(_0x4fa5e9[_0x6493('0x37')]['includeAll']){_0x5d88b9[_0x6493('0x45')]=[{'all':!![]}];}return db[_0x6493('0x31')][_0x6493('0x46')](_0x5d88b9);})['then'](function(_0x1e2560){_0x5879a4[_0x6493('0x47')]=_0x1e2560;return _0x5879a4;})[_0x6493('0x2b')](respondWithFilteredResult(_0x4adaca,_0x5d88b9))[_0x6493('0x21')](handleError(_0x4adaca,null));};exports[_0x6493('0x48')]=function(_0x1e72ed,_0x25f979){var _0x4a423d={'raw':![],'where':{'id':_0x1e72ed['params']['id']}},_0x9b9323={};_0x9b9323['model']=_[_0x6493('0x38')](db['ZendeskConfiguration'][_0x6493('0x32')]);_0x9b9323['query']=_['keys'](_0x1e72ed['query']);_0x9b9323[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x9b9323[_0x6493('0x35')],_0x9b9323[_0x6493('0x37')]);_0x4a423d[_0x6493('0x3a')]=_['intersection'](_0x9b9323[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x1e72ed['query']['fields']));_0x4a423d['attributes']=_0x4a423d[_0x6493('0x3a')][_0x6493('0x49')]?_0x4a423d[_0x6493('0x3a')]:_0x9b9323[_0x6493('0x35')];if(_0x1e72ed[_0x6493('0x37')][_0x6493('0x4a')]){_0x4a423d[_0x6493('0x45')]=[{'all':!![]}];}_0x4a423d=_[_0x6493('0x44')]({},_0x4a423d,_0x1e72ed[_0x6493('0x4b')]);return db['ZendeskConfiguration'][_0x6493('0x4c')](_0x4a423d)['then'](handleEntityNotFound(_0x25f979,null))[_0x6493('0x2b')](respondWithResult(_0x25f979,null))[_0x6493('0x21')](handleError(_0x25f979,null));};exports[_0x6493('0x4d')]=function(_0x21fb34,_0x95fdb8){return db[_0x6493('0x31')][_0x6493('0x4d')](_0x21fb34['body'],{})[_0x6493('0x2b')](respondWithResult(_0x95fdb8,0xc9))[_0x6493('0x21')](handleError(_0x95fdb8,null));};exports[_0x6493('0x4e')]=function(_0x2638df,_0x4365b3){if(_0x2638df[_0x6493('0x4f')]['id']){delete _0x2638df[_0x6493('0x4f')]['id'];}return db[_0x6493('0x31')][_0x6493('0x4c')]({'where':{'id':_0x2638df[_0x6493('0x50')]['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x4365b3,null))[_0x6493('0x2b')](saveUpdates(_0x2638df[_0x6493('0x4f')],null))[_0x6493('0x2b')](respondWithResult(_0x4365b3,null))['catch'](handleError(_0x4365b3,null));};exports[_0x6493('0x2c')]=function(_0x3c3c7b,_0x241793){return db[_0x6493('0x31')][_0x6493('0x4c')]({'where':{'id':_0x3c3c7b['params']['id']}})['then'](handleEntityNotFound(_0x241793,null))[_0x6493('0x2b')](removeEntity(_0x241793,null))[_0x6493('0x21')](handleError(_0x241793,null));};exports[_0x6493('0x51')]=function(_0x32d784,_0x1e3af7,_0x37df00){var _0x16cb49={};var _0x4e2fe6={};var _0x532279;var _0x43170c;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x32d784['params']['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x1e3af7,null))[_0x6493('0x2b')](function(_0x2ecb18){if(_0x2ecb18){_0x532279=_0x2ecb18;_0x4e2fe6[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x53')]['rawAttributes']);_0x4e2fe6[_0x6493('0x37')]=_[_0x6493('0x38')](_0x32d784[_0x6493('0x37')]);_0x4e2fe6[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x4e2fe6[_0x6493('0x35')],_0x4e2fe6['query']);_0x16cb49[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x4e2fe6[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x32d784[_0x6493('0x37')]['fields']));_0x16cb49[_0x6493('0x3a')]=_0x16cb49[_0x6493('0x3a')][_0x6493('0x49')]?_0x16cb49[_0x6493('0x3a')]:_0x4e2fe6[_0x6493('0x35')];_0x16cb49[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x32d784['query'][_0x6493('0x41')]);_0x16cb49['where']=qs['filters'](_[_0x6493('0x54')](_0x32d784[_0x6493('0x37')],_0x4e2fe6['filters']));if(_0x32d784['query'][_0x6493('0x43')]){_0x16cb49[_0x6493('0x42')]=_[_0x6493('0x44')](_0x16cb49[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x16cb49[_0x6493('0x3a')],function(_0x12a592){var _0x2358de={};_0x2358de[_0x12a592]={'$like':'%'+_0x32d784['query'][_0x6493('0x43')]+'%'};return _0x2358de;})});}_0x16cb49=_[_0x6493('0x44')]({},_0x16cb49,_0x32d784[_0x6493('0x4b')]);return _0x532279[_0x6493('0x51')](_0x16cb49);}})['then'](function(_0x1dd43e){if(_0x1dd43e){_0x43170c=_0x1dd43e[_0x6493('0x49')];if(!_0x32d784[_0x6493('0x37')]['hasOwnProperty'](_0x6493('0x3e'))){_0x16cb49['limit']=qs[_0x6493('0x25')](_0x32d784[_0x6493('0x37')][_0x6493('0x25')]);_0x16cb49['offset']=qs[_0x6493('0x3f')](_0x32d784[_0x6493('0x37')][_0x6493('0x3f')]);}return _0x532279[_0x6493('0x51')](_0x16cb49);}})[_0x6493('0x2b')](function(_0x5e4ea8){if(_0x5e4ea8){return _0x5e4ea8?{'count':_0x43170c,'rows':_0x5e4ea8}:null;}})[_0x6493('0x2b')](respondWithResult(_0x1e3af7,null))[_0x6493('0x21')](handleError(_0x1e3af7,null));};exports[_0x6493('0x55')]=function(_0x4ad477,_0x59bdbf,_0x15e890){var _0x5f0ca7={};var _0x84a07d={};var _0x38e63d;var _0x251041;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x4ad477[_0x6493('0x50')]['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x59bdbf,null))[_0x6493('0x2b')](function(_0x1e23f7){if(_0x1e23f7){_0x38e63d=_0x1e23f7;_0x84a07d[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x53')][_0x6493('0x32')]);_0x84a07d[_0x6493('0x37')]=_[_0x6493('0x38')](_0x4ad477[_0x6493('0x37')]);_0x84a07d[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x84a07d['model'],_0x84a07d[_0x6493('0x37')]);_0x5f0ca7['attributes']=_[_0x6493('0x3b')](_0x84a07d['model'],qs['fields'](_0x4ad477[_0x6493('0x37')][_0x6493('0x3c')]));_0x5f0ca7[_0x6493('0x3a')]=_0x5f0ca7[_0x6493('0x3a')]['length']?_0x5f0ca7[_0x6493('0x3a')]:_0x84a07d[_0x6493('0x35')];_0x5f0ca7[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x4ad477[_0x6493('0x37')][_0x6493('0x41')]);_0x5f0ca7['where']=qs[_0x6493('0x39')](_[_0x6493('0x54')](_0x4ad477[_0x6493('0x37')],_0x84a07d[_0x6493('0x39')]));if(_0x4ad477[_0x6493('0x37')][_0x6493('0x43')]){_0x5f0ca7[_0x6493('0x42')]=_[_0x6493('0x44')](_0x5f0ca7[_0x6493('0x42')],{'$or':_['map'](_0x5f0ca7[_0x6493('0x3a')],function(_0x5949d3){var _0x1de71b={};_0x1de71b[_0x5949d3]={'$like':'%'+_0x4ad477['query'][_0x6493('0x43')]+'%'};return _0x1de71b;})});}_0x5f0ca7=_[_0x6493('0x44')]({},_0x5f0ca7,_0x4ad477[_0x6493('0x4b')]);return _0x38e63d[_0x6493('0x55')](_0x5f0ca7);}})[_0x6493('0x2b')](function(_0x138b75){if(_0x138b75){_0x251041=_0x138b75[_0x6493('0x49')];if(!_0x4ad477[_0x6493('0x37')][_0x6493('0x3d')](_0x6493('0x3e'))){_0x5f0ca7[_0x6493('0x25')]=qs[_0x6493('0x25')](_0x4ad477[_0x6493('0x37')][_0x6493('0x25')]);_0x5f0ca7[_0x6493('0x3f')]=qs[_0x6493('0x3f')](_0x4ad477['query'][_0x6493('0x3f')]);}return _0x38e63d[_0x6493('0x55')](_0x5f0ca7);}})[_0x6493('0x2b')](function(_0x5a4c6c){if(_0x5a4c6c){return _0x5a4c6c?{'count':_0x251041,'rows':_0x5a4c6c}:null;}})[_0x6493('0x2b')](respondWithResult(_0x59bdbf,null))[_0x6493('0x21')](handleError(_0x59bdbf,null));};exports[_0x6493('0x56')]=function(_0x2fb63c,_0x12e832,_0x517e04){var _0x2e6296={};var _0x4643a1={};var _0x4b41da;var _0x4310a0;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x2fb63c[_0x6493('0x50')]['id']}})['then'](handleEntityNotFound(_0x12e832,null))[_0x6493('0x2b')](function(_0x3a42dd){if(_0x3a42dd){_0x4b41da=_0x3a42dd;_0x4643a1[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x53')][_0x6493('0x32')]);_0x4643a1[_0x6493('0x37')]=_[_0x6493('0x38')](_0x2fb63c[_0x6493('0x37')]);_0x4643a1[_0x6493('0x39')]=_[_0x6493('0x3b')](_0x4643a1[_0x6493('0x35')],_0x4643a1[_0x6493('0x37')]);_0x2e6296[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x4643a1[_0x6493('0x35')],qs['fields'](_0x2fb63c[_0x6493('0x37')][_0x6493('0x3c')]));_0x2e6296[_0x6493('0x3a')]=_0x2e6296[_0x6493('0x3a')][_0x6493('0x49')]?_0x2e6296['attributes']:_0x4643a1[_0x6493('0x35')];_0x2e6296[_0x6493('0x40')]=qs[_0x6493('0x41')](_0x2fb63c[_0x6493('0x37')][_0x6493('0x41')]);_0x2e6296[_0x6493('0x42')]=qs[_0x6493('0x39')](_[_0x6493('0x54')](_0x2fb63c[_0x6493('0x37')],_0x4643a1[_0x6493('0x39')]));if(_0x2fb63c[_0x6493('0x37')][_0x6493('0x43')]){_0x2e6296[_0x6493('0x42')]=_[_0x6493('0x44')](_0x2e6296[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x2e6296[_0x6493('0x3a')],function(_0x2c09fe){var _0x4b16dd={};_0x4b16dd[_0x2c09fe]={'$like':'%'+_0x2fb63c[_0x6493('0x37')][_0x6493('0x43')]+'%'};return _0x4b16dd;})});}_0x2e6296=_[_0x6493('0x44')]({},_0x2e6296,_0x2fb63c[_0x6493('0x4b')]);return _0x4b41da['getDescriptions'](_0x2e6296);}})[_0x6493('0x2b')](function(_0x6e968c){if(_0x6e968c){_0x4310a0=_0x6e968c['length'];if(!_0x2fb63c[_0x6493('0x37')][_0x6493('0x3d')]('nolimit')){_0x2e6296[_0x6493('0x25')]=qs[_0x6493('0x25')](_0x2fb63c[_0x6493('0x37')][_0x6493('0x25')]);_0x2e6296[_0x6493('0x3f')]=qs[_0x6493('0x3f')](_0x2fb63c[_0x6493('0x37')]['offset']);}return _0x4b41da[_0x6493('0x56')](_0x2e6296);}})[_0x6493('0x2b')](function(_0x4c0bed){if(_0x4c0bed){return _0x4c0bed?{'count':_0x4310a0,'rows':_0x4c0bed}:null;}})[_0x6493('0x2b')](respondWithResult(_0x12e832,null))[_0x6493('0x21')](handleError(_0x12e832,null));};exports[_0x6493('0x57')]=function(_0x236384,_0x2711da,_0x877228){var _0x5a3f53={};var _0x3e98c0={};var _0x8aa4ac;var _0x171c61;return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x236384['params']['id']}})['then'](handleEntityNotFound(_0x2711da,null))[_0x6493('0x2b')](function(_0x142ffe){if(_0x142ffe){_0x8aa4ac=_0x142ffe;_0x3e98c0[_0x6493('0x35')]=_[_0x6493('0x38')](db[_0x6493('0x58')][_0x6493('0x32')]);_0x3e98c0[_0x6493('0x37')]=_[_0x6493('0x38')](_0x236384[_0x6493('0x37')]);_0x3e98c0['filters']=_['intersection'](_0x3e98c0['model'],_0x3e98c0['query']);_0x5a3f53[_0x6493('0x3a')]=_[_0x6493('0x3b')](_0x3e98c0[_0x6493('0x35')],qs[_0x6493('0x3c')](_0x236384[_0x6493('0x37')]['fields']));_0x5a3f53['attributes']=_0x5a3f53['attributes'][_0x6493('0x49')]?_0x5a3f53[_0x6493('0x3a')]:_0x3e98c0[_0x6493('0x35')];_0x5a3f53['order']=qs[_0x6493('0x41')](_0x236384[_0x6493('0x37')][_0x6493('0x41')]);_0x5a3f53[_0x6493('0x42')]=qs[_0x6493('0x39')](_[_0x6493('0x54')](_0x236384['query'],_0x3e98c0['filters']));if(_0x236384[_0x6493('0x37')]['filter']){_0x5a3f53['where']=_[_0x6493('0x44')](_0x5a3f53[_0x6493('0x42')],{'$or':_[_0x6493('0x30')](_0x5a3f53[_0x6493('0x3a')],function(_0x2dfc01){var _0xe61708={};_0xe61708[_0x2dfc01]={'$like':'%'+_0x236384[_0x6493('0x37')][_0x6493('0x43')]+'%'};return _0xe61708;})});}_0x5a3f53=_[_0x6493('0x44')]({},_0x5a3f53,_0x236384[_0x6493('0x4b')]);return _0x8aa4ac['getTags'](_0x5a3f53);}})[_0x6493('0x2b')](function(_0x1d4e00){if(_0x1d4e00){_0x171c61=_0x1d4e00['length'];if(!_0x236384[_0x6493('0x37')]['hasOwnProperty'](_0x6493('0x3e'))){_0x5a3f53['limit']=qs[_0x6493('0x25')](_0x236384[_0x6493('0x37')]['limit']);_0x5a3f53[_0x6493('0x3f')]=qs[_0x6493('0x3f')](_0x236384[_0x6493('0x37')]['offset']);}return _0x8aa4ac[_0x6493('0x57')](_0x5a3f53);}})[_0x6493('0x2b')](function(_0x46ded7){if(_0x46ded7){return _0x46ded7?{'count':_0x171c61,'rows':_0x46ded7}:null;}})[_0x6493('0x2b')](respondWithResult(_0x2711da,null))['catch'](handleError(_0x2711da,null));};exports[_0x6493('0x59')]=function(_0x55574f,_0x27de6c,_0x20289c){if(_0x55574f[_0x6493('0x4f')]['id']){delete _0x55574f[_0x6493('0x4f')]['id'];}return db[_0x6493('0x31')][_0x6493('0x52')]({'where':{'id':_0x55574f['params']['id']}})[_0x6493('0x2b')](handleEntityNotFound(_0x27de6c,null))[_0x6493('0x2b')](function(_0x39514e){if(_0x39514e){return _0x39514e[_0x6493('0x59')](_0x55574f[_0x6493('0x4f')][_0x6493('0x5a')]||[]);}return null;})[_0x6493('0x2b')](respondWithResult(_0x27de6c,null))[_0x6493('0x21')](handleError(_0x27de6c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 4514c96..dbaa634 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 _0x2ddf=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ddf,0x175));var _0xf2dd=function(_0x413bd2,_0x1b28f7){_0x413bd2=_0x413bd2-0x0;var _0xbf0d0e=_0x2ddf[_0x413bd2];return _0xbf0d0e;};'use strict';var _=require(_0xf2dd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf2dd('0x1'));var BPromise=require('bluebird');var rp=require(_0xf2dd('0x2'));var fs=require('fs');var path=require(_0xf2dd('0x3'));var rimraf=require(_0xf2dd('0x4'));var config=require('../../config/environment');var attributes=require(_0xf2dd('0x5'));module[_0xf2dd('0x6')]=function(_0x13b335,_0x4c6318){return _0x13b335[_0xf2dd('0x7')](_0xf2dd('0x8'),attributes,{'tableName':_0xf2dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c18=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','moment','request-promise','path'];(function(_0x202e81,_0x2dc375){var _0x29a066=function(_0x4172da){while(--_0x4172da){_0x202e81['push'](_0x202e81['shift']());}};_0x29a066(++_0x2dc375);}(_0x1c18,0xc1));var _0x81c1=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x1c18[_0x37cc52];return _0x2b4a90;};'use strict';var _=require(_0x81c1('0x0'));var util=require('util');var logger=require(_0x81c1('0x1'))('api');var moment=require(_0x81c1('0x2'));var BPromise=require('bluebird');var rp=require(_0x81c1('0x3'));var fs=require('fs');var path=require(_0x81c1('0x4'));var rimraf=require(_0x81c1('0x5'));var config=require(_0x81c1('0x6'));var attributes=require(_0x81c1('0x7'));module[_0x81c1('0x8')]=function(_0x357f31,_0x501b86){return _0x357f31[_0x81c1('0x9')](_0x81c1('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 2d36781..6a43c05 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 _0x4eb8=['http','info','request\x20sent','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e6c66,_0x247d46){var _0x478d53=function(_0x493351){while(--_0x493351){_0x3e6c66['push'](_0x3e6c66['shift']());}};_0x478d53(++_0x247d46);}(_0x4eb8,0x14c));var _0x84eb=function(_0x4ac761,_0x228735){_0x4ac761=_0x4ac761-0x0;var _0x4de38d=_0x4eb8[_0x4ac761];return _0x4de38d;};'use strict';var _=require('lodash');var util=require(_0x84eb('0x0'));var moment=require(_0x84eb('0x1'));var BPromise=require(_0x84eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x84eb('0x4'));var logger=require(_0x84eb('0x5'))(_0x84eb('0x6'));var config=require(_0x84eb('0x7'));var jayson=require(_0x84eb('0x8'));var client=jayson[_0x84eb('0x9')][_0x84eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47ec6a,_0x1ac448,_0x3ddf15){return new BPromise(function(_0x15ff08,_0x2be528){return client['request'](_0x47ec6a,_0x3ddf15)['then'](function(_0x56d183){logger[_0x84eb('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ac448,_0x84eb('0xc'));logger[_0x84eb('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ac448,_0x84eb('0xc'),JSON[_0x84eb('0xe')](_0x56d183));if(_0x56d183[_0x84eb('0xf')]){if(_0x56d183[_0x84eb('0xf')]['code']===0x1f4){logger['error'](_0x84eb('0x10'),_0x1ac448,_0x56d183[_0x84eb('0xf')][_0x84eb('0x11')]);return _0x2be528(_0x56d183['error'][_0x84eb('0x11')]);}logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x1ac448,_0x56d183[_0x84eb('0xf')][_0x84eb('0x11')]);return _0x15ff08(_0x56d183[_0x84eb('0xf')]['message']);}else{logger[_0x84eb('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ac448,_0x84eb('0xc'));_0x15ff08(_0x56d183['result']['message']);}})['catch'](function(_0x5de2ad){logger['error'](_0x84eb('0x10'),_0x1ac448,_0x5de2ad);_0x2be528(_0x5de2ad);});});} \ No newline at end of file +var _0x6bad=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x511133,_0x35255f){var _0x3acd78=function(_0x371acd){while(--_0x371acd){_0x511133['push'](_0x511133['shift']());}};_0x3acd78(++_0x35255f);}(_0x6bad,0x1de));var _0xd6ba=function(_0xc7ef24,_0x33578a){_0xc7ef24=_0xc7ef24-0x0;var _0x32770d=_0x6bad[_0xc7ef24];return _0x32770d;};'use strict';var _=require(_0xd6ba('0x0'));var util=require(_0xd6ba('0x1'));var moment=require(_0xd6ba('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6ba('0x3'));var fs=require('fs');var Redis=require(_0xd6ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6ba('0x5'));var logger=require(_0xd6ba('0x6'))(_0xd6ba('0x7'));var config=require(_0xd6ba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6ba('0x9')][_0xd6ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x169d5f,_0x4089ea,_0x14d989){return new BPromise(function(_0x1e0230,_0xda8872){return client['request'](_0x169d5f,_0x14d989)[_0xd6ba('0xb')](function(_0x2549c7){logger[_0xd6ba('0xc')](_0xd6ba('0xd'),_0x4089ea,_0xd6ba('0xe'));logger[_0xd6ba('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4089ea,'request\x20sent',JSON[_0xd6ba('0x10')](_0x2549c7));if(_0x2549c7[_0xd6ba('0x11')]){if(_0x2549c7[_0xd6ba('0x11')][_0xd6ba('0x12')]===0x1f4){logger[_0xd6ba('0x11')](_0xd6ba('0xd'),_0x4089ea,_0x2549c7[_0xd6ba('0x11')][_0xd6ba('0x13')]);return _0xda8872(_0x2549c7[_0xd6ba('0x11')][_0xd6ba('0x13')]);}logger['error'](_0xd6ba('0xd'),_0x4089ea,_0x2549c7['error'][_0xd6ba('0x13')]);return _0x1e0230(_0x2549c7['error'][_0xd6ba('0x13')]);}else{logger[_0xd6ba('0xc')](_0xd6ba('0xd'),_0x4089ea,'request\x20sent');_0x1e0230(_0x2549c7['result'][_0xd6ba('0x13')]);}})[_0xd6ba('0x14')](function(_0x205e3e){logger[_0xd6ba('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4089ea,_0x205e3e);_0xda8872(_0x205e3e);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index cfdf0f3..ea850e2 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 _0xb845=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x56d117,_0x530489){var _0x2c7514=function(_0x1ce23c){while(--_0x1ce23c){_0x56d117['push'](_0x56d117['shift']());}};_0x2c7514(++_0x530489);}(_0xb845,0x18b));var _0x5b84=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xb845[_0x500785];return _0x1f8bcc;};'use strict';var multer=require('multer');var util=require(_0x5b84('0x0'));var path=require(_0x5b84('0x1'));var timeout=require(_0x5b84('0x2'));var express=require('express');var router=express[_0x5b84('0x3')]();var auth=require(_0x5b84('0x4'));var interaction=require(_0x5b84('0x5'));var config=require(_0x5b84('0x6'));var controller=require(_0x5b84('0x7'));router[_0x5b84('0x8')]('/',auth[_0x5b84('0x9')](),controller[_0x5b84('0xa')]);router[_0x5b84('0x8')](_0x5b84('0xb'),auth[_0x5b84('0x9')](),controller[_0x5b84('0xc')]);router[_0x5b84('0xd')]('/',auth[_0x5b84('0x9')](),controller[_0x5b84('0xe')]);router[_0x5b84('0xf')](_0x5b84('0xb'),auth[_0x5b84('0x9')](),controller[_0x5b84('0x10')]);router[_0x5b84('0x11')](_0x5b84('0xb'),auth['isAuthenticated'](),controller[_0x5b84('0x12')]);module[_0x5b84('0x13')]=router; \ No newline at end of file +var _0xcab6=['index','get','show','post','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0xcab6,0xd4));var _0x6cab=function(_0x5ddff3,_0x52f03c){_0x5ddff3=_0x5ddff3-0x0;var _0x207dcd=_0xcab6[_0x5ddff3];return _0x207dcd;};'use strict';var multer=require(_0x6cab('0x0'));var util=require('util');var path=require(_0x6cab('0x1'));var timeout=require(_0x6cab('0x2'));var express=require(_0x6cab('0x3'));var router=express[_0x6cab('0x4')]();var auth=require(_0x6cab('0x5'));var interaction=require(_0x6cab('0x6'));var config=require('../../config/environment');var controller=require(_0x6cab('0x7'));router['get']('/',auth[_0x6cab('0x8')](),controller[_0x6cab('0x9')]);router[_0x6cab('0xa')]('/:id',auth[_0x6cab('0x8')](),controller[_0x6cab('0xb')]);router[_0x6cab('0xc')]('/',auth[_0x6cab('0x8')](),controller['create']);router['put'](_0x6cab('0xd'),auth[_0x6cab('0x8')](),controller[_0x6cab('0xe')]);router[_0x6cab('0xf')](_0x6cab('0xd'),auth[_0x6cab('0x8')](),controller['destroy']);module[_0x6cab('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2a1fa2e..7d61c95 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 _0xf987=['customVariable','keyValue','STRING','variable','ENUM','string'];(function(_0x22ecde,_0x1a7fb0){var _0xfcc99e=function(_0x106c89){while(--_0x106c89){_0x22ecde['push'](_0x22ecde['shift']());}};_0xfcc99e(++_0x1a7fb0);}(_0xf987,0x18a));var _0x7f98=function(_0x52c606,_0x94600e){_0x52c606=_0x52c606-0x0;var _0x44cd99=_0xf987[_0x52c606];return _0x44cd99;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7f98('0x0')](_0x7f98('0x1'),'variable',_0x7f98('0x2'),_0x7f98('0x3')),'defaultValue':_0x7f98('0x1')},'content':{'type':Sequelize[_0x7f98('0x4')]},'key':{'type':Sequelize[_0x7f98('0x4')]},'keyType':{'type':Sequelize[_0x7f98('0x0')](_0x7f98('0x1'),_0x7f98('0x5'),_0x7f98('0x2'))},'keyContent':{'type':Sequelize[_0x7f98('0x4')]},'idField':{'type':Sequelize[_0x7f98('0x4')]},'nameField':{'type':Sequelize[_0x7f98('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f98('0x4')]}}; \ No newline at end of file +var _0x8aaa=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x678774,_0x4e110d){var _0x56c83a=function(_0xcedc08){while(--_0xcedc08){_0x678774['push'](_0x678774['shift']());}};_0x56c83a(++_0x4e110d);}(_0x8aaa,0x64));var _0xa8aa=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x8aaa[_0x297c55];return _0x120389;};'use strict';var Sequelize=require(_0xa8aa('0x0'));module[_0xa8aa('0x1')]={'type':{'type':Sequelize[_0xa8aa('0x2')]('string',_0xa8aa('0x3'),_0xa8aa('0x4'),_0xa8aa('0x5')),'defaultValue':_0xa8aa('0x6')},'content':{'type':Sequelize[_0xa8aa('0x7')]},'key':{'type':Sequelize[_0xa8aa('0x7')]},'keyType':{'type':Sequelize[_0xa8aa('0x2')](_0xa8aa('0x6'),'variable',_0xa8aa('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa8aa('0x7')]},'customField':{'type':Sequelize[_0xa8aa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 3fb89c1..145cc0f 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 _0xab84=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5bf4ad,_0x26d392){var _0x357aab=function(_0x45ff3c){while(--_0x45ff3c){_0x5bf4ad['push'](_0x5bf4ad['shift']());}};_0x357aab(++_0x26d392);}(_0xab84,0x169));var _0x4ab8=function(_0x10e485,_0x4ee577){_0x10e485=_0x10e485-0x0;var _0x540f38=_0xab84[_0x10e485];return _0x540f38;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ab8('0x0'));var zipdir=require(_0x4ab8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ab8('0x2'));var moment=require(_0x4ab8('0x3'));var BPromise=require(_0x4ab8('0x4'));var Mustache=require(_0x4ab8('0x5'));var util=require(_0x4ab8('0x6'));var path=require(_0x4ab8('0x7'));var sox=require(_0x4ab8('0x8'));var csv=require(_0x4ab8('0x9'));var ejs=require(_0x4ab8('0xa'));var fs=require('fs');var _=require(_0x4ab8('0xb'));var squel=require(_0x4ab8('0xc'));var crypto=require('crypto');var jsforce=require(_0x4ab8('0xd'));var deskjs=require(_0x4ab8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ab8('0xf'));var Papa=require(_0x4ab8('0x10'));var Redis=require('ioredis');var authService=require(_0x4ab8('0x11'));var qs=require(_0x4ab8('0x12'));var as=require(_0x4ab8('0x13'));var hardwareService=require(_0x4ab8('0x14'));var logger=require(_0x4ab8('0x15'))(_0x4ab8('0x16'));var utils=require(_0x4ab8('0x17'));var config=require('../../config/environment');var db=require(_0x4ab8('0x18'))['db'];function respondWithStatusCode(_0x636320,_0x2def03){_0x2def03=_0x2def03||0xcc;return function(_0x2fd8cf){if(_0x2fd8cf){return _0x636320['sendStatus'](_0x2def03);}return _0x636320[_0x4ab8('0x19')](_0x2def03)['end']();};}function respondWithResult(_0x4c342e,_0x188664){_0x188664=_0x188664||0xc8;return function(_0x1307a6){if(_0x1307a6){return _0x4c342e[_0x4ab8('0x19')](_0x188664)[_0x4ab8('0x1a')](_0x1307a6);}};}function respondWithFilteredResult(_0x146784,_0x22d641){return function(_0x3aba42){if(_0x3aba42){var _0xfb981b=_0x3aba42[_0x4ab8('0x1b')],_0x50dede=_0x22d641[_0x4ab8('0x1c')],_0x1bc003=_0x22d641['offset']+_0x22d641[_0x4ab8('0x1d')],_0x2f128e;if(_0x1bc003>=_0xfb981b){_0x1bc003=_0xfb981b;_0x2f128e=0xc8;}else{_0x2f128e=0xce;}_0x146784[_0x4ab8('0x19')](_0x2f128e);return _0x146784[_0x4ab8('0x1e')]('Content-Range',_0x50dede+'-'+_0x1bc003+'/'+_0xfb981b)[_0x4ab8('0x1a')](_0x3aba42);}return null;};}function patchUpdates(_0x27c633){return function(_0x3f34b2){try{jsonpatch['apply'](_0x3f34b2,_0x27c633,!![]);}catch(_0x118756){return BPromise[_0x4ab8('0x1f')](_0x118756);}return _0x3f34b2[_0x4ab8('0x20')]();};}function saveUpdates(_0xcd770c,_0x1c9daa){return function(_0x5ac5ac){if(_0x5ac5ac){return _0x5ac5ac[_0x4ab8('0x21')](_0xcd770c)[_0x4ab8('0x22')](function(_0x1c5408){return _0x1c5408;});}return null;};}function removeEntity(_0x36e820,_0x442dd7){return function(_0x11221e){if(_0x11221e){return _0x11221e[_0x4ab8('0x23')]()[_0x4ab8('0x22')](function(){_0x36e820[_0x4ab8('0x19')](0xcc)[_0x4ab8('0x24')]();});}};}function handleEntityNotFound(_0x1e3771,_0x3c66fe){return function(_0x494d46){if(!_0x494d46){_0x1e3771['sendStatus'](0x194);}return _0x494d46;};}function handleError(_0x56637c,_0x35c74f){_0x35c74f=_0x35c74f||0x1f4;return function(_0x5e3acd){logger[_0x4ab8('0x25')](_0x5e3acd[_0x4ab8('0x26')]);if(_0x5e3acd['name']){delete _0x5e3acd[_0x4ab8('0x27')];}_0x56637c[_0x4ab8('0x19')](_0x35c74f)[_0x4ab8('0x28')](_0x5e3acd);};}exports[_0x4ab8('0x29')]=function(_0x2ba53a,_0xa725bf){var _0x126c3f={},_0x337fd1={},_0x6fd6de={'count':0x0,'rows':[]};var _0x2c9e7d=_[_0x4ab8('0x2a')](db[_0x4ab8('0x2b')][_0x4ab8('0x2c')],function(_0x546427){return{'name':_0x546427[_0x4ab8('0x2d')],'type':_0x546427[_0x4ab8('0x2e')][_0x4ab8('0x2f')]};});_0x337fd1['model']=_[_0x4ab8('0x2a')](_0x2c9e7d,_0x4ab8('0x27'));_0x337fd1[_0x4ab8('0x30')]=_['keys'](_0x2ba53a[_0x4ab8('0x30')]);_0x337fd1[_0x4ab8('0x31')]=_[_0x4ab8('0x32')](_0x337fd1[_0x4ab8('0x33')],_0x337fd1[_0x4ab8('0x30')]);_0x126c3f[_0x4ab8('0x34')]=_[_0x4ab8('0x32')](_0x337fd1[_0x4ab8('0x33')],qs[_0x4ab8('0x35')](_0x2ba53a['query'][_0x4ab8('0x35')]));_0x126c3f[_0x4ab8('0x34')]=_0x126c3f[_0x4ab8('0x34')][_0x4ab8('0x36')]?_0x126c3f[_0x4ab8('0x34')]:_0x337fd1[_0x4ab8('0x33')];if(!_0x2ba53a[_0x4ab8('0x30')][_0x4ab8('0x37')](_0x4ab8('0x38'))){_0x126c3f[_0x4ab8('0x1d')]=qs[_0x4ab8('0x1d')](_0x2ba53a['query']['limit']);_0x126c3f['offset']=qs['offset'](_0x2ba53a['query'][_0x4ab8('0x1c')]);}_0x126c3f[_0x4ab8('0x39')]=qs['sort'](_0x2ba53a[_0x4ab8('0x30')][_0x4ab8('0x3a')]);_0x126c3f[_0x4ab8('0x3b')]=qs[_0x4ab8('0x31')](_[_0x4ab8('0x3c')](_0x2ba53a[_0x4ab8('0x30')],_0x337fd1[_0x4ab8('0x31')]),_0x2c9e7d);if(_0x2ba53a['query'][_0x4ab8('0x3d')]){_0x126c3f[_0x4ab8('0x3b')]=_[_0x4ab8('0x3e')](_0x126c3f['where'],{'$or':_[_0x4ab8('0x2a')](_0x2c9e7d,function(_0x35c373){if(_0x35c373[_0x4ab8('0x2e')]!=='VIRTUAL'){var _0x5beec5={};_0x5beec5[_0x35c373['name']]={'$like':'%'+_0x2ba53a[_0x4ab8('0x30')][_0x4ab8('0x3d')]+'%'};return _0x5beec5;}})});}_0x126c3f=_[_0x4ab8('0x3e')]({},_0x126c3f,_0x2ba53a[_0x4ab8('0x3f')]);var _0x3bef4c={'where':_0x126c3f[_0x4ab8('0x3b')]};return db[_0x4ab8('0x2b')]['count'](_0x3bef4c)[_0x4ab8('0x22')](function(_0xd87d7f){_0x6fd6de['count']=_0xd87d7f;if(_0x2ba53a['query'][_0x4ab8('0x40')]){_0x126c3f['include']=[{'all':!![]}];}return db[_0x4ab8('0x2b')][_0x4ab8('0x41')](_0x126c3f);})['then'](function(_0x14f0c6){_0x6fd6de[_0x4ab8('0x42')]=_0x14f0c6;return _0x6fd6de;})[_0x4ab8('0x22')](respondWithFilteredResult(_0xa725bf,_0x126c3f))[_0x4ab8('0x43')](handleError(_0xa725bf,null));};exports[_0x4ab8('0x44')]=function(_0xeea8d2,_0xcf232c){var _0x3be7a3={'raw':!![],'where':{'id':_0xeea8d2['params']['id']}},_0x3baf09={};_0x3baf09[_0x4ab8('0x33')]=_['keys'](db[_0x4ab8('0x2b')][_0x4ab8('0x2c')]);_0x3baf09[_0x4ab8('0x30')]=_[_0x4ab8('0x45')](_0xeea8d2[_0x4ab8('0x30')]);_0x3baf09[_0x4ab8('0x31')]=_[_0x4ab8('0x32')](_0x3baf09[_0x4ab8('0x33')],_0x3baf09['query']);_0x3be7a3['attributes']=_[_0x4ab8('0x32')](_0x3baf09[_0x4ab8('0x33')],qs[_0x4ab8('0x35')](_0xeea8d2[_0x4ab8('0x30')][_0x4ab8('0x35')]));_0x3be7a3['attributes']=_0x3be7a3[_0x4ab8('0x34')][_0x4ab8('0x36')]?_0x3be7a3[_0x4ab8('0x34')]:_0x3baf09[_0x4ab8('0x33')];if(_0xeea8d2[_0x4ab8('0x30')][_0x4ab8('0x40')]){_0x3be7a3[_0x4ab8('0x46')]=[{'all':!![]}];}_0x3be7a3=_[_0x4ab8('0x3e')]({},_0x3be7a3,_0xeea8d2['options']);return db[_0x4ab8('0x2b')]['find'](_0x3be7a3)[_0x4ab8('0x22')](handleEntityNotFound(_0xcf232c,null))[_0x4ab8('0x22')](respondWithResult(_0xcf232c,null))[_0x4ab8('0x43')](handleError(_0xcf232c,null));};exports[_0x4ab8('0x47')]=function(_0x4ea891,_0x193f4b){return db[_0x4ab8('0x2b')][_0x4ab8('0x47')](_0x4ea891[_0x4ab8('0x48')],{})['then'](respondWithResult(_0x193f4b,0xc9))['catch'](handleError(_0x193f4b,null));};exports[_0x4ab8('0x21')]=function(_0x2504f7,_0x434e91){if(_0x2504f7[_0x4ab8('0x48')]['id']){delete _0x2504f7['body']['id'];}return db[_0x4ab8('0x2b')][_0x4ab8('0x49')]({'where':{'id':_0x2504f7[_0x4ab8('0x4a')]['id']}})[_0x4ab8('0x22')](handleEntityNotFound(_0x434e91,null))[_0x4ab8('0x22')](saveUpdates(_0x2504f7['body'],null))[_0x4ab8('0x22')](respondWithResult(_0x434e91,null))[_0x4ab8('0x43')](handleError(_0x434e91,null));};exports['destroy']=function(_0x617f7f,_0x3f8ffc){return db['ZendeskField'][_0x4ab8('0x49')]({'where':{'id':_0x617f7f['params']['id']}})['then'](handleEntityNotFound(_0x3f8ffc,null))[_0x4ab8('0x22')](removeEntity(_0x3f8ffc,null))[_0x4ab8('0x43')](handleError(_0x3f8ffc,null));}; \ No newline at end of file +var _0xae0e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','ZendeskField','find','catch','create','body','html-pdf','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','query'];(function(_0x4da965,_0x1e3bc7){var _0x16675b=function(_0x35ebb9){while(--_0x35ebb9){_0x4da965['push'](_0x4da965['shift']());}};_0x16675b(++_0x1e3bc7);}(_0xae0e,0xa8));var _0xeae0=function(_0x38dbb1,_0x12ffcb){_0x38dbb1=_0x38dbb1-0x0;var _0x1fc598=_0xae0e[_0x38dbb1];return _0x1fc598;};'use strict';var pdf=require(_0xeae0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeae0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeae0('0x3'));var util=require(_0xeae0('0x4'));var path=require(_0xeae0('0x5'));var sox=require(_0xeae0('0x6'));var csv=require(_0xeae0('0x7'));var ejs=require(_0xeae0('0x8'));var fs=require('fs');var _=require(_0xeae0('0x9'));var squel=require(_0xeae0('0xa'));var crypto=require(_0xeae0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeae0('0xc'));var toCsv=require(_0xeae0('0x7'));var querystring=require(_0xeae0('0xd'));var Papa=require(_0xeae0('0xe'));var Redis=require(_0xeae0('0xf'));var authService=require(_0xeae0('0x10'));var qs=require(_0xeae0('0x11'));var as=require(_0xeae0('0x12'));var hardwareService=require(_0xeae0('0x13'));var logger=require('../../config/logger')(_0xeae0('0x14'));var utils=require('../../config/utils');var config=require(_0xeae0('0x15'));var db=require(_0xeae0('0x16'))['db'];function respondWithStatusCode(_0x2cbb89,_0x101d80){_0x101d80=_0x101d80||0xcc;return function(_0x100ab4){if(_0x100ab4){return _0x2cbb89['sendStatus'](_0x101d80);}return _0x2cbb89[_0xeae0('0x17')](_0x101d80)['end']();};}function respondWithResult(_0x376310,_0x51621e){_0x51621e=_0x51621e||0xc8;return function(_0x1c4b3a){if(_0x1c4b3a){return _0x376310['status'](_0x51621e)[_0xeae0('0x18')](_0x1c4b3a);}};}function respondWithFilteredResult(_0xb8c674,_0x3fbf9c){return function(_0x2ee38b){if(_0x2ee38b){var _0x11905d=_0x2ee38b[_0xeae0('0x19')],_0x500b89=_0x3fbf9c[_0xeae0('0x1a')],_0x5175db=_0x3fbf9c[_0xeae0('0x1a')]+_0x3fbf9c[_0xeae0('0x1b')],_0x2250b7;if(_0x5175db>=_0x11905d){_0x5175db=_0x11905d;_0x2250b7=0xc8;}else{_0x2250b7=0xce;}_0xb8c674['status'](_0x2250b7);return _0xb8c674[_0xeae0('0x1c')](_0xeae0('0x1d'),_0x500b89+'-'+_0x5175db+'/'+_0x11905d)[_0xeae0('0x18')](_0x2ee38b);}return null;};}function patchUpdates(_0x19acff){return function(_0xf75c9b){try{jsonpatch['apply'](_0xf75c9b,_0x19acff,!![]);}catch(_0x5821a1){return BPromise[_0xeae0('0x1e')](_0x5821a1);}return _0xf75c9b[_0xeae0('0x1f')]();};}function saveUpdates(_0x13de7f,_0x4bd57f){return function(_0x5612af){if(_0x5612af){return _0x5612af[_0xeae0('0x20')](_0x13de7f)[_0xeae0('0x21')](function(_0x5ee6d6){return _0x5ee6d6;});}return null;};}function removeEntity(_0x179408,_0x56f455){return function(_0x567fe4){if(_0x567fe4){return _0x567fe4[_0xeae0('0x22')]()[_0xeae0('0x21')](function(){_0x179408['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x167a27,_0x5dad39){return function(_0x330f31){if(!_0x330f31){_0x167a27[_0xeae0('0x23')](0x194);}return _0x330f31;};}function handleError(_0x2de241,_0x51c224){_0x51c224=_0x51c224||0x1f4;return function(_0x388e20){logger['error'](_0x388e20[_0xeae0('0x24')]);if(_0x388e20[_0xeae0('0x25')]){delete _0x388e20['name'];}_0x2de241[_0xeae0('0x17')](_0x51c224)[_0xeae0('0x26')](_0x388e20);};}exports['index']=function(_0x30c589,_0x3e1078){var _0x45d248={},_0x4aa013={},_0x2bd6fc={'count':0x0,'rows':[]};var _0x3ef54b=_[_0xeae0('0x27')](db['ZendeskField'][_0xeae0('0x28')],function(_0x52ace0){return{'name':_0x52ace0[_0xeae0('0x29')],'type':_0x52ace0[_0xeae0('0x2a')][_0xeae0('0x2b')]};});_0x4aa013['model']=_[_0xeae0('0x27')](_0x3ef54b,_0xeae0('0x25'));_0x4aa013[_0xeae0('0x2c')]=_['keys'](_0x30c589['query']);_0x4aa013['filters']=_[_0xeae0('0x2d')](_0x4aa013[_0xeae0('0x2e')],_0x4aa013[_0xeae0('0x2c')]);_0x45d248[_0xeae0('0x2f')]=_['intersection'](_0x4aa013[_0xeae0('0x2e')],qs[_0xeae0('0x30')](_0x30c589['query']['fields']));_0x45d248[_0xeae0('0x2f')]=_0x45d248['attributes'][_0xeae0('0x31')]?_0x45d248[_0xeae0('0x2f')]:_0x4aa013[_0xeae0('0x2e')];if(!_0x30c589['query'][_0xeae0('0x32')](_0xeae0('0x33'))){_0x45d248[_0xeae0('0x1b')]=qs[_0xeae0('0x1b')](_0x30c589[_0xeae0('0x2c')]['limit']);_0x45d248['offset']=qs[_0xeae0('0x1a')](_0x30c589[_0xeae0('0x2c')]['offset']);}_0x45d248['order']=qs[_0xeae0('0x34')](_0x30c589['query'][_0xeae0('0x34')]);_0x45d248[_0xeae0('0x35')]=qs[_0xeae0('0x36')](_['pick'](_0x30c589[_0xeae0('0x2c')],_0x4aa013[_0xeae0('0x36')]),_0x3ef54b);if(_0x30c589[_0xeae0('0x2c')][_0xeae0('0x37')]){_0x45d248['where']=_[_0xeae0('0x38')](_0x45d248[_0xeae0('0x35')],{'$or':_['map'](_0x3ef54b,function(_0x551781){if(_0x551781[_0xeae0('0x2a')]!==_0xeae0('0x39')){var _0x3e9571={};_0x3e9571[_0x551781[_0xeae0('0x25')]]={'$like':'%'+_0x30c589[_0xeae0('0x2c')][_0xeae0('0x37')]+'%'};return _0x3e9571;}})});}_0x45d248=_[_0xeae0('0x38')]({},_0x45d248,_0x30c589['options']);var _0x14e80c={'where':_0x45d248[_0xeae0('0x35')]};return db['ZendeskField'][_0xeae0('0x19')](_0x14e80c)[_0xeae0('0x21')](function(_0x398442){_0x2bd6fc['count']=_0x398442;if(_0x30c589[_0xeae0('0x2c')][_0xeae0('0x3a')]){_0x45d248[_0xeae0('0x3b')]=[{'all':!![]}];}return db['ZendeskField'][_0xeae0('0x3c')](_0x45d248);})[_0xeae0('0x21')](function(_0x38f886){_0x2bd6fc[_0xeae0('0x3d')]=_0x38f886;return _0x2bd6fc;})['then'](respondWithFilteredResult(_0x3e1078,_0x45d248))['catch'](handleError(_0x3e1078,null));};exports[_0xeae0('0x3e')]=function(_0x2ddbb2,_0x4f2ea7){var _0x2e2766={'raw':!![],'where':{'id':_0x2ddbb2[_0xeae0('0x3f')]['id']}},_0x5b36ce={};_0x5b36ce['model']=_[_0xeae0('0x40')](db['ZendeskField'][_0xeae0('0x28')]);_0x5b36ce['query']=_[_0xeae0('0x40')](_0x2ddbb2[_0xeae0('0x2c')]);_0x5b36ce[_0xeae0('0x36')]=_[_0xeae0('0x2d')](_0x5b36ce[_0xeae0('0x2e')],_0x5b36ce[_0xeae0('0x2c')]);_0x2e2766['attributes']=_[_0xeae0('0x2d')](_0x5b36ce['model'],qs[_0xeae0('0x30')](_0x2ddbb2[_0xeae0('0x2c')][_0xeae0('0x30')]));_0x2e2766[_0xeae0('0x2f')]=_0x2e2766[_0xeae0('0x2f')]['length']?_0x2e2766[_0xeae0('0x2f')]:_0x5b36ce['model'];if(_0x2ddbb2['query'][_0xeae0('0x3a')]){_0x2e2766[_0xeae0('0x3b')]=[{'all':!![]}];}_0x2e2766=_[_0xeae0('0x38')]({},_0x2e2766,_0x2ddbb2[_0xeae0('0x41')]);return db[_0xeae0('0x42')][_0xeae0('0x43')](_0x2e2766)[_0xeae0('0x21')](handleEntityNotFound(_0x4f2ea7,null))[_0xeae0('0x21')](respondWithResult(_0x4f2ea7,null))[_0xeae0('0x44')](handleError(_0x4f2ea7,null));};exports[_0xeae0('0x45')]=function(_0x2daaf2,_0x1d80c3){return db['ZendeskField'][_0xeae0('0x45')](_0x2daaf2[_0xeae0('0x46')],{})[_0xeae0('0x21')](respondWithResult(_0x1d80c3,0xc9))[_0xeae0('0x44')](handleError(_0x1d80c3,null));};exports[_0xeae0('0x20')]=function(_0x106435,_0x2318ef){if(_0x106435[_0xeae0('0x46')]['id']){delete _0x106435[_0xeae0('0x46')]['id'];}return db['ZendeskField'][_0xeae0('0x43')]({'where':{'id':_0x106435[_0xeae0('0x3f')]['id']}})[_0xeae0('0x21')](handleEntityNotFound(_0x2318ef,null))['then'](saveUpdates(_0x106435[_0xeae0('0x46')],null))[_0xeae0('0x21')](respondWithResult(_0x2318ef,null))[_0xeae0('0x44')](handleError(_0x2318ef,null));};exports['destroy']=function(_0x365531,_0x5dcebe){return db[_0xeae0('0x42')][_0xeae0('0x43')]({'where':{'id':_0x365531[_0xeae0('0x3f')]['id']}})[_0xeae0('0x21')](handleEntityNotFound(_0x5dcebe,null))[_0xeae0('0x21')](removeEntity(_0x5dcebe,null))[_0xeae0('0x44')](handleError(_0x5dcebe,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a469bbe..f80ac26 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 _0xb574=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','idField','FieldId','lodash','util'];(function(_0x4f1a5b,_0x53c5f7){var _0x2a0e3a=function(_0x1fdffc){while(--_0x1fdffc){_0x4f1a5b['push'](_0x4f1a5b['shift']());}};_0x2a0e3a(++_0x53c5f7);}(_0xb574,0x106));var _0x4b57=function(_0x7d8b42,_0x48c0d5){_0x7d8b42=_0x7d8b42-0x0;var _0x1e5464=_0xb574[_0x7d8b42];return _0x1e5464;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x4b57('0x9'),_0x4b57('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x531a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x531a,0x100));var _0xa531=function(_0x52753e,_0x1718bc){_0x52753e=_0x52753e-0x0;var _0x5b2cd5=_0x531a[_0x52753e];return _0x5b2cd5;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var logger=require(_0xa531('0x2'))(_0xa531('0x3'));var moment=require(_0xa531('0x4'));var BPromise=require(_0xa531('0x5'));var rp=require(_0xa531('0x6'));var fs=require('fs');var path=require(_0xa531('0x7'));var rimraf=require(_0xa531('0x8'));var config=require(_0xa531('0x9'));var attributes=require('./intZendeskField.attributes');module[_0xa531('0xa')]=function(_0x4ec419,_0x266b43){return _0x4ec419[_0xa531('0xb')](_0xa531('0xc'),attributes,{'tableName':_0xa531('0xd'),'paranoid':![],'indexes':[{'name':_0xa531('0xe'),'fields':['idField',_0xa531('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5f999f8..fc843d1 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 _0x2c2e=['rpc','jayson/promise','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36ec2b,_0x4ffe29){var _0x32bfb9=function(_0x4db3a1){while(--_0x4db3a1){_0x36ec2b['push'](_0x36ec2b['shift']());}};_0x32bfb9(++_0x4ffe29);}(_0x2c2e,0x1b0));var _0xe2c2=function(_0x1d8e6d,_0x5a4761){_0x1d8e6d=_0x1d8e6d-0x0;var _0x3a7e3b=_0x2c2e[_0x1d8e6d];return _0x3a7e3b;};'use strict';var _=require(_0xe2c2('0x0'));var util=require('util');var moment=require(_0xe2c2('0x1'));var BPromise=require(_0xe2c2('0x2'));var rs=require(_0xe2c2('0x3'));var fs=require('fs');var Redis=require(_0xe2c2('0x4'));var db=require(_0xe2c2('0x5'))['db'];var utils=require(_0xe2c2('0x6'));var logger=require(_0xe2c2('0x7'))(_0xe2c2('0x8'));var config=require('../../config/environment');var jayson=require(_0xe2c2('0x9'));var client=jayson['client'][_0xe2c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a921b,_0x14bd31,_0x497dc7){return new BPromise(function(_0xc1fe45,_0x39fc64){return client[_0xe2c2('0xb')](_0x3a921b,_0x497dc7)[_0xe2c2('0xc')](function(_0x2cbffa){logger['info'](_0xe2c2('0xd'),_0x14bd31,'request\x20sent');logger[_0xe2c2('0xe')](_0xe2c2('0xf'),_0x14bd31,_0xe2c2('0x10'),JSON['stringify'](_0x2cbffa));if(_0x2cbffa['error']){if(_0x2cbffa[_0xe2c2('0x11')][_0xe2c2('0x12')]===0x1f4){logger[_0xe2c2('0x11')](_0xe2c2('0xd'),_0x14bd31,_0x2cbffa[_0xe2c2('0x11')]['message']);return _0x39fc64(_0x2cbffa['error']['message']);}logger[_0xe2c2('0x11')](_0xe2c2('0xd'),_0x14bd31,_0x2cbffa[_0xe2c2('0x11')][_0xe2c2('0x13')]);return _0xc1fe45(_0x2cbffa['error']['message']);}else{logger[_0xe2c2('0x14')](_0xe2c2('0xd'),_0x14bd31,_0xe2c2('0x10'));_0xc1fe45(_0x2cbffa['result'][_0xe2c2('0x13')]);}})[_0xe2c2('0x15')](function(_0x303f31){logger[_0xe2c2('0x11')](_0xe2c2('0xd'),_0x14bd31,_0x303f31);_0x39fc64(_0x303f31);});});} \ No newline at end of file +var _0xc7c4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x34043b,_0x135de7){var _0x4031ab=function(_0x1a1788){while(--_0x1a1788){_0x34043b['push'](_0x34043b['shift']());}};_0x4031ab(++_0x135de7);}(_0xc7c4,0x1b2));var _0x4c7c=function(_0x63cfc8,_0x4a0921){_0x63cfc8=_0x63cfc8-0x0;var _0x723916=_0xc7c4[_0x63cfc8];return _0x723916;};'use strict';var _=require('lodash');var util=require(_0x4c7c('0x0'));var moment=require('moment');var BPromise=require(_0x4c7c('0x1'));var rs=require(_0x4c7c('0x2'));var fs=require('fs');var Redis=require(_0x4c7c('0x3'));var db=require(_0x4c7c('0x4'))['db'];var utils=require(_0x4c7c('0x5'));var logger=require(_0x4c7c('0x6'))(_0x4c7c('0x7'));var config=require(_0x4c7c('0x8'));var jayson=require(_0x4c7c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x390168,_0x3457aa,_0x2058da){return new BPromise(function(_0x43c185,_0x453571){return client[_0x4c7c('0xa')](_0x390168,_0x2058da)[_0x4c7c('0xb')](function(_0x453d49){logger[_0x4c7c('0xc')](_0x4c7c('0xd'),_0x3457aa,_0x4c7c('0xe'));logger[_0x4c7c('0xf')](_0x4c7c('0x10'),_0x3457aa,_0x4c7c('0xe'),JSON[_0x4c7c('0x11')](_0x453d49));if(_0x453d49[_0x4c7c('0x12')]){if(_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x13')]===0x1f4){logger[_0x4c7c('0x12')](_0x4c7c('0xd'),_0x3457aa,_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x14')]);return _0x453571(_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x14')]);}logger[_0x4c7c('0x12')]('ZendeskField,\x20%s,\x20%s',_0x3457aa,_0x453d49['error'][_0x4c7c('0x14')]);return _0x43c185(_0x453d49[_0x4c7c('0x12')][_0x4c7c('0x14')]);}else{logger['info'](_0x4c7c('0xd'),_0x3457aa,'request\x20sent');_0x43c185(_0x453d49[_0x4c7c('0x15')][_0x4c7c('0x14')]);}})[_0x4c7c('0x16')](function(_0x4d6184){logger['error'](_0x4c7c('0xd'),_0x3457aa,_0x4d6184);_0x453571(_0x4d6184);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 5c38495..d8598b3 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 _0x478d=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x1df698,_0x4e8a9a){var _0x471850=function(_0x176001){while(--_0x176001){_0x1df698['push'](_0x1df698['shift']());}};_0x471850(++_0x4e8a9a);}(_0x478d,0x155));var _0xd478=function(_0x258196,_0x235f4e){_0x258196=_0x258196-0x0;var _0x3df790=_0x478d[_0x258196];return _0x3df790;};'use strict';var multer=require(_0xd478('0x0'));var util=require('util');var path=require(_0xd478('0x1'));var timeout=require(_0xd478('0x2'));var express=require(_0xd478('0x3'));var router=express['Router']();var auth=require(_0xd478('0x4'));var interaction=require(_0xd478('0x5'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xd478('0x6')]('/',auth[_0xd478('0x7')](),controller[_0xd478('0x8')]);router[_0xd478('0x6')](_0xd478('0x9'),auth['isAuthenticated'](),controller[_0xd478('0xa')]);router['get'](_0xd478('0xb'),auth[_0xd478('0x7')](),controller['getConfigurations']);router[_0xd478('0x6')]('/:id/fields',auth[_0xd478('0x7')](),controller[_0xd478('0xc')]);router['post']('/',auth[_0xd478('0x7')](),controller['create']);router[_0xd478('0xd')](_0xd478('0xb'),auth[_0xd478('0x7')](),controller[_0xd478('0xe')]);router[_0xd478('0xf')](_0xd478('0x9'),auth[_0xd478('0x7')](),controller['update']);router[_0xd478('0x10')]('/:id',auth[_0xd478('0x7')](),controller[_0xd478('0x11')]);module[_0xd478('0x12')]=router; \ No newline at end of file +var _0xd7f6=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','../../config/environment','./intZohoAccount.controller'];(function(_0x2a43b9,_0x2aa7ea){var _0x3b6c90=function(_0x5be37f){while(--_0x5be37f){_0x2a43b9['push'](_0x2a43b9['shift']());}};_0x3b6c90(++_0x2aa7ea);}(_0xd7f6,0xd6));var _0x6d7f=function(_0x21fc7a,_0x3cbef7){_0x21fc7a=_0x21fc7a-0x0;var _0x52f11c=_0xd7f6[_0x21fc7a];return _0x52f11c;};'use strict';var multer=require('multer');var util=require(_0x6d7f('0x0'));var path=require(_0x6d7f('0x1'));var timeout=require(_0x6d7f('0x2'));var express=require(_0x6d7f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d7f('0x4'));var controller=require(_0x6d7f('0x5'));router[_0x6d7f('0x6')]('/',auth[_0x6d7f('0x7')](),controller[_0x6d7f('0x8')]);router[_0x6d7f('0x6')](_0x6d7f('0x9'),auth[_0x6d7f('0x7')](),controller[_0x6d7f('0xa')]);router[_0x6d7f('0x6')](_0x6d7f('0xb'),auth[_0x6d7f('0x7')](),controller[_0x6d7f('0xc')]);router[_0x6d7f('0x6')]('/:id/fields',auth[_0x6d7f('0x7')](),controller[_0x6d7f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6d7f('0xe')]);router['post'](_0x6d7f('0xb'),auth['isAuthenticated'](),controller[_0x6d7f('0xf')]);router[_0x6d7f('0x10')]('/:id',auth[_0x6d7f('0x7')](),controller[_0x6d7f('0x11')]);router[_0x6d7f('0x12')]('/:id',auth[_0x6d7f('0x7')](),controller['destroy']);module[_0x6d7f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 539ce7b..b920a90 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 _0x02c6=['exports','STRING','sequelize'];(function(_0x4b001e,_0x261680){var _0x1e22de=function(_0x3b2bd5){while(--_0x3b2bd5){_0x4b001e['push'](_0x4b001e['shift']());}};_0x1e22de(++_0x261680);}(_0x02c6,0x7a));var _0x602c=function(_0x3890f8,_0x1b39df){_0x3890f8=_0x3890f8-0x0;var _0x40713e=_0x02c6[_0x3890f8];return _0x40713e;};'use strict';var Sequelize=require(_0x602c('0x0'));module[_0x602c('0x1')]={'name':{'type':Sequelize[_0x602c('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x602c('0x2')]},'zone':{'type':Sequelize[_0x602c('0x2')]},'clientId':{'type':Sequelize[_0x602c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x602c('0x2')]},'code':{'type':Sequelize[_0x602c('0x2')]},'refreshToken':{'type':Sequelize[_0x602c('0x2')]}}; \ No newline at end of file +var _0xbebf=['STRING','sequelize','exports'];(function(_0x4d3d13,_0x4c5bff){var _0x244df9=function(_0x575353){while(--_0x575353){_0x4d3d13['push'](_0x4d3d13['shift']());}};_0x244df9(++_0x4c5bff);}(_0xbebf,0xcd));var _0xfbeb=function(_0x3c64de,_0x4d2b21){_0x3c64de=_0x3c64de-0x0;var _0x3413b5=_0xbebf[_0x3c64de];return _0x3413b5;};'use strict';var Sequelize=require(_0xfbeb('0x0'));module[_0xfbeb('0x1')]={'name':{'type':Sequelize[_0xfbeb('0x2')]},'description':{'type':Sequelize[_0xfbeb('0x2')]},'host':{'type':Sequelize[_0xfbeb('0x2')]},'zone':{'type':Sequelize[_0xfbeb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xfbeb('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xfbeb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5877105..c85b6e6 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 _0xa22a=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','clientSecret','serverUrl','refreshToken','host','zoho.eu','com','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','set','apply','update','destroy','end','stack','name','index','map','ZohoAccount','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter'];(function(_0x1ab54c,_0x302a5a){var _0x1f1ca4=function(_0x4e8faa){while(--_0x4e8faa){_0x1ab54c['push'](_0x1ab54c['shift']());}};_0x1f1ca4(++_0x302a5a);}(_0xa22a,0x1d3));var _0xaa22=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa22a[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0xaa22('0x0'));var emlformat=require(_0xaa22('0x1'));var rimraf=require(_0xaa22('0x2'));var zipdir=require(_0xaa22('0x3'));var jsonpatch=require(_0xaa22('0x4'));var rp=require(_0xaa22('0x5'));var moment=require('moment');var BPromise=require(_0xaa22('0x6'));var Mustache=require(_0xaa22('0x7'));var util=require('util');var path=require(_0xaa22('0x8'));var sox=require(_0xaa22('0x9'));var csv=require(_0xaa22('0xa'));var ejs=require(_0xaa22('0xb'));var fs=require('fs');var _=require(_0xaa22('0xc'));var squel=require(_0xaa22('0xd'));var crypto=require('crypto');var jsforce=require(_0xaa22('0xe'));var deskjs=require(_0xaa22('0xf'));var toCsv=require(_0xaa22('0xa'));var querystring=require('querystring');var Papa=require(_0xaa22('0x10'));var Redis=require(_0xaa22('0x11'));var authService=require(_0xaa22('0x12'));var qs=require(_0xaa22('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa22('0x14'));var logger=require('../../config/logger')(_0xaa22('0x15'));var utils=require(_0xaa22('0x16'));var config=require('../../config/environment');var db=require(_0xaa22('0x17'))['db'];var integrations=require(_0xaa22('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xaa22('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x59ce25,_0x285399,_0x385fb0){if(_0x385fb0){var _0x110b86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x110b86[_0xaa22('0x1a')](_0x285399)){return _0x59ce25;}else{throw new db[(_0xaa22('0x1b'))]['ValidationError'](_0xaa22('0x1c'));}}else{return _0x59ce25;}}function respondWithRpcPromise(_0x2396f4,_0x5c2969,_0x31a645,_0x3b4f71){return new BPromise(function(_0x206bae,_0x10fcc){var _0x4221c0=_0x3b4f71||client;return _0x4221c0[_0xaa22('0x1d')](_0x2396f4,_0x31a645)[_0xaa22('0x1e')](function(_0x35aa36){logger[_0xaa22('0x1f')](_0xaa22('0x20'),_0x5c2969,_0xaa22('0x21'));logger[_0xaa22('0x22')](_0xaa22('0x23'),_0x5c2969,_0xaa22('0x21'),JSON[_0xaa22('0x24')](_0x35aa36));if(_0x35aa36['error']){if(_0x35aa36[_0xaa22('0x25')][_0xaa22('0x26')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5c2969,_0x35aa36[_0xaa22('0x25')][_0xaa22('0x27')]);return _0x10fcc(_0x35aa36[_0xaa22('0x25')][_0xaa22('0x27')]);}logger['error'](_0xaa22('0x20'),_0x5c2969,_0x35aa36[_0xaa22('0x25')][_0xaa22('0x27')]);return _0x206bae(_0x35aa36[_0xaa22('0x25')]['message']);}else{logger[_0xaa22('0x1f')](_0xaa22('0x20'),_0x5c2969,_0xaa22('0x21'));_0x206bae(_0x35aa36['result'][_0xaa22('0x27')]);}})['catch'](function(_0x944fc8){logger[_0xaa22('0x25')](_0xaa22('0x20'),_0x5c2969,_0x944fc8);_0x10fcc(_0x944fc8);});});}function respondWithStatusCode(_0x438e1a,_0x2b0997){_0x2b0997=_0x2b0997||0xcc;return function(_0x303cb1){if(_0x303cb1){return _0x438e1a[_0xaa22('0x28')](_0x2b0997);}return _0x438e1a[_0xaa22('0x29')](_0x2b0997)['end']();};}function respondWithResult(_0x2da23c,_0x2c2846){_0x2c2846=_0x2c2846||0xc8;return function(_0x5e1a54){if(_0x5e1a54){return _0x2da23c['status'](_0x2c2846)[_0xaa22('0x2a')](_0x5e1a54);}};}function respondWithFilteredResult(_0x5934cd,_0x65550c){return function(_0x333b46){if(_0x333b46){var _0x5a867b=_0x333b46[_0xaa22('0x2b')],_0x237ede=_0x65550c[_0xaa22('0x2c')],_0x42df71=_0x65550c[_0xaa22('0x2c')]+_0x65550c['limit'],_0x344b0a;if(_0x42df71>=_0x5a867b){_0x42df71=_0x5a867b;_0x344b0a=0xc8;}else{_0x344b0a=0xce;}_0x5934cd[_0xaa22('0x29')](_0x344b0a);return _0x5934cd[_0xaa22('0x2d')]('Content-Range',_0x237ede+'-'+_0x42df71+'/'+_0x5a867b)[_0xaa22('0x2a')](_0x333b46);}return null;};}function patchUpdates(_0x38b0cb){return function(_0x4c3fb7){try{jsonpatch[_0xaa22('0x2e')](_0x4c3fb7,_0x38b0cb,!![]);}catch(_0x5a9a91){return BPromise['reject'](_0x5a9a91);}return _0x4c3fb7['save']();};}function saveUpdates(_0x138e7a,_0x4d0e52){return function(_0x2f418f){if(_0x2f418f){return _0x2f418f[_0xaa22('0x2f')](_0x138e7a)[_0xaa22('0x1e')](function(_0x50235a){return _0x50235a;});}return null;};}function removeEntity(_0xc545e0,_0x25c906){return function(_0x38cdef){if(_0x38cdef){return _0x38cdef[_0xaa22('0x30')]()[_0xaa22('0x1e')](function(){_0xc545e0['status'](0xcc)[_0xaa22('0x31')]();});}};}function handleEntityNotFound(_0x436623,_0x2a71d9){return function(_0x1c8096){if(!_0x1c8096){_0x436623[_0xaa22('0x28')](0x194);}return _0x1c8096;};}function handleError(_0x106e82,_0x9db529){_0x9db529=_0x9db529||0x1f4;return function(_0x589666){logger[_0xaa22('0x25')](_0x589666[_0xaa22('0x32')]);if(_0x589666[_0xaa22('0x33')]){delete _0x589666['name'];}_0x106e82[_0xaa22('0x29')](_0x9db529)['send'](_0x589666);};}exports[_0xaa22('0x34')]=function(_0x59cbd8,_0x31bc28){var _0x4c02fe={},_0x2dbaf5={},_0x2b07fc={'count':0x0,'rows':[]};var _0x2196c0=_[_0xaa22('0x35')](db[_0xaa22('0x36')]['rawAttributes'],function(_0x56b366){return{'name':_0x56b366['fieldName'],'type':_0x56b366[_0xaa22('0x37')][_0xaa22('0x38')]};});_0x2dbaf5['model']=_['map'](_0x2196c0,'name');_0x2dbaf5['query']=_[_0xaa22('0x39')](_0x59cbd8[_0xaa22('0x3a')]);_0x2dbaf5['filters']=_[_0xaa22('0x3b')](_0x2dbaf5[_0xaa22('0x3c')],_0x2dbaf5[_0xaa22('0x3a')]);_0x4c02fe['attributes']=_[_0xaa22('0x3b')](_0x2dbaf5['model'],qs[_0xaa22('0x3d')](_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x3d')]));_0x4c02fe['attributes']=_0x4c02fe[_0xaa22('0x3e')][_0xaa22('0x3f')]?_0x4c02fe[_0xaa22('0x3e')]:_0x2dbaf5[_0xaa22('0x3c')];if(!_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x40')](_0xaa22('0x41'))){_0x4c02fe[_0xaa22('0x42')]=qs[_0xaa22('0x42')](_0x59cbd8['query'][_0xaa22('0x42')]);_0x4c02fe['offset']=qs['offset'](_0x59cbd8[_0xaa22('0x3a')]['offset']);}_0x4c02fe[_0xaa22('0x43')]=qs[_0xaa22('0x44')](_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x44')]);_0x4c02fe[_0xaa22('0x45')]=qs[_0xaa22('0x46')](_[_0xaa22('0x47')](_0x59cbd8[_0xaa22('0x3a')],_0x2dbaf5[_0xaa22('0x46')]),_0x2196c0);if(_0x59cbd8['query'][_0xaa22('0x48')]){_0x4c02fe[_0xaa22('0x45')]=_[_0xaa22('0x49')](_0x4c02fe['where'],{'$or':_['map'](_0x2196c0,function(_0x4e2f76){if(_0x4e2f76[_0xaa22('0x37')]!==_0xaa22('0x4a')){var _0x4bff23={};_0x4bff23[_0x4e2f76[_0xaa22('0x33')]]={'$like':'%'+_0x59cbd8['query'][_0xaa22('0x48')]+'%'};return _0x4bff23;}})});}_0x4c02fe=_[_0xaa22('0x49')]({},_0x4c02fe,_0x59cbd8[_0xaa22('0x4b')]);var _0x415dc8={'where':_0x4c02fe['where']};return db[_0xaa22('0x36')][_0xaa22('0x2b')](_0x415dc8)[_0xaa22('0x1e')](function(_0x106d34){_0x2b07fc['count']=_0x106d34;if(_0x59cbd8[_0xaa22('0x3a')][_0xaa22('0x4c')]){_0x4c02fe[_0xaa22('0x4d')]=[{'all':!![]}];}return db['ZohoAccount'][_0xaa22('0x4e')](_0x4c02fe);})['then'](function(_0x3b5ed8){_0x2b07fc[_0xaa22('0x4f')]=_0x3b5ed8;return _0x2b07fc;})[_0xaa22('0x1e')](respondWithFilteredResult(_0x31bc28,_0x4c02fe))['catch'](handleError(_0x31bc28,null));};exports[_0xaa22('0x50')]=function(_0x52e6a1,_0x41ca8f){var _0xc88005={'raw':![],'where':{'id':_0x52e6a1[_0xaa22('0x51')]['id']}},_0x446626={};_0x446626[_0xaa22('0x3c')]=_[_0xaa22('0x39')](db[_0xaa22('0x36')][_0xaa22('0x52')]);_0x446626[_0xaa22('0x3a')]=_[_0xaa22('0x39')](_0x52e6a1[_0xaa22('0x3a')]);_0x446626[_0xaa22('0x46')]=_[_0xaa22('0x3b')](_0x446626[_0xaa22('0x3c')],_0x446626[_0xaa22('0x3a')]);_0xc88005[_0xaa22('0x3e')]=_[_0xaa22('0x3b')](_0x446626[_0xaa22('0x3c')],qs['fields'](_0x52e6a1[_0xaa22('0x3a')][_0xaa22('0x3d')]));_0xc88005[_0xaa22('0x3e')]=_0xc88005['attributes'][_0xaa22('0x3f')]?_0xc88005[_0xaa22('0x3e')]:_0x446626[_0xaa22('0x3c')];if(_0x52e6a1[_0xaa22('0x3a')][_0xaa22('0x4c')]){_0xc88005[_0xaa22('0x4d')]=[{'all':!![]}];}_0xc88005=_[_0xaa22('0x49')]({},_0xc88005,_0x52e6a1[_0xaa22('0x4b')]);return db[_0xaa22('0x36')][_0xaa22('0x53')](_0xc88005)[_0xaa22('0x1e')](handleEntityNotFound(_0x41ca8f,null))[_0xaa22('0x1e')](respondWithResult(_0x41ca8f,null))[_0xaa22('0x54')](handleError(_0x41ca8f,null));};exports['create']=function(_0x2085c4,_0x11204d){return db[_0xaa22('0x36')][_0xaa22('0x55')](_0x2085c4['body'],{})[_0xaa22('0x1e')](respondWithResult(_0x11204d,0xc9))[_0xaa22('0x54')](handleError(_0x11204d,null));};exports[_0xaa22('0x2f')]=function(_0x5a7f7c,_0x319339){if(_0x5a7f7c[_0xaa22('0x56')]['id']){delete _0x5a7f7c[_0xaa22('0x56')]['id'];}return db['ZohoAccount'][_0xaa22('0x53')]({'where':{'id':_0x5a7f7c[_0xaa22('0x51')]['id']}})[_0xaa22('0x1e')](handleEntityNotFound(_0x319339,null))[_0xaa22('0x1e')](saveUpdates(_0x5a7f7c[_0xaa22('0x56')],null))[_0xaa22('0x1e')](respondWithResult(_0x319339,null))[_0xaa22('0x54')](handleError(_0x319339,null));};exports[_0xaa22('0x30')]=function(_0x44aefe,_0x3d3e5e){return db['ZohoAccount'][_0xaa22('0x53')]({'where':{'id':_0x44aefe[_0xaa22('0x51')]['id']}})[_0xaa22('0x1e')](handleEntityNotFound(_0x3d3e5e,null))[_0xaa22('0x1e')](removeEntity(_0x3d3e5e,null))['catch'](handleError(_0x3d3e5e,null));};exports[_0xaa22('0x57')]=function(_0x204d83,_0xf289a1,_0x2578c1){var _0x3bca61={};var _0x57ce33={};var _0xee952b;var _0x49ed30;return db['ZohoAccount'][_0xaa22('0x58')]({'where':{'id':_0x204d83[_0xaa22('0x51')]['id']}})[_0xaa22('0x1e')](handleEntityNotFound(_0xf289a1,null))[_0xaa22('0x1e')](function(_0x57bca4){if(_0x57bca4){_0xee952b=_0x57bca4;_0x57ce33[_0xaa22('0x3c')]=_[_0xaa22('0x39')](db[_0xaa22('0x59')]['rawAttributes']);_0x57ce33[_0xaa22('0x3a')]=_[_0xaa22('0x39')](_0x204d83[_0xaa22('0x3a')]);_0x57ce33[_0xaa22('0x46')]=_[_0xaa22('0x3b')](_0x57ce33[_0xaa22('0x3c')],_0x57ce33[_0xaa22('0x3a')]);_0x3bca61[_0xaa22('0x3e')]=_[_0xaa22('0x3b')](_0x57ce33[_0xaa22('0x3c')],qs[_0xaa22('0x3d')](_0x204d83['query'][_0xaa22('0x3d')]));_0x3bca61['attributes']=_0x3bca61['attributes'][_0xaa22('0x3f')]?_0x3bca61[_0xaa22('0x3e')]:_0x57ce33[_0xaa22('0x3c')];_0x3bca61[_0xaa22('0x43')]=qs['sort'](_0x204d83[_0xaa22('0x3a')][_0xaa22('0x44')]);_0x3bca61[_0xaa22('0x45')]=qs['filters'](_[_0xaa22('0x47')](_0x204d83[_0xaa22('0x3a')],_0x57ce33[_0xaa22('0x46')]));if(_0x204d83['query'][_0xaa22('0x48')]){_0x3bca61[_0xaa22('0x45')]=_[_0xaa22('0x49')](_0x3bca61[_0xaa22('0x45')],{'$or':_[_0xaa22('0x35')](_0x3bca61[_0xaa22('0x3e')],function(_0xe20f10){var _0x4746e5={};_0x4746e5[_0xe20f10]={'$like':'%'+_0x204d83[_0xaa22('0x3a')][_0xaa22('0x48')]+'%'};return _0x4746e5;})});}_0x3bca61=_[_0xaa22('0x49')]({},_0x3bca61,_0x204d83[_0xaa22('0x4b')]);return _0xee952b['getConfigurations'](_0x3bca61);}})[_0xaa22('0x1e')](function(_0x4ad21a){if(_0x4ad21a){_0x49ed30=_0x4ad21a[_0xaa22('0x3f')];if(!_0x204d83[_0xaa22('0x3a')]['hasOwnProperty'](_0xaa22('0x41'))){_0x3bca61[_0xaa22('0x42')]=qs[_0xaa22('0x42')](_0x204d83[_0xaa22('0x3a')][_0xaa22('0x42')]);_0x3bca61[_0xaa22('0x2c')]=qs[_0xaa22('0x2c')](_0x204d83[_0xaa22('0x3a')]['offset']);}return _0xee952b[_0xaa22('0x57')](_0x3bca61);}})[_0xaa22('0x1e')](function(_0x123d07){if(_0x123d07){return _0x123d07?{'count':_0x49ed30,'rows':_0x123d07}:null;}})[_0xaa22('0x1e')](respondWithResult(_0xf289a1,null))[_0xaa22('0x54')](handleError(_0xf289a1,null));};exports[_0xaa22('0x5a')]=function(_0xa14f99,_0x40e8ed,_0x4cc317){if(_0xa14f99['body']['id']){delete _0xa14f99[_0xaa22('0x56')]['id'];}return db[_0xaa22('0x36')]['findOne']({'where':{'id':_0xa14f99[_0xaa22('0x51')]['id']}})['then'](handleEntityNotFound(_0x40e8ed,null))['then'](function(_0x5b295b){if(_0x5b295b){_0xa14f99[_0xaa22('0x56')]['AccountId']=_0x5b295b['id'];_0xa14f99[_0xaa22('0x56')]['Subjects']=integrations[_0xaa22('0x5b')](_0xa14f99[_0xaa22('0x56')]['channel'],_0xa14f99[_0xaa22('0x56')][_0xaa22('0x37')]);_0xa14f99[_0xaa22('0x56')][_0xaa22('0x5c')]=integrations[_0xaa22('0x5d')](_0xa14f99[_0xaa22('0x56')][_0xaa22('0x5e')],_0xa14f99['body']['type']);return db['ZohoConfiguration'][_0xaa22('0x55')](_0xa14f99[_0xaa22('0x56')],{'include':[{'model':db[_0xaa22('0x5f')],'as':_0xaa22('0x60')},{'model':db[_0xaa22('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x40e8ed,null))[_0xaa22('0x54')](handleError(_0x40e8ed,null));};function getAccessToken(_0x29710d){return new Promise(function(_0x563a5f,_0x3e5fc0){var _0x20270c;switch(_0x29710d['zone']){case'US':_0x20270c=_0xaa22('0x61');break;case'AU':_0x20270c='https://accounts.zoho.com.au';break;case'EU':_0x20270c=_0xaa22('0x62');break;case'IN':_0x20270c='https://accounts.zoho.in';break;case'CN':_0x20270c=_0xaa22('0x63');break;default:_0x20270c=_0xaa22('0x62');break;}var _0x402aea={'method':_0xaa22('0x64'),'uri':_0x20270c+_0xaa22('0x65'),'qs':{'refresh_token':_0x29710d['refreshToken'],'client_id':_0x29710d[_0xaa22('0x66')],'client_secret':_0x29710d['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x402aea)[_0xaa22('0x1e')](function(_0x5f352e){if(_0x5f352e['access_token']){_0x563a5f(_0x5f352e[_0xaa22('0x67')]);}else{_0x3e5fc0(_0xaa22('0x68'));}})['catch'](function(_0x109004){_0x3e5fc0(_0x109004);});});}exports[_0xaa22('0x69')]=function(_0x47bd29,_0x147e52,_0x5d3a87){var _0xb053e5,_0x1602a0,_0x661fbc,_0x1b1c78,_0x2614c8;return db[_0xaa22('0x36')][_0xaa22('0x58')]({'where':{'id':_0x47bd29['params']['id']},'attributes':['id','host',_0xaa22('0x6a'),_0xaa22('0x66'),_0xaa22('0x6b'),_0xaa22('0x6c'),_0xaa22('0x26'),_0xaa22('0x6d')]})['then'](handleEntityNotFound(_0x147e52,null))[_0xaa22('0x1e')](function(_0x494060){_0x2614c8=_0x494060;_0xb053e5=_0x2614c8[_0xaa22('0x6e')];_0x1602a0=_0xb053e5===_0xaa22('0x6f')?'eu':_0xaa22('0x70');_0x661fbc=_0x2614c8[_0xaa22('0x6c')];var _0x8d8638=_0x661fbc['slice'](-0x1);if(_0x8d8638==='/'||_0x8d8638==='\x5c'||_0x8d8638===':'){_0x661fbc=_0x661fbc[_0xaa22('0x71')](0x0,_0x661fbc[_0xaa22('0x72')](_0x8d8638));}if(!_0x2614c8[_0xaa22('0x6d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2614c8);})[_0xaa22('0x1e')](function(_0x185f57){if(_0x185f57){return rp({'method':_0xaa22('0x73'),'uri':util['format'](_0xaa22('0x74'),_0x1602a0),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x185f57},'json':!![]});}})[_0xaa22('0x1e')](function(_0x3e4859){if(_0x3e4859){if(_0x3e4859[_0xaa22('0x75')]&&_0x3e4859[_0xaa22('0x75')]['error']){throw new Error(_0x3e4859['response'][_0xaa22('0x25')][_0xaa22('0x27')]);}var _0x32c950=[];var _0x508a06=[];var _0x2a3a85=['Owner',_0xaa22('0x76'),_0xaa22('0x77'),_0xaa22('0x78'),_0xaa22('0x79'),_0xaa22('0x7a'),_0xaa22('0x7b'),'Call_Type'];_0x508a06=_[_0xaa22('0x7c')](_0x3e4859[_0xaa22('0x3d')],function(_0x65be1c){return _0x2a3a85[_0xaa22('0x7d')](_0x65be1c[_0xaa22('0x7e')]);});for(var _0x417eca=0x0;_0x417eca<_0x508a06[_0xaa22('0x3f')];_0x417eca++){if(_0x508a06[_0x417eca][_0xaa22('0x7f')]===![]){_0x32c950[_0xaa22('0x80')]({'id':_0x508a06[_0x417eca]['id'],'name':_0x508a06[_0x417eca][_0xaa22('0x81')],'custom':_0x508a06[_0x417eca][_0xaa22('0x82')],'options':_0x508a06[_0x417eca][_0xaa22('0x83')]===_0xaa22('0x84')&&_0x508a06[_0x417eca]['pick_list_values'][_0xaa22('0x3f')]>-0x1?_[_0xaa22('0x35')](_0x508a06[_0x417eca]['pick_list_values'],function(_0x52d636){return{'name':_0x52d636,'value':_0x52d636};}):[]});}}return{'count':_0x32c950[_0xaa22('0x3f')],'rows':_0x32c950};}else{return{'count':0x0,'rows':[]};}})[_0xaa22('0x1e')](respondWithResult(_0x147e52,null))[_0xaa22('0x54')](function(_0x3afa47){var _0x407deb=_0x47bd29[_0xaa22('0x3a')][_0xaa22('0x1a')]?0x1f4:_0x3afa47['statusCode']||0x1f4;logger[_0xaa22('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa22('0x69'),_0x407deb,JSON['stringify'](_0x3afa47));delete _0x3afa47[_0xaa22('0x33')];if(_0x407deb===0x191){_0x407deb=0x190;}_0x147e52['status'](_0x407deb)['send'](_0x47bd29[_0xaa22('0x3a')]['test']?{'message':_0xaa22('0x85'),'statusCode':_0x3afa47[_0xaa22('0x86')]}:_0x3afa47);});}; \ No newline at end of file +var _0x62b7=['response','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','find','catch','update','body','getConfigurations','findOne','ZohoConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','host','zoho.eu','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20'];(function(_0x3b57fc,_0x1fbf22){var _0x146f10=function(_0x857ac3){while(--_0x857ac3){_0x3b57fc['push'](_0x3b57fc['shift']());}};_0x146f10(++_0x1fbf22);}(_0x62b7,0xa8));var _0x762b=function(_0xf1add8,_0x1254a0){_0xf1add8=_0xf1add8-0x0;var _0x8cc260=_0x62b7[_0xf1add8];return _0x8cc260;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x762b('0x0'));var rimraf=require(_0x762b('0x1'));var zipdir=require(_0x762b('0x2'));var jsonpatch=require(_0x762b('0x3'));var rp=require('request-promise');var moment=require(_0x762b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x762b('0x5'));var util=require('util');var path=require(_0x762b('0x6'));var sox=require(_0x762b('0x7'));var csv=require(_0x762b('0x8'));var ejs=require(_0x762b('0x9'));var fs=require('fs');var _=require(_0x762b('0xa'));var squel=require(_0x762b('0xb'));var crypto=require(_0x762b('0xc'));var jsforce=require(_0x762b('0xd'));var deskjs=require(_0x762b('0xe'));var toCsv=require(_0x762b('0x8'));var querystring=require(_0x762b('0xf'));var Papa=require('papaparse');var Redis=require(_0x762b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x762b('0x11'));var as=require(_0x762b('0x12'));var hardwareService=require(_0x762b('0x13'));var logger=require(_0x762b('0x14'))(_0x762b('0x15'));var utils=require(_0x762b('0x16'));var config=require(_0x762b('0x17'));var db=require(_0x762b('0x18'))['db'];var integrations=require(_0x762b('0x19'));var jayson=require(_0x762b('0x1a'));var client=jayson[_0x762b('0x1b')][_0x762b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xa36209,_0x4f4de9,_0x3d1df7){if(_0x3d1df7){var _0x1ed1fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ed1fd[_0x762b('0x1d')](_0x4f4de9)){return _0xa36209;}else{throw new db[(_0x762b('0x1e'))][(_0x762b('0x1f'))](_0x762b('0x20'));}}else{return _0xa36209;}}function respondWithRpcPromise(_0x92cbba,_0x2fb7e7,_0x1d51b7,_0x4aada1){return new BPromise(function(_0xdd3cf6,_0x417825){var _0xf807eb=_0x4aada1||client;return _0xf807eb[_0x762b('0x21')](_0x92cbba,_0x1d51b7)['then'](function(_0x178e62){logger[_0x762b('0x22')](_0x762b('0x23'),_0x2fb7e7,_0x762b('0x24'));logger[_0x762b('0x25')](_0x762b('0x26'),_0x2fb7e7,_0x762b('0x24'),JSON[_0x762b('0x27')](_0x178e62));if(_0x178e62['error']){if(_0x178e62['error'][_0x762b('0x28')]===0x1f4){logger[_0x762b('0x29')](_0x762b('0x23'),_0x2fb7e7,_0x178e62['error'][_0x762b('0x2a')]);return _0x417825(_0x178e62['error'][_0x762b('0x2a')]);}logger['error'](_0x762b('0x23'),_0x2fb7e7,_0x178e62[_0x762b('0x29')][_0x762b('0x2a')]);return _0xdd3cf6(_0x178e62[_0x762b('0x29')][_0x762b('0x2a')]);}else{logger[_0x762b('0x22')](_0x762b('0x23'),_0x2fb7e7,'request\x20sent');_0xdd3cf6(_0x178e62[_0x762b('0x2b')][_0x762b('0x2a')]);}})['catch'](function(_0x3d5f1f){logger[_0x762b('0x29')](_0x762b('0x23'),_0x2fb7e7,_0x3d5f1f);_0x417825(_0x3d5f1f);});});}function respondWithStatusCode(_0xe546db,_0x52c419){_0x52c419=_0x52c419||0xcc;return function(_0x4ebfc3){if(_0x4ebfc3){return _0xe546db[_0x762b('0x2c')](_0x52c419);}return _0xe546db['status'](_0x52c419)[_0x762b('0x2d')]();};}function respondWithResult(_0x19053f,_0x586c3c){_0x586c3c=_0x586c3c||0xc8;return function(_0x329a7a){if(_0x329a7a){return _0x19053f[_0x762b('0x2e')](_0x586c3c)['json'](_0x329a7a);}};}function respondWithFilteredResult(_0x1c376e,_0x66ec9e){return function(_0x481473){if(_0x481473){var _0x373d84=_0x481473['count'],_0x54b774=_0x66ec9e[_0x762b('0x2f')],_0x38be1d=_0x66ec9e[_0x762b('0x2f')]+_0x66ec9e[_0x762b('0x30')],_0x56b1f8;if(_0x38be1d>=_0x373d84){_0x38be1d=_0x373d84;_0x56b1f8=0xc8;}else{_0x56b1f8=0xce;}_0x1c376e[_0x762b('0x2e')](_0x56b1f8);return _0x1c376e[_0x762b('0x31')](_0x762b('0x32'),_0x54b774+'-'+_0x38be1d+'/'+_0x373d84)[_0x762b('0x33')](_0x481473);}return null;};}function patchUpdates(_0xc3d7e9){return function(_0x27f283){try{jsonpatch[_0x762b('0x34')](_0x27f283,_0xc3d7e9,!![]);}catch(_0x55823d){return BPromise[_0x762b('0x35')](_0x55823d);}return _0x27f283[_0x762b('0x36')]();};}function saveUpdates(_0x40c20a,_0x110875){return function(_0xd8368c){if(_0xd8368c){return _0xd8368c['update'](_0x40c20a)['then'](function(_0x24c623){return _0x24c623;});}return null;};}function removeEntity(_0x33827a,_0x581af9){return function(_0x500633){if(_0x500633){return _0x500633[_0x762b('0x37')]()[_0x762b('0x38')](function(){_0x33827a[_0x762b('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e035,_0x46f5f6){return function(_0x11ac95){if(!_0x11ac95){_0x13e035[_0x762b('0x2c')](0x194);}return _0x11ac95;};}function handleError(_0x5183a3,_0xc7a493){_0xc7a493=_0xc7a493||0x1f4;return function(_0x1503ab){logger[_0x762b('0x29')](_0x1503ab[_0x762b('0x39')]);if(_0x1503ab['name']){delete _0x1503ab[_0x762b('0x3a')];}_0x5183a3[_0x762b('0x2e')](_0xc7a493)['send'](_0x1503ab);};}exports[_0x762b('0x3b')]=function(_0x3a2e73,_0x5a6b47){var _0x4cadfa={},_0x1285ea={},_0x5aa504={'count':0x0,'rows':[]};var _0x2b75d8=_[_0x762b('0x3c')](db[_0x762b('0x3d')][_0x762b('0x3e')],function(_0x5a7e13){return{'name':_0x5a7e13[_0x762b('0x3f')],'type':_0x5a7e13['type'][_0x762b('0x40')]};});_0x1285ea[_0x762b('0x41')]=_[_0x762b('0x3c')](_0x2b75d8,_0x762b('0x3a'));_0x1285ea[_0x762b('0x42')]=_[_0x762b('0x43')](_0x3a2e73[_0x762b('0x42')]);_0x1285ea[_0x762b('0x44')]=_[_0x762b('0x45')](_0x1285ea['model'],_0x1285ea[_0x762b('0x42')]);_0x4cadfa['attributes']=_[_0x762b('0x45')](_0x1285ea[_0x762b('0x41')],qs['fields'](_0x3a2e73[_0x762b('0x42')][_0x762b('0x46')]));_0x4cadfa[_0x762b('0x47')]=_0x4cadfa[_0x762b('0x47')][_0x762b('0x48')]?_0x4cadfa['attributes']:_0x1285ea[_0x762b('0x41')];if(!_0x3a2e73[_0x762b('0x42')][_0x762b('0x49')]('nolimit')){_0x4cadfa[_0x762b('0x30')]=qs[_0x762b('0x30')](_0x3a2e73['query'][_0x762b('0x30')]);_0x4cadfa[_0x762b('0x2f')]=qs[_0x762b('0x2f')](_0x3a2e73[_0x762b('0x42')][_0x762b('0x2f')]);}_0x4cadfa[_0x762b('0x4a')]=qs['sort'](_0x3a2e73[_0x762b('0x42')]['sort']);_0x4cadfa[_0x762b('0x4b')]=qs['filters'](_[_0x762b('0x4c')](_0x3a2e73[_0x762b('0x42')],_0x1285ea[_0x762b('0x44')]),_0x2b75d8);if(_0x3a2e73[_0x762b('0x42')]['filter']){_0x4cadfa[_0x762b('0x4b')]=_[_0x762b('0x4d')](_0x4cadfa[_0x762b('0x4b')],{'$or':_['map'](_0x2b75d8,function(_0x31d73b){if(_0x31d73b[_0x762b('0x4e')]!==_0x762b('0x4f')){var _0x196d2e={};_0x196d2e[_0x31d73b['name']]={'$like':'%'+_0x3a2e73['query'][_0x762b('0x50')]+'%'};return _0x196d2e;}})});}_0x4cadfa=_[_0x762b('0x4d')]({},_0x4cadfa,_0x3a2e73[_0x762b('0x51')]);var _0x10694a={'where':_0x4cadfa[_0x762b('0x4b')]};return db[_0x762b('0x3d')]['count'](_0x10694a)[_0x762b('0x38')](function(_0x45086c){_0x5aa504[_0x762b('0x52')]=_0x45086c;if(_0x3a2e73['query'][_0x762b('0x53')]){_0x4cadfa[_0x762b('0x54')]=[{'all':!![]}];}return db[_0x762b('0x3d')][_0x762b('0x55')](_0x4cadfa);})[_0x762b('0x38')](function(_0x29b2d3){_0x5aa504[_0x762b('0x56')]=_0x29b2d3;return _0x5aa504;})[_0x762b('0x38')](respondWithFilteredResult(_0x5a6b47,_0x4cadfa))['catch'](handleError(_0x5a6b47,null));};exports['show']=function(_0xe43ba2,_0xa2277e){var _0x344439={'raw':![],'where':{'id':_0xe43ba2[_0x762b('0x57')]['id']}},_0x2e403f={};_0x2e403f[_0x762b('0x41')]=_['keys'](db['ZohoAccount']['rawAttributes']);_0x2e403f[_0x762b('0x42')]=_['keys'](_0xe43ba2[_0x762b('0x42')]);_0x2e403f[_0x762b('0x44')]=_[_0x762b('0x45')](_0x2e403f[_0x762b('0x41')],_0x2e403f['query']);_0x344439[_0x762b('0x47')]=_[_0x762b('0x45')](_0x2e403f[_0x762b('0x41')],qs[_0x762b('0x46')](_0xe43ba2[_0x762b('0x42')][_0x762b('0x46')]));_0x344439[_0x762b('0x47')]=_0x344439[_0x762b('0x47')][_0x762b('0x48')]?_0x344439['attributes']:_0x2e403f[_0x762b('0x41')];if(_0xe43ba2['query']['includeAll']){_0x344439[_0x762b('0x54')]=[{'all':!![]}];}_0x344439=_['merge']({},_0x344439,_0xe43ba2[_0x762b('0x51')]);return db[_0x762b('0x3d')][_0x762b('0x58')](_0x344439)['then'](handleEntityNotFound(_0xa2277e,null))[_0x762b('0x38')](respondWithResult(_0xa2277e,null))[_0x762b('0x59')](handleError(_0xa2277e,null));};exports['create']=function(_0x10fef2,_0x41d14f){return db[_0x762b('0x3d')]['create'](_0x10fef2['body'],{})[_0x762b('0x38')](respondWithResult(_0x41d14f,0xc9))['catch'](handleError(_0x41d14f,null));};exports[_0x762b('0x5a')]=function(_0x2fe59,_0x38c8e7){if(_0x2fe59[_0x762b('0x5b')]['id']){delete _0x2fe59[_0x762b('0x5b')]['id'];}return db[_0x762b('0x3d')]['find']({'where':{'id':_0x2fe59[_0x762b('0x57')]['id']}})[_0x762b('0x38')](handleEntityNotFound(_0x38c8e7,null))[_0x762b('0x38')](saveUpdates(_0x2fe59[_0x762b('0x5b')],null))[_0x762b('0x38')](respondWithResult(_0x38c8e7,null))[_0x762b('0x59')](handleError(_0x38c8e7,null));};exports[_0x762b('0x37')]=function(_0x5a9322,_0x1219ea){return db['ZohoAccount']['find']({'where':{'id':_0x5a9322[_0x762b('0x57')]['id']}})[_0x762b('0x38')](handleEntityNotFound(_0x1219ea,null))['then'](removeEntity(_0x1219ea,null))[_0x762b('0x59')](handleError(_0x1219ea,null));};exports[_0x762b('0x5c')]=function(_0x1ac0a3,_0x4a0971,_0x42a35a){var _0x17d013={};var _0x34c687={};var _0x40076f;var _0x3263fd;return db[_0x762b('0x3d')][_0x762b('0x5d')]({'where':{'id':_0x1ac0a3['params']['id']}})['then'](handleEntityNotFound(_0x4a0971,null))[_0x762b('0x38')](function(_0x41477a){if(_0x41477a){_0x40076f=_0x41477a;_0x34c687[_0x762b('0x41')]=_[_0x762b('0x43')](db[_0x762b('0x5e')][_0x762b('0x3e')]);_0x34c687[_0x762b('0x42')]=_['keys'](_0x1ac0a3[_0x762b('0x42')]);_0x34c687['filters']=_[_0x762b('0x45')](_0x34c687[_0x762b('0x41')],_0x34c687[_0x762b('0x42')]);_0x17d013[_0x762b('0x47')]=_['intersection'](_0x34c687[_0x762b('0x41')],qs['fields'](_0x1ac0a3[_0x762b('0x42')]['fields']));_0x17d013[_0x762b('0x47')]=_0x17d013[_0x762b('0x47')][_0x762b('0x48')]?_0x17d013['attributes']:_0x34c687['model'];_0x17d013[_0x762b('0x4a')]=qs[_0x762b('0x5f')](_0x1ac0a3[_0x762b('0x42')][_0x762b('0x5f')]);_0x17d013[_0x762b('0x4b')]=qs[_0x762b('0x44')](_[_0x762b('0x4c')](_0x1ac0a3[_0x762b('0x42')],_0x34c687['filters']));if(_0x1ac0a3[_0x762b('0x42')][_0x762b('0x50')]){_0x17d013['where']=_[_0x762b('0x4d')](_0x17d013[_0x762b('0x4b')],{'$or':_[_0x762b('0x3c')](_0x17d013['attributes'],function(_0x416cc9){var _0x211c64={};_0x211c64[_0x416cc9]={'$like':'%'+_0x1ac0a3['query'][_0x762b('0x50')]+'%'};return _0x211c64;})});}_0x17d013=_[_0x762b('0x4d')]({},_0x17d013,_0x1ac0a3[_0x762b('0x51')]);return _0x40076f[_0x762b('0x5c')](_0x17d013);}})['then'](function(_0x50a7c7){if(_0x50a7c7){_0x3263fd=_0x50a7c7['length'];if(!_0x1ac0a3['query'][_0x762b('0x49')](_0x762b('0x60'))){_0x17d013[_0x762b('0x30')]=qs[_0x762b('0x30')](_0x1ac0a3[_0x762b('0x42')][_0x762b('0x30')]);_0x17d013[_0x762b('0x2f')]=qs[_0x762b('0x2f')](_0x1ac0a3[_0x762b('0x42')][_0x762b('0x2f')]);}return _0x40076f[_0x762b('0x5c')](_0x17d013);}})[_0x762b('0x38')](function(_0x182446){if(_0x182446){return _0x182446?{'count':_0x3263fd,'rows':_0x182446}:null;}})[_0x762b('0x38')](respondWithResult(_0x4a0971,null))[_0x762b('0x59')](handleError(_0x4a0971,null));};exports[_0x762b('0x61')]=function(_0x16dd0b,_0x473665,_0x4a6010){if(_0x16dd0b[_0x762b('0x5b')]['id']){delete _0x16dd0b[_0x762b('0x5b')]['id'];}return db[_0x762b('0x3d')][_0x762b('0x5d')]({'where':{'id':_0x16dd0b[_0x762b('0x57')]['id']}})[_0x762b('0x38')](handleEntityNotFound(_0x473665,null))[_0x762b('0x38')](function(_0x38f44b){if(_0x38f44b){_0x16dd0b[_0x762b('0x5b')][_0x762b('0x62')]=_0x38f44b['id'];_0x16dd0b[_0x762b('0x5b')][_0x762b('0x63')]=integrations[_0x762b('0x64')](_0x16dd0b[_0x762b('0x5b')][_0x762b('0x65')],_0x16dd0b['body'][_0x762b('0x4e')]);_0x16dd0b[_0x762b('0x5b')][_0x762b('0x66')]=integrations[_0x762b('0x67')](_0x16dd0b[_0x762b('0x5b')][_0x762b('0x65')],_0x16dd0b[_0x762b('0x5b')][_0x762b('0x4e')]);return db[_0x762b('0x5e')][_0x762b('0x68')](_0x16dd0b['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x762b('0x69')],'as':_0x762b('0x66')}]});}return null;})['then'](respondWithResult(_0x473665,null))[_0x762b('0x59')](handleError(_0x473665,null));};function getAccessToken(_0x5a2be3){return new Promise(function(_0x37bc91,_0x185216){var _0xb2c2c5;switch(_0x5a2be3[_0x762b('0x6a')]){case'US':_0xb2c2c5=_0x762b('0x6b');break;case'AU':_0xb2c2c5=_0x762b('0x6c');break;case'EU':_0xb2c2c5=_0x762b('0x6d');break;case'IN':_0xb2c2c5=_0x762b('0x6e');break;case'CN':_0xb2c2c5=_0x762b('0x6f');break;default:_0xb2c2c5=_0x762b('0x6d');break;}var _0x514270={'method':_0x762b('0x70'),'uri':_0xb2c2c5+_0x762b('0x71'),'qs':{'refresh_token':_0x5a2be3[_0x762b('0x72')],'client_id':_0x5a2be3[_0x762b('0x73')],'client_secret':_0x5a2be3[_0x762b('0x74')],'grant_type':_0x762b('0x75')},'json':!![]};return rp(_0x514270)[_0x762b('0x38')](function(_0x5c2cf7){if(_0x5c2cf7[_0x762b('0x76')]){_0x37bc91(_0x5c2cf7[_0x762b('0x76')]);}else{_0x185216(_0x762b('0x77'));}})[_0x762b('0x59')](function(_0x147e2a){_0x185216(_0x147e2a);});});}exports['getFields']=function(_0x113a4b,_0x34bfe4,_0x3d6b5d){var _0x11114c,_0xac3dde,_0x2775c7,_0x1ba773,_0x1a3b4e;return db['ZohoAccount']['findOne']({'where':{'id':_0x113a4b[_0x762b('0x57')]['id']},'attributes':['id','host',_0x762b('0x6a'),'clientId','clientSecret',_0x762b('0x78'),_0x762b('0x28'),_0x762b('0x72')]})['then'](handleEntityNotFound(_0x34bfe4,null))['then'](function(_0x271e50){_0x1a3b4e=_0x271e50;_0x11114c=_0x1a3b4e[_0x762b('0x79')];_0xac3dde=_0x11114c===_0x762b('0x7a')?'eu':_0x762b('0x7b');_0x2775c7=_0x1a3b4e[_0x762b('0x78')];var _0x1010ac=_0x2775c7['slice'](-0x1);if(_0x1010ac==='/'||_0x1010ac==='\x5c'||_0x1010ac===':'){_0x2775c7=_0x2775c7[_0x762b('0x7c')](0x0,_0x2775c7['lastIndexOf'](_0x1010ac));}if(!_0x1a3b4e[_0x762b('0x72')]){throw new Error(_0x762b('0x7d'));}return getAccessToken(_0x1a3b4e);})['then'](function(_0x1c7082){if(_0x1c7082){return rp({'method':'GET','uri':util[_0x762b('0x7e')](_0x762b('0x7f'),_0xac3dde),'qs':{'module':_0x762b('0x80')},'headers':{'Authorization':_0x762b('0x81')+_0x1c7082},'json':!![]});}})[_0x762b('0x38')](function(_0x4e67c6){if(_0x4e67c6){if(_0x4e67c6[_0x762b('0x82')]&&_0x4e67c6[_0x762b('0x82')][_0x762b('0x29')]){throw new Error(_0x4e67c6[_0x762b('0x82')][_0x762b('0x29')][_0x762b('0x2a')]);}var _0x22029c=[];var _0xd543bb=[];var _0x4eb91f=['Owner',_0x762b('0x83'),_0x762b('0x84'),_0x762b('0x85'),'Call_Duration',_0x762b('0x86'),_0x762b('0x87'),_0x762b('0x88')];_0xd543bb=_[_0x762b('0x89')](_0x4e67c6[_0x762b('0x46')],function(_0x16db90){return _0x4eb91f[_0x762b('0x8a')](_0x16db90[_0x762b('0x8b')]);});for(var _0x27d8a4=0x0;_0x27d8a4<_0xd543bb['length'];_0x27d8a4++){if(_0xd543bb[_0x27d8a4][_0x762b('0x8c')]===![]){_0x22029c[_0x762b('0x8d')]({'id':_0xd543bb[_0x27d8a4]['id'],'name':_0xd543bb[_0x27d8a4][_0x762b('0x8e')],'custom':_0xd543bb[_0x27d8a4][_0x762b('0x8f')],'options':_0xd543bb[_0x27d8a4][_0x762b('0x90')]===_0x762b('0x91')&&_0xd543bb[_0x27d8a4][_0x762b('0x92')]['length']>-0x1?_[_0x762b('0x3c')](_0xd543bb[_0x27d8a4][_0x762b('0x92')],function(_0x42f56c){return{'name':_0x42f56c,'value':_0x42f56c};}):[]});}}return{'count':_0x22029c[_0x762b('0x48')],'rows':_0x22029c};}else{return{'count':0x0,'rows':[]};}})[_0x762b('0x38')](respondWithResult(_0x34bfe4,null))[_0x762b('0x59')](function(_0x2730c3){var _0x12e7c1=_0x113a4b[_0x762b('0x42')]['test']?0x1f4:_0x2730c3['statusCode']||0x1f4;logger['error'](_0x762b('0x93'),_0x762b('0x94'),_0x12e7c1,JSON[_0x762b('0x27')](_0x2730c3));delete _0x2730c3[_0x762b('0x3a')];if(_0x12e7c1===0x191){_0x12e7c1=0x190;}_0x34bfe4[_0x762b('0x2e')](_0x12e7c1)['send'](_0x113a4b[_0x762b('0x42')][_0x762b('0x1d')]?{'message':'Wrong\x20credentials','statusCode':_0x2730c3['statusCode']}:_0x2730c3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index cc15caf..42d6959 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 _0xdc38=['catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','https://accounts.zoho.com.cn','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0xdc38,0x1c7));var _0x8dc3=function(_0x5a2963,_0x48ec63){_0x5a2963=_0x5a2963-0x0;var _0x24ffb6=_0xdc38[_0x5a2963];return _0x24ffb6;};'use strict';var _=require(_0x8dc3('0x0'));var util=require('util');var logger=require(_0x8dc3('0x1'))(_0x8dc3('0x2'));var moment=require(_0x8dc3('0x3'));var BPromise=require(_0x8dc3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dc3('0x5'));var rimraf=require(_0x8dc3('0x6'));var config=require('../../config/environment');var attributes=require(_0x8dc3('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x8dc3('0x8')]=function(_0x4663a0,_0x100fbb){return _0x4663a0[_0x8dc3('0x9')](_0x8dc3('0xa'),attributes,{'tableName':_0x8dc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a37b3,_0x2192bd,_0x168720){if(_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0xd'))||_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0xe'))||_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0xf'))||_0x4a37b3[_0x8dc3('0xc')](_0x8dc3('0x10'))||_0x4a37b3[_0x8dc3('0xc')]('code')||_0x4a37b3['changed'](_0x8dc3('0x11'))){var _0x3dd607,_0x4f269c;_0x3dd607=_0x4a37b3[_0x8dc3('0xe')];var _0x18d934=_0x3dd607[_0x8dc3('0x12')](-0x1);if(_0x18d934==='/'||_0x18d934==='\x5c'||_0x18d934===':'){_0x3dd607=_0x3dd607[_0x8dc3('0x13')](0x0,_0x3dd607[_0x8dc3('0x14')](_0x18d934));}switch(_0x4a37b3[_0x8dc3('0xd')]){case'US':_0x4f269c='https://accounts.zoho.com';break;case'AU':_0x4f269c=_0x8dc3('0x15');break;case'IN':_0x4f269c=_0x8dc3('0x16');break;case'CN':_0x4f269c='https://accounts.zoho.com.cn';break;default:_0x4f269c=_0x8dc3('0x17');break;}var _0x117be2={'method':_0x8dc3('0x18'),'uri':_0x4f269c+'/oauth/v2/token','form':{'grant_type':_0x8dc3('0x19'),'client_id':_0x4a37b3[_0x8dc3('0xf')],'client_secret':_0x4a37b3['clientSecret'],'redirect_uri':_0x4a37b3[_0x8dc3('0xe')],'code':_0x4a37b3[_0x8dc3('0x1a')]},'headers':{'Content-Type':_0x8dc3('0x1b')}};return rp(_0x117be2)[_0x8dc3('0x1c')](function(_0xc07d6a){var _0x5913a1=JSON[_0x8dc3('0x1d')](_0xc07d6a);if(_0x5913a1[_0x8dc3('0x1e')]){_0x4a37b3[_0x8dc3('0x1f')]=_0x5913a1[_0x8dc3('0x1e')];logger[_0x8dc3('0x20')](util[_0x8dc3('0x21')](_0x8dc3('0x22'),_0x4a37b3['name'],_0x4a37b3['id']));}else{logger[_0x8dc3('0x23')](util[_0x8dc3('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a37b3['name'],_0x4a37b3['id']),util[_0x8dc3('0x24')](_0x5913a1,{'showHidden':![],'depth':null}));}return _0x168720(null,_0x2192bd);})[_0x8dc3('0x25')](function(_0x4c44f4){logger[_0x8dc3('0x23')](util[_0x8dc3('0x21')](_0x8dc3('0x26'),_0x4a37b3[_0x8dc3('0x27')],_0x4a37b3['id']),util[_0x8dc3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x168720(_0x4c44f4);});}else{return _0x168720(null,_0x2192bd);}},'beforeUpdate':function(_0x14a70e,_0x2805d0,_0x4d41c9){if(_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0xd'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0xe'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0xf'))||_0x14a70e['changed'](_0x8dc3('0x10'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0x1a'))||_0x14a70e[_0x8dc3('0xc')](_0x8dc3('0x11'))){var _0x930206,_0x70904a;_0x930206=_0x14a70e[_0x8dc3('0xe')];var _0x53ce71=_0x930206['slice'](-0x1);if(_0x53ce71==='/'||_0x53ce71==='\x5c'||_0x53ce71===':'){_0x930206=_0x930206[_0x8dc3('0x13')](0x0,_0x930206[_0x8dc3('0x14')](_0x53ce71));}switch(_0x14a70e[_0x8dc3('0xd')]){case'US':_0x70904a='https://accounts.zoho.com';break;case'AU':_0x70904a=_0x8dc3('0x15');break;case'IN':_0x70904a=_0x8dc3('0x16');break;case'CN':_0x70904a=_0x8dc3('0x28');break;default:_0x70904a='https://accounts.zoho.eu';break;}var _0x1c10bd={'method':_0x8dc3('0x18'),'uri':_0x70904a+'/oauth/v2/token','form':{'grant_type':_0x8dc3('0x19'),'client_id':_0x14a70e[_0x8dc3('0xf')],'client_secret':_0x14a70e[_0x8dc3('0x10')],'redirect_uri':_0x14a70e[_0x8dc3('0xe')],'code':_0x14a70e[_0x8dc3('0x1a')]},'headers':{'Content-Type':_0x8dc3('0x1b')}};return rp(_0x1c10bd)[_0x8dc3('0x1c')](function(_0x54448a){var _0x13ec49=JSON[_0x8dc3('0x1d')](_0x54448a);if(_0x13ec49[_0x8dc3('0x1e')]){_0x14a70e['refreshToken']=_0x13ec49[_0x8dc3('0x1e')];logger[_0x8dc3('0x20')](util[_0x8dc3('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14a70e[_0x8dc3('0x27')],_0x14a70e['id']));}else{logger['error'](util[_0x8dc3('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14a70e[_0x8dc3('0x27')],_0x14a70e['id']),util[_0x8dc3('0x24')](_0x13ec49,{'showHidden':![],'depth':null}));}return _0x4d41c9(null,_0x2805d0);})[_0x8dc3('0x25')](function(_0x4053ef){logger[_0x8dc3('0x23')](util[_0x8dc3('0x21')](_0x8dc3('0x26'),_0x14a70e['name'],_0x14a70e['id']),util[_0x8dc3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4d41c9(_0x4053ef);});}else{return _0x4d41c9(null,_0x2805d0);}}}});}; \ No newline at end of file +var _0x2551=['application/x-www-form-urlencoded','refresh_token','info','format','name','error','inspect','catch','then','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','zone','clientId','clientSecret','changed','code','host','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2551,0xcf));var _0x1255=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x2551[_0xd336fa];return _0x3370b1;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var logger=require('../../config/logger')(_0x1255('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1255('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1255('0x4'));var attributes=require(_0x1255('0x5'));var integrations=require(_0x1255('0x6'));module[_0x1255('0x7')]=function(_0x4072d5,_0xfc1671){return _0x4072d5['define'](_0x1255('0x8'),attributes,{'tableName':_0x1255('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31a96b,_0x6a0f04,_0x42b647){if(_0x31a96b['changed'](_0x1255('0xa'))||_0x31a96b['changed']('serverUrl')||_0x31a96b['changed'](_0x1255('0xb'))||_0x31a96b['changed'](_0x1255('0xc'))||_0x31a96b[_0x1255('0xd')](_0x1255('0xe'))||_0x31a96b[_0x1255('0xd')](_0x1255('0xf'))){var _0x4ad4a4,_0x3f95b4;_0x4ad4a4=_0x31a96b[_0x1255('0x10')];var _0x5bb2ae=_0x4ad4a4['slice'](-0x1);if(_0x5bb2ae==='/'||_0x5bb2ae==='\x5c'||_0x5bb2ae===':'){_0x4ad4a4=_0x4ad4a4[_0x1255('0x11')](0x0,_0x4ad4a4[_0x1255('0x12')](_0x5bb2ae));}switch(_0x31a96b[_0x1255('0xa')]){case'US':_0x3f95b4=_0x1255('0x13');break;case'AU':_0x3f95b4=_0x1255('0x14');break;case'IN':_0x3f95b4=_0x1255('0x15');break;case'CN':_0x3f95b4=_0x1255('0x16');break;default:_0x3f95b4=_0x1255('0x17');break;}var _0x2058c1={'method':_0x1255('0x18'),'uri':_0x3f95b4+_0x1255('0x19'),'form':{'grant_type':_0x1255('0x1a'),'client_id':_0x31a96b[_0x1255('0xb')],'client_secret':_0x31a96b[_0x1255('0xc')],'redirect_uri':_0x31a96b['serverUrl'],'code':_0x31a96b[_0x1255('0xe')]},'headers':{'Content-Type':_0x1255('0x1b')}};return rp(_0x2058c1)['then'](function(_0xda1b01){var _0x2adef5=JSON['parse'](_0xda1b01);if(_0x2adef5[_0x1255('0x1c')]){_0x31a96b['refreshToken']=_0x2adef5[_0x1255('0x1c')];logger[_0x1255('0x1d')](util[_0x1255('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a96b[_0x1255('0x1f')],_0x31a96b['id']));}else{logger[_0x1255('0x20')](util[_0x1255('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a96b[_0x1255('0x1f')],_0x31a96b['id']),util[_0x1255('0x21')](_0x2adef5,{'showHidden':![],'depth':null}));}return _0x42b647(null,_0x6a0f04);})[_0x1255('0x22')](function(_0x4c33b7){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a96b[_0x1255('0x1f')],_0x31a96b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x42b647(_0x4c33b7);});}else{return _0x42b647(null,_0x6a0f04);}},'beforeUpdate':function(_0x1f2636,_0x31a833,_0x3d79a4){if(_0x1f2636[_0x1255('0xd')](_0x1255('0xa'))||_0x1f2636['changed'](_0x1255('0x10'))||_0x1f2636[_0x1255('0xd')](_0x1255('0xb'))||_0x1f2636[_0x1255('0xd')](_0x1255('0xc'))||_0x1f2636[_0x1255('0xd')](_0x1255('0xe'))||_0x1f2636['changed'](_0x1255('0xf'))){var _0x37cbaa,_0x3e03bd;_0x37cbaa=_0x1f2636[_0x1255('0x10')];var _0x3c8419=_0x37cbaa['slice'](-0x1);if(_0x3c8419==='/'||_0x3c8419==='\x5c'||_0x3c8419===':'){_0x37cbaa=_0x37cbaa[_0x1255('0x11')](0x0,_0x37cbaa[_0x1255('0x12')](_0x3c8419));}switch(_0x1f2636[_0x1255('0xa')]){case'US':_0x3e03bd=_0x1255('0x13');break;case'AU':_0x3e03bd=_0x1255('0x14');break;case'IN':_0x3e03bd=_0x1255('0x15');break;case'CN':_0x3e03bd=_0x1255('0x16');break;default:_0x3e03bd=_0x1255('0x17');break;}var _0x52ae6a={'method':'POST','uri':_0x3e03bd+_0x1255('0x19'),'form':{'grant_type':_0x1255('0x1a'),'client_id':_0x1f2636['clientId'],'client_secret':_0x1f2636[_0x1255('0xc')],'redirect_uri':_0x1f2636[_0x1255('0x10')],'code':_0x1f2636['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x52ae6a)[_0x1255('0x23')](function(_0x11d1bb){var _0xe195d9=JSON['parse'](_0x11d1bb);if(_0xe195d9[_0x1255('0x1c')]){_0x1f2636[_0x1255('0x24')]=_0xe195d9[_0x1255('0x1c')];logger[_0x1255('0x1d')](util['format'](_0x1255('0x25'),_0x1f2636[_0x1255('0x1f')],_0x1f2636['id']));}else{logger['error'](util[_0x1255('0x1e')](_0x1255('0x26'),_0x1f2636[_0x1255('0x1f')],_0x1f2636['id']),util['inspect'](_0xe195d9,{'showHidden':![],'depth':null}));}return _0x3d79a4(null,_0x31a833);})[_0x1255('0x22')](function(_0x3bef10){logger['error'](util[_0x1255('0x1e')](_0x1255('0x26'),_0x1f2636[_0x1255('0x1f')],_0x1f2636['id']),util[_0x1255('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3d79a4(_0x3bef10);});}else{return _0x3d79a4(null,_0x31a833);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f103dc1..2a5cbf9 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 _0xa4a9=['map','model','ZohoAccount','find','raw','ShowZohoAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','GetZohoAccount','findAll','options','where','include','attributes'];(function(_0x53746a,_0x36ccf5){var _0x2942a0=function(_0x54a4be){while(--_0x54a4be){_0x53746a['push'](_0x53746a['shift']());}};_0x2942a0(++_0x36ccf5);}(_0xa4a9,0x126));var _0x9a4a=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xa4a9[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x9a4a('0x0'));var util=require(_0x9a4a('0x1'));var moment=require('moment');var BPromise=require(_0x9a4a('0x2'));var rs=require(_0x9a4a('0x3'));var fs=require('fs');var Redis=require(_0x9a4a('0x4'));var db=require(_0x9a4a('0x5'))['db'];var utils=require(_0x9a4a('0x6'));var logger=require(_0x9a4a('0x7'))(_0x9a4a('0x8'));var config=require(_0x9a4a('0x9'));var jayson=require(_0x9a4a('0xa'));var client=jayson[_0x9a4a('0xb')][_0x9a4a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xde25d1,_0x32026b,_0x1e5a1e){return new BPromise(function(_0x35cb55,_0x264a23){return client[_0x9a4a('0xd')](_0xde25d1,_0x1e5a1e)[_0x9a4a('0xe')](function(_0x2d9cec){logger[_0x9a4a('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x32026b,_0x9a4a('0x10'));logger[_0x9a4a('0x11')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x32026b,'request\x20sent',JSON[_0x9a4a('0x12')](_0x2d9cec));if(_0x2d9cec[_0x9a4a('0x13')]){if(_0x2d9cec['error'][_0x9a4a('0x14')]===0x1f4){logger[_0x9a4a('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x32026b,_0x2d9cec[_0x9a4a('0x13')][_0x9a4a('0x15')]);return _0x264a23(_0x2d9cec['error'][_0x9a4a('0x15')]);}logger[_0x9a4a('0x13')](_0x9a4a('0x16'),_0x32026b,_0x2d9cec[_0x9a4a('0x13')][_0x9a4a('0x15')]);return _0x35cb55(_0x2d9cec[_0x9a4a('0x13')][_0x9a4a('0x15')]);}else{logger[_0x9a4a('0xf')](_0x9a4a('0x16'),_0x32026b,'request\x20sent');_0x35cb55(_0x2d9cec[_0x9a4a('0x17')]['message']);}})['catch'](function(_0x56008f){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x32026b,_0x56008f);_0x264a23(_0x56008f);});});}exports[_0x9a4a('0x18')]=function(_0x1c9f55){var _0x1aec20=this;return new Promise(function(_0x1008f3,_0xa1225a){return db['ZohoAccount'][_0x9a4a('0x19')]({'raw':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c9f55['options']?_0x1c9f55['options'][_0x9a4a('0x1b')]||null:null,'attributes':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55[_0x9a4a('0x1a')]['attributes']||null:null,'limit':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55[_0x9a4a('0x1a')]['limit']||null:null,'include':_0x1c9f55[_0x9a4a('0x1a')]?_0x1c9f55['options'][_0x9a4a('0x1c')]?_['map'](_0x1c9f55[_0x9a4a('0x1a')][_0x9a4a('0x1c')],function(_0x47a8a9){return{'model':db[_0x47a8a9['model']],'as':_0x47a8a9['as'],'attributes':_0x47a8a9[_0x9a4a('0x1d')],'include':_0x47a8a9[_0x9a4a('0x1c')]?_[_0x9a4a('0x1e')](_0x47a8a9['include'],function(_0x385018){return{'model':db[_0x385018[_0x9a4a('0x1f')]],'as':_0x385018['as'],'attributes':_0x385018[_0x9a4a('0x1d')],'include':_0x385018['include']?_[_0x9a4a('0x1e')](_0x385018[_0x9a4a('0x1c')],function(_0x5ac4cf){return{'model':db[_0x5ac4cf[_0x9a4a('0x1f')]],'as':_0x5ac4cf['as'],'attributes':_0x5ac4cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a4a('0xe')](function(_0x52ccdd){logger['info'](_0x9a4a('0x18'),_0x1c9f55);logger[_0x9a4a('0x11')]('GetZohoAccount',_0x1c9f55,JSON['stringify'](_0x52ccdd));_0x1008f3(_0x52ccdd);})['catch'](function(_0x96528a){logger[_0x9a4a('0x13')]('GetZohoAccount',_0x96528a[_0x9a4a('0x15')],_0x1c9f55);_0xa1225a(_0x1aec20[_0x9a4a('0x13')](0x1f4,_0x96528a[_0x9a4a('0x15')]));});});};exports['ShowZohoAccount']=function(_0x30bd16){var _0x29c8dd=this;return new Promise(function(_0x5525b6,_0x55a513){return db[_0x9a4a('0x20')][_0x9a4a('0x21')]({'raw':_0x30bd16['options']?_0x30bd16[_0x9a4a('0x1a')][_0x9a4a('0x22')]===undefined?!![]:![]:!![],'where':_0x30bd16[_0x9a4a('0x1a')]?_0x30bd16[_0x9a4a('0x1a')][_0x9a4a('0x1b')]||null:null,'attributes':_0x30bd16['options']?_0x30bd16[_0x9a4a('0x1a')][_0x9a4a('0x1d')]||null:null,'include':_0x30bd16['options']?_0x30bd16['options'][_0x9a4a('0x1c')]?_[_0x9a4a('0x1e')](_0x30bd16[_0x9a4a('0x1a')]['include'],function(_0x3621e7){return{'model':db[_0x3621e7[_0x9a4a('0x1f')]],'as':_0x3621e7['as'],'attributes':_0x3621e7[_0x9a4a('0x1d')],'include':_0x3621e7['include']?_[_0x9a4a('0x1e')](_0x3621e7['include'],function(_0x1a7108){return{'model':db[_0x1a7108[_0x9a4a('0x1f')]],'as':_0x1a7108['as'],'attributes':_0x1a7108[_0x9a4a('0x1d')],'include':_0x1a7108['include']?_[_0x9a4a('0x1e')](_0x1a7108[_0x9a4a('0x1c')],function(_0x403b68){return{'model':db[_0x403b68['model']],'as':_0x403b68['as'],'attributes':_0x403b68['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a4a('0xe')](function(_0x1b5537){logger[_0x9a4a('0xf')](_0x9a4a('0x23'),_0x30bd16);logger[_0x9a4a('0x11')](_0x9a4a('0x23'),_0x30bd16,JSON[_0x9a4a('0x12')](_0x1b5537));_0x5525b6(_0x1b5537);})['catch'](function(_0xd207f1){logger['error'](_0x9a4a('0x23'),_0xd207f1['message'],_0x30bd16);_0x55a513(_0x29c8dd['error'](0x1f4,_0xd207f1[_0x9a4a('0x15')]));});});}; \ No newline at end of file +var _0xe134=['stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','raw','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x40f4de,_0x38d0cb){var _0x3678dd=function(_0x3fdb40){while(--_0x3fdb40){_0x40f4de['push'](_0x40f4de['shift']());}};_0x3678dd(++_0x38d0cb);}(_0xe134,0x170));var _0x4e13=function(_0x13b28b,_0x5769fd){_0x13b28b=_0x13b28b-0x0;var _0x521b3d=_0xe134[_0x13b28b];return _0x521b3d;};'use strict';var _=require(_0x4e13('0x0'));var util=require(_0x4e13('0x1'));var moment=require(_0x4e13('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e13('0x3'));var fs=require('fs');var Redis=require(_0x4e13('0x4'));var db=require(_0x4e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e13('0x6'))(_0x4e13('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e13('0x8'));var client=jayson[_0x4e13('0x9')][_0x4e13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22ade6,_0x4c90f0,_0x1449d7){return new BPromise(function(_0x13887a,_0x5f1b18){return client['request'](_0x22ade6,_0x1449d7)[_0x4e13('0xb')](function(_0x43da09){logger[_0x4e13('0xc')](_0x4e13('0xd'),_0x4c90f0,'request\x20sent');logger[_0x4e13('0xe')](_0x4e13('0xf'),_0x4c90f0,_0x4e13('0x10'),JSON[_0x4e13('0x11')](_0x43da09));if(_0x43da09[_0x4e13('0x12')]){if(_0x43da09[_0x4e13('0x12')][_0x4e13('0x13')]===0x1f4){logger['error'](_0x4e13('0xd'),_0x4c90f0,_0x43da09[_0x4e13('0x12')][_0x4e13('0x14')]);return _0x5f1b18(_0x43da09['error'][_0x4e13('0x14')]);}logger['error'](_0x4e13('0xd'),_0x4c90f0,_0x43da09[_0x4e13('0x12')][_0x4e13('0x14')]);return _0x13887a(_0x43da09[_0x4e13('0x12')][_0x4e13('0x14')]);}else{logger[_0x4e13('0xc')](_0x4e13('0xd'),_0x4c90f0,'request\x20sent');_0x13887a(_0x43da09[_0x4e13('0x15')][_0x4e13('0x14')]);}})[_0x4e13('0x16')](function(_0x1848e1){logger['error'](_0x4e13('0xd'),_0x4c90f0,_0x1848e1);_0x5f1b18(_0x1848e1);});});}exports[_0x4e13('0x17')]=function(_0x1b9b6d){var _0x5ebf68=this;return new Promise(function(_0x293948,_0x3ea9){return db[_0x4e13('0x18')][_0x4e13('0x19')]({'raw':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1b')]||null:null,'attributes':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')]['attributes']||null:null,'limit':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1c')]||null:null,'include':_0x1b9b6d[_0x4e13('0x1a')]?_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x1b9b6d[_0x4e13('0x1a')][_0x4e13('0x1d')],function(_0x1cb495){return{'model':db[_0x1cb495[_0x4e13('0x1f')]],'as':_0x1cb495['as'],'attributes':_0x1cb495[_0x4e13('0x20')],'include':_0x1cb495[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x1cb495[_0x4e13('0x1d')],function(_0x3c0631){return{'model':db[_0x3c0631[_0x4e13('0x1f')]],'as':_0x3c0631['as'],'attributes':_0x3c0631[_0x4e13('0x20')],'include':_0x3c0631[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x3c0631[_0x4e13('0x1d')],function(_0xd7cfcc){return{'model':db[_0xd7cfcc[_0x4e13('0x1f')]],'as':_0xd7cfcc['as'],'attributes':_0xd7cfcc[_0x4e13('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4e13('0xb')](function(_0x355fa8){logger[_0x4e13('0xc')](_0x4e13('0x17'),_0x1b9b6d);logger[_0x4e13('0xe')](_0x4e13('0x17'),_0x1b9b6d,JSON['stringify'](_0x355fa8));_0x293948(_0x355fa8);})[_0x4e13('0x16')](function(_0x35f17e){logger['error'](_0x4e13('0x17'),_0x35f17e[_0x4e13('0x14')],_0x1b9b6d);_0x3ea9(_0x5ebf68[_0x4e13('0x12')](0x1f4,_0x35f17e[_0x4e13('0x14')]));});});};exports['ShowZohoAccount']=function(_0x8e972d){var _0x52c0bd=this;return new Promise(function(_0x3d26e1,_0x3e341d){return db[_0x4e13('0x18')]['find']({'raw':_0x8e972d[_0x4e13('0x1a')]?_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x21')]===undefined?!![]:![]:!![],'where':_0x8e972d[_0x4e13('0x1a')]?_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x1b')]||null:null,'attributes':_0x8e972d[_0x4e13('0x1a')]?_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x20')]||null:null,'include':_0x8e972d['options']?_0x8e972d['options'][_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x8e972d[_0x4e13('0x1a')][_0x4e13('0x1d')],function(_0x2fce13){return{'model':db[_0x2fce13[_0x4e13('0x1f')]],'as':_0x2fce13['as'],'attributes':_0x2fce13[_0x4e13('0x20')],'include':_0x2fce13[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x2fce13['include'],function(_0x3bc818){return{'model':db[_0x3bc818[_0x4e13('0x1f')]],'as':_0x3bc818['as'],'attributes':_0x3bc818[_0x4e13('0x20')],'include':_0x3bc818[_0x4e13('0x1d')]?_[_0x4e13('0x1e')](_0x3bc818[_0x4e13('0x1d')],function(_0x2af036){return{'model':db[_0x2af036['model']],'as':_0x2af036['as'],'attributes':_0x2af036[_0x4e13('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c2114){logger[_0x4e13('0xc')]('ShowZohoAccount',_0x8e972d);logger[_0x4e13('0xe')](_0x4e13('0x22'),_0x8e972d,JSON[_0x4e13('0x11')](_0x1c2114));_0x3d26e1(_0x1c2114);})[_0x4e13('0x16')](function(_0x45d2d3){logger[_0x4e13('0x12')](_0x4e13('0x22'),_0x45d2d3[_0x4e13('0x14')],_0x8e972d);_0x3e341d(_0x52c0bd['error'](0x1f4,_0x45d2d3['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 32f10bd..2298596 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 _0x980c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x16c8bd,_0x1db58e){var _0x257855=function(_0x4521d1){while(--_0x4521d1){_0x16c8bd['push'](_0x16c8bd['shift']());}};_0x257855(++_0x1db58e);}(_0x980c,0x100));var _0xc980=function(_0x597e21,_0x1373c9){_0x597e21=_0x597e21-0x0;var _0x152802=_0x980c[_0x597e21];return _0x152802;};'use strict';var multer=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var path=require(_0xc980('0x2'));var timeout=require(_0xc980('0x3'));var express=require(_0xc980('0x4'));var router=express[_0xc980('0x5')]();var auth=require(_0xc980('0x6'));var interaction=require(_0xc980('0x7'));var config=require(_0xc980('0x8'));var controller=require(_0xc980('0x9'));router[_0xc980('0xa')]('/',auth['isAuthenticated'](),controller[_0xc980('0xb')]);router[_0xc980('0xa')](_0xc980('0xc'),auth[_0xc980('0xd')](),controller[_0xc980('0xe')]);router[_0xc980('0xa')](_0xc980('0xf'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xc980('0x10'),auth['isAuthenticated'](),controller[_0xc980('0x11')]);router[_0xc980('0xa')](_0xc980('0x12'),auth['isAuthenticated'](),controller[_0xc980('0x13')]);router[_0xc980('0x14')]('/',auth[_0xc980('0xd')](),controller['create']);router[_0xc980('0x15')](_0xc980('0xc'),auth[_0xc980('0xd')](),controller[_0xc980('0x16')]);router[_0xc980('0x17')](_0xc980('0xc'),auth[_0xc980('0xd')](),controller[_0xc980('0x18')]);module[_0xc980('0x19')]=router; \ No newline at end of file +var _0x0427=['/:id','show','/:id/fields','getFields','getDescriptions','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x1257dd,_0x159b6c){var _0x3ec13c=function(_0x110674){while(--_0x110674){_0x1257dd['push'](_0x1257dd['shift']());}};_0x3ec13c(++_0x159b6c);}(_0x0427,0x137));var _0x7042=function(_0x18999e,_0x3311d0){_0x18999e=_0x18999e-0x0;var _0xb0fb8=_0x0427[_0x18999e];return _0xb0fb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7042('0x0'));var timeout=require(_0x7042('0x1'));var express=require('express');var router=express[_0x7042('0x2')]();var auth=require(_0x7042('0x3'));var interaction=require(_0x7042('0x4'));var config=require(_0x7042('0x5'));var controller=require(_0x7042('0x6'));router[_0x7042('0x7')]('/',auth[_0x7042('0x8')](),controller['index']);router[_0x7042('0x7')](_0x7042('0x9'),auth[_0x7042('0x8')](),controller[_0x7042('0xa')]);router[_0x7042('0x7')](_0x7042('0xb'),auth[_0x7042('0x8')](),controller[_0x7042('0xc')]);router[_0x7042('0x7')]('/:id/subjects',auth[_0x7042('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x7042('0xd')]);router['post']('/',auth[_0x7042('0x8')](),controller[_0x7042('0xe')]);router[_0x7042('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7042('0x10')]);router[_0x7042('0x11')](_0x7042('0x9'),auth[_0x7042('0x8')](),controller[_0x7042('0x12')]);module[_0x7042('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4ee7b39..6e1eb1c 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 _0x702c=['contact_lead','STRING','sequelize','ENUM','lead','contact','nothing'];(function(_0x1326ea,_0x409dd9){var _0x4b3537=function(_0x589dd8){while(--_0x589dd8){_0x1326ea['push'](_0x1326ea['shift']());}};_0x4b3537(++_0x409dd9);}(_0x702c,0xe9));var _0xc702=function(_0x5427f4,_0x2ee354){_0x5427f4=_0x5427f4-0x0;var _0x38bbf4=_0x702c[_0x5427f4];return _0x38bbf4;};'use strict';var Sequelize=require(_0xc702('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc702('0x1')](_0xc702('0x2'),_0xc702('0x3'),_0xc702('0x4')),'defaultValue':_0xc702('0x2')},'moduleSearch':{'type':Sequelize[_0xc702('0x1')]('contact_lead',_0xc702('0x3'),_0xc702('0x2')),'defaultValue':_0xc702('0x5')},'description':{'type':Sequelize[_0xc702('0x6')]}}; \ No newline at end of file +var _0x8c80=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8c80,0x1b5));var _0x08c8=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x8c80[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x08c8('0x0'));module[_0x08c8('0x1')]={'name':{'type':Sequelize[_0x08c8('0x2')]},'moduleCreate':{'type':Sequelize[_0x08c8('0x3')](_0x08c8('0x4'),_0x08c8('0x5'),_0x08c8('0x6')),'defaultValue':_0x08c8('0x4')},'moduleSearch':{'type':Sequelize[_0x08c8('0x3')](_0x08c8('0x7'),_0x08c8('0x5'),_0x08c8('0x4')),'defaultValue':_0x08c8('0x7')},'description':{'type':Sequelize[_0x08c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 682f08f..4ca96b3 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 _0xc666=['apply','reject','save','update','destroy','sendStatus','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','findOne','ZohoField','order','pick','length','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','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','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset'];(function(_0x232ec4,_0x59ec26){var _0x1c14a0=function(_0x254f63){while(--_0x254f63){_0x232ec4['push'](_0x232ec4['shift']());}};_0x1c14a0(++_0x59ec26);}(_0xc666,0xe8));var _0x6c66=function(_0x2d5459,_0x4448f8){_0x2d5459=_0x2d5459-0x0;var _0x3129d3=_0xc666[_0x2d5459];return _0x3129d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c66('0x0'));var rimraf=require(_0x6c66('0x1'));var zipdir=require(_0x6c66('0x2'));var jsonpatch=require(_0x6c66('0x3'));var rp=require(_0x6c66('0x4'));var moment=require(_0x6c66('0x5'));var BPromise=require(_0x6c66('0x6'));var Mustache=require(_0x6c66('0x7'));var util=require(_0x6c66('0x8'));var path=require(_0x6c66('0x9'));var sox=require(_0x6c66('0xa'));var csv=require('to-csv');var ejs=require(_0x6c66('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6c66('0xc'));var crypto=require(_0x6c66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c66('0xe'));var Papa=require(_0x6c66('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6c66('0x10'));var as=require(_0x6c66('0x11'));var hardwareService=require(_0x6c66('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6c66('0x13'));var config=require(_0x6c66('0x14'));var db=require(_0x6c66('0x15'))['db'];var jayson=require(_0x6c66('0x16'));var client=jayson[_0x6c66('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4d8109,_0x4db968,_0x5b1f8e){if(_0x5b1f8e){var _0x4c2293=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c2293[_0x6c66('0x18')](_0x4db968)){return _0x4d8109;}else{throw new db['Sequelize'][(_0x6c66('0x19'))](_0x6c66('0x1a'));}}else{return _0x4d8109;}}function respondWithRpcPromise(_0x440939,_0x5b22a4,_0x5dc63e,_0x5e9d12){return new BPromise(function(_0x234441,_0x1ac5c5){var _0x1fddbe=_0x5e9d12||client;return _0x1fddbe[_0x6c66('0x1b')](_0x440939,_0x5dc63e)[_0x6c66('0x1c')](function(_0x452627){logger[_0x6c66('0x1d')]('ZohoConfiguration,\x20%s,\x20%s',_0x5b22a4,_0x6c66('0x1e'));logger[_0x6c66('0x1f')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5b22a4,'request\x20sent',JSON[_0x6c66('0x20')](_0x452627));if(_0x452627[_0x6c66('0x21')]){if(_0x452627[_0x6c66('0x21')][_0x6c66('0x22')]===0x1f4){logger[_0x6c66('0x21')](_0x6c66('0x23'),_0x5b22a4,_0x452627[_0x6c66('0x21')][_0x6c66('0x24')]);return _0x1ac5c5(_0x452627[_0x6c66('0x21')][_0x6c66('0x24')]);}logger[_0x6c66('0x21')](_0x6c66('0x23'),_0x5b22a4,_0x452627[_0x6c66('0x21')]['message']);return _0x234441(_0x452627[_0x6c66('0x21')]['message']);}else{logger[_0x6c66('0x1d')](_0x6c66('0x23'),_0x5b22a4,'request\x20sent');_0x234441(_0x452627[_0x6c66('0x25')]['message']);}})[_0x6c66('0x26')](function(_0x29d596){logger[_0x6c66('0x21')](_0x6c66('0x23'),_0x5b22a4,_0x29d596);_0x1ac5c5(_0x29d596);});});}function respondWithStatusCode(_0x50b639,_0x22f39e){_0x22f39e=_0x22f39e||0xcc;return function(_0x565460){if(_0x565460){return _0x50b639['sendStatus'](_0x22f39e);}return _0x50b639[_0x6c66('0x27')](_0x22f39e)[_0x6c66('0x28')]();};}function respondWithResult(_0x51d544,_0xf52455){_0xf52455=_0xf52455||0xc8;return function(_0xcac241){if(_0xcac241){return _0x51d544[_0x6c66('0x27')](_0xf52455)[_0x6c66('0x29')](_0xcac241);}};}function respondWithFilteredResult(_0x33618c,_0x19b24a){return function(_0x5adc42){if(_0x5adc42){var _0xc4f3ea=_0x5adc42[_0x6c66('0x2a')],_0x21c6a5=_0x19b24a['offset'],_0x3054e8=_0x19b24a[_0x6c66('0x2b')]+_0x19b24a['limit'],_0x533f4f;if(_0x3054e8>=_0xc4f3ea){_0x3054e8=_0xc4f3ea;_0x533f4f=0xc8;}else{_0x533f4f=0xce;}_0x33618c[_0x6c66('0x27')](_0x533f4f);return _0x33618c['set']('Content-Range',_0x21c6a5+'-'+_0x3054e8+'/'+_0xc4f3ea)['json'](_0x5adc42);}return null;};}function patchUpdates(_0xc766da){return function(_0xef4f0d){try{jsonpatch[_0x6c66('0x2c')](_0xef4f0d,_0xc766da,!![]);}catch(_0x5438fe){return BPromise[_0x6c66('0x2d')](_0x5438fe);}return _0xef4f0d[_0x6c66('0x2e')]();};}function saveUpdates(_0x43ec69,_0x254faa){return function(_0x58f824){if(_0x58f824){return _0x58f824[_0x6c66('0x2f')](_0x43ec69)[_0x6c66('0x1c')](function(_0x3aa057){return _0x3aa057;});}return null;};}function removeEntity(_0x1e46e0,_0x3936db){return function(_0x749677){if(_0x749677){return _0x749677[_0x6c66('0x30')]()[_0x6c66('0x1c')](function(){_0x1e46e0[_0x6c66('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48fda7,_0x15e84e){return function(_0xaccf5c){if(!_0xaccf5c){_0x48fda7[_0x6c66('0x31')](0x194);}return _0xaccf5c;};}function handleError(_0xdbf582,_0x22c705){_0x22c705=_0x22c705||0x1f4;return function(_0x40410e){logger[_0x6c66('0x21')](_0x40410e['stack']);if(_0x40410e['name']){delete _0x40410e[_0x6c66('0x32')];}_0xdbf582[_0x6c66('0x27')](_0x22c705)[_0x6c66('0x33')](_0x40410e);};}exports[_0x6c66('0x34')]=function(_0x2af61b,_0xc428c3){var _0x2ece7b={},_0x228968={},_0x1c46d0={'count':0x0,'rows':[]};var _0x9a15df=_['map'](db[_0x6c66('0x35')][_0x6c66('0x36')],function(_0x245052){return{'name':_0x245052[_0x6c66('0x37')],'type':_0x245052[_0x6c66('0x38')][_0x6c66('0x39')]};});_0x228968['model']=_[_0x6c66('0x3a')](_0x9a15df,_0x6c66('0x32'));_0x228968[_0x6c66('0x3b')]=_['keys'](_0x2af61b['query']);_0x228968[_0x6c66('0x3c')]=_['intersection'](_0x228968['model'],_0x228968[_0x6c66('0x3b')]);_0x2ece7b['attributes']=_[_0x6c66('0x3d')](_0x228968[_0x6c66('0x3e')],qs[_0x6c66('0x3f')](_0x2af61b[_0x6c66('0x3b')]['fields']));_0x2ece7b['attributes']=_0x2ece7b[_0x6c66('0x40')]['length']?_0x2ece7b[_0x6c66('0x40')]:_0x228968['model'];if(!_0x2af61b[_0x6c66('0x3b')]['hasOwnProperty']('nolimit')){_0x2ece7b[_0x6c66('0x41')]=qs['limit'](_0x2af61b['query'][_0x6c66('0x41')]);_0x2ece7b[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x2af61b['query']['offset']);}_0x2ece7b['order']=qs[_0x6c66('0x42')](_0x2af61b[_0x6c66('0x3b')][_0x6c66('0x42')]);_0x2ece7b[_0x6c66('0x43')]=qs['filters'](_['pick'](_0x2af61b['query'],_0x228968[_0x6c66('0x3c')]),_0x9a15df);if(_0x2af61b[_0x6c66('0x3b')][_0x6c66('0x44')]){_0x2ece7b[_0x6c66('0x43')]=_[_0x6c66('0x45')](_0x2ece7b[_0x6c66('0x43')],{'$or':_[_0x6c66('0x3a')](_0x9a15df,function(_0x285cd2){if(_0x285cd2['type']!==_0x6c66('0x46')){var _0x1b468c={};_0x1b468c[_0x285cd2[_0x6c66('0x32')]]={'$like':'%'+_0x2af61b[_0x6c66('0x3b')]['filter']+'%'};return _0x1b468c;}})});}_0x2ece7b=_[_0x6c66('0x45')]({},_0x2ece7b,_0x2af61b[_0x6c66('0x47')]);var _0x2c0c72={'where':_0x2ece7b[_0x6c66('0x43')]};return db[_0x6c66('0x35')]['count'](_0x2c0c72)[_0x6c66('0x1c')](function(_0x39a619){_0x1c46d0[_0x6c66('0x2a')]=_0x39a619;if(_0x2af61b[_0x6c66('0x3b')][_0x6c66('0x48')]){_0x2ece7b[_0x6c66('0x49')]=[{'all':!![]}];}return db[_0x6c66('0x35')][_0x6c66('0x4a')](_0x2ece7b);})[_0x6c66('0x1c')](function(_0x326e63){_0x1c46d0[_0x6c66('0x4b')]=_0x326e63;return _0x1c46d0;})[_0x6c66('0x1c')](respondWithFilteredResult(_0xc428c3,_0x2ece7b))[_0x6c66('0x26')](handleError(_0xc428c3,null));};exports[_0x6c66('0x4c')]=function(_0x34c899,_0x1e340b){var _0x543e34={'raw':![],'where':{'id':_0x34c899[_0x6c66('0x4d')]['id']}},_0x56e363={};_0x56e363['model']=_[_0x6c66('0x4e')](db[_0x6c66('0x35')][_0x6c66('0x36')]);_0x56e363[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x34c899['query']);_0x56e363[_0x6c66('0x3c')]=_['intersection'](_0x56e363[_0x6c66('0x3e')],_0x56e363['query']);_0x543e34[_0x6c66('0x40')]=_[_0x6c66('0x3d')](_0x56e363['model'],qs[_0x6c66('0x3f')](_0x34c899[_0x6c66('0x3b')][_0x6c66('0x3f')]));_0x543e34['attributes']=_0x543e34[_0x6c66('0x40')]['length']?_0x543e34[_0x6c66('0x40')]:_0x56e363[_0x6c66('0x3e')];if(_0x34c899[_0x6c66('0x3b')][_0x6c66('0x48')]){_0x543e34['include']=[{'all':!![]}];}_0x543e34=_[_0x6c66('0x45')]({},_0x543e34,_0x34c899[_0x6c66('0x47')]);return db[_0x6c66('0x35')][_0x6c66('0x4f')](_0x543e34)[_0x6c66('0x1c')](handleEntityNotFound(_0x1e340b,null))[_0x6c66('0x1c')](respondWithResult(_0x1e340b,null))[_0x6c66('0x26')](handleError(_0x1e340b,null));};exports['create']=function(_0x1b4c85,_0x469ccb){return db[_0x6c66('0x35')][_0x6c66('0x50')](_0x1b4c85[_0x6c66('0x51')],{})['then'](respondWithResult(_0x469ccb,0xc9))[_0x6c66('0x26')](handleError(_0x469ccb,null));};exports[_0x6c66('0x2f')]=function(_0x13aae7,_0x2a84d6){if(_0x13aae7['body']['id']){delete _0x13aae7[_0x6c66('0x51')]['id'];}return db[_0x6c66('0x35')][_0x6c66('0x4f')]({'where':{'id':_0x13aae7['params']['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x2a84d6,null))[_0x6c66('0x1c')](saveUpdates(_0x13aae7['body'],null))[_0x6c66('0x1c')](respondWithResult(_0x2a84d6,null))[_0x6c66('0x26')](handleError(_0x2a84d6,null));};exports['destroy']=function(_0x5c50c3,_0xd6a30a){return db[_0x6c66('0x35')]['find']({'where':{'id':_0x5c50c3[_0x6c66('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd6a30a,null))[_0x6c66('0x1c')](removeEntity(_0xd6a30a,null))[_0x6c66('0x26')](handleError(_0xd6a30a,null));};exports[_0x6c66('0x52')]=function(_0x1961f8,_0x373129,_0x214aab){var _0x7a311a={};var _0x5b0900={};var _0x3c1ea2;var _0x1f5c42;return db[_0x6c66('0x35')][_0x6c66('0x53')]({'where':{'id':_0x1961f8[_0x6c66('0x4d')]['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x373129,null))['then'](function(_0x23955e){if(_0x23955e){_0x3c1ea2=_0x23955e;_0x5b0900[_0x6c66('0x3e')]=_[_0x6c66('0x4e')](db[_0x6c66('0x54')][_0x6c66('0x36')]);_0x5b0900[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x1961f8[_0x6c66('0x3b')]);_0x5b0900[_0x6c66('0x3c')]=_['intersection'](_0x5b0900[_0x6c66('0x3e')],_0x5b0900[_0x6c66('0x3b')]);_0x7a311a[_0x6c66('0x40')]=_[_0x6c66('0x3d')](_0x5b0900[_0x6c66('0x3e')],qs[_0x6c66('0x3f')](_0x1961f8['query'][_0x6c66('0x3f')]));_0x7a311a[_0x6c66('0x40')]=_0x7a311a['attributes']['length']?_0x7a311a[_0x6c66('0x40')]:_0x5b0900['model'];_0x7a311a[_0x6c66('0x55')]=qs[_0x6c66('0x42')](_0x1961f8['query'][_0x6c66('0x42')]);_0x7a311a[_0x6c66('0x43')]=qs[_0x6c66('0x3c')](_[_0x6c66('0x56')](_0x1961f8[_0x6c66('0x3b')],_0x5b0900['filters']));if(_0x1961f8[_0x6c66('0x3b')][_0x6c66('0x44')]){_0x7a311a[_0x6c66('0x43')]=_[_0x6c66('0x45')](_0x7a311a[_0x6c66('0x43')],{'$or':_[_0x6c66('0x3a')](_0x7a311a[_0x6c66('0x40')],function(_0x4bb3ba){var _0x5b1574={};_0x5b1574[_0x4bb3ba]={'$like':'%'+_0x1961f8[_0x6c66('0x3b')][_0x6c66('0x44')]+'%'};return _0x5b1574;})});}_0x7a311a=_[_0x6c66('0x45')]({},_0x7a311a,_0x1961f8[_0x6c66('0x47')]);return _0x3c1ea2[_0x6c66('0x52')](_0x7a311a);}})[_0x6c66('0x1c')](function(_0x16630e){if(_0x16630e){_0x1f5c42=_0x16630e[_0x6c66('0x57')];if(!_0x1961f8['query'][_0x6c66('0x58')](_0x6c66('0x59'))){_0x7a311a[_0x6c66('0x41')]=qs[_0x6c66('0x41')](_0x1961f8[_0x6c66('0x3b')]['limit']);_0x7a311a[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x1961f8[_0x6c66('0x3b')][_0x6c66('0x2b')]);}return _0x3c1ea2['getFields'](_0x7a311a);}})['then'](function(_0x1c8ac8){if(_0x1c8ac8){return _0x1c8ac8?{'count':_0x1f5c42,'rows':_0x1c8ac8}:null;}})[_0x6c66('0x1c')](respondWithResult(_0x373129,null))[_0x6c66('0x26')](handleError(_0x373129,null));};exports[_0x6c66('0x5a')]=function(_0x4b7547,_0x212145,_0x3fa13c){var _0x179ca3={};var _0x5d7db8={};var _0x364879;var _0x1ef746;return db[_0x6c66('0x35')][_0x6c66('0x53')]({'where':{'id':_0x4b7547[_0x6c66('0x4d')]['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x212145,null))['then'](function(_0x105b1c){if(_0x105b1c){_0x364879=_0x105b1c;_0x5d7db8['model']=_[_0x6c66('0x4e')](db[_0x6c66('0x54')][_0x6c66('0x36')]);_0x5d7db8[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x4b7547['query']);_0x5d7db8[_0x6c66('0x3c')]=_[_0x6c66('0x3d')](_0x5d7db8[_0x6c66('0x3e')],_0x5d7db8[_0x6c66('0x3b')]);_0x179ca3[_0x6c66('0x40')]=_[_0x6c66('0x3d')](_0x5d7db8['model'],qs[_0x6c66('0x3f')](_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x3f')]));_0x179ca3[_0x6c66('0x40')]=_0x179ca3['attributes']['length']?_0x179ca3[_0x6c66('0x40')]:_0x5d7db8[_0x6c66('0x3e')];_0x179ca3[_0x6c66('0x55')]=qs[_0x6c66('0x42')](_0x4b7547[_0x6c66('0x3b')]['sort']);_0x179ca3[_0x6c66('0x43')]=qs[_0x6c66('0x3c')](_['pick'](_0x4b7547['query'],_0x5d7db8['filters']));if(_0x4b7547['query']['filter']){_0x179ca3['where']=_[_0x6c66('0x45')](_0x179ca3[_0x6c66('0x43')],{'$or':_[_0x6c66('0x3a')](_0x179ca3[_0x6c66('0x40')],function(_0x820b8e){var _0x33ab00={};_0x33ab00[_0x820b8e]={'$like':'%'+_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x44')]+'%'};return _0x33ab00;})});}_0x179ca3=_[_0x6c66('0x45')]({},_0x179ca3,_0x4b7547[_0x6c66('0x47')]);return _0x364879['getSubjects'](_0x179ca3);}})[_0x6c66('0x1c')](function(_0x34cef7){if(_0x34cef7){_0x1ef746=_0x34cef7[_0x6c66('0x57')];if(!_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x58')](_0x6c66('0x59'))){_0x179ca3[_0x6c66('0x41')]=qs[_0x6c66('0x41')](_0x4b7547['query'][_0x6c66('0x41')]);_0x179ca3[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x4b7547[_0x6c66('0x3b')][_0x6c66('0x2b')]);}return _0x364879['getSubjects'](_0x179ca3);}})[_0x6c66('0x1c')](function(_0x1cb763){if(_0x1cb763){return _0x1cb763?{'count':_0x1ef746,'rows':_0x1cb763}:null;}})[_0x6c66('0x1c')](respondWithResult(_0x212145,null))[_0x6c66('0x26')](handleError(_0x212145,null));};exports[_0x6c66('0x5b')]=function(_0x44df18,_0x57da65,_0x1022ab){var _0x531c95={};var _0x37bbf7={};var _0x447ba2;var _0x34acaf;return db[_0x6c66('0x35')][_0x6c66('0x53')]({'where':{'id':_0x44df18[_0x6c66('0x4d')]['id']}})[_0x6c66('0x1c')](handleEntityNotFound(_0x57da65,null))[_0x6c66('0x1c')](function(_0xda33de){if(_0xda33de){_0x447ba2=_0xda33de;_0x37bbf7['model']=_['keys'](db[_0x6c66('0x54')][_0x6c66('0x36')]);_0x37bbf7[_0x6c66('0x3b')]=_[_0x6c66('0x4e')](_0x44df18['query']);_0x37bbf7[_0x6c66('0x3c')]=_[_0x6c66('0x3d')](_0x37bbf7[_0x6c66('0x3e')],_0x37bbf7[_0x6c66('0x3b')]);_0x531c95['attributes']=_['intersection'](_0x37bbf7[_0x6c66('0x3e')],qs[_0x6c66('0x3f')](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x3f')]));_0x531c95['attributes']=_0x531c95[_0x6c66('0x40')][_0x6c66('0x57')]?_0x531c95[_0x6c66('0x40')]:_0x37bbf7[_0x6c66('0x3e')];_0x531c95[_0x6c66('0x55')]=qs['sort'](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x42')]);_0x531c95[_0x6c66('0x43')]=qs['filters'](_['pick'](_0x44df18[_0x6c66('0x3b')],_0x37bbf7[_0x6c66('0x3c')]));if(_0x44df18[_0x6c66('0x3b')][_0x6c66('0x44')]){_0x531c95[_0x6c66('0x43')]=_[_0x6c66('0x45')](_0x531c95[_0x6c66('0x43')],{'$or':_['map'](_0x531c95[_0x6c66('0x40')],function(_0x9f5d4d){var _0x260355={};_0x260355[_0x9f5d4d]={'$like':'%'+_0x44df18[_0x6c66('0x3b')]['filter']+'%'};return _0x260355;})});}_0x531c95=_[_0x6c66('0x45')]({},_0x531c95,_0x44df18[_0x6c66('0x47')]);return _0x447ba2['getDescriptions'](_0x531c95);}})[_0x6c66('0x1c')](function(_0x3ad678){if(_0x3ad678){_0x34acaf=_0x3ad678[_0x6c66('0x57')];if(!_0x44df18['query'][_0x6c66('0x58')](_0x6c66('0x59'))){_0x531c95[_0x6c66('0x41')]=qs[_0x6c66('0x41')](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x41')]);_0x531c95[_0x6c66('0x2b')]=qs[_0x6c66('0x2b')](_0x44df18[_0x6c66('0x3b')][_0x6c66('0x2b')]);}return _0x447ba2['getDescriptions'](_0x531c95);}})[_0x6c66('0x1c')](function(_0x467c73){if(_0x467c73){return _0x467c73?{'count':_0x34acaf,'rows':_0x467c73}:null;}})[_0x6c66('0x1c')](respondWithResult(_0x57da65,null))[_0x6c66('0x26')](handleError(_0x57da65,null));}; \ No newline at end of file +var _0x3cc1=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','ZohoConfiguration','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','ZohoField','filter','getFields','getSubjects','findOne','getDescriptions','html-pdf'];(function(_0x34219e,_0x46b1cc){var _0x1deeb9=function(_0x5e3b6d){while(--_0x5e3b6d){_0x34219e['push'](_0x34219e['shift']());}};_0x1deeb9(++_0x46b1cc);}(_0x3cc1,0x16f));var _0x13cc=function(_0x3b54fb,_0x4b40d8){_0x3b54fb=_0x3b54fb-0x0;var _0x309b3f=_0x3cc1[_0x3b54fb];return _0x309b3f;};'use strict';var pdf=require(_0x13cc('0x0'));var emlformat=require(_0x13cc('0x1'));var rimraf=require(_0x13cc('0x2'));var zipdir=require(_0x13cc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13cc('0x4'));var moment=require(_0x13cc('0x5'));var BPromise=require(_0x13cc('0x6'));var Mustache=require(_0x13cc('0x7'));var util=require(_0x13cc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x13cc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x13cc('0xa'));var squel=require(_0x13cc('0xb'));var crypto=require(_0x13cc('0xc'));var jsforce=require(_0x13cc('0xd'));var deskjs=require(_0x13cc('0xe'));var toCsv=require(_0x13cc('0x9'));var querystring=require(_0x13cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x13cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x13cc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13cc('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x13cc('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x13cc('0x14')][_0x13cc('0x15')]({'port':0x232a});function checkPasswordPattern(_0x22ccd8,_0x29c5c5,_0x24e224){if(_0x24e224){var _0x46f8f7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46f8f7['test'](_0x29c5c5)){return _0x22ccd8;}else{throw new db[(_0x13cc('0x16'))][(_0x13cc('0x17'))](_0x13cc('0x18'));}}else{return _0x22ccd8;}}function respondWithRpcPromise(_0x467bf1,_0x4b605e,_0x25c423,_0x304394){return new BPromise(function(_0x37c23d,_0x23d3a6){var _0x5df9ed=_0x304394||client;return _0x5df9ed[_0x13cc('0x19')](_0x467bf1,_0x25c423)[_0x13cc('0x1a')](function(_0x1efd96){logger[_0x13cc('0x1b')](_0x13cc('0x1c'),_0x4b605e,_0x13cc('0x1d'));logger[_0x13cc('0x1e')](_0x13cc('0x1f'),_0x4b605e,'request\x20sent',JSON[_0x13cc('0x20')](_0x1efd96));if(_0x1efd96['error']){if(_0x1efd96[_0x13cc('0x21')][_0x13cc('0x22')]===0x1f4){logger[_0x13cc('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x4b605e,_0x1efd96[_0x13cc('0x21')][_0x13cc('0x23')]);return _0x23d3a6(_0x1efd96[_0x13cc('0x21')][_0x13cc('0x23')]);}logger[_0x13cc('0x21')](_0x13cc('0x1c'),_0x4b605e,_0x1efd96[_0x13cc('0x21')]['message']);return _0x37c23d(_0x1efd96[_0x13cc('0x21')][_0x13cc('0x23')]);}else{logger['info'](_0x13cc('0x1c'),_0x4b605e,_0x13cc('0x1d'));_0x37c23d(_0x1efd96[_0x13cc('0x24')][_0x13cc('0x23')]);}})['catch'](function(_0x3f10d0){logger[_0x13cc('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x4b605e,_0x3f10d0);_0x23d3a6(_0x3f10d0);});});}function respondWithStatusCode(_0x56f13d,_0x404cd4){_0x404cd4=_0x404cd4||0xcc;return function(_0x5173dd){if(_0x5173dd){return _0x56f13d[_0x13cc('0x25')](_0x404cd4);}return _0x56f13d[_0x13cc('0x26')](_0x404cd4)[_0x13cc('0x27')]();};}function respondWithResult(_0x2a0cb5,_0x3153f3){_0x3153f3=_0x3153f3||0xc8;return function(_0x4823be){if(_0x4823be){return _0x2a0cb5[_0x13cc('0x26')](_0x3153f3)[_0x13cc('0x28')](_0x4823be);}};}function respondWithFilteredResult(_0x5b284f,_0x58d8ab){return function(_0x9ac2fa){if(_0x9ac2fa){var _0x3d2d4b=_0x9ac2fa[_0x13cc('0x29')],_0x8e59b1=_0x58d8ab[_0x13cc('0x2a')],_0x4c007f=_0x58d8ab[_0x13cc('0x2a')]+_0x58d8ab[_0x13cc('0x2b')],_0x12c9b8;if(_0x4c007f>=_0x3d2d4b){_0x4c007f=_0x3d2d4b;_0x12c9b8=0xc8;}else{_0x12c9b8=0xce;}_0x5b284f[_0x13cc('0x26')](_0x12c9b8);return _0x5b284f[_0x13cc('0x2c')]('Content-Range',_0x8e59b1+'-'+_0x4c007f+'/'+_0x3d2d4b)[_0x13cc('0x28')](_0x9ac2fa);}return null;};}function patchUpdates(_0x3349b4){return function(_0x351f77){try{jsonpatch[_0x13cc('0x2d')](_0x351f77,_0x3349b4,!![]);}catch(_0x37fdb7){return BPromise[_0x13cc('0x2e')](_0x37fdb7);}return _0x351f77[_0x13cc('0x2f')]();};}function saveUpdates(_0x356192,_0x35296f){return function(_0x4a69d6){if(_0x4a69d6){return _0x4a69d6[_0x13cc('0x30')](_0x356192)[_0x13cc('0x1a')](function(_0x2c7202){return _0x2c7202;});}return null;};}function removeEntity(_0x470ce3,_0x32869f){return function(_0x1a2ec9){if(_0x1a2ec9){return _0x1a2ec9[_0x13cc('0x31')]()[_0x13cc('0x1a')](function(){_0x470ce3[_0x13cc('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6047,_0x3c67ff){return function(_0x4e7957){if(!_0x4e7957){_0x2c6047[_0x13cc('0x25')](0x194);}return _0x4e7957;};}function handleError(_0x145607,_0x261989){_0x261989=_0x261989||0x1f4;return function(_0x599928){logger[_0x13cc('0x21')](_0x599928[_0x13cc('0x32')]);if(_0x599928[_0x13cc('0x33')]){delete _0x599928[_0x13cc('0x33')];}_0x145607[_0x13cc('0x26')](_0x261989)[_0x13cc('0x34')](_0x599928);};}exports[_0x13cc('0x35')]=function(_0x4ef61b,_0xef77be){var _0xcb8da5={},_0x396c82={},_0x13fc17={'count':0x0,'rows':[]};var _0x53ab9e=_[_0x13cc('0x36')](db['ZohoConfiguration']['rawAttributes'],function(_0x37c37c){return{'name':_0x37c37c[_0x13cc('0x37')],'type':_0x37c37c[_0x13cc('0x38')][_0x13cc('0x39')]};});_0x396c82[_0x13cc('0x3a')]=_['map'](_0x53ab9e,_0x13cc('0x33'));_0x396c82['query']=_[_0x13cc('0x3b')](_0x4ef61b['query']);_0x396c82[_0x13cc('0x3c')]=_[_0x13cc('0x3d')](_0x396c82['model'],_0x396c82[_0x13cc('0x3e')]);_0xcb8da5[_0x13cc('0x3f')]=_[_0x13cc('0x3d')](_0x396c82[_0x13cc('0x3a')],qs['fields'](_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x40')]));_0xcb8da5['attributes']=_0xcb8da5['attributes'][_0x13cc('0x41')]?_0xcb8da5[_0x13cc('0x3f')]:_0x396c82['model'];if(!_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x42')](_0x13cc('0x43'))){_0xcb8da5[_0x13cc('0x2b')]=qs['limit'](_0x4ef61b['query']['limit']);_0xcb8da5[_0x13cc('0x2a')]=qs[_0x13cc('0x2a')](_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x2a')]);}_0xcb8da5[_0x13cc('0x44')]=qs['sort'](_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x45')]);_0xcb8da5[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_[_0x13cc('0x47')](_0x4ef61b['query'],_0x396c82[_0x13cc('0x3c')]),_0x53ab9e);if(_0x4ef61b['query']['filter']){_0xcb8da5[_0x13cc('0x46')]=_['merge'](_0xcb8da5['where'],{'$or':_[_0x13cc('0x36')](_0x53ab9e,function(_0x2a2f33){if(_0x2a2f33[_0x13cc('0x38')]!==_0x13cc('0x48')){var _0x2fb47b={};_0x2fb47b[_0x2a2f33[_0x13cc('0x33')]]={'$like':'%'+_0x4ef61b[_0x13cc('0x3e')]['filter']+'%'};return _0x2fb47b;}})});}_0xcb8da5=_[_0x13cc('0x49')]({},_0xcb8da5,_0x4ef61b[_0x13cc('0x4a')]);var _0x3fd341={'where':_0xcb8da5[_0x13cc('0x46')]};return db[_0x13cc('0x4b')][_0x13cc('0x29')](_0x3fd341)['then'](function(_0x2dd48c){_0x13fc17[_0x13cc('0x29')]=_0x2dd48c;if(_0x4ef61b[_0x13cc('0x3e')][_0x13cc('0x4c')]){_0xcb8da5[_0x13cc('0x4d')]=[{'all':!![]}];}return db[_0x13cc('0x4b')]['findAll'](_0xcb8da5);})[_0x13cc('0x1a')](function(_0x48ccdc){_0x13fc17[_0x13cc('0x4e')]=_0x48ccdc;return _0x13fc17;})[_0x13cc('0x1a')](respondWithFilteredResult(_0xef77be,_0xcb8da5))[_0x13cc('0x4f')](handleError(_0xef77be,null));};exports[_0x13cc('0x50')]=function(_0x27dab4,_0x51caa9){var _0x53113c={'raw':![],'where':{'id':_0x27dab4[_0x13cc('0x51')]['id']}},_0x319e17={};_0x319e17[_0x13cc('0x3a')]=_[_0x13cc('0x3b')](db[_0x13cc('0x4b')][_0x13cc('0x52')]);_0x319e17[_0x13cc('0x3e')]=_[_0x13cc('0x3b')](_0x27dab4['query']);_0x319e17[_0x13cc('0x3c')]=_[_0x13cc('0x3d')](_0x319e17['model'],_0x319e17[_0x13cc('0x3e')]);_0x53113c[_0x13cc('0x3f')]=_[_0x13cc('0x3d')](_0x319e17[_0x13cc('0x3a')],qs[_0x13cc('0x40')](_0x27dab4[_0x13cc('0x3e')][_0x13cc('0x40')]));_0x53113c['attributes']=_0x53113c[_0x13cc('0x3f')][_0x13cc('0x41')]?_0x53113c[_0x13cc('0x3f')]:_0x319e17['model'];if(_0x27dab4[_0x13cc('0x3e')][_0x13cc('0x4c')]){_0x53113c[_0x13cc('0x4d')]=[{'all':!![]}];}_0x53113c=_[_0x13cc('0x49')]({},_0x53113c,_0x27dab4['options']);return db['ZohoConfiguration'][_0x13cc('0x53')](_0x53113c)['then'](handleEntityNotFound(_0x51caa9,null))[_0x13cc('0x1a')](respondWithResult(_0x51caa9,null))[_0x13cc('0x4f')](handleError(_0x51caa9,null));};exports[_0x13cc('0x54')]=function(_0x2e6cba,_0x5b5a50){return db[_0x13cc('0x4b')][_0x13cc('0x54')](_0x2e6cba[_0x13cc('0x55')],{})[_0x13cc('0x1a')](respondWithResult(_0x5b5a50,0xc9))[_0x13cc('0x4f')](handleError(_0x5b5a50,null));};exports[_0x13cc('0x30')]=function(_0x4e6c8f,_0x34d261){if(_0x4e6c8f[_0x13cc('0x55')]['id']){delete _0x4e6c8f[_0x13cc('0x55')]['id'];}return db[_0x13cc('0x4b')][_0x13cc('0x53')]({'where':{'id':_0x4e6c8f[_0x13cc('0x51')]['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x34d261,null))[_0x13cc('0x1a')](saveUpdates(_0x4e6c8f[_0x13cc('0x55')],null))['then'](respondWithResult(_0x34d261,null))['catch'](handleError(_0x34d261,null));};exports[_0x13cc('0x31')]=function(_0x369320,_0x228815){return db['ZohoConfiguration'][_0x13cc('0x53')]({'where':{'id':_0x369320[_0x13cc('0x51')]['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x228815,null))[_0x13cc('0x1a')](removeEntity(_0x228815,null))[_0x13cc('0x4f')](handleError(_0x228815,null));};exports['getFields']=function(_0x32f997,_0x36b2a8,_0x53e5d3){var _0x4968cd={};var _0x4fb87b={};var _0xd06e6;var _0x5bf3d2;return db[_0x13cc('0x4b')]['findOne']({'where':{'id':_0x32f997[_0x13cc('0x51')]['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x36b2a8,null))[_0x13cc('0x1a')](function(_0x1175f7){if(_0x1175f7){_0xd06e6=_0x1175f7;_0x4fb87b['model']=_[_0x13cc('0x3b')](db[_0x13cc('0x56')][_0x13cc('0x52')]);_0x4fb87b['query']=_[_0x13cc('0x3b')](_0x32f997['query']);_0x4fb87b[_0x13cc('0x3c')]=_['intersection'](_0x4fb87b[_0x13cc('0x3a')],_0x4fb87b[_0x13cc('0x3e')]);_0x4968cd[_0x13cc('0x3f')]=_[_0x13cc('0x3d')](_0x4fb87b['model'],qs[_0x13cc('0x40')](_0x32f997['query'][_0x13cc('0x40')]));_0x4968cd[_0x13cc('0x3f')]=_0x4968cd[_0x13cc('0x3f')]['length']?_0x4968cd[_0x13cc('0x3f')]:_0x4fb87b['model'];_0x4968cd['order']=qs[_0x13cc('0x45')](_0x32f997['query'][_0x13cc('0x45')]);_0x4968cd[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_[_0x13cc('0x47')](_0x32f997[_0x13cc('0x3e')],_0x4fb87b[_0x13cc('0x3c')]));if(_0x32f997[_0x13cc('0x3e')][_0x13cc('0x57')]){_0x4968cd[_0x13cc('0x46')]=_[_0x13cc('0x49')](_0x4968cd['where'],{'$or':_[_0x13cc('0x36')](_0x4968cd['attributes'],function(_0x38492d){var _0x33ecd7={};_0x33ecd7[_0x38492d]={'$like':'%'+_0x32f997[_0x13cc('0x3e')]['filter']+'%'};return _0x33ecd7;})});}_0x4968cd=_[_0x13cc('0x49')]({},_0x4968cd,_0x32f997[_0x13cc('0x4a')]);return _0xd06e6[_0x13cc('0x58')](_0x4968cd);}})[_0x13cc('0x1a')](function(_0x3b88fd){if(_0x3b88fd){_0x5bf3d2=_0x3b88fd[_0x13cc('0x41')];if(!_0x32f997['query'][_0x13cc('0x42')](_0x13cc('0x43'))){_0x4968cd[_0x13cc('0x2b')]=qs[_0x13cc('0x2b')](_0x32f997['query'][_0x13cc('0x2b')]);_0x4968cd[_0x13cc('0x2a')]=qs[_0x13cc('0x2a')](_0x32f997[_0x13cc('0x3e')][_0x13cc('0x2a')]);}return _0xd06e6['getFields'](_0x4968cd);}})[_0x13cc('0x1a')](function(_0x570019){if(_0x570019){return _0x570019?{'count':_0x5bf3d2,'rows':_0x570019}:null;}})[_0x13cc('0x1a')](respondWithResult(_0x36b2a8,null))['catch'](handleError(_0x36b2a8,null));};exports[_0x13cc('0x59')]=function(_0x62d40e,_0x54823f,_0x23dcc0){var _0x7706b0={};var _0x3db981={};var _0x554570;var _0x4cab47;return db['ZohoConfiguration'][_0x13cc('0x5a')]({'where':{'id':_0x62d40e['params']['id']}})[_0x13cc('0x1a')](handleEntityNotFound(_0x54823f,null))[_0x13cc('0x1a')](function(_0x5bff6b){if(_0x5bff6b){_0x554570=_0x5bff6b;_0x3db981[_0x13cc('0x3a')]=_[_0x13cc('0x3b')](db[_0x13cc('0x56')][_0x13cc('0x52')]);_0x3db981[_0x13cc('0x3e')]=_[_0x13cc('0x3b')](_0x62d40e[_0x13cc('0x3e')]);_0x3db981[_0x13cc('0x3c')]=_[_0x13cc('0x3d')](_0x3db981[_0x13cc('0x3a')],_0x3db981['query']);_0x7706b0['attributes']=_['intersection'](_0x3db981['model'],qs[_0x13cc('0x40')](_0x62d40e[_0x13cc('0x3e')]['fields']));_0x7706b0[_0x13cc('0x3f')]=_0x7706b0[_0x13cc('0x3f')]['length']?_0x7706b0['attributes']:_0x3db981[_0x13cc('0x3a')];_0x7706b0['order']=qs['sort'](_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x45')]);_0x7706b0[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_[_0x13cc('0x47')](_0x62d40e[_0x13cc('0x3e')],_0x3db981[_0x13cc('0x3c')]));if(_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x57')]){_0x7706b0[_0x13cc('0x46')]=_[_0x13cc('0x49')](_0x7706b0[_0x13cc('0x46')],{'$or':_[_0x13cc('0x36')](_0x7706b0[_0x13cc('0x3f')],function(_0x4693a4){var _0x5b99a4={};_0x5b99a4[_0x4693a4]={'$like':'%'+_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x57')]+'%'};return _0x5b99a4;})});}_0x7706b0=_[_0x13cc('0x49')]({},_0x7706b0,_0x62d40e[_0x13cc('0x4a')]);return _0x554570[_0x13cc('0x59')](_0x7706b0);}})[_0x13cc('0x1a')](function(_0x372143){if(_0x372143){_0x4cab47=_0x372143['length'];if(!_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x42')](_0x13cc('0x43'))){_0x7706b0[_0x13cc('0x2b')]=qs[_0x13cc('0x2b')](_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x2b')]);_0x7706b0[_0x13cc('0x2a')]=qs[_0x13cc('0x2a')](_0x62d40e[_0x13cc('0x3e')][_0x13cc('0x2a')]);}return _0x554570[_0x13cc('0x59')](_0x7706b0);}})[_0x13cc('0x1a')](function(_0x3027e8){if(_0x3027e8){return _0x3027e8?{'count':_0x4cab47,'rows':_0x3027e8}:null;}})['then'](respondWithResult(_0x54823f,null))['catch'](handleError(_0x54823f,null));};exports[_0x13cc('0x5b')]=function(_0x106aba,_0x40d639,_0x236091){var _0x2a692a={};var _0x4f14f8={};var _0x2c213d;var _0x3ec091;return db[_0x13cc('0x4b')][_0x13cc('0x5a')]({'where':{'id':_0x106aba[_0x13cc('0x51')]['id']}})['then'](handleEntityNotFound(_0x40d639,null))['then'](function(_0x130b37){if(_0x130b37){_0x2c213d=_0x130b37;_0x4f14f8[_0x13cc('0x3a')]=_[_0x13cc('0x3b')](db[_0x13cc('0x56')][_0x13cc('0x52')]);_0x4f14f8[_0x13cc('0x3e')]=_[_0x13cc('0x3b')](_0x106aba['query']);_0x4f14f8[_0x13cc('0x3c')]=_['intersection'](_0x4f14f8[_0x13cc('0x3a')],_0x4f14f8[_0x13cc('0x3e')]);_0x2a692a['attributes']=_[_0x13cc('0x3d')](_0x4f14f8[_0x13cc('0x3a')],qs['fields'](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x40')]));_0x2a692a['attributes']=_0x2a692a[_0x13cc('0x3f')][_0x13cc('0x41')]?_0x2a692a['attributes']:_0x4f14f8['model'];_0x2a692a['order']=qs[_0x13cc('0x45')](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x45')]);_0x2a692a[_0x13cc('0x46')]=qs[_0x13cc('0x3c')](_['pick'](_0x106aba['query'],_0x4f14f8['filters']));if(_0x106aba[_0x13cc('0x3e')][_0x13cc('0x57')]){_0x2a692a[_0x13cc('0x46')]=_[_0x13cc('0x49')](_0x2a692a[_0x13cc('0x46')],{'$or':_['map'](_0x2a692a[_0x13cc('0x3f')],function(_0x20be72){var _0x3c5146={};_0x3c5146[_0x20be72]={'$like':'%'+_0x106aba[_0x13cc('0x3e')]['filter']+'%'};return _0x3c5146;})});}_0x2a692a=_[_0x13cc('0x49')]({},_0x2a692a,_0x106aba[_0x13cc('0x4a')]);return _0x2c213d[_0x13cc('0x5b')](_0x2a692a);}})[_0x13cc('0x1a')](function(_0x39152a){if(_0x39152a){_0x3ec091=_0x39152a[_0x13cc('0x41')];if(!_0x106aba[_0x13cc('0x3e')]['hasOwnProperty'](_0x13cc('0x43'))){_0x2a692a[_0x13cc('0x2b')]=qs[_0x13cc('0x2b')](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x2b')]);_0x2a692a['offset']=qs[_0x13cc('0x2a')](_0x106aba[_0x13cc('0x3e')][_0x13cc('0x2a')]);}return _0x2c213d[_0x13cc('0x5b')](_0x2a692a);}})[_0x13cc('0x1a')](function(_0x35f691){if(_0x35f691){return _0x35f691?{'count':_0x3ec091,'rows':_0x35f691}:null;}})['then'](respondWithResult(_0x40d639,null))['catch'](handleError(_0x40d639,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7c5dc5a..7fa4671 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 _0xb28f=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x54dc38,_0x493609){var _0xa45247=function(_0x493231){while(--_0x493231){_0x54dc38['push'](_0x54dc38['shift']());}};_0xa45247(++_0x493609);}(_0xb28f,0x10d));var _0xfb28=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xb28f[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0xfb28('0x0'));var util=require(_0xfb28('0x1'));var logger=require(_0xfb28('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb28('0x3'));var fs=require('fs');var path=require(_0xfb28('0x4'));var rimraf=require(_0xfb28('0x5'));var config=require(_0xfb28('0x6'));var attributes=require(_0xfb28('0x7'));module['exports']=function(_0x393f90,_0x2bb3ff){return _0x393f90[_0xfb28('0x8')](_0xfb28('0x9'),attributes,{'tableName':_0xfb28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7f0=['int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x6adb95,_0x1acdff){var _0x226b03=function(_0x57635b){while(--_0x57635b){_0x6adb95['push'](_0x6adb95['shift']());}};_0x226b03(++_0x1acdff);}(_0xd7f0,0x83));var _0x0d7f=function(_0x3f05d0,_0x302aa9){_0x3f05d0=_0x3f05d0-0x0;var _0x32cc15=_0xd7f0[_0x3f05d0];return _0x32cc15;};'use strict';var _=require(_0x0d7f('0x0'));var util=require(_0x0d7f('0x1'));var logger=require(_0x0d7f('0x2'))('api');var moment=require(_0x0d7f('0x3'));var BPromise=require(_0x0d7f('0x4'));var rp=require(_0x0d7f('0x5'));var fs=require('fs');var path=require(_0x0d7f('0x6'));var rimraf=require(_0x0d7f('0x7'));var config=require(_0x0d7f('0x8'));var attributes=require(_0x0d7f('0x9'));module['exports']=function(_0x5c78b0,_0x50bccd){return _0x5c78b0[_0x0d7f('0xa')](_0x0d7f('0xb'),attributes,{'tableName':_0x0d7f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index c887c66..5b95880 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 _0xf424=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x11d0bc,_0x17d093){var _0x2bf7d4=function(_0x2efaef){while(--_0x2efaef){_0x11d0bc['push'](_0x11d0bc['shift']());}};_0x2bf7d4(++_0x17d093);}(_0xf424,0x92));var _0x4f42=function(_0x488163,_0x51204f){_0x488163=_0x488163-0x0;var _0x1ba13b=_0xf424[_0x488163];return _0x1ba13b;};'use strict';var _=require(_0x4f42('0x0'));var util=require(_0x4f42('0x1'));var moment=require(_0x4f42('0x2'));var BPromise=require(_0x4f42('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f42('0x5'));var logger=require(_0x4f42('0x6'))('rpc');var config=require(_0x4f42('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f42('0x8')][_0x4f42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x342138,_0x281107,_0xaa5089){return new BPromise(function(_0x3c5400,_0x54b1a7){return client[_0x4f42('0xa')](_0x342138,_0xaa5089)[_0x4f42('0xb')](function(_0x5421c6){logger[_0x4f42('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x281107,_0x4f42('0xd'));logger[_0x4f42('0xe')](_0x4f42('0xf'),_0x281107,_0x4f42('0xd'),JSON[_0x4f42('0x10')](_0x5421c6));if(_0x5421c6[_0x4f42('0x11')]){if(_0x5421c6[_0x4f42('0x11')][_0x4f42('0x12')]===0x1f4){logger[_0x4f42('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x281107,_0x5421c6[_0x4f42('0x11')][_0x4f42('0x13')]);return _0x54b1a7(_0x5421c6[_0x4f42('0x11')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x281107,_0x5421c6[_0x4f42('0x11')][_0x4f42('0x13')]);return _0x3c5400(_0x5421c6[_0x4f42('0x11')][_0x4f42('0x13')]);}else{logger['info'](_0x4f42('0x14'),_0x281107,_0x4f42('0xd'));_0x3c5400(_0x5421c6[_0x4f42('0x15')][_0x4f42('0x13')]);}})[_0x4f42('0x16')](function(_0x1d6486){logger[_0x4f42('0x11')](_0x4f42('0x14'),_0x281107,_0x1d6486);_0x54b1a7(_0x1d6486);});});} \ No newline at end of file +var _0x3015=['rpc','../../config/environment','jayson/promise','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3015,0x10b));var _0x5301=function(_0x2c7630,_0x205a13){_0x2c7630=_0x2c7630-0x0;var _0x4115f7=_0x3015[_0x2c7630];return _0x4115f7;};'use strict';var _=require('lodash');var util=require(_0x5301('0x0'));var moment=require('moment');var BPromise=require(_0x5301('0x1'));var rs=require(_0x5301('0x2'));var fs=require('fs');var Redis=require(_0x5301('0x3'));var db=require(_0x5301('0x4'))['db'];var utils=require(_0x5301('0x5'));var logger=require('../../config/logger')(_0x5301('0x6'));var config=require(_0x5301('0x7'));var jayson=require(_0x5301('0x8'));var client=jayson['client'][_0x5301('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cab95,_0x3ea707,_0x446962){return new BPromise(function(_0x5a9220,_0x4a552c){return client[_0x5301('0xa')](_0x3cab95,_0x446962)[_0x5301('0xb')](function(_0x3fd276){logger['info'](_0x5301('0xc'),_0x3ea707,_0x5301('0xd'));logger[_0x5301('0xe')](_0x5301('0xf'),_0x3ea707,'request\x20sent',JSON[_0x5301('0x10')](_0x3fd276));if(_0x3fd276[_0x5301('0x11')]){if(_0x3fd276[_0x5301('0x11')]['code']===0x1f4){logger['error'](_0x5301('0xc'),_0x3ea707,_0x3fd276[_0x5301('0x11')]['message']);return _0x4a552c(_0x3fd276[_0x5301('0x11')][_0x5301('0x12')]);}logger['error'](_0x5301('0xc'),_0x3ea707,_0x3fd276['error']['message']);return _0x5a9220(_0x3fd276['error']['message']);}else{logger[_0x5301('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ea707,_0x5301('0xd'));_0x5a9220(_0x3fd276[_0x5301('0x14')][_0x5301('0x12')]);}})['catch'](function(_0xe6763b){logger[_0x5301('0x11')](_0x5301('0xc'),_0x3ea707,_0xe6763b);_0x4a552c(_0xe6763b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d857d84..28409d6 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 _0x5b12=['index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller'];(function(_0x19f727,_0x28224e){var _0x412836=function(_0x40634f){while(--_0x40634f){_0x19f727['push'](_0x19f727['shift']());}};_0x412836(++_0x28224e);}(_0x5b12,0xa3));var _0x25b1=function(_0x194351,_0x8a1121){_0x194351=_0x194351-0x0;var _0x377821=_0x5b12[_0x194351];return _0x377821;};'use strict';var multer=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var path=require(_0x25b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x25b1('0x3'));var router=express['Router']();var auth=require(_0x25b1('0x4'));var interaction=require(_0x25b1('0x5'));var config=require('../../config/environment');var controller=require(_0x25b1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x25b1('0x7')]);router['get']('/:id',auth[_0x25b1('0x8')](),controller[_0x25b1('0x9')]);router[_0x25b1('0xa')]('/',auth[_0x25b1('0x8')](),controller[_0x25b1('0xb')]);router[_0x25b1('0xc')](_0x25b1('0xd'),auth[_0x25b1('0x8')](),controller['update']);router[_0x25b1('0xe')](_0x25b1('0xd'),auth[_0x25b1('0x8')](),controller[_0x25b1('0xf')]);module[_0x25b1('0x10')]=router; \ No newline at end of file +var _0xf4f4=['./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x494d18,_0x56b775){var _0x451015=function(_0x849fda){while(--_0x849fda){_0x494d18['push'](_0x494d18['shift']());}};_0x451015(++_0x56b775);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x32cd25,_0x5abf21){_0x32cd25=_0x32cd25-0x0;var _0x423f41=_0xf4f4[_0x32cd25];return _0x423f41;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth[_0x4f4f('0x8')](),controller['create']);router[_0x4f4f('0xe')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x10')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 13ebb36..abf28bc 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 _0xcabc=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x37f330,_0x30ef70){var _0x4fab68=function(_0x43b392){while(--_0x43b392){_0x37f330['push'](_0x37f330['shift']());}};_0x4fab68(++_0x30ef70);}(_0xcabc,0x16a));var _0xccab=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcabc[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'type':{'type':Sequelize[_0xccab('0x1')](_0xccab('0x2'),_0xccab('0x3'),_0xccab('0x4'),'keyValue'),'defaultValue':_0xccab('0x2')},'content':{'type':Sequelize[_0xccab('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xccab('0x1')](_0xccab('0x2'),_0xccab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xccab('0x5')]},'idField':{'type':Sequelize[_0xccab('0x5')]},'nameField':{'type':Sequelize[_0xccab('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xccab('0x5')]}}; \ No newline at end of file +var _0x32ef=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x35aa5c,_0x546369){var _0xde096b=function(_0x5d958e){while(--_0x5d958e){_0x35aa5c['push'](_0x35aa5c['shift']());}};_0xde096b(++_0x546369);}(_0x32ef,0xf9));var _0xf32e=function(_0x3d2753,_0x1f52dd){_0x3d2753=_0x3d2753-0x0;var _0x34defd=_0x32ef[_0x3d2753];return _0x34defd;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'type':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3'),_0xf32e('0x4'),_0xf32e('0x5'),'keyValue'),'defaultValue':_0xf32e('0x3')},'content':{'type':Sequelize[_0xf32e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3'),_0xf32e('0x4'),_0xf32e('0x5'))},'keyContent':{'type':Sequelize[_0xf32e('0x6')]},'idField':{'type':Sequelize[_0xf32e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf32e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 524d8aa..dd27471 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(_0x329e45,_0x2a09db){var _0x25c632=function(_0x257b65){while(--_0x257b65){_0x329e45['push'](_0x329e45['shift']());}};_0x25c632(++_0x2a09db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x20fb56,_0x315362){var _0x3ca29e=function(_0x1a4f2a){while(--_0x1a4f2a){_0x20fb56['push'](_0x20fb56['shift']());}};_0x3ca29e(++_0x315362);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 667878a..b9a2c0b 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 _0x43e6=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x43e6,0x139));var _0x643e=function(_0x32a0de,_0x423fd0){_0x32a0de=_0x32a0de-0x0;var _0x1ff5cd=_0x43e6[_0x32a0de];return _0x1ff5cd;};'use strict';var _=require(_0x643e('0x0'));var util=require(_0x643e('0x1'));var logger=require(_0x643e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x643e('0x3'));var rp=require(_0x643e('0x4'));var fs=require('fs');var path=require(_0x643e('0x5'));var rimraf=require(_0x643e('0x6'));var config=require(_0x643e('0x7'));var attributes=require(_0x643e('0x8'));module[_0x643e('0x9')]=function(_0x2568d6,_0x517898){return _0x2568d6[_0x643e('0xa')](_0x643e('0xb'),attributes,{'tableName':_0x643e('0xc'),'paranoid':![],'indexes':[{'name':_0x643e('0xd'),'fields':[_0x643e('0xe'),_0x643e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaeab=['rimraf','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','lodash','util','moment','request-promise','path'];(function(_0x3dfd1c,_0x55764a){var _0x5217ed=function(_0x1ac9af){while(--_0x1ac9af){_0x3dfd1c['push'](_0x3dfd1c['shift']());}};_0x5217ed(++_0x55764a);}(_0xaeab,0x1c9));var _0xbaea=function(_0x4bec8d,_0x4e83c4){_0x4bec8d=_0x4bec8d-0x0;var _0x33d8ed=_0xaeab[_0x4bec8d];return _0x33d8ed;};'use strict';var _=require(_0xbaea('0x0'));var util=require(_0xbaea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbaea('0x2'));var BPromise=require('bluebird');var rp=require(_0xbaea('0x3'));var fs=require('fs');var path=require(_0xbaea('0x4'));var rimraf=require(_0xbaea('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xbaea('0x6')]=function(_0x59ae71,_0x286550){return _0x59ae71[_0xbaea('0x7')](_0xbaea('0x8'),attributes,{'tableName':_0xbaea('0x9'),'paranoid':![],'indexes':[{'name':_0xbaea('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index ad124b0..622345d 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 _0xf2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x643b2,_0x14e495){var _0x2e5346=function(_0x3ed065){while(--_0x3ed065){_0x643b2['push'](_0x643b2['shift']());}};_0x2e5346(++_0x14e495);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xf2ca[_0x556927];return _0x5f1235;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});} \ No newline at end of file +var _0x3eea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ba687,_0x177b13){var _0x30828c=function(_0x92d6c6){while(--_0x92d6c6){_0x3ba687['push'](_0x3ba687['shift']());}};_0x30828c(++_0x177b13);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1e6eaa,_0x585d05){_0x1e6eaa=_0x1e6eaa-0x0;var _0x5b031f=_0x3eea[_0x1e6eaa];return _0x5b031f;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){return client[_0xa3ee('0xc')](_0x538bf9,_0x4e4588)['then'](function(_0xb1b96d){logger['info'](_0xa3ee('0xd'),_0x4183ee,_0xa3ee('0xe'));logger[_0xa3ee('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4183ee,_0xa3ee('0xe'),JSON[_0xa3ee('0x10')](_0xb1b96d));if(_0xb1b96d['error']){if(_0xb1b96d['error'][_0xa3ee('0x11')]===0x1f4){logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')]['message']);return _0x56f37b(_0xb1b96d[_0xa3ee('0x12')]['message']);}logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')][_0xa3ee('0x13')]);return _0x37a3f0(_0xb1b96d['error'][_0xa3ee('0x13')]);}else{logger[_0xa3ee('0x14')]('ZohoField,\x20%s,\x20%s',_0x4183ee,'request\x20sent');_0x37a3f0(_0xb1b96d['result'][_0xa3ee('0x13')]);}})[_0xa3ee('0x15')](function(_0x354dd5){logger[_0xa3ee('0x12')]('ZohoField,\x20%s,\x20%s',_0x4183ee,_0x354dd5);_0x56f37b(_0x354dd5);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9a9761d..a0820f7 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 _0x85b1=['express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path','connect-timeout'];(function(_0xb89645,_0x55d7cf){var _0x474232=function(_0x57f483){while(--_0x57f483){_0xb89645['push'](_0xb89645['shift']());}};_0x474232(++_0x55d7cf);}(_0x85b1,0x165));var _0x185b=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x85b1[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0x185b('0x0'));var util=require('util');var path=require(_0x185b('0x1'));var timeout=require(_0x185b('0x2'));var express=require(_0x185b('0x3'));var router=express[_0x185b('0x4')]();var auth=require(_0x185b('0x5'));var interaction=require(_0x185b('0x6'));var config=require('../../config/environment');module[_0x185b('0x7')]=router; \ No newline at end of file +var _0x5995=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59249e,_0x299fa4){var _0x146108=function(_0x126bef){while(--_0x126bef){_0x59249e['push'](_0x59249e['shift']());}};_0x146108(++_0x299fa4);}(_0x5995,0xa0));var _0x5599=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5995[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x5599('0x0'));var util=require(_0x5599('0x1'));var path=require('path');var timeout=require(_0x5599('0x2'));var express=require(_0x5599('0x3'));var router=express[_0x5599('0x4')]();var auth=require(_0x5599('0x5'));var interaction=require(_0x5599('0x6'));var config=require(_0x5599('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 2229a57..c709236 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 _0xd043=['unique_name_and_version','app.js','INTEGER','BOOLEAN','exports','STRING'];(function(_0x531a19,_0x43e019){var _0x4845d2=function(_0x4c9b62){while(--_0x4c9b62){_0x531a19['push'](_0x531a19['shift']());}};_0x4845d2(++_0x43e019);}(_0xd043,0x100));var _0x3d04=function(_0x4371a8,_0x3ac39){_0x4371a8=_0x4371a8-0x0;var _0x110901=_0xd043[_0x4371a8];return _0x110901;};'use strict';var Sequelize=require('sequelize');module[_0x3d04('0x0')]={'name':{'type':Sequelize[_0x3d04('0x1')],'allowNull':![],'unique':_0x3d04('0x2')},'version':{'type':Sequelize[_0x3d04('0x1')],'allowNull':![],'unique':_0x3d04('0x2')},'main':{'type':Sequelize[_0x3d04('0x1')],'defaultValue':_0x3d04('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x3d04('0x1')]},'type':{'type':Sequelize[_0x3d04('0x1')]},'size':{'type':Sequelize[_0x3d04('0x4')]},'active':{'type':Sequelize[_0x3d04('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3d04('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x3d04('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x3d04('0x1')]},'title':{'type':Sequelize[_0x3d04('0x1')]},'remoteUri':{'type':Sequelize[_0x3d04('0x1')]},'link':{'type':Sequelize[_0x3d04('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x222c=['exports','unique_name_and_version','app.js','STRING','BOOLEAN','state','sequelize'];(function(_0x1b9210,_0x5bd4fa){var _0x27fa48=function(_0x227db8){while(--_0x227db8){_0x1b9210['push'](_0x1b9210['shift']());}};_0x27fa48(++_0x5bd4fa);}(_0x222c,0xae));var _0xc222=function(_0x332c0c,_0x4250ae){_0x332c0c=_0x332c0c-0x0;var _0x301a6d=_0x222c[_0x332c0c];return _0x301a6d;};'use strict';var Sequelize=require(_0xc222('0x0'));module[_0xc222('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc222('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xc222('0x3')},'filename':{'type':Sequelize[_0xc222('0x4')]},'path':{'type':Sequelize[_0xc222('0x4')]},'type':{'type':Sequelize[_0xc222('0x4')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xc222('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xc222('0x4')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc222('0x4')],'unique':_0xc222('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xc222('0x4')]},'remoteUri':{'type':Sequelize[_0xc222('0x4')]},'link':{'type':Sequelize[_0xc222('0x4')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 84ed9ae..6694158 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 _0xf228=['../../config/utils','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x1fd0d6,_0x1be60f){var _0x28afa7=function(_0x5eb61f){while(--_0x5eb61f){_0x1fd0d6['push'](_0x1fd0d6['shift']());}};_0x28afa7(++_0x1be60f);}(_0xf228,0x1a4));var _0x8f22=function(_0x61d8d9,_0x110a01){_0x61d8d9=_0x61d8d9-0x0;var _0x53296a=_0xf228[_0x61d8d9];return _0x53296a;};'use strict';var pdf=require(_0x8f22('0x0'));var emlformat=require(_0x8f22('0x1'));var rimraf=require(_0x8f22('0x2'));var zipdir=require(_0x8f22('0x3'));var jsonpatch=require(_0x8f22('0x4'));var rp=require('request-promise');var moment=require(_0x8f22('0x5'));var BPromise=require(_0x8f22('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8f22('0x7'));var ejs=require(_0x8f22('0x8'));var fs=require('fs');var _=require(_0x8f22('0x9'));var squel=require(_0x8f22('0xa'));var crypto=require('crypto');var jsforce=require(_0x8f22('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8f22('0x7'));var querystring=require(_0x8f22('0xc'));var Papa=require(_0x8f22('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8f22('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f22('0xf'));var logger=require(_0x8f22('0x10'))(_0x8f22('0x11'));var utils=require(_0x8f22('0x12'));var config=require('../../config/environment');var db=require(_0x8f22('0x13'))['db'];function respondWithStatusCode(_0x4b9fea,_0x16a8a1){_0x16a8a1=_0x16a8a1||0xcc;return function(_0x98c2e4){if(_0x98c2e4){return _0x4b9fea['sendStatus'](_0x16a8a1);}return _0x4b9fea[_0x8f22('0x14')](_0x16a8a1)[_0x8f22('0x15')]();};}function respondWithResult(_0x42ab63,_0x2e37b9){_0x2e37b9=_0x2e37b9||0xc8;return function(_0x2d4bbc){if(_0x2d4bbc){return _0x42ab63[_0x8f22('0x14')](_0x2e37b9)['json'](_0x2d4bbc);}};}function respondWithFilteredResult(_0x21a7cf,_0x1736a4){return function(_0x454287){if(_0x454287){var _0xccf805=_0x454287[_0x8f22('0x16')],_0x3f2155=_0x1736a4[_0x8f22('0x17')],_0x30b13c=_0x1736a4[_0x8f22('0x17')]+_0x1736a4['limit'],_0x20c73b;if(_0x30b13c>=_0xccf805){_0x30b13c=_0xccf805;_0x20c73b=0xc8;}else{_0x20c73b=0xce;}_0x21a7cf[_0x8f22('0x14')](_0x20c73b);return _0x21a7cf[_0x8f22('0x18')](_0x8f22('0x19'),_0x3f2155+'-'+_0x30b13c+'/'+_0xccf805)[_0x8f22('0x1a')](_0x454287);}return null;};}function patchUpdates(_0x2984ca){return function(_0x3a5ea1){try{jsonpatch[_0x8f22('0x1b')](_0x3a5ea1,_0x2984ca,!![]);}catch(_0x33a2c9){return BPromise[_0x8f22('0x1c')](_0x33a2c9);}return _0x3a5ea1[_0x8f22('0x1d')]();};}function saveUpdates(_0xd457db,_0x51a8a4){return function(_0x23e22d){if(_0x23e22d){return _0x23e22d[_0x8f22('0x1e')](_0xd457db)[_0x8f22('0x1f')](function(_0x445cbd){return _0x445cbd;});}return null;};}function removeEntity(_0x45d776,_0x38f632){return function(_0x562f27){if(_0x562f27){return _0x562f27[_0x8f22('0x20')]()[_0x8f22('0x1f')](function(){_0x45d776['status'](0xcc)[_0x8f22('0x15')]();});}};}function handleEntityNotFound(_0x4d7fb6,_0x10d9bb){return function(_0x452d4d){if(!_0x452d4d){_0x4d7fb6[_0x8f22('0x21')](0x194);}return _0x452d4d;};}function handleError(_0x4506b6,_0x3c430e){_0x3c430e=_0x3c430e||0x1f4;return function(_0x23a92c){logger[_0x8f22('0x22')](_0x23a92c[_0x8f22('0x23')]);if(_0x23a92c[_0x8f22('0x24')]){delete _0x23a92c[_0x8f22('0x24')];}_0x4506b6['status'](_0x3c430e)[_0x8f22('0x25')](_0x23a92c);};}exports[_0x8f22('0x26')]=function(_0x49614c,_0x10ece1){var _0x11fe0e={},_0x4c02={},_0x300951={'count':0x0,'rows':[]};var _0x10b772=_[_0x8f22('0x27')](db[_0x8f22('0x28')][_0x8f22('0x29')],function(_0x1c42c4){return{'name':_0x1c42c4[_0x8f22('0x2a')],'type':_0x1c42c4['type'][_0x8f22('0x2b')]};});_0x4c02['model']=_['map'](_0x10b772,'name');_0x4c02['query']=_[_0x8f22('0x2c')](_0x49614c[_0x8f22('0x2d')]);_0x4c02['filters']=_[_0x8f22('0x2e')](_0x4c02[_0x8f22('0x2f')],_0x4c02['query']);_0x11fe0e[_0x8f22('0x30')]=_[_0x8f22('0x2e')](_0x4c02[_0x8f22('0x2f')],qs[_0x8f22('0x31')](_0x49614c[_0x8f22('0x2d')][_0x8f22('0x31')]));_0x11fe0e[_0x8f22('0x30')]=_0x11fe0e['attributes']['length']?_0x11fe0e['attributes']:_0x4c02['model'];if(!_0x49614c['query'][_0x8f22('0x32')](_0x8f22('0x33'))){_0x11fe0e['limit']=qs['limit'](_0x49614c[_0x8f22('0x2d')][_0x8f22('0x34')]);_0x11fe0e[_0x8f22('0x17')]=qs[_0x8f22('0x17')](_0x49614c[_0x8f22('0x2d')]['offset']);}_0x11fe0e[_0x8f22('0x35')]=qs[_0x8f22('0x36')](_0x49614c[_0x8f22('0x2d')]['sort']);_0x11fe0e[_0x8f22('0x37')]=qs[_0x8f22('0x38')](_[_0x8f22('0x39')](_0x49614c[_0x8f22('0x2d')],_0x4c02[_0x8f22('0x38')]),_0x10b772);if(_0x49614c[_0x8f22('0x2d')][_0x8f22('0x3a')]){_0x11fe0e['where']=_[_0x8f22('0x3b')](_0x11fe0e[_0x8f22('0x37')],{'$or':_[_0x8f22('0x27')](_0x10b772,function(_0x56f123){if(_0x56f123[_0x8f22('0x3c')]!==_0x8f22('0x3d')){var _0x1029dd={};_0x1029dd[_0x56f123[_0x8f22('0x24')]]={'$like':'%'+_0x49614c[_0x8f22('0x2d')]['filter']+'%'};return _0x1029dd;}})});}_0x11fe0e=_[_0x8f22('0x3b')]({},_0x11fe0e,_0x49614c[_0x8f22('0x3e')]);var _0x47a515={'where':_0x11fe0e['where']};return db['Integration'][_0x8f22('0x16')](_0x47a515)[_0x8f22('0x1f')](function(_0x1fc1a1){_0x300951[_0x8f22('0x16')]=_0x1fc1a1;if(_0x49614c[_0x8f22('0x2d')][_0x8f22('0x3f')]){_0x11fe0e[_0x8f22('0x40')]=[{'all':!![]}];}return db[_0x8f22('0x28')]['findAll'](_0x11fe0e);})['then'](function(_0x3db3d6){_0x300951[_0x8f22('0x41')]=_0x3db3d6;return _0x300951;})[_0x8f22('0x1f')](respondWithFilteredResult(_0x10ece1,_0x11fe0e))[_0x8f22('0x42')](handleError(_0x10ece1,null));};exports[_0x8f22('0x43')]=function(_0x44dc8b,_0x51c682){var _0x25d17e={'raw':![],'where':{'id':_0x44dc8b[_0x8f22('0x44')]['id']}},_0x3745d0={};_0x3745d0[_0x8f22('0x2f')]=_['keys'](db['Integration'][_0x8f22('0x29')]);_0x3745d0['query']=_[_0x8f22('0x2c')](_0x44dc8b[_0x8f22('0x2d')]);_0x3745d0[_0x8f22('0x38')]=_['intersection'](_0x3745d0[_0x8f22('0x2f')],_0x3745d0[_0x8f22('0x2d')]);_0x25d17e['attributes']=_[_0x8f22('0x2e')](_0x3745d0[_0x8f22('0x2f')],qs['fields'](_0x44dc8b[_0x8f22('0x2d')][_0x8f22('0x31')]));_0x25d17e['attributes']=_0x25d17e['attributes'][_0x8f22('0x45')]?_0x25d17e[_0x8f22('0x30')]:_0x3745d0[_0x8f22('0x2f')];if(_0x44dc8b[_0x8f22('0x2d')][_0x8f22('0x3f')]){_0x25d17e[_0x8f22('0x40')]=[{'all':!![]}];}_0x25d17e=_['merge']({},_0x25d17e,_0x44dc8b[_0x8f22('0x3e')]);return db['Integration'][_0x8f22('0x46')](_0x25d17e)[_0x8f22('0x1f')](handleEntityNotFound(_0x51c682,null))['then'](respondWithResult(_0x51c682,null))['catch'](handleError(_0x51c682,null));};exports[_0x8f22('0x47')]=function(_0x2f993d,_0x25438e){return db[_0x8f22('0x28')][_0x8f22('0x47')](_0x2f993d[_0x8f22('0x48')],{})[_0x8f22('0x1f')](respondWithResult(_0x25438e,0xc9))[_0x8f22('0x42')](handleError(_0x25438e,null));};exports[_0x8f22('0x1e')]=function(_0xdf2bb,_0x1b3e45){if(_0xdf2bb[_0x8f22('0x48')]['id']){delete _0xdf2bb[_0x8f22('0x48')]['id'];}return db[_0x8f22('0x28')][_0x8f22('0x46')]({'where':{'id':_0xdf2bb[_0x8f22('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b3e45,null))[_0x8f22('0x1f')](saveUpdates(_0xdf2bb['body'],null))[_0x8f22('0x1f')](respondWithResult(_0x1b3e45,null))['catch'](handleError(_0x1b3e45,null));};exports[_0x8f22('0x20')]=function(_0x4cca5c,_0x29cec2){return db[_0x8f22('0x28')][_0x8f22('0x46')]({'where':{'id':_0x4cca5c[_0x8f22('0x44')]['id']}})['then'](handleEntityNotFound(_0x29cec2,null))['then'](removeEntity(_0x29cec2,null))[_0x8f22('0x42')](handleError(_0x29cec2,null));}; \ No newline at end of file +var _0x2813=['rows','catch','show','params','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','stack','name','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','includeAll','include'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x2813,0x8f));var _0x3281=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2813[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3281('0x0'));var emlformat=require(_0x3281('0x1'));var rimraf=require(_0x3281('0x2'));var zipdir=require(_0x3281('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3281('0x4'));var moment=require('moment');var BPromise=require(_0x3281('0x5'));var Mustache=require('mustache');var util=require(_0x3281('0x6'));var path=require(_0x3281('0x7'));var sox=require(_0x3281('0x8'));var csv=require('to-csv');var ejs=require(_0x3281('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3281('0xa'));var crypto=require(_0x3281('0xb'));var jsforce=require(_0x3281('0xc'));var deskjs=require(_0x3281('0xd'));var toCsv=require(_0x3281('0xe'));var querystring=require(_0x3281('0xf'));var Papa=require(_0x3281('0x10'));var Redis=require('ioredis');var authService=require(_0x3281('0x11'));var qs=require(_0x3281('0x12'));var as=require(_0x3281('0x13'));var hardwareService=require(_0x3281('0x14'));var logger=require('../../config/logger')(_0x3281('0x15'));var utils=require(_0x3281('0x16'));var config=require('../../config/environment');var db=require(_0x3281('0x17'))['db'];function respondWithStatusCode(_0x2bb80c,_0x443b5f){_0x443b5f=_0x443b5f||0xcc;return function(_0x25f976){if(_0x25f976){return _0x2bb80c[_0x3281('0x18')](_0x443b5f);}return _0x2bb80c[_0x3281('0x19')](_0x443b5f)[_0x3281('0x1a')]();};}function respondWithResult(_0x52cdcb,_0x2e680f){_0x2e680f=_0x2e680f||0xc8;return function(_0x4b7a76){if(_0x4b7a76){return _0x52cdcb['status'](_0x2e680f)[_0x3281('0x1b')](_0x4b7a76);}};}function respondWithFilteredResult(_0x258688,_0x5a83dd){return function(_0xa237f5){if(_0xa237f5){var _0x2622f8=_0xa237f5[_0x3281('0x1c')],_0x3b4156=_0x5a83dd[_0x3281('0x1d')],_0x143ff6=_0x5a83dd[_0x3281('0x1d')]+_0x5a83dd['limit'],_0x215099;if(_0x143ff6>=_0x2622f8){_0x143ff6=_0x2622f8;_0x215099=0xc8;}else{_0x215099=0xce;}_0x258688[_0x3281('0x19')](_0x215099);return _0x258688['set'](_0x3281('0x1e'),_0x3b4156+'-'+_0x143ff6+'/'+_0x2622f8)['json'](_0xa237f5);}return null;};}function patchUpdates(_0x252ce1){return function(_0x3ee84c){try{jsonpatch[_0x3281('0x1f')](_0x3ee84c,_0x252ce1,!![]);}catch(_0x3f8f1d){return BPromise['reject'](_0x3f8f1d);}return _0x3ee84c['save']();};}function saveUpdates(_0x45ee74,_0x10d967){return function(_0x2f7670){if(_0x2f7670){return _0x2f7670[_0x3281('0x20')](_0x45ee74)[_0x3281('0x21')](function(_0x5f03d4){return _0x5f03d4;});}return null;};}function removeEntity(_0xcb9c7b,_0x287e27){return function(_0x853b71){if(_0x853b71){return _0x853b71[_0x3281('0x22')]()[_0x3281('0x21')](function(){_0xcb9c7b['status'](0xcc)[_0x3281('0x1a')]();});}};}function handleEntityNotFound(_0x52e8bf,_0x376e62){return function(_0x4a47a5){if(!_0x4a47a5){_0x52e8bf['sendStatus'](0x194);}return _0x4a47a5;};}function handleError(_0x495ca3,_0x1d345e){_0x1d345e=_0x1d345e||0x1f4;return function(_0x53d219){logger['error'](_0x53d219[_0x3281('0x23')]);if(_0x53d219[_0x3281('0x24')]){delete _0x53d219[_0x3281('0x24')];}_0x495ca3[_0x3281('0x19')](_0x1d345e)['send'](_0x53d219);};}exports['index']=function(_0x373b4f,_0x4e098b){var _0x36ee68={},_0x4874d0={},_0x457919={'count':0x0,'rows':[]};var _0x14083b=_[_0x3281('0x25')](db[_0x3281('0x26')][_0x3281('0x27')],function(_0x484367){return{'name':_0x484367[_0x3281('0x28')],'type':_0x484367[_0x3281('0x29')]['key']};});_0x4874d0['model']=_[_0x3281('0x25')](_0x14083b,_0x3281('0x24'));_0x4874d0[_0x3281('0x2a')]=_[_0x3281('0x2b')](_0x373b4f['query']);_0x4874d0[_0x3281('0x2c')]=_[_0x3281('0x2d')](_0x4874d0[_0x3281('0x2e')],_0x4874d0['query']);_0x36ee68[_0x3281('0x2f')]=_[_0x3281('0x2d')](_0x4874d0[_0x3281('0x2e')],qs['fields'](_0x373b4f[_0x3281('0x2a')][_0x3281('0x30')]));_0x36ee68['attributes']=_0x36ee68[_0x3281('0x2f')]['length']?_0x36ee68[_0x3281('0x2f')]:_0x4874d0[_0x3281('0x2e')];if(!_0x373b4f['query']['hasOwnProperty'](_0x3281('0x31'))){_0x36ee68[_0x3281('0x32')]=qs[_0x3281('0x32')](_0x373b4f[_0x3281('0x2a')][_0x3281('0x32')]);_0x36ee68['offset']=qs[_0x3281('0x1d')](_0x373b4f[_0x3281('0x2a')][_0x3281('0x1d')]);}_0x36ee68['order']=qs[_0x3281('0x33')](_0x373b4f[_0x3281('0x2a')][_0x3281('0x33')]);_0x36ee68[_0x3281('0x34')]=qs[_0x3281('0x2c')](_[_0x3281('0x35')](_0x373b4f[_0x3281('0x2a')],_0x4874d0[_0x3281('0x2c')]),_0x14083b);if(_0x373b4f[_0x3281('0x2a')][_0x3281('0x36')]){_0x36ee68[_0x3281('0x34')]=_[_0x3281('0x37')](_0x36ee68['where'],{'$or':_[_0x3281('0x25')](_0x14083b,function(_0x8f539){if(_0x8f539[_0x3281('0x29')]!=='VIRTUAL'){var _0xf9347c={};_0xf9347c[_0x8f539[_0x3281('0x24')]]={'$like':'%'+_0x373b4f[_0x3281('0x2a')][_0x3281('0x36')]+'%'};return _0xf9347c;}})});}_0x36ee68=_[_0x3281('0x37')]({},_0x36ee68,_0x373b4f['options']);var _0x28a6fc={'where':_0x36ee68['where']};return db['Integration'][_0x3281('0x1c')](_0x28a6fc)['then'](function(_0x59a2b0){_0x457919['count']=_0x59a2b0;if(_0x373b4f[_0x3281('0x2a')][_0x3281('0x38')]){_0x36ee68[_0x3281('0x39')]=[{'all':!![]}];}return db[_0x3281('0x26')]['findAll'](_0x36ee68);})['then'](function(_0x5bf213){_0x457919[_0x3281('0x3a')]=_0x5bf213;return _0x457919;})['then'](respondWithFilteredResult(_0x4e098b,_0x36ee68))[_0x3281('0x3b')](handleError(_0x4e098b,null));};exports[_0x3281('0x3c')]=function(_0x32b6eb,_0x23640d){var _0x5d7d15={'raw':![],'where':{'id':_0x32b6eb[_0x3281('0x3d')]['id']}},_0x205cab={};_0x205cab[_0x3281('0x2e')]=_[_0x3281('0x2b')](db['Integration'][_0x3281('0x27')]);_0x205cab[_0x3281('0x2a')]=_[_0x3281('0x2b')](_0x32b6eb['query']);_0x205cab[_0x3281('0x2c')]=_[_0x3281('0x2d')](_0x205cab[_0x3281('0x2e')],_0x205cab[_0x3281('0x2a')]);_0x5d7d15[_0x3281('0x2f')]=_[_0x3281('0x2d')](_0x205cab[_0x3281('0x2e')],qs[_0x3281('0x30')](_0x32b6eb[_0x3281('0x2a')]['fields']));_0x5d7d15['attributes']=_0x5d7d15[_0x3281('0x2f')][_0x3281('0x3e')]?_0x5d7d15[_0x3281('0x2f')]:_0x205cab[_0x3281('0x2e')];if(_0x32b6eb[_0x3281('0x2a')][_0x3281('0x38')]){_0x5d7d15['include']=[{'all':!![]}];}_0x5d7d15=_[_0x3281('0x37')]({},_0x5d7d15,_0x32b6eb[_0x3281('0x3f')]);return db[_0x3281('0x26')][_0x3281('0x40')](_0x5d7d15)[_0x3281('0x21')](handleEntityNotFound(_0x23640d,null))[_0x3281('0x21')](respondWithResult(_0x23640d,null))['catch'](handleError(_0x23640d,null));};exports[_0x3281('0x41')]=function(_0x519b0e,_0x3b19cb){return db[_0x3281('0x26')][_0x3281('0x41')](_0x519b0e['body'],{})[_0x3281('0x21')](respondWithResult(_0x3b19cb,0xc9))['catch'](handleError(_0x3b19cb,null));};exports[_0x3281('0x20')]=function(_0x416092,_0x2da2e6){if(_0x416092[_0x3281('0x42')]['id']){delete _0x416092[_0x3281('0x42')]['id'];}return db[_0x3281('0x26')][_0x3281('0x40')]({'where':{'id':_0x416092[_0x3281('0x3d')]['id']}})[_0x3281('0x21')](handleEntityNotFound(_0x2da2e6,null))[_0x3281('0x21')](saveUpdates(_0x416092[_0x3281('0x42')],null))[_0x3281('0x21')](respondWithResult(_0x2da2e6,null))['catch'](handleError(_0x2da2e6,null));};exports[_0x3281('0x22')]=function(_0x1fb947,_0x40096f){return db[_0x3281('0x26')][_0x3281('0x40')]({'where':{'id':_0x1fb947[_0x3281('0x3d')]['id']}})[_0x3281('0x21')](handleEntityNotFound(_0x40096f,null))[_0x3281('0x21')](removeEntity(_0x40096f,null))[_0x3281('0x3b')](handleError(_0x40096f,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 55c3acc..87edbed 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 _0xebfa=['../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4c6959,_0x56b8c1){var _0x27fd86=function(_0x250dd8){while(--_0x250dd8){_0x4c6959['push'](_0x4c6959['shift']());}};_0x27fd86(++_0x56b8c1);}(_0xebfa,0x73));var _0xaebf=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xebfa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xaebf('0x0'));var util=require(_0xaebf('0x1'));var logger=require(_0xaebf('0x2'))(_0xaebf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaebf('0x4'));var fs=require('fs');var path=require(_0xaebf('0x5'));var rimraf=require('rimraf');var config=require(_0xaebf('0x6'));var attributes=require(_0xaebf('0x7'));module[_0xaebf('0x8')]=function(_0x4f832c,_0x57a77f){return _0x4f832c[_0xaebf('0x9')]('Integration',attributes,{'tableName':_0xaebf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe735=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','Integration','integrations','util'];(function(_0x350a00,_0x41d490){var _0x2f07e8=function(_0xa9cdce){while(--_0xa9cdce){_0x350a00['push'](_0x350a00['shift']());}};_0x2f07e8(++_0x41d490);}(_0xe735,0x121));var _0x5e73=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0xe735[_0x44afa4];return _0xcad289;};'use strict';var _=require('lodash');var util=require(_0x5e73('0x0'));var logger=require(_0x5e73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5e73('0x2'));var rp=require(_0x5e73('0x3'));var fs=require('fs');var path=require(_0x5e73('0x4'));var rimraf=require(_0x5e73('0x5'));var config=require(_0x5e73('0x6'));var attributes=require('./integration.attributes');module[_0x5e73('0x7')]=function(_0x46440a,_0x522634){return _0x46440a['define'](_0x5e73('0x8'),attributes,{'tableName':_0x5e73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ee12dd6..2e576b5 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 _0x3a32=['Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','debug'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x3a32,0x9b));var _0x23a3=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x3a32[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var moment=require(_0x23a3('0x2'));var BPromise=require(_0x23a3('0x3'));var rs=require(_0x23a3('0x4'));var fs=require('fs');var Redis=require(_0x23a3('0x5'));var db=require(_0x23a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23a3('0x7'));var config=require(_0x23a3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103499,_0x256bcf,_0xd4e907){return new BPromise(function(_0x2562bc,_0x11d423){return client[_0x23a3('0xa')](_0x103499,_0xd4e907)['then'](function(_0x233b17){logger[_0x23a3('0xb')]('Integration,\x20%s,\x20%s',_0x256bcf,'request\x20sent');logger[_0x23a3('0xc')](_0x23a3('0xd'),_0x256bcf,_0x23a3('0xe'),JSON['stringify'](_0x233b17));if(_0x233b17[_0x23a3('0xf')]){if(_0x233b17['error'][_0x23a3('0x10')]===0x1f4){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x11d423(_0x233b17[_0x23a3('0xf')][_0x23a3('0x12')]);}logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x2562bc(_0x233b17[_0x23a3('0xf')]['message']);}else{logger[_0x23a3('0xb')](_0x23a3('0x11'),_0x256bcf,'request\x20sent');_0x2562bc(_0x233b17[_0x23a3('0x13')][_0x23a3('0x12')]);}})[_0x23a3('0x14')](function(_0x3e3cc1){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x3e3cc1);_0x11d423(_0x3e3cc1);});});} \ No newline at end of file +var _0x4986=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x4986,0x6e));var _0x6498=function(_0x1a8698,_0x51a362){_0x1a8698=_0x1a8698-0x0;var _0x25c050=_0x4986[_0x1a8698];return _0x25c050;};'use strict';var _=require(_0x6498('0x0'));var util=require(_0x6498('0x1'));var moment=require(_0x6498('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6498('0x3'));var db=require(_0x6498('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6498('0x5'))(_0x6498('0x6'));var config=require(_0x6498('0x7'));var jayson=require(_0x6498('0x8'));var client=jayson[_0x6498('0x9')][_0x6498('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26476d,_0x49b00a,_0x54e6af){return new BPromise(function(_0x1e2d8a,_0x2472af){return client[_0x6498('0xb')](_0x26476d,_0x54e6af)[_0x6498('0xc')](function(_0x1c590e){logger['info'](_0x6498('0xd'),_0x49b00a,_0x6498('0xe'));logger[_0x6498('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x49b00a,'request\x20sent',JSON[_0x6498('0x10')](_0x1c590e));if(_0x1c590e['error']){if(_0x1c590e[_0x6498('0x11')][_0x6498('0x12')]===0x1f4){logger[_0x6498('0x11')](_0x6498('0xd'),_0x49b00a,_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);return _0x2472af(_0x1c590e[_0x6498('0x11')]['message']);}logger['error'](_0x6498('0xd'),_0x49b00a,_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);return _0x1e2d8a(_0x1c590e[_0x6498('0x11')][_0x6498('0x13')]);}else{logger['info'](_0x6498('0xd'),_0x49b00a,_0x6498('0xe'));_0x1e2d8a(_0x1c590e[_0x6498('0x14')][_0x6498('0x13')]);}})[_0x6498('0x15')](function(_0x1b4083){logger[_0x6498('0x11')]('Integration,\x20%s,\x20%s',_0x49b00a,_0x1b4083);_0x2472af(_0x1b4083);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b40b8ee..ba3d4db 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 _0x67ee=['Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x183a0f,_0x59955c){var _0x508639=function(_0x3057a3){while(--_0x3057a3){_0x183a0f['push'](_0x183a0f['shift']());}};_0x508639(++_0x59955c);}(_0x67ee,0x9b));var _0xe67e=function(_0x474829,_0x463fce){_0x474829=_0x474829-0x0;var _0x3002cd=_0x67ee[_0x474829];return _0x3002cd;};'use strict';var multer=require(_0xe67e('0x0'));var util=require(_0xe67e('0x1'));var path=require(_0xe67e('0x2'));var timeout=require(_0xe67e('0x3'));var express=require(_0xe67e('0x4'));var router=express[_0xe67e('0x5')]();var auth=require(_0xe67e('0x6'));var interaction=require(_0xe67e('0x7'));var config=require('../../config/environment');var controller=require(_0xe67e('0x8'));router['get']('/',auth[_0xe67e('0x9')](),controller[_0xe67e('0xa')]);router[_0xe67e('0xb')](_0xe67e('0xc'),auth[_0xe67e('0x9')](),controller[_0xe67e('0xd')]);router['get'](_0xe67e('0xe'),auth[_0xe67e('0x9')](),controller['show']);router['post']('/',auth[_0xe67e('0x9')](),controller[_0xe67e('0xf')]);router[_0xe67e('0x10')]('/:id',auth[_0xe67e('0x9')](),controller[_0xe67e('0x11')]);router[_0xe67e('0x12')](_0xe67e('0xe'),auth[_0xe67e('0x9')](),controller[_0xe67e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe62f=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe'];(function(_0x3d9685,_0x3a9f99){var _0x5856f8=function(_0x4d85eb){while(--_0x4d85eb){_0x3d9685['push'](_0x3d9685['shift']());}};_0x5856f8(++_0x3a9f99);}(_0xe62f,0xc5));var _0xfe62=function(_0x179388,_0x4c4ce3){_0x179388=_0x179388-0x0;var _0xaa9a2f=_0xe62f[_0x179388];return _0xaa9a2f;};'use strict';var multer=require(_0xfe62('0x0'));var util=require(_0xfe62('0x1'));var path=require(_0xfe62('0x2'));var timeout=require(_0xfe62('0x3'));var express=require(_0xfe62('0x4'));var router=express[_0xfe62('0x5')]();var auth=require(_0xfe62('0x6'));var interaction=require(_0xfe62('0x7'));var config=require(_0xfe62('0x8'));var controller=require(_0xfe62('0x9'));router['get']('/',auth[_0xfe62('0xa')](),controller['index']);router[_0xfe62('0xb')](_0xfe62('0xc'),auth[_0xfe62('0xa')](),controller['describe']);router[_0xfe62('0xb')](_0xfe62('0xd'),auth['isAuthenticated'](),controller[_0xfe62('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe62('0xf')]);router[_0xfe62('0x10')]('/:id',auth[_0xfe62('0xa')](),controller[_0xfe62('0x11')]);router[_0xfe62('0x12')](_0xfe62('0xd'),auth[_0xfe62('0xa')](),controller[_0xfe62('0x13')]);module[_0xfe62('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 80bd31c..affc4b7 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 _0x4b3d=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING'];(function(_0x12e09,_0x213b18){var _0x594e27=function(_0x16e73c){while(--_0x16e73c){_0x12e09['push'](_0x12e09['shift']());}};_0x594e27(++_0x213b18);}(_0x4b3d,0x173));var _0xd4b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b3d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd4b3('0x0'));module[_0xd4b3('0x1')]={'integration':{'type':Sequelize[_0xd4b3('0x2')]},'eventChannel':{'type':Sequelize[_0xd4b3('0x2')]},'exitStatus':{'type':Sequelize[_0xd4b3('0x2')]},'ticketId':{'type':Sequelize[_0xd4b3('0x2')]},'integrationId':{'type':Sequelize[_0xd4b3('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd4b3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd4b3('0x2')]},'queue':{'type':Sequelize[_0xd4b3('0x2')]},'interface':{'type':Sequelize[_0xd4b3('0x2')]},'membername':{'type':Sequelize[_0xd4b3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd4b3('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd4b3('0x4')]},'holdtime':{'type':Sequelize[_0xd4b3('0x3')]},'agentcomplete':{'type':Sequelize[_0xd4b3('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd4b3('0x3')]},'agentacw':{'type':Sequelize[_0xd4b3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd4b3('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd4b3('0x4')]},'agentdump':{'type':Sequelize[_0xd4b3('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd4b3('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd4b3('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd4b3('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd4b3('0x2')]},'connectedlinename':{'type':Sequelize[_0xd4b3('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd4b3('0x2')]},'context':{'type':Sequelize[_0xd4b3('0x2')]},'exten':{'type':Sequelize[_0xd4b3('0x2')]},'priority':{'type':Sequelize[_0xd4b3('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd4b3('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd4b3('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd4b3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd4b3('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd4b3('0x2')]},'destaccountcode':{'type':Sequelize[_0xd4b3('0x2')]},'destcontext':{'type':Sequelize[_0xd4b3('0x2')]},'destexten':{'type':Sequelize[_0xd4b3('0x2')]},'destpriority':{'type':Sequelize[_0xd4b3('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xd4b3('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd4b3('0x2')]},'attachment':{'type':Sequelize[_0xd4b3('0x6')]},'html':{'type':Sequelize[_0xd4b3('0x6')]},'text':{'type':Sequelize[_0xd4b3('0x6')]},'status':{'type':Sequelize[_0xd4b3('0x7')](_0xd4b3('0x8'),_0xd4b3('0x9'),_0xd4b3('0xa'),'FAILED')},'url':{'type':Sequelize[_0xd4b3('0x2')]},'app':{'type':Sequelize[_0xd4b3('0x2')]},'appdata':{'type':Sequelize[_0xd4b3('0x2')]},'projectId':{'type':Sequelize[_0xd4b3('0x3')]}}; \ No newline at end of file +var _0xdfb5=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT','ENUM'];(function(_0x3445a1,_0x4661bb){var _0x4b739b=function(_0x4ed18b){while(--_0x4ed18b){_0x3445a1['push'](_0x3445a1['shift']());}};_0x4b739b(++_0x4661bb);}(_0xdfb5,0xb3));var _0x5dfb=function(_0x31564f,_0x507909){_0x31564f=_0x31564f-0x0;var _0x156982=_0xdfb5[_0x31564f];return _0x156982;};'use strict';var Sequelize=require(_0x5dfb('0x0'));module[_0x5dfb('0x1')]={'integration':{'type':Sequelize[_0x5dfb('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x5dfb('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5dfb('0x2')]},'calleridnum':{'type':Sequelize[_0x5dfb('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5dfb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5dfb('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5dfb('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5dfb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5dfb('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5dfb('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5dfb('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x5dfb('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5dfb('0x3')]},'lastevent':{'type':Sequelize[_0x5dfb('0x2')]},'channel':{'type':Sequelize[_0x5dfb('0x2')]},'channelstate':{'type':Sequelize[_0x5dfb('0x5')]},'channelstatedesc':{'type':Sequelize[_0x5dfb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5dfb('0x2')]},'connectedlinename':{'type':Sequelize[_0x5dfb('0x2')]},'language':{'type':Sequelize[_0x5dfb('0x2')]},'accountcode':{'type':Sequelize[_0x5dfb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5dfb('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x5dfb('0x2')]},'destcalleridname':{'type':Sequelize[_0x5dfb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5dfb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5dfb('0x2')]},'destlanguage':{'type':Sequelize[_0x5dfb('0x2')]},'destaccountcode':{'type':Sequelize[_0x5dfb('0x2')]},'destcontext':{'type':Sequelize[_0x5dfb('0x2')]},'destexten':{'type':Sequelize[_0x5dfb('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5dfb('0x2')]},'messageId':{'type':Sequelize[_0x5dfb('0x2')]},'inReplyTo':{'type':Sequelize[_0x5dfb('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x5dfb('0x2')]},'to':{'type':Sequelize[_0x5dfb('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x5dfb('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x5dfb('0x6')]},'status':{'type':Sequelize[_0x5dfb('0x7')]('SENT',_0x5dfb('0x8'),_0x5dfb('0x9'),_0x5dfb('0xa'))},'url':{'type':Sequelize[_0x5dfb('0x2')]},'app':{'type':Sequelize[_0x5dfb('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x5dfb('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 78fea8c..d866fc8 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 _0x5e42=['options','IntegrationReport','catch','show','includeAll','include','find','create','body','destroy','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge'];(function(_0x5061b1,_0x426a56){var _0x2996b0=function(_0x15a3f1){while(--_0x15a3f1){_0x5061b1['push'](_0x5061b1['shift']());}};_0x2996b0(++_0x426a56);}(_0x5e42,0xdb));var _0x25e4=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x5e42[_0x5b8310];return _0xd3ebc1;};'use strict';var pdf=require(_0x25e4('0x0'));var emlformat=require(_0x25e4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x25e4('0x2'));var jsonpatch=require(_0x25e4('0x3'));var rp=require(_0x25e4('0x4'));var moment=require(_0x25e4('0x5'));var BPromise=require(_0x25e4('0x6'));var Mustache=require(_0x25e4('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x25e4('0x8'));var ejs=require(_0x25e4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x25e4('0xa'));var crypto=require(_0x25e4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x25e4('0xc'));var toCsv=require(_0x25e4('0x8'));var querystring=require(_0x25e4('0xd'));var Papa=require(_0x25e4('0xe'));var Redis=require(_0x25e4('0xf'));var authService=require(_0x25e4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25e4('0x11'));var logger=require(_0x25e4('0x12'))('api');var utils=require(_0x25e4('0x13'));var config=require(_0x25e4('0x14'));var db=require(_0x25e4('0x15'))['db'];function respondWithStatusCode(_0x421b2c,_0xd6f205){_0xd6f205=_0xd6f205||0xcc;return function(_0x53f93f){if(_0x53f93f){return _0x421b2c[_0x25e4('0x16')](_0xd6f205);}return _0x421b2c['status'](_0xd6f205)['end']();};}function respondWithResult(_0x3eb21d,_0x55d7e6){_0x55d7e6=_0x55d7e6||0xc8;return function(_0x3bddbd){if(_0x3bddbd){return _0x3eb21d[_0x25e4('0x17')](_0x55d7e6)[_0x25e4('0x18')](_0x3bddbd);}};}function respondWithFilteredResult(_0x1ba896,_0x1eec62){return function(_0x5b6ebf){if(_0x5b6ebf){var _0x5c3c7a=_0x5b6ebf[_0x25e4('0x19')],_0xf4db71=_0x1eec62[_0x25e4('0x1a')],_0x3058dd=_0x1eec62[_0x25e4('0x1a')]+_0x1eec62[_0x25e4('0x1b')],_0x1c9767;if(_0x3058dd>=_0x5c3c7a){_0x3058dd=_0x5c3c7a;_0x1c9767=0xc8;}else{_0x1c9767=0xce;}_0x1ba896[_0x25e4('0x17')](_0x1c9767);return _0x1ba896['set'](_0x25e4('0x1c'),_0xf4db71+'-'+_0x3058dd+'/'+_0x5c3c7a)[_0x25e4('0x18')](_0x5b6ebf);}return null;};}function patchUpdates(_0x59a2f9){return function(_0xba4448){try{jsonpatch['apply'](_0xba4448,_0x59a2f9,!![]);}catch(_0x57f8f1){return BPromise[_0x25e4('0x1d')](_0x57f8f1);}return _0xba4448[_0x25e4('0x1e')]();};}function saveUpdates(_0x915aa6,_0x14eb1b){return function(_0x1e94c4){if(_0x1e94c4){return _0x1e94c4[_0x25e4('0x1f')](_0x915aa6)[_0x25e4('0x20')](function(_0x2ac29f){return _0x2ac29f;});}return null;};}function removeEntity(_0x2f41ba,_0x28fb38){return function(_0x47a2cb){if(_0x47a2cb){return _0x47a2cb['destroy']()['then'](function(){_0x2f41ba[_0x25e4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4107d8,_0x3a4014){return function(_0x160982){if(!_0x160982){_0x4107d8[_0x25e4('0x16')](0x194);}return _0x160982;};}function handleError(_0x3ce245,_0x58cc5b){_0x58cc5b=_0x58cc5b||0x1f4;return function(_0x1a6bc8){logger['error'](_0x1a6bc8[_0x25e4('0x21')]);if(_0x1a6bc8['name']){delete _0x1a6bc8[_0x25e4('0x22')];}_0x3ce245[_0x25e4('0x17')](_0x58cc5b)[_0x25e4('0x23')](_0x1a6bc8);};}exports[_0x25e4('0x24')]=function(_0x12a330,_0x52d35d){var _0x1cd2a9={},_0x115023={},_0x276edf={'count':0x0,'rows':[]};var _0x14ec43=_[_0x25e4('0x25')](db['IntegrationReport'][_0x25e4('0x26')],function(_0x381c72){return{'name':_0x381c72[_0x25e4('0x27')],'type':_0x381c72[_0x25e4('0x28')][_0x25e4('0x29')]};});_0x115023['model']=_[_0x25e4('0x25')](_0x14ec43,_0x25e4('0x22'));_0x115023[_0x25e4('0x2a')]=_[_0x25e4('0x2b')](_0x12a330[_0x25e4('0x2a')]);_0x115023[_0x25e4('0x2c')]=_[_0x25e4('0x2d')](_0x115023['model'],_0x115023[_0x25e4('0x2a')]);_0x1cd2a9['attributes']=_['intersection'](_0x115023[_0x25e4('0x2e')],qs[_0x25e4('0x2f')](_0x12a330[_0x25e4('0x2a')][_0x25e4('0x2f')]));_0x1cd2a9[_0x25e4('0x30')]=_0x1cd2a9[_0x25e4('0x30')][_0x25e4('0x31')]?_0x1cd2a9[_0x25e4('0x30')]:_0x115023['model'];if(!_0x12a330[_0x25e4('0x2a')][_0x25e4('0x32')](_0x25e4('0x33'))){_0x1cd2a9[_0x25e4('0x1b')]=qs['limit'](_0x12a330['query'][_0x25e4('0x1b')]);_0x1cd2a9[_0x25e4('0x1a')]=qs[_0x25e4('0x1a')](_0x12a330['query'][_0x25e4('0x1a')]);}_0x1cd2a9[_0x25e4('0x34')]=qs['sort'](_0x12a330['query']['sort']);_0x1cd2a9['where']=qs[_0x25e4('0x2c')](_['pick'](_0x12a330[_0x25e4('0x2a')],_0x115023[_0x25e4('0x2c')]),_0x14ec43);if(_0x12a330[_0x25e4('0x2a')][_0x25e4('0x35')]){_0x1cd2a9['where']=_['merge'](_0x1cd2a9[_0x25e4('0x36')],{'$or':_['map'](_0x14ec43,function(_0x1af44b){if(_0x1af44b['type']!==_0x25e4('0x37')){var _0x3dda18={};_0x3dda18[_0x1af44b[_0x25e4('0x22')]]={'$like':'%'+_0x12a330[_0x25e4('0x2a')]['filter']+'%'};return _0x3dda18;}})});}_0x1cd2a9=_[_0x25e4('0x38')]({},_0x1cd2a9,_0x12a330[_0x25e4('0x39')]);var _0x28b118={'where':_0x1cd2a9[_0x25e4('0x36')]};return db[_0x25e4('0x3a')][_0x25e4('0x19')](_0x28b118)['then'](function(_0xbb9907){_0x276edf['count']=_0xbb9907;if(_0x12a330[_0x25e4('0x2a')]['includeAll']){_0x1cd2a9['include']=[{'all':!![]}];}return db[_0x25e4('0x3a')]['findAll'](_0x1cd2a9);})[_0x25e4('0x20')](function(_0x521722){_0x276edf['rows']=_0x521722;return _0x276edf;})[_0x25e4('0x20')](respondWithFilteredResult(_0x52d35d,_0x1cd2a9))[_0x25e4('0x3b')](handleError(_0x52d35d,null));};exports[_0x25e4('0x3c')]=function(_0x1bb71e,_0x5f0257){var _0x98b230={'raw':![],'where':{'id':_0x1bb71e['params']['id']}},_0x5341af={};_0x5341af[_0x25e4('0x2e')]=_[_0x25e4('0x2b')](db[_0x25e4('0x3a')]['rawAttributes']);_0x5341af[_0x25e4('0x2a')]=_[_0x25e4('0x2b')](_0x1bb71e[_0x25e4('0x2a')]);_0x5341af['filters']=_[_0x25e4('0x2d')](_0x5341af[_0x25e4('0x2e')],_0x5341af['query']);_0x98b230[_0x25e4('0x30')]=_[_0x25e4('0x2d')](_0x5341af[_0x25e4('0x2e')],qs['fields'](_0x1bb71e[_0x25e4('0x2a')][_0x25e4('0x2f')]));_0x98b230[_0x25e4('0x30')]=_0x98b230[_0x25e4('0x30')]['length']?_0x98b230[_0x25e4('0x30')]:_0x5341af[_0x25e4('0x2e')];if(_0x1bb71e['query'][_0x25e4('0x3d')]){_0x98b230[_0x25e4('0x3e')]=[{'all':!![]}];}_0x98b230=_[_0x25e4('0x38')]({},_0x98b230,_0x1bb71e['options']);return db[_0x25e4('0x3a')][_0x25e4('0x3f')](_0x98b230)[_0x25e4('0x20')](handleEntityNotFound(_0x5f0257,null))[_0x25e4('0x20')](respondWithResult(_0x5f0257,null))['catch'](handleError(_0x5f0257,null));};exports[_0x25e4('0x40')]=function(_0x1aa4be,_0xe3cc86){return db[_0x25e4('0x3a')][_0x25e4('0x40')](_0x1aa4be[_0x25e4('0x41')],{})[_0x25e4('0x20')](respondWithResult(_0xe3cc86,0xc9))['catch'](handleError(_0xe3cc86,null));};exports[_0x25e4('0x1f')]=function(_0x4f6d2c,_0x3e671d){if(_0x4f6d2c[_0x25e4('0x41')]['id']){delete _0x4f6d2c[_0x25e4('0x41')]['id'];}return db[_0x25e4('0x3a')][_0x25e4('0x3f')]({'where':{'id':_0x4f6d2c['params']['id']}})['then'](handleEntityNotFound(_0x3e671d,null))[_0x25e4('0x20')](saveUpdates(_0x4f6d2c[_0x25e4('0x41')],null))[_0x25e4('0x20')](respondWithResult(_0x3e671d,null))[_0x25e4('0x3b')](handleError(_0x3e671d,null));};exports[_0x25e4('0x42')]=function(_0x2be975,_0xd7ffb6){return db[_0x25e4('0x3a')][_0x25e4('0x3f')]({'where':{'id':_0x2be975[_0x25e4('0x43')]['id']}})['then'](handleEntityNotFound(_0xd7ffb6,null))[_0x25e4('0x20')](removeEntity(_0xd7ffb6,null))['catch'](handleError(_0xd7ffb6,null));};exports[_0x25e4('0x44')]=function(_0x49cfdc,_0x55e492){return db[_0x25e4('0x3a')]['describe']()[_0x25e4('0x20')](respondWithResult(_0x55e492,null))[_0x25e4('0x3b')](handleError(_0x55e492,null));}; \ No newline at end of file +var _0x467f=['update','destroy','then','error','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','fields','attributes','length','hasOwnProperty','limit','sort','filters','merge','where','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject'];(function(_0x5352d7,_0x447a4c){var _0x594939=function(_0x3baa2c){while(--_0x3baa2c){_0x5352d7['push'](_0x5352d7['shift']());}};_0x594939(++_0x447a4c);}(_0x467f,0x17d));var _0xf467=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x467f[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf467('0x0'));var rimraf=require(_0xf467('0x1'));var zipdir=require(_0xf467('0x2'));var jsonpatch=require(_0xf467('0x3'));var rp=require(_0xf467('0x4'));var moment=require('moment');var BPromise=require(_0xf467('0x5'));var Mustache=require(_0xf467('0x6'));var util=require(_0xf467('0x7'));var path=require(_0xf467('0x8'));var sox=require('sox');var csv=require(_0xf467('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf467('0xa'));var jsforce=require(_0xf467('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf467('0x9'));var querystring=require(_0xf467('0xc'));var Papa=require(_0xf467('0xd'));var Redis=require(_0xf467('0xe'));var authService=require(_0xf467('0xf'));var qs=require(_0xf467('0x10'));var as=require(_0xf467('0x11'));var hardwareService=require(_0xf467('0x12'));var logger=require(_0xf467('0x13'))(_0xf467('0x14'));var utils=require(_0xf467('0x15'));var config=require(_0xf467('0x16'));var db=require(_0xf467('0x17'))['db'];function respondWithStatusCode(_0x4a334c,_0x5c6558){_0x5c6558=_0x5c6558||0xcc;return function(_0xe8124f){if(_0xe8124f){return _0x4a334c[_0xf467('0x18')](_0x5c6558);}return _0x4a334c[_0xf467('0x19')](_0x5c6558)[_0xf467('0x1a')]();};}function respondWithResult(_0x6fd48a,_0x1135d4){_0x1135d4=_0x1135d4||0xc8;return function(_0x183fb1){if(_0x183fb1){return _0x6fd48a[_0xf467('0x19')](_0x1135d4)[_0xf467('0x1b')](_0x183fb1);}};}function respondWithFilteredResult(_0x396ae2,_0x5423f3){return function(_0x405531){if(_0x405531){var _0x2c9027=_0x405531[_0xf467('0x1c')],_0x2c520b=_0x5423f3['offset'],_0x5657ad=_0x5423f3[_0xf467('0x1d')]+_0x5423f3['limit'],_0x124a61;if(_0x5657ad>=_0x2c9027){_0x5657ad=_0x2c9027;_0x124a61=0xc8;}else{_0x124a61=0xce;}_0x396ae2[_0xf467('0x19')](_0x124a61);return _0x396ae2[_0xf467('0x1e')]('Content-Range',_0x2c520b+'-'+_0x5657ad+'/'+_0x2c9027)['json'](_0x405531);}return null;};}function patchUpdates(_0x1bccce){return function(_0x2bbc5f){try{jsonpatch[_0xf467('0x1f')](_0x2bbc5f,_0x1bccce,!![]);}catch(_0x3b7a63){return BPromise[_0xf467('0x20')](_0x3b7a63);}return _0x2bbc5f['save']();};}function saveUpdates(_0x26002c,_0x5ba923){return function(_0x3bda98){if(_0x3bda98){return _0x3bda98[_0xf467('0x21')](_0x26002c)['then'](function(_0x2435b0){return _0x2435b0;});}return null;};}function removeEntity(_0x448c46,_0x2f70bc){return function(_0x19087d){if(_0x19087d){return _0x19087d[_0xf467('0x22')]()[_0xf467('0x23')](function(){_0x448c46[_0xf467('0x19')](0xcc)[_0xf467('0x1a')]();});}};}function handleEntityNotFound(_0x5e3cd3,_0x584547){return function(_0x49b0aa){if(!_0x49b0aa){_0x5e3cd3[_0xf467('0x18')](0x194);}return _0x49b0aa;};}function handleError(_0x317613,_0xb709ba){_0xb709ba=_0xb709ba||0x1f4;return function(_0x562e42){logger[_0xf467('0x24')](_0x562e42['stack']);if(_0x562e42[_0xf467('0x25')]){delete _0x562e42[_0xf467('0x25')];}_0x317613[_0xf467('0x19')](_0xb709ba)[_0xf467('0x26')](_0x562e42);};}exports['index']=function(_0x22f53a,_0x40d4cd){var _0x2dde63={},_0x1072d8={},_0x518851={'count':0x0,'rows':[]};var _0x43dd95=_[_0xf467('0x27')](db[_0xf467('0x28')][_0xf467('0x29')],function(_0xe7fbc9){return{'name':_0xe7fbc9[_0xf467('0x2a')],'type':_0xe7fbc9[_0xf467('0x2b')][_0xf467('0x2c')]};});_0x1072d8[_0xf467('0x2d')]=_[_0xf467('0x27')](_0x43dd95,_0xf467('0x25'));_0x1072d8['query']=_[_0xf467('0x2e')](_0x22f53a['query']);_0x1072d8['filters']=_['intersection'](_0x1072d8['model'],_0x1072d8[_0xf467('0x2f')]);_0x2dde63['attributes']=_['intersection'](_0x1072d8['model'],qs[_0xf467('0x30')](_0x22f53a['query'][_0xf467('0x30')]));_0x2dde63[_0xf467('0x31')]=_0x2dde63[_0xf467('0x31')][_0xf467('0x32')]?_0x2dde63['attributes']:_0x1072d8[_0xf467('0x2d')];if(!_0x22f53a[_0xf467('0x2f')][_0xf467('0x33')]('nolimit')){_0x2dde63[_0xf467('0x34')]=qs[_0xf467('0x34')](_0x22f53a[_0xf467('0x2f')]['limit']);_0x2dde63[_0xf467('0x1d')]=qs[_0xf467('0x1d')](_0x22f53a[_0xf467('0x2f')]['offset']);}_0x2dde63['order']=qs['sort'](_0x22f53a[_0xf467('0x2f')][_0xf467('0x35')]);_0x2dde63['where']=qs[_0xf467('0x36')](_['pick'](_0x22f53a[_0xf467('0x2f')],_0x1072d8['filters']),_0x43dd95);if(_0x22f53a['query']['filter']){_0x2dde63['where']=_[_0xf467('0x37')](_0x2dde63[_0xf467('0x38')],{'$or':_[_0xf467('0x27')](_0x43dd95,function(_0x28d35b){if(_0x28d35b[_0xf467('0x2b')]!=='VIRTUAL'){var _0x85cc4b={};_0x85cc4b[_0x28d35b[_0xf467('0x25')]]={'$like':'%'+_0x22f53a[_0xf467('0x2f')]['filter']+'%'};return _0x85cc4b;}})});}_0x2dde63=_['merge']({},_0x2dde63,_0x22f53a['options']);var _0x56d85c={'where':_0x2dde63[_0xf467('0x38')]};return db[_0xf467('0x28')][_0xf467('0x1c')](_0x56d85c)[_0xf467('0x23')](function(_0x5d0b8c){_0x518851[_0xf467('0x1c')]=_0x5d0b8c;if(_0x22f53a['query'][_0xf467('0x39')]){_0x2dde63[_0xf467('0x3a')]=[{'all':!![]}];}return db[_0xf467('0x28')][_0xf467('0x3b')](_0x2dde63);})[_0xf467('0x23')](function(_0x30b07b){_0x518851[_0xf467('0x3c')]=_0x30b07b;return _0x518851;})[_0xf467('0x23')](respondWithFilteredResult(_0x40d4cd,_0x2dde63))[_0xf467('0x3d')](handleError(_0x40d4cd,null));};exports['show']=function(_0x50421f,_0x3508b3){var _0xe53255={'raw':![],'where':{'id':_0x50421f[_0xf467('0x3e')]['id']}},_0x3225f2={};_0x3225f2[_0xf467('0x2d')]=_[_0xf467('0x2e')](db[_0xf467('0x28')]['rawAttributes']);_0x3225f2['query']=_[_0xf467('0x2e')](_0x50421f[_0xf467('0x2f')]);_0x3225f2[_0xf467('0x36')]=_[_0xf467('0x3f')](_0x3225f2['model'],_0x3225f2[_0xf467('0x2f')]);_0xe53255[_0xf467('0x31')]=_[_0xf467('0x3f')](_0x3225f2[_0xf467('0x2d')],qs['fields'](_0x50421f[_0xf467('0x2f')][_0xf467('0x30')]));_0xe53255['attributes']=_0xe53255[_0xf467('0x31')][_0xf467('0x32')]?_0xe53255['attributes']:_0x3225f2[_0xf467('0x2d')];if(_0x50421f[_0xf467('0x2f')][_0xf467('0x39')]){_0xe53255['include']=[{'all':!![]}];}_0xe53255=_[_0xf467('0x37')]({},_0xe53255,_0x50421f[_0xf467('0x40')]);return db[_0xf467('0x28')][_0xf467('0x41')](_0xe53255)[_0xf467('0x23')](handleEntityNotFound(_0x3508b3,null))['then'](respondWithResult(_0x3508b3,null))[_0xf467('0x3d')](handleError(_0x3508b3,null));};exports[_0xf467('0x42')]=function(_0x48440c,_0x350f21){return db[_0xf467('0x28')][_0xf467('0x42')](_0x48440c['body'],{})[_0xf467('0x23')](respondWithResult(_0x350f21,0xc9))['catch'](handleError(_0x350f21,null));};exports['update']=function(_0x3a730e,_0x5cef48){if(_0x3a730e[_0xf467('0x43')]['id']){delete _0x3a730e[_0xf467('0x43')]['id'];}return db[_0xf467('0x28')][_0xf467('0x41')]({'where':{'id':_0x3a730e['params']['id']}})[_0xf467('0x23')](handleEntityNotFound(_0x5cef48,null))[_0xf467('0x23')](saveUpdates(_0x3a730e[_0xf467('0x43')],null))[_0xf467('0x23')](respondWithResult(_0x5cef48,null))[_0xf467('0x3d')](handleError(_0x5cef48,null));};exports[_0xf467('0x22')]=function(_0xe3b475,_0xa9b715){return db['IntegrationReport']['find']({'where':{'id':_0xe3b475[_0xf467('0x3e')]['id']}})[_0xf467('0x23')](handleEntityNotFound(_0xa9b715,null))[_0xf467('0x23')](removeEntity(_0xa9b715,null))[_0xf467('0x3d')](handleError(_0xa9b715,null));};exports['describe']=function(_0x5afa37,_0xe339f9){return db[_0xf467('0x28')][_0xf467('0x44')]()[_0xf467('0x23')](respondWithResult(_0xe339f9,null))[_0xf467('0x3d')](handleError(_0xe339f9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6e43f0a..4aef774 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 _0x6434=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','report_integration'];(function(_0x4b5d3b,_0x49be21){var _0x48ec2a=function(_0x126feb){while(--_0x126feb){_0x4b5d3b['push'](_0x4b5d3b['shift']());}};_0x48ec2a(++_0x49be21);}(_0x6434,0x1a4));var _0x4643=function(_0x118df4,_0x4c268d){_0x118df4=_0x118df4-0x0;var _0x53201a=_0x6434[_0x118df4];return _0x53201a;};'use strict';var _=require('lodash');var util=require(_0x4643('0x0'));var logger=require(_0x4643('0x1'))(_0x4643('0x2'));var moment=require(_0x4643('0x3'));var BPromise=require(_0x4643('0x4'));var rp=require(_0x4643('0x5'));var fs=require('fs');var path=require(_0x4643('0x6'));var rimraf=require(_0x4643('0x7'));var config=require('../../config/environment');var attributes=require(_0x4643('0x8'));module[_0x4643('0x9')]=function(_0x1f78e5,_0x16442b){return _0x1f78e5[_0x4643('0xa')]('IntegrationReport',attributes,{'tableName':_0x4643('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc5=['define','IntegrationReport','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes'];(function(_0x33793a,_0x515635){var _0x242389=function(_0x11f5aa){while(--_0x11f5aa){_0x33793a['push'](_0x33793a['shift']());}};_0x242389(++_0x515635);}(_0xbdc5,0x84));var _0x5bdc=function(_0x56ba31,_0x3101e9){_0x56ba31=_0x56ba31-0x0;var _0x57a1e6=_0xbdc5[_0x56ba31];return _0x57a1e6;};'use strict';var _=require('lodash');var util=require(_0x5bdc('0x0'));var logger=require(_0x5bdc('0x1'))(_0x5bdc('0x2'));var moment=require('moment');var BPromise=require(_0x5bdc('0x3'));var rp=require(_0x5bdc('0x4'));var fs=require('fs');var path=require(_0x5bdc('0x5'));var rimraf=require('rimraf');var config=require(_0x5bdc('0x6'));var attributes=require(_0x5bdc('0x7'));module['exports']=function(_0x3e2eeb,_0x180d6c){return _0x3e2eeb[_0x5bdc('0x8')](_0x5bdc('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index d7579cc..8a713ed 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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8603,0x190));var _0x3860=function(_0x45725b,_0x6f132e){_0x45725b=_0x45725b-0x0;var _0x2f65a0=_0x8603[_0x45725b];return _0x2f65a0;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ 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(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x0b0e[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 27079e9..8004f2c 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 _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xe')](_0x7721('0x11'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);module[_0x7721('0x16')]=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xe9507b,_0x23020a){var _0x1640d1=function(_0xf73429){while(--_0xf73429){_0xe9507b['push'](_0xe9507b['shift']());}};_0x1640d1(++_0x23020a);}(_0x34e8,0x12c));var _0x834e=function(_0x3f380c,_0x2f6036){_0x3f380c=_0x3f380c-0x0;var _0x11ca1b=_0x34e8[_0x3f380c];return _0x11ca1b;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9fafade..42a57b6 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 _0xea85=['sequelize','STRING'];(function(_0x5aa5be,_0x390b1f){var _0x1d67ff=function(_0xf19e6){while(--_0xf19e6){_0x5aa5be['push'](_0x5aa5be['shift']());}};_0x1d67ff(++_0x390b1f);}(_0xea85,0x13e));var _0x5ea8=function(_0x444067,_0x4f7f38){_0x444067=_0x444067-0x0;var _0x3c995c=_0xea85[_0x444067];return _0x3c995c;};'use strict';var Sequelize=require(_0x5ea8('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ea8('0x1')]},'description':{'type':Sequelize[_0x5ea8('0x1')]},'interval':{'type':Sequelize[_0x5ea8('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xee7d=['exports','STRING','sequelize'];(function(_0x4b7280,_0x504af7){var _0x3f3590=function(_0x219d08){while(--_0x219d08){_0x4b7280['push'](_0x4b7280['shift']());}};_0x3f3590(++_0x504af7);}(_0xee7d,0x149));var _0xdee7=function(_0x66adbd,_0xa70710){_0x66adbd=_0x66adbd-0x0;var _0xcf294f=_0xee7d[_0x66adbd];return _0xcf294f;};'use strict';var Sequelize=require(_0xdee7('0x0'));module[_0xdee7('0x1')]={'name':{'type':Sequelize[_0xdee7('0x2')]},'description':{'type':Sequelize[_0xdee7('0x2')]},'interval':{'type':Sequelize[_0xdee7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index eae8486..b46809a 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 _0x6ccc=['params','length','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','where','pick','merge','type','filter','findAll','rows','catch','show'];(function(_0x29e722,_0x33e8a7){var _0x5231ca=function(_0xdeada8){while(--_0xdeada8){_0x29e722['push'](_0x29e722['shift']());}};_0x5231ca(++_0x33e8a7);}(_0x6ccc,0x6f));var _0xc6cc=function(_0x259aaf,_0x5dbec1){_0x259aaf=_0x259aaf-0x0;var _0x366663=_0x6ccc[_0x259aaf];return _0x366663;};'use strict';var pdf=require(_0xc6cc('0x0'));var emlformat=require(_0xc6cc('0x1'));var rimraf=require(_0xc6cc('0x2'));var zipdir=require(_0xc6cc('0x3'));var jsonpatch=require(_0xc6cc('0x4'));var rp=require('request-promise');var moment=require(_0xc6cc('0x5'));var BPromise=require(_0xc6cc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc6cc('0x7'));var sox=require(_0xc6cc('0x8'));var csv=require(_0xc6cc('0x9'));var ejs=require(_0xc6cc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc6cc('0xb'));var jsforce=require(_0xc6cc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc6cc('0x9'));var querystring=require(_0xc6cc('0xd'));var Papa=require(_0xc6cc('0xe'));var Redis=require(_0xc6cc('0xf'));var authService=require(_0xc6cc('0x10'));var qs=require(_0xc6cc('0x11'));var as=require(_0xc6cc('0x12'));var hardwareService=require(_0xc6cc('0x13'));var logger=require(_0xc6cc('0x14'))(_0xc6cc('0x15'));var utils=require(_0xc6cc('0x16'));var config=require(_0xc6cc('0x17'));var db=require(_0xc6cc('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1ffb47,_0x11c4ac){_0x11c4ac=_0x11c4ac||0xcc;return function(_0x1186ae){if(_0x1186ae){return _0x1ffb47[_0xc6cc('0x19')](_0x11c4ac);}return _0x1ffb47[_0xc6cc('0x1a')](_0x11c4ac)[_0xc6cc('0x1b')]();};}function respondWithResult(_0x927a1b,_0x4b3034){_0x4b3034=_0x4b3034||0xc8;return function(_0x29e286){if(_0x29e286){return _0x927a1b['status'](_0x4b3034)[_0xc6cc('0x1c')](_0x29e286);}};}function respondWithFilteredResult(_0x34e5f0,_0x5adb8c){return function(_0x292465){if(_0x292465){var _0x363b5f=_0x292465[_0xc6cc('0x1d')],_0x204f21=_0x5adb8c[_0xc6cc('0x1e')],_0x292b87=_0x5adb8c[_0xc6cc('0x1e')]+_0x5adb8c['limit'],_0x2dfc58;if(_0x292b87>=_0x363b5f){_0x292b87=_0x363b5f;_0x2dfc58=0xc8;}else{_0x2dfc58=0xce;}_0x34e5f0[_0xc6cc('0x1a')](_0x2dfc58);return _0x34e5f0['set'](_0xc6cc('0x1f'),_0x204f21+'-'+_0x292b87+'/'+_0x363b5f)[_0xc6cc('0x1c')](_0x292465);}return null;};}function patchUpdates(_0xd802ef){return function(_0x83408b){try{jsonpatch[_0xc6cc('0x20')](_0x83408b,_0xd802ef,!![]);}catch(_0x828690){return BPromise[_0xc6cc('0x21')](_0x828690);}return _0x83408b[_0xc6cc('0x22')]();};}function saveUpdates(_0x2efd8f,_0x59af47){return function(_0x10692e){if(_0x10692e){return _0x10692e['update'](_0x2efd8f)[_0xc6cc('0x23')](function(_0x2fe50e){return _0x2fe50e;});}return null;};}function removeEntity(_0xe3d269,_0x4074f2){return function(_0x2eff8f){if(_0x2eff8f){return _0x2eff8f[_0xc6cc('0x24')]()[_0xc6cc('0x23')](function(){var _0x4f389c=_0x2eff8f[_0xc6cc('0x25')]({'plain':!![]});var _0x145da5=_0xc6cc('0x26');return db[_0xc6cc('0x27')][_0xc6cc('0x24')]({'where':{'type':_0x145da5,'resourceId':_0x4f389c['id']}})['then'](function(){return _0x2eff8f;});})[_0xc6cc('0x23')](function(){_0xe3d269[_0xc6cc('0x1a')](0xcc)[_0xc6cc('0x1b')]();});}};}function handleEntityNotFound(_0x524fa6,_0x205ba1){return function(_0x351578){if(!_0x351578){_0x524fa6[_0xc6cc('0x19')](0x194);}return _0x351578;};}function handleError(_0x50b2fb,_0x471a4a){_0x471a4a=_0x471a4a||0x1f4;return function(_0x368efc){logger[_0xc6cc('0x28')](_0x368efc[_0xc6cc('0x29')]);if(_0x368efc[_0xc6cc('0x2a')]){delete _0x368efc[_0xc6cc('0x2a')];}_0x50b2fb[_0xc6cc('0x1a')](_0x471a4a)[_0xc6cc('0x2b')](_0x368efc);};}exports[_0xc6cc('0x2c')]=function(_0x51e47b,_0x292bee){var _0x2c9200={},_0x5a1608={},_0x4d9b9d={'count':0x0,'rows':[]};var _0x316619=_[_0xc6cc('0x2d')](db[_0xc6cc('0x2e')][_0xc6cc('0x2f')],function(_0x33385f){return{'name':_0x33385f['fieldName'],'type':_0x33385f['type']['key']};});_0x5a1608[_0xc6cc('0x30')]=_['map'](_0x316619,'name');_0x5a1608[_0xc6cc('0x31')]=_[_0xc6cc('0x32')](_0x51e47b[_0xc6cc('0x31')]);_0x5a1608[_0xc6cc('0x33')]=_[_0xc6cc('0x34')](_0x5a1608['model'],_0x5a1608['query']);_0x2c9200[_0xc6cc('0x35')]=_[_0xc6cc('0x34')](_0x5a1608[_0xc6cc('0x30')],qs[_0xc6cc('0x36')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x36')]));_0x2c9200[_0xc6cc('0x35')]=_0x2c9200[_0xc6cc('0x35')]['length']?_0x2c9200[_0xc6cc('0x35')]:_0x5a1608['model'];if(!_0x51e47b[_0xc6cc('0x31')]['hasOwnProperty']('nolimit')){_0x2c9200[_0xc6cc('0x37')]=qs[_0xc6cc('0x37')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x37')]);_0x2c9200[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x1e')]);}_0x2c9200[_0xc6cc('0x38')]=qs[_0xc6cc('0x39')](_0x51e47b[_0xc6cc('0x31')][_0xc6cc('0x39')]);_0x2c9200[_0xc6cc('0x3a')]=qs[_0xc6cc('0x33')](_[_0xc6cc('0x3b')](_0x51e47b[_0xc6cc('0x31')],_0x5a1608[_0xc6cc('0x33')]),_0x316619);if(_0x51e47b[_0xc6cc('0x31')]['filter']){_0x2c9200[_0xc6cc('0x3a')]=_[_0xc6cc('0x3c')](_0x2c9200[_0xc6cc('0x3a')],{'$or':_[_0xc6cc('0x2d')](_0x316619,function(_0x3b75f6){if(_0x3b75f6[_0xc6cc('0x3d')]!=='VIRTUAL'){var _0x306a87={};_0x306a87[_0x3b75f6[_0xc6cc('0x2a')]]={'$like':'%'+_0x51e47b['query'][_0xc6cc('0x3e')]+'%'};return _0x306a87;}})});}_0x2c9200=_[_0xc6cc('0x3c')]({},_0x2c9200,_0x51e47b['options']);var _0x60e0d7={'where':_0x2c9200['where']};return db[_0xc6cc('0x2e')]['count'](_0x60e0d7)[_0xc6cc('0x23')](function(_0x284758){_0x4d9b9d['count']=_0x284758;if(_0x51e47b['query']['includeAll']){_0x2c9200['include']=[{'all':!![]}];}return db[_0xc6cc('0x2e')][_0xc6cc('0x3f')](_0x2c9200);})[_0xc6cc('0x23')](function(_0x421203){_0x4d9b9d[_0xc6cc('0x40')]=_0x421203;return _0x4d9b9d;})[_0xc6cc('0x23')](respondWithFilteredResult(_0x292bee,_0x2c9200))[_0xc6cc('0x41')](handleError(_0x292bee,null));};exports[_0xc6cc('0x42')]=function(_0x1a9136,_0x1f8b2c){var _0x4d3608={'raw':!![],'where':{'id':_0x1a9136[_0xc6cc('0x43')]['id']}},_0x4b15eb={};_0x4b15eb[_0xc6cc('0x30')]=_['keys'](db[_0xc6cc('0x2e')][_0xc6cc('0x2f')]);_0x4b15eb['query']=_[_0xc6cc('0x32')](_0x1a9136[_0xc6cc('0x31')]);_0x4b15eb[_0xc6cc('0x33')]=_[_0xc6cc('0x34')](_0x4b15eb[_0xc6cc('0x30')],_0x4b15eb[_0xc6cc('0x31')]);_0x4d3608[_0xc6cc('0x35')]=_[_0xc6cc('0x34')](_0x4b15eb[_0xc6cc('0x30')],qs['fields'](_0x1a9136[_0xc6cc('0x31')][_0xc6cc('0x36')]));_0x4d3608[_0xc6cc('0x35')]=_0x4d3608[_0xc6cc('0x35')][_0xc6cc('0x44')]?_0x4d3608['attributes']:_0x4b15eb[_0xc6cc('0x30')];if(_0x1a9136[_0xc6cc('0x31')][_0xc6cc('0x45')]){_0x4d3608['include']=[{'all':!![]}];}_0x4d3608=_[_0xc6cc('0x3c')]({},_0x4d3608,_0x1a9136[_0xc6cc('0x46')]);return db['Interval'][_0xc6cc('0x47')](_0x4d3608)[_0xc6cc('0x23')](handleEntityNotFound(_0x1f8b2c,null))[_0xc6cc('0x23')](respondWithResult(_0x1f8b2c,null))[_0xc6cc('0x41')](handleError(_0x1f8b2c,null));};exports[_0xc6cc('0x48')]=function(_0x51f235,_0x1e3574){return db[_0xc6cc('0x2e')][_0xc6cc('0x48')](_0x51f235[_0xc6cc('0x49')],{})[_0xc6cc('0x23')](function(_0x239c35){var _0x3cacf5=_0x51f235[_0xc6cc('0x4a')][_0xc6cc('0x25')]({'plain':!![]});if(!_0x3cacf5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cacf5['role']==='user'){var _0x3a7e90=_0x239c35[_0xc6cc('0x25')]({'plain':!![]});var _0x453a97=_0xc6cc('0x26');return db[_0xc6cc('0x4b')]['find']({'where':{'name':_0x453a97,'userProfileId':_0x3cacf5[_0xc6cc('0x4c')]},'raw':!![]})[_0xc6cc('0x23')](function(_0x1b12ff){if(_0x1b12ff&&_0x1b12ff[_0xc6cc('0x4d')]===0x0){return db[_0xc6cc('0x27')][_0xc6cc('0x48')]({'name':_0x3a7e90[_0xc6cc('0x2a')],'resourceId':_0x3a7e90['id'],'type':_0x1b12ff[_0xc6cc('0x2a')],'sectionId':_0x1b12ff['id']},{})[_0xc6cc('0x23')](function(){return _0x239c35;});}else{return _0x239c35;}})[_0xc6cc('0x41')](function(_0x3d1a61){logger['error'](_0xc6cc('0x4e'),_0x3d1a61);throw _0x3d1a61;});}return _0x239c35;})[_0xc6cc('0x23')](respondWithResult(_0x1e3574,0xc9))[_0xc6cc('0x41')](handleError(_0x1e3574,null));};exports[_0xc6cc('0x4f')]=function(_0x429adb,_0x31e265){if(_0x429adb[_0xc6cc('0x49')]['id']){delete _0x429adb['body']['id'];}return db[_0xc6cc('0x2e')][_0xc6cc('0x47')]({'where':{'id':_0x429adb['params']['id']}})[_0xc6cc('0x23')](handleEntityNotFound(_0x31e265,null))[_0xc6cc('0x23')](saveUpdates(_0x429adb[_0xc6cc('0x49')],null))[_0xc6cc('0x23')](respondWithResult(_0x31e265,null))[_0xc6cc('0x41')](handleError(_0x31e265,null));};exports[_0xc6cc('0x24')]=function(_0x133bf7,_0x12b7a5){return db[_0xc6cc('0x2e')]['find']({'where':{'id':_0x133bf7[_0xc6cc('0x43')]['id']}})['then'](handleEntityNotFound(_0x12b7a5,null))[_0xc6cc('0x23')](removeEntity(_0x12b7a5,null))['catch'](handleError(_0x12b7a5,null));};exports[_0xc6cc('0x50')]=function(_0x5de6b8,_0x59a698,_0x1e5e75){if(_0x5de6b8[_0xc6cc('0x49')]['id']){delete _0x5de6b8[_0xc6cc('0x49')]['id'];}return db['Interval'][_0xc6cc('0x47')]({'where':{'id':_0x5de6b8['params']['id']}})['then'](handleEntityNotFound(_0x59a698,null))['then'](function(_0x194f27){if(_0x194f27){_0x5de6b8[_0xc6cc('0x49')][_0xc6cc('0x51')]=_0x194f27['id'];return db[_0xc6cc('0x2e')][_0xc6cc('0x48')](_0x5de6b8[_0xc6cc('0x49')]);}})[_0xc6cc('0x23')](respondWithResult(_0x59a698,null))[_0xc6cc('0x41')](handleError(_0x59a698,null));};exports[_0xc6cc('0x52')]=function(_0x50bb86,_0x1f916a,_0x5ad65b){var _0x4ceb0f={};var _0x44e57d={};var _0x445f41;var _0x43e03a;return db['Interval'][_0xc6cc('0x53')]({'where':{'id':_0x50bb86['params']['id']}})[_0xc6cc('0x23')](handleEntityNotFound(_0x1f916a,null))['then'](function(_0x3e4504){if(_0x3e4504){_0x445f41=_0x3e4504;_0x44e57d['model']=_[_0xc6cc('0x32')](db[_0xc6cc('0x2e')]['rawAttributes']);_0x44e57d['query']=_[_0xc6cc('0x32')](_0x50bb86[_0xc6cc('0x31')]);_0x44e57d['filters']=_['intersection'](_0x44e57d[_0xc6cc('0x30')],_0x44e57d['query']);_0x4ceb0f['attributes']=_[_0xc6cc('0x34')](_0x44e57d[_0xc6cc('0x30')],qs[_0xc6cc('0x36')](_0x50bb86['query'][_0xc6cc('0x36')]));_0x4ceb0f[_0xc6cc('0x35')]=_0x4ceb0f['attributes'][_0xc6cc('0x44')]?_0x4ceb0f[_0xc6cc('0x35')]:_0x44e57d[_0xc6cc('0x30')];_0x4ceb0f['order']=qs['sort'](_0x50bb86['query'][_0xc6cc('0x39')]);_0x4ceb0f[_0xc6cc('0x3a')]=qs['filters'](_['pick'](_0x50bb86[_0xc6cc('0x31')],_0x44e57d['filters']));if(_0x50bb86[_0xc6cc('0x31')][_0xc6cc('0x3e')]){_0x4ceb0f[_0xc6cc('0x3a')]=_[_0xc6cc('0x3c')](_0x4ceb0f[_0xc6cc('0x3a')],{'$or':_[_0xc6cc('0x2d')](_0x4ceb0f[_0xc6cc('0x35')],function(_0x58db00){var _0x3c6f70={};_0x3c6f70[_0x58db00]={'$like':'%'+_0x50bb86[_0xc6cc('0x31')][_0xc6cc('0x3e')]+'%'};return _0x3c6f70;})});}_0x4ceb0f=_['merge']({},_0x4ceb0f,_0x50bb86[_0xc6cc('0x46')]);return _0x445f41[_0xc6cc('0x52')](_0x4ceb0f);}})[_0xc6cc('0x23')](function(_0xe0ad14){if(_0xe0ad14){_0x43e03a=_0xe0ad14[_0xc6cc('0x44')];if(!_0x50bb86['query']['hasOwnProperty'](_0xc6cc('0x54'))){_0x4ceb0f[_0xc6cc('0x37')]=qs['limit'](_0x50bb86[_0xc6cc('0x31')][_0xc6cc('0x37')]);_0x4ceb0f[_0xc6cc('0x1e')]=qs[_0xc6cc('0x1e')](_0x50bb86['query'][_0xc6cc('0x1e')]);}return _0x445f41[_0xc6cc('0x52')](_0x4ceb0f);}})[_0xc6cc('0x23')](function(_0x329a51){if(_0x329a51){return _0x329a51?{'count':_0x43e03a,'rows':_0x329a51}:null;}})['then'](respondWithResult(_0x1f916a,null))[_0xc6cc('0x41')](handleError(_0x1f916a,null));};exports[_0xc6cc('0x55')]=function(_0x5812dc,_0xbbec8,_0x70e883){return db['Interval'][_0xc6cc('0x53')]({'where':{'id':_0x5812dc[_0xc6cc('0x43')]['id']}})['then'](handleEntityNotFound(_0xbbec8,null))['then'](function(_0x14524c){if(_0x14524c){return db[_0xc6cc('0x56')][_0xc6cc('0x57')](function(_0x3c8527){return db[_0xc6cc('0x2e')][_0xc6cc('0x24')]({'where':{'IntervalId':_0x5812dc[_0xc6cc('0x43')]['id']},'transaction':_0x3c8527})['then'](function(_0x3973da){var _0xe336f6=_['map'](_0x5812dc['body'],function(_0x451157){delete _0x451157['id'];_0x451157['IntervalId']=_0x5812dc[_0xc6cc('0x43')]['id'];return _0x451157;});return db[_0xc6cc('0x2e')][_0xc6cc('0x58')](_0xe336f6,{'transaction':_0x3c8527});});})[_0xc6cc('0x23')](function(){return db[_0xc6cc('0x2e')][_0xc6cc('0x3f')]({'where':{'IntervalId':_0x5812dc[_0xc6cc('0x43')]['id']}});});}})[_0xc6cc('0x23')](respondWithResult(_0xbbec8,null))[_0xc6cc('0x41')](handleError(_0xbbec8,null));}; \ No newline at end of file +var _0x40fd=['userProfileId','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','length','transaction','bulkCreate','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','filters','pick','merge','where','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x516ad1,_0x5993c6){var _0x4ae562=function(_0xa722a2){while(--_0xa722a2){_0x516ad1['push'](_0x516ad1['shift']());}};_0x4ae562(++_0x5993c6);}(_0x40fd,0x1c2));var _0xd40f=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x40fd[_0x20a68a];return _0x56c5d4;};'use strict';var pdf=require(_0xd40f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd40f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd40f('0x2'));var rp=require(_0xd40f('0x3'));var moment=require(_0xd40f('0x4'));var BPromise=require(_0xd40f('0x5'));var Mustache=require('mustache');var util=require(_0xd40f('0x6'));var path=require(_0xd40f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd40f('0x8'));var fs=require('fs');var _=require(_0xd40f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd40f('0xa'));var deskjs=require(_0xd40f('0xb'));var toCsv=require(_0xd40f('0xc'));var querystring=require('querystring');var Papa=require(_0xd40f('0xd'));var Redis=require(_0xd40f('0xe'));var authService=require(_0xd40f('0xf'));var qs=require(_0xd40f('0x10'));var as=require(_0xd40f('0x11'));var hardwareService=require(_0xd40f('0x12'));var logger=require('../../config/logger')(_0xd40f('0x13'));var utils=require('../../config/utils');var config=require(_0xd40f('0x14'));var db=require(_0xd40f('0x15'))['db'];var extensions=require(_0xd40f('0x16'));function respondWithStatusCode(_0x539cd5,_0xdc02cc){_0xdc02cc=_0xdc02cc||0xcc;return function(_0x3b5ab6){if(_0x3b5ab6){return _0x539cd5[_0xd40f('0x17')](_0xdc02cc);}return _0x539cd5['status'](_0xdc02cc)[_0xd40f('0x18')]();};}function respondWithResult(_0xf1acb5,_0x35c2c1){_0x35c2c1=_0x35c2c1||0xc8;return function(_0x4ec8fa){if(_0x4ec8fa){return _0xf1acb5[_0xd40f('0x19')](_0x35c2c1)[_0xd40f('0x1a')](_0x4ec8fa);}};}function respondWithFilteredResult(_0x519c1d,_0xac0f13){return function(_0x261ce3){if(_0x261ce3){var _0x1c18aa=_0x261ce3[_0xd40f('0x1b')],_0x2937f7=_0xac0f13[_0xd40f('0x1c')],_0x418d45=_0xac0f13[_0xd40f('0x1c')]+_0xac0f13['limit'],_0x1178aa;if(_0x418d45>=_0x1c18aa){_0x418d45=_0x1c18aa;_0x1178aa=0xc8;}else{_0x1178aa=0xce;}_0x519c1d[_0xd40f('0x19')](_0x1178aa);return _0x519c1d[_0xd40f('0x1d')](_0xd40f('0x1e'),_0x2937f7+'-'+_0x418d45+'/'+_0x1c18aa)[_0xd40f('0x1a')](_0x261ce3);}return null;};}function patchUpdates(_0x2e2079){return function(_0x131408){try{jsonpatch['apply'](_0x131408,_0x2e2079,!![]);}catch(_0x3e5f18){return BPromise[_0xd40f('0x1f')](_0x3e5f18);}return _0x131408[_0xd40f('0x20')]();};}function saveUpdates(_0x1c4a50,_0x30ff0d){return function(_0x530446){if(_0x530446){return _0x530446[_0xd40f('0x21')](_0x1c4a50)[_0xd40f('0x22')](function(_0x1781f4){return _0x1781f4;});}return null;};}function removeEntity(_0x4628ae,_0x26a1d8){return function(_0x37d341){if(_0x37d341){return _0x37d341[_0xd40f('0x23')]()[_0xd40f('0x22')](function(){var _0x47ede2=_0x37d341[_0xd40f('0x24')]({'plain':!![]});var _0x2f4234=_0xd40f('0x25');return db[_0xd40f('0x26')][_0xd40f('0x23')]({'where':{'type':_0x2f4234,'resourceId':_0x47ede2['id']}})[_0xd40f('0x22')](function(){return _0x37d341;});})[_0xd40f('0x22')](function(){_0x4628ae[_0xd40f('0x19')](0xcc)[_0xd40f('0x18')]();});}};}function handleEntityNotFound(_0x45409e,_0x3587b4){return function(_0x518756){if(!_0x518756){_0x45409e[_0xd40f('0x17')](0x194);}return _0x518756;};}function handleError(_0x12db38,_0x33fac3){_0x33fac3=_0x33fac3||0x1f4;return function(_0x391bbd){logger['error'](_0x391bbd[_0xd40f('0x27')]);if(_0x391bbd[_0xd40f('0x28')]){delete _0x391bbd[_0xd40f('0x28')];}_0x12db38[_0xd40f('0x19')](_0x33fac3)[_0xd40f('0x29')](_0x391bbd);};}exports[_0xd40f('0x2a')]=function(_0x10dd15,_0x473dbb){var _0x37671a={},_0x3b032e={},_0x3b7d30={'count':0x0,'rows':[]};var _0x1f7f77=_[_0xd40f('0x2b')](db[_0xd40f('0x2c')][_0xd40f('0x2d')],function(_0x8d124d){return{'name':_0x8d124d[_0xd40f('0x2e')],'type':_0x8d124d['type'][_0xd40f('0x2f')]};});_0x3b032e[_0xd40f('0x30')]=_['map'](_0x1f7f77,'name');_0x3b032e[_0xd40f('0x31')]=_[_0xd40f('0x32')](_0x10dd15[_0xd40f('0x31')]);_0x3b032e['filters']=_[_0xd40f('0x33')](_0x3b032e[_0xd40f('0x30')],_0x3b032e[_0xd40f('0x31')]);_0x37671a[_0xd40f('0x34')]=_[_0xd40f('0x33')](_0x3b032e[_0xd40f('0x30')],qs[_0xd40f('0x35')](_0x10dd15[_0xd40f('0x31')][_0xd40f('0x35')]));_0x37671a[_0xd40f('0x34')]=_0x37671a[_0xd40f('0x34')]['length']?_0x37671a['attributes']:_0x3b032e[_0xd40f('0x30')];if(!_0x10dd15['query'][_0xd40f('0x36')]('nolimit')){_0x37671a['limit']=qs[_0xd40f('0x37')](_0x10dd15[_0xd40f('0x31')]['limit']);_0x37671a[_0xd40f('0x1c')]=qs[_0xd40f('0x1c')](_0x10dd15[_0xd40f('0x31')][_0xd40f('0x1c')]);}_0x37671a[_0xd40f('0x38')]=qs[_0xd40f('0x39')](_0x10dd15[_0xd40f('0x31')][_0xd40f('0x39')]);_0x37671a['where']=qs[_0xd40f('0x3a')](_[_0xd40f('0x3b')](_0x10dd15[_0xd40f('0x31')],_0x3b032e[_0xd40f('0x3a')]),_0x1f7f77);if(_0x10dd15[_0xd40f('0x31')]['filter']){_0x37671a['where']=_[_0xd40f('0x3c')](_0x37671a[_0xd40f('0x3d')],{'$or':_[_0xd40f('0x2b')](_0x1f7f77,function(_0x3f3920){if(_0x3f3920[_0xd40f('0x3e')]!==_0xd40f('0x3f')){var _0x56ef0a={};_0x56ef0a[_0x3f3920[_0xd40f('0x28')]]={'$like':'%'+_0x10dd15[_0xd40f('0x31')][_0xd40f('0x40')]+'%'};return _0x56ef0a;}})});}_0x37671a=_[_0xd40f('0x3c')]({},_0x37671a,_0x10dd15[_0xd40f('0x41')]);var _0xbdca22={'where':_0x37671a[_0xd40f('0x3d')]};return db[_0xd40f('0x2c')][_0xd40f('0x1b')](_0xbdca22)[_0xd40f('0x22')](function(_0xa2a623){_0x3b7d30[_0xd40f('0x1b')]=_0xa2a623;if(_0x10dd15[_0xd40f('0x31')]['includeAll']){_0x37671a[_0xd40f('0x42')]=[{'all':!![]}];}return db[_0xd40f('0x2c')][_0xd40f('0x43')](_0x37671a);})[_0xd40f('0x22')](function(_0x1b67d6){_0x3b7d30[_0xd40f('0x44')]=_0x1b67d6;return _0x3b7d30;})[_0xd40f('0x22')](respondWithFilteredResult(_0x473dbb,_0x37671a))[_0xd40f('0x45')](handleError(_0x473dbb,null));};exports[_0xd40f('0x46')]=function(_0xdd52e2,_0x41f370){var _0x30f633={'raw':!![],'where':{'id':_0xdd52e2[_0xd40f('0x47')]['id']}},_0x24cc4c={};_0x24cc4c[_0xd40f('0x30')]=_[_0xd40f('0x32')](db['Interval'][_0xd40f('0x2d')]);_0x24cc4c[_0xd40f('0x31')]=_[_0xd40f('0x32')](_0xdd52e2[_0xd40f('0x31')]);_0x24cc4c[_0xd40f('0x3a')]=_[_0xd40f('0x33')](_0x24cc4c['model'],_0x24cc4c[_0xd40f('0x31')]);_0x30f633[_0xd40f('0x34')]=_[_0xd40f('0x33')](_0x24cc4c['model'],qs[_0xd40f('0x35')](_0xdd52e2[_0xd40f('0x31')]['fields']));_0x30f633[_0xd40f('0x34')]=_0x30f633[_0xd40f('0x34')]['length']?_0x30f633[_0xd40f('0x34')]:_0x24cc4c['model'];if(_0xdd52e2[_0xd40f('0x31')][_0xd40f('0x48')]){_0x30f633[_0xd40f('0x42')]=[{'all':!![]}];}_0x30f633=_[_0xd40f('0x3c')]({},_0x30f633,_0xdd52e2[_0xd40f('0x41')]);return db[_0xd40f('0x2c')][_0xd40f('0x49')](_0x30f633)[_0xd40f('0x22')](handleEntityNotFound(_0x41f370,null))[_0xd40f('0x22')](respondWithResult(_0x41f370,null))['catch'](handleError(_0x41f370,null));};exports[_0xd40f('0x4a')]=function(_0x1ad1b3,_0x27432f){return db[_0xd40f('0x2c')][_0xd40f('0x4a')](_0x1ad1b3['body'],{})[_0xd40f('0x22')](function(_0x26406b){var _0x3e8ba1=_0x1ad1b3[_0xd40f('0x4b')]['get']({'plain':!![]});if(!_0x3e8ba1)throw new Error(_0xd40f('0x4c'));if(_0x3e8ba1[_0xd40f('0x4d')]===_0xd40f('0x4b')){var _0x49fb33=_0x26406b['get']({'plain':!![]});var _0x5e0e50='Intervals';return db['UserProfileSection'][_0xd40f('0x49')]({'where':{'name':_0x5e0e50,'userProfileId':_0x3e8ba1[_0xd40f('0x4e')]},'raw':!![]})[_0xd40f('0x22')](function(_0x3ac75a){if(_0x3ac75a&&_0x3ac75a[_0xd40f('0x4f')]===0x0){return db[_0xd40f('0x26')][_0xd40f('0x4a')]({'name':_0x49fb33[_0xd40f('0x28')],'resourceId':_0x49fb33['id'],'type':_0x3ac75a[_0xd40f('0x28')],'sectionId':_0x3ac75a['id']},{})[_0xd40f('0x22')](function(){return _0x26406b;});}else{return _0x26406b;}})[_0xd40f('0x45')](function(_0x1fe8d5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe8d5);throw _0x1fe8d5;});}return _0x26406b;})[_0xd40f('0x22')](respondWithResult(_0x27432f,0xc9))['catch'](handleError(_0x27432f,null));};exports[_0xd40f('0x21')]=function(_0x374e27,_0x33f563){if(_0x374e27[_0xd40f('0x50')]['id']){delete _0x374e27[_0xd40f('0x50')]['id'];}return db[_0xd40f('0x2c')]['find']({'where':{'id':_0x374e27['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x33f563,null))[_0xd40f('0x22')](saveUpdates(_0x374e27[_0xd40f('0x50')],null))[_0xd40f('0x22')](respondWithResult(_0x33f563,null))[_0xd40f('0x45')](handleError(_0x33f563,null));};exports[_0xd40f('0x23')]=function(_0x1dd846,_0x4d52c3){return db['Interval']['find']({'where':{'id':_0x1dd846[_0xd40f('0x47')]['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x4d52c3,null))[_0xd40f('0x22')](removeEntity(_0x4d52c3,null))['catch'](handleError(_0x4d52c3,null));};exports[_0xd40f('0x51')]=function(_0x724089,_0x1fffa5,_0x3a22ee){if(_0x724089['body']['id']){delete _0x724089['body']['id'];}return db[_0xd40f('0x2c')]['find']({'where':{'id':_0x724089['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x1fffa5,null))['then'](function(_0x1a0bcb){if(_0x1a0bcb){_0x724089[_0xd40f('0x50')][_0xd40f('0x52')]=_0x1a0bcb['id'];return db['Interval'][_0xd40f('0x4a')](_0x724089[_0xd40f('0x50')]);}})[_0xd40f('0x22')](respondWithResult(_0x1fffa5,null))['catch'](handleError(_0x1fffa5,null));};exports[_0xd40f('0x53')]=function(_0x354764,_0x34964,_0x5dd2dd){var _0x4427f4={};var _0x4845e1={};var _0x24b3e5;var _0x35c4e4;return db[_0xd40f('0x2c')][_0xd40f('0x54')]({'where':{'id':_0x354764['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x34964,null))[_0xd40f('0x22')](function(_0x17c9d5){if(_0x17c9d5){_0x24b3e5=_0x17c9d5;_0x4845e1[_0xd40f('0x30')]=_['keys'](db[_0xd40f('0x2c')]['rawAttributes']);_0x4845e1[_0xd40f('0x31')]=_[_0xd40f('0x32')](_0x354764[_0xd40f('0x31')]);_0x4845e1[_0xd40f('0x3a')]=_[_0xd40f('0x33')](_0x4845e1[_0xd40f('0x30')],_0x4845e1[_0xd40f('0x31')]);_0x4427f4[_0xd40f('0x34')]=_[_0xd40f('0x33')](_0x4845e1[_0xd40f('0x30')],qs[_0xd40f('0x35')](_0x354764[_0xd40f('0x31')]['fields']));_0x4427f4[_0xd40f('0x34')]=_0x4427f4[_0xd40f('0x34')][_0xd40f('0x55')]?_0x4427f4['attributes']:_0x4845e1[_0xd40f('0x30')];_0x4427f4[_0xd40f('0x38')]=qs['sort'](_0x354764['query'][_0xd40f('0x39')]);_0x4427f4[_0xd40f('0x3d')]=qs[_0xd40f('0x3a')](_[_0xd40f('0x3b')](_0x354764[_0xd40f('0x31')],_0x4845e1[_0xd40f('0x3a')]));if(_0x354764['query']['filter']){_0x4427f4[_0xd40f('0x3d')]=_[_0xd40f('0x3c')](_0x4427f4['where'],{'$or':_['map'](_0x4427f4[_0xd40f('0x34')],function(_0x2e0212){var _0xa2d34={};_0xa2d34[_0x2e0212]={'$like':'%'+_0x354764[_0xd40f('0x31')][_0xd40f('0x40')]+'%'};return _0xa2d34;})});}_0x4427f4=_[_0xd40f('0x3c')]({},_0x4427f4,_0x354764[_0xd40f('0x41')]);return _0x24b3e5[_0xd40f('0x53')](_0x4427f4);}})[_0xd40f('0x22')](function(_0xec1e5d){if(_0xec1e5d){_0x35c4e4=_0xec1e5d[_0xd40f('0x55')];if(!_0x354764[_0xd40f('0x31')][_0xd40f('0x36')]('nolimit')){_0x4427f4[_0xd40f('0x37')]=qs[_0xd40f('0x37')](_0x354764[_0xd40f('0x31')][_0xd40f('0x37')]);_0x4427f4[_0xd40f('0x1c')]=qs['offset'](_0x354764[_0xd40f('0x31')]['offset']);}return _0x24b3e5[_0xd40f('0x53')](_0x4427f4);}})[_0xd40f('0x22')](function(_0x48ec72){if(_0x48ec72){return _0x48ec72?{'count':_0x35c4e4,'rows':_0x48ec72}:null;}})[_0xd40f('0x22')](respondWithResult(_0x34964,null))[_0xd40f('0x45')](handleError(_0x34964,null));};exports['addIntervals']=function(_0x483630,_0x4e0805,_0x5144d3){return db[_0xd40f('0x2c')][_0xd40f('0x54')]({'where':{'id':_0x483630['params']['id']}})[_0xd40f('0x22')](handleEntityNotFound(_0x4e0805,null))['then'](function(_0xb3f838){if(_0xb3f838){return db['sequelize'][_0xd40f('0x56')](function(_0x3ffcd9){return db['Interval'][_0xd40f('0x23')]({'where':{'IntervalId':_0x483630[_0xd40f('0x47')]['id']},'transaction':_0x3ffcd9})[_0xd40f('0x22')](function(_0x10f37f){var _0x5160c7=_[_0xd40f('0x2b')](_0x483630[_0xd40f('0x50')],function(_0x572e25){delete _0x572e25['id'];_0x572e25['IntervalId']=_0x483630['params']['id'];return _0x572e25;});return db[_0xd40f('0x2c')][_0xd40f('0x57')](_0x5160c7,{'transaction':_0x3ffcd9});});})['then'](function(){return db[_0xd40f('0x2c')]['findAll']({'where':{'IntervalId':_0x483630[_0xd40f('0x47')]['id']}});});}})[_0xd40f('0x22')](respondWithResult(_0x4e0805,null))[_0xd40f('0x45')](handleError(_0x4e0805,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 42b07d0..2425071 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 _0xc1c4=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12208b,_0x3a5446){var _0x1d546c=function(_0x158d5b){while(--_0x158d5b){_0x12208b['push'](_0x12208b['shift']());}};_0x1d546c(++_0x3a5446);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x13b5b8,_0x188bad){_0x13b5b8=_0x13b5b8-0x0;var _0x469c77=_0xc1c4[_0x13b5b8];return _0x469c77;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var logger=require(_0x4c1c('0x2'))(_0x4c1c('0x3'));var moment=require(_0x4c1c('0x4'));var BPromise=require(_0x4c1c('0x5'));var rp=require(_0x4c1c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c1c('0x7'));var config=require(_0x4c1c('0x8'));var attributes=require(_0x4c1c('0x9'));var extensions=require(_0x4c1c('0xa'));module['exports']=function(_0xaa5184,_0x4f5a4f){return _0xaa5184['define'](_0x4c1c('0xb'),attributes,{'tableName':_0x4c1c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x486065,_0x13cb7b){extensions[_0x4c1c('0xd')](_0xaa5184,_0x486065);},'afterBulkCreate':function(_0x445441,_0x28c8f4,_0x1ac32d){_0x1ac32d();extensions['rewrite'](_0xaa5184,_0x445441[0x0]);},'afterUpdate':function(_0x5cf2d1,_0x3b577d){extensions[_0x4c1c('0xd')](_0xaa5184,_0x5cf2d1);},'afterDestroy':function(_0x41278a,_0x132319){extensions[_0x4c1c('0xd')](_0xaa5184,_0x41278a);}}});}; \ No newline at end of file +var _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','../../config/logger'];(function(_0x44498d,_0x189bf3){var _0x1e640a=function(_0xc30f0d){while(--_0xc30f0d){_0x44498d['push'](_0x44498d['shift']());}};_0x1e640a(++_0x189bf3);}(_0x0427,0x137));var _0x7042=function(_0x5aef19,_0x3e9c54){_0x5aef19=_0x5aef19-0x0;var _0x31d0bb=_0x0427[_0x5aef19];return _0x31d0bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));var extensions=require(_0x7042('0x8'));module['exports']=function(_0x37a35b,_0x2f24b5){return _0x37a35b[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x978169,_0x40caa9){extensions[_0x7042('0xc')](_0x37a35b,_0x978169);},'afterBulkCreate':function(_0x3bd534,_0x5a29aa,_0x326210){_0x326210();extensions['rewrite'](_0x37a35b,_0x3bd534[0x0]);},'afterUpdate':function(_0x5cf853,_0x50eefb){extensions['rewrite'](_0x37a35b,_0x5cf853);},'afterDestroy':function(_0x2809a9,_0x5636e8){extensions[_0x7042('0xc')](_0x37a35b,_0x2809a9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1c1b649..3b6e25a 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 _0x20ad=['http','request','then','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','info','result','catch','GetInterval','Interval','findAll','options','where','limit','include','model','attributes','map','ShowInterval','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x261f2b,_0x540a59){var _0x49b52c=function(_0x4093e2){while(--_0x4093e2){_0x261f2b['push'](_0x261f2b['shift']());}};_0x49b52c(++_0x540a59);}(_0x20ad,0x121));var _0xd20a=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x20ad[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xd20a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd20a('0x1'));var fs=require('fs');var Redis=require(_0xd20a('0x2'));var db=require(_0xd20a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd20a('0x4'));var config=require(_0xd20a('0x5'));var jayson=require(_0xd20a('0x6'));var client=jayson[_0xd20a('0x7')][_0xd20a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5241ad,_0x3eec49,_0x64b5e1){return new BPromise(function(_0x13efba,_0x137981){return client[_0xd20a('0x9')](_0x5241ad,_0x64b5e1)[_0xd20a('0xa')](function(_0x119188){logger['info']('Interval,\x20%s,\x20%s',_0x3eec49,_0xd20a('0xb'));logger[_0xd20a('0xc')](_0xd20a('0xd'),_0x3eec49,_0xd20a('0xb'),JSON[_0xd20a('0xe')](_0x119188));if(_0x119188[_0xd20a('0xf')]){if(_0x119188[_0xd20a('0xf')][_0xd20a('0x10')]===0x1f4){logger[_0xd20a('0xf')](_0xd20a('0x11'),_0x3eec49,_0x119188[_0xd20a('0xf')][_0xd20a('0x12')]);return _0x137981(_0x119188[_0xd20a('0xf')][_0xd20a('0x12')]);}logger[_0xd20a('0xf')](_0xd20a('0x11'),_0x3eec49,_0x119188[_0xd20a('0xf')][_0xd20a('0x12')]);return _0x13efba(_0x119188['error'][_0xd20a('0x12')]);}else{logger[_0xd20a('0x13')]('Interval,\x20%s,\x20%s',_0x3eec49,_0xd20a('0xb'));_0x13efba(_0x119188[_0xd20a('0x14')][_0xd20a('0x12')]);}})[_0xd20a('0x15')](function(_0x30a917){logger[_0xd20a('0xf')](_0xd20a('0x11'),_0x3eec49,_0x30a917);_0x137981(_0x30a917);});});}exports[_0xd20a('0x16')]=function(_0x522890){var _0x444b99=this;return new Promise(function(_0x56ec4b,_0x4b1de1){return db[_0xd20a('0x17')][_0xd20a('0x18')]({'raw':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x522890[_0xd20a('0x19')]?_0x522890['options'][_0xd20a('0x1a')]||null:null,'attributes':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')]['attributes']||null:null,'limit':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')][_0xd20a('0x1b')]||null:null,'include':_0x522890[_0xd20a('0x19')]?_0x522890[_0xd20a('0x19')][_0xd20a('0x1c')]?_['map'](_0x522890[_0xd20a('0x19')][_0xd20a('0x1c')],function(_0x10beba){return{'model':db[_0x10beba[_0xd20a('0x1d')]],'as':_0x10beba['as'],'attributes':_0x10beba[_0xd20a('0x1e')],'include':_0x10beba[_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x10beba[_0xd20a('0x1c')],function(_0x50b9fd){return{'model':db[_0x50b9fd[_0xd20a('0x1d')]],'as':_0x50b9fd['as'],'attributes':_0x50b9fd[_0xd20a('0x1e')],'include':_0x50b9fd['include']?_[_0xd20a('0x1f')](_0x50b9fd[_0xd20a('0x1c')],function(_0xcd7fc1){return{'model':db[_0xcd7fc1[_0xd20a('0x1d')]],'as':_0xcd7fc1['as'],'attributes':_0xcd7fc1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd20a('0xa')](function(_0x258f71){logger[_0xd20a('0x13')](_0xd20a('0x16'),_0x522890);logger[_0xd20a('0xc')](_0xd20a('0x16'),_0x522890,JSON[_0xd20a('0xe')](_0x258f71));_0x56ec4b(_0x258f71);})[_0xd20a('0x15')](function(_0x2f08a6){logger[_0xd20a('0xf')](_0xd20a('0x16'),_0x2f08a6[_0xd20a('0x12')],_0x522890);_0x4b1de1(_0x444b99[_0xd20a('0xf')](0x1f4,_0x2f08a6[_0xd20a('0x12')]));});});};exports['ShowInterval']=function(_0x38bcb2){var _0x1e91ff=this;return new Promise(function(_0x321da0,_0x3cb539){return db[_0xd20a('0x17')]['find']({'raw':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')][_0xd20a('0x1a')]||null:null,'attributes':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')][_0xd20a('0x1e')]||null:null,'include':_0x38bcb2[_0xd20a('0x19')]?_0x38bcb2[_0xd20a('0x19')][_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x38bcb2[_0xd20a('0x19')]['include'],function(_0x31d4f7){return{'model':db[_0x31d4f7['model']],'as':_0x31d4f7['as'],'attributes':_0x31d4f7[_0xd20a('0x1e')],'include':_0x31d4f7[_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x31d4f7['include'],function(_0x1c8d90){return{'model':db[_0x1c8d90[_0xd20a('0x1d')]],'as':_0x1c8d90['as'],'attributes':_0x1c8d90['attributes'],'include':_0x1c8d90[_0xd20a('0x1c')]?_[_0xd20a('0x1f')](_0x1c8d90[_0xd20a('0x1c')],function(_0x3f2993){return{'model':db[_0x3f2993[_0xd20a('0x1d')]],'as':_0x3f2993['as'],'attributes':_0x3f2993[_0xd20a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd20a('0xa')](function(_0x1fa327){logger[_0xd20a('0x13')]('ShowInterval',_0x38bcb2);logger[_0xd20a('0xc')](_0xd20a('0x20'),_0x38bcb2,JSON[_0xd20a('0xe')](_0x1fa327));_0x321da0(_0x1fa327);})[_0xd20a('0x15')](function(_0xf85d3e){logger['error'](_0xd20a('0x20'),_0xf85d3e['message'],_0x38bcb2);_0x3cb539(_0x1e91ff['error'](0x1f4,_0xf85d3e[_0xd20a('0x12')]));});});}; \ No newline at end of file +var _0x449e=['raw','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetInterval','findAll','options','where','attributes','limit','include','model','map','catch','ShowInterval','Interval'];(function(_0x5424db,_0x2abeb0){var _0xe4ad2e=function(_0xcec037){while(--_0xcec037){_0x5424db['push'](_0x5424db['shift']());}};_0xe4ad2e(++_0x2abeb0);}(_0x449e,0x67));var _0xe449=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0x449e[_0xadd0d2];return _0x2d564c;};'use strict';var _=require('lodash');var util=require(_0xe449('0x0'));var moment=require('moment');var BPromise=require(_0xe449('0x1'));var rs=require(_0xe449('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe449('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe449('0x4'))(_0xe449('0x5'));var config=require(_0xe449('0x6'));var jayson=require(_0xe449('0x7'));var client=jayson[_0xe449('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x438d33,_0x410bd7,_0x10531a){return new BPromise(function(_0x2e9a97,_0x5372e6){return client[_0xe449('0x9')](_0x438d33,_0x10531a)[_0xe449('0xa')](function(_0x48f591){logger[_0xe449('0xb')](_0xe449('0xc'),_0x410bd7,'request\x20sent');logger[_0xe449('0xd')](_0xe449('0xe'),_0x410bd7,'request\x20sent',JSON[_0xe449('0xf')](_0x48f591));if(_0x48f591['error']){if(_0x48f591[_0xe449('0x10')][_0xe449('0x11')]===0x1f4){logger[_0xe449('0x10')](_0xe449('0xc'),_0x410bd7,_0x48f591[_0xe449('0x10')]['message']);return _0x5372e6(_0x48f591[_0xe449('0x10')][_0xe449('0x12')]);}logger['error'](_0xe449('0xc'),_0x410bd7,_0x48f591[_0xe449('0x10')][_0xe449('0x12')]);return _0x2e9a97(_0x48f591[_0xe449('0x10')][_0xe449('0x12')]);}else{logger[_0xe449('0xb')](_0xe449('0xc'),_0x410bd7,_0xe449('0x13'));_0x2e9a97(_0x48f591[_0xe449('0x14')][_0xe449('0x12')]);}})['catch'](function(_0x3e1872){logger[_0xe449('0x10')](_0xe449('0xc'),_0x410bd7,_0x3e1872);_0x5372e6(_0x3e1872);});});}exports[_0xe449('0x15')]=function(_0x1ade0b){var _0x4b6e0c=this;return new Promise(function(_0x18ec7a,_0x1f1b9a){return db['Interval'][_0xe449('0x16')]({'raw':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')][_0xe449('0x18')]||null:null,'attributes':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')][_0xe449('0x19')]||null:null,'limit':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')][_0xe449('0x1a')]||null:null,'include':_0x1ade0b[_0xe449('0x17')]?_0x1ade0b[_0xe449('0x17')]['include']?_['map'](_0x1ade0b[_0xe449('0x17')][_0xe449('0x1b')],function(_0x223a74){return{'model':db[_0x223a74[_0xe449('0x1c')]],'as':_0x223a74['as'],'attributes':_0x223a74[_0xe449('0x19')],'include':_0x223a74[_0xe449('0x1b')]?_[_0xe449('0x1d')](_0x223a74['include'],function(_0x1a917a){return{'model':db[_0x1a917a[_0xe449('0x1c')]],'as':_0x1a917a['as'],'attributes':_0x1a917a[_0xe449('0x19')],'include':_0x1a917a[_0xe449('0x1b')]?_['map'](_0x1a917a[_0xe449('0x1b')],function(_0x3f92e5){return{'model':db[_0x3f92e5[_0xe449('0x1c')]],'as':_0x3f92e5['as'],'attributes':_0x3f92e5[_0xe449('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bf825){logger[_0xe449('0xb')](_0xe449('0x15'),_0x1ade0b);logger[_0xe449('0xd')](_0xe449('0x15'),_0x1ade0b,JSON[_0xe449('0xf')](_0x1bf825));_0x18ec7a(_0x1bf825);})[_0xe449('0x1e')](function(_0x395edc){logger[_0xe449('0x10')](_0xe449('0x15'),_0x395edc[_0xe449('0x12')],_0x1ade0b);_0x1f1b9a(_0x4b6e0c[_0xe449('0x10')](0x1f4,_0x395edc['message']));});});};exports[_0xe449('0x1f')]=function(_0x3b7867){var _0x48017c=this;return new Promise(function(_0x59ed9d,_0x1b4f59){return db[_0xe449('0x20')]['find']({'raw':_0x3b7867[_0xe449('0x17')]?_0x3b7867[_0xe449('0x17')][_0xe449('0x21')]===undefined?!![]:![]:!![],'where':_0x3b7867[_0xe449('0x17')]?_0x3b7867[_0xe449('0x17')]['where']||null:null,'attributes':_0x3b7867['options']?_0x3b7867[_0xe449('0x17')][_0xe449('0x19')]||null:null,'include':_0x3b7867[_0xe449('0x17')]?_0x3b7867['options']['include']?_[_0xe449('0x1d')](_0x3b7867[_0xe449('0x17')][_0xe449('0x1b')],function(_0x58ab53){return{'model':db[_0x58ab53[_0xe449('0x1c')]],'as':_0x58ab53['as'],'attributes':_0x58ab53[_0xe449('0x19')],'include':_0x58ab53[_0xe449('0x1b')]?_[_0xe449('0x1d')](_0x58ab53['include'],function(_0x591e5d){return{'model':db[_0x591e5d[_0xe449('0x1c')]],'as':_0x591e5d['as'],'attributes':_0x591e5d[_0xe449('0x19')],'include':_0x591e5d[_0xe449('0x1b')]?_[_0xe449('0x1d')](_0x591e5d['include'],function(_0x507755){return{'model':db[_0x507755[_0xe449('0x1c')]],'as':_0x507755['as'],'attributes':_0x507755['attributes']};}):[]};}):[]};}):[]:[]})[_0xe449('0xa')](function(_0xcf9206){logger['info'](_0xe449('0x1f'),_0x3b7867);logger[_0xe449('0xd')](_0xe449('0x1f'),_0x3b7867,JSON[_0xe449('0xf')](_0xcf9206));_0x59ed9d(_0xcf9206);})['catch'](function(_0xd96506){logger[_0xe449('0x10')](_0xe449('0x1f'),_0xd96506[_0xe449('0x12')],_0x3b7867);_0x1b4f59(_0x48017c[_0xe449('0x10')](0x1f4,_0xd96506['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4616022..cd7ac32 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 _0x5b6b=['express','../../components/auth/service','./jira.controller','isAuthenticated','exports'];(function(_0x239182,_0x2fdbdd){var _0x529f0c=function(_0x5677b0){while(--_0x5677b0){_0x239182['push'](_0x239182['shift']());}};_0x529f0c(++_0x2fdbdd);}(_0x5b6b,0xdc));var _0xb5b6=function(_0x52f890,_0x4766c1){_0x52f890=_0x52f890-0x0;var _0x4fd947=_0x5b6b[_0x52f890];return _0x4fd947;};'use strict';var express=require(_0xb5b6('0x0'));var router=express['Router']();var auth=require(_0xb5b6('0x1'));var controller=require(_0xb5b6('0x2'));router['post']('/',auth[_0xb5b6('0x3')](),controller['send']);module[_0xb5b6('0x4')]=router; \ No newline at end of file +var _0x7029=['exports','express','Router','./jira.controller','post','send'];(function(_0x2ff88b,_0x559d50){var _0x52bca0=function(_0x395b40){while(--_0x395b40){_0x2ff88b['push'](_0x2ff88b['shift']());}};_0x52bca0(++_0x559d50);}(_0x7029,0xd3));var _0x9702=function(_0x3b0986,_0x3fd783){_0x3b0986=_0x3b0986-0x0;var _0x223648=_0x7029[_0x3b0986];return _0x223648;};'use strict';var express=require(_0x9702('0x0'));var router=express[_0x9702('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9702('0x2'));router[_0x9702('0x3')]('/',auth['isAuthenticated'](),controller[_0x9702('0x4')]);module[_0x9702('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3a3cad7..bc07916 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 _0x642a=['3eAmWpBVP0','key','Report','description','issuetype','Bug','customfield_11500','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','Basic\x20','stringify','request','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','api','support'];(function(_0x493c7d,_0x4cf33a){var _0x29c39e=function(_0x4d691e){while(--_0x4d691e){_0x493c7d['push'](_0x493c7d['shift']());}};_0x29c39e(++_0x4cf33a);}(_0x642a,0x1c3));var _0xa642=function(_0x254ec9,_0x2d7b47){_0x254ec9=_0x254ec9-0x0;var _0x3508d3=_0x642a[_0x254ec9];return _0x3508d3;};'use strict';var BPromise=require(_0xa642('0x0'));var https=require('https');var logger=require(_0xa642('0x1'))(_0xa642('0x2'));var USERNAME=_0xa642('0x3');var PASSWORD=_0xa642('0x4');function openIssue(_0x5e5db3,_0x1f4856){var _0x271294={'fields':{'project':{'key':_0x5e5db3[_0xa642('0x5')]||'MOTGUI'},'summary':(_0x5e5db3['summary']||_0xa642('0x6'))+'\x20from\x20'+_0x5e5db3['ip'],'description':_0x5e5db3[_0xa642('0x7')]||JSON['stringify'](_0x5e5db3),'issuetype':{'name':_0x5e5db3[_0xa642('0x8')]||_0xa642('0x9')}}};_0x271294['fields'][_0xa642('0xa')]=_0x5e5db3['email'];_0x271294[_0xa642('0xb')][_0xa642('0xc')]=_0x5e5db3['oldToken'];_0x271294[_0xa642('0xb')][_0xa642('0xd')]=_0x5e5db3[_0xa642('0xe')];_0x271294[_0xa642('0xb')][_0xa642('0xf')]=_0x5e5db3[_0xa642('0x10')];_0x271294[_0xa642('0xb')][_0xa642('0x11')]=_0x5e5db3[_0xa642('0x12')];_0x271294[_0xa642('0xb')]['customfield_10102']=_0x5e5db3['ip'];var _0x262ee5={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xa642('0x13')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x40c092=JSON[_0xa642('0x14')](_0x271294);var _0xdac20=https[_0xa642('0x15')](_0x262ee5,function(_0x4cdaec){_0x4cdaec['setEncoding']('utf8');var _0x3a4b1c='';_0x4cdaec['on']('data',function(_0x389017){_0x3a4b1c+=_0x389017;});_0x4cdaec['on']('end',function(){if(_0x1f4856){return _0x1f4856['status'](_0x4cdaec[_0xa642('0x16')])[_0xa642('0x17')](JSON[_0xa642('0x18')](_0x3a4b1c));}});});_0xdac20['on'](_0xa642('0x19'),function(_0x42e58d){if(_0x1f4856){return _0x1f4856['status'](0x1f4)[_0xa642('0x17')]({'errors':[{'message':_0xa642('0x1a'),'type':_0xa642('0x1b')}]});}});_0xdac20['write'](_0x40c092);_0xdac20['end']();}exports['openIssue']=openIssue;exports[_0xa642('0x1c')]=function(_0x245a35,_0x1faed8){_0x245a35[_0xa642('0x1d')]['ip']=_0x245a35[_0xa642('0x1e')][_0xa642('0x1f')]||_0x245a35['connection'][_0xa642('0x20')]||_0x245a35[_0xa642('0x21')][_0xa642('0x20')]||_0x245a35[_0xa642('0x22')][_0xa642('0x21')][_0xa642('0x20')];return openIssue(_0x245a35['body'],_0x1faed8);}; \ No newline at end of file +var _0x00a0=['body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','data','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','end','openIssue'];(function(_0x2f47d2,_0x2696f0){var _0x52b8d3=function(_0x543b76){while(--_0x543b76){_0x2f47d2['push'](_0x2f47d2['shift']());}};_0x52b8d3(++_0x2696f0);}(_0x00a0,0x86));var _0x000a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x00a0[_0x27af45];return _0x18df21;};'use strict';var BPromise=require(_0x000a('0x0'));var https=require('https');var logger=require(_0x000a('0x1'))(_0x000a('0x2'));var USERNAME=_0x000a('0x3');var PASSWORD=_0x000a('0x4');function openIssue(_0x51cffa,_0x265f6b){var _0x4ce024={'fields':{'project':{'key':_0x51cffa[_0x000a('0x5')]||_0x000a('0x6')},'summary':(_0x51cffa[_0x000a('0x7')]||'Report')+_0x000a('0x8')+_0x51cffa['ip'],'description':_0x51cffa[_0x000a('0x9')]||JSON[_0x000a('0xa')](_0x51cffa),'issuetype':{'name':_0x51cffa[_0x000a('0xb')]||_0x000a('0xc')}}};_0x4ce024[_0x000a('0xd')][_0x000a('0xe')]=_0x51cffa[_0x000a('0xf')];_0x4ce024['fields']['customfield_11501']=_0x51cffa['oldToken'];_0x4ce024[_0x000a('0xd')]['customfield_11502']=_0x51cffa[_0x000a('0x10')];_0x4ce024[_0x000a('0xd')][_0x000a('0x11')]=_0x51cffa[_0x000a('0x12')];_0x4ce024['fields'][_0x000a('0x13')]=_0x51cffa[_0x000a('0x14')];_0x4ce024['fields'][_0x000a('0x15')]=_0x51cffa['ip'];var _0x4f9eb1={'host':_0x000a('0x16'),'port':0x1bb,'path':_0x000a('0x17'),'method':_0x000a('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x000a('0x19'),'Authorization':_0x000a('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x000a('0x1b')]('base64')}};var _0x5182c6=JSON[_0x000a('0xa')](_0x4ce024);var _0x20905a=https[_0x000a('0x1c')](_0x4f9eb1,function(_0x59b036){_0x59b036[_0x000a('0x1d')](_0x000a('0x1e'));var _0x507af4='';_0x59b036['on'](_0x000a('0x1f'),function(_0xcedc3d){_0x507af4+=_0xcedc3d;});_0x59b036['on']('end',function(){if(_0x265f6b){return _0x265f6b[_0x000a('0x20')](_0x59b036['statusCode'])[_0x000a('0x21')](JSON[_0x000a('0x22')](_0x507af4));}});});_0x20905a['on']('error',function(_0x26e838){if(_0x265f6b){return _0x265f6b[_0x000a('0x20')](0x1f4)[_0x000a('0x21')]({'errors':[{'message':_0x000a('0x23'),'type':'api.jira'}]});}});_0x20905a['write'](_0x5182c6);_0x20905a[_0x000a('0x24')]();}exports[_0x000a('0x25')]=openIssue;exports['send']=function(_0x6995db,_0xe9c532){_0x6995db[_0x000a('0x26')]['ip']=_0x6995db[_0x000a('0x27')]['x-forwarded-for']||_0x6995db[_0x000a('0x28')][_0x000a('0x29')]||_0x6995db[_0x000a('0x2a')][_0x000a('0x29')]||_0x6995db[_0x000a('0x28')]['socket'][_0x000a('0x29')];return openIssue(_0x6995db[_0x000a('0x26')],_0xe9c532);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index cddc672..36544ec 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 _0x3412=['util','connect-timeout','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x8ed795,_0x21bb0e){var _0x101264=function(_0x445fcf){while(--_0x445fcf){_0x8ed795['push'](_0x8ed795['shift']());}};_0x101264(++_0x21bb0e);}(_0x3412,0x155));var _0x2341=function(_0x23fa5d,_0x356419){_0x23fa5d=_0x23fa5d-0x0;var _0x43f2b0=_0x3412[_0x23fa5d];return _0x43f2b0;};'use strict';var multer=require(_0x2341('0x0'));var util=require(_0x2341('0x1'));var path=require('path');var timeout=require(_0x2341('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2341('0x3'));var config=require(_0x2341('0x4'));var controller=require(_0x2341('0x5'));router[_0x2341('0x6')]('/',auth[_0x2341('0x7')](),controller[_0x2341('0x8')]);router[_0x2341('0x6')](_0x2341('0x9'),auth[_0x2341('0x7')](),controller[_0x2341('0xa')]);router[_0x2341('0x6')](_0x2341('0xb'),auth[_0x2341('0x7')](),controller[_0x2341('0xc')]);router[_0x2341('0xd')]('/',auth[_0x2341('0x7')](),controller[_0x2341('0xe')]);router['put'](_0x2341('0xb'),auth[_0x2341('0x7')](),controller['update']);router[_0x2341('0xf')](_0x2341('0xb'),auth[_0x2341('0x7')](),controller[_0x2341('0x10')]);module[_0x2341('0x11')]=router; \ No newline at end of file +var _0x448c=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','post','isAuthenticated','update','delete','/:id'];(function(_0x4b22c4,_0x550d36){var _0x497806=function(_0x348b65){while(--_0x348b65){_0x4b22c4['push'](_0x4b22c4['shift']());}};_0x497806(++_0x550d36);}(_0x448c,0x119));var _0xc448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x448c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc448('0x0'));var path=require(_0xc448('0x1'));var timeout=require('connect-timeout');var express=require(_0xc448('0x2'));var router=express['Router']();var auth=require(_0xc448('0x3'));var interaction=require(_0xc448('0x4'));var config=require(_0xc448('0x5'));var controller=require(_0xc448('0x6'));router[_0xc448('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc448('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc448('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc448('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xc448('0x9')](),controller[_0xc448('0xa')]);router[_0xc448('0xb')](_0xc448('0xc'),auth[_0xc448('0x9')](),controller['destroy']);module[_0xc448('0xd')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f34c8fe..a5d11d1 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 _0x5cec=['STRING','TEXT','long','sequelize','exports'];(function(_0x515ae2,_0x21d0d9){var _0x25db1f=function(_0x5d67de){while(--_0x5d67de){_0x515ae2['push'](_0x515ae2['shift']());}};_0x25db1f(++_0x21d0d9);}(_0x5cec,0x1cf));var _0xc5ce=function(_0x3baa58,_0x53d46f){_0x3baa58=_0x3baa58-0x0;var _0x3b1e7b=_0x5cec[_0x3baa58];return _0x3b1e7b;};'use strict';var Sequelize=require(_0xc5ce('0x0'));module[_0xc5ce('0x1')]={'question':{'type':Sequelize[_0xc5ce('0x2')]},'answer':{'type':Sequelize[_0xc5ce('0x3')](_0xc5ce('0x4'))},'membername':{'type':Sequelize[_0xc5ce('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc5ce('0x2')]},'calleridname':{'type':Sequelize[_0xc5ce('0x2')]},'calleridnum':{'type':Sequelize[_0xc5ce('0x2')]},'questionId':{'type':Sequelize[_0xc5ce('0x2')]}}; \ No newline at end of file +var _0x1430=['TEXT','exports','STRING'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x1430,0x187));var _0x0143=function(_0x1c865d,_0x6e2bb9){_0x1c865d=_0x1c865d-0x0;var _0x1466bc=_0x1430[_0x1c865d];return _0x1466bc;};'use strict';var Sequelize=require('sequelize');module[_0x0143('0x0')]={'question':{'type':Sequelize[_0x0143('0x1')]},'answer':{'type':Sequelize[_0x0143('0x2')]('long')},'membername':{'type':Sequelize[_0x0143('0x1')]},'projectname':{'type':Sequelize[_0x0143('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0143('0x1')]},'calleridname':{'type':Sequelize[_0x0143('0x1')]},'calleridnum':{'type':Sequelize[_0x0143('0x1')]},'questionId':{'type':Sequelize[_0x0143('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 2de1244..10f8845 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 _0xb22f=['send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','save','update','destroy','then','error','stack','name'];(function(_0x2202d4,_0x220f6b){var _0x2551ad=function(_0x16a55f){while(--_0x16a55f){_0x2202d4['push'](_0x2202d4['shift']());}};_0x2551ad(++_0x220f6b);}(_0xb22f,0xfa));var _0xfb22=function(_0x3f27ea,_0x1cbe5a){_0x3f27ea=_0x3f27ea-0x0;var _0x583322=_0xb22f[_0x3f27ea];return _0x583322;};'use strict';var pdf=require(_0xfb22('0x0'));var emlformat=require(_0xfb22('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb22('0x2'));var rp=require(_0xfb22('0x3'));var moment=require(_0xfb22('0x4'));var BPromise=require(_0xfb22('0x5'));var Mustache=require(_0xfb22('0x6'));var util=require(_0xfb22('0x7'));var path=require('path');var sox=require(_0xfb22('0x8'));var csv=require(_0xfb22('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfb22('0xa'));var crypto=require(_0xfb22('0xb'));var jsforce=require(_0xfb22('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfb22('0x9'));var querystring=require(_0xfb22('0xd'));var Papa=require(_0xfb22('0xe'));var Redis=require(_0xfb22('0xf'));var authService=require(_0xfb22('0x10'));var qs=require(_0xfb22('0x11'));var as=require(_0xfb22('0x12'));var hardwareService=require(_0xfb22('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfb22('0x14'));var db=require(_0xfb22('0x15'))['db'];function respondWithStatusCode(_0x399971,_0x29312e){_0x29312e=_0x29312e||0xcc;return function(_0x1b8974){if(_0x1b8974){return _0x399971[_0xfb22('0x16')](_0x29312e);}return _0x399971['status'](_0x29312e)[_0xfb22('0x17')]();};}function respondWithResult(_0xfe4908,_0xf3b6de){_0xf3b6de=_0xf3b6de||0xc8;return function(_0x3669d1){if(_0x3669d1){return _0xfe4908[_0xfb22('0x18')](_0xf3b6de)['json'](_0x3669d1);}};}function respondWithFilteredResult(_0x3dc405,_0xc39505){return function(_0x433a11){if(_0x433a11){var _0x4c23de=_0x433a11[_0xfb22('0x19')],_0x448da8=_0xc39505[_0xfb22('0x1a')],_0x4513f6=_0xc39505[_0xfb22('0x1a')]+_0xc39505[_0xfb22('0x1b')],_0x1c81c9;if(_0x4513f6>=_0x4c23de){_0x4513f6=_0x4c23de;_0x1c81c9=0xc8;}else{_0x1c81c9=0xce;}_0x3dc405[_0xfb22('0x18')](_0x1c81c9);return _0x3dc405[_0xfb22('0x1c')]('Content-Range',_0x448da8+'-'+_0x4513f6+'/'+_0x4c23de)[_0xfb22('0x1d')](_0x433a11);}return null;};}function patchUpdates(_0x1aeb3d){return function(_0x13d64a){try{jsonpatch[_0xfb22('0x1e')](_0x13d64a,_0x1aeb3d,!![]);}catch(_0x1aeb4a){return BPromise['reject'](_0x1aeb4a);}return _0x13d64a[_0xfb22('0x1f')]();};}function saveUpdates(_0x4ee0e3,_0x28ff66){return function(_0x2e0f37){if(_0x2e0f37){return _0x2e0f37[_0xfb22('0x20')](_0x4ee0e3)['then'](function(_0x56f2eb){return _0x56f2eb;});}return null;};}function removeEntity(_0x5494b2,_0xbd0b84){return function(_0x3aff50){if(_0x3aff50){return _0x3aff50[_0xfb22('0x21')]()[_0xfb22('0x22')](function(){_0x5494b2[_0xfb22('0x18')](0xcc)[_0xfb22('0x17')]();});}};}function handleEntityNotFound(_0x132c3d,_0x472df0){return function(_0x3a5da8){if(!_0x3a5da8){_0x132c3d[_0xfb22('0x16')](0x194);}return _0x3a5da8;};}function handleError(_0x1d8f0c,_0x4406e0){_0x4406e0=_0x4406e0||0x1f4;return function(_0x29e7d2){logger[_0xfb22('0x23')](_0x29e7d2[_0xfb22('0x24')]);if(_0x29e7d2['name']){delete _0x29e7d2[_0xfb22('0x25')];}_0x1d8f0c[_0xfb22('0x18')](_0x4406e0)[_0xfb22('0x26')](_0x29e7d2);};}exports[_0xfb22('0x27')]=function(_0x302c34,_0x4e9e1c){var _0x52e264={},_0x285368={},_0x5c1515={'count':0x0,'rows':[]};var _0x32df3c=_[_0xfb22('0x28')](db[_0xfb22('0x29')][_0xfb22('0x2a')],function(_0x54f513){return{'name':_0x54f513[_0xfb22('0x2b')],'type':_0x54f513[_0xfb22('0x2c')][_0xfb22('0x2d')]};});_0x285368['model']=_[_0xfb22('0x28')](_0x32df3c,'name');_0x285368[_0xfb22('0x2e')]=_[_0xfb22('0x2f')](_0x302c34['query']);_0x285368['filters']=_['intersection'](_0x285368[_0xfb22('0x30')],_0x285368[_0xfb22('0x2e')]);_0x52e264[_0xfb22('0x31')]=_['intersection'](_0x285368[_0xfb22('0x30')],qs[_0xfb22('0x32')](_0x302c34[_0xfb22('0x2e')][_0xfb22('0x32')]));_0x52e264[_0xfb22('0x31')]=_0x52e264[_0xfb22('0x31')]['length']?_0x52e264['attributes']:_0x285368['model'];if(!_0x302c34[_0xfb22('0x2e')][_0xfb22('0x33')](_0xfb22('0x34'))){_0x52e264[_0xfb22('0x1b')]=qs[_0xfb22('0x1b')](_0x302c34[_0xfb22('0x2e')]['limit']);_0x52e264['offset']=qs[_0xfb22('0x1a')](_0x302c34[_0xfb22('0x2e')][_0xfb22('0x1a')]);}_0x52e264['order']=qs[_0xfb22('0x35')](_0x302c34['query']['sort']);_0x52e264['where']=qs[_0xfb22('0x36')](_[_0xfb22('0x37')](_0x302c34[_0xfb22('0x2e')],_0x285368[_0xfb22('0x36')]),_0x32df3c);if(_0x302c34['query'][_0xfb22('0x38')]){_0x52e264[_0xfb22('0x39')]=_[_0xfb22('0x3a')](_0x52e264[_0xfb22('0x39')],{'$or':_[_0xfb22('0x28')](_0x32df3c,function(_0x295784){if(_0x295784[_0xfb22('0x2c')]!=='VIRTUAL'){var _0x21a556={};_0x21a556[_0x295784['name']]={'$like':'%'+_0x302c34['query']['filter']+'%'};return _0x21a556;}})});}_0x52e264=_[_0xfb22('0x3a')]({},_0x52e264,_0x302c34['options']);var _0x26394f={'where':_0x52e264[_0xfb22('0x39')]};return db['JscriptyAnswerReport'][_0xfb22('0x19')](_0x26394f)['then'](function(_0x533073){_0x5c1515[_0xfb22('0x19')]=_0x533073;if(_0x302c34[_0xfb22('0x2e')][_0xfb22('0x3b')]){_0x52e264[_0xfb22('0x3c')]=[{'all':!![]}];}return db[_0xfb22('0x29')][_0xfb22('0x3d')](_0x52e264);})['then'](function(_0x404fdf){_0x5c1515[_0xfb22('0x3e')]=_0x404fdf;return _0x5c1515;})[_0xfb22('0x22')](respondWithFilteredResult(_0x4e9e1c,_0x52e264))[_0xfb22('0x3f')](handleError(_0x4e9e1c,null));};exports[_0xfb22('0x40')]=function(_0x3be07b,_0x4cf741){var _0x4074d0={'raw':!![],'where':{'id':_0x3be07b[_0xfb22('0x41')]['id']}},_0x34816d={};_0x34816d[_0xfb22('0x30')]=_[_0xfb22('0x2f')](db[_0xfb22('0x29')]['rawAttributes']);_0x34816d[_0xfb22('0x2e')]=_[_0xfb22('0x2f')](_0x3be07b[_0xfb22('0x2e')]);_0x34816d[_0xfb22('0x36')]=_[_0xfb22('0x42')](_0x34816d[_0xfb22('0x30')],_0x34816d[_0xfb22('0x2e')]);_0x4074d0[_0xfb22('0x31')]=_[_0xfb22('0x42')](_0x34816d[_0xfb22('0x30')],qs[_0xfb22('0x32')](_0x3be07b[_0xfb22('0x2e')]['fields']));_0x4074d0[_0xfb22('0x31')]=_0x4074d0['attributes']['length']?_0x4074d0[_0xfb22('0x31')]:_0x34816d[_0xfb22('0x30')];if(_0x3be07b[_0xfb22('0x2e')][_0xfb22('0x3b')]){_0x4074d0[_0xfb22('0x3c')]=[{'all':!![]}];}_0x4074d0=_['merge']({},_0x4074d0,_0x3be07b[_0xfb22('0x43')]);return db[_0xfb22('0x29')][_0xfb22('0x44')](_0x4074d0)[_0xfb22('0x22')](handleEntityNotFound(_0x4cf741,null))[_0xfb22('0x22')](respondWithResult(_0x4cf741,null))[_0xfb22('0x3f')](handleError(_0x4cf741,null));};exports[_0xfb22('0x45')]=function(_0x4c38b2,_0x83bbc8){return db[_0xfb22('0x29')][_0xfb22('0x45')](_0x4c38b2[_0xfb22('0x46')],{})[_0xfb22('0x22')](respondWithResult(_0x83bbc8,0xc9))['catch'](handleError(_0x83bbc8,null));};exports[_0xfb22('0x20')]=function(_0x470873,_0x20c3a7){if(_0x470873[_0xfb22('0x46')]['id']){delete _0x470873[_0xfb22('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x470873['params']['id']}})[_0xfb22('0x22')](handleEntityNotFound(_0x20c3a7,null))[_0xfb22('0x22')](saveUpdates(_0x470873[_0xfb22('0x46')],null))[_0xfb22('0x22')](respondWithResult(_0x20c3a7,null))['catch'](handleError(_0x20c3a7,null));};exports['destroy']=function(_0x46fa6f,_0x42879d){return db[_0xfb22('0x29')]['find']({'where':{'id':_0x46fa6f[_0xfb22('0x41')]['id']}})[_0xfb22('0x22')](handleEntityNotFound(_0x42879d,null))['then'](removeEntity(_0x42879d,null))[_0xfb22('0x3f')](handleError(_0x42879d,null));};exports['describe']=function(_0x445049,_0x308692){return db[_0xfb22('0x29')][_0xfb22('0x47')]()[_0xfb22('0x22')](respondWithResult(_0x308692,null))[_0xfb22('0x3f')](handleError(_0x308692,null));}; \ No newline at end of file +var _0xf041=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','length','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa858b6,_0x156b7b){var _0x287b3a=function(_0x873838){while(--_0x873838){_0xa858b6['push'](_0xa858b6['shift']());}};_0x287b3a(++_0x156b7b);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1f04('0x0'));var zipdir=require(_0x1f04('0x1'));var jsonpatch=require(_0x1f04('0x2'));var rp=require(_0x1f04('0x3'));var moment=require('moment');var BPromise=require(_0x1f04('0x4'));var Mustache=require('mustache');var util=require(_0x1f04('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1f04('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f04('0x7'));var squel=require(_0x1f04('0x8'));var crypto=require(_0x1f04('0x9'));var jsforce=require(_0x1f04('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1f04('0x6'));var querystring=require(_0x1f04('0xb'));var Papa=require(_0x1f04('0xc'));var Redis=require(_0x1f04('0xd'));var authService=require(_0x1f04('0xe'));var qs=require(_0x1f04('0xf'));var as=require(_0x1f04('0x10'));var hardwareService=require(_0x1f04('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1f04('0x12'));var config=require(_0x1f04('0x13'));var db=require(_0x1f04('0x14'))['db'];function respondWithStatusCode(_0x38787a,_0x10e1da){_0x10e1da=_0x10e1da||0xcc;return function(_0x28edce){if(_0x28edce){return _0x38787a[_0x1f04('0x15')](_0x10e1da);}return _0x38787a[_0x1f04('0x16')](_0x10e1da)[_0x1f04('0x17')]();};}function respondWithResult(_0x1e7693,_0x306c30){_0x306c30=_0x306c30||0xc8;return function(_0x4ebd86){if(_0x4ebd86){return _0x1e7693['status'](_0x306c30)[_0x1f04('0x18')](_0x4ebd86);}};}function respondWithFilteredResult(_0x2056f7,_0x24d37c){return function(_0x57de82){if(_0x57de82){var _0x255fc8=_0x57de82[_0x1f04('0x19')],_0x57b4e5=_0x24d37c[_0x1f04('0x1a')],_0x2edf54=_0x24d37c[_0x1f04('0x1a')]+_0x24d37c[_0x1f04('0x1b')],_0x3bc1e6;if(_0x2edf54>=_0x255fc8){_0x2edf54=_0x255fc8;_0x3bc1e6=0xc8;}else{_0x3bc1e6=0xce;}_0x2056f7['status'](_0x3bc1e6);return _0x2056f7['set'](_0x1f04('0x1c'),_0x57b4e5+'-'+_0x2edf54+'/'+_0x255fc8)[_0x1f04('0x18')](_0x57de82);}return null;};}function patchUpdates(_0x413c24){return function(_0x275170){try{jsonpatch[_0x1f04('0x1d')](_0x275170,_0x413c24,!![]);}catch(_0x30d2e5){return BPromise[_0x1f04('0x1e')](_0x30d2e5);}return _0x275170[_0x1f04('0x1f')]();};}function saveUpdates(_0x596bf9,_0x2d325e){return function(_0x3de665){if(_0x3de665){return _0x3de665[_0x1f04('0x20')](_0x596bf9)['then'](function(_0x2eb6d2){return _0x2eb6d2;});}return null;};}function removeEntity(_0x1453e6,_0x570578){return function(_0xae5976){if(_0xae5976){return _0xae5976[_0x1f04('0x21')]()[_0x1f04('0x22')](function(){_0x1453e6[_0x1f04('0x16')](0xcc)[_0x1f04('0x17')]();});}};}function handleEntityNotFound(_0x162d4f,_0x33ada4){return function(_0x4735a2){if(!_0x4735a2){_0x162d4f['sendStatus'](0x194);}return _0x4735a2;};}function handleError(_0x4e9883,_0x3a29aa){_0x3a29aa=_0x3a29aa||0x1f4;return function(_0x42a782){logger[_0x1f04('0x23')](_0x42a782[_0x1f04('0x24')]);if(_0x42a782[_0x1f04('0x25')]){delete _0x42a782[_0x1f04('0x25')];}_0x4e9883[_0x1f04('0x16')](_0x3a29aa)[_0x1f04('0x26')](_0x42a782);};}exports[_0x1f04('0x27')]=function(_0x96ab0e,_0x2288b3){var _0x26c515={},_0x372fec={},_0x5a110d={'count':0x0,'rows':[]};var _0x3b84c0=_[_0x1f04('0x28')](db[_0x1f04('0x29')][_0x1f04('0x2a')],function(_0x22848d){return{'name':_0x22848d[_0x1f04('0x2b')],'type':_0x22848d[_0x1f04('0x2c')][_0x1f04('0x2d')]};});_0x372fec[_0x1f04('0x2e')]=_[_0x1f04('0x28')](_0x3b84c0,_0x1f04('0x25'));_0x372fec['query']=_[_0x1f04('0x2f')](_0x96ab0e['query']);_0x372fec[_0x1f04('0x30')]=_[_0x1f04('0x31')](_0x372fec[_0x1f04('0x2e')],_0x372fec[_0x1f04('0x32')]);_0x26c515['attributes']=_[_0x1f04('0x31')](_0x372fec[_0x1f04('0x2e')],qs[_0x1f04('0x33')](_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x33')]));_0x26c515[_0x1f04('0x34')]=_0x26c515[_0x1f04('0x34')]['length']?_0x26c515[_0x1f04('0x34')]:_0x372fec['model'];if(!_0x96ab0e['query'][_0x1f04('0x35')](_0x1f04('0x36'))){_0x26c515[_0x1f04('0x1b')]=qs['limit'](_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x1b')]);_0x26c515[_0x1f04('0x1a')]=qs['offset'](_0x96ab0e[_0x1f04('0x32')]['offset']);}_0x26c515[_0x1f04('0x37')]=qs[_0x1f04('0x38')](_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x38')]);_0x26c515[_0x1f04('0x39')]=qs[_0x1f04('0x30')](_[_0x1f04('0x3a')](_0x96ab0e[_0x1f04('0x32')],_0x372fec[_0x1f04('0x30')]),_0x3b84c0);if(_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x3b')]){_0x26c515[_0x1f04('0x39')]=_['merge'](_0x26c515[_0x1f04('0x39')],{'$or':_['map'](_0x3b84c0,function(_0x76795b){if(_0x76795b[_0x1f04('0x2c')]!==_0x1f04('0x3c')){var _0x425769={};_0x425769[_0x76795b[_0x1f04('0x25')]]={'$like':'%'+_0x96ab0e[_0x1f04('0x32')][_0x1f04('0x3b')]+'%'};return _0x425769;}})});}_0x26c515=_[_0x1f04('0x3d')]({},_0x26c515,_0x96ab0e[_0x1f04('0x3e')]);var _0x291171={'where':_0x26c515[_0x1f04('0x39')]};return db['JscriptyAnswerReport'][_0x1f04('0x19')](_0x291171)[_0x1f04('0x22')](function(_0x1adcd6){_0x5a110d[_0x1f04('0x19')]=_0x1adcd6;if(_0x96ab0e[_0x1f04('0x32')]['includeAll']){_0x26c515['include']=[{'all':!![]}];}return db[_0x1f04('0x29')][_0x1f04('0x3f')](_0x26c515);})['then'](function(_0xdc751e){_0x5a110d[_0x1f04('0x40')]=_0xdc751e;return _0x5a110d;})[_0x1f04('0x22')](respondWithFilteredResult(_0x2288b3,_0x26c515))[_0x1f04('0x41')](handleError(_0x2288b3,null));};exports['show']=function(_0xbadf8c,_0x4d2d04){var _0x488940={'raw':!![],'where':{'id':_0xbadf8c[_0x1f04('0x42')]['id']}},_0x2644ee={};_0x2644ee[_0x1f04('0x2e')]=_[_0x1f04('0x2f')](db[_0x1f04('0x29')][_0x1f04('0x2a')]);_0x2644ee[_0x1f04('0x32')]=_['keys'](_0xbadf8c[_0x1f04('0x32')]);_0x2644ee['filters']=_[_0x1f04('0x31')](_0x2644ee[_0x1f04('0x2e')],_0x2644ee[_0x1f04('0x32')]);_0x488940[_0x1f04('0x34')]=_[_0x1f04('0x31')](_0x2644ee[_0x1f04('0x2e')],qs[_0x1f04('0x33')](_0xbadf8c[_0x1f04('0x32')][_0x1f04('0x33')]));_0x488940[_0x1f04('0x34')]=_0x488940[_0x1f04('0x34')][_0x1f04('0x43')]?_0x488940['attributes']:_0x2644ee[_0x1f04('0x2e')];if(_0xbadf8c['query']['includeAll']){_0x488940[_0x1f04('0x44')]=[{'all':!![]}];}_0x488940=_[_0x1f04('0x3d')]({},_0x488940,_0xbadf8c[_0x1f04('0x3e')]);return db[_0x1f04('0x29')][_0x1f04('0x45')](_0x488940)['then'](handleEntityNotFound(_0x4d2d04,null))[_0x1f04('0x22')](respondWithResult(_0x4d2d04,null))[_0x1f04('0x41')](handleError(_0x4d2d04,null));};exports[_0x1f04('0x46')]=function(_0x559d92,_0x564b29){return db['JscriptyAnswerReport'][_0x1f04('0x46')](_0x559d92[_0x1f04('0x47')],{})['then'](respondWithResult(_0x564b29,0xc9))['catch'](handleError(_0x564b29,null));};exports['update']=function(_0x1597fa,_0x59315a){if(_0x1597fa['body']['id']){delete _0x1597fa[_0x1f04('0x47')]['id'];}return db[_0x1f04('0x29')][_0x1f04('0x45')]({'where':{'id':_0x1597fa[_0x1f04('0x42')]['id']}})[_0x1f04('0x22')](handleEntityNotFound(_0x59315a,null))[_0x1f04('0x22')](saveUpdates(_0x1597fa[_0x1f04('0x47')],null))['then'](respondWithResult(_0x59315a,null))[_0x1f04('0x41')](handleError(_0x59315a,null));};exports[_0x1f04('0x21')]=function(_0x333db5,_0x187195){return db[_0x1f04('0x29')][_0x1f04('0x45')]({'where':{'id':_0x333db5['params']['id']}})[_0x1f04('0x22')](handleEntityNotFound(_0x187195,null))[_0x1f04('0x22')](removeEntity(_0x187195,null))[_0x1f04('0x41')](handleError(_0x187195,null));};exports[_0x1f04('0x48')]=function(_0x140315,_0x59f69f){return db['JscriptyAnswerReport'][_0x1f04('0x48')]()['then'](respondWithResult(_0x59f69f,null))[_0x1f04('0x41')](handleError(_0x59f69f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0f725fc..b492556 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 _0x99ef=['util','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x99ef,0x117));var _0xf99e=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x99ef[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xf99e('0x0'));var util=require(_0xf99e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf99e('0x2'));var BPromise=require(_0xf99e('0x3'));var rp=require(_0xf99e('0x4'));var fs=require('fs');var path=require(_0xf99e('0x5'));var rimraf=require('rimraf');var config=require(_0xf99e('0x6'));var attributes=require(_0xf99e('0x7'));module['exports']=function(_0x4447c7,_0x2ceb46){return _0x4447c7['define'](_0xf99e('0x8'),attributes,{'tableName':_0xf99e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44fc=['request-promise','path','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird'];(function(_0x46591a,_0x801bdd){var _0x46de39=function(_0x2e8641){while(--_0x2e8641){_0x46591a['push'](_0x46591a['shift']());}};_0x46de39(++_0x801bdd);}(_0x44fc,0x127));var _0xc44f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x44fc[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xc44f('0x0'));var util=require(_0xc44f('0x1'));var logger=require(_0xc44f('0x2'))(_0xc44f('0x3'));var moment=require('moment');var BPromise=require(_0xc44f('0x4'));var rp=require(_0xc44f('0x5'));var fs=require('fs');var path=require(_0xc44f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xc44f('0x7')]=function(_0x35d679,_0x4fa758){return _0x35d679['define'](_0xc44f('0x8'),attributes,{'tableName':_0xc44f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index f0e0d75..d419cbb 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 _0xd79e=['http','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x1d5e54,_0x5115e6){var _0x420d64=function(_0x14c1dc){while(--_0x14c1dc){_0x1d5e54['push'](_0x1d5e54['shift']());}};_0x420d64(++_0x5115e6);}(_0xd79e,0x1da));var _0xed79=function(_0xe1066,_0x263690){_0xe1066=_0xe1066-0x0;var _0x5a731f=_0xd79e[_0xe1066];return _0x5a731f;};'use strict';var _=require(_0xed79('0x0'));var util=require(_0xed79('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed79('0x2'));var fs=require('fs');var Redis=require(_0xed79('0x3'));var db=require(_0xed79('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed79('0x5'))(_0xed79('0x6'));var config=require('../../config/environment');var jayson=require(_0xed79('0x7'));var client=jayson[_0xed79('0x8')][_0xed79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ed00c,_0x21dba5,_0x454cec){return new BPromise(function(_0x18069a,_0x39a7df){return client[_0xed79('0xa')](_0x2ed00c,_0x454cec)['then'](function(_0x310572){logger[_0xed79('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x21dba5,_0xed79('0xc'));logger[_0xed79('0xd')](_0xed79('0xe'),_0x21dba5,'request\x20sent',JSON['stringify'](_0x310572));if(_0x310572[_0xed79('0xf')]){if(_0x310572[_0xed79('0xf')][_0xed79('0x10')]===0x1f4){logger[_0xed79('0xf')](_0xed79('0x11'),_0x21dba5,_0x310572['error']['message']);return _0x39a7df(_0x310572['error']['message']);}logger[_0xed79('0xf')](_0xed79('0x11'),_0x21dba5,_0x310572[_0xed79('0xf')]['message']);return _0x18069a(_0x310572[_0xed79('0xf')][_0xed79('0x12')]);}else{logger[_0xed79('0xb')](_0xed79('0x11'),_0x21dba5,'request\x20sent');_0x18069a(_0x310572[_0xed79('0x13')][_0xed79('0x12')]);}})[_0xed79('0x14')](function(_0x6e6684){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x21dba5,_0x6e6684);_0x39a7df(_0x6e6684);});});} \ No newline at end of file +var _0x8c58=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x5cbbb6,_0x21e5ef){var _0x464e58=function(_0x295566){while(--_0x295566){_0x5cbbb6['push'](_0x5cbbb6['shift']());}};_0x464e58(++_0x21e5ef);}(_0x8c58,0x132));var _0x88c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c58[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x88c5('0x0'));var util=require(_0x88c5('0x1'));var moment=require(_0x88c5('0x2'));var BPromise=require(_0x88c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c5('0x5'))(_0x88c5('0x6'));var config=require(_0x88c5('0x7'));var jayson=require(_0x88c5('0x8'));var client=jayson[_0x88c5('0x9')][_0x88c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193aca,_0x14b88d,_0xcdff9b){return new BPromise(function(_0x100cd3,_0x42eb66){return client['request'](_0x193aca,_0xcdff9b)[_0x88c5('0xb')](function(_0x2fb081){logger[_0x88c5('0xc')](_0x88c5('0xd'),_0x14b88d,'request\x20sent');logger['debug'](_0x88c5('0xe'),_0x14b88d,_0x88c5('0xf'),JSON['stringify'](_0x2fb081));if(_0x2fb081[_0x88c5('0x10')]){if(_0x2fb081[_0x88c5('0x10')][_0x88c5('0x11')]===0x1f4){logger[_0x88c5('0x10')](_0x88c5('0xd'),_0x14b88d,_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);return _0x42eb66(_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);}logger[_0x88c5('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x14b88d,_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);return _0x100cd3(_0x2fb081[_0x88c5('0x10')][_0x88c5('0x12')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x14b88d,_0x88c5('0xf'));_0x100cd3(_0x2fb081[_0x88c5('0x13')][_0x88c5('0x12')]);}})['catch'](function(_0x853de9){logger[_0x88c5('0x10')](_0x88c5('0xd'),_0x14b88d,_0x853de9);_0x42eb66(_0x853de9);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 501a836..5226342 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 _0x8291=['isAuthenticated','index','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','/:id','update','destroy','exports','util','express','Router','../../config/environment','./jscriptyProject.controller','get'];(function(_0x17e597,_0x2843bd){var _0x329bf4=function(_0x1d5892){while(--_0x1d5892){_0x17e597['push'](_0x17e597['shift']());}};_0x329bf4(++_0x2843bd);}(_0x8291,0x1af));var _0x1829=function(_0x192cc3,_0x5edef6){_0x192cc3=_0x192cc3-0x0;var _0x4f1774=_0x8291[_0x192cc3];return _0x4f1774;};'use strict';var multer=require('multer');var util=require(_0x1829('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1829('0x1'));var router=express[_0x1829('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1829('0x3'));var controller=require(_0x1829('0x4'));router[_0x1829('0x5')]('/',auth[_0x1829('0x6')](),controller[_0x1829('0x7')]);router['get']('/:id',auth[_0x1829('0x6')](),controller[_0x1829('0x8')]);router[_0x1829('0x5')]('/:id/sessions',auth[_0x1829('0x6')](),controller[_0x1829('0x9')]);router['get'](_0x1829('0xa'),auth[_0x1829('0x6')](),controller[_0x1829('0xb')]);router[_0x1829('0x5')](_0x1829('0xc'),auth['isAuthenticated'](),timeout(_0x1829('0xd')),controller[_0x1829('0xe')]);router[_0x1829('0xf')]('/',auth[_0x1829('0x6')](),controller[_0x1829('0x10')]);router[_0x1829('0xf')](_0x1829('0x11'),auth[_0x1829('0x6')](),controller['clone']);router[_0x1829('0x12')](_0x1829('0x13'),auth['isAuthenticated'](),controller[_0x1829('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1829('0x15')]);module[_0x1829('0x16')]=router; \ No newline at end of file +var _0x119f=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3710f1,_0x4d55cf){var _0x1ef269=function(_0x286dce){while(--_0x286dce){_0x3710f1['push'](_0x3710f1['shift']());}};_0x1ef269(++_0x4d55cf);}(_0x119f,0xd4));var _0xf119=function(_0x1942a4,_0x14952f){_0x1942a4=_0x1942a4-0x0;var _0x536f31=_0x119f[_0x1942a4];return _0x536f31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf119('0x0'));var timeout=require(_0xf119('0x1'));var express=require('express');var router=express[_0xf119('0x2')]();var auth=require(_0xf119('0x3'));var interaction=require(_0xf119('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xf119('0x5')](),controller[_0xf119('0x6')]);router[_0xf119('0x7')](_0xf119('0x8'),auth['isAuthenticated'](),controller[_0xf119('0x9')]);router[_0xf119('0x7')]('/:id/sessions',auth[_0xf119('0x5')](),controller[_0xf119('0xa')]);router[_0xf119('0x7')](_0xf119('0xb'),auth[_0xf119('0x5')](),controller[_0xf119('0xc')]);router[_0xf119('0x7')](_0xf119('0xd'),auth['isAuthenticated'](),timeout(_0xf119('0xe')),controller[_0xf119('0xf')]);router[_0xf119('0x10')]('/',auth[_0xf119('0x5')](),controller[_0xf119('0x11')]);router[_0xf119('0x10')](_0xf119('0x12'),auth[_0xf119('0x5')](),controller['clone']);router[_0xf119('0x13')](_0xf119('0x8'),auth['isAuthenticated'](),controller[_0xf119('0x14')]);router[_0xf119('0x15')](_0xf119('0x8'),auth[_0xf119('0x5')](),controller[_0xf119('0x16')]);module[_0xf119('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 0b22cf8..199433a 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 _0x620b=['setDataValue','formData','stringify','isString','format','BOOLEAN','lodash','util','STRING','TEXT'];(function(_0x47fb14,_0x182dcb){var _0x3e7cc5=function(_0x3c1c76){while(--_0x3c1c76){_0x47fb14['push'](_0x47fb14['shift']());}};_0x3e7cc5(++_0x182dcb);}(_0x620b,0x1dc));var _0xb620=function(_0x20ccf8,_0x130b88){_0x20ccf8=_0x20ccf8-0x0;var _0x13950a=_0x620b[_0x20ccf8];return _0x13950a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb620('0x0'));var util=require(_0xb620('0x1'));module['exports']={'name':{'type':Sequelize[_0xb620('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb620('0x2')]},'formData':{'type':Sequelize[_0xb620('0x3')]('long'),'set':function(_0x37bbaa){if(_['isObjectLike'](_0x37bbaa)){this[_0xb620('0x4')](_0xb620('0x5'),JSON[_0xb620('0x6')](_0x37bbaa));}else if(_[_0xb620('0x7')](_0x37bbaa)){this[_0xb620('0x4')](_0xb620('0x5'),_0x37bbaa);}else{this['setDataValue'](_0xb620('0x5'),util[_0xb620('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue']('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb620('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb151=['format','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x24e07b,_0x5c9ce1){var _0x406f1e=function(_0x410df4){while(--_0x410df4){_0x24e07b['push'](_0x24e07b['shift']());}};_0x406f1e(++_0x5c9ce1);}(_0xb151,0x124));var _0x1b15=function(_0x37b1df,_0x2d5b07){_0x37b1df=_0x37b1df-0x0;var _0x1b5a5f=_0xb151[_0x37b1df];return _0x1b5a5f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1b15('0x0'));var util=require(_0x1b15('0x1'));module[_0x1b15('0x2')]={'name':{'type':Sequelize[_0x1b15('0x3')],'unique':_0x1b15('0x4')},'description':{'type':Sequelize[_0x1b15('0x3')]},'formData':{'type':Sequelize[_0x1b15('0x5')](_0x1b15('0x6')),'set':function(_0x57c0a4){if(_[_0x1b15('0x7')](_0x57c0a4)){this[_0x1b15('0x8')](_0x1b15('0x9'),JSON[_0x1b15('0xa')](_0x57c0a4));}else if(_[_0x1b15('0xb')](_0x57c0a4)){this[_0x1b15('0x8')](_0x1b15('0x9'),_0x57c0a4);}else{this[_0x1b15('0x8')](_0x1b15('0x9'),util[_0x1b15('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x1b15('0xd')]('name')||'',this[_0x1b15('0xd')](_0x1b15('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1b15('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index ba1992e..10b9950 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 _0x367b=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','catch','params','rawAttributes','includeAll','include','find','create','body','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2c347c,_0x51fb3c){var _0x2248ee=function(_0x1c1122){while(--_0x1c1122){_0x2c347c['push'](_0x2c347c['shift']());}};_0x2248ee(++_0x51fb3c);}(_0x367b,0x1b0));var _0xb367=function(_0x3d0ce2,_0x104494){_0x3d0ce2=_0x3d0ce2-0x0;var _0x5ede07=_0x367b[_0x3d0ce2];return _0x5ede07;};'use strict';var pdf=require(_0xb367('0x0'));var emlformat=require(_0xb367('0x1'));var rimraf=require(_0xb367('0x2'));var zipdir=require(_0xb367('0x3'));var jsonpatch=require(_0xb367('0x4'));var rp=require(_0xb367('0x5'));var moment=require(_0xb367('0x6'));var BPromise=require(_0xb367('0x7'));var Mustache=require(_0xb367('0x8'));var util=require('util');var path=require(_0xb367('0x9'));var sox=require(_0xb367('0xa'));var csv=require('to-csv');var ejs=require(_0xb367('0xb'));var fs=require('fs');var _=require(_0xb367('0xc'));var squel=require(_0xb367('0xd'));var crypto=require('crypto');var jsforce=require(_0xb367('0xe'));var deskjs=require(_0xb367('0xf'));var toCsv=require(_0xb367('0x10'));var querystring=require(_0xb367('0x11'));var Papa=require(_0xb367('0x12'));var Redis=require('ioredis');var authService=require(_0xb367('0x13'));var qs=require(_0xb367('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb367('0x15'))(_0xb367('0x16'));var utils=require(_0xb367('0x17'));var config=require(_0xb367('0x18'));var db=require(_0xb367('0x19'))['db'];function respondWithStatusCode(_0x3e7c83,_0x4042c0){_0x4042c0=_0x4042c0||0xcc;return function(_0x24dde4){if(_0x24dde4){return _0x3e7c83[_0xb367('0x1a')](_0x4042c0);}return _0x3e7c83[_0xb367('0x1b')](_0x4042c0)[_0xb367('0x1c')]();};}function respondWithResult(_0x3b7a5b,_0x12f2ee){_0x12f2ee=_0x12f2ee||0xc8;return function(_0x43bc7f){if(_0x43bc7f){return _0x3b7a5b[_0xb367('0x1b')](_0x12f2ee)[_0xb367('0x1d')](_0x43bc7f);}};}function respondWithFilteredResult(_0x3c0f3c,_0x390e1b){return function(_0xc13f48){if(_0xc13f48){var _0x5c8a18=_0xc13f48[_0xb367('0x1e')],_0x14652e=_0x390e1b[_0xb367('0x1f')],_0x2e0475=_0x390e1b[_0xb367('0x1f')]+_0x390e1b[_0xb367('0x20')],_0x5607b3;if(_0x2e0475>=_0x5c8a18){_0x2e0475=_0x5c8a18;_0x5607b3=0xc8;}else{_0x5607b3=0xce;}_0x3c0f3c[_0xb367('0x1b')](_0x5607b3);return _0x3c0f3c[_0xb367('0x21')](_0xb367('0x22'),_0x14652e+'-'+_0x2e0475+'/'+_0x5c8a18)[_0xb367('0x1d')](_0xc13f48);}return null;};}function patchUpdates(_0x2ce56c){return function(_0x147173){try{jsonpatch[_0xb367('0x23')](_0x147173,_0x2ce56c,!![]);}catch(_0x5643c7){return BPromise[_0xb367('0x24')](_0x5643c7);}return _0x147173['save']();};}function saveUpdates(_0x54851e,_0x10cc6c){return function(_0x58dcc4){if(_0x58dcc4){return _0x58dcc4[_0xb367('0x25')](_0x54851e)[_0xb367('0x26')](function(_0x106817){return _0x106817;});}return null;};}function removeEntity(_0x365bec,_0x15341f){return function(_0x50a926){if(_0x50a926){return _0x50a926[_0xb367('0x27')]()['then'](function(){var _0x479c6b=_0x50a926[_0xb367('0x28')]({'plain':!![]});var _0x480a63='Projects';return db[_0xb367('0x29')][_0xb367('0x27')]({'where':{'type':_0x480a63,'resourceId':_0x479c6b['id']}})[_0xb367('0x26')](function(){return _0x50a926;});})[_0xb367('0x26')](function(){_0x365bec['status'](0xcc)[_0xb367('0x1c')]();});}};}function handleEntityNotFound(_0x162d11,_0x491053){return function(_0xb27796){if(!_0xb27796){_0x162d11[_0xb367('0x1a')](0x194);}return _0xb27796;};}function handleError(_0x5dbe68,_0x848bc6){_0x848bc6=_0x848bc6||0x1f4;return function(_0x8e7f09){logger['error'](_0x8e7f09[_0xb367('0x2a')]);if(_0x8e7f09[_0xb367('0x2b')]){delete _0x8e7f09[_0xb367('0x2b')];}_0x5dbe68[_0xb367('0x1b')](_0x848bc6)[_0xb367('0x2c')](_0x8e7f09);};}exports[_0xb367('0x2d')]=function(_0x37cd5d,_0x3cf8bd){var _0x41840a={},_0x3d6dd2={},_0x199407={'count':0x0,'rows':[]};var _0x2ab8b0=_[_0xb367('0x2e')](db[_0xb367('0x2f')]['rawAttributes'],function(_0x5eab02){return{'name':_0x5eab02[_0xb367('0x30')],'type':_0x5eab02[_0xb367('0x31')][_0xb367('0x32')]};});_0x3d6dd2[_0xb367('0x33')]=_[_0xb367('0x2e')](_0x2ab8b0,'name');_0x3d6dd2[_0xb367('0x34')]=_[_0xb367('0x35')](_0x37cd5d[_0xb367('0x34')]);_0x3d6dd2[_0xb367('0x36')]=_[_0xb367('0x37')](_0x3d6dd2[_0xb367('0x33')],_0x3d6dd2[_0xb367('0x34')]);_0x41840a[_0xb367('0x38')]=_[_0xb367('0x37')](_0x3d6dd2[_0xb367('0x33')],qs['fields'](_0x37cd5d['query'][_0xb367('0x39')]));_0x41840a[_0xb367('0x38')]=_0x41840a[_0xb367('0x38')][_0xb367('0x3a')]?_0x41840a[_0xb367('0x38')]:_0x3d6dd2[_0xb367('0x33')];if(!_0x37cd5d['query'][_0xb367('0x3b')]('nolimit')){_0x41840a[_0xb367('0x20')]=qs[_0xb367('0x20')](_0x37cd5d['query'][_0xb367('0x20')]);_0x41840a['offset']=qs[_0xb367('0x1f')](_0x37cd5d[_0xb367('0x34')][_0xb367('0x1f')]);}_0x41840a[_0xb367('0x3c')]=qs[_0xb367('0x3d')](_0x37cd5d['query'][_0xb367('0x3d')]);_0x41840a[_0xb367('0x3e')]=qs[_0xb367('0x36')](_[_0xb367('0x3f')](_0x37cd5d[_0xb367('0x34')],_0x3d6dd2[_0xb367('0x36')]),_0x2ab8b0);if(_0x37cd5d['query'][_0xb367('0x40')]){_0x41840a[_0xb367('0x3e')]=_['merge'](_0x41840a['where'],{'$or':_[_0xb367('0x2e')](_0x2ab8b0,function(_0xe21236){if(_0xe21236[_0xb367('0x31')]!==_0xb367('0x41')){var _0x57e750={};_0x57e750[_0xe21236[_0xb367('0x2b')]]={'$like':'%'+_0x37cd5d['query'][_0xb367('0x40')]+'%'};return _0x57e750;}})});}_0x41840a=_[_0xb367('0x42')]({},_0x41840a,_0x37cd5d[_0xb367('0x43')]);var _0x3f64d5={'where':_0x41840a[_0xb367('0x3e')]};return db[_0xb367('0x2f')][_0xb367('0x1e')](_0x3f64d5)[_0xb367('0x26')](function(_0x508da7){_0x199407['count']=_0x508da7;if(_0x37cd5d[_0xb367('0x34')]['includeAll']){_0x41840a['include']=[{'all':!![]}];}return db[_0xb367('0x2f')][_0xb367('0x44')](_0x41840a);})[_0xb367('0x26')](function(_0x213e32){_0x199407['rows']=_0x213e32;return _0x199407;})['then'](respondWithFilteredResult(_0x3cf8bd,_0x41840a))[_0xb367('0x45')](handleError(_0x3cf8bd,null));};exports['show']=function(_0x4fb92b,_0x2d3559){var _0x143965={'raw':![],'where':{'id':_0x4fb92b[_0xb367('0x46')]['id']}},_0x13337a={};_0x13337a[_0xb367('0x33')]=_[_0xb367('0x35')](db[_0xb367('0x2f')][_0xb367('0x47')]);_0x13337a[_0xb367('0x34')]=_[_0xb367('0x35')](_0x4fb92b[_0xb367('0x34')]);_0x13337a[_0xb367('0x36')]=_[_0xb367('0x37')](_0x13337a['model'],_0x13337a[_0xb367('0x34')]);_0x143965[_0xb367('0x38')]=_[_0xb367('0x37')](_0x13337a[_0xb367('0x33')],qs['fields'](_0x4fb92b[_0xb367('0x34')]['fields']));_0x143965['attributes']=_0x143965[_0xb367('0x38')]['length']?_0x143965[_0xb367('0x38')]:_0x13337a[_0xb367('0x33')];if(_0x4fb92b[_0xb367('0x34')][_0xb367('0x48')]){_0x143965[_0xb367('0x49')]=[{'all':!![]}];}_0x143965=_[_0xb367('0x42')]({},_0x143965,_0x4fb92b[_0xb367('0x43')]);return db[_0xb367('0x2f')][_0xb367('0x4a')](_0x143965)[_0xb367('0x26')](handleEntityNotFound(_0x2d3559,null))['then'](respondWithResult(_0x2d3559,null))['catch'](handleError(_0x2d3559,null));};exports[_0xb367('0x4b')]=function(_0x28fbfe,_0x3ac7bb){return db['JscriptyProject'][_0xb367('0x4b')](_0x28fbfe[_0xb367('0x4c')],{})[_0xb367('0x26')](function(_0x554c25){var _0x292525=_0x28fbfe['user'][_0xb367('0x28')]({'plain':!![]});if(!_0x292525)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x292525[_0xb367('0x4d')]===_0xb367('0x4e')){var _0x94f197=_0x554c25[_0xb367('0x28')]({'plain':!![]});var _0x11ec12='Projects';return db['UserProfileSection'][_0xb367('0x4a')]({'where':{'name':_0x11ec12,'userProfileId':_0x292525[_0xb367('0x4f')]},'raw':!![]})[_0xb367('0x26')](function(_0x3a78e5){if(_0x3a78e5&&_0x3a78e5[_0xb367('0x50')]===0x0){return db[_0xb367('0x29')][_0xb367('0x4b')]({'name':_0x94f197[_0xb367('0x2b')],'resourceId':_0x94f197['id'],'type':_0x3a78e5['name'],'sectionId':_0x3a78e5['id']},{})[_0xb367('0x26')](function(){return _0x554c25;});}else{return _0x554c25;}})[_0xb367('0x45')](function(_0x2388f6){logger[_0xb367('0x51')](_0xb367('0x52'),_0x2388f6);throw _0x2388f6;});}return _0x554c25;})[_0xb367('0x26')](respondWithResult(_0x3ac7bb,0xc9))[_0xb367('0x45')](handleError(_0x3ac7bb,null));};exports['clone']=function(_0x3df1ab,_0x49e029){var _0x180892={'where':{'id':_0x3df1ab[_0xb367('0x46')]['id']}},_0x5ef5e9={};_0x5ef5e9[_0xb367('0x33')]=_[_0xb367('0x35')](db['JscriptyProject'][_0xb367('0x47')]);_0x180892['attributes']=_[_0xb367('0x37')](_0x5ef5e9[_0xb367('0x33')],qs['fields'](_0x3df1ab['query'][_0xb367('0x39')]));_0x180892[_0xb367('0x38')]=_0x180892[_0xb367('0x38')]['length']?_0x180892['attributes']:_0x5ef5e9[_0xb367('0x33')];if(_0x3df1ab['query'][_0xb367('0x48')]){_0x180892[_0xb367('0x49')]=[{'all':!![]}];}_0x180892=_[_0xb367('0x42')]({},_0x180892,_0x3df1ab[_0xb367('0x43')]);return db[_0xb367('0x2f')]['find'](_0x180892)[_0xb367('0x26')](handleEntityNotFound(_0x49e029,null))[_0xb367('0x26')](function(_0x3db08d){if(_0x3db08d){var _0x446bba=_0x3db08d['get']({'plain':!![]});_0x446bba=qs[_0xb367('0x53')](_0x446bba,['id',_0xb367('0x54'),_0xb367('0x55')]);_0x3df1ab[_0xb367('0x4c')]=_[_0xb367('0x53')](_0x3df1ab[_0xb367('0x4c')],['id',_0xb367('0x54'),_0xb367('0x55')]);return db[_0xb367('0x2f')][_0xb367('0x4b')](_[_0xb367('0x42')](_0x446bba,_0x3df1ab[_0xb367('0x4c')]),{'include':_0x3df1ab[_0xb367('0x34')][_0xb367('0x48')]?[{'all':!![]}]:undefined})[_0xb367('0x26')](function(_0x30616a){var _0x255ca0=_0x3df1ab[_0xb367('0x4e')]['get']({'plain':!![]});if(!_0x255ca0)throw new Error(_0xb367('0x56'));if(_0x255ca0[_0xb367('0x4d')]==='user'){var _0x17f3af=_0x30616a[_0xb367('0x28')]({'plain':!![]});var _0xcf6f81=_0xb367('0x57');return db[_0xb367('0x58')]['find']({'where':{'name':_0xcf6f81,'userProfileId':_0x255ca0[_0xb367('0x4f')]},'raw':!![]})['then'](function(_0x27eade){if(_0x27eade&&_0x27eade[_0xb367('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x17f3af[_0xb367('0x2b')],'resourceId':_0x17f3af['id'],'type':_0x27eade[_0xb367('0x2b')],'sectionId':_0x27eade['id']},{})['then'](function(){return _0x30616a;});}else{return _0x30616a;}})['catch'](function(_0x5b0744){logger[_0xb367('0x51')](_0xb367('0x52'),_0x5b0744);throw _0x5b0744;});}return _0x30616a;});}})[_0xb367('0x26')](respondWithResult(_0x49e029,0xc9))[_0xb367('0x45')](handleError(_0x49e029,null));};exports[_0xb367('0x25')]=function(_0x5c1523,_0x1fb446){if(_0x5c1523[_0xb367('0x4c')]['id']){delete _0x5c1523[_0xb367('0x4c')]['id'];}return db[_0xb367('0x2f')][_0xb367('0x4a')]({'where':{'id':_0x5c1523[_0xb367('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fb446,null))[_0xb367('0x26')](saveUpdates(_0x5c1523[_0xb367('0x4c')],null))[_0xb367('0x26')](respondWithResult(_0x1fb446,null))[_0xb367('0x45')](handleError(_0x1fb446,null));};exports[_0xb367('0x27')]=function(_0x2529f2,_0x25a2de){return db[_0xb367('0x2f')][_0xb367('0x4a')]({'where':{'id':_0x2529f2['params']['id']}})[_0xb367('0x26')](handleEntityNotFound(_0x25a2de,null))[_0xb367('0x26')](removeEntity(_0x25a2de,null))[_0xb367('0x45')](handleError(_0x25a2de,null));};exports[_0xb367('0x59')]=function(_0x5a442d,_0x2c2337,_0x208ffa){var _0x4facc9={'raw':!![],'where':{}};var _0x157983={};var _0x159ad9={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb367('0x5a')]({'where':{'id':_0x5a442d[_0xb367('0x46')]['id']}})[_0xb367('0x26')](handleEntityNotFound(_0x2c2337,null))['then'](function(_0x524b9c){if(_0x524b9c){_0x157983['model']=_['keys'](db[_0xb367('0x5b')][_0xb367('0x47')]);_0x157983[_0xb367('0x34')]=_['keys'](_0x5a442d[_0xb367('0x34')]);_0x157983[_0xb367('0x36')]=_['intersection'](_0x157983['model'],_0x157983[_0xb367('0x34')]);_0x4facc9[_0xb367('0x38')]=_[_0xb367('0x37')](_0x157983[_0xb367('0x33')],qs[_0xb367('0x39')](_0x5a442d['query'][_0xb367('0x39')]));_0x4facc9[_0xb367('0x38')]=_0x4facc9[_0xb367('0x38')][_0xb367('0x3a')]?_0x4facc9[_0xb367('0x38')]:_0x157983['model'];if(!_0x5a442d[_0xb367('0x34')][_0xb367('0x3b')](_0xb367('0x5c'))){_0x4facc9[_0xb367('0x20')]=qs[_0xb367('0x20')](_0x5a442d[_0xb367('0x34')]['limit']);_0x4facc9['offset']=qs[_0xb367('0x1f')](_0x5a442d[_0xb367('0x34')][_0xb367('0x1f')]);}_0x4facc9[_0xb367('0x3c')]=qs[_0xb367('0x3d')](_0x5a442d['query'][_0xb367('0x3d')]);_0x4facc9[_0xb367('0x3e')]=qs[_0xb367('0x36')](_[_0xb367('0x3f')](_0x5a442d['query'],_0x157983['filters']));_0x4facc9[_0xb367('0x3e')][_0xb367('0x5d')]=_0x524b9c['id'];if(_0x5a442d[_0xb367('0x34')]['filter']){_0x4facc9[_0xb367('0x3e')]=_[_0xb367('0x42')](_0x4facc9[_0xb367('0x3e')],{'$or':_[_0xb367('0x2e')](_0x4facc9['attributes'],function(_0x1edc42){var _0x575fa2={};_0x575fa2[_0x1edc42]={'$like':'%'+_0x5a442d['query']['filter']+'%'};return _0x575fa2;})});}_0x4facc9=_['merge']({},_0x4facc9,_0x5a442d[_0xb367('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x4facc9[_0xb367('0x3e')]})[_0xb367('0x26')](function(_0x47aa66){_0x159ad9[_0xb367('0x1e')]=_0x47aa66;if(_0x5a442d['query'][_0xb367('0x48')]){_0x4facc9[_0xb367('0x49')]=[{'all':!![]}];}return db[_0xb367('0x5b')][_0xb367('0x44')](_0x4facc9);})[_0xb367('0x26')](function(_0x530a32){_0x159ad9[_0xb367('0x5e')]=_0x530a32;return _0x159ad9;});}})[_0xb367('0x26')](respondWithFilteredResult(_0x2c2337,_0x4facc9))[_0xb367('0x45')](handleError(_0x2c2337,null));};exports[_0xb367('0x5f')]=function(_0x5a0d0b,_0x2f4abc,_0x34e733){var _0x57cdc9={'raw':!![],'where':{}};var _0x4b2fea={};var _0x3912e2={'count':0x0,'rows':[]};return db[_0xb367('0x2f')][_0xb367('0x5a')]({'where':{'id':_0x5a0d0b[_0xb367('0x46')]['id']}})[_0xb367('0x26')](handleEntityNotFound(_0x2f4abc,null))[_0xb367('0x26')](function(_0x5e0e49){if(_0x5e0e49){_0x4b2fea[_0xb367('0x33')]=_[_0xb367('0x35')](db['JscriptyAnswerReport']['rawAttributes']);_0x4b2fea[_0xb367('0x34')]=_[_0xb367('0x35')](_0x5a0d0b[_0xb367('0x34')]);_0x4b2fea[_0xb367('0x36')]=_[_0xb367('0x37')](_0x4b2fea[_0xb367('0x33')],_0x4b2fea[_0xb367('0x34')]);_0x57cdc9[_0xb367('0x38')]=_[_0xb367('0x37')](_0x4b2fea['model'],qs[_0xb367('0x39')](_0x5a0d0b[_0xb367('0x34')]['fields']));_0x57cdc9[_0xb367('0x38')]=_0x57cdc9[_0xb367('0x38')][_0xb367('0x3a')]?_0x57cdc9[_0xb367('0x38')]:_0x4b2fea[_0xb367('0x33')];if(!_0x5a0d0b[_0xb367('0x34')]['hasOwnProperty'](_0xb367('0x5c'))){_0x57cdc9[_0xb367('0x20')]=qs['limit'](_0x5a0d0b[_0xb367('0x34')]['limit']);_0x57cdc9[_0xb367('0x1f')]=qs[_0xb367('0x1f')](_0x5a0d0b[_0xb367('0x34')]['offset']);}_0x57cdc9[_0xb367('0x3c')]=qs['sort'](_0x5a0d0b[_0xb367('0x34')][_0xb367('0x3d')]);_0x57cdc9[_0xb367('0x3e')]=qs[_0xb367('0x36')](_['pick'](_0x5a0d0b[_0xb367('0x34')],_0x4b2fea[_0xb367('0x36')]));_0x57cdc9[_0xb367('0x3e')][_0xb367('0x5d')]=_0x5e0e49['id'];if(_0x5a0d0b[_0xb367('0x34')][_0xb367('0x40')]){_0x57cdc9[_0xb367('0x3e')]=_[_0xb367('0x42')](_0x57cdc9[_0xb367('0x3e')],{'$or':_[_0xb367('0x2e')](_0x57cdc9['attributes'],function(_0x201030){var _0x534b12={};_0x534b12[_0x201030]={'$like':'%'+_0x5a0d0b[_0xb367('0x34')][_0xb367('0x40')]+'%'};return _0x534b12;})});}_0x57cdc9=_[_0xb367('0x42')]({},_0x57cdc9,_0x5a0d0b['options']);return db[_0xb367('0x60')][_0xb367('0x1e')]({'where':_0x57cdc9[_0xb367('0x3e')]})[_0xb367('0x26')](function(_0x28a3ab){_0x3912e2[_0xb367('0x1e')]=_0x28a3ab;if(_0x5a0d0b[_0xb367('0x34')][_0xb367('0x48')]){_0x57cdc9['include']=[{'all':!![]}];}return db[_0xb367('0x60')]['findAll'](_0x57cdc9);})['then'](function(_0x4b5a0e){_0x3912e2[_0xb367('0x5e')]=_0x4b5a0e;return _0x3912e2;});}})[_0xb367('0x26')](respondWithFilteredResult(_0x2f4abc,_0x57cdc9))['catch'](handleError(_0x2f4abc,null));};function char(_0x3a6fad){return'number'===typeof _0x3a6fad?String[_0xb367('0x61')]['apply'](null,arguments):_0x3a6fad;}function needsEncapsulation(_0x319cda){return!!_0x319cda&&(_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0xd))>=0x0||_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0xa))>=0x0||_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0x2c))>=0x0||_0x319cda[_0xb367('0x62')]()[_0xb367('0x63')](char(0x22))>=0x0);}function encapsulate(_0x56f34a){var _0x3e4b06=char(0x22),_0xdfcd70='\x5c'+char(0x22),_0x299cde=_0x56f34a[_0xb367('0x62')]()[_0xb367('0x64')](new RegExp(_0x3e4b06,'g'),_0xdfcd70);return _0x3e4b06+_0x299cde+_0x3e4b06;}exports[_0xb367('0x65')]=function(_0x225947,_0x5b8744,_0xe642ea){var _0x259eb8,_0x2a4671;var _0x5ba328={'where':{'ProjectId':_0x225947[_0xb367('0x46')]['id']}};if(_0x225947['query'][_0xb367('0x66')]){_0x5ba328[_0xb367('0x3e')]['starttime']=JSON[_0xb367('0x67')](_0x225947['query'][_0xb367('0x66')]);}return db[_0xb367('0x5b')][_0xb367('0x44')](_0x5ba328)[_0xb367('0x26')](handleEntityNotFound(_0x5b8744,null))[_0xb367('0x26')](function(_0x1a351e){if(_0x1a351e){_0x259eb8=_0x1a351e;return db[_0xb367('0x68')][_0xb367('0x44')]({'where':{'SessionId':{'$in':_[_0xb367('0x2e')](_0x259eb8,'id')},'ProjectId':_0x225947[_0xb367('0x46')]['id']},'order':_0xb367('0x69')});}})[_0xb367('0x26')](handleEntityNotFound(_0x5b8744,null))['then'](function(_0x236562){if(_0x236562){_0x2a4671=_0x236562;var _0x229f97={};for(var _0x28f859=0x0,_0x336a57=_0x2a4671['length'];_0x28f859<_0x336a57;_0x28f859++){if(!_0x229f97[_0xb367('0x3b')](_0x2a4671[_0x28f859]['questionId'])){_0x229f97[_0x2a4671[_0x28f859][_0xb367('0x6a')]]=needsEncapsulation(_0x2a4671[_0x28f859][_0xb367('0x6b')])?encapsulate(_0x2a4671[_0x28f859]['question']):_0x2a4671[_0x28f859][_0xb367('0x6b')];}}var _0x658f4a=[],_0x4b6e45={};for(var _0x5cfb43=0x0,_0x13bc09=_0x259eb8['length'];_0x5cfb43<_0x13bc09;_0x5cfb43++){_0x4b6e45={'ProjectId':_0x225947[_0xb367('0x46')]['id'],'SessionId':_0x259eb8[_0x5cfb43]['id'],'StartTime':moment(_0x259eb8[_0x5cfb43][_0xb367('0x6c')])['format'](_0xb367('0x6d'))};for(var _0x2a41df=0x0,_0x6ade34=_0x2a4671[_0xb367('0x3a')];_0x2a41df<_0x6ade34;_0x2a41df++){if(_0x2a4671[_0x2a41df][_0xb367('0x6e')]==_0x259eb8[_0x5cfb43]['id']&&_0x229f97[_0xb367('0x3b')](_0x2a4671[_0x2a41df][_0xb367('0x6a')])){_0x4b6e45[_0x229f97[_0x2a4671[_0x2a41df]['questionId']]]=_0x2a4671[_0x2a41df][_0xb367('0x6f')];}}for(var _0x45e9a2 in _0x229f97){if(!_0x4b6e45[_0xb367('0x3b')](_0x229f97[_0x45e9a2])){_0x4b6e45[_0x229f97[_0x45e9a2]]=null;}}_0x658f4a[_0xb367('0x70')](_0x4b6e45);}return _0x658f4a;}})[_0xb367('0x26')](function(_0x3ad1f2){if(!_[_0xb367('0x71')](_0x3ad1f2)){var _0x400f56=toCsv(_0x3ad1f2);var _0x3269ae=Date[_0xb367('0x72')]();fs[_0xb367('0x73')](util[_0xb367('0x74')](_0xb367('0x75'),_0x225947[_0xb367('0x46')]['id'],_0x3269ae),_0x400f56);_0x5b8744[_0xb367('0x76')]('Content-disposition','attachment;\x20filename='+util[_0xb367('0x74')](_0xb367('0x77'),_0x225947[_0xb367('0x46')]['id'],_0x3269ae));_0x5b8744[_0xb367('0x76')](_0xb367('0x78'),_0xb367('0x79'));return _0x5b8744['download'](util[_0xb367('0x74')](_0xb367('0x75'),_0x225947[_0xb367('0x46')]['id'],_0x3269ae));}else{return _0x5b8744[_0xb367('0x1a')](0xcc);}})[_0xb367('0x45')](handleError(_0x5b8744,null));}; \ No newline at end of file +var _0xb870=['apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','JscriptyProject','findAll','rows','show','includeAll','options','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','rawAttributes','nolimit','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb870,0xd0));var _0x0b87=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb870[_0x413feb];return _0x40ee88;};'use strict';var pdf=require(_0x0b87('0x0'));var emlformat=require(_0x0b87('0x1'));var rimraf=require(_0x0b87('0x2'));var zipdir=require(_0x0b87('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b87('0x4'));var BPromise=require(_0x0b87('0x5'));var Mustache=require('mustache');var util=require(_0x0b87('0x6'));var path=require(_0x0b87('0x7'));var sox=require(_0x0b87('0x8'));var csv=require(_0x0b87('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0b87('0xa'));var crypto=require(_0x0b87('0xb'));var jsforce=require(_0x0b87('0xc'));var deskjs=require(_0x0b87('0xd'));var toCsv=require(_0x0b87('0x9'));var querystring=require('querystring');var Papa=require(_0x0b87('0xe'));var Redis=require('ioredis');var authService=require(_0x0b87('0xf'));var qs=require(_0x0b87('0x10'));var as=require(_0x0b87('0x11'));var hardwareService=require(_0x0b87('0x12'));var logger=require('../../config/logger')(_0x0b87('0x13'));var utils=require(_0x0b87('0x14'));var config=require(_0x0b87('0x15'));var db=require(_0x0b87('0x16'))['db'];function respondWithStatusCode(_0x6d88a4,_0x47c228){_0x47c228=_0x47c228||0xcc;return function(_0x2880c0){if(_0x2880c0){return _0x6d88a4[_0x0b87('0x17')](_0x47c228);}return _0x6d88a4[_0x0b87('0x18')](_0x47c228)[_0x0b87('0x19')]();};}function respondWithResult(_0x13999c,_0x4e6483){_0x4e6483=_0x4e6483||0xc8;return function(_0x5d7899){if(_0x5d7899){return _0x13999c['status'](_0x4e6483)[_0x0b87('0x1a')](_0x5d7899);}};}function respondWithFilteredResult(_0x4566cd,_0x1dc6e2){return function(_0x43f51a){if(_0x43f51a){var _0x396ff3=_0x43f51a[_0x0b87('0x1b')],_0x4cb589=_0x1dc6e2[_0x0b87('0x1c')],_0x3027f3=_0x1dc6e2[_0x0b87('0x1c')]+_0x1dc6e2[_0x0b87('0x1d')],_0x2009c4;if(_0x3027f3>=_0x396ff3){_0x3027f3=_0x396ff3;_0x2009c4=0xc8;}else{_0x2009c4=0xce;}_0x4566cd['status'](_0x2009c4);return _0x4566cd[_0x0b87('0x1e')](_0x0b87('0x1f'),_0x4cb589+'-'+_0x3027f3+'/'+_0x396ff3)[_0x0b87('0x1a')](_0x43f51a);}return null;};}function patchUpdates(_0x5e16b5){return function(_0x2f3405){try{jsonpatch[_0x0b87('0x20')](_0x2f3405,_0x5e16b5,!![]);}catch(_0x35add9){return BPromise[_0x0b87('0x21')](_0x35add9);}return _0x2f3405[_0x0b87('0x22')]();};}function saveUpdates(_0x2e34ca,_0x164732){return function(_0xfd38a5){if(_0xfd38a5){return _0xfd38a5[_0x0b87('0x23')](_0x2e34ca)['then'](function(_0x25f9b6){return _0x25f9b6;});}return null;};}function removeEntity(_0x20ae82,_0x27122d){return function(_0x32642a){if(_0x32642a){return _0x32642a[_0x0b87('0x24')]()[_0x0b87('0x25')](function(){var _0x5bc401=_0x32642a[_0x0b87('0x26')]({'plain':!![]});var _0x21476b=_0x0b87('0x27');return db[_0x0b87('0x28')][_0x0b87('0x24')]({'where':{'type':_0x21476b,'resourceId':_0x5bc401['id']}})['then'](function(){return _0x32642a;});})[_0x0b87('0x25')](function(){_0x20ae82[_0x0b87('0x18')](0xcc)[_0x0b87('0x19')]();});}};}function handleEntityNotFound(_0x167baf,_0x14144b){return function(_0x495c3e){if(!_0x495c3e){_0x167baf['sendStatus'](0x194);}return _0x495c3e;};}function handleError(_0x58184e,_0x38fd67){_0x38fd67=_0x38fd67||0x1f4;return function(_0x59d087){logger[_0x0b87('0x29')](_0x59d087[_0x0b87('0x2a')]);if(_0x59d087['name']){delete _0x59d087['name'];}_0x58184e[_0x0b87('0x18')](_0x38fd67)[_0x0b87('0x2b')](_0x59d087);};}exports[_0x0b87('0x2c')]=function(_0x2a596,_0x22e165){var _0x80827f={},_0x3c659f={},_0x4481de={'count':0x0,'rows':[]};var _0x35efad=_[_0x0b87('0x2d')](db['JscriptyProject']['rawAttributes'],function(_0x59d836){return{'name':_0x59d836[_0x0b87('0x2e')],'type':_0x59d836[_0x0b87('0x2f')][_0x0b87('0x30')]};});_0x3c659f[_0x0b87('0x31')]=_[_0x0b87('0x2d')](_0x35efad,_0x0b87('0x32'));_0x3c659f[_0x0b87('0x33')]=_[_0x0b87('0x34')](_0x2a596['query']);_0x3c659f[_0x0b87('0x35')]=_[_0x0b87('0x36')](_0x3c659f['model'],_0x3c659f[_0x0b87('0x33')]);_0x80827f['attributes']=_[_0x0b87('0x36')](_0x3c659f[_0x0b87('0x31')],qs['fields'](_0x2a596[_0x0b87('0x33')][_0x0b87('0x37')]));_0x80827f[_0x0b87('0x38')]=_0x80827f[_0x0b87('0x38')][_0x0b87('0x39')]?_0x80827f[_0x0b87('0x38')]:_0x3c659f[_0x0b87('0x31')];if(!_0x2a596[_0x0b87('0x33')][_0x0b87('0x3a')]('nolimit')){_0x80827f['limit']=qs[_0x0b87('0x1d')](_0x2a596[_0x0b87('0x33')][_0x0b87('0x1d')]);_0x80827f['offset']=qs[_0x0b87('0x1c')](_0x2a596['query'][_0x0b87('0x1c')]);}_0x80827f[_0x0b87('0x3b')]=qs[_0x0b87('0x3c')](_0x2a596[_0x0b87('0x33')][_0x0b87('0x3c')]);_0x80827f[_0x0b87('0x3d')]=qs['filters'](_[_0x0b87('0x3e')](_0x2a596[_0x0b87('0x33')],_0x3c659f['filters']),_0x35efad);if(_0x2a596[_0x0b87('0x33')][_0x0b87('0x3f')]){_0x80827f[_0x0b87('0x3d')]=_[_0x0b87('0x40')](_0x80827f['where'],{'$or':_[_0x0b87('0x2d')](_0x35efad,function(_0x5c6363){if(_0x5c6363['type']!==_0x0b87('0x41')){var _0x3c41a2={};_0x3c41a2[_0x5c6363[_0x0b87('0x32')]]={'$like':'%'+_0x2a596[_0x0b87('0x33')][_0x0b87('0x3f')]+'%'};return _0x3c41a2;}})});}_0x80827f=_[_0x0b87('0x40')]({},_0x80827f,_0x2a596['options']);var _0x45e6e1={'where':_0x80827f[_0x0b87('0x3d')]};return db['JscriptyProject'][_0x0b87('0x1b')](_0x45e6e1)[_0x0b87('0x25')](function(_0x2841a2){_0x4481de[_0x0b87('0x1b')]=_0x2841a2;if(_0x2a596['query']['includeAll']){_0x80827f[_0x0b87('0x42')]=[{'all':!![]}];}return db[_0x0b87('0x43')][_0x0b87('0x44')](_0x80827f);})[_0x0b87('0x25')](function(_0x49b27c){_0x4481de[_0x0b87('0x45')]=_0x49b27c;return _0x4481de;})[_0x0b87('0x25')](respondWithFilteredResult(_0x22e165,_0x80827f))['catch'](handleError(_0x22e165,null));};exports[_0x0b87('0x46')]=function(_0x5dfe96,_0x1f2662){var _0x19e586={'raw':![],'where':{'id':_0x5dfe96['params']['id']}},_0x4a4082={};_0x4a4082[_0x0b87('0x31')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x4a4082[_0x0b87('0x33')]=_[_0x0b87('0x34')](_0x5dfe96[_0x0b87('0x33')]);_0x4a4082['filters']=_[_0x0b87('0x36')](_0x4a4082[_0x0b87('0x31')],_0x4a4082['query']);_0x19e586[_0x0b87('0x38')]=_[_0x0b87('0x36')](_0x4a4082[_0x0b87('0x31')],qs['fields'](_0x5dfe96[_0x0b87('0x33')]['fields']));_0x19e586[_0x0b87('0x38')]=_0x19e586[_0x0b87('0x38')]['length']?_0x19e586[_0x0b87('0x38')]:_0x4a4082[_0x0b87('0x31')];if(_0x5dfe96[_0x0b87('0x33')][_0x0b87('0x47')]){_0x19e586[_0x0b87('0x42')]=[{'all':!![]}];}_0x19e586=_[_0x0b87('0x40')]({},_0x19e586,_0x5dfe96[_0x0b87('0x48')]);return db[_0x0b87('0x43')][_0x0b87('0x49')](_0x19e586)[_0x0b87('0x25')](handleEntityNotFound(_0x1f2662,null))[_0x0b87('0x25')](respondWithResult(_0x1f2662,null))[_0x0b87('0x4a')](handleError(_0x1f2662,null));};exports['create']=function(_0x555ad5,_0x429e8a){return db[_0x0b87('0x43')][_0x0b87('0x4b')](_0x555ad5[_0x0b87('0x4c')],{})[_0x0b87('0x25')](function(_0x480f6a){var _0x57dc32=_0x555ad5[_0x0b87('0x4d')][_0x0b87('0x26')]({'plain':!![]});if(!_0x57dc32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57dc32['role']===_0x0b87('0x4d')){var _0x2066d9=_0x480f6a[_0x0b87('0x26')]({'plain':!![]});var _0xf4907a=_0x0b87('0x27');return db[_0x0b87('0x4e')][_0x0b87('0x49')]({'where':{'name':_0xf4907a,'userProfileId':_0x57dc32[_0x0b87('0x4f')]},'raw':!![]})['then'](function(_0x4c51b6){if(_0x4c51b6&&_0x4c51b6[_0x0b87('0x50')]===0x0){return db[_0x0b87('0x28')][_0x0b87('0x4b')]({'name':_0x2066d9[_0x0b87('0x32')],'resourceId':_0x2066d9['id'],'type':_0x4c51b6[_0x0b87('0x32')],'sectionId':_0x4c51b6['id']},{})['then'](function(){return _0x480f6a;});}else{return _0x480f6a;}})[_0x0b87('0x4a')](function(_0x4e0865){logger[_0x0b87('0x29')](_0x0b87('0x51'),_0x4e0865);throw _0x4e0865;});}return _0x480f6a;})[_0x0b87('0x25')](respondWithResult(_0x429e8a,0xc9))[_0x0b87('0x4a')](handleError(_0x429e8a,null));};exports[_0x0b87('0x52')]=function(_0x462e29,_0x5c544d){var _0xaed888={'where':{'id':_0x462e29[_0x0b87('0x53')]['id']}},_0x1cbe36={};_0x1cbe36[_0x0b87('0x31')]=_['keys'](db[_0x0b87('0x43')]['rawAttributes']);_0xaed888[_0x0b87('0x38')]=_[_0x0b87('0x36')](_0x1cbe36['model'],qs[_0x0b87('0x37')](_0x462e29[_0x0b87('0x33')][_0x0b87('0x37')]));_0xaed888['attributes']=_0xaed888[_0x0b87('0x38')][_0x0b87('0x39')]?_0xaed888[_0x0b87('0x38')]:_0x1cbe36[_0x0b87('0x31')];if(_0x462e29['query'][_0x0b87('0x47')]){_0xaed888['include']=[{'all':!![]}];}_0xaed888=_[_0x0b87('0x40')]({},_0xaed888,_0x462e29[_0x0b87('0x48')]);return db[_0x0b87('0x43')][_0x0b87('0x49')](_0xaed888)[_0x0b87('0x25')](handleEntityNotFound(_0x5c544d,null))[_0x0b87('0x25')](function(_0x4192f6){if(_0x4192f6){var _0x3b7815=_0x4192f6[_0x0b87('0x26')]({'plain':!![]});_0x3b7815=qs[_0x0b87('0x54')](_0x3b7815,['id',_0x0b87('0x55'),_0x0b87('0x56')]);_0x462e29[_0x0b87('0x4c')]=_[_0x0b87('0x54')](_0x462e29[_0x0b87('0x4c')],['id',_0x0b87('0x55'),_0x0b87('0x56')]);return db[_0x0b87('0x43')]['create'](_['merge'](_0x3b7815,_0x462e29[_0x0b87('0x4c')]),{'include':_0x462e29['query'][_0x0b87('0x47')]?[{'all':!![]}]:undefined})[_0x0b87('0x25')](function(_0x4dd122){var _0x5c3ad4=_0x462e29[_0x0b87('0x4d')][_0x0b87('0x26')]({'plain':!![]});if(!_0x5c3ad4)throw new Error(_0x0b87('0x57'));if(_0x5c3ad4['role']===_0x0b87('0x4d')){var _0x13cc31=_0x4dd122[_0x0b87('0x26')]({'plain':!![]});var _0x34acfd=_0x0b87('0x27');return db[_0x0b87('0x4e')]['find']({'where':{'name':_0x34acfd,'userProfileId':_0x5c3ad4[_0x0b87('0x4f')]},'raw':!![]})[_0x0b87('0x25')](function(_0xd8e7a8){if(_0xd8e7a8&&_0xd8e7a8[_0x0b87('0x50')]===0x0){return db[_0x0b87('0x28')][_0x0b87('0x4b')]({'name':_0x13cc31[_0x0b87('0x32')],'resourceId':_0x13cc31['id'],'type':_0xd8e7a8[_0x0b87('0x32')],'sectionId':_0xd8e7a8['id']},{})[_0x0b87('0x25')](function(){return _0x4dd122;});}else{return _0x4dd122;}})[_0x0b87('0x4a')](function(_0x1f5fc4){logger[_0x0b87('0x29')](_0x0b87('0x51'),_0x1f5fc4);throw _0x1f5fc4;});}return _0x4dd122;});}})[_0x0b87('0x25')](respondWithResult(_0x5c544d,0xc9))[_0x0b87('0x4a')](handleError(_0x5c544d,null));};exports[_0x0b87('0x23')]=function(_0x2d3916,_0x2714ac){if(_0x2d3916[_0x0b87('0x4c')]['id']){delete _0x2d3916[_0x0b87('0x4c')]['id'];}return db[_0x0b87('0x43')][_0x0b87('0x49')]({'where':{'id':_0x2d3916[_0x0b87('0x53')]['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x2714ac,null))[_0x0b87('0x25')](saveUpdates(_0x2d3916[_0x0b87('0x4c')],null))[_0x0b87('0x25')](respondWithResult(_0x2714ac,null))[_0x0b87('0x4a')](handleError(_0x2714ac,null));};exports[_0x0b87('0x24')]=function(_0x5b52e6,_0x4defcb){return db['JscriptyProject'][_0x0b87('0x49')]({'where':{'id':_0x5b52e6[_0x0b87('0x53')]['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x4defcb,null))[_0x0b87('0x25')](removeEntity(_0x4defcb,null))['catch'](handleError(_0x4defcb,null));};exports[_0x0b87('0x58')]=function(_0x30e670,_0x43fe5f,_0x307fb0){var _0x3f30d9={'raw':!![],'where':{}};var _0x4e8c28={};var _0x3058f1={'count':0x0,'rows':[]};return db[_0x0b87('0x43')][_0x0b87('0x59')]({'where':{'id':_0x30e670['params']['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x43fe5f,null))[_0x0b87('0x25')](function(_0xe34f1a){if(_0xe34f1a){_0x4e8c28[_0x0b87('0x31')]=_[_0x0b87('0x34')](db['JscriptySessionReport'][_0x0b87('0x5a')]);_0x4e8c28['query']=_[_0x0b87('0x34')](_0x30e670[_0x0b87('0x33')]);_0x4e8c28[_0x0b87('0x35')]=_['intersection'](_0x4e8c28[_0x0b87('0x31')],_0x4e8c28[_0x0b87('0x33')]);_0x3f30d9[_0x0b87('0x38')]=_['intersection'](_0x4e8c28[_0x0b87('0x31')],qs[_0x0b87('0x37')](_0x30e670[_0x0b87('0x33')]['fields']));_0x3f30d9['attributes']=_0x3f30d9[_0x0b87('0x38')][_0x0b87('0x39')]?_0x3f30d9[_0x0b87('0x38')]:_0x4e8c28[_0x0b87('0x31')];if(!_0x30e670[_0x0b87('0x33')]['hasOwnProperty'](_0x0b87('0x5b'))){_0x3f30d9[_0x0b87('0x1d')]=qs[_0x0b87('0x1d')](_0x30e670[_0x0b87('0x33')][_0x0b87('0x1d')]);_0x3f30d9[_0x0b87('0x1c')]=qs['offset'](_0x30e670['query']['offset']);}_0x3f30d9[_0x0b87('0x3b')]=qs[_0x0b87('0x3c')](_0x30e670[_0x0b87('0x33')]['sort']);_0x3f30d9[_0x0b87('0x3d')]=qs[_0x0b87('0x35')](_[_0x0b87('0x3e')](_0x30e670[_0x0b87('0x33')],_0x4e8c28[_0x0b87('0x35')]));_0x3f30d9[_0x0b87('0x3d')][_0x0b87('0x5c')]=_0xe34f1a['id'];if(_0x30e670['query'][_0x0b87('0x3f')]){_0x3f30d9[_0x0b87('0x3d')]=_[_0x0b87('0x40')](_0x3f30d9[_0x0b87('0x3d')],{'$or':_[_0x0b87('0x2d')](_0x3f30d9[_0x0b87('0x38')],function(_0x15b72d){var _0x27f39f={};_0x27f39f[_0x15b72d]={'$like':'%'+_0x30e670[_0x0b87('0x33')]['filter']+'%'};return _0x27f39f;})});}_0x3f30d9=_[_0x0b87('0x40')]({},_0x3f30d9,_0x30e670[_0x0b87('0x48')]);return db[_0x0b87('0x5d')]['count']({'where':_0x3f30d9['where']})[_0x0b87('0x25')](function(_0x47fe81){_0x3058f1['count']=_0x47fe81;if(_0x30e670[_0x0b87('0x33')]['includeAll']){_0x3f30d9[_0x0b87('0x42')]=[{'all':!![]}];}return db[_0x0b87('0x5d')][_0x0b87('0x44')](_0x3f30d9);})[_0x0b87('0x25')](function(_0x2a7ca3){_0x3058f1[_0x0b87('0x45')]=_0x2a7ca3;return _0x3058f1;});}})[_0x0b87('0x25')](respondWithFilteredResult(_0x43fe5f,_0x3f30d9))[_0x0b87('0x4a')](handleError(_0x43fe5f,null));};exports[_0x0b87('0x5e')]=function(_0x44fc21,_0x33af6e,_0x62aab3){var _0x4536ec={'raw':!![],'where':{}};var _0x2e2b0f={};var _0x119bf5={'count':0x0,'rows':[]};return db[_0x0b87('0x43')]['findOne']({'where':{'id':_0x44fc21['params']['id']}})[_0x0b87('0x25')](handleEntityNotFound(_0x33af6e,null))[_0x0b87('0x25')](function(_0x2755b6){if(_0x2755b6){_0x2e2b0f[_0x0b87('0x31')]=_[_0x0b87('0x34')](db['JscriptyAnswerReport']['rawAttributes']);_0x2e2b0f[_0x0b87('0x33')]=_['keys'](_0x44fc21[_0x0b87('0x33')]);_0x2e2b0f[_0x0b87('0x35')]=_['intersection'](_0x2e2b0f[_0x0b87('0x31')],_0x2e2b0f[_0x0b87('0x33')]);_0x4536ec['attributes']=_[_0x0b87('0x36')](_0x2e2b0f['model'],qs['fields'](_0x44fc21[_0x0b87('0x33')][_0x0b87('0x37')]));_0x4536ec[_0x0b87('0x38')]=_0x4536ec[_0x0b87('0x38')]['length']?_0x4536ec[_0x0b87('0x38')]:_0x2e2b0f[_0x0b87('0x31')];if(!_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3a')](_0x0b87('0x5b'))){_0x4536ec[_0x0b87('0x1d')]=qs[_0x0b87('0x1d')](_0x44fc21[_0x0b87('0x33')][_0x0b87('0x1d')]);_0x4536ec[_0x0b87('0x1c')]=qs[_0x0b87('0x1c')](_0x44fc21[_0x0b87('0x33')]['offset']);}_0x4536ec[_0x0b87('0x3b')]=qs[_0x0b87('0x3c')](_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3c')]);_0x4536ec[_0x0b87('0x3d')]=qs[_0x0b87('0x35')](_[_0x0b87('0x3e')](_0x44fc21['query'],_0x2e2b0f[_0x0b87('0x35')]));_0x4536ec[_0x0b87('0x3d')][_0x0b87('0x5c')]=_0x2755b6['id'];if(_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3f')]){_0x4536ec[_0x0b87('0x3d')]=_[_0x0b87('0x40')](_0x4536ec[_0x0b87('0x3d')],{'$or':_[_0x0b87('0x2d')](_0x4536ec[_0x0b87('0x38')],function(_0x473014){var _0x449dc2={};_0x449dc2[_0x473014]={'$like':'%'+_0x44fc21[_0x0b87('0x33')][_0x0b87('0x3f')]+'%'};return _0x449dc2;})});}_0x4536ec=_[_0x0b87('0x40')]({},_0x4536ec,_0x44fc21['options']);return db[_0x0b87('0x5f')][_0x0b87('0x1b')]({'where':_0x4536ec[_0x0b87('0x3d')]})[_0x0b87('0x25')](function(_0x285156){_0x119bf5[_0x0b87('0x1b')]=_0x285156;if(_0x44fc21['query'][_0x0b87('0x47')]){_0x4536ec['include']=[{'all':!![]}];}return db[_0x0b87('0x5f')][_0x0b87('0x44')](_0x4536ec);})['then'](function(_0xc8d03c){_0x119bf5['rows']=_0xc8d03c;return _0x119bf5;});}})[_0x0b87('0x25')](respondWithFilteredResult(_0x33af6e,_0x4536ec))[_0x0b87('0x4a')](handleError(_0x33af6e,null));};function char(_0x155c4d){return _0x0b87('0x60')===typeof _0x155c4d?String[_0x0b87('0x61')]['apply'](null,arguments):_0x155c4d;}function needsEncapsulation(_0x1c856d){return!!_0x1c856d&&(_0x1c856d[_0x0b87('0x62')]()['indexOf'](char(0xd))>=0x0||_0x1c856d[_0x0b87('0x62')]()[_0x0b87('0x63')](char(0xa))>=0x0||_0x1c856d[_0x0b87('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x1c856d[_0x0b87('0x62')]()[_0x0b87('0x63')](char(0x22))>=0x0);}function encapsulate(_0x80f122){var _0x41ba96=char(0x22),_0x411cf0='\x5c'+char(0x22),_0x2570c7=_0x80f122['toString']()[_0x0b87('0x64')](new RegExp(_0x41ba96,'g'),_0x411cf0);return _0x41ba96+_0x2570c7+_0x41ba96;}exports[_0x0b87('0x65')]=function(_0x1b1c6b,_0x539426,_0x7e3055){var _0x48713a,_0x1eb0b3;var _0x2c7a68={'where':{'ProjectId':_0x1b1c6b[_0x0b87('0x53')]['id']}};if(_0x1b1c6b[_0x0b87('0x33')][_0x0b87('0x66')]){_0x2c7a68['where'][_0x0b87('0x67')]=JSON['parse'](_0x1b1c6b['query'][_0x0b87('0x66')]);}return db[_0x0b87('0x5d')]['findAll'](_0x2c7a68)[_0x0b87('0x25')](handleEntityNotFound(_0x539426,null))[_0x0b87('0x25')](function(_0x2f49f4){if(_0x2f49f4){_0x48713a=_0x2f49f4;return db[_0x0b87('0x68')][_0x0b87('0x44')]({'where':{'SessionId':{'$in':_[_0x0b87('0x2d')](_0x48713a,'id')},'ProjectId':_0x1b1c6b[_0x0b87('0x53')]['id']},'order':'-createdAt'});}})[_0x0b87('0x25')](handleEntityNotFound(_0x539426,null))['then'](function(_0x11244d){if(_0x11244d){_0x1eb0b3=_0x11244d;var _0x534eb8={};for(var _0x583a0e=0x0,_0x420281=_0x1eb0b3[_0x0b87('0x39')];_0x583a0e<_0x420281;_0x583a0e++){if(!_0x534eb8[_0x0b87('0x3a')](_0x1eb0b3[_0x583a0e][_0x0b87('0x69')])){_0x534eb8[_0x1eb0b3[_0x583a0e][_0x0b87('0x69')]]=needsEncapsulation(_0x1eb0b3[_0x583a0e][_0x0b87('0x6a')])?encapsulate(_0x1eb0b3[_0x583a0e][_0x0b87('0x6a')]):_0x1eb0b3[_0x583a0e][_0x0b87('0x6a')];}}var _0xf303e6=[],_0xb8335d={};for(var _0x12aeb8=0x0,_0xde7452=_0x48713a[_0x0b87('0x39')];_0x12aeb8<_0xde7452;_0x12aeb8++){_0xb8335d={'ProjectId':_0x1b1c6b[_0x0b87('0x53')]['id'],'SessionId':_0x48713a[_0x12aeb8]['id'],'StartTime':moment(_0x48713a[_0x12aeb8][_0x0b87('0x67')])[_0x0b87('0x6b')](_0x0b87('0x6c'))};for(var _0x197671=0x0,_0x3747e2=_0x1eb0b3[_0x0b87('0x39')];_0x197671<_0x3747e2;_0x197671++){if(_0x1eb0b3[_0x197671][_0x0b87('0x6d')]==_0x48713a[_0x12aeb8]['id']&&_0x534eb8['hasOwnProperty'](_0x1eb0b3[_0x197671][_0x0b87('0x69')])){_0xb8335d[_0x534eb8[_0x1eb0b3[_0x197671][_0x0b87('0x69')]]]=_0x1eb0b3[_0x197671][_0x0b87('0x6e')];}}for(var _0x4e1daa in _0x534eb8){if(!_0xb8335d['hasOwnProperty'](_0x534eb8[_0x4e1daa])){_0xb8335d[_0x534eb8[_0x4e1daa]]=null;}}_0xf303e6[_0x0b87('0x6f')](_0xb8335d);}return _0xf303e6;}})[_0x0b87('0x25')](function(_0x88df16){if(!_[_0x0b87('0x70')](_0x88df16)){var _0xb01aef=toCsv(_0x88df16);var _0x19aba8=Date['now']();fs[_0x0b87('0x71')](util[_0x0b87('0x6b')](_0x0b87('0x72'),_0x1b1c6b[_0x0b87('0x53')]['id'],_0x19aba8),_0xb01aef);_0x539426['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x0b87('0x6b')](_0x0b87('0x73'),_0x1b1c6b[_0x0b87('0x53')]['id'],_0x19aba8));_0x539426[_0x0b87('0x74')](_0x0b87('0x75'),_0x0b87('0x76'));return _0x539426[_0x0b87('0x77')](util['format'](_0x0b87('0x72'),_0x1b1c6b[_0x0b87('0x53')]['id'],_0x19aba8));}else{return _0x539426['sendStatus'](0xcc);}})[_0x0b87('0x4a')](handleError(_0x539426,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e16802a..eed6ea9 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 _0x3b61=['JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x50d5b6,_0x46c4c9){var _0x10e1df=function(_0x23e8c5){while(--_0x23e8c5){_0x50d5b6['push'](_0x50d5b6['shift']());}};_0x10e1df(++_0x46c4c9);}(_0x3b61,0x1c5));var _0x13b6=function(_0x5a1baa,_0x12e00a){_0x5a1baa=_0x5a1baa-0x0;var _0x15c41f=_0x3b61[_0x5a1baa];return _0x15c41f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x13b6('0x0'))(_0x13b6('0x1'));var moment=require(_0x13b6('0x2'));var BPromise=require(_0x13b6('0x3'));var rp=require(_0x13b6('0x4'));var fs=require('fs');var path=require(_0x13b6('0x5'));var rimraf=require('rimraf');var config=require(_0x13b6('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x13b6('0x7')]=function(_0x5e351b,_0x4246a6){return _0x5e351b[_0x13b6('0x8')](_0x13b6('0x9'),attributes,{'tableName':_0x13b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8567=['bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x5b099c,_0x3cbab2){var _0x6fc6cb=function(_0x4fa3ac){while(--_0x4fa3ac){_0x5b099c['push'](_0x5b099c['shift']());}};_0x6fc6cb(++_0x3cbab2);}(_0x8567,0x8b));var _0x7856=function(_0x1e3035,_0x26e2c7){_0x1e3035=_0x1e3035-0x0;var _0x5268da=_0x8567[_0x1e3035];return _0x5268da;};'use strict';var _=require(_0x7856('0x0'));var util=require(_0x7856('0x1'));var logger=require(_0x7856('0x2'))(_0x7856('0x3'));var moment=require(_0x7856('0x4'));var BPromise=require(_0x7856('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7856('0x6'));var rimraf=require(_0x7856('0x7'));var config=require(_0x7856('0x8'));var attributes=require(_0x7856('0x9'));module['exports']=function(_0x322a2b,_0x493f55){return _0x322a2b['define'](_0x7856('0xa'),attributes,{'tableName':_0x7856('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index f23f268..1bc6cf0 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 _0x243e=['catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','result'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x243e,0x166));var _0xe243=function(_0xbe8c88,_0x30159f){_0xbe8c88=_0xbe8c88-0x0;var _0x40a5f9=_0x243e[_0xbe8c88];return _0x40a5f9;};'use strict';var _=require(_0xe243('0x0'));var util=require(_0xe243('0x1'));var moment=require('moment');var BPromise=require(_0xe243('0x2'));var rs=require(_0xe243('0x3'));var fs=require('fs');var Redis=require(_0xe243('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe243('0x5'));var config=require(_0xe243('0x6'));var jayson=require(_0xe243('0x7'));var client=jayson['client'][_0xe243('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f18e6,_0x128c32,_0x4bdd39){return new BPromise(function(_0x280cc6,_0xd84c18){return client[_0xe243('0x9')](_0x1f18e6,_0x4bdd39)['then'](function(_0x1e071d){logger[_0xe243('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x128c32,_0xe243('0xb'));logger[_0xe243('0xc')](_0xe243('0xd'),_0x128c32,_0xe243('0xb'),JSON[_0xe243('0xe')](_0x1e071d));if(_0x1e071d['error']){if(_0x1e071d[_0xe243('0xf')][_0xe243('0x10')]===0x1f4){logger[_0xe243('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x128c32,_0x1e071d[_0xe243('0xf')]['message']);return _0xd84c18(_0x1e071d[_0xe243('0xf')]['message']);}logger[_0xe243('0xf')](_0xe243('0x11'),_0x128c32,_0x1e071d['error']['message']);return _0x280cc6(_0x1e071d[_0xe243('0xf')][_0xe243('0x12')]);}else{logger[_0xe243('0xa')](_0xe243('0x11'),_0x128c32,_0xe243('0xb'));_0x280cc6(_0x1e071d[_0xe243('0x13')]['message']);}})[_0xe243('0x14')](function(_0x5ec408){logger[_0xe243('0xf')](_0xe243('0x11'),_0x128c32,_0x5ec408);_0xd84c18(_0x5ec408);});});} \ No newline at end of file +var _0x9e57=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x9e57,0x165));var _0x79e5=function(_0x28f2cf,_0x1de725){_0x28f2cf=_0x28f2cf-0x0;var _0x2411b2=_0x9e57[_0x28f2cf];return _0x2411b2;};'use strict';var _=require(_0x79e5('0x0'));var util=require(_0x79e5('0x1'));var moment=require(_0x79e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x79e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79e5('0x4'))['db'];var utils=require(_0x79e5('0x5'));var logger=require(_0x79e5('0x6'))(_0x79e5('0x7'));var config=require(_0x79e5('0x8'));var jayson=require(_0x79e5('0x9'));var client=jayson[_0x79e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e87ee,_0x28f655,_0x54f0b0){return new BPromise(function(_0x2c497d,_0x2d7e03){return client[_0x79e5('0xb')](_0x3e87ee,_0x54f0b0)[_0x79e5('0xc')](function(_0x52b9ed){logger[_0x79e5('0xd')](_0x79e5('0xe'),_0x28f655,'request\x20sent');logger[_0x79e5('0xf')](_0x79e5('0x10'),_0x28f655,_0x79e5('0x11'),JSON[_0x79e5('0x12')](_0x52b9ed));if(_0x52b9ed[_0x79e5('0x13')]){if(_0x52b9ed[_0x79e5('0x13')][_0x79e5('0x14')]===0x1f4){logger[_0x79e5('0x13')](_0x79e5('0xe'),_0x28f655,_0x52b9ed[_0x79e5('0x13')][_0x79e5('0x15')]);return _0x2d7e03(_0x52b9ed[_0x79e5('0x13')]['message']);}logger[_0x79e5('0x13')](_0x79e5('0xe'),_0x28f655,_0x52b9ed[_0x79e5('0x13')]['message']);return _0x2c497d(_0x52b9ed[_0x79e5('0x13')][_0x79e5('0x15')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x28f655,'request\x20sent');_0x2c497d(_0x52b9ed[_0x79e5('0x16')][_0x79e5('0x15')]);}})[_0x79e5('0x17')](function(_0x4ff75b){logger[_0x79e5('0x13')](_0x79e5('0xe'),_0x28f655,_0x4ff75b);_0x2d7e03(_0x4ff75b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f6442d3..69bd71e 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 _0xb0f7=['../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4a701f,_0x3074b9){var _0x316cfc=function(_0x24f521){while(--_0x24f521){_0x4a701f['push'](_0x4a701f['shift']());}};_0x316cfc(++_0x3074b9);}(_0xb0f7,0x17c));var _0x7b0f=function(_0x40b19e,_0x51f6ec){_0x40b19e=_0x40b19e-0x0;var _0x423c2f=_0xb0f7[_0x40b19e];return _0x423c2f;};'use strict';var multer=require(_0x7b0f('0x0'));var util=require('util');var path=require(_0x7b0f('0x1'));var timeout=require(_0x7b0f('0x2'));var express=require(_0x7b0f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7b0f('0x4'));var config=require('../../config/environment');var controller=require(_0x7b0f('0x5'));router[_0x7b0f('0x6')]('/',auth[_0x7b0f('0x7')](),controller['index']);router[_0x7b0f('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x7b0f('0x8')]);router['get'](_0x7b0f('0x9'),auth['isAuthenticated'](),controller[_0x7b0f('0xa')]);router[_0x7b0f('0xb')]('/',auth[_0x7b0f('0x7')](),controller[_0x7b0f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7b0f('0xd')]);router['delete']('/:id',auth[_0x7b0f('0x7')](),controller[_0x7b0f('0xe')]);module[_0x7b0f('0xf')]=router; \ No newline at end of file +var _0x2c2a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x120404,_0x474f63){var _0x4f70d6=function(_0x54fe59){while(--_0x54fe59){_0x120404['push'](_0x120404['shift']());}};_0x4f70d6(++_0x474f63);}(_0x2c2a,0x94));var _0xa2c2=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2c2a[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xa2c2('0x0'));var util=require(_0xa2c2('0x1'));var path=require(_0xa2c2('0x2'));var timeout=require(_0xa2c2('0x3'));var express=require(_0xa2c2('0x4'));var router=express[_0xa2c2('0x5')]();var auth=require(_0xa2c2('0x6'));var interaction=require(_0xa2c2('0x7'));var config=require(_0xa2c2('0x8'));var controller=require(_0xa2c2('0x9'));router[_0xa2c2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa2c2('0xb')]);router[_0xa2c2('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa2c2('0xa')](_0xa2c2('0xc'),auth[_0xa2c2('0xd')](),controller[_0xa2c2('0xe')]);router[_0xa2c2('0xf')]('/',auth[_0xa2c2('0xd')](),controller[_0xa2c2('0x10')]);router[_0xa2c2('0x11')](_0xa2c2('0xc'),auth[_0xa2c2('0xd')](),controller[_0xa2c2('0x12')]);router[_0xa2c2('0x13')]('/:id',auth[_0xa2c2('0xd')](),controller[_0xa2c2('0x14')]);module[_0xa2c2('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ab317d0..df84e4a 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 _0x9f97=['exports','long','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f97,0x1c3));var _0x79f9=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x9f97[_0x2650e9];return _0x3511c8;};'use strict';var Sequelize=require(_0x79f9('0x0'));module[_0x79f9('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x79f9('0x2'))},'membername':{'type':Sequelize[_0x79f9('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x79f9('0x3')]},'uniqueid':{'type':Sequelize[_0x79f9('0x3')]},'calleridname':{'type':Sequelize[_0x79f9('0x3')]},'calleridnum':{'type':Sequelize[_0x79f9('0x3')]},'questionId':{'type':Sequelize[_0x79f9('0x3')]}}; \ No newline at end of file +var _0xbf5e=['STRING','sequelize','exports'];(function(_0x3087cc,_0x4ccde7){var _0x1c15ab=function(_0x50297e){while(--_0x50297e){_0x3087cc['push'](_0x3087cc['shift']());}};_0x1c15ab(++_0x4ccde7);}(_0xbf5e,0x97));var _0xebf5=function(_0xa72ac3,_0x333647){_0xa72ac3=_0xa72ac3-0x0;var _0x13a920=_0xbf5e[_0xa72ac3];return _0x13a920;};'use strict';var Sequelize=require(_0xebf5('0x0'));module[_0xebf5('0x1')]={'question':{'type':Sequelize[_0xebf5('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xebf5('0x2')]},'projectname':{'type':Sequelize[_0xebf5('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xebf5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xebf5('0x2')]},'questionId':{'type':Sequelize[_0xebf5('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index d3a970f..0c380b6 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 _0xc0d6=['json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status'];(function(_0x317ada,_0x246987){var _0x520c36=function(_0x3ade01){while(--_0x3ade01){_0x317ada['push'](_0x317ada['shift']());}};_0x520c36(++_0x246987);}(_0xc0d6,0x1da));var _0x6c0d=function(_0x5b9f2e,_0x32ebb4){_0x5b9f2e=_0x5b9f2e-0x0;var _0x4c38fa=_0xc0d6[_0x5b9f2e];return _0x4c38fa;};'use strict';var pdf=require(_0x6c0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6c0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c0d('0x2'));var rp=require('request-promise');var moment=require(_0x6c0d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c0d('0x4'));var util=require(_0x6c0d('0x5'));var path=require(_0x6c0d('0x6'));var sox=require(_0x6c0d('0x7'));var csv=require(_0x6c0d('0x8'));var ejs=require(_0x6c0d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6c0d('0xa'));var crypto=require(_0x6c0d('0xb'));var jsforce=require(_0x6c0d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6c0d('0x8'));var querystring=require('querystring');var Papa=require(_0x6c0d('0xd'));var Redis=require(_0x6c0d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c0d('0xf'));var as=require(_0x6c0d('0x10'));var hardwareService=require(_0x6c0d('0x11'));var logger=require('../../config/logger')(_0x6c0d('0x12'));var utils=require(_0x6c0d('0x13'));var config=require('../../config/environment');var db=require(_0x6c0d('0x14'))['db'];function respondWithStatusCode(_0x5c6ed8,_0xf9450e){_0xf9450e=_0xf9450e||0xcc;return function(_0x614be8){if(_0x614be8){return _0x5c6ed8['sendStatus'](_0xf9450e);}return _0x5c6ed8['status'](_0xf9450e)[_0x6c0d('0x15')]();};}function respondWithResult(_0x5146d2,_0x438d50){_0x438d50=_0x438d50||0xc8;return function(_0x43f13f){if(_0x43f13f){return _0x5146d2[_0x6c0d('0x16')](_0x438d50)[_0x6c0d('0x17')](_0x43f13f);}};}function respondWithFilteredResult(_0x269aee,_0x353cb2){return function(_0x5d20fd){if(_0x5d20fd){var _0x15c12c=_0x5d20fd[_0x6c0d('0x18')],_0x56abc7=_0x353cb2[_0x6c0d('0x19')],_0x27ae35=_0x353cb2['offset']+_0x353cb2[_0x6c0d('0x1a')],_0xbb34f2;if(_0x27ae35>=_0x15c12c){_0x27ae35=_0x15c12c;_0xbb34f2=0xc8;}else{_0xbb34f2=0xce;}_0x269aee['status'](_0xbb34f2);return _0x269aee[_0x6c0d('0x1b')](_0x6c0d('0x1c'),_0x56abc7+'-'+_0x27ae35+'/'+_0x15c12c)['json'](_0x5d20fd);}return null;};}function patchUpdates(_0x1e13e5){return function(_0x97bebb){try{jsonpatch[_0x6c0d('0x1d')](_0x97bebb,_0x1e13e5,!![]);}catch(_0x256593){return BPromise['reject'](_0x256593);}return _0x97bebb[_0x6c0d('0x1e')]();};}function saveUpdates(_0x43abd7,_0x2edce0){return function(_0x540f78){if(_0x540f78){return _0x540f78[_0x6c0d('0x1f')](_0x43abd7)[_0x6c0d('0x20')](function(_0x60ce50){return _0x60ce50;});}return null;};}function removeEntity(_0x1b1910,_0x2d625e){return function(_0x774a4e){if(_0x774a4e){return _0x774a4e[_0x6c0d('0x21')]()['then'](function(){_0x1b1910['status'](0xcc)[_0x6c0d('0x15')]();});}};}function handleEntityNotFound(_0x2c9deb,_0x4d982b){return function(_0x3ef484){if(!_0x3ef484){_0x2c9deb[_0x6c0d('0x22')](0x194);}return _0x3ef484;};}function handleError(_0x5bd6f6,_0x1e965f){_0x1e965f=_0x1e965f||0x1f4;return function(_0x190e0a){logger['error'](_0x190e0a[_0x6c0d('0x23')]);if(_0x190e0a['name']){delete _0x190e0a['name'];}_0x5bd6f6['status'](_0x1e965f)[_0x6c0d('0x24')](_0x190e0a);};}exports[_0x6c0d('0x25')]=function(_0x5b8bd8,_0x439afe){var _0x23e268={},_0x51b190={},_0x28791c={'count':0x0,'rows':[]};var _0xe30903=_[_0x6c0d('0x26')](db[_0x6c0d('0x27')][_0x6c0d('0x28')],function(_0x55efe3){return{'name':_0x55efe3['fieldName'],'type':_0x55efe3['type'][_0x6c0d('0x29')]};});_0x51b190[_0x6c0d('0x2a')]=_[_0x6c0d('0x26')](_0xe30903,_0x6c0d('0x2b'));_0x51b190[_0x6c0d('0x2c')]=_[_0x6c0d('0x2d')](_0x5b8bd8[_0x6c0d('0x2c')]);_0x51b190[_0x6c0d('0x2e')]=_[_0x6c0d('0x2f')](_0x51b190[_0x6c0d('0x2a')],_0x51b190[_0x6c0d('0x2c')]);_0x23e268[_0x6c0d('0x30')]=_[_0x6c0d('0x2f')](_0x51b190[_0x6c0d('0x2a')],qs['fields'](_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x31')]));_0x23e268[_0x6c0d('0x30')]=_0x23e268['attributes'][_0x6c0d('0x32')]?_0x23e268[_0x6c0d('0x30')]:_0x51b190[_0x6c0d('0x2a')];if(!_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x33')]('nolimit')){_0x23e268[_0x6c0d('0x1a')]=qs[_0x6c0d('0x1a')](_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x1a')]);_0x23e268[_0x6c0d('0x19')]=qs[_0x6c0d('0x19')](_0x5b8bd8['query'][_0x6c0d('0x19')]);}_0x23e268[_0x6c0d('0x34')]=qs[_0x6c0d('0x35')](_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x35')]);_0x23e268[_0x6c0d('0x36')]=qs[_0x6c0d('0x2e')](_[_0x6c0d('0x37')](_0x5b8bd8[_0x6c0d('0x2c')],_0x51b190[_0x6c0d('0x2e')]),_0xe30903);if(_0x5b8bd8[_0x6c0d('0x2c')]['filter']){_0x23e268['where']=_[_0x6c0d('0x38')](_0x23e268[_0x6c0d('0x36')],{'$or':_[_0x6c0d('0x26')](_0xe30903,function(_0xabdece){if(_0xabdece['type']!==_0x6c0d('0x39')){var _0x302638={};_0x302638[_0xabdece[_0x6c0d('0x2b')]]={'$like':'%'+_0x5b8bd8['query'][_0x6c0d('0x3a')]+'%'};return _0x302638;}})});}_0x23e268=_[_0x6c0d('0x38')]({},_0x23e268,_0x5b8bd8[_0x6c0d('0x3b')]);var _0x3ba1bd={'where':_0x23e268[_0x6c0d('0x36')]};return db['JscriptyQuestionReport'][_0x6c0d('0x18')](_0x3ba1bd)[_0x6c0d('0x20')](function(_0x2b2f4d){_0x28791c['count']=_0x2b2f4d;if(_0x5b8bd8[_0x6c0d('0x2c')][_0x6c0d('0x3c')]){_0x23e268[_0x6c0d('0x3d')]=[{'all':!![]}];}return db[_0x6c0d('0x27')][_0x6c0d('0x3e')](_0x23e268);})[_0x6c0d('0x20')](function(_0x275dec){_0x28791c[_0x6c0d('0x3f')]=_0x275dec;return _0x28791c;})[_0x6c0d('0x20')](respondWithFilteredResult(_0x439afe,_0x23e268))[_0x6c0d('0x40')](handleError(_0x439afe,null));};exports[_0x6c0d('0x41')]=function(_0x4b7b91,_0x1be6a7){var _0x6cacd7={'raw':!![],'where':{'id':_0x4b7b91[_0x6c0d('0x42')]['id']}},_0x5929a6={};_0x5929a6[_0x6c0d('0x2a')]=_['keys'](db[_0x6c0d('0x27')]['rawAttributes']);_0x5929a6[_0x6c0d('0x2c')]=_[_0x6c0d('0x2d')](_0x4b7b91[_0x6c0d('0x2c')]);_0x5929a6[_0x6c0d('0x2e')]=_[_0x6c0d('0x2f')](_0x5929a6[_0x6c0d('0x2a')],_0x5929a6[_0x6c0d('0x2c')]);_0x6cacd7[_0x6c0d('0x30')]=_[_0x6c0d('0x2f')](_0x5929a6[_0x6c0d('0x2a')],qs[_0x6c0d('0x31')](_0x4b7b91[_0x6c0d('0x2c')][_0x6c0d('0x31')]));_0x6cacd7[_0x6c0d('0x30')]=_0x6cacd7[_0x6c0d('0x30')][_0x6c0d('0x32')]?_0x6cacd7[_0x6c0d('0x30')]:_0x5929a6[_0x6c0d('0x2a')];if(_0x4b7b91[_0x6c0d('0x2c')]['includeAll']){_0x6cacd7[_0x6c0d('0x3d')]=[{'all':!![]}];}_0x6cacd7=_[_0x6c0d('0x38')]({},_0x6cacd7,_0x4b7b91[_0x6c0d('0x3b')]);return db[_0x6c0d('0x27')][_0x6c0d('0x43')](_0x6cacd7)['then'](handleEntityNotFound(_0x1be6a7,null))[_0x6c0d('0x20')](respondWithResult(_0x1be6a7,null))['catch'](handleError(_0x1be6a7,null));};exports[_0x6c0d('0x44')]=function(_0x12485f,_0x194da0){return db[_0x6c0d('0x27')]['create'](_0x12485f[_0x6c0d('0x45')],{})[_0x6c0d('0x20')](respondWithResult(_0x194da0,0xc9))['catch'](handleError(_0x194da0,null));};exports[_0x6c0d('0x1f')]=function(_0x27e51f,_0x5d30c3){if(_0x27e51f[_0x6c0d('0x45')]['id']){delete _0x27e51f[_0x6c0d('0x45')]['id'];}return db[_0x6c0d('0x27')][_0x6c0d('0x43')]({'where':{'id':_0x27e51f[_0x6c0d('0x42')]['id']}})[_0x6c0d('0x20')](handleEntityNotFound(_0x5d30c3,null))[_0x6c0d('0x20')](saveUpdates(_0x27e51f[_0x6c0d('0x45')],null))[_0x6c0d('0x20')](respondWithResult(_0x5d30c3,null))[_0x6c0d('0x40')](handleError(_0x5d30c3,null));};exports[_0x6c0d('0x21')]=function(_0x5a5469,_0x56886d){return db[_0x6c0d('0x27')][_0x6c0d('0x43')]({'where':{'id':_0x5a5469[_0x6c0d('0x42')]['id']}})['then'](handleEntityNotFound(_0x56886d,null))[_0x6c0d('0x20')](removeEntity(_0x56886d,null))[_0x6c0d('0x40')](handleError(_0x56886d,null));};exports[_0x6c0d('0x46')]=function(_0x5d8a8f,_0x414923){return db[_0x6c0d('0x27')][_0x6c0d('0x46')]()[_0x6c0d('0x20')](respondWithResult(_0x414923,null))[_0x6c0d('0x40')](handleError(_0x414923,null));}; \ No newline at end of file +var _0x760e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','JscriptyQuestionReport','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x760e,0x119));var _0xe760=function(_0x13a3eb,_0x2f5273){_0x13a3eb=_0x13a3eb-0x0;var _0x40815a=_0x760e[_0x13a3eb];return _0x40815a;};'use strict';var pdf=require(_0xe760('0x0'));var emlformat=require(_0xe760('0x1'));var rimraf=require(_0xe760('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe760('0x3'));var rp=require(_0xe760('0x4'));var moment=require(_0xe760('0x5'));var BPromise=require(_0xe760('0x6'));var Mustache=require(_0xe760('0x7'));var util=require(_0xe760('0x8'));var path=require(_0xe760('0x9'));var sox=require(_0xe760('0xa'));var csv=require(_0xe760('0xb'));var ejs=require(_0xe760('0xc'));var fs=require('fs');var _=require(_0xe760('0xd'));var squel=require('squel');var crypto=require(_0xe760('0xe'));var jsforce=require(_0xe760('0xf'));var deskjs=require(_0xe760('0x10'));var toCsv=require(_0xe760('0xb'));var querystring=require(_0xe760('0x11'));var Papa=require(_0xe760('0x12'));var Redis=require(_0xe760('0x13'));var authService=require(_0xe760('0x14'));var qs=require(_0xe760('0x15'));var as=require(_0xe760('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe760('0x17'));var utils=require(_0xe760('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5f72,_0x1d68d0){_0x1d68d0=_0x1d68d0||0xcc;return function(_0x310429){if(_0x310429){return _0x2b5f72[_0xe760('0x19')](_0x1d68d0);}return _0x2b5f72[_0xe760('0x1a')](_0x1d68d0)['end']();};}function respondWithResult(_0x2b9b0f,_0x332ca8){_0x332ca8=_0x332ca8||0xc8;return function(_0x1239bb){if(_0x1239bb){return _0x2b9b0f[_0xe760('0x1a')](_0x332ca8)[_0xe760('0x1b')](_0x1239bb);}};}function respondWithFilteredResult(_0x38df89,_0x5d5ea1){return function(_0x34c517){if(_0x34c517){var _0x241175=_0x34c517[_0xe760('0x1c')],_0x41be70=_0x5d5ea1[_0xe760('0x1d')],_0x3d86f=_0x5d5ea1[_0xe760('0x1d')]+_0x5d5ea1[_0xe760('0x1e')],_0x3aa468;if(_0x3d86f>=_0x241175){_0x3d86f=_0x241175;_0x3aa468=0xc8;}else{_0x3aa468=0xce;}_0x38df89['status'](_0x3aa468);return _0x38df89['set'](_0xe760('0x1f'),_0x41be70+'-'+_0x3d86f+'/'+_0x241175)[_0xe760('0x1b')](_0x34c517);}return null;};}function patchUpdates(_0x1c51b1){return function(_0x427f78){try{jsonpatch[_0xe760('0x20')](_0x427f78,_0x1c51b1,!![]);}catch(_0x50c078){return BPromise[_0xe760('0x21')](_0x50c078);}return _0x427f78['save']();};}function saveUpdates(_0x5d3a4c,_0x5e9c40){return function(_0x5931df){if(_0x5931df){return _0x5931df['update'](_0x5d3a4c)[_0xe760('0x22')](function(_0x1e37e2){return _0x1e37e2;});}return null;};}function removeEntity(_0x20dedc,_0x89df28){return function(_0x5d5a87){if(_0x5d5a87){return _0x5d5a87[_0xe760('0x23')]()[_0xe760('0x22')](function(){_0x20dedc[_0xe760('0x1a')](0xcc)[_0xe760('0x24')]();});}};}function handleEntityNotFound(_0x14676c,_0x44bdf7){return function(_0x2888ad){if(!_0x2888ad){_0x14676c['sendStatus'](0x194);}return _0x2888ad;};}function handleError(_0x5b33bd,_0x100246){_0x100246=_0x100246||0x1f4;return function(_0x19fed2){logger['error'](_0x19fed2[_0xe760('0x25')]);if(_0x19fed2[_0xe760('0x26')]){delete _0x19fed2[_0xe760('0x26')];}_0x5b33bd['status'](_0x100246)[_0xe760('0x27')](_0x19fed2);};}exports[_0xe760('0x28')]=function(_0xcdbd68,_0x40d9f6){var _0x5a27ef={},_0x1cf405={},_0x5a70fa={'count':0x0,'rows':[]};var _0x39a0a2=_[_0xe760('0x29')](db['JscriptyQuestionReport'][_0xe760('0x2a')],function(_0x36f0b9){return{'name':_0x36f0b9[_0xe760('0x2b')],'type':_0x36f0b9[_0xe760('0x2c')][_0xe760('0x2d')]};});_0x1cf405['model']=_[_0xe760('0x29')](_0x39a0a2,_0xe760('0x26'));_0x1cf405['query']=_[_0xe760('0x2e')](_0xcdbd68['query']);_0x1cf405[_0xe760('0x2f')]=_[_0xe760('0x30')](_0x1cf405[_0xe760('0x31')],_0x1cf405[_0xe760('0x32')]);_0x5a27ef[_0xe760('0x33')]=_[_0xe760('0x30')](_0x1cf405[_0xe760('0x31')],qs[_0xe760('0x34')](_0xcdbd68[_0xe760('0x32')][_0xe760('0x34')]));_0x5a27ef['attributes']=_0x5a27ef[_0xe760('0x33')][_0xe760('0x35')]?_0x5a27ef['attributes']:_0x1cf405[_0xe760('0x31')];if(!_0xcdbd68[_0xe760('0x32')][_0xe760('0x36')](_0xe760('0x37'))){_0x5a27ef[_0xe760('0x1e')]=qs[_0xe760('0x1e')](_0xcdbd68['query']['limit']);_0x5a27ef['offset']=qs['offset'](_0xcdbd68['query'][_0xe760('0x1d')]);}_0x5a27ef[_0xe760('0x38')]=qs['sort'](_0xcdbd68[_0xe760('0x32')][_0xe760('0x39')]);_0x5a27ef['where']=qs['filters'](_[_0xe760('0x3a')](_0xcdbd68[_0xe760('0x32')],_0x1cf405[_0xe760('0x2f')]),_0x39a0a2);if(_0xcdbd68['query'][_0xe760('0x3b')]){_0x5a27ef[_0xe760('0x3c')]=_['merge'](_0x5a27ef['where'],{'$or':_['map'](_0x39a0a2,function(_0x3e5108){if(_0x3e5108[_0xe760('0x2c')]!==_0xe760('0x3d')){var _0xf94cc2={};_0xf94cc2[_0x3e5108[_0xe760('0x26')]]={'$like':'%'+_0xcdbd68['query'][_0xe760('0x3b')]+'%'};return _0xf94cc2;}})});}_0x5a27ef=_[_0xe760('0x3e')]({},_0x5a27ef,_0xcdbd68[_0xe760('0x3f')]);var _0x263f8e={'where':_0x5a27ef[_0xe760('0x3c')]};return db[_0xe760('0x40')][_0xe760('0x1c')](_0x263f8e)['then'](function(_0xd8802e){_0x5a70fa['count']=_0xd8802e;if(_0xcdbd68['query'][_0xe760('0x41')]){_0x5a27ef[_0xe760('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x5a27ef);})[_0xe760('0x22')](function(_0xd1e25){_0x5a70fa[_0xe760('0x43')]=_0xd1e25;return _0x5a70fa;})['then'](respondWithFilteredResult(_0x40d9f6,_0x5a27ef))[_0xe760('0x44')](handleError(_0x40d9f6,null));};exports[_0xe760('0x45')]=function(_0x227261,_0x41d340){var _0xe5718d={'raw':!![],'where':{'id':_0x227261[_0xe760('0x46')]['id']}},_0x344bb0={};_0x344bb0[_0xe760('0x31')]=_[_0xe760('0x2e')](db['JscriptyQuestionReport'][_0xe760('0x2a')]);_0x344bb0[_0xe760('0x32')]=_[_0xe760('0x2e')](_0x227261[_0xe760('0x32')]);_0x344bb0[_0xe760('0x2f')]=_[_0xe760('0x30')](_0x344bb0[_0xe760('0x31')],_0x344bb0[_0xe760('0x32')]);_0xe5718d[_0xe760('0x33')]=_[_0xe760('0x30')](_0x344bb0[_0xe760('0x31')],qs[_0xe760('0x34')](_0x227261[_0xe760('0x32')][_0xe760('0x34')]));_0xe5718d[_0xe760('0x33')]=_0xe5718d['attributes'][_0xe760('0x35')]?_0xe5718d['attributes']:_0x344bb0[_0xe760('0x31')];if(_0x227261[_0xe760('0x32')]['includeAll']){_0xe5718d[_0xe760('0x42')]=[{'all':!![]}];}_0xe5718d=_['merge']({},_0xe5718d,_0x227261['options']);return db[_0xe760('0x40')][_0xe760('0x47')](_0xe5718d)['then'](handleEntityNotFound(_0x41d340,null))[_0xe760('0x22')](respondWithResult(_0x41d340,null))[_0xe760('0x44')](handleError(_0x41d340,null));};exports[_0xe760('0x48')]=function(_0x1d0cfb,_0x3effd1){return db[_0xe760('0x40')][_0xe760('0x48')](_0x1d0cfb[_0xe760('0x49')],{})['then'](respondWithResult(_0x3effd1,0xc9))[_0xe760('0x44')](handleError(_0x3effd1,null));};exports['update']=function(_0xd6e2e0,_0x24eb26){if(_0xd6e2e0[_0xe760('0x49')]['id']){delete _0xd6e2e0[_0xe760('0x49')]['id'];}return db['JscriptyQuestionReport'][_0xe760('0x47')]({'where':{'id':_0xd6e2e0[_0xe760('0x46')]['id']}})[_0xe760('0x22')](handleEntityNotFound(_0x24eb26,null))['then'](saveUpdates(_0xd6e2e0[_0xe760('0x49')],null))[_0xe760('0x22')](respondWithResult(_0x24eb26,null))[_0xe760('0x44')](handleError(_0x24eb26,null));};exports[_0xe760('0x23')]=function(_0x207846,_0x4ececb){return db[_0xe760('0x40')][_0xe760('0x47')]({'where':{'id':_0x207846[_0xe760('0x46')]['id']}})[_0xe760('0x22')](handleEntityNotFound(_0x4ececb,null))['then'](removeEntity(_0x4ececb,null))[_0xe760('0x44')](handleError(_0x4ececb,null));};exports['describe']=function(_0x49ac69,_0x4d77db){return db[_0xe760('0x40')][_0xe760('0x4a')]()[_0xe760('0x22')](respondWithResult(_0x4d77db,null))['catch'](handleError(_0x4d77db,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f08f59a..5a7112c 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 _0x6e4b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x2257bb,_0x37d0d3){var _0x26dc39=function(_0x2908aa){while(--_0x2908aa){_0x2257bb['push'](_0x2257bb['shift']());}};_0x26dc39(++_0x37d0d3);}(_0x6e4b,0x78));var _0xb6e4=function(_0x55991f,_0x4dae2b){_0x55991f=_0x55991f-0x0;var _0x35aa41=_0x6e4b[_0x55991f];return _0x35aa41;};'use strict';var _=require(_0xb6e4('0x0'));var util=require('util');var logger=require(_0xb6e4('0x1'))(_0xb6e4('0x2'));var moment=require(_0xb6e4('0x3'));var BPromise=require(_0xb6e4('0x4'));var rp=require(_0xb6e4('0x5'));var fs=require('fs');var path=require(_0xb6e4('0x6'));var rimraf=require('rimraf');var config=require(_0xb6e4('0x7'));var attributes=require(_0xb6e4('0x8'));module['exports']=function(_0x5d95d8,_0x39e3b3){return _0x5d95d8['define'](_0xb6e4('0x9'),attributes,{'tableName':_0xb6e4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d81=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d81,0xc4));var _0x14d8=function(_0x212537,_0x64c7f5){_0x212537=_0x212537-0x0;var _0x233b98=_0x4d81[_0x212537];return _0x233b98;};'use strict';var _=require(_0x14d8('0x0'));var util=require(_0x14d8('0x1'));var logger=require(_0x14d8('0x2'))(_0x14d8('0x3'));var moment=require(_0x14d8('0x4'));var BPromise=require(_0x14d8('0x5'));var rp=require(_0x14d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x14d8('0x7'));module[_0x14d8('0x8')]=function(_0x2164e1,_0x227454){return _0x2164e1[_0x14d8('0x9')](_0x14d8('0xa'),attributes,{'tableName':_0x14d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 31539d9..3b688bc 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 _0x9523=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5d8c8e,_0x19031e){var _0x2d4ff1=function(_0x5c98ee){while(--_0x5c98ee){_0x5d8c8e['push'](_0x5d8c8e['shift']());}};_0x2d4ff1(++_0x19031e);}(_0x9523,0xe2));var _0x3952=function(_0x270411,_0x251347){_0x270411=_0x270411-0x0;var _0x3dec5f=_0x9523[_0x270411];return _0x3dec5f;};'use strict';var _=require('lodash');var util=require(_0x3952('0x0'));var moment=require(_0x3952('0x1'));var BPromise=require(_0x3952('0x2'));var rs=require(_0x3952('0x3'));var fs=require('fs');var Redis=require(_0x3952('0x4'));var db=require(_0x3952('0x5'))['db'];var utils=require(_0x3952('0x6'));var logger=require(_0x3952('0x7'))(_0x3952('0x8'));var config=require(_0x3952('0x9'));var jayson=require(_0x3952('0xa'));var client=jayson[_0x3952('0xb')][_0x3952('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1739b6,_0x5ab5eb,_0x5d4a51){return new BPromise(function(_0x14eb57,_0x1f510a){return client[_0x3952('0xd')](_0x1739b6,_0x5d4a51)['then'](function(_0x3b60ad){logger[_0x3952('0xe')](_0x3952('0xf'),_0x5ab5eb,'request\x20sent');logger[_0x3952('0x10')](_0x3952('0x11'),_0x5ab5eb,_0x3952('0x12'),JSON[_0x3952('0x13')](_0x3b60ad));if(_0x3b60ad[_0x3952('0x14')]){if(_0x3b60ad['error'][_0x3952('0x15')]===0x1f4){logger['error'](_0x3952('0xf'),_0x5ab5eb,_0x3b60ad['error'][_0x3952('0x16')]);return _0x1f510a(_0x3b60ad[_0x3952('0x14')]['message']);}logger[_0x3952('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5ab5eb,_0x3b60ad['error'][_0x3952('0x16')]);return _0x14eb57(_0x3b60ad[_0x3952('0x14')][_0x3952('0x16')]);}else{logger[_0x3952('0xe')](_0x3952('0xf'),_0x5ab5eb,_0x3952('0x12'));_0x14eb57(_0x3b60ad[_0x3952('0x17')][_0x3952('0x16')]);}})[_0x3952('0x18')](function(_0x428949){logger[_0x3952('0x14')](_0x3952('0xf'),_0x5ab5eb,_0x428949);_0x1f510a(_0x428949);});});} \ No newline at end of file +var _0x988c=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x310da2,_0x181858){var _0x12bc21=function(_0x559fe7){while(--_0x559fe7){_0x310da2['push'](_0x310da2['shift']());}};_0x12bc21(++_0x181858);}(_0x988c,0x14a));var _0xc988=function(_0x169551,_0x32e757){_0x169551=_0x169551-0x0;var _0x1e0384=_0x988c[_0x169551];return _0x1e0384;};'use strict';var _=require('lodash');var util=require(_0xc988('0x0'));var moment=require(_0xc988('0x1'));var BPromise=require(_0xc988('0x2'));var rs=require(_0xc988('0x3'));var fs=require('fs');var Redis=require(_0xc988('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc988('0x5'));var logger=require(_0xc988('0x6'))(_0xc988('0x7'));var config=require(_0xc988('0x8'));var jayson=require(_0xc988('0x9'));var client=jayson['client'][_0xc988('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38653e,_0x2749be,_0x551c68){return new BPromise(function(_0x3cdb68,_0x20d948){return client[_0xc988('0xb')](_0x38653e,_0x551c68)[_0xc988('0xc')](function(_0x16c7a4){logger[_0xc988('0xd')](_0xc988('0xe'),_0x2749be,_0xc988('0xf'));logger[_0xc988('0x10')](_0xc988('0x11'),_0x2749be,_0xc988('0xf'),JSON['stringify'](_0x16c7a4));if(_0x16c7a4['error']){if(_0x16c7a4[_0xc988('0x12')]['code']===0x1f4){logger[_0xc988('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2749be,_0x16c7a4[_0xc988('0x12')]['message']);return _0x20d948(_0x16c7a4[_0xc988('0x12')][_0xc988('0x13')]);}logger[_0xc988('0x12')](_0xc988('0xe'),_0x2749be,_0x16c7a4[_0xc988('0x12')][_0xc988('0x13')]);return _0x3cdb68(_0x16c7a4[_0xc988('0x12')][_0xc988('0x13')]);}else{logger[_0xc988('0xd')](_0xc988('0xe'),_0x2749be,'request\x20sent');_0x3cdb68(_0x16c7a4[_0xc988('0x14')]['message']);}})[_0xc988('0x15')](function(_0x473168){logger[_0xc988('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2749be,_0x473168);_0x20d948(_0x473168);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ebfd643..07663d5 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 _0x165d=['/describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x165d,0x14a));var _0xd165=function(_0x2592db,_0x3b30e9){_0x2592db=_0x2592db-0x0;var _0x4e6792=_0x165d[_0x2592db];return _0x4e6792;};'use strict';var multer=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var path=require(_0xd165('0x2'));var timeout=require(_0xd165('0x3'));var express=require(_0xd165('0x4'));var router=express[_0xd165('0x5')]();var auth=require(_0xd165('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd165('0x7'));var controller=require(_0xd165('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd165('0x9')](_0xd165('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd165('0x9')](_0xd165('0xb'),auth[_0xd165('0xc')](),controller[_0xd165('0xd')]);router[_0xd165('0x9')](_0xd165('0xe'),auth[_0xd165('0xc')](),controller[_0xd165('0xf')]);router['post']('/',auth[_0xd165('0xc')](),controller[_0xd165('0x10')]);router[_0xd165('0x11')]('/:id',auth[_0xd165('0xc')](),controller['update']);router[_0xd165('0x12')](_0xd165('0xb'),auth[_0xd165('0xc')](),controller[_0xd165('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f9f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','getQuestions','post','put','/:id','update','delete','exports','util','path'];(function(_0x373436,_0x39d99c){var _0x5bba01=function(_0x294fed){while(--_0x294fed){_0x373436['push'](_0x373436['shift']());}};_0x5bba01(++_0x39d99c);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x130633,_0x1e83d0){_0x130633=_0x130633-0x0;var _0x2c36b2=_0x0f9f[_0x130633];return _0x2c36b2;};'use strict';var multer=require('multer');var util=require(_0xf0f9('0x0'));var path=require(_0xf0f9('0x1'));var timeout=require(_0xf0f9('0x2'));var express=require('express');var router=express[_0xf0f9('0x3')]();var auth=require(_0xf0f9('0x4'));var interaction=require(_0xf0f9('0x5'));var config=require(_0xf0f9('0x6'));var controller=require(_0xf0f9('0x7'));router[_0xf0f9('0x8')]('/',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xa')]);router[_0xf0f9('0x8')](_0xf0f9('0xb'),auth['isAuthenticated'](),controller[_0xf0f9('0xc')]);router[_0xf0f9('0x8')]('/:id',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0x8')]('/:id/questions',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xe')]);router[_0xf0f9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0f9('0x10')](_0xf0f9('0x11'),auth[_0xf0f9('0x9')](),controller[_0xf0f9('0x12')]);router[_0xf0f9('0x13')](_0xf0f9('0x11'),auth[_0xf0f9('0x9')](),controller['destroy']);module[_0xf0f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b0a88ec..c54f944 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 _0x8104=['starttime','endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x521239,_0x51976f){var _0x3ca36f=function(_0x1398f5){while(--_0x1398f5){_0x521239['push'](_0x521239['shift']());}};_0x3ca36f(++_0x51976f);}(_0x8104,0x1a9));var _0x4810=function(_0x902290,_0x1aaa75){_0x902290=_0x902290-0x0;var _0x3f753f=_0x8104[_0x902290];return _0x3f753f;};'use strict';var moment=require(_0x4810('0x0'));var Sequelize=require(_0x4810('0x1'));module[_0x4810('0x2')]={'starttime':{'type':Sequelize[_0x4810('0x3')],'set':function(_0x3fd6dc){this[_0x4810('0x4')](_0x4810('0x5'),_0x3fd6dc);this['setDataValue'](_0x4810('0x6'),moment()[_0x4810('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x4810('0x3')]},'membername':{'type':Sequelize[_0x4810('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4810('0x8')]},'uniqueid':{'type':Sequelize[_0x4810('0x8')]},'calleridname':{'type':Sequelize[_0x4810('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x4810('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x0565=['STRING','BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x531721,_0x1a9f7d){var _0x31d548=function(_0x2c30e5){while(--_0x2c30e5){_0x531721['push'](_0x531721['shift']());}};_0x31d548(++_0x1a9f7d);}(_0x0565,0x12e));var _0x5056=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x0565[_0x220f3f];return _0x1f170e;};'use strict';var moment=require('moment');var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x480664){this[_0x5056('0x2')](_0x5056('0x3'),_0x480664);this[_0x5056('0x2')](_0x5056('0x4'),moment()[_0x5056('0x5')](_0x5056('0x6')));}},'endtime':{'type':Sequelize[_0x5056('0x7')]},'membername':{'type':Sequelize[_0x5056('0x8')]},'projectname':{'type':Sequelize[_0x5056('0x8')]},'queue':{'type':Sequelize[_0x5056('0x8')]},'uniqueid':{'type':Sequelize[_0x5056('0x8')]},'calleridname':{'type':Sequelize[_0x5056('0x8')]},'calleridnum':{'type':Sequelize[_0x5056('0x8')]},'completed':{'type':Sequelize[_0x5056('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 1a6cd42..da650f8 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 _0xcefc=['error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','params','options','body','catch','find','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','pick','rows','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0x46421d,_0x174e32){var _0xf1c684=function(_0x831b88){while(--_0x831b88){_0x46421d['push'](_0x46421d['shift']());}};_0xf1c684(++_0x174e32);}(_0xcefc,0xc0));var _0xccef=function(_0x5eb7c2,_0x5402fa){_0x5eb7c2=_0x5eb7c2-0x0;var _0x21467a=_0xcefc[_0x5eb7c2];return _0x21467a;};'use strict';var pdf=require(_0xccef('0x0'));var emlformat=require(_0xccef('0x1'));var rimraf=require(_0xccef('0x2'));var zipdir=require(_0xccef('0x3'));var jsonpatch=require(_0xccef('0x4'));var rp=require('request-promise');var moment=require(_0xccef('0x5'));var BPromise=require(_0xccef('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xccef('0x7'));var csv=require(_0xccef('0x8'));var ejs=require(_0xccef('0x9'));var fs=require('fs');var _=require(_0xccef('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xccef('0xb'));var deskjs=require(_0xccef('0xc'));var toCsv=require(_0xccef('0x8'));var querystring=require(_0xccef('0xd'));var Papa=require(_0xccef('0xe'));var Redis=require(_0xccef('0xf'));var authService=require(_0xccef('0x10'));var qs=require(_0xccef('0x11'));var as=require(_0xccef('0x12'));var hardwareService=require(_0xccef('0x13'));var logger=require(_0xccef('0x14'))(_0xccef('0x15'));var utils=require('../../config/utils');var config=require(_0xccef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef8ad,_0x33f990){_0x33f990=_0x33f990||0xcc;return function(_0x279f33){if(_0x279f33){return _0x3ef8ad[_0xccef('0x17')](_0x33f990);}return _0x3ef8ad[_0xccef('0x18')](_0x33f990)[_0xccef('0x19')]();};}function respondWithResult(_0x3d4815,_0x75639d){_0x75639d=_0x75639d||0xc8;return function(_0xda23ea){if(_0xda23ea){return _0x3d4815[_0xccef('0x18')](_0x75639d)['json'](_0xda23ea);}};}function respondWithFilteredResult(_0x36209d,_0x2f32df){return function(_0x4cd9dd){if(_0x4cd9dd){var _0x57b164=_0x4cd9dd[_0xccef('0x1a')],_0xe3d2fb=_0x2f32df[_0xccef('0x1b')],_0x239c0b=_0x2f32df[_0xccef('0x1b')]+_0x2f32df[_0xccef('0x1c')],_0x490bff;if(_0x239c0b>=_0x57b164){_0x239c0b=_0x57b164;_0x490bff=0xc8;}else{_0x490bff=0xce;}_0x36209d[_0xccef('0x18')](_0x490bff);return _0x36209d[_0xccef('0x1d')](_0xccef('0x1e'),_0xe3d2fb+'-'+_0x239c0b+'/'+_0x57b164)['json'](_0x4cd9dd);}return null;};}function patchUpdates(_0x207b12){return function(_0x581051){try{jsonpatch['apply'](_0x581051,_0x207b12,!![]);}catch(_0x2bd099){return BPromise[_0xccef('0x1f')](_0x2bd099);}return _0x581051[_0xccef('0x20')]();};}function saveUpdates(_0x2bced8,_0x2c19fd){return function(_0x4d786d){if(_0x4d786d){return _0x4d786d[_0xccef('0x21')](_0x2bced8)[_0xccef('0x22')](function(_0x453f6a){return _0x453f6a;});}return null;};}function removeEntity(_0x490035,_0x5145be){return function(_0x1d84a8){if(_0x1d84a8){return _0x1d84a8[_0xccef('0x23')]()[_0xccef('0x22')](function(){_0x490035[_0xccef('0x18')](0xcc)[_0xccef('0x19')]();});}};}function handleEntityNotFound(_0x4cd58c,_0x31d057){return function(_0x2c98ce){if(!_0x2c98ce){_0x4cd58c[_0xccef('0x17')](0x194);}return _0x2c98ce;};}function handleError(_0x1a6cec,_0x3cb266){_0x3cb266=_0x3cb266||0x1f4;return function(_0x3552d6){logger[_0xccef('0x24')](_0x3552d6[_0xccef('0x25')]);if(_0x3552d6[_0xccef('0x26')]){delete _0x3552d6[_0xccef('0x26')];}_0x1a6cec[_0xccef('0x18')](_0x3cb266)[_0xccef('0x27')](_0x3552d6);};}exports['index']=function(_0x1d4d98,_0x231d13){var _0x4091ac={},_0x38181a={},_0x47098e={'count':0x0,'rows':[]};var _0x54011d=_[_0xccef('0x28')](db[_0xccef('0x29')][_0xccef('0x2a')],function(_0x19cc38){return{'name':_0x19cc38[_0xccef('0x2b')],'type':_0x19cc38[_0xccef('0x2c')][_0xccef('0x2d')]};});_0x38181a[_0xccef('0x2e')]=_[_0xccef('0x28')](_0x54011d,_0xccef('0x26'));_0x38181a['query']=_[_0xccef('0x2f')](_0x1d4d98[_0xccef('0x30')]);_0x38181a[_0xccef('0x31')]=_[_0xccef('0x32')](_0x38181a[_0xccef('0x2e')],_0x38181a['query']);_0x4091ac['attributes']=_[_0xccef('0x32')](_0x38181a[_0xccef('0x2e')],qs[_0xccef('0x33')](_0x1d4d98[_0xccef('0x30')]['fields']));_0x4091ac[_0xccef('0x34')]=_0x4091ac['attributes'][_0xccef('0x35')]?_0x4091ac[_0xccef('0x34')]:_0x38181a[_0xccef('0x2e')];if(!_0x1d4d98[_0xccef('0x30')][_0xccef('0x36')]('nolimit')){_0x4091ac['limit']=qs[_0xccef('0x1c')](_0x1d4d98['query'][_0xccef('0x1c')]);_0x4091ac['offset']=qs[_0xccef('0x1b')](_0x1d4d98[_0xccef('0x30')][_0xccef('0x1b')]);}_0x4091ac[_0xccef('0x37')]=qs[_0xccef('0x38')](_0x1d4d98['query'][_0xccef('0x38')]);_0x4091ac[_0xccef('0x39')]=qs[_0xccef('0x31')](_['pick'](_0x1d4d98['query'],_0x38181a[_0xccef('0x31')]),_0x54011d);if(_0x1d4d98[_0xccef('0x30')]['filter']){_0x4091ac[_0xccef('0x39')]=_[_0xccef('0x3a')](_0x4091ac[_0xccef('0x39')],{'$or':_[_0xccef('0x28')](_0x54011d,function(_0x34a7ae){if(_0x34a7ae['type']!==_0xccef('0x3b')){var _0x38cfa2={};_0x38cfa2[_0x34a7ae[_0xccef('0x26')]]={'$like':'%'+_0x1d4d98['query'][_0xccef('0x3c')]+'%'};return _0x38cfa2;}})});}_0x4091ac=_[_0xccef('0x3a')]({},_0x4091ac,_0x1d4d98['options']);var _0x1074f8={'where':_0x4091ac[_0xccef('0x39')]};return db['JscriptySessionReport'][_0xccef('0x1a')](_0x1074f8)[_0xccef('0x22')](function(_0x22482f){_0x47098e[_0xccef('0x1a')]=_0x22482f;if(_0x1d4d98[_0xccef('0x30')][_0xccef('0x3d')]){_0x4091ac[_0xccef('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xccef('0x3f')](_0x4091ac);})[_0xccef('0x22')](function(_0x4de0f0){_0x47098e['rows']=_0x4de0f0;return _0x47098e;})['then'](respondWithFilteredResult(_0x231d13,_0x4091ac))['catch'](handleError(_0x231d13,null));};exports['show']=function(_0x28d66f,_0x2152cc){var _0x6e7a71={'raw':!![],'where':{'id':_0x28d66f[_0xccef('0x40')]['id']}},_0x3062ac={};_0x3062ac[_0xccef('0x2e')]=_['keys'](db[_0xccef('0x29')][_0xccef('0x2a')]);_0x3062ac[_0xccef('0x30')]=_[_0xccef('0x2f')](_0x28d66f[_0xccef('0x30')]);_0x3062ac[_0xccef('0x31')]=_['intersection'](_0x3062ac[_0xccef('0x2e')],_0x3062ac['query']);_0x6e7a71['attributes']=_[_0xccef('0x32')](_0x3062ac[_0xccef('0x2e')],qs[_0xccef('0x33')](_0x28d66f[_0xccef('0x30')][_0xccef('0x33')]));_0x6e7a71[_0xccef('0x34')]=_0x6e7a71['attributes'][_0xccef('0x35')]?_0x6e7a71['attributes']:_0x3062ac['model'];if(_0x28d66f['query'][_0xccef('0x3d')]){_0x6e7a71[_0xccef('0x3e')]=[{'all':!![]}];}_0x6e7a71=_[_0xccef('0x3a')]({},_0x6e7a71,_0x28d66f[_0xccef('0x41')]);return db['JscriptySessionReport']['find'](_0x6e7a71)['then'](handleEntityNotFound(_0x2152cc,null))['then'](respondWithResult(_0x2152cc,null))['catch'](handleError(_0x2152cc,null));};exports['create']=function(_0x103106,_0x1161f3){return db['JscriptySessionReport']['create'](_0x103106[_0xccef('0x42')],{})[_0xccef('0x22')](respondWithResult(_0x1161f3,0xc9))[_0xccef('0x43')](handleError(_0x1161f3,null));};exports[_0xccef('0x21')]=function(_0x139f7b,_0x3341c7){if(_0x139f7b[_0xccef('0x42')]['id']){delete _0x139f7b['body']['id'];}return db[_0xccef('0x29')][_0xccef('0x44')]({'where':{'id':_0x139f7b[_0xccef('0x40')]['id']}})['then'](handleEntityNotFound(_0x3341c7,null))[_0xccef('0x22')](saveUpdates(_0x139f7b[_0xccef('0x42')],null))['then'](respondWithResult(_0x3341c7,null))[_0xccef('0x43')](handleError(_0x3341c7,null));};exports[_0xccef('0x23')]=function(_0x391fcc,_0x4daa46){return db[_0xccef('0x29')]['find']({'where':{'id':_0x391fcc['params']['id']}})[_0xccef('0x22')](handleEntityNotFound(_0x4daa46,null))[_0xccef('0x22')](removeEntity(_0x4daa46,null))[_0xccef('0x43')](handleError(_0x4daa46,null));};exports[_0xccef('0x45')]=function(_0x31eb4c,_0x272318){return db['JscriptySessionReport'][_0xccef('0x45')]()[_0xccef('0x22')](respondWithResult(_0x272318,null))[_0xccef('0x43')](handleError(_0x272318,null));};exports[_0xccef('0x46')]=function(_0x1d7d29,_0x27b0c9,_0x2e2443){var _0x4ac652={'raw':!![],'where':{}};var _0x215808={};var _0x5df07a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xccef('0x47')]({'where':{'id':_0x1d7d29[_0xccef('0x40')]['id']}})[_0xccef('0x22')](handleEntityNotFound(_0x27b0c9,null))['then'](function(_0x4885ea){if(_0x4885ea){_0x215808[_0xccef('0x2e')]=_[_0xccef('0x2f')](db[_0xccef('0x48')][_0xccef('0x2a')]);_0x215808['query']=_[_0xccef('0x2f')](_0x1d7d29['query']);_0x215808['filters']=_[_0xccef('0x32')](_0x215808[_0xccef('0x2e')],_0x215808[_0xccef('0x30')]);_0x4ac652['attributes']=_['intersection'](_0x215808[_0xccef('0x2e')],qs['fields'](_0x1d7d29[_0xccef('0x30')][_0xccef('0x33')]));_0x4ac652[_0xccef('0x34')]=_0x4ac652[_0xccef('0x34')]['length']?_0x4ac652[_0xccef('0x34')]:_0x215808[_0xccef('0x2e')];if(!_0x1d7d29['query'][_0xccef('0x36')](_0xccef('0x49'))){_0x4ac652[_0xccef('0x1c')]=qs[_0xccef('0x1c')](_0x1d7d29[_0xccef('0x30')][_0xccef('0x1c')]);_0x4ac652[_0xccef('0x1b')]=qs[_0xccef('0x1b')](_0x1d7d29[_0xccef('0x30')]['offset']);}_0x4ac652[_0xccef('0x37')]=qs[_0xccef('0x38')](_0x1d7d29['query'][_0xccef('0x38')]);_0x4ac652['where']=qs[_0xccef('0x31')](_[_0xccef('0x4a')](_0x1d7d29['query'],_0x215808[_0xccef('0x31')]));_0x4ac652[_0xccef('0x39')]['SessionId']=_0x4885ea['id'];if(_0x1d7d29[_0xccef('0x30')]['filter']){_0x4ac652[_0xccef('0x39')]=_[_0xccef('0x3a')](_0x4ac652[_0xccef('0x39')],{'$or':_[_0xccef('0x28')](_0x4ac652[_0xccef('0x34')],function(_0x44533e){var _0x87f475={};_0x87f475[_0x44533e]={'$like':'%'+_0x1d7d29[_0xccef('0x30')][_0xccef('0x3c')]+'%'};return _0x87f475;})});}_0x4ac652=_[_0xccef('0x3a')]({},_0x4ac652,_0x1d7d29[_0xccef('0x41')]);return db[_0xccef('0x48')]['count']({'where':_0x4ac652['where']})[_0xccef('0x22')](function(_0x2169c9){_0x5df07a[_0xccef('0x1a')]=_0x2169c9;if(_0x1d7d29[_0xccef('0x30')][_0xccef('0x3d')]){_0x4ac652[_0xccef('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xccef('0x3f')](_0x4ac652);})[_0xccef('0x22')](function(_0x35e454){_0x5df07a[_0xccef('0x4b')]=_0x35e454;return _0x5df07a;});}})[_0xccef('0x22')](respondWithFilteredResult(_0x27b0c9,_0x4ac652))[_0xccef('0x43')](handleError(_0x27b0c9,null));}; \ No newline at end of file +var _0xb486=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','count','include','findAll','rows','fields','includeAll','catch','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','pick','rimraf','zip-dir'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0xb486,0x1cc));var _0x6b48=function(_0xc6d4f2,_0x10747d){_0xc6d4f2=_0xc6d4f2-0x0;var _0x48ea90=_0xb486[_0xc6d4f2];return _0x48ea90;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6b48('0x0'));var zipdir=require(_0x6b48('0x1'));var jsonpatch=require(_0x6b48('0x2'));var rp=require(_0x6b48('0x3'));var moment=require('moment');var BPromise=require(_0x6b48('0x4'));var Mustache=require(_0x6b48('0x5'));var util=require(_0x6b48('0x6'));var path=require(_0x6b48('0x7'));var sox=require('sox');var csv=require(_0x6b48('0x8'));var ejs=require(_0x6b48('0x9'));var fs=require('fs');var _=require(_0x6b48('0xa'));var squel=require(_0x6b48('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b48('0xc'));var deskjs=require(_0x6b48('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b48('0xe'));var Papa=require(_0x6b48('0xf'));var Redis=require(_0x6b48('0x10'));var authService=require(_0x6b48('0x11'));var qs=require(_0x6b48('0x12'));var as=require(_0x6b48('0x13'));var hardwareService=require(_0x6b48('0x14'));var logger=require('../../config/logger')(_0x6b48('0x15'));var utils=require(_0x6b48('0x16'));var config=require(_0x6b48('0x17'));var db=require(_0x6b48('0x18'))['db'];function respondWithStatusCode(_0x3ff7f4,_0x3d255){_0x3d255=_0x3d255||0xcc;return function(_0x3031be){if(_0x3031be){return _0x3ff7f4[_0x6b48('0x19')](_0x3d255);}return _0x3ff7f4[_0x6b48('0x1a')](_0x3d255)['end']();};}function respondWithResult(_0x24c7d3,_0x1932f9){_0x1932f9=_0x1932f9||0xc8;return function(_0x3e68bf){if(_0x3e68bf){return _0x24c7d3['status'](_0x1932f9)[_0x6b48('0x1b')](_0x3e68bf);}};}function respondWithFilteredResult(_0x4b845f,_0x9dc8c8){return function(_0x40601a){if(_0x40601a){var _0x4ebf96=_0x40601a['count'],_0x1213db=_0x9dc8c8[_0x6b48('0x1c')],_0x29a3db=_0x9dc8c8[_0x6b48('0x1c')]+_0x9dc8c8[_0x6b48('0x1d')],_0x42f168;if(_0x29a3db>=_0x4ebf96){_0x29a3db=_0x4ebf96;_0x42f168=0xc8;}else{_0x42f168=0xce;}_0x4b845f['status'](_0x42f168);return _0x4b845f[_0x6b48('0x1e')]('Content-Range',_0x1213db+'-'+_0x29a3db+'/'+_0x4ebf96)[_0x6b48('0x1b')](_0x40601a);}return null;};}function patchUpdates(_0x290341){return function(_0x452e27){try{jsonpatch['apply'](_0x452e27,_0x290341,!![]);}catch(_0x4ffcfc){return BPromise[_0x6b48('0x1f')](_0x4ffcfc);}return _0x452e27[_0x6b48('0x20')]();};}function saveUpdates(_0x6f063e,_0x43e671){return function(_0x3d6ded){if(_0x3d6ded){return _0x3d6ded[_0x6b48('0x21')](_0x6f063e)[_0x6b48('0x22')](function(_0x1a3131){return _0x1a3131;});}return null;};}function removeEntity(_0x25c4ef,_0x9edc43){return function(_0x23bbb4){if(_0x23bbb4){return _0x23bbb4[_0x6b48('0x23')]()['then'](function(){_0x25c4ef[_0x6b48('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55c3f3,_0x20e575){return function(_0x41a81c){if(!_0x41a81c){_0x55c3f3[_0x6b48('0x19')](0x194);}return _0x41a81c;};}function handleError(_0x318455,_0x550ed3){_0x550ed3=_0x550ed3||0x1f4;return function(_0xcc4f19){logger[_0x6b48('0x24')](_0xcc4f19[_0x6b48('0x25')]);if(_0xcc4f19[_0x6b48('0x26')]){delete _0xcc4f19['name'];}_0x318455[_0x6b48('0x1a')](_0x550ed3)['send'](_0xcc4f19);};}exports[_0x6b48('0x27')]=function(_0x910eae,_0x6812a3){var _0x4f0a41={},_0x5091e1={},_0x1931e6={'count':0x0,'rows':[]};var _0xfee47c=_[_0x6b48('0x28')](db[_0x6b48('0x29')][_0x6b48('0x2a')],function(_0x709a77){return{'name':_0x709a77['fieldName'],'type':_0x709a77[_0x6b48('0x2b')][_0x6b48('0x2c')]};});_0x5091e1[_0x6b48('0x2d')]=_['map'](_0xfee47c,_0x6b48('0x26'));_0x5091e1[_0x6b48('0x2e')]=_[_0x6b48('0x2f')](_0x910eae['query']);_0x5091e1[_0x6b48('0x30')]=_[_0x6b48('0x31')](_0x5091e1['model'],_0x5091e1[_0x6b48('0x2e')]);_0x4f0a41[_0x6b48('0x32')]=_[_0x6b48('0x31')](_0x5091e1[_0x6b48('0x2d')],qs['fields'](_0x910eae[_0x6b48('0x2e')]['fields']));_0x4f0a41[_0x6b48('0x32')]=_0x4f0a41[_0x6b48('0x32')][_0x6b48('0x33')]?_0x4f0a41[_0x6b48('0x32')]:_0x5091e1[_0x6b48('0x2d')];if(!_0x910eae[_0x6b48('0x2e')][_0x6b48('0x34')]('nolimit')){_0x4f0a41[_0x6b48('0x1d')]=qs[_0x6b48('0x1d')](_0x910eae[_0x6b48('0x2e')][_0x6b48('0x1d')]);_0x4f0a41[_0x6b48('0x1c')]=qs['offset'](_0x910eae[_0x6b48('0x2e')]['offset']);}_0x4f0a41[_0x6b48('0x35')]=qs[_0x6b48('0x36')](_0x910eae['query'][_0x6b48('0x36')]);_0x4f0a41[_0x6b48('0x37')]=qs[_0x6b48('0x30')](_['pick'](_0x910eae[_0x6b48('0x2e')],_0x5091e1[_0x6b48('0x30')]),_0xfee47c);if(_0x910eae[_0x6b48('0x2e')][_0x6b48('0x38')]){_0x4f0a41['where']=_['merge'](_0x4f0a41[_0x6b48('0x37')],{'$or':_['map'](_0xfee47c,function(_0x28e14c){if(_0x28e14c[_0x6b48('0x2b')]!==_0x6b48('0x39')){var _0x44f810={};_0x44f810[_0x28e14c[_0x6b48('0x26')]]={'$like':'%'+_0x910eae[_0x6b48('0x2e')][_0x6b48('0x38')]+'%'};return _0x44f810;}})});}_0x4f0a41=_[_0x6b48('0x3a')]({},_0x4f0a41,_0x910eae[_0x6b48('0x3b')]);var _0x6db7b1={'where':_0x4f0a41[_0x6b48('0x37')]};return db[_0x6b48('0x29')][_0x6b48('0x3c')](_0x6db7b1)[_0x6b48('0x22')](function(_0x4b69a1){_0x1931e6[_0x6b48('0x3c')]=_0x4b69a1;if(_0x910eae[_0x6b48('0x2e')]['includeAll']){_0x4f0a41[_0x6b48('0x3d')]=[{'all':!![]}];}return db[_0x6b48('0x29')][_0x6b48('0x3e')](_0x4f0a41);})[_0x6b48('0x22')](function(_0x1dcb3a){_0x1931e6[_0x6b48('0x3f')]=_0x1dcb3a;return _0x1931e6;})['then'](respondWithFilteredResult(_0x6812a3,_0x4f0a41))['catch'](handleError(_0x6812a3,null));};exports['show']=function(_0x406eb5,_0x112377){var _0x4ccb9c={'raw':!![],'where':{'id':_0x406eb5['params']['id']}},_0x146e3b={};_0x146e3b[_0x6b48('0x2d')]=_[_0x6b48('0x2f')](db['JscriptySessionReport'][_0x6b48('0x2a')]);_0x146e3b[_0x6b48('0x2e')]=_[_0x6b48('0x2f')](_0x406eb5[_0x6b48('0x2e')]);_0x146e3b['filters']=_['intersection'](_0x146e3b[_0x6b48('0x2d')],_0x146e3b[_0x6b48('0x2e')]);_0x4ccb9c[_0x6b48('0x32')]=_['intersection'](_0x146e3b[_0x6b48('0x2d')],qs[_0x6b48('0x40')](_0x406eb5['query']['fields']));_0x4ccb9c[_0x6b48('0x32')]=_0x4ccb9c[_0x6b48('0x32')][_0x6b48('0x33')]?_0x4ccb9c[_0x6b48('0x32')]:_0x146e3b[_0x6b48('0x2d')];if(_0x406eb5[_0x6b48('0x2e')][_0x6b48('0x41')]){_0x4ccb9c[_0x6b48('0x3d')]=[{'all':!![]}];}_0x4ccb9c=_['merge']({},_0x4ccb9c,_0x406eb5[_0x6b48('0x3b')]);return db[_0x6b48('0x29')]['find'](_0x4ccb9c)[_0x6b48('0x22')](handleEntityNotFound(_0x112377,null))[_0x6b48('0x22')](respondWithResult(_0x112377,null))[_0x6b48('0x42')](handleError(_0x112377,null));};exports[_0x6b48('0x43')]=function(_0x3d5ce2,_0x5e9d19){return db[_0x6b48('0x29')][_0x6b48('0x43')](_0x3d5ce2[_0x6b48('0x44')],{})[_0x6b48('0x22')](respondWithResult(_0x5e9d19,0xc9))['catch'](handleError(_0x5e9d19,null));};exports['update']=function(_0x5960c5,_0x2bd8b3){if(_0x5960c5['body']['id']){delete _0x5960c5[_0x6b48('0x44')]['id'];}return db[_0x6b48('0x29')][_0x6b48('0x45')]({'where':{'id':_0x5960c5[_0x6b48('0x46')]['id']}})[_0x6b48('0x22')](handleEntityNotFound(_0x2bd8b3,null))[_0x6b48('0x22')](saveUpdates(_0x5960c5[_0x6b48('0x44')],null))[_0x6b48('0x22')](respondWithResult(_0x2bd8b3,null))['catch'](handleError(_0x2bd8b3,null));};exports[_0x6b48('0x23')]=function(_0x3ad2a8,_0x8480f0){return db[_0x6b48('0x29')]['find']({'where':{'id':_0x3ad2a8[_0x6b48('0x46')]['id']}})[_0x6b48('0x22')](handleEntityNotFound(_0x8480f0,null))['then'](removeEntity(_0x8480f0,null))['catch'](handleError(_0x8480f0,null));};exports[_0x6b48('0x47')]=function(_0x579b4d,_0x366439){return db[_0x6b48('0x29')]['describe']()[_0x6b48('0x22')](respondWithResult(_0x366439,null))[_0x6b48('0x42')](handleError(_0x366439,null));};exports[_0x6b48('0x48')]=function(_0x594b33,_0x47cc6b,_0x1bac0d){var _0x20a3c0={'raw':!![],'where':{}};var _0x1a193c={};var _0xec79c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x6b48('0x49')]({'where':{'id':_0x594b33['params']['id']}})[_0x6b48('0x22')](handleEntityNotFound(_0x47cc6b,null))['then'](function(_0x56a37c){if(_0x56a37c){_0x1a193c[_0x6b48('0x2d')]=_[_0x6b48('0x2f')](db[_0x6b48('0x4a')][_0x6b48('0x2a')]);_0x1a193c[_0x6b48('0x2e')]=_[_0x6b48('0x2f')](_0x594b33[_0x6b48('0x2e')]);_0x1a193c['filters']=_[_0x6b48('0x31')](_0x1a193c[_0x6b48('0x2d')],_0x1a193c[_0x6b48('0x2e')]);_0x20a3c0[_0x6b48('0x32')]=_[_0x6b48('0x31')](_0x1a193c[_0x6b48('0x2d')],qs[_0x6b48('0x40')](_0x594b33[_0x6b48('0x2e')][_0x6b48('0x40')]));_0x20a3c0[_0x6b48('0x32')]=_0x20a3c0[_0x6b48('0x32')][_0x6b48('0x33')]?_0x20a3c0['attributes']:_0x1a193c['model'];if(!_0x594b33['query']['hasOwnProperty'](_0x6b48('0x4b'))){_0x20a3c0[_0x6b48('0x1d')]=qs[_0x6b48('0x1d')](_0x594b33[_0x6b48('0x2e')][_0x6b48('0x1d')]);_0x20a3c0[_0x6b48('0x1c')]=qs[_0x6b48('0x1c')](_0x594b33[_0x6b48('0x2e')][_0x6b48('0x1c')]);}_0x20a3c0[_0x6b48('0x35')]=qs[_0x6b48('0x36')](_0x594b33[_0x6b48('0x2e')]['sort']);_0x20a3c0[_0x6b48('0x37')]=qs[_0x6b48('0x30')](_[_0x6b48('0x4c')](_0x594b33['query'],_0x1a193c[_0x6b48('0x30')]));_0x20a3c0['where']['SessionId']=_0x56a37c['id'];if(_0x594b33[_0x6b48('0x2e')][_0x6b48('0x38')]){_0x20a3c0[_0x6b48('0x37')]=_[_0x6b48('0x3a')](_0x20a3c0[_0x6b48('0x37')],{'$or':_['map'](_0x20a3c0['attributes'],function(_0x45e404){var _0x43fa29={};_0x43fa29[_0x45e404]={'$like':'%'+_0x594b33[_0x6b48('0x2e')][_0x6b48('0x38')]+'%'};return _0x43fa29;})});}_0x20a3c0=_[_0x6b48('0x3a')]({},_0x20a3c0,_0x594b33['options']);return db[_0x6b48('0x4a')][_0x6b48('0x3c')]({'where':_0x20a3c0['where']})['then'](function(_0x35a02d){_0xec79c[_0x6b48('0x3c')]=_0x35a02d;if(_0x594b33[_0x6b48('0x2e')][_0x6b48('0x41')]){_0x20a3c0['include']=[{'all':!![]}];}return db[_0x6b48('0x4a')][_0x6b48('0x3e')](_0x20a3c0);})[_0x6b48('0x22')](function(_0xcef58e){_0xec79c[_0x6b48('0x3f')]=_0xcef58e;return _0xec79c;});}})[_0x6b48('0x22')](respondWithFilteredResult(_0x47cc6b,_0x20a3c0))['catch'](handleError(_0x47cc6b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 88e26b0..8346c0a 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 _0xc9c3=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','../../config/logger','moment','bluebird','request-promise'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0xc9c3,0x96));var _0x3c9c=function(_0x297771,_0x383ac3){_0x297771=_0x297771-0x0;var _0x5ea1f4=_0xc9c3[_0x297771];return _0x5ea1f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c9c('0x0'))('api');var moment=require(_0x3c9c('0x1'));var BPromise=require(_0x3c9c('0x2'));var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var attributes=require(_0x3c9c('0x7'));module['exports']=function(_0x48b219,_0x5c86bd){return _0x48b219[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':_0x3c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','api','moment'];(function(_0x4168b8,_0x5f62ff){var _0x41146e=function(_0x441b75){while(--_0x441b75){_0x4168b8['push'](_0x4168b8['shift']());}};_0x41146e(++_0x5f62ff);}(_0x6f44,0x1ea));var _0x46f4=function(_0x1bc7b9,_0x139cd1){_0x1bc7b9=_0x1bc7b9-0x0;var _0x369ecf=_0x6f44[_0x1bc7b9];return _0x369ecf;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 2b4b53d..fb266cd 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 _0x22c4=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x18f2c2,_0x435947){var _0xdabd28=function(_0x43d194){while(--_0x43d194){_0x18f2c2['push'](_0x18f2c2['shift']());}};_0xdabd28(++_0x435947);}(_0x22c4,0x1b8));var _0x422c=function(_0x1162f9,_0x35f87c){_0x1162f9=_0x1162f9-0x0;var _0x75257c=_0x22c4[_0x1162f9];return _0x75257c;};'use strict';var _=require(_0x422c('0x0'));var util=require(_0x422c('0x1'));var moment=require(_0x422c('0x2'));var BPromise=require(_0x422c('0x3'));var rs=require(_0x422c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x422c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x422c('0x6'))('rpc');var config=require(_0x422c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7659f1,_0x79cbb2,_0x2bb16f){return new BPromise(function(_0x17db21,_0x51e1df){return client[_0x422c('0x8')](_0x7659f1,_0x2bb16f)[_0x422c('0x9')](function(_0x437349){logger[_0x422c('0xa')](_0x422c('0xb'),_0x79cbb2,'request\x20sent');logger[_0x422c('0xc')](_0x422c('0xd'),_0x79cbb2,_0x422c('0xe'),JSON[_0x422c('0xf')](_0x437349));if(_0x437349[_0x422c('0x10')]){if(_0x437349[_0x422c('0x10')]['code']===0x1f4){logger[_0x422c('0x10')](_0x422c('0xb'),_0x79cbb2,_0x437349[_0x422c('0x10')][_0x422c('0x11')]);return _0x51e1df(_0x437349['error']['message']);}logger[_0x422c('0x10')](_0x422c('0xb'),_0x79cbb2,_0x437349[_0x422c('0x10')][_0x422c('0x11')]);return _0x17db21(_0x437349[_0x422c('0x10')][_0x422c('0x11')]);}else{logger[_0x422c('0xa')](_0x422c('0xb'),_0x79cbb2,_0x422c('0xe'));_0x17db21(_0x437349[_0x422c('0x12')][_0x422c('0x11')]);}})[_0x422c('0x13')](function(_0x542882){logger[_0x422c('0x10')](_0x422c('0xb'),_0x79cbb2,_0x542882);_0x51e1df(_0x542882);});});} \ No newline at end of file +var _0xe74e=['../../config/logger','rpc','../../config/environment','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28a6ad,_0x351697){var _0xbb804=function(_0x165d37){while(--_0x165d37){_0x28a6ad['push'](_0x28a6ad['shift']());}};_0xbb804(++_0x351697);}(_0xe74e,0x10a));var _0xee74=function(_0x500abc,_0x532cbf){_0x500abc=_0x500abc-0x0;var _0x268b6d=_0xe74e[_0x500abc];return _0x268b6d;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var moment=require(_0xee74('0x1'));var BPromise=require(_0xee74('0x2'));var rs=require(_0xee74('0x3'));var fs=require('fs');var Redis=require(_0xee74('0x4'));var db=require(_0xee74('0x5'))['db'];var utils=require(_0xee74('0x6'));var logger=require(_0xee74('0x7'))(_0xee74('0x8'));var config=require(_0xee74('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242ac6,_0x539a7b,_0x58fa11){return new BPromise(function(_0x11c67e,_0x21043c){return client[_0xee74('0xb')](_0x242ac6,_0x58fa11)['then'](function(_0x48cdb0){logger[_0xee74('0xc')](_0xee74('0xd'),_0x539a7b,_0xee74('0xe'));logger[_0xee74('0xf')](_0xee74('0x10'),_0x539a7b,_0xee74('0xe'),JSON['stringify'](_0x48cdb0));if(_0x48cdb0[_0xee74('0x11')]){if(_0x48cdb0[_0xee74('0x11')][_0xee74('0x12')]===0x1f4){logger[_0xee74('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x539a7b,_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);return _0x21043c(_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);}logger['error'](_0xee74('0xd'),_0x539a7b,_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);return _0x11c67e(_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);}else{logger[_0xee74('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x539a7b,_0xee74('0xe'));_0x11c67e(_0x48cdb0[_0xee74('0x14')][_0xee74('0x13')]);}})['catch'](function(_0x988fb5){logger[_0xee74('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x539a7b,_0x988fb5);_0x21043c(_0x988fb5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b43ce8e..1b62593 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 _0xc0ba=['/:id','isAuthenticated','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','index','put'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xc0ba,0x6c));var _0xac0b=function(_0x27ab58,_0x48c638){_0x27ab58=_0x27ab58-0x0;var _0x3daff0=_0xc0ba[_0x27ab58];return _0x3daff0;};'use strict';var multer=require('multer');var util=require(_0xac0b('0x0'));var path=require('path');var timeout=require(_0xac0b('0x1'));var express=require(_0xac0b('0x2'));var router=express[_0xac0b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xac0b('0x4'));var config=require(_0xac0b('0x5'));var controller=require(_0xac0b('0x6'));router['get']('/',controller[_0xac0b('0x7')]);router[_0xac0b('0x8')](_0xac0b('0x9'),auth[_0xac0b('0xa')](),controller[_0xac0b('0xb')]);module[_0xac0b('0xc')]=router; \ No newline at end of file +var _0x9ca8=['exports','multer','util','path','connect-timeout','../../components/auth/service','./license.controller','get','index','/:id','update'];(function(_0x21e29b,_0x47dd45){var _0x28f11e=function(_0xb91b0d){while(--_0xb91b0d){_0x21e29b['push'](_0x21e29b['shift']());}};_0x28f11e(++_0x47dd45);}(_0x9ca8,0xb1));var _0x89ca=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x9ca8[_0x418549];return _0x288826;};'use strict';var multer=require(_0x89ca('0x0'));var util=require(_0x89ca('0x1'));var path=require(_0x89ca('0x2'));var timeout=require(_0x89ca('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x89ca('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89ca('0x5'));router[_0x89ca('0x6')]('/',controller[_0x89ca('0x7')]);router['put'](_0x89ca('0x8'),auth['isAuthenticated'](),controller[_0x89ca('0x9')]);module[_0x89ca('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 3cb67b0..07ac8c8 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 _0x4819=['INTEGER','exports','TEXT','STRING'];(function(_0x424d86,_0x3d932e){var _0x25f529=function(_0x308e45){while(--_0x308e45){_0x424d86['push'](_0x424d86['shift']());}};_0x25f529(++_0x3d932e);}(_0x4819,0xcd));var _0x9481=function(_0x1c1913,_0x1d1b59){_0x1c1913=_0x1c1913-0x0;var _0x3b352a=_0x4819[_0x1c1913];return _0x3b352a;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'license':{'type':Sequelize[_0x9481('0x1')]},'data1':{'type':Sequelize[_0x9481('0x2')]},'data2':{'type':Sequelize[_0x9481('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9481('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2675=['sequelize','STRING','INTEGER'];(function(_0x157fdf,_0x255a37){var _0x4faa13=function(_0x188f62){while(--_0x188f62){_0x157fdf['push'](_0x157fdf['shift']());}};_0x4faa13(++_0x255a37);}(_0x2675,0x75));var _0x5267=function(_0x2e997d,_0x460edc){_0x2e997d=_0x2e997d-0x0;var _0x325930=_0x2675[_0x2e997d];return _0x325930;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5267('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5267('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 9cea694..ea23b97 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 _0xa711=['destroy','stack','name','send','../../config/license/util','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','merge','options','getLicense','catch','body','params','get','checkLicense','key','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','set','json','apply','reject','save','update','then'];(function(_0x828470,_0x7c21c6){var _0x149f7c=function(_0x5d0497){while(--_0x5d0497){_0x828470['push'](_0x828470['shift']());}};_0x149f7c(++_0x7c21c6);}(_0xa711,0xbf));var _0x1a71=function(_0x2731d3,_0x3ead2b){_0x2731d3=_0x2731d3-0x0;var _0x397f85=_0xa711[_0x2731d3];return _0x397f85;};'use strict';var pdf=require(_0x1a71('0x0'));var emlformat=require(_0x1a71('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1a71('0x2'));var jsonpatch=require(_0x1a71('0x3'));var rp=require(_0x1a71('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a71('0x5'));var path=require('path');var sox=require(_0x1a71('0x6'));var csv=require(_0x1a71('0x7'));var ejs=require(_0x1a71('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1a71('0x9'));var crypto=require(_0x1a71('0xa'));var jsforce=require(_0x1a71('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1a71('0x7'));var querystring=require('querystring');var Papa=require(_0x1a71('0xc'));var Redis=require(_0x1a71('0xd'));var authService=require(_0x1a71('0xe'));var qs=require(_0x1a71('0xf'));var as=require(_0x1a71('0x10'));var hardwareService=require(_0x1a71('0x11'));var logger=require(_0x1a71('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1a71('0x13'));var db=require(_0x1a71('0x14'))['db'];function respondWithStatusCode(_0x456497,_0x2cb088){_0x2cb088=_0x2cb088||0xcc;return function(_0x392120){if(_0x392120){return _0x456497[_0x1a71('0x15')](_0x2cb088);}return _0x456497['status'](_0x2cb088)[_0x1a71('0x16')]();};}function respondWithResult(_0x150dc7,_0x1359b2){_0x1359b2=_0x1359b2||0xc8;return function(_0x13a380){if(_0x13a380){return _0x150dc7['status'](_0x1359b2)['json'](_0x13a380);}};}function respondWithFilteredResult(_0x3e73d2,_0x5b3fde){return function(_0x46b91f){if(_0x46b91f){var _0x3a8b25=_0x46b91f[_0x1a71('0x17')],_0x4971da=_0x5b3fde['offset'],_0x147189=_0x5b3fde[_0x1a71('0x18')]+_0x5b3fde['limit'],_0x4188b3;if(_0x147189>=_0x3a8b25){_0x147189=_0x3a8b25;_0x4188b3=0xc8;}else{_0x4188b3=0xce;}_0x3e73d2[_0x1a71('0x19')](_0x4188b3);return _0x3e73d2[_0x1a71('0x1a')]('Content-Range',_0x4971da+'-'+_0x147189+'/'+_0x3a8b25)[_0x1a71('0x1b')](_0x46b91f);}return null;};}function patchUpdates(_0x52a659){return function(_0x24d2ea){try{jsonpatch[_0x1a71('0x1c')](_0x24d2ea,_0x52a659,!![]);}catch(_0x436da3){return BPromise[_0x1a71('0x1d')](_0x436da3);}return _0x24d2ea[_0x1a71('0x1e')]();};}function saveUpdates(_0x4b8a06,_0x5a1bb9){return function(_0x452115){if(_0x452115){return _0x452115[_0x1a71('0x1f')](_0x4b8a06)[_0x1a71('0x20')](function(_0x4c2129){return _0x4c2129;});}return null;};}function removeEntity(_0x3dae70,_0x1d59e5){return function(_0xd40dd0){if(_0xd40dd0){return _0xd40dd0[_0x1a71('0x21')]()[_0x1a71('0x20')](function(){_0x3dae70[_0x1a71('0x19')](0xcc)[_0x1a71('0x16')]();});}};}function handleEntityNotFound(_0x1e5d55,_0x20060f){return function(_0x170213){if(!_0x170213){_0x1e5d55[_0x1a71('0x15')](0x194);}return _0x170213;};}function handleError(_0x3f1ebf,_0x2fdbee){_0x2fdbee=_0x2fdbee||0x1f4;return function(_0x5bfac3){logger['error'](_0x5bfac3[_0x1a71('0x22')]);if(_0x5bfac3[_0x1a71('0x23')]){delete _0x5bfac3[_0x1a71('0x23')];}_0x3f1ebf['status'](_0x2fdbee)[_0x1a71('0x24')](_0x5bfac3);};}var utilLicense=require(_0x1a71('0x25'));exports[_0x1a71('0x26')]=function(_0xfabbd9,_0x427413){var _0x2551de={'raw':!![],'where':{'id':0x1}},_0x4e84ac={};_0x4e84ac[_0x1a71('0x27')]=_[_0x1a71('0x28')](db['License'][_0x1a71('0x29')]);_0x4e84ac[_0x1a71('0x2a')]=_[_0x1a71('0x28')](_0xfabbd9[_0x1a71('0x2a')]);_0x4e84ac[_0x1a71('0x2b')]=_[_0x1a71('0x2c')](_0x4e84ac[_0x1a71('0x27')],_0x4e84ac['query']);_0x2551de['attributes']=_[_0x1a71('0x2c')](_0x4e84ac[_0x1a71('0x27')],qs[_0x1a71('0x2d')](_0xfabbd9['query'][_0x1a71('0x2d')]));_0x2551de[_0x1a71('0x2e')]=_0x2551de[_0x1a71('0x2e')]['length']?_0x2551de[_0x1a71('0x2e')]:_0x4e84ac['model'];_0x2551de=_[_0x1a71('0x2f')]({},_0x2551de,_0xfabbd9[_0x1a71('0x30')]);return utilLicense[_0x1a71('0x31')](_0x2551de)[_0x1a71('0x20')](respondWithResult(_0x427413,null))[_0x1a71('0x32')](handleError(_0x427413,null));};exports[_0x1a71('0x1f')]=function(_0x1ceb42,_0x34d8db){if(_0x1ceb42[_0x1a71('0x33')]['id']){delete _0x1ceb42[_0x1a71('0x33')]['id'];}return db['License']['find']({'where':{'id':_0x1ceb42[_0x1a71('0x34')]['id']}})['then'](handleEntityNotFound(_0x34d8db,null))['then'](function(_0x194a40){var _0x4a740d=_0x194a40[_0x1a71('0x35')]({'plain':!![]});return utilLicense[_0x1a71('0x36')](_0x4a740d,_0x1ceb42['body'][_0x1a71('0x37')]);})[_0x1a71('0x20')](function(_0x1957a6){if(!_0x1957a6['demo']){return saveUpdates(_0x1ceb42[_0x1a71('0x33')],null);}return _0x1957a6;})[_0x1a71('0x20')](respondWithResult(_0x34d8db,null))['catch'](handleError(_0x34d8db,null));}; \ No newline at end of file +var _0xb439=['catch','body','License','find','params','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','count','offset','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','../../config/license/util','index','model','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense'];(function(_0x2848d6,_0x1376f8){var _0x14eca6=function(_0x4c4027){while(--_0x4c4027){_0x2848d6['push'](_0x2848d6['shift']());}};_0x14eca6(++_0x1376f8);}(_0xb439,0x152));var _0x9b43=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb439[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x9b43('0x0'));var emlformat=require(_0x9b43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9b43('0x2'));var jsonpatch=require(_0x9b43('0x3'));var rp=require(_0x9b43('0x4'));var moment=require('moment');var BPromise=require(_0x9b43('0x5'));var Mustache=require(_0x9b43('0x6'));var util=require(_0x9b43('0x7'));var path=require(_0x9b43('0x8'));var sox=require('sox');var csv=require(_0x9b43('0x9'));var ejs=require(_0x9b43('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9b43('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9b43('0xc'));var toCsv=require(_0x9b43('0x9'));var querystring=require(_0x9b43('0xd'));var Papa=require('papaparse');var Redis=require(_0x9b43('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9b43('0xf'));var as=require(_0x9b43('0x10'));var hardwareService=require(_0x9b43('0x11'));var logger=require(_0x9b43('0x12'))(_0x9b43('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120411,_0x2870f3){_0x2870f3=_0x2870f3||0xcc;return function(_0x48645b){if(_0x48645b){return _0x120411['sendStatus'](_0x2870f3);}return _0x120411[_0x9b43('0x14')](_0x2870f3)['end']();};}function respondWithResult(_0x5e5d30,_0x4eb34f){_0x4eb34f=_0x4eb34f||0xc8;return function(_0x511d66){if(_0x511d66){return _0x5e5d30[_0x9b43('0x14')](_0x4eb34f)[_0x9b43('0x15')](_0x511d66);}};}function respondWithFilteredResult(_0x1b5aee,_0x404156){return function(_0x3f4dd5){if(_0x3f4dd5){var _0x3d2a36=_0x3f4dd5[_0x9b43('0x16')],_0x172595=_0x404156[_0x9b43('0x17')],_0x2d7756=_0x404156[_0x9b43('0x17')]+_0x404156['limit'],_0x4f04b9;if(_0x2d7756>=_0x3d2a36){_0x2d7756=_0x3d2a36;_0x4f04b9=0xc8;}else{_0x4f04b9=0xce;}_0x1b5aee[_0x9b43('0x14')](_0x4f04b9);return _0x1b5aee['set'](_0x9b43('0x18'),_0x172595+'-'+_0x2d7756+'/'+_0x3d2a36)['json'](_0x3f4dd5);}return null;};}function patchUpdates(_0x546a29){return function(_0x41f2cd){try{jsonpatch[_0x9b43('0x19')](_0x41f2cd,_0x546a29,!![]);}catch(_0x6923c1){return BPromise[_0x9b43('0x1a')](_0x6923c1);}return _0x41f2cd['save']();};}function saveUpdates(_0x36cee0,_0x104242){return function(_0x38e52f){if(_0x38e52f){return _0x38e52f[_0x9b43('0x1b')](_0x36cee0)[_0x9b43('0x1c')](function(_0x298ac1){return _0x298ac1;});}return null;};}function removeEntity(_0x4c0313,_0xc9e11a){return function(_0x3f2e13){if(_0x3f2e13){return _0x3f2e13['destroy']()[_0x9b43('0x1c')](function(){_0x4c0313['status'](0xcc)[_0x9b43('0x1d')]();});}};}function handleEntityNotFound(_0x432d7e,_0x413108){return function(_0x29f3c8){if(!_0x29f3c8){_0x432d7e[_0x9b43('0x1e')](0x194);}return _0x29f3c8;};}function handleError(_0x497bad,_0x581f8c){_0x581f8c=_0x581f8c||0x1f4;return function(_0x1577f9){logger[_0x9b43('0x1f')](_0x1577f9[_0x9b43('0x20')]);if(_0x1577f9[_0x9b43('0x21')]){delete _0x1577f9[_0x9b43('0x21')];}_0x497bad[_0x9b43('0x14')](_0x581f8c)['send'](_0x1577f9);};}var utilLicense=require(_0x9b43('0x22'));exports[_0x9b43('0x23')]=function(_0x1226f5,_0x436bbd){var _0x46a6da={'raw':!![],'where':{'id':0x1}},_0x411e1f={};_0x411e1f[_0x9b43('0x24')]=_['keys'](db['License'][_0x9b43('0x25')]);_0x411e1f[_0x9b43('0x26')]=_['keys'](_0x1226f5[_0x9b43('0x26')]);_0x411e1f[_0x9b43('0x27')]=_[_0x9b43('0x28')](_0x411e1f['model'],_0x411e1f[_0x9b43('0x26')]);_0x46a6da[_0x9b43('0x29')]=_[_0x9b43('0x28')](_0x411e1f['model'],qs[_0x9b43('0x2a')](_0x1226f5[_0x9b43('0x26')][_0x9b43('0x2a')]));_0x46a6da[_0x9b43('0x29')]=_0x46a6da[_0x9b43('0x29')][_0x9b43('0x2b')]?_0x46a6da[_0x9b43('0x29')]:_0x411e1f['model'];_0x46a6da=_[_0x9b43('0x2c')]({},_0x46a6da,_0x1226f5[_0x9b43('0x2d')]);return utilLicense[_0x9b43('0x2e')](_0x46a6da)[_0x9b43('0x1c')](respondWithResult(_0x436bbd,null))[_0x9b43('0x2f')](handleError(_0x436bbd,null));};exports[_0x9b43('0x1b')]=function(_0x12e8b5,_0x431604){if(_0x12e8b5[_0x9b43('0x30')]['id']){delete _0x12e8b5[_0x9b43('0x30')]['id'];}return db[_0x9b43('0x31')][_0x9b43('0x32')]({'where':{'id':_0x12e8b5[_0x9b43('0x33')]['id']}})[_0x9b43('0x1c')](handleEntityNotFound(_0x431604,null))[_0x9b43('0x1c')](function(_0x4b64b6){var _0x58f200=_0x4b64b6['get']({'plain':!![]});return utilLicense[_0x9b43('0x34')](_0x58f200,_0x12e8b5[_0x9b43('0x30')][_0x9b43('0x35')]);})[_0x9b43('0x1c')](function(_0x4ecd38){if(!_0x4ecd38[_0x9b43('0x36')]){return saveUpdates(_0x12e8b5[_0x9b43('0x30')],null);}return _0x4ecd38;})[_0x9b43('0x1c')](respondWithResult(_0x431604,null))['catch'](handleError(_0x431604,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 395e9d5..f36a195 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(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb10b,0x12a));var _0xbb10=function(_0x33711e,_0x57999f){_0x33711e=_0x33711e-0x0;var _0x5816e3=_0xb10b[_0x33711e];return _0x5816e3;};'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 _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2090b7,_0x21e78d){var _0x2ad7d5=function(_0x2e906e){while(--_0x2e906e){_0x2090b7['push'](_0x2090b7['shift']());}};_0x2ad7d5(++_0x21e78d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index d11c084..bec7132 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 _0x93e6=['error','code','message','info','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x820307,_0x33406b){var _0x551324=function(_0x1f1e54){while(--_0x1f1e54){_0x820307['push'](_0x820307['shift']());}};_0x551324(++_0x33406b);}(_0x93e6,0x11e));var _0x693e=function(_0x503d00,_0x323df1){_0x503d00=_0x503d00-0x0;var _0x2263d8=_0x93e6[_0x503d00];return _0x2263d8;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x693e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x693e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x693e('0x3'));var logger=require(_0x693e('0x4'))(_0x693e('0x5'));var config=require('../../config/environment');var jayson=require(_0x693e('0x6'));var client=jayson[_0x693e('0x7')][_0x693e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x520113,_0x577dcb,_0x57897c){return new BPromise(function(_0x155601,_0x4b30f6){return client[_0x693e('0x9')](_0x520113,_0x57897c)[_0x693e('0xa')](function(_0x14b901){logger['info'](_0x693e('0xb'),_0x577dcb,'request\x20sent');logger[_0x693e('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x577dcb,_0x693e('0xd'),JSON['stringify'](_0x14b901));if(_0x14b901['error']){if(_0x14b901[_0x693e('0xe')][_0x693e('0xf')]===0x1f4){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901['error'][_0x693e('0x10')]);return _0x4b30f6(_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);}logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);return _0x155601(_0x14b901['error'][_0x693e('0x10')]);}else{logger[_0x693e('0x11')](_0x693e('0xb'),_0x577dcb,'request\x20sent');_0x155601(_0x14b901[_0x693e('0x12')][_0x693e('0x10')]);}})[_0x693e('0x13')](function(_0xb3a90a){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0xb3a90a);_0x4b30f6(_0xb3a90a);});});} \ No newline at end of file +var _0x115a=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x1ccd8a,_0x5bf417){var _0x5a69d8=function(_0x336fdb){while(--_0x336fdb){_0x1ccd8a['push'](_0x1ccd8a['shift']());}};_0x5a69d8(++_0x5bf417);}(_0x115a,0x91));var _0xa115=function(_0x241214,_0x458410){_0x241214=_0x241214-0x0;var _0x12f2df=_0x115a[_0x241214];return _0x12f2df;};'use strict';var _=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var moment=require(_0xa115('0x2'));var BPromise=require(_0xa115('0x3'));var rs=require(_0xa115('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')][_0xa115('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567cb3,_0x2499eb,_0x149d01){return new BPromise(function(_0x291bec,_0x2a7527){return client[_0xa115('0xc')](_0x567cb3,_0x149d01)[_0xa115('0xd')](function(_0xd6f607){logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));logger[_0xa115('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x2499eb,_0xa115('0x10'),JSON[_0xa115('0x12')](_0xd6f607));if(_0xd6f607[_0xa115('0x13')]){if(_0xd6f607[_0xa115('0x13')]['code']===0x1f4){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x2a7527(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}logger[_0xa115('0x13')]('License,\x20%s,\x20%s',_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x291bec(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}else{logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));_0x291bec(_0xd6f607[_0xa115('0x15')][_0xa115('0x14')]);}})[_0xa115('0x16')](function(_0x30c06b){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0x30c06b);_0x2a7527(_0x30c06b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 675f58a..7cc6bd8 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 _0x7fbd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','getApplications','/:id/messages','/:id/verify','/:id/users','getAgents','post','/:id/dispositions','addDisposition','create','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x7fbd,0xa7));var _0xd7fb=function(_0x2eab1d,_0x54edd4){_0x2eab1d=_0x2eab1d-0x0;var _0x37cfed=_0x7fbd[_0x2eab1d];return _0x37cfed;};'use strict';var multer=require('multer');var util=require(_0xd7fb('0x0'));var path=require(_0xd7fb('0x1'));var timeout=require(_0xd7fb('0x2'));var express=require(_0xd7fb('0x3'));var router=express[_0xd7fb('0x4')]();var auth=require(_0xd7fb('0x5'));var interaction=require(_0xd7fb('0x6'));var config=require(_0xd7fb('0x7'));var controller=require(_0xd7fb('0x8'));router[_0xd7fb('0x9')]('/',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0xb')]);router['get']('/describe',auth[_0xd7fb('0xa')](),controller['describe']);router[_0xd7fb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd7fb('0xc')]);router[_0xd7fb('0x9')]('/:id/dispositions',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0xd')]);router[_0xd7fb('0x9')](_0xd7fb('0xe'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0xf')]);router[_0xd7fb('0x9')](_0xd7fb('0x10'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x11')]);router[_0xd7fb('0x9')](_0xd7fb('0x12'),auth[_0xd7fb('0xa')](),controller['getSmtp']);router[_0xd7fb('0x9')]('/:id/interactions',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x13')]);router[_0xd7fb('0x9')]('/:id/applications',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x14')]);router['get'](_0xd7fb('0x15'),auth[_0xd7fb('0xa')](),controller['getMessages']);router[_0xd7fb('0x9')](_0xd7fb('0x16'),auth[_0xd7fb('0xa')](),controller['verifySmtp']);router[_0xd7fb('0x9')](_0xd7fb('0x17'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x18')]);router[_0xd7fb('0x19')](_0xd7fb('0x1a'),auth['isAuthenticated'](),controller[_0xd7fb('0x1b')]);router[_0xd7fb('0x19')](_0xd7fb('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xd7fb('0x19')]('/',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x1c')]);router[_0xd7fb('0x19')](_0xd7fb('0x10'),auth[_0xd7fb('0xa')](),controller['addImap']);router[_0xd7fb('0x19')](_0xd7fb('0x12'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x1d')]);router[_0xd7fb('0x19')](_0xd7fb('0x1e'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x1f')]);router[_0xd7fb('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd7fb('0x20')]);router[_0xd7fb('0x19')](_0xd7fb('0x21'),auth[_0xd7fb('0xa')](),controller['send']);router[_0xd7fb('0x19')](_0xd7fb('0x17'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x22')]);router[_0xd7fb('0x23')]('/:id',auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x24')]);router[_0xd7fb('0x25')](_0xd7fb('0x1a'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x26')]);router[_0xd7fb('0x25')](_0xd7fb('0xe'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x27')]);router[_0xd7fb('0x25')](_0xd7fb('0x10'),auth['isAuthenticated'](),controller[_0xd7fb('0x28')]);router[_0xd7fb('0x25')]('/:id/out_servers',auth[_0xd7fb('0xa')](),controller['removeSmtp']);router[_0xd7fb('0x25')]('/:id',auth[_0xd7fb('0xa')](),controller['destroy']);router[_0xd7fb('0x25')](_0xd7fb('0x17'),auth[_0xd7fb('0xa')](),controller[_0xd7fb('0x29')]);module[_0xd7fb('0x2a')]=router; \ No newline at end of file +var _0x63b9=['isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','/:id','update','removeDispositions','removeAnswers','delete','removeImap','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','get'];(function(_0x327905,_0x3a5af7){var _0x4b8ba6=function(_0x4a5c43){while(--_0x4a5c43){_0x327905['push'](_0x327905['shift']());}};_0x4b8ba6(++_0x3a5af7);}(_0x63b9,0xdb));var _0x963b=function(_0x12d4b7,_0x29cc5d){_0x12d4b7=_0x12d4b7-0x0;var _0x379644=_0x63b9[_0x12d4b7];return _0x379644;};'use strict';var multer=require(_0x963b('0x0'));var util=require(_0x963b('0x1'));var path=require('path');var timeout=require(_0x963b('0x2'));var express=require(_0x963b('0x3'));var router=express[_0x963b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x963b('0x5')]('/',auth[_0x963b('0x6')](),controller[_0x963b('0x7')]);router[_0x963b('0x5')](_0x963b('0x8'),auth[_0x963b('0x6')](),controller[_0x963b('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x963b('0xa')]);router[_0x963b('0x5')](_0x963b('0xb'),auth['isAuthenticated'](),controller[_0x963b('0xc')]);router[_0x963b('0x5')](_0x963b('0xd'),auth['isAuthenticated'](),controller[_0x963b('0xe')]);router[_0x963b('0x5')]('/:id/in_servers',auth[_0x963b('0x6')](),controller[_0x963b('0xf')]);router[_0x963b('0x5')](_0x963b('0x10'),auth[_0x963b('0x6')](),controller[_0x963b('0x11')]);router['get'](_0x963b('0x12'),auth[_0x963b('0x6')](),controller[_0x963b('0x13')]);router['get'](_0x963b('0x14'),auth[_0x963b('0x6')](),controller['getApplications']);router[_0x963b('0x5')](_0x963b('0x15'),auth[_0x963b('0x6')](),controller[_0x963b('0x16')]);router['get'](_0x963b('0x17'),auth[_0x963b('0x6')](),controller[_0x963b('0x18')]);router[_0x963b('0x5')]('/:id/users',auth[_0x963b('0x6')](),controller[_0x963b('0x19')]);router[_0x963b('0x1a')]('/:id/dispositions',auth[_0x963b('0x6')](),controller['addDisposition']);router['post'](_0x963b('0xd'),auth['isAuthenticated'](),controller[_0x963b('0x1b')]);router[_0x963b('0x1a')]('/',auth[_0x963b('0x6')](),controller['create']);router[_0x963b('0x1a')](_0x963b('0x1c'),auth[_0x963b('0x6')](),controller[_0x963b('0x1d')]);router[_0x963b('0x1a')](_0x963b('0x10'),auth[_0x963b('0x6')](),controller[_0x963b('0x1e')]);router['post'](_0x963b('0x12'),auth[_0x963b('0x6')](),controller[_0x963b('0x1f')]);router[_0x963b('0x1a')](_0x963b('0x14'),auth[_0x963b('0x6')](),controller[_0x963b('0x20')]);router[_0x963b('0x1a')](_0x963b('0x21'),auth[_0x963b('0x6')](),controller[_0x963b('0x22')]);router[_0x963b('0x1a')]('/:id/users',auth[_0x963b('0x6')](),controller['addAgents']);router[_0x963b('0x23')](_0x963b('0x24'),auth['isAuthenticated'](),controller[_0x963b('0x25')]);router['delete'](_0x963b('0xb'),auth[_0x963b('0x6')](),controller[_0x963b('0x26')]);router['delete'](_0x963b('0xd'),auth[_0x963b('0x6')](),controller[_0x963b('0x27')]);router[_0x963b('0x28')](_0x963b('0x1c'),auth['isAuthenticated'](),controller[_0x963b('0x29')]);router[_0x963b('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller['removeSmtp']);router[_0x963b('0x28')](_0x963b('0x24'),auth[_0x963b('0x6')](),controller['destroy']);router[_0x963b('0x28')](_0x963b('0x2a'),auth[_0x963b('0x6')](),controller[_0x963b('0x2b')]);module[_0x963b('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e945a7d..2070e64 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 _0xb945=['Arial,Helvetica,sans-serif','INTEGER','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','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x56e160,_0xd392b2){var _0x51ce6c=function(_0x31cd9b){while(--_0x31cd9b){_0x56e160['push'](_0x56e160['shift']());}};_0x51ce6c(++_0xd392b2);}(_0xb945,0x8a));var _0x5b94=function(_0x12b8a3,_0x1e7210){_0x12b8a3=_0x12b8a3-0x0;var _0x21f317=_0xb945[_0x12b8a3];return _0x21f317;};'use strict';var Sequelize=require(_0x5b94('0x0'));module[_0x5b94('0x1')]={'description':{'type':Sequelize[_0x5b94('0x2')]},'name':{'type':Sequelize[_0x5b94('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5b94('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x5b94('0x4')]},'markAsUnread':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5b94('0x5')},'fontSize':{'type':Sequelize[_0x5b94('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5b94('0x7');}},'notificationSound':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5b94('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b94('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5b94('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5b94('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30af36){if(!_0x30af36)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5b94('0x9')](_0x5b94('0xa'),_0x30af36);}}}; \ No newline at end of file +var _0xf841=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0xf841,0x1a9));var _0x1f84=function(_0x224067,_0xe73c38){_0x224067=_0x224067-0x0;var _0x4af627=_0xf841[_0x224067];return _0x4af627;};'use strict';var Sequelize=require(_0x1f84('0x0'));module[_0x1f84('0x1')]={'description':{'type':Sequelize[_0x1f84('0x2')]},'name':{'type':Sequelize[_0x1f84('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1f84('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1f84('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f84('0x4')},'fontSize':{'type':Sequelize[_0x1f84('0x5')](0x2)[_0x1f84('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1f84('0x7')],'defaultValue':function(){return _0x1f84('0x8');}},'notificationSound':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1f84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f84('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x1f84('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1f84('0x3')],'defaultValue':![],'comment':_0x1f84('0xa'),'set':function(_0x6e7e2){if(!_0x6e7e2)this[_0x1f84('0xb')](_0x1f84('0xc'),null);this[_0x1f84('0xb')](_0x1f84('0xd'),_0x6e7e2);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 36e1ea1..02db39f 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 _0x6188=['bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','MailAccounts','UserProfileResource','name','send','MailServerIn','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','MailServerOut','include','find','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','ListId','isNil','active','description','cservice','user','cuser','pass','cpassword','authentication','host','port','service','password','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','getSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication'];(function(_0x4c6a7f,_0x452cf6){var _0x1a5474=function(_0x5531ee){while(--_0x5531ee){_0x4c6a7f['push'](_0x4c6a7f['shift']());}};_0x1a5474(++_0x452cf6);}(_0x6188,0x1af));var _0x8618=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x6188[_0x5db313];return _0x36d503;};'use strict';var pdf=require(_0x8618('0x0'));var emlformat=require(_0x8618('0x1'));var rimraf=require(_0x8618('0x2'));var zipdir=require(_0x8618('0x3'));var jsonpatch=require(_0x8618('0x4'));var rp=require(_0x8618('0x5'));var moment=require(_0x8618('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8618('0x7'));var util=require('util');var path=require(_0x8618('0x8'));var sox=require(_0x8618('0x9'));var csv=require(_0x8618('0xa'));var ejs=require(_0x8618('0xb'));var fs=require('fs');var _=require(_0x8618('0xc'));var squel=require('squel');var crypto=require(_0x8618('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8618('0xe'));var toCsv=require(_0x8618('0xa'));var querystring=require(_0x8618('0xf'));var Papa=require('papaparse');var Redis=require(_0x8618('0x10'));var authService=require(_0x8618('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8618('0x12'));var hardwareService=require(_0x8618('0x13'));var logger=require('../../config/logger')(_0x8618('0x14'));var utils=require('../../config/utils');var config=require(_0x8618('0x15'));var db=require('../../mysqldb')['db'];config[_0x8618('0x16')]=_[_0x8618('0x17')](config[_0x8618('0x16')],{'host':_0x8618('0x18'),'port':0x18eb});var socket=require(_0x8618('0x19'))(new Redis(config[_0x8618('0x16')]));require('./mailAccount.socket')[_0x8618('0x1a')](socket);var jayson=require(_0x8618('0x1b'));var client=jayson[_0x8618('0x1c')][_0x8618('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x5cca72,_0x4a4c7b,_0x28b8e5){if(_0x28b8e5){var _0xa38bec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa38bec['test'](_0x4a4c7b)){return _0x5cca72;}else{throw new db['Sequelize'][(_0x8618('0x1e'))](_0x8618('0x1f'));}}else{return _0x5cca72;}}function respondWithRpcPromise(_0x581341,_0x1ed17c,_0x33c301,_0x2fa10a){return new BPromise(function(_0xcb9890,_0x341b12){var _0x356341=_0x2fa10a||client;return _0x356341[_0x8618('0x20')](_0x581341,_0x33c301)['then'](function(_0x52c683){logger[_0x8618('0x21')](_0x8618('0x22'),_0x1ed17c,_0x8618('0x23'));logger[_0x8618('0x24')](_0x8618('0x25'),_0x1ed17c,_0x8618('0x23'),JSON['stringify'](_0x52c683));if(_0x52c683[_0x8618('0x26')]){if(_0x52c683[_0x8618('0x26')][_0x8618('0x27')]===0x1f4){logger[_0x8618('0x26')](_0x8618('0x22'),_0x1ed17c,_0x52c683[_0x8618('0x26')][_0x8618('0x28')]);return _0x341b12(_0x52c683['error'][_0x8618('0x28')]);}logger[_0x8618('0x26')](_0x8618('0x22'),_0x1ed17c,_0x52c683['error']['message']);return _0xcb9890(_0x52c683['error'][_0x8618('0x28')]);}else{logger[_0x8618('0x21')]('MailAccount,\x20%s,\x20%s',_0x1ed17c,_0x8618('0x23'));_0xcb9890(_0x52c683['result'][_0x8618('0x28')]);}})[_0x8618('0x29')](function(_0x5e6731){logger[_0x8618('0x26')](_0x8618('0x22'),_0x1ed17c,_0x5e6731);_0x341b12(_0x5e6731);});});}function respondWithStatusCode(_0x522330,_0x24d4c9){_0x24d4c9=_0x24d4c9||0xcc;return function(_0x57ca4d){if(_0x57ca4d){return _0x522330[_0x8618('0x2a')](_0x24d4c9);}return _0x522330['status'](_0x24d4c9)[_0x8618('0x2b')]();};}function respondWithResult(_0x44c5f6,_0x31a64a){_0x31a64a=_0x31a64a||0xc8;return function(_0x3f931c){if(_0x3f931c){return _0x44c5f6[_0x8618('0x2c')](_0x31a64a)[_0x8618('0x2d')](_0x3f931c);}};}function respondWithFilteredResult(_0x3dd2d3,_0x397655){return function(_0x304c38){if(_0x304c38){var _0x50acd7=_0x304c38[_0x8618('0x2e')],_0xacc0df=_0x397655[_0x8618('0x2f')],_0x10187f=_0x397655['offset']+_0x397655[_0x8618('0x30')],_0x221ee7;if(_0x10187f>=_0x50acd7){_0x10187f=_0x50acd7;_0x221ee7=0xc8;}else{_0x221ee7=0xce;}_0x3dd2d3[_0x8618('0x2c')](_0x221ee7);return _0x3dd2d3[_0x8618('0x31')](_0x8618('0x32'),_0xacc0df+'-'+_0x10187f+'/'+_0x50acd7)[_0x8618('0x2d')](_0x304c38);}return null;};}function patchUpdates(_0x3d64f8){return function(_0x1a0033){try{jsonpatch[_0x8618('0x33')](_0x1a0033,_0x3d64f8,!![]);}catch(_0x22fc10){return BPromise[_0x8618('0x34')](_0x22fc10);}return _0x1a0033['save']();};}function saveUpdates(_0x23868c,_0x4b93f9){return function(_0x2604bc){if(_0x2604bc){return _0x2604bc[_0x8618('0x35')](_0x23868c)[_0x8618('0x36')](function(_0x9f8542){return _0x9f8542;});}return null;};}function removeEntity(_0xcd6ef6,_0x928b35){return function(_0x414036){if(_0x414036){return _0x414036[_0x8618('0x37')]()[_0x8618('0x36')](function(){var _0x2b01e9=_0x414036[_0x8618('0x38')]({'plain':!![]});var _0x4e7f90=_0x8618('0x39');return db[_0x8618('0x3a')][_0x8618('0x37')]({'where':{'type':_0x4e7f90,'resourceId':_0x2b01e9['id']}})[_0x8618('0x36')](function(){return _0x414036;});})[_0x8618('0x36')](function(){_0xcd6ef6[_0x8618('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4658ba,_0x306c96){return function(_0xd86587){if(!_0xd86587){_0x4658ba[_0x8618('0x2a')](0x194);}return _0xd86587;};}function handleError(_0x386c26,_0x1c67e7){_0x1c67e7=_0x1c67e7||0x1f4;return function(_0x26f2e6){logger[_0x8618('0x26')](_0x26f2e6['stack']);if(_0x26f2e6[_0x8618('0x3b')]){delete _0x26f2e6[_0x8618('0x3b')];}_0x386c26[_0x8618('0x2c')](_0x1c67e7)[_0x8618('0x3c')](_0x26f2e6);};}exports['index']=function(_0x270a5f,_0x40855d){var _0xa6d8cc={'include':[{'model':db[_0x8618('0x3d')],'as':_0x8618('0x3e')},{'model':db['MailServerOut'],'as':_0x8618('0x3f')},{'model':db[_0x8618('0x40')],'as':_0x8618('0x41')}]},_0x21b6e3={},_0x3b79cd={'count':0x0,'rows':[]};var _0x545611=_[_0x8618('0x42')](db[_0x8618('0x43')][_0x8618('0x44')],function(_0x2f1268){return{'name':_0x2f1268[_0x8618('0x45')],'type':_0x2f1268['type'][_0x8618('0x46')]};});_0x21b6e3[_0x8618('0x47')]=_[_0x8618('0x42')](_0x545611,_0x8618('0x3b'));_0x21b6e3[_0x8618('0x48')]=_[_0x8618('0x49')](_0x270a5f[_0x8618('0x48')]);_0x21b6e3[_0x8618('0x4a')]=_['intersection'](_0x21b6e3[_0x8618('0x47')],_0x21b6e3['query']);_0xa6d8cc[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x21b6e3[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x270a5f[_0x8618('0x48')][_0x8618('0x4d')]));_0xa6d8cc[_0x8618('0x4b')]=_0xa6d8cc[_0x8618('0x4b')][_0x8618('0x4e')]?_0xa6d8cc[_0x8618('0x4b')]:_0x21b6e3[_0x8618('0x47')];if(!_0x270a5f['query'][_0x8618('0x4f')]('nolimit')){_0xa6d8cc[_0x8618('0x30')]=qs['limit'](_0x270a5f[_0x8618('0x48')][_0x8618('0x30')]);_0xa6d8cc[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0x270a5f['query']['offset']);}_0xa6d8cc[_0x8618('0x50')]=qs['sort'](_0x270a5f[_0x8618('0x48')][_0x8618('0x51')]);_0xa6d8cc['where']=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x270a5f[_0x8618('0x48')],_0x21b6e3[_0x8618('0x4a')]),_0x545611);if(_0x270a5f[_0x8618('0x48')][_0x8618('0x53')]){_0xa6d8cc[_0x8618('0x54')]=_[_0x8618('0x55')](_0xa6d8cc[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x545611,function(_0x365804){if(_0x365804[_0x8618('0x56')]!==_0x8618('0x57')){var _0x567764={};_0x567764[_0x365804[_0x8618('0x3b')]]={'$like':'%'+_0x270a5f['query'][_0x8618('0x53')]+'%'};return _0x567764;}})});}_0xa6d8cc=_['merge']({},_0xa6d8cc,_0x270a5f[_0x8618('0x58')]);var _0x10abea={'where':_0xa6d8cc[_0x8618('0x54')]};return db['MailAccount'][_0x8618('0x2e')](_0x10abea)[_0x8618('0x36')](function(_0x32d722){_0x3b79cd['count']=_0x32d722;if(_0x270a5f[_0x8618('0x48')][_0x8618('0x59')]){_0xa6d8cc['include']=[{'all':!![]}];}return db[_0x8618('0x43')][_0x8618('0x5a')](_0xa6d8cc);})[_0x8618('0x36')](function(_0x1d3a70){_0x3b79cd[_0x8618('0x5b')]=_0x1d3a70;return _0x3b79cd;})[_0x8618('0x36')](respondWithFilteredResult(_0x40855d,_0xa6d8cc))[_0x8618('0x29')](handleError(_0x40855d,null));};exports[_0x8618('0x5c')]=function(_0xd4f6a8,_0x38b02a){var _0x4b9115={'raw':![],'where':{'id':_0xd4f6a8[_0x8618('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8618('0x3e')},{'model':db[_0x8618('0x5e')],'as':_0x8618('0x3f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2df023={};_0x2df023['model']=_[_0x8618('0x49')](db['MailAccount'][_0x8618('0x44')]);_0x2df023[_0x8618('0x48')]=_[_0x8618('0x49')](_0xd4f6a8[_0x8618('0x48')]);_0x2df023[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x2df023['model'],_0x2df023[_0x8618('0x48')]);_0x4b9115[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x2df023[_0x8618('0x47')],qs['fields'](_0xd4f6a8[_0x8618('0x48')]['fields']));_0x4b9115[_0x8618('0x4b')]=_0x4b9115[_0x8618('0x4b')]['length']?_0x4b9115[_0x8618('0x4b')]:_0x2df023[_0x8618('0x47')];if(_0xd4f6a8[_0x8618('0x48')][_0x8618('0x59')]){_0x4b9115[_0x8618('0x5f')]=[{'all':!![]}];}_0x4b9115=_['merge']({},_0x4b9115,_0xd4f6a8[_0x8618('0x58')]);return db['MailAccount'][_0x8618('0x60')](_0x4b9115)[_0x8618('0x36')](handleEntityNotFound(_0x38b02a,null))[_0x8618('0x36')](respondWithResult(_0x38b02a,null))[_0x8618('0x29')](handleError(_0x38b02a,null));};exports[_0x8618('0x35')]=function(_0x349abe,_0x481c60){if(_0x349abe[_0x8618('0x61')]['id']){delete _0x349abe[_0x8618('0x61')]['id'];}return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x349abe[_0x8618('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x8618('0x3e')},{'model':db[_0x8618('0x5e')],'as':_0x8618('0x3f')},{'model':db['Pause'],'as':_0x8618('0x41')}]})['then'](handleEntityNotFound(_0x481c60,null))[_0x8618('0x36')](saveUpdates(_0x349abe[_0x8618('0x61')],null))[_0x8618('0x36')](function(_0x2990a3){if(_0x2990a3&&_0x349abe['body']['Imap']){return db['MailServerIn'][_0x8618('0x35')](_0x349abe['body']['Imap'],{'where':{'MailAccountId':_0x2990a3['id']}})[_0x8618('0x36')](function(){return _0x2990a3;});}return _0x2990a3;})[_0x8618('0x36')](function(_0x1efe3f){if(_0x1efe3f&&_0x349abe[_0x8618('0x61')][_0x8618('0x3f')]){return db[_0x8618('0x5e')][_0x8618('0x35')](_0x349abe['body'][_0x8618('0x3f')],{'where':{'MailAccountId':_0x1efe3f['id']}})['then'](function(){return _0x1efe3f;});}return _0x1efe3f;})['then'](respondWithResult(_0x481c60,null))[_0x8618('0x29')](handleError(_0x481c60,null));};exports['describe']=function(_0x303259,_0x445107){return db[_0x8618('0x43')][_0x8618('0x62')]()[_0x8618('0x36')](respondWithResult(_0x445107,null))[_0x8618('0x29')](handleError(_0x445107,null));};exports['addDisposition']=function(_0x27c70b,_0x107edd,_0x2a6169){if(_0x27c70b[_0x8618('0x61')]['id']){delete _0x27c70b[_0x8618('0x61')]['id'];}return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x27c70b[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x107edd,null))[_0x8618('0x36')](function(_0x317e4d){if(_0x317e4d){_0x27c70b[_0x8618('0x61')][_0x8618('0x63')]=_0x317e4d['id'];return db[_0x8618('0x64')][_0x8618('0x65')](_0x27c70b[_0x8618('0x61')]);}})[_0x8618('0x36')](respondWithResult(_0x107edd,null))[_0x8618('0x29')](handleError(_0x107edd,null));};exports[_0x8618('0x66')]=function(_0x286500,_0x1431ad,_0x3b5211){var _0xfe8299={'raw':![],'where':{}};var _0x58f9b6={};var _0x434cd7={'count':0x0,'rows':[]};return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x286500['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x1431ad,null))[_0x8618('0x36')](function(_0x3775ef){if(_0x3775ef){_0x58f9b6[_0x8618('0x47')]=_['keys'](db[_0x8618('0x64')][_0x8618('0x44')]);_0x58f9b6[_0x8618('0x48')]=_[_0x8618('0x49')](_0x286500[_0x8618('0x48')]);_0x58f9b6[_0x8618('0x4a')]=_['intersection'](_0x58f9b6[_0x8618('0x47')],_0x58f9b6[_0x8618('0x48')]);_0xfe8299[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x58f9b6[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x286500[_0x8618('0x48')]['fields']));_0xfe8299[_0x8618('0x4b')]=_0xfe8299['attributes']['length']?_0xfe8299[_0x8618('0x4b')]:_0x58f9b6[_0x8618('0x47')];if(!_0x286500[_0x8618('0x48')][_0x8618('0x4f')](_0x8618('0x68'))){_0xfe8299[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x286500[_0x8618('0x48')][_0x8618('0x30')]);_0xfe8299[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0x286500[_0x8618('0x48')]['offset']);}_0xfe8299[_0x8618('0x50')]=qs['sort'](_0x286500[_0x8618('0x48')][_0x8618('0x51')]);_0xfe8299['where']=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x286500[_0x8618('0x48')],_0x58f9b6[_0x8618('0x4a')]));_0xfe8299[_0x8618('0x54')]['MailAccountId']=_0x3775ef['id'];if(_0x286500[_0x8618('0x48')][_0x8618('0x53')]){_0xfe8299[_0x8618('0x54')]=_[_0x8618('0x55')](_0xfe8299['where'],{'$or':_[_0x8618('0x42')](_0xfe8299[_0x8618('0x4b')],function(_0x517db6){var _0x3b2eed={};_0x3b2eed[_0x517db6]={'$like':'%'+_0x286500[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x3b2eed;})});}_0xfe8299=_[_0x8618('0x55')]({},_0xfe8299,_0x286500[_0x8618('0x58')]);return db[_0x8618('0x64')][_0x8618('0x2e')]({'where':_0xfe8299[_0x8618('0x54')]})[_0x8618('0x36')](function(_0x460ad1){_0x434cd7[_0x8618('0x2e')]=_0x460ad1;if(_0x286500[_0x8618('0x48')][_0x8618('0x59')]){_0xfe8299['include']=[{'all':!![]}];}return db[_0x8618('0x64')][_0x8618('0x5a')](_0xfe8299);})[_0x8618('0x36')](function(_0x47aa5c){_0x434cd7[_0x8618('0x5b')]=_0x47aa5c;return _0x434cd7;});}})[_0x8618('0x36')](respondWithFilteredResult(_0x1431ad,_0xfe8299))[_0x8618('0x29')](handleError(_0x1431ad,null));};exports[_0x8618('0x69')]=function(_0x394f93,_0x77eab3,_0x165cce){return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x394f93['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x77eab3,null))['then'](function(_0x5bd456){if(_0x5bd456){return _0x5bd456[_0x8618('0x69')](_0x394f93['query']['ids']);}})['then'](respondWithStatusCode(_0x77eab3,null))[_0x8618('0x29')](handleError(_0x77eab3,null));};exports[_0x8618('0x6a')]=function(_0x142e33,_0x566a8a,_0x37cf7d){if(_0x142e33[_0x8618('0x61')]['id']){delete _0x142e33[_0x8618('0x61')]['id'];}return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x142e33[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x566a8a,null))[_0x8618('0x36')](function(_0xe63f34){if(_0xe63f34){_0x142e33[_0x8618('0x61')][_0x8618('0x63')]=_0xe63f34['id'];return db[_0x8618('0x6b')]['create'](_0x142e33[_0x8618('0x61')]);}})[_0x8618('0x36')](respondWithResult(_0x566a8a,null))[_0x8618('0x29')](handleError(_0x566a8a,null));};exports[_0x8618('0x6c')]=function(_0x5ef577,_0xfa247e,_0x32d836){var _0x1a8d70={'raw':![],'where':{}};var _0x5e4c4b={};var _0x55c9ff={'count':0x0,'rows':[]};return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x5ef577['params']['id']}})['then'](handleEntityNotFound(_0xfa247e,null))['then'](function(_0x2d6c86){if(_0x2d6c86){_0x5e4c4b['model']=_['keys'](db[_0x8618('0x6b')]['rawAttributes']);_0x5e4c4b[_0x8618('0x48')]=_[_0x8618('0x49')](_0x5ef577[_0x8618('0x48')]);_0x5e4c4b[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x5e4c4b[_0x8618('0x47')],_0x5e4c4b[_0x8618('0x48')]);_0x1a8d70[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x5e4c4b[_0x8618('0x47')],qs['fields'](_0x5ef577[_0x8618('0x48')][_0x8618('0x4d')]));_0x1a8d70[_0x8618('0x4b')]=_0x1a8d70[_0x8618('0x4b')][_0x8618('0x4e')]?_0x1a8d70[_0x8618('0x4b')]:_0x5e4c4b[_0x8618('0x47')];if(!_0x5ef577['query']['hasOwnProperty']('nolimit')){_0x1a8d70[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x5ef577['query']['limit']);_0x1a8d70[_0x8618('0x2f')]=qs['offset'](_0x5ef577[_0x8618('0x48')][_0x8618('0x2f')]);}_0x1a8d70[_0x8618('0x50')]=qs['sort'](_0x5ef577[_0x8618('0x48')][_0x8618('0x51')]);_0x1a8d70[_0x8618('0x54')]=qs[_0x8618('0x4a')](_['pick'](_0x5ef577['query'],_0x5e4c4b[_0x8618('0x4a')]));_0x1a8d70['where']['MailAccountId']=_0x2d6c86['id'];if(_0x5ef577[_0x8618('0x48')][_0x8618('0x53')]){_0x1a8d70[_0x8618('0x54')]=_[_0x8618('0x55')](_0x1a8d70[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x1a8d70[_0x8618('0x4b')],function(_0x3426da){var _0x267b14={};_0x267b14[_0x3426da]={'$like':'%'+_0x5ef577[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x267b14;})});}_0x1a8d70=_[_0x8618('0x55')]({},_0x1a8d70,_0x5ef577[_0x8618('0x58')]);return db[_0x8618('0x6b')][_0x8618('0x2e')]({'where':_0x1a8d70[_0x8618('0x54')]})[_0x8618('0x36')](function(_0x3eae8a){_0x55c9ff['count']=_0x3eae8a;if(_0x5ef577[_0x8618('0x48')][_0x8618('0x59')]){_0x1a8d70[_0x8618('0x5f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8618('0x5a')](_0x1a8d70);})[_0x8618('0x36')](function(_0x49deac){_0x55c9ff[_0x8618('0x5b')]=_0x49deac;return _0x55c9ff;});}})['then'](respondWithFilteredResult(_0xfa247e,_0x1a8d70))['catch'](handleError(_0xfa247e,null));};exports[_0x8618('0x6d')]=function(_0x5446ac,_0x4f0206,_0x218c0b){return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x5446ac['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x4f0206,null))['then'](function(_0x249b00){if(_0x249b00){return _0x249b00[_0x8618('0x6d')](_0x5446ac[_0x8618('0x48')][_0x8618('0x6e')]);}})[_0x8618('0x36')](respondWithStatusCode(_0x4f0206,null))['catch'](handleError(_0x4f0206,null));};exports['create']=function(_0x277f3e,_0xf14388){var _0x4ff124={'name':_0x277f3e[_0x8618('0x61')][_0x8618('0x3b')],'key':_0x277f3e['body'][_0x8618('0x46')],'email':_0x277f3e[_0x8618('0x61')]['email'],'ListId':_0x277f3e[_0x8618('0x61')][_0x8618('0x6f')],'active':!_[_0x8618('0x70')](_0x277f3e[_0x8618('0x61')][_0x8618('0x71')])?_0x277f3e['body'][_0x8618('0x71')]:!![],'description':_0x277f3e[_0x8618('0x61')][_0x8618('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x8618('0x70')](_0x277f3e[_0x8618('0x61')][_0x8618('0x73')])){if(_0x277f3e[_0x8618('0x61')]['cauthentication']){_0x4ff124[_0x8618('0x3e')][_0x8618('0x74')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x74')]=_0x277f3e[_0x8618('0x61')][_0x8618('0x75')];_0x4ff124[_0x8618('0x3e')]['password']=_0x4ff124[_0x8618('0x3f')][_0x8618('0x76')]=_0x277f3e[_0x8618('0x61')][_0x8618('0x77')];}else{_0x4ff124[_0x8618('0x3e')][_0x8618('0x78')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x78')]=![];}_0x4ff124[_0x8618('0x3e')][_0x8618('0x79')]=_0x277f3e[_0x8618('0x61')]['Imap'][_0x8618('0x79')];_0x4ff124[_0x8618('0x3e')][_0x8618('0x7a')]=_0x277f3e['body'][_0x8618('0x3e')][_0x8618('0x7a')];_0x4ff124[_0x8618('0x3f')][_0x8618('0x79')]=_0x277f3e['body']['Smtp'][_0x8618('0x79')];_0x4ff124[_0x8618('0x3f')][_0x8618('0x7a')]=_0x277f3e[_0x8618('0x61')][_0x8618('0x3f')]['port'];}else{_0x4ff124[_0x8618('0x3e')][_0x8618('0x7b')]=_0x4ff124['Smtp'][_0x8618('0x7b')]=_0x277f3e['body'][_0x8618('0x73')];_0x4ff124['Imap'][_0x8618('0x74')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x74')]=_0x277f3e['body'][_0x8618('0x75')];_0x4ff124[_0x8618('0x3e')][_0x8618('0x7c')]=_0x4ff124[_0x8618('0x3f')][_0x8618('0x76')]=_0x277f3e[_0x8618('0x61')]['cpassword'];}return db[_0x8618('0x43')][_0x8618('0x65')](_0x4ff124,{'include':[{'model':db['MailServerOut'],'as':_0x8618('0x3f')},{'model':db[_0x8618('0x3d')],'as':_0x8618('0x3e')}]})[_0x8618('0x36')](function(_0x210700){var _0x1e8482=_0x277f3e[_0x8618('0x74')][_0x8618('0x38')]({'plain':!![]});if(!_0x1e8482)throw new Error(_0x8618('0x7d'));if(_0x1e8482[_0x8618('0x7e')]==='user'){var _0x2d0e45=_0x210700[_0x8618('0x38')]({'plain':!![]});return db[_0x8618('0x7f')][_0x8618('0x60')]({'where':{'name':_0x8618('0x39'),'userProfileId':_0x1e8482[_0x8618('0x80')]},'raw':!![]})[_0x8618('0x36')](function(_0x157268){if(_0x157268&&_0x157268[_0x8618('0x81')]===0x0){return db[_0x8618('0x3a')][_0x8618('0x65')]({'name':_0x2d0e45['name'],'resourceId':_0x2d0e45['id'],'type':_0x157268['name'],'sectionId':_0x157268['id']},{})[_0x8618('0x36')](function(){return _0x210700;});}else{return _0x210700;}})[_0x8618('0x29')](function(_0x4703a4){logger[_0x8618('0x26')](_0x8618('0x82'),_0x4703a4);throw _0x4703a4;});}return _0x210700;})[_0x8618('0x36')](respondWithResult(_0xf14388,0xc9))[_0x8618('0x29')](handleError(_0xf14388,null));};exports[_0x8618('0x83')]=function(_0x1b09c9,_0x33d424,_0x4e59f7){return db[_0x8618('0x43')]['findOne']({'where':{'id':_0x1b09c9[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x33d424,null))['then'](function(_0x286439){if(_0x286439){return _0x286439[_0x8618('0x83')]();}return null;})['then'](respondWithResult(_0x33d424,null))[_0x8618('0x29')](handleError(_0x33d424,null));};exports[_0x8618('0x84')]=function(_0x4b1ef8,_0x412431,_0x4dc16d){if(_0x4b1ef8[_0x8618('0x61')]['id']){delete _0x4b1ef8[_0x8618('0x61')]['id'];}return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x4b1ef8[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x412431,null))[_0x8618('0x36')](function(_0xc954f0){if(_0xc954f0){_0x4b1ef8[_0x8618('0x61')][_0x8618('0x63')]=_0xc954f0['id'];return db[_0x8618('0x3d')][_0x8618('0x65')](_0x4b1ef8[_0x8618('0x61')]);}})[_0x8618('0x36')](respondWithResult(_0x412431,null))['catch'](handleError(_0x412431,null));};exports[_0x8618('0x85')]=function(_0x251755,_0x2e24ed,_0xe30db6){return db['MailAccount']['findOne']({'where':{'id':_0x251755[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x2e24ed,null))[_0x8618('0x36')](function(_0x151db7){if(_0x151db7){return _0x151db7[_0x8618('0x86')](null);}return null;})[_0x8618('0x36')](respondWithStatusCode(_0x2e24ed,null))[_0x8618('0x29')](handleError(_0x2e24ed,null));};exports[_0x8618('0x87')]=function(_0x48917f,_0x840fa9,_0x5725df){return db[_0x8618('0x43')]['findOne']({'where':{'id':_0x48917f['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x840fa9,null))[_0x8618('0x36')](function(_0x405146){if(_0x405146){return _0x405146[_0x8618('0x87')]();}return null;})[_0x8618('0x36')](respondWithResult(_0x840fa9,null))[_0x8618('0x29')](handleError(_0x840fa9,null));};exports['addSmtp']=function(_0xf9d2f2,_0x189a96,_0x3224cd){if(_0xf9d2f2[_0x8618('0x61')]['id']){delete _0xf9d2f2[_0x8618('0x61')]['id'];}return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0xf9d2f2[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x189a96,null))['then'](function(_0x34a8d7){if(_0x34a8d7){_0xf9d2f2[_0x8618('0x61')][_0x8618('0x63')]=_0x34a8d7['id'];return db['MailServerOut'][_0x8618('0x65')](_0xf9d2f2[_0x8618('0x61')]);}})['then'](respondWithResult(_0x189a96,null))['catch'](handleError(_0x189a96,null));};exports[_0x8618('0x88')]=function(_0x4e6f67,_0x193981,_0x531516){return db['MailAccount'][_0x8618('0x67')]({'where':{'id':_0x4e6f67['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x193981,null))[_0x8618('0x36')](function(_0x5368b5){if(_0x5368b5){return _0x5368b5[_0x8618('0x89')](null);}return null;})[_0x8618('0x36')](respondWithStatusCode(_0x193981,null))[_0x8618('0x29')](handleError(_0x193981,null));};exports[_0x8618('0x8a')]=function(_0x24412a,_0x3a1def,_0x14c7c2){return db['MailInteraction'][_0x8618('0x60')]({'where':{'id':_0x24412a[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x3a1def,null))[_0x8618('0x36')](function(_0x170f5c){if(_0x170f5c){return _0x170f5c[_0x8618('0x8a')](_0x24412a['body'][_0x8618('0x6e')],_[_0x8618('0x8b')](_0x24412a[_0x8618('0x61')],[_0x8618('0x6e'),'id'])||{});}})[_0x8618('0x36')](respondWithResult(_0x3a1def,null))[_0x8618('0x29')](handleError(_0x3a1def,null));};exports[_0x8618('0x8c')]=function(_0x4f1aa0,_0x3be370,_0xaf3717){var _0xfa906={'raw':![],'where':{}};var _0x221505={};var _0x5392b3={'count':0x0,'rows':[]};return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x4f1aa0[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3be370,null))['then'](function(_0x423d3e){if(_0x423d3e){_0x221505[_0x8618('0x47')]=_[_0x8618('0x49')](db['MailInteraction'][_0x8618('0x44')]);_0x221505[_0x8618('0x48')]=_[_0x8618('0x49')](_0x4f1aa0['query']);_0x221505[_0x8618('0x4a')]=_['intersection'](_0x221505[_0x8618('0x47')],_0x221505[_0x8618('0x48')]);_0xfa906[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x221505[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x4f1aa0[_0x8618('0x48')][_0x8618('0x4d')]));_0xfa906['attributes']=_0xfa906[_0x8618('0x4b')][_0x8618('0x4e')]?_0xfa906['attributes']:_0x221505[_0x8618('0x47')];if(!_0x4f1aa0['query'][_0x8618('0x4f')](_0x8618('0x68'))){_0xfa906[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x4f1aa0[_0x8618('0x48')][_0x8618('0x30')]);_0xfa906[_0x8618('0x2f')]=qs['offset'](_0x4f1aa0['query'][_0x8618('0x2f')]);}_0xfa906[_0x8618('0x50')]=qs[_0x8618('0x51')](_0x4f1aa0[_0x8618('0x48')][_0x8618('0x51')]);_0xfa906[_0x8618('0x54')]=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x4f1aa0['query'],_0x221505[_0x8618('0x4a')]));_0xfa906[_0x8618('0x54')]['MailAccountId']=_0x423d3e['id'];if(_0x4f1aa0[_0x8618('0x48')][_0x8618('0x53')]){_0xfa906[_0x8618('0x54')]=_['merge'](_0xfa906[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0xfa906[_0x8618('0x4b')],function(_0x547dd4){var _0x3989f7={};_0x3989f7[_0x547dd4]={'$like':'%'+_0x4f1aa0[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x3989f7;})});}_0xfa906=_['merge']({},_0xfa906,_0x4f1aa0[_0x8618('0x58')]);return db[_0x8618('0x8d')][_0x8618('0x2e')]({'where':_0xfa906[_0x8618('0x54')]})[_0x8618('0x36')](function(_0x4ac510){_0x5392b3[_0x8618('0x2e')]=_0x4ac510;if(_0x4f1aa0[_0x8618('0x48')]['includeAll']){_0xfa906[_0x8618('0x5f')]=[{'model':db[_0x8618('0x8e')],'as':_0x8618('0x8f'),'required':![]},{'model':db[_0x8618('0x90')],'as':_0x8618('0x91'),'attributes':[_0x8618('0x3b'),'fullname',_0x8618('0x92')],'required':![]},{'model':db[_0x8618('0x93')],'as':_0x8618('0x94'),'attributes':['id',_0x8618('0x3b'),_0x8618('0x95')],'where':_0x4f1aa0[_0x8618('0x48')][_0x8618('0x96')]?{'id':_0x4f1aa0[_0x8618('0x48')]['tag']}:undefined,'required':_0x4f1aa0['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0x8618('0x5a')](_0xfa906);})[_0x8618('0x36')](function(_0x43d137){_0x5392b3[_0x8618('0x5b')]=_0x43d137;return _0x5392b3;});}})[_0x8618('0x36')](respondWithFilteredResult(_0x3be370,_0xfa906))[_0x8618('0x29')](handleError(_0x3be370,null));};exports['addApplications']=function(_0x5578ae,_0x594044,_0x2954d8){return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x5578ae[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x594044,null))['then'](function(_0x3daa44){if(_0x3daa44){return db[_0x8618('0x97')][_0x8618('0x98')](function(_0x1aa423){return db['MailApplication'][_0x8618('0x37')]({'where':{'MailAccountId':_0x5578ae[_0x8618('0x5d')]['id']},'transaction':_0x1aa423})[_0x8618('0x36')](function(_0x422a86){var _0x73d4bf=_[_0x8618('0x42')](_0x5578ae[_0x8618('0x61')],function(_0x57a6ba){_0x57a6ba[_0x8618('0x63')]=_0x5578ae[_0x8618('0x5d')]['id'];return _0x57a6ba;});return db[_0x8618('0x99')][_0x8618('0x9a')](_0x73d4bf,{'transaction':_0x1aa423});});})[_0x8618('0x36')](function(){return db[_0x8618('0x99')][_0x8618('0x9b')]({'where':{'MailAccountId':_0x5578ae[_0x8618('0x5d')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x594044,null))[_0x8618('0x29')](handleError(_0x594044,null));};exports['getApplications']=function(_0xe24766,_0x561ec6,_0x17c2f5){var _0x48722d={};var _0x1c9142={};var _0x3ca33e;var _0x4c2c92;return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0xe24766[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x561ec6,null))['then'](function(_0x225cac){if(_0x225cac){_0x3ca33e=_0x225cac;_0x1c9142[_0x8618('0x47')]=_[_0x8618('0x49')](db[_0x8618('0x99')][_0x8618('0x44')]);_0x1c9142['query']=_[_0x8618('0x49')](_0xe24766['query']);_0x1c9142['filters']=_[_0x8618('0x4c')](_0x1c9142[_0x8618('0x47')],_0x1c9142[_0x8618('0x48')]);_0x48722d[_0x8618('0x4b')]=_[_0x8618('0x4c')](_0x1c9142[_0x8618('0x47')],qs[_0x8618('0x4d')](_0xe24766[_0x8618('0x48')][_0x8618('0x4d')]));_0x48722d[_0x8618('0x4b')]=_0x48722d[_0x8618('0x4b')][_0x8618('0x4e')]?_0x48722d[_0x8618('0x4b')]:_0x1c9142[_0x8618('0x47')];_0x48722d[_0x8618('0x50')]=qs[_0x8618('0x51')](_0xe24766[_0x8618('0x48')][_0x8618('0x51')]);_0x48722d[_0x8618('0x54')]=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0xe24766[_0x8618('0x48')],_0x1c9142[_0x8618('0x4a')]));if(_0xe24766[_0x8618('0x48')][_0x8618('0x53')]){_0x48722d[_0x8618('0x54')]=_[_0x8618('0x55')](_0x48722d['where'],{'$or':_[_0x8618('0x42')](_0x48722d[_0x8618('0x4b')],function(_0x5c68fa){var _0x379e91={};_0x379e91[_0x5c68fa]={'$like':'%'+_0xe24766[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x379e91;})});}_0x48722d=_[_0x8618('0x55')]({},_0x48722d,_0xe24766[_0x8618('0x58')]);return _0x3ca33e['getApplications'](_0x48722d);}})[_0x8618('0x36')](function(_0x159385){if(_0x159385){_0x4c2c92=_0x159385[_0x8618('0x4e')];if(!_0xe24766[_0x8618('0x48')]['hasOwnProperty']('nolimit')){_0x48722d['limit']=qs[_0x8618('0x30')](_0xe24766[_0x8618('0x48')][_0x8618('0x30')]);_0x48722d[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0xe24766['query']['offset']);}return _0x3ca33e[_0x8618('0x9c')](_0x48722d);}})[_0x8618('0x36')](function(_0x5da621){if(_0x5da621){return _0x5da621?{'count':_0x4c2c92,'rows':_0x5da621}:null;}})['then'](respondWithResult(_0x561ec6,null))['catch'](handleError(_0x561ec6,null));};exports[_0x8618('0x9d')]=function(_0x21a7b8,_0x50a04a,_0x5d55d8){var _0x206783={'raw':!![],'where':{}};var _0x520b31={};var _0x316ed9={'count':0x0,'rows':[]};return db[_0x8618('0x43')]['findOne']({'where':{'id':_0x21a7b8[_0x8618('0x5d')]['id']}})['then'](handleEntityNotFound(_0x50a04a,null))[_0x8618('0x36')](function(_0x51cd61){if(_0x51cd61){_0x520b31['model']=_[_0x8618('0x49')](db[_0x8618('0x9e')][_0x8618('0x44')]);_0x520b31['query']=_[_0x8618('0x49')](_0x21a7b8[_0x8618('0x48')]);_0x520b31[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x520b31[_0x8618('0x47')],_0x520b31[_0x8618('0x48')]);_0x206783[_0x8618('0x4b')]=_['intersection'](_0x520b31['model'],qs['fields'](_0x21a7b8[_0x8618('0x48')][_0x8618('0x4d')]));_0x206783[_0x8618('0x4b')]=_0x206783[_0x8618('0x4b')][_0x8618('0x4e')]?_0x206783[_0x8618('0x4b')]:_0x520b31[_0x8618('0x47')];if(!_0x21a7b8['query'][_0x8618('0x4f')]('nolimit')){_0x206783[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x21a7b8[_0x8618('0x48')][_0x8618('0x30')]);_0x206783[_0x8618('0x2f')]=qs[_0x8618('0x2f')](_0x21a7b8[_0x8618('0x48')][_0x8618('0x2f')]);}_0x206783[_0x8618('0x50')]=qs[_0x8618('0x51')](_0x21a7b8[_0x8618('0x48')][_0x8618('0x51')]);_0x206783[_0x8618('0x54')]=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x21a7b8['query'],_0x520b31[_0x8618('0x4a')]));_0x206783['where'][_0x8618('0x63')]=_0x51cd61['id'];if(_0x21a7b8[_0x8618('0x48')][_0x8618('0x53')]){_0x206783['where']=_[_0x8618('0x55')](_0x206783[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x206783[_0x8618('0x4b')],function(_0xdd8bd3){var _0x5596ba={};_0x5596ba[_0xdd8bd3]={'$like':'%'+_0x21a7b8['query'][_0x8618('0x53')]+'%'};return _0x5596ba;})});}if(_0x21a7b8[_0x8618('0x48')][_0x8618('0x9f')]){var _0x13c1f7=_0x21a7b8[_0x8618('0x48')][_0x8618('0x9f')][_0x8618('0xa0')](',');var _0xea1a4b={};_0xea1a4b[_0x13c1f7[0x0]]={'$gte':moment(_0x13c1f7[0x1])[_0x8618('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x206783[_0x8618('0x54')]=_[_0x8618('0x55')](_0x206783[_0x8618('0x54')],_0xea1a4b);}_0x206783=_[_0x8618('0x55')]({},_0x206783,_0x21a7b8[_0x8618('0x58')]);return db['MailMessage'][_0x8618('0x2e')]({'where':_0x206783['where']})[_0x8618('0x36')](function(_0xeddc8f){_0x316ed9[_0x8618('0x2e')]=_0xeddc8f;if(_0x21a7b8[_0x8618('0x48')][_0x8618('0x59')]){_0x206783[_0x8618('0x5f')]=[{'all':!![]}];}return db['MailMessage'][_0x8618('0x5a')](_0x206783);})[_0x8618('0x36')](function(_0x1581d0){_0x316ed9['rows']=_0x1581d0;return _0x316ed9;});}})[_0x8618('0x36')](respondWithFilteredResult(_0x50a04a,_0x206783))[_0x8618('0x29')](handleError(_0x50a04a,null));};exports[_0x8618('0x3c')]=function(_0x4b66ff,_0x16d06c,_0x166aba){var _0x2961f2,_0x354e15={},_0x5b66d7;if(_0x4b66ff[_0x8618('0x61')]['to']){_0x5b66d7=_0x4b66ff[_0x8618('0x61')]['to']['split'](',')[0x0];}return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x4b66ff['params']['id']},'include':[{'model':db[_0x8618('0xa2')],'as':_0x8618('0xa3'),'include':[{'model':db['CmContact'],'as':_0x8618('0xa4'),'where':{'email':_0x5b66d7},'limit':0x1,'order':[['updatedAt',_0x8618('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0x8618('0x3f'),'raw':!![]}]})[_0x8618('0x36')](handleEntityNotFound(_0x16d06c,null))[_0x8618('0x36')](function(_0x125ae1){if(_0x125ae1){_0x2961f2=_0x125ae1;if(_0x125ae1[_0x8618('0x3f')]){if(_[_0x8618('0x70')](_0x4b66ff['body'][_0x8618('0xa6')])){_0x4b66ff[_0x8618('0x61')]['from']=util['format'](_0x8618('0xa7'),_0x125ae1[_0x8618('0x3b')],_0x125ae1[_0x8618('0xa8')]||_0x125ae1[_0x8618('0x3f')][_0x8618('0x74')]);}if(_0x4b66ff['body'][_0x8618('0xa9')]&&_0x4b66ff[_0x8618('0x61')][_0x8618('0xa9')][_0x8618('0x4e')]){for(var _0x3a672b=0x0;_0x3a672b<_0x4b66ff[_0x8618('0x61')]['attachments'][_0x8618('0x4e')];_0x3a672b+=0x1){_0x4b66ff[_0x8618('0x61')][_0x8618('0xa9')][_0x3a672b]={'filename':_0x4b66ff[_0x8618('0x61')][_0x8618('0xa9')][_0x3a672b][_0x8618('0x3b')],'path':path[_0x8618('0xaa')](config[_0x8618('0xab')],_0x8618('0xac'),_0x4b66ff['body'][_0x8618('0xa9')][_0x3a672b][_0x8618('0xad')])};}}var _0x419a86={'tls':{'rejectUnauthorized':![]}};if(_[_0x8618('0x70')](_0x125ae1[_0x8618('0x3f')][_0x8618('0x7b')])){if(_0x125ae1['Smtp'][_0x8618('0x78')]){_0x419a86[_0x8618('0xae')]={'user':_0x125ae1[_0x8618('0x3f')][_0x8618('0x74')],'pass':_0x125ae1['Smtp']['pass']};}_0x419a86[_0x8618('0x79')]=_0x125ae1['Smtp'][_0x8618('0x79')];_0x419a86['port']=_0x125ae1[_0x8618('0x3f')][_0x8618('0x7a')];_0x419a86[_0x8618('0xaf')]=_0x125ae1[_0x8618('0x3f')]['secure'];}else{_0x419a86[_0x8618('0x7b')]=_0x125ae1[_0x8618('0x3f')]['service'];_0x419a86[_0x8618('0xae')]={'user':_0x125ae1['Smtp'][_0x8618('0x74')],'pass':_0x125ae1['Smtp']['pass']};}return respondWithRpcPromise(_0x8618('0xb0'),'sendMail',{'account':_0x419a86,'message':_0x4b66ff[_0x8618('0x61')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x525d6f){if(_0x525d6f){_0x354e15=_0x525d6f;if(_0x2961f2[_0x8618('0xa3')]){if(_0x2961f2[_0x8618('0xa3')][_0x8618('0xa4')][_0x8618('0x4e')]){return _0x2961f2[_0x8618('0xa3')]['Contacts'][0x0];}else{return db[_0x8618('0x8e')][_0x8618('0x65')](_[_0x8618('0x17')](_0x4b66ff['body'],{'firstName':_0x4b66ff[_0x8618('0x61')]['to'],'email':_0x4b66ff[_0x8618('0x61')]['to'],'phone':_0x4b66ff[_0x8618('0x61')]['to'],'ListId':_0x2961f2['ListId']}));}}else{throw new Error(_0x8618('0xb1'));}}})['then'](function(_0x49b40b){if(_0x49b40b){var _0x2eea3f={'UserId':_0x4b66ff['user']['id'],'ContactId':_0x49b40b['id'],'MailAccountId':_0x2961f2['id'],'inReplyTo':_0x354e15[_0x8618('0xb2')],'to':_0x4b66ff[_0x8618('0x61')][_0x8618('0xa6')],'cc':_0x4b66ff[_0x8618('0x61')]['cc'],'subject':_0x4b66ff[_0x8618('0x61')]['subject'],'attach':_0x4b66ff['body'][_0x8618('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8618('0xa1')](_0x8618('0xb4')),'lastMsgDirection':'out','lastMsgBody':_0x4b66ff[_0x8618('0x61')][_0x8618('0x61')],'Messages':[_['merge'](_0x4b66ff[_0x8618('0x61')],{'messageId':_0x354e15[_0x8618('0xb2')],'sentAt':moment()['format'](_0x8618('0xb4')),'read':!![],'MailAccountId':_0x2961f2['id'],'UserId':_0x4b66ff[_0x8618('0x74')]['id'],'ContactId':_0x49b40b['id']})]};if(_0x4b66ff['body'][_0x8618('0xb5')]){_0x2eea3f=_[_0x8618('0x55')](_0x2eea3f,_0x4b66ff[_0x8618('0x61')][_0x8618('0xb5')]);}return db['MailInteraction'][_0x8618('0x65')](_0x2eea3f,{'include':[{'model':db[_0x8618('0x9e')],'as':_0x8618('0xb6')}]});}})[_0x8618('0x36')](respondWithResult(_0x16d06c,null))[_0x8618('0x29')](handleError(_0x16d06c,null));};exports['verifySmtp']=function(_0x418b53,_0x5b025f,_0x4c05eb){return db[_0x8618('0x43')]['find']({'where':{'id':_0x418b53[_0x8618('0x5d')]['id']},'include':[{'model':db[_0x8618('0x5e')],'as':'Smtp','raw':!![]}]})[_0x8618('0x36')](handleEntityNotFound(_0x5b025f,null))[_0x8618('0x36')](function(_0x2cfcc0){if(_0x2cfcc0&&_0x2cfcc0[_0x8618('0x3f')]){var _0x367a90={'id':_0x2cfcc0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2cfcc0[_0x8618('0x3f')]['service']){_0x367a90[_0x8618('0x7b')]=_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x7b')];}else{_0x367a90['host']=_0x2cfcc0[_0x8618('0x3f')]['host'];_0x367a90[_0x8618('0x7a')]=_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x7a')];_0x367a90['secure']=_0x2cfcc0[_0x8618('0x3f')][_0x8618('0xaf')];}if(_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x78')]){_0x367a90[_0x8618('0xae')]={'user':_0x2cfcc0['Smtp'][_0x8618('0x74')],'pass':_0x2cfcc0[_0x8618('0x3f')][_0x8618('0x76')]};}return respondWithRpcPromise(_0x8618('0xb7'),_0x8618('0xb8'),{'account':_0x367a90});}})[_0x8618('0x36')](respondWithResult(_0x5b025f,null))['catch'](handleError(_0x5b025f,null));};exports['destroy']=function(_0x3750f5,_0x4dfb44){return db[_0x8618('0x43')][_0x8618('0x60')]({'where':{'id':_0x3750f5[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x4dfb44,null))[_0x8618('0x36')](function(_0x1418e5){if(_0x1418e5&&_0x1418e5[_0x8618('0x7b')]){throw new db[(_0x8618('0xb9'))]['ValidationError'](_0x8618('0xba'));}return _0x1418e5;})['then'](removeEntity(_0x4dfb44,null))['catch'](handleError(_0x4dfb44,null));};exports[_0x8618('0xbb')]=function(_0x452b12,_0x5bf237,_0x32e4c4){return db['MailAccount'][_0x8618('0x60')]({'where':{'id':_0x452b12[_0x8618('0x5d')]['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x5bf237,null))[_0x8618('0x36')](function(_0x8420f){if(_0x8420f){return _0x8420f['addAgents'](_0x452b12[_0x8618('0x61')][_0x8618('0x6e')],_[_0x8618('0x8b')](_0x452b12[_0x8618('0x61')],[_0x8618('0x6e'),'id'])||{})[_0x8618('0xbc')](function(_0x12aebd){for(var _0x24ae87=0x0;_0x24ae87<_0x452b12[_0x8618('0x61')][_0x8618('0x6e')]['length'];_0x24ae87+=0x1){socket[_0x8618('0xbd')](_0x8618('0xbe'),{'UserId':_0x452b12[_0x8618('0x61')][_0x8618('0x6e')][_0x24ae87],'MailAccountId':_0x452b12[_0x8618('0x5d')]['id']});}return _0x12aebd;});}})[_0x8618('0x36')](respondWithResult(_0x5bf237,null))['catch'](handleError(_0x5bf237,null));};exports['removeAgents']=function(_0x3c910d,_0x4d73cf,_0x356d23){return db[_0x8618('0x43')]['find']({'where':{'id':_0x3c910d['params']['id']}})['then'](handleEntityNotFound(_0x4d73cf,null))[_0x8618('0x36')](function(_0x5c3843){if(_0x5c3843){return _0x5c3843[_0x8618('0xbf')](_0x3c910d[_0x8618('0x48')][_0x8618('0x6e')])[_0x8618('0x36')](function(){if(_[_0x8618('0xc0')](_0x3c910d['query']['ids'])){for(var _0x3c2999=0x0;_0x3c2999<_0x3c910d[_0x8618('0x48')][_0x8618('0x6e')]['length'];_0x3c2999+=0x1){socket[_0x8618('0xbd')](_0x8618('0xc1'),{'UserId':Number(_0x3c910d['query'][_0x8618('0x6e')][_0x3c2999]),'MailAccountId':Number(_0x3c910d[_0x8618('0x5d')]['id'])});}}else{socket[_0x8618('0xbd')](_0x8618('0xc1'),{'UserId':Number(_0x3c910d[_0x8618('0x48')][_0x8618('0x6e')]),'MailAccountId':Number(_0x3c910d[_0x8618('0x5d')]['id'])});}});}})[_0x8618('0x36')](respondWithStatusCode(_0x4d73cf,null))[_0x8618('0x29')](handleError(_0x4d73cf,null));};exports[_0x8618('0xc2')]=function(_0x4ab38b,_0x1b6690,_0x82b8f0){var _0x233f9c={};var _0x5da48e={};var _0x1ece8f;var _0xf6ed37;return db[_0x8618('0x43')][_0x8618('0x67')]({'where':{'id':_0x4ab38b['params']['id']}})[_0x8618('0x36')](handleEntityNotFound(_0x1b6690,null))[_0x8618('0x36')](function(_0xc956e3){if(_0xc956e3){_0x1ece8f=_0xc956e3;_0x5da48e[_0x8618('0x47')]=_[_0x8618('0x49')](db[_0x8618('0x90')][_0x8618('0x44')]);_0x5da48e['query']=_[_0x8618('0x49')](_0x4ab38b[_0x8618('0x48')]);_0x5da48e[_0x8618('0x4a')]=_[_0x8618('0x4c')](_0x5da48e[_0x8618('0x47')],_0x5da48e[_0x8618('0x48')]);_0x233f9c['attributes']=_[_0x8618('0x4c')](_0x5da48e[_0x8618('0x47')],qs[_0x8618('0x4d')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x4d')]));_0x233f9c[_0x8618('0x4b')]=_0x233f9c['attributes']['length']?_0x233f9c['attributes']:_0x5da48e[_0x8618('0x47')];_0x233f9c[_0x8618('0x50')]=qs[_0x8618('0x51')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x51')]);_0x233f9c['where']=qs[_0x8618('0x4a')](_[_0x8618('0x52')](_0x4ab38b[_0x8618('0x48')],_0x5da48e[_0x8618('0x4a')]));if(_0x4ab38b[_0x8618('0x48')][_0x8618('0x53')]){_0x233f9c[_0x8618('0x54')]=_[_0x8618('0x55')](_0x233f9c[_0x8618('0x54')],{'$or':_[_0x8618('0x42')](_0x233f9c[_0x8618('0x4b')],function(_0x4e36b8){var _0x41896b={};_0x41896b[_0x4e36b8]={'$like':'%'+_0x4ab38b[_0x8618('0x48')][_0x8618('0x53')]+'%'};return _0x41896b;})});}_0x233f9c=_['merge']({},_0x233f9c,_0x4ab38b[_0x8618('0x58')]);return _0x1ece8f[_0x8618('0xc2')](_0x233f9c);}})[_0x8618('0x36')](function(_0x4f6ec0){if(_0x4f6ec0){_0xf6ed37=_0x4f6ec0[_0x8618('0x4e')];if(!_0x4ab38b[_0x8618('0x48')][_0x8618('0x4f')](_0x8618('0x68'))){_0x233f9c[_0x8618('0x30')]=qs[_0x8618('0x30')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x30')]);_0x233f9c['offset']=qs[_0x8618('0x2f')](_0x4ab38b[_0x8618('0x48')][_0x8618('0x2f')]);}return _0x1ece8f[_0x8618('0xc2')](_0x233f9c);}})[_0x8618('0x36')](function(_0x24eb65){if(_0x24eb65){return _0x24eb65?{'count':_0xf6ed37,'rows':_0x24eb65}:null;}})[_0x8618('0x36')](respondWithResult(_0x1b6690,null))[_0x8618('0x29')](handleError(_0x1b6690,null));}; \ No newline at end of file +var _0xc75e=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','redis','./mailAccount.socket','register','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','count','offset','set','json','reject','destroy','get','stack','name','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','query','keys','filters','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','Pause','intersection','body','find','update','describe','Disposition','getDispositions','hasOwnProperty','rows','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','create','getAnswers','findOne','removeAnswers','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','port','host','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','send','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','secure','auth','List\x20not\x20found','defaults','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir'];(function(_0x46229d,_0x4eef5d){var _0x154732=function(_0x15b6aa){while(--_0x15b6aa){_0x46229d['push'](_0x46229d['shift']());}};_0x154732(++_0x4eef5d);}(_0xc75e,0x17f));var _0xec75=function(_0x4d7dfa,_0x2daec0){_0x4d7dfa=_0x4d7dfa-0x0;var _0xe7e02b=_0xc75e[_0x4d7dfa];return _0xe7e02b;};'use strict';var pdf=require(_0xec75('0x0'));var emlformat=require(_0xec75('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec75('0x2'));var jsonpatch=require(_0xec75('0x3'));var rp=require(_0xec75('0x4'));var moment=require(_0xec75('0x5'));var BPromise=require(_0xec75('0x6'));var Mustache=require(_0xec75('0x7'));var util=require(_0xec75('0x8'));var path=require(_0xec75('0x9'));var sox=require(_0xec75('0xa'));var csv=require(_0xec75('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec75('0xc'));var squel=require(_0xec75('0xd'));var crypto=require(_0xec75('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xec75('0xf'));var toCsv=require(_0xec75('0xb'));var querystring=require(_0xec75('0x10'));var Papa=require(_0xec75('0x11'));var Redis=require(_0xec75('0x12'));var authService=require(_0xec75('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec75('0x14'))(_0xec75('0x15'));var utils=require(_0xec75('0x16'));var config=require(_0xec75('0x17'));var db=require(_0xec75('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xec75('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec75('0x1a')]));require(_0xec75('0x1b'))[_0xec75('0x1c')](socket);var jayson=require(_0xec75('0x1d'));var client=jayson['client'][_0xec75('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x2d162c,_0x30ef3c,_0x46dd22){if(_0x46dd22){var _0x4af9b3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4af9b3[_0xec75('0x1f')](_0x30ef3c)){return _0x2d162c;}else{throw new db[(_0xec75('0x20'))]['ValidationError'](_0xec75('0x21'));}}else{return _0x2d162c;}}function respondWithRpcPromise(_0x2f2d09,_0x190906,_0x26fc00,_0x441758){return new BPromise(function(_0x2b04f0,_0x56da9d){var _0x59798d=_0x441758||client;return _0x59798d[_0xec75('0x22')](_0x2f2d09,_0x26fc00)[_0xec75('0x23')](function(_0x51087e){logger[_0xec75('0x24')](_0xec75('0x25'),_0x190906,_0xec75('0x26'));logger[_0xec75('0x27')](_0xec75('0x28'),_0x190906,'request\x20sent',JSON[_0xec75('0x29')](_0x51087e));if(_0x51087e[_0xec75('0x2a')]){if(_0x51087e['error']['code']===0x1f4){logger[_0xec75('0x2a')]('MailAccount,\x20%s,\x20%s',_0x190906,_0x51087e[_0xec75('0x2a')][_0xec75('0x2b')]);return _0x56da9d(_0x51087e[_0xec75('0x2a')][_0xec75('0x2b')]);}logger[_0xec75('0x2a')](_0xec75('0x25'),_0x190906,_0x51087e['error'][_0xec75('0x2b')]);return _0x2b04f0(_0x51087e[_0xec75('0x2a')][_0xec75('0x2b')]);}else{logger[_0xec75('0x24')](_0xec75('0x25'),_0x190906,_0xec75('0x26'));_0x2b04f0(_0x51087e['result'][_0xec75('0x2b')]);}})[_0xec75('0x2c')](function(_0x2f7343){logger[_0xec75('0x2a')](_0xec75('0x25'),_0x190906,_0x2f7343);_0x56da9d(_0x2f7343);});});}function respondWithStatusCode(_0x19fc93,_0x6ccc9e){_0x6ccc9e=_0x6ccc9e||0xcc;return function(_0x574912){if(_0x574912){return _0x19fc93[_0xec75('0x2d')](_0x6ccc9e);}return _0x19fc93['status'](_0x6ccc9e)[_0xec75('0x2e')]();};}function respondWithResult(_0x2fb40b,_0x2f570c){_0x2f570c=_0x2f570c||0xc8;return function(_0x3d11b4){if(_0x3d11b4){return _0x2fb40b[_0xec75('0x2f')](_0x2f570c)['json'](_0x3d11b4);}};}function respondWithFilteredResult(_0x29e9e3,_0x160a86){return function(_0x52ecfb){if(_0x52ecfb){var _0x4ed9ee=_0x52ecfb[_0xec75('0x30')],_0x2d8581=_0x160a86[_0xec75('0x31')],_0x2bd24d=_0x160a86['offset']+_0x160a86['limit'],_0x32244e;if(_0x2bd24d>=_0x4ed9ee){_0x2bd24d=_0x4ed9ee;_0x32244e=0xc8;}else{_0x32244e=0xce;}_0x29e9e3[_0xec75('0x2f')](_0x32244e);return _0x29e9e3[_0xec75('0x32')]('Content-Range',_0x2d8581+'-'+_0x2bd24d+'/'+_0x4ed9ee)[_0xec75('0x33')](_0x52ecfb);}return null;};}function patchUpdates(_0x2dac77){return function(_0xd210d6){try{jsonpatch['apply'](_0xd210d6,_0x2dac77,!![]);}catch(_0x49a2f5){return BPromise[_0xec75('0x34')](_0x49a2f5);}return _0xd210d6['save']();};}function saveUpdates(_0x463c6e,_0x379941){return function(_0x3d1515){if(_0x3d1515){return _0x3d1515['update'](_0x463c6e)['then'](function(_0x30c088){return _0x30c088;});}return null;};}function removeEntity(_0x19ee70,_0x57a586){return function(_0x145327){if(_0x145327){return _0x145327[_0xec75('0x35')]()['then'](function(){var _0x56963f=_0x145327[_0xec75('0x36')]({'plain':!![]});var _0x3e6f1b='MailAccounts';return db['UserProfileResource'][_0xec75('0x35')]({'where':{'type':_0x3e6f1b,'resourceId':_0x56963f['id']}})['then'](function(){return _0x145327;});})['then'](function(){_0x19ee70[_0xec75('0x2f')](0xcc)[_0xec75('0x2e')]();});}};}function handleEntityNotFound(_0x21e43f,_0x35b024){return function(_0x39a75b){if(!_0x39a75b){_0x21e43f[_0xec75('0x2d')](0x194);}return _0x39a75b;};}function handleError(_0xb8a316,_0x1c9e11){_0x1c9e11=_0x1c9e11||0x1f4;return function(_0x16b0c2){logger[_0xec75('0x2a')](_0x16b0c2[_0xec75('0x37')]);if(_0x16b0c2['name']){delete _0x16b0c2[_0xec75('0x38')];}_0xb8a316[_0xec75('0x2f')](_0x1c9e11)['send'](_0x16b0c2);};}exports['index']=function(_0x727c68,_0x5150df){var _0x16459b={'include':[{'model':db[_0xec75('0x39')],'as':_0xec75('0x3a')},{'model':db[_0xec75('0x3b')],'as':_0xec75('0x3c')},{'model':db['Pause'],'as':_0xec75('0x3d')}]},_0x3ddabd={},_0x19333c={'count':0x0,'rows':[]};var _0xaae20a=_[_0xec75('0x3e')](db[_0xec75('0x3f')][_0xec75('0x40')],function(_0x35e7f3){return{'name':_0x35e7f3['fieldName'],'type':_0x35e7f3[_0xec75('0x41')][_0xec75('0x42')]};});_0x3ddabd['model']=_[_0xec75('0x3e')](_0xaae20a,_0xec75('0x38'));_0x3ddabd[_0xec75('0x43')]=_[_0xec75('0x44')](_0x727c68['query']);_0x3ddabd[_0xec75('0x45')]=_['intersection'](_0x3ddabd[_0xec75('0x46')],_0x3ddabd[_0xec75('0x43')]);_0x16459b['attributes']=_['intersection'](_0x3ddabd['model'],qs[_0xec75('0x47')](_0x727c68[_0xec75('0x43')][_0xec75('0x47')]));_0x16459b[_0xec75('0x48')]=_0x16459b[_0xec75('0x48')][_0xec75('0x49')]?_0x16459b[_0xec75('0x48')]:_0x3ddabd[_0xec75('0x46')];if(!_0x727c68['query']['hasOwnProperty'](_0xec75('0x4a'))){_0x16459b[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x727c68[_0xec75('0x43')][_0xec75('0x4b')]);_0x16459b[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x727c68[_0xec75('0x43')][_0xec75('0x31')]);}_0x16459b[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x727c68[_0xec75('0x43')][_0xec75('0x4d')]);_0x16459b[_0xec75('0x4e')]=qs['filters'](_[_0xec75('0x4f')](_0x727c68['query'],_0x3ddabd[_0xec75('0x45')]),_0xaae20a);if(_0x727c68[_0xec75('0x43')][_0xec75('0x50')]){_0x16459b[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x16459b['where'],{'$or':_['map'](_0xaae20a,function(_0x3c5860){if(_0x3c5860['type']!==_0xec75('0x52')){var _0x5b8d31={};_0x5b8d31[_0x3c5860[_0xec75('0x38')]]={'$like':'%'+_0x727c68['query'][_0xec75('0x50')]+'%'};return _0x5b8d31;}})});}_0x16459b=_['merge']({},_0x16459b,_0x727c68[_0xec75('0x53')]);var _0x3f70eb={'where':_0x16459b[_0xec75('0x4e')]};return db['MailAccount'][_0xec75('0x30')](_0x3f70eb)['then'](function(_0x336a72){_0x19333c[_0xec75('0x30')]=_0x336a72;if(_0x727c68[_0xec75('0x43')][_0xec75('0x54')]){_0x16459b[_0xec75('0x55')]=[{'all':!![]}];}return db['MailAccount'][_0xec75('0x56')](_0x16459b);})['then'](function(_0x549c9f){_0x19333c['rows']=_0x549c9f;return _0x19333c;})[_0xec75('0x23')](respondWithFilteredResult(_0x5150df,_0x16459b))['catch'](handleError(_0x5150df,null));};exports[_0xec75('0x57')]=function(_0x508cd0,_0x292b1d){var _0x540d36={'raw':![],'where':{'id':_0x508cd0[_0xec75('0x58')]['id']},'include':[{'model':db[_0xec75('0x39')],'as':'Imap'},{'model':db[_0xec75('0x3b')],'as':'Smtp'},{'model':db[_0xec75('0x59')],'as':'mandatoryDispositionPause'}]},_0x4f9308={};_0x4f9308[_0xec75('0x46')]=_['keys'](db[_0xec75('0x3f')][_0xec75('0x40')]);_0x4f9308['query']=_[_0xec75('0x44')](_0x508cd0[_0xec75('0x43')]);_0x4f9308['filters']=_[_0xec75('0x5a')](_0x4f9308[_0xec75('0x46')],_0x4f9308[_0xec75('0x43')]);_0x540d36[_0xec75('0x48')]=_[_0xec75('0x5a')](_0x4f9308[_0xec75('0x46')],qs['fields'](_0x508cd0[_0xec75('0x43')][_0xec75('0x47')]));_0x540d36['attributes']=_0x540d36[_0xec75('0x48')][_0xec75('0x49')]?_0x540d36[_0xec75('0x48')]:_0x4f9308[_0xec75('0x46')];if(_0x508cd0[_0xec75('0x43')][_0xec75('0x54')]){_0x540d36[_0xec75('0x55')]=[{'all':!![]}];}_0x540d36=_[_0xec75('0x51')]({},_0x540d36,_0x508cd0['options']);return db[_0xec75('0x3f')]['find'](_0x540d36)[_0xec75('0x23')](handleEntityNotFound(_0x292b1d,null))['then'](respondWithResult(_0x292b1d,null))[_0xec75('0x2c')](handleError(_0x292b1d,null));};exports['update']=function(_0x2a2203,_0x291ca6){if(_0x2a2203[_0xec75('0x5b')]['id']){delete _0x2a2203[_0xec75('0x5b')]['id'];}return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0x2a2203[_0xec75('0x58')]['id']},'include':[{'model':db[_0xec75('0x39')],'as':_0xec75('0x3a')},{'model':db['MailServerOut'],'as':_0xec75('0x3c')},{'model':db[_0xec75('0x59')],'as':_0xec75('0x3d')}]})['then'](handleEntityNotFound(_0x291ca6,null))[_0xec75('0x23')](saveUpdates(_0x2a2203[_0xec75('0x5b')],null))[_0xec75('0x23')](function(_0x4803c4){if(_0x4803c4&&_0x2a2203[_0xec75('0x5b')][_0xec75('0x3a')]){return db[_0xec75('0x39')][_0xec75('0x5d')](_0x2a2203[_0xec75('0x5b')][_0xec75('0x3a')],{'where':{'MailAccountId':_0x4803c4['id']}})[_0xec75('0x23')](function(){return _0x4803c4;});}return _0x4803c4;})[_0xec75('0x23')](function(_0x1346aa){if(_0x1346aa&&_0x2a2203[_0xec75('0x5b')]['Smtp']){return db[_0xec75('0x3b')][_0xec75('0x5d')](_0x2a2203[_0xec75('0x5b')][_0xec75('0x3c')],{'where':{'MailAccountId':_0x1346aa['id']}})[_0xec75('0x23')](function(){return _0x1346aa;});}return _0x1346aa;})[_0xec75('0x23')](respondWithResult(_0x291ca6,null))[_0xec75('0x2c')](handleError(_0x291ca6,null));};exports[_0xec75('0x5e')]=function(_0x523a31,_0x10426c){return db['MailAccount'][_0xec75('0x5e')]()[_0xec75('0x23')](respondWithResult(_0x10426c,null))[_0xec75('0x2c')](handleError(_0x10426c,null));};exports['addDisposition']=function(_0x1a2cec,_0x5513be,_0x11a43d){if(_0x1a2cec['body']['id']){delete _0x1a2cec['body']['id'];}return db[_0xec75('0x3f')]['find']({'where':{'id':_0x1a2cec['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x5513be,null))[_0xec75('0x23')](function(_0x59df83){if(_0x59df83){_0x1a2cec[_0xec75('0x5b')]['MailAccountId']=_0x59df83['id'];return db[_0xec75('0x5f')]['create'](_0x1a2cec[_0xec75('0x5b')]);}})[_0xec75('0x23')](respondWithResult(_0x5513be,null))[_0xec75('0x2c')](handleError(_0x5513be,null));};exports[_0xec75('0x60')]=function(_0x2dd8f1,_0x38c3f0,_0x1a6dc9){var _0x1481be={'raw':![],'where':{}};var _0x5eb88e={};var _0x2ac185={'count':0x0,'rows':[]};return db[_0xec75('0x3f')]['findOne']({'where':{'id':_0x2dd8f1['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x38c3f0,null))['then'](function(_0x5c2238){if(_0x5c2238){_0x5eb88e[_0xec75('0x46')]=_['keys'](db[_0xec75('0x5f')]['rawAttributes']);_0x5eb88e[_0xec75('0x43')]=_[_0xec75('0x44')](_0x2dd8f1[_0xec75('0x43')]);_0x5eb88e['filters']=_['intersection'](_0x5eb88e['model'],_0x5eb88e[_0xec75('0x43')]);_0x1481be[_0xec75('0x48')]=_[_0xec75('0x5a')](_0x5eb88e[_0xec75('0x46')],qs[_0xec75('0x47')](_0x2dd8f1[_0xec75('0x43')][_0xec75('0x47')]));_0x1481be[_0xec75('0x48')]=_0x1481be['attributes'][_0xec75('0x49')]?_0x1481be['attributes']:_0x5eb88e[_0xec75('0x46')];if(!_0x2dd8f1[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x1481be['limit']=qs[_0xec75('0x4b')](_0x2dd8f1[_0xec75('0x43')][_0xec75('0x4b')]);_0x1481be[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x2dd8f1[_0xec75('0x43')][_0xec75('0x31')]);}_0x1481be[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x2dd8f1['query']['sort']);_0x1481be[_0xec75('0x4e')]=qs['filters'](_['pick'](_0x2dd8f1[_0xec75('0x43')],_0x5eb88e[_0xec75('0x45')]));_0x1481be['where']['MailAccountId']=_0x5c2238['id'];if(_0x2dd8f1[_0xec75('0x43')][_0xec75('0x50')]){_0x1481be[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x1481be[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x1481be['attributes'],function(_0x29b1ef){var _0x2781e3={};_0x2781e3[_0x29b1ef]={'$like':'%'+_0x2dd8f1[_0xec75('0x43')][_0xec75('0x50')]+'%'};return _0x2781e3;})});}_0x1481be=_[_0xec75('0x51')]({},_0x1481be,_0x2dd8f1[_0xec75('0x53')]);return db['Disposition'][_0xec75('0x30')]({'where':_0x1481be[_0xec75('0x4e')]})[_0xec75('0x23')](function(_0x22d7ab){_0x2ac185[_0xec75('0x30')]=_0x22d7ab;if(_0x2dd8f1[_0xec75('0x43')]['includeAll']){_0x1481be[_0xec75('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1481be);})[_0xec75('0x23')](function(_0x3e32ab){_0x2ac185[_0xec75('0x62')]=_0x3e32ab;return _0x2ac185;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x38c3f0,_0x1481be))[_0xec75('0x2c')](handleError(_0x38c3f0,null));};exports[_0xec75('0x63')]=function(_0xb77049,_0x105b2c,_0x49e81d){return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0xb77049['params']['id']}})['then'](handleEntityNotFound(_0x105b2c,null))[_0xec75('0x23')](function(_0x3b4a0a){if(_0x3b4a0a){return _0x3b4a0a[_0xec75('0x63')](_0xb77049[_0xec75('0x43')][_0xec75('0x64')]);}})['then'](respondWithStatusCode(_0x105b2c,null))['catch'](handleError(_0x105b2c,null));};exports[_0xec75('0x65')]=function(_0x5874e5,_0xcf3bbb,_0x3388b6){if(_0x5874e5[_0xec75('0x5b')]['id']){delete _0x5874e5[_0xec75('0x5b')]['id'];}return db[_0xec75('0x3f')]['find']({'where':{'id':_0x5874e5['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0xcf3bbb,null))[_0xec75('0x23')](function(_0x4a6f35){if(_0x4a6f35){_0x5874e5['body'][_0xec75('0x66')]=_0x4a6f35['id'];return db[_0xec75('0x67')][_0xec75('0x68')](_0x5874e5[_0xec75('0x5b')]);}})['then'](respondWithResult(_0xcf3bbb,null))[_0xec75('0x2c')](handleError(_0xcf3bbb,null));};exports[_0xec75('0x69')]=function(_0x1f63a7,_0x4139f7,_0x48c8d6){var _0xe50a11={'raw':![],'where':{}};var _0xc26ddd={};var _0x1ded80={'count':0x0,'rows':[]};return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x1f63a7[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x4139f7,null))[_0xec75('0x23')](function(_0xf2e0ec){if(_0xf2e0ec){_0xc26ddd[_0xec75('0x46')]=_[_0xec75('0x44')](db['CannedAnswer']['rawAttributes']);_0xc26ddd['query']=_[_0xec75('0x44')](_0x1f63a7[_0xec75('0x43')]);_0xc26ddd['filters']=_[_0xec75('0x5a')](_0xc26ddd[_0xec75('0x46')],_0xc26ddd[_0xec75('0x43')]);_0xe50a11['attributes']=_['intersection'](_0xc26ddd[_0xec75('0x46')],qs['fields'](_0x1f63a7[_0xec75('0x43')][_0xec75('0x47')]));_0xe50a11['attributes']=_0xe50a11[_0xec75('0x48')]['length']?_0xe50a11[_0xec75('0x48')]:_0xc26ddd[_0xec75('0x46')];if(!_0x1f63a7['query'][_0xec75('0x61')](_0xec75('0x4a'))){_0xe50a11[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x1f63a7['query'][_0xec75('0x4b')]);_0xe50a11[_0xec75('0x31')]=qs['offset'](_0x1f63a7['query'][_0xec75('0x31')]);}_0xe50a11['order']=qs['sort'](_0x1f63a7[_0xec75('0x43')][_0xec75('0x4d')]);_0xe50a11[_0xec75('0x4e')]=qs[_0xec75('0x45')](_[_0xec75('0x4f')](_0x1f63a7[_0xec75('0x43')],_0xc26ddd[_0xec75('0x45')]));_0xe50a11['where']['MailAccountId']=_0xf2e0ec['id'];if(_0x1f63a7[_0xec75('0x43')][_0xec75('0x50')]){_0xe50a11[_0xec75('0x4e')]=_[_0xec75('0x51')](_0xe50a11[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0xe50a11[_0xec75('0x48')],function(_0x3fa1d2){var _0x469029={};_0x469029[_0x3fa1d2]={'$like':'%'+_0x1f63a7[_0xec75('0x43')][_0xec75('0x50')]+'%'};return _0x469029;})});}_0xe50a11=_['merge']({},_0xe50a11,_0x1f63a7['options']);return db[_0xec75('0x67')][_0xec75('0x30')]({'where':_0xe50a11[_0xec75('0x4e')]})[_0xec75('0x23')](function(_0x4026aa){_0x1ded80[_0xec75('0x30')]=_0x4026aa;if(_0x1f63a7[_0xec75('0x43')]['includeAll']){_0xe50a11['include']=[{'all':!![]}];}return db[_0xec75('0x67')]['findAll'](_0xe50a11);})['then'](function(_0x55e6aa){_0x1ded80['rows']=_0x55e6aa;return _0x1ded80;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x4139f7,_0xe50a11))[_0xec75('0x2c')](handleError(_0x4139f7,null));};exports[_0xec75('0x6b')]=function(_0x381849,_0x21acf3,_0x5a4b37){return db[_0xec75('0x3f')]['find']({'where':{'id':_0x381849['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x21acf3,null))[_0xec75('0x23')](function(_0x45214f){if(_0x45214f){return _0x45214f[_0xec75('0x6b')](_0x381849[_0xec75('0x43')][_0xec75('0x64')]);}})[_0xec75('0x23')](respondWithStatusCode(_0x21acf3,null))[_0xec75('0x2c')](handleError(_0x21acf3,null));};exports[_0xec75('0x68')]=function(_0x109b4f,_0xdf3575){var _0x3e856a={'name':_0x109b4f[_0xec75('0x5b')][_0xec75('0x38')],'key':_0x109b4f['body'][_0xec75('0x42')],'email':_0x109b4f[_0xec75('0x5b')]['email'],'ListId':_0x109b4f['body'][_0xec75('0x6c')],'active':!_[_0xec75('0x6d')](_0x109b4f[_0xec75('0x5b')][_0xec75('0x6e')])?_0x109b4f[_0xec75('0x5b')][_0xec75('0x6e')]:!![],'description':_0x109b4f['body'][_0xec75('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0xec75('0x6d')](_0x109b4f[_0xec75('0x5b')]['cservice'])){if(_0x109b4f['body'][_0xec75('0x70')]){_0x3e856a['Imap'][_0xec75('0x71')]=_0x3e856a['Smtp'][_0xec75('0x71')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x72')];_0x3e856a[_0xec75('0x3a')][_0xec75('0x73')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x74')]=_0x109b4f['body'][_0xec75('0x75')];}else{_0x3e856a[_0xec75('0x3a')][_0xec75('0x76')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x76')]=![];}_0x3e856a[_0xec75('0x3a')]['host']=_0x109b4f[_0xec75('0x5b')]['Imap']['host'];_0x3e856a[_0xec75('0x3a')][_0xec75('0x77')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x3a')][_0xec75('0x77')];_0x3e856a[_0xec75('0x3c')][_0xec75('0x78')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x3c')][_0xec75('0x78')];_0x3e856a[_0xec75('0x3c')][_0xec75('0x77')]=_0x109b4f['body'][_0xec75('0x3c')][_0xec75('0x77')];}else{_0x3e856a[_0xec75('0x3a')][_0xec75('0x79')]=_0x3e856a['Smtp'][_0xec75('0x79')]=_0x109b4f[_0xec75('0x5b')]['cservice'];_0x3e856a['Imap'][_0xec75('0x71')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x71')]=_0x109b4f[_0xec75('0x5b')][_0xec75('0x72')];_0x3e856a['Imap'][_0xec75('0x73')]=_0x3e856a[_0xec75('0x3c')][_0xec75('0x74')]=_0x109b4f['body'][_0xec75('0x75')];}return db['MailAccount'][_0xec75('0x68')](_0x3e856a,{'include':[{'model':db['MailServerOut'],'as':_0xec75('0x3c')},{'model':db[_0xec75('0x39')],'as':_0xec75('0x3a')}]})[_0xec75('0x23')](function(_0xa5078d){var _0x58afe0=_0x109b4f['user'][_0xec75('0x36')]({'plain':!![]});if(!_0x58afe0)throw new Error(_0xec75('0x7a'));if(_0x58afe0['role']===_0xec75('0x71')){var _0x2e5877=_0xa5078d['get']({'plain':!![]});return db[_0xec75('0x7b')][_0xec75('0x5c')]({'where':{'name':_0xec75('0x7c'),'userProfileId':_0x58afe0[_0xec75('0x7d')]},'raw':!![]})[_0xec75('0x23')](function(_0x97d7de){if(_0x97d7de&&_0x97d7de[_0xec75('0x7e')]===0x0){return db[_0xec75('0x7f')][_0xec75('0x68')]({'name':_0x2e5877['name'],'resourceId':_0x2e5877['id'],'type':_0x97d7de[_0xec75('0x38')],'sectionId':_0x97d7de['id']},{})[_0xec75('0x23')](function(){return _0xa5078d;});}else{return _0xa5078d;}})[_0xec75('0x2c')](function(_0x213a08){logger['error'](_0xec75('0x80'),_0x213a08);throw _0x213a08;});}return _0xa5078d;})[_0xec75('0x23')](respondWithResult(_0xdf3575,0xc9))[_0xec75('0x2c')](handleError(_0xdf3575,null));};exports[_0xec75('0x81')]=function(_0x364592,_0x336832,_0x4a5105){return db[_0xec75('0x3f')]['findOne']({'where':{'id':_0x364592[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x336832,null))['then'](function(_0x33849e){if(_0x33849e){return _0x33849e['getImap']();}return null;})[_0xec75('0x23')](respondWithResult(_0x336832,null))[_0xec75('0x2c')](handleError(_0x336832,null));};exports[_0xec75('0x82')]=function(_0x300860,_0x5da765,_0x22e90a){if(_0x300860[_0xec75('0x5b')]['id']){delete _0x300860[_0xec75('0x5b')]['id'];}return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0x300860[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x5da765,null))[_0xec75('0x23')](function(_0x2acbbe){if(_0x2acbbe){_0x300860[_0xec75('0x5b')][_0xec75('0x66')]=_0x2acbbe['id'];return db[_0xec75('0x39')][_0xec75('0x68')](_0x300860[_0xec75('0x5b')]);}})[_0xec75('0x23')](respondWithResult(_0x5da765,null))['catch'](handleError(_0x5da765,null));};exports[_0xec75('0x83')]=function(_0x15556b,_0x2bdf5c,_0x3be850){return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x15556b[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x2bdf5c,null))[_0xec75('0x23')](function(_0x3a041b){if(_0x3a041b){return _0x3a041b[_0xec75('0x84')](null);}return null;})[_0xec75('0x23')](respondWithStatusCode(_0x2bdf5c,null))[_0xec75('0x2c')](handleError(_0x2bdf5c,null));};exports['getSmtp']=function(_0x19cb4f,_0x41bcb7,_0x4e151c){return db['MailAccount'][_0xec75('0x6a')]({'where':{'id':_0x19cb4f[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x41bcb7,null))[_0xec75('0x23')](function(_0x1b7d3e){if(_0x1b7d3e){return _0x1b7d3e[_0xec75('0x85')]();}return null;})[_0xec75('0x23')](respondWithResult(_0x41bcb7,null))['catch'](handleError(_0x41bcb7,null));};exports['addSmtp']=function(_0xf3ec1d,_0x2baca8,_0x2faf8e){if(_0xf3ec1d[_0xec75('0x5b')]['id']){delete _0xf3ec1d[_0xec75('0x5b')]['id'];}return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0xf3ec1d[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x2baca8,null))[_0xec75('0x23')](function(_0x270070){if(_0x270070){_0xf3ec1d[_0xec75('0x5b')][_0xec75('0x66')]=_0x270070['id'];return db[_0xec75('0x3b')][_0xec75('0x68')](_0xf3ec1d[_0xec75('0x5b')]);}})[_0xec75('0x23')](respondWithResult(_0x2baca8,null))[_0xec75('0x2c')](handleError(_0x2baca8,null));};exports[_0xec75('0x86')]=function(_0x24f4ab,_0x7945,_0x1b89b1){return db['MailAccount'][_0xec75('0x6a')]({'where':{'id':_0x24f4ab[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x7945,null))[_0xec75('0x23')](function(_0x4c5245){if(_0x4c5245){return _0x4c5245['setSmtp'](null);}return null;})[_0xec75('0x23')](respondWithStatusCode(_0x7945,null))[_0xec75('0x2c')](handleError(_0x7945,null));};exports[_0xec75('0x87')]=function(_0x168f6d,_0x4f05ec,_0x26ba5c){return db[_0xec75('0x88')][_0xec75('0x5c')]({'where':{'id':_0x168f6d[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x4f05ec,null))[_0xec75('0x23')](function(_0x4c84a8){if(_0x4c84a8){return _0x4c84a8[_0xec75('0x87')](_0x168f6d[_0xec75('0x5b')][_0xec75('0x64')],_['omit'](_0x168f6d['body'],[_0xec75('0x64'),'id'])||{});}})[_0xec75('0x23')](respondWithResult(_0x4f05ec,null))['catch'](handleError(_0x4f05ec,null));};exports[_0xec75('0x89')]=function(_0x4e5191,_0x1f82a2,_0xb4cc5b){var _0x61ed9b={'raw':![],'where':{}};var _0x45a321={};var _0x969efe={'count':0x0,'rows':[]};return db[_0xec75('0x3f')]['findOne']({'where':{'id':_0x4e5191['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x1f82a2,null))['then'](function(_0x2224d3){if(_0x2224d3){_0x45a321[_0xec75('0x46')]=_[_0xec75('0x44')](db[_0xec75('0x88')][_0xec75('0x40')]);_0x45a321['query']=_[_0xec75('0x44')](_0x4e5191[_0xec75('0x43')]);_0x45a321[_0xec75('0x45')]=_[_0xec75('0x5a')](_0x45a321[_0xec75('0x46')],_0x45a321[_0xec75('0x43')]);_0x61ed9b['attributes']=_[_0xec75('0x5a')](_0x45a321['model'],qs[_0xec75('0x47')](_0x4e5191[_0xec75('0x43')][_0xec75('0x47')]));_0x61ed9b[_0xec75('0x48')]=_0x61ed9b[_0xec75('0x48')]['length']?_0x61ed9b[_0xec75('0x48')]:_0x45a321[_0xec75('0x46')];if(!_0x4e5191[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x61ed9b[_0xec75('0x4b')]=qs['limit'](_0x4e5191[_0xec75('0x43')]['limit']);_0x61ed9b['offset']=qs[_0xec75('0x31')](_0x4e5191[_0xec75('0x43')]['offset']);}_0x61ed9b[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x4e5191[_0xec75('0x43')]['sort']);_0x61ed9b[_0xec75('0x4e')]=qs[_0xec75('0x45')](_[_0xec75('0x4f')](_0x4e5191[_0xec75('0x43')],_0x45a321['filters']));_0x61ed9b[_0xec75('0x4e')]['MailAccountId']=_0x2224d3['id'];if(_0x4e5191[_0xec75('0x43')][_0xec75('0x50')]){_0x61ed9b[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x61ed9b[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x61ed9b['attributes'],function(_0x46f320){var _0x25d149={};_0x25d149[_0x46f320]={'$like':'%'+_0x4e5191[_0xec75('0x43')]['filter']+'%'};return _0x25d149;})});}_0x61ed9b=_[_0xec75('0x51')]({},_0x61ed9b,_0x4e5191[_0xec75('0x53')]);return db[_0xec75('0x88')][_0xec75('0x30')]({'where':_0x61ed9b[_0xec75('0x4e')]})[_0xec75('0x23')](function(_0x34b92d){_0x969efe[_0xec75('0x30')]=_0x34b92d;if(_0x4e5191['query'][_0xec75('0x54')]){_0x61ed9b[_0xec75('0x55')]=[{'model':db[_0xec75('0x8a')],'as':_0xec75('0x8b'),'required':![]},{'model':db[_0xec75('0x8c')],'as':'Owner','attributes':[_0xec75('0x38'),_0xec75('0x8d'),_0xec75('0x8e')],'required':![]},{'model':db[_0xec75('0x8f')],'as':_0xec75('0x90'),'attributes':['id',_0xec75('0x38'),_0xec75('0x91')],'where':_0x4e5191[_0xec75('0x43')][_0xec75('0x92')]?{'id':_0x4e5191[_0xec75('0x43')][_0xec75('0x92')]}:undefined,'required':_0x4e5191[_0xec75('0x43')]['tag']?!![]:![]}];}return db[_0xec75('0x88')]['findAll'](_0x61ed9b);})[_0xec75('0x23')](function(_0x29479d){_0x969efe[_0xec75('0x62')]=_0x29479d;return _0x969efe;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x1f82a2,_0x61ed9b))['catch'](handleError(_0x1f82a2,null));};exports[_0xec75('0x93')]=function(_0x327274,_0x4b1325,_0x5dcc8d){return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x327274[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x4b1325,null))[_0xec75('0x23')](function(_0x57fa87){if(_0x57fa87){return db[_0xec75('0x94')][_0xec75('0x95')](function(_0x2b7e39){return db['MailApplication'][_0xec75('0x35')]({'where':{'MailAccountId':_0x327274[_0xec75('0x58')]['id']},'transaction':_0x2b7e39})[_0xec75('0x23')](function(_0x3c8e37){var _0x32b8a8=_[_0xec75('0x3e')](_0x327274[_0xec75('0x5b')],function(_0x22c472){_0x22c472[_0xec75('0x66')]=_0x327274[_0xec75('0x58')]['id'];return _0x22c472;});return db[_0xec75('0x96')][_0xec75('0x97')](_0x32b8a8,{'transaction':_0x2b7e39});});})['then'](function(){return db[_0xec75('0x96')]['findAndCountAll']({'where':{'MailAccountId':_0x327274[_0xec75('0x58')]['id']},'order':_0xec75('0x98')});});}})['then'](respondWithResult(_0x4b1325,null))[_0xec75('0x2c')](handleError(_0x4b1325,null));};exports[_0xec75('0x99')]=function(_0x26962f,_0x362439,_0x1b352c){var _0x16df8f={};var _0x200939={};var _0x81a9d5;var _0x3e8d33;return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x26962f[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x362439,null))['then'](function(_0x46dbcf){if(_0x46dbcf){_0x81a9d5=_0x46dbcf;_0x200939['model']=_[_0xec75('0x44')](db[_0xec75('0x96')][_0xec75('0x40')]);_0x200939[_0xec75('0x43')]=_[_0xec75('0x44')](_0x26962f['query']);_0x200939['filters']=_[_0xec75('0x5a')](_0x200939[_0xec75('0x46')],_0x200939[_0xec75('0x43')]);_0x16df8f[_0xec75('0x48')]=_['intersection'](_0x200939[_0xec75('0x46')],qs[_0xec75('0x47')](_0x26962f[_0xec75('0x43')][_0xec75('0x47')]));_0x16df8f[_0xec75('0x48')]=_0x16df8f['attributes']['length']?_0x16df8f[_0xec75('0x48')]:_0x200939[_0xec75('0x46')];_0x16df8f[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x26962f[_0xec75('0x43')]['sort']);_0x16df8f['where']=qs[_0xec75('0x45')](_['pick'](_0x26962f[_0xec75('0x43')],_0x200939[_0xec75('0x45')]));if(_0x26962f[_0xec75('0x43')]['filter']){_0x16df8f[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x16df8f['where'],{'$or':_['map'](_0x16df8f[_0xec75('0x48')],function(_0x253ef2){var _0x21fea2={};_0x21fea2[_0x253ef2]={'$like':'%'+_0x26962f[_0xec75('0x43')]['filter']+'%'};return _0x21fea2;})});}_0x16df8f=_['merge']({},_0x16df8f,_0x26962f[_0xec75('0x53')]);return _0x81a9d5['getApplications'](_0x16df8f);}})[_0xec75('0x23')](function(_0x3f9fc9){if(_0x3f9fc9){_0x3e8d33=_0x3f9fc9['length'];if(!_0x26962f[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x16df8f[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x26962f[_0xec75('0x43')][_0xec75('0x4b')]);_0x16df8f[_0xec75('0x31')]=qs['offset'](_0x26962f['query'][_0xec75('0x31')]);}return _0x81a9d5[_0xec75('0x99')](_0x16df8f);}})[_0xec75('0x23')](function(_0x969538){if(_0x969538){return _0x969538?{'count':_0x3e8d33,'rows':_0x969538}:null;}})['then'](respondWithResult(_0x362439,null))[_0xec75('0x2c')](handleError(_0x362439,null));};exports[_0xec75('0x9a')]=function(_0x2d99d0,_0x197d76,_0x48c09b){var _0x10d962={'raw':!![],'where':{}};var _0x1af1d6={};var _0x3e86c3={'count':0x0,'rows':[]};return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x2d99d0[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x197d76,null))[_0xec75('0x23')](function(_0x4ff7a2){if(_0x4ff7a2){_0x1af1d6[_0xec75('0x46')]=_[_0xec75('0x44')](db[_0xec75('0x9b')][_0xec75('0x40')]);_0x1af1d6[_0xec75('0x43')]=_[_0xec75('0x44')](_0x2d99d0[_0xec75('0x43')]);_0x1af1d6[_0xec75('0x45')]=_[_0xec75('0x5a')](_0x1af1d6[_0xec75('0x46')],_0x1af1d6['query']);_0x10d962[_0xec75('0x48')]=_['intersection'](_0x1af1d6[_0xec75('0x46')],qs['fields'](_0x2d99d0['query'][_0xec75('0x47')]));_0x10d962[_0xec75('0x48')]=_0x10d962['attributes'][_0xec75('0x49')]?_0x10d962['attributes']:_0x1af1d6[_0xec75('0x46')];if(!_0x2d99d0[_0xec75('0x43')][_0xec75('0x61')](_0xec75('0x4a'))){_0x10d962['limit']=qs[_0xec75('0x4b')](_0x2d99d0[_0xec75('0x43')]['limit']);_0x10d962['offset']=qs[_0xec75('0x31')](_0x2d99d0[_0xec75('0x43')][_0xec75('0x31')]);}_0x10d962[_0xec75('0x4c')]=qs['sort'](_0x2d99d0[_0xec75('0x43')][_0xec75('0x4d')]);_0x10d962['where']=qs[_0xec75('0x45')](_[_0xec75('0x4f')](_0x2d99d0[_0xec75('0x43')],_0x1af1d6[_0xec75('0x45')]));_0x10d962['where'][_0xec75('0x66')]=_0x4ff7a2['id'];if(_0x2d99d0[_0xec75('0x43')][_0xec75('0x50')]){_0x10d962[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x10d962[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x10d962[_0xec75('0x48')],function(_0x439d37){var _0x4d6ead={};_0x4d6ead[_0x439d37]={'$like':'%'+_0x2d99d0[_0xec75('0x43')][_0xec75('0x50')]+'%'};return _0x4d6ead;})});}if(_0x2d99d0['query'][_0xec75('0x9c')]){var _0x513571=_0x2d99d0[_0xec75('0x43')]['$gte'][_0xec75('0x9d')](',');var _0x229f4b={};_0x229f4b[_0x513571[0x0]]={'$gte':moment(_0x513571[0x1])[_0xec75('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10d962[_0xec75('0x4e')]=_['merge'](_0x10d962[_0xec75('0x4e')],_0x229f4b);}_0x10d962=_['merge']({},_0x10d962,_0x2d99d0[_0xec75('0x53')]);return db['MailMessage'][_0xec75('0x30')]({'where':_0x10d962[_0xec75('0x4e')]})['then'](function(_0x5e6ceb){_0x3e86c3[_0xec75('0x30')]=_0x5e6ceb;if(_0x2d99d0[_0xec75('0x43')][_0xec75('0x54')]){_0x10d962[_0xec75('0x55')]=[{'all':!![]}];}return db[_0xec75('0x9b')][_0xec75('0x56')](_0x10d962);})[_0xec75('0x23')](function(_0x3d6782){_0x3e86c3[_0xec75('0x62')]=_0x3d6782;return _0x3e86c3;});}})[_0xec75('0x23')](respondWithFilteredResult(_0x197d76,_0x10d962))[_0xec75('0x2c')](handleError(_0x197d76,null));};exports[_0xec75('0x9f')]=function(_0x791fac,_0x19ddef,_0xa67cd5){var _0x3a4b86,_0x5aad42={},_0x5191c6;if(_0x791fac[_0xec75('0x5b')]['to']){_0x5191c6=_0x791fac[_0xec75('0x5b')]['to'][_0xec75('0x9d')](',')[0x0];}return db[_0xec75('0x3f')]['find']({'where':{'id':_0x791fac['params']['id']},'include':[{'model':db[_0xec75('0xa0')],'as':_0xec75('0xa1'),'include':[{'model':db['CmContact'],'as':_0xec75('0xa2'),'where':{'email':_0x5191c6},'limit':0x1,'order':[[_0xec75('0xa3'),_0xec75('0xa4')]]}]},{'model':db[_0xec75('0x3b')],'as':_0xec75('0x3c'),'raw':!![]}]})[_0xec75('0x23')](handleEntityNotFound(_0x19ddef,null))['then'](function(_0x5e4a39){if(_0x5e4a39){_0x3a4b86=_0x5e4a39;if(_0x5e4a39[_0xec75('0x3c')]){if(_['isNil'](_0x791fac[_0xec75('0x5b')][_0xec75('0xa5')])){_0x791fac[_0xec75('0x5b')][_0xec75('0xa5')]=util[_0xec75('0x9e')](_0xec75('0xa6'),_0x5e4a39[_0xec75('0x38')],_0x5e4a39[_0xec75('0xa7')]||_0x5e4a39[_0xec75('0x3c')][_0xec75('0x71')]);}if(_0x791fac[_0xec75('0x5b')]['attachments']&&_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0xec75('0x49')]){for(var _0x26bb22=0x0;_0x26bb22<_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')]['length'];_0x26bb22+=0x1){_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0x26bb22]={'filename':_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0x26bb22][_0xec75('0x38')],'path':path[_0xec75('0xa9')](config['root'],_0xec75('0xaa'),_0x791fac[_0xec75('0x5b')][_0xec75('0xa8')][_0x26bb22]['basename'])};}}var _0x1977cb={'tls':{'rejectUnauthorized':![]}};if(_[_0xec75('0x6d')](_0x5e4a39[_0xec75('0x3c')][_0xec75('0x79')])){if(_0x5e4a39[_0xec75('0x3c')][_0xec75('0x76')]){_0x1977cb['auth']={'user':_0x5e4a39[_0xec75('0x3c')][_0xec75('0x71')],'pass':_0x5e4a39[_0xec75('0x3c')][_0xec75('0x74')]};}_0x1977cb[_0xec75('0x78')]=_0x5e4a39[_0xec75('0x3c')][_0xec75('0x78')];_0x1977cb[_0xec75('0x77')]=_0x5e4a39[_0xec75('0x3c')]['port'];_0x1977cb['secure']=_0x5e4a39[_0xec75('0x3c')][_0xec75('0xab')];}else{_0x1977cb[_0xec75('0x79')]=_0x5e4a39[_0xec75('0x3c')][_0xec75('0x79')];_0x1977cb[_0xec75('0xac')]={'user':_0x5e4a39[_0xec75('0x3c')][_0xec75('0x71')],'pass':_0x5e4a39['Smtp'][_0xec75('0x74')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x1977cb,'message':_0x791fac[_0xec75('0x5b')]});}else{throw new Error(_0xec75('0xad'));}}})[_0xec75('0x23')](function(_0xb493c9){if(_0xb493c9){_0x5aad42=_0xb493c9;if(_0x3a4b86[_0xec75('0xa1')]){if(_0x3a4b86[_0xec75('0xa1')][_0xec75('0xa2')][_0xec75('0x49')]){return _0x3a4b86[_0xec75('0xa1')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xec75('0xae')](_0x791fac[_0xec75('0x5b')],{'firstName':_0x791fac[_0xec75('0x5b')]['to'],'email':_0x791fac[_0xec75('0x5b')]['to'],'phone':_0x791fac[_0xec75('0x5b')]['to'],'ListId':_0x3a4b86[_0xec75('0x6c')]}));}}else{throw new Error(_0xec75('0xad'));}}})[_0xec75('0x23')](function(_0x23c0a8){if(_0x23c0a8){var _0x14f26c={'UserId':_0x791fac['user']['id'],'ContactId':_0x23c0a8['id'],'MailAccountId':_0x3a4b86['id'],'inReplyTo':_0x5aad42[_0xec75('0xaf')],'to':_0x791fac['body'][_0xec75('0xa5')],'cc':_0x791fac[_0xec75('0x5b')]['cc'],'subject':_0x791fac[_0xec75('0x5b')]['subject'],'attach':_0x791fac[_0xec75('0x5b')][_0xec75('0xb0')],'firstMsgDirection':_0xec75('0xb1'),'lastMsgAt':moment()[_0xec75('0x9e')](_0xec75('0xb2')),'lastMsgDirection':_0xec75('0xb1'),'lastMsgBody':_0x791fac[_0xec75('0x5b')]['body'],'Messages':[_[_0xec75('0x51')](_0x791fac[_0xec75('0x5b')],{'messageId':_0x5aad42['messageId'],'sentAt':moment()[_0xec75('0x9e')](_0xec75('0xb2')),'read':!![],'MailAccountId':_0x3a4b86['id'],'UserId':_0x791fac[_0xec75('0x71')]['id'],'ContactId':_0x23c0a8['id']})]};if(_0x791fac['body'][_0xec75('0xb3')]){_0x14f26c=_[_0xec75('0x51')](_0x14f26c,_0x791fac[_0xec75('0x5b')]['Interaction']);}return db[_0xec75('0x88')]['create'](_0x14f26c,{'include':[{'model':db[_0xec75('0x9b')],'as':_0xec75('0xb4')}]});}})[_0xec75('0x23')](respondWithResult(_0x19ddef,null))[_0xec75('0x2c')](handleError(_0x19ddef,null));};exports[_0xec75('0xb5')]=function(_0x5e4ce5,_0x574e92,_0x5e3bbb){return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0x5e4ce5[_0xec75('0x58')]['id']},'include':[{'model':db[_0xec75('0x3b')],'as':_0xec75('0x3c'),'raw':!![]}]})[_0xec75('0x23')](handleEntityNotFound(_0x574e92,null))['then'](function(_0x4a8766){if(_0x4a8766&&_0x4a8766['Smtp']){var _0xd5325c={'id':_0x4a8766['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a8766[_0xec75('0x3c')][_0xec75('0x79')]){_0xd5325c[_0xec75('0x79')]=_0x4a8766[_0xec75('0x3c')][_0xec75('0x79')];}else{_0xd5325c[_0xec75('0x78')]=_0x4a8766[_0xec75('0x3c')][_0xec75('0x78')];_0xd5325c[_0xec75('0x77')]=_0x4a8766['Smtp'][_0xec75('0x77')];_0xd5325c[_0xec75('0xab')]=_0x4a8766[_0xec75('0x3c')]['secure'];}if(_0x4a8766['Smtp'][_0xec75('0x76')]){_0xd5325c[_0xec75('0xac')]={'user':_0x4a8766[_0xec75('0x3c')]['user'],'pass':_0x4a8766['Smtp'][_0xec75('0x74')]};}return respondWithRpcPromise(_0xec75('0xb6'),'verifySmtp',{'account':_0xd5325c});}})[_0xec75('0x23')](respondWithResult(_0x574e92,null))[_0xec75('0x2c')](handleError(_0x574e92,null));};exports[_0xec75('0x35')]=function(_0x288d23,_0x150715){return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0x288d23[_0xec75('0x58')]['id']}})['then'](handleEntityNotFound(_0x150715,null))[_0xec75('0x23')](function(_0x4de37d){if(_0x4de37d&&_0x4de37d[_0xec75('0x79')]){throw new db['Sequelize']['ValidationError'](_0xec75('0xb7'));}return _0x4de37d;})[_0xec75('0x23')](removeEntity(_0x150715,null))[_0xec75('0x2c')](handleError(_0x150715,null));};exports[_0xec75('0xb8')]=function(_0x284718,_0x395fb8,_0x59a077){return db['MailAccount'][_0xec75('0x5c')]({'where':{'id':_0x284718[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x395fb8,null))[_0xec75('0x23')](function(_0x214b14){if(_0x214b14){return _0x214b14[_0xec75('0xb8')](_0x284718[_0xec75('0x5b')]['ids'],_[_0xec75('0xb9')](_0x284718[_0xec75('0x5b')],['ids','id'])||{})[_0xec75('0xba')](function(_0x2f1b7d){for(var _0x2bc440=0x0;_0x2bc440<_0x284718[_0xec75('0x5b')]['ids'][_0xec75('0x49')];_0x2bc440+=0x1){socket[_0xec75('0xbb')](_0xec75('0xbc'),{'UserId':_0x284718[_0xec75('0x5b')][_0xec75('0x64')][_0x2bc440],'MailAccountId':_0x284718[_0xec75('0x58')]['id']});}return _0x2f1b7d;});}})[_0xec75('0x23')](respondWithResult(_0x395fb8,null))['catch'](handleError(_0x395fb8,null));};exports[_0xec75('0xbd')]=function(_0x13ded9,_0x337f10,_0x3ec0a2){return db[_0xec75('0x3f')][_0xec75('0x5c')]({'where':{'id':_0x13ded9[_0xec75('0x58')]['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x337f10,null))[_0xec75('0x23')](function(_0x3cecb3){if(_0x3cecb3){return _0x3cecb3['removeAgents'](_0x13ded9[_0xec75('0x43')][_0xec75('0x64')])[_0xec75('0x23')](function(){if(_[_0xec75('0xbe')](_0x13ded9['query'][_0xec75('0x64')])){for(var _0x564322=0x0;_0x564322<_0x13ded9[_0xec75('0x43')][_0xec75('0x64')][_0xec75('0x49')];_0x564322+=0x1){socket[_0xec75('0xbb')](_0xec75('0xbf'),{'UserId':Number(_0x13ded9['query'][_0xec75('0x64')][_0x564322]),'MailAccountId':Number(_0x13ded9[_0xec75('0x58')]['id'])});}}else{socket['emit'](_0xec75('0xbf'),{'UserId':Number(_0x13ded9[_0xec75('0x43')][_0xec75('0x64')]),'MailAccountId':Number(_0x13ded9[_0xec75('0x58')]['id'])});}});}})[_0xec75('0x23')](respondWithStatusCode(_0x337f10,null))['catch'](handleError(_0x337f10,null));};exports['getAgents']=function(_0x4af05c,_0x5aaeb0,_0x1907d3){var _0x5c6cb5={};var _0x48f916={};var _0x434845;var _0x38ed81;return db[_0xec75('0x3f')][_0xec75('0x6a')]({'where':{'id':_0x4af05c['params']['id']}})[_0xec75('0x23')](handleEntityNotFound(_0x5aaeb0,null))[_0xec75('0x23')](function(_0x1af64c){if(_0x1af64c){_0x434845=_0x1af64c;_0x48f916[_0xec75('0x46')]=_['keys'](db[_0xec75('0x8c')]['rawAttributes']);_0x48f916[_0xec75('0x43')]=_[_0xec75('0x44')](_0x4af05c['query']);_0x48f916['filters']=_[_0xec75('0x5a')](_0x48f916['model'],_0x48f916[_0xec75('0x43')]);_0x5c6cb5[_0xec75('0x48')]=_[_0xec75('0x5a')](_0x48f916[_0xec75('0x46')],qs[_0xec75('0x47')](_0x4af05c['query'][_0xec75('0x47')]));_0x5c6cb5['attributes']=_0x5c6cb5[_0xec75('0x48')][_0xec75('0x49')]?_0x5c6cb5[_0xec75('0x48')]:_0x48f916[_0xec75('0x46')];_0x5c6cb5[_0xec75('0x4c')]=qs[_0xec75('0x4d')](_0x4af05c['query'][_0xec75('0x4d')]);_0x5c6cb5[_0xec75('0x4e')]=qs[_0xec75('0x45')](_['pick'](_0x4af05c[_0xec75('0x43')],_0x48f916[_0xec75('0x45')]));if(_0x4af05c[_0xec75('0x43')][_0xec75('0x50')]){_0x5c6cb5[_0xec75('0x4e')]=_[_0xec75('0x51')](_0x5c6cb5[_0xec75('0x4e')],{'$or':_[_0xec75('0x3e')](_0x5c6cb5['attributes'],function(_0x4d5db6){var _0x37be5f={};_0x37be5f[_0x4d5db6]={'$like':'%'+_0x4af05c['query'][_0xec75('0x50')]+'%'};return _0x37be5f;})});}_0x5c6cb5=_['merge']({},_0x5c6cb5,_0x4af05c['options']);return _0x434845[_0xec75('0xc0')](_0x5c6cb5);}})[_0xec75('0x23')](function(_0x594107){if(_0x594107){_0x38ed81=_0x594107[_0xec75('0x49')];if(!_0x4af05c['query'][_0xec75('0x61')](_0xec75('0x4a'))){_0x5c6cb5[_0xec75('0x4b')]=qs[_0xec75('0x4b')](_0x4af05c[_0xec75('0x43')][_0xec75('0x4b')]);_0x5c6cb5[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x4af05c['query'][_0xec75('0x31')]);}return _0x434845[_0xec75('0xc0')](_0x5c6cb5);}})[_0xec75('0x23')](function(_0x2396c3){if(_0x2396c3){return _0x2396c3?{'count':_0x38ed81,'rows':_0x2396c3}:null;}})[_0xec75('0x23')](respondWithResult(_0x5aaeb0,null))[_0xec75('0x2c')](handleError(_0x5aaeb0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 74e1fec..acb399f 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 _0x1dea=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x1dea,0xfd));var _0xa1de=function(_0x433dbe,_0x2412bc){_0x433dbe=_0x433dbe-0x0;var _0x3c147b=_0x1dea[_0x433dbe];return _0x3c147b;};'use strict';var EventEmitter=require(_0xa1de('0x0'));var MailAccount=require(_0xa1de('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa1de('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1de('0x3'),'afterDestroy':_0xa1de('0x4')};function emitEvent(_0x3c35b2){return function(_0x1649c1,_0x12bb5d,_0x21ace8){MailAccountEvents[_0xa1de('0x5')](_0x3c35b2+':'+_0x1649c1['id'],_0x1649c1);MailAccountEvents[_0xa1de('0x5')](_0x3c35b2,_0x1649c1);_0x21ace8(null);};}for(var e in events){if(events[_0xa1de('0x6')](e)){var event=events[e];MailAccount[_0xa1de('0x7')](e,emitEvent(event));}}module[_0xa1de('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x96e8=['exports','events','../../mysqldb','MailAccount','update','remove','emit','hook'];(function(_0x4b0db2,_0x2c115b){var _0x2fd0e3=function(_0x334be9){while(--_0x334be9){_0x4b0db2['push'](_0x4b0db2['shift']());}};_0x2fd0e3(++_0x2c115b);}(_0x96e8,0x99));var _0x896e=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x96e8[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0x896e('0x0'));var MailAccount=require(_0x896e('0x1'))['db'][_0x896e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x896e('0x3'),'afterDestroy':_0x896e('0x4')};function emitEvent(_0xe30ae8){return function(_0x410364,_0x16ce4a,_0x2e29fc){MailAccountEvents[_0x896e('0x5')](_0xe30ae8+':'+_0x410364['id'],_0x410364);MailAccountEvents[_0x896e('0x5')](_0xe30ae8,_0x410364);_0x2e29fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x896e('0x6')](e,emitEvent(event));}}module[_0x896e('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c3e3dae..ea0c281 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 _0x003a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','lodash','util'];(function(_0x3995dc,_0x1f14a9){var _0x4647c7=function(_0xf41e04){while(--_0xf41e04){_0x3995dc['push'](_0x3995dc['shift']());}};_0x4647c7(++_0x1f14a9);}(_0x003a,0xca));var _0xa003=function(_0x1316be,_0x5edf66){_0x1316be=_0x1316be-0x0;var _0x2c9864=_0x003a[_0x1316be];return _0x2c9864;};'use strict';var _=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var logger=require(_0xa003('0x2'))(_0xa003('0x3'));var moment=require(_0xa003('0x4'));var BPromise=require(_0xa003('0x5'));var rp=require(_0xa003('0x6'));var fs=require('fs');var path=require(_0xa003('0x7'));var rimraf=require(_0xa003('0x8'));var config=require(_0xa003('0x9'));var attributes=require(_0xa003('0xa'));module[_0xa003('0xb')]=function(_0x1734d0,_0x13f52e){return _0x1734d0['define']('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e0c=['mail_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x212f56,_0xfaa7dd){var _0x59b847=function(_0x2b6aed){while(--_0x2b6aed){_0x212f56['push'](_0x212f56['shift']());}};_0x59b847(++_0xfaa7dd);}(_0x9e0c,0x121));var _0xc9e0=function(_0x13d68e,_0x1ee2fd){_0x13d68e=_0x13d68e-0x0;var _0x314e59=_0x9e0c[_0x13d68e];return _0x314e59;};'use strict';var _=require(_0xc9e0('0x0'));var util=require(_0xc9e0('0x1'));var logger=require(_0xc9e0('0x2'))(_0xc9e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9e0('0x4'));var fs=require('fs');var path=require(_0xc9e0('0x5'));var rimraf=require(_0xc9e0('0x6'));var config=require(_0xc9e0('0x7'));var attributes=require(_0xc9e0('0x8'));module[_0xc9e0('0x9')]=function(_0x353514,_0x3c2d33){return _0x353514[_0xc9e0('0xa')]('MailAccount',attributes,{'tableName':_0xc9e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ce58a6c..c3b965a 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 _0xa3b9=['where','attributes','limit','include','model','map','info','GetMailAccount','debug','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','Applications','Smtp','get','omit','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','create','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','Messages','inReplyTo','update','interaction','created','MailMessage','contact','attachments','originTo','originCc','bcc','Attachments','UserId','User','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','MailAccount','findAll','options','raw'];(function(_0x341df2,_0x5eabfe){var _0x141e56=function(_0x3e4a1a){while(--_0x3e4a1a){_0x341df2['push'](_0x341df2['shift']());}};_0x141e56(++_0x5eabfe);}(_0xa3b9,0x112));var _0x9a3b=function(_0x341e95,_0x18ab0c){_0x341e95=_0x341e95-0x0;var _0x2af873=_0xa3b9[_0x341e95];return _0x2af873;};'use strict';var _=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var moment=require(_0x9a3b('0x2'));var BPromise=require(_0x9a3b('0x3'));var rs=require(_0x9a3b('0x4'));var fs=require('fs');var Redis=require(_0x9a3b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a3b('0x6'));var logger=require(_0x9a3b('0x7'))(_0x9a3b('0x8'));var config=require(_0x9a3b('0x9'));var jayson=require(_0x9a3b('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0x9a3b('0xb')]=_[_0x9a3b('0xc')](config[_0x9a3b('0xb')],{'host':_0x9a3b('0xd'),'port':0x18eb});var socket=require(_0x9a3b('0xe'))(new Redis(config[_0x9a3b('0xb')]));require(_0x9a3b('0xf'))['register'](socket);function respondWithRpcPromise(_0x15ba19,_0x1beb32,_0x3dacdf){return new BPromise(function(_0x3e5858,_0x4a4161){return client[_0x9a3b('0x10')](_0x15ba19,_0x3dacdf)[_0x9a3b('0x11')](function(_0x3457e5){logger['info']('MailAccount,\x20%s,\x20%s',_0x1beb32,_0x9a3b('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1beb32,_0x9a3b('0x12'),JSON[_0x9a3b('0x13')](_0x3457e5));if(_0x3457e5['error']){if(_0x3457e5[_0x9a3b('0x14')]['code']===0x1f4){logger[_0x9a3b('0x14')](_0x9a3b('0x15'),_0x1beb32,_0x3457e5[_0x9a3b('0x14')]['message']);return _0x4a4161(_0x3457e5['error'][_0x9a3b('0x16')]);}logger['error'](_0x9a3b('0x15'),_0x1beb32,_0x3457e5[_0x9a3b('0x14')][_0x9a3b('0x16')]);return _0x3e5858(_0x3457e5[_0x9a3b('0x14')][_0x9a3b('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1beb32,_0x9a3b('0x12'));_0x3e5858(_0x3457e5[_0x9a3b('0x17')]['message']);}})[_0x9a3b('0x18')](function(_0x32b520){logger[_0x9a3b('0x14')]('MailAccount,\x20%s,\x20%s',_0x1beb32,_0x32b520);_0x4a4161(_0x32b520);});});}exports['GetMailAccount']=function(_0x6ee019){var _0x55c97c=this;return new Promise(function(_0x4960ab,_0x34665e){return db[_0x9a3b('0x19')][_0x9a3b('0x1a')]({'raw':_0x6ee019[_0x9a3b('0x1b')]?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1c')]===undefined?!![]:![]:!![],'where':_0x6ee019['options']?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1d')]||null:null,'attributes':_0x6ee019[_0x9a3b('0x1b')]?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1e')]||null:null,'limit':_0x6ee019[_0x9a3b('0x1b')]?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x1f')]||null:null,'include':_0x6ee019['options']?_0x6ee019[_0x9a3b('0x1b')][_0x9a3b('0x20')]?_['map'](_0x6ee019['options'][_0x9a3b('0x20')],function(_0x23f0e2){return{'model':db[_0x23f0e2[_0x9a3b('0x21')]],'as':_0x23f0e2['as'],'attributes':_0x23f0e2[_0x9a3b('0x1e')],'include':_0x23f0e2['include']?_[_0x9a3b('0x22')](_0x23f0e2[_0x9a3b('0x20')],function(_0x9daa08){return{'model':db[_0x9daa08[_0x9a3b('0x21')]],'as':_0x9daa08['as'],'attributes':_0x9daa08[_0x9a3b('0x1e')],'include':_0x9daa08[_0x9a3b('0x20')]?_['map'](_0x9daa08[_0x9a3b('0x20')],function(_0x4eeb4b){return{'model':db[_0x4eeb4b[_0x9a3b('0x21')]],'as':_0x4eeb4b['as'],'attributes':_0x4eeb4b[_0x9a3b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9a3b('0x11')](function(_0x504b44){logger[_0x9a3b('0x23')](_0x9a3b('0x24'),_0x6ee019);logger[_0x9a3b('0x25')](_0x9a3b('0x24'),_0x6ee019,JSON[_0x9a3b('0x13')](_0x504b44));_0x4960ab(_0x504b44);})[_0x9a3b('0x18')](function(_0x4f1abe){logger['error'](_0x9a3b('0x24'),_0x4f1abe[_0x9a3b('0x16')],_0x6ee019);_0x34665e(_0x55c97c[_0x9a3b('0x14')](0x1f4,_0x4f1abe[_0x9a3b('0x16')]));});});};exports[_0x9a3b('0x26')]=function(_0x4ea56c){var _0x5b446c=this;return new Promise(function(_0x5b30c7,_0x38d06e){return db[_0x9a3b('0x19')]['find']({'raw':_0x4ea56c[_0x9a3b('0x1b')]?_0x4ea56c[_0x9a3b('0x1b')][_0x9a3b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ea56c['options']?_0x4ea56c['options'][_0x9a3b('0x1d')]||null:null,'attributes':_0x4ea56c['options']?_0x4ea56c[_0x9a3b('0x1b')]['attributes']||null:null,'include':_0x4ea56c[_0x9a3b('0x1b')]?_0x4ea56c['options'][_0x9a3b('0x20')]?_[_0x9a3b('0x22')](_0x4ea56c[_0x9a3b('0x1b')][_0x9a3b('0x20')],function(_0x3f5ab6){return{'model':db[_0x3f5ab6['model']],'as':_0x3f5ab6['as'],'attributes':_0x3f5ab6[_0x9a3b('0x1e')],'include':_0x3f5ab6['include']?_[_0x9a3b('0x22')](_0x3f5ab6[_0x9a3b('0x20')],function(_0x119044){return{'model':db[_0x119044[_0x9a3b('0x21')]],'as':_0x119044['as'],'attributes':_0x119044[_0x9a3b('0x1e')],'include':_0x119044[_0x9a3b('0x20')]?_['map'](_0x119044['include'],function(_0x3f06b6){return{'model':db[_0x3f06b6[_0x9a3b('0x21')]],'as':_0x3f06b6['as'],'attributes':_0x3f06b6[_0x9a3b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2819fa){logger['info'](_0x9a3b('0x26'),_0x4ea56c);logger[_0x9a3b('0x25')](_0x9a3b('0x26'),_0x4ea56c,JSON['stringify'](_0x2819fa));_0x5b30c7(_0x2819fa);})[_0x9a3b('0x18')](function(_0x1ca18a){logger[_0x9a3b('0x14')](_0x9a3b('0x26'),_0x1ca18a[_0x9a3b('0x16')],_0x4ea56c);_0x38d06e(_0x5b446c[_0x9a3b('0x14')](0x1f4,_0x1ca18a['message']));});});};exports[_0x9a3b('0x27')]=function(_0x33f136){var _0x3ba059=this;return new Promise(function(_0x493632,_0x341e7e){var _0x38b040={'body':_0x33f136[_0x9a3b('0x28')],'channel':_0x9a3b('0x29')};var _0x18a959=_[_0x9a3b('0x2a')](_[_0x9a3b('0x2b')](db[_0x9a3b('0x2c')][_0x9a3b('0x2d')]),['createdAt',_0x9a3b('0x2e'),_0x9a3b('0x2f'),_0x9a3b('0x30')]);var _0x1caec6=![];if(_0x33f136[_0x9a3b('0x28')]['id']){delete _0x33f136[_0x9a3b('0x28')]['id'];}if(_[_0x9a3b('0x31')](_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x32')])){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x33')));}if(_[_0x9a3b('0x31')](_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')])||_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')]===''){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x34')));}if(_[_0x9a3b('0x31')](_0x33f136[_0x9a3b('0x28')]['mapKey'])){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x35')+_0x18a959));}if(!_[_0x9a3b('0x36')](_0x18a959,_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x37')])){return _0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x9a3b('0x38')+_0x18a959));}var _0x149df1={};_0x149df1[_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x37')]]=_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x32')];return db[_0x9a3b('0x19')]['find']({'where':{'id':_0x33f136[_0x9a3b('0x39')]['id']},'include':[{'model':db[_0x9a3b('0x3a')],'as':_0x9a3b('0x3b'),'include':[{'model':db[_0x9a3b('0x2c')],'as':_0x9a3b('0x3c'),'where':_0x149df1,'limit':0x1,'order':[[_0x9a3b('0x2e'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x9a3b('0x3d')},{'model':db['MailServerOut'],'as':_0x9a3b('0x3e')}]})[_0x9a3b('0x11')](function(_0x1e23ef){if(_0x1e23ef&&_0x1e23ef[_0x9a3b('0x3b')]){var _0xbc13b3=_0x1e23ef[_0x9a3b('0x3f')]({'plain':!![]});_0x38b040[_0x9a3b('0x39')]=_[_0x9a3b('0x40')](_0xbc13b3,[_0x9a3b('0x3d'),_0x9a3b('0x3b')]);_0x38b040[_0x9a3b('0x41')]=_0xbc13b3[_0x9a3b('0x3d')];_0x38b040[_0x9a3b('0x42')]=_0xbc13b3[_0x9a3b('0x3b')];_0x38b040[_0x9a3b('0x41')]=_['orderBy'](_0x38b040[_0x9a3b('0x41')],[_0x9a3b('0x43')],[_0x9a3b('0x44')]);if(_0x38b040['account']&&_0x38b040[_0x9a3b('0x39')][_0x9a3b('0x45')]){_0x38b040['applications'][_0x9a3b('0x46')]({'id':0x0,'priority':_0x38b040[_0x9a3b('0x41')][_0x9a3b('0x47')]+0x1,'app':_0x9a3b('0x48'),'appdata':_0x9a3b('0x45'),'interval':_0x9a3b('0x49')});}if(_0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3d')]){delete _0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3d')];}if(_0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3b')]){delete _0x38b040[_0x9a3b('0x39')][_0x9a3b('0x3b')];}if(_0xbc13b3[_0x9a3b('0x3b')][_0x9a3b('0x3c')][_0x9a3b('0x47')]){return _0xbc13b3[_0x9a3b('0x3b')][_0x9a3b('0x3c')][0x0];}var _0x5488de=_['defaults'](_0x33f136[_0x9a3b('0x28')],{'firstName':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x32')],'ListId':_0xbc13b3[_0x9a3b('0x30')]});_0x5488de[_0x33f136['body'][_0x9a3b('0x37')]]=_0x33f136[_0x9a3b('0x28')]['from'];return db[_0x9a3b('0x2c')][_0x9a3b('0x4a')](_0x5488de);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x5ea313){_0x38b040['contact']=_0x5ea313;if(_0x5ea313){if(!_0x33f136['body']['message'][_0x9a3b('0x4b')]){_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['messageId']=rs[_0x9a3b('0x4c')]()+'\x20'+_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x32')];}var _0x3a1082={'ContactId':_0x5ea313['id'],'MailAccountId':_0x33f136[_0x9a3b('0x39')]['id'],'inReplyTo':_0x33f136['body']['message'][_0x9a3b('0x4b')],'to':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x32')],'cc':_0x33f136['body']['message']['cc'],'subject':_0x33f136[_0x9a3b('0x28')]['message'][_0x9a3b('0x4d')],'attach':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x4e')],'lastMsgAt':moment()[_0x9a3b('0x4f')](_0x9a3b('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')]};return db[_0x9a3b('0x51')][_0x9a3b('0x52')]({'where':{'closed':![],'MailAccountId':_0x33f136[_0x9a3b('0x39')]['id']},'include':[{'model':db['MailMessage'],'as':_0x9a3b('0x53'),'attributes':['messageId'],'where':{'messageId':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x54')]}}]})[_0x9a3b('0x11')](function(_0x41411d){if(_0x41411d){return[_0x41411d,![]];}return db[_0x9a3b('0x51')]['create'](_0x3a1082)[_0x9a3b('0x11')](function(_0x1ba863){return[_0x1ba863,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2a0e88,_0x5e56ae){if(_0x2a0e88){_0x1caec6=_0x5e56ae;if(!_0x5e56ae){return _0x2a0e88[_0x9a3b('0x55')]({'inReplyTo':_0x33f136[_0x9a3b('0x28')]['message'][_0x9a3b('0x4b')],'to':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['from'],'cc':_0x33f136[_0x9a3b('0x28')]['message']['cc'],'subject':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['subject'],'attach':_0x2a0e88['attach']?_0x2a0e88[_0x9a3b('0x4e')]:_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['attach'],'substatus':null,'substatusAt':moment()[_0x9a3b('0x4f')](_0x9a3b('0x50')),'lastMsgAt':moment()['format'](_0x9a3b('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')]});}else{return _0x2a0e88;}}})['then'](function(_0x52d5c4){_0x38b040['interaction']=_0x52d5c4['get']({'plain':!![]});_0x38b040[_0x9a3b('0x56')][_0x9a3b('0x57')]=_0x1caec6;return db[_0x9a3b('0x58')][_0x9a3b('0x4a')]({'body':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x28')],'MailAccountId':_0x33f136[_0x9a3b('0x39')]['id'],'MailInteractionId':_0x52d5c4['id'],'direction':'in','ContactId':_0x38b040[_0x9a3b('0x59')]['id'],'messageId':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x4b')],'from':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x32')],'to':_0x33f136['body'][_0x9a3b('0x16')]['to'],'cc':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')]['cc'],'subject':_0x33f136['body']['message']['subject'],'attach':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x4e')],'Attachments':_0x33f136[_0x9a3b('0x28')]['message'][_0x9a3b('0x5a')],'originTo':_0x33f136['body'][_0x9a3b('0x16')][_0x9a3b('0x5b')],'originCc':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x5c')],'bcc':_0x33f136[_0x9a3b('0x28')][_0x9a3b('0x16')][_0x9a3b('0x5d')]},{'include':[{'model':db['Attachment'],'as':_0x9a3b('0x5e')}]});})[_0x9a3b('0x11')](function(_0x5ad314){_0x38b040[_0x9a3b('0x16')]=_0x5ad314;if(_0x38b040[_0x9a3b('0x56')][_0x9a3b('0x5f')]){return db[_0x9a3b('0x60')][_0x9a3b('0x52')]({'attributes':['id','name'],'where':{'id':_0x38b040['interaction'][_0x9a3b('0x5f')]}})[_0x9a3b('0x11')](function(_0x24781b){if(_0x24781b){_0x38b040['applications'][_0x9a3b('0x61')]({'id':0x0,'priority':0x0,'app':_0x9a3b('0x62'),'appdata':_0x24781b['name']+','+(_0x38b040['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9a3b('0x63'),_0x9a3b('0x64'),_0x38b040);});}return respondWithRpcPromise('Start','startRouting',_0x38b040);})[_0x9a3b('0x11')](function(_0x54c675){_0x493632(_0x54c675);})['catch'](function(_0x574b82){_0x341e7e(_0x3ba059[_0x9a3b('0x14')](0x1f4,_0x574b82[_0x9a3b('0x16')]));});});}; \ No newline at end of file +var _0xb332=['List\x20not\x20found','contact','generate','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','update','format','interaction','created','MailMessage','originCc','bcc','Attachment','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount','find','ShowMailAccount','catch','NotifyMailAccount','body','difference','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','Smtp','get','omit','Applications','list','applications','orderBy','asc','push','close','length','create'];(function(_0x13aee0,_0x45ab29){var _0xa7e086=function(_0x3ad36a){while(--_0x3ad36a){_0x13aee0['push'](_0x13aee0['shift']());}};_0xa7e086(++_0x45ab29);}(_0xb332,0xd9));var _0x2b33=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0xb332[_0x35b7d4];return _0x4e8cee;};'use strict';var _=require(_0x2b33('0x0'));var util=require('util');var moment=require(_0x2b33('0x1'));var BPromise=require(_0x2b33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b33('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b33('0x4'));var logger=require('../../config/logger')(_0x2b33('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b33('0x6'));var client=jayson[_0x2b33('0x7')][_0x2b33('0x8')]({'port':0x232c});config[_0x2b33('0x9')]=_['defaults'](config['redis'],{'host':_0x2b33('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b33('0x9')]));require(_0x2b33('0xb'))[_0x2b33('0xc')](socket);function respondWithRpcPromise(_0x14b4d1,_0x5834bb,_0x16f18){return new BPromise(function(_0x1cefb1,_0x1be19d){return client[_0x2b33('0xd')](_0x14b4d1,_0x16f18)[_0x2b33('0xe')](function(_0xf1e5e5){logger[_0x2b33('0xf')](_0x2b33('0x10'),_0x5834bb,_0x2b33('0x11'));logger[_0x2b33('0x12')](_0x2b33('0x13'),_0x5834bb,'request\x20sent',JSON[_0x2b33('0x14')](_0xf1e5e5));if(_0xf1e5e5[_0x2b33('0x15')]){if(_0xf1e5e5[_0x2b33('0x15')]['code']===0x1f4){logger[_0x2b33('0x15')]('MailAccount,\x20%s,\x20%s',_0x5834bb,_0xf1e5e5[_0x2b33('0x15')][_0x2b33('0x16')]);return _0x1be19d(_0xf1e5e5[_0x2b33('0x15')]['message']);}logger['error'](_0x2b33('0x10'),_0x5834bb,_0xf1e5e5[_0x2b33('0x15')][_0x2b33('0x16')]);return _0x1cefb1(_0xf1e5e5[_0x2b33('0x15')][_0x2b33('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x5834bb,'request\x20sent');_0x1cefb1(_0xf1e5e5[_0x2b33('0x17')]['message']);}})['catch'](function(_0x42cfd7){logger[_0x2b33('0x15')](_0x2b33('0x10'),_0x5834bb,_0x42cfd7);_0x1be19d(_0x42cfd7);});});}exports['GetMailAccount']=function(_0x42461e){var _0x5e1795=this;return new Promise(function(_0x8079c0,_0x2565be){return db[_0x2b33('0x18')][_0x2b33('0x19')]({'raw':_0x42461e[_0x2b33('0x1a')]?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1b')]===undefined?!![]:![]:!![],'where':_0x42461e['options']?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1c')]||null:null,'attributes':_0x42461e[_0x2b33('0x1a')]?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1d')]||null:null,'limit':_0x42461e[_0x2b33('0x1a')]?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1e')]||null:null,'include':_0x42461e['options']?_0x42461e[_0x2b33('0x1a')][_0x2b33('0x1f')]?_[_0x2b33('0x20')](_0x42461e[_0x2b33('0x1a')]['include'],function(_0x2ec9db){return{'model':db[_0x2ec9db['model']],'as':_0x2ec9db['as'],'attributes':_0x2ec9db[_0x2b33('0x1d')],'include':_0x2ec9db['include']?_[_0x2b33('0x20')](_0x2ec9db[_0x2b33('0x1f')],function(_0x5d8d05){return{'model':db[_0x5d8d05[_0x2b33('0x21')]],'as':_0x5d8d05['as'],'attributes':_0x5d8d05['attributes'],'include':_0x5d8d05[_0x2b33('0x1f')]?_['map'](_0x5d8d05[_0x2b33('0x1f')],function(_0xa109f4){return{'model':db[_0xa109f4[_0x2b33('0x21')]],'as':_0xa109f4['as'],'attributes':_0xa109f4[_0x2b33('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b33('0xe')](function(_0x312d4d){logger[_0x2b33('0xf')](_0x2b33('0x22'),_0x42461e);logger[_0x2b33('0x12')](_0x2b33('0x22'),_0x42461e,JSON['stringify'](_0x312d4d));_0x8079c0(_0x312d4d);})['catch'](function(_0x106ea0){logger[_0x2b33('0x15')](_0x2b33('0x22'),_0x106ea0[_0x2b33('0x16')],_0x42461e);_0x2565be(_0x5e1795[_0x2b33('0x15')](0x1f4,_0x106ea0['message']));});});};exports['ShowMailAccount']=function(_0x311ddd){var _0x3d2aaa=this;return new Promise(function(_0x476965,_0x1d2168){return db[_0x2b33('0x18')][_0x2b33('0x23')]({'raw':_0x311ddd['options']?_0x311ddd[_0x2b33('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x311ddd[_0x2b33('0x1a')]?_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1c')]||null:null,'attributes':_0x311ddd[_0x2b33('0x1a')]?_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1d')]||null:null,'include':_0x311ddd[_0x2b33('0x1a')]?_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1f')]?_[_0x2b33('0x20')](_0x311ddd[_0x2b33('0x1a')][_0x2b33('0x1f')],function(_0xe415f4){return{'model':db[_0xe415f4[_0x2b33('0x21')]],'as':_0xe415f4['as'],'attributes':_0xe415f4[_0x2b33('0x1d')],'include':_0xe415f4[_0x2b33('0x1f')]?_['map'](_0xe415f4['include'],function(_0x5da10e){return{'model':db[_0x5da10e[_0x2b33('0x21')]],'as':_0x5da10e['as'],'attributes':_0x5da10e[_0x2b33('0x1d')],'include':_0x5da10e[_0x2b33('0x1f')]?_[_0x2b33('0x20')](_0x5da10e[_0x2b33('0x1f')],function(_0x51a5d3){return{'model':db[_0x51a5d3['model']],'as':_0x51a5d3['as'],'attributes':_0x51a5d3[_0x2b33('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44aea1){logger[_0x2b33('0xf')](_0x2b33('0x24'),_0x311ddd);logger[_0x2b33('0x12')](_0x2b33('0x24'),_0x311ddd,JSON[_0x2b33('0x14')](_0x44aea1));_0x476965(_0x44aea1);})[_0x2b33('0x25')](function(_0x2594fd){logger[_0x2b33('0x15')](_0x2b33('0x24'),_0x2594fd['message'],_0x311ddd);_0x1d2168(_0x3d2aaa[_0x2b33('0x15')](0x1f4,_0x2594fd[_0x2b33('0x16')]));});});};exports[_0x2b33('0x26')]=function(_0x5b7c32){var _0x5e0aba=this;return new Promise(function(_0x3afaa5,_0x4e4d54){var _0x108182={'body':_0x5b7c32[_0x2b33('0x27')],'channel':'mail'};var _0x10147a=_[_0x2b33('0x28')](_['keys'](db[_0x2b33('0x29')][_0x2b33('0x2a')]),['createdAt',_0x2b33('0x2b'),_0x2b33('0x2c'),_0x2b33('0x2d')]);var _0x49348c=![];if(_0x5b7c32[_0x2b33('0x27')]['id']){delete _0x5b7c32[_0x2b33('0x27')]['id'];}if(_[_0x2b33('0x2e')](_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x2f')])){return _0x4e4d54(_0x5e0aba['error'](0x1f4,_0x2b33('0x30')));}if(_[_0x2b33('0x2e')](_0x5b7c32[_0x2b33('0x27')]['body'])||_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x27')]===''){return _0x4e4d54(_0x5e0aba[_0x2b33('0x15')](0x1f4,_0x2b33('0x31')));}if(_['isNil'](_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x32')])){return _0x4e4d54(_0x5e0aba['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x10147a));}if(!_['includes'](_0x10147a,_0x5b7c32[_0x2b33('0x27')]['mapKey'])){return _0x4e4d54(_0x5e0aba[_0x2b33('0x15')](0x1f4,_0x2b33('0x33')+_0x10147a));}var _0x4ac79b={};_0x4ac79b[_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x32')]]=_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x2f')];return db[_0x2b33('0x18')]['find']({'where':{'id':_0x5b7c32[_0x2b33('0x34')]['id']},'include':[{'model':db[_0x2b33('0x35')],'as':_0x2b33('0x36'),'include':[{'model':db[_0x2b33('0x29')],'as':_0x2b33('0x37'),'where':_0x4ac79b,'limit':0x1,'order':[[_0x2b33('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x2b33('0x38')}]})['then'](function(_0x1c5019){if(_0x1c5019&&_0x1c5019['List']){var _0x5071ab=_0x1c5019[_0x2b33('0x39')]({'plain':!![]});_0x108182[_0x2b33('0x34')]=_[_0x2b33('0x3a')](_0x5071ab,['Applications',_0x2b33('0x36')]);_0x108182['applications']=_0x5071ab[_0x2b33('0x3b')];_0x108182[_0x2b33('0x3c')]=_0x5071ab[_0x2b33('0x36')];_0x108182[_0x2b33('0x3d')]=_[_0x2b33('0x3e')](_0x108182[_0x2b33('0x3d')],['priority'],[_0x2b33('0x3f')]);if(_0x108182[_0x2b33('0x34')]&&_0x108182[_0x2b33('0x34')]['autoclose']){_0x108182[_0x2b33('0x3d')][_0x2b33('0x40')]({'id':0x0,'priority':_0x108182[_0x2b33('0x3d')]['length']+0x1,'app':_0x2b33('0x41'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x108182[_0x2b33('0x34')][_0x2b33('0x3b')]){delete _0x108182[_0x2b33('0x34')][_0x2b33('0x3b')];}if(_0x108182[_0x2b33('0x34')][_0x2b33('0x36')]){delete _0x108182[_0x2b33('0x34')][_0x2b33('0x36')];}if(_0x5071ab['List'][_0x2b33('0x37')][_0x2b33('0x42')]){return _0x5071ab['List'][_0x2b33('0x37')][0x0];}var _0x45a939=_['defaults'](_0x5b7c32[_0x2b33('0x27')],{'firstName':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x2f')],'ListId':_0x5071ab[_0x2b33('0x2d')]});_0x45a939[_0x5b7c32['body'][_0x2b33('0x32')]]=_0x5b7c32[_0x2b33('0x27')]['from'];return db[_0x2b33('0x29')][_0x2b33('0x43')](_0x45a939);}else{throw new Error(_0x2b33('0x44'));}})[_0x2b33('0xe')](function(_0x3a9bbf){_0x108182[_0x2b33('0x45')]=_0x3a9bbf;if(_0x3a9bbf){if(!_0x5b7c32[_0x2b33('0x27')]['message']['messageId']){_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['messageId']=rs[_0x2b33('0x46')]()+'\x20'+_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['from'];}var _0x185c3e={'ContactId':_0x3a9bbf['id'],'MailAccountId':_0x5b7c32[_0x2b33('0x34')]['id'],'inReplyTo':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x47')],'to':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x2f')],'cc':_0x5b7c32['body']['message']['cc'],'subject':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x48')],'attach':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x49')],'lastMsgAt':moment()['format'](_0x2b33('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x27')]};return db[_0x2b33('0x4b')][_0x2b33('0x23')]({'where':{'closed':![],'MailAccountId':_0x5b7c32[_0x2b33('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0x2b33('0x4c'),'attributes':[_0x2b33('0x47')],'where':{'messageId':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x4d')]}}]})['then'](function(_0xd3dc0d){if(_0xd3dc0d){return[_0xd3dc0d,![]];}return db[_0x2b33('0x4b')][_0x2b33('0x43')](_0x185c3e)[_0x2b33('0xe')](function(_0x49745e){return[_0x49745e,!![]];});});}else{throw new Error(_0x2b33('0x4e'));}})['spread'](function(_0x1388ed,_0x23cb0b){if(_0x1388ed){_0x49348c=_0x23cb0b;if(!_0x23cb0b){return _0x1388ed[_0x2b33('0x4f')]({'inReplyTo':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x47')],'to':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['from'],'cc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['cc'],'subject':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x48')],'attach':_0x1388ed[_0x2b33('0x49')]?_0x1388ed[_0x2b33('0x49')]:_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x49')],'substatus':null,'substatusAt':moment()[_0x2b33('0x50')](_0x2b33('0x4a')),'lastMsgAt':moment()['format'](_0x2b33('0x4a')),'lastMsgDirection':'in','lastMsgBody':_0x5b7c32['body']['body']});}else{return _0x1388ed;}}})[_0x2b33('0xe')](function(_0x5404f8){_0x108182[_0x2b33('0x51')]=_0x5404f8['get']({'plain':!![]});_0x108182[_0x2b33('0x51')][_0x2b33('0x52')]=_0x49348c;return db[_0x2b33('0x53')][_0x2b33('0x43')]({'body':_0x5b7c32['body']['body'],'MailAccountId':_0x5b7c32['account']['id'],'MailInteractionId':_0x5404f8['id'],'direction':'in','ContactId':_0x108182['contact']['id'],'messageId':_0x5b7c32['body']['message']['messageId'],'from':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x2f')],'to':_0x5b7c32['body'][_0x2b33('0x16')]['to'],'cc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['cc'],'subject':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x48')],'attach':_0x5b7c32['body']['message']['attach'],'Attachments':_0x5b7c32['body']['message']['attachments'],'originTo':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')]['originTo'],'originCc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x54')],'bcc':_0x5b7c32[_0x2b33('0x27')][_0x2b33('0x16')][_0x2b33('0x55')]},{'include':[{'model':db[_0x2b33('0x56')],'as':'Attachments'}]});})['then'](function(_0x22b354){_0x108182[_0x2b33('0x16')]=_0x22b354;if(_0x108182[_0x2b33('0x51')][_0x2b33('0x57')]){return db[_0x2b33('0x58')]['find']({'attributes':['id','name'],'where':{'id':_0x108182['interaction'][_0x2b33('0x57')]}})[_0x2b33('0xe')](function(_0x2452e4){if(_0x2452e4){_0x108182['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2b33('0x59'),'appdata':_0x2452e4[_0x2b33('0x5a')]+','+(_0x108182['account'][_0x2b33('0x5b')]||0xa),'interval':_0x2b33('0x5c')});}return respondWithRpcPromise(_0x2b33('0x5d'),'startRouting',_0x108182);});}return respondWithRpcPromise(_0x2b33('0x5d'),_0x2b33('0x5e'),_0x108182);})[_0x2b33('0xe')](function(_0x44cec5){_0x3afaa5(_0x44cec5);})['catch'](function(_0x3e0900){_0x4e4d54(_0x5e0aba['error'](0x1f4,_0x3e0900[_0x2b33('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0155b19..2cb2982 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 _0x85d0=['emit','register','length','mailAccount:'];(function(_0x33faa3,_0x3b6e21){var _0x4abf73=function(_0x4bbc5f){while(--_0x4bbc5f){_0x33faa3['push'](_0x33faa3['shift']());}};_0x4abf73(++_0x3b6e21);}(_0x85d0,0x164));var _0x085d=function(_0x37e3f1,_0xee95c6){_0x37e3f1=_0x37e3f1-0x0;var _0x42c77b=_0x85d0[_0x37e3f1];return _0x42c77b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove','update'];function createListener(_0x297001,_0x1716e5){return function(_0xfd8773){_0x1716e5[_0x085d('0x0')](_0x297001,_0xfd8773);};}function removeListener(_0x231765,_0x19ae4c){return function(){MailAccountEvents['removeListener'](_0x231765,_0x19ae4c);};}exports[_0x085d('0x1')]=function(_0x5c917f){for(var _0x364f09=0x0,_0x9acc97=events[_0x085d('0x2')];_0x364f09<_0x9acc97;_0x364f09++){var _0x4a12b7=events[_0x364f09];var _0xf65d01=createListener(_0x085d('0x3')+_0x4a12b7,_0x5c917f);MailAccountEvents['on'](_0x4a12b7,_0xf65d01);}}; \ No newline at end of file +var _0x9829=['remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0x9829,0xc4));var _0x9982=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x9829[_0x2f5a22];return _0x326b70;};'use strict';var MailAccountEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){MailAccountEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);MailAccountEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index dececb4..cf54508 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 _0x4483=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put'];(function(_0x1a08cf,_0x186382){var _0x4174b7=function(_0x263861){while(--_0x263861){_0x1a08cf['push'](_0x1a08cf['shift']());}};_0x4174b7(++_0x186382);}(_0x4483,0x1a3));var _0x3448=function(_0x3577ea,_0x64b30e){_0x3577ea=_0x3577ea-0x0;var _0x5f4cd9=_0x4483[_0x3577ea];return _0x5f4cd9;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var auth=require(_0x3448('0x5'));var interaction=require(_0x3448('0x6'));var config=require(_0x3448('0x7'));var controller=require('./mailApplication.controller');router[_0x3448('0x8')](_0x3448('0x9'),auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0xc')](_0x3448('0x9'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['delete']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);module[_0x3448('0xf')]=router; \ No newline at end of file +var _0xd4f4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x30acb9,_0x36cb4f){var _0x3b4db1=function(_0x5ede5a){while(--_0x5ede5a){_0x30acb9['push'](_0x30acb9['shift']());}};_0x3b4db1(++_0x36cb4f);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x5eb1d1,_0x79656a){_0x5eb1d1=_0x5eb1d1-0x0;var _0xc05d00=_0xd4f4[_0x5eb1d1];return _0xc05d00;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require(_0x4d4f('0x9'));router[_0x4d4f('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4d4f('0xb')](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0xe')]);router[_0x4d4f('0xf')](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x10')]);module[_0x4d4f('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a7657fd..b9e10c7 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 _0xd232=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xd232,0x183));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2d23('0x0'));module[_0x2d23('0x1')]={'priority':{'type':Sequelize[_0x2d23('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2d23('0x3')],'allowNull':![],'defaultValue':_0x2d23('0x4')},'appdata':{'type':Sequelize[_0x2d23('0x5')]()},'description':{'type':Sequelize[_0x2d23('0x3')]},'interval':{'type':Sequelize[_0x2d23('0x3')],'defaultValue':_0x2d23('0x6')}}; \ No newline at end of file +var _0x4861=['sequelize','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4861,0x1e0));var _0x1486=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4861[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x1486('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1486('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1486('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1486('0x3')]()},'description':{'type':Sequelize[_0x1486('0x2')]},'interval':{'type':Sequelize[_0x1486('0x2')],'defaultValue':_0x1486('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index beda334..264c987 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 _0xc777=['save','then','end','error','stack','name','show','params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','MailApplication','find','catch','update','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x2f60e5,_0x55394e){var _0x42ad55=function(_0x3bbb09){while(--_0x3bbb09){_0x2f60e5['push'](_0x2f60e5['shift']());}};_0x42ad55(++_0x55394e);}(_0xc777,0x1b7));var _0x7c77=function(_0x434152,_0x3c7399){_0x434152=_0x434152-0x0;var _0xa6ee48=_0xc777[_0x434152];return _0xa6ee48;};'use strict';var pdf=require(_0x7c77('0x0'));var emlformat=require(_0x7c77('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7c77('0x2'));var jsonpatch=require(_0x7c77('0x3'));var rp=require(_0x7c77('0x4'));var moment=require(_0x7c77('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c77('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7c77('0x7'));var csv=require(_0x7c77('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c77('0x9'));var squel=require(_0x7c77('0xa'));var crypto=require(_0x7c77('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c77('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c77('0xd'));var Papa=require(_0x7c77('0xe'));var Redis=require(_0x7c77('0xf'));var authService=require(_0x7c77('0x10'));var qs=require(_0x7c77('0x11'));var as=require(_0x7c77('0x12'));var hardwareService=require(_0x7c77('0x13'));var logger=require(_0x7c77('0x14'))('api');var utils=require(_0x7c77('0x15'));var config=require('../../config/environment');var db=require(_0x7c77('0x16'))['db'];function respondWithStatusCode(_0x31c18b,_0x58bdac){_0x58bdac=_0x58bdac||0xcc;return function(_0x65ef3f){if(_0x65ef3f){return _0x31c18b[_0x7c77('0x17')](_0x58bdac);}return _0x31c18b[_0x7c77('0x18')](_0x58bdac)['end']();};}function respondWithResult(_0xb0997b,_0x5f3e20){_0x5f3e20=_0x5f3e20||0xc8;return function(_0x5ce14e){if(_0x5ce14e){return _0xb0997b['status'](_0x5f3e20)[_0x7c77('0x19')](_0x5ce14e);}};}function respondWithFilteredResult(_0x26e781,_0x5d9836){return function(_0x200ab7){if(_0x200ab7){var _0x31fe7a=_0x200ab7[_0x7c77('0x1a')],_0x109946=_0x5d9836[_0x7c77('0x1b')],_0x909bb8=_0x5d9836[_0x7c77('0x1b')]+_0x5d9836[_0x7c77('0x1c')],_0x74612b;if(_0x909bb8>=_0x31fe7a){_0x909bb8=_0x31fe7a;_0x74612b=0xc8;}else{_0x74612b=0xce;}_0x26e781[_0x7c77('0x18')](_0x74612b);return _0x26e781[_0x7c77('0x1d')](_0x7c77('0x1e'),_0x109946+'-'+_0x909bb8+'/'+_0x31fe7a)[_0x7c77('0x19')](_0x200ab7);}return null;};}function patchUpdates(_0x23ee8a){return function(_0x140c1b){try{jsonpatch[_0x7c77('0x1f')](_0x140c1b,_0x23ee8a,!![]);}catch(_0x573803){return BPromise[_0x7c77('0x20')](_0x573803);}return _0x140c1b[_0x7c77('0x21')]();};}function saveUpdates(_0xb5b2fa,_0xa8b179){return function(_0x41363c){if(_0x41363c){return _0x41363c['update'](_0xb5b2fa)['then'](function(_0x4640ad){return _0x4640ad;});}return null;};}function removeEntity(_0x5f03bc,_0x2a610d){return function(_0x4c43b2){if(_0x4c43b2){return _0x4c43b2['destroy']()[_0x7c77('0x22')](function(){_0x5f03bc[_0x7c77('0x18')](0xcc)[_0x7c77('0x23')]();});}};}function handleEntityNotFound(_0x3a8c5a,_0xa88589){return function(_0x99a617){if(!_0x99a617){_0x3a8c5a[_0x7c77('0x17')](0x194);}return _0x99a617;};}function handleError(_0x56ca14,_0x5494b1){_0x5494b1=_0x5494b1||0x1f4;return function(_0x3b848c){logger[_0x7c77('0x24')](_0x3b848c[_0x7c77('0x25')]);if(_0x3b848c[_0x7c77('0x26')]){delete _0x3b848c[_0x7c77('0x26')];}_0x56ca14[_0x7c77('0x18')](_0x5494b1)['send'](_0x3b848c);};}exports[_0x7c77('0x27')]=function(_0x3df5de,_0xa7293b){var _0x19f1ac={'raw':!![],'where':{'id':_0x3df5de[_0x7c77('0x28')]['id']}},_0x1370a9={};_0x1370a9[_0x7c77('0x29')]=_[_0x7c77('0x2a')](db['MailApplication'][_0x7c77('0x2b')]);_0x1370a9[_0x7c77('0x2c')]=_[_0x7c77('0x2a')](_0x3df5de['query']);_0x1370a9['filters']=_[_0x7c77('0x2d')](_0x1370a9['model'],_0x1370a9[_0x7c77('0x2c')]);_0x19f1ac['attributes']=_[_0x7c77('0x2d')](_0x1370a9[_0x7c77('0x29')],qs['fields'](_0x3df5de[_0x7c77('0x2c')][_0x7c77('0x2e')]));_0x19f1ac[_0x7c77('0x2f')]=_0x19f1ac[_0x7c77('0x2f')][_0x7c77('0x30')]?_0x19f1ac[_0x7c77('0x2f')]:_0x1370a9['model'];if(_0x3df5de[_0x7c77('0x2c')][_0x7c77('0x31')]){_0x19f1ac[_0x7c77('0x32')]=[{'all':!![]}];}_0x19f1ac=_[_0x7c77('0x33')]({},_0x19f1ac,_0x3df5de[_0x7c77('0x34')]);return db[_0x7c77('0x35')][_0x7c77('0x36')](_0x19f1ac)[_0x7c77('0x22')](handleEntityNotFound(_0xa7293b,null))[_0x7c77('0x22')](respondWithResult(_0xa7293b,null))[_0x7c77('0x37')](handleError(_0xa7293b,null));};exports[_0x7c77('0x38')]=function(_0x33f07e,_0xa979cf){if(_0x33f07e[_0x7c77('0x39')]['id']){delete _0x33f07e[_0x7c77('0x39')]['id'];}return db[_0x7c77('0x35')][_0x7c77('0x36')]({'where':{'id':_0x33f07e[_0x7c77('0x28')]['id']}})['then'](handleEntityNotFound(_0xa979cf,null))['then'](saveUpdates(_0x33f07e[_0x7c77('0x39')],null))[_0x7c77('0x22')](respondWithResult(_0xa979cf,null))[_0x7c77('0x37')](handleError(_0xa979cf,null));};exports[_0x7c77('0x3a')]=function(_0x4b580d,_0x46eab1){return db[_0x7c77('0x35')][_0x7c77('0x36')]({'where':{'id':_0x4b580d['params']['id']}})[_0x7c77('0x22')](handleEntityNotFound(_0x46eab1,null))[_0x7c77('0x22')](removeEntity(_0x46eab1,null))['catch'](handleError(_0x46eab1,null));}; \ No newline at end of file +var _0x49be=['count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','find','catch','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x1c1a4a,_0x2ece0c){var _0x1ba657=function(_0x5204bd){while(--_0x5204bd){_0x1c1a4a['push'](_0x1c1a4a['shift']());}};_0x1ba657(++_0x2ece0c);}(_0x49be,0x12b));var _0xe49b=function(_0x2bb9b3,_0x1d2c25){_0x2bb9b3=_0x2bb9b3-0x0;var _0x601b6=_0x49be[_0x2bb9b3];return _0x601b6;};'use strict';var pdf=require(_0xe49b('0x0'));var emlformat=require(_0xe49b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe49b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe49b('0x3'));var moment=require('moment');var BPromise=require(_0xe49b('0x4'));var Mustache=require('mustache');var util=require(_0xe49b('0x5'));var path=require(_0xe49b('0x6'));var sox=require(_0xe49b('0x7'));var csv=require(_0xe49b('0x8'));var ejs=require(_0xe49b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe49b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe49b('0xb'));var toCsv=require(_0xe49b('0x8'));var querystring=require(_0xe49b('0xc'));var Papa=require('papaparse');var Redis=require(_0xe49b('0xd'));var authService=require(_0xe49b('0xe'));var qs=require(_0xe49b('0xf'));var as=require(_0xe49b('0x10'));var hardwareService=require(_0xe49b('0x11'));var logger=require('../../config/logger')(_0xe49b('0x12'));var utils=require(_0xe49b('0x13'));var config=require(_0xe49b('0x14'));var db=require(_0xe49b('0x15'))['db'];function respondWithStatusCode(_0x4470bf,_0xf2f291){_0xf2f291=_0xf2f291||0xcc;return function(_0x2ac8c9){if(_0x2ac8c9){return _0x4470bf[_0xe49b('0x16')](_0xf2f291);}return _0x4470bf[_0xe49b('0x17')](_0xf2f291)['end']();};}function respondWithResult(_0x460c04,_0x2afc0f){_0x2afc0f=_0x2afc0f||0xc8;return function(_0x1f812d){if(_0x1f812d){return _0x460c04[_0xe49b('0x17')](_0x2afc0f)[_0xe49b('0x18')](_0x1f812d);}};}function respondWithFilteredResult(_0x1d74af,_0x59bd18){return function(_0x5a9b31){if(_0x5a9b31){var _0x483f8c=_0x5a9b31[_0xe49b('0x19')],_0x2aeff1=_0x59bd18[_0xe49b('0x1a')],_0x5031fe=_0x59bd18[_0xe49b('0x1a')]+_0x59bd18[_0xe49b('0x1b')],_0x3f5b89;if(_0x5031fe>=_0x483f8c){_0x5031fe=_0x483f8c;_0x3f5b89=0xc8;}else{_0x3f5b89=0xce;}_0x1d74af[_0xe49b('0x17')](_0x3f5b89);return _0x1d74af['set'](_0xe49b('0x1c'),_0x2aeff1+'-'+_0x5031fe+'/'+_0x483f8c)[_0xe49b('0x18')](_0x5a9b31);}return null;};}function patchUpdates(_0x50a62a){return function(_0x1f6cd9){try{jsonpatch[_0xe49b('0x1d')](_0x1f6cd9,_0x50a62a,!![]);}catch(_0x3c711c){return BPromise[_0xe49b('0x1e')](_0x3c711c);}return _0x1f6cd9[_0xe49b('0x1f')]();};}function saveUpdates(_0x4b665e,_0x2003c8){return function(_0x4cbfb8){if(_0x4cbfb8){return _0x4cbfb8[_0xe49b('0x20')](_0x4b665e)[_0xe49b('0x21')](function(_0x10d5cf){return _0x10d5cf;});}return null;};}function removeEntity(_0x378ae4,_0x2dd3b7){return function(_0x2632c9){if(_0x2632c9){return _0x2632c9[_0xe49b('0x22')]()[_0xe49b('0x21')](function(){_0x378ae4[_0xe49b('0x17')](0xcc)[_0xe49b('0x23')]();});}};}function handleEntityNotFound(_0x9828a8,_0x39c933){return function(_0x4058fc){if(!_0x4058fc){_0x9828a8[_0xe49b('0x16')](0x194);}return _0x4058fc;};}function handleError(_0x34a6c0,_0x59d1b6){_0x59d1b6=_0x59d1b6||0x1f4;return function(_0x5f7fa3){logger[_0xe49b('0x24')](_0x5f7fa3[_0xe49b('0x25')]);if(_0x5f7fa3['name']){delete _0x5f7fa3['name'];}_0x34a6c0[_0xe49b('0x17')](_0x59d1b6)['send'](_0x5f7fa3);};}exports[_0xe49b('0x26')]=function(_0x2519d3,_0x424b99){var _0x30c9f4={'raw':!![],'where':{'id':_0x2519d3[_0xe49b('0x27')]['id']}},_0x303462={};_0x303462[_0xe49b('0x28')]=_[_0xe49b('0x29')](db[_0xe49b('0x2a')][_0xe49b('0x2b')]);_0x303462[_0xe49b('0x2c')]=_[_0xe49b('0x29')](_0x2519d3[_0xe49b('0x2c')]);_0x303462[_0xe49b('0x2d')]=_[_0xe49b('0x2e')](_0x303462['model'],_0x303462[_0xe49b('0x2c')]);_0x30c9f4['attributes']=_[_0xe49b('0x2e')](_0x303462[_0xe49b('0x28')],qs[_0xe49b('0x2f')](_0x2519d3[_0xe49b('0x2c')][_0xe49b('0x2f')]));_0x30c9f4['attributes']=_0x30c9f4[_0xe49b('0x30')]['length']?_0x30c9f4['attributes']:_0x303462[_0xe49b('0x28')];if(_0x2519d3[_0xe49b('0x2c')][_0xe49b('0x31')]){_0x30c9f4[_0xe49b('0x32')]=[{'all':!![]}];}_0x30c9f4=_['merge']({},_0x30c9f4,_0x2519d3['options']);return db[_0xe49b('0x2a')][_0xe49b('0x33')](_0x30c9f4)[_0xe49b('0x21')](handleEntityNotFound(_0x424b99,null))['then'](respondWithResult(_0x424b99,null))[_0xe49b('0x34')](handleError(_0x424b99,null));};exports['update']=function(_0x13003f,_0x5ace73){if(_0x13003f[_0xe49b('0x35')]['id']){delete _0x13003f[_0xe49b('0x35')]['id'];}return db['MailApplication']['find']({'where':{'id':_0x13003f[_0xe49b('0x27')]['id']}})[_0xe49b('0x21')](handleEntityNotFound(_0x5ace73,null))[_0xe49b('0x21')](saveUpdates(_0x13003f['body'],null))['then'](respondWithResult(_0x5ace73,null))[_0xe49b('0x34')](handleError(_0x5ace73,null));};exports[_0xe49b('0x22')]=function(_0x497d64,_0x558a47){return db['MailApplication'][_0xe49b('0x33')]({'where':{'id':_0x497d64[_0xe49b('0x27')]['id']}})[_0xe49b('0x21')](handleEntityNotFound(_0x558a47,null))[_0xe49b('0x21')](removeEntity(_0x558a47,null))[_0xe49b('0x34')](handleError(_0x558a47,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 12f57cc..94e7080 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 _0x25ec=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications'];(function(_0x547da9,_0x452b5b){var _0x56b3a7=function(_0x5d1924){while(--_0x5d1924){_0x547da9['push'](_0x547da9['shift']());}};_0x56b3a7(++_0x452b5b);}(_0x25ec,0xb8));var _0xc25e=function(_0x525da2,_0xc20be5){_0x525da2=_0x525da2-0x0;var _0x12562f=_0x25ec[_0x525da2];return _0x12562f;};'use strict';var _=require(_0xc25e('0x0'));var util=require(_0xc25e('0x1'));var logger=require(_0xc25e('0x2'))(_0xc25e('0x3'));var moment=require('moment');var BPromise=require(_0xc25e('0x4'));var rp=require(_0xc25e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc25e('0x6'));var config=require(_0xc25e('0x7'));var attributes=require(_0xc25e('0x8'));module['exports']=function(_0x1c7dca,_0x379d12){return _0x1c7dca[_0xc25e('0x9')]('MailApplication',attributes,{'tableName':_0xc25e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc25e('0xb'),'collate':_0xc25e('0xc')});}; \ No newline at end of file +var _0x9bc1=['rimraf','../../config/environment','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0xad7433,_0x328655){var _0x113410=function(_0x2ee73d){while(--_0x2ee73d){_0xad7433['push'](_0xad7433['shift']());}};_0x113410(++_0x328655);}(_0x9bc1,0x74));var _0x19bc=function(_0x2b2e44,_0x36b38a){_0x2b2e44=_0x2b2e44-0x0;var _0x2d0b45=_0x9bc1[_0x2b2e44];return _0x2d0b45;};'use strict';var _=require('lodash');var util=require(_0x19bc('0x0'));var logger=require(_0x19bc('0x1'))(_0x19bc('0x2'));var moment=require(_0x19bc('0x3'));var BPromise=require(_0x19bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x19bc('0x5'));var config=require(_0x19bc('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x2c4785,_0x1669c9){return _0x2c4785[_0x19bc('0x7')](_0x19bc('0x8'),attributes,{'tableName':_0x19bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x19bc('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index cfc157a..07655a3 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 _0x54ae=['info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54ae,0x18b));var _0xe54a=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x54ae[_0x466bc5];return _0x138952;};'use strict';var _=require(_0xe54a('0x0'));var util=require(_0xe54a('0x1'));var moment=require(_0xe54a('0x2'));var BPromise=require(_0xe54a('0x3'));var rs=require(_0xe54a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe54a('0x5'))['db'];var utils=require(_0xe54a('0x6'));var logger=require(_0xe54a('0x7'))(_0xe54a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe54a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43df22,_0x20e097,_0xb78bbf){return new BPromise(function(_0x27fe7f,_0x4a4191){return client['request'](_0x43df22,_0xb78bbf)[_0xe54a('0xa')](function(_0x30460b){logger[_0xe54a('0xb')](_0xe54a('0xc'),_0x20e097,'request\x20sent');logger[_0xe54a('0xd')](_0xe54a('0xe'),_0x20e097,_0xe54a('0xf'),JSON[_0xe54a('0x10')](_0x30460b));if(_0x30460b[_0xe54a('0x11')]){if(_0x30460b[_0xe54a('0x11')][_0xe54a('0x12')]===0x1f4){logger[_0xe54a('0x11')](_0xe54a('0xc'),_0x20e097,_0x30460b[_0xe54a('0x11')][_0xe54a('0x13')]);return _0x4a4191(_0x30460b[_0xe54a('0x11')][_0xe54a('0x13')]);}logger['error'](_0xe54a('0xc'),_0x20e097,_0x30460b[_0xe54a('0x11')][_0xe54a('0x13')]);return _0x27fe7f(_0x30460b['error']['message']);}else{logger[_0xe54a('0xb')](_0xe54a('0xc'),_0x20e097,_0xe54a('0xf'));_0x27fe7f(_0x30460b[_0xe54a('0x14')]['message']);}})[_0xe54a('0x15')](function(_0x2c970d){logger[_0xe54a('0x11')](_0xe54a('0xc'),_0x20e097,_0x2c970d);_0x4a4191(_0x2c970d);});});}exports[_0xe54a('0x16')]=function(_0x555399){var _0x59cd41=this;return new Promise(function(_0x4e4e78,_0xf1a494){return db['MailApplication'][_0xe54a('0x17')](_0x555399[_0xe54a('0x18')],{'raw':_0x555399[_0xe54a('0x19')]?_0x555399['options'][_0xe54a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555399['options']?_0x555399[_0xe54a('0x19')][_0xe54a('0x1b')]||null:null,'attributes':_0x555399[_0xe54a('0x19')]?_0x555399[_0xe54a('0x19')][_0xe54a('0x1c')]||null:null,'limit':_0x555399[_0xe54a('0x19')]?_0x555399['options']['limit']||null:null})[_0xe54a('0xa')](function(_0x3630a4){logger[_0xe54a('0xb')]('UpdateMailApplication',_0x555399);logger[_0xe54a('0xd')](_0xe54a('0x16'),_0x555399,JSON['stringify'](_0x3630a4));_0x4e4e78(_0x3630a4);})[_0xe54a('0x15')](function(_0x3f70b5){logger[_0xe54a('0x11')]('UpdateMailApplication',_0x3f70b5['message'],_0x555399);_0xf1a494(_0x59cd41[_0xe54a('0x11')](0x1f4,_0x3f70b5[_0xe54a('0x13')]));});});}; \ No newline at end of file +var _0x10c5=['client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','update','options','raw','attributes','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45a044,_0x538a43){var _0x223939=function(_0x528451){while(--_0x528451){_0x45a044['push'](_0x45a044['shift']());}};_0x223939(++_0x538a43);}(_0x10c5,0x104));var _0x510c=function(_0x3c8dfc,_0x34f4df){_0x3c8dfc=_0x3c8dfc-0x0;var _0x17609d=_0x10c5[_0x3c8dfc];return _0x17609d;};'use strict';var _=require('lodash');var util=require(_0x510c('0x0'));var moment=require(_0x510c('0x1'));var BPromise=require('bluebird');var rs=require(_0x510c('0x2'));var fs=require('fs');var Redis=require(_0x510c('0x3'));var db=require(_0x510c('0x4'))['db'];var utils=require(_0x510c('0x5'));var logger=require(_0x510c('0x6'))(_0x510c('0x7'));var config=require(_0x510c('0x8'));var jayson=require(_0x510c('0x9'));var client=jayson[_0x510c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3891a8,_0x1afb89,_0x36ac3d){return new BPromise(function(_0x5c8fc3,_0x32f4f5){return client[_0x510c('0xb')](_0x3891a8,_0x36ac3d)['then'](function(_0x105bc2){logger[_0x510c('0xc')](_0x510c('0xd'),_0x1afb89,_0x510c('0xe'));logger[_0x510c('0xf')](_0x510c('0x10'),_0x1afb89,_0x510c('0xe'),JSON[_0x510c('0x11')](_0x105bc2));if(_0x105bc2[_0x510c('0x12')]){if(_0x105bc2[_0x510c('0x12')][_0x510c('0x13')]===0x1f4){logger['error'](_0x510c('0xd'),_0x1afb89,_0x105bc2[_0x510c('0x12')][_0x510c('0x14')]);return _0x32f4f5(_0x105bc2[_0x510c('0x12')][_0x510c('0x14')]);}logger[_0x510c('0x12')](_0x510c('0xd'),_0x1afb89,_0x105bc2[_0x510c('0x12')][_0x510c('0x14')]);return _0x5c8fc3(_0x105bc2['error'][_0x510c('0x14')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x1afb89,_0x510c('0xe'));_0x5c8fc3(_0x105bc2['result'][_0x510c('0x14')]);}})[_0x510c('0x15')](function(_0x49e93f){logger[_0x510c('0x12')](_0x510c('0xd'),_0x1afb89,_0x49e93f);_0x32f4f5(_0x49e93f);});});}exports['UpdateMailApplication']=function(_0x3c9819){var _0x3e197a=this;return new Promise(function(_0x2a66c9,_0x4cf371){return db['MailApplication'][_0x510c('0x16')](_0x3c9819['body'],{'raw':_0x3c9819[_0x510c('0x17')]?_0x3c9819[_0x510c('0x17')][_0x510c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9819['options']?_0x3c9819[_0x510c('0x17')]['where']||null:null,'attributes':_0x3c9819[_0x510c('0x17')]?_0x3c9819['options'][_0x510c('0x19')]||null:null,'limit':_0x3c9819[_0x510c('0x17')]?_0x3c9819[_0x510c('0x17')]['limit']||null:null})[_0x510c('0x1a')](function(_0x271ffd){logger[_0x510c('0xc')]('UpdateMailApplication',_0x3c9819);logger['debug']('UpdateMailApplication',_0x3c9819,JSON[_0x510c('0x11')](_0x271ffd));_0x2a66c9(_0x271ffd);})[_0x510c('0x15')](function(_0x33cefc){logger[_0x510c('0x12')]('UpdateMailApplication',_0x33cefc['message'],_0x3c9819);_0x4cf371(_0x3e197a[_0x510c('0x12')](0x1f4,_0x33cefc[_0x510c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7e1ad1c..e3c872b 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 _0x3248=['create','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','download','post'];(function(_0x28a351,_0x4c5fd4){var _0x24c03a=function(_0x37b5e7){while(--_0x37b5e7){_0x28a351['push'](_0x28a351['shift']());}};_0x24c03a(++_0x4c5fd4);}(_0x3248,0x1b0));var _0x8324=function(_0x2bb943,_0x67ea62){_0x2bb943=_0x2bb943-0x0;var _0x1d481c=_0x3248[_0x2bb943];return _0x1d481c;};'use strict';var multer=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var path=require(_0x8324('0x2'));var timeout=require(_0x8324('0x3'));var express=require(_0x8324('0x4'));var router=express[_0x8324('0x5')]();var auth=require(_0x8324('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8324('0x7'));router[_0x8324('0x8')]('/',auth['isAuthenticated'](),controller[_0x8324('0x9')]);router[_0x8324('0x8')](_0x8324('0xa'),auth[_0x8324('0xb')](),controller[_0x8324('0xc')]);router['get'](_0x8324('0xd'),auth[_0x8324('0xb')](),controller[_0x8324('0xe')]);router['get']('/:id/messages',auth[_0x8324('0xb')](),controller[_0x8324('0xf')]);router[_0x8324('0x8')]('/:id/download',auth[_0x8324('0xb')](),controller[_0x8324('0x10')]);router[_0x8324('0x11')]('/',auth[_0x8324('0xb')](),controller[_0x8324('0x12')]);router[_0x8324('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x8324('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8324('0x13')](_0x8324('0x14'),_0x8324('0x15')),controller['addTags']);router[_0x8324('0x16')](_0x8324('0xd'),auth[_0x8324('0xb')](),interaction['tracked'](_0x8324('0x14'),_0x8324('0x17')),controller[_0x8324('0x18')]);router[_0x8324('0x19')](_0x8324('0xd'),auth[_0x8324('0xb')](),interaction['tracked']('mail',_0x8324('0x1a')),controller[_0x8324('0x1b')]);router[_0x8324('0x19')]('/:id/tags',auth[_0x8324('0xb')](),controller[_0x8324('0x1c')]);module[_0x8324('0x1d')]=router; \ No newline at end of file +var _0xeb76=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','describe','/:id','isAuthenticated','show'];(function(_0x27992c,_0x1ad209){var _0x5a77e5=function(_0x183abb){while(--_0x183abb){_0x27992c['push'](_0x27992c['shift']());}};_0x5a77e5(++_0x1ad209);}(_0xeb76,0x171));var _0x6eb7=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xeb76[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x6eb7('0x0'));var util=require(_0x6eb7('0x1'));var path=require(_0x6eb7('0x2'));var timeout=require(_0x6eb7('0x3'));var express=require('express');var router=express[_0x6eb7('0x4')]();var auth=require(_0x6eb7('0x5'));var interaction=require(_0x6eb7('0x6'));var config=require(_0x6eb7('0x7'));var controller=require(_0x6eb7('0x8'));router[_0x6eb7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6eb7('0x9')](_0x6eb7('0xa'),auth['isAuthenticated'](),controller[_0x6eb7('0xb')]);router[_0x6eb7('0x9')](_0x6eb7('0xc'),auth[_0x6eb7('0xd')](),controller[_0x6eb7('0xe')]);router[_0x6eb7('0x9')](_0x6eb7('0xf'),auth[_0x6eb7('0xd')](),controller[_0x6eb7('0x10')]);router[_0x6eb7('0x9')](_0x6eb7('0x11'),auth[_0x6eb7('0xd')](),controller['download']);router[_0x6eb7('0x12')]('/',auth['isAuthenticated'](),controller[_0x6eb7('0x13')]);router['post'](_0x6eb7('0xf'),auth[_0x6eb7('0xd')](),controller[_0x6eb7('0x14')]);router[_0x6eb7('0x12')](_0x6eb7('0x15'),auth[_0x6eb7('0xd')](),interaction[_0x6eb7('0x16')](_0x6eb7('0x17'),_0x6eb7('0x18')),controller[_0x6eb7('0x19')]);router[_0x6eb7('0x1a')](_0x6eb7('0xc'),auth[_0x6eb7('0xd')](),interaction['tracked'](_0x6eb7('0x17'),_0x6eb7('0x1b')),controller['update']);router[_0x6eb7('0x1c')]('/:id',auth['isAuthenticated'](),interaction[_0x6eb7('0x16')](_0x6eb7('0x17'),_0x6eb7('0x1d')),controller[_0x6eb7('0x1e')]);router['delete']('/:id/tags',auth[_0x6eb7('0xd')](),controller['removeTags']);module[_0x6eb7('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b9e5c16..6f4f2b5 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 _0x092b=['ENUM','out','sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x3d2f6a,_0x3e4923){var _0x5c4851=function(_0x213ba1){while(--_0x213ba1){_0x3d2f6a['push'](_0x3d2f6a['shift']());}};_0x5c4851(++_0x3e4923);}(_0x092b,0x19c));var _0xb092=function(_0x347eed,_0x12af42){_0x347eed=_0x347eed-0x0;var _0x2cf2f0=_0x092b[_0x347eed];return _0x2cf2f0;};'use strict';var Sequelize=require(_0xb092('0x0'));var iconv=require(_0xb092('0x1'));module[_0xb092('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb092('0x3')]},'disposition':{'type':Sequelize[_0xb092('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb092('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb092('0x4')]},'cc':{'type':Sequelize[_0xb092('0x5')](_0xb092('0x6'))},'subject':{'type':Sequelize[_0xb092('0x5')]()},'attach':{'type':Sequelize[_0xb092('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xb092('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb092('0x8')]('in',_0xb092('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb092('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb092('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0xb092('0x5')](_0xb092('0x6'))}}; \ No newline at end of file +var _0x6677=['DATE','ENUM','out','iconv','BOOLEAN','STRING','TEXT','long'];(function(_0x28b1ff,_0x26a0aa){var _0x431f5d=function(_0x4b940e){while(--_0x4b940e){_0x28b1ff['push'](_0x28b1ff['shift']());}};_0x431f5d(++_0x26a0aa);}(_0x6677,0x93));var _0x7667=function(_0x1af0f4,_0x3a993f){_0x1af0f4=_0x1af0f4-0x0;var _0xc8ed09=_0x6677[_0x1af0f4];return _0xc8ed09;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x7667('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7667('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7667('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7667('0x2')](0x1fe)},'to':{'type':Sequelize[_0x7667('0x2')]},'cc':{'type':Sequelize[_0x7667('0x3')](_0x7667('0x4'))},'subject':{'type':Sequelize[_0x7667('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7667('0x5')]},'substatus':{'type':Sequelize[_0x7667('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x7667('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x7667('0x6')]('in',_0x7667('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7667('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7667('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x7667('0x3')](_0x7667('0x4'))},'lastMsgText':{'type':Sequelize[_0x7667('0x3')](_0x7667('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d3ab214..6ffcea8 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(_0x1a1315,_0x1b65b7){var _0x14b1ba=function(_0x11eaf8){while(--_0x11eaf8){_0x1a1315['push'](_0x1a1315['shift']());}};_0x14b1ba(++_0x1b65b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x1cbb2f,_0xad3edb){var _0x44215c=function(_0x694281){while(--_0x694281){_0x1cbb2f['push'](_0x1cbb2f['shift']());}};_0x44215c(++_0xad3edb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b9ceade..de149fb 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 _0x62f0=['remove','then','findAll','setDataValue','unreadMessages','length','catch','hook','events','../../mysqldb','MailInteraction','save','update'];(function(_0x17ce02,_0x5ce6fa){var _0x326356=function(_0x1423cc){while(--_0x1423cc){_0x17ce02['push'](_0x17ce02['shift']());}};_0x326356(++_0x5ce6fa);}(_0x62f0,0xd8));var _0x062f=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0x62f0[_0x188c88];return _0x4e4c38;};'use strict';var EventEmitter=require(_0x062f('0x0'));var MailInteraction=require(_0x062f('0x1'))['db'][_0x062f('0x2')];var MailMessage=require(_0x062f('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x062f('0x3'),'afterUpdate':_0x062f('0x4'),'afterDestroy':_0x062f('0x5')};function emitEvent(_0x54b7f7){return function(_0x571a56,_0x1b6f51,_0x3d28b5){_0x571a56['getUsers']({'attributes':['id'],'raw':!![]})[_0x062f('0x6')](function(_0x52f10f){_0x571a56['setDataValue']('Users',_0x52f10f['map'](function(_0x21e722){return{'id':_0x21e722['id']};}));return MailMessage[_0x062f('0x7')]({'where':{'MailInteractionId':_0x571a56['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4cf373){_0x571a56[_0x062f('0x8')](_0x062f('0x9'),_0x4cf373[_0x062f('0xa')]);MailInteractionEvents['emit'](_0x54b7f7+':'+_0x571a56['id'],_0x571a56);MailInteractionEvents['emit'](_0x54b7f7,_0x571a56);_0x3d28b5(null);})[_0x062f('0xb')](_0x3d28b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x062f('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x17ef=['map','findAll','unreadMessages','length','emit','catch','events','../../mysqldb','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','Users'];(function(_0x345631,_0xd88694){var _0x317713=function(_0x5d6afb){while(--_0x5d6afb){_0x345631['push'](_0x345631['shift']());}};_0x317713(++_0xd88694);}(_0x17ef,0x15f));var _0xf17e=function(_0x32858e,_0x47aaee){_0x32858e=_0x32858e-0x0;var _0x15c720=_0x17ef[_0x32858e];return _0x15c720;};'use strict';var EventEmitter=require(_0xf17e('0x0'));var MailInteraction=require(_0xf17e('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xf17e('0x1'))['db'][_0xf17e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf17e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf17e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b0efe){return function(_0x2f23a9,_0x3729a6,_0x5dbb66){_0x2f23a9[_0xf17e('0x5')]({'attributes':['id'],'raw':!![]})[_0xf17e('0x6')](function(_0x369c4e){_0x2f23a9[_0xf17e('0x7')](_0xf17e('0x8'),_0x369c4e[_0xf17e('0x9')](function(_0xe3b682){return{'id':_0xe3b682['id']};}));return MailMessage[_0xf17e('0xa')]({'where':{'MailInteractionId':_0x2f23a9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf17e('0x6')](function(_0x396446){_0x2f23a9['setDataValue'](_0xf17e('0xb'),_0x396446[_0xf17e('0xc')]);MailInteractionEvents[_0xf17e('0xd')](_0x3b0efe+':'+_0x2f23a9['id'],_0x2f23a9);MailInteractionEvents[_0xf17e('0xd')](_0x3b0efe,_0x2f23a9);_0x5dbb66(null);})[_0xf17e('0xe')](_0x5dbb66(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ba0d27c..2692037 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 _0x55ca=['changed','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x5199af,_0x1eb67c){var _0x381974=function(_0x456a88){while(--_0x456a88){_0x5199af['push'](_0x5199af['shift']());}};_0x381974(++_0x1eb67c);}(_0x55ca,0x126));var _0xa55c=function(_0x205b46,_0x3ca65b){_0x205b46=_0x205b46-0x0;var _0x2b6ae8=_0x55ca[_0x205b46];return _0x2b6ae8;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('MailInteraction',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[{'name':_0xa55c('0xa'),'fields':['subject','to'],'type':_0xa55c('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x290d28,_0x52a3bc,_0x5849ad){if(_0x290d28[_0xa55c('0xc')]){_0x290d28[_0xa55c('0xd')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));}if(_0x290d28[_0xa55c('0x10')]){_0x290d28[_0xa55c('0x11')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));}_0x5849ad(null,_0x52a3bc);},'beforeUpdate':function(_0x3998f7,_0x15eec8,_0x5d47ff){if(_0x3998f7['changed'](_0xa55c('0xc'))){_0x3998f7['substatusAt']=_0x3998f7['substatus']?moment()['format'](_0xa55c('0xf')):null;}if(_0x3998f7[_0xa55c('0x12')](_0xa55c('0x10'))){_0x3998f7[_0xa55c('0x11')]=moment()[_0xa55c('0xe')](_0xa55c('0xf'));_0x3998f7['substatus']=null;_0x3998f7[_0xa55c('0xd')]=null;}_0x5d47ff(null,_0x3998f7);},'afterUpdate':function(_0x3dcf4f,_0x25934f,_0x31e10d){var _0x1c4cfd=_0x3c97c8[_0xa55c('0x13')];var _0x51590e=_0x3dcf4f[_0xa55c('0x14')]({'plain':!![]});if(_0x51590e[_0xa55c('0x10')]){return _0x1c4cfd['MailMessage'][_0xa55c('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x51590e['id']}})[_0xa55c('0x16')](function(){_0x31e10d();})[_0xa55c('0x17')](function(_0x358b61){_0x31e10d(_0x358b61);});}else{_0x31e10d();}}},'charset':_0xa55c('0x18'),'collate':_0xa55c('0x19')});}; \ No newline at end of file +var _0x9957=['api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','lodash','util','../../config/logger'];(function(_0x461d7b,_0x5a6003){var _0x40aff1=function(_0x4d2ee3){while(--_0x4d2ee3){_0x461d7b['push'](_0x461d7b['shift']());}};_0x40aff1(++_0x5a6003);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){if(_0xa2e5f0[_0x7995('0xe')]){_0xa2e5f0[_0x7995('0xf')]=moment()[_0x7995('0x10')](_0x7995('0x11'));}if(_0xa2e5f0['closed']){_0xa2e5f0[_0x7995('0x12')]=moment()[_0x7995('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c8a3(null,_0x3116fb);},'beforeUpdate':function(_0xb0c872,_0x2cb37a,_0x19a27e){if(_0xb0c872[_0x7995('0x13')](_0x7995('0xe'))){_0xb0c872[_0x7995('0xf')]=_0xb0c872[_0x7995('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xb0c872[_0x7995('0x13')](_0x7995('0x14'))){_0xb0c872[_0x7995('0x12')]=moment()[_0x7995('0x10')](_0x7995('0x11'));_0xb0c872[_0x7995('0xe')]=null;_0xb0c872[_0x7995('0xf')]=null;}_0x19a27e(null,_0xb0c872);},'afterUpdate':function(_0x41cbf0,_0x5377e5,_0x2eeacc){var _0x565d97=_0x137b6b[_0x7995('0x15')];var _0x37f297=_0x41cbf0[_0x7995('0x16')]({'plain':!![]});if(_0x37f297[_0x7995('0x14')]){return _0x565d97[_0x7995('0x17')][_0x7995('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37f297['id']}})['then'](function(){_0x2eeacc();})['catch'](function(_0x2536c8){_0x2eeacc(_0x2536c8);});}else{_0x2eeacc();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d355266..187a39f 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 _0xc368=['rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','where','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xdf2d08,_0x47f349){var _0x341245=function(_0x3a7231){while(--_0x3a7231){_0xdf2d08['push'](_0xdf2d08['shift']());}};_0x341245(++_0x47f349);}(_0xc368,0x7b));var _0x8c36=function(_0x3e7b03,_0x29ffa9){_0x3e7b03=_0x3e7b03-0x0;var _0x25a7bb=_0xc368[_0x3e7b03];return _0x25a7bb;};'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});config['redis']=_[_0x8c36('0xa')](config[_0x8c36('0xb')],{'host':_0x8c36('0xc'),'port':0x18eb});var socket=require(_0x8c36('0xd'))(new Redis(config[_0x8c36('0xb')]));require(_0x8c36('0xe'))['register'](socket);function respondWithRpcPromise(_0x5bfbdd,_0x49f227,_0x116d25){return new BPromise(function(_0x28854e,_0x5132f6){return client[_0x8c36('0xf')](_0x5bfbdd,_0x116d25)[_0x8c36('0x10')](function(_0x1d5c61){logger[_0x8c36('0x11')](_0x8c36('0x12'),_0x49f227,_0x8c36('0x13'));logger[_0x8c36('0x14')](_0x8c36('0x15'),_0x49f227,_0x8c36('0x13'),JSON[_0x8c36('0x16')](_0x1d5c61));if(_0x1d5c61[_0x8c36('0x17')]){if(_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x18')]===0x1f4){logger[_0x8c36('0x17')]('MailInteraction,\x20%s,\x20%s',_0x49f227,_0x1d5c61[_0x8c36('0x17')]['message']);return _0x5132f6(_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x19')]);}logger[_0x8c36('0x17')](_0x8c36('0x12'),_0x49f227,_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x19')]);return _0x28854e(_0x1d5c61[_0x8c36('0x17')][_0x8c36('0x19')]);}else{logger[_0x8c36('0x11')]('MailInteraction,\x20%s,\x20%s',_0x49f227,_0x8c36('0x13'));_0x28854e(_0x1d5c61[_0x8c36('0x1a')][_0x8c36('0x19')]);}})[_0x8c36('0x1b')](function(_0x3ef5ba){logger['error'](_0x8c36('0x12'),_0x49f227,_0x3ef5ba);_0x5132f6(_0x3ef5ba);});});}exports[_0x8c36('0x1c')]=function(_0x2ac843){var _0x137d5c=this;return new Promise(function(_0xc30310,_0x2b07ad){return db[_0x8c36('0x1d')][_0x8c36('0x1e')](_0x2ac843[_0x8c36('0x1f')],{'raw':_0x2ac843[_0x8c36('0x20')]?_0x2ac843[_0x8c36('0x20')][_0x8c36('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ac843[_0x8c36('0x20')]?_0x2ac843['options']['where']||null:null,'attributes':_0x2ac843['options']?_0x2ac843['options'][_0x8c36('0x22')]||null:null,'limit':_0x2ac843[_0x8c36('0x20')]?_0x2ac843[_0x8c36('0x20')][_0x8c36('0x23')]||null:null})[_0x8c36('0x10')](function(_0x27c0df){logger['info'](_0x8c36('0x1c'),_0x2ac843);logger['debug'](_0x8c36('0x1c'),_0x2ac843,JSON['stringify'](_0x27c0df));_0xc30310(_0x27c0df);})[_0x8c36('0x1b')](function(_0x1afee4){logger[_0x8c36('0x17')](_0x8c36('0x1c'),_0x1afee4['message'],_0x2ac843);_0x2b07ad(_0x137d5c['error'](0x1f4,_0x1afee4[_0x8c36('0x19')]));});});};exports[_0x8c36('0x24')]=function(_0x5ad933){return new Promise(function(_0x4fc3ba,_0x418663){return db[_0x8c36('0x1d')]['find']({'where':_0x5ad933[_0x8c36('0x20')]?_0x5ad933[_0x8c36('0x20')][_0x8c36('0x25')]||null:null})['then'](function(_0x49b737){if(_0x49b737){return _0x49b737[_0x8c36('0x26')](_0x5ad933[_0x8c36('0x1f')][_0x8c36('0x27')],_[_0x8c36('0x28')](_0x5ad933[_0x8c36('0x1f')],[_0x8c36('0x27'),'id'])||{});}})[_0x8c36('0x29')](function(_0x1a828f){logger[_0x8c36('0x11')](_0x8c36('0x2a'),_0x5ad933);logger[_0x8c36('0x14')](_0x8c36('0x2a'),_0x5ad933,JSON[_0x8c36('0x16')](_0x1a828f));_0x4fc3ba(_0x1a828f);})[_0x8c36('0x1b')](function(_0x103d26){logger[_0x8c36('0x17')](_0x8c36('0x2a'),_0x103d26['message'],_0x5ad933);_0x418663(_this['error'](0x1f4,_0x103d26['message']));});});}; \ No newline at end of file +var _0xc36d=['AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','MailInteraction','find','addTags','omit','ids','info'];(function(_0x56ebf3,_0x9d4baa){var _0x2cc060=function(_0x5e47a9){while(--_0x5e47a9){_0x56ebf3['push'](_0x56ebf3['shift']());}};_0x2cc060(++_0x9d4baa);}(_0xc36d,0x7d));var _0xdc36=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xc36d[_0x27530d];return _0x59e561;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var moment=require(_0xdc36('0x2'));var BPromise=require(_0xdc36('0x3'));var rs=require(_0xdc36('0x4'));var fs=require('fs');var Redis=require(_0xdc36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('rpc');var config=require(_0xdc36('0x8'));var jayson=require(_0xdc36('0x9'));var client=jayson[_0xdc36('0xa')][_0xdc36('0xb')]({'port':0x232a});config[_0xdc36('0xc')]=_['defaults'](config[_0xdc36('0xc')],{'host':_0xdc36('0xd'),'port':0x18eb});var socket=require(_0xdc36('0xe'))(new Redis(config[_0xdc36('0xc')]));require('./mailInteraction.socket')[_0xdc36('0xf')](socket);function respondWithRpcPromise(_0x23956b,_0x573f8e,_0x1d0035){return new BPromise(function(_0x1cb73d,_0x2483bd){return client['request'](_0x23956b,_0x1d0035)[_0xdc36('0x10')](function(_0x18707d){logger['info']('MailInteraction,\x20%s,\x20%s',_0x573f8e,_0xdc36('0x11'));logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x573f8e,_0xdc36('0x11'),JSON['stringify'](_0x18707d));if(_0x18707d[_0xdc36('0x14')]){if(_0x18707d[_0xdc36('0x14')][_0xdc36('0x15')]===0x1f4){logger[_0xdc36('0x14')](_0xdc36('0x16'),_0x573f8e,_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);return _0x2483bd(_0x18707d[_0xdc36('0x14')]['message']);}logger[_0xdc36('0x14')]('MailInteraction,\x20%s,\x20%s',_0x573f8e,_0x18707d['error']['message']);return _0x1cb73d(_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);}else{logger['info'](_0xdc36('0x16'),_0x573f8e,_0xdc36('0x11'));_0x1cb73d(_0x18707d[_0xdc36('0x18')][_0xdc36('0x17')]);}})[_0xdc36('0x19')](function(_0x46783d){logger['error'](_0xdc36('0x16'),_0x573f8e,_0x46783d);_0x2483bd(_0x46783d);});});}exports[_0xdc36('0x1a')]=function(_0x58eefb){var _0x414953=this;return new Promise(function(_0x197924,_0x3f25f0){return db['MailInteraction'][_0xdc36('0x1b')](_0x58eefb[_0xdc36('0x1c')],{'raw':_0x58eefb['options']?_0x58eefb[_0xdc36('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58eefb['options']?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x1e')]||null:null,'attributes':_0x58eefb[_0xdc36('0x1d')]?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x1f')]||null:null,'limit':_0x58eefb[_0xdc36('0x1d')]?_0x58eefb[_0xdc36('0x1d')][_0xdc36('0x20')]||null:null})['then'](function(_0x34057e){logger['info'](_0xdc36('0x1a'),_0x58eefb);logger[_0xdc36('0x12')](_0xdc36('0x1a'),_0x58eefb,JSON['stringify'](_0x34057e));_0x197924(_0x34057e);})[_0xdc36('0x19')](function(_0x6e3906){logger[_0xdc36('0x14')]('UpdateMailInteraction',_0x6e3906[_0xdc36('0x17')],_0x58eefb);_0x3f25f0(_0x414953[_0xdc36('0x14')](0x1f4,_0x6e3906[_0xdc36('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x3c39e3){return new Promise(function(_0x2dcef7,_0x4b15b4){return db[_0xdc36('0x21')][_0xdc36('0x22')]({'where':_0x3c39e3['options']?_0x3c39e3[_0xdc36('0x1d')]['where']||null:null})['then'](function(_0x57785d){if(_0x57785d){return _0x57785d[_0xdc36('0x23')](_0x3c39e3[_0xdc36('0x1c')]['ids'],_[_0xdc36('0x24')](_0x3c39e3[_0xdc36('0x1c')],[_0xdc36('0x25'),'id'])||{});}})['spread'](function(_0x2a4451){logger[_0xdc36('0x26')](_0xdc36('0x27'),_0x3c39e3);logger[_0xdc36('0x12')](_0xdc36('0x27'),_0x3c39e3,JSON[_0xdc36('0x28')](_0x2a4451));_0x2dcef7(_0x2a4451);})[_0xdc36('0x19')](function(_0x54eb86){logger[_0xdc36('0x14')](_0xdc36('0x27'),_0x54eb86['message'],_0x3c39e3);_0x4b15b4(_this['error'](0x1f4,_0x54eb86[_0xdc36('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ede3cae..3d54b46 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 _0xca9a=['mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xca9a,0xaf));var _0xaca9=function(_0x3af00a,_0x297156){_0x3af00a=_0x3af00a-0x0;var _0x46b573=_0xca9a[_0x3af00a];return _0x46b573;};'use strict';var MailInteractionEvents=require(_0xaca9('0x0'));var events=[_0xaca9('0x1'),_0xaca9('0x2'),'update'];function createListener(_0x3a5dd1,_0x53f2c2){return function(_0x5d1fbe){_0x53f2c2[_0xaca9('0x3')](_0x3a5dd1,_0x5d1fbe);};}function removeListener(_0x113b28,_0x15c86d){return function(){MailInteractionEvents[_0xaca9('0x4')](_0x113b28,_0x15c86d);};}exports['register']=function(_0x3ae8a4){for(var _0x3a35d4=0x0,_0x3f1d89=events['length'];_0x3a35d4<_0x3f1d89;_0x3a35d4++){var _0x548ffa=events[_0x3a35d4];var _0x3688aa=createListener(_0xaca9('0x5')+_0x548ffa,_0x3ae8a4);MailInteractionEvents['on'](_0x548ffa,_0x3688aa);}}; \ No newline at end of file +var _0x34c9=['register','length','remove','update','emit','removeListener'];(function(_0x39a14e,_0x42990e){var _0x5030b8=function(_0x578e0d){while(--_0x578e0d){_0x39a14e['push'](_0x39a14e['shift']());}};_0x5030b8(++_0x42990e);}(_0x34c9,0x92));var _0x934c=function(_0x4af250,_0x4b41cf){_0x4af250=_0x4af250-0x0;var _0xf68a14=_0x34c9[_0x4af250];return _0xf68a14;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x934c('0x0'),_0x934c('0x1')];function createListener(_0x457471,_0x290854){return function(_0x1a9654){_0x290854[_0x934c('0x2')](_0x457471,_0x1a9654);};}function removeListener(_0x1efed5,_0x81db15){return function(){MailInteractionEvents[_0x934c('0x3')](_0x1efed5,_0x81db15);};}exports[_0x934c('0x4')]=function(_0x5577d3){for(var _0x181a2e=0x0,_0x4e6187=events[_0x934c('0x5')];_0x181a2e<_0x4e6187;_0x181a2e++){var _0x3b4cf7=events[_0x181a2e];var _0x3944c6=createListener('mailInteraction:'+_0x3b4cf7,_0x5577d3);MailInteractionEvents['on'](_0x3b4cf7,_0x3944c6);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 680a4e2..ff22756 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 _0x008c=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','tracked','mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x471ff8,_0x5c7fa1){var _0x42bdb5=function(_0x52f28d){while(--_0x52f28d){_0x471ff8['push'](_0x471ff8['shift']());}};_0x42bdb5(++_0x5c7fa1);}(_0x008c,0x188));var _0xc008=function(_0x45c1b7,_0x136e78){_0x45c1b7=_0x45c1b7-0x0;var _0x2ae433=_0x008c[_0x45c1b7];return _0x2ae433;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xc008('0xa')](),interaction[_0xc008('0x10')]('mail',_0xc008('0x11')),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router[_0xc008('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router['put'](_0xc008('0x16'),auth[_0xc008('0xa')](),controller[_0xc008('0x17')]);router[_0xc008('0x18')](_0xc008('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x98a8,0x12c));var _0x898a=function(_0x359f8a,_0x2e7aad){_0x359f8a=_0x359f8a-0x0;var _0x235d44=_0x98a8[_0x359f8a];return _0x235d44;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2957d1d..a568651 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 _0xd052=['INTEGER','exports','long','BOOLEAN','out','STRING','TEXT','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd052,0x69));var _0x2d05=function(_0x116895,_0xf2457e){_0x116895=_0x116895-0x0;var _0x51b0d9=_0xd052[_0x116895];return _0x51b0d9;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x2d05('0x0')]={'body':{'type':Sequelize['TEXT'](_0x2d05('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x2d05('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d05('0x3')),'defaultValue':_0x2d05('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2d05('0x4')]},'to':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))},'cc':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))},'bcc':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))},'subject':{'type':Sequelize[_0x2d05('0x5')]},'sentAt':{'type':Sequelize[_0x2d05('0x6')]},'attach':{'type':Sequelize[_0x2d05('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2d05('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x2d05('0x5')](_0x2d05('0x1'))}}; \ No newline at end of file +var _0xcac2=['INTEGER','BOOLEAN','sequelize','lodash','exports','long','TEXT','out','STRING'];(function(_0x31a261,_0x4635ce){var _0x1a8230=function(_0x57dc81){while(--_0x57dc81){_0x31a261['push'](_0x31a261['shift']());}};_0x1a8230(++_0x4635ce);}(_0xcac2,0x1e8));var _0x2cac=function(_0x1fc584,_0x586a18){_0x1fc584=_0x1fc584-0x0;var _0x27a483=_0xcac2[_0x1fc584];return _0x27a483;};'use strict';var Sequelize=require(_0x2cac('0x0'));var _=require(_0x2cac('0x1'));module[_0x2cac('0x2')]={'body':{'type':Sequelize['TEXT'](_0x2cac('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2cac('0x4')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x2cac('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2cac('0x6')](0x1fe)},'from':{'type':Sequelize[_0x2cac('0x6')]},'to':{'type':Sequelize[_0x2cac('0x4')](_0x2cac('0x3'))},'cc':{'type':Sequelize[_0x2cac('0x4')](_0x2cac('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x2cac('0x4')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x2cac('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2cac('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x2cac('0x3'))},'originCc':{'type':Sequelize[_0x2cac('0x4')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9450b5d..0241959 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 _0xa992=['acceptmessage','agent','RejectMessage','rejectMessage','interface','channel','rejectmessage','unix','toString','root','files','tmp','server','bcc','Attachment','Attachments','from','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','build','download','log','err','unlinkSync','html-pdf','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','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','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','keys','body','find','params','create','direction','out','secret','split','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','attachments','join','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','format','UserId','Contact','get','MailInteractionId','read1stAt','interaction','role','acceptMessage','manual','SIP/%s','event','EventManager'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xa992,0xc4));var _0x2a99=function(_0x181f84,_0xb7048d){_0x181f84=_0x181f84-0x0;var _0x5e45af=_0xa992[_0x181f84];return _0x5e45af;};'use strict';var pdf=require(_0x2a99('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a99('0x1'));var rp=require(_0x2a99('0x2'));var moment=require('moment');var BPromise=require(_0x2a99('0x3'));var Mustache=require('mustache');var util=require(_0x2a99('0x4'));var path=require('path');var sox=require(_0x2a99('0x5'));var csv=require('to-csv');var ejs=require(_0x2a99('0x6'));var fs=require('fs');var _=require(_0x2a99('0x7'));var squel=require(_0x2a99('0x8'));var crypto=require(_0x2a99('0x9'));var jsforce=require(_0x2a99('0xa'));var deskjs=require(_0x2a99('0xb'));var toCsv=require(_0x2a99('0xc'));var querystring=require(_0x2a99('0xd'));var Papa=require(_0x2a99('0xe'));var Redis=require(_0x2a99('0xf'));var authService=require(_0x2a99('0x10'));var qs=require(_0x2a99('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a99('0x12'));var logger=require(_0x2a99('0x13'))(_0x2a99('0x14'));var utils=require(_0x2a99('0x15'));var config=require(_0x2a99('0x16'));var db=require(_0x2a99('0x17'))['db'];config[_0x2a99('0x18')]=_['defaults'](config[_0x2a99('0x18')],{'host':_0x2a99('0x19'),'port':0x18eb});var socket=require(_0x2a99('0x1a'))(new Redis(config[_0x2a99('0x18')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x2a99('0x1b'));var client=jayson[_0x2a99('0x1c')][_0x2a99('0x1d')]({'port':0x232c});var client9003=jayson[_0x2a99('0x1c')]['http']({'port':0x232b});var client9002=jayson['client'][_0x2a99('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5b3024,_0x3320af,_0x180f75){if(_0x180f75){var _0x22adf3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22adf3[_0x2a99('0x1e')](_0x3320af)){return _0x5b3024;}else{throw new db[(_0x2a99('0x1f'))][(_0x2a99('0x20'))](_0x2a99('0x21'));}}else{return _0x5b3024;}}function respondWithRpcPromise(_0x1630b4,_0xf88a7c,_0x3bbe1b,_0x3be6b6){return new BPromise(function(_0x4c793e,_0xa2c95b){var _0x49052c=_0x3be6b6||client;return _0x49052c[_0x2a99('0x22')](_0x1630b4,_0x3bbe1b)[_0x2a99('0x23')](function(_0x426821){logger['info'](_0x2a99('0x24'),_0xf88a7c,_0x2a99('0x25'));logger['debug'](_0x2a99('0x26'),_0xf88a7c,_0x2a99('0x25'),JSON[_0x2a99('0x27')](_0x426821));if(_0x426821['error']){if(_0x426821[_0x2a99('0x28')][_0x2a99('0x29')]===0x1f4){logger['error'](_0x2a99('0x24'),_0xf88a7c,_0x426821[_0x2a99('0x28')][_0x2a99('0x2a')]);return _0xa2c95b(_0x426821['error'][_0x2a99('0x2a')]);}logger[_0x2a99('0x28')](_0x2a99('0x24'),_0xf88a7c,_0x426821[_0x2a99('0x28')]['message']);return _0x4c793e(_0x426821[_0x2a99('0x28')][_0x2a99('0x2a')]);}else{logger[_0x2a99('0x2b')](_0x2a99('0x24'),_0xf88a7c,_0x2a99('0x25'));_0x4c793e(_0x426821[_0x2a99('0x2c')][_0x2a99('0x2a')]);}})[_0x2a99('0x2d')](function(_0x4b34c6){logger[_0x2a99('0x28')](_0x2a99('0x24'),_0xf88a7c,_0x4b34c6);_0xa2c95b(_0x4b34c6);});});}function respondWithStatusCode(_0x479e27,_0x4714d7){_0x4714d7=_0x4714d7||0xcc;return function(_0x2043c4){if(_0x2043c4){return _0x479e27[_0x2a99('0x2e')](_0x4714d7);}return _0x479e27['status'](_0x4714d7)['end']();};}function respondWithResult(_0x5d318f,_0x14f536){_0x14f536=_0x14f536||0xc8;return function(_0x307c53){if(_0x307c53){return _0x5d318f[_0x2a99('0x2f')](_0x14f536)[_0x2a99('0x30')](_0x307c53);}};}function respondWithFilteredResult(_0x3e8ad4,_0x834f3f){return function(_0x23cccd){if(_0x23cccd){var _0xff1ee9=_0x23cccd[_0x2a99('0x31')],_0xd0ddec=_0x834f3f[_0x2a99('0x32')],_0x3029ac=_0x834f3f[_0x2a99('0x32')]+_0x834f3f[_0x2a99('0x33')],_0x2ee9ca;if(_0x3029ac>=_0xff1ee9){_0x3029ac=_0xff1ee9;_0x2ee9ca=0xc8;}else{_0x2ee9ca=0xce;}_0x3e8ad4[_0x2a99('0x2f')](_0x2ee9ca);return _0x3e8ad4['set'](_0x2a99('0x34'),_0xd0ddec+'-'+_0x3029ac+'/'+_0xff1ee9)[_0x2a99('0x30')](_0x23cccd);}return null;};}function patchUpdates(_0x5a5115){return function(_0x3f0d6a){try{jsonpatch[_0x2a99('0x35')](_0x3f0d6a,_0x5a5115,!![]);}catch(_0x4f5bcd){return BPromise[_0x2a99('0x36')](_0x4f5bcd);}return _0x3f0d6a[_0x2a99('0x37')]();};}function saveUpdates(_0x2550ab,_0x4e3a27){return function(_0x4d47b8){if(_0x4d47b8){return _0x4d47b8[_0x2a99('0x38')](_0x2550ab)[_0x2a99('0x23')](function(_0x823054){return _0x823054;});}return null;};}function removeEntity(_0x4f2784,_0x116395){return function(_0x20a3a9){if(_0x20a3a9){return _0x20a3a9[_0x2a99('0x39')]()[_0x2a99('0x23')](function(){_0x4f2784['status'](0xcc)[_0x2a99('0x3a')]();});}};}function handleEntityNotFound(_0xaa9924,_0x3b47cd){return function(_0x2e46a4){if(!_0x2e46a4){_0xaa9924['sendStatus'](0x194);}return _0x2e46a4;};}function handleError(_0x1fce17,_0x15a202){_0x15a202=_0x15a202||0x1f4;return function(_0x341de5){logger[_0x2a99('0x28')](_0x341de5['stack']);if(_0x341de5[_0x2a99('0x3b')]){delete _0x341de5['name'];}_0x1fce17[_0x2a99('0x2f')](_0x15a202)[_0x2a99('0x3c')](_0x341de5);};}exports[_0x2a99('0x3d')]=function(_0x482f1a,_0x455928){var _0x451516={},_0x381725={},_0x2503de={'count':0x0,'rows':[]};var _0x304177=_[_0x2a99('0x3e')](db[_0x2a99('0x3f')][_0x2a99('0x40')],function(_0x217bf9){return{'name':_0x217bf9[_0x2a99('0x41')],'type':_0x217bf9[_0x2a99('0x42')][_0x2a99('0x43')]};});_0x381725[_0x2a99('0x44')]=_[_0x2a99('0x3e')](_0x304177,'name');_0x381725['query']=_['keys'](_0x482f1a[_0x2a99('0x45')]);_0x381725['filters']=_[_0x2a99('0x46')](_0x381725['model'],_0x381725[_0x2a99('0x45')]);_0x451516['attributes']=_['intersection'](_0x381725['model'],qs[_0x2a99('0x47')](_0x482f1a[_0x2a99('0x45')][_0x2a99('0x47')]));_0x451516[_0x2a99('0x48')]=_0x451516[_0x2a99('0x48')][_0x2a99('0x49')]?_0x451516['attributes']:_0x381725['model'];if(!_0x482f1a[_0x2a99('0x45')]['hasOwnProperty'](_0x2a99('0x4a'))){_0x451516['limit']=qs[_0x2a99('0x33')](_0x482f1a[_0x2a99('0x45')]['limit']);_0x451516[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x482f1a[_0x2a99('0x45')][_0x2a99('0x32')]);}_0x451516['order']=qs[_0x2a99('0x4b')](_0x482f1a[_0x2a99('0x45')]['sort']);_0x451516['where']=qs[_0x2a99('0x4c')](_[_0x2a99('0x4d')](_0x482f1a['query'],_0x381725[_0x2a99('0x4c')]),_0x304177);if(_0x482f1a[_0x2a99('0x45')]['filter']){_0x451516[_0x2a99('0x4e')]=_['merge'](_0x451516[_0x2a99('0x4e')],{'$or':_['map'](_0x304177,function(_0x209fd2){if(_0x209fd2[_0x2a99('0x42')]!=='VIRTUAL'){var _0x313cf3={};_0x313cf3[_0x209fd2[_0x2a99('0x3b')]]={'$like':'%'+_0x482f1a[_0x2a99('0x45')][_0x2a99('0x4f')]+'%'};return _0x313cf3;}})});}_0x451516=_[_0x2a99('0x50')]({},_0x451516,_0x482f1a[_0x2a99('0x51')]);var _0x2eb5b0={'where':_0x451516['where']};return db[_0x2a99('0x3f')][_0x2a99('0x31')](_0x2eb5b0)[_0x2a99('0x23')](function(_0x273511){_0x2503de[_0x2a99('0x31')]=_0x273511;if(_0x482f1a[_0x2a99('0x45')][_0x2a99('0x52')]){_0x451516[_0x2a99('0x53')]=[{'all':!![]}];}return db[_0x2a99('0x3f')][_0x2a99('0x54')](_0x451516);})[_0x2a99('0x23')](function(_0x319f96){_0x2503de[_0x2a99('0x55')]=_0x319f96;return _0x2503de;})[_0x2a99('0x23')](respondWithFilteredResult(_0x455928,_0x451516))[_0x2a99('0x2d')](handleError(_0x455928,null));};exports[_0x2a99('0x56')]=function(_0x21a111,_0x21e71){var _0x198a58={'raw':!![],'where':{'id':_0x21a111['params']['id']}},_0xfe5737={};_0xfe5737[_0x2a99('0x44')]=_[_0x2a99('0x57')](db['MailMessage'][_0x2a99('0x40')]);_0xfe5737['query']=_[_0x2a99('0x57')](_0x21a111[_0x2a99('0x45')]);_0xfe5737[_0x2a99('0x4c')]=_[_0x2a99('0x46')](_0xfe5737[_0x2a99('0x44')],_0xfe5737[_0x2a99('0x45')]);_0x198a58[_0x2a99('0x48')]=_[_0x2a99('0x46')](_0xfe5737[_0x2a99('0x44')],qs[_0x2a99('0x47')](_0x21a111[_0x2a99('0x45')]['fields']));_0x198a58[_0x2a99('0x48')]=_0x198a58[_0x2a99('0x48')][_0x2a99('0x49')]?_0x198a58['attributes']:_0xfe5737['model'];if(_0x21a111[_0x2a99('0x45')][_0x2a99('0x52')]){_0x198a58[_0x2a99('0x53')]=[{'all':!![]}];}_0x198a58=_[_0x2a99('0x50')]({},_0x198a58,_0x21a111[_0x2a99('0x51')]);return db[_0x2a99('0x3f')]['find'](_0x198a58)[_0x2a99('0x23')](handleEntityNotFound(_0x21e71,null))[_0x2a99('0x23')](respondWithResult(_0x21e71,null))['catch'](handleError(_0x21e71,null));};exports[_0x2a99('0x38')]=function(_0x5e850f,_0x279d75){if(_0x5e850f[_0x2a99('0x58')]['id']){delete _0x5e850f['body']['id'];}return db[_0x2a99('0x3f')][_0x2a99('0x59')]({'where':{'id':_0x5e850f[_0x2a99('0x5a')]['id']}})[_0x2a99('0x23')](handleEntityNotFound(_0x279d75,null))[_0x2a99('0x23')](saveUpdates(_0x5e850f['body'],null))[_0x2a99('0x23')](respondWithResult(_0x279d75,null))[_0x2a99('0x2d')](handleError(_0x279d75,null));};exports[_0x2a99('0x39')]=function(_0x2b1545,_0x41c6e9){return db[_0x2a99('0x3f')]['find']({'where':{'id':_0x2b1545['params']['id']}})[_0x2a99('0x23')](handleEntityNotFound(_0x41c6e9,null))[_0x2a99('0x23')](removeEntity(_0x41c6e9,null))['catch'](handleError(_0x41c6e9,null));};exports['describe']=function(_0x37c7b7,_0x239475){return db[_0x2a99('0x3f')]['describe']()[_0x2a99('0x23')](respondWithResult(_0x239475,null))['catch'](handleError(_0x239475,null));};exports[_0x2a99('0x5b')]=function(_0x4950cb,_0x1b7318){return db['MailMessage'][_0x2a99('0x5b')](_0x4950cb['body'])[_0x2a99('0x23')](function(_0x2607f2){if(_0x2607f2){if(_0x2607f2[_0x2a99('0x5c')]===_0x2a99('0x5d')&&!_0x2607f2[_0x2a99('0x5e')]){var _0x41aeb8,_0x393ba0,_0x18ed23;if(_0x4950cb[_0x2a99('0x58')]['to']){_0x393ba0=_0x4950cb[_0x2a99('0x58')]['to'][_0x2a99('0x5f')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2607f2[_0x2a99('0x60')]},'include':[{'model':db[_0x2a99('0x61')],'as':'List','include':[{'model':db[_0x2a99('0x62')],'as':_0x2a99('0x63'),'where':{'email':_0x393ba0},'limit':0x1,'order':[[_0x2a99('0x64'),_0x2a99('0x65')]]}]},{'model':db[_0x2a99('0x66')],'as':_0x2a99('0x67'),'raw':!![]}]})[_0x2a99('0x23')](function(_0x1c5c7a){_0x41aeb8=_0x1c5c7a;if(_0x41aeb8&&_0x41aeb8[_0x2a99('0x67')]){var _0x4477c8={'tls':{'rejectUnauthorized':![]}};if(_[_0x2a99('0x68')](_0x41aeb8['Smtp'][_0x2a99('0x69')])){_0x4477c8[_0x2a99('0x6a')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6a')];_0x4477c8[_0x2a99('0x6b')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6b')];_0x4477c8['secure']=_0x41aeb8['Smtp'][_0x2a99('0x6c')];if(_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6d')]){_0x4477c8[_0x2a99('0x6e')]={'user':_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6f')],'pass':_0x41aeb8[_0x2a99('0x67')]['pass']};}}else{_0x4477c8[_0x2a99('0x69')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x69')];_0x4477c8[_0x2a99('0x6e')]={'user':_0x41aeb8['Smtp']['user'],'pass':_0x41aeb8[_0x2a99('0x67')]['pass']};_0x4477c8[_0x2a99('0x6c')]=_0x41aeb8[_0x2a99('0x67')][_0x2a99('0x6c')];}if(_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')]&&_0x4950cb[_0x2a99('0x58')]['attachments'][_0x2a99('0x49')]){for(var _0x5e68ee=0x0;_0x5e68ee<_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')][_0x2a99('0x49')];_0x5e68ee+=0x1){_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')][_0x5e68ee]={'filename':_0x4950cb['body'][_0x2a99('0x70')][_0x5e68ee][_0x2a99('0x3b')],'path':path[_0x2a99('0x71')](config['root'],_0x2a99('0x72'),_0x4950cb[_0x2a99('0x58')][_0x2a99('0x70')][_0x5e68ee]['basename'])};}}_0x18ed23={'account':_0x4477c8,'message':_0x4950cb[_0x2a99('0x58')]};return;}})[_0x2a99('0x23')](function(){if(_0x41aeb8['List']){if(_0x41aeb8[_0x2a99('0x73')][_0x2a99('0x63')][_0x2a99('0x49')]){return _0x41aeb8['List'][_0x2a99('0x63')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x4950cb['body'],{'firstName':_0x4950cb[_0x2a99('0x58')]['to'],'email':_0x4950cb[_0x2a99('0x58')]['to'],'phone':_0x4950cb['body']['to'],'ListId':_0x41aeb8[_0x2a99('0x74')]}));}}else{throw new Error(_0x2a99('0x75'));}})[_0x2a99('0x23')](function(){if(_0x18ed23){return respondWithRpcPromise(_0x2a99('0x76'),_0x2a99('0x77'),_0x18ed23,client9003)[_0x2a99('0x23')](function(_0x597144){return _0x2607f2[_0x2a99('0x38')]({'read':!![],'messageId':_0x597144['messageId'],'sentAt':moment()['format'](_0x2a99('0x78'))});})[_0x2a99('0x2d')](function(_0x192468){logger[_0x2a99('0x28')]('%s',JSON[_0x2a99('0x27')](_0x192468));return _0x2607f2;});}return _0x2607f2;});}return _0x2607f2;}})[_0x2a99('0x23')](respondWithResult(_0x1b7318,0xc9))['catch'](handleError(_0x1b7318,null));};var interaction_log=require(_0x2a99('0x13'))(_0x2a99('0x79'));exports[_0x2a99('0x7a')]=function(_0x20e89e,_0x5e2113,_0xd1cbc0){var _0x110d9c={'channel':_0x2a99('0x7b')};if(_0x20e89e['body']['id']){delete _0x20e89e[_0x2a99('0x58')]['id'];}_0x20e89e['body']['read']=!![];_0x20e89e[_0x2a99('0x58')][_0x2a99('0x7c')]=moment()[_0x2a99('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x20e89e[_0x2a99('0x58')][_0x2a99('0x7e')]=_0x20e89e[_0x2a99('0x58')]['UserId']||_0x20e89e[_0x2a99('0x6f')]['id'];return db[_0x2a99('0x3f')][_0x2a99('0x59')]({'where':{'id':_0x20e89e[_0x2a99('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x2a99('0x62')],'as':_0x2a99('0x7f')}]})[_0x2a99('0x23')](handleEntityNotFound(_0x5e2113,null))[_0x2a99('0x23')](saveUpdates(_0x20e89e[_0x2a99('0x58')],null))[_0x2a99('0x23')](function(_0x1db46b){if(_0x1db46b){_0x110d9c['message']=_0x1db46b[_0x2a99('0x80')]({'plain':!![]});return db['MailInteraction'][_0x2a99('0x59')]({'where':{'id':_0x1db46b[_0x2a99('0x81')]}});}return null;})[_0x2a99('0x23')](handleEntityNotFound(_0x5e2113,null))[_0x2a99('0x23')](function(_0x141f52){if(_0x141f52){return _0x141f52[_0x2a99('0x38')]({'UserId':_0x20e89e[_0x2a99('0x58')][_0x2a99('0x7e')],'read1stAt':_[_0x2a99('0x68')](_0x141f52[_0x2a99('0x82')])?moment()['format'](_0x2a99('0x78')):undefined});}return null;})[_0x2a99('0x23')](function(_0x59da49){if(_0x59da49){_0x110d9c[_0x2a99('0x83')]=_0x59da49[_0x2a99('0x80')]({'plain':!![]});interaction_log[_0x2a99('0x2b')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20e89e['user']['id'],_0x20e89e[_0x2a99('0x6f')]['name'],_0x20e89e[_0x2a99('0x6f')][_0x2a99('0x84')],_0x110d9c[_0x2a99('0x83')]['id'],_0x20e89e['body']?JSON['stringify'](_0x20e89e['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x2a99('0x85'),_0x110d9c);}return null;})['then'](function(_0x48debf){if(_0x48debf){if(_0x20e89e[_0x2a99('0x58')][_0x2a99('0x86')]){_0x110d9c[_0x2a99('0x2a')]['interface']=util[_0x2a99('0x7d')](_0x2a99('0x87'),_0x20e89e['user'][_0x2a99('0x3b')]);_0x110d9c[_0x2a99('0x2a')]['channel']=_0x110d9c['channel'];_0x110d9c[_0x2a99('0x2a')][_0x2a99('0x88')]=_0x2a99('0x7a');return respondWithRpcPromise(_0x2a99('0x89'),_0x2a99('0x89'),{'event':_0x2a99('0x8a'),'message':_0x110d9c[_0x2a99('0x2a')]},client9002)[_0x2a99('0x23')](function(){return _0x110d9c;});}return _0x110d9c;}return null;})['then'](respondWithResult(_0x5e2113,null))[_0x2a99('0x2d')](handleError(_0x5e2113,null));};var interaction_log=require(_0x2a99('0x13'))(_0x2a99('0x79'));exports['reject']=function(_0x8ed745,_0x3bc2a6,_0x33091f){var _0x5c078f={'agent':{},'channel':_0x2a99('0x7b')};if(_0x8ed745[_0x2a99('0x58')]['id']){delete _0x8ed745['body']['id'];}_0x8ed745[_0x2a99('0x58')][_0x2a99('0x7e')]=_0x8ed745[_0x2a99('0x58')]['UserId']||_0x8ed745['user']['id'];_0x5c078f[_0x2a99('0x8b')]['id']=_0x8ed745['body'][_0x2a99('0x7e')];return db[_0x2a99('0x3f')]['find']({'where':{'id':_0x8ed745['params']['id'],'UserId':null}})[_0x2a99('0x23')](handleEntityNotFound(_0x3bc2a6,null))[_0x2a99('0x23')](function(_0x2b96b3){if(_0x2b96b3){_0x5c078f[_0x2a99('0x2a')]=_0x2b96b3[_0x2a99('0x80')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x2b96b3[_0x2a99('0x81')]}});}return null;})[_0x2a99('0x23')](handleEntityNotFound(_0x3bc2a6,null))[_0x2a99('0x23')](function(_0x1a2637){if(_0x1a2637){_0x5c078f[_0x2a99('0x83')]=_0x1a2637[_0x2a99('0x80')]({'plain':!![]});interaction_log[_0x2a99('0x2b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8ed745[_0x2a99('0x6f')]['id'],_0x8ed745[_0x2a99('0x6f')][_0x2a99('0x3b')],_0x8ed745[_0x2a99('0x6f')][_0x2a99('0x84')],_0x5c078f[_0x2a99('0x83')]['id'],_0x8ed745[_0x2a99('0x58')]?JSON['stringify'](_0x8ed745['body']):'null');return respondWithRpcPromise(_0x2a99('0x8c'),_0x2a99('0x8d'),_0x5c078f);}return null;})[_0x2a99('0x23')](function(_0x39febe){if(_0x39febe){_0x39febe[_0x2a99('0x2a')][_0x2a99('0x8e')]=util[_0x2a99('0x7d')]('SIP/%s',_0x8ed745[_0x2a99('0x6f')]['name']);_0x39febe['message'][_0x2a99('0x8f')]=_0x5c078f[_0x2a99('0x8f')];_0x39febe[_0x2a99('0x2a')][_0x2a99('0x88')]=_0x2a99('0x36');respondWithRpcPromise(_0x2a99('0x89'),'EventManager',{'event':_0x2a99('0x90'),'message':_0x39febe[_0x2a99('0x2a')]},client9002);return _0x5c078f;}return null;})['then'](respondWithResult(_0x3bc2a6,null))[_0x2a99('0x2d')](handleError(_0x3bc2a6,null));};exports['download']=function(_0x4ebe84,_0x381f16){var _0x21ed7b=moment()[_0x2a99('0x91')]()[_0x2a99('0x92')]();var _0x388918=path[_0x2a99('0x71')](config[_0x2a99('0x93')],'server',_0x2a99('0x94'),_0x2a99('0x95'));var _0x565837=path[_0x2a99('0x71')](config['root'],_0x2a99('0x96'),'files',_0x2a99('0x70'));var _0x216a38=util[_0x2a99('0x7d')]('message-%s.eml',_0x21ed7b);return db[_0x2a99('0x3f')][_0x2a99('0x59')]({'where':{'id':_0x4ebe84[_0x2a99('0x5a')]['id']},'attributes':['id',_0x2a99('0x58'),'from','to','cc',_0x2a99('0x97'),'subject','createdAt'],'include':_0x4ebe84[_0x2a99('0x45')][_0x2a99('0x70')]?[{'model':db[_0x2a99('0x98')],'as':_0x2a99('0x99')}]:undefined})[_0x2a99('0x23')](handleEntityNotFound(_0x381f16,null))[_0x2a99('0x23')](function(_0x1c2e09){if(_0x1c2e09){var _0x2a43e8=_0x1c2e09;var _0x4f27d8={'from':_0x2a43e8[_0x2a99('0x9a')],'to':_0x2a43e8['to'],'subject':_0x2a43e8[_0x2a99('0x9b')],'html':_0x2a43e8['body'],'headers':{'Date':moment(_0x2a43e8[_0x2a99('0x9c')])[_0x2a99('0x7d')](_0x2a99('0x9d'))},'attachments':[]};if(_0x1c2e09['cc']){_0x4f27d8[_0x2a99('0x9e')]['Cc']=_0x1c2e09['cc'];}if(_0x1c2e09[_0x2a99('0x97')]){_0x4f27d8[_0x2a99('0x9e')][_0x2a99('0x9f')]=_0x1c2e09[_0x2a99('0x97')];}return new BPromise(function(_0x7efe96,_0x4da9bb){if(_0x1c2e09['Attachments']){for(var _0x27434d=0x0;_0x27434d<_0x1c2e09[_0x2a99('0x99')][_0x2a99('0x49')];_0x27434d++){var _0xb5a920=_0x1c2e09[_0x2a99('0x99')][_0x27434d];var _0x23091c=path['join'](_0x565837,_0xb5a920[_0x2a99('0xa0')]);if(fs['existsSync'](_0x23091c)){_0x4f27d8[_0x2a99('0x70')][_0x2a99('0xa1')]({'name':_0xb5a920[_0x2a99('0x3b')],'contentType':_0xb5a920[_0x2a99('0x42')],'data':fs['readFileSync'](_0x23091c)});}}}emlformat[_0x2a99('0xa2')](_0x4f27d8,function(_0x3094be,_0x4be8fc){if(_0x3094be)return _0x4da9bb(_0x3094be);fs['writeFileSync'](path[_0x2a99('0x71')](_0x388918,_0x216a38),_0x4be8fc);return _0x7efe96(_0x4be8fc);});});}})[_0x2a99('0x23')](function(_0x429def){if(_0x429def){return _0x381f16[_0x2a99('0xa3')](path[_0x2a99('0x71')](_0x388918,_0x216a38),_0x216a38,function(_0xe89f23){if(_0xe89f23){console[_0x2a99('0xa4')](_0x2a99('0xa5'),_0xe89f23);}else{fs[_0x2a99('0xa6')](path['join'](_0x388918,_0x216a38));}});}})['catch'](handleError(_0x381f16,null));}; \ No newline at end of file +var _0x572b=['name','filter','options','includeAll','findAll','rows','show','params','include','find','catch','body','describe','create','direction','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','basename','defaults','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','format','UserId','Contact','get','MailInteraction','MailInteractionId','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','info','role','RejectMessage','rejectMessage','event','rejectmessage','download','unix','server','tmp','files','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','test','Sequelize','ValidationError','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x572b,0x1b2));var _0xb572=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x572b[_0x4d8a8f];return _0xfc4adc;};'use strict';var pdf=require(_0xb572('0x0'));var emlformat=require(_0xb572('0x1'));var rimraf=require(_0xb572('0x2'));var zipdir=require(_0xb572('0x3'));var jsonpatch=require(_0xb572('0x4'));var rp=require('request-promise');var moment=require(_0xb572('0x5'));var BPromise=require(_0xb572('0x6'));var Mustache=require(_0xb572('0x7'));var util=require('util');var path=require(_0xb572('0x8'));var sox=require(_0xb572('0x9'));var csv=require(_0xb572('0xa'));var ejs=require(_0xb572('0xb'));var fs=require('fs');var _=require(_0xb572('0xc'));var squel=require(_0xb572('0xd'));var crypto=require(_0xb572('0xe'));var jsforce=require(_0xb572('0xf'));var deskjs=require(_0xb572('0x10'));var toCsv=require(_0xb572('0xa'));var querystring=require('querystring');var Papa=require(_0xb572('0x11'));var Redis=require('ioredis');var authService=require(_0xb572('0x12'));var qs=require(_0xb572('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb572('0x14'))(_0xb572('0x15'));var utils=require(_0xb572('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb572('0x17')]=_['defaults'](config[_0xb572('0x17')],{'host':_0xb572('0x18'),'port':0x18eb});var socket=require(_0xb572('0x19'))(new Redis(config['redis']));require(_0xb572('0x1a'))[_0xb572('0x1b')](socket);var jayson=require(_0xb572('0x1c'));var client=jayson['client'][_0xb572('0x1d')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0xb572('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x436487,_0x1481be,_0x5098bc){if(_0x5098bc){var _0x3285f9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3285f9[_0xb572('0x1e')](_0x1481be)){return _0x436487;}else{throw new db[(_0xb572('0x1f'))][(_0xb572('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x436487;}}function respondWithRpcPromise(_0x2b9c04,_0x18597b,_0x5b9a16,_0x53074e){return new BPromise(function(_0x34a77f,_0x341432){var _0x580241=_0x53074e||client;return _0x580241[_0xb572('0x21')](_0x2b9c04,_0x5b9a16)['then'](function(_0x38bbc6){logger['info'](_0xb572('0x22'),_0x18597b,_0xb572('0x23'));logger[_0xb572('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x18597b,_0xb572('0x23'),JSON[_0xb572('0x25')](_0x38bbc6));if(_0x38bbc6[_0xb572('0x26')]){if(_0x38bbc6['error'][_0xb572('0x27')]===0x1f4){logger[_0xb572('0x26')](_0xb572('0x22'),_0x18597b,_0x38bbc6['error'][_0xb572('0x28')]);return _0x341432(_0x38bbc6[_0xb572('0x26')][_0xb572('0x28')]);}logger[_0xb572('0x26')]('MailMessage,\x20%s,\x20%s',_0x18597b,_0x38bbc6[_0xb572('0x26')][_0xb572('0x28')]);return _0x34a77f(_0x38bbc6[_0xb572('0x26')][_0xb572('0x28')]);}else{logger['info'](_0xb572('0x22'),_0x18597b,_0xb572('0x23'));_0x34a77f(_0x38bbc6[_0xb572('0x29')][_0xb572('0x28')]);}})['catch'](function(_0x330754){logger['error'](_0xb572('0x22'),_0x18597b,_0x330754);_0x341432(_0x330754);});});}function respondWithStatusCode(_0x574990,_0x908888){_0x908888=_0x908888||0xcc;return function(_0x2c4b07){if(_0x2c4b07){return _0x574990[_0xb572('0x2a')](_0x908888);}return _0x574990[_0xb572('0x2b')](_0x908888)[_0xb572('0x2c')]();};}function respondWithResult(_0x338cea,_0x2891bc){_0x2891bc=_0x2891bc||0xc8;return function(_0x1b60a5){if(_0x1b60a5){return _0x338cea[_0xb572('0x2b')](_0x2891bc)['json'](_0x1b60a5);}};}function respondWithFilteredResult(_0x29cf6a,_0x1f3ddb){return function(_0x36563d){if(_0x36563d){var _0x363782=_0x36563d[_0xb572('0x2d')],_0x1527f7=_0x1f3ddb[_0xb572('0x2e')],_0x53ef84=_0x1f3ddb['offset']+_0x1f3ddb[_0xb572('0x2f')],_0x1e6ee2;if(_0x53ef84>=_0x363782){_0x53ef84=_0x363782;_0x1e6ee2=0xc8;}else{_0x1e6ee2=0xce;}_0x29cf6a[_0xb572('0x2b')](_0x1e6ee2);return _0x29cf6a[_0xb572('0x30')](_0xb572('0x31'),_0x1527f7+'-'+_0x53ef84+'/'+_0x363782)[_0xb572('0x32')](_0x36563d);}return null;};}function patchUpdates(_0x474678){return function(_0x29b897){try{jsonpatch[_0xb572('0x33')](_0x29b897,_0x474678,!![]);}catch(_0x5cfb86){return BPromise[_0xb572('0x34')](_0x5cfb86);}return _0x29b897[_0xb572('0x35')]();};}function saveUpdates(_0x240f11,_0x234bc7){return function(_0x195427){if(_0x195427){return _0x195427[_0xb572('0x36')](_0x240f11)['then'](function(_0x376cca){return _0x376cca;});}return null;};}function removeEntity(_0x25661b,_0x2742f2){return function(_0x4b7842){if(_0x4b7842){return _0x4b7842[_0xb572('0x37')]()[_0xb572('0x38')](function(){_0x25661b['status'](0xcc)[_0xb572('0x2c')]();});}};}function handleEntityNotFound(_0x1b310c,_0x55dcf3){return function(_0x191a6c){if(!_0x191a6c){_0x1b310c[_0xb572('0x2a')](0x194);}return _0x191a6c;};}function handleError(_0x22caba,_0x723115){_0x723115=_0x723115||0x1f4;return function(_0x58b119){logger[_0xb572('0x26')](_0x58b119['stack']);if(_0x58b119['name']){delete _0x58b119['name'];}_0x22caba[_0xb572('0x2b')](_0x723115)[_0xb572('0x39')](_0x58b119);};}exports[_0xb572('0x3a')]=function(_0x3e70f3,_0x1042c3){var _0x3f1d5b={},_0x40c5f9={},_0x3e5826={'count':0x0,'rows':[]};var _0x1dc6e5=_[_0xb572('0x3b')](db[_0xb572('0x3c')][_0xb572('0x3d')],function(_0x4a96a5){return{'name':_0x4a96a5['fieldName'],'type':_0x4a96a5[_0xb572('0x3e')][_0xb572('0x3f')]};});_0x40c5f9['model']=_[_0xb572('0x3b')](_0x1dc6e5,'name');_0x40c5f9[_0xb572('0x40')]=_[_0xb572('0x41')](_0x3e70f3['query']);_0x40c5f9[_0xb572('0x42')]=_[_0xb572('0x43')](_0x40c5f9[_0xb572('0x44')],_0x40c5f9[_0xb572('0x40')]);_0x3f1d5b['attributes']=_[_0xb572('0x43')](_0x40c5f9[_0xb572('0x44')],qs[_0xb572('0x45')](_0x3e70f3[_0xb572('0x40')][_0xb572('0x45')]));_0x3f1d5b['attributes']=_0x3f1d5b[_0xb572('0x46')][_0xb572('0x47')]?_0x3f1d5b[_0xb572('0x46')]:_0x40c5f9[_0xb572('0x44')];if(!_0x3e70f3[_0xb572('0x40')][_0xb572('0x48')](_0xb572('0x49'))){_0x3f1d5b[_0xb572('0x2f')]=qs[_0xb572('0x2f')](_0x3e70f3[_0xb572('0x40')][_0xb572('0x2f')]);_0x3f1d5b[_0xb572('0x2e')]=qs[_0xb572('0x2e')](_0x3e70f3[_0xb572('0x40')][_0xb572('0x2e')]);}_0x3f1d5b[_0xb572('0x4a')]=qs[_0xb572('0x4b')](_0x3e70f3[_0xb572('0x40')]['sort']);_0x3f1d5b[_0xb572('0x4c')]=qs['filters'](_[_0xb572('0x4d')](_0x3e70f3[_0xb572('0x40')],_0x40c5f9[_0xb572('0x42')]),_0x1dc6e5);if(_0x3e70f3[_0xb572('0x40')]['filter']){_0x3f1d5b[_0xb572('0x4c')]=_[_0xb572('0x4e')](_0x3f1d5b[_0xb572('0x4c')],{'$or':_[_0xb572('0x3b')](_0x1dc6e5,function(_0x1d7da6){if(_0x1d7da6[_0xb572('0x3e')]!=='VIRTUAL'){var _0x45c694={};_0x45c694[_0x1d7da6[_0xb572('0x4f')]]={'$like':'%'+_0x3e70f3['query'][_0xb572('0x50')]+'%'};return _0x45c694;}})});}_0x3f1d5b=_[_0xb572('0x4e')]({},_0x3f1d5b,_0x3e70f3[_0xb572('0x51')]);var _0x551c39={'where':_0x3f1d5b[_0xb572('0x4c')]};return db['MailMessage'][_0xb572('0x2d')](_0x551c39)[_0xb572('0x38')](function(_0x545e17){_0x3e5826[_0xb572('0x2d')]=_0x545e17;if(_0x3e70f3['query'][_0xb572('0x52')]){_0x3f1d5b['include']=[{'all':!![]}];}return db[_0xb572('0x3c')][_0xb572('0x53')](_0x3f1d5b);})[_0xb572('0x38')](function(_0x3e80ad){_0x3e5826[_0xb572('0x54')]=_0x3e80ad;return _0x3e5826;})[_0xb572('0x38')](respondWithFilteredResult(_0x1042c3,_0x3f1d5b))['catch'](handleError(_0x1042c3,null));};exports[_0xb572('0x55')]=function(_0xcaaf01,_0x1a6339){var _0x1c7502={'raw':!![],'where':{'id':_0xcaaf01[_0xb572('0x56')]['id']}},_0x126951={};_0x126951[_0xb572('0x44')]=_[_0xb572('0x41')](db[_0xb572('0x3c')][_0xb572('0x3d')]);_0x126951['query']=_['keys'](_0xcaaf01['query']);_0x126951['filters']=_[_0xb572('0x43')](_0x126951['model'],_0x126951[_0xb572('0x40')]);_0x1c7502[_0xb572('0x46')]=_[_0xb572('0x43')](_0x126951[_0xb572('0x44')],qs[_0xb572('0x45')](_0xcaaf01[_0xb572('0x40')][_0xb572('0x45')]));_0x1c7502[_0xb572('0x46')]=_0x1c7502[_0xb572('0x46')][_0xb572('0x47')]?_0x1c7502[_0xb572('0x46')]:_0x126951['model'];if(_0xcaaf01[_0xb572('0x40')][_0xb572('0x52')]){_0x1c7502[_0xb572('0x57')]=[{'all':!![]}];}_0x1c7502=_[_0xb572('0x4e')]({},_0x1c7502,_0xcaaf01['options']);return db[_0xb572('0x3c')][_0xb572('0x58')](_0x1c7502)['then'](handleEntityNotFound(_0x1a6339,null))[_0xb572('0x38')](respondWithResult(_0x1a6339,null))[_0xb572('0x59')](handleError(_0x1a6339,null));};exports[_0xb572('0x36')]=function(_0x17ce6e,_0xe23510){if(_0x17ce6e[_0xb572('0x5a')]['id']){delete _0x17ce6e[_0xb572('0x5a')]['id'];}return db[_0xb572('0x3c')][_0xb572('0x58')]({'where':{'id':_0x17ce6e['params']['id']}})[_0xb572('0x38')](handleEntityNotFound(_0xe23510,null))[_0xb572('0x38')](saveUpdates(_0x17ce6e['body'],null))['then'](respondWithResult(_0xe23510,null))[_0xb572('0x59')](handleError(_0xe23510,null));};exports[_0xb572('0x37')]=function(_0x415df6,_0x45d99e){return db['MailMessage']['find']({'where':{'id':_0x415df6[_0xb572('0x56')]['id']}})[_0xb572('0x38')](handleEntityNotFound(_0x45d99e,null))[_0xb572('0x38')](removeEntity(_0x45d99e,null))[_0xb572('0x59')](handleError(_0x45d99e,null));};exports[_0xb572('0x5b')]=function(_0x459ed7,_0x344dca){return db[_0xb572('0x3c')][_0xb572('0x5b')]()['then'](respondWithResult(_0x344dca,null))[_0xb572('0x59')](handleError(_0x344dca,null));};exports[_0xb572('0x5c')]=function(_0x35a959,_0x3d0554){return db[_0xb572('0x3c')][_0xb572('0x5c')](_0x35a959[_0xb572('0x5a')])['then'](function(_0x5d034d){if(_0x5d034d){if(_0x5d034d[_0xb572('0x5d')]===_0xb572('0x5e')&&!_0x5d034d[_0xb572('0x5f')]){var _0x3a6e08,_0x3c46b8,_0x11e821;if(_0x35a959[_0xb572('0x5a')]['to']){_0x3c46b8=_0x35a959[_0xb572('0x5a')]['to']['split'](',')[0x0];}return db[_0xb572('0x60')][_0xb572('0x61')]({'where':{'id':_0x5d034d['MailAccountId']},'include':[{'model':db[_0xb572('0x62')],'as':_0xb572('0x63'),'include':[{'model':db[_0xb572('0x64')],'as':_0xb572('0x65'),'where':{'email':_0x3c46b8},'limit':0x1,'order':[['updatedAt',_0xb572('0x66')]]}]},{'model':db[_0xb572('0x67')],'as':_0xb572('0x68'),'raw':!![]}]})['then'](function(_0x5c56da){_0x3a6e08=_0x5c56da;if(_0x3a6e08&&_0x3a6e08[_0xb572('0x68')]){var _0x56a7af={'tls':{'rejectUnauthorized':![]}};if(_[_0xb572('0x69')](_0x3a6e08[_0xb572('0x68')][_0xb572('0x6a')])){_0x56a7af[_0xb572('0x6b')]=_0x3a6e08[_0xb572('0x68')][_0xb572('0x6b')];_0x56a7af[_0xb572('0x6c')]=_0x3a6e08['Smtp'][_0xb572('0x6c')];_0x56a7af[_0xb572('0x6d')]=_0x3a6e08['Smtp'][_0xb572('0x6d')];if(_0x3a6e08['Smtp']['authentication']){_0x56a7af[_0xb572('0x6e')]={'user':_0x3a6e08['Smtp']['user'],'pass':_0x3a6e08[_0xb572('0x68')]['pass']};}}else{_0x56a7af[_0xb572('0x6a')]=_0x3a6e08[_0xb572('0x68')]['service'];_0x56a7af[_0xb572('0x6e')]={'user':_0x3a6e08[_0xb572('0x68')][_0xb572('0x6f')],'pass':_0x3a6e08[_0xb572('0x68')][_0xb572('0x70')]};_0x56a7af[_0xb572('0x6d')]=_0x3a6e08[_0xb572('0x68')]['secure'];}if(_0x35a959[_0xb572('0x5a')][_0xb572('0x71')]&&_0x35a959[_0xb572('0x5a')][_0xb572('0x71')]['length']){for(var _0x33d5d7=0x0;_0x33d5d7<_0x35a959[_0xb572('0x5a')]['attachments'][_0xb572('0x47')];_0x33d5d7+=0x1){_0x35a959[_0xb572('0x5a')][_0xb572('0x71')][_0x33d5d7]={'filename':_0x35a959['body'][_0xb572('0x71')][_0x33d5d7]['name'],'path':path[_0xb572('0x72')](config[_0xb572('0x73')],'server/files/attachments',_0x35a959['body'][_0xb572('0x71')][_0x33d5d7][_0xb572('0x74')])};}}_0x11e821={'account':_0x56a7af,'message':_0x35a959[_0xb572('0x5a')]};return;}})['then'](function(){if(_0x3a6e08[_0xb572('0x63')]){if(_0x3a6e08[_0xb572('0x63')][_0xb572('0x65')][_0xb572('0x47')]){return _0x3a6e08[_0xb572('0x63')][_0xb572('0x65')][0x0];}else{return db['CmContact'][_0xb572('0x5c')](_[_0xb572('0x75')](_0x35a959[_0xb572('0x5a')],{'firstName':_0x35a959[_0xb572('0x5a')]['to'],'email':_0x35a959[_0xb572('0x5a')]['to'],'phone':_0x35a959[_0xb572('0x5a')]['to'],'ListId':_0x3a6e08[_0xb572('0x76')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xb572('0x38')](function(){if(_0x11e821){return respondWithRpcPromise(_0xb572('0x77'),_0xb572('0x78'),_0x11e821,client9003)[_0xb572('0x38')](function(_0x21c411){return _0x5d034d[_0xb572('0x36')]({'read':!![],'messageId':_0x21c411[_0xb572('0x79')],'sentAt':moment()['format'](_0xb572('0x7a'))});})[_0xb572('0x59')](function(_0x48e707){logger[_0xb572('0x26')]('%s',JSON[_0xb572('0x25')](_0x48e707));return _0x5d034d;});}return _0x5d034d;});}return _0x5d034d;}})['then'](respondWithResult(_0x3d0554,0xc9))[_0xb572('0x59')](handleError(_0x3d0554,null));};var interaction_log=require(_0xb572('0x14'))(_0xb572('0x7b'));exports[_0xb572('0x7c')]=function(_0x6fc672,_0x708d55,_0x224193){var _0x51bc10={'channel':_0xb572('0x7d')};if(_0x6fc672['body']['id']){delete _0x6fc672[_0xb572('0x5a')]['id'];}_0x6fc672[_0xb572('0x5a')]['read']=!![];_0x6fc672[_0xb572('0x5a')][_0xb572('0x7e')]=moment()[_0xb572('0x7f')](_0xb572('0x7a'));_0x6fc672[_0xb572('0x5a')]['UserId']=_0x6fc672['body'][_0xb572('0x80')]||_0x6fc672[_0xb572('0x6f')]['id'];return db[_0xb572('0x3c')]['find']({'where':{'id':_0x6fc672[_0xb572('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb572('0x81')}]})[_0xb572('0x38')](handleEntityNotFound(_0x708d55,null))[_0xb572('0x38')](saveUpdates(_0x6fc672[_0xb572('0x5a')],null))['then'](function(_0x3f4f6e){if(_0x3f4f6e){_0x51bc10[_0xb572('0x28')]=_0x3f4f6e[_0xb572('0x82')]({'plain':!![]});return db[_0xb572('0x83')][_0xb572('0x58')]({'where':{'id':_0x3f4f6e[_0xb572('0x84')]}});}return null;})[_0xb572('0x38')](handleEntityNotFound(_0x708d55,null))[_0xb572('0x38')](function(_0xe62e4d){if(_0xe62e4d){return _0xe62e4d[_0xb572('0x36')]({'UserId':_0x6fc672[_0xb572('0x5a')]['UserId'],'read1stAt':_[_0xb572('0x69')](_0xe62e4d['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4449ff){if(_0x4449ff){_0x51bc10['interaction']=_0x4449ff['get']({'plain':!![]});interaction_log['info'](_0xb572('0x85'),_0x6fc672[_0xb572('0x6f')]['id'],_0x6fc672[_0xb572('0x6f')]['name'],_0x6fc672['user']['role'],_0x51bc10[_0xb572('0x86')]['id'],_0x6fc672[_0xb572('0x5a')]?JSON[_0xb572('0x25')](_0x6fc672[_0xb572('0x5a')]):_0xb572('0x87'));return respondWithRpcPromise('AcceptMessage',_0xb572('0x88'),_0x51bc10);}return null;})['then'](function(_0x426b5e){if(_0x426b5e){if(_0x6fc672['body'][_0xb572('0x89')]){_0x51bc10[_0xb572('0x28')][_0xb572('0x8a')]=util['format'](_0xb572('0x8b'),_0x6fc672['user']['name']);_0x51bc10['message']['channel']=_0x51bc10[_0xb572('0x8c')];_0x51bc10[_0xb572('0x28')]['event']=_0xb572('0x7c');return respondWithRpcPromise(_0xb572('0x8d'),_0xb572('0x8d'),{'event':_0xb572('0x8e'),'message':_0x51bc10['message']},client9002)['then'](function(){return _0x51bc10;});}return _0x51bc10;}return null;})[_0xb572('0x38')](respondWithResult(_0x708d55,null))[_0xb572('0x59')](handleError(_0x708d55,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xb572('0x34')]=function(_0x33cecf,_0x3060a5,_0x451184){var _0x1f7b16={'agent':{},'channel':'mail'};if(_0x33cecf['body']['id']){delete _0x33cecf[_0xb572('0x5a')]['id'];}_0x33cecf[_0xb572('0x5a')][_0xb572('0x80')]=_0x33cecf['body'][_0xb572('0x80')]||_0x33cecf['user']['id'];_0x1f7b16[_0xb572('0x8f')]['id']=_0x33cecf['body']['UserId'];return db[_0xb572('0x3c')][_0xb572('0x58')]({'where':{'id':_0x33cecf['params']['id'],'UserId':null}})[_0xb572('0x38')](handleEntityNotFound(_0x3060a5,null))['then'](function(_0x2d6775){if(_0x2d6775){_0x1f7b16[_0xb572('0x28')]=_0x2d6775[_0xb572('0x82')]({'plain':!![]});return db[_0xb572('0x83')]['find']({'where':{'id':_0x2d6775[_0xb572('0x84')]}});}return null;})['then'](handleEntityNotFound(_0x3060a5,null))['then'](function(_0x26b1e8){if(_0x26b1e8){_0x1f7b16[_0xb572('0x86')]=_0x26b1e8[_0xb572('0x82')]({'plain':!![]});interaction_log[_0xb572('0x90')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33cecf['user']['id'],_0x33cecf[_0xb572('0x6f')][_0xb572('0x4f')],_0x33cecf[_0xb572('0x6f')][_0xb572('0x91')],_0x1f7b16['interaction']['id'],_0x33cecf[_0xb572('0x5a')]?JSON[_0xb572('0x25')](_0x33cecf[_0xb572('0x5a')]):'null');return respondWithRpcPromise(_0xb572('0x92'),_0xb572('0x93'),_0x1f7b16);}return null;})[_0xb572('0x38')](function(_0x2f7f45){if(_0x2f7f45){_0x2f7f45['message'][_0xb572('0x8a')]=util[_0xb572('0x7f')](_0xb572('0x8b'),_0x33cecf[_0xb572('0x6f')]['name']);_0x2f7f45['message'][_0xb572('0x8c')]=_0x1f7b16[_0xb572('0x8c')];_0x2f7f45[_0xb572('0x28')][_0xb572('0x94')]=_0xb572('0x34');respondWithRpcPromise(_0xb572('0x8d'),_0xb572('0x8d'),{'event':_0xb572('0x95'),'message':_0x2f7f45['message']},client9002);return _0x1f7b16;}return null;})[_0xb572('0x38')](respondWithResult(_0x3060a5,null))[_0xb572('0x59')](handleError(_0x3060a5,null));};exports[_0xb572('0x96')]=function(_0x5418da,_0x21b63c){var _0x154a5f=moment()[_0xb572('0x97')]()['toString']();var _0x22f647=path['join'](config[_0xb572('0x73')],_0xb572('0x98'),'files',_0xb572('0x99'));var _0x5271b1=path[_0xb572('0x72')](config[_0xb572('0x73')],_0xb572('0x98'),_0xb572('0x9a'),_0xb572('0x71'));var _0x1b33d2=util[_0xb572('0x7f')]('message-%s.eml',_0x154a5f);return db['MailMessage']['find']({'where':{'id':_0x5418da['params']['id']},'attributes':['id',_0xb572('0x5a'),_0xb572('0x9b'),'to','cc',_0xb572('0x9c'),_0xb572('0x9d'),_0xb572('0x9e')],'include':_0x5418da[_0xb572('0x40')][_0xb572('0x71')]?[{'model':db['Attachment'],'as':_0xb572('0x9f')}]:undefined})[_0xb572('0x38')](handleEntityNotFound(_0x21b63c,null))[_0xb572('0x38')](function(_0x1abeb4){if(_0x1abeb4){var _0x2e2544=_0x1abeb4;var _0xad669={'from':_0x2e2544['from'],'to':_0x2e2544['to'],'subject':_0x2e2544[_0xb572('0x9d')],'html':_0x2e2544[_0xb572('0x5a')],'headers':{'Date':moment(_0x2e2544[_0xb572('0x9e')])[_0xb572('0x7f')](_0xb572('0xa0'))},'attachments':[]};if(_0x1abeb4['cc']){_0xad669[_0xb572('0xa1')]['Cc']=_0x1abeb4['cc'];}if(_0x1abeb4[_0xb572('0x9c')]){_0xad669['headers'][_0xb572('0xa2')]=_0x1abeb4['bcc'];}return new BPromise(function(_0x38a75f,_0x2bc8f9){if(_0x1abeb4[_0xb572('0x9f')]){for(var _0xdb3a3d=0x0;_0xdb3a3d<_0x1abeb4['Attachments'][_0xb572('0x47')];_0xdb3a3d++){var _0x2194a3=_0x1abeb4[_0xb572('0x9f')][_0xdb3a3d];var _0x1334d5=path['join'](_0x5271b1,_0x2194a3[_0xb572('0x74')]);if(fs[_0xb572('0xa3')](_0x1334d5)){_0xad669['attachments'][_0xb572('0xa4')]({'name':_0x2194a3[_0xb572('0x4f')],'contentType':_0x2194a3['type'],'data':fs[_0xb572('0xa5')](_0x1334d5)});}}}emlformat[_0xb572('0xa6')](_0xad669,function(_0x41b611,_0x35a55c){if(_0x41b611)return _0x2bc8f9(_0x41b611);fs[_0xb572('0xa7')](path['join'](_0x22f647,_0x1b33d2),_0x35a55c);return _0x38a75f(_0x35a55c);});});}})[_0xb572('0x38')](function(_0x789b28){if(_0x789b28){return _0x21b63c[_0xb572('0x96')](path['join'](_0x22f647,_0x1b33d2),_0x1b33d2,function(_0x395440){if(_0x395440){console[_0xb572('0xa8')](_0xb572('0xa9'),_0x395440);}else{fs[_0xb572('0xaa')](path[_0xb572('0x72')](_0x22f647,_0x1b33d2));}});}})[_0xb572('0x59')](handleError(_0x21b63c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7562208..c4ba222 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 _0xe2ee=['update','remove','emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save'];(function(_0x332d08,_0x5b1c82){var _0x21e667=function(_0x71d4ca){while(--_0x71d4ca){_0x332d08['push'](_0x332d08['shift']());}};_0x21e667(++_0x5b1c82);}(_0xe2ee,0xc4));var _0xee2e=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xe2ee[_0x59e821];return _0x5333f6;};'use strict';var EventEmitter=require(_0xee2e('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xee2e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xee2e('0x2')](0x0);var events={'afterCreate':_0xee2e('0x3'),'afterUpdate':_0xee2e('0x4'),'afterDestroy':_0xee2e('0x5')};function emitEvent(_0x382602){return function(_0x59ed6d,_0x201b03,_0xa005b0){MailMessageEvents[_0xee2e('0x6')](_0x382602+':'+_0x59ed6d['id'],_0x59ed6d);MailMessageEvents[_0xee2e('0x6')](_0x382602,_0x59ed6d);_0xa005b0(null);};}for(var e in events){if(events[_0xee2e('0x7')](e)){var event=events[e];MailMessage[_0xee2e('0x8')](e,emitEvent(event));}}module[_0xee2e('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x1c36=['../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1c36,0x1cb));var _0x61c3=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x1c36[_0x5627e1];return _0x2f013f;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x61c3('0x0'))['db'][_0x61c3('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x61c3('0x2'),'afterUpdate':_0x61c3('0x3'),'afterDestroy':_0x61c3('0x4')};function emitEvent(_0x2a7509){return function(_0x547149,_0x2a4905,_0x223ef5){MailMessageEvents[_0x61c3('0x5')](_0x2a7509+':'+_0x547149['id'],_0x547149);MailMessageEvents[_0x61c3('0x5')](_0x2a7509,_0x547149);_0x223ef5(null);};}for(var e in events){if(events[_0x61c3('0x6')](e)){var event=events[e];MailMessage[_0x61c3('0x7')](e,emitEvent(event));}}module[_0x61c3('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9783778..e087f6d 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 _0xaa35=['MailInteraction','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','isNil','UserId'];(function(_0x5ec1ec,_0x5f095c){var _0x4c099f=function(_0x5b1a7e){while(--_0x5b1a7e){_0x5ec1ec['push'](_0x5ec1ec['shift']());}};_0x4c099f(++_0x5f095c);}(_0xaa35,0x6b));var _0x5aa3=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xaa35[_0x421eeb];return _0x2c7371;};'use strict';var _=require(_0x5aa3('0x0'));var util=require(_0x5aa3('0x1'));var logger=require(_0x5aa3('0x2'))(_0x5aa3('0x3'));var moment=require(_0x5aa3('0x4'));var BPromise=require(_0x5aa3('0x5'));var rp=require(_0x5aa3('0x6'));var htmlToText=require(_0x5aa3('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5aa3('0x8'));var config=require(_0x5aa3('0x9'));var attributes=require(_0x5aa3('0xa'));module[_0x5aa3('0xb')]=function(_0x26f952,_0x1c4bc5){return _0x26f952[_0x5aa3('0xc')](_0x5aa3('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5aa3('0xe')]},{'name':_0x5aa3('0xf'),'fields':[_0x5aa3('0x10'),_0x5aa3('0x11')],'type':_0x5aa3('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ad2c4,_0xac1e67,_0x18828b){if(_0x4ad2c4['body']){_0x4ad2c4[_0x5aa3('0x10')]=htmlToText['fromString'](_0x4ad2c4[_0x5aa3('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x18828b(null,_0xac1e67);},'afterCreate':function(_0x3dccb0,_0x48ee4d,_0x27b36a){var _0x2361b1=_0x26f952['models'];var _0x4dcf7d=_0x3dccb0[_0x5aa3('0x14')]({'plain':!![]});if(_0x4dcf7d[_0x5aa3('0x15')][_0x5aa3('0x16')]()==='in'||_0x4dcf7d[_0x5aa3('0x15')][_0x5aa3('0x16')]()==='out'&&!_0x4dcf7d['secret']&&!_[_0x5aa3('0x17')](_0x4dcf7d[_0x5aa3('0x18')])){_0x2361b1[_0x5aa3('0x19')]['findOne']({'where':{'id':_0x4dcf7d['MailInteractionId']}})[_0x5aa3('0x1a')](function(_0xb0ed76){if(_0xb0ed76){_0xb0ed76[_0x5aa3('0x1b')]({'lastMsgAt':_0x4dcf7d[_0x5aa3('0x1c')],'lastMsgDirection':_0x4dcf7d[_0x5aa3('0x15')]['toLowerCase'](),'lastMsgBody':_0x4dcf7d['body']});}})[_0x5aa3('0x1d')](function(_0x343f91){console[_0x5aa3('0x1e')](_0x343f91);});}_0x27b36a();}},'charset':_0x5aa3('0x1f'),'collate':_0x5aa3('0x20')});}; \ No newline at end of file +var _0x1a10=['toLowerCase','out','isNil','UserId','MailInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString'];(function(_0x498381,_0x122bfc){var _0x7e0ae8=function(_0x5b3414){while(--_0x5b3414){_0x498381['push'](_0x498381['shift']());}};_0x7e0ae8(++_0x122bfc);}(_0x1a10,0xd2));var _0x01a1=function(_0x76fa2,_0x5630d7){_0x76fa2=_0x76fa2-0x0;var _0x4fe756=_0x1a10[_0x76fa2];return _0x4fe756;};'use strict';var _=require(_0x01a1('0x0'));var util=require(_0x01a1('0x1'));var logger=require('../../config/logger')(_0x01a1('0x2'));var moment=require(_0x01a1('0x3'));var BPromise=require(_0x01a1('0x4'));var rp=require(_0x01a1('0x5'));var htmlToText=require(_0x01a1('0x6'));var fs=require('fs');var path=require(_0x01a1('0x7'));var rimraf=require(_0x01a1('0x8'));var config=require(_0x01a1('0x9'));var attributes=require(_0x01a1('0xa'));module[_0x01a1('0xb')]=function(_0x16ffbc,_0x563310){return _0x16ffbc[_0x01a1('0xc')](_0x01a1('0xd'),attributes,{'tableName':_0x01a1('0xe'),'paranoid':![],'indexes':[{'name':_0x01a1('0xf'),'fields':[_0x01a1('0xf')]},{'name':_0x01a1('0x10'),'fields':[_0x01a1('0x11'),_0x01a1('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ab2b2,_0x5ea1e7,_0x13c051){if(_0x3ab2b2[_0x01a1('0x13')]){_0x3ab2b2[_0x01a1('0x11')]=htmlToText[_0x01a1('0x14')](_0x3ab2b2[_0x01a1('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13c051(null,_0x5ea1e7);},'afterCreate':function(_0x30f53a,_0x134424,_0x264242){var _0xd45fad=_0x16ffbc['models'];var _0xfedfba=_0x30f53a['get']({'plain':!![]});if(_0xfedfba['direction'][_0x01a1('0x15')]()==='in'||_0xfedfba['direction']['toLowerCase']()===_0x01a1('0x16')&&!_0xfedfba['secret']&&!_[_0x01a1('0x17')](_0xfedfba[_0x01a1('0x18')])){_0xd45fad[_0x01a1('0x19')][_0x01a1('0x1a')]({'where':{'id':_0xfedfba['MailInteractionId']}})[_0x01a1('0x1b')](function(_0x987aff){if(_0x987aff){_0x987aff[_0x01a1('0x1c')]({'lastMsgAt':_0xfedfba['createdAt'],'lastMsgDirection':_0xfedfba['direction'][_0x01a1('0x15')](),'lastMsgBody':_0xfedfba[_0x01a1('0x13')]});}})[_0x01a1('0x1d')](function(_0x8125b6){console[_0x01a1('0x1e')](_0x8125b6);});}_0x264242();}},'charset':_0x01a1('0x1f'),'collate':_0x01a1('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 81a3001..2203256 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 _0x9303=['request\x20sent','stringify','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug'];(function(_0x369cbe,_0x2c8bda){var _0x280f8f=function(_0x4fe14a){while(--_0x4fe14a){_0x369cbe['push'](_0x369cbe['shift']());}};_0x280f8f(++_0x2c8bda);}(_0x9303,0xd7));var _0x3930=function(_0x1f15bb,_0x4663fb){_0x1f15bb=_0x1f15bb-0x0;var _0x3a49ef=_0x9303[_0x1f15bb];return _0x3a49ef;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3930('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3930('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3930('0x3'))(_0x3930('0x4'));var config=require(_0x3930('0x5'));var jayson=require(_0x3930('0x6'));var client=jayson['client'][_0x3930('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3930('0x8')],{'host':_0x3930('0x9'),'port':0x18eb});var socket=require(_0x3930('0xa'))(new Redis(config[_0x3930('0x8')]));require(_0x3930('0xb'))['register'](socket);function respondWithRpcPromise(_0x5d5aef,_0x104088,_0x5c19e3){return new BPromise(function(_0x5269b3,_0x5503a7){return client[_0x3930('0xc')](_0x5d5aef,_0x5c19e3)[_0x3930('0xd')](function(_0x417b9c){logger[_0x3930('0xe')](_0x3930('0xf'),_0x104088,'request\x20sent');logger[_0x3930('0x10')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x104088,_0x3930('0x11'),JSON[_0x3930('0x12')](_0x417b9c));if(_0x417b9c[_0x3930('0x13')]){if(_0x417b9c['error'][_0x3930('0x14')]===0x1f4){logger[_0x3930('0x13')]('MailMessage,\x20%s,\x20%s',_0x104088,_0x417b9c[_0x3930('0x13')][_0x3930('0x15')]);return _0x5503a7(_0x417b9c[_0x3930('0x13')][_0x3930('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x104088,_0x417b9c[_0x3930('0x13')]['message']);return _0x5269b3(_0x417b9c[_0x3930('0x13')]['message']);}else{logger[_0x3930('0xe')](_0x3930('0xf'),_0x104088,'request\x20sent');_0x5269b3(_0x417b9c['result']['message']);}})[_0x3930('0x16')](function(_0x1462db){logger[_0x3930('0x13')]('MailMessage,\x20%s,\x20%s',_0x104088,_0x1462db);_0x5503a7(_0x1462db);});});}exports['CreateMailMessage']=function(_0x4f4e2e){var _0x5a2501=this;return new Promise(function(_0x3400f5,_0x2ba9ba){return db[_0x3930('0x17')][_0x3930('0x18')](_0x4f4e2e[_0x3930('0x19')],{'raw':_0x4f4e2e['options']?_0x4f4e2e[_0x3930('0x1a')][_0x3930('0x1b')]===undefined?!![]:![]:!![]})[_0x3930('0xd')](function(_0x4a4307){logger[_0x3930('0xe')](_0x3930('0x1c'),_0x4f4e2e);logger[_0x3930('0x10')](_0x3930('0x1c'),_0x4f4e2e,JSON[_0x3930('0x12')](_0x4a4307));_0x3400f5(_0x4a4307);})[_0x3930('0x16')](function(_0x347d7d){logger[_0x3930('0x13')]('CreateMailMessage',_0x347d7d[_0x3930('0x15')],_0x4f4e2e);_0x2ba9ba(_0x5a2501[_0x3930('0x13')](0x1f4,_0x347d7d[_0x3930('0x15')]));});});}; \ No newline at end of file +var _0x677a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','moment','bluebird'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x677a,0xd6));var _0xa677=function(_0x27f87b,_0x52af51){_0x27f87b=_0x27f87b-0x0;var _0x410e0a=_0x677a[_0x27f87b];return _0x410e0a;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});config[_0xa677('0xb')]=_[_0xa677('0xc')](config[_0xa677('0xb')],{'host':_0xa677('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xa677('0xe')](socket);function respondWithRpcPromise(_0x4c9e8c,_0x3e5e2c,_0x1d6586){return new BPromise(function(_0x5d2451,_0xead831){return client[_0xa677('0xf')](_0x4c9e8c,_0x1d6586)[_0xa677('0x10')](function(_0x96f98d){logger['info'](_0xa677('0x11'),_0x3e5e2c,_0xa677('0x12'));logger[_0xa677('0x13')](_0xa677('0x14'),_0x3e5e2c,'request\x20sent',JSON[_0xa677('0x15')](_0x96f98d));if(_0x96f98d['error']){if(_0x96f98d[_0xa677('0x16')][_0xa677('0x17')]===0x1f4){logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);return _0xead831(_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);}logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);return _0x5d2451(_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);}else{logger['info'](_0xa677('0x11'),_0x3e5e2c,_0xa677('0x12'));_0x5d2451(_0x96f98d['result']['message']);}})[_0xa677('0x19')](function(_0x73350){logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x73350);_0xead831(_0x73350);});});}exports['CreateMailMessage']=function(_0x2eab12){var _0x2122ac=this;return new Promise(function(_0xad957e,_0x44de05){return db[_0xa677('0x1a')][_0xa677('0x1b')](_0x2eab12['body'],{'raw':_0x2eab12[_0xa677('0x1c')]?_0x2eab12['options'][_0xa677('0x1d')]===undefined?!![]:![]:!![]})[_0xa677('0x10')](function(_0x45eb0f){logger['info'](_0xa677('0x1e'),_0x2eab12);logger[_0xa677('0x13')](_0xa677('0x1e'),_0x2eab12,JSON[_0xa677('0x15')](_0x45eb0f));_0xad957e(_0x45eb0f);})['catch'](function(_0x1aa82b){logger[_0xa677('0x16')]('CreateMailMessage',_0x1aa82b[_0xa677('0x18')],_0x2eab12);_0x44de05(_0x2122ac[_0xa677('0x16')](0x1f4,_0x1aa82b[_0xa677('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5ca8dea..5c59e15 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 _0x8f9d=['update','emit','removeListener','register','mailMessage:','./mailMessage.events','remove'];(function(_0x281df6,_0x15dc0e){var _0x26c3a4=function(_0x7ccfb){while(--_0x7ccfb){_0x281df6['push'](_0x281df6['shift']());}};_0x26c3a4(++_0x15dc0e);}(_0x8f9d,0x15c));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var MailMessageEvents=require(_0xd8f9('0x0'));var events=['save',_0xd8f9('0x1'),_0xd8f9('0x2')];function createListener(_0x3a8836,_0x4f5115){return function(_0x983c9f){_0x4f5115[_0xd8f9('0x3')](_0x3a8836,_0x983c9f);};}function removeListener(_0x4dd5ec,_0x741d98){return function(){MailMessageEvents[_0xd8f9('0x4')](_0x4dd5ec,_0x741d98);};}exports[_0xd8f9('0x5')]=function(_0x4e4ac2){for(var _0x43b504=0x0,_0x37b181=events['length'];_0x43b504<_0x37b181;_0x43b504++){var _0xf9e9a4=events[_0x43b504];var _0x2ca1ff=createListener(_0xd8f9('0x6')+_0xf9e9a4,_0x4e4ac2);MailMessageEvents['on'](_0xf9e9a4,_0x2ca1ff);}}; \ No newline at end of file +var _0x854a=['register','mailMessage:','./mailMessage.events','save','update','removeListener'];(function(_0x4fd507,_0x375e66){var _0x157917=function(_0xd97dd8){while(--_0xd97dd8){_0x4fd507['push'](_0x4fd507['shift']());}};_0x157917(++_0x375e66);}(_0x854a,0x1e8));var _0xa854=function(_0x39cba9,_0x4e0f68){_0x39cba9=_0x39cba9-0x0;var _0x32a89e=_0x854a[_0x39cba9];return _0x32a89e;};'use strict';var MailMessageEvents=require(_0xa854('0x0'));var events=[_0xa854('0x1'),'remove',_0xa854('0x2')];function createListener(_0xefccb6,_0x4c3191){return function(_0x506d4e){_0x4c3191['emit'](_0xefccb6,_0x506d4e);};}function removeListener(_0x4c912f,_0x540564){return function(){MailMessageEvents[_0xa854('0x3')](_0x4c912f,_0x540564);};}exports[_0xa854('0x4')]=function(_0x10050d){for(var _0x3456f2=0x0,_0x3e26f6=events['length'];_0x3456f2<_0x3e26f6;_0x3456f2++){var _0x55a0cb=events[_0x3456f2];var _0x5150fc=createListener(_0xa854('0x5')+_0x55a0cb,_0x10050d);MailMessageEvents['on'](_0x55a0cb,_0x5150fc);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 83dcc47..fbb55bd 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 _0xd2c1=['get','isAuthenticated','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams','/:id/users','addAgents','put','/:id','update','delete','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0xd2c1,0x117));var _0x1d2c=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0xd2c1[_0x4f6f84];return _0x20d989;};'use strict';var multer=require(_0x1d2c('0x0'));var util=require('util');var path=require(_0x1d2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d2c('0x2'));var router=express[_0x1d2c('0x3')]();var auth=require(_0x1d2c('0x4'));var interaction=require(_0x1d2c('0x5'));var config=require(_0x1d2c('0x6'));var controller=require('./mailQueue.controller');router[_0x1d2c('0x7')]('/',auth[_0x1d2c('0x8')](),controller['index']);router['get'](_0x1d2c('0x9'),auth['isAuthenticated'](),controller[_0x1d2c('0xa')]);router['get']('/:id',auth[_0x1d2c('0x8')](),controller['show']);router['get'](_0x1d2c('0xb'),auth['isAuthenticated'](),controller[_0x1d2c('0xc')]);router[_0x1d2c('0x7')](_0x1d2c('0xd'),auth[_0x1d2c('0x8')](),controller[_0x1d2c('0xe')]);router[_0x1d2c('0x7')]('/:id/users',auth[_0x1d2c('0x8')](),controller['getAgents']);router['post']('/',auth[_0x1d2c('0x8')](),controller[_0x1d2c('0xf')]);router[_0x1d2c('0x10')](_0x1d2c('0xd'),auth[_0x1d2c('0x8')](),controller[_0x1d2c('0x11')]);router[_0x1d2c('0x10')](_0x1d2c('0x12'),auth['isAuthenticated'](),controller[_0x1d2c('0x13')]);router[_0x1d2c('0x14')](_0x1d2c('0x15'),auth[_0x1d2c('0x8')](),controller[_0x1d2c('0x16')]);router[_0x1d2c('0x17')](_0x1d2c('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0x1d2c('0x17')](_0x1d2c('0xd'),auth[_0x1d2c('0x8')](),controller['removeTeams']);router[_0x1d2c('0x17')]('/:id/users',auth[_0x1d2c('0x8')](),controller[_0x1d2c('0x18')]);module[_0x1d2c('0x19')]=router; \ No newline at end of file +var _0x9395=['express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x2ef714,_0x49e1c4){var _0x252ab0=function(_0x868e73){while(--_0x868e73){_0x2ef714['push'](_0x2ef714['shift']());}};_0x252ab0(++_0x49e1c4);}(_0x9395,0x114));var _0x5939=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9395[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5939('0x0'));var util=require(_0x5939('0x1'));var path=require(_0x5939('0x2'));var timeout=require(_0x5939('0x3'));var express=require(_0x5939('0x4'));var router=express[_0x5939('0x5')]();var auth=require(_0x5939('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5939('0x7'));var controller=require('./mailQueue.controller');router[_0x5939('0x8')]('/',auth['isAuthenticated'](),controller[_0x5939('0x9')]);router[_0x5939('0x8')](_0x5939('0xa'),auth[_0x5939('0xb')](),controller['describe']);router[_0x5939('0x8')](_0x5939('0xc'),auth[_0x5939('0xb')](),controller[_0x5939('0xd')]);router[_0x5939('0x8')](_0x5939('0xe'),auth['isAuthenticated'](),controller[_0x5939('0xf')]);router[_0x5939('0x8')](_0x5939('0x10'),auth['isAuthenticated'](),controller[_0x5939('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x5939('0x12')]);router[_0x5939('0x13')]('/',auth[_0x5939('0xb')](),controller['create']);router[_0x5939('0x13')](_0x5939('0x10'),auth[_0x5939('0xb')](),controller['addTeams']);router[_0x5939('0x13')](_0x5939('0x14'),auth[_0x5939('0xb')](),controller[_0x5939('0x15')]);router[_0x5939('0x16')](_0x5939('0xc'),auth[_0x5939('0xb')](),controller[_0x5939('0x17')]);router['delete'](_0x5939('0xc'),auth['isAuthenticated'](),controller[_0x5939('0x18')]);router[_0x5939('0x19')](_0x5939('0x10'),auth[_0x5939('0xb')](),controller[_0x5939('0x1a')]);router['delete'](_0x5939('0x14'),auth[_0x5939('0xb')](),controller['removeAgents']);module[_0x5939('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f1909bf..e856a49 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 _0x5c84=['ENUM','beepall','sequelize','STRING','name','INTEGER'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5c84,0x1ca));var _0x45c8=function(_0xbf6d84,_0x1101bc){_0xbf6d84=_0xbf6d84-0x0;var _0x40c3fe=_0x5c84[_0xbf6d84];return _0x40c3fe;};'use strict';var Sequelize=require(_0x45c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x45c8('0x1')],'unique':_0x45c8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x45c8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45c8('0x4')]('rrmemory',_0x45c8('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x2581=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2581,0xcb));var _0x1258=function(_0x1eab07,_0x2676f5){_0x1eab07=_0x1eab07-0x0;var _0x588016=_0x2581[_0x1eab07];return _0x588016;};'use strict';var Sequelize=require(_0x1258('0x0'));module[_0x1258('0x1')]={'name':{'type':Sequelize[_0x1258('0x2')],'unique':_0x1258('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1258('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1258('0x4')](_0x1258('0x5'),_0x1258('0x6'),_0x1258('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 38208ab..6633dbd 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 _0x793e=['rows','catch','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','describe','getMembers','findOne','UserMailQueue','findAndCountAll','UserId','agent','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','User','Agents','voicePause','flatMap','transaction','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','count','offset','json','apply','update','destroy','then','get','MailQueues','UserProfileResource','end','error','stack','name','send','MailQueue','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll'];(function(_0x5a0d88,_0x2b1805){var _0xb05271=function(_0x28ed36){while(--_0x28ed36){_0x5a0d88['push'](_0x5a0d88['shift']());}};_0xb05271(++_0x2b1805);}(_0x793e,0x13e));var _0xe793=function(_0x4070f8,_0x599ee1){_0x4070f8=_0x4070f8-0x0;var _0x4f1fa6=_0x793e[_0x4070f8];return _0x4f1fa6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe793('0x0'));var rimraf=require(_0xe793('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe793('0x2'));var rp=require(_0xe793('0x3'));var moment=require(_0xe793('0x4'));var BPromise=require(_0xe793('0x5'));var Mustache=require(_0xe793('0x6'));var util=require(_0xe793('0x7'));var path=require(_0xe793('0x8'));var sox=require(_0xe793('0x9'));var csv=require(_0xe793('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe793('0xb'));var squel=require('squel');var crypto=require(_0xe793('0xc'));var jsforce=require(_0xe793('0xd'));var deskjs=require(_0xe793('0xe'));var toCsv=require(_0xe793('0xa'));var querystring=require('querystring');var Papa=require(_0xe793('0xf'));var Redis=require('ioredis');var authService=require(_0xe793('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe793('0x11'));var hardwareService=require(_0xe793('0x12'));var logger=require('../../config/logger')(_0xe793('0x13'));var utils=require('../../config/utils');var config=require(_0xe793('0x14'));var db=require(_0xe793('0x15'))['db'];config['redis']=_['defaults'](config[_0xe793('0x16')],{'host':_0xe793('0x17'),'port':0x18eb});var socket=require(_0xe793('0x18'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xe793('0x19')](socket);function respondWithStatusCode(_0x2f2762,_0xbd4fc0){_0xbd4fc0=_0xbd4fc0||0xcc;return function(_0x352835){if(_0x352835){return _0x2f2762[_0xe793('0x1a')](_0xbd4fc0);}return _0x2f2762[_0xe793('0x1b')](_0xbd4fc0)['end']();};}function respondWithResult(_0x1f2546,_0x5cb695){_0x5cb695=_0x5cb695||0xc8;return function(_0x44b47d){if(_0x44b47d){return _0x1f2546['status'](_0x5cb695)['json'](_0x44b47d);}};}function respondWithFilteredResult(_0x156d1f,_0x161b88){return function(_0x4d83f5){if(_0x4d83f5){var _0x5d268a=_0x4d83f5[_0xe793('0x1c')],_0x1fc24a=_0x161b88[_0xe793('0x1d')],_0x5420c4=_0x161b88['offset']+_0x161b88['limit'],_0x5a83da;if(_0x5420c4>=_0x5d268a){_0x5420c4=_0x5d268a;_0x5a83da=0xc8;}else{_0x5a83da=0xce;}_0x156d1f[_0xe793('0x1b')](_0x5a83da);return _0x156d1f['set']('Content-Range',_0x1fc24a+'-'+_0x5420c4+'/'+_0x5d268a)[_0xe793('0x1e')](_0x4d83f5);}return null;};}function patchUpdates(_0x4ffe43){return function(_0x275b0e){try{jsonpatch[_0xe793('0x1f')](_0x275b0e,_0x4ffe43,!![]);}catch(_0x2551aa){return BPromise['reject'](_0x2551aa);}return _0x275b0e['save']();};}function saveUpdates(_0x540606,_0x43ccc8){return function(_0x420c46){if(_0x420c46){return _0x420c46[_0xe793('0x20')](_0x540606)['then'](function(_0x43a1bb){return _0x43a1bb;});}return null;};}function removeEntity(_0x5ceb76,_0x21733d){return function(_0x31547c){if(_0x31547c){return _0x31547c[_0xe793('0x21')]()[_0xe793('0x22')](function(){var _0x30f166=_0x31547c[_0xe793('0x23')]({'plain':!![]});var _0x53e754=_0xe793('0x24');return db[_0xe793('0x25')][_0xe793('0x21')]({'where':{'type':_0x53e754,'resourceId':_0x30f166['id']}})['then'](function(){return _0x31547c;});})[_0xe793('0x22')](function(){_0x5ceb76['status'](0xcc)[_0xe793('0x26')]();});}};}function handleEntityNotFound(_0x5d16c2,_0x51517a){return function(_0x5ba827){if(!_0x5ba827){_0x5d16c2[_0xe793('0x1a')](0x194);}return _0x5ba827;};}function handleError(_0x10574e,_0x475584){_0x475584=_0x475584||0x1f4;return function(_0xfcb97d){logger[_0xe793('0x27')](_0xfcb97d[_0xe793('0x28')]);if(_0xfcb97d[_0xe793('0x29')]){delete _0xfcb97d[_0xe793('0x29')];}_0x10574e[_0xe793('0x1b')](_0x475584)[_0xe793('0x2a')](_0xfcb97d);};}exports['index']=function(_0x1ece33,_0x41b5fd){var _0x3ab31d={},_0x1ff051={},_0x39c383={'count':0x0,'rows':[]};var _0x19c207=_['map'](db[_0xe793('0x2b')]['rawAttributes'],function(_0x5aa9ad){return{'name':_0x5aa9ad['fieldName'],'type':_0x5aa9ad['type']['key']};});_0x1ff051[_0xe793('0x2c')]=_[_0xe793('0x2d')](_0x19c207,_0xe793('0x29'));_0x1ff051[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x1ece33[_0xe793('0x2e')]);_0x1ff051[_0xe793('0x30')]=_[_0xe793('0x31')](_0x1ff051[_0xe793('0x2c')],_0x1ff051['query']);_0x3ab31d[_0xe793('0x32')]=_[_0xe793('0x31')](_0x1ff051['model'],qs[_0xe793('0x33')](_0x1ece33[_0xe793('0x2e')][_0xe793('0x33')]));_0x3ab31d[_0xe793('0x32')]=_0x3ab31d['attributes'][_0xe793('0x34')]?_0x3ab31d[_0xe793('0x32')]:_0x1ff051[_0xe793('0x2c')];if(!_0x1ece33[_0xe793('0x2e')][_0xe793('0x35')](_0xe793('0x36'))){_0x3ab31d[_0xe793('0x37')]=qs['limit'](_0x1ece33[_0xe793('0x2e')][_0xe793('0x37')]);_0x3ab31d['offset']=qs['offset'](_0x1ece33[_0xe793('0x2e')][_0xe793('0x1d')]);}_0x3ab31d[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x1ece33['query'][_0xe793('0x39')]);_0x3ab31d['where']=qs[_0xe793('0x30')](_[_0xe793('0x3a')](_0x1ece33['query'],_0x1ff051['filters']),_0x19c207);if(_0x1ece33['query'][_0xe793('0x3b')]){_0x3ab31d[_0xe793('0x3c')]=_[_0xe793('0x3d')](_0x3ab31d[_0xe793('0x3c')],{'$or':_[_0xe793('0x2d')](_0x19c207,function(_0x470638){if(_0x470638[_0xe793('0x3e')]!=='VIRTUAL'){var _0x320cd3={};_0x320cd3[_0x470638['name']]={'$like':'%'+_0x1ece33['query'][_0xe793('0x3b')]+'%'};return _0x320cd3;}})});}_0x3ab31d=_[_0xe793('0x3d')]({},_0x3ab31d,_0x1ece33[_0xe793('0x3f')]);var _0x32ced8={'where':_0x3ab31d[_0xe793('0x3c')]};return db[_0xe793('0x2b')][_0xe793('0x1c')](_0x32ced8)[_0xe793('0x22')](function(_0x45fccb){_0x39c383[_0xe793('0x1c')]=_0x45fccb;if(_0x1ece33[_0xe793('0x2e')][_0xe793('0x40')]){_0x3ab31d['include']=[{'all':!![]}];}return db['MailQueue'][_0xe793('0x41')](_0x3ab31d);})[_0xe793('0x22')](function(_0xd859cd){_0x39c383[_0xe793('0x42')]=_0xd859cd;return _0x39c383;})[_0xe793('0x22')](respondWithFilteredResult(_0x41b5fd,_0x3ab31d))[_0xe793('0x43')](handleError(_0x41b5fd,null));};exports['show']=function(_0x2c55a8,_0x4a187f){var _0x1c1dbf={'raw':!![],'where':{'id':_0x2c55a8['params']['id']}},_0x2a3fcc={};_0x2a3fcc['model']=_[_0xe793('0x2f')](db[_0xe793('0x2b')][_0xe793('0x44')]);_0x2a3fcc['query']=_[_0xe793('0x2f')](_0x2c55a8[_0xe793('0x2e')]);_0x2a3fcc['filters']=_[_0xe793('0x31')](_0x2a3fcc['model'],_0x2a3fcc[_0xe793('0x2e')]);_0x1c1dbf['attributes']=_[_0xe793('0x31')](_0x2a3fcc['model'],qs[_0xe793('0x33')](_0x2c55a8[_0xe793('0x2e')][_0xe793('0x33')]));_0x1c1dbf[_0xe793('0x32')]=_0x1c1dbf[_0xe793('0x32')][_0xe793('0x34')]?_0x1c1dbf[_0xe793('0x32')]:_0x2a3fcc[_0xe793('0x2c')];if(_0x2c55a8['query'][_0xe793('0x40')]){_0x1c1dbf['include']=[{'all':!![]}];}_0x1c1dbf=_[_0xe793('0x3d')]({},_0x1c1dbf,_0x2c55a8['options']);return db['MailQueue'][_0xe793('0x45')](_0x1c1dbf)['then'](handleEntityNotFound(_0x4a187f,null))['then'](respondWithResult(_0x4a187f,null))[_0xe793('0x43')](handleError(_0x4a187f,null));};exports[_0xe793('0x46')]=function(_0x50ccbf,_0x218a6c){return db[_0xe793('0x2b')][_0xe793('0x46')](_0x50ccbf['body'],{})['then'](function(_0x24ba8b){var _0x5b0369=_0x50ccbf[_0xe793('0x47')][_0xe793('0x23')]({'plain':!![]});if(!_0x5b0369)throw new Error(_0xe793('0x48'));if(_0x5b0369[_0xe793('0x49')]===_0xe793('0x47')){var _0x189c76=_0x24ba8b[_0xe793('0x23')]({'plain':!![]});var _0x10c1c2=_0xe793('0x24');return db[_0xe793('0x4a')][_0xe793('0x45')]({'where':{'name':_0x10c1c2,'userProfileId':_0x5b0369[_0xe793('0x4b')]},'raw':!![]})[_0xe793('0x22')](function(_0x4f2192){if(_0x4f2192&&_0x4f2192['autoAssociation']===0x0){return db[_0xe793('0x25')][_0xe793('0x46')]({'name':_0x189c76['name'],'resourceId':_0x189c76['id'],'type':_0x4f2192['name'],'sectionId':_0x4f2192['id']},{})[_0xe793('0x22')](function(){return _0x24ba8b;});}else{return _0x24ba8b;}})['catch'](function(_0x29fc72){logger[_0xe793('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29fc72);throw _0x29fc72;});}return _0x24ba8b;})['then'](respondWithResult(_0x218a6c,0xc9))[_0xe793('0x43')](handleError(_0x218a6c,null));};exports['update']=function(_0x30f4f4,_0x2f7758){if(_0x30f4f4['body']['id']){delete _0x30f4f4[_0xe793('0x4c')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x30f4f4[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x2f7758,null))[_0xe793('0x22')](saveUpdates(_0x30f4f4[_0xe793('0x4c')],null))[_0xe793('0x22')](respondWithResult(_0x2f7758,null))['catch'](handleError(_0x2f7758,null));};exports[_0xe793('0x21')]=function(_0x13df16,_0x3b604f){return db[_0xe793('0x2b')][_0xe793('0x45')]({'where':{'id':_0x13df16[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x3b604f,null))[_0xe793('0x22')](removeEntity(_0x3b604f,null))['catch'](handleError(_0x3b604f,null));};exports[_0xe793('0x4e')]=function(_0x1cf715,_0x2a3970){return db[_0xe793('0x2b')][_0xe793('0x4e')]()[_0xe793('0x22')](respondWithResult(_0x2a3970,null))[_0xe793('0x43')](handleError(_0x2a3970,null));};exports[_0xe793('0x4f')]=function(_0x1b96af,_0x5c58ba,_0x2b6c67){var _0x4415ad={'raw':!![],'where':{}},_0x3f49c1={},_0x27a0fe;return db[_0xe793('0x2b')][_0xe793('0x50')]({'where':{'id':_0x1b96af[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x5c58ba,null))[_0xe793('0x22')](function(_0xd690a1){if(_0xd690a1){_0x27a0fe=_0xd690a1[_0xe793('0x23')]({'plain':!![]});_0x3f49c1[_0xe793('0x2c')]=_[_0xe793('0x2f')](db[_0xe793('0x51')][_0xe793('0x44')]);_0x3f49c1[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x1b96af[_0xe793('0x2e')]);_0x3f49c1[_0xe793('0x30')]=_[_0xe793('0x31')](_0x3f49c1[_0xe793('0x2c')],_0x3f49c1[_0xe793('0x2e')]);_0x4415ad[_0xe793('0x32')]=_[_0xe793('0x31')](_0x3f49c1[_0xe793('0x2c')],qs[_0xe793('0x33')](_0x1b96af[_0xe793('0x2e')][_0xe793('0x33')]));_0x4415ad[_0xe793('0x32')]=_0x4415ad[_0xe793('0x32')][_0xe793('0x34')]?_0x4415ad[_0xe793('0x32')]:_0x3f49c1[_0xe793('0x2c')];if(!_0x1b96af['query'][_0xe793('0x35')](_0xe793('0x36'))){_0x4415ad[_0xe793('0x37')]=qs[_0xe793('0x37')](_0x1b96af[_0xe793('0x2e')][_0xe793('0x37')]);_0x4415ad[_0xe793('0x1d')]=qs[_0xe793('0x1d')](_0x1b96af['query'][_0xe793('0x1d')]);}_0x4415ad[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x1b96af[_0xe793('0x2e')]['sort']);_0x4415ad[_0xe793('0x3c')]=qs[_0xe793('0x30')](_[_0xe793('0x3a')](_0x1b96af[_0xe793('0x2e')],_0x3f49c1[_0xe793('0x30')]));_0x4415ad[_0xe793('0x3c')]['MailQueueId']=_0xd690a1['id'];if(_0x1b96af[_0xe793('0x2e')][_0xe793('0x3b')]){_0x4415ad['where']=_[_0xe793('0x3d')](_0x4415ad[_0xe793('0x3c')],{'$or':_['map'](_0x4415ad[_0xe793('0x32')],function(_0x476847){var _0xb85ca3={};_0xb85ca3[_0x476847]={'$like':'%'+_0x1b96af['query'][_0xe793('0x3b')]+'%'};return _0xb85ca3;})});}_0x4415ad=_[_0xe793('0x3d')]({},_0x4415ad,_0x1b96af[_0xe793('0x3f')]);return db[_0xe793('0x51')][_0xe793('0x41')](_0x4415ad);}})['then'](function(_0x71df4e){if(_0x71df4e){return db['User'][_0xe793('0x52')]({'where':{'id':_[_0xe793('0x2d')](_0x71df4e,_0xe793('0x53')),'role':_0xe793('0x54')},'attributes':['id',_0xe793('0x29'),'mailPause','updatedAt','createdAt']});}})[_0xe793('0x22')](function(_0x1fbc76){if(_0x1fbc76){return{'count':_0x1fbc76[_0xe793('0x1c')],'rows':_['map'](_0x1fbc76['rows'],function(_0x247486){return{'membername':_0x247486['name'],'UserId':_0x247486['id'],'queue_name':_0x27a0fe['name'],'MailQueueId':_0x27a0fe['id'],'interface':util[_0xe793('0x55')](_0xe793('0x56'),_0xe793('0x57'),_0x247486[_0xe793('0x29')]),'penalty':0x0,'paused':_0x247486['mailPause'],'createdAt':_0x247486[_0xe793('0x58')],'updatedAt':_0x247486['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe793('0x22')](respondWithFilteredResult(_0x5c58ba,_0x4415ad))[_0xe793('0x43')](handleError(_0x5c58ba,null));};exports['getTeams']=function(_0x3a2e22,_0x5f5d82,_0x11bb7e){var _0x41ec46={};var _0x481090={};var _0x429fac;var _0x3b3064;return db['MailQueue'][_0xe793('0x50')]({'where':{'id':_0x3a2e22['params']['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x5f5d82,null))[_0xe793('0x22')](function(_0x289dfa){if(_0x289dfa){_0x429fac=_0x289dfa;_0x481090[_0xe793('0x2c')]=_[_0xe793('0x2f')](db[_0xe793('0x59')][_0xe793('0x44')]);_0x481090[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x3a2e22['query']);_0x481090['filters']=_[_0xe793('0x31')](_0x481090['model'],_0x481090[_0xe793('0x2e')]);_0x41ec46[_0xe793('0x32')]=_[_0xe793('0x31')](_0x481090['model'],qs['fields'](_0x3a2e22[_0xe793('0x2e')][_0xe793('0x33')]));_0x41ec46[_0xe793('0x32')]=_0x41ec46[_0xe793('0x32')][_0xe793('0x34')]?_0x41ec46['attributes']:_0x481090[_0xe793('0x2c')];_0x41ec46[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x3a2e22[_0xe793('0x2e')][_0xe793('0x39')]);_0x41ec46['where']=qs['filters'](_['pick'](_0x3a2e22[_0xe793('0x2e')],_0x481090[_0xe793('0x30')]));if(_0x3a2e22[_0xe793('0x2e')][_0xe793('0x3b')]){_0x41ec46[_0xe793('0x3c')]=_[_0xe793('0x3d')](_0x41ec46['where'],{'$or':_[_0xe793('0x2d')](_0x41ec46['attributes'],function(_0x155c78){var _0x1f5ef9={};_0x1f5ef9[_0x155c78]={'$like':'%'+_0x3a2e22[_0xe793('0x2e')]['filter']+'%'};return _0x1f5ef9;})});}_0x41ec46=_[_0xe793('0x3d')]({},_0x41ec46,_0x3a2e22[_0xe793('0x3f')]);return _0x429fac['getTeams'](_0x41ec46);}})[_0xe793('0x22')](function(_0x4edaf4){if(_0x4edaf4){_0x3b3064=_0x4edaf4[_0xe793('0x34')];if(!_0x3a2e22['query']['hasOwnProperty'](_0xe793('0x36'))){_0x41ec46[_0xe793('0x37')]=qs[_0xe793('0x37')](_0x3a2e22[_0xe793('0x2e')]['limit']);_0x41ec46['offset']=qs[_0xe793('0x1d')](_0x3a2e22[_0xe793('0x2e')][_0xe793('0x1d')]);}return _0x429fac[_0xe793('0x5a')](_0x41ec46);}})['then'](function(_0x1ef4fd){if(_0x1ef4fd){return _0x1ef4fd?{'count':_0x3b3064,'rows':_0x1ef4fd}:null;}})[_0xe793('0x22')](respondWithResult(_0x5f5d82,null))[_0xe793('0x43')](handleError(_0x5f5d82,null));};exports[_0xe793('0x5b')]=function(_0x215ef5,_0x1a730b,_0x551dc8){var _0x481e41=_0x215ef5['body']['ids'];return db[_0xe793('0x59')][_0xe793('0x41')]({'where':{'id':_0x481e41},'attributes':['id'],'include':[{'model':db[_0xe793('0x5c')],'as':_0xe793('0x5d'),'attributes':['id',_0xe793('0x29'),'online',_0xe793('0x5e'),'interface'],'raw':!![]}]})[_0xe793('0x22')](function(_0x4fa725){if(_0x4fa725){var _0x2bd932=_[_0xe793('0x5f')](_0x4fa725,function(_0x3fe7cd){var _0x2c6bb0=_0x3fe7cd['get']({'plain':!![]});return _0x2c6bb0[_0xe793('0x5d')];});return db[_0xe793('0x2b')]['find']({'where':{'id':_0x215ef5['params']['id']}})[_0xe793('0x22')](function(_0xfd0b84){return db['sequelize'][_0xe793('0x60')](function(_0x218fcb){return _0xfd0b84[_0xe793('0x5b')](_0x481e41,{'transaction':_0x218fcb})[_0xe793('0x22')](function(){return BPromise['each'](_0x2bd932,function(_0x1c0b3a){return db[_0xe793('0x51')][_0xe793('0x61')]({'where':{'UserId':_0x1c0b3a['id'],'MailQueueId':_0x215ef5['params']['id']},'transaction':_0x218fcb});});})[_0xe793('0x22')](function(){_0x2bd932['forEach'](function(_0x8df66e){socket[_0xe793('0x62')](_0xe793('0x63'),{'UserId':_0x8df66e['id'],'MailQueueId':_0xfd0b84['id']});});});});});}})[_0xe793('0x22')](respondWithStatusCode(_0x1a730b,null))[_0xe793('0x43')](handleError(_0x1a730b,null));};exports[_0xe793('0x64')]=function(_0x32e914,_0x326f9a,_0x532125){return db['Team'][_0xe793('0x41')]({'where':{'id':_0x32e914['query'][_0xe793('0x65')]},'attributes':['id'],'include':[{'model':db[_0xe793('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe793('0x22')](handleEntityNotFound(_0x326f9a,null))[_0xe793('0x22')](function(_0x32d3ea){var _0x6c4f99=_[_0xe793('0x2d')](_0x32d3ea,'id');var _0x1cf966=[];var _0x12d639=[];var _0x38620f=squel[_0xe793('0x66')]();_0x38620f[_0xe793('0x67')]('tq.TeamId')[_0xe793('0x68')](_0xe793('0x69'),'tq')[_0xe793('0x6a')]('user_has_teams','ut',_0xe793('0x6b'))['where'](_0xe793('0x6c'),_0x32e914[_0xe793('0x4d')]['id']);for(var _0x28d9f5=0x0;_0x28d9f5<_0x32d3ea['length'];_0x28d9f5+=0x1){let _0x351350=_0x32d3ea[_0x28d9f5];for(var _0x4b1b42=0x0;_0x4b1b42<_0x351350['Agents'][_0xe793('0x34')];_0x4b1b42+=0x1){let _0x16ae79=_0x351350['Agents'][_0x4b1b42];var _0x75f8ae=_0x38620f['clone']();_0x75f8ae[_0xe793('0x3c')](_0xe793('0x6d'),_0x16ae79['id']);_0x12d639[_0xe793('0x6e')](db[_0xe793('0x6f')][_0xe793('0x2e')](_0x75f8ae[_0xe793('0x70')](),{'type':db[_0xe793('0x6f')][_0xe793('0x71')][_0xe793('0x72')]})[_0xe793('0x22')](function(_0x2042bd){if(_0x2042bd[_0xe793('0x34')]===0x1){return _0x16ae79['id'];}else{var _0x9192d4=_['every'](_[_0xe793('0x2d')](_0x2042bd,_0xe793('0x73')),function(_0x5f5a97){return _[_0xe793('0x74')](_0x6c4f99,_0x5f5a97);});if(_0x9192d4){return _0x16ae79['id'];}}}));}}return BPromise[_0xe793('0x75')](_0x12d639)[_0xe793('0x22')](function(_0xaddd01){_0x1cf966=_(_0x1cf966)[_0xe793('0x76')](_0xaddd01)[_0xe793('0x77')]()[_0xe793('0x78')]();return db[_0xe793('0x2b')][_0xe793('0x45')]({'where':{'id':_0x32e914['params']['id']}})[_0xe793('0x22')](function(_0xd32706){return db[_0xe793('0x6f')]['transaction'](function(_0x5b8ad7){return _0xd32706['removeTeams'](_0x32e914[_0xe793('0x2e')][_0xe793('0x65')],{'transaction':_0x5b8ad7})[_0xe793('0x22')](function(){if(!_[_0xe793('0x79')](_0x1cf966)){return _0xd32706[_0xe793('0x7a')](_0x1cf966,{'transaction':_0x5b8ad7});}})[_0xe793('0x22')](function(){_0x1cf966['forEach'](function(_0x1dc85a){socket[_0xe793('0x62')]('userMailQueue:remove',{'UserId':_0x1dc85a,'MailQueueId':_0xd32706['id']});});});});});});})[_0xe793('0x22')](respondWithStatusCode(_0x326f9a,null))[_0xe793('0x43')](handleError(_0x326f9a,null));};exports['addAgents']=function(_0x116992,_0x1560ff,_0x5b11e3){return db['MailQueue'][_0xe793('0x45')]({'where':{'id':_0x116992[_0xe793('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1560ff,null))['then'](function(_0x1dd0e4){if(_0x1dd0e4){return _0x1dd0e4[_0xe793('0x7b')](_0x116992['body']['ids'],_[_0xe793('0x7c')](_0x116992[_0xe793('0x4c')],[_0xe793('0x65'),'id'])||{})[_0xe793('0x7d')](function(_0xe03759){for(var _0x59eb16=0x0;_0x59eb16<_0x116992[_0xe793('0x4c')][_0xe793('0x65')][_0xe793('0x34')];_0x59eb16+=0x1){socket[_0xe793('0x62')](_0xe793('0x63'),{'UserId':_0x116992[_0xe793('0x4c')]['ids'][_0x59eb16],'MailQueueId':_0x116992['params']['id']});}return _0xe03759;});}})[_0xe793('0x22')](respondWithResult(_0x1560ff,null))['catch'](handleError(_0x1560ff,null));};exports[_0xe793('0x7a')]=function(_0x4f5681,_0x238383,_0x5da35f){return db[_0xe793('0x2b')][_0xe793('0x45')]({'where':{'id':_0x4f5681[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x238383,null))[_0xe793('0x22')](function(_0xa5505f){if(_0xa5505f){return _0xa5505f['removeAgents'](_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')])[_0xe793('0x22')](function(){if(_[_0xe793('0x7e')](_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')])){for(var _0x2aa911=0x0;_0x2aa911<_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')][_0xe793('0x34')];_0x2aa911+=0x1){socket[_0xe793('0x62')]('userMailQueue:remove',{'UserId':Number(_0x4f5681[_0xe793('0x2e')][_0xe793('0x65')][_0x2aa911]),'MailQueueId':Number(_0x4f5681[_0xe793('0x4d')]['id'])});}}else{socket[_0xe793('0x62')]('userMailQueue:remove',{'UserId':Number(_0x4f5681['query'][_0xe793('0x65')]),'MailQueueId':Number(_0x4f5681[_0xe793('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x238383,null))[_0xe793('0x43')](handleError(_0x238383,null));};exports['getAgents']=function(_0x46d2c7,_0x3502a0,_0x469837){var _0x4a74c3={};var _0x30f3d1={};var _0xe0e44a;var _0x3a46b8;return db[_0xe793('0x2b')][_0xe793('0x50')]({'where':{'id':_0x46d2c7[_0xe793('0x4d')]['id']}})[_0xe793('0x22')](handleEntityNotFound(_0x3502a0,null))[_0xe793('0x22')](function(_0x3a07d0){if(_0x3a07d0){_0xe0e44a=_0x3a07d0;_0x30f3d1[_0xe793('0x2c')]=_[_0xe793('0x2f')](db[_0xe793('0x5c')][_0xe793('0x44')]);_0x30f3d1[_0xe793('0x2e')]=_[_0xe793('0x2f')](_0x46d2c7[_0xe793('0x2e')]);_0x30f3d1[_0xe793('0x30')]=_['intersection'](_0x30f3d1[_0xe793('0x2c')],_0x30f3d1[_0xe793('0x2e')]);_0x4a74c3[_0xe793('0x32')]=_[_0xe793('0x31')](_0x30f3d1['model'],qs[_0xe793('0x33')](_0x46d2c7[_0xe793('0x2e')][_0xe793('0x33')]));_0x4a74c3[_0xe793('0x32')]=_0x4a74c3[_0xe793('0x32')]['length']?_0x4a74c3['attributes']:_0x30f3d1[_0xe793('0x2c')];_0x4a74c3[_0xe793('0x38')]=qs[_0xe793('0x39')](_0x46d2c7[_0xe793('0x2e')]['sort']);_0x4a74c3[_0xe793('0x3c')]=qs['filters'](_['pick'](_0x46d2c7[_0xe793('0x2e')],_0x30f3d1[_0xe793('0x30')]));if(_0x46d2c7['query'][_0xe793('0x3b')]){_0x4a74c3[_0xe793('0x3c')]=_[_0xe793('0x3d')](_0x4a74c3[_0xe793('0x3c')],{'$or':_['map'](_0x4a74c3[_0xe793('0x32')],function(_0x27725a){var _0x7fb2bb={};_0x7fb2bb[_0x27725a]={'$like':'%'+_0x46d2c7[_0xe793('0x2e')][_0xe793('0x3b')]+'%'};return _0x7fb2bb;})});}_0x4a74c3=_[_0xe793('0x3d')]({},_0x4a74c3,_0x46d2c7[_0xe793('0x3f')]);return _0xe0e44a[_0xe793('0x7f')](_0x4a74c3);}})[_0xe793('0x22')](function(_0x1d221d){if(_0x1d221d){_0x3a46b8=_0x1d221d[_0xe793('0x34')];if(!_0x46d2c7['query']['hasOwnProperty'](_0xe793('0x36'))){_0x4a74c3['limit']=qs[_0xe793('0x37')](_0x46d2c7['query'][_0xe793('0x37')]);_0x4a74c3[_0xe793('0x1d')]=qs[_0xe793('0x1d')](_0x46d2c7[_0xe793('0x2e')][_0xe793('0x1d')]);}return _0xe0e44a[_0xe793('0x7f')](_0x4a74c3);}})['then'](function(_0x494c4c){if(_0x494c4c){return _0x494c4c?{'count':_0x3a46b8,'rows':_0x494c4c}:null;}})['then'](respondWithResult(_0x3502a0,null))['catch'](handleError(_0x3502a0,null));}; \ No newline at end of file +var _0x07e3=['send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','MailQueue','includeAll','include','findAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','order','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','MailQueues','UserProfileResource','end','error','stack','name'];(function(_0xb23bfe,_0x54c0ce){var _0xe3d28e=function(_0x44e000){while(--_0x44e000){_0xb23bfe['push'](_0xb23bfe['shift']());}};_0xe3d28e(++_0x54c0ce);}(_0x07e3,0xed));var _0x307e=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x07e3[_0xbe40ad];return _0x50fac9;};'use strict';var pdf=require(_0x307e('0x0'));var emlformat=require(_0x307e('0x1'));var rimraf=require(_0x307e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x307e('0x3'));var rp=require(_0x307e('0x4'));var moment=require(_0x307e('0x5'));var BPromise=require(_0x307e('0x6'));var Mustache=require(_0x307e('0x7'));var util=require(_0x307e('0x8'));var path=require(_0x307e('0x9'));var sox=require('sox');var csv=require(_0x307e('0xa'));var ejs=require(_0x307e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x307e('0xc'));var crypto=require('crypto');var jsforce=require(_0x307e('0xd'));var deskjs=require(_0x307e('0xe'));var toCsv=require(_0x307e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x307e('0xf'));var authService=require(_0x307e('0x10'));var qs=require(_0x307e('0x11'));var as=require(_0x307e('0x12'));var hardwareService=require(_0x307e('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x307e('0x14'));var db=require(_0x307e('0x15'))['db'];config[_0x307e('0x16')]=_[_0x307e('0x17')](config[_0x307e('0x16')],{'host':_0x307e('0x18'),'port':0x18eb});var socket=require(_0x307e('0x19'))(new Redis(config[_0x307e('0x16')]));require(_0x307e('0x1a'))[_0x307e('0x1b')](socket);function respondWithStatusCode(_0x111b90,_0x55a7b9){_0x55a7b9=_0x55a7b9||0xcc;return function(_0x54f861){if(_0x54f861){return _0x111b90[_0x307e('0x1c')](_0x55a7b9);}return _0x111b90['status'](_0x55a7b9)['end']();};}function respondWithResult(_0xd79bd4,_0x22317b){_0x22317b=_0x22317b||0xc8;return function(_0x5f0c8c){if(_0x5f0c8c){return _0xd79bd4[_0x307e('0x1d')](_0x22317b)['json'](_0x5f0c8c);}};}function respondWithFilteredResult(_0x3756cb,_0x4de828){return function(_0x4a7f8e){if(_0x4a7f8e){var _0xb5906e=_0x4a7f8e[_0x307e('0x1e')],_0x12e3f7=_0x4de828['offset'],_0x4ee549=_0x4de828[_0x307e('0x1f')]+_0x4de828[_0x307e('0x20')],_0x57ad10;if(_0x4ee549>=_0xb5906e){_0x4ee549=_0xb5906e;_0x57ad10=0xc8;}else{_0x57ad10=0xce;}_0x3756cb[_0x307e('0x1d')](_0x57ad10);return _0x3756cb[_0x307e('0x21')](_0x307e('0x22'),_0x12e3f7+'-'+_0x4ee549+'/'+_0xb5906e)[_0x307e('0x23')](_0x4a7f8e);}return null;};}function patchUpdates(_0x8fe150){return function(_0x5b2981){try{jsonpatch['apply'](_0x5b2981,_0x8fe150,!![]);}catch(_0x299a38){return BPromise[_0x307e('0x24')](_0x299a38);}return _0x5b2981[_0x307e('0x25')]();};}function saveUpdates(_0x268c79,_0x2d388){return function(_0x28ed9d){if(_0x28ed9d){return _0x28ed9d[_0x307e('0x26')](_0x268c79)[_0x307e('0x27')](function(_0x32c97e){return _0x32c97e;});}return null;};}function removeEntity(_0x6929c0,_0xba9bc){return function(_0x22e614){if(_0x22e614){return _0x22e614[_0x307e('0x28')]()['then'](function(){var _0x334f8f=_0x22e614['get']({'plain':!![]});var _0x39a44c=_0x307e('0x29');return db[_0x307e('0x2a')][_0x307e('0x28')]({'where':{'type':_0x39a44c,'resourceId':_0x334f8f['id']}})[_0x307e('0x27')](function(){return _0x22e614;});})['then'](function(){_0x6929c0['status'](0xcc)[_0x307e('0x2b')]();});}};}function handleEntityNotFound(_0x27c6bb,_0x7f88a1){return function(_0x2d2e9c){if(!_0x2d2e9c){_0x27c6bb['sendStatus'](0x194);}return _0x2d2e9c;};}function handleError(_0x32393b,_0x56b9c5){_0x56b9c5=_0x56b9c5||0x1f4;return function(_0x3725b6){logger[_0x307e('0x2c')](_0x3725b6[_0x307e('0x2d')]);if(_0x3725b6[_0x307e('0x2e')]){delete _0x3725b6[_0x307e('0x2e')];}_0x32393b['status'](_0x56b9c5)[_0x307e('0x2f')](_0x3725b6);};}exports['index']=function(_0x2fc146,_0x6cff33){var _0x5e9755={},_0x18b7bc={},_0x1de137={'count':0x0,'rows':[]};var _0x42b02c=_[_0x307e('0x30')](db['MailQueue'][_0x307e('0x31')],function(_0x43b95c){return{'name':_0x43b95c[_0x307e('0x32')],'type':_0x43b95c['type'][_0x307e('0x33')]};});_0x18b7bc[_0x307e('0x34')]=_['map'](_0x42b02c,_0x307e('0x2e'));_0x18b7bc['query']=_[_0x307e('0x35')](_0x2fc146[_0x307e('0x36')]);_0x18b7bc[_0x307e('0x37')]=_[_0x307e('0x38')](_0x18b7bc[_0x307e('0x34')],_0x18b7bc[_0x307e('0x36')]);_0x5e9755['attributes']=_['intersection'](_0x18b7bc[_0x307e('0x34')],qs[_0x307e('0x39')](_0x2fc146['query'][_0x307e('0x39')]));_0x5e9755[_0x307e('0x3a')]=_0x5e9755[_0x307e('0x3a')][_0x307e('0x3b')]?_0x5e9755[_0x307e('0x3a')]:_0x18b7bc[_0x307e('0x34')];if(!_0x2fc146[_0x307e('0x36')][_0x307e('0x3c')](_0x307e('0x3d'))){_0x5e9755['limit']=qs[_0x307e('0x20')](_0x2fc146['query'][_0x307e('0x20')]);_0x5e9755[_0x307e('0x1f')]=qs[_0x307e('0x1f')](_0x2fc146[_0x307e('0x36')]['offset']);}_0x5e9755['order']=qs['sort'](_0x2fc146[_0x307e('0x36')][_0x307e('0x3e')]);_0x5e9755[_0x307e('0x3f')]=qs[_0x307e('0x37')](_['pick'](_0x2fc146[_0x307e('0x36')],_0x18b7bc[_0x307e('0x37')]),_0x42b02c);if(_0x2fc146[_0x307e('0x36')][_0x307e('0x40')]){_0x5e9755['where']=_['merge'](_0x5e9755[_0x307e('0x3f')],{'$or':_[_0x307e('0x30')](_0x42b02c,function(_0x27af77){if(_0x27af77['type']!=='VIRTUAL'){var _0x3ec956={};_0x3ec956[_0x27af77['name']]={'$like':'%'+_0x2fc146[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0x3ec956;}})});}_0x5e9755=_[_0x307e('0x41')]({},_0x5e9755,_0x2fc146[_0x307e('0x42')]);var _0x50cc4c={'where':_0x5e9755[_0x307e('0x3f')]};return db[_0x307e('0x43')]['count'](_0x50cc4c)[_0x307e('0x27')](function(_0x3d3a38){_0x1de137[_0x307e('0x1e')]=_0x3d3a38;if(_0x2fc146[_0x307e('0x36')][_0x307e('0x44')]){_0x5e9755[_0x307e('0x45')]=[{'all':!![]}];}return db[_0x307e('0x43')][_0x307e('0x46')](_0x5e9755);})[_0x307e('0x27')](function(_0x4ffe7c){_0x1de137[_0x307e('0x47')]=_0x4ffe7c;return _0x1de137;})[_0x307e('0x27')](respondWithFilteredResult(_0x6cff33,_0x5e9755))[_0x307e('0x48')](handleError(_0x6cff33,null));};exports[_0x307e('0x49')]=function(_0x550ffc,_0x1682fb){var _0xdcb384={'raw':!![],'where':{'id':_0x550ffc['params']['id']}},_0x228ac3={};_0x228ac3[_0x307e('0x34')]=_[_0x307e('0x35')](db[_0x307e('0x43')][_0x307e('0x31')]);_0x228ac3[_0x307e('0x36')]=_['keys'](_0x550ffc[_0x307e('0x36')]);_0x228ac3[_0x307e('0x37')]=_['intersection'](_0x228ac3[_0x307e('0x34')],_0x228ac3[_0x307e('0x36')]);_0xdcb384[_0x307e('0x3a')]=_['intersection'](_0x228ac3[_0x307e('0x34')],qs[_0x307e('0x39')](_0x550ffc[_0x307e('0x36')]['fields']));_0xdcb384[_0x307e('0x3a')]=_0xdcb384[_0x307e('0x3a')][_0x307e('0x3b')]?_0xdcb384[_0x307e('0x3a')]:_0x228ac3['model'];if(_0x550ffc['query'][_0x307e('0x44')]){_0xdcb384[_0x307e('0x45')]=[{'all':!![]}];}_0xdcb384=_[_0x307e('0x41')]({},_0xdcb384,_0x550ffc[_0x307e('0x42')]);return db[_0x307e('0x43')][_0x307e('0x4a')](_0xdcb384)[_0x307e('0x27')](handleEntityNotFound(_0x1682fb,null))[_0x307e('0x27')](respondWithResult(_0x1682fb,null))[_0x307e('0x48')](handleError(_0x1682fb,null));};exports[_0x307e('0x4b')]=function(_0x43ddaf,_0x482fa4){return db[_0x307e('0x43')][_0x307e('0x4b')](_0x43ddaf[_0x307e('0x4c')],{})[_0x307e('0x27')](function(_0x44c280){var _0x96b75f=_0x43ddaf['user'][_0x307e('0x4d')]({'plain':!![]});if(!_0x96b75f)throw new Error(_0x307e('0x4e'));if(_0x96b75f[_0x307e('0x4f')]===_0x307e('0x50')){var _0x104ef7=_0x44c280[_0x307e('0x4d')]({'plain':!![]});var _0xd6dd70=_0x307e('0x29');return db[_0x307e('0x51')][_0x307e('0x4a')]({'where':{'name':_0xd6dd70,'userProfileId':_0x96b75f['userProfileId']},'raw':!![]})[_0x307e('0x27')](function(_0x2d8a87){if(_0x2d8a87&&_0x2d8a87[_0x307e('0x52')]===0x0){return db[_0x307e('0x2a')]['create']({'name':_0x104ef7[_0x307e('0x2e')],'resourceId':_0x104ef7['id'],'type':_0x2d8a87['name'],'sectionId':_0x2d8a87['id']},{})['then'](function(){return _0x44c280;});}else{return _0x44c280;}})[_0x307e('0x48')](function(_0xc87b29){logger[_0x307e('0x2c')](_0x307e('0x53'),_0xc87b29);throw _0xc87b29;});}return _0x44c280;})[_0x307e('0x27')](respondWithResult(_0x482fa4,0xc9))[_0x307e('0x48')](handleError(_0x482fa4,null));};exports[_0x307e('0x26')]=function(_0x2b50b9,_0xee601c){if(_0x2b50b9['body']['id']){delete _0x2b50b9['body']['id'];}return db['MailQueue'][_0x307e('0x4a')]({'where':{'id':_0x2b50b9[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0xee601c,null))[_0x307e('0x27')](saveUpdates(_0x2b50b9[_0x307e('0x4c')],null))[_0x307e('0x27')](respondWithResult(_0xee601c,null))['catch'](handleError(_0xee601c,null));};exports[_0x307e('0x28')]=function(_0x337ba8,_0x188999){return db['MailQueue'][_0x307e('0x4a')]({'where':{'id':_0x337ba8[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x188999,null))['then'](removeEntity(_0x188999,null))['catch'](handleError(_0x188999,null));};exports[_0x307e('0x55')]=function(_0xb843a9,_0x43d163){return db[_0x307e('0x43')][_0x307e('0x55')]()['then'](respondWithResult(_0x43d163,null))[_0x307e('0x48')](handleError(_0x43d163,null));};exports['getMembers']=function(_0x94ee1b,_0x19b86e,_0x2cee4f){var _0x6e0f39={'raw':!![],'where':{}},_0x5ab580={},_0x10fb34;return db[_0x307e('0x43')][_0x307e('0x56')]({'where':{'id':_0x94ee1b['params']['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x19b86e,null))[_0x307e('0x27')](function(_0x40fb97){if(_0x40fb97){_0x10fb34=_0x40fb97[_0x307e('0x4d')]({'plain':!![]});_0x5ab580['model']=_[_0x307e('0x35')](db[_0x307e('0x57')]['rawAttributes']);_0x5ab580[_0x307e('0x36')]=_[_0x307e('0x35')](_0x94ee1b['query']);_0x5ab580[_0x307e('0x37')]=_[_0x307e('0x38')](_0x5ab580[_0x307e('0x34')],_0x5ab580[_0x307e('0x36')]);_0x6e0f39[_0x307e('0x3a')]=_[_0x307e('0x38')](_0x5ab580[_0x307e('0x34')],qs[_0x307e('0x39')](_0x94ee1b[_0x307e('0x36')]['fields']));_0x6e0f39['attributes']=_0x6e0f39[_0x307e('0x3a')]['length']?_0x6e0f39[_0x307e('0x3a')]:_0x5ab580[_0x307e('0x34')];if(!_0x94ee1b['query'][_0x307e('0x3c')](_0x307e('0x3d'))){_0x6e0f39[_0x307e('0x20')]=qs[_0x307e('0x20')](_0x94ee1b['query'][_0x307e('0x20')]);_0x6e0f39[_0x307e('0x1f')]=qs['offset'](_0x94ee1b[_0x307e('0x36')]['offset']);}_0x6e0f39['order']=qs['sort'](_0x94ee1b[_0x307e('0x36')][_0x307e('0x3e')]);_0x6e0f39[_0x307e('0x3f')]=qs['filters'](_['pick'](_0x94ee1b['query'],_0x5ab580[_0x307e('0x37')]));_0x6e0f39[_0x307e('0x3f')][_0x307e('0x58')]=_0x40fb97['id'];if(_0x94ee1b[_0x307e('0x36')][_0x307e('0x40')]){_0x6e0f39[_0x307e('0x3f')]=_[_0x307e('0x41')](_0x6e0f39[_0x307e('0x3f')],{'$or':_[_0x307e('0x30')](_0x6e0f39[_0x307e('0x3a')],function(_0x402d77){var _0x53d5f7={};_0x53d5f7[_0x402d77]={'$like':'%'+_0x94ee1b[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0x53d5f7;})});}_0x6e0f39=_['merge']({},_0x6e0f39,_0x94ee1b[_0x307e('0x42')]);return db[_0x307e('0x57')][_0x307e('0x46')](_0x6e0f39);}})[_0x307e('0x27')](function(_0x471091){if(_0x471091){return db[_0x307e('0x59')][_0x307e('0x5a')]({'where':{'id':_[_0x307e('0x30')](_0x471091,_0x307e('0x5b')),'role':'agent'},'attributes':['id',_0x307e('0x2e'),_0x307e('0x5c'),'updatedAt',_0x307e('0x5d')]});}})[_0x307e('0x27')](function(_0x206c93){if(_0x206c93){return{'count':_0x206c93[_0x307e('0x1e')],'rows':_[_0x307e('0x30')](_0x206c93[_0x307e('0x47')],function(_0x31149d){return{'membername':_0x31149d[_0x307e('0x2e')],'UserId':_0x31149d['id'],'queue_name':_0x10fb34[_0x307e('0x2e')],'MailQueueId':_0x10fb34['id'],'interface':util[_0x307e('0x5e')](_0x307e('0x5f'),_0x307e('0x60'),_0x31149d['name']),'penalty':0x0,'paused':_0x31149d[_0x307e('0x5c')],'createdAt':_0x31149d[_0x307e('0x5d')],'updatedAt':_0x31149d[_0x307e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x307e('0x27')](respondWithFilteredResult(_0x19b86e,_0x6e0f39))[_0x307e('0x48')](handleError(_0x19b86e,null));};exports[_0x307e('0x62')]=function(_0x5a2ef0,_0x2b4489,_0x2de5ba){var _0x449322={};var _0x3290f1={};var _0x1b4ec2;var _0x1406dc;return db['MailQueue'][_0x307e('0x56')]({'where':{'id':_0x5a2ef0[_0x307e('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b4489,null))[_0x307e('0x27')](function(_0x87e700){if(_0x87e700){_0x1b4ec2=_0x87e700;_0x3290f1['model']=_[_0x307e('0x35')](db[_0x307e('0x63')][_0x307e('0x31')]);_0x3290f1[_0x307e('0x36')]=_['keys'](_0x5a2ef0[_0x307e('0x36')]);_0x3290f1[_0x307e('0x37')]=_['intersection'](_0x3290f1[_0x307e('0x34')],_0x3290f1[_0x307e('0x36')]);_0x449322['attributes']=_['intersection'](_0x3290f1[_0x307e('0x34')],qs[_0x307e('0x39')](_0x5a2ef0[_0x307e('0x36')][_0x307e('0x39')]));_0x449322[_0x307e('0x3a')]=_0x449322[_0x307e('0x3a')]['length']?_0x449322[_0x307e('0x3a')]:_0x3290f1[_0x307e('0x34')];_0x449322[_0x307e('0x64')]=qs[_0x307e('0x3e')](_0x5a2ef0[_0x307e('0x36')][_0x307e('0x3e')]);_0x449322['where']=qs[_0x307e('0x37')](_[_0x307e('0x65')](_0x5a2ef0[_0x307e('0x36')],_0x3290f1['filters']));if(_0x5a2ef0[_0x307e('0x36')][_0x307e('0x40')]){_0x449322['where']=_[_0x307e('0x41')](_0x449322[_0x307e('0x3f')],{'$or':_[_0x307e('0x30')](_0x449322[_0x307e('0x3a')],function(_0x181af6){var _0xf3e75a={};_0xf3e75a[_0x181af6]={'$like':'%'+_0x5a2ef0[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0xf3e75a;})});}_0x449322=_['merge']({},_0x449322,_0x5a2ef0[_0x307e('0x42')]);return _0x1b4ec2['getTeams'](_0x449322);}})['then'](function(_0xe038c4){if(_0xe038c4){_0x1406dc=_0xe038c4[_0x307e('0x3b')];if(!_0x5a2ef0[_0x307e('0x36')][_0x307e('0x3c')](_0x307e('0x3d'))){_0x449322['limit']=qs['limit'](_0x5a2ef0[_0x307e('0x36')]['limit']);_0x449322['offset']=qs[_0x307e('0x1f')](_0x5a2ef0['query'][_0x307e('0x1f')]);}return _0x1b4ec2['getTeams'](_0x449322);}})[_0x307e('0x27')](function(_0x2e5514){if(_0x2e5514){return _0x2e5514?{'count':_0x1406dc,'rows':_0x2e5514}:null;}})[_0x307e('0x27')](respondWithResult(_0x2b4489,null))[_0x307e('0x48')](handleError(_0x2b4489,null));};exports[_0x307e('0x66')]=function(_0x3c72f1,_0x5e0efb,_0x59196b){var _0x5280ed=_0x3c72f1['body'][_0x307e('0x67')];return db[_0x307e('0x63')][_0x307e('0x46')]({'where':{'id':_0x5280ed},'attributes':['id'],'include':[{'model':db[_0x307e('0x59')],'as':_0x307e('0x68'),'attributes':['id',_0x307e('0x2e'),_0x307e('0x69'),_0x307e('0x6a'),_0x307e('0x6b')],'raw':!![]}]})[_0x307e('0x27')](function(_0x41501b){if(_0x41501b){var _0x1ec90c=_[_0x307e('0x6c')](_0x41501b,function(_0xee6f60){var _0x2f8e04=_0xee6f60['get']({'plain':!![]});return _0x2f8e04[_0x307e('0x68')];});return db[_0x307e('0x43')][_0x307e('0x4a')]({'where':{'id':_0x3c72f1[_0x307e('0x54')]['id']}})[_0x307e('0x27')](function(_0x58e0f3){return db[_0x307e('0x6d')][_0x307e('0x6e')](function(_0x467dc4){return _0x58e0f3[_0x307e('0x66')](_0x5280ed,{'transaction':_0x467dc4})[_0x307e('0x27')](function(){return BPromise[_0x307e('0x6f')](_0x1ec90c,function(_0x19fcba){return db[_0x307e('0x57')][_0x307e('0x70')]({'where':{'UserId':_0x19fcba['id'],'MailQueueId':_0x3c72f1[_0x307e('0x54')]['id']},'transaction':_0x467dc4});});})['then'](function(){_0x1ec90c[_0x307e('0x71')](function(_0x65359c){socket[_0x307e('0x72')](_0x307e('0x73'),{'UserId':_0x65359c['id'],'MailQueueId':_0x58e0f3['id']});});});});});}})[_0x307e('0x27')](respondWithStatusCode(_0x5e0efb,null))[_0x307e('0x48')](handleError(_0x5e0efb,null));};exports['removeTeams']=function(_0x2f40a1,_0x373857,_0x644d5c){return db[_0x307e('0x63')][_0x307e('0x46')]({'where':{'id':_0x2f40a1[_0x307e('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x307e('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x307e('0x27')](handleEntityNotFound(_0x373857,null))[_0x307e('0x27')](function(_0x1fb4b7){var _0x3a3ede=_[_0x307e('0x30')](_0x1fb4b7,'id');var _0x360d8e=[];var _0x56b382=[];var _0x30076e=squel[_0x307e('0x74')]();_0x30076e[_0x307e('0x75')](_0x307e('0x76'))[_0x307e('0x77')]('team_has_mail_queues','tq')[_0x307e('0x78')](_0x307e('0x79'),'ut',_0x307e('0x7a'))[_0x307e('0x3f')](_0x307e('0x7b'),_0x2f40a1[_0x307e('0x54')]['id']);for(var _0xa2c38b=0x0;_0xa2c38b<_0x1fb4b7['length'];_0xa2c38b+=0x1){let _0x141b19=_0x1fb4b7[_0xa2c38b];for(var _0x5752fa=0x0;_0x5752fa<_0x141b19['Agents'][_0x307e('0x3b')];_0x5752fa+=0x1){let _0x2621a9=_0x141b19[_0x307e('0x68')][_0x5752fa];var _0x46ef58=_0x30076e[_0x307e('0x7c')]();_0x46ef58['where'](_0x307e('0x7d'),_0x2621a9['id']);_0x56b382[_0x307e('0x7e')](db['sequelize']['query'](_0x46ef58['toString'](),{'type':db['sequelize'][_0x307e('0x7f')]['SELECT']})[_0x307e('0x27')](function(_0x45e07f){if(_0x45e07f[_0x307e('0x3b')]===0x1){return _0x2621a9['id'];}else{var _0x320200=_[_0x307e('0x80')](_['map'](_0x45e07f,_0x307e('0x81')),function(_0x1d0307){return _[_0x307e('0x82')](_0x3a3ede,_0x1d0307);});if(_0x320200){return _0x2621a9['id'];}}}));}}return BPromise[_0x307e('0x83')](_0x56b382)['then'](function(_0x37da29){_0x360d8e=_(_0x360d8e)[_0x307e('0x84')](_0x37da29)['compact']()[_0x307e('0x85')]();return db[_0x307e('0x43')][_0x307e('0x4a')]({'where':{'id':_0x2f40a1['params']['id']}})['then'](function(_0x411a33){return db[_0x307e('0x6d')][_0x307e('0x6e')](function(_0x3c01c4){return _0x411a33[_0x307e('0x86')](_0x2f40a1[_0x307e('0x36')][_0x307e('0x67')],{'transaction':_0x3c01c4})[_0x307e('0x27')](function(){if(!_[_0x307e('0x87')](_0x360d8e)){return _0x411a33['removeAgents'](_0x360d8e,{'transaction':_0x3c01c4});}})['then'](function(){_0x360d8e[_0x307e('0x71')](function(_0x1790a3){socket['emit'](_0x307e('0x88'),{'UserId':_0x1790a3,'MailQueueId':_0x411a33['id']});});});});});});})[_0x307e('0x27')](respondWithStatusCode(_0x373857,null))[_0x307e('0x48')](handleError(_0x373857,null));};exports[_0x307e('0x89')]=function(_0x49c906,_0x4a100e,_0xacd01b){return db[_0x307e('0x43')][_0x307e('0x4a')]({'where':{'id':_0x49c906[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x4a100e,null))[_0x307e('0x27')](function(_0x2922f9){if(_0x2922f9){return _0x2922f9[_0x307e('0x89')](_0x49c906['body'][_0x307e('0x67')],_[_0x307e('0x8a')](_0x49c906[_0x307e('0x4c')],[_0x307e('0x67'),'id'])||{})[_0x307e('0x8b')](function(_0x396b53){for(var _0x85503b=0x0;_0x85503b<_0x49c906[_0x307e('0x4c')][_0x307e('0x67')][_0x307e('0x3b')];_0x85503b+=0x1){socket[_0x307e('0x72')](_0x307e('0x73'),{'UserId':_0x49c906['body'][_0x307e('0x67')][_0x85503b],'MailQueueId':_0x49c906['params']['id']});}return _0x396b53;});}})[_0x307e('0x27')](respondWithResult(_0x4a100e,null))[_0x307e('0x48')](handleError(_0x4a100e,null));};exports[_0x307e('0x8c')]=function(_0x4e7d87,_0x39e8e3,_0x1db384){return db['MailQueue'][_0x307e('0x4a')]({'where':{'id':_0x4e7d87[_0x307e('0x54')]['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x39e8e3,null))[_0x307e('0x27')](function(_0x3a3bff){if(_0x3a3bff){return _0x3a3bff[_0x307e('0x8c')](_0x4e7d87[_0x307e('0x36')]['ids'])[_0x307e('0x27')](function(){if(_['isArray'](_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')])){for(var _0x5602c3=0x0;_0x5602c3<_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')][_0x307e('0x3b')];_0x5602c3+=0x1){socket[_0x307e('0x72')](_0x307e('0x88'),{'UserId':Number(_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')][_0x5602c3]),'MailQueueId':Number(_0x4e7d87[_0x307e('0x54')]['id'])});}}else{socket['emit'](_0x307e('0x88'),{'UserId':Number(_0x4e7d87[_0x307e('0x36')][_0x307e('0x67')]),'MailQueueId':Number(_0x4e7d87['params']['id'])});}});}})[_0x307e('0x27')](respondWithStatusCode(_0x39e8e3,null))['catch'](handleError(_0x39e8e3,null));};exports[_0x307e('0x8d')]=function(_0x206765,_0x388704,_0x10578b){var _0x2bc164={};var _0x2cba80={};var _0x5a7e11;var _0x3a5e7d;return db[_0x307e('0x43')]['findOne']({'where':{'id':_0x206765['params']['id']}})[_0x307e('0x27')](handleEntityNotFound(_0x388704,null))[_0x307e('0x27')](function(_0x373b70){if(_0x373b70){_0x5a7e11=_0x373b70;_0x2cba80[_0x307e('0x34')]=_['keys'](db[_0x307e('0x59')][_0x307e('0x31')]);_0x2cba80[_0x307e('0x36')]=_[_0x307e('0x35')](_0x206765[_0x307e('0x36')]);_0x2cba80[_0x307e('0x37')]=_[_0x307e('0x38')](_0x2cba80[_0x307e('0x34')],_0x2cba80['query']);_0x2bc164['attributes']=_[_0x307e('0x38')](_0x2cba80[_0x307e('0x34')],qs['fields'](_0x206765[_0x307e('0x36')]['fields']));_0x2bc164['attributes']=_0x2bc164[_0x307e('0x3a')]['length']?_0x2bc164[_0x307e('0x3a')]:_0x2cba80[_0x307e('0x34')];_0x2bc164[_0x307e('0x64')]=qs[_0x307e('0x3e')](_0x206765['query'][_0x307e('0x3e')]);_0x2bc164['where']=qs[_0x307e('0x37')](_['pick'](_0x206765[_0x307e('0x36')],_0x2cba80[_0x307e('0x37')]));if(_0x206765['query'][_0x307e('0x40')]){_0x2bc164[_0x307e('0x3f')]=_[_0x307e('0x41')](_0x2bc164['where'],{'$or':_['map'](_0x2bc164[_0x307e('0x3a')],function(_0x4e3de1){var _0x10a4a2={};_0x10a4a2[_0x4e3de1]={'$like':'%'+_0x206765[_0x307e('0x36')][_0x307e('0x40')]+'%'};return _0x10a4a2;})});}_0x2bc164=_[_0x307e('0x41')]({},_0x2bc164,_0x206765['options']);return _0x5a7e11[_0x307e('0x8d')](_0x2bc164);}})[_0x307e('0x27')](function(_0x30a990){if(_0x30a990){_0x3a5e7d=_0x30a990[_0x307e('0x3b')];if(!_0x206765[_0x307e('0x36')]['hasOwnProperty'](_0x307e('0x3d'))){_0x2bc164[_0x307e('0x20')]=qs['limit'](_0x206765['query'][_0x307e('0x20')]);_0x2bc164[_0x307e('0x1f')]=qs['offset'](_0x206765[_0x307e('0x36')][_0x307e('0x1f')]);}return _0x5a7e11[_0x307e('0x8d')](_0x2bc164);}})[_0x307e('0x27')](function(_0x15bee){if(_0x15bee){return _0x15bee?{'count':_0x3a5e7d,'rows':_0x15bee}:null;}})['then'](respondWithResult(_0x388704,null))[_0x307e('0x48')](handleError(_0x388704,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d6517d6..53b98ef 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 _0xc8ac=['exports','events','../../mysqldb','save','emit','hook'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc8ac,0xc1));var _0xcc8a=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xc8ac[_0x163742];return _0x1152ac;};'use strict';var EventEmitter=require(_0xcc8a('0x0'));var MailQueue=require(_0xcc8a('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc8a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46bdd9){return function(_0x1eba39,_0x22d493,_0x1c4e24){MailQueueEvents[_0xcc8a('0x3')](_0x46bdd9+':'+_0x1eba39['id'],_0x1eba39);MailQueueEvents[_0xcc8a('0x3')](_0x46bdd9,_0x1eba39);_0x1c4e24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xcc8a('0x4')](e,emitEvent(event));}}module[_0xcc8a('0x5')]=MailQueueEvents; \ No newline at end of file +var _0x1a65=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x1fcf1b,_0x214549){var _0x5d2952=function(_0x3331b7){while(--_0x3331b7){_0x1fcf1b['push'](_0x1fcf1b['shift']());}};_0x5d2952(++_0x214549);}(_0x1a65,0x151));var _0x51a6=function(_0x242369,_0x4b570b){_0x242369=_0x242369-0x0;var _0x28a5df=_0x1a65[_0x242369];return _0x28a5df;};'use strict';var EventEmitter=require(_0x51a6('0x0'));var MailQueue=require(_0x51a6('0x1'))['db'][_0x51a6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x51a6('0x3')](0x0);var events={'afterCreate':_0x51a6('0x4'),'afterUpdate':'update','afterDestroy':_0x51a6('0x5')};function emitEvent(_0x5a283c){return function(_0x1c4935,_0x3cc2d9,_0x566c3c){MailQueueEvents['emit'](_0x5a283c+':'+_0x1c4935['id'],_0x1c4935);MailQueueEvents[_0x51a6('0x6')](_0x5a283c,_0x1c4935);_0x566c3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x51a6('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f4b8298..9923425 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 _0x65e6=['path','rimraf','../../config/environment','./mailQueue.attributes','mail_queues','util','api','bluebird','request-promise'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x65e6,0x95));var _0x665e=function(_0x58ce95,_0x39c441){_0x58ce95=_0x58ce95-0x0;var _0x1a8d47=_0x65e6[_0x58ce95];return _0x1a8d47;};'use strict';var _=require('lodash');var util=require(_0x665e('0x0'));var logger=require('../../config/logger')(_0x665e('0x1'));var moment=require('moment');var BPromise=require(_0x665e('0x2'));var rp=require(_0x665e('0x3'));var fs=require('fs');var path=require(_0x665e('0x4'));var rimraf=require(_0x665e('0x5'));var config=require(_0x665e('0x6'));var attributes=require(_0x665e('0x7'));module['exports']=function(_0x1508c3,_0x26b375){return _0x1508c3['define']('MailQueue',attributes,{'tableName':_0x665e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x779c=['MailQueue','mail_queues','lodash','moment','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0x779c,0x89));var _0xc779=function(_0x19bc01,_0x4fb8a7){_0x19bc01=_0x19bc01-0x0;var _0x414097=_0x779c[_0x19bc01];return _0x414097;};'use strict';var _=require(_0xc779('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc779('0x1'));var BPromise=require('bluebird');var rp=require(_0xc779('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc779('0x3'));var config=require(_0xc779('0x4'));var attributes=require(_0xc779('0x5'));module[_0xc779('0x6')]=function(_0x2522ee,_0x2952d5){return _0x2522ee['define'](_0xc779('0x7'),attributes,{'tableName':_0xc779('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 21883e7..7f55f1a 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 _0x1db0=['map','catch','ShowMailQueue','find','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1db0,0x107));var _0x01db=function(_0x5377a1,_0x22e1e4){_0x5377a1=_0x5377a1-0x0;var _0x45ff6f=_0x1db0[_0x5377a1];return _0x45ff6f;};'use strict';var _=require('lodash');var util=require(_0x01db('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01db('0x1'));var db=require(_0x01db('0x2'))['db'];var utils=require(_0x01db('0x3'));var logger=require(_0x01db('0x4'))(_0x01db('0x5'));var config=require('../../config/environment');var jayson=require(_0x01db('0x6'));var client=jayson[_0x01db('0x7')][_0x01db('0x8')]({'port':0x232a});config[_0x01db('0x9')]=_[_0x01db('0xa')](config[_0x01db('0x9')],{'host':_0x01db('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01db('0x9')]));require(_0x01db('0xc'))[_0x01db('0xd')](socket);function respondWithRpcPromise(_0x26c340,_0x390865,_0x39e280){return new BPromise(function(_0x83ee42,_0x50a735){return client['request'](_0x26c340,_0x39e280)[_0x01db('0xe')](function(_0x3dfad0){logger['info'](_0x01db('0xf'),_0x390865,'request\x20sent');logger[_0x01db('0x10')](_0x01db('0x11'),_0x390865,_0x01db('0x12'),JSON[_0x01db('0x13')](_0x3dfad0));if(_0x3dfad0['error']){if(_0x3dfad0[_0x01db('0x14')][_0x01db('0x15')]===0x1f4){logger[_0x01db('0x14')](_0x01db('0xf'),_0x390865,_0x3dfad0[_0x01db('0x14')][_0x01db('0x16')]);return _0x50a735(_0x3dfad0[_0x01db('0x14')]['message']);}logger['error'](_0x01db('0xf'),_0x390865,_0x3dfad0[_0x01db('0x14')]['message']);return _0x83ee42(_0x3dfad0[_0x01db('0x14')][_0x01db('0x16')]);}else{logger[_0x01db('0x17')](_0x01db('0xf'),_0x390865,'request\x20sent');_0x83ee42(_0x3dfad0['result'][_0x01db('0x16')]);}})['catch'](function(_0x534d4f){logger['error'](_0x01db('0xf'),_0x390865,_0x534d4f);_0x50a735(_0x534d4f);});});}exports[_0x01db('0x18')]=function(_0x17300e){var _0x20858b=this;return new Promise(function(_0x2e59a3,_0x4c1aff){return db[_0x01db('0x19')]['findAll']({'raw':_0x17300e[_0x01db('0x1a')]?_0x17300e[_0x01db('0x1a')][_0x01db('0x1b')]===undefined?!![]:![]:!![],'where':_0x17300e['options']?_0x17300e[_0x01db('0x1a')][_0x01db('0x1c')]||null:null,'attributes':_0x17300e[_0x01db('0x1a')]?_0x17300e[_0x01db('0x1a')][_0x01db('0x1d')]||null:null,'limit':_0x17300e[_0x01db('0x1a')]?_0x17300e[_0x01db('0x1a')][_0x01db('0x1e')]||null:null,'include':_0x17300e[_0x01db('0x1a')]?_0x17300e['options'][_0x01db('0x1f')]?_['map'](_0x17300e[_0x01db('0x1a')][_0x01db('0x1f')],function(_0x319d3e){return{'model':db[_0x319d3e[_0x01db('0x20')]],'as':_0x319d3e['as'],'attributes':_0x319d3e[_0x01db('0x1d')],'include':_0x319d3e[_0x01db('0x1f')]?_[_0x01db('0x21')](_0x319d3e[_0x01db('0x1f')],function(_0x5dfdda){return{'model':db[_0x5dfdda[_0x01db('0x20')]],'as':_0x5dfdda['as'],'attributes':_0x5dfdda[_0x01db('0x1d')],'include':_0x5dfdda[_0x01db('0x1f')]?_[_0x01db('0x21')](_0x5dfdda['include'],function(_0x3959a8){return{'model':db[_0x3959a8[_0x01db('0x20')]],'as':_0x3959a8['as'],'attributes':_0x3959a8[_0x01db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x01db('0xe')](function(_0x474c40){logger['info'](_0x01db('0x18'),_0x17300e);logger[_0x01db('0x10')]('GetMailQueue',_0x17300e,JSON['stringify'](_0x474c40));_0x2e59a3(_0x474c40);})[_0x01db('0x22')](function(_0x33d616){logger[_0x01db('0x14')]('GetMailQueue',_0x33d616[_0x01db('0x16')],_0x17300e);_0x4c1aff(_0x20858b[_0x01db('0x14')](0x1f4,_0x33d616[_0x01db('0x16')]));});});};exports[_0x01db('0x23')]=function(_0x4d806f){var _0x54430f=this;return new Promise(function(_0x391553,_0x1fcae8){return db[_0x01db('0x19')][_0x01db('0x24')]({'raw':_0x4d806f['options']?_0x4d806f['options'][_0x01db('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d806f[_0x01db('0x1a')]?_0x4d806f[_0x01db('0x1a')][_0x01db('0x1c')]||null:null,'attributes':_0x4d806f[_0x01db('0x1a')]?_0x4d806f[_0x01db('0x1a')][_0x01db('0x1d')]||null:null,'include':_0x4d806f[_0x01db('0x1a')]?_0x4d806f[_0x01db('0x1a')][_0x01db('0x1f')]?_[_0x01db('0x21')](_0x4d806f[_0x01db('0x1a')][_0x01db('0x1f')],function(_0x5698b0){return{'model':db[_0x5698b0[_0x01db('0x20')]],'as':_0x5698b0['as'],'attributes':_0x5698b0[_0x01db('0x1d')],'include':_0x5698b0[_0x01db('0x1f')]?_[_0x01db('0x21')](_0x5698b0[_0x01db('0x1f')],function(_0x59c67f){return{'model':db[_0x59c67f[_0x01db('0x20')]],'as':_0x59c67f['as'],'attributes':_0x59c67f[_0x01db('0x1d')],'include':_0x59c67f[_0x01db('0x1f')]?_['map'](_0x59c67f['include'],function(_0x36a623){return{'model':db[_0x36a623[_0x01db('0x20')]],'as':_0x36a623['as'],'attributes':_0x36a623[_0x01db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x01db('0xe')](function(_0x162b11){logger[_0x01db('0x17')](_0x01db('0x23'),_0x4d806f);logger['debug'](_0x01db('0x23'),_0x4d806f,JSON[_0x01db('0x13')](_0x162b11));_0x391553(_0x162b11);})[_0x01db('0x22')](function(_0x365396){logger[_0x01db('0x14')](_0x01db('0x23'),_0x365396['message'],_0x4d806f);_0x1fcae8(_0x54430f[_0x01db('0x14')](0x1f4,_0x365396['message']));});});}; \ No newline at end of file +var _0x7c1c=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','map','include','model','attributes','stringify','ShowMailQueue','then','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xc9b988,_0x429150){var _0x5f14fe=function(_0x5c76a8){while(--_0x5c76a8){_0xc9b988['push'](_0xc9b988['shift']());}};_0x5f14fe(++_0x429150);}(_0x7c1c,0xe4));var _0xc7c1=function(_0x220419,_0x16987b){_0x220419=_0x220419-0x0;var _0x494842=_0x7c1c[_0x220419];return _0x494842;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7c1('0x0'));var BPromise=require(_0xc7c1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7c1('0x3'));var logger=require(_0xc7c1('0x4'))(_0xc7c1('0x5'));var config=require(_0xc7c1('0x6'));var jayson=require(_0xc7c1('0x7'));var client=jayson[_0xc7c1('0x8')][_0xc7c1('0x9')]({'port':0x232a});config[_0xc7c1('0xa')]=_[_0xc7c1('0xb')](config['redis'],{'host':_0xc7c1('0xc'),'port':0x18eb});var socket=require(_0xc7c1('0xd'))(new Redis(config[_0xc7c1('0xa')]));require('./mailQueue.socket')[_0xc7c1('0xe')](socket);function respondWithRpcPromise(_0x4afdda,_0xce349c,_0x465647){return new BPromise(function(_0x28470c,_0x34e052){return client[_0xc7c1('0xf')](_0x4afdda,_0x465647)['then'](function(_0x348592){logger[_0xc7c1('0x10')](_0xc7c1('0x11'),_0xce349c,'request\x20sent');logger[_0xc7c1('0x12')](_0xc7c1('0x13'),_0xce349c,_0xc7c1('0x14'),JSON['stringify'](_0x348592));if(_0x348592['error']){if(_0x348592[_0xc7c1('0x15')][_0xc7c1('0x16')]===0x1f4){logger[_0xc7c1('0x15')]('MailQueue,\x20%s,\x20%s',_0xce349c,_0x348592[_0xc7c1('0x15')][_0xc7c1('0x17')]);return _0x34e052(_0x348592['error'][_0xc7c1('0x17')]);}logger[_0xc7c1('0x15')]('MailQueue,\x20%s,\x20%s',_0xce349c,_0x348592[_0xc7c1('0x15')]['message']);return _0x28470c(_0x348592[_0xc7c1('0x15')][_0xc7c1('0x17')]);}else{logger[_0xc7c1('0x10')]('MailQueue,\x20%s,\x20%s',_0xce349c,'request\x20sent');_0x28470c(_0x348592[_0xc7c1('0x18')][_0xc7c1('0x17')]);}})[_0xc7c1('0x19')](function(_0x3966a9){logger[_0xc7c1('0x15')](_0xc7c1('0x11'),_0xce349c,_0x3966a9);_0x34e052(_0x3966a9);});});}exports[_0xc7c1('0x1a')]=function(_0x1462f9){var _0xa1fbff=this;return new Promise(function(_0x2a683a,_0x268ac8){return db[_0xc7c1('0x1b')]['findAll']({'raw':_0x1462f9[_0xc7c1('0x1c')]?_0x1462f9[_0xc7c1('0x1c')][_0xc7c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x1462f9['options']?_0x1462f9[_0xc7c1('0x1c')][_0xc7c1('0x1e')]||null:null,'attributes':_0x1462f9[_0xc7c1('0x1c')]?_0x1462f9[_0xc7c1('0x1c')]['attributes']||null:null,'limit':_0x1462f9['options']?_0x1462f9['options'][_0xc7c1('0x1f')]||null:null,'include':_0x1462f9[_0xc7c1('0x1c')]?_0x1462f9['options']['include']?_[_0xc7c1('0x20')](_0x1462f9[_0xc7c1('0x1c')][_0xc7c1('0x21')],function(_0x3937a9){return{'model':db[_0x3937a9[_0xc7c1('0x22')]],'as':_0x3937a9['as'],'attributes':_0x3937a9[_0xc7c1('0x23')],'include':_0x3937a9[_0xc7c1('0x21')]?_[_0xc7c1('0x20')](_0x3937a9[_0xc7c1('0x21')],function(_0x1adb46){return{'model':db[_0x1adb46['model']],'as':_0x1adb46['as'],'attributes':_0x1adb46[_0xc7c1('0x23')],'include':_0x1adb46[_0xc7c1('0x21')]?_[_0xc7c1('0x20')](_0x1adb46[_0xc7c1('0x21')],function(_0x2213f6){return{'model':db[_0x2213f6['model']],'as':_0x2213f6['as'],'attributes':_0x2213f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49cc10){logger['info'](_0xc7c1('0x1a'),_0x1462f9);logger[_0xc7c1('0x12')](_0xc7c1('0x1a'),_0x1462f9,JSON[_0xc7c1('0x24')](_0x49cc10));_0x2a683a(_0x49cc10);})[_0xc7c1('0x19')](function(_0x474442){logger[_0xc7c1('0x15')](_0xc7c1('0x1a'),_0x474442[_0xc7c1('0x17')],_0x1462f9);_0x268ac8(_0xa1fbff[_0xc7c1('0x15')](0x1f4,_0x474442[_0xc7c1('0x17')]));});});};exports[_0xc7c1('0x25')]=function(_0x11c6ab){var _0x81e8ee=this;return new Promise(function(_0xd44a0c,_0x28c7cb){return db['MailQueue']['find']({'raw':_0x11c6ab[_0xc7c1('0x1c')]?_0x11c6ab[_0xc7c1('0x1c')][_0xc7c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x11c6ab['options']?_0x11c6ab['options']['where']||null:null,'attributes':_0x11c6ab[_0xc7c1('0x1c')]?_0x11c6ab[_0xc7c1('0x1c')][_0xc7c1('0x23')]||null:null,'include':_0x11c6ab[_0xc7c1('0x1c')]?_0x11c6ab['options'][_0xc7c1('0x21')]?_[_0xc7c1('0x20')](_0x11c6ab[_0xc7c1('0x1c')]['include'],function(_0x6a903d){return{'model':db[_0x6a903d[_0xc7c1('0x22')]],'as':_0x6a903d['as'],'attributes':_0x6a903d['attributes'],'include':_0x6a903d[_0xc7c1('0x21')]?_['map'](_0x6a903d[_0xc7c1('0x21')],function(_0x14539f){return{'model':db[_0x14539f['model']],'as':_0x14539f['as'],'attributes':_0x14539f[_0xc7c1('0x23')],'include':_0x14539f['include']?_[_0xc7c1('0x20')](_0x14539f[_0xc7c1('0x21')],function(_0x132b51){return{'model':db[_0x132b51[_0xc7c1('0x22')]],'as':_0x132b51['as'],'attributes':_0x132b51[_0xc7c1('0x23')]};}):[]};}):[]};}):[]:[]})[_0xc7c1('0x26')](function(_0x323731){logger[_0xc7c1('0x10')]('ShowMailQueue',_0x11c6ab);logger[_0xc7c1('0x12')]('ShowMailQueue',_0x11c6ab,JSON[_0xc7c1('0x24')](_0x323731));_0xd44a0c(_0x323731);})[_0xc7c1('0x19')](function(_0xc7e99c){logger[_0xc7c1('0x15')]('ShowMailQueue',_0xc7e99c[_0xc7c1('0x17')],_0x11c6ab);_0x28c7cb(_0x81e8ee[_0xc7c1('0x15')](0x1f4,_0xc7e99c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b4872b0..aced34e 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 _0x697a=['length','./mailQueue.events','remove','update','register'];(function(_0x4292c1,_0x4c13a8){var _0x184785=function(_0x4b3ded){while(--_0x4b3ded){_0x4292c1['push'](_0x4292c1['shift']());}};_0x184785(++_0x4c13a8);}(_0x697a,0x123));var _0xa697=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x697a[_0x373dee];return _0x46798f;};'use strict';var MailQueueEvents=require(_0xa697('0x0'));var events=['save',_0xa697('0x1'),_0xa697('0x2')];function createListener(_0x558668,_0x1bfe7d){return function(_0x2f4664){_0x1bfe7d['emit'](_0x558668,_0x2f4664);};}function removeListener(_0x1d18d7,_0x3ca944){return function(){MailQueueEvents['removeListener'](_0x1d18d7,_0x3ca944);};}exports[_0xa697('0x3')]=function(_0x4bf982){for(var _0x1eb651=0x0,_0x22f393=events[_0xa697('0x4')];_0x1eb651<_0x22f393;_0x1eb651++){var _0x2c733a=events[_0x1eb651];var _0xfd7c5a=createListener('mailQueue:'+_0x2c733a,_0x4bf982);MailQueueEvents['on'](_0x2c733a,_0xfd7c5a);}}; \ No newline at end of file +var _0x76c3=['update','removeListener','save'];(function(_0x647697,_0x19c2fa){var _0x38521f=function(_0x47c563){while(--_0x47c563){_0x647697['push'](_0x647697['shift']());}};_0x38521f(++_0x19c2fa);}(_0x76c3,0xd7));var _0x376c=function(_0x381999,_0xec65f){_0x381999=_0x381999-0x0;var _0x51e118=_0x76c3[_0x381999];return _0x51e118;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x376c('0x0'),'remove',_0x376c('0x1')];function createListener(_0x310b58,_0x16e363){return function(_0x541862){_0x16e363['emit'](_0x310b58,_0x541862);};}function removeListener(_0x2bcb5b,_0x16104b){return function(){MailQueueEvents[_0x376c('0x2')](_0x2bcb5b,_0x16104b);};}exports['register']=function(_0x4a04e9){for(var _0x135c98=0x0,_0xaaadef=events['length'];_0x135c98<_0xaaadef;_0x135c98++){var _0x5a157d=events[_0x135c98];var _0x51698d=createListener('mailQueue:'+_0x5a157d,_0x4a04e9);MailQueueEvents['on'](_0x5a157d,_0x51698d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3e912f7..e849c20 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 _0xdd83=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','post'];(function(_0x50d2db,_0x47481f){var _0x1c7e27=function(_0x1f669d){while(--_0x1f669d){_0x50d2db['push'](_0x50d2db['shift']());}};_0x1c7e27(++_0x47481f);}(_0xdd83,0x1e7));var _0x3dd8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdd83[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3dd8('0x0'));var util=require(_0x3dd8('0x1'));var path=require(_0x3dd8('0x2'));var timeout=require(_0x3dd8('0x3'));var express=require(_0x3dd8('0x4'));var router=express['Router']();var auth=require(_0x3dd8('0x5'));var interaction=require(_0x3dd8('0x6'));var config=require(_0x3dd8('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x3dd8('0x8')](),controller['index']);router[_0x3dd8('0x9')](_0x3dd8('0xa'),auth['isAuthenticated'](),controller[_0x3dd8('0xb')]);router[_0x3dd8('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3dd8('0xc')]('/',auth[_0x3dd8('0x8')](),controller[_0x3dd8('0xd')]);router[_0x3dd8('0xe')](_0x3dd8('0xf'),auth[_0x3dd8('0x8')](),controller[_0x3dd8('0x10')]);router[_0x3dd8('0x11')]('/:id',auth[_0x3dd8('0x8')](),controller[_0x3dd8('0x12')]);module[_0x3dd8('0x13')]=router; \ No newline at end of file +var _0x0127=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x0127,0x93));var _0x7012=function(_0xc465cb,_0xfff6dd){_0xc465cb=_0xc465cb-0x0;var _0x23a861=_0x0127[_0xc465cb];return _0x23a861;};'use strict';var multer=require(_0x7012('0x0'));var util=require(_0x7012('0x1'));var path=require(_0x7012('0x2'));var timeout=require(_0x7012('0x3'));var express=require(_0x7012('0x4'));var router=express[_0x7012('0x5')]();var auth=require(_0x7012('0x6'));var interaction=require(_0x7012('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x7012('0x8')]('/',auth[_0x7012('0x9')](),controller[_0x7012('0xa')]);router[_0x7012('0x8')](_0x7012('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7012('0x8')]('/:id',auth[_0x7012('0x9')](),controller['show']);router[_0x7012('0xc')]('/',auth[_0x7012('0x9')](),controller[_0x7012('0xd')]);router[_0x7012('0xe')]('/:id',auth[_0x7012('0x9')](),controller[_0x7012('0xf')]);router[_0x7012('0x10')](_0x7012('0x11'),auth[_0x7012('0x9')](),controller['destroy']);module[_0x7012('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 5f8493e..5aa5854 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 _0xe939=['DATE','moment','sequelize','exports','STRING'];(function(_0x5358cd,_0x293fd6){var _0xc144e2=function(_0x18c1fc){while(--_0x18c1fc){_0x5358cd['push'](_0x5358cd['shift']());}};_0xc144e2(++_0x293fd6);}(_0xe939,0xd8));var _0x9e93=function(_0x3bc414,_0x489e1c){_0x3bc414=_0x3bc414-0x0;var _0x24080d=_0xe939[_0x3bc414];return _0x24080d;};'use strict';var moment=require(_0x9e93('0x0'));var Sequelize=require(_0x9e93('0x1'));module[_0x9e93('0x2')]={'uniqueid':{'type':Sequelize[_0x9e93('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9e93('0x3')]},'joinAt':{'type':Sequelize[_0x9e93('0x4')]},'leaveAt':{'type':Sequelize[_0x9e93('0x4')]},'acceptAt':{'type':Sequelize[_0x9e93('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9e93('0x3')]}}; \ No newline at end of file +var _0xfbce=['sequelize','exports','STRING','DATE','moment'];(function(_0x1fbcfd,_0xc573b4){var _0x4f7808=function(_0x1a68bb){while(--_0x1a68bb){_0x1fbcfd['push'](_0x1fbcfd['shift']());}};_0x4f7808(++_0xc573b4);}(_0xfbce,0x176));var _0xefbc=function(_0x1c526f,_0xad84c7){_0x1c526f=_0x1c526f-0x0;var _0x14f246=_0xfbce[_0x1c526f];return _0x14f246;};'use strict';var moment=require(_0xefbc('0x0'));var Sequelize=require(_0xefbc('0x1'));module[_0xefbc('0x2')]={'uniqueid':{'type':Sequelize[_0xefbc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xefbc('0x3')]},'joinAt':{'type':Sequelize[_0xefbc('0x4')]},'leaveAt':{'type':Sequelize[_0xefbc('0x4')]},'acceptAt':{'type':Sequelize[_0xefbc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5a1651c..575fb5a 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 _0xfdb3=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','describe','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x43fc6c,_0x2c40ba){_0x43fc6c=_0x43fc6c-0x0;var _0x276fa2=_0xfdb3[_0x43fc6c];return _0x276fa2;};'use strict';var pdf=require(_0x3fdb('0x0'));var emlformat=require(_0x3fdb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3fdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3fdb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fdb('0x4'));var util=require(_0x3fdb('0x5'));var path=require(_0x3fdb('0x6'));var sox=require(_0x3fdb('0x7'));var csv=require(_0x3fdb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fdb('0x9'));var squel=require(_0x3fdb('0xa'));var crypto=require(_0x3fdb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3fdb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3fdb('0xd'));var Papa=require(_0x3fdb('0xe'));var Redis=require(_0x3fdb('0xf'));var authService=require(_0x3fdb('0x10'));var qs=require(_0x3fdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3fdb('0x12'));var config=require(_0x3fdb('0x13'));var db=require(_0x3fdb('0x14'))['db'];function respondWithStatusCode(_0x45e769,_0x3cc79c){_0x3cc79c=_0x3cc79c||0xcc;return function(_0x41f371){if(_0x41f371){return _0x45e769[_0x3fdb('0x15')](_0x3cc79c);}return _0x45e769[_0x3fdb('0x16')](_0x3cc79c)[_0x3fdb('0x17')]();};}function respondWithResult(_0x1c3972,_0x4eab69){_0x4eab69=_0x4eab69||0xc8;return function(_0x35a660){if(_0x35a660){return _0x1c3972[_0x3fdb('0x16')](_0x4eab69)['json'](_0x35a660);}};}function respondWithFilteredResult(_0x46c906,_0x31cd0e){return function(_0x182635){if(_0x182635){var _0x39c573=_0x182635[_0x3fdb('0x18')],_0x5a9b95=_0x31cd0e[_0x3fdb('0x19')],_0x5f2d00=_0x31cd0e[_0x3fdb('0x19')]+_0x31cd0e[_0x3fdb('0x1a')],_0x52132a;if(_0x5f2d00>=_0x39c573){_0x5f2d00=_0x39c573;_0x52132a=0xc8;}else{_0x52132a=0xce;}_0x46c906[_0x3fdb('0x16')](_0x52132a);return _0x46c906['set'](_0x3fdb('0x1b'),_0x5a9b95+'-'+_0x5f2d00+'/'+_0x39c573)[_0x3fdb('0x1c')](_0x182635);}return null;};}function patchUpdates(_0x45c509){return function(_0x463c6d){try{jsonpatch[_0x3fdb('0x1d')](_0x463c6d,_0x45c509,!![]);}catch(_0x4d9a94){return BPromise[_0x3fdb('0x1e')](_0x4d9a94);}return _0x463c6d[_0x3fdb('0x1f')]();};}function saveUpdates(_0x44c8b2,_0x1bbad7){return function(_0x403f48){if(_0x403f48){return _0x403f48['update'](_0x44c8b2)[_0x3fdb('0x20')](function(_0x4e632b){return _0x4e632b;});}return null;};}function removeEntity(_0x457b90,_0x490744){return function(_0x516440){if(_0x516440){return _0x516440['destroy']()['then'](function(){_0x457b90[_0x3fdb('0x16')](0xcc)[_0x3fdb('0x17')]();});}};}function handleEntityNotFound(_0xaf7c32,_0xac9aac){return function(_0x111cb8){if(!_0x111cb8){_0xaf7c32[_0x3fdb('0x15')](0x194);}return _0x111cb8;};}function handleError(_0x5d7665,_0x4cc898){_0x4cc898=_0x4cc898||0x1f4;return function(_0x1ed7bc){logger[_0x3fdb('0x21')](_0x1ed7bc['stack']);if(_0x1ed7bc[_0x3fdb('0x22')]){delete _0x1ed7bc['name'];}_0x5d7665['status'](_0x4cc898)[_0x3fdb('0x23')](_0x1ed7bc);};}exports[_0x3fdb('0x24')]=function(_0x5734c3,_0x2a634a){var _0x4d9c14={},_0x166ff2={},_0x30c1f0={'count':0x0,'rows':[]};var _0x11db11=_[_0x3fdb('0x25')](db[_0x3fdb('0x26')][_0x3fdb('0x27')],function(_0x442dbc){return{'name':_0x442dbc[_0x3fdb('0x28')],'type':_0x442dbc['type']['key']};});_0x166ff2[_0x3fdb('0x29')]=_[_0x3fdb('0x25')](_0x11db11,_0x3fdb('0x22'));_0x166ff2[_0x3fdb('0x2a')]=_[_0x3fdb('0x2b')](_0x5734c3[_0x3fdb('0x2a')]);_0x166ff2[_0x3fdb('0x2c')]=_[_0x3fdb('0x2d')](_0x166ff2['model'],_0x166ff2[_0x3fdb('0x2a')]);_0x4d9c14[_0x3fdb('0x2e')]=_[_0x3fdb('0x2d')](_0x166ff2[_0x3fdb('0x29')],qs[_0x3fdb('0x2f')](_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x2f')]));_0x4d9c14[_0x3fdb('0x2e')]=_0x4d9c14[_0x3fdb('0x2e')][_0x3fdb('0x30')]?_0x4d9c14[_0x3fdb('0x2e')]:_0x166ff2[_0x3fdb('0x29')];if(!_0x5734c3[_0x3fdb('0x2a')]['hasOwnProperty']('nolimit')){_0x4d9c14[_0x3fdb('0x1a')]=qs[_0x3fdb('0x1a')](_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x1a')]);_0x4d9c14[_0x3fdb('0x19')]=qs[_0x3fdb('0x19')](_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x19')]);}_0x4d9c14[_0x3fdb('0x31')]=qs['sort'](_0x5734c3[_0x3fdb('0x2a')]['sort']);_0x4d9c14[_0x3fdb('0x32')]=qs[_0x3fdb('0x2c')](_[_0x3fdb('0x33')](_0x5734c3['query'],_0x166ff2[_0x3fdb('0x2c')]),_0x11db11);if(_0x5734c3[_0x3fdb('0x2a')]['filter']){_0x4d9c14[_0x3fdb('0x32')]=_[_0x3fdb('0x34')](_0x4d9c14[_0x3fdb('0x32')],{'$or':_[_0x3fdb('0x25')](_0x11db11,function(_0x4978d9){if(_0x4978d9[_0x3fdb('0x35')]!==_0x3fdb('0x36')){var _0x4eacc5={};_0x4eacc5[_0x4978d9[_0x3fdb('0x22')]]={'$like':'%'+_0x5734c3[_0x3fdb('0x2a')][_0x3fdb('0x37')]+'%'};return _0x4eacc5;}})});}_0x4d9c14=_[_0x3fdb('0x34')]({},_0x4d9c14,_0x5734c3[_0x3fdb('0x38')]);var _0x12287c={'where':_0x4d9c14['where']};return db[_0x3fdb('0x26')]['count'](_0x12287c)[_0x3fdb('0x20')](function(_0x23e2c6){_0x30c1f0[_0x3fdb('0x18')]=_0x23e2c6;if(_0x5734c3['query'][_0x3fdb('0x39')]){_0x4d9c14[_0x3fdb('0x3a')]=[{'all':!![]}];}return db[_0x3fdb('0x26')][_0x3fdb('0x3b')](_0x4d9c14);})[_0x3fdb('0x20')](function(_0x3e46a2){_0x30c1f0[_0x3fdb('0x3c')]=_0x3e46a2;return _0x30c1f0;})['then'](respondWithFilteredResult(_0x2a634a,_0x4d9c14))[_0x3fdb('0x3d')](handleError(_0x2a634a,null));};exports[_0x3fdb('0x3e')]=function(_0x583811,_0x31721a){var _0x1da23f={'raw':!![],'where':{'id':_0x583811[_0x3fdb('0x3f')]['id']}},_0x2b5b14={};_0x2b5b14['model']=_[_0x3fdb('0x2b')](db[_0x3fdb('0x26')][_0x3fdb('0x27')]);_0x2b5b14[_0x3fdb('0x2a')]=_['keys'](_0x583811[_0x3fdb('0x2a')]);_0x2b5b14[_0x3fdb('0x2c')]=_[_0x3fdb('0x2d')](_0x2b5b14[_0x3fdb('0x29')],_0x2b5b14[_0x3fdb('0x2a')]);_0x1da23f[_0x3fdb('0x2e')]=_[_0x3fdb('0x2d')](_0x2b5b14[_0x3fdb('0x29')],qs['fields'](_0x583811['query'][_0x3fdb('0x2f')]));_0x1da23f[_0x3fdb('0x2e')]=_0x1da23f[_0x3fdb('0x2e')][_0x3fdb('0x30')]?_0x1da23f[_0x3fdb('0x2e')]:_0x2b5b14[_0x3fdb('0x29')];if(_0x583811[_0x3fdb('0x2a')][_0x3fdb('0x39')]){_0x1da23f[_0x3fdb('0x3a')]=[{'all':!![]}];}_0x1da23f=_[_0x3fdb('0x34')]({},_0x1da23f,_0x583811[_0x3fdb('0x38')]);return db[_0x3fdb('0x26')]['find'](_0x1da23f)[_0x3fdb('0x20')](handleEntityNotFound(_0x31721a,null))[_0x3fdb('0x20')](respondWithResult(_0x31721a,null))['catch'](handleError(_0x31721a,null));};exports[_0x3fdb('0x40')]=function(_0x119600,_0x5d1938){return db[_0x3fdb('0x26')][_0x3fdb('0x40')](_0x119600[_0x3fdb('0x41')],{})['then'](respondWithResult(_0x5d1938,0xc9))[_0x3fdb('0x3d')](handleError(_0x5d1938,null));};exports[_0x3fdb('0x42')]=function(_0x525d45,_0x119386){if(_0x525d45[_0x3fdb('0x41')]['id']){delete _0x525d45[_0x3fdb('0x41')]['id'];}return db[_0x3fdb('0x26')][_0x3fdb('0x43')]({'where':{'id':_0x525d45[_0x3fdb('0x3f')]['id']}})[_0x3fdb('0x20')](handleEntityNotFound(_0x119386,null))[_0x3fdb('0x20')](saveUpdates(_0x525d45[_0x3fdb('0x41')],null))['then'](respondWithResult(_0x119386,null))[_0x3fdb('0x3d')](handleError(_0x119386,null));};exports[_0x3fdb('0x44')]=function(_0x57b0ad,_0x5b7900){return db['MailQueueReport'][_0x3fdb('0x43')]({'where':{'id':_0x57b0ad['params']['id']}})['then'](handleEntityNotFound(_0x5b7900,null))[_0x3fdb('0x20')](removeEntity(_0x5b7900,null))['catch'](handleError(_0x5b7900,null));};exports[_0x3fdb('0x45')]=function(_0x3ac448,_0x4e468a){return db[_0x3fdb('0x26')][_0x3fdb('0x45')]()[_0x3fdb('0x20')](respondWithResult(_0x4e468a,null))['catch'](handleError(_0x4e468a,null));}; \ No newline at end of file +var _0xd0ae=['update','then','destroy','error','stack','name','send','index','map','MailQueueReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','apply','reject','save'];(function(_0x2379f2,_0x1c91bc){var _0x2015af=function(_0x432f30){while(--_0x432f30){_0x2379f2['push'](_0x2379f2['shift']());}};_0x2015af(++_0x1c91bc);}(_0xd0ae,0x160));var _0xed0a=function(_0x3952b4,_0x84d2ab){_0x3952b4=_0x3952b4-0x0;var _0x3e6c0d=_0xd0ae[_0x3952b4];return _0x3e6c0d;};'use strict';var pdf=require(_0xed0a('0x0'));var emlformat=require(_0xed0a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed0a('0x3'));var moment=require(_0xed0a('0x4'));var BPromise=require(_0xed0a('0x5'));var Mustache=require(_0xed0a('0x6'));var util=require(_0xed0a('0x7'));var path=require('path');var sox=require(_0xed0a('0x8'));var csv=require(_0xed0a('0x9'));var ejs=require(_0xed0a('0xa'));var fs=require('fs');var _=require(_0xed0a('0xb'));var squel=require(_0xed0a('0xc'));var crypto=require(_0xed0a('0xd'));var jsforce=require(_0xed0a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed0a('0x9'));var querystring=require(_0xed0a('0xf'));var Papa=require(_0xed0a('0x10'));var Redis=require(_0xed0a('0x11'));var authService=require(_0xed0a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xed0a('0x13'));var hardwareService=require(_0xed0a('0x14'));var logger=require(_0xed0a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xed0a('0x16'));var db=require(_0xed0a('0x17'))['db'];function respondWithStatusCode(_0x195257,_0xe0507a){_0xe0507a=_0xe0507a||0xcc;return function(_0x3497f2){if(_0x3497f2){return _0x195257[_0xed0a('0x18')](_0xe0507a);}return _0x195257[_0xed0a('0x19')](_0xe0507a)[_0xed0a('0x1a')]();};}function respondWithResult(_0xce85ff,_0x45443a){_0x45443a=_0x45443a||0xc8;return function(_0x8f141a){if(_0x8f141a){return _0xce85ff[_0xed0a('0x19')](_0x45443a)['json'](_0x8f141a);}};}function respondWithFilteredResult(_0x396dc5,_0x4ec61c){return function(_0x3f96de){if(_0x3f96de){var _0x3f622a=_0x3f96de[_0xed0a('0x1b')],_0x3201f1=_0x4ec61c[_0xed0a('0x1c')],_0x19d3cd=_0x4ec61c[_0xed0a('0x1c')]+_0x4ec61c['limit'],_0x5e53f3;if(_0x19d3cd>=_0x3f622a){_0x19d3cd=_0x3f622a;_0x5e53f3=0xc8;}else{_0x5e53f3=0xce;}_0x396dc5[_0xed0a('0x19')](_0x5e53f3);return _0x396dc5[_0xed0a('0x1d')]('Content-Range',_0x3201f1+'-'+_0x19d3cd+'/'+_0x3f622a)['json'](_0x3f96de);}return null;};}function patchUpdates(_0x6f23cd){return function(_0x34daae){try{jsonpatch[_0xed0a('0x1e')](_0x34daae,_0x6f23cd,!![]);}catch(_0x3700ad){return BPromise[_0xed0a('0x1f')](_0x3700ad);}return _0x34daae[_0xed0a('0x20')]();};}function saveUpdates(_0x285e0c,_0x3c63a4){return function(_0x51cb81){if(_0x51cb81){return _0x51cb81[_0xed0a('0x21')](_0x285e0c)[_0xed0a('0x22')](function(_0x18218b){return _0x18218b;});}return null;};}function removeEntity(_0x50a8d8,_0x5a8efe){return function(_0x20a3f6){if(_0x20a3f6){return _0x20a3f6[_0xed0a('0x23')]()['then'](function(){_0x50a8d8[_0xed0a('0x19')](0xcc)[_0xed0a('0x1a')]();});}};}function handleEntityNotFound(_0xd81ba8,_0x5ba3c6){return function(_0x296d43){if(!_0x296d43){_0xd81ba8[_0xed0a('0x18')](0x194);}return _0x296d43;};}function handleError(_0x214b08,_0x5bb2c9){_0x5bb2c9=_0x5bb2c9||0x1f4;return function(_0xf21bef){logger[_0xed0a('0x24')](_0xf21bef[_0xed0a('0x25')]);if(_0xf21bef[_0xed0a('0x26')]){delete _0xf21bef[_0xed0a('0x26')];}_0x214b08[_0xed0a('0x19')](_0x5bb2c9)[_0xed0a('0x27')](_0xf21bef);};}exports[_0xed0a('0x28')]=function(_0x3438d5,_0x2b9817){var _0x418fcc={},_0x5ef80d={},_0xfd4ab4={'count':0x0,'rows':[]};var _0x1b39bb=_[_0xed0a('0x29')](db[_0xed0a('0x2a')]['rawAttributes'],function(_0x233a6f){return{'name':_0x233a6f[_0xed0a('0x2b')],'type':_0x233a6f[_0xed0a('0x2c')][_0xed0a('0x2d')]};});_0x5ef80d[_0xed0a('0x2e')]=_['map'](_0x1b39bb,_0xed0a('0x26'));_0x5ef80d['query']=_[_0xed0a('0x2f')](_0x3438d5[_0xed0a('0x30')]);_0x5ef80d['filters']=_[_0xed0a('0x31')](_0x5ef80d[_0xed0a('0x2e')],_0x5ef80d[_0xed0a('0x30')]);_0x418fcc['attributes']=_['intersection'](_0x5ef80d[_0xed0a('0x2e')],qs[_0xed0a('0x32')](_0x3438d5['query'][_0xed0a('0x32')]));_0x418fcc[_0xed0a('0x33')]=_0x418fcc['attributes'][_0xed0a('0x34')]?_0x418fcc[_0xed0a('0x33')]:_0x5ef80d[_0xed0a('0x2e')];if(!_0x3438d5[_0xed0a('0x30')][_0xed0a('0x35')](_0xed0a('0x36'))){_0x418fcc[_0xed0a('0x37')]=qs[_0xed0a('0x37')](_0x3438d5['query'][_0xed0a('0x37')]);_0x418fcc['offset']=qs[_0xed0a('0x1c')](_0x3438d5[_0xed0a('0x30')]['offset']);}_0x418fcc[_0xed0a('0x38')]=qs[_0xed0a('0x39')](_0x3438d5[_0xed0a('0x30')][_0xed0a('0x39')]);_0x418fcc[_0xed0a('0x3a')]=qs[_0xed0a('0x3b')](_[_0xed0a('0x3c')](_0x3438d5[_0xed0a('0x30')],_0x5ef80d[_0xed0a('0x3b')]),_0x1b39bb);if(_0x3438d5[_0xed0a('0x30')][_0xed0a('0x3d')]){_0x418fcc[_0xed0a('0x3a')]=_['merge'](_0x418fcc[_0xed0a('0x3a')],{'$or':_[_0xed0a('0x29')](_0x1b39bb,function(_0x12f162){if(_0x12f162[_0xed0a('0x2c')]!==_0xed0a('0x3e')){var _0x369669={};_0x369669[_0x12f162[_0xed0a('0x26')]]={'$like':'%'+_0x3438d5[_0xed0a('0x30')][_0xed0a('0x3d')]+'%'};return _0x369669;}})});}_0x418fcc=_[_0xed0a('0x3f')]({},_0x418fcc,_0x3438d5[_0xed0a('0x40')]);var _0x8f8539={'where':_0x418fcc[_0xed0a('0x3a')]};return db[_0xed0a('0x2a')][_0xed0a('0x1b')](_0x8f8539)[_0xed0a('0x22')](function(_0x544dea){_0xfd4ab4[_0xed0a('0x1b')]=_0x544dea;if(_0x3438d5['query'][_0xed0a('0x41')]){_0x418fcc[_0xed0a('0x42')]=[{'all':!![]}];}return db[_0xed0a('0x2a')][_0xed0a('0x43')](_0x418fcc);})[_0xed0a('0x22')](function(_0x37cab3){_0xfd4ab4[_0xed0a('0x44')]=_0x37cab3;return _0xfd4ab4;})[_0xed0a('0x22')](respondWithFilteredResult(_0x2b9817,_0x418fcc))[_0xed0a('0x45')](handleError(_0x2b9817,null));};exports[_0xed0a('0x46')]=function(_0x53a49a,_0x3d99eb){var _0x2caf31={'raw':!![],'where':{'id':_0x53a49a[_0xed0a('0x47')]['id']}},_0x179756={};_0x179756[_0xed0a('0x2e')]=_[_0xed0a('0x2f')](db[_0xed0a('0x2a')][_0xed0a('0x48')]);_0x179756[_0xed0a('0x30')]=_[_0xed0a('0x2f')](_0x53a49a[_0xed0a('0x30')]);_0x179756[_0xed0a('0x3b')]=_[_0xed0a('0x31')](_0x179756[_0xed0a('0x2e')],_0x179756[_0xed0a('0x30')]);_0x2caf31['attributes']=_['intersection'](_0x179756[_0xed0a('0x2e')],qs['fields'](_0x53a49a['query'][_0xed0a('0x32')]));_0x2caf31[_0xed0a('0x33')]=_0x2caf31[_0xed0a('0x33')][_0xed0a('0x34')]?_0x2caf31[_0xed0a('0x33')]:_0x179756[_0xed0a('0x2e')];if(_0x53a49a['query'][_0xed0a('0x41')]){_0x2caf31[_0xed0a('0x42')]=[{'all':!![]}];}_0x2caf31=_[_0xed0a('0x3f')]({},_0x2caf31,_0x53a49a[_0xed0a('0x40')]);return db[_0xed0a('0x2a')][_0xed0a('0x49')](_0x2caf31)[_0xed0a('0x22')](handleEntityNotFound(_0x3d99eb,null))[_0xed0a('0x22')](respondWithResult(_0x3d99eb,null))[_0xed0a('0x45')](handleError(_0x3d99eb,null));};exports[_0xed0a('0x4a')]=function(_0x18351c,_0x511c3d){return db['MailQueueReport'][_0xed0a('0x4a')](_0x18351c['body'],{})['then'](respondWithResult(_0x511c3d,0xc9))[_0xed0a('0x45')](handleError(_0x511c3d,null));};exports[_0xed0a('0x21')]=function(_0x197207,_0x331fe8){if(_0x197207['body']['id']){delete _0x197207['body']['id'];}return db['MailQueueReport'][_0xed0a('0x49')]({'where':{'id':_0x197207[_0xed0a('0x47')]['id']}})[_0xed0a('0x22')](handleEntityNotFound(_0x331fe8,null))[_0xed0a('0x22')](saveUpdates(_0x197207[_0xed0a('0x4b')],null))[_0xed0a('0x22')](respondWithResult(_0x331fe8,null))[_0xed0a('0x45')](handleError(_0x331fe8,null));};exports['destroy']=function(_0x50f1e0,_0x14932d){return db[_0xed0a('0x2a')][_0xed0a('0x49')]({'where':{'id':_0x50f1e0['params']['id']}})[_0xed0a('0x22')](handleEntityNotFound(_0x14932d,null))[_0xed0a('0x22')](removeEntity(_0x14932d,null))[_0xed0a('0x45')](handleError(_0x14932d,null));};exports[_0xed0a('0x4c')]=function(_0x52affc,_0x3fe3e3){return db[_0xed0a('0x2a')][_0xed0a('0x4c')]()[_0xed0a('0x22')](respondWithResult(_0x3fe3e3,null))[_0xed0a('0x45')](handleError(_0x3fe3e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 496e807..3b26adb 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 _0x7096=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','api','bluebird','request-promise','path'];(function(_0x144b4f,_0x3bcfb6){var _0x5ed74b=function(_0x507df6){while(--_0x507df6){_0x144b4f['push'](_0x144b4f['shift']());}};_0x5ed74b(++_0x3bcfb6);}(_0x7096,0x10c));var _0x6709=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x7096[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd052=['../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','moment','path'];(function(_0x4271f0,_0x227df5){var _0x5064dc=function(_0x8864f9){while(--_0x8864f9){_0x4271f0['push'](_0x4271f0['shift']());}};_0x5064dc(++_0x227df5);}(_0xd052,0x69));var _0x2d05=function(_0x339ded,_0xb38a57){_0x339ded=_0x339ded-0x0;var _0x37f8dc=_0xd052[_0x339ded];return _0x37f8dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d05('0x0'))('api');var moment=require(_0x2d05('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d05('0x2'));var rimraf=require('rimraf');var config=require(_0x2d05('0x3'));var attributes=require(_0x2d05('0x4'));module['exports']=function(_0x380979,_0x15de1f){return _0x380979[_0x2d05('0x5')](_0x2d05('0x6'),attributes,{'tableName':_0x2d05('0x7'),'paranoid':![],'indexes':[{'name':_0x2d05('0x8'),'fields':[_0x2d05('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3fc653c..6a05b75 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x984e9c,_0x3d8857){var _0x1a4f49=function(_0x34e999){while(--_0x34e999){_0x984e9c['push'](_0x984e9c['shift']());}};_0x1a4f49(++_0x3d8857);}(_0x7a54,0x106));var _0x47a5=function(_0x10b082,_0x1958e9){_0x10b082=_0x10b082-0x0;var _0x57e5d9=_0x7a54[_0x10b082];return _0x57e5d9;};'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')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x187d=['MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','then','UpdateMailQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x51fb88,_0x1b5555){var _0x46c4d0=function(_0xaff8f2){while(--_0xaff8f2){_0x51fb88['push'](_0x51fb88['shift']());}};_0x46c4d0(++_0x1b5555);}(_0x187d,0x93));var _0xd187=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x187d[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')](_0x374fe0[_0xd187('0x18')],{'raw':_0x374fe0[_0xd187('0x19')]?_0x374fe0[_0xd187('0x19')][_0xd187('0x1a')]===undefined?!![]:![]:!![]})[_0xd187('0x1b')](function(_0x5204ee){logger[_0xd187('0xc')](_0xd187('0x15'),_0x374fe0);logger[_0xd187('0xf')]('CreateMailQueueReport',_0x374fe0,JSON['stringify'](_0x5204ee));_0x21df74(_0x5204ee);})['catch'](function(_0x435d94){logger[_0xd187('0x12')](_0xd187('0x15'),_0x435d94['message'],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x435d94['message']));});});};exports[_0xd187('0x1c')]=function(_0x5a7a23){var _0x1047f4=this;return new Promise(function(_0x54f340,_0x4f3879){return db[_0xd187('0x16')]['update'](_0x5a7a23[_0xd187('0x18')],{'raw':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23[_0xd187('0x19')][_0xd187('0x1d')]||null:null,'attributes':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options'][_0xd187('0x1e')]||null:null,'limit':_0x5a7a23[_0xd187('0x19')]?_0x5a7a23['options'][_0xd187('0x1f')]||null:null})[_0xd187('0x1b')](function(_0x34febe){logger['info'](_0xd187('0x1c'),_0x5a7a23);logger['debug'](_0xd187('0x1c'),_0x5a7a23,JSON[_0xd187('0x11')](_0x34febe));_0x54f340(_0x34febe);})[_0xd187('0x14')](function(_0x352b66){logger['error'](_0xd187('0x1c'),_0x352b66[_0xd187('0x13')],_0x5a7a23);_0x4f3879(_0x1047f4['error'](0x1f4,_0x352b66['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index eb2c156..b4dd6df 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 _0x1757=['exports','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3512b2,_0x2cb54a){var _0x16c6e8=function(_0x1698d4){while(--_0x1698d4){_0x3512b2['push'](_0x3512b2['shift']());}};_0x16c6e8(++_0x2cb54a);}(_0x1757,0x11b));var _0x7175=function(_0x1d3b9d,_0xdd459c){_0x1d3b9d=_0x1d3b9d-0x0;var _0x5caef6=_0x1757[_0x1d3b9d];return _0x5caef6;};'use strict';var multer=require('multer');var util=require(_0x7175('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7175('0x1'));var router=express[_0x7175('0x2')]();var auth=require(_0x7175('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7175('0x4'));module[_0x7175('0x5')]=router; \ No newline at end of file +var _0x2fe7=['../../components/interaction/service','exports','util','path','express','Router'];(function(_0x256103,_0x4302f8){var _0x56e3c3=function(_0x139b72){while(--_0x139b72){_0x256103['push'](_0x256103['shift']());}};_0x56e3c3(++_0x4302f8);}(_0x2fe7,0x1ee));var _0x72fe=function(_0x5eac05,_0x15f2ba){_0x5eac05=_0x5eac05-0x0;var _0x28090b=_0x2fe7[_0x5eac05];return _0x28090b;};'use strict';var multer=require('multer');var util=require(_0x72fe('0x0'));var path=require(_0x72fe('0x1'));var timeout=require('connect-timeout');var express=require(_0x72fe('0x2'));var router=express[_0x72fe('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x72fe('0x4'));var config=require('../../config/environment');module[_0x72fe('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2b52377..8d25f13 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 _0xba4e=['STRING','BOOLEAN','username','INTEGER','sequelize','exports'];(function(_0x1683b2,_0x3ff310){var _0x45f858=function(_0x208e2e){while(--_0x208e2e){_0x1683b2['push'](_0x1683b2['shift']());}};_0x45f858(++_0x3ff310);}(_0xba4e,0x1a2));var _0xeba4=function(_0x17e0ff,_0x4dbd1e){_0x17e0ff=_0x17e0ff-0x0;var _0x357979=_0xba4e[_0x17e0ff];return _0x357979;};'use strict';var Sequelize=require(_0xeba4('0x0'));module[_0xeba4('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeba4('0x2')]},'authentication':{'type':Sequelize[_0xeba4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xeba4('0x2')],'unique':_0xeba4('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xeba4('0x5')]},'tls':{'type':Sequelize[_0xeba4('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xeba4('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xeba4('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xeba4('0x2')]}}; \ No newline at end of file +var _0x3155=['STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x4d15cd,_0x7dc2f7){var _0x15a57d=function(_0x26a59d){while(--_0x26a59d){_0x4d15cd['push'](_0x4d15cd['shift']());}};_0x15a57d(++_0x7dc2f7);}(_0x3155,0x125));var _0x5315=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x3155[_0x27d958];return _0x53e63e;};'use strict';var Sequelize=require(_0x5315('0x0'));module['exports']={'description':{'type':Sequelize[_0x5315('0x1')]},'host':{'type':Sequelize[_0x5315('0x1')]},'authentication':{'type':Sequelize[_0x5315('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x5315('0x3')},'password':{'type':Sequelize[_0x5315('0x1')]},'port':{'type':Sequelize[_0x5315('0x4')]},'tls':{'type':Sequelize[_0x5315('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5315('0x1')],'defaultValue':_0x5315('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5315('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 44d0f2c..87c52db 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 _0xe4d9=['moment','path','rimraf','./mailServerIn.attributes','exports','define','lodash','util','../../config/logger'];(function(_0xa2a4d8,_0x437e16){var _0x25fec5=function(_0x4493d7){while(--_0x4493d7){_0xa2a4d8['push'](_0xa2a4d8['shift']());}};_0x25fec5(++_0x437e16);}(_0xe4d9,0x141));var _0x9e4d=function(_0x530efe,_0x5d8e0e){_0x530efe=_0x530efe-0x0;var _0x39aca3=_0xe4d9[_0x530efe];return _0x39aca3;};'use strict';var _=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var logger=require(_0x9e4d('0x2'))('api');var moment=require(_0x9e4d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e4d('0x4'));var rimraf=require(_0x9e4d('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e4d('0x6'));module[_0x9e4d('0x7')]=function(_0x5a4881,_0x493fb5){return _0x5a4881[_0x9e4d('0x8')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b5=['exports','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x27fdcb,_0xe5c55b){var _0x51b14d=function(_0x2ddaa5){while(--_0x2ddaa5){_0x27fdcb['push'](_0x27fdcb['shift']());}};_0x51b14d(++_0xe5c55b);}(_0x90b5,0x139));var _0x590b=function(_0x377949,_0x24acce){_0x377949=_0x377949-0x0;var _0xbcaa4d=_0x90b5[_0x377949];return _0xbcaa4d;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 81adafa..8e46ef9 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 _0xefa1=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','debug','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0xbc4d01,_0x383bb7){var _0x5a777c=function(_0x5dd651){while(--_0x5dd651){_0xbc4d01['push'](_0xbc4d01['shift']());}};_0x5a777c(++_0x383bb7);}(_0xefa1,0x13d));var _0x1efa=function(_0x421d67,_0x317375){_0x421d67=_0x421d67-0x0;var _0x2ca984=_0xefa1[_0x421d67];return _0x2ca984;};'use strict';var _=require(_0x1efa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1efa('0x1'));var rs=require(_0x1efa('0x2'));var fs=require('fs');var Redis=require(_0x1efa('0x3'));var db=require(_0x1efa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1efa('0x5'))(_0x1efa('0x6'));var config=require(_0x1efa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1efa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13a4a5,_0x2cf644,_0x60e8ea){return new BPromise(function(_0xa76e44,_0x186045){return client['request'](_0x13a4a5,_0x60e8ea)[_0x1efa('0x9')](function(_0x50dabb){logger[_0x1efa('0xa')](_0x1efa('0xb'),_0x2cf644,_0x1efa('0xc'));logger['debug'](_0x1efa('0xd'),_0x2cf644,'request\x20sent',JSON[_0x1efa('0xe')](_0x50dabb));if(_0x50dabb[_0x1efa('0xf')]){if(_0x50dabb[_0x1efa('0xf')]['code']===0x1f4){logger[_0x1efa('0xf')]('MailServerIn,\x20%s,\x20%s',_0x2cf644,_0x50dabb[_0x1efa('0xf')]['message']);return _0x186045(_0x50dabb['error'][_0x1efa('0x10')]);}logger[_0x1efa('0xf')](_0x1efa('0xb'),_0x2cf644,_0x50dabb['error'][_0x1efa('0x10')]);return _0xa76e44(_0x50dabb[_0x1efa('0xf')][_0x1efa('0x10')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x2cf644,'request\x20sent');_0xa76e44(_0x50dabb['result'][_0x1efa('0x10')]);}})['catch'](function(_0x11e569){logger['error'](_0x1efa('0xb'),_0x2cf644,_0x11e569);_0x186045(_0x11e569);});});}exports['GetMailServerIn']=function(_0x26a106){var _0x10894c=this;return new Promise(function(_0x368647,_0x389d3e){return db[_0x1efa('0x11')][_0x1efa('0x12')]({'raw':_0x26a106[_0x1efa('0x13')]?_0x26a106[_0x1efa('0x13')][_0x1efa('0x14')]===undefined?!![]:![]:!![],'where':_0x26a106['options']?_0x26a106['options'][_0x1efa('0x15')]||null:null,'attributes':_0x26a106[_0x1efa('0x13')]?_0x26a106[_0x1efa('0x13')][_0x1efa('0x16')]||null:null,'limit':_0x26a106[_0x1efa('0x13')]?_0x26a106['options'][_0x1efa('0x17')]||null:null,'include':_0x26a106[_0x1efa('0x13')]?_0x26a106[_0x1efa('0x13')][_0x1efa('0x18')]?_[_0x1efa('0x19')](_0x26a106[_0x1efa('0x13')][_0x1efa('0x18')],function(_0x2ce759){return{'model':db[_0x2ce759[_0x1efa('0x1a')]],'as':_0x2ce759['as'],'attributes':_0x2ce759[_0x1efa('0x16')],'include':_0x2ce759[_0x1efa('0x18')]?_[_0x1efa('0x19')](_0x2ce759[_0x1efa('0x18')],function(_0x45238a){return{'model':db[_0x45238a['model']],'as':_0x45238a['as'],'attributes':_0x45238a['attributes'],'include':_0x45238a[_0x1efa('0x18')]?_[_0x1efa('0x19')](_0x45238a['include'],function(_0x3d5752){return{'model':db[_0x3d5752[_0x1efa('0x1a')]],'as':_0x3d5752['as'],'attributes':_0x3d5752[_0x1efa('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1efa('0x9')](function(_0x1ffdac){logger[_0x1efa('0xa')](_0x1efa('0x1b'),_0x26a106);logger[_0x1efa('0x1c')](_0x1efa('0x1b'),_0x26a106,JSON['stringify'](_0x1ffdac));_0x368647(_0x1ffdac);})[_0x1efa('0x1d')](function(_0x41abee){logger[_0x1efa('0xf')](_0x1efa('0x1b'),_0x41abee[_0x1efa('0x10')],_0x26a106);_0x389d3e(_0x10894c['error'](0x1f4,_0x41abee[_0x1efa('0x10')]));});});}; \ No newline at end of file +var _0xe4ee=['info','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe4ee,0x124));var _0xee4e=function(_0x34630a,_0x25691c){_0x34630a=_0x34630a-0x0;var _0x3169d8=_0xe4ee[_0x34630a];return _0x3169d8;};'use strict';var _=require('lodash');var util=require(_0xee4e('0x0'));var moment=require(_0xee4e('0x1'));var BPromise=require(_0xee4e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee4e('0x3'))(_0xee4e('0x4'));var config=require(_0xee4e('0x5'));var jayson=require(_0xee4e('0x6'));var client=jayson[_0xee4e('0x7')][_0xee4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc037f9,_0x2ae824,_0x2cd9e8){return new BPromise(function(_0x2b3a95,_0x40043b){return client[_0xee4e('0x9')](_0xc037f9,_0x2cd9e8)[_0xee4e('0xa')](function(_0x23dac0){logger['info'](_0xee4e('0xb'),_0x2ae824,_0xee4e('0xc'));logger[_0xee4e('0xd')](_0xee4e('0xe'),_0x2ae824,_0xee4e('0xc'),JSON[_0xee4e('0xf')](_0x23dac0));if(_0x23dac0[_0xee4e('0x10')]){if(_0x23dac0['error']['code']===0x1f4){logger[_0xee4e('0x10')](_0xee4e('0xb'),_0x2ae824,_0x23dac0[_0xee4e('0x10')]['message']);return _0x40043b(_0x23dac0[_0xee4e('0x10')][_0xee4e('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x2ae824,_0x23dac0[_0xee4e('0x10')][_0xee4e('0x11')]);return _0x2b3a95(_0x23dac0[_0xee4e('0x10')][_0xee4e('0x11')]);}else{logger[_0xee4e('0x12')](_0xee4e('0xb'),_0x2ae824,_0xee4e('0xc'));_0x2b3a95(_0x23dac0['result'][_0xee4e('0x11')]);}})[_0xee4e('0x13')](function(_0x5c12ff){logger[_0xee4e('0x10')](_0xee4e('0xb'),_0x2ae824,_0x5c12ff);_0x40043b(_0x5c12ff);});});}exports[_0xee4e('0x14')]=function(_0x190737){var _0x50f453=this;return new Promise(function(_0xb05edf,_0x48be3c){return db[_0xee4e('0x15')][_0xee4e('0x16')]({'raw':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')][_0xee4e('0x18')]===undefined?!![]:![]:!![],'where':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')][_0xee4e('0x19')]||null:null,'attributes':_0x190737[_0xee4e('0x17')]?_0x190737['options'][_0xee4e('0x1a')]||null:null,'limit':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')][_0xee4e('0x1b')]||null:null,'include':_0x190737[_0xee4e('0x17')]?_0x190737[_0xee4e('0x17')]['include']?_['map'](_0x190737[_0xee4e('0x17')][_0xee4e('0x1c')],function(_0x4e5fd2){return{'model':db[_0x4e5fd2['model']],'as':_0x4e5fd2['as'],'attributes':_0x4e5fd2[_0xee4e('0x1a')],'include':_0x4e5fd2[_0xee4e('0x1c')]?_[_0xee4e('0x1d')](_0x4e5fd2[_0xee4e('0x1c')],function(_0x311a16){return{'model':db[_0x311a16[_0xee4e('0x1e')]],'as':_0x311a16['as'],'attributes':_0x311a16[_0xee4e('0x1a')],'include':_0x311a16[_0xee4e('0x1c')]?_[_0xee4e('0x1d')](_0x311a16['include'],function(_0xaeb12b){return{'model':db[_0xaeb12b[_0xee4e('0x1e')]],'as':_0xaeb12b['as'],'attributes':_0xaeb12b[_0xee4e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xee4e('0xa')](function(_0x1d2aa3){logger[_0xee4e('0x12')](_0xee4e('0x14'),_0x190737);logger[_0xee4e('0xd')](_0xee4e('0x14'),_0x190737,JSON[_0xee4e('0xf')](_0x1d2aa3));_0xb05edf(_0x1d2aa3);})[_0xee4e('0x13')](function(_0x5e0536){logger['error'](_0xee4e('0x14'),_0x5e0536[_0xee4e('0x11')],_0x190737);_0x48be3c(_0x50f453[_0xee4e('0x10')](0x1f4,_0x5e0536['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 745d3ce..91dbc96 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 _0x95b5=['get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b4909,_0x10b5db){var _0x4efacc=function(_0x2929b5){while(--_0x2929b5){_0x1b4909['push'](_0x1b4909['shift']());}};_0x4efacc(++_0x10b5db);}(_0x95b5,0x14a));var _0x595b=function(_0x2a1bc2,_0x4ad4b9){_0x2a1bc2=_0x2a1bc2-0x0;var _0x2ca785=_0x95b5[_0x2a1bc2];return _0x2ca785;};'use strict';var multer=require(_0x595b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x595b('0x1'));var express=require('express');var router=express[_0x595b('0x2')]();var auth=require(_0x595b('0x3'));var interaction=require(_0x595b('0x4'));var config=require(_0x595b('0x5'));var controller=require('./mailServerOut.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x595b('0x6')](_0x595b('0x7'),auth[_0x595b('0x8')](),controller[_0x595b('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x595b('0xa')]);router[_0x595b('0xb')](_0x595b('0x7'),auth[_0x595b('0x8')](),controller[_0x595b('0xc')]);router[_0x595b('0xd')](_0x595b('0x7'),auth[_0x595b('0x8')](),controller[_0x595b('0xe')]);module[_0x595b('0xf')]=router; \ No newline at end of file +var _0xb643=['post','isAuthenticated','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show'];(function(_0x5be4a0,_0x291a73){var _0x247978=function(_0x5f1fe7){while(--_0x5f1fe7){_0x5be4a0['push'](_0x5be4a0['shift']());}};_0x247978(++_0x291a73);}(_0xb643,0xc4));var _0x3b64=function(_0x442863,_0x2d9dc6){_0x442863=_0x442863-0x0;var _0x38797c=_0xb643[_0x442863];return _0x38797c;};'use strict';var multer=require(_0x3b64('0x0'));var util=require(_0x3b64('0x1'));var path=require(_0x3b64('0x2'));var timeout=require(_0x3b64('0x3'));var express=require(_0x3b64('0x4'));var router=express['Router']();var auth=require(_0x3b64('0x5'));var interaction=require(_0x3b64('0x6'));var config=require(_0x3b64('0x7'));var controller=require(_0x3b64('0x8'));router[_0x3b64('0x9')]('/',auth['isAuthenticated'](),controller[_0x3b64('0xa')]);router[_0x3b64('0x9')](_0x3b64('0xb'),auth['isAuthenticated'](),controller[_0x3b64('0xc')]);router[_0x3b64('0xd')]('/',auth[_0x3b64('0xe')](),controller[_0x3b64('0xf')]);router['put'](_0x3b64('0xb'),auth['isAuthenticated'](),controller[_0x3b64('0x10')]);router['delete'](_0x3b64('0xb'),auth[_0x3b64('0xe')](),controller[_0x3b64('0x11')]);module[_0x3b64('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9e0e223..dd18920 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 _0x6d19=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6d19,0x160));var _0x96d1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x6d19[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x96d1('0x0'));module[_0x96d1('0x1')]={'description':{'type':Sequelize[_0x96d1('0x2')]},'host':{'type':Sequelize[_0x96d1('0x2')]},'user':{'type':Sequelize[_0x96d1('0x2')]},'pass':{'type':Sequelize[_0x96d1('0x2')]},'port':{'type':Sequelize[_0x96d1('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x96d1('0x2')]},'authentication':{'type':Sequelize[_0x96d1('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xab00=['INTEGER','sequelize','exports','STRING'];(function(_0x193175,_0x21e038){var _0x11d51d=function(_0x1bad64){while(--_0x1bad64){_0x193175['push'](_0x193175['shift']());}};_0x11d51d(++_0x21e038);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3a17cd,_0x5202a8){_0x3a17cd=_0x3a17cd-0x0;var _0x51a6ec=_0xab00[_0x3a17cd];return _0x51a6ec;};'use strict';var Sequelize=require(_0x0ab0('0x0'));module[_0x0ab0('0x1')]={'description':{'type':Sequelize[_0x0ab0('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x0ab0('0x2')]},'pass':{'type':Sequelize[_0x0ab0('0x2')]},'port':{'type':Sequelize[_0x0ab0('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0ab0('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index caf98e1..8d5742c 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 _0xbc87=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','MailServerOut','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','fields','find','create','body','catch','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xbc87,0x144));var _0x7bc8=function(_0x26035d,_0xc68032){_0x26035d=_0x26035d-0x0;var _0x18de85=_0xbc87[_0x26035d];return _0x18de85;};'use strict';var pdf=require(_0x7bc8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7bc8('0x1'));var jsonpatch=require(_0x7bc8('0x2'));var rp=require(_0x7bc8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bc8('0x4'));var util=require(_0x7bc8('0x5'));var path=require(_0x7bc8('0x6'));var sox=require(_0x7bc8('0x7'));var csv=require(_0x7bc8('0x8'));var ejs=require(_0x7bc8('0x9'));var fs=require('fs');var _=require(_0x7bc8('0xa'));var squel=require(_0x7bc8('0xb'));var crypto=require(_0x7bc8('0xc'));var jsforce=require(_0x7bc8('0xd'));var deskjs=require(_0x7bc8('0xe'));var toCsv=require(_0x7bc8('0x8'));var querystring=require(_0x7bc8('0xf'));var Papa=require(_0x7bc8('0x10'));var Redis=require(_0x7bc8('0x11'));var authService=require(_0x7bc8('0x12'));var qs=require(_0x7bc8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc8('0x14'));var logger=require('../../config/logger')(_0x7bc8('0x15'));var utils=require(_0x7bc8('0x16'));var config=require(_0x7bc8('0x17'));var db=require(_0x7bc8('0x18'))['db'];function respondWithStatusCode(_0x39d4f8,_0x41a2be){_0x41a2be=_0x41a2be||0xcc;return function(_0x4cd0ff){if(_0x4cd0ff){return _0x39d4f8[_0x7bc8('0x19')](_0x41a2be);}return _0x39d4f8[_0x7bc8('0x1a')](_0x41a2be)['end']();};}function respondWithResult(_0x32d58c,_0x4ebdfe){_0x4ebdfe=_0x4ebdfe||0xc8;return function(_0x11f135){if(_0x11f135){return _0x32d58c[_0x7bc8('0x1a')](_0x4ebdfe)[_0x7bc8('0x1b')](_0x11f135);}};}function respondWithFilteredResult(_0x2a1069,_0x2e0bcd){return function(_0x499417){if(_0x499417){var _0x4270cb=_0x499417[_0x7bc8('0x1c')],_0x47fb8f=_0x2e0bcd[_0x7bc8('0x1d')],_0x3c349d=_0x2e0bcd[_0x7bc8('0x1d')]+_0x2e0bcd[_0x7bc8('0x1e')],_0x5d80fb;if(_0x3c349d>=_0x4270cb){_0x3c349d=_0x4270cb;_0x5d80fb=0xc8;}else{_0x5d80fb=0xce;}_0x2a1069[_0x7bc8('0x1a')](_0x5d80fb);return _0x2a1069[_0x7bc8('0x1f')](_0x7bc8('0x20'),_0x47fb8f+'-'+_0x3c349d+'/'+_0x4270cb)['json'](_0x499417);}return null;};}function patchUpdates(_0x5b4968){return function(_0x381910){try{jsonpatch[_0x7bc8('0x21')](_0x381910,_0x5b4968,!![]);}catch(_0x67c835){return BPromise[_0x7bc8('0x22')](_0x67c835);}return _0x381910[_0x7bc8('0x23')]();};}function saveUpdates(_0x5f15cb,_0x141b48){return function(_0x4a1042){if(_0x4a1042){return _0x4a1042[_0x7bc8('0x24')](_0x5f15cb)[_0x7bc8('0x25')](function(_0x13595d){return _0x13595d;});}return null;};}function removeEntity(_0x42a6d8,_0x1718a2){return function(_0x1ab2a8){if(_0x1ab2a8){return _0x1ab2a8[_0x7bc8('0x26')]()['then'](function(){_0x42a6d8[_0x7bc8('0x1a')](0xcc)[_0x7bc8('0x27')]();});}};}function handleEntityNotFound(_0x242c15,_0x1b6e4b){return function(_0x37828c){if(!_0x37828c){_0x242c15['sendStatus'](0x194);}return _0x37828c;};}function handleError(_0x4f2b53,_0x3130bf){_0x3130bf=_0x3130bf||0x1f4;return function(_0x26e4a5){logger['error'](_0x26e4a5['stack']);if(_0x26e4a5[_0x7bc8('0x28')]){delete _0x26e4a5[_0x7bc8('0x28')];}_0x4f2b53['status'](_0x3130bf)[_0x7bc8('0x29')](_0x26e4a5);};}exports['index']=function(_0x16b2fb,_0x3757fa){var _0x629238={},_0xf943d={},_0x35db77={'count':0x0,'rows':[]};var _0x1e7ca4=_['map'](db[_0x7bc8('0x2a')][_0x7bc8('0x2b')],function(_0x1fdc37){return{'name':_0x1fdc37[_0x7bc8('0x2c')],'type':_0x1fdc37[_0x7bc8('0x2d')][_0x7bc8('0x2e')]};});_0xf943d['model']=_[_0x7bc8('0x2f')](_0x1e7ca4,_0x7bc8('0x28'));_0xf943d['query']=_[_0x7bc8('0x30')](_0x16b2fb['query']);_0xf943d[_0x7bc8('0x31')]=_[_0x7bc8('0x32')](_0xf943d[_0x7bc8('0x33')],_0xf943d[_0x7bc8('0x34')]);_0x629238[_0x7bc8('0x35')]=_[_0x7bc8('0x32')](_0xf943d[_0x7bc8('0x33')],qs['fields'](_0x16b2fb[_0x7bc8('0x34')]['fields']));_0x629238[_0x7bc8('0x35')]=_0x629238[_0x7bc8('0x35')][_0x7bc8('0x36')]?_0x629238['attributes']:_0xf943d['model'];if(!_0x16b2fb[_0x7bc8('0x34')]['hasOwnProperty']('nolimit')){_0x629238[_0x7bc8('0x1e')]=qs[_0x7bc8('0x1e')](_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x1e')]);_0x629238[_0x7bc8('0x1d')]=qs['offset'](_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x1d')]);}_0x629238['order']=qs[_0x7bc8('0x37')](_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x37')]);_0x629238[_0x7bc8('0x38')]=qs[_0x7bc8('0x31')](_['pick'](_0x16b2fb[_0x7bc8('0x34')],_0xf943d['filters']),_0x1e7ca4);if(_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x39')]){_0x629238['where']=_[_0x7bc8('0x3a')](_0x629238[_0x7bc8('0x38')],{'$or':_['map'](_0x1e7ca4,function(_0x4fc2ce){if(_0x4fc2ce[_0x7bc8('0x2d')]!==_0x7bc8('0x3b')){var _0x2d5e53={};_0x2d5e53[_0x4fc2ce['name']]={'$like':'%'+_0x16b2fb[_0x7bc8('0x34')]['filter']+'%'};return _0x2d5e53;}})});}_0x629238=_[_0x7bc8('0x3a')]({},_0x629238,_0x16b2fb[_0x7bc8('0x3c')]);var _0x58472e={'where':_0x629238[_0x7bc8('0x38')]};return db[_0x7bc8('0x2a')][_0x7bc8('0x1c')](_0x58472e)[_0x7bc8('0x25')](function(_0x56f8bd){_0x35db77[_0x7bc8('0x1c')]=_0x56f8bd;if(_0x16b2fb[_0x7bc8('0x34')][_0x7bc8('0x3d')]){_0x629238[_0x7bc8('0x3e')]=[{'all':!![]}];}return db['MailServerOut'][_0x7bc8('0x3f')](_0x629238);})[_0x7bc8('0x25')](function(_0x44f829){_0x35db77['rows']=_0x44f829;return _0x35db77;})['then'](respondWithFilteredResult(_0x3757fa,_0x629238))['catch'](handleError(_0x3757fa,null));};exports['show']=function(_0x362d89,_0x3f8770){var _0xc6c9f6={'raw':!![],'where':{'id':_0x362d89[_0x7bc8('0x40')]['id']}},_0x4c673c={};_0x4c673c[_0x7bc8('0x33')]=_[_0x7bc8('0x30')](db[_0x7bc8('0x2a')][_0x7bc8('0x2b')]);_0x4c673c['query']=_['keys'](_0x362d89[_0x7bc8('0x34')]);_0x4c673c[_0x7bc8('0x31')]=_[_0x7bc8('0x32')](_0x4c673c[_0x7bc8('0x33')],_0x4c673c[_0x7bc8('0x34')]);_0xc6c9f6[_0x7bc8('0x35')]=_[_0x7bc8('0x32')](_0x4c673c[_0x7bc8('0x33')],qs[_0x7bc8('0x41')](_0x362d89['query']['fields']));_0xc6c9f6[_0x7bc8('0x35')]=_0xc6c9f6[_0x7bc8('0x35')][_0x7bc8('0x36')]?_0xc6c9f6[_0x7bc8('0x35')]:_0x4c673c[_0x7bc8('0x33')];if(_0x362d89['query'][_0x7bc8('0x3d')]){_0xc6c9f6['include']=[{'all':!![]}];}_0xc6c9f6=_[_0x7bc8('0x3a')]({},_0xc6c9f6,_0x362d89['options']);return db[_0x7bc8('0x2a')][_0x7bc8('0x42')](_0xc6c9f6)[_0x7bc8('0x25')](handleEntityNotFound(_0x3f8770,null))[_0x7bc8('0x25')](respondWithResult(_0x3f8770,null))['catch'](handleError(_0x3f8770,null));};exports['create']=function(_0x37ec7b,_0xa926df){return db[_0x7bc8('0x2a')][_0x7bc8('0x43')](_0x37ec7b[_0x7bc8('0x44')],{})[_0x7bc8('0x25')](respondWithResult(_0xa926df,0xc9))['catch'](handleError(_0xa926df,null));};exports[_0x7bc8('0x24')]=function(_0xd52c63,_0x2595c9){if(_0xd52c63[_0x7bc8('0x44')]['id']){delete _0xd52c63[_0x7bc8('0x44')]['id'];}return db[_0x7bc8('0x2a')][_0x7bc8('0x42')]({'where':{'id':_0xd52c63[_0x7bc8('0x40')]['id']}})[_0x7bc8('0x25')](handleEntityNotFound(_0x2595c9,null))['then'](saveUpdates(_0xd52c63[_0x7bc8('0x44')],null))[_0x7bc8('0x25')](respondWithResult(_0x2595c9,null))[_0x7bc8('0x45')](handleError(_0x2595c9,null));};exports[_0x7bc8('0x26')]=function(_0x5ecd76,_0x395895){return db[_0x7bc8('0x2a')][_0x7bc8('0x42')]({'where':{'id':_0x5ecd76[_0x7bc8('0x40')]['id']}})[_0x7bc8('0x25')](handleEntityNotFound(_0x395895,null))['then'](removeEntity(_0x395895,null))[_0x7bc8('0x45')](handleError(_0x395895,null));}; \ No newline at end of file +var _0x98d2=['name','send','MailServerOut','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x59001a,_0x3a3a59){var _0x4a2aa0=function(_0x124eb3){while(--_0x124eb3){_0x59001a['push'](_0x59001a['shift']());}};_0x4a2aa0(++_0x3a3a59);}(_0x98d2,0xb3));var _0x298d=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x98d2[_0x1de43c];return _0x296d3e;};'use strict';var pdf=require(_0x298d('0x0'));var emlformat=require(_0x298d('0x1'));var rimraf=require(_0x298d('0x2'));var zipdir=require(_0x298d('0x3'));var jsonpatch=require(_0x298d('0x4'));var rp=require(_0x298d('0x5'));var moment=require(_0x298d('0x6'));var BPromise=require(_0x298d('0x7'));var Mustache=require(_0x298d('0x8'));var util=require('util');var path=require(_0x298d('0x9'));var sox=require(_0x298d('0xa'));var csv=require('to-csv');var ejs=require(_0x298d('0xb'));var fs=require('fs');var _=require(_0x298d('0xc'));var squel=require(_0x298d('0xd'));var crypto=require('crypto');var jsforce=require(_0x298d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x298d('0xf'));var Papa=require('papaparse');var Redis=require(_0x298d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x298d('0x11'));var as=require(_0x298d('0x12'));var hardwareService=require(_0x298d('0x13'));var logger=require(_0x298d('0x14'))(_0x298d('0x15'));var utils=require(_0x298d('0x16'));var config=require(_0x298d('0x17'));var db=require(_0x298d('0x18'))['db'];function respondWithStatusCode(_0xdda1cb,_0x5326ff){_0x5326ff=_0x5326ff||0xcc;return function(_0xcde3b1){if(_0xcde3b1){return _0xdda1cb['sendStatus'](_0x5326ff);}return _0xdda1cb['status'](_0x5326ff)[_0x298d('0x19')]();};}function respondWithResult(_0x3dea4a,_0x30c0e3){_0x30c0e3=_0x30c0e3||0xc8;return function(_0x2e06c1){if(_0x2e06c1){return _0x3dea4a[_0x298d('0x1a')](_0x30c0e3)[_0x298d('0x1b')](_0x2e06c1);}};}function respondWithFilteredResult(_0x4f634a,_0x4a641b){return function(_0x1c6b1e){if(_0x1c6b1e){var _0x5ba082=_0x1c6b1e['count'],_0x55f5a3=_0x4a641b[_0x298d('0x1c')],_0x424974=_0x4a641b[_0x298d('0x1c')]+_0x4a641b[_0x298d('0x1d')],_0x180366;if(_0x424974>=_0x5ba082){_0x424974=_0x5ba082;_0x180366=0xc8;}else{_0x180366=0xce;}_0x4f634a['status'](_0x180366);return _0x4f634a[_0x298d('0x1e')](_0x298d('0x1f'),_0x55f5a3+'-'+_0x424974+'/'+_0x5ba082)['json'](_0x1c6b1e);}return null;};}function patchUpdates(_0x19f153){return function(_0x5a9710){try{jsonpatch['apply'](_0x5a9710,_0x19f153,!![]);}catch(_0x37b119){return BPromise[_0x298d('0x20')](_0x37b119);}return _0x5a9710[_0x298d('0x21')]();};}function saveUpdates(_0x49bfc6,_0x59a5c2){return function(_0x39a942){if(_0x39a942){return _0x39a942[_0x298d('0x22')](_0x49bfc6)[_0x298d('0x23')](function(_0x2ece29){return _0x2ece29;});}return null;};}function removeEntity(_0x48f58a,_0xa51293){return function(_0x4cc025){if(_0x4cc025){return _0x4cc025[_0x298d('0x24')]()[_0x298d('0x23')](function(){_0x48f58a[_0x298d('0x1a')](0xcc)[_0x298d('0x19')]();});}};}function handleEntityNotFound(_0x4f2323,_0x10e07a){return function(_0x49599e){if(!_0x49599e){_0x4f2323[_0x298d('0x25')](0x194);}return _0x49599e;};}function handleError(_0x37ae33,_0x439911){_0x439911=_0x439911||0x1f4;return function(_0x4e37c0){logger[_0x298d('0x26')](_0x4e37c0[_0x298d('0x27')]);if(_0x4e37c0[_0x298d('0x28')]){delete _0x4e37c0[_0x298d('0x28')];}_0x37ae33[_0x298d('0x1a')](_0x439911)[_0x298d('0x29')](_0x4e37c0);};}exports['index']=function(_0x5e2da8,_0x5d2d26){var _0x1e2a52={},_0x55ec55={},_0x5370d8={'count':0x0,'rows':[]};var _0xb77f28=_['map'](db[_0x298d('0x2a')][_0x298d('0x2b')],function(_0x1b015e){return{'name':_0x1b015e[_0x298d('0x2c')],'type':_0x1b015e['type']['key']};});_0x55ec55[_0x298d('0x2d')]=_[_0x298d('0x2e')](_0xb77f28,_0x298d('0x28'));_0x55ec55[_0x298d('0x2f')]=_[_0x298d('0x30')](_0x5e2da8[_0x298d('0x2f')]);_0x55ec55[_0x298d('0x31')]=_[_0x298d('0x32')](_0x55ec55['model'],_0x55ec55[_0x298d('0x2f')]);_0x1e2a52[_0x298d('0x33')]=_['intersection'](_0x55ec55[_0x298d('0x2d')],qs[_0x298d('0x34')](_0x5e2da8['query']['fields']));_0x1e2a52['attributes']=_0x1e2a52['attributes'][_0x298d('0x35')]?_0x1e2a52['attributes']:_0x55ec55[_0x298d('0x2d')];if(!_0x5e2da8[_0x298d('0x2f')][_0x298d('0x36')](_0x298d('0x37'))){_0x1e2a52[_0x298d('0x1d')]=qs[_0x298d('0x1d')](_0x5e2da8[_0x298d('0x2f')][_0x298d('0x1d')]);_0x1e2a52[_0x298d('0x1c')]=qs[_0x298d('0x1c')](_0x5e2da8[_0x298d('0x2f')][_0x298d('0x1c')]);}_0x1e2a52['order']=qs[_0x298d('0x38')](_0x5e2da8['query'][_0x298d('0x38')]);_0x1e2a52[_0x298d('0x39')]=qs[_0x298d('0x31')](_['pick'](_0x5e2da8[_0x298d('0x2f')],_0x55ec55[_0x298d('0x31')]),_0xb77f28);if(_0x5e2da8[_0x298d('0x2f')][_0x298d('0x3a')]){_0x1e2a52[_0x298d('0x39')]=_[_0x298d('0x3b')](_0x1e2a52[_0x298d('0x39')],{'$or':_[_0x298d('0x2e')](_0xb77f28,function(_0x32de84){if(_0x32de84[_0x298d('0x3c')]!==_0x298d('0x3d')){var _0x2ca7a5={};_0x2ca7a5[_0x32de84[_0x298d('0x28')]]={'$like':'%'+_0x5e2da8[_0x298d('0x2f')][_0x298d('0x3a')]+'%'};return _0x2ca7a5;}})});}_0x1e2a52=_['merge']({},_0x1e2a52,_0x5e2da8[_0x298d('0x3e')]);var _0xed1c1c={'where':_0x1e2a52[_0x298d('0x39')]};return db[_0x298d('0x2a')][_0x298d('0x3f')](_0xed1c1c)[_0x298d('0x23')](function(_0x2ff8a4){_0x5370d8['count']=_0x2ff8a4;if(_0x5e2da8[_0x298d('0x2f')][_0x298d('0x40')]){_0x1e2a52[_0x298d('0x41')]=[{'all':!![]}];}return db[_0x298d('0x2a')][_0x298d('0x42')](_0x1e2a52);})['then'](function(_0x426b35){_0x5370d8['rows']=_0x426b35;return _0x5370d8;})[_0x298d('0x23')](respondWithFilteredResult(_0x5d2d26,_0x1e2a52))[_0x298d('0x43')](handleError(_0x5d2d26,null));};exports[_0x298d('0x44')]=function(_0x22eefd,_0x175856){var _0x253a42={'raw':!![],'where':{'id':_0x22eefd['params']['id']}},_0x3e99c3={};_0x3e99c3[_0x298d('0x2d')]=_[_0x298d('0x30')](db[_0x298d('0x2a')]['rawAttributes']);_0x3e99c3[_0x298d('0x2f')]=_[_0x298d('0x30')](_0x22eefd[_0x298d('0x2f')]);_0x3e99c3[_0x298d('0x31')]=_['intersection'](_0x3e99c3[_0x298d('0x2d')],_0x3e99c3['query']);_0x253a42['attributes']=_[_0x298d('0x32')](_0x3e99c3['model'],qs['fields'](_0x22eefd[_0x298d('0x2f')][_0x298d('0x34')]));_0x253a42['attributes']=_0x253a42['attributes'][_0x298d('0x35')]?_0x253a42[_0x298d('0x33')]:_0x3e99c3['model'];if(_0x22eefd['query'][_0x298d('0x40')]){_0x253a42[_0x298d('0x41')]=[{'all':!![]}];}_0x253a42=_[_0x298d('0x3b')]({},_0x253a42,_0x22eefd[_0x298d('0x3e')]);return db[_0x298d('0x2a')][_0x298d('0x45')](_0x253a42)['then'](handleEntityNotFound(_0x175856,null))['then'](respondWithResult(_0x175856,null))[_0x298d('0x43')](handleError(_0x175856,null));};exports[_0x298d('0x46')]=function(_0x5bab11,_0x519f13){return db['MailServerOut'][_0x298d('0x46')](_0x5bab11[_0x298d('0x47')],{})[_0x298d('0x23')](respondWithResult(_0x519f13,0xc9))[_0x298d('0x43')](handleError(_0x519f13,null));};exports[_0x298d('0x22')]=function(_0x5b497a,_0x3948dc){if(_0x5b497a[_0x298d('0x47')]['id']){delete _0x5b497a['body']['id'];}return db[_0x298d('0x2a')]['find']({'where':{'id':_0x5b497a[_0x298d('0x48')]['id']}})['then'](handleEntityNotFound(_0x3948dc,null))[_0x298d('0x23')](saveUpdates(_0x5b497a[_0x298d('0x47')],null))[_0x298d('0x23')](respondWithResult(_0x3948dc,null))[_0x298d('0x43')](handleError(_0x3948dc,null));};exports[_0x298d('0x24')]=function(_0x3f395d,_0x2502af){return db[_0x298d('0x2a')][_0x298d('0x45')]({'where':{'id':_0x3f395d['params']['id']}})['then'](handleEntityNotFound(_0x2502af,null))[_0x298d('0x23')](removeEntity(_0x2502af,null))[_0x298d('0x43')](handleError(_0x2502af,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 71dbce2..0f6aaea 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 _0x41b9=['api','moment','request-promise','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger'];(function(_0x30f6f6,_0x5f0f90){var _0x43b46a=function(_0x10004e){while(--_0x10004e){_0x30f6f6['push'](_0x30f6f6['shift']());}};_0x43b46a(++_0x5f0f90);}(_0x41b9,0xc4));var _0x941b=function(_0x3c3753,_0x47b6e5){_0x3c3753=_0x3c3753-0x0;var _0x482a5d=_0x41b9[_0x3c3753];return _0x482a5d;};'use strict';var _=require(_0x941b('0x0'));var util=require('util');var logger=require(_0x941b('0x1'))(_0x941b('0x2'));var moment=require(_0x941b('0x3'));var BPromise=require('bluebird');var rp=require(_0x941b('0x4'));var fs=require('fs');var path=require(_0x941b('0x5'));var rimraf=require(_0x941b('0x6'));var config=require('../../config/environment');var attributes=require(_0x941b('0x7'));module[_0x941b('0x8')]=function(_0x108061,_0x1796c8){return _0x108061[_0x941b('0x9')](_0x941b('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4824=['../../config/logger','api','request-promise','path','../../config/environment','./mailServerOut.attributes','define','mail_servers_out','util'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x4824,0xe9));var _0x4482=function(_0x4ecb4f,_0x2b5f7e){_0x4ecb4f=_0x4ecb4f-0x0;var _0x1305b6=_0x4824[_0x4ecb4f];return _0x1305b6;};'use strict';var _=require('lodash');var util=require(_0x4482('0x0'));var logger=require(_0x4482('0x1'))(_0x4482('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4482('0x3'));var fs=require('fs');var path=require(_0x4482('0x4'));var rimraf=require('rimraf');var config=require(_0x4482('0x5'));var attributes=require(_0x4482('0x6'));module['exports']=function(_0x5389da,_0x20bb5c){return _0x5389da[_0x4482('0x7')]('MailServerOut',attributes,{'tableName':_0x4482('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index f06dba2..a365465 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 _0x4c9c=['stringify','error','code','message','info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0x4c9c,0x101));var _0xc4c9=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x4c9c[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xc4c9('0x0'));var util=require(_0xc4c9('0x1'));var moment=require('moment');var BPromise=require(_0xc4c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4c9('0x3'));var db=require(_0xc4c9('0x4'))['db'];var utils=require(_0xc4c9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4c9('0x6'));var jayson=require(_0xc4c9('0x7'));var client=jayson[_0xc4c9('0x8')][_0xc4c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f6f3f,_0x2f8aeb,_0x387a1f){return new BPromise(function(_0x656673,_0x3f466d){return client[_0xc4c9('0xa')](_0x1f6f3f,_0x387a1f)[_0xc4c9('0xb')](function(_0x5588dd){logger['info'](_0xc4c9('0xc'),_0x2f8aeb,_0xc4c9('0xd'));logger[_0xc4c9('0xe')](_0xc4c9('0xf'),_0x2f8aeb,_0xc4c9('0xd'),JSON[_0xc4c9('0x10')](_0x5588dd));if(_0x5588dd[_0xc4c9('0x11')]){if(_0x5588dd[_0xc4c9('0x11')][_0xc4c9('0x12')]===0x1f4){logger['error'](_0xc4c9('0xc'),_0x2f8aeb,_0x5588dd['error'][_0xc4c9('0x13')]);return _0x3f466d(_0x5588dd[_0xc4c9('0x11')][_0xc4c9('0x13')]);}logger[_0xc4c9('0x11')](_0xc4c9('0xc'),_0x2f8aeb,_0x5588dd['error'][_0xc4c9('0x13')]);return _0x656673(_0x5588dd[_0xc4c9('0x11')][_0xc4c9('0x13')]);}else{logger[_0xc4c9('0x14')](_0xc4c9('0xc'),_0x2f8aeb,_0xc4c9('0xd'));_0x656673(_0x5588dd['result']['message']);}})['catch'](function(_0xa43e94){logger[_0xc4c9('0x11')](_0xc4c9('0xc'),_0x2f8aeb,_0xa43e94);_0x3f466d(_0xa43e94);});});} \ No newline at end of file +var _0x51e2=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x51e2,0x175));var _0x251e=function(_0x361d69,_0x18dbc3){_0x361d69=_0x361d69-0x0;var _0x57d702=_0x51e2[_0x361d69];return _0x57d702;};'use strict';var _=require(_0x251e('0x0'));var util=require(_0x251e('0x1'));var moment=require(_0x251e('0x2'));var BPromise=require(_0x251e('0x3'));var rs=require(_0x251e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x251e('0x5'));var logger=require('../../config/logger')(_0x251e('0x6'));var config=require(_0x251e('0x7'));var jayson=require(_0x251e('0x8'));var client=jayson[_0x251e('0x9')][_0x251e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5236fe,_0x3268cc,_0x49dfbe){return new BPromise(function(_0x3b8987,_0x14b91f){return client[_0x251e('0xb')](_0x5236fe,_0x49dfbe)[_0x251e('0xc')](function(_0x1dab47){logger[_0x251e('0xd')](_0x251e('0xe'),_0x3268cc,_0x251e('0xf'));logger[_0x251e('0x10')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3268cc,_0x251e('0xf'),JSON[_0x251e('0x11')](_0x1dab47));if(_0x1dab47[_0x251e('0x12')]){if(_0x1dab47['error']['code']===0x1f4){logger[_0x251e('0x12')](_0x251e('0xe'),_0x3268cc,_0x1dab47['error'][_0x251e('0x13')]);return _0x14b91f(_0x1dab47[_0x251e('0x12')]['message']);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x3268cc,_0x1dab47[_0x251e('0x12')]['message']);return _0x3b8987(_0x1dab47[_0x251e('0x12')][_0x251e('0x13')]);}else{logger[_0x251e('0xd')](_0x251e('0xe'),_0x3268cc,'request\x20sent');_0x3b8987(_0x1dab47['result'][_0x251e('0x13')]);}})[_0x251e('0x14')](function(_0x140498){logger[_0x251e('0x12')](_0x251e('0xe'),_0x3268cc,_0x140498);_0x14b91f(_0x140498);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index dfc91b8..2718318 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 _0x447b=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','post','create','put'];(function(_0x5614a3,_0x1ebbb3){var _0x15f60c=function(_0x213c69){while(--_0x213c69){_0x5614a3['push'](_0x5614a3['shift']());}};_0x15f60c(++_0x1ebbb3);}(_0x447b,0xc2));var _0xb447=function(_0x25cc1b,_0x463bba){_0x25cc1b=_0x25cc1b-0x0;var _0x26cf11=_0x447b[_0x25cc1b];return _0x26cf11;};'use strict';var multer=require(_0xb447('0x0'));var util=require('util');var path=require(_0xb447('0x1'));var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb447('0x5'));var config=require(_0xb447('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xb447('0x7')](),controller[_0xb447('0x8')]);router['get']('/describe',auth[_0xb447('0x7')](),controller[_0xb447('0x9')]);router[_0xb447('0xa')](_0xb447('0xb'),auth[_0xb447('0x7')](),controller['show']);router[_0xb447('0xc')]('/',auth[_0xb447('0x7')](),controller[_0xb447('0xd')]);router[_0xb447('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb447('0xf')]);router[_0xb447('0x10')](_0xb447('0xb'),auth[_0xb447('0x7')](),controller[_0xb447('0x11')]);module[_0xb447('0x12')]=router; \ No newline at end of file +var _0x475e=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','describe','/:id','isAuthenticated','show','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x33e982,_0x1d15b1){var _0x2d3668=function(_0x3c16d5){while(--_0x3c16d5){_0x33e982['push'](_0x33e982['shift']());}};_0x2d3668(++_0x1d15b1);}(_0x475e,0x17b));var _0xe475=function(_0x5b9153,_0x251fb3){_0x5b9153=_0x5b9153-0x0;var _0x1bde0f=_0x475e[_0x5b9153];return _0x1bde0f;};'use strict';var multer=require(_0xe475('0x0'));var util=require(_0xe475('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe475('0x2'));var router=express[_0xe475('0x3')]();var auth=require(_0xe475('0x4'));var interaction=require(_0xe475('0x5'));var config=require(_0xe475('0x6'));var controller=require(_0xe475('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe475('0x8')](_0xe475('0x9'),auth['isAuthenticated'](),controller[_0xe475('0xa')]);router[_0xe475('0x8')](_0xe475('0xb'),auth[_0xe475('0xc')](),controller[_0xe475('0xd')]);router['post']('/',auth[_0xe475('0xc')](),controller['create']);router['put'](_0xe475('0xb'),auth[_0xe475('0xc')](),controller['update']);router['delete'](_0xe475('0xb'),auth[_0xe475('0xc')](),controller[_0xe475('0xe')]);module[_0xe475('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 402f74a..0745ea6 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 _0xa5aa=['sequelize','exports','name','STRING'];(function(_0x4aeb1f,_0x135770){var _0x371689=function(_0x2b647b){while(--_0x2b647b){_0x4aeb1f['push'](_0x4aeb1f['shift']());}};_0x371689(++_0x135770);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x5eb27c,_0x2af03d){_0x5eb27c=_0x5eb27c-0x0;var _0x1be9a9=_0xa5aa[_0x5eb27c];return _0x1be9a9;};'use strict';var Sequelize=require(_0xaa5a('0x0'));module[_0xaa5a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaa5a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa5a('0x3')]}}; \ No newline at end of file +var _0x3e0c=['exports','STRING','sequelize'];(function(_0x5a7c1e,_0x17e6c1){var _0x33af8e=function(_0x5b6c17){while(--_0x5b6c17){_0x5a7c1e['push'](_0x5a7c1e['shift']());}};_0x33af8e(++_0x17e6c1);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x34360e,_0x1009d6){_0x34360e=_0x34360e-0x0;var _0x4c19c7=_0x3e0c[_0x34360e];return _0x4c19c7;};'use strict';var Sequelize=require(_0xc3e0('0x0'));module[_0xc3e0('0x1')]={'name':{'type':Sequelize[_0xc3e0('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc3e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 80663f1..3ebb41f 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 _0xe7d9=['send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','rows','show','filters','include','options','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name'];(function(_0x32fee3,_0x25d761){var _0x4d560e=function(_0x25b630){while(--_0x25b630){_0x32fee3['push'](_0x32fee3['shift']());}};_0x4d560e(++_0x25d761);}(_0xe7d9,0xbe));var _0x9e7d=function(_0x31669f,_0x51ad35){_0x31669f=_0x31669f-0x0;var _0x33f0fb=_0xe7d9[_0x31669f];return _0x33f0fb;};'use strict';var pdf=require(_0x9e7d('0x0'));var emlformat=require(_0x9e7d('0x1'));var rimraf=require(_0x9e7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e7d('0x3'));var rp=require(_0x9e7d('0x4'));var moment=require(_0x9e7d('0x5'));var BPromise=require(_0x9e7d('0x6'));var Mustache=require(_0x9e7d('0x7'));var util=require(_0x9e7d('0x8'));var path=require(_0x9e7d('0x9'));var sox=require(_0x9e7d('0xa'));var csv=require(_0x9e7d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e7d('0xc'));var squel=require(_0x9e7d('0xd'));var crypto=require(_0x9e7d('0xe'));var jsforce=require(_0x9e7d('0xf'));var deskjs=require(_0x9e7d('0x10'));var toCsv=require(_0x9e7d('0xb'));var querystring=require(_0x9e7d('0x11'));var Papa=require(_0x9e7d('0x12'));var Redis=require(_0x9e7d('0x13'));var authService=require(_0x9e7d('0x14'));var qs=require(_0x9e7d('0x15'));var as=require(_0x9e7d('0x16'));var hardwareService=require(_0x9e7d('0x17'));var logger=require(_0x9e7d('0x18'))(_0x9e7d('0x19'));var utils=require('../../config/utils');var config=require(_0x9e7d('0x1a'));var db=require(_0x9e7d('0x1b'))['db'];function respondWithStatusCode(_0x28571c,_0x53c8c9){_0x53c8c9=_0x53c8c9||0xcc;return function(_0x1da418){if(_0x1da418){return _0x28571c[_0x9e7d('0x1c')](_0x53c8c9);}return _0x28571c[_0x9e7d('0x1d')](_0x53c8c9)[_0x9e7d('0x1e')]();};}function respondWithResult(_0x859008,_0xb865c1){_0xb865c1=_0xb865c1||0xc8;return function(_0x5927e6){if(_0x5927e6){return _0x859008['status'](_0xb865c1)[_0x9e7d('0x1f')](_0x5927e6);}};}function respondWithFilteredResult(_0x12a347,_0x40f597){return function(_0x1ef893){if(_0x1ef893){var _0x5949b9=_0x1ef893[_0x9e7d('0x20')],_0x3286aa=_0x40f597[_0x9e7d('0x21')],_0x2312ab=_0x40f597[_0x9e7d('0x21')]+_0x40f597[_0x9e7d('0x22')],_0x1af334;if(_0x2312ab>=_0x5949b9){_0x2312ab=_0x5949b9;_0x1af334=0xc8;}else{_0x1af334=0xce;}_0x12a347[_0x9e7d('0x1d')](_0x1af334);return _0x12a347[_0x9e7d('0x23')](_0x9e7d('0x24'),_0x3286aa+'-'+_0x2312ab+'/'+_0x5949b9)[_0x9e7d('0x1f')](_0x1ef893);}return null;};}function patchUpdates(_0x53c268){return function(_0x4af629){try{jsonpatch[_0x9e7d('0x25')](_0x4af629,_0x53c268,!![]);}catch(_0x2640e0){return BPromise[_0x9e7d('0x26')](_0x2640e0);}return _0x4af629['save']();};}function saveUpdates(_0x1b1508,_0x32da38){return function(_0x2c243e){if(_0x2c243e){return _0x2c243e[_0x9e7d('0x27')](_0x1b1508)['then'](function(_0x5ce19a){return _0x5ce19a;});}return null;};}function removeEntity(_0x3ea187,_0x477bf9){return function(_0x2f7e69){if(_0x2f7e69){return _0x2f7e69[_0x9e7d('0x28')]()[_0x9e7d('0x29')](function(){_0x3ea187[_0x9e7d('0x1d')](0xcc)[_0x9e7d('0x1e')]();});}};}function handleEntityNotFound(_0x12f787,_0x5be604){return function(_0x765c09){if(!_0x765c09){_0x12f787[_0x9e7d('0x1c')](0x194);}return _0x765c09;};}function handleError(_0x3ac256,_0x22586e){_0x22586e=_0x22586e||0x1f4;return function(_0xb80fa4){logger['error'](_0xb80fa4[_0x9e7d('0x2a')]);if(_0xb80fa4[_0x9e7d('0x2b')]){delete _0xb80fa4[_0x9e7d('0x2b')];}_0x3ac256[_0x9e7d('0x1d')](_0x22586e)[_0x9e7d('0x2c')](_0xb80fa4);};}exports[_0x9e7d('0x2d')]=function(_0x3a220c,_0x45f33c){var _0x107f47={},_0x409683={},_0x272495={'count':0x0,'rows':[]};var _0x49915c=_[_0x9e7d('0x2e')](db[_0x9e7d('0x2f')]['rawAttributes'],function(_0x33609b){return{'name':_0x33609b[_0x9e7d('0x30')],'type':_0x33609b[_0x9e7d('0x31')][_0x9e7d('0x32')]};});_0x409683[_0x9e7d('0x33')]=_['map'](_0x49915c,'name');_0x409683[_0x9e7d('0x34')]=_[_0x9e7d('0x35')](_0x3a220c['query']);_0x409683['filters']=_[_0x9e7d('0x36')](_0x409683[_0x9e7d('0x33')],_0x409683[_0x9e7d('0x34')]);_0x107f47['attributes']=_[_0x9e7d('0x36')](_0x409683[_0x9e7d('0x33')],qs[_0x9e7d('0x37')](_0x3a220c['query'][_0x9e7d('0x37')]));_0x107f47[_0x9e7d('0x38')]=_0x107f47[_0x9e7d('0x38')][_0x9e7d('0x39')]?_0x107f47[_0x9e7d('0x38')]:_0x409683[_0x9e7d('0x33')];if(!_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3a')](_0x9e7d('0x3b'))){_0x107f47[_0x9e7d('0x22')]=qs[_0x9e7d('0x22')](_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x22')]);_0x107f47[_0x9e7d('0x21')]=qs[_0x9e7d('0x21')](_0x3a220c[_0x9e7d('0x34')]['offset']);}_0x107f47[_0x9e7d('0x3c')]=qs['sort'](_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3d')]);_0x107f47['where']=qs['filters'](_['pick'](_0x3a220c['query'],_0x409683['filters']),_0x49915c);if(_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3e')]){_0x107f47[_0x9e7d('0x3f')]=_[_0x9e7d('0x40')](_0x107f47[_0x9e7d('0x3f')],{'$or':_[_0x9e7d('0x2e')](_0x49915c,function(_0x572bc5){if(_0x572bc5[_0x9e7d('0x31')]!==_0x9e7d('0x41')){var _0x1e14ad={};_0x1e14ad[_0x572bc5['name']]={'$like':'%'+_0x3a220c[_0x9e7d('0x34')][_0x9e7d('0x3e')]+'%'};return _0x1e14ad;}})});}_0x107f47=_[_0x9e7d('0x40')]({},_0x107f47,_0x3a220c['options']);var _0x29ee8d={'where':_0x107f47['where']};return db[_0x9e7d('0x2f')][_0x9e7d('0x20')](_0x29ee8d)[_0x9e7d('0x29')](function(_0x23a6de){_0x272495[_0x9e7d('0x20')]=_0x23a6de;if(_0x3a220c['query'][_0x9e7d('0x42')]){_0x107f47['include']=[{'all':!![]}];}return db[_0x9e7d('0x2f')]['findAll'](_0x107f47);})[_0x9e7d('0x29')](function(_0x154a33){_0x272495[_0x9e7d('0x43')]=_0x154a33;return _0x272495;})[_0x9e7d('0x29')](respondWithFilteredResult(_0x45f33c,_0x107f47))['catch'](handleError(_0x45f33c,null));};exports[_0x9e7d('0x44')]=function(_0x13d176,_0x1cd66d){var _0x2ec352={'raw':!![],'where':{'id':_0x13d176['params']['id']}},_0x14fbb9={};_0x14fbb9[_0x9e7d('0x33')]=_[_0x9e7d('0x35')](db[_0x9e7d('0x2f')]['rawAttributes']);_0x14fbb9[_0x9e7d('0x34')]=_[_0x9e7d('0x35')](_0x13d176[_0x9e7d('0x34')]);_0x14fbb9[_0x9e7d('0x45')]=_['intersection'](_0x14fbb9[_0x9e7d('0x33')],_0x14fbb9[_0x9e7d('0x34')]);_0x2ec352[_0x9e7d('0x38')]=_[_0x9e7d('0x36')](_0x14fbb9[_0x9e7d('0x33')],qs[_0x9e7d('0x37')](_0x13d176[_0x9e7d('0x34')][_0x9e7d('0x37')]));_0x2ec352[_0x9e7d('0x38')]=_0x2ec352[_0x9e7d('0x38')]['length']?_0x2ec352['attributes']:_0x14fbb9['model'];if(_0x13d176[_0x9e7d('0x34')][_0x9e7d('0x42')]){_0x2ec352[_0x9e7d('0x46')]=[{'all':!![]}];}_0x2ec352=_[_0x9e7d('0x40')]({},_0x2ec352,_0x13d176[_0x9e7d('0x47')]);return db[_0x9e7d('0x2f')]['find'](_0x2ec352)[_0x9e7d('0x29')](handleEntityNotFound(_0x1cd66d,null))['then'](respondWithResult(_0x1cd66d,null))[_0x9e7d('0x48')](handleError(_0x1cd66d,null));};exports['create']=function(_0x1be751,_0x222872){return db[_0x9e7d('0x2f')][_0x9e7d('0x49')](_0x1be751['body'],{})[_0x9e7d('0x29')](respondWithResult(_0x222872,0xc9))[_0x9e7d('0x48')](handleError(_0x222872,null));};exports[_0x9e7d('0x27')]=function(_0xe342ce,_0x365976){if(_0xe342ce[_0x9e7d('0x4a')]['id']){delete _0xe342ce[_0x9e7d('0x4a')]['id'];}return db['MailSubstatus'][_0x9e7d('0x4b')]({'where':{'id':_0xe342ce[_0x9e7d('0x4c')]['id']}})[_0x9e7d('0x29')](handleEntityNotFound(_0x365976,null))[_0x9e7d('0x29')](saveUpdates(_0xe342ce[_0x9e7d('0x4a')],null))[_0x9e7d('0x29')](respondWithResult(_0x365976,null))[_0x9e7d('0x48')](handleError(_0x365976,null));};exports['destroy']=function(_0x187873,_0x5ee406){return db['MailSubstatus'][_0x9e7d('0x4b')]({'where':{'id':_0x187873[_0x9e7d('0x4c')]['id']}})[_0x9e7d('0x29')](handleEntityNotFound(_0x5ee406,null))[_0x9e7d('0x29')](removeEntity(_0x5ee406,null))[_0x9e7d('0x48')](handleError(_0x5ee406,null));};exports[_0x9e7d('0x4d')]=function(_0x2caaa1,_0x1e3171){return db[_0x9e7d('0x2f')]['describe']()[_0x9e7d('0x29')](respondWithResult(_0x1e3171,null))[_0x9e7d('0x48')](handleError(_0x1e3171,null));}; \ No newline at end of file +var _0xbca6=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailSubstatus','include','findAll','catch','show','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xbca6,0xf6));var _0x6bca=function(_0x16faf2,_0x45b50b){_0x16faf2=_0x16faf2-0x0;var _0x472a=_0xbca6[_0x16faf2];return _0x472a;};'use strict';var pdf=require(_0x6bca('0x0'));var emlformat=require(_0x6bca('0x1'));var rimraf=require(_0x6bca('0x2'));var zipdir=require(_0x6bca('0x3'));var jsonpatch=require(_0x6bca('0x4'));var rp=require(_0x6bca('0x5'));var moment=require(_0x6bca('0x6'));var BPromise=require(_0x6bca('0x7'));var Mustache=require(_0x6bca('0x8'));var util=require(_0x6bca('0x9'));var path=require(_0x6bca('0xa'));var sox=require(_0x6bca('0xb'));var csv=require(_0x6bca('0xc'));var ejs=require(_0x6bca('0xd'));var fs=require('fs');var _=require(_0x6bca('0xe'));var squel=require('squel');var crypto=require(_0x6bca('0xf'));var jsforce=require(_0x6bca('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6bca('0xc'));var querystring=require(_0x6bca('0x11'));var Papa=require('papaparse');var Redis=require(_0x6bca('0x12'));var authService=require(_0x6bca('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6bca('0x14'));var hardwareService=require(_0x6bca('0x15'));var logger=require(_0x6bca('0x16'))(_0x6bca('0x17'));var utils=require('../../config/utils');var config=require(_0x6bca('0x18'));var db=require(_0x6bca('0x19'))['db'];function respondWithStatusCode(_0x29cf16,_0x31b13e){_0x31b13e=_0x31b13e||0xcc;return function(_0x3f5c83){if(_0x3f5c83){return _0x29cf16['sendStatus'](_0x31b13e);}return _0x29cf16[_0x6bca('0x1a')](_0x31b13e)[_0x6bca('0x1b')]();};}function respondWithResult(_0x513fe2,_0x1ea531){_0x1ea531=_0x1ea531||0xc8;return function(_0x3460cf){if(_0x3460cf){return _0x513fe2['status'](_0x1ea531)['json'](_0x3460cf);}};}function respondWithFilteredResult(_0x87a85,_0x5ba59e){return function(_0x507e92){if(_0x507e92){var _0x2351d7=_0x507e92[_0x6bca('0x1c')],_0x4f8dc0=_0x5ba59e[_0x6bca('0x1d')],_0x282d3a=_0x5ba59e[_0x6bca('0x1d')]+_0x5ba59e['limit'],_0x554025;if(_0x282d3a>=_0x2351d7){_0x282d3a=_0x2351d7;_0x554025=0xc8;}else{_0x554025=0xce;}_0x87a85[_0x6bca('0x1a')](_0x554025);return _0x87a85[_0x6bca('0x1e')](_0x6bca('0x1f'),_0x4f8dc0+'-'+_0x282d3a+'/'+_0x2351d7)['json'](_0x507e92);}return null;};}function patchUpdates(_0x302f66){return function(_0x5df83d){try{jsonpatch['apply'](_0x5df83d,_0x302f66,!![]);}catch(_0x58362e){return BPromise['reject'](_0x58362e);}return _0x5df83d[_0x6bca('0x20')]();};}function saveUpdates(_0x599473,_0x470d3b){return function(_0x5099cb){if(_0x5099cb){return _0x5099cb['update'](_0x599473)[_0x6bca('0x21')](function(_0x5335b3){return _0x5335b3;});}return null;};}function removeEntity(_0x5a7aad,_0x4d5d5c){return function(_0x4062d1){if(_0x4062d1){return _0x4062d1[_0x6bca('0x22')]()['then'](function(){_0x5a7aad['status'](0xcc)[_0x6bca('0x1b')]();});}};}function handleEntityNotFound(_0xa9fbd1,_0x3f4eea){return function(_0x1134f8){if(!_0x1134f8){_0xa9fbd1['sendStatus'](0x194);}return _0x1134f8;};}function handleError(_0x42c3f6,_0x34f95d){_0x34f95d=_0x34f95d||0x1f4;return function(_0xaf8d02){logger['error'](_0xaf8d02[_0x6bca('0x23')]);if(_0xaf8d02['name']){delete _0xaf8d02[_0x6bca('0x24')];}_0x42c3f6[_0x6bca('0x1a')](_0x34f95d)[_0x6bca('0x25')](_0xaf8d02);};}exports['index']=function(_0x3cea8c,_0x2db392){var _0xba2661={},_0x287ea6={},_0xaf1685={'count':0x0,'rows':[]};var _0x2803c6=_[_0x6bca('0x26')](db['MailSubstatus'][_0x6bca('0x27')],function(_0x328f4f){return{'name':_0x328f4f[_0x6bca('0x28')],'type':_0x328f4f[_0x6bca('0x29')]['key']};});_0x287ea6[_0x6bca('0x2a')]=_[_0x6bca('0x26')](_0x2803c6,_0x6bca('0x24'));_0x287ea6[_0x6bca('0x2b')]=_[_0x6bca('0x2c')](_0x3cea8c[_0x6bca('0x2b')]);_0x287ea6[_0x6bca('0x2d')]=_[_0x6bca('0x2e')](_0x287ea6[_0x6bca('0x2a')],_0x287ea6['query']);_0xba2661[_0x6bca('0x2f')]=_[_0x6bca('0x2e')](_0x287ea6[_0x6bca('0x2a')],qs[_0x6bca('0x30')](_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x30')]));_0xba2661[_0x6bca('0x2f')]=_0xba2661[_0x6bca('0x2f')][_0x6bca('0x31')]?_0xba2661['attributes']:_0x287ea6[_0x6bca('0x2a')];if(!_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x32')](_0x6bca('0x33'))){_0xba2661[_0x6bca('0x34')]=qs[_0x6bca('0x34')](_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x34')]);_0xba2661['offset']=qs[_0x6bca('0x1d')](_0x3cea8c[_0x6bca('0x2b')][_0x6bca('0x1d')]);}_0xba2661[_0x6bca('0x35')]=qs[_0x6bca('0x36')](_0x3cea8c['query'][_0x6bca('0x36')]);_0xba2661['where']=qs[_0x6bca('0x2d')](_[_0x6bca('0x37')](_0x3cea8c[_0x6bca('0x2b')],_0x287ea6[_0x6bca('0x2d')]),_0x2803c6);if(_0x3cea8c['query'][_0x6bca('0x38')]){_0xba2661[_0x6bca('0x39')]=_[_0x6bca('0x3a')](_0xba2661[_0x6bca('0x39')],{'$or':_['map'](_0x2803c6,function(_0x3e9d1f){if(_0x3e9d1f[_0x6bca('0x29')]!==_0x6bca('0x3b')){var _0x385f26={};_0x385f26[_0x3e9d1f['name']]={'$like':'%'+_0x3cea8c['query'][_0x6bca('0x38')]+'%'};return _0x385f26;}})});}_0xba2661=_[_0x6bca('0x3a')]({},_0xba2661,_0x3cea8c[_0x6bca('0x3c')]);var _0xbdd169={'where':_0xba2661['where']};return db[_0x6bca('0x3d')][_0x6bca('0x1c')](_0xbdd169)[_0x6bca('0x21')](function(_0x50c54c){_0xaf1685[_0x6bca('0x1c')]=_0x50c54c;if(_0x3cea8c[_0x6bca('0x2b')]['includeAll']){_0xba2661[_0x6bca('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x6bca('0x3f')](_0xba2661);})[_0x6bca('0x21')](function(_0x17c99f){_0xaf1685['rows']=_0x17c99f;return _0xaf1685;})[_0x6bca('0x21')](respondWithFilteredResult(_0x2db392,_0xba2661))[_0x6bca('0x40')](handleError(_0x2db392,null));};exports[_0x6bca('0x41')]=function(_0x5ca064,_0x195fbc){var _0x7f91da={'raw':!![],'where':{'id':_0x5ca064['params']['id']}},_0x9e9e05={};_0x9e9e05[_0x6bca('0x2a')]=_['keys'](db[_0x6bca('0x3d')][_0x6bca('0x27')]);_0x9e9e05[_0x6bca('0x2b')]=_[_0x6bca('0x2c')](_0x5ca064[_0x6bca('0x2b')]);_0x9e9e05[_0x6bca('0x2d')]=_[_0x6bca('0x2e')](_0x9e9e05[_0x6bca('0x2a')],_0x9e9e05[_0x6bca('0x2b')]);_0x7f91da[_0x6bca('0x2f')]=_[_0x6bca('0x2e')](_0x9e9e05[_0x6bca('0x2a')],qs[_0x6bca('0x30')](_0x5ca064['query'][_0x6bca('0x30')]));_0x7f91da[_0x6bca('0x2f')]=_0x7f91da[_0x6bca('0x2f')][_0x6bca('0x31')]?_0x7f91da[_0x6bca('0x2f')]:_0x9e9e05[_0x6bca('0x2a')];if(_0x5ca064[_0x6bca('0x2b')]['includeAll']){_0x7f91da[_0x6bca('0x3e')]=[{'all':!![]}];}_0x7f91da=_['merge']({},_0x7f91da,_0x5ca064[_0x6bca('0x3c')]);return db[_0x6bca('0x3d')][_0x6bca('0x42')](_0x7f91da)[_0x6bca('0x21')](handleEntityNotFound(_0x195fbc,null))[_0x6bca('0x21')](respondWithResult(_0x195fbc,null))['catch'](handleError(_0x195fbc,null));};exports['create']=function(_0x12256d,_0x57bd2f){return db[_0x6bca('0x3d')][_0x6bca('0x43')](_0x12256d[_0x6bca('0x44')],{})[_0x6bca('0x21')](respondWithResult(_0x57bd2f,0xc9))[_0x6bca('0x40')](handleError(_0x57bd2f,null));};exports[_0x6bca('0x45')]=function(_0x241290,_0x97ff1e){if(_0x241290[_0x6bca('0x44')]['id']){delete _0x241290['body']['id'];}return db[_0x6bca('0x3d')][_0x6bca('0x42')]({'where':{'id':_0x241290[_0x6bca('0x46')]['id']}})[_0x6bca('0x21')](handleEntityNotFound(_0x97ff1e,null))[_0x6bca('0x21')](saveUpdates(_0x241290['body'],null))[_0x6bca('0x21')](respondWithResult(_0x97ff1e,null))['catch'](handleError(_0x97ff1e,null));};exports[_0x6bca('0x22')]=function(_0x5ea3f7,_0x2dbcec){return db[_0x6bca('0x3d')][_0x6bca('0x42')]({'where':{'id':_0x5ea3f7['params']['id']}})[_0x6bca('0x21')](handleEntityNotFound(_0x2dbcec,null))[_0x6bca('0x21')](removeEntity(_0x2dbcec,null))[_0x6bca('0x40')](handleError(_0x2dbcec,null));};exports[_0x6bca('0x47')]=function(_0x283af9,_0x27ff12){return db['MailSubstatus'][_0x6bca('0x47')]()[_0x6bca('0x21')](respondWithResult(_0x27ff12,null))[_0x6bca('0x40')](handleError(_0x27ff12,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 487d04a..29ef751 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 _0x2a1b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x59949c,_0x5c2b77){var _0x3349c7=function(_0x2193f9){while(--_0x2193f9){_0x59949c['push'](_0x59949c['shift']());}};_0x3349c7(++_0x5c2b77);}(_0x2a1b,0xee));var _0xb2a1=function(_0x48001f,_0x1f6fe9){_0x48001f=_0x48001f-0x0;var _0x1a5f6b=_0x2a1b[_0x48001f];return _0x1a5f6b;};'use strict';var _=require(_0xb2a1('0x0'));var util=require(_0xb2a1('0x1'));var logger=require(_0xb2a1('0x2'))(_0xb2a1('0x3'));var moment=require(_0xb2a1('0x4'));var BPromise=require(_0xb2a1('0x5'));var rp=require(_0xb2a1('0x6'));var fs=require('fs');var path=require(_0xb2a1('0x7'));var rimraf=require(_0xb2a1('0x8'));var config=require(_0xb2a1('0x9'));var attributes=require(_0xb2a1('0xa'));module[_0xb2a1('0xb')]=function(_0x320513,_0x231380){return _0x320513[_0xb2a1('0xc')](_0xb2a1('0xd'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x318d=['rimraf','./mailSubstatus.attributes','define','MailSubstatus','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x318d,0x1b2));var _0xd318=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0x318d[_0x1db863];return _0x18b578;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd318('0x0'))(_0xd318('0x1'));var moment=require(_0xd318('0x2'));var BPromise=require(_0xd318('0x3'));var rp=require(_0xd318('0x4'));var fs=require('fs');var path=require(_0xd318('0x5'));var rimraf=require(_0xd318('0x6'));var config=require('../../config/environment');var attributes=require(_0xd318('0x7'));module['exports']=function(_0x135336,_0x105940){return _0x135336[_0xd318('0x8')](_0xd318('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2dc7be0..b28ca81 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 _0x9bde=['code','message','MailSubstatus,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x414669,_0x5bc546){var _0xe2b5cd=function(_0x1e65f8){while(--_0x1e65f8){_0x414669['push'](_0x414669['shift']());}};_0xe2b5cd(++_0x5bc546);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d013c,_0x4f2629){_0x1d013c=_0x1d013c-0x0;var _0x4b6d81=_0x9bde[_0x1d013c];return _0x4b6d81;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x19baab,_0x3b2716){var _0x317bf6=function(_0x1a2a92){while(--_0x1a2a92){_0x19baab['push'](_0x19baab['shift']());}};_0x317bf6(++_0x3b2716);}(_0x153f,0x15b));var _0xf153=function(_0x4a8491,_0xa492c1){_0x4a8491=_0x4a8491-0x0;var _0x99f365=_0x153f[_0x4a8491];return _0x99f365;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 109e620..3b90bef 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 _0xab56=['get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x229461,_0xb8cb9){var _0x3b2d9a=function(_0x12c052){while(--_0x12c052){_0x229461['push'](_0x229461['shift']());}};_0x3b2d9a(++_0xb8cb9);}(_0xab56,0x1ba));var _0x6ab5=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xab56[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require(_0x6ab5('0x0'));var util=require('util');var path=require(_0x6ab5('0x1'));var timeout=require(_0x6ab5('0x2'));var express=require(_0x6ab5('0x3'));var router=express['Router']();var auth=require(_0x6ab5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab5('0x5'));var controller=require('./mailTransferReport.controller');router[_0x6ab5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ab5('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6ab5('0x6')](_0x6ab5('0x7'),auth[_0x6ab5('0x8')](),controller[_0x6ab5('0x9')]);router[_0x6ab5('0xa')]('/',auth[_0x6ab5('0x8')](),controller[_0x6ab5('0xb')]);router[_0x6ab5('0xc')]('/:id',auth[_0x6ab5('0x8')](),controller['update']);router[_0x6ab5('0xd')](_0x6ab5('0x7'),auth[_0x6ab5('0x8')](),controller[_0x6ab5('0xe')]);module[_0x6ab5('0xf')]=router; \ No newline at end of file +var _0x581f=['index','/:id','show','post','put','delete','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5e8ff8,_0x3e8081){var _0x258962=function(_0x4e5023){while(--_0x4e5023){_0x5e8ff8['push'](_0x5e8ff8['shift']());}};_0x258962(++_0x3e8081);}(_0x581f,0x1b8));var _0xf581=function(_0x55c1a2,_0x44d9ca){_0x55c1a2=_0x55c1a2-0x0;var _0x410310=_0x581f[_0x55c1a2];return _0x410310;};'use strict';var multer=require('multer');var util=require(_0xf581('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf581('0x1'));var router=express[_0xf581('0x2')]();var auth=require(_0xf581('0x3'));var interaction=require(_0xf581('0x4'));var config=require(_0xf581('0x5'));var controller=require('./mailTransferReport.controller');router[_0xf581('0x6')]('/',auth[_0xf581('0x7')](),controller[_0xf581('0x8')]);router[_0xf581('0x6')]('/describe',auth[_0xf581('0x7')](),controller['describe']);router[_0xf581('0x6')](_0xf581('0x9'),auth[_0xf581('0x7')](),controller[_0xf581('0xa')]);router[_0xf581('0xb')]('/',auth[_0xf581('0x7')](),controller['create']);router[_0xf581('0xc')](_0xf581('0x9'),auth[_0xf581('0x7')](),controller['update']);router[_0xf581('0xd')](_0xf581('0x9'),auth[_0xf581('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index cb8078f..eb5d874 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 _0x3625=['ENUM','account','agent','queue','moment','sequelize','exports','STRING'];(function(_0x1bf33d,_0x109877){var _0x2528c9=function(_0x32821b){while(--_0x32821b){_0x1bf33d['push'](_0x1bf33d['shift']());}};_0x2528c9(++_0x109877);}(_0x3625,0xa4));var _0x5362=function(_0x3dadf1,_0x4401b0){_0x3dadf1=_0x3dadf1-0x0;var _0x456748=_0x3625[_0x3dadf1];return _0x456748;};'use strict';var moment=require(_0x5362('0x0'));var Sequelize=require(_0x5362('0x1'));module[_0x5362('0x2')]={'uniqueid':{'type':Sequelize[_0x5362('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5362('0x4')](_0x5362('0x5'),_0x5362('0x6'),_0x5362('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe3ec=['agent','queue','DATE','NOW','moment','exports','account'];(function(_0x2c1819,_0x1c726a){var _0x13e579=function(_0x58868b){while(--_0x58868b){_0x2c1819['push'](_0x2c1819['shift']());}};_0x13e579(++_0x1c726a);}(_0xe3ec,0x193));var _0xce3e=function(_0xd276d7,_0x3ac1b9){_0xd276d7=_0xd276d7-0x0;var _0x2b236c=_0xe3ec[_0xd276d7];return _0x2b236c;};'use strict';var moment=require(_0xce3e('0x0'));var Sequelize=require('sequelize');module[_0xce3e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xce3e('0x2'),_0xce3e('0x3'),_0xce3e('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xce3e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xce3e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 4d63455..5fc2a13 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 _0x92f6=['end','json','offset','limit','Content-Range','reject','then','error','stack','name','send','index','map','MailTransferReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','rawAttributes','keys','merge','create','body','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2d8674,_0x4ed949){var _0x51486b=function(_0x2c1079){while(--_0x2c1079){_0x2d8674['push'](_0x2d8674['shift']());}};_0x51486b(++_0x4ed949);}(_0x92f6,0xff));var _0x692f=function(_0x48be5e,_0x24f00e){_0x48be5e=_0x48be5e-0x0;var _0x559ffd=_0x92f6[_0x48be5e];return _0x559ffd;};'use strict';var pdf=require(_0x692f('0x0'));var emlformat=require(_0x692f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x692f('0x2'));var jsonpatch=require(_0x692f('0x3'));var rp=require('request-promise');var moment=require(_0x692f('0x4'));var BPromise=require(_0x692f('0x5'));var Mustache=require(_0x692f('0x6'));var util=require(_0x692f('0x7'));var path=require('path');var sox=require(_0x692f('0x8'));var csv=require(_0x692f('0x9'));var ejs=require(_0x692f('0xa'));var fs=require('fs');var _=require(_0x692f('0xb'));var squel=require(_0x692f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x692f('0xd'));var toCsv=require(_0x692f('0x9'));var querystring=require(_0x692f('0xe'));var Papa=require(_0x692f('0xf'));var Redis=require('ioredis');var authService=require(_0x692f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x692f('0x11'));var hardwareService=require(_0x692f('0x12'));var logger=require(_0x692f('0x13'))(_0x692f('0x14'));var utils=require(_0x692f('0x15'));var config=require('../../config/environment');var db=require(_0x692f('0x16'))['db'];function respondWithStatusCode(_0x52f278,_0x3c0914){_0x3c0914=_0x3c0914||0xcc;return function(_0x59650c){if(_0x59650c){return _0x52f278[_0x692f('0x17')](_0x3c0914);}return _0x52f278[_0x692f('0x18')](_0x3c0914)[_0x692f('0x19')]();};}function respondWithResult(_0x49d9a5,_0x1cb898){_0x1cb898=_0x1cb898||0xc8;return function(_0x174983){if(_0x174983){return _0x49d9a5['status'](_0x1cb898)[_0x692f('0x1a')](_0x174983);}};}function respondWithFilteredResult(_0x1626e0,_0x4bd25c){return function(_0x2cd48a){if(_0x2cd48a){var _0x26b35b=_0x2cd48a['count'],_0x8af014=_0x4bd25c[_0x692f('0x1b')],_0x1e87a9=_0x4bd25c[_0x692f('0x1b')]+_0x4bd25c[_0x692f('0x1c')],_0x4a2a48;if(_0x1e87a9>=_0x26b35b){_0x1e87a9=_0x26b35b;_0x4a2a48=0xc8;}else{_0x4a2a48=0xce;}_0x1626e0[_0x692f('0x18')](_0x4a2a48);return _0x1626e0['set'](_0x692f('0x1d'),_0x8af014+'-'+_0x1e87a9+'/'+_0x26b35b)[_0x692f('0x1a')](_0x2cd48a);}return null;};}function patchUpdates(_0x45453c){return function(_0x585188){try{jsonpatch['apply'](_0x585188,_0x45453c,!![]);}catch(_0x173a20){return BPromise[_0x692f('0x1e')](_0x173a20);}return _0x585188['save']();};}function saveUpdates(_0x2beb9f,_0x396290){return function(_0x3a879e){if(_0x3a879e){return _0x3a879e['update'](_0x2beb9f)['then'](function(_0x95ea27){return _0x95ea27;});}return null;};}function removeEntity(_0x4b139c,_0x2a8e67){return function(_0x498066){if(_0x498066){return _0x498066['destroy']()[_0x692f('0x1f')](function(){_0x4b139c[_0x692f('0x18')](0xcc)[_0x692f('0x19')]();});}};}function handleEntityNotFound(_0x50cd21,_0x572a81){return function(_0x156b00){if(!_0x156b00){_0x50cd21[_0x692f('0x17')](0x194);}return _0x156b00;};}function handleError(_0x2995ea,_0x447c93){_0x447c93=_0x447c93||0x1f4;return function(_0x5c2659){logger[_0x692f('0x20')](_0x5c2659[_0x692f('0x21')]);if(_0x5c2659[_0x692f('0x22')]){delete _0x5c2659['name'];}_0x2995ea[_0x692f('0x18')](_0x447c93)[_0x692f('0x23')](_0x5c2659);};}exports[_0x692f('0x24')]=function(_0x4a4ea8,_0x4f15f9){var _0x2501c2={},_0x1f7d6e={},_0x58a2c5={'count':0x0,'rows':[]};var _0x2048ae=_[_0x692f('0x25')](db[_0x692f('0x26')]['rawAttributes'],function(_0x5aea0f){return{'name':_0x5aea0f[_0x692f('0x27')],'type':_0x5aea0f['type'][_0x692f('0x28')]};});_0x1f7d6e[_0x692f('0x29')]=_[_0x692f('0x25')](_0x2048ae,'name');_0x1f7d6e[_0x692f('0x2a')]=_['keys'](_0x4a4ea8[_0x692f('0x2a')]);_0x1f7d6e['filters']=_[_0x692f('0x2b')](_0x1f7d6e['model'],_0x1f7d6e[_0x692f('0x2a')]);_0x2501c2[_0x692f('0x2c')]=_[_0x692f('0x2b')](_0x1f7d6e[_0x692f('0x29')],qs['fields'](_0x4a4ea8['query'][_0x692f('0x2d')]));_0x2501c2[_0x692f('0x2c')]=_0x2501c2[_0x692f('0x2c')][_0x692f('0x2e')]?_0x2501c2[_0x692f('0x2c')]:_0x1f7d6e[_0x692f('0x29')];if(!_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x2f')](_0x692f('0x30'))){_0x2501c2[_0x692f('0x1c')]=qs['limit'](_0x4a4ea8['query']['limit']);_0x2501c2[_0x692f('0x1b')]=qs[_0x692f('0x1b')](_0x4a4ea8['query']['offset']);}_0x2501c2[_0x692f('0x31')]=qs[_0x692f('0x32')](_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x32')]);_0x2501c2[_0x692f('0x33')]=qs['filters'](_[_0x692f('0x34')](_0x4a4ea8[_0x692f('0x2a')],_0x1f7d6e[_0x692f('0x35')]),_0x2048ae);if(_0x4a4ea8[_0x692f('0x2a')]['filter']){_0x2501c2[_0x692f('0x33')]=_['merge'](_0x2501c2[_0x692f('0x33')],{'$or':_[_0x692f('0x25')](_0x2048ae,function(_0x24522f){if(_0x24522f['type']!==_0x692f('0x36')){var _0x4e4fe2={};_0x4e4fe2[_0x24522f['name']]={'$like':'%'+_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x37')]+'%'};return _0x4e4fe2;}})});}_0x2501c2=_['merge']({},_0x2501c2,_0x4a4ea8[_0x692f('0x38')]);var _0x35e1f2={'where':_0x2501c2[_0x692f('0x33')]};return db[_0x692f('0x26')]['count'](_0x35e1f2)[_0x692f('0x1f')](function(_0x2cb224){_0x58a2c5[_0x692f('0x39')]=_0x2cb224;if(_0x4a4ea8[_0x692f('0x2a')][_0x692f('0x3a')]){_0x2501c2[_0x692f('0x3b')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x2501c2);})[_0x692f('0x1f')](function(_0x3d4f2e){_0x58a2c5[_0x692f('0x3c')]=_0x3d4f2e;return _0x58a2c5;})[_0x692f('0x1f')](respondWithFilteredResult(_0x4f15f9,_0x2501c2))[_0x692f('0x3d')](handleError(_0x4f15f9,null));};exports[_0x692f('0x3e')]=function(_0x4c6ff9,_0xbb2771){var _0x740dff={'raw':!![],'where':{'id':_0x4c6ff9['params']['id']}},_0x354198={};_0x354198['model']=_['keys'](db[_0x692f('0x26')][_0x692f('0x3f')]);_0x354198[_0x692f('0x2a')]=_[_0x692f('0x40')](_0x4c6ff9[_0x692f('0x2a')]);_0x354198['filters']=_[_0x692f('0x2b')](_0x354198['model'],_0x354198[_0x692f('0x2a')]);_0x740dff[_0x692f('0x2c')]=_[_0x692f('0x2b')](_0x354198[_0x692f('0x29')],qs[_0x692f('0x2d')](_0x4c6ff9[_0x692f('0x2a')]['fields']));_0x740dff[_0x692f('0x2c')]=_0x740dff['attributes'][_0x692f('0x2e')]?_0x740dff[_0x692f('0x2c')]:_0x354198[_0x692f('0x29')];if(_0x4c6ff9['query'][_0x692f('0x3a')]){_0x740dff['include']=[{'all':!![]}];}_0x740dff=_[_0x692f('0x41')]({},_0x740dff,_0x4c6ff9['options']);return db[_0x692f('0x26')]['find'](_0x740dff)['then'](handleEntityNotFound(_0xbb2771,null))['then'](respondWithResult(_0xbb2771,null))[_0x692f('0x3d')](handleError(_0xbb2771,null));};exports[_0x692f('0x42')]=function(_0x56aa64,_0x36313d){return db[_0x692f('0x26')][_0x692f('0x42')](_0x56aa64[_0x692f('0x43')],{})[_0x692f('0x1f')](respondWithResult(_0x36313d,0xc9))[_0x692f('0x3d')](handleError(_0x36313d,null));};exports['update']=function(_0x26c870,_0x431d79){if(_0x26c870['body']['id']){delete _0x26c870[_0x692f('0x43')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x26c870[_0x692f('0x44')]['id']}})['then'](handleEntityNotFound(_0x431d79,null))['then'](saveUpdates(_0x26c870[_0x692f('0x43')],null))[_0x692f('0x1f')](respondWithResult(_0x431d79,null))['catch'](handleError(_0x431d79,null));};exports[_0x692f('0x45')]=function(_0x3b6b48,_0x5b8df0){return db[_0x692f('0x26')]['find']({'where':{'id':_0x3b6b48[_0x692f('0x44')]['id']}})[_0x692f('0x1f')](handleEntityNotFound(_0x5b8df0,null))[_0x692f('0x1f')](removeEntity(_0x5b8df0,null))[_0x692f('0x3d')](handleError(_0x5b8df0,null));};exports['describe']=function(_0x2439c2,_0x250dac){return db[_0x692f('0x26')]['describe']()[_0x692f('0x1f')](respondWithResult(_0x250dac,null))['catch'](handleError(_0x250dac,null));}; \ No newline at end of file +var _0x7353=['attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','MailTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7353,0x1dc));var _0x3735=function(_0x36b7c5,_0x2c3179){_0x36b7c5=_0x36b7c5-0x0;var _0x1aa40e=_0x7353[_0x36b7c5];return _0x1aa40e;};'use strict';var pdf=require(_0x3735('0x0'));var emlformat=require(_0x3735('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3735('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3735('0x3'));var moment=require('moment');var BPromise=require(_0x3735('0x4'));var Mustache=require(_0x3735('0x5'));var util=require(_0x3735('0x6'));var path=require(_0x3735('0x7'));var sox=require('sox');var csv=require(_0x3735('0x8'));var ejs=require(_0x3735('0x9'));var fs=require('fs');var _=require(_0x3735('0xa'));var squel=require(_0x3735('0xb'));var crypto=require(_0x3735('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3735('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3735('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3735('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3735('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x3735('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a3afa,_0x17ef2c){_0x17ef2c=_0x17ef2c||0xcc;return function(_0x391fef){if(_0x391fef){return _0x5a3afa[_0x3735('0x11')](_0x17ef2c);}return _0x5a3afa[_0x3735('0x12')](_0x17ef2c)['end']();};}function respondWithResult(_0x3f025d,_0x367e52){_0x367e52=_0x367e52||0xc8;return function(_0x3f4c97){if(_0x3f4c97){return _0x3f025d[_0x3735('0x12')](_0x367e52)[_0x3735('0x13')](_0x3f4c97);}};}function respondWithFilteredResult(_0x128106,_0x381660){return function(_0x36fc89){if(_0x36fc89){var _0x3c53d3=_0x36fc89[_0x3735('0x14')],_0x286e00=_0x381660[_0x3735('0x15')],_0x5702ca=_0x381660['offset']+_0x381660[_0x3735('0x16')],_0x166a6a;if(_0x5702ca>=_0x3c53d3){_0x5702ca=_0x3c53d3;_0x166a6a=0xc8;}else{_0x166a6a=0xce;}_0x128106['status'](_0x166a6a);return _0x128106[_0x3735('0x17')](_0x3735('0x18'),_0x286e00+'-'+_0x5702ca+'/'+_0x3c53d3)[_0x3735('0x13')](_0x36fc89);}return null;};}function patchUpdates(_0x2f8218){return function(_0x9f2a88){try{jsonpatch['apply'](_0x9f2a88,_0x2f8218,!![]);}catch(_0x77ab1e){return BPromise[_0x3735('0x19')](_0x77ab1e);}return _0x9f2a88['save']();};}function saveUpdates(_0x2fed98,_0x119248){return function(_0x54725c){if(_0x54725c){return _0x54725c[_0x3735('0x1a')](_0x2fed98)[_0x3735('0x1b')](function(_0x5203dc){return _0x5203dc;});}return null;};}function removeEntity(_0x31d9af,_0x23c5d5){return function(_0x1c6593){if(_0x1c6593){return _0x1c6593[_0x3735('0x1c')]()[_0x3735('0x1b')](function(){_0x31d9af[_0x3735('0x12')](0xcc)[_0x3735('0x1d')]();});}};}function handleEntityNotFound(_0x27801a,_0x2d9457){return function(_0x512e24){if(!_0x512e24){_0x27801a[_0x3735('0x11')](0x194);}return _0x512e24;};}function handleError(_0x271ee4,_0x378e36){_0x378e36=_0x378e36||0x1f4;return function(_0x2818ed){logger['error'](_0x2818ed[_0x3735('0x1e')]);if(_0x2818ed[_0x3735('0x1f')]){delete _0x2818ed[_0x3735('0x1f')];}_0x271ee4[_0x3735('0x12')](_0x378e36)[_0x3735('0x20')](_0x2818ed);};}exports[_0x3735('0x21')]=function(_0x5435be,_0x57ac28){var _0x5b8d38={},_0x11ee01={},_0x61b585={'count':0x0,'rows':[]};var _0x5e3518=_[_0x3735('0x22')](db[_0x3735('0x23')][_0x3735('0x24')],function(_0x5e85e8){return{'name':_0x5e85e8['fieldName'],'type':_0x5e85e8['type'][_0x3735('0x25')]};});_0x11ee01[_0x3735('0x26')]=_['map'](_0x5e3518,_0x3735('0x1f'));_0x11ee01[_0x3735('0x27')]=_[_0x3735('0x28')](_0x5435be[_0x3735('0x27')]);_0x11ee01[_0x3735('0x29')]=_[_0x3735('0x2a')](_0x11ee01[_0x3735('0x26')],_0x11ee01[_0x3735('0x27')]);_0x5b8d38['attributes']=_[_0x3735('0x2a')](_0x11ee01['model'],qs[_0x3735('0x2b')](_0x5435be[_0x3735('0x27')]['fields']));_0x5b8d38[_0x3735('0x2c')]=_0x5b8d38['attributes'][_0x3735('0x2d')]?_0x5b8d38[_0x3735('0x2c')]:_0x11ee01[_0x3735('0x26')];if(!_0x5435be[_0x3735('0x27')]['hasOwnProperty'](_0x3735('0x2e'))){_0x5b8d38[_0x3735('0x16')]=qs[_0x3735('0x16')](_0x5435be['query'][_0x3735('0x16')]);_0x5b8d38[_0x3735('0x15')]=qs[_0x3735('0x15')](_0x5435be[_0x3735('0x27')]['offset']);}_0x5b8d38[_0x3735('0x2f')]=qs[_0x3735('0x30')](_0x5435be['query'][_0x3735('0x30')]);_0x5b8d38[_0x3735('0x31')]=qs['filters'](_[_0x3735('0x32')](_0x5435be['query'],_0x11ee01['filters']),_0x5e3518);if(_0x5435be[_0x3735('0x27')][_0x3735('0x33')]){_0x5b8d38[_0x3735('0x31')]=_[_0x3735('0x34')](_0x5b8d38['where'],{'$or':_['map'](_0x5e3518,function(_0x523201){if(_0x523201['type']!==_0x3735('0x35')){var _0x2b2568={};_0x2b2568[_0x523201[_0x3735('0x1f')]]={'$like':'%'+_0x5435be['query'][_0x3735('0x33')]+'%'};return _0x2b2568;}})});}_0x5b8d38=_[_0x3735('0x34')]({},_0x5b8d38,_0x5435be['options']);var _0x14cba7={'where':_0x5b8d38['where']};return db['MailTransferReport'][_0x3735('0x14')](_0x14cba7)[_0x3735('0x1b')](function(_0x12ef00){_0x61b585['count']=_0x12ef00;if(_0x5435be[_0x3735('0x27')]['includeAll']){_0x5b8d38[_0x3735('0x36')]=[{'all':!![]}];}return db[_0x3735('0x23')][_0x3735('0x37')](_0x5b8d38);})['then'](function(_0x7da8b9){_0x61b585[_0x3735('0x38')]=_0x7da8b9;return _0x61b585;})[_0x3735('0x1b')](respondWithFilteredResult(_0x57ac28,_0x5b8d38))[_0x3735('0x39')](handleError(_0x57ac28,null));};exports[_0x3735('0x3a')]=function(_0x2771ea,_0x2476ae){var _0x56755c={'raw':!![],'where':{'id':_0x2771ea['params']['id']}},_0xf4631={};_0xf4631[_0x3735('0x26')]=_['keys'](db['MailTransferReport'][_0x3735('0x24')]);_0xf4631['query']=_[_0x3735('0x28')](_0x2771ea[_0x3735('0x27')]);_0xf4631[_0x3735('0x29')]=_[_0x3735('0x2a')](_0xf4631[_0x3735('0x26')],_0xf4631[_0x3735('0x27')]);_0x56755c[_0x3735('0x2c')]=_['intersection'](_0xf4631[_0x3735('0x26')],qs[_0x3735('0x2b')](_0x2771ea['query'][_0x3735('0x2b')]));_0x56755c[_0x3735('0x2c')]=_0x56755c[_0x3735('0x2c')][_0x3735('0x2d')]?_0x56755c[_0x3735('0x2c')]:_0xf4631['model'];if(_0x2771ea[_0x3735('0x27')][_0x3735('0x3b')]){_0x56755c[_0x3735('0x36')]=[{'all':!![]}];}_0x56755c=_[_0x3735('0x34')]({},_0x56755c,_0x2771ea['options']);return db[_0x3735('0x23')][_0x3735('0x3c')](_0x56755c)['then'](handleEntityNotFound(_0x2476ae,null))['then'](respondWithResult(_0x2476ae,null))['catch'](handleError(_0x2476ae,null));};exports[_0x3735('0x3d')]=function(_0x4b67b6,_0xdd5d91){return db[_0x3735('0x23')][_0x3735('0x3d')](_0x4b67b6['body'],{})['then'](respondWithResult(_0xdd5d91,0xc9))[_0x3735('0x39')](handleError(_0xdd5d91,null));};exports['update']=function(_0x2d9507,_0x11d0fd){if(_0x2d9507[_0x3735('0x3e')]['id']){delete _0x2d9507['body']['id'];}return db['MailTransferReport'][_0x3735('0x3c')]({'where':{'id':_0x2d9507['params']['id']}})[_0x3735('0x1b')](handleEntityNotFound(_0x11d0fd,null))['then'](saveUpdates(_0x2d9507['body'],null))['then'](respondWithResult(_0x11d0fd,null))[_0x3735('0x39')](handleError(_0x11d0fd,null));};exports['destroy']=function(_0x404358,_0x2aa57e){return db[_0x3735('0x23')][_0x3735('0x3c')]({'where':{'id':_0x404358[_0x3735('0x3f')]['id']}})[_0x3735('0x1b')](handleEntityNotFound(_0x2aa57e,null))[_0x3735('0x1b')](removeEntity(_0x2aa57e,null))[_0x3735('0x39')](handleError(_0x2aa57e,null));};exports[_0x3735('0x40')]=function(_0x1f8ea2,_0x4df4c8){return db['MailTransferReport'][_0x3735('0x40')]()[_0x3735('0x1b')](respondWithResult(_0x4df4c8,null))['catch'](handleError(_0x4df4c8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f19c810..0c33dbe 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 _0xa1ad=['api','moment','request-promise','rimraf','../../config/environment','exports','MailTransferReport','report_mail_transfer','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ad,0x1c0));var _0xda1a=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xa1ad[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0xda1a('0x0'));var util=require(_0xda1a('0x1'));var logger=require(_0xda1a('0x2'))(_0xda1a('0x3'));var moment=require(_0xda1a('0x4'));var BPromise=require('bluebird');var rp=require(_0xda1a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda1a('0x6'));var config=require(_0xda1a('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xda1a('0x8')]=function(_0x386b90,_0x387162){return _0x386b90['define'](_0xda1a('0x9'),attributes,{'tableName':_0xda1a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd17=['api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash','../../config/logger'];(function(_0xee40b9,_0x283358){var _0x64ea28=function(_0x44bf2f){while(--_0x44bf2f){_0xee40b9['push'](_0xee40b9['shift']());}};_0x64ea28(++_0x283358);}(_0xfd17,0x18a));var _0x7fd1=function(_0x5e07a7,_0x1438b3){_0x5e07a7=_0x5e07a7-0x0;var _0x22ced5=_0xfd17[_0x5e07a7];return _0x22ced5;};'use strict';var _=require(_0x7fd1('0x0'));var util=require('util');var logger=require(_0x7fd1('0x1'))(_0x7fd1('0x2'));var moment=require('moment');var BPromise=require(_0x7fd1('0x3'));var rp=require(_0x7fd1('0x4'));var fs=require('fs');var path=require(_0x7fd1('0x5'));var rimraf=require(_0x7fd1('0x6'));var config=require('../../config/environment');var attributes=require(_0x7fd1('0x7'));module['exports']=function(_0x50fc07,_0xb9baf7){return _0x50fc07[_0x7fd1('0x8')](_0x7fd1('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x7fd1('0xa'),'fields':[_0x7fd1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 29c780b..ecac430 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 _0xd152=['stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3eca96,_0x1bc1ea){var _0x8ac51f=function(_0xf59098){while(--_0xf59098){_0x3eca96['push'](_0x3eca96['shift']());}};_0x8ac51f(++_0x1bc1ea);}(_0xd152,0x125));var _0x2d15=function(_0x261f31,_0x416a7e){_0x261f31=_0x261f31-0x0;var _0x2db7cf=_0xd152[_0x261f31];return _0x2db7cf;};'use strict';var _=require('lodash');var util=require(_0x2d15('0x0'));var moment=require(_0x2d15('0x1'));var BPromise=require(_0x2d15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d15('0x3'));var db=require(_0x2d15('0x4'))['db'];var utils=require(_0x2d15('0x5'));var logger=require(_0x2d15('0x6'))(_0x2d15('0x7'));var config=require(_0x2d15('0x8'));var jayson=require(_0x2d15('0x9'));var client=jayson[_0x2d15('0xa')][_0x2d15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b8fa,_0x6e51fb,_0x464002){return new BPromise(function(_0x4558f6,_0x323694){return client[_0x2d15('0xc')](_0x26b8fa,_0x464002)[_0x2d15('0xd')](function(_0x873ee8){logger[_0x2d15('0xe')](_0x2d15('0xf'),_0x6e51fb,'request\x20sent');logger[_0x2d15('0x10')](_0x2d15('0x11'),_0x6e51fb,_0x2d15('0x12'),JSON[_0x2d15('0x13')](_0x873ee8));if(_0x873ee8[_0x2d15('0x14')]){if(_0x873ee8[_0x2d15('0x14')]['code']===0x1f4){logger['error'](_0x2d15('0xf'),_0x6e51fb,_0x873ee8[_0x2d15('0x14')][_0x2d15('0x15')]);return _0x323694(_0x873ee8[_0x2d15('0x14')][_0x2d15('0x15')]);}logger[_0x2d15('0x14')](_0x2d15('0xf'),_0x6e51fb,_0x873ee8[_0x2d15('0x14')]['message']);return _0x4558f6(_0x873ee8[_0x2d15('0x14')][_0x2d15('0x15')]);}else{logger[_0x2d15('0xe')](_0x2d15('0xf'),_0x6e51fb,_0x2d15('0x12'));_0x4558f6(_0x873ee8[_0x2d15('0x16')][_0x2d15('0x15')]);}})[_0x2d15('0x17')](function(_0x61fdac){logger[_0x2d15('0x14')](_0x2d15('0xf'),_0x6e51fb,_0x61fdac);_0x323694(_0x61fdac);});});} \ No newline at end of file +var _0x2784=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xf806fa,_0x406459){var _0x58995b=function(_0x5ddc03){while(--_0x5ddc03){_0xf806fa['push'](_0xf806fa['shift']());}};_0x58995b(++_0x406459);}(_0x2784,0x1c3));var _0x4278=function(_0x12c695,_0x397a06){_0x12c695=_0x12c695-0x0;var _0x38d4f5=_0x2784[_0x12c695];return _0x38d4f5;};'use strict';var _=require('lodash');var util=require(_0x4278('0x0'));var moment=require('moment');var BPromise=require(_0x4278('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4278('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4278('0x3'));var logger=require(_0x4278('0x4'))(_0x4278('0x5'));var config=require(_0x4278('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4278('0x7')][_0x4278('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x526d52,_0x17f958,_0x474c4d){return new BPromise(function(_0x78d80b,_0x4a6a78){return client[_0x4278('0x9')](_0x526d52,_0x474c4d)[_0x4278('0xa')](function(_0x1f6068){logger[_0x4278('0xb')](_0x4278('0xc'),_0x17f958,_0x4278('0xd'));logger[_0x4278('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x17f958,_0x4278('0xd'),JSON[_0x4278('0xf')](_0x1f6068));if(_0x1f6068[_0x4278('0x10')]){if(_0x1f6068['error'][_0x4278('0x11')]===0x1f4){logger['error'](_0x4278('0xc'),_0x17f958,_0x1f6068[_0x4278('0x10')][_0x4278('0x12')]);return _0x4a6a78(_0x1f6068[_0x4278('0x10')]['message']);}logger[_0x4278('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x17f958,_0x1f6068[_0x4278('0x10')]['message']);return _0x78d80b(_0x1f6068[_0x4278('0x10')][_0x4278('0x12')]);}else{logger[_0x4278('0xb')](_0x4278('0xc'),_0x17f958,_0x4278('0xd'));_0x78d80b(_0x1f6068[_0x4278('0x13')]['message']);}})[_0x4278('0x14')](function(_0x4897eb){logger[_0x4278('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x17f958,_0x4897eb);_0x4a6a78(_0x4897eb);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0616cf7..8aef2c3 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 _0x5a84=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x59c558,_0x21dbad){var _0x220bab=function(_0x5bb148){while(--_0x5bb148){_0x59c558['push'](_0x59c558['shift']());}};_0x220bab(++_0x21dbad);}(_0x5a84,0x82));var _0x45a8=function(_0x500bfd,_0x582244){_0x500bfd=_0x500bfd-0x0;var _0x308e7e=_0x5a84[_0x500bfd];return _0x308e7e;};'use strict';var multer=require(_0x45a8('0x0'));var util=require(_0x45a8('0x1'));var path=require(_0x45a8('0x2'));var timeout=require(_0x45a8('0x3'));var express=require(_0x45a8('0x4'));var router=express[_0x45a8('0x5')]();var auth=require(_0x45a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x45a8('0x7'));var controller=require(_0x45a8('0x8'));router[_0x45a8('0x9')]('/',auth[_0x45a8('0xa')](),controller[_0x45a8('0xb')]);router[_0x45a8('0x9')](_0x45a8('0xc'),auth[_0x45a8('0xa')](),controller[_0x45a8('0xd')]);router[_0x45a8('0x9')]('/:id',auth[_0x45a8('0xa')](),controller[_0x45a8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x45a8('0xf')]);router[_0x45a8('0x10')](_0x45a8('0x11'),auth[_0x45a8('0xa')](),controller[_0x45a8('0x12')]);router[_0x45a8('0x13')]('/:id',auth[_0x45a8('0xa')](),controller[_0x45a8('0x14')]);module[_0x45a8('0x15')]=router; \ No newline at end of file +var _0x288f=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','create','destroy','exports'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x288f,0x130));var _0xf288=function(_0x48bf52,_0x8c4a24){_0x48bf52=_0x48bf52-0x0;var _0x78d6a6=_0x288f[_0x48bf52];return _0x78d6a6;};'use strict';var multer=require(_0xf288('0x0'));var util=require(_0xf288('0x1'));var path=require(_0xf288('0x2'));var timeout=require(_0xf288('0x3'));var express=require(_0xf288('0x4'));var router=express['Router']();var auth=require(_0xf288('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf288('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth[_0xf288('0x7')](),controller[_0xf288('0x8')]);router[_0xf288('0x9')](_0xf288('0xa'),auth[_0xf288('0x7')](),controller['describe']);router[_0xf288('0x9')](_0xf288('0xb'),auth[_0xf288('0x7')](),controller[_0xf288('0xc')]);router['post']('/',auth[_0xf288('0x7')](),controller[_0xf288('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf288('0xb'),auth[_0xf288('0x7')](),controller[_0xf288('0xe')]);module[_0xf288('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0574ef0..618e192 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 _0x05f8=['getDataValue','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x05f8,0x99));var _0x805f=function(_0x107b08,_0x386169){_0x107b08=_0x107b08-0x0;var _0x4ae685=_0x05f8[_0x107b08];return _0x4ae685;};'use strict';var Sequelize=require(_0x805f('0x0'));var moment=require(_0x805f('0x1'));module[_0x805f('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x805f('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x805f('0x3')],'defaultValue':_0x805f('0x4'),'comment':_0x805f('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x805f('0x6')]},'exitAt':{'type':Sequelize[_0x805f('0x6')],'set':function(_0x33700f){var _0x15b111=moment(_0x33700f);var _0x33e77b=moment(this[_0x805f('0x7')]('enterAt'));var _0x17bbb1=_0x15b111[_0x805f('0x8')](_0x33e77b,'seconds');this[_0x805f('0x9')]('exitAt',_0x33700f);this[_0x805f('0x9')](_0x805f('0xa'),_0x17bbb1||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x805f('0xb')},'data2':{'type':Sequelize[_0x805f('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x805f('0x3')],'comment':_0x805f('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0x805f('0xd')},'data5':{'type':Sequelize[_0x805f('0x3')],'comment':_0x805f('0xe')},'role':{'type':Sequelize[_0x805f('0x3')]},'internal':{'type':Sequelize[_0x805f('0xf')]},'uniqueid':{'type':Sequelize[_0x805f('0x3')]}}; \ No newline at end of file +var _0xb8aa=['INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]'];(function(_0x5a09ef,_0x1f65ef){var _0x238d29=function(_0x7fa1a5){while(--_0x7fa1a5){_0x5a09ef['push'](_0x5a09ef['shift']());}};_0x238d29(++_0x1f65ef);}(_0xb8aa,0xf1));var _0xab8a=function(_0x281375,_0x251289){_0x281375=_0x281375-0x0;var _0x5d05aa=_0xb8aa[_0x281375];return _0x5d05aa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xab8a('0x0'));module[_0xab8a('0x1')]={'channel':{'type':Sequelize[_0xab8a('0x2')]},'membername':{'type':Sequelize[_0xab8a('0x2')]},'interface':{'type':Sequelize[_0xab8a('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xab8a('0x3'),'comment':_0xab8a('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xab8a('0x5')]},'exitAt':{'type':Sequelize[_0xab8a('0x5')],'set':function(_0x141f70){var _0x884d3e=moment(_0x141f70);var _0x582d06=moment(this[_0xab8a('0x6')](_0xab8a('0x7')));var _0x4685cb=_0x884d3e[_0xab8a('0x8')](_0x582d06,_0xab8a('0x9'));this[_0xab8a('0xa')]('exitAt',_0x141f70);this[_0xab8a('0xa')]('duration',_0x4685cb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xab8a('0xb')},'data2':{'type':Sequelize[_0xab8a('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xab8a('0x2')],'comment':_0xab8a('0xc')},'data4':{'type':Sequelize[_0xab8a('0x2')],'comment':_0xab8a('0xd')},'data5':{'type':Sequelize[_0xab8a('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xab8a('0x2')]},'internal':{'type':Sequelize[_0xab8a('0xe')]},'uniqueid':{'type':Sequelize[_0xab8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 7968ba6..221c3f4 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 _0x81c3=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2c33f4,_0x25ece0){var _0x51023=function(_0xc2582){while(--_0xc2582){_0x2c33f4['push'](_0x2c33f4['shift']());}};_0x51023(++_0x25ece0);}(_0x81c3,0x1b0));var _0x381c=function(_0x113553,_0x31f370){_0x113553=_0x113553-0x0;var _0x30ae4=_0x81c3[_0x113553];return _0x30ae4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x381c('0x0'));var rimraf=require(_0x381c('0x1'));var zipdir=require(_0x381c('0x2'));var jsonpatch=require(_0x381c('0x3'));var rp=require('request-promise');var moment=require(_0x381c('0x4'));var BPromise=require(_0x381c('0x5'));var Mustache=require('mustache');var util=require(_0x381c('0x6'));var path=require(_0x381c('0x7'));var sox=require(_0x381c('0x8'));var csv=require(_0x381c('0x9'));var ejs=require(_0x381c('0xa'));var fs=require('fs');var _=require(_0x381c('0xb'));var squel=require(_0x381c('0xc'));var crypto=require(_0x381c('0xd'));var jsforce=require(_0x381c('0xe'));var deskjs=require(_0x381c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x381c('0x10'));var qs=require(_0x381c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x381c('0x12'));var logger=require(_0x381c('0x13'))('api');var utils=require(_0x381c('0x14'));var config=require('../../config/environment');var db=require(_0x381c('0x15'))['db'];function respondWithStatusCode(_0x5e3e1c,_0x4abb06){_0x4abb06=_0x4abb06||0xcc;return function(_0x5ee79d){if(_0x5ee79d){return _0x5e3e1c[_0x381c('0x16')](_0x4abb06);}return _0x5e3e1c[_0x381c('0x17')](_0x4abb06)[_0x381c('0x18')]();};}function respondWithResult(_0x2eaaaf,_0x23487c){_0x23487c=_0x23487c||0xc8;return function(_0x30e441){if(_0x30e441){return _0x2eaaaf['status'](_0x23487c)[_0x381c('0x19')](_0x30e441);}};}function respondWithFilteredResult(_0x3ae63d,_0x42a31c){return function(_0x4ecdb9){if(_0x4ecdb9){var _0x7158ef=_0x4ecdb9[_0x381c('0x1a')],_0x234a89=_0x42a31c[_0x381c('0x1b')],_0x3dbfd9=_0x42a31c[_0x381c('0x1b')]+_0x42a31c[_0x381c('0x1c')],_0x219bff;if(_0x3dbfd9>=_0x7158ef){_0x3dbfd9=_0x7158ef;_0x219bff=0xc8;}else{_0x219bff=0xce;}_0x3ae63d[_0x381c('0x17')](_0x219bff);return _0x3ae63d[_0x381c('0x1d')](_0x381c('0x1e'),_0x234a89+'-'+_0x3dbfd9+'/'+_0x7158ef)[_0x381c('0x19')](_0x4ecdb9);}return null;};}function patchUpdates(_0x38fa32){return function(_0x2aef27){try{jsonpatch[_0x381c('0x1f')](_0x2aef27,_0x38fa32,!![]);}catch(_0xd4e098){return BPromise[_0x381c('0x20')](_0xd4e098);}return _0x2aef27[_0x381c('0x21')]();};}function saveUpdates(_0x3564b0,_0x30d89b){return function(_0x5a42ef){if(_0x5a42ef){return _0x5a42ef[_0x381c('0x22')](_0x3564b0)[_0x381c('0x23')](function(_0x308818){return _0x308818;});}return null;};}function removeEntity(_0x109c51,_0x2d0acd){return function(_0xa183bb){if(_0xa183bb){return _0xa183bb[_0x381c('0x24')]()[_0x381c('0x23')](function(){_0x109c51['status'](0xcc)[_0x381c('0x18')]();});}};}function handleEntityNotFound(_0x52bc06,_0x4ed316){return function(_0x37732d){if(!_0x37732d){_0x52bc06[_0x381c('0x16')](0x194);}return _0x37732d;};}function handleError(_0x1abee1,_0x2db0b2){_0x2db0b2=_0x2db0b2||0x1f4;return function(_0x316fa7){logger[_0x381c('0x25')](_0x316fa7[_0x381c('0x26')]);if(_0x316fa7['name']){delete _0x316fa7[_0x381c('0x27')];}_0x1abee1['status'](_0x2db0b2)[_0x381c('0x28')](_0x316fa7);};}exports[_0x381c('0x29')]=function(_0x3a352f,_0x325e4d){var _0x62c4ff={},_0x19fc8b={},_0x585de3={'count':0x0,'rows':[]};var _0x401877=_[_0x381c('0x2a')](db[_0x381c('0x2b')]['rawAttributes'],function(_0x4e0ea0){return{'name':_0x4e0ea0[_0x381c('0x2c')],'type':_0x4e0ea0[_0x381c('0x2d')]['key']};});_0x19fc8b['model']=_['map'](_0x401877,_0x381c('0x27'));_0x19fc8b[_0x381c('0x2e')]=_[_0x381c('0x2f')](_0x3a352f[_0x381c('0x2e')]);_0x19fc8b[_0x381c('0x30')]=_[_0x381c('0x31')](_0x19fc8b['model'],_0x19fc8b[_0x381c('0x2e')]);_0x62c4ff[_0x381c('0x32')]=_['intersection'](_0x19fc8b[_0x381c('0x33')],qs['fields'](_0x3a352f[_0x381c('0x2e')][_0x381c('0x34')]));_0x62c4ff['attributes']=_0x62c4ff[_0x381c('0x32')][_0x381c('0x35')]?_0x62c4ff[_0x381c('0x32')]:_0x19fc8b['model'];if(!_0x3a352f[_0x381c('0x2e')]['hasOwnProperty'](_0x381c('0x36'))){_0x62c4ff[_0x381c('0x1c')]=qs[_0x381c('0x1c')](_0x3a352f[_0x381c('0x2e')][_0x381c('0x1c')]);_0x62c4ff[_0x381c('0x1b')]=qs['offset'](_0x3a352f[_0x381c('0x2e')]['offset']);}_0x62c4ff[_0x381c('0x37')]=qs[_0x381c('0x38')](_0x3a352f[_0x381c('0x2e')]['sort']);_0x62c4ff[_0x381c('0x39')]=qs['filters'](_['pick'](_0x3a352f[_0x381c('0x2e')],_0x19fc8b[_0x381c('0x30')]),_0x401877);if(_0x3a352f[_0x381c('0x2e')][_0x381c('0x3a')]){_0x62c4ff[_0x381c('0x39')]=_[_0x381c('0x3b')](_0x62c4ff[_0x381c('0x39')],{'$or':_[_0x381c('0x2a')](_0x401877,function(_0xbcd4bd){if(_0xbcd4bd[_0x381c('0x2d')]!==_0x381c('0x3c')){var _0xfdd8b6={};_0xfdd8b6[_0xbcd4bd['name']]={'$like':'%'+_0x3a352f[_0x381c('0x2e')][_0x381c('0x3a')]+'%'};return _0xfdd8b6;}})});}_0x62c4ff=_[_0x381c('0x3b')]({},_0x62c4ff,_0x3a352f[_0x381c('0x3d')]);var _0x54f9bc={'where':_0x62c4ff[_0x381c('0x39')]};return db['MemberReport'][_0x381c('0x1a')](_0x54f9bc)[_0x381c('0x23')](function(_0x54ef5){_0x585de3[_0x381c('0x1a')]=_0x54ef5;if(_0x3a352f[_0x381c('0x2e')][_0x381c('0x3e')]){_0x62c4ff[_0x381c('0x3f')]=[{'all':!![]}];}return db[_0x381c('0x2b')]['findAll'](_0x62c4ff);})[_0x381c('0x23')](function(_0xa3d0a4){_0x585de3[_0x381c('0x40')]=_0xa3d0a4;return _0x585de3;})[_0x381c('0x23')](respondWithFilteredResult(_0x325e4d,_0x62c4ff))['catch'](handleError(_0x325e4d,null));};exports[_0x381c('0x41')]=function(_0x415cc6,_0x390a5d){var _0x40be84={'raw':!![],'where':{'id':_0x415cc6[_0x381c('0x42')]['id']}},_0x274f23={};_0x274f23['model']=_[_0x381c('0x2f')](db[_0x381c('0x2b')][_0x381c('0x43')]);_0x274f23['query']=_['keys'](_0x415cc6[_0x381c('0x2e')]);_0x274f23['filters']=_[_0x381c('0x31')](_0x274f23[_0x381c('0x33')],_0x274f23[_0x381c('0x2e')]);_0x40be84[_0x381c('0x32')]=_[_0x381c('0x31')](_0x274f23[_0x381c('0x33')],qs[_0x381c('0x34')](_0x415cc6[_0x381c('0x2e')][_0x381c('0x34')]));_0x40be84[_0x381c('0x32')]=_0x40be84[_0x381c('0x32')][_0x381c('0x35')]?_0x40be84[_0x381c('0x32')]:_0x274f23[_0x381c('0x33')];if(_0x415cc6[_0x381c('0x2e')]['includeAll']){_0x40be84[_0x381c('0x3f')]=[{'all':!![]}];}_0x40be84=_[_0x381c('0x3b')]({},_0x40be84,_0x415cc6[_0x381c('0x3d')]);return db[_0x381c('0x2b')]['find'](_0x40be84)[_0x381c('0x23')](handleEntityNotFound(_0x390a5d,null))[_0x381c('0x23')](respondWithResult(_0x390a5d,null))['catch'](handleError(_0x390a5d,null));};exports['create']=function(_0x3f3e66,_0x1237eb){return db['MemberReport'][_0x381c('0x44')](_0x3f3e66[_0x381c('0x45')],{})['then'](respondWithResult(_0x1237eb,0xc9))[_0x381c('0x46')](handleError(_0x1237eb,null));};exports[_0x381c('0x22')]=function(_0x275722,_0x590f14){if(_0x275722[_0x381c('0x45')]['id']){delete _0x275722['body']['id'];}return db[_0x381c('0x2b')][_0x381c('0x47')]({'where':{'id':_0x275722[_0x381c('0x42')]['id']}})[_0x381c('0x23')](handleEntityNotFound(_0x590f14,null))[_0x381c('0x23')](saveUpdates(_0x275722[_0x381c('0x45')],null))[_0x381c('0x23')](respondWithResult(_0x590f14,null))[_0x381c('0x46')](handleError(_0x590f14,null));};exports[_0x381c('0x24')]=function(_0x462c74,_0x27ba1f){return db[_0x381c('0x2b')][_0x381c('0x47')]({'where':{'id':_0x462c74[_0x381c('0x42')]['id']}})[_0x381c('0x23')](handleEntityNotFound(_0x27ba1f,null))[_0x381c('0x23')](removeEntity(_0x27ba1f,null))['catch'](handleError(_0x27ba1f,null));};exports[_0x381c('0x48')]=function(_0x2203a5,_0x71a7e6){return db[_0x381c('0x2b')]['describe']()['then'](respondWithResult(_0x71a7e6,null))['catch'](handleError(_0x71a7e6,null));}; \ No newline at end of file +var _0x3e6d=['fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','include','params','keys','rawAttributes','length','includeAll','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','error','stack','name','send','MemberReport','fieldName','type','key','model','query','intersection'];(function(_0x146d8d,_0x2c42fc){var _0x95a74=function(_0x196ee2){while(--_0x196ee2){_0x146d8d['push'](_0x146d8d['shift']());}};_0x95a74(++_0x2c42fc);}(_0x3e6d,0x187));var _0xd3e6=function(_0x4e977f,_0x50ea87){_0x4e977f=_0x4e977f-0x0;var _0x3bbc90=_0x3e6d[_0x4e977f];return _0x3bbc90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3e6('0x0'));var rimraf=require(_0xd3e6('0x1'));var zipdir=require(_0xd3e6('0x2'));var jsonpatch=require(_0xd3e6('0x3'));var rp=require('request-promise');var moment=require(_0xd3e6('0x4'));var BPromise=require(_0xd3e6('0x5'));var Mustache=require(_0xd3e6('0x6'));var util=require(_0xd3e6('0x7'));var path=require('path');var sox=require(_0xd3e6('0x8'));var csv=require(_0xd3e6('0x9'));var ejs=require(_0xd3e6('0xa'));var fs=require('fs');var _=require(_0xd3e6('0xb'));var squel=require(_0xd3e6('0xc'));var crypto=require(_0xd3e6('0xd'));var jsforce=require(_0xd3e6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd3e6('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3e6('0x10'));var authService=require(_0xd3e6('0x11'));var qs=require(_0xd3e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3e6('0x13'));var logger=require(_0xd3e6('0x14'))(_0xd3e6('0x15'));var utils=require(_0xd3e6('0x16'));var config=require(_0xd3e6('0x17'));var db=require(_0xd3e6('0x18'))['db'];function respondWithStatusCode(_0x47707a,_0x49dad3){_0x49dad3=_0x49dad3||0xcc;return function(_0x28ad68){if(_0x28ad68){return _0x47707a[_0xd3e6('0x19')](_0x49dad3);}return _0x47707a[_0xd3e6('0x1a')](_0x49dad3)[_0xd3e6('0x1b')]();};}function respondWithResult(_0x1c8a69,_0x61d939){_0x61d939=_0x61d939||0xc8;return function(_0xb9d11d){if(_0xb9d11d){return _0x1c8a69['status'](_0x61d939)[_0xd3e6('0x1c')](_0xb9d11d);}};}function respondWithFilteredResult(_0x5471a6,_0x789bbe){return function(_0x666b01){if(_0x666b01){var _0x41d44f=_0x666b01[_0xd3e6('0x1d')],_0x32c9b8=_0x789bbe[_0xd3e6('0x1e')],_0x1ba193=_0x789bbe['offset']+_0x789bbe['limit'],_0x18a005;if(_0x1ba193>=_0x41d44f){_0x1ba193=_0x41d44f;_0x18a005=0xc8;}else{_0x18a005=0xce;}_0x5471a6['status'](_0x18a005);return _0x5471a6[_0xd3e6('0x1f')]('Content-Range',_0x32c9b8+'-'+_0x1ba193+'/'+_0x41d44f)[_0xd3e6('0x1c')](_0x666b01);}return null;};}function patchUpdates(_0x189fc3){return function(_0x3fd7d5){try{jsonpatch['apply'](_0x3fd7d5,_0x189fc3,!![]);}catch(_0x3d6729){return BPromise[_0xd3e6('0x20')](_0x3d6729);}return _0x3fd7d5[_0xd3e6('0x21')]();};}function saveUpdates(_0x5f3010,_0x1e6947){return function(_0x3c9525){if(_0x3c9525){return _0x3c9525[_0xd3e6('0x22')](_0x5f3010)[_0xd3e6('0x23')](function(_0x4ca6d6){return _0x4ca6d6;});}return null;};}function removeEntity(_0x5ebee6,_0x2fb049){return function(_0x713be0){if(_0x713be0){return _0x713be0['destroy']()[_0xd3e6('0x23')](function(){_0x5ebee6[_0xd3e6('0x1a')](0xcc)[_0xd3e6('0x1b')]();});}};}function handleEntityNotFound(_0x5525c4,_0x30722c){return function(_0x34ef3b){if(!_0x34ef3b){_0x5525c4[_0xd3e6('0x19')](0x194);}return _0x34ef3b;};}function handleError(_0x574ba5,_0x105b03){_0x105b03=_0x105b03||0x1f4;return function(_0xc080ab){logger[_0xd3e6('0x24')](_0xc080ab[_0xd3e6('0x25')]);if(_0xc080ab['name']){delete _0xc080ab[_0xd3e6('0x26')];}_0x574ba5[_0xd3e6('0x1a')](_0x105b03)[_0xd3e6('0x27')](_0xc080ab);};}exports['index']=function(_0x34370b,_0x2ccd74){var _0x33948f={},_0x3a1369={},_0x47ca26={'count':0x0,'rows':[]};var _0x2dbe1e=_['map'](db[_0xd3e6('0x28')]['rawAttributes'],function(_0x5a1c8b){return{'name':_0x5a1c8b[_0xd3e6('0x29')],'type':_0x5a1c8b[_0xd3e6('0x2a')][_0xd3e6('0x2b')]};});_0x3a1369[_0xd3e6('0x2c')]=_['map'](_0x2dbe1e,_0xd3e6('0x26'));_0x3a1369[_0xd3e6('0x2d')]=_['keys'](_0x34370b[_0xd3e6('0x2d')]);_0x3a1369['filters']=_['intersection'](_0x3a1369[_0xd3e6('0x2c')],_0x3a1369[_0xd3e6('0x2d')]);_0x33948f['attributes']=_[_0xd3e6('0x2e')](_0x3a1369[_0xd3e6('0x2c')],qs[_0xd3e6('0x2f')](_0x34370b['query']['fields']));_0x33948f[_0xd3e6('0x30')]=_0x33948f[_0xd3e6('0x30')]['length']?_0x33948f['attributes']:_0x3a1369['model'];if(!_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x31')](_0xd3e6('0x32'))){_0x33948f[_0xd3e6('0x33')]=qs[_0xd3e6('0x33')](_0x34370b['query'][_0xd3e6('0x33')]);_0x33948f['offset']=qs['offset'](_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x1e')]);}_0x33948f['order']=qs[_0xd3e6('0x34')](_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x34')]);_0x33948f[_0xd3e6('0x35')]=qs['filters'](_[_0xd3e6('0x36')](_0x34370b[_0xd3e6('0x2d')],_0x3a1369[_0xd3e6('0x37')]),_0x2dbe1e);if(_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x38')]){_0x33948f[_0xd3e6('0x35')]=_[_0xd3e6('0x39')](_0x33948f[_0xd3e6('0x35')],{'$or':_[_0xd3e6('0x3a')](_0x2dbe1e,function(_0x11ff1d){if(_0x11ff1d[_0xd3e6('0x2a')]!==_0xd3e6('0x3b')){var _0x277347={};_0x277347[_0x11ff1d[_0xd3e6('0x26')]]={'$like':'%'+_0x34370b[_0xd3e6('0x2d')][_0xd3e6('0x38')]+'%'};return _0x277347;}})});}_0x33948f=_[_0xd3e6('0x39')]({},_0x33948f,_0x34370b[_0xd3e6('0x3c')]);var _0x36cb4c={'where':_0x33948f['where']};return db['MemberReport'][_0xd3e6('0x1d')](_0x36cb4c)[_0xd3e6('0x23')](function(_0x1f5c82){_0x47ca26[_0xd3e6('0x1d')]=_0x1f5c82;if(_0x34370b[_0xd3e6('0x2d')]['includeAll']){_0x33948f[_0xd3e6('0x3d')]=[{'all':!![]}];}return db[_0xd3e6('0x28')]['findAll'](_0x33948f);})[_0xd3e6('0x23')](function(_0x11db22){_0x47ca26['rows']=_0x11db22;return _0x47ca26;})['then'](respondWithFilteredResult(_0x2ccd74,_0x33948f))['catch'](handleError(_0x2ccd74,null));};exports['show']=function(_0x2fc43a,_0x27b59a){var _0xd491b1={'raw':!![],'where':{'id':_0x2fc43a[_0xd3e6('0x3e')]['id']}},_0x3032de={};_0x3032de['model']=_[_0xd3e6('0x3f')](db['MemberReport'][_0xd3e6('0x40')]);_0x3032de['query']=_[_0xd3e6('0x3f')](_0x2fc43a[_0xd3e6('0x2d')]);_0x3032de[_0xd3e6('0x37')]=_[_0xd3e6('0x2e')](_0x3032de[_0xd3e6('0x2c')],_0x3032de[_0xd3e6('0x2d')]);_0xd491b1['attributes']=_[_0xd3e6('0x2e')](_0x3032de[_0xd3e6('0x2c')],qs[_0xd3e6('0x2f')](_0x2fc43a[_0xd3e6('0x2d')][_0xd3e6('0x2f')]));_0xd491b1[_0xd3e6('0x30')]=_0xd491b1['attributes'][_0xd3e6('0x41')]?_0xd491b1[_0xd3e6('0x30')]:_0x3032de[_0xd3e6('0x2c')];if(_0x2fc43a[_0xd3e6('0x2d')][_0xd3e6('0x42')]){_0xd491b1['include']=[{'all':!![]}];}_0xd491b1=_[_0xd3e6('0x39')]({},_0xd491b1,_0x2fc43a[_0xd3e6('0x3c')]);return db[_0xd3e6('0x28')][_0xd3e6('0x43')](_0xd491b1)['then'](handleEntityNotFound(_0x27b59a,null))[_0xd3e6('0x23')](respondWithResult(_0x27b59a,null))[_0xd3e6('0x44')](handleError(_0x27b59a,null));};exports[_0xd3e6('0x45')]=function(_0x2ddda4,_0x6b434a){return db[_0xd3e6('0x28')][_0xd3e6('0x45')](_0x2ddda4['body'],{})[_0xd3e6('0x23')](respondWithResult(_0x6b434a,0xc9))[_0xd3e6('0x44')](handleError(_0x6b434a,null));};exports['update']=function(_0x52e555,_0x1b3dd2){if(_0x52e555[_0xd3e6('0x46')]['id']){delete _0x52e555['body']['id'];}return db[_0xd3e6('0x28')]['find']({'where':{'id':_0x52e555[_0xd3e6('0x3e')]['id']}})[_0xd3e6('0x23')](handleEntityNotFound(_0x1b3dd2,null))[_0xd3e6('0x23')](saveUpdates(_0x52e555[_0xd3e6('0x46')],null))[_0xd3e6('0x23')](respondWithResult(_0x1b3dd2,null))[_0xd3e6('0x44')](handleError(_0x1b3dd2,null));};exports[_0xd3e6('0x47')]=function(_0x49da28,_0xe87268){return db[_0xd3e6('0x28')][_0xd3e6('0x43')]({'where':{'id':_0x49da28[_0xd3e6('0x3e')]['id']}})[_0xd3e6('0x23')](handleEntityNotFound(_0xe87268,null))['then'](removeEntity(_0xe87268,null))[_0xd3e6('0x44')](handleError(_0xe87268,null));};exports[_0xd3e6('0x48')]=function(_0x3370ec,_0x5e392c){return db[_0xd3e6('0x28')][_0xd3e6('0x48')]()[_0xd3e6('0x23')](respondWithResult(_0x5e392c,null))[_0xd3e6('0x44')](handleError(_0x5e392c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index aee57e7..c2e8837 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 _0x8958=['../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface','util','request-promise','rimraf'];(function(_0x3401e7,_0x496f1b){var _0x5d191c=function(_0x5625d2){while(--_0x5625d2){_0x3401e7['push'](_0x3401e7['shift']());}};_0x5d191c(++_0x496f1b);}(_0x8958,0x93));var _0x8895=function(_0x4305ae,_0x9433a5){_0x4305ae=_0x4305ae-0x0;var _0x46bf2f=_0x8958[_0x4305ae];return _0x46bf2f;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x8895('0x8'),_0x8895('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24ca=['request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','api','bluebird'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x24ca,0x8c));var _0xa24c=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x24ca[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa24c('0x1'));var moment=require('moment');var BPromise=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var fs=require('fs');var path=require(_0xa24c('0x4'));var rimraf=require('rimraf');var config=require(_0xa24c('0x5'));var attributes=require(_0xa24c('0x6'));module[_0xa24c('0x7')]=function(_0x5a37ae,_0x5377ed){return _0x5a37ae['define'](_0xa24c('0x8'),attributes,{'tableName':_0xa24c('0x9'),'paranoid':![],'indexes':[{'name':_0xa24c('0xa'),'fields':[_0xa24c('0xb'),_0xa24c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7372ff4..ea673dc 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 _0x8911=['body','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','UpdateMemberReport','update'];(function(_0x119e3f,_0x24e162){var _0x453d58=function(_0x34ffdb){while(--_0x34ffdb){_0x119e3f['push'](_0x119e3f['shift']());}};_0x453d58(++_0x24e162);}(_0x8911,0x173));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1891('0x0'));var rs=require(_0x1891('0x1'));var fs=require('fs');var Redis=require(_0x1891('0x2'));var db=require(_0x1891('0x3'))['db'];var utils=require(_0x1891('0x4'));var logger=require(_0x1891('0x5'))(_0x1891('0x6'));var config=require(_0x1891('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1891('0x8')][_0x1891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ffcf1,_0x398171,_0x5b98bf){return new BPromise(function(_0x2c0859,_0x58f936){return client[_0x1891('0xa')](_0x3ffcf1,_0x5b98bf)[_0x1891('0xb')](function(_0x4cb230){logger[_0x1891('0xc')]('MemberReport,\x20%s,\x20%s',_0x398171,'request\x20sent');logger[_0x1891('0xd')](_0x1891('0xe'),_0x398171,_0x1891('0xf'),JSON[_0x1891('0x10')](_0x4cb230));if(_0x4cb230[_0x1891('0x11')]){if(_0x4cb230[_0x1891('0x11')][_0x1891('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x398171,_0x4cb230['error'][_0x1891('0x13')]);return _0x58f936(_0x4cb230[_0x1891('0x11')]['message']);}logger[_0x1891('0x11')](_0x1891('0x14'),_0x398171,_0x4cb230[_0x1891('0x11')][_0x1891('0x13')]);return _0x2c0859(_0x4cb230[_0x1891('0x11')][_0x1891('0x13')]);}else{logger[_0x1891('0xc')](_0x1891('0x14'),_0x398171,_0x1891('0xf'));_0x2c0859(_0x4cb230[_0x1891('0x15')][_0x1891('0x13')]);}})[_0x1891('0x16')](function(_0x572906){logger[_0x1891('0x11')](_0x1891('0x14'),_0x398171,_0x572906);_0x58f936(_0x572906);});});}exports[_0x1891('0x17')]=function(_0x3df026){var _0x21e52c=this;return new Promise(function(_0x2e0f27,_0x3bd415){return db[_0x1891('0x18')][_0x1891('0x19')]({'raw':_0x3df026['options']?_0x3df026[_0x1891('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3df026[_0x1891('0x1a')]?_0x3df026['options'][_0x1891('0x1b')]||null:null,'attributes':_0x3df026['options']?_0x3df026[_0x1891('0x1a')][_0x1891('0x1c')]||null:null,'limit':_0x3df026['options']?_0x3df026[_0x1891('0x1a')][_0x1891('0x1d')]||null:null,'include':_0x3df026[_0x1891('0x1a')]?_0x3df026[_0x1891('0x1a')][_0x1891('0x1e')]?_[_0x1891('0x1f')](_0x3df026['options'][_0x1891('0x1e')],function(_0x1a3eca){return{'model':db[_0x1a3eca[_0x1891('0x20')]],'as':_0x1a3eca['as'],'attributes':_0x1a3eca[_0x1891('0x1c')],'include':_0x1a3eca[_0x1891('0x1e')]?_[_0x1891('0x1f')](_0x1a3eca[_0x1891('0x1e')],function(_0x1f7440){return{'model':db[_0x1f7440['model']],'as':_0x1f7440['as'],'attributes':_0x1f7440[_0x1891('0x1c')],'include':_0x1f7440[_0x1891('0x1e')]?_[_0x1891('0x1f')](_0x1f7440[_0x1891('0x1e')],function(_0x2a2c5b){return{'model':db[_0x2a2c5b['model']],'as':_0x2a2c5b['as'],'attributes':_0x2a2c5b[_0x1891('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1891('0xb')](function(_0x23bb97){logger[_0x1891('0xc')](_0x1891('0x17'),_0x3df026);logger[_0x1891('0xd')](_0x1891('0x17'),_0x3df026,JSON['stringify'](_0x23bb97));_0x2e0f27(_0x23bb97);})[_0x1891('0x16')](function(_0x4e115b){logger[_0x1891('0x11')](_0x1891('0x17'),_0x4e115b[_0x1891('0x13')],_0x3df026);_0x3bd415(_0x21e52c['error'](0x1f4,_0x4e115b[_0x1891('0x13')]));});});};exports[_0x1891('0x21')]=function(_0x24b820){var _0x362936=this;return new Promise(function(_0x21ae08,_0x530fc5){return db[_0x1891('0x18')]['create'](_0x24b820['body'],{'raw':_0x24b820[_0x1891('0x1a')]?_0x24b820[_0x1891('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1891('0xb')](function(_0xc27b0d){logger[_0x1891('0xc')](_0x1891('0x21'),_0x24b820);logger[_0x1891('0xd')](_0x1891('0x21'),_0x24b820,JSON[_0x1891('0x10')](_0xc27b0d));_0x21ae08(_0xc27b0d);})[_0x1891('0x16')](function(_0x13a67d){logger[_0x1891('0x11')]('CreateMemberReport',_0x13a67d[_0x1891('0x13')],_0x24b820);_0x530fc5(_0x362936[_0x1891('0x11')](0x1f4,_0x13a67d['message']));});});};exports[_0x1891('0x22')]=function(_0x4c10ec){var _0x482dce=this;return new Promise(function(_0x377cf7,_0x35883c){return db[_0x1891('0x18')][_0x1891('0x23')](_0x4c10ec[_0x1891('0x24')],{'raw':_0x4c10ec['options']?_0x4c10ec[_0x1891('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c10ec[_0x1891('0x1a')]?_0x4c10ec['options'][_0x1891('0x1b')]||null:null,'attributes':_0x4c10ec[_0x1891('0x1a')]?_0x4c10ec[_0x1891('0x1a')][_0x1891('0x1c')]||null:null,'limit':_0x4c10ec[_0x1891('0x1a')]?_0x4c10ec[_0x1891('0x1a')][_0x1891('0x1d')]||null:null})[_0x1891('0xb')](function(_0x5d0532){logger[_0x1891('0xc')](_0x1891('0x22'),_0x4c10ec);logger[_0x1891('0xd')]('UpdateMemberReport',_0x4c10ec,JSON[_0x1891('0x10')](_0x5d0532));_0x377cf7(_0x5d0532);})['catch'](function(_0x11a21b){logger[_0x1891('0x11')](_0x1891('0x22'),_0x11a21b[_0x1891('0x13')],_0x4c10ec);_0x35883c(_0x482dce[_0x1891('0x11')](0x1f4,_0x11a21b['message']));});});}; \ No newline at end of file +var _0x93e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','model','attributes','map','create','body','CreateMemberReport','UpdateMemberReport','util','moment','bluebird','randomstring'];(function(_0x33f6a9,_0x5e195c){var _0x36df01=function(_0x2225d9){while(--_0x2225d9){_0x33f6a9['push'](_0x33f6a9['shift']());}};_0x36df01(++_0x5e195c);}(_0x93e9,0x152));var _0x993e=function(_0x38ce02,_0x2cd026){_0x38ce02=_0x38ce02-0x0;var _0x43d1f2=_0x93e9[_0x38ce02];return _0x43d1f2;};'use strict';var _=require('lodash');var util=require(_0x993e('0x0'));var moment=require(_0x993e('0x1'));var BPromise=require(_0x993e('0x2'));var rs=require(_0x993e('0x3'));var fs=require('fs');var Redis=require(_0x993e('0x4'));var db=require(_0x993e('0x5'))['db'];var utils=require(_0x993e('0x6'));var logger=require(_0x993e('0x7'))(_0x993e('0x8'));var config=require('../../config/environment');var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9a9ec4,_0x3be3cb,_0x2fa4ce){return new BPromise(function(_0x40cc7e,_0x632f0a){return client['request'](_0x9a9ec4,_0x2fa4ce)[_0x993e('0xc')](function(_0x4c11a8){logger['info'](_0x993e('0xd'),_0x3be3cb,_0x993e('0xe'));logger[_0x993e('0xf')](_0x993e('0x10'),_0x3be3cb,_0x993e('0xe'),JSON[_0x993e('0x11')](_0x4c11a8));if(_0x4c11a8['error']){if(_0x4c11a8[_0x993e('0x12')][_0x993e('0x13')]===0x1f4){logger['error'](_0x993e('0xd'),_0x3be3cb,_0x4c11a8[_0x993e('0x12')]['message']);return _0x632f0a(_0x4c11a8[_0x993e('0x12')][_0x993e('0x14')]);}logger['error'](_0x993e('0xd'),_0x3be3cb,_0x4c11a8['error'][_0x993e('0x14')]);return _0x40cc7e(_0x4c11a8[_0x993e('0x12')]['message']);}else{logger[_0x993e('0x15')](_0x993e('0xd'),_0x3be3cb,_0x993e('0xe'));_0x40cc7e(_0x4c11a8['result']['message']);}})[_0x993e('0x16')](function(_0x1c5f63){logger[_0x993e('0x12')](_0x993e('0xd'),_0x3be3cb,_0x1c5f63);_0x632f0a(_0x1c5f63);});});}exports[_0x993e('0x17')]=function(_0x11588f){var _0x14e146=this;return new Promise(function(_0x78284d,_0x2619ac){return db[_0x993e('0x18')][_0x993e('0x19')]({'raw':_0x11588f['options']?_0x11588f[_0x993e('0x1a')][_0x993e('0x1b')]===undefined?!![]:![]:!![],'where':_0x11588f[_0x993e('0x1a')]?_0x11588f[_0x993e('0x1a')][_0x993e('0x1c')]||null:null,'attributes':_0x11588f[_0x993e('0x1a')]?_0x11588f[_0x993e('0x1a')]['attributes']||null:null,'limit':_0x11588f[_0x993e('0x1a')]?_0x11588f['options'][_0x993e('0x1d')]||null:null,'include':_0x11588f[_0x993e('0x1a')]?_0x11588f[_0x993e('0x1a')][_0x993e('0x1e')]?_['map'](_0x11588f['options'][_0x993e('0x1e')],function(_0x2d8595){return{'model':db[_0x2d8595[_0x993e('0x1f')]],'as':_0x2d8595['as'],'attributes':_0x2d8595[_0x993e('0x20')],'include':_0x2d8595[_0x993e('0x1e')]?_[_0x993e('0x21')](_0x2d8595['include'],function(_0x2b8800){return{'model':db[_0x2b8800[_0x993e('0x1f')]],'as':_0x2b8800['as'],'attributes':_0x2b8800['attributes'],'include':_0x2b8800[_0x993e('0x1e')]?_[_0x993e('0x21')](_0x2b8800['include'],function(_0x91d582){return{'model':db[_0x91d582[_0x993e('0x1f')]],'as':_0x91d582['as'],'attributes':_0x91d582[_0x993e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x993e('0xc')](function(_0x1f9ea7){logger[_0x993e('0x15')]('GetMemberReport',_0x11588f);logger[_0x993e('0xf')](_0x993e('0x17'),_0x11588f,JSON['stringify'](_0x1f9ea7));_0x78284d(_0x1f9ea7);})[_0x993e('0x16')](function(_0x4b6f50){logger[_0x993e('0x12')](_0x993e('0x17'),_0x4b6f50['message'],_0x11588f);_0x2619ac(_0x14e146['error'](0x1f4,_0x4b6f50[_0x993e('0x14')]));});});};exports['CreateMemberReport']=function(_0x598c93){var _0x5a5309=this;return new Promise(function(_0x5b259a,_0x49f953){return db[_0x993e('0x18')][_0x993e('0x22')](_0x598c93[_0x993e('0x23')],{'raw':_0x598c93[_0x993e('0x1a')]?_0x598c93[_0x993e('0x1a')][_0x993e('0x1b')]===undefined?!![]:![]:!![]})[_0x993e('0xc')](function(_0x5eea33){logger['info'](_0x993e('0x24'),_0x598c93);logger[_0x993e('0xf')](_0x993e('0x24'),_0x598c93,JSON[_0x993e('0x11')](_0x5eea33));_0x5b259a(_0x5eea33);})['catch'](function(_0x59cef1){logger[_0x993e('0x12')](_0x993e('0x24'),_0x59cef1[_0x993e('0x14')],_0x598c93);_0x49f953(_0x5a5309[_0x993e('0x12')](0x1f4,_0x59cef1[_0x993e('0x14')]));});});};exports[_0x993e('0x25')]=function(_0x2eb293){var _0x3c7451=this;return new Promise(function(_0xf6935b,_0x2bfce9){return db[_0x993e('0x18')]['update'](_0x2eb293[_0x993e('0x23')],{'raw':_0x2eb293[_0x993e('0x1a')]?_0x2eb293[_0x993e('0x1a')][_0x993e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eb293[_0x993e('0x1a')]?_0x2eb293[_0x993e('0x1a')][_0x993e('0x1c')]||null:null,'attributes':_0x2eb293['options']?_0x2eb293[_0x993e('0x1a')][_0x993e('0x20')]||null:null,'limit':_0x2eb293[_0x993e('0x1a')]?_0x2eb293[_0x993e('0x1a')]['limit']||null:null})['then'](function(_0x2f4f99){logger[_0x993e('0x15')](_0x993e('0x25'),_0x2eb293);logger[_0x993e('0xf')]('UpdateMemberReport',_0x2eb293,JSON['stringify'](_0x2f4f99));_0xf6935b(_0x2f4f99);})[_0x993e('0x16')](function(_0xbaab95){logger[_0x993e('0x12')](_0x993e('0x25'),_0xbaab95[_0x993e('0x14')],_0x2eb293);_0x2bfce9(_0x3c7451[_0x993e('0x12')](0x1f4,_0xbaab95[_0x993e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 30a75ae..666d15a 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 _0x351d=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./migration.controller','index','exports'];(function(_0x352a14,_0x596a71){var _0x416e2a=function(_0xd2fc37){while(--_0xd2fc37){_0x352a14['push'](_0x352a14['shift']());}};_0x416e2a(++_0x596a71);}(_0x351d,0x90));var _0xd351=function(_0x4a9d84,_0x12a68c){_0x4a9d84=_0x4a9d84-0x0;var _0x4d80cf=_0x351d[_0x4a9d84];return _0x4d80cf;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var auth=require(_0xd351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd351('0x5'));var controller=require(_0xd351('0x6'));router['get']('/',controller[_0xd351('0x7')]);module[_0xd351('0x8')]=router; \ No newline at end of file +var _0x04b8=['index','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x144c51,_0x9327f0){var _0x24653f=function(_0x26ee50){while(--_0x26ee50){_0x144c51['push'](_0x144c51['shift']());}};_0x24653f(++_0x9327f0);}(_0x04b8,0x159));var _0x804b=function(_0x511f54,_0x1d891c){_0x511f54=_0x511f54-0x0;var _0x236bb=_0x04b8[_0x511f54];return _0x236bb;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var auth=require(_0x804b('0x3'));var interaction=require(_0x804b('0x4'));var config=require('../../config/environment');var controller=require(_0x804b('0x5'));router[_0x804b('0x6')]('/',controller[_0x804b('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 17a33dd..66f1e20 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 _0x78d3=['version','sequelize','exports','STRING'];(function(_0x4c221d,_0x3bc12f){var _0x203a04=function(_0x5a3a2a){while(--_0x5a3a2a){_0x4c221d['push'](_0x4c221d['shift']());}};_0x203a04(++_0x3bc12f);}(_0x78d3,0xf1));var _0x378d=function(_0x370e1e,_0x3c4bf2){_0x370e1e=_0x370e1e-0x0;var _0x2473d0=_0x78d3[_0x370e1e];return _0x2473d0;};'use strict';var Sequelize=require(_0x378d('0x0'));module[_0x378d('0x1')]={'version':{'type':Sequelize[_0x378d('0x2')],'unique':_0x378d('0x3')}}; \ No newline at end of file +var _0xe4fc=['version','sequelize','exports','STRING'];(function(_0xd6f949,_0xb329b9){var _0x2cb800=function(_0x53efec){while(--_0x53efec){_0xd6f949['push'](_0xd6f949['shift']());}};_0x2cb800(++_0xb329b9);}(_0xe4fc,0xa1));var _0xce4f=function(_0x14d827,_0xe04570){_0x14d827=_0x14d827-0x0;var _0x3046d9=_0xe4fc[_0x14d827];return _0x3046d9;};'use strict';var Sequelize=require(_0xce4f('0x0'));module[_0xce4f('0x1')]={'version':{'type':Sequelize[_0xce4f('0x2')],'unique':_0xce4f('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 0f624cd..c688724 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 _0x9bde=['index','map','Migration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x23ffb1,_0x31bed0){var _0x35c70c=function(_0xc52a05){while(--_0xc52a05){_0x23ffb1['push'](_0x23ffb1['shift']());}};_0x35c70c(++_0x31bed0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x63b491,_0x21ee35){_0x63b491=_0x63b491-0x0;var _0x192f8c=_0x9bde[_0x63b491];return _0x192f8c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(!_0x5bc4bf){_0x36f8c0[_0xe9bd('0x27')](0x194);}return _0x5bc4bf;};}function handleError(_0x1e3cbb,_0x2c9a57){_0x2c9a57=_0x2c9a57||0x1f4;return function(_0x39b206){logger[_0xe9bd('0x28')](_0x39b206[_0xe9bd('0x29')]);if(_0x39b206[_0xe9bd('0x2a')]){delete _0x39b206[_0xe9bd('0x2a')];}_0x1e3cbb[_0xe9bd('0x19')](_0x2c9a57)['send'](_0x39b206);};}exports[_0xe9bd('0x2b')]=function(_0x38fdfa,_0x5ba1d6){var _0x3b13b7={},_0xc25248={},_0x119672={'count':0x0,'rows':[]};var _0x429055=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')]['rawAttributes'],function(_0x5b7f1d){return{'name':_0x5b7f1d[_0xe9bd('0x2e')],'type':_0x5b7f1d['type'][_0xe9bd('0x2f')]};});_0xc25248[_0xe9bd('0x30')]=_[_0xe9bd('0x2c')](_0x429055,_0xe9bd('0x2a'));_0xc25248[_0xe9bd('0x31')]=_['keys'](_0x38fdfa['query']);_0xc25248[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],_0xc25248[_0xe9bd('0x31')]);_0x3b13b7[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],qs[_0xe9bd('0x35')](_0x38fdfa[_0xe9bd('0x31')]['fields']));_0x3b13b7[_0xe9bd('0x34')]=_0x3b13b7[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x3b13b7['attributes']:_0xc25248['model'];if(!_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x3b13b7[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1e')]);_0x3b13b7[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1d')]);}_0x3b13b7[_0xe9bd('0x39')]=qs[_0xe9bd('0x3a')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3a')]);_0x3b13b7[_0xe9bd('0x3b')]=qs[_0xe9bd('0x32')](_[_0xe9bd('0x3c')](_0x38fdfa['query'],_0xc25248[_0xe9bd('0x32')]),_0x429055);if(_0x38fdfa[_0xe9bd('0x31')]['filter']){_0x3b13b7[_0xe9bd('0x3b')]=_[_0xe9bd('0x3d')](_0x3b13b7['where'],{'$or':_['map'](_0x429055,function(_0x2785e6){if(_0x2785e6[_0xe9bd('0x3e')]!=='VIRTUAL'){var _0x2d1289={};_0x2d1289[_0x2785e6[_0xe9bd('0x2a')]]={'$like':'%'+_0x38fdfa[_0xe9bd('0x31')]['filter']+'%'};return _0x2d1289;}})});}_0x3b13b7=_[_0xe9bd('0x3d')]({},_0x3b13b7,_0x38fdfa['options']);var _0x3c8f7e={'where':_0x3b13b7[_0xe9bd('0x3b')]};return db[_0xe9bd('0x2d')][_0xe9bd('0x1c')](_0x3c8f7e)['then'](function(_0x41f2d4){_0x119672[_0xe9bd('0x1c')]=_0x41f2d4;if(_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3f')]){_0x3b13b7[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2d')][_0xe9bd('0x41')](_0x3b13b7);})[_0xe9bd('0x25')](function(_0x2b5a71){_0x119672[_0xe9bd('0x42')]=_0x2b5a71;return _0x119672;})['then'](respondWithFilteredResult(_0x5ba1d6,_0x3b13b7))['catch'](handleError(_0x5ba1d6,null));}; \ No newline at end of file +var _0xf4eb=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes'];(function(_0x1e7865,_0xb1c46f){var _0x4e5336=function(_0xcab4b8){while(--_0xcab4b8){_0x1e7865['push'](_0x1e7865['shift']());}};_0x4e5336(++_0xb1c46f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x382e5c,_0x32bbb7){_0x382e5c=_0x382e5c-0x0;var _0x28e5c4=_0xf4eb[_0x382e5c];return _0x28e5c4;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_0x41f918,_0xbf4e('0x20'));_0x315df3['query']=_[_0xbf4e('0x26')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],_0x315df3[_0xbf4e('0x27')]);_0x38c923['attributes']=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],qs['fields'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2a')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3['model'];if(!_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2c')](_0xbf4e('0x2d'))){_0x38c923['limit']=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0x2bfccf[_0xbf4e('0x27')]['offset']);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2f')]);_0x38c923[_0xbf4e('0x30')]=qs['filters'](_['pick'](_0x2bfccf['query'],_0x315df3['filters']),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]){_0x38c923[_0xbf4e('0x30')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x30')],{'$or':_[_0xbf4e('0x25')](_0x41f918,function(_0x355b42){if(_0x355b42[_0xbf4e('0x23')]!==_0xbf4e('0x33')){var _0x54527d={};_0x54527d[_0x355b42['name']]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]+'%'};return _0x54527d;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x3f46f1={'where':_0x38c923['where']};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x3f46f1)[_0xbf4e('0x1b')](function(_0xb30f90){_0x4021a9['count']=_0xb30f90;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x34')]){_0x38c923[_0xbf4e('0x35')]=[{'all':!![]}];}return db[_0xbf4e('0x21')]['findAll'](_0x38c923);})[_0xbf4e('0x1b')](function(_0x44e96b){_0x4021a9[_0xbf4e('0x36')]=_0x44e96b;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x37')](handleError(_0x5a0a9b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2e47d67..ae5db0b 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 _0xba0b=['request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','api','moment','bluebird'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xba0b,0x110));var _0xbba0=function(_0x4b2e21,_0x54ff37){_0x4b2e21=_0x4b2e21-0x0;var _0x2af112=_0xba0b[_0x4b2e21];return _0x2af112;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbba0('0x0'));var moment=require(_0xbba0('0x1'));var BPromise=require(_0xbba0('0x2'));var rp=require(_0xbba0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbba0('0x4'));var config=require(_0xbba0('0x5'));var attributes=require(_0xbba0('0x6'));module[_0xbba0('0x7')]=function(_0x203830,_0x5bf3d2){return _0x203830[_0xbba0('0x8')](_0xbba0('0x9'),attributes,{'tableName':_0xbba0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd01f=['exports','define','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./migration.attributes'];(function(_0x44b863,_0x254828){var _0x257bcb=function(_0x452f0e){while(--_0x452f0e){_0x44b863['push'](_0x44b863['shift']());}};_0x257bcb(++_0x254828);}(_0xd01f,0x1d6));var _0xfd01=function(_0x7b261e,_0x32331c){_0x7b261e=_0x7b261e-0x0;var _0x55ab59=_0xd01f[_0x7b261e];return _0x55ab59;};'use strict';var _=require(_0xfd01('0x0'));var util=require('util');var logger=require(_0xfd01('0x1'))('api');var moment=require(_0xfd01('0x2'));var BPromise=require(_0xfd01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd01('0x4'));var rimraf=require('rimraf');var config=require(_0xfd01('0x5'));var attributes=require(_0xfd01('0x6'));module[_0xfd01('0x7')]=function(_0x570282,_0x145ebb){return _0x570282[_0xfd01('0x8')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index c1b4a41..361d1bb 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 _0x9c4b=['stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x310167,_0x4f925b){var _0x42b71f=function(_0x7ae536){while(--_0x7ae536){_0x310167['push'](_0x310167['shift']());}};_0x42b71f(++_0x4f925b);}(_0x9c4b,0x101));var _0xb9c4=function(_0x4fd701,_0x4dd637){_0x4fd701=_0x4fd701-0x0;var _0xb61e42=_0x9c4b[_0x4fd701];return _0xb61e42;};'use strict';var _=require(_0xb9c4('0x0'));var util=require(_0xb9c4('0x1'));var moment=require(_0xb9c4('0x2'));var BPromise=require(_0xb9c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c4('0x5'));var logger=require(_0xb9c4('0x6'))(_0xb9c4('0x7'));var config=require(_0xb9c4('0x8'));var jayson=require(_0xb9c4('0x9'));var client=jayson[_0xb9c4('0xa')][_0xb9c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a72c2,_0xe3072f,_0x471688){return new BPromise(function(_0x2c6b1c,_0x14152d){return client[_0xb9c4('0xc')](_0x1a72c2,_0x471688)[_0xb9c4('0xd')](function(_0x3d65cc){logger[_0xb9c4('0xe')](_0xb9c4('0xf'),_0xe3072f,_0xb9c4('0x10'));logger[_0xb9c4('0x11')](_0xb9c4('0x12'),_0xe3072f,'request\x20sent',JSON[_0xb9c4('0x13')](_0x3d65cc));if(_0x3d65cc[_0xb9c4('0x14')]){if(_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x15')]===0x1f4){logger[_0xb9c4('0x14')](_0xb9c4('0xf'),_0xe3072f,_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x16')]);return _0x14152d(_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x16')]);}logger[_0xb9c4('0x14')](_0xb9c4('0xf'),_0xe3072f,_0x3d65cc[_0xb9c4('0x14')][_0xb9c4('0x16')]);return _0x2c6b1c(_0x3d65cc['error']['message']);}else{logger[_0xb9c4('0xe')](_0xb9c4('0xf'),_0xe3072f,_0xb9c4('0x10'));_0x2c6b1c(_0x3d65cc['result'][_0xb9c4('0x16')]);}})['catch'](function(_0x35f0f3){logger['error'](_0xb9c4('0xf'),_0xe3072f,_0x35f0f3);_0x14152d(_0x35f0f3);});});} \ No newline at end of file +var _0x5ba3=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','Migration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5ba3,0x140));var _0x35ba=function(_0x20b7d1,_0x1f24eb){_0x20b7d1=_0x20b7d1-0x0;var _0x5a4a84=_0x5ba3[_0x20b7d1];return _0x5a4a84;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('Migration,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 4962431..04bbd5c 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 _0x78d0=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x462ca7,_0x40a1f9){var _0x503899=function(_0x3ff6e5){while(--_0x3ff6e5){_0x462ca7['push'](_0x462ca7['shift']());}};_0x503899(++_0x40a1f9);}(_0x78d0,0x1cb));var _0x078d=function(_0x4895e5,_0x364032){_0x4895e5=_0x4895e5-0x0;var _0x38bf66=_0x78d0[_0x4895e5];return _0x38bf66;};'use strict';var multer=require(_0x078d('0x0'));var util=require(_0x078d('0x1'));var path=require(_0x078d('0x2'));var timeout=require(_0x078d('0x3'));var express=require('express');var router=express[_0x078d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x078d('0x5'));var config=require(_0x078d('0x6'));var controller=require(_0x078d('0x7'));router[_0x078d('0x8')]('/',auth['isAuthenticated'](),controller[_0x078d('0x9')]);router[_0x078d('0x8')]('/:id',auth[_0x078d('0xa')](),controller[_0x078d('0xb')]);router[_0x078d('0xc')]('/',auth[_0x078d('0xa')](),controller[_0x078d('0xd')]);router[_0x078d('0xe')](_0x078d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x078d('0x10')](_0x078d('0xf'),auth[_0x078d('0xa')](),controller[_0x078d('0x11')]);module[_0x078d('0x12')]=router; \ No newline at end of file +var _0x3e6d=['delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e6d,0xdf));var _0xd3e6=function(_0x50c453,_0x3daa12){_0x50c453=_0x50c453-0x0;var _0x51f8e9=_0x3e6d[_0x50c453];return _0x51f8e9;};'use strict';var multer=require(_0xd3e6('0x0'));var util=require(_0xd3e6('0x1'));var path=require(_0xd3e6('0x2'));var timeout=require(_0xd3e6('0x3'));var express=require(_0xd3e6('0x4'));var router=express['Router']();var auth=require(_0xd3e6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3e6('0x6'));router[_0xd3e6('0x7')]('/',auth[_0xd3e6('0x8')](),controller[_0xd3e6('0x9')]);router[_0xd3e6('0x7')](_0xd3e6('0xa'),auth[_0xd3e6('0x8')](),controller[_0xd3e6('0xb')]);router[_0xd3e6('0xc')]('/',auth[_0xd3e6('0x8')](),controller[_0xd3e6('0xd')]);router['put'](_0xd3e6('0xa'),auth[_0xd3e6('0x8')](),controller[_0xd3e6('0xe')]);router[_0xd3e6('0xf')](_0xd3e6('0xa'),auth[_0xd3e6('0x8')](),controller['destroy']);module[_0xd3e6('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b727fb0..8031a50 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(_0x394690,_0x9896bf){var _0x5873f9=function(_0x2d624e){while(--_0x2d624e){_0x394690['push'](_0x394690['shift']());}};_0x5873f9(++_0x9896bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x2da521,_0x500b3d){var _0x68a10a=function(_0x1f4f50){while(--_0x1f4f50){_0x2da521['push'](_0x2da521['shift']());}};_0x68a10a(++_0x500b3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 81ad447..b2c18e7 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 _0xd1ab=['include','rows','params','keys','fields','find','catch','create','transaction','body','findAll','type','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','root','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/network.ejs','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','send','Network','rawAttributes','fieldName','key','model','map','name','query','intersection','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll'];(function(_0x47254f,_0x415e04){var _0x98ce80=function(_0x951635){while(--_0x951635){_0x47254f['push'](_0x47254f['shift']());}};_0x98ce80(++_0x415e04);}(_0xd1ab,0x101));var _0xbd1a=function(_0x30f638,_0x9718a1){_0x30f638=_0x30f638-0x0;var _0xc3e5ac=_0xd1ab[_0x30f638];return _0xc3e5ac;};'use strict';var pdf=require(_0xbd1a('0x0'));var emlformat=require(_0xbd1a('0x1'));var rimraf=require(_0xbd1a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd1a('0x3'));var rp=require(_0xbd1a('0x4'));var moment=require(_0xbd1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbd1a('0x6'));var util=require(_0xbd1a('0x7'));var path=require(_0xbd1a('0x8'));var sox=require(_0xbd1a('0x9'));var csv=require(_0xbd1a('0xa'));var ejs=require(_0xbd1a('0xb'));var fs=require('fs');var _=require(_0xbd1a('0xc'));var squel=require(_0xbd1a('0xd'));var crypto=require(_0xbd1a('0xe'));var jsforce=require(_0xbd1a('0xf'));var deskjs=require(_0xbd1a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbd1a('0x11'));var Papa=require('papaparse');var Redis=require(_0xbd1a('0x12'));var authService=require(_0xbd1a('0x13'));var qs=require(_0xbd1a('0x14'));var as=require(_0xbd1a('0x15'));var hardwareService=require(_0xbd1a('0x16'));var logger=require(_0xbd1a('0x17'))(_0xbd1a('0x18'));var utils=require(_0xbd1a('0x19'));var config=require(_0xbd1a('0x1a'));var db=require(_0xbd1a('0x1b'))['db'];var jayson=require(_0xbd1a('0x1c'));var client=jayson[_0xbd1a('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x473630,_0x71ccbf,_0x2178c0){if(_0x2178c0){var _0x2282a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2282a5[_0xbd1a('0x1e')](_0x71ccbf)){return _0x473630;}else{throw new db[(_0xbd1a('0x1f'))][(_0xbd1a('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x473630;}}function respondWithRpcPromise(_0x4c7392,_0x1a04b8,_0x376fbe,_0x431491){return new BPromise(function(_0x1e39ce,_0x21b899){var _0x2cbaca=_0x431491||client;return _0x2cbaca['request'](_0x4c7392,_0x376fbe)[_0xbd1a('0x21')](function(_0x1d50ce){logger[_0xbd1a('0x22')](_0xbd1a('0x23'),_0x1a04b8,_0xbd1a('0x24'));logger[_0xbd1a('0x25')](_0xbd1a('0x26'),_0x1a04b8,_0xbd1a('0x24'),JSON[_0xbd1a('0x27')](_0x1d50ce));if(_0x1d50ce[_0xbd1a('0x28')]){if(_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x29')]===0x1f4){logger[_0xbd1a('0x28')](_0xbd1a('0x23'),_0x1a04b8,_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x2a')]);return _0x21b899(_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x2a')]);}logger[_0xbd1a('0x28')](_0xbd1a('0x23'),_0x1a04b8,_0x1d50ce['error'][_0xbd1a('0x2a')]);return _0x1e39ce(_0x1d50ce[_0xbd1a('0x28')][_0xbd1a('0x2a')]);}else{logger[_0xbd1a('0x22')]('Network,\x20%s,\x20%s',_0x1a04b8,_0xbd1a('0x24'));_0x1e39ce(_0x1d50ce[_0xbd1a('0x2b')][_0xbd1a('0x2a')]);}})['catch'](function(_0x25b223){logger[_0xbd1a('0x28')](_0xbd1a('0x23'),_0x1a04b8,_0x25b223);_0x21b899(_0x25b223);});});}function respondWithStatusCode(_0x2031d4,_0x386901){_0x386901=_0x386901||0xcc;return function(_0x108911){if(_0x108911){return _0x2031d4['sendStatus'](_0x386901);}return _0x2031d4[_0xbd1a('0x2c')](_0x386901)[_0xbd1a('0x2d')]();};}function respondWithResult(_0x5bd475,_0x2da5c7){_0x2da5c7=_0x2da5c7||0xc8;return function(_0x149867){if(_0x149867){return _0x5bd475[_0xbd1a('0x2c')](_0x2da5c7)['json'](_0x149867);}};}function respondWithFilteredResult(_0x4b02bf,_0x3441a8){return function(_0x22df59){if(_0x22df59){var _0x2ee320=_0x22df59[_0xbd1a('0x2e')],_0x34c804=_0x3441a8['offset'],_0x5f01a8=_0x3441a8[_0xbd1a('0x2f')]+_0x3441a8[_0xbd1a('0x30')],_0x5229a3;if(_0x5f01a8>=_0x2ee320){_0x5f01a8=_0x2ee320;_0x5229a3=0xc8;}else{_0x5229a3=0xce;}_0x4b02bf[_0xbd1a('0x2c')](_0x5229a3);return _0x4b02bf[_0xbd1a('0x31')](_0xbd1a('0x32'),_0x34c804+'-'+_0x5f01a8+'/'+_0x2ee320)[_0xbd1a('0x33')](_0x22df59);}return null;};}function patchUpdates(_0x122b2a){return function(_0x1bd976){try{jsonpatch[_0xbd1a('0x34')](_0x1bd976,_0x122b2a,!![]);}catch(_0x4be266){return BPromise[_0xbd1a('0x35')](_0x4be266);}return _0x1bd976[_0xbd1a('0x36')]();};}function saveUpdates(_0x563720,_0x5878ad){return function(_0x1920ba){if(_0x1920ba){return _0x1920ba[_0xbd1a('0x37')](_0x563720)[_0xbd1a('0x21')](function(_0x372cbd){return _0x372cbd;});}return null;};}function removeEntity(_0x56acff,_0x44f503){return function(_0x51f6e3){if(_0x51f6e3){return _0x51f6e3[_0xbd1a('0x38')]()[_0xbd1a('0x21')](function(){_0x56acff[_0xbd1a('0x2c')](0xcc)[_0xbd1a('0x2d')]();});}};}function handleEntityNotFound(_0x342b06,_0x68c5e8){return function(_0x4c5ed2){if(!_0x4c5ed2){_0x342b06[_0xbd1a('0x39')](0x194);}return _0x4c5ed2;};}function handleError(_0x406a68,_0x37e3e6){_0x37e3e6=_0x37e3e6||0x1f4;return function(_0x234905){logger[_0xbd1a('0x28')](_0x234905['stack']);if(_0x234905['name']){delete _0x234905['name'];}_0x406a68[_0xbd1a('0x2c')](_0x37e3e6)[_0xbd1a('0x3a')](_0x234905);};}exports['index']=function(_0x50ba76,_0x1ca598){var _0x4a4b4c={},_0x464bb7={},_0x1b786d={'count':0x0,'rows':[]};var _0x18f3f9=_['map'](db[_0xbd1a('0x3b')][_0xbd1a('0x3c')],function(_0x21b3c6){return{'name':_0x21b3c6[_0xbd1a('0x3d')],'type':_0x21b3c6['type'][_0xbd1a('0x3e')]};});_0x464bb7[_0xbd1a('0x3f')]=_[_0xbd1a('0x40')](_0x18f3f9,_0xbd1a('0x41'));_0x464bb7[_0xbd1a('0x42')]=_['keys'](_0x50ba76['query']);_0x464bb7['filters']=_[_0xbd1a('0x43')](_0x464bb7['model'],_0x464bb7['query']);_0x4a4b4c[_0xbd1a('0x44')]=_[_0xbd1a('0x43')](_0x464bb7[_0xbd1a('0x3f')],qs['fields'](_0x50ba76[_0xbd1a('0x42')]['fields']));_0x4a4b4c[_0xbd1a('0x44')]=_0x4a4b4c[_0xbd1a('0x44')][_0xbd1a('0x45')]?_0x4a4b4c[_0xbd1a('0x44')]:_0x464bb7[_0xbd1a('0x3f')];if(!_0x50ba76['query']['hasOwnProperty'](_0xbd1a('0x46'))){_0x4a4b4c[_0xbd1a('0x30')]=qs['limit'](_0x50ba76['query']['limit']);_0x4a4b4c[_0xbd1a('0x2f')]=qs[_0xbd1a('0x2f')](_0x50ba76['query'][_0xbd1a('0x2f')]);}_0x4a4b4c[_0xbd1a('0x47')]=qs[_0xbd1a('0x48')](_0x50ba76['query'][_0xbd1a('0x48')]);_0x4a4b4c[_0xbd1a('0x49')]=qs[_0xbd1a('0x4a')](_['pick'](_0x50ba76['query'],_0x464bb7[_0xbd1a('0x4a')]),_0x18f3f9);if(_0x50ba76['query'][_0xbd1a('0x4b')]){_0x4a4b4c[_0xbd1a('0x49')]=_[_0xbd1a('0x4c')](_0x4a4b4c[_0xbd1a('0x49')],{'$or':_[_0xbd1a('0x40')](_0x18f3f9,function(_0x4eb491){if(_0x4eb491['type']!==_0xbd1a('0x4d')){var _0x273d47={};_0x273d47[_0x4eb491[_0xbd1a('0x41')]]={'$like':'%'+_0x50ba76[_0xbd1a('0x42')][_0xbd1a('0x4b')]+'%'};return _0x273d47;}})});}_0x4a4b4c=_[_0xbd1a('0x4c')]({},_0x4a4b4c,_0x50ba76['options']);var _0x4c826b={'where':_0x4a4b4c[_0xbd1a('0x49')]};return db[_0xbd1a('0x3b')][_0xbd1a('0x2e')](_0x4c826b)[_0xbd1a('0x21')](function(_0x2b4d05){_0x1b786d[_0xbd1a('0x2e')]=_0x2b4d05;if(_0x50ba76[_0xbd1a('0x42')][_0xbd1a('0x4e')]){_0x4a4b4c[_0xbd1a('0x4f')]=[{'all':!![]}];}return db[_0xbd1a('0x3b')]['findAll'](_0x4a4b4c);})[_0xbd1a('0x21')](function(_0x85644){_0x1b786d[_0xbd1a('0x50')]=_0x85644;return _0x1b786d;})[_0xbd1a('0x21')](respondWithFilteredResult(_0x1ca598,_0x4a4b4c))['catch'](handleError(_0x1ca598,null));};exports['show']=function(_0x23daae,_0x3240ea){var _0x187036={'raw':!![],'where':{'id':_0x23daae[_0xbd1a('0x51')]['id']}},_0x513980={};_0x513980['model']=_[_0xbd1a('0x52')](db[_0xbd1a('0x3b')][_0xbd1a('0x3c')]);_0x513980[_0xbd1a('0x42')]=_[_0xbd1a('0x52')](_0x23daae[_0xbd1a('0x42')]);_0x513980[_0xbd1a('0x4a')]=_[_0xbd1a('0x43')](_0x513980['model'],_0x513980['query']);_0x187036[_0xbd1a('0x44')]=_['intersection'](_0x513980[_0xbd1a('0x3f')],qs[_0xbd1a('0x53')](_0x23daae['query'][_0xbd1a('0x53')]));_0x187036[_0xbd1a('0x44')]=_0x187036[_0xbd1a('0x44')]['length']?_0x187036[_0xbd1a('0x44')]:_0x513980['model'];if(_0x23daae[_0xbd1a('0x42')][_0xbd1a('0x4e')]){_0x187036['include']=[{'all':!![]}];}_0x187036=_[_0xbd1a('0x4c')]({},_0x187036,_0x23daae['options']);return db['Network'][_0xbd1a('0x54')](_0x187036)[_0xbd1a('0x21')](handleEntityNotFound(_0x3240ea,null))['then'](respondWithResult(_0x3240ea,null))[_0xbd1a('0x55')](handleError(_0x3240ea,null));};exports[_0xbd1a('0x56')]=function(_0x5e6ae7,_0x3dbd9b,_0x6ecae3){var _0x24fc86;return db['sequelize'][_0xbd1a('0x57')](function(_0xd0ab8d){return db['Network']['create'](_0x5e6ae7[_0xbd1a('0x58')],{'raw':!![]})['then'](function(_0x123dd7){_0x24fc86=_0x123dd7;return db[_0xbd1a('0x3b')][_0xbd1a('0x59')]({'where':{'type':_0x5e6ae7[_0xbd1a('0x58')][_0xbd1a('0x5a')]},'raw':!![]});})[_0xbd1a('0x21')](function(_0x50179e){if(_0x24fc86[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()==_0xbd1a('0x5c')){var _0x2775de=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config['root'],_0xbd1a('0x5f')),_0xbd1a('0x60'));var _0x398acb=ejs[_0xbd1a('0x61')](_0x2775de,{'networks':_0x50179e||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x398acb);return respondWithRpcPromise('Reload',_0xbd1a('0x56'),{'module':_0xbd1a('0x62')});}else if(_0x24fc86[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()=='TURN'){var _0x4c488a=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config['root'],_0xbd1a('0x63')),_0xbd1a('0x60'));var _0x24be9d=ejs['render'](_0x4c488a,{'networks':_0x50179e||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x65'),_0x24be9d);return respondWithRpcPromise('Reload',_0xbd1a('0x56'),{'module':_0xbd1a('0x62')});}else{var _0x411ad3=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],'server/files/templates/network.ejs'),_0xbd1a('0x60'));var _0x13d70f=ejs['render'](_0x411ad3,{'networks':_0x50179e||[]});fs['writeFileSync'](util[_0xbd1a('0x67')](_0xbd1a('0x68'),_0x5e6ae7[_0xbd1a('0x58')][_0xbd1a('0x5a')][_0xbd1a('0x69')]()),_0x13d70f);return respondWithRpcPromise('Reload',_0xbd1a('0x56'),{'module':_0xbd1a('0x6a')});}return null;})[_0xbd1a('0x21')](function(){return _0x24fc86;});})[_0xbd1a('0x21')](respondWithResult(_0x3dbd9b,0xc9))[_0xbd1a('0x55')](handleError(_0x3dbd9b,null));};exports[_0xbd1a('0x37')]=function(_0x4f410c,_0x2db716,_0x253558){var _0x2446d4;return db[_0xbd1a('0x6b')][_0xbd1a('0x57')](function(_0x37b7ff){return db[_0xbd1a('0x3b')]['find']({'where':{'id':_0x4f410c['params']['id']}})[_0xbd1a('0x21')](handleEntityNotFound(_0x2db716,null))[_0xbd1a('0x21')](saveUpdates(_0x4f410c[_0xbd1a('0x58')],null))[_0xbd1a('0x21')](function(_0x65e0bd){if(_0x65e0bd){_0x2446d4=_0x65e0bd;return db['Network'][_0xbd1a('0x59')]({'where':{'type':_0x2446d4['type']},'raw':!![]});}return null;})[_0xbd1a('0x21')](function(_0x430888){if(_0x2446d4[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()=='STUN'){var _0x1e05d6=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],_0xbd1a('0x5f')),_0xbd1a('0x60'));var _0x18817a=ejs['render'](_0x1e05d6,{'networks':_0x430888||[]});fs['writeFileSync'](_0xbd1a('0x6c'),_0x18817a);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x37'),{'module':_0xbd1a('0x62')});}else if(_0x2446d4[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()==_0xbd1a('0x6e')){var _0x17e494=fs['readFileSync'](path['join'](config['root'],_0xbd1a('0x63')),'utf8');var _0x26a414=ejs[_0xbd1a('0x61')](_0x17e494,{'networks':_0x430888||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x65'),_0x26a414);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x37'),{'module':_0xbd1a('0x62')});}else{var _0x3c840b=fs['readFileSync'](path['join'](config[_0xbd1a('0x66')],'server/files/templates/network.ejs'),'utf8');var _0x16daa0=ejs[_0xbd1a('0x61')](_0x3c840b,{'networks':_0x430888||[]});fs[_0xbd1a('0x64')](util[_0xbd1a('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x4f410c['body']['type'][_0xbd1a('0x69')]()),_0x16daa0);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x37'),{'module':_0xbd1a('0x6a')});}return null;})[_0xbd1a('0x21')](function(_0x1f4697){if(_0x1f4697){return _0x2446d4;}return null;});})[_0xbd1a('0x21')](respondWithResult(_0x2db716,null))[_0xbd1a('0x55')](handleError(_0x2db716,null));};exports[_0xbd1a('0x38')]=function(_0x2bba7d,_0x444e26,_0x535056){var _0x39999e;return db[_0xbd1a('0x3b')][_0xbd1a('0x54')]({'where':{'id':_0x2bba7d[_0xbd1a('0x51')]['id']}})[_0xbd1a('0x21')](function(_0x264110){_0x39999e=_0x264110;return _0x264110;})['then'](handleEntityNotFound(_0x444e26,null))[_0xbd1a('0x21')](removeEntity(_0x444e26,null))['then'](function(){if(_0x39999e){return db[_0xbd1a('0x3b')][_0xbd1a('0x59')]({'where':{'type':_0x39999e[_0xbd1a('0x5a')]},'raw':!![]});}})[_0xbd1a('0x21')](function(_0x507bcf){if(_0x39999e[_0xbd1a('0x5a')][_0xbd1a('0x5b')]()==_0xbd1a('0x5c')){var _0x2ead9e=fs['readFileSync'](path[_0xbd1a('0x5e')](config['root'],_0xbd1a('0x5f')),_0xbd1a('0x60'));var _0x2aa2b0=ejs['render'](_0x2ead9e,{'networks':_0x507bcf||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x6c'),_0x2aa2b0);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x38'),{'module':_0xbd1a('0x62')});}else if(_0x39999e['type'][_0xbd1a('0x5b')]()==_0xbd1a('0x6e')){var _0x51d643=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],_0xbd1a('0x63')),_0xbd1a('0x60'));var _0x1ff877=ejs[_0xbd1a('0x61')](_0x51d643,{'networks':_0x507bcf||[]});fs[_0xbd1a('0x64')](_0xbd1a('0x65'),_0x1ff877);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x38'),{'module':_0xbd1a('0x62')});}else{var _0x3cc6d8=fs[_0xbd1a('0x5d')](path[_0xbd1a('0x5e')](config[_0xbd1a('0x66')],_0xbd1a('0x6f')),_0xbd1a('0x60'));var _0x4f5e7e=ejs[_0xbd1a('0x61')](_0x3cc6d8,{'networks':_0x507bcf||[]});fs[_0xbd1a('0x64')](util['format'](_0xbd1a('0x68'),_0x2bba7d[_0xbd1a('0x58')][_0xbd1a('0x5a')]['toLowerCase']()),_0x4f5e7e);return respondWithRpcPromise(_0xbd1a('0x6d'),_0xbd1a('0x38'),{'module':'chan_sip.so'});}return null;})[_0xbd1a('0x55')](handleError(_0x444e26,null));}; \ No newline at end of file +var _0x6d4f=['rawAttributes','find','create','sequelize','transaction','body','findAll','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','params','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','Network','fieldName','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6d4f,0xee));var _0xf6d4=function(_0xb9fe33,_0x47a545){_0xb9fe33=_0xb9fe33-0x0;var _0x15f7c2=_0x6d4f[_0xb9fe33];return _0x15f7c2;};'use strict';var pdf=require(_0xf6d4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6d4('0x1'));var rp=require(_0xf6d4('0x2'));var moment=require(_0xf6d4('0x3'));var BPromise=require(_0xf6d4('0x4'));var Mustache=require(_0xf6d4('0x5'));var util=require(_0xf6d4('0x6'));var path=require(_0xf6d4('0x7'));var sox=require(_0xf6d4('0x8'));var csv=require(_0xf6d4('0x9'));var ejs=require(_0xf6d4('0xa'));var fs=require('fs');var _=require(_0xf6d4('0xb'));var squel=require(_0xf6d4('0xc'));var crypto=require(_0xf6d4('0xd'));var jsforce=require(_0xf6d4('0xe'));var deskjs=require(_0xf6d4('0xf'));var toCsv=require(_0xf6d4('0x9'));var querystring=require('querystring');var Papa=require(_0xf6d4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf6d4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf6d4('0x12'));var config=require(_0xf6d4('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf6d4('0x14'));var client=jayson[_0xf6d4('0x15')][_0xf6d4('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2e5a37,_0x2a3036,_0x355e38){if(_0x355e38){var _0x525c76=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x525c76['test'](_0x2a3036)){return _0x2e5a37;}else{throw new db[(_0xf6d4('0x17'))][(_0xf6d4('0x18'))](_0xf6d4('0x19'));}}else{return _0x2e5a37;}}function respondWithRpcPromise(_0x3fae79,_0x3584b9,_0x5d9f86,_0x459897){return new BPromise(function(_0x2adb02,_0xe6b9f7){var _0x2eb2e0=_0x459897||client;return _0x2eb2e0[_0xf6d4('0x1a')](_0x3fae79,_0x5d9f86)['then'](function(_0x1bd327){logger['info'](_0xf6d4('0x1b'),_0x3584b9,'request\x20sent');logger[_0xf6d4('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x3584b9,_0xf6d4('0x1d'),JSON[_0xf6d4('0x1e')](_0x1bd327));if(_0x1bd327['error']){if(_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x20')]===0x1f4){logger[_0xf6d4('0x1f')]('Network,\x20%s,\x20%s',_0x3584b9,_0x1bd327[_0xf6d4('0x1f')]['message']);return _0xe6b9f7(_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x21')]);}logger[_0xf6d4('0x1f')](_0xf6d4('0x1b'),_0x3584b9,_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x21')]);return _0x2adb02(_0x1bd327[_0xf6d4('0x1f')][_0xf6d4('0x21')]);}else{logger[_0xf6d4('0x22')](_0xf6d4('0x1b'),_0x3584b9,_0xf6d4('0x1d'));_0x2adb02(_0x1bd327[_0xf6d4('0x23')][_0xf6d4('0x21')]);}})[_0xf6d4('0x24')](function(_0x45dd00){logger[_0xf6d4('0x1f')](_0xf6d4('0x1b'),_0x3584b9,_0x45dd00);_0xe6b9f7(_0x45dd00);});});}function respondWithStatusCode(_0x4e1971,_0x3ce42e){_0x3ce42e=_0x3ce42e||0xcc;return function(_0x3f7937){if(_0x3f7937){return _0x4e1971[_0xf6d4('0x25')](_0x3ce42e);}return _0x4e1971[_0xf6d4('0x26')](_0x3ce42e)[_0xf6d4('0x27')]();};}function respondWithResult(_0x22f6ac,_0x2e52d3){_0x2e52d3=_0x2e52d3||0xc8;return function(_0x2714cc){if(_0x2714cc){return _0x22f6ac[_0xf6d4('0x26')](_0x2e52d3)[_0xf6d4('0x28')](_0x2714cc);}};}function respondWithFilteredResult(_0x1aa46e,_0x35177c){return function(_0x15f335){if(_0x15f335){var _0xfa6d2d=_0x15f335[_0xf6d4('0x29')],_0xfc0300=_0x35177c['offset'],_0x2ce6ee=_0x35177c[_0xf6d4('0x2a')]+_0x35177c[_0xf6d4('0x2b')],_0x530046;if(_0x2ce6ee>=_0xfa6d2d){_0x2ce6ee=_0xfa6d2d;_0x530046=0xc8;}else{_0x530046=0xce;}_0x1aa46e[_0xf6d4('0x26')](_0x530046);return _0x1aa46e[_0xf6d4('0x2c')](_0xf6d4('0x2d'),_0xfc0300+'-'+_0x2ce6ee+'/'+_0xfa6d2d)['json'](_0x15f335);}return null;};}function patchUpdates(_0x1b6bdd){return function(_0x33ebf3){try{jsonpatch[_0xf6d4('0x2e')](_0x33ebf3,_0x1b6bdd,!![]);}catch(_0x567ae4){return BPromise['reject'](_0x567ae4);}return _0x33ebf3[_0xf6d4('0x2f')]();};}function saveUpdates(_0x36d560,_0x5d5e36){return function(_0x2cac1c){if(_0x2cac1c){return _0x2cac1c['update'](_0x36d560)[_0xf6d4('0x30')](function(_0x3c9403){return _0x3c9403;});}return null;};}function removeEntity(_0x414cf1,_0x1f59fa){return function(_0x392e4f){if(_0x392e4f){return _0x392e4f[_0xf6d4('0x31')]()[_0xf6d4('0x30')](function(){_0x414cf1[_0xf6d4('0x26')](0xcc)[_0xf6d4('0x27')]();});}};}function handleEntityNotFound(_0x4b90cf,_0xcb8c50){return function(_0x19fb2d){if(!_0x19fb2d){_0x4b90cf[_0xf6d4('0x25')](0x194);}return _0x19fb2d;};}function handleError(_0x29efe6,_0x13edeb){_0x13edeb=_0x13edeb||0x1f4;return function(_0x19fa75){logger[_0xf6d4('0x1f')](_0x19fa75[_0xf6d4('0x32')]);if(_0x19fa75[_0xf6d4('0x33')]){delete _0x19fa75[_0xf6d4('0x33')];}_0x29efe6[_0xf6d4('0x26')](_0x13edeb)[_0xf6d4('0x34')](_0x19fa75);};}exports[_0xf6d4('0x35')]=function(_0x21407a,_0x3a055d){var _0x378306={},_0x3255c1={},_0x5be423={'count':0x0,'rows':[]};var _0x5e41ed=_[_0xf6d4('0x36')](db[_0xf6d4('0x37')]['rawAttributes'],function(_0x4ba438){return{'name':_0x4ba438[_0xf6d4('0x38')],'type':_0x4ba438[_0xf6d4('0x39')]['key']};});_0x3255c1['model']=_[_0xf6d4('0x36')](_0x5e41ed,_0xf6d4('0x33'));_0x3255c1['query']=_[_0xf6d4('0x3a')](_0x21407a['query']);_0x3255c1['filters']=_[_0xf6d4('0x3b')](_0x3255c1[_0xf6d4('0x3c')],_0x3255c1[_0xf6d4('0x3d')]);_0x378306[_0xf6d4('0x3e')]=_[_0xf6d4('0x3b')](_0x3255c1[_0xf6d4('0x3c')],qs[_0xf6d4('0x3f')](_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x3f')]));_0x378306[_0xf6d4('0x3e')]=_0x378306[_0xf6d4('0x3e')][_0xf6d4('0x40')]?_0x378306[_0xf6d4('0x3e')]:_0x3255c1[_0xf6d4('0x3c')];if(!_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x41')](_0xf6d4('0x42'))){_0x378306[_0xf6d4('0x2b')]=qs[_0xf6d4('0x2b')](_0x21407a[_0xf6d4('0x3d')]['limit']);_0x378306[_0xf6d4('0x2a')]=qs[_0xf6d4('0x2a')](_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x2a')]);}_0x378306['order']=qs[_0xf6d4('0x43')](_0x21407a['query'][_0xf6d4('0x43')]);_0x378306[_0xf6d4('0x44')]=qs['filters'](_[_0xf6d4('0x45')](_0x21407a['query'],_0x3255c1[_0xf6d4('0x46')]),_0x5e41ed);if(_0x21407a[_0xf6d4('0x3d')][_0xf6d4('0x47')]){_0x378306['where']=_[_0xf6d4('0x48')](_0x378306[_0xf6d4('0x44')],{'$or':_[_0xf6d4('0x36')](_0x5e41ed,function(_0x157db2){if(_0x157db2[_0xf6d4('0x39')]!==_0xf6d4('0x49')){var _0x21624f={};_0x21624f[_0x157db2[_0xf6d4('0x33')]]={'$like':'%'+_0x21407a[_0xf6d4('0x3d')]['filter']+'%'};return _0x21624f;}})});}_0x378306=_[_0xf6d4('0x48')]({},_0x378306,_0x21407a[_0xf6d4('0x4a')]);var _0x383c56={'where':_0x378306[_0xf6d4('0x44')]};return db['Network'][_0xf6d4('0x29')](_0x383c56)['then'](function(_0x4cb249){_0x5be423['count']=_0x4cb249;if(_0x21407a['query'][_0xf6d4('0x4b')]){_0x378306[_0xf6d4('0x4c')]=[{'all':!![]}];}return db[_0xf6d4('0x37')]['findAll'](_0x378306);})['then'](function(_0x143b78){_0x5be423['rows']=_0x143b78;return _0x5be423;})[_0xf6d4('0x30')](respondWithFilteredResult(_0x3a055d,_0x378306))[_0xf6d4('0x24')](handleError(_0x3a055d,null));};exports['show']=function(_0x52b661,_0x5b84d2){var _0x1069b7={'raw':!![],'where':{'id':_0x52b661['params']['id']}},_0x2a6d35={};_0x2a6d35['model']=_[_0xf6d4('0x3a')](db[_0xf6d4('0x37')][_0xf6d4('0x4d')]);_0x2a6d35[_0xf6d4('0x3d')]=_['keys'](_0x52b661[_0xf6d4('0x3d')]);_0x2a6d35[_0xf6d4('0x46')]=_[_0xf6d4('0x3b')](_0x2a6d35[_0xf6d4('0x3c')],_0x2a6d35['query']);_0x1069b7[_0xf6d4('0x3e')]=_[_0xf6d4('0x3b')](_0x2a6d35[_0xf6d4('0x3c')],qs[_0xf6d4('0x3f')](_0x52b661[_0xf6d4('0x3d')]['fields']));_0x1069b7['attributes']=_0x1069b7['attributes']['length']?_0x1069b7[_0xf6d4('0x3e')]:_0x2a6d35['model'];if(_0x52b661[_0xf6d4('0x3d')][_0xf6d4('0x4b')]){_0x1069b7[_0xf6d4('0x4c')]=[{'all':!![]}];}_0x1069b7=_[_0xf6d4('0x48')]({},_0x1069b7,_0x52b661['options']);return db[_0xf6d4('0x37')][_0xf6d4('0x4e')](_0x1069b7)[_0xf6d4('0x30')](handleEntityNotFound(_0x5b84d2,null))[_0xf6d4('0x30')](respondWithResult(_0x5b84d2,null))[_0xf6d4('0x24')](handleError(_0x5b84d2,null));};exports[_0xf6d4('0x4f')]=function(_0x56deb3,_0x5daaa3,_0x917813){var _0x1650b9;return db[_0xf6d4('0x50')][_0xf6d4('0x51')](function(_0x57f9f5){return db[_0xf6d4('0x37')][_0xf6d4('0x4f')](_0x56deb3[_0xf6d4('0x52')],{'raw':!![]})['then'](function(_0x5a8efa){_0x1650b9=_0x5a8efa;return db['Network'][_0xf6d4('0x53')]({'where':{'type':_0x56deb3['body'][_0xf6d4('0x39')]},'raw':!![]});})['then'](function(_0x41caec){if(_0x1650b9[_0xf6d4('0x39')]['toUpperCase']()==_0xf6d4('0x54')){var _0x1f3ea0=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xf6d4('0x57'));var _0x1bf713=ejs[_0xf6d4('0x58')](_0x1f3ea0,{'networks':_0x41caec||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x5a'),_0x1bf713);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x4f'),{'module':_0xf6d4('0x5c')});}else if(_0x1650b9[_0xf6d4('0x39')][_0xf6d4('0x5d')]()==_0xf6d4('0x5e')){var _0x21a7fe=fs['readFileSync'](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x60')),_0xf6d4('0x57'));var _0x5b92ad=ejs[_0xf6d4('0x58')](_0x21a7fe,{'networks':_0x41caec||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x61'),_0x5b92ad);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x4f'),{'module':_0xf6d4('0x5c')});}else{var _0x3135a3=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x62')),_0xf6d4('0x57'));var _0x19bce8=ejs[_0xf6d4('0x58')](_0x3135a3,{'networks':_0x41caec||[]});fs[_0xf6d4('0x59')](util[_0xf6d4('0x63')](_0xf6d4('0x64'),_0x56deb3['body'][_0xf6d4('0x39')][_0xf6d4('0x65')]()),_0x19bce8);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x4f'),{'module':_0xf6d4('0x66')});}return null;})[_0xf6d4('0x30')](function(){return _0x1650b9;});})[_0xf6d4('0x30')](respondWithResult(_0x5daaa3,0xc9))['catch'](handleError(_0x5daaa3,null));};exports[_0xf6d4('0x67')]=function(_0x4cbd4b,_0x1dbcfe,_0x180723){var _0x26ddb4;return db[_0xf6d4('0x50')][_0xf6d4('0x51')](function(_0x2d666c){return db[_0xf6d4('0x37')][_0xf6d4('0x4e')]({'where':{'id':_0x4cbd4b[_0xf6d4('0x68')]['id']}})[_0xf6d4('0x30')](handleEntityNotFound(_0x1dbcfe,null))[_0xf6d4('0x30')](saveUpdates(_0x4cbd4b[_0xf6d4('0x52')],null))[_0xf6d4('0x30')](function(_0x5e8503){if(_0x5e8503){_0x26ddb4=_0x5e8503;return db[_0xf6d4('0x37')]['findAll']({'where':{'type':_0x26ddb4[_0xf6d4('0x39')]},'raw':!![]});}return null;})[_0xf6d4('0x30')](function(_0x1a13e5){if(_0x26ddb4[_0xf6d4('0x39')][_0xf6d4('0x5d')]()=='STUN'){var _0x3583d5=fs['readFileSync'](path[_0xf6d4('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xf6d4('0x57'));var _0x1b0014=ejs[_0xf6d4('0x58')](_0x3583d5,{'networks':_0x1a13e5||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x5a'),_0x1b0014);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x67'),{'module':_0xf6d4('0x5c')});}else if(_0x26ddb4[_0xf6d4('0x39')]['toUpperCase']()==_0xf6d4('0x5e')){var _0x2c6a90=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4498bd=ejs['render'](_0x2c6a90,{'networks':_0x1a13e5||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x61'),_0x4498bd);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x67'),{'module':_0xf6d4('0x5c')});}else{var _0x650fac=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x62')),_0xf6d4('0x57'));var _0x5eb59b=ejs[_0xf6d4('0x58')](_0x650fac,{'networks':_0x1a13e5||[]});fs[_0xf6d4('0x59')](util[_0xf6d4('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x4cbd4b[_0xf6d4('0x52')]['type'][_0xf6d4('0x65')]()),_0x5eb59b);return respondWithRpcPromise('Reload',_0xf6d4('0x67'),{'module':_0xf6d4('0x66')});}return null;})[_0xf6d4('0x30')](function(_0x16e7e5){if(_0x16e7e5){return _0x26ddb4;}return null;});})[_0xf6d4('0x30')](respondWithResult(_0x1dbcfe,null))[_0xf6d4('0x24')](handleError(_0x1dbcfe,null));};exports['destroy']=function(_0x3ee1e6,_0x550448,_0x8aa046){var _0x2736e2;return db[_0xf6d4('0x37')][_0xf6d4('0x4e')]({'where':{'id':_0x3ee1e6[_0xf6d4('0x68')]['id']}})[_0xf6d4('0x30')](function(_0x574c84){_0x2736e2=_0x574c84;return _0x574c84;})['then'](handleEntityNotFound(_0x550448,null))['then'](removeEntity(_0x550448,null))[_0xf6d4('0x30')](function(){if(_0x2736e2){return db['Network']['findAll']({'where':{'type':_0x2736e2[_0xf6d4('0x39')]},'raw':!![]});}})['then'](function(_0x344e1f){if(_0x2736e2[_0xf6d4('0x39')][_0xf6d4('0x5d')]()==_0xf6d4('0x54')){var _0x59ec1b=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x56f195=ejs[_0xf6d4('0x58')](_0x59ec1b,{'networks':_0x344e1f||[]});fs[_0xf6d4('0x59')](_0xf6d4('0x5a'),_0x56f195);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x2736e2[_0xf6d4('0x39')]['toUpperCase']()=='TURN'){var _0x1e7dac=fs[_0xf6d4('0x55')](path['join'](config[_0xf6d4('0x5f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x24ca6b=ejs[_0xf6d4('0x58')](_0x1e7dac,{'networks':_0x344e1f||[]});fs[_0xf6d4('0x59')]('/etc/asterisk/turn_xcally.conf',_0x24ca6b);return respondWithRpcPromise(_0xf6d4('0x5b'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x98e451=fs[_0xf6d4('0x55')](path[_0xf6d4('0x56')](config[_0xf6d4('0x5f')],_0xf6d4('0x62')),_0xf6d4('0x57'));var _0x4ffbe3=ejs[_0xf6d4('0x58')](_0x98e451,{'networks':_0x344e1f||[]});fs[_0xf6d4('0x59')](util[_0xf6d4('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x3ee1e6[_0xf6d4('0x52')]['type'][_0xf6d4('0x65')]()),_0x4ffbe3);return respondWithRpcPromise(_0xf6d4('0x5b'),_0xf6d4('0x31'),{'module':'chan_sip.so'});}return null;})[_0xf6d4('0x24')](handleError(_0x550448,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1460fe3..68f4110 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 _0xb903=['rimraf','../../config/environment','./network.attributes','exports','network','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x81024b,_0x1437bf){var _0x4ee29c=function(_0x3dc297){while(--_0x3dc297){_0x81024b['push'](_0x81024b['shift']());}};_0x4ee29c(++_0x1437bf);}(_0xb903,0x185));var _0x3b90=function(_0xf41281,_0x2fec54){_0xf41281=_0xf41281-0x0;var _0x3756ab=_0xb903[_0xf41281];return _0x3756ab;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('Network',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde2c=['api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','Network','network','lodash','util','../../config/logger'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xde2c,0x7f));var _0xcde2=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xde2c[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var moment=require(_0xcde2('0x4'));var BPromise=require(_0xcde2('0x5'));var rp=require(_0xcde2('0x6'));var fs=require('fs');var path=require(_0xcde2('0x7'));var rimraf=require('rimraf');var config=require(_0xcde2('0x8'));var attributes=require(_0xcde2('0x9'));module[_0xcde2('0xa')]=function(_0x1398de,_0x401b16){return _0x1398de['define'](_0xcde2('0xb'),attributes,{'tableName':_0xcde2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 796fc2c..38bc396 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 _0xf9c5=['../../config/environment','client','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xde1a2a,_0x52b7bc){var _0x43ab09=function(_0x962258){while(--_0x962258){_0xde1a2a['push'](_0xde1a2a['shift']());}};_0x43ab09(++_0x52b7bc);}(_0xf9c5,0x150));var _0x5f9c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf9c5[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x5f9c('0x0'));var moment=require('moment');var BPromise=require(_0x5f9c('0x1'));var rs=require(_0x5f9c('0x2'));var fs=require('fs');var Redis=require(_0x5f9c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5f9c('0x4'))(_0x5f9c('0x5'));var config=require(_0x5f9c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5f9c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbd6231,_0xbe0152,_0x5dcabd){return new BPromise(function(_0x386983,_0x4e89b7){return client[_0x5f9c('0x8')](_0xbd6231,_0x5dcabd)[_0x5f9c('0x9')](function(_0x642812){logger['info'](_0x5f9c('0xa'),_0xbe0152,_0x5f9c('0xb'));logger['debug'](_0x5f9c('0xc'),_0xbe0152,'request\x20sent',JSON[_0x5f9c('0xd')](_0x642812));if(_0x642812[_0x5f9c('0xe')]){if(_0x642812[_0x5f9c('0xe')][_0x5f9c('0xf')]===0x1f4){logger[_0x5f9c('0xe')](_0x5f9c('0xa'),_0xbe0152,_0x642812[_0x5f9c('0xe')][_0x5f9c('0x10')]);return _0x4e89b7(_0x642812['error'][_0x5f9c('0x10')]);}logger[_0x5f9c('0xe')](_0x5f9c('0xa'),_0xbe0152,_0x642812['error'][_0x5f9c('0x10')]);return _0x386983(_0x642812['error'][_0x5f9c('0x10')]);}else{logger[_0x5f9c('0x11')](_0x5f9c('0xa'),_0xbe0152,'request\x20sent');_0x386983(_0x642812[_0x5f9c('0x12')][_0x5f9c('0x10')]);}})['catch'](function(_0x133e81){logger[_0x5f9c('0xe')](_0x5f9c('0xa'),_0xbe0152,_0x133e81);_0x4e89b7(_0x133e81);});});} \ No newline at end of file +var _0x9b5d=['http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9b5d,0xd3));var _0xd9b5=function(_0xcd9302,_0x59074c){_0xcd9302=_0xcd9302-0x0;var _0x35b0c1=_0x9b5d[_0xcd9302];return _0x35b0c1;};'use strict';var _=require('lodash');var util=require(_0xd9b5('0x0'));var moment=require(_0xd9b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9b5('0x2'));var fs=require('fs');var Redis=require(_0xd9b5('0x3'));var db=require(_0xd9b5('0x4'))['db'];var utils=require(_0xd9b5('0x5'));var logger=require('../../config/logger')(_0xd9b5('0x6'));var config=require(_0xd9b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9b5('0x8')][_0xd9b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x561fa2,_0x4ec5ff,_0x470e9e){return new BPromise(function(_0x5c3566,_0x819973){return client[_0xd9b5('0xa')](_0x561fa2,_0x470e9e)[_0xd9b5('0xb')](function(_0x535091){logger[_0xd9b5('0xc')](_0xd9b5('0xd'),_0x4ec5ff,_0xd9b5('0xe'));logger['debug'](_0xd9b5('0xf'),_0x4ec5ff,_0xd9b5('0xe'),JSON['stringify'](_0x535091));if(_0x535091[_0xd9b5('0x10')]){if(_0x535091[_0xd9b5('0x10')]['code']===0x1f4){logger[_0xd9b5('0x10')](_0xd9b5('0xd'),_0x4ec5ff,_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);return _0x819973(_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);}logger['error'](_0xd9b5('0xd'),_0x4ec5ff,_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);return _0x5c3566(_0x535091[_0xd9b5('0x10')][_0xd9b5('0x11')]);}else{logger['info'](_0xd9b5('0xd'),_0x4ec5ff,'request\x20sent');_0x5c3566(_0x535091[_0xd9b5('0x12')][_0xd9b5('0x11')]);}})[_0xd9b5('0x13')](function(_0x43ee4c){logger[_0xd9b5('0x10')](_0xd9b5('0xd'),_0x4ec5ff,_0x43ee4c);_0x819973(_0x43ee4c);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index aa9509e..df6a0d5 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 _0x8b8b=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','path','express','Router','../../components/auth/service'];(function(_0x347437,_0x55d68e){var _0x27afa4=function(_0xb3fb44){while(--_0xb3fb44){_0x347437['push'](_0x347437['shift']());}};_0x27afa4(++_0x55d68e);}(_0x8b8b,0x73));var _0xb8b8=function(_0x17ca07,_0x43c67f){_0x17ca07=_0x17ca07-0x0;var _0x34b97d=_0x8b8b[_0x17ca07];return _0x34b97d;};'use strict';var multer=require(_0xb8b8('0x0'));var util=require('util');var path=require(_0xb8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8b8('0x2'));var router=express[_0xb8b8('0x3')]();var auth=require(_0xb8b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb8b8('0x5'));var controller=require(_0xb8b8('0x6'));router[_0xb8b8('0x7')]('/',auth[_0xb8b8('0x8')](),controller[_0xb8b8('0x9')]);module['exports']=router; \ No newline at end of file +var _0xe296=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e357d,_0x3cb775){var _0x1fa416=function(_0x1ee7d4){while(--_0x1ee7d4){_0x4e357d['push'](_0x4e357d['shift']());}};_0x1fa416(++_0x3cb775);}(_0xe296,0xf0));var _0x6e29=function(_0x14bb43,_0x512b78){_0x14bb43=_0x14bb43-0x0;var _0x1737a3=_0xe296[_0x14bb43];return _0x1737a3;};'use strict';var multer=require(_0x6e29('0x0'));var util=require(_0x6e29('0x1'));var path=require(_0x6e29('0x2'));var timeout=require(_0x6e29('0x3'));var express=require('express');var router=express[_0x6e29('0x4')]();var auth=require(_0x6e29('0x5'));var interaction=require(_0x6e29('0x6'));var config=require(_0x6e29('0x7'));var controller=require(_0x6e29('0x8'));router[_0x6e29('0x9')]('/',auth[_0x6e29('0xa')](),controller[_0x6e29('0xb')]);module[_0x6e29('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 586952b..131dd19 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 _0x0df5=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x497889,_0x36d2e2){var _0x5f6b12=function(_0x4c47dd){while(--_0x4c47dd){_0x497889['push'](_0x497889['shift']());}};_0x5f6b12(++_0x36d2e2);}(_0x0df5,0xbd));var _0x50df=function(_0x525495,_0x4af010){_0x525495=_0x525495-0x0;var _0x9623bf=_0x0df5[_0x525495];return _0x9623bf;};'use strict';var Sequelize=require(_0x50df('0x0'));module[_0x50df('0x1')]={'body':{'type':Sequelize[_0x50df('0x2')]},'senderName':{'type':Sequelize[_0x50df('0x3')]},'recipientsId':{'type':Sequelize[_0x50df('0x2')]},'recipientsDescription':{'type':Sequelize[_0x50df('0x3')]},'beep':{'type':Sequelize[_0x50df('0x4')]}}; \ No newline at end of file +var _0x90ff=['BOOLEAN','sequelize'];(function(_0x132671,_0x26760e){var _0x4a3b55=function(_0xf011ca){while(--_0xf011ca){_0x132671['push'](_0x132671['shift']());}};_0x4a3b55(++_0x26760e);}(_0x90ff,0xbd));var _0xf90f=function(_0x148a4d,_0xe6f5e8){_0x148a4d=_0x148a4d-0x0;var _0x51018a=_0x90ff[_0x148a4d];return _0x51018a;};'use strict';var Sequelize=require(_0xf90f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xf90f('0x1')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 8527677..b823cdc 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 _0x65ea=['queue','replace','Queue','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','status','end','json','count','set','Content-Range','apply','reject','then','error','stack','name','send','sendNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','voicequeue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','recipientsId','sequelize','transaction','Notification','create','forEach','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','User','union','ids','includes'];(function(_0x106337,_0x5bd12a){var _0x7c867f=function(_0x2d8482){while(--_0x2d8482){_0x106337['push'](_0x106337['shift']());}};_0x7c867f(++_0x5bd12a);}(_0x65ea,0xc4));var _0xa65e=function(_0x740a35,_0x4efde9){_0x740a35=_0x740a35-0x0;var _0x169a91=_0x65ea[_0x740a35];return _0x169a91;};'use strict';var pdf=require(_0xa65e('0x0'));var emlformat=require(_0xa65e('0x1'));var rimraf=require(_0xa65e('0x2'));var zipdir=require(_0xa65e('0x3'));var jsonpatch=require(_0xa65e('0x4'));var rp=require(_0xa65e('0x5'));var moment=require('moment');var BPromise=require(_0xa65e('0x6'));var Mustache=require('mustache');var util=require(_0xa65e('0x7'));var path=require(_0xa65e('0x8'));var sox=require(_0xa65e('0x9'));var csv=require('to-csv');var ejs=require(_0xa65e('0xa'));var fs=require('fs');var _=require(_0xa65e('0xb'));var squel=require('squel');var crypto=require(_0xa65e('0xc'));var jsforce=require(_0xa65e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa65e('0xe'));var querystring=require(_0xa65e('0xf'));var Papa=require(_0xa65e('0x10'));var Redis=require(_0xa65e('0x11'));var authService=require(_0xa65e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa65e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa65e('0x14'))(_0xa65e('0x15'));var utils=require(_0xa65e('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa65e('0x17')]=_[_0xa65e('0x18')](config[_0xa65e('0x17')],{'host':_0xa65e('0x19'),'port':0x18eb});var socket=require(_0xa65e('0x1a'))(new Redis(config[_0xa65e('0x17')]));require(_0xa65e('0x1b'))[_0xa65e('0x1c')](socket);function respondWithStatusCode(_0x549008,_0x162b2c){_0x162b2c=_0x162b2c||0xcc;return function(_0x558ca8){if(_0x558ca8){return _0x549008['sendStatus'](_0x162b2c);}return _0x549008[_0xa65e('0x1d')](_0x162b2c)[_0xa65e('0x1e')]();};}function respondWithResult(_0x5a4020,_0x4fa6b5){_0x4fa6b5=_0x4fa6b5||0xc8;return function(_0xf3a746){if(_0xf3a746){return _0x5a4020[_0xa65e('0x1d')](_0x4fa6b5)[_0xa65e('0x1f')](_0xf3a746);}};}function respondWithFilteredResult(_0x1b6319,_0x461c16){return function(_0x5ab6b7){if(_0x5ab6b7){var _0x3e8102=_0x5ab6b7[_0xa65e('0x20')],_0x2c8455=_0x461c16['offset'],_0x34c229=_0x461c16['offset']+_0x461c16['limit'],_0x3e92ec;if(_0x34c229>=_0x3e8102){_0x34c229=_0x3e8102;_0x3e92ec=0xc8;}else{_0x3e92ec=0xce;}_0x1b6319[_0xa65e('0x1d')](_0x3e92ec);return _0x1b6319[_0xa65e('0x21')](_0xa65e('0x22'),_0x2c8455+'-'+_0x34c229+'/'+_0x3e8102)[_0xa65e('0x1f')](_0x5ab6b7);}return null;};}function patchUpdates(_0x521181){return function(_0x279e5c){try{jsonpatch[_0xa65e('0x23')](_0x279e5c,_0x521181,!![]);}catch(_0x554cdc){return BPromise[_0xa65e('0x24')](_0x554cdc);}return _0x279e5c['save']();};}function saveUpdates(_0x230ebe,_0x3bd6c2){return function(_0x298f55){if(_0x298f55){return _0x298f55['update'](_0x230ebe)[_0xa65e('0x25')](function(_0x4d4f3b){return _0x4d4f3b;});}return null;};}function removeEntity(_0x2dd81d,_0x132041){return function(_0x442e17){if(_0x442e17){return _0x442e17['destroy']()[_0xa65e('0x25')](function(){_0x2dd81d[_0xa65e('0x1d')](0xcc)[_0xa65e('0x1e')]();});}};}function handleEntityNotFound(_0x5dd2f6,_0x34b715){return function(_0x54088a){if(!_0x54088a){_0x5dd2f6['sendStatus'](0x194);}return _0x54088a;};}function handleError(_0x3178f5,_0x260040){_0x260040=_0x260040||0x1f4;return function(_0x2e9f11){logger[_0xa65e('0x26')](_0x2e9f11[_0xa65e('0x27')]);if(_0x2e9f11[_0xa65e('0x28')]){delete _0x2e9f11['name'];}_0x3178f5[_0xa65e('0x1d')](_0x260040)[_0xa65e('0x29')](_0x2e9f11);};}exports[_0xa65e('0x2a')]=function(_0x1dbe3e,_0x17eabf,_0x2581ca){if(!_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')](_0xa65e('0x2d'))&&!_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')]('TemplateId')){throw new db['Sequelize'][(_0xa65e('0x2e'))](_0xa65e('0x2f'));}else{if(_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')](_0xa65e('0x30'))&&!_0x1dbe3e[_0xa65e('0x2b')]['hasOwnProperty']('view')){throw new db[(_0xa65e('0x31'))][(_0xa65e('0x2e'))](_0xa65e('0x32'));}if(!_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')](_0xa65e('0x33'))){throw new db['Sequelize'][(_0xa65e('0x2e'))](_0xa65e('0x34'));}else{try{var _0x499102=JSON['parse'](_0x1dbe3e['body'][_0xa65e('0x33')]);}catch(_0x5f511d){logger[_0xa65e('0x26')](_0x5f511d);throw new db[(_0xa65e('0x31'))][(_0xa65e('0x2e'))](_0xa65e('0x35'));}var _0x209dcf=['chatqueue',_0xa65e('0x36'),'mailqueue','openchannelqueue',_0xa65e('0x37'),_0xa65e('0x38'),'whatsappqueue',_0xa65e('0x39'),'user'];if(_[_0xa65e('0x3a')](_0x499102,function(_0x3d2bb0){return!_['includes'](_0x209dcf,_0x3d2bb0[_0xa65e('0x3b')][_0xa65e('0x3c')]());})){throw new db[(_0xa65e('0x31'))][(_0xa65e('0x2e'))](_0xa65e('0x3d'));}}}var _0x29eef5={};_0x29eef5[_0xa65e('0x3e')]=_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x2c')]('senderName')?_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x3e')]:_0x1dbe3e[_0xa65e('0x3f')][_0xa65e('0x40')];_0x29eef5[_0xa65e('0x41')]=_['isEmpty'](_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x41')])?null:_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x41')];_0x29eef5[_0xa65e('0x42')]=_0x1dbe3e[_0xa65e('0x2b')][_0xa65e('0x42')]||![];_0x29eef5['SenderId']=_0x1dbe3e[_0xa65e('0x3f')]['id'];return getContent(_0x1dbe3e[_0xa65e('0x2b')])[_0xa65e('0x25')](function(_0x277fc6){_0x29eef5[_0xa65e('0x2b')]=_0x277fc6;return getRecipients(_0x499102);})['then'](function(_0x582da3){_0x29eef5[_0xa65e('0x43')]=_['sortBy'](_0x582da3)['join'](',');return db[_0xa65e('0x44')][_0xa65e('0x45')](function(_0x5c7059){return db[_0xa65e('0x46')][_0xa65e('0x47')](_0x29eef5,{'raw':!![],'transaction':_0x5c7059})[_0xa65e('0x25')](function(_0x339a77){var _0x51b9c1={'sender':_0x29eef5[_0xa65e('0x3e')],'description':_0x29eef5[_0xa65e('0x41')],'content':_0x29eef5[_0xa65e('0x2b')],'beep':_0x29eef5[_0xa65e('0x42')]};_0x582da3[_0xa65e('0x48')](function(_0x2773e3){_0x51b9c1['recipient']=_0x2773e3;socket[_0xa65e('0x49')](_0xa65e('0x4a'),_0x51b9c1);});return _0x339a77;});});})[_0xa65e('0x25')](respondWithResult(_0x17eabf,0xc9))[_0xa65e('0x4b')](handleError(_0x17eabf,null));};function getContent(_0x2aa51a){return new BPromise(function(_0x535237,_0x1508dc){if(_0x2aa51a['text']){_0x535237(_0x2aa51a[_0xa65e('0x2d')]);return;}return db[_0xa65e('0x4c')][_0xa65e('0x4d')]({'attributes':[_0xa65e('0x4e')],'where':{'id':_0x2aa51a[_0xa65e('0x30')]},'raw':!![]})[_0xa65e('0x25')](function(_0x44f516){if(!_0x44f516)throw new db['Sequelize'][(_0xa65e('0x2e'))](_0xa65e('0x4f'));var _0x1898ba=Mustache[_0xa65e('0x50')](_0x44f516['html'],_0x2aa51a[_0xa65e('0x51')]);_0x535237(_0x1898ba);})['catch'](function(_0x526459){_0x1508dc(_0x526459);});});}function getRecipients(_0x57171b){return new BPromise(function(_0x31d883,_0x52a483){var _0x3b1467=[];var _0xc56aa9=[];_0x57171b[_0xa65e('0x48')](function(_0x493ae0){var _0x4050d7=_['startCase'](_0x493ae0[_0xa65e('0x3b')][_0xa65e('0x3c')]());if(_0x4050d7===_0xa65e('0x52')){_0x3b1467=_[_0xa65e('0x53')](_0x3b1467,_0x493ae0[_0xa65e('0x54')]);}else{if(_[_0xa65e('0x55')](_0x4050d7,_0xa65e('0x56')))_0x4050d7=_0x4050d7[_0xa65e('0x57')](_0xa65e('0x56'),_0xa65e('0x58'));_0x493ae0[_0xa65e('0x54')][_0xa65e('0x48')](function(_0x5cc29d){_0xc56aa9[_0xa65e('0x59')](getAgents(_0x4050d7,_0x5cc29d));});}});return BPromise[_0xa65e('0x5a')](_0xc56aa9)['then'](function(_0x2cd70a){_0x3b1467=_[_0xa65e('0x53')](_0x3b1467,_[_0xa65e('0x5b')](_0x2cd70a));_0x31d883(_0x3b1467);})[_0xa65e('0x4b')](function(_0x4868c0){_0x52a483(_0x4868c0);});});}function getAgents(_0x33e45f,_0x1ead4b){return new BPromise(function(_0x3962e0,_0x5e6fa6){return db[_0x33e45f][_0xa65e('0x4d')]({'where':{'id':_0x1ead4b}})[_0xa65e('0x25')](function(_0xdad1ff){return _0xdad1ff[_0xa65e('0x5c')]({'attributes':['id'],'raw':!![]})[_0xa65e('0x25')](function(_0x305cc5){var _0xf5521f=_[_0xa65e('0x5d')](_0x305cc5,'id');_0x3962e0(_0xf5521f);});})[_0xa65e('0x4b')](function(_0x3bb3f7){_0x5e6fa6(_0x3bb3f7);});});} \ No newline at end of file +var _0x9442=['toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','sequelize','Notification','create','emit','notification:send','catch','Template','findOne','html','forEach','union','ids','queue','replace','push','all','flatten','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','status','end','stack','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model'];(function(_0x1d40a0,_0x1bc80d){var _0x4015a3=function(_0x95267c){while(--_0x95267c){_0x1d40a0['push'](_0x1d40a0['shift']());}};_0x4015a3(++_0x1bc80d);}(_0x9442,0x135));var _0x2944=function(_0x3f21f9,_0x5a04a9){_0x3f21f9=_0x3f21f9-0x0;var _0x2c83f7=_0x9442[_0x3f21f9];return _0x2c83f7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2944('0x0'));var zipdir=require(_0x2944('0x1'));var jsonpatch=require(_0x2944('0x2'));var rp=require(_0x2944('0x3'));var moment=require('moment');var BPromise=require(_0x2944('0x4'));var Mustache=require(_0x2944('0x5'));var util=require(_0x2944('0x6'));var path=require(_0x2944('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2944('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2944('0x9'));var crypto=require(_0x2944('0xa'));var jsforce=require(_0x2944('0xb'));var deskjs=require(_0x2944('0xc'));var toCsv=require(_0x2944('0xd'));var querystring=require(_0x2944('0xe'));var Papa=require(_0x2944('0xf'));var Redis=require(_0x2944('0x10'));var authService=require(_0x2944('0x11'));var qs=require(_0x2944('0x12'));var as=require(_0x2944('0x13'));var hardwareService=require(_0x2944('0x14'));var logger=require(_0x2944('0x15'))(_0x2944('0x16'));var utils=require(_0x2944('0x17'));var config=require(_0x2944('0x18'));var db=require(_0x2944('0x19'))['db'];config[_0x2944('0x1a')]=_[_0x2944('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2944('0x1a')]));require('./notification.socket')[_0x2944('0x1c')](socket);function respondWithStatusCode(_0x1a6401,_0x1ec1da){_0x1ec1da=_0x1ec1da||0xcc;return function(_0x505d83){if(_0x505d83){return _0x1a6401[_0x2944('0x1d')](_0x1ec1da);}return _0x1a6401['status'](_0x1ec1da)['end']();};}function respondWithResult(_0x302d34,_0x34ea0d){_0x34ea0d=_0x34ea0d||0xc8;return function(_0x3b8796){if(_0x3b8796){return _0x302d34['status'](_0x34ea0d)[_0x2944('0x1e')](_0x3b8796);}};}function respondWithFilteredResult(_0x44cdfe,_0x1004da){return function(_0x519102){if(_0x519102){var _0xddb70b=_0x519102[_0x2944('0x1f')],_0x3d1429=_0x1004da[_0x2944('0x20')],_0x1aa959=_0x1004da['offset']+_0x1004da[_0x2944('0x21')],_0x2964d2;if(_0x1aa959>=_0xddb70b){_0x1aa959=_0xddb70b;_0x2964d2=0xc8;}else{_0x2964d2=0xce;}_0x44cdfe['status'](_0x2964d2);return _0x44cdfe['set'](_0x2944('0x22'),_0x3d1429+'-'+_0x1aa959+'/'+_0xddb70b)[_0x2944('0x1e')](_0x519102);}return null;};}function patchUpdates(_0x57b4d4){return function(_0xe1c89f){try{jsonpatch['apply'](_0xe1c89f,_0x57b4d4,!![]);}catch(_0x497a54){return BPromise[_0x2944('0x23')](_0x497a54);}return _0xe1c89f[_0x2944('0x24')]();};}function saveUpdates(_0x2359c8,_0x29794a){return function(_0x5bf251){if(_0x5bf251){return _0x5bf251[_0x2944('0x25')](_0x2359c8)[_0x2944('0x26')](function(_0x581d1c){return _0x581d1c;});}return null;};}function removeEntity(_0x2be600,_0x5f1d94){return function(_0x533f64){if(_0x533f64){return _0x533f64[_0x2944('0x27')]()[_0x2944('0x26')](function(){_0x2be600[_0x2944('0x28')](0xcc)[_0x2944('0x29')]();});}};}function handleEntityNotFound(_0x80452e,_0x166214){return function(_0x3e466a){if(!_0x3e466a){_0x80452e['sendStatus'](0x194);}return _0x3e466a;};}function handleError(_0x2108c9,_0x54203a){_0x54203a=_0x54203a||0x1f4;return function(_0x28cc03){logger['error'](_0x28cc03[_0x2944('0x2a')]);if(_0x28cc03['name']){delete _0x28cc03['name'];}_0x2108c9[_0x2944('0x28')](_0x54203a)[_0x2944('0x2b')](_0x28cc03);};}exports[_0x2944('0x2c')]=function(_0xc19090,_0x53b336,_0x10e211){if(!_0xc19090[_0x2944('0x2d')][_0x2944('0x2e')](_0x2944('0x2f'))&&!_0xc19090[_0x2944('0x2d')][_0x2944('0x2e')](_0x2944('0x30'))){throw new db[(_0x2944('0x31'))]['ValidationError'](_0x2944('0x32'));}else{if(_0xc19090[_0x2944('0x2d')]['hasOwnProperty'](_0x2944('0x30'))&&!_0xc19090[_0x2944('0x2d')][_0x2944('0x2e')](_0x2944('0x33'))){throw new db['Sequelize'][(_0x2944('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xc19090[_0x2944('0x2d')]['hasOwnProperty'](_0x2944('0x35'))){throw new db['Sequelize'][(_0x2944('0x34'))](_0x2944('0x36'));}else{try{var _0x24c506=JSON['parse'](_0xc19090[_0x2944('0x2d')][_0x2944('0x35')]);}catch(_0x388f0b){logger[_0x2944('0x37')](_0x388f0b);throw new db['Sequelize'][(_0x2944('0x34'))](_0x2944('0x38'));}var _0x2df045=[_0x2944('0x39'),_0x2944('0x3a'),'mailqueue',_0x2944('0x3b'),'smsqueue',_0x2944('0x3c'),_0x2944('0x3d'),_0x2944('0x3e'),_0x2944('0x3f')];if(_[_0x2944('0x40')](_0x24c506,function(_0x291698){return!_[_0x2944('0x41')](_0x2df045,_0x291698[_0x2944('0x42')][_0x2944('0x43')]());})){throw new db[(_0x2944('0x31'))]['ValidationError'](_0x2944('0x44'));}}}var _0x1ffb9e={};_0x1ffb9e[_0x2944('0x45')]=_0xc19090['body'][_0x2944('0x2e')](_0x2944('0x45'))?_0xc19090['body'][_0x2944('0x45')]:_0xc19090['user'][_0x2944('0x46')];_0x1ffb9e[_0x2944('0x47')]=_[_0x2944('0x48')](_0xc19090[_0x2944('0x2d')][_0x2944('0x47')])?null:_0xc19090[_0x2944('0x2d')][_0x2944('0x47')];_0x1ffb9e[_0x2944('0x49')]=_0xc19090[_0x2944('0x2d')]['beep']||![];_0x1ffb9e['SenderId']=_0xc19090['user']['id'];return getContent(_0xc19090['body'])[_0x2944('0x26')](function(_0x4819e1){_0x1ffb9e[_0x2944('0x2d')]=_0x4819e1;return getRecipients(_0x24c506);})['then'](function(_0x59258d){_0x1ffb9e[_0x2944('0x4a')]=_[_0x2944('0x4b')](_0x59258d)['join'](',');return db[_0x2944('0x4c')]['transaction'](function(_0x1bfdd9){return db[_0x2944('0x4d')][_0x2944('0x4e')](_0x1ffb9e,{'raw':!![],'transaction':_0x1bfdd9})['then'](function(_0x46fdde){var _0xdfb58e={'sender':_0x1ffb9e[_0x2944('0x45')],'description':_0x1ffb9e['recipientsDescription'],'content':_0x1ffb9e['body'],'beep':_0x1ffb9e[_0x2944('0x49')]};_0x59258d['forEach'](function(_0x352093){_0xdfb58e['recipient']=_0x352093;socket[_0x2944('0x4f')](_0x2944('0x50'),_0xdfb58e);});return _0x46fdde;});});})[_0x2944('0x26')](respondWithResult(_0x53b336,0xc9))[_0x2944('0x51')](handleError(_0x53b336,null));};function getContent(_0x456809){return new BPromise(function(_0x298103,_0x2f8b88){if(_0x456809[_0x2944('0x2f')]){_0x298103(_0x456809[_0x2944('0x2f')]);return;}return db[_0x2944('0x52')][_0x2944('0x53')]({'attributes':[_0x2944('0x54')],'where':{'id':_0x456809[_0x2944('0x30')]},'raw':!![]})[_0x2944('0x26')](function(_0x286495){if(!_0x286495)throw new db[(_0x2944('0x31'))][(_0x2944('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3bce51=Mustache['render'](_0x286495[_0x2944('0x54')],_0x456809[_0x2944('0x33')]);_0x298103(_0x3bce51);})[_0x2944('0x51')](function(_0x457453){_0x2f8b88(_0x457453);});});}function getRecipients(_0x5a033){return new BPromise(function(_0x41f3f0,_0x542cd1){var _0x242308=[];var _0x516769=[];_0x5a033[_0x2944('0x55')](function(_0x54f23d){var _0x524fd2=_['startCase'](_0x54f23d[_0x2944('0x42')]['toLowerCase']());if(_0x524fd2==='User'){_0x242308=_[_0x2944('0x56')](_0x242308,_0x54f23d[_0x2944('0x57')]);}else{if(_['includes'](_0x524fd2,_0x2944('0x58')))_0x524fd2=_0x524fd2[_0x2944('0x59')](_0x2944('0x58'),'Queue');_0x54f23d['ids'][_0x2944('0x55')](function(_0x2a90bd){_0x516769[_0x2944('0x5a')](getAgents(_0x524fd2,_0x2a90bd));});}});return BPromise[_0x2944('0x5b')](_0x516769)[_0x2944('0x26')](function(_0x49292d){_0x242308=_[_0x2944('0x56')](_0x242308,_[_0x2944('0x5c')](_0x49292d));_0x41f3f0(_0x242308);})[_0x2944('0x51')](function(_0x35cd4e){_0x542cd1(_0x35cd4e);});});}function getAgents(_0x2047e8,_0x168da8){return new BPromise(function(_0x1ffd96,_0x2ee70c){return db[_0x2047e8]['findOne']({'where':{'id':_0x168da8}})[_0x2944('0x26')](function(_0x1b3479){return _0x1b3479[_0x2944('0x5d')]({'attributes':['id'],'raw':!![]})[_0x2944('0x26')](function(_0x236a71){var _0x3340f8=_['map'](_0x236a71,'id');_0x1ffd96(_0x3340f8);});})['catch'](function(_0x11cdb3){_0x2ee70c(_0x11cdb3);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 27090aa..a7876bc 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x57336e,_0x5db5b9){var _0x204ae0=function(_0xe65f1b){while(--_0xe65f1b){_0x57336e['push'](_0x57336e['shift']());}};_0x204ae0(++_0x5db5b9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0xdb28,0x106));var _0x8db2=function(_0x1a567d,_0x3e6af0){_0x1a567d=_0x1a567d-0x0;var _0x38cf8a=_0xdb28[_0x1a567d];return _0x38cf8a;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index fad8dff..fd29ac9 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 _0xda3f=['../../config/environment','exports','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf'];(function(_0x1a7bec,_0x31bbd7){var _0x55bf92=function(_0x2de764){while(--_0x2de764){_0x1a7bec['push'](_0x1a7bec['shift']());}};_0x55bf92(++_0x31bbd7);}(_0xda3f,0xec));var _0xfda3=function(_0x6f5206,_0x3d8cfd){_0x6f5206=_0x6f5206-0x0;var _0x1e725c=_0xda3f[_0x6f5206];return _0x1e725c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./notification.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfda3('0x8'),'collate':_0xfda3('0x9')});}; \ No newline at end of file +var _0x0972=['define','notifications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','rimraf','../../config/environment','./notification.attributes','exports'];(function(_0x1a72cb,_0x2ed497){var _0x271e70=function(_0x4a5c26){while(--_0x4a5c26){_0x1a72cb['push'](_0x1a72cb['shift']());}};_0x271e70(++_0x2ed497);}(_0x0972,0x64));var _0x2097=function(_0x32cfe6,_0x2a55bb){_0x32cfe6=_0x32cfe6-0x0;var _0xa13e0b=_0x0972[_0x32cfe6];return _0xa13e0b;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('Notification',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2097('0xa'),'collate':_0x2097('0xb')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index afffa53..9672e16 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 _0x530d=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x303e50,_0x335e8a){var _0x442d97=function(_0x4e61aa){while(--_0x4e61aa){_0x303e50['push'](_0x303e50['shift']());}};_0x442d97(++_0x335e8a);}(_0x530d,0x17b));var _0xd530=function(_0x436634,_0x4fc3fb){_0x436634=_0x436634-0x0;var _0x4cbacd=_0x530d[_0x436634];return _0x4cbacd;};'use strict';var _=require(_0xd530('0x0'));var util=require('util');var moment=require(_0xd530('0x1'));var BPromise=require(_0xd530('0x2'));var rs=require(_0xd530('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd530('0x4'))['db'];var utils=require(_0xd530('0x5'));var logger=require(_0xd530('0x6'))(_0xd530('0x7'));var config=require(_0xd530('0x8'));var jayson=require(_0xd530('0x9'));var client=jayson[_0xd530('0xa')][_0xd530('0xb')]({'port':0x232a});config[_0xd530('0xc')]=_[_0xd530('0xd')](config['redis'],{'host':_0xd530('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x3fb1c0,_0x219524,_0x22cdc8){return new BPromise(function(_0x234186,_0x1b5e54){return client[_0xd530('0xf')](_0x3fb1c0,_0x22cdc8)['then'](function(_0x58fb85){logger[_0xd530('0x10')](_0xd530('0x11'),_0x219524,_0xd530('0x12'));logger[_0xd530('0x13')](_0xd530('0x14'),_0x219524,'request\x20sent',JSON[_0xd530('0x15')](_0x58fb85));if(_0x58fb85[_0xd530('0x16')]){if(_0x58fb85['error'][_0xd530('0x17')]===0x1f4){logger[_0xd530('0x16')](_0xd530('0x11'),_0x219524,_0x58fb85[_0xd530('0x16')][_0xd530('0x18')]);return _0x1b5e54(_0x58fb85[_0xd530('0x16')][_0xd530('0x18')]);}logger[_0xd530('0x16')](_0xd530('0x11'),_0x219524,_0x58fb85['error'][_0xd530('0x18')]);return _0x234186(_0x58fb85[_0xd530('0x16')]['message']);}else{logger[_0xd530('0x10')](_0xd530('0x11'),_0x219524,_0xd530('0x12'));_0x234186(_0x58fb85[_0xd530('0x19')][_0xd530('0x18')]);}})[_0xd530('0x1a')](function(_0x5be30c){logger[_0xd530('0x16')](_0xd530('0x11'),_0x219524,_0x5be30c);_0x1b5e54(_0x5be30c);});});} \ No newline at end of file +var _0xbf71=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x28a0b3,_0x39b7d1){var _0x4fd5f3=function(_0x507988){while(--_0x507988){_0x28a0b3['push'](_0x28a0b3['shift']());}};_0x4fd5f3(++_0x39b7d1);}(_0xbf71,0x127));var _0x1bf7=function(_0x425565,_0x4f15e1){_0x425565=_0x425565-0x0;var _0x3db3a9=_0xbf71[_0x425565];return _0x3db3a9;};'use strict';var _=require(_0x1bf7('0x0'));var util=require(_0x1bf7('0x1'));var moment=require('moment');var BPromise=require(_0x1bf7('0x2'));var rs=require(_0x1bf7('0x3'));var fs=require('fs');var Redis=require(_0x1bf7('0x4'));var db=require(_0x1bf7('0x5'))['db'];var utils=require(_0x1bf7('0x6'));var logger=require(_0x1bf7('0x7'))(_0x1bf7('0x8'));var config=require('../../config/environment');var jayson=require(_0x1bf7('0x9'));var client=jayson['client'][_0x1bf7('0xa')]({'port':0x232a});config['redis']=_[_0x1bf7('0xb')](config[_0x1bf7('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1bf7('0xc')]));require(_0x1bf7('0xd'))[_0x1bf7('0xe')](socket);function respondWithRpcPromise(_0x19e7ea,_0x3dc109,_0x436a9a){return new BPromise(function(_0x527d0b,_0x4610b7){return client[_0x1bf7('0xf')](_0x19e7ea,_0x436a9a)[_0x1bf7('0x10')](function(_0x17ab3d){logger[_0x1bf7('0x11')](_0x1bf7('0x12'),_0x3dc109,_0x1bf7('0x13'));logger[_0x1bf7('0x14')](_0x1bf7('0x15'),_0x3dc109,_0x1bf7('0x13'),JSON['stringify'](_0x17ab3d));if(_0x17ab3d[_0x1bf7('0x16')]){if(_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x17')]===0x1f4){logger[_0x1bf7('0x16')](_0x1bf7('0x12'),_0x3dc109,_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x18')]);return _0x4610b7(_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x18')]);}logger[_0x1bf7('0x16')](_0x1bf7('0x12'),_0x3dc109,_0x17ab3d[_0x1bf7('0x16')][_0x1bf7('0x18')]);return _0x527d0b(_0x17ab3d['error'][_0x1bf7('0x18')]);}else{logger[_0x1bf7('0x11')](_0x1bf7('0x12'),_0x3dc109,_0x1bf7('0x13'));_0x527d0b(_0x17ab3d[_0x1bf7('0x19')]['message']);}})[_0x1bf7('0x1a')](function(_0x5132d6){logger[_0x1bf7('0x16')](_0x1bf7('0x12'),_0x3dc109,_0x5132d6);_0x4610b7(_0x5132d6);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 4f64173..272edf5 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 _0x39da=['notification:','./notification.events','update','removeListener','register','length'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x39da,0x115));var _0xa39d=function(_0x55f4c3,_0x1e8d70){_0x55f4c3=_0x55f4c3-0x0;var _0x46582c=_0x39da[_0x55f4c3];return _0x46582c;};'use strict';var NotificationEvents=require(_0xa39d('0x0'));var events=['save','remove',_0xa39d('0x1')];function createListener(_0x533867,_0x3c6ec4){return function(_0x3ced4d){_0x3c6ec4['emit'](_0x533867,_0x3ced4d);};}function removeListener(_0x5f552c,_0x41b671){return function(){NotificationEvents[_0xa39d('0x2')](_0x5f552c,_0x41b671);};}exports[_0xa39d('0x3')]=function(_0x43ccdc){for(var _0x413602=0x0,_0x55e850=events[_0xa39d('0x4')];_0x413602<_0x55e850;_0x413602++){var _0x2abfb3=events[_0x413602];var _0x4dec58=createListener(_0xa39d('0x5')+_0x2abfb3,_0x43ccdc);NotificationEvents['on'](_0x2abfb3,_0x4dec58);}}; \ No newline at end of file +var _0x620f=['save','remove','update','emit','removeListener','register','length','notification:'];(function(_0x13e0ae,_0x8b5ca5){var _0x1dbc69=function(_0x2dfc90){while(--_0x2dfc90){_0x13e0ae['push'](_0x13e0ae['shift']());}};_0x1dbc69(++_0x8b5ca5);}(_0x620f,0xe8));var _0xf620=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x620f[_0x3ab51d];return _0x29a04e;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xf620('0x0'),_0xf620('0x1'),_0xf620('0x2')];function createListener(_0x3c3b7f,_0x11ada5){return function(_0x5a956f){_0x11ada5[_0xf620('0x3')](_0x3c3b7f,_0x5a956f);};}function removeListener(_0x25df40,_0x3c865c){return function(){NotificationEvents[_0xf620('0x4')](_0x25df40,_0x3c865c);};}exports[_0xf620('0x5')]=function(_0x8dd0d7){for(var _0x1d0865=0x0,_0x57e9f4=events[_0xf620('0x6')];_0x1d0865<_0x57e9f4;_0x1d0865++){var _0x3c4121=events[_0x1d0865];var _0x3e74df=createListener(_0xf620('0x7')+_0x3c4121,_0x8dd0d7);NotificationEvents['on'](_0x3c4121,_0x3e74df);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 22e9a6c..8b91871 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 _0xd079=['notify','/:id/send','send','put','update','destroy','delete','/:id/dispositions','removeDispositions','removeAnswers','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/canned_answers','/:id/notify'];(function(_0x22419f,_0x1ea160){var _0x1e1b68=function(_0x3bb649){while(--_0x3bb649){_0x22419f['push'](_0x22419f['shift']());}};_0x1e1b68(++_0x1ea160);}(_0xd079,0x1bb));var _0x9d07=function(_0x4e020c,_0x46a143){_0x4e020c=_0x4e020c-0x0;var _0x2cec33=_0xd079[_0x4e020c];return _0x2cec33;};'use strict';var multer=require(_0x9d07('0x0'));var util=require('util');var path=require(_0x9d07('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d07('0x2'));var router=express['Router']();var auth=require(_0x9d07('0x3'));var interaction=require(_0x9d07('0x4'));var config=require(_0x9d07('0x5'));var controller=require(_0x9d07('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d07('0x7')]);router[_0x9d07('0x8')](_0x9d07('0x9'),auth[_0x9d07('0xa')](),controller[_0x9d07('0xb')]);router[_0x9d07('0x8')](_0x9d07('0xc'),auth[_0x9d07('0xa')](),controller[_0x9d07('0xd')]);router['get']('/:id/dispositions',auth[_0x9d07('0xa')](),controller[_0x9d07('0xe')]);router[_0x9d07('0x8')]('/:id/canned_answers',auth[_0x9d07('0xa')](),controller[_0x9d07('0xf')]);router[_0x9d07('0x8')](_0x9d07('0x10'),auth[_0x9d07('0xa')](),controller[_0x9d07('0x11')]);router[_0x9d07('0x8')](_0x9d07('0x12'),auth[_0x9d07('0xa')](),controller[_0x9d07('0x13')]);router[_0x9d07('0x8')](_0x9d07('0x14'),auth[_0x9d07('0xa')](),controller[_0x9d07('0x15')]);router[_0x9d07('0x16')]('/',auth[_0x9d07('0xa')](),controller['create']);router[_0x9d07('0x16')]('/:id/dispositions',auth[_0x9d07('0xa')](),controller['addDisposition']);router[_0x9d07('0x16')](_0x9d07('0x17'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x9d07('0x18'),controller[_0x9d07('0x19')]);router[_0x9d07('0x16')](_0x9d07('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9d07('0x16')](_0x9d07('0x14'),auth[_0x9d07('0xa')](),controller['addAgents']);router['post'](_0x9d07('0x1a'),auth['isAuthenticated'](),controller[_0x9d07('0x1b')]);router[_0x9d07('0x1c')](_0x9d07('0xc'),auth['isAuthenticated'](),controller[_0x9d07('0x1d')]);router['delete'](_0x9d07('0xc'),auth['isAuthenticated'](),controller[_0x9d07('0x1e')]);router[_0x9d07('0x1f')](_0x9d07('0x20'),auth['isAuthenticated'](),controller[_0x9d07('0x21')]);router[_0x9d07('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9d07('0x22')]);router[_0x9d07('0x1f')](_0x9d07('0x14'),auth[_0x9d07('0xa')](),controller['removeAgents']);module[_0x9d07('0x23')]=router; \ No newline at end of file +var _0x80d6=['/:id/canned_answers','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addAgents','send','update','delete','destroy','removeDispositions'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x80d6,0xa0));var _0x680d=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x80d6[_0x5f382f];return _0x3bb11b;};'use strict';var multer=require(_0x680d('0x0'));var util=require('util');var path=require(_0x680d('0x1'));var timeout=require(_0x680d('0x2'));var express=require(_0x680d('0x3'));var router=express['Router']();var auth=require(_0x680d('0x4'));var interaction=require(_0x680d('0x5'));var config=require(_0x680d('0x6'));var controller=require(_0x680d('0x7'));router[_0x680d('0x8')]('/',auth['isAuthenticated'](),controller[_0x680d('0x9')]);router[_0x680d('0x8')](_0x680d('0xa'),auth[_0x680d('0xb')](),controller[_0x680d('0xc')]);router[_0x680d('0x8')](_0x680d('0xd'),auth['isAuthenticated'](),controller[_0x680d('0xe')]);router[_0x680d('0x8')](_0x680d('0xf'),auth[_0x680d('0xb')](),controller[_0x680d('0x10')]);router[_0x680d('0x8')]('/:id/canned_answers',auth[_0x680d('0xb')](),controller[_0x680d('0x11')]);router[_0x680d('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x680d('0x12')]);router[_0x680d('0x8')](_0x680d('0x13'),auth['isAuthenticated'](),controller[_0x680d('0x14')]);router[_0x680d('0x8')](_0x680d('0x15'),auth['isAuthenticated'](),controller[_0x680d('0x16')]);router[_0x680d('0x17')]('/',auth[_0x680d('0xb')](),controller[_0x680d('0x18')]);router[_0x680d('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x680d('0x19')]);router[_0x680d('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x680d('0x1a')]);router[_0x680d('0x17')]('/:id/notify',controller[_0x680d('0x1b')]);router[_0x680d('0x17')](_0x680d('0x1c'),auth[_0x680d('0xb')](),controller['addApplications']);router[_0x680d('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x680d('0x1d')]);router[_0x680d('0x17')]('/:id/send',auth[_0x680d('0xb')](),controller[_0x680d('0x1e')]);router['put'](_0x680d('0xd'),auth[_0x680d('0xb')](),controller[_0x680d('0x1f')]);router[_0x680d('0x20')](_0x680d('0xd'),auth[_0x680d('0xb')](),controller[_0x680d('0x21')]);router[_0x680d('0x20')](_0x680d('0xf'),auth[_0x680d('0xb')](),controller[_0x680d('0x22')]);router[_0x680d('0x20')](_0x680d('0x23'),auth[_0x680d('0xb')](),controller[_0x680d('0x24')]);router[_0x680d('0x20')](_0x680d('0x15'),auth[_0x680d('0xb')](),controller[_0x680d('0x25')]);module[_0x680d('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 693c54c..dc85a42 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 _0x4f0f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4f0f,0xff));var _0xf4f0=function(_0x2ea4bc,_0xa49f8f){_0x2ea4bc=_0x2ea4bc-0x0;var _0x29dfe2=_0x4f0f[_0x2ea4bc];return _0x29dfe2;};'use strict';var Sequelize=require(_0xf4f0('0x0'));var rs=require(_0xf4f0('0x1'));module[_0xf4f0('0x2')]={'name':{'type':Sequelize[_0xf4f0('0x3')],'unique':_0xf4f0('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xf4f0('0x3')]},'token':{'type':Sequelize[_0xf4f0('0x3')],'defaultValue':function(){return rs[_0xf4f0('0x5')]();}},'replyUri':{'type':Sequelize[_0xf4f0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf4f0('0x6')],'defaultValue':function(){return _0xf4f0('0x7');}},'notificationSound':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf4f0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf4f0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf4f0('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf4f0('0xa'),'set':function(_0x39963f){if(!_0x39963f)this[_0xf4f0('0xb')](_0xf4f0('0xc'),null);this[_0xf4f0('0xb')](_0xf4f0('0xd'),_0x39963f);}}}; \ No newline at end of file +var _0x3828=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x3828,0xe3));var _0x8382=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3828[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8382('0x0'));module[_0x8382('0x1')]={'name':{'type':Sequelize[_0x8382('0x2')],'unique':_0x8382('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8382('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8382('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8382('0x4')],'defaultValue':function(){return _0x8382('0x5');}},'notificationSound':{'type':Sequelize[_0x8382('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8382('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8382('0x2')]},'queueTransfer':{'type':Sequelize[_0x8382('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8382('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8382('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x8382('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8382('0x9'),'set':function(_0x28ded1){if(!_0x28ded1)this[_0x8382('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x28ded1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 04e0ba4..a0786c5 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 _0x09ac=['get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelAccount','count','include','findAll','show','params','mandatoryDispositionPause','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','rows','removeDispositions','addAnswer','CannedAnswer','findOne','OpenchannelAccountId','removeAnswers','ids','notify','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','orderBy','applications','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','destroy','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','defaults','user','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x09ac,0x81));var _0xc09a=function(_0x24655a,_0x7fa437){_0x24655a=_0x24655a-0x0;var _0x5f4ad4=_0x09ac[_0x24655a];return _0x5f4ad4;};'use strict';var pdf=require(_0xc09a('0x0'));var emlformat=require(_0xc09a('0x1'));var rimraf=require(_0xc09a('0x2'));var zipdir=require(_0xc09a('0x3'));var jsonpatch=require(_0xc09a('0x4'));var rp=require(_0xc09a('0x5'));var moment=require(_0xc09a('0x6'));var BPromise=require(_0xc09a('0x7'));var Mustache=require(_0xc09a('0x8'));var util=require(_0xc09a('0x9'));var path=require(_0xc09a('0xa'));var sox=require(_0xc09a('0xb'));var csv=require(_0xc09a('0xc'));var ejs=require(_0xc09a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc09a('0xe'));var crypto=require(_0xc09a('0xf'));var jsforce=require(_0xc09a('0x10'));var deskjs=require(_0xc09a('0x11'));var toCsv=require(_0xc09a('0xc'));var querystring=require(_0xc09a('0x12'));var Papa=require(_0xc09a('0x13'));var Redis=require(_0xc09a('0x14'));var authService=require(_0xc09a('0x15'));var qs=require(_0xc09a('0x16'));var as=require(_0xc09a('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc09a('0x18'))(_0xc09a('0x19'));var utils=require('../../config/utils');var config=require(_0xc09a('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc09a('0x1b')],{'host':_0xc09a('0x1c'),'port':0x18eb});var socket=require(_0xc09a('0x1d'))(new Redis(config[_0xc09a('0x1b')]));require(_0xc09a('0x1e'))[_0xc09a('0x1f')](socket);var jayson=require(_0xc09a('0x20'));var client=jayson[_0xc09a('0x21')][_0xc09a('0x22')]({'port':0x232c});var client9002=jayson[_0xc09a('0x21')][_0xc09a('0x22')]({'port':0x232a});function checkPasswordPattern(_0x54379f,_0x4899d5,_0x3c2b1d){if(_0x3c2b1d){var _0x30d59e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30d59e[_0xc09a('0x23')](_0x4899d5)){return _0x54379f;}else{throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54379f;}}function respondWithRpcPromise(_0x3c10ee,_0x11e036,_0x507c8c,_0x4cc5ca){return new BPromise(function(_0x9bda08,_0xce2192){var _0x407bfc=_0x4cc5ca||client;return _0x407bfc['request'](_0x3c10ee,_0x507c8c)[_0xc09a('0x26')](function(_0x238621){logger[_0xc09a('0x27')](_0xc09a('0x28'),_0x11e036,_0xc09a('0x29'));logger['debug'](_0xc09a('0x2a'),_0x11e036,_0xc09a('0x29'),JSON['stringify'](_0x238621));if(_0x238621[_0xc09a('0x2b')]){if(_0x238621['error']['code']===0x1f4){logger[_0xc09a('0x2b')](_0xc09a('0x28'),_0x11e036,_0x238621[_0xc09a('0x2b')]['message']);return _0xce2192(_0x238621['error'][_0xc09a('0x2c')]);}logger[_0xc09a('0x2b')](_0xc09a('0x28'),_0x11e036,_0x238621[_0xc09a('0x2b')][_0xc09a('0x2c')]);return _0x9bda08(_0x238621[_0xc09a('0x2b')][_0xc09a('0x2c')]);}else{logger[_0xc09a('0x27')](_0xc09a('0x28'),_0x11e036,'request\x20sent');_0x9bda08(_0x238621[_0xc09a('0x2d')][_0xc09a('0x2c')]);}})[_0xc09a('0x2e')](function(_0x43ac09){logger[_0xc09a('0x2b')](_0xc09a('0x28'),_0x11e036,_0x43ac09);_0xce2192(_0x43ac09);});});}function respondWithStatusCode(_0x1d4288,_0x5bd1fd){_0x5bd1fd=_0x5bd1fd||0xcc;return function(_0x2f95c5){if(_0x2f95c5){return _0x1d4288[_0xc09a('0x2f')](_0x5bd1fd);}return _0x1d4288[_0xc09a('0x30')](_0x5bd1fd)[_0xc09a('0x31')]();};}function respondWithResult(_0x36c4f6,_0x1c716b){_0x1c716b=_0x1c716b||0xc8;return function(_0x3aa226){if(_0x3aa226){return _0x36c4f6['status'](_0x1c716b)[_0xc09a('0x32')](_0x3aa226);}};}function respondWithFilteredResult(_0x1094b,_0x3117f2){return function(_0x135748){if(_0x135748){var _0x29d894=_0x135748['count'],_0x47ae36=_0x3117f2['offset'],_0x120f5c=_0x3117f2[_0xc09a('0x33')]+_0x3117f2[_0xc09a('0x34')],_0x4f0d62;if(_0x120f5c>=_0x29d894){_0x120f5c=_0x29d894;_0x4f0d62=0xc8;}else{_0x4f0d62=0xce;}_0x1094b[_0xc09a('0x30')](_0x4f0d62);return _0x1094b['set'](_0xc09a('0x35'),_0x47ae36+'-'+_0x120f5c+'/'+_0x29d894)['json'](_0x135748);}return null;};}function patchUpdates(_0x52351b){return function(_0x4450bf){try{jsonpatch['apply'](_0x4450bf,_0x52351b,!![]);}catch(_0x53adfc){return BPromise[_0xc09a('0x36')](_0x53adfc);}return _0x4450bf[_0xc09a('0x37')]();};}function saveUpdates(_0x42aae4,_0xedc453){return function(_0x3ab22a){if(_0x3ab22a){return _0x3ab22a[_0xc09a('0x38')](_0x42aae4)[_0xc09a('0x26')](function(_0x286da3){return _0x286da3;});}return null;};}function removeEntity(_0x5d48c0,_0x239625){return function(_0x52ca8b){if(_0x52ca8b){return _0x52ca8b['destroy']()[_0xc09a('0x26')](function(){var _0x1c2eba=_0x52ca8b[_0xc09a('0x39')]({'plain':!![]});var _0x41c721=_0xc09a('0x3a');return db[_0xc09a('0x3b')]['destroy']({'where':{'type':_0x41c721,'resourceId':_0x1c2eba['id']}})['then'](function(){return _0x52ca8b;});})[_0xc09a('0x26')](function(){_0x5d48c0[_0xc09a('0x30')](0xcc)[_0xc09a('0x31')]();});}};}function handleEntityNotFound(_0x37aa25,_0x4cd239){return function(_0x19a4aa){if(!_0x19a4aa){_0x37aa25[_0xc09a('0x2f')](0x194);}return _0x19a4aa;};}function handleError(_0x1660fd,_0x1ec12f){_0x1ec12f=_0x1ec12f||0x1f4;return function(_0x5bc433){logger[_0xc09a('0x2b')](_0x5bc433[_0xc09a('0x3c')]);if(_0x5bc433[_0xc09a('0x3d')]){delete _0x5bc433[_0xc09a('0x3d')];}_0x1660fd[_0xc09a('0x30')](_0x1ec12f)[_0xc09a('0x3e')](_0x5bc433);};}exports[_0xc09a('0x3f')]=function(_0x1ff212,_0x2fb18d){var _0x5ec745={'include':[{'model':db[_0xc09a('0x40')],'as':'mandatoryDispositionPause'}]},_0x18e194={},_0x4115e4={'count':0x0,'rows':[]};var _0x33cd3a=_[_0xc09a('0x41')](db['OpenchannelAccount'][_0xc09a('0x42')],function(_0x17d080){return{'name':_0x17d080['fieldName'],'type':_0x17d080[_0xc09a('0x43')][_0xc09a('0x44')]};});_0x18e194[_0xc09a('0x45')]=_[_0xc09a('0x41')](_0x33cd3a,_0xc09a('0x3d'));_0x18e194[_0xc09a('0x46')]=_['keys'](_0x1ff212[_0xc09a('0x46')]);_0x18e194[_0xc09a('0x47')]=_[_0xc09a('0x48')](_0x18e194[_0xc09a('0x45')],_0x18e194['query']);_0x5ec745['attributes']=_[_0xc09a('0x48')](_0x18e194[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x1ff212[_0xc09a('0x46')][_0xc09a('0x49')]));_0x5ec745[_0xc09a('0x4a')]=_0x5ec745[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x5ec745[_0xc09a('0x4a')]:_0x18e194[_0xc09a('0x45')];if(!_0x1ff212['query'][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x5ec745[_0xc09a('0x34')]=qs[_0xc09a('0x34')](_0x1ff212[_0xc09a('0x46')]['limit']);_0x5ec745['offset']=qs[_0xc09a('0x33')](_0x1ff212['query'][_0xc09a('0x33')]);}_0x5ec745[_0xc09a('0x4e')]=qs[_0xc09a('0x4f')](_0x1ff212[_0xc09a('0x46')]['sort']);_0x5ec745[_0xc09a('0x50')]=qs['filters'](_[_0xc09a('0x51')](_0x1ff212[_0xc09a('0x46')],_0x18e194[_0xc09a('0x47')]),_0x33cd3a);if(_0x1ff212[_0xc09a('0x46')][_0xc09a('0x52')]){_0x5ec745[_0xc09a('0x50')]=_['merge'](_0x5ec745[_0xc09a('0x50')],{'$or':_[_0xc09a('0x41')](_0x33cd3a,function(_0x273c25){if(_0x273c25['type']!==_0xc09a('0x53')){var _0x5a9fbd={};_0x5a9fbd[_0x273c25[_0xc09a('0x3d')]]={'$like':'%'+_0x1ff212[_0xc09a('0x46')]['filter']+'%'};return _0x5a9fbd;}})});}_0x5ec745=_[_0xc09a('0x54')]({},_0x5ec745,_0x1ff212[_0xc09a('0x55')]);var _0x2bcf56={'where':_0x5ec745['where']};return db[_0xc09a('0x56')]['count'](_0x2bcf56)[_0xc09a('0x26')](function(_0x8506f3){_0x4115e4[_0xc09a('0x57')]=_0x8506f3;if(_0x1ff212['query']['includeAll']){_0x5ec745[_0xc09a('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xc09a('0x59')](_0x5ec745);})[_0xc09a('0x26')](function(_0x516440){_0x4115e4['rows']=_0x516440;return _0x4115e4;})['then'](respondWithFilteredResult(_0x2fb18d,_0x5ec745))['catch'](handleError(_0x2fb18d,null));};exports[_0xc09a('0x5a')]=function(_0x4dbb9b,_0x20166f){var _0x26fac4={'raw':![],'where':{'id':_0x4dbb9b[_0xc09a('0x5b')]['id']},'include':[{'model':db[_0xc09a('0x40')],'as':_0xc09a('0x5c')}]},_0x35ea27={};_0x35ea27[_0xc09a('0x45')]=_[_0xc09a('0x5d')](db[_0xc09a('0x56')][_0xc09a('0x42')]);_0x35ea27[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x4dbb9b[_0xc09a('0x46')]);_0x35ea27[_0xc09a('0x47')]=_[_0xc09a('0x48')](_0x35ea27[_0xc09a('0x45')],_0x35ea27['query']);_0x26fac4[_0xc09a('0x4a')]=_['intersection'](_0x35ea27[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x4dbb9b[_0xc09a('0x46')][_0xc09a('0x49')]));_0x26fac4['attributes']=_0x26fac4['attributes']['length']?_0x26fac4[_0xc09a('0x4a')]:_0x35ea27[_0xc09a('0x45')];if(_0x4dbb9b[_0xc09a('0x46')][_0xc09a('0x5e')]){_0x26fac4[_0xc09a('0x58')]=[{'all':!![]}];}_0x26fac4=_['merge']({},_0x26fac4,_0x4dbb9b[_0xc09a('0x55')]);return db[_0xc09a('0x56')][_0xc09a('0x5f')](_0x26fac4)[_0xc09a('0x26')](handleEntityNotFound(_0x20166f,null))[_0xc09a('0x26')](respondWithResult(_0x20166f,null))['catch'](handleError(_0x20166f,null));};exports[_0xc09a('0x60')]=function(_0x27dd10,_0x59bf34){return db[_0xc09a('0x56')][_0xc09a('0x60')](_0x27dd10[_0xc09a('0x61')],{})['then'](function(_0x544ff2){var _0x134ac7=_0x27dd10['user'][_0xc09a('0x39')]({'plain':!![]});if(!_0x134ac7)throw new Error(_0xc09a('0x62'));if(_0x134ac7['role']==='user'){var _0x2c3cd9=_0x544ff2['get']({'plain':!![]});var _0x24ed09='OpenchannelAccounts';return db['UserProfileSection'][_0xc09a('0x5f')]({'where':{'name':_0x24ed09,'userProfileId':_0x134ac7['userProfileId']},'raw':!![]})[_0xc09a('0x26')](function(_0x2c9167){if(_0x2c9167&&_0x2c9167[_0xc09a('0x63')]===0x0){return db['UserProfileResource'][_0xc09a('0x60')]({'name':_0x2c3cd9[_0xc09a('0x3d')],'resourceId':_0x2c3cd9['id'],'type':_0x2c9167[_0xc09a('0x3d')],'sectionId':_0x2c9167['id']},{})[_0xc09a('0x26')](function(){return _0x544ff2;});}else{return _0x544ff2;}})['catch'](function(_0x2ed65e){logger['error'](_0xc09a('0x64'),_0x2ed65e);throw _0x2ed65e;});}return _0x544ff2;})[_0xc09a('0x26')](respondWithResult(_0x59bf34,0xc9))['catch'](handleError(_0x59bf34,null));};exports[_0xc09a('0x38')]=function(_0x1917e1,_0x2be794){if(_0x1917e1[_0xc09a('0x61')]['id']){delete _0x1917e1['body']['id'];}return db['OpenchannelAccount'][_0xc09a('0x5f')]({'where':{'id':_0x1917e1[_0xc09a('0x5b')]['id']},'include':[{'model':db[_0xc09a('0x40')],'as':_0xc09a('0x5c')}]})[_0xc09a('0x26')](handleEntityNotFound(_0x2be794,null))[_0xc09a('0x26')](saveUpdates(_0x1917e1[_0xc09a('0x61')],null))[_0xc09a('0x26')](respondWithResult(_0x2be794,null))[_0xc09a('0x2e')](handleError(_0x2be794,null));};exports['destroy']=function(_0x560810,_0x2ec6d4){return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x560810[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x2ec6d4,null))[_0xc09a('0x26')](removeEntity(_0x2ec6d4,null))['catch'](handleError(_0x2ec6d4,null));};exports[_0xc09a('0x65')]=function(_0x28f6d4,_0x5ec661){return db[_0xc09a('0x56')][_0xc09a('0x65')]()[_0xc09a('0x26')](respondWithResult(_0x5ec661,null))['catch'](handleError(_0x5ec661,null));};exports[_0xc09a('0x66')]=function(_0x5d69bd,_0x3d9a6d,_0x3b0d00){if(_0x5d69bd[_0xc09a('0x61')]['id']){delete _0x5d69bd[_0xc09a('0x61')]['id'];}return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x5d69bd['params']['id']}})['then'](handleEntityNotFound(_0x3d9a6d,null))[_0xc09a('0x26')](function(_0x332c62){if(_0x332c62){_0x5d69bd['body'][_0xc09a('0x67')]=_0x332c62['id'];return db[_0xc09a('0x68')][_0xc09a('0x60')](_0x5d69bd[_0xc09a('0x61')]);}})[_0xc09a('0x26')](respondWithResult(_0x3d9a6d,null))[_0xc09a('0x2e')](handleError(_0x3d9a6d,null));};exports[_0xc09a('0x69')]=function(_0x552956,_0x1dc2c9,_0xfe5383){var _0xac074e={'raw':![],'where':{}};var _0x26d297={};var _0x6f8c9b={'count':0x0,'rows':[]};return db[_0xc09a('0x56')]['findOne']({'where':{'id':_0x552956[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x1dc2c9,null))[_0xc09a('0x26')](function(_0x475034){if(_0x475034){_0x26d297[_0xc09a('0x45')]=_['keys'](db[_0xc09a('0x68')][_0xc09a('0x42')]);_0x26d297[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x552956['query']);_0x26d297[_0xc09a('0x47')]=_[_0xc09a('0x48')](_0x26d297[_0xc09a('0x45')],_0x26d297[_0xc09a('0x46')]);_0xac074e[_0xc09a('0x4a')]=_[_0xc09a('0x48')](_0x26d297[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x552956[_0xc09a('0x46')][_0xc09a('0x49')]));_0xac074e[_0xc09a('0x4a')]=_0xac074e[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0xac074e[_0xc09a('0x4a')]:_0x26d297[_0xc09a('0x45')];if(!_0x552956[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0xac074e[_0xc09a('0x34')]=qs[_0xc09a('0x34')](_0x552956['query']['limit']);_0xac074e[_0xc09a('0x33')]=qs['offset'](_0x552956['query']['offset']);}_0xac074e['order']=qs[_0xc09a('0x4f')](_0x552956[_0xc09a('0x46')][_0xc09a('0x4f')]);_0xac074e[_0xc09a('0x50')]=qs[_0xc09a('0x47')](_[_0xc09a('0x51')](_0x552956['query'],_0x26d297[_0xc09a('0x47')]));_0xac074e['where']['OpenchannelAccountId']=_0x475034['id'];if(_0x552956['query'][_0xc09a('0x52')]){_0xac074e[_0xc09a('0x50')]=_[_0xc09a('0x54')](_0xac074e['where'],{'$or':_[_0xc09a('0x41')](_0xac074e[_0xc09a('0x4a')],function(_0x5e0893){var _0x3b5115={};_0x3b5115[_0x5e0893]={'$like':'%'+_0x552956[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x3b5115;})});}_0xac074e=_[_0xc09a('0x54')]({},_0xac074e,_0x552956[_0xc09a('0x55')]);return db[_0xc09a('0x68')]['count']({'where':_0xac074e['where']})[_0xc09a('0x26')](function(_0x5593fe){_0x6f8c9b[_0xc09a('0x57')]=_0x5593fe;if(_0x552956['query'][_0xc09a('0x5e')]){_0xac074e[_0xc09a('0x58')]=[{'all':!![]}];}return db[_0xc09a('0x68')][_0xc09a('0x59')](_0xac074e);})[_0xc09a('0x26')](function(_0x155fc9){_0x6f8c9b[_0xc09a('0x6a')]=_0x155fc9;return _0x6f8c9b;});}})[_0xc09a('0x26')](respondWithFilteredResult(_0x1dc2c9,_0xac074e))['catch'](handleError(_0x1dc2c9,null));};exports[_0xc09a('0x6b')]=function(_0x1225d7,_0x4d1fe5,_0x44d2d1){return db[_0xc09a('0x56')]['find']({'where':{'id':_0x1225d7[_0xc09a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4d1fe5,null))['then'](function(_0x2c8020){if(_0x2c8020){return _0x2c8020[_0xc09a('0x6b')](_0x1225d7[_0xc09a('0x46')]['ids']);}})[_0xc09a('0x26')](respondWithStatusCode(_0x4d1fe5,null))[_0xc09a('0x2e')](handleError(_0x4d1fe5,null));};exports[_0xc09a('0x6c')]=function(_0x2c8de3,_0x34572b,_0x9973a9){if(_0x2c8de3['body']['id']){delete _0x2c8de3[_0xc09a('0x61')]['id'];}return db['OpenchannelAccount'][_0xc09a('0x5f')]({'where':{'id':_0x2c8de3[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x34572b,null))[_0xc09a('0x26')](function(_0x1a93cb){if(_0x1a93cb){_0x2c8de3['body']['OpenchannelAccountId']=_0x1a93cb['id'];return db[_0xc09a('0x6d')][_0xc09a('0x60')](_0x2c8de3[_0xc09a('0x61')]);}})[_0xc09a('0x26')](respondWithResult(_0x34572b,null))[_0xc09a('0x2e')](handleError(_0x34572b,null));};exports['getAnswers']=function(_0x53803e,_0x43e97c,_0x24a0ab){var _0x577a63={'raw':![],'where':{}};var _0x252890={};var _0x3a31bd={'count':0x0,'rows':[]};return db[_0xc09a('0x56')][_0xc09a('0x6e')]({'where':{'id':_0x53803e[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x43e97c,null))['then'](function(_0x58f1ad){if(_0x58f1ad){_0x252890[_0xc09a('0x45')]=_['keys'](db['CannedAnswer'][_0xc09a('0x42')]);_0x252890[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x53803e['query']);_0x252890[_0xc09a('0x47')]=_['intersection'](_0x252890[_0xc09a('0x45')],_0x252890[_0xc09a('0x46')]);_0x577a63['attributes']=_['intersection'](_0x252890[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x49')]));_0x577a63[_0xc09a('0x4a')]=_0x577a63[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x577a63[_0xc09a('0x4a')]:_0x252890[_0xc09a('0x45')];if(!_0x53803e[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x577a63['limit']=qs[_0xc09a('0x34')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x34')]);_0x577a63[_0xc09a('0x33')]=qs[_0xc09a('0x33')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x33')]);}_0x577a63['order']=qs[_0xc09a('0x4f')](_0x53803e[_0xc09a('0x46')][_0xc09a('0x4f')]);_0x577a63[_0xc09a('0x50')]=qs[_0xc09a('0x47')](_[_0xc09a('0x51')](_0x53803e[_0xc09a('0x46')],_0x252890[_0xc09a('0x47')]));_0x577a63[_0xc09a('0x50')][_0xc09a('0x6f')]=_0x58f1ad['id'];if(_0x53803e[_0xc09a('0x46')][_0xc09a('0x52')]){_0x577a63[_0xc09a('0x50')]=_[_0xc09a('0x54')](_0x577a63['where'],{'$or':_[_0xc09a('0x41')](_0x577a63['attributes'],function(_0x5d5114){var _0x5bc616={};_0x5bc616[_0x5d5114]={'$like':'%'+_0x53803e[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x5bc616;})});}_0x577a63=_[_0xc09a('0x54')]({},_0x577a63,_0x53803e[_0xc09a('0x55')]);return db[_0xc09a('0x6d')]['count']({'where':_0x577a63[_0xc09a('0x50')]})['then'](function(_0x352c3f){_0x3a31bd[_0xc09a('0x57')]=_0x352c3f;if(_0x53803e[_0xc09a('0x46')][_0xc09a('0x5e')]){_0x577a63[_0xc09a('0x58')]=[{'all':!![]}];}return db[_0xc09a('0x6d')]['findAll'](_0x577a63);})[_0xc09a('0x26')](function(_0x1aaf59){_0x3a31bd[_0xc09a('0x6a')]=_0x1aaf59;return _0x3a31bd;});}})['then'](respondWithFilteredResult(_0x43e97c,_0x577a63))[_0xc09a('0x2e')](handleError(_0x43e97c,null));};exports[_0xc09a('0x70')]=function(_0x5b2504,_0x8aac77,_0x1df847){return db['OpenchannelAccount'][_0xc09a('0x5f')]({'where':{'id':_0x5b2504[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x8aac77,null))['then'](function(_0x1868bf){if(_0x1868bf){return _0x1868bf[_0xc09a('0x70')](_0x5b2504[_0xc09a('0x46')][_0xc09a('0x71')]);}})[_0xc09a('0x26')](respondWithStatusCode(_0x8aac77,null))[_0xc09a('0x2e')](handleError(_0x8aac77,null));};exports[_0xc09a('0x72')]=function(_0x364a03,_0x2a878c,_0x596d43){var _0xa03d9={'body':_0x364a03[_0xc09a('0x61')],'channel':'openchannel'};var _0x53e556=[];var _0x5613f7=[];var _0x14afc2={};var _0x44a032=![];return db[_0xc09a('0x73')][_0xc09a('0x65')]()[_0xc09a('0x26')](function(_0x1e5031){if(!_0x1e5031){throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))](_0xc09a('0x74'));}_0x53e556=_[_0xc09a('0x75')](_[_0xc09a('0x5d')](_0x1e5031),[_0xc09a('0x76'),_0xc09a('0x77')]);_0x5613f7=_['difference'](_[_0xc09a('0x5d')](_0x1e5031),[_0xc09a('0x76'),'updatedAt','CompanyId',_0xc09a('0x78')]);if(_0x364a03[_0xc09a('0x61')]['id']){delete _0x364a03[_0xc09a('0x61')]['id'];}if(_[_0xc09a('0x79')](_0x364a03['body'][_0xc09a('0x7a')])){throw new db['Sequelize'][(_0xc09a('0x25'))]('from\x20is\x20mandatory');}if(_[_0xc09a('0x79')](_0x364a03[_0xc09a('0x61')]['body'])||_0x364a03[_0xc09a('0x61')][_0xc09a('0x61')]===''){throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))](_0xc09a('0x7b'));}if(_[_0xc09a('0x79')](_0x364a03[_0xc09a('0x61')][_0xc09a('0x7c')])){throw new db['Sequelize']['ValidationError'](_0xc09a('0x7d')+_0x5613f7);}if(!_[_0xc09a('0x7e')](_0x5613f7,_0x364a03['body'][_0xc09a('0x7c')])){throw new db[(_0xc09a('0x24'))][(_0xc09a('0x25'))](_0xc09a('0x7f')+_0x5613f7);}_0x14afc2[_0x364a03[_0xc09a('0x61')][_0xc09a('0x7c')]]=_0x364a03[_0xc09a('0x61')][_0xc09a('0x7a')];})[_0xc09a('0x26')](function(){return db[_0xc09a('0x56')]['find']({'where':{'id':_0x364a03[_0xc09a('0x5b')]['id']},'include':[{'model':db[_0xc09a('0x80')],'as':'List','include':[{'model':db[_0xc09a('0x73')],'as':_0xc09a('0x81'),'where':_0x14afc2,'limit':0x1,'order':[[_0xc09a('0x77'),_0xc09a('0x82')]]}]},{'model':db[_0xc09a('0x83')],'as':_0xc09a('0x84')}]});})[_0xc09a('0x26')](handleEntityNotFound(_0x2a878c,null))[_0xc09a('0x26')](function(_0x2d95b6){if(_0x2d95b6&&_0x2d95b6[_0xc09a('0x85')]){_0xa03d9[_0xc09a('0x86')]=_0x2d95b6;_0xa03d9['applications']=_0x2d95b6[_0xc09a('0x84')];_0xa03d9['list']=_0x2d95b6[_0xc09a('0x85')];_0xa03d9['applications']=_[_0xc09a('0x87')](_0xa03d9[_0xc09a('0x88')],['priority'],[_0xc09a('0x89')]);if(_0xa03d9[_0xc09a('0x86')]['Applications']){delete _0xa03d9[_0xc09a('0x86')]['Applications'];}if(_0xa03d9[_0xc09a('0x86')]['List']&&_0xa03d9[_0xc09a('0x86')][_0xc09a('0x85')][_0xc09a('0x81')][_0xc09a('0x4b')]){return _0xa03d9[_0xc09a('0x86')]['List'][_0xc09a('0x81')][0x0];}var _0x23d4f8=_['defaults'](_0x364a03['body'],{'firstName':_0x364a03[_0xc09a('0x61')][_0xc09a('0x7a')],'ListId':_0x2d95b6[_0xc09a('0x78')]});_0x23d4f8[_0x364a03['body']['mapKey']]=_0x364a03['body']['from'];return db[_0xc09a('0x73')][_0xc09a('0x60')](_0x23d4f8,{'fields':_0x53e556,'raw':!![]});}})[_0xc09a('0x26')](handleEntityNotFound(_0x2a878c,null))['then'](function(_0x5abd04){_0xa03d9[_0xc09a('0x8a')]=_0x5abd04;if(_0x5abd04){var _0x4c2950={'ContactId':_0x5abd04['id'],'OpenchannelAccountId':_0x364a03[_0xc09a('0x5b')]['id'],'from':(_0x5abd04[_0xc09a('0x8b')]||'')+'\x20'+(_0x5abd04['lastName']||'')};var _0xa63056={'OpenchannelAccountId':_0x364a03[_0xc09a('0x5b')]['id'],'closed':![]};if(_0x364a03['body']['threadId']){_0xa63056[_0xc09a('0x8c')]=_0x364a03[_0xc09a('0x61')][_0xc09a('0x8c')];return db[_0xc09a('0x8d')][_0xc09a('0x5f')]({'where':_0xa63056})['then'](function(_0x2a5945){if(_0x2a5945){return[_0x2a5945,![]];}_0x4c2950[_0xc09a('0x8c')]=_0x364a03['body'][_0xc09a('0x8c')];_0x4c2950['externalUrl']=_0x364a03['body'][_0xc09a('0x8e')];return db[_0xc09a('0x8d')][_0xc09a('0x60')](_0x4c2950)[_0xc09a('0x26')](function(_0x5d9903){return[_0x5d9903,!![]];});});}else{_0xa63056['threadId']=null;}_0xa63056[_0xc09a('0x8f')]=_0x5abd04['id'];return db[_0xc09a('0x8d')]['find']({'where':_0xa63056})[_0xc09a('0x26')](function(_0x28b74e){if(_0x28b74e){return[_0x28b74e,![]];}return db[_0xc09a('0x8d')][_0xc09a('0x60')](_0x4c2950)[_0xc09a('0x26')](function(_0x29534d){return[_0x29534d,!![]];});});}})[_0xc09a('0x90')](function(_0x4252c0,_0x5271cb){if(_0x4252c0){_0x44a032=_0x5271cb;if(!_0x5271cb){var _0xc4fe1d={'from':(_0xa03d9[_0xc09a('0x8a')][_0xc09a('0x8b')]||'')+'\x20'+(_0xa03d9[_0xc09a('0x8a')]['lastName']||'')};if(_0x364a03[_0xc09a('0x61')][_0xc09a('0x8c')]&&_0x364a03[_0xc09a('0x61')][_0xc09a('0x91')]&&_0x364a03['body'][_0xc09a('0x8c')]!=_0x364a03['body'][_0xc09a('0x91')]){_0xc4fe1d[_0xc09a('0x8c')]=_0x364a03[_0xc09a('0x61')][_0xc09a('0x91')];}return _0x4252c0[_0xc09a('0x38')](_0xc4fe1d);}else{return _0x4252c0;}}})['then'](function(_0x42e5f1){_0xa03d9[_0xc09a('0x92')]=_0x42e5f1[_0xc09a('0x39')]({'plain':!![]});_0xa03d9[_0xc09a('0x92')][_0xc09a('0x93')]=_0x44a032;if(_0xa03d9[_0xc09a('0x92')]['created']){if(_0xa03d9[_0xc09a('0x86')][_0xc09a('0x94')]){_0xa03d9[_0xc09a('0x88')][_0xc09a('0x95')]({'id':0x0,'priority':_0xa03d9[_0xc09a('0x88')][_0xc09a('0x4b')]+0x1,'app':_0xc09a('0x96'),'appdata':'unmanaged','interval':_0xc09a('0x97')});}}return db[_0xc09a('0x98')][_0xc09a('0x60')]({'body':_0x364a03[_0xc09a('0x61')]['body'],'OpenchannelAccountId':_0x364a03[_0xc09a('0x5b')]['id'],'OpenchannelInteractionId':_0x42e5f1['id'],'direction':'in','ContactId':_0xa03d9[_0xc09a('0x8a')]['id'],'AttachmentId':_0x364a03['body']['AttachmentId']});})[_0xc09a('0x26')](function(_0x4d5a2b){_0xa03d9[_0xc09a('0x2c')]=_0x4d5a2b;if(_0xa03d9[_0xc09a('0x92')][_0xc09a('0x99')]){return db['User'][_0xc09a('0x5f')]({'attributes':['id',_0xc09a('0x3d')],'where':{'id':_0xa03d9[_0xc09a('0x92')][_0xc09a('0x99')]}})[_0xc09a('0x26')](function(_0x48c9d4){if(_0x48c9d4){_0xa03d9['applications'][_0xc09a('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x48c9d4[_0xc09a('0x3d')]+','+(_0xa03d9[_0xc09a('0x86')][_0xc09a('0x9b')]||0xa),'interval':_0xc09a('0x97')});_0xa03d9[_0xc09a('0x9c')]=![];}return respondWithRpcPromise(_0xc09a('0x9d'),_0xc09a('0x9e'),_0xa03d9);});}return respondWithRpcPromise('Start',_0xc09a('0x9e'),_0xa03d9);})[_0xc09a('0x26')](function(_0x362b02){respondWithRpcPromise(_0xc09a('0x9f'),_0xc09a('0x9f'),{'event':'notify','message':_0x362b02},client9002);return _0x362b02;})[_0xc09a('0x26')](respondWithResult(_0x2a878c,null))[_0xc09a('0x2e')](handleError(_0x2a878c,null));};exports[_0xc09a('0xa0')]=function(_0x14f35a,_0x27e86a,_0x230522){return db[_0xc09a('0x56')]['findOne']({'where':{'id':_0x14f35a[_0xc09a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27e86a,null))['then'](function(_0x4f5e07){if(_0x4f5e07){return db[_0xc09a('0xa1')][_0xc09a('0xa2')](function(_0x1a294e){return db[_0xc09a('0x83')][_0xc09a('0xa3')]({'where':{'OpenchannelAccountId':_0x14f35a[_0xc09a('0x5b')]['id']},'transaction':_0x1a294e})['then'](function(_0x19a042){var _0x5df186=_[_0xc09a('0x41')](_0x14f35a[_0xc09a('0x61')],function(_0x43ee43){_0x43ee43[_0xc09a('0x6f')]=_0x14f35a['params']['id'];return _0x43ee43;});return db[_0xc09a('0x83')]['bulkCreate'](_0x5df186,{'transaction':_0x1a294e});});})[_0xc09a('0x26')](function(){return db[_0xc09a('0x83')][_0xc09a('0xa4')]({'where':{'OpenchannelAccountId':_0x14f35a[_0xc09a('0x5b')]['id']},'order':'priority'});});}})[_0xc09a('0x26')](respondWithResult(_0x27e86a,null))['catch'](handleError(_0x27e86a,null));};exports[_0xc09a('0xa5')]=function(_0x343ffb,_0x5f44ce,_0xab0077){var _0x4f41eb={};var _0x1a81e7={};var _0xc6adfe;var _0x3e12b9;return db[_0xc09a('0x56')][_0xc09a('0x6e')]({'where':{'id':_0x343ffb['params']['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x5f44ce,null))[_0xc09a('0x26')](function(_0x6a9ca8){if(_0x6a9ca8){_0xc6adfe=_0x6a9ca8;_0x1a81e7[_0xc09a('0x45')]=_['keys'](db[_0xc09a('0x83')]['rawAttributes']);_0x1a81e7[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x343ffb[_0xc09a('0x46')]);_0x1a81e7['filters']=_['intersection'](_0x1a81e7[_0xc09a('0x45')],_0x1a81e7[_0xc09a('0x46')]);_0x4f41eb[_0xc09a('0x4a')]=_['intersection'](_0x1a81e7[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x343ffb[_0xc09a('0x46')]['fields']));_0x4f41eb[_0xc09a('0x4a')]=_0x4f41eb['attributes'][_0xc09a('0x4b')]?_0x4f41eb[_0xc09a('0x4a')]:_0x1a81e7[_0xc09a('0x45')];_0x4f41eb[_0xc09a('0x4e')]=qs[_0xc09a('0x4f')](_0x343ffb[_0xc09a('0x46')][_0xc09a('0x4f')]);_0x4f41eb['where']=qs[_0xc09a('0x47')](_['pick'](_0x343ffb[_0xc09a('0x46')],_0x1a81e7[_0xc09a('0x47')]));if(_0x343ffb['query'][_0xc09a('0x52')]){_0x4f41eb[_0xc09a('0x50')]=_['merge'](_0x4f41eb[_0xc09a('0x50')],{'$or':_['map'](_0x4f41eb[_0xc09a('0x4a')],function(_0x2378f6){var _0x481bed={};_0x481bed[_0x2378f6]={'$like':'%'+_0x343ffb[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x481bed;})});}_0x4f41eb=_['merge']({},_0x4f41eb,_0x343ffb[_0xc09a('0x55')]);return _0xc6adfe[_0xc09a('0xa5')](_0x4f41eb);}})[_0xc09a('0x26')](function(_0x58223b){if(_0x58223b){_0x3e12b9=_0x58223b[_0xc09a('0x4b')];if(!_0x343ffb[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x4f41eb[_0xc09a('0x34')]=qs[_0xc09a('0x34')](_0x343ffb[_0xc09a('0x46')]['limit']);_0x4f41eb[_0xc09a('0x33')]=qs[_0xc09a('0x33')](_0x343ffb['query']['offset']);}return _0xc6adfe[_0xc09a('0xa5')](_0x4f41eb);}})[_0xc09a('0x26')](function(_0x432004){if(_0x432004){return _0x432004?{'count':_0x3e12b9,'rows':_0x432004}:null;}})[_0xc09a('0x26')](respondWithResult(_0x5f44ce,null))[_0xc09a('0x2e')](handleError(_0x5f44ce,null));};exports[_0xc09a('0xa6')]=function(_0x41b2a4,_0x52e80f,_0x62f26f){var _0x1276be={'raw':![],'where':{}};var _0x2c027f={};var _0x39344e={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x41b2a4[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x52e80f,null))[_0xc09a('0x26')](function(_0x18e468){if(_0x18e468){_0x2c027f[_0xc09a('0x45')]=_[_0xc09a('0x5d')](db[_0xc09a('0x8d')]['rawAttributes']);_0x2c027f[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x41b2a4['query']);_0x2c027f['filters']=_[_0xc09a('0x48')](_0x2c027f[_0xc09a('0x45')],_0x2c027f[_0xc09a('0x46')]);_0x1276be[_0xc09a('0x4a')]=_[_0xc09a('0x48')](_0x2c027f[_0xc09a('0x45')],qs[_0xc09a('0x49')](_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x49')]));_0x1276be[_0xc09a('0x4a')]=_0x1276be[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x1276be[_0xc09a('0x4a')]:_0x2c027f[_0xc09a('0x45')];if(!_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x4c')](_0xc09a('0x4d'))){_0x1276be[_0xc09a('0x34')]=qs['limit'](_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x34')]);_0x1276be[_0xc09a('0x33')]=qs['offset'](_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x33')]);}_0x1276be['order']=qs[_0xc09a('0x4f')](_0x41b2a4[_0xc09a('0x46')]['sort']);_0x1276be['where']=qs[_0xc09a('0x47')](_[_0xc09a('0x51')](_0x41b2a4['query'],_0x2c027f[_0xc09a('0x47')]));_0x1276be[_0xc09a('0x50')][_0xc09a('0x6f')]=_0x18e468['id'];if(_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x52')]){_0x1276be[_0xc09a('0x50')]=_['merge'](_0x1276be[_0xc09a('0x50')],{'$or':_['map'](_0x1276be[_0xc09a('0x4a')],function(_0x5856f2){var _0x256d02={};_0x256d02[_0x5856f2]={'$like':'%'+_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x52')]+'%'};return _0x256d02;})});}_0x1276be=_[_0xc09a('0x54')]({},_0x1276be,_0x41b2a4[_0xc09a('0x55')]);return db[_0xc09a('0x8d')][_0xc09a('0x57')]({'where':_0x1276be[_0xc09a('0x50')]})['then'](function(_0x48e897){_0x39344e[_0xc09a('0x57')]=_0x48e897;if(_0x41b2a4[_0xc09a('0x46')][_0xc09a('0x5e')]){_0x1276be[_0xc09a('0x58')]=[{'model':db['CmContact'],'as':_0xc09a('0xa7'),'required':![]},{'model':db[_0xc09a('0xa8')],'as':_0xc09a('0xa9'),'attributes':['name',_0xc09a('0xaa'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xc09a('0xab'),'attributes':['id',_0xc09a('0x3d'),_0xc09a('0xac')],'where':_0x41b2a4['query'][_0xc09a('0xad')]?{'id':_0x41b2a4[_0xc09a('0x46')][_0xc09a('0xad')]}:undefined,'required':_0x41b2a4[_0xc09a('0x46')]['tag']?!![]:![]}];}return db[_0xc09a('0x8d')][_0xc09a('0x59')](_0x1276be);})['then'](function(_0x18ff7b){_0x39344e[_0xc09a('0x6a')]=_0x18ff7b;return _0x39344e;});}})['then'](respondWithFilteredResult(_0x52e80f,_0x1276be))[_0xc09a('0x2e')](handleError(_0x52e80f,null));};exports[_0xc09a('0xae')]=function(_0x45647b,_0x54bfc1,_0x59f51a){return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x45647b[_0xc09a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x54bfc1,null))['then'](function(_0x41733e){if(_0x41733e){return _0x41733e[_0xc09a('0xae')](_0x45647b[_0xc09a('0x61')][_0xc09a('0x71')],_[_0xc09a('0xaf')](_0x45647b['body'],['ids','id'])||{})['spread'](function(_0x4db9c4){for(var _0x2b9b64=0x0;_0x2b9b64<_0x45647b['body']['ids'][_0xc09a('0x4b')];_0x2b9b64+=0x1){socket['emit'](_0xc09a('0xb0'),{'UserId':_0x45647b[_0xc09a('0x61')]['ids'][_0x2b9b64],'OpenchannelAccountId':_0x45647b[_0xc09a('0x5b')]['id']});}return _0x4db9c4;});}})[_0xc09a('0x26')](respondWithResult(_0x54bfc1,null))[_0xc09a('0x2e')](handleError(_0x54bfc1,null));};exports['removeAgents']=function(_0x4f355a,_0x566f1c,_0xaa2b87){return db[_0xc09a('0x56')][_0xc09a('0x5f')]({'where':{'id':_0x4f355a[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x566f1c,null))[_0xc09a('0x26')](function(_0x5f0cc7){if(_0x5f0cc7){return _0x5f0cc7[_0xc09a('0xb1')](_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')])[_0xc09a('0x26')](function(){if(_[_0xc09a('0xb2')](_0x4f355a['query'][_0xc09a('0x71')])){for(var _0x56c248=0x0;_0x56c248<_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')][_0xc09a('0x4b')];_0x56c248+=0x1){socket[_0xc09a('0xb3')](_0xc09a('0xb4'),{'UserId':Number(_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')][_0x56c248]),'OpenchannelAccountId':Number(_0x4f355a[_0xc09a('0x5b')]['id'])});}}else{socket[_0xc09a('0xb3')](_0xc09a('0xb4'),{'UserId':Number(_0x4f355a[_0xc09a('0x46')][_0xc09a('0x71')]),'OpenchannelAccountId':Number(_0x4f355a['params']['id'])});}});}})[_0xc09a('0x26')](respondWithStatusCode(_0x566f1c,null))['catch'](handleError(_0x566f1c,null));};exports[_0xc09a('0xb5')]=function(_0x5cc03c,_0x573f35,_0x4b00e0){var _0x48734b={};var _0x86ae51={};var _0x35e82d;var _0xa71fb;return db[_0xc09a('0x56')][_0xc09a('0x6e')]({'where':{'id':_0x5cc03c[_0xc09a('0x5b')]['id']}})[_0xc09a('0x26')](handleEntityNotFound(_0x573f35,null))['then'](function(_0x2feb75){if(_0x2feb75){_0x35e82d=_0x2feb75;_0x86ae51[_0xc09a('0x45')]=_[_0xc09a('0x5d')](db[_0xc09a('0xa8')][_0xc09a('0x42')]);_0x86ae51[_0xc09a('0x46')]=_[_0xc09a('0x5d')](_0x5cc03c[_0xc09a('0x46')]);_0x86ae51[_0xc09a('0x47')]=_['intersection'](_0x86ae51[_0xc09a('0x45')],_0x86ae51[_0xc09a('0x46')]);_0x48734b[_0xc09a('0x4a')]=_[_0xc09a('0x48')](_0x86ae51['model'],qs[_0xc09a('0x49')](_0x5cc03c['query'][_0xc09a('0x49')]));_0x48734b[_0xc09a('0x4a')]=_0x48734b[_0xc09a('0x4a')][_0xc09a('0x4b')]?_0x48734b[_0xc09a('0x4a')]:_0x86ae51[_0xc09a('0x45')];_0x48734b[_0xc09a('0x4e')]=qs[_0xc09a('0x4f')](_0x5cc03c[_0xc09a('0x46')]['sort']);_0x48734b[_0xc09a('0x50')]=qs['filters'](_['pick'](_0x5cc03c['query'],_0x86ae51[_0xc09a('0x47')]));if(_0x5cc03c[_0xc09a('0x46')]['filter']){_0x48734b[_0xc09a('0x50')]=_[_0xc09a('0x54')](_0x48734b[_0xc09a('0x50')],{'$or':_[_0xc09a('0x41')](_0x48734b[_0xc09a('0x4a')],function(_0x1774d7){var _0xe46577={};_0xe46577[_0x1774d7]={'$like':'%'+_0x5cc03c['query'][_0xc09a('0x52')]+'%'};return _0xe46577;})});}_0x48734b=_[_0xc09a('0x54')]({},_0x48734b,_0x5cc03c['options']);return _0x35e82d['getAgents'](_0x48734b);}})[_0xc09a('0x26')](function(_0x16eab4){if(_0x16eab4){_0xa71fb=_0x16eab4['length'];if(!_0x5cc03c[_0xc09a('0x46')]['hasOwnProperty'](_0xc09a('0x4d'))){_0x48734b['limit']=qs[_0xc09a('0x34')](_0x5cc03c['query']['limit']);_0x48734b[_0xc09a('0x33')]=qs[_0xc09a('0x33')](_0x5cc03c['query'][_0xc09a('0x33')]);}return _0x35e82d[_0xc09a('0xb5')](_0x48734b);}})[_0xc09a('0x26')](function(_0x5d4e89){if(_0x5d4e89){return _0x5d4e89?{'count':_0xa71fb,'rows':_0x5d4e89}:null;}})[_0xc09a('0x26')](respondWithResult(_0x573f35,null))[_0xc09a('0x2e')](handleError(_0x573f35,null));};exports[_0xc09a('0x3e')]=function(_0xd78f93,_0x20889e,_0x27ed9d){var _0x577a3d,_0x11fc57,_0x5d3589;if(_[_0xc09a('0x79')](_0xd78f93['body'][_0xc09a('0x61')])||_0xd78f93[_0xc09a('0x61')]['body']===''){throw new db[(_0xc09a('0x24'))]['ValidationError'](_0xc09a('0x7b'));}if(_[_0xc09a('0x79')](_0xd78f93['body']['to'])){}_0x577a3d=_0xd78f93[_0xc09a('0x61')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0xd78f93['params']['id']}})['then'](handleEntityNotFound(_0x20889e,null))[_0xc09a('0x26')](function(_0x5de7e7){if(_0x5de7e7){return db[_0xc09a('0x56')]['find']({'where':{'id':_0x5de7e7['id']},'include':[{'model':db['CmList'],'as':_0xc09a('0x85'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x5de7e7[_0xc09a('0x7c')]]:_0x577a3d},'limit':0x1,'order':[['updatedAt',_0xc09a('0x82')]]}]}]})[_0xc09a('0x26')](handleEntityNotFound(_0x20889e,null))[_0xc09a('0x26')](function(_0x4df509){if(_0x4df509&&_0x4df509['List']){_0x11fc57=_0x4df509[_0xc09a('0x39')]({'plain':!![]});if(_0x11fc57[_0xc09a('0x85')]&&_0x11fc57[_0xc09a('0x85')][_0xc09a('0x81')][_0xc09a('0x4b')]){return _0x11fc57[_0xc09a('0x85')][_0xc09a('0x81')][0x0];}return db[_0xc09a('0x73')][_0xc09a('0x60')](_[_0xc09a('0xb6')](_0xd78f93[_0xc09a('0x61')],{'firstName':_0x577a3d,[_0x4df509['mapKey']]:_0x577a3d,'phone':_0x577a3d,'ListId':_0x11fc57[_0xc09a('0x78')]}));}})[_0xc09a('0x26')](handleEntityNotFound(_0x20889e,null))[_0xc09a('0x26')](function(_0x5290b7){if(_0x5290b7){_0x5d3589=_0x5290b7;return db[_0xc09a('0x8d')][_0xc09a('0x5f')]({'where':{'ContactId':_0x5d3589['id'],'closed':![],'OpenchannelAccountId':_0x11fc57['id']}})[_0xc09a('0x26')](function(_0x375f31){if(_0x375f31){return[_0x375f31,![]];}return db[_0xc09a('0x8d')][_0xc09a('0x60')]({'UserId':_0xd78f93[_0xc09a('0xb7')]['id'],'ContactId':_0x5d3589['id'],'OpenchannelAccountId':_0x11fc57['id'],'lastMsgDirection':'out','Messages':[_[_0xc09a('0x54')](_0xd78f93[_0xc09a('0x61')],{'read':![],'body':_0xd78f93[_0xc09a('0x61')][_0xc09a('0x61')],'OpenchannelAccountId':_0x11fc57['id'],'UserId':_0xd78f93['user']['id'],'ContactId':_0x5d3589['id']})]},{'include':[{'model':db[_0xc09a('0x98')],'as':_0xc09a('0xb8')}]})[_0xc09a('0x26')](function(_0x4f82c9){return[_0x4f82c9,!![]];});});}})[_0xc09a('0x90')](function(_0x5907d7,_0x2aaad2){if(_0x2aaad2){return _0x5907d7;}return db[_0xc09a('0x98')][_0xc09a('0x60')](_['merge'](_0xd78f93[_0xc09a('0x61')],{'read':![],'body':_0xd78f93[_0xc09a('0x61')]['body'],'OpenchannelAccountId':_0x11fc57['id'],'OpenchannelInteractionId':_0x5907d7['id'],'UserId':_0xd78f93['user']['id'],'ContactId':_0x5d3589['id']}))['then'](function(_0x22e82d){_0x5907d7[_0xc09a('0xb9')][_0xc09a('0xb8')]=[];_0x5907d7['dataValues'][_0xc09a('0xb8')][_0xc09a('0x95')](_0x22e82d['dataValues']);return _0x5907d7;});});}})['then'](respondWithResult(_0x20889e,null))[_0xc09a('0x2e')](handleError(_0x20889e,null));}; \ No newline at end of file +var _0x8a8a=['map','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','VIRTUAL','filter','options','OpenchannelAccount','include','findAll','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','intersection','order','merge','includeAll','removeDispositions','ids','OpenchannelAccountId','CannedAnswer','rawAttributes','rows','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','account','Applications','list','applications','priority','asc','Contacts','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','get','created','autoclose','close','*,*,*,*','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','Start','EventManager','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','internal','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','send','out','OpenchannelMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','OpenchannelAccounts','UserProfileResource','end','name','index','mandatoryDispositionPause'];(function(_0x2de7ce,_0x248799){var _0xa621d0=function(_0x440c62){while(--_0x440c62){_0x2de7ce['push'](_0x2de7ce['shift']());}};_0xa621d0(++_0x248799);}(_0x8a8a,0x1eb));var _0xa8a8=function(_0x58a57b,_0x176230){_0x58a57b=_0x58a57b-0x0;var _0x36c35e=_0x8a8a[_0x58a57b];return _0x36c35e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa8a8('0x0'));var rimraf=require(_0xa8a8('0x1'));var zipdir=require(_0xa8a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8a8('0x3'));var moment=require(_0xa8a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8a8('0x5'));var util=require(_0xa8a8('0x6'));var path=require(_0xa8a8('0x7'));var sox=require(_0xa8a8('0x8'));var csv=require(_0xa8a8('0x9'));var ejs=require(_0xa8a8('0xa'));var fs=require('fs');var _=require(_0xa8a8('0xb'));var squel=require(_0xa8a8('0xc'));var crypto=require(_0xa8a8('0xd'));var jsforce=require(_0xa8a8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa8a8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa8a8('0xf'));var authService=require(_0xa8a8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a8('0x11'));var hardwareService=require(_0xa8a8('0x12'));var logger=require('../../config/logger')(_0xa8a8('0x13'));var utils=require(_0xa8a8('0x14'));var config=require(_0xa8a8('0x15'));var db=require(_0xa8a8('0x16'))['db'];config[_0xa8a8('0x17')]=_[_0xa8a8('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa8a8('0x19'))(new Redis(config[_0xa8a8('0x17')]));require(_0xa8a8('0x1a'))[_0xa8a8('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xa8a8('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x1d2629,_0x506694,_0x31a33e){if(_0x31a33e){var _0x5b7f7c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b7f7c[_0xa8a8('0x1d')](_0x506694)){return _0x1d2629;}else{throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x20'));}}else{return _0x1d2629;}}function respondWithRpcPromise(_0x529e53,_0x33a75e,_0x2d2853,_0x1f47eb){return new BPromise(function(_0x2259b8,_0xeaefc5){var _0x564a08=_0x1f47eb||client;return _0x564a08[_0xa8a8('0x21')](_0x529e53,_0x2d2853)['then'](function(_0x197ae8){logger[_0xa8a8('0x22')](_0xa8a8('0x23'),_0x33a75e,'request\x20sent');logger[_0xa8a8('0x24')](_0xa8a8('0x25'),_0x33a75e,_0xa8a8('0x26'),JSON[_0xa8a8('0x27')](_0x197ae8));if(_0x197ae8[_0xa8a8('0x28')]){if(_0x197ae8['error'][_0xa8a8('0x29')]===0x1f4){logger[_0xa8a8('0x28')](_0xa8a8('0x23'),_0x33a75e,_0x197ae8[_0xa8a8('0x28')]['message']);return _0xeaefc5(_0x197ae8[_0xa8a8('0x28')]['message']);}logger[_0xa8a8('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x33a75e,_0x197ae8[_0xa8a8('0x28')][_0xa8a8('0x2a')]);return _0x2259b8(_0x197ae8[_0xa8a8('0x28')][_0xa8a8('0x2a')]);}else{logger['info'](_0xa8a8('0x23'),_0x33a75e,_0xa8a8('0x26'));_0x2259b8(_0x197ae8[_0xa8a8('0x2b')]['message']);}})[_0xa8a8('0x2c')](function(_0x1427a0){logger[_0xa8a8('0x28')](_0xa8a8('0x23'),_0x33a75e,_0x1427a0);_0xeaefc5(_0x1427a0);});});}function respondWithStatusCode(_0xee2e5a,_0x541aa0){_0x541aa0=_0x541aa0||0xcc;return function(_0x493db9){if(_0x493db9){return _0xee2e5a[_0xa8a8('0x2d')](_0x541aa0);}return _0xee2e5a[_0xa8a8('0x2e')](_0x541aa0)['end']();};}function respondWithResult(_0x2a4a75,_0x56d3f1){_0x56d3f1=_0x56d3f1||0xc8;return function(_0x5ccd5a){if(_0x5ccd5a){return _0x2a4a75[_0xa8a8('0x2e')](_0x56d3f1)['json'](_0x5ccd5a);}};}function respondWithFilteredResult(_0x79b60c,_0x24565a){return function(_0x34995e){if(_0x34995e){var _0x1a7c79=_0x34995e[_0xa8a8('0x2f')],_0x5d5da0=_0x24565a['offset'],_0x124afc=_0x24565a[_0xa8a8('0x30')]+_0x24565a[_0xa8a8('0x31')],_0x39b1e4;if(_0x124afc>=_0x1a7c79){_0x124afc=_0x1a7c79;_0x39b1e4=0xc8;}else{_0x39b1e4=0xce;}_0x79b60c['status'](_0x39b1e4);return _0x79b60c[_0xa8a8('0x32')](_0xa8a8('0x33'),_0x5d5da0+'-'+_0x124afc+'/'+_0x1a7c79)[_0xa8a8('0x34')](_0x34995e);}return null;};}function patchUpdates(_0x369b6d){return function(_0x506f79){try{jsonpatch[_0xa8a8('0x35')](_0x506f79,_0x369b6d,!![]);}catch(_0x96018f){return BPromise[_0xa8a8('0x36')](_0x96018f);}return _0x506f79['save']();};}function saveUpdates(_0xa57bf5,_0x1c1bbe){return function(_0x3cb0b9){if(_0x3cb0b9){return _0x3cb0b9[_0xa8a8('0x37')](_0xa57bf5)[_0xa8a8('0x38')](function(_0x37914a){return _0x37914a;});}return null;};}function removeEntity(_0x813c9f,_0x24ea86){return function(_0x39b6a2){if(_0x39b6a2){return _0x39b6a2[_0xa8a8('0x39')]()[_0xa8a8('0x38')](function(){var _0x443c44=_0x39b6a2['get']({'plain':!![]});var _0x7a5364=_0xa8a8('0x3a');return db[_0xa8a8('0x3b')][_0xa8a8('0x39')]({'where':{'type':_0x7a5364,'resourceId':_0x443c44['id']}})[_0xa8a8('0x38')](function(){return _0x39b6a2;});})[_0xa8a8('0x38')](function(){_0x813c9f[_0xa8a8('0x2e')](0xcc)[_0xa8a8('0x3c')]();});}};}function handleEntityNotFound(_0xf03f00,_0x42e435){return function(_0x10218d){if(!_0x10218d){_0xf03f00[_0xa8a8('0x2d')](0x194);}return _0x10218d;};}function handleError(_0x22ad12,_0x8f77cd){_0x8f77cd=_0x8f77cd||0x1f4;return function(_0x243bce){logger[_0xa8a8('0x28')](_0x243bce['stack']);if(_0x243bce[_0xa8a8('0x3d')]){delete _0x243bce['name'];}_0x22ad12[_0xa8a8('0x2e')](_0x8f77cd)['send'](_0x243bce);};}exports[_0xa8a8('0x3e')]=function(_0x132541,_0x296f1b){var _0x41a5ec={'include':[{'model':db['Pause'],'as':_0xa8a8('0x3f')}]},_0x5b24fb={},_0x392177={'count':0x0,'rows':[]};var _0x319485=_[_0xa8a8('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x4487ce){return{'name':_0x4487ce[_0xa8a8('0x41')],'type':_0x4487ce['type']['key']};});_0x5b24fb[_0xa8a8('0x42')]=_[_0xa8a8('0x40')](_0x319485,_0xa8a8('0x3d'));_0x5b24fb[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x132541[_0xa8a8('0x43')]);_0x5b24fb[_0xa8a8('0x45')]=_['intersection'](_0x5b24fb[_0xa8a8('0x42')],_0x5b24fb[_0xa8a8('0x43')]);_0x41a5ec[_0xa8a8('0x46')]=_['intersection'](_0x5b24fb[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x132541[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x41a5ec[_0xa8a8('0x46')]=_0x41a5ec[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x41a5ec['attributes']:_0x5b24fb[_0xa8a8('0x42')];if(!_0x132541['query'][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x41a5ec[_0xa8a8('0x31')]=qs[_0xa8a8('0x31')](_0x132541[_0xa8a8('0x43')][_0xa8a8('0x31')]);_0x41a5ec[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x132541[_0xa8a8('0x43')]['offset']);}_0x41a5ec['order']=qs[_0xa8a8('0x4b')](_0x132541[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x41a5ec['where']=qs[_0xa8a8('0x45')](_[_0xa8a8('0x4c')](_0x132541[_0xa8a8('0x43')],_0x5b24fb[_0xa8a8('0x45')]),_0x319485);if(_0x132541[_0xa8a8('0x43')]['filter']){_0x41a5ec[_0xa8a8('0x4d')]=_['merge'](_0x41a5ec[_0xa8a8('0x4d')],{'$or':_['map'](_0x319485,function(_0x144dc3){if(_0x144dc3[_0xa8a8('0x4e')]!==_0xa8a8('0x4f')){var _0x5441f8={};_0x5441f8[_0x144dc3[_0xa8a8('0x3d')]]={'$like':'%'+_0x132541[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0x5441f8;}})});}_0x41a5ec=_['merge']({},_0x41a5ec,_0x132541[_0xa8a8('0x51')]);var _0x2dcb4d={'where':_0x41a5ec[_0xa8a8('0x4d')]};return db[_0xa8a8('0x52')]['count'](_0x2dcb4d)[_0xa8a8('0x38')](function(_0x1d3c1b){_0x392177[_0xa8a8('0x2f')]=_0x1d3c1b;if(_0x132541[_0xa8a8('0x43')]['includeAll']){_0x41a5ec[_0xa8a8('0x53')]=[{'all':!![]}];}return db[_0xa8a8('0x52')][_0xa8a8('0x54')](_0x41a5ec);})[_0xa8a8('0x38')](function(_0x8c3dc1){_0x392177['rows']=_0x8c3dc1;return _0x392177;})['then'](respondWithFilteredResult(_0x296f1b,_0x41a5ec))[_0xa8a8('0x2c')](handleError(_0x296f1b,null));};exports['show']=function(_0x50c3bc,_0x4f9cc0){var _0x35f816={'raw':![],'where':{'id':_0x50c3bc[_0xa8a8('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xa8a8('0x3f')}]},_0x26a998={};_0x26a998[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db['OpenchannelAccount']['rawAttributes']);_0x26a998[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x50c3bc['query']);_0x26a998[_0xa8a8('0x45')]=_['intersection'](_0x26a998['model'],_0x26a998[_0xa8a8('0x43')]);_0x35f816['attributes']=_['intersection'](_0x26a998[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x50c3bc[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x35f816[_0xa8a8('0x46')]=_0x35f816['attributes'][_0xa8a8('0x48')]?_0x35f816[_0xa8a8('0x46')]:_0x26a998[_0xa8a8('0x42')];if(_0x50c3bc[_0xa8a8('0x43')]['includeAll']){_0x35f816[_0xa8a8('0x53')]=[{'all':!![]}];}_0x35f816=_['merge']({},_0x35f816,_0x50c3bc[_0xa8a8('0x51')]);return db[_0xa8a8('0x52')][_0xa8a8('0x56')](_0x35f816)['then'](handleEntityNotFound(_0x4f9cc0,null))[_0xa8a8('0x38')](respondWithResult(_0x4f9cc0,null))[_0xa8a8('0x2c')](handleError(_0x4f9cc0,null));};exports[_0xa8a8('0x57')]=function(_0xa39012,_0x29b988){return db[_0xa8a8('0x52')][_0xa8a8('0x57')](_0xa39012[_0xa8a8('0x58')],{})['then'](function(_0xa73f54){var _0x548da1=_0xa39012[_0xa8a8('0x59')]['get']({'plain':!![]});if(!_0x548da1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x548da1[_0xa8a8('0x5a')]===_0xa8a8('0x59')){var _0xf0e5ca=_0xa73f54['get']({'plain':!![]});var _0x24f1ae='OpenchannelAccounts';return db[_0xa8a8('0x5b')][_0xa8a8('0x56')]({'where':{'name':_0x24f1ae,'userProfileId':_0x548da1[_0xa8a8('0x5c')]},'raw':!![]})['then'](function(_0x11d134){if(_0x11d134&&_0x11d134[_0xa8a8('0x5d')]===0x0){return db[_0xa8a8('0x3b')]['create']({'name':_0xf0e5ca['name'],'resourceId':_0xf0e5ca['id'],'type':_0x11d134[_0xa8a8('0x3d')],'sectionId':_0x11d134['id']},{})[_0xa8a8('0x38')](function(){return _0xa73f54;});}else{return _0xa73f54;}})[_0xa8a8('0x2c')](function(_0x2c1e6e){logger[_0xa8a8('0x28')](_0xa8a8('0x5e'),_0x2c1e6e);throw _0x2c1e6e;});}return _0xa73f54;})['then'](respondWithResult(_0x29b988,0xc9))[_0xa8a8('0x2c')](handleError(_0x29b988,null));};exports[_0xa8a8('0x37')]=function(_0x19e4ee,_0x4c6bc0){if(_0x19e4ee[_0xa8a8('0x58')]['id']){delete _0x19e4ee[_0xa8a8('0x58')]['id'];}return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x19e4ee['params']['id']},'include':[{'model':db[_0xa8a8('0x5f')],'as':_0xa8a8('0x3f')}]})['then'](handleEntityNotFound(_0x4c6bc0,null))[_0xa8a8('0x38')](saveUpdates(_0x19e4ee['body'],null))[_0xa8a8('0x38')](respondWithResult(_0x4c6bc0,null))[_0xa8a8('0x2c')](handleError(_0x4c6bc0,null));};exports[_0xa8a8('0x39')]=function(_0x51be4f,_0x3e0f3d){return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x51be4f['params']['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e0f3d,null))[_0xa8a8('0x38')](removeEntity(_0x3e0f3d,null))[_0xa8a8('0x2c')](handleError(_0x3e0f3d,null));};exports['describe']=function(_0x37e2d7,_0x4f8152){return db['OpenchannelAccount'][_0xa8a8('0x60')]()[_0xa8a8('0x38')](respondWithResult(_0x4f8152,null))['catch'](handleError(_0x4f8152,null));};exports[_0xa8a8('0x61')]=function(_0x65576b,_0x432269,_0x5ab1e6){if(_0x65576b[_0xa8a8('0x58')]['id']){delete _0x65576b[_0xa8a8('0x58')]['id'];}return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x65576b['params']['id']}})['then'](handleEntityNotFound(_0x432269,null))[_0xa8a8('0x38')](function(_0x3639cf){if(_0x3639cf){_0x65576b[_0xa8a8('0x58')][_0xa8a8('0x62')]=_0x3639cf['id'];return db[_0xa8a8('0x63')]['create'](_0x65576b['body']);}})[_0xa8a8('0x38')](respondWithResult(_0x432269,null))['catch'](handleError(_0x432269,null));};exports[_0xa8a8('0x64')]=function(_0x4a1dda,_0x58f970,_0xd30d08){var _0x31efd9={'raw':![],'where':{}};var _0x5e3cc3={};var _0x401f00={'count':0x0,'rows':[]};return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x4a1dda[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x58f970,null))[_0xa8a8('0x38')](function(_0x1baf9b){if(_0x1baf9b){_0x5e3cc3[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db['Disposition']['rawAttributes']);_0x5e3cc3[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x4a1dda[_0xa8a8('0x43')]);_0x5e3cc3[_0xa8a8('0x45')]=_[_0xa8a8('0x66')](_0x5e3cc3[_0xa8a8('0x42')],_0x5e3cc3[_0xa8a8('0x43')]);_0x31efd9[_0xa8a8('0x46')]=_[_0xa8a8('0x66')](_0x5e3cc3[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x4a1dda['query'][_0xa8a8('0x47')]));_0x31efd9[_0xa8a8('0x46')]=_0x31efd9[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x31efd9['attributes']:_0x5e3cc3[_0xa8a8('0x42')];if(!_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x31efd9[_0xa8a8('0x31')]=qs['limit'](_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x31')]);_0x31efd9[_0xa8a8('0x30')]=qs['offset'](_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x30')]);}_0x31efd9[_0xa8a8('0x67')]=qs[_0xa8a8('0x4b')](_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x31efd9[_0xa8a8('0x4d')]=qs[_0xa8a8('0x45')](_[_0xa8a8('0x4c')](_0x4a1dda[_0xa8a8('0x43')],_0x5e3cc3[_0xa8a8('0x45')]));_0x31efd9[_0xa8a8('0x4d')]['OpenchannelAccountId']=_0x1baf9b['id'];if(_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x50')]){_0x31efd9[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x31efd9['where'],{'$or':_[_0xa8a8('0x40')](_0x31efd9[_0xa8a8('0x46')],function(_0x5f41e0){var _0x5d55d1={};_0x5d55d1[_0x5f41e0]={'$like':'%'+_0x4a1dda[_0xa8a8('0x43')]['filter']+'%'};return _0x5d55d1;})});}_0x31efd9=_[_0xa8a8('0x68')]({},_0x31efd9,_0x4a1dda['options']);return db[_0xa8a8('0x63')][_0xa8a8('0x2f')]({'where':_0x31efd9[_0xa8a8('0x4d')]})[_0xa8a8('0x38')](function(_0x5a1596){_0x401f00[_0xa8a8('0x2f')]=_0x5a1596;if(_0x4a1dda[_0xa8a8('0x43')][_0xa8a8('0x69')]){_0x31efd9[_0xa8a8('0x53')]=[{'all':!![]}];}return db[_0xa8a8('0x63')][_0xa8a8('0x54')](_0x31efd9);})[_0xa8a8('0x38')](function(_0x3bb738){_0x401f00['rows']=_0x3bb738;return _0x401f00;});}})[_0xa8a8('0x38')](respondWithFilteredResult(_0x58f970,_0x31efd9))[_0xa8a8('0x2c')](handleError(_0x58f970,null));};exports[_0xa8a8('0x6a')]=function(_0x151458,_0x418be3,_0x28c909){return db['OpenchannelAccount'][_0xa8a8('0x56')]({'where':{'id':_0x151458['params']['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x418be3,null))[_0xa8a8('0x38')](function(_0x940ddf){if(_0x940ddf){return _0x940ddf[_0xa8a8('0x6a')](_0x151458[_0xa8a8('0x43')][_0xa8a8('0x6b')]);}})[_0xa8a8('0x38')](respondWithStatusCode(_0x418be3,null))[_0xa8a8('0x2c')](handleError(_0x418be3,null));};exports['addAnswer']=function(_0xdf8174,_0x5d2c61,_0x2fa366){if(_0xdf8174[_0xa8a8('0x58')]['id']){delete _0xdf8174[_0xa8a8('0x58')]['id'];}return db[_0xa8a8('0x52')]['find']({'where':{'id':_0xdf8174['params']['id']}})['then'](handleEntityNotFound(_0x5d2c61,null))['then'](function(_0x3baec6){if(_0x3baec6){_0xdf8174[_0xa8a8('0x58')][_0xa8a8('0x6c')]=_0x3baec6['id'];return db[_0xa8a8('0x6d')][_0xa8a8('0x57')](_0xdf8174['body']);}})['then'](respondWithResult(_0x5d2c61,null))['catch'](handleError(_0x5d2c61,null));};exports['getAnswers']=function(_0x46207a,_0x4f003d,_0x5a26e8){var _0x1623af={'raw':![],'where':{}};var _0x1816a0={};var _0x25dce1={'count':0x0,'rows':[]};return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x46207a[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x4f003d,null))[_0xa8a8('0x38')](function(_0x31fbb1){if(_0x31fbb1){_0x1816a0[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0x6d')][_0xa8a8('0x6e')]);_0x1816a0[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x46207a['query']);_0x1816a0['filters']=_[_0xa8a8('0x66')](_0x1816a0['model'],_0x1816a0[_0xa8a8('0x43')]);_0x1623af['attributes']=_['intersection'](_0x1816a0[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x1623af[_0xa8a8('0x46')]=_0x1623af[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x1623af[_0xa8a8('0x46')]:_0x1816a0[_0xa8a8('0x42')];if(!_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x1623af[_0xa8a8('0x31')]=qs['limit'](_0x46207a['query'][_0xa8a8('0x31')]);_0x1623af['offset']=qs[_0xa8a8('0x30')](_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x30')]);}_0x1623af['order']=qs['sort'](_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x1623af[_0xa8a8('0x4d')]=qs[_0xa8a8('0x45')](_['pick'](_0x46207a[_0xa8a8('0x43')],_0x1816a0[_0xa8a8('0x45')]));_0x1623af[_0xa8a8('0x4d')]['OpenchannelAccountId']=_0x31fbb1['id'];if(_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x50')]){_0x1623af[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x1623af[_0xa8a8('0x4d')],{'$or':_[_0xa8a8('0x40')](_0x1623af[_0xa8a8('0x46')],function(_0x50866c){var _0x41504b={};_0x41504b[_0x50866c]={'$like':'%'+_0x46207a[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0x41504b;})});}_0x1623af=_[_0xa8a8('0x68')]({},_0x1623af,_0x46207a[_0xa8a8('0x51')]);return db['CannedAnswer'][_0xa8a8('0x2f')]({'where':_0x1623af['where']})[_0xa8a8('0x38')](function(_0x15fdad){_0x25dce1[_0xa8a8('0x2f')]=_0x15fdad;if(_0x46207a[_0xa8a8('0x43')]['includeAll']){_0x1623af[_0xa8a8('0x53')]=[{'all':!![]}];}return db[_0xa8a8('0x6d')][_0xa8a8('0x54')](_0x1623af);})[_0xa8a8('0x38')](function(_0x1b3929){_0x25dce1[_0xa8a8('0x6f')]=_0x1b3929;return _0x25dce1;});}})['then'](respondWithFilteredResult(_0x4f003d,_0x1623af))[_0xa8a8('0x2c')](handleError(_0x4f003d,null));};exports[_0xa8a8('0x70')]=function(_0x2d40cf,_0x2292ce,_0x124df4){return db[_0xa8a8('0x52')][_0xa8a8('0x56')]({'where':{'id':_0x2d40cf[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x2292ce,null))[_0xa8a8('0x38')](function(_0x4f6c5e){if(_0x4f6c5e){return _0x4f6c5e[_0xa8a8('0x70')](_0x2d40cf[_0xa8a8('0x43')][_0xa8a8('0x6b')]);}})[_0xa8a8('0x38')](respondWithStatusCode(_0x2292ce,null))[_0xa8a8('0x2c')](handleError(_0x2292ce,null));};exports[_0xa8a8('0x71')]=function(_0xfcc7ab,_0x38c7cc,_0x370770){var _0x41d69a={'body':_0xfcc7ab[_0xa8a8('0x58')],'channel':_0xa8a8('0x72')};var _0x492001=[];var _0x524ae7=[];var _0x4cc046={};var _0x2bf347=![];return db[_0xa8a8('0x73')][_0xa8a8('0x60')]()[_0xa8a8('0x38')](function(_0x11f3d9){if(!_0x11f3d9){throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x74'));}_0x492001=_[_0xa8a8('0x75')](_[_0xa8a8('0x44')](_0x11f3d9),['createdAt',_0xa8a8('0x76')]);_0x524ae7=_[_0xa8a8('0x75')](_[_0xa8a8('0x44')](_0x11f3d9),[_0xa8a8('0x77'),_0xa8a8('0x76'),'CompanyId','ListId']);if(_0xfcc7ab[_0xa8a8('0x58')]['id']){delete _0xfcc7ab['body']['id'];}if(_[_0xa8a8('0x78')](_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x79')])){throw new db['Sequelize'][(_0xa8a8('0x1f'))](_0xa8a8('0x7a'));}if(_[_0xa8a8('0x78')](_0xfcc7ab['body'][_0xa8a8('0x58')])||_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x58')]===''){throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x7b'));}if(_[_0xa8a8('0x78')](_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x7c')])){throw new db[(_0xa8a8('0x1e'))]['ValidationError'](_0xa8a8('0x7d')+_0x524ae7);}if(!_[_0xa8a8('0x7e')](_0x524ae7,_0xfcc7ab[_0xa8a8('0x58')]['mapKey'])){throw new db[(_0xa8a8('0x1e'))][(_0xa8a8('0x1f'))](_0xa8a8('0x7f')+_0x524ae7);}_0x4cc046[_0xfcc7ab[_0xa8a8('0x58')]['mapKey']]=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x79')];})[_0xa8a8('0x38')](function(){return db[_0xa8a8('0x52')]['find']({'where':{'id':_0xfcc7ab[_0xa8a8('0x55')]['id']},'include':[{'model':db[_0xa8a8('0x80')],'as':_0xa8a8('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4cc046,'limit':0x1,'order':[[_0xa8a8('0x76'),_0xa8a8('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xa8a8('0x38')](handleEntityNotFound(_0x38c7cc,null))[_0xa8a8('0x38')](function(_0x9736fb){if(_0x9736fb&&_0x9736fb[_0xa8a8('0x81')]){_0x41d69a[_0xa8a8('0x83')]=_0x9736fb;_0x41d69a['applications']=_0x9736fb[_0xa8a8('0x84')];_0x41d69a[_0xa8a8('0x85')]=_0x9736fb[_0xa8a8('0x81')];_0x41d69a[_0xa8a8('0x86')]=_['orderBy'](_0x41d69a[_0xa8a8('0x86')],[_0xa8a8('0x87')],[_0xa8a8('0x88')]);if(_0x41d69a['account']['Applications']){delete _0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x84')];}if(_0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x81')]&&_0x41d69a['account'][_0xa8a8('0x81')][_0xa8a8('0x89')][_0xa8a8('0x48')]){return _0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x81')][_0xa8a8('0x89')][0x0];}var _0x4a7269=_[_0xa8a8('0x18')](_0xfcc7ab[_0xa8a8('0x58')],{'firstName':_0xfcc7ab['body'][_0xa8a8('0x79')],'ListId':_0x9736fb[_0xa8a8('0x8a')]});_0x4a7269[_0xfcc7ab[_0xa8a8('0x58')]['mapKey']]=_0xfcc7ab[_0xa8a8('0x58')]['from'];return db[_0xa8a8('0x73')][_0xa8a8('0x57')](_0x4a7269,{'fields':_0x492001,'raw':!![]});}})[_0xa8a8('0x38')](handleEntityNotFound(_0x38c7cc,null))[_0xa8a8('0x38')](function(_0x58c9e9){_0x41d69a[_0xa8a8('0x8b')]=_0x58c9e9;if(_0x58c9e9){var _0x131682={'ContactId':_0x58c9e9['id'],'OpenchannelAccountId':_0xfcc7ab[_0xa8a8('0x55')]['id'],'from':(_0x58c9e9[_0xa8a8('0x8c')]||'')+'\x20'+(_0x58c9e9['lastName']||'')};var _0x4b37cb={'OpenchannelAccountId':_0xfcc7ab[_0xa8a8('0x55')]['id'],'closed':![]};if(_0xfcc7ab[_0xa8a8('0x58')]['threadId']){_0x4b37cb[_0xa8a8('0x8d')]=_0xfcc7ab[_0xa8a8('0x58')]['threadId'];return db[_0xa8a8('0x8e')][_0xa8a8('0x56')]({'where':_0x4b37cb})[_0xa8a8('0x38')](function(_0x630181){if(_0x630181){return[_0x630181,![]];}_0x131682['threadId']=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x8d')];_0x131682[_0xa8a8('0x8f')]=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x8f')];return db[_0xa8a8('0x8e')][_0xa8a8('0x57')](_0x131682)[_0xa8a8('0x38')](function(_0x435c6d){return[_0x435c6d,!![]];});});}else{_0x4b37cb[_0xa8a8('0x8d')]=null;}_0x4b37cb[_0xa8a8('0x90')]=_0x58c9e9['id'];return db[_0xa8a8('0x8e')]['find']({'where':_0x4b37cb})[_0xa8a8('0x38')](function(_0x890d81){if(_0x890d81){return[_0x890d81,![]];}return db['OpenchannelInteraction'][_0xa8a8('0x57')](_0x131682)['then'](function(_0x4a8fcc){return[_0x4a8fcc,!![]];});});}})[_0xa8a8('0x91')](function(_0x428c61,_0x560c6e){if(_0x428c61){_0x2bf347=_0x560c6e;if(!_0x560c6e){var _0x5bb523={'from':(_0x41d69a[_0xa8a8('0x8b')][_0xa8a8('0x8c')]||'')+'\x20'+(_0x41d69a[_0xa8a8('0x8b')][_0xa8a8('0x92')]||'')};if(_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x8d')]&&_0xfcc7ab['body'][_0xa8a8('0x93')]&&_0xfcc7ab[_0xa8a8('0x58')]['threadId']!=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x93')]){_0x5bb523['threadId']=_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x93')];}return _0x428c61[_0xa8a8('0x37')](_0x5bb523);}else{return _0x428c61;}}})[_0xa8a8('0x38')](function(_0x330279){_0x41d69a[_0xa8a8('0x94')]=_0x330279[_0xa8a8('0x95')]({'plain':!![]});_0x41d69a[_0xa8a8('0x94')][_0xa8a8('0x96')]=_0x2bf347;if(_0x41d69a[_0xa8a8('0x94')][_0xa8a8('0x96')]){if(_0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x97')]){_0x41d69a[_0xa8a8('0x86')]['push']({'id':0x0,'priority':_0x41d69a[_0xa8a8('0x86')][_0xa8a8('0x48')]+0x1,'app':_0xa8a8('0x98'),'appdata':'unmanaged','interval':_0xa8a8('0x99')});}}return db['OpenchannelMessage'][_0xa8a8('0x57')]({'body':_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x58')],'OpenchannelAccountId':_0xfcc7ab['params']['id'],'OpenchannelInteractionId':_0x330279['id'],'direction':'in','ContactId':_0x41d69a[_0xa8a8('0x8b')]['id'],'AttachmentId':_0xfcc7ab[_0xa8a8('0x58')][_0xa8a8('0x9a')]});})[_0xa8a8('0x38')](function(_0x37d945){_0x41d69a[_0xa8a8('0x2a')]=_0x37d945;if(_0x41d69a[_0xa8a8('0x94')]['UserId']){return db[_0xa8a8('0x9b')][_0xa8a8('0x56')]({'attributes':['id','name'],'where':{'id':_0x41d69a['interaction']['UserId']}})['then'](function(_0x1e53be){if(_0x1e53be){_0x41d69a['applications'][_0xa8a8('0x9c')]({'id':0x0,'priority':0x0,'app':_0xa8a8('0x9d'),'appdata':_0x1e53be[_0xa8a8('0x3d')]+','+(_0x41d69a[_0xa8a8('0x83')][_0xa8a8('0x9e')]||0xa),'interval':'*,*,*,*'});_0x41d69a['forcedOwnership']=![];}return respondWithRpcPromise(_0xa8a8('0x9f'),'startRouting',_0x41d69a);});}return respondWithRpcPromise(_0xa8a8('0x9f'),'startRouting',_0x41d69a);})['then'](function(_0x3fcf95){respondWithRpcPromise(_0xa8a8('0xa0'),_0xa8a8('0xa0'),{'event':_0xa8a8('0x71'),'message':_0x3fcf95},client9002);return _0x3fcf95;})[_0xa8a8('0x38')](respondWithResult(_0x38c7cc,null))[_0xa8a8('0x2c')](handleError(_0x38c7cc,null));};exports['addApplications']=function(_0x43bf14,_0x3e0a0d,_0x59c8a5){return db['OpenchannelAccount'][_0xa8a8('0x65')]({'where':{'id':_0x43bf14[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e0a0d,null))[_0xa8a8('0x38')](function(_0x3102c3){if(_0x3102c3){return db[_0xa8a8('0xa1')]['transaction'](function(_0x133f8a){return db[_0xa8a8('0xa2')][_0xa8a8('0x39')]({'where':{'OpenchannelAccountId':_0x43bf14[_0xa8a8('0x55')]['id']},'transaction':_0x133f8a})[_0xa8a8('0x38')](function(_0x4dc53c){var _0x272c18=_[_0xa8a8('0x40')](_0x43bf14['body'],function(_0xe9655b){_0xe9655b[_0xa8a8('0x6c')]=_0x43bf14[_0xa8a8('0x55')]['id'];return _0xe9655b;});return db[_0xa8a8('0xa2')][_0xa8a8('0xa3')](_0x272c18,{'transaction':_0x133f8a});});})[_0xa8a8('0x38')](function(){return db[_0xa8a8('0xa2')][_0xa8a8('0xa4')]({'where':{'OpenchannelAccountId':_0x43bf14[_0xa8a8('0x55')]['id']},'order':_0xa8a8('0x87')});});}})[_0xa8a8('0x38')](respondWithResult(_0x3e0a0d,null))[_0xa8a8('0x2c')](handleError(_0x3e0a0d,null));};exports['getApplications']=function(_0x12f2d2,_0x14682a,_0x231f51){var _0x35f8f7={};var _0x40946b={};var _0x4e97f4;var _0x2d8490;return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x12f2d2[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x14682a,null))['then'](function(_0x1ecac5){if(_0x1ecac5){_0x4e97f4=_0x1ecac5;_0x40946b[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0xa2')][_0xa8a8('0x6e')]);_0x40946b[_0xa8a8('0x43')]=_['keys'](_0x12f2d2[_0xa8a8('0x43')]);_0x40946b[_0xa8a8('0x45')]=_[_0xa8a8('0x66')](_0x40946b[_0xa8a8('0x42')],_0x40946b['query']);_0x35f8f7['attributes']=_[_0xa8a8('0x66')](_0x40946b[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x12f2d2['query']['fields']));_0x35f8f7[_0xa8a8('0x46')]=_0x35f8f7[_0xa8a8('0x46')]['length']?_0x35f8f7[_0xa8a8('0x46')]:_0x40946b[_0xa8a8('0x42')];_0x35f8f7['order']=qs[_0xa8a8('0x4b')](_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x35f8f7[_0xa8a8('0x4d')]=qs[_0xa8a8('0x45')](_['pick'](_0x12f2d2['query'],_0x40946b[_0xa8a8('0x45')]));if(_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x50')]){_0x35f8f7[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x35f8f7[_0xa8a8('0x4d')],{'$or':_[_0xa8a8('0x40')](_0x35f8f7[_0xa8a8('0x46')],function(_0xa34daa){var _0xc221aa={};_0xc221aa[_0xa34daa]={'$like':'%'+_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0xc221aa;})});}_0x35f8f7=_[_0xa8a8('0x68')]({},_0x35f8f7,_0x12f2d2[_0xa8a8('0x51')]);return _0x4e97f4[_0xa8a8('0xa5')](_0x35f8f7);}})[_0xa8a8('0x38')](function(_0x32dcfe){if(_0x32dcfe){_0x2d8490=_0x32dcfe[_0xa8a8('0x48')];if(!_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x49')]('nolimit')){_0x35f8f7[_0xa8a8('0x31')]=qs[_0xa8a8('0x31')](_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x31')]);_0x35f8f7[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x12f2d2[_0xa8a8('0x43')][_0xa8a8('0x30')]);}return _0x4e97f4[_0xa8a8('0xa5')](_0x35f8f7);}})['then'](function(_0x4edd5e){if(_0x4edd5e){return _0x4edd5e?{'count':_0x2d8490,'rows':_0x4edd5e}:null;}})['then'](respondWithResult(_0x14682a,null))[_0xa8a8('0x2c')](handleError(_0x14682a,null));};exports[_0xa8a8('0xa6')]=function(_0x454716,_0x2db7d1,_0x52b349){var _0x2a9d9a={'raw':![],'where':{}};var _0x55edb2={};var _0x248100={'count':0x0,'rows':[]};return db[_0xa8a8('0x52')]['findOne']({'where':{'id':_0x454716[_0xa8a8('0x55')]['id']}})['then'](handleEntityNotFound(_0x2db7d1,null))[_0xa8a8('0x38')](function(_0xa3ebb5){if(_0xa3ebb5){_0x55edb2[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0x8e')]['rawAttributes']);_0x55edb2[_0xa8a8('0x43')]=_[_0xa8a8('0x44')](_0x454716[_0xa8a8('0x43')]);_0x55edb2[_0xa8a8('0x45')]=_['intersection'](_0x55edb2[_0xa8a8('0x42')],_0x55edb2['query']);_0x2a9d9a[_0xa8a8('0x46')]=_[_0xa8a8('0x66')](_0x55edb2['model'],qs[_0xa8a8('0x47')](_0x454716[_0xa8a8('0x43')][_0xa8a8('0x47')]));_0x2a9d9a['attributes']=_0x2a9d9a[_0xa8a8('0x46')][_0xa8a8('0x48')]?_0x2a9d9a[_0xa8a8('0x46')]:_0x55edb2[_0xa8a8('0x42')];if(!_0x454716[_0xa8a8('0x43')][_0xa8a8('0x49')]('nolimit')){_0x2a9d9a[_0xa8a8('0x31')]=qs['limit'](_0x454716['query'][_0xa8a8('0x31')]);_0x2a9d9a[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x454716[_0xa8a8('0x43')][_0xa8a8('0x30')]);}_0x2a9d9a['order']=qs[_0xa8a8('0x4b')](_0x454716[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x2a9d9a['where']=qs['filters'](_[_0xa8a8('0x4c')](_0x454716['query'],_0x55edb2[_0xa8a8('0x45')]));_0x2a9d9a['where'][_0xa8a8('0x6c')]=_0xa3ebb5['id'];if(_0x454716[_0xa8a8('0x43')]['filter']){_0x2a9d9a[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x2a9d9a['where'],{'$or':_['map'](_0x2a9d9a['attributes'],function(_0x156d40){var _0x16674e={};_0x16674e[_0x156d40]={'$like':'%'+_0x454716[_0xa8a8('0x43')][_0xa8a8('0x50')]+'%'};return _0x16674e;})});}_0x2a9d9a=_['merge']({},_0x2a9d9a,_0x454716[_0xa8a8('0x51')]);return db[_0xa8a8('0x8e')][_0xa8a8('0x2f')]({'where':_0x2a9d9a[_0xa8a8('0x4d')]})[_0xa8a8('0x38')](function(_0x77e5a4){_0x248100[_0xa8a8('0x2f')]=_0x77e5a4;if(_0x454716[_0xa8a8('0x43')]['includeAll']){_0x2a9d9a[_0xa8a8('0x53')]=[{'model':db[_0xa8a8('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xa8a8('0x3d'),_0xa8a8('0xa7'),_0xa8a8('0xa8')],'required':![]},{'model':db['Tag'],'as':_0xa8a8('0xa9'),'attributes':['id','name','color'],'where':_0x454716['query'][_0xa8a8('0xaa')]?{'id':_0x454716[_0xa8a8('0x43')][_0xa8a8('0xaa')]}:undefined,'required':_0x454716[_0xa8a8('0x43')][_0xa8a8('0xaa')]?!![]:![]}];}return db[_0xa8a8('0x8e')][_0xa8a8('0x54')](_0x2a9d9a);})['then'](function(_0x15c578){_0x248100[_0xa8a8('0x6f')]=_0x15c578;return _0x248100;});}})['then'](respondWithFilteredResult(_0x2db7d1,_0x2a9d9a))[_0xa8a8('0x2c')](handleError(_0x2db7d1,null));};exports[_0xa8a8('0xab')]=function(_0xc59a68,_0x313778,_0x4280e9){return db['OpenchannelAccount'][_0xa8a8('0x56')]({'where':{'id':_0xc59a68[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x313778,null))[_0xa8a8('0x38')](function(_0x10e26a){if(_0x10e26a){return _0x10e26a['addAgents'](_0xc59a68[_0xa8a8('0x58')]['ids'],_[_0xa8a8('0xac')](_0xc59a68[_0xa8a8('0x58')],[_0xa8a8('0x6b'),'id'])||{})[_0xa8a8('0x91')](function(_0x3f5fba){for(var _0x226a78=0x0;_0x226a78<_0xc59a68[_0xa8a8('0x58')][_0xa8a8('0x6b')][_0xa8a8('0x48')];_0x226a78+=0x1){socket['emit'](_0xa8a8('0xad'),{'UserId':_0xc59a68[_0xa8a8('0x58')]['ids'][_0x226a78],'OpenchannelAccountId':_0xc59a68['params']['id']});}return _0x3f5fba;});}})[_0xa8a8('0x38')](respondWithResult(_0x313778,null))[_0xa8a8('0x2c')](handleError(_0x313778,null));};exports[_0xa8a8('0xae')]=function(_0x2a4d75,_0x206f4f,_0x5093cd){return db[_0xa8a8('0x52')]['find']({'where':{'id':_0x2a4d75[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x206f4f,null))[_0xa8a8('0x38')](function(_0x226b50){if(_0x226b50){return _0x226b50[_0xa8a8('0xae')](_0x2a4d75[_0xa8a8('0x43')][_0xa8a8('0x6b')])['then'](function(){if(_[_0xa8a8('0xaf')](_0x2a4d75[_0xa8a8('0x43')][_0xa8a8('0x6b')])){for(var _0x2298b5=0x0;_0x2298b5<_0x2a4d75[_0xa8a8('0x43')][_0xa8a8('0x6b')][_0xa8a8('0x48')];_0x2298b5+=0x1){socket['emit'](_0xa8a8('0xb0'),{'UserId':Number(_0x2a4d75['query'][_0xa8a8('0x6b')][_0x2298b5]),'OpenchannelAccountId':Number(_0x2a4d75[_0xa8a8('0x55')]['id'])});}}else{socket[_0xa8a8('0xb1')](_0xa8a8('0xb0'),{'UserId':Number(_0x2a4d75[_0xa8a8('0x43')]['ids']),'OpenchannelAccountId':Number(_0x2a4d75[_0xa8a8('0x55')]['id'])});}});}})[_0xa8a8('0x38')](respondWithStatusCode(_0x206f4f,null))[_0xa8a8('0x2c')](handleError(_0x206f4f,null));};exports['getAgents']=function(_0x3e0e2a,_0x233ffa,_0x9abffb){var _0x3e1b69={};var _0x3ef305={};var _0x37f08c;var _0x3225e4;return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x3e0e2a[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x233ffa,null))[_0xa8a8('0x38')](function(_0x208fb3){if(_0x208fb3){_0x37f08c=_0x208fb3;_0x3ef305[_0xa8a8('0x42')]=_[_0xa8a8('0x44')](db[_0xa8a8('0x9b')][_0xa8a8('0x6e')]);_0x3ef305[_0xa8a8('0x43')]=_['keys'](_0x3e0e2a[_0xa8a8('0x43')]);_0x3ef305[_0xa8a8('0x45')]=_[_0xa8a8('0x66')](_0x3ef305[_0xa8a8('0x42')],_0x3ef305[_0xa8a8('0x43')]);_0x3e1b69[_0xa8a8('0x46')]=_['intersection'](_0x3ef305[_0xa8a8('0x42')],qs[_0xa8a8('0x47')](_0x3e0e2a['query'][_0xa8a8('0x47')]));_0x3e1b69[_0xa8a8('0x46')]=_0x3e1b69[_0xa8a8('0x46')]['length']?_0x3e1b69[_0xa8a8('0x46')]:_0x3ef305[_0xa8a8('0x42')];_0x3e1b69[_0xa8a8('0x67')]=qs['sort'](_0x3e0e2a[_0xa8a8('0x43')][_0xa8a8('0x4b')]);_0x3e1b69['where']=qs['filters'](_['pick'](_0x3e0e2a[_0xa8a8('0x43')],_0x3ef305[_0xa8a8('0x45')]));if(_0x3e0e2a['query'][_0xa8a8('0x50')]){_0x3e1b69[_0xa8a8('0x4d')]=_[_0xa8a8('0x68')](_0x3e1b69[_0xa8a8('0x4d')],{'$or':_[_0xa8a8('0x40')](_0x3e1b69[_0xa8a8('0x46')],function(_0x466ec0){var _0x45f502={};_0x45f502[_0x466ec0]={'$like':'%'+_0x3e0e2a[_0xa8a8('0x43')]['filter']+'%'};return _0x45f502;})});}_0x3e1b69=_[_0xa8a8('0x68')]({},_0x3e1b69,_0x3e0e2a[_0xa8a8('0x51')]);return _0x37f08c[_0xa8a8('0xb2')](_0x3e1b69);}})[_0xa8a8('0x38')](function(_0x5b897f){if(_0x5b897f){_0x3225e4=_0x5b897f[_0xa8a8('0x48')];if(!_0x3e0e2a[_0xa8a8('0x43')][_0xa8a8('0x49')](_0xa8a8('0x4a'))){_0x3e1b69[_0xa8a8('0x31')]=qs[_0xa8a8('0x31')](_0x3e0e2a[_0xa8a8('0x43')]['limit']);_0x3e1b69[_0xa8a8('0x30')]=qs[_0xa8a8('0x30')](_0x3e0e2a['query'][_0xa8a8('0x30')]);}return _0x37f08c[_0xa8a8('0xb2')](_0x3e1b69);}})['then'](function(_0x4bb633){if(_0x4bb633){return _0x4bb633?{'count':_0x3225e4,'rows':_0x4bb633}:null;}})[_0xa8a8('0x38')](respondWithResult(_0x233ffa,null))[_0xa8a8('0x2c')](handleError(_0x233ffa,null));};exports[_0xa8a8('0xb3')]=function(_0x12403e,_0x3e6e3c,_0xc16d19){var _0x5f148c,_0x173c82,_0x4a834b;if(_[_0xa8a8('0x78')](_0x12403e[_0xa8a8('0x58')]['body'])||_0x12403e['body'][_0xa8a8('0x58')]===''){throw new db[(_0xa8a8('0x1e'))]['ValidationError'](_0xa8a8('0x7b'));}if(_['isNil'](_0x12403e['body']['to'])){}_0x5f148c=_0x12403e[_0xa8a8('0x58')]['to'];return db[_0xa8a8('0x52')][_0xa8a8('0x65')]({'where':{'id':_0x12403e[_0xa8a8('0x55')]['id']}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e6e3c,null))['then'](function(_0x3a0ee8){if(_0x3a0ee8){return db[_0xa8a8('0x52')]['find']({'where':{'id':_0x3a0ee8['id']},'include':[{'model':db[_0xa8a8('0x80')],'as':_0xa8a8('0x81'),'include':[{'model':db['CmContact'],'as':_0xa8a8('0x89'),'where':{[_0x3a0ee8[_0xa8a8('0x7c')]]:_0x5f148c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e6e3c,null))[_0xa8a8('0x38')](function(_0x54adb4){if(_0x54adb4&&_0x54adb4[_0xa8a8('0x81')]){_0x173c82=_0x54adb4['get']({'plain':!![]});if(_0x173c82[_0xa8a8('0x81')]&&_0x173c82[_0xa8a8('0x81')]['Contacts']['length']){return _0x173c82[_0xa8a8('0x81')][_0xa8a8('0x89')][0x0];}return db['CmContact'][_0xa8a8('0x57')](_[_0xa8a8('0x18')](_0x12403e[_0xa8a8('0x58')],{'firstName':_0x5f148c,[_0x54adb4['mapKey']]:_0x5f148c,'phone':_0x5f148c,'ListId':_0x173c82['ListId']}));}})[_0xa8a8('0x38')](handleEntityNotFound(_0x3e6e3c,null))['then'](function(_0xda79e){if(_0xda79e){_0x4a834b=_0xda79e;return db['OpenchannelInteraction'][_0xa8a8('0x56')]({'where':{'ContactId':_0x4a834b['id'],'closed':![],'OpenchannelAccountId':_0x173c82['id']}})['then'](function(_0x332ac7){if(_0x332ac7){return[_0x332ac7,![]];}return db[_0xa8a8('0x8e')][_0xa8a8('0x57')]({'UserId':_0x12403e['user']['id'],'ContactId':_0x4a834b['id'],'OpenchannelAccountId':_0x173c82['id'],'lastMsgDirection':_0xa8a8('0xb4'),'Messages':[_[_0xa8a8('0x68')](_0x12403e[_0xa8a8('0x58')],{'read':![],'body':_0x12403e[_0xa8a8('0x58')]['body'],'OpenchannelAccountId':_0x173c82['id'],'UserId':_0x12403e[_0xa8a8('0x59')]['id'],'ContactId':_0x4a834b['id']})]},{'include':[{'model':db[_0xa8a8('0xb5')],'as':'Messages'}]})[_0xa8a8('0x38')](function(_0x29fa0f){return[_0x29fa0f,!![]];});});}})[_0xa8a8('0x91')](function(_0xa9c2ff,_0x5607dd){if(_0x5607dd){return _0xa9c2ff;}return db[_0xa8a8('0xb5')][_0xa8a8('0x57')](_[_0xa8a8('0x68')](_0x12403e[_0xa8a8('0x58')],{'read':![],'body':_0x12403e[_0xa8a8('0x58')][_0xa8a8('0x58')],'OpenchannelAccountId':_0x173c82['id'],'OpenchannelInteractionId':_0xa9c2ff['id'],'UserId':_0x12403e[_0xa8a8('0x59')]['id'],'ContactId':_0x4a834b['id']}))['then'](function(_0xa8b261){_0xa9c2ff[_0xa8a8('0xb6')][_0xa8a8('0xb7')]=[];_0xa9c2ff[_0xa8a8('0xb6')][_0xa8a8('0xb7')][_0xa8a8('0xb8')](_0xa8b261[_0xa8a8('0xb6')]);return _0xa9c2ff;});});}})[_0xa8a8('0x38')](respondWithResult(_0x3e6e3c,null))[_0xa8a8('0x2c')](handleError(_0x3e6e3c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a5654a7..5d2da2d 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 _0x9f99=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount'];(function(_0xa83d8f,_0xdd617a){var _0x806ff=function(_0x430567){while(--_0x430567){_0xa83d8f['push'](_0xa83d8f['shift']());}};_0x806ff(++_0xdd617a);}(_0x9f99,0x139));var _0x99f9=function(_0x3ad749,_0x4afb5a){_0x3ad749=_0x3ad749-0x0;var _0x338a38=_0x9f99[_0x3ad749];return _0x338a38;};'use strict';var EventEmitter=require(_0x99f9('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x99f9('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x99f9('0x2')](0x0);var events={'afterCreate':_0x99f9('0x3'),'afterUpdate':'update','afterDestroy':_0x99f9('0x4')};function emitEvent(_0x5e3bae){return function(_0x314c9d,_0x2feeec,_0x4ec6bf){OpenchannelAccountEvents['emit'](_0x5e3bae+':'+_0x314c9d['id'],_0x314c9d);OpenchannelAccountEvents[_0x99f9('0x5')](_0x5e3bae,_0x314c9d);_0x4ec6bf(null);};}for(var e in events){if(events[_0x99f9('0x6')](e)){var event=events[e];OpenchannelAccount[_0x99f9('0x7')](e,emitEvent(event));}}module[_0x99f9('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5e5b=['remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x3de2ca,_0x51e1ba){var _0x2e9106=function(_0x381663){while(--_0x381663){_0x3de2ca['push'](_0x3de2ca['shift']());}};_0x2e9106(++_0x51e1ba);}(_0x5e5b,0xbc));var _0xb5e5=function(_0x3ee6ba,_0x10d1ca){_0x3ee6ba=_0x3ee6ba-0x0;var _0x59e95f=_0x5e5b[_0x3ee6ba];return _0x59e95f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xb5e5('0x0'))['db'][_0xb5e5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb5e5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5e5('0x3'),'afterDestroy':_0xb5e5('0x4')};function emitEvent(_0x507fdf){return function(_0x3a804f,_0x1e8e48,_0x7b6eba){OpenchannelAccountEvents['emit'](_0x507fdf+':'+_0x3a804f['id'],_0x3a804f);OpenchannelAccountEvents['emit'](_0x507fdf,_0x3a804f);_0x7b6eba(null);};}for(var e in events){if(events[_0xb5e5('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb5e5('0x6')](e,emitEvent(event));}}module[_0xb5e5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 14c611c..063747c 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 _0x62ac=['OpenchannelAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','define'];(function(_0x5a1a12,_0x426124){var _0x2cf5c0=function(_0x1fb2db){while(--_0x1fb2db){_0x5a1a12['push'](_0x5a1a12['shift']());}};_0x2cf5c0(++_0x426124);}(_0x62ac,0x14b));var _0xc62a=function(_0x13a621,_0x29b45c){_0x13a621=_0x13a621-0x0;var _0x19c55d=_0x62ac[_0x13a621];return _0x19c55d;};'use strict';var _=require('lodash');var util=require(_0xc62a('0x0'));var logger=require(_0xc62a('0x1'))(_0xc62a('0x2'));var moment=require(_0xc62a('0x3'));var BPromise=require(_0xc62a('0x4'));var rp=require(_0xc62a('0x5'));var fs=require('fs');var path=require(_0xc62a('0x6'));var rimraf=require(_0xc62a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc62a('0x8'));module['exports']=function(_0x3bce1e,_0x13e182){return _0x3bce1e[_0xc62a('0x9')](_0xc62a('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1977=['./openchannelAccount.attributes','define','openchannel_accounts','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x1ee366,_0xe80d55){var _0x5e9c66=function(_0x45f986){while(--_0x45f986){_0x1ee366['push'](_0x1ee366['shift']());}};_0x5e9c66(++_0xe80d55);}(_0x1977,0xb7));var _0x7197=function(_0x262f7c,_0x56b881){_0x262f7c=_0x262f7c-0x0;var _0x572d92=_0x1977[_0x262f7c];return _0x572d92;};'use strict';var _=require(_0x7197('0x0'));var util=require(_0x7197('0x1'));var logger=require('../../config/logger')(_0x7197('0x2'));var moment=require(_0x7197('0x3'));var BPromise=require('bluebird');var rp=require(_0x7197('0x4'));var fs=require('fs');var path=require(_0x7197('0x5'));var rimraf=require('rimraf');var config=require(_0x7197('0x6'));var attributes=require(_0x7197('0x7'));module['exports']=function(_0x53018b,_0x5c7eef){return _0x53018b[_0x7197('0x8')]('OpenchannelAccount',attributes,{'tableName':_0x7197('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index bf0cd4c..70d7dd8 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 _0xc190=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xc190,0x85));var _0x0c19=function(_0x47a1c1,_0x27cc80){_0x47a1c1=_0x47a1c1-0x0;var _0x161ae3=_0xc190[_0x47a1c1];return _0x161ae3;};'use strict';var _=require(_0x0c19('0x0'));var util=require(_0x0c19('0x1'));var moment=require('moment');var BPromise=require(_0x0c19('0x2'));var rs=require(_0x0c19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c19('0x4'))['db'];var utils=require(_0x0c19('0x5'));var logger=require('../../config/logger')(_0x0c19('0x6'));var config=require(_0x0c19('0x7'));var jayson=require(_0x0c19('0x8'));var client=jayson[_0x0c19('0x9')]['http']({'port':0x232a});config[_0x0c19('0xa')]=_[_0x0c19('0xb')](config[_0x0c19('0xa')],{'host':_0x0c19('0xc'),'port':0x18eb});var socket=require(_0x0c19('0xd'))(new Redis(config[_0x0c19('0xa')]));require(_0x0c19('0xe'))[_0x0c19('0xf')](socket);function respondWithRpcPromise(_0x2360b6,_0x24f266,_0x368271){return new BPromise(function(_0x4079cf,_0x2d142c){return client[_0x0c19('0x10')](_0x2360b6,_0x368271)['then'](function(_0x23558e){logger[_0x0c19('0x11')](_0x0c19('0x12'),_0x24f266,_0x0c19('0x13'));logger['debug'](_0x0c19('0x14'),_0x24f266,_0x0c19('0x13'),JSON[_0x0c19('0x15')](_0x23558e));if(_0x23558e[_0x0c19('0x16')]){if(_0x23558e[_0x0c19('0x16')][_0x0c19('0x17')]===0x1f4){logger[_0x0c19('0x16')](_0x0c19('0x12'),_0x24f266,_0x23558e[_0x0c19('0x16')][_0x0c19('0x18')]);return _0x2d142c(_0x23558e[_0x0c19('0x16')]['message']);}logger[_0x0c19('0x16')](_0x0c19('0x12'),_0x24f266,_0x23558e['error'][_0x0c19('0x18')]);return _0x4079cf(_0x23558e[_0x0c19('0x16')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x24f266,_0x0c19('0x13'));_0x4079cf(_0x23558e[_0x0c19('0x19')][_0x0c19('0x18')]);}})[_0x0c19('0x1a')](function(_0x59f2f2){logger[_0x0c19('0x16')](_0x0c19('0x12'),_0x24f266,_0x59f2f2);_0x2d142c(_0x59f2f2);});});} \ No newline at end of file +var _0x5e9d=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5e9d,0x1f1));var _0xd5e9=function(_0x2eed5a,_0x4cbf4a){_0x2eed5a=_0x2eed5a-0x0;var _0x51d67d=_0x5e9d[_0x2eed5a];return _0x51d67d;};'use strict';var _=require(_0xd5e9('0x0'));var util=require(_0xd5e9('0x1'));var moment=require('moment');var BPromise=require(_0xd5e9('0x2'));var rs=require(_0xd5e9('0x3'));var fs=require('fs');var Redis=require(_0xd5e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5e9('0x5'));var logger=require(_0xd5e9('0x6'))(_0xd5e9('0x7'));var config=require(_0xd5e9('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd5e9('0x9')]=_[_0xd5e9('0xa')](config['redis'],{'host':_0xd5e9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5e9('0x9')]));require(_0xd5e9('0xc'))[_0xd5e9('0xd')](socket);function respondWithRpcPromise(_0x5616c5,_0x259741,_0x2e7810){return new BPromise(function(_0x2f426f,_0x11c641){return client[_0xd5e9('0xe')](_0x5616c5,_0x2e7810)[_0xd5e9('0xf')](function(_0x163fb6){logger[_0xd5e9('0x10')](_0xd5e9('0x11'),_0x259741,_0xd5e9('0x12'));logger['debug'](_0xd5e9('0x13'),_0x259741,'request\x20sent',JSON[_0xd5e9('0x14')](_0x163fb6));if(_0x163fb6[_0xd5e9('0x15')]){if(_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x16')]===0x1f4){logger[_0xd5e9('0x15')](_0xd5e9('0x11'),_0x259741,_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);return _0x11c641(_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);}logger['error'](_0xd5e9('0x11'),_0x259741,_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);return _0x2f426f(_0x163fb6[_0xd5e9('0x15')][_0xd5e9('0x17')]);}else{logger[_0xd5e9('0x10')](_0xd5e9('0x11'),_0x259741,'request\x20sent');_0x2f426f(_0x163fb6[_0xd5e9('0x18')][_0xd5e9('0x17')]);}})[_0xd5e9('0x19')](function(_0x565790){logger['error'](_0xd5e9('0x11'),_0x259741,_0x565790);_0x11c641(_0x565790);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index efde47e..deae032 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 _0x7740=['length','./openchannelAccount.events','save','remove','update'];(function(_0x126e2f,_0x3e6c2d){var _0x2bb62f=function(_0x1b498d){while(--_0x1b498d){_0x126e2f['push'](_0x126e2f['shift']());}};_0x2bb62f(++_0x3e6c2d);}(_0x7740,0x12d));var _0x0774=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x7740[_0x1db831];return _0x39ba56;};'use strict';var OpenchannelAccountEvents=require(_0x0774('0x0'));var events=[_0x0774('0x1'),_0x0774('0x2'),_0x0774('0x3')];function createListener(_0x55fd1a,_0x232476){return function(_0x5e676e){_0x232476['emit'](_0x55fd1a,_0x5e676e);};}function removeListener(_0xbccd25,_0xfd2949){return function(){OpenchannelAccountEvents['removeListener'](_0xbccd25,_0xfd2949);};}exports['register']=function(_0x1a20ea){for(var _0x3163ba=0x0,_0x7866b5=events[_0x0774('0x4')];_0x3163ba<_0x7866b5;_0x3163ba++){var _0x406cb1=events[_0x3163ba];var _0x2ef1aa=createListener('openchannelAccount:'+_0x406cb1,_0x1a20ea);OpenchannelAccountEvents['on'](_0x406cb1,_0x2ef1aa);}}; \ No newline at end of file +var _0xab01=['length','openchannelAccount:','save','remove','emit','removeListener','register'];(function(_0x17c66c,_0x57de99){var _0x346258=function(_0x2b5a2a){while(--_0x2b5a2a){_0x17c66c['push'](_0x17c66c['shift']());}};_0x346258(++_0x57de99);}(_0xab01,0xc6));var _0x1ab0=function(_0x442f5b,_0x39d79d){_0x442f5b=_0x442f5b-0x0;var _0x19fd96=_0xab01[_0x442f5b];return _0x19fd96;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x1ab0('0x0'),_0x1ab0('0x1'),'update'];function createListener(_0x251415,_0x360a04){return function(_0x581f0e){_0x360a04[_0x1ab0('0x2')](_0x251415,_0x581f0e);};}function removeListener(_0x444601,_0x71b9c1){return function(){OpenchannelAccountEvents[_0x1ab0('0x3')](_0x444601,_0x71b9c1);};}exports[_0x1ab0('0x4')]=function(_0x17c42b){for(var _0x26c910=0x0,_0x4bb8bb=events[_0x1ab0('0x5')];_0x26c910<_0x4bb8bb;_0x26c910++){var _0x41dbd1=events[_0x26c910];var _0xa436ec=createListener(_0x1ab0('0x6')+_0x41dbd1,_0x17c42b);OpenchannelAccountEvents['on'](_0x41dbd1,_0xa436ec);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f3b0c57..d7b33af 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 _0x5cf7=['path','express','../../components/auth/service','get','index','/:id','show','isAuthenticated','create','put','update','destroy','exports','multer','util'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x5cf7,0x85));var _0x75cf=function(_0x3ae42b,_0x34399c){_0x3ae42b=_0x3ae42b-0x0;var _0x292eaf=_0x5cf7[_0x3ae42b];return _0x292eaf;};'use strict';var multer=require(_0x75cf('0x0'));var util=require(_0x75cf('0x1'));var path=require(_0x75cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x75cf('0x3'));var router=express['Router']();var auth=require(_0x75cf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x75cf('0x5')]('/',auth['isAuthenticated'](),controller[_0x75cf('0x6')]);router['get'](_0x75cf('0x7'),auth['isAuthenticated'](),controller[_0x75cf('0x8')]);router['post']('/',auth[_0x75cf('0x9')](),controller[_0x75cf('0xa')]);router[_0x75cf('0xb')](_0x75cf('0x7'),auth[_0x75cf('0x9')](),controller[_0x75cf('0xc')]);router['delete']('/:id',auth[_0x75cf('0x9')](),controller[_0x75cf('0xd')]);module[_0x75cf('0xe')]=router; \ No newline at end of file +var _0xef64=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x56e8cc,_0x12992e){var _0x34d867=function(_0x593f68){while(--_0x593f68){_0x56e8cc['push'](_0x56e8cc['shift']());}};_0x34d867(++_0x12992e);}(_0xef64,0x16d));var _0x4ef6=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xef64[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x4ef6('0x0'));var util=require(_0x4ef6('0x1'));var path=require(_0x4ef6('0x2'));var timeout=require(_0x4ef6('0x3'));var express=require(_0x4ef6('0x4'));var router=express['Router']();var auth=require(_0x4ef6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ef6('0x6'));var controller=require(_0x4ef6('0x7'));router['get']('/',auth[_0x4ef6('0x8')](),controller[_0x4ef6('0x9')]);router[_0x4ef6('0xa')](_0x4ef6('0xb'),auth[_0x4ef6('0x8')](),controller[_0x4ef6('0xc')]);router['post']('/',auth[_0x4ef6('0x8')](),controller[_0x4ef6('0xd')]);router[_0x4ef6('0xe')](_0x4ef6('0xb'),auth[_0x4ef6('0x8')](),controller[_0x4ef6('0xf')]);router[_0x4ef6('0x10')](_0x4ef6('0xb'),auth[_0x4ef6('0x8')](),controller[_0x4ef6('0x11')]);module[_0x4ef6('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 85f4c05..93e8208 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 _0x5b28=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x9922e8,_0x4da924){var _0x10e335=function(_0x1c72ab){while(--_0x1c72ab){_0x9922e8['push'](_0x9922e8['shift']());}};_0x10e335(++_0x4da924);}(_0x5b28,0x148));var _0x85b2=function(_0x4d54d3,_0x3169fb){_0x4d54d3=_0x4d54d3-0x0;var _0x4eacc5=_0x5b28[_0x4d54d3];return _0x4eacc5;};'use strict';var Sequelize=require(_0x85b2('0x0'));module[_0x85b2('0x1')]={'priority':{'type':Sequelize[_0x85b2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x85b2('0x3')],'allowNull':![],'defaultValue':_0x85b2('0x4')},'appdata':{'type':Sequelize[_0x85b2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x85b2('0x3')],'defaultValue':_0x85b2('0x6')}}; \ No newline at end of file +var _0x5d69=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1f5ee3,_0x42d31b){var _0x2db824=function(_0xa3030b){while(--_0xa3030b){_0x1f5ee3['push'](_0x1f5ee3['shift']());}};_0x2db824(++_0x42d31b);}(_0x5d69,0x87));var _0x95d6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5d69[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x95d6('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x95d6('0x1')],'allowNull':![],'defaultValue':_0x95d6('0x2')},'appdata':{'type':Sequelize[_0x95d6('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x95d6('0x1')],'defaultValue':_0x95d6('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 79b6c39..954212e 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 _0x6e16=['count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','model','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','intersection','find','create','catch','update','body','params','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x41c5dd,_0x54e03c){var _0x481bd0=function(_0x165ee1){while(--_0x165ee1){_0x41c5dd['push'](_0x41c5dd['shift']());}};_0x481bd0(++_0x54e03c);}(_0x6e16,0xb7));var _0x66e1=function(_0x1fa83f,_0x4a9e92){_0x1fa83f=_0x1fa83f-0x0;var _0x33599c=_0x6e16[_0x1fa83f];return _0x33599c;};'use strict';var pdf=require(_0x66e1('0x0'));var emlformat=require(_0x66e1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x66e1('0x2'));var rp=require('request-promise');var moment=require(_0x66e1('0x3'));var BPromise=require(_0x66e1('0x4'));var Mustache=require('mustache');var util=require(_0x66e1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x66e1('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66e1('0x7'));var squel=require(_0x66e1('0x8'));var crypto=require('crypto');var jsforce=require(_0x66e1('0x9'));var deskjs=require(_0x66e1('0xa'));var toCsv=require(_0x66e1('0x6'));var querystring=require('querystring');var Papa=require(_0x66e1('0xb'));var Redis=require(_0x66e1('0xc'));var authService=require(_0x66e1('0xd'));var qs=require(_0x66e1('0xe'));var as=require(_0x66e1('0xf'));var hardwareService=require(_0x66e1('0x10'));var logger=require(_0x66e1('0x11'))(_0x66e1('0x12'));var utils=require('../../config/utils');var config=require(_0x66e1('0x13'));var db=require(_0x66e1('0x14'))['db'];function respondWithStatusCode(_0x5531fc,_0x3e4917){_0x3e4917=_0x3e4917||0xcc;return function(_0x4e939c){if(_0x4e939c){return _0x5531fc[_0x66e1('0x15')](_0x3e4917);}return _0x5531fc[_0x66e1('0x16')](_0x3e4917)[_0x66e1('0x17')]();};}function respondWithResult(_0x44b831,_0x4d86aa){_0x4d86aa=_0x4d86aa||0xc8;return function(_0x18a0e1){if(_0x18a0e1){return _0x44b831[_0x66e1('0x16')](_0x4d86aa)['json'](_0x18a0e1);}};}function respondWithFilteredResult(_0x135732,_0xde6bd0){return function(_0x262531){if(_0x262531){var _0x345333=_0x262531[_0x66e1('0x18')],_0x8ae8b=_0xde6bd0['offset'],_0x381f56=_0xde6bd0[_0x66e1('0x19')]+_0xde6bd0[_0x66e1('0x1a')],_0x5a0aed;if(_0x381f56>=_0x345333){_0x381f56=_0x345333;_0x5a0aed=0xc8;}else{_0x5a0aed=0xce;}_0x135732[_0x66e1('0x16')](_0x5a0aed);return _0x135732[_0x66e1('0x1b')](_0x66e1('0x1c'),_0x8ae8b+'-'+_0x381f56+'/'+_0x345333)['json'](_0x262531);}return null;};}function patchUpdates(_0x370493){return function(_0x16928c){try{jsonpatch[_0x66e1('0x1d')](_0x16928c,_0x370493,!![]);}catch(_0x4d108a){return BPromise[_0x66e1('0x1e')](_0x4d108a);}return _0x16928c[_0x66e1('0x1f')]();};}function saveUpdates(_0x4bea98,_0x5cb3db){return function(_0x298f45){if(_0x298f45){return _0x298f45['update'](_0x4bea98)[_0x66e1('0x20')](function(_0x128a37){return _0x128a37;});}return null;};}function removeEntity(_0x137431,_0x4c6d21){return function(_0x4122d6){if(_0x4122d6){return _0x4122d6['destroy']()[_0x66e1('0x20')](function(){_0x137431['status'](0xcc)[_0x66e1('0x17')]();});}};}function handleEntityNotFound(_0x5c74a5,_0x323618){return function(_0x16759c){if(!_0x16759c){_0x5c74a5[_0x66e1('0x15')](0x194);}return _0x16759c;};}function handleError(_0x176b02,_0x1a936c){_0x1a936c=_0x1a936c||0x1f4;return function(_0x80b5b6){logger[_0x66e1('0x21')](_0x80b5b6[_0x66e1('0x22')]);if(_0x80b5b6['name']){delete _0x80b5b6[_0x66e1('0x23')];}_0x176b02[_0x66e1('0x16')](_0x1a936c)[_0x66e1('0x24')](_0x80b5b6);};}exports[_0x66e1('0x25')]=function(_0x866f31,_0x5d3e74){var _0x1a1540={},_0x518dd2={},_0x415da5={'count':0x0,'rows':[]};var _0x174556=_[_0x66e1('0x26')](db[_0x66e1('0x27')][_0x66e1('0x28')],function(_0x1ff49c){return{'name':_0x1ff49c[_0x66e1('0x29')],'type':_0x1ff49c[_0x66e1('0x2a')][_0x66e1('0x2b')]};});_0x518dd2['model']=_['map'](_0x174556,_0x66e1('0x23'));_0x518dd2[_0x66e1('0x2c')]=_[_0x66e1('0x2d')](_0x866f31['query']);_0x518dd2[_0x66e1('0x2e')]=_['intersection'](_0x518dd2['model'],_0x518dd2[_0x66e1('0x2c')]);_0x1a1540[_0x66e1('0x2f')]=_['intersection'](_0x518dd2['model'],qs[_0x66e1('0x30')](_0x866f31['query'][_0x66e1('0x30')]));_0x1a1540[_0x66e1('0x2f')]=_0x1a1540[_0x66e1('0x2f')]['length']?_0x1a1540[_0x66e1('0x2f')]:_0x518dd2[_0x66e1('0x31')];if(!_0x866f31[_0x66e1('0x2c')][_0x66e1('0x32')]('nolimit')){_0x1a1540[_0x66e1('0x1a')]=qs[_0x66e1('0x1a')](_0x866f31[_0x66e1('0x2c')][_0x66e1('0x1a')]);_0x1a1540[_0x66e1('0x19')]=qs[_0x66e1('0x19')](_0x866f31[_0x66e1('0x2c')]['offset']);}_0x1a1540[_0x66e1('0x33')]=qs[_0x66e1('0x34')](_0x866f31['query'][_0x66e1('0x34')]);_0x1a1540['where']=qs['filters'](_['pick'](_0x866f31[_0x66e1('0x2c')],_0x518dd2['filters']),_0x174556);if(_0x866f31[_0x66e1('0x2c')][_0x66e1('0x35')]){_0x1a1540[_0x66e1('0x36')]=_[_0x66e1('0x37')](_0x1a1540['where'],{'$or':_[_0x66e1('0x26')](_0x174556,function(_0x160e96){if(_0x160e96[_0x66e1('0x2a')]!==_0x66e1('0x38')){var _0x543976={};_0x543976[_0x160e96[_0x66e1('0x23')]]={'$like':'%'+_0x866f31['query'][_0x66e1('0x35')]+'%'};return _0x543976;}})});}_0x1a1540=_['merge']({},_0x1a1540,_0x866f31[_0x66e1('0x39')]);var _0x5336d1={'where':_0x1a1540[_0x66e1('0x36')]};return db[_0x66e1('0x27')][_0x66e1('0x18')](_0x5336d1)[_0x66e1('0x20')](function(_0x5738f3){_0x415da5[_0x66e1('0x18')]=_0x5738f3;if(_0x866f31[_0x66e1('0x2c')][_0x66e1('0x3a')]){_0x1a1540[_0x66e1('0x3b')]=[{'all':!![]}];}return db[_0x66e1('0x27')][_0x66e1('0x3c')](_0x1a1540);})[_0x66e1('0x20')](function(_0x57119d){_0x415da5['rows']=_0x57119d;return _0x415da5;})[_0x66e1('0x20')](respondWithFilteredResult(_0x5d3e74,_0x1a1540))['catch'](handleError(_0x5d3e74,null));};exports[_0x66e1('0x3d')]=function(_0x3ad2f9,_0x41d0b6){var _0x78a25b={'raw':!![],'where':{'id':_0x3ad2f9['params']['id']}},_0x3e6a7f={};_0x3e6a7f['model']=_['keys'](db[_0x66e1('0x27')][_0x66e1('0x28')]);_0x3e6a7f[_0x66e1('0x2c')]=_[_0x66e1('0x2d')](_0x3ad2f9[_0x66e1('0x2c')]);_0x3e6a7f['filters']=_[_0x66e1('0x3e')](_0x3e6a7f['model'],_0x3e6a7f[_0x66e1('0x2c')]);_0x78a25b[_0x66e1('0x2f')]=_[_0x66e1('0x3e')](_0x3e6a7f[_0x66e1('0x31')],qs[_0x66e1('0x30')](_0x3ad2f9[_0x66e1('0x2c')][_0x66e1('0x30')]));_0x78a25b['attributes']=_0x78a25b[_0x66e1('0x2f')]['length']?_0x78a25b['attributes']:_0x3e6a7f['model'];if(_0x3ad2f9[_0x66e1('0x2c')][_0x66e1('0x3a')]){_0x78a25b[_0x66e1('0x3b')]=[{'all':!![]}];}_0x78a25b=_['merge']({},_0x78a25b,_0x3ad2f9['options']);return db[_0x66e1('0x27')][_0x66e1('0x3f')](_0x78a25b)['then'](handleEntityNotFound(_0x41d0b6,null))['then'](respondWithResult(_0x41d0b6,null))['catch'](handleError(_0x41d0b6,null));};exports[_0x66e1('0x40')]=function(_0x4e021c,_0x13c681){return db[_0x66e1('0x27')][_0x66e1('0x40')](_0x4e021c['body'],{})[_0x66e1('0x20')](respondWithResult(_0x13c681,0xc9))[_0x66e1('0x41')](handleError(_0x13c681,null));};exports[_0x66e1('0x42')]=function(_0x26e579,_0x3f56a9){if(_0x26e579[_0x66e1('0x43')]['id']){delete _0x26e579[_0x66e1('0x43')]['id'];}return db[_0x66e1('0x27')][_0x66e1('0x3f')]({'where':{'id':_0x26e579[_0x66e1('0x44')]['id']}})[_0x66e1('0x20')](handleEntityNotFound(_0x3f56a9,null))[_0x66e1('0x20')](saveUpdates(_0x26e579[_0x66e1('0x43')],null))['then'](respondWithResult(_0x3f56a9,null))[_0x66e1('0x41')](handleError(_0x3f56a9,null));};exports['destroy']=function(_0x6209e9,_0xfabee1){return db[_0x66e1('0x27')][_0x66e1('0x3f')]({'where':{'id':_0x6209e9[_0x66e1('0x44')]['id']}})[_0x66e1('0x20')](handleEntityNotFound(_0xfabee1,null))[_0x66e1('0x20')](removeEntity(_0xfabee1,null))[_0x66e1('0x41')](handleError(_0xfabee1,null));}; \ No newline at end of file +var _0xb0b3=['json','apply','save','destroy','then','name','map','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','OpenchannelApplication','findAll','rows','show','params','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xb0b3,0x69));var _0x3b0b=function(_0x16478e,_0x544885){_0x16478e=_0x16478e-0x0;var _0x177b0f=_0xb0b3[_0x16478e];return _0x177b0f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b0b('0x0'));var rimraf=require(_0x3b0b('0x1'));var zipdir=require(_0x3b0b('0x2'));var jsonpatch=require(_0x3b0b('0x3'));var rp=require('request-promise');var moment=require(_0x3b0b('0x4'));var BPromise=require(_0x3b0b('0x5'));var Mustache=require(_0x3b0b('0x6'));var util=require(_0x3b0b('0x7'));var path=require(_0x3b0b('0x8'));var sox=require('sox');var csv=require(_0x3b0b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b0b('0xa'));var squel=require(_0x3b0b('0xb'));var crypto=require(_0x3b0b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b0b('0x9'));var querystring=require(_0x3b0b('0xd'));var Papa=require('papaparse');var Redis=require(_0x3b0b('0xe'));var authService=require(_0x3b0b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3b0b('0x10'));var hardwareService=require(_0x3b0b('0x11'));var logger=require(_0x3b0b('0x12'))(_0x3b0b('0x13'));var utils=require(_0x3b0b('0x14'));var config=require(_0x3b0b('0x15'));var db=require(_0x3b0b('0x16'))['db'];function respondWithStatusCode(_0x55ad19,_0x59be49){_0x59be49=_0x59be49||0xcc;return function(_0x283303){if(_0x283303){return _0x55ad19[_0x3b0b('0x17')](_0x59be49);}return _0x55ad19['status'](_0x59be49)[_0x3b0b('0x18')]();};}function respondWithResult(_0x35090c,_0x2ebfbe){_0x2ebfbe=_0x2ebfbe||0xc8;return function(_0x222a2c){if(_0x222a2c){return _0x35090c[_0x3b0b('0x19')](_0x2ebfbe)['json'](_0x222a2c);}};}function respondWithFilteredResult(_0x3a3efe,_0x2dc420){return function(_0x53b2ff){if(_0x53b2ff){var _0x2a4e98=_0x53b2ff[_0x3b0b('0x1a')],_0x3ae83d=_0x2dc420[_0x3b0b('0x1b')],_0x4b504a=_0x2dc420[_0x3b0b('0x1b')]+_0x2dc420[_0x3b0b('0x1c')],_0x4535ec;if(_0x4b504a>=_0x2a4e98){_0x4b504a=_0x2a4e98;_0x4535ec=0xc8;}else{_0x4535ec=0xce;}_0x3a3efe[_0x3b0b('0x19')](_0x4535ec);return _0x3a3efe[_0x3b0b('0x1d')](_0x3b0b('0x1e'),_0x3ae83d+'-'+_0x4b504a+'/'+_0x2a4e98)[_0x3b0b('0x1f')](_0x53b2ff);}return null;};}function patchUpdates(_0xafb3f5){return function(_0x46668c){try{jsonpatch[_0x3b0b('0x20')](_0x46668c,_0xafb3f5,!![]);}catch(_0x4d0c6d){return BPromise['reject'](_0x4d0c6d);}return _0x46668c[_0x3b0b('0x21')]();};}function saveUpdates(_0x52cee2,_0x1a2e98){return function(_0x27ab83){if(_0x27ab83){return _0x27ab83['update'](_0x52cee2)['then'](function(_0x2a190b){return _0x2a190b;});}return null;};}function removeEntity(_0x1def77,_0x5412b4){return function(_0x39a24b){if(_0x39a24b){return _0x39a24b[_0x3b0b('0x22')]()[_0x3b0b('0x23')](function(){_0x1def77['status'](0xcc)[_0x3b0b('0x18')]();});}};}function handleEntityNotFound(_0x595fd5,_0x567cbb){return function(_0x1a1d47){if(!_0x1a1d47){_0x595fd5[_0x3b0b('0x17')](0x194);}return _0x1a1d47;};}function handleError(_0x5aaf9e,_0x3da0ef){_0x3da0ef=_0x3da0ef||0x1f4;return function(_0x527f02){logger['error'](_0x527f02['stack']);if(_0x527f02[_0x3b0b('0x24')]){delete _0x527f02[_0x3b0b('0x24')];}_0x5aaf9e[_0x3b0b('0x19')](_0x3da0ef)['send'](_0x527f02);};}exports['index']=function(_0x2ea561,_0x53f81c){var _0x432d01={},_0x51d693={},_0x2e0ab6={'count':0x0,'rows':[]};var _0x51bcd6=_[_0x3b0b('0x25')](db['OpenchannelApplication']['rawAttributes'],function(_0x15628d){return{'name':_0x15628d['fieldName'],'type':_0x15628d[_0x3b0b('0x26')][_0x3b0b('0x27')]};});_0x51d693[_0x3b0b('0x28')]=_[_0x3b0b('0x25')](_0x51bcd6,_0x3b0b('0x24'));_0x51d693[_0x3b0b('0x29')]=_[_0x3b0b('0x2a')](_0x2ea561[_0x3b0b('0x29')]);_0x51d693['filters']=_[_0x3b0b('0x2b')](_0x51d693[_0x3b0b('0x28')],_0x51d693['query']);_0x432d01[_0x3b0b('0x2c')]=_['intersection'](_0x51d693[_0x3b0b('0x28')],qs[_0x3b0b('0x2d')](_0x2ea561[_0x3b0b('0x29')]['fields']));_0x432d01[_0x3b0b('0x2c')]=_0x432d01['attributes'][_0x3b0b('0x2e')]?_0x432d01['attributes']:_0x51d693[_0x3b0b('0x28')];if(!_0x2ea561['query']['hasOwnProperty'](_0x3b0b('0x2f'))){_0x432d01[_0x3b0b('0x1c')]=qs[_0x3b0b('0x1c')](_0x2ea561['query'][_0x3b0b('0x1c')]);_0x432d01[_0x3b0b('0x1b')]=qs[_0x3b0b('0x1b')](_0x2ea561[_0x3b0b('0x29')][_0x3b0b('0x1b')]);}_0x432d01[_0x3b0b('0x30')]=qs[_0x3b0b('0x31')](_0x2ea561[_0x3b0b('0x29')][_0x3b0b('0x31')]);_0x432d01[_0x3b0b('0x32')]=qs[_0x3b0b('0x33')](_[_0x3b0b('0x34')](_0x2ea561[_0x3b0b('0x29')],_0x51d693[_0x3b0b('0x33')]),_0x51bcd6);if(_0x2ea561['query']['filter']){_0x432d01[_0x3b0b('0x32')]=_[_0x3b0b('0x35')](_0x432d01[_0x3b0b('0x32')],{'$or':_[_0x3b0b('0x25')](_0x51bcd6,function(_0x3fa66d){if(_0x3fa66d[_0x3b0b('0x26')]!==_0x3b0b('0x36')){var _0x1845f1={};_0x1845f1[_0x3fa66d[_0x3b0b('0x24')]]={'$like':'%'+_0x2ea561[_0x3b0b('0x29')]['filter']+'%'};return _0x1845f1;}})});}_0x432d01=_['merge']({},_0x432d01,_0x2ea561[_0x3b0b('0x37')]);var _0x2db9c8={'where':_0x432d01[_0x3b0b('0x32')]};return db['OpenchannelApplication'][_0x3b0b('0x1a')](_0x2db9c8)[_0x3b0b('0x23')](function(_0x16cb98){_0x2e0ab6['count']=_0x16cb98;if(_0x2ea561['query'][_0x3b0b('0x38')]){_0x432d01[_0x3b0b('0x39')]=[{'all':!![]}];}return db[_0x3b0b('0x3a')][_0x3b0b('0x3b')](_0x432d01);})[_0x3b0b('0x23')](function(_0x41b542){_0x2e0ab6[_0x3b0b('0x3c')]=_0x41b542;return _0x2e0ab6;})[_0x3b0b('0x23')](respondWithFilteredResult(_0x53f81c,_0x432d01))['catch'](handleError(_0x53f81c,null));};exports[_0x3b0b('0x3d')]=function(_0x43b576,_0x6c568f){var _0x13dd79={'raw':!![],'where':{'id':_0x43b576[_0x3b0b('0x3e')]['id']}},_0x9e7902={};_0x9e7902[_0x3b0b('0x28')]=_[_0x3b0b('0x2a')](db[_0x3b0b('0x3a')]['rawAttributes']);_0x9e7902['query']=_[_0x3b0b('0x2a')](_0x43b576[_0x3b0b('0x29')]);_0x9e7902[_0x3b0b('0x33')]=_[_0x3b0b('0x2b')](_0x9e7902[_0x3b0b('0x28')],_0x9e7902[_0x3b0b('0x29')]);_0x13dd79['attributes']=_[_0x3b0b('0x2b')](_0x9e7902['model'],qs[_0x3b0b('0x2d')](_0x43b576[_0x3b0b('0x29')][_0x3b0b('0x2d')]));_0x13dd79[_0x3b0b('0x2c')]=_0x13dd79[_0x3b0b('0x2c')]['length']?_0x13dd79['attributes']:_0x9e7902['model'];if(_0x43b576[_0x3b0b('0x29')][_0x3b0b('0x38')]){_0x13dd79[_0x3b0b('0x39')]=[{'all':!![]}];}_0x13dd79=_[_0x3b0b('0x35')]({},_0x13dd79,_0x43b576[_0x3b0b('0x37')]);return db['OpenchannelApplication'][_0x3b0b('0x3f')](_0x13dd79)['then'](handleEntityNotFound(_0x6c568f,null))['then'](respondWithResult(_0x6c568f,null))['catch'](handleError(_0x6c568f,null));};exports[_0x3b0b('0x40')]=function(_0x37f8d8,_0x490caa){return db[_0x3b0b('0x3a')]['create'](_0x37f8d8[_0x3b0b('0x41')],{})[_0x3b0b('0x23')](respondWithResult(_0x490caa,0xc9))[_0x3b0b('0x42')](handleError(_0x490caa,null));};exports[_0x3b0b('0x43')]=function(_0x4632d1,_0x1dbd2d){if(_0x4632d1[_0x3b0b('0x41')]['id']){delete _0x4632d1[_0x3b0b('0x41')]['id'];}return db[_0x3b0b('0x3a')][_0x3b0b('0x3f')]({'where':{'id':_0x4632d1[_0x3b0b('0x3e')]['id']}})[_0x3b0b('0x23')](handleEntityNotFound(_0x1dbd2d,null))[_0x3b0b('0x23')](saveUpdates(_0x4632d1[_0x3b0b('0x41')],null))['then'](respondWithResult(_0x1dbd2d,null))[_0x3b0b('0x42')](handleError(_0x1dbd2d,null));};exports['destroy']=function(_0x5ef9d6,_0x38193b){return db['OpenchannelApplication'][_0x3b0b('0x3f')]({'where':{'id':_0x5ef9d6['params']['id']}})[_0x3b0b('0x23')](handleEntityNotFound(_0x38193b,null))['then'](removeEntity(_0x38193b,null))[_0x3b0b('0x42')](handleError(_0x38193b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b3e5bb5..63cae7b 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 _0x0cb8=['../../config/logger','api','moment','bluebird','rimraf','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x0cb8,0xae));var _0x80cb=function(_0x4a540a,_0x5f5c99){_0x4a540a=_0x4a540a-0x0;var _0x5e2854=_0x0cb8[_0x4a540a];return _0x5e2854;};'use strict';var _=require(_0x80cb('0x0'));var util=require(_0x80cb('0x1'));var logger=require(_0x80cb('0x2'))(_0x80cb('0x3'));var moment=require(_0x80cb('0x4'));var BPromise=require(_0x80cb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80cb('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x464702,_0x661b7a){return _0x464702[_0x80cb('0x7')](_0x80cb('0x8'),attributes,{'tableName':_0x80cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x80cb('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x75a3=['utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x75a3,0xd1));var _0x375a=function(_0x87c726,_0x2235d3){_0x87c726=_0x87c726-0x0;var _0xbcdcdd=_0x75a3[_0x87c726];return _0xbcdcdd;};'use strict';var _=require(_0x375a('0x0'));var util=require('util');var logger=require(_0x375a('0x1'))(_0x375a('0x2'));var moment=require('moment');var BPromise=require(_0x375a('0x3'));var rp=require(_0x375a('0x4'));var fs=require('fs');var path=require(_0x375a('0x5'));var rimraf=require('rimraf');var config=require(_0x375a('0x6'));var attributes=require(_0x375a('0x7'));module[_0x375a('0x8')]=function(_0x4c23ee,_0x1f6975){return _0x4c23ee[_0x375a('0x9')](_0x375a('0xa'),attributes,{'tableName':_0x375a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x375a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6d16b33..aef3309 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1d2053,_0x2b2c49){var _0x33f525=function(_0x5ee4b5){while(--_0x5ee4b5){_0x1d2053['push'](_0x1d2053['shift']());}};_0x33f525(++_0x2b2c49);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e7b46,_0x1e5718){_0x4e7b46=_0x4e7b46-0x0;var _0x309599=_0xb10b[_0x4e7b46];return _0x309599;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x48e046,_0x113479){var _0x5bdf06=function(_0x53302f){while(--_0x53302f){_0x48e046['push'](_0x48e046['shift']());}};_0x5bdf06(++_0x113479);}(_0xb10b,0x12a));var _0xbb10=function(_0x388ccc,_0x2a24fd){_0x388ccc=_0x388ccc-0x0;var _0x570c20=_0xb10b[_0x388ccc];return _0x570c20;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 6e6c0b5..48344bd 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 _0xe3d6=['index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xe3d6,0x128));var _0x6e3d=function(_0x247b1d,_0x36e266){_0x247b1d=_0x247b1d-0x0;var _0x1fdbb6=_0xe3d6[_0x247b1d];return _0x1fdbb6;};'use strict';var multer=require('multer');var util=require(_0x6e3d('0x0'));var path=require(_0x6e3d('0x1'));var timeout=require(_0x6e3d('0x2'));var express=require(_0x6e3d('0x3'));var router=express[_0x6e3d('0x4')]();var auth=require(_0x6e3d('0x5'));var interaction=require(_0x6e3d('0x6'));var config=require(_0x6e3d('0x7'));var controller=require(_0x6e3d('0x8'));router['get']('/',auth[_0x6e3d('0x9')](),controller[_0x6e3d('0xa')]);router[_0x6e3d('0xb')](_0x6e3d('0xc'),auth[_0x6e3d('0x9')](),controller[_0x6e3d('0xd')]);router[_0x6e3d('0xb')]('/:id',auth[_0x6e3d('0x9')](),controller[_0x6e3d('0xe')]);router[_0x6e3d('0xb')](_0x6e3d('0xf'),auth[_0x6e3d('0x9')](),controller[_0x6e3d('0x10')]);router[_0x6e3d('0xb')](_0x6e3d('0x11'),auth['isAuthenticated'](),controller[_0x6e3d('0x12')]);router[_0x6e3d('0x13')]('/',auth[_0x6e3d('0x9')](),controller[_0x6e3d('0x14')]);router[_0x6e3d('0x13')](_0x6e3d('0xf'),auth[_0x6e3d('0x9')](),controller[_0x6e3d('0x15')]);router[_0x6e3d('0x13')](_0x6e3d('0x16'),auth[_0x6e3d('0x9')](),interaction[_0x6e3d('0x17')]('openchannel',_0x6e3d('0x18')),controller[_0x6e3d('0x19')]);router[_0x6e3d('0x1a')]('/:id',auth[_0x6e3d('0x9')](),interaction[_0x6e3d('0x17')](_0x6e3d('0x1b'),_0x6e3d('0x1c')),controller[_0x6e3d('0x1d')]);router['delete']('/:id',auth[_0x6e3d('0x9')](),interaction['tracked'](_0x6e3d('0x1b'),_0x6e3d('0x1e')),controller['destroy']);router[_0x6e3d('0x1f')](_0x6e3d('0x16'),auth['isAuthenticated'](),controller[_0x6e3d('0x20')]);module[_0x6e3d('0x21')]=router; \ No newline at end of file +var _0x3913=['removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','addTags','put','tracked','openchannel','openchannelinteraction:update','delete','destroy'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x3913,0x182));var _0x3391=function(_0x5c77c2,_0x59b073){_0x5c77c2=_0x5c77c2-0x0;var _0x4f404b=_0x3913[_0x5c77c2];return _0x4f404b;};'use strict';var multer=require(_0x3391('0x0'));var util=require(_0x3391('0x1'));var path=require(_0x3391('0x2'));var timeout=require(_0x3391('0x3'));var express=require(_0x3391('0x4'));var router=express[_0x3391('0x5')]();var auth=require(_0x3391('0x6'));var interaction=require(_0x3391('0x7'));var config=require('../../config/environment');var controller=require(_0x3391('0x8'));router[_0x3391('0x9')]('/',auth[_0x3391('0xa')](),controller[_0x3391('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3391('0xc')]);router[_0x3391('0x9')](_0x3391('0xd'),auth[_0x3391('0xa')](),controller[_0x3391('0xe')]);router[_0x3391('0x9')](_0x3391('0xf'),auth['isAuthenticated'](),controller[_0x3391('0x10')]);router[_0x3391('0x9')](_0x3391('0x11'),auth['isAuthenticated'](),controller[_0x3391('0x12')]);router[_0x3391('0x13')]('/',auth[_0x3391('0xa')](),controller[_0x3391('0x14')]);router['post'](_0x3391('0xf'),auth[_0x3391('0xa')](),controller[_0x3391('0x15')]);router[_0x3391('0x13')](_0x3391('0x16'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x3391('0x17')]);router[_0x3391('0x18')](_0x3391('0xd'),auth['isAuthenticated'](),interaction[_0x3391('0x19')](_0x3391('0x1a'),_0x3391('0x1b')),controller['update']);router[_0x3391('0x1c')]('/:id',auth[_0x3391('0xa')](),interaction['tracked'](_0x3391('0x1a'),'openchannelinteraction:destroy'),controller[_0x3391('0x1d')]);router['delete'](_0x3391('0x16'),auth['isAuthenticated'](),controller[_0x3391('0x1e')]);module[_0x3391('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3d3e83a..5c67de0 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 _0xcd48=['ENUM','out','sequelize','DATE','STRING'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0xcd48,0x93));var _0x8cd4=function(_0x17da60,_0x8b6ded){_0x17da60=_0x17da60-0x0;var _0x4b30b0=_0xcd48[_0x17da60];return _0x4b30b0;};'use strict';var Sequelize=require(_0x8cd4('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8cd4('0x1')]},'disposition':{'type':Sequelize[_0x8cd4('0x2')]},'note':{'type':Sequelize[_0x8cd4('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8cd4('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8cd4('0x3')]('in',_0x8cd4('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8cd4('0x2')]}}; \ No newline at end of file +var _0xee00=['out','exports','DATE','STRING','ENUM'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0xee00,0x123));var _0x0ee0=function(_0x17d8ef,_0x2d6a9f){_0x17d8ef=_0x17d8ef-0x0;var _0x297377=_0xee00[_0x17d8ef];return _0x297377;};'use strict';var Sequelize=require('sequelize');module[_0x0ee0('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0ee0('0x1')]},'disposition':{'type':Sequelize[_0x0ee0('0x2')]},'note':{'type':Sequelize[_0x0ee0('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x0ee0('0x2')]},'lastMsgAt':{'type':Sequelize[_0x0ee0('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x0ee0('0x3')]('in',_0x0ee0('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0ee0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 2651c75..3473bb1 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 _0x044c=['../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','select','field','name','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','expr','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','keys','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','params','includeAll','include','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','createdAt','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','disposition','threadId','Private','Messages','basename','createReadStream','createWriteStream','direction','out','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x13191c,_0x562d0f){var _0xdf46ce=function(_0x5803e4){while(--_0x5803e4){_0x13191c['push'](_0x13191c['shift']());}};_0xdf46ce(++_0x562d0f);}(_0x044c,0x1d1));var _0xc044=function(_0x45f193,_0x155044){_0x45f193=_0x45f193-0x0;var _0x556d57=_0x044c[_0x45f193];return _0x556d57;};'use strict';var pdf=require(_0xc044('0x0'));var emlformat=require(_0xc044('0x1'));var rimraf=require(_0xc044('0x2'));var zipdir=require(_0xc044('0x3'));var jsonpatch=require(_0xc044('0x4'));var rp=require(_0xc044('0x5'));var moment=require(_0xc044('0x6'));var BPromise=require(_0xc044('0x7'));var Mustache=require(_0xc044('0x8'));var util=require(_0xc044('0x9'));var path=require(_0xc044('0xa'));var sox=require('sox');var csv=require(_0xc044('0xb'));var ejs=require(_0xc044('0xc'));var fs=require('fs');var _=require(_0xc044('0xd'));var squel=require('squel');var crypto=require(_0xc044('0xe'));var jsforce=require(_0xc044('0xf'));var deskjs=require(_0xc044('0x10'));var toCsv=require(_0xc044('0xb'));var querystring=require(_0xc044('0x11'));var Papa=require(_0xc044('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc044('0x13'));var as=require(_0xc044('0x14'));var hardwareService=require(_0xc044('0x15'));var logger=require(_0xc044('0x16'))(_0xc044('0x17'));var utils=require('../../config/utils');var config=require(_0xc044('0x18'));var db=require(_0xc044('0x19'))['db'];config[_0xc044('0x1a')]=_[_0xc044('0x1b')](config[_0xc044('0x1a')],{'host':_0xc044('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc044('0x1a')]));require(_0xc044('0x1d'))[_0xc044('0x1e')](socket);function respondWithStatusCode(_0x3f5397,_0x401456){_0x401456=_0x401456||0xcc;return function(_0x13efd8){if(_0x13efd8){return _0x3f5397[_0xc044('0x1f')](_0x401456);}return _0x3f5397[_0xc044('0x20')](_0x401456)['end']();};}function respondWithResult(_0x641a63,_0x4ca66a){_0x4ca66a=_0x4ca66a||0xc8;return function(_0x57c64b){if(_0x57c64b){return _0x641a63['status'](_0x4ca66a)['json'](_0x57c64b);}};}function respondWithFilteredResult(_0x46b461,_0x466755){return function(_0xdb3663){if(_0xdb3663){var _0x4e4b77=_0xdb3663[_0xc044('0x21')],_0xa9330d=_0x466755[_0xc044('0x22')],_0x42d1b2=_0x466755[_0xc044('0x22')]+_0x466755[_0xc044('0x23')],_0x54a61c;if(_0x42d1b2>=_0x4e4b77){_0x42d1b2=_0x4e4b77;_0x54a61c=0xc8;}else{_0x54a61c=0xce;}_0x46b461[_0xc044('0x20')](_0x54a61c);return _0x46b461[_0xc044('0x24')](_0xc044('0x25'),_0xa9330d+'-'+_0x42d1b2+'/'+_0x4e4b77)[_0xc044('0x26')](_0xdb3663);}return null;};}function patchUpdates(_0x20b44d){return function(_0x287bb9){try{jsonpatch['apply'](_0x287bb9,_0x20b44d,!![]);}catch(_0x8fcf47){return BPromise[_0xc044('0x27')](_0x8fcf47);}return _0x287bb9[_0xc044('0x28')]();};}function saveUpdates(_0x5358fa,_0x2296f2){return function(_0x1e3297){if(_0x1e3297){return _0x1e3297['update'](_0x5358fa)['then'](function(_0x44cd5c){return _0x44cd5c;});}return null;};}function removeEntity(_0x5947e1,_0x4f11cb){return function(_0x2ce093){if(_0x2ce093){return _0x2ce093[_0xc044('0x29')]()[_0xc044('0x2a')](function(){_0x5947e1[_0xc044('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95767a,_0x3a980b){return function(_0x2a8a22){if(!_0x2a8a22){_0x95767a[_0xc044('0x1f')](0x194);}return _0x2a8a22;};}function handleError(_0x558b0f,_0x3f39e7){_0x3f39e7=_0x3f39e7||0x1f4;return function(_0x5bbe0d){logger[_0xc044('0x2b')](_0x5bbe0d[_0xc044('0x2c')]);if(_0x5bbe0d['name']){delete _0x5bbe0d['name'];}_0x558b0f[_0xc044('0x20')](_0x3f39e7)[_0xc044('0x2d')](_0x5bbe0d);};}function getInteractionUsers(_0xed75fb,_0x37fc35){return new BPromise(function(_0x353635,_0xb2c48b){try{if(_0x37fc35[_0xed75fb['id']]){_0xed75fb[_0xc044('0x2e')]=_[_0xc044('0x2f')](_0x37fc35[_0xed75fb['id']],function(_0x396a8b){return{'id':_0x396a8b['id'],'fullname':_0x396a8b[_0xc044('0x30')]};});}}catch(_0x1b35e4){_0xb2c48b(_0x1b35e4);}_0x353635(_0xed75fb);});}function getInteractionTags(_0x3df610,_0x215489){return new BPromise(function(_0x3f6071,_0x49f6dd){try{if(_0x3df610[_0xc044('0x31')]){_0x3df610[_0xc044('0x32')]=[];_0x3df610['TagIds'][_0xc044('0x33')](',')[_0xc044('0x34')](function(_0x279022){_0x3df610[_0xc044('0x32')][_0xc044('0x35')](_0x215489[_0x279022]);});}delete _0x3df610['TagIds'];}catch(_0x393d44){_0x49f6dd(_0x393d44);}_0x3f6071(_0x3df610);});}function updateOpenchannelInteraction(_0x310c6,_0x143fac,_0x55e473){return new BPromise(function(_0x5c86ac,_0x24698c){return getInteractionUsers(_0x310c6,_0x55e473)['then'](function(_0x23bbfb){return getInteractionTags(_0x23bbfb,_0x143fac);})[_0xc044('0x2a')](function(_0x19d59e){_0x5c86ac(_0x19d59e);})[_0xc044('0x36')](function(_0x317b31){_0x24698c(_0x317b31);});});}exports[_0xc044('0x37')]=function(_0xe1981d,_0x1df1e2){var _0x4dc361={},_0x111863={},_0x3197e0={'count':0x0,'rows':[]};var _0x1904f7=_[_0xc044('0x2f')](db[_0xc044('0x38')][_0xc044('0x39')],function(_0x4e1969){return{'name':_0x4e1969[_0xc044('0x3a')],'type':_0x4e1969[_0xc044('0x3b')][_0xc044('0x3c')]};});_0x111863['model']=_[_0xc044('0x2f')](_0x1904f7,'name');_0x111863[_0xc044('0x3d')]=_['keys'](_0xe1981d[_0xc044('0x3d')]);_0x111863['filters']=_[_0xc044('0x3e')](_0x111863['model'],_0x111863[_0xc044('0x3d')]);_0x4dc361[_0xc044('0x3f')]=_['intersection'](_0x111863[_0xc044('0x40')],qs[_0xc044('0x41')](_0xe1981d['query'][_0xc044('0x41')]));_0x4dc361[_0xc044('0x3f')]=_0x4dc361['attributes'][_0xc044('0x42')]?_0x4dc361[_0xc044('0x3f')]:_0x111863[_0xc044('0x40')];if(!_0xe1981d[_0xc044('0x3d')][_0xc044('0x43')]('nolimit')){_0x4dc361[_0xc044('0x23')]=qs[_0xc044('0x23')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x23')]);_0x4dc361[_0xc044('0x22')]=qs[_0xc044('0x22')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x22')]);}_0x4dc361[_0xc044('0x44')]=qs[_0xc044('0x45')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x45')]);_0x4dc361['where']=qs[_0xc044('0x46')](_[_0xc044('0x47')](_0xe1981d[_0xc044('0x3d')],_0x111863[_0xc044('0x46')]),_0x1904f7);var _0x28fcb5=[];var _0x1bf075=squel[_0xc044('0x48')]()[_0xc044('0x49')]('id')[_0xc044('0x49')](_0xc044('0x4a'))[_0xc044('0x49')](_0xc044('0x4b'))['from'](_0xc044('0x4c'));var _0x15e2b8=squel['select']()[_0xc044('0x49')]('u.id')[_0xc044('0x49')](_0xc044('0x4d'))[_0xc044('0x49')](_0xc044('0x4e'))[_0xc044('0x4f')](_0xc044('0x50'),'ui')[_0xc044('0x51')](_0xc044('0x52'),'u',_0xc044('0x53'));var _0x1aedb7=squel[_0xc044('0x48')]()[_0xc044('0x4f')]('openchannel_interactions','i')['left_join'](_0xc044('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xc044('0x55'))['left_join'](_0xc044('0x56'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xc044('0x51')](_0xc044('0x57'),'me',_0xc044('0x58'))[_0xc044('0x51')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xc044('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3ba853=squel[_0xc044('0x59')]();var _0x472745=[];var _0x2f987b=squel[_0xc044('0x59')]();var _0x24dfb3;if(_0xe1981d[_0xc044('0x3d')]['search']){_0x24dfb3=as['parseSearch'](_0xe1981d['query']['search']);var _0x53e159=_0x24dfb3[_0xc044('0x5a')];for(var _0x5da0cc=0x0;_0x5da0cc<_0x24dfb3[_0xc044('0x5b')][_0xc044('0x42')];_0x5da0cc++){var _0x3405f3=_0x24dfb3[_0xc044('0x5b')][_0x5da0cc];var _0x21bfc7='i';var _0x5be7d9=_['find'](_0x1904f7,[_0xc044('0x4a'),_0x3405f3[_0xc044('0x49')]]);if(!_0x5be7d9){switch(_0x3405f3[_0xc044('0x49')]){case _0xc044('0x5c'):if(_0x3405f3[_0xc044('0x5d')]==0x1){_0x1aedb7['having']('`'+_0x3405f3['field']+'`\x20=\x200');}else{_0x1aedb7[_0xc044('0x5e')]('`'+_0x3405f3[_0xc044('0x49')]+_0xc044('0x5f'));}break;case _0xc044('0x60'):if(_0x3405f3[_0xc044('0x61')]===_0xc044('0x62')){if(_0x3405f3[_0xc044('0x5d')][_0xc044('0x33')]('\x20')['length']>0x1){_0x3ba853[_0x53e159](_0xc044('0x63'),qs['getFullTextValue'](_0x3405f3[_0xc044('0x5d')]),null);}else{var _0x15e222='%'+_0x3405f3[_0xc044('0x5d')]+'%';_0x3ba853[_0x53e159](_0xc044('0x64'),_0x15e222,_0x15e222,_0x15e222);}}else{_0x5be7d9=_[_0xc044('0x65')](_0x1904f7,[_0xc044('0x4a'),_0xc044('0x66')]);_0x3405f3[_0xc044('0x49')]=_0xc044('0x66');_0x5ee0a8=as[_0xc044('0x67')](_0x21bfc7,_0x5be7d9[_0xc044('0x3b')],_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8['text'],_0x5ee0a8[_0xc044('0x5d')]['start'],_0x5ee0a8[_0xc044('0x5d')][_0xc044('0x68')]);}break;case _0xc044('0x69'):var _0x55870e=_0x3405f3[_0xc044('0x5d')][_0xc044('0x33')](',')[_0xc044('0x2f')](function(_0x231b04){return Number(_0x231b04);});_0x55870e[_0xc044('0x34')](function(_0x158d31){_0x2f987b['or'](_0xc044('0x6a'),'%,'+_0x158d31+',%');});_0x472745=_[_0xc044('0x6b')](_0x472745,_0x55870e);break;case _0xc044('0x6c'):if(_0x3405f3[_0xc044('0x61')]===_0xc044('0x62')){_0x3ba853[_0x53e159](_0xc044('0x6d'),'%'+_0x3405f3['value']+'%',null);}else{_0x5be7d9=_[_0xc044('0x65')](_0x1904f7,[_0xc044('0x4a'),_0xc044('0x6e')]);_0x3405f3['field']=_0xc044('0x6e');_0x5ee0a8=as['buildExpression'](_0x21bfc7,_0x5be7d9[_0xc044('0x3b')],_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8[_0xc044('0x6f')],_0x5ee0a8['value'][_0xc044('0x70')],_0x5ee0a8[_0xc044('0x5d')]['end']);}break;case'body':_0x5ee0a8=as[_0xc044('0x67')]('me',null,_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8[_0xc044('0x6f')],_0x5ee0a8[_0xc044('0x5d')][_0xc044('0x70')],_0x5ee0a8['value'][_0xc044('0x68')]);break;}}else{var _0x5ee0a8=as[_0xc044('0x67')](_0x21bfc7,_0x5be7d9[_0xc044('0x3b')],_0x3405f3);_0x3ba853[_0x53e159](_0x5ee0a8[_0xc044('0x6f')],_0x5ee0a8['value'][_0xc044('0x70')],_0x5ee0a8[_0xc044('0x5d')][_0xc044('0x68')]);}}}else{var _0x1bd367=_(_0xe1981d[_0xc044('0x3d')])[_0xc044('0x71')]()['map'](function(_0x95ad86){return _[_0xc044('0x72')](_0x1904f7,[_0xc044('0x4a'),_0x95ad86])?_0x95ad86:undefined;})[_0xc044('0x73')]()[_0xc044('0x5d')]();if(!_[_0xc044('0x74')](_0x1bd367)){_0x1bd367[_0xc044('0x34')](function(_0xddd11a){if(_0xddd11a===_0xc044('0x75')){_0x1aedb7[_0xc044('0x76')](_0xc044('0x77'),[][_0xc044('0x78')](_0xe1981d['query'][_0xddd11a]));}else if(_0xddd11a==='createdAt'){var _0x4d5fe2=JSON[_0xc044('0x79')](_0xe1981d[_0xc044('0x3d')][_0xddd11a])[_0xc044('0x7a')];var _0x3bb286=JSON['parse'](_0xe1981d[_0xc044('0x3d')][_0xddd11a])[_0xc044('0x7b')];_0x1aedb7['where'](_0xc044('0x7c'),_0x4d5fe2,_0x3bb286);}else{if(_0xe1981d['query'][_0xddd11a]===_0xc044('0x7d')){_0x1aedb7['where']('i.'+_0xddd11a+_0xc044('0x7e'));}else{_0x1aedb7[_0xc044('0x76')]('i.'+_0xddd11a+_0xc044('0x7f'),_0xe1981d['query'][_0xddd11a]);}}});}if(_0xe1981d[_0xc044('0x3d')][_0xc044('0x80')]){if(_0xe1981d[_0xc044('0x3d')]['read']==0x1){_0x1aedb7[_0xc044('0x5e')](_0xc044('0x81'));}else{_0x1aedb7[_0xc044('0x5e')](_0xc044('0x82'));}}if(_0xe1981d[_0xc044('0x3d')][_0xc044('0x83')]){_0x472745=_[_0xc044('0x84')](_0xe1981d[_0xc044('0x3d')][_0xc044('0x83')])?_0xe1981d[_0xc044('0x3d')]['tag']:new Array(_0xe1981d[_0xc044('0x3d')][_0xc044('0x83')]);_0x472745['forEach'](function(_0x5e597d){_0x2f987b['or'](_0xc044('0x6a'),'%,'+_0x5e597d+',%');});}if(_0xe1981d[_0xc044('0x3d')]['filter']){var _0x47909d=_0xe1981d[_0xc044('0x3d')][_0xc044('0x85')][_0xc044('0x86')]('\x5c','\x5c\x5c')[_0xc044('0x86')]('\x27\x27',_0xc044('0x87'));if(qs['isNumeric'](_0x47909d)){_0x3ba853['or'](_0xc044('0x88'),_0x47909d+'%');}else{_0x3ba853['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc044('0x89')](_0x47909d))['or']('i.from\x20LIKE\x20?',_0x47909d+'%')['or'](_0xc044('0x8a'),_0x47909d+'%');}}}_0x1aedb7[_0xc044('0x76')](_0x3ba853);_0x1aedb7[_0xc044('0x8b')](_0xc044('0x8c'));var _0x3f05ba={'type':db[_0xc044('0x8d')]['QueryTypes'][_0xc044('0x8e')],'raw':!![]};var _0x49c606=_0x1aedb7['clone']();_0x49c606[_0xc044('0x49')](_0xc044('0x8c'));_0x49c606[_0xc044('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc044('0x5c'));if(_0x4dc361[_0xc044('0x44')]){_0x4dc361[_0xc044('0x44')][_0xc044('0x34')](function(_0x4ab12d){_0x1aedb7[_0xc044('0x44')]('i.'+_0x4ab12d[0x0],_0x4ab12d[0x1]===_0xc044('0x8f')?![]:!![]);});}if(!_[_0xc044('0x74')](_0x472745)){_0x1aedb7['having'](_0x2f987b);_0x49c606['where'](_0xc044('0x90'),_0x472745);}BPromise[_0xc044('0x91')]()[_0xc044('0x2a')](function(){if(!_0x24dfb3){if(_0xe1981d['query'][_0xc044('0x75')]||_0xe1981d['query']['journey'])return;_0x49c606[_0xc044('0x76')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1aedb7[_0xc044('0x76')](_0xc044('0x92'));return;}return _0xe1981d['user'][_0xc044('0x93')]({'attributes':['id'],'raw':!![]})[_0xc044('0x2a')](function(_0xf027b7){if(_[_0xc044('0x74')](_0xf027b7)){_0x49c606[_0xc044('0x76')](_0xc044('0x94'));_0x1aedb7[_0xc044('0x76')](_0xc044('0x94'));}else{_0x49c606[_0xc044('0x76')](_0xc044('0x77'),_[_0xc044('0x2f')](_0xf027b7,'id'));_0x1aedb7[_0xc044('0x76')](_0xc044('0x77'),_['map'](_0xf027b7,'id'));}});})[_0xc044('0x2a')](function(){db[_0xc044('0x95')][_0xc044('0x3d')](_0x49c606[_0xc044('0x96')](),_0x3f05ba)[_0xc044('0x2a')](function(_0x39f540){_0x3197e0[_0xc044('0x21')]=_0x39f540[_0xc044('0x42')];if(_0x3197e0[_0xc044('0x21')]===0x0)return[];return db[_0xc044('0x95')][_0xc044('0x3d')](_0x1bf075[_0xc044('0x96')](),_0x3f05ba)['then'](function(_0xa7305){_0x28fcb5=_[_0xc044('0x97')](_0xa7305,'id');_0x3f05ba=_[_0xc044('0x98')](_0x3f05ba,{'model':db[_0xc044('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe1981d[_0xc044('0x3d')][_0xc044('0x41')]){_0x4dc361[_0xc044('0x3f')][_0xc044('0x34')](function(_0x386e7d){_0x1aedb7[_0xc044('0x49')]('i.'+_0x386e7d);});}else{_0x1aedb7[_0xc044('0x49')](_0xc044('0x99'),_0xc044('0x5c'));_0x1aedb7[_0xc044('0x49')]('a.key',_0xc044('0x9a'));_0x1aedb7[_0xc044('0x49')](_0xc044('0x9b'),_0xc044('0x9c'));_0x1aedb7['field'](_0xc044('0x9d'));_0x1aedb7[_0xc044('0x49')](_0xc044('0x9e'),_0xc044('0x9f'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa0'),_0xc044('0xa1'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa2'),_0xc044('0xa3'));_0x1aedb7['field']('c.phone',_0xc044('0xa4'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa5'),_0xc044('0xa6'));_0x1aedb7['field'](_0xc044('0xa7'),_0xc044('0xa8'));_0x1aedb7[_0xc044('0x49')](_0xc044('0xa9'),_0xc044('0xaa'));_0x1aedb7['field'](_0xc044('0xab'),_0xc044('0xac'));_0x1aedb7['field'](_0xc044('0xad'),_0xc044('0x31'));}if(_0x4dc361['limit'])_0x1aedb7[_0xc044('0x23')](_0x4dc361[_0xc044('0x23')]);if(_0x4dc361[_0xc044('0x22')])_0x1aedb7[_0xc044('0x22')](_0x4dc361[_0xc044('0x22')]);return db['sequelize'][_0xc044('0x3d')](_0x1aedb7[_0xc044('0x96')](),_0x3f05ba);})[_0xc044('0x2a')](function(_0x68d132){_0x15e2b8[_0xc044('0x76')](_0xc044('0xae'),_['map'](_0x68d132,'id'));return db[_0xc044('0x95')][_0xc044('0x3d')](_0x15e2b8['toString'](),_0x3f05ba)[_0xc044('0x2a')](function(_0x1cc706){var _0x28e8db=_['groupBy'](_0x1cc706,_0xc044('0xaf'));var _0x538d5e=[];_0x68d132[_0xc044('0x34')](function(_0x207a0a){_0x538d5e[_0xc044('0x35')](updateOpenchannelInteraction(_0x207a0a,_0x28fcb5,_0x28e8db));});return BPromise['all'](_0x538d5e);});});})[_0xc044('0x2a')](function(_0x117151){_0x3197e0[_0xc044('0xb0')]=_0x117151;return _0x3197e0;})[_0xc044('0x2a')](respondWithFilteredResult(_0x1df1e2,_0x4dc361));})[_0xc044('0x36')](handleError(_0x1df1e2,null));};exports['show']=function(_0x361251,_0x1f46b7){var _0x45bba9={'raw':![],'where':{'id':_0x361251[_0xc044('0xb1')]['id']}},_0x45b4e5={};_0x45b4e5['model']=_[_0xc044('0x71')](db[_0xc044('0x38')][_0xc044('0x39')]);_0x45b4e5['query']=_['keys'](_0x361251[_0xc044('0x3d')]);_0x45b4e5[_0xc044('0x46')]=_[_0xc044('0x3e')](_0x45b4e5[_0xc044('0x40')],_0x45b4e5['query']);_0x45bba9['attributes']=_['intersection'](_0x45b4e5[_0xc044('0x40')],qs[_0xc044('0x41')](_0x361251[_0xc044('0x3d')]['fields']));_0x45bba9[_0xc044('0x3f')]=_0x45bba9[_0xc044('0x3f')]['length']?_0x45bba9['attributes']:_0x45b4e5[_0xc044('0x40')];if(_0x361251[_0xc044('0x3d')][_0xc044('0xb2')]){_0x45bba9[_0xc044('0xb3')]=[{'all':!![]}];}_0x45bba9=_[_0xc044('0x98')]({},_0x45bba9,_0x361251[_0xc044('0xb4')]);return db[_0xc044('0x38')]['find'](_0x45bba9)[_0xc044('0x2a')](handleEntityNotFound(_0x1f46b7,null))[_0xc044('0x2a')](respondWithResult(_0x1f46b7,null))[_0xc044('0x36')](handleError(_0x1f46b7,null));};exports[_0xc044('0xb5')]=function(_0x559fc0,_0x435e5f){return db[_0xc044('0x38')][_0xc044('0xb5')](_0x559fc0[_0xc044('0xb6')],{})[_0xc044('0x2a')](respondWithResult(_0x435e5f,0xc9))['catch'](handleError(_0x435e5f,null));};exports[_0xc044('0xb7')]=function(_0x55dfa1,_0x1e590a){if(_0x55dfa1[_0xc044('0xb6')]['id']){delete _0x55dfa1['body']['id'];}return db[_0xc044('0x38')][_0xc044('0x65')]({'where':{'id':_0x55dfa1[_0xc044('0xb1')]['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x1e590a,null))['then'](saveUpdates(_0x55dfa1[_0xc044('0xb6')],null))[_0xc044('0x2a')](respondWithResult(_0x1e590a,null))[_0xc044('0x36')](handleError(_0x1e590a,null));};exports[_0xc044('0x29')]=function(_0x1f987d,_0x5b511d){return db[_0xc044('0x38')][_0xc044('0x65')]({'where':{'id':_0x1f987d[_0xc044('0xb1')]['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x5b511d,null))[_0xc044('0x2a')](removeEntity(_0x5b511d,null))[_0xc044('0x36')](handleError(_0x5b511d,null));};exports[_0xc044('0xb8')]=function(_0x4470b8,_0x7fde27){return db['OpenchannelInteraction']['describe']()['then'](respondWithResult(_0x7fde27,null))['catch'](handleError(_0x7fde27,null));};exports[_0xc044('0xb9')]=function(_0x211359,_0x30137e,_0x203e02){return db[_0xc044('0xba')][_0xc044('0x65')]({'where':{'id':_0x211359['params']['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x30137e,null))[_0xc044('0x2a')](function(_0x3c012d){if(_0x3c012d){return _0x3c012d[_0xc044('0xb9')](_0x211359[_0xc044('0xb6')][_0xc044('0xbb')],_[_0xc044('0xbc')](_0x211359[_0xc044('0xb6')],[_0xc044('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x30137e,null))[_0xc044('0x36')](handleError(_0x30137e,null));};exports[_0xc044('0xbd')]=function(_0x49fd24,_0xb2a515,_0x25e527){var _0x6422bb={'raw':![],'where':{}};var _0x557a37={};var _0x4f4402={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc044('0xbe')]({'where':{'id':_0x49fd24[_0xc044('0xb1')]['id']}})['then'](handleEntityNotFound(_0xb2a515,null))[_0xc044('0x2a')](function(_0x506ea5){if(_0x506ea5){_0x557a37[_0xc044('0x40')]=_[_0xc044('0x71')](db['OpenchannelMessage'][_0xc044('0x39')]);_0x557a37[_0xc044('0x3d')]=_[_0xc044('0x71')](_0x49fd24[_0xc044('0x3d')]);_0x557a37['filters']=_['intersection'](_0x557a37['model'],_0x557a37[_0xc044('0x3d')]);_0x6422bb[_0xc044('0x3f')]=_[_0xc044('0x3e')](_0x557a37[_0xc044('0x40')],qs['fields'](_0x49fd24[_0xc044('0x3d')]['fields']));_0x6422bb[_0xc044('0x3f')]=_0x6422bb[_0xc044('0x3f')][_0xc044('0x42')]?_0x6422bb[_0xc044('0x3f')]:_0x557a37[_0xc044('0x40')];if(!_0x49fd24['query'][_0xc044('0x43')](_0xc044('0xbf'))){_0x6422bb['limit']=qs[_0xc044('0x23')](_0x49fd24[_0xc044('0x3d')][_0xc044('0x23')]);_0x6422bb['offset']=qs[_0xc044('0x22')](_0x49fd24[_0xc044('0x3d')]['offset']);}_0x6422bb[_0xc044('0x44')]=qs[_0xc044('0x45')](_0x49fd24[_0xc044('0x3d')][_0xc044('0x45')]);_0x6422bb[_0xc044('0x76')]=qs[_0xc044('0x46')](_[_0xc044('0x47')](_0x49fd24[_0xc044('0x3d')],_0x557a37[_0xc044('0x46')]));_0x6422bb[_0xc044('0x76')][_0xc044('0xaf')]=_0x506ea5['id'];if(_0x49fd24[_0xc044('0x3d')][_0xc044('0x85')]){_0x6422bb[_0xc044('0x76')]=_['merge'](_0x6422bb[_0xc044('0x76')],{'$or':_[_0xc044('0x2f')](_0x6422bb['attributes'],function(_0x5d5b50){var _0x5342d9={};_0x5342d9[_0x5d5b50]={'$like':'%'+_0x49fd24['query'][_0xc044('0x85')]+'%'};return _0x5342d9;})});}if(_0x49fd24['query'][_0xc044('0x7a')]){var _0x58db56=_0x49fd24[_0xc044('0x3d')][_0xc044('0x7a')][_0xc044('0x33')](',');var _0xb0d9ca={};_0xb0d9ca[_0x58db56[0x0]]={'$gte':moment(_0x58db56[0x1])[_0xc044('0xc0')](_0xc044('0xc1'))};_0x6422bb[_0xc044('0x76')]=_['merge'](_0x6422bb['where'],_0xb0d9ca);}_0x6422bb=_[_0xc044('0x98')]({},_0x6422bb,_0x49fd24[_0xc044('0xb4')]);return db['OpenchannelMessage'][_0xc044('0x21')]({'where':_0x6422bb[_0xc044('0x76')]})[_0xc044('0x2a')](function(_0xdf2793){_0x4f4402[_0xc044('0x21')]=_0xdf2793;if(_0x49fd24[_0xc044('0x3d')][_0xc044('0xb2')]){_0x6422bb['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc044('0xc2')](_0x6422bb);})['then'](function(_0x5e2ce6){_0x4f4402[_0xc044('0xb0')]=_0x5e2ce6;return _0x4f4402;});}})[_0xc044('0x2a')](respondWithFilteredResult(_0xb2a515,_0x6422bb))[_0xc044('0x36')](handleError(_0xb2a515,null));};exports[_0xc044('0xc3')]=function(_0x1389dd,_0x3c045e,_0x3476b3){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1389dd[_0xc044('0xb1')]['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x3c045e,null))[_0xc044('0x2a')](function(_0x1760dd){if(_0x1760dd){return _0x1760dd[_0xc044('0xc4')](_0x1389dd[_0xc044('0xb6')][_0xc044('0xbb')],_[_0xc044('0xbc')](_0x1389dd[_0xc044('0xb6')],[_0xc044('0xbb'),'id'])||{})[_0xc044('0xc5')](function(){return db[_0xc044('0x69')][_0xc044('0xc2')]({'attributes':['id',_0xc044('0x4a'),'color'],'where':{'id':_0x1389dd[_0xc044('0xb6')]['ids']}});})[_0xc044('0x2a')](function(_0x28c6a1){socket['emit'](_0xc044('0xc6'),{'id':Number(_0x1389dd[_0xc044('0xb1')]['id']),'tags':_0x28c6a1||[]});return{'id':Number(_0x1389dd[_0xc044('0xb1')]['id']),'tags':_0x28c6a1||[]};});}})[_0xc044('0x2a')](respondWithResult(_0x3c045e,null))[_0xc044('0x36')](handleError(_0x3c045e,null));};exports[_0xc044('0xc7')]=function(_0x22d65d,_0x42a724,_0x315966){return db[_0xc044('0x38')]['find']({'where':{'id':_0x22d65d['params']['id']}})[_0xc044('0x2a')](handleEntityNotFound(_0x42a724,null))[_0xc044('0x2a')](function(_0x4040ab){if(_0x4040ab){return _0x4040ab[_0xc044('0xc7')](_0x22d65d[_0xc044('0x3d')][_0xc044('0xbb')]);}})[_0xc044('0x2a')](respondWithStatusCode(_0x42a724,null))[_0xc044('0x36')](handleError(_0x42a724,null));};exports['download']=function(_0x52460d,_0x2e55a6){var _0x4406a8=moment()[_0xc044('0xc8')]()[_0xc044('0x96')]();var _0x1e9c66=path[_0xc044('0xc9')](config['root'],_0xc044('0xca'),_0xc044('0xcb'),_0xc044('0xcc'));var _0x2f9d39=path[_0xc044('0xc9')](config[_0xc044('0xcd')],'server','files',_0xc044('0xce'));var _0x564742=path[_0xc044('0xc9')](_0x1e9c66,_0x4406a8);var _0x101efa=util[_0xc044('0xc0')](_0xc044('0xcf'),_0x52460d[_0xc044('0xb1')]['id'],_0x4406a8);var _0x100f32=path[_0xc044('0xc9')](_0x1e9c66,_0x101efa);var _0x4fc530=[];_0x4fc530[_0xc044('0x35')]({'model':db[_0xc044('0x6c')],'as':_0xc044('0x6c'),'attributes':['id',_0xc044('0x30')],'raw':!![]});_0x4fc530['push']({'model':db[_0xc044('0xd0')],'as':_0xc044('0x60'),'attributes':['id',_0xc044('0xd1'),'lastName'],'raw':!![]});if(_0x52460d['query']['attachments']){_0x4fc530[_0xc044('0x35')]({'model':db[_0xc044('0xd2')],'as':_0xc044('0xd2'),'raw':!![]});}var _0x3abef1=[{'model':db[_0xc044('0xba')],'as':'Messages','attributes':['id','body',_0xc044('0xd3'),'direction',_0xc044('0xd4'),'read'],'include':_0x4fc530}];_0x3abef1[_0xc044('0x35')]({'model':db[_0xc044('0xd5')],'as':'Account','attributes':['id',_0xc044('0x4a')]});_0x3abef1[_0xc044('0x35')]({'model':db[_0xc044('0x6c')],'as':_0xc044('0xd6'),'attributes':['id',_0xc044('0x30')]});return db['OpenchannelInteraction'][_0xc044('0x65')]({'where':{'id':_0x52460d['params']['id']},'include':_0x3abef1})[_0xc044('0x2a')](handleEntityNotFound(_0x2e55a6,null))[_0xc044('0x2a')](function(_0x3ea6da){if(_0x3ea6da){var _0xc6fc9=_0x3ea6da[_0xc044('0xd7')]({'plain':!![]});fs[_0xc044('0xd8')](_0x564742);var _0x322d1e={'format':'A4','border':_0xc044('0xd9'),'header':{'height':_0xc044('0xda'),'contents':{'first':_0xc044('0xdb')}},'footer':{'height':_0xc044('0xdc'),'contents':{'default':util['format'](_0xc044('0xdd'),util[_0xc044('0xc0')](_0xc044('0xde'),_0xc044('0xdf'),_0xc6fc9['id']),moment()[_0xc044('0xc0')](_0xc044('0xe0'))[_0xc044('0x96')]())}}};var _0x562078={'channel':_0xc044('0xdf'),'account':_0xc6fc9['Account']['name'],'agent':_0xc6fc9[_0xc044('0xd6')]?_0xc6fc9['Owner'][_0xc044('0x30')]:_0xc044('0xe1'),'createdAt':moment(_0xc6fc9[_0xc044('0xd3')])[_0xc044('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc044('0x96')](),'closedAt':_0xc6fc9[_0xc044('0xe2')]?moment(_0xc6fc9['closedAt'])['format'](_0xc044('0xc1'))[_0xc044('0x96')]():'','disposition':_0xc6fc9[_0xc044('0xe3')],'visibility':_0xc6fc9[_0xc044('0xe4')]?'Public':_0xc044('0xe5'),'messages':_(_0xc6fc9[_0xc044('0xe6')])[_0xc044('0x85')]({'secret':![]})[_0xc044('0x2f')](function(_0x3b64fc){if(_0x3b64fc[_0xc044('0xd2')]){var _0x3a2b35=path[_0xc044('0xc9')](_0x2f9d39,_0x3b64fc['Attachment'][_0xc044('0xe7')]);if(fs['existsSync'](_0x3a2b35)){fs[_0xc044('0xe8')](_0x3a2b35)['pipe'](fs[_0xc044('0xe9')](path[_0xc044('0xc9')](_0x564742,_0x3b64fc[_0xc044('0xd2')][_0xc044('0xe7')])));}}return{'date':moment(_0x3b64fc[_0xc044('0xd3')])[_0xc044('0xc0')](_0xc044('0xc1'))[_0xc044('0x96')](),'sender':_0x3b64fc[_0xc044('0xea')]===_0xc044('0xeb')?_0x3b64fc['User']?_0x3b64fc[_0xc044('0x6c')][_0xc044('0x30')]:'System':_0x3b64fc[_0xc044('0x60')][_0xc044('0xd1')]+(_0x3b64fc[_0xc044('0x60')][_0xc044('0xec')]?'\x20'+_0x3b64fc[_0xc044('0x60')][_0xc044('0xec')]:''),'body':_0x3b64fc['Attachment']?_0x3b64fc['Attachment'][_0xc044('0xe7')]:_0x3b64fc[_0xc044('0xb6')],'direction':_0x3b64fc[_0xc044('0xea')]===_0xc044('0xeb')?'A':'C','secret':_0x3b64fc[_0xc044('0xd4')],'read':_0x3b64fc[_0xc044('0x80')],'attachment':_0x3b64fc[_0xc044('0xd2')]};})[_0xc044('0x5d')]()};return ejs[_0xc044('0xed')](path[_0xc044('0xc9')](config[_0xc044('0xcd')],_0xc044('0xca'),_0xc044('0xee'),_0xc044('0xef')),{'interaction':_0x562078})['then'](function(_0xf8b37c){return new BPromise(function(_0x13241c,_0x97bd3d){pdf[_0xc044('0xb5')](_0xf8b37c,_0x322d1e)[_0xc044('0xf0')](path[_0xc044('0xc9')](_0x564742,_0xc044('0xf1')+_0xc6fc9['id']+'-'+_0x4406a8+_0xc044('0xf2')),function(_0x544d37,_0x4d7014){if(_0x544d37)return _0x97bd3d(_0x544d37);_0x13241c(_0x4d7014);});});})[_0xc044('0x2a')](function(){return new BPromise(function(_0x109060,_0x3ad650){zipdir(_0x564742,{'saveTo':_0x100f32},function(_0x4388ff,_0x1eb2c0){if(_0x4388ff)return _0x3ad650(_0x4388ff);return _0x109060(_0x1eb2c0);});})[_0xc044('0x2a')](function(){return new BPromise(function(_0x1e941f,_0x239fa7){rimraf(_0x564742,function(_0x4e1faf){if(_0x4e1faf)_0x239fa7(_0x4e1faf);return _0x1e941f();});});})[_0xc044('0x2a')](function(){return _0x2e55a6[_0xc044('0xf3')](_0x100f32,_0x101efa,function(_0x1ac9f3){if(_0x1ac9f3){console['log']('err',_0x1ac9f3);}else{fs[_0xc044('0xf4')](_0x100f32);}});});});}else{return _0x2e55a6[_0xc044('0x1f')](0xc8);}})['catch'](handleError(_0x2e55a6,null));}; \ No newline at end of file +var _0x07a4=['\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','firstName','renderFile','server','views','downloadInteraction.html','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','Tags','TagIds','split','push','catch','index','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','isEmpty','sequelize','toString','count','keyBy','OpenchannelInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','show','includeAll','include','merge','options','create','body','params','OpenchannelMessage','ids','omit','getMessages','findOne','rawAttributes','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','files','tmp','attachments','format','transcript-%d-%s.zip','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x07a4,0x1ef));var _0x407a=function(_0x323eeb,_0x3d168d){_0x323eeb=_0x323eeb-0x0;var _0x116de9=_0x07a4[_0x323eeb];return _0x116de9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x407a('0x0'));var rimraf=require(_0x407a('0x1'));var zipdir=require(_0x407a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x407a('0x3'));var moment=require(_0x407a('0x4'));var BPromise=require(_0x407a('0x5'));var Mustache=require(_0x407a('0x6'));var util=require(_0x407a('0x7'));var path=require(_0x407a('0x8'));var sox=require(_0x407a('0x9'));var csv=require(_0x407a('0xa'));var ejs=require(_0x407a('0xb'));var fs=require('fs');var _=require(_0x407a('0xc'));var squel=require(_0x407a('0xd'));var crypto=require(_0x407a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x407a('0xf'));var toCsv=require(_0x407a('0xa'));var querystring=require('querystring');var Papa=require(_0x407a('0x10'));var Redis=require(_0x407a('0x11'));var authService=require(_0x407a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x407a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x407a('0x14'))(_0x407a('0x15'));var utils=require('../../config/utils');var config=require(_0x407a('0x16'));var db=require(_0x407a('0x17'))['db'];config[_0x407a('0x18')]=_['defaults'](config['redis'],{'host':_0x407a('0x19'),'port':0x18eb});var socket=require(_0x407a('0x1a'))(new Redis(config['redis']));require(_0x407a('0x1b'))[_0x407a('0x1c')](socket);function respondWithStatusCode(_0x629221,_0x5e912c){_0x5e912c=_0x5e912c||0xcc;return function(_0x114fa8){if(_0x114fa8){return _0x629221[_0x407a('0x1d')](_0x5e912c);}return _0x629221[_0x407a('0x1e')](_0x5e912c)[_0x407a('0x1f')]();};}function respondWithResult(_0xd764e6,_0x25cf1a){_0x25cf1a=_0x25cf1a||0xc8;return function(_0x1651f3){if(_0x1651f3){return _0xd764e6[_0x407a('0x1e')](_0x25cf1a)[_0x407a('0x20')](_0x1651f3);}};}function respondWithFilteredResult(_0x5e27be,_0x22ae07){return function(_0x3119ea){if(_0x3119ea){var _0x129737=_0x3119ea['count'],_0xef8046=_0x22ae07[_0x407a('0x21')],_0x175321=_0x22ae07[_0x407a('0x21')]+_0x22ae07['limit'],_0xcd49a2;if(_0x175321>=_0x129737){_0x175321=_0x129737;_0xcd49a2=0xc8;}else{_0xcd49a2=0xce;}_0x5e27be['status'](_0xcd49a2);return _0x5e27be[_0x407a('0x22')]('Content-Range',_0xef8046+'-'+_0x175321+'/'+_0x129737)[_0x407a('0x20')](_0x3119ea);}return null;};}function patchUpdates(_0x4c9df6){return function(_0x28cb8c){try{jsonpatch[_0x407a('0x23')](_0x28cb8c,_0x4c9df6,!![]);}catch(_0x4d1800){return BPromise[_0x407a('0x24')](_0x4d1800);}return _0x28cb8c[_0x407a('0x25')]();};}function saveUpdates(_0x5b3780,_0x1e0c64){return function(_0x5ec91b){if(_0x5ec91b){return _0x5ec91b[_0x407a('0x26')](_0x5b3780)[_0x407a('0x27')](function(_0x4bdbd0){return _0x4bdbd0;});}return null;};}function removeEntity(_0x22c649,_0x5cdcc9){return function(_0x4b78ca){if(_0x4b78ca){return _0x4b78ca[_0x407a('0x28')]()[_0x407a('0x27')](function(){_0x22c649['status'](0xcc)[_0x407a('0x1f')]();});}};}function handleEntityNotFound(_0x580647,_0x5f2586){return function(_0x368715){if(!_0x368715){_0x580647[_0x407a('0x1d')](0x194);}return _0x368715;};}function handleError(_0xde8c65,_0x2ad01c){_0x2ad01c=_0x2ad01c||0x1f4;return function(_0x269c9c){logger['error'](_0x269c9c[_0x407a('0x29')]);if(_0x269c9c[_0x407a('0x2a')]){delete _0x269c9c[_0x407a('0x2a')];}_0xde8c65['status'](_0x2ad01c)[_0x407a('0x2b')](_0x269c9c);};}function getInteractionUsers(_0x1062e0,_0x1baaf3){return new BPromise(function(_0x452a46,_0x186b67){try{if(_0x1baaf3[_0x1062e0['id']]){_0x1062e0[_0x407a('0x2c')]=_[_0x407a('0x2d')](_0x1baaf3[_0x1062e0['id']],function(_0x45dfb7){return{'id':_0x45dfb7['id'],'fullname':_0x45dfb7[_0x407a('0x2e')]};});}}catch(_0x52d130){_0x186b67(_0x52d130);}_0x452a46(_0x1062e0);});}function getInteractionTags(_0x731bf2,_0x148c98){return new BPromise(function(_0x42576b,_0x229228){try{if(_0x731bf2['TagIds']){_0x731bf2[_0x407a('0x2f')]=[];_0x731bf2[_0x407a('0x30')][_0x407a('0x31')](',')['forEach'](function(_0x16700c){_0x731bf2[_0x407a('0x2f')][_0x407a('0x32')](_0x148c98[_0x16700c]);});}delete _0x731bf2[_0x407a('0x30')];}catch(_0x972ff4){_0x229228(_0x972ff4);}_0x42576b(_0x731bf2);});}function updateOpenchannelInteraction(_0x1a8a12,_0x526a90,_0x52c3dd){return new BPromise(function(_0x29d4ed,_0x13a3a9){return getInteractionUsers(_0x1a8a12,_0x52c3dd)[_0x407a('0x27')](function(_0x46d814){return getInteractionTags(_0x46d814,_0x526a90);})[_0x407a('0x27')](function(_0x20e434){_0x29d4ed(_0x20e434);})[_0x407a('0x33')](function(_0x355d71){_0x13a3a9(_0x355d71);});});}exports[_0x407a('0x34')]=function(_0x2020cf,_0x4e6911){var _0x6e9c86={},_0x2ee968={},_0x345ad8={'count':0x0,'rows':[]};var _0x35a016=_[_0x407a('0x2d')](db['OpenchannelInteraction']['rawAttributes'],function(_0x167b2b){return{'name':_0x167b2b[_0x407a('0x35')],'type':_0x167b2b[_0x407a('0x36')][_0x407a('0x37')]};});_0x2ee968['model']=_[_0x407a('0x2d')](_0x35a016,'name');_0x2ee968['query']=_[_0x407a('0x38')](_0x2020cf[_0x407a('0x39')]);_0x2ee968[_0x407a('0x3a')]=_[_0x407a('0x3b')](_0x2ee968[_0x407a('0x3c')],_0x2ee968[_0x407a('0x39')]);_0x6e9c86[_0x407a('0x3d')]=_['intersection'](_0x2ee968[_0x407a('0x3c')],qs[_0x407a('0x3e')](_0x2020cf[_0x407a('0x39')]['fields']));_0x6e9c86[_0x407a('0x3d')]=_0x6e9c86[_0x407a('0x3d')][_0x407a('0x3f')]?_0x6e9c86[_0x407a('0x3d')]:_0x2ee968[_0x407a('0x3c')];if(!_0x2020cf['query'][_0x407a('0x40')](_0x407a('0x41'))){_0x6e9c86[_0x407a('0x42')]=qs[_0x407a('0x42')](_0x2020cf[_0x407a('0x39')]['limit']);_0x6e9c86[_0x407a('0x21')]=qs[_0x407a('0x21')](_0x2020cf['query'][_0x407a('0x21')]);}_0x6e9c86[_0x407a('0x43')]=qs[_0x407a('0x44')](_0x2020cf[_0x407a('0x39')][_0x407a('0x44')]);_0x6e9c86[_0x407a('0x45')]=qs[_0x407a('0x3a')](_[_0x407a('0x46')](_0x2020cf['query'],_0x2ee968[_0x407a('0x3a')]),_0x35a016);var _0xd67be8=[];var _0x220795=squel['select']()[_0x407a('0x47')]('id')[_0x407a('0x47')]('name')[_0x407a('0x47')](_0x407a('0x48'))[_0x407a('0x49')](_0x407a('0x4a'));var _0x111a50=squel[_0x407a('0x4b')]()[_0x407a('0x47')](_0x407a('0x4c'))[_0x407a('0x47')]('u.fullname')['field'](_0x407a('0x4d'))[_0x407a('0x49')](_0x407a('0x4e'),'ui')['left_join']('users','u',_0x407a('0x4f'));var _0x18ee56=squel[_0x407a('0x4b')]()['from'](_0x407a('0x50'),'i')[_0x407a('0x51')](_0x407a('0x52'),'c',_0x407a('0x53'))['left_join'](_0x407a('0x54'),'o','o.id\x20=\x20i.UserId')[_0x407a('0x51')](_0x407a('0x55'),'a',_0x407a('0x56'))[_0x407a('0x51')]('openchannel_messages','me',_0x407a('0x57'))[_0x407a('0x51')](_0x407a('0x58'),'it',_0x407a('0x59'))['left_join']('tools_tags','t',_0x407a('0x5a'));var _0x1c624c=squel[_0x407a('0x5b')]();var _0x1fb812=[];var _0x4c2d11=squel[_0x407a('0x5b')]();var _0x39672e;if(_0x2020cf['query'][_0x407a('0x5c')]){_0x39672e=as[_0x407a('0x5d')](_0x2020cf['query'][_0x407a('0x5c')]);var _0x44dc57=_0x39672e[_0x407a('0x5e')];for(var _0x3f5814=0x0;_0x3f5814<_0x39672e[_0x407a('0x5f')][_0x407a('0x3f')];_0x3f5814++){var _0x4c6388=_0x39672e[_0x407a('0x5f')][_0x3f5814];var _0x12b80e='i';var _0x48b9c3=_['find'](_0x35a016,['name',_0x4c6388['field']]);if(!_0x48b9c3){switch(_0x4c6388[_0x407a('0x47')]){case _0x407a('0x60'):if(_0x4c6388[_0x407a('0x61')]==0x1){_0x18ee56[_0x407a('0x62')]('`'+_0x4c6388['field']+'`\x20=\x200');}else{_0x18ee56[_0x407a('0x62')]('`'+_0x4c6388[_0x407a('0x47')]+_0x407a('0x63'));}break;case _0x407a('0x64'):if(_0x4c6388[_0x407a('0x65')]===_0x407a('0x66')){if(_0x4c6388[_0x407a('0x61')][_0x407a('0x31')]('\x20')[_0x407a('0x3f')]>0x1){_0x1c624c[_0x44dc57](_0x407a('0x67'),qs['getFullTextValue'](_0x4c6388['value']),null);}else{var _0xe37d05='%'+_0x4c6388[_0x407a('0x61')]+'%';_0x1c624c[_0x44dc57](_0x407a('0x68'),_0xe37d05,_0xe37d05,_0xe37d05);}}else{_0x48b9c3=_[_0x407a('0x69')](_0x35a016,[_0x407a('0x2a'),_0x407a('0x6a')]);_0x4c6388[_0x407a('0x47')]=_0x407a('0x6a');_0x24af91=as[_0x407a('0x6b')](_0x12b80e,_0x48b9c3[_0x407a('0x36')],_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91[_0x407a('0x6c')],_0x24af91[_0x407a('0x61')][_0x407a('0x6d')],_0x24af91[_0x407a('0x61')][_0x407a('0x1f')]);}break;case _0x407a('0x6e'):var _0xc7f2b9=_0x4c6388['value'][_0x407a('0x31')](',')[_0x407a('0x2d')](function(_0x18d64b){return Number(_0x18d64b);});_0xc7f2b9[_0x407a('0x6f')](function(_0x3c9945){_0x4c2d11['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c9945+',%');});_0x1fb812=_[_0x407a('0x70')](_0x1fb812,_0xc7f2b9);break;case _0x407a('0x71'):if(_0x4c6388[_0x407a('0x65')]===_0x407a('0x66')){_0x1c624c[_0x44dc57](_0x407a('0x72'),'%'+_0x4c6388[_0x407a('0x61')]+'%',null);}else{_0x48b9c3=_['find'](_0x35a016,[_0x407a('0x2a'),'UserId']);_0x4c6388['field']='UserId';_0x24af91=as['buildExpression'](_0x12b80e,_0x48b9c3['type'],_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91[_0x407a('0x6c')],_0x24af91[_0x407a('0x61')][_0x407a('0x6d')],_0x24af91[_0x407a('0x61')]['end']);}break;case'body':_0x24af91=as[_0x407a('0x6b')]('me',null,_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91[_0x407a('0x6c')],_0x24af91[_0x407a('0x61')][_0x407a('0x6d')],_0x24af91[_0x407a('0x61')]['end']);break;}}else{var _0x24af91=as[_0x407a('0x6b')](_0x12b80e,_0x48b9c3['type'],_0x4c6388);_0x1c624c[_0x44dc57](_0x24af91['text'],_0x24af91[_0x407a('0x61')]['start'],_0x24af91[_0x407a('0x61')][_0x407a('0x1f')]);}}}else{var _0x36222a=_(_0x2020cf['query'])[_0x407a('0x38')]()[_0x407a('0x2d')](function(_0x5d94bd){return _['some'](_0x35a016,['name',_0x5d94bd])?_0x5d94bd:undefined;})[_0x407a('0x73')]()[_0x407a('0x61')]();if(!_['isEmpty'](_0x36222a)){_0x36222a['forEach'](function(_0x4eefe5){if(_0x4eefe5===_0x407a('0x74')){_0x18ee56[_0x407a('0x45')](_0x407a('0x75'),[][_0x407a('0x76')](_0x2020cf[_0x407a('0x39')][_0x4eefe5]));}else if(_0x4eefe5===_0x407a('0x77')){var _0x5c053c=JSON[_0x407a('0x78')](_0x2020cf[_0x407a('0x39')][_0x4eefe5])[_0x407a('0x79')];var _0x2fb960=JSON[_0x407a('0x78')](_0x2020cf[_0x407a('0x39')][_0x4eefe5])['$lte'];_0x18ee56[_0x407a('0x45')](_0x407a('0x7a'),_0x5c053c,_0x2fb960);}else{if(_0x2020cf[_0x407a('0x39')][_0x4eefe5]===_0x407a('0x7b')){_0x18ee56['where']('i.'+_0x4eefe5+'\x20IS\x20NULL');}else{_0x18ee56[_0x407a('0x45')]('i.'+_0x4eefe5+_0x407a('0x7c'),_0x2020cf[_0x407a('0x39')][_0x4eefe5]);}}});}if(_0x2020cf[_0x407a('0x39')][_0x407a('0x7d')]){if(_0x2020cf['query'][_0x407a('0x7d')]==0x1){_0x18ee56[_0x407a('0x62')]('`unreadMessages`\x20=\x200');}else{_0x18ee56[_0x407a('0x62')](_0x407a('0x7e'));}}if(_0x2020cf[_0x407a('0x39')]['tag']){_0x1fb812=_[_0x407a('0x7f')](_0x2020cf[_0x407a('0x39')]['tag'])?_0x2020cf['query'][_0x407a('0x80')]:new Array(_0x2020cf[_0x407a('0x39')][_0x407a('0x80')]);_0x1fb812['forEach'](function(_0x1cd53d){_0x4c2d11['or'](_0x407a('0x81'),'%,'+_0x1cd53d+',%');});}if(_0x2020cf[_0x407a('0x39')]['filter']){var _0x196a4c=_0x2020cf['query'][_0x407a('0x82')][_0x407a('0x83')]('\x5c','\x5c\x5c')[_0x407a('0x83')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x407a('0x84')](_0x196a4c)){_0x1c624c['or'](_0x407a('0x85'),_0x196a4c+'%');}else{_0x1c624c['or'](_0x407a('0x86'),qs['getFullTextValue'](_0x196a4c))['or']('i.from\x20LIKE\x20?',_0x196a4c+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x196a4c+'%');}}}_0x18ee56['where'](_0x1c624c);_0x18ee56['group'](_0x407a('0x87'));var _0x2711fe={'type':db['Sequelize'][_0x407a('0x88')][_0x407a('0x89')],'raw':!![]};var _0x151d5c=_0x18ee56[_0x407a('0x8a')]();_0x151d5c['field'](_0x407a('0x87'));_0x151d5c[_0x407a('0x47')](_0x407a('0x8b'),_0x407a('0x60'));if(_0x6e9c86[_0x407a('0x43')]){_0x6e9c86[_0x407a('0x43')][_0x407a('0x6f')](function(_0x2c07b7){_0x18ee56['order']('i.'+_0x2c07b7[0x0],_0x2c07b7[0x1]===_0x407a('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x1fb812)){_0x18ee56[_0x407a('0x62')](_0x4c2d11);_0x151d5c[_0x407a('0x45')]('t.id\x20IN\x20?',_0x1fb812);}BPromise[_0x407a('0x8d')]()[_0x407a('0x27')](function(){if(!_0x39672e){if(_0x2020cf[_0x407a('0x39')][_0x407a('0x74')]||_0x2020cf[_0x407a('0x39')]['journey'])return;_0x151d5c['where'](_0x407a('0x8e'));_0x18ee56[_0x407a('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x2020cf[_0x407a('0x8f')][_0x407a('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x101df9){if(_[_0x407a('0x91')](_0x101df9)){_0x151d5c[_0x407a('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x18ee56[_0x407a('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x151d5c['where'](_0x407a('0x75'),_[_0x407a('0x2d')](_0x101df9,'id'));_0x18ee56[_0x407a('0x45')](_0x407a('0x75'),_[_0x407a('0x2d')](_0x101df9,'id'));}});})[_0x407a('0x27')](function(){db[_0x407a('0x92')][_0x407a('0x39')](_0x151d5c[_0x407a('0x93')](),_0x2711fe)[_0x407a('0x27')](function(_0x1ad34d){_0x345ad8[_0x407a('0x94')]=_0x1ad34d['length'];if(_0x345ad8['count']===0x0)return[];return db[_0x407a('0x92')][_0x407a('0x39')](_0x220795[_0x407a('0x93')](),_0x2711fe)['then'](function(_0x2581e4){_0xd67be8=_[_0x407a('0x95')](_0x2581e4,'id');_0x2711fe=_['merge'](_0x2711fe,{'model':db[_0x407a('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2020cf[_0x407a('0x39')][_0x407a('0x3e')]){_0x6e9c86['attributes'][_0x407a('0x6f')](function(_0x34c801){_0x18ee56['field']('i.'+_0x34c801);});}else{_0x18ee56['field'](_0x407a('0x8b'),_0x407a('0x60'));_0x18ee56[_0x407a('0x47')](_0x407a('0x97'),'Account.key');_0x18ee56[_0x407a('0x47')](_0x407a('0x98'),_0x407a('0x99'));_0x18ee56['field'](_0x407a('0x9a'));_0x18ee56[_0x407a('0x47')](_0x407a('0x9b'),_0x407a('0x9c'));_0x18ee56[_0x407a('0x47')](_0x407a('0x9d'),_0x407a('0x9e'));_0x18ee56['field'](_0x407a('0x9f'),_0x407a('0xa0'));_0x18ee56[_0x407a('0x47')](_0x407a('0xa1'),_0x407a('0xa2'));_0x18ee56[_0x407a('0x47')]('c.mobile',_0x407a('0xa3'));_0x18ee56[_0x407a('0x47')](_0x407a('0xa4'),_0x407a('0xa5'));_0x18ee56[_0x407a('0x47')]('o.fullname',_0x407a('0xa6'));_0x18ee56[_0x407a('0x47')](_0x407a('0xa7'),_0x407a('0xa8'));_0x18ee56['field'](_0x407a('0xa9'),_0x407a('0x30'));}if(_0x6e9c86[_0x407a('0x42')])_0x18ee56['limit'](_0x6e9c86[_0x407a('0x42')]);if(_0x6e9c86[_0x407a('0x21')])_0x18ee56[_0x407a('0x21')](_0x6e9c86['offset']);return db[_0x407a('0x92')][_0x407a('0x39')](_0x18ee56['toString'](),_0x2711fe);})[_0x407a('0x27')](function(_0x386bf8){_0x111a50[_0x407a('0x45')](_0x407a('0xaa'),_['map'](_0x386bf8,'id'));return db[_0x407a('0x92')][_0x407a('0x39')](_0x111a50[_0x407a('0x93')](),_0x2711fe)[_0x407a('0x27')](function(_0x3803b8){var _0x56713e=_['groupBy'](_0x3803b8,_0x407a('0xab'));var _0x4b980b=[];_0x386bf8[_0x407a('0x6f')](function(_0x8af1d1){_0x4b980b['push'](updateOpenchannelInteraction(_0x8af1d1,_0xd67be8,_0x56713e));});return BPromise['all'](_0x4b980b);});});})['then'](function(_0x146062){_0x345ad8[_0x407a('0xac')]=_0x146062;return _0x345ad8;})[_0x407a('0x27')](respondWithFilteredResult(_0x4e6911,_0x6e9c86));})[_0x407a('0x33')](handleError(_0x4e6911,null));};exports[_0x407a('0xad')]=function(_0x36467a,_0x335b52){var _0x1e8b68={'raw':![],'where':{'id':_0x36467a['params']['id']}},_0x3ada83={};_0x3ada83['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x3ada83[_0x407a('0x39')]=_[_0x407a('0x38')](_0x36467a[_0x407a('0x39')]);_0x3ada83[_0x407a('0x3a')]=_[_0x407a('0x3b')](_0x3ada83[_0x407a('0x3c')],_0x3ada83[_0x407a('0x39')]);_0x1e8b68[_0x407a('0x3d')]=_['intersection'](_0x3ada83[_0x407a('0x3c')],qs[_0x407a('0x3e')](_0x36467a[_0x407a('0x39')][_0x407a('0x3e')]));_0x1e8b68[_0x407a('0x3d')]=_0x1e8b68[_0x407a('0x3d')]['length']?_0x1e8b68[_0x407a('0x3d')]:_0x3ada83['model'];if(_0x36467a['query'][_0x407a('0xae')]){_0x1e8b68[_0x407a('0xaf')]=[{'all':!![]}];}_0x1e8b68=_[_0x407a('0xb0')]({},_0x1e8b68,_0x36467a[_0x407a('0xb1')]);return db[_0x407a('0x96')][_0x407a('0x69')](_0x1e8b68)[_0x407a('0x27')](handleEntityNotFound(_0x335b52,null))[_0x407a('0x27')](respondWithResult(_0x335b52,null))['catch'](handleError(_0x335b52,null));};exports['create']=function(_0x2d1fa,_0x521852){return db[_0x407a('0x96')][_0x407a('0xb2')](_0x2d1fa[_0x407a('0xb3')],{})[_0x407a('0x27')](respondWithResult(_0x521852,0xc9))['catch'](handleError(_0x521852,null));};exports[_0x407a('0x26')]=function(_0x19e6b1,_0x4d902b){if(_0x19e6b1[_0x407a('0xb3')]['id']){delete _0x19e6b1[_0x407a('0xb3')]['id'];}return db['OpenchannelInteraction'][_0x407a('0x69')]({'where':{'id':_0x19e6b1[_0x407a('0xb4')]['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x4d902b,null))[_0x407a('0x27')](saveUpdates(_0x19e6b1['body'],null))[_0x407a('0x27')](respondWithResult(_0x4d902b,null))[_0x407a('0x33')](handleError(_0x4d902b,null));};exports[_0x407a('0x28')]=function(_0xe9eedf,_0x3d3148){return db[_0x407a('0x96')][_0x407a('0x69')]({'where':{'id':_0xe9eedf['params']['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x3d3148,null))[_0x407a('0x27')](removeEntity(_0x3d3148,null))[_0x407a('0x33')](handleError(_0x3d3148,null));};exports['describe']=function(_0x269395,_0xcff0d4){return db['OpenchannelInteraction']['describe']()[_0x407a('0x27')](respondWithResult(_0xcff0d4,null))['catch'](handleError(_0xcff0d4,null));};exports['addMessage']=function(_0x10b3b4,_0x88be7c,_0x4856db){return db[_0x407a('0xb5')][_0x407a('0x69')]({'where':{'id':_0x10b3b4['params']['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x88be7c,null))['then'](function(_0x193c93){if(_0x193c93){return _0x193c93['addMessage'](_0x10b3b4[_0x407a('0xb3')][_0x407a('0xb6')],_[_0x407a('0xb7')](_0x10b3b4[_0x407a('0xb3')],[_0x407a('0xb6'),'id'])||{});}})[_0x407a('0x27')](respondWithResult(_0x88be7c,null))[_0x407a('0x33')](handleError(_0x88be7c,null));};exports[_0x407a('0xb8')]=function(_0x383fbe,_0x46c5b5,_0x237176){var _0x155c75={'raw':![],'where':{}};var _0x3aefa3={};var _0x1fb908={'count':0x0,'rows':[]};return db[_0x407a('0x96')][_0x407a('0xb9')]({'where':{'id':_0x383fbe[_0x407a('0xb4')]['id']}})['then'](handleEntityNotFound(_0x46c5b5,null))[_0x407a('0x27')](function(_0x202db7){if(_0x202db7){_0x3aefa3['model']=_[_0x407a('0x38')](db[_0x407a('0xb5')][_0x407a('0xba')]);_0x3aefa3[_0x407a('0x39')]=_['keys'](_0x383fbe[_0x407a('0x39')]);_0x3aefa3[_0x407a('0x3a')]=_[_0x407a('0x3b')](_0x3aefa3[_0x407a('0x3c')],_0x3aefa3[_0x407a('0x39')]);_0x155c75['attributes']=_[_0x407a('0x3b')](_0x3aefa3[_0x407a('0x3c')],qs[_0x407a('0x3e')](_0x383fbe['query']['fields']));_0x155c75[_0x407a('0x3d')]=_0x155c75['attributes']['length']?_0x155c75[_0x407a('0x3d')]:_0x3aefa3['model'];if(!_0x383fbe[_0x407a('0x39')]['hasOwnProperty'](_0x407a('0x41'))){_0x155c75[_0x407a('0x42')]=qs[_0x407a('0x42')](_0x383fbe['query']['limit']);_0x155c75[_0x407a('0x21')]=qs[_0x407a('0x21')](_0x383fbe[_0x407a('0x39')][_0x407a('0x21')]);}_0x155c75['order']=qs['sort'](_0x383fbe[_0x407a('0x39')]['sort']);_0x155c75[_0x407a('0x45')]=qs[_0x407a('0x3a')](_[_0x407a('0x46')](_0x383fbe[_0x407a('0x39')],_0x3aefa3[_0x407a('0x3a')]));_0x155c75[_0x407a('0x45')][_0x407a('0xab')]=_0x202db7['id'];if(_0x383fbe[_0x407a('0x39')][_0x407a('0x82')]){_0x155c75['where']=_[_0x407a('0xb0')](_0x155c75['where'],{'$or':_[_0x407a('0x2d')](_0x155c75[_0x407a('0x3d')],function(_0xa5d9cc){var _0x2df8af={};_0x2df8af[_0xa5d9cc]={'$like':'%'+_0x383fbe['query'][_0x407a('0x82')]+'%'};return _0x2df8af;})});}if(_0x383fbe['query'][_0x407a('0x79')]){var _0x376582=_0x383fbe[_0x407a('0x39')][_0x407a('0x79')]['split'](',');var _0x3647cf={};_0x3647cf[_0x376582[0x0]]={'$gte':moment(_0x376582[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x155c75[_0x407a('0x45')]=_[_0x407a('0xb0')](_0x155c75[_0x407a('0x45')],_0x3647cf);}_0x155c75=_[_0x407a('0xb0')]({},_0x155c75,_0x383fbe['options']);return db[_0x407a('0xb5')][_0x407a('0x94')]({'where':_0x155c75[_0x407a('0x45')]})['then'](function(_0x400793){_0x1fb908[_0x407a('0x94')]=_0x400793;if(_0x383fbe[_0x407a('0x39')][_0x407a('0xae')]){_0x155c75[_0x407a('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x155c75);})[_0x407a('0x27')](function(_0x3220fb){_0x1fb908[_0x407a('0xac')]=_0x3220fb;return _0x1fb908;});}})[_0x407a('0x27')](respondWithFilteredResult(_0x46c5b5,_0x155c75))['catch'](handleError(_0x46c5b5,null));};exports[_0x407a('0xbb')]=function(_0x5c54ac,_0x1224bf,_0x76bddd){return db[_0x407a('0x96')][_0x407a('0x69')]({'where':{'id':_0x5c54ac[_0x407a('0xb4')]['id']}})[_0x407a('0x27')](handleEntityNotFound(_0x1224bf,null))[_0x407a('0x27')](function(_0x94fd49){if(_0x94fd49){return _0x94fd49['setTags'](_0x5c54ac[_0x407a('0xb3')][_0x407a('0xb6')],_['omit'](_0x5c54ac[_0x407a('0xb3')],[_0x407a('0xb6'),'id'])||{})[_0x407a('0xbc')](function(){return db['Tag']['findAll']({'attributes':['id',_0x407a('0x2a'),_0x407a('0x48')],'where':{'id':_0x5c54ac[_0x407a('0xb3')][_0x407a('0xb6')]}});})[_0x407a('0x27')](function(_0x492de0){socket[_0x407a('0xbd')](_0x407a('0xbe'),{'id':Number(_0x5c54ac[_0x407a('0xb4')]['id']),'tags':_0x492de0||[]});return{'id':Number(_0x5c54ac['params']['id']),'tags':_0x492de0||[]};});}})[_0x407a('0x27')](respondWithResult(_0x1224bf,null))[_0x407a('0x33')](handleError(_0x1224bf,null));};exports[_0x407a('0xbf')]=function(_0x15d1b0,_0xa3facf,_0x880ef1){return db[_0x407a('0x96')][_0x407a('0x69')]({'where':{'id':_0x15d1b0['params']['id']}})[_0x407a('0x27')](handleEntityNotFound(_0xa3facf,null))['then'](function(_0x70e720){if(_0x70e720){return _0x70e720[_0x407a('0xbf')](_0x15d1b0[_0x407a('0x39')][_0x407a('0xb6')]);}})[_0x407a('0x27')](respondWithStatusCode(_0xa3facf,null))[_0x407a('0x33')](handleError(_0xa3facf,null));};exports[_0x407a('0xc0')]=function(_0x47ec6e,_0x4fa130){var _0x3723e2=moment()['unix']()[_0x407a('0x93')]();var _0x468fa0=path[_0x407a('0xc1')](config[_0x407a('0xc2')],'server',_0x407a('0xc3'),_0x407a('0xc4'));var _0x4b5345=path[_0x407a('0xc1')](config[_0x407a('0xc2')],'server',_0x407a('0xc3'),_0x407a('0xc5'));var _0x2433cd=path[_0x407a('0xc1')](_0x468fa0,_0x3723e2);var _0x55bce9=util[_0x407a('0xc6')](_0x407a('0xc7'),_0x47ec6e[_0x407a('0xb4')]['id'],_0x3723e2);var _0x45a3f4=path[_0x407a('0xc1')](_0x468fa0,_0x55bce9);var _0x2e4694=[];_0x2e4694[_0x407a('0x32')]({'model':db[_0x407a('0x71')],'as':_0x407a('0x71'),'attributes':['id',_0x407a('0x2e')],'raw':!![]});_0x2e4694[_0x407a('0x32')]({'model':db['CmContact'],'as':_0x407a('0x64'),'attributes':['id','firstName',_0x407a('0xc8')],'raw':!![]});if(_0x47ec6e[_0x407a('0x39')][_0x407a('0xc5')]){_0x2e4694[_0x407a('0x32')]({'model':db[_0x407a('0xc9')],'as':_0x407a('0xc9'),'raw':!![]});}var _0x3b864c=[{'model':db['OpenchannelMessage'],'as':_0x407a('0xca'),'attributes':['id','body',_0x407a('0x77'),_0x407a('0xcb'),_0x407a('0xcc'),_0x407a('0x7d')],'include':_0x2e4694}];_0x3b864c['push']({'model':db[_0x407a('0xcd')],'as':_0x407a('0xce'),'attributes':['id',_0x407a('0x2a')]});_0x3b864c[_0x407a('0x32')]({'model':db[_0x407a('0x71')],'as':_0x407a('0xcf'),'attributes':['id',_0x407a('0x2e')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x47ec6e[_0x407a('0xb4')]['id']},'include':_0x3b864c})[_0x407a('0x27')](handleEntityNotFound(_0x4fa130,null))[_0x407a('0x27')](function(_0x18c2fe){if(_0x18c2fe){var _0x4ac300=_0x18c2fe[_0x407a('0xd0')]({'plain':!![]});fs[_0x407a('0xd1')](_0x2433cd);var _0x599783={'format':'A4','border':_0x407a('0xd2'),'header':{'height':_0x407a('0xd3'),'contents':{'first':_0x407a('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x407a('0xc6')](_0x407a('0xd5'),util[_0x407a('0xc6')](_0x407a('0xd6'),'Openchannel',_0x4ac300['id']),moment()['format']('YYYY-MM-DD')[_0x407a('0x93')]())}}};var _0x278cde={'channel':'Openchannel','account':_0x4ac300['Account'][_0x407a('0x2a')],'agent':_0x4ac300[_0x407a('0xcf')]?_0x4ac300['Owner'][_0x407a('0x2e')]:_0x407a('0xd7'),'createdAt':moment(_0x4ac300[_0x407a('0x77')])[_0x407a('0xc6')](_0x407a('0xd8'))['toString'](),'closedAt':_0x4ac300[_0x407a('0xd9')]?moment(_0x4ac300['closedAt'])[_0x407a('0xc6')](_0x407a('0xd8'))[_0x407a('0x93')]():'','disposition':_0x4ac300['disposition'],'visibility':_0x4ac300[_0x407a('0xda')]?_0x407a('0xdb'):_0x407a('0xdc'),'messages':_(_0x4ac300[_0x407a('0xca')])[_0x407a('0x82')]({'secret':![]})[_0x407a('0x2d')](function(_0x470a28){if(_0x470a28['Attachment']){var _0x5e70c1=path['join'](_0x4b5345,_0x470a28[_0x407a('0xc9')]['basename']);if(fs[_0x407a('0xdd')](_0x5e70c1)){fs[_0x407a('0xde')](_0x5e70c1)[_0x407a('0xdf')](fs[_0x407a('0xe0')](path[_0x407a('0xc1')](_0x2433cd,_0x470a28[_0x407a('0xc9')][_0x407a('0xe1')])));}}return{'date':moment(_0x470a28['createdAt'])['format'](_0x407a('0xd8'))[_0x407a('0x93')](),'sender':_0x470a28[_0x407a('0xcb')]===_0x407a('0xe2')?_0x470a28[_0x407a('0x71')]?_0x470a28[_0x407a('0x71')]['fullname']:_0x407a('0xe3'):_0x470a28['Contact'][_0x407a('0xe4')]+(_0x470a28[_0x407a('0x64')][_0x407a('0xc8')]?'\x20'+_0x470a28['Contact'][_0x407a('0xc8')]:''),'body':_0x470a28[_0x407a('0xc9')]?_0x470a28['Attachment'][_0x407a('0xe1')]:_0x470a28[_0x407a('0xb3')],'direction':_0x470a28[_0x407a('0xcb')]==='out'?'A':'C','secret':_0x470a28[_0x407a('0xcc')],'read':_0x470a28['read'],'attachment':_0x470a28[_0x407a('0xc9')]};})['value']()};return ejs[_0x407a('0xe5')](path[_0x407a('0xc1')](config['root'],_0x407a('0xe6'),_0x407a('0xe7'),_0x407a('0xe8')),{'interaction':_0x278cde})['then'](function(_0x282298){return new BPromise(function(_0x149aa6,_0x53c4f2){pdf[_0x407a('0xb2')](_0x282298,_0x599783)['toFile'](path[_0x407a('0xc1')](_0x2433cd,'transcript-'+_0x4ac300['id']+'-'+_0x3723e2+'.pdf'),function(_0x51511f,_0x5b5c9e){if(_0x51511f)return _0x53c4f2(_0x51511f);_0x149aa6(_0x5b5c9e);});});})[_0x407a('0x27')](function(){return new BPromise(function(_0x5b086a,_0x5799d0){zipdir(_0x2433cd,{'saveTo':_0x45a3f4},function(_0x27c3b8,_0x5ac875){if(_0x27c3b8)return _0x5799d0(_0x27c3b8);return _0x5b086a(_0x5ac875);});})[_0x407a('0x27')](function(){return new BPromise(function(_0x35cfc9,_0x3a75ee){rimraf(_0x2433cd,function(_0x359e8c){if(_0x359e8c)_0x3a75ee(_0x359e8c);return _0x35cfc9();});});})[_0x407a('0x27')](function(){return _0x4fa130['download'](_0x45a3f4,_0x55bce9,function(_0x1e82bd){if(_0x1e82bd){console[_0x407a('0xe9')](_0x407a('0xea'),_0x1e82bd);}else{fs[_0x407a('0xeb')](_0x45a3f4);}});});});}else{return _0x4fa130[_0x407a('0x1d')](0xc8);}})['catch'](handleError(_0x4fa130,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 26abb47..8d9cb8e 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 _0x528a=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','update'];(function(_0x147f97,_0x19f38e){var _0x18ba3b=function(_0x3642e0){while(--_0x3642e0){_0x147f97['push'](_0x147f97['shift']());}};_0x18ba3b(++_0x19f38e);}(_0x528a,0x185));var _0xa528=function(_0x30d4e7,_0x499185){_0x30d4e7=_0x30d4e7-0x0;var _0x2c99a8=_0x528a[_0x30d4e7];return _0x2c99a8;};'use strict';var EventEmitter=require(_0xa528('0x0'));var OpenchannelInteraction=require(_0xa528('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa528('0x2'),'afterDestroy':_0xa528('0x3')};function emitEvent(_0x357833){return function(_0x3c1aaa,_0x1748a5,_0x814a51){_0x3c1aaa[_0xa528('0x4')]({'attributes':['id'],'raw':!![]})[_0xa528('0x5')](function(_0x3fb107){_0x3c1aaa[_0xa528('0x6')](_0xa528('0x7'),_0x3fb107['map'](function(_0x1ecd9b){return{'id':_0x1ecd9b['id']};}));return OpenchannelMessage[_0xa528('0x8')]({'where':{'OpenchannelInteractionId':_0x3c1aaa['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x33cffc){_0x3c1aaa[_0xa528('0x6')](_0xa528('0x9'),_0x33cffc[_0xa528('0xa')]);OpenchannelInteractionEvents[_0xa528('0xb')](_0x357833+':'+_0x3c1aaa['id'],_0x3c1aaa);OpenchannelInteractionEvents[_0xa528('0xb')](_0x357833,_0x3c1aaa);_0x814a51(null);})[_0xa528('0xc')](_0x814a51(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xa528('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc2a7=['length','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x5c53be,_0x5677a5){var _0x2d5fda=function(_0x584cdb){while(--_0x584cdb){_0x5c53be['push'](_0x5c53be['shift']());}};_0x2d5fda(++_0x5677a5);}(_0xc2a7,0xd0));var _0x7c2a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc2a7[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7c2a('0x0'))['db'][_0x7c2a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x7c2a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7c2a('0x3')](0x0);var events={'afterCreate':_0x7c2a('0x4'),'afterUpdate':_0x7c2a('0x5'),'afterDestroy':_0x7c2a('0x6')};function emitEvent(_0x4bb3fa){return function(_0x2fe7b7,_0x9d9868,_0x4a4a16){_0x2fe7b7['getUsers']({'attributes':['id'],'raw':!![]})[_0x7c2a('0x7')](function(_0x1152bc){_0x2fe7b7[_0x7c2a('0x8')](_0x7c2a('0x9'),_0x1152bc[_0x7c2a('0xa')](function(_0x41850b){return{'id':_0x41850b['id']};}));return OpenchannelMessage[_0x7c2a('0xb')]({'where':{'OpenchannelInteractionId':_0x2fe7b7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c2a('0x7')](function(_0x2af2a1){_0x2fe7b7[_0x7c2a('0x8')](_0x7c2a('0xc'),_0x2af2a1[_0x7c2a('0xd')]);OpenchannelInteractionEvents['emit'](_0x4bb3fa+':'+_0x2fe7b7['id'],_0x2fe7b7);OpenchannelInteractionEvents['emit'](_0x4bb3fa,_0x2fe7b7);_0x4a4a16(null);})[_0x7c2a('0xe')](_0x4a4a16(null));};}for(var e in events){if(events[_0x7c2a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7c2a('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7fbfc2d..dcd10cd 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 _0xa59f=['moment','request-promise','path','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0xc7cc,_0x233416){var _0x4f4bde=function(_0xf80105){while(--_0xf80105){_0xc7cc['push'](_0xc7cc['shift']());}};_0x4f4bde(++_0x233416);}(_0xa59f,0x83));var _0xfa59=function(_0x58e450,_0x3e21da){_0x58e450=_0x58e450-0x0;var _0x26193d=_0xa59f[_0x58e450];return _0x26193d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa59('0x0'))('api');var moment=require(_0xfa59('0x1'));var BPromise=require('bluebird');var rp=require(_0xfa59('0x2'));var fs=require('fs');var path=require(_0xfa59('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xfa59('0x4')]=function(_0x307c2f,_0x3c7439){return _0x307c2f[_0xfa59('0x5')](_0xfa59('0x6'),attributes,{'tableName':_0xfa59('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f0349,_0x377db3,_0x362611){if(_0x1f0349['changed'](_0xfa59('0x8'))){_0x1f0349[_0xfa59('0x9')]=moment()[_0xfa59('0xa')](_0xfa59('0xb'));}_0x362611(null,_0x1f0349);}}});}; \ No newline at end of file +var _0xadd0=['../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','format','util','api','moment','bluebird','path','rimraf'];(function(_0x38cb7c,_0xf33f42){var _0x2a5f5e=function(_0x54b3ac){while(--_0x54b3ac){_0x38cb7c['push'](_0x38cb7c['shift']());}};_0x2a5f5e(++_0xf33f42);}(_0xadd0,0x158));var _0x0add=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadd0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0add('0x0'));var logger=require('../../config/logger')(_0x0add('0x1'));var moment=require(_0x0add('0x2'));var BPromise=require(_0x0add('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0add('0x4'));var rimraf=require(_0x0add('0x5'));var config=require(_0x0add('0x6'));var attributes=require(_0x0add('0x7'));module[_0x0add('0x8')]=function(_0x41d0c0,_0xc471f3){return _0x41d0c0[_0x0add('0x9')](_0x0add('0xa'),attributes,{'tableName':_0x0add('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x471594,_0x3c102c,_0x1ca5c6){if(_0x471594[_0x0add('0xc')]('closed')){_0x471594['closedAt']=moment()[_0x0add('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1ca5c6(null,_0x471594);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1fd1345..9a00dee 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 _0xb9cb=['OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','stringify','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9cb,0x191));var _0xbb9c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xb9cb[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xbb9c('0x0'));var util=require(_0xbb9c('0x1'));var moment=require('moment');var BPromise=require(_0xbb9c('0x2'));var rs=require(_0xbb9c('0x3'));var fs=require('fs');var Redis=require(_0xbb9c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb9c('0x5'));var logger=require(_0xbb9c('0x6'))(_0xbb9c('0x7'));var config=require(_0xbb9c('0x8'));var jayson=require(_0xbb9c('0x9'));var client=jayson[_0xbb9c('0xa')][_0xbb9c('0xb')]({'port':0x232a});config[_0xbb9c('0xc')]=_[_0xbb9c('0xd')](config[_0xbb9c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb9c('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3c9ea0,_0x16cdde,_0x17afe5){return new BPromise(function(_0x50950d,_0xd938e){return client[_0xbb9c('0xe')](_0x3c9ea0,_0x17afe5)[_0xbb9c('0xf')](function(_0x1abc19){logger[_0xbb9c('0x10')](_0xbb9c('0x11'),_0x16cdde,_0xbb9c('0x12'));logger[_0xbb9c('0x13')](_0xbb9c('0x14'),_0x16cdde,'request\x20sent',JSON['stringify'](_0x1abc19));if(_0x1abc19[_0xbb9c('0x15')]){if(_0x1abc19[_0xbb9c('0x15')][_0xbb9c('0x16')]===0x1f4){logger[_0xbb9c('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x16cdde,_0x1abc19[_0xbb9c('0x15')][_0xbb9c('0x17')]);return _0xd938e(_0x1abc19['error'][_0xbb9c('0x17')]);}logger[_0xbb9c('0x15')](_0xbb9c('0x11'),_0x16cdde,_0x1abc19[_0xbb9c('0x15')]['message']);return _0x50950d(_0x1abc19[_0xbb9c('0x15')][_0xbb9c('0x17')]);}else{logger['info'](_0xbb9c('0x11'),_0x16cdde,_0xbb9c('0x12'));_0x50950d(_0x1abc19[_0xbb9c('0x18')][_0xbb9c('0x17')]);}})[_0xbb9c('0x19')](function(_0x38fb93){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x16cdde,_0x38fb93);_0xd938e(_0x38fb93);});});}exports[_0xbb9c('0x1a')]=function(_0x59f2b1){var _0x327b59=this;return new Promise(function(_0x51e609,_0x5cfce3){return db[_0xbb9c('0x1b')]['update'](_0x59f2b1[_0xbb9c('0x1c')],{'raw':_0x59f2b1[_0xbb9c('0x1d')]?_0x59f2b1[_0xbb9c('0x1d')][_0xbb9c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f2b1[_0xbb9c('0x1d')]?_0x59f2b1[_0xbb9c('0x1d')][_0xbb9c('0x1f')]||null:null,'attributes':_0x59f2b1[_0xbb9c('0x1d')]?_0x59f2b1['options'][_0xbb9c('0x20')]||null:null,'limit':_0x59f2b1['options']?_0x59f2b1[_0xbb9c('0x1d')]['limit']||null:null})[_0xbb9c('0xf')](function(_0x1f3c61){logger[_0xbb9c('0x10')](_0xbb9c('0x1a'),_0x59f2b1);logger[_0xbb9c('0x13')](_0xbb9c('0x1a'),_0x59f2b1,JSON[_0xbb9c('0x21')](_0x1f3c61));_0x51e609(_0x1f3c61);})['catch'](function(_0x3d6652){logger[_0xbb9c('0x15')]('UpdateOpenchannelInteraction',_0x3d6652[_0xbb9c('0x17')],_0x59f2b1);_0x5cfce3(_0x327b59['error'](0x1f4,_0x3d6652[_0xbb9c('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1ed5f2){return new Promise(function(_0x269820,_0x5396c6){return db[_0xbb9c('0x1b')][_0xbb9c('0x22')]({'where':_0x1ed5f2[_0xbb9c('0x1d')]?_0x1ed5f2[_0xbb9c('0x1d')]['where']||null:null})[_0xbb9c('0xf')](function(_0x4b307d){if(_0x4b307d){return _0x4b307d['addTags'](_0x1ed5f2[_0xbb9c('0x1c')][_0xbb9c('0x23')],_['omit'](_0x1ed5f2['body'],['ids','id'])||{});}})[_0xbb9c('0x24')](function(_0x296b8d){logger[_0xbb9c('0x10')]('AddTags',_0x1ed5f2);logger[_0xbb9c('0x13')](_0xbb9c('0x25'),_0x1ed5f2,JSON[_0xbb9c('0x21')](_0x296b8d));_0x269820(_0x296b8d);})[_0xbb9c('0x19')](function(_0x47bebf){logger[_0xbb9c('0x15')](_0xbb9c('0x25'),_0x47bebf[_0xbb9c('0x17')],_0x1ed5f2);_0x5396c6(_this[_0xbb9c('0x15')](0x1f4,_0x47bebf[_0xbb9c('0x17')]));});});}; \ No newline at end of file +var _0x9478=['AddTags','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateOpenchannelInteraction','body','raw','options','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','ids','spread'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x9478,0x173));var _0x8947=function(_0x2304a8,_0x559d22){_0x2304a8=_0x2304a8-0x0;var _0x44668b=_0x9478[_0x2304a8];return _0x44668b;};'use strict';var _=require(_0x8947('0x0'));var util=require(_0x8947('0x1'));var moment=require('moment');var BPromise=require(_0x8947('0x2'));var rs=require(_0x8947('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8947('0x4'))['db'];var utils=require(_0x8947('0x5'));var logger=require(_0x8947('0x6'))('rpc');var config=require(_0x8947('0x7'));var jayson=require(_0x8947('0x8'));var client=jayson[_0x8947('0x9')][_0x8947('0xa')]({'port':0x232a});config[_0x8947('0xb')]=_[_0x8947('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8947('0xb')]));require(_0x8947('0xd'))[_0x8947('0xe')](socket);function respondWithRpcPromise(_0x2e623b,_0xfb3f77,_0xa690b4){return new BPromise(function(_0x5616fe,_0x53fda0){return client[_0x8947('0xf')](_0x2e623b,_0xa690b4)[_0x8947('0x10')](function(_0x105f87){logger['info'](_0x8947('0x11'),_0xfb3f77,_0x8947('0x12'));logger[_0x8947('0x13')](_0x8947('0x14'),_0xfb3f77,_0x8947('0x12'),JSON['stringify'](_0x105f87));if(_0x105f87[_0x8947('0x15')]){if(_0x105f87['error'][_0x8947('0x16')]===0x1f4){logger[_0x8947('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xfb3f77,_0x105f87[_0x8947('0x15')][_0x8947('0x17')]);return _0x53fda0(_0x105f87[_0x8947('0x15')][_0x8947('0x17')]);}logger[_0x8947('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xfb3f77,_0x105f87[_0x8947('0x15')][_0x8947('0x17')]);return _0x5616fe(_0x105f87['error'][_0x8947('0x17')]);}else{logger[_0x8947('0x18')](_0x8947('0x11'),_0xfb3f77,_0x8947('0x12'));_0x5616fe(_0x105f87[_0x8947('0x19')][_0x8947('0x17')]);}})[_0x8947('0x1a')](function(_0x5252d4){logger['error'](_0x8947('0x11'),_0xfb3f77,_0x5252d4);_0x53fda0(_0x5252d4);});});}exports[_0x8947('0x1b')]=function(_0x4f0d69){var _0x2ef74f=this;return new Promise(function(_0x5cf6e4,_0x1c3a66){return db['OpenchannelInteraction']['update'](_0x4f0d69[_0x8947('0x1c')],{'raw':_0x4f0d69['options']?_0x4f0d69['options'][_0x8947('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0d69[_0x8947('0x1e')]?_0x4f0d69['options']['where']||null:null,'attributes':_0x4f0d69[_0x8947('0x1e')]?_0x4f0d69[_0x8947('0x1e')][_0x8947('0x1f')]||null:null,'limit':_0x4f0d69[_0x8947('0x1e')]?_0x4f0d69[_0x8947('0x1e')][_0x8947('0x20')]||null:null})[_0x8947('0x10')](function(_0x552140){logger[_0x8947('0x18')](_0x8947('0x1b'),_0x4f0d69);logger[_0x8947('0x13')](_0x8947('0x1b'),_0x4f0d69,JSON['stringify'](_0x552140));_0x5cf6e4(_0x552140);})[_0x8947('0x1a')](function(_0x4aef35){logger[_0x8947('0x15')](_0x8947('0x1b'),_0x4aef35[_0x8947('0x17')],_0x4f0d69);_0x1c3a66(_0x2ef74f[_0x8947('0x15')](0x1f4,_0x4aef35['message']));});});};exports[_0x8947('0x21')]=function(_0x230533){return new Promise(function(_0x3f2b3c,_0x46a201){return db[_0x8947('0x22')][_0x8947('0x23')]({'where':_0x230533['options']?_0x230533[_0x8947('0x1e')][_0x8947('0x24')]||null:null})[_0x8947('0x10')](function(_0x1915af){if(_0x1915af){return _0x1915af['addTags'](_0x230533[_0x8947('0x1c')][_0x8947('0x25')],_['omit'](_0x230533['body'],[_0x8947('0x25'),'id'])||{});}})[_0x8947('0x26')](function(_0x246a80){logger[_0x8947('0x18')](_0x8947('0x27'),_0x230533);logger['debug'](_0x8947('0x27'),_0x230533,JSON[_0x8947('0x28')](_0x246a80));_0x3f2b3c(_0x246a80);})[_0x8947('0x1a')](function(_0x22f711){logger['error'](_0x8947('0x27'),_0x22f711[_0x8947('0x17')],_0x230533);_0x46a201(_this[_0x8947('0x15')](0x1f4,_0x22f711[_0x8947('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 81021c0..ae5966b 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 _0x9ada=['./openchannelInteraction.events','save','emit','removeListener','register','length'];(function(_0xdf190a,_0x371a80){var _0x5c402c=function(_0x2b09ce){while(--_0x2b09ce){_0xdf190a['push'](_0xdf190a['shift']());}};_0x5c402c(++_0x371a80);}(_0x9ada,0xd8));var _0xa9ad=function(_0x435de8,_0x1e563d){_0x435de8=_0x435de8-0x0;var _0x2e9e95=_0x9ada[_0x435de8];return _0x2e9e95;};'use strict';var OpenchannelInteractionEvents=require(_0xa9ad('0x0'));var events=[_0xa9ad('0x1'),'remove','update'];function createListener(_0x2a0db3,_0x5b9b9e){return function(_0x2de217){_0x5b9b9e[_0xa9ad('0x2')](_0x2a0db3,_0x2de217);};}function removeListener(_0x1af9eb,_0x52c518){return function(){OpenchannelInteractionEvents[_0xa9ad('0x3')](_0x1af9eb,_0x52c518);};}exports[_0xa9ad('0x4')]=function(_0x3202a5){for(var _0x53432a=0x0,_0x442e62=events[_0xa9ad('0x5')];_0x53432a<_0x442e62;_0x53432a++){var _0x2f4b96=events[_0x53432a];var _0x152563=createListener('openchannelInteraction:'+_0x2f4b96,_0x3202a5);OpenchannelInteractionEvents['on'](_0x2f4b96,_0x152563);}}; \ No newline at end of file +var _0x16e8=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener'];(function(_0x493030,_0x29ec7e){var _0x56f5e4=function(_0xb929a1){while(--_0xb929a1){_0x493030['push'](_0x493030['shift']());}};_0x56f5e4(++_0x29ec7e);}(_0x16e8,0x183));var _0x816e=function(_0x596f90,_0x305ed5){_0x596f90=_0x596f90-0x0;var _0x2897e9=_0x16e8[_0x596f90];return _0x2897e9;};'use strict';var OpenchannelInteractionEvents=require(_0x816e('0x0'));var events=[_0x816e('0x1'),_0x816e('0x2'),_0x816e('0x3')];function createListener(_0x1be59a,_0x3f2a4a){return function(_0x53be3d){_0x3f2a4a['emit'](_0x1be59a,_0x53be3d);};}function removeListener(_0x174f10,_0x195610){return function(){OpenchannelInteractionEvents[_0x816e('0x4')](_0x174f10,_0x195610);};}exports[_0x816e('0x5')]=function(_0x564ce4){for(var _0x4157bb=0x0,_0x3cdc8c=events['length'];_0x4157bb<_0x3cdc8c;_0x4157bb++){var _0x418de6=events[_0x4157bb];var _0x3d425d=createListener(_0x816e('0x6')+_0x418de6,_0x564ce4);OpenchannelInteractionEvents['on'](_0x418de6,_0x3d425d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ef1fb7f..aa4d6e5 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 _0x5551=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','tracked','openchannel','openchannelmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','express'];(function(_0x459451,_0x3d0204){var _0x1c6a7f=function(_0x3a0008){while(--_0x3a0008){_0x459451['push'](_0x459451['shift']());}};_0x1c6a7f(++_0x3d0204);}(_0x5551,0x1dd));var _0x1555=function(_0x8dc21c,_0x14de32){_0x8dc21c=_0x8dc21c-0x0;var _0x6b13c3=_0x5551[_0x8dc21c];return _0x6b13c3;};'use strict';var multer=require(_0x1555('0x0'));var util=require(_0x1555('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1555('0x2'));var router=express[_0x1555('0x3')]();var auth=require(_0x1555('0x4'));var interaction=require(_0x1555('0x5'));var config=require(_0x1555('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x1555('0x7')](),controller[_0x1555('0x8')]);router[_0x1555('0x9')]('/describe',auth[_0x1555('0x7')](),controller['describe']);router[_0x1555('0x9')]('/:id',auth[_0x1555('0x7')](),controller[_0x1555('0xa')]);router[_0x1555('0xb')]('/',auth[_0x1555('0x7')](),interaction[_0x1555('0xc')](_0x1555('0xd'),_0x1555('0xe')),controller['create']);router[_0x1555('0xf')](_0x1555('0x10'),auth['isAuthenticated'](),controller[_0x1555('0x11')]);router[_0x1555('0xf')](_0x1555('0x12'),auth[_0x1555('0x7')](),controller[_0x1555('0x13')]);router['put'](_0x1555('0x14'),auth['isAuthenticated'](),controller[_0x1555('0x15')]);router[_0x1555('0x16')](_0x1555('0x10'),auth['isAuthenticated'](),controller[_0x1555('0x17')]);module['exports']=router; \ No newline at end of file +var _0x42fa=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/:id','post','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4b1c8e,_0x164bd7){var _0x4f38c9=function(_0x3fd138){while(--_0x3fd138){_0x4b1c8e['push'](_0x4b1c8e['shift']());}};_0x4f38c9(++_0x164bd7);}(_0x42fa,0x97));var _0xa42f=function(_0x7beda5,_0x5d855c){_0x7beda5=_0x7beda5-0x0;var _0x5cea6b=_0x42fa[_0x7beda5];return _0x5cea6b;};'use strict';var multer=require(_0xa42f('0x0'));var util=require(_0xa42f('0x1'));var path=require(_0xa42f('0x2'));var timeout=require(_0xa42f('0x3'));var express=require(_0xa42f('0x4'));var router=express[_0xa42f('0x5')]();var auth=require(_0xa42f('0x6'));var interaction=require(_0xa42f('0x7'));var config=require(_0xa42f('0x8'));var controller=require(_0xa42f('0x9'));router[_0xa42f('0xa')]('/',auth[_0xa42f('0xb')](),controller[_0xa42f('0xc')]);router[_0xa42f('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xa42f('0xd'),auth[_0xa42f('0xb')](),controller['show']);router[_0xa42f('0xe')]('/',auth['isAuthenticated'](),interaction[_0xa42f('0xf')](_0xa42f('0x10'),_0xa42f('0x11')),controller[_0xa42f('0x12')]);router[_0xa42f('0x13')]('/:id',auth[_0xa42f('0xb')](),controller[_0xa42f('0x14')]);router[_0xa42f('0x13')](_0xa42f('0x15'),auth['isAuthenticated'](),controller[_0xa42f('0x16')]);router['put']('/:id/reject',auth[_0xa42f('0xb')](),controller['reject']);router[_0xa42f('0x17')](_0xa42f('0xd'),auth['isAuthenticated'](),controller[_0xa42f('0x18')]);module[_0xa42f('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0733846..58e168f 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 _0x6f82=['BOOLEAN','out','DATE','sequelize','medium'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f82,0xdf));var _0x26f8=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x6f82[_0x1d83db];return _0x2dc1d1;};'use strict';var Sequelize=require(_0x26f8('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x26f8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x26f8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x26f8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x26f8('0x3')),'defaultValue':_0x26f8('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x26f8('0x4')]}}; \ No newline at end of file +var _0x94d3=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x1cfc2b,_0x206b9d){var _0xd46e6e=function(_0x591f7a){while(--_0x591f7a){_0x1cfc2b['push'](_0x1cfc2b['shift']());}};_0xd46e6e(++_0x206b9d);}(_0x94d3,0x188));var _0x394d=function(_0x1adbb5,_0x5e988e){_0x1adbb5=_0x1adbb5-0x0;var _0x41e36c=_0x94d3[_0x1adbb5];return _0x41e36c;};'use strict';var Sequelize=require(_0x394d('0x0'));module['exports']={'body':{'type':Sequelize[_0x394d('0x1')](_0x394d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x394d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x394d('0x4')),'defaultValue':_0x394d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x394d('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 889f8a7..a668c2b 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 _0x8b69=['code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','rows','show','create','body','find','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','null','rejectMessage','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53565a,_0x40648b){var _0x387936=function(_0x4009f2){while(--_0x4009f2){_0x53565a['push'](_0x53565a['shift']());}};_0x387936(++_0x40648b);}(_0x8b69,0x1b7));var _0x98b6=function(_0x5006c9,_0x59f403){_0x5006c9=_0x5006c9-0x0;var _0x4c8ade=_0x8b69[_0x5006c9];return _0x4c8ade;};'use strict';var pdf=require(_0x98b6('0x0'));var emlformat=require(_0x98b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x98b6('0x2'));var jsonpatch=require(_0x98b6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b6('0x4'));var Mustache=require(_0x98b6('0x5'));var util=require(_0x98b6('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98b6('0x7'));var fs=require('fs');var _=require(_0x98b6('0x8'));var squel=require('squel');var crypto=require(_0x98b6('0x9'));var jsforce=require(_0x98b6('0xa'));var deskjs=require(_0x98b6('0xb'));var toCsv=require(_0x98b6('0xc'));var querystring=require(_0x98b6('0xd'));var Papa=require(_0x98b6('0xe'));var Redis=require('ioredis');var authService=require(_0x98b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x98b6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98b6('0x11'))('api');var utils=require(_0x98b6('0x12'));var config=require(_0x98b6('0x13'));var db=require(_0x98b6('0x14'))['db'];config['redis']=_[_0x98b6('0x15')](config[_0x98b6('0x16')],{'host':_0x98b6('0x17'),'port':0x18eb});var socket=require(_0x98b6('0x18'))(new Redis(config['redis']));require(_0x98b6('0x19'))[_0x98b6('0x1a')](socket);var jayson=require(_0x98b6('0x1b'));var client=jayson[_0x98b6('0x1c')][_0x98b6('0x1d')]({'port':0x232c});var client9002=jayson[_0x98b6('0x1c')][_0x98b6('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xea574,_0x295f85,_0x4fc08a){if(_0x4fc08a){var _0x29eaaa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29eaaa['test'](_0x295f85)){return _0xea574;}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 _0xea574;}}function respondWithRpcPromise(_0x8a4921,_0x1cfea7,_0x1ed91e,_0x167f9e){return new BPromise(function(_0xaa699,_0x54e14a){var _0xe27c84=_0x167f9e||client;return _0xe27c84[_0x98b6('0x1e')](_0x8a4921,_0x1ed91e)[_0x98b6('0x1f')](function(_0x477e1a){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1cfea7,_0x98b6('0x20'));logger[_0x98b6('0x21')](_0x98b6('0x22'),_0x1cfea7,_0x98b6('0x20'),JSON[_0x98b6('0x23')](_0x477e1a));if(_0x477e1a['error']){if(_0x477e1a[_0x98b6('0x24')][_0x98b6('0x25')]===0x1f4){logger[_0x98b6('0x24')](_0x98b6('0x26'),_0x1cfea7,_0x477e1a['error'][_0x98b6('0x27')]);return _0x54e14a(_0x477e1a[_0x98b6('0x24')][_0x98b6('0x27')]);}logger['error'](_0x98b6('0x26'),_0x1cfea7,_0x477e1a[_0x98b6('0x24')][_0x98b6('0x27')]);return _0xaa699(_0x477e1a['error']['message']);}else{logger[_0x98b6('0x28')](_0x98b6('0x26'),_0x1cfea7,_0x98b6('0x20'));_0xaa699(_0x477e1a[_0x98b6('0x29')][_0x98b6('0x27')]);}})[_0x98b6('0x2a')](function(_0x38524a){logger['error'](_0x98b6('0x26'),_0x1cfea7,_0x38524a);_0x54e14a(_0x38524a);});});}function respondWithStatusCode(_0x14e11d,_0x415cef){_0x415cef=_0x415cef||0xcc;return function(_0x5c3852){if(_0x5c3852){return _0x14e11d['sendStatus'](_0x415cef);}return _0x14e11d[_0x98b6('0x2b')](_0x415cef)[_0x98b6('0x2c')]();};}function respondWithResult(_0x2830e9,_0x46a8c9){_0x46a8c9=_0x46a8c9||0xc8;return function(_0x43ccaf){if(_0x43ccaf){return _0x2830e9[_0x98b6('0x2b')](_0x46a8c9)[_0x98b6('0x2d')](_0x43ccaf);}};}function respondWithFilteredResult(_0xd97ef2,_0x347cea){return function(_0xa9ce3){if(_0xa9ce3){var _0x3cc704=_0xa9ce3[_0x98b6('0x2e')],_0x35405d=_0x347cea[_0x98b6('0x2f')],_0x1fd55d=_0x347cea[_0x98b6('0x2f')]+_0x347cea[_0x98b6('0x30')],_0xe0945e;if(_0x1fd55d>=_0x3cc704){_0x1fd55d=_0x3cc704;_0xe0945e=0xc8;}else{_0xe0945e=0xce;}_0xd97ef2[_0x98b6('0x2b')](_0xe0945e);return _0xd97ef2[_0x98b6('0x31')](_0x98b6('0x32'),_0x35405d+'-'+_0x1fd55d+'/'+_0x3cc704)['json'](_0xa9ce3);}return null;};}function patchUpdates(_0x165b61){return function(_0x29d15a){try{jsonpatch[_0x98b6('0x33')](_0x29d15a,_0x165b61,!![]);}catch(_0x2c72c3){return BPromise[_0x98b6('0x34')](_0x2c72c3);}return _0x29d15a[_0x98b6('0x35')]();};}function saveUpdates(_0x3854c1,_0x21a5cb){return function(_0x51a5d0){if(_0x51a5d0){return _0x51a5d0[_0x98b6('0x36')](_0x3854c1)[_0x98b6('0x1f')](function(_0x52c6b6){return _0x52c6b6;});}return null;};}function removeEntity(_0x46060b,_0x4a8bf4){return function(_0x4315c8){if(_0x4315c8){return _0x4315c8[_0x98b6('0x37')]()[_0x98b6('0x1f')](function(){_0x46060b[_0x98b6('0x2b')](0xcc)[_0x98b6('0x2c')]();});}};}function handleEntityNotFound(_0x2c064c,_0x3a875c){return function(_0x47962b){if(!_0x47962b){_0x2c064c[_0x98b6('0x38')](0x194);}return _0x47962b;};}function handleError(_0x3ec5a8,_0x55ec4a){_0x55ec4a=_0x55ec4a||0x1f4;return function(_0x160dcb){logger[_0x98b6('0x24')](_0x160dcb['stack']);if(_0x160dcb[_0x98b6('0x39')]){delete _0x160dcb[_0x98b6('0x39')];}_0x3ec5a8[_0x98b6('0x2b')](_0x55ec4a)[_0x98b6('0x3a')](_0x160dcb);};}exports[_0x98b6('0x3b')]=function(_0x3edc3a,_0x57d7dd){var _0x19ef5b={},_0x1d7ec9={},_0x813b9b={'count':0x0,'rows':[]};var _0x3ef3ae=_[_0x98b6('0x3c')](db[_0x98b6('0x3d')][_0x98b6('0x3e')],function(_0x21abd0){return{'name':_0x21abd0[_0x98b6('0x3f')],'type':_0x21abd0[_0x98b6('0x40')][_0x98b6('0x41')]};});_0x1d7ec9['model']=_[_0x98b6('0x3c')](_0x3ef3ae,_0x98b6('0x39'));_0x1d7ec9[_0x98b6('0x42')]=_[_0x98b6('0x43')](_0x3edc3a[_0x98b6('0x42')]);_0x1d7ec9[_0x98b6('0x44')]=_[_0x98b6('0x45')](_0x1d7ec9['model'],_0x1d7ec9[_0x98b6('0x42')]);_0x19ef5b['attributes']=_['intersection'](_0x1d7ec9['model'],qs[_0x98b6('0x46')](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x46')]));_0x19ef5b[_0x98b6('0x47')]=_0x19ef5b['attributes'][_0x98b6('0x48')]?_0x19ef5b[_0x98b6('0x47')]:_0x1d7ec9[_0x98b6('0x49')];if(!_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4a')]('nolimit')){_0x19ef5b[_0x98b6('0x30')]=qs['limit'](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x30')]);_0x19ef5b[_0x98b6('0x2f')]=qs['offset'](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x2f')]);}_0x19ef5b[_0x98b6('0x4b')]=qs[_0x98b6('0x4c')](_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4c')]);_0x19ef5b[_0x98b6('0x4d')]=qs[_0x98b6('0x44')](_['pick'](_0x3edc3a[_0x98b6('0x42')],_0x1d7ec9[_0x98b6('0x44')]),_0x3ef3ae);if(_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4e')]){_0x19ef5b[_0x98b6('0x4d')]=_['merge'](_0x19ef5b[_0x98b6('0x4d')],{'$or':_[_0x98b6('0x3c')](_0x3ef3ae,function(_0x1268d6){if(_0x1268d6['type']!=='VIRTUAL'){var _0x30b7fa={};_0x30b7fa[_0x1268d6[_0x98b6('0x39')]]={'$like':'%'+_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x4e')]+'%'};return _0x30b7fa;}})});}_0x19ef5b=_[_0x98b6('0x4f')]({},_0x19ef5b,_0x3edc3a[_0x98b6('0x50')]);var _0x138dff={'where':_0x19ef5b[_0x98b6('0x4d')]};return db[_0x98b6('0x3d')][_0x98b6('0x2e')](_0x138dff)[_0x98b6('0x1f')](function(_0xd33792){_0x813b9b['count']=_0xd33792;if(_0x3edc3a[_0x98b6('0x42')][_0x98b6('0x51')]){_0x19ef5b['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x19ef5b);})['then'](function(_0x2f48d6){_0x813b9b[_0x98b6('0x52')]=_0x2f48d6;return _0x813b9b;})['then'](respondWithFilteredResult(_0x57d7dd,_0x19ef5b))[_0x98b6('0x2a')](handleError(_0x57d7dd,null));};exports[_0x98b6('0x53')]=function(_0x4c54e1,_0x6557ef){var _0x5888c8={'raw':!![],'where':{'id':_0x4c54e1['params']['id']}},_0x26e1b4={};_0x26e1b4['model']=_[_0x98b6('0x43')](db[_0x98b6('0x3d')]['rawAttributes']);_0x26e1b4[_0x98b6('0x42')]=_[_0x98b6('0x43')](_0x4c54e1[_0x98b6('0x42')]);_0x26e1b4[_0x98b6('0x44')]=_[_0x98b6('0x45')](_0x26e1b4[_0x98b6('0x49')],_0x26e1b4[_0x98b6('0x42')]);_0x5888c8[_0x98b6('0x47')]=_['intersection'](_0x26e1b4[_0x98b6('0x49')],qs[_0x98b6('0x46')](_0x4c54e1[_0x98b6('0x42')][_0x98b6('0x46')]));_0x5888c8[_0x98b6('0x47')]=_0x5888c8['attributes']['length']?_0x5888c8[_0x98b6('0x47')]:_0x26e1b4[_0x98b6('0x49')];if(_0x4c54e1[_0x98b6('0x42')][_0x98b6('0x51')]){_0x5888c8['include']=[{'all':!![]}];}_0x5888c8=_[_0x98b6('0x4f')]({},_0x5888c8,_0x4c54e1['options']);return db[_0x98b6('0x3d')]['find'](_0x5888c8)[_0x98b6('0x1f')](handleEntityNotFound(_0x6557ef,null))[_0x98b6('0x1f')](respondWithResult(_0x6557ef,null))[_0x98b6('0x2a')](handleError(_0x6557ef,null));};exports['create']=function(_0xe8ef9d,_0x343cd2){return db[_0x98b6('0x3d')][_0x98b6('0x54')](_0xe8ef9d['body'],{})['then'](respondWithResult(_0x343cd2,0xc9))['catch'](handleError(_0x343cd2,null));};exports['update']=function(_0x55db0d,_0x41fe98){if(_0x55db0d['body']['id']){delete _0x55db0d[_0x98b6('0x55')]['id'];}return db[_0x98b6('0x3d')]['find']({'where':{'id':_0x55db0d['params']['id']}})[_0x98b6('0x1f')](handleEntityNotFound(_0x41fe98,null))[_0x98b6('0x1f')](saveUpdates(_0x55db0d[_0x98b6('0x55')],null))['then'](respondWithResult(_0x41fe98,null))['catch'](handleError(_0x41fe98,null));};exports['destroy']=function(_0x14a8bb,_0x3f1961){return db['OpenchannelMessage'][_0x98b6('0x56')]({'where':{'id':_0x14a8bb[_0x98b6('0x57')]['id']}})[_0x98b6('0x1f')](handleEntityNotFound(_0x3f1961,null))[_0x98b6('0x1f')](removeEntity(_0x3f1961,null))['catch'](handleError(_0x3f1961,null));};exports[_0x98b6('0x58')]=function(_0x12a75e,_0x1d385d){return db[_0x98b6('0x3d')][_0x98b6('0x58')]()['then'](respondWithResult(_0x1d385d,null))[_0x98b6('0x2a')](handleError(_0x1d385d,null));};var interaction_log=require('../../config/logger')(_0x98b6('0x59'));exports[_0x98b6('0x5a')]=function(_0x2c82d6,_0x478c25,_0xafc44a){var _0x4630cb={'channel':_0x98b6('0x5b')};if(_0x2c82d6[_0x98b6('0x55')]['id']){delete _0x2c82d6['body']['id'];}_0x2c82d6['body'][_0x98b6('0x5c')]=!![];_0x2c82d6[_0x98b6('0x55')][_0x98b6('0x5d')]=moment()[_0x98b6('0x5e')](_0x98b6('0x5f'));_0x2c82d6[_0x98b6('0x55')]['UserId']=_0x2c82d6[_0x98b6('0x55')][_0x98b6('0x60')]||_0x2c82d6[_0x98b6('0x61')]['id'];return db[_0x98b6('0x3d')]['find']({'where':{'id':_0x2c82d6['params']['id'],'UserId':null},'include':[{'model':db[_0x98b6('0x62')],'as':_0x98b6('0x63')}]})[_0x98b6('0x1f')](handleEntityNotFound(_0x478c25,null))['then'](saveUpdates(_0x2c82d6[_0x98b6('0x55')],null))['then'](function(_0xa01b41){if(_0xa01b41){_0x4630cb[_0x98b6('0x27')]=_0xa01b41[_0x98b6('0x64')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0xa01b41[_0x98b6('0x65')]}});}return null;})[_0x98b6('0x1f')](handleEntityNotFound(_0x478c25,null))[_0x98b6('0x1f')](function(_0x293e57){if(_0x293e57){return _0x293e57[_0x98b6('0x36')]({'UserId':_0x2c82d6['body']['UserId'],'read1stAt':_[_0x98b6('0x66')](_0x293e57[_0x98b6('0x67')])?moment()['format'](_0x98b6('0x5f')):undefined});}return null;})[_0x98b6('0x1f')](function(_0x90e97d){if(_0x90e97d){_0x4630cb[_0x98b6('0x68')]=_0x90e97d['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c82d6['user']['id'],_0x2c82d6['user'][_0x98b6('0x39')],_0x2c82d6[_0x98b6('0x61')][_0x98b6('0x69')],_0x4630cb[_0x98b6('0x68')]['id'],_0x2c82d6[_0x98b6('0x55')]?JSON[_0x98b6('0x23')](_0x2c82d6[_0x98b6('0x55')]):'null');return respondWithRpcPromise(_0x98b6('0x6a'),_0x98b6('0x6b'),_0x4630cb);}return null;})[_0x98b6('0x1f')](function(_0x2ea892){if(_0x2ea892){if(_0x2c82d6[_0x98b6('0x55')]['manual']){_0x4630cb['message'][_0x98b6('0x6c')]=util['format'](_0x98b6('0x6d'),_0x2c82d6[_0x98b6('0x61')][_0x98b6('0x39')]);_0x4630cb[_0x98b6('0x27')][_0x98b6('0x6e')]=_0x4630cb[_0x98b6('0x6e')];_0x4630cb[_0x98b6('0x27')][_0x98b6('0x6f')]='accept';return respondWithRpcPromise(_0x98b6('0x70'),_0x98b6('0x70'),{'event':_0x98b6('0x71'),'message':_0x4630cb['message']},client9002)[_0x98b6('0x1f')](function(){return _0x4630cb;});}return _0x4630cb;}return null;})[_0x98b6('0x1f')](respondWithResult(_0x478c25,null))['catch'](handleError(_0x478c25,null));};var interaction_log=require(_0x98b6('0x11'))(_0x98b6('0x59'));exports['reject']=function(_0x50d555,_0x122f6d,_0x3c25cc){var _0x4f6717={'agent':{},'channel':_0x98b6('0x5b')};if(_0x50d555[_0x98b6('0x55')]['id']){delete _0x50d555['body']['id'];}_0x50d555['body'][_0x98b6('0x60')]=_0x50d555[_0x98b6('0x55')][_0x98b6('0x60')]||_0x50d555[_0x98b6('0x61')]['id'];_0x4f6717[_0x98b6('0x72')]['id']=_0x50d555[_0x98b6('0x55')]['UserId'];return db[_0x98b6('0x3d')][_0x98b6('0x56')]({'where':{'id':_0x50d555['params']['id'],'UserId':null}})[_0x98b6('0x1f')](handleEntityNotFound(_0x122f6d,null))[_0x98b6('0x1f')](function(_0x478ba1){if(_0x478ba1){_0x4f6717['message']=_0x478ba1['get']({'plain':!![]});return db[_0x98b6('0x73')][_0x98b6('0x56')]({'where':{'id':_0x478ba1[_0x98b6('0x65')]}});}return null;})[_0x98b6('0x1f')](handleEntityNotFound(_0x122f6d,null))['then'](function(_0x139df8){if(_0x139df8){_0x4f6717[_0x98b6('0x68')]=_0x139df8[_0x98b6('0x64')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x50d555[_0x98b6('0x61')]['id'],_0x50d555[_0x98b6('0x61')][_0x98b6('0x39')],_0x50d555['user']['role'],_0x4f6717[_0x98b6('0x68')]['id'],_0x50d555[_0x98b6('0x55')]?JSON[_0x98b6('0x23')](_0x50d555[_0x98b6('0x55')]):_0x98b6('0x74'));return respondWithRpcPromise('RejectMessage',_0x98b6('0x75'),_0x4f6717);}return null;})[_0x98b6('0x1f')](function(_0x1f67a5){if(_0x1f67a5){_0x1f67a5['message'][_0x98b6('0x6c')]=util[_0x98b6('0x5e')](_0x98b6('0x6d'),_0x50d555[_0x98b6('0x61')][_0x98b6('0x39')]);_0x1f67a5[_0x98b6('0x27')]['channel']=_0x4f6717[_0x98b6('0x6e')];_0x1f67a5[_0x98b6('0x27')][_0x98b6('0x6f')]=_0x98b6('0x34');respondWithRpcPromise('EventManager',_0x98b6('0x70'),{'event':_0x98b6('0x76'),'message':_0x1f67a5[_0x98b6('0x27')]},client9002);return _0x4f6717;}return null;})['then'](respondWithResult(_0x122f6d,null))[_0x98b6('0x2a')](handleError(_0x122f6d,null));}; \ No newline at end of file +var _0xc3fc=['accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','name','send','index','map','OpenchannelMessage','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','find','create','body','update','describe','openchannel-interactions'];(function(_0x177654,_0x3e78eb){var _0x394e97=function(_0x43b013){while(--_0x43b013){_0x177654['push'](_0x177654['shift']());}};_0x394e97(++_0x3e78eb);}(_0xc3fc,0x194));var _0xcc3f=function(_0x9f6913,_0xd3f9e1){_0x9f6913=_0x9f6913-0x0;var _0x22507c=_0xc3fc[_0x9f6913];return _0x22507c;};'use strict';var pdf=require(_0xcc3f('0x0'));var emlformat=require(_0xcc3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc3f('0x3'));var moment=require(_0xcc3f('0x4'));var BPromise=require(_0xcc3f('0x5'));var Mustache=require(_0xcc3f('0x6'));var util=require(_0xcc3f('0x7'));var path=require(_0xcc3f('0x8'));var sox=require(_0xcc3f('0x9'));var csv=require(_0xcc3f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcc3f('0xb'));var crypto=require(_0xcc3f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcc3f('0xd'));var toCsv=require(_0xcc3f('0xa'));var querystring=require(_0xcc3f('0xe'));var Papa=require(_0xcc3f('0xf'));var Redis=require(_0xcc3f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcc3f('0x11'));var as=require(_0xcc3f('0x12'));var hardwareService=require(_0xcc3f('0x13'));var logger=require(_0xcc3f('0x14'))(_0xcc3f('0x15'));var utils=require(_0xcc3f('0x16'));var config=require(_0xcc3f('0x17'));var db=require(_0xcc3f('0x18'))['db'];config[_0xcc3f('0x19')]=_['defaults'](config[_0xcc3f('0x19')],{'host':_0xcc3f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc3f('0x19')]));require('./openchannelMessage.socket')[_0xcc3f('0x1b')](socket);var jayson=require(_0xcc3f('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xcc3f('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x4f1ce6,_0x5950cd,_0x5f501f){if(_0x5f501f){var _0x16a101=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16a101['test'](_0x5950cd)){return _0x4f1ce6;}else{throw new db['Sequelize'][(_0xcc3f('0x1e'))](_0xcc3f('0x1f'));}}else{return _0x4f1ce6;}}function respondWithRpcPromise(_0x12ec2b,_0x57af27,_0x454c83,_0x3fdd4b){return new BPromise(function(_0x40dcf7,_0x4209e3){var _0x1886f2=_0x3fdd4b||client;return _0x1886f2[_0xcc3f('0x20')](_0x12ec2b,_0x454c83)[_0xcc3f('0x21')](function(_0x1f899e){logger[_0xcc3f('0x22')](_0xcc3f('0x23'),_0x57af27,_0xcc3f('0x24'));logger[_0xcc3f('0x25')](_0xcc3f('0x26'),_0x57af27,_0xcc3f('0x24'),JSON[_0xcc3f('0x27')](_0x1f899e));if(_0x1f899e[_0xcc3f('0x28')]){if(_0x1f899e[_0xcc3f('0x28')]['code']===0x1f4){logger[_0xcc3f('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x57af27,_0x1f899e[_0xcc3f('0x28')][_0xcc3f('0x29')]);return _0x4209e3(_0x1f899e['error'][_0xcc3f('0x29')]);}logger[_0xcc3f('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x57af27,_0x1f899e[_0xcc3f('0x28')][_0xcc3f('0x29')]);return _0x40dcf7(_0x1f899e['error'][_0xcc3f('0x29')]);}else{logger[_0xcc3f('0x22')](_0xcc3f('0x23'),_0x57af27,_0xcc3f('0x24'));_0x40dcf7(_0x1f899e[_0xcc3f('0x2a')][_0xcc3f('0x29')]);}})[_0xcc3f('0x2b')](function(_0x3da7ed){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x57af27,_0x3da7ed);_0x4209e3(_0x3da7ed);});});}function respondWithStatusCode(_0x2b7039,_0x18862e){_0x18862e=_0x18862e||0xcc;return function(_0x298f7e){if(_0x298f7e){return _0x2b7039[_0xcc3f('0x2c')](_0x18862e);}return _0x2b7039[_0xcc3f('0x2d')](_0x18862e)[_0xcc3f('0x2e')]();};}function respondWithResult(_0x1a5a34,_0x2ed90e){_0x2ed90e=_0x2ed90e||0xc8;return function(_0x29a2d6){if(_0x29a2d6){return _0x1a5a34['status'](_0x2ed90e)[_0xcc3f('0x2f')](_0x29a2d6);}};}function respondWithFilteredResult(_0x4e6eb1,_0x3021d5){return function(_0x49c91a){if(_0x49c91a){var _0xcc8029=_0x49c91a[_0xcc3f('0x30')],_0x5b542c=_0x3021d5['offset'],_0x115456=_0x3021d5[_0xcc3f('0x31')]+_0x3021d5[_0xcc3f('0x32')],_0x42628e;if(_0x115456>=_0xcc8029){_0x115456=_0xcc8029;_0x42628e=0xc8;}else{_0x42628e=0xce;}_0x4e6eb1['status'](_0x42628e);return _0x4e6eb1[_0xcc3f('0x33')](_0xcc3f('0x34'),_0x5b542c+'-'+_0x115456+'/'+_0xcc8029)[_0xcc3f('0x2f')](_0x49c91a);}return null;};}function patchUpdates(_0xc1e97a){return function(_0x43e4b9){try{jsonpatch['apply'](_0x43e4b9,_0xc1e97a,!![]);}catch(_0x398581){return BPromise[_0xcc3f('0x35')](_0x398581);}return _0x43e4b9[_0xcc3f('0x36')]();};}function saveUpdates(_0x54e16e,_0x374629){return function(_0x4441a7){if(_0x4441a7){return _0x4441a7['update'](_0x54e16e)['then'](function(_0x30b668){return _0x30b668;});}return null;};}function removeEntity(_0x2ce792,_0x45a737){return function(_0x1ba8f5){if(_0x1ba8f5){return _0x1ba8f5[_0xcc3f('0x37')]()[_0xcc3f('0x21')](function(){_0x2ce792['status'](0xcc)[_0xcc3f('0x2e')]();});}};}function handleEntityNotFound(_0x6c6b71,_0x17c855){return function(_0x13c43a){if(!_0x13c43a){_0x6c6b71['sendStatus'](0x194);}return _0x13c43a;};}function handleError(_0x333b5c,_0x39ec3c){_0x39ec3c=_0x39ec3c||0x1f4;return function(_0x37a500){logger[_0xcc3f('0x28')](_0x37a500['stack']);if(_0x37a500[_0xcc3f('0x38')]){delete _0x37a500[_0xcc3f('0x38')];}_0x333b5c[_0xcc3f('0x2d')](_0x39ec3c)[_0xcc3f('0x39')](_0x37a500);};}exports[_0xcc3f('0x3a')]=function(_0x695365,_0x54bc08){var _0x221f78={},_0x46faf1={},_0x3abd1f={'count':0x0,'rows':[]};var _0x451781=_[_0xcc3f('0x3b')](db[_0xcc3f('0x3c')]['rawAttributes'],function(_0x5dd108){return{'name':_0x5dd108[_0xcc3f('0x3d')],'type':_0x5dd108['type'][_0xcc3f('0x3e')]};});_0x46faf1[_0xcc3f('0x3f')]=_['map'](_0x451781,_0xcc3f('0x38'));_0x46faf1[_0xcc3f('0x40')]=_['keys'](_0x695365[_0xcc3f('0x40')]);_0x46faf1[_0xcc3f('0x41')]=_[_0xcc3f('0x42')](_0x46faf1['model'],_0x46faf1[_0xcc3f('0x40')]);_0x221f78[_0xcc3f('0x43')]=_[_0xcc3f('0x42')](_0x46faf1['model'],qs[_0xcc3f('0x44')](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x44')]));_0x221f78[_0xcc3f('0x43')]=_0x221f78['attributes']['length']?_0x221f78[_0xcc3f('0x43')]:_0x46faf1[_0xcc3f('0x3f')];if(!_0x695365[_0xcc3f('0x40')][_0xcc3f('0x45')]('nolimit')){_0x221f78[_0xcc3f('0x32')]=qs[_0xcc3f('0x32')](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x32')]);_0x221f78[_0xcc3f('0x31')]=qs['offset'](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x31')]);}_0x221f78[_0xcc3f('0x46')]=qs[_0xcc3f('0x47')](_0x695365[_0xcc3f('0x40')][_0xcc3f('0x47')]);_0x221f78['where']=qs[_0xcc3f('0x41')](_[_0xcc3f('0x48')](_0x695365[_0xcc3f('0x40')],_0x46faf1[_0xcc3f('0x41')]),_0x451781);if(_0x695365[_0xcc3f('0x40')][_0xcc3f('0x49')]){_0x221f78['where']=_['merge'](_0x221f78[_0xcc3f('0x4a')],{'$or':_['map'](_0x451781,function(_0x54208f){if(_0x54208f[_0xcc3f('0x4b')]!==_0xcc3f('0x4c')){var _0x4bd7e0={};_0x4bd7e0[_0x54208f[_0xcc3f('0x38')]]={'$like':'%'+_0x695365[_0xcc3f('0x40')][_0xcc3f('0x49')]+'%'};return _0x4bd7e0;}})});}_0x221f78=_['merge']({},_0x221f78,_0x695365[_0xcc3f('0x4d')]);var _0x1176bc={'where':_0x221f78[_0xcc3f('0x4a')]};return db[_0xcc3f('0x3c')][_0xcc3f('0x30')](_0x1176bc)[_0xcc3f('0x21')](function(_0x136610){_0x3abd1f[_0xcc3f('0x30')]=_0x136610;if(_0x695365['query'][_0xcc3f('0x4e')]){_0x221f78[_0xcc3f('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcc3f('0x50')](_0x221f78);})['then'](function(_0x4ed351){_0x3abd1f['rows']=_0x4ed351;return _0x3abd1f;})[_0xcc3f('0x21')](respondWithFilteredResult(_0x54bc08,_0x221f78))[_0xcc3f('0x2b')](handleError(_0x54bc08,null));};exports[_0xcc3f('0x51')]=function(_0x1ff2e5,_0x4a797f){var _0xf12e83={'raw':!![],'where':{'id':_0x1ff2e5[_0xcc3f('0x52')]['id']}},_0x272b83={};_0x272b83['model']=_[_0xcc3f('0x53')](db[_0xcc3f('0x3c')][_0xcc3f('0x54')]);_0x272b83['query']=_[_0xcc3f('0x53')](_0x1ff2e5[_0xcc3f('0x40')]);_0x272b83['filters']=_['intersection'](_0x272b83['model'],_0x272b83[_0xcc3f('0x40')]);_0xf12e83[_0xcc3f('0x43')]=_[_0xcc3f('0x42')](_0x272b83[_0xcc3f('0x3f')],qs[_0xcc3f('0x44')](_0x1ff2e5[_0xcc3f('0x40')][_0xcc3f('0x44')]));_0xf12e83[_0xcc3f('0x43')]=_0xf12e83[_0xcc3f('0x43')][_0xcc3f('0x55')]?_0xf12e83[_0xcc3f('0x43')]:_0x272b83['model'];if(_0x1ff2e5[_0xcc3f('0x40')][_0xcc3f('0x4e')]){_0xf12e83[_0xcc3f('0x4f')]=[{'all':!![]}];}_0xf12e83=_['merge']({},_0xf12e83,_0x1ff2e5[_0xcc3f('0x4d')]);return db[_0xcc3f('0x3c')][_0xcc3f('0x56')](_0xf12e83)[_0xcc3f('0x21')](handleEntityNotFound(_0x4a797f,null))[_0xcc3f('0x21')](respondWithResult(_0x4a797f,null))[_0xcc3f('0x2b')](handleError(_0x4a797f,null));};exports[_0xcc3f('0x57')]=function(_0x510f1a,_0x242751){return db[_0xcc3f('0x3c')][_0xcc3f('0x57')](_0x510f1a[_0xcc3f('0x58')],{})[_0xcc3f('0x21')](respondWithResult(_0x242751,0xc9))[_0xcc3f('0x2b')](handleError(_0x242751,null));};exports[_0xcc3f('0x59')]=function(_0xe5715f,_0x490402){if(_0xe5715f['body']['id']){delete _0xe5715f[_0xcc3f('0x58')]['id'];}return db[_0xcc3f('0x3c')]['find']({'where':{'id':_0xe5715f[_0xcc3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x490402,null))['then'](saveUpdates(_0xe5715f[_0xcc3f('0x58')],null))[_0xcc3f('0x21')](respondWithResult(_0x490402,null))['catch'](handleError(_0x490402,null));};exports[_0xcc3f('0x37')]=function(_0x4fc6f6,_0x55cc11){return db[_0xcc3f('0x3c')]['find']({'where':{'id':_0x4fc6f6[_0xcc3f('0x52')]['id']}})[_0xcc3f('0x21')](handleEntityNotFound(_0x55cc11,null))[_0xcc3f('0x21')](removeEntity(_0x55cc11,null))[_0xcc3f('0x2b')](handleError(_0x55cc11,null));};exports[_0xcc3f('0x5a')]=function(_0xe4b102,_0x3f78a3){return db[_0xcc3f('0x3c')]['describe']()[_0xcc3f('0x21')](respondWithResult(_0x3f78a3,null))['catch'](handleError(_0x3f78a3,null));};var interaction_log=require(_0xcc3f('0x14'))(_0xcc3f('0x5b'));exports[_0xcc3f('0x5c')]=function(_0x125b13,_0x24307d,_0x5c7887){var _0x3f4f8d={'channel':_0xcc3f('0x5d')};if(_0x125b13[_0xcc3f('0x58')]['id']){delete _0x125b13['body']['id'];}_0x125b13['body'][_0xcc3f('0x5e')]=!![];_0x125b13[_0xcc3f('0x58')][_0xcc3f('0x5f')]=moment()[_0xcc3f('0x60')](_0xcc3f('0x61'));_0x125b13[_0xcc3f('0x58')][_0xcc3f('0x62')]=_0x125b13['body']['UserId']||_0x125b13[_0xcc3f('0x63')]['id'];return db[_0xcc3f('0x3c')][_0xcc3f('0x56')]({'where':{'id':_0x125b13[_0xcc3f('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xcc3f('0x64')}]})['then'](handleEntityNotFound(_0x24307d,null))[_0xcc3f('0x21')](saveUpdates(_0x125b13[_0xcc3f('0x58')],null))['then'](function(_0xce6594){if(_0xce6594){_0x3f4f8d[_0xcc3f('0x29')]=_0xce6594[_0xcc3f('0x65')]({'plain':!![]});return db[_0xcc3f('0x66')][_0xcc3f('0x56')]({'where':{'id':_0xce6594[_0xcc3f('0x67')]}});}return null;})[_0xcc3f('0x21')](handleEntityNotFound(_0x24307d,null))[_0xcc3f('0x21')](function(_0x1ae44e){if(_0x1ae44e){return _0x1ae44e[_0xcc3f('0x59')]({'UserId':_0x125b13[_0xcc3f('0x58')]['UserId'],'read1stAt':_[_0xcc3f('0x68')](_0x1ae44e[_0xcc3f('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x26c854){if(_0x26c854){_0x3f4f8d[_0xcc3f('0x6a')]=_0x26c854['get']({'plain':!![]});interaction_log[_0xcc3f('0x22')](_0xcc3f('0x6b'),_0x125b13[_0xcc3f('0x63')]['id'],_0x125b13[_0xcc3f('0x63')][_0xcc3f('0x38')],_0x125b13['user'][_0xcc3f('0x6c')],_0x3f4f8d[_0xcc3f('0x6a')]['id'],_0x125b13[_0xcc3f('0x58')]?JSON['stringify'](_0x125b13[_0xcc3f('0x58')]):_0xcc3f('0x6d'));return respondWithRpcPromise(_0xcc3f('0x6e'),_0xcc3f('0x6f'),_0x3f4f8d);}return null;})['then'](function(_0xcf436a){if(_0xcf436a){if(_0x125b13['body'][_0xcc3f('0x70')]){_0x3f4f8d[_0xcc3f('0x29')][_0xcc3f('0x71')]=util['format'](_0xcc3f('0x72'),_0x125b13[_0xcc3f('0x63')][_0xcc3f('0x38')]);_0x3f4f8d['message']['channel']=_0x3f4f8d[_0xcc3f('0x73')];_0x3f4f8d[_0xcc3f('0x29')]['event']=_0xcc3f('0x5c');return respondWithRpcPromise('EventManager',_0xcc3f('0x74'),{'event':_0xcc3f('0x75'),'message':_0x3f4f8d['message']},client9002)[_0xcc3f('0x21')](function(){return _0x3f4f8d;});}return _0x3f4f8d;}return null;})[_0xcc3f('0x21')](respondWithResult(_0x24307d,null))[_0xcc3f('0x2b')](handleError(_0x24307d,null));};var interaction_log=require('../../config/logger')(_0xcc3f('0x5b'));exports['reject']=function(_0x419eb9,_0x378680,_0x1d073f){var _0x604924={'agent':{},'channel':'openchannel'};if(_0x419eb9[_0xcc3f('0x58')]['id']){delete _0x419eb9['body']['id'];}_0x419eb9[_0xcc3f('0x58')][_0xcc3f('0x62')]=_0x419eb9[_0xcc3f('0x58')]['UserId']||_0x419eb9[_0xcc3f('0x63')]['id'];_0x604924[_0xcc3f('0x76')]['id']=_0x419eb9[_0xcc3f('0x58')]['UserId'];return db['OpenchannelMessage'][_0xcc3f('0x56')]({'where':{'id':_0x419eb9[_0xcc3f('0x52')]['id'],'UserId':null}})[_0xcc3f('0x21')](handleEntityNotFound(_0x378680,null))['then'](function(_0xbbf5ab){if(_0xbbf5ab){_0x604924[_0xcc3f('0x29')]=_0xbbf5ab[_0xcc3f('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcc3f('0x56')]({'where':{'id':_0xbbf5ab['OpenchannelInteractionId']}});}return null;})[_0xcc3f('0x21')](handleEntityNotFound(_0x378680,null))[_0xcc3f('0x21')](function(_0x7452ea){if(_0x7452ea){_0x604924['interaction']=_0x7452ea['get']({'plain':!![]});interaction_log['info'](_0xcc3f('0x77'),_0x419eb9[_0xcc3f('0x63')]['id'],_0x419eb9[_0xcc3f('0x63')]['name'],_0x419eb9[_0xcc3f('0x63')][_0xcc3f('0x6c')],_0x604924[_0xcc3f('0x6a')]['id'],_0x419eb9[_0xcc3f('0x58')]?JSON[_0xcc3f('0x27')](_0x419eb9[_0xcc3f('0x58')]):_0xcc3f('0x6d'));return respondWithRpcPromise(_0xcc3f('0x78'),_0xcc3f('0x79'),_0x604924);}return null;})['then'](function(_0x3783a1){if(_0x3783a1){_0x3783a1['message'][_0xcc3f('0x71')]=util['format']('SIP/%s',_0x419eb9[_0xcc3f('0x63')][_0xcc3f('0x38')]);_0x3783a1[_0xcc3f('0x29')][_0xcc3f('0x73')]=_0x604924['channel'];_0x3783a1[_0xcc3f('0x29')][_0xcc3f('0x7a')]=_0xcc3f('0x35');respondWithRpcPromise(_0xcc3f('0x74'),_0xcc3f('0x74'),{'event':_0xcc3f('0x7b'),'message':_0x3783a1['message']},client9002);return _0x604924;}return null;})['then'](respondWithResult(_0x378680,null))[_0xcc3f('0x2b')](handleError(_0x378680,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5be1972..9e60911 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 _0xd26c=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4206f5,_0x21f338){var _0xa29cf3=function(_0x2d35d7){while(--_0x2d35d7){_0x4206f5['push'](_0x4206f5['shift']());}};_0xa29cf3(++_0x21f338);}(_0xd26c,0x91));var _0xcd26=function(_0x14d801,_0x4d340b){_0x14d801=_0x14d801-0x0;var _0x2ae468=_0xd26c[_0x14d801];return _0x2ae468;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xcd26('0x0'))['db'][_0xcd26('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcd26('0x2')](0x0);var events={'afterCreate':_0xcd26('0x3'),'afterUpdate':_0xcd26('0x4'),'afterDestroy':'remove'};function emitEvent(_0x57fbe9){return function(_0x393b99,_0x18e180,_0x3e32cb){OpenchannelMessageEvents[_0xcd26('0x5')](_0x57fbe9+':'+_0x393b99['id'],_0x393b99);OpenchannelMessageEvents[_0xcd26('0x5')](_0x57fbe9,_0x393b99);_0x3e32cb(null);};}for(var e in events){if(events[_0xcd26('0x6')](e)){var event=events[e];OpenchannelMessage[_0xcd26('0x7')](e,emitEvent(event));}}module[_0xcd26('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x19bb=['../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x19bb,0x1d8));var _0xb19b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x19bb[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb19b('0x0'))['db'][_0xb19b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb19b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb19b('0x3'),'afterDestroy':_0xb19b('0x4')};function emitEvent(_0x57cc6a){return function(_0x46022e,_0x4cb517,_0x2834ff){OpenchannelMessageEvents[_0xb19b('0x5')](_0x57cc6a+':'+_0x46022e['id'],_0x46022e);OpenchannelMessageEvents['emit'](_0x57cc6a,_0x46022e);_0x2834ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xb19b('0x6')](e,emitEvent(event));}}module[_0xb19b('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index af39586..53d1244 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 _0x158f=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','error','then','OpenchannelAccount','OpenchannelAccountId','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','Contact','POST','GET'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x158f,0x137));var _0xf158=function(_0xcbf198,_0x17c7df){_0xcbf198=_0xcbf198-0x0;var _0x339705=_0x158f[_0xcbf198];return _0x339705;};'use strict';var _=require('lodash');var util=require(_0xf158('0x0'));var logger=require(_0xf158('0x1'))(_0xf158('0x2'));var moment=require(_0xf158('0x3'));var BPromise=require(_0xf158('0x4'));var rp=require(_0xf158('0x5'));var fs=require('fs');var path=require(_0xf158('0x6'));var rimraf=require('rimraf');var config=require(_0xf158('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xf158('0x8')]=function(_0xb84ee0,_0x178e85){return _0xb84ee0[_0xf158('0x9')](_0xf158('0xa'),attributes,{'tableName':_0xf158('0xb'),'paranoid':![],'indexes':[{'name':_0xf158('0xc'),'fields':[_0xf158('0xd')],'type':_0xf158('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35554e,_0x2a17df,_0x1482d6){var _0x5c232c=_0xb84ee0[_0xf158('0xf')];var _0x421b24=_0x35554e[_0xf158('0x10')]({'plain':!![]});if(_0x421b24[_0xf158('0x11')]['toLowerCase']()==='in'||_0x421b24[_0xf158('0x11')][_0xf158('0x12')]()===_0xf158('0x13')&&!_0x421b24[_0xf158('0x14')]&&!_[_0xf158('0x15')](_0x421b24[_0xf158('0x16')])){_0x5c232c[_0xf158('0x17')]['findOne']({'where':{'id':_0x421b24[_0xf158('0x18')]}})['then'](function(_0x16ae70){if(_0x16ae70){_0x16ae70[_0xf158('0x19')]({'lastMsgAt':_0x421b24[_0xf158('0x1a')],'lastMsgDirection':_0x421b24[_0xf158('0x11')][_0xf158('0x12')]()});}})['catch'](function(_0x34431b){console[_0xf158('0x1b')](_0x34431b);});}if(_0x421b24[_0xf158('0x11')]==='out'&&!_0x421b24[_0xf158('0x14')]){var _0x3bfdf1;_0x5c232c['CmContact']['describe']()[_0xf158('0x1c')](function(_0x15fffe){return _0x5c232c[_0xf158('0x1d')]['find']({'where':{'id':_0x421b24[_0xf158('0x1e')]},'include':[{'model':_0x5c232c['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x421b24[_0xf158('0x18')]},'limit':0x1,'include':[{'model':_0x5c232c[_0xf158('0x1f')],'as':'Contact','attributes':_[_0xf158('0x20')](_0x15fffe)}]}]});})['then'](function(_0xbf88c9){_0x3bfdf1=_0xbf88c9[_0xf158('0x10')]({'plain':!![]});if(_0x3bfdf1&&_0x3bfdf1[_0xf158('0x21')]){logger[_0xf158('0x22')](_0xf158('0x23'),_0xf158('0x24'),util[_0xf158('0x25')](_0xf158('0x26'),_0x421b24['id'],_0x3bfdf1[_0xf158('0x21')]));if(_0x3bfdf1[_0xf158('0x27')]&&_0x3bfdf1[_0xf158('0x27')][_0xf158('0x28')]){_0x421b24[_0xf158('0x29')]=_[_0xf158('0x2a')](_0x3bfdf1[_0xf158('0x27')][0x0],_0xf158('0x2b'));_0x421b24['Contact']=_0x3bfdf1[_0xf158('0x27')][0x0]['Contact'];}var _0x2a17df={'method':_0xf158('0x2c'),'uri':encodeURI(_0x3bfdf1[_0xf158('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2a17df['method']){case _0xf158('0x2d'):_0x2a17df['qs']=_0x421b24;break;case _0xf158('0x2c'):_0x2a17df[_0xf158('0xd')]=_0x421b24;break;}return rp(_0x2a17df)[_0xf158('0x1c')](function(_0x438bb4){logger[_0xf158('0x22')](_0xf158('0x23'),'afterCreate',util[_0xf158('0x25')](_0xf158('0x2e'),_0x421b24['id'],_0x3bfdf1['replyUri']));if(_0x438bb4[_0xf158('0xd')][_0xf158('0x2f')]&&_0x438bb4[_0xf158('0xd')]['threadId']!=_0x421b24[_0xf158('0x29')][_0xf158('0x2f')]){return _0x5c232c[_0xf158('0x17')][_0xf158('0x19')]({'threadId':_0x438bb4[_0xf158('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x421b24[_0xf158('0x29')]['id']}});}else{return;}})[_0xf158('0x1c')](function(){return _0x35554e[_0xf158('0x19')]({'read':!![]});})[_0xf158('0x30')](function(_0x505dd3){logger[_0xf158('0x1b')](_0xf158('0x23'),'afterCreate',util[_0xf158('0x31')](_0x505dd3,{'showHidden':![],'depth':null}));_0x1482d6();});}else{_0x1482d6();}})['finally'](function(){_0x1482d6();});}else{_0x1482d6();}}},'charset':_0xf158('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4986=['method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','update','createdAt','direction','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Interactions'];(function(_0x32df3f,_0x32976f){var _0x4b9d2f=function(_0x2e38ff){while(--_0x2e38ff){_0x32df3f['push'](_0x32df3f['shift']());}};_0x4b9d2f(++_0x32976f);}(_0x4986,0x6e));var _0x6498=function(_0x10a38c,_0x12a90){_0x10a38c=_0x10a38c-0x0;var _0x4cea26=_0x4986[_0x10a38c];return _0x4cea26;};'use strict';var _=require(_0x6498('0x0'));var util=require(_0x6498('0x1'));var logger=require(_0x6498('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6498('0x3'));var rp=require(_0x6498('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6498('0x5'));var config=require(_0x6498('0x6'));var attributes=require(_0x6498('0x7'));module[_0x6498('0x8')]=function(_0x117a31,_0x8d1853){return _0x117a31[_0x6498('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6498('0xa'),'fields':[_0x6498('0xb')],'type':_0x6498('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x465333,_0x1c590e,_0x5f14e4){var _0x3edea9=_0x117a31[_0x6498('0xd')];var _0x3fe456=_0x465333['get']({'plain':!![]});if(_0x3fe456['direction'][_0x6498('0xe')]()==='in'||_0x3fe456['direction'][_0x6498('0xe')]()===_0x6498('0xf')&&!_0x3fe456[_0x6498('0x10')]&&!_[_0x6498('0x11')](_0x3fe456[_0x6498('0x12')])){_0x3edea9[_0x6498('0x13')][_0x6498('0x14')]({'where':{'id':_0x3fe456['OpenchannelInteractionId']}})['then'](function(_0x4769ab){if(_0x4769ab){_0x4769ab[_0x6498('0x15')]({'lastMsgAt':_0x3fe456[_0x6498('0x16')],'lastMsgDirection':_0x3fe456[_0x6498('0x17')][_0x6498('0xe')]()});}})['catch'](function(_0x318b75){console[_0x6498('0x18')](_0x318b75);});}if(_0x3fe456[_0x6498('0x17')]===_0x6498('0xf')&&!_0x3fe456[_0x6498('0x10')]){var _0x1b4083;_0x3edea9[_0x6498('0x19')]['describe']()[_0x6498('0x1a')](function(_0x8b41fe){return _0x3edea9[_0x6498('0x1b')][_0x6498('0x1c')]({'where':{'id':_0x3fe456[_0x6498('0x1d')]},'include':[{'model':_0x3edea9['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x3fe456[_0x6498('0x1e')]},'limit':0x1,'include':[{'model':_0x3edea9[_0x6498('0x19')],'as':_0x6498('0x1f'),'attributes':_[_0x6498('0x20')](_0x8b41fe)}]}]});})[_0x6498('0x1a')](function(_0x46c830){_0x1b4083=_0x46c830[_0x6498('0x21')]({'plain':!![]});if(_0x1b4083&&_0x1b4083[_0x6498('0x22')]){logger[_0x6498('0x23')](_0x6498('0x24'),_0x6498('0x25'),util[_0x6498('0x26')](_0x6498('0x27'),_0x3fe456['id'],_0x1b4083[_0x6498('0x22')]));if(_0x1b4083['Interactions']&&_0x1b4083['Interactions'][_0x6498('0x28')]){_0x3fe456['Interaction']=_[_0x6498('0x29')](_0x1b4083[_0x6498('0x2a')][0x0],_0x6498('0x1f'));_0x3fe456[_0x6498('0x1f')]=_0x1b4083['Interactions'][0x0]['Contact'];}var _0x1c590e={'method':'POST','uri':encodeURI(_0x1b4083[_0x6498('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c590e[_0x6498('0x2b')]){case _0x6498('0x2c'):_0x1c590e['qs']=_0x3fe456;break;case _0x6498('0x2d'):_0x1c590e[_0x6498('0xb')]=_0x3fe456;break;}return rp(_0x1c590e)[_0x6498('0x1a')](function(_0x1bb97c){logger[_0x6498('0x23')](_0x6498('0x24'),_0x6498('0x25'),util[_0x6498('0x26')](_0x6498('0x2e'),_0x3fe456['id'],_0x1b4083[_0x6498('0x22')]));if(_0x1bb97c['body'][_0x6498('0x2f')]&&_0x1bb97c[_0x6498('0xb')]['threadId']!=_0x3fe456['Interaction']['threadId']){return _0x3edea9['OpenchannelInteraction'][_0x6498('0x15')]({'threadId':_0x1bb97c[_0x6498('0xb')][_0x6498('0x2f')]},{'logging':!![],'where':{'id':_0x3fe456[_0x6498('0x30')]['id']}});}else{return;}})['then'](function(){return _0x465333[_0x6498('0x15')]({'read':!![]});})['catch'](function(_0x4ef1bf){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x6498('0x25'),util[_0x6498('0x31')](_0x4ef1bf,{'showHidden':![],'depth':null}));_0x5f14e4();});}else{_0x5f14e4();}})['finally'](function(){_0x5f14e4();});}else{_0x5f14e4();}}},'charset':_0x6498('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7bff105..1e002f9 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 _0xffd6=['./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelMessage','create','options','raw','debug','CreateOpenchannelMessage','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x2b6cb8,_0x8baac3){var _0x2e691d=function(_0xe6bc73){while(--_0xe6bc73){_0x2b6cb8['push'](_0x2b6cb8['shift']());}};_0x2e691d(++_0x8baac3);}(_0xffd6,0x97));var _0x6ffd=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xffd6[_0x215e65];return _0xa85842;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});}exports['CreateOpenchannelMessage']=function(_0x34c3c1){var _0x4612a3=this;return new Promise(function(_0x4eeaa2,_0x564a11){return db[_0x6ffd('0x1a')][_0x6ffd('0x1b')](_0x34c3c1['body'],{'raw':_0x34c3c1[_0x6ffd('0x1c')]?_0x34c3c1[_0x6ffd('0x1c')][_0x6ffd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3ba429){logger[_0x6ffd('0x19')]('CreateOpenchannelMessage',_0x34c3c1);logger[_0x6ffd('0x1e')](_0x6ffd('0x1f'),_0x34c3c1,JSON['stringify'](_0x3ba429));_0x4eeaa2(_0x3ba429);})[_0x6ffd('0x20')](function(_0x35ef16){logger[_0x6ffd('0x16')]('CreateOpenchannelMessage',_0x35ef16[_0x6ffd('0x18')],_0x34c3c1);_0x564a11(_0x4612a3[_0x6ffd('0x16')](0x1f4,_0x35ef16[_0x6ffd('0x18')]));});});}; \ No newline at end of file +var _0x09d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','catch','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x09d2,0x1d2));var _0x209d=function(_0x756a4b,_0x52d392){_0x756a4b=_0x756a4b-0x0;var _0x3a272d=_0x09d2[_0x756a4b];return _0x3a272d;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var moment=require(_0x209d('0x2'));var BPromise=require(_0x209d('0x3'));var rs=require(_0x209d('0x4'));var fs=require('fs');var Redis=require(_0x209d('0x5'));var db=require(_0x209d('0x6'))['db'];var utils=require(_0x209d('0x7'));var logger=require(_0x209d('0x8'))(_0x209d('0x9'));var config=require('../../config/environment');var jayson=require(_0x209d('0xa'));var client=jayson[_0x209d('0xb')][_0x209d('0xc')]({'port':0x232a});config[_0x209d('0xd')]=_[_0x209d('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x209d('0xf'))(new Redis(config[_0x209d('0xd')]));require(_0x209d('0x10'))['register'](socket);function respondWithRpcPromise(_0x6b5375,_0x580742,_0x33caba){return new BPromise(function(_0x446eb0,_0x3ee1eb){return client[_0x209d('0x11')](_0x6b5375,_0x33caba)[_0x209d('0x12')](function(_0x30052a){logger[_0x209d('0x13')](_0x209d('0x14'),_0x580742,_0x209d('0x15'));logger[_0x209d('0x16')](_0x209d('0x17'),_0x580742,_0x209d('0x15'),JSON['stringify'](_0x30052a));if(_0x30052a[_0x209d('0x18')]){if(_0x30052a[_0x209d('0x18')][_0x209d('0x19')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x580742,_0x30052a[_0x209d('0x18')]['message']);return _0x3ee1eb(_0x30052a['error'][_0x209d('0x1a')]);}logger[_0x209d('0x18')](_0x209d('0x14'),_0x580742,_0x30052a['error'][_0x209d('0x1a')]);return _0x446eb0(_0x30052a[_0x209d('0x18')][_0x209d('0x1a')]);}else{logger[_0x209d('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x580742,_0x209d('0x15'));_0x446eb0(_0x30052a[_0x209d('0x1b')][_0x209d('0x1a')]);}})['catch'](function(_0x47daf8){logger[_0x209d('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x580742,_0x47daf8);_0x3ee1eb(_0x47daf8);});});}exports[_0x209d('0x1c')]=function(_0x3c139e){var _0xa72210=this;return new Promise(function(_0x1eec9f,_0x3d8854){return db[_0x209d('0x1d')][_0x209d('0x1e')](_0x3c139e[_0x209d('0x1f')],{'raw':_0x3c139e[_0x209d('0x20')]?_0x3c139e[_0x209d('0x20')][_0x209d('0x21')]===undefined?!![]:![]:!![]})[_0x209d('0x12')](function(_0x61a720){logger[_0x209d('0x13')](_0x209d('0x1c'),_0x3c139e);logger[_0x209d('0x16')](_0x209d('0x1c'),_0x3c139e,JSON[_0x209d('0x22')](_0x61a720));_0x1eec9f(_0x61a720);})[_0x209d('0x23')](function(_0x183767){logger[_0x209d('0x18')]('CreateOpenchannelMessage',_0x183767[_0x209d('0x1a')],_0x3c139e);_0x3d8854(_0xa72210[_0x209d('0x18')](0x1f4,_0x183767['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cb727b6..dd837a2 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(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1a9390,_0x3339e6){_0x1a9390=_0x1a9390-0x0;var _0x2b4514=_0xbdb7[_0x1a9390];return _0x2b4514;};'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 _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x87021e,_0x4b0232){_0x87021e=_0x87021e-0x0;var _0x26b66e=_0x9bde[_0x87021e];return _0x26b66e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 27ed228..fd6324e 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 _0xf9d5=['./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','removeTeams','removeAgents','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c730a,_0x17de0e){var _0x483cbb=function(_0x35cea0){while(--_0x35cea0){_0x2c730a['push'](_0x2c730a['shift']());}};_0x483cbb(++_0x17de0e);}(_0xf9d5,0x122));var _0x5f9d=function(_0x4a468e,_0x4ca999){_0x4a468e=_0x4a468e-0x0;var _0x128c98=_0xf9d5[_0x4a468e];return _0x128c98;};'use strict';var multer=require('multer');var util=require(_0x5f9d('0x0'));var path=require(_0x5f9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f9d('0x2'));var router=express[_0x5f9d('0x3')]();var auth=require(_0x5f9d('0x4'));var interaction=require(_0x5f9d('0x5'));var config=require(_0x5f9d('0x6'));var controller=require(_0x5f9d('0x7'));router[_0x5f9d('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f9d('0x9')]);router['get'](_0x5f9d('0xa'),auth[_0x5f9d('0xb')](),controller['describe']);router[_0x5f9d('0x8')](_0x5f9d('0xc'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0xd')]);router[_0x5f9d('0x8')](_0x5f9d('0xe'),auth['isAuthenticated'](),controller[_0x5f9d('0xf')]);router[_0x5f9d('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5f9d('0x10')]);router[_0x5f9d('0x8')](_0x5f9d('0x11'),auth['isAuthenticated'](),controller[_0x5f9d('0x12')]);router[_0x5f9d('0x13')]('/',auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x14')]);router['post'](_0x5f9d('0x15'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x16')]);router['post'](_0x5f9d('0x11'),auth[_0x5f9d('0xb')](),controller['addAgents']);router['put'](_0x5f9d('0xc'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x17')]);router[_0x5f9d('0x18')](_0x5f9d('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x5f9d('0x15'),auth['isAuthenticated'](),controller[_0x5f9d('0x19')]);router['delete'](_0x5f9d('0x11'),auth[_0x5f9d('0xb')](),controller[_0x5f9d('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb491=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents'];(function(_0x5d3276,_0xd38063){var _0x3562f5=function(_0x5c5594){while(--_0x5c5594){_0x5d3276['push'](_0x5d3276['shift']());}};_0x3562f5(++_0xd38063);}(_0xb491,0x18c));var _0x1b49=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xb491[_0x148879];return _0x4f7027;};'use strict';var multer=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var path=require(_0x1b49('0x2'));var timeout=require(_0x1b49('0x3'));var express=require(_0x1b49('0x4'));var router=express[_0x1b49('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b49('0x6'));var config=require(_0x1b49('0x7'));var controller=require('./openchannelQueue.controller');router[_0x1b49('0x8')]('/',auth[_0x1b49('0x9')](),controller[_0x1b49('0xa')]);router['get'](_0x1b49('0xb'),auth['isAuthenticated'](),controller[_0x1b49('0xc')]);router[_0x1b49('0x8')](_0x1b49('0xd'),auth[_0x1b49('0x9')](),controller[_0x1b49('0xe')]);router[_0x1b49('0x8')](_0x1b49('0xf'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x10')]);router[_0x1b49('0x8')](_0x1b49('0x11'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x12')]);router[_0x1b49('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x1b49('0x13')]);router[_0x1b49('0x14')]('/',auth[_0x1b49('0x9')](),controller[_0x1b49('0x15')]);router[_0x1b49('0x14')]('/:id/teams',auth[_0x1b49('0x9')](),controller['addTeams']);router[_0x1b49('0x14')](_0x1b49('0x16'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x17')]);router['put'](_0x1b49('0xd'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x18')]);router[_0x1b49('0x19')](_0x1b49('0xd'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x1a')]);router[_0x1b49('0x19')]('/:id/teams',auth[_0x1b49('0x9')](),controller[_0x1b49('0x1b')]);router['delete'](_0x1b49('0x16'),auth[_0x1b49('0x9')](),controller[_0x1b49('0x1c')]);module[_0x1b49('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a63a6f0..fe02a81 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 _0xd603=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0xd603,0x103));var _0x3d60=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xd603[_0x2d4421];return _0x2d3b01;};'use strict';var Sequelize=require(_0x3d60('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d60('0x1')],'unique':_0x3d60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3d60('0x1')]},'timeout':{'type':Sequelize[_0x3d60('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3d60('0x4')](_0x3d60('0x5'),'beepall',_0x3d60('0x6'))}}; \ No newline at end of file +var _0xe511=['exports','STRING','INTEGER','rrmemory','beepall','sequelize'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xe511,0x143));var _0x1e51=function(_0x2eedb5,_0x2e1801){_0x2eedb5=_0x2eedb5-0x0;var _0x534cd6=_0xe511[_0x2eedb5];return _0x534cd6;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize[_0x1e51('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1e51('0x2')]},'timeout':{'type':Sequelize[_0x1e51('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1e51('0x4'),_0x1e51('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 332fa62..0454107 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 _0x7583=['bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x1c394f,_0x29ee09){var _0x3201ec=function(_0x1f6f8a){while(--_0x1f6f8a){_0x1c394f['push'](_0x1c394f['shift']());}};_0x3201ec(++_0x29ee09);}(_0x7583,0x10b));var _0x3758=function(_0xeb6f8d,_0x1138f1){_0xeb6f8d=_0xeb6f8d-0x0;var _0x41f045=_0x7583[_0xeb6f8d];return _0x41f045;};'use strict';var pdf=require(_0x3758('0x0'));var emlformat=require(_0x3758('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3758('0x2'));var rp=require(_0x3758('0x3'));var moment=require(_0x3758('0x4'));var BPromise=require(_0x3758('0x5'));var Mustache=require(_0x3758('0x6'));var util=require(_0x3758('0x7'));var path=require(_0x3758('0x8'));var sox=require('sox');var csv=require(_0x3758('0x9'));var ejs=require(_0x3758('0xa'));var fs=require('fs');var _=require(_0x3758('0xb'));var squel=require(_0x3758('0xc'));var crypto=require(_0x3758('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3758('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3758('0xf'));var qs=require(_0x3758('0x10'));var as=require(_0x3758('0x11'));var hardwareService=require(_0x3758('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3758('0x13'));var config=require(_0x3758('0x14'));var db=require(_0x3758('0x15'))['db'];config[_0x3758('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x3758('0x17')](socket);function respondWithStatusCode(_0x40a978,_0x48fa1d){_0x48fa1d=_0x48fa1d||0xcc;return function(_0x5846eb){if(_0x5846eb){return _0x40a978[_0x3758('0x18')](_0x48fa1d);}return _0x40a978[_0x3758('0x19')](_0x48fa1d)[_0x3758('0x1a')]();};}function respondWithResult(_0x22151e,_0x461137){_0x461137=_0x461137||0xc8;return function(_0x23319d){if(_0x23319d){return _0x22151e[_0x3758('0x19')](_0x461137)[_0x3758('0x1b')](_0x23319d);}};}function respondWithFilteredResult(_0x43257e,_0x489fbb){return function(_0x5d686b){if(_0x5d686b){var _0x13dcbf=_0x5d686b[_0x3758('0x1c')],_0x42a513=_0x489fbb[_0x3758('0x1d')],_0x1da660=_0x489fbb[_0x3758('0x1d')]+_0x489fbb[_0x3758('0x1e')],_0x3a72a2;if(_0x1da660>=_0x13dcbf){_0x1da660=_0x13dcbf;_0x3a72a2=0xc8;}else{_0x3a72a2=0xce;}_0x43257e[_0x3758('0x19')](_0x3a72a2);return _0x43257e['set']('Content-Range',_0x42a513+'-'+_0x1da660+'/'+_0x13dcbf)[_0x3758('0x1b')](_0x5d686b);}return null;};}function patchUpdates(_0x1f00a2){return function(_0x1b1a7d){try{jsonpatch[_0x3758('0x1f')](_0x1b1a7d,_0x1f00a2,!![]);}catch(_0x4821a0){return BPromise[_0x3758('0x20')](_0x4821a0);}return _0x1b1a7d[_0x3758('0x21')]();};}function saveUpdates(_0x3bb2fa,_0x527a4f){return function(_0x32f13c){if(_0x32f13c){return _0x32f13c[_0x3758('0x22')](_0x3bb2fa)[_0x3758('0x23')](function(_0x2a65f0){return _0x2a65f0;});}return null;};}function removeEntity(_0x34c9c8,_0x3c27fe){return function(_0x4edc1f){if(_0x4edc1f){return _0x4edc1f[_0x3758('0x24')]()[_0x3758('0x23')](function(){var _0x5a58e5=_0x4edc1f[_0x3758('0x25')]({'plain':!![]});var _0x2988cd=_0x3758('0x26');return db[_0x3758('0x27')][_0x3758('0x24')]({'where':{'type':_0x2988cd,'resourceId':_0x5a58e5['id']}})[_0x3758('0x23')](function(){return _0x4edc1f;});})[_0x3758('0x23')](function(){_0x34c9c8[_0x3758('0x19')](0xcc)[_0x3758('0x1a')]();});}};}function handleEntityNotFound(_0x5bc094,_0x5b9378){return function(_0x38aca3){if(!_0x38aca3){_0x5bc094[_0x3758('0x18')](0x194);}return _0x38aca3;};}function handleError(_0x111baa,_0x254000){_0x254000=_0x254000||0x1f4;return function(_0x94ab9f){logger[_0x3758('0x28')](_0x94ab9f['stack']);if(_0x94ab9f[_0x3758('0x29')]){delete _0x94ab9f[_0x3758('0x29')];}_0x111baa['status'](_0x254000)[_0x3758('0x2a')](_0x94ab9f);};}exports[_0x3758('0x2b')]=function(_0x326567,_0x1111f6){var _0x2eae18={},_0x491ced={},_0x505958={'count':0x0,'rows':[]};var _0x4c680a=_[_0x3758('0x2c')](db[_0x3758('0x2d')][_0x3758('0x2e')],function(_0x43f74b){return{'name':_0x43f74b[_0x3758('0x2f')],'type':_0x43f74b['type'][_0x3758('0x30')]};});_0x491ced['model']=_[_0x3758('0x2c')](_0x4c680a,_0x3758('0x29'));_0x491ced[_0x3758('0x31')]=_['keys'](_0x326567[_0x3758('0x31')]);_0x491ced[_0x3758('0x32')]=_['intersection'](_0x491ced[_0x3758('0x33')],_0x491ced[_0x3758('0x31')]);_0x2eae18[_0x3758('0x34')]=_['intersection'](_0x491ced[_0x3758('0x33')],qs[_0x3758('0x35')](_0x326567[_0x3758('0x31')][_0x3758('0x35')]));_0x2eae18['attributes']=_0x2eae18[_0x3758('0x34')][_0x3758('0x36')]?_0x2eae18[_0x3758('0x34')]:_0x491ced[_0x3758('0x33')];if(!_0x326567[_0x3758('0x31')][_0x3758('0x37')](_0x3758('0x38'))){_0x2eae18['limit']=qs[_0x3758('0x1e')](_0x326567[_0x3758('0x31')][_0x3758('0x1e')]);_0x2eae18[_0x3758('0x1d')]=qs['offset'](_0x326567[_0x3758('0x31')][_0x3758('0x1d')]);}_0x2eae18['order']=qs[_0x3758('0x39')](_0x326567[_0x3758('0x31')][_0x3758('0x39')]);_0x2eae18[_0x3758('0x3a')]=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0x326567[_0x3758('0x31')],_0x491ced[_0x3758('0x32')]),_0x4c680a);if(_0x326567[_0x3758('0x31')][_0x3758('0x3c')]){_0x2eae18[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x2eae18[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x4c680a,function(_0xdd7815){if(_0xdd7815[_0x3758('0x3e')]!=='VIRTUAL'){var _0x137762={};_0x137762[_0xdd7815[_0x3758('0x29')]]={'$like':'%'+_0x326567[_0x3758('0x31')][_0x3758('0x3c')]+'%'};return _0x137762;}})});}_0x2eae18=_[_0x3758('0x3d')]({},_0x2eae18,_0x326567[_0x3758('0x3f')]);var _0x4e5438={'where':_0x2eae18[_0x3758('0x3a')]};return db[_0x3758('0x2d')][_0x3758('0x1c')](_0x4e5438)[_0x3758('0x23')](function(_0x1aaeaa){_0x505958[_0x3758('0x1c')]=_0x1aaeaa;if(_0x326567[_0x3758('0x31')][_0x3758('0x40')]){_0x2eae18[_0x3758('0x41')]=[{'all':!![]}];}return db[_0x3758('0x2d')][_0x3758('0x42')](_0x2eae18);})[_0x3758('0x23')](function(_0x41e6a9){_0x505958[_0x3758('0x43')]=_0x41e6a9;return _0x505958;})[_0x3758('0x23')](respondWithFilteredResult(_0x1111f6,_0x2eae18))[_0x3758('0x44')](handleError(_0x1111f6,null));};exports[_0x3758('0x45')]=function(_0xb04e3a,_0x44d5be){var _0xaccc67={'raw':!![],'where':{'id':_0xb04e3a[_0x3758('0x46')]['id']}},_0x3b90ab={};_0x3b90ab['model']=_[_0x3758('0x47')](db[_0x3758('0x2d')][_0x3758('0x2e')]);_0x3b90ab[_0x3758('0x31')]=_['keys'](_0xb04e3a[_0x3758('0x31')]);_0x3b90ab[_0x3758('0x32')]=_[_0x3758('0x48')](_0x3b90ab[_0x3758('0x33')],_0x3b90ab[_0x3758('0x31')]);_0xaccc67['attributes']=_['intersection'](_0x3b90ab[_0x3758('0x33')],qs[_0x3758('0x35')](_0xb04e3a[_0x3758('0x31')][_0x3758('0x35')]));_0xaccc67['attributes']=_0xaccc67['attributes']['length']?_0xaccc67['attributes']:_0x3b90ab[_0x3758('0x33')];if(_0xb04e3a[_0x3758('0x31')][_0x3758('0x40')]){_0xaccc67['include']=[{'all':!![]}];}_0xaccc67=_[_0x3758('0x3d')]({},_0xaccc67,_0xb04e3a[_0x3758('0x3f')]);return db['OpenchannelQueue'][_0x3758('0x49')](_0xaccc67)[_0x3758('0x23')](handleEntityNotFound(_0x44d5be,null))[_0x3758('0x23')](respondWithResult(_0x44d5be,null))['catch'](handleError(_0x44d5be,null));};exports[_0x3758('0x4a')]=function(_0x42b313,_0x2c46f8){return db[_0x3758('0x2d')]['create'](_0x42b313[_0x3758('0x4b')],{})[_0x3758('0x23')](function(_0x489bac){var _0xa55023=_0x42b313['user'][_0x3758('0x25')]({'plain':!![]});if(!_0xa55023)throw new Error(_0x3758('0x4c'));if(_0xa55023[_0x3758('0x4d')]===_0x3758('0x4e')){var _0x222185=_0x489bac[_0x3758('0x25')]({'plain':!![]});var _0x1f3363=_0x3758('0x26');return db[_0x3758('0x4f')][_0x3758('0x49')]({'where':{'name':_0x1f3363,'userProfileId':_0xa55023[_0x3758('0x50')]},'raw':!![]})[_0x3758('0x23')](function(_0x437efb){if(_0x437efb&&_0x437efb[_0x3758('0x51')]===0x0){return db[_0x3758('0x27')]['create']({'name':_0x222185[_0x3758('0x29')],'resourceId':_0x222185['id'],'type':_0x437efb[_0x3758('0x29')],'sectionId':_0x437efb['id']},{})['then'](function(){return _0x489bac;});}else{return _0x489bac;}})['catch'](function(_0x39c6ce){logger[_0x3758('0x28')](_0x3758('0x52'),_0x39c6ce);throw _0x39c6ce;});}return _0x489bac;})[_0x3758('0x23')](respondWithResult(_0x2c46f8,0xc9))[_0x3758('0x44')](handleError(_0x2c46f8,null));};exports[_0x3758('0x22')]=function(_0x4cbb07,_0x435a54){if(_0x4cbb07[_0x3758('0x4b')]['id']){delete _0x4cbb07[_0x3758('0x4b')]['id'];}return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x4cbb07[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x435a54,null))['then'](saveUpdates(_0x4cbb07[_0x3758('0x4b')],null))[_0x3758('0x23')](respondWithResult(_0x435a54,null))[_0x3758('0x44')](handleError(_0x435a54,null));};exports[_0x3758('0x24')]=function(_0x31d5e1,_0xb74a45){return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x31d5e1[_0x3758('0x46')]['id']}})['then'](handleEntityNotFound(_0xb74a45,null))[_0x3758('0x23')](removeEntity(_0xb74a45,null))[_0x3758('0x44')](handleError(_0xb74a45,null));};exports['describe']=function(_0x599d60,_0x8ae4f7){return db[_0x3758('0x2d')][_0x3758('0x53')]()[_0x3758('0x23')](respondWithResult(_0x8ae4f7,null))['catch'](handleError(_0x8ae4f7,null));};exports[_0x3758('0x54')]=function(_0xa897f,_0x46bcca,_0x3fe9a3){var _0x141691={'raw':!![],'where':{}},_0x2f3be4={},_0x715bdd;return db[_0x3758('0x2d')][_0x3758('0x55')]({'where':{'id':_0xa897f[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x46bcca,null))[_0x3758('0x23')](function(_0x6c3d4a){if(_0x6c3d4a){_0x715bdd=_0x6c3d4a[_0x3758('0x25')]({'plain':!![]});_0x2f3be4[_0x3758('0x33')]=_[_0x3758('0x47')](db['UserOpenchannelQueue'][_0x3758('0x2e')]);_0x2f3be4[_0x3758('0x31')]=_[_0x3758('0x47')](_0xa897f[_0x3758('0x31')]);_0x2f3be4[_0x3758('0x32')]=_[_0x3758('0x48')](_0x2f3be4[_0x3758('0x33')],_0x2f3be4[_0x3758('0x31')]);_0x141691[_0x3758('0x34')]=_[_0x3758('0x48')](_0x2f3be4[_0x3758('0x33')],qs[_0x3758('0x35')](_0xa897f['query'][_0x3758('0x35')]));_0x141691[_0x3758('0x34')]=_0x141691['attributes'][_0x3758('0x36')]?_0x141691[_0x3758('0x34')]:_0x2f3be4['model'];if(!_0xa897f[_0x3758('0x31')][_0x3758('0x37')](_0x3758('0x38'))){_0x141691[_0x3758('0x1e')]=qs[_0x3758('0x1e')](_0xa897f[_0x3758('0x31')]['limit']);_0x141691['offset']=qs[_0x3758('0x1d')](_0xa897f[_0x3758('0x31')][_0x3758('0x1d')]);}_0x141691[_0x3758('0x56')]=qs[_0x3758('0x39')](_0xa897f[_0x3758('0x31')][_0x3758('0x39')]);_0x141691[_0x3758('0x3a')]=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0xa897f[_0x3758('0x31')],_0x2f3be4['filters']));_0x141691['where'][_0x3758('0x57')]=_0x6c3d4a['id'];if(_0xa897f['query'][_0x3758('0x3c')]){_0x141691[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x141691[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x141691[_0x3758('0x34')],function(_0x55df90){var _0x480f37={};_0x480f37[_0x55df90]={'$like':'%'+_0xa897f['query'][_0x3758('0x3c')]+'%'};return _0x480f37;})});}_0x141691=_[_0x3758('0x3d')]({},_0x141691,_0xa897f[_0x3758('0x3f')]);return db[_0x3758('0x58')][_0x3758('0x42')](_0x141691);}})[_0x3758('0x23')](function(_0x12fcf5){if(_0x12fcf5){return db[_0x3758('0x59')][_0x3758('0x5a')]({'where':{'id':_[_0x3758('0x2c')](_0x12fcf5,_0x3758('0x5b')),'role':_0x3758('0x5c')},'attributes':['id','name',_0x3758('0x5d'),_0x3758('0x5e'),_0x3758('0x5f')]});}})[_0x3758('0x23')](function(_0x314733){if(_0x314733){return{'count':_0x314733['count'],'rows':_[_0x3758('0x2c')](_0x314733[_0x3758('0x43')],function(_0x17e567){return{'membername':_0x17e567[_0x3758('0x29')],'UserId':_0x17e567['id'],'queue_name':_0x715bdd['name'],'OpenchannelQueueId':_0x715bdd['id'],'interface':util[_0x3758('0x60')]('%s/%s',_0x3758('0x61'),_0x17e567[_0x3758('0x29')]),'penalty':0x0,'paused':_0x17e567['openchannelPause'],'createdAt':_0x17e567[_0x3758('0x5f')],'updatedAt':_0x17e567['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3758('0x23')](respondWithFilteredResult(_0x46bcca,_0x141691))[_0x3758('0x44')](handleError(_0x46bcca,null));};exports[_0x3758('0x62')]=function(_0x58ae3e,_0x5363e5,_0x16909c){var _0x439018={};var _0x49a91c={};var _0x5c2d16;var _0x16127e;return db[_0x3758('0x2d')]['findOne']({'where':{'id':_0x58ae3e[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x5363e5,null))[_0x3758('0x23')](function(_0x44132e){if(_0x44132e){_0x5c2d16=_0x44132e;_0x49a91c[_0x3758('0x33')]=_['keys'](db[_0x3758('0x63')]['rawAttributes']);_0x49a91c[_0x3758('0x31')]=_[_0x3758('0x47')](_0x58ae3e[_0x3758('0x31')]);_0x49a91c[_0x3758('0x32')]=_[_0x3758('0x48')](_0x49a91c[_0x3758('0x33')],_0x49a91c[_0x3758('0x31')]);_0x439018[_0x3758('0x34')]=_['intersection'](_0x49a91c[_0x3758('0x33')],qs['fields'](_0x58ae3e['query'][_0x3758('0x35')]));_0x439018[_0x3758('0x34')]=_0x439018[_0x3758('0x34')][_0x3758('0x36')]?_0x439018[_0x3758('0x34')]:_0x49a91c[_0x3758('0x33')];_0x439018['order']=qs[_0x3758('0x39')](_0x58ae3e['query'][_0x3758('0x39')]);_0x439018['where']=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0x58ae3e[_0x3758('0x31')],_0x49a91c['filters']));if(_0x58ae3e[_0x3758('0x31')]['filter']){_0x439018[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x439018[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x439018[_0x3758('0x34')],function(_0x3f2fc1){var _0x51beb8={};_0x51beb8[_0x3f2fc1]={'$like':'%'+_0x58ae3e[_0x3758('0x31')]['filter']+'%'};return _0x51beb8;})});}_0x439018=_[_0x3758('0x3d')]({},_0x439018,_0x58ae3e[_0x3758('0x3f')]);return _0x5c2d16[_0x3758('0x62')](_0x439018);}})[_0x3758('0x23')](function(_0x3265c9){if(_0x3265c9){_0x16127e=_0x3265c9[_0x3758('0x36')];if(!_0x58ae3e[_0x3758('0x31')]['hasOwnProperty'](_0x3758('0x38'))){_0x439018[_0x3758('0x1e')]=qs[_0x3758('0x1e')](_0x58ae3e[_0x3758('0x31')][_0x3758('0x1e')]);_0x439018['offset']=qs['offset'](_0x58ae3e[_0x3758('0x31')][_0x3758('0x1d')]);}return _0x5c2d16[_0x3758('0x62')](_0x439018);}})[_0x3758('0x23')](function(_0x14667c){if(_0x14667c){return _0x14667c?{'count':_0x16127e,'rows':_0x14667c}:null;}})[_0x3758('0x23')](respondWithResult(_0x5363e5,null))[_0x3758('0x44')](handleError(_0x5363e5,null));};exports[_0x3758('0x64')]=function(_0x2716ac,_0x1cfb08,_0x26ccb4){var _0x2a4c2a=_0x2716ac[_0x3758('0x4b')][_0x3758('0x65')];return db[_0x3758('0x63')]['findAll']({'where':{'id':_0x2a4c2a},'attributes':['id'],'include':[{'model':db[_0x3758('0x59')],'as':_0x3758('0x66'),'attributes':['id',_0x3758('0x29'),'online',_0x3758('0x67'),'interface'],'raw':!![]}]})[_0x3758('0x23')](function(_0x369cbb){if(_0x369cbb){var _0x399776=_[_0x3758('0x68')](_0x369cbb,function(_0x2097c0){var _0x9c4f4=_0x2097c0[_0x3758('0x25')]({'plain':!![]});return _0x9c4f4['Agents'];});return db[_0x3758('0x2d')]['find']({'where':{'id':_0x2716ac['params']['id']}})[_0x3758('0x23')](function(_0x482c28){return db[_0x3758('0x69')][_0x3758('0x6a')](function(_0x47b326){return _0x482c28[_0x3758('0x64')](_0x2a4c2a,{'transaction':_0x47b326})[_0x3758('0x23')](function(){return BPromise['each'](_0x399776,function(_0x30f3cf){return db[_0x3758('0x58')][_0x3758('0x6b')]({'where':{'UserId':_0x30f3cf['id'],'OpenchannelQueueId':_0x2716ac[_0x3758('0x46')]['id']},'transaction':_0x47b326});});})[_0x3758('0x23')](function(){_0x399776[_0x3758('0x6c')](function(_0x6ca76b){socket[_0x3758('0x6d')](_0x3758('0x6e'),{'UserId':_0x6ca76b['id'],'OpenchannelQueueId':_0x482c28['id']});});});});});}})['then'](respondWithStatusCode(_0x1cfb08,null))[_0x3758('0x44')](handleError(_0x1cfb08,null));};exports[_0x3758('0x6f')]=function(_0xe18c67,_0x490168,_0x7ea5eb){return db[_0x3758('0x63')][_0x3758('0x42')]({'where':{'id':_0xe18c67['query'][_0x3758('0x65')]},'attributes':['id'],'include':[{'model':db[_0x3758('0x59')],'as':_0x3758('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x490168,null))[_0x3758('0x23')](function(_0x25dc07){var _0xc8a0ef=_[_0x3758('0x2c')](_0x25dc07,'id');var _0x24e0d2=[];var _0x3b40df=[];var _0x125411=squel[_0x3758('0x70')]();_0x125411[_0x3758('0x71')](_0x3758('0x72'))[_0x3758('0x73')]('team_has_openchannel_queues','tq')[_0x3758('0x74')](_0x3758('0x75'),'ut',_0x3758('0x76'))[_0x3758('0x3a')](_0x3758('0x77'),_0xe18c67['params']['id']);for(var _0x184cea=0x0;_0x184cea<_0x25dc07[_0x3758('0x36')];_0x184cea+=0x1){let _0x35c7f9=_0x25dc07[_0x184cea];for(var _0x53d7c9=0x0;_0x53d7c9<_0x35c7f9[_0x3758('0x66')][_0x3758('0x36')];_0x53d7c9+=0x1){let _0x25b070=_0x35c7f9[_0x3758('0x66')][_0x53d7c9];var _0x25c360=_0x125411['clone']();_0x25c360[_0x3758('0x3a')](_0x3758('0x78'),_0x25b070['id']);_0x3b40df[_0x3758('0x79')](db['sequelize'][_0x3758('0x31')](_0x25c360[_0x3758('0x7a')](),{'type':db[_0x3758('0x69')][_0x3758('0x7b')][_0x3758('0x7c')]})['then'](function(_0x2d1fba){if(_0x2d1fba[_0x3758('0x36')]===0x1){return _0x25b070['id'];}else{var _0x32837a=_['every'](_[_0x3758('0x2c')](_0x2d1fba,'TeamId'),function(_0x20ea15){return _[_0x3758('0x7d')](_0xc8a0ef,_0x20ea15);});if(_0x32837a){return _0x25b070['id'];}}}));}}return BPromise[_0x3758('0x7e')](_0x3b40df)[_0x3758('0x23')](function(_0x325d84){_0x24e0d2=_(_0x24e0d2)[_0x3758('0x7f')](_0x325d84)[_0x3758('0x80')]()[_0x3758('0x81')]();return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0xe18c67[_0x3758('0x46')]['id']}})['then'](function(_0x2562f4){return db['sequelize'][_0x3758('0x6a')](function(_0x407ab6){return _0x2562f4[_0x3758('0x6f')](_0xe18c67[_0x3758('0x31')]['ids'],{'transaction':_0x407ab6})['then'](function(){if(!_['isEmpty'](_0x24e0d2)){return _0x2562f4['removeAgents'](_0x24e0d2,{'transaction':_0x407ab6});}})[_0x3758('0x23')](function(){_0x24e0d2['forEach'](function(_0x17ba7e){socket['emit'](_0x3758('0x82'),{'UserId':_0x17ba7e,'OpenchannelQueueId':_0x2562f4['id']});});});});});});})[_0x3758('0x23')](respondWithStatusCode(_0x490168,null))[_0x3758('0x44')](handleError(_0x490168,null));};exports['addAgents']=function(_0x2baf9c,_0x2cd178,_0x406de2){return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x2baf9c[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x2cd178,null))['then'](function(_0x54ff4d){if(_0x54ff4d){return _0x54ff4d[_0x3758('0x83')](_0x2baf9c['body'][_0x3758('0x65')],_[_0x3758('0x84')](_0x2baf9c[_0x3758('0x4b')],[_0x3758('0x65'),'id'])||{})[_0x3758('0x85')](function(_0x314349){for(var _0x549d8c=0x0;_0x549d8c<_0x2baf9c[_0x3758('0x4b')][_0x3758('0x65')]['length'];_0x549d8c+=0x1){socket[_0x3758('0x6d')](_0x3758('0x6e'),{'UserId':_0x2baf9c[_0x3758('0x4b')]['ids'][_0x549d8c],'OpenchannelQueueId':_0x2baf9c[_0x3758('0x46')]['id']});}return _0x314349;});}})['then'](respondWithResult(_0x2cd178,null))['catch'](handleError(_0x2cd178,null));};exports[_0x3758('0x86')]=function(_0x693caf,_0x3db866,_0x257338){return db[_0x3758('0x2d')][_0x3758('0x49')]({'where':{'id':_0x693caf['params']['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x3db866,null))[_0x3758('0x23')](function(_0x299fdc){if(_0x299fdc){return _0x299fdc[_0x3758('0x86')](_0x693caf[_0x3758('0x31')][_0x3758('0x65')])['then'](function(){if(_['isArray'](_0x693caf[_0x3758('0x31')][_0x3758('0x65')])){for(var _0x57fb75=0x0;_0x57fb75<_0x693caf[_0x3758('0x31')][_0x3758('0x65')][_0x3758('0x36')];_0x57fb75+=0x1){socket['emit'](_0x3758('0x82'),{'UserId':Number(_0x693caf['query'][_0x3758('0x65')][_0x57fb75]),'OpenchannelQueueId':Number(_0x693caf['params']['id'])});}}else{socket[_0x3758('0x6d')](_0x3758('0x82'),{'UserId':Number(_0x693caf[_0x3758('0x31')][_0x3758('0x65')]),'OpenchannelQueueId':Number(_0x693caf['params']['id'])});}});}})[_0x3758('0x23')](respondWithStatusCode(_0x3db866,null))[_0x3758('0x44')](handleError(_0x3db866,null));};exports['getAgents']=function(_0x1809dc,_0x14d251,_0x39c0f6){var _0x3e5b0a={};var _0x2b350f={};var _0x2a1d39;var _0x43da2d;return db[_0x3758('0x2d')][_0x3758('0x55')]({'where':{'id':_0x1809dc[_0x3758('0x46')]['id']}})[_0x3758('0x23')](handleEntityNotFound(_0x14d251,null))[_0x3758('0x23')](function(_0xf7d082){if(_0xf7d082){_0x2a1d39=_0xf7d082;_0x2b350f[_0x3758('0x33')]=_[_0x3758('0x47')](db[_0x3758('0x59')][_0x3758('0x2e')]);_0x2b350f[_0x3758('0x31')]=_[_0x3758('0x47')](_0x1809dc[_0x3758('0x31')]);_0x2b350f['filters']=_[_0x3758('0x48')](_0x2b350f[_0x3758('0x33')],_0x2b350f[_0x3758('0x31')]);_0x3e5b0a['attributes']=_['intersection'](_0x2b350f['model'],qs[_0x3758('0x35')](_0x1809dc['query'][_0x3758('0x35')]));_0x3e5b0a[_0x3758('0x34')]=_0x3e5b0a['attributes'][_0x3758('0x36')]?_0x3e5b0a['attributes']:_0x2b350f[_0x3758('0x33')];_0x3e5b0a[_0x3758('0x56')]=qs['sort'](_0x1809dc['query'][_0x3758('0x39')]);_0x3e5b0a[_0x3758('0x3a')]=qs[_0x3758('0x32')](_[_0x3758('0x3b')](_0x1809dc[_0x3758('0x31')],_0x2b350f[_0x3758('0x32')]));if(_0x1809dc[_0x3758('0x31')][_0x3758('0x3c')]){_0x3e5b0a[_0x3758('0x3a')]=_[_0x3758('0x3d')](_0x3e5b0a[_0x3758('0x3a')],{'$or':_[_0x3758('0x2c')](_0x3e5b0a[_0x3758('0x34')],function(_0x52412c){var _0x5aad07={};_0x5aad07[_0x52412c]={'$like':'%'+_0x1809dc[_0x3758('0x31')][_0x3758('0x3c')]+'%'};return _0x5aad07;})});}_0x3e5b0a=_['merge']({},_0x3e5b0a,_0x1809dc[_0x3758('0x3f')]);return _0x2a1d39[_0x3758('0x87')](_0x3e5b0a);}})[_0x3758('0x23')](function(_0x592d84){if(_0x592d84){_0x43da2d=_0x592d84[_0x3758('0x36')];if(!_0x1809dc[_0x3758('0x31')][_0x3758('0x37')](_0x3758('0x38'))){_0x3e5b0a[_0x3758('0x1e')]=qs['limit'](_0x1809dc[_0x3758('0x31')][_0x3758('0x1e')]);_0x3e5b0a[_0x3758('0x1d')]=qs['offset'](_0x1809dc[_0x3758('0x31')][_0x3758('0x1d')]);}return _0x2a1d39[_0x3758('0x87')](_0x3e5b0a);}})[_0x3758('0x23')](function(_0x1b59d5){if(_0x1b59d5){return _0x1b59d5?{'count':_0x43da2d,'rows':_0x1b59d5}:null;}})['then'](respondWithResult(_0x14d251,null))[_0x3758('0x44')](handleError(_0x14d251,null));}; \ No newline at end of file +var _0xc56c=['../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','map','OpenchannelQueue','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','every','TeamId','includes','union','compact','value','isEmpty','forEach','addAgents','omit','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x390908,_0x27dd28){var _0x2ac84f=function(_0x477568){while(--_0x477568){_0x390908['push'](_0x390908['shift']());}};_0x2ac84f(++_0x27dd28);}(_0xc56c,0xfb));var _0xcc56=function(_0x738958,_0x54e241){_0x738958=_0x738958-0x0;var _0x4f32de=_0xc56c[_0x738958];return _0x4f32de;};'use strict';var pdf=require(_0xcc56('0x0'));var emlformat=require(_0xcc56('0x1'));var rimraf=require(_0xcc56('0x2'));var zipdir=require(_0xcc56('0x3'));var jsonpatch=require(_0xcc56('0x4'));var rp=require('request-promise');var moment=require(_0xcc56('0x5'));var BPromise=require(_0xcc56('0x6'));var Mustache=require(_0xcc56('0x7'));var util=require(_0xcc56('0x8'));var path=require(_0xcc56('0x9'));var sox=require(_0xcc56('0xa'));var csv=require(_0xcc56('0xb'));var ejs=require(_0xcc56('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcc56('0xd'));var deskjs=require(_0xcc56('0xe'));var toCsv=require(_0xcc56('0xb'));var querystring=require('querystring');var Papa=require(_0xcc56('0xf'));var Redis=require(_0xcc56('0x10'));var authService=require(_0xcc56('0x11'));var qs=require(_0xcc56('0x12'));var as=require(_0xcc56('0x13'));var hardwareService=require(_0xcc56('0x14'));var logger=require(_0xcc56('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcc56('0x16'));var db=require(_0xcc56('0x17'))['db'];config[_0xcc56('0x18')]=_['defaults'](config['redis'],{'host':_0xcc56('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc56('0x18')]));require(_0xcc56('0x1a'))[_0xcc56('0x1b')](socket);function respondWithStatusCode(_0x47bc1b,_0x3a4577){_0x3a4577=_0x3a4577||0xcc;return function(_0x5ee216){if(_0x5ee216){return _0x47bc1b[_0xcc56('0x1c')](_0x3a4577);}return _0x47bc1b[_0xcc56('0x1d')](_0x3a4577)[_0xcc56('0x1e')]();};}function respondWithResult(_0x18111b,_0x33135d){_0x33135d=_0x33135d||0xc8;return function(_0x28ab9b){if(_0x28ab9b){return _0x18111b[_0xcc56('0x1d')](_0x33135d)[_0xcc56('0x1f')](_0x28ab9b);}};}function respondWithFilteredResult(_0x1b1660,_0x943b92){return function(_0x5605f5){if(_0x5605f5){var _0x195e79=_0x5605f5[_0xcc56('0x20')],_0x455618=_0x943b92[_0xcc56('0x21')],_0x519c36=_0x943b92['offset']+_0x943b92['limit'],_0x2e7b6f;if(_0x519c36>=_0x195e79){_0x519c36=_0x195e79;_0x2e7b6f=0xc8;}else{_0x2e7b6f=0xce;}_0x1b1660[_0xcc56('0x1d')](_0x2e7b6f);return _0x1b1660[_0xcc56('0x22')](_0xcc56('0x23'),_0x455618+'-'+_0x519c36+'/'+_0x195e79)['json'](_0x5605f5);}return null;};}function patchUpdates(_0x4e0e95){return function(_0x124ee2){try{jsonpatch[_0xcc56('0x24')](_0x124ee2,_0x4e0e95,!![]);}catch(_0x17625e){return BPromise['reject'](_0x17625e);}return _0x124ee2[_0xcc56('0x25')]();};}function saveUpdates(_0x66e78,_0x518336){return function(_0x250a02){if(_0x250a02){return _0x250a02[_0xcc56('0x26')](_0x66e78)[_0xcc56('0x27')](function(_0x12a5a9){return _0x12a5a9;});}return null;};}function removeEntity(_0x16b393,_0x20b503){return function(_0x17b8de){if(_0x17b8de){return _0x17b8de[_0xcc56('0x28')]()[_0xcc56('0x27')](function(){var _0x3f925e=_0x17b8de[_0xcc56('0x29')]({'plain':!![]});var _0x478113=_0xcc56('0x2a');return db[_0xcc56('0x2b')][_0xcc56('0x28')]({'where':{'type':_0x478113,'resourceId':_0x3f925e['id']}})[_0xcc56('0x27')](function(){return _0x17b8de;});})[_0xcc56('0x27')](function(){_0x16b393[_0xcc56('0x1d')](0xcc)[_0xcc56('0x1e')]();});}};}function handleEntityNotFound(_0x15f162,_0x5225b0){return function(_0x127114){if(!_0x127114){_0x15f162[_0xcc56('0x1c')](0x194);}return _0x127114;};}function handleError(_0xd9bd2f,_0x23dd2b){_0x23dd2b=_0x23dd2b||0x1f4;return function(_0x141c7d){logger[_0xcc56('0x2c')](_0x141c7d['stack']);if(_0x141c7d[_0xcc56('0x2d')]){delete _0x141c7d['name'];}_0xd9bd2f['status'](_0x23dd2b)[_0xcc56('0x2e')](_0x141c7d);};}exports['index']=function(_0x48d413,_0x516cac){var _0x177f90={},_0x5750bc={},_0x3b873b={'count':0x0,'rows':[]};var _0x3493af=_[_0xcc56('0x2f')](db[_0xcc56('0x30')][_0xcc56('0x31')],function(_0x55a01e){return{'name':_0x55a01e['fieldName'],'type':_0x55a01e[_0xcc56('0x32')]['key']};});_0x5750bc['model']=_[_0xcc56('0x2f')](_0x3493af,'name');_0x5750bc[_0xcc56('0x33')]=_['keys'](_0x48d413[_0xcc56('0x33')]);_0x5750bc['filters']=_[_0xcc56('0x34')](_0x5750bc[_0xcc56('0x35')],_0x5750bc[_0xcc56('0x33')]);_0x177f90[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x5750bc[_0xcc56('0x35')],qs[_0xcc56('0x37')](_0x48d413[_0xcc56('0x33')][_0xcc56('0x37')]));_0x177f90[_0xcc56('0x36')]=_0x177f90[_0xcc56('0x36')][_0xcc56('0x38')]?_0x177f90[_0xcc56('0x36')]:_0x5750bc[_0xcc56('0x35')];if(!_0x48d413[_0xcc56('0x33')][_0xcc56('0x39')](_0xcc56('0x3a'))){_0x177f90[_0xcc56('0x3b')]=qs[_0xcc56('0x3b')](_0x48d413[_0xcc56('0x33')][_0xcc56('0x3b')]);_0x177f90[_0xcc56('0x21')]=qs['offset'](_0x48d413[_0xcc56('0x33')][_0xcc56('0x21')]);}_0x177f90[_0xcc56('0x3c')]=qs[_0xcc56('0x3d')](_0x48d413[_0xcc56('0x33')][_0xcc56('0x3d')]);_0x177f90[_0xcc56('0x3e')]=qs['filters'](_[_0xcc56('0x3f')](_0x48d413[_0xcc56('0x33')],_0x5750bc[_0xcc56('0x40')]),_0x3493af);if(_0x48d413[_0xcc56('0x33')][_0xcc56('0x41')]){_0x177f90[_0xcc56('0x3e')]=_[_0xcc56('0x42')](_0x177f90[_0xcc56('0x3e')],{'$or':_[_0xcc56('0x2f')](_0x3493af,function(_0x5ad824){if(_0x5ad824[_0xcc56('0x32')]!==_0xcc56('0x43')){var _0x29b8c9={};_0x29b8c9[_0x5ad824[_0xcc56('0x2d')]]={'$like':'%'+_0x48d413[_0xcc56('0x33')]['filter']+'%'};return _0x29b8c9;}})});}_0x177f90=_['merge']({},_0x177f90,_0x48d413['options']);var _0x4d29c7={'where':_0x177f90[_0xcc56('0x3e')]};return db[_0xcc56('0x30')]['count'](_0x4d29c7)[_0xcc56('0x27')](function(_0x594bd2){_0x3b873b['count']=_0x594bd2;if(_0x48d413[_0xcc56('0x33')][_0xcc56('0x44')]){_0x177f90[_0xcc56('0x45')]=[{'all':!![]}];}return db[_0xcc56('0x30')][_0xcc56('0x46')](_0x177f90);})['then'](function(_0x226e54){_0x3b873b[_0xcc56('0x47')]=_0x226e54;return _0x3b873b;})[_0xcc56('0x27')](respondWithFilteredResult(_0x516cac,_0x177f90))[_0xcc56('0x48')](handleError(_0x516cac,null));};exports[_0xcc56('0x49')]=function(_0x5c210f,_0x4e6c2d){var _0x9c7b6c={'raw':!![],'where':{'id':_0x5c210f[_0xcc56('0x4a')]['id']}},_0x2491e6={};_0x2491e6[_0xcc56('0x35')]=_[_0xcc56('0x4b')](db['OpenchannelQueue'][_0xcc56('0x31')]);_0x2491e6[_0xcc56('0x33')]=_[_0xcc56('0x4b')](_0x5c210f[_0xcc56('0x33')]);_0x2491e6['filters']=_[_0xcc56('0x34')](_0x2491e6[_0xcc56('0x35')],_0x2491e6[_0xcc56('0x33')]);_0x9c7b6c[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x2491e6['model'],qs[_0xcc56('0x37')](_0x5c210f[_0xcc56('0x33')][_0xcc56('0x37')]));_0x9c7b6c[_0xcc56('0x36')]=_0x9c7b6c[_0xcc56('0x36')][_0xcc56('0x38')]?_0x9c7b6c[_0xcc56('0x36')]:_0x2491e6['model'];if(_0x5c210f['query'][_0xcc56('0x44')]){_0x9c7b6c[_0xcc56('0x45')]=[{'all':!![]}];}_0x9c7b6c=_[_0xcc56('0x42')]({},_0x9c7b6c,_0x5c210f[_0xcc56('0x4c')]);return db[_0xcc56('0x30')][_0xcc56('0x4d')](_0x9c7b6c)[_0xcc56('0x27')](handleEntityNotFound(_0x4e6c2d,null))['then'](respondWithResult(_0x4e6c2d,null))['catch'](handleError(_0x4e6c2d,null));};exports[_0xcc56('0x4e')]=function(_0x167fbd,_0x2dc09c){return db[_0xcc56('0x30')][_0xcc56('0x4e')](_0x167fbd[_0xcc56('0x4f')],{})['then'](function(_0x5809f2){var _0x2a4ff5=_0x167fbd[_0xcc56('0x50')]['get']({'plain':!![]});if(!_0x2a4ff5)throw new Error(_0xcc56('0x51'));if(_0x2a4ff5['role']===_0xcc56('0x50')){var _0x1ad4d7=_0x5809f2['get']({'plain':!![]});var _0x568f78=_0xcc56('0x2a');return db[_0xcc56('0x52')]['find']({'where':{'name':_0x568f78,'userProfileId':_0x2a4ff5[_0xcc56('0x53')]},'raw':!![]})[_0xcc56('0x27')](function(_0x3cdc78){if(_0x3cdc78&&_0x3cdc78[_0xcc56('0x54')]===0x0){return db[_0xcc56('0x2b')][_0xcc56('0x4e')]({'name':_0x1ad4d7['name'],'resourceId':_0x1ad4d7['id'],'type':_0x3cdc78['name'],'sectionId':_0x3cdc78['id']},{})[_0xcc56('0x27')](function(){return _0x5809f2;});}else{return _0x5809f2;}})[_0xcc56('0x48')](function(_0x4110aa){logger[_0xcc56('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4110aa);throw _0x4110aa;});}return _0x5809f2;})[_0xcc56('0x27')](respondWithResult(_0x2dc09c,0xc9))[_0xcc56('0x48')](handleError(_0x2dc09c,null));};exports[_0xcc56('0x26')]=function(_0x10851a,_0x3b6444){if(_0x10851a[_0xcc56('0x4f')]['id']){delete _0x10851a['body']['id'];}return db[_0xcc56('0x30')]['find']({'where':{'id':_0x10851a[_0xcc56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b6444,null))['then'](saveUpdates(_0x10851a[_0xcc56('0x4f')],null))['then'](respondWithResult(_0x3b6444,null))[_0xcc56('0x48')](handleError(_0x3b6444,null));};exports[_0xcc56('0x28')]=function(_0x2f1813,_0x4c4c05){return db[_0xcc56('0x30')][_0xcc56('0x4d')]({'where':{'id':_0x2f1813[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x4c4c05,null))['then'](removeEntity(_0x4c4c05,null))[_0xcc56('0x48')](handleError(_0x4c4c05,null));};exports[_0xcc56('0x55')]=function(_0x231ba4,_0xa97f52){return db[_0xcc56('0x30')][_0xcc56('0x55')]()[_0xcc56('0x27')](respondWithResult(_0xa97f52,null))[_0xcc56('0x48')](handleError(_0xa97f52,null));};exports[_0xcc56('0x56')]=function(_0x4c080a,_0x4322e5,_0x12e1bf){var _0x41f885={'raw':!![],'where':{}},_0x17c1ec={},_0x3cdf56;return db[_0xcc56('0x30')][_0xcc56('0x57')]({'where':{'id':_0x4c080a[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x4322e5,null))[_0xcc56('0x27')](function(_0x38144c){if(_0x38144c){_0x3cdf56=_0x38144c[_0xcc56('0x29')]({'plain':!![]});_0x17c1ec[_0xcc56('0x35')]=_[_0xcc56('0x4b')](db[_0xcc56('0x58')]['rawAttributes']);_0x17c1ec[_0xcc56('0x33')]=_[_0xcc56('0x4b')](_0x4c080a[_0xcc56('0x33')]);_0x17c1ec[_0xcc56('0x40')]=_['intersection'](_0x17c1ec['model'],_0x17c1ec[_0xcc56('0x33')]);_0x41f885[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x17c1ec[_0xcc56('0x35')],qs['fields'](_0x4c080a['query'][_0xcc56('0x37')]));_0x41f885[_0xcc56('0x36')]=_0x41f885[_0xcc56('0x36')][_0xcc56('0x38')]?_0x41f885['attributes']:_0x17c1ec[_0xcc56('0x35')];if(!_0x4c080a[_0xcc56('0x33')]['hasOwnProperty'](_0xcc56('0x3a'))){_0x41f885[_0xcc56('0x3b')]=qs[_0xcc56('0x3b')](_0x4c080a['query'][_0xcc56('0x3b')]);_0x41f885[_0xcc56('0x21')]=qs['offset'](_0x4c080a[_0xcc56('0x33')][_0xcc56('0x21')]);}_0x41f885[_0xcc56('0x3c')]=qs[_0xcc56('0x3d')](_0x4c080a[_0xcc56('0x33')]['sort']);_0x41f885['where']=qs[_0xcc56('0x40')](_['pick'](_0x4c080a[_0xcc56('0x33')],_0x17c1ec[_0xcc56('0x40')]));_0x41f885['where'][_0xcc56('0x59')]=_0x38144c['id'];if(_0x4c080a['query'][_0xcc56('0x41')]){_0x41f885['where']=_[_0xcc56('0x42')](_0x41f885['where'],{'$or':_[_0xcc56('0x2f')](_0x41f885[_0xcc56('0x36')],function(_0x336543){var _0x23a212={};_0x23a212[_0x336543]={'$like':'%'+_0x4c080a[_0xcc56('0x33')][_0xcc56('0x41')]+'%'};return _0x23a212;})});}_0x41f885=_[_0xcc56('0x42')]({},_0x41f885,_0x4c080a['options']);return db[_0xcc56('0x58')][_0xcc56('0x46')](_0x41f885);}})[_0xcc56('0x27')](function(_0x1bec83){if(_0x1bec83){return db['User'][_0xcc56('0x5a')]({'where':{'id':_['map'](_0x1bec83,'UserId'),'role':_0xcc56('0x5b')},'attributes':['id','name',_0xcc56('0x5c'),_0xcc56('0x5d'),_0xcc56('0x5e')]});}})['then'](function(_0x3b081e){if(_0x3b081e){return{'count':_0x3b081e['count'],'rows':_[_0xcc56('0x2f')](_0x3b081e['rows'],function(_0xbd6364){return{'membername':_0xbd6364[_0xcc56('0x2d')],'UserId':_0xbd6364['id'],'queue_name':_0x3cdf56[_0xcc56('0x2d')],'OpenchannelQueueId':_0x3cdf56['id'],'interface':util[_0xcc56('0x5f')](_0xcc56('0x60'),_0xcc56('0x61'),_0xbd6364[_0xcc56('0x2d')]),'penalty':0x0,'paused':_0xbd6364[_0xcc56('0x5c')],'createdAt':_0xbd6364[_0xcc56('0x5e')],'updatedAt':_0xbd6364[_0xcc56('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcc56('0x27')](respondWithFilteredResult(_0x4322e5,_0x41f885))['catch'](handleError(_0x4322e5,null));};exports[_0xcc56('0x62')]=function(_0x268766,_0x57f67f,_0x17b169){var _0x68ffa8={};var _0x105695={};var _0x2f95c3;var _0x3d190e;return db[_0xcc56('0x30')][_0xcc56('0x57')]({'where':{'id':_0x268766[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x57f67f,null))[_0xcc56('0x27')](function(_0x1fde3f){if(_0x1fde3f){_0x2f95c3=_0x1fde3f;_0x105695['model']=_[_0xcc56('0x4b')](db[_0xcc56('0x63')][_0xcc56('0x31')]);_0x105695['query']=_[_0xcc56('0x4b')](_0x268766[_0xcc56('0x33')]);_0x105695[_0xcc56('0x40')]=_['intersection'](_0x105695[_0xcc56('0x35')],_0x105695[_0xcc56('0x33')]);_0x68ffa8[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x105695[_0xcc56('0x35')],qs[_0xcc56('0x37')](_0x268766[_0xcc56('0x33')][_0xcc56('0x37')]));_0x68ffa8['attributes']=_0x68ffa8[_0xcc56('0x36')][_0xcc56('0x38')]?_0x68ffa8[_0xcc56('0x36')]:_0x105695[_0xcc56('0x35')];_0x68ffa8[_0xcc56('0x3c')]=qs[_0xcc56('0x3d')](_0x268766[_0xcc56('0x33')][_0xcc56('0x3d')]);_0x68ffa8[_0xcc56('0x3e')]=qs['filters'](_[_0xcc56('0x3f')](_0x268766[_0xcc56('0x33')],_0x105695['filters']));if(_0x268766[_0xcc56('0x33')][_0xcc56('0x41')]){_0x68ffa8['where']=_[_0xcc56('0x42')](_0x68ffa8['where'],{'$or':_[_0xcc56('0x2f')](_0x68ffa8[_0xcc56('0x36')],function(_0x55f8c3){var _0x592f56={};_0x592f56[_0x55f8c3]={'$like':'%'+_0x268766['query']['filter']+'%'};return _0x592f56;})});}_0x68ffa8=_['merge']({},_0x68ffa8,_0x268766[_0xcc56('0x4c')]);return _0x2f95c3[_0xcc56('0x62')](_0x68ffa8);}})['then'](function(_0x55ad4e){if(_0x55ad4e){_0x3d190e=_0x55ad4e['length'];if(!_0x268766[_0xcc56('0x33')][_0xcc56('0x39')](_0xcc56('0x3a'))){_0x68ffa8[_0xcc56('0x3b')]=qs['limit'](_0x268766[_0xcc56('0x33')]['limit']);_0x68ffa8[_0xcc56('0x21')]=qs[_0xcc56('0x21')](_0x268766[_0xcc56('0x33')][_0xcc56('0x21')]);}return _0x2f95c3[_0xcc56('0x62')](_0x68ffa8);}})[_0xcc56('0x27')](function(_0x133d3b){if(_0x133d3b){return _0x133d3b?{'count':_0x3d190e,'rows':_0x133d3b}:null;}})['then'](respondWithResult(_0x57f67f,null))[_0xcc56('0x48')](handleError(_0x57f67f,null));};exports[_0xcc56('0x64')]=function(_0x547ad5,_0x1d590c,_0x2ac917){var _0x573541=_0x547ad5['body'][_0xcc56('0x65')];return db[_0xcc56('0x63')][_0xcc56('0x46')]({'where':{'id':_0x573541},'attributes':['id'],'include':[{'model':db[_0xcc56('0x66')],'as':_0xcc56('0x67'),'attributes':['id',_0xcc56('0x2d'),_0xcc56('0x68'),'voicePause',_0xcc56('0x69')],'raw':!![]}]})['then'](function(_0x36d710){if(_0x36d710){var _0x1ef53e=_[_0xcc56('0x6a')](_0x36d710,function(_0x2acd19){var _0x103dca=_0x2acd19[_0xcc56('0x29')]({'plain':!![]});return _0x103dca[_0xcc56('0x67')];});return db[_0xcc56('0x30')]['find']({'where':{'id':_0x547ad5[_0xcc56('0x4a')]['id']}})['then'](function(_0x46c9a5){return db[_0xcc56('0x6b')][_0xcc56('0x6c')](function(_0x26cf4b){return _0x46c9a5[_0xcc56('0x64')](_0x573541,{'transaction':_0x26cf4b})[_0xcc56('0x27')](function(){return BPromise[_0xcc56('0x6d')](_0x1ef53e,function(_0x2a4dcc){return db[_0xcc56('0x58')][_0xcc56('0x6e')]({'where':{'UserId':_0x2a4dcc['id'],'OpenchannelQueueId':_0x547ad5[_0xcc56('0x4a')]['id']},'transaction':_0x26cf4b});});})['then'](function(){_0x1ef53e['forEach'](function(_0x482d25){socket[_0xcc56('0x6f')](_0xcc56('0x70'),{'UserId':_0x482d25['id'],'OpenchannelQueueId':_0x46c9a5['id']});});});});});}})[_0xcc56('0x27')](respondWithStatusCode(_0x1d590c,null))[_0xcc56('0x48')](handleError(_0x1d590c,null));};exports[_0xcc56('0x71')]=function(_0x2c68e3,_0x297917,_0x320079){return db[_0xcc56('0x63')]['findAll']({'where':{'id':_0x2c68e3['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xcc56('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcc56('0x27')](handleEntityNotFound(_0x297917,null))['then'](function(_0x4b1e71){var _0x3a4f8a=_[_0xcc56('0x2f')](_0x4b1e71,'id');var _0x568a11=[];var _0xb214d3=[];var _0x12c9d5=squel[_0xcc56('0x72')]();_0x12c9d5[_0xcc56('0x73')](_0xcc56('0x74'))[_0xcc56('0x75')](_0xcc56('0x76'),'tq')[_0xcc56('0x77')](_0xcc56('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcc56('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x2c68e3[_0xcc56('0x4a')]['id']);for(var _0x500785=0x0;_0x500785<_0x4b1e71['length'];_0x500785+=0x1){let _0x4f1d8b=_0x4b1e71[_0x500785];for(var _0x16d1e2=0x0;_0x16d1e2<_0x4f1d8b['Agents']['length'];_0x16d1e2+=0x1){let _0x427c1a=_0x4f1d8b[_0xcc56('0x67')][_0x16d1e2];var _0x1c66e8=_0x12c9d5['clone']();_0x1c66e8['where'](_0xcc56('0x79'),_0x427c1a['id']);_0xb214d3[_0xcc56('0x7a')](db[_0xcc56('0x6b')][_0xcc56('0x33')](_0x1c66e8['toString'](),{'type':db[_0xcc56('0x6b')]['QueryTypes']['SELECT']})[_0xcc56('0x27')](function(_0x57e4d1){if(_0x57e4d1['length']===0x1){return _0x427c1a['id'];}else{var _0x427d4f=_[_0xcc56('0x7b')](_[_0xcc56('0x2f')](_0x57e4d1,_0xcc56('0x7c')),function(_0x3d1f4c){return _[_0xcc56('0x7d')](_0x3a4f8a,_0x3d1f4c);});if(_0x427d4f){return _0x427c1a['id'];}}}));}}return BPromise['all'](_0xb214d3)[_0xcc56('0x27')](function(_0x583778){_0x568a11=_(_0x568a11)[_0xcc56('0x7e')](_0x583778)[_0xcc56('0x7f')]()[_0xcc56('0x80')]();return db[_0xcc56('0x30')][_0xcc56('0x4d')]({'where':{'id':_0x2c68e3[_0xcc56('0x4a')]['id']}})['then'](function(_0x214d7e){return db[_0xcc56('0x6b')][_0xcc56('0x6c')](function(_0x2aacbb){return _0x214d7e[_0xcc56('0x71')](_0x2c68e3[_0xcc56('0x33')][_0xcc56('0x65')],{'transaction':_0x2aacbb})[_0xcc56('0x27')](function(){if(!_[_0xcc56('0x81')](_0x568a11)){return _0x214d7e['removeAgents'](_0x568a11,{'transaction':_0x2aacbb});}})[_0xcc56('0x27')](function(){_0x568a11[_0xcc56('0x82')](function(_0x59863f){socket[_0xcc56('0x6f')]('userOpenchannelQueue:remove',{'UserId':_0x59863f,'OpenchannelQueueId':_0x214d7e['id']});});});});});});})['then'](respondWithStatusCode(_0x297917,null))[_0xcc56('0x48')](handleError(_0x297917,null));};exports['addAgents']=function(_0x5cb73f,_0x23ee75,_0x38673c){return db['OpenchannelQueue']['find']({'where':{'id':_0x5cb73f[_0xcc56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x23ee75,null))['then'](function(_0x3eb6e6){if(_0x3eb6e6){return _0x3eb6e6[_0xcc56('0x83')](_0x5cb73f[_0xcc56('0x4f')]['ids'],_[_0xcc56('0x84')](_0x5cb73f[_0xcc56('0x4f')],[_0xcc56('0x65'),'id'])||{})['spread'](function(_0x290af5){for(var _0x4153e0=0x0;_0x4153e0<_0x5cb73f[_0xcc56('0x4f')]['ids'][_0xcc56('0x38')];_0x4153e0+=0x1){socket['emit'](_0xcc56('0x70'),{'UserId':_0x5cb73f[_0xcc56('0x4f')][_0xcc56('0x65')][_0x4153e0],'OpenchannelQueueId':_0x5cb73f['params']['id']});}return _0x290af5;});}})[_0xcc56('0x27')](respondWithResult(_0x23ee75,null))[_0xcc56('0x48')](handleError(_0x23ee75,null));};exports['removeAgents']=function(_0x18f143,_0x34326b,_0x70552a){return db[_0xcc56('0x30')][_0xcc56('0x4d')]({'where':{'id':_0x18f143[_0xcc56('0x4a')]['id']}})[_0xcc56('0x27')](handleEntityNotFound(_0x34326b,null))[_0xcc56('0x27')](function(_0x246057){if(_0x246057){return _0x246057[_0xcc56('0x85')](_0x18f143[_0xcc56('0x33')]['ids'])[_0xcc56('0x27')](function(){if(_[_0xcc56('0x86')](_0x18f143['query'][_0xcc56('0x65')])){for(var _0xfd5ed3=0x0;_0xfd5ed3<_0x18f143[_0xcc56('0x33')][_0xcc56('0x65')][_0xcc56('0x38')];_0xfd5ed3+=0x1){socket[_0xcc56('0x6f')](_0xcc56('0x87'),{'UserId':Number(_0x18f143[_0xcc56('0x33')][_0xcc56('0x65')][_0xfd5ed3]),'OpenchannelQueueId':Number(_0x18f143[_0xcc56('0x4a')]['id'])});}}else{socket['emit'](_0xcc56('0x87'),{'UserId':Number(_0x18f143[_0xcc56('0x33')][_0xcc56('0x65')]),'OpenchannelQueueId':Number(_0x18f143[_0xcc56('0x4a')]['id'])});}});}})[_0xcc56('0x27')](respondWithStatusCode(_0x34326b,null))[_0xcc56('0x48')](handleError(_0x34326b,null));};exports[_0xcc56('0x88')]=function(_0x127185,_0x113299,_0x5a9307){var _0x4e53de={};var _0x14d032={};var _0x980faf;var _0x56b248;return db[_0xcc56('0x30')][_0xcc56('0x57')]({'where':{'id':_0x127185[_0xcc56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x113299,null))['then'](function(_0x4cd7cc){if(_0x4cd7cc){_0x980faf=_0x4cd7cc;_0x14d032[_0xcc56('0x35')]=_[_0xcc56('0x4b')](db[_0xcc56('0x66')][_0xcc56('0x31')]);_0x14d032[_0xcc56('0x33')]=_[_0xcc56('0x4b')](_0x127185[_0xcc56('0x33')]);_0x14d032[_0xcc56('0x40')]=_[_0xcc56('0x34')](_0x14d032[_0xcc56('0x35')],_0x14d032[_0xcc56('0x33')]);_0x4e53de[_0xcc56('0x36')]=_[_0xcc56('0x34')](_0x14d032[_0xcc56('0x35')],qs[_0xcc56('0x37')](_0x127185[_0xcc56('0x33')][_0xcc56('0x37')]));_0x4e53de[_0xcc56('0x36')]=_0x4e53de[_0xcc56('0x36')][_0xcc56('0x38')]?_0x4e53de[_0xcc56('0x36')]:_0x14d032[_0xcc56('0x35')];_0x4e53de[_0xcc56('0x3c')]=qs['sort'](_0x127185[_0xcc56('0x33')][_0xcc56('0x3d')]);_0x4e53de[_0xcc56('0x3e')]=qs[_0xcc56('0x40')](_['pick'](_0x127185[_0xcc56('0x33')],_0x14d032['filters']));if(_0x127185[_0xcc56('0x33')][_0xcc56('0x41')]){_0x4e53de[_0xcc56('0x3e')]=_[_0xcc56('0x42')](_0x4e53de[_0xcc56('0x3e')],{'$or':_[_0xcc56('0x2f')](_0x4e53de[_0xcc56('0x36')],function(_0xfb75cc){var _0x5129bb={};_0x5129bb[_0xfb75cc]={'$like':'%'+_0x127185['query'][_0xcc56('0x41')]+'%'};return _0x5129bb;})});}_0x4e53de=_[_0xcc56('0x42')]({},_0x4e53de,_0x127185['options']);return _0x980faf['getAgents'](_0x4e53de);}})[_0xcc56('0x27')](function(_0x1b9c1a){if(_0x1b9c1a){_0x56b248=_0x1b9c1a[_0xcc56('0x38')];if(!_0x127185[_0xcc56('0x33')][_0xcc56('0x39')](_0xcc56('0x3a'))){_0x4e53de[_0xcc56('0x3b')]=qs[_0xcc56('0x3b')](_0x127185[_0xcc56('0x33')][_0xcc56('0x3b')]);_0x4e53de['offset']=qs['offset'](_0x127185[_0xcc56('0x33')][_0xcc56('0x21')]);}return _0x980faf[_0xcc56('0x88')](_0x4e53de);}})[_0xcc56('0x27')](function(_0x334465){if(_0x334465){return _0x334465?{'count':_0x56b248,'rows':_0x334465}:null;}})['then'](respondWithResult(_0x113299,null))['catch'](handleError(_0x113299,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 5be661c..2fab714 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 _0xadf0=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x14be10,_0x1afc0d){var _0x422f43=function(_0xde343c){while(--_0xde343c){_0x14be10['push'](_0x14be10['shift']());}};_0x422f43(++_0x1afc0d);}(_0xadf0,0x109));var _0x0adf=function(_0x344126,_0x3d18bc){_0x344126=_0x344126-0x0;var _0x50529e=_0xadf0[_0x344126];return _0x50529e;};'use strict';var EventEmitter=require(_0x0adf('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x0adf('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0adf('0x2')](0x0);var events={'afterCreate':_0x0adf('0x3'),'afterUpdate':_0x0adf('0x4'),'afterDestroy':_0x0adf('0x5')};function emitEvent(_0x13a138){return function(_0x14052e,_0x35d64c,_0x593018){OpenchannelQueueEvents[_0x0adf('0x6')](_0x13a138+':'+_0x14052e['id'],_0x14052e);OpenchannelQueueEvents[_0x0adf('0x6')](_0x13a138,_0x14052e);_0x593018(null);};}for(var e in events){if(events[_0x0adf('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0adf('0x8')](e,emitEvent(event));}}module[_0x0adf('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xfcbd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xfcbd,0x129));var _0xdfcb=function(_0x560a6d,_0x42c234){_0x560a6d=_0x560a6d-0x0;var _0x4b29aa=_0xfcbd[_0x560a6d];return _0x4b29aa;};'use strict';var EventEmitter=require(_0xdfcb('0x0'));var OpenchannelQueue=require(_0xdfcb('0x1'))['db'][_0xdfcb('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xdfcb('0x3')](0x0);var events={'afterCreate':_0xdfcb('0x4'),'afterUpdate':_0xdfcb('0x5'),'afterDestroy':_0xdfcb('0x6')};function emitEvent(_0x499e63){return function(_0x1377a8,_0x51bdd4,_0x9a2619){OpenchannelQueueEvents[_0xdfcb('0x7')](_0x499e63+':'+_0x1377a8['id'],_0x1377a8);OpenchannelQueueEvents[_0xdfcb('0x7')](_0x499e63,_0x1377a8);_0x9a2619(null);};}for(var e in events){if(events[_0xdfcb('0x8')](e)){var event=events[e];OpenchannelQueue[_0xdfcb('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index dbdac80..a21d2ac 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 _0x8e49=['rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','request-promise','path'];(function(_0x579ff2,_0x22eb5a){var _0x14e555=function(_0x5c7b12){while(--_0x5c7b12){_0x579ff2['push'](_0x579ff2['shift']());}};_0x14e555(++_0x22eb5a);}(_0x8e49,0x8a));var _0x98e4=function(_0x265e0e,_0x38b2bb){_0x265e0e=_0x265e0e-0x0;var _0x518157=_0x8e49[_0x265e0e];return _0x518157;};'use strict';var _=require(_0x98e4('0x0'));var util=require(_0x98e4('0x1'));var logger=require('../../config/logger')(_0x98e4('0x2'));var moment=require(_0x98e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x98e4('0x4'));var fs=require('fs');var path=require(_0x98e4('0x5'));var rimraf=require(_0x98e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x98e4('0x7'));module[_0x98e4('0x8')]=function(_0x1cb7bf,_0x50a705){return _0x1cb7bf[_0x98e4('0x9')](_0x98e4('0xa'),attributes,{'tableName':_0x98e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3930=['OpenchannelQueue','openchannel_queues','util','../../config/logger','api','request-promise','path','./openchannelQueue.attributes','exports','define'];(function(_0x49376c,_0x4a82e9){var _0x246ddc=function(_0x36be9f){while(--_0x36be9f){_0x49376c['push'](_0x49376c['shift']());}};_0x246ddc(++_0x4a82e9);}(_0x3930,0x98));var _0x0393=function(_0x59ae56,_0x1a1aaf){_0x59ae56=_0x59ae56-0x0;var _0x839b0f=_0x3930[_0x59ae56];return _0x839b0f;};'use strict';var _=require('lodash');var util=require(_0x0393('0x0'));var logger=require(_0x0393('0x1'))(_0x0393('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0393('0x3'));var fs=require('fs');var path=require(_0x0393('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0393('0x5'));module[_0x0393('0x6')]=function(_0x545f70,_0x5cf4d4){return _0x545f70[_0x0393('0x7')](_0x0393('0x8'),attributes,{'tableName':_0x0393('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 0826964..f180ab3 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 _0x2066=['message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','attributes','model','find','ShowOpenchannelQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x104e25,_0x194af3){var _0x763ca3=function(_0x4bd2ac){while(--_0x4bd2ac){_0x104e25['push'](_0x104e25['shift']());}};_0x763ca3(++_0x194af3);}(_0x2066,0xdd));var _0x6206=function(_0x44deef,_0x3857aa){_0x44deef=_0x44deef-0x0;var _0x7b3964=_0x2066[_0x44deef];return _0x7b3964;};'use strict';var _=require(_0x6206('0x0'));var util=require(_0x6206('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6206('0x2'));var fs=require('fs');var Redis=require(_0x6206('0x3'));var db=require(_0x6206('0x4'))['db'];var utils=require(_0x6206('0x5'));var logger=require(_0x6206('0x6'))(_0x6206('0x7'));var config=require('../../config/environment');var jayson=require(_0x6206('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6206('0x9')]=_[_0x6206('0xa')](config[_0x6206('0x9')],{'host':_0x6206('0xb'),'port':0x18eb});var socket=require(_0x6206('0xc'))(new Redis(config[_0x6206('0x9')]));require(_0x6206('0xd'))[_0x6206('0xe')](socket);function respondWithRpcPromise(_0x4b3a60,_0x380cce,_0x404fdf){return new BPromise(function(_0xe0ac63,_0x4efd5a){return client[_0x6206('0xf')](_0x4b3a60,_0x404fdf)[_0x6206('0x10')](function(_0x21630a){logger[_0x6206('0x11')](_0x6206('0x12'),_0x380cce,_0x6206('0x13'));logger[_0x6206('0x14')](_0x6206('0x15'),_0x380cce,_0x6206('0x13'),JSON[_0x6206('0x16')](_0x21630a));if(_0x21630a[_0x6206('0x17')]){if(_0x21630a[_0x6206('0x17')][_0x6206('0x18')]===0x1f4){logger[_0x6206('0x17')](_0x6206('0x12'),_0x380cce,_0x21630a['error']['message']);return _0x4efd5a(_0x21630a['error']['message']);}logger[_0x6206('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x380cce,_0x21630a[_0x6206('0x17')][_0x6206('0x19')]);return _0xe0ac63(_0x21630a['error'][_0x6206('0x19')]);}else{logger[_0x6206('0x11')](_0x6206('0x12'),_0x380cce,_0x6206('0x13'));_0xe0ac63(_0x21630a[_0x6206('0x1a')][_0x6206('0x19')]);}})[_0x6206('0x1b')](function(_0x8db6bb){logger[_0x6206('0x17')](_0x6206('0x12'),_0x380cce,_0x8db6bb);_0x4efd5a(_0x8db6bb);});});}exports[_0x6206('0x1c')]=function(_0x164810){var _0x3f7e49=this;return new Promise(function(_0x958ec9,_0x43cc54){return db[_0x6206('0x1d')][_0x6206('0x1e')]({'raw':_0x164810['options']?_0x164810[_0x6206('0x1f')][_0x6206('0x20')]===undefined?!![]:![]:!![],'where':_0x164810['options']?_0x164810['options'][_0x6206('0x21')]||null:null,'attributes':_0x164810[_0x6206('0x1f')]?_0x164810[_0x6206('0x1f')]['attributes']||null:null,'limit':_0x164810['options']?_0x164810[_0x6206('0x1f')][_0x6206('0x22')]||null:null,'include':_0x164810[_0x6206('0x1f')]?_0x164810[_0x6206('0x1f')][_0x6206('0x23')]?_[_0x6206('0x24')](_0x164810[_0x6206('0x1f')][_0x6206('0x23')],function(_0x35fe4e){return{'model':db[_0x35fe4e['model']],'as':_0x35fe4e['as'],'attributes':_0x35fe4e[_0x6206('0x25')],'include':_0x35fe4e['include']?_[_0x6206('0x24')](_0x35fe4e[_0x6206('0x23')],function(_0x55af18){return{'model':db[_0x55af18[_0x6206('0x26')]],'as':_0x55af18['as'],'attributes':_0x55af18[_0x6206('0x25')],'include':_0x55af18[_0x6206('0x23')]?_['map'](_0x55af18[_0x6206('0x23')],function(_0x2776d5){return{'model':db[_0x2776d5['model']],'as':_0x2776d5['as'],'attributes':_0x2776d5[_0x6206('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6206('0x10')](function(_0x515f8a){logger['info'](_0x6206('0x1c'),_0x164810);logger[_0x6206('0x14')](_0x6206('0x1c'),_0x164810,JSON[_0x6206('0x16')](_0x515f8a));_0x958ec9(_0x515f8a);})[_0x6206('0x1b')](function(_0x51e0a9){logger[_0x6206('0x17')](_0x6206('0x1c'),_0x51e0a9[_0x6206('0x19')],_0x164810);_0x43cc54(_0x3f7e49[_0x6206('0x17')](0x1f4,_0x51e0a9['message']));});});};exports['ShowOpenchannelQueue']=function(_0x2c8b26){var _0x1dab2f=this;return new Promise(function(_0x5ad05e,_0x173c33){return db['OpenchannelQueue'][_0x6206('0x27')]({'raw':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x20')]===undefined?!![]:![]:!![],'where':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x21')]||null:null,'attributes':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x25')]||null:null,'include':_0x2c8b26['options']?_0x2c8b26[_0x6206('0x1f')][_0x6206('0x23')]?_[_0x6206('0x24')](_0x2c8b26['options']['include'],function(_0xf10771){return{'model':db[_0xf10771['model']],'as':_0xf10771['as'],'attributes':_0xf10771[_0x6206('0x25')],'include':_0xf10771[_0x6206('0x23')]?_[_0x6206('0x24')](_0xf10771[_0x6206('0x23')],function(_0x49d492){return{'model':db[_0x49d492[_0x6206('0x26')]],'as':_0x49d492['as'],'attributes':_0x49d492['attributes'],'include':_0x49d492['include']?_[_0x6206('0x24')](_0x49d492[_0x6206('0x23')],function(_0x56bcaa){return{'model':db[_0x56bcaa[_0x6206('0x26')]],'as':_0x56bcaa['as'],'attributes':_0x56bcaa[_0x6206('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6206('0x10')](function(_0x1f7247){logger[_0x6206('0x11')](_0x6206('0x28'),_0x2c8b26);logger['debug'](_0x6206('0x28'),_0x2c8b26,JSON[_0x6206('0x16')](_0x1f7247));_0x5ad05e(_0x1f7247);})[_0x6206('0x1b')](function(_0x3fd41d){logger['error'](_0x6206('0x28'),_0x3fd41d[_0x6206('0x19')],_0x2c8b26);_0x173c33(_0x1dab2f[_0x6206('0x17')](0x1f4,_0x3fd41d[_0x6206('0x19')]));});});}; \ No newline at end of file +var _0x5590=['code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','include','map','model','find','where','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5590,0x1bc));var _0x0559=function(_0x4ebe00,_0x1ad85f){_0x4ebe00=_0x4ebe00-0x0;var _0x38a280=_0x5590[_0x4ebe00];return _0x38a280;};'use strict';var _=require('lodash');var util=require(_0x0559('0x0'));var moment=require(_0x0559('0x1'));var BPromise=require(_0x0559('0x2'));var rs=require(_0x0559('0x3'));var fs=require('fs');var Redis=require(_0x0559('0x4'));var db=require(_0x0559('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0559('0x6'))('rpc');var config=require(_0x0559('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0559('0x8')][_0x0559('0x9')]({'port':0x232a});config[_0x0559('0xa')]=_[_0x0559('0xb')](config[_0x0559('0xa')],{'host':_0x0559('0xc'),'port':0x18eb});var socket=require(_0x0559('0xd'))(new Redis(config[_0x0559('0xa')]));require('./openchannelQueue.socket')[_0x0559('0xe')](socket);function respondWithRpcPromise(_0x3cc30d,_0x584228,_0x5a2fb4){return new BPromise(function(_0x5131be,_0x50368f){return client[_0x0559('0xf')](_0x3cc30d,_0x5a2fb4)[_0x0559('0x10')](function(_0x499a8d){logger[_0x0559('0x11')](_0x0559('0x12'),_0x584228,_0x0559('0x13'));logger[_0x0559('0x14')](_0x0559('0x15'),_0x584228,_0x0559('0x13'),JSON[_0x0559('0x16')](_0x499a8d));if(_0x499a8d[_0x0559('0x17')]){if(_0x499a8d['error'][_0x0559('0x18')]===0x1f4){logger[_0x0559('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x584228,_0x499a8d[_0x0559('0x17')][_0x0559('0x19')]);return _0x50368f(_0x499a8d[_0x0559('0x17')][_0x0559('0x19')]);}logger[_0x0559('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x584228,_0x499a8d['error'][_0x0559('0x19')]);return _0x5131be(_0x499a8d[_0x0559('0x17')][_0x0559('0x19')]);}else{logger[_0x0559('0x11')](_0x0559('0x12'),_0x584228,_0x0559('0x13'));_0x5131be(_0x499a8d['result'][_0x0559('0x19')]);}})[_0x0559('0x1a')](function(_0x2e3eb0){logger[_0x0559('0x17')](_0x0559('0x12'),_0x584228,_0x2e3eb0);_0x50368f(_0x2e3eb0);});});}exports[_0x0559('0x1b')]=function(_0x4a0939){var _0xb9c25d=this;return new Promise(function(_0x1f3c4e,_0x4ecf8f){return db[_0x0559('0x1c')][_0x0559('0x1d')]({'raw':_0x4a0939[_0x0559('0x1e')]?_0x4a0939['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a0939[_0x0559('0x1e')]?_0x4a0939[_0x0559('0x1e')]['where']||null:null,'attributes':_0x4a0939['options']?_0x4a0939[_0x0559('0x1e')][_0x0559('0x1f')]||null:null,'limit':_0x4a0939[_0x0559('0x1e')]?_0x4a0939[_0x0559('0x1e')][_0x0559('0x20')]||null:null,'include':_0x4a0939[_0x0559('0x1e')]?_0x4a0939[_0x0559('0x1e')][_0x0559('0x21')]?_[_0x0559('0x22')](_0x4a0939[_0x0559('0x1e')][_0x0559('0x21')],function(_0x50753d){return{'model':db[_0x50753d[_0x0559('0x23')]],'as':_0x50753d['as'],'attributes':_0x50753d[_0x0559('0x1f')],'include':_0x50753d['include']?_[_0x0559('0x22')](_0x50753d[_0x0559('0x21')],function(_0x42ed9e){return{'model':db[_0x42ed9e[_0x0559('0x23')]],'as':_0x42ed9e['as'],'attributes':_0x42ed9e[_0x0559('0x1f')],'include':_0x42ed9e[_0x0559('0x21')]?_[_0x0559('0x22')](_0x42ed9e['include'],function(_0x1ac24c){return{'model':db[_0x1ac24c[_0x0559('0x23')]],'as':_0x1ac24c['as'],'attributes':_0x1ac24c[_0x0559('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0559('0x10')](function(_0x10eb8f){logger[_0x0559('0x11')](_0x0559('0x1b'),_0x4a0939);logger['debug'](_0x0559('0x1b'),_0x4a0939,JSON[_0x0559('0x16')](_0x10eb8f));_0x1f3c4e(_0x10eb8f);})[_0x0559('0x1a')](function(_0x475f2b){logger[_0x0559('0x17')](_0x0559('0x1b'),_0x475f2b[_0x0559('0x19')],_0x4a0939);_0x4ecf8f(_0xb9c25d['error'](0x1f4,_0x475f2b['message']));});});};exports['ShowOpenchannelQueue']=function(_0x461bb9){var _0x5dd16a=this;return new Promise(function(_0x43e57c,_0x188cdf){return db[_0x0559('0x1c')][_0x0559('0x24')]({'raw':_0x461bb9['options']?_0x461bb9[_0x0559('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x461bb9[_0x0559('0x1e')]?_0x461bb9['options'][_0x0559('0x25')]||null:null,'attributes':_0x461bb9[_0x0559('0x1e')]?_0x461bb9[_0x0559('0x1e')][_0x0559('0x1f')]||null:null,'include':_0x461bb9['options']?_0x461bb9[_0x0559('0x1e')]['include']?_[_0x0559('0x22')](_0x461bb9[_0x0559('0x1e')][_0x0559('0x21')],function(_0x4a3422){return{'model':db[_0x4a3422[_0x0559('0x23')]],'as':_0x4a3422['as'],'attributes':_0x4a3422[_0x0559('0x1f')],'include':_0x4a3422[_0x0559('0x21')]?_[_0x0559('0x22')](_0x4a3422['include'],function(_0x51f5da){return{'model':db[_0x51f5da['model']],'as':_0x51f5da['as'],'attributes':_0x51f5da[_0x0559('0x1f')],'include':_0x51f5da[_0x0559('0x21')]?_[_0x0559('0x22')](_0x51f5da['include'],function(_0x49304c){return{'model':db[_0x49304c[_0x0559('0x23')]],'as':_0x49304c['as'],'attributes':_0x49304c[_0x0559('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0559('0x10')](function(_0x42d32f){logger[_0x0559('0x11')](_0x0559('0x26'),_0x461bb9);logger['debug'](_0x0559('0x26'),_0x461bb9,JSON[_0x0559('0x16')](_0x42d32f));_0x43e57c(_0x42d32f);})[_0x0559('0x1a')](function(_0x11961d){logger[_0x0559('0x17')](_0x0559('0x26'),_0x11961d['message'],_0x461bb9);_0x188cdf(_0x5dd16a[_0x0559('0x17')](0x1f4,_0x11961d[_0x0559('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index af90e1d..b89066d 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 _0xf3a5=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','length'];(function(_0x28f321,_0x3b1bdf){var _0x2feda4=function(_0x3f6cf5){while(--_0x3f6cf5){_0x28f321['push'](_0x28f321['shift']());}};_0x2feda4(++_0x3b1bdf);}(_0xf3a5,0xcd));var _0x5f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a5[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x5f3a('0x0'));var events=['save',_0x5f3a('0x1'),_0x5f3a('0x2')];function createListener(_0x4c1f3f,_0x2f9258){return function(_0x377fcb){_0x2f9258[_0x5f3a('0x3')](_0x4c1f3f,_0x377fcb);};}function removeListener(_0x12589e,_0x25a89e){return function(){OpenchannelQueueEvents['removeListener'](_0x12589e,_0x25a89e);};}exports['register']=function(_0x2a6140){for(var _0xba3b96=0x0,_0x99dc5a=events[_0x5f3a('0x4')];_0xba3b96<_0x99dc5a;_0xba3b96++){var _0x39a7db=events[_0xba3b96];var _0x3fe1a5=createListener(_0x5f3a('0x5')+_0x39a7db,_0x2a6140);OpenchannelQueueEvents['on'](_0x39a7db,_0x3fe1a5);}}; \ No newline at end of file +var _0xc578=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit','register'];(function(_0x1531a9,_0x30bd51){var _0x11b216=function(_0x3cc88f){while(--_0x3cc88f){_0x1531a9['push'](_0x1531a9['shift']());}};_0x11b216(++_0x30bd51);}(_0xc578,0x72));var _0x8c57=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc578[_0x138adb];return _0x1b27f2;};'use strict';var OpenchannelQueueEvents=require(_0x8c57('0x0'));var events=[_0x8c57('0x1'),'remove',_0x8c57('0x2')];function createListener(_0x4b9302,_0x4731a2){return function(_0x44e77a){_0x4731a2[_0x8c57('0x3')](_0x4b9302,_0x44e77a);};}function removeListener(_0x3a3f82,_0x53fd88){return function(){OpenchannelQueueEvents['removeListener'](_0x3a3f82,_0x53fd88);};}exports[_0x8c57('0x4')]=function(_0x347557){for(var _0xcad46e=0x0,_0x413627=events[_0x8c57('0x5')];_0xcad46e<_0x413627;_0xcad46e++){var _0x1ae685=events[_0xcad46e];var _0x444131=createListener(_0x8c57('0x6')+_0x1ae685,_0x347557);OpenchannelQueueEvents['on'](_0x1ae685,_0x444131);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 5fab1e0..2a1d96b 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 _0x73a3=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x73a3,0x17a));var _0x373a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x73a3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x373a('0x0'));var path=require(_0x373a('0x1'));var timeout=require(_0x373a('0x2'));var express=require(_0x373a('0x3'));var router=express[_0x373a('0x4')]();var auth=require(_0x373a('0x5'));var interaction=require(_0x373a('0x6'));var config=require('../../config/environment');var controller=require(_0x373a('0x7'));router[_0x373a('0x8')]('/',auth[_0x373a('0x9')](),controller['index']);router[_0x373a('0x8')](_0x373a('0xa'),auth[_0x373a('0x9')](),controller['describe']);router['get'](_0x373a('0xb'),auth[_0x373a('0x9')](),controller['show']);router[_0x373a('0xc')]('/',auth[_0x373a('0x9')](),controller[_0x373a('0xd')]);router['put'](_0x373a('0xb'),auth[_0x373a('0x9')](),controller['update']);router[_0x373a('0xe')](_0x373a('0xb'),auth[_0x373a('0x9')](),controller[_0x373a('0xf')]);module[_0x373a('0x10')]=router; \ No newline at end of file +var _0x9086=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d9582,_0x4fbf5e){var _0x38a35d=function(_0x5f871c){while(--_0x5f871c){_0x2d9582['push'](_0x2d9582['shift']());}};_0x38a35d(++_0x4fbf5e);}(_0x9086,0x17f));var _0x6908=function(_0x524d24,_0x20b81e){_0x524d24=_0x524d24-0x0;var _0x17e372=_0x9086[_0x524d24];return _0x17e372;};'use strict';var multer=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var path=require(_0x6908('0x2'));var timeout=require(_0x6908('0x3'));var express=require(_0x6908('0x4'));var router=express[_0x6908('0x5')]();var auth=require(_0x6908('0x6'));var interaction=require(_0x6908('0x7'));var config=require(_0x6908('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x6908('0x9')]('/',auth[_0x6908('0xa')](),controller[_0x6908('0xb')]);router[_0x6908('0x9')](_0x6908('0xc'),auth['isAuthenticated'](),controller[_0x6908('0xd')]);router['get']('/:id',auth[_0x6908('0xa')](),controller[_0x6908('0xe')]);router[_0x6908('0xf')]('/',auth[_0x6908('0xa')](),controller[_0x6908('0x10')]);router[_0x6908('0x11')]('/:id',auth[_0x6908('0xa')](),controller[_0x6908('0x12')]);router[_0x6908('0x13')](_0x6908('0x14'),auth[_0x6908('0xa')](),controller[_0x6908('0x15')]);module[_0x6908('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 3200509..4627b28 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 _0x7451=['sequelize','exports','STRING','DATE','moment'];(function(_0x502471,_0x29006e){var _0x4414a8=function(_0x3aa44f){while(--_0x3aa44f){_0x502471['push'](_0x502471['shift']());}};_0x4414a8(++_0x29006e);}(_0x7451,0x117));var _0x1745=function(_0x423fe9,_0x23eef8){_0x423fe9=_0x423fe9-0x0;var _0x3cacf8=_0x7451[_0x423fe9];return _0x3cacf8;};'use strict';var moment=require(_0x1745('0x0'));var Sequelize=require(_0x1745('0x1'));module[_0x1745('0x2')]={'uniqueid':{'type':Sequelize[_0x1745('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1745('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1745('0x4')]},'acceptAt':{'type':Sequelize[_0x1745('0x4')]},'exitAt':{'type':Sequelize[_0x1745('0x4')]},'reason':{'type':Sequelize[_0x1745('0x3')]}}; \ No newline at end of file +var _0x3f82=['moment','STRING','DATE'];(function(_0x57311b,_0x2b709b){var _0x3e6385=function(_0x48ad74){while(--_0x48ad74){_0x57311b['push'](_0x57311b['shift']());}};_0x3e6385(++_0x2b709b);}(_0x3f82,0x1f2));var _0x23f8=function(_0x2520de,_0x39b56b){_0x2520de=_0x2520de-0x0;var _0x2bbe9c=_0x3f82[_0x2520de];return _0x2bbe9c;};'use strict';var moment=require(_0x23f8('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x23f8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x23f8('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x23f8('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x23f8('0x2')]},'reason':{'type':Sequelize[_0x23f8('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f9ea520..7d6966a 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 _0xb1a6=['stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','then','findAll','catch','params','keys','includeAll','include','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xb1a6,0x143));var _0x6b1a=function(_0x3f1c21,_0x57e1b6){_0x3f1c21=_0x3f1c21-0x0;var _0x10ad4f=_0xb1a6[_0x3f1c21];return _0x10ad4f;};'use strict';var pdf=require(_0x6b1a('0x0'));var emlformat=require(_0x6b1a('0x1'));var rimraf=require(_0x6b1a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b1a('0x3'));var rp=require(_0x6b1a('0x4'));var moment=require('moment');var BPromise=require(_0x6b1a('0x5'));var Mustache=require(_0x6b1a('0x6'));var util=require(_0x6b1a('0x7'));var path=require(_0x6b1a('0x8'));var sox=require('sox');var csv=require(_0x6b1a('0x9'));var ejs=require(_0x6b1a('0xa'));var fs=require('fs');var _=require(_0x6b1a('0xb'));var squel=require('squel');var crypto=require(_0x6b1a('0xc'));var jsforce=require(_0x6b1a('0xd'));var deskjs=require(_0x6b1a('0xe'));var toCsv=require(_0x6b1a('0x9'));var querystring=require('querystring');var Papa=require(_0x6b1a('0xf'));var Redis=require(_0x6b1a('0x10'));var authService=require(_0x6b1a('0x11'));var qs=require(_0x6b1a('0x12'));var as=require(_0x6b1a('0x13'));var hardwareService=require(_0x6b1a('0x14'));var logger=require(_0x6b1a('0x15'))(_0x6b1a('0x16'));var utils=require('../../config/utils');var config=require(_0x6b1a('0x17'));var db=require(_0x6b1a('0x18'))['db'];function respondWithStatusCode(_0x2ce495,_0x5394c0){_0x5394c0=_0x5394c0||0xcc;return function(_0x28109a){if(_0x28109a){return _0x2ce495[_0x6b1a('0x19')](_0x5394c0);}return _0x2ce495[_0x6b1a('0x1a')](_0x5394c0)[_0x6b1a('0x1b')]();};}function respondWithResult(_0x1f1e9b,_0x2c5493){_0x2c5493=_0x2c5493||0xc8;return function(_0x319a5a){if(_0x319a5a){return _0x1f1e9b[_0x6b1a('0x1a')](_0x2c5493)['json'](_0x319a5a);}};}function respondWithFilteredResult(_0x16fddf,_0x4fe902){return function(_0x2a1f84){if(_0x2a1f84){var _0x3df1b5=_0x2a1f84[_0x6b1a('0x1c')],_0x17874b=_0x4fe902[_0x6b1a('0x1d')],_0x43c520=_0x4fe902[_0x6b1a('0x1d')]+_0x4fe902[_0x6b1a('0x1e')],_0x44153a;if(_0x43c520>=_0x3df1b5){_0x43c520=_0x3df1b5;_0x44153a=0xc8;}else{_0x44153a=0xce;}_0x16fddf[_0x6b1a('0x1a')](_0x44153a);return _0x16fddf[_0x6b1a('0x1f')]('Content-Range',_0x17874b+'-'+_0x43c520+'/'+_0x3df1b5)[_0x6b1a('0x20')](_0x2a1f84);}return null;};}function patchUpdates(_0x8b728f){return function(_0x8cfd9){try{jsonpatch[_0x6b1a('0x21')](_0x8cfd9,_0x8b728f,!![]);}catch(_0x55ee4b){return BPromise[_0x6b1a('0x22')](_0x55ee4b);}return _0x8cfd9['save']();};}function saveUpdates(_0x247113,_0x4b3c77){return function(_0x38b92f){if(_0x38b92f){return _0x38b92f[_0x6b1a('0x23')](_0x247113)['then'](function(_0x19179e){return _0x19179e;});}return null;};}function removeEntity(_0x2c4848,_0x329a0d){return function(_0x425591){if(_0x425591){return _0x425591[_0x6b1a('0x24')]()['then'](function(){_0x2c4848['status'](0xcc)[_0x6b1a('0x1b')]();});}};}function handleEntityNotFound(_0x3df786,_0x4fb3bc){return function(_0xfc2861){if(!_0xfc2861){_0x3df786[_0x6b1a('0x19')](0x194);}return _0xfc2861;};}function handleError(_0x4f0b4b,_0x320255){_0x320255=_0x320255||0x1f4;return function(_0x271bfc){logger['error'](_0x271bfc[_0x6b1a('0x25')]);if(_0x271bfc[_0x6b1a('0x26')]){delete _0x271bfc['name'];}_0x4f0b4b[_0x6b1a('0x1a')](_0x320255)[_0x6b1a('0x27')](_0x271bfc);};}exports[_0x6b1a('0x28')]=function(_0x2d7365,_0x11c7a7){var _0x26e167={},_0x3faffd={},_0x127ab9={'count':0x0,'rows':[]};var _0x1b165a=_[_0x6b1a('0x29')](db[_0x6b1a('0x2a')][_0x6b1a('0x2b')],function(_0x54806d){return{'name':_0x54806d[_0x6b1a('0x2c')],'type':_0x54806d[_0x6b1a('0x2d')][_0x6b1a('0x2e')]};});_0x3faffd[_0x6b1a('0x2f')]=_[_0x6b1a('0x29')](_0x1b165a,'name');_0x3faffd[_0x6b1a('0x30')]=_['keys'](_0x2d7365['query']);_0x3faffd[_0x6b1a('0x31')]=_[_0x6b1a('0x32')](_0x3faffd[_0x6b1a('0x2f')],_0x3faffd[_0x6b1a('0x30')]);_0x26e167[_0x6b1a('0x33')]=_[_0x6b1a('0x32')](_0x3faffd[_0x6b1a('0x2f')],qs[_0x6b1a('0x34')](_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x34')]));_0x26e167[_0x6b1a('0x33')]=_0x26e167[_0x6b1a('0x33')][_0x6b1a('0x35')]?_0x26e167['attributes']:_0x3faffd[_0x6b1a('0x2f')];if(!_0x2d7365[_0x6b1a('0x30')]['hasOwnProperty'](_0x6b1a('0x36'))){_0x26e167['limit']=qs[_0x6b1a('0x1e')](_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x1e')]);_0x26e167[_0x6b1a('0x1d')]=qs[_0x6b1a('0x1d')](_0x2d7365['query'][_0x6b1a('0x1d')]);}_0x26e167['order']=qs[_0x6b1a('0x37')](_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x37')]);_0x26e167[_0x6b1a('0x38')]=qs[_0x6b1a('0x31')](_[_0x6b1a('0x39')](_0x2d7365[_0x6b1a('0x30')],_0x3faffd[_0x6b1a('0x31')]),_0x1b165a);if(_0x2d7365[_0x6b1a('0x30')][_0x6b1a('0x3a')]){_0x26e167[_0x6b1a('0x38')]=_['merge'](_0x26e167[_0x6b1a('0x38')],{'$or':_[_0x6b1a('0x29')](_0x1b165a,function(_0x4df3d3){if(_0x4df3d3[_0x6b1a('0x2d')]!==_0x6b1a('0x3b')){var _0x15d46f={};_0x15d46f[_0x4df3d3[_0x6b1a('0x26')]]={'$like':'%'+_0x2d7365[_0x6b1a('0x30')]['filter']+'%'};return _0x15d46f;}})});}_0x26e167=_['merge']({},_0x26e167,_0x2d7365[_0x6b1a('0x3c')]);var _0x45f5f4={'where':_0x26e167[_0x6b1a('0x38')]};return db[_0x6b1a('0x2a')][_0x6b1a('0x1c')](_0x45f5f4)[_0x6b1a('0x3d')](function(_0x502515){_0x127ab9[_0x6b1a('0x1c')]=_0x502515;if(_0x2d7365[_0x6b1a('0x30')]['includeAll']){_0x26e167['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6b1a('0x3e')](_0x26e167);})[_0x6b1a('0x3d')](function(_0x2cf020){_0x127ab9['rows']=_0x2cf020;return _0x127ab9;})[_0x6b1a('0x3d')](respondWithFilteredResult(_0x11c7a7,_0x26e167))[_0x6b1a('0x3f')](handleError(_0x11c7a7,null));};exports['show']=function(_0x431338,_0x5d15e7){var _0x599139={'raw':!![],'where':{'id':_0x431338[_0x6b1a('0x40')]['id']}},_0x286674={};_0x286674[_0x6b1a('0x2f')]=_['keys'](db[_0x6b1a('0x2a')][_0x6b1a('0x2b')]);_0x286674['query']=_[_0x6b1a('0x41')](_0x431338[_0x6b1a('0x30')]);_0x286674[_0x6b1a('0x31')]=_[_0x6b1a('0x32')](_0x286674[_0x6b1a('0x2f')],_0x286674['query']);_0x599139[_0x6b1a('0x33')]=_['intersection'](_0x286674[_0x6b1a('0x2f')],qs[_0x6b1a('0x34')](_0x431338[_0x6b1a('0x30')][_0x6b1a('0x34')]));_0x599139[_0x6b1a('0x33')]=_0x599139[_0x6b1a('0x33')][_0x6b1a('0x35')]?_0x599139[_0x6b1a('0x33')]:_0x286674['model'];if(_0x431338[_0x6b1a('0x30')][_0x6b1a('0x42')]){_0x599139[_0x6b1a('0x43')]=[{'all':!![]}];}_0x599139=_['merge']({},_0x599139,_0x431338[_0x6b1a('0x3c')]);return db[_0x6b1a('0x2a')][_0x6b1a('0x44')](_0x599139)[_0x6b1a('0x3d')](handleEntityNotFound(_0x5d15e7,null))[_0x6b1a('0x3d')](respondWithResult(_0x5d15e7,null))[_0x6b1a('0x3f')](handleError(_0x5d15e7,null));};exports['create']=function(_0x12ceee,_0x29c28c){return db['OpenchannelQueueReport'][_0x6b1a('0x45')](_0x12ceee[_0x6b1a('0x46')],{})['then'](respondWithResult(_0x29c28c,0xc9))[_0x6b1a('0x3f')](handleError(_0x29c28c,null));};exports['update']=function(_0x2450ab,_0x38046a){if(_0x2450ab[_0x6b1a('0x46')]['id']){delete _0x2450ab['body']['id'];}return db['OpenchannelQueueReport'][_0x6b1a('0x44')]({'where':{'id':_0x2450ab['params']['id']}})[_0x6b1a('0x3d')](handleEntityNotFound(_0x38046a,null))['then'](saveUpdates(_0x2450ab[_0x6b1a('0x46')],null))[_0x6b1a('0x3d')](respondWithResult(_0x38046a,null))[_0x6b1a('0x3f')](handleError(_0x38046a,null));};exports[_0x6b1a('0x24')]=function(_0x1f8f02,_0x28d17c){return db['OpenchannelQueueReport'][_0x6b1a('0x44')]({'where':{'id':_0x1f8f02[_0x6b1a('0x40')]['id']}})[_0x6b1a('0x3d')](handleEntityNotFound(_0x28d17c,null))[_0x6b1a('0x3d')](removeEntity(_0x28d17c,null))['catch'](handleError(_0x28d17c,null));};exports[_0x6b1a('0x47')]=function(_0x303df9,_0xf9d251){return db[_0x6b1a('0x2a')][_0x6b1a('0x47')]()[_0x6b1a('0x3d')](respondWithResult(_0xf9d251,null))['catch'](handleError(_0xf9d251,null));}; \ No newline at end of file +var _0x3b94=['reject','save','destroy','then','name','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','apply'];(function(_0x3a33d7,_0x428ab0){var _0x2ad048=function(_0x1e18cf){while(--_0x1e18cf){_0x3a33d7['push'](_0x3a33d7['shift']());}};_0x2ad048(++_0x428ab0);}(_0x3b94,0xb3));var _0x43b9=function(_0x41acf4,_0x45f994){_0x41acf4=_0x41acf4-0x0;var _0x5a2eab=_0x3b94[_0x41acf4];return _0x5a2eab;};'use strict';var pdf=require(_0x43b9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43b9('0x1'));var zipdir=require(_0x43b9('0x2'));var jsonpatch=require(_0x43b9('0x3'));var rp=require(_0x43b9('0x4'));var moment=require('moment');var BPromise=require(_0x43b9('0x5'));var Mustache=require('mustache');var util=require(_0x43b9('0x6'));var path=require('path');var sox=require(_0x43b9('0x7'));var csv=require('to-csv');var ejs=require(_0x43b9('0x8'));var fs=require('fs');var _=require(_0x43b9('0x9'));var squel=require(_0x43b9('0xa'));var crypto=require(_0x43b9('0xb'));var jsforce=require(_0x43b9('0xc'));var deskjs=require(_0x43b9('0xd'));var toCsv=require(_0x43b9('0xe'));var querystring=require(_0x43b9('0xf'));var Papa=require(_0x43b9('0x10'));var Redis=require('ioredis');var authService=require(_0x43b9('0x11'));var qs=require(_0x43b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43b9('0x13'));var logger=require(_0x43b9('0x14'))(_0x43b9('0x15'));var utils=require(_0x43b9('0x16'));var config=require(_0x43b9('0x17'));var db=require(_0x43b9('0x18'))['db'];function respondWithStatusCode(_0x227f0b,_0x43abdb){_0x43abdb=_0x43abdb||0xcc;return function(_0x22ad83){if(_0x22ad83){return _0x227f0b[_0x43b9('0x19')](_0x43abdb);}return _0x227f0b[_0x43b9('0x1a')](_0x43abdb)[_0x43b9('0x1b')]();};}function respondWithResult(_0x3edd06,_0x1aef77){_0x1aef77=_0x1aef77||0xc8;return function(_0xc1b8f5){if(_0xc1b8f5){return _0x3edd06[_0x43b9('0x1a')](_0x1aef77)[_0x43b9('0x1c')](_0xc1b8f5);}};}function respondWithFilteredResult(_0x4cdd4c,_0x53d974){return function(_0x3df370){if(_0x3df370){var _0x3bd84f=_0x3df370['count'],_0xbeb065=_0x53d974['offset'],_0x2f3b5f=_0x53d974['offset']+_0x53d974[_0x43b9('0x1d')],_0x312116;if(_0x2f3b5f>=_0x3bd84f){_0x2f3b5f=_0x3bd84f;_0x312116=0xc8;}else{_0x312116=0xce;}_0x4cdd4c['status'](_0x312116);return _0x4cdd4c['set']('Content-Range',_0xbeb065+'-'+_0x2f3b5f+'/'+_0x3bd84f)[_0x43b9('0x1c')](_0x3df370);}return null;};}function patchUpdates(_0xa3efde){return function(_0x5382ca){try{jsonpatch[_0x43b9('0x1e')](_0x5382ca,_0xa3efde,!![]);}catch(_0x4b41aa){return BPromise[_0x43b9('0x1f')](_0x4b41aa);}return _0x5382ca[_0x43b9('0x20')]();};}function saveUpdates(_0x5dd817,_0x58f5a2){return function(_0x5a97fc){if(_0x5a97fc){return _0x5a97fc['update'](_0x5dd817)['then'](function(_0x19cbd7){return _0x19cbd7;});}return null;};}function removeEntity(_0x48c7be,_0x296660){return function(_0x5db5c5){if(_0x5db5c5){return _0x5db5c5[_0x43b9('0x21')]()[_0x43b9('0x22')](function(){_0x48c7be[_0x43b9('0x1a')](0xcc)[_0x43b9('0x1b')]();});}};}function handleEntityNotFound(_0x5218a8,_0x3730b4){return function(_0x12e02e){if(!_0x12e02e){_0x5218a8['sendStatus'](0x194);}return _0x12e02e;};}function handleError(_0x47a85d,_0x1db45c){_0x1db45c=_0x1db45c||0x1f4;return function(_0x87be88){logger['error'](_0x87be88['stack']);if(_0x87be88[_0x43b9('0x23')]){delete _0x87be88[_0x43b9('0x23')];}_0x47a85d[_0x43b9('0x1a')](_0x1db45c)['send'](_0x87be88);};}exports[_0x43b9('0x24')]=function(_0x3a25ed,_0x27a68a){var _0x5ab635={},_0x129982={},_0x486794={'count':0x0,'rows':[]};var _0x15faef=_['map'](db[_0x43b9('0x25')][_0x43b9('0x26')],function(_0x116890){return{'name':_0x116890[_0x43b9('0x27')],'type':_0x116890[_0x43b9('0x28')][_0x43b9('0x29')]};});_0x129982[_0x43b9('0x2a')]=_[_0x43b9('0x2b')](_0x15faef,_0x43b9('0x23'));_0x129982[_0x43b9('0x2c')]=_['keys'](_0x3a25ed[_0x43b9('0x2c')]);_0x129982[_0x43b9('0x2d')]=_[_0x43b9('0x2e')](_0x129982[_0x43b9('0x2a')],_0x129982[_0x43b9('0x2c')]);_0x5ab635['attributes']=_[_0x43b9('0x2e')](_0x129982['model'],qs[_0x43b9('0x2f')](_0x3a25ed[_0x43b9('0x2c')]['fields']));_0x5ab635['attributes']=_0x5ab635[_0x43b9('0x30')]['length']?_0x5ab635[_0x43b9('0x30')]:_0x129982[_0x43b9('0x2a')];if(!_0x3a25ed[_0x43b9('0x2c')][_0x43b9('0x31')](_0x43b9('0x32'))){_0x5ab635[_0x43b9('0x1d')]=qs['limit'](_0x3a25ed['query']['limit']);_0x5ab635['offset']=qs['offset'](_0x3a25ed[_0x43b9('0x2c')][_0x43b9('0x33')]);}_0x5ab635['order']=qs[_0x43b9('0x34')](_0x3a25ed['query'][_0x43b9('0x34')]);_0x5ab635['where']=qs[_0x43b9('0x2d')](_['pick'](_0x3a25ed['query'],_0x129982[_0x43b9('0x2d')]),_0x15faef);if(_0x3a25ed[_0x43b9('0x2c')][_0x43b9('0x35')]){_0x5ab635[_0x43b9('0x36')]=_[_0x43b9('0x37')](_0x5ab635[_0x43b9('0x36')],{'$or':_[_0x43b9('0x2b')](_0x15faef,function(_0x43230d){if(_0x43230d[_0x43b9('0x28')]!==_0x43b9('0x38')){var _0x5d7f31={};_0x5d7f31[_0x43230d[_0x43b9('0x23')]]={'$like':'%'+_0x3a25ed[_0x43b9('0x2c')]['filter']+'%'};return _0x5d7f31;}})});}_0x5ab635=_[_0x43b9('0x37')]({},_0x5ab635,_0x3a25ed['options']);var _0x30cd6c={'where':_0x5ab635[_0x43b9('0x36')]};return db['OpenchannelQueueReport']['count'](_0x30cd6c)[_0x43b9('0x22')](function(_0x1ada05){_0x486794[_0x43b9('0x39')]=_0x1ada05;if(_0x3a25ed['query'][_0x43b9('0x3a')]){_0x5ab635['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x43b9('0x3b')](_0x5ab635);})[_0x43b9('0x22')](function(_0x35e6af){_0x486794[_0x43b9('0x3c')]=_0x35e6af;return _0x486794;})['then'](respondWithFilteredResult(_0x27a68a,_0x5ab635))[_0x43b9('0x3d')](handleError(_0x27a68a,null));};exports['show']=function(_0x3570a6,_0x228bb6){var _0x1858f0={'raw':!![],'where':{'id':_0x3570a6[_0x43b9('0x3e')]['id']}},_0x524c3d={};_0x524c3d[_0x43b9('0x2a')]=_[_0x43b9('0x3f')](db[_0x43b9('0x25')][_0x43b9('0x26')]);_0x524c3d[_0x43b9('0x2c')]=_[_0x43b9('0x3f')](_0x3570a6[_0x43b9('0x2c')]);_0x524c3d[_0x43b9('0x2d')]=_['intersection'](_0x524c3d[_0x43b9('0x2a')],_0x524c3d[_0x43b9('0x2c')]);_0x1858f0[_0x43b9('0x30')]=_[_0x43b9('0x2e')](_0x524c3d[_0x43b9('0x2a')],qs['fields'](_0x3570a6['query']['fields']));_0x1858f0['attributes']=_0x1858f0[_0x43b9('0x30')][_0x43b9('0x40')]?_0x1858f0[_0x43b9('0x30')]:_0x524c3d[_0x43b9('0x2a')];if(_0x3570a6['query']['includeAll']){_0x1858f0[_0x43b9('0x41')]=[{'all':!![]}];}_0x1858f0=_['merge']({},_0x1858f0,_0x3570a6['options']);return db[_0x43b9('0x25')][_0x43b9('0x42')](_0x1858f0)[_0x43b9('0x22')](handleEntityNotFound(_0x228bb6,null))['then'](respondWithResult(_0x228bb6,null))[_0x43b9('0x3d')](handleError(_0x228bb6,null));};exports[_0x43b9('0x43')]=function(_0x3e7eab,_0x5613d9){return db['OpenchannelQueueReport'][_0x43b9('0x43')](_0x3e7eab[_0x43b9('0x44')],{})[_0x43b9('0x22')](respondWithResult(_0x5613d9,0xc9))[_0x43b9('0x3d')](handleError(_0x5613d9,null));};exports['update']=function(_0x3c27ac,_0x39eebe){if(_0x3c27ac[_0x43b9('0x44')]['id']){delete _0x3c27ac['body']['id'];}return db[_0x43b9('0x25')][_0x43b9('0x42')]({'where':{'id':_0x3c27ac[_0x43b9('0x3e')]['id']}})[_0x43b9('0x22')](handleEntityNotFound(_0x39eebe,null))[_0x43b9('0x22')](saveUpdates(_0x3c27ac[_0x43b9('0x44')],null))[_0x43b9('0x22')](respondWithResult(_0x39eebe,null))[_0x43b9('0x3d')](handleError(_0x39eebe,null));};exports[_0x43b9('0x21')]=function(_0x3ba1f6,_0x39ebc3){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3ba1f6['params']['id']}})[_0x43b9('0x22')](handleEntityNotFound(_0x39ebc3,null))[_0x43b9('0x22')](removeEntity(_0x39ebc3,null))['catch'](handleError(_0x39ebc3,null));};exports[_0x43b9('0x45')]=function(_0x374c5a,_0x2b0657){return db[_0x43b9('0x25')]['describe']()[_0x43b9('0x22')](respondWithResult(_0x2b0657,null))[_0x43b9('0x3d')](handleError(_0x2b0657,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index cfa6662..1f6e52b 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 _0x33d8=['./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x54547c,_0x403953){var _0xea7f23=function(_0x285735){while(--_0x285735){_0x54547c['push'](_0x54547c['shift']());}};_0xea7f23(++_0x403953);}(_0x33d8,0x164));var _0x833d=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x33d8[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x833d('0x0'));var logger=require(_0x833d('0x1'))(_0x833d('0x2'));var moment=require(_0x833d('0x3'));var BPromise=require(_0x833d('0x4'));var rp=require(_0x833d('0x5'));var fs=require('fs');var path=require(_0x833d('0x6'));var rimraf=require('rimraf');var config=require(_0x833d('0x7'));var attributes=require(_0x833d('0x8'));module[_0x833d('0x9')]=function(_0x49a48e,_0x4b7e06){return _0x49a48e[_0x833d('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x833d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x833d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb203=['request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x92e8f3,_0x3bedc5){var _0x319e72=function(_0x33b484){while(--_0x33b484){_0x92e8f3['push'](_0x92e8f3['shift']());}};_0x319e72(++_0x3bedc5);}(_0xb203,0x78));var _0x3b20=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb203[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x3b20('0x0'));var util=require(_0x3b20('0x1'));var logger=require(_0x3b20('0x2'))(_0x3b20('0x3'));var moment=require(_0x3b20('0x4'));var BPromise=require(_0x3b20('0x5'));var rp=require(_0x3b20('0x6'));var fs=require('fs');var path=require(_0x3b20('0x7'));var rimraf=require(_0x3b20('0x8'));var config=require(_0x3b20('0x9'));var attributes=require('./openchannelQueueReport.attributes');module[_0x3b20('0xa')]=function(_0x214fb2,_0x31f78e){return _0x214fb2[_0x3b20('0xb')](_0x3b20('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x3b20('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 37511c1..6f71574 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 _0x97e6=['UpdateOpenchannelQueueReport','update','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify'];(function(_0xdc7a23,_0x53bae0){var _0x415981=function(_0x546218){while(--_0x546218){_0xdc7a23['push'](_0xdc7a23['shift']());}};_0x415981(++_0x53bae0);}(_0x97e6,0x159));var _0x697e=function(_0x4dd71c,_0x23a24e){_0x4dd71c=_0x4dd71c-0x0;var _0x8e4e36=_0x97e6[_0x4dd71c];return _0x8e4e36;};'use strict';var _=require(_0x697e('0x0'));var util=require('util');var moment=require(_0x697e('0x1'));var BPromise=require(_0x697e('0x2'));var rs=require(_0x697e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x697e('0x4'))['db'];var utils=require(_0x697e('0x5'));var logger=require('../../config/logger')(_0x697e('0x6'));var config=require('../../config/environment');var jayson=require(_0x697e('0x7'));var client=jayson[_0x697e('0x8')][_0x697e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546438,_0x371e2f,_0x21b9d5){return new BPromise(function(_0x4cf39f,_0x5670e3){return client[_0x697e('0xa')](_0x546438,_0x21b9d5)[_0x697e('0xb')](function(_0x2499f6){logger['info'](_0x697e('0xc'),_0x371e2f,_0x697e('0xd'));logger[_0x697e('0xe')](_0x697e('0xf'),_0x371e2f,_0x697e('0xd'),JSON['stringify'](_0x2499f6));if(_0x2499f6[_0x697e('0x10')]){if(_0x2499f6['error']['code']===0x1f4){logger[_0x697e('0x10')](_0x697e('0xc'),_0x371e2f,_0x2499f6[_0x697e('0x10')]['message']);return _0x5670e3(_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x371e2f,_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);return _0x4cf39f(_0x2499f6[_0x697e('0x10')][_0x697e('0x11')]);}else{logger[_0x697e('0x12')](_0x697e('0xc'),_0x371e2f,_0x697e('0xd'));_0x4cf39f(_0x2499f6[_0x697e('0x13')][_0x697e('0x11')]);}})['catch'](function(_0x316bdb){logger[_0x697e('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x371e2f,_0x316bdb);_0x5670e3(_0x316bdb);});});}exports[_0x697e('0x14')]=function(_0x5edd20){var _0x233404=this;return new Promise(function(_0x281216,_0x50da1e){return db[_0x697e('0x15')][_0x697e('0x16')](_0x5edd20[_0x697e('0x17')],{'raw':_0x5edd20[_0x697e('0x18')]?_0x5edd20[_0x697e('0x18')][_0x697e('0x19')]===undefined?!![]:![]:!![]})[_0x697e('0xb')](function(_0x26e3cd){logger[_0x697e('0x12')](_0x697e('0x14'),_0x5edd20);logger[_0x697e('0xe')]('CreateOpenchannelQueueReport',_0x5edd20,JSON[_0x697e('0x1a')](_0x26e3cd));_0x281216(_0x26e3cd);})['catch'](function(_0x179fab){logger[_0x697e('0x10')]('CreateOpenchannelQueueReport',_0x179fab[_0x697e('0x11')],_0x5edd20);_0x50da1e(_0x233404['error'](0x1f4,_0x179fab[_0x697e('0x11')]));});});};exports[_0x697e('0x1b')]=function(_0x1d37ae){var _0x15737b=this;return new Promise(function(_0x11122b,_0x4b4514){return db['OpenchannelQueueReport'][_0x697e('0x1c')](_0x1d37ae[_0x697e('0x17')],{'raw':_0x1d37ae[_0x697e('0x18')]?_0x1d37ae[_0x697e('0x18')][_0x697e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d37ae[_0x697e('0x18')]?_0x1d37ae[_0x697e('0x18')]['where']||null:null,'attributes':_0x1d37ae['options']?_0x1d37ae[_0x697e('0x18')][_0x697e('0x1d')]||null:null,'limit':_0x1d37ae[_0x697e('0x18')]?_0x1d37ae[_0x697e('0x18')][_0x697e('0x1e')]||null:null})[_0x697e('0xb')](function(_0x33f4b5){logger['info']('UpdateOpenchannelQueueReport',_0x1d37ae);logger['debug'](_0x697e('0x1b'),_0x1d37ae,JSON['stringify'](_0x33f4b5));_0x11122b(_0x33f4b5);})['catch'](function(_0x5785e5){logger['error'](_0x697e('0x1b'),_0x5785e5[_0x697e('0x11')],_0x1d37ae);_0x4b4514(_0x15737b[_0x697e('0x10')](0x1f4,_0x5785e5[_0x697e('0x11')]));});});}; \ No newline at end of file +var _0xa3e8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','where','attributes','limit','debug','lodash','util'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xa3e8,0x127));var _0x8a3e=function(_0x384ca2,_0x520a6c){_0x384ca2=_0x384ca2-0x0;var _0x489427=_0xa3e8[_0x384ca2];return _0x489427;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var moment=require(_0x8a3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a3e('0x3'));var fs=require('fs');var Redis=require(_0x8a3e('0x4'));var db=require(_0x8a3e('0x5'))['db'];var utils=require(_0x8a3e('0x6'));var logger=require(_0x8a3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a3e('0x8')][_0x8a3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2052a8,_0x5a2a25,_0x27f08d){return new BPromise(function(_0x4c7f41,_0x437cde){return client[_0x8a3e('0xa')](_0x2052a8,_0x27f08d)[_0x8a3e('0xb')](function(_0x402a96){logger[_0x8a3e('0xc')](_0x8a3e('0xd'),_0x5a2a25,_0x8a3e('0xe'));logger['debug'](_0x8a3e('0xf'),_0x5a2a25,_0x8a3e('0xe'),JSON[_0x8a3e('0x10')](_0x402a96));if(_0x402a96['error']){if(_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x12')]===0x1f4){logger[_0x8a3e('0x11')](_0x8a3e('0xd'),_0x5a2a25,_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);return _0x437cde(_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);}logger[_0x8a3e('0x11')](_0x8a3e('0xd'),_0x5a2a25,_0x402a96[_0x8a3e('0x11')][_0x8a3e('0x13')]);return _0x4c7f41(_0x402a96[_0x8a3e('0x11')]['message']);}else{logger[_0x8a3e('0xc')](_0x8a3e('0xd'),_0x5a2a25,_0x8a3e('0xe'));_0x4c7f41(_0x402a96[_0x8a3e('0x14')][_0x8a3e('0x13')]);}})[_0x8a3e('0x15')](function(_0x48e5a8){logger[_0x8a3e('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5a2a25,_0x48e5a8);_0x437cde(_0x48e5a8);});});}exports['CreateOpenchannelQueueReport']=function(_0x2f0b46){var _0xb2f9c3=this;return new Promise(function(_0xcb1a1f,_0xe36063){return db[_0x8a3e('0x16')][_0x8a3e('0x17')](_0x2f0b46[_0x8a3e('0x18')],{'raw':_0x2f0b46[_0x8a3e('0x19')]?_0x2f0b46['options'][_0x8a3e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x103eab){logger[_0x8a3e('0xc')](_0x8a3e('0x1b'),_0x2f0b46);logger['debug'](_0x8a3e('0x1b'),_0x2f0b46,JSON[_0x8a3e('0x10')](_0x103eab));_0xcb1a1f(_0x103eab);})['catch'](function(_0x316594){logger[_0x8a3e('0x11')](_0x8a3e('0x1b'),_0x316594[_0x8a3e('0x13')],_0x2f0b46);_0xe36063(_0xb2f9c3[_0x8a3e('0x11')](0x1f4,_0x316594[_0x8a3e('0x13')]));});});};exports[_0x8a3e('0x1c')]=function(_0x422303){var _0x328c45=this;return new Promise(function(_0x36d365,_0x41a6ff){return db[_0x8a3e('0x16')]['update'](_0x422303[_0x8a3e('0x18')],{'raw':_0x422303['options']?_0x422303[_0x8a3e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422303[_0x8a3e('0x19')]?_0x422303[_0x8a3e('0x19')][_0x8a3e('0x1d')]||null:null,'attributes':_0x422303[_0x8a3e('0x19')]?_0x422303[_0x8a3e('0x19')][_0x8a3e('0x1e')]||null:null,'limit':_0x422303[_0x8a3e('0x19')]?_0x422303['options'][_0x8a3e('0x1f')]||null:null})[_0x8a3e('0xb')](function(_0xf80a64){logger[_0x8a3e('0xc')](_0x8a3e('0x1c'),_0x422303);logger[_0x8a3e('0x20')](_0x8a3e('0x1c'),_0x422303,JSON['stringify'](_0xf80a64));_0x36d365(_0xf80a64);})[_0x8a3e('0x15')](function(_0x463efc){logger[_0x8a3e('0x11')](_0x8a3e('0x1c'),_0x463efc[_0x8a3e('0x13')],_0x422303);_0x41a6ff(_0x328c45[_0x8a3e('0x11')](0x1f4,_0x463efc[_0x8a3e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 034ab2c..50a46b9 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(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4e1793c..328b954 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 _0xb848=['STRING','ENUM','agent','queue','NOW','sequelize','exports'];(function(_0x1821f3,_0xbde01e){var _0x1452d3=function(_0x53083b){while(--_0x53083b){_0x1821f3['push'](_0x1821f3['shift']());}};_0x1452d3(++_0xbde01e);}(_0xb848,0x186));var _0x8b84=function(_0x5d3ed6,_0x30b646){_0x5d3ed6=_0x5d3ed6-0x0;var _0x548252=_0xb848[_0x5d3ed6];return _0x548252;};'use strict';var moment=require('moment');var Sequelize=require(_0x8b84('0x0'));module[_0x8b84('0x1')]={'uniqueid':{'type':Sequelize[_0x8b84('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8b84('0x3')]('account',_0x8b84('0x4'),'queue'),'allowNull':![],'defaultValue':_0x8b84('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8b84('0x6')]}}; \ No newline at end of file +var _0x9b96=['exports','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x29a0a4,_0x1141cf){var _0x642458=function(_0x34627b){while(--_0x34627b){_0x29a0a4['push'](_0x29a0a4['shift']());}};_0x642458(++_0x1141cf);}(_0x9b96,0xbb));var _0x69b9=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x9b96[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0x69b9('0x0'));var Sequelize=require(_0x69b9('0x1'));module[_0x69b9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x69b9('0x3')](_0x69b9('0x4'),'agent',_0x69b9('0x5')),'allowNull':![],'defaultValue':_0x69b9('0x5')},'transferredAt':{'type':Sequelize[_0x69b9('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c4a8b49..0af48b4 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 _0xbc5e=['attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','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/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','key','model','query','filters','intersection','fields'];(function(_0x58d48c,_0x5c13f4){var _0x37e0ba=function(_0x221ef5){while(--_0x221ef5){_0x58d48c['push'](_0x58d48c['shift']());}};_0x37e0ba(++_0x5c13f4);}(_0xbc5e,0x65));var _0xebc5=function(_0x35e641,_0x4b5f7e){_0x35e641=_0x35e641-0x0;var _0x24c608=_0xbc5e[_0x35e641];return _0x24c608;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xebc5('0x0'));var rimraf=require(_0xebc5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebc5('0x2'));var rp=require(_0xebc5('0x3'));var moment=require(_0xebc5('0x4'));var BPromise=require(_0xebc5('0x5'));var Mustache=require(_0xebc5('0x6'));var util=require(_0xebc5('0x7'));var path=require(_0xebc5('0x8'));var sox=require(_0xebc5('0x9'));var csv=require(_0xebc5('0xa'));var ejs=require(_0xebc5('0xb'));var fs=require('fs');var _=require(_0xebc5('0xc'));var squel=require(_0xebc5('0xd'));var crypto=require(_0xebc5('0xe'));var jsforce=require(_0xebc5('0xf'));var deskjs=require(_0xebc5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xebc5('0x11'));var Papa=require('papaparse');var Redis=require(_0xebc5('0x12'));var authService=require(_0xebc5('0x13'));var qs=require(_0xebc5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebc5('0x15'));var logger=require(_0xebc5('0x16'))('api');var utils=require(_0xebc5('0x17'));var config=require(_0xebc5('0x18'));var db=require(_0xebc5('0x19'))['db'];function respondWithStatusCode(_0x561c09,_0x489222){_0x489222=_0x489222||0xcc;return function(_0x146711){if(_0x146711){return _0x561c09['sendStatus'](_0x489222);}return _0x561c09[_0xebc5('0x1a')](_0x489222)[_0xebc5('0x1b')]();};}function respondWithResult(_0xf8c6bc,_0x2c2ee6){_0x2c2ee6=_0x2c2ee6||0xc8;return function(_0x1b8637){if(_0x1b8637){return _0xf8c6bc[_0xebc5('0x1a')](_0x2c2ee6)['json'](_0x1b8637);}};}function respondWithFilteredResult(_0x52d3da,_0x5be60b){return function(_0x2d2020){if(_0x2d2020){var _0x4aecad=_0x2d2020['count'],_0x5a9caf=_0x5be60b[_0xebc5('0x1c')],_0x24048e=_0x5be60b[_0xebc5('0x1c')]+_0x5be60b['limit'],_0x2f943f;if(_0x24048e>=_0x4aecad){_0x24048e=_0x4aecad;_0x2f943f=0xc8;}else{_0x2f943f=0xce;}_0x52d3da[_0xebc5('0x1a')](_0x2f943f);return _0x52d3da[_0xebc5('0x1d')](_0xebc5('0x1e'),_0x5a9caf+'-'+_0x24048e+'/'+_0x4aecad)[_0xebc5('0x1f')](_0x2d2020);}return null;};}function patchUpdates(_0xfe2874){return function(_0x458669){try{jsonpatch[_0xebc5('0x20')](_0x458669,_0xfe2874,!![]);}catch(_0x27f5c4){return BPromise[_0xebc5('0x21')](_0x27f5c4);}return _0x458669['save']();};}function saveUpdates(_0x1579e0,_0x5905d7){return function(_0x27918b){if(_0x27918b){return _0x27918b[_0xebc5('0x22')](_0x1579e0)[_0xebc5('0x23')](function(_0x3078f2){return _0x3078f2;});}return null;};}function removeEntity(_0x1394e1,_0x487f52){return function(_0x1522b0){if(_0x1522b0){return _0x1522b0[_0xebc5('0x24')]()[_0xebc5('0x23')](function(){_0x1394e1[_0xebc5('0x1a')](0xcc)[_0xebc5('0x1b')]();});}};}function handleEntityNotFound(_0x265ba9,_0xa05d87){return function(_0x560ac6){if(!_0x560ac6){_0x265ba9[_0xebc5('0x25')](0x194);}return _0x560ac6;};}function handleError(_0x38c781,_0x27b62a){_0x27b62a=_0x27b62a||0x1f4;return function(_0x5ec1cf){logger[_0xebc5('0x26')](_0x5ec1cf[_0xebc5('0x27')]);if(_0x5ec1cf[_0xebc5('0x28')]){delete _0x5ec1cf[_0xebc5('0x28')];}_0x38c781[_0xebc5('0x1a')](_0x27b62a)[_0xebc5('0x29')](_0x5ec1cf);};}exports['index']=function(_0x1808f2,_0x15b01b){var _0x327611={},_0x4cd9d9={},_0x74fa1f={'count':0x0,'rows':[]};var _0x56bae=_[_0xebc5('0x2a')](db[_0xebc5('0x2b')][_0xebc5('0x2c')],function(_0x132acf){return{'name':_0x132acf['fieldName'],'type':_0x132acf['type'][_0xebc5('0x2d')]};});_0x4cd9d9[_0xebc5('0x2e')]=_[_0xebc5('0x2a')](_0x56bae,'name');_0x4cd9d9[_0xebc5('0x2f')]=_['keys'](_0x1808f2[_0xebc5('0x2f')]);_0x4cd9d9[_0xebc5('0x30')]=_[_0xebc5('0x31')](_0x4cd9d9[_0xebc5('0x2e')],_0x4cd9d9[_0xebc5('0x2f')]);_0x327611['attributes']=_[_0xebc5('0x31')](_0x4cd9d9[_0xebc5('0x2e')],qs[_0xebc5('0x32')](_0x1808f2['query'][_0xebc5('0x32')]));_0x327611['attributes']=_0x327611[_0xebc5('0x33')][_0xebc5('0x34')]?_0x327611['attributes']:_0x4cd9d9[_0xebc5('0x2e')];if(!_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x35')](_0xebc5('0x36'))){_0x327611['limit']=qs[_0xebc5('0x37')](_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x37')]);_0x327611[_0xebc5('0x1c')]=qs[_0xebc5('0x1c')](_0x1808f2['query'][_0xebc5('0x1c')]);}_0x327611[_0xebc5('0x38')]=qs[_0xebc5('0x39')](_0x1808f2[_0xebc5('0x2f')]['sort']);_0x327611[_0xebc5('0x3a')]=qs[_0xebc5('0x30')](_[_0xebc5('0x3b')](_0x1808f2[_0xebc5('0x2f')],_0x4cd9d9['filters']),_0x56bae);if(_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x3c')]){_0x327611[_0xebc5('0x3a')]=_[_0xebc5('0x3d')](_0x327611[_0xebc5('0x3a')],{'$or':_[_0xebc5('0x2a')](_0x56bae,function(_0x1610f6){if(_0x1610f6['type']!=='VIRTUAL'){var _0x2385a5={};_0x2385a5[_0x1610f6[_0xebc5('0x28')]]={'$like':'%'+_0x1808f2[_0xebc5('0x2f')][_0xebc5('0x3c')]+'%'};return _0x2385a5;}})});}_0x327611=_[_0xebc5('0x3d')]({},_0x327611,_0x1808f2[_0xebc5('0x3e')]);var _0xa7a9f8={'where':_0x327611[_0xebc5('0x3a')]};return db[_0xebc5('0x2b')][_0xebc5('0x3f')](_0xa7a9f8)[_0xebc5('0x23')](function(_0x594c3c){_0x74fa1f[_0xebc5('0x3f')]=_0x594c3c;if(_0x1808f2['query'][_0xebc5('0x40')]){_0x327611[_0xebc5('0x41')]=[{'all':!![]}];}return db[_0xebc5('0x2b')][_0xebc5('0x42')](_0x327611);})[_0xebc5('0x23')](function(_0xc1fdf7){_0x74fa1f[_0xebc5('0x43')]=_0xc1fdf7;return _0x74fa1f;})[_0xebc5('0x23')](respondWithFilteredResult(_0x15b01b,_0x327611))[_0xebc5('0x44')](handleError(_0x15b01b,null));};exports[_0xebc5('0x45')]=function(_0x82edd1,_0x413396){var _0x2b4c79={'raw':!![],'where':{'id':_0x82edd1[_0xebc5('0x46')]['id']}},_0x44c7b3={};_0x44c7b3[_0xebc5('0x2e')]=_['keys'](db[_0xebc5('0x2b')][_0xebc5('0x2c')]);_0x44c7b3[_0xebc5('0x2f')]=_[_0xebc5('0x47')](_0x82edd1[_0xebc5('0x2f')]);_0x44c7b3[_0xebc5('0x30')]=_[_0xebc5('0x31')](_0x44c7b3['model'],_0x44c7b3[_0xebc5('0x2f')]);_0x2b4c79[_0xebc5('0x33')]=_['intersection'](_0x44c7b3[_0xebc5('0x2e')],qs[_0xebc5('0x32')](_0x82edd1['query'][_0xebc5('0x32')]));_0x2b4c79[_0xebc5('0x33')]=_0x2b4c79[_0xebc5('0x33')][_0xebc5('0x34')]?_0x2b4c79[_0xebc5('0x33')]:_0x44c7b3[_0xebc5('0x2e')];if(_0x82edd1['query']['includeAll']){_0x2b4c79['include']=[{'all':!![]}];}_0x2b4c79=_[_0xebc5('0x3d')]({},_0x2b4c79,_0x82edd1[_0xebc5('0x3e')]);return db[_0xebc5('0x2b')]['find'](_0x2b4c79)[_0xebc5('0x23')](handleEntityNotFound(_0x413396,null))[_0xebc5('0x23')](respondWithResult(_0x413396,null))[_0xebc5('0x44')](handleError(_0x413396,null));};exports[_0xebc5('0x48')]=function(_0x2b2f5c,_0x383ebc){return db[_0xebc5('0x2b')][_0xebc5('0x48')](_0x2b2f5c[_0xebc5('0x49')],{})['then'](respondWithResult(_0x383ebc,0xc9))[_0xebc5('0x44')](handleError(_0x383ebc,null));};exports[_0xebc5('0x22')]=function(_0x545880,_0x3ce4fb){if(_0x545880['body']['id']){delete _0x545880['body']['id'];}return db['OpenchannelTransferReport'][_0xebc5('0x4a')]({'where':{'id':_0x545880[_0xebc5('0x46')]['id']}})[_0xebc5('0x23')](handleEntityNotFound(_0x3ce4fb,null))[_0xebc5('0x23')](saveUpdates(_0x545880[_0xebc5('0x49')],null))[_0xebc5('0x23')](respondWithResult(_0x3ce4fb,null))[_0xebc5('0x44')](handleError(_0x3ce4fb,null));};exports[_0xebc5('0x24')]=function(_0x119339,_0xd24be2){return db['OpenchannelTransferReport'][_0xebc5('0x4a')]({'where':{'id':_0x119339[_0xebc5('0x46')]['id']}})[_0xebc5('0x23')](handleEntityNotFound(_0xd24be2,null))['then'](removeEntity(_0xd24be2,null))[_0xebc5('0x44')](handleError(_0xd24be2,null));};exports[_0xebc5('0x4b')]=function(_0x1f05d0,_0x27ff06){return db[_0xebc5('0x2b')][_0xebc5('0x4b')]()[_0xebc5('0x23')](respondWithResult(_0x27ff06,null))[_0xebc5('0x44')](handleError(_0x27ff06,null));}; \ No newline at end of file +var _0x9c0d=['rows','show','params','options','find','catch','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x42c3b8,_0x2a76ac){var _0x82276f=function(_0x1b8471){while(--_0x1b8471){_0x42c3b8['push'](_0x42c3b8['shift']());}};_0x82276f(++_0x2a76ac);}(_0x9c0d,0x97));var _0xd9c0=function(_0xd92652,_0x59f24a){_0xd92652=_0xd92652-0x0;var _0x17ba47=_0x9c0d[_0xd92652];return _0x17ba47;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9c0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9c0('0x1'));var moment=require(_0xd9c0('0x2'));var BPromise=require(_0xd9c0('0x3'));var Mustache=require(_0xd9c0('0x4'));var util=require(_0xd9c0('0x5'));var path=require(_0xd9c0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9c0('0x7'));var fs=require('fs');var _=require(_0xd9c0('0x8'));var squel=require(_0xd9c0('0x9'));var crypto=require(_0xd9c0('0xa'));var jsforce=require(_0xd9c0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd9c0('0xc'));var querystring=require(_0xd9c0('0xd'));var Papa=require('papaparse');var Redis=require(_0xd9c0('0xe'));var authService=require(_0xd9c0('0xf'));var qs=require(_0xd9c0('0x10'));var as=require(_0xd9c0('0x11'));var hardwareService=require(_0xd9c0('0x12'));var logger=require(_0xd9c0('0x13'))(_0xd9c0('0x14'));var utils=require(_0xd9c0('0x15'));var config=require('../../config/environment');var db=require(_0xd9c0('0x16'))['db'];function respondWithStatusCode(_0x1061f0,_0xd6189c){_0xd6189c=_0xd6189c||0xcc;return function(_0x37be6c){if(_0x37be6c){return _0x1061f0[_0xd9c0('0x17')](_0xd6189c);}return _0x1061f0[_0xd9c0('0x18')](_0xd6189c)[_0xd9c0('0x19')]();};}function respondWithResult(_0x40225c,_0x24a7ec){_0x24a7ec=_0x24a7ec||0xc8;return function(_0xe06d18){if(_0xe06d18){return _0x40225c[_0xd9c0('0x18')](_0x24a7ec)[_0xd9c0('0x1a')](_0xe06d18);}};}function respondWithFilteredResult(_0x232687,_0x2d5e9b){return function(_0x3cd844){if(_0x3cd844){var _0x4de75b=_0x3cd844[_0xd9c0('0x1b')],_0x3e3df1=_0x2d5e9b[_0xd9c0('0x1c')],_0x406ebc=_0x2d5e9b['offset']+_0x2d5e9b[_0xd9c0('0x1d')],_0x177fa5;if(_0x406ebc>=_0x4de75b){_0x406ebc=_0x4de75b;_0x177fa5=0xc8;}else{_0x177fa5=0xce;}_0x232687[_0xd9c0('0x18')](_0x177fa5);return _0x232687[_0xd9c0('0x1e')](_0xd9c0('0x1f'),_0x3e3df1+'-'+_0x406ebc+'/'+_0x4de75b)[_0xd9c0('0x1a')](_0x3cd844);}return null;};}function patchUpdates(_0x4238f3){return function(_0x278868){try{jsonpatch['apply'](_0x278868,_0x4238f3,!![]);}catch(_0x1303b5){return BPromise[_0xd9c0('0x20')](_0x1303b5);}return _0x278868['save']();};}function saveUpdates(_0x13b76b,_0xd5ee4a){return function(_0x354510){if(_0x354510){return _0x354510[_0xd9c0('0x21')](_0x13b76b)[_0xd9c0('0x22')](function(_0x5e17ce){return _0x5e17ce;});}return null;};}function removeEntity(_0x183c4d,_0x45cbd3){return function(_0x207e3f){if(_0x207e3f){return _0x207e3f[_0xd9c0('0x23')]()[_0xd9c0('0x22')](function(){_0x183c4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa4847f,_0x34a2a8){return function(_0x392376){if(!_0x392376){_0xa4847f['sendStatus'](0x194);}return _0x392376;};}function handleError(_0x515367,_0x3a3089){_0x3a3089=_0x3a3089||0x1f4;return function(_0xc0c48f){logger['error'](_0xc0c48f['stack']);if(_0xc0c48f[_0xd9c0('0x24')]){delete _0xc0c48f['name'];}_0x515367[_0xd9c0('0x18')](_0x3a3089)[_0xd9c0('0x25')](_0xc0c48f);};}exports['index']=function(_0x850fdf,_0x129820){var _0x132477={},_0x4247f9={},_0x72b7e2={'count':0x0,'rows':[]};var _0x313e72=_[_0xd9c0('0x26')](db[_0xd9c0('0x27')][_0xd9c0('0x28')],function(_0x464192){return{'name':_0x464192[_0xd9c0('0x29')],'type':_0x464192[_0xd9c0('0x2a')]['key']};});_0x4247f9[_0xd9c0('0x2b')]=_[_0xd9c0('0x26')](_0x313e72,_0xd9c0('0x24'));_0x4247f9[_0xd9c0('0x2c')]=_[_0xd9c0('0x2d')](_0x850fdf['query']);_0x4247f9[_0xd9c0('0x2e')]=_[_0xd9c0('0x2f')](_0x4247f9['model'],_0x4247f9[_0xd9c0('0x2c')]);_0x132477[_0xd9c0('0x30')]=_[_0xd9c0('0x2f')](_0x4247f9[_0xd9c0('0x2b')],qs['fields'](_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x31')]));_0x132477[_0xd9c0('0x30')]=_0x132477['attributes'][_0xd9c0('0x32')]?_0x132477[_0xd9c0('0x30')]:_0x4247f9['model'];if(!_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x33')](_0xd9c0('0x34'))){_0x132477[_0xd9c0('0x1d')]=qs['limit'](_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x1d')]);_0x132477[_0xd9c0('0x1c')]=qs['offset'](_0x850fdf['query'][_0xd9c0('0x1c')]);}_0x132477[_0xd9c0('0x35')]=qs[_0xd9c0('0x36')](_0x850fdf['query']['sort']);_0x132477[_0xd9c0('0x37')]=qs[_0xd9c0('0x2e')](_[_0xd9c0('0x38')](_0x850fdf[_0xd9c0('0x2c')],_0x4247f9[_0xd9c0('0x2e')]),_0x313e72);if(_0x850fdf[_0xd9c0('0x2c')][_0xd9c0('0x39')]){_0x132477[_0xd9c0('0x37')]=_[_0xd9c0('0x3a')](_0x132477[_0xd9c0('0x37')],{'$or':_['map'](_0x313e72,function(_0x5466b4){if(_0x5466b4[_0xd9c0('0x2a')]!==_0xd9c0('0x3b')){var _0x3f863b={};_0x3f863b[_0x5466b4[_0xd9c0('0x24')]]={'$like':'%'+_0x850fdf[_0xd9c0('0x2c')]['filter']+'%'};return _0x3f863b;}})});}_0x132477=_['merge']({},_0x132477,_0x850fdf['options']);var _0x46ccd9={'where':_0x132477[_0xd9c0('0x37')]};return db[_0xd9c0('0x27')]['count'](_0x46ccd9)[_0xd9c0('0x22')](function(_0x1e05a8){_0x72b7e2[_0xd9c0('0x1b')]=_0x1e05a8;if(_0x850fdf['query'][_0xd9c0('0x3c')]){_0x132477[_0xd9c0('0x3d')]=[{'all':!![]}];}return db[_0xd9c0('0x27')]['findAll'](_0x132477);})[_0xd9c0('0x22')](function(_0x47b3b3){_0x72b7e2[_0xd9c0('0x3e')]=_0x47b3b3;return _0x72b7e2;})[_0xd9c0('0x22')](respondWithFilteredResult(_0x129820,_0x132477))['catch'](handleError(_0x129820,null));};exports[_0xd9c0('0x3f')]=function(_0x20beff,_0x4d455d){var _0x5e7de7={'raw':!![],'where':{'id':_0x20beff[_0xd9c0('0x40')]['id']}},_0x14310f={};_0x14310f['model']=_['keys'](db[_0xd9c0('0x27')]['rawAttributes']);_0x14310f['query']=_['keys'](_0x20beff[_0xd9c0('0x2c')]);_0x14310f[_0xd9c0('0x2e')]=_[_0xd9c0('0x2f')](_0x14310f['model'],_0x14310f['query']);_0x5e7de7[_0xd9c0('0x30')]=_[_0xd9c0('0x2f')](_0x14310f['model'],qs[_0xd9c0('0x31')](_0x20beff['query'][_0xd9c0('0x31')]));_0x5e7de7['attributes']=_0x5e7de7[_0xd9c0('0x30')][_0xd9c0('0x32')]?_0x5e7de7[_0xd9c0('0x30')]:_0x14310f[_0xd9c0('0x2b')];if(_0x20beff['query'][_0xd9c0('0x3c')]){_0x5e7de7[_0xd9c0('0x3d')]=[{'all':!![]}];}_0x5e7de7=_[_0xd9c0('0x3a')]({},_0x5e7de7,_0x20beff[_0xd9c0('0x41')]);return db[_0xd9c0('0x27')][_0xd9c0('0x42')](_0x5e7de7)[_0xd9c0('0x22')](handleEntityNotFound(_0x4d455d,null))[_0xd9c0('0x22')](respondWithResult(_0x4d455d,null))[_0xd9c0('0x43')](handleError(_0x4d455d,null));};exports[_0xd9c0('0x44')]=function(_0x38bfc0,_0x93048){return db['OpenchannelTransferReport'][_0xd9c0('0x44')](_0x38bfc0['body'],{})[_0xd9c0('0x22')](respondWithResult(_0x93048,0xc9))['catch'](handleError(_0x93048,null));};exports['update']=function(_0x5e2db6,_0x27aac3){if(_0x5e2db6[_0xd9c0('0x45')]['id']){delete _0x5e2db6[_0xd9c0('0x45')]['id'];}return db[_0xd9c0('0x27')]['find']({'where':{'id':_0x5e2db6[_0xd9c0('0x40')]['id']}})[_0xd9c0('0x22')](handleEntityNotFound(_0x27aac3,null))[_0xd9c0('0x22')](saveUpdates(_0x5e2db6[_0xd9c0('0x45')],null))[_0xd9c0('0x22')](respondWithResult(_0x27aac3,null))[_0xd9c0('0x43')](handleError(_0x27aac3,null));};exports[_0xd9c0('0x23')]=function(_0x1630fa,_0x5c65be){return db[_0xd9c0('0x27')]['find']({'where':{'id':_0x1630fa[_0xd9c0('0x40')]['id']}})[_0xd9c0('0x22')](handleEntityNotFound(_0x5c65be,null))[_0xd9c0('0x22')](removeEntity(_0x5c65be,null))[_0xd9c0('0x43')](handleError(_0x5c65be,null));};exports[_0xd9c0('0x46')]=function(_0x373802,_0x518473){return db[_0xd9c0('0x27')]['describe']()[_0xd9c0('0x22')](respondWithResult(_0x518473,null))[_0xd9c0('0x43')](handleError(_0x518473,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3ea2f64..69a0edd 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 _0x8cad=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x8cad,0xfe));var _0xd8ca=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x8cad[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var logger=require(_0xd8ca('0x2'))(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require(_0xd8ca('0x5'));var rp=require(_0xd8ca('0x6'));var fs=require('fs');var path=require(_0xd8ca('0x7'));var rimraf=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var attributes=require(_0xd8ca('0xa'));module[_0xd8ca('0xb')]=function(_0x14c73e,_0x6d5070){return _0x14c73e['define'](_0xd8ca('0xc'),attributes,{'tableName':_0xd8ca('0xd'),'paranoid':![],'indexes':[{'name':_0xd8ca('0xe'),'fields':[_0xd8ca('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x25b827,_0x2dedc1){var _0x4b7dfd=function(_0x2e8201){while(--_0x2e8201){_0x25b827['push'](_0x25b827['shift']());}};_0x4b7dfd(++_0x2dedc1);}(_0xa46e,0x8a));var _0xea46=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xa46e[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1675f98..a3a2e63 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 _0xf820=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3d7fe8,_0x5d3250){var _0x9c0ea2=function(_0x44d666){while(--_0x44d666){_0x3d7fe8['push'](_0x3d7fe8['shift']());}};_0x9c0ea2(++_0x5d3250);}(_0xf820,0x86));var _0x0f82=function(_0x24fa28,_0x4abfa4){_0x24fa28=_0x24fa28-0x0;var _0x36025f=_0xf820[_0x24fa28];return _0x36025f;};'use strict';var _=require(_0x0f82('0x0'));var util=require(_0x0f82('0x1'));var moment=require(_0x0f82('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f82('0x3'));var fs=require('fs');var Redis=require(_0x0f82('0x4'));var db=require(_0x0f82('0x5'))['db'];var utils=require(_0x0f82('0x6'));var logger=require(_0x0f82('0x7'))(_0x0f82('0x8'));var config=require(_0x0f82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0f82('0xa')][_0x0f82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28df65,_0x40f244,_0x552403){return new BPromise(function(_0x4be7cb,_0x41675f){return client['request'](_0x28df65,_0x552403)[_0x0f82('0xc')](function(_0x22a121){logger['info'](_0x0f82('0xd'),_0x40f244,_0x0f82('0xe'));logger[_0x0f82('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x40f244,_0x0f82('0xe'),JSON[_0x0f82('0x10')](_0x22a121));if(_0x22a121[_0x0f82('0x11')]){if(_0x22a121['error'][_0x0f82('0x12')]===0x1f4){logger[_0x0f82('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40f244,_0x22a121[_0x0f82('0x11')]['message']);return _0x41675f(_0x22a121['error'][_0x0f82('0x13')]);}logger[_0x0f82('0x11')](_0x0f82('0xd'),_0x40f244,_0x22a121[_0x0f82('0x11')]['message']);return _0x4be7cb(_0x22a121[_0x0f82('0x11')][_0x0f82('0x13')]);}else{logger['info'](_0x0f82('0xd'),_0x40f244,'request\x20sent');_0x4be7cb(_0x22a121[_0x0f82('0x14')]['message']);}})['catch'](function(_0x3df176){logger['error'](_0x0f82('0xd'),_0x40f244,_0x3df176);_0x41675f(_0x3df176);});});} \ No newline at end of file +var _0x8f85=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x32897b,_0x21bee8){var _0x4394ce=function(_0x2b7a5b){while(--_0x2b7a5b){_0x32897b['push'](_0x32897b['shift']());}};_0x4394ce(++_0x21bee8);}(_0x8f85,0x1b5));var _0x58f8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x8f85[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x58f8('0x0'));var util=require(_0x58f8('0x1'));var moment=require('moment');var BPromise=require(_0x58f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x58f8('0x4'))(_0x58f8('0x5'));var config=require(_0x58f8('0x6'));var jayson=require(_0x58f8('0x7'));var client=jayson[_0x58f8('0x8')][_0x58f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad1c1,_0x481e3b,_0x4190ef){return new BPromise(function(_0x26b365,_0x51f7f1){return client[_0x58f8('0xa')](_0x3ad1c1,_0x4190ef)[_0x58f8('0xb')](function(_0xeb7bfc){logger[_0x58f8('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x481e3b,_0x58f8('0xd'));logger['debug'](_0x58f8('0xe'),_0x481e3b,_0x58f8('0xd'),JSON[_0x58f8('0xf')](_0xeb7bfc));if(_0xeb7bfc[_0x58f8('0x10')]){if(_0xeb7bfc[_0x58f8('0x10')][_0x58f8('0x11')]===0x1f4){logger[_0x58f8('0x10')](_0x58f8('0x12'),_0x481e3b,_0xeb7bfc['error'][_0x58f8('0x13')]);return _0x51f7f1(_0xeb7bfc[_0x58f8('0x10')]['message']);}logger[_0x58f8('0x10')](_0x58f8('0x12'),_0x481e3b,_0xeb7bfc[_0x58f8('0x10')][_0x58f8('0x13')]);return _0x26b365(_0xeb7bfc[_0x58f8('0x10')][_0x58f8('0x13')]);}else{logger['info'](_0x58f8('0x12'),_0x481e3b,_0x58f8('0xd'));_0x26b365(_0xeb7bfc[_0x58f8('0x14')][_0x58f8('0x13')]);}})[_0x58f8('0x15')](function(_0x57a0a4){logger[_0x58f8('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x481e3b,_0x57a0a4);_0x51f7f1(_0x57a0a4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f6eab7c..eecda6c 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 _0x91d4=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update'];(function(_0xdab3da,_0xc05e3b){var _0x524d1b=function(_0x4d47b5){while(--_0x4d47b5){_0xdab3da['push'](_0xdab3da['shift']());}};_0x524d1b(++_0xc05e3b);}(_0x91d4,0x19b));var _0x491d=function(_0x3fb22d,_0x4d997b){_0x3fb22d=_0x3fb22d-0x0;var _0x42b188=_0x91d4[_0x3fb22d];return _0x42b188;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x491d('0x0'));var timeout=require(_0x491d('0x1'));var express=require(_0x491d('0x2'));var router=express[_0x491d('0x3')]();var auth=require(_0x491d('0x4'));var interaction=require(_0x491d('0x5'));var config=require(_0x491d('0x6'));var controller=require('./pause.controller');router[_0x491d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x491d('0x8'),auth[_0x491d('0x9')](),controller[_0x491d('0xa')]);router[_0x491d('0xb')]('/',auth[_0x491d('0x9')](),controller['create']);router[_0x491d('0xc')](_0x491d('0x8'),auth['isAuthenticated'](),controller[_0x491d('0xd')]);router[_0x491d('0xe')](_0x491d('0x8'),auth['isAuthenticated'](),controller[_0x491d('0xf')]);module[_0x491d('0x10')]=router; \ No newline at end of file +var _0x60a7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x60a7,0x130));var _0x760a=function(_0x4da368,_0x15a3f7){_0x4da368=_0x4da368-0x0;var _0xc3b022=_0x60a7[_0x4da368];return _0xc3b022;};'use strict';var multer=require(_0x760a('0x0'));var util=require('util');var path=require(_0x760a('0x1'));var timeout=require(_0x760a('0x2'));var express=require(_0x760a('0x3'));var router=express[_0x760a('0x4')]();var auth=require(_0x760a('0x5'));var interaction=require(_0x760a('0x6'));var config=require(_0x760a('0x7'));var controller=require('./pause.controller');router[_0x760a('0x8')]('/',auth[_0x760a('0x9')](),controller['index']);router[_0x760a('0x8')](_0x760a('0xa'),auth[_0x760a('0x9')](),controller[_0x760a('0xb')]);router[_0x760a('0xc')]('/',auth['isAuthenticated'](),controller[_0x760a('0xd')]);router[_0x760a('0xe')](_0x760a('0xa'),auth[_0x760a('0x9')](),controller[_0x760a('0xf')]);router['delete'](_0x760a('0xa'),auth[_0x760a('0x9')](),controller['destroy']);module[_0x760a('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 03e0e21..f175ccc 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 _0x7075=['STRING','sequelize'];(function(_0xd2b907,_0x1d769b){var _0x2cde42=function(_0x1baddc){while(--_0x1baddc){_0xd2b907['push'](_0xd2b907['shift']());}};_0x2cde42(++_0x1d769b);}(_0x7075,0xd7));var _0x5707=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7075[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5707('0x0'));module['exports']={'name':{'type':Sequelize[_0x5707('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8782=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8782,0x17a));var _0x2878=function(_0x1d48e9,_0x5f4e70){_0x1d48e9=_0x1d48e9-0x0;var _0x2d9b80=_0x8782[_0x1d48e9];return _0x2d9b80;};'use strict';var Sequelize=require(_0x2878('0x0'));module[_0x2878('0x1')]={'name':{'type':Sequelize[_0x2878('0x2')],'unique':_0x2878('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2878('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9a5eed9..90f55e7 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 _0x2ec1=['sort','where','map','VIRTUAL','filter','merge','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','index','Pause','rawAttributes','fieldName','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order'];(function(_0xae43d3,_0x5c8e96){var _0x5b6e06=function(_0x401a4d){while(--_0x401a4d){_0xae43d3['push'](_0xae43d3['shift']());}};_0x5b6e06(++_0x5c8e96);}(_0x2ec1,0x1b0));var _0x12ec=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2ec1[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require(_0x12ec('0x0'));var emlformat=require(_0x12ec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x12ec('0x2'));var jsonpatch=require(_0x12ec('0x3'));var rp=require(_0x12ec('0x4'));var moment=require('moment');var BPromise=require(_0x12ec('0x5'));var Mustache=require('mustache');var util=require(_0x12ec('0x6'));var path=require(_0x12ec('0x7'));var sox=require(_0x12ec('0x8'));var csv=require(_0x12ec('0x9'));var ejs=require(_0x12ec('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12ec('0xb'));var crypto=require(_0x12ec('0xc'));var jsforce=require(_0x12ec('0xd'));var deskjs=require(_0x12ec('0xe'));var toCsv=require(_0x12ec('0x9'));var querystring=require(_0x12ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x12ec('0x10'));var authService=require(_0x12ec('0x11'));var qs=require(_0x12ec('0x12'));var as=require(_0x12ec('0x13'));var hardwareService=require(_0x12ec('0x14'));var logger=require(_0x12ec('0x15'))(_0x12ec('0x16'));var utils=require('../../config/utils');var config=require(_0x12ec('0x17'));var db=require(_0x12ec('0x18'))['db'];function respondWithStatusCode(_0x4a5665,_0x3e9c6b){_0x3e9c6b=_0x3e9c6b||0xcc;return function(_0x2fc0e3){if(_0x2fc0e3){return _0x4a5665['sendStatus'](_0x3e9c6b);}return _0x4a5665['status'](_0x3e9c6b)[_0x12ec('0x19')]();};}function respondWithResult(_0x524e9c,_0x3cec38){_0x3cec38=_0x3cec38||0xc8;return function(_0x5e3940){if(_0x5e3940){return _0x524e9c[_0x12ec('0x1a')](_0x3cec38)['json'](_0x5e3940);}};}function respondWithFilteredResult(_0x30ccdf,_0x79442f){return function(_0x1c554c){if(_0x1c554c){var _0x221fa7=_0x1c554c[_0x12ec('0x1b')],_0x49aa0c=_0x79442f[_0x12ec('0x1c')],_0x36802f=_0x79442f[_0x12ec('0x1c')]+_0x79442f[_0x12ec('0x1d')],_0x58a684;if(_0x36802f>=_0x221fa7){_0x36802f=_0x221fa7;_0x58a684=0xc8;}else{_0x58a684=0xce;}_0x30ccdf[_0x12ec('0x1a')](_0x58a684);return _0x30ccdf['set'](_0x12ec('0x1e'),_0x49aa0c+'-'+_0x36802f+'/'+_0x221fa7)[_0x12ec('0x1f')](_0x1c554c);}return null;};}function patchUpdates(_0x5cf0e9){return function(_0x42fc7d){try{jsonpatch[_0x12ec('0x20')](_0x42fc7d,_0x5cf0e9,!![]);}catch(_0x4f0476){return BPromise[_0x12ec('0x21')](_0x4f0476);}return _0x42fc7d[_0x12ec('0x22')]();};}function saveUpdates(_0x35dd4c,_0x276c19){return function(_0x453603){if(_0x453603){return _0x453603[_0x12ec('0x23')](_0x35dd4c)[_0x12ec('0x24')](function(_0x377024){return _0x377024;});}return null;};}function removeEntity(_0x20fb76,_0x5aa4b8){return function(_0x2e07e4){if(_0x2e07e4){return _0x2e07e4[_0x12ec('0x25')]()['then'](function(){var _0x46deee=_0x2e07e4[_0x12ec('0x26')]({'plain':!![]});var _0x1524f3=_0x12ec('0x27');return db[_0x12ec('0x28')][_0x12ec('0x25')]({'where':{'type':_0x1524f3,'resourceId':_0x46deee['id']}})[_0x12ec('0x24')](function(){return _0x2e07e4;});})[_0x12ec('0x24')](function(){_0x20fb76[_0x12ec('0x1a')](0xcc)[_0x12ec('0x19')]();});}};}function handleEntityNotFound(_0x521e7e,_0x55a635){return function(_0x4f0421){if(!_0x4f0421){_0x521e7e[_0x12ec('0x29')](0x194);}return _0x4f0421;};}function handleError(_0x27c1cd,_0x2ad070){_0x2ad070=_0x2ad070||0x1f4;return function(_0x316571){logger[_0x12ec('0x2a')](_0x316571[_0x12ec('0x2b')]);if(_0x316571[_0x12ec('0x2c')]){delete _0x316571[_0x12ec('0x2c')];}_0x27c1cd[_0x12ec('0x1a')](_0x2ad070)['send'](_0x316571);};}exports[_0x12ec('0x2d')]=function(_0xea1849,_0x199c2a){var _0x2ffecb={},_0x206deb={},_0x450c84={'count':0x0,'rows':[]};var _0x5aa028=_['map'](db[_0x12ec('0x2e')][_0x12ec('0x2f')],function(_0xaffbbd){return{'name':_0xaffbbd[_0x12ec('0x30')],'type':_0xaffbbd[_0x12ec('0x31')]['key']};});_0x206deb[_0x12ec('0x32')]=_['map'](_0x5aa028,'name');_0x206deb['query']=_['keys'](_0xea1849['query']);_0x206deb[_0x12ec('0x33')]=_[_0x12ec('0x34')](_0x206deb[_0x12ec('0x32')],_0x206deb['query']);_0x2ffecb[_0x12ec('0x35')]=_['intersection'](_0x206deb[_0x12ec('0x32')],qs[_0x12ec('0x36')](_0xea1849[_0x12ec('0x37')][_0x12ec('0x36')]));_0x2ffecb[_0x12ec('0x35')]=_0x2ffecb[_0x12ec('0x35')][_0x12ec('0x38')]?_0x2ffecb[_0x12ec('0x35')]:_0x206deb[_0x12ec('0x32')];if(!_0xea1849[_0x12ec('0x37')][_0x12ec('0x39')](_0x12ec('0x3a'))){_0x2ffecb[_0x12ec('0x1d')]=qs['limit'](_0xea1849[_0x12ec('0x37')]['limit']);_0x2ffecb[_0x12ec('0x1c')]=qs['offset'](_0xea1849['query']['offset']);}_0x2ffecb[_0x12ec('0x3b')]=qs[_0x12ec('0x3c')](_0xea1849[_0x12ec('0x37')][_0x12ec('0x3c')]);_0x2ffecb[_0x12ec('0x3d')]=qs[_0x12ec('0x33')](_['pick'](_0xea1849[_0x12ec('0x37')],_0x206deb['filters']),_0x5aa028);if(_0xea1849['query']['filter']){_0x2ffecb[_0x12ec('0x3d')]=_['merge'](_0x2ffecb[_0x12ec('0x3d')],{'$or':_[_0x12ec('0x3e')](_0x5aa028,function(_0x47a7f3){if(_0x47a7f3[_0x12ec('0x31')]!==_0x12ec('0x3f')){var _0x496338={};_0x496338[_0x47a7f3[_0x12ec('0x2c')]]={'$like':'%'+_0xea1849[_0x12ec('0x37')][_0x12ec('0x40')]+'%'};return _0x496338;}})});}_0x2ffecb=_[_0x12ec('0x41')]({},_0x2ffecb,_0xea1849['options']);var _0x3ab218={'where':_0x2ffecb[_0x12ec('0x3d')]};return db[_0x12ec('0x2e')]['count'](_0x3ab218)['then'](function(_0x100702){_0x450c84[_0x12ec('0x1b')]=_0x100702;if(_0xea1849['query']['includeAll']){_0x2ffecb[_0x12ec('0x42')]=[{'all':!![]}];}return db[_0x12ec('0x2e')][_0x12ec('0x43')](_0x2ffecb);})[_0x12ec('0x24')](function(_0x2ebfd8){_0x450c84['rows']=_0x2ebfd8;return _0x450c84;})['then'](respondWithFilteredResult(_0x199c2a,_0x2ffecb))[_0x12ec('0x44')](handleError(_0x199c2a,null));};exports[_0x12ec('0x45')]=function(_0x1e5b02,_0x2a1abe){var _0x16a758={'raw':!![],'where':{'id':_0x1e5b02[_0x12ec('0x46')]['id']}},_0x5c9f9b={};_0x5c9f9b[_0x12ec('0x32')]=_['keys'](db[_0x12ec('0x2e')]['rawAttributes']);_0x5c9f9b[_0x12ec('0x37')]=_[_0x12ec('0x47')](_0x1e5b02[_0x12ec('0x37')]);_0x5c9f9b['filters']=_[_0x12ec('0x34')](_0x5c9f9b[_0x12ec('0x32')],_0x5c9f9b['query']);_0x16a758[_0x12ec('0x35')]=_[_0x12ec('0x34')](_0x5c9f9b[_0x12ec('0x32')],qs[_0x12ec('0x36')](_0x1e5b02['query'][_0x12ec('0x36')]));_0x16a758[_0x12ec('0x35')]=_0x16a758[_0x12ec('0x35')]['length']?_0x16a758[_0x12ec('0x35')]:_0x5c9f9b[_0x12ec('0x32')];if(_0x1e5b02[_0x12ec('0x37')][_0x12ec('0x48')]){_0x16a758[_0x12ec('0x42')]=[{'all':!![]}];}_0x16a758=_[_0x12ec('0x41')]({},_0x16a758,_0x1e5b02[_0x12ec('0x49')]);return db[_0x12ec('0x2e')][_0x12ec('0x4a')](_0x16a758)[_0x12ec('0x24')](handleEntityNotFound(_0x2a1abe,null))[_0x12ec('0x24')](respondWithResult(_0x2a1abe,null))[_0x12ec('0x44')](handleError(_0x2a1abe,null));};exports[_0x12ec('0x4b')]=function(_0x309f2f,_0x10942b){return db[_0x12ec('0x2e')]['create'](_0x309f2f[_0x12ec('0x4c')],{})['then'](function(_0x1fc764){var _0x3f6a3f=_0x309f2f['user'][_0x12ec('0x26')]({'plain':!![]});if(!_0x3f6a3f)throw new Error(_0x12ec('0x4d'));if(_0x3f6a3f['role']==='user'){var _0x1414c1=_0x1fc764[_0x12ec('0x26')]({'plain':!![]});var _0x45c557=_0x12ec('0x27');return db[_0x12ec('0x4e')]['find']({'where':{'name':_0x45c557,'userProfileId':_0x3f6a3f[_0x12ec('0x4f')]},'raw':!![]})['then'](function(_0x33c9c3){if(_0x33c9c3&&_0x33c9c3[_0x12ec('0x50')]===0x0){return db[_0x12ec('0x28')][_0x12ec('0x4b')]({'name':_0x1414c1[_0x12ec('0x2c')],'resourceId':_0x1414c1['id'],'type':_0x33c9c3[_0x12ec('0x2c')],'sectionId':_0x33c9c3['id']},{})[_0x12ec('0x24')](function(){return _0x1fc764;});}else{return _0x1fc764;}})[_0x12ec('0x44')](function(_0x392879){logger[_0x12ec('0x2a')](_0x12ec('0x51'),_0x392879);throw _0x392879;});}return _0x1fc764;})[_0x12ec('0x24')](respondWithResult(_0x10942b,0xc9))[_0x12ec('0x44')](handleError(_0x10942b,null));};exports[_0x12ec('0x23')]=function(_0x5f0ea2,_0x5ca23a){if(_0x5f0ea2[_0x12ec('0x4c')]['id']){delete _0x5f0ea2[_0x12ec('0x4c')]['id'];}return db['Pause'][_0x12ec('0x4a')]({'where':{'id':_0x5f0ea2[_0x12ec('0x46')]['id']}})[_0x12ec('0x24')](handleEntityNotFound(_0x5ca23a,null))['then'](saveUpdates(_0x5f0ea2[_0x12ec('0x4c')],null))['then'](respondWithResult(_0x5ca23a,null))[_0x12ec('0x44')](handleError(_0x5ca23a,null));};exports[_0x12ec('0x25')]=function(_0x37d7ac,_0x22cfae){return db[_0x12ec('0x2e')]['find']({'where':{'id':_0x37d7ac[_0x12ec('0x46')]['id']}})[_0x12ec('0x24')](handleEntityNotFound(_0x22cfae,null))[_0x12ec('0x24')](removeEntity(_0x22cfae,null))['catch'](handleError(_0x22cfae,null));}; \ No newline at end of file +var _0x6048=['Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6048,0x82));var _0x8604=function(_0x32f616,_0x373411){_0x32f616=_0x32f616-0x0;var _0x52f6ee=_0x6048[_0x32f616];return _0x52f6ee;};'use strict';var pdf=require(_0x8604('0x0'));var emlformat=require(_0x8604('0x1'));var rimraf=require(_0x8604('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8604('0x3'));var moment=require('moment');var BPromise=require(_0x8604('0x4'));var Mustache=require(_0x8604('0x5'));var util=require(_0x8604('0x6'));var path=require(_0x8604('0x7'));var sox=require(_0x8604('0x8'));var csv=require(_0x8604('0x9'));var ejs=require(_0x8604('0xa'));var fs=require('fs');var _=require(_0x8604('0xb'));var squel=require(_0x8604('0xc'));var crypto=require(_0x8604('0xd'));var jsforce=require(_0x8604('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8604('0xf'));var Papa=require(_0x8604('0x10'));var Redis=require(_0x8604('0x11'));var authService=require(_0x8604('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8604('0x13'));var hardwareService=require(_0x8604('0x14'));var logger=require(_0x8604('0x15'))(_0x8604('0x16'));var utils=require('../../config/utils');var config=require(_0x8604('0x17'));var db=require(_0x8604('0x18'))['db'];function respondWithStatusCode(_0xec39b5,_0xff57ae){_0xff57ae=_0xff57ae||0xcc;return function(_0x16758c){if(_0x16758c){return _0xec39b5['sendStatus'](_0xff57ae);}return _0xec39b5[_0x8604('0x19')](_0xff57ae)['end']();};}function respondWithResult(_0x3ec451,_0x3c1338){_0x3c1338=_0x3c1338||0xc8;return function(_0x198e79){if(_0x198e79){return _0x3ec451[_0x8604('0x19')](_0x3c1338)[_0x8604('0x1a')](_0x198e79);}};}function respondWithFilteredResult(_0x4641f1,_0x414924){return function(_0x2b340b){if(_0x2b340b){var _0x3fc0d6=_0x2b340b['count'],_0x2120ac=_0x414924[_0x8604('0x1b')],_0x4a1d62=_0x414924[_0x8604('0x1b')]+_0x414924['limit'],_0x47dce5;if(_0x4a1d62>=_0x3fc0d6){_0x4a1d62=_0x3fc0d6;_0x47dce5=0xc8;}else{_0x47dce5=0xce;}_0x4641f1[_0x8604('0x19')](_0x47dce5);return _0x4641f1['set'](_0x8604('0x1c'),_0x2120ac+'-'+_0x4a1d62+'/'+_0x3fc0d6)[_0x8604('0x1a')](_0x2b340b);}return null;};}function patchUpdates(_0x58ef52){return function(_0x5afc91){try{jsonpatch[_0x8604('0x1d')](_0x5afc91,_0x58ef52,!![]);}catch(_0x45ee47){return BPromise[_0x8604('0x1e')](_0x45ee47);}return _0x5afc91[_0x8604('0x1f')]();};}function saveUpdates(_0x2238f7,_0x3b94d0){return function(_0x349e7b){if(_0x349e7b){return _0x349e7b[_0x8604('0x20')](_0x2238f7)[_0x8604('0x21')](function(_0x19183d){return _0x19183d;});}return null;};}function removeEntity(_0x57bcfa,_0xfafcc){return function(_0x540fce){if(_0x540fce){return _0x540fce[_0x8604('0x22')]()[_0x8604('0x21')](function(){var _0x2848b9=_0x540fce[_0x8604('0x23')]({'plain':!![]});var _0x5a9105=_0x8604('0x24');return db[_0x8604('0x25')]['destroy']({'where':{'type':_0x5a9105,'resourceId':_0x2848b9['id']}})[_0x8604('0x21')](function(){return _0x540fce;});})['then'](function(){_0x57bcfa['status'](0xcc)[_0x8604('0x26')]();});}};}function handleEntityNotFound(_0xf12726,_0x36b9b7){return function(_0x23ddb5){if(!_0x23ddb5){_0xf12726[_0x8604('0x27')](0x194);}return _0x23ddb5;};}function handleError(_0x5b02c5,_0x3efaaf){_0x3efaaf=_0x3efaaf||0x1f4;return function(_0x282f68){logger[_0x8604('0x28')](_0x282f68[_0x8604('0x29')]);if(_0x282f68[_0x8604('0x2a')]){delete _0x282f68[_0x8604('0x2a')];}_0x5b02c5[_0x8604('0x19')](_0x3efaaf)[_0x8604('0x2b')](_0x282f68);};}exports[_0x8604('0x2c')]=function(_0x2526f3,_0x2f9a4e){var _0x12ca82={},_0x122162={},_0x39765e={'count':0x0,'rows':[]};var _0x459dc7=_[_0x8604('0x2d')](db[_0x8604('0x2e')][_0x8604('0x2f')],function(_0x1e894f){return{'name':_0x1e894f[_0x8604('0x30')],'type':_0x1e894f['type'][_0x8604('0x31')]};});_0x122162[_0x8604('0x32')]=_[_0x8604('0x2d')](_0x459dc7,_0x8604('0x2a'));_0x122162[_0x8604('0x33')]=_[_0x8604('0x34')](_0x2526f3[_0x8604('0x33')]);_0x122162[_0x8604('0x35')]=_['intersection'](_0x122162[_0x8604('0x32')],_0x122162[_0x8604('0x33')]);_0x12ca82[_0x8604('0x36')]=_[_0x8604('0x37')](_0x122162[_0x8604('0x32')],qs[_0x8604('0x38')](_0x2526f3['query'][_0x8604('0x38')]));_0x12ca82['attributes']=_0x12ca82[_0x8604('0x36')][_0x8604('0x39')]?_0x12ca82[_0x8604('0x36')]:_0x122162['model'];if(!_0x2526f3['query'][_0x8604('0x3a')]('nolimit')){_0x12ca82[_0x8604('0x3b')]=qs[_0x8604('0x3b')](_0x2526f3[_0x8604('0x33')]['limit']);_0x12ca82[_0x8604('0x1b')]=qs[_0x8604('0x1b')](_0x2526f3[_0x8604('0x33')][_0x8604('0x1b')]);}_0x12ca82['order']=qs['sort'](_0x2526f3[_0x8604('0x33')]['sort']);_0x12ca82[_0x8604('0x3c')]=qs['filters'](_[_0x8604('0x3d')](_0x2526f3[_0x8604('0x33')],_0x122162[_0x8604('0x35')]),_0x459dc7);if(_0x2526f3[_0x8604('0x33')][_0x8604('0x3e')]){_0x12ca82['where']=_[_0x8604('0x3f')](_0x12ca82['where'],{'$or':_[_0x8604('0x2d')](_0x459dc7,function(_0x3d8037){if(_0x3d8037[_0x8604('0x40')]!==_0x8604('0x41')){var _0x203db2={};_0x203db2[_0x3d8037[_0x8604('0x2a')]]={'$like':'%'+_0x2526f3[_0x8604('0x33')]['filter']+'%'};return _0x203db2;}})});}_0x12ca82=_[_0x8604('0x3f')]({},_0x12ca82,_0x2526f3[_0x8604('0x42')]);var _0x606eb0={'where':_0x12ca82[_0x8604('0x3c')]};return db[_0x8604('0x2e')][_0x8604('0x43')](_0x606eb0)[_0x8604('0x21')](function(_0x455a98){_0x39765e[_0x8604('0x43')]=_0x455a98;if(_0x2526f3['query'][_0x8604('0x44')]){_0x12ca82[_0x8604('0x45')]=[{'all':!![]}];}return db[_0x8604('0x2e')][_0x8604('0x46')](_0x12ca82);})[_0x8604('0x21')](function(_0x4a0d9c){_0x39765e[_0x8604('0x47')]=_0x4a0d9c;return _0x39765e;})[_0x8604('0x21')](respondWithFilteredResult(_0x2f9a4e,_0x12ca82))[_0x8604('0x48')](handleError(_0x2f9a4e,null));};exports[_0x8604('0x49')]=function(_0x36e5c0,_0x5f3c6e){var _0x8e02c8={'raw':!![],'where':{'id':_0x36e5c0[_0x8604('0x4a')]['id']}},_0x194404={};_0x194404[_0x8604('0x32')]=_[_0x8604('0x34')](db[_0x8604('0x2e')][_0x8604('0x2f')]);_0x194404[_0x8604('0x33')]=_[_0x8604('0x34')](_0x36e5c0['query']);_0x194404[_0x8604('0x35')]=_[_0x8604('0x37')](_0x194404[_0x8604('0x32')],_0x194404[_0x8604('0x33')]);_0x8e02c8['attributes']=_['intersection'](_0x194404['model'],qs[_0x8604('0x38')](_0x36e5c0[_0x8604('0x33')][_0x8604('0x38')]));_0x8e02c8['attributes']=_0x8e02c8[_0x8604('0x36')][_0x8604('0x39')]?_0x8e02c8[_0x8604('0x36')]:_0x194404[_0x8604('0x32')];if(_0x36e5c0['query'][_0x8604('0x44')]){_0x8e02c8[_0x8604('0x45')]=[{'all':!![]}];}_0x8e02c8=_[_0x8604('0x3f')]({},_0x8e02c8,_0x36e5c0[_0x8604('0x42')]);return db[_0x8604('0x2e')][_0x8604('0x4b')](_0x8e02c8)[_0x8604('0x21')](handleEntityNotFound(_0x5f3c6e,null))[_0x8604('0x21')](respondWithResult(_0x5f3c6e,null))[_0x8604('0x48')](handleError(_0x5f3c6e,null));};exports[_0x8604('0x4c')]=function(_0x4604e3,_0x532c5e){return db[_0x8604('0x2e')]['create'](_0x4604e3[_0x8604('0x4d')],{})[_0x8604('0x21')](function(_0x5ed3eb){var _0x3ca2a2=_0x4604e3[_0x8604('0x4e')][_0x8604('0x23')]({'plain':!![]});if(!_0x3ca2a2)throw new Error(_0x8604('0x4f'));if(_0x3ca2a2[_0x8604('0x50')]===_0x8604('0x4e')){var _0x17b4cb=_0x5ed3eb[_0x8604('0x23')]({'plain':!![]});var _0x39d33e='Pauses';return db['UserProfileSection'][_0x8604('0x4b')]({'where':{'name':_0x39d33e,'userProfileId':_0x3ca2a2['userProfileId']},'raw':!![]})['then'](function(_0x49dc2a){if(_0x49dc2a&&_0x49dc2a[_0x8604('0x51')]===0x0){return db[_0x8604('0x25')]['create']({'name':_0x17b4cb[_0x8604('0x2a')],'resourceId':_0x17b4cb['id'],'type':_0x49dc2a[_0x8604('0x2a')],'sectionId':_0x49dc2a['id']},{})[_0x8604('0x21')](function(){return _0x5ed3eb;});}else{return _0x5ed3eb;}})[_0x8604('0x48')](function(_0x1785fd){logger[_0x8604('0x28')](_0x8604('0x52'),_0x1785fd);throw _0x1785fd;});}return _0x5ed3eb;})[_0x8604('0x21')](respondWithResult(_0x532c5e,0xc9))['catch'](handleError(_0x532c5e,null));};exports[_0x8604('0x20')]=function(_0x2879aa,_0x3a5e94){if(_0x2879aa[_0x8604('0x4d')]['id']){delete _0x2879aa[_0x8604('0x4d')]['id'];}return db[_0x8604('0x2e')][_0x8604('0x4b')]({'where':{'id':_0x2879aa[_0x8604('0x4a')]['id']}})[_0x8604('0x21')](handleEntityNotFound(_0x3a5e94,null))[_0x8604('0x21')](saveUpdates(_0x2879aa[_0x8604('0x4d')],null))[_0x8604('0x21')](respondWithResult(_0x3a5e94,null))['catch'](handleError(_0x3a5e94,null));};exports[_0x8604('0x22')]=function(_0x1d3811,_0x2c7436){return db[_0x8604('0x2e')][_0x8604('0x4b')]({'where':{'id':_0x1d3811[_0x8604('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2c7436,null))[_0x8604('0x21')](removeEntity(_0x2c7436,null))[_0x8604('0x48')](handleError(_0x2c7436,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c385fc5..e55e067 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 _0x5ae8=['rimraf','./pause.attributes','exports','tools_pauses','lodash','util','moment','bluebird','request-promise'];(function(_0x3a9d7b,_0x5c4c90){var _0xdb2023=function(_0x55592a){while(--_0x55592a){_0x3a9d7b['push'](_0x3a9d7b['shift']());}};_0xdb2023(++_0x5c4c90);}(_0x5ae8,0x1ab));var _0x85ae=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x5ae8[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x85ae('0x0'));var util=require(_0x85ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x85ae('0x2'));var BPromise=require(_0x85ae('0x3'));var rp=require(_0x85ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85ae('0x5'));var config=require('../../config/environment');var attributes=require(_0x85ae('0x6'));module[_0x85ae('0x7')]=function(_0x48e833,_0x247910){return _0x48e833['define']('Pause',attributes,{'tableName':_0x85ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95f9=['rimraf','../../config/environment','exports','define','Pause','tools_pauses','util','../../config/logger','api','moment','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x95f9,0xae));var _0x995f=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x95f9[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x995f('0x0'));var logger=require(_0x995f('0x1'))(_0x995f('0x2'));var moment=require(_0x995f('0x3'));var BPromise=require('bluebird');var rp=require(_0x995f('0x4'));var fs=require('fs');var path=require(_0x995f('0x5'));var rimraf=require(_0x995f('0x6'));var config=require(_0x995f('0x7'));var attributes=require('./pause.attributes');module[_0x995f('0x8')]=function(_0x382f70,_0x124837){return _0x382f70[_0x995f('0x9')](_0x995f('0xa'),attributes,{'tableName':_0x995f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 4f9fdef..439a6d7 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 _0x98d3=['result','catch','options','raw','where','include','map','attributes','model','then','ShowPause','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x384ffc,_0x90eb09){var _0x2a2f01=function(_0x443695){while(--_0x443695){_0x384ffc['push'](_0x384ffc['shift']());}};_0x2a2f01(++_0x90eb09);}(_0x98d3,0x173));var _0x398d=function(_0xd2bbaf,_0x246a1b){_0xd2bbaf=_0xd2bbaf-0x0;var _0x17e278=_0x98d3[_0xd2bbaf];return _0x17e278;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var moment=require('moment');var BPromise=require(_0x398d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x398d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x398d('0x6'));var client=jayson[_0x398d('0x7')][_0x398d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502652,_0x4ba1a3,_0x391d99){return new BPromise(function(_0x3029f3,_0x399598){return client[_0x398d('0x9')](_0x502652,_0x391d99)['then'](function(_0x3a1934){logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));logger[_0x398d('0xd')](_0x398d('0xe'),_0x4ba1a3,_0x398d('0xc'),JSON[_0x398d('0xf')](_0x3a1934));if(_0x3a1934['error']){if(_0x3a1934[_0x398d('0x10')][_0x398d('0x11')]===0x1f4){logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);return _0x399598(_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);}logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')]['message']);return _0x3029f3(_0x3a1934['error'][_0x398d('0x12')]);}else{logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));_0x3029f3(_0x3a1934[_0x398d('0x13')][_0x398d('0x12')]);}})[_0x398d('0x14')](function(_0x3c151a){logger['error'](_0x398d('0xb'),_0x4ba1a3,_0x3c151a);_0x399598(_0x3c151a);});});}exports['ShowPause']=function(_0x673840){var _0x476c36=this;return new Promise(function(_0x297768,_0x5de1be){return db['Pause']['find']({'raw':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x16')]===undefined?!![]:![]:!![],'where':_0x673840[_0x398d('0x15')]?_0x673840[_0x398d('0x15')][_0x398d('0x17')]||null:null,'attributes':_0x673840[_0x398d('0x15')]?_0x673840['options']['attributes']||null:null,'include':_0x673840['options']?_0x673840[_0x398d('0x15')][_0x398d('0x18')]?_[_0x398d('0x19')](_0x673840[_0x398d('0x15')][_0x398d('0x18')],function(_0x557df7){return{'model':db[_0x557df7['model']],'as':_0x557df7['as'],'attributes':_0x557df7[_0x398d('0x1a')],'include':_0x557df7[_0x398d('0x18')]?_['map'](_0x557df7[_0x398d('0x18')],function(_0x38d8da){return{'model':db[_0x38d8da['model']],'as':_0x38d8da['as'],'attributes':_0x38d8da['attributes'],'include':_0x38d8da['include']?_[_0x398d('0x19')](_0x38d8da[_0x398d('0x18')],function(_0x24fa2c){return{'model':db[_0x24fa2c[_0x398d('0x1b')]],'as':_0x24fa2c['as'],'attributes':_0x24fa2c[_0x398d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x398d('0x1c')](function(_0xc9c9b7){logger[_0x398d('0xa')]('ShowPause',_0x673840);logger[_0x398d('0xd')]('ShowPause',_0x673840,JSON['stringify'](_0xc9c9b7));_0x297768(_0xc9c9b7);})[_0x398d('0x14')](function(_0x27bc6e){logger['error'](_0x398d('0x1d'),_0x27bc6e['message'],_0x673840);_0x5de1be(_0x476c36[_0x398d('0x10')](0x1f4,_0x27bc6e[_0x398d('0x12')]));});});}; \ No newline at end of file +var _0x77f2=['util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','find','options','raw','where','map','include','attributes','model','ShowPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77f2,0x188));var _0x277f=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x77f2[_0x2e3545];return _0xcf18f;};'use strict';var _=require('lodash');var util=require(_0x277f('0x0'));var moment=require('moment');var BPromise=require(_0x277f('0x1'));var rs=require(_0x277f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x277f('0x3'))(_0x277f('0x4'));var config=require('../../config/environment');var jayson=require(_0x277f('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cfad8,_0xec2684,_0x24b21a){return new BPromise(function(_0x422495,_0x548c80){return client[_0x277f('0x6')](_0x5cfad8,_0x24b21a)[_0x277f('0x7')](function(_0xd946bc){logger[_0x277f('0x8')](_0x277f('0x9'),_0xec2684,'request\x20sent');logger[_0x277f('0xa')](_0x277f('0xb'),_0xec2684,_0x277f('0xc'),JSON[_0x277f('0xd')](_0xd946bc));if(_0xd946bc[_0x277f('0xe')]){if(_0xd946bc[_0x277f('0xe')][_0x277f('0xf')]===0x1f4){logger[_0x277f('0xe')](_0x277f('0x9'),_0xec2684,_0xd946bc['error'][_0x277f('0x10')]);return _0x548c80(_0xd946bc[_0x277f('0xe')][_0x277f('0x10')]);}logger[_0x277f('0xe')](_0x277f('0x9'),_0xec2684,_0xd946bc[_0x277f('0xe')][_0x277f('0x10')]);return _0x422495(_0xd946bc['error'][_0x277f('0x10')]);}else{logger[_0x277f('0x8')]('Pause,\x20%s,\x20%s',_0xec2684,_0x277f('0xc'));_0x422495(_0xd946bc[_0x277f('0x11')]['message']);}})[_0x277f('0x12')](function(_0x2017e8){logger['error'](_0x277f('0x9'),_0xec2684,_0x2017e8);_0x548c80(_0x2017e8);});});}exports['ShowPause']=function(_0x59312a){var _0x168a33=this;return new Promise(function(_0x1f6372,_0x48c578){return db['Pause'][_0x277f('0x13')]({'raw':_0x59312a[_0x277f('0x14')]?_0x59312a[_0x277f('0x14')][_0x277f('0x15')]===undefined?!![]:![]:!![],'where':_0x59312a['options']?_0x59312a[_0x277f('0x14')][_0x277f('0x16')]||null:null,'attributes':_0x59312a[_0x277f('0x14')]?_0x59312a[_0x277f('0x14')]['attributes']||null:null,'include':_0x59312a[_0x277f('0x14')]?_0x59312a['options']['include']?_[_0x277f('0x17')](_0x59312a[_0x277f('0x14')][_0x277f('0x18')],function(_0x45cb6c){return{'model':db[_0x45cb6c['model']],'as':_0x45cb6c['as'],'attributes':_0x45cb6c[_0x277f('0x19')],'include':_0x45cb6c['include']?_[_0x277f('0x17')](_0x45cb6c[_0x277f('0x18')],function(_0x279989){return{'model':db[_0x279989[_0x277f('0x1a')]],'as':_0x279989['as'],'attributes':_0x279989[_0x277f('0x19')],'include':_0x279989['include']?_[_0x277f('0x17')](_0x279989[_0x277f('0x18')],function(_0xf7eacc){return{'model':db[_0xf7eacc[_0x277f('0x1a')]],'as':_0xf7eacc['as'],'attributes':_0xf7eacc[_0x277f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x61b2fb){logger['info']('ShowPause',_0x59312a);logger[_0x277f('0xa')]('ShowPause',_0x59312a,JSON[_0x277f('0xd')](_0x61b2fb));_0x1f6372(_0x61b2fb);})[_0x277f('0x12')](function(_0x518ff0){logger[_0x277f('0xe')](_0x277f('0x1b'),_0x518ff0['message'],_0x59312a);_0x48c578(_0x168a33[_0x277f('0xe')](0x1f4,_0x518ff0[_0x277f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fb89705..2fc9e32 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 _0x7546=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/webhook','webhookGet','/:id','/:id/download','isAuthenticated','download','diskStorage','server/files/plugins','originalname','format','%s-%s%s','basename','extname','post','single','webhookPost'];(function(_0x14f06c,_0x45a1ef){var _0x5d44c9=function(_0x244ae7){while(--_0x244ae7){_0x14f06c['push'](_0x14f06c['shift']());}};_0x5d44c9(++_0x45a1ef);}(_0x7546,0x1c6));var _0x6754=function(_0xfaada0,_0x5c3ed0){_0xfaada0=_0xfaada0-0x0;var _0x2f7a85=_0x7546[_0xfaada0];return _0x2f7a85;};'use strict';var multer=require('multer');var util=require(_0x6754('0x0'));var path=require(_0x6754('0x1'));var timeout=require(_0x6754('0x2'));var express=require(_0x6754('0x3'));var router=express[_0x6754('0x4')]();var auth=require(_0x6754('0x5'));var interaction=require(_0x6754('0x6'));var config=require(_0x6754('0x7'));var controller=require('./plugin.controller');router[_0x6754('0x8')]('/',auth['isAuthenticated'](),controller[_0x6754('0x9')]);router[_0x6754('0x8')](_0x6754('0xa'),controller[_0x6754('0xb')]);router[_0x6754('0x8')](_0x6754('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6754('0x8')](_0x6754('0xd'),auth[_0x6754('0xe')](),controller[_0x6754('0xf')]);var upload=multer({'storage':multer[_0x6754('0x10')]({'destination':function(_0x4dd597,_0x46bf98,_0x410f2f){_0x410f2f(null,path['join'](config['root'],_0x6754('0x11')));},'filename':function(_0x4c0c91,_0x2637e9,_0x9e65a7){_0x2637e9[_0x6754('0x12')]=_0x2637e9[_0x6754('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9e65a7(null,util[_0x6754('0x13')](_0x6754('0x14'),path[_0x6754('0x15')](_0x2637e9['originalname'],path[_0x6754('0x16')](_0x2637e9[_0x6754('0x12')])),Date['now'](),path[_0x6754('0x16')](_0x2637e9[_0x6754('0x12')])));}})});router[_0x6754('0x17')]('/',upload[_0x6754('0x18')]('file'),controller['upload']);router['post'](_0x6754('0xa'),controller[_0x6754('0x19')]);router[_0x6754('0x1a')]('/:id',auth[_0x6754('0xe')](),controller[_0x6754('0x1b')]);router['delete'](_0x6754('0xc'),auth[_0x6754('0xe')](),controller[_0x6754('0x1c')]);module[_0x6754('0x1d')]=router; \ No newline at end of file +var _0x6d1c=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','webhookGet','isAuthenticated','show','/:id/download'];(function(_0x179ff7,_0x441c07){var _0x4d26cf=function(_0x498ece){while(--_0x498ece){_0x179ff7['push'](_0x179ff7['shift']());}};_0x4d26cf(++_0x441c07);}(_0x6d1c,0x1ce));var _0xc6d1=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x6d1c[_0x337a10];return _0x575f98;};'use strict';var multer=require(_0xc6d1('0x0'));var util=require(_0xc6d1('0x1'));var path=require(_0xc6d1('0x2'));var timeout=require(_0xc6d1('0x3'));var express=require(_0xc6d1('0x4'));var router=express[_0xc6d1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc6d1('0x6'));var config=require(_0xc6d1('0x7'));var controller=require('./plugin.controller');router[_0xc6d1('0x8')]('/',auth['isAuthenticated'](),controller[_0xc6d1('0x9')]);router[_0xc6d1('0x8')]('/webhook',controller[_0xc6d1('0xa')]);router[_0xc6d1('0x8')]('/:id',auth[_0xc6d1('0xb')](),controller[_0xc6d1('0xc')]);router['get'](_0xc6d1('0xd'),auth['isAuthenticated'](),controller[_0xc6d1('0xe')]);var upload=multer({'storage':multer[_0xc6d1('0xf')]({'destination':function(_0x18b588,_0x551757,_0x2f1076){_0x2f1076(null,path[_0xc6d1('0x10')](config[_0xc6d1('0x11')],_0xc6d1('0x12')));},'filename':function(_0x288584,_0x5714ea,_0x4135c1){_0x5714ea[_0xc6d1('0x13')]=_0x5714ea[_0xc6d1('0x13')][_0xc6d1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4135c1(null,util[_0xc6d1('0x15')]('%s-%s%s',path['basename'](_0x5714ea[_0xc6d1('0x13')],path[_0xc6d1('0x16')](_0x5714ea[_0xc6d1('0x13')])),Date[_0xc6d1('0x17')](),path[_0xc6d1('0x16')](_0x5714ea['originalname'])));}})});router[_0xc6d1('0x18')]('/',upload[_0xc6d1('0x19')](_0xc6d1('0x1a')),controller[_0xc6d1('0x1b')]);router['post'](_0xc6d1('0x1c'),controller['webhookPost']);router[_0xc6d1('0x1d')](_0xc6d1('0x1e'),auth['isAuthenticated'](),controller[_0xc6d1('0x1f')]);router[_0xc6d1('0x20')](_0xc6d1('0x1e'),auth[_0xc6d1('0xb')](),controller[_0xc6d1('0x20')]);module[_0xc6d1('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1883480..d2aa2fb 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 _0xf675=['adminOnly','never','always','exports','STRING','ENUM','html','script','BOOLEAN'];(function(_0x29b8ec,_0x40ff5a){var _0xe1b982=function(_0x464e01){while(--_0x464e01){_0x29b8ec['push'](_0x29b8ec['shift']());}};_0xe1b982(++_0x40ff5a);}(_0xf675,0xae));var _0x5f67=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xf675[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require('sequelize');module[_0x5f67('0x0')]={'name':{'type':Sequelize[_0x5f67('0x1')]},'type':{'type':Sequelize[_0x5f67('0x2')](_0x5f67('0x3'),_0x5f67('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5f67('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x5f67('0x6'),'agentOnly','always',_0x5f67('0x7')),'defaultValue':_0x5f67('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5f67('0x1')]},'adminUrl':{'type':Sequelize[_0x5f67('0x1')]},'agentUrl':{'type':Sequelize[_0x5f67('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x5f67('0x1')]}}; \ No newline at end of file +var _0xf925=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xf925,0xeb));var _0x5f92=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0xf925[_0x420a7c];return _0x311c52;};'use strict';var Sequelize=require(_0x5f92('0x0'));module[_0x5f92('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5f92('0x2')](_0x5f92('0x3'),_0x5f92('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5f92('0x5')],'comment':_0x5f92('0x6')},'active':{'type':Sequelize[_0x5f92('0x7')],'defaultValue':0x0,'comment':_0x5f92('0x8')},'sidebar':{'type':Sequelize[_0x5f92('0x2')](_0x5f92('0x9'),'agentOnly',_0x5f92('0xa'),_0x5f92('0xb')),'defaultValue':_0x5f92('0xa'),'comment':_0x5f92('0xc')},'icon':{'type':Sequelize[_0x5f92('0x5')]},'adminUrl':{'type':Sequelize[_0x5f92('0x5')]},'agentUrl':{'type':Sequelize[_0x5f92('0x5')]},'scriptName':{'type':Sequelize[_0x5f92('0x5')]},'scriptPath':{'type':Sequelize[_0x5f92('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b2c75f2..276169b 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 _0x47db=['node_modules/**/*','attachments/**/*','finalize','close','existsSync','format','%s.zip','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','parameters','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','scriptPath','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','filters','attributes','fields','length','nolimit','offset','order','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','intersection','find','params','join','root','server/files/plugins','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x47db,0xff));var _0xb47d=function(_0x34ab32,_0x1fb698){_0x34ab32=_0x34ab32-0x0;var _0x139be0=_0x47db[_0x34ab32];return _0x139be0;};'use strict';var pdf=require(_0xb47d('0x0'));var emlformat=require(_0xb47d('0x1'));var rimraf=require(_0xb47d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb47d('0x3'));var rp=require('request-promise');var moment=require(_0xb47d('0x4'));var BPromise=require(_0xb47d('0x5'));var Mustache=require(_0xb47d('0x6'));var util=require(_0xb47d('0x7'));var path=require(_0xb47d('0x8'));var sox=require(_0xb47d('0x9'));var csv=require('to-csv');var ejs=require(_0xb47d('0xa'));var fs=require('fs');var _=require(_0xb47d('0xb'));var squel=require(_0xb47d('0xc'));var crypto=require(_0xb47d('0xd'));var jsforce=require(_0xb47d('0xe'));var deskjs=require(_0xb47d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb47d('0x10'));var extract=require(_0xb47d('0x11'));var rimraf=require(_0xb47d('0x2'));var archiver=require(_0xb47d('0x12'));var Redis=require(_0xb47d('0x13'));var authService=require(_0xb47d('0x14'));var qs=require(_0xb47d('0x15'));var as=require(_0xb47d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb47d('0x17'))(_0xb47d('0x18'));var utils=require(_0xb47d('0x19'));var config=require(_0xb47d('0x1a'));var db=require(_0xb47d('0x1b'))['db'];config[_0xb47d('0x1c')]=_[_0xb47d('0x1d')](config['redis'],{'host':_0xb47d('0x1e'),'port':0x18eb});var socket=require(_0xb47d('0x1f'))(new Redis(config['redis']));require(_0xb47d('0x20'))[_0xb47d('0x21')](socket);function respondWithStatusCode(_0x16e77a,_0x4cbb81){_0x4cbb81=_0x4cbb81||0xcc;return function(_0x4b8ca1){if(_0x4b8ca1){return _0x16e77a[_0xb47d('0x22')](_0x4cbb81);}return _0x16e77a[_0xb47d('0x23')](_0x4cbb81)[_0xb47d('0x24')]();};}function respondWithResult(_0x456c49,_0x34d96a){_0x34d96a=_0x34d96a||0xc8;return function(_0x1f8d3c){if(_0x1f8d3c){return _0x456c49[_0xb47d('0x23')](_0x34d96a)[_0xb47d('0x25')](_0x1f8d3c);}};}function respondWithFilteredResult(_0x23965b,_0x4f4de5){return function(_0x560300){if(_0x560300){var _0x35c412=_0x560300['count'],_0x2455a6=_0x4f4de5['offset'],_0x56588a=_0x4f4de5['offset']+_0x4f4de5[_0xb47d('0x26')],_0x1f2a69;if(_0x56588a>=_0x35c412){_0x56588a=_0x35c412;_0x1f2a69=0xc8;}else{_0x1f2a69=0xce;}_0x23965b[_0xb47d('0x23')](_0x1f2a69);return _0x23965b[_0xb47d('0x27')](_0xb47d('0x28'),_0x2455a6+'-'+_0x56588a+'/'+_0x35c412)[_0xb47d('0x25')](_0x560300);}return null;};}function patchUpdates(_0x4d27f3){return function(_0x392f93){try{jsonpatch[_0xb47d('0x29')](_0x392f93,_0x4d27f3,!![]);}catch(_0x5bc9cf){return BPromise[_0xb47d('0x2a')](_0x5bc9cf);}return _0x392f93[_0xb47d('0x2b')]();};}function saveUpdates(_0x560ba0,_0x441072){return function(_0x2e603f){if(_0x2e603f){return _0x2e603f[_0xb47d('0x2c')](_0x560ba0)['then'](function(_0x515503){return _0x515503;});}return null;};}function removeEntity(_0x44c088,_0x38db5e){return function(_0x4fb1d5){if(_0x4fb1d5){return _0x4fb1d5[_0xb47d('0x2d')]()[_0xb47d('0x2e')](function(){var _0x1fb1cf=_0x4fb1d5[_0xb47d('0x2f')]({'plain':!![]});var _0x2b783f=_0xb47d('0x30');return db[_0xb47d('0x31')][_0xb47d('0x2d')]({'where':{'type':_0x2b783f,'resourceId':_0x1fb1cf['id']}})[_0xb47d('0x2e')](function(){return _0x4fb1d5;});})['then'](function(){_0x44c088[_0xb47d('0x23')](0xcc)[_0xb47d('0x24')]();});}};}function handleEntityNotFound(_0x27aa06,_0x48f992){return function(_0x3c1ee8){if(!_0x3c1ee8){_0x27aa06[_0xb47d('0x22')](0x194);}return _0x3c1ee8;};}function handleError(_0x9d73cc,_0x5d71a5){_0x5d71a5=_0x5d71a5||0x1f4;return function(_0x3acf7c){logger[_0xb47d('0x32')](_0x3acf7c[_0xb47d('0x33')]);if(_0x3acf7c[_0xb47d('0x34')]){delete _0x3acf7c['name'];}_0x9d73cc[_0xb47d('0x23')](_0x5d71a5)[_0xb47d('0x35')](_0x3acf7c);};}exports[_0xb47d('0x36')]=function(_0x3ea38c,_0x1f9df7){var _0x5194fa={},_0x34a21c={},_0x3c7a59={'count':0x0,'rows':[]};var _0x215465=_[_0xb47d('0x37')](db[_0xb47d('0x38')][_0xb47d('0x39')],function(_0x631724){return{'name':_0x631724['fieldName'],'type':_0x631724['type'][_0xb47d('0x3a')]};});_0x34a21c[_0xb47d('0x3b')]=_[_0xb47d('0x37')](_0x215465,_0xb47d('0x34'));_0x34a21c[_0xb47d('0x3c')]=_['keys'](_0x3ea38c[_0xb47d('0x3c')]);_0x34a21c[_0xb47d('0x3d')]=_['intersection'](_0x34a21c['model'],_0x34a21c[_0xb47d('0x3c')]);_0x5194fa[_0xb47d('0x3e')]=_['intersection'](_0x34a21c[_0xb47d('0x3b')],qs[_0xb47d('0x3f')](_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x3f')]));_0x5194fa[_0xb47d('0x3e')]=_0x5194fa[_0xb47d('0x3e')][_0xb47d('0x40')]?_0x5194fa[_0xb47d('0x3e')]:_0x34a21c[_0xb47d('0x3b')];if(!_0x3ea38c[_0xb47d('0x3c')]['hasOwnProperty'](_0xb47d('0x41'))){_0x5194fa['limit']=qs[_0xb47d('0x26')](_0x3ea38c[_0xb47d('0x3c')]['limit']);_0x5194fa[_0xb47d('0x42')]=qs[_0xb47d('0x42')](_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x42')]);}_0x5194fa[_0xb47d('0x43')]=qs['sort'](_0x3ea38c[_0xb47d('0x3c')]['sort']);_0x5194fa[_0xb47d('0x44')]=qs[_0xb47d('0x3d')](_['pick'](_0x3ea38c[_0xb47d('0x3c')],_0x34a21c[_0xb47d('0x3d')]),_0x215465);if(_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x45')]){_0x5194fa[_0xb47d('0x44')]=_[_0xb47d('0x46')](_0x5194fa[_0xb47d('0x44')],{'$or':_[_0xb47d('0x37')](_0x215465,function(_0x14c2ec){if(_0x14c2ec[_0xb47d('0x47')]!==_0xb47d('0x48')){var _0x3a7135={};_0x3a7135[_0x14c2ec[_0xb47d('0x34')]]={'$like':'%'+_0x3ea38c['query'][_0xb47d('0x45')]+'%'};return _0x3a7135;}})});}_0x5194fa=_[_0xb47d('0x46')]({},_0x5194fa,_0x3ea38c[_0xb47d('0x49')]);var _0x16032c={'where':_0x5194fa['where']};return db['Plugin'][_0xb47d('0x4a')](_0x16032c)[_0xb47d('0x2e')](function(_0xc0ea1c){_0x3c7a59[_0xb47d('0x4a')]=_0xc0ea1c;if(_0x3ea38c[_0xb47d('0x3c')][_0xb47d('0x4b')]){_0x5194fa[_0xb47d('0x4c')]=[{'all':!![]}];}return db[_0xb47d('0x38')]['findAll'](_0x5194fa);})[_0xb47d('0x2e')](function(_0x278bcd){_0x3c7a59[_0xb47d('0x4d')]=_0x278bcd;return _0x3c7a59;})[_0xb47d('0x2e')](respondWithFilteredResult(_0x1f9df7,_0x5194fa))[_0xb47d('0x4e')](handleError(_0x1f9df7,null));};exports[_0xb47d('0x4f')]=function(_0x802569,_0x10ed6d){var _0x113919={'raw':!![],'where':{'id':_0x802569['params']['id']}},_0x4c9e05={};_0x4c9e05[_0xb47d('0x3b')]=_['keys'](db['Plugin']['rawAttributes']);_0x4c9e05[_0xb47d('0x3c')]=_[_0xb47d('0x50')](_0x802569[_0xb47d('0x3c')]);_0x4c9e05[_0xb47d('0x3d')]=_[_0xb47d('0x51')](_0x4c9e05[_0xb47d('0x3b')],_0x4c9e05[_0xb47d('0x3c')]);_0x113919[_0xb47d('0x3e')]=_['intersection'](_0x4c9e05[_0xb47d('0x3b')],qs[_0xb47d('0x3f')](_0x802569['query'][_0xb47d('0x3f')]));_0x113919[_0xb47d('0x3e')]=_0x113919['attributes'][_0xb47d('0x40')]?_0x113919[_0xb47d('0x3e')]:_0x4c9e05[_0xb47d('0x3b')];if(_0x802569['query']['includeAll']){_0x113919[_0xb47d('0x4c')]=[{'all':!![]}];}_0x113919=_['merge']({},_0x113919,_0x802569[_0xb47d('0x49')]);return db[_0xb47d('0x38')][_0xb47d('0x52')](_0x113919)[_0xb47d('0x2e')](handleEntityNotFound(_0x10ed6d,null))[_0xb47d('0x2e')](respondWithResult(_0x10ed6d,null))[_0xb47d('0x4e')](handleError(_0x10ed6d,null));};exports['download']=function(_0x4a1a1e,_0x41d0e2,_0x70f449){return db[_0xb47d('0x38')][_0xb47d('0x52')]({'where':{'id':_0x4a1a1e[_0xb47d('0x53')]['id']},'attributes':[_0xb47d('0x34'),_0xb47d('0x8')],'raw':!![]})[_0xb47d('0x2e')](handleEntityNotFound(_0x41d0e2,null))[_0xb47d('0x2e')](function(_0x6c7d9f){if(_0x6c7d9f){var _0x449d4b=path[_0xb47d('0x54')](config[_0xb47d('0x55')],_0xb47d('0x56'),util['format']('%s.zip',path[_0xb47d('0x57')](_0x6c7d9f[_0xb47d('0x8')])));var _0x5dbf6f=fs[_0xb47d('0x58')](_0x449d4b);var _0x1fd5d2=archiver(_0xb47d('0x59'),{'zlib':{'level':0x9}});_0x1fd5d2['on'](_0xb47d('0x5a'),function(_0x376b53){if(_0x376b53[_0xb47d('0x5b')]===_0xb47d('0x5c')){logger[_0xb47d('0x32')](_0x376b53);}else{throw new db[(_0xb47d('0x5d'))][(_0xb47d('0x5e'))](_0xb47d('0x5f'));}});_0x1fd5d2['on']('error',function(_0x5a5564){throw new db[(_0xb47d('0x5d'))][(_0xb47d('0x5e'))](_0xb47d('0x5f'));});_0x1fd5d2[_0xb47d('0x60')](_0x5dbf6f);_0x1fd5d2[_0xb47d('0x61')](_0xb47d('0x62'),{'cwd':path[_0xb47d('0x54')](config[_0xb47d('0x55')],_0xb47d('0x56'),path['dirname'](_0x6c7d9f[_0xb47d('0x8')])),'ignore':[path['join'](path[_0xb47d('0x57')](_0x6c7d9f[_0xb47d('0x8')]),_0xb47d('0x63')),path[_0xb47d('0x54')](path[_0xb47d('0x57')](_0x6c7d9f[_0xb47d('0x8')]),_0xb47d('0x64'))],'nodir':!![]})[_0xb47d('0x65')]();_0x5dbf6f['on'](_0xb47d('0x66'),function(){if(!fs[_0xb47d('0x67')](_0x449d4b)){throw new db['Sequelize'][(_0xb47d('0x5e'))]('Plugin\x20not\x20found');}return _0x41d0e2['download'](_0x449d4b,util[_0xb47d('0x68')](_0xb47d('0x69'),path[_0xb47d('0x57')](_0x6c7d9f['path'])),function(_0x5706b2){if(_0x5706b2){throw new db[(_0xb47d('0x5d'))][(_0xb47d('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb47d('0x6a')](_0x449d4b);logger[_0xb47d('0x6b')](_0xb47d('0x6c'));logger[_0xb47d('0x6b')](_0xb47d('0x6d'));});});}return null;})[_0xb47d('0x4e')](handleError(_0x41d0e2,null));};exports[_0xb47d('0x6e')]=function(_0x2862f5,_0x29b345,_0x57b14b){var _0x2c3bfc=path[_0xb47d('0x57')](_0x2862f5[_0xb47d('0x6f')][_0xb47d('0x70')],path[_0xb47d('0x71')](_0x2862f5[_0xb47d('0x6f')]['filename']));var _0x3eb7b6=path[_0xb47d('0x54')](config[_0xb47d('0x55')],_0xb47d('0x56'),_0x2862f5[_0xb47d('0x6f')][_0xb47d('0x70')]);var _0x5307da=path['join'](config[_0xb47d('0x55')],_0xb47d('0x56'),_0x2c3bfc);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x3eb7b6);logger[_0xb47d('0x6b')](_0xb47d('0x72'),_0x5307da);try{fs['chmodSync'](_0x3eb7b6,parseInt(_0xb47d('0x73'),0x8));extract(_0x3eb7b6,{'dir':_0x5307da},function(_0x2b7619){if(_0x2b7619){logger[_0xb47d('0x32')](_0x2b7619);handleError(_0x2b7619,!![]);};var _0x1366e1=fs[_0xb47d('0x74')](_0x5307da);if(_0x1366e1[_0xb47d('0x40')]>0x1){removeReferences(_0x3eb7b6,_0x5307da);logger[_0xb47d('0x32')](_0xb47d('0x75'));return _0x57b14b(new Error(_0xb47d('0x75')));}var _0x2f82fa=fs[_0xb47d('0x76')](path['join'](_0x5307da,_0x1366e1[0x0]));if(_0x2f82fa[_0xb47d('0x77')]()){removeReferences(_0x3eb7b6,_0x5307da);logger[_0xb47d('0x32')](_0xb47d('0x75'));return _0x57b14b(new Error(_0xb47d('0x75')));}if(_0x2f82fa[_0xb47d('0x78')]()){var _0x3d6102=fs[_0xb47d('0x74')](path[_0xb47d('0x54')](_0x5307da,_0x1366e1[0x0]));if(_0x3d6102['length']===0x0){removeReferences(_0x3eb7b6,_0x5307da);logger[_0xb47d('0x32')](_0xb47d('0x75'));return _0x57b14b(new Error(_0xb47d('0x75')));}var _0x2b9fe4=_0x3d6102[_0xb47d('0x79')](function(_0x5e41cd){return _0x5e41cd==='manifest.json';});if(!_0x2b9fe4){return _0x57b14b(new Error(_0xb47d('0x7a')));}var _0x2b0676=fs[_0xb47d('0x7b')](path[_0xb47d('0x54')](_0x5307da,_0x1366e1[0x0],'manifest.json'));var _0x45b43b=JSON[_0xb47d('0x7c')](_0x2b0676);if('undefined'==typeof _0x45b43b[_0xb47d('0x34')]){return _0x57b14b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xb47d('0x7d')==typeof _0x45b43b['type']){return _0x57b14b(new Error(_0xb47d('0x7e')));}if(_0xb47d('0x7d')==typeof _0x45b43b[_0xb47d('0x7f')]){return _0x57b14b(new Error(_0xb47d('0x80')));}if(_0xb47d('0x7d')==typeof _0x45b43b['parameters']){return _0x57b14b(new Error(_0xb47d('0x81')));}if(_0x45b43b[_0xb47d('0x47')]===_0xb47d('0x82')){if(_0xb47d('0x7d')==typeof _0x45b43b['parameters'][_0xb47d('0x83')]){return _0x57b14b(new Error(_0xb47d('0x84')));}if(_0xb47d('0x7d')==typeof _0x45b43b['parameters']['views'][_0xb47d('0x85')]&&'undefined'==typeof _0x45b43b['parameters'][_0xb47d('0x83')][_0xb47d('0x86')]){return _0x57b14b(new Error(_0xb47d('0x87')));}}else if(_0x45b43b[_0xb47d('0x47')]===_0xb47d('0x88')){if(_0xb47d('0x7d')==typeof _0x45b43b[_0xb47d('0x89')][_0xb47d('0x8a')]){return _0x57b14b(new Error(_0xb47d('0x8b')));}if('undefined'==typeof _0x45b43b[_0xb47d('0x89')]['scriptPath']){return _0x57b14b(new Error(_0xb47d('0x8c')));}}else{return _0x57b14b(new Error(_0xb47d('0x8d')));}var _0x4fecaa=_0x45b43b['name'];var _0x14bdbd=_0x45b43b[_0xb47d('0x8e')];var _0x5b831a=_0x45b43b['type'];var _0x40bd77=_0x45b43b[_0xb47d('0x8f')]?_0x45b43b['sidebar']:_0xb47d('0x90');var _0x42085c=_0x45b43b[_0xb47d('0x91')]?_0x45b43b[_0xb47d('0x91')]:_0xb47d('0x92');var _0x24bb0a='';var _0x8a2ec7='';var _0x30c7a8='';var _0xf23cc0='';var _0x1df476=_0x45b43b[_0xb47d('0x7f')];if(_0x5b831a===_0xb47d('0x82')){if(_0xb47d('0x7d')!=typeof _0x45b43b['parameters'][_0xb47d('0x83')]['admin']){var _0x117413=_0x45b43b[_0xb47d('0x89')][_0xb47d('0x83')][_0xb47d('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x117413)){_0x24bb0a=path[_0xb47d('0x54')](_0xb47d('0x93'),_0x2c3bfc,_0x1366e1[0x0],_0x117413);}else{_0x24bb0a=_0x117413;}}else{logger['info'](_0xb47d('0x94'));}if(_0xb47d('0x7d')!=typeof _0x45b43b[_0xb47d('0x89')]['views'][_0xb47d('0x86')]){var _0x370768=_0x45b43b['parameters'][_0xb47d('0x83')][_0xb47d('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xb47d('0x95')](_0x370768)){_0x8a2ec7=path[_0xb47d('0x54')]('plugins',_0x2c3bfc,_0x1366e1[0x0],_0x370768);}else{_0x8a2ec7=_0x370768;}}else{logger[_0xb47d('0x6b')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5b831a==='script'){_0x30c7a8=_0x45b43b[_0xb47d('0x89')]['scriptName'];_0xf23cc0=_0x45b43b['parameters'][_0xb47d('0x96')];if(_0xb47d('0x7d')!=typeof _0x45b43b[_0xb47d('0x89')][_0xb47d('0x83')]){if(_0xb47d('0x7d')!=typeof _0x45b43b['parameters']['views'][_0xb47d('0x85')]){var _0x117413=_0x45b43b['parameters'][_0xb47d('0x83')][_0xb47d('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x117413)){_0x24bb0a=path['join'](_0xb47d('0x93'),_0x2c3bfc,_0x1366e1[0x0],_0x117413);}else{_0x24bb0a=_0x117413;}}if(_0xb47d('0x7d')!=typeof _0x45b43b['parameters']['views']['agent']){var _0x370768=_0x45b43b[_0xb47d('0x89')][_0xb47d('0x83')][_0xb47d('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xb47d('0x95')](_0x370768)){_0x8a2ec7=path[_0xb47d('0x54')](_0xb47d('0x93'),_0x2c3bfc,_0x1366e1[0x0],_0x370768);}else{_0x8a2ec7=_0x370768;}}}}var _0x1c46fe={'name':_0x4fecaa,'description':_0x14bdbd,'path':path[_0xb47d('0x54')](_0x2c3bfc,_0x1366e1[0x0]),'type':_0x5b831a,'sidebar':_0x40bd77,'icon':_0x42085c,'adminUrl':_0x24bb0a,'agentUrl':_0x8a2ec7,'scriptName':_0x30c7a8,'scriptPath':_0xf23cc0,'version':_0x1df476};removeReferences(_0x3eb7b6,null);return db['Plugin'][_0xb47d('0x97')](_0x1c46fe)[_0xb47d('0x2e')](function(_0x19577f){var _0x6b9f04={'role':_0x2862f5['body'][_0xb47d('0x98')],'userProfileId':_0x2862f5[_0xb47d('0x99')]['userProfileId']};if(!_0x6b9f04)throw new Error(_0xb47d('0x9a'));if(_0x6b9f04[_0xb47d('0x98')]===_0xb47d('0x9b')){var _0x4c5560=_0x19577f[_0xb47d('0x2f')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb47d('0x30'),'userProfileId':_0x6b9f04['userProfileId']},'raw':!![]})[_0xb47d('0x2e')](function(_0x3d4fe5){if(_0x3d4fe5&&_0x3d4fe5[_0xb47d('0x9c')]===0x0){return db['UserProfileResource'][_0xb47d('0x97')]({'name':_0x4c5560['name'],'resourceId':_0x4c5560['id'],'type':_0x3d4fe5[_0xb47d('0x34')],'sectionId':_0x3d4fe5['id']},{})[_0xb47d('0x2e')](function(){return _0x19577f;});}else{return _0x19577f;}})['catch'](function(_0x4c8c94){logger[_0xb47d('0x32')](_0xb47d('0x9d'),_0x4c8c94);throw _0x4c8c94;});}return _0x19577f;})['then'](respondWithResult(_0x29b345,null))['catch'](handleError(_0x29b345,null));}});}catch(_0x646c0){_0x29b345[_0xb47d('0x23')](0x1f4)[_0xb47d('0x35')](_0x646c0);}};function removeReferences(_0x45f163,_0x2be44e){try{if(_0x45f163){fs[_0xb47d('0x6a')](_0x45f163);logger['info'](_0xb47d('0x9e'));}if(_0x2be44e){rimraf(_0x2be44e,function(){});logger['info'](_0xb47d('0x9f'));}}catch(_0x290f17){logger[_0xb47d('0x32')](_0x290f17);}}exports[_0xb47d('0x2c')]=function(_0x4d2d2c,_0x1818ed,_0x359147){return db[_0xb47d('0x38')][_0xb47d('0x52')]({'where':{'id':_0x4d2d2c['params']['id']}})[_0xb47d('0x2e')](handleEntityNotFound(_0x1818ed,null))['then'](saveUpdates(_0x4d2d2c[_0xb47d('0x99')],null))[_0xb47d('0x2e')](respondWithResult(_0x1818ed,null))['catch'](handleError(_0x1818ed,null));};exports[_0xb47d('0xa0')]=function(_0x12f5ee,_0x481d36,_0x145061){return db[_0xb47d('0x38')][_0xb47d('0x52')]({'where':{'id':_0x12f5ee[_0xb47d('0x53')]['id']}})[_0xb47d('0x2e')](function(_0x25fbcb){if(_0x25fbcb){return _0x25fbcb[_0xb47d('0x2d')]();}})['then'](function(_0x33a8b5){rimraf(path['join'](config['root'],_0xb47d('0x56'),path[_0xb47d('0xa1')](_0x33a8b5['path'])),function(){});return _0x33a8b5;})[_0xb47d('0x2e')](handleEntityNotFound(_0x481d36,null))['then'](respondWithStatusCode(_0x481d36,null))['catch'](handleError(_0x481d36,null));};exports['webhookGet']=function(_0x3e3644,_0x331dc9,_0x461ae8){return BPromise[_0xb47d('0xa2')]()[_0xb47d('0x2e')](function(){if(!_0x3e3644['query']['path']){throw new Error(_0xb47d('0xa3'));}if(!_0x3e3644[_0xb47d('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xa88f25=_0x3e3644[_0xb47d('0x3c')]['hostname']?_0x3e3644[_0xb47d('0x3c')][_0xb47d('0xa4')]+':'+_0x3e3644[_0xb47d('0x3c')][_0xb47d('0xa5')]:_0xb47d('0xa6')+_0x3e3644[_0xb47d('0x3c')]['port'];var _0x1b86af=_0x3e3644[_0xb47d('0x3c')][_0xb47d('0x25')]?_0x3e3644['query'][_0xb47d('0x25')]:!![];var _0x21c627=_0x3e3644['query'][_0xb47d('0xa7')]?_0x3e3644[_0xb47d('0x3c')][_0xb47d('0xa7')]:null;var _0x2c4bd1={'method':_0x3e3644[_0xb47d('0xa8')],'uri':util[_0xb47d('0x68')](_0xb47d('0xa9'),_0xa88f25,_0x3e3644[_0xb47d('0x3c')][_0xb47d('0x8')]),'json':_0x1b86af,'resolveWithFullResponse':!![],'encoding':_0x21c627,'qs':_0x3e3644[_0xb47d('0x3c')]};if(_0x3e3644[_0xb47d('0xaa')]){_0x2c4bd1[_0xb47d('0xaa')]=_0x3e3644[_0xb47d('0xaa')];if(_0x2c4bd1[_0xb47d('0xaa')][_0xb47d('0xab')]){delete _0x2c4bd1[_0xb47d('0xaa')][_0xb47d('0xab')];}}if(_0x2c4bd1['headers'][_0xb47d('0xac')]){delete _0x2c4bd1['headers'][_0xb47d('0xac')];}return rp(_0x2c4bd1);})['then'](function(_0x23f4ae){if(_0x23f4ae){_0x331dc9[_0xb47d('0x27')](_0x23f4ae[_0xb47d('0xaa')]);logger[_0xb47d('0x6b')](_0x23f4ae[_0xb47d('0x99')]);if(_[_0xb47d('0xad')](_0x3e3644[_0xb47d('0x3c')]['path'],'download')&&_0x23f4ae['statusCode']==0x1f4){return _0x331dc9[_0xb47d('0x22')](_0x23f4ae['statusCode']);}else{return _0x331dc9['status'](_0x23f4ae[_0xb47d('0xae')])[_0xb47d('0x35')](_0x23f4ae[_0xb47d('0x99')]);}}else{return _0x331dc9[_0xb47d('0x22')](0xc8);}})[_0xb47d('0x4e')](handleError(_0x331dc9,null));};exports[_0xb47d('0xaf')]=function(_0x3b07b7,_0x207dcd,_0x5da881){return BPromise[_0xb47d('0xa2')]()[_0xb47d('0x2e')](function(){if(!_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0x8')]){throw new Error(_0xb47d('0xa3'));}if(!_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0xa5')]){throw new Error(_0xb47d('0xb0'));}var _0x1a57fc=_0x3b07b7[_0xb47d('0x3c')]['hostname']?_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0xa4')]+':'+_0x3b07b7[_0xb47d('0x3c')]['port']:_0xb47d('0xa6')+_0x3b07b7['query'][_0xb47d('0xa5')];var _0x126bf7=_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0x25')]?_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0x25')]:!![];var _0x5e16ad=_0x3b07b7['query'][_0xb47d('0xa7')]?_0x3b07b7[_0xb47d('0x3c')][_0xb47d('0xa7')]:null;var _0xfe1ff2={'method':_0x3b07b7[_0xb47d('0xa8')],'uri':util[_0xb47d('0x68')](_0xb47d('0xa9'),_0x1a57fc,_0x3b07b7[_0xb47d('0x3c')]['path']),'json':_0x126bf7,'resolveWithFullResponse':!![],'encoding':_0x5e16ad,'body':_0x3b07b7['body']};if(_0x3b07b7[_0xb47d('0xaa')]){_0xfe1ff2[_0xb47d('0xaa')]=_0x3b07b7['headers'];if(_0xfe1ff2[_0xb47d('0xaa')][_0xb47d('0xab')]){delete _0xfe1ff2[_0xb47d('0xaa')]['content-length'];}}if(_0xfe1ff2[_0xb47d('0xaa')][_0xb47d('0xac')]){delete _0xfe1ff2[_0xb47d('0xaa')][_0xb47d('0xac')];}return rp(_0xfe1ff2);})[_0xb47d('0x2e')](function(_0x20fd2f){if(_0x20fd2f){_0x207dcd['set'](_0x20fd2f['headers']);logger[_0xb47d('0x6b')](_0x20fd2f[_0xb47d('0x99')]);return _0x207dcd['status'](_0x20fd2f['statusCode'])[_0xb47d('0x35')](_0x20fd2f[_0xb47d('0x99')]);}else{return _0x207dcd['sendStatus'](0xc8);}})[_0xb47d('0x4e')](handleError(_0x207dcd,null));}; \ No newline at end of file +var _0x2640=['sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','merge','where','type','filter','options','includeAll','include','findAll','rows','catch','show','params','download','find','join','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','**/*','root','server/files/plugins','finalize','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','extract-zip','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then'];(function(_0x2762eb,_0x34b29b){var _0x5765f0=function(_0x38a77e){while(--_0x38a77e){_0x2762eb['push'](_0x2762eb['shift']());}};_0x5765f0(++_0x34b29b);}(_0x2640,0x12d));var _0x0264=function(_0x400542,_0x3ab703){_0x400542=_0x400542-0x0;var _0x490a04=_0x2640[_0x400542];return _0x490a04;};'use strict';var pdf=require(_0x0264('0x0'));var emlformat=require(_0x0264('0x1'));var rimraf=require(_0x0264('0x2'));var zipdir=require(_0x0264('0x3'));var jsonpatch=require(_0x0264('0x4'));var rp=require(_0x0264('0x5'));var moment=require(_0x0264('0x6'));var BPromise=require(_0x0264('0x7'));var Mustache=require(_0x0264('0x8'));var util=require(_0x0264('0x9'));var path=require(_0x0264('0xa'));var sox=require(_0x0264('0xb'));var csv=require(_0x0264('0xc'));var ejs=require(_0x0264('0xd'));var fs=require('fs');var _=require(_0x0264('0xe'));var squel=require(_0x0264('0xf'));var crypto=require(_0x0264('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x0264('0x11'));var toCsv=require(_0x0264('0xc'));var querystring=require(_0x0264('0x12'));var Papa=require('papaparse');var extract=require(_0x0264('0x13'));var rimraf=require('rimraf');var archiver=require(_0x0264('0x14'));var Redis=require('ioredis');var authService=require(_0x0264('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x0264('0x16'));var hardwareService=require(_0x0264('0x17'));var logger=require(_0x0264('0x18'))(_0x0264('0x19'));var utils=require(_0x0264('0x1a'));var config=require(_0x0264('0x1b'));var db=require(_0x0264('0x1c'))['db'];config[_0x0264('0x1d')]=_[_0x0264('0x1e')](config[_0x0264('0x1d')],{'host':_0x0264('0x1f'),'port':0x18eb});var socket=require(_0x0264('0x20'))(new Redis(config[_0x0264('0x1d')]));require(_0x0264('0x21'))[_0x0264('0x22')](socket);function respondWithStatusCode(_0x20f64f,_0x18ae91){_0x18ae91=_0x18ae91||0xcc;return function(_0x3b5fd9){if(_0x3b5fd9){return _0x20f64f['sendStatus'](_0x18ae91);}return _0x20f64f[_0x0264('0x23')](_0x18ae91)[_0x0264('0x24')]();};}function respondWithResult(_0x516d61,_0x3209b5){_0x3209b5=_0x3209b5||0xc8;return function(_0x282d7c){if(_0x282d7c){return _0x516d61[_0x0264('0x23')](_0x3209b5)[_0x0264('0x25')](_0x282d7c);}};}function respondWithFilteredResult(_0x304a0c,_0x1cd80f){return function(_0x112b57){if(_0x112b57){var _0x4884dc=_0x112b57[_0x0264('0x26')],_0xb3d669=_0x1cd80f[_0x0264('0x27')],_0xc05aef=_0x1cd80f[_0x0264('0x27')]+_0x1cd80f[_0x0264('0x28')],_0x1ad815;if(_0xc05aef>=_0x4884dc){_0xc05aef=_0x4884dc;_0x1ad815=0xc8;}else{_0x1ad815=0xce;}_0x304a0c[_0x0264('0x23')](_0x1ad815);return _0x304a0c[_0x0264('0x29')](_0x0264('0x2a'),_0xb3d669+'-'+_0xc05aef+'/'+_0x4884dc)[_0x0264('0x25')](_0x112b57);}return null;};}function patchUpdates(_0x28454c){return function(_0xb8a215){try{jsonpatch[_0x0264('0x2b')](_0xb8a215,_0x28454c,!![]);}catch(_0x45eeef){return BPromise[_0x0264('0x2c')](_0x45eeef);}return _0xb8a215[_0x0264('0x2d')]();};}function saveUpdates(_0x21b3c8,_0x3d638b){return function(_0x2fc693){if(_0x2fc693){return _0x2fc693[_0x0264('0x2e')](_0x21b3c8)['then'](function(_0x2adc86){return _0x2adc86;});}return null;};}function removeEntity(_0x29478a,_0x32941a){return function(_0x50be1b){if(_0x50be1b){return _0x50be1b[_0x0264('0x2f')]()['then'](function(){var _0x44ae78=_0x50be1b[_0x0264('0x30')]({'plain':!![]});var _0xdfb519='Plugins';return db[_0x0264('0x31')]['destroy']({'where':{'type':_0xdfb519,'resourceId':_0x44ae78['id']}})[_0x0264('0x32')](function(){return _0x50be1b;});})[_0x0264('0x32')](function(){_0x29478a[_0x0264('0x23')](0xcc)[_0x0264('0x24')]();});}};}function handleEntityNotFound(_0x47d6b8,_0x42401e){return function(_0x363cb0){if(!_0x363cb0){_0x47d6b8[_0x0264('0x33')](0x194);}return _0x363cb0;};}function handleError(_0x26820d,_0x4ce948){_0x4ce948=_0x4ce948||0x1f4;return function(_0x175b70){logger[_0x0264('0x34')](_0x175b70[_0x0264('0x35')]);if(_0x175b70['name']){delete _0x175b70[_0x0264('0x36')];}_0x26820d['status'](_0x4ce948)[_0x0264('0x37')](_0x175b70);};}exports[_0x0264('0x38')]=function(_0xd5e386,_0x1dd4f1){var _0x2eb814={},_0x35191b={},_0x3862b1={'count':0x0,'rows':[]};var _0x75f32a=_[_0x0264('0x39')](db[_0x0264('0x3a')][_0x0264('0x3b')],function(_0xc9ae6e){return{'name':_0xc9ae6e[_0x0264('0x3c')],'type':_0xc9ae6e['type'][_0x0264('0x3d')]};});_0x35191b[_0x0264('0x3e')]=_[_0x0264('0x39')](_0x75f32a,_0x0264('0x36'));_0x35191b[_0x0264('0x3f')]=_[_0x0264('0x40')](_0xd5e386[_0x0264('0x3f')]);_0x35191b[_0x0264('0x41')]=_[_0x0264('0x42')](_0x35191b[_0x0264('0x3e')],_0x35191b['query']);_0x2eb814[_0x0264('0x43')]=_['intersection'](_0x35191b['model'],qs['fields'](_0xd5e386[_0x0264('0x3f')][_0x0264('0x44')]));_0x2eb814[_0x0264('0x43')]=_0x2eb814[_0x0264('0x43')][_0x0264('0x45')]?_0x2eb814[_0x0264('0x43')]:_0x35191b['model'];if(!_0xd5e386[_0x0264('0x3f')][_0x0264('0x46')]('nolimit')){_0x2eb814[_0x0264('0x28')]=qs[_0x0264('0x28')](_0xd5e386['query']['limit']);_0x2eb814['offset']=qs['offset'](_0xd5e386['query'][_0x0264('0x27')]);}_0x2eb814['order']=qs[_0x0264('0x47')](_0xd5e386[_0x0264('0x3f')][_0x0264('0x47')]);_0x2eb814['where']=qs[_0x0264('0x41')](_['pick'](_0xd5e386[_0x0264('0x3f')],_0x35191b['filters']),_0x75f32a);if(_0xd5e386[_0x0264('0x3f')]['filter']){_0x2eb814['where']=_[_0x0264('0x48')](_0x2eb814[_0x0264('0x49')],{'$or':_['map'](_0x75f32a,function(_0x40d922){if(_0x40d922[_0x0264('0x4a')]!=='VIRTUAL'){var _0x2e1742={};_0x2e1742[_0x40d922['name']]={'$like':'%'+_0xd5e386['query'][_0x0264('0x4b')]+'%'};return _0x2e1742;}})});}_0x2eb814=_['merge']({},_0x2eb814,_0xd5e386[_0x0264('0x4c')]);var _0x1b6453={'where':_0x2eb814[_0x0264('0x49')]};return db[_0x0264('0x3a')][_0x0264('0x26')](_0x1b6453)[_0x0264('0x32')](function(_0xe6093c){_0x3862b1[_0x0264('0x26')]=_0xe6093c;if(_0xd5e386[_0x0264('0x3f')][_0x0264('0x4d')]){_0x2eb814[_0x0264('0x4e')]=[{'all':!![]}];}return db[_0x0264('0x3a')][_0x0264('0x4f')](_0x2eb814);})[_0x0264('0x32')](function(_0x35742e){_0x3862b1[_0x0264('0x50')]=_0x35742e;return _0x3862b1;})[_0x0264('0x32')](respondWithFilteredResult(_0x1dd4f1,_0x2eb814))[_0x0264('0x51')](handleError(_0x1dd4f1,null));};exports[_0x0264('0x52')]=function(_0x115dfe,_0x46a8e4){var _0x53c6f9={'raw':!![],'where':{'id':_0x115dfe[_0x0264('0x53')]['id']}},_0x3d78e3={};_0x3d78e3['model']=_[_0x0264('0x40')](db[_0x0264('0x3a')][_0x0264('0x3b')]);_0x3d78e3[_0x0264('0x3f')]=_[_0x0264('0x40')](_0x115dfe[_0x0264('0x3f')]);_0x3d78e3[_0x0264('0x41')]=_[_0x0264('0x42')](_0x3d78e3['model'],_0x3d78e3[_0x0264('0x3f')]);_0x53c6f9[_0x0264('0x43')]=_[_0x0264('0x42')](_0x3d78e3[_0x0264('0x3e')],qs[_0x0264('0x44')](_0x115dfe[_0x0264('0x3f')][_0x0264('0x44')]));_0x53c6f9[_0x0264('0x43')]=_0x53c6f9[_0x0264('0x43')]['length']?_0x53c6f9[_0x0264('0x43')]:_0x3d78e3[_0x0264('0x3e')];if(_0x115dfe[_0x0264('0x3f')][_0x0264('0x4d')]){_0x53c6f9[_0x0264('0x4e')]=[{'all':!![]}];}_0x53c6f9=_[_0x0264('0x48')]({},_0x53c6f9,_0x115dfe[_0x0264('0x4c')]);return db[_0x0264('0x3a')]['find'](_0x53c6f9)[_0x0264('0x32')](handleEntityNotFound(_0x46a8e4,null))[_0x0264('0x32')](respondWithResult(_0x46a8e4,null))[_0x0264('0x51')](handleError(_0x46a8e4,null));};exports[_0x0264('0x54')]=function(_0x537915,_0x5ef84f,_0x46f347){return db[_0x0264('0x3a')][_0x0264('0x55')]({'where':{'id':_0x537915[_0x0264('0x53')]['id']},'attributes':[_0x0264('0x36'),'path'],'raw':!![]})[_0x0264('0x32')](handleEntityNotFound(_0x5ef84f,null))[_0x0264('0x32')](function(_0x52fae3){if(_0x52fae3){var _0x13e3fc=path[_0x0264('0x56')](config['root'],'server/files/plugins',util[_0x0264('0x57')](_0x0264('0x58'),path[_0x0264('0x59')](_0x52fae3[_0x0264('0xa')])));var _0xc3e987=fs[_0x0264('0x5a')](_0x13e3fc);var _0x49b6f2=archiver(_0x0264('0x5b'),{'zlib':{'level':0x9}});_0x49b6f2['on'](_0x0264('0x5c'),function(_0x4492c0){if(_0x4492c0[_0x0264('0x5d')]===_0x0264('0x5e')){logger[_0x0264('0x34')](_0x4492c0);}else{throw new db[(_0x0264('0x5f'))][(_0x0264('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x49b6f2['on']('error',function(_0x2b45f3){throw new db[(_0x0264('0x5f'))][(_0x0264('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x49b6f2[_0x0264('0x61')](_0xc3e987);_0x49b6f2[_0x0264('0x62')](_0x0264('0x63'),{'cwd':path[_0x0264('0x56')](config[_0x0264('0x64')],_0x0264('0x65'),path['dirname'](_0x52fae3[_0x0264('0xa')])),'ignore':[path[_0x0264('0x56')](path['basename'](_0x52fae3[_0x0264('0xa')]),'node_modules/**/*'),path['join'](path[_0x0264('0x59')](_0x52fae3[_0x0264('0xa')]),'attachments/**/*')],'nodir':!![]})[_0x0264('0x66')]();_0xc3e987['on']('close',function(){if(!fs[_0x0264('0x67')](_0x13e3fc)){throw new db[(_0x0264('0x5f'))][(_0x0264('0x60'))](_0x0264('0x68'));}return _0x5ef84f[_0x0264('0x54')](_0x13e3fc,util[_0x0264('0x57')](_0x0264('0x58'),path[_0x0264('0x59')](_0x52fae3[_0x0264('0xa')])),function(_0x441ac5){if(_0x441ac5){throw new db['Sequelize'][(_0x0264('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x0264('0x69')](_0x13e3fc);logger[_0x0264('0x6a')](_0x0264('0x6b'));logger[_0x0264('0x6a')](_0x0264('0x6c'));});});}return null;})[_0x0264('0x51')](handleError(_0x5ef84f,null));};exports['upload']=function(_0x492fad,_0x859459,_0xddb51a){var _0x22407a=path[_0x0264('0x59')](_0x492fad[_0x0264('0x6d')][_0x0264('0x6e')],path[_0x0264('0x6f')](_0x492fad['file'][_0x0264('0x6e')]));var _0x384ad7=path[_0x0264('0x56')](config[_0x0264('0x64')],'server/files/plugins',_0x492fad[_0x0264('0x6d')][_0x0264('0x6e')]);var _0x3aee45=path[_0x0264('0x56')](config[_0x0264('0x64')],_0x0264('0x65'),_0x22407a);logger[_0x0264('0x6a')](_0x0264('0x70'),_0x384ad7);logger[_0x0264('0x6a')]('Plugin\x20upload\x20destination:\x20%s',_0x3aee45);try{fs[_0x0264('0x71')](_0x384ad7,parseInt('0777',0x8));extract(_0x384ad7,{'dir':_0x3aee45},function(_0x5aad74){if(_0x5aad74){logger['error'](_0x5aad74);handleError(_0x5aad74,!![]);};var _0x3b454d=fs[_0x0264('0x72')](_0x3aee45);if(_0x3b454d[_0x0264('0x45')]>0x1){removeReferences(_0x384ad7,_0x3aee45);logger[_0x0264('0x34')](_0x0264('0x73'));return _0xddb51a(new Error(_0x0264('0x73')));}var _0x1fadaa=fs[_0x0264('0x74')](path[_0x0264('0x56')](_0x3aee45,_0x3b454d[0x0]));if(_0x1fadaa[_0x0264('0x75')]()){removeReferences(_0x384ad7,_0x3aee45);logger[_0x0264('0x34')](_0x0264('0x73'));return _0xddb51a(new Error(_0x0264('0x73')));}if(_0x1fadaa[_0x0264('0x76')]()){var _0x433a6f=fs[_0x0264('0x72')](path[_0x0264('0x56')](_0x3aee45,_0x3b454d[0x0]));if(_0x433a6f['length']===0x0){removeReferences(_0x384ad7,_0x3aee45);logger[_0x0264('0x34')]('Invalid\x20plugin\x20structure');return _0xddb51a(new Error(_0x0264('0x73')));}var _0x16b658=_0x433a6f[_0x0264('0x77')](function(_0x4fc4cd){return _0x4fc4cd===_0x0264('0x78');});if(!_0x16b658){return _0xddb51a(new Error(_0x0264('0x79')));}var _0x4eff46=fs[_0x0264('0x7a')](path[_0x0264('0x56')](_0x3aee45,_0x3b454d[0x0],_0x0264('0x78')));var _0x271761=JSON[_0x0264('0x7b')](_0x4eff46);if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x36')]){return _0xddb51a(new Error(_0x0264('0x7d')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x4a')]){return _0xddb51a(new Error(_0x0264('0x7e')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x7f')]){return _0xddb51a(new Error(_0x0264('0x80')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')]){return _0xddb51a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x271761['type']===_0x0264('0x82')){if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')]){return _0xddb51a(new Error(_0x0264('0x84')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')][_0x0264('0x85')]&&_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')][_0x0264('0x86')]){return _0xddb51a(new Error(_0x0264('0x87')));}}else if(_0x271761[_0x0264('0x4a')]===_0x0264('0x88')){if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x89')]){return _0xddb51a(new Error(_0x0264('0x8a')));}if(_0x0264('0x7c')==typeof _0x271761[_0x0264('0x81')][_0x0264('0x8b')]){return _0xddb51a(new Error(_0x0264('0x8c')));}}else{return _0xddb51a(new Error(_0x0264('0x8d')));}var _0x4d083d=_0x271761[_0x0264('0x36')];var _0x21bd66=_0x271761[_0x0264('0x8e')];var _0x356c68=_0x271761[_0x0264('0x4a')];var _0x3b1f48=_0x271761[_0x0264('0x8f')]?_0x271761[_0x0264('0x8f')]:'always';var _0x4241e5=_0x271761[_0x0264('0x90')]?_0x271761[_0x0264('0x90')]:_0x0264('0x91');var _0x3f756d='';var _0x1650b8='';var _0x37e325='';var _0x429179='';var _0x1dc929=_0x271761[_0x0264('0x7f')];if(_0x356c68===_0x0264('0x82')){if(_0x0264('0x7c')!=typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')]['admin']){var _0x1ef882=_0x271761[_0x0264('0x81')][_0x0264('0x83')][_0x0264('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x0264('0x92')](_0x1ef882)){_0x3f756d=path[_0x0264('0x56')]('plugins',_0x22407a,_0x3b454d[0x0],_0x1ef882);}else{_0x3f756d=_0x1ef882;}}else{logger[_0x0264('0x6a')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x0264('0x7c')!=typeof _0x271761[_0x0264('0x81')]['views'][_0x0264('0x86')]){var _0x202b62=_0x271761[_0x0264('0x81')][_0x0264('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0264('0x92')](_0x202b62)){_0x1650b8=path[_0x0264('0x56')](_0x0264('0x93'),_0x22407a,_0x3b454d[0x0],_0x202b62);}else{_0x1650b8=_0x202b62;}}else{logger[_0x0264('0x6a')](_0x0264('0x94'));}}else if(_0x356c68===_0x0264('0x88')){_0x37e325=_0x271761[_0x0264('0x81')]['scriptName'];_0x429179=_0x271761[_0x0264('0x81')][_0x0264('0x8b')];if('undefined'!=typeof _0x271761[_0x0264('0x81')][_0x0264('0x83')]){if('undefined'!=typeof _0x271761['parameters'][_0x0264('0x83')]['admin']){var _0x1ef882=_0x271761[_0x0264('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1ef882)){_0x3f756d=path['join'](_0x0264('0x93'),_0x22407a,_0x3b454d[0x0],_0x1ef882);}else{_0x3f756d=_0x1ef882;}}if('undefined'!=typeof _0x271761['parameters'][_0x0264('0x83')][_0x0264('0x86')]){var _0x202b62=_0x271761[_0x0264('0x81')]['views'][_0x0264('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x0264('0x92')](_0x202b62)){_0x1650b8=path[_0x0264('0x56')](_0x0264('0x93'),_0x22407a,_0x3b454d[0x0],_0x202b62);}else{_0x1650b8=_0x202b62;}}}}var _0x1f80c9={'name':_0x4d083d,'description':_0x21bd66,'path':path[_0x0264('0x56')](_0x22407a,_0x3b454d[0x0]),'type':_0x356c68,'sidebar':_0x3b1f48,'icon':_0x4241e5,'adminUrl':_0x3f756d,'agentUrl':_0x1650b8,'scriptName':_0x37e325,'scriptPath':_0x429179,'version':_0x1dc929};removeReferences(_0x384ad7,null);return db[_0x0264('0x3a')][_0x0264('0x95')](_0x1f80c9)[_0x0264('0x32')](function(_0x2dda59){var _0xe4700c={'role':_0x492fad[_0x0264('0x96')][_0x0264('0x97')],'userProfileId':_0x492fad[_0x0264('0x96')][_0x0264('0x98')]};if(!_0xe4700c)throw new Error(_0x0264('0x99'));if(_0xe4700c[_0x0264('0x97')]==='user'){var _0x3e0274=_0x2dda59['get']({'plain':!![]});return db[_0x0264('0x9a')][_0x0264('0x55')]({'where':{'name':_0x0264('0x9b'),'userProfileId':_0xe4700c[_0x0264('0x98')]},'raw':!![]})['then'](function(_0x236470){if(_0x236470&&_0x236470['autoAssociation']===0x0){return db['UserProfileResource'][_0x0264('0x95')]({'name':_0x3e0274[_0x0264('0x36')],'resourceId':_0x3e0274['id'],'type':_0x236470[_0x0264('0x36')],'sectionId':_0x236470['id']},{})[_0x0264('0x32')](function(){return _0x2dda59;});}else{return _0x2dda59;}})[_0x0264('0x51')](function(_0x4be295){logger[_0x0264('0x34')](_0x0264('0x9c'),_0x4be295);throw _0x4be295;});}return _0x2dda59;})[_0x0264('0x32')](respondWithResult(_0x859459,null))[_0x0264('0x51')](handleError(_0x859459,null));}});}catch(_0x4279d5){_0x859459[_0x0264('0x23')](0x1f4)['send'](_0x4279d5);}};function removeReferences(_0x5bb671,_0x3f6998){try{if(_0x5bb671){fs['unlinkSync'](_0x5bb671);logger[_0x0264('0x6a')](_0x0264('0x9d'));}if(_0x3f6998){rimraf(_0x3f6998,function(){});logger['info'](_0x0264('0x9e'));}}catch(_0x34b646){logger['error'](_0x34b646);}}exports[_0x0264('0x2e')]=function(_0x1c8f0b,_0x406129,_0x1720a7){return db[_0x0264('0x3a')][_0x0264('0x55')]({'where':{'id':_0x1c8f0b[_0x0264('0x53')]['id']}})[_0x0264('0x32')](handleEntityNotFound(_0x406129,null))[_0x0264('0x32')](saveUpdates(_0x1c8f0b[_0x0264('0x96')],null))[_0x0264('0x32')](respondWithResult(_0x406129,null))[_0x0264('0x51')](handleError(_0x406129,null));};exports['delete']=function(_0x242d31,_0x57a461,_0x39e50e){return db[_0x0264('0x3a')][_0x0264('0x55')]({'where':{'id':_0x242d31[_0x0264('0x53')]['id']}})[_0x0264('0x32')](function(_0x5be6bb){if(_0x5be6bb){return _0x5be6bb[_0x0264('0x2f')]();}})[_0x0264('0x32')](function(_0x4d8b7a){rimraf(path['join'](config['root'],_0x0264('0x65'),path[_0x0264('0x9f')](_0x4d8b7a[_0x0264('0xa')])),function(){});return _0x4d8b7a;})[_0x0264('0x32')](handleEntityNotFound(_0x57a461,null))[_0x0264('0x32')](respondWithStatusCode(_0x57a461,null))['catch'](handleError(_0x57a461,null));};exports[_0x0264('0xa0')]=function(_0xc6982b,_0x68d446,_0x15e170){return BPromise[_0x0264('0xa1')]()['then'](function(){if(!_0xc6982b[_0x0264('0x3f')][_0x0264('0xa')]){throw new Error(_0x0264('0xa2'));}if(!_0xc6982b[_0x0264('0x3f')][_0x0264('0xa3')]){throw new Error(_0x0264('0xa4'));}var _0x26bcb3=_0xc6982b[_0x0264('0x3f')][_0x0264('0xa5')]?_0xc6982b[_0x0264('0x3f')][_0x0264('0xa5')]+':'+_0xc6982b[_0x0264('0x3f')]['port']:'http://localhost:'+_0xc6982b[_0x0264('0x3f')]['port'];var _0x4b3b3d=_0xc6982b[_0x0264('0x3f')][_0x0264('0x25')]?_0xc6982b[_0x0264('0x3f')][_0x0264('0x25')]:!![];var _0x5202ae=_0xc6982b[_0x0264('0x3f')][_0x0264('0xa6')]?_0xc6982b[_0x0264('0x3f')]['encoding']:null;var _0xce4b69={'method':_0xc6982b[_0x0264('0xa7')],'uri':util[_0x0264('0x57')](_0x0264('0xa8'),_0x26bcb3,_0xc6982b[_0x0264('0x3f')][_0x0264('0xa')]),'json':_0x4b3b3d,'resolveWithFullResponse':!![],'encoding':_0x5202ae,'qs':_0xc6982b[_0x0264('0x3f')]};if(_0xc6982b[_0x0264('0xa9')]){_0xce4b69[_0x0264('0xa9')]=_0xc6982b['headers'];if(_0xce4b69['headers'][_0x0264('0xaa')]){delete _0xce4b69['headers'][_0x0264('0xaa')];}}if(_0xce4b69[_0x0264('0xa9')][_0x0264('0xab')]){delete _0xce4b69[_0x0264('0xa9')]['content-type'];}return rp(_0xce4b69);})['then'](function(_0x3e0d8c){if(_0x3e0d8c){_0x68d446[_0x0264('0x29')](_0x3e0d8c[_0x0264('0xa9')]);logger[_0x0264('0x6a')](_0x3e0d8c[_0x0264('0x96')]);if(_[_0x0264('0xac')](_0xc6982b[_0x0264('0x3f')][_0x0264('0xa')],_0x0264('0x54'))&&_0x3e0d8c['statusCode']==0x1f4){return _0x68d446[_0x0264('0x33')](_0x3e0d8c[_0x0264('0xad')]);}else{return _0x68d446[_0x0264('0x23')](_0x3e0d8c[_0x0264('0xad')])[_0x0264('0x37')](_0x3e0d8c[_0x0264('0x96')]);}}else{return _0x68d446[_0x0264('0x33')](0xc8);}})[_0x0264('0x51')](handleError(_0x68d446,null));};exports[_0x0264('0xae')]=function(_0x4b54e3,_0x30dbba,_0x5520ed){return BPromise[_0x0264('0xa1')]()[_0x0264('0x32')](function(){if(!_0x4b54e3['query']['path']){throw new Error(_0x0264('0xa2'));}if(!_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa3')]){throw new Error(_0x0264('0xa4'));}var _0x1b721c=_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa5')]?_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa5')]+':'+_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa3')]:_0x0264('0xaf')+_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa3')];var _0x35d62d=_0x4b54e3['query'][_0x0264('0x25')]?_0x4b54e3[_0x0264('0x3f')][_0x0264('0x25')]:!![];var _0x2d640d=_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa6')]?_0x4b54e3[_0x0264('0x3f')][_0x0264('0xa6')]:null;var _0x296bfa={'method':_0x4b54e3[_0x0264('0xa7')],'uri':util[_0x0264('0x57')](_0x0264('0xa8'),_0x1b721c,_0x4b54e3[_0x0264('0x3f')]['path']),'json':_0x35d62d,'resolveWithFullResponse':!![],'encoding':_0x2d640d,'body':_0x4b54e3[_0x0264('0x96')]};if(_0x4b54e3[_0x0264('0xa9')]){_0x296bfa['headers']=_0x4b54e3[_0x0264('0xa9')];if(_0x296bfa[_0x0264('0xa9')][_0x0264('0xaa')]){delete _0x296bfa[_0x0264('0xa9')][_0x0264('0xaa')];}}if(_0x296bfa[_0x0264('0xa9')][_0x0264('0xab')]){delete _0x296bfa[_0x0264('0xa9')]['content-type'];}return rp(_0x296bfa);})[_0x0264('0x32')](function(_0x1df936){if(_0x1df936){_0x30dbba['set'](_0x1df936[_0x0264('0xa9')]);logger[_0x0264('0x6a')](_0x1df936[_0x0264('0x96')]);return _0x30dbba[_0x0264('0x23')](_0x1df936[_0x0264('0xad')])[_0x0264('0x37')](_0x1df936[_0x0264('0x96')]);}else{return _0x30dbba['sendStatus'](0xc8);}})[_0x0264('0x51')](handleError(_0x30dbba,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 773c9bb..a912672 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 _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x781d,0x14a));var _0xd781=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x781d[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xd781('0x0'));var Plugin=require(_0xd781('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){PluginEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);PluginEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=PluginEvents; \ No newline at end of file +var _0xdf55=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xb70919,_0x360b63){var _0x285189=function(_0x3f7964){while(--_0x3f7964){_0xb70919['push'](_0xb70919['shift']());}};_0x285189(++_0x360b63);}(_0xdf55,0x83));var _0x5df5=function(_0x11fd4e,_0x1a32ec){_0x11fd4e=_0x11fd4e-0x0;var _0x324371=_0xdf55[_0x11fd4e];return _0x324371;};'use strict';var EventEmitter=require(_0x5df5('0x0'));var Plugin=require(_0x5df5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5df5('0x2')](0x0);var events={'afterCreate':_0x5df5('0x3'),'afterUpdate':'update','afterDestroy':_0x5df5('0x4')};function emitEvent(_0x773e15){return function(_0x381a4c,_0x521007,_0x289af4){PluginEvents[_0x5df5('0x5')](_0x773e15+':'+_0x381a4c['id'],_0x381a4c);PluginEvents[_0x5df5('0x5')](_0x773e15,_0x381a4c);_0x289af4(null);};}for(var e in events){if(events[_0x5df5('0x6')](e)){var event=events[e];Plugin[_0x5df5('0x7')](e,emitEvent(event));}}module[_0x5df5('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0860cfa..d48b4ba 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 _0xc8c8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes','exports','define','Plugin','lodash','util'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xc8c8,0xe2));var _0x8c8c=function(_0x501b9d,_0x19ee0e){_0x501b9d=_0x501b9d-0x0;var _0x120ad2=_0xc8c8[_0x501b9d];return _0x120ad2;};'use strict';var _=require(_0x8c8c('0x0'));var util=require(_0x8c8c('0x1'));var logger=require(_0x8c8c('0x2'))(_0x8c8c('0x3'));var moment=require(_0x8c8c('0x4'));var BPromise=require(_0x8c8c('0x5'));var rp=require(_0x8c8c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c8c('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c8c('0x8'));module[_0x8c8c('0x9')]=function(_0x391fe8,_0x268327){return _0x391fe8[_0x8c8c('0xa')](_0x8c8c('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a04=['bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','lodash','util','api','moment'];(function(_0x12c654,_0x40c772){var _0x136ecc=function(_0x18cd9d){while(--_0x18cd9d){_0x12c654['push'](_0x12c654['shift']());}};_0x136ecc(++_0x40c772);}(_0x9a04,0xf8));var _0x49a0=function(_0x212ab5,_0x42ebb0){_0x212ab5=_0x212ab5-0x0;var _0x475366=_0x9a04[_0x212ab5];return _0x475366;};'use strict';var _=require(_0x49a0('0x0'));var util=require(_0x49a0('0x1'));var logger=require('../../config/logger')(_0x49a0('0x2'));var moment=require(_0x49a0('0x3'));var BPromise=require(_0x49a0('0x4'));var rp=require(_0x49a0('0x5'));var fs=require('fs');var path=require(_0x49a0('0x6'));var rimraf=require(_0x49a0('0x7'));var config=require(_0x49a0('0x8'));var attributes=require(_0x49a0('0x9'));module[_0x49a0('0xa')]=function(_0x570c7d,_0x2f4789){return _0x570c7d['define'](_0x49a0('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index dca4deb..3560fbe 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 _0xe384=['create','body','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreatePlugin','Plugin'];(function(_0x35edb8,_0x2f1885){var _0x1f0246=function(_0x4ae489){while(--_0x4ae489){_0x35edb8['push'](_0x35edb8['shift']());}};_0x1f0246(++_0x2f1885);}(_0xe384,0x8b));var _0x4e38=function(_0x2a2359,_0x9abb35){_0x2a2359=_0x2a2359-0x0;var _0x342108=_0xe384[_0x2a2359];return _0x342108;};'use strict';var _=require(_0x4e38('0x0'));var util=require(_0x4e38('0x1'));var moment=require(_0x4e38('0x2'));var BPromise=require(_0x4e38('0x3'));var rs=require(_0x4e38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e38('0x5'))['db'];var utils=require(_0x4e38('0x6'));var logger=require('../../config/logger')(_0x4e38('0x7'));var config=require(_0x4e38('0x8'));var jayson=require(_0x4e38('0x9'));var client=jayson[_0x4e38('0xa')][_0x4e38('0xb')]({'port':0x232a});config[_0x4e38('0xc')]=_[_0x4e38('0xd')](config[_0x4e38('0xc')],{'host':_0x4e38('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e38('0xc')]));require(_0x4e38('0xf'))[_0x4e38('0x10')](socket);function respondWithRpcPromise(_0x49d842,_0x1d7981,_0x3a047c){return new BPromise(function(_0x398eea,_0x2d2cd2){return client['request'](_0x49d842,_0x3a047c)['then'](function(_0x18c2a1){logger[_0x4e38('0x11')](_0x4e38('0x12'),_0x1d7981,_0x4e38('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x1d7981,'request\x20sent',JSON[_0x4e38('0x14')](_0x18c2a1));if(_0x18c2a1[_0x4e38('0x15')]){if(_0x18c2a1[_0x4e38('0x15')]['code']===0x1f4){logger['error'](_0x4e38('0x12'),_0x1d7981,_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);return _0x2d2cd2(_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);}logger[_0x4e38('0x15')]('Plugin,\x20%s,\x20%s',_0x1d7981,_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);return _0x398eea(_0x18c2a1[_0x4e38('0x15')][_0x4e38('0x16')]);}else{logger[_0x4e38('0x11')](_0x4e38('0x12'),_0x1d7981,_0x4e38('0x13'));_0x398eea(_0x18c2a1[_0x4e38('0x17')][_0x4e38('0x16')]);}})['catch'](function(_0x5ce17e){logger['error'](_0x4e38('0x12'),_0x1d7981,_0x5ce17e);_0x2d2cd2(_0x5ce17e);});});}exports[_0x4e38('0x18')]=function(_0x44d5bf){var _0x2ecf20=this;return new Promise(function(_0x5ce12f,_0x123afb){return db[_0x4e38('0x19')][_0x4e38('0x1a')](_0x44d5bf[_0x4e38('0x1b')],{'raw':_0x44d5bf[_0x4e38('0x1c')]?_0x44d5bf[_0x4e38('0x1c')][_0x4e38('0x1d')]===undefined?!![]:![]:!![]})[_0x4e38('0x1e')](function(_0x14b473){logger[_0x4e38('0x11')](_0x4e38('0x18'),_0x44d5bf);logger[_0x4e38('0x1f')](_0x4e38('0x18'),_0x44d5bf,JSON[_0x4e38('0x14')](_0x14b473));_0x5ce12f(_0x14b473);})[_0x4e38('0x20')](function(_0x1d5811){logger[_0x4e38('0x15')]('CreatePlugin',_0x1d5811[_0x4e38('0x16')],_0x44d5bf);_0x123afb(_0x2ecf20[_0x4e38('0x15')](0x1f4,_0x1d5811[_0x4e38('0x16')]));});});}; \ No newline at end of file +var _0x7a37=['error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','moment','bluebird','../../config/logger','../../config/environment','client','defaults','localhost','redis','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x33a7a9,_0xb33ec5){var _0x53b7af=function(_0x56bb7d){while(--_0x56bb7d){_0x33a7a9['push'](_0x33a7a9['shift']());}};_0x53b7af(++_0xb33ec5);}(_0x7a37,0x184));var _0x77a3=function(_0x3f731b,_0x4d4d7e){_0x3f731b=_0x3f731b-0x0;var _0x5e0592=_0x7a37[_0x3f731b];return _0x5e0592;};'use strict';var _=require(_0x77a3('0x0'));var util=require('util');var moment=require(_0x77a3('0x1'));var BPromise=require(_0x77a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x77a3('0x3'))('rpc');var config=require(_0x77a3('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x77a3('0x5')]['http']({'port':0x232a});config['redis']=_[_0x77a3('0x6')](config['redis'],{'host':_0x77a3('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77a3('0x8')]));require(_0x77a3('0x9'))['register'](socket);function respondWithRpcPromise(_0x1b3b0d,_0x4a2e40,_0xc4d232){return new BPromise(function(_0x2b8499,_0x1038e9){return client[_0x77a3('0xa')](_0x1b3b0d,_0xc4d232)[_0x77a3('0xb')](function(_0x3e43ea){logger[_0x77a3('0xc')](_0x77a3('0xd'),_0x4a2e40,_0x77a3('0xe'));logger[_0x77a3('0xf')](_0x77a3('0x10'),_0x4a2e40,_0x77a3('0xe'),JSON[_0x77a3('0x11')](_0x3e43ea));if(_0x3e43ea[_0x77a3('0x12')]){if(_0x3e43ea['error'][_0x77a3('0x13')]===0x1f4){logger[_0x77a3('0x12')]('Plugin,\x20%s,\x20%s',_0x4a2e40,_0x3e43ea[_0x77a3('0x12')][_0x77a3('0x14')]);return _0x1038e9(_0x3e43ea['error']['message']);}logger['error'](_0x77a3('0xd'),_0x4a2e40,_0x3e43ea['error'][_0x77a3('0x14')]);return _0x2b8499(_0x3e43ea[_0x77a3('0x12')][_0x77a3('0x14')]);}else{logger[_0x77a3('0xc')](_0x77a3('0xd'),_0x4a2e40,_0x77a3('0xe'));_0x2b8499(_0x3e43ea[_0x77a3('0x15')][_0x77a3('0x14')]);}})[_0x77a3('0x16')](function(_0x3273e3){logger['error'](_0x77a3('0xd'),_0x4a2e40,_0x3273e3);_0x1038e9(_0x3273e3);});});}exports['CreatePlugin']=function(_0x128a1b){var _0x1b0759=this;return new Promise(function(_0x1cdd55,_0xaa9540){return db[_0x77a3('0x17')][_0x77a3('0x18')](_0x128a1b[_0x77a3('0x19')],{'raw':_0x128a1b[_0x77a3('0x1a')]?_0x128a1b[_0x77a3('0x1a')][_0x77a3('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xf9d33f){logger[_0x77a3('0xc')](_0x77a3('0x1c'),_0x128a1b);logger[_0x77a3('0xf')]('CreatePlugin',_0x128a1b,JSON[_0x77a3('0x11')](_0xf9d33f));_0x1cdd55(_0xf9d33f);})[_0x77a3('0x16')](function(_0x3acfad){logger['error'](_0x77a3('0x1c'),_0x3acfad['message'],_0x128a1b);_0xaa9540(_0x1b0759[_0x77a3('0x12')](0x1f4,_0x3acfad[_0x77a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b574181..9cfd238 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 _0x4d00=['removeListener','register','length','plugin:','./plugin.events','save','update','emit'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x4d00,0x7c));var _0x04d0=function(_0x1d611d,_0x4f1847){_0x1d611d=_0x1d611d-0x0;var _0x4edae6=_0x4d00[_0x1d611d];return _0x4edae6;};'use strict';var PluginEvents=require(_0x04d0('0x0'));var events=[_0x04d0('0x1'),'remove',_0x04d0('0x2')];function createListener(_0x381b73,_0x38c783){return function(_0x3c3f50){_0x38c783[_0x04d0('0x3')](_0x381b73,_0x3c3f50);};}function removeListener(_0x3307ff,_0xe00684){return function(){PluginEvents[_0x04d0('0x4')](_0x3307ff,_0xe00684);};}exports[_0x04d0('0x5')]=function(_0x5d6246){for(var _0x11608c=0x0,_0x1b652a=events[_0x04d0('0x6')];_0x11608c<_0x1b652a;_0x11608c++){var _0xbc896=events[_0x11608c];var _0x5c1cdb=createListener(_0x04d0('0x7')+_0xbc896,_0x5d6246);PluginEvents['on'](_0xbc896,_0x5c1cdb);}}; \ No newline at end of file +var _0x7e22=['update','emit','register','plugin:','./plugin.events','remove'];(function(_0x27332e,_0x247ad6){var _0x5882fc=function(_0x263c21){while(--_0x263c21){_0x27332e['push'](_0x27332e['shift']());}};_0x5882fc(++_0x247ad6);}(_0x7e22,0x1d8));var _0x27e2=function(_0x568a91,_0x19aaa7){_0x568a91=_0x568a91-0x0;var _0x764498=_0x7e22[_0x568a91];return _0x764498;};'use strict';var PluginEvents=require(_0x27e2('0x0'));var events=['save',_0x27e2('0x1'),_0x27e2('0x2')];function createListener(_0x34245e,_0x317692){return function(_0x1b0477){_0x317692[_0x27e2('0x3')](_0x34245e,_0x1b0477);};}function removeListener(_0x5e5b08,_0x43868c){return function(){PluginEvents['removeListener'](_0x5e5b08,_0x43868c);};}exports[_0x27e2('0x4')]=function(_0x350996){for(var _0x3eb3cd=0x0,_0x8ec259=events['length'];_0x3eb3cd<_0x8ec259;_0x3eb3cd++){var _0x207ab6=events[_0x3eb3cd];var _0x419985=createListener(_0x27e2('0x5')+_0x207ab6,_0x350996);PluginEvents['on'](_0x207ab6,_0x419985);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 03b26d6..20b8e87 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 _0x6e5f=['index','/:id','post','put','update','delete','destroy','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0x20ac66,_0x242c55){var _0x3b4f46=function(_0x361cee){while(--_0x361cee){_0x20ac66['push'](_0x20ac66['shift']());}};_0x3b4f46(++_0x242c55);}(_0x6e5f,0x1e8));var _0xf6e5=function(_0x59750f,_0x274c1e){_0x59750f=_0x59750f-0x0;var _0x2fbda0=_0x6e5f[_0x59750f];return _0x2fbda0;};'use strict';var express=require(_0xf6e5('0x0'));var router=express[_0xf6e5('0x1')]();var auth=require(_0xf6e5('0x2'));var controller=require(_0xf6e5('0x3'));router[_0xf6e5('0x4')]('/',auth[_0xf6e5('0x5')](),controller[_0xf6e5('0x6')]);router[_0xf6e5('0x4')](_0xf6e5('0x7'),auth[_0xf6e5('0x5')](),controller['show']);router[_0xf6e5('0x8')]('/',auth[_0xf6e5('0x5')](),controller['create']);router[_0xf6e5('0x9')](_0xf6e5('0x7'),auth[_0xf6e5('0x5')](),controller[_0xf6e5('0xa')]);router[_0xf6e5('0xb')](_0xf6e5('0x7'),auth[_0xf6e5('0x5')](),controller[_0xf6e5('0xc')]);module['exports']=router; \ No newline at end of file +var _0x51bc=['Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x49dd44,_0x2d169a){var _0x40ec9f=function(_0x582ae9){while(--_0x582ae9){_0x49dd44['push'](_0x49dd44['shift']());}};_0x40ec9f(++_0x2d169a);}(_0x51bc,0x179));var _0xc51b=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x51bc[_0x100682];return _0xcb6e87;};'use strict';var express=require('express');var router=express[_0xc51b('0x0')]();var auth=require(_0xc51b('0x1'));var controller=require(_0xc51b('0x2'));router[_0xc51b('0x3')]('/',auth[_0xc51b('0x4')](),controller[_0xc51b('0x5')]);router['get'](_0xc51b('0x6'),auth['isAuthenticated'](),controller[_0xc51b('0x7')]);router[_0xc51b('0x8')]('/',auth[_0xc51b('0x4')](),controller[_0xc51b('0x9')]);router['put']('/:id',auth[_0xc51b('0x4')](),controller[_0xc51b('0xa')]);router[_0xc51b('0xb')](_0xc51b('0x6'),auth[_0xc51b('0x4')](),controller[_0xc51b('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index f6d6c0c..529b6f6 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 _0x4f37=['dirname','start','send','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','params','Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','reject','express','motion2','length','then','show','describe','catch','create','body','../../files/plugins','cwd','chdir'];(function(_0x536c83,_0xe956ca){var _0x2a5945=function(_0x354ab2){while(--_0x354ab2){_0x536c83['push'](_0x536c83['shift']());}};_0x2a5945(++_0xe956ca);}(_0x4f37,0x1d3));var _0x74f3=function(_0x238e43,_0x51d1f0){_0x238e43=_0x238e43-0x0;var _0x38e1be=_0x4f37[_0x238e43];return _0x38e1be;};'use strict';var _=require('lodash');var pm2=require(_0x74f3('0x0'));var logger=require('../../config/logger')(_0x74f3('0x1'));var path=require('path');var exec=require(_0x74f3('0x2'))[_0x74f3('0x3')];var BPromise=require(_0x74f3('0x4'));function handleEntityNotFound(_0x5d3a49,_0x2e6ce1){return function(_0x30604f){if(!_0x30604f){_0x5d3a49[_0x74f3('0x5')](0x194);;}return _0x30604f;};}function respondWithResult(_0x568461,_0x24861c){_0x24861c=_0x24861c||0xc8;return function(_0x51ff33){if(_0x51ff33){return _0x568461[_0x74f3('0x6')](_0x24861c)[_0x74f3('0x7')](_0x51ff33);}return null;};}function handleError(_0x2dd67b,_0x32c6ca){_0x32c6ca=_0x32c6ca||0x1f4;return function(_0x194929){logger[_0x74f3('0x8')](_0x194929[_0x74f3('0x9')]);if(_0x194929[_0x74f3('0xa')]){delete _0x194929[_0x74f3('0xa')];}_0x2dd67b[_0x74f3('0x6')](_0x32c6ca)['send'](_0x194929);};}function execChildProcess(){return new BPromise(function(_0x3b2bf6,_0x2977c5){exec(_0x74f3('0xb'),function(_0x24802a,_0x3645d7,_0xfcc739){logger['info'](_0x3645d7);logger[_0x74f3('0xc')](_0xfcc739);if(_0x24802a){logger[_0x74f3('0x8')](_0x24802a);return _0x2977c5(_0x24802a);}return _0x3b2bf6(_0x3645d7);});});}exports[_0x74f3('0xd')]=function(_0x4ab3df,_0x4f7259){return pm2['list']()['then'](function(_0x5d2377){if(_0x5d2377){var _0x2cad05=_[_0x74f3('0xe')](_0x5d2377,function(_0x17e533){return _0x17e533[_0x74f3('0xa')]===_0x74f3('0xf')||_0x17e533[_0x74f3('0xa')]===_0x74f3('0x10');});return{'rows':_0x2cad05,'count':_0x2cad05[_0x74f3('0x11')]};}return null;})[_0x74f3('0x12')](respondWithResult(_0x4f7259,null))['catch'](handleError(_0x4f7259,null));};exports[_0x74f3('0x13')]=function(_0x2462e3,_0x1c4574){return pm2[_0x74f3('0x14')](_0x2462e3['params']['id'])[_0x74f3('0x12')](respondWithResult(_0x1c4574,null))[_0x74f3('0x12')](handleEntityNotFound(_0x1c4574,null))[_0x74f3('0x15')](handleError(_0x1c4574,null));};exports[_0x74f3('0x16')]=function(_0x4b4d99,_0xe45cd3){if(_0x4b4d99[_0x74f3('0x17')]['name']&&_0x4b4d99[_0x74f3('0x17')]['script']){var _0x51f82f=path['join'](__dirname,_0x74f3('0x18'),_0x4b4d99['body']['script']);var _0x9c29e5=process[_0x74f3('0x19')]();process[_0x74f3('0x1a')](path[_0x74f3('0x1b')](_0x51f82f));return execChildProcess()[_0x74f3('0x12')](function(_0x4ba4ea){process[_0x74f3('0x1a')](_0x9c29e5);return pm2[_0x74f3('0x1c')]({'name':_0x4b4d99[_0x74f3('0x17')]['name'],'script':_0x51f82f});})[_0x74f3('0x12')](function(_0x2430bb){pm2['dump']();return _0x2430bb[0x0];})[_0x74f3('0x12')](respondWithResult(_0xe45cd3,0xc9))['catch'](handleError(_0xe45cd3,null));}else{return _0xe45cd3['status'](0x1f4)[_0x74f3('0x1d')]({'message':_0x74f3('0x1e')});}};exports[_0x74f3('0x1f')]=function(_0x145e2e,_0x1b22b8){if(_0x145e2e[_0x74f3('0x17')]['id']){delete _0x145e2e[_0x74f3('0x17')]['id'];}var _0x5909cd={'online':'restart','stopped':_0x74f3('0x20')};if(_0x5909cd[_0x74f3('0x21')](_0x145e2e['body']['status'])){return pm2[_0x5909cd[_0x145e2e['body'][_0x74f3('0x6')]]](_0x145e2e['params']['id'])[_0x74f3('0x12')](respondWithResult(_0x1b22b8,0xc8))[_0x74f3('0x15')](handleError(_0x1b22b8,null));}else{return _0x1b22b8[_0x74f3('0x6')](0x1f4)[_0x74f3('0x1d')]({'message':_0x74f3('0x22')});}};exports[_0x74f3('0x23')]=function(_0x1d8756,_0x266e2d){if(_0x1d8756[_0x74f3('0x17')]['id']){delete _0x1d8756['body']['id'];}if(_0x1d8756[_0x74f3('0x24')]['id']){return pm2['delete'](_0x1d8756[_0x74f3('0x24')]['id'])[_0x74f3('0x12')](function(_0x4ce3d0){pm2['dump']();return _0x4ce3d0[0x0];})[_0x74f3('0x12')](respondWithResult(_0x266e2d,null))['catch'](handleError(_0x266e2d,null));}else{return _0x266e2d[_0x74f3('0x6')](0x1f4)['send']({'message':_0x74f3('0x25')});}}; \ No newline at end of file +var _0x0fe9=['../../config/logger','child_process','exec','bluebird','json','stack','status','send','npm\x20install','info','index','list','then','reject','name','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x0fe9,0x18e));var _0x90fe=function(_0x348126,_0x148d92){_0x348126=_0x348126-0x0;var _0x3b19f5=_0x0fe9[_0x348126];return _0x3b19f5;};'use strict';var _=require(_0x90fe('0x0'));var pm2=require(_0x90fe('0x1'));var logger=require(_0x90fe('0x2'))('api');var path=require('path');var exec=require(_0x90fe('0x3'))[_0x90fe('0x4')];var BPromise=require(_0x90fe('0x5'));function handleEntityNotFound(_0x1c98fc,_0x36f5c4){return function(_0x409016){if(!_0x409016){_0x1c98fc['sendStatus'](0x194);;}return _0x409016;};}function respondWithResult(_0xebc5d1,_0x372536){_0x372536=_0x372536||0xc8;return function(_0x731a){if(_0x731a){return _0xebc5d1['status'](_0x372536)[_0x90fe('0x6')](_0x731a);}return null;};}function handleError(_0x5d39de,_0xaf31e8){_0xaf31e8=_0xaf31e8||0x1f4;return function(_0x3a8216){logger['error'](_0x3a8216[_0x90fe('0x7')]);if(_0x3a8216['name']){delete _0x3a8216['name'];}_0x5d39de[_0x90fe('0x8')](_0xaf31e8)[_0x90fe('0x9')](_0x3a8216);};}function execChildProcess(){return new BPromise(function(_0x147e86,_0x5ee1fb){exec(_0x90fe('0xa'),function(_0x49dc5c,_0x421d1d,_0xed19c0){logger[_0x90fe('0xb')](_0x421d1d);logger[_0x90fe('0xb')](_0xed19c0);if(_0x49dc5c){logger['error'](_0x49dc5c);return _0x5ee1fb(_0x49dc5c);}return _0x147e86(_0x421d1d);});});}exports[_0x90fe('0xc')]=function(_0x546470,_0x706879){return pm2[_0x90fe('0xd')]()[_0x90fe('0xe')](function(_0x2776f1){if(_0x2776f1){var _0xdc29d=_[_0x90fe('0xf')](_0x2776f1,function(_0x29a194){return _0x29a194[_0x90fe('0x10')]===_0x90fe('0x11')||_0x29a194[_0x90fe('0x10')]===_0x90fe('0x12');});return{'rows':_0xdc29d,'count':_0xdc29d[_0x90fe('0x13')]};}return null;})['then'](respondWithResult(_0x706879,null))[_0x90fe('0x14')](handleError(_0x706879,null));};exports[_0x90fe('0x15')]=function(_0x482ee4,_0xe00888){return pm2[_0x90fe('0x16')](_0x482ee4[_0x90fe('0x17')]['id'])[_0x90fe('0xe')](respondWithResult(_0xe00888,null))[_0x90fe('0xe')](handleEntityNotFound(_0xe00888,null))['catch'](handleError(_0xe00888,null));};exports['create']=function(_0x392f8e,_0x378a45){if(_0x392f8e[_0x90fe('0x18')][_0x90fe('0x10')]&&_0x392f8e[_0x90fe('0x18')][_0x90fe('0x19')]){var _0x1275fe=path[_0x90fe('0x1a')](__dirname,_0x90fe('0x1b'),_0x392f8e[_0x90fe('0x18')][_0x90fe('0x19')]);var _0x4730d0=process[_0x90fe('0x1c')]();process[_0x90fe('0x1d')](path['dirname'](_0x1275fe));return execChildProcess()[_0x90fe('0xe')](function(_0x4254ab){process[_0x90fe('0x1d')](_0x4730d0);return pm2[_0x90fe('0x1e')]({'name':_0x392f8e[_0x90fe('0x18')]['name'],'script':_0x1275fe});})[_0x90fe('0xe')](function(_0x3cee85){pm2[_0x90fe('0x1f')]();return _0x3cee85[0x0];})[_0x90fe('0xe')](respondWithResult(_0x378a45,0xc9))[_0x90fe('0x14')](handleError(_0x378a45,null));}else{return _0x378a45[_0x90fe('0x8')](0x1f4)['send']({'message':_0x90fe('0x20')});}};exports[_0x90fe('0x21')]=function(_0x2444fb,_0x4c8ab5){if(_0x2444fb[_0x90fe('0x18')]['id']){delete _0x2444fb['body']['id'];}var _0x5b4da5={'online':'restart','stopped':_0x90fe('0x22')};if(_0x5b4da5[_0x90fe('0x23')](_0x2444fb[_0x90fe('0x18')][_0x90fe('0x8')])){return pm2[_0x5b4da5[_0x2444fb[_0x90fe('0x18')][_0x90fe('0x8')]]](_0x2444fb[_0x90fe('0x17')]['id'])['then'](respondWithResult(_0x4c8ab5,0xc8))['catch'](handleError(_0x4c8ab5,null));}else{return _0x4c8ab5['status'](0x1f4)[_0x90fe('0x9')]({'message':_0x90fe('0x24')});}};exports[_0x90fe('0x25')]=function(_0x4bfd74,_0x161d8d){if(_0x4bfd74[_0x90fe('0x18')]['id']){delete _0x4bfd74['body']['id'];}if(_0x4bfd74[_0x90fe('0x17')]['id']){return pm2[_0x90fe('0x26')](_0x4bfd74[_0x90fe('0x17')]['id'])[_0x90fe('0xe')](function(_0x2f5143){pm2[_0x90fe('0x1f')]();return _0x2f5143[0x0];})[_0x90fe('0xe')](respondWithResult(_0x161d8d,null))['catch'](handleError(_0x161d8d,null));}else{return _0x161d8d[_0x90fe('0x8')](0x1f4)[_0x90fe('0x9')]({'message':_0x90fe('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 242d88d..0633d71 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 _0xf916=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xf916,0xf5));var _0x6f91=function(_0x464b9c,_0x220cd4){_0x464b9c=_0x464b9c-0x0;var _0x801f58=_0xf916[_0x464b9c];return _0x801f58;};'use strict';var multer=require(_0x6f91('0x0'));var util=require('util');var path=require(_0x6f91('0x1'));var timeout=require(_0x6f91('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6f91('0x3'));var interaction=require(_0x6f91('0x4'));var config=require(_0x6f91('0x5'));module['exports']=router; \ No newline at end of file +var _0xf925=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x5d3076,_0x225f7f){var _0x150ef2=function(_0x34b015){while(--_0x34b015){_0x5d3076['push'](_0x5d3076['shift']());}};_0x150ef2(++_0x225f7f);}(_0xf925,0x17c));var _0x5f92=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0xf925[_0x229cfd];return _0x5621a3;};'use strict';var multer=require(_0x5f92('0x0'));var util=require(_0x5f92('0x1'));var path=require(_0x5f92('0x2'));var timeout=require(_0x5f92('0x3'));var express=require(_0x5f92('0x4'));var router=express[_0x5f92('0x5')]();var auth=require(_0x5f92('0x6'));var interaction=require(_0x5f92('0x7'));var config=require(_0x5f92('0x8'));module[_0x5f92('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 7c6ec69..792e993 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 _0x7223=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x9309,_0x1f26ca){var _0x2b0a89=function(_0x341668){while(--_0x341668){_0x9309['push'](_0x9309['shift']());}};_0x2b0a89(++_0x1f26ca);}(_0x7223,0x154));var _0x3722=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x7223[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0x3722('0x0'));module[_0x3722('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3722('0x2')]},'scheduledat':{'type':Sequelize[_0x3722('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3722('0x3')]},'ringtime':{'type':Sequelize[_0x3722('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3722('0x2')]},'membername':{'type':Sequelize[_0x3722('0x2')]}}; \ No newline at end of file +var _0x75a0=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x42c810,_0x3786c9){var _0x32466f=function(_0x31e26b){while(--_0x31e26b){_0x42c810['push'](_0x42c810['shift']());}};_0x32466f(++_0x3786c9);}(_0x75a0,0x19a));var _0x075a=function(_0x53f3ad,_0x39163e){_0x53f3ad=_0x53f3ad-0x0;var _0x48b203=_0x75a0[_0x53f3ad];return _0x48b203;};'use strict';var Sequelize=require(_0x075a('0x0'));module[_0x075a('0x1')]={'state':{'type':Sequelize[_0x075a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x075a('0x3')]},'scheduledat':{'type':Sequelize[_0x075a('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x075a('0x4')]},'responsetime':{'type':Sequelize[_0x075a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x075a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x075a('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9014a5c..5b79e8a 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 _0xd840=['rimraf','./reportAgentPreview.attributes','exports','report_agent_preview','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xd840,0x14e));var _0x0d84=function(_0x26a46b,_0x54c9c1){_0x26a46b=_0x26a46b-0x0;var _0x226e55=_0xd840[_0x26a46b];return _0x226e55;};'use strict';var _=require('lodash');var util=require(_0x0d84('0x0'));var logger=require(_0x0d84('0x1'))(_0x0d84('0x2'));var moment=require(_0x0d84('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d84('0x4'));var fs=require('fs');var path=require(_0x0d84('0x5'));var rimraf=require(_0x0d84('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d84('0x7'));module[_0x0d84('0x8')]=function(_0x41527c,_0x1c9c88){return _0x41527c['define']('ReportAgentPreview',attributes,{'tableName':_0x0d84('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc02=['../../config/logger','api','moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview'];(function(_0x1493fa,_0x29d372){var _0x3a3dd2=function(_0x3ec61a){while(--_0x3ec61a){_0x1493fa['push'](_0x1493fa['shift']());}};_0x3a3dd2(++_0x29d372);}(_0xbc02,0x1f4));var _0x2bc0=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xbc02[_0x17784a];return _0x41aded;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2bc0('0x0'))(_0x2bc0('0x1'));var moment=require(_0x2bc0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bc0('0x3'));var rimraf=require(_0x2bc0('0x4'));var config=require(_0x2bc0('0x5'));var attributes=require(_0x2bc0('0x6'));module[_0x2bc0('0x7')]=function(_0x2e8bc7,_0x59a3d4){return _0x2e8bc7[_0x2bc0('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x2bc0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 782c896..57de7ef 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 _0x7684=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4f1140,_0xdd3e4d){var _0x3e8bbe=function(_0x23d4c9){while(--_0x23d4c9){_0x4f1140['push'](_0x4f1140['shift']());}};_0x3e8bbe(++_0xdd3e4d);}(_0x7684,0x11f));var _0x4768=function(_0x2fe31b,_0x345e28){_0x2fe31b=_0x2fe31b-0x0;var _0x13b946=_0x7684[_0x2fe31b];return _0x13b946;};'use strict';var _=require(_0x4768('0x0'));var util=require('util');var moment=require(_0x4768('0x1'));var BPromise=require(_0x4768('0x2'));var rs=require(_0x4768('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4768('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4768('0x5'))('rpc');var config=require(_0x4768('0x6'));var jayson=require(_0x4768('0x7'));var client=jayson[_0x4768('0x8')][_0x4768('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4432da,_0x2b42bf,_0x9ba90c){return new BPromise(function(_0x3fc3b6,_0x5f25e0){return client[_0x4768('0xa')](_0x4432da,_0x9ba90c)[_0x4768('0xb')](function(_0x13689e){logger[_0x4768('0xc')](_0x4768('0xd'),_0x2b42bf,_0x4768('0xe'));logger[_0x4768('0xf')](_0x4768('0x10'),_0x2b42bf,_0x4768('0xe'),JSON['stringify'](_0x13689e));if(_0x13689e[_0x4768('0x11')]){if(_0x13689e[_0x4768('0x11')][_0x4768('0x12')]===0x1f4){logger[_0x4768('0x11')](_0x4768('0xd'),_0x2b42bf,_0x13689e[_0x4768('0x11')][_0x4768('0x13')]);return _0x5f25e0(_0x13689e[_0x4768('0x11')]['message']);}logger[_0x4768('0x11')](_0x4768('0xd'),_0x2b42bf,_0x13689e[_0x4768('0x11')][_0x4768('0x13')]);return _0x3fc3b6(_0x13689e[_0x4768('0x11')][_0x4768('0x13')]);}else{logger[_0x4768('0xc')](_0x4768('0xd'),_0x2b42bf,_0x4768('0xe'));_0x3fc3b6(_0x13689e['result']['message']);}})['catch'](function(_0x1b4b1b){logger[_0x4768('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2b42bf,_0x1b4b1b);_0x5f25e0(_0x1b4b1b);});});}exports['CreateReportAgentPreview']=function(_0x5a083e){var _0x101b7c=this;return new Promise(function(_0x5a98c9,_0x2f82db){return db[_0x4768('0x14')][_0x4768('0x15')](_0x5a083e[_0x4768('0x16')],{'raw':_0x5a083e[_0x4768('0x17')]?_0x5a083e[_0x4768('0x17')][_0x4768('0x18')]===undefined?!![]:![]:!![]})[_0x4768('0xb')](function(_0x8e3635){logger[_0x4768('0xc')]('CreateReportAgentPreview',_0x5a083e);logger['debug'](_0x4768('0x19'),_0x5a083e,JSON[_0x4768('0x1a')](_0x8e3635));_0x5a98c9(_0x8e3635);})['catch'](function(_0x5da0ee){logger[_0x4768('0x11')](_0x4768('0x19'),_0x5da0ee[_0x4768('0x13')],_0x5a083e);_0x2f82db(_0x101b7c['error'](0x1f4,_0x5da0ee['message']));});});}; \ No newline at end of file +var _0xd8f9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','body','options','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x53e54e,_0x1d3f75){var _0x505560=function(_0x17fda6){while(--_0x17fda6){_0x53e54e['push'](_0x53e54e['shift']());}};_0x505560(++_0x1d3f75);}(_0xd8f9,0xa3));var _0x9d8f=function(_0x5ccaad,_0x521445){_0x5ccaad=_0x5ccaad-0x0;var _0x20a9c8=_0xd8f9[_0x5ccaad];return _0x20a9c8;};'use strict';var _=require(_0x9d8f('0x0'));var util=require(_0x9d8f('0x1'));var moment=require('moment');var BPromise=require(_0x9d8f('0x2'));var rs=require(_0x9d8f('0x3'));var fs=require('fs');var Redis=require(_0x9d8f('0x4'));var db=require(_0x9d8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d8f('0x6'))(_0x9d8f('0x7'));var config=require(_0x9d8f('0x8'));var jayson=require(_0x9d8f('0x9'));var client=jayson[_0x9d8f('0xa')][_0x9d8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fe960,_0x4ed79d,_0x5ead25){return new BPromise(function(_0x366291,_0x279d98){return client['request'](_0x1fe960,_0x5ead25)[_0x9d8f('0xc')](function(_0x3aff4c){logger[_0x9d8f('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x4ed79d,'request\x20sent');logger[_0x9d8f('0xe')](_0x9d8f('0xf'),_0x4ed79d,_0x9d8f('0x10'),JSON[_0x9d8f('0x11')](_0x3aff4c));if(_0x3aff4c[_0x9d8f('0x12')]){if(_0x3aff4c[_0x9d8f('0x12')][_0x9d8f('0x13')]===0x1f4){logger['error'](_0x9d8f('0x14'),_0x4ed79d,_0x3aff4c['error'][_0x9d8f('0x15')]);return _0x279d98(_0x3aff4c['error'][_0x9d8f('0x15')]);}logger['error'](_0x9d8f('0x14'),_0x4ed79d,_0x3aff4c['error']['message']);return _0x366291(_0x3aff4c['error'][_0x9d8f('0x15')]);}else{logger[_0x9d8f('0xd')](_0x9d8f('0x14'),_0x4ed79d,_0x9d8f('0x10'));_0x366291(_0x3aff4c[_0x9d8f('0x16')][_0x9d8f('0x15')]);}})['catch'](function(_0x169952){logger['error'](_0x9d8f('0x14'),_0x4ed79d,_0x169952);_0x279d98(_0x169952);});});}exports[_0x9d8f('0x17')]=function(_0x13427b){var _0x5370e1=this;return new Promise(function(_0x591d9a,_0x373a23){return db[_0x9d8f('0x18')]['create'](_0x13427b[_0x9d8f('0x19')],{'raw':_0x13427b[_0x9d8f('0x1a')]?_0x13427b[_0x9d8f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9d8f('0xc')](function(_0x197283){logger[_0x9d8f('0xd')]('CreateReportAgentPreview',_0x13427b);logger['debug']('CreateReportAgentPreview',_0x13427b,JSON['stringify'](_0x197283));_0x591d9a(_0x197283);})[_0x9d8f('0x1b')](function(_0xbea633){logger['error'](_0x9d8f('0x17'),_0xbea633['message'],_0x13427b);_0x373a23(_0x5370e1[_0x9d8f('0x12')](0x1f4,_0xbea633['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 563b2d0..b90e9c0 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 _0xcf8c=['faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/sms/queues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xcf8c,0x15e));var _0xccf8=function(_0x239e86,_0xb1d22){_0x239e86=_0x239e86-0x0;var _0x47a428=_0xcf8c[_0x239e86];return _0x47a428;};'use strict';var multer=require(_0xccf8('0x0'));var util=require(_0xccf8('0x1'));var path=require(_0xccf8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xccf8('0x3'));var controller=require(_0xccf8('0x4'));router[_0xccf8('0x5')](_0xccf8('0x6'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x8')]);router[_0xccf8('0x5')](_0xccf8('0x9'),auth[_0xccf8('0x7')](),controller[_0xccf8('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xccf8('0x7')](),controller[_0xccf8('0xb')]);router['get']('/voice/queues',auth[_0xccf8('0x7')](),controller[_0xccf8('0xc')]);router[_0xccf8('0x5')](_0xccf8('0xd'),auth[_0xccf8('0x7')](),controller[_0xccf8('0xe')]);router[_0xccf8('0x5')](_0xccf8('0xf'),auth[_0xccf8('0x7')](),controller['mailQueues']);router[_0xccf8('0x5')](_0xccf8('0x10'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x11')]);router[_0xccf8('0x5')]('/openchannel/queues',auth[_0xccf8('0x7')](),controller['openchannelQueues']);router[_0xccf8('0x5')](_0xccf8('0x12'),auth[_0xccf8('0x7')](),controller['smsQueues']);router['get'](_0xccf8('0x13'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0xccf8('0x14')]);router[_0xccf8('0x5')](_0xccf8('0x15'),auth[_0xccf8('0x7')](),controller['voiceQueuesPreview']);router[_0xccf8('0x5')](_0xccf8('0x16'),auth[_0xccf8('0x7')](),controller['voiceQueuesChannels']);router[_0xccf8('0x5')](_0xccf8('0x17'),auth['isAuthenticated'](),controller[_0xccf8('0x18')]);router[_0xccf8('0x5')](_0xccf8('0x19'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x1a')]);router[_0xccf8('0x5')](_0xccf8('0x1b'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x1c')]);router[_0xccf8('0x5')]('/voice/queues/:id',auth[_0xccf8('0x7')](),controller[_0xccf8('0x1d')]);router[_0xccf8('0x5')](_0xccf8('0x1e'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x1f')]);router[_0xccf8('0x5')](_0xccf8('0x20'),auth['isAuthenticated'](),controller[_0xccf8('0x21')]);router[_0xccf8('0x5')](_0xccf8('0x22'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x23')]);router[_0xccf8('0x24')](_0xccf8('0x25'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x26')]);router[_0xccf8('0x5')](_0xccf8('0x27'),auth['isAuthenticated'](),controller[_0xccf8('0x28')]);router[_0xccf8('0x5')](_0xccf8('0x29'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x2a')]);router[_0xccf8('0x5')]('/campaigns',auth[_0xccf8('0x7')](),controller[_0xccf8('0x2b')]);router['get'](_0xccf8('0x2c'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x2d')]);router[_0xccf8('0x5')](_0xccf8('0x2e'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x2f')]);router[_0xccf8('0x5')]('/mail/queues/waitinginteractions',auth[_0xccf8('0x7')](),controller[_0xccf8('0x30')]);router[_0xccf8('0x5')](_0xccf8('0x31'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x32')]);router[_0xccf8('0x5')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xccf8('0x33')]);router[_0xccf8('0x5')](_0xccf8('0x34'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x35')]);router['get'](_0xccf8('0x36'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x37')]);router[_0xccf8('0x38')](_0xccf8('0x39'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x3b')));router[_0xccf8('0x5')](_0xccf8('0x3c'),auth[_0xccf8('0x7')](),controller['showMailQueues']);router[_0xccf8('0x38')](_0xccf8('0x3d'),auth[_0xccf8('0x7')](),controller['queueNotify'](_0xccf8('0x3e')));router[_0xccf8('0x5')]('/chat/queues/:id',auth[_0xccf8('0x7')](),controller[_0xccf8('0x3f')]);router[_0xccf8('0x38')](_0xccf8('0x40'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x41')));router[_0xccf8('0x5')](_0xccf8('0x42'),auth['isAuthenticated'](),controller[_0xccf8('0x43')]);router['post'](_0xccf8('0x44'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x45')));router['get'](_0xccf8('0x46'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x47')]);router[_0xccf8('0x38')](_0xccf8('0x48'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')](_0xccf8('0x49')));router[_0xccf8('0x38')](_0xccf8('0x4a'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x3a')]('whatsapp'));router[_0xccf8('0x5')](_0xccf8('0x4b'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xccf8('0x5')](_0xccf8('0x4c'),auth['isAuthenticated'](),controller[_0xccf8('0x4d')]);router[_0xccf8('0x38')](_0xccf8('0x4e'),auth[_0xccf8('0x7')](),controller[_0xccf8('0x4f')]);module[_0xccf8('0x50')]=router; \ No newline at end of file +var _0xd924=['/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','faxQueues','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/chat/queues/:id/notify','/chat/queues/:id','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','multer','util','path','Router','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues'];(function(_0x249a4d,_0x49c4f1){var _0x151da6=function(_0x507e19){while(--_0x507e19){_0x249a4d['push'](_0x249a4d['shift']());}};_0x151da6(++_0x49c4f1);}(_0xd924,0x74));var _0x4d92=function(_0x3674d4,_0x4ce93b){_0x3674d4=_0x3674d4-0x0;var _0x4b5cd4=_0xd924[_0x3674d4];return _0x4b5cd4;};'use strict';var multer=require(_0x4d92('0x0'));var util=require(_0x4d92('0x1'));var path=require(_0x4d92('0x2'));var express=require('express');var router=express[_0x4d92('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x4d92('0x4')]('/voice/channels',auth[_0x4d92('0x5')](),controller[_0x4d92('0x6')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x4d92('0x7')]);router[_0x4d92('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x4d92('0x5')](),controller[_0x4d92('0x8')]);router[_0x4d92('0x4')](_0x4d92('0x9'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x4d92('0x4')](_0x4d92('0xa'),auth[_0x4d92('0x5')](),controller[_0x4d92('0xb')]);router['get'](_0x4d92('0xc'),auth[_0x4d92('0x5')](),controller[_0x4d92('0xd')]);router[_0x4d92('0x4')](_0x4d92('0xe'),auth[_0x4d92('0x5')](),controller['mailAccounts']);router[_0x4d92('0x4')](_0x4d92('0xf'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x10')]);router[_0x4d92('0x4')]('/sms/queues',auth[_0x4d92('0x5')](),controller[_0x4d92('0x11')]);router[_0x4d92('0x4')]('/whatsapp/queues',auth[_0x4d92('0x5')](),controller[_0x4d92('0x12')]);router[_0x4d92('0x4')]('/fax/queues',auth[_0x4d92('0x5')](),controller[_0x4d92('0x13')]);router[_0x4d92('0x4')]('/voice/queues/preview/:id',auth[_0x4d92('0x5')](),controller['voiceQueuesPreview']);router[_0x4d92('0x4')](_0x4d92('0x14'),auth['isAuthenticated'](),controller[_0x4d92('0x15')]);router[_0x4d92('0x4')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x4d92('0x16')]);router[_0x4d92('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x4d92('0x5')](),controller['voiceQueuesChannelHangup']);router[_0x4d92('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x4d92('0x5')](),controller[_0x4d92('0x17')]);router[_0x4d92('0x4')](_0x4d92('0x18'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x19')]);router[_0x4d92('0x4')]('/outbound',auth['isAuthenticated'](),controller[_0x4d92('0x1a')]);router[_0x4d92('0x4')](_0x4d92('0x1b'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x1c')]);router[_0x4d92('0x4')](_0x4d92('0x1d'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x1e')]);router[_0x4d92('0x1f')](_0x4d92('0x20'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x21')]);router[_0x4d92('0x4')](_0x4d92('0x22'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x23')]);router[_0x4d92('0x4')](_0x4d92('0x24'),auth['isAuthenticated'](),controller[_0x4d92('0x25')]);router[_0x4d92('0x4')]('/campaigns',auth['isAuthenticated'](),controller[_0x4d92('0x26')]);router[_0x4d92('0x4')](_0x4d92('0x27'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x4d92('0x4')](_0x4d92('0x28'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x29')]);router['get']('/mail/queues/waitinginteractions',auth[_0x4d92('0x5')](),controller['mailQueuesWaitingInteractions']);router[_0x4d92('0x4')](_0x4d92('0x2a'),auth['isAuthenticated'](),controller[_0x4d92('0x2b')]);router['get']('/sms/queues/waitinginteractions',auth[_0x4d92('0x5')](),controller[_0x4d92('0x2c')]);router[_0x4d92('0x4')](_0x4d92('0x2d'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x4d92('0x4')]('/fax/queues/waitinginteractions',auth[_0x4d92('0x5')](),controller[_0x4d92('0x2e')]);router['post']('/mail/queues/:id/notify',auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x30')));router['get']('/mail/queues/:id',auth[_0x4d92('0x5')](),controller['showMailQueues']);router['post'](_0x4d92('0x31'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')]('chat'));router[_0x4d92('0x4')](_0x4d92('0x32'),auth[_0x4d92('0x5')](),controller['showChatQueues']);router[_0x4d92('0x33')](_0x4d92('0x34'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x35')));router[_0x4d92('0x4')](_0x4d92('0x36'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x37')]);router[_0x4d92('0x33')](_0x4d92('0x38'),auth['isAuthenticated'](),controller[_0x4d92('0x2f')](_0x4d92('0x39')));router['get']('/openchannel/queues/:id',auth[_0x4d92('0x5')](),controller['showOpenchannelQueues']);router[_0x4d92('0x33')](_0x4d92('0x3a'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x3b')));router['post'](_0x4d92('0x3c'),auth[_0x4d92('0x5')](),controller[_0x4d92('0x2f')](_0x4d92('0x3d')));router[_0x4d92('0x4')](_0x4d92('0x3e'),auth[_0x4d92('0x5')](),controller['showSmsQueues']);router[_0x4d92('0x4')](_0x4d92('0x3f'),auth[_0x4d92('0x5')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0336e44..8062077 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 _0x8a01=['merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','catch','VoiceChannelMixMonitor'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x8a01,0x13c));var _0x18a0=function(_0xac083e,_0x5e192f){_0xac083e=_0xac083e-0x0;var _0x1898a1=_0x8a01[_0xac083e];return _0x1898a1;};'use strict';var BPromise=require('bluebird');var moment=require(_0x18a0('0x0'));var _=require(_0x18a0('0x1'));var util=require(_0x18a0('0x2'));var db=require(_0x18a0('0x3'))['db'];var logger=require(_0x18a0('0x4'))(_0x18a0('0x5'));var jayson=require(_0x18a0('0x6'));var amiClient=jayson[_0x18a0('0x7')][_0x18a0('0x8')]({'port':0x232a});var mailClient=jayson[_0x18a0('0x7')][_0x18a0('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0x18a0('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x297f53,_0x11a8dc,_0x494331){return new BPromise(function(_0x14c039,_0x2c7596){var _0x42dcf6=_0x494331?_0x494331:amiClient;return _0x42dcf6[_0x18a0('0x9')](_0x297f53,_0x11a8dc)[_0x18a0('0xa')](function(_0x119ce0){if(_0x119ce0[_0x18a0('0xb')]){if(_0x119ce0['error']['code']===0x1f4){return _0x2c7596(_0x119ce0['error'][_0x18a0('0xc')]);}return _0x14c039(_0x119ce0['error']['message']);}else{_0x14c039(_0x119ce0[_0x18a0('0xd')]);}})['catch'](function(_0x1552cd){_0x2c7596(_0x1552cd);});});}function respondWithResult(_0x1ef43e,_0x594576){_0x594576=_0x594576||0xc8;return function(_0x4ec803){if(_0x4ec803){return _0x1ef43e[_0x18a0('0xe')](_0x594576)[_0x18a0('0xf')](_0x4ec803);}return _0x1ef43e[_0x18a0('0x10')](0x194);};}function handleError(_0x1d9690,_0x110407){_0x110407=_0x110407||0x1f4;return function(_0x29a397){logger[_0x18a0('0xb')](_0x29a397[_0x18a0('0x11')]);if(_0x29a397[_0x18a0('0x12')]){delete _0x29a397[_0x18a0('0x12')];}_0x1d9690[_0x18a0('0xe')](_0x110407)[_0x18a0('0x13')](_0x29a397);};}function findById(_0x2a6515){return function(_0x54b1dd){if(!_[_0x18a0('0x14')](_0x2a6515)&&!_[_0x18a0('0x14')](_0x54b1dd)&&!_[_0x18a0('0x14')](_0x54b1dd[_0x18a0('0x15')])){return _[_0x18a0('0x16')](_0x54b1dd['rows'],function(_0xc977a7){return _0xc977a7['id']==_0x2a6515;});}return null;};}exports[_0x18a0('0x17')]=function(_0x3dedb7,_0x34bbd0){return respondWithRpcPromise('VoiceChannels',_0x3dedb7['query'])['then'](respondWithResult(_0x34bbd0,null))[_0x18a0('0x18')](handleError(_0x34bbd0,null));};exports['voiceChannelMixMonitor']=function(_0x54ba8,_0x24a8cf){return respondWithRpcPromise(_0x18a0('0x19'),_[_0x18a0('0x1a')](_0x54ba8[_0x18a0('0x1b')],_0x54ba8['params']))['then'](respondWithResult(_0x24a8cf,null))[_0x18a0('0x18')](handleError(_0x24a8cf,null));};exports[_0x18a0('0x1c')]=function(_0x170db2,_0x119192){return respondWithRpcPromise(_0x18a0('0x1d'),_['merge'](_0x170db2[_0x18a0('0x1b')],_0x170db2[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x119192,null))['catch'](handleError(_0x119192,null));};exports[_0x18a0('0x1f')]=function(_0x1d0ff4,_0x1e3d85){return respondWithRpcPromise(_0x18a0('0x20'),_0x1d0ff4[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x1e3d85,null))[_0x18a0('0x18')](handleError(_0x1e3d85,null));};exports[_0x18a0('0x21')]=function(_0x46e642,_0x5205a1){return respondWithRpcPromise(_0x18a0('0x20'),_0x46e642[_0x18a0('0x1b')])['then'](findById(_0x46e642['params']['id']))[_0x18a0('0xa')](respondWithResult(_0x5205a1,null))['catch'](handleError(_0x5205a1,null));};exports[_0x18a0('0x22')]=function(_0x293b48,_0x4344a0){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x293b48['query'],_0x293b48[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x4344a0,null))[_0x18a0('0x18')](handleError(_0x4344a0,null));};exports[_0x18a0('0x23')]=function(_0x2d7242,_0x4ad1cc){return respondWithRpcPromise(_0x18a0('0x24'),_0x2d7242[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x4ad1cc,null))[_0x18a0('0x18')](handleError(_0x4ad1cc,null));};exports['voiceQueuesChannel']=function(_0x387c66,_0x19c412){return respondWithRpcPromise(_0x18a0('0x25'),_[_0x18a0('0x1a')](_0x387c66[_0x18a0('0x1b')],_0x387c66['params']))[_0x18a0('0xa')](respondWithResult(_0x19c412,null))['catch'](handleError(_0x19c412,null));};exports[_0x18a0('0x26')]=function(_0xea99e4,_0x4ac5f3){return respondWithRpcPromise(_0x18a0('0x27'),_['merge'](_0xea99e4[_0x18a0('0x1b')],_0xea99e4[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x4ac5f3,null))[_0x18a0('0x18')](handleError(_0x4ac5f3,null));};exports[_0x18a0('0x28')]=function(_0x2659eb,_0x19c493){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x18a0('0x1a')](_0x2659eb[_0x18a0('0x1b')],_0x2659eb[_0x18a0('0x1e')]))[_0x18a0('0xa')](respondWithResult(_0x19c493,null))[_0x18a0('0x18')](handleError(_0x19c493,null));};exports[_0x18a0('0x29')]=function(_0x357cb6,_0x592115){return respondWithRpcPromise(_0x18a0('0x2a'),_0x357cb6['query'])[_0x18a0('0xa')](respondWithResult(_0x592115,null))['catch'](handleError(_0x592115,null));};exports['outboundChannels']=function(_0x3a0c2d,_0x3c999f){return respondWithRpcPromise(_0x18a0('0x2b'),_0x3a0c2d['query'])[_0x18a0('0xa')](respondWithResult(_0x3c999f,null))[_0x18a0('0x18')](handleError(_0x3c999f,null));};exports[_0x18a0('0x2c')]=function(_0x25ad5c,_0x185d8d){var _0x2e59a8;return respondWithRpcPromise(_0x18a0('0x2d'),_0x25ad5c['query'])['then'](function(_0x55d7ab){_0x2e59a8=_0x55d7ab;return respondWithRpcPromise(_0x18a0('0x2d'),_0x25ad5c[_0x18a0('0x1b')],routingClient);})[_0x18a0('0xa')](function(_0xd4a5d6){return _[_0x18a0('0x1a')]({},_0xd4a5d6,_0x2e59a8);})['then'](respondWithResult(_0x185d8d,null))[_0x18a0('0x18')](handleError(_0x185d8d,null));};exports[_0x18a0('0x2e')]=function(_0x37321e,_0xd509a1){if(_0x37321e[_0x18a0('0x2f')]&&_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')]&&_0x37321e[_0x18a0('0x31')]&&_0x37321e['user'][_0x18a0('0x12')]){for(var _0x19ddb1 in _0x37321e['body']['interaction']){if(_0x37321e['body'][_0x18a0('0x30')][_0x18a0('0x32')](_0x19ddb1)){db[_0x18a0('0x33')][_0x18a0('0x34')]({'where':{'channel':_0x19ddb1,'membername':_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')],'type':_0x18a0('0x35'),'exitAt':null,'uniqueid':_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1]&&_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1][_0x18a0('0x36')]?{'$notIn':_0x37321e['body']['interaction'][_0x19ddb1]}:{'$ne':null}}})[_0x18a0('0xa')](function(_0x4dc12a){var _0x715a9=moment()[_0x18a0('0x37')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x13deb3=0x0,_0x358cff=_0x4dc12a[_0x18a0('0x36')];_0x13deb3<_0x358cff;_0x13deb3+=0x1){_0x4dc12a[_0x13deb3]['updateAttributes']({'exitAt':_0x715a9});}});for(var _0x18d989=0x0;_0x18d989<_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1][_0x18a0('0x36')];_0x18d989+=0x1){db[_0x18a0('0x33')][_0x18a0('0x38')]({'where':{'channel':_0x19ddb1,'membername':_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')],'type':_0x18a0('0x35'),'uniqueid':_0x37321e[_0x18a0('0x2f')]['interaction'][_0x19ddb1][_0x18d989],'exitAt':null},'defaults':{'channel':_0x19ddb1,'membername':_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')],'interface':_[_0x18a0('0x14')](_0x37321e[_0x18a0('0x31')][_0x18a0('0x39')])?util[_0x18a0('0x37')](_0x18a0('0x3a'),_0x37321e[_0x18a0('0x31')][_0x18a0('0x12')]):_0x37321e[_0x18a0('0x31')][_0x18a0('0x39')],'type':'INTERACTION','enterAt':moment()[_0x18a0('0x37')](_0x18a0('0x3b')),'role':_0x18a0('0x3c'),'internal':_0x37321e[_0x18a0('0x31')]['internal'],'uniqueid':_0x37321e[_0x18a0('0x2f')][_0x18a0('0x30')][_0x19ddb1][_0x18d989]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x37321e['params']['id'],'capacity':_0x37321e[_0x18a0('0x2f')]['capacity']},routingClient)['then'](respondWithResult(_0xd509a1,null))[_0x18a0('0x18')](handleError(_0xd509a1,null));};exports['telephones']=function(_0x1a770c,_0xc67137){return respondWithRpcPromise('Telephones',_0x1a770c['query'])[_0x18a0('0xa')](respondWithResult(_0xc67137,null))[_0x18a0('0x18')](handleError(_0xc67137,null));};exports[_0x18a0('0x3d')]=function(_0x54c07a,_0x150b9f){return respondWithRpcPromise('Trunks',_0x54c07a[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x150b9f,null))['catch'](handleError(_0x150b9f,null));};exports[_0x18a0('0x3e')]=function(_0x414b0d,_0x68492){return respondWithRpcPromise(_0x18a0('0x3f'),_0x414b0d['query'])[_0x18a0('0xa')](respondWithResult(_0x68492,null))['catch'](handleError(_0x68492,null));};exports[_0x18a0('0x40')]=function(_0x1fe0a0,_0x44ca6f){return respondWithRpcPromise(_0x18a0('0x41'),_0x1fe0a0[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x44ca6f,null))['catch'](handleError(_0x44ca6f,null));};exports[_0x18a0('0x42')]=function(_0x2415af,_0x16eb22){return respondWithRpcPromise(_0x18a0('0x41'),_0x2415af['query'],routingClient)[_0x18a0('0xa')](findById(_0x2415af[_0x18a0('0x1e')]['id']))[_0x18a0('0xa')](respondWithResult(_0x16eb22,null))[_0x18a0('0x18')](handleError(_0x16eb22,null));};exports[_0x18a0('0x43')]=function(_0x5cec4d,_0x455b61){return respondWithRpcPromise(_0x18a0('0x44'),_0x5cec4d['query'],routingClient)[_0x18a0('0xa')](respondWithResult(_0x455b61,null))['catch'](handleError(_0x455b61,null));};exports[_0x18a0('0x45')]=function(_0x35abe4,_0x2be91c){return respondWithRpcPromise(_0x18a0('0x44'),_0x35abe4[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x35abe4[_0x18a0('0x1e')]['id']))[_0x18a0('0xa')](respondWithResult(_0x2be91c,null))[_0x18a0('0x18')](handleError(_0x2be91c,null));};exports[_0x18a0('0x46')]=function(_0x39a68c,_0x496ed8){return respondWithRpcPromise(_0x18a0('0x47'),_0x39a68c[_0x18a0('0x1b')],mailClient)[_0x18a0('0xa')](respondWithResult(_0x496ed8,null))[_0x18a0('0x18')](handleError(_0x496ed8,null));};exports['openchannelQueues']=function(_0x5c0d6f,_0x348593){return respondWithRpcPromise(_0x18a0('0x48'),_0x5c0d6f[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x348593,null))[_0x18a0('0x18')](handleError(_0x348593,null));};exports['showOpenchannelQueues']=function(_0x1ba650,_0x5173c4){return respondWithRpcPromise('OpenchannelQueues',_0x1ba650[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x1ba650[_0x18a0('0x1e')]['id']))['then'](respondWithResult(_0x5173c4,null))[_0x18a0('0x18')](handleError(_0x5173c4,null));};exports[_0x18a0('0x49')]=function(_0x5a88ae,_0xcde27f){return respondWithRpcPromise('SmsQueues',_0x5a88ae[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0xcde27f,null))[_0x18a0('0x18')](handleError(_0xcde27f,null));};exports[_0x18a0('0x4a')]=function(_0x4d3361,_0xb328b6){return respondWithRpcPromise(_0x18a0('0x4b'),_0x4d3361[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x4d3361['params']['id']))[_0x18a0('0xa')](respondWithResult(_0xb328b6,null))[_0x18a0('0x18')](handleError(_0xb328b6,null));};exports[_0x18a0('0x4c')]=function(_0x3ae0a8,_0x184b0d){return respondWithRpcPromise(_0x18a0('0x4d'),_0x3ae0a8[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x184b0d,null))[_0x18a0('0x18')](handleError(_0x184b0d,null));};exports[_0x18a0('0x4e')]=function(_0x54dee2,_0x40d3c4){return respondWithRpcPromise(_0x18a0('0x4d'),_0x54dee2[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](findById(_0x54dee2['params']['id']))['then'](respondWithResult(_0x40d3c4,null))[_0x18a0('0x18')](handleError(_0x40d3c4,null));};exports['faxQueues']=function(_0x3ee46d,_0x4d41f2){return respondWithRpcPromise(_0x18a0('0x4f'),_0x3ee46d['query'],routingClient)['then'](respondWithResult(_0x4d41f2,null))['catch'](handleError(_0x4d41f2,null));};exports[_0x18a0('0x50')]=function(_0xf18659,_0x12609b){return respondWithRpcPromise(_0x18a0('0x4f'),_0xf18659[_0x18a0('0x1b')],routingClient)['then'](findById(_0xf18659['params']['id']))['then'](respondWithResult(_0x12609b,null))[_0x18a0('0x18')](handleError(_0x12609b,null));};exports[_0x18a0('0x51')]=function(_0x3aa6ad,_0x1288a2){return respondWithRpcPromise('FaxAccounts',_0x3aa6ad[_0x18a0('0x1b')])[_0x18a0('0xa')](respondWithResult(_0x1288a2,null))[_0x18a0('0x18')](handleError(_0x1288a2,null));};exports[_0x18a0('0x52')]=function(_0x42561c,_0x2846a7){return respondWithRpcPromise(_0x18a0('0x53'),_0x42561c['query'],routingClient)['then'](respondWithResult(_0x2846a7,null))[_0x18a0('0x18')](handleError(_0x2846a7,null));};exports[_0x18a0('0x54')]=function(_0x4aede5,_0x28a6fe){return respondWithRpcPromise(_0x18a0('0x55'),_0x4aede5[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x28a6fe,null))[_0x18a0('0x18')](handleError(_0x28a6fe,null));};exports[_0x18a0('0x56')]=function(_0x48737c,_0x19cf8d){return respondWithRpcPromise(_0x18a0('0x57'),_0x48737c[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x19cf8d,null))[_0x18a0('0x18')](handleError(_0x19cf8d,null));};exports[_0x18a0('0x58')]=function(_0x564b9c,_0x27e71c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x564b9c['query'],routingClient)[_0x18a0('0xa')](respondWithResult(_0x27e71c,null))['catch'](handleError(_0x27e71c,null));};exports[_0x18a0('0x59')]=function(_0x302d5e,_0x22f6b8){return respondWithRpcPromise(_0x18a0('0x5a'),_0x302d5e[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x22f6b8,null))[_0x18a0('0x18')](handleError(_0x22f6b8,null));};exports[_0x18a0('0x5b')]=function(_0x5d09d0,_0x4fbd80){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5d09d0[_0x18a0('0x1b')],routingClient)[_0x18a0('0xa')](respondWithResult(_0x4fbd80,null))['catch'](handleError(_0x4fbd80,null));};exports[_0x18a0('0x5c')]=function(_0x5c73c4){return function(_0x440072,_0x37eb01){var _0x4e0ee6,_0x2601d6;var _0x24a186=_[_0x18a0('0x5d')](_0x5c73c4);var _0x371d46=_0x5c73c4==='chat'?_0x18a0('0x5e'):_0x18a0('0x5f');return db[_0x24a186+'Queue']['findOne']({'raw':!![],'where':{'id':_0x440072['params']['id']}})[_0x18a0('0xa')](function(_0x2e9349){if(_[_0x18a0('0x14')](_0x2e9349)){throw new Error(_0x24a186+_0x18a0('0x60'));}_0x4e0ee6=_0x2e9349;return db[_0x24a186+_0x18a0('0x61')][_0x18a0('0x62')]({'where':{'id':_0x440072[_0x18a0('0x2f')][_0x18a0('0x63')]},'include':[{'model':db[_0x24a186+_0x18a0('0x64')],'as':_0x18a0('0x64')},{'model':db[_0x24a186+_0x371d46],'as':_0x18a0('0x5f')}]});})[_0x18a0('0xa')](function(_0x357ef5){if(_['isNil'](_0x357ef5)){throw new Error(_0x24a186+_0x18a0('0x65'));}_0x2601d6=_0x357ef5;return _0x357ef5[_0x18a0('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x18a0('0xa')](function(){var _0x1ea10c={'uniqueid':_0x5c73c4+'.'+_0x2601d6['id']+'.'+_0x2601d6[_0x18a0('0x64')]['id'],'FromUserId':_0x440072['user']['id'],'type':'queue'};_0x1ea10c[_0x24a186+_0x18a0('0x67')]=_0x2601d6['id'];_0x1ea10c[_0x24a186+_0x18a0('0x68')]=_0x2601d6['Interaction']['id'];_0x1ea10c[_0x18a0('0x69')+_0x24a186+_0x371d46+'Id']=_0x2601d6[_0x18a0('0x5f')]['id'];_0x1ea10c['To'+_0x24a186+_0x18a0('0x6a')]=_0x4e0ee6['id'];return db[_0x24a186+_0x18a0('0x6b')][_0x18a0('0x6c')](_0x1ea10c);})[_0x18a0('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x5c73c4,'interaction':_0x2601d6[_0x18a0('0x64')],'message':_0x2601d6,'account':_0x2601d6[_0x18a0('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x18a0('0x6d'),'appdata':_0x4e0ee6[_0x18a0('0x12')]+','+(_0x2601d6[_0x18a0('0x5f')][_0x18a0('0x6e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x37eb01,null))[_0x18a0('0x18')](handleError(_0x37eb01,null));};};exports['agentNotify']=function(_0x474b61,_0x537d2e){var _0x5e781c,_0x1b7810;if(_[_0x18a0('0x14')](_0x474b61['body']['channel'])){throw new Error(_0x18a0('0x6f'));}var _0x11e949=_0x474b61[_0x18a0('0x2f')]['channel'];var _0xa98c11=_[_0x18a0('0x5d')](_0x11e949);var _0x232249=_0x11e949==='chat'?'Website':'Account';return db[_0x18a0('0x70')][_0x18a0('0x62')]({'raw':!![],'where':{'id':_0x474b61[_0x18a0('0x1e')]['id'],'role':'agent'}})[_0x18a0('0xa')](function(_0x5322f6){if(_[_0x18a0('0x14')](_0x5322f6)){throw new Error(_0x18a0('0x71'));}_0x5e781c=_0x5322f6;return db[_0xa98c11+_0x18a0('0x61')][_0x18a0('0x62')]({'where':{'id':_0x474b61[_0x18a0('0x2f')]['messageId']},'include':[{'model':db[_0xa98c11+_0x18a0('0x64')],'as':'Interaction'},{'model':db[_0xa98c11+_0x232249],'as':_0x18a0('0x5f')}]});})['then'](function(_0x1fd43b){if(_[_0x18a0('0x14')](_0x1fd43b)){throw new Error(_0xa98c11+_0x18a0('0x65'));}_0x1b7810=_0x1fd43b;return _0x1fd43b[_0x18a0('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x18a0('0xa')](function(){var _0x1bcb4a={'uniqueid':_0x11e949+'.'+_0x1b7810['id']+'.'+_0x1b7810[_0x18a0('0x64')]['id'],'FromUserId':_0x474b61[_0x18a0('0x31')]['id'],'type':'queue','ToUserId':_0x5e781c['id']};_0x1bcb4a[_0xa98c11+_0x18a0('0x67')]=_0x1b7810['id'];_0x1bcb4a[_0xa98c11+'InteractionId']=_0x1b7810[_0x18a0('0x64')]['id'];_0x1bcb4a[_0x18a0('0x69')+_0xa98c11+_0x232249+'Id']=_0x1b7810[_0x18a0('0x5f')]['id'];return db[_0xa98c11+_0x18a0('0x6b')][_0x18a0('0x6c')](_0x1bcb4a);})[_0x18a0('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x11e949,'interaction':_0x1b7810[_0x18a0('0x64')],'message':_0x1b7810,'account':_0x1b7810[_0x18a0('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x18a0('0x3c'),'appdata':_0x5e781c[_0x18a0('0x12')]+','+(_0x1b7810[_0x18a0('0x5f')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x18a0('0xa')](respondWithResult(_0x537d2e,null))['catch'](handleError(_0x537d2e,null));}; \ No newline at end of file +var _0x42b2=['VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','query','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','TransferReport','create','bluebird','lodash','util','../../config/logger','api','client','http','request','then','error','code','message','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42b2,0x1b2));var _0x242b=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x42b2[_0x5c3c0b];return _0x52ecd2;};'use strict';var BPromise=require(_0x242b('0x0'));var moment=require('moment');var _=require(_0x242b('0x1'));var util=require(_0x242b('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x242b('0x3'))(_0x242b('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x242b('0x5')][_0x242b('0x6')]({'port':0x232a});var mailClient=jayson[_0x242b('0x5')][_0x242b('0x6')]({'port':0x232b});var routingClient=jayson[_0x242b('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x12fb40,_0x5ada21,_0x5aa0bf){return new BPromise(function(_0x267f26,_0x49c96a){var _0x3367ba=_0x5aa0bf?_0x5aa0bf:amiClient;return _0x3367ba[_0x242b('0x7')](_0x12fb40,_0x5ada21)[_0x242b('0x8')](function(_0x75c885){if(_0x75c885[_0x242b('0x9')]){if(_0x75c885[_0x242b('0x9')][_0x242b('0xa')]===0x1f4){return _0x49c96a(_0x75c885['error']['message']);}return _0x267f26(_0x75c885[_0x242b('0x9')][_0x242b('0xb')]);}else{_0x267f26(_0x75c885['result']);}})[_0x242b('0xc')](function(_0x529d7c){_0x49c96a(_0x529d7c);});});}function respondWithResult(_0x5d88a3,_0x50b756){_0x50b756=_0x50b756||0xc8;return function(_0x38c6c9){if(_0x38c6c9){return _0x5d88a3[_0x242b('0xd')](_0x50b756)[_0x242b('0xe')](_0x38c6c9);}return _0x5d88a3[_0x242b('0xf')](0x194);};}function handleError(_0x578cd9,_0x812c3a){_0x812c3a=_0x812c3a||0x1f4;return function(_0x3a1f28){logger[_0x242b('0x9')](_0x3a1f28['stack']);if(_0x3a1f28['name']){delete _0x3a1f28[_0x242b('0x10')];}_0x578cd9['status'](_0x812c3a)[_0x242b('0x11')](_0x3a1f28);};}function findById(_0x1158fa){return function(_0x560a92){if(!_[_0x242b('0x12')](_0x1158fa)&&!_['isNil'](_0x560a92)&&!_[_0x242b('0x12')](_0x560a92[_0x242b('0x13')])){return _[_0x242b('0x14')](_0x560a92[_0x242b('0x13')],function(_0x5d688a){return _0x5d688a['id']==_0x1158fa;});}return null;};}exports[_0x242b('0x15')]=function(_0x318c6f,_0x212015){return respondWithRpcPromise(_0x242b('0x16'),_0x318c6f['query'])[_0x242b('0x8')](respondWithResult(_0x212015,null))[_0x242b('0xc')](handleError(_0x212015,null));};exports[_0x242b('0x17')]=function(_0x255995,_0x37dbe9){return respondWithRpcPromise(_0x242b('0x18'),_['merge'](_0x255995['query'],_0x255995[_0x242b('0x19')]))['then'](respondWithResult(_0x37dbe9,null))[_0x242b('0xc')](handleError(_0x37dbe9,null));};exports['voiceChannelStopMixMonitor']=function(_0x446b64,_0x32c1af){return respondWithRpcPromise(_0x242b('0x1a'),_[_0x242b('0x1b')](_0x446b64[_0x242b('0x1c')],_0x446b64[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x32c1af,null))['catch'](handleError(_0x32c1af,null));};exports['voiceQueues']=function(_0x537f95,_0x45cfb8){return respondWithRpcPromise(_0x242b('0x1d'),_0x537f95['query'])[_0x242b('0x8')](respondWithResult(_0x45cfb8,null))[_0x242b('0xc')](handleError(_0x45cfb8,null));};exports[_0x242b('0x1e')]=function(_0xf1859f,_0xc905bf){return respondWithRpcPromise(_0x242b('0x1d'),_0xf1859f[_0x242b('0x1c')])['then'](findById(_0xf1859f['params']['id']))[_0x242b('0x8')](respondWithResult(_0xc905bf,null))[_0x242b('0xc')](handleError(_0xc905bf,null));};exports['voiceQueuesPreview']=function(_0x3529bb,_0x4a8b10){return respondWithRpcPromise(_0x242b('0x1f'),_[_0x242b('0x1b')](_0x3529bb['query'],_0x3529bb[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x4a8b10,null))[_0x242b('0xc')](handleError(_0x4a8b10,null));};exports[_0x242b('0x20')]=function(_0x123829,_0x475e21){return respondWithRpcPromise(_0x242b('0x21'),_0x123829['query'])[_0x242b('0x8')](respondWithResult(_0x475e21,null))[_0x242b('0xc')](handleError(_0x475e21,null));};exports[_0x242b('0x22')]=function(_0x5845f8,_0x3b5711){return respondWithRpcPromise(_0x242b('0x23'),_['merge'](_0x5845f8['query'],_0x5845f8[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x3b5711,null))['catch'](handleError(_0x3b5711,null));};exports['voiceQueuesChannelHangup']=function(_0x32b949,_0x37c8e2){return respondWithRpcPromise(_0x242b('0x24'),_[_0x242b('0x1b')](_0x32b949[_0x242b('0x1c')],_0x32b949[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x37c8e2,null))[_0x242b('0xc')](handleError(_0x37c8e2,null));};exports['voiceQueuesChannelRedirect']=function(_0x149810,_0x3a5b82){return respondWithRpcPromise(_0x242b('0x25'),_[_0x242b('0x1b')](_0x149810[_0x242b('0x1c')],_0x149810[_0x242b('0x19')]))[_0x242b('0x8')](respondWithResult(_0x3a5b82,null))['catch'](handleError(_0x3a5b82,null));};exports[_0x242b('0x26')]=function(_0x5eb3c1,_0x21c925){return respondWithRpcPromise('Outbound',_0x5eb3c1[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x21c925,null))[_0x242b('0xc')](handleError(_0x21c925,null));};exports[_0x242b('0x27')]=function(_0x55cae2,_0x1f6f3e){return respondWithRpcPromise(_0x242b('0x28'),_0x55cae2[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x1f6f3e,null))[_0x242b('0xc')](handleError(_0x1f6f3e,null));};exports[_0x242b('0x29')]=function(_0x3a7b2a,_0x464099){var _0x30abd1;return respondWithRpcPromise(_0x242b('0x2a'),_0x3a7b2a[_0x242b('0x1c')])['then'](function(_0x3babd4){_0x30abd1=_0x3babd4;return respondWithRpcPromise('Agents',_0x3a7b2a[_0x242b('0x1c')],routingClient);})[_0x242b('0x8')](function(_0x2eb340){return _[_0x242b('0x1b')]({},_0x2eb340,_0x30abd1);})[_0x242b('0x8')](respondWithResult(_0x464099,null))['catch'](handleError(_0x464099,null));};exports[_0x242b('0x2b')]=function(_0x23238c,_0x562a7d){if(_0x23238c[_0x242b('0x2c')]&&_0x23238c[_0x242b('0x2c')]['interaction']&&_0x23238c[_0x242b('0x2d')]&&_0x23238c[_0x242b('0x2d')][_0x242b('0x10')]){for(var _0xe7ef28 in _0x23238c['body']['interaction']){if(_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0x242b('0x2f')](_0xe7ef28)){db[_0x242b('0x30')][_0x242b('0x31')]({'where':{'channel':_0xe7ef28,'membername':_0x23238c[_0x242b('0x2d')]['name'],'type':_0x242b('0x32'),'exitAt':null,'uniqueid':_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28]&&_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28]['length']?{'$notIn':_0x23238c[_0x242b('0x2c')]['interaction'][_0xe7ef28]}:{'$ne':null}}})['then'](function(_0x20ed75){var _0x10f7b7=moment()[_0x242b('0x33')](_0x242b('0x34'));for(var _0x431c08=0x0,_0xa8b5fa=_0x20ed75[_0x242b('0x35')];_0x431c08<_0xa8b5fa;_0x431c08+=0x1){_0x20ed75[_0x431c08][_0x242b('0x36')]({'exitAt':_0x10f7b7});}});for(var _0xd0bb9b=0x0;_0xd0bb9b<_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28][_0x242b('0x35')];_0xd0bb9b+=0x1){db[_0x242b('0x30')][_0x242b('0x37')]({'where':{'channel':_0xe7ef28,'membername':_0x23238c[_0x242b('0x2d')][_0x242b('0x10')],'type':'INTERACTION','uniqueid':_0x23238c['body'][_0x242b('0x2e')][_0xe7ef28][_0xd0bb9b],'exitAt':null},'defaults':{'channel':_0xe7ef28,'membername':_0x23238c[_0x242b('0x2d')][_0x242b('0x10')],'interface':_['isNil'](_0x23238c[_0x242b('0x2d')]['interface'])?util[_0x242b('0x33')](_0x242b('0x38'),_0x23238c[_0x242b('0x2d')]['name']):_0x23238c['user'][_0x242b('0x39')],'type':_0x242b('0x32'),'enterAt':moment()['format'](_0x242b('0x34')),'role':_0x242b('0x3a'),'internal':_0x23238c['user']['internal'],'uniqueid':_0x23238c[_0x242b('0x2c')][_0x242b('0x2e')][_0xe7ef28][_0xd0bb9b]}});}}}}return respondWithRpcPromise(_0x242b('0x3b'),{'id':_0x23238c[_0x242b('0x19')]['id'],'capacity':_0x23238c[_0x242b('0x2c')][_0x242b('0x3c')]},routingClient)[_0x242b('0x8')](respondWithResult(_0x562a7d,null))[_0x242b('0xc')](handleError(_0x562a7d,null));};exports['telephones']=function(_0x4baa17,_0x947d39){return respondWithRpcPromise(_0x242b('0x3d'),_0x4baa17[_0x242b('0x1c')])['then'](respondWithResult(_0x947d39,null))[_0x242b('0xc')](handleError(_0x947d39,null));};exports[_0x242b('0x3e')]=function(_0x1dbe7e,_0x505018){return respondWithRpcPromise(_0x242b('0x3f'),_0x1dbe7e[_0x242b('0x1c')])['then'](respondWithResult(_0x505018,null))['catch'](handleError(_0x505018,null));};exports[_0x242b('0x40')]=function(_0x50f5bb,_0x4932a6){return respondWithRpcPromise(_0x242b('0x41'),_0x50f5bb[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x4932a6,null))[_0x242b('0xc')](handleError(_0x4932a6,null));};exports[_0x242b('0x42')]=function(_0x27d751,_0x1e7184){return respondWithRpcPromise('ChatQueues',_0x27d751[_0x242b('0x1c')],routingClient)['then'](respondWithResult(_0x1e7184,null))['catch'](handleError(_0x1e7184,null));};exports[_0x242b('0x43')]=function(_0x4fd419,_0x3b3d2f){return respondWithRpcPromise(_0x242b('0x44'),_0x4fd419[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x4fd419[_0x242b('0x19')]['id']))['then'](respondWithResult(_0x3b3d2f,null))[_0x242b('0xc')](handleError(_0x3b3d2f,null));};exports['mailQueues']=function(_0x164e0d,_0x3ce758){return respondWithRpcPromise(_0x242b('0x45'),_0x164e0d[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0x3ce758,null))[_0x242b('0xc')](handleError(_0x3ce758,null));};exports['showMailQueues']=function(_0x409d38,_0x5ef676){return respondWithRpcPromise('MailQueues',_0x409d38[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x409d38[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x5ef676,null))[_0x242b('0xc')](handleError(_0x5ef676,null));};exports[_0x242b('0x46')]=function(_0x389915,_0x4e305b){return respondWithRpcPromise(_0x242b('0x47'),_0x389915[_0x242b('0x1c')],mailClient)[_0x242b('0x8')](respondWithResult(_0x4e305b,null))[_0x242b('0xc')](handleError(_0x4e305b,null));};exports[_0x242b('0x48')]=function(_0x29f52c,_0x479ca5){return respondWithRpcPromise(_0x242b('0x49'),_0x29f52c[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0x479ca5,null))[_0x242b('0xc')](handleError(_0x479ca5,null));};exports['showOpenchannelQueues']=function(_0x58a7b2,_0x53c8e0){return respondWithRpcPromise(_0x242b('0x49'),_0x58a7b2[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x58a7b2[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x53c8e0,null))[_0x242b('0xc')](handleError(_0x53c8e0,null));};exports[_0x242b('0x4a')]=function(_0x361f4e,_0x15cded){return respondWithRpcPromise(_0x242b('0x4b'),_0x361f4e[_0x242b('0x1c')],routingClient)['then'](respondWithResult(_0x15cded,null))[_0x242b('0xc')](handleError(_0x15cded,null));};exports[_0x242b('0x4c')]=function(_0x3082fd,_0x2285ba){return respondWithRpcPromise(_0x242b('0x4b'),_0x3082fd[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x3082fd[_0x242b('0x19')]['id']))['then'](respondWithResult(_0x2285ba,null))[_0x242b('0xc')](handleError(_0x2285ba,null));};exports['whatsappQueues']=function(_0x204d0,_0x7baacb){return respondWithRpcPromise(_0x242b('0x4d'),_0x204d0['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x7baacb,null))['catch'](handleError(_0x7baacb,null));};exports[_0x242b('0x4e')]=function(_0x453919,_0x2512eb){return respondWithRpcPromise('WhatsappQueues',_0x453919[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](findById(_0x453919[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x2512eb,null))[_0x242b('0xc')](handleError(_0x2512eb,null));};exports[_0x242b('0x4f')]=function(_0x587c96,_0x5cb0c4){return respondWithRpcPromise('FaxQueues',_0x587c96['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x5cb0c4,null))[_0x242b('0xc')](handleError(_0x5cb0c4,null));};exports[_0x242b('0x50')]=function(_0x520142,_0x337bc2){return respondWithRpcPromise('FaxQueues',_0x520142['query'],routingClient)[_0x242b('0x8')](findById(_0x520142[_0x242b('0x19')]['id']))[_0x242b('0x8')](respondWithResult(_0x337bc2,null))[_0x242b('0xc')](handleError(_0x337bc2,null));};exports['faxAccounts']=function(_0x5d1d60,_0x3d40dd){return respondWithRpcPromise('FaxAccounts',_0x5d1d60[_0x242b('0x1c')])[_0x242b('0x8')](respondWithResult(_0x3d40dd,null))[_0x242b('0xc')](handleError(_0x3d40dd,null));};exports['chatQueuesWaitingInteractions']=function(_0x27b06e,_0x4f33fc){return respondWithRpcPromise(_0x242b('0x51'),_0x27b06e['query'],routingClient)['then'](respondWithResult(_0x4f33fc,null))[_0x242b('0xc')](handleError(_0x4f33fc,null));};exports[_0x242b('0x52')]=function(_0x458af7,_0x112203){return respondWithRpcPromise(_0x242b('0x53'),_0x458af7[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0x112203,null))['catch'](handleError(_0x112203,null));};exports[_0x242b('0x54')]=function(_0x482a1d,_0x3deebd){return respondWithRpcPromise(_0x242b('0x55'),_0x482a1d['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x3deebd,null))['catch'](handleError(_0x3deebd,null));};exports[_0x242b('0x56')]=function(_0x5caed2,_0xada2d1){return respondWithRpcPromise(_0x242b('0x57'),_0x5caed2[_0x242b('0x1c')],routingClient)[_0x242b('0x8')](respondWithResult(_0xada2d1,null))[_0x242b('0xc')](handleError(_0xada2d1,null));};exports[_0x242b('0x58')]=function(_0x48e311,_0x317f39){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x48e311['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x317f39,null))[_0x242b('0xc')](handleError(_0x317f39,null));};exports[_0x242b('0x59')]=function(_0x17735d,_0x86c41b){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x17735d['query'],routingClient)[_0x242b('0x8')](respondWithResult(_0x86c41b,null))[_0x242b('0xc')](handleError(_0x86c41b,null));};exports['queueNotify']=function(_0x550b88){return function(_0x59bb9e,_0x4605da){var _0xbdadce,_0x2d14d0;var _0x397ace=_[_0x242b('0x5a')](_0x550b88);var _0x3e2542=_0x550b88===_0x242b('0x5b')?_0x242b('0x5c'):_0x242b('0x5d');return db[_0x397ace+_0x242b('0x5e')]['findOne']({'raw':!![],'where':{'id':_0x59bb9e['params']['id']}})['then'](function(_0x331e0e){if(_[_0x242b('0x12')](_0x331e0e)){throw new Error(_0x397ace+_0x242b('0x5f'));}_0xbdadce=_0x331e0e;return db[_0x397ace+_0x242b('0x60')][_0x242b('0x61')]({'where':{'id':_0x59bb9e[_0x242b('0x2c')]['messageId']},'include':[{'model':db[_0x397ace+_0x242b('0x62')],'as':_0x242b('0x62')},{'model':db[_0x397ace+_0x3e2542],'as':_0x242b('0x5d')}]});})[_0x242b('0x8')](function(_0x57a000){if(_[_0x242b('0x12')](_0x57a000)){throw new Error(_0x397ace+'\x20Message\x20not\x20found');}_0x2d14d0=_0x57a000;return _0x57a000['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x242b('0x8')](function(){var _0xc6a336={'uniqueid':_0x550b88+'.'+_0x2d14d0['id']+'.'+_0x2d14d0[_0x242b('0x62')]['id'],'FromUserId':_0x59bb9e[_0x242b('0x2d')]['id'],'type':_0x242b('0x63')};_0xc6a336[_0x397ace+_0x242b('0x64')]=_0x2d14d0['id'];_0xc6a336[_0x397ace+_0x242b('0x65')]=_0x2d14d0[_0x242b('0x62')]['id'];_0xc6a336[_0x242b('0x66')+_0x397ace+_0x3e2542+'Id']=_0x2d14d0[_0x242b('0x5d')]['id'];_0xc6a336['To'+_0x397ace+_0x242b('0x67')]=_0xbdadce['id'];return db[_0x397ace+'TransferReport']['create'](_0xc6a336);})[_0x242b('0x8')](function(){return respondWithRpcPromise(_0x242b('0x68'),{'channel':_0x550b88,'interaction':_0x2d14d0['Interaction'],'message':_0x2d14d0,'account':_0x2d14d0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0xbdadce[_0x242b('0x10')]+','+(_0x2d14d0['Account'][_0x242b('0x69')]||0x12c),'interval':_0x242b('0x6a')}]},routingClient);})['then'](respondWithResult(_0x4605da,null))[_0x242b('0xc')](handleError(_0x4605da,null));};};exports['agentNotify']=function(_0x50dfea,_0x1558a4){var _0x1dd5f5,_0x3a1a10;if(_['isNil'](_0x50dfea['body'][_0x242b('0x6b')])){throw new Error(_0x242b('0x6c'));}var _0x4e6417=_0x50dfea[_0x242b('0x2c')][_0x242b('0x6b')];var _0x188ce5=_[_0x242b('0x5a')](_0x4e6417);var _0x20eb48=_0x4e6417===_0x242b('0x5b')?_0x242b('0x5c'):_0x242b('0x5d');return db[_0x242b('0x6d')][_0x242b('0x61')]({'raw':!![],'where':{'id':_0x50dfea[_0x242b('0x19')]['id'],'role':_0x242b('0x3a')}})[_0x242b('0x8')](function(_0x402386){if(_[_0x242b('0x12')](_0x402386)){throw new Error(_0x242b('0x6e'));}_0x1dd5f5=_0x402386;return db[_0x188ce5+_0x242b('0x60')][_0x242b('0x61')]({'where':{'id':_0x50dfea[_0x242b('0x2c')][_0x242b('0x6f')]},'include':[{'model':db[_0x188ce5+'Interaction'],'as':_0x242b('0x62')},{'model':db[_0x188ce5+_0x20eb48],'as':_0x242b('0x5d')}]});})['then'](function(_0x262c81){if(_['isNil'](_0x262c81)){throw new Error(_0x188ce5+'\x20Message\x20not\x20found');}_0x3a1a10=_0x262c81;return _0x262c81['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x242b('0x8')](function(){var _0x14c850={'uniqueid':_0x4e6417+'.'+_0x3a1a10['id']+'.'+_0x3a1a10[_0x242b('0x62')]['id'],'FromUserId':_0x50dfea[_0x242b('0x2d')]['id'],'type':_0x242b('0x63'),'ToUserId':_0x1dd5f5['id']};_0x14c850[_0x188ce5+'MessageId']=_0x3a1a10['id'];_0x14c850[_0x188ce5+_0x242b('0x65')]=_0x3a1a10[_0x242b('0x62')]['id'];_0x14c850[_0x242b('0x66')+_0x188ce5+_0x20eb48+'Id']=_0x3a1a10['Account']['id'];return db[_0x188ce5+_0x242b('0x70')][_0x242b('0x71')](_0x14c850);})[_0x242b('0x8')](function(){return respondWithRpcPromise(_0x242b('0x68'),{'channel':_0x4e6417,'interaction':_0x3a1a10['Interaction'],'message':_0x3a1a10,'account':_0x3a1a10[_0x242b('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1dd5f5[_0x242b('0x10')]+','+(_0x3a1a10[_0x242b('0x5d')]['agentTransferTimeout']||0x12c),'interval':_0x242b('0x6a')}]},routingClient);})[_0x242b('0x8')](respondWithResult(_0x1558a4,null))['catch'](handleError(_0x1558a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e29e460..f42c60e 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 _0xcc45=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49b78e,_0x2fa935){var _0x4f155d=function(_0x4b91ea){while(--_0x4b91ea){_0x49b78e['push'](_0x49b78e['shift']());}};_0x4f155d(++_0x2fa935);}(_0xcc45,0x177));var _0x5cc4=function(_0x44c741,_0xae9d9c){_0x44c741=_0x44c741-0x0;var _0x4b247f=_0xcc45[_0x44c741];return _0x4b247f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5cc4('0x0'));var express=require(_0x5cc4('0x1'));var router=express[_0x5cc4('0x2')]();var auth=require(_0x5cc4('0x3'));var interaction=require(_0x5cc4('0x4'));var config=require(_0x5cc4('0x5'));var controller=require(_0x5cc4('0x6'));router[_0x5cc4('0x7')]('/',auth[_0x5cc4('0x8')](),controller[_0x5cc4('0x9')]);router['get'](_0x5cc4('0xa'),auth[_0x5cc4('0x8')](),controller[_0x5cc4('0xb')]);router['get'](_0x5cc4('0xc'),auth[_0x5cc4('0x8')](),controller['run']);router[_0x5cc4('0xd')]('/',auth[_0x5cc4('0x8')](),controller['create']);router[_0x5cc4('0xe')](_0x5cc4('0xa'),auth['isAuthenticated'](),controller[_0x5cc4('0xf')]);router[_0x5cc4('0x10')](_0x5cc4('0xa'),auth[_0x5cc4('0x8')](),controller[_0x5cc4('0x11')]);module[_0x5cc4('0x12')]=router; \ No newline at end of file +var _0x8248=['index','show','run','create','/:id','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x30a92c,_0x2c3e60){var _0x10356f=function(_0xe3bfee){while(--_0xe3bfee){_0x30a92c['push'](_0x30a92c['shift']());}};_0x10356f(++_0x2c3e60);}(_0x8248,0x16d));var _0x8824=function(_0x3fab74,_0x5bbebe){_0x3fab74=_0x3fab74-0x0;var _0x4e0112=_0x8248[_0x3fab74];return _0x4e0112;};'use strict';var multer=require(_0x8824('0x0'));var util=require('util');var path=require(_0x8824('0x1'));var timeout=require(_0x8824('0x2'));var express=require('express');var router=express[_0x8824('0x3')]();var auth=require(_0x8824('0x4'));var interaction=require(_0x8824('0x5'));var config=require(_0x8824('0x6'));var controller=require('./schedule.controller');router[_0x8824('0x7')]('/',auth[_0x8824('0x8')](),controller[_0x8824('0x9')]);router[_0x8824('0x7')]('/:id',auth[_0x8824('0x8')](),controller[_0x8824('0xa')]);router[_0x8824('0x7')]('/:id/run',auth[_0x8824('0x8')](),controller[_0x8824('0xb')]);router['post']('/',auth[_0x8824('0x8')](),controller[_0x8824('0xc')]);router['put'](_0x8824('0xd'),auth['isAuthenticated'](),controller[_0x8824('0xe')]);router['delete'](_0x8824('0xd'),auth[_0x8824('0x8')](),controller[_0x8824('0xf')]);module[_0x8824('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0acd321..7363b3b 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 _0xb2ad=['months','hours','minutes','days','csv','pdf','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2ad,0x16d));var _0xdb2a=function(_0xb85b75,_0x339655){_0xb85b75=_0xb85b75-0x0;var _0x49ea49=_0xb2ad[_0xb85b75];return _0x49ea49;};'use strict';var Sequelize=require('sequelize');module[_0xdb2a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdb2a('0x1')]},'active':{'type':Sequelize[_0xdb2a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdb2a('0x1')],'allowNull':![],'defaultValue':_0xdb2a('0x3')},'startAt':{'type':Sequelize[_0xdb2a('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdb2a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdb2a('0x6')](_0xdb2a('0x7'),_0xdb2a('0x8'),_0xdb2a('0x9'),'weeks','days',_0xdb2a('0xa'),_0xdb2a('0xb')),'allowNull':![],'defaultValue':_0xdb2a('0xc')},'output':{'type':Sequelize['ENUM'](_0xdb2a('0xd'),_0xdb2a('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0xdb2a('0xd')},'type':{'type':Sequelize[_0xdb2a('0x6')]('custom','default'),'allowNull':![],'defaultValue':_0xdb2a('0xf')},'sendMail':{'type':Sequelize[_0xdb2a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb2a('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xdb2a('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xdb2a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfb67=['pdf','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','days','hours'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xfb67,0xdd));var _0x7fb6=function(_0x544723,_0x32fa49){_0x544723=_0x544723-0x0;var _0x3373e5=_0xfb67[_0x544723];return _0x3373e5;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'active':{'type':Sequelize[_0x7fb6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![],'defaultValue':_0x7fb6('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x7fb6('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7fb6('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7fb6('0x7')](_0x7fb6('0x8'),_0x7fb6('0x9'),'months',_0x7fb6('0xa'),_0x7fb6('0xb'),_0x7fb6('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x7fb6('0xb')},'output':{'type':Sequelize[_0x7fb6('0x7')]('csv',_0x7fb6('0xd'),_0x7fb6('0xe')),'allowNull':![],'defaultValue':_0x7fb6('0xf')},'type':{'type':Sequelize['ENUM'](_0x7fb6('0x10'),'default'),'allowNull':![],'defaultValue':_0x7fb6('0x10')},'sendMail':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7fb6('0x2')]},'cc':{'type':Sequelize[_0x7fb6('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8e80c0a..3bf1f79 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 _0x5229=['count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Scheduler','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','../../config/schedule','run','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json'];(function(_0x52c0a2,_0x57edc9){var _0x3824bd=function(_0x17f8c4){while(--_0x17f8c4){_0x52c0a2['push'](_0x52c0a2['shift']());}};_0x3824bd(++_0x57edc9);}(_0x5229,0x1de));var _0x9522=function(_0x2cfc7d,_0x5a7577){_0x2cfc7d=_0x2cfc7d-0x0;var _0x2dced9=_0x5229[_0x2cfc7d];return _0x2dced9;};'use strict';var pdf=require(_0x9522('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9522('0x1'));var zipdir=require(_0x9522('0x2'));var jsonpatch=require(_0x9522('0x3'));var rp=require(_0x9522('0x4'));var moment=require(_0x9522('0x5'));var BPromise=require(_0x9522('0x6'));var Mustache=require('mustache');var util=require(_0x9522('0x7'));var path=require('path');var sox=require(_0x9522('0x8'));var csv=require(_0x9522('0x9'));var ejs=require(_0x9522('0xa'));var fs=require('fs');var _=require(_0x9522('0xb'));var squel=require(_0x9522('0xc'));var crypto=require('crypto');var jsforce=require(_0x9522('0xd'));var deskjs=require(_0x9522('0xe'));var toCsv=require(_0x9522('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9522('0xf'));var authService=require(_0x9522('0x10'));var qs=require(_0x9522('0x11'));var as=require(_0x9522('0x12'));var hardwareService=require(_0x9522('0x13'));var logger=require(_0x9522('0x14'))(_0x9522('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c17f,_0x157559){_0x157559=_0x157559||0xcc;return function(_0x23d199){if(_0x23d199){return _0x57c17f[_0x9522('0x16')](_0x157559);}return _0x57c17f[_0x9522('0x17')](_0x157559)[_0x9522('0x18')]();};}function respondWithResult(_0x2f9fa4,_0x570428){_0x570428=_0x570428||0xc8;return function(_0x58ded0){if(_0x58ded0){return _0x2f9fa4[_0x9522('0x17')](_0x570428)[_0x9522('0x19')](_0x58ded0);}};}function respondWithFilteredResult(_0x44086a,_0x59b0cb){return function(_0x5e6647){if(_0x5e6647){var _0x46b5f1=_0x5e6647[_0x9522('0x1a')],_0x4accdd=_0x59b0cb[_0x9522('0x1b')],_0x273007=_0x59b0cb[_0x9522('0x1b')]+_0x59b0cb[_0x9522('0x1c')],_0x4f1e28;if(_0x273007>=_0x46b5f1){_0x273007=_0x46b5f1;_0x4f1e28=0xc8;}else{_0x4f1e28=0xce;}_0x44086a[_0x9522('0x17')](_0x4f1e28);return _0x44086a[_0x9522('0x1d')](_0x9522('0x1e'),_0x4accdd+'-'+_0x273007+'/'+_0x46b5f1)[_0x9522('0x19')](_0x5e6647);}return null;};}function patchUpdates(_0x2107f5){return function(_0xdc931d){try{jsonpatch[_0x9522('0x1f')](_0xdc931d,_0x2107f5,!![]);}catch(_0x416794){return BPromise[_0x9522('0x20')](_0x416794);}return _0xdc931d[_0x9522('0x21')]();};}function saveUpdates(_0x6b77b8,_0x528ead){return function(_0x122458){if(_0x122458){return _0x122458['update'](_0x6b77b8)[_0x9522('0x22')](function(_0x115ce4){return _0x115ce4;});}return null;};}function removeEntity(_0x5c2744,_0x505453){return function(_0x4d6133){if(_0x4d6133){return _0x4d6133[_0x9522('0x23')]()[_0x9522('0x22')](function(){var _0x19bc2f=_0x4d6133['get']({'plain':!![]});var _0x29a2d7=_0x9522('0x24');return db[_0x9522('0x25')][_0x9522('0x23')]({'where':{'type':_0x29a2d7,'resourceId':_0x19bc2f['id']}})[_0x9522('0x22')](function(){return _0x4d6133;});})['then'](function(){_0x5c2744[_0x9522('0x17')](0xcc)[_0x9522('0x18')]();});}};}function handleEntityNotFound(_0x241f17,_0x426cd0){return function(_0x44b034){if(!_0x44b034){_0x241f17['sendStatus'](0x194);}return _0x44b034;};}function handleError(_0x2d9c7b,_0x24a29e){_0x24a29e=_0x24a29e||0x1f4;return function(_0x390d66){logger['error'](_0x390d66[_0x9522('0x26')]);if(_0x390d66[_0x9522('0x27')]){delete _0x390d66[_0x9522('0x27')];}_0x2d9c7b[_0x9522('0x17')](_0x24a29e)[_0x9522('0x28')](_0x390d66);};}exports[_0x9522('0x29')]=function(_0x16b1d5,_0x23c281){var _0x3277de={},_0x34e366={},_0x59e49d={'count':0x0,'rows':[]};var _0x2b72ab=_['map'](db['Schedule'][_0x9522('0x2a')],function(_0x646a9f){return{'name':_0x646a9f[_0x9522('0x2b')],'type':_0x646a9f[_0x9522('0x2c')][_0x9522('0x2d')]};});_0x34e366[_0x9522('0x2e')]=_['map'](_0x2b72ab,_0x9522('0x27'));_0x34e366['query']=_[_0x9522('0x2f')](_0x16b1d5[_0x9522('0x30')]);_0x34e366[_0x9522('0x31')]=_[_0x9522('0x32')](_0x34e366[_0x9522('0x2e')],_0x34e366[_0x9522('0x30')]);_0x3277de[_0x9522('0x33')]=_['intersection'](_0x34e366[_0x9522('0x2e')],qs[_0x9522('0x34')](_0x16b1d5[_0x9522('0x30')]['fields']));_0x3277de[_0x9522('0x33')]=_0x3277de[_0x9522('0x33')]['length']?_0x3277de[_0x9522('0x33')]:_0x34e366[_0x9522('0x2e')];if(!_0x16b1d5['query'][_0x9522('0x35')](_0x9522('0x36'))){_0x3277de['limit']=qs[_0x9522('0x1c')](_0x16b1d5[_0x9522('0x30')][_0x9522('0x1c')]);_0x3277de[_0x9522('0x1b')]=qs[_0x9522('0x1b')](_0x16b1d5['query'][_0x9522('0x1b')]);}_0x3277de[_0x9522('0x37')]=qs[_0x9522('0x38')](_0x16b1d5[_0x9522('0x30')][_0x9522('0x38')]);_0x3277de[_0x9522('0x39')]=qs['filters'](_[_0x9522('0x3a')](_0x16b1d5['query'],_0x34e366['filters']),_0x2b72ab);if(_0x16b1d5[_0x9522('0x30')][_0x9522('0x3b')]){_0x3277de['where']=_['merge'](_0x3277de[_0x9522('0x39')],{'$or':_[_0x9522('0x3c')](_0x2b72ab,function(_0x585946){if(_0x585946[_0x9522('0x2c')]!==_0x9522('0x3d')){var _0x4a640e={};_0x4a640e[_0x585946[_0x9522('0x27')]]={'$like':'%'+_0x16b1d5[_0x9522('0x30')]['filter']+'%'};return _0x4a640e;}})});}_0x3277de=_[_0x9522('0x3e')]({},_0x3277de,_0x16b1d5[_0x9522('0x3f')]);var _0x7c55a1={'where':_0x3277de[_0x9522('0x39')]};return db[_0x9522('0x40')][_0x9522('0x1a')](_0x7c55a1)['then'](function(_0x10f628){_0x59e49d[_0x9522('0x1a')]=_0x10f628;if(_0x16b1d5['query'][_0x9522('0x41')]){_0x3277de[_0x9522('0x42')]=[{'all':!![]}];}return db['Schedule'][_0x9522('0x43')](_0x3277de);})[_0x9522('0x22')](function(_0x2fd2ae){_0x59e49d[_0x9522('0x44')]=_0x2fd2ae;return _0x59e49d;})[_0x9522('0x22')](respondWithFilteredResult(_0x23c281,_0x3277de))[_0x9522('0x45')](handleError(_0x23c281,null));};exports['show']=function(_0x44ca08,_0x2ea574){var _0xe685ea={'raw':![],'where':{'id':_0x44ca08[_0x9522('0x46')]['id']}},_0x13f4e8={};_0x13f4e8['model']=_[_0x9522('0x2f')](db['Schedule'][_0x9522('0x2a')]);_0x13f4e8[_0x9522('0x30')]=_[_0x9522('0x2f')](_0x44ca08[_0x9522('0x30')]);_0x13f4e8[_0x9522('0x31')]=_[_0x9522('0x32')](_0x13f4e8[_0x9522('0x2e')],_0x13f4e8['query']);_0xe685ea[_0x9522('0x33')]=_['intersection'](_0x13f4e8['model'],qs[_0x9522('0x34')](_0x44ca08[_0x9522('0x30')][_0x9522('0x34')]));_0xe685ea[_0x9522('0x33')]=_0xe685ea[_0x9522('0x33')]['length']?_0xe685ea[_0x9522('0x33')]:_0x13f4e8[_0x9522('0x2e')];if(_0x44ca08['query'][_0x9522('0x41')]){_0xe685ea[_0x9522('0x42')]=[{'all':!![]}];}_0xe685ea=_[_0x9522('0x3e')]({},_0xe685ea,_0x44ca08['options']);return db[_0x9522('0x40')][_0x9522('0x47')](_0xe685ea)[_0x9522('0x22')](handleEntityNotFound(_0x2ea574,null))[_0x9522('0x22')](respondWithResult(_0x2ea574,null))['catch'](handleError(_0x2ea574,null));};exports[_0x9522('0x48')]=function(_0x34b649,_0x31a658){return db[_0x9522('0x40')]['create'](_0x34b649['body'],{})[_0x9522('0x22')](function(_0xea086c){var _0x30fe6b=_0x34b649[_0x9522('0x49')][_0x9522('0x4a')]({'plain':!![]});if(!_0x30fe6b)throw new Error(_0x9522('0x4b'));if(_0x30fe6b[_0x9522('0x4c')]==='user'){var _0x2b2048=_0xea086c['get']({'plain':!![]});var _0x4c293d=_0x9522('0x24');return db[_0x9522('0x4d')][_0x9522('0x47')]({'where':{'name':_0x4c293d,'userProfileId':_0x30fe6b['userProfileId']},'raw':!![]})['then'](function(_0x1dde3b){if(_0x1dde3b&&_0x1dde3b['autoAssociation']===0x0){return db[_0x9522('0x25')][_0x9522('0x48')]({'name':_0x2b2048[_0x9522('0x27')],'resourceId':_0x2b2048['id'],'type':_0x1dde3b[_0x9522('0x27')],'sectionId':_0x1dde3b['id']},{})[_0x9522('0x22')](function(){return _0xea086c;});}else{return _0xea086c;}})[_0x9522('0x45')](function(_0x3c8273){logger[_0x9522('0x4e')](_0x9522('0x4f'),_0x3c8273);throw _0x3c8273;});}return _0xea086c;})[_0x9522('0x22')](respondWithResult(_0x31a658,0xc9))['catch'](handleError(_0x31a658,null));};exports[_0x9522('0x50')]=function(_0xde1f7,_0x1d7128){if(_0xde1f7[_0x9522('0x51')]['id']){delete _0xde1f7[_0x9522('0x51')]['id'];}return db['Schedule']['find']({'where':{'id':_0xde1f7[_0x9522('0x46')]['id']}})[_0x9522('0x22')](handleEntityNotFound(_0x1d7128,null))[_0x9522('0x22')](saveUpdates(_0xde1f7[_0x9522('0x51')],null))[_0x9522('0x22')](respondWithResult(_0x1d7128,null))[_0x9522('0x45')](handleError(_0x1d7128,null));};exports[_0x9522('0x23')]=function(_0x1b56bc,_0x2f41be){return db['Schedule'][_0x9522('0x47')]({'where':{'id':_0x1b56bc[_0x9522('0x46')]['id']}})[_0x9522('0x22')](handleEntityNotFound(_0x2f41be,null))[_0x9522('0x22')](removeEntity(_0x2f41be,null))[_0x9522('0x45')](handleError(_0x2f41be,null));};exports['run']=function(_0x5b7ff4,_0x3af32a,_0xe8943){var _0x1d35c3=require(_0x9522('0x52'));return db[_0x9522('0x40')][_0x9522('0x47')]({'where':{'id':_0x5b7ff4[_0x9522('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3af32a,null))['then'](function(){_0x1d35c3[_0x9522('0x53')](_0x5b7ff4[_0x9522('0x46')]['id']);})[_0x9522('0x22')](respondWithStatusCode(_0x3af32a,null))['catch'](handleError(_0x3af32a,null));}; \ No newline at end of file +var _0xba22=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','get','Scheduler','UserProfileResource','destroy','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x34b9c5,_0x42700f){var _0x10b193=function(_0x14df10){while(--_0x14df10){_0x34b9c5['push'](_0x34b9c5['shift']());}};_0x10b193(++_0x42700f);}(_0xba22,0x150));var _0x2ba2=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xba22[_0x16d10f];return _0x50c823;};'use strict';var pdf=require(_0x2ba2('0x0'));var emlformat=require(_0x2ba2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2ba2('0x2'));var jsonpatch=require(_0x2ba2('0x3'));var rp=require(_0x2ba2('0x4'));var moment=require('moment');var BPromise=require(_0x2ba2('0x5'));var Mustache=require(_0x2ba2('0x6'));var util=require(_0x2ba2('0x7'));var path=require(_0x2ba2('0x8'));var sox=require(_0x2ba2('0x9'));var csv=require(_0x2ba2('0xa'));var ejs=require(_0x2ba2('0xb'));var fs=require('fs');var _=require(_0x2ba2('0xc'));var squel=require('squel');var crypto=require(_0x2ba2('0xd'));var jsforce=require(_0x2ba2('0xe'));var deskjs=require(_0x2ba2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ba2('0x10'));var Papa=require(_0x2ba2('0x11'));var Redis=require(_0x2ba2('0x12'));var authService=require(_0x2ba2('0x13'));var qs=require(_0x2ba2('0x14'));var as=require(_0x2ba2('0x15'));var hardwareService=require(_0x2ba2('0x16'));var logger=require(_0x2ba2('0x17'))(_0x2ba2('0x18'));var utils=require(_0x2ba2('0x19'));var config=require(_0x2ba2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf239bf,_0x467973){_0x467973=_0x467973||0xcc;return function(_0x458f81){if(_0x458f81){return _0xf239bf[_0x2ba2('0x1b')](_0x467973);}return _0xf239bf['status'](_0x467973)[_0x2ba2('0x1c')]();};}function respondWithResult(_0x5a748c,_0x6aa7f7){_0x6aa7f7=_0x6aa7f7||0xc8;return function(_0x56fc80){if(_0x56fc80){return _0x5a748c[_0x2ba2('0x1d')](_0x6aa7f7)[_0x2ba2('0x1e')](_0x56fc80);}};}function respondWithFilteredResult(_0xb20e38,_0x3531dd){return function(_0x568e84){if(_0x568e84){var _0x47888d=_0x568e84[_0x2ba2('0x1f')],_0x1ae8ad=_0x3531dd['offset'],_0x180117=_0x3531dd[_0x2ba2('0x20')]+_0x3531dd[_0x2ba2('0x21')],_0x2406b9;if(_0x180117>=_0x47888d){_0x180117=_0x47888d;_0x2406b9=0xc8;}else{_0x2406b9=0xce;}_0xb20e38['status'](_0x2406b9);return _0xb20e38[_0x2ba2('0x22')]('Content-Range',_0x1ae8ad+'-'+_0x180117+'/'+_0x47888d)[_0x2ba2('0x1e')](_0x568e84);}return null;};}function patchUpdates(_0x543264){return function(_0x460c72){try{jsonpatch[_0x2ba2('0x23')](_0x460c72,_0x543264,!![]);}catch(_0x3a22a9){return BPromise[_0x2ba2('0x24')](_0x3a22a9);}return _0x460c72[_0x2ba2('0x25')]();};}function saveUpdates(_0x1fbb36,_0x1b91d4){return function(_0xd728ad){if(_0xd728ad){return _0xd728ad['update'](_0x1fbb36)[_0x2ba2('0x26')](function(_0x517e84){return _0x517e84;});}return null;};}function removeEntity(_0x346c9e,_0x306403){return function(_0x5e15a4){if(_0x5e15a4){return _0x5e15a4['destroy']()[_0x2ba2('0x26')](function(){var _0x4154d2=_0x5e15a4[_0x2ba2('0x27')]({'plain':!![]});var _0x31bc13=_0x2ba2('0x28');return db[_0x2ba2('0x29')][_0x2ba2('0x2a')]({'where':{'type':_0x31bc13,'resourceId':_0x4154d2['id']}})[_0x2ba2('0x26')](function(){return _0x5e15a4;});})['then'](function(){_0x346c9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x414e07,_0x407ec2){return function(_0x1967d5){if(!_0x1967d5){_0x414e07[_0x2ba2('0x1b')](0x194);}return _0x1967d5;};}function handleError(_0x5629bf,_0x1067b9){_0x1067b9=_0x1067b9||0x1f4;return function(_0x5aead4){logger[_0x2ba2('0x2b')](_0x5aead4['stack']);if(_0x5aead4[_0x2ba2('0x2c')]){delete _0x5aead4[_0x2ba2('0x2c')];}_0x5629bf[_0x2ba2('0x1d')](_0x1067b9)[_0x2ba2('0x2d')](_0x5aead4);};}exports[_0x2ba2('0x2e')]=function(_0x569cfd,_0x382f1d){var _0x1a71bc={},_0x5df92d={},_0x2fc320={'count':0x0,'rows':[]};var _0x1dfea1=_[_0x2ba2('0x2f')](db[_0x2ba2('0x30')][_0x2ba2('0x31')],function(_0x378638){return{'name':_0x378638[_0x2ba2('0x32')],'type':_0x378638[_0x2ba2('0x33')][_0x2ba2('0x34')]};});_0x5df92d['model']=_[_0x2ba2('0x2f')](_0x1dfea1,_0x2ba2('0x2c'));_0x5df92d[_0x2ba2('0x35')]=_[_0x2ba2('0x36')](_0x569cfd[_0x2ba2('0x35')]);_0x5df92d[_0x2ba2('0x37')]=_[_0x2ba2('0x38')](_0x5df92d[_0x2ba2('0x39')],_0x5df92d['query']);_0x1a71bc[_0x2ba2('0x3a')]=_[_0x2ba2('0x38')](_0x5df92d[_0x2ba2('0x39')],qs[_0x2ba2('0x3b')](_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x3b')]));_0x1a71bc[_0x2ba2('0x3a')]=_0x1a71bc['attributes'][_0x2ba2('0x3c')]?_0x1a71bc[_0x2ba2('0x3a')]:_0x5df92d[_0x2ba2('0x39')];if(!_0x569cfd['query']['hasOwnProperty'](_0x2ba2('0x3d'))){_0x1a71bc[_0x2ba2('0x21')]=qs[_0x2ba2('0x21')](_0x569cfd[_0x2ba2('0x35')]['limit']);_0x1a71bc[_0x2ba2('0x20')]=qs['offset'](_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x20')]);}_0x1a71bc['order']=qs[_0x2ba2('0x3e')](_0x569cfd['query'][_0x2ba2('0x3e')]);_0x1a71bc[_0x2ba2('0x3f')]=qs[_0x2ba2('0x37')](_[_0x2ba2('0x40')](_0x569cfd[_0x2ba2('0x35')],_0x5df92d['filters']),_0x1dfea1);if(_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x41')]){_0x1a71bc[_0x2ba2('0x3f')]=_['merge'](_0x1a71bc[_0x2ba2('0x3f')],{'$or':_[_0x2ba2('0x2f')](_0x1dfea1,function(_0x964cfe){if(_0x964cfe[_0x2ba2('0x33')]!=='VIRTUAL'){var _0x94a030={};_0x94a030[_0x964cfe[_0x2ba2('0x2c')]]={'$like':'%'+_0x569cfd[_0x2ba2('0x35')]['filter']+'%'};return _0x94a030;}})});}_0x1a71bc=_[_0x2ba2('0x42')]({},_0x1a71bc,_0x569cfd[_0x2ba2('0x43')]);var _0x134175={'where':_0x1a71bc[_0x2ba2('0x3f')]};return db[_0x2ba2('0x30')][_0x2ba2('0x1f')](_0x134175)[_0x2ba2('0x26')](function(_0x29a177){_0x2fc320[_0x2ba2('0x1f')]=_0x29a177;if(_0x569cfd[_0x2ba2('0x35')][_0x2ba2('0x44')]){_0x1a71bc['include']=[{'all':!![]}];}return db[_0x2ba2('0x30')][_0x2ba2('0x45')](_0x1a71bc);})[_0x2ba2('0x26')](function(_0x2bb925){_0x2fc320[_0x2ba2('0x46')]=_0x2bb925;return _0x2fc320;})[_0x2ba2('0x26')](respondWithFilteredResult(_0x382f1d,_0x1a71bc))['catch'](handleError(_0x382f1d,null));};exports[_0x2ba2('0x47')]=function(_0x393c3d,_0x58d89a){var _0x28c5b5={'raw':![],'where':{'id':_0x393c3d[_0x2ba2('0x48')]['id']}},_0x5b7def={};_0x5b7def[_0x2ba2('0x39')]=_['keys'](db[_0x2ba2('0x30')][_0x2ba2('0x31')]);_0x5b7def[_0x2ba2('0x35')]=_['keys'](_0x393c3d[_0x2ba2('0x35')]);_0x5b7def['filters']=_['intersection'](_0x5b7def[_0x2ba2('0x39')],_0x5b7def[_0x2ba2('0x35')]);_0x28c5b5[_0x2ba2('0x3a')]=_[_0x2ba2('0x38')](_0x5b7def[_0x2ba2('0x39')],qs[_0x2ba2('0x3b')](_0x393c3d[_0x2ba2('0x35')][_0x2ba2('0x3b')]));_0x28c5b5['attributes']=_0x28c5b5['attributes'][_0x2ba2('0x3c')]?_0x28c5b5['attributes']:_0x5b7def[_0x2ba2('0x39')];if(_0x393c3d['query'][_0x2ba2('0x44')]){_0x28c5b5[_0x2ba2('0x49')]=[{'all':!![]}];}_0x28c5b5=_[_0x2ba2('0x42')]({},_0x28c5b5,_0x393c3d['options']);return db[_0x2ba2('0x30')][_0x2ba2('0x4a')](_0x28c5b5)[_0x2ba2('0x26')](handleEntityNotFound(_0x58d89a,null))[_0x2ba2('0x26')](respondWithResult(_0x58d89a,null))['catch'](handleError(_0x58d89a,null));};exports['create']=function(_0x221bd0,_0x5edd3b){return db['Schedule'][_0x2ba2('0x4b')](_0x221bd0[_0x2ba2('0x4c')],{})[_0x2ba2('0x26')](function(_0x45c361){var _0x174d34=_0x221bd0[_0x2ba2('0x4d')][_0x2ba2('0x27')]({'plain':!![]});if(!_0x174d34)throw new Error(_0x2ba2('0x4e'));if(_0x174d34[_0x2ba2('0x4f')]===_0x2ba2('0x4d')){var _0x201503=_0x45c361[_0x2ba2('0x27')]({'plain':!![]});var _0xff4b93=_0x2ba2('0x28');return db[_0x2ba2('0x50')][_0x2ba2('0x4a')]({'where':{'name':_0xff4b93,'userProfileId':_0x174d34[_0x2ba2('0x51')]},'raw':!![]})[_0x2ba2('0x26')](function(_0x3efc12){if(_0x3efc12&&_0x3efc12[_0x2ba2('0x52')]===0x0){return db['UserProfileResource'][_0x2ba2('0x4b')]({'name':_0x201503[_0x2ba2('0x2c')],'resourceId':_0x201503['id'],'type':_0x3efc12['name'],'sectionId':_0x3efc12['id']},{})[_0x2ba2('0x26')](function(){return _0x45c361;});}else{return _0x45c361;}})[_0x2ba2('0x53')](function(_0x21c88d){logger[_0x2ba2('0x2b')](_0x2ba2('0x54'),_0x21c88d);throw _0x21c88d;});}return _0x45c361;})[_0x2ba2('0x26')](respondWithResult(_0x5edd3b,0xc9))[_0x2ba2('0x53')](handleError(_0x5edd3b,null));};exports[_0x2ba2('0x55')]=function(_0x3deb2b,_0x18e235){if(_0x3deb2b[_0x2ba2('0x4c')]['id']){delete _0x3deb2b[_0x2ba2('0x4c')]['id'];}return db[_0x2ba2('0x30')]['find']({'where':{'id':_0x3deb2b[_0x2ba2('0x48')]['id']}})['then'](handleEntityNotFound(_0x18e235,null))[_0x2ba2('0x26')](saveUpdates(_0x3deb2b[_0x2ba2('0x4c')],null))[_0x2ba2('0x26')](respondWithResult(_0x18e235,null))[_0x2ba2('0x53')](handleError(_0x18e235,null));};exports['destroy']=function(_0x56fb48,_0x347542){return db[_0x2ba2('0x30')][_0x2ba2('0x4a')]({'where':{'id':_0x56fb48['params']['id']}})[_0x2ba2('0x26')](handleEntityNotFound(_0x347542,null))[_0x2ba2('0x26')](removeEntity(_0x347542,null))[_0x2ba2('0x53')](handleError(_0x347542,null));};exports[_0x2ba2('0x56')]=function(_0x17c850,_0x792a8b,_0x35c1a2){var _0x48f102=require(_0x2ba2('0x57'));return db[_0x2ba2('0x30')][_0x2ba2('0x4a')]({'where':{'id':_0x17c850['params']['id']},'raw':!![]})[_0x2ba2('0x26')](handleEntityNotFound(_0x792a8b,null))[_0x2ba2('0x26')](function(){_0x48f102[_0x2ba2('0x56')](_0x17c850[_0x2ba2('0x48')]['id']);})['then'](respondWithStatusCode(_0x792a8b,null))[_0x2ba2('0x53')](handleError(_0x792a8b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 217365f..487a843 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 _0x9c3f=['Schedule','tools_schedules','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0xc01d2,_0x29f146){var _0x17f297=function(_0x24703f){while(--_0x24703f){_0xc01d2['push'](_0xc01d2['shift']());}};_0x17f297(++_0x29f146);}(_0x9c3f,0x116));var _0xf9c3=function(_0x403f5a,_0x2a32ec){_0x403f5a=_0x403f5a-0x0;var _0x384bef=_0x9c3f[_0x403f5a];return _0x384bef;};'use strict';var _=require(_0xf9c3('0x0'));var util=require(_0xf9c3('0x1'));var logger=require('../../config/logger')(_0xf9c3('0x2'));var moment=require('moment');var BPromise=require(_0xf9c3('0x3'));var rp=require(_0xf9c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9c3('0x5'));var config=require(_0xf9c3('0x6'));var attributes=require(_0xf9c3('0x7'));module[_0xf9c3('0x8')]=function(_0x2e1838,_0x63fc71){return _0x2e1838[_0xf9c3('0x9')](_0xf9c3('0xa'),attributes,{'tableName':_0xf9c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd377=['request-promise','path','rimraf','../../config/environment','exports','define','tools_schedules','lodash','../../config/logger','api','moment','bluebird'];(function(_0x978b14,_0x45a8ab){var _0x8dbf9c=function(_0x186b34){while(--_0x186b34){_0x978b14['push'](_0x978b14['shift']());}};_0x8dbf9c(++_0x45a8ab);}(_0xd377,0x1db));var _0x7d37=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd377[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7d37('0x0'));var util=require('util');var logger=require(_0x7d37('0x1'))(_0x7d37('0x2'));var moment=require(_0x7d37('0x3'));var BPromise=require(_0x7d37('0x4'));var rp=require(_0x7d37('0x5'));var fs=require('fs');var path=require(_0x7d37('0x6'));var rimraf=require(_0x7d37('0x7'));var config=require(_0x7d37('0x8'));var attributes=require('./schedule.attributes');module[_0x7d37('0x9')]=function(_0x47300b,_0x581000){return _0x47300b[_0x7d37('0xa')]('Schedule',attributes,{'tableName':_0x7d37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index f4b8eca..c9f6ff7 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 _0x63b8=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ce3f6,_0x3b922a){var _0x3a63b7=function(_0x2752f3){while(--_0x2752f3){_0x1ce3f6['push'](_0x1ce3f6['shift']());}};_0x3a63b7(++_0x3b922a);}(_0x63b8,0x99));var _0x863b=function(_0x561f10,_0x581c75){_0x561f10=_0x561f10-0x0;var _0x31150c=_0x63b8[_0x561f10];return _0x31150c;};'use strict';var _=require(_0x863b('0x0'));var util=require(_0x863b('0x1'));var moment=require('moment');var BPromise=require(_0x863b('0x2'));var rs=require(_0x863b('0x3'));var fs=require('fs');var Redis=require(_0x863b('0x4'));var db=require(_0x863b('0x5'))['db'];var utils=require(_0x863b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x863b('0x7'));var jayson=require(_0x863b('0x8'));var client=jayson[_0x863b('0x9')][_0x863b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58acdb,_0x296ad3,_0x3480db){return new BPromise(function(_0x2dece7,_0x2418ae){return client['request'](_0x58acdb,_0x3480db)['then'](function(_0x173001){logger[_0x863b('0xb')](_0x863b('0xc'),_0x296ad3,_0x863b('0xd'));logger[_0x863b('0xe')](_0x863b('0xf'),_0x296ad3,'request\x20sent',JSON[_0x863b('0x10')](_0x173001));if(_0x173001[_0x863b('0x11')]){if(_0x173001[_0x863b('0x11')][_0x863b('0x12')]===0x1f4){logger[_0x863b('0x11')](_0x863b('0xc'),_0x296ad3,_0x173001['error'][_0x863b('0x13')]);return _0x2418ae(_0x173001[_0x863b('0x11')]['message']);}logger[_0x863b('0x11')](_0x863b('0xc'),_0x296ad3,_0x173001[_0x863b('0x11')][_0x863b('0x13')]);return _0x2dece7(_0x173001['error'][_0x863b('0x13')]);}else{logger[_0x863b('0xb')](_0x863b('0xc'),_0x296ad3,_0x863b('0xd'));_0x2dece7(_0x173001[_0x863b('0x14')]['message']);}})['catch'](function(_0x1421dd){logger[_0x863b('0x11')](_0x863b('0xc'),_0x296ad3,_0x1421dd);_0x2418ae(_0x1421dd);});});} \ No newline at end of file +var _0x9315=['then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2af9c5,_0x1eccae){var _0x198e3b=function(_0x5c9ee8){while(--_0x5c9ee8){_0x2af9c5['push'](_0x2af9c5['shift']());}};_0x198e3b(++_0x1eccae);}(_0x9315,0x14e));var _0x5931=function(_0x305a6c,_0x53df99){_0x305a6c=_0x305a6c-0x0;var _0x5cacbe=_0x9315[_0x305a6c];return _0x5cacbe;};'use strict';var _=require('lodash');var util=require(_0x5931('0x0'));var moment=require(_0x5931('0x1'));var BPromise=require('bluebird');var rs=require(_0x5931('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5931('0x3'))['db'];var utils=require(_0x5931('0x4'));var logger=require(_0x5931('0x5'))(_0x5931('0x6'));var config=require(_0x5931('0x7'));var jayson=require(_0x5931('0x8'));var client=jayson['client'][_0x5931('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49d172,_0x3b440,_0x19a144){return new BPromise(function(_0x1241a5,_0x1acd67){return client[_0x5931('0xa')](_0x49d172,_0x19a144)[_0x5931('0xb')](function(_0x34d40c){logger[_0x5931('0xc')](_0x5931('0xd'),_0x3b440,_0x5931('0xe'));logger[_0x5931('0xf')](_0x5931('0x10'),_0x3b440,_0x5931('0xe'),JSON[_0x5931('0x11')](_0x34d40c));if(_0x34d40c[_0x5931('0x12')]){if(_0x34d40c[_0x5931('0x12')][_0x5931('0x13')]===0x1f4){logger[_0x5931('0x12')](_0x5931('0xd'),_0x3b440,_0x34d40c['error'][_0x5931('0x14')]);return _0x1acd67(_0x34d40c[_0x5931('0x12')][_0x5931('0x14')]);}logger['error'](_0x5931('0xd'),_0x3b440,_0x34d40c[_0x5931('0x12')][_0x5931('0x14')]);return _0x1241a5(_0x34d40c[_0x5931('0x12')]['message']);}else{logger[_0x5931('0xc')](_0x5931('0xd'),_0x3b440,'request\x20sent');_0x1241a5(_0x34d40c[_0x5931('0x15')][_0x5931('0x14')]);}})[_0x5931('0x16')](function(_0x2f151e){logger[_0x5931('0x12')](_0x5931('0xd'),_0x3b440,_0x2f151e);_0x1acd67(_0x2f151e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 8cd147a..d01d9a8 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 _0x396e=['connect-timeout','express','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','update','destroy','exports','multer','util'];(function(_0x1452ac,_0x960b27){var _0x3d0060=function(_0x48de7b){while(--_0x48de7b){_0x1452ac['push'](_0x1452ac['shift']());}};_0x3d0060(++_0x960b27);}(_0x396e,0xcf));var _0xe396=function(_0x11db1b,_0x46f212){_0x11db1b=_0x11db1b-0x0;var _0x36394b=_0x396e[_0x11db1b];return _0x36394b;};'use strict';var multer=require(_0xe396('0x0'));var util=require(_0xe396('0x1'));var path=require('path');var timeout=require(_0xe396('0x2'));var express=require(_0xe396('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe396('0x4'));var controller=require(_0xe396('0x5'));router[_0xe396('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe396('0x6')](_0xe396('0x7'),auth[_0xe396('0x8')](),controller[_0xe396('0x9')]);router[_0xe396('0x6')](_0xe396('0xa'),auth[_0xe396('0x8')](),controller[_0xe396('0xb')]);router['get'](_0xe396('0xc'),auth[_0xe396('0x8')](),controller[_0xe396('0xd')]);router[_0xe396('0xe')]('/',auth[_0xe396('0x8')](),controller[_0xe396('0xf')]);router['put'](_0xe396('0xa'),auth['isAuthenticated'](),controller[_0xe396('0x10')]);router['delete']('/:id',auth[_0xe396('0x8')](),controller[_0xe396('0x11')]);module[_0xe396('0x12')]=router; \ No newline at end of file +var _0x2941=['download','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download'];(function(_0x26dc96,_0x10c6f5){var _0x30b7be=function(_0x47de22){while(--_0x47de22){_0x26dc96['push'](_0x26dc96['shift']());}};_0x30b7be(++_0x10c6f5);}(_0x2941,0x151));var _0x1294=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0x2941[_0x9e7f3a];return _0x5ab145;};'use strict';var multer=require(_0x1294('0x0'));var util=require('util');var path=require(_0x1294('0x1'));var timeout=require(_0x1294('0x2'));var express=require(_0x1294('0x3'));var router=express[_0x1294('0x4')]();var auth=require(_0x1294('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1294('0x6'));var controller=require(_0x1294('0x7'));router[_0x1294('0x8')]('/',auth[_0x1294('0x9')](),controller[_0x1294('0xa')]);router[_0x1294('0x8')](_0x1294('0xb'),auth[_0x1294('0x9')](),controller[_0x1294('0xc')]);router[_0x1294('0x8')]('/:id',auth[_0x1294('0x9')](),controller[_0x1294('0xd')]);router['get'](_0x1294('0xe'),auth['isAuthenticated'](),controller[_0x1294('0xf')]);router[_0x1294('0x10')]('/',auth[_0x1294('0x9')](),controller['create']);router[_0x1294('0x11')](_0x1294('0x12'),auth[_0x1294('0x9')](),controller[_0x1294('0x13')]);router['delete'](_0x1294('0x12'),auth[_0x1294('0x9')](),controller[_0x1294('0x14')]);module[_0x1294('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 070d21f..8195c99 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 _0x4b84=['createdAt','sequelize','moment','exports','value','extname','getDataValue','STRING','setDataValue','INTEGER','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x3fbb10,_0x15e109){var _0x3d063c=function(_0x2ed91f){while(--_0x2ed91f){_0x3fbb10['push'](_0x3fbb10['shift']());}};_0x3d063c(++_0x15e109);}(_0x4b84,0x1cc));var _0x44b8=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0x4b84[_0x350aeb];return _0x3c5273;};'use strict';var Sequelize=require(_0x44b8('0x0'));var moment=require(_0x44b8('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x44b8('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x44b8('0x3'))?path[_0x44b8('0x4')](this[_0x44b8('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x44b8('0x6')],'set':function(_0x54274b){var _0x327f59=_0x54274b['replace'](/\\/g,'/');this[_0x44b8('0x7')]('value',_0x327f59);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x44b8('0x8')],'set':function(_0x42319d){this[_0x44b8('0x7')]('startedAt',moment()[_0x44b8('0x9')](_0x42319d,'ms'));this[_0x44b8('0x7')](_0x44b8('0xa'),moment());this[_0x44b8('0x7')](_0x44b8('0xb'),_0x42319d);}},'startedAt':{'type':Sequelize[_0x44b8('0xc')],'get':function(){return moment(this[_0x44b8('0x5')]('startedAt'))[_0x44b8('0xd')](_0x44b8('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x44b8('0xc')],'get':function(){return moment(this['getDataValue'](_0x44b8('0xa')))[_0x44b8('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x44b8('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x44b8('0x10')))[_0x44b8('0xd')](_0x44b8('0xe'))[_0x44b8('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x44b8('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x44b8('0xf')]();}}}; \ No newline at end of file +var _0xdc97=['startedAt','subtract','closedAt','duration','DATE','toString','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path','exports','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x1c1996,_0xb8413e){var _0x30dff0=function(_0x57aeba){while(--_0x57aeba){_0x1c1996['push'](_0x1c1996['shift']());}};_0x30dff0(++_0xb8413e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x57c929,_0x56bd48){_0x57c929=_0x57c929-0x0;var _0x12858a=_0xdc97[_0x57c929];return _0x12858a;};'use strict';var Sequelize=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var config=require('../../config/environment');module[_0x7dc9('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7dc9('0x4')](_0x7dc9('0x5'))?path['extname'](this[_0x7dc9('0x4')](_0x7dc9('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x7dc9('0x6')]},'channel':{'type':Sequelize[_0x7dc9('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2636ef){var _0x4f91c7=_0x2636ef['replace'](/\\/g,'/');this[_0x7dc9('0x7')](_0x7dc9('0x5'),_0x4f91c7);}},'rating':{'type':Sequelize[_0x7dc9('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7dc9('0x8')],'set':function(_0x3dd07e){this['setDataValue'](_0x7dc9('0x9'),moment()[_0x7dc9('0xa')](_0x3dd07e,'ms'));this[_0x7dc9('0x7')](_0x7dc9('0xb'),moment());this[_0x7dc9('0x7')](_0x7dc9('0xc'),_0x3dd07e);}},'startedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x7dc9('0xe')]();}},'closedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this['getDataValue'](_0x7dc9('0xb')))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}},'createdAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this[_0x7dc9('0x4')]('createdAt'))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}},'updatedAt':{'type':Sequelize[_0x7dc9('0xd')],'get':function(){return moment(this[_0x7dc9('0x4')](_0x7dc9('0x11')))[_0x7dc9('0xf')](_0x7dc9('0x10'))[_0x7dc9('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 52993da..c2597e8 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 _0xeb5d=['format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','body','duration','createdAt','closedAt','describe','download','uniqueid','value','join','root','decryptFile','secrets','recording','server/files/screen_recordings','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ScreenRecording','fieldName','model','differenceBy','map'];(function(_0x37fd56,_0x1528a7){var _0x22adc8=function(_0x4d87ab){while(--_0x4d87ab){_0x37fd56['push'](_0x37fd56['shift']());}};_0x22adc8(++_0x1528a7);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeb5d[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdeb5('0x0'));var rimraf=require(_0xdeb5('0x1'));var zipdir=require(_0xdeb5('0x2'));var jsonpatch=require(_0xdeb5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdeb5('0x4'));var Mustache=require(_0xdeb5('0x5'));var util=require('util');var path=require(_0xdeb5('0x6'));var sox=require(_0xdeb5('0x7'));var csv=require(_0xdeb5('0x8'));var ejs=require(_0xdeb5('0x9'));var fs=require('fs');var _=require(_0xdeb5('0xa'));var squel=require(_0xdeb5('0xb'));var crypto=require(_0xdeb5('0xc'));var jsforce=require(_0xdeb5('0xd'));var deskjs=require(_0xdeb5('0xe'));var toCsv=require(_0xdeb5('0x8'));var querystring=require(_0xdeb5('0xf'));var Papa=require(_0xdeb5('0x10'));var Redis=require(_0xdeb5('0x11'));var authService=require(_0xdeb5('0x12'));var qs=require(_0xdeb5('0x13'));var as=require(_0xdeb5('0x14'));var hardwareService=require(_0xdeb5('0x15'));var logger=require('../../config/logger')(_0xdeb5('0x16'));var utils=require(_0xdeb5('0x17'));var config=require(_0xdeb5('0x18'));var db=require(_0xdeb5('0x19'))['db'];function respondWithStatusCode(_0x188747,_0x298927){_0x298927=_0x298927||0xcc;return function(_0x2fe452){if(_0x2fe452){return _0x188747[_0xdeb5('0x1a')](_0x298927);}return _0x188747['status'](_0x298927)[_0xdeb5('0x1b')]();};}function respondWithResult(_0x5e2853,_0xe648c0){_0xe648c0=_0xe648c0||0xc8;return function(_0x11d83a){if(_0x11d83a){return _0x5e2853[_0xdeb5('0x1c')](_0xe648c0)[_0xdeb5('0x1d')](_0x11d83a);}};}function respondWithFilteredResult(_0x2633aa,_0x57e4e7){return function(_0x82d3ba){if(_0x82d3ba){var _0x384145=_0x82d3ba[_0xdeb5('0x1e')],_0x5caec0=_0x57e4e7['offset'],_0x17312b=_0x57e4e7['offset']+_0x57e4e7[_0xdeb5('0x1f')],_0x835c99;if(_0x17312b>=_0x384145){_0x17312b=_0x384145;_0x835c99=0xc8;}else{_0x835c99=0xce;}_0x2633aa['status'](_0x835c99);return _0x2633aa[_0xdeb5('0x20')](_0xdeb5('0x21'),_0x5caec0+'-'+_0x17312b+'/'+_0x384145)[_0xdeb5('0x1d')](_0x82d3ba);}return null;};}function patchUpdates(_0x5c1785){return function(_0x13c9fe){try{jsonpatch['apply'](_0x13c9fe,_0x5c1785,!![]);}catch(_0x20ac22){return BPromise[_0xdeb5('0x22')](_0x20ac22);}return _0x13c9fe[_0xdeb5('0x23')]();};}function saveUpdates(_0xb3e5a1,_0x3f7eff){return function(_0x540300){if(_0x540300){return _0x540300[_0xdeb5('0x24')](_0xb3e5a1)[_0xdeb5('0x25')](function(_0x4ef4d5){return _0x4ef4d5;});}return null;};}function removeEntity(_0x51f458,_0x5c8601){return function(_0x1ca65d){if(_0x1ca65d){return _0x1ca65d[_0xdeb5('0x26')]()[_0xdeb5('0x25')](function(){_0x51f458['status'](0xcc)[_0xdeb5('0x1b')]();});}};}function handleEntityNotFound(_0x5cdf41,_0x37d039){return function(_0x30e5c3){if(!_0x30e5c3){_0x5cdf41[_0xdeb5('0x1a')](0x194);}return _0x30e5c3;};}function handleError(_0x25d677,_0x31684a){_0x31684a=_0x31684a||0x1f4;return function(_0x364c90){logger[_0xdeb5('0x27')](_0x364c90[_0xdeb5('0x28')]);if(_0x364c90[_0xdeb5('0x29')]){delete _0x364c90[_0xdeb5('0x29')];}_0x25d677['status'](_0x31684a)[_0xdeb5('0x2a')](_0x364c90);};}exports[_0xdeb5('0x2b')]=function(_0x427302,_0x26d04d){var _0x546f86={},_0x484d6e={},_0x25e2f0={'count':0x0,'rows':[]};var _0x2d3f85=_['map'](db[_0xdeb5('0x2c')]['rawAttributes'],function(_0x41bf2b){return{'name':_0x41bf2b[_0xdeb5('0x2d')],'type':_0x41bf2b['type']['key']};});_0x484d6e[_0xdeb5('0x2e')]=_[_0xdeb5('0x2f')](_[_0xdeb5('0x30')](_0x2d3f85,_0xdeb5('0x29')),[_0xdeb5('0x31')]);_0x484d6e['query']=_[_0xdeb5('0x32')](_0x427302[_0xdeb5('0x33')]);_0x484d6e[_0xdeb5('0x34')]=_[_0xdeb5('0x35')](_0x484d6e[_0xdeb5('0x2e')],_0x484d6e[_0xdeb5('0x33')]);_0x546f86[_0xdeb5('0x36')]=_[_0xdeb5('0x35')](_0x484d6e[_0xdeb5('0x2e')],qs[_0xdeb5('0x37')](_0x427302[_0xdeb5('0x33')][_0xdeb5('0x37')]));_0x546f86[_0xdeb5('0x36')]=_0x546f86['attributes'][_0xdeb5('0x38')]?_0x546f86['attributes']:_0x484d6e[_0xdeb5('0x2e')];if(!_0x427302[_0xdeb5('0x33')][_0xdeb5('0x39')]('nolimit')){_0x546f86[_0xdeb5('0x1f')]=qs['limit'](_0x427302['query'][_0xdeb5('0x1f')]);_0x546f86['offset']=qs[_0xdeb5('0x3a')](_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3a')]);}_0x546f86[_0xdeb5('0x3b')]=qs[_0xdeb5('0x3c')](_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3c')]);_0x546f86[_0xdeb5('0x3d')]=qs['filters'](_[_0xdeb5('0x3e')](_0x427302['query'],_0x484d6e[_0xdeb5('0x34')]),_0x2d3f85);if(_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3f')]){_0x546f86[_0xdeb5('0x3d')]=_[_0xdeb5('0x40')](_0x546f86[_0xdeb5('0x3d')],{'$or':_[_0xdeb5('0x30')](_0x2d3f85,function(_0x614555){if(_0x614555[_0xdeb5('0x41')]!==_0xdeb5('0x42')){var _0x243515={};_0x243515[_0x614555[_0xdeb5('0x29')]]={'$like':'%'+_0x427302[_0xdeb5('0x33')][_0xdeb5('0x3f')]+'%'};return _0x243515;}})});}_0x546f86=_[_0xdeb5('0x40')]({},_0x546f86,_0x427302['options']);var _0x45f6fe={'where':_0x546f86['where']};return db[_0xdeb5('0x2c')][_0xdeb5('0x1e')](_0x45f6fe)[_0xdeb5('0x25')](function(_0x415e99){_0x25e2f0[_0xdeb5('0x1e')]=_0x415e99;if(_0x427302['query']['includeAll']){_0x546f86[_0xdeb5('0x43')]=[{'all':!![]}];}return db[_0xdeb5('0x2c')][_0xdeb5('0x44')](_0x546f86);})['then'](function(_0x3fee4f){_0x25e2f0['rows']=_0x3fee4f;return _0x25e2f0;})[_0xdeb5('0x25')](respondWithFilteredResult(_0x26d04d,_0x546f86))[_0xdeb5('0x45')](handleError(_0x26d04d,null));};exports[_0xdeb5('0x46')]=function(_0x58e52b,_0x450bbc){var _0x3bab95={'raw':![],'where':{'id':_0x58e52b[_0xdeb5('0x47')]['id']}},_0xe858e2={};_0xe858e2['model']=_[_0xdeb5('0x32')](db[_0xdeb5('0x2c')]['rawAttributes']);_0xe858e2[_0xdeb5('0x33')]=_[_0xdeb5('0x32')](_0x58e52b[_0xdeb5('0x33')]);_0xe858e2[_0xdeb5('0x34')]=_[_0xdeb5('0x35')](_0xe858e2[_0xdeb5('0x2e')],_0xe858e2[_0xdeb5('0x33')]);_0x3bab95[_0xdeb5('0x36')]=_[_0xdeb5('0x35')](_0xe858e2[_0xdeb5('0x2e')],qs['fields'](_0x58e52b[_0xdeb5('0x33')][_0xdeb5('0x37')]));_0x3bab95[_0xdeb5('0x36')]=_0x3bab95[_0xdeb5('0x36')][_0xdeb5('0x38')]?_0x3bab95[_0xdeb5('0x36')]:_0xe858e2[_0xdeb5('0x2e')];if(_0x58e52b[_0xdeb5('0x33')][_0xdeb5('0x48')]){_0x3bab95['include']=[{'all':!![]}];}_0x3bab95=_[_0xdeb5('0x40')]({},_0x3bab95,_0x58e52b[_0xdeb5('0x49')]);return db['ScreenRecording'][_0xdeb5('0x4a')](_0x3bab95)[_0xdeb5('0x25')](handleEntityNotFound(_0x450bbc,null))[_0xdeb5('0x25')](respondWithResult(_0x450bbc,null))[_0xdeb5('0x45')](handleError(_0x450bbc,null));};exports['create']=function(_0x3fec09,_0x29d898){return db['ScreenRecording']['create'](_0x3fec09[_0xdeb5('0x4b')],{})[_0xdeb5('0x25')](respondWithResult(_0x29d898,0xc9))[_0xdeb5('0x45')](handleError(_0x29d898,null));};exports[_0xdeb5('0x24')]=function(_0x1ae0ba,_0x4a3d96){if(_0x1ae0ba[_0xdeb5('0x4b')]['id']){delete _0x1ae0ba[_0xdeb5('0x4b')]['id'];}delete _0x1ae0ba[_0xdeb5('0x4b')][_0xdeb5('0x4c')];delete _0x1ae0ba[_0xdeb5('0x4b')][_0xdeb5('0x4d')];delete _0x1ae0ba[_0xdeb5('0x4b')][_0xdeb5('0x4e')];delete _0x1ae0ba[_0xdeb5('0x4b')]['value'];return db[_0xdeb5('0x2c')]['find']({'where':{'id':_0x1ae0ba[_0xdeb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a3d96,null))[_0xdeb5('0x25')](saveUpdates(_0x1ae0ba[_0xdeb5('0x4b')],null))[_0xdeb5('0x25')](respondWithResult(_0x4a3d96,null))[_0xdeb5('0x45')](handleError(_0x4a3d96,null));};exports[_0xdeb5('0x4f')]=function(_0x1f52eb,_0x1adb14){return db[_0xdeb5('0x2c')][_0xdeb5('0x4f')]()[_0xdeb5('0x25')](respondWithResult(_0x1adb14,null))[_0xdeb5('0x45')](handleError(_0x1adb14,null));};exports[_0xdeb5('0x50')]=function(_0x481961,_0x14e8fc,_0x180b7f){var _0x3f2fd2=require('../../components/encryptor');var _0x3bca2e=![];var _0x45914d={};if(_0x481961[_0xdeb5('0x33')]['type']&&_0x481961[_0xdeb5('0x33')][_0xdeb5('0x41')]===_0xdeb5('0x51')){_0x45914d[_0xdeb5('0x51')]=_0x481961['params']['id'];}else{_0x45914d['id']=_0x481961[_0xdeb5('0x47')]['id'];}return db['ScreenRecording'][_0xdeb5('0x4a')]({'where':_0x45914d,'attributes':['id',_0xdeb5('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x14e8fc,null))[_0xdeb5('0x25')](function(_0xd9101a){if(_0xd9101a){var _0x4235fe=path[_0xdeb5('0x53')](config[_0xdeb5('0x54')],'server/files/screen_recordings',_0xd9101a['value']);var _0x878408=util[_0xdeb5('0x31')]('%s.cypher',_0x4235fe);if(fs['existsSync'](_0x878408)){_0x3bca2e=!![];return _0x3f2fd2[_0xdeb5('0x55')](_0x878408,_0x4235fe,config[_0xdeb5('0x56')][_0xdeb5('0x57')])['then'](function(){return _0xd9101a;});}return _0xd9101a;}})['then'](function(_0x571d61){if(_0x571d61){var _0x1f1171=path[_0xdeb5('0x53')](config[_0xdeb5('0x54')],_0xdeb5('0x58'),_0x571d61[_0xdeb5('0x52')]);if(!fs[_0xdeb5('0x59')](_0x1f1171)){throw new db[(_0xdeb5('0x5a'))][(_0xdeb5('0x5b'))](_0xdeb5('0x5c'));}if(_0x571d61[_0xdeb5('0x5d')]){return _0x14e8fc['download'](_0x1f1171,_0x571d61[_0xdeb5('0x5d')]+path[_0xdeb5('0x5e')](_0x1f1171),function(){if(_0x3bca2e){fs[_0xdeb5('0x5f')](_0x1f1171);}});}else{return _0x14e8fc[_0xdeb5('0x50')](_0x1f1171,function(_0x50282c){if(_0x3bca2e){fs[_0xdeb5('0x5f')](_0x1f1171);}});}}})[_0xdeb5('0x45')](function(_0x17e099){if(_0x17e099['message']===_0xdeb5('0x5c')){_0x14e8fc[_0xdeb5('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x14e8fc,null);}});};exports[_0xdeb5('0x26')]=function(_0x398498,_0x2f6194){return db[_0xdeb5('0x2c')][_0xdeb5('0x4a')]({'where':{'id':_0x398498['params']['id']}})[_0xdeb5('0x25')](function(_0x555ed9){if(!_0x555ed9)throw new ReferenceError(_0xdeb5('0x60'));return _0x555ed9;})[_0xdeb5('0x25')](function(_0x449445){var _0x51e3d8=path['join'](config[_0xdeb5('0x54')],'server/files/screen_recordings',_0x449445[_0xdeb5('0x52')]);logger[_0xdeb5('0x61')]('cancellazione\x20fisica\x20documento\x20%s',_0x51e3d8);if(!_[_0xdeb5('0x62')](_0x449445[_0xdeb5('0x52')])&&fs[_0xdeb5('0x59')](_0x51e3d8)){logger[_0xdeb5('0x61')](_0xdeb5('0x63')+_0x51e3d8+_0xdeb5('0x64'));fs[_0xdeb5('0x65')](_0x51e3d8);}_0x51e3d8=_0x51e3d8+_0xdeb5('0x66');if(!_['isNil'](_0x449445['value'])&&fs[_0xdeb5('0x59')](_0x51e3d8)){logger[_0xdeb5('0x61')](_0xdeb5('0x63')+_0x51e3d8+_0xdeb5('0x64'));fs[_0xdeb5('0x65')](_0x51e3d8);}return _0x449445;})['then'](function(_0x408824){if(!_0x408824)throw new InternalError();return _0x408824[_0xdeb5('0x26')]();})[_0xdeb5('0x25')](function(){_0x2f6194[_0xdeb5('0x1c')](0xcc)[_0xdeb5('0x1b')]();})['catch'](handleError(_0x2f6194,null));}; \ No newline at end of file +var _0xaa00=['where','filter','merge','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','sendStatus','status','end','count','offset','limit','set','json','save','update','then','destroy','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort'];(function(_0x51cefc,_0x27e236){var _0x44a4f5=function(_0x569232){while(--_0x569232){_0x51cefc['push'](_0x51cefc['shift']());}};_0x44a4f5(++_0x27e236);}(_0xaa00,0x1f4));var _0x0aa0=function(_0x3220ea,_0x32c573){_0x3220ea=_0x3220ea-0x0;var _0x447d35=_0xaa00[_0x3220ea];return _0x447d35;};'use strict';var pdf=require(_0x0aa0('0x0'));var emlformat=require(_0x0aa0('0x1'));var rimraf=require(_0x0aa0('0x2'));var zipdir=require(_0x0aa0('0x3'));var jsonpatch=require(_0x0aa0('0x4'));var rp=require(_0x0aa0('0x5'));var moment=require(_0x0aa0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0aa0('0x7'));var util=require(_0x0aa0('0x8'));var path=require(_0x0aa0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0aa0('0xa'));var fs=require('fs');var _=require(_0x0aa0('0xb'));var squel=require('squel');var crypto=require(_0x0aa0('0xc'));var jsforce=require(_0x0aa0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0aa0('0xe'));var querystring=require(_0x0aa0('0xf'));var Papa=require(_0x0aa0('0x10'));var Redis=require('ioredis');var authService=require(_0x0aa0('0x11'));var qs=require(_0x0aa0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0aa0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b128c,_0x212af9){_0x212af9=_0x212af9||0xcc;return function(_0x258f86){if(_0x258f86){return _0x5b128c[_0x0aa0('0x14')](_0x212af9);}return _0x5b128c[_0x0aa0('0x15')](_0x212af9)[_0x0aa0('0x16')]();};}function respondWithResult(_0x43c814,_0x1d3ff5){_0x1d3ff5=_0x1d3ff5||0xc8;return function(_0x2745d7){if(_0x2745d7){return _0x43c814[_0x0aa0('0x15')](_0x1d3ff5)['json'](_0x2745d7);}};}function respondWithFilteredResult(_0x352db0,_0x40e408){return function(_0x4ef18e){if(_0x4ef18e){var _0x5c953f=_0x4ef18e[_0x0aa0('0x17')],_0x57ce4e=_0x40e408[_0x0aa0('0x18')],_0x5b482c=_0x40e408['offset']+_0x40e408[_0x0aa0('0x19')],_0x49e29e;if(_0x5b482c>=_0x5c953f){_0x5b482c=_0x5c953f;_0x49e29e=0xc8;}else{_0x49e29e=0xce;}_0x352db0['status'](_0x49e29e);return _0x352db0[_0x0aa0('0x1a')]('Content-Range',_0x57ce4e+'-'+_0x5b482c+'/'+_0x5c953f)[_0x0aa0('0x1b')](_0x4ef18e);}return null;};}function patchUpdates(_0x5b14a0){return function(_0x50a1f9){try{jsonpatch['apply'](_0x50a1f9,_0x5b14a0,!![]);}catch(_0x4413f4){return BPromise['reject'](_0x4413f4);}return _0x50a1f9[_0x0aa0('0x1c')]();};}function saveUpdates(_0x214114,_0x523387){return function(_0x1dd9bf){if(_0x1dd9bf){return _0x1dd9bf[_0x0aa0('0x1d')](_0x214114)[_0x0aa0('0x1e')](function(_0x304f0f){return _0x304f0f;});}return null;};}function removeEntity(_0x43c8e1,_0x978ef9){return function(_0x5401df){if(_0x5401df){return _0x5401df[_0x0aa0('0x1f')]()['then'](function(){_0x43c8e1[_0x0aa0('0x15')](0xcc)[_0x0aa0('0x16')]();});}};}function handleEntityNotFound(_0x506e92,_0xa47abe){return function(_0x411bb1){if(!_0x411bb1){_0x506e92[_0x0aa0('0x14')](0x194);}return _0x411bb1;};}function handleError(_0x397f64,_0x2fa37e){_0x2fa37e=_0x2fa37e||0x1f4;return function(_0x1ac9fe){logger['error'](_0x1ac9fe[_0x0aa0('0x20')]);if(_0x1ac9fe[_0x0aa0('0x21')]){delete _0x1ac9fe[_0x0aa0('0x21')];}_0x397f64['status'](_0x2fa37e)['send'](_0x1ac9fe);};}exports[_0x0aa0('0x22')]=function(_0x537d56,_0x55b8c9){var _0x27cae3={},_0x23b550={},_0x2a76ad={'count':0x0,'rows':[]};var _0xce7916=_[_0x0aa0('0x23')](db[_0x0aa0('0x24')][_0x0aa0('0x25')],function(_0x3c1cab){return{'name':_0x3c1cab[_0x0aa0('0x26')],'type':_0x3c1cab[_0x0aa0('0x27')][_0x0aa0('0x28')]};});_0x23b550[_0x0aa0('0x29')]=_[_0x0aa0('0x2a')](_[_0x0aa0('0x23')](_0xce7916,_0x0aa0('0x21')),['format']);_0x23b550['query']=_['keys'](_0x537d56['query']);_0x23b550[_0x0aa0('0x2b')]=_[_0x0aa0('0x2c')](_0x23b550[_0x0aa0('0x29')],_0x23b550['query']);_0x27cae3[_0x0aa0('0x2d')]=_[_0x0aa0('0x2c')](_0x23b550[_0x0aa0('0x29')],qs[_0x0aa0('0x2e')](_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x2e')]));_0x27cae3[_0x0aa0('0x2d')]=_0x27cae3[_0x0aa0('0x2d')][_0x0aa0('0x30')]?_0x27cae3[_0x0aa0('0x2d')]:_0x23b550[_0x0aa0('0x29')];if(!_0x537d56['query'][_0x0aa0('0x31')](_0x0aa0('0x32'))){_0x27cae3[_0x0aa0('0x19')]=qs['limit'](_0x537d56[_0x0aa0('0x2f')]['limit']);_0x27cae3[_0x0aa0('0x18')]=qs['offset'](_0x537d56['query'][_0x0aa0('0x18')]);}_0x27cae3['order']=qs['sort'](_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x33')]);_0x27cae3[_0x0aa0('0x34')]=qs[_0x0aa0('0x2b')](_['pick'](_0x537d56[_0x0aa0('0x2f')],_0x23b550['filters']),_0xce7916);if(_0x537d56['query'][_0x0aa0('0x35')]){_0x27cae3[_0x0aa0('0x34')]=_[_0x0aa0('0x36')](_0x27cae3['where'],{'$or':_['map'](_0xce7916,function(_0x257391){if(_0x257391[_0x0aa0('0x27')]!=='VIRTUAL'){var _0x5d4f6d={};_0x5d4f6d[_0x257391[_0x0aa0('0x21')]]={'$like':'%'+_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x35')]+'%'};return _0x5d4f6d;}})});}_0x27cae3=_[_0x0aa0('0x36')]({},_0x27cae3,_0x537d56['options']);var _0x487d4d={'where':_0x27cae3[_0x0aa0('0x34')]};return db[_0x0aa0('0x24')]['count'](_0x487d4d)[_0x0aa0('0x1e')](function(_0x4e5736){_0x2a76ad['count']=_0x4e5736;if(_0x537d56[_0x0aa0('0x2f')][_0x0aa0('0x37')]){_0x27cae3[_0x0aa0('0x38')]=[{'all':!![]}];}return db[_0x0aa0('0x24')][_0x0aa0('0x39')](_0x27cae3);})[_0x0aa0('0x1e')](function(_0x78f173){_0x2a76ad[_0x0aa0('0x3a')]=_0x78f173;return _0x2a76ad;})['then'](respondWithFilteredResult(_0x55b8c9,_0x27cae3))['catch'](handleError(_0x55b8c9,null));};exports[_0x0aa0('0x3b')]=function(_0x500ec9,_0x129e44){var _0xf4cc09={'raw':![],'where':{'id':_0x500ec9[_0x0aa0('0x3c')]['id']}},_0xaf0adc={};_0xaf0adc['model']=_[_0x0aa0('0x3d')](db[_0x0aa0('0x24')][_0x0aa0('0x25')]);_0xaf0adc[_0x0aa0('0x2f')]=_[_0x0aa0('0x3d')](_0x500ec9[_0x0aa0('0x2f')]);_0xaf0adc['filters']=_[_0x0aa0('0x2c')](_0xaf0adc[_0x0aa0('0x29')],_0xaf0adc[_0x0aa0('0x2f')]);_0xf4cc09[_0x0aa0('0x2d')]=_[_0x0aa0('0x2c')](_0xaf0adc[_0x0aa0('0x29')],qs['fields'](_0x500ec9[_0x0aa0('0x2f')]['fields']));_0xf4cc09[_0x0aa0('0x2d')]=_0xf4cc09['attributes'][_0x0aa0('0x30')]?_0xf4cc09[_0x0aa0('0x2d')]:_0xaf0adc['model'];if(_0x500ec9['query'][_0x0aa0('0x37')]){_0xf4cc09['include']=[{'all':!![]}];}_0xf4cc09=_['merge']({},_0xf4cc09,_0x500ec9['options']);return db[_0x0aa0('0x24')][_0x0aa0('0x3e')](_0xf4cc09)[_0x0aa0('0x1e')](handleEntityNotFound(_0x129e44,null))[_0x0aa0('0x1e')](respondWithResult(_0x129e44,null))[_0x0aa0('0x3f')](handleError(_0x129e44,null));};exports['create']=function(_0x52567c,_0x1396a9){return db[_0x0aa0('0x24')][_0x0aa0('0x40')](_0x52567c['body'],{})['then'](respondWithResult(_0x1396a9,0xc9))[_0x0aa0('0x3f')](handleError(_0x1396a9,null));};exports[_0x0aa0('0x1d')]=function(_0x2f55af,_0x3bc805){if(_0x2f55af[_0x0aa0('0x41')]['id']){delete _0x2f55af[_0x0aa0('0x41')]['id'];}delete _0x2f55af[_0x0aa0('0x41')]['duration'];delete _0x2f55af[_0x0aa0('0x41')][_0x0aa0('0x42')];delete _0x2f55af[_0x0aa0('0x41')][_0x0aa0('0x43')];delete _0x2f55af[_0x0aa0('0x41')][_0x0aa0('0x44')];return db[_0x0aa0('0x24')][_0x0aa0('0x3e')]({'where':{'id':_0x2f55af[_0x0aa0('0x3c')]['id']}})[_0x0aa0('0x1e')](handleEntityNotFound(_0x3bc805,null))[_0x0aa0('0x1e')](saveUpdates(_0x2f55af[_0x0aa0('0x41')],null))['then'](respondWithResult(_0x3bc805,null))[_0x0aa0('0x3f')](handleError(_0x3bc805,null));};exports[_0x0aa0('0x45')]=function(_0x410674,_0xb892ab){return db[_0x0aa0('0x24')][_0x0aa0('0x45')]()['then'](respondWithResult(_0xb892ab,null))[_0x0aa0('0x3f')](handleError(_0xb892ab,null));};exports[_0x0aa0('0x46')]=function(_0x1cb40b,_0x1e7909,_0x3e4b8d){var _0x4e717e=require(_0x0aa0('0x47'));var _0x540f62=![];var _0x204369={};if(_0x1cb40b[_0x0aa0('0x2f')][_0x0aa0('0x27')]&&_0x1cb40b['query'][_0x0aa0('0x27')]==='uniqueid'){_0x204369['uniqueid']=_0x1cb40b['params']['id'];}else{_0x204369['id']=_0x1cb40b[_0x0aa0('0x3c')]['id'];}return db[_0x0aa0('0x24')]['find']({'where':_0x204369,'attributes':['id',_0x0aa0('0x44')],'raw':!![]})['then'](handleEntityNotFound(_0x1e7909,null))['then'](function(_0x1c246e){if(_0x1c246e){var _0x186969=path[_0x0aa0('0x48')](config[_0x0aa0('0x49')],_0x0aa0('0x4a'),_0x1c246e[_0x0aa0('0x44')]);var _0x53ba27=util['format'](_0x0aa0('0x4b'),_0x186969);if(fs['existsSync'](_0x53ba27)){_0x540f62=!![];return _0x4e717e['decryptFile'](_0x53ba27,_0x186969,config[_0x0aa0('0x4c')][_0x0aa0('0x4d')])[_0x0aa0('0x1e')](function(){return _0x1c246e;});}return _0x1c246e;}})[_0x0aa0('0x1e')](function(_0x17cea6){if(_0x17cea6){var _0xf7c371=path[_0x0aa0('0x48')](config[_0x0aa0('0x49')],'server/files/screen_recordings',_0x17cea6[_0x0aa0('0x44')]);if(!fs[_0x0aa0('0x4e')](_0xf7c371)){throw new db['Sequelize'][(_0x0aa0('0x4f'))](_0x0aa0('0x50'));}if(_0x17cea6[_0x0aa0('0x51')]){return _0x1e7909[_0x0aa0('0x46')](_0xf7c371,_0x17cea6[_0x0aa0('0x51')]+path[_0x0aa0('0x52')](_0xf7c371),function(){if(_0x540f62){fs[_0x0aa0('0x53')](_0xf7c371);}});}else{return _0x1e7909[_0x0aa0('0x46')](_0xf7c371,function(_0x2813aa){if(_0x540f62){fs[_0x0aa0('0x53')](_0xf7c371);}});}}})[_0x0aa0('0x3f')](function(_0x3e18de){if(_0x3e18de[_0x0aa0('0x54')]==='ScreenRecording\x20not\x20found'){_0x1e7909['status'](0x194)[_0x0aa0('0x55')]('Not\x20found');}else{return handleError(_0x1e7909,null);}});};exports[_0x0aa0('0x1f')]=function(_0x43a37a,_0xdab2fe){return db[_0x0aa0('0x24')][_0x0aa0('0x3e')]({'where':{'id':_0x43a37a[_0x0aa0('0x3c')]['id']}})['then'](function(_0x49a22a){if(!_0x49a22a)throw new ReferenceError('Entity\x20not\x20found');return _0x49a22a;})[_0x0aa0('0x1e')](function(_0x53be1d){var _0x2289b6=path['join'](config[_0x0aa0('0x49')],_0x0aa0('0x4a'),_0x53be1d[_0x0aa0('0x44')]);logger[_0x0aa0('0x56')]('cancellazione\x20fisica\x20documento\x20%s',_0x2289b6);if(!_[_0x0aa0('0x57')](_0x53be1d[_0x0aa0('0x44')])&&fs[_0x0aa0('0x4e')](_0x2289b6)){logger[_0x0aa0('0x56')]('File:\x20\x22'+_0x2289b6+_0x0aa0('0x58'));fs[_0x0aa0('0x59')](_0x2289b6);}_0x2289b6=_0x2289b6+_0x0aa0('0x5a');if(!_[_0x0aa0('0x57')](_0x53be1d[_0x0aa0('0x44')])&&fs[_0x0aa0('0x4e')](_0x2289b6)){logger[_0x0aa0('0x56')](_0x0aa0('0x5b')+_0x2289b6+_0x0aa0('0x58'));fs[_0x0aa0('0x59')](_0x2289b6);}return _0x53be1d;})[_0x0aa0('0x1e')](function(_0x4db6cd){if(!_0x4db6cd)throw new InternalError();return _0x4db6cd[_0x0aa0('0x1f')]();})[_0x0aa0('0x1e')](function(){_0xdab2fe[_0x0aa0('0x15')](0xcc)[_0x0aa0('0x16')]();})['catch'](handleError(_0xdab2fe,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d404f6f..3ccd2f3 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 _0x1a9d=['exports','define','screen_recordings','interactionid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3d67fd,_0x72c8b8){var _0x4e1164=function(_0x49bbfa){while(--_0x49bbfa){_0x3d67fd['push'](_0x3d67fd['shift']());}};_0x4e1164(++_0x72c8b8);}(_0x1a9d,0x16f));var _0xd1a9=function(_0x351283,_0x5966a6){_0x351283=_0x351283-0x0;var _0x122685=_0x1a9d[_0x351283];return _0x122685;};'use strict';var _=require(_0xd1a9('0x0'));var util=require('util');var logger=require(_0xd1a9('0x1'))('api');var moment=require(_0xd1a9('0x2'));var BPromise=require('bluebird');var rp=require(_0xd1a9('0x3'));var fs=require('fs');var path=require(_0xd1a9('0x4'));var rimraf=require(_0xd1a9('0x5'));var config=require(_0xd1a9('0x6'));var attributes=require('./screenRecording.attributes');module[_0xd1a9('0x7')]=function(_0x11d430,_0x275728){return _0x11d430[_0xd1a9('0x8')]('ScreenRecording',attributes,{'tableName':_0xd1a9('0x9'),'paranoid':![],'indexes':[{'name':_0xd1a9('0xa'),'fields':[_0xd1a9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38c9=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','moment','request-promise','path','../../config/environment','./screenRecording.attributes','exports'];(function(_0x48497f,_0x5a901f){var _0x440c1d=function(_0x5e5f7d){while(--_0x5e5f7d){_0x48497f['push'](_0x48497f['shift']());}};_0x440c1d(++_0x5a901f);}(_0x38c9,0x64));var _0x938c=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x38c9[_0x36bf88];return _0x332914;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x938c('0x2'));var BPromise=require('bluebird');var rp=require(_0x938c('0x3'));var fs=require('fs');var path=require(_0x938c('0x4'));var rimraf=require('rimraf');var config=require(_0x938c('0x5'));var attributes=require(_0x938c('0x6'));module[_0x938c('0x7')]=function(_0x3a9654,_0x2cd56e){return _0x3a9654[_0x938c('0x8')](_0x938c('0x9'),attributes,{'tableName':_0x938c('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x938c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 41c0f65..a980d1f 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(_0xed5b9e,_0x4abf96){var _0x48e6a9=function(_0x1b8410){while(--_0x1b8410){_0xed5b9e['push'](_0xed5b9e['shift']());}};_0x48e6a9(++_0x4abf96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x32470f,_0x1c8d19){var _0x3db4cc=function(_0x263a4e){while(--_0x263a4e){_0x32470f['push'](_0x32470f['shift']());}};_0x3db4cc(++_0x1c8d19);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 53f0b85..4443075 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 _0x681b=['Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/:id','show','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','diskStorage','logologin','addLogoLogin','addPreferred','favicon','post','addFavicon','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x2088b6,_0x3ca4ae){var _0x4f80c0=function(_0x18dba0){while(--_0x18dba0){_0x2088b6['push'](_0x2088b6['shift']());}};_0x4f80c0(++_0x3ca4ae);}(_0x681b,0x175));var _0xb681=function(_0x458904,_0x45398f){_0x458904=_0x458904-0x0;var _0x1dced6=_0x681b[_0x458904];return _0x1dced6;};'use strict';var multer=require(_0xb681('0x0'));var util=require(_0xb681('0x1'));var path=require(_0xb681('0x2'));var timeout=require(_0xb681('0x3'));var express=require(_0xb681('0x4'));var router=express[_0xb681('0x5')]();var auth=require(_0xb681('0x6'));var interaction=require(_0xb681('0x7'));var config=require('../../config/environment');var controller=require(_0xb681('0x8'));router[_0xb681('0x9')]('/',auth[_0xb681('0xa')](),controller[_0xb681('0xb')]);router[_0xb681('0x9')](_0xb681('0xc'),controller[_0xb681('0xd')]);router[_0xb681('0x9')]('/:id/logo',controller[_0xb681('0xe')]);router['get'](_0xb681('0xf'),controller['getLogoLogin']);router[_0xb681('0x9')]('/:id/gdpr',controller[_0xb681('0x10')]);router[_0xb681('0x9')](_0xb681('0x11'),controller[_0xb681('0x12')]);router[_0xb681('0x9')](_0xb681('0x13'),controller[_0xb681('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49e58f,_0x5a395e,_0x232465){_0x232465(null,path[_0xb681('0x15')](config[_0xb681('0x16')],_0xb681('0x17')));},'filename':function(_0x495a1c,_0x432f1d,_0xf83360){_0xf83360(null,util[_0xb681('0x18')](_0xb681('0x19'),_0xb681('0x1a'),path[_0xb681('0x1b')](_0x432f1d[_0xb681('0x1c')])));}})});router['post']('/:id/logo',upload[_0xb681('0x1d')](_0xb681('0x1e')),controller[_0xb681('0x1f')]);var upload=multer({'storage':multer[_0xb681('0x20')]({'destination':function(_0x9880e1,_0x43eb7c,_0xadb69c){_0xadb69c(null,path['join'](config[_0xb681('0x16')],'server/files/images/logos/'));},'filename':function(_0x398dbd,_0x20b6b0,_0x17900f){_0x17900f(null,util[_0xb681('0x18')](_0xb681('0x19'),_0xb681('0x21'),path[_0xb681('0x1b')](_0x20b6b0[_0xb681('0x1c')])));}})});router['post']('/:id/logo_login',upload['single']('file'),controller[_0xb681('0x22')]);var upload=multer({'storage':multer[_0xb681('0x20')]({'destination':function(_0x5306d8,_0x247f4a,_0x23c07e){_0x23c07e(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5bb1ec,_0xb4d9fd,_0x165e25){_0x165e25(null,util[_0xb681('0x18')](_0xb681('0x19'),'preferred',path[_0xb681('0x1b')](_0xb4d9fd['originalname'])));}})});router['post']('/:id/preferred',upload[_0xb681('0x1d')](_0xb681('0x1e')),controller[_0xb681('0x23')]);var upload=multer({'storage':multer[_0xb681('0x20')]({'destination':function(_0x392d7b,_0x5a7367,_0x4da85d){_0x4da85d(null,path[_0xb681('0x15')](config['root'],_0xb681('0x17')));},'filename':function(_0x1283fe,_0x652ea0,_0xa0f8e6){_0xa0f8e6(null,util[_0xb681('0x18')](_0xb681('0x19'),_0xb681('0x24'),path[_0xb681('0x1b')](_0x652ea0['originalname'])));}})});router[_0xb681('0x25')](_0xb681('0x13'),upload[_0xb681('0x1d')](_0xb681('0x1e')),controller[_0xb681('0x26')]);router[_0xb681('0x27')](_0xb681('0xc'),auth[_0xb681('0xa')](),controller[_0xb681('0x28')]);module[_0xb681('0x29')]=router; \ No newline at end of file +var _0x56d5=['addLogoLogin','preferred','/:id/preferred','file','addPreferred','addFavicon','put','/:id','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','getLogo','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','diskStorage','join','root','format','logo','originalname','/:id/logo','single','server/files/images/logos/','%s%s','post','/:id/logo_login'];(function(_0x28f35,_0x327f7b){var _0x53cc46=function(_0x3bc9ea){while(--_0x3bc9ea){_0x28f35['push'](_0x28f35['shift']());}};_0x53cc46(++_0x327f7b);}(_0x56d5,0xd7));var _0x556d=function(_0x43e9b3,_0x5acc9e){_0x43e9b3=_0x43e9b3-0x0;var _0x48fb7f=_0x56d5[_0x43e9b3];return _0x48fb7f;};'use strict';var multer=require(_0x556d('0x0'));var util=require(_0x556d('0x1'));var path=require('path');var timeout=require(_0x556d('0x2'));var express=require(_0x556d('0x3'));var router=express[_0x556d('0x4')]();var auth=require(_0x556d('0x5'));var interaction=require(_0x556d('0x6'));var config=require(_0x556d('0x7'));var controller=require(_0x556d('0x8'));router[_0x556d('0x9')]('/',auth[_0x556d('0xa')](),controller[_0x556d('0xb')]);router[_0x556d('0x9')]('/:id',controller[_0x556d('0xc')]);router[_0x556d('0x9')]('/:id/logo',controller[_0x556d('0xd')]);router[_0x556d('0x9')]('/:id/logo_login',controller[_0x556d('0xe')]);router[_0x556d('0x9')](_0x556d('0xf'),controller[_0x556d('0x10')]);router['get']('/:id/preferred',controller[_0x556d('0x11')]);router[_0x556d('0x9')](_0x556d('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x556d('0x13')]({'destination':function(_0x1426ad,_0x5ce558,_0xbdf9da){_0xbdf9da(null,path[_0x556d('0x14')](config[_0x556d('0x15')],'server/files/images/logos/'));},'filename':function(_0x1c27df,_0x9e4542,_0x4e9cd9){_0x4e9cd9(null,util[_0x556d('0x16')]('%s%s',_0x556d('0x17'),path['extname'](_0x9e4542[_0x556d('0x18')])));}})});router['post'](_0x556d('0x19'),upload[_0x556d('0x1a')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x556d('0x13')]({'destination':function(_0x4b9841,_0x42b8e7,_0x22fb1a){_0x22fb1a(null,path['join'](config[_0x556d('0x15')],_0x556d('0x1b')));},'filename':function(_0x573ee0,_0xe6abbe,_0x3eb2dd){_0x3eb2dd(null,util[_0x556d('0x16')](_0x556d('0x1c'),'logologin',path['extname'](_0xe6abbe[_0x556d('0x18')])));}})});router[_0x556d('0x1d')](_0x556d('0x1e'),upload['single']('file'),controller[_0x556d('0x1f')]);var upload=multer({'storage':multer[_0x556d('0x13')]({'destination':function(_0x3b8c7c,_0x570781,_0x5dbe23){_0x5dbe23(null,path[_0x556d('0x14')](config[_0x556d('0x15')],_0x556d('0x1b')));},'filename':function(_0x4436e1,_0x38c9f4,_0x2696c1){_0x2696c1(null,util[_0x556d('0x16')]('%s%s',_0x556d('0x20'),path['extname'](_0x38c9f4[_0x556d('0x18')])));}})});router[_0x556d('0x1d')](_0x556d('0x21'),upload['single'](_0x556d('0x22')),controller[_0x556d('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbec702,_0x36fbac,_0x443a6d){_0x443a6d(null,path['join'](config[_0x556d('0x15')],_0x556d('0x1b')));},'filename':function(_0x1cc301,_0x2a772c,_0x5f5587){_0x5f5587(null,util[_0x556d('0x16')]('%s%s','favicon',path['extname'](_0x2a772c[_0x556d('0x18')])));}})});router['post'](_0x556d('0x12'),upload[_0x556d('0x1a')](_0x556d('0x22')),controller[_0x556d('0x24')]);router[_0x556d('0x25')](_0x556d('0x26'),auth['isAuthenticated'](),controller[_0x556d('0x27')]);module[_0x556d('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index fec7037..1e9ac88 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 _0x4702=['min_internal','INTEGER','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports'];(function(_0xd28cc,_0x2f8927){var _0x1f3e28=function(_0x35876a){while(--_0x35876a){_0xd28cc['push'](_0xd28cc['shift']());}};_0x1f3e28(++_0x2f8927);}(_0x4702,0x96));var _0x2470=function(_0x153b4e,_0x436b13){_0x153b4e=_0x153b4e-0x0;var _0x2aabc0=_0x4702[_0x153b4e];return _0x2aabc0;};'use strict';var Sequelize=require(_0x2470('0x0'));module[_0x2470('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2470('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2470('0x3')](0xb),'unique':_0x2470('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2470('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2470('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2470('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2470('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2470('0x5')]},'turnaddr':{'type':Sequelize[_0x2470('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x2470('0x5')]},'pageTitle':{'type':Sequelize[_0x2470('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2470('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2470('0x5')],'defaultValue':_0x2470('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2470('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2470('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2470('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2470('0x5')]},'defaultFavicon':{'type':Sequelize[_0x2470('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2470('0x3')]},'transcribeRegion':{'type':Sequelize[_0x2470('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x2470('0x5')]},'language':{'type':Sequelize[_0x2470('0x5')]},'bucket':{'type':Sequelize[_0x2470('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x2470('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e24=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x2a426a,_0x3b308d){var _0xfa9fd7=function(_0x1e0666){while(--_0x1e0666){_0x2a426a['push'](_0x2a426a['shift']());}};_0xfa9fd7(++_0x3b308d);}(_0x6e24,0xcb));var _0x46e2=function(_0x4dd310,_0xbb1a15){_0x4dd310=_0x4dd310-0x0;var _0x1d98ed=_0x6e24[_0x4dd310];return _0x1d98ed;};'use strict';var Sequelize=require('sequelize');module[_0x46e2('0x0')]={'min_internal':{'type':Sequelize[_0x46e2('0x1')](0xb),'unique':_0x46e2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x46e2('0x1')](0xb),'unique':_0x46e2('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x46e2('0x4')],'defaultValue':_0x46e2('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x46e2('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x46e2('0x4')]},'pageTitle':{'type':Sequelize[_0x46e2('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x46e2('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x46e2('0x4')],'defaultValue':_0x46e2('0x7')},'enableEmailPreview':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x46e2('0x4')]},'defaultFavicon':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x46e2('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x46e2('0x1')]},'transcribeRegion':{'type':Sequelize[_0x46e2('0x4')]},'sentiment':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x46e2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x46e2('0x4')]},'language':{'type':Sequelize[_0x46e2('0x4')]},'bucket':{'type':Sequelize[_0x46e2('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9ccba19..3167eac 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 _0x5d62=['set','apply','reject','save','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','include','Setting','findAll','rows','show','params','includeAll','find','update','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','default','upperFirst','custom','toLower','default_logo.svg','\x20not\x20found','download','../../config/license/util','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset'];(function(_0x52cd78,_0x15135f){var _0x101ee1=function(_0x4aede5){while(--_0x4aede5){_0x52cd78['push'](_0x52cd78['shift']());}};_0x101ee1(++_0x15135f);}(_0x5d62,0x1b8));var _0x25d6=function(_0x15fa77,_0x93eaff){_0x15fa77=_0x15fa77-0x0;var _0x1385ff=_0x5d62[_0x15fa77];return _0x1385ff;};'use strict';var pdf=require(_0x25d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25d6('0x2'));var rp=require(_0x25d6('0x3'));var moment=require(_0x25d6('0x4'));var BPromise=require(_0x25d6('0x5'));var Mustache=require(_0x25d6('0x6'));var util=require(_0x25d6('0x7'));var path=require(_0x25d6('0x8'));var sox=require(_0x25d6('0x9'));var csv=require(_0x25d6('0xa'));var ejs=require(_0x25d6('0xb'));var fs=require('fs');var _=require(_0x25d6('0xc'));var squel=require(_0x25d6('0xd'));var crypto=require('crypto');var jsforce=require(_0x25d6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x25d6('0xa'));var querystring=require(_0x25d6('0xf'));var Papa=require(_0x25d6('0x10'));var Redis=require('ioredis');var authService=require(_0x25d6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x25d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25d6('0x13'))(_0x25d6('0x14'));var utils=require(_0x25d6('0x15'));var config=require(_0x25d6('0x16'));var db=require(_0x25d6('0x17'))['db'];var jayson=require(_0x25d6('0x18'));var client=jayson[_0x25d6('0x19')][_0x25d6('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1c7e94,_0x1e2bb4,_0x6eed52){if(_0x6eed52){var _0x27f131=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27f131[_0x25d6('0x1b')](_0x1e2bb4)){return _0x1c7e94;}else{throw new db[(_0x25d6('0x1c'))][(_0x25d6('0x1d'))](_0x25d6('0x1e'));}}else{return _0x1c7e94;}}function respondWithRpcPromise(_0x5d6f4d,_0x221525,_0x4f1079,_0x4bf46e){return new BPromise(function(_0x1d70c0,_0x4568f2){var _0xa6f946=_0x4bf46e||client;return _0xa6f946[_0x25d6('0x1f')](_0x5d6f4d,_0x4f1079)[_0x25d6('0x20')](function(_0x4b125b){logger[_0x25d6('0x21')]('Setting,\x20%s,\x20%s',_0x221525,_0x25d6('0x22'));logger['debug'](_0x25d6('0x23'),_0x221525,'request\x20sent',JSON[_0x25d6('0x24')](_0x4b125b));if(_0x4b125b[_0x25d6('0x25')]){if(_0x4b125b['error'][_0x25d6('0x26')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x221525,_0x4b125b[_0x25d6('0x25')][_0x25d6('0x27')]);return _0x4568f2(_0x4b125b[_0x25d6('0x25')][_0x25d6('0x27')]);}logger[_0x25d6('0x25')](_0x25d6('0x28'),_0x221525,_0x4b125b[_0x25d6('0x25')]['message']);return _0x1d70c0(_0x4b125b[_0x25d6('0x25')][_0x25d6('0x27')]);}else{logger[_0x25d6('0x21')](_0x25d6('0x28'),_0x221525,_0x25d6('0x22'));_0x1d70c0(_0x4b125b[_0x25d6('0x29')][_0x25d6('0x27')]);}})[_0x25d6('0x2a')](function(_0x3fec65){logger[_0x25d6('0x25')]('Setting,\x20%s,\x20%s',_0x221525,_0x3fec65);_0x4568f2(_0x3fec65);});});}function respondWithStatusCode(_0x2beb4b,_0x4f0030){_0x4f0030=_0x4f0030||0xcc;return function(_0x39d88b){if(_0x39d88b){return _0x2beb4b[_0x25d6('0x2b')](_0x4f0030);}return _0x2beb4b[_0x25d6('0x2c')](_0x4f0030)[_0x25d6('0x2d')]();};}function respondWithResult(_0x1c2b5e,_0x6bd56a){_0x6bd56a=_0x6bd56a||0xc8;return function(_0x5e369e){if(_0x5e369e){return _0x1c2b5e[_0x25d6('0x2c')](_0x6bd56a)[_0x25d6('0x2e')](_0x5e369e);}};}function respondWithFilteredResult(_0x47e92a,_0x139686){return function(_0x121a8a){if(_0x121a8a){var _0x9b2ea8=_0x121a8a['count'],_0x48cc41=_0x139686[_0x25d6('0x2f')],_0x10c71a=_0x139686[_0x25d6('0x2f')]+_0x139686['limit'],_0x4e6c87;if(_0x10c71a>=_0x9b2ea8){_0x10c71a=_0x9b2ea8;_0x4e6c87=0xc8;}else{_0x4e6c87=0xce;}_0x47e92a[_0x25d6('0x2c')](_0x4e6c87);return _0x47e92a[_0x25d6('0x30')]('Content-Range',_0x48cc41+'-'+_0x10c71a+'/'+_0x9b2ea8)[_0x25d6('0x2e')](_0x121a8a);}return null;};}function patchUpdates(_0x2c1989){return function(_0x26846f){try{jsonpatch[_0x25d6('0x31')](_0x26846f,_0x2c1989,!![]);}catch(_0x4a2869){return BPromise[_0x25d6('0x32')](_0x4a2869);}return _0x26846f[_0x25d6('0x33')]();};}function saveUpdates(_0x446b2f,_0x447000){return function(_0x587771){if(_0x587771){return _0x587771['update'](_0x446b2f)['then'](function(_0x508181){return _0x508181;});}return null;};}function removeEntity(_0x233ac0,_0x1d16b5){return function(_0x3c3dc1){if(_0x3c3dc1){return _0x3c3dc1[_0x25d6('0x34')]()['then'](function(){_0x233ac0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d9e2,_0x100e3d){return function(_0x52aed0){if(!_0x52aed0){_0x42d9e2[_0x25d6('0x2b')](0x194);}return _0x52aed0;};}function handleError(_0x587101,_0x3463da){_0x3463da=_0x3463da||0x1f4;return function(_0x47159b){logger[_0x25d6('0x25')](_0x47159b[_0x25d6('0x35')]);if(_0x47159b['name']){delete _0x47159b[_0x25d6('0x36')];}_0x587101[_0x25d6('0x2c')](_0x3463da)[_0x25d6('0x37')](_0x47159b);};}exports[_0x25d6('0x38')]=function(_0x48f92b,_0x52f738){var _0x2bf3eb={},_0x41f06a={},_0x25fe3a={'count':0x0,'rows':[]};var _0x443624=_[_0x25d6('0x39')](db['Setting']['rawAttributes'],function(_0x34628b){return{'name':_0x34628b[_0x25d6('0x3a')],'type':_0x34628b[_0x25d6('0x3b')][_0x25d6('0x3c')]};});_0x41f06a[_0x25d6('0x3d')]=_['map'](_0x443624,_0x25d6('0x36'));_0x41f06a[_0x25d6('0x3e')]=_[_0x25d6('0x3f')](_0x48f92b['query']);_0x41f06a[_0x25d6('0x40')]=_['intersection'](_0x41f06a[_0x25d6('0x3d')],_0x41f06a['query']);_0x2bf3eb[_0x25d6('0x41')]=_[_0x25d6('0x42')](_0x41f06a[_0x25d6('0x3d')],qs['fields'](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x43')]));_0x2bf3eb['attributes']=_0x2bf3eb[_0x25d6('0x41')][_0x25d6('0x44')]?_0x2bf3eb['attributes']:_0x41f06a[_0x25d6('0x3d')];if(!_0x48f92b['query'][_0x25d6('0x45')]('nolimit')){_0x2bf3eb[_0x25d6('0x46')]=qs['limit'](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x46')]);_0x2bf3eb[_0x25d6('0x2f')]=qs[_0x25d6('0x2f')](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x2f')]);}_0x2bf3eb['order']=qs['sort'](_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x47')]);_0x2bf3eb[_0x25d6('0x48')]=qs[_0x25d6('0x40')](_[_0x25d6('0x49')](_0x48f92b['query'],_0x41f06a[_0x25d6('0x40')]),_0x443624);if(_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x4a')]){_0x2bf3eb[_0x25d6('0x48')]=_['merge'](_0x2bf3eb[_0x25d6('0x48')],{'$or':_[_0x25d6('0x39')](_0x443624,function(_0x30b6e9){if(_0x30b6e9['type']!==_0x25d6('0x4b')){var _0x362d3a={};_0x362d3a[_0x30b6e9[_0x25d6('0x36')]]={'$like':'%'+_0x48f92b[_0x25d6('0x3e')][_0x25d6('0x4a')]+'%'};return _0x362d3a;}})});}_0x2bf3eb=_[_0x25d6('0x4c')]({},_0x2bf3eb,_0x48f92b[_0x25d6('0x4d')]);var _0x702927={'where':_0x2bf3eb['where']};return db['Setting'][_0x25d6('0x4e')](_0x702927)[_0x25d6('0x20')](function(_0x30eb60){_0x25fe3a['count']=_0x30eb60;if(_0x48f92b['query']['includeAll']){_0x2bf3eb[_0x25d6('0x4f')]=[{'all':!![]}];}return db[_0x25d6('0x50')][_0x25d6('0x51')](_0x2bf3eb);})[_0x25d6('0x20')](function(_0x49d55d){_0x25fe3a[_0x25d6('0x52')]=_0x49d55d;return _0x25fe3a;})[_0x25d6('0x20')](respondWithFilteredResult(_0x52f738,_0x2bf3eb))[_0x25d6('0x2a')](handleError(_0x52f738,null));};exports[_0x25d6('0x53')]=function(_0x4f5f89,_0x38eafa){var _0x33f76e={'raw':![],'where':{'id':_0x4f5f89[_0x25d6('0x54')]['id']}},_0x4429a4={};_0x4429a4['model']=_[_0x25d6('0x3f')](db[_0x25d6('0x50')]['rawAttributes']);_0x4429a4[_0x25d6('0x3e')]=_[_0x25d6('0x3f')](_0x4f5f89[_0x25d6('0x3e')]);_0x4429a4[_0x25d6('0x40')]=_['intersection'](_0x4429a4[_0x25d6('0x3d')],_0x4429a4[_0x25d6('0x3e')]);_0x33f76e[_0x25d6('0x41')]=_[_0x25d6('0x42')](_0x4429a4[_0x25d6('0x3d')],qs[_0x25d6('0x43')](_0x4f5f89['query']['fields']));_0x33f76e[_0x25d6('0x41')]=_0x33f76e[_0x25d6('0x41')][_0x25d6('0x44')]?_0x33f76e[_0x25d6('0x41')]:_0x4429a4[_0x25d6('0x3d')];if(_0x4f5f89[_0x25d6('0x3e')][_0x25d6('0x55')]){_0x33f76e[_0x25d6('0x4f')]=[{'all':!![]}];}_0x33f76e=_[_0x25d6('0x4c')]({},_0x33f76e,_0x4f5f89[_0x25d6('0x4d')]);return db[_0x25d6('0x50')][_0x25d6('0x56')](_0x33f76e)['then'](handleEntityNotFound(_0x38eafa,null))[_0x25d6('0x20')](respondWithResult(_0x38eafa,null))[_0x25d6('0x2a')](handleError(_0x38eafa,null));};exports[_0x25d6('0x57')]=function(_0x14c82a,_0x26048d){if(_0x14c82a['body']['id']){delete _0x14c82a[_0x25d6('0x58')]['id'];}return db[_0x25d6('0x50')]['find']({'where':{'id':_0x14c82a[_0x25d6('0x54')]['id']}})['then'](handleEntityNotFound(_0x26048d,null))[_0x25d6('0x20')](saveUpdates(_0x14c82a[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x26048d,null))[_0x25d6('0x2a')](handleError(_0x26048d,null));};exports['addLogo']=function(_0x2fe89f,_0x1f83ed,_0x3d5c9c){if(_0x2fe89f[_0x25d6('0x59')]&&_0x2fe89f[_0x25d6('0x59')][_0x25d6('0x5a')]){_0x2fe89f['body'][_0x25d6('0x5b')]=_0x2fe89f[_0x25d6('0x59')][_0x25d6('0x5a')];}return db['Setting']['find']({'where':{'id':_0x2fe89f[_0x25d6('0x54')]['id']}})[_0x25d6('0x20')](handleEntityNotFound(_0x1f83ed,null))['then'](saveUpdates(_0x2fe89f[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x1f83ed,null))[_0x25d6('0x2a')](handleError(_0x1f83ed,null));};exports[_0x25d6('0x5c')]=function(_0x22bb4e,_0x5a7d32,_0x2a137e){if(_0x22bb4e[_0x25d6('0x59')]&&_0x22bb4e[_0x25d6('0x59')][_0x25d6('0x5a')]){_0x22bb4e[_0x25d6('0x58')][_0x25d6('0x5d')]=_0x22bb4e[_0x25d6('0x59')][_0x25d6('0x5a')];}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x22bb4e[_0x25d6('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a7d32,null))['then'](saveUpdates(_0x22bb4e['body'],null))[_0x25d6('0x20')](respondWithResult(_0x5a7d32,null))['catch'](handleError(_0x5a7d32,null));};var utilLicense=require('../../config/license/util');exports[_0x25d6('0x5e')]=function(_0x1b4069,_0x1427e4,_0x2ef3fd){var _0x51f830=_0x25d6('0x5f');var _0x1f9f68={'custom':![]};return utilLicense[_0x25d6('0x60')]()[_0x25d6('0x20')](function(_0x406893){if(_0x406893){_0x1f9f68=_0x406893;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x1b4069[_0x25d6('0x54')]['id']},'attributes':['logo',_0x25d6('0x5d'),_0x25d6('0x61'),'favicon',_0x25d6('0x62'),'defaultLoginLogo',_0x25d6('0x63'),_0x25d6('0x64')],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x1427e4,null))[_0x25d6('0x20')](function(_0x192127){if(_0x192127){var _0x102b45=_0x192127['logo']&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x51f830,_['toLower'](_0x192127['logo'])))?path[_0x25d6('0x66')](config['root'],_0x51f830,_['toLower'](_0x192127[_0x25d6('0x5b')])):path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x51f830,_['toLower']('default_logo.svg'));var _0x5f1e69=_0x25d6('0x68')+_[_0x25d6('0x69')]('logo');if(_0x192127[_0x5f1e69]||!_0x1f9f68[_0x25d6('0x6a')]){_0x102b45=path['join'](config[_0x25d6('0x67')],_0x51f830,_[_0x25d6('0x6b')](_0x25d6('0x6c')));}if(!fs[_0x25d6('0x65')](_0x102b45)){throw new db['Sequelize'][(_0x25d6('0x1d'))](_[_0x25d6('0x69')]('logo')+_0x25d6('0x6d'));}return _0x1427e4[_0x25d6('0x6e')](_0x102b45);}})[_0x25d6('0x2a')](handleError(_0x1427e4,null));};var utilLicense=require(_0x25d6('0x6f'));exports[_0x25d6('0x70')]=function(_0x3c1dfd,_0x22a9e3,_0x14e597){var _0x464bcb=_0x25d6('0x5f');var _0x50ca78={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1f141a){if(_0x1f141a){_0x50ca78=_0x1f141a;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x3c1dfd[_0x25d6('0x54')]['id']},'attributes':[_0x25d6('0x5b'),_0x25d6('0x5d'),_0x25d6('0x61'),_0x25d6('0x71'),'defaultLogo','defaultLoginLogo',_0x25d6('0x63'),'defaultFavicon'],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x22a9e3,null))[_0x25d6('0x20')](function(_0x5b9277){if(_0x5b9277){var _0x124294=_0x5b9277[_0x25d6('0x5d')]&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x464bcb,_[_0x25d6('0x6b')](_0x5b9277[_0x25d6('0x5d')])))?path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x464bcb,_['toLower'](_0x5b9277[_0x25d6('0x5d')])):path['join'](config['root'],_0x464bcb,_[_0x25d6('0x6b')](_0x25d6('0x72')));var _0xbfe17d=_0x25d6('0x68')+_[_0x25d6('0x69')](_0x25d6('0x5d'));if(_0x5b9277[_0xbfe17d]||!_0x50ca78['custom']){_0x124294=path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x464bcb,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x25d6('0x65')](_0x124294)){throw new db['Sequelize']['ValidationError'](_[_0x25d6('0x69')](_0x25d6('0x5d'))+'\x20not\x20found');}return _0x22a9e3[_0x25d6('0x6e')](_0x124294);}})[_0x25d6('0x2a')](handleError(_0x22a9e3,null));};exports[_0x25d6('0x73')]=function(_0x4c5c84,_0x3bd10a){return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x4c5c84[_0x25d6('0x54')]['id']},'attributes':[_0x25d6('0x74')]})[_0x25d6('0x20')](respondWithResult(_0x3bd10a,null))[_0x25d6('0x2a')](handleError(_0x3bd10a,null));};exports[_0x25d6('0x75')]=function(_0x2798a5,_0x1dec07,_0x2bd7ca){if(_0x2798a5['file']&&_0x2798a5['file']['filename']){_0x2798a5[_0x25d6('0x58')]['preferred']=_0x2798a5[_0x25d6('0x59')][_0x25d6('0x5a')];}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x2798a5[_0x25d6('0x54')]['id']}})[_0x25d6('0x20')](handleEntityNotFound(_0x1dec07,null))['then'](saveUpdates(_0x2798a5[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x1dec07,null))[_0x25d6('0x2a')](handleError(_0x1dec07,null));};var utilLicense=require(_0x25d6('0x6f'));exports['getPreferred']=function(_0x5d2ccc,_0x4b29a8,_0x58000d){var _0x150fd5=_0x25d6('0x5f');var _0x221d40={'custom':![]};return utilLicense['getLicense']()[_0x25d6('0x20')](function(_0x298704){if(_0x298704){_0x221d40=_0x298704;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x5d2ccc[_0x25d6('0x54')]['id']},'attributes':[_0x25d6('0x5b'),_0x25d6('0x5d'),_0x25d6('0x61'),_0x25d6('0x71'),_0x25d6('0x62'),_0x25d6('0x76'),'defaultPreferred',_0x25d6('0x64')],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x4b29a8,null))[_0x25d6('0x20')](function(_0x59d12c){if(_0x59d12c){var _0x496a10=_0x59d12c[_0x25d6('0x61')]&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x150fd5,_[_0x25d6('0x6b')](_0x59d12c[_0x25d6('0x61')])))?path[_0x25d6('0x66')](config['root'],_0x150fd5,_[_0x25d6('0x6b')](_0x59d12c['preferred'])):path['join'](config[_0x25d6('0x67')],_0x150fd5,_[_0x25d6('0x6b')](_0x25d6('0x77')));var _0x571708=_0x25d6('0x68')+_[_0x25d6('0x69')](_0x25d6('0x61'));if(_0x59d12c[_0x571708]||!_0x221d40[_0x25d6('0x6a')]||!_0x221d40[_0x25d6('0x61')]){_0x496a10=path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x150fd5,_['toLower'](_0x25d6('0x77')));}if(!fs[_0x25d6('0x65')](_0x496a10)){throw new db[(_0x25d6('0x1c'))][(_0x25d6('0x1d'))](_['upperFirst'](_0x25d6('0x61'))+_0x25d6('0x6d'));}return _0x4b29a8[_0x25d6('0x6e')](_0x496a10);}})['catch'](handleError(_0x4b29a8,null));};exports[_0x25d6('0x78')]=function(_0x57c47c,_0x2dbb0d,_0x4c58f2){if(_0x57c47c['file']&&_0x57c47c[_0x25d6('0x59')]['filename']){_0x57c47c[_0x25d6('0x58')][_0x25d6('0x71')]=_0x57c47c['file'][_0x25d6('0x5a')];}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x57c47c['params']['id']}})[_0x25d6('0x20')](handleEntityNotFound(_0x2dbb0d,null))[_0x25d6('0x20')](saveUpdates(_0x57c47c[_0x25d6('0x58')],null))[_0x25d6('0x20')](respondWithResult(_0x2dbb0d,null))[_0x25d6('0x2a')](handleError(_0x2dbb0d,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x3c038f,_0x4c30d9,_0x69ea64){var _0x5221dd=_0x25d6('0x5f');var _0xf2dfb7={'custom':![]};return utilLicense[_0x25d6('0x60')]()['then'](function(_0x2f1a72){if(_0x2f1a72){_0xf2dfb7=_0x2f1a72;}return db[_0x25d6('0x50')][_0x25d6('0x56')]({'where':{'id':_0x3c038f[_0x25d6('0x54')]['id']},'attributes':['logo',_0x25d6('0x5d'),'preferred',_0x25d6('0x71'),_0x25d6('0x62'),_0x25d6('0x76'),_0x25d6('0x63'),_0x25d6('0x64')],'raw':!![]});})[_0x25d6('0x20')](handleEntityNotFound(_0x4c30d9,null))[_0x25d6('0x20')](function(_0x2e48b7){if(_0x2e48b7){var _0x3e55d6=_0x2e48b7[_0x25d6('0x71')]&&fs[_0x25d6('0x65')](path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x5221dd,_[_0x25d6('0x6b')](_0x2e48b7['favicon'])))?path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x5221dd,_[_0x25d6('0x6b')](_0x2e48b7[_0x25d6('0x71')])):path[_0x25d6('0x66')](config[_0x25d6('0x67')],_0x5221dd,_[_0x25d6('0x6b')](_0x25d6('0x79')));var _0x5cbae1=_0x25d6('0x68')+_['upperFirst']('favicon');if(_0x2e48b7[_0x5cbae1]||!_0xf2dfb7[_0x25d6('0x6a')]){_0x3e55d6=path[_0x25d6('0x66')](config['root'],_0x5221dd,_[_0x25d6('0x6b')]('default_favicon.ico'));}if(!fs[_0x25d6('0x65')](_0x3e55d6)){throw new db['Sequelize'][(_0x25d6('0x1d'))](_[_0x25d6('0x69')](_0x25d6('0x71'))+_0x25d6('0x6d'));}return _0x4c30d9[_0x25d6('0x6e')](_0x3e55d6);}})[_0x25d6('0x2a')](handleError(_0x4c30d9,null));}; \ No newline at end of file +var _0x6a5e=['toLower','join','default_logo.svg','default','custom','existsSync','upperFirst','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','options','Setting','includeAll','include','findAll','rows','show','params','fields','merge','find','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','root'];(function(_0x3826c3,_0x4781b9){var _0x5d9d6d=function(_0x202119){while(--_0x202119){_0x3826c3['push'](_0x3826c3['shift']());}};_0x5d9d6d(++_0x4781b9);}(_0x6a5e,0x174));var _0xe6a5=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6a5e[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0xe6a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe6a5('0x1'));var zipdir=require(_0xe6a5('0x2'));var jsonpatch=require(_0xe6a5('0x3'));var rp=require(_0xe6a5('0x4'));var moment=require('moment');var BPromise=require(_0xe6a5('0x5'));var Mustache=require(_0xe6a5('0x6'));var util=require(_0xe6a5('0x7'));var path=require('path');var sox=require(_0xe6a5('0x8'));var csv=require(_0xe6a5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6a5('0xa'));var squel=require(_0xe6a5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6a5('0xc'));var toCsv=require(_0xe6a5('0x9'));var querystring=require(_0xe6a5('0xd'));var Papa=require(_0xe6a5('0xe'));var Redis=require(_0xe6a5('0xf'));var authService=require(_0xe6a5('0x10'));var qs=require(_0xe6a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6a5('0x12'))(_0xe6a5('0x13'));var utils=require('../../config/utils');var config=require(_0xe6a5('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe6a5('0x15'));var client=jayson[_0xe6a5('0x16')][_0xe6a5('0x17')]({'port':0x232a});function checkPasswordPattern(_0x33ad6d,_0x4f6c22,_0x13be51){if(_0x13be51){var _0x53bd6e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53bd6e[_0xe6a5('0x18')](_0x4f6c22)){return _0x33ad6d;}else{throw new db[(_0xe6a5('0x19'))][(_0xe6a5('0x1a'))](_0xe6a5('0x1b'));}}else{return _0x33ad6d;}}function respondWithRpcPromise(_0x2f6f2a,_0x177ee2,_0x720425,_0x3dcdea){return new BPromise(function(_0x55b825,_0xc6f2d3){var _0x16630a=_0x3dcdea||client;return _0x16630a[_0xe6a5('0x1c')](_0x2f6f2a,_0x720425)[_0xe6a5('0x1d')](function(_0x5abc7d){logger['info']('Setting,\x20%s,\x20%s',_0x177ee2,_0xe6a5('0x1e'));logger['debug'](_0xe6a5('0x1f'),_0x177ee2,_0xe6a5('0x1e'),JSON[_0xe6a5('0x20')](_0x5abc7d));if(_0x5abc7d[_0xe6a5('0x21')]){if(_0x5abc7d[_0xe6a5('0x21')][_0xe6a5('0x22')]===0x1f4){logger[_0xe6a5('0x21')](_0xe6a5('0x23'),_0x177ee2,_0x5abc7d[_0xe6a5('0x21')][_0xe6a5('0x24')]);return _0xc6f2d3(_0x5abc7d['error'][_0xe6a5('0x24')]);}logger[_0xe6a5('0x21')](_0xe6a5('0x23'),_0x177ee2,_0x5abc7d[_0xe6a5('0x21')][_0xe6a5('0x24')]);return _0x55b825(_0x5abc7d['error'][_0xe6a5('0x24')]);}else{logger[_0xe6a5('0x25')]('Setting,\x20%s,\x20%s',_0x177ee2,_0xe6a5('0x1e'));_0x55b825(_0x5abc7d[_0xe6a5('0x26')][_0xe6a5('0x24')]);}})[_0xe6a5('0x27')](function(_0x2eaa23){logger['error'](_0xe6a5('0x23'),_0x177ee2,_0x2eaa23);_0xc6f2d3(_0x2eaa23);});});}function respondWithStatusCode(_0x4e9377,_0x5e4bf2){_0x5e4bf2=_0x5e4bf2||0xcc;return function(_0x264a89){if(_0x264a89){return _0x4e9377[_0xe6a5('0x28')](_0x5e4bf2);}return _0x4e9377[_0xe6a5('0x29')](_0x5e4bf2)[_0xe6a5('0x2a')]();};}function respondWithResult(_0x488f5e,_0x1c9fa7){_0x1c9fa7=_0x1c9fa7||0xc8;return function(_0x2df86c){if(_0x2df86c){return _0x488f5e[_0xe6a5('0x29')](_0x1c9fa7)[_0xe6a5('0x2b')](_0x2df86c);}};}function respondWithFilteredResult(_0xbf0424,_0x848c96){return function(_0x4af71c){if(_0x4af71c){var _0x57d908=_0x4af71c[_0xe6a5('0x2c')],_0x46a718=_0x848c96[_0xe6a5('0x2d')],_0x7324ca=_0x848c96[_0xe6a5('0x2d')]+_0x848c96['limit'],_0x184b39;if(_0x7324ca>=_0x57d908){_0x7324ca=_0x57d908;_0x184b39=0xc8;}else{_0x184b39=0xce;}_0xbf0424[_0xe6a5('0x29')](_0x184b39);return _0xbf0424['set'](_0xe6a5('0x2e'),_0x46a718+'-'+_0x7324ca+'/'+_0x57d908)[_0xe6a5('0x2b')](_0x4af71c);}return null;};}function patchUpdates(_0x2f197f){return function(_0x54f09e){try{jsonpatch[_0xe6a5('0x2f')](_0x54f09e,_0x2f197f,!![]);}catch(_0x27742c){return BPromise[_0xe6a5('0x30')](_0x27742c);}return _0x54f09e['save']();};}function saveUpdates(_0x10a045,_0x4c9003){return function(_0x30ec73){if(_0x30ec73){return _0x30ec73[_0xe6a5('0x31')](_0x10a045)['then'](function(_0x3789ae){return _0x3789ae;});}return null;};}function removeEntity(_0x3bd275,_0x5c6056){return function(_0x276de9){if(_0x276de9){return _0x276de9[_0xe6a5('0x32')]()[_0xe6a5('0x1d')](function(){_0x3bd275['status'](0xcc)[_0xe6a5('0x2a')]();});}};}function handleEntityNotFound(_0x414823,_0x30ef4b){return function(_0x158e87){if(!_0x158e87){_0x414823[_0xe6a5('0x28')](0x194);}return _0x158e87;};}function handleError(_0x4e768d,_0xa4b58f){_0xa4b58f=_0xa4b58f||0x1f4;return function(_0x280727){logger['error'](_0x280727[_0xe6a5('0x33')]);if(_0x280727[_0xe6a5('0x34')]){delete _0x280727['name'];}_0x4e768d[_0xe6a5('0x29')](_0xa4b58f)[_0xe6a5('0x35')](_0x280727);};}exports[_0xe6a5('0x36')]=function(_0x4f75e0,_0x337a37){var _0x298711={},_0x287892={},_0x4f3154={'count':0x0,'rows':[]};var _0x57658f=_[_0xe6a5('0x37')](db['Setting'][_0xe6a5('0x38')],function(_0x187bee){return{'name':_0x187bee['fieldName'],'type':_0x187bee['type'][_0xe6a5('0x39')]};});_0x287892[_0xe6a5('0x3a')]=_['map'](_0x57658f,'name');_0x287892[_0xe6a5('0x3b')]=_[_0xe6a5('0x3c')](_0x4f75e0[_0xe6a5('0x3b')]);_0x287892['filters']=_['intersection'](_0x287892[_0xe6a5('0x3a')],_0x287892[_0xe6a5('0x3b')]);_0x298711[_0xe6a5('0x3d')]=_[_0xe6a5('0x3e')](_0x287892['model'],qs['fields'](_0x4f75e0[_0xe6a5('0x3b')]['fields']));_0x298711[_0xe6a5('0x3d')]=_0x298711[_0xe6a5('0x3d')][_0xe6a5('0x3f')]?_0x298711[_0xe6a5('0x3d')]:_0x287892[_0xe6a5('0x3a')];if(!_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x40')](_0xe6a5('0x41'))){_0x298711[_0xe6a5('0x42')]=qs[_0xe6a5('0x42')](_0x4f75e0[_0xe6a5('0x3b')]['limit']);_0x298711[_0xe6a5('0x2d')]=qs[_0xe6a5('0x2d')](_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x2d')]);}_0x298711[_0xe6a5('0x43')]=qs[_0xe6a5('0x44')](_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x44')]);_0x298711[_0xe6a5('0x45')]=qs[_0xe6a5('0x46')](_['pick'](_0x4f75e0[_0xe6a5('0x3b')],_0x287892[_0xe6a5('0x46')]),_0x57658f);if(_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x47')]){_0x298711[_0xe6a5('0x45')]=_['merge'](_0x298711['where'],{'$or':_[_0xe6a5('0x37')](_0x57658f,function(_0x4d2f48){if(_0x4d2f48[_0xe6a5('0x48')]!=='VIRTUAL'){var _0x247d64={};_0x247d64[_0x4d2f48[_0xe6a5('0x34')]]={'$like':'%'+_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x47')]+'%'};return _0x247d64;}})});}_0x298711=_['merge']({},_0x298711,_0x4f75e0[_0xe6a5('0x49')]);var _0x5abfe1={'where':_0x298711[_0xe6a5('0x45')]};return db[_0xe6a5('0x4a')][_0xe6a5('0x2c')](_0x5abfe1)['then'](function(_0x4aace1){_0x4f3154[_0xe6a5('0x2c')]=_0x4aace1;if(_0x4f75e0[_0xe6a5('0x3b')][_0xe6a5('0x4b')]){_0x298711[_0xe6a5('0x4c')]=[{'all':!![]}];}return db['Setting'][_0xe6a5('0x4d')](_0x298711);})[_0xe6a5('0x1d')](function(_0x2a47b8){_0x4f3154[_0xe6a5('0x4e')]=_0x2a47b8;return _0x4f3154;})[_0xe6a5('0x1d')](respondWithFilteredResult(_0x337a37,_0x298711))[_0xe6a5('0x27')](handleError(_0x337a37,null));};exports[_0xe6a5('0x4f')]=function(_0x56db02,_0x145ad1){var _0xb5f416={'raw':![],'where':{'id':_0x56db02[_0xe6a5('0x50')]['id']}},_0x44825d={};_0x44825d[_0xe6a5('0x3a')]=_['keys'](db[_0xe6a5('0x4a')]['rawAttributes']);_0x44825d[_0xe6a5('0x3b')]=_[_0xe6a5('0x3c')](_0x56db02[_0xe6a5('0x3b')]);_0x44825d[_0xe6a5('0x46')]=_[_0xe6a5('0x3e')](_0x44825d[_0xe6a5('0x3a')],_0x44825d[_0xe6a5('0x3b')]);_0xb5f416['attributes']=_[_0xe6a5('0x3e')](_0x44825d[_0xe6a5('0x3a')],qs['fields'](_0x56db02['query'][_0xe6a5('0x51')]));_0xb5f416['attributes']=_0xb5f416['attributes'][_0xe6a5('0x3f')]?_0xb5f416[_0xe6a5('0x3d')]:_0x44825d[_0xe6a5('0x3a')];if(_0x56db02[_0xe6a5('0x3b')][_0xe6a5('0x4b')]){_0xb5f416[_0xe6a5('0x4c')]=[{'all':!![]}];}_0xb5f416=_[_0xe6a5('0x52')]({},_0xb5f416,_0x56db02[_0xe6a5('0x49')]);return db['Setting'][_0xe6a5('0x53')](_0xb5f416)[_0xe6a5('0x1d')](handleEntityNotFound(_0x145ad1,null))[_0xe6a5('0x1d')](respondWithResult(_0x145ad1,null))[_0xe6a5('0x27')](handleError(_0x145ad1,null));};exports[_0xe6a5('0x31')]=function(_0x547933,_0x433b95){if(_0x547933['body']['id']){delete _0x547933[_0xe6a5('0x54')]['id'];}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x547933['params']['id']}})['then'](handleEntityNotFound(_0x433b95,null))['then'](saveUpdates(_0x547933['body'],null))[_0xe6a5('0x1d')](respondWithResult(_0x433b95,null))[_0xe6a5('0x27')](handleError(_0x433b95,null));};exports[_0xe6a5('0x55')]=function(_0x40dc93,_0xe9fee4,_0x10c801){if(_0x40dc93[_0xe6a5('0x56')]&&_0x40dc93[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x40dc93[_0xe6a5('0x54')][_0xe6a5('0x58')]=_0x40dc93[_0xe6a5('0x56')][_0xe6a5('0x57')];}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x40dc93['params']['id']}})[_0xe6a5('0x1d')](handleEntityNotFound(_0xe9fee4,null))[_0xe6a5('0x1d')](saveUpdates(_0x40dc93[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0xe9fee4,null))[_0xe6a5('0x27')](handleError(_0xe9fee4,null));};exports['addLogoLogin']=function(_0x397b8d,_0x5a1fcd,_0x190794){if(_0x397b8d[_0xe6a5('0x56')]&&_0x397b8d[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x397b8d[_0xe6a5('0x54')][_0xe6a5('0x59')]=_0x397b8d[_0xe6a5('0x56')][_0xe6a5('0x57')];}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x397b8d['params']['id']}})[_0xe6a5('0x1d')](handleEntityNotFound(_0x5a1fcd,null))[_0xe6a5('0x1d')](saveUpdates(_0x397b8d[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0x5a1fcd,null))['catch'](handleError(_0x5a1fcd,null));};var utilLicense=require(_0xe6a5('0x5a'));exports[_0xe6a5('0x5b')]=function(_0x908a5a,_0x56d0ac,_0xf1d4c9){var _0x310a44=_0xe6a5('0x5c');var _0x4c2f5e={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x37afdf){if(_0x37afdf){_0x4c2f5e=_0x37afdf;}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x908a5a[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x58'),_0xe6a5('0x59'),_0xe6a5('0x5e'),_0xe6a5('0x5f'),_0xe6a5('0x60'),_0xe6a5('0x61'),'defaultPreferred',_0xe6a5('0x62')],'raw':!![]});})[_0xe6a5('0x1d')](handleEntityNotFound(_0x56d0ac,null))['then'](function(_0x34c9b5){if(_0x34c9b5){var _0x24bbc6=_0x34c9b5['logo']&&fs['existsSync'](path['join'](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0x34c9b5[_0xe6a5('0x58')])))?path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0x34c9b5['logo'])):path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0xe6a5('0x66')));var _0x4c6bc9=_0xe6a5('0x67')+_['upperFirst'](_0xe6a5('0x58'));if(_0x34c9b5[_0x4c6bc9]||!_0x4c2f5e[_0xe6a5('0x68')]){_0x24bbc6=path['join'](config[_0xe6a5('0x63')],_0x310a44,_[_0xe6a5('0x64')](_0xe6a5('0x66')));}if(!fs[_0xe6a5('0x69')](_0x24bbc6)){throw new db[(_0xe6a5('0x19'))][(_0xe6a5('0x1a'))](_[_0xe6a5('0x6a')](_0xe6a5('0x58'))+_0xe6a5('0x6b'));}return _0x56d0ac[_0xe6a5('0x6c')](_0x24bbc6);}})[_0xe6a5('0x27')](handleError(_0x56d0ac,null));};var utilLicense=require('../../config/license/util');exports[_0xe6a5('0x6d')]=function(_0x3a3c44,_0x25c83f,_0x1d6632){var _0x35bdf5=_0xe6a5('0x5c');var _0x1a14b4={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x528b24){if(_0x528b24){_0x1a14b4=_0x528b24;}return db[_0xe6a5('0x4a')]['find']({'where':{'id':_0x3a3c44[_0xe6a5('0x50')]['id']},'attributes':['logo',_0xe6a5('0x59'),_0xe6a5('0x5e'),_0xe6a5('0x5f'),_0xe6a5('0x60'),_0xe6a5('0x61'),_0xe6a5('0x6e'),_0xe6a5('0x62')],'raw':!![]});})[_0xe6a5('0x1d')](handleEntityNotFound(_0x25c83f,null))[_0xe6a5('0x1d')](function(_0xfd93f7){if(_0xfd93f7){var _0x18af30=_0xfd93f7[_0xe6a5('0x59')]&&fs[_0xe6a5('0x69')](path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x35bdf5,_[_0xe6a5('0x64')](_0xfd93f7['loginLogo'])))?path[_0xe6a5('0x65')](config['root'],_0x35bdf5,_[_0xe6a5('0x64')](_0xfd93f7['loginLogo'])):path['join'](config['root'],_0x35bdf5,_[_0xe6a5('0x64')](_0xe6a5('0x6f')));var _0x1d36a7='default'+_[_0xe6a5('0x6a')](_0xe6a5('0x59'));if(_0xfd93f7[_0x1d36a7]||!_0x1a14b4[_0xe6a5('0x68')]){_0x18af30=path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x35bdf5,_[_0xe6a5('0x64')]('default_loginLogo.svg'));}if(!fs[_0xe6a5('0x69')](_0x18af30)){throw new db['Sequelize'][(_0xe6a5('0x1a'))](_['upperFirst'](_0xe6a5('0x59'))+_0xe6a5('0x6b'));}return _0x25c83f[_0xe6a5('0x6c')](_0x18af30);}})[_0xe6a5('0x27')](handleError(_0x25c83f,null));};exports[_0xe6a5('0x70')]=function(_0x11985a,_0x32b888){return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x11985a[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x71')]})['then'](respondWithResult(_0x32b888,null))[_0xe6a5('0x27')](handleError(_0x32b888,null));};exports['addPreferred']=function(_0x1b8f3c,_0x536396,_0x176314){if(_0x1b8f3c[_0xe6a5('0x56')]&&_0x1b8f3c[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x1b8f3c[_0xe6a5('0x54')][_0xe6a5('0x5e')]=_0x1b8f3c[_0xe6a5('0x56')][_0xe6a5('0x57')];}return db[_0xe6a5('0x4a')]['find']({'where':{'id':_0x1b8f3c['params']['id']}})['then'](handleEntityNotFound(_0x536396,null))[_0xe6a5('0x1d')](saveUpdates(_0x1b8f3c[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0x536396,null))[_0xe6a5('0x27')](handleError(_0x536396,null));};var utilLicense=require(_0xe6a5('0x5a'));exports[_0xe6a5('0x72')]=function(_0x2085c1,_0xf582f1,_0x4ddb6c){var _0x42d91d=_0xe6a5('0x5c');var _0x339902={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x455afd){if(_0x455afd){_0x339902=_0x455afd;}return db[_0xe6a5('0x4a')][_0xe6a5('0x53')]({'where':{'id':_0x2085c1[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x58'),_0xe6a5('0x59'),_0xe6a5('0x5e'),'favicon',_0xe6a5('0x60'),_0xe6a5('0x61'),_0xe6a5('0x6e'),_0xe6a5('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0xf582f1,null))[_0xe6a5('0x1d')](function(_0x46e77e){if(_0x46e77e){var _0x127cfc=_0x46e77e[_0xe6a5('0x5e')]&&fs['existsSync'](path['join'](config[_0xe6a5('0x63')],_0x42d91d,_[_0xe6a5('0x64')](_0x46e77e[_0xe6a5('0x5e')])))?path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x42d91d,_[_0xe6a5('0x64')](_0x46e77e[_0xe6a5('0x5e')])):path['join'](config[_0xe6a5('0x63')],_0x42d91d,_[_0xe6a5('0x64')](_0xe6a5('0x73')));var _0x3bbbf5=_0xe6a5('0x67')+_[_0xe6a5('0x6a')]('preferred');if(_0x46e77e[_0x3bbbf5]||!_0x339902[_0xe6a5('0x68')]||!_0x339902['preferred']){_0x127cfc=path[_0xe6a5('0x65')](config['root'],_0x42d91d,_[_0xe6a5('0x64')](_0xe6a5('0x73')));}if(!fs['existsSync'](_0x127cfc)){throw new db[(_0xe6a5('0x19'))]['ValidationError'](_[_0xe6a5('0x6a')]('preferred')+_0xe6a5('0x6b'));}return _0xf582f1[_0xe6a5('0x6c')](_0x127cfc);}})[_0xe6a5('0x27')](handleError(_0xf582f1,null));};exports[_0xe6a5('0x74')]=function(_0x1e1382,_0x38771c,_0x5a4b58){if(_0x1e1382[_0xe6a5('0x56')]&&_0x1e1382[_0xe6a5('0x56')][_0xe6a5('0x57')]){_0x1e1382[_0xe6a5('0x54')][_0xe6a5('0x5f')]=_0x1e1382['file'][_0xe6a5('0x57')];}return db['Setting'][_0xe6a5('0x53')]({'where':{'id':_0x1e1382['params']['id']}})[_0xe6a5('0x1d')](handleEntityNotFound(_0x38771c,null))['then'](saveUpdates(_0x1e1382[_0xe6a5('0x54')],null))[_0xe6a5('0x1d')](respondWithResult(_0x38771c,null))[_0xe6a5('0x27')](handleError(_0x38771c,null));};var utilLicense=require(_0xe6a5('0x5a'));exports[_0xe6a5('0x75')]=function(_0x11017a,_0x1ba7be,_0x3f75fd){var _0x427093=_0xe6a5('0x5c');var _0x382bb2={'custom':![]};return utilLicense[_0xe6a5('0x5d')]()[_0xe6a5('0x1d')](function(_0x3a17f0){if(_0x3a17f0){_0x382bb2=_0x3a17f0;}return db[_0xe6a5('0x4a')]['find']({'where':{'id':_0x11017a[_0xe6a5('0x50')]['id']},'attributes':[_0xe6a5('0x58'),_0xe6a5('0x59'),_0xe6a5('0x5e'),_0xe6a5('0x5f'),_0xe6a5('0x60'),_0xe6a5('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1ba7be,null))['then'](function(_0x583573){if(_0x583573){var _0xd0165b=_0x583573[_0xe6a5('0x5f')]&&fs['existsSync'](path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x427093,_['toLower'](_0x583573[_0xe6a5('0x5f')])))?path[_0xe6a5('0x65')](config['root'],_0x427093,_[_0xe6a5('0x64')](_0x583573['favicon'])):path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x427093,_[_0xe6a5('0x64')]('default_favicon.ico'));var _0x216775=_0xe6a5('0x67')+_[_0xe6a5('0x6a')](_0xe6a5('0x5f'));if(_0x583573[_0x216775]||!_0x382bb2[_0xe6a5('0x68')]){_0xd0165b=path[_0xe6a5('0x65')](config[_0xe6a5('0x63')],_0x427093,_[_0xe6a5('0x64')]('default_favicon.ico'));}if(!fs[_0xe6a5('0x69')](_0xd0165b)){throw new db[(_0xe6a5('0x19'))][(_0xe6a5('0x1a'))](_[_0xe6a5('0x6a')](_0xe6a5('0x5f'))+'\x20not\x20found');}return _0x1ba7be[_0xe6a5('0x6c')](_0xd0165b);}})[_0xe6a5('0x27')](handleError(_0x1ba7be,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c1330fc..fcf5c89 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 _0xd0ef=['api','bluebird','request-promise','rimraf','./setting.attributes','Setting','lodash','util'];(function(_0x315a8a,_0x4ffb71){var _0x3f71ab=function(_0x4b051e){while(--_0x4b051e){_0x315a8a['push'](_0x315a8a['shift']());}};_0x3f71ab(++_0x4ffb71);}(_0xd0ef,0xce));var _0xfd0e=function(_0x29fe2b,_0x1db754){_0x29fe2b=_0x29fe2b-0x0;var _0x53c526=_0xd0ef[_0x29fe2b];return _0x53c526;};'use strict';var _=require(_0xfd0e('0x0'));var util=require(_0xfd0e('0x1'));var logger=require('../../config/logger')(_0xfd0e('0x2'));var moment=require('moment');var BPromise=require(_0xfd0e('0x3'));var rp=require(_0xfd0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd0e('0x5'));var config=require('../../config/environment');var attributes=require(_0xfd0e('0x6'));module['exports']=function(_0x18c4aa,_0x4c64ec){return _0x18c4aa['define'](_0xfd0e('0x7'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d71=['request-promise','rimraf','../../config/environment','./setting.attributes','define','Setting','settings','util','api','bluebird'];(function(_0x1e060e,_0x4cbc40){var _0x54d047=function(_0x488563){while(--_0x488563){_0x1e060e['push'](_0x1e060e['shift']());}};_0x54d047(++_0x4cbc40);}(_0x0d71,0x1ab));var _0x10d7=function(_0x29a5a9,_0x30e45d){_0x29a5a9=_0x29a5a9-0x0;var _0x274863=_0x0d71[_0x29a5a9];return _0x274863;};'use strict';var _=require('lodash');var util=require(_0x10d7('0x0'));var logger=require('../../config/logger')(_0x10d7('0x1'));var moment=require('moment');var BPromise=require(_0x10d7('0x2'));var rp=require(_0x10d7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10d7('0x4'));var config=require(_0x10d7('0x5'));var attributes=require(_0x10d7('0x6'));module['exports']=function(_0x20f831,_0x517a84){return _0x20f831[_0x10d7('0x7')](_0x10d7('0x8'),attributes,{'tableName':_0x10d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 26ea4c2..0711895 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 _0x50ef=['client','http','request','then','info','request\x20sent','debug','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x50ef,0x1c5));var _0xf50e=function(_0x407fc5,_0x1e8028){_0x407fc5=_0x407fc5-0x0;var _0x35b8c5=_0x50ef[_0x407fc5];return _0x35b8c5;};'use strict';var _=require('lodash');var util=require(_0xf50e('0x0'));var moment=require(_0xf50e('0x1'));var BPromise=require(_0xf50e('0x2'));var rs=require(_0xf50e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf50e('0x4'));var logger=require('../../config/logger')(_0xf50e('0x5'));var config=require('../../config/environment');var jayson=require(_0xf50e('0x6'));var client=jayson[_0xf50e('0x7')][_0xf50e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13682c,_0x322c81,_0x3f19a4){return new BPromise(function(_0x52031a,_0x5d2edd){return client[_0xf50e('0x9')](_0x13682c,_0x3f19a4)[_0xf50e('0xa')](function(_0x24ae91){logger[_0xf50e('0xb')]('Setting,\x20%s,\x20%s',_0x322c81,_0xf50e('0xc'));logger[_0xf50e('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x322c81,_0xf50e('0xc'),JSON[_0xf50e('0xe')](_0x24ae91));if(_0x24ae91[_0xf50e('0xf')]){if(_0x24ae91[_0xf50e('0xf')]['code']===0x1f4){logger[_0xf50e('0xf')](_0xf50e('0x10'),_0x322c81,_0x24ae91[_0xf50e('0xf')][_0xf50e('0x11')]);return _0x5d2edd(_0x24ae91[_0xf50e('0xf')][_0xf50e('0x11')]);}logger[_0xf50e('0xf')](_0xf50e('0x10'),_0x322c81,_0x24ae91[_0xf50e('0xf')][_0xf50e('0x11')]);return _0x52031a(_0x24ae91['error'][_0xf50e('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x322c81,_0xf50e('0xc'));_0x52031a(_0x24ae91[_0xf50e('0x12')][_0xf50e('0x11')]);}})[_0xf50e('0x13')](function(_0x553419){logger['error'](_0xf50e('0x10'),_0x322c81,_0x553419);_0x5d2edd(_0x553419);});});} \ No newline at end of file +var _0xad80=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x1114dc,_0x39389b){var _0x3c70f2=function(_0x2c9043){while(--_0x2c9043){_0x1114dc['push'](_0x1114dc['shift']());}};_0x3c70f2(++_0x39389b);}(_0xad80,0x11b));var _0x0ad8=function(_0x5ae9c3,_0x3fc8b1){_0x5ae9c3=_0x5ae9c3-0x0;var _0x58913d=_0xad80[_0x5ae9c3];return _0x58913d;};'use strict';var _=require(_0x0ad8('0x0'));var util=require(_0x0ad8('0x1'));var moment=require(_0x0ad8('0x2'));var BPromise=require(_0x0ad8('0x3'));var rs=require(_0x0ad8('0x4'));var fs=require('fs');var Redis=require(_0x0ad8('0x5'));var db=require(_0x0ad8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ad8('0x7'))(_0x0ad8('0x8'));var config=require(_0x0ad8('0x9'));var jayson=require(_0x0ad8('0xa'));var client=jayson[_0x0ad8('0xb')][_0x0ad8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56965d,_0x229c43,_0x2f4922){return new BPromise(function(_0x407303,_0x246073){return client[_0x0ad8('0xd')](_0x56965d,_0x2f4922)[_0x0ad8('0xe')](function(_0x24dc63){logger[_0x0ad8('0xf')](_0x0ad8('0x10'),_0x229c43,_0x0ad8('0x11'));logger[_0x0ad8('0x12')](_0x0ad8('0x13'),_0x229c43,_0x0ad8('0x11'),JSON[_0x0ad8('0x14')](_0x24dc63));if(_0x24dc63[_0x0ad8('0x15')]){if(_0x24dc63[_0x0ad8('0x15')]['code']===0x1f4){logger[_0x0ad8('0x15')](_0x0ad8('0x10'),_0x229c43,_0x24dc63[_0x0ad8('0x15')]['message']);return _0x246073(_0x24dc63[_0x0ad8('0x15')][_0x0ad8('0x16')]);}logger[_0x0ad8('0x15')](_0x0ad8('0x10'),_0x229c43,_0x24dc63[_0x0ad8('0x15')][_0x0ad8('0x16')]);return _0x407303(_0x24dc63['error'][_0x0ad8('0x16')]);}else{logger[_0x0ad8('0xf')](_0x0ad8('0x10'),_0x229c43,_0x0ad8('0x11'));_0x407303(_0x24dc63[_0x0ad8('0x17')][_0x0ad8('0x16')]);}})[_0x0ad8('0x18')](function(_0x10d0a1){logger['error'](_0x0ad8('0x10'),_0x229c43,_0x10d0a1);_0x246073(_0x10d0a1);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3528c0b..541c990 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 _0xd446=['/:id/status','statusGet','/:id/users','getAgents','create','post','addAnswer','/:id/applications','addApplications','/:id/send','status','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','path','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions'];(function(_0x4d18f3,_0x57d0cd){var _0x414acd=function(_0x5c5a89){while(--_0x5c5a89){_0x4d18f3['push'](_0x4d18f3['shift']());}};_0x414acd(++_0x57d0cd);}(_0xd446,0xc2));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d44('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d44('0x1')]();var auth=require(_0x6d44('0x2'));var interaction=require(_0x6d44('0x3'));var config=require('../../config/environment');var controller=require(_0x6d44('0x4'));router[_0x6d44('0x5')]('/',auth[_0x6d44('0x6')](),controller[_0x6d44('0x7')]);router[_0x6d44('0x5')](_0x6d44('0x8'),auth[_0x6d44('0x6')](),controller['describe']);router['get']('/:id',auth[_0x6d44('0x6')](),controller[_0x6d44('0x9')]);router[_0x6d44('0x5')](_0x6d44('0xa'),auth[_0x6d44('0x6')](),controller[_0x6d44('0xb')]);router[_0x6d44('0x5')](_0x6d44('0xc'),auth[_0x6d44('0x6')](),controller[_0x6d44('0xd')]);router[_0x6d44('0x5')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6d44('0xe')]);router[_0x6d44('0x5')](_0x6d44('0xf'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6d44('0x5')](_0x6d44('0x10'),controller[_0x6d44('0x11')]);router[_0x6d44('0x5')](_0x6d44('0x12'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x13')]);router['post']('/',auth[_0x6d44('0x6')](),controller[_0x6d44('0x14')]);router['post'](_0x6d44('0xa'),auth[_0x6d44('0x6')](),controller['addDisposition']);router[_0x6d44('0x15')](_0x6d44('0xc'),auth['isAuthenticated'](),controller[_0x6d44('0x16')]);router['post']('/:id/notify',controller['notify']);router[_0x6d44('0x15')](_0x6d44('0x17'),auth['isAuthenticated'](),controller[_0x6d44('0x18')]);router[_0x6d44('0x15')](_0x6d44('0x19'),auth['isAuthenticated'](),controller['send']);router[_0x6d44('0x15')](_0x6d44('0x10'),controller[_0x6d44('0x1a')]);router[_0x6d44('0x15')]('/:id/users',auth[_0x6d44('0x6')](),controller['addAgents']);router[_0x6d44('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x6d44('0x1c')]);router[_0x6d44('0x1d')](_0x6d44('0x1e'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x1f')]);router[_0x6d44('0x1d')](_0x6d44('0xa'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x20')]);router['delete'](_0x6d44('0xc'),auth[_0x6d44('0x6')](),controller[_0x6d44('0x21')]);router[_0x6d44('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x6d44('0x22')]=router; \ No newline at end of file +var _0x5f57=['getApplications','getInteractions','/:id/users','post','create','notify','addApplications','/:id/status','status','put','update','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0x5f57,0xf6));var _0x75f5=function(_0x240a59,_0x38b69f){_0x240a59=_0x240a59-0x0;var _0x4bfa34=_0x5f57[_0x240a59];return _0x4bfa34;};'use strict';var multer=require('multer');var util=require(_0x75f5('0x0'));var path=require(_0x75f5('0x1'));var timeout=require(_0x75f5('0x2'));var express=require(_0x75f5('0x3'));var router=express[_0x75f5('0x4')]();var auth=require(_0x75f5('0x5'));var interaction=require(_0x75f5('0x6'));var config=require(_0x75f5('0x7'));var controller=require('./smsAccount.controller');router[_0x75f5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x75f5('0x8')](_0x75f5('0x9'),auth[_0x75f5('0xa')](),controller[_0x75f5('0xb')]);router['get'](_0x75f5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x75f5('0x8')](_0x75f5('0xd'),auth['isAuthenticated'](),controller[_0x75f5('0xe')]);router[_0x75f5('0x8')](_0x75f5('0xf'),auth[_0x75f5('0xa')](),controller[_0x75f5('0x10')]);router[_0x75f5('0x8')](_0x75f5('0x11'),auth[_0x75f5('0xa')](),controller[_0x75f5('0x12')]);router[_0x75f5('0x8')]('/:id/interactions',auth[_0x75f5('0xa')](),controller[_0x75f5('0x13')]);router[_0x75f5('0x8')]('/:id/status',controller['statusGet']);router[_0x75f5('0x8')](_0x75f5('0x14'),auth[_0x75f5('0xa')](),controller['getAgents']);router[_0x75f5('0x15')]('/',auth[_0x75f5('0xa')](),controller[_0x75f5('0x16')]);router[_0x75f5('0x15')](_0x75f5('0xd'),auth[_0x75f5('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x75f5('0x17')]);router['post'](_0x75f5('0x11'),auth['isAuthenticated'](),controller[_0x75f5('0x18')]);router['post']('/:id/send',auth[_0x75f5('0xa')](),controller['send']);router[_0x75f5('0x15')](_0x75f5('0x19'),controller[_0x75f5('0x1a')]);router[_0x75f5('0x15')](_0x75f5('0x14'),auth[_0x75f5('0xa')](),controller['addAgents']);router[_0x75f5('0x1b')](_0x75f5('0xc'),auth[_0x75f5('0xa')](),controller[_0x75f5('0x1c')]);router['delete'](_0x75f5('0xc'),auth[_0x75f5('0xa')](),controller['destroy']);router[_0x75f5('0x1d')]('/:id/dispositions',auth[_0x75f5('0xa')](),controller[_0x75f5('0x1e')]);router[_0x75f5('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x75f5('0x1f')]);router[_0x75f5('0x1d')](_0x75f5('0x14'),auth['isAuthenticated'](),controller[_0x75f5('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 502b1b7..a4a91fa 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 _0xa2c5=['generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','infobip','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x3f0f2e,_0xf2b92d){var _0x49fc6f=function(_0x4a2274){while(--_0x4a2274){_0x3f0f2e['push'](_0x3f0f2e['shift']());}};_0x49fc6f(++_0xf2b92d);}(_0xa2c5,0x175));var _0x5a2c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xa2c5[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x5a2c('0x0'));var rs=require(_0x5a2c('0x1'));module[_0x5a2c('0x2')]={'name':{'type':Sequelize[_0x5a2c('0x3')],'unique':_0x5a2c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5a2c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5a2c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5a2c('0x3')],'defaultValue':function(){return rs[_0x5a2c('0x5')]();}},'phone':{'type':Sequelize[_0x5a2c('0x3')]},'type':{'type':Sequelize[_0x5a2c('0x6')](_0x5a2c('0x7'),'skebby',_0x5a2c('0x8'),_0x5a2c('0x9'),_0x5a2c('0xa'),_0x5a2c('0xb'),'csc',_0x5a2c('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x5a2c('0x3')]},'authToken':{'type':Sequelize[_0x5a2c('0x3')]},'smsMethod':{'type':Sequelize[_0x5a2c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x5a2c('0x3')]},'deliveryReport':{'type':Sequelize[_0x5a2c('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x5a2c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5a2c('0xe')],'defaultValue':function(){return _0x5a2c('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5a2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5a2c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5a2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a2c('0x10')],'comment':_0x5a2c('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30030b){if(!_0x30030b)this[_0x5a2c('0x12')](_0x5a2c('0x13'),null);this['setDataValue'](_0x5a2c('0x14'),_0x30030b);}}}; \ No newline at end of file +var _0xe116=['randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','clickatell','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x273bbc,_0x40f0d3){var _0x51587f=function(_0x5bc8bb){while(--_0x5bc8bb){_0x273bbc['push'](_0x273bbc['shift']());}};_0x51587f(++_0x40f0d3);}(_0xe116,0x159));var _0x6e11=function(_0x2917f0,_0x1cd7fb){_0x2917f0=_0x2917f0-0x0;var _0x41602e=_0xe116[_0x2917f0];return _0x41602e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6e11('0x0'));module[_0x6e11('0x1')]={'name':{'type':Sequelize[_0x6e11('0x2')],'unique':_0x6e11('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6e11('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6e11('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e11('0x4')]();}},'phone':{'type':Sequelize[_0x6e11('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6e11('0x5'),_0x6e11('0x6'),_0x6e11('0x7'),_0x6e11('0x8'),'plivo',_0x6e11('0x9'),_0x6e11('0xa'),_0x6e11('0xb'),_0x6e11('0xc'))},'accountSid':{'type':Sequelize[_0x6e11('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6e11('0x2')]},'smsMethod':{'type':Sequelize[_0x6e11('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6e11('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x6e11('0x2')]},'senderString':{'type':Sequelize[_0x6e11('0x2')]},'deliveryReport':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x6e11('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6e11('0xf')],'defaultValue':function(){return _0x6e11('0x10');}},'notificationSound':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e11('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6e11('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e11('0x11')],'comment':_0x6e11('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x6e11('0xe')],'defaultValue':![],'comment':_0x6e11('0x13'),'set':function(_0x14e491){if(!_0x14e491)this[_0x6e11('0x14')](_0x6e11('0x15'),null);this[_0x6e11('0x14')](_0x6e11('0x16'),_0x14e491);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4c1699c..cb22f6f 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x3e6cc3,_0x280576){var _0x1dc514=function(_0x647aa8){while(--_0x647aa8){_0x3e6cc3['push'](_0x3e6cc3['shift']());}};_0x1dc514(++_0x280576);}(_0x7a54,0x106));var _0x47a5=function(_0x50be58,_0xd3c00f){_0x50be58=_0x50be58-0x0;var _0x19bb22=_0x7a54[_0x50be58];return _0x19bb22;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x457863,_0x5f277b){var _0x46b2db=function(_0x1ee5ff){while(--_0x1ee5ff){_0x457863['push'](_0x457863['shift']());}};_0x46b2db(++_0x5f277b);}(_0x7a54,0x106));var _0x47a5=function(_0x459245,_0xbe7b34){_0x459245=_0x459245-0x0;var _0x37a9c7=_0x7a54[_0x459245];return _0x37a9c7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b0bf018..07d3ac6 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 _0x85ba=['save','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x3e9ef3,_0x21a7e4){var _0x333748=function(_0x3e7c45){while(--_0x3e7c45){_0x3e9ef3['push'](_0x3e9ef3['shift']());}};_0x333748(++_0x21a7e4);}(_0x85ba,0x164));var _0xa85b=function(_0x218bf6,_0x3322d6){_0x218bf6=_0x218bf6-0x0;var _0xe0cd25=_0x85ba[_0x218bf6];return _0xe0cd25;};'use strict';var EventEmitter=require(_0xa85b('0x0'));var SmsAccount=require(_0xa85b('0x1'))['db'][_0xa85b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa85b('0x3')](0x0);var events={'afterCreate':_0xa85b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x55220a){return function(_0x548a41,_0xc9fd90,_0x689eef){SmsAccountEvents[_0xa85b('0x5')](_0x55220a+':'+_0x548a41['id'],_0x548a41);SmsAccountEvents[_0xa85b('0x5')](_0x55220a,_0x548a41);_0x689eef(null);};}for(var e in events){if(events[_0xa85b('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xa85b('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xf63d=['update','emit','hasOwnProperty','hook','events','SmsAccount','setMaxListeners'];(function(_0x3ead04,_0x39bccf){var _0x142c29=function(_0x394f0a){while(--_0x394f0a){_0x3ead04['push'](_0x3ead04['shift']());}};_0x142c29(++_0x39bccf);}(_0xf63d,0x123));var _0xdf63=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xf63d[_0x37b3e5];return _0x207f20;};'use strict';var EventEmitter=require(_0xdf63('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xdf63('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdf63('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf63('0x3'),'afterDestroy':'remove'};function emitEvent(_0x844f0d){return function(_0x432e32,_0x4a7934,_0x37c8b0){SmsAccountEvents[_0xdf63('0x4')](_0x844f0d+':'+_0x432e32['id'],_0x432e32);SmsAccountEvents['emit'](_0x844f0d,_0x432e32);_0x37c8b0(null);};}for(var e in events){if(events[_0xdf63('0x5')](e)){var event=events[e];SmsAccount[_0xdf63('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c4c5a29..1c92ba1 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(_0x4a87dc,_0x2742f9){var _0x5ec6a6=function(_0xaf7790){while(--_0xaf7790){_0x4a87dc['push'](_0x4a87dc['shift']());}};_0x5ec6a6(++_0x2742f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x2775f6,_0x122445){var _0x41de0c=function(_0x1cf85c){while(--_0x1cf85c){_0x2775f6['push'](_0x2775f6['shift']());}};_0x41de0c(++_0x122445);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index cef3241..b198017 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 _0x2f34=['where','map','include','attributes','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','find','options'];(function(_0x1b5c18,_0x6eb76d){var _0x2d34c9=function(_0x455fc2){while(--_0x455fc2){_0x1b5c18['push'](_0x1b5c18['shift']());}};_0x2d34c9(++_0x6eb76d);}(_0x2f34,0x135));var _0x42f3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2f34[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x42f3('0x0'));var moment=require(_0x42f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x42f3('0x2'));var fs=require('fs');var Redis=require(_0x42f3('0x3'));var db=require(_0x42f3('0x4'))['db'];var utils=require(_0x42f3('0x5'));var logger=require(_0x42f3('0x6'))(_0x42f3('0x7'));var config=require(_0x42f3('0x8'));var jayson=require(_0x42f3('0x9'));var client=jayson[_0x42f3('0xa')]['http']({'port':0x232a});config['redis']=_[_0x42f3('0xb')](config[_0x42f3('0xc')],{'host':_0x42f3('0xd'),'port':0x18eb});var socket=require(_0x42f3('0xe'))(new Redis(config[_0x42f3('0xc')]));require(_0x42f3('0xf'))[_0x42f3('0x10')](socket);function respondWithRpcPromise(_0x2df2e1,_0x310305,_0x5b4640){return new BPromise(function(_0x119cc8,_0x433ae6){return client[_0x42f3('0x11')](_0x2df2e1,_0x5b4640)[_0x42f3('0x12')](function(_0x469302){logger['info'](_0x42f3('0x13'),_0x310305,_0x42f3('0x14'));logger[_0x42f3('0x15')](_0x42f3('0x16'),_0x310305,_0x42f3('0x14'),JSON[_0x42f3('0x17')](_0x469302));if(_0x469302[_0x42f3('0x18')]){if(_0x469302[_0x42f3('0x18')][_0x42f3('0x19')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x310305,_0x469302[_0x42f3('0x18')][_0x42f3('0x1a')]);return _0x433ae6(_0x469302[_0x42f3('0x18')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x310305,_0x469302['error'][_0x42f3('0x1a')]);return _0x119cc8(_0x469302[_0x42f3('0x18')][_0x42f3('0x1a')]);}else{logger[_0x42f3('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x310305,_0x42f3('0x14'));_0x119cc8(_0x469302[_0x42f3('0x1c')][_0x42f3('0x1a')]);}})[_0x42f3('0x1d')](function(_0xcfcd84){logger[_0x42f3('0x18')](_0x42f3('0x13'),_0x310305,_0xcfcd84);_0x433ae6(_0xcfcd84);});});}exports[_0x42f3('0x1e')]=function(_0x33f05d){var _0x1df60e=this;return new Promise(function(_0x526b61,_0x3b857a){return db['SmsAccount'][_0x42f3('0x1f')]({'raw':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')][_0x42f3('0x21')]||null:null,'attributes':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')]['attributes']||null:null,'include':_0x33f05d[_0x42f3('0x20')]?_0x33f05d[_0x42f3('0x20')]['include']?_[_0x42f3('0x22')](_0x33f05d[_0x42f3('0x20')][_0x42f3('0x23')],function(_0x542cd6){return{'model':db[_0x542cd6['model']],'as':_0x542cd6['as'],'attributes':_0x542cd6[_0x42f3('0x24')],'include':_0x542cd6['include']?_[_0x42f3('0x22')](_0x542cd6['include'],function(_0x1774cc){return{'model':db[_0x1774cc[_0x42f3('0x25')]],'as':_0x1774cc['as'],'attributes':_0x1774cc[_0x42f3('0x24')],'include':_0x1774cc[_0x42f3('0x23')]?_[_0x42f3('0x22')](_0x1774cc[_0x42f3('0x23')],function(_0x5c9983){return{'model':db[_0x5c9983[_0x42f3('0x25')]],'as':_0x5c9983['as'],'attributes':_0x5c9983['attributes']};}):[]};}):[]};}):[]:[]})[_0x42f3('0x12')](function(_0x2e1e80){logger[_0x42f3('0x1b')]('ShowSmsAccount',_0x33f05d);logger[_0x42f3('0x15')](_0x42f3('0x1e'),_0x33f05d,JSON[_0x42f3('0x17')](_0x2e1e80));_0x526b61(_0x2e1e80);})[_0x42f3('0x1d')](function(_0x397c63){logger['error'](_0x42f3('0x1e'),_0x397c63[_0x42f3('0x1a')],_0x33f05d);_0x3b857a(_0x1df60e[_0x42f3('0x18')](0x1f4,_0x397c63['message']));});});}; \ No newline at end of file +var _0x2c54=['../../config/environment','jayson/promise','client','redis','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','ShowSmsAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41ebbb,_0x45b3a5){var _0x5848c8=function(_0x2f09ad){while(--_0x2f09ad){_0x41ebbb['push'](_0x41ebbb['shift']());}};_0x5848c8(++_0x45b3a5);}(_0x2c54,0x66));var _0x42c5=function(_0x17a529,_0x5221ac){_0x17a529=_0x17a529-0x0;var _0x10d876=_0x2c54[_0x17a529];return _0x10d876;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require(_0x42c5('0x3'));var rs=require(_0x42c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42c5('0x5'))['db'];var utils=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require(_0x42c5('0x9'));var jayson=require(_0x42c5('0xa'));var client=jayson[_0x42c5('0xb')]['http']({'port':0x232a});config[_0x42c5('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x42c5('0xd'))(new Redis(config[_0x42c5('0xc')]));require(_0x42c5('0xe'))[_0x42c5('0xf')](socket);function respondWithRpcPromise(_0x435664,_0x453acc,_0x12f8a7){return new BPromise(function(_0x3a202e,_0xaf38f6){return client[_0x42c5('0x10')](_0x435664,_0x12f8a7)[_0x42c5('0x11')](function(_0x13258e){logger['info'](_0x42c5('0x12'),_0x453acc,_0x42c5('0x13'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x453acc,_0x42c5('0x13'),JSON[_0x42c5('0x14')](_0x13258e));if(_0x13258e[_0x42c5('0x15')]){if(_0x13258e[_0x42c5('0x15')]['code']===0x1f4){logger['error'](_0x42c5('0x12'),_0x453acc,_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);return _0xaf38f6(_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);}logger[_0x42c5('0x15')](_0x42c5('0x12'),_0x453acc,_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);return _0x3a202e(_0x13258e[_0x42c5('0x15')][_0x42c5('0x16')]);}else{logger[_0x42c5('0x17')]('SmsAccount,\x20%s,\x20%s',_0x453acc,'request\x20sent');_0x3a202e(_0x13258e[_0x42c5('0x18')][_0x42c5('0x16')]);}})['catch'](function(_0x1807ff){logger[_0x42c5('0x15')](_0x42c5('0x12'),_0x453acc,_0x1807ff);_0xaf38f6(_0x1807ff);});});}exports['ShowSmsAccount']=function(_0x228c43){var _0x3d3fc1=this;return new Promise(function(_0x3703d9,_0x37397a){return db[_0x42c5('0x19')][_0x42c5('0x1a')]({'raw':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1c')]===undefined?!![]:![]:!![],'where':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1d')]||null:null,'attributes':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1e')]||null:null,'include':_0x228c43[_0x42c5('0x1b')]?_0x228c43[_0x42c5('0x1b')][_0x42c5('0x1f')]?_[_0x42c5('0x20')](_0x228c43['options'][_0x42c5('0x1f')],function(_0x3fed53){return{'model':db[_0x3fed53[_0x42c5('0x21')]],'as':_0x3fed53['as'],'attributes':_0x3fed53[_0x42c5('0x1e')],'include':_0x3fed53[_0x42c5('0x1f')]?_[_0x42c5('0x20')](_0x3fed53[_0x42c5('0x1f')],function(_0x2a81bf){return{'model':db[_0x2a81bf[_0x42c5('0x21')]],'as':_0x2a81bf['as'],'attributes':_0x2a81bf[_0x42c5('0x1e')],'include':_0x2a81bf[_0x42c5('0x1f')]?_[_0x42c5('0x20')](_0x2a81bf['include'],function(_0x726435){return{'model':db[_0x726435[_0x42c5('0x21')]],'as':_0x726435['as'],'attributes':_0x726435[_0x42c5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x42c5('0x11')](function(_0x9caa11){logger[_0x42c5('0x17')]('ShowSmsAccount',_0x228c43);logger[_0x42c5('0x22')](_0x42c5('0x23'),_0x228c43,JSON[_0x42c5('0x14')](_0x9caa11));_0x3703d9(_0x9caa11);})[_0x42c5('0x24')](function(_0x4ecb77){logger['error']('ShowSmsAccount',_0x4ecb77['message'],_0x228c43);_0x37397a(_0x3d3fc1[_0x42c5('0x15')](0x1f4,_0x4ecb77['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 36b8c27..1a6203f 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 _0x91a0=['removeListener','register','length','./smsAccount.events','remove','update','emit'];(function(_0x1a78d7,_0x1d0145){var _0x4f1a0a=function(_0x156b86){while(--_0x156b86){_0x1a78d7['push'](_0x1a78d7['shift']());}};_0x4f1a0a(++_0x1d0145);}(_0x91a0,0x1df));var _0x091a=function(_0x161f03,_0x5d141b){_0x161f03=_0x161f03-0x0;var _0x2f396f=_0x91a0[_0x161f03];return _0x2f396f;};'use strict';var SmsAccountEvents=require(_0x091a('0x0'));var events=['save',_0x091a('0x1'),_0x091a('0x2')];function createListener(_0xa436bc,_0x2ba2bb){return function(_0x127629){_0x2ba2bb[_0x091a('0x3')](_0xa436bc,_0x127629);};}function removeListener(_0x420d1b,_0x25cdc3){return function(){SmsAccountEvents[_0x091a('0x4')](_0x420d1b,_0x25cdc3);};}exports[_0x091a('0x5')]=function(_0x5dc3d6){for(var _0x456e69=0x0,_0x49dadf=events[_0x091a('0x6')];_0x456e69<_0x49dadf;_0x456e69++){var _0x3b3240=events[_0x456e69];var _0x430c18=createListener('smsAccount:'+_0x3b3240,_0x5dc3d6);SmsAccountEvents['on'](_0x3b3240,_0x430c18);}}; \ No newline at end of file +var _0x5f00=['./smsAccount.events','remove','emit','register'];(function(_0x2167a4,_0x2e890a){var _0x54f126=function(_0x2c4ed5){while(--_0x2c4ed5){_0x2167a4['push'](_0x2167a4['shift']());}};_0x54f126(++_0x2e890a);}(_0x5f00,0x170));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require(_0x05f0('0x0'));var events=['save',_0x05f0('0x1'),'update'];function createListener(_0x294efa,_0x5872eb){return function(_0x43ab86){_0x5872eb[_0x05f0('0x2')](_0x294efa,_0x43ab86);};}function removeListener(_0x3afbeb,_0x26965b){return function(){SmsAccountEvents['removeListener'](_0x3afbeb,_0x26965b);};}exports[_0x05f0('0x3')]=function(_0x4b1e9e){for(var _0x4330b9=0x0,_0xaf4fb4=events['length'];_0x4330b9<_0xaf4fb4;_0x4330b9++){var _0x599056=events[_0x4330b9];var _0x237db9=createListener('smsAccount:'+_0x599056,_0x4b1e9e);SmsAccountEvents['on'](_0x599056,_0x237db9);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index f817740..a6b89ea 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 _0xe5c8=['get','isAuthenticated','index','/:id','create','update','delete','exports','multer','connect-timeout','../../config/environment','./smsApplication.controller'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xe5c8,0xb0));var _0x8e5c=function(_0x410275,_0x345360){_0x410275=_0x410275-0x0;var _0x17d0bf=_0xe5c8[_0x410275];return _0x17d0bf;};'use strict';var multer=require(_0x8e5c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e5c('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e5c('0x2'));var controller=require(_0x8e5c('0x3'));router[_0x8e5c('0x4')]('/',auth[_0x8e5c('0x5')](),controller[_0x8e5c('0x6')]);router['get'](_0x8e5c('0x7'),auth[_0x8e5c('0x5')](),controller['show']);router['post']('/',auth[_0x8e5c('0x5')](),controller[_0x8e5c('0x8')]);router['put']('/:id',auth[_0x8e5c('0x5')](),controller[_0x8e5c('0x9')]);router[_0x8e5c('0xa')](_0x8e5c('0x7'),auth[_0x8e5c('0x5')](),controller['destroy']);module[_0x8e5c('0xb')]=router; \ No newline at end of file +var _0x96b7=['get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','util','path','express','../../config/environment','./smsApplication.controller'];(function(_0x521ea0,_0x156575){var _0x227650=function(_0x557e59){while(--_0x557e59){_0x521ea0['push'](_0x521ea0['shift']());}};_0x227650(++_0x156575);}(_0x96b7,0xea));var _0x796b=function(_0x535bcd,_0x1575af){_0x535bcd=_0x535bcd-0x0;var _0x42f269=_0x96b7[_0x535bcd];return _0x42f269;};'use strict';var multer=require(_0x796b('0x0'));var util=require(_0x796b('0x1'));var path=require(_0x796b('0x2'));var timeout=require('connect-timeout');var express=require(_0x796b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x796b('0x4'));var controller=require(_0x796b('0x5'));router[_0x796b('0x6')]('/',auth[_0x796b('0x7')](),controller[_0x796b('0x8')]);router[_0x796b('0x6')](_0x796b('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x796b('0xa')]);router['put']('/:id',auth[_0x796b('0x7')](),controller[_0x796b('0xb')]);router[_0x796b('0xc')](_0x796b('0x9'),auth[_0x796b('0x7')](),controller[_0x796b('0xd')]);module[_0x796b('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index dfea889..9c5a3f4 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 _0xddcb=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xddcb,0x12f));var _0xbddc=function(_0x5a7e49,_0x18f802){_0x5a7e49=_0x5a7e49-0x0;var _0x5c5e1b=_0xddcb[_0x5a7e49];return _0x5c5e1b;};'use strict';var Sequelize=require('sequelize');module[_0xbddc('0x0')]={'priority':{'type':Sequelize[_0xbddc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbddc('0x2')],'allowNull':![],'defaultValue':_0xbddc('0x3')},'appdata':{'type':Sequelize[_0xbddc('0x4')]()},'description':{'type':Sequelize[_0xbddc('0x2')]},'interval':{'type':Sequelize[_0xbddc('0x2')],'defaultValue':_0xbddc('0x5')}}; \ No newline at end of file +var _0x2fcb=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2fcb,0x1a7));var _0xb2fc=function(_0xdfbafd,_0x1d4322){_0xdfbafd=_0xdfbafd-0x0;var _0x188908=_0x2fcb[_0xdfbafd];return _0x188908;};'use strict';var Sequelize=require(_0xb2fc('0x0'));module[_0xb2fc('0x1')]={'priority':{'type':Sequelize[_0xb2fc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb2fc('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb2fc('0x4')],'defaultValue':_0xb2fc('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 42a4e70..4b42986 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 _0x1c7c=['json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','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','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x42f331,_0x33905b){var _0x43e6ad=function(_0xed4e2c){while(--_0xed4e2c){_0x42f331['push'](_0x42f331['shift']());}};_0x43e6ad(++_0x33905b);}(_0x1c7c,0x164));var _0xc1c7=function(_0x543cc3,_0x187df5){_0x543cc3=_0x543cc3-0x0;var _0x504019=_0x1c7c[_0x543cc3];return _0x504019;};'use strict';var pdf=require(_0xc1c7('0x0'));var emlformat=require(_0xc1c7('0x1'));var rimraf=require(_0xc1c7('0x2'));var zipdir=require(_0xc1c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c7('0x4'));var moment=require('moment');var BPromise=require(_0xc1c7('0x5'));var Mustache=require(_0xc1c7('0x6'));var util=require(_0xc1c7('0x7'));var path=require(_0xc1c7('0x8'));var sox=require(_0xc1c7('0x9'));var csv=require(_0xc1c7('0xa'));var ejs=require(_0xc1c7('0xb'));var fs=require('fs');var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0xa'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473248,_0x44bf88){_0x44bf88=_0x44bf88||0xcc;return function(_0x376cab){if(_0x376cab){return _0x473248[_0xc1c7('0x1a')](_0x44bf88);}return _0x473248[_0xc1c7('0x1b')](_0x44bf88)[_0xc1c7('0x1c')]();};}function respondWithResult(_0x40c313,_0x1b57ab){_0x1b57ab=_0x1b57ab||0xc8;return function(_0xdfc7d9){if(_0xdfc7d9){return _0x40c313[_0xc1c7('0x1b')](_0x1b57ab)[_0xc1c7('0x1d')](_0xdfc7d9);}};}function respondWithFilteredResult(_0x34d392,_0x49576d){return function(_0x3e1f0e){if(_0x3e1f0e){var _0x335600=_0x3e1f0e[_0xc1c7('0x1e')],_0x21911c=_0x49576d[_0xc1c7('0x1f')],_0x555b59=_0x49576d[_0xc1c7('0x1f')]+_0x49576d[_0xc1c7('0x20')],_0x94678a;if(_0x555b59>=_0x335600){_0x555b59=_0x335600;_0x94678a=0xc8;}else{_0x94678a=0xce;}_0x34d392[_0xc1c7('0x1b')](_0x94678a);return _0x34d392[_0xc1c7('0x21')](_0xc1c7('0x22'),_0x21911c+'-'+_0x555b59+'/'+_0x335600)['json'](_0x3e1f0e);}return null;};}function patchUpdates(_0x37d748){return function(_0x17fd22){try{jsonpatch[_0xc1c7('0x23')](_0x17fd22,_0x37d748,!![]);}catch(_0x1bc9d){return BPromise['reject'](_0x1bc9d);}return _0x17fd22[_0xc1c7('0x24')]();};}function saveUpdates(_0x4d6171,_0x5e7e4a){return function(_0x195c5f){if(_0x195c5f){return _0x195c5f['update'](_0x4d6171)['then'](function(_0x2d006f){return _0x2d006f;});}return null;};}function removeEntity(_0x17a265,_0x2f1b87){return function(_0x4c6b34){if(_0x4c6b34){return _0x4c6b34[_0xc1c7('0x25')]()[_0xc1c7('0x26')](function(){_0x17a265[_0xc1c7('0x1b')](0xcc)[_0xc1c7('0x1c')]();});}};}function handleEntityNotFound(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(!_0x3180fd){_0x2e64c4[_0xc1c7('0x1a')](0x194);}return _0x3180fd;};}function handleError(_0x22b654,_0x1540c1){_0x1540c1=_0x1540c1||0x1f4;return function(_0x29cf97){logger[_0xc1c7('0x27')](_0x29cf97[_0xc1c7('0x28')]);if(_0x29cf97[_0xc1c7('0x29')]){delete _0x29cf97[_0xc1c7('0x29')];}_0x22b654[_0xc1c7('0x1b')](_0x1540c1)['send'](_0x29cf97);};}exports[_0xc1c7('0x2a')]=function(_0x13a1f9,_0x4e1721){var _0x52a1d5={},_0x352f24={},_0x539931={'count':0x0,'rows':[]};var _0x544fbb=_[_0xc1c7('0x2b')](db[_0xc1c7('0x2c')][_0xc1c7('0x2d')],function(_0x243450){return{'name':_0x243450[_0xc1c7('0x2e')],'type':_0x243450['type']['key']};});_0x352f24[_0xc1c7('0x2f')]=_[_0xc1c7('0x2b')](_0x544fbb,_0xc1c7('0x29'));_0x352f24[_0xc1c7('0x30')]=_[_0xc1c7('0x31')](_0x13a1f9['query']);_0x352f24['filters']=_[_0xc1c7('0x32')](_0x352f24[_0xc1c7('0x2f')],_0x352f24['query']);_0x52a1d5[_0xc1c7('0x33')]=_[_0xc1c7('0x32')](_0x352f24[_0xc1c7('0x2f')],qs[_0xc1c7('0x34')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x34')]));_0x52a1d5[_0xc1c7('0x33')]=_0x52a1d5['attributes'][_0xc1c7('0x35')]?_0x52a1d5[_0xc1c7('0x33')]:_0x352f24[_0xc1c7('0x2f')];if(!_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x36')](_0xc1c7('0x37'))){_0x52a1d5[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x13a1f9[_0xc1c7('0x30')]['limit']);_0x52a1d5['offset']=qs[_0xc1c7('0x1f')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x1f')]);}_0x52a1d5[_0xc1c7('0x38')]=qs[_0xc1c7('0x39')](_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x39')]);_0x52a1d5[_0xc1c7('0x3a')]=qs[_0xc1c7('0x3b')](_[_0xc1c7('0x3c')](_0x13a1f9[_0xc1c7('0x30')],_0x352f24[_0xc1c7('0x3b')]),_0x544fbb);if(_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x3d')]){_0x52a1d5[_0xc1c7('0x3a')]=_[_0xc1c7('0x3e')](_0x52a1d5[_0xc1c7('0x3a')],{'$or':_[_0xc1c7('0x2b')](_0x544fbb,function(_0x2f9e9a){if(_0x2f9e9a[_0xc1c7('0x3f')]!==_0xc1c7('0x40')){var _0x49e9ac={};_0x49e9ac[_0x2f9e9a['name']]={'$like':'%'+_0x13a1f9['query'][_0xc1c7('0x3d')]+'%'};return _0x49e9ac;}})});}_0x52a1d5=_['merge']({},_0x52a1d5,_0x13a1f9['options']);var _0x17ae8e={'where':_0x52a1d5[_0xc1c7('0x3a')]};return db[_0xc1c7('0x2c')][_0xc1c7('0x1e')](_0x17ae8e)['then'](function(_0x5cd9ff){_0x539931[_0xc1c7('0x1e')]=_0x5cd9ff;if(_0x13a1f9[_0xc1c7('0x30')][_0xc1c7('0x41')]){_0x52a1d5[_0xc1c7('0x42')]=[{'all':!![]}];}return db[_0xc1c7('0x2c')][_0xc1c7('0x43')](_0x52a1d5);})[_0xc1c7('0x26')](function(_0x1d4621){_0x539931[_0xc1c7('0x44')]=_0x1d4621;return _0x539931;})[_0xc1c7('0x26')](respondWithFilteredResult(_0x4e1721,_0x52a1d5))[_0xc1c7('0x45')](handleError(_0x4e1721,null));};exports[_0xc1c7('0x46')]=function(_0x5409d2,_0xbbf96d){var _0x412520={'raw':!![],'where':{'id':_0x5409d2[_0xc1c7('0x47')]['id']}},_0x508b32={};_0x508b32[_0xc1c7('0x2f')]=_[_0xc1c7('0x31')](db[_0xc1c7('0x2c')][_0xc1c7('0x2d')]);_0x508b32[_0xc1c7('0x30')]=_[_0xc1c7('0x31')](_0x5409d2[_0xc1c7('0x30')]);_0x508b32[_0xc1c7('0x3b')]=_[_0xc1c7('0x32')](_0x508b32['model'],_0x508b32[_0xc1c7('0x30')]);_0x412520[_0xc1c7('0x33')]=_['intersection'](_0x508b32['model'],qs[_0xc1c7('0x34')](_0x5409d2[_0xc1c7('0x30')][_0xc1c7('0x34')]));_0x412520[_0xc1c7('0x33')]=_0x412520[_0xc1c7('0x33')]['length']?_0x412520[_0xc1c7('0x33')]:_0x508b32[_0xc1c7('0x2f')];if(_0x5409d2['query']['includeAll']){_0x412520['include']=[{'all':!![]}];}_0x412520=_[_0xc1c7('0x3e')]({},_0x412520,_0x5409d2[_0xc1c7('0x48')]);return db[_0xc1c7('0x2c')]['find'](_0x412520)[_0xc1c7('0x26')](handleEntityNotFound(_0xbbf96d,null))[_0xc1c7('0x26')](respondWithResult(_0xbbf96d,null))['catch'](handleError(_0xbbf96d,null));};exports[_0xc1c7('0x49')]=function(_0xce8ab9,_0x32e38e){return db[_0xc1c7('0x2c')][_0xc1c7('0x49')](_0xce8ab9[_0xc1c7('0x4a')],{})[_0xc1c7('0x26')](respondWithResult(_0x32e38e,0xc9))[_0xc1c7('0x45')](handleError(_0x32e38e,null));};exports[_0xc1c7('0x4b')]=function(_0x3ec5de,_0xa49f73){if(_0x3ec5de[_0xc1c7('0x4a')]['id']){delete _0x3ec5de[_0xc1c7('0x4a')]['id'];}return db[_0xc1c7('0x2c')][_0xc1c7('0x4c')]({'where':{'id':_0x3ec5de[_0xc1c7('0x47')]['id']}})[_0xc1c7('0x26')](handleEntityNotFound(_0xa49f73,null))[_0xc1c7('0x26')](saveUpdates(_0x3ec5de['body'],null))[_0xc1c7('0x26')](respondWithResult(_0xa49f73,null))['catch'](handleError(_0xa49f73,null));};exports[_0xc1c7('0x25')]=function(_0x23f42f,_0x2840a3){return db['SmsApplication'][_0xc1c7('0x4c')]({'where':{'id':_0x23f42f[_0xc1c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2840a3,null))['then'](removeEntity(_0x2840a3,null))['catch'](handleError(_0x2840a3,null));}; \ No newline at end of file +var _0x9f0e=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','SmsApplication','includeAll','include','findAll','rows','catch','options','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x46b4ce,_0x4c00a8){_0x46b4ce=_0x46b4ce-0x0;var _0x1de005=_0x9f0e[_0x46b4ce];return _0x1de005;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var Redis=require(_0xe9f0('0x11'));var authService=require(_0xe9f0('0x12'));var qs=require(_0xe9f0('0x13'));var as=require(_0xe9f0('0x14'));var hardwareService=require(_0xe9f0('0x15'));var logger=require('../../config/logger')(_0xe9f0('0x16'));var utils=require(_0xe9f0('0x17'));var config=require(_0xe9f0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207fac,_0x586763){_0x586763=_0x586763||0xcc;return function(_0x367545){if(_0x367545){return _0x207fac[_0xe9f0('0x19')](_0x586763);}return _0x207fac[_0xe9f0('0x1a')](_0x586763)[_0xe9f0('0x1b')]();};}function respondWithResult(_0x55a388,_0x2cf75d){_0x2cf75d=_0x2cf75d||0xc8;return function(_0x5a10c6){if(_0x5a10c6){return _0x55a388[_0xe9f0('0x1a')](_0x2cf75d)[_0xe9f0('0x1c')](_0x5a10c6);}};}function respondWithFilteredResult(_0x3800e8,_0x59320d){return function(_0x28bfac){if(_0x28bfac){var _0x33e9e4=_0x28bfac[_0xe9f0('0x1d')],_0x2e68ef=_0x59320d[_0xe9f0('0x1e')],_0x598eee=_0x59320d[_0xe9f0('0x1e')]+_0x59320d[_0xe9f0('0x1f')],_0xaa7aa6;if(_0x598eee>=_0x33e9e4){_0x598eee=_0x33e9e4;_0xaa7aa6=0xc8;}else{_0xaa7aa6=0xce;}_0x3800e8[_0xe9f0('0x1a')](_0xaa7aa6);return _0x3800e8[_0xe9f0('0x20')]('Content-Range',_0x2e68ef+'-'+_0x598eee+'/'+_0x33e9e4)[_0xe9f0('0x1c')](_0x28bfac);}return null;};}function patchUpdates(_0x19e090){return function(_0x232f2c){try{jsonpatch['apply'](_0x232f2c,_0x19e090,!![]);}catch(_0x35e841){return BPromise[_0xe9f0('0x21')](_0x35e841);}return _0x232f2c[_0xe9f0('0x22')]();};}function saveUpdates(_0x43f399,_0x5ba788){return function(_0x33f143){if(_0x33f143){return _0x33f143[_0xe9f0('0x23')](_0x43f399)['then'](function(_0x51e03f){return _0x51e03f;});}return null;};}function removeEntity(_0x4cc403,_0x12fe9f){return function(_0xa1ddc){if(_0xa1ddc){return _0xa1ddc[_0xe9f0('0x24')]()[_0xe9f0('0x25')](function(){_0x4cc403[_0xe9f0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(!_0x437d43){_0x229fe0[_0xe9f0('0x19')](0x194);}return _0x437d43;};}function handleError(_0x3ca991,_0x372ffd){_0x372ffd=_0x372ffd||0x1f4;return function(_0x37c0fc){logger[_0xe9f0('0x26')](_0x37c0fc[_0xe9f0('0x27')]);if(_0x37c0fc[_0xe9f0('0x28')]){delete _0x37c0fc['name'];}_0x3ca991[_0xe9f0('0x1a')](_0x372ffd)[_0xe9f0('0x29')](_0x37c0fc);};}exports[_0xe9f0('0x2a')]=function(_0x1a8478,_0x4cf1b1){var _0x212a38={},_0x2613fd={},_0x856ac8={'count':0x0,'rows':[]};var _0x1f98a7=_[_0xe9f0('0x2b')](db['SmsApplication'][_0xe9f0('0x2c')],function(_0xdc16bc){return{'name':_0xdc16bc[_0xe9f0('0x2d')],'type':_0xdc16bc[_0xe9f0('0x2e')][_0xe9f0('0x2f')]};});_0x2613fd[_0xe9f0('0x30')]=_[_0xe9f0('0x2b')](_0x1f98a7,_0xe9f0('0x28'));_0x2613fd[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x1a8478[_0xe9f0('0x31')]);_0x2613fd[_0xe9f0('0x33')]=_[_0xe9f0('0x34')](_0x2613fd[_0xe9f0('0x30')],_0x2613fd[_0xe9f0('0x31')]);_0x212a38[_0xe9f0('0x35')]=_[_0xe9f0('0x34')](_0x2613fd[_0xe9f0('0x30')],qs[_0xe9f0('0x36')](_0x1a8478[_0xe9f0('0x31')][_0xe9f0('0x36')]));_0x212a38[_0xe9f0('0x35')]=_0x212a38[_0xe9f0('0x35')][_0xe9f0('0x37')]?_0x212a38['attributes']:_0x2613fd['model'];if(!_0x1a8478['query'][_0xe9f0('0x38')]('nolimit')){_0x212a38[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x1a8478['query'][_0xe9f0('0x1f')]);_0x212a38['offset']=qs['offset'](_0x1a8478['query'][_0xe9f0('0x1e')]);}_0x212a38[_0xe9f0('0x39')]=qs['sort'](_0x1a8478[_0xe9f0('0x31')][_0xe9f0('0x3a')]);_0x212a38[_0xe9f0('0x3b')]=qs['filters'](_['pick'](_0x1a8478[_0xe9f0('0x31')],_0x2613fd[_0xe9f0('0x33')]),_0x1f98a7);if(_0x1a8478[_0xe9f0('0x31')]['filter']){_0x212a38[_0xe9f0('0x3b')]=_[_0xe9f0('0x3c')](_0x212a38[_0xe9f0('0x3b')],{'$or':_[_0xe9f0('0x2b')](_0x1f98a7,function(_0x2b38de){if(_0x2b38de['type']!==_0xe9f0('0x3d')){var _0x3a2b23={};_0x3a2b23[_0x2b38de[_0xe9f0('0x28')]]={'$like':'%'+_0x1a8478['query'][_0xe9f0('0x3e')]+'%'};return _0x3a2b23;}})});}_0x212a38=_[_0xe9f0('0x3c')]({},_0x212a38,_0x1a8478['options']);var _0x317278={'where':_0x212a38['where']};return db[_0xe9f0('0x3f')]['count'](_0x317278)['then'](function(_0x51eda3){_0x856ac8['count']=_0x51eda3;if(_0x1a8478['query'][_0xe9f0('0x40')]){_0x212a38[_0xe9f0('0x41')]=[{'all':!![]}];}return db[_0xe9f0('0x3f')][_0xe9f0('0x42')](_0x212a38);})[_0xe9f0('0x25')](function(_0xd9b61b){_0x856ac8[_0xe9f0('0x43')]=_0xd9b61b;return _0x856ac8;})[_0xe9f0('0x25')](respondWithFilteredResult(_0x4cf1b1,_0x212a38))[_0xe9f0('0x44')](handleError(_0x4cf1b1,null));};exports['show']=function(_0x1e2016,_0x3eeea3){var _0x36b00a={'raw':!![],'where':{'id':_0x1e2016['params']['id']}},_0x571366={};_0x571366[_0xe9f0('0x30')]=_['keys'](db[_0xe9f0('0x3f')][_0xe9f0('0x2c')]);_0x571366[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x1e2016['query']);_0x571366[_0xe9f0('0x33')]=_[_0xe9f0('0x34')](_0x571366[_0xe9f0('0x30')],_0x571366[_0xe9f0('0x31')]);_0x36b00a[_0xe9f0('0x35')]=_['intersection'](_0x571366[_0xe9f0('0x30')],qs[_0xe9f0('0x36')](_0x1e2016[_0xe9f0('0x31')][_0xe9f0('0x36')]));_0x36b00a[_0xe9f0('0x35')]=_0x36b00a['attributes'][_0xe9f0('0x37')]?_0x36b00a['attributes']:_0x571366['model'];if(_0x1e2016[_0xe9f0('0x31')][_0xe9f0('0x40')]){_0x36b00a['include']=[{'all':!![]}];}_0x36b00a=_[_0xe9f0('0x3c')]({},_0x36b00a,_0x1e2016[_0xe9f0('0x45')]);return db[_0xe9f0('0x3f')][_0xe9f0('0x46')](_0x36b00a)[_0xe9f0('0x25')](handleEntityNotFound(_0x3eeea3,null))[_0xe9f0('0x25')](respondWithResult(_0x3eeea3,null))[_0xe9f0('0x44')](handleError(_0x3eeea3,null));};exports['create']=function(_0x8b8da3,_0x4a6e2a){return db[_0xe9f0('0x3f')]['create'](_0x8b8da3[_0xe9f0('0x47')],{})['then'](respondWithResult(_0x4a6e2a,0xc9))[_0xe9f0('0x44')](handleError(_0x4a6e2a,null));};exports[_0xe9f0('0x23')]=function(_0x422324,_0x4c94e9){if(_0x422324[_0xe9f0('0x47')]['id']){delete _0x422324[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x3f')][_0xe9f0('0x46')]({'where':{'id':_0x422324[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x25')](handleEntityNotFound(_0x4c94e9,null))[_0xe9f0('0x25')](saveUpdates(_0x422324[_0xe9f0('0x47')],null))[_0xe9f0('0x25')](respondWithResult(_0x4c94e9,null))[_0xe9f0('0x44')](handleError(_0x4c94e9,null));};exports[_0xe9f0('0x24')]=function(_0x1325a2,_0x57beee){return db['SmsApplication'][_0xe9f0('0x46')]({'where':{'id':_0x1325a2[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x25')](handleEntityNotFound(_0x57beee,null))['then'](removeEntity(_0x57beee,null))[_0xe9f0('0x44')](handleError(_0x57beee,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8bc8e1e..8993ca6 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 _0x983a=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','../../config/environment','exports','define','SmsApplication'];(function(_0x29ab2c,_0x249491){var _0x1b8724=function(_0x116a94){while(--_0x116a94){_0x29ab2c['push'](_0x29ab2c['shift']());}};_0x1b8724(++_0x249491);}(_0x983a,0x93));var _0xa983=function(_0x462d8a,_0x495d12){_0x462d8a=_0x462d8a-0x0;var _0x15b114=_0x983a[_0x462d8a];return _0x15b114;};'use strict';var _=require(_0xa983('0x0'));var util=require(_0xa983('0x1'));var logger=require(_0xa983('0x2'))('api');var moment=require(_0xa983('0x3'));var BPromise=require(_0xa983('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa983('0x5'));var attributes=require('./smsApplication.attributes');module[_0xa983('0x6')]=function(_0x32dd50,_0x8c9b41){return _0x32dd50[_0xa983('0x7')](_0xa983('0x8'),attributes,{'tableName':_0xa983('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa983('0xa'),'collate':_0xa983('0xb')});}; \ No newline at end of file +var _0x44cf=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x37e618,_0xcc41f8){var _0x383afb=function(_0x573fc0){while(--_0x573fc0){_0x37e618['push'](_0x37e618['shift']());}};_0x383afb(++_0xcc41f8);}(_0x44cf,0x88));var _0xf44c=function(_0x1ac824,_0x36dd6c){_0x1ac824=_0x1ac824-0x0;var _0x39ca88=_0x44cf[_0x1ac824];return _0x39ca88;};'use strict';var _=require(_0xf44c('0x0'));var util=require(_0xf44c('0x1'));var logger=require(_0xf44c('0x2'))(_0xf44c('0x3'));var moment=require(_0xf44c('0x4'));var BPromise=require(_0xf44c('0x5'));var rp=require(_0xf44c('0x6'));var fs=require('fs');var path=require(_0xf44c('0x7'));var rimraf=require('rimraf');var config=require(_0xf44c('0x8'));var attributes=require(_0xf44c('0x9'));module[_0xf44c('0xa')]=function(_0x154ce5,_0x42cb87){return _0x154ce5[_0xf44c('0xb')](_0xf44c('0xc'),attributes,{'tableName':_0xf44c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf44c('0xe'),'collate':_0xf44c('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 43ce2b8..4f7e314 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 _0x0f3c=['rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a30a7,_0x1f3b34){var _0x479a14=function(_0x110d32){while(--_0x110d32){_0x4a30a7['push'](_0x4a30a7['shift']());}};_0x479a14(++_0x1f3b34);}(_0x0f3c,0x189));var _0xc0f3=function(_0x5f52f6,_0x8ea39c){_0x5f52f6=_0x5f52f6-0x0;var _0x3291e5=_0x0f3c[_0x5f52f6];return _0x3291e5;};'use strict';var _=require(_0xc0f3('0x0'));var util=require(_0xc0f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0f3('0x2'));var db=require(_0xc0f3('0x3'))['db'];var utils=require(_0xc0f3('0x4'));var logger=require(_0xc0f3('0x5'))(_0xc0f3('0x6'));var config=require(_0xc0f3('0x7'));var jayson=require(_0xc0f3('0x8'));var client=jayson[_0xc0f3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37d939,_0x2c517e,_0x48fc5d){return new BPromise(function(_0x435864,_0x399c29){return client['request'](_0x37d939,_0x48fc5d)[_0xc0f3('0xa')](function(_0x31ddbe){logger[_0xc0f3('0xb')](_0xc0f3('0xc'),_0x2c517e,_0xc0f3('0xd'));logger[_0xc0f3('0xe')](_0xc0f3('0xf'),_0x2c517e,'request\x20sent',JSON[_0xc0f3('0x10')](_0x31ddbe));if(_0x31ddbe[_0xc0f3('0x11')]){if(_0x31ddbe[_0xc0f3('0x11')]['code']===0x1f4){logger[_0xc0f3('0x11')](_0xc0f3('0xc'),_0x2c517e,_0x31ddbe[_0xc0f3('0x11')][_0xc0f3('0x12')]);return _0x399c29(_0x31ddbe['error'][_0xc0f3('0x12')]);}logger[_0xc0f3('0x11')](_0xc0f3('0xc'),_0x2c517e,_0x31ddbe[_0xc0f3('0x11')][_0xc0f3('0x12')]);return _0x435864(_0x31ddbe[_0xc0f3('0x11')][_0xc0f3('0x12')]);}else{logger[_0xc0f3('0xb')](_0xc0f3('0xc'),_0x2c517e,_0xc0f3('0xd'));_0x435864(_0x31ddbe[_0xc0f3('0x13')][_0xc0f3('0x12')]);}})[_0xc0f3('0x14')](function(_0x5b2d71){logger[_0xc0f3('0x11')](_0xc0f3('0xc'),_0x2c517e,_0x5b2d71);_0x399c29(_0x5b2d71);});});} \ No newline at end of file +var _0x41f2=['code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x27385e,_0x547b6c){var _0x159fee=function(_0x456626){while(--_0x456626){_0x27385e['push'](_0x27385e['shift']());}};_0x159fee(++_0x547b6c);}(_0x41f2,0x14f));var _0x241f=function(_0xefc3,_0x32a3c4){_0xefc3=_0xefc3-0x0;var _0x457933=_0x41f2[_0xefc3];return _0x457933;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var moment=require('moment');var BPromise=require(_0x241f('0x2'));var rs=require(_0x241f('0x3'));var fs=require('fs');var Redis=require(_0x241f('0x4'));var db=require(_0x241f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x241f('0x6'))(_0x241f('0x7'));var config=require('../../config/environment');var jayson=require(_0x241f('0x8'));var client=jayson[_0x241f('0x9')][_0x241f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3a28,_0x38cf69,_0x4e7af6){return new BPromise(function(_0x2dce43,_0x41f672){return client['request'](_0x3a3a28,_0x4e7af6)['then'](function(_0x5eaaf6){logger[_0x241f('0xb')]('SmsApplication,\x20%s,\x20%s',_0x38cf69,_0x241f('0xc'));logger[_0x241f('0xd')](_0x241f('0xe'),_0x38cf69,'request\x20sent',JSON[_0x241f('0xf')](_0x5eaaf6));if(_0x5eaaf6['error']){if(_0x5eaaf6[_0x241f('0x10')][_0x241f('0x11')]===0x1f4){logger[_0x241f('0x10')]('SmsApplication,\x20%s,\x20%s',_0x38cf69,_0x5eaaf6[_0x241f('0x10')][_0x241f('0x12')]);return _0x41f672(_0x5eaaf6[_0x241f('0x10')][_0x241f('0x12')]);}logger['error'](_0x241f('0x13'),_0x38cf69,_0x5eaaf6['error'][_0x241f('0x12')]);return _0x2dce43(_0x5eaaf6[_0x241f('0x10')]['message']);}else{logger[_0x241f('0xb')](_0x241f('0x13'),_0x38cf69,_0x241f('0xc'));_0x2dce43(_0x5eaaf6[_0x241f('0x14')]['message']);}})[_0x241f('0x15')](function(_0x3e07fb){logger['error'](_0x241f('0x13'),_0x38cf69,_0x3e07fb);_0x41f672(_0x3e07fb);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2fa7ae8..ed297c9 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 _0x9f89=['express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','exports','util','connect-timeout'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9f89,0x13d));var _0x99f8=function(_0xf7831f,_0x1c6188){_0xf7831f=_0xf7831f-0x0;var _0x3f88e7=_0x9f89[_0xf7831f];return _0x3f88e7;};'use strict';var multer=require('multer');var util=require(_0x99f8('0x0'));var path=require('path');var timeout=require(_0x99f8('0x1'));var express=require(_0x99f8('0x2'));var router=express[_0x99f8('0x3')]();var auth=require(_0x99f8('0x4'));var interaction=require(_0x99f8('0x5'));var config=require('../../config/environment');var controller=require(_0x99f8('0x6'));router[_0x99f8('0x7')]('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0x9')]);router[_0x99f8('0x7')](_0x99f8('0xa'),auth[_0x99f8('0x8')](),controller['describe']);router[_0x99f8('0x7')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),controller[_0x99f8('0xc')]);router['get'](_0x99f8('0xd'),auth[_0x99f8('0x8')](),controller[_0x99f8('0xe')]);router[_0x99f8('0x7')]('/:id/download',auth[_0x99f8('0x8')](),controller[_0x99f8('0xf')]);router[_0x99f8('0x10')]('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0x11')]);router[_0x99f8('0x10')](_0x99f8('0xd'),auth[_0x99f8('0x8')](),controller[_0x99f8('0x12')]);router[_0x99f8('0x10')](_0x99f8('0x13'),auth['isAuthenticated'](),interaction[_0x99f8('0x14')](_0x99f8('0x15'),_0x99f8('0x16')),controller[_0x99f8('0x17')]);router[_0x99f8('0x18')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),interaction[_0x99f8('0x14')](_0x99f8('0x15'),_0x99f8('0x19')),controller[_0x99f8('0x1a')]);router['delete'](_0x99f8('0xb'),auth[_0x99f8('0x8')](),interaction['tracked'](_0x99f8('0x15'),_0x99f8('0x1b')),controller['destroy']);router['delete'](_0x99f8('0x13'),auth[_0x99f8('0x8')](),controller['removeTags']);module[_0x99f8('0x1c')]=router; \ No newline at end of file +var _0x0137=['tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','smsinteraction:destroy','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags'];(function(_0x4ec0b4,_0x2f313d){var _0x3342b6=function(_0x241778){while(--_0x241778){_0x4ec0b4['push'](_0x4ec0b4['shift']());}};_0x3342b6(++_0x2f313d);}(_0x0137,0x1d8));var _0x7013=function(_0x3e4d9a,_0x449a9f){_0x3e4d9a=_0x3e4d9a-0x0;var _0x4124d3=_0x0137[_0x3e4d9a];return _0x4124d3;};'use strict';var multer=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var path=require(_0x7013('0x2'));var timeout=require(_0x7013('0x3'));var express=require(_0x7013('0x4'));var router=express['Router']();var auth=require(_0x7013('0x5'));var interaction=require(_0x7013('0x6'));var config=require(_0x7013('0x7'));var controller=require(_0x7013('0x8'));router[_0x7013('0x9')]('/',auth[_0x7013('0xa')](),controller['index']);router[_0x7013('0x9')](_0x7013('0xb'),auth['isAuthenticated'](),controller[_0x7013('0xc')]);router[_0x7013('0x9')](_0x7013('0xd'),auth['isAuthenticated'](),controller[_0x7013('0xe')]);router[_0x7013('0x9')](_0x7013('0xf'),auth[_0x7013('0xa')](),controller['getMessages']);router[_0x7013('0x9')](_0x7013('0x10'),auth[_0x7013('0xa')](),controller[_0x7013('0x11')]);router[_0x7013('0x12')]('/',auth[_0x7013('0xa')](),controller['create']);router[_0x7013('0x12')](_0x7013('0xf'),auth[_0x7013('0xa')](),controller[_0x7013('0x13')]);router[_0x7013('0x12')](_0x7013('0x14'),auth[_0x7013('0xa')](),interaction[_0x7013('0x15')](_0x7013('0x16'),_0x7013('0x17')),controller[_0x7013('0x18')]);router['put']('/:id',auth[_0x7013('0xa')](),interaction[_0x7013('0x15')](_0x7013('0x16'),_0x7013('0x19')),controller[_0x7013('0x1a')]);router['delete']('/:id',auth[_0x7013('0xa')](),interaction[_0x7013('0x15')](_0x7013('0x16'),_0x7013('0x1b')),controller[_0x7013('0x1c')]);router['delete'](_0x7013('0x14'),auth[_0x7013('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0f48f71..364e6de 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x359c17,_0x23aa00){var _0x7d9532=function(_0x35ad31){while(--_0x35ad31){_0x359c17['push'](_0x359c17['shift']());}};_0x7d9532(++_0x23aa00);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x51bf6b,_0x402d98){var _0xb23a48=function(_0x32c7e4){while(--_0x32c7e4){_0x51bf6b['push'](_0x51bf6b['shift']());}};_0xb23a48(++_0x402d98);}(_0xb10b,0x12a));var _0xbb10=function(_0x513835,_0x93de04){_0x513835=_0x513835-0x0;var _0x567b24=_0xb10b[_0x513835];return _0x567b24;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 47f8fab..8829871 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 _0x9354=['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','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','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?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','buildExpression','some','compact','isEmpty','forEach','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','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)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','journey','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','catch','show','params','include','merge','options','create','body','describe','addMessage','omit','findOne','SmsMessage','nolimit','format','findAll','addTags','setTags','ids','emit','removeTags','download','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
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','Sms','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','out','renderFile','root','downloadInteraction.html','toFile','transcript-','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/utils','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','split','Tags','push','index','SmsInteraction','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9354,0x96));var _0x4935=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x9354[_0x7148a3];return _0x52f31d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4935('0x0'));var rimraf=require(_0x4935('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4935('0x2'));var rp=require(_0x4935('0x3'));var moment=require(_0x4935('0x4'));var BPromise=require(_0x4935('0x5'));var Mustache=require('mustache');var util=require(_0x4935('0x6'));var path=require(_0x4935('0x7'));var sox=require(_0x4935('0x8'));var csv=require(_0x4935('0x9'));var ejs=require(_0x4935('0xa'));var fs=require('fs');var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x9'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4935('0x16')]=_[_0x4935('0x17')](config[_0x4935('0x16')],{'host':_0x4935('0x18'),'port':0x18eb});var socket=require(_0x4935('0x19'))(new Redis(config[_0x4935('0x16')]));require(_0x4935('0x1a'))[_0x4935('0x1b')](socket);function respondWithStatusCode(_0x57549f,_0x237e28){_0x237e28=_0x237e28||0xcc;return function(_0x1ce1ba){if(_0x1ce1ba){return _0x57549f[_0x4935('0x1c')](_0x237e28);}return _0x57549f[_0x4935('0x1d')](_0x237e28)[_0x4935('0x1e')]();};}function respondWithResult(_0x24cc99,_0x395a43){_0x395a43=_0x395a43||0xc8;return function(_0x57d7ed){if(_0x57d7ed){return _0x24cc99[_0x4935('0x1d')](_0x395a43)[_0x4935('0x1f')](_0x57d7ed);}};}function respondWithFilteredResult(_0x165ed3,_0x123300){return function(_0x1f0e81){if(_0x1f0e81){var _0x429ef3=_0x1f0e81['count'],_0x4ebc63=_0x123300[_0x4935('0x20')],_0xd70eff=_0x123300[_0x4935('0x20')]+_0x123300[_0x4935('0x21')],_0x145277;if(_0xd70eff>=_0x429ef3){_0xd70eff=_0x429ef3;_0x145277=0xc8;}else{_0x145277=0xce;}_0x165ed3['status'](_0x145277);return _0x165ed3['set'](_0x4935('0x22'),_0x4ebc63+'-'+_0xd70eff+'/'+_0x429ef3)[_0x4935('0x1f')](_0x1f0e81);}return null;};}function patchUpdates(_0x1ae059){return function(_0x388422){try{jsonpatch[_0x4935('0x23')](_0x388422,_0x1ae059,!![]);}catch(_0x16ab7c){return BPromise[_0x4935('0x24')](_0x16ab7c);}return _0x388422[_0x4935('0x25')]();};}function saveUpdates(_0x58b2f3,_0x2f520a){return function(_0x320d81){if(_0x320d81){return _0x320d81[_0x4935('0x26')](_0x58b2f3)[_0x4935('0x27')](function(_0x52c65a){return _0x52c65a;});}return null;};}function removeEntity(_0x53530f,_0x4dc1f5){return function(_0x36e76a){if(_0x36e76a){return _0x36e76a[_0x4935('0x28')]()[_0x4935('0x27')](function(){_0x53530f[_0x4935('0x1d')](0xcc)[_0x4935('0x1e')]();});}};}function handleEntityNotFound(_0x1c37ba,_0x3784f9){return function(_0x1d53a7){if(!_0x1d53a7){_0x1c37ba[_0x4935('0x1c')](0x194);}return _0x1d53a7;};}function handleError(_0xf4abb2,_0x1d08b5){_0x1d08b5=_0x1d08b5||0x1f4;return function(_0x39d07b){logger[_0x4935('0x29')](_0x39d07b[_0x4935('0x2a')]);if(_0x39d07b[_0x4935('0x2b')]){delete _0x39d07b['name'];}_0xf4abb2['status'](_0x1d08b5)['send'](_0x39d07b);};}function getInteractionUsers(_0x1fc218,_0x76ea7d){return new BPromise(function(_0x4f1163,_0x3f0707){try{if(_0x76ea7d[_0x1fc218['id']]){_0x1fc218[_0x4935('0x2c')]=_[_0x4935('0x2d')](_0x76ea7d[_0x1fc218['id']],function(_0x9fe9f6){return{'id':_0x9fe9f6['id'],'fullname':_0x9fe9f6[_0x4935('0x2e')]};});}}catch(_0x24262e){_0x3f0707(_0x24262e);}_0x4f1163(_0x1fc218);});}function getInteractionTags(_0x28afc2,_0x2fe6da){return new BPromise(function(_0x5b3c8e,_0xb7fe2a){try{if(_0x28afc2[_0x4935('0x2f')]){_0x28afc2['Tags']=[];_0x28afc2['TagIds'][_0x4935('0x30')](',')['forEach'](function(_0x2e8cb1){_0x28afc2[_0x4935('0x31')][_0x4935('0x32')](_0x2fe6da[_0x2e8cb1]);});}delete _0x28afc2['TagIds'];}catch(_0x4bb012){_0xb7fe2a(_0x4bb012);}_0x5b3c8e(_0x28afc2);});}function updateSmsInteraction(_0x415260,_0x2eab83,_0x4fabea){return new BPromise(function(_0x47003b,_0x3260d2){return getInteractionUsers(_0x415260,_0x4fabea)[_0x4935('0x27')](function(_0xb2ce85){return getInteractionTags(_0xb2ce85,_0x2eab83);})[_0x4935('0x27')](function(_0x4a69bc){_0x47003b(_0x4a69bc);})['catch'](function(_0x3d8795){_0x3260d2(_0x3d8795);});});}exports[_0x4935('0x33')]=function(_0x512b7b,_0x4945a7){var _0xb3d934={},_0x51f49b={},_0x7b45d1={'count':0x0,'rows':[]};var _0x3f32fb=_[_0x4935('0x2d')](db[_0x4935('0x34')][_0x4935('0x35')],function(_0x36d0b9){return{'name':_0x36d0b9['fieldName'],'type':_0x36d0b9[_0x4935('0x36')]['key']};});_0x51f49b[_0x4935('0x37')]=_['map'](_0x3f32fb,_0x4935('0x2b'));_0x51f49b['query']=_[_0x4935('0x38')](_0x512b7b[_0x4935('0x39')]);_0x51f49b[_0x4935('0x3a')]=_[_0x4935('0x3b')](_0x51f49b[_0x4935('0x37')],_0x51f49b[_0x4935('0x39')]);_0xb3d934[_0x4935('0x3c')]=_['intersection'](_0x51f49b['model'],qs[_0x4935('0x3d')](_0x512b7b['query']['fields']));_0xb3d934[_0x4935('0x3c')]=_0xb3d934['attributes'][_0x4935('0x3e')]?_0xb3d934[_0x4935('0x3c')]:_0x51f49b[_0x4935('0x37')];if(!_0x512b7b[_0x4935('0x39')][_0x4935('0x3f')]('nolimit')){_0xb3d934['limit']=qs[_0x4935('0x21')](_0x512b7b[_0x4935('0x39')][_0x4935('0x21')]);_0xb3d934[_0x4935('0x20')]=qs[_0x4935('0x20')](_0x512b7b[_0x4935('0x39')][_0x4935('0x20')]);}_0xb3d934[_0x4935('0x40')]=qs['sort'](_0x512b7b['query'][_0x4935('0x41')]);_0xb3d934[_0x4935('0x42')]=qs['filters'](_[_0x4935('0x43')](_0x512b7b[_0x4935('0x39')],_0x51f49b[_0x4935('0x3a')]),_0x3f32fb);var _0xe5c9f5=[];var _0x52ab0c=squel['select']()[_0x4935('0x44')]('id')[_0x4935('0x44')]('name')[_0x4935('0x44')](_0x4935('0x45'))[_0x4935('0x46')]('tools_tags');var _0x1a93c8=squel[_0x4935('0x47')]()[_0x4935('0x44')](_0x4935('0x48'))[_0x4935('0x44')](_0x4935('0x49'))[_0x4935('0x44')](_0x4935('0x4a'))[_0x4935('0x46')](_0x4935('0x4b'),'ui')[_0x4935('0x4c')](_0x4935('0x4d'),'u',_0x4935('0x4e'));var _0xf4e847=squel[_0x4935('0x47')]()[_0x4935('0x46')](_0x4935('0x4f'),'i')[_0x4935('0x4c')]('cm_contacts','c',_0x4935('0x50'))['left_join'](_0x4935('0x4d'),'o',_0x4935('0x51'))[_0x4935('0x4c')](_0x4935('0x52'),'a','a.id\x20=\x20i.SmsAccountId')[_0x4935('0x4c')](_0x4935('0x53'),'me',_0x4935('0x54'))[_0x4935('0x4c')](_0x4935('0x55'),'it',_0x4935('0x56'))[_0x4935('0x4c')](_0x4935('0x57'),'t',_0x4935('0x58'));var _0x392cba=squel['expr']();var _0x2e001b=[];var _0x1c3d9c=squel['expr']();var _0x447a64;if(_0x512b7b[_0x4935('0x39')][_0x4935('0x59')]){_0x447a64=as[_0x4935('0x5a')](_0x512b7b[_0x4935('0x39')][_0x4935('0x59')]);var _0x289c5e=_0x447a64[_0x4935('0x5b')];for(var _0x4b9c70=0x0;_0x4b9c70<_0x447a64[_0x4935('0x5c')]['length'];_0x4b9c70++){var _0x561fa3=_0x447a64[_0x4935('0x5c')][_0x4b9c70];var _0x189071='i';var _0x41c6d0=_[_0x4935('0x5d')](_0x3f32fb,[_0x4935('0x2b'),_0x561fa3['field']]);if(!_0x41c6d0){switch(_0x561fa3[_0x4935('0x44')]){case _0x4935('0x5e'):if(_0x561fa3[_0x4935('0x5f')]==0x1){_0xf4e847[_0x4935('0x60')]('`'+_0x561fa3[_0x4935('0x44')]+_0x4935('0x61'));}else{_0xf4e847[_0x4935('0x60')]('`'+_0x561fa3[_0x4935('0x44')]+_0x4935('0x62'));}break;case _0x4935('0x63'):if(_0x561fa3['operator']===_0x4935('0x64')){if(_0x561fa3['value'][_0x4935('0x30')]('\x20')[_0x4935('0x3e')]>0x1){_0x392cba[_0x289c5e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4935('0x65')](_0x561fa3['value']),null);}else{var _0x58a89b='%'+_0x561fa3['value']+'%';_0x392cba[_0x289c5e](_0x4935('0x66'),_0x58a89b,_0x58a89b,_0x58a89b);}}else{_0x41c6d0=_[_0x4935('0x5d')](_0x3f32fb,[_0x4935('0x2b'),_0x4935('0x67')]);_0x561fa3[_0x4935('0x44')]='ContactId';_0x3003a6=as['buildExpression'](_0x189071,_0x41c6d0[_0x4935('0x36')],_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6[_0x4935('0x68')],_0x3003a6[_0x4935('0x5f')]['start'],_0x3003a6[_0x4935('0x5f')][_0x4935('0x1e')]);}break;case _0x4935('0x69'):var _0xc92288=_0x561fa3['value'][_0x4935('0x30')](',')['map'](function(_0x5093a5){return Number(_0x5093a5);});_0xc92288['forEach'](function(_0x24d870){_0x1c3d9c['or'](_0x4935('0x6a'),'%,'+_0x24d870+',%');});_0x2e001b=_['union'](_0x2e001b,_0xc92288);break;case _0x4935('0x6b'):if(_0x561fa3[_0x4935('0x6c')]==='$substring'){_0x392cba[_0x289c5e](_0x4935('0x6d'),'%'+_0x561fa3[_0x4935('0x5f')]+'%',null);}else{_0x41c6d0=_[_0x4935('0x5d')](_0x3f32fb,[_0x4935('0x2b'),_0x4935('0x6e')]);_0x561fa3[_0x4935('0x44')]=_0x4935('0x6e');_0x3003a6=as['buildExpression'](_0x189071,_0x41c6d0[_0x4935('0x36')],_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6['text'],_0x3003a6['value'][_0x4935('0x6f')],_0x3003a6[_0x4935('0x5f')]['end']);}break;case'body':_0x3003a6=as[_0x4935('0x70')]('me',null,_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6[_0x4935('0x68')],_0x3003a6[_0x4935('0x5f')]['start'],_0x3003a6[_0x4935('0x5f')]['end']);break;}}else{var _0x3003a6=as[_0x4935('0x70')](_0x189071,_0x41c6d0[_0x4935('0x36')],_0x561fa3);_0x392cba[_0x289c5e](_0x3003a6[_0x4935('0x68')],_0x3003a6[_0x4935('0x5f')]['start'],_0x3003a6[_0x4935('0x5f')][_0x4935('0x1e')]);}}}else{var _0x5aef06=_(_0x512b7b[_0x4935('0x39')])[_0x4935('0x38')]()[_0x4935('0x2d')](function(_0x2046b2){return _[_0x4935('0x71')](_0x3f32fb,[_0x4935('0x2b'),_0x2046b2])?_0x2046b2:undefined;})[_0x4935('0x72')]()[_0x4935('0x5f')]();if(!_[_0x4935('0x73')](_0x5aef06)){_0x5aef06[_0x4935('0x74')](function(_0x44d6a0){if(_0x44d6a0==='SmsAccountId'){_0xf4e847[_0x4935('0x42')](_0x4935('0x75'),[][_0x4935('0x76')](_0x512b7b[_0x4935('0x39')][_0x44d6a0]));}else if(_0x44d6a0===_0x4935('0x77')){var _0x95da52=JSON[_0x4935('0x78')](_0x512b7b[_0x4935('0x39')][_0x44d6a0])[_0x4935('0x79')];var _0x19d5d0=JSON[_0x4935('0x78')](_0x512b7b[_0x4935('0x39')][_0x44d6a0])[_0x4935('0x7a')];_0xf4e847['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x95da52,_0x19d5d0);}else{if(_0x512b7b[_0x4935('0x39')][_0x44d6a0]===_0x4935('0x7b')){_0xf4e847['where']('i.'+_0x44d6a0+_0x4935('0x7c'));}else{_0xf4e847[_0x4935('0x42')]('i.'+_0x44d6a0+'\x20=\x20?',_0x512b7b['query'][_0x44d6a0]);}}});}if(_0x512b7b[_0x4935('0x39')][_0x4935('0x7d')]){if(_0x512b7b[_0x4935('0x39')][_0x4935('0x7d')]==0x1){_0xf4e847[_0x4935('0x60')]('`unreadMessages`\x20=\x200');}else{_0xf4e847[_0x4935('0x60')](_0x4935('0x7e'));}}if(_0x512b7b[_0x4935('0x39')][_0x4935('0x7f')]){_0x2e001b=_['isArray'](_0x512b7b[_0x4935('0x39')]['tag'])?_0x512b7b['query'][_0x4935('0x7f')]:new Array(_0x512b7b[_0x4935('0x39')]['tag']);_0x2e001b[_0x4935('0x74')](function(_0x22d594){_0x1c3d9c['or'](_0x4935('0x6a'),'%,'+_0x22d594+',%');});}if(_0x512b7b['query'][_0x4935('0x80')]){var _0x4ac1b8=_0x512b7b['query'][_0x4935('0x80')][_0x4935('0x81')]('\x5c','\x5c\x5c')[_0x4935('0x81')]('\x27\x27',_0x4935('0x82'));if(qs[_0x4935('0x83')](_0x4ac1b8)){_0x392cba['or'](_0x4935('0x84'),_0x4ac1b8+'%')['or'](_0x4935('0x85'),_0x4ac1b8+'%');}else{_0x392cba['or'](_0x4935('0x86'),qs['getFullTextValue'](_0x4ac1b8))['or'](_0x4935('0x87'),_0x4ac1b8+'%');}}}_0xf4e847[_0x4935('0x42')](_0x392cba);_0xf4e847[_0x4935('0x88')]('i.id');var _0x47f144={'type':db[_0x4935('0x89')][_0x4935('0x8a')]['SELECT'],'raw':!![]};var _0x2f47bc=_0xf4e847['clone']();_0x2f47bc['field'](_0x4935('0x8b'));_0x2f47bc[_0x4935('0x44')](_0x4935('0x8c'),'unreadMessages');if(_0xb3d934['order']){_0xb3d934[_0x4935('0x40')]['forEach'](function(_0x3b9fa6){_0xf4e847['order']('i.'+_0x3b9fa6[0x0],_0x3b9fa6[0x1]===_0x4935('0x8d')?![]:!![]);});}if(!_[_0x4935('0x73')](_0x2e001b)){_0xf4e847[_0x4935('0x60')](_0x1c3d9c);_0x2f47bc[_0x4935('0x42')](_0x4935('0x8e'),_0x2e001b);}BPromise[_0x4935('0x8f')]()[_0x4935('0x27')](function(){if(!_0x447a64){if(_0x512b7b['query'][_0x4935('0x90')]||_0x512b7b['query'][_0x4935('0x91')])return;_0x2f47bc[_0x4935('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0xf4e847[_0x4935('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x512b7b[_0x4935('0x92')][_0x4935('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x582a2c){if(_['isEmpty'](_0x582a2c)){_0x2f47bc[_0x4935('0x42')]('i.SmsAccountId\x20IS\x20NULL');_0xf4e847['where'](_0x4935('0x94'));}else{_0x2f47bc['where'](_0x4935('0x75'),_['map'](_0x582a2c,'id'));_0xf4e847['where']('i.SmsAccountId\x20IN\x20?',_[_0x4935('0x2d')](_0x582a2c,'id'));}});})['then'](function(){db[_0x4935('0x95')][_0x4935('0x39')](_0x2f47bc[_0x4935('0x96')](),_0x47f144)[_0x4935('0x27')](function(_0x32495e){_0x7b45d1['count']=_0x32495e[_0x4935('0x3e')];if(_0x7b45d1[_0x4935('0x97')]===0x0)return[];return db['sequelize'][_0x4935('0x39')](_0x52ab0c[_0x4935('0x96')](),_0x47f144)['then'](function(_0x1ffef1){_0xe5c9f5=_[_0x4935('0x98')](_0x1ffef1,'id');_0x47f144=_['merge'](_0x47f144,{'model':db[_0x4935('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x512b7b['query'][_0x4935('0x3d')]){_0xb3d934[_0x4935('0x3c')]['forEach'](function(_0x3515c9){_0xf4e847[_0x4935('0x44')]('i.'+_0x3515c9);});}else{_0xf4e847['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4935('0x5e'));_0xf4e847[_0x4935('0x44')]('a.key',_0x4935('0x99'));_0xf4e847[_0x4935('0x44')](_0x4935('0x9a'),_0x4935('0x9b'));_0xf4e847['field'](_0x4935('0x9c'));_0xf4e847[_0x4935('0x44')]('c.firstName',_0x4935('0x9d'));_0xf4e847[_0x4935('0x44')](_0x4935('0x9e'),_0x4935('0x9f'));_0xf4e847[_0x4935('0x44')](_0x4935('0xa0'),_0x4935('0xa1'));_0xf4e847[_0x4935('0x44')](_0x4935('0xa2'),_0x4935('0xa3'));_0xf4e847[_0x4935('0x44')]('c.mobile',_0x4935('0xa4'));_0xf4e847[_0x4935('0x44')](_0x4935('0xa5'),_0x4935('0xa6'));_0xf4e847[_0x4935('0x44')]('o.fullname',_0x4935('0xa7'));_0xf4e847[_0x4935('0x44')]('o.internal',_0x4935('0xa8'));_0xf4e847[_0x4935('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4935('0x2f'));}if(_0xb3d934[_0x4935('0x21')])_0xf4e847[_0x4935('0x21')](_0xb3d934['limit']);if(_0xb3d934[_0x4935('0x20')])_0xf4e847[_0x4935('0x20')](_0xb3d934[_0x4935('0x20')]);return db[_0x4935('0x95')][_0x4935('0x39')](_0xf4e847['toString'](),_0x47f144);})[_0x4935('0x27')](function(_0x39901d){_0x1a93c8[_0x4935('0x42')](_0x4935('0xa9'),_[_0x4935('0x2d')](_0x39901d,'id'));return db[_0x4935('0x95')]['query'](_0x1a93c8[_0x4935('0x96')](),_0x47f144)[_0x4935('0x27')](function(_0x60bb5f){var _0x13ca4f=_[_0x4935('0xaa')](_0x60bb5f,_0x4935('0xab'));var _0x23fd89=[];_0x39901d['forEach'](function(_0x107897){_0x23fd89[_0x4935('0x32')](updateSmsInteraction(_0x107897,_0xe5c9f5,_0x13ca4f));});return BPromise[_0x4935('0xac')](_0x23fd89);});});})[_0x4935('0x27')](function(_0x35a451){_0x7b45d1['rows']=_0x35a451;return _0x7b45d1;})['then'](respondWithFilteredResult(_0x4945a7,_0xb3d934));})[_0x4935('0xad')](handleError(_0x4945a7,null));};exports[_0x4935('0xae')]=function(_0x463226,_0xe3bc97){var _0x190aa0={'raw':![],'where':{'id':_0x463226[_0x4935('0xaf')]['id']}},_0x515506={};_0x515506[_0x4935('0x37')]=_[_0x4935('0x38')](db['SmsInteraction'][_0x4935('0x35')]);_0x515506[_0x4935('0x39')]=_[_0x4935('0x38')](_0x463226[_0x4935('0x39')]);_0x515506[_0x4935('0x3a')]=_[_0x4935('0x3b')](_0x515506[_0x4935('0x37')],_0x515506['query']);_0x190aa0[_0x4935('0x3c')]=_['intersection'](_0x515506[_0x4935('0x37')],qs['fields'](_0x463226['query'][_0x4935('0x3d')]));_0x190aa0['attributes']=_0x190aa0['attributes'][_0x4935('0x3e')]?_0x190aa0[_0x4935('0x3c')]:_0x515506['model'];if(_0x463226[_0x4935('0x39')]['includeAll']){_0x190aa0[_0x4935('0xb0')]=[{'all':!![]}];}_0x190aa0=_[_0x4935('0xb1')]({},_0x190aa0,_0x463226[_0x4935('0xb2')]);return db[_0x4935('0x34')][_0x4935('0x5d')](_0x190aa0)[_0x4935('0x27')](handleEntityNotFound(_0xe3bc97,null))['then'](respondWithResult(_0xe3bc97,null))[_0x4935('0xad')](handleError(_0xe3bc97,null));};exports[_0x4935('0xb3')]=function(_0xce134a,_0x5d53e6){return db[_0x4935('0x34')][_0x4935('0xb3')](_0xce134a[_0x4935('0xb4')],{})['then'](respondWithResult(_0x5d53e6,0xc9))[_0x4935('0xad')](handleError(_0x5d53e6,null));};exports[_0x4935('0x26')]=function(_0x401ea7,_0x23b6eb){if(_0x401ea7[_0x4935('0xb4')]['id']){delete _0x401ea7['body']['id'];}return db[_0x4935('0x34')]['find']({'where':{'id':_0x401ea7[_0x4935('0xaf')]['id']}})['then'](handleEntityNotFound(_0x23b6eb,null))[_0x4935('0x27')](saveUpdates(_0x401ea7['body'],null))[_0x4935('0x27')](respondWithResult(_0x23b6eb,null))[_0x4935('0xad')](handleError(_0x23b6eb,null));};exports[_0x4935('0x28')]=function(_0x5d9398,_0x31d209){return db[_0x4935('0x34')][_0x4935('0x5d')]({'where':{'id':_0x5d9398[_0x4935('0xaf')]['id']}})[_0x4935('0x27')](handleEntityNotFound(_0x31d209,null))[_0x4935('0x27')](removeEntity(_0x31d209,null))[_0x4935('0xad')](handleError(_0x31d209,null));};exports[_0x4935('0xb5')]=function(_0xc4ce1d,_0x575ca2){return db[_0x4935('0x34')][_0x4935('0xb5')]()[_0x4935('0x27')](respondWithResult(_0x575ca2,null))[_0x4935('0xad')](handleError(_0x575ca2,null));};exports[_0x4935('0xb6')]=function(_0x203750,_0x3f2d82,_0x5107d4){return db['SmsMessage'][_0x4935('0x5d')]({'where':{'id':_0x203750['params']['id']}})['then'](handleEntityNotFound(_0x3f2d82,null))[_0x4935('0x27')](function(_0x3a4266){if(_0x3a4266){return _0x3a4266[_0x4935('0xb6')](_0x203750[_0x4935('0xb4')]['ids'],_[_0x4935('0xb7')](_0x203750[_0x4935('0xb4')],['ids','id'])||{});}})['then'](respondWithResult(_0x3f2d82,null))['catch'](handleError(_0x3f2d82,null));};exports['getMessages']=function(_0x4d0933,_0x38c352,_0x14d6b8){var _0x5ec439={'raw':![],'where':{}};var _0x492bfb={};var _0x5665bf={'count':0x0,'rows':[]};return db[_0x4935('0x34')][_0x4935('0xb8')]({'where':{'id':_0x4d0933[_0x4935('0xaf')]['id']}})['then'](handleEntityNotFound(_0x38c352,null))['then'](function(_0x598350){if(_0x598350){_0x492bfb[_0x4935('0x37')]=_[_0x4935('0x38')](db[_0x4935('0xb9')][_0x4935('0x35')]);_0x492bfb['query']=_[_0x4935('0x38')](_0x4d0933[_0x4935('0x39')]);_0x492bfb[_0x4935('0x3a')]=_['intersection'](_0x492bfb['model'],_0x492bfb[_0x4935('0x39')]);_0x5ec439[_0x4935('0x3c')]=_[_0x4935('0x3b')](_0x492bfb[_0x4935('0x37')],qs[_0x4935('0x3d')](_0x4d0933[_0x4935('0x39')][_0x4935('0x3d')]));_0x5ec439[_0x4935('0x3c')]=_0x5ec439[_0x4935('0x3c')]['length']?_0x5ec439[_0x4935('0x3c')]:_0x492bfb[_0x4935('0x37')];if(!_0x4d0933['query']['hasOwnProperty'](_0x4935('0xba'))){_0x5ec439['limit']=qs[_0x4935('0x21')](_0x4d0933[_0x4935('0x39')]['limit']);_0x5ec439[_0x4935('0x20')]=qs['offset'](_0x4d0933[_0x4935('0x39')][_0x4935('0x20')]);}_0x5ec439['order']=qs['sort'](_0x4d0933[_0x4935('0x39')][_0x4935('0x41')]);_0x5ec439[_0x4935('0x42')]=qs[_0x4935('0x3a')](_[_0x4935('0x43')](_0x4d0933[_0x4935('0x39')],_0x492bfb[_0x4935('0x3a')]));_0x5ec439[_0x4935('0x42')]['SmsInteractionId']=_0x598350['id'];if(_0x4d0933['query'][_0x4935('0x80')]){_0x5ec439[_0x4935('0x42')]=_[_0x4935('0xb1')](_0x5ec439[_0x4935('0x42')],{'$or':_[_0x4935('0x2d')](_0x5ec439[_0x4935('0x3c')],function(_0x3f13d7){var _0x26c2f9={};_0x26c2f9[_0x3f13d7]={'$like':'%'+_0x4d0933['query'][_0x4935('0x80')]+'%'};return _0x26c2f9;})});}if(_0x4d0933['query'][_0x4935('0x79')]){var _0x52a661=_0x4d0933[_0x4935('0x39')][_0x4935('0x79')][_0x4935('0x30')](',');var _0x409d86={};_0x409d86[_0x52a661[0x0]]={'$gte':moment(_0x52a661[0x1])[_0x4935('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5ec439[_0x4935('0x42')]=_[_0x4935('0xb1')](_0x5ec439[_0x4935('0x42')],_0x409d86);}_0x5ec439=_['merge']({},_0x5ec439,_0x4d0933['options']);return db[_0x4935('0xb9')]['count']({'where':_0x5ec439[_0x4935('0x42')]})[_0x4935('0x27')](function(_0x3faf56){_0x5665bf[_0x4935('0x97')]=_0x3faf56;if(_0x4d0933[_0x4935('0x39')]['includeAll']){_0x5ec439[_0x4935('0xb0')]=[{'all':!![]}];}return db[_0x4935('0xb9')][_0x4935('0xbc')](_0x5ec439);})[_0x4935('0x27')](function(_0x46eebd){_0x5665bf['rows']=_0x46eebd;return _0x5665bf;});}})[_0x4935('0x27')](respondWithFilteredResult(_0x38c352,_0x5ec439))[_0x4935('0xad')](handleError(_0x38c352,null));};exports[_0x4935('0xbd')]=function(_0x19aa4e,_0x51a95e,_0x4aa286){return db['SmsInteraction']['find']({'where':{'id':_0x19aa4e[_0x4935('0xaf')]['id']}})[_0x4935('0x27')](handleEntityNotFound(_0x51a95e,null))[_0x4935('0x27')](function(_0x41cab4){if(_0x41cab4){return _0x41cab4[_0x4935('0xbe')](_0x19aa4e[_0x4935('0xb4')][_0x4935('0xbf')],_[_0x4935('0xb7')](_0x19aa4e[_0x4935('0xb4')],[_0x4935('0xbf'),'id'])||{})['spread'](function(){return db[_0x4935('0x69')][_0x4935('0xbc')]({'attributes':['id',_0x4935('0x2b'),_0x4935('0x45')],'where':{'id':_0x19aa4e[_0x4935('0xb4')][_0x4935('0xbf')]}});})[_0x4935('0x27')](function(_0x1da775){socket[_0x4935('0xc0')]('smsInteractionTags:save',{'id':Number(_0x19aa4e['params']['id']),'tags':_0x1da775||[]});return{'id':Number(_0x19aa4e[_0x4935('0xaf')]['id']),'tags':_0x1da775||[]};});}})[_0x4935('0x27')](respondWithResult(_0x51a95e,null))[_0x4935('0xad')](handleError(_0x51a95e,null));};exports[_0x4935('0xc1')]=function(_0x181fa8,_0x161f14,_0x1c55ad){return db[_0x4935('0x34')]['find']({'where':{'id':_0x181fa8[_0x4935('0xaf')]['id']}})[_0x4935('0x27')](handleEntityNotFound(_0x161f14,null))['then'](function(_0x46f309){if(_0x46f309){return _0x46f309['removeTags'](_0x181fa8[_0x4935('0x39')][_0x4935('0xbf')]);}})[_0x4935('0x27')](respondWithStatusCode(_0x161f14,null))[_0x4935('0xad')](handleError(_0x161f14,null));};exports[_0x4935('0xc2')]=function(_0x37a095,_0x70c9b6){var _0x379b5e=moment()[_0x4935('0xc3')]()[_0x4935('0x96')]();var _0x4ace12=path[_0x4935('0xc4')](config['root'],_0x4935('0xc5'),_0x4935('0xc6'),_0x4935('0xc7'));var _0x3b66fe=path[_0x4935('0xc4')](config['root'],_0x4935('0xc5'),_0x4935('0xc6'),_0x4935('0xc8'));var _0x1ac8bc=path[_0x4935('0xc4')](_0x4ace12,_0x379b5e);var _0x260829=util[_0x4935('0xbb')](_0x4935('0xc9'),_0x37a095[_0x4935('0xaf')]['id'],_0x379b5e);var _0x37ea56=path[_0x4935('0xc4')](_0x4ace12,_0x260829);var _0xdd0d0b=[];_0xdd0d0b['push']({'model':db[_0x4935('0x6b')],'as':_0x4935('0x6b'),'attributes':['id',_0x4935('0x2e')],'raw':!![]});_0xdd0d0b['push']({'model':db[_0x4935('0xca')],'as':'Contact','attributes':['id',_0x4935('0xcb'),_0x4935('0xcc')],'raw':!![]});var _0x216ef8=[{'model':db[_0x4935('0xb9')],'as':_0x4935('0xcd'),'attributes':['id','body',_0x4935('0x77'),_0x4935('0xce'),_0x4935('0xcf'),_0x4935('0x7d')],'include':_0xdd0d0b}];_0x216ef8['push']({'model':db[_0x4935('0xd0')],'as':_0x4935('0xd1'),'attributes':['id',_0x4935('0x2b')]});_0x216ef8[_0x4935('0x32')]({'model':db[_0x4935('0x6b')],'as':_0x4935('0xd2'),'attributes':['id',_0x4935('0x2e')]});return db[_0x4935('0x34')]['find']({'where':{'id':_0x37a095[_0x4935('0xaf')]['id']},'include':_0x216ef8})[_0x4935('0x27')](handleEntityNotFound(_0x70c9b6,null))[_0x4935('0x27')](function(_0x50a224){if(_0x50a224){var _0x3d508b=_0x50a224[_0x4935('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x1ac8bc);var _0x50c9da={'format':'A4','border':_0x4935('0xd4'),'header':{'height':_0x4935('0xd5'),'contents':{'first':_0x4935('0xd6')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x4935('0xbb')](_0x4935('0xd7'),_0x4935('0xd8'),_0x3d508b['id']),moment()[_0x4935('0xbb')](_0x4935('0xd9'))['toString']())}}};var _0x15c87c={'channel':'Sms','account':_0x3d508b['Account']['name'],'agent':_0x3d508b[_0x4935('0xd2')]?_0x3d508b[_0x4935('0xd2')][_0x4935('0x2e')]:'N.A.','createdAt':moment(_0x3d508b[_0x4935('0x77')])[_0x4935('0xbb')](_0x4935('0xda'))['toString'](),'closedAt':_0x3d508b[_0x4935('0xdb')]?moment(_0x3d508b[_0x4935('0xdc')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4935('0x96')]():'','disposition':_0x3d508b['disposition'],'messages':_(_0x3d508b[_0x4935('0xcd')])[_0x4935('0x80')]({'secret':![]})['map'](function(_0x2b4cb9){return{'date':moment(_0x2b4cb9['createdAt'])['format'](_0x4935('0xda'))[_0x4935('0x96')](),'sender':_0x2b4cb9[_0x4935('0xce')]===_0x4935('0xdd')?_0x2b4cb9[_0x4935('0x6b')]?_0x2b4cb9[_0x4935('0x6b')][_0x4935('0x2e')]:'System':_0x2b4cb9[_0x4935('0x63')]['firstName']+(_0x2b4cb9[_0x4935('0x63')][_0x4935('0xcc')]?'\x20'+_0x2b4cb9[_0x4935('0x63')][_0x4935('0xcc')]:''),'body':_0x2b4cb9[_0x4935('0xb4')],'direction':_0x2b4cb9[_0x4935('0xce')]==='out'?'A':'C','secret':_0x2b4cb9['secret'],'read':_0x2b4cb9[_0x4935('0x7d')]};})[_0x4935('0x5f')]()};return ejs[_0x4935('0xde')](path[_0x4935('0xc4')](config[_0x4935('0xdf')],_0x4935('0xc5'),'views',_0x4935('0xe0')),{'interaction':_0x15c87c})[_0x4935('0x27')](function(_0x407dd5){return new BPromise(function(_0x5457c7,_0x5d2d94){pdf[_0x4935('0xb3')](_0x407dd5,_0x50c9da)[_0x4935('0xe1')](path[_0x4935('0xc4')](_0x1ac8bc,_0x4935('0xe2')+_0x3d508b['id']+'-'+_0x379b5e+'.pdf'),function(_0x5aeff4,_0x47402d){if(_0x5aeff4)return _0x5d2d94(_0x5aeff4);_0x5457c7(_0x47402d);});});})[_0x4935('0x27')](function(){return new BPromise(function(_0x538fa5,_0x4b9633){zipdir(_0x1ac8bc,{'saveTo':_0x37ea56},function(_0x2e057d,_0x362ef8){if(_0x2e057d)return _0x4b9633(_0x2e057d);return _0x538fa5(_0x362ef8);});})['then'](function(){return new BPromise(function(_0x4a382c,_0x242c6d){rimraf(_0x1ac8bc,function(_0x20d00f){if(_0x20d00f)_0x242c6d(_0x20d00f);return _0x4a382c();});});})[_0x4935('0x27')](function(){return _0x70c9b6[_0x4935('0xc2')](_0x37ea56,_0x260829,function(_0x27feac){if(_0x27feac){console[_0x4935('0xe3')]('err',_0x27feac);}else{fs[_0x4935('0xe4')](_0x37ea56);}});});});}else{return _0x70c9b6[_0x4935('0x1c')](0xc8);}})[_0x4935('0xad')](handleError(_0x70c9b6,null));}; \ No newline at end of file +var _0x6c76=['conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','show','params','includeAll','include','options','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','intersection','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','files','tmp','server','attachments','CmContact','firstName','lastName','secret','SmsAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','out','System','views','toFile','transcript-','.pdf','log','err','sendStatus','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','offset','limit','apply','reject','update','then','destroy','end','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','users','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator'];(function(_0x364803,_0xcf3b83){var _0xeb0e5d=function(_0x113950){while(--_0x113950){_0x364803['push'](_0x364803['shift']());}};_0xeb0e5d(++_0xcf3b83);}(_0x6c76,0x184));var _0x66c7=function(_0x44e08d,_0x1f8937){_0x44e08d=_0x44e08d-0x0;var _0x483463=_0x6c76[_0x44e08d];return _0x483463;};'use strict';var pdf=require(_0x66c7('0x0'));var emlformat=require(_0x66c7('0x1'));var rimraf=require(_0x66c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66c7('0x3'));var rp=require(_0x66c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x66c7('0x5'));var util=require(_0x66c7('0x6'));var path=require('path');var sox=require(_0x66c7('0x7'));var csv=require(_0x66c7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x8'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var db=require(_0x66c7('0x15'))['db'];config[_0x66c7('0x16')]=_['defaults'](config[_0x66c7('0x16')],{'host':_0x66c7('0x17'),'port':0x18eb});var socket=require(_0x66c7('0x18'))(new Redis(config[_0x66c7('0x16')]));require(_0x66c7('0x19'))[_0x66c7('0x1a')](socket);function respondWithStatusCode(_0x618bd7,_0xf3b04){_0xf3b04=_0xf3b04||0xcc;return function(_0x6400fe){if(_0x6400fe){return _0x618bd7['sendStatus'](_0xf3b04);}return _0x618bd7[_0x66c7('0x1b')](_0xf3b04)['end']();};}function respondWithResult(_0x208010,_0x39f951){_0x39f951=_0x39f951||0xc8;return function(_0x3c81c0){if(_0x3c81c0){return _0x208010[_0x66c7('0x1b')](_0x39f951)[_0x66c7('0x1c')](_0x3c81c0);}};}function respondWithFilteredResult(_0x4e229a,_0x5cf913){return function(_0x53fb36){if(_0x53fb36){var _0x5129f6=_0x53fb36['count'],_0x8ad572=_0x5cf913[_0x66c7('0x1d')],_0x19f29d=_0x5cf913[_0x66c7('0x1d')]+_0x5cf913[_0x66c7('0x1e')],_0x47a299;if(_0x19f29d>=_0x5129f6){_0x19f29d=_0x5129f6;_0x47a299=0xc8;}else{_0x47a299=0xce;}_0x4e229a[_0x66c7('0x1b')](_0x47a299);return _0x4e229a['set']('Content-Range',_0x8ad572+'-'+_0x19f29d+'/'+_0x5129f6)[_0x66c7('0x1c')](_0x53fb36);}return null;};}function patchUpdates(_0x237177){return function(_0xf30f9){try{jsonpatch[_0x66c7('0x1f')](_0xf30f9,_0x237177,!![]);}catch(_0x465457){return BPromise[_0x66c7('0x20')](_0x465457);}return _0xf30f9['save']();};}function saveUpdates(_0x4ddbd2,_0x366e9b){return function(_0x4a2b90){if(_0x4a2b90){return _0x4a2b90[_0x66c7('0x21')](_0x4ddbd2)[_0x66c7('0x22')](function(_0x44bdef){return _0x44bdef;});}return null;};}function removeEntity(_0x1fc9d3,_0x5bfaf6){return function(_0x2736df){if(_0x2736df){return _0x2736df[_0x66c7('0x23')]()['then'](function(){_0x1fc9d3[_0x66c7('0x1b')](0xcc)[_0x66c7('0x24')]();});}};}function handleEntityNotFound(_0x2bb86d,_0x2ef6a2){return function(_0x2af0a3){if(!_0x2af0a3){_0x2bb86d['sendStatus'](0x194);}return _0x2af0a3;};}function handleError(_0x5bc4e6,_0x4e514a){_0x4e514a=_0x4e514a||0x1f4;return function(_0x2dd131){logger[_0x66c7('0x25')](_0x2dd131['stack']);if(_0x2dd131[_0x66c7('0x26')]){delete _0x2dd131[_0x66c7('0x26')];}_0x5bc4e6[_0x66c7('0x1b')](_0x4e514a)[_0x66c7('0x27')](_0x2dd131);};}function getInteractionUsers(_0x36a830,_0x27be81){return new BPromise(function(_0x570f0d,_0xccefb2){try{if(_0x27be81[_0x36a830['id']]){_0x36a830[_0x66c7('0x28')]=_[_0x66c7('0x29')](_0x27be81[_0x36a830['id']],function(_0x33be23){return{'id':_0x33be23['id'],'fullname':_0x33be23[_0x66c7('0x2a')]};});}}catch(_0x592f0e){_0xccefb2(_0x592f0e);}_0x570f0d(_0x36a830);});}function getInteractionTags(_0x263b48,_0x4f1a34){return new BPromise(function(_0xfbd97,_0x543fbf){try{if(_0x263b48[_0x66c7('0x2b')]){_0x263b48[_0x66c7('0x2c')]=[];_0x263b48[_0x66c7('0x2b')][_0x66c7('0x2d')](',')[_0x66c7('0x2e')](function(_0x24e776){_0x263b48['Tags']['push'](_0x4f1a34[_0x24e776]);});}delete _0x263b48[_0x66c7('0x2b')];}catch(_0x12e7c6){_0x543fbf(_0x12e7c6);}_0xfbd97(_0x263b48);});}function updateSmsInteraction(_0x827cbc,_0x3f657e,_0x344345){return new BPromise(function(_0x131f24,_0x44dcde){return getInteractionUsers(_0x827cbc,_0x344345)[_0x66c7('0x22')](function(_0x15edc8){return getInteractionTags(_0x15edc8,_0x3f657e);})[_0x66c7('0x22')](function(_0x1fd460){_0x131f24(_0x1fd460);})[_0x66c7('0x2f')](function(_0x4eb03f){_0x44dcde(_0x4eb03f);});});}exports['index']=function(_0x446bd8,_0x13e7a2){var _0x367ad5={},_0x1b2849={},_0x45050c={'count':0x0,'rows':[]};var _0x2bf7c2=_[_0x66c7('0x29')](db['SmsInteraction'][_0x66c7('0x30')],function(_0x33b7ff){return{'name':_0x33b7ff[_0x66c7('0x31')],'type':_0x33b7ff[_0x66c7('0x32')][_0x66c7('0x33')]};});_0x1b2849[_0x66c7('0x34')]=_[_0x66c7('0x29')](_0x2bf7c2,_0x66c7('0x26'));_0x1b2849[_0x66c7('0x35')]=_[_0x66c7('0x36')](_0x446bd8[_0x66c7('0x35')]);_0x1b2849['filters']=_['intersection'](_0x1b2849[_0x66c7('0x34')],_0x1b2849[_0x66c7('0x35')]);_0x367ad5[_0x66c7('0x37')]=_['intersection'](_0x1b2849['model'],qs[_0x66c7('0x38')](_0x446bd8[_0x66c7('0x35')]['fields']));_0x367ad5[_0x66c7('0x37')]=_0x367ad5[_0x66c7('0x37')][_0x66c7('0x39')]?_0x367ad5['attributes']:_0x1b2849[_0x66c7('0x34')];if(!_0x446bd8[_0x66c7('0x35')][_0x66c7('0x3a')](_0x66c7('0x3b'))){_0x367ad5[_0x66c7('0x1e')]=qs[_0x66c7('0x1e')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x1e')]);_0x367ad5[_0x66c7('0x1d')]=qs['offset'](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x1d')]);}_0x367ad5[_0x66c7('0x3c')]=qs[_0x66c7('0x3d')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x3d')]);_0x367ad5[_0x66c7('0x3e')]=qs[_0x66c7('0x3f')](_[_0x66c7('0x40')](_0x446bd8[_0x66c7('0x35')],_0x1b2849['filters']),_0x2bf7c2);var _0x5bb5fc=[];var _0x528f5c=squel[_0x66c7('0x41')]()[_0x66c7('0x42')]('id')['field']('name')[_0x66c7('0x42')](_0x66c7('0x43'))[_0x66c7('0x44')](_0x66c7('0x45'));var _0x2c5269=squel['select']()[_0x66c7('0x42')]('u.id')['field'](_0x66c7('0x46'))[_0x66c7('0x42')](_0x66c7('0x47'))[_0x66c7('0x44')]('user_has_sms_interactions','ui')['left_join'](_0x66c7('0x48'),'u','u.id\x20=\x20ui.UserId');var _0x4e0c89=squel[_0x66c7('0x41')]()[_0x66c7('0x44')](_0x66c7('0x49'),'i')[_0x66c7('0x4a')]('cm_contacts','c',_0x66c7('0x4b'))[_0x66c7('0x4a')](_0x66c7('0x48'),'o','o.id\x20=\x20i.UserId')[_0x66c7('0x4a')](_0x66c7('0x4c'),'a',_0x66c7('0x4d'))[_0x66c7('0x4a')](_0x66c7('0x4e'),'me',_0x66c7('0x4f'))[_0x66c7('0x4a')](_0x66c7('0x50'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x66c7('0x4a')](_0x66c7('0x45'),'t',_0x66c7('0x51'));var _0x1386a2=squel[_0x66c7('0x52')]();var _0x2f766e=[];var _0x2cd0c6=squel[_0x66c7('0x52')]();var _0x1b3dc2;if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x53')]){_0x1b3dc2=as[_0x66c7('0x54')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x53')]);var _0x47e766=_0x1b3dc2[_0x66c7('0x55')];for(var _0x225fb6=0x0;_0x225fb6<_0x1b3dc2[_0x66c7('0x56')][_0x66c7('0x39')];_0x225fb6++){var _0x533ff5=_0x1b3dc2[_0x66c7('0x56')][_0x225fb6];var _0x1a159f='i';var _0x55e026=_[_0x66c7('0x57')](_0x2bf7c2,[_0x66c7('0x26'),_0x533ff5[_0x66c7('0x42')]]);if(!_0x55e026){switch(_0x533ff5[_0x66c7('0x42')]){case _0x66c7('0x58'):if(_0x533ff5[_0x66c7('0x59')]==0x1){_0x4e0c89[_0x66c7('0x5a')]('`'+_0x533ff5['field']+_0x66c7('0x5b'));}else{_0x4e0c89[_0x66c7('0x5a')]('`'+_0x533ff5['field']+_0x66c7('0x5c'));}break;case _0x66c7('0x5d'):if(_0x533ff5[_0x66c7('0x5e')]==='$substring'){if(_0x533ff5[_0x66c7('0x59')][_0x66c7('0x2d')]('\x20')[_0x66c7('0x39')]>0x1){_0x1386a2[_0x47e766](_0x66c7('0x5f'),qs[_0x66c7('0x60')](_0x533ff5[_0x66c7('0x59')]),null);}else{var _0x1d8313='%'+_0x533ff5[_0x66c7('0x59')]+'%';_0x1386a2[_0x47e766]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1d8313,_0x1d8313,_0x1d8313);}}else{_0x55e026=_[_0x66c7('0x57')](_0x2bf7c2,[_0x66c7('0x26'),'ContactId']);_0x533ff5[_0x66c7('0x42')]=_0x66c7('0x61');_0xa75268=as[_0x66c7('0x62')](_0x1a159f,_0x55e026['type'],_0x533ff5);_0x1386a2[_0x47e766](_0xa75268['text'],_0xa75268[_0x66c7('0x59')]['start'],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);}break;case _0x66c7('0x63'):var _0x106b1e=_0x533ff5[_0x66c7('0x59')][_0x66c7('0x2d')](',')['map'](function(_0x58f938){return Number(_0x58f938);});_0x106b1e[_0x66c7('0x2e')](function(_0x3c3c63){_0x2cd0c6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c3c63+',%');});_0x2f766e=_['union'](_0x2f766e,_0x106b1e);break;case _0x66c7('0x64'):if(_0x533ff5['operator']===_0x66c7('0x65')){_0x1386a2[_0x47e766](_0x66c7('0x66'),'%'+_0x533ff5[_0x66c7('0x59')]+'%',null);}else{_0x55e026=_[_0x66c7('0x57')](_0x2bf7c2,['name',_0x66c7('0x67')]);_0x533ff5[_0x66c7('0x42')]=_0x66c7('0x67');_0xa75268=as[_0x66c7('0x62')](_0x1a159f,_0x55e026[_0x66c7('0x32')],_0x533ff5);_0x1386a2[_0x47e766](_0xa75268[_0x66c7('0x68')],_0xa75268['value'][_0x66c7('0x69')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);}break;case'body':_0xa75268=as[_0x66c7('0x62')]('me',null,_0x533ff5);_0x1386a2[_0x47e766](_0xa75268['text'],_0xa75268[_0x66c7('0x59')][_0x66c7('0x69')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);break;}}else{var _0xa75268=as[_0x66c7('0x62')](_0x1a159f,_0x55e026['type'],_0x533ff5);_0x1386a2[_0x47e766](_0xa75268[_0x66c7('0x68')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x69')],_0xa75268[_0x66c7('0x59')][_0x66c7('0x24')]);}}}else{var _0x50e4be=_(_0x446bd8[_0x66c7('0x35')])[_0x66c7('0x36')]()[_0x66c7('0x29')](function(_0x37f244){return _[_0x66c7('0x6a')](_0x2bf7c2,[_0x66c7('0x26'),_0x37f244])?_0x37f244:undefined;})[_0x66c7('0x6b')]()[_0x66c7('0x59')]();if(!_[_0x66c7('0x6c')](_0x50e4be)){_0x50e4be[_0x66c7('0x2e')](function(_0x2e26e){if(_0x2e26e===_0x66c7('0x6d')){_0x4e0c89['where'](_0x66c7('0x6e'),[][_0x66c7('0x6f')](_0x446bd8[_0x66c7('0x35')][_0x2e26e]));}else if(_0x2e26e===_0x66c7('0x70')){var _0x1a7e10=JSON[_0x66c7('0x71')](_0x446bd8[_0x66c7('0x35')][_0x2e26e])['$gte'];var _0xe3f51=JSON[_0x66c7('0x71')](_0x446bd8[_0x66c7('0x35')][_0x2e26e])[_0x66c7('0x72')];_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x73'),_0x1a7e10,_0xe3f51);}else{if(_0x446bd8[_0x66c7('0x35')][_0x2e26e]===_0x66c7('0x74')){_0x4e0c89[_0x66c7('0x3e')]('i.'+_0x2e26e+_0x66c7('0x75'));}else{_0x4e0c89[_0x66c7('0x3e')]('i.'+_0x2e26e+_0x66c7('0x76'),_0x446bd8[_0x66c7('0x35')][_0x2e26e]);}}});}if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x77')]){if(_0x446bd8[_0x66c7('0x35')]['read']==0x1){_0x4e0c89[_0x66c7('0x5a')](_0x66c7('0x78'));}else{_0x4e0c89[_0x66c7('0x5a')](_0x66c7('0x79'));}}if(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')]){_0x2f766e=_[_0x66c7('0x7b')](_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')])?_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')]:new Array(_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7a')]);_0x2f766e[_0x66c7('0x2e')](function(_0x3263ab){_0x2cd0c6['or'](_0x66c7('0x7c'),'%,'+_0x3263ab+',%');});}if(_0x446bd8[_0x66c7('0x35')]['filter']){var _0x42485b=_0x446bd8[_0x66c7('0x35')][_0x66c7('0x7d')][_0x66c7('0x7e')]('\x5c','\x5c\x5c')[_0x66c7('0x7e')]('\x27\x27',_0x66c7('0x7f'));if(qs['isNumeric'](_0x42485b)){_0x1386a2['or']('i.id\x20LIKE\x20?',_0x42485b+'%')['or'](_0x66c7('0x80'),_0x42485b+'%');}else{_0x1386a2['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x66c7('0x60')](_0x42485b))['or'](_0x66c7('0x81'),_0x42485b+'%');}}}_0x4e0c89[_0x66c7('0x3e')](_0x1386a2);_0x4e0c89[_0x66c7('0x82')](_0x66c7('0x83'));var _0x1d800e={'type':db[_0x66c7('0x84')][_0x66c7('0x85')][_0x66c7('0x86')],'raw':!![]};var _0x35ad88=_0x4e0c89[_0x66c7('0x87')]();_0x35ad88[_0x66c7('0x42')]('i.id');_0x35ad88[_0x66c7('0x42')](_0x66c7('0x88'),_0x66c7('0x58'));if(_0x367ad5[_0x66c7('0x3c')]){_0x367ad5['order'][_0x66c7('0x2e')](function(_0x1ed044){_0x4e0c89['order']('i.'+_0x1ed044[0x0],_0x1ed044[0x1]===_0x66c7('0x89')?![]:!![]);});}if(!_[_0x66c7('0x6c')](_0x2f766e)){_0x4e0c89[_0x66c7('0x5a')](_0x2cd0c6);_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x8a'),_0x2f766e);}BPromise[_0x66c7('0x8b')]()['then'](function(){if(!_0x1b3dc2){if(_0x446bd8['query'][_0x66c7('0x6d')]||_0x446bd8['query']['journey'])return;_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x8c'));_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x8c'));return;}return _0x446bd8[_0x66c7('0x8d')][_0x66c7('0x8e')]({'attributes':['id'],'raw':!![]})[_0x66c7('0x22')](function(_0x41b4f0){if(_['isEmpty'](_0x41b4f0)){_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x8f'));_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x8f'));}else{_0x35ad88[_0x66c7('0x3e')](_0x66c7('0x6e'),_[_0x66c7('0x29')](_0x41b4f0,'id'));_0x4e0c89[_0x66c7('0x3e')](_0x66c7('0x6e'),_[_0x66c7('0x29')](_0x41b4f0,'id'));}});})[_0x66c7('0x22')](function(){db[_0x66c7('0x90')][_0x66c7('0x35')](_0x35ad88[_0x66c7('0x91')](),_0x1d800e)[_0x66c7('0x22')](function(_0x2aaba9){_0x45050c[_0x66c7('0x92')]=_0x2aaba9[_0x66c7('0x39')];if(_0x45050c[_0x66c7('0x92')]===0x0)return[];return db[_0x66c7('0x90')][_0x66c7('0x35')](_0x528f5c[_0x66c7('0x91')](),_0x1d800e)[_0x66c7('0x22')](function(_0x300ff4){_0x5bb5fc=_[_0x66c7('0x93')](_0x300ff4,'id');_0x1d800e=_[_0x66c7('0x94')](_0x1d800e,{'model':db[_0x66c7('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x446bd8['query'][_0x66c7('0x38')]){_0x367ad5[_0x66c7('0x37')][_0x66c7('0x2e')](function(_0x5a163c){_0x4e0c89[_0x66c7('0x42')]('i.'+_0x5a163c);});}else{_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x88'),'unreadMessages');_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x96'),_0x66c7('0x97'));_0x4e0c89['field'](_0x66c7('0x98'),_0x66c7('0x99'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x9a'));_0x4e0c89['field'](_0x66c7('0x9b'),_0x66c7('0x9c'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0x9d'),'Contact.lastName');_0x4e0c89['field'](_0x66c7('0x9e'),_0x66c7('0x9f'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xa0'),_0x66c7('0xa1'));_0x4e0c89['field'](_0x66c7('0xa2'),_0x66c7('0xa3'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xa4'),_0x66c7('0xa5'));_0x4e0c89['field'](_0x66c7('0xa6'),_0x66c7('0xa7'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xa8'),_0x66c7('0xa9'));_0x4e0c89[_0x66c7('0x42')](_0x66c7('0xaa'),_0x66c7('0x2b'));}if(_0x367ad5['limit'])_0x4e0c89[_0x66c7('0x1e')](_0x367ad5[_0x66c7('0x1e')]);if(_0x367ad5[_0x66c7('0x1d')])_0x4e0c89['offset'](_0x367ad5[_0x66c7('0x1d')]);return db[_0x66c7('0x90')][_0x66c7('0x35')](_0x4e0c89[_0x66c7('0x91')](),_0x1d800e);})[_0x66c7('0x22')](function(_0x2e528e){_0x2c5269[_0x66c7('0x3e')](_0x66c7('0xab'),_['map'](_0x2e528e,'id'));return db[_0x66c7('0x90')][_0x66c7('0x35')](_0x2c5269[_0x66c7('0x91')](),_0x1d800e)[_0x66c7('0x22')](function(_0x3d12ed){var _0x39f425=_['groupBy'](_0x3d12ed,_0x66c7('0xac'));var _0x446e40=[];_0x2e528e[_0x66c7('0x2e')](function(_0x223ab1){_0x446e40[_0x66c7('0xad')](updateSmsInteraction(_0x223ab1,_0x5bb5fc,_0x39f425));});return BPromise[_0x66c7('0xae')](_0x446e40);});});})[_0x66c7('0x22')](function(_0xbeab37){_0x45050c['rows']=_0xbeab37;return _0x45050c;})[_0x66c7('0x22')](respondWithFilteredResult(_0x13e7a2,_0x367ad5));})[_0x66c7('0x2f')](handleError(_0x13e7a2,null));};exports[_0x66c7('0xaf')]=function(_0x54cb09,_0x176d9d){var _0x2f0bf0={'raw':![],'where':{'id':_0x54cb09[_0x66c7('0xb0')]['id']}},_0x46aa68={};_0x46aa68[_0x66c7('0x34')]=_[_0x66c7('0x36')](db[_0x66c7('0x95')]['rawAttributes']);_0x46aa68[_0x66c7('0x35')]=_['keys'](_0x54cb09['query']);_0x46aa68['filters']=_['intersection'](_0x46aa68[_0x66c7('0x34')],_0x46aa68[_0x66c7('0x35')]);_0x2f0bf0['attributes']=_['intersection'](_0x46aa68[_0x66c7('0x34')],qs[_0x66c7('0x38')](_0x54cb09['query']['fields']));_0x2f0bf0[_0x66c7('0x37')]=_0x2f0bf0['attributes']['length']?_0x2f0bf0[_0x66c7('0x37')]:_0x46aa68[_0x66c7('0x34')];if(_0x54cb09['query'][_0x66c7('0xb1')]){_0x2f0bf0[_0x66c7('0xb2')]=[{'all':!![]}];}_0x2f0bf0=_[_0x66c7('0x94')]({},_0x2f0bf0,_0x54cb09[_0x66c7('0xb3')]);return db[_0x66c7('0x95')][_0x66c7('0x57')](_0x2f0bf0)[_0x66c7('0x22')](handleEntityNotFound(_0x176d9d,null))[_0x66c7('0x22')](respondWithResult(_0x176d9d,null))[_0x66c7('0x2f')](handleError(_0x176d9d,null));};exports['create']=function(_0x1ea4c2,_0x5337d5){return db[_0x66c7('0x95')][_0x66c7('0xb4')](_0x1ea4c2['body'],{})[_0x66c7('0x22')](respondWithResult(_0x5337d5,0xc9))[_0x66c7('0x2f')](handleError(_0x5337d5,null));};exports[_0x66c7('0x21')]=function(_0x12bcbf,_0x2c735a){if(_0x12bcbf['body']['id']){delete _0x12bcbf[_0x66c7('0xb5')]['id'];}return db['SmsInteraction'][_0x66c7('0x57')]({'where':{'id':_0x12bcbf[_0x66c7('0xb0')]['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x2c735a,null))[_0x66c7('0x22')](saveUpdates(_0x12bcbf[_0x66c7('0xb5')],null))[_0x66c7('0x22')](respondWithResult(_0x2c735a,null))[_0x66c7('0x2f')](handleError(_0x2c735a,null));};exports['destroy']=function(_0x54fb36,_0x2ed11c){return db['SmsInteraction']['find']({'where':{'id':_0x54fb36['params']['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x2ed11c,null))['then'](removeEntity(_0x2ed11c,null))[_0x66c7('0x2f')](handleError(_0x2ed11c,null));};exports[_0x66c7('0xb6')]=function(_0x40d269,_0x4c23c7){return db[_0x66c7('0x95')]['describe']()[_0x66c7('0x22')](respondWithResult(_0x4c23c7,null))['catch'](handleError(_0x4c23c7,null));};exports[_0x66c7('0xb7')]=function(_0x248b31,_0xca6817,_0x3c8c2b){return db[_0x66c7('0xb8')][_0x66c7('0x57')]({'where':{'id':_0x248b31[_0x66c7('0xb0')]['id']}})['then'](handleEntityNotFound(_0xca6817,null))[_0x66c7('0x22')](function(_0x4f728a){if(_0x4f728a){return _0x4f728a['addMessage'](_0x248b31[_0x66c7('0xb5')][_0x66c7('0xb9')],_[_0x66c7('0xba')](_0x248b31[_0x66c7('0xb5')],[_0x66c7('0xb9'),'id'])||{});}})[_0x66c7('0x22')](respondWithResult(_0xca6817,null))[_0x66c7('0x2f')](handleError(_0xca6817,null));};exports[_0x66c7('0xbb')]=function(_0x30c228,_0x73399,_0x34ac80){var _0x12bca4={'raw':![],'where':{}};var _0x1bd864={};var _0x4fa142={'count':0x0,'rows':[]};return db[_0x66c7('0x95')]['findOne']({'where':{'id':_0x30c228[_0x66c7('0xb0')]['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x73399,null))[_0x66c7('0x22')](function(_0x3826e4){if(_0x3826e4){_0x1bd864[_0x66c7('0x34')]=_[_0x66c7('0x36')](db['SmsMessage']['rawAttributes']);_0x1bd864['query']=_['keys'](_0x30c228['query']);_0x1bd864[_0x66c7('0x3f')]=_[_0x66c7('0xbc')](_0x1bd864[_0x66c7('0x34')],_0x1bd864[_0x66c7('0x35')]);_0x12bca4['attributes']=_['intersection'](_0x1bd864[_0x66c7('0x34')],qs[_0x66c7('0x38')](_0x30c228['query'][_0x66c7('0x38')]));_0x12bca4[_0x66c7('0x37')]=_0x12bca4['attributes'][_0x66c7('0x39')]?_0x12bca4[_0x66c7('0x37')]:_0x1bd864[_0x66c7('0x34')];if(!_0x30c228[_0x66c7('0x35')]['hasOwnProperty']('nolimit')){_0x12bca4[_0x66c7('0x1e')]=qs[_0x66c7('0x1e')](_0x30c228[_0x66c7('0x35')][_0x66c7('0x1e')]);_0x12bca4[_0x66c7('0x1d')]=qs[_0x66c7('0x1d')](_0x30c228[_0x66c7('0x35')][_0x66c7('0x1d')]);}_0x12bca4[_0x66c7('0x3c')]=qs[_0x66c7('0x3d')](_0x30c228['query'][_0x66c7('0x3d')]);_0x12bca4[_0x66c7('0x3e')]=qs[_0x66c7('0x3f')](_[_0x66c7('0x40')](_0x30c228[_0x66c7('0x35')],_0x1bd864[_0x66c7('0x3f')]));_0x12bca4[_0x66c7('0x3e')][_0x66c7('0xac')]=_0x3826e4['id'];if(_0x30c228[_0x66c7('0x35')][_0x66c7('0x7d')]){_0x12bca4['where']=_[_0x66c7('0x94')](_0x12bca4[_0x66c7('0x3e')],{'$or':_[_0x66c7('0x29')](_0x12bca4[_0x66c7('0x37')],function(_0x2fcf9e){var _0x1a9c73={};_0x1a9c73[_0x2fcf9e]={'$like':'%'+_0x30c228[_0x66c7('0x35')][_0x66c7('0x7d')]+'%'};return _0x1a9c73;})});}if(_0x30c228['query'][_0x66c7('0xbd')]){var _0x2bac63=_0x30c228[_0x66c7('0x35')][_0x66c7('0xbd')][_0x66c7('0x2d')](',');var _0x433147={};_0x433147[_0x2bac63[0x0]]={'$gte':moment(_0x2bac63[0x1])[_0x66c7('0xbe')](_0x66c7('0xbf'))};_0x12bca4[_0x66c7('0x3e')]=_[_0x66c7('0x94')](_0x12bca4[_0x66c7('0x3e')],_0x433147);}_0x12bca4=_[_0x66c7('0x94')]({},_0x12bca4,_0x30c228['options']);return db['SmsMessage'][_0x66c7('0x92')]({'where':_0x12bca4[_0x66c7('0x3e')]})[_0x66c7('0x22')](function(_0x6a57c6){_0x4fa142[_0x66c7('0x92')]=_0x6a57c6;if(_0x30c228[_0x66c7('0x35')][_0x66c7('0xb1')]){_0x12bca4[_0x66c7('0xb2')]=[{'all':!![]}];}return db['SmsMessage'][_0x66c7('0xc0')](_0x12bca4);})[_0x66c7('0x22')](function(_0x498698){_0x4fa142[_0x66c7('0xc1')]=_0x498698;return _0x4fa142;});}})[_0x66c7('0x22')](respondWithFilteredResult(_0x73399,_0x12bca4))[_0x66c7('0x2f')](handleError(_0x73399,null));};exports[_0x66c7('0xc2')]=function(_0x5c97da,_0xa292ce,_0x224406){return db[_0x66c7('0x95')][_0x66c7('0x57')]({'where':{'id':_0x5c97da['params']['id']}})['then'](handleEntityNotFound(_0xa292ce,null))[_0x66c7('0x22')](function(_0x46eb2e){if(_0x46eb2e){return _0x46eb2e[_0x66c7('0xc3')](_0x5c97da[_0x66c7('0xb5')][_0x66c7('0xb9')],_[_0x66c7('0xba')](_0x5c97da['body'],[_0x66c7('0xb9'),'id'])||{})[_0x66c7('0xc4')](function(){return db[_0x66c7('0x63')][_0x66c7('0xc0')]({'attributes':['id','name',_0x66c7('0x43')],'where':{'id':_0x5c97da['body'][_0x66c7('0xb9')]}});})['then'](function(_0x492f77){socket[_0x66c7('0xc5')](_0x66c7('0xc6'),{'id':Number(_0x5c97da['params']['id']),'tags':_0x492f77||[]});return{'id':Number(_0x5c97da['params']['id']),'tags':_0x492f77||[]};});}})[_0x66c7('0x22')](respondWithResult(_0xa292ce,null))['catch'](handleError(_0xa292ce,null));};exports[_0x66c7('0xc7')]=function(_0xa1dc6a,_0x2358e9,_0xba7a89){return db['SmsInteraction'][_0x66c7('0x57')]({'where':{'id':_0xa1dc6a[_0x66c7('0xb0')]['id']}})[_0x66c7('0x22')](handleEntityNotFound(_0x2358e9,null))[_0x66c7('0x22')](function(_0xc4d935){if(_0xc4d935){return _0xc4d935['removeTags'](_0xa1dc6a['query'][_0x66c7('0xb9')]);}})[_0x66c7('0x22')](respondWithStatusCode(_0x2358e9,null))[_0x66c7('0x2f')](handleError(_0x2358e9,null));};exports[_0x66c7('0xc8')]=function(_0x3bae47,_0x501a80){var _0x290fcc=moment()[_0x66c7('0xc9')]()[_0x66c7('0x91')]();var _0x20d8f8=path[_0x66c7('0xca')](config['root'],'server',_0x66c7('0xcb'),_0x66c7('0xcc'));var _0x4e683b=path[_0x66c7('0xca')](config['root'],_0x66c7('0xcd'),_0x66c7('0xcb'),_0x66c7('0xce'));var _0x4dc210=path[_0x66c7('0xca')](_0x20d8f8,_0x290fcc);var _0x5013a7=util[_0x66c7('0xbe')]('transcript-%d-%s.zip',_0x3bae47[_0x66c7('0xb0')]['id'],_0x290fcc);var _0x361fe0=path[_0x66c7('0xca')](_0x20d8f8,_0x5013a7);var _0x3eff3a=[];_0x3eff3a['push']({'model':db[_0x66c7('0x64')],'as':_0x66c7('0x64'),'attributes':['id','fullname'],'raw':!![]});_0x3eff3a[_0x66c7('0xad')]({'model':db[_0x66c7('0xcf')],'as':'Contact','attributes':['id',_0x66c7('0xd0'),_0x66c7('0xd1')],'raw':!![]});var _0x4aadc8=[{'model':db[_0x66c7('0xb8')],'as':'Messages','attributes':['id','body',_0x66c7('0x70'),'direction',_0x66c7('0xd2'),_0x66c7('0x77')],'include':_0x3eff3a}];_0x4aadc8['push']({'model':db[_0x66c7('0xd3')],'as':'Account','attributes':['id',_0x66c7('0x26')]});_0x4aadc8[_0x66c7('0xad')]({'model':db[_0x66c7('0x64')],'as':_0x66c7('0xd4'),'attributes':['id','fullname']});return db[_0x66c7('0x95')][_0x66c7('0x57')]({'where':{'id':_0x3bae47['params']['id']},'include':_0x4aadc8})[_0x66c7('0x22')](handleEntityNotFound(_0x501a80,null))[_0x66c7('0x22')](function(_0x2f2024){if(_0x2f2024){var _0x158887=_0x2f2024[_0x66c7('0xd5')]({'plain':!![]});fs[_0x66c7('0xd6')](_0x4dc210);var _0x41804e={'format':'A4','border':_0x66c7('0xd7'),'header':{'height':_0x66c7('0xd8'),'contents':{'first':_0x66c7('0xd9')}},'footer':{'height':_0x66c7('0xda'),'contents':{'default':util[_0x66c7('0xbe')](_0x66c7('0xdb'),util[_0x66c7('0xbe')](_0x66c7('0xdc'),_0x66c7('0xdd'),_0x158887['id']),moment()['format'](_0x66c7('0xde'))['toString']())}}};var _0x4b44a3={'channel':_0x66c7('0xdd'),'account':_0x158887[_0x66c7('0xdf')]['name'],'agent':_0x158887[_0x66c7('0xd4')]?_0x158887[_0x66c7('0xd4')][_0x66c7('0x2a')]:_0x66c7('0xe0'),'createdAt':moment(_0x158887[_0x66c7('0x70')])['format'](_0x66c7('0xbf'))[_0x66c7('0x91')](),'closedAt':_0x158887[_0x66c7('0xe1')]?moment(_0x158887[_0x66c7('0xe2')])[_0x66c7('0xbe')](_0x66c7('0xbf'))['toString']():'','disposition':_0x158887[_0x66c7('0xe3')],'messages':_(_0x158887['Messages'])[_0x66c7('0x7d')]({'secret':![]})['map'](function(_0x3c60d7){return{'date':moment(_0x3c60d7[_0x66c7('0x70')])[_0x66c7('0xbe')](_0x66c7('0xbf'))[_0x66c7('0x91')](),'sender':_0x3c60d7['direction']===_0x66c7('0xe4')?_0x3c60d7[_0x66c7('0x64')]?_0x3c60d7[_0x66c7('0x64')]['fullname']:_0x66c7('0xe5'):_0x3c60d7['Contact'][_0x66c7('0xd0')]+(_0x3c60d7[_0x66c7('0x5d')]['lastName']?'\x20'+_0x3c60d7[_0x66c7('0x5d')][_0x66c7('0xd1')]:''),'body':_0x3c60d7[_0x66c7('0xb5')],'direction':_0x3c60d7['direction']===_0x66c7('0xe4')?'A':'C','secret':_0x3c60d7[_0x66c7('0xd2')],'read':_0x3c60d7[_0x66c7('0x77')]};})['value']()};return ejs['renderFile'](path[_0x66c7('0xca')](config['root'],_0x66c7('0xcd'),_0x66c7('0xe6'),'downloadInteraction.html'),{'interaction':_0x4b44a3})[_0x66c7('0x22')](function(_0x49f915){return new BPromise(function(_0x5e98f6,_0x3c0cfd){pdf[_0x66c7('0xb4')](_0x49f915,_0x41804e)[_0x66c7('0xe7')](path['join'](_0x4dc210,_0x66c7('0xe8')+_0x158887['id']+'-'+_0x290fcc+_0x66c7('0xe9')),function(_0x46a220,_0x28612f){if(_0x46a220)return _0x3c0cfd(_0x46a220);_0x5e98f6(_0x28612f);});});})[_0x66c7('0x22')](function(){return new BPromise(function(_0x49fe5a,_0x2ce2c2){zipdir(_0x4dc210,{'saveTo':_0x361fe0},function(_0x319ae6,_0x2462c6){if(_0x319ae6)return _0x2ce2c2(_0x319ae6);return _0x49fe5a(_0x2462c6);});})['then'](function(){return new BPromise(function(_0x1d329d,_0x5d6306){rimraf(_0x4dc210,function(_0x42119f){if(_0x42119f)_0x5d6306(_0x42119f);return _0x1d329d();});});})[_0x66c7('0x22')](function(){return _0x501a80[_0x66c7('0xc8')](_0x361fe0,_0x5013a7,function(_0x22a363){if(_0x22a363){console[_0x66c7('0xea')](_0x66c7('0xeb'),_0x22a363);}else{fs['unlinkSync'](_0x361fe0);}});});});}else{return _0x501a80[_0x66c7('0xec')](0xc8);}})[_0x66c7('0x2f')](handleError(_0x501a80,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c8dd27e..a34a31d 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 _0x885a=['then','Users','map','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers'];(function(_0x4d7046,_0x49fe7e){var _0x4c8c53=function(_0x51d2ed){while(--_0x51d2ed){_0x4d7046['push'](_0x4d7046['shift']());}};_0x4c8c53(++_0x49fe7e);}(_0x885a,0x180));var _0xa885=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x885a[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xa885('0x0'))['db'][_0xa885('0x1')];var SmsMessage=require(_0xa885('0x0'))['db'][_0xa885('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa885('0x3'),'afterUpdate':_0xa885('0x4'),'afterDestroy':_0xa885('0x5')};function emitEvent(_0x106e16){return function(_0x108285,_0x33f18b,_0x5dfd7e){_0x108285[_0xa885('0x6')]({'attributes':['id'],'raw':!![]})[_0xa885('0x7')](function(_0x31fd77){_0x108285['setDataValue'](_0xa885('0x8'),_0x31fd77[_0xa885('0x9')](function(_0x38df93){return{'id':_0x38df93['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x108285['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa885('0x7')](function(_0x299f57){_0x108285[_0xa885('0xa')](_0xa885('0xb'),_0x299f57[_0xa885('0xc')]);SmsInteractionEvents[_0xa885('0xd')](_0x106e16+':'+_0x108285['id'],_0x108285);SmsInteractionEvents[_0xa885('0xd')](_0x106e16,_0x108285);_0x5dfd7e(null);})['catch'](_0x5dfd7e(null));};}for(var e in events){if(events[_0xa885('0xe')](e)){var event=events[e];SmsInteraction[_0xa885('0xf')](e,emitEvent(event));}}module[_0xa885('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x1dcc=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0xcfd748,_0x3a5bcb){var _0x294ff3=function(_0x560165){while(--_0x560165){_0xcfd748['push'](_0xcfd748['shift']());}};_0x294ff3(++_0x3a5bcb);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3b03e7,_0x5a8ee2){_0x3b03e7=_0x3b03e7-0x0;var _0x50d8d7=_0x1dcc[_0x3b03e7];return _0x50d8d7;};'use strict';var EventEmitter=require(_0xc1dc('0x0'));var SmsInteraction=require(_0xc1dc('0x1'))['db'][_0xc1dc('0x2')];var SmsMessage=require(_0xc1dc('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1dc('0x4'),'afterDestroy':_0xc1dc('0x5')};function emitEvent(_0x2a8ff9){return function(_0x5deaf7,_0x4ad50f,_0x1e57ba){_0x5deaf7[_0xc1dc('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1dc('0x7')](function(_0x4dab41){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0x9'),_0x4dab41['map'](function(_0x6aad09){return{'id':_0x6aad09['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5deaf7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1dc('0x7')](function(_0x49ef48){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0xa'),_0x49ef48[_0xc1dc('0xb')]);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9+':'+_0x5deaf7['id'],_0x5deaf7);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9,_0x5deaf7);_0x1e57ba(null);})[_0xc1dc('0xd')](_0x1e57ba(null));};}for(var e in events){if(events[_0xc1dc('0xe')](e)){var event=events[e];SmsInteraction[_0xc1dc('0xf')](e,emitEvent(event));}}module[_0xc1dc('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7ec4a39..2929a92 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 _0xe4c7=['define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x3fa04e,_0x20fe59){var _0x72dedf=function(_0x4212a0){while(--_0x4212a0){_0x3fa04e['push'](_0x3fa04e['shift']());}};_0x72dedf(++_0x20fe59);}(_0xe4c7,0xe9));var _0x7e4c=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0xe4c7[_0x673ea4];return _0x3e5938;};'use strict';var _=require(_0x7e4c('0x0'));var util=require('util');var logger=require(_0x7e4c('0x1'))(_0x7e4c('0x2'));var moment=require(_0x7e4c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e4c('0x4'));var config=require(_0x7e4c('0x5'));var attributes=require(_0x7e4c('0x6'));module['exports']=function(_0x977016,_0x2c6c5b){return _0x977016[_0x7e4c('0x7')](_0x7e4c('0x8'),attributes,{'tableName':_0x7e4c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x350c41,_0x3104cb,_0x4a171c){if(_0x350c41[_0x7e4c('0xa')](_0x7e4c('0xb'))){_0x350c41[_0x7e4c('0xc')]=moment()[_0x7e4c('0xd')](_0x7e4c('0xe'));}_0x4a171c(null,_0x350c41);}}});}; \ No newline at end of file +var _0xca8d=['changed','closed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0xf09021,_0x4aa5ac){var _0x54741f=function(_0x39f37c){while(--_0x39f37c){_0xf09021['push'](_0xf09021['shift']());}};_0x54741f(++_0x4aa5ac);}(_0xca8d,0x10d));var _0xdca8=function(_0x16d6a2,_0x266958){_0x16d6a2=_0x16d6a2-0x0;var _0x681283=_0xca8d[_0x16d6a2];return _0x681283;};'use strict';var _=require(_0xdca8('0x0'));var util=require('util');var logger=require(_0xdca8('0x1'))(_0xdca8('0x2'));var moment=require(_0xdca8('0x3'));var BPromise=require(_0xdca8('0x4'));var rp=require(_0xdca8('0x5'));var fs=require('fs');var path=require(_0xdca8('0x6'));var rimraf=require('rimraf');var config=require(_0xdca8('0x7'));var attributes=require(_0xdca8('0x8'));module[_0xdca8('0x9')]=function(_0x7d3563,_0x4320d7){return _0x7d3563['define'](_0xdca8('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a6f86,_0x5c7a52,_0x5b8a42){if(_0x2a6f86[_0xdca8('0xb')](_0xdca8('0xc'))){_0x2a6f86[_0xdca8('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5b8a42(null,_0x2a6f86);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 42d02da..c1cecff 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 _0xe0cc=['body','options','raw','where','attributes','limit','debug','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateSmsInteraction','SmsInteraction','update'];(function(_0x361bd6,_0x3c03ee){var _0x56956f=function(_0xe37e03){while(--_0xe37e03){_0x361bd6['push'](_0x361bd6['shift']());}};_0x56956f(++_0x3c03ee);}(_0xe0cc,0x164));var _0xce0c=function(_0x2ea404,_0x2dc68f){_0x2ea404=_0x2ea404-0x0;var _0x4fe5ab=_0xe0cc[_0x2ea404];return _0x4fe5ab;};'use strict';var _=require(_0xce0c('0x0'));var util=require(_0xce0c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce0c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce0c('0x3'));var config=require(_0xce0c('0x4'));var jayson=require(_0xce0c('0x5'));var client=jayson['client'][_0xce0c('0x6')]({'port':0x232a});config[_0xce0c('0x7')]=_[_0xce0c('0x8')](config['redis'],{'host':_0xce0c('0x9'),'port':0x18eb});var socket=require(_0xce0c('0xa'))(new Redis(config['redis']));require(_0xce0c('0xb'))['register'](socket);function respondWithRpcPromise(_0x3702c4,_0x58c45c,_0x233389){return new BPromise(function(_0x2b0f54,_0x3c236f){return client['request'](_0x3702c4,_0x233389)[_0xce0c('0xc')](function(_0x5895e6){logger[_0xce0c('0xd')](_0xce0c('0xe'),_0x58c45c,_0xce0c('0xf'));logger['debug'](_0xce0c('0x10'),_0x58c45c,_0xce0c('0xf'),JSON[_0xce0c('0x11')](_0x5895e6));if(_0x5895e6[_0xce0c('0x12')]){if(_0x5895e6[_0xce0c('0x12')]['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x58c45c,_0x5895e6[_0xce0c('0x12')][_0xce0c('0x13')]);return _0x3c236f(_0x5895e6['error'][_0xce0c('0x13')]);}logger[_0xce0c('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x58c45c,_0x5895e6[_0xce0c('0x12')][_0xce0c('0x13')]);return _0x2b0f54(_0x5895e6[_0xce0c('0x12')][_0xce0c('0x13')]);}else{logger[_0xce0c('0xd')](_0xce0c('0xe'),_0x58c45c,_0xce0c('0xf'));_0x2b0f54(_0x5895e6['result'][_0xce0c('0x13')]);}})[_0xce0c('0x14')](function(_0x41caae){logger[_0xce0c('0x12')](_0xce0c('0xe'),_0x58c45c,_0x41caae);_0x3c236f(_0x41caae);});});}exports[_0xce0c('0x15')]=function(_0x325eaf){var _0x20bc90=this;return new Promise(function(_0x542ba1,_0xfcae73){return db[_0xce0c('0x16')][_0xce0c('0x17')](_0x325eaf[_0xce0c('0x18')],{'raw':_0x325eaf[_0xce0c('0x19')]?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325eaf[_0xce0c('0x19')]?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1b')]||null:null,'attributes':_0x325eaf['options']?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1c')]||null:null,'limit':_0x325eaf['options']?_0x325eaf[_0xce0c('0x19')][_0xce0c('0x1d')]||null:null})[_0xce0c('0xc')](function(_0x3c56c2){logger[_0xce0c('0xd')]('UpdateSmsInteraction',_0x325eaf);logger[_0xce0c('0x1e')](_0xce0c('0x15'),_0x325eaf,JSON[_0xce0c('0x11')](_0x3c56c2));_0x542ba1(_0x3c56c2);})[_0xce0c('0x14')](function(_0x4f5492){logger[_0xce0c('0x12')](_0xce0c('0x15'),_0x4f5492['message'],_0x325eaf);_0xfcae73(_0x20bc90[_0xce0c('0x12')](0x1f4,_0x4f5492[_0xce0c('0x13')]));});});};exports[_0xce0c('0x1f')]=function(_0xabe983){return new Promise(function(_0x128a07,_0xb62185){return db[_0xce0c('0x16')][_0xce0c('0x20')]({'where':_0xabe983[_0xce0c('0x19')]?_0xabe983['options']['where']||null:null})[_0xce0c('0xc')](function(_0x37004e){if(_0x37004e){return _0x37004e[_0xce0c('0x21')](_0xabe983[_0xce0c('0x18')][_0xce0c('0x22')],_[_0xce0c('0x23')](_0xabe983[_0xce0c('0x18')],[_0xce0c('0x22'),'id'])||{});}})[_0xce0c('0x24')](function(_0x4c2d2b){logger['info'](_0xce0c('0x25'),_0xabe983);logger[_0xce0c('0x1e')](_0xce0c('0x25'),_0xabe983,JSON[_0xce0c('0x11')](_0x4c2d2b));_0x128a07(_0x4c2d2b);})['catch'](function(_0x16fcbb){logger[_0xce0c('0x12')](_0xce0c('0x25'),_0x16fcbb[_0xce0c('0x13')],_0xabe983);_0xb62185(_this[_0xce0c('0x12')](0x1f4,_0x16fcbb['message']));});});}; \ No newline at end of file +var _0xdb8a=['code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0xdb8a,0xbf));var _0xadb8=function(_0x4f3af4,_0x2d048c){_0x4f3af4=_0x4f3af4-0x0;var _0x557e86=_0xdb8a[_0x4f3af4];return _0x557e86;};'use strict';var _=require(_0xadb8('0x0'));var util=require(_0xadb8('0x1'));var moment=require(_0xadb8('0x2'));var BPromise=require(_0xadb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb8('0x4'));var db=require(_0xadb8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xadb8('0x6'));var config=require(_0xadb8('0x7'));var jayson=require(_0xadb8('0x8'));var client=jayson[_0xadb8('0x9')][_0xadb8('0xa')]({'port':0x232a});config[_0xadb8('0xb')]=_['defaults'](config[_0xadb8('0xb')],{'host':_0xadb8('0xc'),'port':0x18eb});var socket=require(_0xadb8('0xd'))(new Redis(config[_0xadb8('0xb')]));require(_0xadb8('0xe'))[_0xadb8('0xf')](socket);function respondWithRpcPromise(_0x538f6b,_0x4d7482,_0x4c4a9c){return new BPromise(function(_0x153774,_0x1ec609){return client[_0xadb8('0x10')](_0x538f6b,_0x4c4a9c)[_0xadb8('0x11')](function(_0x17cc40){logger[_0xadb8('0x12')](_0xadb8('0x13'),_0x4d7482,_0xadb8('0x14'));logger[_0xadb8('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4d7482,_0xadb8('0x14'),JSON[_0xadb8('0x16')](_0x17cc40));if(_0x17cc40[_0xadb8('0x17')]){if(_0x17cc40[_0xadb8('0x17')][_0xadb8('0x18')]===0x1f4){logger[_0xadb8('0x17')](_0xadb8('0x13'),_0x4d7482,_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);return _0x1ec609(_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);}logger[_0xadb8('0x17')](_0xadb8('0x13'),_0x4d7482,_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);return _0x153774(_0x17cc40[_0xadb8('0x17')][_0xadb8('0x19')]);}else{logger[_0xadb8('0x12')](_0xadb8('0x13'),_0x4d7482,_0xadb8('0x14'));_0x153774(_0x17cc40[_0xadb8('0x1a')][_0xadb8('0x19')]);}})[_0xadb8('0x1b')](function(_0x431369){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4d7482,_0x431369);_0x1ec609(_0x431369);});});}exports[_0xadb8('0x1c')]=function(_0x47772c){var _0x1c3560=this;return new Promise(function(_0x1ff486,_0x2a4d19){return db[_0xadb8('0x1d')][_0xadb8('0x1e')](_0x47772c['body'],{'raw':_0x47772c[_0xadb8('0x1f')]?_0x47772c['options'][_0xadb8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47772c['options']?_0x47772c[_0xadb8('0x1f')][_0xadb8('0x21')]||null:null,'attributes':_0x47772c[_0xadb8('0x1f')]?_0x47772c[_0xadb8('0x1f')][_0xadb8('0x22')]||null:null,'limit':_0x47772c[_0xadb8('0x1f')]?_0x47772c[_0xadb8('0x1f')][_0xadb8('0x23')]||null:null})[_0xadb8('0x11')](function(_0x1ff447){logger[_0xadb8('0x12')](_0xadb8('0x1c'),_0x47772c);logger[_0xadb8('0x15')](_0xadb8('0x1c'),_0x47772c,JSON[_0xadb8('0x16')](_0x1ff447));_0x1ff486(_0x1ff447);})['catch'](function(_0x431a74){logger[_0xadb8('0x17')](_0xadb8('0x1c'),_0x431a74[_0xadb8('0x19')],_0x47772c);_0x2a4d19(_0x1c3560[_0xadb8('0x17')](0x1f4,_0x431a74['message']));});});};exports[_0xadb8('0x24')]=function(_0x487232){return new Promise(function(_0x1be984,_0x3fe228){return db[_0xadb8('0x1d')][_0xadb8('0x25')]({'where':_0x487232['options']?_0x487232['options'][_0xadb8('0x21')]||null:null})[_0xadb8('0x11')](function(_0x4f0f2c){if(_0x4f0f2c){return _0x4f0f2c[_0xadb8('0x26')](_0x487232[_0xadb8('0x27')]['ids'],_[_0xadb8('0x28')](_0x487232['body'],['ids','id'])||{});}})[_0xadb8('0x29')](function(_0x323a7d){logger['info'](_0xadb8('0x2a'),_0x487232);logger[_0xadb8('0x15')]('AddTags',_0x487232,JSON[_0xadb8('0x16')](_0x323a7d));_0x1be984(_0x323a7d);})[_0xadb8('0x1b')](function(_0x248e4c){logger[_0xadb8('0x17')](_0xadb8('0x2a'),_0x248e4c['message'],_0x487232);_0x3fe228(_this[_0xadb8('0x17')](0x1f4,_0x248e4c[_0xadb8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b01f0c9..a0bd798 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x241f6b,_0x2af41b){var _0xfa096f=function(_0x424537){while(--_0x424537){_0x241f6b['push'](_0x241f6b['shift']());}};_0xfa096f(++_0x2af41b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x3317ed,_0x5b0845){var _0x57da18=function(_0x3c005b){while(--_0x3c005b){_0x3317ed['push'](_0x3317ed['shift']());}};_0x57da18(++_0x5b0845);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index db8ca43..0be3d45 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 _0x8a06=['isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get'];(function(_0x1899ae,_0x5b5ad6){var _0x243c83=function(_0x3688e5){while(--_0x3688e5){_0x1899ae['push'](_0x1899ae['shift']());}};_0x243c83(++_0x5b5ad6);}(_0x8a06,0xbb));var _0x68a0=function(_0x8c6164,_0x1dc7db){_0x8c6164=_0x8c6164-0x0;var _0x1ca172=_0x8a06[_0x8c6164];return _0x1ca172;};'use strict';var multer=require('multer');var util=require(_0x68a0('0x0'));var path=require(_0x68a0('0x1'));var timeout=require(_0x68a0('0x2'));var express=require(_0x68a0('0x3'));var router=express[_0x68a0('0x4')]();var auth=require(_0x68a0('0x5'));var interaction=require(_0x68a0('0x6'));var config=require('../../config/environment');var controller=require(_0x68a0('0x7'));router[_0x68a0('0x8')]('/',auth[_0x68a0('0x9')](),controller['index']);router[_0x68a0('0x8')](_0x68a0('0xa'),auth[_0x68a0('0x9')](),controller[_0x68a0('0xb')]);router['get'](_0x68a0('0xc'),auth['isAuthenticated'](),controller[_0x68a0('0xd')]);router[_0x68a0('0xe')]('/',auth[_0x68a0('0x9')](),interaction[_0x68a0('0xf')](_0x68a0('0x10'),_0x68a0('0x11')),controller[_0x68a0('0x12')]);router[_0x68a0('0xe')](_0x68a0('0x13'),controller[_0x68a0('0x14')]);router[_0x68a0('0x15')](_0x68a0('0xc'),auth['isAuthenticated'](),controller[_0x68a0('0x16')]);router[_0x68a0('0x15')](_0x68a0('0x17'),auth['isAuthenticated'](),controller[_0x68a0('0x18')]);router[_0x68a0('0x15')]('/:id/reject',auth[_0x68a0('0x9')](),controller[_0x68a0('0x19')]);router[_0x68a0('0x1a')](_0x68a0('0xc'),auth[_0x68a0('0x9')](),controller['destroy']);module[_0x68a0('0x1b')]=router; \ No newline at end of file +var _0xec9d=['status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','sms','smsmessage:create','/:id/status'];(function(_0x59ce68,_0x98d1b5){var _0x37c816=function(_0x33e81b){while(--_0x33e81b){_0x59ce68['push'](_0x59ce68['shift']());}};_0x37c816(++_0x98d1b5);}(_0xec9d,0x133));var _0xdec9=function(_0x7ecdad,_0x44bfba){_0x7ecdad=_0x7ecdad-0x0;var _0x325013=_0xec9d[_0x7ecdad];return _0x325013;};'use strict';var multer=require(_0xdec9('0x0'));var util=require(_0xdec9('0x1'));var path=require(_0xdec9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdec9('0x3'));var config=require(_0xdec9('0x4'));var controller=require(_0xdec9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xdec9('0x6')]);router[_0xdec9('0x7')](_0xdec9('0x8'),auth['isAuthenticated'](),controller[_0xdec9('0x9')]);router['get'](_0xdec9('0xa'),auth[_0xdec9('0xb')](),controller[_0xdec9('0xc')]);router[_0xdec9('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xdec9('0xe'),_0xdec9('0xf')),controller['create']);router[_0xdec9('0xd')](_0xdec9('0x10'),controller[_0xdec9('0x11')]);router['put'](_0xdec9('0xa'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x12')]);router[_0xdec9('0x13')](_0xdec9('0x14'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x15')]);router[_0xdec9('0x13')](_0xdec9('0x16'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x17')]);router[_0xdec9('0x18')](_0xdec9('0xa'),auth[_0xdec9('0xb')](),controller[_0xdec9('0x19')]);module[_0xdec9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1796e53..bfb233e 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 _0xa239=['exports','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xa239,0x7d));var _0x9a23=function(_0x46e392,_0x4032e0){_0x46e392=_0x46e392-0x0;var _0x5cfe9c=_0xa239[_0x46e392];return _0x5cfe9c;};'use strict';var Sequelize=require(_0x9a23('0x0'));module[_0x9a23('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9a23('0x2')),'defaultValue':_0x9a23('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9a23('0x3')](0xbe)},'phone':{'type':Sequelize[_0x9a23('0x3')]},'readAt':{'type':Sequelize[_0x9a23('0x4')]},'secret':{'type':Sequelize[_0x9a23('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x2e35=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4f7b43,_0x119c22){var _0x2fcdf3=function(_0xaeee0c){while(--_0xaeee0c){_0x4f7b43['push'](_0x4f7b43['shift']());}};_0x2fcdf3(++_0x119c22);}(_0x2e35,0x1d0));var _0x52e3=function(_0x444b61,_0x27b182){_0x444b61=_0x444b61-0x0;var _0x4f7a21=_0x2e35[_0x444b61];return _0x4f7a21;};'use strict';var Sequelize=require(_0x52e3('0x0'));module[_0x52e3('0x1')]={'body':{'type':Sequelize[_0x52e3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x52e3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x52e3('0x4')]('in',_0x52e3('0x5')),'defaultValue':_0x52e3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x52e3('0x6')]},'readAt':{'type':Sequelize[_0x52e3('0x7')]},'secret':{'type':Sequelize[_0x52e3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7980473..86a93f2 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 _0xbfa6=['describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','delivered','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','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~!@#$%^&-_=+[{]}.','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x5a4c25,_0x2b4761){var _0x3bdeff=function(_0x54266a){while(--_0x54266a){_0x5a4c25['push'](_0x5a4c25['shift']());}};_0x3bdeff(++_0x2b4761);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x9e55f6,_0x5df434){_0x9e55f6=_0x9e55f6-0x0;var _0x220e55=_0xbfa6[_0x9e55f6];return _0x220e55;};'use strict';var pdf=require(_0x6bfa('0x0'));var emlformat=require(_0x6bfa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bfa('0x2'));var moment=require(_0x6bfa('0x3'));var BPromise=require(_0x6bfa('0x4'));var Mustache=require('mustache');var util=require(_0x6bfa('0x5'));var path=require(_0x6bfa('0x6'));var sox=require(_0x6bfa('0x7'));var csv=require(_0x6bfa('0x8'));var ejs=require(_0x6bfa('0x9'));var fs=require('fs');var _=require(_0x6bfa('0xa'));var squel=require(_0x6bfa('0xb'));var crypto=require('crypto');var jsforce=require(_0x6bfa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6bfa('0x8'));var querystring=require(_0x6bfa('0xd'));var Papa=require(_0x6bfa('0xe'));var Redis=require(_0x6bfa('0xf'));var authService=require(_0x6bfa('0x10'));var qs=require(_0x6bfa('0x11'));var as=require(_0x6bfa('0x12'));var hardwareService=require(_0x6bfa('0x13'));var logger=require(_0x6bfa('0x14'))(_0x6bfa('0x15'));var utils=require('../../config/utils');var config=require(_0x6bfa('0x16'));var db=require(_0x6bfa('0x17'))['db'];config[_0x6bfa('0x18')]=_['defaults'](config[_0x6bfa('0x18')],{'host':_0x6bfa('0x19'),'port':0x18eb});var socket=require(_0x6bfa('0x1a'))(new Redis(config[_0x6bfa('0x18')]));require(_0x6bfa('0x1b'))['register'](socket);var jayson=require(_0x6bfa('0x1c'));var client=jayson['client'][_0x6bfa('0x1d')]({'port':0x232c});var client9002=jayson[_0x6bfa('0x1e')][_0x6bfa('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x305210,_0x2c4944,_0x2a11ac){if(_0x2a11ac){var _0x331351=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x331351[_0x6bfa('0x1f')](_0x2c4944)){return _0x305210;}else{throw new db[(_0x6bfa('0x20'))]['ValidationError'](_0x6bfa('0x21'));}}else{return _0x305210;}}function respondWithRpcPromise(_0x49a835,_0x1b4c11,_0xa99566,_0x23db95){return new BPromise(function(_0x1affa5,_0x5ef6d0){var _0x508196=_0x23db95||client;return _0x508196['request'](_0x49a835,_0xa99566)['then'](function(_0x21760a){logger['info'](_0x6bfa('0x22'),_0x1b4c11,_0x6bfa('0x23'));logger[_0x6bfa('0x24')](_0x6bfa('0x25'),_0x1b4c11,_0x6bfa('0x23'),JSON[_0x6bfa('0x26')](_0x21760a));if(_0x21760a[_0x6bfa('0x27')]){if(_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x28')]===0x1f4){logger[_0x6bfa('0x27')](_0x6bfa('0x22'),_0x1b4c11,_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x29')]);return _0x5ef6d0(_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x29')]);}logger[_0x6bfa('0x27')]('SmsMessage,\x20%s,\x20%s',_0x1b4c11,_0x21760a[_0x6bfa('0x27')][_0x6bfa('0x29')]);return _0x1affa5(_0x21760a['error'][_0x6bfa('0x29')]);}else{logger[_0x6bfa('0x2a')](_0x6bfa('0x22'),_0x1b4c11,_0x6bfa('0x23'));_0x1affa5(_0x21760a[_0x6bfa('0x2b')][_0x6bfa('0x29')]);}})['catch'](function(_0x4c0b26){logger[_0x6bfa('0x27')](_0x6bfa('0x22'),_0x1b4c11,_0x4c0b26);_0x5ef6d0(_0x4c0b26);});});}function respondWithStatusCode(_0xcf2b43,_0x2b0171){_0x2b0171=_0x2b0171||0xcc;return function(_0x4291e6){if(_0x4291e6){return _0xcf2b43[_0x6bfa('0x2c')](_0x2b0171);}return _0xcf2b43[_0x6bfa('0x2d')](_0x2b0171)[_0x6bfa('0x2e')]();};}function respondWithResult(_0x243c94,_0x2154f0){_0x2154f0=_0x2154f0||0xc8;return function(_0x2a550b){if(_0x2a550b){return _0x243c94['status'](_0x2154f0)[_0x6bfa('0x2f')](_0x2a550b);}};}function respondWithFilteredResult(_0x1bf435,_0x5633d0){return function(_0x340eaa){if(_0x340eaa){var _0x498683=_0x340eaa[_0x6bfa('0x30')],_0x15cd72=_0x5633d0[_0x6bfa('0x31')],_0x47845d=_0x5633d0[_0x6bfa('0x31')]+_0x5633d0['limit'],_0x38be66;if(_0x47845d>=_0x498683){_0x47845d=_0x498683;_0x38be66=0xc8;}else{_0x38be66=0xce;}_0x1bf435[_0x6bfa('0x2d')](_0x38be66);return _0x1bf435[_0x6bfa('0x32')](_0x6bfa('0x33'),_0x15cd72+'-'+_0x47845d+'/'+_0x498683)[_0x6bfa('0x2f')](_0x340eaa);}return null;};}function patchUpdates(_0x986408){return function(_0x14f446){try{jsonpatch[_0x6bfa('0x34')](_0x14f446,_0x986408,!![]);}catch(_0x3a5b8b){return BPromise[_0x6bfa('0x35')](_0x3a5b8b);}return _0x14f446['save']();};}function saveUpdates(_0x18bcb3,_0x28a34e){return function(_0x537d3c){if(_0x537d3c){return _0x537d3c[_0x6bfa('0x36')](_0x18bcb3)['then'](function(_0x14fef5){return _0x14fef5;});}return null;};}function removeEntity(_0x46f197,_0x346e7e){return function(_0x5a2785){if(_0x5a2785){return _0x5a2785[_0x6bfa('0x37')]()[_0x6bfa('0x38')](function(){_0x46f197[_0x6bfa('0x2d')](0xcc)[_0x6bfa('0x2e')]();});}};}function handleEntityNotFound(_0x4aaf62,_0x1a5a4e){return function(_0x140020){if(!_0x140020){_0x4aaf62[_0x6bfa('0x2c')](0x194);}return _0x140020;};}function handleError(_0x40049b,_0x3e94d2){_0x3e94d2=_0x3e94d2||0x1f4;return function(_0x2f6ec7){logger['error'](_0x2f6ec7[_0x6bfa('0x39')]);if(_0x2f6ec7[_0x6bfa('0x3a')]){delete _0x2f6ec7[_0x6bfa('0x3a')];}_0x40049b[_0x6bfa('0x2d')](_0x3e94d2)[_0x6bfa('0x3b')](_0x2f6ec7);};}exports[_0x6bfa('0x3c')]=function(_0x235b45,_0x4c27a0){var _0x50cc25={},_0x496295={},_0x1084e7={'count':0x0,'rows':[]};var _0x4d06ec=_[_0x6bfa('0x3d')](db[_0x6bfa('0x3e')][_0x6bfa('0x3f')],function(_0x4a72a9){return{'name':_0x4a72a9[_0x6bfa('0x40')],'type':_0x4a72a9[_0x6bfa('0x41')][_0x6bfa('0x42')]};});_0x496295['model']=_[_0x6bfa('0x3d')](_0x4d06ec,_0x6bfa('0x3a'));_0x496295[_0x6bfa('0x43')]=_[_0x6bfa('0x44')](_0x235b45[_0x6bfa('0x43')]);_0x496295[_0x6bfa('0x45')]=_[_0x6bfa('0x46')](_0x496295[_0x6bfa('0x47')],_0x496295[_0x6bfa('0x43')]);_0x50cc25['attributes']=_[_0x6bfa('0x46')](_0x496295[_0x6bfa('0x47')],qs[_0x6bfa('0x48')](_0x235b45[_0x6bfa('0x43')]['fields']));_0x50cc25[_0x6bfa('0x49')]=_0x50cc25[_0x6bfa('0x49')]['length']?_0x50cc25[_0x6bfa('0x49')]:_0x496295['model'];if(!_0x235b45[_0x6bfa('0x43')]['hasOwnProperty'](_0x6bfa('0x4a'))){_0x50cc25['limit']=qs[_0x6bfa('0x4b')](_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x4b')]);_0x50cc25['offset']=qs[_0x6bfa('0x31')](_0x235b45['query'][_0x6bfa('0x31')]);}_0x50cc25[_0x6bfa('0x4c')]=qs['sort'](_0x235b45[_0x6bfa('0x43')]['sort']);_0x50cc25[_0x6bfa('0x4d')]=qs[_0x6bfa('0x45')](_[_0x6bfa('0x4e')](_0x235b45[_0x6bfa('0x43')],_0x496295[_0x6bfa('0x45')]),_0x4d06ec);if(_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x4f')]){_0x50cc25[_0x6bfa('0x4d')]=_[_0x6bfa('0x50')](_0x50cc25[_0x6bfa('0x4d')],{'$or':_[_0x6bfa('0x3d')](_0x4d06ec,function(_0x18516b){if(_0x18516b['type']!=='VIRTUAL'){var _0x4dc69c={};_0x4dc69c[_0x18516b[_0x6bfa('0x3a')]]={'$like':'%'+_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x4f')]+'%'};return _0x4dc69c;}})});}_0x50cc25=_['merge']({},_0x50cc25,_0x235b45[_0x6bfa('0x51')]);var _0x438d60={'where':_0x50cc25[_0x6bfa('0x4d')]};return db['SmsMessage'][_0x6bfa('0x30')](_0x438d60)[_0x6bfa('0x38')](function(_0x5529aa){_0x1084e7['count']=_0x5529aa;if(_0x235b45[_0x6bfa('0x43')][_0x6bfa('0x52')]){_0x50cc25[_0x6bfa('0x53')]=[{'all':!![]}];}return db[_0x6bfa('0x3e')][_0x6bfa('0x54')](_0x50cc25);})[_0x6bfa('0x38')](function(_0x3ce909){_0x1084e7[_0x6bfa('0x55')]=_0x3ce909;return _0x1084e7;})[_0x6bfa('0x38')](respondWithFilteredResult(_0x4c27a0,_0x50cc25))[_0x6bfa('0x56')](handleError(_0x4c27a0,null));};exports[_0x6bfa('0x57')]=function(_0x234f7e,_0x43f025){var _0x3068c0={'raw':!![],'where':{'id':_0x234f7e[_0x6bfa('0x58')]['id']}},_0x6ef173={};_0x6ef173[_0x6bfa('0x47')]=_[_0x6bfa('0x44')](db[_0x6bfa('0x3e')]['rawAttributes']);_0x6ef173[_0x6bfa('0x43')]=_[_0x6bfa('0x44')](_0x234f7e[_0x6bfa('0x43')]);_0x6ef173['filters']=_[_0x6bfa('0x46')](_0x6ef173[_0x6bfa('0x47')],_0x6ef173['query']);_0x3068c0[_0x6bfa('0x49')]=_['intersection'](_0x6ef173['model'],qs[_0x6bfa('0x48')](_0x234f7e['query'][_0x6bfa('0x48')]));_0x3068c0[_0x6bfa('0x49')]=_0x3068c0[_0x6bfa('0x49')]['length']?_0x3068c0['attributes']:_0x6ef173[_0x6bfa('0x47')];if(_0x234f7e['query'][_0x6bfa('0x52')]){_0x3068c0[_0x6bfa('0x53')]=[{'all':!![]}];}_0x3068c0=_['merge']({},_0x3068c0,_0x234f7e['options']);return db[_0x6bfa('0x3e')][_0x6bfa('0x59')](_0x3068c0)[_0x6bfa('0x38')](handleEntityNotFound(_0x43f025,null))['then'](respondWithResult(_0x43f025,null))['catch'](handleError(_0x43f025,null));};exports[_0x6bfa('0x5a')]=function(_0x9e461,_0x1d5a1b){return db[_0x6bfa('0x3e')][_0x6bfa('0x5a')](_0x9e461[_0x6bfa('0x5b')],{})[_0x6bfa('0x38')](respondWithResult(_0x1d5a1b,0xc9))[_0x6bfa('0x56')](handleError(_0x1d5a1b,null));};exports[_0x6bfa('0x36')]=function(_0x136453,_0x407a73){if(_0x136453[_0x6bfa('0x5b')]['id']){delete _0x136453['body']['id'];}return db[_0x6bfa('0x3e')]['find']({'where':{'id':_0x136453['params']['id']}})[_0x6bfa('0x38')](handleEntityNotFound(_0x407a73,null))[_0x6bfa('0x38')](saveUpdates(_0x136453[_0x6bfa('0x5b')],null))[_0x6bfa('0x38')](respondWithResult(_0x407a73,null))['catch'](handleError(_0x407a73,null));};exports[_0x6bfa('0x37')]=function(_0x5c3b54,_0x1d15d5){return db[_0x6bfa('0x3e')][_0x6bfa('0x59')]({'where':{'id':_0x5c3b54['params']['id']}})[_0x6bfa('0x38')](handleEntityNotFound(_0x1d15d5,null))['then'](removeEntity(_0x1d15d5,null))['catch'](handleError(_0x1d15d5,null));};exports[_0x6bfa('0x5c')]=function(_0x78a9c3,_0x26aecf){return db['SmsMessage'][_0x6bfa('0x5c')]()[_0x6bfa('0x38')](respondWithResult(_0x26aecf,null))['catch'](handleError(_0x26aecf,null));};var interaction_log=require(_0x6bfa('0x14'))(_0x6bfa('0x5d'));exports['accept']=function(_0x772ad2,_0x1458c2,_0x35cced){var _0x126360={'channel':_0x6bfa('0x5e')};if(_0x772ad2['body']['id']){delete _0x772ad2[_0x6bfa('0x5b')]['id'];}_0x772ad2['body'][_0x6bfa('0x5f')]=!![];_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x60')]=moment()[_0x6bfa('0x61')](_0x6bfa('0x62'));_0x772ad2[_0x6bfa('0x5b')]['UserId']=_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x63')]||_0x772ad2[_0x6bfa('0x64')]['id'];return db[_0x6bfa('0x3e')][_0x6bfa('0x59')]({'where':{'id':_0x772ad2[_0x6bfa('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6bfa('0x65')}]})[_0x6bfa('0x38')](handleEntityNotFound(_0x1458c2,null))[_0x6bfa('0x38')](saveUpdates(_0x772ad2[_0x6bfa('0x5b')],null))[_0x6bfa('0x38')](function(_0x2e45f4){if(_0x2e45f4){_0x126360[_0x6bfa('0x29')]=_0x2e45f4[_0x6bfa('0x66')]({'plain':!![]});return db[_0x6bfa('0x67')]['find']({'where':{'id':_0x2e45f4[_0x6bfa('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1458c2,null))['then'](function(_0x1f5e4f){if(_0x1f5e4f){return _0x1f5e4f[_0x6bfa('0x36')]({'UserId':_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x63')],'read1stAt':_[_0x6bfa('0x69')](_0x1f5e4f[_0x6bfa('0x6a')])?moment()[_0x6bfa('0x61')](_0x6bfa('0x62')):undefined});}return null;})['then'](function(_0x5b05a8){if(_0x5b05a8){_0x126360[_0x6bfa('0x6b')]=_0x5b05a8[_0x6bfa('0x66')]({'plain':!![]});interaction_log[_0x6bfa('0x2a')](_0x6bfa('0x6c'),_0x772ad2['user']['id'],_0x772ad2[_0x6bfa('0x64')][_0x6bfa('0x3a')],_0x772ad2['user']['role'],_0x126360[_0x6bfa('0x6b')]['id'],_0x772ad2[_0x6bfa('0x5b')]?JSON[_0x6bfa('0x26')](_0x772ad2['body']):_0x6bfa('0x6d'));return respondWithRpcPromise(_0x6bfa('0x6e'),'acceptMessage',_0x126360);}return null;})[_0x6bfa('0x38')](function(_0x188040){if(_0x188040){if(_0x772ad2[_0x6bfa('0x5b')][_0x6bfa('0x6f')]){_0x126360[_0x6bfa('0x29')][_0x6bfa('0x70')]=util[_0x6bfa('0x61')](_0x6bfa('0x71'),_0x772ad2[_0x6bfa('0x64')]['name']);_0x126360[_0x6bfa('0x29')][_0x6bfa('0x72')]=_0x126360[_0x6bfa('0x72')];_0x126360[_0x6bfa('0x29')][_0x6bfa('0x73')]=_0x6bfa('0x74');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6bfa('0x75'),'message':_0x126360[_0x6bfa('0x29')]},client9002)['then'](function(){return _0x126360;});}return _0x126360;}return null;})[_0x6bfa('0x38')](respondWithResult(_0x1458c2,null))[_0x6bfa('0x56')](handleError(_0x1458c2,null));};var interaction_log=require(_0x6bfa('0x14'))('sms-interactions');exports[_0x6bfa('0x35')]=function(_0x52bc7c,_0x5a3158,_0x4cd72e){var _0x90203f={'agent':{},'channel':_0x6bfa('0x5e')};if(_0x52bc7c['body']['id']){delete _0x52bc7c[_0x6bfa('0x5b')]['id'];}_0x52bc7c[_0x6bfa('0x5b')]['UserId']=_0x52bc7c['body'][_0x6bfa('0x63')]||_0x52bc7c[_0x6bfa('0x64')]['id'];_0x90203f[_0x6bfa('0x76')]['id']=_0x52bc7c[_0x6bfa('0x5b')][_0x6bfa('0x63')];return db['SmsMessage'][_0x6bfa('0x59')]({'where':{'id':_0x52bc7c[_0x6bfa('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a3158,null))[_0x6bfa('0x38')](function(_0x285c68){if(_0x285c68){_0x90203f['message']=_0x285c68[_0x6bfa('0x66')]({'plain':!![]});return db[_0x6bfa('0x67')][_0x6bfa('0x59')]({'where':{'id':_0x285c68['SmsInteractionId']}});}return null;})[_0x6bfa('0x38')](handleEntityNotFound(_0x5a3158,null))[_0x6bfa('0x38')](function(_0x649385){if(_0x649385){_0x90203f[_0x6bfa('0x6b')]=_0x649385[_0x6bfa('0x66')]({'plain':!![]});interaction_log[_0x6bfa('0x2a')](_0x6bfa('0x77'),_0x52bc7c[_0x6bfa('0x64')]['id'],_0x52bc7c['user'][_0x6bfa('0x3a')],_0x52bc7c['user'][_0x6bfa('0x78')],_0x90203f[_0x6bfa('0x6b')]['id'],_0x52bc7c[_0x6bfa('0x5b')]?JSON[_0x6bfa('0x26')](_0x52bc7c[_0x6bfa('0x5b')]):_0x6bfa('0x6d'));return respondWithRpcPromise(_0x6bfa('0x79'),_0x6bfa('0x7a'),_0x90203f);}return null;})[_0x6bfa('0x38')](function(_0x9c54fb){if(_0x9c54fb){_0x9c54fb[_0x6bfa('0x29')][_0x6bfa('0x70')]=util[_0x6bfa('0x61')](_0x6bfa('0x71'),_0x52bc7c[_0x6bfa('0x64')][_0x6bfa('0x3a')]);_0x9c54fb[_0x6bfa('0x29')][_0x6bfa('0x72')]=_0x90203f[_0x6bfa('0x72')];_0x9c54fb[_0x6bfa('0x29')][_0x6bfa('0x73')]=_0x6bfa('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x9c54fb['message']},client9002);return _0x90203f;}return null;})[_0x6bfa('0x38')](respondWithResult(_0x5a3158,null))[_0x6bfa('0x56')](handleError(_0x5a3158,null));};exports[_0x6bfa('0x2d')]=function(_0x3888fb,_0x536a28,_0x2466b6){if(_0x3888fb[_0x6bfa('0x5b')]['id']){delete _0x3888fb[_0x6bfa('0x5b')]['id'];}var _0x3a22fb;return db['SmsMessage'][_0x6bfa('0x59')]({'where':{'id':_0x3888fb[_0x6bfa('0x58')]['id']}})[_0x6bfa('0x38')](handleEntityNotFound(_0x536a28,null))[_0x6bfa('0x38')](function(_0x9db255){if(_0x9db255){_0x3a22fb=_0x9db255;return db[_0x6bfa('0x7b')][_0x6bfa('0x59')]({'where':{'id':_0x9db255[_0x6bfa('0x7c')]}});}})[_0x6bfa('0x38')](handleEntityNotFound(_0x536a28,null))[_0x6bfa('0x38')](function(_0x4dc7c6){if(_0x4dc7c6){logger[_0x6bfa('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6bfa('0x2d'),_0x6bfa('0x7d'),_0x4dc7c6[_0x6bfa('0x41')],util[_0x6bfa('0x7e')](_0x3888fb[_0x6bfa('0x5b')],{'showHidden':![],'depth':null}));switch(_0x4dc7c6['type']){case _0x6bfa('0x7f'):if(_0x3888fb[_0x6bfa('0x5b')][_0x6bfa('0x80')]&&_0x3888fb[_0x6bfa('0x5b')][_0x6bfa('0x80')]===_0x3a22fb['messageId']){return _0x3a22fb[_0x6bfa('0x36')]({'read':!![]});}else{logger['error'](_0x6bfa('0x81'),_0x6bfa('0x2d'),_0x6bfa('0x7f'),util[_0x6bfa('0x7e')](_0x3888fb['body'],{'showHidden':![],'depth':null}));}break;case _0x6bfa('0x82'):if(_0x3888fb['body']['MessageUUID']&&_0x3888fb['body'][_0x6bfa('0x83')]===_0x3a22fb[_0x6bfa('0x84')]&&_[_0x6bfa('0x85')](['sent',_0x6bfa('0x86')],_0x3888fb['body']['Status'])>=0x0){return _0x3a22fb[_0x6bfa('0x36')]({'read':!![]});}else{logger[_0x6bfa('0x27')](_0x6bfa('0x81'),'status',_0x6bfa('0x87'),util[_0x6bfa('0x7e')](_0x3888fb[_0x6bfa('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6bfa('0x88'):var _0x445589=_0x3888fb['body']['results'][0x0];if(_0x445589['status'][_0x6bfa('0x89')]===_0x6bfa('0x8a')){return _0x3a22fb[_0x6bfa('0x36')]({'read':!![]});}else{logger['error'](_0x6bfa('0x81'),_0x6bfa('0x2d'),_0x6bfa('0x88'),util['inspect'](_0x3888fb['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a22fb;}})[_0x6bfa('0x38')](respondWithResult(_0x536a28,null))[_0x6bfa('0x56')](handleError(_0x536a28,null));}; \ No newline at end of file +var _0x2f3a=['jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','stack','send','map','SmsMessage','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','rows','show','keys','rawAttributes','length','include','options','find','body','update','params','destroy','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','format','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','DELIVERED','infobip','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x450e61,_0x2aebc0){_0x450e61=_0x450e61-0x0;var _0x303f67=_0x2f3a[_0x450e61];return _0x303f67;};'use strict';var pdf=require(_0xa2f3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa2f3('0x1'));var jsonpatch=require(_0xa2f3('0x2'));var rp=require(_0xa2f3('0x3'));var moment=require(_0xa2f3('0x4'));var BPromise=require(_0xa2f3('0x5'));var Mustache=require(_0xa2f3('0x6'));var util=require('util');var path=require(_0xa2f3('0x7'));var sox=require('sox');var csv=require(_0xa2f3('0x8'));var ejs=require(_0xa2f3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2f3('0xa'));var jsforce=require(_0xa2f3('0xb'));var deskjs=require(_0xa2f3('0xc'));var toCsv=require(_0xa2f3('0x8'));var querystring=require('querystring');var Papa=require(_0xa2f3('0xd'));var Redis=require(_0xa2f3('0xe'));var authService=require(_0xa2f3('0xf'));var qs=require(_0xa2f3('0x10'));var as=require(_0xa2f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2f3('0x12'))(_0xa2f3('0x13'));var utils=require('../../config/utils');var config=require(_0xa2f3('0x14'));var db=require(_0xa2f3('0x15'))['db'];config[_0xa2f3('0x16')]=_['defaults'](config[_0xa2f3('0x16')],{'host':_0xa2f3('0x17'),'port':0x18eb});var socket=require(_0xa2f3('0x18'))(new Redis(config[_0xa2f3('0x16')]));require(_0xa2f3('0x19'))[_0xa2f3('0x1a')](socket);var jayson=require(_0xa2f3('0x1b'));var client=jayson[_0xa2f3('0x1c')][_0xa2f3('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xa2f3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x33bf10,_0x74fb58,_0x51d297){if(_0x51d297){var _0x3f9782=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f9782[_0xa2f3('0x1e')](_0x74fb58)){return _0x33bf10;}else{throw new db['Sequelize']['ValidationError'](_0xa2f3('0x1f'));}}else{return _0x33bf10;}}function respondWithRpcPromise(_0x7706bd,_0x2db0d2,_0x1c5c62,_0x205578){return new BPromise(function(_0x23309e,_0x30be69){var _0xde603d=_0x205578||client;return _0xde603d['request'](_0x7706bd,_0x1c5c62)[_0xa2f3('0x20')](function(_0x24850a){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2db0d2,_0xa2f3('0x21'));logger['debug'](_0xa2f3('0x22'),_0x2db0d2,_0xa2f3('0x21'),JSON['stringify'](_0x24850a));if(_0x24850a[_0xa2f3('0x23')]){if(_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x24')]===0x1f4){logger[_0xa2f3('0x23')](_0xa2f3('0x25'),_0x2db0d2,_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x26')]);return _0x30be69(_0x24850a[_0xa2f3('0x23')]['message']);}logger[_0xa2f3('0x23')](_0xa2f3('0x25'),_0x2db0d2,_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x26')]);return _0x23309e(_0x24850a[_0xa2f3('0x23')][_0xa2f3('0x26')]);}else{logger[_0xa2f3('0x27')]('SmsMessage,\x20%s,\x20%s',_0x2db0d2,'request\x20sent');_0x23309e(_0x24850a[_0xa2f3('0x28')][_0xa2f3('0x26')]);}})[_0xa2f3('0x29')](function(_0x13982c){logger['error'](_0xa2f3('0x25'),_0x2db0d2,_0x13982c);_0x30be69(_0x13982c);});});}function respondWithStatusCode(_0x1eb1cc,_0x3cbeeb){_0x3cbeeb=_0x3cbeeb||0xcc;return function(_0x5afda4){if(_0x5afda4){return _0x1eb1cc[_0xa2f3('0x2a')](_0x3cbeeb);}return _0x1eb1cc['status'](_0x3cbeeb)[_0xa2f3('0x2b')]();};}function respondWithResult(_0x5b868c,_0x452142){_0x452142=_0x452142||0xc8;return function(_0x52f211){if(_0x52f211){return _0x5b868c[_0xa2f3('0x2c')](_0x452142)['json'](_0x52f211);}};}function respondWithFilteredResult(_0xb65c3e,_0x210a42){return function(_0x2e8291){if(_0x2e8291){var _0x253fed=_0x2e8291[_0xa2f3('0x2d')],_0x94ddd8=_0x210a42[_0xa2f3('0x2e')],_0x50ae25=_0x210a42[_0xa2f3('0x2e')]+_0x210a42[_0xa2f3('0x2f')],_0x27351d;if(_0x50ae25>=_0x253fed){_0x50ae25=_0x253fed;_0x27351d=0xc8;}else{_0x27351d=0xce;}_0xb65c3e[_0xa2f3('0x2c')](_0x27351d);return _0xb65c3e[_0xa2f3('0x30')](_0xa2f3('0x31'),_0x94ddd8+'-'+_0x50ae25+'/'+_0x253fed)[_0xa2f3('0x32')](_0x2e8291);}return null;};}function patchUpdates(_0x4a0d9f){return function(_0x20d9b1){try{jsonpatch[_0xa2f3('0x33')](_0x20d9b1,_0x4a0d9f,!![]);}catch(_0x3bbd87){return BPromise[_0xa2f3('0x34')](_0x3bbd87);}return _0x20d9b1[_0xa2f3('0x35')]();};}function saveUpdates(_0x48b584,_0x334be6){return function(_0x5bd47c){if(_0x5bd47c){return _0x5bd47c['update'](_0x48b584)[_0xa2f3('0x20')](function(_0x1c96e6){return _0x1c96e6;});}return null;};}function removeEntity(_0x4fad9a,_0x3f4ea0){return function(_0x41770c){if(_0x41770c){return _0x41770c['destroy']()[_0xa2f3('0x20')](function(){_0x4fad9a[_0xa2f3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8b7a,_0x281541){return function(_0x406358){if(!_0x406358){_0x5d8b7a[_0xa2f3('0x2a')](0x194);}return _0x406358;};}function handleError(_0x1219aa,_0x57c7c5){_0x57c7c5=_0x57c7c5||0x1f4;return function(_0x170b07){logger['error'](_0x170b07[_0xa2f3('0x36')]);if(_0x170b07['name']){delete _0x170b07['name'];}_0x1219aa[_0xa2f3('0x2c')](_0x57c7c5)[_0xa2f3('0x37')](_0x170b07);};}exports['index']=function(_0x1c49b1,_0x5a0f36){var _0x399f3f={},_0x3390fe={},_0x306b75={'count':0x0,'rows':[]};var _0x11dade=_[_0xa2f3('0x38')](db[_0xa2f3('0x39')]['rawAttributes'],function(_0x354554){return{'name':_0x354554[_0xa2f3('0x3a')],'type':_0x354554[_0xa2f3('0x3b')][_0xa2f3('0x3c')]};});_0x3390fe[_0xa2f3('0x3d')]=_[_0xa2f3('0x38')](_0x11dade,_0xa2f3('0x3e'));_0x3390fe[_0xa2f3('0x3f')]=_['keys'](_0x1c49b1[_0xa2f3('0x3f')]);_0x3390fe[_0xa2f3('0x40')]=_[_0xa2f3('0x41')](_0x3390fe[_0xa2f3('0x3d')],_0x3390fe[_0xa2f3('0x3f')]);_0x399f3f['attributes']=_[_0xa2f3('0x41')](_0x3390fe[_0xa2f3('0x3d')],qs['fields'](_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x42')]));_0x399f3f[_0xa2f3('0x43')]=_0x399f3f[_0xa2f3('0x43')]['length']?_0x399f3f[_0xa2f3('0x43')]:_0x3390fe[_0xa2f3('0x3d')];if(!_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x44')](_0xa2f3('0x45'))){_0x399f3f[_0xa2f3('0x2f')]=qs[_0xa2f3('0x2f')](_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x2f')]);_0x399f3f[_0xa2f3('0x2e')]=qs[_0xa2f3('0x2e')](_0x1c49b1[_0xa2f3('0x3f')]['offset']);}_0x399f3f[_0xa2f3('0x46')]=qs['sort'](_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x47')]);_0x399f3f[_0xa2f3('0x48')]=qs[_0xa2f3('0x40')](_['pick'](_0x1c49b1[_0xa2f3('0x3f')],_0x3390fe[_0xa2f3('0x40')]),_0x11dade);if(_0x1c49b1['query']['filter']){_0x399f3f[_0xa2f3('0x48')]=_[_0xa2f3('0x49')](_0x399f3f[_0xa2f3('0x48')],{'$or':_[_0xa2f3('0x38')](_0x11dade,function(_0x2477e0){if(_0x2477e0['type']!=='VIRTUAL'){var _0x510bfa={};_0x510bfa[_0x2477e0[_0xa2f3('0x3e')]]={'$like':'%'+_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x4a')]+'%'};return _0x510bfa;}})});}_0x399f3f=_[_0xa2f3('0x49')]({},_0x399f3f,_0x1c49b1['options']);var _0x1b68ac={'where':_0x399f3f[_0xa2f3('0x48')]};return db[_0xa2f3('0x39')][_0xa2f3('0x2d')](_0x1b68ac)['then'](function(_0x5cacfc){_0x306b75[_0xa2f3('0x2d')]=_0x5cacfc;if(_0x1c49b1[_0xa2f3('0x3f')][_0xa2f3('0x4b')]){_0x399f3f['include']=[{'all':!![]}];}return db[_0xa2f3('0x39')]['findAll'](_0x399f3f);})[_0xa2f3('0x20')](function(_0x598a54){_0x306b75[_0xa2f3('0x4c')]=_0x598a54;return _0x306b75;})[_0xa2f3('0x20')](respondWithFilteredResult(_0x5a0f36,_0x399f3f))[_0xa2f3('0x29')](handleError(_0x5a0f36,null));};exports[_0xa2f3('0x4d')]=function(_0x11315d,_0x26a51a){var _0x33a700={'raw':!![],'where':{'id':_0x11315d['params']['id']}},_0x570a4b={};_0x570a4b[_0xa2f3('0x3d')]=_[_0xa2f3('0x4e')](db[_0xa2f3('0x39')][_0xa2f3('0x4f')]);_0x570a4b[_0xa2f3('0x3f')]=_[_0xa2f3('0x4e')](_0x11315d['query']);_0x570a4b[_0xa2f3('0x40')]=_[_0xa2f3('0x41')](_0x570a4b['model'],_0x570a4b[_0xa2f3('0x3f')]);_0x33a700['attributes']=_[_0xa2f3('0x41')](_0x570a4b[_0xa2f3('0x3d')],qs[_0xa2f3('0x42')](_0x11315d['query'][_0xa2f3('0x42')]));_0x33a700[_0xa2f3('0x43')]=_0x33a700[_0xa2f3('0x43')][_0xa2f3('0x50')]?_0x33a700[_0xa2f3('0x43')]:_0x570a4b[_0xa2f3('0x3d')];if(_0x11315d[_0xa2f3('0x3f')][_0xa2f3('0x4b')]){_0x33a700[_0xa2f3('0x51')]=[{'all':!![]}];}_0x33a700=_['merge']({},_0x33a700,_0x11315d[_0xa2f3('0x52')]);return db[_0xa2f3('0x39')][_0xa2f3('0x53')](_0x33a700)[_0xa2f3('0x20')](handleEntityNotFound(_0x26a51a,null))[_0xa2f3('0x20')](respondWithResult(_0x26a51a,null))[_0xa2f3('0x29')](handleError(_0x26a51a,null));};exports['create']=function(_0x475c42,_0x4f7585){return db['SmsMessage']['create'](_0x475c42[_0xa2f3('0x54')],{})[_0xa2f3('0x20')](respondWithResult(_0x4f7585,0xc9))[_0xa2f3('0x29')](handleError(_0x4f7585,null));};exports[_0xa2f3('0x55')]=function(_0x5d5004,_0x39c2f9){if(_0x5d5004[_0xa2f3('0x54')]['id']){delete _0x5d5004['body']['id'];}return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x5d5004[_0xa2f3('0x56')]['id']}})['then'](handleEntityNotFound(_0x39c2f9,null))[_0xa2f3('0x20')](saveUpdates(_0x5d5004['body'],null))[_0xa2f3('0x20')](respondWithResult(_0x39c2f9,null))[_0xa2f3('0x29')](handleError(_0x39c2f9,null));};exports[_0xa2f3('0x57')]=function(_0x349159,_0x206e65){return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x349159[_0xa2f3('0x56')]['id']}})['then'](handleEntityNotFound(_0x206e65,null))[_0xa2f3('0x20')](removeEntity(_0x206e65,null))[_0xa2f3('0x29')](handleError(_0x206e65,null));};exports[_0xa2f3('0x58')]=function(_0x5ed510,_0x36d2e6){return db['SmsMessage']['describe']()[_0xa2f3('0x20')](respondWithResult(_0x36d2e6,null))[_0xa2f3('0x29')](handleError(_0x36d2e6,null));};var interaction_log=require('../../config/logger')(_0xa2f3('0x59'));exports[_0xa2f3('0x5a')]=function(_0x4e96e0,_0x257d9b,_0x4cc71c){var _0x41f629={'channel':'sms'};if(_0x4e96e0[_0xa2f3('0x54')]['id']){delete _0x4e96e0[_0xa2f3('0x54')]['id'];}_0x4e96e0[_0xa2f3('0x54')][_0xa2f3('0x5b')]=!![];_0x4e96e0['body'][_0xa2f3('0x5c')]=moment()['format'](_0xa2f3('0x5d'));_0x4e96e0[_0xa2f3('0x54')][_0xa2f3('0x5e')]=_0x4e96e0[_0xa2f3('0x54')]['UserId']||_0x4e96e0[_0xa2f3('0x5f')]['id'];return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x4e96e0[_0xa2f3('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa2f3('0x60')],'as':_0xa2f3('0x61')}]})['then'](handleEntityNotFound(_0x257d9b,null))['then'](saveUpdates(_0x4e96e0[_0xa2f3('0x54')],null))[_0xa2f3('0x20')](function(_0x208ee5){if(_0x208ee5){_0x41f629[_0xa2f3('0x26')]=_0x208ee5[_0xa2f3('0x62')]({'plain':!![]});return db[_0xa2f3('0x63')][_0xa2f3('0x53')]({'where':{'id':_0x208ee5[_0xa2f3('0x64')]}});}return null;})[_0xa2f3('0x20')](handleEntityNotFound(_0x257d9b,null))[_0xa2f3('0x20')](function(_0x34f5e5){if(_0x34f5e5){return _0x34f5e5[_0xa2f3('0x55')]({'UserId':_0x4e96e0['body']['UserId'],'read1stAt':_['isNil'](_0x34f5e5[_0xa2f3('0x65')])?moment()['format'](_0xa2f3('0x5d')):undefined});}return null;})[_0xa2f3('0x20')](function(_0xae17a5){if(_0xae17a5){_0x41f629[_0xa2f3('0x66')]=_0xae17a5[_0xa2f3('0x62')]({'plain':!![]});interaction_log[_0xa2f3('0x27')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e96e0[_0xa2f3('0x5f')]['id'],_0x4e96e0['user'][_0xa2f3('0x3e')],_0x4e96e0[_0xa2f3('0x5f')][_0xa2f3('0x67')],_0x41f629['interaction']['id'],_0x4e96e0[_0xa2f3('0x54')]?JSON[_0xa2f3('0x68')](_0x4e96e0['body']):_0xa2f3('0x69'));return respondWithRpcPromise(_0xa2f3('0x6a'),_0xa2f3('0x6b'),_0x41f629);}return null;})[_0xa2f3('0x20')](function(_0x4fcec7){if(_0x4fcec7){if(_0x4e96e0[_0xa2f3('0x54')][_0xa2f3('0x6c')]){_0x41f629[_0xa2f3('0x26')]['interface']=util['format'](_0xa2f3('0x6d'),_0x4e96e0[_0xa2f3('0x5f')][_0xa2f3('0x3e')]);_0x41f629[_0xa2f3('0x26')][_0xa2f3('0x6e')]=_0x41f629[_0xa2f3('0x6e')];_0x41f629[_0xa2f3('0x26')][_0xa2f3('0x6f')]=_0xa2f3('0x5a');return respondWithRpcPromise(_0xa2f3('0x70'),'EventManager',{'event':_0xa2f3('0x71'),'message':_0x41f629['message']},client9002)['then'](function(){return _0x41f629;});}return _0x41f629;}return null;})[_0xa2f3('0x20')](respondWithResult(_0x257d9b,null))[_0xa2f3('0x29')](handleError(_0x257d9b,null));};var interaction_log=require(_0xa2f3('0x12'))('sms-interactions');exports[_0xa2f3('0x34')]=function(_0x4013b6,_0x11e7ee,_0x440450){var _0xfb23ad={'agent':{},'channel':_0xa2f3('0x72')};if(_0x4013b6['body']['id']){delete _0x4013b6[_0xa2f3('0x54')]['id'];}_0x4013b6['body'][_0xa2f3('0x5e')]=_0x4013b6[_0xa2f3('0x54')][_0xa2f3('0x5e')]||_0x4013b6[_0xa2f3('0x5f')]['id'];_0xfb23ad[_0xa2f3('0x73')]['id']=_0x4013b6[_0xa2f3('0x54')]['UserId'];return db[_0xa2f3('0x39')][_0xa2f3('0x53')]({'where':{'id':_0x4013b6[_0xa2f3('0x56')]['id'],'UserId':null}})[_0xa2f3('0x20')](handleEntityNotFound(_0x11e7ee,null))[_0xa2f3('0x20')](function(_0x646351){if(_0x646351){_0xfb23ad[_0xa2f3('0x26')]=_0x646351[_0xa2f3('0x62')]({'plain':!![]});return db[_0xa2f3('0x63')][_0xa2f3('0x53')]({'where':{'id':_0x646351['SmsInteractionId']}});}return null;})[_0xa2f3('0x20')](handleEntityNotFound(_0x11e7ee,null))[_0xa2f3('0x20')](function(_0x4511ca){if(_0x4511ca){_0xfb23ad[_0xa2f3('0x66')]=_0x4511ca[_0xa2f3('0x62')]({'plain':!![]});interaction_log[_0xa2f3('0x27')](_0xa2f3('0x74'),_0x4013b6['user']['id'],_0x4013b6[_0xa2f3('0x5f')][_0xa2f3('0x3e')],_0x4013b6[_0xa2f3('0x5f')][_0xa2f3('0x67')],_0xfb23ad[_0xa2f3('0x66')]['id'],_0x4013b6['body']?JSON[_0xa2f3('0x68')](_0x4013b6['body']):_0xa2f3('0x69'));return respondWithRpcPromise(_0xa2f3('0x75'),_0xa2f3('0x76'),_0xfb23ad);}return null;})[_0xa2f3('0x20')](function(_0x1ad2d3){if(_0x1ad2d3){_0x1ad2d3[_0xa2f3('0x26')][_0xa2f3('0x77')]=util[_0xa2f3('0x78')]('SIP/%s',_0x4013b6['user']['name']);_0x1ad2d3['message'][_0xa2f3('0x6e')]=_0xfb23ad[_0xa2f3('0x6e')];_0x1ad2d3['message'][_0xa2f3('0x6f')]=_0xa2f3('0x34');respondWithRpcPromise(_0xa2f3('0x70'),_0xa2f3('0x70'),{'event':'rejectmessage','message':_0x1ad2d3[_0xa2f3('0x26')]},client9002);return _0xfb23ad;}return null;})['then'](respondWithResult(_0x11e7ee,null))[_0xa2f3('0x29')](handleError(_0x11e7ee,null));};exports[_0xa2f3('0x2c')]=function(_0x867ffb,_0x51cc78,_0x18db96){if(_0x867ffb['body']['id']){delete _0x867ffb[_0xa2f3('0x54')]['id'];}var _0x1595e7;return db['SmsMessage'][_0xa2f3('0x53')]({'where':{'id':_0x867ffb[_0xa2f3('0x56')]['id']}})[_0xa2f3('0x20')](handleEntityNotFound(_0x51cc78,null))[_0xa2f3('0x20')](function(_0x4bd99f){if(_0x4bd99f){_0x1595e7=_0x4bd99f;return db[_0xa2f3('0x79')][_0xa2f3('0x53')]({'where':{'id':_0x4bd99f[_0xa2f3('0x7a')]}});}})[_0xa2f3('0x20')](handleEntityNotFound(_0x51cc78,null))['then'](function(_0x444e13){if(_0x444e13){logger['debug'](_0xa2f3('0x22'),_0xa2f3('0x2c'),_0xa2f3('0x7b'),_0x444e13[_0xa2f3('0x3b')],util['inspect'](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));switch(_0x444e13['type']){case _0xa2f3('0x7c'):if(_0x867ffb[_0xa2f3('0x54')]['MessageSid']&&_0x867ffb['body'][_0xa2f3('0x7d')]===_0x1595e7[_0xa2f3('0x7e')]){return _0x1595e7['update']({'read':!![]});}else{logger['error'](_0xa2f3('0x7f'),_0xa2f3('0x2c'),_0xa2f3('0x7c'),util[_0xa2f3('0x80')](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa2f3('0x81'):if(_0x867ffb[_0xa2f3('0x54')][_0xa2f3('0x82')]&&_0x867ffb[_0xa2f3('0x54')][_0xa2f3('0x82')]===_0x1595e7[_0xa2f3('0x7e')]&&_[_0xa2f3('0x83')]([_0xa2f3('0x84'),_0xa2f3('0x85')],_0x867ffb[_0xa2f3('0x54')][_0xa2f3('0x86')])>=0x0){return _0x1595e7[_0xa2f3('0x55')]({'read':!![]});}else{logger['error'](_0xa2f3('0x7f'),_0xa2f3('0x2c'),_0xa2f3('0x87'),util[_0xa2f3('0x80')](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xe8d68c=_0x867ffb['body'][_0xa2f3('0x88')][0x0];if(_0xe8d68c[_0xa2f3('0x2c')]['groupName']===_0xa2f3('0x89')){return _0x1595e7[_0xa2f3('0x55')]({'read':!![]});}else{logger[_0xa2f3('0x23')](_0xa2f3('0x7f'),_0xa2f3('0x2c'),_0xa2f3('0x8a'),util[_0xa2f3('0x80')](_0x867ffb[_0xa2f3('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1595e7;}})[_0xa2f3('0x20')](respondWithResult(_0x51cc78,null))[_0xa2f3('0x29')](handleError(_0x51cc78,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 60e55fe..f45f861 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 _0x379f=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','exports'];(function(_0x18c506,_0x5f4ca3){var _0x4ab39f=function(_0x1a6e5c){while(--_0x1a6e5c){_0x18c506['push'](_0x18c506['shift']());}};_0x4ab39f(++_0x5f4ca3);}(_0x379f,0xe0));var _0xf379=function(_0x35acf5,_0x1f6c96){_0x35acf5=_0x35acf5-0x0;var _0x29c02b=_0x379f[_0x35acf5];return _0x29c02b;};'use strict';var EventEmitter=require(_0xf379('0x0'));var SmsMessage=require(_0xf379('0x1'))['db'][_0xf379('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf379('0x3')](0x0);var events={'afterCreate':_0xf379('0x4'),'afterUpdate':_0xf379('0x5'),'afterDestroy':'remove'};function emitEvent(_0x455e7b){return function(_0x314771,_0x2be9ef,_0x222d3a){SmsMessageEvents[_0xf379('0x6')](_0x455e7b+':'+_0x314771['id'],_0x314771);SmsMessageEvents[_0xf379('0x6')](_0x455e7b,_0x314771);_0x222d3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf379('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x65fd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x65fd,0x1db));var _0xd65f=function(_0x6134aa,_0xabf3cc){_0x6134aa=_0x6134aa-0x0;var _0x24bf6f=_0x65fd[_0x6134aa];return _0x24bf6f;};'use strict';var EventEmitter=require(_0xd65f('0x0'));var SmsMessage=require(_0xd65f('0x1'))['db'][_0xd65f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd65f('0x3'),'afterUpdate':_0xd65f('0x4'),'afterDestroy':_0xd65f('0x5')};function emitEvent(_0x19f032){return function(_0x9ca3a6,_0x1f863d,_0x5ebde0){SmsMessageEvents['emit'](_0x19f032+':'+_0x9ca3a6['id'],_0x9ca3a6);SmsMessageEvents[_0xd65f('0x6')](_0x19f032,_0x9ca3a6);_0x5ebde0(null);};}for(var e in events){if(events[_0xd65f('0x7')](e)){var event=events[e];SmsMessage[_0xd65f('0x8')](e,emitEvent(event));}}module[_0xd65f('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d415bd3..5da05ae 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 _0xcbee=['queued_count','head','messages','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','keys','sort','length','signature=','/external/get/send.php?','id_sms','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','senderString','%s:%s','format','Basic\x20%s','toString','base64','http_code','data'];(function(_0x59c20e,_0x272105){var _0x383b97=function(_0x3400cf){while(--_0x3400cf){_0x59c20e['push'](_0x59c20e['shift']());}};_0x383b97(++_0x272105);}(_0xcbee,0x111));var _0xecbe=function(_0x338d81,_0x289932){_0x338d81=_0x338d81-0x0;var _0x234be9=_0xcbee[_0x338d81];return _0x234be9;};'use strict';var _=require(_0xecbe('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xecbe('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xecbe('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xecbe('0x3'));module[_0xecbe('0x4')]=function(_0x1e3a7c,_0x1fa81f){return _0x1e3a7c[_0xecbe('0x5')](_0xecbe('0x6'),attributes,{'tableName':_0xecbe('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xecbe('0x8')],'type':_0xecbe('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dc727,_0x45f57c,_0xd63bd5){var _0x25b518=_0x1e3a7c[_0xecbe('0xa')];var _0x7da942=_0x2dc727[_0xecbe('0xb')]({'plain':!![]});if(_0x7da942[_0xecbe('0xc')][_0xecbe('0xd')]()==='in'||_0x7da942['direction'][_0xecbe('0xd')]()===_0xecbe('0xe')&&!_0x7da942['secret']&&!_[_0xecbe('0xf')](_0x7da942['UserId'])){_0x25b518[_0xecbe('0x10')][_0xecbe('0x11')]({'where':{'id':_0x7da942[_0xecbe('0x12')]}})[_0xecbe('0x13')](function(_0x3d7a54){if(_0x3d7a54){_0x3d7a54[_0xecbe('0x14')]({'lastMsgAt':_0x7da942[_0xecbe('0x15')],'lastMsgDirection':_0x7da942[_0xecbe('0xc')][_0xecbe('0xd')]()});}})[_0xecbe('0x16')](function(_0x217ed1){console[_0xecbe('0x17')](_0x217ed1);});}if(_0x7da942[_0xecbe('0xc')]==='out'&&!_0x7da942[_0xecbe('0x18')]){var _0x178168;_0x25b518[_0xecbe('0x19')][_0xecbe('0x1a')]({'where':{'id':_0x7da942[_0xecbe('0x1b')]},'raw':!![]})['then'](function(_0x24950e){_0x178168=_0x24950e;if(_0x178168&&_0x178168[_0xecbe('0x1c')]){switch(_0x178168[_0xecbe('0x1c')]){case _0xecbe('0x1d'):var _0x1df6dd=require(_0xecbe('0x1d'));if(_0x178168[_0xecbe('0x1e')]&&_0x178168[_0xecbe('0x1f')]&&_0x178168['phone']){var _0x8bcd7f=new _0x1df6dd(_0x178168[_0xecbe('0x1e')],_0x178168[_0xecbe('0x1f')]);_0x8bcd7f['messages']['create']({'body':_0x7da942[_0xecbe('0x8')],'to':_0x7da942[_0xecbe('0x20')],'from':_0x178168[_0xecbe('0x20')],'statusCallback':_0x178168[_0xecbe('0x21')]+_0xecbe('0x22')+_0x7da942['id']+_0xecbe('0x23')+_0x178168[_0xecbe('0x24')]})['then'](function(_0xd6caa4){if(_0xd6caa4[_0xecbe('0x25')]){return _0x2dc727[_0xecbe('0x14')]({'messageId':_0xd6caa4[_0xecbe('0x25')]});}})[_0xecbe('0x16')](function(_0x47bf0d){logger['error'](_0xecbe('0x26'),'afterCreate','twilio',util[_0xecbe('0x27')](_0x47bf0d,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate','twilio',_0xecbe('0x28'));}break;case _0xecbe('0x29'):var _0x3a0d9c=_0xecbe('0x2a');if(_0x178168[_0xecbe('0x2b')]&&_0x178168[_0xecbe('0x2c')]){var _0x8a4dcb={'recipient':[_0x7da942[_0xecbe('0x20')]],'message':_0x7da942['body'],'message_type':_0x178168[_0xecbe('0x2d')]};if(_0x178168[_0xecbe('0x2d')]&&_0x178168[_0xecbe('0x2d')]!=='SI'){_0x8a4dcb[_0xecbe('0x2e')]=_0x178168[_0xecbe('0x20')];}var _0x36bf40={'url':_0x3a0d9c+_0xecbe('0x2f')+_0x178168[_0xecbe('0x2b')]+_0xecbe('0x30')+_0x178168['password'],'method':_0xecbe('0x31')};rp(_0x36bf40)['then'](function(_0x5afdc3){var _0x3b6a38=_0x5afdc3[_0xecbe('0x32')](';');var _0x51b350={'user_key':_0x3b6a38[0x0],'session_key':_0x3b6a38[0x1]};_0x36bf40={'url':_0x3a0d9c+_0xecbe('0x33'),'method':_0xecbe('0x34'),'headers':{'user_key':_0x51b350[_0xecbe('0x35')],'Session_key':_0x51b350[_0xecbe('0x36')]},'json':!![],'body':_0x8a4dcb};return rp(_0x36bf40);})['then'](function(_0x213c5c){if(_0x213c5c[_0xecbe('0x37')]>=0x1){var _0x5d7151={'messageId':_0x213c5c[_0xecbe('0x38')]};if(_0x178168[_0xecbe('0x2d')]!=='GP'||!_0x178168[_0xecbe('0x39')]){_0x5d7151[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x5d7151);}else{return logger['error'](_0xecbe('0x26'),'afterCreate',_0xecbe('0x29'),util[_0xecbe('0x27')](_0x213c5c,{'showHidden':![],'depth':null}));}})[_0xecbe('0x16')](function(_0x2d2827){return logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x29'),util[_0xecbe('0x27')](_0x2d2827,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x178168['authToken']){var _0x34f572={'recipient':_0x7da942[_0xecbe('0x20')],'message':_0x7da942[_0xecbe('0x8')],'sender':_0x178168['senderString']||_0x178168[_0xecbe('0x20')],'authorization':_0x178168['authToken']};var _0x45f57c={'method':_0xecbe('0x34'),'uri':_0xecbe('0x3c'),'body':_0x34f572,'json':!![]};rp(_0x45f57c)[_0xecbe('0x13')](function(_0x1fe8cc){var _0x31ceb4={'messageId':_0x1fe8cc[_0xecbe('0x3d')]};if(!_0x178168[_0xecbe('0x39')]){_0x31ceb4[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x31ceb4);})['catch'](function(_0x29ff91){logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x3e'),util['inspect'](_0x29ff91,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x3e'),_0xecbe('0x3f'));}break;case'clicksend':if(_0x178168['username']&&_0x178168[_0xecbe('0x2c')]){var _0x34f572={'messages':[{'source':'xCALLY\x20Motion','to':_0x7da942['phone'],'body':_0x7da942[_0xecbe('0x8')],'from':_0x178168[_0xecbe('0x40')]||_0x178168[_0xecbe('0x20')]}]};var _0x36dfab=util['format'](_0xecbe('0x41'),_0x178168[_0xecbe('0x2b')],_0x178168[_0xecbe('0x2c')]);var _0x45f57c={'method':_0xecbe('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x34f572,'headers':{'Authorization':util[_0xecbe('0x42')](_0xecbe('0x43'),new Buffer(_0x36dfab)[_0xecbe('0x44')](_0xecbe('0x45')))},'json':!![]};rp(_0x45f57c)[_0xecbe('0x13')](function(_0x4d7813){if(_0x4d7813[_0xecbe('0x46')]>=0xc8&&_0x4d7813[_0xecbe('0x46')]<=0xce){if(_0x4d7813[_0xecbe('0x47')]&&_0x4d7813['data'][_0xecbe('0x48')]>0x0){var _0x140426=_[_0xecbe('0x49')](_0x4d7813[_0xecbe('0x47')][_0xecbe('0x4a')]);var _0x4475fa={'messageId':_0x140426[_0xecbe('0x4b')]};if(!_0x178168[_0xecbe('0x39')]){_0x4475fa['read']=!![];}return _0x2dc727[_0xecbe('0x14')](_0x4475fa);}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),'clickSend',util['inspect'](_0x4d7813,{'showHidden':![],'depth':null}));}}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x4c'),util[_0xecbe('0x27')](_0x4d7813,{'showHidden':![],'depth':null}));}})[_0xecbe('0x16')](function(_0x5ef820){logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x4c'),util[_0xecbe('0x27')](_0x5ef820,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x4c'),_0xecbe('0x4d'));}break;case _0xecbe('0x4e'):if(_0x178168[_0xecbe('0x4f')]&&_0x178168['authToken']){var _0x34f572={'dst':_0x7da942[_0xecbe('0x20')],'text':_0x7da942[_0xecbe('0x8')],'src':_0x178168['senderString']||_0x178168['phone'],'url':_0x178168['remote']+_0xecbe('0x22')+_0x7da942['id']+_0xecbe('0x23')+_0x178168['token']};var _0x36dfab=util[_0xecbe('0x42')](_0xecbe('0x41'),_0x178168[_0xecbe('0x4f')],_0x178168[_0xecbe('0x1f')]);var _0x45f57c={'method':'POST','uri':util[_0xecbe('0x42')](_0xecbe('0x50'),_0x178168[_0xecbe('0x4f')]),'body':_0x34f572,'headers':{'Authorization':util[_0xecbe('0x42')](_0xecbe('0x43'),new Buffer(_0x36dfab)[_0xecbe('0x44')](_0xecbe('0x45')))},'json':!![]};rp(_0x45f57c)[_0xecbe('0x13')](function(_0x45d4b0){var _0x152499={'messageId':_0x45d4b0[_0xecbe('0x51')][0x0]};return _0x2dc727[_0xecbe('0x14')](_0x152499);})['catch'](function(_0x32a286){logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),'plivo',util[_0xecbe('0x27')](_0x32a286,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecbe('0x26'),'afterCreate',_0xecbe('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xecbe('0x52'):if(_0x178168['username']&&_0x178168[_0xecbe('0x2c')]){if(_0x178168[_0xecbe('0x53')]){var _0x4d5a20={'method':_0xecbe('0x34'),'uri':_0x178168['baseUrl']+_0xecbe('0x54'),'body':{'username':_0x178168[_0xecbe('0x2b')],'password':_0x178168[_0xecbe('0x2c')]},'json':!![]};return rp(_0x4d5a20)[_0xecbe('0x13')](function(_0x21d509){var _0xf20463={'method':_0xecbe('0x34'),'uri':_0x178168[_0xecbe('0x53')]+_0xecbe('0x55'),'body':{'messages':[{'from':_0x178168[_0xecbe('0x20')],'destinations':[{'to':_0x7da942[_0xecbe('0x20')]}],'text':_0x7da942[_0xecbe('0x8')],'notifyUrl':_0x178168[_0xecbe('0x21')]+_0xecbe('0x22')+_0x7da942['id']+_0xecbe('0x23')+_0x178168[_0xecbe('0x24')],'notifyContentType':_0xecbe('0x56'),'callbackData':_0x178168[_0xecbe('0x20')]+';'+_0x7da942[_0xecbe('0x8')]}]},'headers':{'Authorization':_0xecbe('0x57')+_0x21d509[_0xecbe('0x24')]},'json':!![]};return rp(_0xf20463)[_0xecbe('0x13')](function(_0x39e16a){if(_0x39e16a[_0xecbe('0x4a')]){var _0x650e91={'messageId':_0x39e16a[_0xecbe('0x4a')][0x0]['messageId']};if(!_0x178168[_0xecbe('0x39')]){_0x650e91[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x650e91);}else{return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x52'),util['inspect'](_0x39e16a,{'showHidden':![],'depth':null}));}});})[_0xecbe('0x16')](function(_0x1104dc){return logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x52'),util[_0xecbe('0x27')](_0x1104dc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x52'),_0xecbe('0x4d'));}break;case _0xecbe('0x58'):var _0x21da55=require(_0xecbe('0x59'));if(_0x178168['apiKey']){var _0x4a2975={};_0x4a2975[_0xecbe('0x5a')]=_0x178168[_0xecbe('0x2b')];_0x4a2975[_0xecbe('0x20')]=_0x7da942[_0xecbe('0x20')];_0x4a2975['sender']=_0x178168[_0xecbe('0x20')];_0x4a2975[_0xecbe('0x5b')]=_0x7da942[_0xecbe('0x8')];_0x4a2975[_0xecbe('0x5c')]=+new Date();var _0x805c3f='';var _0x4c186b='';var _0x47f727=Object[_0xecbe('0x5d')](_0x4a2975);_0x47f727[_0xecbe('0x5e')]();for(var _0x388967=0x0;_0x388967<_0x47f727[_0xecbe('0x5f')];_0x388967++){if(_0x805c3f!=''){_0x805c3f+='&';}_0x805c3f+=_0x47f727[_0x388967]+'='+encodeURIComponent(_0x4a2975[_0x47f727[_0x388967]]);_0x4c186b+=_0x4a2975[_0x47f727[_0x388967]];}_0x4c186b+=_0x178168['apiKey'];_0x4c186b=_0x21da55['createHash']('md5')[_0xecbe('0x14')](_0x4c186b)['digest']('hex');if(_0x805c3f!==''){_0x805c3f+='&';}_0x805c3f+=_0xecbe('0x60')+_0x4c186b;var _0x36bf40={'method':'GET','uri':_0x178168[_0xecbe('0x53')]+_0xecbe('0x61')+_0x805c3f,'json':!![]};return rp(_0x36bf40)['then'](function(_0x29ef1b){var _0x143ace=Object[_0xecbe('0x5d')](_0x29ef1b);if(_0x29ef1b[_0x143ace[0x0]]['error']&&parseInt(_0x29ef1b[_0x143ace[0x0]][_0xecbe('0x17')])===0x0){var _0x2e2862={'messageId':_0x29ef1b[_0x143ace[0x0]][_0xecbe('0x62')]};if(!_0x178168[_0xecbe('0x39')]){_0x2e2862[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x2e2862);}else{return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x58'),util[_0xecbe('0x27')](_0x29ef1b['error'],{'showHidden':![],'depth':null}));}})[_0xecbe('0x16')](function(_0x44e47d){return logger[_0xecbe('0x17')](_0xecbe('0x26'),'afterCreate',_0xecbe('0x58'),util[_0xecbe('0x27')](_0x44e47d,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0xecbe('0x63'):if(_0x178168[_0xecbe('0x64')]){var _0x4fbd74={'method':_0xecbe('0x34'),'uri':_0xecbe('0x65'),'headers':{'Authorization':_0x178168[_0xecbe('0x64')]},'body':{'content':_0x7da942['body'],'to':[_0x7da942[_0xecbe('0x20')]],'from':_0x178168['phone'],'binary':![],'clientMessageId':_0xecbe('0x66'),'charset':_0xecbe('0x67')},'json':!![]};rp(_0x4fbd74)[_0xecbe('0x13')](function(_0x319855){if(!_0x319855[_0xecbe('0x17')]){var _0x15fe24={'messageId':_0x319855[_0xecbe('0x4a')][0x0]['apiMessageId']};if(!_0x178168[_0xecbe('0x39')]){_0x15fe24[_0xecbe('0x3a')]=!![];}return _0x2dc727[_0xecbe('0x14')](_0x15fe24);}else{return logger['error'](_0xecbe('0x26'),'afterCreate','clickatell',util[_0xecbe('0x27')](_0x319855[_0xecbe('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x58b06a){return logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x63'),util[_0xecbe('0x27')](_0x58b06a,{'showHidden':![],'depth':null}));});}else{logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),'clickatell',_0xecbe('0x68'));}break;case'intelepeer':if(_0x178168[_0xecbe('0x64')]){var _0x4f274b={};var _0x36bf40={'method':_0xecbe('0x34'),'uri':_0xecbe('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x178168[_0xecbe('0x64')],'Content-Type':_0xecbe('0x56')},'body':{'from':_0x178168[_0xecbe('0x20')],'to':_0x7da942[_0xecbe('0x20')],'text':_0x7da942[_0xecbe('0x8')]},'json':!![]};return rp(_0x36bf40)[_0xecbe('0x13')](function(_0x1070e7){if(_0x1070e7[_0xecbe('0x6a')]==0xca){_0x4f274b[_0xecbe('0x6b')]=_0x1070e7;var _0x4c043a={'method':_0xecbe('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x178168[_0xecbe('0x64')],'Content-Type':_0xecbe('0x56')},'body':{'refid':_0x4f274b[_0xecbe('0x6b')][_0xecbe('0x6c')]},'json':!![]};return rp(_0x4c043a)['then'](function(_0x281882){_0x4f274b[_0xecbe('0x6d')]=_0x281882;var _0x376013={'messageId':_0x4f274b[_0xecbe('0x6b')][_0xecbe('0x6c')],'read':!![]};return _0x2dc727[_0xecbe('0x14')](_0x376013);});}else{return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),_0xecbe('0x6e'),util['inspect'](_0x1070e7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4ab173){return logger[_0xecbe('0x17')](_0xecbe('0x26'),_0xecbe('0x3b'),'intelepeer',util[_0xecbe('0x27')](_0x4ab173,{'showHidden':![],'depth':null}));});}else{return logger[_0xecbe('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xecbe('0x3b'),_0xecbe('0x6e'),_0xecbe('0x6f'));}break;}}})[_0xecbe('0x70')](function(){_0xd63bd5();});}else{_0xd63bd5();}}},'charset':_0xecbe('0x71'),'collate':_0xecbe('0x72')});}; \ No newline at end of file +var _0x7f81=['POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','password','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','/api/sms/messages/','IBSSO\x20','infobip','csc','crypto','apiKey','login','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','SmsInteractionId','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','sms'];(function(_0x4afe31,_0x126fed){var _0x235433=function(_0x686e98){while(--_0x686e98){_0x4afe31['push'](_0x4afe31['shift']());}};_0x235433(++_0x126fed);}(_0x7f81,0x1ac));var _0x17f8=function(_0x1bf977,_0xbb8a6b){_0x1bf977=_0x1bf977-0x0;var _0x559680=_0x7f81[_0x1bf977];return _0x559680;};'use strict';var _=require(_0x17f8('0x0'));var util=require(_0x17f8('0x1'));var logger=require(_0x17f8('0x2'))(_0x17f8('0x3'));var moment=require('moment');var BPromise=require(_0x17f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17f8('0x5'));var rimraf=require(_0x17f8('0x6'));var config=require(_0x17f8('0x7'));var attributes=require(_0x17f8('0x8'));module[_0x17f8('0x9')]=function(_0x4066b2,_0x53438d){return _0x4066b2[_0x17f8('0xa')](_0x17f8('0xb'),attributes,{'tableName':_0x17f8('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x17f8('0xd'),'fields':[_0x17f8('0xe')],'type':_0x17f8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36728e,_0x47ab34,_0x1642cf){var _0x5b92cc=_0x4066b2[_0x17f8('0x10')];var _0x3220f5=_0x36728e[_0x17f8('0x11')]({'plain':!![]});if(_0x3220f5[_0x17f8('0x12')][_0x17f8('0x13')]()==='in'||_0x3220f5[_0x17f8('0x12')][_0x17f8('0x13')]()===_0x17f8('0x14')&&!_0x3220f5['secret']&&!_[_0x17f8('0x15')](_0x3220f5[_0x17f8('0x16')])){_0x5b92cc[_0x17f8('0x17')]['findOne']({'where':{'id':_0x3220f5[_0x17f8('0x18')]}})['then'](function(_0x25d72f){if(_0x25d72f){_0x25d72f[_0x17f8('0x19')]({'lastMsgAt':_0x3220f5[_0x17f8('0x1a')],'lastMsgDirection':_0x3220f5[_0x17f8('0x12')][_0x17f8('0x13')]()});}})[_0x17f8('0x1b')](function(_0xe6be41){console['error'](_0xe6be41);});}if(_0x3220f5[_0x17f8('0x12')]===_0x17f8('0x14')&&!_0x3220f5[_0x17f8('0x1c')]){var _0x65b7c5;_0x5b92cc[_0x17f8('0x1d')][_0x17f8('0x1e')]({'where':{'id':_0x3220f5[_0x17f8('0x1f')]},'raw':!![]})[_0x17f8('0x20')](function(_0x2a1a53){_0x65b7c5=_0x2a1a53;if(_0x65b7c5&&_0x65b7c5[_0x17f8('0x21')]){switch(_0x65b7c5[_0x17f8('0x21')]){case _0x17f8('0x22'):var _0x52117d=require(_0x17f8('0x22'));if(_0x65b7c5[_0x17f8('0x23')]&&_0x65b7c5[_0x17f8('0x24')]&&_0x65b7c5[_0x17f8('0x25')]){var _0x1b9ba7=new _0x52117d(_0x65b7c5[_0x17f8('0x23')],_0x65b7c5[_0x17f8('0x24')]);_0x1b9ba7['messages']['create']({'body':_0x3220f5['body'],'to':_0x3220f5[_0x17f8('0x25')],'from':_0x65b7c5[_0x17f8('0x25')],'statusCallback':_0x65b7c5['remote']+'/api/sms/messages/'+_0x3220f5['id']+_0x17f8('0x26')+_0x65b7c5[_0x17f8('0x27')]})['then'](function(_0x3a63ce){if(_0x3a63ce[_0x17f8('0x28')]){return _0x36728e[_0x17f8('0x19')]({'messageId':_0x3a63ce[_0x17f8('0x28')]});}})[_0x17f8('0x1b')](function(_0x174ecf){logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x22'),util[_0x17f8('0x2c')](_0x174ecf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x22'),_0x17f8('0x2d'));}break;case _0x17f8('0x2e'):var _0x5ed964='https://api.skebby.it/API/v1.0/REST/';if(_0x65b7c5[_0x17f8('0x2f')]&&_0x65b7c5['password']){var _0x40d610={'recipient':[_0x3220f5[_0x17f8('0x25')]],'message':_0x3220f5[_0x17f8('0xe')],'message_type':_0x65b7c5[_0x17f8('0x30')]};if(_0x65b7c5[_0x17f8('0x30')]&&_0x65b7c5[_0x17f8('0x30')]!=='SI'){_0x40d610[_0x17f8('0x31')]=_0x65b7c5['phone'];}var _0x1c255f={'url':_0x5ed964+_0x17f8('0x32')+_0x65b7c5[_0x17f8('0x2f')]+'&password='+_0x65b7c5['password'],'method':'GET'};rp(_0x1c255f)[_0x17f8('0x20')](function(_0x432a9d){var _0x224733=_0x432a9d['split'](';');var _0x23f83a={'user_key':_0x224733[0x0],'session_key':_0x224733[0x1]};_0x1c255f={'url':_0x5ed964+_0x17f8('0x33'),'method':_0x17f8('0x34'),'headers':{'user_key':_0x23f83a[_0x17f8('0x35')],'Session_key':_0x23f83a[_0x17f8('0x36')]},'json':!![],'body':_0x40d610};return rp(_0x1c255f);})[_0x17f8('0x20')](function(_0x294df8){if(_0x294df8[_0x17f8('0x37')]>=0x1){var _0x2954aa={'messageId':_0x294df8[_0x17f8('0x38')]};if(_0x65b7c5[_0x17f8('0x30')]!=='GP'||!_0x65b7c5[_0x17f8('0x39')]){_0x2954aa[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x2954aa);}else{return logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),'skebby',util[_0x17f8('0x2c')](_0x294df8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e6653){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x2e'),util[_0x17f8('0x2c')](_0x4e6653,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x2e'),_0x17f8('0x3b'));}break;case _0x17f8('0x3c'):if(_0x65b7c5[_0x17f8('0x24')]){var _0x148a44={'recipient':_0x3220f5[_0x17f8('0x25')],'message':_0x3220f5['body'],'sender':_0x65b7c5[_0x17f8('0x3d')]||_0x65b7c5[_0x17f8('0x25')],'authorization':_0x65b7c5['authToken']};var _0x47ab34={'method':_0x17f8('0x34'),'uri':_0x17f8('0x3e'),'body':_0x148a44,'json':!![]};rp(_0x47ab34)[_0x17f8('0x20')](function(_0x45bacf){var _0x182c64={'messageId':_0x45bacf[_0x17f8('0x3f')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x182c64[_0x17f8('0x3a')]=!![];}return _0x36728e['update'](_0x182c64);})[_0x17f8('0x1b')](function(_0x405365){logger['error'](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x3c'),util[_0x17f8('0x2c')](_0x405365,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x3c'),_0x17f8('0x40'));}break;case _0x17f8('0x41'):if(_0x65b7c5[_0x17f8('0x2f')]&&_0x65b7c5['password']){var _0x148a44={'messages':[{'source':_0x17f8('0x42'),'to':_0x3220f5[_0x17f8('0x25')],'body':_0x3220f5['body'],'from':_0x65b7c5[_0x17f8('0x3d')]||_0x65b7c5[_0x17f8('0x25')]}]};var _0x206383=util[_0x17f8('0x43')]('%s:%s',_0x65b7c5['username'],_0x65b7c5[_0x17f8('0x44')]);var _0x47ab34={'method':'POST','uri':_0x17f8('0x45'),'body':_0x148a44,'headers':{'Authorization':util[_0x17f8('0x43')](_0x17f8('0x46'),new Buffer(_0x206383)['toString'](_0x17f8('0x47')))},'json':!![]};rp(_0x47ab34)[_0x17f8('0x20')](function(_0x141d31){if(_0x141d31['http_code']>=0xc8&&_0x141d31[_0x17f8('0x48')]<=0xce){if(_0x141d31['data']&&_0x141d31[_0x17f8('0x49')][_0x17f8('0x4a')]>0x0){var _0x3470f7=_[_0x17f8('0x4b')](_0x141d31['data'][_0x17f8('0x4c')]);var _0x1acef1={'messageId':_0x3470f7[_0x17f8('0x4d')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x1acef1[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x1acef1);}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x4e'),util[_0x17f8('0x2c')](_0x141d31,{'showHidden':![],'depth':null}));}}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x4e'),util[_0x17f8('0x2c')](_0x141d31,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb41210){logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x4e'),util['inspect'](_0xb41210,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),'clickSend',_0x17f8('0x3b'));}break;case _0x17f8('0x4f'):if(_0x65b7c5[_0x17f8('0x50')]&&_0x65b7c5['authToken']){var _0x148a44={'dst':_0x3220f5[_0x17f8('0x25')],'text':_0x3220f5[_0x17f8('0xe')],'src':_0x65b7c5[_0x17f8('0x3d')]||_0x65b7c5['phone'],'url':_0x65b7c5[_0x17f8('0x51')]+'/api/sms/messages/'+_0x3220f5['id']+_0x17f8('0x26')+_0x65b7c5[_0x17f8('0x27')]};var _0x206383=util[_0x17f8('0x43')]('%s:%s',_0x65b7c5['authId'],_0x65b7c5[_0x17f8('0x24')]);var _0x47ab34={'method':_0x17f8('0x34'),'uri':util[_0x17f8('0x43')](_0x17f8('0x52'),_0x65b7c5['authId']),'body':_0x148a44,'headers':{'Authorization':util[_0x17f8('0x43')](_0x17f8('0x46'),new Buffer(_0x206383)[_0x17f8('0x53')](_0x17f8('0x47')))},'json':!![]};rp(_0x47ab34)['then'](function(_0x30258c){var _0x4cdbb1={'messageId':_0x30258c[_0x17f8('0x54')][0x0]};return _0x36728e['update'](_0x4cdbb1);})['catch'](function(_0x3e9544){logger[_0x17f8('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17f8('0x2b'),_0x17f8('0x4f'),util['inspect'](_0x3e9544,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17f8('0x2b'),_0x17f8('0x4f'),_0x17f8('0x55'));}break;case'infobip':if(_0x65b7c5[_0x17f8('0x2f')]&&_0x65b7c5[_0x17f8('0x44')]){if(_0x65b7c5[_0x17f8('0x56')]){var _0x32335c={'method':_0x17f8('0x34'),'uri':_0x65b7c5[_0x17f8('0x56')]+_0x17f8('0x57'),'body':{'username':_0x65b7c5[_0x17f8('0x2f')],'password':_0x65b7c5[_0x17f8('0x44')]},'json':!![]};return rp(_0x32335c)['then'](function(_0x376223){var _0x56f643={'method':'POST','uri':_0x65b7c5[_0x17f8('0x56')]+_0x17f8('0x58'),'body':{'messages':[{'from':_0x65b7c5[_0x17f8('0x25')],'destinations':[{'to':_0x3220f5[_0x17f8('0x25')]}],'text':_0x3220f5[_0x17f8('0xe')],'notifyUrl':_0x65b7c5[_0x17f8('0x51')]+_0x17f8('0x59')+_0x3220f5['id']+_0x17f8('0x26')+_0x65b7c5[_0x17f8('0x27')],'notifyContentType':'application/json','callbackData':_0x65b7c5[_0x17f8('0x25')]+';'+_0x3220f5[_0x17f8('0xe')]}]},'headers':{'Authorization':_0x17f8('0x5a')+_0x376223[_0x17f8('0x27')]},'json':!![]};return rp(_0x56f643)[_0x17f8('0x20')](function(_0x1d7499){if(_0x1d7499[_0x17f8('0x4c')]){var _0x351a80={'messageId':_0x1d7499['messages'][0x0]['messageId']};if(!_0x65b7c5[_0x17f8('0x39')]){_0x351a80[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x351a80);}else{return logger['error'](_0x17f8('0x2a'),'afterCreate','infobip',util[_0x17f8('0x2c')](_0x1d7499,{'showHidden':![],'depth':null}));}});})[_0x17f8('0x1b')](function(_0x30c143){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5b'),util[_0x17f8('0x2c')](_0x30c143,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5b'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x17f8('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x17f8('0x5b'),_0x17f8('0x3b'));}break;case _0x17f8('0x5c'):var _0x10aa6f=require(_0x17f8('0x5d'));if(_0x65b7c5[_0x17f8('0x5e')]){var _0x452a73={};_0x452a73[_0x17f8('0x5f')]=_0x65b7c5['username'];_0x452a73[_0x17f8('0x25')]=_0x3220f5[_0x17f8('0x25')];_0x452a73['sender']=_0x65b7c5[_0x17f8('0x25')];_0x452a73['text']=_0x3220f5[_0x17f8('0xe')];_0x452a73['timestamp']=+new Date();var _0x21bb02='';var _0x34612e='';var _0x500bec=Object['keys'](_0x452a73);_0x500bec['sort']();for(var _0x56569d=0x0;_0x56569d<_0x500bec['length'];_0x56569d++){if(_0x21bb02!=''){_0x21bb02+='&';}_0x21bb02+=_0x500bec[_0x56569d]+'='+encodeURIComponent(_0x452a73[_0x500bec[_0x56569d]]);_0x34612e+=_0x452a73[_0x500bec[_0x56569d]];}_0x34612e+=_0x65b7c5[_0x17f8('0x5e')];_0x34612e=_0x10aa6f['createHash'](_0x17f8('0x60'))[_0x17f8('0x19')](_0x34612e)[_0x17f8('0x61')](_0x17f8('0x62'));if(_0x21bb02!==''){_0x21bb02+='&';}_0x21bb02+=_0x17f8('0x63')+_0x34612e;var _0x1c255f={'method':_0x17f8('0x64'),'uri':_0x65b7c5['baseUrl']+_0x17f8('0x65')+_0x21bb02,'json':!![]};return rp(_0x1c255f)[_0x17f8('0x20')](function(_0xcf0cf){var _0x3c94eb=Object[_0x17f8('0x66')](_0xcf0cf);if(_0xcf0cf[_0x3c94eb[0x0]]['error']&&parseInt(_0xcf0cf[_0x3c94eb[0x0]][_0x17f8('0x29')])===0x0){var _0x31d507={'messageId':_0xcf0cf[_0x3c94eb[0x0]][_0x17f8('0x67')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x31d507[_0x17f8('0x3a')]=!![];}return _0x36728e[_0x17f8('0x19')](_0x31d507);}else{return logger['error'](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5c'),util[_0x17f8('0x2c')](_0xcf0cf[_0x17f8('0x29')],{'showHidden':![],'depth':null}));}})[_0x17f8('0x1b')](function(_0x278a4f){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x5c'),util[_0x17f8('0x2c')](_0x278a4f,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x65b7c5[_0x17f8('0x5e')]){var _0x385897={'method':_0x17f8('0x34'),'uri':_0x17f8('0x68'),'headers':{'Authorization':_0x65b7c5[_0x17f8('0x5e')]},'body':{'content':_0x3220f5[_0x17f8('0xe')],'to':[_0x3220f5[_0x17f8('0x25')]],'from':_0x65b7c5[_0x17f8('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0x17f8('0x69')},'json':!![]};rp(_0x385897)[_0x17f8('0x20')](function(_0x472bc2){if(!_0x472bc2[_0x17f8('0x29')]){var _0x206eba={'messageId':_0x472bc2[_0x17f8('0x4c')][0x0][_0x17f8('0x6a')]};if(!_0x65b7c5[_0x17f8('0x39')]){_0x206eba[_0x17f8('0x3a')]=!![];}return _0x36728e['update'](_0x206eba);}else{return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x6b'),util[_0x17f8('0x2c')](_0x472bc2['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e8714){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x6b'),util[_0x17f8('0x2c')](_0x3e8714,{'showHidden':![],'depth':null}));});}else{logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x6b'),_0x17f8('0x6c'));}break;case'intelepeer':if(_0x65b7c5[_0x17f8('0x5e')]){var _0x445644={};var _0x1c255f={'method':'POST','uri':_0x17f8('0x6d'),'headers':{'Authorization':_0x17f8('0x6e')+_0x65b7c5[_0x17f8('0x5e')],'Content-Type':_0x17f8('0x6f')},'body':{'from':_0x65b7c5[_0x17f8('0x25')],'to':_0x3220f5[_0x17f8('0x25')],'text':_0x3220f5[_0x17f8('0xe')]},'json':!![]};return rp(_0x1c255f)[_0x17f8('0x20')](function(_0x46938c){if(_0x46938c[_0x17f8('0x70')]==0xca){_0x445644[_0x17f8('0x71')]=_0x46938c;var _0x485e5b={'method':_0x17f8('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x17f8('0x6e')+_0x65b7c5['apiKey'],'Content-Type':_0x17f8('0x6f')},'body':{'refid':_0x445644['message'][_0x17f8('0x72')]},'json':!![]};return rp(_0x485e5b)[_0x17f8('0x20')](function(_0x4e39a1){_0x445644[_0x17f8('0x73')]=_0x4e39a1;var _0x278681={'messageId':_0x445644[_0x17f8('0x71')]['refid'],'read':!![]};return _0x36728e[_0x17f8('0x19')](_0x278681);});}else{return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate',_0x17f8('0x74'),util[_0x17f8('0x2c')](_0x46938c,{'showHidden':![],'depth':null}));}})[_0x17f8('0x1b')](function(_0x59a4e1){return logger[_0x17f8('0x29')](_0x17f8('0x2a'),'afterCreate','intelepeer',util[_0x17f8('0x2c')](_0x59a4e1,{'showHidden':![],'depth':null}));});}else{return logger[_0x17f8('0x29')](_0x17f8('0x2a'),_0x17f8('0x2b'),_0x17f8('0x74'),_0x17f8('0x75'));}break;}}})[_0x17f8('0x76')](function(){_0x1642cf();});}else{_0x1642cf();}}},'charset':_0x17f8('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e44bac0..d9a82c7 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 _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x1b2d1e,_0x5d0f38){var _0x4cfc8e=function(_0x2b414e){while(--_0x2b414e){_0x1b2d1e['push'](_0x1b2d1e['shift']());}};_0x4cfc8e(++_0x5d0f38);}(_0x8603,0x190));var _0x3860=function(_0x5240b7,_0x2d7ea2){_0x5240b7=_0x5240b7-0x0;var _0x3b57b2=_0x8603[_0x5240b7];return _0x3b57b2;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateSmsMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ No newline at end of file +var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x252e0e,_0x12108e){var _0x158349=function(_0x456117){while(--_0x456117){_0x252e0e['push'](_0x252e0e['shift']());}};_0x158349(++_0x12108e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x5eb8[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fdc8d1e..5377a52 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 _0xbf18=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xbf18,0x91));var _0x8bf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf18[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x8bf1('0x0'));var events=[_0x8bf1('0x1'),'remove','update'];function createListener(_0x4bc3f6,_0x328461){return function(_0x3d7621){_0x328461[_0x8bf1('0x2')](_0x4bc3f6,_0x3d7621);};}function removeListener(_0x5455aa,_0x5e32de){return function(){SmsMessageEvents[_0x8bf1('0x3')](_0x5455aa,_0x5e32de);};}exports[_0x8bf1('0x4')]=function(_0xb02f04){for(var _0x24bb74=0x0,_0x32a60e=events[_0x8bf1('0x5')];_0x24bb74<_0x32a60e;_0x24bb74++){var _0x4668e1=events[_0x24bb74];var _0x45f2c2=createListener(_0x8bf1('0x6')+_0x4668e1,_0xb02f04);SmsMessageEvents['on'](_0x4668e1,_0x45f2c2);}}; \ No newline at end of file +var _0xc2b9=['smsMessage:','./smsMessage.events','save','remove','update','removeListener','register','length'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc2b9,0x101));var _0x9c2b=function(_0x5a7180,_0x1af60c){_0x5a7180=_0x5a7180-0x0;var _0x49a441=_0xc2b9[_0x5a7180];return _0x49a441;};'use strict';var SmsMessageEvents=require(_0x9c2b('0x0'));var events=[_0x9c2b('0x1'),_0x9c2b('0x2'),_0x9c2b('0x3')];function createListener(_0x5a0406,_0x3a3f36){return function(_0x50f6aa){_0x3a3f36['emit'](_0x5a0406,_0x50f6aa);};}function removeListener(_0x557b1e,_0x443733){return function(){SmsMessageEvents[_0x9c2b('0x4')](_0x557b1e,_0x443733);};}exports[_0x9c2b('0x5')]=function(_0x4f7d91){for(var _0x585aeb=0x0,_0x4e1753=events[_0x9c2b('0x6')];_0x585aeb<_0x4e1753;_0x585aeb++){var _0x35cc22=events[_0x585aeb];var _0x3e9c91=createListener(_0x9c2b('0x7')+_0x35cc22,_0x4f7d91);SmsMessageEvents['on'](_0x35cc22,_0x3e9c91);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 568610c..7acd790 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 _0x9c48=['util','path','express','Router','../../components/auth/service','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','delete','removeTeams','exports','multer'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x9c48,0xa1));var _0x89c4=function(_0x23f654,_0x38e808){_0x23f654=_0x23f654-0x0;var _0x4b9ef1=_0x9c48[_0x23f654];return _0x4b9ef1;};'use strict';var multer=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var path=require(_0x89c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x89c4('0x3'));var router=express[_0x89c4('0x4')]();var auth=require(_0x89c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89c4('0x6'));router[_0x89c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x89c4('0x8')]);router[_0x89c4('0x7')](_0x89c4('0x9'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xb')]);router[_0x89c4('0x7')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xd')]);router[_0x89c4('0x7')](_0x89c4('0xe'),auth[_0x89c4('0xa')](),controller[_0x89c4('0xf')]);router[_0x89c4('0x7')](_0x89c4('0x10'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x11')]);router[_0x89c4('0x7')](_0x89c4('0x12'),auth[_0x89c4('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x89c4('0x13')]);router[_0x89c4('0x14')](_0x89c4('0x10'),auth[_0x89c4('0xa')](),controller[_0x89c4('0x15')]);router[_0x89c4('0x14')](_0x89c4('0x12'),auth['isAuthenticated'](),controller[_0x89c4('0x16')]);router[_0x89c4('0x17')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller['update']);router[_0x89c4('0x18')](_0x89c4('0xc'),auth[_0x89c4('0xa')](),controller['destroy']);router[_0x89c4('0x18')]('/:id/teams',auth[_0x89c4('0xa')](),controller[_0x89c4('0x19')]);router['delete'](_0x89c4('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x89c4('0x1a')]=router; \ No newline at end of file +var _0x9536=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer'];(function(_0x12dfeb,_0x3fe94f){var _0x3f2fb8=function(_0x2770e5){while(--_0x2770e5){_0x12dfeb['push'](_0x12dfeb['shift']());}};_0x3f2fb8(++_0x3fe94f);}(_0x9536,0x179));var _0x6953=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x9536[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0x8')]('/:id',auth[_0x6953('0x9')](),controller[_0x6953('0xc')]);router[_0x6953('0x8')]('/:id/members',auth[_0x6953('0x9')](),controller[_0x6953('0xd')]);router[_0x6953('0x8')](_0x6953('0xe'),auth[_0x6953('0x9')](),controller[_0x6953('0xf')]);router[_0x6953('0x8')](_0x6953('0x10'),auth[_0x6953('0x9')](),controller['getAgents']);router[_0x6953('0x11')]('/',auth['isAuthenticated'](),controller[_0x6953('0x12')]);router[_0x6953('0x11')](_0x6953('0xe'),auth[_0x6953('0x9')](),controller[_0x6953('0x13')]);router[_0x6953('0x11')](_0x6953('0x10'),auth[_0x6953('0x9')](),controller[_0x6953('0x14')]);router[_0x6953('0x15')](_0x6953('0x16'),auth['isAuthenticated'](),controller['update']);router[_0x6953('0x17')](_0x6953('0x16'),auth[_0x6953('0x9')](),controller[_0x6953('0x18')]);router['delete'](_0x6953('0xe'),auth[_0x6953('0x9')](),controller['removeTeams']);router[_0x6953('0x17')](_0x6953('0x10'),auth[_0x6953('0x9')](),controller[_0x6953('0x19')]);module[_0x6953('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 1293864..7f5c68b 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 _0xa0f6=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name','STRING'];(function(_0x37f3e0,_0x4803f1){var _0x190c51=function(_0x28815c){while(--_0x28815c){_0x37f3e0['push'](_0x37f3e0['shift']());}};_0x190c51(++_0x4803f1);}(_0xa0f6,0xd4));var _0x6a0f=function(_0x434d9e,_0x564e85){_0x434d9e=_0x434d9e-0x0;var _0x33de23=_0xa0f6[_0x434d9e];return _0x33de23;};'use strict';var Sequelize=require(_0x6a0f('0x0'));module[_0x6a0f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6a0f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6a0f('0x3')]},'timeout':{'type':Sequelize[_0x6a0f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a0f('0x5')](_0x6a0f('0x6'),'beepall',_0x6a0f('0x7'))}}; \ No newline at end of file +var _0x035f=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x19c39c,_0x3e2dc2){var _0x24c24c=function(_0x171b8c){while(--_0x171b8c){_0x19c39c['push'](_0x19c39c['shift']());}};_0x24c24c(++_0x3e2dc2);}(_0x035f,0x66));var _0xf035=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x035f[_0x8cb2f9];return _0x164887;};'use strict';var Sequelize=require(_0xf035('0x0'));module['exports']={'name':{'type':Sequelize[_0xf035('0x1')],'unique':_0xf035('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf035('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf035('0x3')](_0xf035('0x4'),_0xf035('0x5'),_0xf035('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c948c89..5ea7f66 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 _0x2deb=['sequelize','transaction','each','findOrCreate','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','compact','isEmpty','removeAgents','forEach','emit','addAgents','omit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','create','findOne','SmsQueueId','options','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','flatMap'];(function(_0x245a1a,_0x4740e7){var _0x2fd743=function(_0x5e2b2a){while(--_0x5e2b2a){_0x245a1a['push'](_0x245a1a['shift']());}};_0x2fd743(++_0x4740e7);}(_0x2deb,0x1c6));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb2de('0x0'));var emlformat=require(_0xb2de('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require(_0xb2de('0x4'));var moment=require('moment');var BPromise=require(_0xb2de('0x5'));var Mustache=require(_0xb2de('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb2de('0x7'));var csv=require(_0xb2de('0x8'));var ejs=require(_0xb2de('0x9'));var fs=require('fs');var _=require(_0xb2de('0xa'));var squel=require(_0xb2de('0xb'));var crypto=require('crypto');var jsforce=require(_0xb2de('0xc'));var deskjs=require(_0xb2de('0xd'));var toCsv=require(_0xb2de('0x8'));var querystring=require(_0xb2de('0xe'));var Papa=require(_0xb2de('0xf'));var Redis=require(_0xb2de('0x10'));var authService=require(_0xb2de('0x11'));var qs=require(_0xb2de('0x12'));var as=require(_0xb2de('0x13'));var hardwareService=require(_0xb2de('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x15'));var config=require(_0xb2de('0x16'));var db=require(_0xb2de('0x17'))['db'];config[_0xb2de('0x18')]=_[_0xb2de('0x19')](config[_0xb2de('0x18')],{'host':_0xb2de('0x1a'),'port':0x18eb});var socket=require(_0xb2de('0x1b'))(new Redis(config[_0xb2de('0x18')]));require(_0xb2de('0x1c'))[_0xb2de('0x1d')](socket);function respondWithStatusCode(_0x7a83a,_0xa5acac){_0xa5acac=_0xa5acac||0xcc;return function(_0x47f6bb){if(_0x47f6bb){return _0x7a83a[_0xb2de('0x1e')](_0xa5acac);}return _0x7a83a[_0xb2de('0x1f')](_0xa5acac)[_0xb2de('0x20')]();};}function respondWithResult(_0x3c7cae,_0x33170e){_0x33170e=_0x33170e||0xc8;return function(_0x3ecfb9){if(_0x3ecfb9){return _0x3c7cae['status'](_0x33170e)[_0xb2de('0x21')](_0x3ecfb9);}};}function respondWithFilteredResult(_0x1bfbfe,_0x4a00c8){return function(_0x2e14e2){if(_0x2e14e2){var _0x280658=_0x2e14e2[_0xb2de('0x22')],_0x5c91d0=_0x4a00c8['offset'],_0x276107=_0x4a00c8[_0xb2de('0x23')]+_0x4a00c8['limit'],_0x2223c;if(_0x276107>=_0x280658){_0x276107=_0x280658;_0x2223c=0xc8;}else{_0x2223c=0xce;}_0x1bfbfe[_0xb2de('0x1f')](_0x2223c);return _0x1bfbfe[_0xb2de('0x24')](_0xb2de('0x25'),_0x5c91d0+'-'+_0x276107+'/'+_0x280658)[_0xb2de('0x21')](_0x2e14e2);}return null;};}function patchUpdates(_0x209e94){return function(_0x1ea9c3){try{jsonpatch[_0xb2de('0x26')](_0x1ea9c3,_0x209e94,!![]);}catch(_0x2b8938){return BPromise[_0xb2de('0x27')](_0x2b8938);}return _0x1ea9c3[_0xb2de('0x28')]();};}function saveUpdates(_0x441694,_0x2dce16){return function(_0x14b381){if(_0x14b381){return _0x14b381[_0xb2de('0x29')](_0x441694)[_0xb2de('0x2a')](function(_0x5d4ac3){return _0x5d4ac3;});}return null;};}function removeEntity(_0x1f2ec5,_0x164f82){return function(_0xf431aa){if(_0xf431aa){return _0xf431aa[_0xb2de('0x2b')]()[_0xb2de('0x2a')](function(){var _0xe0b778=_0xf431aa[_0xb2de('0x2c')]({'plain':!![]});var _0x499eea='SmsQueues';return db[_0xb2de('0x2d')][_0xb2de('0x2b')]({'where':{'type':_0x499eea,'resourceId':_0xe0b778['id']}})[_0xb2de('0x2a')](function(){return _0xf431aa;});})[_0xb2de('0x2a')](function(){_0x1f2ec5[_0xb2de('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27afb3,_0x10da6a){return function(_0x213b19){if(!_0x213b19){_0x27afb3['sendStatus'](0x194);}return _0x213b19;};}function handleError(_0x386794,_0x5332ad){_0x5332ad=_0x5332ad||0x1f4;return function(_0x28a9e6){logger[_0xb2de('0x2e')](_0x28a9e6[_0xb2de('0x2f')]);if(_0x28a9e6[_0xb2de('0x30')]){delete _0x28a9e6[_0xb2de('0x30')];}_0x386794[_0xb2de('0x1f')](_0x5332ad)[_0xb2de('0x31')](_0x28a9e6);};}exports[_0xb2de('0x32')]=function(_0x1276db,_0x3e9920){var _0x17947a={},_0x1d124a={},_0x42f0f5={'count':0x0,'rows':[]};var _0x342d85=_[_0xb2de('0x33')](db[_0xb2de('0x34')]['rawAttributes'],function(_0x48c145){return{'name':_0x48c145[_0xb2de('0x35')],'type':_0x48c145[_0xb2de('0x36')][_0xb2de('0x37')]};});_0x1d124a[_0xb2de('0x38')]=_['map'](_0x342d85,_0xb2de('0x30'));_0x1d124a[_0xb2de('0x39')]=_[_0xb2de('0x3a')](_0x1276db[_0xb2de('0x39')]);_0x1d124a[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x1d124a['model'],_0x1d124a['query']);_0x17947a[_0xb2de('0x3d')]=_[_0xb2de('0x3c')](_0x1d124a[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0x1276db['query'][_0xb2de('0x3e')]));_0x17947a[_0xb2de('0x3d')]=_0x17947a[_0xb2de('0x3d')]['length']?_0x17947a[_0xb2de('0x3d')]:_0x1d124a[_0xb2de('0x38')];if(!_0x1276db[_0xb2de('0x39')][_0xb2de('0x3f')](_0xb2de('0x40'))){_0x17947a[_0xb2de('0x41')]=qs[_0xb2de('0x41')](_0x1276db['query'][_0xb2de('0x41')]);_0x17947a[_0xb2de('0x23')]=qs['offset'](_0x1276db[_0xb2de('0x39')][_0xb2de('0x23')]);}_0x17947a[_0xb2de('0x42')]=qs['sort'](_0x1276db[_0xb2de('0x39')][_0xb2de('0x43')]);_0x17947a['where']=qs[_0xb2de('0x3b')](_[_0xb2de('0x44')](_0x1276db[_0xb2de('0x39')],_0x1d124a['filters']),_0x342d85);if(_0x1276db[_0xb2de('0x39')][_0xb2de('0x45')]){_0x17947a[_0xb2de('0x46')]=_[_0xb2de('0x47')](_0x17947a['where'],{'$or':_[_0xb2de('0x33')](_0x342d85,function(_0x1eeecd){if(_0x1eeecd['type']!==_0xb2de('0x48')){var _0x4bc347={};_0x4bc347[_0x1eeecd[_0xb2de('0x30')]]={'$like':'%'+_0x1276db['query'][_0xb2de('0x45')]+'%'};return _0x4bc347;}})});}_0x17947a=_[_0xb2de('0x47')]({},_0x17947a,_0x1276db['options']);var _0x4289ce={'where':_0x17947a[_0xb2de('0x46')]};return db[_0xb2de('0x34')][_0xb2de('0x22')](_0x4289ce)['then'](function(_0x41838c){_0x42f0f5[_0xb2de('0x22')]=_0x41838c;if(_0x1276db[_0xb2de('0x39')][_0xb2de('0x49')]){_0x17947a[_0xb2de('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0xb2de('0x4b')](_0x17947a);})['then'](function(_0x40d6f1){_0x42f0f5[_0xb2de('0x4c')]=_0x40d6f1;return _0x42f0f5;})[_0xb2de('0x2a')](respondWithFilteredResult(_0x3e9920,_0x17947a))[_0xb2de('0x4d')](handleError(_0x3e9920,null));};exports[_0xb2de('0x4e')]=function(_0xd54e68,_0x4241cc){var _0x29687e={'raw':!![],'where':{'id':_0xd54e68[_0xb2de('0x4f')]['id']}},_0x36cf52={};_0x36cf52[_0xb2de('0x38')]=_[_0xb2de('0x3a')](db['SmsQueue'][_0xb2de('0x50')]);_0x36cf52['query']=_[_0xb2de('0x3a')](_0xd54e68[_0xb2de('0x39')]);_0x36cf52[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x36cf52[_0xb2de('0x38')],_0x36cf52['query']);_0x29687e[_0xb2de('0x3d')]=_[_0xb2de('0x3c')](_0x36cf52[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0xd54e68['query']['fields']));_0x29687e[_0xb2de('0x3d')]=_0x29687e[_0xb2de('0x3d')][_0xb2de('0x51')]?_0x29687e[_0xb2de('0x3d')]:_0x36cf52[_0xb2de('0x38')];if(_0xd54e68[_0xb2de('0x39')][_0xb2de('0x49')]){_0x29687e[_0xb2de('0x4a')]=[{'all':!![]}];}_0x29687e=_['merge']({},_0x29687e,_0xd54e68['options']);return db[_0xb2de('0x34')][_0xb2de('0x52')](_0x29687e)[_0xb2de('0x2a')](handleEntityNotFound(_0x4241cc,null))['then'](respondWithResult(_0x4241cc,null))[_0xb2de('0x4d')](handleError(_0x4241cc,null));};exports['create']=function(_0x3af657,_0x371389){return db[_0xb2de('0x34')]['create'](_0x3af657[_0xb2de('0x53')],{})['then'](function(_0x130d6b){var _0x2034a9=_0x3af657[_0xb2de('0x54')]['get']({'plain':!![]});if(!_0x2034a9)throw new Error(_0xb2de('0x55'));if(_0x2034a9['role']===_0xb2de('0x54')){var _0x4ba3f8=_0x130d6b['get']({'plain':!![]});var _0x298a81=_0xb2de('0x56');return db[_0xb2de('0x57')][_0xb2de('0x52')]({'where':{'name':_0x298a81,'userProfileId':_0x2034a9[_0xb2de('0x58')]},'raw':!![]})[_0xb2de('0x2a')](function(_0x2af5c8){if(_0x2af5c8&&_0x2af5c8[_0xb2de('0x59')]===0x0){return db[_0xb2de('0x2d')][_0xb2de('0x5a')]({'name':_0x4ba3f8[_0xb2de('0x30')],'resourceId':_0x4ba3f8['id'],'type':_0x2af5c8[_0xb2de('0x30')],'sectionId':_0x2af5c8['id']},{})[_0xb2de('0x2a')](function(){return _0x130d6b;});}else{return _0x130d6b;}})[_0xb2de('0x4d')](function(_0x43e5ee){logger[_0xb2de('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43e5ee);throw _0x43e5ee;});}return _0x130d6b;})[_0xb2de('0x2a')](respondWithResult(_0x371389,0xc9))['catch'](handleError(_0x371389,null));};exports['update']=function(_0x2a05cc,_0x261617){if(_0x2a05cc[_0xb2de('0x53')]['id']){delete _0x2a05cc[_0xb2de('0x53')]['id'];}return db[_0xb2de('0x34')]['find']({'where':{'id':_0x2a05cc[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x261617,null))[_0xb2de('0x2a')](saveUpdates(_0x2a05cc['body'],null))['then'](respondWithResult(_0x261617,null))[_0xb2de('0x4d')](handleError(_0x261617,null));};exports['destroy']=function(_0x40017e,_0x39460e){return db[_0xb2de('0x34')][_0xb2de('0x52')]({'where':{'id':_0x40017e[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x39460e,null))[_0xb2de('0x2a')](removeEntity(_0x39460e,null))[_0xb2de('0x4d')](handleError(_0x39460e,null));};exports['describe']=function(_0x885c91,_0x1e5a47){return db[_0xb2de('0x34')]['describe']()[_0xb2de('0x2a')](respondWithResult(_0x1e5a47,null))[_0xb2de('0x4d')](handleError(_0x1e5a47,null));};exports['getMembers']=function(_0x145b63,_0x16736e,_0x20ce35){var _0xcfb416={'raw':!![],'where':{}},_0x5f2226={},_0x4c1945;return db[_0xb2de('0x34')][_0xb2de('0x5b')]({'where':{'id':_0x145b63[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x16736e,null))[_0xb2de('0x2a')](function(_0x1450a3){if(_0x1450a3){_0x4c1945=_0x1450a3[_0xb2de('0x2c')]({'plain':!![]});_0x5f2226[_0xb2de('0x38')]=_['keys'](db['UserSmsQueue'][_0xb2de('0x50')]);_0x5f2226['query']=_[_0xb2de('0x3a')](_0x145b63[_0xb2de('0x39')]);_0x5f2226[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x5f2226['model'],_0x5f2226[_0xb2de('0x39')]);_0xcfb416[_0xb2de('0x3d')]=_['intersection'](_0x5f2226['model'],qs[_0xb2de('0x3e')](_0x145b63['query'][_0xb2de('0x3e')]));_0xcfb416[_0xb2de('0x3d')]=_0xcfb416[_0xb2de('0x3d')][_0xb2de('0x51')]?_0xcfb416[_0xb2de('0x3d')]:_0x5f2226['model'];if(!_0x145b63[_0xb2de('0x39')][_0xb2de('0x3f')](_0xb2de('0x40'))){_0xcfb416['limit']=qs['limit'](_0x145b63[_0xb2de('0x39')][_0xb2de('0x41')]);_0xcfb416[_0xb2de('0x23')]=qs[_0xb2de('0x23')](_0x145b63['query']['offset']);}_0xcfb416['order']=qs[_0xb2de('0x43')](_0x145b63['query'][_0xb2de('0x43')]);_0xcfb416[_0xb2de('0x46')]=qs['filters'](_[_0xb2de('0x44')](_0x145b63[_0xb2de('0x39')],_0x5f2226[_0xb2de('0x3b')]));_0xcfb416[_0xb2de('0x46')][_0xb2de('0x5c')]=_0x1450a3['id'];if(_0x145b63[_0xb2de('0x39')][_0xb2de('0x45')]){_0xcfb416[_0xb2de('0x46')]=_['merge'](_0xcfb416[_0xb2de('0x46')],{'$or':_['map'](_0xcfb416['attributes'],function(_0x2c3f69){var _0x1e803f={};_0x1e803f[_0x2c3f69]={'$like':'%'+_0x145b63[_0xb2de('0x39')]['filter']+'%'};return _0x1e803f;})});}_0xcfb416=_[_0xb2de('0x47')]({},_0xcfb416,_0x145b63[_0xb2de('0x5d')]);return db[_0xb2de('0x5e')]['findAll'](_0xcfb416);}})[_0xb2de('0x2a')](function(_0x31635b){if(_0x31635b){return db[_0xb2de('0x5f')]['findAndCountAll']({'where':{'id':_[_0xb2de('0x33')](_0x31635b,_0xb2de('0x60')),'role':_0xb2de('0x61')},'attributes':['id','name',_0xb2de('0x62'),_0xb2de('0x63'),_0xb2de('0x64')]});}})[_0xb2de('0x2a')](function(_0x3fe0a4){if(_0x3fe0a4){return{'count':_0x3fe0a4[_0xb2de('0x22')],'rows':_[_0xb2de('0x33')](_0x3fe0a4[_0xb2de('0x4c')],function(_0x17feb9){return{'membername':_0x17feb9[_0xb2de('0x30')],'UserId':_0x17feb9['id'],'queue_name':_0x4c1945[_0xb2de('0x30')],'SmsQueueId':_0x4c1945['id'],'interface':util[_0xb2de('0x65')](_0xb2de('0x66'),_0xb2de('0x67'),_0x17feb9[_0xb2de('0x30')]),'penalty':0x0,'paused':_0x17feb9[_0xb2de('0x62')],'createdAt':_0x17feb9[_0xb2de('0x64')],'updatedAt':_0x17feb9[_0xb2de('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x16736e,_0xcfb416))[_0xb2de('0x4d')](handleError(_0x16736e,null));};exports[_0xb2de('0x68')]=function(_0x2da137,_0x3d984d,_0x158490){var _0x3ed00a={};var _0x2ab19a={};var _0xdb0e22;var _0x81518f;return db[_0xb2de('0x34')][_0xb2de('0x5b')]({'where':{'id':_0x2da137[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x3d984d,null))[_0xb2de('0x2a')](function(_0x28110c){if(_0x28110c){_0xdb0e22=_0x28110c;_0x2ab19a[_0xb2de('0x38')]=_['keys'](db['Team']['rawAttributes']);_0x2ab19a['query']=_[_0xb2de('0x3a')](_0x2da137[_0xb2de('0x39')]);_0x2ab19a[_0xb2de('0x3b')]=_[_0xb2de('0x3c')](_0x2ab19a[_0xb2de('0x38')],_0x2ab19a[_0xb2de('0x39')]);_0x3ed00a['attributes']=_[_0xb2de('0x3c')](_0x2ab19a[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0x2da137[_0xb2de('0x39')][_0xb2de('0x3e')]));_0x3ed00a[_0xb2de('0x3d')]=_0x3ed00a['attributes'][_0xb2de('0x51')]?_0x3ed00a['attributes']:_0x2ab19a['model'];_0x3ed00a[_0xb2de('0x42')]=qs[_0xb2de('0x43')](_0x2da137[_0xb2de('0x39')]['sort']);_0x3ed00a['where']=qs[_0xb2de('0x3b')](_[_0xb2de('0x44')](_0x2da137['query'],_0x2ab19a[_0xb2de('0x3b')]));if(_0x2da137[_0xb2de('0x39')][_0xb2de('0x45')]){_0x3ed00a[_0xb2de('0x46')]=_[_0xb2de('0x47')](_0x3ed00a['where'],{'$or':_[_0xb2de('0x33')](_0x3ed00a[_0xb2de('0x3d')],function(_0x5e232b){var _0x1611af={};_0x1611af[_0x5e232b]={'$like':'%'+_0x2da137['query'][_0xb2de('0x45')]+'%'};return _0x1611af;})});}_0x3ed00a=_[_0xb2de('0x47')]({},_0x3ed00a,_0x2da137[_0xb2de('0x5d')]);return _0xdb0e22['getTeams'](_0x3ed00a);}})[_0xb2de('0x2a')](function(_0x107e6d){if(_0x107e6d){_0x81518f=_0x107e6d['length'];if(!_0x2da137[_0xb2de('0x39')][_0xb2de('0x3f')](_0xb2de('0x40'))){_0x3ed00a[_0xb2de('0x41')]=qs['limit'](_0x2da137[_0xb2de('0x39')][_0xb2de('0x41')]);_0x3ed00a['offset']=qs['offset'](_0x2da137['query'][_0xb2de('0x23')]);}return _0xdb0e22[_0xb2de('0x68')](_0x3ed00a);}})['then'](function(_0x2e98b3){if(_0x2e98b3){return _0x2e98b3?{'count':_0x81518f,'rows':_0x2e98b3}:null;}})[_0xb2de('0x2a')](respondWithResult(_0x3d984d,null))[_0xb2de('0x4d')](handleError(_0x3d984d,null));};exports[_0xb2de('0x69')]=function(_0x39be4c,_0x210c0e,_0x392282){var _0x37a7c8=_0x39be4c[_0xb2de('0x53')][_0xb2de('0x6a')];return db['Team'][_0xb2de('0x4b')]({'where':{'id':_0x37a7c8},'attributes':['id'],'include':[{'model':db[_0xb2de('0x5f')],'as':_0xb2de('0x6b'),'attributes':['id','name',_0xb2de('0x6c'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x331741){if(_0x331741){var _0x57859b=_[_0xb2de('0x6d')](_0x331741,function(_0x1fe9b8){var _0x1e08c3=_0x1fe9b8[_0xb2de('0x2c')]({'plain':!![]});return _0x1e08c3[_0xb2de('0x6b')];});return db[_0xb2de('0x34')][_0xb2de('0x52')]({'where':{'id':_0x39be4c[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](function(_0x3b1c89){return db[_0xb2de('0x6e')][_0xb2de('0x6f')](function(_0x13c5df){return _0x3b1c89[_0xb2de('0x69')](_0x37a7c8,{'transaction':_0x13c5df})['then'](function(){return BPromise[_0xb2de('0x70')](_0x57859b,function(_0x585966){return db['UserSmsQueue'][_0xb2de('0x71')]({'where':{'UserId':_0x585966['id'],'SmsQueueId':_0x39be4c['params']['id']},'transaction':_0x13c5df});});})['then'](function(){_0x57859b['forEach'](function(_0xd037b1){socket['emit']('userSmsQueue:save',{'UserId':_0xd037b1['id'],'SmsQueueId':_0x3b1c89['id']});});});});});}})[_0xb2de('0x2a')](respondWithStatusCode(_0x210c0e,null))[_0xb2de('0x4d')](handleError(_0x210c0e,null));};exports[_0xb2de('0x72')]=function(_0xa31721,_0x2a7c33,_0x1e1265){return db['Team'][_0xb2de('0x4b')]({'where':{'id':_0xa31721[_0xb2de('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb2de('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xb2de('0x2a')](handleEntityNotFound(_0x2a7c33,null))['then'](function(_0x3be733){var _0x230c58=_['map'](_0x3be733,'id');var _0x12efb0=[];var _0x900604=[];var _0x35560e=squel[_0xb2de('0x73')]();_0x35560e[_0xb2de('0x74')](_0xb2de('0x75'))[_0xb2de('0x76')](_0xb2de('0x77'),'tq')[_0xb2de('0x78')](_0xb2de('0x79'),'ut',_0xb2de('0x7a'))[_0xb2de('0x46')](_0xb2de('0x7b'),_0xa31721[_0xb2de('0x4f')]['id']);for(var _0x1f940f=0x0;_0x1f940f<_0x3be733[_0xb2de('0x51')];_0x1f940f+=0x1){let _0x29bd25=_0x3be733[_0x1f940f];for(var _0x2f63e7=0x0;_0x2f63e7<_0x29bd25[_0xb2de('0x6b')][_0xb2de('0x51')];_0x2f63e7+=0x1){let _0x30b014=_0x29bd25[_0xb2de('0x6b')][_0x2f63e7];var _0x1442c5=_0x35560e[_0xb2de('0x7c')]();_0x1442c5[_0xb2de('0x46')]('ut.UserId\x20=\x20?',_0x30b014['id']);_0x900604['push'](db['sequelize'][_0xb2de('0x39')](_0x1442c5[_0xb2de('0x7d')](),{'type':db[_0xb2de('0x6e')][_0xb2de('0x7e')][_0xb2de('0x7f')]})[_0xb2de('0x2a')](function(_0x47a499){if(_0x47a499[_0xb2de('0x51')]===0x1){return _0x30b014['id'];}else{var _0x4f84f1=_['every'](_[_0xb2de('0x33')](_0x47a499,_0xb2de('0x80')),function(_0x14040c){return _['includes'](_0x230c58,_0x14040c);});if(_0x4f84f1){return _0x30b014['id'];}}}));}}return BPromise[_0xb2de('0x81')](_0x900604)[_0xb2de('0x2a')](function(_0x3841a2){_0x12efb0=_(_0x12efb0)['union'](_0x3841a2)[_0xb2de('0x82')]()['value']();return db['SmsQueue'][_0xb2de('0x52')]({'where':{'id':_0xa31721[_0xb2de('0x4f')]['id']}})['then'](function(_0x2b469c){return db[_0xb2de('0x6e')][_0xb2de('0x6f')](function(_0xca1733){return _0x2b469c['removeTeams'](_0xa31721[_0xb2de('0x39')][_0xb2de('0x6a')],{'transaction':_0xca1733})[_0xb2de('0x2a')](function(){if(!_[_0xb2de('0x83')](_0x12efb0)){return _0x2b469c[_0xb2de('0x84')](_0x12efb0,{'transaction':_0xca1733});}})[_0xb2de('0x2a')](function(){_0x12efb0[_0xb2de('0x85')](function(_0x41498c){socket[_0xb2de('0x86')]('userSmsQueue:remove',{'UserId':_0x41498c,'SmsQueueId':_0x2b469c['id']});});});});});});})[_0xb2de('0x2a')](respondWithStatusCode(_0x2a7c33,null))['catch'](handleError(_0x2a7c33,null));};exports[_0xb2de('0x87')]=function(_0x16a0d8,_0x56df5a,_0x4a4b19){return db[_0xb2de('0x34')][_0xb2de('0x52')]({'where':{'id':_0x16a0d8[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x56df5a,null))['then'](function(_0xea09c4){if(_0xea09c4){return _0xea09c4[_0xb2de('0x87')](_0x16a0d8[_0xb2de('0x53')][_0xb2de('0x6a')],_[_0xb2de('0x88')](_0x16a0d8[_0xb2de('0x53')],[_0xb2de('0x6a'),'id'])||{})['spread'](function(_0x3deaab){for(var _0x5e23e8=0x0;_0x5e23e8<_0x16a0d8[_0xb2de('0x53')][_0xb2de('0x6a')][_0xb2de('0x51')];_0x5e23e8+=0x1){socket[_0xb2de('0x86')](_0xb2de('0x89'),{'UserId':_0x16a0d8[_0xb2de('0x53')][_0xb2de('0x6a')][_0x5e23e8],'SmsQueueId':_0x16a0d8[_0xb2de('0x4f')]['id']});}return _0x3deaab;});}})['then'](respondWithResult(_0x56df5a,null))[_0xb2de('0x4d')](handleError(_0x56df5a,null));};exports[_0xb2de('0x84')]=function(_0x22fd9b,_0x54d39b,_0x392aef){return db[_0xb2de('0x34')]['find']({'where':{'id':_0x22fd9b[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x54d39b,null))['then'](function(_0x5f035f){if(_0x5f035f){return _0x5f035f['removeAgents'](_0x22fd9b[_0xb2de('0x39')][_0xb2de('0x6a')])[_0xb2de('0x2a')](function(){if(_[_0xb2de('0x8a')](_0x22fd9b[_0xb2de('0x39')]['ids'])){for(var _0x31740e=0x0;_0x31740e<_0x22fd9b['query']['ids'][_0xb2de('0x51')];_0x31740e+=0x1){socket[_0xb2de('0x86')](_0xb2de('0x8b'),{'UserId':Number(_0x22fd9b[_0xb2de('0x39')][_0xb2de('0x6a')][_0x31740e]),'SmsQueueId':Number(_0x22fd9b[_0xb2de('0x4f')]['id'])});}}else{socket[_0xb2de('0x86')](_0xb2de('0x8b'),{'UserId':Number(_0x22fd9b[_0xb2de('0x39')][_0xb2de('0x6a')]),'SmsQueueId':Number(_0x22fd9b['params']['id'])});}});}})[_0xb2de('0x2a')](respondWithStatusCode(_0x54d39b,null))[_0xb2de('0x4d')](handleError(_0x54d39b,null));};exports['getAgents']=function(_0x3b3677,_0x1d5c9b,_0x2f67c8){var _0x374266={};var _0x210019={};var _0x587ea9;var _0x1829f6;return db[_0xb2de('0x34')][_0xb2de('0x5b')]({'where':{'id':_0x3b3677[_0xb2de('0x4f')]['id']}})[_0xb2de('0x2a')](handleEntityNotFound(_0x1d5c9b,null))[_0xb2de('0x2a')](function(_0x41f81c){if(_0x41f81c){_0x587ea9=_0x41f81c;_0x210019['model']=_[_0xb2de('0x3a')](db[_0xb2de('0x5f')]['rawAttributes']);_0x210019['query']=_['keys'](_0x3b3677[_0xb2de('0x39')]);_0x210019['filters']=_['intersection'](_0x210019[_0xb2de('0x38')],_0x210019[_0xb2de('0x39')]);_0x374266[_0xb2de('0x3d')]=_[_0xb2de('0x3c')](_0x210019[_0xb2de('0x38')],qs[_0xb2de('0x3e')](_0x3b3677[_0xb2de('0x39')][_0xb2de('0x3e')]));_0x374266[_0xb2de('0x3d')]=_0x374266[_0xb2de('0x3d')]['length']?_0x374266[_0xb2de('0x3d')]:_0x210019[_0xb2de('0x38')];_0x374266[_0xb2de('0x42')]=qs[_0xb2de('0x43')](_0x3b3677['query'][_0xb2de('0x43')]);_0x374266[_0xb2de('0x46')]=qs[_0xb2de('0x3b')](_[_0xb2de('0x44')](_0x3b3677['query'],_0x210019[_0xb2de('0x3b')]));if(_0x3b3677['query'][_0xb2de('0x45')]){_0x374266[_0xb2de('0x46')]=_[_0xb2de('0x47')](_0x374266[_0xb2de('0x46')],{'$or':_['map'](_0x374266[_0xb2de('0x3d')],function(_0x11a909){var _0x54f3d1={};_0x54f3d1[_0x11a909]={'$like':'%'+_0x3b3677[_0xb2de('0x39')][_0xb2de('0x45')]+'%'};return _0x54f3d1;})});}_0x374266=_[_0xb2de('0x47')]({},_0x374266,_0x3b3677[_0xb2de('0x5d')]);return _0x587ea9[_0xb2de('0x8c')](_0x374266);}})['then'](function(_0x212322){if(_0x212322){_0x1829f6=_0x212322[_0xb2de('0x51')];if(!_0x3b3677[_0xb2de('0x39')]['hasOwnProperty'](_0xb2de('0x40'))){_0x374266[_0xb2de('0x41')]=qs[_0xb2de('0x41')](_0x3b3677[_0xb2de('0x39')][_0xb2de('0x41')]);_0x374266[_0xb2de('0x23')]=qs[_0xb2de('0x23')](_0x3b3677['query'][_0xb2de('0x23')]);}return _0x587ea9[_0xb2de('0x8c')](_0x374266);}})[_0xb2de('0x2a')](function(_0x401c73){if(_0x401c73){return _0x401c73?{'count':_0x1829f6,'rows':_0x401c73}:null;}})[_0xb2de('0x2a')](respondWithResult(_0x1d5c9b,null))[_0xb2de('0x4d')](handleError(_0x1d5c9b,null));}; \ No newline at end of file +var _0x700f=['save','update','destroy','then','get','SmsQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','catch','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','order','SmsQueueId','UserSmsQueue','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','offset','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userSmsQueue:save','getAgents','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','status','count','limit','set','Content-Range','reject'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x700f,0x17e));var _0xf700=function(_0xe75e84,_0x3dce66){_0xe75e84=_0xe75e84-0x0;var _0x101995=_0x700f[_0xe75e84];return _0x101995;};'use strict';var pdf=require(_0xf700('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf700('0x1'));var zipdir=require(_0xf700('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf700('0x3'));var moment=require('moment');var BPromise=require(_0xf700('0x4'));var Mustache=require('mustache');var util=require(_0xf700('0x5'));var path=require(_0xf700('0x6'));var sox=require(_0xf700('0x7'));var csv=require('to-csv');var ejs=require(_0xf700('0x8'));var fs=require('fs');var _=require(_0xf700('0x9'));var squel=require(_0xf700('0xa'));var crypto=require(_0xf700('0xb'));var jsforce=require(_0xf700('0xc'));var deskjs=require(_0xf700('0xd'));var toCsv=require(_0xf700('0xe'));var querystring=require(_0xf700('0xf'));var Papa=require(_0xf700('0x10'));var Redis=require(_0xf700('0x11'));var authService=require(_0xf700('0x12'));var qs=require(_0xf700('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf700('0x14'));var logger=require(_0xf700('0x15'))('api');var utils=require(_0xf700('0x16'));var config=require(_0xf700('0x17'));var db=require(_0xf700('0x18'))['db'];config[_0xf700('0x19')]=_[_0xf700('0x1a')](config[_0xf700('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf700('0x1b'))(new Redis(config[_0xf700('0x19')]));require(_0xf700('0x1c'))['register'](socket);function respondWithStatusCode(_0x54bd5b,_0x1cfb1f){_0x1cfb1f=_0x1cfb1f||0xcc;return function(_0x1dc7bc){if(_0x1dc7bc){return _0x54bd5b['sendStatus'](_0x1cfb1f);}return _0x54bd5b[_0xf700('0x1d')](_0x1cfb1f)['end']();};}function respondWithResult(_0x42fab6,_0x63ffd9){_0x63ffd9=_0x63ffd9||0xc8;return function(_0x62add3){if(_0x62add3){return _0x42fab6[_0xf700('0x1d')](_0x63ffd9)['json'](_0x62add3);}};}function respondWithFilteredResult(_0x411bf6,_0x4d9585){return function(_0xd1abb7){if(_0xd1abb7){var _0x10b8ea=_0xd1abb7[_0xf700('0x1e')],_0x35bba4=_0x4d9585['offset'],_0x46f1c1=_0x4d9585['offset']+_0x4d9585[_0xf700('0x1f')],_0x225666;if(_0x46f1c1>=_0x10b8ea){_0x46f1c1=_0x10b8ea;_0x225666=0xc8;}else{_0x225666=0xce;}_0x411bf6[_0xf700('0x1d')](_0x225666);return _0x411bf6[_0xf700('0x20')](_0xf700('0x21'),_0x35bba4+'-'+_0x46f1c1+'/'+_0x10b8ea)['json'](_0xd1abb7);}return null;};}function patchUpdates(_0xc94157){return function(_0x5edbac){try{jsonpatch['apply'](_0x5edbac,_0xc94157,!![]);}catch(_0x33bc00){return BPromise[_0xf700('0x22')](_0x33bc00);}return _0x5edbac[_0xf700('0x23')]();};}function saveUpdates(_0x3dfb65,_0x27b96c){return function(_0x167aab){if(_0x167aab){return _0x167aab[_0xf700('0x24')](_0x3dfb65)['then'](function(_0x4744d4){return _0x4744d4;});}return null;};}function removeEntity(_0x172666,_0xdd6c6e){return function(_0x3d10a2){if(_0x3d10a2){return _0x3d10a2[_0xf700('0x25')]()[_0xf700('0x26')](function(){var _0x4670e7=_0x3d10a2[_0xf700('0x27')]({'plain':!![]});var _0x44b4fb=_0xf700('0x28');return db[_0xf700('0x29')][_0xf700('0x25')]({'where':{'type':_0x44b4fb,'resourceId':_0x4670e7['id']}})[_0xf700('0x26')](function(){return _0x3d10a2;});})[_0xf700('0x26')](function(){_0x172666['status'](0xcc)[_0xf700('0x2a')]();});}};}function handleEntityNotFound(_0x1f17a7,_0x277a47){return function(_0x215ef5){if(!_0x215ef5){_0x1f17a7[_0xf700('0x2b')](0x194);}return _0x215ef5;};}function handleError(_0x46b1e3,_0x4704f0){_0x4704f0=_0x4704f0||0x1f4;return function(_0x4d522b){logger[_0xf700('0x2c')](_0x4d522b[_0xf700('0x2d')]);if(_0x4d522b[_0xf700('0x2e')]){delete _0x4d522b['name'];}_0x46b1e3[_0xf700('0x1d')](_0x4704f0)[_0xf700('0x2f')](_0x4d522b);};}exports[_0xf700('0x30')]=function(_0x58c295,_0x5a1e4b){var _0x8ec7da={},_0x47e980={},_0x73973e={'count':0x0,'rows':[]};var _0xa23b20=_[_0xf700('0x31')](db[_0xf700('0x32')][_0xf700('0x33')],function(_0x3740f5){return{'name':_0x3740f5[_0xf700('0x34')],'type':_0x3740f5['type'][_0xf700('0x35')]};});_0x47e980[_0xf700('0x36')]=_[_0xf700('0x31')](_0xa23b20,_0xf700('0x2e'));_0x47e980['query']=_[_0xf700('0x37')](_0x58c295[_0xf700('0x38')]);_0x47e980[_0xf700('0x39')]=_[_0xf700('0x3a')](_0x47e980[_0xf700('0x36')],_0x47e980[_0xf700('0x38')]);_0x8ec7da['attributes']=_[_0xf700('0x3a')](_0x47e980[_0xf700('0x36')],qs['fields'](_0x58c295['query'][_0xf700('0x3b')]));_0x8ec7da['attributes']=_0x8ec7da[_0xf700('0x3c')]['length']?_0x8ec7da[_0xf700('0x3c')]:_0x47e980[_0xf700('0x36')];if(!_0x58c295[_0xf700('0x38')][_0xf700('0x3d')](_0xf700('0x3e'))){_0x8ec7da[_0xf700('0x1f')]=qs['limit'](_0x58c295[_0xf700('0x38')][_0xf700('0x1f')]);_0x8ec7da['offset']=qs['offset'](_0x58c295[_0xf700('0x38')]['offset']);}_0x8ec7da['order']=qs[_0xf700('0x3f')](_0x58c295[_0xf700('0x38')][_0xf700('0x3f')]);_0x8ec7da[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x58c295[_0xf700('0x38')],_0x47e980['filters']),_0xa23b20);if(_0x58c295[_0xf700('0x38')][_0xf700('0x42')]){_0x8ec7da[_0xf700('0x40')]=_[_0xf700('0x43')](_0x8ec7da['where'],{'$or':_[_0xf700('0x31')](_0xa23b20,function(_0x41bcf5){if(_0x41bcf5[_0xf700('0x44')]!=='VIRTUAL'){var _0x423936={};_0x423936[_0x41bcf5[_0xf700('0x2e')]]={'$like':'%'+_0x58c295[_0xf700('0x38')]['filter']+'%'};return _0x423936;}})});}_0x8ec7da=_[_0xf700('0x43')]({},_0x8ec7da,_0x58c295['options']);var _0x5788b8={'where':_0x8ec7da['where']};return db['SmsQueue'][_0xf700('0x1e')](_0x5788b8)[_0xf700('0x26')](function(_0x30fadd){_0x73973e[_0xf700('0x1e')]=_0x30fadd;if(_0x58c295[_0xf700('0x38')][_0xf700('0x45')]){_0x8ec7da['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x8ec7da);})[_0xf700('0x26')](function(_0xc5ce85){_0x73973e['rows']=_0xc5ce85;return _0x73973e;})['then'](respondWithFilteredResult(_0x5a1e4b,_0x8ec7da))[_0xf700('0x46')](handleError(_0x5a1e4b,null));};exports[_0xf700('0x47')]=function(_0x3ea3a3,_0x4ae7b8){var _0xa60cb1={'raw':!![],'where':{'id':_0x3ea3a3[_0xf700('0x48')]['id']}},_0x5d6020={};_0x5d6020[_0xf700('0x36')]=_[_0xf700('0x37')](db[_0xf700('0x32')][_0xf700('0x33')]);_0x5d6020[_0xf700('0x38')]=_['keys'](_0x3ea3a3[_0xf700('0x38')]);_0x5d6020['filters']=_[_0xf700('0x3a')](_0x5d6020[_0xf700('0x36')],_0x5d6020[_0xf700('0x38')]);_0xa60cb1[_0xf700('0x3c')]=_[_0xf700('0x3a')](_0x5d6020[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x3ea3a3[_0xf700('0x38')][_0xf700('0x3b')]));_0xa60cb1['attributes']=_0xa60cb1[_0xf700('0x3c')][_0xf700('0x49')]?_0xa60cb1['attributes']:_0x5d6020[_0xf700('0x36')];if(_0x3ea3a3[_0xf700('0x38')][_0xf700('0x45')]){_0xa60cb1[_0xf700('0x4a')]=[{'all':!![]}];}_0xa60cb1=_[_0xf700('0x43')]({},_0xa60cb1,_0x3ea3a3[_0xf700('0x4b')]);return db[_0xf700('0x32')][_0xf700('0x4c')](_0xa60cb1)['then'](handleEntityNotFound(_0x4ae7b8,null))[_0xf700('0x26')](respondWithResult(_0x4ae7b8,null))[_0xf700('0x46')](handleError(_0x4ae7b8,null));};exports[_0xf700('0x4d')]=function(_0x216fe7,_0x15744c){return db['SmsQueue']['create'](_0x216fe7[_0xf700('0x4e')],{})['then'](function(_0x5d9181){var _0x49940a=_0x216fe7[_0xf700('0x4f')]['get']({'plain':!![]});if(!_0x49940a)throw new Error(_0xf700('0x50'));if(_0x49940a[_0xf700('0x51')]===_0xf700('0x4f')){var _0x4bb4b6=_0x5d9181[_0xf700('0x27')]({'plain':!![]});var _0x4eac2b=_0xf700('0x28');return db['UserProfileSection'][_0xf700('0x4c')]({'where':{'name':_0x4eac2b,'userProfileId':_0x49940a[_0xf700('0x52')]},'raw':!![]})[_0xf700('0x26')](function(_0x5851c1){if(_0x5851c1&&_0x5851c1[_0xf700('0x53')]===0x0){return db[_0xf700('0x29')][_0xf700('0x4d')]({'name':_0x4bb4b6[_0xf700('0x2e')],'resourceId':_0x4bb4b6['id'],'type':_0x5851c1[_0xf700('0x2e')],'sectionId':_0x5851c1['id']},{})[_0xf700('0x26')](function(){return _0x5d9181;});}else{return _0x5d9181;}})[_0xf700('0x46')](function(_0x31d0a0){logger[_0xf700('0x2c')](_0xf700('0x54'),_0x31d0a0);throw _0x31d0a0;});}return _0x5d9181;})[_0xf700('0x26')](respondWithResult(_0x15744c,0xc9))[_0xf700('0x46')](handleError(_0x15744c,null));};exports[_0xf700('0x24')]=function(_0x237744,_0x48e908){if(_0x237744[_0xf700('0x4e')]['id']){delete _0x237744[_0xf700('0x4e')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x237744[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0x48e908,null))[_0xf700('0x26')](saveUpdates(_0x237744[_0xf700('0x4e')],null))[_0xf700('0x26')](respondWithResult(_0x48e908,null))[_0xf700('0x46')](handleError(_0x48e908,null));};exports[_0xf700('0x25')]=function(_0x12a2fd,_0xd39b33){return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0x12a2fd[_0xf700('0x48')]['id']}})[_0xf700('0x26')](handleEntityNotFound(_0xd39b33,null))['then'](removeEntity(_0xd39b33,null))['catch'](handleError(_0xd39b33,null));};exports['describe']=function(_0x6aed23,_0x4ba651){return db['SmsQueue']['describe']()[_0xf700('0x26')](respondWithResult(_0x4ba651,null))['catch'](handleError(_0x4ba651,null));};exports[_0xf700('0x55')]=function(_0x4afaac,_0x45a6aa,_0x3c224f){var _0x2a2c8b={'raw':!![],'where':{}},_0xa68670={},_0x488ef3;return db[_0xf700('0x32')][_0xf700('0x56')]({'where':{'id':_0x4afaac['params']['id']}})[_0xf700('0x26')](handleEntityNotFound(_0x45a6aa,null))['then'](function(_0xb31cc3){if(_0xb31cc3){_0x488ef3=_0xb31cc3[_0xf700('0x27')]({'plain':!![]});_0xa68670[_0xf700('0x36')]=_[_0xf700('0x37')](db['UserSmsQueue'][_0xf700('0x33')]);_0xa68670[_0xf700('0x38')]=_[_0xf700('0x37')](_0x4afaac[_0xf700('0x38')]);_0xa68670[_0xf700('0x39')]=_[_0xf700('0x3a')](_0xa68670[_0xf700('0x36')],_0xa68670['query']);_0x2a2c8b['attributes']=_[_0xf700('0x3a')](_0xa68670[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x4afaac[_0xf700('0x38')][_0xf700('0x3b')]));_0x2a2c8b[_0xf700('0x3c')]=_0x2a2c8b[_0xf700('0x3c')][_0xf700('0x49')]?_0x2a2c8b['attributes']:_0xa68670[_0xf700('0x36')];if(!_0x4afaac[_0xf700('0x38')][_0xf700('0x3d')](_0xf700('0x3e'))){_0x2a2c8b[_0xf700('0x1f')]=qs['limit'](_0x4afaac['query'][_0xf700('0x1f')]);_0x2a2c8b['offset']=qs['offset'](_0x4afaac['query']['offset']);}_0x2a2c8b[_0xf700('0x57')]=qs[_0xf700('0x3f')](_0x4afaac[_0xf700('0x38')][_0xf700('0x3f')]);_0x2a2c8b[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x4afaac[_0xf700('0x38')],_0xa68670[_0xf700('0x39')]));_0x2a2c8b[_0xf700('0x40')][_0xf700('0x58')]=_0xb31cc3['id'];if(_0x4afaac[_0xf700('0x38')][_0xf700('0x42')]){_0x2a2c8b[_0xf700('0x40')]=_['merge'](_0x2a2c8b[_0xf700('0x40')],{'$or':_[_0xf700('0x31')](_0x2a2c8b['attributes'],function(_0x43cfb4){var _0xe639b5={};_0xe639b5[_0x43cfb4]={'$like':'%'+_0x4afaac[_0xf700('0x38')][_0xf700('0x42')]+'%'};return _0xe639b5;})});}_0x2a2c8b=_[_0xf700('0x43')]({},_0x2a2c8b,_0x4afaac[_0xf700('0x4b')]);return db[_0xf700('0x59')][_0xf700('0x5a')](_0x2a2c8b);}})[_0xf700('0x26')](function(_0x993033){if(_0x993033){return db[_0xf700('0x5b')][_0xf700('0x5c')]({'where':{'id':_['map'](_0x993033,_0xf700('0x5d')),'role':_0xf700('0x5e')},'attributes':['id','name',_0xf700('0x5f'),_0xf700('0x60'),_0xf700('0x61')]});}})[_0xf700('0x26')](function(_0x5c973d){if(_0x5c973d){return{'count':_0x5c973d[_0xf700('0x1e')],'rows':_['map'](_0x5c973d[_0xf700('0x62')],function(_0x395107){return{'membername':_0x395107['name'],'UserId':_0x395107['id'],'queue_name':_0x488ef3['name'],'SmsQueueId':_0x488ef3['id'],'interface':util[_0xf700('0x63')](_0xf700('0x64'),'SIP',_0x395107[_0xf700('0x2e')]),'penalty':0x0,'paused':_0x395107[_0xf700('0x5f')],'createdAt':_0x395107[_0xf700('0x61')],'updatedAt':_0x395107[_0xf700('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45a6aa,_0x2a2c8b))['catch'](handleError(_0x45a6aa,null));};exports[_0xf700('0x65')]=function(_0x1f191e,_0x5dc303,_0x24261b){var _0x199a5b={};var _0x13a845={};var _0x2264d8;var _0xeb3891;return db['SmsQueue'][_0xf700('0x56')]({'where':{'id':_0x1f191e[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dc303,null))[_0xf700('0x26')](function(_0x5e12f9){if(_0x5e12f9){_0x2264d8=_0x5e12f9;_0x13a845[_0xf700('0x36')]=_[_0xf700('0x37')](db['Team']['rawAttributes']);_0x13a845[_0xf700('0x38')]=_[_0xf700('0x37')](_0x1f191e[_0xf700('0x38')]);_0x13a845[_0xf700('0x39')]=_[_0xf700('0x3a')](_0x13a845['model'],_0x13a845['query']);_0x199a5b['attributes']=_['intersection'](_0x13a845[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x1f191e[_0xf700('0x38')][_0xf700('0x3b')]));_0x199a5b[_0xf700('0x3c')]=_0x199a5b[_0xf700('0x3c')][_0xf700('0x49')]?_0x199a5b['attributes']:_0x13a845[_0xf700('0x36')];_0x199a5b[_0xf700('0x57')]=qs[_0xf700('0x3f')](_0x1f191e[_0xf700('0x38')][_0xf700('0x3f')]);_0x199a5b[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x1f191e['query'],_0x13a845[_0xf700('0x39')]));if(_0x1f191e[_0xf700('0x38')]['filter']){_0x199a5b[_0xf700('0x40')]=_[_0xf700('0x43')](_0x199a5b[_0xf700('0x40')],{'$or':_[_0xf700('0x31')](_0x199a5b[_0xf700('0x3c')],function(_0x3ba9c4){var _0x6e53cf={};_0x6e53cf[_0x3ba9c4]={'$like':'%'+_0x1f191e[_0xf700('0x38')][_0xf700('0x42')]+'%'};return _0x6e53cf;})});}_0x199a5b=_[_0xf700('0x43')]({},_0x199a5b,_0x1f191e[_0xf700('0x4b')]);return _0x2264d8[_0xf700('0x65')](_0x199a5b);}})[_0xf700('0x26')](function(_0x774ef2){if(_0x774ef2){_0xeb3891=_0x774ef2[_0xf700('0x49')];if(!_0x1f191e['query']['hasOwnProperty'](_0xf700('0x3e'))){_0x199a5b['limit']=qs['limit'](_0x1f191e['query']['limit']);_0x199a5b[_0xf700('0x66')]=qs[_0xf700('0x66')](_0x1f191e[_0xf700('0x38')][_0xf700('0x66')]);}return _0x2264d8[_0xf700('0x65')](_0x199a5b);}})['then'](function(_0x114b41){if(_0x114b41){return _0x114b41?{'count':_0xeb3891,'rows':_0x114b41}:null;}})[_0xf700('0x26')](respondWithResult(_0x5dc303,null))[_0xf700('0x46')](handleError(_0x5dc303,null));};exports[_0xf700('0x67')]=function(_0xc2859d,_0x4161b0,_0x21122a){var _0x4fdf73=_0xc2859d['body'][_0xf700('0x68')];return db[_0xf700('0x69')][_0xf700('0x5a')]({'where':{'id':_0x4fdf73},'attributes':['id'],'include':[{'model':db[_0xf700('0x5b')],'as':_0xf700('0x6a'),'attributes':['id','name',_0xf700('0x6b'),_0xf700('0x6c'),_0xf700('0x6d')],'raw':!![]}]})[_0xf700('0x26')](function(_0x2e1a71){if(_0x2e1a71){var _0x5d2780=_['flatMap'](_0x2e1a71,function(_0x371d04){var _0x7214d7=_0x371d04['get']({'plain':!![]});return _0x7214d7[_0xf700('0x6a')];});return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0xc2859d[_0xf700('0x48')]['id']}})['then'](function(_0x1a89b0){return db[_0xf700('0x6e')][_0xf700('0x6f')](function(_0x576ac0){return _0x1a89b0[_0xf700('0x67')](_0x4fdf73,{'transaction':_0x576ac0})['then'](function(){return BPromise['each'](_0x5d2780,function(_0x51c0a5){return db['UserSmsQueue'][_0xf700('0x70')]({'where':{'UserId':_0x51c0a5['id'],'SmsQueueId':_0xc2859d[_0xf700('0x48')]['id']},'transaction':_0x576ac0});});})[_0xf700('0x26')](function(){_0x5d2780[_0xf700('0x71')](function(_0x3f3e47){socket[_0xf700('0x72')]('userSmsQueue:save',{'UserId':_0x3f3e47['id'],'SmsQueueId':_0x1a89b0['id']});});});});});}})[_0xf700('0x26')](respondWithStatusCode(_0x4161b0,null))[_0xf700('0x46')](handleError(_0x4161b0,null));};exports[_0xf700('0x73')]=function(_0x2e64ae,_0x396969,_0x208467){return db[_0xf700('0x69')]['findAll']({'where':{'id':_0x2e64ae['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf700('0x5b')],'as':_0xf700('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf700('0x26')](handleEntityNotFound(_0x396969,null))[_0xf700('0x26')](function(_0x396604){var _0x3b0f16=_['map'](_0x396604,'id');var _0x44fb55=[];var _0x3349b5=[];var _0x1dc29b=squel['select']();_0x1dc29b['field']('tq.TeamId')[_0xf700('0x74')](_0xf700('0x75'),'tq')['join'](_0xf700('0x76'),'ut',_0xf700('0x77'))['where']('SmsQueueId\x20=\x20?',_0x2e64ae[_0xf700('0x48')]['id']);for(var _0x57f281=0x0;_0x57f281<_0x396604['length'];_0x57f281+=0x1){let _0x407500=_0x396604[_0x57f281];for(var _0x5d8bff=0x0;_0x5d8bff<_0x407500[_0xf700('0x6a')][_0xf700('0x49')];_0x5d8bff+=0x1){let _0x1bd27a=_0x407500[_0xf700('0x6a')][_0x5d8bff];var _0x19a02f=_0x1dc29b[_0xf700('0x78')]();_0x19a02f['where'](_0xf700('0x79'),_0x1bd27a['id']);_0x3349b5[_0xf700('0x7a')](db[_0xf700('0x6e')][_0xf700('0x38')](_0x19a02f[_0xf700('0x7b')](),{'type':db[_0xf700('0x6e')][_0xf700('0x7c')][_0xf700('0x7d')]})[_0xf700('0x26')](function(_0x1a426c){if(_0x1a426c[_0xf700('0x49')]===0x1){return _0x1bd27a['id'];}else{var _0x5a150e=_[_0xf700('0x7e')](_[_0xf700('0x31')](_0x1a426c,_0xf700('0x7f')),function(_0x5b6b24){return _['includes'](_0x3b0f16,_0x5b6b24);});if(_0x5a150e){return _0x1bd27a['id'];}}}));}}return BPromise[_0xf700('0x80')](_0x3349b5)[_0xf700('0x26')](function(_0x5897b3){_0x44fb55=_(_0x44fb55)[_0xf700('0x81')](_0x5897b3)[_0xf700('0x82')]()[_0xf700('0x83')]();return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0x2e64ae[_0xf700('0x48')]['id']}})[_0xf700('0x26')](function(_0x5c73f8){return db['sequelize'][_0xf700('0x6f')](function(_0x4ea609){return _0x5c73f8[_0xf700('0x73')](_0x2e64ae[_0xf700('0x38')]['ids'],{'transaction':_0x4ea609})['then'](function(){if(!_[_0xf700('0x84')](_0x44fb55)){return _0x5c73f8[_0xf700('0x85')](_0x44fb55,{'transaction':_0x4ea609});}})[_0xf700('0x26')](function(){_0x44fb55[_0xf700('0x71')](function(_0x56fce9){socket[_0xf700('0x72')]('userSmsQueue:remove',{'UserId':_0x56fce9,'SmsQueueId':_0x5c73f8['id']});});});});});});})[_0xf700('0x26')](respondWithStatusCode(_0x396969,null))[_0xf700('0x46')](handleError(_0x396969,null));};exports[_0xf700('0x86')]=function(_0x160f68,_0xf38b65,_0x53bdf4){return db['SmsQueue'][_0xf700('0x4c')]({'where':{'id':_0x160f68[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0xf38b65,null))[_0xf700('0x26')](function(_0x59c3eb){if(_0x59c3eb){return _0x59c3eb[_0xf700('0x86')](_0x160f68[_0xf700('0x4e')][_0xf700('0x68')],_[_0xf700('0x87')](_0x160f68['body'],[_0xf700('0x68'),'id'])||{})[_0xf700('0x88')](function(_0x4e39a2){for(var _0x4d9320=0x0;_0x4d9320<_0x160f68['body'][_0xf700('0x68')][_0xf700('0x49')];_0x4d9320+=0x1){socket[_0xf700('0x72')](_0xf700('0x89'),{'UserId':_0x160f68[_0xf700('0x4e')][_0xf700('0x68')][_0x4d9320],'SmsQueueId':_0x160f68[_0xf700('0x48')]['id']});}return _0x4e39a2;});}})[_0xf700('0x26')](respondWithResult(_0xf38b65,null))[_0xf700('0x46')](handleError(_0xf38b65,null));};exports[_0xf700('0x85')]=function(_0x4c99ec,_0x2edb85,_0x5c1af1){return db[_0xf700('0x32')][_0xf700('0x4c')]({'where':{'id':_0x4c99ec['params']['id']}})[_0xf700('0x26')](handleEntityNotFound(_0x2edb85,null))[_0xf700('0x26')](function(_0x204209){if(_0x204209){return _0x204209[_0xf700('0x85')](_0x4c99ec[_0xf700('0x38')]['ids'])[_0xf700('0x26')](function(){if(_['isArray'](_0x4c99ec[_0xf700('0x38')][_0xf700('0x68')])){for(var _0x124df0=0x0;_0x124df0<_0x4c99ec[_0xf700('0x38')]['ids']['length'];_0x124df0+=0x1){socket[_0xf700('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x4c99ec[_0xf700('0x38')][_0xf700('0x68')][_0x124df0]),'SmsQueueId':Number(_0x4c99ec[_0xf700('0x48')]['id'])});}}else{socket[_0xf700('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x4c99ec[_0xf700('0x38')][_0xf700('0x68')]),'SmsQueueId':Number(_0x4c99ec[_0xf700('0x48')]['id'])});}});}})[_0xf700('0x26')](respondWithStatusCode(_0x2edb85,null))[_0xf700('0x46')](handleError(_0x2edb85,null));};exports[_0xf700('0x8a')]=function(_0x167f84,_0x502ad8,_0x3838ee){var _0x462728={};var _0x192e71={};var _0x370f87;var _0x49dfa5;return db[_0xf700('0x32')]['findOne']({'where':{'id':_0x167f84[_0xf700('0x48')]['id']}})['then'](handleEntityNotFound(_0x502ad8,null))[_0xf700('0x26')](function(_0x471c89){if(_0x471c89){_0x370f87=_0x471c89;_0x192e71['model']=_[_0xf700('0x37')](db[_0xf700('0x5b')]['rawAttributes']);_0x192e71[_0xf700('0x38')]=_[_0xf700('0x37')](_0x167f84[_0xf700('0x38')]);_0x192e71[_0xf700('0x39')]=_[_0xf700('0x3a')](_0x192e71[_0xf700('0x36')],_0x192e71['query']);_0x462728['attributes']=_[_0xf700('0x3a')](_0x192e71[_0xf700('0x36')],qs[_0xf700('0x3b')](_0x167f84[_0xf700('0x38')][_0xf700('0x3b')]));_0x462728[_0xf700('0x3c')]=_0x462728[_0xf700('0x3c')][_0xf700('0x49')]?_0x462728[_0xf700('0x3c')]:_0x192e71['model'];_0x462728[_0xf700('0x57')]=qs[_0xf700('0x3f')](_0x167f84[_0xf700('0x38')]['sort']);_0x462728[_0xf700('0x40')]=qs[_0xf700('0x39')](_[_0xf700('0x41')](_0x167f84[_0xf700('0x38')],_0x192e71['filters']));if(_0x167f84[_0xf700('0x38')]['filter']){_0x462728[_0xf700('0x40')]=_[_0xf700('0x43')](_0x462728[_0xf700('0x40')],{'$or':_[_0xf700('0x31')](_0x462728[_0xf700('0x3c')],function(_0x583bf0){var _0x2d9a08={};_0x2d9a08[_0x583bf0]={'$like':'%'+_0x167f84[_0xf700('0x38')][_0xf700('0x42')]+'%'};return _0x2d9a08;})});}_0x462728=_[_0xf700('0x43')]({},_0x462728,_0x167f84[_0xf700('0x4b')]);return _0x370f87[_0xf700('0x8a')](_0x462728);}})['then'](function(_0x2aec16){if(_0x2aec16){_0x49dfa5=_0x2aec16[_0xf700('0x49')];if(!_0x167f84[_0xf700('0x38')][_0xf700('0x3d')](_0xf700('0x3e'))){_0x462728['limit']=qs[_0xf700('0x1f')](_0x167f84[_0xf700('0x38')][_0xf700('0x1f')]);_0x462728['offset']=qs[_0xf700('0x66')](_0x167f84['query'][_0xf700('0x66')]);}return _0x370f87[_0xf700('0x8a')](_0x462728);}})[_0xf700('0x26')](function(_0x4ddd0d){if(_0x4ddd0d){return _0x4ddd0d?{'count':_0x49dfa5,'rows':_0x4ddd0d}:null;}})['then'](respondWithResult(_0x502ad8,null))[_0xf700('0x46')](handleError(_0x502ad8,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ba0058c..645ec3d 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 _0x05e2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x4e4131,_0x2a7207){var _0x38a874=function(_0x3c89d6){while(--_0x3c89d6){_0x4e4131['push'](_0x4e4131['shift']());}};_0x38a874(++_0x2a7207);}(_0x05e2,0xe0));var _0x205e=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0x05e2[_0x3c2666];return _0x10c814;};'use strict';var EventEmitter=require(_0x205e('0x0'));var SmsQueue=require(_0x205e('0x1'))['db'][_0x205e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x205e('0x3')](0x0);var events={'afterCreate':_0x205e('0x4'),'afterUpdate':_0x205e('0x5'),'afterDestroy':_0x205e('0x6')};function emitEvent(_0x39c1eb){return function(_0x28f9cd,_0x9ef671,_0x24b4d2){SmsQueueEvents[_0x205e('0x7')](_0x39c1eb+':'+_0x28f9cd['id'],_0x28f9cd);SmsQueueEvents[_0x205e('0x7')](_0x39c1eb,_0x28f9cd);_0x24b4d2(null);};}for(var e in events){if(events[_0x205e('0x8')](e)){var event=events[e];SmsQueue[_0x205e('0x9')](e,emitEvent(event));}}module[_0x205e('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xf19d=['save','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xf19d,0x164));var _0xdf19=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xf19d[_0x1ddedd];return _0xa3e1ac;};'use strict';var EventEmitter=require(_0xdf19('0x0'));var SmsQueue=require(_0xdf19('0x1'))['db'][_0xdf19('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xdf19('0x3')](0x0);var events={'afterCreate':_0xdf19('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38efa2){return function(_0x533cbe,_0x31dd7e,_0x223f0c){SmsQueueEvents[_0xdf19('0x5')](_0x38efa2+':'+_0x533cbe['id'],_0x533cbe);SmsQueueEvents[_0xdf19('0x5')](_0x38efa2,_0x533cbe);_0x223f0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xdf19('0x6')](e,emitEvent(event));}}module[_0xdf19('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1af3a39..9bc0da4 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 _0xbd3b=['request-promise','path','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x15542f,_0x4019bf){var _0x46f5de=function(_0x2726e1){while(--_0x2726e1){_0x15542f['push'](_0x15542f['shift']());}};_0x46f5de(++_0x4019bf);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x5edafc,_0x22002c){_0x5edafc=_0x5edafc-0x0;var _0x1fa600=_0xbd3b[_0x5edafc];return _0x1fa600;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var logger=require(_0xbbd3('0x2'))('api');var moment=require(_0xbbd3('0x3'));var BPromise=require(_0xbbd3('0x4'));var rp=require(_0xbbd3('0x5'));var fs=require('fs');var path=require(_0xbbd3('0x6'));var rimraf=require('rimraf');var config=require(_0xbbd3('0x7'));var attributes=require(_0xbbd3('0x8'));module['exports']=function(_0x2e1bcb,_0x494774){return _0x2e1bcb[_0xbbd3('0x9')](_0xbbd3('0xa'),attributes,{'tableName':_0xbbd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb66c=['sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x362e84,_0x40af12){var _0x292bde=function(_0x472193){while(--_0x472193){_0x362e84['push'](_0x362e84['shift']());}};_0x292bde(++_0x40af12);}(_0xb66c,0x175));var _0xcb66=function(_0x207193,_0x3c6339){_0x207193=_0x207193-0x0;var _0x17e8be=_0xb66c[_0x207193];return _0x17e8be;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 968d74c..5476701 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 _0xf3a6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find'];(function(_0x2d0bdd,_0x299c2f){var _0x80ebfb=function(_0x15c145){while(--_0x15c145){_0x2d0bdd['push'](_0x2d0bdd['shift']());}};_0x80ebfb(++_0x299c2f);}(_0xf3a6,0x183));var _0x6f3a=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf3a6[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x6f3a('0x0'));var util=require(_0x6f3a('0x1'));var moment=require(_0x6f3a('0x2'));var BPromise=require(_0x6f3a('0x3'));var rs=require(_0x6f3a('0x4'));var fs=require('fs');var Redis=require(_0x6f3a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f3a('0x6'));var logger=require(_0x6f3a('0x7'))(_0x6f3a('0x8'));var config=require(_0x6f3a('0x9'));var jayson=require(_0x6f3a('0xa'));var client=jayson[_0x6f3a('0xb')][_0x6f3a('0xc')]({'port':0x232a});config[_0x6f3a('0xd')]=_[_0x6f3a('0xe')](config['redis'],{'host':_0x6f3a('0xf'),'port':0x18eb});var socket=require(_0x6f3a('0x10'))(new Redis(config[_0x6f3a('0xd')]));require(_0x6f3a('0x11'))[_0x6f3a('0x12')](socket);function respondWithRpcPromise(_0x425b5c,_0x3e3978,_0x53f096){return new BPromise(function(_0x1f9f71,_0x147728){return client[_0x6f3a('0x13')](_0x425b5c,_0x53f096)[_0x6f3a('0x14')](function(_0xfa2cdf){logger[_0x6f3a('0x15')](_0x6f3a('0x16'),_0x3e3978,_0x6f3a('0x17'));logger[_0x6f3a('0x18')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x3e3978,_0x6f3a('0x17'),JSON[_0x6f3a('0x19')](_0xfa2cdf));if(_0xfa2cdf[_0x6f3a('0x1a')]){if(_0xfa2cdf[_0x6f3a('0x1a')]['code']===0x1f4){logger[_0x6f3a('0x1a')]('SmsQueue,\x20%s,\x20%s',_0x3e3978,_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);return _0x147728(_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);}logger[_0x6f3a('0x1a')](_0x6f3a('0x16'),_0x3e3978,_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);return _0x1f9f71(_0xfa2cdf[_0x6f3a('0x1a')][_0x6f3a('0x1b')]);}else{logger[_0x6f3a('0x15')](_0x6f3a('0x16'),_0x3e3978,_0x6f3a('0x17'));_0x1f9f71(_0xfa2cdf[_0x6f3a('0x1c')]['message']);}})[_0x6f3a('0x1d')](function(_0x20a562){logger[_0x6f3a('0x1a')](_0x6f3a('0x16'),_0x3e3978,_0x20a562);_0x147728(_0x20a562);});});}exports[_0x6f3a('0x1e')]=function(_0x3a763c){var _0x324130=this;return new Promise(function(_0x536a17,_0x3ed538){return db['SmsQueue'][_0x6f3a('0x1f')]({'raw':_0x3a763c[_0x6f3a('0x20')]?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x21')]===undefined?!![]:![]:!![],'where':_0x3a763c['options']?_0x3a763c['options'][_0x6f3a('0x22')]||null:null,'attributes':_0x3a763c[_0x6f3a('0x20')]?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x23')]||null:null,'limit':_0x3a763c[_0x6f3a('0x20')]?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x24')]||null:null,'include':_0x3a763c['options']?_0x3a763c[_0x6f3a('0x20')][_0x6f3a('0x25')]?_[_0x6f3a('0x26')](_0x3a763c[_0x6f3a('0x20')]['include'],function(_0x3eb47c){return{'model':db[_0x3eb47c[_0x6f3a('0x27')]],'as':_0x3eb47c['as'],'attributes':_0x3eb47c[_0x6f3a('0x23')],'include':_0x3eb47c['include']?_[_0x6f3a('0x26')](_0x3eb47c['include'],function(_0x3b4cce){return{'model':db[_0x3b4cce[_0x6f3a('0x27')]],'as':_0x3b4cce['as'],'attributes':_0x3b4cce[_0x6f3a('0x23')],'include':_0x3b4cce[_0x6f3a('0x25')]?_[_0x6f3a('0x26')](_0x3b4cce[_0x6f3a('0x25')],function(_0xc0266a){return{'model':db[_0xc0266a[_0x6f3a('0x27')]],'as':_0xc0266a['as'],'attributes':_0xc0266a[_0x6f3a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6f3a('0x14')](function(_0x1186c1){logger[_0x6f3a('0x15')](_0x6f3a('0x1e'),_0x3a763c);logger[_0x6f3a('0x18')](_0x6f3a('0x1e'),_0x3a763c,JSON[_0x6f3a('0x19')](_0x1186c1));_0x536a17(_0x1186c1);})['catch'](function(_0x4b92f1){logger[_0x6f3a('0x1a')](_0x6f3a('0x1e'),_0x4b92f1[_0x6f3a('0x1b')],_0x3a763c);_0x3ed538(_0x324130[_0x6f3a('0x1a')](0x1f4,_0x4b92f1[_0x6f3a('0x1b')]));});});};exports[_0x6f3a('0x28')]=function(_0x28c653){var _0x193e50=this;return new Promise(function(_0x366a82,_0x15817b){return db[_0x6f3a('0x29')][_0x6f3a('0x2a')]({'raw':_0x28c653['options']?_0x28c653[_0x6f3a('0x20')][_0x6f3a('0x21')]===undefined?!![]:![]:!![],'where':_0x28c653[_0x6f3a('0x20')]?_0x28c653[_0x6f3a('0x20')][_0x6f3a('0x22')]||null:null,'attributes':_0x28c653[_0x6f3a('0x20')]?_0x28c653[_0x6f3a('0x20')][_0x6f3a('0x23')]||null:null,'include':_0x28c653[_0x6f3a('0x20')]?_0x28c653[_0x6f3a('0x20')]['include']?_[_0x6f3a('0x26')](_0x28c653['options'][_0x6f3a('0x25')],function(_0x1c6e58){return{'model':db[_0x1c6e58[_0x6f3a('0x27')]],'as':_0x1c6e58['as'],'attributes':_0x1c6e58['attributes'],'include':_0x1c6e58[_0x6f3a('0x25')]?_[_0x6f3a('0x26')](_0x1c6e58['include'],function(_0x3f83e7){return{'model':db[_0x3f83e7[_0x6f3a('0x27')]],'as':_0x3f83e7['as'],'attributes':_0x3f83e7['attributes'],'include':_0x3f83e7['include']?_[_0x6f3a('0x26')](_0x3f83e7[_0x6f3a('0x25')],function(_0xf22bbd){return{'model':db[_0xf22bbd[_0x6f3a('0x27')]],'as':_0xf22bbd['as'],'attributes':_0xf22bbd[_0x6f3a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd3eea1){logger['info'](_0x6f3a('0x28'),_0x28c653);logger[_0x6f3a('0x18')]('ShowSmsQueue',_0x28c653,JSON[_0x6f3a('0x19')](_0xd3eea1));_0x366a82(_0xd3eea1);})[_0x6f3a('0x1d')](function(_0x58ae05){logger['error'](_0x6f3a('0x28'),_0x58ae05[_0x6f3a('0x1b')],_0x28c653);_0x15817b(_0x193e50['error'](0x1f4,_0x58ae05[_0x6f3a('0x1b')]));});});}; \ No newline at end of file +var _0x58fb=['map','include','model','attributes','ShowSmsQueue','SmsQueue','find','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0x58fb,0x148));var _0xb58f=function(_0x179edb,_0x45fb9d){_0x179edb=_0x179edb-0x0;var _0x8dceae=_0x58fb[_0x179edb];return _0x8dceae;};'use strict';var _=require(_0xb58f('0x0'));var util=require(_0xb58f('0x1'));var moment=require(_0xb58f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb58f('0x3'));var fs=require('fs');var Redis=require(_0xb58f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb58f('0x5'));var logger=require(_0xb58f('0x6'))(_0xb58f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb58f('0x8')][_0xb58f('0x9')]({'port':0x232a});config[_0xb58f('0xa')]=_[_0xb58f('0xb')](config[_0xb58f('0xa')],{'host':_0xb58f('0xc'),'port':0x18eb});var socket=require(_0xb58f('0xd'))(new Redis(config[_0xb58f('0xa')]));require('./smsQueue.socket')[_0xb58f('0xe')](socket);function respondWithRpcPromise(_0x24bd92,_0x5e408d,_0x5aee6c){return new BPromise(function(_0x2c8f74,_0x421705){return client[_0xb58f('0xf')](_0x24bd92,_0x5aee6c)[_0xb58f('0x10')](function(_0x5d445e){logger['info'](_0xb58f('0x11'),_0x5e408d,_0xb58f('0x12'));logger[_0xb58f('0x13')](_0xb58f('0x14'),_0x5e408d,_0xb58f('0x12'),JSON[_0xb58f('0x15')](_0x5d445e));if(_0x5d445e[_0xb58f('0x16')]){if(_0x5d445e['error']['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x5e408d,_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);return _0x421705(_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x5e408d,_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);return _0x2c8f74(_0x5d445e[_0xb58f('0x16')][_0xb58f('0x17')]);}else{logger['info'](_0xb58f('0x11'),_0x5e408d,_0xb58f('0x12'));_0x2c8f74(_0x5d445e[_0xb58f('0x18')]['message']);}})[_0xb58f('0x19')](function(_0x2bc543){logger['error']('SmsQueue,\x20%s,\x20%s',_0x5e408d,_0x2bc543);_0x421705(_0x2bc543);});});}exports[_0xb58f('0x1a')]=function(_0x38540e){var _0x7f64ef=this;return new Promise(function(_0x30965e,_0x19c3a3){return db['SmsQueue'][_0xb58f('0x1b')]({'raw':_0x38540e[_0xb58f('0x1c')]?_0x38540e['options'][_0xb58f('0x1d')]===undefined?!![]:![]:!![],'where':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')][_0xb58f('0x1e')]||null:null,'attributes':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')]['attributes']||null:null,'limit':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')][_0xb58f('0x1f')]||null:null,'include':_0x38540e[_0xb58f('0x1c')]?_0x38540e[_0xb58f('0x1c')]['include']?_[_0xb58f('0x20')](_0x38540e[_0xb58f('0x1c')][_0xb58f('0x21')],function(_0x1d323a){return{'model':db[_0x1d323a[_0xb58f('0x22')]],'as':_0x1d323a['as'],'attributes':_0x1d323a['attributes'],'include':_0x1d323a[_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x1d323a[_0xb58f('0x21')],function(_0x3578fd){return{'model':db[_0x3578fd['model']],'as':_0x3578fd['as'],'attributes':_0x3578fd[_0xb58f('0x23')],'include':_0x3578fd[_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x3578fd['include'],function(_0x5d1f13){return{'model':db[_0x5d1f13[_0xb58f('0x22')]],'as':_0x5d1f13['as'],'attributes':_0x5d1f13[_0xb58f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f552d){logger['info']('GetSmsQueue',_0x38540e);logger[_0xb58f('0x13')](_0xb58f('0x1a'),_0x38540e,JSON[_0xb58f('0x15')](_0x1f552d));_0x30965e(_0x1f552d);})[_0xb58f('0x19')](function(_0x8aae3f){logger['error'](_0xb58f('0x1a'),_0x8aae3f[_0xb58f('0x17')],_0x38540e);_0x19c3a3(_0x7f64ef[_0xb58f('0x16')](0x1f4,_0x8aae3f[_0xb58f('0x17')]));});});};exports[_0xb58f('0x24')]=function(_0x423778){var _0x453d4c=this;return new Promise(function(_0x1bc046,_0x26b949){return db[_0xb58f('0x25')][_0xb58f('0x26')]({'raw':_0x423778[_0xb58f('0x1c')]?_0x423778[_0xb58f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x423778[_0xb58f('0x1c')]?_0x423778[_0xb58f('0x1c')][_0xb58f('0x1e')]||null:null,'attributes':_0x423778['options']?_0x423778[_0xb58f('0x1c')]['attributes']||null:null,'include':_0x423778['options']?_0x423778['options'][_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x423778[_0xb58f('0x1c')][_0xb58f('0x21')],function(_0x5319c3){return{'model':db[_0x5319c3['model']],'as':_0x5319c3['as'],'attributes':_0x5319c3[_0xb58f('0x23')],'include':_0x5319c3[_0xb58f('0x21')]?_[_0xb58f('0x20')](_0x5319c3[_0xb58f('0x21')],function(_0x1397d0){return{'model':db[_0x1397d0[_0xb58f('0x22')]],'as':_0x1397d0['as'],'attributes':_0x1397d0['attributes'],'include':_0x1397d0['include']?_[_0xb58f('0x20')](_0x1397d0['include'],function(_0xa29866){return{'model':db[_0xa29866[_0xb58f('0x22')]],'as':_0xa29866['as'],'attributes':_0xa29866['attributes']};}):[]};}):[]};}):[]:[]})[_0xb58f('0x10')](function(_0x1f6b72){logger[_0xb58f('0x27')](_0xb58f('0x24'),_0x423778);logger['debug'](_0xb58f('0x24'),_0x423778,JSON[_0xb58f('0x15')](_0x1f6b72));_0x1bc046(_0x1f6b72);})[_0xb58f('0x19')](function(_0x47fd7a){logger[_0xb58f('0x16')](_0xb58f('0x24'),_0x47fd7a[_0xb58f('0x17')],_0x423778);_0x26b949(_0x453d4c[_0xb58f('0x16')](0x1f4,_0x47fd7a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3442bdc..bbf686a 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 _0x1d91=['emit','removeListener','register','length','./smsQueue.events','save','remove','update'];(function(_0x5c965a,_0x42cc16){var _0x3b6bd9=function(_0x3ba393){while(--_0x3ba393){_0x5c965a['push'](_0x5c965a['shift']());}};_0x3b6bd9(++_0x42cc16);}(_0x1d91,0x64));var _0x11d9=function(_0x5b9031,_0x1ecf8a){_0x5b9031=_0x5b9031-0x0;var _0x522398=_0x1d91[_0x5b9031];return _0x522398;};'use strict';var SmsQueueEvents=require(_0x11d9('0x0'));var events=[_0x11d9('0x1'),_0x11d9('0x2'),_0x11d9('0x3')];function createListener(_0x2c7381,_0x107c14){return function(_0x250003){_0x107c14[_0x11d9('0x4')](_0x2c7381,_0x250003);};}function removeListener(_0x5db550,_0x1f32ef){return function(){SmsQueueEvents[_0x11d9('0x5')](_0x5db550,_0x1f32ef);};}exports[_0x11d9('0x6')]=function(_0x3b304d){for(var _0x4b6de4=0x0,_0x56533e=events[_0x11d9('0x7')];_0x4b6de4<_0x56533e;_0x4b6de4++){var _0x4bda7a=events[_0x4b6de4];var _0x3347c1=createListener('smsQueue:'+_0x4bda7a,_0x3b304d);SmsQueueEvents['on'](_0x4bda7a,_0x3347c1);}}; \ No newline at end of file +var _0xc318=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x4bf78e,_0x5b7a3b){var _0x495abb=function(_0x3f7e46){while(--_0x3f7e46){_0x4bf78e['push'](_0x4bf78e['shift']());}};_0x495abb(++_0x5b7a3b);}(_0xc318,0x104));var _0x8c31=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc318[_0x6c993a];return _0x27f547;};'use strict';var SmsQueueEvents=require(_0x8c31('0x0'));var events=[_0x8c31('0x1'),_0x8c31('0x2'),_0x8c31('0x3')];function createListener(_0x2dcf1d,_0x133264){return function(_0x529f5d){_0x133264['emit'](_0x2dcf1d,_0x529f5d);};}function removeListener(_0xbac655,_0x1042d2){return function(){SmsQueueEvents[_0x8c31('0x4')](_0xbac655,_0x1042d2);};}exports[_0x8c31('0x5')]=function(_0x1c5df5){for(var _0x104c2b=0x0,_0x1e184d=events[_0x8c31('0x6')];_0x104c2b<_0x1e184d;_0x104c2b++){var _0x4d18e1=events[_0x104c2b];var _0xb91a20=createListener(_0x8c31('0x7')+_0x4d18e1,_0x1c5df5);SmsQueueEvents['on'](_0x4d18e1,_0xb91a20);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8318231..f1e9f51 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 _0x66e1=['../../components/auth/service','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5c3347,_0x1a7bbf){var _0x4dc774=function(_0x3cd66d){while(--_0x3cd66d){_0x5c3347['push'](_0x5c3347['shift']());}};_0x4dc774(++_0x1a7bbf);}(_0x66e1,0xd3));var _0x166e=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x66e1[_0xd0b415];return _0x2bdf2c;};'use strict';var multer=require(_0x166e('0x0'));var util=require(_0x166e('0x1'));var path=require(_0x166e('0x2'));var timeout=require(_0x166e('0x3'));var express=require(_0x166e('0x4'));var router=express['Router']();var auth=require(_0x166e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x166e('0x6')]);router[_0x166e('0x7')](_0x166e('0x8'),auth[_0x166e('0x9')](),controller[_0x166e('0xa')]);router['get']('/:id',auth[_0x166e('0x9')](),controller[_0x166e('0xb')]);router[_0x166e('0xc')]('/',auth[_0x166e('0x9')](),controller[_0x166e('0xd')]);router['put'](_0x166e('0xe'),auth[_0x166e('0x9')](),controller['update']);router[_0x166e('0xf')]('/:id',auth[_0x166e('0x9')](),controller[_0x166e('0x10')]);module[_0x166e('0x11')]=router; \ No newline at end of file +var _0x0737=['destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete'];(function(_0x40f194,_0x1fe87c){var _0x350349=function(_0x43f95c){while(--_0x43f95c){_0x40f194['push'](_0x40f194['shift']());}};_0x350349(++_0x1fe87c);}(_0x0737,0xa3));var _0x7073=function(_0xcd9190,_0x46a9af){_0xcd9190=_0xcd9190-0x0;var _0xdd4bee=_0x0737[_0xcd9190];return _0xdd4bee;};'use strict';var multer=require(_0x7073('0x0'));var util=require(_0x7073('0x1'));var path=require('path');var timeout=require(_0x7073('0x2'));var express=require(_0x7073('0x3'));var router=express['Router']();var auth=require(_0x7073('0x4'));var interaction=require(_0x7073('0x5'));var config=require(_0x7073('0x6'));var controller=require(_0x7073('0x7'));router[_0x7073('0x8')]('/',auth[_0x7073('0x9')](),controller['index']);router[_0x7073('0x8')]('/describe',auth[_0x7073('0x9')](),controller[_0x7073('0xa')]);router['get'](_0x7073('0xb'),auth[_0x7073('0x9')](),controller[_0x7073('0xc')]);router['post']('/',auth[_0x7073('0x9')](),controller[_0x7073('0xd')]);router[_0x7073('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7073('0xf')]);router[_0x7073('0x10')](_0x7073('0xb'),auth[_0x7073('0x9')](),controller[_0x7073('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5c204ab..a64d5aa 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 _0x4a8f=['STRING','DATE','moment','sequelize','exports'];(function(_0x53d5d7,_0x76eed8){var _0x29f8e9=function(_0x50df37){while(--_0x50df37){_0x53d5d7['push'](_0x53d5d7['shift']());}};_0x29f8e9(++_0x76eed8);}(_0x4a8f,0x110));var _0xf4a8=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x4a8f[_0xe45118];return _0x15e15d;};'use strict';var moment=require(_0xf4a8('0x0'));var Sequelize=require(_0xf4a8('0x1'));module[_0xf4a8('0x2')]={'uniqueid':{'type':Sequelize[_0xf4a8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf4a8('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf4a8('0x4')]},'exitAt':{'type':Sequelize[_0xf4a8('0x4')]},'reason':{'type':Sequelize[_0xf4a8('0x3')]}}; \ No newline at end of file +var _0x4871=['exports','STRING','DATE','moment','sequelize'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0x4871,0x14d));var _0x1487=function(_0x1560bd,_0x3318fd){_0x1560bd=_0x1560bd-0x0;var _0x1ef369=_0x4871[_0x1560bd];return _0x1ef369;};'use strict';var moment=require(_0x1487('0x0'));var Sequelize=require(_0x1487('0x1'));module[_0x1487('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1487('0x3')]},'joinAt':{'type':Sequelize[_0x1487('0x4')]},'leaveAt':{'type':Sequelize[_0x1487('0x4')]},'acceptAt':{'type':Sequelize[_0x1487('0x4')]},'exitAt':{'type':Sequelize[_0x1487('0x4')]},'reason':{'type':Sequelize[_0x1487('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 604be5e..477bd20 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 _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'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 +var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0x814b,0x1a2));var _0xb814=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x814b[_0x1af5b2];return _0xf1aa2d;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f672740..0ad5a45 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 _0x8705=['define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x8705,0x1f2));var _0x5870=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8705[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5870('0x0'));var util=require(_0x5870('0x1'));var logger=require(_0x5870('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5870('0x3'));var rp=require(_0x5870('0x4'));var fs=require('fs');var path=require(_0x5870('0x5'));var rimraf=require(_0x5870('0x6'));var config=require('../../config/environment');var attributes=require(_0x5870('0x7'));module[_0x5870('0x8')]=function(_0x3f4812,_0x212022){return _0x3f4812[_0x5870('0x9')](_0x5870('0xa'),attributes,{'tableName':_0x5870('0xb'),'paranoid':![],'indexes':[{'name':_0x5870('0xc'),'fields':[_0x5870('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a44=['request-promise','path','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','api','moment','bluebird'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x4a44,0xf8));var _0x44a4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4a44[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x44a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x44a4('0x1'));var moment=require(_0x44a4('0x2'));var BPromise=require(_0x44a4('0x3'));var rp=require(_0x44a4('0x4'));var fs=require('fs');var path=require(_0x44a4('0x5'));var rimraf=require('rimraf');var config=require(_0x44a4('0x6'));var attributes=require(_0x44a4('0x7'));module['exports']=function(_0x55c537,_0x5a2c3d){return _0x55c537[_0x44a4('0x8')](_0x44a4('0x9'),attributes,{'tableName':_0x44a4('0xa'),'paranoid':![],'indexes':[{'name':_0x44a4('0xb'),'fields':[_0x44a4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d598625..8fbb2f7 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 _0xd4ef=['error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','options','info','body','raw','where','limit','UpdateSmsQueueReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b5f97,_0x46b15e){var _0x2f6001=function(_0x268878){while(--_0x268878){_0x5b5f97['push'](_0x5b5f97['shift']());}};_0x2f6001(++_0x46b15e);}(_0xd4ef,0x169));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfd4e('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd4e('0x1'));var db=require(_0xfd4e('0x2'))['db'];var utils=require(_0xfd4e('0x3'));var logger=require(_0xfd4e('0x4'))(_0xfd4e('0x5'));var config=require(_0xfd4e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd4e('0x7')][_0xfd4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d513e,_0xce5084,_0x20cd1a){return new BPromise(function(_0x3a985b,_0x1ad2ed){return client[_0xfd4e('0x9')](_0x3d513e,_0x20cd1a)[_0xfd4e('0xa')](function(_0x449d09){logger['info'](_0xfd4e('0xb'),_0xce5084,_0xfd4e('0xc'));logger[_0xfd4e('0xd')](_0xfd4e('0xe'),_0xce5084,_0xfd4e('0xc'),JSON[_0xfd4e('0xf')](_0x449d09));if(_0x449d09[_0xfd4e('0x10')]){if(_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x11')]===0x1f4){logger[_0xfd4e('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0xce5084,_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x12')]);return _0x1ad2ed(_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x12')]);}logger[_0xfd4e('0x10')](_0xfd4e('0xb'),_0xce5084,_0x449d09[_0xfd4e('0x10')]['message']);return _0x3a985b(_0x449d09[_0xfd4e('0x10')][_0xfd4e('0x12')]);}else{logger['info'](_0xfd4e('0xb'),_0xce5084,_0xfd4e('0xc'));_0x3a985b(_0x449d09['result'][_0xfd4e('0x12')]);}})[_0xfd4e('0x13')](function(_0x374397){logger[_0xfd4e('0x10')](_0xfd4e('0xb'),_0xce5084,_0x374397);_0x1ad2ed(_0x374397);});});}exports[_0xfd4e('0x14')]=function(_0x3fab25){var _0x5825fe=this;return new Promise(function(_0x2e420e,_0x5c6f1a){return db[_0xfd4e('0x15')]['create'](_0x3fab25['body'],{'raw':_0x3fab25[_0xfd4e('0x16')]?_0x3fab25[_0xfd4e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xfd4e('0xa')](function(_0x3c73db){logger[_0xfd4e('0x17')](_0xfd4e('0x14'),_0x3fab25);logger['debug'](_0xfd4e('0x14'),_0x3fab25,JSON['stringify'](_0x3c73db));_0x2e420e(_0x3c73db);})[_0xfd4e('0x13')](function(_0x4bc6b5){logger[_0xfd4e('0x10')]('CreateSmsQueueReport',_0x4bc6b5[_0xfd4e('0x12')],_0x3fab25);_0x5c6f1a(_0x5825fe[_0xfd4e('0x10')](0x1f4,_0x4bc6b5[_0xfd4e('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x4495f0){var _0x5128b2=this;return new Promise(function(_0x50850f,_0x417476){return db['SmsQueueReport']['update'](_0x4495f0[_0xfd4e('0x18')],{'raw':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0['options'][_0xfd4e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0['options'][_0xfd4e('0x1a')]||null:null,'attributes':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0['options']['attributes']||null:null,'limit':_0x4495f0[_0xfd4e('0x16')]?_0x4495f0[_0xfd4e('0x16')][_0xfd4e('0x1b')]||null:null})[_0xfd4e('0xa')](function(_0x4e3321){logger[_0xfd4e('0x17')](_0xfd4e('0x1c'),_0x4495f0);logger[_0xfd4e('0xd')](_0xfd4e('0x1c'),_0x4495f0,JSON['stringify'](_0x4e3321));_0x50850f(_0x4e3321);})[_0xfd4e('0x13')](function(_0x4d5ff7){logger[_0xfd4e('0x10')](_0xfd4e('0x1c'),_0x4d5ff7[_0xfd4e('0x12')],_0x4495f0);_0x417476(_0x5128b2[_0xfd4e('0x10')](0x1f4,_0x4d5ff7[_0xfd4e('0x12')]));});});}; \ No newline at end of file +var _0x7828=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','update','body','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x18d1ce,_0x2cf546){var _0x473ea5=function(_0x2d1bea){while(--_0x2d1bea){_0x18d1ce['push'](_0x18d1ce['shift']());}};_0x473ea5(++_0x2cf546);}(_0x7828,0x15e));var _0x8782=function(_0x438525,_0x16ea09){_0x438525=_0x438525-0x0;var _0x288a50=_0x7828[_0x438525];return _0x288a50;};'use strict';var _=require('lodash');var util=require(_0x8782('0x0'));var moment=require(_0x8782('0x1'));var BPromise=require(_0x8782('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8782('0x3'));var db=require(_0x8782('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8782('0x5'))('rpc');var config=require(_0x8782('0x6'));var jayson=require(_0x8782('0x7'));var client=jayson[_0x8782('0x8')][_0x8782('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x479bd6,_0xc1fae6,_0x927a27){return new BPromise(function(_0x502bf7,_0x28b272){return client[_0x8782('0xa')](_0x479bd6,_0x927a27)[_0x8782('0xb')](function(_0x4f4824){logger[_0x8782('0xc')](_0x8782('0xd'),_0xc1fae6,_0x8782('0xe'));logger['debug'](_0x8782('0xf'),_0xc1fae6,'request\x20sent',JSON[_0x8782('0x10')](_0x4f4824));if(_0x4f4824[_0x8782('0x11')]){if(_0x4f4824['error']['code']===0x1f4){logger[_0x8782('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xc1fae6,_0x4f4824[_0x8782('0x11')][_0x8782('0x12')]);return _0x28b272(_0x4f4824[_0x8782('0x11')]['message']);}logger[_0x8782('0x11')](_0x8782('0xd'),_0xc1fae6,_0x4f4824[_0x8782('0x11')][_0x8782('0x12')]);return _0x502bf7(_0x4f4824[_0x8782('0x11')][_0x8782('0x12')]);}else{logger[_0x8782('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0xc1fae6,_0x8782('0xe'));_0x502bf7(_0x4f4824[_0x8782('0x13')]['message']);}})[_0x8782('0x14')](function(_0x588d1b){logger[_0x8782('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xc1fae6,_0x588d1b);_0x28b272(_0x588d1b);});});}exports[_0x8782('0x15')]=function(_0x46d426){var _0x19e1e6=this;return new Promise(function(_0x5e249f,_0x8a5266){return db[_0x8782('0x16')][_0x8782('0x17')](_0x46d426['body'],{'raw':_0x46d426[_0x8782('0x18')]?_0x46d426[_0x8782('0x18')][_0x8782('0x19')]===undefined?!![]:![]:!![]})[_0x8782('0xb')](function(_0x43e36f){logger['info'](_0x8782('0x15'),_0x46d426);logger[_0x8782('0x1a')](_0x8782('0x15'),_0x46d426,JSON['stringify'](_0x43e36f));_0x5e249f(_0x43e36f);})[_0x8782('0x14')](function(_0x5b4d53){logger[_0x8782('0x11')](_0x8782('0x15'),_0x5b4d53[_0x8782('0x12')],_0x46d426);_0x8a5266(_0x19e1e6[_0x8782('0x11')](0x1f4,_0x5b4d53[_0x8782('0x12')]));});});};exports[_0x8782('0x1b')]=function(_0x5a4aaa){var _0x593bc3=this;return new Promise(function(_0x2efcac,_0x36fdd9){return db['SmsQueueReport'][_0x8782('0x1c')](_0x5a4aaa[_0x8782('0x1d')],{'raw':_0x5a4aaa['options']?_0x5a4aaa[_0x8782('0x18')][_0x8782('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4aaa['options']?_0x5a4aaa[_0x8782('0x18')][_0x8782('0x1e')]||null:null,'attributes':_0x5a4aaa[_0x8782('0x18')]?_0x5a4aaa['options'][_0x8782('0x1f')]||null:null,'limit':_0x5a4aaa[_0x8782('0x18')]?_0x5a4aaa[_0x8782('0x18')][_0x8782('0x20')]||null:null})['then'](function(_0xef3660){logger[_0x8782('0xc')](_0x8782('0x1b'),_0x5a4aaa);logger['debug'](_0x8782('0x1b'),_0x5a4aaa,JSON[_0x8782('0x10')](_0xef3660));_0x2efcac(_0xef3660);})[_0x8782('0x14')](function(_0x49fb36){logger[_0x8782('0x11')]('UpdateSmsQueueReport',_0x49fb36[_0x8782('0x12')],_0x5a4aaa);_0x36fdd9(_0x593bc3['error'](0x1f4,_0x49fb36[_0x8782('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3ed2700..4639470 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x757a,0xde));var _0xa757=function(_0x53da6d,_0x546e8f){_0x53da6d=_0x53da6d-0x0;var _0x5a05ae=_0x757a[_0x53da6d];return _0x5a05ae;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6324=['util','path','connect-timeout','Router','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x42d285,_0x48dda9){var _0x5c88a6=function(_0x58a3db){while(--_0x58a3db){_0x42d285['push'](_0x42d285['shift']());}};_0x5c88a6(++_0x48dda9);}(_0x6324,0x142));var _0x4632=function(_0x479988,_0x17b763){_0x479988=_0x479988-0x0;var _0x17610c=_0x6324[_0x479988];return _0x17610c;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get']('/',auth[_0x4632('0x7')](),controller[_0x4632('0x8')]);router[_0x4632('0x9')](_0x4632('0xa'),auth['isAuthenticated'](),controller[_0x4632('0xb')]);router[_0x4632('0x9')](_0x4632('0xc'),auth['isAuthenticated'](),controller[_0x4632('0xd')]);router[_0x4632('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4632('0xf')](_0x4632('0xc'),auth[_0x4632('0x7')](),controller[_0x4632('0x10')]);router[_0x4632('0x11')](_0x4632('0xc'),auth[_0x4632('0x7')](),controller[_0x4632('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1162552..f8003df 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 _0xb125=['account','agent','queue','NOW','moment','sequelize','exports','STRING'];(function(_0x11067b,_0x2b689f){var _0x511235=function(_0x4425fe){while(--_0x4425fe){_0x11067b['push'](_0x11067b['shift']());}};_0x511235(++_0x2b689f);}(_0xb125,0x1e4));var _0x5b12=function(_0x1ef8d8,_0x594468){_0x1ef8d8=_0x1ef8d8-0x0;var _0x403fe8=_0xb125[_0x1ef8d8];return _0x403fe8;};'use strict';var moment=require(_0x5b12('0x0'));var Sequelize=require(_0x5b12('0x1'));module[_0x5b12('0x2')]={'uniqueid':{'type':Sequelize[_0x5b12('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5b12('0x4'),_0x5b12('0x5'),_0x5b12('0x6')),'allowNull':![],'defaultValue':_0x5b12('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5b12('0x7')]}}; \ No newline at end of file +var _0x32f5=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x1879f6,_0x447434){var _0x455909=function(_0x443507){while(--_0x443507){_0x1879f6['push'](_0x1879f6['shift']());}};_0x455909(++_0x447434);}(_0x32f5,0x130));var _0x532f=function(_0x5b47af,_0x3dc3f2){_0x5b47af=_0x5b47af-0x0;var _0xc50dee=_0x32f5[_0x5b47af];return _0xc50dee;};'use strict';var moment=require('moment');var Sequelize=require(_0x532f('0x0'));module[_0x532f('0x1')]={'uniqueid':{'type':Sequelize[_0x532f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x532f('0x3')]('account',_0x532f('0x4'),'queue'),'allowNull':![],'defaultValue':_0x532f('0x5')},'transferredAt':{'type':Sequelize[_0x532f('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ad08cda..4fa1f87 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 _0x9c44=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x3904a3,_0x467f1b){var _0x25e8f5=function(_0xc61adf){while(--_0xc61adf){_0x3904a3['push'](_0x3904a3['shift']());}};_0x25e8f5(++_0x467f1b);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['SmsTransferReport'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));};exports[_0x49c4('0x40')]=function(_0x2668ed,_0x2dffb4){var _0xa3d59e={'raw':!![],'where':{'id':_0x2668ed['params']['id']}},_0x326142={};_0x326142[_0x49c4('0x29')]=_['keys'](db[_0x49c4('0x3b')][_0x49c4('0x25')]);_0x326142[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x2668ed[_0x49c4('0x2a')]);_0x326142[_0x49c4('0x35')]=_['intersection'](_0x326142['model'],_0x326142[_0x49c4('0x2a')]);_0xa3d59e[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x326142[_0x49c4('0x29')],qs['fields'](_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x2e')]));_0xa3d59e[_0x49c4('0x2c')]=_0xa3d59e[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0xa3d59e[_0x49c4('0x2c')]:_0x326142[_0x49c4('0x29')];if(_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x41')]){_0xa3d59e['include']=[{'all':!![]}];}_0xa3d59e=_[_0x49c4('0x38')]({},_0xa3d59e,_0x2668ed['options']);return db[_0x49c4('0x3b')][_0x49c4('0x42')](_0xa3d59e)[_0x49c4('0x20')](handleEntityNotFound(_0x2dffb4,null))[_0x49c4('0x20')](respondWithResult(_0x2dffb4,null))[_0x49c4('0x3f')](handleError(_0x2dffb4,null));};exports['create']=function(_0x592e8e,_0x15b674){return db[_0x49c4('0x3b')][_0x49c4('0x43')](_0x592e8e[_0x49c4('0x44')],{})[_0x49c4('0x20')](respondWithResult(_0x15b674,0xc9))[_0x49c4('0x3f')](handleError(_0x15b674,null));};exports['update']=function(_0x3bac1b,_0x5cfff9){if(_0x3bac1b[_0x49c4('0x44')]['id']){delete _0x3bac1b[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x3bac1b[_0x49c4('0x45')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x20')](saveUpdates(_0x3bac1b['body'],null))[_0x49c4('0x20')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x3f')](handleError(_0x5cfff9,null));};exports['destroy']=function(_0x1e1ac4,_0xaece5f){return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x1e1ac4['params']['id']}})['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x20')](removeEntity(_0xaece5f,null))['catch'](handleError(_0xaece5f,null));};exports[_0x49c4('0x46')]=function(_0x1f941f,_0x3811b2){return db[_0x49c4('0x3b')][_0x49c4('0x46')]()[_0x49c4('0x20')](respondWithResult(_0x3811b2,null))[_0x49c4('0x3f')](handleError(_0x3811b2,null));}; \ No newline at end of file +var _0x70e0=['attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x412c66,_0x1e5067){var _0x2df7cb=function(_0x34f094){while(--_0x34f094){_0x412c66['push'](_0x412c66['shift']());}};_0x2df7cb(++_0x1e5067);}(_0x70e0,0x17b));var _0x070e=function(_0x51878c,_0x54d5d0){_0x51878c=_0x51878c-0x0;var _0x2a9401=_0x70e0[_0x51878c];return _0x2a9401;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));};exports['show']=function(_0x5bd39a,_0x398168){var _0x42c448={'raw':!![],'where':{'id':_0x5bd39a['params']['id']}},_0x38879f={};_0x38879f[_0x070e('0x2b')]=_[_0x070e('0x2c')](db[_0x070e('0x27')][_0x070e('0x28')]);_0x38879f['query']=_[_0x070e('0x2c')](_0x5bd39a['query']);_0x38879f['filters']=_['intersection'](_0x38879f[_0x070e('0x2b')],_0x38879f[_0x070e('0x2d')]);_0x42c448[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x38879f[_0x070e('0x2b')],qs['fields'](_0x5bd39a[_0x070e('0x2d')]['fields']));_0x42c448[_0x070e('0x2f')]=_0x42c448[_0x070e('0x2f')][_0x070e('0x31')]?_0x42c448['attributes']:_0x38879f['model'];if(_0x5bd39a[_0x070e('0x2d')]['includeAll']){_0x42c448[_0x070e('0x41')]=[{'all':!![]}];}_0x42c448=_[_0x070e('0x3a')]({},_0x42c448,_0x5bd39a[_0x070e('0x3b')]);return db['SmsTransferReport'][_0x070e('0x42')](_0x42c448)[_0x070e('0x20')](handleEntityNotFound(_0x398168,null))['then'](respondWithResult(_0x398168,null))['catch'](handleError(_0x398168,null));};exports[_0x070e('0x43')]=function(_0x945901,_0x2d43ce){return db[_0x070e('0x27')][_0x070e('0x43')](_0x945901['body'],{})[_0x070e('0x20')](respondWithResult(_0x2d43ce,0xc9))[_0x070e('0x40')](handleError(_0x2d43ce,null));};exports[_0x070e('0x1f')]=function(_0x391dee,_0x79eaa0){if(_0x391dee[_0x070e('0x44')]['id']){delete _0x391dee[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x391dee[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x79eaa0,null))[_0x070e('0x20')](saveUpdates(_0x391dee[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x79eaa0,null))[_0x070e('0x40')](handleError(_0x79eaa0,null));};exports['destroy']=function(_0x171621,_0xa7a41b){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x171621[_0x070e('0x45')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xa7a41b,null))[_0x070e('0x20')](removeEntity(_0xa7a41b,null))[_0x070e('0x40')](handleError(_0xa7a41b,null));};exports[_0x070e('0x46')]=function(_0x5744c5,_0x251696){return db['SmsTransferReport'][_0x070e('0x46')]()[_0x070e('0x20')](respondWithResult(_0x251696,null))['catch'](handleError(_0x251696,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c0bf45b..6c4d644 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 _0x2ea6=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define'];(function(_0x3bbcf6,_0x596bd4){var _0x308a42=function(_0x5ca9d6){while(--_0x5ca9d6){_0x3bbcf6['push'](_0x3bbcf6['shift']());}};_0x308a42(++_0x596bd4);}(_0x2ea6,0x148));var _0x62ea=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x2ea6[_0x616290];return _0x453879;};'use strict';var _=require(_0x62ea('0x0'));var util=require('util');var logger=require(_0x62ea('0x1'))(_0x62ea('0x2'));var moment=require(_0x62ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x62ea('0x4'));var fs=require('fs');var path=require(_0x62ea('0x5'));var rimraf=require(_0x62ea('0x6'));var config=require(_0x62ea('0x7'));var attributes=require(_0x62ea('0x8'));module['exports']=function(_0x30eaf8,_0x4d0360){return _0x30eaf8[_0x62ea('0x9')](_0x62ea('0xa'),attributes,{'tableName':_0x62ea('0xb'),'paranoid':![],'indexes':[{'name':_0x62ea('0xc'),'fields':[_0x62ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f54=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f54,0xe4));var _0x43f5=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x3f54[_0x5ce15c];return _0x36e4f5;};'use strict';var _=require(_0x43f5('0x0'));var util=require(_0x43f5('0x1'));var logger=require(_0x43f5('0x2'))(_0x43f5('0x3'));var moment=require(_0x43f5('0x4'));var BPromise=require('bluebird');var rp=require(_0x43f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43f5('0x6'));var config=require(_0x43f5('0x7'));var attributes=require(_0x43f5('0x8'));module[_0x43f5('0x9')]=function(_0x54ba91,_0x1f0ca7){return _0x54ba91[_0x43f5('0xa')]('SmsTransferReport',attributes,{'tableName':_0x43f5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x43f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4bccde1..036d4eb 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 _0x33d0=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x33d0,0x1e4));var _0x033d=function(_0x499195,_0x5df0b2){_0x499195=_0x499195-0x0;var _0x1137ce=_0x33d0[_0x499195];return _0x1137ce;};'use strict';var _=require(_0x033d('0x0'));var util=require(_0x033d('0x1'));var moment=require(_0x033d('0x2'));var BPromise=require(_0x033d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x033d('0x4'));var db=require(_0x033d('0x5'))['db'];var utils=require(_0x033d('0x6'));var logger=require(_0x033d('0x7'))(_0x033d('0x8'));var config=require(_0x033d('0x9'));var jayson=require(_0x033d('0xa'));var client=jayson['client'][_0x033d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51fb89,_0x320c37,_0x210ab0){return new BPromise(function(_0x45648d,_0x2e5c8b){return client[_0x033d('0xc')](_0x51fb89,_0x210ab0)[_0x033d('0xd')](function(_0x36f11c){logger[_0x033d('0xe')](_0x033d('0xf'),_0x320c37,_0x033d('0x10'));logger[_0x033d('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x320c37,_0x033d('0x10'),JSON[_0x033d('0x12')](_0x36f11c));if(_0x36f11c[_0x033d('0x13')]){if(_0x36f11c[_0x033d('0x13')]['code']===0x1f4){logger[_0x033d('0x13')](_0x033d('0xf'),_0x320c37,_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);return _0x2e5c8b(_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);}logger[_0x033d('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x320c37,_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);return _0x45648d(_0x36f11c[_0x033d('0x13')][_0x033d('0x14')]);}else{logger['info'](_0x033d('0xf'),_0x320c37,_0x033d('0x10'));_0x45648d(_0x36f11c['result']['message']);}})[_0x033d('0x15')](function(_0x3f7ca9){logger[_0x033d('0x13')](_0x033d('0xf'),_0x320c37,_0x3f7ca9);_0x2e5c8b(_0x3f7ca9);});});} \ No newline at end of file +var _0xce7b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce7b,0xc3));var _0xbce7=function(_0x3532f3,_0x19c533){_0x3532f3=_0x3532f3-0x0;var _0x4e86ac=_0xce7b[_0x3532f3];return _0x4e86ac;};'use strict';var _=require('lodash');var util=require(_0xbce7('0x0'));var moment=require(_0xbce7('0x1'));var BPromise=require(_0xbce7('0x2'));var rs=require(_0xbce7('0x3'));var fs=require('fs');var Redis=require(_0xbce7('0x4'));var db=require(_0xbce7('0x5'))['db'];var utils=require(_0xbce7('0x6'));var logger=require(_0xbce7('0x7'))(_0xbce7('0x8'));var config=require(_0xbce7('0x9'));var jayson=require(_0xbce7('0xa'));var client=jayson[_0xbce7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182364,_0x356df1,_0x12d511){return new BPromise(function(_0xd4a214,_0x1a42bd){return client[_0xbce7('0xc')](_0x182364,_0x12d511)[_0xbce7('0xd')](function(_0x260eec){logger[_0xbce7('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x356df1,_0xbce7('0xf'));logger['debug'](_0xbce7('0x10'),_0x356df1,_0xbce7('0xf'),JSON[_0xbce7('0x11')](_0x260eec));if(_0x260eec['error']){if(_0x260eec[_0xbce7('0x12')][_0xbce7('0x13')]===0x1f4){logger[_0xbce7('0x12')](_0xbce7('0x14'),_0x356df1,_0x260eec['error'][_0xbce7('0x15')]);return _0x1a42bd(_0x260eec[_0xbce7('0x12')][_0xbce7('0x15')]);}logger['error'](_0xbce7('0x14'),_0x356df1,_0x260eec['error'][_0xbce7('0x15')]);return _0xd4a214(_0x260eec[_0xbce7('0x12')][_0xbce7('0x15')]);}else{logger[_0xbce7('0xe')](_0xbce7('0x14'),_0x356df1,_0xbce7('0xf'));_0xd4a214(_0x260eec[_0xbce7('0x16')][_0xbce7('0x15')]);}})[_0xbce7('0x17')](function(_0x1b7014){logger[_0xbce7('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x356df1,_0x1b7014);_0x1a42bd(_0x1b7014);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index af8c5d7..a74dc8a 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 _0xdae8=['update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create','put'];(function(_0x121e0f,_0x1dce03){var _0x563380=function(_0x49fcbb){while(--_0x49fcbb){_0x121e0f['push'](_0x121e0f['shift']());}};_0x563380(++_0x1dce03);}(_0xdae8,0xce));var _0x8dae=function(_0x1dfcb9,_0x3f245e){_0x1dfcb9=_0x1dfcb9-0x0;var _0xc930a7=_0xdae8[_0x1dfcb9];return _0xc930a7;};'use strict';var multer=require('multer');var util=require(_0x8dae('0x0'));var path=require('path');var timeout=require(_0x8dae('0x1'));var express=require(_0x8dae('0x2'));var router=express['Router']();var auth=require(_0x8dae('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8dae('0x4'));var controller=require(_0x8dae('0x5'));router[_0x8dae('0x6')]('/',auth[_0x8dae('0x7')](),controller[_0x8dae('0x8')]);router[_0x8dae('0x6')](_0x8dae('0x9'),auth['isAuthenticated'](),controller[_0x8dae('0xa')]);router[_0x8dae('0x6')](_0x8dae('0xb'),auth[_0x8dae('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x8dae('0xc')]({'destination':function(_0x3bcd51,_0x5581c8,_0x5dd2c2){_0x5dd2c2(null,path[_0x8dae('0xd')](config[_0x8dae('0xe')],'server/files/sounds/original/'));},'filename':function(_0x3c0f57,_0x1462a9,_0xbed9bb){_0x1462a9[_0x8dae('0xf')]=_0x1462a9[_0x8dae('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xbed9bb(null,util[_0x8dae('0x10')](_0x8dae('0x11'),path[_0x8dae('0x12')](_0x1462a9[_0x8dae('0xf')],path[_0x8dae('0x13')](_0x1462a9['originalname'])),Date[_0x8dae('0x14')](),path[_0x8dae('0x13')](_0x1462a9[_0x8dae('0xf')])));}})});router[_0x8dae('0x15')]('/',upload[_0x8dae('0x16')](_0x8dae('0x17')),controller[_0x8dae('0x18')]);router[_0x8dae('0x19')]('/:id',auth[_0x8dae('0x7')](),controller[_0x8dae('0x1a')]);router[_0x8dae('0x1b')](_0x8dae('0x9'),auth[_0x8dae('0x7')](),controller[_0x8dae('0x1b')]);module[_0x8dae('0x1c')]=router; \ No newline at end of file +var _0xaafe=['update','delete','exports','util','path','connect-timeout','express','./sound.controller','isAuthenticated','index','/:id','show','get','download','root','server/files/sounds/original/','originalname','format','basename','extname','now','single','file','create','put'];(function(_0x5328b4,_0x1475d6){var _0x287638=function(_0x54da66){while(--_0x54da66){_0x5328b4['push'](_0x5328b4['shift']());}};_0x287638(++_0x1475d6);}(_0xaafe,0xb2));var _0xeaaf=function(_0x5da78c,_0xfc64e0){_0x5da78c=_0x5da78c-0x0;var _0x3ce0e0=_0xaafe[_0x5da78c];return _0x3ce0e0;};'use strict';var multer=require('multer');var util=require(_0xeaaf('0x0'));var path=require(_0xeaaf('0x1'));var timeout=require(_0xeaaf('0x2'));var express=require(_0xeaaf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeaaf('0x4'));router['get']('/',auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x6')]);router['get'](_0xeaaf('0x7'),auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x8')]);router[_0xeaaf('0x9')]('/:id/download',auth[_0xeaaf('0x5')](),controller[_0xeaaf('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x50b810,_0x21e907,_0xb4cba1){_0xb4cba1(null,path['join'](config[_0xeaaf('0xb')],_0xeaaf('0xc')));},'filename':function(_0x48a0c5,_0x44e318,_0xd5c55c){_0x44e318['originalname']=_0x44e318[_0xeaaf('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd5c55c(null,util[_0xeaaf('0xe')]('%s-%s%s',path[_0xeaaf('0xf')](_0x44e318[_0xeaaf('0xd')],path[_0xeaaf('0x10')](_0x44e318['originalname'])),Date[_0xeaaf('0x11')](),path[_0xeaaf('0x10')](_0x44e318[_0xeaaf('0xd')])));}})});router['post']('/',upload[_0xeaaf('0x12')](_0xeaaf('0x13')),controller[_0xeaaf('0x14')]);router[_0xeaaf('0x15')](_0xeaaf('0x7'),auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x16')]);router[_0xeaaf('0x17')](_0xeaaf('0x7'),auth[_0xeaaf('0x5')](),controller[_0xeaaf('0x17')]);module[_0xeaaf('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 098539b..b4ecda6 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 _0x730c=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x730c,0x8c));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc730('0x0'));module['exports']={'name':{'type':Sequelize[_0xc730('0x1')],'unique':_0xc730('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc730('0x1')]},'display_name':{'type':Sequelize[_0xc730('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xc730('0x1')]},'original_format':{'type':Sequelize[_0xc730('0x1')]},'original_duration':{'type':Sequelize[_0xc730('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc730('0x4')]},'original_channelCount':{'type':Sequelize[_0xc730('0x5')]},'original_bitRate':{'type':Sequelize[_0xc730('0x4')]},'original_sampleRate':{'type':Sequelize[_0xc730('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xc730('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc730('0x4')]},'converted_channelCount':{'type':Sequelize[_0xc730('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xc730('0x5')]}}; \ No newline at end of file +var _0xe71d=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x12b146,_0x4a2efc){var _0x28879a=function(_0x1256a2){while(--_0x1256a2){_0x12b146['push'](_0x12b146['shift']());}};_0x28879a(++_0x4a2efc);}(_0xe71d,0x1b7));var _0xde71=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xe71d[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0xde71('0x0')]={'name':{'type':Sequelize[_0xde71('0x1')],'unique':_0xde71('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xde71('0x1')]},'display_name':{'type':Sequelize[_0xde71('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xde71('0x1')]},'original_format':{'type':Sequelize[_0xde71('0x1')]},'original_duration':{'type':Sequelize[_0xde71('0x3')]},'original_sampleCount':{'type':Sequelize[_0xde71('0x4')]},'original_channelCount':{'type':Sequelize[_0xde71('0x5')]},'original_bitRate':{'type':Sequelize[_0xde71('0x4')]},'original_sampleRate':{'type':Sequelize[_0xde71('0x5')]},'converted_format':{'type':Sequelize[_0xde71('0x1')]},'converted_duration':{'type':Sequelize[_0xde71('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xde71('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 88ccafa..fb4dea7 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 _0x4bcb=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','Sound','count','includeAll','include','findAll','show','rawAttributes','length','merge','options','find','download','params','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','catch','create','basename','file','originalname','extname','filename','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','%s.%s','original_format','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4bcb,0x74));var _0xb4bc=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x4bcb[_0x10f68e];return _0x4c8372;};'use strict';var pdf=require(_0xb4bc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb4bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4bc('0x2'));var rp=require(_0xb4bc('0x3'));var moment=require(_0xb4bc('0x4'));var BPromise=require(_0xb4bc('0x5'));var Mustache=require(_0xb4bc('0x6'));var util=require(_0xb4bc('0x7'));var path=require(_0xb4bc('0x8'));var sox=require(_0xb4bc('0x9'));var csv=require(_0xb4bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4bc('0xb'));var squel=require(_0xb4bc('0xc'));var crypto=require(_0xb4bc('0xd'));var jsforce=require(_0xb4bc('0xe'));var deskjs=require(_0xb4bc('0xf'));var toCsv=require(_0xb4bc('0xa'));var querystring=require('querystring');var Papa=require(_0xb4bc('0x10'));var Redis=require(_0xb4bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb4bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4bc('0x13'))('api');var utils=require(_0xb4bc('0x14'));var config=require(_0xb4bc('0x15'));var db=require(_0xb4bc('0x16'))['db'];function respondWithStatusCode(_0x10039d,_0x23d8b0){_0x23d8b0=_0x23d8b0||0xcc;return function(_0x1ef88c){if(_0x1ef88c){return _0x10039d[_0xb4bc('0x17')](_0x23d8b0);}return _0x10039d[_0xb4bc('0x18')](_0x23d8b0)[_0xb4bc('0x19')]();};}function respondWithResult(_0x4c72a5,_0x2dbe09){_0x2dbe09=_0x2dbe09||0xc8;return function(_0x459dc0){if(_0x459dc0){return _0x4c72a5[_0xb4bc('0x18')](_0x2dbe09)[_0xb4bc('0x1a')](_0x459dc0);}};}function respondWithFilteredResult(_0x260ed6,_0x46cb80){return function(_0x1265e8){if(_0x1265e8){var _0x1219d4=_0x1265e8['count'],_0x399561=_0x46cb80[_0xb4bc('0x1b')],_0x35bb56=_0x46cb80['offset']+_0x46cb80[_0xb4bc('0x1c')],_0x3bf5c8;if(_0x35bb56>=_0x1219d4){_0x35bb56=_0x1219d4;_0x3bf5c8=0xc8;}else{_0x3bf5c8=0xce;}_0x260ed6[_0xb4bc('0x18')](_0x3bf5c8);return _0x260ed6[_0xb4bc('0x1d')]('Content-Range',_0x399561+'-'+_0x35bb56+'/'+_0x1219d4)[_0xb4bc('0x1a')](_0x1265e8);}return null;};}function patchUpdates(_0x11294b){return function(_0x27df74){try{jsonpatch[_0xb4bc('0x1e')](_0x27df74,_0x11294b,!![]);}catch(_0x274745){return BPromise[_0xb4bc('0x1f')](_0x274745);}return _0x27df74[_0xb4bc('0x20')]();};}function saveUpdates(_0x449d3b,_0x1d4cc9){return function(_0x10ba12){if(_0x10ba12){return _0x10ba12[_0xb4bc('0x21')](_0x449d3b)[_0xb4bc('0x22')](function(_0x299aaa){return _0x299aaa;});}return null;};}function removeEntity(_0x1310c7,_0x5acb3f){return function(_0x16674b){if(_0x16674b){return _0x16674b[_0xb4bc('0x23')]()[_0xb4bc('0x22')](function(){var _0x330b22=_0x16674b[_0xb4bc('0x24')]({'plain':!![]});var _0x4f3d45=_0xb4bc('0x25');return db[_0xb4bc('0x26')]['destroy']({'where':{'type':_0x4f3d45,'resourceId':_0x330b22['id']}})[_0xb4bc('0x22')](function(){return _0x16674b;});})[_0xb4bc('0x22')](function(){_0x1310c7[_0xb4bc('0x18')](0xcc)[_0xb4bc('0x19')]();});}};}function handleEntityNotFound(_0x1f0788,_0x9cf783){return function(_0x38aba2){if(!_0x38aba2){_0x1f0788[_0xb4bc('0x17')](0x194);}return _0x38aba2;};}function handleError(_0x558f9f,_0x16b0f3){_0x16b0f3=_0x16b0f3||0x1f4;return function(_0x495cd2){logger['error'](_0x495cd2[_0xb4bc('0x27')]);if(_0x495cd2[_0xb4bc('0x28')]){delete _0x495cd2['name'];}_0x558f9f[_0xb4bc('0x18')](_0x16b0f3)[_0xb4bc('0x29')](_0x495cd2);};}exports[_0xb4bc('0x2a')]=function(_0x361d96,_0x2f9129){var _0x4f9b00={},_0x1e7aab={},_0x55ecf8={'count':0x0,'rows':[]};var _0x4b80e2=_[_0xb4bc('0x2b')](db['Sound']['rawAttributes'],function(_0x30faa9){return{'name':_0x30faa9[_0xb4bc('0x2c')],'type':_0x30faa9[_0xb4bc('0x2d')][_0xb4bc('0x2e')]};});_0x1e7aab[_0xb4bc('0x2f')]=_['map'](_0x4b80e2,_0xb4bc('0x28'));_0x1e7aab['query']=_[_0xb4bc('0x30')](_0x361d96[_0xb4bc('0x31')]);_0x1e7aab[_0xb4bc('0x32')]=_[_0xb4bc('0x33')](_0x1e7aab['model'],_0x1e7aab[_0xb4bc('0x31')]);_0x4f9b00[_0xb4bc('0x34')]=_['intersection'](_0x1e7aab['model'],qs['fields'](_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x35')]));_0x4f9b00[_0xb4bc('0x34')]=_0x4f9b00[_0xb4bc('0x34')]['length']?_0x4f9b00[_0xb4bc('0x34')]:_0x1e7aab[_0xb4bc('0x2f')];if(!_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x36')](_0xb4bc('0x37'))){_0x4f9b00['limit']=qs[_0xb4bc('0x1c')](_0x361d96[_0xb4bc('0x31')]['limit']);_0x4f9b00[_0xb4bc('0x1b')]=qs[_0xb4bc('0x1b')](_0x361d96[_0xb4bc('0x31')]['offset']);}_0x4f9b00[_0xb4bc('0x38')]=qs[_0xb4bc('0x39')](_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x39')]);_0x4f9b00['where']=qs[_0xb4bc('0x32')](_[_0xb4bc('0x3a')](_0x361d96[_0xb4bc('0x31')],_0x1e7aab['filters']),_0x4b80e2);if(_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x3b')]){_0x4f9b00[_0xb4bc('0x3c')]=_['merge'](_0x4f9b00[_0xb4bc('0x3c')],{'$or':_[_0xb4bc('0x2b')](_0x4b80e2,function(_0x3f4cb4){if(_0x3f4cb4['type']!==_0xb4bc('0x3d')){var _0x3abb5d={};_0x3abb5d[_0x3f4cb4[_0xb4bc('0x28')]]={'$like':'%'+_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x3b')]+'%'};return _0x3abb5d;}})});}_0x4f9b00=_['merge']({},_0x4f9b00,_0x361d96['options']);var _0x5d04b0={'where':_0x4f9b00[_0xb4bc('0x3c')]};return db[_0xb4bc('0x3e')]['count'](_0x5d04b0)[_0xb4bc('0x22')](function(_0x53ceca){_0x55ecf8[_0xb4bc('0x3f')]=_0x53ceca;if(_0x361d96[_0xb4bc('0x31')][_0xb4bc('0x40')]){_0x4f9b00[_0xb4bc('0x41')]=[{'all':!![]}];}return db[_0xb4bc('0x3e')][_0xb4bc('0x42')](_0x4f9b00);})[_0xb4bc('0x22')](function(_0x3bf14e){_0x55ecf8['rows']=_0x3bf14e;return _0x55ecf8;})['then'](respondWithFilteredResult(_0x2f9129,_0x4f9b00))['catch'](handleError(_0x2f9129,null));};exports[_0xb4bc('0x43')]=function(_0x50b31a,_0x59a172){var _0x3ba2fb={'raw':!![],'where':{'id':_0x50b31a['params']['id']}},_0x302e82={};_0x302e82[_0xb4bc('0x2f')]=_['keys'](db['Sound'][_0xb4bc('0x44')]);_0x302e82['query']=_[_0xb4bc('0x30')](_0x50b31a[_0xb4bc('0x31')]);_0x302e82[_0xb4bc('0x32')]=_['intersection'](_0x302e82[_0xb4bc('0x2f')],_0x302e82[_0xb4bc('0x31')]);_0x3ba2fb[_0xb4bc('0x34')]=_[_0xb4bc('0x33')](_0x302e82[_0xb4bc('0x2f')],qs[_0xb4bc('0x35')](_0x50b31a[_0xb4bc('0x31')][_0xb4bc('0x35')]));_0x3ba2fb[_0xb4bc('0x34')]=_0x3ba2fb['attributes'][_0xb4bc('0x45')]?_0x3ba2fb[_0xb4bc('0x34')]:_0x302e82['model'];if(_0x50b31a['query'][_0xb4bc('0x40')]){_0x3ba2fb[_0xb4bc('0x41')]=[{'all':!![]}];}_0x3ba2fb=_[_0xb4bc('0x46')]({},_0x3ba2fb,_0x50b31a[_0xb4bc('0x47')]);return db[_0xb4bc('0x3e')][_0xb4bc('0x48')](_0x3ba2fb)[_0xb4bc('0x22')](handleEntityNotFound(_0x59a172,null))[_0xb4bc('0x22')](respondWithResult(_0x59a172,null))['catch'](handleError(_0x59a172,null));};exports[_0xb4bc('0x49')]=function(_0x2b9fb4,_0x404698,_0x74ebdb){return db['Sound'][_0xb4bc('0x48')]({'where':{'id':_0x2b9fb4[_0xb4bc('0x4a')]['id']},'attributes':[_0xb4bc('0x28'),_0xb4bc('0x4b'),_0xb4bc('0x4c')],'raw':!![]})[_0xb4bc('0x22')](handleEntityNotFound(_0x404698,null))[_0xb4bc('0x22')](function(_0x230948){if(_0x230948){if(!fs['existsSync'](path[_0xb4bc('0x4d')](config['root'],_0xb4bc('0x4e'),_0x230948[_0xb4bc('0x4b')]+'.'+_0x230948['converted_format']))){throw new db[(_0xb4bc('0x4f'))][(_0xb4bc('0x50'))](_0xb4bc('0x51'));}return _0x404698[_0xb4bc('0x49')](path[_0xb4bc('0x4d')](config[_0xb4bc('0x52')],_0xb4bc('0x4e'),util[_0xb4bc('0x53')]('%s.%s',_0x230948[_0xb4bc('0x4b')],_0x230948[_0xb4bc('0x4c')])),util[_0xb4bc('0x53')]('%s.%s',_0x230948[_0xb4bc('0x28')],_0x230948[_0xb4bc('0x4c')]));}return null;})[_0xb4bc('0x54')](handleError(_0x404698,null));};exports[_0xb4bc('0x55')]=function(_0x2aacd1,_0x443dc5,_0x40dba2){var _0x1ec6db={'name':path[_0xb4bc('0x56')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x58')],path['extname'](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x58')])),'save_name':path['basename'](_0x2aacd1['file']['filename'],path[_0xb4bc('0x59')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x5a')])),'original_format':path[_0xb4bc('0x59')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x18659b=path[_0xb4bc('0x4d')](config['root'],_0xb4bc('0x5b'),_0x2aacd1[_0xb4bc('0x57')]['filename']);var _0xc579b4=path['join'](config[_0xb4bc('0x52')],'server/files/sounds/converted',util[_0xb4bc('0x53')]('%s.%s',path[_0xb4bc('0x56')](_0x2aacd1[_0xb4bc('0x57')][_0xb4bc('0x5a')],path[_0xb4bc('0x59')](_0x2aacd1[_0xb4bc('0x57')]['filename'])),_0x1ec6db[_0xb4bc('0x4c')]));logger[_0xb4bc('0x5c')](_0xb4bc('0x5d'),_0x18659b);logger[_0xb4bc('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0xc579b4);try{fs['chmodSync'](_0x18659b,parseInt('0777',0x8));var _0x53f544=sox[_0xb4bc('0x5e')](_0x18659b,_0xc579b4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53f544['on'](_0xb4bc('0x5f'),function(_0x55c384){fs[_0xb4bc('0x60')](_0x18659b);_0x443dc5[_0xb4bc('0x18')](0x1f4)[_0xb4bc('0x29')](_0x55c384);});_0x53f544['on'](_0xb4bc('0x61'),function(_0x161aef){_0x1ec6db[_0xb4bc('0x62')]=isNaN(_0x161aef[_0xb4bc('0x63')])?null:_0x161aef[_0xb4bc('0x63')]*0x3e8;_0x1ec6db[_0xb4bc('0x64')]=isNaN(_0x161aef[_0xb4bc('0x65')])?null:_0x161aef[_0xb4bc('0x65')];_0x1ec6db[_0xb4bc('0x66')]=isNaN(_0x161aef[_0xb4bc('0x67')])?null:_0x161aef['channelCount'];_0x1ec6db[_0xb4bc('0x68')]=isNaN(_0x161aef['bitRate'])?null:_0x161aef[_0xb4bc('0x69')];_0x1ec6db[_0xb4bc('0x6a')]=isNaN(_0x161aef['sampleRate'])?null:_0x161aef['sampleRate'];});_0x53f544['on'](_0xb4bc('0x6b'),function(_0x582f35){_0x1ec6db[_0xb4bc('0x6c')]=isNaN(_0x582f35[_0xb4bc('0x63')])?null:_0x582f35['duration']*0x3e8;_0x1ec6db[_0xb4bc('0x6d')]=isNaN(_0x582f35[_0xb4bc('0x65')])?null:_0x582f35[_0xb4bc('0x65')];_0x1ec6db[_0xb4bc('0x6e')]=isNaN(_0x582f35['channelCount'])?null:_0x582f35['channelCount'];_0x1ec6db[_0xb4bc('0x6f')]=isNaN(_0x582f35[_0xb4bc('0x69')])?null:_0x582f35[_0xb4bc('0x69')];_0x1ec6db[_0xb4bc('0x70')]=isNaN(_0x582f35['sampleRate'])?null:_0x582f35['sampleRate'];});_0x53f544['on'](_0xb4bc('0x19'),function(){fs[_0xb4bc('0x71')](_0xc579b4,parseInt('0777',0x8));return db[_0xb4bc('0x3e')][_0xb4bc('0x55')](_0x1ec6db)[_0xb4bc('0x22')](function(_0x97ae6a){var _0x120c8b={'role':_0x2aacd1[_0xb4bc('0x72')]['role'],'userProfileId':_0x2aacd1[_0xb4bc('0x72')][_0xb4bc('0x73')]};if(!_0x120c8b)throw new Error(_0xb4bc('0x74'));if(_0x120c8b['role']===_0xb4bc('0x75')){var _0x1c4370=_0x97ae6a[_0xb4bc('0x24')]({'plain':!![]});return db[_0xb4bc('0x76')][_0xb4bc('0x48')]({'where':{'name':_0xb4bc('0x25'),'userProfileId':_0x120c8b['userProfileId']},'raw':!![]})[_0xb4bc('0x22')](function(_0x222259){if(_0x222259&&_0x222259[_0xb4bc('0x77')]===0x0){return db[_0xb4bc('0x26')]['create']({'name':_0x1c4370[_0xb4bc('0x28')],'resourceId':_0x1c4370['id'],'type':_0x222259[_0xb4bc('0x28')],'sectionId':_0x222259['id']},{})['then'](function(){return _0x97ae6a;});}else{return _0x97ae6a;}})[_0xb4bc('0x54')](function(_0x932474){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x932474);throw _0x932474;});}return _0x97ae6a;})['then'](respondWithResult(_0x443dc5,null))[_0xb4bc('0x54')](handleError(_0x443dc5,null));});_0x53f544[_0xb4bc('0x78')]();}catch(_0xffbe70){_0x443dc5[_0xb4bc('0x18')](0x1f4)[_0xb4bc('0x29')](_0xffbe70);}};exports[_0xb4bc('0x21')]=function(_0x146c95,_0xe97a53,_0x59adfb){return db[_0xb4bc('0x3e')][_0xb4bc('0x48')]({'where':{'id':_0x146c95[_0xb4bc('0x4a')]['id']}})[_0xb4bc('0x22')](handleEntityNotFound(_0xe97a53,null))[_0xb4bc('0x22')](saveUpdates(_[_0xb4bc('0x3a')](_0x146c95[_0xb4bc('0x72')],[_0xb4bc('0x28'),'description']),null))[_0xb4bc('0x22')](respondWithResult(_0xe97a53,null))['catch'](handleError(_0xe97a53,null));};exports['delete']=function(_0x4f262c,_0x20b81a,_0x1048bb){return db[_0xb4bc('0x3e')]['find']({'where':{'id':_0x4f262c['params']['id']}})[_0xb4bc('0x22')](function(_0x4b1622){if(_0x4b1622){return _0x4b1622[_0xb4bc('0x23')]();}})['then'](function(_0x5296b5){var _0x4c7641=path['join'](config[_0xb4bc('0x52')],_0xb4bc('0x5b'),util['format'](_0xb4bc('0x79'),_0x5296b5[_0xb4bc('0x4b')],_0x5296b5[_0xb4bc('0x7a')]));var _0x3205cb=path['join'](config[_0xb4bc('0x52')],_0xb4bc('0x4e'),util['format'](_0xb4bc('0x79'),_0x5296b5[_0xb4bc('0x4b')],_0x5296b5[_0xb4bc('0x4c')]));fs[_0xb4bc('0x60')](_0x4c7641);fs['unlinkSync'](_0x3205cb);return _0x5296b5;})['then'](function(_0x23f24b){if(_0x23f24b){return _0x20b81a[_0xb4bc('0x18')](0xcc)['end']();}})[_0xb4bc('0x22')](handleEntityNotFound(_0x20b81a,null))[_0xb4bc('0x54')](handleError(_0x20b81a,null));}; \ No newline at end of file +var _0x53e3=['body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','%s.%s','original_format','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','download','save_name','existsSync','join','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','converted_format','create','file','originalname','basename','filename','extname','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate'];(function(_0x309378,_0x51581c){var _0xad3422=function(_0x2b6c0e){while(--_0x2b6c0e){_0x309378['push'](_0x309378['shift']());}};_0xad3422(++_0x51581c);}(_0x53e3,0x82));var _0x353e=function(_0x246490,_0x529de9){_0x246490=_0x246490-0x0;var _0xff2551=_0x53e3[_0x246490];return _0xff2551;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x353e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x353e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x353e('0x2'));var moment=require(_0x353e('0x3'));var BPromise=require(_0x353e('0x4'));var Mustache=require(_0x353e('0x5'));var util=require(_0x353e('0x6'));var path=require('path');var sox=require(_0x353e('0x7'));var csv=require('to-csv');var ejs=require(_0x353e('0x8'));var fs=require('fs');var _=require(_0x353e('0x9'));var squel=require(_0x353e('0xa'));var crypto=require('crypto');var jsforce=require(_0x353e('0xb'));var deskjs=require(_0x353e('0xc'));var toCsv=require(_0x353e('0xd'));var querystring=require(_0x353e('0xe'));var Papa=require(_0x353e('0xf'));var Redis=require('ioredis');var authService=require(_0x353e('0x10'));var qs=require(_0x353e('0x11'));var as=require(_0x353e('0x12'));var hardwareService=require(_0x353e('0x13'));var logger=require('../../config/logger')(_0x353e('0x14'));var utils=require('../../config/utils');var config=require(_0x353e('0x15'));var db=require(_0x353e('0x16'))['db'];function respondWithStatusCode(_0x30b0ca,_0x1bb707){_0x1bb707=_0x1bb707||0xcc;return function(_0x4f3de4){if(_0x4f3de4){return _0x30b0ca[_0x353e('0x17')](_0x1bb707);}return _0x30b0ca[_0x353e('0x18')](_0x1bb707)[_0x353e('0x19')]();};}function respondWithResult(_0x201a90,_0x434031){_0x434031=_0x434031||0xc8;return function(_0x5b0c19){if(_0x5b0c19){return _0x201a90['status'](_0x434031)[_0x353e('0x1a')](_0x5b0c19);}};}function respondWithFilteredResult(_0x4ebe88,_0x1c21cb){return function(_0x268edb){if(_0x268edb){var _0x51c05e=_0x268edb[_0x353e('0x1b')],_0xf12589=_0x1c21cb[_0x353e('0x1c')],_0x5c4825=_0x1c21cb[_0x353e('0x1c')]+_0x1c21cb['limit'],_0x5ac5df;if(_0x5c4825>=_0x51c05e){_0x5c4825=_0x51c05e;_0x5ac5df=0xc8;}else{_0x5ac5df=0xce;}_0x4ebe88['status'](_0x5ac5df);return _0x4ebe88[_0x353e('0x1d')](_0x353e('0x1e'),_0xf12589+'-'+_0x5c4825+'/'+_0x51c05e)[_0x353e('0x1a')](_0x268edb);}return null;};}function patchUpdates(_0x47f0f7){return function(_0x538f44){try{jsonpatch[_0x353e('0x1f')](_0x538f44,_0x47f0f7,!![]);}catch(_0x299b88){return BPromise['reject'](_0x299b88);}return _0x538f44[_0x353e('0x20')]();};}function saveUpdates(_0x31e4ad,_0x5a67e7){return function(_0x4be1dc){if(_0x4be1dc){return _0x4be1dc[_0x353e('0x21')](_0x31e4ad)[_0x353e('0x22')](function(_0x54e62f){return _0x54e62f;});}return null;};}function removeEntity(_0x54dcd3,_0x17a7fe){return function(_0x48189e){if(_0x48189e){return _0x48189e[_0x353e('0x23')]()['then'](function(){var _0x348dba=_0x48189e[_0x353e('0x24')]({'plain':!![]});var _0x1b3734=_0x353e('0x25');return db[_0x353e('0x26')]['destroy']({'where':{'type':_0x1b3734,'resourceId':_0x348dba['id']}})[_0x353e('0x22')](function(){return _0x48189e;});})[_0x353e('0x22')](function(){_0x54dcd3[_0x353e('0x18')](0xcc)[_0x353e('0x19')]();});}};}function handleEntityNotFound(_0x4a8c05,_0x7bd336){return function(_0x3e4cff){if(!_0x3e4cff){_0x4a8c05[_0x353e('0x17')](0x194);}return _0x3e4cff;};}function handleError(_0x25122b,_0x6bfc87){_0x6bfc87=_0x6bfc87||0x1f4;return function(_0x4ed9f1){logger[_0x353e('0x27')](_0x4ed9f1[_0x353e('0x28')]);if(_0x4ed9f1[_0x353e('0x29')]){delete _0x4ed9f1[_0x353e('0x29')];}_0x25122b['status'](_0x6bfc87)[_0x353e('0x2a')](_0x4ed9f1);};}exports[_0x353e('0x2b')]=function(_0x744eb7,_0x38f7e9){var _0x58bcdd={},_0x37dfc0={},_0x5392e1={'count':0x0,'rows':[]};var _0x15103c=_[_0x353e('0x2c')](db[_0x353e('0x2d')][_0x353e('0x2e')],function(_0x23efee){return{'name':_0x23efee[_0x353e('0x2f')],'type':_0x23efee[_0x353e('0x30')]['key']};});_0x37dfc0[_0x353e('0x31')]=_['map'](_0x15103c,_0x353e('0x29'));_0x37dfc0[_0x353e('0x32')]=_['keys'](_0x744eb7['query']);_0x37dfc0[_0x353e('0x33')]=_[_0x353e('0x34')](_0x37dfc0[_0x353e('0x31')],_0x37dfc0['query']);_0x58bcdd[_0x353e('0x35')]=_[_0x353e('0x34')](_0x37dfc0[_0x353e('0x31')],qs[_0x353e('0x36')](_0x744eb7[_0x353e('0x32')][_0x353e('0x36')]));_0x58bcdd['attributes']=_0x58bcdd[_0x353e('0x35')][_0x353e('0x37')]?_0x58bcdd['attributes']:_0x37dfc0[_0x353e('0x31')];if(!_0x744eb7[_0x353e('0x32')][_0x353e('0x38')](_0x353e('0x39'))){_0x58bcdd['limit']=qs['limit'](_0x744eb7[_0x353e('0x32')]['limit']);_0x58bcdd[_0x353e('0x1c')]=qs[_0x353e('0x1c')](_0x744eb7[_0x353e('0x32')][_0x353e('0x1c')]);}_0x58bcdd['order']=qs[_0x353e('0x3a')](_0x744eb7[_0x353e('0x32')][_0x353e('0x3a')]);_0x58bcdd[_0x353e('0x3b')]=qs[_0x353e('0x33')](_[_0x353e('0x3c')](_0x744eb7[_0x353e('0x32')],_0x37dfc0['filters']),_0x15103c);if(_0x744eb7['query'][_0x353e('0x3d')]){_0x58bcdd[_0x353e('0x3b')]=_[_0x353e('0x3e')](_0x58bcdd[_0x353e('0x3b')],{'$or':_[_0x353e('0x2c')](_0x15103c,function(_0x1adff1){if(_0x1adff1[_0x353e('0x30')]!==_0x353e('0x3f')){var _0x50e0ca={};_0x50e0ca[_0x1adff1[_0x353e('0x29')]]={'$like':'%'+_0x744eb7[_0x353e('0x32')]['filter']+'%'};return _0x50e0ca;}})});}_0x58bcdd=_[_0x353e('0x3e')]({},_0x58bcdd,_0x744eb7[_0x353e('0x40')]);var _0x2fca0a={'where':_0x58bcdd[_0x353e('0x3b')]};return db[_0x353e('0x2d')][_0x353e('0x1b')](_0x2fca0a)[_0x353e('0x22')](function(_0xab0009){_0x5392e1['count']=_0xab0009;if(_0x744eb7[_0x353e('0x32')][_0x353e('0x41')]){_0x58bcdd['include']=[{'all':!![]}];}return db[_0x353e('0x2d')][_0x353e('0x42')](_0x58bcdd);})['then'](function(_0x21649a){_0x5392e1[_0x353e('0x43')]=_0x21649a;return _0x5392e1;})[_0x353e('0x22')](respondWithFilteredResult(_0x38f7e9,_0x58bcdd))[_0x353e('0x44')](handleError(_0x38f7e9,null));};exports[_0x353e('0x45')]=function(_0x29efe2,_0x19c7f3){var _0x3f53d1={'raw':!![],'where':{'id':_0x29efe2[_0x353e('0x46')]['id']}},_0x4f6193={};_0x4f6193[_0x353e('0x31')]=_['keys'](db[_0x353e('0x2d')][_0x353e('0x2e')]);_0x4f6193[_0x353e('0x32')]=_[_0x353e('0x47')](_0x29efe2[_0x353e('0x32')]);_0x4f6193[_0x353e('0x33')]=_['intersection'](_0x4f6193['model'],_0x4f6193['query']);_0x3f53d1['attributes']=_[_0x353e('0x34')](_0x4f6193[_0x353e('0x31')],qs['fields'](_0x29efe2[_0x353e('0x32')][_0x353e('0x36')]));_0x3f53d1[_0x353e('0x35')]=_0x3f53d1['attributes'][_0x353e('0x37')]?_0x3f53d1[_0x353e('0x35')]:_0x4f6193['model'];if(_0x29efe2[_0x353e('0x32')][_0x353e('0x41')]){_0x3f53d1['include']=[{'all':!![]}];}_0x3f53d1=_['merge']({},_0x3f53d1,_0x29efe2[_0x353e('0x40')]);return db['Sound'][_0x353e('0x48')](_0x3f53d1)['then'](handleEntityNotFound(_0x19c7f3,null))[_0x353e('0x22')](respondWithResult(_0x19c7f3,null))['catch'](handleError(_0x19c7f3,null));};exports[_0x353e('0x49')]=function(_0x42e15b,_0x20ffd3,_0x580ca9){return db['Sound']['find']({'where':{'id':_0x42e15b[_0x353e('0x46')]['id']},'attributes':['name',_0x353e('0x4a'),'converted_format'],'raw':!![]})[_0x353e('0x22')](handleEntityNotFound(_0x20ffd3,null))['then'](function(_0x9e0dd0){if(_0x9e0dd0){if(!fs[_0x353e('0x4b')](path[_0x353e('0x4c')](config['root'],'server/files/sounds/converted',_0x9e0dd0[_0x353e('0x4a')]+'.'+_0x9e0dd0['converted_format']))){throw new db[(_0x353e('0x4d'))][(_0x353e('0x4e'))](_0x353e('0x4f'));}return _0x20ffd3[_0x353e('0x49')](path[_0x353e('0x4c')](config['root'],_0x353e('0x50'),util[_0x353e('0x51')]('%s.%s',_0x9e0dd0[_0x353e('0x4a')],_0x9e0dd0[_0x353e('0x52')])),util[_0x353e('0x51')]('%s.%s',_0x9e0dd0['name'],_0x9e0dd0[_0x353e('0x52')]));}return null;})['catch'](handleError(_0x20ffd3,null));};exports[_0x353e('0x53')]=function(_0x45417f,_0xd6d2d2,_0x42c27c){var _0x53dc3b={'name':path['basename'](_0x45417f[_0x353e('0x54')][_0x353e('0x55')],path['extname'](_0x45417f[_0x353e('0x54')][_0x353e('0x55')])),'save_name':path[_0x353e('0x56')](_0x45417f[_0x353e('0x54')][_0x353e('0x57')],path[_0x353e('0x58')](_0x45417f[_0x353e('0x54')][_0x353e('0x57')])),'original_format':path['extname'](_0x45417f[_0x353e('0x54')]['originalname'])['substring'](0x1),'converted_format':_0x353e('0x59')};var _0x5182d1=path['join'](config[_0x353e('0x5a')],_0x353e('0x5b'),_0x45417f[_0x353e('0x54')]['filename']);var _0x485294=path[_0x353e('0x4c')](config[_0x353e('0x5a')],_0x353e('0x50'),util['format']('%s.%s',path[_0x353e('0x56')](_0x45417f[_0x353e('0x54')][_0x353e('0x57')],path['extname'](_0x45417f[_0x353e('0x54')][_0x353e('0x57')])),_0x53dc3b[_0x353e('0x52')]));logger[_0x353e('0x5c')](_0x353e('0x5d'),_0x5182d1);logger[_0x353e('0x5c')](_0x353e('0x5e'),_0x485294);try{fs[_0x353e('0x5f')](_0x5182d1,parseInt(_0x353e('0x60'),0x8));var _0x442d31=sox[_0x353e('0x61')](_0x5182d1,_0x485294,{'sampleRate':0x1f40,'format':_0x353e('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x442d31['on'](_0x353e('0x27'),function(_0x3df3be){fs[_0x353e('0x62')](_0x5182d1);_0xd6d2d2[_0x353e('0x18')](0x1f4)[_0x353e('0x2a')](_0x3df3be);});_0x442d31['on'](_0x353e('0x63'),function(_0xb68970){_0x53dc3b['original_duration']=isNaN(_0xb68970[_0x353e('0x64')])?null:_0xb68970['duration']*0x3e8;_0x53dc3b[_0x353e('0x65')]=isNaN(_0xb68970[_0x353e('0x66')])?null:_0xb68970[_0x353e('0x66')];_0x53dc3b[_0x353e('0x67')]=isNaN(_0xb68970[_0x353e('0x68')])?null:_0xb68970[_0x353e('0x68')];_0x53dc3b[_0x353e('0x69')]=isNaN(_0xb68970['bitRate'])?null:_0xb68970[_0x353e('0x6a')];_0x53dc3b['original_sampleRate']=isNaN(_0xb68970[_0x353e('0x6b')])?null:_0xb68970['sampleRate'];});_0x442d31['on'](_0x353e('0x6c'),function(_0x410832){_0x53dc3b[_0x353e('0x6d')]=isNaN(_0x410832[_0x353e('0x64')])?null:_0x410832['duration']*0x3e8;_0x53dc3b['converted_sampleCount']=isNaN(_0x410832['sampleCount'])?null:_0x410832[_0x353e('0x66')];_0x53dc3b[_0x353e('0x6e')]=isNaN(_0x410832[_0x353e('0x68')])?null:_0x410832[_0x353e('0x68')];_0x53dc3b['converted_bitRate']=isNaN(_0x410832[_0x353e('0x6a')])?null:_0x410832[_0x353e('0x6a')];_0x53dc3b[_0x353e('0x6f')]=isNaN(_0x410832[_0x353e('0x6b')])?null:_0x410832[_0x353e('0x6b')];});_0x442d31['on'](_0x353e('0x19'),function(){fs[_0x353e('0x5f')](_0x485294,parseInt(_0x353e('0x60'),0x8));return db['Sound'][_0x353e('0x53')](_0x53dc3b)[_0x353e('0x22')](function(_0x5d83d5){var _0x49a046={'role':_0x45417f[_0x353e('0x70')]['role'],'userProfileId':_0x45417f[_0x353e('0x70')]['userProfileId']};if(!_0x49a046)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49a046[_0x353e('0x71')]===_0x353e('0x72')){var _0x1d8f12=_0x5d83d5[_0x353e('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x353e('0x48')]({'where':{'name':'Sounds','userProfileId':_0x49a046[_0x353e('0x73')]},'raw':!![]})['then'](function(_0x24934f){if(_0x24934f&&_0x24934f[_0x353e('0x74')]===0x0){return db[_0x353e('0x26')]['create']({'name':_0x1d8f12[_0x353e('0x29')],'resourceId':_0x1d8f12['id'],'type':_0x24934f[_0x353e('0x29')],'sectionId':_0x24934f['id']},{})[_0x353e('0x22')](function(){return _0x5d83d5;});}else{return _0x5d83d5;}})[_0x353e('0x44')](function(_0x22310a){logger['error'](_0x353e('0x75'),_0x22310a);throw _0x22310a;});}return _0x5d83d5;})[_0x353e('0x22')](respondWithResult(_0xd6d2d2,null))[_0x353e('0x44')](handleError(_0xd6d2d2,null));});_0x442d31[_0x353e('0x76')]();}catch(_0x450201){_0xd6d2d2[_0x353e('0x18')](0x1f4)[_0x353e('0x2a')](_0x450201);}};exports[_0x353e('0x21')]=function(_0x254042,_0xacb72a,_0x1675e7){return db[_0x353e('0x2d')][_0x353e('0x48')]({'where':{'id':_0x254042[_0x353e('0x46')]['id']}})['then'](handleEntityNotFound(_0xacb72a,null))[_0x353e('0x22')](saveUpdates(_[_0x353e('0x3c')](_0x254042[_0x353e('0x70')],['name','description']),null))[_0x353e('0x22')](respondWithResult(_0xacb72a,null))[_0x353e('0x44')](handleError(_0xacb72a,null));};exports['delete']=function(_0x744993,_0x15c7a5,_0xcbb737){return db[_0x353e('0x2d')]['find']({'where':{'id':_0x744993['params']['id']}})[_0x353e('0x22')](function(_0x37283c){if(_0x37283c){return _0x37283c[_0x353e('0x23')]();}})[_0x353e('0x22')](function(_0x2af531){var _0x3e54fd=path[_0x353e('0x4c')](config[_0x353e('0x5a')],_0x353e('0x5b'),util[_0x353e('0x51')](_0x353e('0x77'),_0x2af531[_0x353e('0x4a')],_0x2af531[_0x353e('0x78')]));var _0xeab4e1=path[_0x353e('0x4c')](config[_0x353e('0x5a')],_0x353e('0x50'),util['format'](_0x353e('0x77'),_0x2af531[_0x353e('0x4a')],_0x2af531['converted_format']));fs[_0x353e('0x62')](_0x3e54fd);fs[_0x353e('0x62')](_0xeab4e1);return _0x2af531;})[_0x353e('0x22')](function(_0x36d0e4){if(_0x36d0e4){return _0x15c7a5[_0x353e('0x18')](0xcc)[_0x353e('0x19')]();}})[_0x353e('0x22')](handleEntityNotFound(_0x15c7a5,null))[_0x353e('0x44')](handleError(_0x15c7a5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a16730b..7d924c8 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 _0x9f7a=['tools_sounds','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','Sound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f7a,0x105));var _0xa9f7=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x9f7a[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xa9f7('0x0'));var util=require('util');var logger=require(_0xa9f7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa9f7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9f7('0x3'));var rimraf=require(_0xa9f7('0x4'));var config=require(_0xa9f7('0x5'));var attributes=require('./sound.attributes');module[_0xa9f7('0x6')]=function(_0x4ff8f3,_0x1f8946){return _0x4ff8f3[_0xa9f7('0x7')](_0xa9f7('0x8'),attributes,{'tableName':_0xa9f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8cd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x59ab7b,_0x4cfd23){var _0x1ee027=function(_0x53b229){while(--_0x53b229){_0x59ab7b['push'](_0x59ab7b['shift']());}};_0x1ee027(++_0x4cfd23);}(_0xd8cd,0x15c));var _0xdd8c=function(_0x53f808,_0x33901b){_0x53f808=_0x53f808-0x0;var _0x23a15a=_0xd8cd[_0x53f808];return _0x23a15a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdd8c('0x0'));var moment=require(_0xdd8c('0x1'));var BPromise=require(_0xdd8c('0x2'));var rp=require(_0xdd8c('0x3'));var fs=require('fs');var path=require(_0xdd8c('0x4'));var rimraf=require(_0xdd8c('0x5'));var config=require(_0xdd8c('0x6'));var attributes=require(_0xdd8c('0x7'));module[_0xdd8c('0x8')]=function(_0x208afc,_0x5b6353){return _0x208afc[_0xdd8c('0x9')](_0xdd8c('0xa'),attributes,{'tableName':_0xdd8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index aeaa5bb..cf1851d 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 _0xf878=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSound','Sound','find','options','where','include','map','model','attributes','stringify','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s'];(function(_0x44184a,_0x571ae2){var _0xd0031e=function(_0x599443){while(--_0x599443){_0x44184a['push'](_0x44184a['shift']());}};_0xd0031e(++_0x571ae2);}(_0xf878,0x13e));var _0x8f87=function(_0x3bce4c,_0x30ab0c){_0x3bce4c=_0x3bce4c-0x0;var _0x2cfc90=_0xf878[_0x3bce4c];return _0x2cfc90;};'use strict';var _=require('lodash');var util=require(_0x8f87('0x0'));var moment=require(_0x8f87('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f87('0x2'));var db=require(_0x8f87('0x3'))['db'];var utils=require(_0x8f87('0x4'));var logger=require('../../config/logger')(_0x8f87('0x5'));var config=require('../../config/environment');var jayson=require(_0x8f87('0x6'));var client=jayson[_0x8f87('0x7')][_0x8f87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11d8e8,_0x3e2161,_0x469d98){return new BPromise(function(_0x18982a,_0x5a376c){return client[_0x8f87('0x9')](_0x11d8e8,_0x469d98)[_0x8f87('0xa')](function(_0xcdad55){logger['info'](_0x8f87('0xb'),_0x3e2161,_0x8f87('0xc'));logger[_0x8f87('0xd')](_0x8f87('0xe'),_0x3e2161,'request\x20sent',JSON['stringify'](_0xcdad55));if(_0xcdad55[_0x8f87('0xf')]){if(_0xcdad55[_0x8f87('0xf')][_0x8f87('0x10')]===0x1f4){logger[_0x8f87('0xf')](_0x8f87('0xb'),_0x3e2161,_0xcdad55[_0x8f87('0xf')][_0x8f87('0x11')]);return _0x5a376c(_0xcdad55[_0x8f87('0xf')]['message']);}logger[_0x8f87('0xf')](_0x8f87('0xb'),_0x3e2161,_0xcdad55[_0x8f87('0xf')][_0x8f87('0x11')]);return _0x18982a(_0xcdad55['error'][_0x8f87('0x11')]);}else{logger[_0x8f87('0x12')](_0x8f87('0xb'),_0x3e2161,_0x8f87('0xc'));_0x18982a(_0xcdad55['result'][_0x8f87('0x11')]);}})[_0x8f87('0x13')](function(_0x582859){logger[_0x8f87('0xf')](_0x8f87('0xb'),_0x3e2161,_0x582859);_0x5a376c(_0x582859);});});}exports[_0x8f87('0x14')]=function(_0x110ef0){var _0x11f51e=this;return new Promise(function(_0x5de0d6,_0xf993aa){return db[_0x8f87('0x15')][_0x8f87('0x16')]({'raw':_0x110ef0['options']?_0x110ef0[_0x8f87('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x110ef0[_0x8f87('0x17')]?_0x110ef0['options'][_0x8f87('0x18')]||null:null,'attributes':_0x110ef0[_0x8f87('0x17')]?_0x110ef0[_0x8f87('0x17')]['attributes']||null:null,'include':_0x110ef0[_0x8f87('0x17')]?_0x110ef0[_0x8f87('0x17')][_0x8f87('0x19')]?_[_0x8f87('0x1a')](_0x110ef0[_0x8f87('0x17')]['include'],function(_0x1803d9){return{'model':db[_0x1803d9[_0x8f87('0x1b')]],'as':_0x1803d9['as'],'attributes':_0x1803d9[_0x8f87('0x1c')],'include':_0x1803d9[_0x8f87('0x19')]?_[_0x8f87('0x1a')](_0x1803d9[_0x8f87('0x19')],function(_0x314689){return{'model':db[_0x314689['model']],'as':_0x314689['as'],'attributes':_0x314689['attributes'],'include':_0x314689[_0x8f87('0x19')]?_[_0x8f87('0x1a')](_0x314689[_0x8f87('0x19')],function(_0x40dd51){return{'model':db[_0x40dd51['model']],'as':_0x40dd51['as'],'attributes':_0x40dd51[_0x8f87('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1e42){logger[_0x8f87('0x12')]('ShowSound',_0x110ef0);logger[_0x8f87('0xd')]('ShowSound',_0x110ef0,JSON[_0x8f87('0x1d')](_0x4b1e42));_0x5de0d6(_0x4b1e42);})[_0x8f87('0x13')](function(_0x18f9cb){logger[_0x8f87('0xf')](_0x8f87('0x14'),_0x18f9cb[_0x8f87('0x11')],_0x110ef0);_0xf993aa(_0x11f51e[_0x8f87('0xf')](0x1f4,_0x18f9cb[_0x8f87('0x11')]));});});}; \ No newline at end of file +var _0x6221=['Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','debug','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x107d84,_0x4d826b){var _0x128546=function(_0x5a26d5){while(--_0x5a26d5){_0x107d84['push'](_0x107d84['shift']());}};_0x128546(++_0x4d826b);}(_0x6221,0x1f2));var _0x1622=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x6221[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1622('0x0'));var BPromise=require(_0x1622('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1622('0x2'));var db=require(_0x1622('0x3'))['db'];var utils=require(_0x1622('0x4'));var logger=require('../../config/logger')(_0x1622('0x5'));var config=require(_0x1622('0x6'));var jayson=require(_0x1622('0x7'));var client=jayson['client'][_0x1622('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44495d,_0x402e98,_0x3ff5a5){return new BPromise(function(_0x3441fa,_0x2a20d8){return client[_0x1622('0x9')](_0x44495d,_0x3ff5a5)[_0x1622('0xa')](function(_0x25154a){logger[_0x1622('0xb')](_0x1622('0xc'),_0x402e98,_0x1622('0xd'));logger['debug'](_0x1622('0xe'),_0x402e98,_0x1622('0xd'),JSON['stringify'](_0x25154a));if(_0x25154a[_0x1622('0xf')]){if(_0x25154a[_0x1622('0xf')][_0x1622('0x10')]===0x1f4){logger[_0x1622('0xf')](_0x1622('0xc'),_0x402e98,_0x25154a['error'][_0x1622('0x11')]);return _0x2a20d8(_0x25154a[_0x1622('0xf')][_0x1622('0x11')]);}logger['error'](_0x1622('0xc'),_0x402e98,_0x25154a[_0x1622('0xf')][_0x1622('0x11')]);return _0x3441fa(_0x25154a[_0x1622('0xf')][_0x1622('0x11')]);}else{logger['info'](_0x1622('0xc'),_0x402e98,_0x1622('0xd'));_0x3441fa(_0x25154a['result'][_0x1622('0x11')]);}})['catch'](function(_0x12b2af){logger[_0x1622('0xf')](_0x1622('0xc'),_0x402e98,_0x12b2af);_0x2a20d8(_0x12b2af);});});}exports[_0x1622('0x12')]=function(_0xe971db){var _0x2059fe=this;return new Promise(function(_0x7325af,_0xddfa4c){return db[_0x1622('0x13')][_0x1622('0x14')]({'raw':_0xe971db[_0x1622('0x15')]?_0xe971db[_0x1622('0x15')][_0x1622('0x16')]===undefined?!![]:![]:!![],'where':_0xe971db[_0x1622('0x15')]?_0xe971db['options'][_0x1622('0x17')]||null:null,'attributes':_0xe971db['options']?_0xe971db['options'][_0x1622('0x18')]||null:null,'include':_0xe971db[_0x1622('0x15')]?_0xe971db[_0x1622('0x15')][_0x1622('0x19')]?_['map'](_0xe971db[_0x1622('0x15')]['include'],function(_0x241a78){return{'model':db[_0x241a78[_0x1622('0x1a')]],'as':_0x241a78['as'],'attributes':_0x241a78[_0x1622('0x18')],'include':_0x241a78[_0x1622('0x19')]?_['map'](_0x241a78[_0x1622('0x19')],function(_0x44063b){return{'model':db[_0x44063b[_0x1622('0x1a')]],'as':_0x44063b['as'],'attributes':_0x44063b['attributes'],'include':_0x44063b[_0x1622('0x19')]?_[_0x1622('0x1b')](_0x44063b['include'],function(_0x5b5321){return{'model':db[_0x5b5321[_0x1622('0x1a')]],'as':_0x5b5321['as'],'attributes':_0x5b5321['attributes']};}):[]};}):[]};}):[]:[]})[_0x1622('0xa')](function(_0x1b9ed0){logger[_0x1622('0xb')]('ShowSound',_0xe971db);logger[_0x1622('0x1c')]('ShowSound',_0xe971db,JSON['stringify'](_0x1b9ed0));_0x7325af(_0x1b9ed0);})[_0x1622('0x1d')](function(_0x251125){logger[_0x1622('0xf')](_0x1622('0x12'),_0x251125['message'],_0xe971db);_0xddfa4c(_0x2059fe[_0x1622('0xf')](0x1f4,_0x251125[_0x1622('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 54b57f8..a30c186 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 _0x36d9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util'];(function(_0x5bd616,_0x3eba4e){var _0x1012f4=function(_0x29e96b){while(--_0x29e96b){_0x5bd616['push'](_0x5bd616['shift']());}};_0x1012f4(++_0x3eba4e);}(_0x36d9,0x1b6));var _0x936d=function(_0x7239d0,_0x41268f){_0x7239d0=_0x7239d0-0x0;var _0x260b38=_0x36d9[_0x7239d0];return _0x260b38;};'use strict';var multer=require(_0x936d('0x0'));var util=require(_0x936d('0x1'));var path=require(_0x936d('0x2'));var timeout=require(_0x936d('0x3'));var express=require(_0x936d('0x4'));var router=express[_0x936d('0x5')]();var auth=require(_0x936d('0x6'));var interaction=require(_0x936d('0x7'));var config=require(_0x936d('0x8'));var controller=require(_0x936d('0x9'));router[_0x936d('0xa')]('/',auth[_0x936d('0xb')](),controller[_0x936d('0xc')]);router['get'](_0x936d('0xd'),auth[_0x936d('0xb')](),controller[_0x936d('0xe')]);router[_0x936d('0xf')]('/',auth[_0x936d('0xb')](),controller['create']);router[_0x936d('0x10')]('/:id',auth[_0x936d('0xb')](),controller[_0x936d('0x11')]);router[_0x936d('0x12')]('/:id',auth[_0x936d('0xb')](),controller['destroy']);module[_0x936d('0x13')]=router; \ No newline at end of file +var _0x82d6=['index','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareMessage.controller','get'];(function(_0x4c87bf,_0x50eaa2){var _0x59f320=function(_0x53a5dd){while(--_0x53a5dd){_0x4c87bf['push'](_0x4c87bf['shift']());}};_0x59f320(++_0x50eaa2);}(_0x82d6,0xb4));var _0x682d=function(_0x4cb462,_0x2210cf){_0x4cb462=_0x4cb462-0x0;var _0x3e6296=_0x82d6[_0x4cb462];return _0x3e6296;};'use strict';var multer=require(_0x682d('0x0'));var util=require(_0x682d('0x1'));var path=require(_0x682d('0x2'));var timeout=require(_0x682d('0x3'));var express=require(_0x682d('0x4'));var router=express[_0x682d('0x5')]();var auth=require(_0x682d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x682d('0x7'));var controller=require(_0x682d('0x8'));router[_0x682d('0x9')]('/',auth['isAuthenticated'](),controller[_0x682d('0xa')]);router['get'](_0x682d('0xb'),auth[_0x682d('0xc')](),controller[_0x682d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x682d('0xe')]);router[_0x682d('0xf')](_0x682d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x682d('0x10')]('/:id',auth[_0x682d('0xc')](),controller[_0x682d('0x11')]);module[_0x682d('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index c54c469..b3fc86f 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 _0xfa3f=['TEXT','ENUM','out','STRING'];(function(_0x39d548,_0x5dcb27){var _0x1c623d=function(_0x13689a){while(--_0x13689a){_0x39d548['push'](_0x39d548['shift']());}};_0x1c623d(++_0x5dcb27);}(_0xfa3f,0x1a7));var _0xffa3=function(_0x59356e,_0x500356){_0x59356e=_0x59356e-0x0;var _0x230601=_0xfa3f[_0x59356e];return _0x230601;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xffa3('0x0')]},'body':{'type':Sequelize[_0xffa3('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xffa3('0x2')]('in',_0xffa3('0x3')),'defaultValue':_0xffa3('0x3'),'allowNull':![]}}; \ No newline at end of file +var _0xc37e=['exports','TEXT','medium','ENUM','out'];(function(_0xe6b369,_0x33a05a){var _0x566653=function(_0xcf0a8b){while(--_0xcf0a8b){_0xe6b369['push'](_0xe6b369['shift']());}};_0x566653(++_0x33a05a);}(_0xc37e,0xbe));var _0xec37=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc37e[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0xec37('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xec37('0x1')](_0xec37('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xec37('0x3')]('in',_0xec37('0x4')),'defaultValue':_0xec37('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 843fbc5..c380590 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 _0x7752=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','SquareMessage','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2c9215,_0x58ff65){var _0x46dc79=function(_0x5b24e3){while(--_0x5b24e3){_0x2c9215['push'](_0x2c9215['shift']());}};_0x46dc79(++_0x58ff65);}(_0x7752,0x174));var _0x2775=function(_0x2fb4b2,_0x55fd94){_0x2fb4b2=_0x2fb4b2-0x0;var _0x25d88f=_0x7752[_0x2fb4b2];return _0x25d88f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2775('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2775('0x2'));var moment=require(_0x2775('0x3'));var BPromise=require(_0x2775('0x4'));var Mustache=require(_0x2775('0x5'));var util=require('util');var path=require(_0x2775('0x6'));var sox=require(_0x2775('0x7'));var csv=require(_0x2775('0x8'));var ejs=require(_0x2775('0x9'));var fs=require('fs');var _=require(_0x2775('0xa'));var squel=require(_0x2775('0xb'));var crypto=require(_0x2775('0xc'));var jsforce=require(_0x2775('0xd'));var deskjs=require(_0x2775('0xe'));var toCsv=require(_0x2775('0x8'));var querystring=require(_0x2775('0xf'));var Papa=require(_0x2775('0x10'));var Redis=require(_0x2775('0x11'));var authService=require(_0x2775('0x12'));var qs=require(_0x2775('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2775('0x14'));var logger=require(_0x2775('0x15'))('api');var utils=require(_0x2775('0x16'));var config=require(_0x2775('0x17'));var db=require(_0x2775('0x18'))['db'];function respondWithStatusCode(_0x3dcc5f,_0x391fc9){_0x391fc9=_0x391fc9||0xcc;return function(_0x245d93){if(_0x245d93){return _0x3dcc5f['sendStatus'](_0x391fc9);}return _0x3dcc5f[_0x2775('0x19')](_0x391fc9)[_0x2775('0x1a')]();};}function respondWithResult(_0x464ccd,_0x428c77){_0x428c77=_0x428c77||0xc8;return function(_0x410984){if(_0x410984){return _0x464ccd[_0x2775('0x19')](_0x428c77)[_0x2775('0x1b')](_0x410984);}};}function respondWithFilteredResult(_0x5dd075,_0x169f3f){return function(_0x49bf4e){if(_0x49bf4e){var _0x5e8331=_0x49bf4e[_0x2775('0x1c')],_0x859861=_0x169f3f[_0x2775('0x1d')],_0x3c2ff9=_0x169f3f[_0x2775('0x1d')]+_0x169f3f[_0x2775('0x1e')],_0x69ce85;if(_0x3c2ff9>=_0x5e8331){_0x3c2ff9=_0x5e8331;_0x69ce85=0xc8;}else{_0x69ce85=0xce;}_0x5dd075[_0x2775('0x19')](_0x69ce85);return _0x5dd075[_0x2775('0x1f')](_0x2775('0x20'),_0x859861+'-'+_0x3c2ff9+'/'+_0x5e8331)[_0x2775('0x1b')](_0x49bf4e);}return null;};}function patchUpdates(_0xc3d84c){return function(_0x5c32e5){try{jsonpatch[_0x2775('0x21')](_0x5c32e5,_0xc3d84c,!![]);}catch(_0x3ff18c){return BPromise[_0x2775('0x22')](_0x3ff18c);}return _0x5c32e5[_0x2775('0x23')]();};}function saveUpdates(_0x56238b,_0x390b2e){return function(_0x399399){if(_0x399399){return _0x399399[_0x2775('0x24')](_0x56238b)[_0x2775('0x25')](function(_0x2fdc14){return _0x2fdc14;});}return null;};}function removeEntity(_0x47794a,_0x517ec2){return function(_0x457773){if(_0x457773){return _0x457773[_0x2775('0x26')]()[_0x2775('0x25')](function(){_0x47794a[_0x2775('0x19')](0xcc)[_0x2775('0x1a')]();});}};}function handleEntityNotFound(_0x3dc62d,_0x4546e4){return function(_0x4a4ea5){if(!_0x4a4ea5){_0x3dc62d[_0x2775('0x27')](0x194);}return _0x4a4ea5;};}function handleError(_0x3b9b0b,_0x826ff){_0x826ff=_0x826ff||0x1f4;return function(_0x42e988){logger[_0x2775('0x28')](_0x42e988[_0x2775('0x29')]);if(_0x42e988[_0x2775('0x2a')]){delete _0x42e988['name'];}_0x3b9b0b[_0x2775('0x19')](_0x826ff)[_0x2775('0x2b')](_0x42e988);};}exports[_0x2775('0x2c')]=function(_0xd93851,_0x201d05){var _0x412926={},_0x35d2ca={},_0x546ee0={'count':0x0,'rows':[]};var _0xc47272=_[_0x2775('0x2d')](db['SquareMessage'][_0x2775('0x2e')],function(_0x4ead8a){return{'name':_0x4ead8a[_0x2775('0x2f')],'type':_0x4ead8a[_0x2775('0x30')]['key']};});_0x35d2ca['model']=_[_0x2775('0x2d')](_0xc47272,_0x2775('0x2a'));_0x35d2ca[_0x2775('0x31')]=_['keys'](_0xd93851['query']);_0x35d2ca[_0x2775('0x32')]=_['intersection'](_0x35d2ca[_0x2775('0x33')],_0x35d2ca[_0x2775('0x31')]);_0x412926[_0x2775('0x34')]=_[_0x2775('0x35')](_0x35d2ca[_0x2775('0x33')],qs[_0x2775('0x36')](_0xd93851[_0x2775('0x31')][_0x2775('0x36')]));_0x412926[_0x2775('0x34')]=_0x412926['attributes'][_0x2775('0x37')]?_0x412926[_0x2775('0x34')]:_0x35d2ca['model'];if(!_0xd93851['query'][_0x2775('0x38')](_0x2775('0x39'))){_0x412926[_0x2775('0x1e')]=qs[_0x2775('0x1e')](_0xd93851['query']['limit']);_0x412926['offset']=qs['offset'](_0xd93851[_0x2775('0x31')][_0x2775('0x1d')]);}_0x412926[_0x2775('0x3a')]=qs['sort'](_0xd93851[_0x2775('0x31')][_0x2775('0x3b')]);_0x412926[_0x2775('0x3c')]=qs[_0x2775('0x32')](_[_0x2775('0x3d')](_0xd93851[_0x2775('0x31')],_0x35d2ca['filters']),_0xc47272);if(_0xd93851[_0x2775('0x31')][_0x2775('0x3e')]){_0x412926[_0x2775('0x3c')]=_['merge'](_0x412926['where'],{'$or':_[_0x2775('0x2d')](_0xc47272,function(_0x46062f){if(_0x46062f[_0x2775('0x30')]!==_0x2775('0x3f')){var _0x3c371d={};_0x3c371d[_0x46062f['name']]={'$like':'%'+_0xd93851[_0x2775('0x31')][_0x2775('0x3e')]+'%'};return _0x3c371d;}})});}_0x412926=_[_0x2775('0x40')]({},_0x412926,_0xd93851['options']);var _0x1f3d81={'where':_0x412926[_0x2775('0x3c')]};return db['SquareMessage'][_0x2775('0x1c')](_0x1f3d81)['then'](function(_0x155c2b){_0x546ee0['count']=_0x155c2b;if(_0xd93851[_0x2775('0x31')]['includeAll']){_0x412926['include']=[{'all':!![]}];}return db[_0x2775('0x41')][_0x2775('0x42')](_0x412926);})[_0x2775('0x25')](function(_0x5b7079){_0x546ee0[_0x2775('0x43')]=_0x5b7079;return _0x546ee0;})[_0x2775('0x25')](respondWithFilteredResult(_0x201d05,_0x412926))[_0x2775('0x44')](handleError(_0x201d05,null));};exports[_0x2775('0x45')]=function(_0x5827b8,_0x4223ab){var _0x574fbc={'raw':!![],'where':{'id':_0x5827b8[_0x2775('0x46')]['id']}},_0x12ac5c={};_0x12ac5c[_0x2775('0x33')]=_[_0x2775('0x47')](db[_0x2775('0x41')][_0x2775('0x2e')]);_0x12ac5c[_0x2775('0x31')]=_[_0x2775('0x47')](_0x5827b8[_0x2775('0x31')]);_0x12ac5c[_0x2775('0x32')]=_[_0x2775('0x35')](_0x12ac5c[_0x2775('0x33')],_0x12ac5c['query']);_0x574fbc[_0x2775('0x34')]=_['intersection'](_0x12ac5c[_0x2775('0x33')],qs[_0x2775('0x36')](_0x5827b8[_0x2775('0x31')][_0x2775('0x36')]));_0x574fbc[_0x2775('0x34')]=_0x574fbc['attributes'][_0x2775('0x37')]?_0x574fbc[_0x2775('0x34')]:_0x12ac5c[_0x2775('0x33')];if(_0x5827b8[_0x2775('0x31')][_0x2775('0x48')]){_0x574fbc['include']=[{'all':!![]}];}_0x574fbc=_[_0x2775('0x40')]({},_0x574fbc,_0x5827b8[_0x2775('0x49')]);return db[_0x2775('0x41')][_0x2775('0x4a')](_0x574fbc)[_0x2775('0x25')](handleEntityNotFound(_0x4223ab,null))[_0x2775('0x25')](respondWithResult(_0x4223ab,null))['catch'](handleError(_0x4223ab,null));};exports['create']=function(_0x291a5c,_0x5ded6e){return db[_0x2775('0x41')][_0x2775('0x4b')](_0x291a5c[_0x2775('0x4c')],{})[_0x2775('0x25')](respondWithResult(_0x5ded6e,0xc9))[_0x2775('0x44')](handleError(_0x5ded6e,null));};exports['update']=function(_0x402bef,_0x2936bb){if(_0x402bef['body']['id']){delete _0x402bef[_0x2775('0x4c')]['id'];}return db[_0x2775('0x41')][_0x2775('0x4a')]({'where':{'id':_0x402bef[_0x2775('0x46')]['id']}})[_0x2775('0x25')](handleEntityNotFound(_0x2936bb,null))[_0x2775('0x25')](saveUpdates(_0x402bef[_0x2775('0x4c')],null))[_0x2775('0x25')](respondWithResult(_0x2936bb,null))['catch'](handleError(_0x2936bb,null));};exports['destroy']=function(_0x2da58c,_0x218557){return db[_0x2775('0x41')][_0x2775('0x4a')]({'where':{'id':_0x2da58c[_0x2775('0x46')]['id']}})[_0x2775('0x25')](handleEntityNotFound(_0x218557,null))[_0x2775('0x25')](removeEntity(_0x218557,null))[_0x2775('0x44')](handleError(_0x218557,null));}; \ No newline at end of file +var _0x0653=['type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','merge','where','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes'];(function(_0xf09798,_0x37ea4a){var _0x343b2=function(_0xad1523){while(--_0xad1523){_0xf09798['push'](_0xf09798['shift']());}};_0x343b2(++_0x37ea4a);}(_0x0653,0x12e));var _0x3065=function(_0x1f1b39,_0x327afc){_0x1f1b39=_0x1f1b39-0x0;var _0x186af7=_0x0653[_0x1f1b39];return _0x186af7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3065('0x0'));var rimraf=require(_0x3065('0x1'));var zipdir=require(_0x3065('0x2'));var jsonpatch=require(_0x3065('0x3'));var rp=require('request-promise');var moment=require(_0x3065('0x4'));var BPromise=require(_0x3065('0x5'));var Mustache=require(_0x3065('0x6'));var util=require('util');var path=require(_0x3065('0x7'));var sox=require(_0x3065('0x8'));var csv=require(_0x3065('0x9'));var ejs=require(_0x3065('0xa'));var fs=require('fs');var _=require(_0x3065('0xb'));var squel=require(_0x3065('0xc'));var crypto=require(_0x3065('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3065('0x9'));var querystring=require(_0x3065('0xe'));var Papa=require(_0x3065('0xf'));var Redis=require(_0x3065('0x10'));var authService=require(_0x3065('0x11'));var qs=require(_0x3065('0x12'));var as=require(_0x3065('0x13'));var hardwareService=require(_0x3065('0x14'));var logger=require(_0x3065('0x15'))('api');var utils=require(_0x3065('0x16'));var config=require(_0x3065('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x423e9c,_0x27d85b){_0x27d85b=_0x27d85b||0xcc;return function(_0x1f8c50){if(_0x1f8c50){return _0x423e9c['sendStatus'](_0x27d85b);}return _0x423e9c[_0x3065('0x18')](_0x27d85b)[_0x3065('0x19')]();};}function respondWithResult(_0x29e79d,_0x3a3adf){_0x3a3adf=_0x3a3adf||0xc8;return function(_0x5b9d3d){if(_0x5b9d3d){return _0x29e79d[_0x3065('0x18')](_0x3a3adf)[_0x3065('0x1a')](_0x5b9d3d);}};}function respondWithFilteredResult(_0x550746,_0x175d0d){return function(_0x436ddf){if(_0x436ddf){var _0x1d7d87=_0x436ddf['count'],_0x1c2d5d=_0x175d0d[_0x3065('0x1b')],_0x13f52b=_0x175d0d['offset']+_0x175d0d[_0x3065('0x1c')],_0x5cde41;if(_0x13f52b>=_0x1d7d87){_0x13f52b=_0x1d7d87;_0x5cde41=0xc8;}else{_0x5cde41=0xce;}_0x550746['status'](_0x5cde41);return _0x550746[_0x3065('0x1d')]('Content-Range',_0x1c2d5d+'-'+_0x13f52b+'/'+_0x1d7d87)[_0x3065('0x1a')](_0x436ddf);}return null;};}function patchUpdates(_0x4bcc55){return function(_0x12ec88){try{jsonpatch[_0x3065('0x1e')](_0x12ec88,_0x4bcc55,!![]);}catch(_0x462df4){return BPromise[_0x3065('0x1f')](_0x462df4);}return _0x12ec88['save']();};}function saveUpdates(_0x15efe1,_0x25491e){return function(_0x58f59c){if(_0x58f59c){return _0x58f59c['update'](_0x15efe1)['then'](function(_0x3b6020){return _0x3b6020;});}return null;};}function removeEntity(_0x3e830c,_0x40d667){return function(_0x133452){if(_0x133452){return _0x133452[_0x3065('0x20')]()[_0x3065('0x21')](function(){_0x3e830c[_0x3065('0x18')](0xcc)[_0x3065('0x19')]();});}};}function handleEntityNotFound(_0x44a7d8,_0x489f55){return function(_0x528604){if(!_0x528604){_0x44a7d8[_0x3065('0x22')](0x194);}return _0x528604;};}function handleError(_0x3cec4e,_0x34f6fc){_0x34f6fc=_0x34f6fc||0x1f4;return function(_0x41935a){logger[_0x3065('0x23')](_0x41935a[_0x3065('0x24')]);if(_0x41935a[_0x3065('0x25')]){delete _0x41935a['name'];}_0x3cec4e[_0x3065('0x18')](_0x34f6fc)[_0x3065('0x26')](_0x41935a);};}exports[_0x3065('0x27')]=function(_0x41bc1b,_0x679ec){var _0x42154f={},_0x2a6794={},_0x2d8225={'count':0x0,'rows':[]};var _0x323a85=_[_0x3065('0x28')](db[_0x3065('0x29')][_0x3065('0x2a')],function(_0x24e03a){return{'name':_0x24e03a['fieldName'],'type':_0x24e03a[_0x3065('0x2b')]['key']};});_0x2a6794[_0x3065('0x2c')]=_[_0x3065('0x28')](_0x323a85,_0x3065('0x25'));_0x2a6794[_0x3065('0x2d')]=_[_0x3065('0x2e')](_0x41bc1b[_0x3065('0x2d')]);_0x2a6794[_0x3065('0x2f')]=_[_0x3065('0x30')](_0x2a6794[_0x3065('0x2c')],_0x2a6794[_0x3065('0x2d')]);_0x42154f[_0x3065('0x31')]=_[_0x3065('0x30')](_0x2a6794[_0x3065('0x2c')],qs[_0x3065('0x32')](_0x41bc1b[_0x3065('0x2d')][_0x3065('0x32')]));_0x42154f[_0x3065('0x31')]=_0x42154f[_0x3065('0x31')]['length']?_0x42154f[_0x3065('0x31')]:_0x2a6794['model'];if(!_0x41bc1b[_0x3065('0x2d')]['hasOwnProperty'](_0x3065('0x33'))){_0x42154f['limit']=qs[_0x3065('0x1c')](_0x41bc1b[_0x3065('0x2d')]['limit']);_0x42154f[_0x3065('0x1b')]=qs[_0x3065('0x1b')](_0x41bc1b[_0x3065('0x2d')]['offset']);}_0x42154f['order']=qs[_0x3065('0x34')](_0x41bc1b['query'][_0x3065('0x34')]);_0x42154f['where']=qs[_0x3065('0x2f')](_[_0x3065('0x35')](_0x41bc1b['query'],_0x2a6794['filters']),_0x323a85);if(_0x41bc1b[_0x3065('0x2d')]['filter']){_0x42154f['where']=_[_0x3065('0x36')](_0x42154f[_0x3065('0x37')],{'$or':_[_0x3065('0x28')](_0x323a85,function(_0x1b13af){if(_0x1b13af[_0x3065('0x2b')]!=='VIRTUAL'){var _0x26e1d8={};_0x26e1d8[_0x1b13af[_0x3065('0x25')]]={'$like':'%'+_0x41bc1b[_0x3065('0x2d')]['filter']+'%'};return _0x26e1d8;}})});}_0x42154f=_[_0x3065('0x36')]({},_0x42154f,_0x41bc1b[_0x3065('0x38')]);var _0xb087da={'where':_0x42154f[_0x3065('0x37')]};return db[_0x3065('0x29')][_0x3065('0x39')](_0xb087da)[_0x3065('0x21')](function(_0x29e6b5){_0x2d8225[_0x3065('0x39')]=_0x29e6b5;if(_0x41bc1b['query']['includeAll']){_0x42154f[_0x3065('0x3a')]=[{'all':!![]}];}return db[_0x3065('0x29')][_0x3065('0x3b')](_0x42154f);})[_0x3065('0x21')](function(_0x550879){_0x2d8225[_0x3065('0x3c')]=_0x550879;return _0x2d8225;})[_0x3065('0x21')](respondWithFilteredResult(_0x679ec,_0x42154f))[_0x3065('0x3d')](handleError(_0x679ec,null));};exports[_0x3065('0x3e')]=function(_0x4d44ad,_0x1086ff){var _0x25e0d1={'raw':!![],'where':{'id':_0x4d44ad['params']['id']}},_0x9b5c9e={};_0x9b5c9e[_0x3065('0x2c')]=_[_0x3065('0x2e')](db[_0x3065('0x29')][_0x3065('0x2a')]);_0x9b5c9e[_0x3065('0x2d')]=_[_0x3065('0x2e')](_0x4d44ad[_0x3065('0x2d')]);_0x9b5c9e[_0x3065('0x2f')]=_[_0x3065('0x30')](_0x9b5c9e[_0x3065('0x2c')],_0x9b5c9e['query']);_0x25e0d1[_0x3065('0x31')]=_[_0x3065('0x30')](_0x9b5c9e[_0x3065('0x2c')],qs['fields'](_0x4d44ad['query'][_0x3065('0x32')]));_0x25e0d1[_0x3065('0x31')]=_0x25e0d1['attributes']['length']?_0x25e0d1[_0x3065('0x31')]:_0x9b5c9e[_0x3065('0x2c')];if(_0x4d44ad['query'][_0x3065('0x3f')]){_0x25e0d1[_0x3065('0x3a')]=[{'all':!![]}];}_0x25e0d1=_[_0x3065('0x36')]({},_0x25e0d1,_0x4d44ad[_0x3065('0x38')]);return db[_0x3065('0x29')][_0x3065('0x40')](_0x25e0d1)[_0x3065('0x21')](handleEntityNotFound(_0x1086ff,null))['then'](respondWithResult(_0x1086ff,null))['catch'](handleError(_0x1086ff,null));};exports['create']=function(_0x1cd5e5,_0x260866){return db[_0x3065('0x29')][_0x3065('0x41')](_0x1cd5e5[_0x3065('0x42')],{})[_0x3065('0x21')](respondWithResult(_0x260866,0xc9))[_0x3065('0x3d')](handleError(_0x260866,null));};exports[_0x3065('0x43')]=function(_0xa78c59,_0x203261){if(_0xa78c59[_0x3065('0x42')]['id']){delete _0xa78c59[_0x3065('0x42')]['id'];}return db[_0x3065('0x29')][_0x3065('0x40')]({'where':{'id':_0xa78c59[_0x3065('0x44')]['id']}})[_0x3065('0x21')](handleEntityNotFound(_0x203261,null))[_0x3065('0x21')](saveUpdates(_0xa78c59[_0x3065('0x42')],null))[_0x3065('0x21')](respondWithResult(_0x203261,null))[_0x3065('0x3d')](handleError(_0x203261,null));};exports[_0x3065('0x20')]=function(_0x3cb2ef,_0x47a2a5){return db[_0x3065('0x29')][_0x3065('0x40')]({'where':{'id':_0x3cb2ef[_0x3065('0x44')]['id']}})[_0x3065('0x21')](handleEntityNotFound(_0x47a2a5,null))['then'](removeEntity(_0x47a2a5,null))[_0x3065('0x3d')](handleError(_0x47a2a5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f315d26..0299a08 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','square_messages','lodash'];(function(_0x578ffa,_0x159dd6){var _0x49cea7=function(_0x2b0e1b){while(--_0x2b0e1b){_0x578ffa['push'](_0x578ffa['shift']());}};_0x49cea7(++_0x159dd6);}(_0xabce,0x103));var _0xeabc=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xabce[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('SquareMessage',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0x2675,0x75));var _0x5267=function(_0x49cf1a,_0x98f6ed){_0x49cf1a=_0x49cf1a-0x0;var _0x5ab8ba=_0x2675[_0x49cf1a];return _0x5ab8ba;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 2cdd3a8..253e2f5 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 _0x4279=['error','message','info','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x4279,0x8d));var _0x9427=function(_0xe079d3,_0x250371){_0xe079d3=_0xe079d3-0x0;var _0x191e18=_0x4279[_0xe079d3];return _0x191e18;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var moment=require(_0x9427('0x1'));var BPromise=require('bluebird');var rs=require(_0x9427('0x2'));var fs=require('fs');var Redis=require(_0x9427('0x3'));var db=require(_0x9427('0x4'))['db'];var utils=require(_0x9427('0x5'));var logger=require('../../config/logger')(_0x9427('0x6'));var config=require('../../config/environment');var jayson=require(_0x9427('0x7'));var client=jayson[_0x9427('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7fa417,_0x511208,_0x25ba0b){return new BPromise(function(_0x4d24f2,_0x322f34){return client['request'](_0x7fa417,_0x25ba0b)[_0x9427('0x9')](function(_0x4c729a){logger['info'](_0x9427('0xa'),_0x511208,_0x9427('0xb'));logger[_0x9427('0xc')](_0x9427('0xd'),_0x511208,_0x9427('0xb'),JSON[_0x9427('0xe')](_0x4c729a));if(_0x4c729a[_0x9427('0xf')]){if(_0x4c729a[_0x9427('0xf')]['code']===0x1f4){logger[_0x9427('0xf')](_0x9427('0xa'),_0x511208,_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);return _0x322f34(_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);}logger[_0x9427('0xf')](_0x9427('0xa'),_0x511208,_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);return _0x4d24f2(_0x4c729a[_0x9427('0xf')][_0x9427('0x10')]);}else{logger[_0x9427('0x11')]('SquareMessage,\x20%s,\x20%s',_0x511208,_0x9427('0xb'));_0x4d24f2(_0x4c729a[_0x9427('0x12')][_0x9427('0x10')]);}})['catch'](function(_0x542718){logger[_0x9427('0xf')]('SquareMessage,\x20%s,\x20%s',_0x511208,_0x542718);_0x322f34(_0x542718);});});}exports[_0x9427('0x13')]=function(_0x20de12){var _0x4aaea7=this;return new Promise(function(_0x5177e2,_0x296bd6){return db[_0x9427('0x14')][_0x9427('0x15')](_0x20de12[_0x9427('0x16')],{'raw':_0x20de12[_0x9427('0x17')]?_0x20de12[_0x9427('0x17')][_0x9427('0x18')]===undefined?!![]:![]:!![]})[_0x9427('0x9')](function(_0xa9da31){logger[_0x9427('0x11')](_0x9427('0x13'),_0x20de12);logger[_0x9427('0xc')](_0x9427('0x13'),_0x20de12,JSON[_0x9427('0xe')](_0xa9da31));_0x5177e2(_0xa9da31);})[_0x9427('0x19')](function(_0x3e8743){logger['error']('CreateSquareMessage',_0x3e8743[_0x9427('0x10')],_0x20de12);_0x296bd6(_0x4aaea7[_0x9427('0xf')](0x1f4,_0x3e8743[_0x9427('0x10')]));});});}; \ No newline at end of file +var _0xe2fe=['request\x20sent','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','stringify','error','message'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')](_0x502eb6[_0xee2f('0x15')],{'raw':_0x502eb6['options']?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x17')]===undefined?!![]:![]:!![]})[_0xee2f('0xa')](function(_0x21fdf4){logger[_0xee2f('0xb')]('CreateSquareMessage',_0x502eb6);logger['debug'](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0x21fdf4));_0x40b5bc(_0x21fdf4);})[_0xee2f('0x18')](function(_0x203b2f){logger[_0xee2f('0xe')](_0xee2f('0x12'),_0x203b2f[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7['error'](0x1f4,_0x203b2f[_0xee2f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3a4f6c0..677edb6 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 _0x168b=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','15s','test','post','create','put','/:id','delete'];(function(_0x59b12e,_0xbf0942){var _0xcb7ea9=function(_0x459af8){while(--_0x459af8){_0x59b12e['push'](_0x59b12e['shift']());}};_0xcb7ea9(++_0xbf0942);}(_0x168b,0x9b));var _0xb168=function(_0x4a92f9,_0x32b570){_0x4a92f9=_0x4a92f9-0x0;var _0x3c6448=_0x168b[_0x4a92f9];return _0x3c6448;};'use strict';var multer=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var path=require(_0xb168('0x2'));var timeout=require('connect-timeout');var express=require(_0xb168('0x3'));var router=express[_0xb168('0x4')]();var auth=require(_0xb168('0x5'));var interaction=require(_0xb168('0x6'));var config=require(_0xb168('0x7'));var controller=require(_0xb168('0x8'));router['get']('/',auth[_0xb168('0x9')](),controller[_0xb168('0xa')]);router[_0xb168('0xb')]('/:id',auth[_0xb168('0x9')](),controller[_0xb168('0xc')]);router[_0xb168('0xb')](_0xb168('0xd'),auth[_0xb168('0x9')](),timeout(_0xb168('0xe')),controller[_0xb168('0xf')]);router[_0xb168('0x10')]('/',auth[_0xb168('0x9')](),controller[_0xb168('0x11')]);router[_0xb168('0x12')](_0xb168('0x13'),auth[_0xb168('0x9')](),controller['update']);router[_0xb168('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb168('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf0cf=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0cf,0x1a4));var _0xff0c=function(_0x2024a8,_0x1f88bb){_0x2024a8=_0x2024a8-0x0;var _0x4bdf10=_0xf0cf[_0x2024a8];return _0x4bdf10;};'use strict';var multer=require(_0xff0c('0x0'));var util=require(_0xff0c('0x1'));var path=require(_0xff0c('0x2'));var timeout=require(_0xff0c('0x3'));var express=require(_0xff0c('0x4'));var router=express[_0xff0c('0x5')]();var auth=require(_0xff0c('0x6'));var interaction=require(_0xff0c('0x7'));var config=require(_0xff0c('0x8'));var controller=require(_0xff0c('0x9'));router[_0xff0c('0xa')]('/',auth[_0xff0c('0xb')](),controller[_0xff0c('0xc')]);router[_0xff0c('0xa')](_0xff0c('0xd'),auth[_0xff0c('0xb')](),controller['show']);router[_0xff0c('0xa')](_0xff0c('0xe'),auth[_0xff0c('0xb')](),timeout(_0xff0c('0xf')),controller[_0xff0c('0x10')]);router[_0xff0c('0x11')]('/',auth[_0xff0c('0xb')](),controller[_0xff0c('0x12')]);router['put'](_0xff0c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xff0c('0x13')](_0xff0c('0xd'),auth[_0xff0c('0xb')](),controller[_0xff0c('0x14')]);module[_0xff0c('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8c47dd2..0af42ad 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 _0xdd05=['name','STRING'];(function(_0x18d4dc,_0x4752e3){var _0x48dda1=function(_0x1af6b1){while(--_0x1af6b1){_0x18d4dc['push'](_0x18d4dc['shift']());}};_0x48dda1(++_0x4752e3);}(_0xdd05,0x7f));var _0x5dd0=function(_0x2e7c1b,_0x232f79){_0x2e7c1b=_0x2e7c1b-0x0;var _0x42f565=_0xdd05[_0x2e7c1b];return _0x42f565;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5dd0('0x0')],'unique':_0x5dd0('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5dd0('0x0')]},'description':{'type':Sequelize[_0x5dd0('0x0')]}}; \ No newline at end of file +var _0x5944=['exports'];(function(_0xce7128,_0x2620dd){var _0x355e8d=function(_0x43483d){while(--_0x43483d){_0xce7128['push'](_0xce7128['shift']());}};_0x355e8d(++_0x2620dd);}(_0x5944,0x108));var _0x4594=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5944[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x4594('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e4f127a..6d8f4cb 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 _0x1446=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','filter','options','includeAll','rows','catch','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','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/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','end','error','stack','send','index','SquareOdbc','rawAttributes','fieldName','key','model','map','name','query'];(function(_0x40e471,_0x26a1ec){var _0x3d9d46=function(_0x896da3){while(--_0x896da3){_0x40e471['push'](_0x40e471['shift']());}};_0x3d9d46(++_0x26a1ec);}(_0x1446,0x7b));var _0x6144=function(_0x2318ba,_0x2c2e20){_0x2318ba=_0x2318ba-0x0;var _0x173321=_0x1446[_0x2318ba];return _0x173321;};'use strict';var pdf=require(_0x6144('0x0'));var emlformat=require(_0x6144('0x1'));var rimraf=require(_0x6144('0x2'));var zipdir=require(_0x6144('0x3'));var jsonpatch=require(_0x6144('0x4'));var rp=require(_0x6144('0x5'));var moment=require('moment');var BPromise=require(_0x6144('0x6'));var Mustache=require(_0x6144('0x7'));var util=require(_0x6144('0x8'));var path=require(_0x6144('0x9'));var sox=require(_0x6144('0xa'));var csv=require(_0x6144('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6144('0xc'));var squel=require(_0x6144('0xd'));var crypto=require(_0x6144('0xe'));var jsforce=require(_0x6144('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6144('0xb'));var querystring=require(_0x6144('0x10'));var Papa=require(_0x6144('0x11'));var Redis=require(_0x6144('0x12'));var authService=require(_0x6144('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6144('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6144('0x15'));var db=require(_0x6144('0x16'))['db'];function respondWithStatusCode(_0x5276e6,_0x5f5279){_0x5f5279=_0x5f5279||0xcc;return function(_0x443e4d){if(_0x443e4d){return _0x5276e6[_0x6144('0x17')](_0x5f5279);}return _0x5276e6[_0x6144('0x18')](_0x5f5279)['end']();};}function respondWithResult(_0x3adeca,_0xe01f8e){_0xe01f8e=_0xe01f8e||0xc8;return function(_0x8793fe){if(_0x8793fe){return _0x3adeca[_0x6144('0x18')](_0xe01f8e)[_0x6144('0x19')](_0x8793fe);}};}function respondWithFilteredResult(_0x398514,_0x306c3b){return function(_0x27cb26){if(_0x27cb26){var _0x259c24=_0x27cb26[_0x6144('0x1a')],_0x1cf0ed=_0x306c3b[_0x6144('0x1b')],_0x12d63c=_0x306c3b[_0x6144('0x1b')]+_0x306c3b['limit'],_0x4e39a6;if(_0x12d63c>=_0x259c24){_0x12d63c=_0x259c24;_0x4e39a6=0xc8;}else{_0x4e39a6=0xce;}_0x398514['status'](_0x4e39a6);return _0x398514[_0x6144('0x1c')](_0x6144('0x1d'),_0x1cf0ed+'-'+_0x12d63c+'/'+_0x259c24)[_0x6144('0x19')](_0x27cb26);}return null;};}function patchUpdates(_0x447d94){return function(_0x499eff){try{jsonpatch[_0x6144('0x1e')](_0x499eff,_0x447d94,!![]);}catch(_0xf40436){return BPromise['reject'](_0xf40436);}return _0x499eff[_0x6144('0x1f')]();};}function saveUpdates(_0x4d0978,_0x170bad){return function(_0x54480c){if(_0x54480c){return _0x54480c[_0x6144('0x20')](_0x4d0978)[_0x6144('0x21')](function(_0x360569){return _0x360569;});}return null;};}function removeEntity(_0x31d306,_0x2ee621){return function(_0x177c91){if(_0x177c91){return _0x177c91[_0x6144('0x22')]()[_0x6144('0x21')](function(){var _0x4dad3d=_0x177c91['get']({'plain':!![]});var _0x1f04e1='ODBC';return db[_0x6144('0x23')][_0x6144('0x22')]({'where':{'type':_0x1f04e1,'resourceId':_0x4dad3d['id']}})[_0x6144('0x21')](function(){return _0x177c91;});})[_0x6144('0x21')](function(){_0x31d306[_0x6144('0x18')](0xcc)[_0x6144('0x24')]();});}};}function handleEntityNotFound(_0x478cc8,_0x33d285){return function(_0x21c36c){if(!_0x21c36c){_0x478cc8['sendStatus'](0x194);}return _0x21c36c;};}function handleError(_0x398b87,_0x3a1167){_0x3a1167=_0x3a1167||0x1f4;return function(_0x113d6b){logger[_0x6144('0x25')](_0x113d6b[_0x6144('0x26')]);if(_0x113d6b['name']){delete _0x113d6b['name'];}_0x398b87[_0x6144('0x18')](_0x3a1167)[_0x6144('0x27')](_0x113d6b);};}exports[_0x6144('0x28')]=function(_0x341420,_0x3ab5ce){var _0x2e5691={},_0x17aedb={},_0x19abab={'count':0x0,'rows':[]};var _0x9a9bc3=_['map'](db[_0x6144('0x29')][_0x6144('0x2a')],function(_0x47d238){return{'name':_0x47d238[_0x6144('0x2b')],'type':_0x47d238['type'][_0x6144('0x2c')]};});_0x17aedb[_0x6144('0x2d')]=_[_0x6144('0x2e')](_0x9a9bc3,_0x6144('0x2f'));_0x17aedb[_0x6144('0x30')]=_[_0x6144('0x31')](_0x341420[_0x6144('0x30')]);_0x17aedb[_0x6144('0x32')]=_['intersection'](_0x17aedb[_0x6144('0x2d')],_0x17aedb[_0x6144('0x30')]);_0x2e5691[_0x6144('0x33')]=_[_0x6144('0x34')](_0x17aedb[_0x6144('0x2d')],qs[_0x6144('0x35')](_0x341420[_0x6144('0x30')]['fields']));_0x2e5691[_0x6144('0x33')]=_0x2e5691[_0x6144('0x33')][_0x6144('0x36')]?_0x2e5691[_0x6144('0x33')]:_0x17aedb[_0x6144('0x2d')];if(!_0x341420['query'][_0x6144('0x37')](_0x6144('0x38'))){_0x2e5691[_0x6144('0x39')]=qs[_0x6144('0x39')](_0x341420[_0x6144('0x30')][_0x6144('0x39')]);_0x2e5691[_0x6144('0x1b')]=qs[_0x6144('0x1b')](_0x341420[_0x6144('0x30')]['offset']);}_0x2e5691[_0x6144('0x3a')]=qs[_0x6144('0x3b')](_0x341420[_0x6144('0x30')][_0x6144('0x3b')]);_0x2e5691[_0x6144('0x3c')]=qs['filters'](_[_0x6144('0x3d')](_0x341420[_0x6144('0x30')],_0x17aedb['filters']),_0x9a9bc3);if(_0x341420['query']['filter']){_0x2e5691[_0x6144('0x3c')]=_[_0x6144('0x3e')](_0x2e5691[_0x6144('0x3c')],{'$or':_[_0x6144('0x2e')](_0x9a9bc3,function(_0x551a0f){if(_0x551a0f[_0x6144('0x3f')]!=='VIRTUAL'){var _0x34558c={};_0x34558c[_0x551a0f[_0x6144('0x2f')]]={'$like':'%'+_0x341420[_0x6144('0x30')][_0x6144('0x40')]+'%'};return _0x34558c;}})});}_0x2e5691=_[_0x6144('0x3e')]({},_0x2e5691,_0x341420[_0x6144('0x41')]);var _0x263ffc={'where':_0x2e5691['where']};return db['SquareOdbc'][_0x6144('0x1a')](_0x263ffc)[_0x6144('0x21')](function(_0x1acaa7){_0x19abab[_0x6144('0x1a')]=_0x1acaa7;if(_0x341420[_0x6144('0x30')][_0x6144('0x42')]){_0x2e5691['include']=[{'all':!![]}];}return db[_0x6144('0x29')]['findAll'](_0x2e5691);})[_0x6144('0x21')](function(_0x479dd2){_0x19abab[_0x6144('0x43')]=_0x479dd2;return _0x19abab;})[_0x6144('0x21')](respondWithFilteredResult(_0x3ab5ce,_0x2e5691))[_0x6144('0x44')](handleError(_0x3ab5ce,null));};exports['show']=function(_0x33b5e8,_0x12de35){var _0x1d17d4={'raw':!![],'where':{'id':_0x33b5e8['params']['id']}},_0x649796={};_0x649796[_0x6144('0x2d')]=_[_0x6144('0x31')](db[_0x6144('0x29')]['rawAttributes']);_0x649796['query']=_[_0x6144('0x31')](_0x33b5e8[_0x6144('0x30')]);_0x649796['filters']=_[_0x6144('0x34')](_0x649796[_0x6144('0x2d')],_0x649796[_0x6144('0x30')]);_0x1d17d4[_0x6144('0x33')]=_[_0x6144('0x34')](_0x649796[_0x6144('0x2d')],qs[_0x6144('0x35')](_0x33b5e8[_0x6144('0x30')][_0x6144('0x35')]));_0x1d17d4[_0x6144('0x33')]=_0x1d17d4[_0x6144('0x33')][_0x6144('0x36')]?_0x1d17d4['attributes']:_0x649796[_0x6144('0x2d')];if(_0x33b5e8[_0x6144('0x30')][_0x6144('0x42')]){_0x1d17d4[_0x6144('0x45')]=[{'all':!![]}];}_0x1d17d4=_[_0x6144('0x3e')]({},_0x1d17d4,_0x33b5e8[_0x6144('0x41')]);return db[_0x6144('0x29')][_0x6144('0x46')](_0x1d17d4)[_0x6144('0x21')](handleEntityNotFound(_0x12de35,null))[_0x6144('0x21')](respondWithResult(_0x12de35,null))[_0x6144('0x44')](handleError(_0x12de35,null));};exports[_0x6144('0x47')]=function(_0x4bd3d8,_0x29bd2c){return db['SquareOdbc'][_0x6144('0x47')](_0x4bd3d8[_0x6144('0x48')],{})[_0x6144('0x21')](function(_0x284c5b){var _0x416985=_0x4bd3d8[_0x6144('0x49')][_0x6144('0x4a')]({'plain':!![]});if(!_0x416985)throw new Error(_0x6144('0x4b'));if(_0x416985[_0x6144('0x4c')]===_0x6144('0x49')){var _0x146379=_0x284c5b['get']({'plain':!![]});var _0x3afd8a=_0x6144('0x4d');return db[_0x6144('0x4e')]['find']({'where':{'name':_0x3afd8a,'userProfileId':_0x416985['userProfileId']},'raw':!![]})[_0x6144('0x21')](function(_0x2caaea){if(_0x2caaea&&_0x2caaea[_0x6144('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x146379[_0x6144('0x2f')],'resourceId':_0x146379['id'],'type':_0x2caaea['name'],'sectionId':_0x2caaea['id']},{})[_0x6144('0x21')](function(){return _0x284c5b;});}else{return _0x284c5b;}})['catch'](function(_0x42a0f8){logger[_0x6144('0x25')](_0x6144('0x50'),_0x42a0f8);throw _0x42a0f8;});}return _0x284c5b;})[_0x6144('0x21')](respondWithResult(_0x29bd2c,0xc9))[_0x6144('0x44')](handleError(_0x29bd2c,null));};exports[_0x6144('0x20')]=function(_0x2b41bd,_0xaa53d1){if(_0x2b41bd['body']['id']){delete _0x2b41bd['body']['id'];}return db[_0x6144('0x29')]['find']({'where':{'id':_0x2b41bd[_0x6144('0x51')]['id']}})[_0x6144('0x21')](handleEntityNotFound(_0xaa53d1,null))['then'](saveUpdates(_0x2b41bd[_0x6144('0x48')],null))[_0x6144('0x21')](respondWithResult(_0xaa53d1,null))[_0x6144('0x44')](handleError(_0xaa53d1,null));};exports['destroy']=function(_0x1b01d7,_0x457773){return db[_0x6144('0x29')][_0x6144('0x46')]({'where':{'id':_0x1b01d7['params']['id']}})[_0x6144('0x21')](handleEntityNotFound(_0x457773,null))['then'](removeEntity(_0x457773,null))[_0x6144('0x44')](handleError(_0x457773,null));};exports[_0x6144('0x52')]=function(_0x514b87,_0x383fc1,_0x2707e6){var _0xd0fc25;return db[_0x6144('0x29')][_0x6144('0x46')]({'where':{'id':_0x514b87[_0x6144('0x51')]['id']},'attributes':['id',_0x6144('0x53')]})['then'](handleEntityNotFound(_0x383fc1,null))[_0x6144('0x21')](function(_0xf32222){if(_0xf32222){var _0x218d76=require(_0x6144('0x54'))();_0x218d76['openSync'](_0xf32222['dsn']);_0x218d76[_0x6144('0x55')]();return _0xf32222;}})['then'](respondWithResult(_0x383fc1,null))[_0x6144('0x44')](handleError(_0x383fc1,null));}; \ No newline at end of file +var _0x4e1f=['options','includeAll','include','findAll','rows','catch','show','params','attributes','find','create','body','user','role','ODBC','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter'];(function(_0x450381,_0x490f08){var _0x150dc3=function(_0x47e3bf){while(--_0x47e3bf){_0x450381['push'](_0x450381['shift']());}};_0x150dc3(++_0x490f08);}(_0x4e1f,0xc4));var _0xf4e1=function(_0x42fd3e,_0x3850fe){_0x42fd3e=_0x42fd3e-0x0;var _0x3f9609=_0x4e1f[_0x42fd3e];return _0x3f9609;};'use strict';var pdf=require(_0xf4e1('0x0'));var emlformat=require(_0xf4e1('0x1'));var rimraf=require(_0xf4e1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4e1('0x3'));var rp=require(_0xf4e1('0x4'));var moment=require(_0xf4e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4e1('0x6'));var util=require(_0xf4e1('0x7'));var path=require('path');var sox=require(_0xf4e1('0x8'));var csv=require(_0xf4e1('0x9'));var ejs=require(_0xf4e1('0xa'));var fs=require('fs');var _=require(_0xf4e1('0xb'));var squel=require('squel');var crypto=require(_0xf4e1('0xc'));var jsforce=require(_0xf4e1('0xd'));var deskjs=require(_0xf4e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf4e1('0xf'));var Papa=require(_0xf4e1('0x10'));var Redis=require(_0xf4e1('0x11'));var authService=require(_0xf4e1('0x12'));var qs=require(_0xf4e1('0x13'));var as=require(_0xf4e1('0x14'));var hardwareService=require(_0xf4e1('0x15'));var logger=require(_0xf4e1('0x16'))(_0xf4e1('0x17'));var utils=require(_0xf4e1('0x18'));var config=require(_0xf4e1('0x19'));var db=require(_0xf4e1('0x1a'))['db'];function respondWithStatusCode(_0x2eb3ed,_0x471f9c){_0x471f9c=_0x471f9c||0xcc;return function(_0x318249){if(_0x318249){return _0x2eb3ed[_0xf4e1('0x1b')](_0x471f9c);}return _0x2eb3ed['status'](_0x471f9c)[_0xf4e1('0x1c')]();};}function respondWithResult(_0x5b4328,_0x325b31){_0x325b31=_0x325b31||0xc8;return function(_0x529083){if(_0x529083){return _0x5b4328[_0xf4e1('0x1d')](_0x325b31)['json'](_0x529083);}};}function respondWithFilteredResult(_0x700802,_0x50cd2e){return function(_0x23c287){if(_0x23c287){var _0x1e5c95=_0x23c287[_0xf4e1('0x1e')],_0x2c626b=_0x50cd2e[_0xf4e1('0x1f')],_0x495763=_0x50cd2e['offset']+_0x50cd2e[_0xf4e1('0x20')],_0x1bbada;if(_0x495763>=_0x1e5c95){_0x495763=_0x1e5c95;_0x1bbada=0xc8;}else{_0x1bbada=0xce;}_0x700802['status'](_0x1bbada);return _0x700802[_0xf4e1('0x21')](_0xf4e1('0x22'),_0x2c626b+'-'+_0x495763+'/'+_0x1e5c95)[_0xf4e1('0x23')](_0x23c287);}return null;};}function patchUpdates(_0x2308f8){return function(_0x5929a2){try{jsonpatch[_0xf4e1('0x24')](_0x5929a2,_0x2308f8,!![]);}catch(_0x3e04b0){return BPromise[_0xf4e1('0x25')](_0x3e04b0);}return _0x5929a2['save']();};}function saveUpdates(_0x7c3c73,_0x48729f){return function(_0x3bd54e){if(_0x3bd54e){return _0x3bd54e[_0xf4e1('0x26')](_0x7c3c73)[_0xf4e1('0x27')](function(_0x177557){return _0x177557;});}return null;};}function removeEntity(_0x5c91e3,_0x335bf1){return function(_0x3fa8ea){if(_0x3fa8ea){return _0x3fa8ea[_0xf4e1('0x28')]()['then'](function(){var _0x3ba3c6=_0x3fa8ea[_0xf4e1('0x29')]({'plain':!![]});var _0x406ac6='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x406ac6,'resourceId':_0x3ba3c6['id']}})[_0xf4e1('0x27')](function(){return _0x3fa8ea;});})[_0xf4e1('0x27')](function(){_0x5c91e3[_0xf4e1('0x1d')](0xcc)[_0xf4e1('0x1c')]();});}};}function handleEntityNotFound(_0x9dc7de,_0x56826c){return function(_0x4ae598){if(!_0x4ae598){_0x9dc7de['sendStatus'](0x194);}return _0x4ae598;};}function handleError(_0x22e730,_0x2a314b){_0x2a314b=_0x2a314b||0x1f4;return function(_0x58d872){logger['error'](_0x58d872['stack']);if(_0x58d872[_0xf4e1('0x2a')]){delete _0x58d872[_0xf4e1('0x2a')];}_0x22e730[_0xf4e1('0x1d')](_0x2a314b)[_0xf4e1('0x2b')](_0x58d872);};}exports[_0xf4e1('0x2c')]=function(_0x34bb94,_0xd7fac9){var _0x237727={},_0x55f950={},_0x24267c={'count':0x0,'rows':[]};var _0x44d962=_[_0xf4e1('0x2d')](db[_0xf4e1('0x2e')][_0xf4e1('0x2f')],function(_0x21a1e3){return{'name':_0x21a1e3['fieldName'],'type':_0x21a1e3[_0xf4e1('0x30')][_0xf4e1('0x31')]};});_0x55f950[_0xf4e1('0x32')]=_[_0xf4e1('0x2d')](_0x44d962,_0xf4e1('0x2a'));_0x55f950[_0xf4e1('0x33')]=_[_0xf4e1('0x34')](_0x34bb94['query']);_0x55f950[_0xf4e1('0x35')]=_[_0xf4e1('0x36')](_0x55f950['model'],_0x55f950['query']);_0x237727['attributes']=_[_0xf4e1('0x36')](_0x55f950['model'],qs[_0xf4e1('0x37')](_0x34bb94[_0xf4e1('0x33')]['fields']));_0x237727['attributes']=_0x237727['attributes'][_0xf4e1('0x38')]?_0x237727['attributes']:_0x55f950[_0xf4e1('0x32')];if(!_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x39')](_0xf4e1('0x3a'))){_0x237727[_0xf4e1('0x20')]=qs[_0xf4e1('0x20')](_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x20')]);_0x237727['offset']=qs[_0xf4e1('0x1f')](_0x34bb94['query'][_0xf4e1('0x1f')]);}_0x237727[_0xf4e1('0x3b')]=qs[_0xf4e1('0x3c')](_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x3c')]);_0x237727['where']=qs[_0xf4e1('0x35')](_[_0xf4e1('0x3d')](_0x34bb94['query'],_0x55f950[_0xf4e1('0x35')]),_0x44d962);if(_0x34bb94[_0xf4e1('0x33')]['filter']){_0x237727['where']=_[_0xf4e1('0x3e')](_0x237727[_0xf4e1('0x3f')],{'$or':_[_0xf4e1('0x2d')](_0x44d962,function(_0x50366d){if(_0x50366d[_0xf4e1('0x30')]!=='VIRTUAL'){var _0x452bbe={};_0x452bbe[_0x50366d[_0xf4e1('0x2a')]]={'$like':'%'+_0x34bb94[_0xf4e1('0x33')][_0xf4e1('0x40')]+'%'};return _0x452bbe;}})});}_0x237727=_[_0xf4e1('0x3e')]({},_0x237727,_0x34bb94[_0xf4e1('0x41')]);var _0x3e2e1d={'where':_0x237727[_0xf4e1('0x3f')]};return db[_0xf4e1('0x2e')][_0xf4e1('0x1e')](_0x3e2e1d)[_0xf4e1('0x27')](function(_0x89bfa8){_0x24267c['count']=_0x89bfa8;if(_0x34bb94['query'][_0xf4e1('0x42')]){_0x237727[_0xf4e1('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0xf4e1('0x44')](_0x237727);})[_0xf4e1('0x27')](function(_0xd03d3){_0x24267c[_0xf4e1('0x45')]=_0xd03d3;return _0x24267c;})[_0xf4e1('0x27')](respondWithFilteredResult(_0xd7fac9,_0x237727))[_0xf4e1('0x46')](handleError(_0xd7fac9,null));};exports[_0xf4e1('0x47')]=function(_0x2d9666,_0xf0bc0){var _0x58fb75={'raw':!![],'where':{'id':_0x2d9666[_0xf4e1('0x48')]['id']}},_0x50317e={};_0x50317e[_0xf4e1('0x32')]=_[_0xf4e1('0x34')](db[_0xf4e1('0x2e')][_0xf4e1('0x2f')]);_0x50317e[_0xf4e1('0x33')]=_[_0xf4e1('0x34')](_0x2d9666[_0xf4e1('0x33')]);_0x50317e[_0xf4e1('0x35')]=_['intersection'](_0x50317e[_0xf4e1('0x32')],_0x50317e[_0xf4e1('0x33')]);_0x58fb75[_0xf4e1('0x49')]=_[_0xf4e1('0x36')](_0x50317e['model'],qs['fields'](_0x2d9666[_0xf4e1('0x33')][_0xf4e1('0x37')]));_0x58fb75[_0xf4e1('0x49')]=_0x58fb75[_0xf4e1('0x49')][_0xf4e1('0x38')]?_0x58fb75['attributes']:_0x50317e['model'];if(_0x2d9666['query']['includeAll']){_0x58fb75[_0xf4e1('0x43')]=[{'all':!![]}];}_0x58fb75=_[_0xf4e1('0x3e')]({},_0x58fb75,_0x2d9666[_0xf4e1('0x41')]);return db[_0xf4e1('0x2e')][_0xf4e1('0x4a')](_0x58fb75)['then'](handleEntityNotFound(_0xf0bc0,null))[_0xf4e1('0x27')](respondWithResult(_0xf0bc0,null))[_0xf4e1('0x46')](handleError(_0xf0bc0,null));};exports[_0xf4e1('0x4b')]=function(_0x491602,_0x582c93){return db[_0xf4e1('0x2e')][_0xf4e1('0x4b')](_0x491602[_0xf4e1('0x4c')],{})[_0xf4e1('0x27')](function(_0x190bc0){var _0x39b130=_0x491602[_0xf4e1('0x4d')][_0xf4e1('0x29')]({'plain':!![]});if(!_0x39b130)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39b130[_0xf4e1('0x4e')]===_0xf4e1('0x4d')){var _0x132e51=_0x190bc0[_0xf4e1('0x29')]({'plain':!![]});var _0x487afa=_0xf4e1('0x4f');return db[_0xf4e1('0x50')]['find']({'where':{'name':_0x487afa,'userProfileId':_0x39b130[_0xf4e1('0x51')]},'raw':!![]})['then'](function(_0x372491){if(_0x372491&&_0x372491['autoAssociation']===0x0){return db[_0xf4e1('0x52')]['create']({'name':_0x132e51[_0xf4e1('0x2a')],'resourceId':_0x132e51['id'],'type':_0x372491[_0xf4e1('0x2a')],'sectionId':_0x372491['id']},{})['then'](function(){return _0x190bc0;});}else{return _0x190bc0;}})[_0xf4e1('0x46')](function(_0x1e8137){logger['error'](_0xf4e1('0x53'),_0x1e8137);throw _0x1e8137;});}return _0x190bc0;})['then'](respondWithResult(_0x582c93,0xc9))['catch'](handleError(_0x582c93,null));};exports['update']=function(_0x3d2a32,_0x46ffaa){if(_0x3d2a32[_0xf4e1('0x4c')]['id']){delete _0x3d2a32[_0xf4e1('0x4c')]['id'];}return db[_0xf4e1('0x2e')][_0xf4e1('0x4a')]({'where':{'id':_0x3d2a32[_0xf4e1('0x48')]['id']}})[_0xf4e1('0x27')](handleEntityNotFound(_0x46ffaa,null))[_0xf4e1('0x27')](saveUpdates(_0x3d2a32[_0xf4e1('0x4c')],null))['then'](respondWithResult(_0x46ffaa,null))[_0xf4e1('0x46')](handleError(_0x46ffaa,null));};exports['destroy']=function(_0x5bc23f,_0x2e04b6){return db['SquareOdbc'][_0xf4e1('0x4a')]({'where':{'id':_0x5bc23f[_0xf4e1('0x48')]['id']}})[_0xf4e1('0x27')](handleEntityNotFound(_0x2e04b6,null))[_0xf4e1('0x27')](removeEntity(_0x2e04b6,null))[_0xf4e1('0x46')](handleError(_0x2e04b6,null));};exports[_0xf4e1('0x54')]=function(_0x26a7f7,_0x160c51,_0x5d22a2){var _0x3193ec;return db[_0xf4e1('0x2e')][_0xf4e1('0x4a')]({'where':{'id':_0x26a7f7['params']['id']},'attributes':['id',_0xf4e1('0x55')]})[_0xf4e1('0x27')](handleEntityNotFound(_0x160c51,null))[_0xf4e1('0x27')](function(_0x364942){if(_0x364942){var _0x1b4e31=require(_0xf4e1('0x56'))();_0x1b4e31['openSync'](_0x364942['dsn']);_0x1b4e31['closeSync']();return _0x364942;}})['then'](respondWithResult(_0x160c51,null))['catch'](handleError(_0x160c51,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 09b4676..4a9f3b6 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 _0xec2f=['../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','square_odbc','lodash','util'];(function(_0x214bf6,_0x5205b3){var _0x273223=function(_0x21065a){while(--_0x21065a){_0x214bf6['push'](_0x214bf6['shift']());}};_0x273223(++_0x5205b3);}(_0xec2f,0xa8));var _0xfec2=function(_0x5de7a5,_0x23948a){_0x5de7a5=_0x5de7a5-0x0;var _0x41e57b=_0xec2f[_0x5de7a5];return _0x41e57b;};'use strict';var _=require(_0xfec2('0x0'));var util=require(_0xfec2('0x1'));var logger=require(_0xfec2('0x2'))('api');var moment=require(_0xfec2('0x3'));var BPromise=require(_0xfec2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfec2('0x5'));var config=require(_0xfec2('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xfec2('0x7')]=function(_0x5ab50e,_0x256aa3){return _0x5ab50e[_0xfec2('0x8')]('SquareOdbc',attributes,{'tableName':_0xfec2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48dd=['../../config/logger','moment','request-promise','path','rimraf','./squareOdbc.attributes','exports','SquareOdbc','square_odbc'];(function(_0x4c15b3,_0x3aa9f8){var _0x1f4bd8=function(_0x441165){while(--_0x441165){_0x4c15b3['push'](_0x4c15b3['shift']());}};_0x1f4bd8(++_0x3aa9f8);}(_0x48dd,0x99));var _0xd48d=function(_0x4e4a6e,_0x1f9653){_0x4e4a6e=_0x4e4a6e-0x0;var _0x95553=_0x48dd[_0x4e4a6e];return _0x95553;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd48d('0x0'))('api');var moment=require(_0xd48d('0x1'));var BPromise=require('bluebird');var rp=require(_0xd48d('0x2'));var fs=require('fs');var path=require(_0xd48d('0x3'));var rimraf=require(_0xd48d('0x4'));var config=require('../../config/environment');var attributes=require(_0xd48d('0x5'));module[_0xd48d('0x6')]=function(_0x1bbde1,_0x1e7521){return _0x1bbde1['define'](_0xd48d('0x7'),attributes,{'tableName':_0xd48d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 852fd6e..8e2e7f5 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(_0x478a0c,_0x17c51a){var _0x3c76e5=function(_0x159b35){while(--_0x159b35){_0x478a0c['push'](_0x478a0c['shift']());}};_0x3c76e5(++_0x17c51a);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0xe14b,0x93));var _0xbe14=function(_0x2b1fd6,_0x1c1aaa){_0x2b1fd6=_0x2b1fd6-0x0;var _0x2bc96e=_0xe14b[_0x2b1fd6];return _0x2bc96e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 65eeb85..5bbee28 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 _0x8603=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getUsers','post','create','addUsers','delete','destroy','/:id/users','removeUsers','exports'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x8603,0x190));var _0x3860=function(_0x3d95e9,_0x45bb17){_0x3d95e9=_0x3d95e9-0x0;var _0x472c9a=_0x8603[_0x3d95e9];return _0x472c9a;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./squareProject.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/',auth['isAuthenticated'](),controller[_0x3860('0xd')]);router[_0x3860('0xc')]('/:id/users',auth[_0x3860('0x9')](),controller[_0x3860('0xe')]);router['put'](_0x3860('0x8'),auth[_0x3860('0x9')](),controller['update']);router[_0x3860('0xf')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x10')]);router[_0x3860('0xf')](_0x3860('0x11'),auth[_0x3860('0x9')](),controller[_0x3860('0x12')]);module[_0x3860('0x13')]=router; \ No newline at end of file +var _0x9c00=['express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x9c00,0x1a0));var _0x09c0=function(_0xd49e15,_0x5e34ac){_0xd49e15=_0xd49e15-0x0;var _0x306b6a=_0x9c00[_0xd49e15];return _0x306b6a;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c0('0x4'));var config=require(_0x09c0('0x5'));var controller=require(_0x09c0('0x6'));router[_0x09c0('0x7')]('/',auth[_0x09c0('0x8')](),controller['index']);router['get'](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xa')]);router[_0x09c0('0x7')](_0x09c0('0xb'),auth['isAuthenticated'](),controller[_0x09c0('0xc')]);router[_0x09c0('0xd')]('/',auth[_0x09c0('0x8')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xd')](_0x09c0('0xb'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x11')]);router[_0x09c0('0x12')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x12')](_0x09c0('0xb'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x14')]);module[_0x09c0('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 388b343..0ea66ff 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 _0x1dbe=['name','BLOB','getDataValue','preproduction','toString','utf8','long','production','exports','STRING'];(function(_0x5be8c5,_0xdbb932){var _0x229597=function(_0x401fd4){while(--_0x401fd4){_0x5be8c5['push'](_0x5be8c5['shift']());}};_0x229597(++_0xdbb932);}(_0x1dbe,0xbc));var _0xe1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe1db('0x0')]={'name':{'type':Sequelize[_0xe1db('0x1')],'unique':_0xe1db('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xe1db('0x3')]('long'),'get':function(){if(this[_0xe1db('0x4')]('preproduction')){return this['getDataValue'](_0xe1db('0x5'))[_0xe1db('0x6')](_0xe1db('0x7'));}}},'production':{'type':Sequelize[_0xe1db('0x3')](_0xe1db('0x8')),'get':function(){if(this[_0xe1db('0x4')](_0xe1db('0x9'))){return this[_0xe1db('0x4')](_0xe1db('0x9'))[_0xe1db('0x6')]('utf8');}}}}; \ No newline at end of file +var _0xe2f9=['preproduction','toString','utf8','production','sequelize','exports','name','STRING','TEXT','long','getDataValue'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xe2f9,0x10c));var _0x9e2f=function(_0x5a4650,_0x30d108){_0x5a4650=_0x5a4650-0x0;var _0x12ec86=_0xe2f9[_0x5a4650];return _0x12ec86;};'use strict';var Sequelize=require(_0x9e2f('0x0'));module[_0x9e2f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e2f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9e2f('0x3')]},'notes':{'type':Sequelize[_0x9e2f('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x9e2f('0x5')),'get':function(){if(this[_0x9e2f('0x6')](_0x9e2f('0x7'))){return this[_0x9e2f('0x6')](_0x9e2f('0x7'))[_0x9e2f('0x8')](_0x9e2f('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x9e2f('0x5')),'get':function(){if(this['getDataValue'](_0x9e2f('0xa'))){return this[_0x9e2f('0x6')](_0x9e2f('0xa'))[_0x9e2f('0x8')](_0x9e2f('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 197afd0..2befc59 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 _0xe14c=['redis','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','SquareProjects','error','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0xe14c,0x15a));var _0xce14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe14c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xce14('0x0'));var emlformat=require(_0xce14('0x1'));var rimraf=require(_0xce14('0x2'));var zipdir=require(_0xce14('0x3'));var jsonpatch=require(_0xce14('0x4'));var rp=require(_0xce14('0x5'));var moment=require(_0xce14('0x6'));var BPromise=require(_0xce14('0x7'));var Mustache=require(_0xce14('0x8'));var util=require('util');var path=require('path');var sox=require(_0xce14('0x9'));var csv=require(_0xce14('0xa'));var ejs=require(_0xce14('0xb'));var fs=require('fs');var _=require(_0xce14('0xc'));var squel=require(_0xce14('0xd'));var crypto=require(_0xce14('0xe'));var jsforce=require(_0xce14('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce14('0xa'));var querystring=require(_0xce14('0x10'));var Papa=require(_0xce14('0x11'));var Redis=require(_0xce14('0x12'));var authService=require(_0xce14('0x13'));var qs=require(_0xce14('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce14('0x15'));var logger=require('../../config/logger')(_0xce14('0x16'));var utils=require(_0xce14('0x17'));var config=require(_0xce14('0x18'));var db=require(_0xce14('0x19'))['db'];config[_0xce14('0x1a')]=_['defaults'](config[_0xce14('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xce14('0x1b'))(new Redis(config[_0xce14('0x1a')]));require(_0xce14('0x1c'))['register'](socket);function respondWithStatusCode(_0x3bf137,_0x21e75a){_0x21e75a=_0x21e75a||0xcc;return function(_0x1c965c){if(_0x1c965c){return _0x3bf137[_0xce14('0x1d')](_0x21e75a);}return _0x3bf137[_0xce14('0x1e')](_0x21e75a)[_0xce14('0x1f')]();};}function respondWithResult(_0x41e217,_0x4e857d){_0x4e857d=_0x4e857d||0xc8;return function(_0x296aa8){if(_0x296aa8){return _0x41e217[_0xce14('0x1e')](_0x4e857d)[_0xce14('0x20')](_0x296aa8);}};}function respondWithFilteredResult(_0x1c5cbc,_0x4b3e7a){return function(_0x4867aa){if(_0x4867aa){var _0xa08cd0=_0x4867aa[_0xce14('0x21')],_0x591f12=_0x4b3e7a[_0xce14('0x22')],_0x305105=_0x4b3e7a[_0xce14('0x22')]+_0x4b3e7a[_0xce14('0x23')],_0x5dcd96;if(_0x305105>=_0xa08cd0){_0x305105=_0xa08cd0;_0x5dcd96=0xc8;}else{_0x5dcd96=0xce;}_0x1c5cbc[_0xce14('0x1e')](_0x5dcd96);return _0x1c5cbc[_0xce14('0x24')](_0xce14('0x25'),_0x591f12+'-'+_0x305105+'/'+_0xa08cd0)[_0xce14('0x20')](_0x4867aa);}return null;};}function patchUpdates(_0x5ed330){return function(_0x4eded2){try{jsonpatch['apply'](_0x4eded2,_0x5ed330,!![]);}catch(_0x12911a){return BPromise['reject'](_0x12911a);}return _0x4eded2[_0xce14('0x26')]();};}function saveUpdates(_0x59f875,_0x50d3f3){return function(_0x4271a2){if(_0x4271a2){return _0x4271a2[_0xce14('0x27')](_0x59f875)[_0xce14('0x28')](function(_0x3ddc32){return _0x3ddc32;});}return null;};}function removeEntity(_0x3ec6b1,_0x417f4d){return function(_0x2f4d2f){if(_0x2f4d2f){return _0x2f4d2f[_0xce14('0x29')]()['then'](function(){var _0x174cdd=_0x2f4d2f[_0xce14('0x2a')]({'plain':!![]});var _0x3f0ef2=_0xce14('0x2b');return db['UserProfileResource'][_0xce14('0x29')]({'where':{'type':_0x3f0ef2,'resourceId':_0x174cdd['id']}})[_0xce14('0x28')](function(){return _0x2f4d2f;});})[_0xce14('0x28')](function(){_0x3ec6b1[_0xce14('0x1e')](0xcc)[_0xce14('0x1f')]();});}};}function handleEntityNotFound(_0x269d36,_0x3e5ffd){return function(_0x39a747){if(!_0x39a747){_0x269d36[_0xce14('0x1d')](0x194);}return _0x39a747;};}function handleError(_0x34df23,_0x4866d0){_0x4866d0=_0x4866d0||0x1f4;return function(_0x4b3cac){logger[_0xce14('0x2c')](_0x4b3cac['stack']);if(_0x4b3cac[_0xce14('0x2d')]){delete _0x4b3cac[_0xce14('0x2d')];}_0x34df23[_0xce14('0x1e')](_0x4866d0)[_0xce14('0x2e')](_0x4b3cac);};}exports[_0xce14('0x2f')]=function(_0x22a062,_0x2f687e){var _0x2c5121={},_0x1c9198={},_0x2ac613={'count':0x0,'rows':[]};var _0x413823=_[_0xce14('0x30')](db[_0xce14('0x31')][_0xce14('0x32')],function(_0x35085a){return{'name':_0x35085a['fieldName'],'type':_0x35085a[_0xce14('0x33')][_0xce14('0x34')]};});_0x1c9198[_0xce14('0x35')]=_[_0xce14('0x30')](_0x413823,_0xce14('0x2d'));_0x1c9198[_0xce14('0x36')]=_[_0xce14('0x37')](_0x22a062[_0xce14('0x36')]);_0x1c9198[_0xce14('0x38')]=_[_0xce14('0x39')](_0x1c9198[_0xce14('0x35')],_0x1c9198[_0xce14('0x36')]);_0x2c5121['attributes']=_[_0xce14('0x39')](_0x1c9198['model'],qs[_0xce14('0x3a')](_0x22a062[_0xce14('0x36')][_0xce14('0x3a')]));_0x2c5121[_0xce14('0x3b')]=_0x2c5121['attributes'][_0xce14('0x3c')]?_0x2c5121[_0xce14('0x3b')]:_0x1c9198[_0xce14('0x35')];if(!_0x22a062[_0xce14('0x36')][_0xce14('0x3d')]('nolimit')){_0x2c5121['limit']=qs[_0xce14('0x23')](_0x22a062[_0xce14('0x36')][_0xce14('0x23')]);_0x2c5121[_0xce14('0x22')]=qs[_0xce14('0x22')](_0x22a062[_0xce14('0x36')][_0xce14('0x22')]);}_0x2c5121[_0xce14('0x3e')]=qs[_0xce14('0x3f')](_0x22a062['query'][_0xce14('0x3f')]);_0x2c5121[_0xce14('0x40')]=qs['filters'](_['pick'](_0x22a062[_0xce14('0x36')],_0x1c9198[_0xce14('0x38')]),_0x413823);if(_0x22a062[_0xce14('0x36')][_0xce14('0x41')]){_0x2c5121[_0xce14('0x40')]=_[_0xce14('0x42')](_0x2c5121[_0xce14('0x40')],{'$or':_['map'](_0x413823,function(_0x1dc502){if(_0x1dc502[_0xce14('0x33')]!==_0xce14('0x43')){var _0x7cdd0a={};_0x7cdd0a[_0x1dc502[_0xce14('0x2d')]]={'$like':'%'+_0x22a062[_0xce14('0x36')]['filter']+'%'};return _0x7cdd0a;}})});}_0x2c5121=_[_0xce14('0x42')]({},_0x2c5121,_0x22a062[_0xce14('0x44')]);var _0x576edc={'where':_0x2c5121[_0xce14('0x40')]};return db[_0xce14('0x31')][_0xce14('0x21')](_0x576edc)[_0xce14('0x28')](function(_0x555ad9){_0x2ac613['count']=_0x555ad9;if(_0x22a062['query'][_0xce14('0x45')]){_0x2c5121['include']=[{'all':!![]}];}return db[_0xce14('0x31')][_0xce14('0x46')](_0x2c5121);})[_0xce14('0x28')](function(_0x4340a4){_0x2ac613[_0xce14('0x47')]=_0x4340a4;return _0x2ac613;})[_0xce14('0x28')](respondWithFilteredResult(_0x2f687e,_0x2c5121))[_0xce14('0x48')](handleError(_0x2f687e,null));};exports[_0xce14('0x49')]=function(_0xa93103,_0x440093){var _0x2f3540={'raw':![],'where':{'id':_0xa93103[_0xce14('0x4a')]['id']}},_0x15841d={};_0x15841d[_0xce14('0x35')]=_[_0xce14('0x37')](db[_0xce14('0x31')]['rawAttributes']);_0x15841d[_0xce14('0x36')]=_[_0xce14('0x37')](_0xa93103[_0xce14('0x36')]);_0x15841d[_0xce14('0x38')]=_[_0xce14('0x39')](_0x15841d['model'],_0x15841d[_0xce14('0x36')]);_0x2f3540[_0xce14('0x3b')]=_['intersection'](_0x15841d['model'],qs['fields'](_0xa93103[_0xce14('0x36')]['fields']));_0x2f3540[_0xce14('0x3b')]=_0x2f3540[_0xce14('0x3b')][_0xce14('0x3c')]?_0x2f3540[_0xce14('0x3b')]:_0x15841d[_0xce14('0x35')];if(_0xa93103[_0xce14('0x36')][_0xce14('0x45')]){_0x2f3540[_0xce14('0x4b')]=[{'all':!![]}];}_0x2f3540=_[_0xce14('0x42')]({},_0x2f3540,_0xa93103[_0xce14('0x44')]);return db[_0xce14('0x31')][_0xce14('0x4c')](_0x2f3540)[_0xce14('0x28')](handleEntityNotFound(_0x440093,null))[_0xce14('0x28')](respondWithResult(_0x440093,null))[_0xce14('0x48')](handleError(_0x440093,null));};exports[_0xce14('0x4d')]=function(_0x35cc98,_0x244260){return db[_0xce14('0x31')]['create'](_0x35cc98[_0xce14('0x4e')],{})[_0xce14('0x28')](function(_0x48cd54){var _0x183038=_0x35cc98[_0xce14('0x4f')][_0xce14('0x2a')]({'plain':!![]});if(!_0x183038)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x183038[_0xce14('0x50')]===_0xce14('0x4f')){var _0x5f561d=_0x48cd54[_0xce14('0x2a')]({'plain':!![]});var _0x48cfeb=_0xce14('0x2b');return db[_0xce14('0x51')][_0xce14('0x4c')]({'where':{'name':_0x48cfeb,'userProfileId':_0x183038[_0xce14('0x52')]},'raw':!![]})[_0xce14('0x28')](function(_0x3e961b){if(_0x3e961b&&_0x3e961b['autoAssociation']===0x0){return db['UserProfileResource'][_0xce14('0x4d')]({'name':_0x5f561d[_0xce14('0x2d')],'resourceId':_0x5f561d['id'],'type':_0x3e961b[_0xce14('0x2d')],'sectionId':_0x3e961b['id']},{})['then'](function(){return _0x48cd54;});}else{return _0x48cd54;}})[_0xce14('0x48')](function(_0x507006){logger[_0xce14('0x2c')](_0xce14('0x53'),_0x507006);throw _0x507006;});}return _0x48cd54;})['then'](respondWithResult(_0x244260,0xc9))['catch'](handleError(_0x244260,null));};exports['update']=function(_0x4cfa9d,_0x5bfb4a){if(_0x4cfa9d[_0xce14('0x4e')]['id']){delete _0x4cfa9d[_0xce14('0x4e')]['id'];}return db[_0xce14('0x31')][_0xce14('0x4c')]({'where':{'id':_0x4cfa9d['params']['id']}})['then'](handleEntityNotFound(_0x5bfb4a,null))['then'](saveUpdates(_0x4cfa9d[_0xce14('0x4e')],null))['then'](respondWithResult(_0x5bfb4a,null))[_0xce14('0x48')](handleError(_0x5bfb4a,null));};exports['destroy']=function(_0xe4243d,_0x2a3b5a){return db['SquareProject']['find']({'where':{'id':_0xe4243d['params']['id']}})['then'](handleEntityNotFound(_0x2a3b5a,null))['then'](removeEntity(_0x2a3b5a,null))['catch'](handleError(_0x2a3b5a,null));};exports['addUsers']=function(_0x26673c,_0x38ebcb,_0x453c35){return db[_0xce14('0x31')][_0xce14('0x4c')]({'where':{'id':_0x26673c[_0xce14('0x4a')]['id']}})[_0xce14('0x28')](handleEntityNotFound(_0x38ebcb,null))[_0xce14('0x28')](function(_0x4823a6){if(_0x4823a6){return _0x4823a6[_0xce14('0x54')](_0x26673c['body'][_0xce14('0x55')],_['omit'](_0x26673c[_0xce14('0x4e')],[_0xce14('0x55'),'id'])||{});}})['then'](respondWithResult(_0x38ebcb,null))[_0xce14('0x48')](handleError(_0x38ebcb,null));};exports[_0xce14('0x56')]=function(_0x39a429,_0xaa6790,_0x4588b6){return db[_0xce14('0x31')][_0xce14('0x4c')]({'where':{'id':_0x39a429[_0xce14('0x4a')]['id']}})[_0xce14('0x28')](handleEntityNotFound(_0xaa6790,null))[_0xce14('0x28')](function(_0x22803d){if(_0x22803d){return _0x22803d[_0xce14('0x56')](_0x39a429['query']['ids'])[_0xce14('0x28')](function(){if(_[_0xce14('0x57')](_0x39a429[_0xce14('0x36')][_0xce14('0x55')])){for(var _0x4c11bf=0x0;_0x4c11bf<_0x39a429[_0xce14('0x36')][_0xce14('0x55')][_0xce14('0x3c')];_0x4c11bf+=0x1){socket[_0xce14('0x58')](_0xce14('0x59'),{'UserId':Number(_0x39a429[_0xce14('0x36')][_0xce14('0x55')][_0x4c11bf]),'SquareProjectId':Number(_0x39a429['params']['id'])});}}else{socket[_0xce14('0x58')](_0xce14('0x59'),{'UserId':Number(_0x39a429['query'][_0xce14('0x55')]),'SquareProjectId':Number(_0x39a429['params']['id'])});}});}})[_0xce14('0x28')](respondWithStatusCode(_0xaa6790,null))['catch'](handleError(_0xaa6790,null));};exports[_0xce14('0x5a')]=function(_0x1e764b,_0x4f3cd6,_0x151c07){var _0x467bfc={};var _0x4b2883={};var _0x4a0009;var _0x30dd2b;return db[_0xce14('0x31')][_0xce14('0x5b')]({'where':{'id':_0x1e764b['params']['id']}})[_0xce14('0x28')](handleEntityNotFound(_0x4f3cd6,null))[_0xce14('0x28')](function(_0x5b8375){if(_0x5b8375){_0x4a0009=_0x5b8375;_0x4b2883[_0xce14('0x35')]=_[_0xce14('0x37')](db['User'][_0xce14('0x32')]);_0x4b2883[_0xce14('0x36')]=_['keys'](_0x1e764b[_0xce14('0x36')]);_0x4b2883[_0xce14('0x38')]=_['intersection'](_0x4b2883[_0xce14('0x35')],_0x4b2883[_0xce14('0x36')]);_0x467bfc[_0xce14('0x3b')]=_['intersection'](_0x4b2883['model'],qs[_0xce14('0x3a')](_0x1e764b['query'][_0xce14('0x3a')]));_0x467bfc[_0xce14('0x3b')]=_0x467bfc[_0xce14('0x3b')][_0xce14('0x3c')]?_0x467bfc[_0xce14('0x3b')]:_0x4b2883[_0xce14('0x35')];_0x467bfc['order']=qs[_0xce14('0x3f')](_0x1e764b[_0xce14('0x36')][_0xce14('0x3f')]);_0x467bfc['where']=qs[_0xce14('0x38')](_['pick'](_0x1e764b['query'],_0x4b2883[_0xce14('0x38')]));if(_0x1e764b['query'][_0xce14('0x41')]){_0x467bfc[_0xce14('0x40')]=_[_0xce14('0x42')](_0x467bfc['where'],{'$or':_[_0xce14('0x30')](_0x467bfc[_0xce14('0x3b')],function(_0x172d87){var _0x210035={};_0x210035[_0x172d87]={'$like':'%'+_0x1e764b[_0xce14('0x36')]['filter']+'%'};return _0x210035;})});}_0x467bfc=_[_0xce14('0x42')]({},_0x467bfc,_0x1e764b['options']);return _0x4a0009[_0xce14('0x5a')](_0x467bfc);}})[_0xce14('0x28')](function(_0x2ae8a6){if(_0x2ae8a6){_0x30dd2b=_0x2ae8a6['length'];if(!_0x1e764b[_0xce14('0x36')][_0xce14('0x3d')](_0xce14('0x5c'))){_0x467bfc[_0xce14('0x23')]=qs[_0xce14('0x23')](_0x1e764b[_0xce14('0x36')][_0xce14('0x23')]);_0x467bfc[_0xce14('0x22')]=qs['offset'](_0x1e764b[_0xce14('0x36')][_0xce14('0x22')]);}return _0x4a0009[_0xce14('0x5a')](_0x467bfc);}})[_0xce14('0x28')](function(_0x2a44de){if(_0x2a44de){return _0x2a44de?{'count':_0x30dd2b,'rows':_0x2a44de}:null;}})[_0xce14('0x28')](respondWithResult(_0x4f3cd6,null))[_0xce14('0x48')](handleError(_0x4f3cd6,null));}; \ No newline at end of file +var _0x72a5=['fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','error','stack','name','map','SquareProject','rawAttributes'];(function(_0x296516,_0x2c99e1){var _0x464c97=function(_0x4fd9b0){while(--_0x4fd9b0){_0x296516['push'](_0x296516['shift']());}};_0x464c97(++_0x2c99e1);}(_0x72a5,0x1a3));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x572a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x572a('0x1'));var jsonpatch=require(_0x572a('0x2'));var rp=require(_0x572a('0x3'));var moment=require(_0x572a('0x4'));var BPromise=require(_0x572a('0x5'));var Mustache=require(_0x572a('0x6'));var util=require(_0x572a('0x7'));var path=require(_0x572a('0x8'));var sox=require(_0x572a('0x9'));var csv=require(_0x572a('0xa'));var ejs=require(_0x572a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x572a('0xc'));var crypto=require(_0x572a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x572a('0xa'));var querystring=require(_0x572a('0xe'));var Papa=require(_0x572a('0xf'));var Redis=require(_0x572a('0x10'));var authService=require(_0x572a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x572a('0x12'));var logger=require(_0x572a('0x13'))(_0x572a('0x14'));var utils=require(_0x572a('0x15'));var config=require(_0x572a('0x16'));var db=require(_0x572a('0x17'))['db'];config[_0x572a('0x18')]=_[_0x572a('0x19')](config['redis'],{'host':_0x572a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x572a('0x18')]));require(_0x572a('0x1b'))['register'](socket);function respondWithStatusCode(_0x25be41,_0xf8cf88){_0xf8cf88=_0xf8cf88||0xcc;return function(_0x2758fa){if(_0x2758fa){return _0x25be41[_0x572a('0x1c')](_0xf8cf88);}return _0x25be41['status'](_0xf8cf88)[_0x572a('0x1d')]();};}function respondWithResult(_0x4049bc,_0x4c466c){_0x4c466c=_0x4c466c||0xc8;return function(_0x11de81){if(_0x11de81){return _0x4049bc[_0x572a('0x1e')](_0x4c466c)[_0x572a('0x1f')](_0x11de81);}};}function respondWithFilteredResult(_0x25cc47,_0xab72d9){return function(_0x21cba0){if(_0x21cba0){var _0x4f6953=_0x21cba0[_0x572a('0x20')],_0x3b0407=_0xab72d9['offset'],_0x669500=_0xab72d9[_0x572a('0x21')]+_0xab72d9[_0x572a('0x22')],_0xa16a2a;if(_0x669500>=_0x4f6953){_0x669500=_0x4f6953;_0xa16a2a=0xc8;}else{_0xa16a2a=0xce;}_0x25cc47[_0x572a('0x1e')](_0xa16a2a);return _0x25cc47[_0x572a('0x23')](_0x572a('0x24'),_0x3b0407+'-'+_0x669500+'/'+_0x4f6953)[_0x572a('0x1f')](_0x21cba0);}return null;};}function patchUpdates(_0x39eec5){return function(_0x5b6c80){try{jsonpatch[_0x572a('0x25')](_0x5b6c80,_0x39eec5,!![]);}catch(_0x5a14ae){return BPromise[_0x572a('0x26')](_0x5a14ae);}return _0x5b6c80[_0x572a('0x27')]();};}function saveUpdates(_0x4a5645,_0x4bdb3c){return function(_0x43adc0){if(_0x43adc0){return _0x43adc0[_0x572a('0x28')](_0x4a5645)[_0x572a('0x29')](function(_0x574af1){return _0x574af1;});}return null;};}function removeEntity(_0x49a555,_0x3a2be8){return function(_0x17b788){if(_0x17b788){return _0x17b788[_0x572a('0x2a')]()[_0x572a('0x29')](function(){var _0x198fec=_0x17b788[_0x572a('0x2b')]({'plain':!![]});var _0x404899=_0x572a('0x2c');return db['UserProfileResource'][_0x572a('0x2a')]({'where':{'type':_0x404899,'resourceId':_0x198fec['id']}})[_0x572a('0x29')](function(){return _0x17b788;});})['then'](function(){_0x49a555['status'](0xcc)[_0x572a('0x1d')]();});}};}function handleEntityNotFound(_0x5081d6,_0xb51b81){return function(_0x589762){if(!_0x589762){_0x5081d6['sendStatus'](0x194);}return _0x589762;};}function handleError(_0x42e081,_0x22c545){_0x22c545=_0x22c545||0x1f4;return function(_0x251abc){logger[_0x572a('0x2d')](_0x251abc[_0x572a('0x2e')]);if(_0x251abc[_0x572a('0x2f')]){delete _0x251abc[_0x572a('0x2f')];}_0x42e081[_0x572a('0x1e')](_0x22c545)['send'](_0x251abc);};}exports['index']=function(_0x40efc2,_0x12a8fa){var _0x425c36={},_0x4ce7c5={},_0x2da4fb={'count':0x0,'rows':[]};var _0x5c0e74=_[_0x572a('0x30')](db[_0x572a('0x31')][_0x572a('0x32')],function(_0x3650f7){return{'name':_0x3650f7[_0x572a('0x33')],'type':_0x3650f7[_0x572a('0x34')][_0x572a('0x35')]};});_0x4ce7c5[_0x572a('0x36')]=_['map'](_0x5c0e74,'name');_0x4ce7c5[_0x572a('0x37')]=_['keys'](_0x40efc2[_0x572a('0x37')]);_0x4ce7c5[_0x572a('0x38')]=_[_0x572a('0x39')](_0x4ce7c5['model'],_0x4ce7c5[_0x572a('0x37')]);_0x425c36['attributes']=_[_0x572a('0x39')](_0x4ce7c5['model'],qs[_0x572a('0x3a')](_0x40efc2['query']['fields']));_0x425c36[_0x572a('0x3b')]=_0x425c36['attributes'][_0x572a('0x3c')]?_0x425c36[_0x572a('0x3b')]:_0x4ce7c5[_0x572a('0x36')];if(!_0x40efc2[_0x572a('0x37')]['hasOwnProperty'](_0x572a('0x3d'))){_0x425c36[_0x572a('0x22')]=qs[_0x572a('0x22')](_0x40efc2[_0x572a('0x37')][_0x572a('0x22')]);_0x425c36[_0x572a('0x21')]=qs[_0x572a('0x21')](_0x40efc2[_0x572a('0x37')][_0x572a('0x21')]);}_0x425c36[_0x572a('0x3e')]=qs['sort'](_0x40efc2['query'][_0x572a('0x3f')]);_0x425c36[_0x572a('0x40')]=qs[_0x572a('0x38')](_[_0x572a('0x41')](_0x40efc2[_0x572a('0x37')],_0x4ce7c5[_0x572a('0x38')]),_0x5c0e74);if(_0x40efc2[_0x572a('0x37')][_0x572a('0x42')]){_0x425c36[_0x572a('0x40')]=_[_0x572a('0x43')](_0x425c36['where'],{'$or':_[_0x572a('0x30')](_0x5c0e74,function(_0x2b5a55){if(_0x2b5a55[_0x572a('0x34')]!==_0x572a('0x44')){var _0x139bd7={};_0x139bd7[_0x2b5a55[_0x572a('0x2f')]]={'$like':'%'+_0x40efc2[_0x572a('0x37')]['filter']+'%'};return _0x139bd7;}})});}_0x425c36=_[_0x572a('0x43')]({},_0x425c36,_0x40efc2['options']);var _0x773d72={'where':_0x425c36[_0x572a('0x40')]};return db[_0x572a('0x31')][_0x572a('0x20')](_0x773d72)[_0x572a('0x29')](function(_0x3dafce){_0x2da4fb[_0x572a('0x20')]=_0x3dafce;if(_0x40efc2[_0x572a('0x37')][_0x572a('0x45')]){_0x425c36[_0x572a('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0x572a('0x47')](_0x425c36);})[_0x572a('0x29')](function(_0x14aec5){_0x2da4fb[_0x572a('0x48')]=_0x14aec5;return _0x2da4fb;})[_0x572a('0x29')](respondWithFilteredResult(_0x12a8fa,_0x425c36))[_0x572a('0x49')](handleError(_0x12a8fa,null));};exports[_0x572a('0x4a')]=function(_0x543ed2,_0x74dea9){var _0x37842e={'raw':![],'where':{'id':_0x543ed2[_0x572a('0x4b')]['id']}},_0x58496a={};_0x58496a['model']=_[_0x572a('0x4c')](db[_0x572a('0x31')][_0x572a('0x32')]);_0x58496a[_0x572a('0x37')]=_[_0x572a('0x4c')](_0x543ed2['query']);_0x58496a[_0x572a('0x38')]=_[_0x572a('0x39')](_0x58496a[_0x572a('0x36')],_0x58496a['query']);_0x37842e[_0x572a('0x3b')]=_[_0x572a('0x39')](_0x58496a['model'],qs[_0x572a('0x3a')](_0x543ed2['query'][_0x572a('0x3a')]));_0x37842e[_0x572a('0x3b')]=_0x37842e[_0x572a('0x3b')][_0x572a('0x3c')]?_0x37842e[_0x572a('0x3b')]:_0x58496a[_0x572a('0x36')];if(_0x543ed2[_0x572a('0x37')][_0x572a('0x45')]){_0x37842e[_0x572a('0x46')]=[{'all':!![]}];}_0x37842e=_[_0x572a('0x43')]({},_0x37842e,_0x543ed2[_0x572a('0x4d')]);return db['SquareProject'][_0x572a('0x4e')](_0x37842e)['then'](handleEntityNotFound(_0x74dea9,null))['then'](respondWithResult(_0x74dea9,null))[_0x572a('0x49')](handleError(_0x74dea9,null));};exports['create']=function(_0x513c06,_0x75eea9){return db['SquareProject'][_0x572a('0x4f')](_0x513c06[_0x572a('0x50')],{})[_0x572a('0x29')](function(_0xe04dd9){var _0x47350d=_0x513c06[_0x572a('0x51')][_0x572a('0x2b')]({'plain':!![]});if(!_0x47350d)throw new Error(_0x572a('0x52'));if(_0x47350d['role']===_0x572a('0x51')){var _0x19bdd2=_0xe04dd9[_0x572a('0x2b')]({'plain':!![]});var _0x2bfcac=_0x572a('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x2bfcac,'userProfileId':_0x47350d['userProfileId']},'raw':!![]})[_0x572a('0x29')](function(_0x500edb){if(_0x500edb&&_0x500edb[_0x572a('0x53')]===0x0){return db[_0x572a('0x54')]['create']({'name':_0x19bdd2[_0x572a('0x2f')],'resourceId':_0x19bdd2['id'],'type':_0x500edb[_0x572a('0x2f')],'sectionId':_0x500edb['id']},{})[_0x572a('0x29')](function(){return _0xe04dd9;});}else{return _0xe04dd9;}})[_0x572a('0x49')](function(_0x167a3b){logger[_0x572a('0x2d')](_0x572a('0x55'),_0x167a3b);throw _0x167a3b;});}return _0xe04dd9;})[_0x572a('0x29')](respondWithResult(_0x75eea9,0xc9))['catch'](handleError(_0x75eea9,null));};exports[_0x572a('0x28')]=function(_0x5f088b,_0x40d8d8){if(_0x5f088b[_0x572a('0x50')]['id']){delete _0x5f088b[_0x572a('0x50')]['id'];}return db[_0x572a('0x31')]['find']({'where':{'id':_0x5f088b[_0x572a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40d8d8,null))[_0x572a('0x29')](saveUpdates(_0x5f088b[_0x572a('0x50')],null))[_0x572a('0x29')](respondWithResult(_0x40d8d8,null))[_0x572a('0x49')](handleError(_0x40d8d8,null));};exports[_0x572a('0x2a')]=function(_0xa88ea8,_0x293f59){return db[_0x572a('0x31')][_0x572a('0x4e')]({'where':{'id':_0xa88ea8['params']['id']}})[_0x572a('0x29')](handleEntityNotFound(_0x293f59,null))['then'](removeEntity(_0x293f59,null))[_0x572a('0x49')](handleError(_0x293f59,null));};exports['addUsers']=function(_0x338e60,_0xa1f495,_0x243d28){return db[_0x572a('0x31')][_0x572a('0x4e')]({'where':{'id':_0x338e60[_0x572a('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa1f495,null))[_0x572a('0x29')](function(_0x324b2c){if(_0x324b2c){return _0x324b2c['addUsers'](_0x338e60[_0x572a('0x50')][_0x572a('0x56')],_['omit'](_0x338e60[_0x572a('0x50')],[_0x572a('0x56'),'id'])||{});}})[_0x572a('0x29')](respondWithResult(_0xa1f495,null))['catch'](handleError(_0xa1f495,null));};exports['removeUsers']=function(_0x13786e,_0x364978,_0x1d2165){return db[_0x572a('0x31')][_0x572a('0x4e')]({'where':{'id':_0x13786e[_0x572a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x364978,null))[_0x572a('0x29')](function(_0x387cbc){if(_0x387cbc){return _0x387cbc[_0x572a('0x57')](_0x13786e[_0x572a('0x37')][_0x572a('0x56')])['then'](function(){if(_[_0x572a('0x58')](_0x13786e[_0x572a('0x37')]['ids'])){for(var _0x42cdda=0x0;_0x42cdda<_0x13786e['query'][_0x572a('0x56')][_0x572a('0x3c')];_0x42cdda+=0x1){socket[_0x572a('0x59')](_0x572a('0x5a'),{'UserId':Number(_0x13786e[_0x572a('0x37')][_0x572a('0x56')][_0x42cdda]),'SquareProjectId':Number(_0x13786e['params']['id'])});}}else{socket[_0x572a('0x59')](_0x572a('0x5a'),{'UserId':Number(_0x13786e[_0x572a('0x37')]['ids']),'SquareProjectId':Number(_0x13786e[_0x572a('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x364978,null))[_0x572a('0x49')](handleError(_0x364978,null));};exports[_0x572a('0x5b')]=function(_0x33e389,_0x5d78d3,_0x346c3){var _0x149afc={};var _0x4f83fb={};var _0x586bae;var _0x255e78;return db[_0x572a('0x31')][_0x572a('0x5c')]({'where':{'id':_0x33e389[_0x572a('0x4b')]['id']}})[_0x572a('0x29')](handleEntityNotFound(_0x5d78d3,null))['then'](function(_0x126a35){if(_0x126a35){_0x586bae=_0x126a35;_0x4f83fb['model']=_[_0x572a('0x4c')](db['User']['rawAttributes']);_0x4f83fb[_0x572a('0x37')]=_[_0x572a('0x4c')](_0x33e389[_0x572a('0x37')]);_0x4f83fb['filters']=_[_0x572a('0x39')](_0x4f83fb['model'],_0x4f83fb[_0x572a('0x37')]);_0x149afc['attributes']=_[_0x572a('0x39')](_0x4f83fb[_0x572a('0x36')],qs['fields'](_0x33e389[_0x572a('0x37')][_0x572a('0x3a')]));_0x149afc[_0x572a('0x3b')]=_0x149afc[_0x572a('0x3b')][_0x572a('0x3c')]?_0x149afc[_0x572a('0x3b')]:_0x4f83fb['model'];_0x149afc[_0x572a('0x3e')]=qs[_0x572a('0x3f')](_0x33e389[_0x572a('0x37')][_0x572a('0x3f')]);_0x149afc['where']=qs[_0x572a('0x38')](_[_0x572a('0x41')](_0x33e389[_0x572a('0x37')],_0x4f83fb[_0x572a('0x38')]));if(_0x33e389[_0x572a('0x37')][_0x572a('0x42')]){_0x149afc[_0x572a('0x40')]=_['merge'](_0x149afc[_0x572a('0x40')],{'$or':_['map'](_0x149afc[_0x572a('0x3b')],function(_0x2ec64c){var _0x344331={};_0x344331[_0x2ec64c]={'$like':'%'+_0x33e389[_0x572a('0x37')][_0x572a('0x42')]+'%'};return _0x344331;})});}_0x149afc=_[_0x572a('0x43')]({},_0x149afc,_0x33e389[_0x572a('0x4d')]);return _0x586bae[_0x572a('0x5b')](_0x149afc);}})[_0x572a('0x29')](function(_0x13a5a7){if(_0x13a5a7){_0x255e78=_0x13a5a7[_0x572a('0x3c')];if(!_0x33e389[_0x572a('0x37')][_0x572a('0x5d')](_0x572a('0x3d'))){_0x149afc[_0x572a('0x22')]=qs[_0x572a('0x22')](_0x33e389[_0x572a('0x37')][_0x572a('0x22')]);_0x149afc[_0x572a('0x21')]=qs[_0x572a('0x21')](_0x33e389[_0x572a('0x37')][_0x572a('0x21')]);}return _0x586bae[_0x572a('0x5b')](_0x149afc);}})['then'](function(_0x4dd897){if(_0x4dd897){return _0x4dd897?{'count':_0x255e78,'rows':_0x4dd897}:null;}})[_0x572a('0x29')](respondWithResult(_0x5d78d3,null))[_0x572a('0x49')](handleError(_0x5d78d3,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7b66f51..0890fc3 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 _0xab5c=['emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners','update'];(function(_0x59ee58,_0x478012){var _0x9c675c=function(_0x4cf3cd){while(--_0x4cf3cd){_0x59ee58['push'](_0x59ee58['shift']());}};_0x9c675c(++_0x478012);}(_0xab5c,0x134));var _0xcab5=function(_0x569ebf,_0x540e0d){_0x569ebf=_0x569ebf-0x0;var _0x348edf=_0xab5c[_0x569ebf];return _0x348edf;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xcab5('0x0'))['db'][_0xcab5('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xcab5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcab5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x558809){return function(_0x5200b9,_0x1d92af,_0x4da49c){SquareProjectEvents[_0xcab5('0x4')](_0x558809+':'+_0x5200b9['id'],_0x5200b9);SquareProjectEvents[_0xcab5('0x4')](_0x558809,_0x5200b9);_0x4da49c(null);};}for(var e in events){if(events[_0xcab5('0x5')](e)){var event=events[e];SquareProject[_0xcab5('0x6')](e,emitEvent(event));}}module[_0xcab5('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xc178=['setMaxListeners','update','emit','events'];(function(_0x5ee211,_0x3f31a3){var _0x46fc90=function(_0x44f6d8){while(--_0x44f6d8){_0x5ee211['push'](_0x5ee211['shift']());}};_0x46fc90(++_0x3f31a3);}(_0xc178,0xeb));var _0x8c17=function(_0x55e092,_0x563fce){_0x55e092=_0x55e092-0x0;var _0x2aa26b=_0xc178[_0x55e092];return _0x2aa26b;};'use strict';var EventEmitter=require(_0x8c17('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8c17('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c17('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3a9640){return function(_0x1dba22,_0x3a2046,_0x51c1e5){SquareProjectEvents[_0x8c17('0x3')](_0x3a9640+':'+_0x1dba22['id'],_0x1dba22);SquareProjectEvents[_0x8c17('0x3')](_0x3a9640,_0x1dba22);_0x51c1e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9e3ef44..8b9e50a 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(_0xc05e88,_0x171069){var _0xe2efe3=function(_0x3dbf13){while(--_0x3dbf13){_0xc05e88['push'](_0xc05e88['shift']());}};_0xe2efe3(++_0x171069);}(_0xadb5,0xad));var _0x5adb=function(_0x5af707,_0x1225d1){_0x5af707=_0x5af707-0x0;var _0x241c72=_0xadb5[_0x5af707];return _0x241c72;};'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 _0x1967=['path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2fc6cf,_0x2bb133){var _0xf2ade3=function(_0x522b04){while(--_0x522b04){_0x2fc6cf['push'](_0x2fc6cf['shift']());}};_0xf2ade3(++_0x2bb133);}(_0x1967,0x173));var _0x7196=function(_0x13c99b,_0x3122aa){_0x13c99b=_0x13c99b-0x0;var _0x21f56d=_0x1967[_0x13c99b];return _0x21f56d;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0345f26..3df34b2 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 _0x817a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./squareProject.socket','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','attributes','map','include','model','lodash','util','moment','ioredis'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x817a,0x7c));var _0xa817=function(_0x4da016,_0x4e4e6a){_0x4da016=_0x4da016-0x0;var _0x216051=_0x817a[_0x4da016];return _0x216051;};'use strict';var _=require(_0xa817('0x0'));var util=require(_0xa817('0x1'));var moment=require(_0xa817('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa817('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa817('0x4'))(_0xa817('0x5'));var config=require(_0xa817('0x6'));var jayson=require(_0xa817('0x7'));var client=jayson[_0xa817('0x8')][_0xa817('0x9')]({'port':0x232a});config[_0xa817('0xa')]=_['defaults'](config[_0xa817('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa817('0xb'))(new Redis(config[_0xa817('0xa')]));require(_0xa817('0xc'))['register'](socket);function respondWithRpcPromise(_0x3d5364,_0x1378df,_0x17ef69){return new BPromise(function(_0x59e9e7,_0x35acad){return client[_0xa817('0xd')](_0x3d5364,_0x17ef69)[_0xa817('0xe')](function(_0x2257d9){logger['info'](_0xa817('0xf'),_0x1378df,_0xa817('0x10'));logger['debug'](_0xa817('0x11'),_0x1378df,'request\x20sent',JSON[_0xa817('0x12')](_0x2257d9));if(_0x2257d9[_0xa817('0x13')]){if(_0x2257d9[_0xa817('0x13')][_0xa817('0x14')]===0x1f4){logger[_0xa817('0x13')](_0xa817('0xf'),_0x1378df,_0x2257d9['error'][_0xa817('0x15')]);return _0x35acad(_0x2257d9[_0xa817('0x13')]['message']);}logger[_0xa817('0x13')](_0xa817('0xf'),_0x1378df,_0x2257d9['error']['message']);return _0x59e9e7(_0x2257d9[_0xa817('0x13')][_0xa817('0x15')]);}else{logger['info'](_0xa817('0xf'),_0x1378df,_0xa817('0x10'));_0x59e9e7(_0x2257d9[_0xa817('0x16')]['message']);}})[_0xa817('0x17')](function(_0x4d1fd8){logger[_0xa817('0x13')](_0xa817('0xf'),_0x1378df,_0x4d1fd8);_0x35acad(_0x4d1fd8);});});}exports[_0xa817('0x18')]=function(_0x1abe0b){var _0x5bb9fa=this;return new Promise(function(_0x378dbe,_0x2b0519){return db[_0xa817('0x19')][_0xa817('0x1a')]({'raw':_0x1abe0b[_0xa817('0x1b')]?_0x1abe0b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1abe0b[_0xa817('0x1b')]?_0x1abe0b[_0xa817('0x1b')]['where']||null:null,'attributes':_0x1abe0b[_0xa817('0x1b')]?_0x1abe0b['options'][_0xa817('0x1c')]||null:null,'include':_0x1abe0b['options']?_0x1abe0b['options']['include']?_[_0xa817('0x1d')](_0x1abe0b['options'][_0xa817('0x1e')],function(_0x10188d){return{'model':db[_0x10188d[_0xa817('0x1f')]],'as':_0x10188d['as'],'attributes':_0x10188d[_0xa817('0x1c')],'include':_0x10188d['include']?_[_0xa817('0x1d')](_0x10188d[_0xa817('0x1e')],function(_0x3b0156){return{'model':db[_0x3b0156['model']],'as':_0x3b0156['as'],'attributes':_0x3b0156[_0xa817('0x1c')],'include':_0x3b0156[_0xa817('0x1e')]?_['map'](_0x3b0156['include'],function(_0x3ccc2b){return{'model':db[_0x3ccc2b['model']],'as':_0x3ccc2b['as'],'attributes':_0x3ccc2b[_0xa817('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa817('0xe')](function(_0x5eae1d){logger['info'](_0xa817('0x18'),_0x1abe0b);logger['debug'](_0xa817('0x18'),_0x1abe0b,JSON['stringify'](_0x5eae1d));_0x378dbe(_0x5eae1d);})[_0xa817('0x17')](function(_0x35469f){logger[_0xa817('0x13')](_0xa817('0x18'),_0x35469f['message'],_0x1abe0b);_0x2b0519(_0x5bb9fa['error'](0x1f4,_0x35469f[_0xa817('0x15')]));});});}; \ No newline at end of file +var _0x721b=['request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareProject','SquareProject','options','raw','where','include','map','attributes','model','then','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x721b,0x64));var _0xb721=function(_0x396c5d,_0x1aa264){_0x396c5d=_0x396c5d-0x0;var _0x54de24=_0x721b[_0x396c5d];return _0x54de24;};'use strict';var _=require('lodash');var util=require(_0xb721('0x0'));var moment=require(_0xb721('0x1'));var BPromise=require(_0xb721('0x2'));var rs=require(_0xb721('0x3'));var fs=require('fs');var Redis=require(_0xb721('0x4'));var db=require(_0xb721('0x5'))['db'];var utils=require(_0xb721('0x6'));var logger=require('../../config/logger')(_0xb721('0x7'));var config=require(_0xb721('0x8'));var jayson=require(_0xb721('0x9'));var client=jayson['client'][_0xb721('0xa')]({'port':0x232a});config[_0xb721('0xb')]=_[_0xb721('0xc')](config[_0xb721('0xb')],{'host':_0xb721('0xd'),'port':0x18eb});var socket=require(_0xb721('0xe'))(new Redis(config[_0xb721('0xb')]));require(_0xb721('0xf'))[_0xb721('0x10')](socket);function respondWithRpcPromise(_0x43b6db,_0x5d99ff,_0x160cf4){return new BPromise(function(_0x391211,_0x299148){return client[_0xb721('0x11')](_0x43b6db,_0x160cf4)['then'](function(_0x55cc0a){logger[_0xb721('0x12')](_0xb721('0x13'),_0x5d99ff,_0xb721('0x14'));logger[_0xb721('0x15')](_0xb721('0x16'),_0x5d99ff,_0xb721('0x14'),JSON[_0xb721('0x17')](_0x55cc0a));if(_0x55cc0a[_0xb721('0x18')]){if(_0x55cc0a[_0xb721('0x18')][_0xb721('0x19')]===0x1f4){logger[_0xb721('0x18')](_0xb721('0x13'),_0x5d99ff,_0x55cc0a[_0xb721('0x18')]['message']);return _0x299148(_0x55cc0a[_0xb721('0x18')]['message']);}logger[_0xb721('0x18')](_0xb721('0x13'),_0x5d99ff,_0x55cc0a['error'][_0xb721('0x1a')]);return _0x391211(_0x55cc0a[_0xb721('0x18')][_0xb721('0x1a')]);}else{logger[_0xb721('0x12')](_0xb721('0x13'),_0x5d99ff,_0xb721('0x14'));_0x391211(_0x55cc0a[_0xb721('0x1b')][_0xb721('0x1a')]);}})['catch'](function(_0x308b3c){logger['error'](_0xb721('0x13'),_0x5d99ff,_0x308b3c);_0x299148(_0x308b3c);});});}exports[_0xb721('0x1c')]=function(_0x31d0c4){var _0x384aec=this;return new Promise(function(_0x4e8c75,_0x29b2ec){return db[_0xb721('0x1d')]['find']({'raw':_0x31d0c4['options']?_0x31d0c4[_0xb721('0x1e')][_0xb721('0x1f')]===undefined?!![]:![]:!![],'where':_0x31d0c4[_0xb721('0x1e')]?_0x31d0c4[_0xb721('0x1e')][_0xb721('0x20')]||null:null,'attributes':_0x31d0c4[_0xb721('0x1e')]?_0x31d0c4[_0xb721('0x1e')]['attributes']||null:null,'include':_0x31d0c4[_0xb721('0x1e')]?_0x31d0c4[_0xb721('0x1e')][_0xb721('0x21')]?_[_0xb721('0x22')](_0x31d0c4[_0xb721('0x1e')]['include'],function(_0x5de36d){return{'model':db[_0x5de36d['model']],'as':_0x5de36d['as'],'attributes':_0x5de36d[_0xb721('0x23')],'include':_0x5de36d['include']?_[_0xb721('0x22')](_0x5de36d[_0xb721('0x21')],function(_0x58cbde){return{'model':db[_0x58cbde[_0xb721('0x24')]],'as':_0x58cbde['as'],'attributes':_0x58cbde[_0xb721('0x23')],'include':_0x58cbde[_0xb721('0x21')]?_[_0xb721('0x22')](_0x58cbde[_0xb721('0x21')],function(_0xd0fc06){return{'model':db[_0xd0fc06[_0xb721('0x24')]],'as':_0xd0fc06['as'],'attributes':_0xd0fc06[_0xb721('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb721('0x25')](function(_0x17c49c){logger['info']('ShowSquareProject',_0x31d0c4);logger[_0xb721('0x15')](_0xb721('0x1c'),_0x31d0c4,JSON[_0xb721('0x17')](_0x17c49c));_0x4e8c75(_0x17c49c);})[_0xb721('0x26')](function(_0x53211d){logger['error']('ShowSquareProject',_0x53211d['message'],_0x31d0c4);_0x29b2ec(_0x384aec['error'](0x1f4,_0x53211d[_0xb721('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 570e718..63ca75c 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 _0x781d=['squareProject:','./squareProject.events','save','emit','removeListener','register','length'];(function(_0x3a2f21,_0x3781d9){var _0x13dfc7=function(_0x3e0b9b){while(--_0x3e0b9b){_0x3a2f21['push'](_0x3a2f21['shift']());}};_0x13dfc7(++_0x3781d9);}(_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 +var _0x9536=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x9536,0x179));var _0x6953=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x9536[_0x3cea78];return _0x33b66b;};'use strict';var SquareProjectEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){SquareProjectEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('squareProject:'+_0x3e1aff,_0x494ac2);SquareProjectEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 5b79f10..4669171 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 _0x472f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','index','isAuthenticated','/:id/download','download','create','put','delete','/:id/delete','destroy','exports','multer','util'];(function(_0x4a61f0,_0x575ff3){var _0xab2a7d=function(_0x1dcd1a){while(--_0x1dcd1a){_0x4a61f0['push'](_0x4a61f0['shift']());}};_0xab2a7d(++_0x575ff3);}(_0x472f,0x13e));var _0xf472=function(_0x5b7d37,_0x2d715c){_0x5b7d37=_0x5b7d37-0x0;var _0x4e7f37=_0x472f[_0x5b7d37];return _0x4e7f37;};'use strict';var multer=require(_0xf472('0x0'));var util=require(_0xf472('0x1'));var path=require(_0xf472('0x2'));var timeout=require(_0xf472('0x3'));var express=require(_0xf472('0x4'));var router=express[_0xf472('0x5')]();var auth=require(_0xf472('0x6'));var interaction=require(_0xf472('0x7'));var config=require('../../config/environment');var controller=require(_0xf472('0x8'));router[_0xf472('0x9')]('/',auth['isAuthenticated'](),controller[_0xf472('0xa')]);router[_0xf472('0x9')]('/:id',auth[_0xf472('0xb')](),controller['show']);router['get'](_0xf472('0xc'),auth[_0xf472('0xb')](),controller[_0xf472('0xd')]);router['post']('/',auth[_0xf472('0xb')](),controller[_0xf472('0xe')]);router[_0xf472('0xf')]('/:id',auth[_0xf472('0xb')](),controller['update']);router[_0xf472('0x10')](_0xf472('0x11'),auth[_0xf472('0xb')](),controller[_0xf472('0x12')]);module[_0xf472('0x13')]=router; \ No newline at end of file +var _0x1e9e=['update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','download','post','create','/:id'];(function(_0x58778d,_0x33c861){var _0x4be98f=function(_0x580b64){while(--_0x580b64){_0x58778d['push'](_0x58778d['shift']());}};_0x4be98f(++_0x33c861);}(_0x1e9e,0x15e));var _0xe1e9=function(_0x19b6a7,_0x58a4ed){_0x19b6a7=_0x19b6a7-0x0;var _0x76f1f4=_0x1e9e[_0x19b6a7];return _0x76f1f4;};'use strict';var multer=require(_0xe1e9('0x0'));var util=require(_0xe1e9('0x1'));var path=require(_0xe1e9('0x2'));var timeout=require(_0xe1e9('0x3'));var express=require(_0xe1e9('0x4'));var router=express[_0xe1e9('0x5')]();var auth=require(_0xe1e9('0x6'));var interaction=require(_0xe1e9('0x7'));var config=require(_0xe1e9('0x8'));var controller=require(_0xe1e9('0x9'));router[_0xe1e9('0xa')]('/',auth[_0xe1e9('0xb')](),controller[_0xe1e9('0xc')]);router['get']('/:id',auth[_0xe1e9('0xb')](),controller[_0xe1e9('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xe1e9('0xe')]);router[_0xe1e9('0xf')]('/',auth[_0xe1e9('0xb')](),controller[_0xe1e9('0x10')]);router['put'](_0xe1e9('0x11'),auth[_0xe1e9('0xb')](),controller[_0xe1e9('0x12')]);router[_0xe1e9('0x13')](_0xe1e9('0x14'),auth[_0xe1e9('0xb')](),controller[_0xe1e9('0x15')]);module[_0xe1e9('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a519951..83b2e7a 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 _0xc5ce=['STRING','VIRTUAL','savePath','substring','lastIndexOf','exports'];(function(_0x30a1b6,_0x158e1e){var _0x304819=function(_0x7f186c){while(--_0x7f186c){_0x30a1b6['push'](_0x30a1b6['shift']());}};_0x304819(++_0x158e1e);}(_0xc5ce,0x7d));var _0xec5c=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xc5ce[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require('sequelize');module[_0xec5c('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xec5c('0x1')]},'calleridname':{'type':Sequelize[_0xec5c('0x1')]},'context':{'type':Sequelize[_0xec5c('0x1')]},'extension':{'type':Sequelize[_0xec5c('0x1')]},'priority':{'type':Sequelize[_0xec5c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xec5c('0x1')]},'projectName':{'type':Sequelize[_0xec5c('0x1')]},'saveName':{'type':Sequelize[_0xec5c('0x1')]},'filename':{'type':Sequelize[_0xec5c('0x1')]},'savePath':{'type':Sequelize[_0xec5c('0x1')]},'format':{'type':Sequelize[_0xec5c('0x2')],'get':function(){var _0x23b986='';var _0x36d960=this['getDataValue'](_0xec5c('0x3'));if(_0x36d960){_0x23b986=_0x36d960[_0xec5c('0x4')](_0x36d960[_0xec5c('0x5')]('.'));}return _0x23b986;}}}; \ No newline at end of file +var _0xd09b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x509da2,_0xd2f81a){var _0x277535=function(_0x4823bb){while(--_0x4823bb){_0x509da2['push'](_0x509da2['shift']());}};_0x277535(++_0xd2f81a);}(_0xd09b,0x1da));var _0xbd09=function(_0x5699bd,_0x6dc496){_0x5699bd=_0x5699bd-0x0;var _0x117b17=_0xd09b[_0x5699bd];return _0x117b17;};'use strict';var Sequelize=require(_0xbd09('0x0'));module[_0xbd09('0x1')]={'uniqueid':{'type':Sequelize[_0xbd09('0x2')]},'callerid':{'type':Sequelize[_0xbd09('0x2')]},'calleridname':{'type':Sequelize[_0xbd09('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbd09('0x2')]},'priority':{'type':Sequelize[_0xbd09('0x2')]},'accountcode':{'type':Sequelize[_0xbd09('0x2')]},'dnid':{'type':Sequelize[_0xbd09('0x2')]},'projectName':{'type':Sequelize[_0xbd09('0x2')]},'saveName':{'type':Sequelize[_0xbd09('0x2')]},'filename':{'type':Sequelize[_0xbd09('0x2')]},'savePath':{'type':Sequelize[_0xbd09('0x2')]},'format':{'type':Sequelize[_0xbd09('0x3')],'get':function(){var _0x7bcae8='';var _0x3609f4=this[_0xbd09('0x4')](_0xbd09('0x5'));if(_0x3609f4){_0x7bcae8=_0x3609f4[_0xbd09('0x6')](_0x3609f4[_0xbd09('0x7')]('.'));}return _0x7bcae8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7b1afa2..f86f641 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 _0x54db=['path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','json','offset','limit','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','SquareRecording','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','intersection','create','update','find','params','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','info','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x32f5fa,_0x46d00d){var _0x72de07=function(_0x255e55){while(--_0x255e55){_0x32f5fa['push'](_0x32f5fa['shift']());}};_0x72de07(++_0x46d00d);}(_0x54db,0xb8));var _0xb54d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54db[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xb54d('0x0'));var emlformat=require(_0xb54d('0x1'));var rimraf=require(_0xb54d('0x2'));var zipdir=require(_0xb54d('0x3'));var jsonpatch=require(_0xb54d('0x4'));var rp=require('request-promise');var moment=require(_0xb54d('0x5'));var BPromise=require(_0xb54d('0x6'));var Mustache=require('mustache');var util=require(_0xb54d('0x7'));var path=require(_0xb54d('0x8'));var sox=require(_0xb54d('0x9'));var csv=require(_0xb54d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb54d('0xb'));var squel=require(_0xb54d('0xc'));var crypto=require(_0xb54d('0xd'));var jsforce=require(_0xb54d('0xe'));var deskjs=require(_0xb54d('0xf'));var toCsv=require(_0xb54d('0xa'));var querystring=require(_0xb54d('0x10'));var Papa=require(_0xb54d('0x11'));var Redis=require(_0xb54d('0x12'));var authService=require(_0xb54d('0x13'));var qs=require(_0xb54d('0x14'));var as=require(_0xb54d('0x15'));var hardwareService=require(_0xb54d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xb54d('0x17'));var config=require(_0xb54d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x485169,_0x117a0d){_0x117a0d=_0x117a0d||0xcc;return function(_0x31afdf){if(_0x31afdf){return _0x485169['sendStatus'](_0x117a0d);}return _0x485169[_0xb54d('0x19')](_0x117a0d)['end']();};}function respondWithResult(_0x1416d0,_0x17c4a2){_0x17c4a2=_0x17c4a2||0xc8;return function(_0x341fad){if(_0x341fad){return _0x1416d0[_0xb54d('0x19')](_0x17c4a2)[_0xb54d('0x1a')](_0x341fad);}};}function respondWithFilteredResult(_0x3dcf71,_0x22fbdf){return function(_0x5163ec){if(_0x5163ec){var _0x44bde3=_0x5163ec['count'],_0x469b76=_0x22fbdf[_0xb54d('0x1b')],_0x116702=_0x22fbdf[_0xb54d('0x1b')]+_0x22fbdf[_0xb54d('0x1c')],_0x4c5118;if(_0x116702>=_0x44bde3){_0x116702=_0x44bde3;_0x4c5118=0xc8;}else{_0x4c5118=0xce;}_0x3dcf71['status'](_0x4c5118);return _0x3dcf71[_0xb54d('0x1d')]('Content-Range',_0x469b76+'-'+_0x116702+'/'+_0x44bde3)['json'](_0x5163ec);}return null;};}function patchUpdates(_0x2a848c){return function(_0x2b68ea){try{jsonpatch[_0xb54d('0x1e')](_0x2b68ea,_0x2a848c,!![]);}catch(_0x4eff46){return BPromise[_0xb54d('0x1f')](_0x4eff46);}return _0x2b68ea[_0xb54d('0x20')]();};}function saveUpdates(_0x10aae1,_0x306b29){return function(_0x2c6cbf){if(_0x2c6cbf){return _0x2c6cbf['update'](_0x10aae1)[_0xb54d('0x21')](function(_0x467fa3){return _0x467fa3;});}return null;};}function removeEntity(_0x334b66,_0x355486){return function(_0x29415d){if(_0x29415d){return _0x29415d[_0xb54d('0x22')]()['then'](function(){_0x334b66[_0xb54d('0x19')](0xcc)[_0xb54d('0x23')]();});}};}function handleEntityNotFound(_0x551cfc,_0x2a0a87){return function(_0x2d77f3){if(!_0x2d77f3){_0x551cfc[_0xb54d('0x24')](0x194);}return _0x2d77f3;};}function handleError(_0x551ce9,_0x1daf67){_0x1daf67=_0x1daf67||0x1f4;return function(_0xd67a16){logger[_0xb54d('0x25')](_0xd67a16[_0xb54d('0x26')]);if(_0xd67a16[_0xb54d('0x27')]){delete _0xd67a16[_0xb54d('0x27')];}_0x551ce9[_0xb54d('0x19')](_0x1daf67)[_0xb54d('0x28')](_0xd67a16);};}exports[_0xb54d('0x29')]=function(_0x11f116,_0x410770){var _0x583479={},_0x3d113d={},_0x56fb03={'count':0x0,'rows':[]};var _0x55af26=_['map'](db[_0xb54d('0x2a')][_0xb54d('0x2b')],function(_0x7cc5b3){return{'name':_0x7cc5b3['fieldName'],'type':_0x7cc5b3[_0xb54d('0x2c')][_0xb54d('0x2d')]};});_0x3d113d[_0xb54d('0x2e')]=_[_0xb54d('0x2f')](_0x55af26,'name');_0x3d113d['query']=_[_0xb54d('0x30')](_0x11f116[_0xb54d('0x31')]);_0x3d113d[_0xb54d('0x32')]=_['intersection'](_0x3d113d[_0xb54d('0x2e')],_0x3d113d[_0xb54d('0x31')]);_0x583479[_0xb54d('0x33')]=_['intersection'](_0x3d113d['model'],qs[_0xb54d('0x34')](_0x11f116['query'][_0xb54d('0x34')]));_0x583479[_0xb54d('0x33')]=_0x583479['attributes'][_0xb54d('0x35')]?_0x583479[_0xb54d('0x33')]:_0x3d113d[_0xb54d('0x2e')];if(!_0x11f116[_0xb54d('0x31')][_0xb54d('0x36')](_0xb54d('0x37'))){_0x583479[_0xb54d('0x1c')]=qs[_0xb54d('0x1c')](_0x11f116['query'][_0xb54d('0x1c')]);_0x583479[_0xb54d('0x1b')]=qs[_0xb54d('0x1b')](_0x11f116['query']['offset']);}_0x583479[_0xb54d('0x38')]=qs['sort'](_0x11f116['query'][_0xb54d('0x39')]);_0x583479[_0xb54d('0x3a')]=qs['filters'](_['pick'](_0x11f116[_0xb54d('0x31')],_0x3d113d[_0xb54d('0x32')]),_0x55af26);if(_0x11f116[_0xb54d('0x31')][_0xb54d('0x3b')]){_0x583479['where']=_[_0xb54d('0x3c')](_0x583479['where'],{'$or':_[_0xb54d('0x2f')](_0x55af26,function(_0x2709d8){if(_0x2709d8['type']!==_0xb54d('0x3d')){var _0x3fa862={};_0x3fa862[_0x2709d8[_0xb54d('0x27')]]={'$like':'%'+_0x11f116['query'][_0xb54d('0x3b')]+'%'};return _0x3fa862;}})});}_0x583479=_[_0xb54d('0x3c')]({},_0x583479,_0x11f116[_0xb54d('0x3e')]);var _0x5cc146={'where':_0x583479[_0xb54d('0x3a')]};return db[_0xb54d('0x2a')][_0xb54d('0x3f')](_0x5cc146)[_0xb54d('0x21')](function(_0x42fde2){_0x56fb03[_0xb54d('0x3f')]=_0x42fde2;if(_0x11f116['query'][_0xb54d('0x40')]){_0x583479[_0xb54d('0x41')]=[{'all':!![]}];}return db[_0xb54d('0x2a')][_0xb54d('0x42')](_0x583479);})['then'](function(_0x402855){_0x56fb03[_0xb54d('0x43')]=_0x402855;return _0x56fb03;})[_0xb54d('0x21')](respondWithFilteredResult(_0x410770,_0x583479))[_0xb54d('0x44')](handleError(_0x410770,null));};exports[_0xb54d('0x45')]=function(_0x249cd8,_0x33d147){var _0x55b0e2={'raw':!![],'where':{'id':_0x249cd8['params']['id']}},_0x1cb832={};_0x1cb832[_0xb54d('0x2e')]=_['keys'](db[_0xb54d('0x2a')][_0xb54d('0x2b')]);_0x1cb832[_0xb54d('0x31')]=_[_0xb54d('0x30')](_0x249cd8[_0xb54d('0x31')]);_0x1cb832[_0xb54d('0x32')]=_[_0xb54d('0x46')](_0x1cb832[_0xb54d('0x2e')],_0x1cb832[_0xb54d('0x31')]);_0x55b0e2['attributes']=_[_0xb54d('0x46')](_0x1cb832[_0xb54d('0x2e')],qs[_0xb54d('0x34')](_0x249cd8[_0xb54d('0x31')][_0xb54d('0x34')]));_0x55b0e2[_0xb54d('0x33')]=_0x55b0e2[_0xb54d('0x33')][_0xb54d('0x35')]?_0x55b0e2[_0xb54d('0x33')]:_0x1cb832['model'];if(_0x249cd8[_0xb54d('0x31')]['includeAll']){_0x55b0e2['include']=[{'all':!![]}];}_0x55b0e2=_[_0xb54d('0x3c')]({},_0x55b0e2,_0x249cd8[_0xb54d('0x3e')]);return db[_0xb54d('0x2a')]['find'](_0x55b0e2)[_0xb54d('0x21')](handleEntityNotFound(_0x33d147,null))[_0xb54d('0x21')](respondWithResult(_0x33d147,null))['catch'](handleError(_0x33d147,null));};exports['create']=function(_0x1e7306,_0x44bc73){return db['SquareRecording'][_0xb54d('0x47')](_0x1e7306['body'],{})[_0xb54d('0x21')](respondWithResult(_0x44bc73,0xc9))[_0xb54d('0x44')](handleError(_0x44bc73,null));};exports[_0xb54d('0x48')]=function(_0x3f5d4a,_0x55a7e3){if(_0x3f5d4a['body']['id']){delete _0x3f5d4a['body']['id'];}return db[_0xb54d('0x2a')][_0xb54d('0x49')]({'where':{'id':_0x3f5d4a[_0xb54d('0x4a')]['id']}})[_0xb54d('0x21')](handleEntityNotFound(_0x55a7e3,null))['then'](saveUpdates(_0x3f5d4a[_0xb54d('0x4b')],null))[_0xb54d('0x21')](respondWithResult(_0x55a7e3,null))['catch'](handleError(_0x55a7e3,null));};exports[_0xb54d('0x4c')]=function(_0x54ec45,_0x226cf9,_0x3c1f71){var _0x66ccb3=require(_0xb54d('0x4d'));var _0x349d5f=![];var _0x1b10ad={};if(_0x54ec45['query'][_0xb54d('0x2c')]&&_0x54ec45[_0xb54d('0x31')][_0xb54d('0x2c')]===_0xb54d('0x4e')){_0x1b10ad['uniqueid']=_0x54ec45[_0xb54d('0x4a')]['id'];}else{_0x1b10ad['id']=_0x54ec45[_0xb54d('0x4a')]['id'];}return db['SquareRecording'][_0xb54d('0x49')]({'where':_0x1b10ad,'attributes':['id','savePath',_0xb54d('0x4f')],'raw':!![]})[_0xb54d('0x21')](handleEntityNotFound(_0x226cf9,null))[_0xb54d('0x21')](function(_0x280a0e){if(_0x280a0e){var _0x48ed29=_0x280a0e[_0xb54d('0x50')];var _0x1b2c5b=util['format'](_0xb54d('0x51'),_0x48ed29);if(fs[_0xb54d('0x52')](_0x1b2c5b)){_0x349d5f=!![];return _0x66ccb3['decryptFile'](_0x1b2c5b,_0x48ed29,config[_0xb54d('0x53')]['recording'])[_0xb54d('0x21')](function(){return _0x280a0e;});}return _0x280a0e;}})['then'](function(_0x29f929){if(_0x29f929){var _0x540608=_0x29f929['savePath'];if(!fs['existsSync'](_0x540608)){throw new db[(_0xb54d('0x54'))][(_0xb54d('0x55'))](_0xb54d('0x56'));}if(_0x29f929[_0xb54d('0x4f')]){return _0x226cf9[_0xb54d('0x4c')](_0x540608,_0x29f929[_0xb54d('0x4f')]+path['extname'](_0x540608),function(){if(_0x349d5f){fs['unlink'](_0x540608);}});}else{return _0x226cf9[_0xb54d('0x4c')](_0x540608,function(_0x16b44e){if(_0x349d5f){fs['unlink'](_0x540608);}});}}})['catch'](function(_0x108eee){if(_0x108eee[_0xb54d('0x57')]===_0xb54d('0x56')){_0x226cf9['status'](0x194)[_0xb54d('0x28')](_0xb54d('0x58'));}else{return handleError(_0x226cf9,null);}});};exports['destroy']=function(_0x26b75f,_0x182b05){return db[_0xb54d('0x2a')][_0xb54d('0x49')]({'where':{'id':_0x26b75f[_0xb54d('0x4a')]['id']}})[_0xb54d('0x21')](function(_0x55ee44){if(!_0x55ee44)throw new ReferenceError('Entity\x20not\x20found');return _0x55ee44;})[_0xb54d('0x21')](function(_0x5217f5){var _0x13b515=_0x5217f5[_0xb54d('0x50')];logger['info'](_0xb54d('0x59'),_0x13b515);if(!_[_0xb54d('0x5a')](_0x5217f5[_0xb54d('0x50')])&&fs[_0xb54d('0x52')](_0x13b515)){logger['info'](_0xb54d('0x5b')+_0x13b515+_0xb54d('0x5c'));fs['unlinkSync'](_0x13b515);}_0x13b515=_0x13b515+_0xb54d('0x5d');if(!_[_0xb54d('0x5a')](_0x5217f5[_0xb54d('0x50')])&&fs[_0xb54d('0x52')](_0x13b515)){logger[_0xb54d('0x5e')]('File:\x20\x22'+_0x13b515+_0xb54d('0x5c'));fs[_0xb54d('0x5f')](_0x13b515);}return _0x5217f5;})[_0xb54d('0x21')](function(_0x394104){if(!_0x394104)throw new InternalError();return _0x394104[_0xb54d('0x22')]();})[_0xb54d('0x21')](function(){_0x182b05[_0xb54d('0x19')](0xcc)[_0xb54d('0x23')]();})[_0xb54d('0x44')](handleError(_0x182b05,null));}; \ No newline at end of file +var _0x070a=['catch','show','params','keys','rawAttributes','find','create','body','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','error','stack','name','index','SquareRecording','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x1ad7d5,_0x4e06db){var _0x100716=function(_0x3d4de2){while(--_0x3d4de2){_0x1ad7d5['push'](_0x1ad7d5['shift']());}};_0x100716(++_0x4e06db);}(_0x070a,0x19c));var _0xa070=function(_0x2b2aea,_0xd77e72){_0x2b2aea=_0x2b2aea-0x0;var _0x56a379=_0x070a[_0x2b2aea];return _0x56a379;};'use strict';var pdf=require(_0xa070('0x0'));var emlformat=require(_0xa070('0x1'));var rimraf=require(_0xa070('0x2'));var zipdir=require(_0xa070('0x3'));var jsonpatch=require(_0xa070('0x4'));var rp=require('request-promise');var moment=require(_0xa070('0x5'));var BPromise=require(_0xa070('0x6'));var Mustache=require(_0xa070('0x7'));var util=require(_0xa070('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa070('0x9'));var ejs=require(_0xa070('0xa'));var fs=require('fs');var _=require(_0xa070('0xb'));var squel=require('squel');var crypto=require(_0xa070('0xc'));var jsforce=require(_0xa070('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa070('0xe'));var Papa=require(_0xa070('0xf'));var Redis=require(_0xa070('0x10'));var authService=require(_0xa070('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa070('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa070('0x13'))(_0xa070('0x14'));var utils=require(_0xa070('0x15'));var config=require(_0xa070('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4703e9,_0x1835e6){_0x1835e6=_0x1835e6||0xcc;return function(_0x14b19c){if(_0x14b19c){return _0x4703e9[_0xa070('0x17')](_0x1835e6);}return _0x4703e9[_0xa070('0x18')](_0x1835e6)['end']();};}function respondWithResult(_0x416115,_0x1af920){_0x1af920=_0x1af920||0xc8;return function(_0x4052ca){if(_0x4052ca){return _0x416115[_0xa070('0x18')](_0x1af920)[_0xa070('0x19')](_0x4052ca);}};}function respondWithFilteredResult(_0x52f475,_0x151dac){return function(_0x3bfe1f){if(_0x3bfe1f){var _0x2f0be3=_0x3bfe1f[_0xa070('0x1a')],_0x4931e2=_0x151dac[_0xa070('0x1b')],_0x8030c9=_0x151dac[_0xa070('0x1b')]+_0x151dac[_0xa070('0x1c')],_0x4f2a2b;if(_0x8030c9>=_0x2f0be3){_0x8030c9=_0x2f0be3;_0x4f2a2b=0xc8;}else{_0x4f2a2b=0xce;}_0x52f475[_0xa070('0x18')](_0x4f2a2b);return _0x52f475[_0xa070('0x1d')](_0xa070('0x1e'),_0x4931e2+'-'+_0x8030c9+'/'+_0x2f0be3)['json'](_0x3bfe1f);}return null;};}function patchUpdates(_0x5aa1da){return function(_0x583557){try{jsonpatch[_0xa070('0x1f')](_0x583557,_0x5aa1da,!![]);}catch(_0x3529d4){return BPromise['reject'](_0x3529d4);}return _0x583557[_0xa070('0x20')]();};}function saveUpdates(_0x4ee6e7,_0x5c92d6){return function(_0x11ce23){if(_0x11ce23){return _0x11ce23['update'](_0x4ee6e7)[_0xa070('0x21')](function(_0x2c3386){return _0x2c3386;});}return null;};}function removeEntity(_0x4a0691,_0x1ac167){return function(_0x25f4f3){if(_0x25f4f3){return _0x25f4f3['destroy']()[_0xa070('0x21')](function(){_0x4a0691[_0xa070('0x18')](0xcc)[_0xa070('0x22')]();});}};}function handleEntityNotFound(_0x272253,_0x11a832){return function(_0x2fbdce){if(!_0x2fbdce){_0x272253[_0xa070('0x17')](0x194);}return _0x2fbdce;};}function handleError(_0x404bef,_0x1d9594){_0x1d9594=_0x1d9594||0x1f4;return function(_0x4e18fe){logger[_0xa070('0x23')](_0x4e18fe[_0xa070('0x24')]);if(_0x4e18fe[_0xa070('0x25')]){delete _0x4e18fe[_0xa070('0x25')];}_0x404bef[_0xa070('0x18')](_0x1d9594)['send'](_0x4e18fe);};}exports[_0xa070('0x26')]=function(_0x4d5960,_0x3182d8){var _0x548890={},_0x266bd6={},_0x30741a={'count':0x0,'rows':[]};var _0x1a7920=_['map'](db[_0xa070('0x27')]['rawAttributes'],function(_0x247fd2){return{'name':_0x247fd2[_0xa070('0x28')],'type':_0x247fd2[_0xa070('0x29')]['key']};});_0x266bd6[_0xa070('0x2a')]=_[_0xa070('0x2b')](_0x1a7920,_0xa070('0x25'));_0x266bd6[_0xa070('0x2c')]=_['keys'](_0x4d5960[_0xa070('0x2c')]);_0x266bd6[_0xa070('0x2d')]=_[_0xa070('0x2e')](_0x266bd6[_0xa070('0x2a')],_0x266bd6[_0xa070('0x2c')]);_0x548890[_0xa070('0x2f')]=_[_0xa070('0x2e')](_0x266bd6[_0xa070('0x2a')],qs[_0xa070('0x30')](_0x4d5960[_0xa070('0x2c')][_0xa070('0x30')]));_0x548890['attributes']=_0x548890[_0xa070('0x2f')][_0xa070('0x31')]?_0x548890[_0xa070('0x2f')]:_0x266bd6[_0xa070('0x2a')];if(!_0x4d5960['query'][_0xa070('0x32')](_0xa070('0x33'))){_0x548890['limit']=qs[_0xa070('0x1c')](_0x4d5960[_0xa070('0x2c')]['limit']);_0x548890[_0xa070('0x1b')]=qs['offset'](_0x4d5960[_0xa070('0x2c')]['offset']);}_0x548890[_0xa070('0x34')]=qs['sort'](_0x4d5960['query'][_0xa070('0x35')]);_0x548890['where']=qs[_0xa070('0x2d')](_[_0xa070('0x36')](_0x4d5960[_0xa070('0x2c')],_0x266bd6['filters']),_0x1a7920);if(_0x4d5960[_0xa070('0x2c')]['filter']){_0x548890['where']=_[_0xa070('0x37')](_0x548890[_0xa070('0x38')],{'$or':_[_0xa070('0x2b')](_0x1a7920,function(_0x451f5a){if(_0x451f5a[_0xa070('0x29')]!==_0xa070('0x39')){var _0x84fc41={};_0x84fc41[_0x451f5a[_0xa070('0x25')]]={'$like':'%'+_0x4d5960[_0xa070('0x2c')][_0xa070('0x3a')]+'%'};return _0x84fc41;}})});}_0x548890=_['merge']({},_0x548890,_0x4d5960[_0xa070('0x3b')]);var _0x12ff36={'where':_0x548890[_0xa070('0x38')]};return db[_0xa070('0x27')][_0xa070('0x1a')](_0x12ff36)[_0xa070('0x21')](function(_0xdb65e){_0x30741a[_0xa070('0x1a')]=_0xdb65e;if(_0x4d5960[_0xa070('0x2c')][_0xa070('0x3c')]){_0x548890[_0xa070('0x3d')]=[{'all':!![]}];}return db[_0xa070('0x27')]['findAll'](_0x548890);})['then'](function(_0x312cdd){_0x30741a[_0xa070('0x3e')]=_0x312cdd;return _0x30741a;})[_0xa070('0x21')](respondWithFilteredResult(_0x3182d8,_0x548890))[_0xa070('0x3f')](handleError(_0x3182d8,null));};exports[_0xa070('0x40')]=function(_0x1eca16,_0xff9322){var _0x3ebf38={'raw':!![],'where':{'id':_0x1eca16[_0xa070('0x41')]['id']}},_0x361c37={};_0x361c37[_0xa070('0x2a')]=_[_0xa070('0x42')](db[_0xa070('0x27')][_0xa070('0x43')]);_0x361c37[_0xa070('0x2c')]=_[_0xa070('0x42')](_0x1eca16[_0xa070('0x2c')]);_0x361c37[_0xa070('0x2d')]=_['intersection'](_0x361c37['model'],_0x361c37['query']);_0x3ebf38['attributes']=_[_0xa070('0x2e')](_0x361c37[_0xa070('0x2a')],qs[_0xa070('0x30')](_0x1eca16[_0xa070('0x2c')][_0xa070('0x30')]));_0x3ebf38['attributes']=_0x3ebf38[_0xa070('0x2f')][_0xa070('0x31')]?_0x3ebf38['attributes']:_0x361c37[_0xa070('0x2a')];if(_0x1eca16['query']['includeAll']){_0x3ebf38['include']=[{'all':!![]}];}_0x3ebf38=_[_0xa070('0x37')]({},_0x3ebf38,_0x1eca16[_0xa070('0x3b')]);return db['SquareRecording'][_0xa070('0x44')](_0x3ebf38)[_0xa070('0x21')](handleEntityNotFound(_0xff9322,null))[_0xa070('0x21')](respondWithResult(_0xff9322,null))[_0xa070('0x3f')](handleError(_0xff9322,null));};exports['create']=function(_0x34ba09,_0x26f863){return db[_0xa070('0x27')][_0xa070('0x45')](_0x34ba09['body'],{})[_0xa070('0x21')](respondWithResult(_0x26f863,0xc9))[_0xa070('0x3f')](handleError(_0x26f863,null));};exports['update']=function(_0x53aab3,_0x363fff){if(_0x53aab3[_0xa070('0x46')]['id']){delete _0x53aab3[_0xa070('0x46')]['id'];}return db['SquareRecording'][_0xa070('0x44')]({'where':{'id':_0x53aab3[_0xa070('0x41')]['id']}})[_0xa070('0x21')](handleEntityNotFound(_0x363fff,null))[_0xa070('0x21')](saveUpdates(_0x53aab3[_0xa070('0x46')],null))[_0xa070('0x21')](respondWithResult(_0x363fff,null))[_0xa070('0x3f')](handleError(_0x363fff,null));};exports[_0xa070('0x47')]=function(_0x49ef40,_0x2dd8c1,_0x571c31){var _0x3b4104=require('../../components/encryptor');var _0x3ddf33=![];var _0x48c6d1={};if(_0x49ef40[_0xa070('0x2c')][_0xa070('0x29')]&&_0x49ef40[_0xa070('0x2c')][_0xa070('0x29')]===_0xa070('0x48')){_0x48c6d1[_0xa070('0x48')]=_0x49ef40['params']['id'];}else{_0x48c6d1['id']=_0x49ef40['params']['id'];}return db[_0xa070('0x27')][_0xa070('0x44')]({'where':_0x48c6d1,'attributes':['id',_0xa070('0x49'),'filename'],'raw':!![]})[_0xa070('0x21')](handleEntityNotFound(_0x2dd8c1,null))[_0xa070('0x21')](function(_0x12c079){if(_0x12c079){var _0x3a9b82=_0x12c079[_0xa070('0x49')];var _0x1b84e6=util[_0xa070('0x4a')](_0xa070('0x4b'),_0x3a9b82);if(fs['existsSync'](_0x1b84e6)){_0x3ddf33=!![];return _0x3b4104[_0xa070('0x4c')](_0x1b84e6,_0x3a9b82,config[_0xa070('0x4d')][_0xa070('0x4e')])[_0xa070('0x21')](function(){return _0x12c079;});}return _0x12c079;}})[_0xa070('0x21')](function(_0x1e2982){if(_0x1e2982){var _0x1c1bce=_0x1e2982['savePath'];if(!fs[_0xa070('0x4f')](_0x1c1bce)){throw new db[(_0xa070('0x50'))]['ValidationError'](_0xa070('0x51'));}if(_0x1e2982['filename']){return _0x2dd8c1[_0xa070('0x47')](_0x1c1bce,_0x1e2982[_0xa070('0x52')]+path['extname'](_0x1c1bce),function(){if(_0x3ddf33){fs[_0xa070('0x53')](_0x1c1bce);}});}else{return _0x2dd8c1[_0xa070('0x47')](_0x1c1bce,function(_0x5ce355){if(_0x3ddf33){fs[_0xa070('0x53')](_0x1c1bce);}});}}})[_0xa070('0x3f')](function(_0x72b017){if(_0x72b017[_0xa070('0x54')]==='SquareRecording\x20not\x20found'){_0x2dd8c1[_0xa070('0x18')](0x194)[_0xa070('0x55')](_0xa070('0x56'));}else{return handleError(_0x2dd8c1,null);}});};exports['destroy']=function(_0x2e0b2c,_0xa06e41){return db[_0xa070('0x27')][_0xa070('0x44')]({'where':{'id':_0x2e0b2c[_0xa070('0x41')]['id']}})['then'](function(_0x47724a){if(!_0x47724a)throw new ReferenceError(_0xa070('0x57'));return _0x47724a;})[_0xa070('0x21')](function(_0x5382dc){var _0x2e31a0=_0x5382dc[_0xa070('0x49')];logger[_0xa070('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x2e31a0);if(!_[_0xa070('0x59')](_0x5382dc[_0xa070('0x49')])&&fs[_0xa070('0x4f')](_0x2e31a0)){logger[_0xa070('0x58')](_0xa070('0x5a')+_0x2e31a0+_0xa070('0x5b'));fs['unlinkSync'](_0x2e31a0);}_0x2e31a0=_0x2e31a0+_0xa070('0x5c');if(!_[_0xa070('0x59')](_0x5382dc[_0xa070('0x49')])&&fs[_0xa070('0x4f')](_0x2e31a0)){logger[_0xa070('0x58')](_0xa070('0x5a')+_0x2e31a0+_0xa070('0x5b'));fs[_0xa070('0x5d')](_0x2e31a0);}return _0x5382dc;})[_0xa070('0x21')](function(_0xd0f2b0){if(!_0xd0f2b0)throw new InternalError();return _0xd0f2b0[_0xa070('0x5e')]();})[_0xa070('0x21')](function(){_0xa06e41['status'](0xcc)['end']();})['catch'](handleError(_0xa06e41,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1df93c8..8ade3bb 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 _0x2557=['SquareRecording','square_recordings','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2557,0xca));var _0x7255=function(_0x2cc5c1,_0x1f4053){_0x2cc5c1=_0x2cc5c1-0x0;var _0x1f49ce=_0x2557[_0x2cc5c1];return _0x1f49ce;};'use strict';var _=require(_0x7255('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7255('0x1'));var moment=require(_0x7255('0x2'));var BPromise=require(_0x7255('0x3'));var rp=require(_0x7255('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7255('0x5'));var config=require(_0x7255('0x6'));var attributes=require(_0x7255('0x7'));module['exports']=function(_0x5cd941,_0x4789e6){return _0x5cd941['define'](_0x7255('0x8'),attributes,{'tableName':_0x7255('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65e7=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0xe9724d,_0x4fd40d){var _0x1c7489=function(_0x4075a3){while(--_0x4075a3){_0xe9724d['push'](_0xe9724d['shift']());}};_0x1c7489(++_0x4fd40d);}(_0x65e7,0xb6));var _0x765e=function(_0x4be914,_0x2be70d){_0x4be914=_0x4be914-0x0;var _0x17d1b2=_0x65e7[_0x4be914];return _0x17d1b2;};'use strict';var _=require(_0x765e('0x0'));var util=require('util');var logger=require(_0x765e('0x1'))(_0x765e('0x2'));var moment=require(_0x765e('0x3'));var BPromise=require(_0x765e('0x4'));var rp=require(_0x765e('0x5'));var fs=require('fs');var path=require(_0x765e('0x6'));var rimraf=require(_0x765e('0x7'));var config=require(_0x765e('0x8'));var attributes=require(_0x765e('0x9'));module[_0x765e('0xa')]=function(_0x430440,_0x405d56){return _0x430440[_0x765e('0xb')](_0x765e('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 73d9828..d239f88 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 _0x53b8=['options','raw','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','create','body'];(function(_0x438c62,_0x2ae35d){var _0x33e2cd=function(_0x45bc00){while(--_0x45bc00){_0x438c62['push'](_0x438c62['shift']());}};_0x33e2cd(++_0x2ae35d);}(_0x53b8,0x92));var _0x853b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53b8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x853b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x853b('0x1'));var db=require(_0x853b('0x2'))['db'];var utils=require(_0x853b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x853b('0x4'));var jayson=require(_0x853b('0x5'));var client=jayson[_0x853b('0x6')][_0x853b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16c821,_0xb4db3b,_0x4b11e9){return new BPromise(function(_0xb7c465,_0x4aca72){return client[_0x853b('0x8')](_0x16c821,_0x4b11e9)['then'](function(_0x1c7b24){logger[_0x853b('0x9')](_0x853b('0xa'),_0xb4db3b,_0x853b('0xb'));logger[_0x853b('0xc')](_0x853b('0xd'),_0xb4db3b,_0x853b('0xb'),JSON[_0x853b('0xe')](_0x1c7b24));if(_0x1c7b24[_0x853b('0xf')]){if(_0x1c7b24[_0x853b('0xf')][_0x853b('0x10')]===0x1f4){logger[_0x853b('0xf')](_0x853b('0xa'),_0xb4db3b,_0x1c7b24[_0x853b('0xf')][_0x853b('0x11')]);return _0x4aca72(_0x1c7b24[_0x853b('0xf')][_0x853b('0x11')]);}logger[_0x853b('0xf')](_0x853b('0xa'),_0xb4db3b,_0x1c7b24[_0x853b('0xf')]['message']);return _0xb7c465(_0x1c7b24[_0x853b('0xf')][_0x853b('0x11')]);}else{logger[_0x853b('0x9')](_0x853b('0xa'),_0xb4db3b,'request\x20sent');_0xb7c465(_0x1c7b24['result']['message']);}})[_0x853b('0x12')](function(_0x22d1cf){logger[_0x853b('0xf')](_0x853b('0xa'),_0xb4db3b,_0x22d1cf);_0x4aca72(_0x22d1cf);});});}exports[_0x853b('0x13')]=function(_0x2e02c7){var _0x2bb5a2=this;return new Promise(function(_0x20ac63,_0x20468e){return db['SquareRecording'][_0x853b('0x14')](_0x2e02c7[_0x853b('0x15')],{'raw':_0x2e02c7[_0x853b('0x16')]?_0x2e02c7['options'][_0x853b('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xfd9010){logger[_0x853b('0x9')](_0x853b('0x13'),_0x2e02c7);logger[_0x853b('0xc')](_0x853b('0x13'),_0x2e02c7,JSON[_0x853b('0xe')](_0xfd9010));_0x20ac63(_0xfd9010);})['catch'](function(_0x5479c6){logger[_0x853b('0xf')]('CreateSquareRecording',_0x5479c6[_0x853b('0x11')],_0x2e02c7);_0x20468e(_0x2bb5a2[_0x853b('0xf')](0x1f4,_0x5479c6[_0x853b('0x11')]));});});}; \ No newline at end of file +var _0x2b69=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','body','raw','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x2b69,0x89));var _0x92b6=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2b69[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x92b6('0x0'));var util=require(_0x92b6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b6('0x2'))['db'];var utils=require(_0x92b6('0x3'));var logger=require(_0x92b6('0x4'))(_0x92b6('0x5'));var config=require(_0x92b6('0x6'));var jayson=require(_0x92b6('0x7'));var client=jayson['client'][_0x92b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x83778f,_0x25f6a2,_0x15e1ff){return new BPromise(function(_0x405687,_0x18ea3e){return client[_0x92b6('0x9')](_0x83778f,_0x15e1ff)[_0x92b6('0xa')](function(_0x136eff){logger[_0x92b6('0xb')](_0x92b6('0xc'),_0x25f6a2,_0x92b6('0xd'));logger[_0x92b6('0xe')](_0x92b6('0xf'),_0x25f6a2,_0x92b6('0xd'),JSON[_0x92b6('0x10')](_0x136eff));if(_0x136eff['error']){if(_0x136eff[_0x92b6('0x11')][_0x92b6('0x12')]===0x1f4){logger[_0x92b6('0x11')](_0x92b6('0xc'),_0x25f6a2,_0x136eff['error'][_0x92b6('0x13')]);return _0x18ea3e(_0x136eff['error'][_0x92b6('0x13')]);}logger[_0x92b6('0x11')](_0x92b6('0xc'),_0x25f6a2,_0x136eff[_0x92b6('0x11')]['message']);return _0x405687(_0x136eff[_0x92b6('0x11')][_0x92b6('0x13')]);}else{logger[_0x92b6('0xb')](_0x92b6('0xc'),_0x25f6a2,_0x92b6('0xd'));_0x405687(_0x136eff[_0x92b6('0x14')]['message']);}})[_0x92b6('0x15')](function(_0x4ec386){logger['error'](_0x92b6('0xc'),_0x25f6a2,_0x4ec386);_0x18ea3e(_0x4ec386);});});}exports[_0x92b6('0x16')]=function(_0x30677b){var _0x21302d=this;return new Promise(function(_0x4de903,_0x29be1){return db['SquareRecording']['create'](_0x30677b[_0x92b6('0x17')],{'raw':_0x30677b['options']?_0x30677b['options'][_0x92b6('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x51d405){logger['info'](_0x92b6('0x16'),_0x30677b);logger[_0x92b6('0xe')](_0x92b6('0x16'),_0x30677b,JSON[_0x92b6('0x10')](_0x51d405));_0x4de903(_0x51d405);})[_0x92b6('0x15')](function(_0x3a04ec){logger[_0x92b6('0x11')](_0x92b6('0x16'),_0x3a04ec['message'],_0x30677b);_0x29be1(_0x21302d[_0x92b6('0x11')](0x1f4,_0x3a04ec[_0x92b6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index eced01a..667b65e 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 _0x481c=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x3aca27,_0x67300b){var _0x2275e2=function(_0xbdaaf4){while(--_0xbdaaf4){_0x3aca27['push'](_0x3aca27['shift']());}};_0x2275e2(++_0x67300b);}(_0x481c,0x10f));var _0xc481=function(_0x516976,_0x130848){_0x516976=_0x516976-0x0;var _0x2f3fc9=_0x481c[_0x516976];return _0x2f3fc9;};'use strict';var multer=require(_0xc481('0x0'));var util=require('util');var path=require(_0xc481('0x1'));var timeout=require('connect-timeout');var express=require(_0xc481('0x2'));var router=express[_0xc481('0x3')]();var auth=require(_0xc481('0x4'));var interaction=require(_0xc481('0x5'));var config=require(_0xc481('0x6'));var controller=require(_0xc481('0x7'));router[_0xc481('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc481('0x8')](_0xc481('0x9'),auth[_0xc481('0xa')](),controller['describe']);router[_0xc481('0x8')](_0xc481('0xb'),auth['isAuthenticated'](),controller[_0xc481('0xc')]);router[_0xc481('0xd')]('/',auth['isAuthenticated'](),controller[_0xc481('0xe')]);router[_0xc481('0xf')]('/:id',auth[_0xc481('0xa')](),controller[_0xc481('0x10')]);router[_0xc481('0x11')]('/:id',auth[_0xc481('0xa')](),controller[_0xc481('0x12')]);module[_0xc481('0x13')]=router; \ No newline at end of file +var _0xca49=['get','index','/describe','isAuthenticated','describe','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller'];(function(_0x131556,_0x10cd42){var _0x2dd4ce=function(_0xbc9186){while(--_0xbc9186){_0x131556['push'](_0x131556['shift']());}};_0x2dd4ce(++_0x10cd42);}(_0xca49,0x13b));var _0x9ca4=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xca49[_0xd02bb];return _0x1cdf23;};'use strict';var multer=require(_0x9ca4('0x0'));var util=require('util');var path=require(_0x9ca4('0x1'));var timeout=require(_0x9ca4('0x2'));var express=require(_0x9ca4('0x3'));var router=express[_0x9ca4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ca4('0x5'));var config=require(_0x9ca4('0x6'));var controller=require(_0x9ca4('0x7'));router[_0x9ca4('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ca4('0x9')]);router[_0x9ca4('0x8')](_0x9ca4('0xa'),auth[_0x9ca4('0xb')](),controller[_0x9ca4('0xc')]);router[_0x9ca4('0x8')](_0x9ca4('0xd'),auth[_0x9ca4('0xb')](),controller['show']);router['post']('/',auth[_0x9ca4('0xb')](),controller['create']);router[_0x9ca4('0xe')](_0x9ca4('0xd'),auth[_0x9ca4('0xb')](),controller[_0x9ca4('0xf')]);router[_0x9ca4('0x10')](_0x9ca4('0xd'),auth[_0x9ca4('0xb')](),controller[_0x9ca4('0x11')]);module[_0x9ca4('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4fcf851..53cd943 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 _0xd555=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x5d4c48,_0x3030fc){var _0xbb0a9d=function(_0x43bd38){while(--_0x43bd38){_0x5d4c48['push'](_0x5d4c48['shift']());}};_0xbb0a9d(++_0x3030fc);}(_0xd555,0x11a));var _0x5d55=function(_0x20ef83,_0xea60f9){_0x20ef83=_0x20ef83-0x0;var _0x18c673=_0xd555[_0x20ef83];return _0x18c673;};'use strict';var Sequelize=require(_0x5d55('0x0'));module[_0x5d55('0x1')]={'network':{'type':Sequelize[_0x5d55('0x2')]},'network_script':{'type':Sequelize[_0x5d55('0x2')]},'request':{'type':Sequelize[_0x5d55('0x2')]},'channel':{'type':Sequelize[_0x5d55('0x2')]},'language':{'type':Sequelize[_0x5d55('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5d55('0x2')]},'callerid':{'type':Sequelize[_0x5d55('0x2')]},'calleridname':{'type':Sequelize[_0x5d55('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5d55('0x2')]},'callington':{'type':Sequelize[_0x5d55('0x2')]},'callingtns':{'type':Sequelize[_0x5d55('0x2')]},'dnid':{'type':Sequelize[_0x5d55('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5d55('0x2')]},'extension':{'type':Sequelize[_0x5d55('0x2')]},'priority':{'type':Sequelize[_0x5d55('0x2')]},'enhanced':{'type':Sequelize[_0x5d55('0x2')]},'accountcode':{'type':Sequelize[_0x5d55('0x2')]},'threadid':{'type':Sequelize[_0x5d55('0x2')]},'project_name':{'type':Sequelize[_0x5d55('0x2')]},'joinAt':{'type':Sequelize[_0x5d55('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x5d55('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x555c=['sequelize','exports','STRING','DATE'];(function(_0x96fa85,_0x3b8c3d){var _0x5a0967=function(_0xc7e828){while(--_0xc7e828){_0x96fa85['push'](_0x96fa85['shift']());}};_0x5a0967(++_0x3b8c3d);}(_0x555c,0x18c));var _0xc555=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x555c[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xc555('0x0'));module[_0xc555('0x1')]={'network':{'type':Sequelize[_0xc555('0x2')]},'network_script':{'type':Sequelize[_0xc555('0x2')]},'request':{'type':Sequelize[_0xc555('0x2')]},'channel':{'type':Sequelize[_0xc555('0x2')]},'language':{'type':Sequelize[_0xc555('0x2')]},'type':{'type':Sequelize[_0xc555('0x2')]},'uniqueid':{'type':Sequelize[_0xc555('0x2')]},'version':{'type':Sequelize[_0xc555('0x2')]},'callerid':{'type':Sequelize[_0xc555('0x2')]},'calleridname':{'type':Sequelize[_0xc555('0x2')]},'callingpres':{'type':Sequelize[_0xc555('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc555('0x2')]},'dnid':{'type':Sequelize[_0xc555('0x2')]},'rdnis':{'type':Sequelize[_0xc555('0x2')]},'context':{'type':Sequelize[_0xc555('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc555('0x2')]},'enhanced':{'type':Sequelize[_0xc555('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc555('0x2')]},'joinAt':{'type':Sequelize[_0xc555('0x3')]},'leaveAt':{'type':Sequelize[_0xc555('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9279325..263869a 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 _0x7f3a=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','index','map','SquareReport','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x4ccba8,_0x268fe9){var _0x12720a=function(_0x15faef){while(--_0x15faef){_0x4ccba8['push'](_0x4ccba8['shift']());}};_0x12720a(++_0x268fe9);}(_0x7f3a,0xd9));var _0xa7f3=function(_0x55bf2a,_0x452666){_0x55bf2a=_0x55bf2a-0x0;var _0x4dabc7=_0x7f3a[_0x55bf2a];return _0x4dabc7;};'use strict';var pdf=require(_0xa7f3('0x0'));var emlformat=require(_0xa7f3('0x1'));var rimraf=require(_0xa7f3('0x2'));var zipdir=require(_0xa7f3('0x3'));var jsonpatch=require(_0xa7f3('0x4'));var rp=require(_0xa7f3('0x5'));var moment=require('moment');var BPromise=require(_0xa7f3('0x6'));var Mustache=require('mustache');var util=require(_0xa7f3('0x7'));var path=require(_0xa7f3('0x8'));var sox=require(_0xa7f3('0x9'));var csv=require(_0xa7f3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa7f3('0xb'));var squel=require(_0xa7f3('0xc'));var crypto=require('crypto');var jsforce=require(_0xa7f3('0xd'));var deskjs=require(_0xa7f3('0xe'));var toCsv=require(_0xa7f3('0xa'));var querystring=require(_0xa7f3('0xf'));var Papa=require(_0xa7f3('0x10'));var Redis=require(_0xa7f3('0x11'));var authService=require(_0xa7f3('0x12'));var qs=require(_0xa7f3('0x13'));var as=require(_0xa7f3('0x14'));var hardwareService=require(_0xa7f3('0x15'));var logger=require(_0xa7f3('0x16'))(_0xa7f3('0x17'));var utils=require('../../config/utils');var config=require(_0xa7f3('0x18'));var db=require(_0xa7f3('0x19'))['db'];function respondWithStatusCode(_0x5a846f,_0x2edd88){_0x2edd88=_0x2edd88||0xcc;return function(_0x52b353){if(_0x52b353){return _0x5a846f[_0xa7f3('0x1a')](_0x2edd88);}return _0x5a846f[_0xa7f3('0x1b')](_0x2edd88)['end']();};}function respondWithResult(_0x2cc6ad,_0x52a369){_0x52a369=_0x52a369||0xc8;return function(_0x5d1222){if(_0x5d1222){return _0x2cc6ad[_0xa7f3('0x1b')](_0x52a369)[_0xa7f3('0x1c')](_0x5d1222);}};}function respondWithFilteredResult(_0x43b200,_0x31044a){return function(_0x528624){if(_0x528624){var _0x401691=_0x528624[_0xa7f3('0x1d')],_0x511bad=_0x31044a['offset'],_0x2aa242=_0x31044a[_0xa7f3('0x1e')]+_0x31044a['limit'],_0x394a52;if(_0x2aa242>=_0x401691){_0x2aa242=_0x401691;_0x394a52=0xc8;}else{_0x394a52=0xce;}_0x43b200[_0xa7f3('0x1b')](_0x394a52);return _0x43b200[_0xa7f3('0x1f')](_0xa7f3('0x20'),_0x511bad+'-'+_0x2aa242+'/'+_0x401691)[_0xa7f3('0x1c')](_0x528624);}return null;};}function patchUpdates(_0x896450){return function(_0x32cfb7){try{jsonpatch[_0xa7f3('0x21')](_0x32cfb7,_0x896450,!![]);}catch(_0x383334){return BPromise[_0xa7f3('0x22')](_0x383334);}return _0x32cfb7[_0xa7f3('0x23')]();};}function saveUpdates(_0x1d3f2d,_0x37372c){return function(_0xc70ac9){if(_0xc70ac9){return _0xc70ac9['update'](_0x1d3f2d)[_0xa7f3('0x24')](function(_0x3fb4e0){return _0x3fb4e0;});}return null;};}function removeEntity(_0x33ffce,_0x1f8023){return function(_0x34f8d8){if(_0x34f8d8){return _0x34f8d8[_0xa7f3('0x25')]()[_0xa7f3('0x24')](function(){_0x33ffce[_0xa7f3('0x1b')](0xcc)[_0xa7f3('0x26')]();});}};}function handleEntityNotFound(_0x9a96de,_0x3bd2fe){return function(_0x5316fa){if(!_0x5316fa){_0x9a96de[_0xa7f3('0x1a')](0x194);}return _0x5316fa;};}function handleError(_0x952921,_0x199170){_0x199170=_0x199170||0x1f4;return function(_0x2e3047){logger[_0xa7f3('0x27')](_0x2e3047[_0xa7f3('0x28')]);if(_0x2e3047['name']){delete _0x2e3047['name'];}_0x952921[_0xa7f3('0x1b')](_0x199170)['send'](_0x2e3047);};}exports[_0xa7f3('0x29')]=function(_0x1ef515,_0x1087b2){var _0x1f200b={},_0x32baac={},_0x642000={'count':0x0,'rows':[]};var _0x2ae562=_[_0xa7f3('0x2a')](db[_0xa7f3('0x2b')][_0xa7f3('0x2c')],function(_0x567139){return{'name':_0x567139['fieldName'],'type':_0x567139[_0xa7f3('0x2d')]['key']};});_0x32baac[_0xa7f3('0x2e')]=_[_0xa7f3('0x2a')](_0x2ae562,_0xa7f3('0x2f'));_0x32baac[_0xa7f3('0x30')]=_[_0xa7f3('0x31')](_0x1ef515[_0xa7f3('0x30')]);_0x32baac[_0xa7f3('0x32')]=_[_0xa7f3('0x33')](_0x32baac[_0xa7f3('0x2e')],_0x32baac[_0xa7f3('0x30')]);_0x1f200b[_0xa7f3('0x34')]=_[_0xa7f3('0x33')](_0x32baac[_0xa7f3('0x2e')],qs[_0xa7f3('0x35')](_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x35')]));_0x1f200b[_0xa7f3('0x34')]=_0x1f200b[_0xa7f3('0x34')][_0xa7f3('0x36')]?_0x1f200b[_0xa7f3('0x34')]:_0x32baac[_0xa7f3('0x2e')];if(!_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x37')]('nolimit')){_0x1f200b[_0xa7f3('0x38')]=qs['limit'](_0x1ef515[_0xa7f3('0x30')]['limit']);_0x1f200b['offset']=qs['offset'](_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x1e')]);}_0x1f200b['order']=qs['sort'](_0x1ef515[_0xa7f3('0x30')]['sort']);_0x1f200b[_0xa7f3('0x39')]=qs['filters'](_[_0xa7f3('0x3a')](_0x1ef515[_0xa7f3('0x30')],_0x32baac[_0xa7f3('0x32')]),_0x2ae562);if(_0x1ef515[_0xa7f3('0x30')][_0xa7f3('0x3b')]){_0x1f200b[_0xa7f3('0x39')]=_[_0xa7f3('0x3c')](_0x1f200b[_0xa7f3('0x39')],{'$or':_[_0xa7f3('0x2a')](_0x2ae562,function(_0x5918cf){if(_0x5918cf['type']!==_0xa7f3('0x3d')){var _0x31db5d={};_0x31db5d[_0x5918cf[_0xa7f3('0x2f')]]={'$like':'%'+_0x1ef515['query'][_0xa7f3('0x3b')]+'%'};return _0x31db5d;}})});}_0x1f200b=_[_0xa7f3('0x3c')]({},_0x1f200b,_0x1ef515[_0xa7f3('0x3e')]);var _0x56774e={'where':_0x1f200b[_0xa7f3('0x39')]};return db['SquareReport'][_0xa7f3('0x1d')](_0x56774e)[_0xa7f3('0x24')](function(_0x11b1ae){_0x642000[_0xa7f3('0x1d')]=_0x11b1ae;if(_0x1ef515['query'][_0xa7f3('0x3f')]){_0x1f200b[_0xa7f3('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0xa7f3('0x41')](_0x1f200b);})['then'](function(_0x42dafd){_0x642000[_0xa7f3('0x42')]=_0x42dafd;return _0x642000;})[_0xa7f3('0x24')](respondWithFilteredResult(_0x1087b2,_0x1f200b))[_0xa7f3('0x43')](handleError(_0x1087b2,null));};exports[_0xa7f3('0x44')]=function(_0x7a4b3,_0x45e45d){var _0x1dfcbe={'raw':!![],'where':{'id':_0x7a4b3['params']['id']}},_0x3507b9={};_0x3507b9[_0xa7f3('0x2e')]=_['keys'](db[_0xa7f3('0x2b')]['rawAttributes']);_0x3507b9['query']=_[_0xa7f3('0x31')](_0x7a4b3[_0xa7f3('0x30')]);_0x3507b9[_0xa7f3('0x32')]=_['intersection'](_0x3507b9[_0xa7f3('0x2e')],_0x3507b9['query']);_0x1dfcbe[_0xa7f3('0x34')]=_[_0xa7f3('0x33')](_0x3507b9[_0xa7f3('0x2e')],qs['fields'](_0x7a4b3['query'][_0xa7f3('0x35')]));_0x1dfcbe[_0xa7f3('0x34')]=_0x1dfcbe['attributes']['length']?_0x1dfcbe['attributes']:_0x3507b9[_0xa7f3('0x2e')];if(_0x7a4b3[_0xa7f3('0x30')][_0xa7f3('0x3f')]){_0x1dfcbe[_0xa7f3('0x40')]=[{'all':!![]}];}_0x1dfcbe=_[_0xa7f3('0x3c')]({},_0x1dfcbe,_0x7a4b3['options']);return db[_0xa7f3('0x2b')][_0xa7f3('0x45')](_0x1dfcbe)[_0xa7f3('0x24')](handleEntityNotFound(_0x45e45d,null))[_0xa7f3('0x24')](respondWithResult(_0x45e45d,null))['catch'](handleError(_0x45e45d,null));};exports[_0xa7f3('0x46')]=function(_0x1db437,_0x140260){return db[_0xa7f3('0x2b')][_0xa7f3('0x46')](_0x1db437['body'],{})[_0xa7f3('0x24')](respondWithResult(_0x140260,0xc9))[_0xa7f3('0x43')](handleError(_0x140260,null));};exports[_0xa7f3('0x47')]=function(_0x271d52,_0x447d33){if(_0x271d52[_0xa7f3('0x48')]['id']){delete _0x271d52[_0xa7f3('0x48')]['id'];}return db[_0xa7f3('0x2b')][_0xa7f3('0x45')]({'where':{'id':_0x271d52[_0xa7f3('0x49')]['id']}})[_0xa7f3('0x24')](handleEntityNotFound(_0x447d33,null))['then'](saveUpdates(_0x271d52[_0xa7f3('0x48')],null))[_0xa7f3('0x24')](respondWithResult(_0x447d33,null))['catch'](handleError(_0x447d33,null));};exports[_0xa7f3('0x25')]=function(_0x4b3573,_0x2db208){return db[_0xa7f3('0x2b')][_0xa7f3('0x45')]({'where':{'id':_0x4b3573[_0xa7f3('0x49')]['id']}})[_0xa7f3('0x24')](handleEntityNotFound(_0x2db208,null))['then'](removeEntity(_0x2db208,null))[_0xa7f3('0x43')](handleError(_0x2db208,null));};exports[_0xa7f3('0x4a')]=function(_0x116965,_0x439129){return db['SquareReport'][_0xa7f3('0x4a')]()['then'](respondWithResult(_0x439129,null))[_0xa7f3('0x43')](handleError(_0x439129,null));}; \ No newline at end of file +var _0x5945=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x517e74,_0x2740fe){var _0x108b45=function(_0xf64eb){while(--_0xf64eb){_0x517e74['push'](_0x517e74['shift']());}};_0x108b45(++_0x2740fe);}(_0x5945,0x16c));var _0x5594=function(_0x4093bb,_0x12d5d8){_0x4093bb=_0x4093bb-0x0;var _0x349327=_0x5945[_0x4093bb];return _0x349327;};'use strict';var pdf=require(_0x5594('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5594('0x1'));var zipdir=require(_0x5594('0x2'));var jsonpatch=require(_0x5594('0x3'));var rp=require('request-promise');var moment=require(_0x5594('0x4'));var BPromise=require(_0x5594('0x5'));var Mustache=require(_0x5594('0x6'));var util=require(_0x5594('0x7'));var path=require(_0x5594('0x8'));var sox=require(_0x5594('0x9'));var csv=require(_0x5594('0xa'));var ejs=require(_0x5594('0xb'));var fs=require('fs');var _=require(_0x5594('0xc'));var squel=require(_0x5594('0xd'));var crypto=require('crypto');var jsforce=require(_0x5594('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5594('0xf'));var Papa=require(_0x5594('0x10'));var Redis=require(_0x5594('0x11'));var authService=require(_0x5594('0x12'));var qs=require(_0x5594('0x13'));var as=require(_0x5594('0x14'));var hardwareService=require(_0x5594('0x15'));var logger=require(_0x5594('0x16'))(_0x5594('0x17'));var utils=require(_0x5594('0x18'));var config=require(_0x5594('0x19'));var db=require(_0x5594('0x1a'))['db'];function respondWithStatusCode(_0x463357,_0x36dc7d){_0x36dc7d=_0x36dc7d||0xcc;return function(_0xeb63e6){if(_0xeb63e6){return _0x463357['sendStatus'](_0x36dc7d);}return _0x463357[_0x5594('0x1b')](_0x36dc7d)[_0x5594('0x1c')]();};}function respondWithResult(_0xec756e,_0x52f4ca){_0x52f4ca=_0x52f4ca||0xc8;return function(_0x2d47c8){if(_0x2d47c8){return _0xec756e[_0x5594('0x1b')](_0x52f4ca)[_0x5594('0x1d')](_0x2d47c8);}};}function respondWithFilteredResult(_0x4a79d4,_0x139232){return function(_0x2972e2){if(_0x2972e2){var _0x21576c=_0x2972e2[_0x5594('0x1e')],_0x4db1a7=_0x139232['offset'],_0x42706e=_0x139232[_0x5594('0x1f')]+_0x139232[_0x5594('0x20')],_0x176384;if(_0x42706e>=_0x21576c){_0x42706e=_0x21576c;_0x176384=0xc8;}else{_0x176384=0xce;}_0x4a79d4['status'](_0x176384);return _0x4a79d4[_0x5594('0x21')](_0x5594('0x22'),_0x4db1a7+'-'+_0x42706e+'/'+_0x21576c)[_0x5594('0x1d')](_0x2972e2);}return null;};}function patchUpdates(_0x524354){return function(_0x3304b8){try{jsonpatch[_0x5594('0x23')](_0x3304b8,_0x524354,!![]);}catch(_0x1e4335){return BPromise[_0x5594('0x24')](_0x1e4335);}return _0x3304b8[_0x5594('0x25')]();};}function saveUpdates(_0x3df36f,_0x1f2362){return function(_0x24baeb){if(_0x24baeb){return _0x24baeb['update'](_0x3df36f)['then'](function(_0x579fad){return _0x579fad;});}return null;};}function removeEntity(_0x3bb330,_0x452abb){return function(_0x4c61f5){if(_0x4c61f5){return _0x4c61f5['destroy']()[_0x5594('0x26')](function(){_0x3bb330[_0x5594('0x1b')](0xcc)[_0x5594('0x1c')]();});}};}function handleEntityNotFound(_0x1e30a4,_0xee1f7){return function(_0x5788eb){if(!_0x5788eb){_0x1e30a4[_0x5594('0x27')](0x194);}return _0x5788eb;};}function handleError(_0x3883cf,_0x2d65e9){_0x2d65e9=_0x2d65e9||0x1f4;return function(_0x1606be){logger[_0x5594('0x28')](_0x1606be['stack']);if(_0x1606be[_0x5594('0x29')]){delete _0x1606be[_0x5594('0x29')];}_0x3883cf[_0x5594('0x1b')](_0x2d65e9)[_0x5594('0x2a')](_0x1606be);};}exports[_0x5594('0x2b')]=function(_0x348979,_0x4647fb){var _0x2cf088={},_0x206dd0={},_0x1e5cd9={'count':0x0,'rows':[]};var _0x2f3cc2=_[_0x5594('0x2c')](db[_0x5594('0x2d')][_0x5594('0x2e')],function(_0x1f49e4){return{'name':_0x1f49e4[_0x5594('0x2f')],'type':_0x1f49e4['type'][_0x5594('0x30')]};});_0x206dd0[_0x5594('0x31')]=_[_0x5594('0x2c')](_0x2f3cc2,'name');_0x206dd0['query']=_[_0x5594('0x32')](_0x348979[_0x5594('0x33')]);_0x206dd0[_0x5594('0x34')]=_[_0x5594('0x35')](_0x206dd0[_0x5594('0x31')],_0x206dd0[_0x5594('0x33')]);_0x2cf088['attributes']=_[_0x5594('0x35')](_0x206dd0[_0x5594('0x31')],qs[_0x5594('0x36')](_0x348979['query'][_0x5594('0x36')]));_0x2cf088[_0x5594('0x37')]=_0x2cf088[_0x5594('0x37')][_0x5594('0x38')]?_0x2cf088[_0x5594('0x37')]:_0x206dd0[_0x5594('0x31')];if(!_0x348979[_0x5594('0x33')]['hasOwnProperty'](_0x5594('0x39'))){_0x2cf088[_0x5594('0x20')]=qs[_0x5594('0x20')](_0x348979[_0x5594('0x33')][_0x5594('0x20')]);_0x2cf088[_0x5594('0x1f')]=qs[_0x5594('0x1f')](_0x348979[_0x5594('0x33')][_0x5594('0x1f')]);}_0x2cf088['order']=qs[_0x5594('0x3a')](_0x348979[_0x5594('0x33')][_0x5594('0x3a')]);_0x2cf088[_0x5594('0x3b')]=qs['filters'](_['pick'](_0x348979[_0x5594('0x33')],_0x206dd0[_0x5594('0x34')]),_0x2f3cc2);if(_0x348979[_0x5594('0x33')][_0x5594('0x3c')]){_0x2cf088[_0x5594('0x3b')]=_['merge'](_0x2cf088[_0x5594('0x3b')],{'$or':_['map'](_0x2f3cc2,function(_0x46e5e2){if(_0x46e5e2[_0x5594('0x3d')]!==_0x5594('0x3e')){var _0x5d1973={};_0x5d1973[_0x46e5e2[_0x5594('0x29')]]={'$like':'%'+_0x348979[_0x5594('0x33')][_0x5594('0x3c')]+'%'};return _0x5d1973;}})});}_0x2cf088=_[_0x5594('0x3f')]({},_0x2cf088,_0x348979['options']);var _0x1f0323={'where':_0x2cf088['where']};return db['SquareReport'][_0x5594('0x1e')](_0x1f0323)[_0x5594('0x26')](function(_0x2ca82d){_0x1e5cd9[_0x5594('0x1e')]=_0x2ca82d;if(_0x348979[_0x5594('0x33')][_0x5594('0x40')]){_0x2cf088[_0x5594('0x41')]=[{'all':!![]}];}return db[_0x5594('0x2d')][_0x5594('0x42')](_0x2cf088);})[_0x5594('0x26')](function(_0x4d12c7){_0x1e5cd9[_0x5594('0x43')]=_0x4d12c7;return _0x1e5cd9;})[_0x5594('0x26')](respondWithFilteredResult(_0x4647fb,_0x2cf088))[_0x5594('0x44')](handleError(_0x4647fb,null));};exports[_0x5594('0x45')]=function(_0x373169,_0x4a2939){var _0x4a1eb9={'raw':!![],'where':{'id':_0x373169[_0x5594('0x46')]['id']}},_0x2b7bdb={};_0x2b7bdb[_0x5594('0x31')]=_[_0x5594('0x32')](db[_0x5594('0x2d')][_0x5594('0x2e')]);_0x2b7bdb[_0x5594('0x33')]=_[_0x5594('0x32')](_0x373169[_0x5594('0x33')]);_0x2b7bdb[_0x5594('0x34')]=_[_0x5594('0x35')](_0x2b7bdb[_0x5594('0x31')],_0x2b7bdb[_0x5594('0x33')]);_0x4a1eb9[_0x5594('0x37')]=_[_0x5594('0x35')](_0x2b7bdb[_0x5594('0x31')],qs[_0x5594('0x36')](_0x373169['query'][_0x5594('0x36')]));_0x4a1eb9[_0x5594('0x37')]=_0x4a1eb9['attributes'][_0x5594('0x38')]?_0x4a1eb9[_0x5594('0x37')]:_0x2b7bdb[_0x5594('0x31')];if(_0x373169[_0x5594('0x33')]['includeAll']){_0x4a1eb9[_0x5594('0x41')]=[{'all':!![]}];}_0x4a1eb9=_['merge']({},_0x4a1eb9,_0x373169['options']);return db['SquareReport'][_0x5594('0x47')](_0x4a1eb9)['then'](handleEntityNotFound(_0x4a2939,null))[_0x5594('0x26')](respondWithResult(_0x4a2939,null))[_0x5594('0x44')](handleError(_0x4a2939,null));};exports[_0x5594('0x48')]=function(_0x137546,_0x2ea73a){return db[_0x5594('0x2d')][_0x5594('0x48')](_0x137546[_0x5594('0x49')],{})[_0x5594('0x26')](respondWithResult(_0x2ea73a,0xc9))[_0x5594('0x44')](handleError(_0x2ea73a,null));};exports[_0x5594('0x4a')]=function(_0x50ef2d,_0x564a4c){if(_0x50ef2d[_0x5594('0x49')]['id']){delete _0x50ef2d[_0x5594('0x49')]['id'];}return db[_0x5594('0x2d')][_0x5594('0x47')]({'where':{'id':_0x50ef2d[_0x5594('0x46')]['id']}})[_0x5594('0x26')](handleEntityNotFound(_0x564a4c,null))[_0x5594('0x26')](saveUpdates(_0x50ef2d[_0x5594('0x49')],null))['then'](respondWithResult(_0x564a4c,null))[_0x5594('0x44')](handleError(_0x564a4c,null));};exports[_0x5594('0x4b')]=function(_0x5c15fe,_0x38f562){return db[_0x5594('0x2d')]['find']({'where':{'id':_0x5c15fe[_0x5594('0x46')]['id']}})[_0x5594('0x26')](handleEntityNotFound(_0x38f562,null))[_0x5594('0x26')](removeEntity(_0x38f562,null))[_0x5594('0x44')](handleError(_0x38f562,null));};exports[_0x5594('0x4c')]=function(_0x4548e9,_0x44ad55){return db['SquareReport'][_0x5594('0x4c')]()[_0x5594('0x26')](respondWithResult(_0x44ad55,null))[_0x5594('0x44')](handleError(_0x44ad55,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c57c345..c9b0a4f 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 _0x3690=['leaveAt','lodash','util','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0xca28d9,_0x206d23){var _0x2a190b=function(_0x4beff9){while(--_0x4beff9){_0xca28d9['push'](_0xca28d9['shift']());}};_0x2a190b(++_0x206d23);}(_0x3690,0xe5));var _0x0369=function(_0x535355,_0x134e0d){_0x535355=_0x535355-0x0;var _0x33f61e=_0x3690[_0x535355];return _0x33f61e;};'use strict';var _=require(_0x0369('0x0'));var util=require(_0x0369('0x1'));var logger=require('../../config/logger')(_0x0369('0x2'));var moment=require(_0x0369('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0369('0x4'));var rimraf=require(_0x0369('0x5'));var config=require(_0x0369('0x6'));var attributes=require(_0x0369('0x7'));module[_0x0369('0x8')]=function(_0x1bf675,_0x29762d){return _0x1bf675[_0x0369('0x9')](_0x0369('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':'leaveAt','fields':[_0x0369('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x187e=['../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x187e,0x94));var _0xe187=function(_0x24cc52,_0x2527a6){_0x24cc52=_0x24cc52-0x0;var _0x5a8039=_0x187e[_0x24cc52];return _0x5a8039;};'use strict';var _=require(_0xe187('0x0'));var util=require(_0xe187('0x1'));var logger=require(_0xe187('0x2'))(_0xe187('0x3'));var moment=require('moment');var BPromise=require(_0xe187('0x4'));var rp=require(_0xe187('0x5'));var fs=require('fs');var path=require(_0xe187('0x6'));var rimraf=require(_0xe187('0x7'));var config=require('../../config/environment');var attributes=require(_0xe187('0x8'));module[_0xe187('0x9')]=function(_0x82bcc7,_0x10a459){return _0x82bcc7['define'](_0xe187('0xa'),attributes,{'tableName':_0xe187('0xb'),'paranoid':![],'indexes':[{'name':_0xe187('0xc'),'fields':['uniqueid',_0xe187('0xd')]},{'name':_0xe187('0xe'),'fields':[_0xe187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f25bb81..0cc8aea 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 _0xb962=['error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb962,0x178));var _0x2b96=function(_0x222627,_0x47a235){_0x222627=_0x222627-0x0;var _0x5bdaf5=_0xb962[_0x222627];return _0x5bdaf5;};'use strict';var _=require(_0x2b96('0x0'));var util=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));var BPromise=require(_0x2b96('0x3'));var rs=require(_0x2b96('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b96('0x6'))(_0x2b96('0x7'));var config=require(_0x2b96('0x8'));var jayson=require(_0x2b96('0x9'));var client=jayson[_0x2b96('0xa')][_0x2b96('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d74ef,_0x5bd317,_0x223917){return new BPromise(function(_0x99ba7c,_0x1dcd97){return client[_0x2b96('0xc')](_0x1d74ef,_0x223917)[_0x2b96('0xd')](function(_0x49d2da){logger[_0x2b96('0xe')](_0x2b96('0xf'),_0x5bd317,_0x2b96('0x10'));logger[_0x2b96('0x11')](_0x2b96('0x12'),_0x5bd317,_0x2b96('0x10'),JSON[_0x2b96('0x13')](_0x49d2da));if(_0x49d2da[_0x2b96('0x14')]){if(_0x49d2da['error'][_0x2b96('0x15')]===0x1f4){logger['error'](_0x2b96('0xf'),_0x5bd317,_0x49d2da[_0x2b96('0x14')][_0x2b96('0x16')]);return _0x1dcd97(_0x49d2da[_0x2b96('0x14')]['message']);}logger[_0x2b96('0x14')](_0x2b96('0xf'),_0x5bd317,_0x49d2da[_0x2b96('0x14')][_0x2b96('0x16')]);return _0x99ba7c(_0x49d2da[_0x2b96('0x14')][_0x2b96('0x16')]);}else{logger[_0x2b96('0xe')](_0x2b96('0xf'),_0x5bd317,_0x2b96('0x10'));_0x99ba7c(_0x49d2da[_0x2b96('0x17')][_0x2b96('0x16')]);}})[_0x2b96('0x18')](function(_0xe47b49){logger['error']('SquareReport,\x20%s,\x20%s',_0x5bd317,_0xe47b49);_0x1dcd97(_0xe47b49);});});}exports[_0x2b96('0x19')]=function(_0x14d7fc){var _0x2e43e2=this;return new Promise(function(_0x288733,_0xec462e){return db[_0x2b96('0x1a')][_0x2b96('0x1b')](_0x14d7fc[_0x2b96('0x1c')],{'raw':_0x14d7fc[_0x2b96('0x1d')]?_0x14d7fc[_0x2b96('0x1d')][_0x2b96('0x1e')]===undefined?!![]:![]:!![]})[_0x2b96('0xd')](function(_0x237f39){logger['info'](_0x2b96('0x19'),_0x14d7fc);logger['debug'](_0x2b96('0x19'),_0x14d7fc,JSON[_0x2b96('0x13')](_0x237f39));_0x288733(_0x237f39);})[_0x2b96('0x18')](function(_0xc3bf4a){logger[_0x2b96('0x14')]('CreateSquareReport',_0xc3bf4a['message'],_0x14d7fc);_0xec462e(_0x2e43e2[_0x2b96('0x14')](0x1f4,_0xc3bf4a['message']));});});};exports[_0x2b96('0x1f')]=function(_0x2696cb){var _0x5b89a0=this;return new Promise(function(_0x2bfec4,_0x69f7ab){return db[_0x2b96('0x1a')][_0x2b96('0x20')](_0x2696cb[_0x2b96('0x1c')],{'raw':_0x2696cb['options']?_0x2696cb[_0x2b96('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2696cb[_0x2b96('0x1d')]?_0x2696cb[_0x2b96('0x1d')][_0x2b96('0x21')]||null:null,'attributes':_0x2696cb[_0x2b96('0x1d')]?_0x2696cb[_0x2b96('0x1d')][_0x2b96('0x22')]||null:null,'limit':_0x2696cb[_0x2b96('0x1d')]?_0x2696cb[_0x2b96('0x1d')][_0x2b96('0x23')]||null:null})['then'](function(_0x5f5bae){logger[_0x2b96('0xe')](_0x2b96('0x1f'),_0x2696cb);logger[_0x2b96('0x11')](_0x2b96('0x1f'),_0x2696cb,JSON[_0x2b96('0x13')](_0x5f5bae));_0x2bfec4(_0x5f5bae);})[_0x2b96('0x18')](function(_0x5d74b2){logger[_0x2b96('0x14')]('UpdateSquareReport',_0x5d74b2[_0x2b96('0x16')],_0x2696cb);_0x69f7ab(_0x5b89a0[_0x2b96('0x14')](0x1f4,_0x5d74b2['message']));});});}; \ No newline at end of file +var _0xca38=['limit','then','UpdateSquareReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','raw','attributes'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0xca38,0x1a7));var _0x8ca3=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0xca38[_0x3d7de8];return _0x5e9a0c;};'use strict';var _=require(_0x8ca3('0x0'));var util=require('util');var moment=require(_0x8ca3('0x1'));var BPromise=require(_0x8ca3('0x2'));var rs=require(_0x8ca3('0x3'));var fs=require('fs');var Redis=require(_0x8ca3('0x4'));var db=require(_0x8ca3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ca3('0x6'));var config=require('../../config/environment');var jayson=require(_0x8ca3('0x7'));var client=jayson[_0x8ca3('0x8')][_0x8ca3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e6fb,_0x59ede2,_0x1dccf8){return new BPromise(function(_0x2cd9af,_0x1ee4ac){return client[_0x8ca3('0xa')](_0x33e6fb,_0x1dccf8)['then'](function(_0x5671ef){logger[_0x8ca3('0xb')]('SquareReport,\x20%s,\x20%s',_0x59ede2,_0x8ca3('0xc'));logger[_0x8ca3('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x59ede2,'request\x20sent',JSON[_0x8ca3('0xe')](_0x5671ef));if(_0x5671ef['error']){if(_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x10')]===0x1f4){logger[_0x8ca3('0xf')](_0x8ca3('0x11'),_0x59ede2,_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x12')]);return _0x1ee4ac(_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x12')]);}logger['error'](_0x8ca3('0x11'),_0x59ede2,_0x5671ef[_0x8ca3('0xf')][_0x8ca3('0x12')]);return _0x2cd9af(_0x5671ef['error'][_0x8ca3('0x12')]);}else{logger[_0x8ca3('0xb')](_0x8ca3('0x11'),_0x59ede2,_0x8ca3('0xc'));_0x2cd9af(_0x5671ef[_0x8ca3('0x13')]['message']);}})[_0x8ca3('0x14')](function(_0x512f67){logger['error'](_0x8ca3('0x11'),_0x59ede2,_0x512f67);_0x1ee4ac(_0x512f67);});});}exports[_0x8ca3('0x15')]=function(_0x1fdfef){var _0x17a5e6=this;return new Promise(function(_0x49b99a,_0x34e53f){return db['SquareReport'][_0x8ca3('0x16')](_0x1fdfef[_0x8ca3('0x17')],{'raw':_0x1fdfef[_0x8ca3('0x18')]?_0x1fdfef[_0x8ca3('0x18')][_0x8ca3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2a6bfa){logger[_0x8ca3('0xb')](_0x8ca3('0x15'),_0x1fdfef);logger[_0x8ca3('0xd')](_0x8ca3('0x15'),_0x1fdfef,JSON['stringify'](_0x2a6bfa));_0x49b99a(_0x2a6bfa);})[_0x8ca3('0x14')](function(_0x16140f){logger[_0x8ca3('0xf')](_0x8ca3('0x15'),_0x16140f[_0x8ca3('0x12')],_0x1fdfef);_0x34e53f(_0x17a5e6[_0x8ca3('0xf')](0x1f4,_0x16140f[_0x8ca3('0x12')]));});});};exports['UpdateSquareReport']=function(_0x3a5748){var _0xcb8b11=this;return new Promise(function(_0x96a2e8,_0x42b6d0){return db['SquareReport']['update'](_0x3a5748[_0x8ca3('0x17')],{'raw':_0x3a5748[_0x8ca3('0x18')]?_0x3a5748[_0x8ca3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5748['options']?_0x3a5748[_0x8ca3('0x18')]['where']||null:null,'attributes':_0x3a5748[_0x8ca3('0x18')]?_0x3a5748[_0x8ca3('0x18')][_0x8ca3('0x1a')]||null:null,'limit':_0x3a5748['options']?_0x3a5748[_0x8ca3('0x18')][_0x8ca3('0x1b')]||null:null})[_0x8ca3('0x1c')](function(_0x105115){logger[_0x8ca3('0xb')](_0x8ca3('0x1d'),_0x3a5748);logger['debug'](_0x8ca3('0x1d'),_0x3a5748,JSON[_0x8ca3('0xe')](_0x105115));_0x96a2e8(_0x105115);})[_0x8ca3('0x14')](function(_0x5bee97){logger['error'](_0x8ca3('0x1d'),_0x5bee97[_0x8ca3('0x12')],_0x3a5748);_0x42b6d0(_0xcb8b11[_0x8ca3('0xf')](0x1f4,_0x5bee97[_0x8ca3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d68d7a3..f835be6 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(_0x559310,_0x2394fc){var _0x504ace=function(_0x10bd15){while(--_0x10bd15){_0x559310['push'](_0x559310['shift']());}};_0x504ace(++_0x2394fc);}(_0x7a54,0x106));var _0x47a5=function(_0x173ff0,_0x195b5d){_0x173ff0=_0x173ff0-0x0;var _0x181e15=_0x7a54[_0x173ff0];return _0x181e15;};'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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x444afa,_0x55e9fe){var _0x3fe253=function(_0x137aee){while(--_0x137aee){_0x444afa['push'](_0x444afa['shift']());}};_0x3fe253(++_0x55e9fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32dd50,_0x5cde6b){_0x32dd50=_0x32dd50-0x0;var _0x52d87f=_0x5f2f[_0x32dd50];return _0x52d87f;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c00ff5f..783d24d 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 _0xeff6=['sequelize','STRING','TEXT'];(function(_0x3f70cd,_0x6bf4ed){var _0x3feb93=function(_0x4a045a){while(--_0x4a045a){_0x3f70cd['push'](_0x3f70cd['shift']());}};_0x3feb93(++_0x6bf4ed);}(_0xeff6,0x129));var _0x6eff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeff6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6eff('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6eff('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6eff('0x1')]},'data':{'type':Sequelize[_0x6eff('0x2')]},'project_name':{'type':Sequelize[_0x6eff('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b67=['STRING','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6b67,0x115));var _0x76b6=function(_0x38894d,_0x1883d8){_0x38894d=_0x38894d-0x0;var _0x5614fe=_0x6b67[_0x38894d];return _0x5614fe;};'use strict';var Sequelize=require('sequelize');module[_0x76b6('0x0')]={'uniqueid':{'type':Sequelize[_0x76b6('0x1')]},'node':{'type':Sequelize[_0x76b6('0x1')]},'application':{'type':Sequelize[_0x76b6('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x76b6('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 96807a5..2299999 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 _0x730c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','set','apply','update','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x42dbea,_0x5a9ada){var _0x531d45=function(_0x46aebd){while(--_0x46aebd){_0x42dbea['push'](_0x42dbea['shift']());}};_0x531d45(++_0x5a9ada);}(_0x730c,0x15a));var _0xc730=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x730c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc730('0x0'));var rimraf=require(_0xc730('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc730('0x2'));var rp=require(_0xc730('0x3'));var moment=require('moment');var BPromise=require(_0xc730('0x4'));var Mustache=require('mustache');var util=require(_0xc730('0x5'));var path=require(_0xc730('0x6'));var sox=require(_0xc730('0x7'));var csv=require(_0xc730('0x8'));var ejs=require(_0xc730('0x9'));var fs=require('fs');var _=require(_0xc730('0xa'));var squel=require(_0xc730('0xb'));var crypto=require(_0xc730('0xc'));var jsforce=require(_0xc730('0xd'));var deskjs=require(_0xc730('0xe'));var toCsv=require(_0xc730('0x8'));var querystring=require(_0xc730('0xf'));var Papa=require(_0xc730('0x10'));var Redis=require(_0xc730('0x11'));var authService=require(_0xc730('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc730('0x13'));var hardwareService=require(_0xc730('0x14'));var logger=require('../../config/logger')(_0xc730('0x15'));var utils=require(_0xc730('0x16'));var config=require(_0xc730('0x17'));var db=require(_0xc730('0x18'))['db'];function respondWithStatusCode(_0x5958f5,_0x5065c3){_0x5065c3=_0x5065c3||0xcc;return function(_0x45f70e){if(_0x45f70e){return _0x5958f5['sendStatus'](_0x5065c3);}return _0x5958f5['status'](_0x5065c3)[_0xc730('0x19')]();};}function respondWithResult(_0x28d1b7,_0x3ad512){_0x3ad512=_0x3ad512||0xc8;return function(_0x461c62){if(_0x461c62){return _0x28d1b7[_0xc730('0x1a')](_0x3ad512)[_0xc730('0x1b')](_0x461c62);}};}function respondWithFilteredResult(_0x1f0bbb,_0x541a8e){return function(_0x181a65){if(_0x181a65){var _0x59b168=_0x181a65['count'],_0x1f1c0b=_0x541a8e[_0xc730('0x1c')],_0x2fd3ea=_0x541a8e[_0xc730('0x1c')]+_0x541a8e['limit'],_0x5b41c1;if(_0x2fd3ea>=_0x59b168){_0x2fd3ea=_0x59b168;_0x5b41c1=0xc8;}else{_0x5b41c1=0xce;}_0x1f0bbb[_0xc730('0x1a')](_0x5b41c1);return _0x1f0bbb[_0xc730('0x1d')]('Content-Range',_0x1f1c0b+'-'+_0x2fd3ea+'/'+_0x59b168)[_0xc730('0x1b')](_0x181a65);}return null;};}function patchUpdates(_0x3022ea){return function(_0x23bd53){try{jsonpatch[_0xc730('0x1e')](_0x23bd53,_0x3022ea,!![]);}catch(_0xc2f04a){return BPromise['reject'](_0xc2f04a);}return _0x23bd53['save']();};}function saveUpdates(_0x1e77e3,_0x267f0c){return function(_0x6e2102){if(_0x6e2102){return _0x6e2102[_0xc730('0x1f')](_0x1e77e3)[_0xc730('0x20')](function(_0x5bcbe1){return _0x5bcbe1;});}return null;};}function removeEntity(_0x4fae4a,_0x11e7ec){return function(_0x6ec874){if(_0x6ec874){return _0x6ec874['destroy']()[_0xc730('0x20')](function(){_0x4fae4a[_0xc730('0x1a')](0xcc)[_0xc730('0x19')]();});}};}function handleEntityNotFound(_0x31d336,_0x4ad58f){return function(_0x590c65){if(!_0x590c65){_0x31d336[_0xc730('0x21')](0x194);}return _0x590c65;};}function handleError(_0x348661,_0x44ea56){_0x44ea56=_0x44ea56||0x1f4;return function(_0x48883b){logger[_0xc730('0x22')](_0x48883b[_0xc730('0x23')]);if(_0x48883b[_0xc730('0x24')]){delete _0x48883b[_0xc730('0x24')];}_0x348661[_0xc730('0x1a')](_0x44ea56)['send'](_0x48883b);};}exports[_0xc730('0x25')]=function(_0xed6a08,_0x405a96){var _0x3dfe88={},_0xeaf8c4={},_0x1d8f59={'count':0x0,'rows':[]};var _0xa6e69b=_[_0xc730('0x26')](db['SquareDetailsReport'][_0xc730('0x27')],function(_0x355a89){return{'name':_0x355a89[_0xc730('0x28')],'type':_0x355a89[_0xc730('0x29')][_0xc730('0x2a')]};});_0xeaf8c4[_0xc730('0x2b')]=_[_0xc730('0x26')](_0xa6e69b,_0xc730('0x24'));_0xeaf8c4[_0xc730('0x2c')]=_['keys'](_0xed6a08['query']);_0xeaf8c4[_0xc730('0x2d')]=_[_0xc730('0x2e')](_0xeaf8c4[_0xc730('0x2b')],_0xeaf8c4[_0xc730('0x2c')]);_0x3dfe88[_0xc730('0x2f')]=_['intersection'](_0xeaf8c4['model'],qs[_0xc730('0x30')](_0xed6a08[_0xc730('0x2c')][_0xc730('0x30')]));_0x3dfe88['attributes']=_0x3dfe88[_0xc730('0x2f')][_0xc730('0x31')]?_0x3dfe88[_0xc730('0x2f')]:_0xeaf8c4['model'];if(!_0xed6a08[_0xc730('0x2c')][_0xc730('0x32')](_0xc730('0x33'))){_0x3dfe88[_0xc730('0x34')]=qs[_0xc730('0x34')](_0xed6a08['query'][_0xc730('0x34')]);_0x3dfe88[_0xc730('0x1c')]=qs[_0xc730('0x1c')](_0xed6a08['query'][_0xc730('0x1c')]);}_0x3dfe88[_0xc730('0x35')]=qs[_0xc730('0x36')](_0xed6a08[_0xc730('0x2c')][_0xc730('0x36')]);_0x3dfe88[_0xc730('0x37')]=qs[_0xc730('0x2d')](_['pick'](_0xed6a08[_0xc730('0x2c')],_0xeaf8c4['filters']),_0xa6e69b);if(_0xed6a08[_0xc730('0x2c')][_0xc730('0x38')]){_0x3dfe88['where']=_[_0xc730('0x39')](_0x3dfe88[_0xc730('0x37')],{'$or':_[_0xc730('0x26')](_0xa6e69b,function(_0x477ec9){if(_0x477ec9[_0xc730('0x29')]!=='VIRTUAL'){var _0x2cc8f1={};_0x2cc8f1[_0x477ec9[_0xc730('0x24')]]={'$like':'%'+_0xed6a08[_0xc730('0x2c')][_0xc730('0x38')]+'%'};return _0x2cc8f1;}})});}_0x3dfe88=_[_0xc730('0x39')]({},_0x3dfe88,_0xed6a08[_0xc730('0x3a')]);var _0x2483a4={'where':_0x3dfe88[_0xc730('0x37')]};return db[_0xc730('0x3b')][_0xc730('0x3c')](_0x2483a4)[_0xc730('0x20')](function(_0x7a40a3){_0x1d8f59[_0xc730('0x3c')]=_0x7a40a3;if(_0xed6a08['query'][_0xc730('0x3d')]){_0x3dfe88[_0xc730('0x3e')]=[{'all':!![]}];}return db[_0xc730('0x3b')][_0xc730('0x3f')](_0x3dfe88);})[_0xc730('0x20')](function(_0x529e06){_0x1d8f59[_0xc730('0x40')]=_0x529e06;return _0x1d8f59;})[_0xc730('0x20')](respondWithFilteredResult(_0x405a96,_0x3dfe88))[_0xc730('0x41')](handleError(_0x405a96,null));};exports[_0xc730('0x42')]=function(_0x45cdc8,_0x38e3c6){var _0x4769fe={'raw':!![],'where':{'id':_0x45cdc8[_0xc730('0x43')]['id']}},_0x5c02c8={};_0x5c02c8['model']=_['keys'](db[_0xc730('0x3b')][_0xc730('0x27')]);_0x5c02c8[_0xc730('0x2c')]=_[_0xc730('0x44')](_0x45cdc8[_0xc730('0x2c')]);_0x5c02c8[_0xc730('0x2d')]=_[_0xc730('0x2e')](_0x5c02c8[_0xc730('0x2b')],_0x5c02c8[_0xc730('0x2c')]);_0x4769fe[_0xc730('0x2f')]=_[_0xc730('0x2e')](_0x5c02c8[_0xc730('0x2b')],qs[_0xc730('0x30')](_0x45cdc8[_0xc730('0x2c')]['fields']));_0x4769fe[_0xc730('0x2f')]=_0x4769fe[_0xc730('0x2f')][_0xc730('0x31')]?_0x4769fe[_0xc730('0x2f')]:_0x5c02c8['model'];if(_0x45cdc8[_0xc730('0x2c')][_0xc730('0x3d')]){_0x4769fe['include']=[{'all':!![]}];}_0x4769fe=_[_0xc730('0x39')]({},_0x4769fe,_0x45cdc8[_0xc730('0x3a')]);return db[_0xc730('0x3b')][_0xc730('0x45')](_0x4769fe)['then'](handleEntityNotFound(_0x38e3c6,null))[_0xc730('0x20')](respondWithResult(_0x38e3c6,null))[_0xc730('0x41')](handleError(_0x38e3c6,null));};exports['create']=function(_0xe7f2b0,_0x2b89b1){return db['SquareDetailsReport'][_0xc730('0x46')](_0xe7f2b0['body'],{})[_0xc730('0x20')](respondWithResult(_0x2b89b1,0xc9))[_0xc730('0x41')](handleError(_0x2b89b1,null));};exports[_0xc730('0x1f')]=function(_0x3921e5,_0x6501ab){if(_0x3921e5['body']['id']){delete _0x3921e5[_0xc730('0x47')]['id'];}return db[_0xc730('0x3b')]['find']({'where':{'id':_0x3921e5[_0xc730('0x43')]['id']}})['then'](handleEntityNotFound(_0x6501ab,null))[_0xc730('0x20')](saveUpdates(_0x3921e5[_0xc730('0x47')],null))[_0xc730('0x20')](respondWithResult(_0x6501ab,null))[_0xc730('0x41')](handleError(_0x6501ab,null));};exports['destroy']=function(_0x95cefb,_0x1ae2c7){return db[_0xc730('0x3b')][_0xc730('0x45')]({'where':{'id':_0x95cefb[_0xc730('0x43')]['id']}})[_0xc730('0x20')](handleEntityNotFound(_0x1ae2c7,null))[_0xc730('0x20')](removeEntity(_0x1ae2c7,null))[_0xc730('0x41')](handleError(_0x1ae2c7,null));};exports[_0xc730('0x48')]=function(_0xaabdd5,_0x59135f){return db['SquareDetailsReport']['describe']()[_0xc730('0x20')](respondWithResult(_0x59135f,null))[_0xc730('0x41')](handleError(_0x59135f,null));}; \ No newline at end of file +var _0xa019=['merge','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter'];(function(_0x2e6704,_0x2c5a44){var _0x1815da=function(_0x22bf61){while(--_0x22bf61){_0x2e6704['push'](_0x2e6704['shift']());}};_0x1815da(++_0x2c5a44);}(_0xa019,0x9d));var _0x9a01=function(_0x5aa8ac,_0x37f6e8){_0x5aa8ac=_0x5aa8ac-0x0;var _0x4b382d=_0xa019[_0x5aa8ac];return _0x4b382d;};'use strict';var pdf=require(_0x9a01('0x0'));var emlformat=require(_0x9a01('0x1'));var rimraf=require(_0x9a01('0x2'));var zipdir=require(_0x9a01('0x3'));var jsonpatch=require(_0x9a01('0x4'));var rp=require('request-promise');var moment=require(_0x9a01('0x5'));var BPromise=require(_0x9a01('0x6'));var Mustache=require(_0x9a01('0x7'));var util=require('util');var path=require(_0x9a01('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a01('0x9'));var fs=require('fs');var _=require(_0x9a01('0xa'));var squel=require(_0x9a01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a01('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9a01('0xd'));var Papa=require(_0x9a01('0xe'));var Redis=require('ioredis');var authService=require(_0x9a01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9a01('0x10'));var hardwareService=require(_0x9a01('0x11'));var logger=require(_0x9a01('0x12'))(_0x9a01('0x13'));var utils=require(_0x9a01('0x14'));var config=require('../../config/environment');var db=require(_0x9a01('0x15'))['db'];function respondWithStatusCode(_0x41b901,_0x337060){_0x337060=_0x337060||0xcc;return function(_0x2ce89c){if(_0x2ce89c){return _0x41b901[_0x9a01('0x16')](_0x337060);}return _0x41b901[_0x9a01('0x17')](_0x337060)[_0x9a01('0x18')]();};}function respondWithResult(_0x54b8c1,_0x39a7eb){_0x39a7eb=_0x39a7eb||0xc8;return function(_0x5419d8){if(_0x5419d8){return _0x54b8c1['status'](_0x39a7eb)[_0x9a01('0x19')](_0x5419d8);}};}function respondWithFilteredResult(_0x23ad7d,_0x13f5a7){return function(_0x5bd4e5){if(_0x5bd4e5){var _0x4cff5e=_0x5bd4e5['count'],_0x518913=_0x13f5a7[_0x9a01('0x1a')],_0x22660f=_0x13f5a7[_0x9a01('0x1a')]+_0x13f5a7[_0x9a01('0x1b')],_0x390c9f;if(_0x22660f>=_0x4cff5e){_0x22660f=_0x4cff5e;_0x390c9f=0xc8;}else{_0x390c9f=0xce;}_0x23ad7d[_0x9a01('0x17')](_0x390c9f);return _0x23ad7d[_0x9a01('0x1c')](_0x9a01('0x1d'),_0x518913+'-'+_0x22660f+'/'+_0x4cff5e)[_0x9a01('0x19')](_0x5bd4e5);}return null;};}function patchUpdates(_0x31a4b6){return function(_0x531550){try{jsonpatch[_0x9a01('0x1e')](_0x531550,_0x31a4b6,!![]);}catch(_0x3d729b){return BPromise[_0x9a01('0x1f')](_0x3d729b);}return _0x531550[_0x9a01('0x20')]();};}function saveUpdates(_0x1659f9,_0xb62fe4){return function(_0x418c53){if(_0x418c53){return _0x418c53[_0x9a01('0x21')](_0x1659f9)[_0x9a01('0x22')](function(_0x40fcc1){return _0x40fcc1;});}return null;};}function removeEntity(_0x1ae92e,_0x51a55b){return function(_0xeb7eea){if(_0xeb7eea){return _0xeb7eea[_0x9a01('0x23')]()[_0x9a01('0x22')](function(){_0x1ae92e[_0x9a01('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a772,_0x3681a2){return function(_0x506cca){if(!_0x506cca){_0x51a772[_0x9a01('0x16')](0x194);}return _0x506cca;};}function handleError(_0x1e4e43,_0x1423d9){_0x1423d9=_0x1423d9||0x1f4;return function(_0x4a251c){logger[_0x9a01('0x24')](_0x4a251c[_0x9a01('0x25')]);if(_0x4a251c[_0x9a01('0x26')]){delete _0x4a251c['name'];}_0x1e4e43[_0x9a01('0x17')](_0x1423d9)['send'](_0x4a251c);};}exports[_0x9a01('0x27')]=function(_0xb0ee71,_0x4e9450){var _0x46968a={},_0x38d547={},_0x1c8cfb={'count':0x0,'rows':[]};var _0x528e9e=_[_0x9a01('0x28')](db['SquareDetailsReport'][_0x9a01('0x29')],function(_0x1fa2a3){return{'name':_0x1fa2a3['fieldName'],'type':_0x1fa2a3[_0x9a01('0x2a')]['key']};});_0x38d547['model']=_[_0x9a01('0x28')](_0x528e9e,'name');_0x38d547['query']=_[_0x9a01('0x2b')](_0xb0ee71[_0x9a01('0x2c')]);_0x38d547[_0x9a01('0x2d')]=_[_0x9a01('0x2e')](_0x38d547[_0x9a01('0x2f')],_0x38d547[_0x9a01('0x2c')]);_0x46968a[_0x9a01('0x30')]=_[_0x9a01('0x2e')](_0x38d547['model'],qs['fields'](_0xb0ee71[_0x9a01('0x2c')][_0x9a01('0x31')]));_0x46968a[_0x9a01('0x30')]=_0x46968a[_0x9a01('0x30')]['length']?_0x46968a['attributes']:_0x38d547[_0x9a01('0x2f')];if(!_0xb0ee71[_0x9a01('0x2c')]['hasOwnProperty'](_0x9a01('0x32'))){_0x46968a['limit']=qs['limit'](_0xb0ee71[_0x9a01('0x2c')]['limit']);_0x46968a[_0x9a01('0x1a')]=qs['offset'](_0xb0ee71[_0x9a01('0x2c')][_0x9a01('0x1a')]);}_0x46968a[_0x9a01('0x33')]=qs['sort'](_0xb0ee71[_0x9a01('0x2c')][_0x9a01('0x34')]);_0x46968a['where']=qs[_0x9a01('0x2d')](_['pick'](_0xb0ee71['query'],_0x38d547[_0x9a01('0x2d')]),_0x528e9e);if(_0xb0ee71['query']['filter']){_0x46968a[_0x9a01('0x35')]=_['merge'](_0x46968a[_0x9a01('0x35')],{'$or':_[_0x9a01('0x28')](_0x528e9e,function(_0x4e78c2){if(_0x4e78c2[_0x9a01('0x2a')]!==_0x9a01('0x36')){var _0x17fccf={};_0x17fccf[_0x4e78c2[_0x9a01('0x26')]]={'$like':'%'+_0xb0ee71['query'][_0x9a01('0x37')]+'%'};return _0x17fccf;}})});}_0x46968a=_[_0x9a01('0x38')]({},_0x46968a,_0xb0ee71['options']);var _0x2145a8={'where':_0x46968a[_0x9a01('0x35')]};return db[_0x9a01('0x39')][_0x9a01('0x3a')](_0x2145a8)['then'](function(_0x5b9382){_0x1c8cfb[_0x9a01('0x3a')]=_0x5b9382;if(_0xb0ee71['query'][_0x9a01('0x3b')]){_0x46968a[_0x9a01('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x9a01('0x3d')](_0x46968a);})[_0x9a01('0x22')](function(_0x3f7d93){_0x1c8cfb[_0x9a01('0x3e')]=_0x3f7d93;return _0x1c8cfb;})['then'](respondWithFilteredResult(_0x4e9450,_0x46968a))[_0x9a01('0x3f')](handleError(_0x4e9450,null));};exports['show']=function(_0x3604a7,_0x52cb61){var _0x506526={'raw':!![],'where':{'id':_0x3604a7[_0x9a01('0x40')]['id']}},_0x7c932b={};_0x7c932b[_0x9a01('0x2f')]=_[_0x9a01('0x2b')](db[_0x9a01('0x39')][_0x9a01('0x29')]);_0x7c932b['query']=_['keys'](_0x3604a7[_0x9a01('0x2c')]);_0x7c932b['filters']=_[_0x9a01('0x2e')](_0x7c932b[_0x9a01('0x2f')],_0x7c932b[_0x9a01('0x2c')]);_0x506526[_0x9a01('0x30')]=_['intersection'](_0x7c932b[_0x9a01('0x2f')],qs['fields'](_0x3604a7[_0x9a01('0x2c')][_0x9a01('0x31')]));_0x506526[_0x9a01('0x30')]=_0x506526[_0x9a01('0x30')][_0x9a01('0x41')]?_0x506526[_0x9a01('0x30')]:_0x7c932b[_0x9a01('0x2f')];if(_0x3604a7[_0x9a01('0x2c')]['includeAll']){_0x506526[_0x9a01('0x3c')]=[{'all':!![]}];}_0x506526=_[_0x9a01('0x38')]({},_0x506526,_0x3604a7[_0x9a01('0x42')]);return db[_0x9a01('0x39')]['find'](_0x506526)[_0x9a01('0x22')](handleEntityNotFound(_0x52cb61,null))[_0x9a01('0x22')](respondWithResult(_0x52cb61,null))[_0x9a01('0x3f')](handleError(_0x52cb61,null));};exports[_0x9a01('0x43')]=function(_0x1e9b29,_0x45dc36){return db[_0x9a01('0x39')][_0x9a01('0x43')](_0x1e9b29['body'],{})[_0x9a01('0x22')](respondWithResult(_0x45dc36,0xc9))[_0x9a01('0x3f')](handleError(_0x45dc36,null));};exports['update']=function(_0x301d7c,_0x257f7c){if(_0x301d7c[_0x9a01('0x44')]['id']){delete _0x301d7c[_0x9a01('0x44')]['id'];}return db[_0x9a01('0x39')][_0x9a01('0x45')]({'where':{'id':_0x301d7c[_0x9a01('0x40')]['id']}})[_0x9a01('0x22')](handleEntityNotFound(_0x257f7c,null))[_0x9a01('0x22')](saveUpdates(_0x301d7c[_0x9a01('0x44')],null))[_0x9a01('0x22')](respondWithResult(_0x257f7c,null))[_0x9a01('0x3f')](handleError(_0x257f7c,null));};exports[_0x9a01('0x23')]=function(_0x21ede5,_0x60a007){return db[_0x9a01('0x39')]['find']({'where':{'id':_0x21ede5[_0x9a01('0x40')]['id']}})[_0x9a01('0x22')](handleEntityNotFound(_0x60a007,null))[_0x9a01('0x22')](removeEntity(_0x60a007,null))[_0x9a01('0x3f')](handleError(_0x60a007,null));};exports[_0x9a01('0x46')]=function(_0x30cf3b,_0x203494){return db[_0x9a01('0x39')][_0x9a01('0x46')]()[_0x9a01('0x22')](respondWithResult(_0x203494,null))[_0x9a01('0x3f')](handleError(_0x203494,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d811a37..84484dc 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 _0x85c0=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x5d02c3,_0xd35ca3){var _0x4c6fbc=function(_0x174eb0){while(--_0x174eb0){_0x5d02c3['push'](_0x5d02c3['shift']());}};_0x4c6fbc(++_0xd35ca3);}(_0x85c0,0x1ef));var _0x085c=function(_0x224b6a,_0x31e5a0){_0x224b6a=_0x224b6a-0x0;var _0x48f0eb=_0x85c0[_0x224b6a];return _0x48f0eb;};'use strict';var _=require('lodash');var util=require(_0x085c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x085c('0x1'));var BPromise=require(_0x085c('0x2'));var rp=require(_0x085c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x085c('0x4'));var config=require(_0x085c('0x5'));var attributes=require(_0x085c('0x6'));module[_0x085c('0x7')]=function(_0x3a93eb,_0x135959){return _0x3a93eb[_0x085c('0x8')](_0x085c('0x9'),attributes,{'tableName':_0x085c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc074=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','../../config/logger','moment','bluebird'];(function(_0x2afe47,_0x398584){var _0x226203=function(_0x56cce4){while(--_0x56cce4){_0x2afe47['push'](_0x2afe47['shift']());}};_0x226203(++_0x398584);}(_0xc074,0xec));var _0x4c07=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xc074[_0x420b24];return _0x4da552;};'use strict';var _=require(_0x4c07('0x0'));var util=require('util');var logger=require(_0x4c07('0x1'))('api');var moment=require(_0x4c07('0x2'));var BPromise=require(_0x4c07('0x3'));var rp=require(_0x4c07('0x4'));var fs=require('fs');var path=require(_0x4c07('0x5'));var rimraf=require(_0x4c07('0x6'));var config=require(_0x4c07('0x7'));var attributes=require(_0x4c07('0x8'));module[_0x4c07('0x9')]=function(_0x40bce1,_0x1f571b){return _0x40bce1[_0x4c07('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x4c07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 3c67cc7..e933c44 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 _0x3e09=['debug','stringify','error','code','message','request\x20sent','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e09,0xd1));var _0x93e0=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0x3e09[_0xadc7d9];return _0x915ca1;};'use strict';var _=require(_0x93e0('0x0'));var util=require(_0x93e0('0x1'));var moment=require(_0x93e0('0x2'));var BPromise=require(_0x93e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93e0('0x4'));var db=require(_0x93e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93e0('0x6'))(_0x93e0('0x7'));var config=require(_0x93e0('0x8'));var jayson=require(_0x93e0('0x9'));var client=jayson['client'][_0x93e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1972a0,_0x15a8be,_0x1778e5){return new BPromise(function(_0x5b87f2,_0xaafe4f){return client[_0x93e0('0xb')](_0x1972a0,_0x1778e5)[_0x93e0('0xc')](function(_0x38199){logger[_0x93e0('0xd')](_0x93e0('0xe'),_0x15a8be,'request\x20sent');logger[_0x93e0('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x15a8be,'request\x20sent',JSON[_0x93e0('0x10')](_0x38199));if(_0x38199[_0x93e0('0x11')]){if(_0x38199['error'][_0x93e0('0x12')]===0x1f4){logger[_0x93e0('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x15a8be,_0x38199[_0x93e0('0x11')][_0x93e0('0x13')]);return _0xaafe4f(_0x38199[_0x93e0('0x11')][_0x93e0('0x13')]);}logger['error'](_0x93e0('0xe'),_0x15a8be,_0x38199['error']['message']);return _0x5b87f2(_0x38199[_0x93e0('0x11')][_0x93e0('0x13')]);}else{logger[_0x93e0('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x15a8be,_0x93e0('0x14'));_0x5b87f2(_0x38199['result'][_0x93e0('0x13')]);}})[_0x93e0('0x15')](function(_0x5b2b78){logger[_0x93e0('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x15a8be,_0x5b2b78);_0xaafe4f(_0x5b2b78);});});}exports[_0x93e0('0x16')]=function(_0x2ece2b){var _0x4eba3b=this;return new Promise(function(_0x3ba7c1,_0x17251c){return db[_0x93e0('0x17')][_0x93e0('0x18')](_0x2ece2b[_0x93e0('0x19')],{'raw':_0x2ece2b['options']?_0x2ece2b[_0x93e0('0x1a')][_0x93e0('0x1b')]===undefined?!![]:![]:!![]})[_0x93e0('0xc')](function(_0x443a8f){logger[_0x93e0('0xd')](_0x93e0('0x16'),_0x2ece2b);logger[_0x93e0('0xf')](_0x93e0('0x16'),_0x2ece2b,JSON[_0x93e0('0x10')](_0x443a8f));_0x3ba7c1(_0x443a8f);})[_0x93e0('0x15')](function(_0x1f9366){logger[_0x93e0('0x11')]('CreateSquareDetailsReport',_0x1f9366[_0x93e0('0x13')],_0x2ece2b);_0x17251c(_0x4eba3b[_0x93e0('0x11')](0x1f4,_0x1f9366[_0x93e0('0x13')]));});});}; \ No newline at end of file +var _0x6eb5=['options','raw','lodash','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','create'];(function(_0x2f031b,_0x2faef1){var _0x488b0d=function(_0x2a3dad){while(--_0x2a3dad){_0x2f031b['push'](_0x2f031b['shift']());}};_0x488b0d(++_0x2faef1);}(_0x6eb5,0xf4));var _0x56eb=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x6eb5[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0x56eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56eb('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56eb('0x2'));var config=require(_0x56eb('0x3'));var jayson=require(_0x56eb('0x4'));var client=jayson[_0x56eb('0x5')][_0x56eb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2000d2,_0x372672,_0x406d7a){return new BPromise(function(_0x5c815c,_0x216161){return client[_0x56eb('0x7')](_0x2000d2,_0x406d7a)[_0x56eb('0x8')](function(_0x568d30){logger[_0x56eb('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x372672,_0x56eb('0xa'));logger[_0x56eb('0xb')](_0x56eb('0xc'),_0x372672,'request\x20sent',JSON[_0x56eb('0xd')](_0x568d30));if(_0x568d30['error']){if(_0x568d30[_0x56eb('0xe')]['code']===0x1f4){logger[_0x56eb('0xe')](_0x56eb('0xf'),_0x372672,_0x568d30['error'][_0x56eb('0x10')]);return _0x216161(_0x568d30[_0x56eb('0xe')][_0x56eb('0x10')]);}logger['error'](_0x56eb('0xf'),_0x372672,_0x568d30[_0x56eb('0xe')]['message']);return _0x5c815c(_0x568d30[_0x56eb('0xe')][_0x56eb('0x10')]);}else{logger[_0x56eb('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x372672,_0x56eb('0xa'));_0x5c815c(_0x568d30['result']['message']);}})[_0x56eb('0x11')](function(_0x1c4c50){logger[_0x56eb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x372672,_0x1c4c50);_0x216161(_0x1c4c50);});});}exports[_0x56eb('0x12')]=function(_0x3aeee3){var _0x5a8592=this;return new Promise(function(_0x3025b6,_0xa833e9){return db['SquareDetailsReport'][_0x56eb('0x13')](_0x3aeee3['body'],{'raw':_0x3aeee3[_0x56eb('0x14')]?_0x3aeee3[_0x56eb('0x14')][_0x56eb('0x15')]===undefined?!![]:![]:!![]})[_0x56eb('0x8')](function(_0x423abd){logger[_0x56eb('0x9')]('CreateSquareDetailsReport',_0x3aeee3);logger[_0x56eb('0xb')](_0x56eb('0x12'),_0x3aeee3,JSON['stringify'](_0x423abd));_0x3025b6(_0x423abd);})[_0x56eb('0x11')](function(_0x39fa9a){logger['error'](_0x56eb('0x12'),_0x39fa9a[_0x56eb('0x10')],_0x3aeee3);_0xa833e9(_0x5a8592[_0x56eb('0xe')](0x1f4,_0x39fa9a[_0x56eb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 84e5ac6..a548f5e 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 _0x1198=['get','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','isAuthenticated','index'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x1198,0x1b4));var _0x8119=function(_0x35f1f4,_0x494820){_0x35f1f4=_0x35f1f4-0x0;var _0x1af82a=_0x1198[_0x35f1f4];return _0x1af82a;};'use strict';var express=require(_0x8119('0x0'));var router=express['Router']();var auth=require(_0x8119('0x1'));var controller=require(_0x8119('0x2'));router['get']('/',auth[_0x8119('0x3')](),controller[_0x8119('0x4')]);router[_0x8119('0x5')](_0x8119('0x6'),auth['isAuthenticated'](),controller[_0x8119('0x7')]);module[_0x8119('0x8')]=router; \ No newline at end of file +var _0xa329=['isAuthenticated','index','killProcess','exports','express','Router','./system.controller'];(function(_0x17c262,_0x1bf7f8){var _0x220a71=function(_0x37c4a5){while(--_0x37c4a5){_0x17c262['push'](_0x17c262['shift']());}};_0x220a71(++_0x1bf7f8);}(_0xa329,0x162));var _0x9a32=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0xa329[_0x59145a];return _0xf04d7;};'use strict';var express=require(_0x9a32('0x0'));var router=express[_0x9a32('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9a32('0x2'));router['get']('/',auth[_0x9a32('0x3')](),controller[_0x9a32('0x4')]);router['get']('/process/:pid/kill',auth[_0x9a32('0x3')](),controller[_0x9a32('0x5')]);module[_0x9a32('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c69fa71..be362fe 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 _0xb101=['lodash','error','inspect','name','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb101,0x75));var _0x1b10=function(_0x542afe,_0x3099a3){_0x542afe=_0x542afe-0x0;var _0x35826c=_0xb101[_0x542afe];return _0x35826c;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x1b10('0x0')];var logger=require('../../config/logger')(_0x1b10('0x1'));var util=require('util');var BPromise=require(_0x1b10('0x2'));var _=require(_0x1b10('0x3'));function handleError(_0x33c0d4,_0x417a43,_0x481a06){_0x417a43=_0x417a43||0x1f4;return function(_0x59864b){logger[_0x1b10('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x481a06,_0x417a43,util[_0x1b10('0x5')](_0x59864b,{'showHidden':![],'depth':null}));delete _0x59864b[_0x1b10('0x6')];_0x33c0d4[_0x1b10('0x7')](_0x417a43)[_0x1b10('0x8')](_0x59864b);};}exports[_0x1b10('0x9')]=function(_0x38268b,_0x352056){return info['getAllData']()[_0x1b10('0xa')](function(_0x97dd68){return _0x352056['status'](0xc8)[_0x1b10('0xb')](_0x97dd68);})[_0x1b10('0xc')](function(_0x5c7188){return _0x352056['status'](0x1f4)[_0x1b10('0xb')](_0x5c7188);});};exports[_0x1b10('0xd')]=function(_0x52d151,_0xfe3f64){var _0x3a1c69=['components/import/cm'];return new BPromise(function(_0x5348e9,_0x305432){return exec(util[_0x1b10('0xe')](_0x1b10('0xf'),_0x52d151['params'][_0x1b10('0x10')]),function(_0x57c803,_0x2c23f6,_0x1a7f0e){if(_0x57c803){return _0x305432(_0x57c803);}return _0x5348e9(_0x2c23f6);});})[_0x1b10('0xa')](function(_0x2478c5){var _0x2067d0=![];var _0x2d1066=_0x2478c5['split'](/\n/);for(var _0x57fdad=0x0,_0x527155=_0x3a1c69[_0x1b10('0x11')];_0x57fdad<_0x527155,_0x2067d0===![];_0x57fdad+=0x1){if(_0x2478c5[_0x1b10('0x12')](_0x3a1c69[_0x57fdad])>=0x0){_0x2067d0=!![];}}if(!_0x2067d0){throw new Error(util[_0x1b10('0xe')](_0x1b10('0x13'),_0x52d151['params']['pid']));}process[_0x1b10('0x14')](_0x52d151[_0x1b10('0x15')][_0x1b10('0x10')],_0x1b10('0x16'));return _0xfe3f64[_0x1b10('0x7')](0xc8)[_0x1b10('0xb')]({'message':util['format'](_0x1b10('0x17'),_0x52d151[_0x1b10('0x15')][_0x1b10('0x10')])});})[_0x1b10('0xc')](handleError(_0xfe3f64,null,_0x1b10('0xd')));}; \ No newline at end of file +var _0xb2ec=['catch','json','killProcess','components/import/cm','format','params','pid','length','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','status'];(function(_0x29d18c,_0x13622a){var _0x3b4059=function(_0x2bb94f){while(--_0x2bb94f){_0x29d18c['push'](_0x29d18c['shift']());}};_0x3b4059(++_0x13622a);}(_0xb2ec,0x1de));var _0xcb2e=function(_0x388c5b,_0xa1bd9a){_0x388c5b=_0x388c5b-0x0;var _0x336ddc=_0xb2ec[_0x388c5b];return _0x336ddc;};'use strict';var info=require(_0xcb2e('0x0'));var exec=require(_0xcb2e('0x1'))[_0xcb2e('0x2')];var logger=require(_0xcb2e('0x3'))(_0xcb2e('0x4'));var util=require(_0xcb2e('0x5'));var BPromise=require(_0xcb2e('0x6'));var _=require(_0xcb2e('0x7'));function handleError(_0x5ebc16,_0x55602e,_0x11623d){_0x55602e=_0x55602e||0x1f4;return function(_0x425518){logger[_0xcb2e('0x8')](_0xcb2e('0x9'),_0x11623d,_0x55602e,util['inspect'](_0x425518,{'showHidden':![],'depth':null}));delete _0x425518[_0xcb2e('0xa')];_0x5ebc16['status'](_0x55602e)[_0xcb2e('0xb')](_0x425518);};}exports[_0xcb2e('0xc')]=function(_0x5bce35,_0x3c95ea){return info[_0xcb2e('0xd')]()[_0xcb2e('0xe')](function(_0x207948){return _0x3c95ea[_0xcb2e('0xf')](0xc8)['json'](_0x207948);})[_0xcb2e('0x10')](function(_0xe9100b){return _0x3c95ea[_0xcb2e('0xf')](0x1f4)[_0xcb2e('0x11')](_0xe9100b);});};exports[_0xcb2e('0x12')]=function(_0x1b4b5d,_0x5103a3){var _0x370fc4=[_0xcb2e('0x13')];return new BPromise(function(_0x41fff3,_0x1a657d){return exec(util[_0xcb2e('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1b4b5d[_0xcb2e('0x15')][_0xcb2e('0x16')]),function(_0x1abd48,_0x49f695,_0x59d01a){if(_0x1abd48){return _0x1a657d(_0x1abd48);}return _0x41fff3(_0x49f695);});})[_0xcb2e('0xe')](function(_0x37b1e3){var _0x10e89f=![];var _0x359b66=_0x37b1e3['split'](/\n/);for(var _0x8b9ef0=0x0,_0x428644=_0x370fc4[_0xcb2e('0x17')];_0x8b9ef0<_0x428644,_0x10e89f===![];_0x8b9ef0+=0x1){if(_0x37b1e3['indexOf'](_0x370fc4[_0x8b9ef0])>=0x0){_0x10e89f=!![];}}if(!_0x10e89f){throw new Error(util[_0xcb2e('0x14')](_0xcb2e('0x18'),_0x1b4b5d[_0xcb2e('0x15')][_0xcb2e('0x16')]));}process['kill'](_0x1b4b5d[_0xcb2e('0x15')]['pid'],'SIGINT');return _0x5103a3['status'](0xc8)['json']({'message':util[_0xcb2e('0x14')](_0xcb2e('0x19'),_0x1b4b5d[_0xcb2e('0x15')][_0xcb2e('0x16')])});})['catch'](handleError(_0x5103a3,null,_0xcb2e('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d04abaf..8fb949d 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 _0x6f7a=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','create','put','exports','multer','util'];(function(_0x517ab6,_0x5a58a8){var _0x36615a=function(_0x56eb68){while(--_0x56eb68){_0x517ab6['push'](_0x517ab6['shift']());}};_0x36615a(++_0x5a58a8);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2cc249,_0x586979){_0x2cc249=_0x2cc249-0x0;var _0x516c7f=_0x6f7a[_0x2cc249];return _0x516c7f;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var auth=require(_0xa6f7('0x5'));var interaction=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var controller=require(_0xa6f7('0x8'));router[_0xa6f7('0x9')]('/',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xb')]);router[_0xa6f7('0x9')](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['show']);router['post']('/',auth[_0xa6f7('0xa')](),controller[_0xa6f7('0xd')]);router[_0xa6f7('0xe')](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['update']);router['delete'](_0xa6f7('0xc'),auth[_0xa6f7('0xa')](),controller['destroy']);module[_0xa6f7('0xf')]=router; \ No newline at end of file +var _0x91a7=['show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x3aceaf,_0x3710da){var _0x2f0ead=function(_0x176c52){while(--_0x176c52){_0x3aceaf['push'](_0x3aceaf['shift']());}};_0x2f0ead(++_0x3710da);}(_0x91a7,0xe7));var _0x791a=function(_0x5bbfc7,_0x32321c){_0x5bbfc7=_0x5bbfc7-0x0;var _0x5f4d86=_0x91a7[_0x5bbfc7];return _0x5f4d86;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x791a('0x5')]('/',auth[_0x791a('0x6')](),controller['index']);router[_0x791a('0x5')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x7')]);router['post']('/',auth[_0x791a('0x6')](),controller[_0x791a('0x8')]);router[_0x791a('0x9')](_0x791a('0xa'),auth[_0x791a('0x6')](),controller['update']);router[_0x791a('0xb')](_0x791a('0xa'),auth['isAuthenticated'](),controller[_0x791a('0xc')]);module[_0x791a('0xd')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index abcc0f8..05c96ca 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 _0x087b=['sequelize','exports','STRING'];(function(_0x4da66d,_0x56aead){var _0x32e516=function(_0x29230d){while(--_0x29230d){_0x4da66d['push'](_0x4da66d['shift']());}};_0x32e516(++_0x56aead);}(_0x087b,0x11a));var _0xb087=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x087b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb087('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb087('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','#0091EA','exports','STRING'];(function(_0x4c056a,_0xb0dfac){var _0x10e613=function(_0x12f97e){while(--_0x12f97e){_0x4c056a['push'](_0x4c056a['shift']());}};_0x10e613(++_0xb0dfac);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'unique':_0x0baf('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x3')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d22f315..fd08515 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 _0x6a03=['length','find','create','body','user','role','get','UserProfileSection','autoAssociation','error','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','destroy','then','stack','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','Tag'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x6a03,0x13f));var _0x36a0=function(_0x4b5bbe,_0x4bb2c4){_0x4b5bbe=_0x4b5bbe-0x0;var _0x1daea2=_0x6a03[_0x4b5bbe];return _0x1daea2;};'use strict';var pdf=require(_0x36a0('0x0'));var emlformat=require(_0x36a0('0x1'));var rimraf=require(_0x36a0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36a0('0x3'));var rp=require(_0x36a0('0x4'));var moment=require(_0x36a0('0x5'));var BPromise=require(_0x36a0('0x6'));var Mustache=require('mustache');var util=require(_0x36a0('0x7'));var path=require(_0x36a0('0x8'));var sox=require(_0x36a0('0x9'));var csv=require(_0x36a0('0xa'));var ejs=require(_0x36a0('0xb'));var fs=require('fs');var _=require(_0x36a0('0xc'));var squel=require(_0x36a0('0xd'));var crypto=require(_0x36a0('0xe'));var jsforce=require(_0x36a0('0xf'));var deskjs=require(_0x36a0('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36a0('0x11'));var Redis=require(_0x36a0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x36a0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36a0('0x14'));var logger=require(_0x36a0('0x15'))(_0x36a0('0x16'));var utils=require(_0x36a0('0x17'));var config=require(_0x36a0('0x18'));var db=require(_0x36a0('0x19'))['db'];function respondWithStatusCode(_0x3f9dbb,_0x3bce81){_0x3bce81=_0x3bce81||0xcc;return function(_0x214a4a){if(_0x214a4a){return _0x3f9dbb[_0x36a0('0x1a')](_0x3bce81);}return _0x3f9dbb[_0x36a0('0x1b')](_0x3bce81)[_0x36a0('0x1c')]();};}function respondWithResult(_0xaa8e3d,_0x14966f){_0x14966f=_0x14966f||0xc8;return function(_0x1c7120){if(_0x1c7120){return _0xaa8e3d[_0x36a0('0x1b')](_0x14966f)[_0x36a0('0x1d')](_0x1c7120);}};}function respondWithFilteredResult(_0x20dc02,_0x366712){return function(_0x39a38f){if(_0x39a38f){var _0x278021=_0x39a38f[_0x36a0('0x1e')],_0x49ef99=_0x366712[_0x36a0('0x1f')],_0x3387b8=_0x366712['offset']+_0x366712[_0x36a0('0x20')],_0x391115;if(_0x3387b8>=_0x278021){_0x3387b8=_0x278021;_0x391115=0xc8;}else{_0x391115=0xce;}_0x20dc02[_0x36a0('0x1b')](_0x391115);return _0x20dc02[_0x36a0('0x21')](_0x36a0('0x22'),_0x49ef99+'-'+_0x3387b8+'/'+_0x278021)['json'](_0x39a38f);}return null;};}function patchUpdates(_0x11f7a1){return function(_0x36848d){try{jsonpatch['apply'](_0x36848d,_0x11f7a1,!![]);}catch(_0x33bc10){return BPromise[_0x36a0('0x23')](_0x33bc10);}return _0x36848d['save']();};}function saveUpdates(_0x1706d3,_0xb59ff1){return function(_0x1066dd){if(_0x1066dd){return _0x1066dd['update'](_0x1706d3)['then'](function(_0x340a43){return _0x340a43;});}return null;};}function removeEntity(_0x10078e,_0x4f6572){return function(_0x216be8){if(_0x216be8){return _0x216be8[_0x36a0('0x24')]()[_0x36a0('0x25')](function(){var _0x354adc=_0x216be8['get']({'plain':!![]});var _0x33a90b='Tags';return db['UserProfileResource']['destroy']({'where':{'type':_0x33a90b,'resourceId':_0x354adc['id']}})[_0x36a0('0x25')](function(){return _0x216be8;});})[_0x36a0('0x25')](function(){_0x10078e[_0x36a0('0x1b')](0xcc)[_0x36a0('0x1c')]();});}};}function handleEntityNotFound(_0x56e006,_0x46d2fa){return function(_0x2677de){if(!_0x2677de){_0x56e006['sendStatus'](0x194);}return _0x2677de;};}function handleError(_0x425855,_0x37faf8){_0x37faf8=_0x37faf8||0x1f4;return function(_0x305f05){logger['error'](_0x305f05[_0x36a0('0x26')]);if(_0x305f05[_0x36a0('0x27')]){delete _0x305f05[_0x36a0('0x27')];}_0x425855['status'](_0x37faf8)['send'](_0x305f05);};}exports[_0x36a0('0x28')]=function(_0x1f69ee,_0x1880a4){var _0x51b620={},_0x3db514={},_0x5a0135={'count':0x0,'rows':[]};var _0x2af2dc=_[_0x36a0('0x29')](db['Tag']['rawAttributes'],function(_0x4150ab){return{'name':_0x4150ab['fieldName'],'type':_0x4150ab[_0x36a0('0x2a')][_0x36a0('0x2b')]};});_0x3db514[_0x36a0('0x2c')]=_['map'](_0x2af2dc,'name');_0x3db514[_0x36a0('0x2d')]=_[_0x36a0('0x2e')](_0x1f69ee[_0x36a0('0x2d')]);_0x3db514[_0x36a0('0x2f')]=_[_0x36a0('0x30')](_0x3db514[_0x36a0('0x2c')],_0x3db514[_0x36a0('0x2d')]);_0x51b620[_0x36a0('0x31')]=_[_0x36a0('0x30')](_0x3db514[_0x36a0('0x2c')],qs[_0x36a0('0x32')](_0x1f69ee[_0x36a0('0x2d')]['fields']));_0x51b620[_0x36a0('0x31')]=_0x51b620['attributes']['length']?_0x51b620[_0x36a0('0x31')]:_0x3db514[_0x36a0('0x2c')];if(!_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x33')](_0x36a0('0x34'))){_0x51b620[_0x36a0('0x20')]=qs[_0x36a0('0x20')](_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x20')]);_0x51b620[_0x36a0('0x1f')]=qs[_0x36a0('0x1f')](_0x1f69ee['query'][_0x36a0('0x1f')]);}_0x51b620['order']=qs['sort'](_0x1f69ee[_0x36a0('0x2d')]['sort']);_0x51b620['where']=qs[_0x36a0('0x2f')](_[_0x36a0('0x35')](_0x1f69ee[_0x36a0('0x2d')],_0x3db514['filters']),_0x2af2dc);if(_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x36')]){_0x51b620[_0x36a0('0x37')]=_[_0x36a0('0x38')](_0x51b620['where'],{'$or':_[_0x36a0('0x29')](_0x2af2dc,function(_0x1ab7e2){if(_0x1ab7e2[_0x36a0('0x2a')]!==_0x36a0('0x39')){var _0x4bc04a={};_0x4bc04a[_0x1ab7e2[_0x36a0('0x27')]]={'$like':'%'+_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x36')]+'%'};return _0x4bc04a;}})});}_0x51b620=_[_0x36a0('0x38')]({},_0x51b620,_0x1f69ee[_0x36a0('0x3a')]);var _0x1481d1={'where':_0x51b620[_0x36a0('0x37')]};return db['Tag']['count'](_0x1481d1)['then'](function(_0x97035d){_0x5a0135[_0x36a0('0x1e')]=_0x97035d;if(_0x1f69ee[_0x36a0('0x2d')][_0x36a0('0x3b')]){_0x51b620[_0x36a0('0x3c')]=[{'all':!![]}];}return db['Tag'][_0x36a0('0x3d')](_0x51b620);})[_0x36a0('0x25')](function(_0x5d7d6f){_0x5a0135[_0x36a0('0x3e')]=_0x5d7d6f;return _0x5a0135;})[_0x36a0('0x25')](respondWithFilteredResult(_0x1880a4,_0x51b620))[_0x36a0('0x3f')](handleError(_0x1880a4,null));};exports['show']=function(_0x4c9117,_0x36a8b3){var _0x3dae8d={'raw':!![],'where':{'id':_0x4c9117[_0x36a0('0x40')]['id']}},_0x248377={};_0x248377[_0x36a0('0x2c')]=_[_0x36a0('0x2e')](db[_0x36a0('0x41')]['rawAttributes']);_0x248377['query']=_[_0x36a0('0x2e')](_0x4c9117[_0x36a0('0x2d')]);_0x248377['filters']=_[_0x36a0('0x30')](_0x248377['model'],_0x248377[_0x36a0('0x2d')]);_0x3dae8d['attributes']=_['intersection'](_0x248377['model'],qs[_0x36a0('0x32')](_0x4c9117['query'][_0x36a0('0x32')]));_0x3dae8d[_0x36a0('0x31')]=_0x3dae8d[_0x36a0('0x31')][_0x36a0('0x42')]?_0x3dae8d[_0x36a0('0x31')]:_0x248377[_0x36a0('0x2c')];if(_0x4c9117[_0x36a0('0x2d')][_0x36a0('0x3b')]){_0x3dae8d[_0x36a0('0x3c')]=[{'all':!![]}];}_0x3dae8d=_[_0x36a0('0x38')]({},_0x3dae8d,_0x4c9117[_0x36a0('0x3a')]);return db['Tag'][_0x36a0('0x43')](_0x3dae8d)[_0x36a0('0x25')](handleEntityNotFound(_0x36a8b3,null))[_0x36a0('0x25')](respondWithResult(_0x36a8b3,null))[_0x36a0('0x3f')](handleError(_0x36a8b3,null));};exports[_0x36a0('0x44')]=function(_0x52968a,_0x5e46f6){return db[_0x36a0('0x41')][_0x36a0('0x44')](_0x52968a[_0x36a0('0x45')],{})[_0x36a0('0x25')](function(_0x2bc98b){var _0x255af7=_0x52968a[_0x36a0('0x46')]['get']({'plain':!![]});if(!_0x255af7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x255af7[_0x36a0('0x47')]===_0x36a0('0x46')){var _0x725964=_0x2bc98b[_0x36a0('0x48')]({'plain':!![]});var _0x5b4834='Tags';return db[_0x36a0('0x49')][_0x36a0('0x43')]({'where':{'name':_0x5b4834,'userProfileId':_0x255af7['userProfileId']},'raw':!![]})[_0x36a0('0x25')](function(_0x367467){if(_0x367467&&_0x367467[_0x36a0('0x4a')]===0x0){return db['UserProfileResource'][_0x36a0('0x44')]({'name':_0x725964[_0x36a0('0x27')],'resourceId':_0x725964['id'],'type':_0x367467[_0x36a0('0x27')],'sectionId':_0x367467['id']},{})[_0x36a0('0x25')](function(){return _0x2bc98b;});}else{return _0x2bc98b;}})[_0x36a0('0x3f')](function(_0x33452b){logger[_0x36a0('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33452b);throw _0x33452b;});}return _0x2bc98b;})['then'](respondWithResult(_0x5e46f6,0xc9))[_0x36a0('0x3f')](handleError(_0x5e46f6,null));};exports[_0x36a0('0x4c')]=function(_0x41ce56,_0x2e0461){if(_0x41ce56[_0x36a0('0x45')]['id']){delete _0x41ce56['body']['id'];}return db[_0x36a0('0x41')][_0x36a0('0x43')]({'where':{'id':_0x41ce56[_0x36a0('0x40')]['id']}})[_0x36a0('0x25')](handleEntityNotFound(_0x2e0461,null))[_0x36a0('0x25')](saveUpdates(_0x41ce56['body'],null))[_0x36a0('0x25')](respondWithResult(_0x2e0461,null))['catch'](handleError(_0x2e0461,null));};exports[_0x36a0('0x24')]=function(_0x31c304,_0x3f79fe){return db[_0x36a0('0x41')]['find']({'where':{'id':_0x31c304['params']['id']}})[_0x36a0('0x25')](handleEntityNotFound(_0x3f79fe,null))[_0x36a0('0x25')](removeEntity(_0x3f79fe,null))[_0x36a0('0x3f')](handleError(_0x3f79fe,null));}; \ No newline at end of file +var _0x4b07=['filter','where','merge','options','count','includeAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','save','get','Tags','UserProfileResource','then','error','name','send','index','map','Tag','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort'];(function(_0xee2e7a,_0x58354d){var _0x319dd3=function(_0xa99240){while(--_0xa99240){_0xee2e7a['push'](_0xee2e7a['shift']());}};_0x319dd3(++_0x58354d);}(_0x4b07,0x66));var _0x74b0=function(_0xbdf519,_0x455616){_0xbdf519=_0xbdf519-0x0;var _0x52ac7c=_0x4b07[_0xbdf519];return _0x52ac7c;};'use strict';var pdf=require(_0x74b0('0x0'));var emlformat=require(_0x74b0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74b0('0x2'));var rp=require(_0x74b0('0x3'));var moment=require(_0x74b0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x74b0('0x5'));var path=require(_0x74b0('0x6'));var sox=require(_0x74b0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x74b0('0x8'));var squel=require(_0x74b0('0x9'));var crypto=require(_0x74b0('0xa'));var jsforce=require(_0x74b0('0xb'));var deskjs=require(_0x74b0('0xc'));var toCsv=require(_0x74b0('0xd'));var querystring=require(_0x74b0('0xe'));var Papa=require(_0x74b0('0xf'));var Redis=require(_0x74b0('0x10'));var authService=require(_0x74b0('0x11'));var qs=require(_0x74b0('0x12'));var as=require(_0x74b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b0('0x14'))(_0x74b0('0x15'));var utils=require('../../config/utils');var config=require(_0x74b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3527cb,_0x350aef){_0x350aef=_0x350aef||0xcc;return function(_0x4d8a79){if(_0x4d8a79){return _0x3527cb[_0x74b0('0x17')](_0x350aef);}return _0x3527cb[_0x74b0('0x18')](_0x350aef)[_0x74b0('0x19')]();};}function respondWithResult(_0x3344be,_0x36a375){_0x36a375=_0x36a375||0xc8;return function(_0x518489){if(_0x518489){return _0x3344be[_0x74b0('0x18')](_0x36a375)[_0x74b0('0x1a')](_0x518489);}};}function respondWithFilteredResult(_0x476335,_0x498002){return function(_0x4f6a15){if(_0x4f6a15){var _0x124ff7=_0x4f6a15['count'],_0xc71965=_0x498002[_0x74b0('0x1b')],_0xd4a545=_0x498002[_0x74b0('0x1b')]+_0x498002[_0x74b0('0x1c')],_0x22c518;if(_0xd4a545>=_0x124ff7){_0xd4a545=_0x124ff7;_0x22c518=0xc8;}else{_0x22c518=0xce;}_0x476335[_0x74b0('0x18')](_0x22c518);return _0x476335[_0x74b0('0x1d')](_0x74b0('0x1e'),_0xc71965+'-'+_0xd4a545+'/'+_0x124ff7)[_0x74b0('0x1a')](_0x4f6a15);}return null;};}function patchUpdates(_0x2537db){return function(_0xe8872e){try{jsonpatch['apply'](_0xe8872e,_0x2537db,!![]);}catch(_0x230e1f){return BPromise['reject'](_0x230e1f);}return _0xe8872e[_0x74b0('0x1f')]();};}function saveUpdates(_0x55cde4,_0x244fe0){return function(_0x3e279e){if(_0x3e279e){return _0x3e279e['update'](_0x55cde4)['then'](function(_0x18b833){return _0x18b833;});}return null;};}function removeEntity(_0xbc9442,_0x3c37b6){return function(_0x52e3a6){if(_0x52e3a6){return _0x52e3a6['destroy']()['then'](function(){var _0x3a8bde=_0x52e3a6[_0x74b0('0x20')]({'plain':!![]});var _0x1c7b70=_0x74b0('0x21');return db[_0x74b0('0x22')]['destroy']({'where':{'type':_0x1c7b70,'resourceId':_0x3a8bde['id']}})[_0x74b0('0x23')](function(){return _0x52e3a6;});})[_0x74b0('0x23')](function(){_0xbc9442[_0x74b0('0x18')](0xcc)[_0x74b0('0x19')]();});}};}function handleEntityNotFound(_0x29e728,_0x4cf607){return function(_0x2dee11){if(!_0x2dee11){_0x29e728[_0x74b0('0x17')](0x194);}return _0x2dee11;};}function handleError(_0x5720f1,_0x485558){_0x485558=_0x485558||0x1f4;return function(_0x61f902){logger[_0x74b0('0x24')](_0x61f902['stack']);if(_0x61f902[_0x74b0('0x25')]){delete _0x61f902['name'];}_0x5720f1[_0x74b0('0x18')](_0x485558)[_0x74b0('0x26')](_0x61f902);};}exports[_0x74b0('0x27')]=function(_0x49b71f,_0x19fc13){var _0x5ae279={},_0x330963={},_0x2f9b89={'count':0x0,'rows':[]};var _0x34577c=_[_0x74b0('0x28')](db[_0x74b0('0x29')]['rawAttributes'],function(_0x331783){return{'name':_0x331783['fieldName'],'type':_0x331783[_0x74b0('0x2a')][_0x74b0('0x2b')]};});_0x330963[_0x74b0('0x2c')]=_[_0x74b0('0x28')](_0x34577c,'name');_0x330963[_0x74b0('0x2d')]=_['keys'](_0x49b71f[_0x74b0('0x2d')]);_0x330963[_0x74b0('0x2e')]=_['intersection'](_0x330963[_0x74b0('0x2c')],_0x330963[_0x74b0('0x2d')]);_0x5ae279[_0x74b0('0x2f')]=_[_0x74b0('0x30')](_0x330963[_0x74b0('0x2c')],qs['fields'](_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x31')]));_0x5ae279[_0x74b0('0x2f')]=_0x5ae279[_0x74b0('0x2f')]['length']?_0x5ae279[_0x74b0('0x2f')]:_0x330963['model'];if(!_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x32')]('nolimit')){_0x5ae279[_0x74b0('0x1c')]=qs[_0x74b0('0x1c')](_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x1c')]);_0x5ae279[_0x74b0('0x1b')]=qs[_0x74b0('0x1b')](_0x49b71f[_0x74b0('0x2d')]['offset']);}_0x5ae279['order']=qs[_0x74b0('0x33')](_0x49b71f['query'][_0x74b0('0x33')]);_0x5ae279['where']=qs[_0x74b0('0x2e')](_['pick'](_0x49b71f[_0x74b0('0x2d')],_0x330963[_0x74b0('0x2e')]),_0x34577c);if(_0x49b71f['query'][_0x74b0('0x34')]){_0x5ae279[_0x74b0('0x35')]=_[_0x74b0('0x36')](_0x5ae279[_0x74b0('0x35')],{'$or':_[_0x74b0('0x28')](_0x34577c,function(_0x49f5dc){if(_0x49f5dc[_0x74b0('0x2a')]!=='VIRTUAL'){var _0x413f75={};_0x413f75[_0x49f5dc['name']]={'$like':'%'+_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x34')]+'%'};return _0x413f75;}})});}_0x5ae279=_[_0x74b0('0x36')]({},_0x5ae279,_0x49b71f[_0x74b0('0x37')]);var _0x48524a={'where':_0x5ae279['where']};return db[_0x74b0('0x29')][_0x74b0('0x38')](_0x48524a)[_0x74b0('0x23')](function(_0x18b159){_0x2f9b89[_0x74b0('0x38')]=_0x18b159;if(_0x49b71f[_0x74b0('0x2d')][_0x74b0('0x39')]){_0x5ae279['include']=[{'all':!![]}];}return db[_0x74b0('0x29')]['findAll'](_0x5ae279);})[_0x74b0('0x23')](function(_0x250aa9){_0x2f9b89[_0x74b0('0x3a')]=_0x250aa9;return _0x2f9b89;})[_0x74b0('0x23')](respondWithFilteredResult(_0x19fc13,_0x5ae279))[_0x74b0('0x3b')](handleError(_0x19fc13,null));};exports[_0x74b0('0x3c')]=function(_0x403477,_0x18ab4b){var _0xe3cd32={'raw':!![],'where':{'id':_0x403477[_0x74b0('0x3d')]['id']}},_0x401850={};_0x401850['model']=_[_0x74b0('0x3e')](db[_0x74b0('0x29')][_0x74b0('0x3f')]);_0x401850[_0x74b0('0x2d')]=_[_0x74b0('0x3e')](_0x403477[_0x74b0('0x2d')]);_0x401850['filters']=_[_0x74b0('0x30')](_0x401850[_0x74b0('0x2c')],_0x401850[_0x74b0('0x2d')]);_0xe3cd32['attributes']=_['intersection'](_0x401850[_0x74b0('0x2c')],qs[_0x74b0('0x31')](_0x403477[_0x74b0('0x2d')][_0x74b0('0x31')]));_0xe3cd32['attributes']=_0xe3cd32['attributes'][_0x74b0('0x40')]?_0xe3cd32[_0x74b0('0x2f')]:_0x401850['model'];if(_0x403477[_0x74b0('0x2d')][_0x74b0('0x39')]){_0xe3cd32[_0x74b0('0x41')]=[{'all':!![]}];}_0xe3cd32=_[_0x74b0('0x36')]({},_0xe3cd32,_0x403477[_0x74b0('0x37')]);return db[_0x74b0('0x29')][_0x74b0('0x42')](_0xe3cd32)[_0x74b0('0x23')](handleEntityNotFound(_0x18ab4b,null))[_0x74b0('0x23')](respondWithResult(_0x18ab4b,null))[_0x74b0('0x3b')](handleError(_0x18ab4b,null));};exports[_0x74b0('0x43')]=function(_0x4d4585,_0x5c9e3a){return db['Tag']['create'](_0x4d4585[_0x74b0('0x44')],{})['then'](function(_0x5d8089){var _0xf3f691=_0x4d4585[_0x74b0('0x45')][_0x74b0('0x20')]({'plain':!![]});if(!_0xf3f691)throw new Error(_0x74b0('0x46'));if(_0xf3f691[_0x74b0('0x47')]===_0x74b0('0x45')){var _0x434533=_0x5d8089['get']({'plain':!![]});var _0x52e678=_0x74b0('0x21');return db[_0x74b0('0x48')]['find']({'where':{'name':_0x52e678,'userProfileId':_0xf3f691[_0x74b0('0x49')]},'raw':!![]})['then'](function(_0x3adfd1){if(_0x3adfd1&&_0x3adfd1[_0x74b0('0x4a')]===0x0){return db[_0x74b0('0x22')][_0x74b0('0x43')]({'name':_0x434533[_0x74b0('0x25')],'resourceId':_0x434533['id'],'type':_0x3adfd1[_0x74b0('0x25')],'sectionId':_0x3adfd1['id']},{})[_0x74b0('0x23')](function(){return _0x5d8089;});}else{return _0x5d8089;}})[_0x74b0('0x3b')](function(_0x97136d){logger[_0x74b0('0x24')](_0x74b0('0x4b'),_0x97136d);throw _0x97136d;});}return _0x5d8089;})['then'](respondWithResult(_0x5c9e3a,0xc9))[_0x74b0('0x3b')](handleError(_0x5c9e3a,null));};exports[_0x74b0('0x4c')]=function(_0x5a031b,_0x508962){if(_0x5a031b[_0x74b0('0x44')]['id']){delete _0x5a031b[_0x74b0('0x44')]['id'];}return db[_0x74b0('0x29')]['find']({'where':{'id':_0x5a031b[_0x74b0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x508962,null))[_0x74b0('0x23')](saveUpdates(_0x5a031b[_0x74b0('0x44')],null))[_0x74b0('0x23')](respondWithResult(_0x508962,null))[_0x74b0('0x3b')](handleError(_0x508962,null));};exports['destroy']=function(_0x5e42db,_0x3ee2c7){return db[_0x74b0('0x29')][_0x74b0('0x42')]({'where':{'id':_0x5e42db[_0x74b0('0x3d')]['id']}})[_0x74b0('0x23')](handleEntityNotFound(_0x3ee2c7,null))[_0x74b0('0x23')](removeEntity(_0x3ee2c7,null))[_0x74b0('0x3b')](handleError(_0x3ee2c7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index d505264..b8b99c4 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 _0x017e=['define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x017e,0x6b));var _0xe017=function(_0xe97e4c,_0x486a93){_0xe97e4c=_0xe97e4c-0x0;var _0x2a2f09=_0x017e[_0xe97e4c];return _0x2a2f09;};'use strict';var _=require(_0xe017('0x0'));var util=require(_0xe017('0x1'));var logger=require(_0xe017('0x2'))(_0xe017('0x3'));var moment=require(_0xe017('0x4'));var BPromise=require(_0xe017('0x5'));var rp=require(_0xe017('0x6'));var fs=require('fs');var path=require(_0xe017('0x7'));var rimraf=require(_0xe017('0x8'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xe017('0x9')]=function(_0xf36522,_0x4a859d){return _0xf36522[_0xe017('0xa')](_0xe017('0xb'),attributes,{'tableName':_0xe017('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','api'];(function(_0x4be14a,_0x50e1ca){var _0x143618=function(_0xd7ce4d){while(--_0xd7ce4d){_0x4be14a['push'](_0x4be14a['shift']());}};_0x143618(++_0x50e1ca);}(_0x687b,0x1eb));var _0xb687=function(_0x396dc6,_0x529342){_0x396dc6=_0x396dc6-0x0;var _0x285078=_0x687b[_0x396dc6];return _0x285078;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require('../../config/logger')(_0xb687('0x2'));var moment=require(_0xb687('0x3'));var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0xfdc315,_0x396831){return _0xfdc315[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 67f3a69..0f0b8d8 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 _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3edc05,_0x36420d){var _0x6ce7dc=function(_0x3d2b3c){while(--_0x3d2b3c){_0x3edc05['push'](_0x3edc05['shift']());}};_0x6ce7dc(++_0x36420d);}(_0xca66,0x8b));var _0x6ca6=function(_0x20c07d,_0x4c5d3c){_0x20c07d=_0x20c07d-0x0;var _0xe45bf1=_0xca66[_0x20c07d];return _0xe45bf1;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file +var _0x39cb=['code','Tag,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('Tag,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c05ad86..aa8ebf6 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 _0x8652=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','isAuthenticated','show','/:id/queues','getQueues','/:id/users','getAgents','create','post','addAgents','put','delete','destroy','removeQueues','exports'];(function(_0x137fdc,_0x350ef5){var _0x4594b8=function(_0x3bc436){while(--_0x3bc436){_0x137fdc['push'](_0x137fdc['shift']());}};_0x4594b8(++_0x350ef5);}(_0x8652,0x68));var _0x2865=function(_0x358c86,_0x38a8a2){_0x358c86=_0x358c86-0x0;var _0x52edc5=_0x8652[_0x358c86];return _0x52edc5;};'use strict';var multer=require(_0x2865('0x0'));var util=require(_0x2865('0x1'));var path=require(_0x2865('0x2'));var timeout=require(_0x2865('0x3'));var express=require(_0x2865('0x4'));var router=express['Router']();var auth=require(_0x2865('0x5'));var interaction=require(_0x2865('0x6'));var config=require(_0x2865('0x7'));var controller=require(_0x2865('0x8'));router[_0x2865('0x9')]('/',auth['isAuthenticated'](),controller[_0x2865('0xa')]);router[_0x2865('0x9')](_0x2865('0xb'),auth[_0x2865('0xc')](),controller[_0x2865('0xd')]);router[_0x2865('0x9')](_0x2865('0xe'),auth[_0x2865('0xc')](),controller[_0x2865('0xf')]);router[_0x2865('0x9')](_0x2865('0x10'),auth[_0x2865('0xc')](),controller[_0x2865('0x11')]);router['post']('/',auth[_0x2865('0xc')](),controller[_0x2865('0x12')]);router[_0x2865('0x13')](_0x2865('0xe'),auth[_0x2865('0xc')](),controller['addQueues']);router[_0x2865('0x13')](_0x2865('0x10'),auth[_0x2865('0xc')](),controller[_0x2865('0x14')]);router[_0x2865('0x15')](_0x2865('0xb'),auth[_0x2865('0xc')](),controller['update']);router[_0x2865('0x16')]('/:id',auth[_0x2865('0xc')](),controller[_0x2865('0x17')]);router[_0x2865('0x16')](_0x2865('0xe'),auth[_0x2865('0xc')](),controller[_0x2865('0x18')]);router[_0x2865('0x16')](_0x2865('0x10'),auth[_0x2865('0xc')](),controller['removeAgents']);module[_0x2865('0x19')]=router; \ No newline at end of file +var _0x1a26=['exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','post','create','addQueues','/:id/users','addAgents','update','delete','destroy','removeQueues','removeAgents'];(function(_0x4f4cdc,_0x4cb0b){var _0x15a8fe=function(_0x5bf529){while(--_0x5bf529){_0x4f4cdc['push'](_0x4f4cdc['shift']());}};_0x15a8fe(++_0x4cb0b);}(_0x1a26,0x1e1));var _0x61a2=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x1a26[_0x39e84d];return _0x1991bc;};'use strict';var multer=require('multer');var util=require(_0x61a2('0x0'));var path=require('path');var timeout=require(_0x61a2('0x1'));var express=require('express');var router=express[_0x61a2('0x2')]();var auth=require(_0x61a2('0x3'));var interaction=require(_0x61a2('0x4'));var config=require('../../config/environment');var controller=require(_0x61a2('0x5'));router[_0x61a2('0x6')]('/',auth[_0x61a2('0x7')](),controller[_0x61a2('0x8')]);router[_0x61a2('0x6')](_0x61a2('0x9'),auth[_0x61a2('0x7')](),controller[_0x61a2('0xa')]);router[_0x61a2('0x6')](_0x61a2('0xb'),auth[_0x61a2('0x7')](),controller[_0x61a2('0xc')]);router[_0x61a2('0x6')]('/:id/users',auth[_0x61a2('0x7')](),controller['getAgents']);router[_0x61a2('0xd')]('/',auth[_0x61a2('0x7')](),controller[_0x61a2('0xe')]);router['post']('/:id/queues',auth[_0x61a2('0x7')](),controller[_0x61a2('0xf')]);router['post'](_0x61a2('0x10'),auth[_0x61a2('0x7')](),controller[_0x61a2('0x11')]);router['put'](_0x61a2('0x9'),auth['isAuthenticated'](),controller[_0x61a2('0x12')]);router[_0x61a2('0x13')]('/:id',auth[_0x61a2('0x7')](),controller[_0x61a2('0x14')]);router[_0x61a2('0x13')](_0x61a2('0xb'),auth[_0x61a2('0x7')](),controller[_0x61a2('0x15')]);router[_0x61a2('0x13')](_0x61a2('0x10'),auth['isAuthenticated'](),controller[_0x61a2('0x16')]);module[_0x61a2('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 45a796f..ac1aa7d 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 _0x8f53=['STRING','name','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f53,0xb3));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x38f5('0x0')]={'name':{'type':Sequelize[_0x38f5('0x1')],'allowNull':![],'unique':_0x38f5('0x2')},'description':{'type':Sequelize[_0x38f5('0x1')]}}; \ No newline at end of file +var _0xe900=['exports','STRING','name','sequelize'];(function(_0x2fef52,_0x2ae797){var _0x5f484c=function(_0x3b1036){while(--_0x3b1036){_0x2fef52['push'](_0x2fef52['shift']());}};_0x5f484c(++_0x2ae797);}(_0xe900,0x1a7));var _0x0e90=function(_0x4f3c4f,_0x4be3ac){_0x4f3c4f=_0x4f3c4f-0x0;var _0x38a198=_0xe900[_0x4f3c4f];return _0x38a198;};'use strict';var Sequelize=require(_0x0e90('0x0'));module[_0x0e90('0x1')]={'name':{'type':Sequelize[_0x0e90('0x2')],'allowNull':![],'unique':_0x0e90('0x3')},'description':{'type':Sequelize[_0x0e90('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index e461e9d..0980a84 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 _0x3b2e=['voice','destroy','isArray','userTeam:remove','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','count','offset','limit','Content-Range','json','apply','save','update','then','get','end','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','Queues','addQueues','add','ids','remove','toLowerCase','addAgents','Voice','Chat','Mail','Sms','each','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','mail','sms','whatsapp'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x3b2e,0x10a));var _0xe3b2=function(_0x562163,_0x264e2a){_0x562163=_0x562163-0x0;var _0x551eed=_0x3b2e[_0x562163];return _0x551eed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3b2('0x0'));var rimraf=require(_0xe3b2('0x1'));var zipdir=require(_0xe3b2('0x2'));var jsonpatch=require(_0xe3b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3b2('0x4'));var Mustache=require(_0xe3b2('0x5'));var util=require('util');var path=require(_0xe3b2('0x6'));var sox=require(_0xe3b2('0x7'));var csv=require(_0xe3b2('0x8'));var ejs=require(_0xe3b2('0x9'));var fs=require('fs');var _=require(_0xe3b2('0xa'));var squel=require('squel');var crypto=require(_0xe3b2('0xb'));var jsforce=require(_0xe3b2('0xc'));var deskjs=require(_0xe3b2('0xd'));var toCsv=require(_0xe3b2('0x8'));var querystring=require(_0xe3b2('0xe'));var Papa=require(_0xe3b2('0xf'));var Redis=require(_0xe3b2('0x10'));var authService=require(_0xe3b2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3b2('0x12'));var logger=require(_0xe3b2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe3b2('0x14'));var db=require(_0xe3b2('0x15'))['db'];config[_0xe3b2('0x16')]=_[_0xe3b2('0x17')](config[_0xe3b2('0x16')],{'host':_0xe3b2('0x18'),'port':0x18eb});var socket=require(_0xe3b2('0x19'))(new Redis(config[_0xe3b2('0x16')]));require(_0xe3b2('0x1a'))[_0xe3b2('0x1b')](socket);function respondWithStatusCode(_0xf7523d,_0x51cd01){_0x51cd01=_0x51cd01||0xcc;return function(_0x43e30b){if(_0x43e30b){return _0xf7523d['sendStatus'](_0x51cd01);}return _0xf7523d['status'](_0x51cd01)['end']();};}function respondWithResult(_0x4f2148,_0x3e8d72){_0x3e8d72=_0x3e8d72||0xc8;return function(_0x41be10){if(_0x41be10){return _0x4f2148[_0xe3b2('0x1c')](_0x3e8d72)['json'](_0x41be10);}};}function respondWithFilteredResult(_0x2299b5,_0x3a41c5){return function(_0x55df6e){if(_0x55df6e){var _0x406cb9=_0x55df6e[_0xe3b2('0x1d')],_0x4171f2=_0x3a41c5['offset'],_0x5a0c14=_0x3a41c5[_0xe3b2('0x1e')]+_0x3a41c5[_0xe3b2('0x1f')],_0x3febdf;if(_0x5a0c14>=_0x406cb9){_0x5a0c14=_0x406cb9;_0x3febdf=0xc8;}else{_0x3febdf=0xce;}_0x2299b5[_0xe3b2('0x1c')](_0x3febdf);return _0x2299b5['set'](_0xe3b2('0x20'),_0x4171f2+'-'+_0x5a0c14+'/'+_0x406cb9)[_0xe3b2('0x21')](_0x55df6e);}return null;};}function patchUpdates(_0x2716a5){return function(_0x4a19de){try{jsonpatch[_0xe3b2('0x22')](_0x4a19de,_0x2716a5,!![]);}catch(_0x30a274){return BPromise['reject'](_0x30a274);}return _0x4a19de[_0xe3b2('0x23')]();};}function saveUpdates(_0x5b0130,_0x23852a){return function(_0x2ee612){if(_0x2ee612){return _0x2ee612[_0xe3b2('0x24')](_0x5b0130)[_0xe3b2('0x25')](function(_0x20b65e){return _0x20b65e;});}return null;};}function removeEntity(_0x18eb1d,_0x457ba2){return function(_0x31eaa6){if(_0x31eaa6){return _0x31eaa6['destroy']()[_0xe3b2('0x25')](function(){var _0x1017d7=_0x31eaa6[_0xe3b2('0x26')]({'plain':!![]});var _0x3450d4='Teams';return db['UserProfileResource']['destroy']({'where':{'type':_0x3450d4,'resourceId':_0x1017d7['id']}})[_0xe3b2('0x25')](function(){return _0x31eaa6;});})[_0xe3b2('0x25')](function(){_0x18eb1d['status'](0xcc)[_0xe3b2('0x27')]();});}};}function handleEntityNotFound(_0x651a40,_0x296e4d){return function(_0x1537b2){if(!_0x1537b2){_0x651a40[_0xe3b2('0x28')](0x194);}return _0x1537b2;};}function handleError(_0xabf7ea,_0x4f04ab){_0x4f04ab=_0x4f04ab||0x1f4;return function(_0x1a923a){logger[_0xe3b2('0x29')](_0x1a923a[_0xe3b2('0x2a')]);if(_0x1a923a[_0xe3b2('0x2b')]){delete _0x1a923a['name'];}_0xabf7ea['status'](_0x4f04ab)[_0xe3b2('0x2c')](_0x1a923a);};}exports[_0xe3b2('0x2d')]=function(_0x326460,_0x21e053){var _0x2ef914={},_0x35e40b={},_0x4fe25b={'count':0x0,'rows':[]};var _0x112d82=_[_0xe3b2('0x2e')](db[_0xe3b2('0x2f')][_0xe3b2('0x30')],function(_0x46c59d){return{'name':_0x46c59d[_0xe3b2('0x31')],'type':_0x46c59d[_0xe3b2('0x32')][_0xe3b2('0x33')]};});_0x35e40b[_0xe3b2('0x34')]=_[_0xe3b2('0x2e')](_0x112d82,_0xe3b2('0x2b'));_0x35e40b[_0xe3b2('0x35')]=_[_0xe3b2('0x36')](_0x326460['query']);_0x35e40b[_0xe3b2('0x37')]=_[_0xe3b2('0x38')](_0x35e40b[_0xe3b2('0x34')],_0x35e40b['query']);_0x2ef914['attributes']=_[_0xe3b2('0x38')](_0x35e40b['model'],qs[_0xe3b2('0x39')](_0x326460[_0xe3b2('0x35')][_0xe3b2('0x39')]));_0x2ef914[_0xe3b2('0x3a')]=_0x2ef914[_0xe3b2('0x3a')][_0xe3b2('0x3b')]?_0x2ef914[_0xe3b2('0x3a')]:_0x35e40b['model'];if(!_0x326460[_0xe3b2('0x35')][_0xe3b2('0x3c')](_0xe3b2('0x3d'))){_0x2ef914[_0xe3b2('0x1f')]=qs['limit'](_0x326460[_0xe3b2('0x35')][_0xe3b2('0x1f')]);_0x2ef914[_0xe3b2('0x1e')]=qs[_0xe3b2('0x1e')](_0x326460[_0xe3b2('0x35')]['offset']);}_0x2ef914[_0xe3b2('0x3e')]=qs[_0xe3b2('0x3f')](_0x326460['query'][_0xe3b2('0x3f')]);_0x2ef914[_0xe3b2('0x40')]=qs[_0xe3b2('0x37')](_['pick'](_0x326460[_0xe3b2('0x35')],_0x35e40b['filters']),_0x112d82);if(_0x326460['query'][_0xe3b2('0x41')]){_0x2ef914[_0xe3b2('0x40')]=_[_0xe3b2('0x42')](_0x2ef914[_0xe3b2('0x40')],{'$or':_['map'](_0x112d82,function(_0x550e52){if(_0x550e52[_0xe3b2('0x32')]!==_0xe3b2('0x43')){var _0x3ead97={};_0x3ead97[_0x550e52['name']]={'$like':'%'+_0x326460[_0xe3b2('0x35')][_0xe3b2('0x41')]+'%'};return _0x3ead97;}})});}_0x2ef914=_[_0xe3b2('0x42')]({},_0x2ef914,_0x326460['options']);var _0x246df8={'where':_0x2ef914['where']};return db[_0xe3b2('0x2f')][_0xe3b2('0x1d')](_0x246df8)[_0xe3b2('0x25')](function(_0xd0f4a6){_0x4fe25b[_0xe3b2('0x1d')]=_0xd0f4a6;if(_0x326460['query'][_0xe3b2('0x44')]){_0x2ef914[_0xe3b2('0x45')]=[{'all':!![]}];}return db[_0xe3b2('0x2f')][_0xe3b2('0x46')](_0x2ef914);})[_0xe3b2('0x25')](function(_0xb144b3){_0x4fe25b['rows']=_0xb144b3;return _0x4fe25b;})[_0xe3b2('0x25')](respondWithFilteredResult(_0x21e053,_0x2ef914))['catch'](handleError(_0x21e053,null));};exports[_0xe3b2('0x47')]=function(_0x4166d0,_0x3abceb){var _0x4694e9={'raw':![],'where':{'id':_0x4166d0[_0xe3b2('0x48')]['id']}},_0x19a239={};_0x19a239[_0xe3b2('0x34')]=_[_0xe3b2('0x36')](db[_0xe3b2('0x2f')][_0xe3b2('0x30')]);_0x19a239[_0xe3b2('0x35')]=_[_0xe3b2('0x36')](_0x4166d0[_0xe3b2('0x35')]);_0x19a239[_0xe3b2('0x37')]=_[_0xe3b2('0x38')](_0x19a239['model'],_0x19a239['query']);_0x4694e9[_0xe3b2('0x3a')]=_['intersection'](_0x19a239[_0xe3b2('0x34')],qs[_0xe3b2('0x39')](_0x4166d0[_0xe3b2('0x35')]['fields']));_0x4694e9[_0xe3b2('0x3a')]=_0x4694e9['attributes'][_0xe3b2('0x3b')]?_0x4694e9['attributes']:_0x19a239[_0xe3b2('0x34')];if(_0x4166d0[_0xe3b2('0x35')][_0xe3b2('0x44')]){_0x4694e9[_0xe3b2('0x45')]=[{'all':!![]}];}_0x4694e9=_['merge']({},_0x4694e9,_0x4166d0[_0xe3b2('0x49')]);return db['Team'][_0xe3b2('0x4a')](_0x4694e9)[_0xe3b2('0x25')](handleEntityNotFound(_0x3abceb,null))['then'](respondWithResult(_0x3abceb,null))[_0xe3b2('0x4b')](handleError(_0x3abceb,null));};exports[_0xe3b2('0x4c')]=function(_0x3f0a68,_0x2a8b05){return db['Team'][_0xe3b2('0x4c')](_0x3f0a68['body'],{})[_0xe3b2('0x25')](function(_0x493bb6){var _0x1fb32c=_0x3f0a68['user'][_0xe3b2('0x26')]({'plain':!![]});if(!_0x1fb32c)throw new Error(_0xe3b2('0x4d'));if(_0x1fb32c[_0xe3b2('0x4e')]===_0xe3b2('0x4f')){var _0x1dda6a=_0x493bb6[_0xe3b2('0x26')]({'plain':!![]});var _0x820b08=_0xe3b2('0x50');return db[_0xe3b2('0x51')][_0xe3b2('0x4a')]({'where':{'name':_0x820b08,'userProfileId':_0x1fb32c[_0xe3b2('0x52')]},'raw':!![]})[_0xe3b2('0x25')](function(_0x9183ed){if(_0x9183ed&&_0x9183ed[_0xe3b2('0x53')]===0x0){return db[_0xe3b2('0x54')][_0xe3b2('0x4c')]({'name':_0x1dda6a['name'],'resourceId':_0x1dda6a['id'],'type':_0x9183ed[_0xe3b2('0x2b')],'sectionId':_0x9183ed['id']},{})['then'](function(){return _0x493bb6;});}else{return _0x493bb6;}})[_0xe3b2('0x4b')](function(_0x308dc8){logger[_0xe3b2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x308dc8);throw _0x308dc8;});}return _0x493bb6;})['then'](respondWithResult(_0x2a8b05,0xc9))[_0xe3b2('0x4b')](handleError(_0x2a8b05,null));};exports[_0xe3b2('0x24')]=function(_0x4661c1,_0x3ad1b6){if(_0x4661c1[_0xe3b2('0x55')]['id']){delete _0x4661c1['body']['id'];}return db[_0xe3b2('0x2f')][_0xe3b2('0x4a')]({'where':{'id':_0x4661c1['params']['id']}})['then'](handleEntityNotFound(_0x3ad1b6,null))[_0xe3b2('0x25')](saveUpdates(_0x4661c1['body'],null))['then'](respondWithResult(_0x3ad1b6,null))[_0xe3b2('0x4b')](handleError(_0x3ad1b6,null));};exports['destroy']=function(_0x364ae0,_0x3b1dc1){return db[_0xe3b2('0x2f')][_0xe3b2('0x4a')]({'where':{'id':_0x364ae0['params']['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x3b1dc1,null))[_0xe3b2('0x25')](removeEntity(_0x3b1dc1,null))[_0xe3b2('0x4b')](handleError(_0x3b1dc1,null));};exports[_0xe3b2('0x56')]=function(_0x4f3078,_0x4b148a,_0x34f642){return db[_0xe3b2('0x2f')][_0xe3b2('0x57')]({'where':{'id':_0x4f3078[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x4b148a,null))[_0xe3b2('0x25')](function(_0x38d2c0){if(!_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x58')]||!utils[_0xe3b2('0x59')](_0x4f3078['query']['channel'])){throw new db[(_0xe3b2('0x5a'))][(_0xe3b2('0x5b'))](_0xe3b2('0x5c'));}var _0x6fb47f={};var _0x4c4c31={};_0x4c4c31[_0xe3b2('0x34')]=_[_0xe3b2('0x36')](db[_[_0xe3b2('0x5d')](_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x58')]['toLowerCase']())+_0xe3b2('0x5e')]['rawAttributes']);_0x4c4c31['query']=_[_0xe3b2('0x36')](_0x4f3078[_0xe3b2('0x35')]);_0x4c4c31[_0xe3b2('0x37')]=_[_0xe3b2('0x38')](_0x4c4c31[_0xe3b2('0x34')],_0x4c4c31[_0xe3b2('0x35')]);_0x6fb47f[_0xe3b2('0x3a')]=_[_0xe3b2('0x38')](_0x4c4c31[_0xe3b2('0x34')],qs[_0xe3b2('0x39')](_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x39')]));_0x6fb47f[_0xe3b2('0x3a')]=_0x6fb47f[_0xe3b2('0x3a')][_0xe3b2('0x3b')]?_0x6fb47f[_0xe3b2('0x3a')]:_0x4c4c31[_0xe3b2('0x34')];_0x6fb47f[_0xe3b2('0x1f')]=qs[_0xe3b2('0x1f')](_0x4f3078['query']['limit']);_0x6fb47f['offset']=qs[_0xe3b2('0x1e')](_0x4f3078['query']['offset']);_0x6fb47f[_0xe3b2('0x3e')]=qs[_0xe3b2('0x3f')](_0x4f3078['query'][_0xe3b2('0x3f')]);_0x6fb47f['where']=qs[_0xe3b2('0x37')](_['pick'](_0x4f3078[_0xe3b2('0x35')],_0x4c4c31[_0xe3b2('0x37')]));_0x6fb47f=_[_0xe3b2('0x42')]({},_0x6fb47f,_0x4f3078[_0xe3b2('0x49')]);return _0x38d2c0['get'+_[_0xe3b2('0x5d')](_0x4f3078[_0xe3b2('0x35')][_0xe3b2('0x58')]['toLowerCase']())+_0xe3b2('0x5f')](_0x6fb47f);})['then'](respondWithResult(_0x4b148a,null))[_0xe3b2('0x4b')](handleError(_0x4b148a,null));};exports[_0xe3b2('0x60')]=function(_0x244743,_0xe7c804,_0x35eb30){return db['Team'][_0xe3b2('0x57')]({'where':{'id':_0x244743[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](function(_0x244a4b){if(_0x244a4b){if(!_0x244743[_0xe3b2('0x55')][_0xe3b2('0x58')]||!utils[_0xe3b2('0x59')](_0x244743[_0xe3b2('0x55')][_0xe3b2('0x58')])){throw new db['Sequelize']['ValidationError'](_0xe3b2('0x5c'));}return _0x244a4b[_0xe3b2('0x61')+_[_0xe3b2('0x5d')](_0x244743[_0xe3b2('0x55')][_0xe3b2('0x58')]['toLowerCase']())+'Queues'](_0x244743[_0xe3b2('0x55')][_0xe3b2('0x62')]);}return null;})[_0xe3b2('0x25')](handleEntityNotFound(_0xe7c804,null))[_0xe3b2('0x25')](respondWithStatusCode(_0xe7c804,null))[_0xe3b2('0x4b')](handleError(_0xe7c804,null));};exports['removeQueues']=function(_0x5cb491,_0x1b6a74,_0x2d91bd){return db[_0xe3b2('0x2f')][_0xe3b2('0x57')]({'where':{'id':_0x5cb491[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](function(_0x3cd885){if(_0x3cd885){if(!_0x5cb491[_0xe3b2('0x35')]['channel']||!utils[_0xe3b2('0x59')](_0x5cb491[_0xe3b2('0x35')][_0xe3b2('0x58')])){throw new db[(_0xe3b2('0x5a'))]['ValidationError'](_0xe3b2('0x5c'));}return _0x3cd885[_0xe3b2('0x63')+_['capitalize'](_0x5cb491[_0xe3b2('0x35')][_0xe3b2('0x58')][_0xe3b2('0x64')]())+_0xe3b2('0x5f')](_0x5cb491['query'][_0xe3b2('0x62')]);}return null;})[_0xe3b2('0x25')](handleEntityNotFound(_0x1b6a74,null))['then'](respondWithStatusCode(_0x1b6a74,null))['catch'](handleError(_0x1b6a74,null));};exports[_0xe3b2('0x65')]=function(_0x4a5a89,_0x1476f3,_0x39c5ca){return db[_0xe3b2('0x2f')][_0xe3b2('0x4a')]({'where':{'id':_0x4a5a89[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x1476f3,null))[_0xe3b2('0x25')](function(_0x36d978){if(_0x36d978){var _0x5789b7=[_0xe3b2('0x66'),_0xe3b2('0x67'),_0xe3b2('0x68'),_0xe3b2('0x69'),'Fax','Openchannel','Whatsapp'];return BPromise[_0xe3b2('0x6a')](_0x5789b7,function(_0x47c9da){return _0x36d978[_0xe3b2('0x26')+_0x47c9da+'Queues']({'attributes':['id','name']})[_0xe3b2('0x25')](function(_0x41e464){return BPromise[_0xe3b2('0x6a')](_0x41e464,function(_0x196f53){return _0x196f53[_0xe3b2('0x65')](_0x4a5a89[_0xe3b2('0x55')][_0xe3b2('0x62')])['then'](function(){if(_0x47c9da===_0xe3b2('0x66')){return db[_0xe3b2('0x6b')]['findAll']({'where':{'id':_0x4a5a89[_0xe3b2('0x55')][_0xe3b2('0x62')]},'attributes':['id','name',_0xe3b2('0x6c'),_0xe3b2('0x6d'),'interface'],'raw':!![]})[_0xe3b2('0x25')](function(_0x46bf54){return BPromise[_0xe3b2('0x6a')](_[_0xe3b2('0x41')](_0x46bf54,{'online':0x1}),function(_0x5c2b74){return db[_0xe3b2('0x6e')][_0xe3b2('0x6f')]({'membername':_0x5c2b74[_0xe3b2('0x2b')],'UserId':_0x5c2b74['id'],'queue_name':_0x196f53[_0xe3b2('0x2b')],'VoiceQueueId':_0x196f53['id'],'interface':_[_0xe3b2('0x70')](_0x5c2b74[_0xe3b2('0x71')])?util[_0xe3b2('0x72')](_0xe3b2('0x73'),_0x5c2b74[_0xe3b2('0x2b')]):_0x5c2b74[_0xe3b2('0x71')],'paused':_0x5c2b74[_0xe3b2('0x6d')]||![],'penalty':0x0});});});}});});})[_0xe3b2('0x25')](function(){return _0x36d978;});})['then'](function(){return _0x36d978;});}})[_0xe3b2('0x25')](function(_0x1dbcbe){if(_0x1dbcbe){return _0x1dbcbe[_0xe3b2('0x65')](_0x4a5a89[_0xe3b2('0x55')]['ids'],_[_0xe3b2('0x74')](_0x4a5a89[_0xe3b2('0x55')],[_0xe3b2('0x62'),'id'])||{})[_0xe3b2('0x75')](function(_0x8a0c99){for(var _0x3d4818=0x0;_0x3d4818<_0x4a5a89[_0xe3b2('0x55')][_0xe3b2('0x62')][_0xe3b2('0x3b')];_0x3d4818+=0x1){socket[_0xe3b2('0x76')](_0xe3b2('0x77'),{'UserId':_0x4a5a89['body'][_0xe3b2('0x62')][_0x3d4818],'TeamId':_0x4a5a89[_0xe3b2('0x48')]['id']});}return _0x8a0c99;});}})[_0xe3b2('0x25')](respondWithResult(_0x1476f3,null))[_0xe3b2('0x4b')](handleError(_0x1476f3,null));};exports[_0xe3b2('0x78')]=function(_0x429726,_0x38f337,_0x235c51){return db[_0xe3b2('0x2f')]['find']({'where':{'id':_0x429726['params']['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x38f337,null))[_0xe3b2('0x25')](function(_0x1fb49f){if(_0x1fb49f){return BPromise[_0xe3b2('0x6a')](['voice','chat',_0xe3b2('0x79'),_0xe3b2('0x7a'),'fax','openchannel',_0xe3b2('0x7b')],function(_0x5d98d1){return _0x1fb49f['get'+_[_0xe3b2('0x5d')](_0x5d98d1)+_0xe3b2('0x5f')]({'attributes':['id',_0xe3b2('0x2b')]})[_0xe3b2('0x25')](function(_0x10463c){return BPromise[_0xe3b2('0x6a')](_0x10463c,function(_0x32c68c){return _0x32c68c[_0xe3b2('0x78')](_0x429726['query'][_0xe3b2('0x62')])['then'](function(){if(_0x5d98d1===_0xe3b2('0x7c')){return db['UserVoiceQueueRt'][_0xe3b2('0x7d')]({'where':{'VoiceQueueId':_0x32c68c['id'],'UserId':_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')]}});}});});})['then'](function(){return _0x1fb49f;});})['then'](function(){return _0x1fb49f;});}})['then'](function(_0x292e5f){if(_0x292e5f){return _0x292e5f[_0xe3b2('0x78')](_0x429726[_0xe3b2('0x35')]['ids'])['then'](function(){if(_[_0xe3b2('0x7e')](_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')])){for(var _0x480a9d=0x0;_0x480a9d<_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')][_0xe3b2('0x3b')];_0x480a9d+=0x1){socket[_0xe3b2('0x76')](_0xe3b2('0x7f'),{'UserId':Number(_0x429726[_0xe3b2('0x35')]['ids'][_0x480a9d]),'TeamId':Number(_0x429726[_0xe3b2('0x48')]['id'])});}}else{socket[_0xe3b2('0x76')]('userTeam:remove',{'UserId':Number(_0x429726[_0xe3b2('0x35')][_0xe3b2('0x62')]),'TeamId':Number(_0x429726[_0xe3b2('0x48')]['id'])});}});}})[_0xe3b2('0x25')](respondWithStatusCode(_0x38f337,null))['catch'](handleError(_0x38f337,null));};exports[_0xe3b2('0x80')]=function(_0xb21745,_0x1c5557,_0xee2c9b){var _0x445ce7={};var _0x4a32f5={};var _0x4965c9;var _0x1180ab;return db[_0xe3b2('0x2f')][_0xe3b2('0x57')]({'where':{'id':_0xb21745[_0xe3b2('0x48')]['id']}})[_0xe3b2('0x25')](handleEntityNotFound(_0x1c5557,null))[_0xe3b2('0x25')](function(_0x29a286){if(_0x29a286){_0x4965c9=_0x29a286;_0x4a32f5[_0xe3b2('0x34')]=_[_0xe3b2('0x36')](db[_0xe3b2('0x6b')][_0xe3b2('0x30')]);_0x4a32f5[_0xe3b2('0x35')]=_[_0xe3b2('0x36')](_0xb21745[_0xe3b2('0x35')]);_0x4a32f5[_0xe3b2('0x37')]=_['intersection'](_0x4a32f5['model'],_0x4a32f5[_0xe3b2('0x35')]);_0x445ce7['attributes']=_['intersection'](_0x4a32f5[_0xe3b2('0x34')],qs['fields'](_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x39')]));_0x445ce7[_0xe3b2('0x3a')]=_0x445ce7[_0xe3b2('0x3a')][_0xe3b2('0x3b')]?_0x445ce7[_0xe3b2('0x3a')]:_0x4a32f5['model'];_0x445ce7['order']=qs['sort'](_0xb21745['query'][_0xe3b2('0x3f')]);_0x445ce7[_0xe3b2('0x40')]=qs[_0xe3b2('0x37')](_[_0xe3b2('0x81')](_0xb21745['query'],_0x4a32f5[_0xe3b2('0x37')]));if(_0xb21745[_0xe3b2('0x35')]['filter']){_0x445ce7[_0xe3b2('0x40')]=_[_0xe3b2('0x42')](_0x445ce7[_0xe3b2('0x40')],{'$or':_[_0xe3b2('0x2e')](_0x445ce7[_0xe3b2('0x3a')],function(_0x2148f4){var _0x5cb599={};_0x5cb599[_0x2148f4]={'$like':'%'+_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x41')]+'%'};return _0x5cb599;})});}_0x445ce7=_[_0xe3b2('0x42')]({},_0x445ce7,_0xb21745['options']);return _0x4965c9[_0xe3b2('0x80')](_0x445ce7);}})[_0xe3b2('0x25')](function(_0x3cf02e){if(_0x3cf02e){_0x1180ab=_0x3cf02e[_0xe3b2('0x3b')];if(!_0xb21745['query'][_0xe3b2('0x3c')]('nolimit')){_0x445ce7[_0xe3b2('0x1f')]=qs['limit'](_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x1f')]);_0x445ce7[_0xe3b2('0x1e')]=qs[_0xe3b2('0x1e')](_0xb21745[_0xe3b2('0x35')][_0xe3b2('0x1e')]);}return _0x4965c9['getAgents'](_0x445ce7);}})[_0xe3b2('0x25')](function(_0x4540f5){if(_0x4540f5){return _0x4540f5?{'count':_0x1180ab,'rows':_0x4540f5}:null;}})[_0xe3b2('0x25')](respondWithResult(_0x1c5557,null))[_0xe3b2('0x4b')](handleError(_0x1c5557,null));}; \ No newline at end of file +var _0xabe8=['sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','User','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','map','Team','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Sequelize','Unknown\x20channel','add','ids','removeQueues','addAgents','Chat','Sms','Fax','Openchannel','Whatsapp','each','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','voice','mail'];(function(_0x4e4a09,_0xe4eac8){var _0x17a756=function(_0x23b5ef){while(--_0x23b5ef){_0x4e4a09['push'](_0x4e4a09['shift']());}};_0x17a756(++_0xe4eac8);}(_0xabe8,0x8c));var _0x8abe=function(_0xd7d2,_0x5ad1cd){_0xd7d2=_0xd7d2-0x0;var _0x58ef71=_0xabe8[_0xd7d2];return _0x58ef71;};'use strict';var pdf=require(_0x8abe('0x0'));var emlformat=require(_0x8abe('0x1'));var rimraf=require(_0x8abe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8abe('0x3'));var rp=require(_0x8abe('0x4'));var moment=require('moment');var BPromise=require(_0x8abe('0x5'));var Mustache=require('mustache');var util=require(_0x8abe('0x6'));var path=require(_0x8abe('0x7'));var sox=require(_0x8abe('0x8'));var csv=require(_0x8abe('0x9'));var ejs=require(_0x8abe('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8abe('0xb'));var jsforce=require(_0x8abe('0xc'));var deskjs=require(_0x8abe('0xd'));var toCsv=require(_0x8abe('0x9'));var querystring=require(_0x8abe('0xe'));var Papa=require(_0x8abe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8abe('0x10'));var hardwareService=require(_0x8abe('0x11'));var logger=require(_0x8abe('0x12'))(_0x8abe('0x13'));var utils=require(_0x8abe('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8abe('0x15')]=_[_0x8abe('0x16')](config[_0x8abe('0x15')],{'host':_0x8abe('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x8abe('0x18')](socket);function respondWithStatusCode(_0x5e7c8b,_0x1c407d){_0x1c407d=_0x1c407d||0xcc;return function(_0x5d25ab){if(_0x5d25ab){return _0x5e7c8b[_0x8abe('0x19')](_0x1c407d);}return _0x5e7c8b[_0x8abe('0x1a')](_0x1c407d)['end']();};}function respondWithResult(_0x1bcd6d,_0x5bc34a){_0x5bc34a=_0x5bc34a||0xc8;return function(_0x2ca971){if(_0x2ca971){return _0x1bcd6d[_0x8abe('0x1a')](_0x5bc34a)[_0x8abe('0x1b')](_0x2ca971);}};}function respondWithFilteredResult(_0x2609f4,_0x3f5d9b){return function(_0x1d8aec){if(_0x1d8aec){var _0x1cd7c9=_0x1d8aec[_0x8abe('0x1c')],_0x297c10=_0x3f5d9b['offset'],_0x45905e=_0x3f5d9b[_0x8abe('0x1d')]+_0x3f5d9b[_0x8abe('0x1e')],_0x344fd2;if(_0x45905e>=_0x1cd7c9){_0x45905e=_0x1cd7c9;_0x344fd2=0xc8;}else{_0x344fd2=0xce;}_0x2609f4[_0x8abe('0x1a')](_0x344fd2);return _0x2609f4[_0x8abe('0x1f')](_0x8abe('0x20'),_0x297c10+'-'+_0x45905e+'/'+_0x1cd7c9)['json'](_0x1d8aec);}return null;};}function patchUpdates(_0x4f6c1c){return function(_0x455677){try{jsonpatch[_0x8abe('0x21')](_0x455677,_0x4f6c1c,!![]);}catch(_0x2626e7){return BPromise[_0x8abe('0x22')](_0x2626e7);}return _0x455677[_0x8abe('0x23')]();};}function saveUpdates(_0x2f7e3c,_0x113ab2){return function(_0x4d5f2d){if(_0x4d5f2d){return _0x4d5f2d[_0x8abe('0x24')](_0x2f7e3c)[_0x8abe('0x25')](function(_0x383ca7){return _0x383ca7;});}return null;};}function removeEntity(_0x1873d5,_0x1f9bde){return function(_0x198aa9){if(_0x198aa9){return _0x198aa9[_0x8abe('0x26')]()[_0x8abe('0x25')](function(){var _0x8df196=_0x198aa9[_0x8abe('0x27')]({'plain':!![]});var _0x40f33a=_0x8abe('0x28');return db[_0x8abe('0x29')][_0x8abe('0x26')]({'where':{'type':_0x40f33a,'resourceId':_0x8df196['id']}})[_0x8abe('0x25')](function(){return _0x198aa9;});})[_0x8abe('0x25')](function(){_0x1873d5[_0x8abe('0x1a')](0xcc)[_0x8abe('0x2a')]();});}};}function handleEntityNotFound(_0x4be22d,_0x468cb0){return function(_0x43530f){if(!_0x43530f){_0x4be22d[_0x8abe('0x19')](0x194);}return _0x43530f;};}function handleError(_0x4bcbb6,_0xca4d){_0xca4d=_0xca4d||0x1f4;return function(_0x4a899c){logger[_0x8abe('0x2b')](_0x4a899c[_0x8abe('0x2c')]);if(_0x4a899c['name']){delete _0x4a899c[_0x8abe('0x2d')];}_0x4bcbb6['status'](_0xca4d)['send'](_0x4a899c);};}exports['index']=function(_0x51f8ac,_0x248abd){var _0x4bd195={},_0x7c04dc={},_0x16ba7e={'count':0x0,'rows':[]};var _0x24ce27=_[_0x8abe('0x2e')](db[_0x8abe('0x2f')][_0x8abe('0x30')],function(_0x101ae0){return{'name':_0x101ae0['fieldName'],'type':_0x101ae0[_0x8abe('0x31')][_0x8abe('0x32')]};});_0x7c04dc[_0x8abe('0x33')]=_[_0x8abe('0x2e')](_0x24ce27,_0x8abe('0x2d'));_0x7c04dc[_0x8abe('0x34')]=_['keys'](_0x51f8ac[_0x8abe('0x34')]);_0x7c04dc[_0x8abe('0x35')]=_[_0x8abe('0x36')](_0x7c04dc[_0x8abe('0x33')],_0x7c04dc[_0x8abe('0x34')]);_0x4bd195[_0x8abe('0x37')]=_[_0x8abe('0x36')](_0x7c04dc[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x51f8ac['query'][_0x8abe('0x38')]));_0x4bd195['attributes']=_0x4bd195[_0x8abe('0x37')][_0x8abe('0x39')]?_0x4bd195['attributes']:_0x7c04dc['model'];if(!_0x51f8ac[_0x8abe('0x34')]['hasOwnProperty'](_0x8abe('0x3a'))){_0x4bd195[_0x8abe('0x1e')]=qs[_0x8abe('0x1e')](_0x51f8ac[_0x8abe('0x34')][_0x8abe('0x1e')]);_0x4bd195['offset']=qs[_0x8abe('0x1d')](_0x51f8ac['query']['offset']);}_0x4bd195[_0x8abe('0x3b')]=qs[_0x8abe('0x3c')](_0x51f8ac[_0x8abe('0x34')][_0x8abe('0x3c')]);_0x4bd195['where']=qs[_0x8abe('0x35')](_[_0x8abe('0x3d')](_0x51f8ac['query'],_0x7c04dc[_0x8abe('0x35')]),_0x24ce27);if(_0x51f8ac[_0x8abe('0x34')]['filter']){_0x4bd195[_0x8abe('0x3e')]=_['merge'](_0x4bd195[_0x8abe('0x3e')],{'$or':_[_0x8abe('0x2e')](_0x24ce27,function(_0x2ff789){if(_0x2ff789[_0x8abe('0x31')]!==_0x8abe('0x3f')){var _0x38fb89={};_0x38fb89[_0x2ff789[_0x8abe('0x2d')]]={'$like':'%'+_0x51f8ac['query'][_0x8abe('0x40')]+'%'};return _0x38fb89;}})});}_0x4bd195=_[_0x8abe('0x41')]({},_0x4bd195,_0x51f8ac['options']);var _0x4378bd={'where':_0x4bd195['where']};return db[_0x8abe('0x2f')][_0x8abe('0x1c')](_0x4378bd)[_0x8abe('0x25')](function(_0x19c83b){_0x16ba7e[_0x8abe('0x1c')]=_0x19c83b;if(_0x51f8ac[_0x8abe('0x34')][_0x8abe('0x42')]){_0x4bd195[_0x8abe('0x43')]=[{'all':!![]}];}return db[_0x8abe('0x2f')]['findAll'](_0x4bd195);})[_0x8abe('0x25')](function(_0x1a8ea9){_0x16ba7e[_0x8abe('0x44')]=_0x1a8ea9;return _0x16ba7e;})[_0x8abe('0x25')](respondWithFilteredResult(_0x248abd,_0x4bd195))[_0x8abe('0x45')](handleError(_0x248abd,null));};exports[_0x8abe('0x46')]=function(_0x202a12,_0x469fe9){var _0x4005bf={'raw':![],'where':{'id':_0x202a12[_0x8abe('0x47')]['id']}},_0x51d7e7={};_0x51d7e7[_0x8abe('0x33')]=_[_0x8abe('0x48')](db['Team'][_0x8abe('0x30')]);_0x51d7e7['query']=_['keys'](_0x202a12[_0x8abe('0x34')]);_0x51d7e7['filters']=_['intersection'](_0x51d7e7['model'],_0x51d7e7['query']);_0x4005bf[_0x8abe('0x37')]=_['intersection'](_0x51d7e7[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x202a12[_0x8abe('0x34')]['fields']));_0x4005bf[_0x8abe('0x37')]=_0x4005bf[_0x8abe('0x37')]['length']?_0x4005bf[_0x8abe('0x37')]:_0x51d7e7['model'];if(_0x202a12[_0x8abe('0x34')]['includeAll']){_0x4005bf[_0x8abe('0x43')]=[{'all':!![]}];}_0x4005bf=_[_0x8abe('0x41')]({},_0x4005bf,_0x202a12[_0x8abe('0x49')]);return db[_0x8abe('0x2f')][_0x8abe('0x4a')](_0x4005bf)[_0x8abe('0x25')](handleEntityNotFound(_0x469fe9,null))['then'](respondWithResult(_0x469fe9,null))[_0x8abe('0x45')](handleError(_0x469fe9,null));};exports[_0x8abe('0x4b')]=function(_0x490069,_0x472128){return db['Team']['create'](_0x490069[_0x8abe('0x4c')],{})[_0x8abe('0x25')](function(_0x70cabc){var _0x5c3946=_0x490069['user'][_0x8abe('0x27')]({'plain':!![]});if(!_0x5c3946)throw new Error(_0x8abe('0x4d'));if(_0x5c3946[_0x8abe('0x4e')]===_0x8abe('0x4f')){var _0x3068b9=_0x70cabc[_0x8abe('0x27')]({'plain':!![]});var _0x35edd8=_0x8abe('0x28');return db[_0x8abe('0x50')][_0x8abe('0x4a')]({'where':{'name':_0x35edd8,'userProfileId':_0x5c3946[_0x8abe('0x51')]},'raw':!![]})['then'](function(_0x1d35d2){if(_0x1d35d2&&_0x1d35d2[_0x8abe('0x52')]===0x0){return db['UserProfileResource'][_0x8abe('0x4b')]({'name':_0x3068b9[_0x8abe('0x2d')],'resourceId':_0x3068b9['id'],'type':_0x1d35d2[_0x8abe('0x2d')],'sectionId':_0x1d35d2['id']},{})[_0x8abe('0x25')](function(){return _0x70cabc;});}else{return _0x70cabc;}})['catch'](function(_0x39f1c6){logger['error'](_0x8abe('0x53'),_0x39f1c6);throw _0x39f1c6;});}return _0x70cabc;})[_0x8abe('0x25')](respondWithResult(_0x472128,0xc9))[_0x8abe('0x45')](handleError(_0x472128,null));};exports[_0x8abe('0x24')]=function(_0x59e399,_0xefc047){if(_0x59e399[_0x8abe('0x4c')]['id']){delete _0x59e399[_0x8abe('0x4c')]['id'];}return db[_0x8abe('0x2f')][_0x8abe('0x4a')]({'where':{'id':_0x59e399[_0x8abe('0x47')]['id']}})[_0x8abe('0x25')](handleEntityNotFound(_0xefc047,null))[_0x8abe('0x25')](saveUpdates(_0x59e399[_0x8abe('0x4c')],null))[_0x8abe('0x25')](respondWithResult(_0xefc047,null))[_0x8abe('0x45')](handleError(_0xefc047,null));};exports[_0x8abe('0x26')]=function(_0x52ed62,_0x3bcabc){return db[_0x8abe('0x2f')][_0x8abe('0x4a')]({'where':{'id':_0x52ed62[_0x8abe('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bcabc,null))['then'](removeEntity(_0x3bcabc,null))[_0x8abe('0x45')](handleError(_0x3bcabc,null));};exports[_0x8abe('0x54')]=function(_0x566941,_0x5b18dd,_0x112e67){return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x566941['params']['id']}})[_0x8abe('0x25')](handleEntityNotFound(_0x5b18dd,null))[_0x8abe('0x25')](function(_0x3cd910){if(!_0x566941[_0x8abe('0x34')][_0x8abe('0x56')]||!utils[_0x8abe('0x57')](_0x566941['query']['channel'])){throw new db['Sequelize'][(_0x8abe('0x58'))]('Unknown\x20channel');}var _0x16b034={};var _0x4fa1fc={};_0x4fa1fc[_0x8abe('0x33')]=_[_0x8abe('0x48')](db[_[_0x8abe('0x59')](_0x566941['query'][_0x8abe('0x56')][_0x8abe('0x5a')]())+_0x8abe('0x5b')]['rawAttributes']);_0x4fa1fc['query']=_[_0x8abe('0x48')](_0x566941[_0x8abe('0x34')]);_0x4fa1fc[_0x8abe('0x35')]=_[_0x8abe('0x36')](_0x4fa1fc['model'],_0x4fa1fc[_0x8abe('0x34')]);_0x16b034[_0x8abe('0x37')]=_[_0x8abe('0x36')](_0x4fa1fc[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x566941[_0x8abe('0x34')][_0x8abe('0x38')]));_0x16b034[_0x8abe('0x37')]=_0x16b034[_0x8abe('0x37')][_0x8abe('0x39')]?_0x16b034[_0x8abe('0x37')]:_0x4fa1fc[_0x8abe('0x33')];_0x16b034[_0x8abe('0x1e')]=qs[_0x8abe('0x1e')](_0x566941[_0x8abe('0x34')][_0x8abe('0x1e')]);_0x16b034[_0x8abe('0x1d')]=qs[_0x8abe('0x1d')](_0x566941['query'][_0x8abe('0x1d')]);_0x16b034[_0x8abe('0x3b')]=qs[_0x8abe('0x3c')](_0x566941[_0x8abe('0x34')][_0x8abe('0x3c')]);_0x16b034['where']=qs[_0x8abe('0x35')](_[_0x8abe('0x3d')](_0x566941[_0x8abe('0x34')],_0x4fa1fc[_0x8abe('0x35')]));_0x16b034=_['merge']({},_0x16b034,_0x566941[_0x8abe('0x49')]);return _0x3cd910[_0x8abe('0x27')+_['capitalize'](_0x566941[_0x8abe('0x34')][_0x8abe('0x56')][_0x8abe('0x5a')]())+_0x8abe('0x5c')](_0x16b034);})[_0x8abe('0x25')](respondWithResult(_0x5b18dd,null))[_0x8abe('0x45')](handleError(_0x5b18dd,null));};exports[_0x8abe('0x5d')]=function(_0x189c19,_0x260c48,_0x59c2dc){return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x189c19[_0x8abe('0x47')]['id']}})[_0x8abe('0x25')](function(_0x307fe9){if(_0x307fe9){if(!_0x189c19[_0x8abe('0x4c')]['channel']||!utils['isValidChannel'](_0x189c19[_0x8abe('0x4c')][_0x8abe('0x56')])){throw new db[(_0x8abe('0x5e'))][(_0x8abe('0x58'))](_0x8abe('0x5f'));}return _0x307fe9[_0x8abe('0x60')+_[_0x8abe('0x59')](_0x189c19[_0x8abe('0x4c')]['channel'][_0x8abe('0x5a')]())+_0x8abe('0x5c')](_0x189c19['body'][_0x8abe('0x61')]);}return null;})[_0x8abe('0x25')](handleEntityNotFound(_0x260c48,null))['then'](respondWithStatusCode(_0x260c48,null))[_0x8abe('0x45')](handleError(_0x260c48,null));};exports[_0x8abe('0x62')]=function(_0x4d4945,_0x47ecaf,_0x50c3b5){return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x4d4945['params']['id']}})['then'](function(_0x518918){if(_0x518918){if(!_0x4d4945[_0x8abe('0x34')]['channel']||!utils['isValidChannel'](_0x4d4945[_0x8abe('0x34')][_0x8abe('0x56')])){throw new db[(_0x8abe('0x5e'))][(_0x8abe('0x58'))](_0x8abe('0x5f'));}return _0x518918['remove'+_[_0x8abe('0x59')](_0x4d4945[_0x8abe('0x34')][_0x8abe('0x56')][_0x8abe('0x5a')]())+_0x8abe('0x5c')](_0x4d4945[_0x8abe('0x34')][_0x8abe('0x61')]);}return null;})[_0x8abe('0x25')](handleEntityNotFound(_0x47ecaf,null))[_0x8abe('0x25')](respondWithStatusCode(_0x47ecaf,null))[_0x8abe('0x45')](handleError(_0x47ecaf,null));};exports[_0x8abe('0x63')]=function(_0x19a07e,_0x75436f,_0x4859a0){return db['Team'][_0x8abe('0x4a')]({'where':{'id':_0x19a07e[_0x8abe('0x47')]['id']}})['then'](handleEntityNotFound(_0x75436f,null))[_0x8abe('0x25')](function(_0x4241f8){if(_0x4241f8){var _0x14d6c9=['Voice',_0x8abe('0x64'),'Mail',_0x8abe('0x65'),_0x8abe('0x66'),_0x8abe('0x67'),_0x8abe('0x68')];return BPromise[_0x8abe('0x69')](_0x14d6c9,function(_0x65a15f){return _0x4241f8[_0x8abe('0x27')+_0x65a15f+'Queues']({'attributes':['id','name']})['then'](function(_0x23f991){return BPromise[_0x8abe('0x69')](_0x23f991,function(_0x2a5289){return _0x2a5289[_0x8abe('0x63')](_0x19a07e[_0x8abe('0x4c')][_0x8abe('0x61')])[_0x8abe('0x25')](function(){if(_0x65a15f==='Voice'){return db['User'][_0x8abe('0x6a')]({'where':{'id':_0x19a07e[_0x8abe('0x4c')]['ids']},'attributes':['id',_0x8abe('0x2d'),_0x8abe('0x6b'),_0x8abe('0x6c'),_0x8abe('0x6d')],'raw':!![]})[_0x8abe('0x25')](function(_0x353aa3){return BPromise[_0x8abe('0x69')](_[_0x8abe('0x40')](_0x353aa3,{'online':0x1}),function(_0x569843){return db['UserVoiceQueueRt'][_0x8abe('0x6e')]({'membername':_0x569843[_0x8abe('0x2d')],'UserId':_0x569843['id'],'queue_name':_0x2a5289['name'],'VoiceQueueId':_0x2a5289['id'],'interface':_[_0x8abe('0x6f')](_0x569843['interface'])?util[_0x8abe('0x70')](_0x8abe('0x71'),_0x569843[_0x8abe('0x2d')]):_0x569843[_0x8abe('0x6d')],'paused':_0x569843[_0x8abe('0x6c')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x4241f8;});})['then'](function(){return _0x4241f8;});}})['then'](function(_0x5d1078){if(_0x5d1078){return _0x5d1078[_0x8abe('0x63')](_0x19a07e['body'][_0x8abe('0x61')],_[_0x8abe('0x72')](_0x19a07e[_0x8abe('0x4c')],[_0x8abe('0x61'),'id'])||{})[_0x8abe('0x73')](function(_0x33cf92){for(var _0x18a6ac=0x0;_0x18a6ac<_0x19a07e[_0x8abe('0x4c')]['ids'][_0x8abe('0x39')];_0x18a6ac+=0x1){socket[_0x8abe('0x74')](_0x8abe('0x75'),{'UserId':_0x19a07e['body'][_0x8abe('0x61')][_0x18a6ac],'TeamId':_0x19a07e[_0x8abe('0x47')]['id']});}return _0x33cf92;});}})['then'](respondWithResult(_0x75436f,null))[_0x8abe('0x45')](handleError(_0x75436f,null));};exports['removeAgents']=function(_0x19bdf4,_0x12a968,_0x4499fa){return db[_0x8abe('0x2f')][_0x8abe('0x4a')]({'where':{'id':_0x19bdf4[_0x8abe('0x47')]['id']}})['then'](handleEntityNotFound(_0x12a968,null))['then'](function(_0x44097c){if(_0x44097c){return BPromise[_0x8abe('0x69')]([_0x8abe('0x76'),'chat',_0x8abe('0x77'),_0x8abe('0x78'),_0x8abe('0x79'),_0x8abe('0x7a'),_0x8abe('0x7b')],function(_0xdf05d3){return _0x44097c[_0x8abe('0x27')+_['capitalize'](_0xdf05d3)+_0x8abe('0x5c')]({'attributes':['id',_0x8abe('0x2d')]})[_0x8abe('0x25')](function(_0x8bad71){return BPromise['each'](_0x8bad71,function(_0x6600b0){return _0x6600b0[_0x8abe('0x7c')](_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')])['then'](function(){if(_0xdf05d3===_0x8abe('0x76')){return db['UserVoiceQueueRt'][_0x8abe('0x26')]({'where':{'VoiceQueueId':_0x6600b0['id'],'UserId':_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')]}});}});});})['then'](function(){return _0x44097c;});})[_0x8abe('0x25')](function(){return _0x44097c;});}})[_0x8abe('0x25')](function(_0x5e8948){if(_0x5e8948){return _0x5e8948['removeAgents'](_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')])[_0x8abe('0x25')](function(){if(_[_0x8abe('0x7d')](_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')])){for(var _0x308515=0x0;_0x308515<_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')][_0x8abe('0x39')];_0x308515+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x19bdf4['query']['ids'][_0x308515]),'TeamId':Number(_0x19bdf4[_0x8abe('0x47')]['id'])});}}else{socket[_0x8abe('0x74')](_0x8abe('0x7e'),{'UserId':Number(_0x19bdf4[_0x8abe('0x34')][_0x8abe('0x61')]),'TeamId':Number(_0x19bdf4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x12a968,null))[_0x8abe('0x45')](handleError(_0x12a968,null));};exports['getAgents']=function(_0x36ceea,_0x332486,_0x18fae5){var _0x45deb9={};var _0xc8d1c7={};var _0x7a19a9;var _0x16a150;return db[_0x8abe('0x2f')][_0x8abe('0x55')]({'where':{'id':_0x36ceea[_0x8abe('0x47')]['id']}})[_0x8abe('0x25')](handleEntityNotFound(_0x332486,null))['then'](function(_0x58223d){if(_0x58223d){_0x7a19a9=_0x58223d;_0xc8d1c7['model']=_[_0x8abe('0x48')](db[_0x8abe('0x7f')]['rawAttributes']);_0xc8d1c7['query']=_[_0x8abe('0x48')](_0x36ceea[_0x8abe('0x34')]);_0xc8d1c7['filters']=_['intersection'](_0xc8d1c7['model'],_0xc8d1c7['query']);_0x45deb9[_0x8abe('0x37')]=_['intersection'](_0xc8d1c7[_0x8abe('0x33')],qs[_0x8abe('0x38')](_0x36ceea['query'][_0x8abe('0x38')]));_0x45deb9['attributes']=_0x45deb9[_0x8abe('0x37')][_0x8abe('0x39')]?_0x45deb9[_0x8abe('0x37')]:_0xc8d1c7[_0x8abe('0x33')];_0x45deb9[_0x8abe('0x3b')]=qs[_0x8abe('0x3c')](_0x36ceea[_0x8abe('0x34')][_0x8abe('0x3c')]);_0x45deb9[_0x8abe('0x3e')]=qs[_0x8abe('0x35')](_[_0x8abe('0x3d')](_0x36ceea[_0x8abe('0x34')],_0xc8d1c7[_0x8abe('0x35')]));if(_0x36ceea[_0x8abe('0x34')]['filter']){_0x45deb9[_0x8abe('0x3e')]=_[_0x8abe('0x41')](_0x45deb9[_0x8abe('0x3e')],{'$or':_['map'](_0x45deb9['attributes'],function(_0x48b6c0){var _0x3117d4={};_0x3117d4[_0x48b6c0]={'$like':'%'+_0x36ceea[_0x8abe('0x34')][_0x8abe('0x40')]+'%'};return _0x3117d4;})});}_0x45deb9=_[_0x8abe('0x41')]({},_0x45deb9,_0x36ceea[_0x8abe('0x49')]);return _0x7a19a9[_0x8abe('0x80')](_0x45deb9);}})['then'](function(_0x14bbdf){if(_0x14bbdf){_0x16a150=_0x14bbdf[_0x8abe('0x39')];if(!_0x36ceea[_0x8abe('0x34')][_0x8abe('0x81')](_0x8abe('0x3a'))){_0x45deb9[_0x8abe('0x1e')]=qs[_0x8abe('0x1e')](_0x36ceea[_0x8abe('0x34')]['limit']);_0x45deb9[_0x8abe('0x1d')]=qs['offset'](_0x36ceea[_0x8abe('0x34')][_0x8abe('0x1d')]);}return _0x7a19a9[_0x8abe('0x80')](_0x45deb9);}})[_0x8abe('0x25')](function(_0x2948f9){if(_0x2948f9){return _0x2948f9?{'count':_0x16a150,'rows':_0x2948f9}:null;}})[_0x8abe('0x25')](respondWithResult(_0x332486,null))[_0x8abe('0x45')](handleError(_0x332486,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d1d4f4a..6bf323f 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 _0x0d88=['events','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2cb4b6,_0xbe1953){var _0x32449e=function(_0x4ce91a){while(--_0x4ce91a){_0x2cb4b6['push'](_0x2cb4b6['shift']());}};_0x32449e(++_0xbe1953);}(_0x0d88,0x6e));var _0x80d8=function(_0x3f542b,_0x587747){_0x3f542b=_0x3f542b-0x0;var _0x16f633=_0x0d88[_0x3f542b];return _0x16f633;};'use strict';var EventEmitter=require(_0x80d8('0x0'));var Team=require(_0x80d8('0x1'))['db'][_0x80d8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x80d8('0x3')](0x0);var events={'afterCreate':_0x80d8('0x4'),'afterUpdate':'update','afterDestroy':_0x80d8('0x5')};function emitEvent(_0x4c8836){return function(_0x17dbab,_0x4354ca,_0x5a872c){TeamEvents[_0x80d8('0x6')](_0x4c8836+':'+_0x17dbab['id'],_0x17dbab);TeamEvents[_0x80d8('0x6')](_0x4c8836,_0x17dbab);_0x5a872c(null);};}for(var e in events){if(events[_0x80d8('0x7')](e)){var event=events[e];Team[_0x80d8('0x8')](e,emitEvent(event));}}module[_0x80d8('0x9')]=TeamEvents; \ No newline at end of file +var _0x24dd=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x2f003f,_0x45d36f){var _0x38442a=function(_0x3f1ca0){while(--_0x3f1ca0){_0x2f003f['push'](_0x2f003f['shift']());}};_0x38442a(++_0x45d36f);}(_0x24dd,0x97));var _0xd24d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x24dd[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0xd24d('0x0'));var Team=require(_0xd24d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xd24d('0x2')](0x0);var events={'afterCreate':_0xd24d('0x3'),'afterUpdate':'update','afterDestroy':_0xd24d('0x4')};function emitEvent(_0x18d6f4){return function(_0x10a60b,_0x10bc7d,_0x372495){TeamEvents[_0xd24d('0x5')](_0x18d6f4+':'+_0x10a60b['id'],_0x10a60b);TeamEvents[_0xd24d('0x5')](_0x18d6f4,_0x10a60b);_0x372495(null);};}for(var e in events){if(events[_0xd24d('0x6')](e)){var event=events[e];Team[_0xd24d('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2878a63..2deaac1 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 _0x04a8=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./team.attributes','define','lodash'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x04a8,0x149));var _0x804a=function(_0x485ff3,_0x3efe5c){_0x485ff3=_0x485ff3-0x0;var _0x656dbc=_0x04a8[_0x485ff3];return _0x656dbc;};'use strict';var _=require(_0x804a('0x0'));var util=require(_0x804a('0x1'));var logger=require(_0x804a('0x2'))(_0x804a('0x3'));var moment=require(_0x804a('0x4'));var BPromise=require(_0x804a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x804a('0x6'));var rimraf=require('rimraf');var config=require(_0x804a('0x7'));var attributes=require(_0x804a('0x8'));module['exports']=function(_0x452bc7,_0x423867){return _0x452bc7[_0x804a('0x9')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a7=['Team','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define'];(function(_0x513c93,_0x189225){var _0x1699cc=function(_0x33a425){while(--_0x33a425){_0x513c93['push'](_0x513c93['shift']());}};_0x1699cc(++_0x189225);}(_0x14a7,0x16d));var _0x714a=function(_0x5c4ba6,_0x11a3ff){_0x5c4ba6=_0x5c4ba6-0x0;var _0x5e1715=_0x14a7[_0x5c4ba6];return _0x5e1715;};'use strict';var _=require(_0x714a('0x0'));var util=require('util');var logger=require(_0x714a('0x1'))(_0x714a('0x2'));var moment=require(_0x714a('0x3'));var BPromise=require(_0x714a('0x4'));var rp=require(_0x714a('0x5'));var fs=require('fs');var path=require(_0x714a('0x6'));var rimraf=require(_0x714a('0x7'));var config=require(_0x714a('0x8'));var attributes=require(_0x714a('0x9'));module[_0x714a('0xa')]=function(_0x5d6733,_0xab7b57){return _0x5d6733[_0x714a('0xb')](_0x714a('0xc'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index bf8deca..a606105 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 _0x75fa=['redis','localhost','socket.io-emitter','register','then','Team,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x239b5a,_0x56199a){var _0x5a701c=function(_0x3cdf2d){while(--_0x3cdf2d){_0x239b5a['push'](_0x239b5a['shift']());}};_0x5a701c(++_0x56199a);}(_0x75fa,0xce));var _0xa75f=function(_0x32d0dc,_0x465d23){_0x32d0dc=_0x32d0dc-0x0;var _0x40cc25=_0x75fa[_0x32d0dc];return _0x40cc25;};'use strict';var _=require(_0xa75f('0x0'));var util=require(_0xa75f('0x1'));var moment=require(_0xa75f('0x2'));var BPromise=require(_0xa75f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa75f('0x4'))['db'];var utils=require(_0xa75f('0x5'));var logger=require(_0xa75f('0x6'))(_0xa75f('0x7'));var config=require(_0xa75f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa75f('0x9')]['http']({'port':0x232a});config[_0xa75f('0xa')]=_['defaults'](config['redis'],{'host':_0xa75f('0xb'),'port':0x18eb});var socket=require(_0xa75f('0xc'))(new Redis(config[_0xa75f('0xa')]));require('./team.socket')[_0xa75f('0xd')](socket);function respondWithRpcPromise(_0x57e909,_0xa0089e,_0x4d27a9){return new BPromise(function(_0x15e044,_0x1b2a0c){return client['request'](_0x57e909,_0x4d27a9)[_0xa75f('0xe')](function(_0x1acbfa){logger['info'](_0xa75f('0xf'),_0xa0089e,'request\x20sent');logger[_0xa75f('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0xa0089e,_0xa75f('0x11'),JSON['stringify'](_0x1acbfa));if(_0x1acbfa[_0xa75f('0x12')]){if(_0x1acbfa[_0xa75f('0x12')][_0xa75f('0x13')]===0x1f4){logger['error'](_0xa75f('0xf'),_0xa0089e,_0x1acbfa[_0xa75f('0x12')]['message']);return _0x1b2a0c(_0x1acbfa[_0xa75f('0x12')][_0xa75f('0x14')]);}logger[_0xa75f('0x12')]('Team,\x20%s,\x20%s',_0xa0089e,_0x1acbfa[_0xa75f('0x12')][_0xa75f('0x14')]);return _0x15e044(_0x1acbfa['error']['message']);}else{logger[_0xa75f('0x15')](_0xa75f('0xf'),_0xa0089e,_0xa75f('0x11'));_0x15e044(_0x1acbfa[_0xa75f('0x16')][_0xa75f('0x14')]);}})[_0xa75f('0x17')](function(_0x1baff0){logger[_0xa75f('0x12')](_0xa75f('0xf'),_0xa0089e,_0x1baff0);_0x1b2a0c(_0x1baff0);});});} \ No newline at end of file +var _0x6c05=['info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','register','then'];(function(_0x408e5f,_0x57d4b4){var _0x4405e6=function(_0x450962){while(--_0x450962){_0x408e5f['push'](_0x408e5f['shift']());}};_0x4405e6(++_0x57d4b4);}(_0x6c05,0x18e));var _0x56c0=function(_0xe19dcf,_0x248748){_0xe19dcf=_0xe19dcf-0x0;var _0x686aa8=_0x6c05[_0xe19dcf];return _0x686aa8;};'use strict';var _=require(_0x56c0('0x0'));var util=require(_0x56c0('0x1'));var moment=require(_0x56c0('0x2'));var BPromise=require(_0x56c0('0x3'));var rs=require(_0x56c0('0x4'));var fs=require('fs');var Redis=require(_0x56c0('0x5'));var db=require(_0x56c0('0x6'))['db'];var utils=require(_0x56c0('0x7'));var logger=require(_0x56c0('0x8'))('rpc');var config=require(_0x56c0('0x9'));var jayson=require(_0x56c0('0xa'));var client=jayson[_0x56c0('0xb')]['http']({'port':0x232a});config[_0x56c0('0xc')]=_[_0x56c0('0xd')](config[_0x56c0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x56c0('0xe'))(new Redis(config[_0x56c0('0xc')]));require(_0x56c0('0xf'))[_0x56c0('0x10')](socket);function respondWithRpcPromise(_0x4592ae,_0xb35602,_0x46d3c1){return new BPromise(function(_0x1efd41,_0x5800e6){return client['request'](_0x4592ae,_0x46d3c1)[_0x56c0('0x11')](function(_0x3ff4d4){logger[_0x56c0('0x12')](_0x56c0('0x13'),_0xb35602,_0x56c0('0x14'));logger['debug'](_0x56c0('0x15'),_0xb35602,'request\x20sent',JSON['stringify'](_0x3ff4d4));if(_0x3ff4d4[_0x56c0('0x16')]){if(_0x3ff4d4['error'][_0x56c0('0x17')]===0x1f4){logger[_0x56c0('0x16')](_0x56c0('0x13'),_0xb35602,_0x3ff4d4[_0x56c0('0x16')][_0x56c0('0x18')]);return _0x5800e6(_0x3ff4d4['error']['message']);}logger[_0x56c0('0x16')](_0x56c0('0x13'),_0xb35602,_0x3ff4d4[_0x56c0('0x16')][_0x56c0('0x18')]);return _0x1efd41(_0x3ff4d4[_0x56c0('0x16')][_0x56c0('0x18')]);}else{logger[_0x56c0('0x12')](_0x56c0('0x13'),_0xb35602,_0x56c0('0x14'));_0x1efd41(_0x3ff4d4[_0x56c0('0x19')][_0x56c0('0x18')]);}})['catch'](function(_0x38724b){logger['error'](_0x56c0('0x13'),_0xb35602,_0x38724b);_0x5800e6(_0x38724b);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3691c2b..bfeeef4 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 _0x9ade=['remove','update','emit','register','length','team:','./team.events','save'];(function(_0x7eb6cf,_0x2b3bf0){var _0x42022f=function(_0x74c915){while(--_0x74c915){_0x7eb6cf['push'](_0x7eb6cf['shift']());}};_0x42022f(++_0x2b3bf0);}(_0x9ade,0x8e));var _0xe9ad=function(_0x24bf11,_0x320ad8){_0x24bf11=_0x24bf11-0x0;var _0x20f05b=_0x9ade[_0x24bf11];return _0x20f05b;};'use strict';var TeamEvents=require(_0xe9ad('0x0'));var events=[_0xe9ad('0x1'),_0xe9ad('0x2'),_0xe9ad('0x3')];function createListener(_0x3ad948,_0x163f67){return function(_0x38fa6c){_0x163f67[_0xe9ad('0x4')](_0x3ad948,_0x38fa6c);};}function removeListener(_0x468a5b,_0x441278){return function(){TeamEvents['removeListener'](_0x468a5b,_0x441278);};}exports[_0xe9ad('0x5')]=function(_0x53b3f7){for(var _0x5cf047=0x0,_0x382206=events[_0xe9ad('0x6')];_0x5cf047<_0x382206;_0x5cf047++){var _0x394441=events[_0x5cf047];var _0xe8984c=createListener(_0xe9ad('0x7')+_0x394441,_0x53b3f7);TeamEvents['on'](_0x394441,_0xe8984c);}}; \ No newline at end of file +var _0x1115=['save','remove','update','emit','length','team:'];(function(_0x4cd4f5,_0x1b6ea6){var _0x37423d=function(_0x31a954){while(--_0x31a954){_0x4cd4f5['push'](_0x4cd4f5['shift']());}};_0x37423d(++_0x1b6ea6);}(_0x1115,0x1b6));var _0x5111=function(_0xed17a5,_0xfe43f6){_0xed17a5=_0xed17a5-0x0;var _0x45671e=_0x1115[_0xed17a5];return _0x45671e;};'use strict';var TeamEvents=require('./team.events');var events=[_0x5111('0x0'),_0x5111('0x1'),_0x5111('0x2')];function createListener(_0x20e2ee,_0x39a422){return function(_0x118ead){_0x39a422[_0x5111('0x3')](_0x20e2ee,_0x118ead);};}function removeListener(_0x2cd14a,_0xe7b51f){return function(){TeamEvents['removeListener'](_0x2cd14a,_0xe7b51f);};}exports['register']=function(_0x467c3a){for(var _0x115ba7=0x0,_0x50f0a3=events[_0x5111('0x4')];_0x115ba7<_0x50f0a3;_0x115ba7++){var _0x2d2777=events[_0x115ba7];var _0x54d5ae=createListener(_0x5111('0x5')+_0x2d2777,_0x467c3a);TeamEvents['on'](_0x2d2777,_0x54d5ae);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e8d0083..04e75ad 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 _0xa059=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xa059,0xed));var _0x9a05=function(_0x9d3607,_0x112fdf){_0x9d3607=_0x9d3607-0x0;var _0x1b835a=_0xa059[_0x9d3607];return _0x1b835a;};'use strict';var multer=require(_0x9a05('0x0'));var util=require(_0x9a05('0x1'));var path=require(_0x9a05('0x2'));var timeout=require(_0x9a05('0x3'));var express=require(_0x9a05('0x4'));var router=express[_0x9a05('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a05('0x6'));var config=require(_0x9a05('0x7'));var controller=require('./template.controller');router[_0x9a05('0x8')]('/',auth[_0x9a05('0x9')](),controller['index']);router[_0x9a05('0x8')](_0x9a05('0xa'),auth[_0x9a05('0x9')](),controller['show']);router['post']('/',auth[_0x9a05('0x9')](),controller[_0x9a05('0xb')]);router[_0x9a05('0xc')](_0x9a05('0xa'),auth['isAuthenticated'](),controller[_0x9a05('0xd')]);router[_0x9a05('0xe')](_0x9a05('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a05('0xf')]=router; \ No newline at end of file +var _0x5a2f=['post','create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a2f,0xaa));var _0xf5a2=function(_0x160dc2,_0x7cc777){_0x160dc2=_0x160dc2-0x0;var _0x457e76=_0x5a2f[_0x160dc2];return _0x457e76;};'use strict';var multer=require('multer');var util=require(_0xf5a2('0x0'));var path=require('path');var timeout=require(_0xf5a2('0x1'));var express=require(_0xf5a2('0x2'));var router=express[_0xf5a2('0x3')]();var auth=require(_0xf5a2('0x4'));var interaction=require(_0xf5a2('0x5'));var config=require('../../config/environment');var controller=require(_0xf5a2('0x6'));router[_0xf5a2('0x7')]('/',auth[_0xf5a2('0x8')](),controller[_0xf5a2('0x9')]);router[_0xf5a2('0x7')]('/:id',auth[_0xf5a2('0x8')](),controller['show']);router[_0xf5a2('0xa')]('/',auth['isAuthenticated'](),controller[_0xf5a2('0xb')]);router[_0xf5a2('0xc')]('/:id',auth[_0xf5a2('0x8')](),controller[_0xf5a2('0xd')]);router[_0xf5a2('0xe')](_0xf5a2('0xf'),auth['isAuthenticated'](),controller[_0xf5a2('0x10')]);module[_0xf5a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index acdb62d..ee2effd 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 _0x1ba8=['exports','STRING','TEXT','sequelize'];(function(_0x5c7b76,_0x12382c){var _0x2f6579=function(_0x24772d){while(--_0x24772d){_0x5c7b76['push'](_0x5c7b76['shift']());}};_0x2f6579(++_0x12382c);}(_0x1ba8,0x117));var _0x81ba=function(_0x35a4fc,_0x23f198){_0x35a4fc=_0x35a4fc-0x0;var _0x54e81d=_0x1ba8[_0x35a4fc];return _0x54e81d;};'use strict';var Sequelize=require(_0x81ba('0x0'));module[_0x81ba('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x81ba('0x2')]},'html':{'type':Sequelize[_0x81ba('0x3')]}}; \ No newline at end of file +var _0x7700=['STRING','sequelize','exports'];(function(_0x70e40,_0x95c147){var _0x1e9b98=function(_0xd23be6){while(--_0xd23be6){_0x70e40['push'](_0x70e40['shift']());}};_0x1e9b98(++_0x95c147);}(_0x7700,0x151));var _0x0770=function(_0x2b29ab,_0x201845){_0x2b29ab=_0x2b29ab-0x0;var _0x16e64b=_0x7700[_0x2b29ab];return _0x16e64b;};'use strict';var Sequelize=require(_0x0770('0x0'));module[_0x0770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0770('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ec0ce31..de22315 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 _0x60c4=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','pick','VIRTUAL','filter','merge','include','rows','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','Templates','UserProfileResource','destroy','error','stack','name','Template','type','key'];(function(_0x42f840,_0x1aa32e){var _0x47539f=function(_0x390a4b){while(--_0x390a4b){_0x42f840['push'](_0x42f840['shift']());}};_0x47539f(++_0x1aa32e);}(_0x60c4,0x1a7));var _0x460c=function(_0x2695d9,_0x3a4e30){_0x2695d9=_0x2695d9-0x0;var _0x30a79c=_0x60c4[_0x2695d9];return _0x30a79c;};'use strict';var pdf=require(_0x460c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x460c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x460c('0x2'));var rp=require(_0x460c('0x3'));var moment=require(_0x460c('0x4'));var BPromise=require(_0x460c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x460c('0x6'));var sox=require(_0x460c('0x7'));var csv=require(_0x460c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x460c('0x9'));var squel=require(_0x460c('0xa'));var crypto=require(_0x460c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x460c('0xc'));var toCsv=require(_0x460c('0x8'));var querystring=require('querystring');var Papa=require(_0x460c('0xd'));var Redis=require(_0x460c('0xe'));var authService=require(_0x460c('0xf'));var qs=require(_0x460c('0x10'));var as=require(_0x460c('0x11'));var hardwareService=require(_0x460c('0x12'));var logger=require(_0x460c('0x13'))('api');var utils=require(_0x460c('0x14'));var config=require(_0x460c('0x15'));var db=require(_0x460c('0x16'))['db'];function respondWithStatusCode(_0x77571a,_0x17075c){_0x17075c=_0x17075c||0xcc;return function(_0x289fe0){if(_0x289fe0){return _0x77571a[_0x460c('0x17')](_0x17075c);}return _0x77571a[_0x460c('0x18')](_0x17075c)[_0x460c('0x19')]();};}function respondWithResult(_0x53a83c,_0x2d73bd){_0x2d73bd=_0x2d73bd||0xc8;return function(_0x23cbd1){if(_0x23cbd1){return _0x53a83c[_0x460c('0x18')](_0x2d73bd)[_0x460c('0x1a')](_0x23cbd1);}};}function respondWithFilteredResult(_0x301d49,_0x19ea11){return function(_0x9ec526){if(_0x9ec526){var _0x26ba11=_0x9ec526[_0x460c('0x1b')],_0x3a87a4=_0x19ea11[_0x460c('0x1c')],_0x81e2b8=_0x19ea11[_0x460c('0x1c')]+_0x19ea11['limit'],_0x19f3c7;if(_0x81e2b8>=_0x26ba11){_0x81e2b8=_0x26ba11;_0x19f3c7=0xc8;}else{_0x19f3c7=0xce;}_0x301d49[_0x460c('0x18')](_0x19f3c7);return _0x301d49[_0x460c('0x1d')](_0x460c('0x1e'),_0x3a87a4+'-'+_0x81e2b8+'/'+_0x26ba11)[_0x460c('0x1a')](_0x9ec526);}return null;};}function patchUpdates(_0x30c9d5){return function(_0x36192c){try{jsonpatch[_0x460c('0x1f')](_0x36192c,_0x30c9d5,!![]);}catch(_0xe6f87f){return BPromise[_0x460c('0x20')](_0xe6f87f);}return _0x36192c[_0x460c('0x21')]();};}function saveUpdates(_0x143bcc,_0x54a725){return function(_0x525370){if(_0x525370){return _0x525370[_0x460c('0x22')](_0x143bcc)[_0x460c('0x23')](function(_0xd3ac9f){return _0xd3ac9f;});}return null;};}function removeEntity(_0x52c8b1,_0x5551cd){return function(_0x135006){if(_0x135006){return _0x135006['destroy']()[_0x460c('0x23')](function(){var _0x41db8d=_0x135006['get']({'plain':!![]});var _0xfb6efb=_0x460c('0x24');return db[_0x460c('0x25')][_0x460c('0x26')]({'where':{'type':_0xfb6efb,'resourceId':_0x41db8d['id']}})['then'](function(){return _0x135006;});})['then'](function(){_0x52c8b1[_0x460c('0x18')](0xcc)[_0x460c('0x19')]();});}};}function handleEntityNotFound(_0x238347,_0x411193){return function(_0x49821c){if(!_0x49821c){_0x238347['sendStatus'](0x194);}return _0x49821c;};}function handleError(_0x255620,_0x1f08c6){_0x1f08c6=_0x1f08c6||0x1f4;return function(_0x452592){logger[_0x460c('0x27')](_0x452592[_0x460c('0x28')]);if(_0x452592[_0x460c('0x29')]){delete _0x452592[_0x460c('0x29')];}_0x255620[_0x460c('0x18')](_0x1f08c6)['send'](_0x452592);};}exports['index']=function(_0x5305ca,_0x13e21f){var _0x2984db={},_0x36b6aa={},_0x15a5a2={'count':0x0,'rows':[]};var _0x2f03b5=_['map'](db[_0x460c('0x2a')]['rawAttributes'],function(_0x2eaaec){return{'name':_0x2eaaec['fieldName'],'type':_0x2eaaec[_0x460c('0x2b')][_0x460c('0x2c')]};});_0x36b6aa[_0x460c('0x2d')]=_['map'](_0x2f03b5,_0x460c('0x29'));_0x36b6aa[_0x460c('0x2e')]=_[_0x460c('0x2f')](_0x5305ca[_0x460c('0x2e')]);_0x36b6aa['filters']=_[_0x460c('0x30')](_0x36b6aa['model'],_0x36b6aa[_0x460c('0x2e')]);_0x2984db['attributes']=_[_0x460c('0x30')](_0x36b6aa[_0x460c('0x2d')],qs[_0x460c('0x31')](_0x5305ca[_0x460c('0x2e')]['fields']));_0x2984db[_0x460c('0x32')]=_0x2984db['attributes'][_0x460c('0x33')]?_0x2984db['attributes']:_0x36b6aa['model'];if(!_0x5305ca[_0x460c('0x2e')][_0x460c('0x34')]('nolimit')){_0x2984db[_0x460c('0x35')]=qs[_0x460c('0x35')](_0x5305ca['query'][_0x460c('0x35')]);_0x2984db[_0x460c('0x1c')]=qs[_0x460c('0x1c')](_0x5305ca['query']['offset']);}_0x2984db['order']=qs[_0x460c('0x36')](_0x5305ca[_0x460c('0x2e')][_0x460c('0x36')]);_0x2984db[_0x460c('0x37')]=qs[_0x460c('0x38')](_[_0x460c('0x39')](_0x5305ca[_0x460c('0x2e')],_0x36b6aa[_0x460c('0x38')]),_0x2f03b5);if(_0x5305ca[_0x460c('0x2e')]['filter']){_0x2984db[_0x460c('0x37')]=_['merge'](_0x2984db[_0x460c('0x37')],{'$or':_['map'](_0x2f03b5,function(_0x3f31dc){if(_0x3f31dc[_0x460c('0x2b')]!==_0x460c('0x3a')){var _0x1abc57={};_0x1abc57[_0x3f31dc[_0x460c('0x29')]]={'$like':'%'+_0x5305ca[_0x460c('0x2e')][_0x460c('0x3b')]+'%'};return _0x1abc57;}})});}_0x2984db=_[_0x460c('0x3c')]({},_0x2984db,_0x5305ca['options']);var _0x179f2c={'where':_0x2984db[_0x460c('0x37')]};return db['Template']['count'](_0x179f2c)['then'](function(_0x244bda){_0x15a5a2[_0x460c('0x1b')]=_0x244bda;if(_0x5305ca[_0x460c('0x2e')]['includeAll']){_0x2984db[_0x460c('0x3d')]=[{'all':!![]}];}return db[_0x460c('0x2a')]['findAll'](_0x2984db);})[_0x460c('0x23')](function(_0x108fa5){_0x15a5a2[_0x460c('0x3e')]=_0x108fa5;return _0x15a5a2;})[_0x460c('0x23')](respondWithFilteredResult(_0x13e21f,_0x2984db))['catch'](handleError(_0x13e21f,null));};exports['show']=function(_0x4ba4e0,_0x2ef653){var _0x1b5d76={'raw':!![],'where':{'id':_0x4ba4e0['params']['id']}},_0x59e78e={};_0x59e78e[_0x460c('0x2d')]=_['keys'](db['Template'][_0x460c('0x3f')]);_0x59e78e[_0x460c('0x2e')]=_[_0x460c('0x2f')](_0x4ba4e0[_0x460c('0x2e')]);_0x59e78e[_0x460c('0x38')]=_[_0x460c('0x30')](_0x59e78e[_0x460c('0x2d')],_0x59e78e[_0x460c('0x2e')]);_0x1b5d76['attributes']=_[_0x460c('0x30')](_0x59e78e[_0x460c('0x2d')],qs[_0x460c('0x31')](_0x4ba4e0[_0x460c('0x2e')][_0x460c('0x31')]));_0x1b5d76[_0x460c('0x32')]=_0x1b5d76[_0x460c('0x32')][_0x460c('0x33')]?_0x1b5d76['attributes']:_0x59e78e[_0x460c('0x2d')];if(_0x4ba4e0[_0x460c('0x2e')]['includeAll']){_0x1b5d76['include']=[{'all':!![]}];}_0x1b5d76=_[_0x460c('0x3c')]({},_0x1b5d76,_0x4ba4e0[_0x460c('0x40')]);return db[_0x460c('0x2a')][_0x460c('0x41')](_0x1b5d76)[_0x460c('0x23')](handleEntityNotFound(_0x2ef653,null))[_0x460c('0x23')](respondWithResult(_0x2ef653,null))['catch'](handleError(_0x2ef653,null));};exports[_0x460c('0x42')]=function(_0x22a81a,_0x30fb7c){return db[_0x460c('0x2a')][_0x460c('0x42')](_0x22a81a[_0x460c('0x43')],{})[_0x460c('0x23')](function(_0x46c720){var _0x256815=_0x22a81a['user'][_0x460c('0x44')]({'plain':!![]});if(!_0x256815)throw new Error(_0x460c('0x45'));if(_0x256815[_0x460c('0x46')]===_0x460c('0x47')){var _0x42715a=_0x46c720['get']({'plain':!![]});var _0x3f69fd=_0x460c('0x24');return db[_0x460c('0x48')]['find']({'where':{'name':_0x3f69fd,'userProfileId':_0x256815[_0x460c('0x49')]},'raw':!![]})[_0x460c('0x23')](function(_0x50c1ba){if(_0x50c1ba&&_0x50c1ba[_0x460c('0x4a')]===0x0){return db[_0x460c('0x25')][_0x460c('0x42')]({'name':_0x42715a[_0x460c('0x29')],'resourceId':_0x42715a['id'],'type':_0x50c1ba['name'],'sectionId':_0x50c1ba['id']},{})['then'](function(){return _0x46c720;});}else{return _0x46c720;}})[_0x460c('0x4b')](function(_0x4e8532){logger[_0x460c('0x27')](_0x460c('0x4c'),_0x4e8532);throw _0x4e8532;});}return _0x46c720;})[_0x460c('0x23')](respondWithResult(_0x30fb7c,0xc9))['catch'](handleError(_0x30fb7c,null));};exports[_0x460c('0x22')]=function(_0xa1e37,_0x216a38){if(_0xa1e37['body']['id']){delete _0xa1e37[_0x460c('0x43')]['id'];}return db[_0x460c('0x2a')]['find']({'where':{'id':_0xa1e37['params']['id']}})['then'](handleEntityNotFound(_0x216a38,null))[_0x460c('0x23')](saveUpdates(_0xa1e37['body'],null))[_0x460c('0x23')](respondWithResult(_0x216a38,null))[_0x460c('0x4b')](handleError(_0x216a38,null));};exports[_0x460c('0x26')]=function(_0x47c053,_0x5757ed){return db[_0x460c('0x2a')][_0x460c('0x41')]({'where':{'id':_0x47c053[_0x460c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5757ed,null))[_0x460c('0x23')](removeEntity(_0x5757ed,null))[_0x460c('0x4b')](handleError(_0x5757ed,null));}; \ No newline at end of file +var _0xb230=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Template','count','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','key','map','name','query'];(function(_0x567bcb,_0x4978c1){var _0x4eebc2=function(_0x42a456){while(--_0x42a456){_0x567bcb['push'](_0x567bcb['shift']());}};_0x4eebc2(++_0x4978c1);}(_0xb230,0x14b));var _0x0b23=function(_0x246179,_0x4b378a){_0x246179=_0x246179-0x0;var _0x138aa9=_0xb230[_0x246179];return _0x138aa9;};'use strict';var pdf=require(_0x0b23('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0b23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b23('0x2'));var rp=require(_0x0b23('0x3'));var moment=require(_0x0b23('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0b23('0x5'));var path=require(_0x0b23('0x6'));var sox=require(_0x0b23('0x7'));var csv=require('to-csv');var ejs=require(_0x0b23('0x8'));var fs=require('fs');var _=require(_0x0b23('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b23('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b23('0xb'));var Redis=require(_0x0b23('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b23('0xd'));var hardwareService=require(_0x0b23('0xe'));var logger=require(_0x0b23('0xf'))(_0x0b23('0x10'));var utils=require('../../config/utils');var config=require(_0x0b23('0x11'));var db=require(_0x0b23('0x12'))['db'];function respondWithStatusCode(_0x5df937,_0x3f0873){_0x3f0873=_0x3f0873||0xcc;return function(_0x278601){if(_0x278601){return _0x5df937['sendStatus'](_0x3f0873);}return _0x5df937[_0x0b23('0x13')](_0x3f0873)[_0x0b23('0x14')]();};}function respondWithResult(_0x7be17c,_0xa28864){_0xa28864=_0xa28864||0xc8;return function(_0x3199d2){if(_0x3199d2){return _0x7be17c[_0x0b23('0x13')](_0xa28864)[_0x0b23('0x15')](_0x3199d2);}};}function respondWithFilteredResult(_0x4a7b49,_0x3bec9b){return function(_0x4cd2d7){if(_0x4cd2d7){var _0x243243=_0x4cd2d7['count'],_0x46faec=_0x3bec9b[_0x0b23('0x16')],_0x42dc57=_0x3bec9b[_0x0b23('0x16')]+_0x3bec9b['limit'],_0x1c0418;if(_0x42dc57>=_0x243243){_0x42dc57=_0x243243;_0x1c0418=0xc8;}else{_0x1c0418=0xce;}_0x4a7b49[_0x0b23('0x13')](_0x1c0418);return _0x4a7b49['set']('Content-Range',_0x46faec+'-'+_0x42dc57+'/'+_0x243243)['json'](_0x4cd2d7);}return null;};}function patchUpdates(_0x4424d6){return function(_0x4d125a){try{jsonpatch[_0x0b23('0x17')](_0x4d125a,_0x4424d6,!![]);}catch(_0xe9350c){return BPromise[_0x0b23('0x18')](_0xe9350c);}return _0x4d125a[_0x0b23('0x19')]();};}function saveUpdates(_0x2495cc,_0xb176d0){return function(_0x45783c){if(_0x45783c){return _0x45783c[_0x0b23('0x1a')](_0x2495cc)['then'](function(_0x1328ce){return _0x1328ce;});}return null;};}function removeEntity(_0x5581a2,_0xa4bef1){return function(_0x1e7759){if(_0x1e7759){return _0x1e7759['destroy']()[_0x0b23('0x1b')](function(){var _0x590a3b=_0x1e7759[_0x0b23('0x1c')]({'plain':!![]});var _0x1b9900=_0x0b23('0x1d');return db[_0x0b23('0x1e')][_0x0b23('0x1f')]({'where':{'type':_0x1b9900,'resourceId':_0x590a3b['id']}})['then'](function(){return _0x1e7759;});})[_0x0b23('0x1b')](function(){_0x5581a2[_0x0b23('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1079fe,_0x55aac2){return function(_0x27599d){if(!_0x27599d){_0x1079fe[_0x0b23('0x20')](0x194);}return _0x27599d;};}function handleError(_0x9fba09,_0x5459bb){_0x5459bb=_0x5459bb||0x1f4;return function(_0x2f5006){logger[_0x0b23('0x21')](_0x2f5006[_0x0b23('0x22')]);if(_0x2f5006['name']){delete _0x2f5006['name'];}_0x9fba09['status'](_0x5459bb)[_0x0b23('0x23')](_0x2f5006);};}exports[_0x0b23('0x24')]=function(_0x548a12,_0x41ed46){var _0x3652cd={},_0x15367e={},_0xaa2bb6={'count':0x0,'rows':[]};var _0x1bace2=_['map'](db['Template'][_0x0b23('0x25')],function(_0x54e742){return{'name':_0x54e742[_0x0b23('0x26')],'type':_0x54e742[_0x0b23('0x27')][_0x0b23('0x28')]};});_0x15367e['model']=_[_0x0b23('0x29')](_0x1bace2,_0x0b23('0x2a'));_0x15367e[_0x0b23('0x2b')]=_[_0x0b23('0x2c')](_0x548a12[_0x0b23('0x2b')]);_0x15367e[_0x0b23('0x2d')]=_['intersection'](_0x15367e['model'],_0x15367e[_0x0b23('0x2b')]);_0x3652cd['attributes']=_[_0x0b23('0x2e')](_0x15367e[_0x0b23('0x2f')],qs[_0x0b23('0x30')](_0x548a12[_0x0b23('0x2b')][_0x0b23('0x30')]));_0x3652cd[_0x0b23('0x31')]=_0x3652cd[_0x0b23('0x31')][_0x0b23('0x32')]?_0x3652cd['attributes']:_0x15367e[_0x0b23('0x2f')];if(!_0x548a12[_0x0b23('0x2b')][_0x0b23('0x33')](_0x0b23('0x34'))){_0x3652cd[_0x0b23('0x35')]=qs[_0x0b23('0x35')](_0x548a12[_0x0b23('0x2b')][_0x0b23('0x35')]);_0x3652cd[_0x0b23('0x16')]=qs['offset'](_0x548a12[_0x0b23('0x2b')][_0x0b23('0x16')]);}_0x3652cd[_0x0b23('0x36')]=qs[_0x0b23('0x37')](_0x548a12[_0x0b23('0x2b')]['sort']);_0x3652cd[_0x0b23('0x38')]=qs[_0x0b23('0x2d')](_[_0x0b23('0x39')](_0x548a12[_0x0b23('0x2b')],_0x15367e[_0x0b23('0x2d')]),_0x1bace2);if(_0x548a12[_0x0b23('0x2b')][_0x0b23('0x3a')]){_0x3652cd['where']=_[_0x0b23('0x3b')](_0x3652cd[_0x0b23('0x38')],{'$or':_[_0x0b23('0x29')](_0x1bace2,function(_0x47bcac){if(_0x47bcac[_0x0b23('0x27')]!==_0x0b23('0x3c')){var _0x1eeae7={};_0x1eeae7[_0x47bcac['name']]={'$like':'%'+_0x548a12[_0x0b23('0x2b')][_0x0b23('0x3a')]+'%'};return _0x1eeae7;}})});}_0x3652cd=_[_0x0b23('0x3b')]({},_0x3652cd,_0x548a12[_0x0b23('0x3d')]);var _0x4aec8e={'where':_0x3652cd[_0x0b23('0x38')]};return db[_0x0b23('0x3e')][_0x0b23('0x3f')](_0x4aec8e)[_0x0b23('0x1b')](function(_0x15363c){_0xaa2bb6[_0x0b23('0x3f')]=_0x15363c;if(_0x548a12[_0x0b23('0x2b')]['includeAll']){_0x3652cd[_0x0b23('0x40')]=[{'all':!![]}];}return db[_0x0b23('0x3e')][_0x0b23('0x41')](_0x3652cd);})[_0x0b23('0x1b')](function(_0x57e5c9){_0xaa2bb6['rows']=_0x57e5c9;return _0xaa2bb6;})['then'](respondWithFilteredResult(_0x41ed46,_0x3652cd))[_0x0b23('0x42')](handleError(_0x41ed46,null));};exports[_0x0b23('0x43')]=function(_0x57e77f,_0x529914){var _0x4e4706={'raw':!![],'where':{'id':_0x57e77f[_0x0b23('0x44')]['id']}},_0x5c86a8={};_0x5c86a8[_0x0b23('0x2f')]=_[_0x0b23('0x2c')](db[_0x0b23('0x3e')][_0x0b23('0x25')]);_0x5c86a8[_0x0b23('0x2b')]=_[_0x0b23('0x2c')](_0x57e77f[_0x0b23('0x2b')]);_0x5c86a8[_0x0b23('0x2d')]=_['intersection'](_0x5c86a8[_0x0b23('0x2f')],_0x5c86a8[_0x0b23('0x2b')]);_0x4e4706[_0x0b23('0x31')]=_[_0x0b23('0x2e')](_0x5c86a8[_0x0b23('0x2f')],qs['fields'](_0x57e77f[_0x0b23('0x2b')][_0x0b23('0x30')]));_0x4e4706['attributes']=_0x4e4706[_0x0b23('0x31')][_0x0b23('0x32')]?_0x4e4706['attributes']:_0x5c86a8[_0x0b23('0x2f')];if(_0x57e77f[_0x0b23('0x2b')][_0x0b23('0x45')]){_0x4e4706[_0x0b23('0x40')]=[{'all':!![]}];}_0x4e4706=_[_0x0b23('0x3b')]({},_0x4e4706,_0x57e77f[_0x0b23('0x3d')]);return db[_0x0b23('0x3e')][_0x0b23('0x46')](_0x4e4706)[_0x0b23('0x1b')](handleEntityNotFound(_0x529914,null))[_0x0b23('0x1b')](respondWithResult(_0x529914,null))[_0x0b23('0x42')](handleError(_0x529914,null));};exports[_0x0b23('0x47')]=function(_0x46ae30,_0xc12109){return db[_0x0b23('0x3e')]['create'](_0x46ae30['body'],{})[_0x0b23('0x1b')](function(_0x4c3752){var _0xacc4ef=_0x46ae30[_0x0b23('0x48')][_0x0b23('0x1c')]({'plain':!![]});if(!_0xacc4ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xacc4ef['role']===_0x0b23('0x48')){var _0x4f5db4=_0x4c3752[_0x0b23('0x1c')]({'plain':!![]});var _0x10e11c=_0x0b23('0x1d');return db['UserProfileSection'][_0x0b23('0x46')]({'where':{'name':_0x10e11c,'userProfileId':_0xacc4ef['userProfileId']},'raw':!![]})[_0x0b23('0x1b')](function(_0x1a7640){if(_0x1a7640&&_0x1a7640['autoAssociation']===0x0){return db[_0x0b23('0x1e')][_0x0b23('0x47')]({'name':_0x4f5db4[_0x0b23('0x2a')],'resourceId':_0x4f5db4['id'],'type':_0x1a7640[_0x0b23('0x2a')],'sectionId':_0x1a7640['id']},{})[_0x0b23('0x1b')](function(){return _0x4c3752;});}else{return _0x4c3752;}})[_0x0b23('0x42')](function(_0x13ec59){logger[_0x0b23('0x21')](_0x0b23('0x49'),_0x13ec59);throw _0x13ec59;});}return _0x4c3752;})['then'](respondWithResult(_0xc12109,0xc9))[_0x0b23('0x42')](handleError(_0xc12109,null));};exports['update']=function(_0x124be6,_0x219d98){if(_0x124be6['body']['id']){delete _0x124be6[_0x0b23('0x4a')]['id'];}return db[_0x0b23('0x3e')][_0x0b23('0x46')]({'where':{'id':_0x124be6[_0x0b23('0x44')]['id']}})[_0x0b23('0x1b')](handleEntityNotFound(_0x219d98,null))['then'](saveUpdates(_0x124be6[_0x0b23('0x4a')],null))[_0x0b23('0x1b')](respondWithResult(_0x219d98,null))[_0x0b23('0x42')](handleError(_0x219d98,null));};exports['destroy']=function(_0x30bc37,_0x2391bb){return db[_0x0b23('0x3e')][_0x0b23('0x46')]({'where':{'id':_0x30bc37[_0x0b23('0x44')]['id']}})[_0x0b23('0x1b')](handleEntityNotFound(_0x2391bb,null))[_0x0b23('0x1b')](removeEntity(_0x2391bb,null))[_0x0b23('0x42')](handleError(_0x2391bb,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c7317ec..9450f05 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 _0x79ac=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7c67ed,_0x16fb94){var _0x2e5c17=function(_0x3d344f){while(--_0x3d344f){_0x7c67ed['push'](_0x7c67ed['shift']());}};_0x2e5c17(++_0x16fb94);}(_0x79ac,0x1b9));var _0xc79a=function(_0x3096c6,_0x3a3f8e){_0x3096c6=_0x3096c6-0x0;var _0x1dc42b=_0x79ac[_0x3096c6];return _0x1dc42b;};'use strict';var _=require(_0xc79a('0x0'));var util=require(_0xc79a('0x1'));var logger=require(_0xc79a('0x2'))(_0xc79a('0x3'));var moment=require(_0xc79a('0x4'));var BPromise=require(_0xc79a('0x5'));var rp=require(_0xc79a('0x6'));var fs=require('fs');var path=require(_0xc79a('0x7'));var rimraf=require(_0xc79a('0x8'));var config=require(_0xc79a('0x9'));var attributes=require(_0xc79a('0xa'));module[_0xc79a('0xb')]=function(_0x1db524,_0x2ca270){return _0x1db524[_0xc79a('0xc')](_0xc79a('0xd'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74bd=['exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./template.attributes'];(function(_0x2413b6,_0x3c1379){var _0x30791f=function(_0x2c3bb0){while(--_0x2c3bb0){_0x2413b6['push'](_0x2413b6['shift']());}};_0x30791f(++_0x3c1379);}(_0x74bd,0xdc));var _0xd74b=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x74bd[_0x5e4b85];return _0x5cd3cb;};'use strict';var _=require(_0xd74b('0x0'));var util=require('util');var logger=require(_0xd74b('0x1'))(_0xd74b('0x2'));var moment=require(_0xd74b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd74b('0x4'));var rimraf=require(_0xd74b('0x5'));var config=require(_0xd74b('0x6'));var attributes=require(_0xd74b('0x7'));module[_0xd74b('0x8')]=function(_0x3ce21a,_0x1726d3){return _0x3ce21a[_0xd74b('0x9')](_0xd74b('0xa'),attributes,{'tableName':_0xd74b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 67d502e..7948dfa 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 _0x6c01=['model','GetTemplate','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','catch','findAll','options','attributes','limit','include','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c01,0xd5));var _0x16c0=function(_0x42731b,_0x1205e9){_0x42731b=_0x42731b-0x0;var _0x500c65=_0x6c01[_0x42731b];return _0x500c65;};'use strict';var _=require(_0x16c0('0x0'));var util=require('util');var moment=require(_0x16c0('0x1'));var BPromise=require(_0x16c0('0x2'));var rs=require(_0x16c0('0x3'));var fs=require('fs');var Redis=require(_0x16c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16c0('0x5'))(_0x16c0('0x6'));var config=require(_0x16c0('0x7'));var jayson=require(_0x16c0('0x8'));var client=jayson['client'][_0x16c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2475a9,_0x13b23d,_0x1b1c66){return new BPromise(function(_0x44eddd,_0x4dc155){return client[_0x16c0('0xa')](_0x2475a9,_0x1b1c66)[_0x16c0('0xb')](function(_0x46339b){logger[_0x16c0('0xc')]('Template,\x20%s,\x20%s',_0x13b23d,_0x16c0('0xd'));logger['debug'](_0x16c0('0xe'),_0x13b23d,_0x16c0('0xd'),JSON[_0x16c0('0xf')](_0x46339b));if(_0x46339b[_0x16c0('0x10')]){if(_0x46339b[_0x16c0('0x10')][_0x16c0('0x11')]===0x1f4){logger[_0x16c0('0x10')]('Template,\x20%s,\x20%s',_0x13b23d,_0x46339b[_0x16c0('0x10')][_0x16c0('0x12')]);return _0x4dc155(_0x46339b[_0x16c0('0x10')][_0x16c0('0x12')]);}logger[_0x16c0('0x10')]('Template,\x20%s,\x20%s',_0x13b23d,_0x46339b['error'][_0x16c0('0x12')]);return _0x44eddd(_0x46339b['error'][_0x16c0('0x12')]);}else{logger[_0x16c0('0xc')](_0x16c0('0x13'),_0x13b23d,_0x16c0('0xd'));_0x44eddd(_0x46339b['result'][_0x16c0('0x12')]);}})[_0x16c0('0x14')](function(_0x232246){logger[_0x16c0('0x10')](_0x16c0('0x13'),_0x13b23d,_0x232246);_0x4dc155(_0x232246);});});}exports['GetTemplate']=function(_0x5389c0){var _0x31bd5c=this;return new Promise(function(_0x21fb81,_0x32e411){return db['Template'][_0x16c0('0x15')]({'raw':_0x5389c0[_0x16c0('0x16')]?_0x5389c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5389c0[_0x16c0('0x16')]?_0x5389c0[_0x16c0('0x16')]['where']||null:null,'attributes':_0x5389c0[_0x16c0('0x16')]?_0x5389c0[_0x16c0('0x16')][_0x16c0('0x17')]||null:null,'limit':_0x5389c0['options']?_0x5389c0[_0x16c0('0x16')][_0x16c0('0x18')]||null:null,'include':_0x5389c0[_0x16c0('0x16')]?_0x5389c0[_0x16c0('0x16')][_0x16c0('0x19')]?_[_0x16c0('0x1a')](_0x5389c0[_0x16c0('0x16')][_0x16c0('0x19')],function(_0x613080){return{'model':db[_0x613080[_0x16c0('0x1b')]],'as':_0x613080['as'],'attributes':_0x613080[_0x16c0('0x17')],'include':_0x613080[_0x16c0('0x19')]?_['map'](_0x613080[_0x16c0('0x19')],function(_0x2fccc1){return{'model':db[_0x2fccc1[_0x16c0('0x1b')]],'as':_0x2fccc1['as'],'attributes':_0x2fccc1[_0x16c0('0x17')],'include':_0x2fccc1[_0x16c0('0x19')]?_[_0x16c0('0x1a')](_0x2fccc1['include'],function(_0x5231e9){return{'model':db[_0x5231e9[_0x16c0('0x1b')]],'as':_0x5231e9['as'],'attributes':_0x5231e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x16c0('0xb')](function(_0x553baf){logger['info'](_0x16c0('0x1c'),_0x5389c0);logger[_0x16c0('0x1d')](_0x16c0('0x1c'),_0x5389c0,JSON[_0x16c0('0xf')](_0x553baf));_0x21fb81(_0x553baf);})[_0x16c0('0x14')](function(_0xa84da4){logger[_0x16c0('0x10')](_0x16c0('0x1c'),_0xa84da4['message'],_0x5389c0);_0x32e411(_0x31bd5c[_0x16c0('0x10')](0x1f4,_0xa84da4['message']));});});}; \ No newline at end of file +var _0x864b=['options','where','limit','include','map','model','attributes','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTemplate','findAll'];(function(_0x347ae9,_0x8979ce){var _0x401103=function(_0x14cea9){while(--_0x14cea9){_0x347ae9['push'](_0x347ae9['shift']());}};_0x401103(++_0x8979ce);}(_0x864b,0x91));var _0xb864=function(_0x53565a,_0x40648b){_0x53565a=_0x53565a-0x0;var _0x387936=_0x864b[_0x53565a];return _0x387936;};'use strict';var _=require(_0xb864('0x0'));var util=require(_0xb864('0x1'));var moment=require(_0xb864('0x2'));var BPromise=require(_0xb864('0x3'));var rs=require(_0xb864('0x4'));var fs=require('fs');var Redis=require(_0xb864('0x5'));var db=require(_0xb864('0x6'))['db'];var utils=require(_0xb864('0x7'));var logger=require(_0xb864('0x8'))('rpc');var config=require(_0xb864('0x9'));var jayson=require(_0xb864('0xa'));var client=jayson[_0xb864('0xb')][_0xb864('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31d22c,_0x3e8506,_0x2a6c99){return new BPromise(function(_0xa51fe8,_0x46954b){return client['request'](_0x31d22c,_0x2a6c99)['then'](function(_0x44c799){logger[_0xb864('0xd')](_0xb864('0xe'),_0x3e8506,'request\x20sent');logger[_0xb864('0xf')](_0xb864('0x10'),_0x3e8506,_0xb864('0x11'),JSON[_0xb864('0x12')](_0x44c799));if(_0x44c799[_0xb864('0x13')]){if(_0x44c799['error'][_0xb864('0x14')]===0x1f4){logger[_0xb864('0x13')](_0xb864('0xe'),_0x3e8506,_0x44c799[_0xb864('0x13')][_0xb864('0x15')]);return _0x46954b(_0x44c799['error'][_0xb864('0x15')]);}logger['error'](_0xb864('0xe'),_0x3e8506,_0x44c799[_0xb864('0x13')][_0xb864('0x15')]);return _0xa51fe8(_0x44c799[_0xb864('0x13')]['message']);}else{logger[_0xb864('0xd')](_0xb864('0xe'),_0x3e8506,'request\x20sent');_0xa51fe8(_0x44c799[_0xb864('0x16')][_0xb864('0x15')]);}})['catch'](function(_0x3704a1){logger[_0xb864('0x13')](_0xb864('0xe'),_0x3e8506,_0x3704a1);_0x46954b(_0x3704a1);});});}exports[_0xb864('0x17')]=function(_0x497db6){var _0x25bb10=this;return new Promise(function(_0x9bf066,_0x5cc5de){return db['Template'][_0xb864('0x18')]({'raw':_0x497db6['options']?_0x497db6[_0xb864('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x497db6[_0xb864('0x19')]?_0x497db6['options'][_0xb864('0x1a')]||null:null,'attributes':_0x497db6['options']?_0x497db6[_0xb864('0x19')]['attributes']||null:null,'limit':_0x497db6['options']?_0x497db6[_0xb864('0x19')][_0xb864('0x1b')]||null:null,'include':_0x497db6[_0xb864('0x19')]?_0x497db6['options'][_0xb864('0x1c')]?_[_0xb864('0x1d')](_0x497db6[_0xb864('0x19')]['include'],function(_0x1cc32f){return{'model':db[_0x1cc32f[_0xb864('0x1e')]],'as':_0x1cc32f['as'],'attributes':_0x1cc32f[_0xb864('0x1f')],'include':_0x1cc32f['include']?_[_0xb864('0x1d')](_0x1cc32f[_0xb864('0x1c')],function(_0xf8e197){return{'model':db[_0xf8e197[_0xb864('0x1e')]],'as':_0xf8e197['as'],'attributes':_0xf8e197[_0xb864('0x1f')],'include':_0xf8e197[_0xb864('0x1c')]?_[_0xb864('0x1d')](_0xf8e197['include'],function(_0x487e62){return{'model':db[_0x487e62['model']],'as':_0x487e62['as'],'attributes':_0x487e62[_0xb864('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb864('0x20')](function(_0x553591){logger[_0xb864('0xd')](_0xb864('0x17'),_0x497db6);logger['debug']('GetTemplate',_0x497db6,JSON['stringify'](_0x553591));_0x9bf066(_0x553591);})[_0xb864('0x21')](function(_0x2698ce){logger[_0xb864('0x13')](_0xb864('0x17'),_0x2698ce[_0xb864('0x15')],_0x497db6);_0x5cc5de(_0x25bb10['error'](0x1f4,_0x2698ce[_0xb864('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c06879b..493aeaa 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 _0x94e3=['/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions'];(function(_0x249e2e,_0x452a66){var _0x2eb804=function(_0x4a5821){while(--_0x4a5821){_0x249e2e['push'](_0x249e2e['shift']());}};_0x2eb804(++_0x452a66);}(_0x94e3,0x10f));var _0x394e=function(_0x3073f6,_0xf71a88){_0x3073f6=_0x3073f6-0x0;var _0x28eaef=_0x94e3[_0x3073f6];return _0x28eaef;};'use strict';var multer=require(_0x394e('0x0'));var util=require('util');var path=require(_0x394e('0x1'));var timeout=require(_0x394e('0x2'));var express=require(_0x394e('0x3'));var router=express[_0x394e('0x4')]();var auth=require(_0x394e('0x5'));var interaction=require(_0x394e('0x6'));var config=require(_0x394e('0x7'));var controller=require(_0x394e('0x8'));router[_0x394e('0x9')]('/',auth[_0x394e('0xa')](),controller[_0x394e('0xb')]);router[_0x394e('0x9')](_0x394e('0xc'),auth[_0x394e('0xa')](),controller[_0x394e('0xd')]);router[_0x394e('0x9')](_0x394e('0xe'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x394e('0x9')](_0x394e('0xf'),auth[_0x394e('0xa')](),controller[_0x394e('0x10')]);router[_0x394e('0x9')](_0x394e('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x394e('0x12')]('/',auth[_0x394e('0xa')](),controller['create']);router[_0x394e('0x12')](_0x394e('0xe'),auth[_0x394e('0xa')](),controller[_0x394e('0x13')]);router[_0x394e('0x12')](_0x394e('0xf'),auth[_0x394e('0xa')](),controller[_0x394e('0x14')]);router[_0x394e('0x12')]('/:id/actions',auth['isAuthenticated'](),controller[_0x394e('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x394e('0x16')]);router[_0x394e('0x17')](_0x394e('0xc'),auth[_0x394e('0xa')](),controller[_0x394e('0x18')]);module[_0x394e('0x19')]=router; \ No newline at end of file +var _0x715d=['../../config/environment','./trigger.controller','isAuthenticated','get','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x715d,0x18a));var _0xd715=function(_0x22f077,_0x4e99a4){_0x22f077=_0x22f077-0x0;var _0x3a92c=_0x715d[_0x22f077];return _0x3a92c;};'use strict';var multer=require(_0xd715('0x0'));var util=require(_0xd715('0x1'));var path=require('path');var timeout=require(_0xd715('0x2'));var express=require('express');var router=express[_0xd715('0x3')]();var auth=require(_0xd715('0x4'));var interaction=require(_0xd715('0x5'));var config=require(_0xd715('0x6'));var controller=require(_0xd715('0x7'));router['get']('/',auth[_0xd715('0x8')](),controller['index']);router[_0xd715('0x9')]('/:id',auth[_0xd715('0x8')](),controller['show']);router[_0xd715('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xd715('0xa')]);router[_0xd715('0x9')](_0xd715('0xb'),auth[_0xd715('0x8')](),controller[_0xd715('0xc')]);router[_0xd715('0x9')](_0xd715('0xd'),auth[_0xd715('0x8')](),controller[_0xd715('0xe')]);router[_0xd715('0xf')]('/',auth[_0xd715('0x8')](),controller['create']);router[_0xd715('0xf')]('/:id/all_conditions',auth[_0xd715('0x8')](),controller[_0xd715('0x10')]);router['post'](_0xd715('0xb'),auth[_0xd715('0x8')](),controller[_0xd715('0x11')]);router[_0xd715('0xf')]('/:id/actions',auth[_0xd715('0x8')](),controller[_0xd715('0x12')]);router[_0xd715('0x13')](_0xd715('0x14'),auth[_0xd715('0x8')](),controller[_0xd715('0x15')]);router[_0xd715('0x16')](_0xd715('0x14'),auth[_0xd715('0x8')](),controller[_0xd715('0x17')]);module[_0xd715('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 67d71d1..c1d0303 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 _0xee54=['sequelize','STRING'];(function(_0x814954,_0x2a5b85){var _0x4edda3=function(_0x45cef6){while(--_0x45cef6){_0x814954['push'](_0x814954['shift']());}};_0x4edda3(++_0x2a5b85);}(_0xee54,0x120));var _0x4ee5=function(_0x2d8e3b,_0x2de6f1){_0x2d8e3b=_0x2d8e3b-0x0;var _0x75f5ba=_0xee54[_0x2d8e3b];return _0x75f5ba;};'use strict';var Sequelize=require(_0x4ee5('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ee5('0x1')]},'channel':{'type':Sequelize[_0x4ee5('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xba80=['STRING','sequelize','exports'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xba80,0x1a8));var _0x0ba8=function(_0x207fd5,_0x417b97){_0x207fd5=_0x207fd5-0x0;var _0x5c06d8=_0xba80[_0x207fd5];return _0x5c06d8;};'use strict';var Sequelize=require(_0x0ba8('0x0'));module[_0x0ba8('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0ba8('0x2')]},'description':{'type':Sequelize[_0x0ba8('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ac95987..fd412ac 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 _0x7b71=['fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','catch','show','params','intersection','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','map','Trigger','rawAttributes'];(function(_0x1a9fc2,_0x12a3f5){var _0x15dbf1=function(_0x57d004){while(--_0x57d004){_0x1a9fc2['push'](_0x1a9fc2['shift']());}};_0x15dbf1(++_0x12a3f5);}(_0x7b71,0x1a4));var _0x17b7=function(_0x4e7551,_0x398ee5){_0x4e7551=_0x4e7551-0x0;var _0x2c2ae8=_0x7b71[_0x4e7551];return _0x2c2ae8;};'use strict';var pdf=require(_0x17b7('0x0'));var emlformat=require(_0x17b7('0x1'));var rimraf=require(_0x17b7('0x2'));var zipdir=require(_0x17b7('0x3'));var jsonpatch=require(_0x17b7('0x4'));var rp=require(_0x17b7('0x5'));var moment=require(_0x17b7('0x6'));var BPromise=require(_0x17b7('0x7'));var Mustache=require(_0x17b7('0x8'));var util=require(_0x17b7('0x9'));var path=require(_0x17b7('0xa'));var sox=require(_0x17b7('0xb'));var csv=require(_0x17b7('0xc'));var ejs=require(_0x17b7('0xd'));var fs=require('fs');var _=require(_0x17b7('0xe'));var squel=require(_0x17b7('0xf'));var crypto=require('crypto');var jsforce=require(_0x17b7('0x10'));var deskjs=require(_0x17b7('0x11'));var toCsv=require(_0x17b7('0xc'));var querystring=require(_0x17b7('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x17b7('0x13'));var qs=require(_0x17b7('0x14'));var as=require(_0x17b7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x17b7('0x16'));var utils=require(_0x17b7('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283cbd,_0x6a4ee0){_0x6a4ee0=_0x6a4ee0||0xcc;return function(_0x36cb98){if(_0x36cb98){return _0x283cbd[_0x17b7('0x18')](_0x6a4ee0);}return _0x283cbd[_0x17b7('0x19')](_0x6a4ee0)[_0x17b7('0x1a')]();};}function respondWithResult(_0x33ee62,_0x120772){_0x120772=_0x120772||0xc8;return function(_0x1ab9d0){if(_0x1ab9d0){return _0x33ee62[_0x17b7('0x19')](_0x120772)['json'](_0x1ab9d0);}};}function respondWithFilteredResult(_0x5d1048,_0x21ac7e){return function(_0xf61ef6){if(_0xf61ef6){var _0x2eed8e=_0xf61ef6['count'],_0x34576e=_0x21ac7e[_0x17b7('0x1b')],_0x5c0993=_0x21ac7e[_0x17b7('0x1b')]+_0x21ac7e['limit'],_0x1953ab;if(_0x5c0993>=_0x2eed8e){_0x5c0993=_0x2eed8e;_0x1953ab=0xc8;}else{_0x1953ab=0xce;}_0x5d1048[_0x17b7('0x19')](_0x1953ab);return _0x5d1048[_0x17b7('0x1c')](_0x17b7('0x1d'),_0x34576e+'-'+_0x5c0993+'/'+_0x2eed8e)[_0x17b7('0x1e')](_0xf61ef6);}return null;};}function patchUpdates(_0x1bcf4d){return function(_0x1d8b67){try{jsonpatch['apply'](_0x1d8b67,_0x1bcf4d,!![]);}catch(_0x34e63c){return BPromise[_0x17b7('0x1f')](_0x34e63c);}return _0x1d8b67[_0x17b7('0x20')]();};}function saveUpdates(_0xb1da24,_0x328c54){return function(_0x33fb38){if(_0x33fb38){return _0x33fb38[_0x17b7('0x21')](_0xb1da24)[_0x17b7('0x22')](function(_0xdf2a05){return _0xdf2a05;});}return null;};}function removeEntity(_0x17e0b9,_0x55249f){return function(_0x4b3694){if(_0x4b3694){return _0x4b3694[_0x17b7('0x23')]()[_0x17b7('0x22')](function(){var _0x363d70=_0x4b3694[_0x17b7('0x24')]({'plain':!![]});var _0xe81559=_0x17b7('0x25');return db[_0x17b7('0x26')][_0x17b7('0x23')]({'where':{'type':_0xe81559,'resourceId':_0x363d70['id']}})[_0x17b7('0x22')](function(){return _0x4b3694;});})[_0x17b7('0x22')](function(){_0x17e0b9['status'](0xcc)[_0x17b7('0x1a')]();});}};}function handleEntityNotFound(_0x1a5fd4,_0x5876b2){return function(_0x5adaeb){if(!_0x5adaeb){_0x1a5fd4[_0x17b7('0x18')](0x194);}return _0x5adaeb;};}function handleError(_0x5af834,_0x4d9b86){_0x4d9b86=_0x4d9b86||0x1f4;return function(_0x216b45){logger['error'](_0x216b45[_0x17b7('0x27')]);if(_0x216b45[_0x17b7('0x28')]){delete _0x216b45[_0x17b7('0x28')];}_0x5af834['status'](_0x4d9b86)[_0x17b7('0x29')](_0x216b45);};}exports['index']=function(_0x2eac34,_0x196fa3){var _0x1d026c={},_0x53afeb={},_0x687e42={'count':0x0,'rows':[]};var _0x5011fc=_[_0x17b7('0x2a')](db[_0x17b7('0x2b')][_0x17b7('0x2c')],function(_0x129a3d){return{'name':_0x129a3d[_0x17b7('0x2d')],'type':_0x129a3d['type'][_0x17b7('0x2e')]};});_0x53afeb[_0x17b7('0x2f')]=_[_0x17b7('0x2a')](_0x5011fc,_0x17b7('0x28'));_0x53afeb[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x2eac34[_0x17b7('0x30')]);_0x53afeb[_0x17b7('0x32')]=_['intersection'](_0x53afeb['model'],_0x53afeb[_0x17b7('0x30')]);_0x1d026c[_0x17b7('0x33')]=_['intersection'](_0x53afeb[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x2eac34[_0x17b7('0x30')][_0x17b7('0x34')]));_0x1d026c['attributes']=_0x1d026c['attributes'][_0x17b7('0x35')]?_0x1d026c['attributes']:_0x53afeb['model'];if(!_0x2eac34[_0x17b7('0x30')]['hasOwnProperty'](_0x17b7('0x36'))){_0x1d026c[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0x2eac34['query'][_0x17b7('0x37')]);_0x1d026c[_0x17b7('0x1b')]=qs[_0x17b7('0x1b')](_0x2eac34[_0x17b7('0x30')]['offset']);}_0x1d026c[_0x17b7('0x38')]=qs[_0x17b7('0x39')](_0x2eac34['query'][_0x17b7('0x39')]);_0x1d026c[_0x17b7('0x3a')]=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0x2eac34[_0x17b7('0x30')],_0x53afeb[_0x17b7('0x32')]),_0x5011fc);if(_0x2eac34[_0x17b7('0x30')][_0x17b7('0x3c')]){_0x1d026c[_0x17b7('0x3a')]=_['merge'](_0x1d026c[_0x17b7('0x3a')],{'$or':_[_0x17b7('0x2a')](_0x5011fc,function(_0x2bc145){if(_0x2bc145[_0x17b7('0x3d')]!==_0x17b7('0x3e')){var _0x18a067={};_0x18a067[_0x2bc145[_0x17b7('0x28')]]={'$like':'%'+_0x2eac34[_0x17b7('0x30')]['filter']+'%'};return _0x18a067;}})});}_0x1d026c=_[_0x17b7('0x3f')]({},_0x1d026c,_0x2eac34[_0x17b7('0x40')]);var _0x67b191={'where':_0x1d026c[_0x17b7('0x3a')]};return db[_0x17b7('0x2b')][_0x17b7('0x41')](_0x67b191)[_0x17b7('0x22')](function(_0x2eb2d8){_0x687e42[_0x17b7('0x41')]=_0x2eb2d8;if(_0x2eac34['query'][_0x17b7('0x42')]){_0x1d026c['include']=[{'all':!![]}];}return db[_0x17b7('0x2b')]['findAll'](_0x1d026c);})[_0x17b7('0x22')](function(_0x292f44){_0x687e42['rows']=_0x292f44;return _0x687e42;})[_0x17b7('0x22')](respondWithFilteredResult(_0x196fa3,_0x1d026c))[_0x17b7('0x43')](handleError(_0x196fa3,null));};exports[_0x17b7('0x44')]=function(_0x2b28bb,_0x132f5b){var _0x39ac76={'raw':![],'where':{'id':_0x2b28bb[_0x17b7('0x45')]['id']}},_0x1d05e8={};_0x1d05e8[_0x17b7('0x2f')]=_['keys'](db[_0x17b7('0x2b')][_0x17b7('0x2c')]);_0x1d05e8[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x2b28bb['query']);_0x1d05e8[_0x17b7('0x32')]=_[_0x17b7('0x46')](_0x1d05e8['model'],_0x1d05e8[_0x17b7('0x30')]);_0x39ac76['attributes']=_['intersection'](_0x1d05e8[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x2b28bb[_0x17b7('0x30')][_0x17b7('0x34')]));_0x39ac76[_0x17b7('0x33')]=_0x39ac76['attributes']['length']?_0x39ac76['attributes']:_0x1d05e8[_0x17b7('0x2f')];if(_0x2b28bb[_0x17b7('0x30')]['includeAll']){_0x39ac76[_0x17b7('0x47')]=[{'all':!![]}];}_0x39ac76=_[_0x17b7('0x3f')]({},_0x39ac76,_0x2b28bb[_0x17b7('0x40')]);return db[_0x17b7('0x2b')][_0x17b7('0x48')](_0x39ac76)[_0x17b7('0x22')](handleEntityNotFound(_0x132f5b,null))['then'](respondWithResult(_0x132f5b,null))[_0x17b7('0x43')](handleError(_0x132f5b,null));};exports['create']=function(_0x14e2be,_0x30665c){return db[_0x17b7('0x2b')]['create'](_0x14e2be[_0x17b7('0x49')],{})[_0x17b7('0x22')](function(_0x420fd4){var _0x1ca7ca=_0x14e2be[_0x17b7('0x4a')][_0x17b7('0x24')]({'plain':!![]});if(!_0x1ca7ca)throw new Error(_0x17b7('0x4b'));if(_0x1ca7ca[_0x17b7('0x4c')]===_0x17b7('0x4a')){var _0x192baf=_0x420fd4[_0x17b7('0x24')]({'plain':!![]});var _0x3005bf=_0x17b7('0x25');return db[_0x17b7('0x4d')][_0x17b7('0x48')]({'where':{'name':_0x3005bf,'userProfileId':_0x1ca7ca['userProfileId']},'raw':!![]})['then'](function(_0x483db1){if(_0x483db1&&_0x483db1[_0x17b7('0x4e')]===0x0){return db[_0x17b7('0x26')][_0x17b7('0x4f')]({'name':_0x192baf[_0x17b7('0x28')],'resourceId':_0x192baf['id'],'type':_0x483db1['name'],'sectionId':_0x483db1['id']},{})[_0x17b7('0x22')](function(){return _0x420fd4;});}else{return _0x420fd4;}})[_0x17b7('0x43')](function(_0x555d1a){logger['error'](_0x17b7('0x50'),_0x555d1a);throw _0x555d1a;});}return _0x420fd4;})[_0x17b7('0x22')](respondWithResult(_0x30665c,0xc9))[_0x17b7('0x43')](handleError(_0x30665c,null));};exports[_0x17b7('0x21')]=function(_0x5703a7,_0x9186c9){if(_0x5703a7[_0x17b7('0x49')]['id']){delete _0x5703a7[_0x17b7('0x49')]['id'];}return db[_0x17b7('0x2b')][_0x17b7('0x48')]({'where':{'id':_0x5703a7[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x9186c9,null))[_0x17b7('0x22')](saveUpdates(_0x5703a7[_0x17b7('0x49')],null))[_0x17b7('0x22')](respondWithResult(_0x9186c9,null))[_0x17b7('0x43')](handleError(_0x9186c9,null));};exports['destroy']=function(_0x5da78f,_0x4c72b8){return db[_0x17b7('0x2b')][_0x17b7('0x48')]({'where':{'id':_0x5da78f[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x4c72b8,null))[_0x17b7('0x22')](removeEntity(_0x4c72b8,null))[_0x17b7('0x43')](handleError(_0x4c72b8,null));};exports[_0x17b7('0x51')]=function(_0x162c8d,_0x10aeda,_0x9d5943){if(_0x162c8d['body']['id']){delete _0x162c8d[_0x17b7('0x49')]['id'];}return db['Trigger'][_0x17b7('0x48')]({'where':{'id':_0x162c8d['params']['id']}})['then'](handleEntityNotFound(_0x10aeda,null))[_0x17b7('0x22')](function(_0x28600e){if(_0x28600e){_0x162c8d[_0x17b7('0x49')][_0x17b7('0x52')]=_0x28600e['id'];return db[_0x17b7('0x53')]['create'](_0x162c8d[_0x17b7('0x49')]);}})[_0x17b7('0x22')](respondWithResult(_0x10aeda,null))[_0x17b7('0x43')](handleError(_0x10aeda,null));};exports['addAnyCondition']=function(_0x5c9bc8,_0x5d439a,_0x5a599a){if(_0x5c9bc8[_0x17b7('0x49')]['id']){delete _0x5c9bc8[_0x17b7('0x49')]['id'];}return db['Trigger'][_0x17b7('0x48')]({'where':{'id':_0x5c9bc8[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x5d439a,null))[_0x17b7('0x22')](function(_0x391ba9){if(_0x391ba9){_0x5c9bc8[_0x17b7('0x49')][_0x17b7('0x54')]=_0x391ba9['id'];return db[_0x17b7('0x53')][_0x17b7('0x4f')](_0x5c9bc8[_0x17b7('0x49')]);}})[_0x17b7('0x22')](respondWithResult(_0x5d439a,null))[_0x17b7('0x43')](handleError(_0x5d439a,null));};exports['getAllConditions']=function(_0x43f583,_0x100352,_0x4af677){var _0x308d93={};var _0x21937c={};var _0x540764;var _0x43e8eb;return db[_0x17b7('0x2b')][_0x17b7('0x55')]({'where':{'id':_0x43f583[_0x17b7('0x45')]['id']}})['then'](handleEntityNotFound(_0x100352,null))[_0x17b7('0x22')](function(_0x162449){if(_0x162449){_0x540764=_0x162449;_0x21937c[_0x17b7('0x2f')]=_[_0x17b7('0x31')](db[_0x17b7('0x53')][_0x17b7('0x2c')]);_0x21937c[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x43f583[_0x17b7('0x30')]);_0x21937c[_0x17b7('0x32')]=_[_0x17b7('0x46')](_0x21937c[_0x17b7('0x2f')],_0x21937c[_0x17b7('0x30')]);_0x308d93[_0x17b7('0x33')]=_['intersection'](_0x21937c[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x43f583[_0x17b7('0x30')][_0x17b7('0x34')]));_0x308d93[_0x17b7('0x33')]=_0x308d93['attributes'][_0x17b7('0x35')]?_0x308d93[_0x17b7('0x33')]:_0x21937c[_0x17b7('0x2f')];_0x308d93[_0x17b7('0x38')]=qs['sort'](_0x43f583['query'][_0x17b7('0x39')]);_0x308d93[_0x17b7('0x3a')]=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0x43f583[_0x17b7('0x30')],_0x21937c['filters']));if(_0x43f583[_0x17b7('0x30')][_0x17b7('0x3c')]){_0x308d93['where']=_[_0x17b7('0x3f')](_0x308d93[_0x17b7('0x3a')],{'$or':_['map'](_0x308d93[_0x17b7('0x33')],function(_0x12603f){var _0x2c503a={};_0x2c503a[_0x12603f]={'$like':'%'+_0x43f583[_0x17b7('0x30')]['filter']+'%'};return _0x2c503a;})});}_0x308d93=_[_0x17b7('0x3f')]({},_0x308d93,_0x43f583[_0x17b7('0x40')]);return _0x540764[_0x17b7('0x56')](_0x308d93);}})[_0x17b7('0x22')](function(_0x42203d){if(_0x42203d){_0x43e8eb=_0x42203d[_0x17b7('0x35')];if(!_0x43f583[_0x17b7('0x30')]['hasOwnProperty'](_0x17b7('0x36'))){_0x308d93[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0x43f583[_0x17b7('0x30')]['limit']);_0x308d93['offset']=qs[_0x17b7('0x1b')](_0x43f583[_0x17b7('0x30')][_0x17b7('0x1b')]);}return _0x540764[_0x17b7('0x56')](_0x308d93);}})[_0x17b7('0x22')](function(_0x26e2d7){if(_0x26e2d7){return _0x26e2d7?{'count':_0x43e8eb,'rows':_0x26e2d7}:null;}})[_0x17b7('0x22')](respondWithResult(_0x100352,null))[_0x17b7('0x43')](handleError(_0x100352,null));};exports[_0x17b7('0x57')]=function(_0x399c81,_0x5b9537,_0x27c850){var _0x45be42={};var _0x336477={};var _0x4ed56d;var _0x2b823f;return db[_0x17b7('0x2b')][_0x17b7('0x55')]({'where':{'id':_0x399c81['params']['id']}})['then'](handleEntityNotFound(_0x5b9537,null))[_0x17b7('0x22')](function(_0x188038){if(_0x188038){_0x4ed56d=_0x188038;_0x336477[_0x17b7('0x2f')]=_[_0x17b7('0x31')](db[_0x17b7('0x53')][_0x17b7('0x2c')]);_0x336477[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0x399c81['query']);_0x336477[_0x17b7('0x32')]=_['intersection'](_0x336477['model'],_0x336477[_0x17b7('0x30')]);_0x45be42['attributes']=_['intersection'](_0x336477[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0x399c81['query'][_0x17b7('0x34')]));_0x45be42[_0x17b7('0x33')]=_0x45be42[_0x17b7('0x33')][_0x17b7('0x35')]?_0x45be42[_0x17b7('0x33')]:_0x336477[_0x17b7('0x2f')];_0x45be42[_0x17b7('0x38')]=qs['sort'](_0x399c81[_0x17b7('0x30')][_0x17b7('0x39')]);_0x45be42['where']=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0x399c81['query'],_0x336477[_0x17b7('0x32')]));if(_0x399c81[_0x17b7('0x30')][_0x17b7('0x3c')]){_0x45be42[_0x17b7('0x3a')]=_[_0x17b7('0x3f')](_0x45be42[_0x17b7('0x3a')],{'$or':_[_0x17b7('0x2a')](_0x45be42[_0x17b7('0x33')],function(_0x55e994){var _0x1633b2={};_0x1633b2[_0x55e994]={'$like':'%'+_0x399c81[_0x17b7('0x30')]['filter']+'%'};return _0x1633b2;})});}_0x45be42=_[_0x17b7('0x3f')]({},_0x45be42,_0x399c81[_0x17b7('0x40')]);return _0x4ed56d[_0x17b7('0x57')](_0x45be42);}})[_0x17b7('0x22')](function(_0x219588){if(_0x219588){_0x2b823f=_0x219588[_0x17b7('0x35')];if(!_0x399c81[_0x17b7('0x30')][_0x17b7('0x58')]('nolimit')){_0x45be42[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0x399c81[_0x17b7('0x30')]['limit']);_0x45be42[_0x17b7('0x1b')]=qs[_0x17b7('0x1b')](_0x399c81[_0x17b7('0x30')]['offset']);}return _0x4ed56d[_0x17b7('0x57')](_0x45be42);}})[_0x17b7('0x22')](function(_0x3f5fed){if(_0x3f5fed){return _0x3f5fed?{'count':_0x2b823f,'rows':_0x3f5fed}:null;}})['then'](respondWithResult(_0x5b9537,null))[_0x17b7('0x43')](handleError(_0x5b9537,null));};exports[_0x17b7('0x59')]=function(_0x470907,_0x40d3c9,_0x21d9a7){if(_0x470907['body']['id']){delete _0x470907['body']['id'];}return db['Trigger'][_0x17b7('0x48')]({'where':{'id':_0x470907['params']['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x40d3c9,null))[_0x17b7('0x22')](function(_0x36ed4e){if(_0x36ed4e){_0x470907['body'][_0x17b7('0x5a')]=_0x36ed4e['id'];return db[_0x17b7('0x5b')]['create'](_0x470907[_0x17b7('0x49')]);}})[_0x17b7('0x22')](respondWithResult(_0x40d3c9,null))['catch'](handleError(_0x40d3c9,null));};exports[_0x17b7('0x5c')]=function(_0xed0bb8,_0x4ae944,_0x1426e6){var _0x1103c9={};var _0x506f99={};var _0x31c9f8;var _0x13cee3;return db[_0x17b7('0x2b')]['findOne']({'where':{'id':_0xed0bb8[_0x17b7('0x45')]['id']}})[_0x17b7('0x22')](handleEntityNotFound(_0x4ae944,null))[_0x17b7('0x22')](function(_0x20f71e){if(_0x20f71e){_0x31c9f8=_0x20f71e;_0x506f99['model']=_[_0x17b7('0x31')](db[_0x17b7('0x5b')][_0x17b7('0x2c')]);_0x506f99[_0x17b7('0x30')]=_[_0x17b7('0x31')](_0xed0bb8['query']);_0x506f99['filters']=_[_0x17b7('0x46')](_0x506f99[_0x17b7('0x2f')],_0x506f99[_0x17b7('0x30')]);_0x1103c9[_0x17b7('0x33')]=_['intersection'](_0x506f99[_0x17b7('0x2f')],qs[_0x17b7('0x34')](_0xed0bb8[_0x17b7('0x30')][_0x17b7('0x34')]));_0x1103c9[_0x17b7('0x33')]=_0x1103c9[_0x17b7('0x33')][_0x17b7('0x35')]?_0x1103c9[_0x17b7('0x33')]:_0x506f99[_0x17b7('0x2f')];_0x1103c9[_0x17b7('0x38')]=qs['sort'](_0xed0bb8['query'][_0x17b7('0x39')]);_0x1103c9['where']=qs[_0x17b7('0x32')](_[_0x17b7('0x3b')](_0xed0bb8[_0x17b7('0x30')],_0x506f99[_0x17b7('0x32')]));if(_0xed0bb8[_0x17b7('0x30')]['filter']){_0x1103c9[_0x17b7('0x3a')]=_[_0x17b7('0x3f')](_0x1103c9['where'],{'$or':_[_0x17b7('0x2a')](_0x1103c9[_0x17b7('0x33')],function(_0x3c6d3a){var _0x57bead={};_0x57bead[_0x3c6d3a]={'$like':'%'+_0xed0bb8[_0x17b7('0x30')][_0x17b7('0x3c')]+'%'};return _0x57bead;})});}_0x1103c9=_[_0x17b7('0x3f')]({},_0x1103c9,_0xed0bb8[_0x17b7('0x40')]);return _0x31c9f8[_0x17b7('0x5c')](_0x1103c9);}})['then'](function(_0x426024){if(_0x426024){_0x13cee3=_0x426024['length'];if(!_0xed0bb8['query'][_0x17b7('0x58')]('nolimit')){_0x1103c9[_0x17b7('0x37')]=qs[_0x17b7('0x37')](_0xed0bb8[_0x17b7('0x30')][_0x17b7('0x37')]);_0x1103c9[_0x17b7('0x1b')]=qs[_0x17b7('0x1b')](_0xed0bb8['query'][_0x17b7('0x1b')]);}return _0x31c9f8[_0x17b7('0x5c')](_0x1103c9);}})[_0x17b7('0x22')](function(_0x14dc03){if(_0x14dc03){return _0x14dc03?{'count':_0x13cee3,'rows':_0x14dc03}:null;}})[_0x17b7('0x22')](respondWithResult(_0x4ae944,null))[_0x17b7('0x43')](handleError(_0x4ae944,null));}; \ No newline at end of file +var _0xac5e=['api','../../config/environment','sendStatus','status','json','count','offset','limit','set','then','destroy','Triggers','UserProfileResource','end','stack','name','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','TriggerAllId','Condition','addAnyCondition','findOne','order','getAllConditions','getAnyConditions','addAction','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xac5e,0x97));var _0xeac5=function(_0x3966be,_0x58e253){_0x3966be=_0x3966be-0x0;var _0x35ca31=_0xac5e[_0x3966be];return _0x35ca31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeac5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeac5('0x1'));var jsonpatch=require(_0xeac5('0x2'));var rp=require(_0xeac5('0x3'));var moment=require(_0xeac5('0x4'));var BPromise=require(_0xeac5('0x5'));var Mustache=require('mustache');var util=require(_0xeac5('0x6'));var path=require(_0xeac5('0x7'));var sox=require(_0xeac5('0x8'));var csv=require('to-csv');var ejs=require(_0xeac5('0x9'));var fs=require('fs');var _=require(_0xeac5('0xa'));var squel=require(_0xeac5('0xb'));var crypto=require(_0xeac5('0xc'));var jsforce=require(_0xeac5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeac5('0xe'));var querystring=require(_0xeac5('0xf'));var Papa=require('papaparse');var Redis=require(_0xeac5('0x10'));var authService=require(_0xeac5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeac5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeac5('0x13'));var utils=require('../../config/utils');var config=require(_0xeac5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a7a7,_0x105de1){_0x105de1=_0x105de1||0xcc;return function(_0x3894fd){if(_0x3894fd){return _0x59a7a7[_0xeac5('0x15')](_0x105de1);}return _0x59a7a7[_0xeac5('0x16')](_0x105de1)['end']();};}function respondWithResult(_0x3ef412,_0x594d8c){_0x594d8c=_0x594d8c||0xc8;return function(_0x4f813b){if(_0x4f813b){return _0x3ef412['status'](_0x594d8c)[_0xeac5('0x17')](_0x4f813b);}};}function respondWithFilteredResult(_0xb71d65,_0x35f969){return function(_0x5ada30){if(_0x5ada30){var _0x47eff4=_0x5ada30[_0xeac5('0x18')],_0x3baac6=_0x35f969[_0xeac5('0x19')],_0x23ede6=_0x35f969[_0xeac5('0x19')]+_0x35f969[_0xeac5('0x1a')],_0xd580e7;if(_0x23ede6>=_0x47eff4){_0x23ede6=_0x47eff4;_0xd580e7=0xc8;}else{_0xd580e7=0xce;}_0xb71d65[_0xeac5('0x16')](_0xd580e7);return _0xb71d65[_0xeac5('0x1b')]('Content-Range',_0x3baac6+'-'+_0x23ede6+'/'+_0x47eff4)[_0xeac5('0x17')](_0x5ada30);}return null;};}function patchUpdates(_0x447855){return function(_0x36f265){try{jsonpatch['apply'](_0x36f265,_0x447855,!![]);}catch(_0x2fe430){return BPromise['reject'](_0x2fe430);}return _0x36f265['save']();};}function saveUpdates(_0x2a906c,_0x3c620e){return function(_0x1c4996){if(_0x1c4996){return _0x1c4996['update'](_0x2a906c)[_0xeac5('0x1c')](function(_0x7c7df3){return _0x7c7df3;});}return null;};}function removeEntity(_0x286da6,_0x50bf28){return function(_0xedd700){if(_0xedd700){return _0xedd700[_0xeac5('0x1d')]()['then'](function(){var _0xe840f8=_0xedd700['get']({'plain':!![]});var _0x114b67=_0xeac5('0x1e');return db[_0xeac5('0x1f')][_0xeac5('0x1d')]({'where':{'type':_0x114b67,'resourceId':_0xe840f8['id']}})[_0xeac5('0x1c')](function(){return _0xedd700;});})[_0xeac5('0x1c')](function(){_0x286da6[_0xeac5('0x16')](0xcc)[_0xeac5('0x20')]();});}};}function handleEntityNotFound(_0x64ca50,_0x329f18){return function(_0x4b5238){if(!_0x4b5238){_0x64ca50[_0xeac5('0x15')](0x194);}return _0x4b5238;};}function handleError(_0xa61d16,_0xd53daa){_0xd53daa=_0xd53daa||0x1f4;return function(_0x263f2c){logger['error'](_0x263f2c[_0xeac5('0x21')]);if(_0x263f2c[_0xeac5('0x22')]){delete _0x263f2c[_0xeac5('0x22')];}_0xa61d16[_0xeac5('0x16')](_0xd53daa)['send'](_0x263f2c);};}exports['index']=function(_0xb52b00,_0x520306){var _0x19cfff={},_0x2f435d={},_0x4b07ee={'count':0x0,'rows':[]};var _0x327714=_[_0xeac5('0x23')](db[_0xeac5('0x24')][_0xeac5('0x25')],function(_0x584d18){return{'name':_0x584d18[_0xeac5('0x26')],'type':_0x584d18[_0xeac5('0x27')][_0xeac5('0x28')]};});_0x2f435d[_0xeac5('0x29')]=_['map'](_0x327714,_0xeac5('0x22'));_0x2f435d[_0xeac5('0x2a')]=_[_0xeac5('0x2b')](_0xb52b00['query']);_0x2f435d[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x2f435d[_0xeac5('0x29')],_0x2f435d[_0xeac5('0x2a')]);_0x19cfff[_0xeac5('0x2e')]=_[_0xeac5('0x2d')](_0x2f435d[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x2f')]));_0x19cfff[_0xeac5('0x2e')]=_0x19cfff[_0xeac5('0x2e')]['length']?_0x19cfff[_0xeac5('0x2e')]:_0x2f435d[_0xeac5('0x29')];if(!_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x30')](_0xeac5('0x31'))){_0x19cfff['limit']=qs[_0xeac5('0x1a')](_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x1a')]);_0x19cfff['offset']=qs['offset'](_0xb52b00['query'][_0xeac5('0x19')]);}_0x19cfff['order']=qs['sort'](_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x32')]);_0x19cfff[_0xeac5('0x33')]=qs['filters'](_[_0xeac5('0x34')](_0xb52b00['query'],_0x2f435d[_0xeac5('0x2c')]),_0x327714);if(_0xb52b00['query'][_0xeac5('0x35')]){_0x19cfff[_0xeac5('0x33')]=_[_0xeac5('0x36')](_0x19cfff[_0xeac5('0x33')],{'$or':_[_0xeac5('0x23')](_0x327714,function(_0x19d83b){if(_0x19d83b[_0xeac5('0x27')]!==_0xeac5('0x37')){var _0xd84471={};_0xd84471[_0x19d83b[_0xeac5('0x22')]]={'$like':'%'+_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x35')]+'%'};return _0xd84471;}})});}_0x19cfff=_['merge']({},_0x19cfff,_0xb52b00[_0xeac5('0x38')]);var _0x226d2a={'where':_0x19cfff[_0xeac5('0x33')]};return db[_0xeac5('0x24')][_0xeac5('0x18')](_0x226d2a)[_0xeac5('0x1c')](function(_0x5d31a1){_0x4b07ee[_0xeac5('0x18')]=_0x5d31a1;if(_0xb52b00[_0xeac5('0x2a')][_0xeac5('0x39')]){_0x19cfff[_0xeac5('0x3a')]=[{'all':!![]}];}return db[_0xeac5('0x24')]['findAll'](_0x19cfff);})[_0xeac5('0x1c')](function(_0x3ce894){_0x4b07ee[_0xeac5('0x3b')]=_0x3ce894;return _0x4b07ee;})[_0xeac5('0x1c')](respondWithFilteredResult(_0x520306,_0x19cfff))[_0xeac5('0x3c')](handleError(_0x520306,null));};exports[_0xeac5('0x3d')]=function(_0xa104f4,_0x35d036){var _0x503369={'raw':![],'where':{'id':_0xa104f4[_0xeac5('0x3e')]['id']}},_0x27fb69={};_0x27fb69[_0xeac5('0x29')]=_[_0xeac5('0x2b')](db[_0xeac5('0x24')]['rawAttributes']);_0x27fb69[_0xeac5('0x2a')]=_[_0xeac5('0x2b')](_0xa104f4[_0xeac5('0x2a')]);_0x27fb69[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x27fb69[_0xeac5('0x29')],_0x27fb69['query']);_0x503369[_0xeac5('0x2e')]=_[_0xeac5('0x2d')](_0x27fb69[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0xa104f4[_0xeac5('0x2a')]['fields']));_0x503369[_0xeac5('0x2e')]=_0x503369[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x503369[_0xeac5('0x2e')]:_0x27fb69[_0xeac5('0x29')];if(_0xa104f4[_0xeac5('0x2a')][_0xeac5('0x39')]){_0x503369['include']=[{'all':!![]}];}_0x503369=_['merge']({},_0x503369,_0xa104f4[_0xeac5('0x38')]);return db[_0xeac5('0x24')]['find'](_0x503369)['then'](handleEntityNotFound(_0x35d036,null))['then'](respondWithResult(_0x35d036,null))[_0xeac5('0x3c')](handleError(_0x35d036,null));};exports['create']=function(_0x2c2d63,_0x4d715f){return db['Trigger'][_0xeac5('0x40')](_0x2c2d63['body'],{})['then'](function(_0x31ae5d){var _0x157308=_0x2c2d63[_0xeac5('0x41')][_0xeac5('0x42')]({'plain':!![]});if(!_0x157308)throw new Error(_0xeac5('0x43'));if(_0x157308['role']===_0xeac5('0x41')){var _0x172bf4=_0x31ae5d[_0xeac5('0x42')]({'plain':!![]});var _0x153269=_0xeac5('0x1e');return db['UserProfileSection']['find']({'where':{'name':_0x153269,'userProfileId':_0x157308[_0xeac5('0x44')]},'raw':!![]})[_0xeac5('0x1c')](function(_0x1856b3){if(_0x1856b3&&_0x1856b3[_0xeac5('0x45')]===0x0){return db['UserProfileResource'][_0xeac5('0x40')]({'name':_0x172bf4[_0xeac5('0x22')],'resourceId':_0x172bf4['id'],'type':_0x1856b3[_0xeac5('0x22')],'sectionId':_0x1856b3['id']},{})[_0xeac5('0x1c')](function(){return _0x31ae5d;});}else{return _0x31ae5d;}})['catch'](function(_0x4613e0){logger[_0xeac5('0x46')](_0xeac5('0x47'),_0x4613e0);throw _0x4613e0;});}return _0x31ae5d;})['then'](respondWithResult(_0x4d715f,0xc9))['catch'](handleError(_0x4d715f,null));};exports[_0xeac5('0x48')]=function(_0x5175a0,_0x3d242a){if(_0x5175a0[_0xeac5('0x49')]['id']){delete _0x5175a0[_0xeac5('0x49')]['id'];}return db[_0xeac5('0x24')]['find']({'where':{'id':_0x5175a0[_0xeac5('0x3e')]['id']}})[_0xeac5('0x1c')](handleEntityNotFound(_0x3d242a,null))[_0xeac5('0x1c')](saveUpdates(_0x5175a0['body'],null))['then'](respondWithResult(_0x3d242a,null))[_0xeac5('0x3c')](handleError(_0x3d242a,null));};exports[_0xeac5('0x1d')]=function(_0x21b802,_0x5dac3c){return db['Trigger'][_0xeac5('0x4a')]({'where':{'id':_0x21b802[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5dac3c,null))[_0xeac5('0x1c')](removeEntity(_0x5dac3c,null))[_0xeac5('0x3c')](handleError(_0x5dac3c,null));};exports['addAllCondition']=function(_0x102ec3,_0xae7d76,_0x7d8b9b){if(_0x102ec3[_0xeac5('0x49')]['id']){delete _0x102ec3[_0xeac5('0x49')]['id'];}return db[_0xeac5('0x24')]['find']({'where':{'id':_0x102ec3[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0xae7d76,null))[_0xeac5('0x1c')](function(_0x2aae17){if(_0x2aae17){_0x102ec3[_0xeac5('0x49')][_0xeac5('0x4b')]=_0x2aae17['id'];return db[_0xeac5('0x4c')][_0xeac5('0x40')](_0x102ec3[_0xeac5('0x49')]);}})[_0xeac5('0x1c')](respondWithResult(_0xae7d76,null))[_0xeac5('0x3c')](handleError(_0xae7d76,null));};exports[_0xeac5('0x4d')]=function(_0x42279a,_0x27bc42,_0x23db5d){if(_0x42279a[_0xeac5('0x49')]['id']){delete _0x42279a['body']['id'];}return db[_0xeac5('0x24')][_0xeac5('0x4a')]({'where':{'id':_0x42279a[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x27bc42,null))[_0xeac5('0x1c')](function(_0xc70a1e){if(_0xc70a1e){_0x42279a[_0xeac5('0x49')]['TriggerAnyId']=_0xc70a1e['id'];return db['Condition'][_0xeac5('0x40')](_0x42279a[_0xeac5('0x49')]);}})[_0xeac5('0x1c')](respondWithResult(_0x27bc42,null))['catch'](handleError(_0x27bc42,null));};exports['getAllConditions']=function(_0x48049c,_0x4940d1,_0x43fdf8){var _0x491947={};var _0x4cdb1c={};var _0x2b23a9;var _0x5493b2;return db[_0xeac5('0x24')][_0xeac5('0x4e')]({'where':{'id':_0x48049c[_0xeac5('0x3e')]['id']}})[_0xeac5('0x1c')](handleEntityNotFound(_0x4940d1,null))['then'](function(_0x40da6b){if(_0x40da6b){_0x2b23a9=_0x40da6b;_0x4cdb1c['model']=_[_0xeac5('0x2b')](db['Condition'][_0xeac5('0x25')]);_0x4cdb1c[_0xeac5('0x2a')]=_[_0xeac5('0x2b')](_0x48049c['query']);_0x4cdb1c[_0xeac5('0x2c')]=_['intersection'](_0x4cdb1c[_0xeac5('0x29')],_0x4cdb1c[_0xeac5('0x2a')]);_0x491947[_0xeac5('0x2e')]=_['intersection'](_0x4cdb1c[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0x48049c['query'][_0xeac5('0x2f')]));_0x491947[_0xeac5('0x2e')]=_0x491947[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x491947[_0xeac5('0x2e')]:_0x4cdb1c[_0xeac5('0x29')];_0x491947[_0xeac5('0x4f')]=qs[_0xeac5('0x32')](_0x48049c['query'][_0xeac5('0x32')]);_0x491947['where']=qs['filters'](_[_0xeac5('0x34')](_0x48049c['query'],_0x4cdb1c[_0xeac5('0x2c')]));if(_0x48049c[_0xeac5('0x2a')][_0xeac5('0x35')]){_0x491947['where']=_[_0xeac5('0x36')](_0x491947['where'],{'$or':_[_0xeac5('0x23')](_0x491947[_0xeac5('0x2e')],function(_0x2fc853){var _0x14b527={};_0x14b527[_0x2fc853]={'$like':'%'+_0x48049c['query'][_0xeac5('0x35')]+'%'};return _0x14b527;})});}_0x491947=_['merge']({},_0x491947,_0x48049c[_0xeac5('0x38')]);return _0x2b23a9[_0xeac5('0x50')](_0x491947);}})[_0xeac5('0x1c')](function(_0x333244){if(_0x333244){_0x5493b2=_0x333244[_0xeac5('0x3f')];if(!_0x48049c[_0xeac5('0x2a')]['hasOwnProperty']('nolimit')){_0x491947['limit']=qs[_0xeac5('0x1a')](_0x48049c['query'][_0xeac5('0x1a')]);_0x491947[_0xeac5('0x19')]=qs['offset'](_0x48049c['query'][_0xeac5('0x19')]);}return _0x2b23a9[_0xeac5('0x50')](_0x491947);}})[_0xeac5('0x1c')](function(_0xa63cc1){if(_0xa63cc1){return _0xa63cc1?{'count':_0x5493b2,'rows':_0xa63cc1}:null;}})[_0xeac5('0x1c')](respondWithResult(_0x4940d1,null))[_0xeac5('0x3c')](handleError(_0x4940d1,null));};exports[_0xeac5('0x51')]=function(_0x9f47c9,_0x3e3a8d,_0x5bf3f6){var _0x1cec6e={};var _0x32f3de={};var _0x217ef1;var _0x42fcbc;return db[_0xeac5('0x24')][_0xeac5('0x4e')]({'where':{'id':_0x9f47c9[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e3a8d,null))[_0xeac5('0x1c')](function(_0x13524f){if(_0x13524f){_0x217ef1=_0x13524f;_0x32f3de[_0xeac5('0x29')]=_['keys'](db['Condition'][_0xeac5('0x25')]);_0x32f3de['query']=_['keys'](_0x9f47c9[_0xeac5('0x2a')]);_0x32f3de[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x32f3de[_0xeac5('0x29')],_0x32f3de[_0xeac5('0x2a')]);_0x1cec6e['attributes']=_[_0xeac5('0x2d')](_0x32f3de[_0xeac5('0x29')],qs[_0xeac5('0x2f')](_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x2f')]));_0x1cec6e[_0xeac5('0x2e')]=_0x1cec6e[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x1cec6e[_0xeac5('0x2e')]:_0x32f3de[_0xeac5('0x29')];_0x1cec6e[_0xeac5('0x4f')]=qs[_0xeac5('0x32')](_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x32')]);_0x1cec6e[_0xeac5('0x33')]=qs[_0xeac5('0x2c')](_['pick'](_0x9f47c9[_0xeac5('0x2a')],_0x32f3de['filters']));if(_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x35')]){_0x1cec6e['where']=_[_0xeac5('0x36')](_0x1cec6e[_0xeac5('0x33')],{'$or':_[_0xeac5('0x23')](_0x1cec6e[_0xeac5('0x2e')],function(_0x2aadaa){var _0x232fca={};_0x232fca[_0x2aadaa]={'$like':'%'+_0x9f47c9[_0xeac5('0x2a')][_0xeac5('0x35')]+'%'};return _0x232fca;})});}_0x1cec6e=_['merge']({},_0x1cec6e,_0x9f47c9[_0xeac5('0x38')]);return _0x217ef1[_0xeac5('0x51')](_0x1cec6e);}})[_0xeac5('0x1c')](function(_0xd6481e){if(_0xd6481e){_0x42fcbc=_0xd6481e['length'];if(!_0x9f47c9['query'][_0xeac5('0x30')](_0xeac5('0x31'))){_0x1cec6e['limit']=qs[_0xeac5('0x1a')](_0x9f47c9[_0xeac5('0x2a')]['limit']);_0x1cec6e[_0xeac5('0x19')]=qs[_0xeac5('0x19')](_0x9f47c9['query'][_0xeac5('0x19')]);}return _0x217ef1['getAnyConditions'](_0x1cec6e);}})[_0xeac5('0x1c')](function(_0x49c9f5){if(_0x49c9f5){return _0x49c9f5?{'count':_0x42fcbc,'rows':_0x49c9f5}:null;}})['then'](respondWithResult(_0x3e3a8d,null))[_0xeac5('0x3c')](handleError(_0x3e3a8d,null));};exports[_0xeac5('0x52')]=function(_0xef6fc5,_0xe4f9ab,_0x3d646c){if(_0xef6fc5[_0xeac5('0x49')]['id']){delete _0xef6fc5['body']['id'];}return db[_0xeac5('0x24')]['find']({'where':{'id':_0xef6fc5[_0xeac5('0x3e')]['id']}})[_0xeac5('0x1c')](handleEntityNotFound(_0xe4f9ab,null))[_0xeac5('0x1c')](function(_0x161f42){if(_0x161f42){_0xef6fc5['body']['TriggerId']=_0x161f42['id'];return db[_0xeac5('0x53')][_0xeac5('0x40')](_0xef6fc5[_0xeac5('0x49')]);}})[_0xeac5('0x1c')](respondWithResult(_0xe4f9ab,null))[_0xeac5('0x3c')](handleError(_0xe4f9ab,null));};exports[_0xeac5('0x54')]=function(_0x58fa19,_0x2c23a8,_0x3af377){var _0x22aeb2={};var _0x43d591={};var _0x1b8b14;var _0x4d8da4;return db[_0xeac5('0x24')]['findOne']({'where':{'id':_0x58fa19[_0xeac5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2c23a8,null))['then'](function(_0x254f60){if(_0x254f60){_0x1b8b14=_0x254f60;_0x43d591['model']=_[_0xeac5('0x2b')](db[_0xeac5('0x53')][_0xeac5('0x25')]);_0x43d591['query']=_[_0xeac5('0x2b')](_0x58fa19['query']);_0x43d591[_0xeac5('0x2c')]=_[_0xeac5('0x2d')](_0x43d591['model'],_0x43d591[_0xeac5('0x2a')]);_0x22aeb2[_0xeac5('0x2e')]=_['intersection'](_0x43d591[_0xeac5('0x29')],qs['fields'](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x2f')]));_0x22aeb2[_0xeac5('0x2e')]=_0x22aeb2[_0xeac5('0x2e')][_0xeac5('0x3f')]?_0x22aeb2['attributes']:_0x43d591[_0xeac5('0x29')];_0x22aeb2[_0xeac5('0x4f')]=qs[_0xeac5('0x32')](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x32')]);_0x22aeb2['where']=qs['filters'](_[_0xeac5('0x34')](_0x58fa19['query'],_0x43d591[_0xeac5('0x2c')]));if(_0x58fa19['query'][_0xeac5('0x35')]){_0x22aeb2[_0xeac5('0x33')]=_[_0xeac5('0x36')](_0x22aeb2[_0xeac5('0x33')],{'$or':_[_0xeac5('0x23')](_0x22aeb2['attributes'],function(_0x219dfe){var _0x43a73d={};_0x43a73d[_0x219dfe]={'$like':'%'+_0x58fa19[_0xeac5('0x2a')]['filter']+'%'};return _0x43a73d;})});}_0x22aeb2=_[_0xeac5('0x36')]({},_0x22aeb2,_0x58fa19[_0xeac5('0x38')]);return _0x1b8b14[_0xeac5('0x54')](_0x22aeb2);}})[_0xeac5('0x1c')](function(_0x567eaf){if(_0x567eaf){_0x4d8da4=_0x567eaf[_0xeac5('0x3f')];if(!_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x30')](_0xeac5('0x31'))){_0x22aeb2[_0xeac5('0x1a')]=qs['limit'](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x1a')]);_0x22aeb2[_0xeac5('0x19')]=qs[_0xeac5('0x19')](_0x58fa19[_0xeac5('0x2a')][_0xeac5('0x19')]);}return _0x1b8b14[_0xeac5('0x54')](_0x22aeb2);}})[_0xeac5('0x1c')](function(_0x5db5f2){if(_0x5db5f2){return _0x5db5f2?{'count':_0x4d8da4,'rows':_0x5db5f2}:null;}})[_0xeac5('0x1c')](respondWithResult(_0x2c23a8,null))[_0xeac5('0x3c')](handleError(_0x2c23a8,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 085f6e4..8a27a23 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 _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x28efa0,_0x481587){var _0x110f72=function(_0x4b11f7){while(--_0x4b11f7){_0x28efa0['push'](_0x28efa0['shift']());}};_0x110f72(++_0x481587);}(_0x2ef3,0xba));var _0x32ef=function(_0x3debfe,_0x3c4121){_0x3debfe=_0x3debfe-0x0;var _0x595086=_0x2ef3[_0x3debfe];return _0x595086;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index d6ff732..377061c 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 _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetTrigger','catch','ShowTrigger'];(function(_0x15876c,_0x510dd4){var _0x39d91b=function(_0x2a692c){while(--_0x2a692c){_0x15876c['push'](_0x15876c['shift']());}};_0x39d91b(++_0x510dd4);}(_0x087b,0x11a));var _0xb087=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x087b[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('Trigger,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetTrigger']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['Trigger'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['Trigger'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowTrigger',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file +var _0x4213=['then','ShowTrigger','find','where','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trigger,\x20%s,\x20%s','info','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x3dbae4,_0x2a0a5a){var _0x2cffe6=function(_0x49650c){while(--_0x49650c){_0x3dbae4['push'](_0x3dbae4['shift']());}};_0x2cffe6(++_0x2a0a5a);}(_0x4213,0x77));var _0x3421=function(_0xeb888d,_0xb9ed5){_0xeb888d=_0xeb888d-0x0;var _0x106329=_0x4213[_0xeb888d];return _0x106329;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5469d8,_0x50e464,_0x1b152f){return new BPromise(function(_0x130625,_0x1cf6a0){return client[_0x3421('0xc')](_0x5469d8,_0x1b152f)['then'](function(_0x1f20cf){logger['info']('Trigger,\x20%s,\x20%s',_0x50e464,_0x3421('0xd'));logger['debug'](_0x3421('0xe'),_0x50e464,_0x3421('0xd'),JSON[_0x3421('0xf')](_0x1f20cf));if(_0x1f20cf[_0x3421('0x10')]){if(_0x1f20cf[_0x3421('0x10')][_0x3421('0x11')]===0x1f4){logger[_0x3421('0x10')]('Trigger,\x20%s,\x20%s',_0x50e464,_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);return _0x1cf6a0(_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);}logger[_0x3421('0x10')](_0x3421('0x13'),_0x50e464,_0x1f20cf[_0x3421('0x10')]['message']);return _0x130625(_0x1f20cf[_0x3421('0x10')]['message']);}else{logger[_0x3421('0x14')](_0x3421('0x13'),_0x50e464,'request\x20sent');_0x130625(_0x1f20cf[_0x3421('0x15')]['message']);}})[_0x3421('0x16')](function(_0x23694b){logger['error'](_0x3421('0x13'),_0x50e464,_0x23694b);_0x1cf6a0(_0x23694b);});});}exports[_0x3421('0x17')]=function(_0x130d3c){var _0x104cc5=this;return new Promise(function(_0x18acc1,_0x200fdd){return db[_0x3421('0x18')][_0x3421('0x19')]({'raw':_0x130d3c[_0x3421('0x1a')]?_0x130d3c[_0x3421('0x1a')][_0x3421('0x1b')]===undefined?!![]:![]:!![],'where':_0x130d3c['options']?_0x130d3c[_0x3421('0x1a')]['where']||null:null,'attributes':_0x130d3c['options']?_0x130d3c['options'][_0x3421('0x1c')]||null:null,'limit':_0x130d3c[_0x3421('0x1a')]?_0x130d3c[_0x3421('0x1a')][_0x3421('0x1d')]||null:null,'include':_0x130d3c[_0x3421('0x1a')]?_0x130d3c[_0x3421('0x1a')][_0x3421('0x1e')]?_[_0x3421('0x1f')](_0x130d3c[_0x3421('0x1a')][_0x3421('0x1e')],function(_0x48fb3d){return{'model':db[_0x48fb3d['model']],'as':_0x48fb3d['as'],'attributes':_0x48fb3d['attributes'],'include':_0x48fb3d[_0x3421('0x1e')]?_[_0x3421('0x1f')](_0x48fb3d[_0x3421('0x1e')],function(_0x5bc28a){return{'model':db[_0x5bc28a['model']],'as':_0x5bc28a['as'],'attributes':_0x5bc28a[_0x3421('0x1c')],'include':_0x5bc28a['include']?_[_0x3421('0x1f')](_0x5bc28a['include'],function(_0x15e73c){return{'model':db[_0x15e73c[_0x3421('0x20')]],'as':_0x15e73c['as'],'attributes':_0x15e73c[_0x3421('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3421('0x21')](function(_0x186885){logger['info'](_0x3421('0x17'),_0x130d3c);logger['debug']('GetTrigger',_0x130d3c,JSON[_0x3421('0xf')](_0x186885));_0x18acc1(_0x186885);})['catch'](function(_0x5074a2){logger[_0x3421('0x10')]('GetTrigger',_0x5074a2[_0x3421('0x12')],_0x130d3c);_0x200fdd(_0x104cc5['error'](0x1f4,_0x5074a2[_0x3421('0x12')]));});});};exports[_0x3421('0x22')]=function(_0x48d828){var _0x3f7c0b=this;return new Promise(function(_0x3bc7c1,_0x420349){return db['Trigger'][_0x3421('0x23')]({'raw':_0x48d828['options']?_0x48d828[_0x3421('0x1a')][_0x3421('0x1b')]===undefined?!![]:![]:!![],'where':_0x48d828[_0x3421('0x1a')]?_0x48d828[_0x3421('0x1a')][_0x3421('0x24')]||null:null,'attributes':_0x48d828[_0x3421('0x1a')]?_0x48d828[_0x3421('0x1a')][_0x3421('0x1c')]||null:null,'include':_0x48d828[_0x3421('0x1a')]?_0x48d828[_0x3421('0x1a')]['include']?_['map'](_0x48d828[_0x3421('0x1a')][_0x3421('0x1e')],function(_0x5218cd){return{'model':db[_0x5218cd[_0x3421('0x20')]],'as':_0x5218cd['as'],'attributes':_0x5218cd[_0x3421('0x1c')],'include':_0x5218cd[_0x3421('0x1e')]?_[_0x3421('0x1f')](_0x5218cd[_0x3421('0x1e')],function(_0x4a33f8){return{'model':db[_0x4a33f8[_0x3421('0x20')]],'as':_0x4a33f8['as'],'attributes':_0x4a33f8[_0x3421('0x1c')],'include':_0x4a33f8[_0x3421('0x1e')]?_['map'](_0x4a33f8[_0x3421('0x1e')],function(_0x4ba1b9){return{'model':db[_0x4ba1b9[_0x3421('0x20')]],'as':_0x4ba1b9['as'],'attributes':_0x4ba1b9[_0x3421('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3421('0x21')](function(_0xcda5ee){logger[_0x3421('0x14')](_0x3421('0x22'),_0x48d828);logger[_0x3421('0x25')]('ShowTrigger',_0x48d828,JSON['stringify'](_0xcda5ee));_0x3bc7c1(_0xcda5ee);})['catch'](function(_0x4696f3){logger['error']('ShowTrigger',_0x4696f3[_0x3421('0x12')],_0x48d828);_0x420349(_0x3f7c0b['error'](0x1f4,_0x4696f3[_0x3421('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dcfacac..edaf44e 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 _0x2d17=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','get','/:id','show','post','/:id/clone','clone','put','update','delete'];(function(_0x37cc5b,_0x282dac){var _0x16bcc5=function(_0x2fd502){while(--_0x2fd502){_0x37cc5b['push'](_0x37cc5b['shift']());}};_0x16bcc5(++_0x282dac);}(_0x2d17,0x17e));var _0x72d1=function(_0x5ecd93,_0x18ca38){_0x5ecd93=_0x5ecd93-0x0;var _0xa72cf6=_0x2d17[_0x5ecd93];return _0xa72cf6;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0xb')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xb')]('/',auth[_0x72d1('0x7')](),controller['create']);router[_0x72d1('0xe')](_0x72d1('0x9'),auth[_0x72d1('0x7')](),controller[_0x72d1('0xf')]);router[_0x72d1('0x10')](_0x72d1('0x9'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x11')]);module[_0x72d1('0x12')]=router; \ No newline at end of file +var _0xd2ea=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0xd2ea,0x15f));var _0xad2e=function(_0x305ba2,_0x4e9ffe){_0x305ba2=_0x305ba2-0x0;var _0xb79482=_0xd2ea[_0x305ba2];return _0xb79482;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['post'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['clone']);router[_0xad2e('0xf')]('/',auth['isAuthenticated'](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller['update']);router[_0xad2e('0x12')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x13')]);module[_0xad2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2074c33..a250e62 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 _0x113d=['auto','yes','update','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband'];(function(_0x239ebd,_0x1ce664){var _0x25c9c7=function(_0x133bdd){while(--_0x133bdd){_0x239ebd['push'](_0x239ebd['shift']());}};_0x25c9c7(++_0x1ce664);}(_0x113d,0xea));var _0xd113=function(_0x25b244,_0x165d6b){_0x25b244=_0x25b244-0x0;var _0xcc202=_0x113d[_0x25b244];return _0xcc202;};'use strict';var Sequelize=require(_0xd113('0x0'));module[_0xd113('0x1')]={'name':{'type':Sequelize[_0xd113('0x2')],'allowNull':![],'unique':_0xd113('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xd113('0x4'),_0xd113('0x5'),_0xd113('0x6')),'allowNull':![],'defaultValue':_0xd113('0x4')},'context':{'type':Sequelize[_0xd113('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x8'),'ALLOWED_PASSED_SCREEN',_0xd113('0x9'),_0xd113('0xa'),'PROHIB_NOT_SCREENED',_0xd113('0xb'),_0xd113('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xd113('0x2')]},'permit':{'type':Sequelize[_0xd113('0x2')]},'secret':{'type':Sequelize[_0xd113('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd113('0x2')]},'transport':{'type':Sequelize[_0xd113('0x2')],'defaultValue':'udp','set':function(_0x5b04e8){this['setDataValue'](_0xd113('0xd'),_0x5b04e8?_0x5b04e8[_0xd113('0xe')](','):null);},'get':function(){return this[_0xd113('0xf')]('transport')?this[_0xd113('0xf')](_0xd113('0xd'))['split'](','):null;},'comment':_0xd113('0x10')},'dtmfmode':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x11'),_0xd113('0x12'),_0xd113('0x13'),_0xd113('0x14'),_0xd113('0x15')),'defaultValue':_0xd113('0x11')},'directmedia':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no','nonat',_0xd113('0x17'),_0xd113('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd113('0x2')]},'nat':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x19'),'set':function(_0x290ab0){this['setDataValue'](_0xd113('0x1a'),_0x290ab0?_0x290ab0[_0xd113('0xe')](','):null);},'get':function(){return this[_0xd113('0xf')](_0xd113('0x1a'))?this[_0xd113('0xf')]('nat')[_0xd113('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd113('0x2')]},'namedcallgroup':{'type':Sequelize[_0xd113('0x2')]},'pickupgroup':{'type':Sequelize[_0xd113('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd113('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd113('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x1c')},'allow':{'type':Sequelize[_0xd113('0x2')],'allowNull':![],'defaultValue':_0xd113('0x1d'),'set':function(_0x429fa8){this['setDataValue'](_0xd113('0x1e'),_0x429fa8?_0x429fa8[_0xd113('0xe')](';'):_0xd113('0x1d'));},'get':function(){return this['getDataValue'](_0xd113('0x1e'))?this[_0xd113('0xf')](_0xd113('0x1e'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'insecure':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x1f'),'set':function(_0x378dcb){this[_0xd113('0x20')](_0xd113('0x21'),_0x378dcb?_0x378dcb[_0xd113('0xe')](','):null);},'get':function(){return this[_0xd113('0xf')](_0xd113('0x21'))?this[_0xd113('0xf')](_0xd113('0x21'))[_0xd113('0x1b')](','):null;},'comment':_0xd113('0x22')},'trustrpid':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no',_0xd113('0x23'))},'promiscredir':{'type':Sequelize[_0xd113('0x7')]('yes','no')},'useclientcode':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'accountcode':{'type':Sequelize[_0xd113('0x24')](0xb)},'setvar':{'type':Sequelize[_0xd113('0x2')]},'callerid':{'type':Sequelize[_0xd113('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd113('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':_0xd113('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd113('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xd113('0x2')]},'template':{'type':Sequelize[_0xd113('0x2')]},'videosupport':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no',_0xd113('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd113('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x26'),_0xd113('0x27'),_0xd113('0x28'))},'session_expires':{'type':Sequelize[_0xd113('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x29'),_0xd113('0x2a')),'defaultValue':_0xd113('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xd113('0x2')]},'fromdomain':{'type':Sequelize[_0xd113('0x2')]},'fromuser':{'type':Sequelize[_0xd113('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':_0xd113('0x16')},'keepalive':{'type':Sequelize[_0xd113('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xd113('0x2')]},'defaultuser':{'type':Sequelize[_0xd113('0x2')]},'rtptimeout':{'type':Sequelize[_0xd113('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd113('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd113('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no',_0xd113('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd113('0x2')]},'callbackextension':{'type':Sequelize[_0xd113('0x2')]},'timert1':{'type':Sequelize[_0xd113('0x24')](0xb)},'timerb':{'type':Sequelize[_0xd113('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd113('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xd113('0x2')]},'contactdeny':{'type':Sequelize[_0xd113('0x2')]},'contactacl':{'type':Sequelize[_0xd113('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xd113('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xd113('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'force_avp':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'icesupport':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xd113('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xd113('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd113('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xd113('0x2')]},'dtlssetup':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x2d'),_0xd113('0x2e'),_0xd113('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd113('0x2')]},'recordofffeature':{'type':Sequelize[_0xd113('0x2')]},'call_limit':{'type':Sequelize[_0xd113('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xd113('0x7')](_0xd113('0x16'),'no')},'vmexten':{'type':Sequelize[_0xd113('0x2')]},'mohinterpret':{'type':Sequelize[_0xd113('0x2')]},'mohsuggest':{'type':Sequelize[_0xd113('0x2')]},'parkinglot':{'type':Sequelize[_0xd113('0x2')]},'description':{'type':Sequelize[_0xd113('0x2')]},'host':{'type':Sequelize[_0xd113('0x2')],'defaultValue':_0xd113('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xd113('0x16'),'no','nonat',_0xd113('0x17'),_0xd113('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd113('0x2')]},'otherFields':{'type':Sequelize[_0xd113('0x2')]},'active':{'type':Sequelize[_0xd113('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd113('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2522=['ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name'];(function(_0x56fcfe,_0x543a44){var _0x4759f9=function(_0x5c01ec){while(--_0x5c01ec){_0x56fcfe['push'](_0x56fcfe['shift']());}};_0x4759f9(++_0x543a44);}(_0x2522,0x15b));var _0x2252=function(_0x5abf93,_0x3750cd){_0x5abf93=_0x5abf93-0x0;var _0x1a59cf=_0x2522[_0x5abf93];return _0x1a59cf;};'use strict';var Sequelize=require(_0x2252('0x0'));module['exports']={'name':{'type':Sequelize[_0x2252('0x1')],'allowNull':![],'unique':_0x2252('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x4'),'user','peer'),'allowNull':![],'defaultValue':_0x2252('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2252('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x2252('0x6'),_0x2252('0x7'),_0x2252('0x8'),_0x2252('0x9'),_0x2252('0xa'),_0x2252('0xb'),_0x2252('0xc'),_0x2252('0xd'))},'deny':{'type':Sequelize[_0x2252('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'udp','set':function(_0x2fb95f){this[_0x2252('0xe')](_0x2252('0xf'),_0x2fb95f?_0x2fb95f['join'](','):null);},'get':function(){return this[_0x2252('0x10')](_0x2252('0xf'))?this['getDataValue'](_0x2252('0xf'))[_0x2252('0x11')](','):null;},'comment':_0x2252('0x12')},'dtmfmode':{'type':Sequelize[_0x2252('0x3')]('rfc2833',_0x2252('0x13'),_0x2252('0x14'),_0x2252('0x15'),_0x2252('0x16')),'defaultValue':_0x2252('0x17')},'directmedia':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no',_0x2252('0x19'),_0x2252('0x1a'),_0x2252('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2252('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2252('0x1')],'defaultValue':_0x2252('0x1c'),'set':function(_0x2ae7f3){this[_0x2252('0xe')](_0x2252('0x1d'),_0x2ae7f3?_0x2ae7f3[_0x2252('0x1e')](','):null);},'get':function(){return this[_0x2252('0x10')](_0x2252('0x1d'))?this[_0x2252('0x10')]('nat')[_0x2252('0x11')](','):null;},'comment':_0x2252('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2252('0x1')]},'pickupgroup':{'type':Sequelize[_0x2252('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2252('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2252('0x1')],'defaultValue':_0x2252('0x20')},'allow':{'type':Sequelize[_0x2252('0x1')],'allowNull':![],'defaultValue':_0x2252('0x21'),'set':function(_0x262db0){this[_0x2252('0xe')](_0x2252('0x22'),_0x262db0?_0x262db0['join'](';'):_0x2252('0x21'));},'get':function(){return this[_0x2252('0x10')](_0x2252('0x22'))?this[_0x2252('0x10')](_0x2252('0x22'))[_0x2252('0x11')](';'):null;},'comment':_0x2252('0x23')},'autoframing':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'insecure':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'port,invite','set':function(_0x5b2971){this['setDataValue']('insecure',_0x5b2971?_0x5b2971[_0x2252('0x1e')](','):null);},'get':function(){return this[_0x2252('0x10')](_0x2252('0x24'))?this[_0x2252('0x10')]('insecure')[_0x2252('0x11')](','):null;},'comment':_0x2252('0x25')},'trustrpid':{'type':Sequelize[_0x2252('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x2252('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x2252('0x26')](0xb)},'setvar':{'type':Sequelize[_0x2252('0x1')]},'callerid':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':_0x2252('0x18')},'busylevel':{'type':Sequelize[_0x2252('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2252('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x2252('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no',_0x2252('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2252('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'mailbox':{'type':Sequelize[_0x2252('0x1')]},'session_timers':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x28'),_0x2252('0x29'),_0x2252('0x2a'))},'session_expires':{'type':Sequelize[_0x2252('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x2b'),'uas'),'defaultValue':_0x2252('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x2252('0x1')]},'regexten':{'type':Sequelize[_0x2252('0x1')]},'fromdomain':{'type':Sequelize[_0x2252('0x1')]},'fromuser':{'type':Sequelize[_0x2252('0x1')]},'port':{'type':Sequelize[_0x2252('0x26')](0x5)},'qualify':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2252('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2252('0x1')]},'rtptimeout':{'type':Sequelize[_0x2252('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2252('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2252('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2252('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2252('0x26')](0xb)},'timerb':{'type':Sequelize[_0x2252('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2252('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x2252('0x1')]},'contactdeny':{'type':Sequelize[_0x2252('0x1')]},'contactacl':{'type':Sequelize[_0x2252('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2252('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2252('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x2252('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'force_avp':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no','fingerprint',_0x2252('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x2252('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2252('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2252('0x1')]},'dtlscapath':{'type':Sequelize[_0x2252('0x1')]},'dtlssetup':{'type':Sequelize[_0x2252('0x3')]('active',_0x2252('0x2e'),_0x2252('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2252('0x1')]},'usereqphone':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2252('0x1')]},'call_limit':{'type':Sequelize[_0x2252('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2252('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2252('0x1')]},'mohsuggest':{'type':Sequelize[_0x2252('0x1')]},'parkinglot':{'type':Sequelize[_0x2252('0x1')]},'description':{'type':Sequelize[_0x2252('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2252('0x3')](_0x2252('0x18'),'no',_0x2252('0x19'),_0x2252('0x1a'),_0x2252('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2252('0x1')]},'otherFields':{'type':Sequelize[_0x2252('0x1')]},'active':{'type':Sequelize[_0x2252('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2252('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 1ac5050..5697caf 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 _0x0bb4=['/etc/asterisk/sip_xcally_trunks.conf','destroy','Reload','chan_sip.so','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','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','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','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','apply','reject','save','update','Trunks','UserProfileResource','stack','name','send','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','merge','options','includeAll','include','findAll','find','clone','params','createdAt','updatedAt','body','omit','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','render','writeFileSync','registry','userProfileId','server/files/templates/registry.ejs'];(function(_0x597cb7,_0x448d77){var _0x23e80a=function(_0x4b2048){while(--_0x4b2048){_0x597cb7['push'](_0x597cb7['shift']());}};_0x23e80a(++_0x448d77);}(_0x0bb4,0x77));var _0x40bb=function(_0x3befe7,_0x417c57){_0x3befe7=_0x3befe7-0x0;var _0x22dcdb=_0x0bb4[_0x3befe7];return _0x22dcdb;};'use strict';var pdf=require(_0x40bb('0x0'));var emlformat=require(_0x40bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x40bb('0x2'));var jsonpatch=require(_0x40bb('0x3'));var rp=require(_0x40bb('0x4'));var moment=require(_0x40bb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40bb('0x6'));var util=require('util');var path=require(_0x40bb('0x7'));var sox=require('sox');var csv=require(_0x40bb('0x8'));var ejs=require(_0x40bb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40bb('0xa'));var crypto=require(_0x40bb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40bb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x40bb('0xd'));var Papa=require(_0x40bb('0xe'));var Redis=require(_0x40bb('0xf'));var authService=require(_0x40bb('0x10'));var qs=require(_0x40bb('0x11'));var as=require(_0x40bb('0x12'));var hardwareService=require(_0x40bb('0x13'));var logger=require(_0x40bb('0x14'))(_0x40bb('0x15'));var utils=require(_0x40bb('0x16'));var config=require(_0x40bb('0x17'));var db=require(_0x40bb('0x18'))['db'];var jayson=require(_0x40bb('0x19'));var client=jayson[_0x40bb('0x1a')][_0x40bb('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2a3ae5,_0x713bae,_0x4c98ae){if(_0x4c98ae){var _0x55cac9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55cac9[_0x40bb('0x1c')](_0x713bae)){return _0x2a3ae5;}else{throw new db[(_0x40bb('0x1d'))][(_0x40bb('0x1e'))](_0x40bb('0x1f'));}}else{return _0x2a3ae5;}}function respondWithRpcPromise(_0x2d6121,_0x99c52d,_0x207c7e,_0x3c5751){return new BPromise(function(_0x4a177c,_0x3b28a2){var _0x3edc83=_0x3c5751||client;return _0x3edc83[_0x40bb('0x20')](_0x2d6121,_0x207c7e)[_0x40bb('0x21')](function(_0x45be5d){logger['info'](_0x40bb('0x22'),_0x99c52d,_0x40bb('0x23'));logger[_0x40bb('0x24')](_0x40bb('0x25'),_0x99c52d,_0x40bb('0x23'),JSON[_0x40bb('0x26')](_0x45be5d));if(_0x45be5d[_0x40bb('0x27')]){if(_0x45be5d['error'][_0x40bb('0x28')]===0x1f4){logger[_0x40bb('0x27')](_0x40bb('0x22'),_0x99c52d,_0x45be5d[_0x40bb('0x27')][_0x40bb('0x29')]);return _0x3b28a2(_0x45be5d[_0x40bb('0x27')][_0x40bb('0x29')]);}logger[_0x40bb('0x27')](_0x40bb('0x22'),_0x99c52d,_0x45be5d[_0x40bb('0x27')][_0x40bb('0x29')]);return _0x4a177c(_0x45be5d[_0x40bb('0x27')]['message']);}else{logger[_0x40bb('0x2a')](_0x40bb('0x22'),_0x99c52d,_0x40bb('0x23'));_0x4a177c(_0x45be5d[_0x40bb('0x2b')][_0x40bb('0x29')]);}})[_0x40bb('0x2c')](function(_0x3ab03b){logger[_0x40bb('0x27')](_0x40bb('0x22'),_0x99c52d,_0x3ab03b);_0x3b28a2(_0x3ab03b);});});}function respondWithStatusCode(_0x22daf6,_0x8ee5e5){_0x8ee5e5=_0x8ee5e5||0xcc;return function(_0x558cd6){if(_0x558cd6){return _0x22daf6['sendStatus'](_0x8ee5e5);}return _0x22daf6[_0x40bb('0x2d')](_0x8ee5e5)[_0x40bb('0x2e')]();};}function respondWithResult(_0x8592b6,_0x5b73c2){_0x5b73c2=_0x5b73c2||0xc8;return function(_0xc1b76f){if(_0xc1b76f){return _0x8592b6[_0x40bb('0x2d')](_0x5b73c2)[_0x40bb('0x2f')](_0xc1b76f);}};}function respondWithFilteredResult(_0x121056,_0x28cd48){return function(_0x1e8ac0){if(_0x1e8ac0){var _0x1b0ad6=_0x1e8ac0[_0x40bb('0x30')],_0x39766a=_0x28cd48[_0x40bb('0x31')],_0x418834=_0x28cd48['offset']+_0x28cd48[_0x40bb('0x32')],_0x510ea9;if(_0x418834>=_0x1b0ad6){_0x418834=_0x1b0ad6;_0x510ea9=0xc8;}else{_0x510ea9=0xce;}_0x121056['status'](_0x510ea9);return _0x121056[_0x40bb('0x33')]('Content-Range',_0x39766a+'-'+_0x418834+'/'+_0x1b0ad6)['json'](_0x1e8ac0);}return null;};}function patchUpdates(_0x4538e5){return function(_0x420128){try{jsonpatch[_0x40bb('0x34')](_0x420128,_0x4538e5,!![]);}catch(_0x4a48f6){return BPromise[_0x40bb('0x35')](_0x4a48f6);}return _0x420128[_0x40bb('0x36')]();};}function saveUpdates(_0x27e9cb,_0x551d41){return function(_0x451fb1){if(_0x451fb1){return _0x451fb1[_0x40bb('0x37')](_0x27e9cb)[_0x40bb('0x21')](function(_0x13eced){return _0x13eced;});}return null;};}function removeEntity(_0xd31b22,_0x3eca00){return function(_0x3bc259){if(_0x3bc259){return _0x3bc259['destroy']()['then'](function(){var _0x30cf4b=_0x3bc259['get']({'plain':!![]});var _0x423dba=_0x40bb('0x38');return db[_0x40bb('0x39')]['destroy']({'where':{'type':_0x423dba,'resourceId':_0x30cf4b['id']}})[_0x40bb('0x21')](function(){return _0x3bc259;});})['then'](function(){_0xd31b22[_0x40bb('0x2d')](0xcc)[_0x40bb('0x2e')]();});}};}function handleEntityNotFound(_0x529e28,_0x441f59){return function(_0x494935){if(!_0x494935){_0x529e28['sendStatus'](0x194);}return _0x494935;};}function handleError(_0x380640,_0x461464){_0x461464=_0x461464||0x1f4;return function(_0xd49d70){logger['error'](_0xd49d70[_0x40bb('0x3a')]);if(_0xd49d70[_0x40bb('0x3b')]){delete _0xd49d70['name'];}_0x380640['status'](_0x461464)[_0x40bb('0x3c')](_0xd49d70);};}exports['index']=function(_0x276330,_0x1d3d53){var _0x1a32ef={},_0x348120={},_0x4ecfe5={'count':0x0,'rows':[]};var _0x59dce5=_['map'](db[_0x40bb('0x3d')][_0x40bb('0x3e')],function(_0x5530cf){return{'name':_0x5530cf[_0x40bb('0x3f')],'type':_0x5530cf[_0x40bb('0x40')][_0x40bb('0x41')]};});_0x348120[_0x40bb('0x42')]=_['map'](_0x59dce5,_0x40bb('0x3b'));_0x348120[_0x40bb('0x43')]=_[_0x40bb('0x44')](_0x276330[_0x40bb('0x43')]);_0x348120[_0x40bb('0x45')]=_['intersection'](_0x348120['model'],_0x348120['query']);_0x1a32ef[_0x40bb('0x46')]=_[_0x40bb('0x47')](_0x348120['model'],qs['fields'](_0x276330[_0x40bb('0x43')][_0x40bb('0x48')]));_0x1a32ef[_0x40bb('0x46')]=_0x1a32ef[_0x40bb('0x46')][_0x40bb('0x49')]?_0x1a32ef[_0x40bb('0x46')]:_0x348120['model'];if(!_0x276330[_0x40bb('0x43')][_0x40bb('0x4a')]('nolimit')){_0x1a32ef['limit']=qs['limit'](_0x276330['query'][_0x40bb('0x32')]);_0x1a32ef[_0x40bb('0x31')]=qs['offset'](_0x276330['query'][_0x40bb('0x31')]);}_0x1a32ef[_0x40bb('0x4b')]=qs[_0x40bb('0x4c')](_0x276330['query']['sort']);_0x1a32ef[_0x40bb('0x4d')]=qs[_0x40bb('0x45')](_[_0x40bb('0x4e')](_0x276330['query'],_0x348120[_0x40bb('0x45')]),_0x59dce5);if(_0x276330[_0x40bb('0x43')][_0x40bb('0x4f')]){_0x1a32ef[_0x40bb('0x4d')]=_['merge'](_0x1a32ef[_0x40bb('0x4d')],{'$or':_[_0x40bb('0x50')](_0x59dce5,function(_0x1454aa){if(_0x1454aa[_0x40bb('0x40')]!=='VIRTUAL'){var _0x2a83c5={};_0x2a83c5[_0x1454aa[_0x40bb('0x3b')]]={'$like':'%'+_0x276330[_0x40bb('0x43')]['filter']+'%'};return _0x2a83c5;}})});}_0x1a32ef=_[_0x40bb('0x51')]({},_0x1a32ef,_0x276330[_0x40bb('0x52')]);var _0x8c56b0={'where':_0x1a32ef[_0x40bb('0x4d')]};return db[_0x40bb('0x3d')][_0x40bb('0x30')](_0x8c56b0)['then'](function(_0x5adfb0){_0x4ecfe5[_0x40bb('0x30')]=_0x5adfb0;if(_0x276330[_0x40bb('0x43')][_0x40bb('0x53')]){_0x1a32ef[_0x40bb('0x54')]=[{'all':!![]}];}return db[_0x40bb('0x3d')][_0x40bb('0x55')](_0x1a32ef);})[_0x40bb('0x21')](function(_0x195561){_0x4ecfe5['rows']=_0x195561;return _0x4ecfe5;})['then'](respondWithFilteredResult(_0x1d3d53,_0x1a32ef))['catch'](handleError(_0x1d3d53,null));};exports['show']=function(_0x2457bb,_0x29e589){var _0x46c9ef={'raw':![],'where':{'id':_0x2457bb['params']['id']}},_0x4fc0ca={};_0x4fc0ca[_0x40bb('0x42')]=_[_0x40bb('0x44')](db[_0x40bb('0x3d')][_0x40bb('0x3e')]);_0x4fc0ca[_0x40bb('0x43')]=_[_0x40bb('0x44')](_0x2457bb['query']);_0x4fc0ca[_0x40bb('0x45')]=_[_0x40bb('0x47')](_0x4fc0ca['model'],_0x4fc0ca[_0x40bb('0x43')]);_0x46c9ef[_0x40bb('0x46')]=_[_0x40bb('0x47')](_0x4fc0ca[_0x40bb('0x42')],qs[_0x40bb('0x48')](_0x2457bb[_0x40bb('0x43')]['fields']));_0x46c9ef[_0x40bb('0x46')]=_0x46c9ef[_0x40bb('0x46')][_0x40bb('0x49')]?_0x46c9ef[_0x40bb('0x46')]:_0x4fc0ca['model'];if(_0x2457bb[_0x40bb('0x43')][_0x40bb('0x53')]){_0x46c9ef[_0x40bb('0x54')]=[{'all':!![]}];}_0x46c9ef=_[_0x40bb('0x51')]({},_0x46c9ef,_0x2457bb['options']);return db['Trunk'][_0x40bb('0x56')](_0x46c9ef)[_0x40bb('0x21')](handleEntityNotFound(_0x29e589,null))[_0x40bb('0x21')](respondWithResult(_0x29e589,null))[_0x40bb('0x2c')](handleError(_0x29e589,null));};exports[_0x40bb('0x57')]=function(_0x14090e,_0x4cfed9){var _0x284de0={'where':{'id':_0x14090e[_0x40bb('0x58')]['id']}},_0xbff3fb={};_0xbff3fb[_0x40bb('0x42')]=_[_0x40bb('0x44')](db[_0x40bb('0x3d')]['rawAttributes']);_0x284de0[_0x40bb('0x46')]=_[_0x40bb('0x47')](_0xbff3fb[_0x40bb('0x42')],qs[_0x40bb('0x48')](_0x14090e[_0x40bb('0x43')][_0x40bb('0x48')]));_0x284de0['attributes']=_0x284de0[_0x40bb('0x46')]['length']?_0x284de0[_0x40bb('0x46')]:_0xbff3fb[_0x40bb('0x42')];if(_0x14090e[_0x40bb('0x43')][_0x40bb('0x53')]){_0x284de0[_0x40bb('0x54')]=[{'all':!![]}];}_0x284de0=_['merge']({},_0x284de0,_0x14090e[_0x40bb('0x52')]);return db[_0x40bb('0x3d')][_0x40bb('0x56')](_0x284de0)[_0x40bb('0x21')](handleEntityNotFound(_0x4cfed9,null))[_0x40bb('0x21')](function(_0x4fe879){if(_0x4fe879){var _0x2b463d=_0x4fe879['get']({'plain':!![]});_0x2b463d=qs['omit'](_0x2b463d,['id',_0x40bb('0x59'),_0x40bb('0x5a')]);_0x14090e[_0x40bb('0x5b')]=_[_0x40bb('0x5c')](_0x14090e[_0x40bb('0x5b')],['id',_0x40bb('0x59'),'updatedAt']);return db['Trunk'][_0x40bb('0x5d')](_[_0x40bb('0x51')](_0x2b463d,_0x14090e[_0x40bb('0x5b')]),{'include':_0x14090e[_0x40bb('0x43')][_0x40bb('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x351788){var _0x42cdf1=_0x14090e[_0x40bb('0x5e')][_0x40bb('0x5f')]({'plain':!![]});if(!_0x42cdf1)throw new Error(_0x40bb('0x60'));if(_0x42cdf1[_0x40bb('0x61')]==='user'){var _0x44ce1d=_0x351788[_0x40bb('0x5f')]({'plain':!![]});var _0x41c2c9=_0x40bb('0x38');return db[_0x40bb('0x62')]['find']({'where':{'name':_0x41c2c9,'userProfileId':_0x42cdf1['userProfileId']},'raw':!![]})[_0x40bb('0x21')](function(_0x542db4){if(_0x542db4&&_0x542db4[_0x40bb('0x63')]===0x0){return db[_0x40bb('0x39')]['create']({'name':_0x44ce1d[_0x40bb('0x3b')],'resourceId':_0x44ce1d['id'],'type':_0x542db4[_0x40bb('0x3b')],'sectionId':_0x542db4['id']},{})[_0x40bb('0x21')](function(){return _0x351788;});}else{return _0x351788;}})[_0x40bb('0x2c')](function(_0x5bbafd){logger[_0x40bb('0x27')](_0x40bb('0x64'),_0x5bbafd);throw _0x5bbafd;});}return _0x351788;});}})[_0x40bb('0x21')](respondWithResult(_0x4cfed9,0xc9))[_0x40bb('0x2c')](handleError(_0x4cfed9,null));};exports['create']=function(_0xb6a620,_0x138187,_0xf1d756){var _0x3de31d;return db['Trunk'][_0x40bb('0x5d')](_0xb6a620[_0x40bb('0x5b')],{'raw':!![]})['then'](function(_0x3ca7b3){_0x3de31d=_0x3ca7b3;return db['Trunk'][_0x40bb('0x55')]({'raw':!![]});})[_0x40bb('0x21')](function(_0x547afc){var _0x37a359=fs[_0x40bb('0x65')](path['join'](config[_0x40bb('0x66')],_0x40bb('0x67')),_0x40bb('0x68'));var _0x4ceb7e=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],'server/files/templates/registry.ejs'),_0x40bb('0x68'));var _0xa2e0e5=ejs[_0x40bb('0x6a')](_0x37a359,{'trunks':_0x547afc||[]});fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0xa2e0e5);if(_0x3de31d[_0x40bb('0x6c')]){var _0x30d4eb=ejs['render'](_0x4ceb7e,{'trunks':_0x547afc||[]});fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x30d4eb);}})[_0x40bb('0x21')](function(){return respondWithRpcPromise('Reload',_0x40bb('0x5d'),{'module':'chan_sip.so'});})[_0x40bb('0x21')](function(){var _0x3d54aa=_0xb6a620[_0x40bb('0x5e')][_0x40bb('0x5f')]({'plain':!![]});if(!_0x3d54aa)throw new Error(_0x40bb('0x60'));if(_0x3d54aa['role']===_0x40bb('0x5e')){var _0x4287be=_0x3de31d[_0x40bb('0x5f')]({'plain':!![]});return db[_0x40bb('0x62')][_0x40bb('0x56')]({'where':{'name':_0x40bb('0x38'),'userProfileId':_0x3d54aa[_0x40bb('0x6d')]},'raw':!![]})[_0x40bb('0x21')](function(_0x22329e){if(_0x22329e&&_0x22329e[_0x40bb('0x63')]===0x0){return db['UserProfileResource'][_0x40bb('0x5d')]({'name':_0x4287be['name'],'resourceId':_0x4287be['id'],'type':_0x22329e[_0x40bb('0x3b')],'sectionId':_0x22329e['id']},{})[_0x40bb('0x21')](function(){return _0x3de31d;});}else{return _0x3de31d;}})[_0x40bb('0x2c')](function(_0x3ce5d4){logger[_0x40bb('0x27')](_0x40bb('0x64'),_0x3ce5d4);throw _0x3ce5d4;});}return _0x3de31d;})[_0x40bb('0x21')](respondWithResult(_0x138187,0xc9))[_0x40bb('0x2c')](handleError(_0x138187,null));};exports[_0x40bb('0x37')]=function(_0x295a5a,_0xd66131,_0x3d6e77){var _0x32b8e4;return db[_0x40bb('0x3d')][_0x40bb('0x56')]({'where':{'id':_0x295a5a[_0x40bb('0x58')]['id']}})[_0x40bb('0x21')](handleEntityNotFound(_0xd66131,null))[_0x40bb('0x21')](saveUpdates(_0x295a5a[_0x40bb('0x5b')],null))[_0x40bb('0x21')](function(_0x3ad10b){if(_0x3ad10b){_0x32b8e4=_0x3ad10b;return db[_0x40bb('0x3d')][_0x40bb('0x55')]({'raw':!![]});}})[_0x40bb('0x21')](function(_0x4eba2c){if(_0x4eba2c){var _0x3f3310=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],'server/files/templates/trunk.ejs'),_0x40bb('0x68'));var _0x2c963e=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],_0x40bb('0x6e')),_0x40bb('0x68'));var _0x3fda5f=ejs[_0x40bb('0x6a')](_0x3f3310,{'trunks':_0x4eba2c||[]});fs[_0x40bb('0x6b')](_0x40bb('0x6f'),_0x3fda5f);var _0xc781f3=ejs['render'](_0x2c963e,{'trunks':_0x4eba2c||[]});fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0xc781f3);return respondWithRpcPromise('Reload',_0x40bb('0x37'),{'module':'chan_sip.so'});}return null;})[_0x40bb('0x21')](function(_0x4460b1){if(_0x4460b1){return _0x32b8e4;}})[_0x40bb('0x21')](respondWithResult(_0xd66131,null))[_0x40bb('0x2c')](handleError(_0xd66131,null));};exports[_0x40bb('0x70')]=function(_0x40ef93,_0x22ed4f,_0x39b3fc){var _0x11cefc;return db[_0x40bb('0x3d')][_0x40bb('0x56')]({'where':{'id':_0x40ef93[_0x40bb('0x58')]['id']}})[_0x40bb('0x21')](handleEntityNotFound(_0x22ed4f,null))[_0x40bb('0x21')](removeEntity(_0x22ed4f,null))[_0x40bb('0x21')](function(){return db[_0x40bb('0x3d')][_0x40bb('0x55')]({'raw':!![]});})['then'](function(_0x46aab1){var _0x32f90b=fs[_0x40bb('0x65')](path['join'](config[_0x40bb('0x66')],_0x40bb('0x67')),_0x40bb('0x68'));var _0x1e5fd0=fs[_0x40bb('0x65')](path[_0x40bb('0x69')](config[_0x40bb('0x66')],_0x40bb('0x6e')),_0x40bb('0x68'));var _0x503f06=ejs[_0x40bb('0x6a')](_0x32f90b,{'trunks':_0x46aab1});var _0x16e32e=ejs[_0x40bb('0x6a')](_0x1e5fd0,{'trunks':_0x46aab1});fs[_0x40bb('0x6b')](_0x40bb('0x6f'),_0x503f06);fs[_0x40bb('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x16e32e);return respondWithRpcPromise(_0x40bb('0x71'),_0x40bb('0x70'),{'module':_0x40bb('0x72')});})['catch'](handleError(_0x22ed4f,null));}; \ No newline at end of file +var _0x0c1a=['count','offset','limit','set','apply','reject','destroy','Trunks','UserProfileResource','end','stack','send','index','map','Trunk','type','key','model','query','filters','attributes','intersection','nolimit','order','sort','where','pick','merge','filter','include','findAll','rows','show','keys','rawAttributes','fields','length','includeAll','options','find','catch','clone','params','get','omit','createdAt','updatedAt','body','user','UserProfileSection','userProfileId','autoAssociation','create','name','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','update','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','json'];(function(_0x591707,_0x44302b){var _0x3df29c=function(_0x310ee2){while(--_0x310ee2){_0x591707['push'](_0x591707['shift']());}};_0x3df29c(++_0x44302b);}(_0x0c1a,0x127));var _0xa0c1=function(_0x30ffde,_0x4e07a4){_0x30ffde=_0x30ffde-0x0;var _0x16c4cd=_0x0c1a[_0x30ffde];return _0x16c4cd;};'use strict';var pdf=require(_0xa0c1('0x0'));var emlformat=require(_0xa0c1('0x1'));var rimraf=require(_0xa0c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0c1('0x3'));var moment=require('moment');var BPromise=require(_0xa0c1('0x4'));var Mustache=require(_0xa0c1('0x5'));var util=require(_0xa0c1('0x6'));var path=require(_0xa0c1('0x7'));var sox=require(_0xa0c1('0x8'));var csv=require(_0xa0c1('0x9'));var ejs=require(_0xa0c1('0xa'));var fs=require('fs');var _=require(_0xa0c1('0xb'));var squel=require(_0xa0c1('0xc'));var crypto=require(_0xa0c1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa0c1('0xe'));var toCsv=require(_0xa0c1('0x9'));var querystring=require(_0xa0c1('0xf'));var Papa=require(_0xa0c1('0x10'));var Redis=require(_0xa0c1('0x11'));var authService=require(_0xa0c1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa0c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0c1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa0c1('0x15'));var db=require(_0xa0c1('0x16'))['db'];var jayson=require(_0xa0c1('0x17'));var client=jayson['client'][_0xa0c1('0x18')]({'port':0x232a});function checkPasswordPattern(_0xd201d8,_0x2a453b,_0xc4de3b){if(_0xc4de3b){var _0x1cafb2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cafb2[_0xa0c1('0x19')](_0x2a453b)){return _0xd201d8;}else{throw new db['Sequelize']['ValidationError'](_0xa0c1('0x1a'));}}else{return _0xd201d8;}}function respondWithRpcPromise(_0x35c8fd,_0x11e1f4,_0xf87af8,_0x10f3dc){return new BPromise(function(_0x4813ba,_0x5ca8f3){var _0x3f70a4=_0x10f3dc||client;return _0x3f70a4[_0xa0c1('0x1b')](_0x35c8fd,_0xf87af8)[_0xa0c1('0x1c')](function(_0x458137){logger['info'](_0xa0c1('0x1d'),_0x11e1f4,'request\x20sent');logger[_0xa0c1('0x1e')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11e1f4,_0xa0c1('0x1f'),JSON[_0xa0c1('0x20')](_0x458137));if(_0x458137[_0xa0c1('0x21')]){if(_0x458137[_0xa0c1('0x21')][_0xa0c1('0x22')]===0x1f4){logger['error'](_0xa0c1('0x1d'),_0x11e1f4,_0x458137[_0xa0c1('0x21')][_0xa0c1('0x23')]);return _0x5ca8f3(_0x458137[_0xa0c1('0x21')][_0xa0c1('0x23')]);}logger['error'](_0xa0c1('0x1d'),_0x11e1f4,_0x458137[_0xa0c1('0x21')][_0xa0c1('0x23')]);return _0x4813ba(_0x458137['error'][_0xa0c1('0x23')]);}else{logger[_0xa0c1('0x24')]('Trunk,\x20%s,\x20%s',_0x11e1f4,'request\x20sent');_0x4813ba(_0x458137[_0xa0c1('0x25')][_0xa0c1('0x23')]);}})['catch'](function(_0x2efcfc){logger[_0xa0c1('0x21')](_0xa0c1('0x1d'),_0x11e1f4,_0x2efcfc);_0x5ca8f3(_0x2efcfc);});});}function respondWithStatusCode(_0x408538,_0x483936){_0x483936=_0x483936||0xcc;return function(_0x1861d5){if(_0x1861d5){return _0x408538[_0xa0c1('0x26')](_0x483936);}return _0x408538[_0xa0c1('0x27')](_0x483936)['end']();};}function respondWithResult(_0x30c757,_0x2fdcbe){_0x2fdcbe=_0x2fdcbe||0xc8;return function(_0x20344b){if(_0x20344b){return _0x30c757[_0xa0c1('0x27')](_0x2fdcbe)[_0xa0c1('0x28')](_0x20344b);}};}function respondWithFilteredResult(_0x49530b,_0x4a5d0b){return function(_0x43e519){if(_0x43e519){var _0x369919=_0x43e519[_0xa0c1('0x29')],_0x3be9e2=_0x4a5d0b[_0xa0c1('0x2a')],_0x28f16c=_0x4a5d0b[_0xa0c1('0x2a')]+_0x4a5d0b[_0xa0c1('0x2b')],_0x26a286;if(_0x28f16c>=_0x369919){_0x28f16c=_0x369919;_0x26a286=0xc8;}else{_0x26a286=0xce;}_0x49530b[_0xa0c1('0x27')](_0x26a286);return _0x49530b[_0xa0c1('0x2c')]('Content-Range',_0x3be9e2+'-'+_0x28f16c+'/'+_0x369919)[_0xa0c1('0x28')](_0x43e519);}return null;};}function patchUpdates(_0x49fd04){return function(_0xcd1f57){try{jsonpatch[_0xa0c1('0x2d')](_0xcd1f57,_0x49fd04,!![]);}catch(_0x5d3344){return BPromise[_0xa0c1('0x2e')](_0x5d3344);}return _0xcd1f57['save']();};}function saveUpdates(_0x28fb4e,_0x4e4498){return function(_0x575e98){if(_0x575e98){return _0x575e98['update'](_0x28fb4e)['then'](function(_0x123318){return _0x123318;});}return null;};}function removeEntity(_0x3cc3bf,_0x1db772){return function(_0xc2252c){if(_0xc2252c){return _0xc2252c[_0xa0c1('0x2f')]()[_0xa0c1('0x1c')](function(){var _0x31a7fd=_0xc2252c['get']({'plain':!![]});var _0x34410b=_0xa0c1('0x30');return db[_0xa0c1('0x31')][_0xa0c1('0x2f')]({'where':{'type':_0x34410b,'resourceId':_0x31a7fd['id']}})[_0xa0c1('0x1c')](function(){return _0xc2252c;});})[_0xa0c1('0x1c')](function(){_0x3cc3bf[_0xa0c1('0x27')](0xcc)[_0xa0c1('0x32')]();});}};}function handleEntityNotFound(_0x49fa0e,_0x38fcbb){return function(_0x48ca75){if(!_0x48ca75){_0x49fa0e[_0xa0c1('0x26')](0x194);}return _0x48ca75;};}function handleError(_0x2f025b,_0x4d52f9){_0x4d52f9=_0x4d52f9||0x1f4;return function(_0xbea0a){logger[_0xa0c1('0x21')](_0xbea0a[_0xa0c1('0x33')]);if(_0xbea0a['name']){delete _0xbea0a['name'];}_0x2f025b[_0xa0c1('0x27')](_0x4d52f9)[_0xa0c1('0x34')](_0xbea0a);};}exports[_0xa0c1('0x35')]=function(_0x3565f7,_0x527d0b){var _0x2c5ef3={},_0x4bfcc6={},_0x263e53={'count':0x0,'rows':[]};var _0x2542d8=_[_0xa0c1('0x36')](db[_0xa0c1('0x37')]['rawAttributes'],function(_0x24ab3d){return{'name':_0x24ab3d['fieldName'],'type':_0x24ab3d[_0xa0c1('0x38')][_0xa0c1('0x39')]};});_0x4bfcc6[_0xa0c1('0x3a')]=_[_0xa0c1('0x36')](_0x2542d8,'name');_0x4bfcc6[_0xa0c1('0x3b')]=_['keys'](_0x3565f7[_0xa0c1('0x3b')]);_0x4bfcc6[_0xa0c1('0x3c')]=_['intersection'](_0x4bfcc6[_0xa0c1('0x3a')],_0x4bfcc6[_0xa0c1('0x3b')]);_0x2c5ef3[_0xa0c1('0x3d')]=_[_0xa0c1('0x3e')](_0x4bfcc6[_0xa0c1('0x3a')],qs['fields'](_0x3565f7[_0xa0c1('0x3b')]['fields']));_0x2c5ef3[_0xa0c1('0x3d')]=_0x2c5ef3[_0xa0c1('0x3d')]['length']?_0x2c5ef3[_0xa0c1('0x3d')]:_0x4bfcc6['model'];if(!_0x3565f7[_0xa0c1('0x3b')]['hasOwnProperty'](_0xa0c1('0x3f'))){_0x2c5ef3[_0xa0c1('0x2b')]=qs[_0xa0c1('0x2b')](_0x3565f7[_0xa0c1('0x3b')][_0xa0c1('0x2b')]);_0x2c5ef3[_0xa0c1('0x2a')]=qs[_0xa0c1('0x2a')](_0x3565f7['query'][_0xa0c1('0x2a')]);}_0x2c5ef3[_0xa0c1('0x40')]=qs['sort'](_0x3565f7['query'][_0xa0c1('0x41')]);_0x2c5ef3[_0xa0c1('0x42')]=qs[_0xa0c1('0x3c')](_[_0xa0c1('0x43')](_0x3565f7['query'],_0x4bfcc6[_0xa0c1('0x3c')]),_0x2542d8);if(_0x3565f7['query']['filter']){_0x2c5ef3[_0xa0c1('0x42')]=_[_0xa0c1('0x44')](_0x2c5ef3['where'],{'$or':_[_0xa0c1('0x36')](_0x2542d8,function(_0x489426){if(_0x489426[_0xa0c1('0x38')]!=='VIRTUAL'){var _0xe5a1fc={};_0xe5a1fc[_0x489426['name']]={'$like':'%'+_0x3565f7[_0xa0c1('0x3b')][_0xa0c1('0x45')]+'%'};return _0xe5a1fc;}})});}_0x2c5ef3=_[_0xa0c1('0x44')]({},_0x2c5ef3,_0x3565f7['options']);var _0x1ea033={'where':_0x2c5ef3[_0xa0c1('0x42')]};return db[_0xa0c1('0x37')][_0xa0c1('0x29')](_0x1ea033)[_0xa0c1('0x1c')](function(_0x1048b0){_0x263e53[_0xa0c1('0x29')]=_0x1048b0;if(_0x3565f7[_0xa0c1('0x3b')]['includeAll']){_0x2c5ef3[_0xa0c1('0x46')]=[{'all':!![]}];}return db['Trunk'][_0xa0c1('0x47')](_0x2c5ef3);})['then'](function(_0x5479d7){_0x263e53[_0xa0c1('0x48')]=_0x5479d7;return _0x263e53;})[_0xa0c1('0x1c')](respondWithFilteredResult(_0x527d0b,_0x2c5ef3))['catch'](handleError(_0x527d0b,null));};exports[_0xa0c1('0x49')]=function(_0x5df18c,_0x2c3416){var _0x2b09c3={'raw':![],'where':{'id':_0x5df18c['params']['id']}},_0x559a9c={};_0x559a9c['model']=_[_0xa0c1('0x4a')](db['Trunk'][_0xa0c1('0x4b')]);_0x559a9c['query']=_[_0xa0c1('0x4a')](_0x5df18c[_0xa0c1('0x3b')]);_0x559a9c[_0xa0c1('0x3c')]=_[_0xa0c1('0x3e')](_0x559a9c[_0xa0c1('0x3a')],_0x559a9c[_0xa0c1('0x3b')]);_0x2b09c3[_0xa0c1('0x3d')]=_[_0xa0c1('0x3e')](_0x559a9c[_0xa0c1('0x3a')],qs[_0xa0c1('0x4c')](_0x5df18c[_0xa0c1('0x3b')][_0xa0c1('0x4c')]));_0x2b09c3[_0xa0c1('0x3d')]=_0x2b09c3['attributes'][_0xa0c1('0x4d')]?_0x2b09c3[_0xa0c1('0x3d')]:_0x559a9c[_0xa0c1('0x3a')];if(_0x5df18c[_0xa0c1('0x3b')][_0xa0c1('0x4e')]){_0x2b09c3[_0xa0c1('0x46')]=[{'all':!![]}];}_0x2b09c3=_[_0xa0c1('0x44')]({},_0x2b09c3,_0x5df18c[_0xa0c1('0x4f')]);return db[_0xa0c1('0x37')][_0xa0c1('0x50')](_0x2b09c3)[_0xa0c1('0x1c')](handleEntityNotFound(_0x2c3416,null))[_0xa0c1('0x1c')](respondWithResult(_0x2c3416,null))[_0xa0c1('0x51')](handleError(_0x2c3416,null));};exports[_0xa0c1('0x52')]=function(_0x2fa897,_0x280d8b){var _0x212902={'where':{'id':_0x2fa897[_0xa0c1('0x53')]['id']}},_0x7fc4be={};_0x7fc4be[_0xa0c1('0x3a')]=_[_0xa0c1('0x4a')](db['Trunk'][_0xa0c1('0x4b')]);_0x212902[_0xa0c1('0x3d')]=_[_0xa0c1('0x3e')](_0x7fc4be[_0xa0c1('0x3a')],qs['fields'](_0x2fa897[_0xa0c1('0x3b')][_0xa0c1('0x4c')]));_0x212902[_0xa0c1('0x3d')]=_0x212902['attributes'][_0xa0c1('0x4d')]?_0x212902[_0xa0c1('0x3d')]:_0x7fc4be[_0xa0c1('0x3a')];if(_0x2fa897[_0xa0c1('0x3b')][_0xa0c1('0x4e')]){_0x212902[_0xa0c1('0x46')]=[{'all':!![]}];}_0x212902=_[_0xa0c1('0x44')]({},_0x212902,_0x2fa897['options']);return db['Trunk']['find'](_0x212902)[_0xa0c1('0x1c')](handleEntityNotFound(_0x280d8b,null))[_0xa0c1('0x1c')](function(_0x3e7375){if(_0x3e7375){var _0x24a32e=_0x3e7375[_0xa0c1('0x54')]({'plain':!![]});_0x24a32e=qs[_0xa0c1('0x55')](_0x24a32e,['id',_0xa0c1('0x56'),_0xa0c1('0x57')]);_0x2fa897[_0xa0c1('0x58')]=_[_0xa0c1('0x55')](_0x2fa897[_0xa0c1('0x58')],['id',_0xa0c1('0x56'),_0xa0c1('0x57')]);return db['Trunk']['create'](_[_0xa0c1('0x44')](_0x24a32e,_0x2fa897['body']),{'include':_0x2fa897[_0xa0c1('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xa0c1('0x1c')](function(_0x22cef2){var _0x291230=_0x2fa897['user'][_0xa0c1('0x54')]({'plain':!![]});if(!_0x291230)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x291230['role']===_0xa0c1('0x59')){var _0x48753a=_0x22cef2[_0xa0c1('0x54')]({'plain':!![]});var _0x1820ef=_0xa0c1('0x30');return db[_0xa0c1('0x5a')]['find']({'where':{'name':_0x1820ef,'userProfileId':_0x291230[_0xa0c1('0x5b')]},'raw':!![]})[_0xa0c1('0x1c')](function(_0x1e3a9f){if(_0x1e3a9f&&_0x1e3a9f[_0xa0c1('0x5c')]===0x0){return db['UserProfileResource'][_0xa0c1('0x5d')]({'name':_0x48753a[_0xa0c1('0x5e')],'resourceId':_0x48753a['id'],'type':_0x1e3a9f[_0xa0c1('0x5e')],'sectionId':_0x1e3a9f['id']},{})[_0xa0c1('0x1c')](function(){return _0x22cef2;});}else{return _0x22cef2;}})[_0xa0c1('0x51')](function(_0x4d55ed){logger[_0xa0c1('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d55ed);throw _0x4d55ed;});}return _0x22cef2;});}})['then'](respondWithResult(_0x280d8b,0xc9))['catch'](handleError(_0x280d8b,null));};exports['create']=function(_0x587f0c,_0x774926,_0x2dbd81){var _0x1e4b6e;return db[_0xa0c1('0x37')]['create'](_0x587f0c[_0xa0c1('0x58')],{'raw':!![]})[_0xa0c1('0x1c')](function(_0x13ebb0){_0x1e4b6e=_0x13ebb0;return db[_0xa0c1('0x37')][_0xa0c1('0x47')]({'raw':!![]});})['then'](function(_0x6df200){var _0x4dd640=fs[_0xa0c1('0x5f')](path[_0xa0c1('0x60')](config[_0xa0c1('0x61')],'server/files/templates/trunk.ejs'),_0xa0c1('0x62'));var _0x416404=fs[_0xa0c1('0x5f')](path[_0xa0c1('0x60')](config['root'],_0xa0c1('0x63')),_0xa0c1('0x62'));var _0x2452ed=ejs[_0xa0c1('0x64')](_0x4dd640,{'trunks':_0x6df200||[]});fs[_0xa0c1('0x65')](_0xa0c1('0x66'),_0x2452ed);if(_0x1e4b6e[_0xa0c1('0x67')]){var _0x14d7fe=ejs[_0xa0c1('0x64')](_0x416404,{'trunks':_0x6df200||[]});fs['writeFileSync'](_0xa0c1('0x68'),_0x14d7fe);}})[_0xa0c1('0x1c')](function(){return respondWithRpcPromise(_0xa0c1('0x69'),_0xa0c1('0x5d'),{'module':_0xa0c1('0x6a')});})[_0xa0c1('0x1c')](function(){var _0x5f3e53=_0x587f0c['user'][_0xa0c1('0x54')]({'plain':!![]});if(!_0x5f3e53)throw new Error(_0xa0c1('0x6b'));if(_0x5f3e53[_0xa0c1('0x6c')]===_0xa0c1('0x59')){var _0xf336=_0x1e4b6e[_0xa0c1('0x54')]({'plain':!![]});return db[_0xa0c1('0x5a')][_0xa0c1('0x50')]({'where':{'name':_0xa0c1('0x30'),'userProfileId':_0x5f3e53[_0xa0c1('0x5b')]},'raw':!![]})[_0xa0c1('0x1c')](function(_0x4f3db4){if(_0x4f3db4&&_0x4f3db4[_0xa0c1('0x5c')]===0x0){return db[_0xa0c1('0x31')][_0xa0c1('0x5d')]({'name':_0xf336[_0xa0c1('0x5e')],'resourceId':_0xf336['id'],'type':_0x4f3db4['name'],'sectionId':_0x4f3db4['id']},{})[_0xa0c1('0x1c')](function(){return _0x1e4b6e;});}else{return _0x1e4b6e;}})[_0xa0c1('0x51')](function(_0x4ef956){logger['error'](_0xa0c1('0x6d'),_0x4ef956);throw _0x4ef956;});}return _0x1e4b6e;})[_0xa0c1('0x1c')](respondWithResult(_0x774926,0xc9))[_0xa0c1('0x51')](handleError(_0x774926,null));};exports['update']=function(_0x280795,_0x19024a,_0x394942){var _0x530b30;return db[_0xa0c1('0x37')][_0xa0c1('0x50')]({'where':{'id':_0x280795[_0xa0c1('0x53')]['id']}})['then'](handleEntityNotFound(_0x19024a,null))[_0xa0c1('0x1c')](saveUpdates(_0x280795[_0xa0c1('0x58')],null))[_0xa0c1('0x1c')](function(_0x25eb52){if(_0x25eb52){_0x530b30=_0x25eb52;return db[_0xa0c1('0x37')][_0xa0c1('0x47')]({'raw':!![]});}})[_0xa0c1('0x1c')](function(_0x4d0bc7){if(_0x4d0bc7){var _0x55676f=fs[_0xa0c1('0x5f')](path['join'](config[_0xa0c1('0x61')],_0xa0c1('0x6e')),_0xa0c1('0x62'));var _0x20dfd3=fs[_0xa0c1('0x5f')](path[_0xa0c1('0x60')](config['root'],_0xa0c1('0x63')),'utf8');var _0x3f064d=ejs[_0xa0c1('0x64')](_0x55676f,{'trunks':_0x4d0bc7||[]});fs[_0xa0c1('0x65')](_0xa0c1('0x66'),_0x3f064d);var _0x4ad0ff=ejs[_0xa0c1('0x64')](_0x20dfd3,{'trunks':_0x4d0bc7||[]});fs['writeFileSync'](_0xa0c1('0x68'),_0x4ad0ff);return respondWithRpcPromise(_0xa0c1('0x69'),_0xa0c1('0x6f'),{'module':_0xa0c1('0x6a')});}return null;})[_0xa0c1('0x1c')](function(_0x26db4d){if(_0x26db4d){return _0x530b30;}})[_0xa0c1('0x1c')](respondWithResult(_0x19024a,null))[_0xa0c1('0x51')](handleError(_0x19024a,null));};exports[_0xa0c1('0x2f')]=function(_0x449dd1,_0x2b186d,_0x3e711a){var _0x3200ff;return db['Trunk'][_0xa0c1('0x50')]({'where':{'id':_0x449dd1[_0xa0c1('0x53')]['id']}})[_0xa0c1('0x1c')](handleEntityNotFound(_0x2b186d,null))['then'](removeEntity(_0x2b186d,null))[_0xa0c1('0x1c')](function(){return db['Trunk'][_0xa0c1('0x47')]({'raw':!![]});})['then'](function(_0x45ef2f){var _0x2bbb2a=fs[_0xa0c1('0x5f')](path['join'](config[_0xa0c1('0x61')],'server/files/templates/trunk.ejs'),'utf8');var _0xe520e5=fs[_0xa0c1('0x5f')](path['join'](config[_0xa0c1('0x61')],_0xa0c1('0x63')),_0xa0c1('0x62'));var _0x3435c4=ejs['render'](_0x2bbb2a,{'trunks':_0x45ef2f});var _0x9e7281=ejs[_0xa0c1('0x64')](_0xe520e5,{'trunks':_0x45ef2f});fs[_0xa0c1('0x65')](_0xa0c1('0x66'),_0x3435c4);fs[_0xa0c1('0x65')](_0xa0c1('0x68'),_0x9e7281);return respondWithRpcPromise('Reload',_0xa0c1('0x2f'),{'module':_0xa0c1('0x6a')});})[_0xa0c1('0x51')](handleError(_0x2b186d,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 53f90c6..b98cc3f 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 _0xf962=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','lodash','api','moment','bluebird','request-promise'];(function(_0x521513,_0x1fe32a){var _0x26ec71=function(_0xba81f8){while(--_0xba81f8){_0x521513['push'](_0x521513['shift']());}};_0x26ec71(++_0x1fe32a);}(_0xf962,0x10e));var _0x2f96=function(_0x3a2aa4,_0x2e9f97){_0x3a2aa4=_0x3a2aa4-0x0;var _0x3905c5=_0xf962[_0x3a2aa4];return _0x3905c5;};'use strict';var _=require(_0x2f96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f96('0x1'));var moment=require(_0x2f96('0x2'));var BPromise=require(_0x2f96('0x3'));var rp=require(_0x2f96('0x4'));var fs=require('fs');var path=require(_0x2f96('0x5'));var rimraf=require(_0x2f96('0x6'));var config=require(_0x2f96('0x7'));var attributes=require(_0x2f96('0x8'));module[_0x2f96('0x9')]=function(_0x4b69a6,_0x1f23f5){return _0x4b69a6[_0x2f96('0xa')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7647=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment'];(function(_0xf9e76,_0x2e6b9a){var _0x119a9b=function(_0x146396){while(--_0x146396){_0xf9e76['push'](_0xf9e76['shift']());}};_0x119a9b(++_0x2e6b9a);}(_0x7647,0x95));var _0x7764=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7647[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7764('0x0'));var util=require(_0x7764('0x1'));var logger=require(_0x7764('0x2'))(_0x7764('0x3'));var moment=require(_0x7764('0x4'));var BPromise=require('bluebird');var rp=require(_0x7764('0x5'));var fs=require('fs');var path=require(_0x7764('0x6'));var rimraf=require(_0x7764('0x7'));var config=require(_0x7764('0x8'));var attributes=require(_0x7764('0x9'));module[_0x7764('0xa')]=function(_0x41ac82,_0x367992){return _0x41ac82[_0x7764('0xb')](_0x7764('0xc'),attributes,{'tableName':_0x7764('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index ccbdaa4..d0de8ae 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 _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetTrunk','Trunk','find','raw','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5864ef,_0x496812){var _0x21c244=function(_0x433f8a){while(--_0x433f8a){_0x5864ef['push'](_0x5864ef['shift']());}};_0x21c244(++_0x496812);}(_0x4fc2,0x111));var _0x24fc=function(_0x293fec,_0x133f38){_0x293fec=_0x293fec-0x0;var _0x405724=_0x4fc2[_0x293fec];return _0x405724;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('Trunk,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('Trunk,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetTrunk']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['Trunk'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowTrunk']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file +var _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18c639,_0xb8c920){_0x18c639=_0x18c639-0x0;var _0x16a68f=_0x5f2f[_0x18c639];return _0x16a68f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8c67440..6c937ed 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 _0x51eb=['removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','/create_many','bulkCreate','post','addContacts','create','addQueues','join','root','%s-%s','now','originalname','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/square_projects','addSquareProjects','put','update','/:id/password','changePassword','delete'];(function(_0x428d55,_0x4e5e47){var _0x4ba5fc=function(_0x216dcd){while(--_0x216dcd){_0x428d55['push'](_0x428d55['shift']());}};_0x4ba5fc(++_0x4e5e47);}(_0x51eb,0x1ba));var _0xb51e=function(_0x3aba31,_0x4f3a86){_0x3aba31=_0x3aba31-0x0;var _0x4ed575=_0x51eb[_0x3aba31];return _0x4ed575;};'use strict';var multer=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var path=require(_0xb51e('0x2'));var timeout=require(_0xb51e('0x3'));var express=require('express');var router=express[_0xb51e('0x4')]();var auth=require(_0xb51e('0x5'));var interaction=require(_0xb51e('0x6'));var config=require(_0xb51e('0x7'));var controller=require(_0xb51e('0x8'));router[_0xb51e('0x9')]('/',auth[_0xb51e('0xa')](),controller['index']);router['get'](_0xb51e('0xb'),auth[_0xb51e('0xa')](),controller['describe']);router[_0xb51e('0x9')](_0xb51e('0xc'),auth['isAuthenticated'](),controller[_0xb51e('0xd')]);router[_0xb51e('0x9')](_0xb51e('0xe'),auth[_0xb51e('0xa')](),controller['show']);router[_0xb51e('0x9')](_0xb51e('0xf'),controller[_0xb51e('0x10')]);router[_0xb51e('0x9')](_0xb51e('0x11'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x12')]);router[_0xb51e('0x9')](_0xb51e('0x13'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x14')]);router[_0xb51e('0x9')](_0xb51e('0x15'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x16')]);router[_0xb51e('0x9')](_0xb51e('0x17'),auth['isAuthenticated'](),controller['getGroups']);router[_0xb51e('0x9')](_0xb51e('0x18'),auth['isAuthenticated'](),controller[_0xb51e('0x19')]);router[_0xb51e('0x9')](_0xb51e('0x1a'),auth[_0xb51e('0xa')](),controller['getScreenRecordings']);router[_0xb51e('0x9')]('/:id/chat/interactions',auth[_0xb51e('0xa')](),controller[_0xb51e('0x1b')]);router[_0xb51e('0x9')](_0xb51e('0x1c'),auth['isAuthenticated'](),controller[_0xb51e('0x1d')]);router[_0xb51e('0x9')](_0xb51e('0x1e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x1f')]);router['get']('/:id/sms/interactions',auth[_0xb51e('0xa')](),controller['getSmsInteractions']);router[_0xb51e('0x9')]('/:id/fax/interactions',auth[_0xb51e('0xa')](),controller[_0xb51e('0x20')]);router[_0xb51e('0x9')](_0xb51e('0x21'),auth[_0xb51e('0xa')](),controller['getWhatsappInteractions']);router[_0xb51e('0x9')](_0xb51e('0x22'),auth[_0xb51e('0xa')](),controller['getTeams']);router[_0xb51e('0x9')](_0xb51e('0x23'),auth['isAuthenticated'](),controller[_0xb51e('0x24')]);router[_0xb51e('0x9')]('/:id/agents',auth[_0xb51e('0xa')](),controller[_0xb51e('0x25')]);router[_0xb51e('0x9')](_0xb51e('0x26'),auth['isAuthenticated'](),controller[_0xb51e('0x27')]);router['get'](_0xb51e('0x28'),auth['isAuthenticated'](),controller[_0xb51e('0x29')]);router[_0xb51e('0x9')](_0xb51e('0x2a'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x2b')]);router[_0xb51e('0x9')](_0xb51e('0x2c'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x2d')]);router[_0xb51e('0x9')](_0xb51e('0x2e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x2f')]);router[_0xb51e('0x9')](_0xb51e('0x30'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x31')]);router[_0xb51e('0x9')](_0xb51e('0x32'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x33')]);router[_0xb51e('0x9')]('/:id/square_projects',auth[_0xb51e('0xa')](),controller['getSquareProjects']);router[_0xb51e('0x9')](_0xb51e('0x34'),auth['isAuthenticated'](),controller[_0xb51e('0x35')]);router['get'](_0xb51e('0x36'),auth[_0xb51e('0xa')](),controller['getApiKey']);router['post'](_0xb51e('0x37'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x38')]);router[_0xb51e('0x39')]('/:id/contacts',auth[_0xb51e('0xa')](),controller[_0xb51e('0x3a')]);router[_0xb51e('0x39')]('/',auth[_0xb51e('0xa')](),controller[_0xb51e('0x3b')]);router[_0xb51e('0x39')]('/:id/queues',auth['isAuthenticated'](),controller[_0xb51e('0x3c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x770b36,_0x5d0f13,_0x525f91){_0x525f91(null,path[_0xb51e('0x3d')](config[_0xb51e('0x3e')],'server/files/images/'));},'filename':function(_0x10db00,_0x28d6c5,_0x328e20){_0x328e20(null,util['format'](_0xb51e('0x3f'),Date[_0xb51e('0x40')](),_0x28d6c5[_0xb51e('0x41')]));}})});router['post'](_0xb51e('0xf'),upload['single'](_0xb51e('0x42')),controller[_0xb51e('0x43')]);router['post']('/:id/login',auth[_0xb51e('0xa')](),controller[_0xb51e('0x44')]);router[_0xb51e('0x39')](_0xb51e('0x45'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x46')]);router[_0xb51e('0x39')](_0xb51e('0x47'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x48')]);router[_0xb51e('0x39')](_0xb51e('0x49'),auth[_0xb51e('0xa')](),controller['unpause']);router[_0xb51e('0x39')](_0xb51e('0x22'),auth[_0xb51e('0xa')](),controller['addTeams']);router[_0xb51e('0x39')](_0xb51e('0x4a'),auth[_0xb51e('0xa')](),controller['addChatInteractions']);router[_0xb51e('0x39')](_0xb51e('0x4b'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x4c')]);router[_0xb51e('0x39')](_0xb51e('0x4d'),auth[_0xb51e('0xa')](),controller['addFaxInteractions']);router[_0xb51e('0x39')](_0xb51e('0x4e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x4f')]);router[_0xb51e('0x39')](_0xb51e('0x50'),auth[_0xb51e('0xa')](),controller['addOpenchannelInteractions']);router[_0xb51e('0x39')](_0xb51e('0x51'),auth[_0xb51e('0xa')](),controller['addWhatsappInteractions']);router[_0xb51e('0x39')](_0xb51e('0x28'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x52')]);router[_0xb51e('0x39')](_0xb51e('0x2a'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0xb51e('0x39')](_0xb51e('0x2c'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x53')]);router['post'](_0xb51e('0x2e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x54')]);router['post'](_0xb51e('0x30'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x55')]);router[_0xb51e('0x39')](_0xb51e('0x32'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0xb51e('0x39')](_0xb51e('0x56'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x57')]);router[_0xb51e('0x39')](_0xb51e('0x36'),auth[_0xb51e('0xa')](),controller['createApiKey']);router[_0xb51e('0x58')]('/:id',auth[_0xb51e('0xa')](),controller[_0xb51e('0x59')]);router[_0xb51e('0x58')](_0xb51e('0x5a'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x5b')]);router[_0xb51e('0x5c')]('/:id/queues',auth[_0xb51e('0xa')](),controller[_0xb51e('0x5d')]);router[_0xb51e('0x5c')](_0xb51e('0x22'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x5e')]);router[_0xb51e('0x5c')](_0xb51e('0xe'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x5f')]);router[_0xb51e('0x5c')]('/:id/chat_interactions',auth[_0xb51e('0xa')](),controller[_0xb51e('0x60')]);router['delete'](_0xb51e('0x4b'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xb51e('0x5c')](_0xb51e('0x4d'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x61')]);router['delete']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb51e('0x62')]);router[_0xb51e('0x5c')](_0xb51e('0x50'),auth['isAuthenticated'](),controller[_0xb51e('0x63')]);router[_0xb51e('0x5c')](_0xb51e('0x51'),auth[_0xb51e('0xa')](),controller['removeWhatsappInteractions']);router[_0xb51e('0x5c')](_0xb51e('0x28'),auth[_0xb51e('0xa')](),controller['removeFaxAccounts']);router['delete'](_0xb51e('0x2a'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x64')]);router[_0xb51e('0x5c')](_0xb51e('0x2c'),auth['isAuthenticated'](),controller[_0xb51e('0x65')]);router['delete'](_0xb51e('0x2e'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x66')]);router['delete'](_0xb51e('0x30'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x67')]);router['delete']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xb51e('0x5c')](_0xb51e('0x56'),auth[_0xb51e('0xa')](),controller[_0xb51e('0x68')]);router['delete']('/:id/api_key',auth[_0xb51e('0xa')](),controller[_0xb51e('0x69')]);module[_0xb51e('0x6a')]=router; \ No newline at end of file +var _0xf7e9=['getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','bulkCreate','post','addContacts','create','addQueues','diskStorage','server/files/images/','format','%s-%s','originalname','single','/:id/login','login','/:id/logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','destroy','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists'];(function(_0x574250,_0x3ec0d7){var _0x5e3d92=function(_0x5b3fe7){while(--_0x5b3fe7){_0x574250['push'](_0x574250['shift']());}};_0x5e3d92(++_0x3ec0d7);}(_0xf7e9,0xb2));var _0x9f7e=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xf7e9[_0x687ddc];return _0x441991;};'use strict';var multer=require(_0x9f7e('0x0'));var util=require('util');var path=require(_0x9f7e('0x1'));var timeout=require(_0x9f7e('0x2'));var express=require(_0x9f7e('0x3'));var router=express[_0x9f7e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9f7e('0x5'));var config=require(_0x9f7e('0x6'));var controller=require('./user.controller');router[_0x9f7e('0x7')]('/',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x9')]);router[_0x9f7e('0x7')](_0x9f7e('0xa'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0xb')]);router[_0x9f7e('0x7')](_0x9f7e('0xc'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0xd')]);router[_0x9f7e('0x7')]('/:id',auth[_0x9f7e('0x8')](),controller['show']);router[_0x9f7e('0x7')](_0x9f7e('0xe'),controller[_0x9f7e('0xf')]);router[_0x9f7e('0x7')](_0x9f7e('0x10'),auth[_0x9f7e('0x8')](),controller['getContacts']);router[_0x9f7e('0x7')](_0x9f7e('0x11'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x12')]);router['get']('/:id/queues_rt',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x13')]);router[_0x9f7e('0x7')](_0x9f7e('0x14'),auth['isAuthenticated'](),controller['getGroups']);router[_0x9f7e('0x7')]('/:id/recordings',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x15')]);router[_0x9f7e('0x7')](_0x9f7e('0x16'),auth[_0x9f7e('0x8')](),controller['getScreenRecordings']);router[_0x9f7e('0x7')](_0x9f7e('0x17'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x18')]);router[_0x9f7e('0x7')]('/:id/openchannel/interactions',auth[_0x9f7e('0x8')](),controller['getOpenchannelInteractions']);router[_0x9f7e('0x7')]('/:id/mail/interactions',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x19')]);router[_0x9f7e('0x7')](_0x9f7e('0x1a'),auth['isAuthenticated'](),controller[_0x9f7e('0x1b')]);router[_0x9f7e('0x7')](_0x9f7e('0x1c'),auth['isAuthenticated'](),controller[_0x9f7e('0x1d')]);router['get'](_0x9f7e('0x1e'),auth[_0x9f7e('0x8')](),controller['getWhatsappInteractions']);router[_0x9f7e('0x7')](_0x9f7e('0x1f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x20')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x9f7e('0x21')]);router['get']('/:id/agents',auth['isAuthenticated'](),controller[_0x9f7e('0x22')]);router[_0x9f7e('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x9f7e('0x23')]);router[_0x9f7e('0x7')]('/:id/fax_accounts',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x24')]);router[_0x9f7e('0x7')](_0x9f7e('0x25'),auth['isAuthenticated'](),controller[_0x9f7e('0x26')]);router[_0x9f7e('0x7')](_0x9f7e('0x27'),auth['isAuthenticated'](),controller[_0x9f7e('0x28')]);router[_0x9f7e('0x7')](_0x9f7e('0x29'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x2a')]);router[_0x9f7e('0x7')](_0x9f7e('0x2b'),auth['isAuthenticated'](),controller[_0x9f7e('0x2c')]);router[_0x9f7e('0x7')](_0x9f7e('0x2d'),auth['isAuthenticated'](),controller[_0x9f7e('0x2e')]);router['get'](_0x9f7e('0x2f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x30')]);router[_0x9f7e('0x7')](_0x9f7e('0x31'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x32')]);router[_0x9f7e('0x7')](_0x9f7e('0x33'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x34')]);router['post']('/create_many',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x35')]);router[_0x9f7e('0x36')](_0x9f7e('0x10'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x37')]);router[_0x9f7e('0x36')]('/',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x38')]);router[_0x9f7e('0x36')](_0x9f7e('0x11'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x39')]);var upload=multer({'storage':multer[_0x9f7e('0x3a')]({'destination':function(_0x136c3c,_0x36fa52,_0x4497d0){_0x4497d0(null,path['join'](config['root'],_0x9f7e('0x3b')));},'filename':function(_0x4cf2a6,_0x59dcf3,_0x4fe598){_0x4fe598(null,util[_0x9f7e('0x3c')](_0x9f7e('0x3d'),Date['now'](),_0x59dcf3[_0x9f7e('0x3e')]));}})});router[_0x9f7e('0x36')](_0x9f7e('0xe'),upload[_0x9f7e('0x3f')]('file'),controller['addAvatar']);router['post'](_0x9f7e('0x40'),auth['isAuthenticated'](),controller[_0x9f7e('0x41')]);router[_0x9f7e('0x36')](_0x9f7e('0x42'),auth[_0x9f7e('0x8')](),controller['logout']);router['post']('/:id/pause',auth[_0x9f7e('0x8')](),controller['pause']);router['post'](_0x9f7e('0x43'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x44')]);router['post'](_0x9f7e('0x1f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x45')]);router[_0x9f7e('0x36')](_0x9f7e('0x46'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x47')]);router[_0x9f7e('0x36')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x9f7e('0x48')]);router[_0x9f7e('0x36')](_0x9f7e('0x49'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x4a')]);router['post'](_0x9f7e('0x4b'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x4c')]);router[_0x9f7e('0x36')](_0x9f7e('0x4d'),auth[_0x9f7e('0x8')](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x4e')]);router[_0x9f7e('0x36')](_0x9f7e('0x4f'),auth['isAuthenticated'](),controller[_0x9f7e('0x50')]);router[_0x9f7e('0x36')](_0x9f7e('0x25'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x51')]);router[_0x9f7e('0x36')](_0x9f7e('0x27'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x52')]);router[_0x9f7e('0x36')]('/:id/sms_accounts',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x53')]);router['post']('/:id/chat_websites',auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x54')]);router[_0x9f7e('0x36')](_0x9f7e('0x2d'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x55')]);router[_0x9f7e('0x36')](_0x9f7e('0x2f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x56')]);router[_0x9f7e('0x36')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x9f7e('0x57')]);router[_0x9f7e('0x58')](_0x9f7e('0x59'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x5a')]);router['put'](_0x9f7e('0x5b'),auth[_0x9f7e('0x8')](),controller['changePassword']);router[_0x9f7e('0x5c')](_0x9f7e('0x11'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x5d')]);router[_0x9f7e('0x5c')](_0x9f7e('0x1f'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x9f7e('0x5c')](_0x9f7e('0x59'),auth['isAuthenticated'](),controller[_0x9f7e('0x5e')]);router[_0x9f7e('0x5c')](_0x9f7e('0x46'),auth[_0x9f7e('0x8')](),controller['removeChatInteractions']);router['delete'](_0x9f7e('0x5f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x60')]);router['delete'](_0x9f7e('0x49'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete'](_0x9f7e('0x4b'),auth['isAuthenticated'](),controller[_0x9f7e('0x61')]);router[_0x9f7e('0x5c')]('/:id/openchannel_interactions',auth[_0x9f7e('0x8')](),controller['removeOpenchannelInteractions']);router[_0x9f7e('0x5c')](_0x9f7e('0x62'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x63')]);router[_0x9f7e('0x5c')](_0x9f7e('0x4f'),auth['isAuthenticated'](),controller[_0x9f7e('0x64')]);router[_0x9f7e('0x5c')](_0x9f7e('0x25'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x65')]);router['delete'](_0x9f7e('0x27'),auth['isAuthenticated'](),controller[_0x9f7e('0x66')]);router[_0x9f7e('0x5c')](_0x9f7e('0x29'),auth[_0x9f7e('0x8')](),controller['removeSmsAccounts']);router[_0x9f7e('0x5c')](_0x9f7e('0x2b'),auth['isAuthenticated'](),controller[_0x9f7e('0x67')]);router[_0x9f7e('0x5c')](_0x9f7e('0x2d'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x68')]);router[_0x9f7e('0x5c')](_0x9f7e('0x2f'),auth[_0x9f7e('0x8')](),controller[_0x9f7e('0x69')]);router[_0x9f7e('0x5c')](_0x9f7e('0x33'),auth[_0x9f7e('0x8')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 531b998..c76314e 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 _0xe4a2=['accountcode','callerid','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','name','setDataValue','fullname','getDataValue','email','toLowerCase','admin','agent','telephone','local','INTEGER','internal'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xe4a2,0x106));var _0x2e4a=function(_0x3dcb03,_0x29f542){_0x3dcb03=_0x3dcb03-0x0;var _0x4c42b1=_0xe4a2[_0x3dcb03];return _0x4c42b1;};'use strict';var Sequelize=require(_0x2e4a('0x0'));var moment=require(_0x2e4a('0x1'));var util=require('util');var _=require(_0x2e4a('0x2'));module[_0x2e4a('0x3')]={'name':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'unique':_0x2e4a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1b4a77){this[_0x2e4a('0x6')](_0x2e4a('0x5'),_0x1b4a77);this['setDataValue']('defaultuser',_0x1b4a77);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'set':function(_0x4f23c0){this[_0x2e4a('0x6')](_0x2e4a('0x7'),_0x4f23c0);this[_0x2e4a('0x6')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4f23c0,this[_0x2e4a('0x8')]('internal')));}},'alias':{'type':Sequelize[_0x2e4a('0x4')]},'email':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'unique':_0x2e4a('0x9'),'validate':{'isEmail':!![]},'set':function(_0x398c67){if(_0x398c67){this[_0x2e4a('0x6')](_0x2e4a('0x9'),_0x398c67[_0x2e4a('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0x2e4a('0xb'),'user',_0x2e4a('0xc'),_0x2e4a('0xd')),'allowNull':![]},'password':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':_0x2e4a('0xe')},'internal':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5135e6){this[_0x2e4a('0x6')](_0x2e4a('0x10'),_0x5135e6);this[_0x2e4a('0x6')](_0x2e4a('0x11'),_0x5135e6);this['setDataValue'](_0x2e4a('0x12'),util[_0x2e4a('0x13')]('\x22%s\x22\x20<%s>',this[_0x2e4a('0x8')]('fullname'),_0x5135e6));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2e4a('0x4')]},'mobile':{'type':Sequelize[_0x2e4a('0x4')]},'address':{'type':Sequelize[_0x2e4a('0x4')]},'zipcode':{'type':Sequelize[_0x2e4a('0x4')]},'userpic':{'type':Sequelize[_0x2e4a('0x4')]},'city':{'type':Sequelize[_0x2e4a('0x4')]},'country':{'type':Sequelize[_0x2e4a('0x4')]},'online':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2e4a('0x15')]},'voicePause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':_0x2e4a('0x16')},'lastPauseAt':{'type':Sequelize[_0x2e4a('0x15')]},'chatCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2e4a('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'defaultValue':_0x2e4a('0x17')},'ipaddr':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x2e4a('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x19'),_0x2e4a('0x1a'),_0x2e4a('0x1b')),'allowNull':!![],'defaultValue':_0x2e4a('0x19')},'context':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'defaultValue':_0x2e4a('0x1c')},'callingpres':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x1d'),_0x2e4a('0x1e'),_0x2e4a('0x1f'),_0x2e4a('0x20'),_0x2e4a('0x21'),_0x2e4a('0x22'),_0x2e4a('0x23'),_0x2e4a('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2e4a('0x25'),'set':function(_0x31ba15){this[_0x2e4a('0x6')](_0x2e4a('0x26'),_0x31ba15?_0x31ba15[_0x2e4a('0x27')](','):null);},'get':function(){return this[_0x2e4a('0x8')](_0x2e4a('0x26'))?this[_0x2e4a('0x8')]('transport')[_0x2e4a('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2e4a('0x18')]('rfc2833',_0x2e4a('0x29'),_0x2e4a('0x2a'),_0x2e4a('0x2b'),_0x2e4a('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no',_0x2e4a('0x2e'),_0x2e4a('0x2f'),_0x2e4a('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2e4a('0x31'),'set':function(_0x3c30e0){this['setDataValue'](_0x2e4a('0x32'),_0x3c30e0?_0x3c30e0['join'](','):null);},'get':function(){return this[_0x2e4a('0x8')]('nat')?this['getDataValue'](_0x2e4a('0x32'))[_0x2e4a('0x28')](','):null;},'comment':_0x2e4a('0x33')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2e4a('0x4')]},'pickupgroup':{'type':Sequelize[_0x2e4a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x2e4a('0x4')]},'language':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2e4a('0x4')]},'disallow':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'defaultValue':_0x2e4a('0x34')},'allow':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xd66e31){this['setDataValue'](_0x2e4a('0x35'),_0xd66e31?_0xd66e31[_0x2e4a('0x27')](';'):_0x2e4a('0x36'));},'get':function(){return this[_0x2e4a('0x8')]('allow')?this[_0x2e4a('0x8')](_0x2e4a('0x35'))[_0x2e4a('0x28')](';'):null;},'comment':_0x2e4a('0x37')},'autoframing':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'set':function(_0x173a20){this[_0x2e4a('0x6')](_0x2e4a('0x38'),_0x173a20?_0x173a20[_0x2e4a('0x27')](','):null);},'get':function(){return this[_0x2e4a('0x8')]('insecure')?this[_0x2e4a('0x8')](_0x2e4a('0x38'))[_0x2e4a('0x28')](','):null;},'comment':_0x2e4a('0x39')},'trustrpid':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2e4a('0x18')]('yes','no',_0x2e4a('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![],'defaultValue':_0x2e4a('0x2d')},'busylevel':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2e4a('0x18')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x3b'),_0x2e4a('0x3c'),_0x2e4a('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2e4a('0x18')]('uac',_0x2e4a('0x3e')),'allowNull':!![],'defaultValue':_0x2e4a('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x2e4a('0x2d')},'keepalive':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2e4a('0x18')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no',_0x2e4a('0x3f'),_0x2e4a('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x41'),_0x2e4a('0x42'),_0x2e4a('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2e4a('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x2e4a('0x2d'),'no',_0x2e4a('0x2e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2e4a('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x2e4a('0x15')]},'showWebBar':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0,'set':function(_0x256c53){this[_0x2e4a('0x6')](_0x2e4a('0x44'),_0x256c53);var _0x1a2829=this[_0x2e4a('0x45')]({'plain':!![]});switch(_0x256c53){case 0x0:case 0x1:var _0x52da4e=_0x1a2829[_0x2e4a('0x26')]?_[_0x2e4a('0x46')](_0x1a2829['transport'])?_0x1a2829[_0x2e4a('0x26')]['join']():_0x1a2829['transport']:_0x2e4a('0x25');if(_0x52da4e==='wss'){_0x52da4e=_0x2e4a('0x25');}this[_0x2e4a('0x6')](_0x2e4a('0x26'),_0x52da4e);this[_0x2e4a('0x6')](_0x2e4a('0x47'),'no');this[_0x2e4a('0x6')](_0x2e4a('0x48'),null);this[_0x2e4a('0x6')](_0x2e4a('0x49'),null);this['setDataValue'](_0x2e4a('0x4a'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4b'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4c'),null);this['setDataValue'](_0x2e4a('0x4d'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4e'),null);this[_0x2e4a('0x6')](_0x2e4a('0x4f'),null);this[_0x2e4a('0x6')](_0x2e4a('0x50'),'no');break;case 0x2:this[_0x2e4a('0x6')](_0x2e4a('0x26'),_0x2e4a('0x51'));this['setDataValue'](_0x2e4a('0x47'),'yes');this[_0x2e4a('0x6')](_0x2e4a('0x48'),_0x2e4a('0x2d'));this[_0x2e4a('0x6')](_0x2e4a('0x49'),_0x2e4a('0x2d'));this[_0x2e4a('0x6')]('icesupport',_0x2e4a('0x2d'));this[_0x2e4a('0x6')](_0x2e4a('0x4b'),_0x2e4a('0x2d'));this[_0x2e4a('0x6')](_0x2e4a('0x4c'),'no');this[_0x2e4a('0x6')]('dtlssetup',_0x2e4a('0x43'));this[_0x2e4a('0x6')](_0x2e4a('0x4e'),_0x1a2829[_0x2e4a('0x4e')]||_0x2e4a('0x52'));this[_0x2e4a('0x6')](_0x2e4a('0x4f'),_0x1a2829[_0x2e4a('0x4f')]||_0x2e4a('0x53'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x2e4a('0x54')],'set':function(_0x28b433){this[_0x2e4a('0x6')]('permissions',_0x28b433?_0x28b433[_0x2e4a('0x27')](','):[]);},'get':function(){return this[_0x2e4a('0x8')](_0x2e4a('0x55'))?_['map'](this[_0x2e4a('0x8')](_0x2e4a('0x55'))[_0x2e4a('0x28')](','),function(_0x443a37){return parseInt(_0x443a37,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2e4a('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2e4a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2e4a('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2e4a('0x18')](_0x2e4a('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2e4a('0x8')](_0x2e4a('0x56'))?this[_0x2e4a('0x8')](_0x2e4a('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2e4a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2e4a('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![],'set':function(_0x340714){if(typeof _0x340714===_0x2e4a('0x57')){var _0x4884f3=_0x340714==='1'?!![]:_0x340714==='0'?![]:_0x340714===_0x2e4a('0x58')?!![]:_0x340714==='false'?![]:![];this[_0x2e4a('0x6')](_0x2e4a('0x59'),_0x4884f3);}else{this['setDataValue'](_0x2e4a('0x59'),_0x340714);}}},'blocked':{'type':Sequelize[_0x2e4a('0x14')],'defaultValue':![],'set':function(_0x3823cb){this['setDataValue'](_0x2e4a('0x5a'),_0x3823cb);if(_0x3823cb===!![]){this[_0x2e4a('0x6')](_0x2e4a('0x5b'),moment());this['setDataValue'](_0x2e4a('0x5c'),0x0);}else{this[_0x2e4a('0x6')](_0x2e4a('0x5b'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2e4a('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x12f4=['auto','rfc2833','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','nonat','showWebBar','get','udp','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','map','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','lodash','STRING','setDataValue','name','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN','DEFAULT\x20PAUSE','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband'];(function(_0x4ab6a2,_0x17b9d6){var _0x2ce0a6=function(_0x6fcdbf){while(--_0x6fcdbf){_0x4ab6a2['push'](_0x4ab6a2['shift']());}};_0x2ce0a6(++_0x17b9d6);}(_0x12f4,0x1f1));var _0x412f=function(_0x43cbe0,_0x3e7a42){_0x43cbe0=_0x43cbe0-0x0;var _0x121cb8=_0x12f4[_0x43cbe0];return _0x121cb8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x412f('0x0'));module['exports']={'name':{'type':Sequelize[_0x412f('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2545e1){this[_0x412f('0x2')](_0x412f('0x3'),_0x2545e1);this['setDataValue']('defaultuser',_0x2545e1);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x22573c){this[_0x412f('0x2')](_0x412f('0x4'),_0x22573c);this[_0x412f('0x2')](_0x412f('0x5'),util[_0x412f('0x6')]('\x22%s\x22\x20<%s>',_0x22573c,this[_0x412f('0x7')](_0x412f('0x8'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x412f('0x9'),'validate':{'isEmail':!![]},'set':function(_0x22dd52){if(_0x22dd52){this[_0x412f('0x2')](_0x412f('0x9'),_0x22dd52[_0x412f('0xa')]());}}},'role':{'type':Sequelize[_0x412f('0xb')]('admin',_0x412f('0xc'),_0x412f('0xd'),_0x412f('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x412f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x412f('0x1')],'defaultValue':_0x412f('0xf')},'internal':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':![],'unique':_0x412f('0x8'),'set':function(_0xc0bfef){this['setDataValue'](_0x412f('0x8'),_0xc0bfef);this['setDataValue'](_0x412f('0x11'),_0xc0bfef);this[_0x412f('0x2')](_0x412f('0x5'),util['format'](_0x412f('0x12'),this[_0x412f('0x7')](_0x412f('0x4')),_0xc0bfef));}},'salt':{'type':Sequelize[_0x412f('0x1')]},'phone':{'type':Sequelize[_0x412f('0x1')]},'mobile':{'type':Sequelize[_0x412f('0x1')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x412f('0x1')]},'userpic':{'type':Sequelize[_0x412f('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x412f('0x1')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x412f('0x13')]},'voicePause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x412f('0x1')],'defaultValue':_0x412f('0x15')},'lastPauseAt':{'type':Sequelize[_0x412f('0x13')]},'chatCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x412f('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x412f('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x412f('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x16'),'user',_0x412f('0x17')),'allowNull':!![],'defaultValue':_0x412f('0x16')},'context':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x18'),_0x412f('0x19'),_0x412f('0x1a'),_0x412f('0x1b'),_0x412f('0x1c'),'PROHIB_PASSED_SCREEN',_0x412f('0x1d'),_0x412f('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![],'defaultValue':'udp','set':function(_0x218f12){this[_0x412f('0x2')](_0x412f('0x1f'),_0x218f12?_0x218f12[_0x412f('0x20')](','):null);},'get':function(){return this[_0x412f('0x7')](_0x412f('0x1f'))?this[_0x412f('0x7')](_0x412f('0x1f'))[_0x412f('0x21')](','):null;},'comment':_0x412f('0x22')},'dtmfmode':{'type':Sequelize[_0x412f('0xb')]('rfc2833',_0x412f('0x23'),'shortinfo',_0x412f('0x24'),_0x412f('0x25')),'allowNull':!![],'defaultValue':_0x412f('0x26')},'directmedia':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no','nonat',_0x412f('0x28'),_0x412f('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x412f('0x2a'),'set':function(_0xc58ac1){this[_0x412f('0x2')]('nat',_0xc58ac1?_0xc58ac1[_0x412f('0x20')](','):null);},'get':function(){return this[_0x412f('0x7')](_0x412f('0x2b'))?this['getDataValue'](_0x412f('0x2b'))[_0x412f('0x21')](','):null;},'comment':_0x412f('0x2c')},'callgroup':{'type':Sequelize[_0x412f('0x1')]},'namedcallgroup':{'type':Sequelize[_0x412f('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x412f('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x412f('0x1')]},'disallow':{'type':Sequelize[_0x412f('0x1')],'allowNull':![],'defaultValue':_0x412f('0x2d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x412f('0x2e'),'set':function(_0x3e46fb){this[_0x412f('0x2')]('allow',_0x3e46fb?_0x3e46fb[_0x412f('0x20')](';'):_0x412f('0x2e'));},'get':function(){return this['getDataValue'](_0x412f('0x2f'))?this[_0x412f('0x7')](_0x412f('0x2f'))['split'](';'):null;},'comment':_0x412f('0x30')},'autoframing':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![],'set':function(_0x3bc2f8){this[_0x412f('0x2')](_0x412f('0x31'),_0x3bc2f8?_0x3bc2f8[_0x412f('0x20')](','):null);},'get':function(){return this[_0x412f('0x7')](_0x412f('0x31'))?this['getDataValue'](_0x412f('0x31'))[_0x412f('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no',_0x412f('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x412f('0xb')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x412f('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':_0x412f('0x27')},'busylevel':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'template':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no',_0x412f('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x35'),_0x412f('0x36'),_0x412f('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x412f('0xb')]('uac',_0x412f('0x38')),'allowNull':!![],'defaultValue':_0x412f('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no',_0x412f('0x39'),_0x412f('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x412f('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x412f('0x3b'),_0x412f('0x3c'),_0x412f('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x412f('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x412f('0xb')]('yes','no',_0x412f('0x3e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x412f('0x13')]},'showWebBar':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0,'set':function(_0x305757){this['setDataValue'](_0x412f('0x3f'),_0x305757);var _0x32c9be=this[_0x412f('0x40')]({'plain':!![]});switch(_0x305757){case 0x0:case 0x1:var _0x46da37=_0x32c9be[_0x412f('0x1f')]?_['isArray'](_0x32c9be[_0x412f('0x1f')])?_0x32c9be[_0x412f('0x1f')][_0x412f('0x20')]():_0x32c9be[_0x412f('0x1f')]:_0x412f('0x41');if(_0x46da37==='wss'){_0x46da37=_0x412f('0x41');}this['setDataValue'](_0x412f('0x1f'),_0x46da37);this[_0x412f('0x2')]('encryption','no');this['setDataValue'](_0x412f('0x42'),null);this[_0x412f('0x2')](_0x412f('0x43'),null);this[_0x412f('0x2')]('icesupport',null);this[_0x412f('0x2')](_0x412f('0x44'),null);this[_0x412f('0x2')](_0x412f('0x45'),null);this[_0x412f('0x2')](_0x412f('0x46'),null);this[_0x412f('0x2')](_0x412f('0x47'),null);this[_0x412f('0x2')](_0x412f('0x48'),null);this[_0x412f('0x2')](_0x412f('0x49'),'no');break;case 0x2:this[_0x412f('0x2')]('transport','wss');this[_0x412f('0x2')]('encryption',_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x42'),_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x43'),_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x4a'),_0x412f('0x27'));this[_0x412f('0x2')](_0x412f('0x44'),_0x412f('0x27'));this[_0x412f('0x2')]('dtlsverify','no');this[_0x412f('0x2')](_0x412f('0x46'),_0x412f('0x3d'));this['setDataValue'](_0x412f('0x47'),_0x32c9be[_0x412f('0x47')]||_0x412f('0x4b'));this[_0x412f('0x2')]('dtlsprivatekey',_0x32c9be['dtlsprivatekey']||_0x412f('0x4c'));this[_0x412f('0x2')]('rtcp_mux',_0x412f('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x412f('0x4d')],'set':function(_0x3bdfec){this[_0x412f('0x2')]('permissions',_0x3bdfec?_0x3bdfec[_0x412f('0x20')](','):[]);},'get':function(){return this[_0x412f('0x7')]('permissions')?_[_0x412f('0x4e')](this[_0x412f('0x7')](_0x412f('0x4f'))[_0x412f('0x21')](','),function(_0x362eb0){return parseInt(_0x362eb0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x412f('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x412f('0x1')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x412f('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x412f('0xb')](_0x412f('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x412f('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x412f('0x1')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x412f('0x50')],'get':function(){return this[_0x412f('0x7')](_0x412f('0x51'))?this[_0x412f('0x7')](_0x412f('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x412f('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x412f('0x1')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![],'set':function(_0x389fa0){if(typeof _0x389fa0===_0x412f('0x52')){var _0x175692=_0x389fa0==='1'?!![]:_0x389fa0==='0'?![]:_0x389fa0===_0x412f('0x53')?!![]:_0x389fa0===_0x412f('0x54')?![]:![];this[_0x412f('0x2')](_0x412f('0x55'),_0x175692);}else{this[_0x412f('0x2')](_0x412f('0x55'),_0x389fa0);}}},'blocked':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![],'set':function(_0x22123f){this[_0x412f('0x2')](_0x412f('0x56'),_0x22123f);if(_0x22123f===!![]){this[_0x412f('0x2')]('blockedAt',moment());this[_0x412f('0x2')](_0x412f('0x57'),0x0);}else{this[_0x412f('0x2')](_0x412f('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x412f('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x412f('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x412f('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f73277e..7b29b30 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 _0x8200=['addContacts','omit','ids','telephone','admin','telephones','users','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','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','SELECT','from','mailbox','VoiceMail','email','permissions','101','113','110','105','106','107','108','100','111','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','Setting','findOne','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','spread','toLowerCase','QueueId','emit','Queue:save','voice','push','SIP/%s','each','upsert','remove','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','hasOwnProperty','List','color','tag','getQueues','Queue','Unknown\x20role','order','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','UserVoiceQueue.penalty','MemberReport','all','YYYY-MM-DD\x20HH:mm:ss','forEach','device','PAUSE','LOGININPAUSE','concat','resolve','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','smsPause','whatsapppause','lastPauseAt','manual','mail','chat','fax','whatsapp','openchannel','getTeams','addTeams','getVoiceQueues','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','penalty','removeTeams','Team','Chat','Openchannel','removeAgent','getLists','CmList','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_sms_interactions:save','removeSmsInteractions','isArray','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','CmHopper','$and','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./user.socket','register','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','user','Agents','agent','Telephones','filter','ignore','map','value','includes','role','find','name','end','stack','send','index','User','rawAttributes','fieldName','type','key','differenceBy','password','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','where','merge','sequelize','lower','col','options','includeAll','include','findAll','rows','show','params','salt','bulkCreate','body','describe'];(function(_0x570db0,_0x1fd128){var _0x4346f4=function(_0x16f72d){while(--_0x16f72d){_0x570db0['push'](_0x570db0['shift']());}};_0x4346f4(++_0x1fd128);}(_0x8200,0xfa));var _0x0820=function(_0x5e97cb,_0x315dd8){_0x5e97cb=_0x5e97cb-0x0;var _0x25cabe=_0x8200[_0x5e97cb];return _0x25cabe;};'use strict';var pdf=require(_0x0820('0x0'));var emlformat=require(_0x0820('0x1'));var rimraf=require(_0x0820('0x2'));var zipdir=require(_0x0820('0x3'));var jsonpatch=require(_0x0820('0x4'));var rp=require(_0x0820('0x5'));var moment=require('moment');var BPromise=require(_0x0820('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0820('0x7'));var fs=require('fs');var _=require(_0x0820('0x8'));var squel=require(_0x0820('0x9'));var crypto=require(_0x0820('0xa'));var jsforce=require(_0x0820('0xb'));var deskjs=require(_0x0820('0xc'));var toCsv=require(_0x0820('0xd'));var querystring=require(_0x0820('0xe'));var Papa=require(_0x0820('0xf'));var Redis=require(_0x0820('0x10'));var authService=require(_0x0820('0x11'));var qs=require(_0x0820('0x12'));var as=require(_0x0820('0x13'));var hardwareService=require(_0x0820('0x14'));var logger=require(_0x0820('0x15'))(_0x0820('0x16'));var utils=require(_0x0820('0x17'));var config=require(_0x0820('0x18'));var db=require(_0x0820('0x19'))['db'];config['redis']=_[_0x0820('0x1a')](config[_0x0820('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0820('0x1b')]));require(_0x0820('0x1c'))[_0x0820('0x1d')](socket);var jayson=require(_0x0820('0x1e'));var client=jayson[_0x0820('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x4c9f04,_0x34928c,_0x528ade){if(_0x528ade){var _0x25b7c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25b7c0['test'](_0x34928c)){return _0x4c9f04;}else{throw new db[(_0x0820('0x20'))]['ValidationError'](_0x0820('0x21'));}}else{return _0x4c9f04;}}function respondWithRpcPromise(_0x475ba5,_0x46eb37,_0x1584a2,_0x53a931){return new BPromise(function(_0x1f80c0,_0xfb0fd7){var _0x450824=_0x53a931||client;return _0x450824[_0x0820('0x22')](_0x475ba5,_0x1584a2)['then'](function(_0x5c8488){logger[_0x0820('0x23')](_0x0820('0x24'),_0x46eb37,_0x0820('0x25'));logger[_0x0820('0x26')](_0x0820('0x27'),_0x46eb37,_0x0820('0x25'),JSON[_0x0820('0x28')](_0x5c8488));if(_0x5c8488[_0x0820('0x29')]){if(_0x5c8488[_0x0820('0x29')]['code']===0x1f4){logger[_0x0820('0x29')](_0x0820('0x24'),_0x46eb37,_0x5c8488[_0x0820('0x29')][_0x0820('0x2a')]);return _0xfb0fd7(_0x5c8488['error'][_0x0820('0x2a')]);}logger[_0x0820('0x29')](_0x0820('0x24'),_0x46eb37,_0x5c8488['error']['message']);return _0x1f80c0(_0x5c8488[_0x0820('0x29')][_0x0820('0x2a')]);}else{logger[_0x0820('0x23')](_0x0820('0x24'),_0x46eb37,_0x0820('0x25'));_0x1f80c0(_0x5c8488[_0x0820('0x2b')][_0x0820('0x2a')]);}})[_0x0820('0x2c')](function(_0x462569){logger[_0x0820('0x29')](_0x0820('0x24'),_0x46eb37,_0x462569);_0xfb0fd7(_0x462569);});});}function respondWithStatusCode(_0x22ac0c,_0x5e38fe){_0x5e38fe=_0x5e38fe||0xcc;return function(_0x26025e){if(_0x26025e){return _0x22ac0c[_0x0820('0x2d')](_0x5e38fe);}return _0x22ac0c[_0x0820('0x2e')](_0x5e38fe)['end']();};}function respondWithResult(_0x4c2fb7,_0x3caa8e){_0x3caa8e=_0x3caa8e||0xc8;return function(_0x535517){if(_0x535517){return _0x4c2fb7[_0x0820('0x2e')](_0x3caa8e)[_0x0820('0x2f')](_0x535517);}};}function respondWithFilteredResult(_0x213425,_0x3a1bb9){return function(_0x3cfdf6){if(_0x3cfdf6){var _0x52b441=_0x3cfdf6[_0x0820('0x30')],_0x585cd0=_0x3a1bb9['offset'],_0x4165ff=_0x3a1bb9[_0x0820('0x31')]+_0x3a1bb9[_0x0820('0x32')],_0x28c99a;if(_0x4165ff>=_0x52b441){_0x4165ff=_0x52b441;_0x28c99a=0xc8;}else{_0x28c99a=0xce;}_0x213425[_0x0820('0x2e')](_0x28c99a);return _0x213425[_0x0820('0x33')](_0x0820('0x34'),_0x585cd0+'-'+_0x4165ff+'/'+_0x52b441)[_0x0820('0x2f')](_0x3cfdf6);}return null;};}function patchUpdates(_0x2eb841){return function(_0x31a5c4){try{jsonpatch['apply'](_0x31a5c4,_0x2eb841,!![]);}catch(_0x42aac9){return BPromise['reject'](_0x42aac9);}return _0x31a5c4[_0x0820('0x35')]();};}function saveUpdates(_0x43ee49,_0x4df43c){return function(_0x18c5b5){if(_0x18c5b5){return _0x18c5b5[_0x0820('0x36')](_0x43ee49)[_0x0820('0x37')](function(_0x223fa8){return _0x223fa8;});}return null;};}function removeEntity(_0xcf6619,_0x4f0d02){return function(_0x5af9d2){if(_0x5af9d2){return _0x5af9d2[_0x0820('0x38')]()[_0x0820('0x37')](function(){var _0x3fe06d=_0x5af9d2['get']({'plain':!![]});var _0x1d9bdb=[{'name':'Users','value':_0x0820('0x39'),'ignore':!![]},{'name':_0x0820('0x3a'),'value':_0x0820('0x3b'),'ignore':![]},{'name':_0x0820('0x3c'),'value':'telephone','ignore':![]}];var _0xfaf176=_(_0x1d9bdb)[_0x0820('0x3d')](_0x0820('0x3e'))[_0x0820('0x3f')](_0x0820('0x40'))['value']();if(_[_0x0820('0x41')](_0xfaf176,_0x3fe06d[_0x0820('0x42')])){return;}var _0x7ca105=_[_0x0820('0x43')](_0x1d9bdb,['value',_0x3fe06d[_0x0820('0x42')]])[_0x0820('0x44')];return db['UserProfileResource'][_0x0820('0x38')]({'where':{'type':_0x7ca105,'resourceId':_0x3fe06d['id']}})[_0x0820('0x37')](function(){return _0x5af9d2;});})[_0x0820('0x37')](function(){_0xcf6619[_0x0820('0x2e')](0xcc)[_0x0820('0x45')]();});}};}function handleEntityNotFound(_0x17b321,_0x6ebbba){return function(_0x5d160d){if(!_0x5d160d){_0x17b321[_0x0820('0x2d')](0x194);}return _0x5d160d;};}function handleError(_0x15a9cd,_0x4b9c2a){_0x4b9c2a=_0x4b9c2a||0x1f4;return function(_0x4648b9){logger['error'](_0x4648b9[_0x0820('0x46')]);if(_0x4648b9[_0x0820('0x44')]){delete _0x4648b9[_0x0820('0x44')];}_0x15a9cd[_0x0820('0x2e')](_0x4b9c2a)[_0x0820('0x47')](_0x4648b9);};}exports[_0x0820('0x48')]=function(_0x4e8a94,_0x5eb889){var _0x2a7fe8={},_0x4053b8={},_0xcf0a48={'count':0x0,'rows':[]};var _0x3baac7=_[_0x0820('0x3f')](db[_0x0820('0x49')][_0x0820('0x4a')],function(_0x2fcafa){return{'name':_0x2fcafa[_0x0820('0x4b')],'type':_0x2fcafa[_0x0820('0x4c')][_0x0820('0x4d')]};});_0x4053b8['model']=_[_0x0820('0x4e')](_[_0x0820('0x3f')](_0x3baac7,_0x0820('0x44')),[_0x0820('0x4f'),'salt']);_0x4053b8[_0x0820('0x50')]=_[_0x0820('0x51')](_0x4e8a94[_0x0820('0x50')]);_0x4053b8[_0x0820('0x52')]=_[_0x0820('0x53')](_0x4053b8[_0x0820('0x54')],_0x4053b8[_0x0820('0x50')]);_0x2a7fe8[_0x0820('0x55')]=_[_0x0820('0x53')](_0x4053b8[_0x0820('0x54')],qs[_0x0820('0x56')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x56')]));_0x2a7fe8['attributes']=_0x2a7fe8[_0x0820('0x55')][_0x0820('0x57')]?_0x2a7fe8[_0x0820('0x55')]:_0x4053b8[_0x0820('0x54')];if(!_0x4e8a94[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x2a7fe8[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x32')]);_0x2a7fe8[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x31')]);}_0x2a7fe8['order']=qs[_0x0820('0x59')](_0x4e8a94[_0x0820('0x50')][_0x0820('0x59')]);_0x2a7fe8['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x4e8a94['query'],_0x4053b8[_0x0820('0x52')]),_0x3baac7);if(_0x4e8a94[_0x0820('0x50')][_0x0820('0x3d')]){_0x2a7fe8[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x2a7fe8['where'],{'$or':_['map'](_0x3baac7,function(_0x3a23b9){if(_0x3a23b9[_0x0820('0x4c')]!=='VIRTUAL'){return db[_0x0820('0x5d')][_0x0820('0x5b')](db[_0x0820('0x5d')]['fn'](_0x0820('0x5e'),db['sequelize'][_0x0820('0x5f')](_0x3a23b9['name'])),{'$like':db[_0x0820('0x5d')]['fn'](_0x0820('0x5e'),'%'+_0x4e8a94[_0x0820('0x50')][_0x0820('0x3d')]+'%')});}})});}_0x2a7fe8=_[_0x0820('0x5c')]({},_0x2a7fe8,_0x4e8a94[_0x0820('0x60')]);var _0x2da950={'where':_0x2a7fe8[_0x0820('0x5b')]};return db['User'][_0x0820('0x30')](_0x2da950)['then'](function(_0x36052a){_0xcf0a48[_0x0820('0x30')]=_0x36052a;if(_0x4e8a94[_0x0820('0x50')][_0x0820('0x61')]){_0x2a7fe8[_0x0820('0x62')]=[{'all':!![]}];}return db[_0x0820('0x49')][_0x0820('0x63')](_0x2a7fe8);})[_0x0820('0x37')](function(_0x327295){_0xcf0a48[_0x0820('0x64')]=_0x327295;return _0xcf0a48;})[_0x0820('0x37')](respondWithFilteredResult(_0x5eb889,_0x2a7fe8))[_0x0820('0x2c')](handleError(_0x5eb889,null));};exports[_0x0820('0x65')]=function(_0xa9554d,_0x32e06a){var _0x3d484d={'raw':![],'where':{'id':_0xa9554d[_0x0820('0x66')]['id']}},_0x38bf27={};_0x38bf27[_0x0820('0x54')]=_[_0x0820('0x4e')](_['keys'](db[_0x0820('0x49')]['rawAttributes']),['password',_0x0820('0x67')]);_0x38bf27[_0x0820('0x50')]=_[_0x0820('0x51')](_0xa9554d['query']);_0x38bf27['filters']=_[_0x0820('0x53')](_0x38bf27[_0x0820('0x54')],_0x38bf27[_0x0820('0x50')]);_0x3d484d['attributes']=_[_0x0820('0x53')](_0x38bf27[_0x0820('0x54')],qs[_0x0820('0x56')](_0xa9554d[_0x0820('0x50')]['fields']));_0x3d484d[_0x0820('0x55')]=_0x3d484d[_0x0820('0x55')]['length']?_0x3d484d[_0x0820('0x55')]:_0x38bf27['model'];if(_0xa9554d[_0x0820('0x50')][_0x0820('0x61')]){_0x3d484d[_0x0820('0x62')]=[{'all':!![]}];}_0x3d484d=_[_0x0820('0x5c')]({},_0x3d484d,_0xa9554d['options']);return db['User']['find'](_0x3d484d)[_0x0820('0x37')](handleEntityNotFound(_0x32e06a,null))[_0x0820('0x37')](respondWithResult(_0x32e06a,null))[_0x0820('0x2c')](handleError(_0x32e06a,null));};exports[_0x0820('0x68')]=function(_0x549559,_0x3a6120){return db[_0x0820('0x49')][_0x0820('0x68')](_0x549559['body'],{'raw':![],'individualHooks':!![]})[_0x0820('0x37')](respondWithResult(_0x3a6120,0xc9))[_0x0820('0x2c')](handleError(_0x3a6120,null));};exports[_0x0820('0x36')]=function(_0x235950,_0x4aea85){if(_0x235950[_0x0820('0x69')]['id']){delete _0x235950[_0x0820('0x69')]['id'];}delete _0x235950['body'][_0x0820('0x42')];return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x235950[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x4aea85,null))[_0x0820('0x37')](saveUpdates(_0x235950[_0x0820('0x69')],null))[_0x0820('0x37')](respondWithResult(_0x4aea85,null))[_0x0820('0x2c')](handleError(_0x4aea85,null));};exports[_0x0820('0x6a')]=function(_0x1dc580,_0x851998){return db[_0x0820('0x49')][_0x0820('0x6a')]()['then'](respondWithResult(_0x851998,null))[_0x0820('0x2c')](handleError(_0x851998,null));};exports[_0x0820('0x6b')]=function(_0x4c0178,_0x809e7,_0x4bdd66){return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x4c0178[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x809e7,null))[_0x0820('0x37')](function(_0x3aabcb){if(_0x3aabcb){return _0x3aabcb[_0x0820('0x6b')](_0x4c0178[_0x0820('0x69')]['ids'],_[_0x0820('0x6c')](_0x4c0178[_0x0820('0x69')],[_0x0820('0x6d'),'id'])||{});}})[_0x0820('0x37')](respondWithResult(_0x809e7,null))[_0x0820('0x2c')](handleError(_0x809e7,null));};var getLicense=function(_0x28a20c){return new BPromise(function(_0x2e4f7f,_0x100778){var _0x1e1e7d=0x0;_0x28a20c['body'][_0x0820('0x42')]===_0x0820('0x3b')&&_0x2e4f7f('agent\x20role');return db[_0x0820('0x49')][_0x0820('0x30')]({'where':{'$or':[{'role':_0x28a20c[_0x0820('0x69')][_0x0820('0x42')]===_0x0820('0x6e')?_0x0820('0x6e'):[_0x0820('0x6f'),_0x0820('0x39')]}]}})[_0x0820('0x37')](function(_0x179855){_0x1e1e7d=_0x179855;return require('../../config/license/util')['getLicense']();})[_0x0820('0x37')](function(_0x17fd34){var _0x4e6744=_0x28a20c[_0x0820('0x69')][_0x0820('0x42')]===_0x0820('0x6e')?_0x0820('0x70'):_0x0820('0x71');if(!_['isNil'](_0x17fd34[_0x4e6744])&&_0x1e1e7d>=_0x17fd34[_0x4e6744]){return _0x100778({'message':_0x0820('0x72')});}return _0x2e4f7f(util[_0x0820('0x73')](_0x0820('0x74'),_0x4e6744,_0x1e1e7d));})[_0x0820('0x2c')](function(_0x40a7ee){return _0x100778(_0x40a7ee);});});};exports[_0x0820('0x75')]=function(_0x4ca303,_0x5bb41f){return getLicense(_0x4ca303)[_0x0820('0x37')](function(_0x54c7bc){if(!_0x4ca303['body'][_0x0820('0x76')]){var _0x1429c8;return db['Setting']['findById'](0x1)[_0x0820('0x37')](function(_0x2ed3d7){return checkPasswordPattern(_0x2ed3d7,_0x4ca303[_0x0820('0x69')][_0x0820('0x4f')],_0x2ed3d7[_0x0820('0x77')]);})[_0x0820('0x37')](function(_0x2f979a){_0x1429c8=_0x2f979a[_0x0820('0x78')];return db[_0x0820('0x49')]['max'](_0x0820('0x76'));})[_0x0820('0x37')](function(_0x1a3622){if(_[_0x0820('0x79')](_0x1a3622)){if(_0x1429c8){_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]=_0x1429c8;}else{_0x4ca303['body'][_0x0820('0x76')]=0x1;}}else{if(_[_0x0820('0x79')](_0x1429c8)||_0x1429c8==_0x1a3622){_0x4ca303[_0x0820('0x69')]['internal']=_0x1a3622+0x1;}else if(_0x1429c8>_0x1a3622){_0x4ca303[_0x0820('0x69')]['internal']=_0x1429c8;}else{return db[_0x0820('0x5d')]['query'](_0x0820('0x7a'),{'type':db[_0x0820('0x5d')][_0x0820('0x7b')][_0x0820('0x7c')]})[_0x0820('0x37')](function(_0x132d95){if(_0x132d95&&_0x132d95[_0x0820('0x57')]){for(var _0x3e1458=0x0,_0xff06b8=_0x132d95['length'];_0x3e1458<_0xff06b8&&_[_0x0820('0x79')](_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]);_0x3e1458++){if(_0x1429c8<=_0x132d95[_0x3e1458][_0x0820('0x7d')]){_0x4ca303['body'][_0x0820('0x76')]=_0x132d95[_0x3e1458][_0x0820('0x7d')];}else if(_0x1429c8>_0x132d95[_0x3e1458][_0x0820('0x7d')]&&_0x1429c8<=_0x132d95[_0x3e1458]['to']){_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]=_0x1429c8;}}}if(_['isNil'](_0x4ca303['body'][_0x0820('0x76')])){_0x4ca303[_0x0820('0x69')][_0x0820('0x76')]=_0x1a3622+0x1;}});}}});}})[_0x0820('0x37')](function(){if(_0x4ca303['body']['voicemail']){_0x4ca303['body'][_0x0820('0x7e')]=_0x4ca303[_0x0820('0x69')][_0x0820('0x76')];_0x4ca303[_0x0820('0x69')][_0x0820('0x7f')]={'mailbox':_0x4ca303[_0x0820('0x69')]['internal'],'password':_0x4ca303['body'][_0x0820('0x4f')],'fullname':_0x4ca303['body']['fullname'],'email':_0x4ca303[_0x0820('0x69')][_0x0820('0x80')]};}if(_0x4ca303['body']&&_0x4ca303[_0x0820('0x69')]['role']===_0x0820('0x3b')){if(!_0x4ca303[_0x0820('0x69')]['permissions']){_0x4ca303[_0x0820('0x69')][_0x0820('0x81')]=[_0x0820('0x82'),'102','103',_0x0820('0x83'),_0x0820('0x84'),'104',_0x0820('0x85'),_0x0820('0x86'),_0x0820('0x87'),_0x0820('0x88'),'109',_0x0820('0x89'),_0x0820('0x8a'),'114'];}}return db[_0x0820('0x49')][_0x0820('0x75')](_0x4ca303[_0x0820('0x69')],{'include':[{'model':db[_0x0820('0x7f')],'as':'VoiceMail'}]});})['then'](function(_0x2ea560){if(_0x4ca303[_0x0820('0x69')][_0x0820('0x42')]===_0x0820('0x39'))return _0x2ea560;var _0x2637ee=_0x4ca303[_0x0820('0x39')][_0x0820('0x8b')]({'plain':!![]});if(!_0x2637ee)throw new Error(_0x0820('0x8c'));if(_0x2637ee[_0x0820('0x42')]==='user'){var _0x4982ae=_0x2ea560[_0x0820('0x8b')]({'plain':!![]});var _0x1838f4=[{'name':_0x0820('0x3a'),'value':_0x0820('0x3b')},{'name':_0x0820('0x3c'),'value':_0x0820('0x6e')}];var _0x39c20f=_['find'](_0x1838f4,['value',_0x4982ae['role']])['name'];return db[_0x0820('0x8d')][_0x0820('0x43')]({'where':{'name':_0x39c20f,'userProfileId':_0x2637ee[_0x0820('0x8e')]},'raw':!![]})[_0x0820('0x37')](function(_0x3da48b){if(_0x3da48b&&_0x3da48b[_0x0820('0x8f')]===0x0){return db['UserProfileResource']['create']({'name':_0x4982ae[_0x0820('0x44')],'resourceId':_0x4982ae['id'],'type':_0x3da48b[_0x0820('0x44')],'sectionId':_0x3da48b['id']},{})[_0x0820('0x37')](function(){return _0x2ea560;});}else{return _0x2ea560;}})[_0x0820('0x2c')](function(_0x394620){logger[_0x0820('0x29')](_0x0820('0x90'),_0x394620);throw _0x394620;});}return _0x2ea560;})[_0x0820('0x37')](respondWithResult(_0x5bb41f,0xc9))[_0x0820('0x2c')](handleError(_0x5bb41f,null));};exports[_0x0820('0x91')]=function(_0x3bde07,_0x1b1b0c,_0x56fe39){var _0x95d867=![];if(_0x3bde07['body']['id']){delete _0x3bde07[_0x0820('0x69')]['id'];}return db[_0x0820('0x92')][_0x0820('0x93')]({'attributes':['id',_0x0820('0x77')]})['then'](function(_0x222a17){_0x95d867=_0x222a17['securePassword'];return db['User'][_0x0820('0x43')]({'where':{'id':_0x3bde07[_0x0820('0x66')]['id']}});})['then'](function(_0x501798){if(_0x501798){if(_0x501798['id']==_0x3bde07[_0x0820('0x39')]['id']){if(!_0x3bde07['body'][_0x0820('0x94')]||!_0x3bde07['body'][_0x0820('0x95')]){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x97'));}if(!_0x501798[_0x0820('0x98')](_0x3bde07[_0x0820('0x69')][_0x0820('0x94')])){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x99'));}if(_0x3bde07[_0x0820('0x69')]['oldPassword']==_0x3bde07['body'][_0x0820('0x95')]){throw new db['Sequelize'][(_0x0820('0x96'))](_0x0820('0x9a'));}return _0x501798;}else if(_0x3bde07[_0x0820('0x39')][_0x0820('0x42')]==_0x0820('0x6f')){if(!_0x3bde07[_0x0820('0x69')][_0x0820('0x95')]){throw new db['Sequelize'][(_0x0820('0x96'))](_0x0820('0x9b'));}return _0x501798;}else if(_0x3bde07['user'][_0x0820('0x42')]==_0x0820('0x39')){if(!_0x3bde07[_0x0820('0x69')][_0x0820('0x95')]){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x9b'));}if(_0x501798[_0x0820('0x42')]!='agent'){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0x9c'));}return _0x501798;}else{throw new db['Sequelize']['ValidationError'](_0x0820('0x9c'));}}return null;})[_0x0820('0x37')](handleEntityNotFound(_0x1b1b0c,null))[_0x0820('0x37')](function(_0x11facc){return checkPasswordPattern(_0x11facc,_0x3bde07[_0x0820('0x69')][_0x0820('0x95')],_0x95d867);})['then'](saveUpdates({'password':_0x3bde07[_0x0820('0x69')]['newPassword'],'passwordResetAt':_0x3bde07[_0x0820('0x39')]['id']==_0x3bde07[_0x0820('0x66')]['id']?moment():null},null))['then'](respondWithResult(_0x1b1b0c,null))['catch'](handleError(_0x1b1b0c,null));};exports[_0x0820('0x9d')]=function(_0x5f3a94,_0x4b419d,_0x401265){var _0x138d42=_0x5f3a94[_0x0820('0x69')][_0x0820('0x9e')];return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x5f3a94[_0x0820('0x66')]['id']},'attributes':['id',_0x0820('0x44'),_0x0820('0x42'),_0x0820('0x9f'),'loginInPause',_0x0820('0xa0'),_0x0820('0xa1')]})[_0x0820('0x37')](handleEntityNotFound(_0x4b419d,null))[_0x0820('0x37')](function(_0x57a691){if(_0x57a691){if(!utils[_0x0820('0xa2')](_0x138d42)){throw new db[(_0x0820('0x20'))]['ValidationError'](_0x0820('0xa3'));}return _0x57a691[_0x0820('0xa4')+_[_0x0820('0xa5')](_0x138d42['toLowerCase']())+_0x0820('0xa6')](_0x5f3a94[_0x0820('0x69')][_0x0820('0x6d')],{'penalty':_0x5f3a94['body']['penalty']||0x0})[_0x0820('0xa7')](function(_0xeb2717){for(var _0x1474a5=0x0;_0x1474a5<_0x5f3a94[_0x0820('0x69')][_0x0820('0x6d')][_0x0820('0x57')];_0x1474a5+=0x1){var _0x5c59c9={'UserId':_0x5f3a94['params']['id']};_0x5c59c9[_[_0x0820('0xa5')](_0x138d42[_0x0820('0xa8')]())+_0x0820('0xa9')]=_0x5f3a94['body'][_0x0820('0x6d')][_0x1474a5];socket[_0x0820('0xaa')]('user'+_['capitalize'](_0x138d42[_0x0820('0xa8')]())+_0x0820('0xab'),_0x5c59c9);}return _0xeb2717;})[_0x0820('0x37')](function(){if(_0x138d42===_0x0820('0xac')){return db['VoiceQueue']['findAll']({'where':{'id':_0x5f3a94[_0x0820('0x69')][_0x0820('0x6d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x0820('0x37')](function(_0x3c8df9){var _0x2a60e7=_0x57a691[_0x0820('0x8b')]({'plain':!![]});var _0x489e64=[];if(_0x138d42===_0x0820('0xac')&&_0x2a60e7[_0x0820('0x42')]===_0x0820('0x3b')&&_0x2a60e7[_0x0820('0x9f')]){for(var _0x155992=0x0;_0x155992<_0x3c8df9[_0x0820('0x57')];_0x155992+=0x1){_0x489e64[_0x0820('0xad')]({'membername':_0x2a60e7[_0x0820('0x44')],'UserId':_0x2a60e7['id'],'queue_name':_0x3c8df9[_0x155992]['name'],'VoiceQueueId':_0x3c8df9[_0x155992]['id'],'interface':_[_0x0820('0x79')](_0x2a60e7[_0x0820('0xa1')])?util['format'](_0x0820('0xae'),_0x2a60e7[_0x0820('0x44')]):_0x2a60e7[_0x0820('0xa1')],'paused':_0x2a60e7[_0x0820('0xa0')]||![],'penalty':_0x5f3a94[_0x0820('0x69')]['penalty']||0x0});}return BPromise[_0x0820('0xaf')](_0x489e64,function(_0x23b20c){return db['UserVoiceQueueRt'][_0x0820('0xb0')](_0x23b20c);});}return _0x57a691;});}})[_0x0820('0x37')](respondWithStatusCode(_0x4b419d,null))[_0x0820('0x2c')](handleError(_0x4b419d,null));};exports['removeQueues']=function(_0x50a8fa,_0x2afa84,_0x36d02d){var _0x209be5;return db['User']['find']({'where':{'id':_0x50a8fa[_0x0820('0x66')]['id']},'attributes':['id','name',_0x0820('0x42')]})[_0x0820('0x37')](handleEntityNotFound(_0x2afa84,null))[_0x0820('0x37')](function(_0x3361f5){if(_0x3361f5){_0x209be5=_0x3361f5;if(!_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')]||!utils[_0x0820('0xa2')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')])){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0xa3'));}return _0x3361f5[_0x0820('0xb1')+_[_0x0820('0xa5')](_0x50a8fa['query'][_0x0820('0x9e')][_0x0820('0xa8')]())+_0x0820('0xa6')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')]);}})[_0x0820('0x37')](function(_0x11e280){for(var _0x27c164=0x0;_0x27c164<_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')]['length'];_0x27c164+=0x1){var _0x4761a8={'UserId':_0x50a8fa[_0x0820('0x66')]['id']};_0x4761a8[_[_0x0820('0xa5')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')][_0x0820('0xa8')]())+_0x0820('0xa9')]=_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')][_0x27c164];socket[_0x0820('0xaa')](_0x0820('0x39')+_[_0x0820('0xa5')](_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')][_0x0820('0xa8')]())+_0x0820('0xb2'),_0x4761a8);}return _0x11e280;})[_0x0820('0x37')](function(){if(_0x50a8fa[_0x0820('0x50')][_0x0820('0x9e')]===_0x0820('0xac')){return db[_0x0820('0xb3')][_0x0820('0x38')]({'where':{'UserId':_0x50a8fa['params']['id'],'VoiceQueueId':_0x50a8fa[_0x0820('0x50')][_0x0820('0x6d')]},'individualHooks':!![]})[_0x0820('0x37')](function(){return _0x209be5;});}return _0x209be5;})[_0x0820('0x37')](respondWithStatusCode(_0x2afa84,null))[_0x0820('0x2c')](handleError(_0x2afa84,null));};exports[_0x0820('0xb4')]=function(_0x8beb2f,_0x7aaa5c,_0x5b1a6b){_0x8beb2f[_0x0820('0x69')][_0x0820('0xb5')]=_0x8beb2f[_0x0820('0xb6')][_0x0820('0xb7')];return db['User'][_0x0820('0x43')]({'where':{'id':_0x8beb2f[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x7aaa5c,null))[_0x0820('0x37')](saveUpdates(_0x8beb2f[_0x0820('0x69')],null))['then'](respondWithResult(_0x7aaa5c,null))['catch'](handleError(_0x7aaa5c,null));};exports['getAvatar']=function(_0x32369f,_0x4c7e03,_0x4b75a4){var _0x4a5916=path['join'](config[_0x0820('0xb8')],_0x0820('0xb9'));return db['User'][_0x0820('0x43')]({'where':{'id':_0x32369f[_0x0820('0x66')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0820('0x37')](handleEntityNotFound(_0x4c7e03,null))['then'](function(_0x5bb3f2){if(_0x5bb3f2){if(_[_0x0820('0x79')](_0x5bb3f2['userpic'])){return _0x4c7e03[_0x0820('0xba')](_0x4a5916);}else{if(!fs[_0x0820('0xbb')](path['join'](config[_0x0820('0xb8')],_0x0820('0xbc'),_0x5bb3f2[_0x0820('0xb5')]))){return _0x4c7e03[_0x0820('0xba')](_0x4a5916);}return _0x4c7e03[_0x0820('0xba')](path['join'](config['root'],_0x0820('0xbc'),_0x5bb3f2[_0x0820('0xb5')]));}}})[_0x0820('0x2c')](handleError(_0x4c7e03,null));};exports[_0x0820('0xbd')]=function(_0x19b355,_0xc0cdad,_0x144207){var _0x5db8ac={};var _0x540277={};var _0x503961;var _0x19c0de;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x19b355[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0xc0cdad,null))[_0x0820('0x37')](function(_0x2952cf){if(_0x2952cf){_0x503961=_0x2952cf;_0x540277[_0x0820('0x54')]=_[_0x0820('0x51')](db['CmContact'][_0x0820('0x4a')]);_0x540277['query']=_[_0x0820('0x51')](_0x19b355[_0x0820('0x50')]);_0x540277['filters']=_['intersection'](_0x540277[_0x0820('0x54')],_0x540277['query']);_0x5db8ac[_0x0820('0x55')]=_[_0x0820('0x53')](_0x540277[_0x0820('0x54')],qs[_0x0820('0x56')](_0x19b355[_0x0820('0x50')][_0x0820('0x56')]));_0x5db8ac[_0x0820('0x55')]=_0x5db8ac[_0x0820('0x55')][_0x0820('0x57')]?_0x5db8ac['attributes']:_0x540277[_0x0820('0x54')];_0x5db8ac['order']=qs[_0x0820('0x59')](_0x19b355['query'][_0x0820('0x59')]);_0x5db8ac[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x19b355[_0x0820('0x50')],_0x540277[_0x0820('0x52')]));if(_0x19b355[_0x0820('0x50')][_0x0820('0x3d')]){_0x5db8ac[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x5db8ac[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x5db8ac[_0x0820('0x55')],function(_0x3743e9){var _0x37d12b={};_0x37d12b[_0x3743e9]={'$like':'%'+_0x19b355['query']['filter']+'%'};return _0x37d12b;})});}_0x5db8ac=_[_0x0820('0x5c')]({},_0x5db8ac,_0x19b355['options']);return _0x503961[_0x0820('0xbd')](_0x5db8ac);}})[_0x0820('0x37')](function(_0x268601){if(_0x268601){_0x19c0de=_0x268601['length'];if(_0x19b355[_0x0820('0x50')][_0x0820('0xbe')]('includeAll')){_0x5db8ac[_0x0820('0x62')]=[{'model':db['CmList'],'as':_0x0820('0xbf'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0820('0x44'),_0x0820('0xc0')],'where':_0x19b355[_0x0820('0x50')][_0x0820('0xc1')]?{'id':_0x19b355[_0x0820('0x50')][_0x0820('0xc1')]}:undefined,'required':_0x19b355['query'][_0x0820('0xc1')]?!![]:![]}];}if(!_0x19b355[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x5db8ac[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x19b355[_0x0820('0x50')]['limit']);_0x5db8ac[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x19b355['query'][_0x0820('0x31')]);}return _0x503961[_0x0820('0xbd')](_0x5db8ac);}})['then'](function(_0x597891){if(_0x597891){return _0x597891?{'count':_0x19c0de,'rows':_0x597891}:null;}})[_0x0820('0x37')](respondWithResult(_0xc0cdad,null))[_0x0820('0x2c')](handleError(_0xc0cdad,null));};exports[_0x0820('0xc2')]=function(_0x2c72e1,_0x472084,_0x4e5f5a){var _0x3ea2a8;var _0x47b4f8;var _0x506319={};var _0xa14c95;return db['User'][_0x0820('0x93')]({'where':{'id':_0x2c72e1[_0x0820('0x66')]['id']},'attributes':['id',_0x0820('0x44'),_0x0820('0x42')]})[_0x0820('0x37')](handleEntityNotFound(_0x472084,null))[_0x0820('0x37')](function(_0xf7ebbf){if(!utils[_0x0820('0xa2')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])){throw new db['Sequelize'][(_0x0820('0x96'))]('Unknown\x20channel');}_0x3ea2a8=_0xf7ebbf;var _0x31a582={};_0x31a582[_0x0820('0x54')]=_[_0x0820('0x51')](db[_[_0x0820('0xa5')](_0x2c72e1['query'][_0x0820('0x9e')])+_0x0820('0xc3')]['rawAttributes']);_0x31a582[_0x0820('0x50')]=_['keys'](_0x2c72e1[_0x0820('0x50')]);_0x31a582[_0x0820('0x52')]=_[_0x0820('0x53')](_0x31a582[_0x0820('0x54')],_0x31a582['query']);_0x506319[_0x0820('0x55')]=_[_0x0820('0x53')](_0x31a582['model'],qs['fields'](_0x2c72e1['query'][_0x0820('0x56')]));_0x506319['attributes']=_0x506319['attributes']['length']?_0x506319[_0x0820('0x55')]:_0x31a582[_0x0820('0x54')];_0x506319['order']=qs['sort'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x59')]);_0x506319[_0x0820('0x5b')]=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x2c72e1[_0x0820('0x50')],_0x31a582[_0x0820('0x52')]));if(_0x2c72e1['query']['filter']){_0x506319[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x506319[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x506319[_0x0820('0x55')],function(_0xfbdf0b){var _0x546cb9={};_0x546cb9[_0xfbdf0b]={'$like':'%'+_0x2c72e1[_0x0820('0x50')]['filter']+'%'};return _0x546cb9;})});}_0x506319=_[_0x0820('0x5c')]({},_0x506319,_0x2c72e1[_0x0820('0x60')]);switch(_0x3ea2a8[_0x0820('0x42')]){case _0x0820('0x6f'):return db[_['capitalize'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+_0x0820('0xc3')]['findAll'](_0x506319);case _0x0820('0x39'):case'agent':return _0x3ea2a8['get'+_[_0x0820('0xa5')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+_0x0820('0xa6')](_0x506319);default:throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0xc4'));}})['then'](function(_0x4fa70a){_0xa14c95=_0x4fa70a[_0x0820('0x57')];if(!_0x2c72e1['query'][_0x0820('0xbe')](_0x0820('0x58'))){_0x506319[_0x0820('0x32')]=qs['limit'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x32')]);_0x506319[_0x0820('0x31')]=qs['offset'](_0x2c72e1[_0x0820('0x50')][_0x0820('0x31')]);}switch(_0x3ea2a8[_0x0820('0x42')]){case _0x0820('0x6f'):return db[_[_0x0820('0xa5')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+_0x0820('0xc3')]['findAll'](_0x506319);case _0x0820('0x39'):case'agent':return _0x3ea2a8[_0x0820('0x8b')+_[_0x0820('0xa5')](_0x2c72e1[_0x0820('0x50')][_0x0820('0x9e')])+'Queues'](_0x506319);}})['then'](function(_0x2091b0){return{'count':_0xa14c95,'rows':_0x2091b0};})[_0x0820('0x37')](respondWithResult(_0x472084,null))[_0x0820('0x2c')](handleError(_0x472084,null));};exports['getVoiceQueuesRt']=function(_0x16b886,_0x309c58,_0x5237e9){var _0x363cde={};var _0x7e25c3={};var _0x1853d4;var _0x4dd12c;return db[_0x0820('0x49')]['findOne']({'where':{'id':_0x16b886[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x309c58,null))[_0x0820('0x37')](function(_0x4a63a7){if(_0x4a63a7){_0x1853d4=_0x4a63a7;_0x7e25c3[_0x0820('0x54')]=_[_0x0820('0x51')](db['UserVoiceQueueRt'][_0x0820('0x4a')]);_0x7e25c3[_0x0820('0x50')]=_[_0x0820('0x51')](_0x16b886[_0x0820('0x50')]);_0x7e25c3[_0x0820('0x52')]=_[_0x0820('0x53')](_0x7e25c3[_0x0820('0x54')],_0x7e25c3[_0x0820('0x50')]);_0x363cde[_0x0820('0x55')]=_[_0x0820('0x53')](_0x7e25c3[_0x0820('0x54')],qs[_0x0820('0x56')](_0x16b886[_0x0820('0x50')][_0x0820('0x56')]));_0x363cde['attributes']=_0x363cde['attributes']['length']?_0x363cde['attributes']:_0x7e25c3[_0x0820('0x54')];_0x363cde[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x16b886[_0x0820('0x50')][_0x0820('0x59')]);_0x363cde[_0x0820('0x5b')]=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x16b886[_0x0820('0x50')],_0x7e25c3[_0x0820('0x52')]));if(_0x16b886['query'][_0x0820('0x3d')]){_0x363cde[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x363cde['where'],{'$or':_['map'](_0x363cde[_0x0820('0x55')],function(_0x23f9cc){var _0x10e67a={};_0x10e67a[_0x23f9cc]={'$like':'%'+_0x16b886[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x10e67a;})});}_0x363cde=_[_0x0820('0x5c')]({},_0x363cde,_0x16b886[_0x0820('0x60')]);return _0x1853d4[_0x0820('0xc6')](_0x363cde);}})[_0x0820('0x37')](function(_0x45dd3f){if(_0x45dd3f){_0x4dd12c=_0x45dd3f['length'];if(!_0x16b886[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0x363cde['limit']=qs[_0x0820('0x32')](_0x16b886['query']['limit']);_0x363cde['offset']=qs[_0x0820('0x31')](_0x16b886[_0x0820('0x50')][_0x0820('0x31')]);}return _0x1853d4[_0x0820('0xc6')](_0x363cde);}})[_0x0820('0x37')](function(_0x3d9e7b){if(_0x3d9e7b){return _0x3d9e7b?{'count':_0x4dd12c,'rows':_0x3d9e7b}:null;}})[_0x0820('0x37')](respondWithResult(_0x309c58,null))['catch'](handleError(_0x309c58,null));};exports[_0x0820('0xc7')]=function(_0x4a3e99,_0x14b694,_0x518580){var _0xbd645a={};var _0x5d3afb={};var _0xd7f9b2;var _0x122a38;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x4a3e99[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x14b694,null))['then'](function(_0x3fb3de){if(_0x3fb3de){_0xd7f9b2=_0x3fb3de;_0x5d3afb[_0x0820('0x54')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x5d3afb[_0x0820('0x50')]=_[_0x0820('0x51')](_0x4a3e99[_0x0820('0x50')]);_0x5d3afb[_0x0820('0x52')]=_[_0x0820('0x53')](_0x5d3afb[_0x0820('0x54')],_0x5d3afb['query']);_0xbd645a[_0x0820('0x55')]=_[_0x0820('0x53')](_0x5d3afb['model'],qs[_0x0820('0x56')](_0x4a3e99[_0x0820('0x50')]['fields']));_0xbd645a['attributes']=_0xbd645a['attributes'][_0x0820('0x57')]?_0xbd645a['attributes']:_0x5d3afb[_0x0820('0x54')];_0xbd645a['order']=qs[_0x0820('0x59')](_0x4a3e99[_0x0820('0x50')][_0x0820('0x59')]);_0xbd645a[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x4a3e99[_0x0820('0x50')],_0x5d3afb[_0x0820('0x52')]));if(_0x4a3e99['query'][_0x0820('0x3d')]){_0xbd645a[_0x0820('0x5b')]=_['merge'](_0xbd645a[_0x0820('0x5b')],{'$or':_['map'](_0xbd645a[_0x0820('0x55')],function(_0x26e0fa){var _0x4458df={};_0x4458df[_0x26e0fa]={'$like':'%'+_0x4a3e99['query']['filter']+'%'};return _0x4458df;})});}_0xbd645a=_[_0x0820('0x5c')]({},_0xbd645a,_0x4a3e99['options']);return _0xd7f9b2[_0x0820('0xc7')](_0xbd645a);}})[_0x0820('0x37')](function(_0x54c930){if(_0x54c930){_0x122a38=_0x54c930[_0x0820('0x57')];if(!_0x4a3e99[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0xbd645a[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x4a3e99[_0x0820('0x50')][_0x0820('0x32')]);_0xbd645a[_0x0820('0x31')]=qs['offset'](_0x4a3e99[_0x0820('0x50')][_0x0820('0x31')]);}return _0xd7f9b2[_0x0820('0xc7')](_0xbd645a);}})['then'](function(_0x34f155){if(_0x34f155){return _0x34f155?{'count':_0x122a38,'rows':_0x34f155}:null;}})[_0x0820('0x37')](respondWithResult(_0x14b694,null))[_0x0820('0x2c')](handleError(_0x14b694,null));};exports['getRecordings']=function(_0x173e8e,_0x244dbb,_0x1d0615){var _0x5041e1={'raw':!![],'where':{}};var _0x4b924a={};var _0x8f15f={'count':0x0,'rows':[]};return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x173e8e[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x244dbb,null))['then'](function(_0x25446f){if(_0x25446f){_0x4b924a[_0x0820('0x54')]=_[_0x0820('0x51')](db[_0x0820('0xc8')][_0x0820('0x4a')]);_0x4b924a['query']=_[_0x0820('0x51')](_0x173e8e[_0x0820('0x50')]);_0x4b924a[_0x0820('0x52')]=_[_0x0820('0x53')](_0x4b924a[_0x0820('0x54')],_0x4b924a['query']);_0x5041e1[_0x0820('0x55')]=_[_0x0820('0x53')](_0x4b924a[_0x0820('0x54')],qs['fields'](_0x173e8e[_0x0820('0x50')]['fields']));_0x5041e1[_0x0820('0x55')]=_0x5041e1['attributes'][_0x0820('0x57')]?_0x5041e1['attributes']:_0x4b924a[_0x0820('0x54')];if(!_0x173e8e[_0x0820('0x50')][_0x0820('0xbe')]('nolimit')){_0x5041e1[_0x0820('0x32')]=qs['limit'](_0x173e8e[_0x0820('0x50')][_0x0820('0x32')]);_0x5041e1[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x173e8e[_0x0820('0x50')][_0x0820('0x31')]);}_0x5041e1['order']=qs[_0x0820('0x59')](_0x173e8e[_0x0820('0x50')][_0x0820('0x59')]);_0x5041e1[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x173e8e[_0x0820('0x50')],_0x4b924a['filters']));_0x5041e1['where'][_0x0820('0xc9')]=_0x25446f['id'];if(_0x173e8e[_0x0820('0x50')]['filter']){_0x5041e1[_0x0820('0x5b')]=_['merge'](_0x5041e1['where'],{'$or':_[_0x0820('0x3f')](_0x5041e1[_0x0820('0x55')],function(_0x47a8bd){var _0x201f12={};_0x201f12[_0x47a8bd]={'$like':'%'+_0x173e8e[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x201f12;})});}_0x5041e1=_[_0x0820('0x5c')]({},_0x5041e1,_0x173e8e['options']);return db['VoiceRecording'][_0x0820('0x30')]({'where':_0x5041e1[_0x0820('0x5b')]})['then'](function(_0x3f6d92){_0x8f15f['count']=_0x3f6d92;if(_0x173e8e[_0x0820('0x50')][_0x0820('0x61')]){_0x5041e1[_0x0820('0x62')]=[{'all':!![]}];}return db[_0x0820('0xc8')][_0x0820('0x63')](_0x5041e1);})[_0x0820('0x37')](function(_0x3fe730){_0x8f15f[_0x0820('0x64')]=_0x3fe730;return _0x8f15f;});}})[_0x0820('0x37')](respondWithFilteredResult(_0x244dbb,_0x5041e1))[_0x0820('0x2c')](handleError(_0x244dbb,null));};exports['getScreenRecordings']=function(_0x35c1d0,_0xaf1976,_0x14b167){var _0x1741e7={'raw':!![],'where':{}};var _0x3b116f={};var _0x38af2a={'count':0x0,'rows':[]};return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x35c1d0['params']['id']}})['then'](handleEntityNotFound(_0xaf1976,null))[_0x0820('0x37')](function(_0xbc62bd){if(_0xbc62bd){_0x3b116f['model']=_[_0x0820('0x51')](db[_0x0820('0xca')]['rawAttributes']);_0x3b116f[_0x0820('0x50')]=_[_0x0820('0x51')](_0x35c1d0['query']);_0x3b116f[_0x0820('0x52')]=_[_0x0820('0x53')](_0x3b116f[_0x0820('0x54')],_0x3b116f[_0x0820('0x50')]);_0x1741e7['attributes']=_[_0x0820('0x53')](_0x3b116f[_0x0820('0x54')],qs[_0x0820('0x56')](_0x35c1d0['query'][_0x0820('0x56')]));_0x1741e7[_0x0820('0x55')]=_0x1741e7['attributes'][_0x0820('0x57')]?_0x1741e7['attributes']:_0x3b116f[_0x0820('0x54')];if(!_0x35c1d0[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0x1741e7[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x35c1d0[_0x0820('0x50')][_0x0820('0x32')]);_0x1741e7['offset']=qs[_0x0820('0x31')](_0x35c1d0[_0x0820('0x50')][_0x0820('0x31')]);}_0x1741e7[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x35c1d0['query'][_0x0820('0x59')]);_0x1741e7['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x35c1d0[_0x0820('0x50')],_0x3b116f[_0x0820('0x52')]));_0x1741e7[_0x0820('0x5b')][_0x0820('0xc9')]=_0xbc62bd['id'];if(_0x35c1d0[_0x0820('0x50')]['filter']){_0x1741e7['where']=_['merge'](_0x1741e7[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x1741e7[_0x0820('0x55')],function(_0x2f2d7f){var _0x5e0dee={};_0x5e0dee[_0x2f2d7f]={'$like':'%'+_0x35c1d0[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x5e0dee;})});}_0x1741e7=_['merge']({},_0x1741e7,_0x35c1d0[_0x0820('0x60')]);return db[_0x0820('0xca')][_0x0820('0x30')]({'where':_0x1741e7[_0x0820('0x5b')]})[_0x0820('0x37')](function(_0x508c27){_0x38af2a[_0x0820('0x30')]=_0x508c27;if(_0x35c1d0[_0x0820('0x50')]['includeAll']){_0x1741e7[_0x0820('0x62')]=[{'all':!![]}];}return db[_0x0820('0xca')][_0x0820('0x63')](_0x1741e7);})[_0x0820('0x37')](function(_0x6e84b4){_0x38af2a[_0x0820('0x64')]=_0x6e84b4;return _0x38af2a;});}})[_0x0820('0x37')](respondWithFilteredResult(_0xaf1976,_0x1741e7))[_0x0820('0x2c')](handleError(_0xaf1976,null));};exports[_0x0820('0xcb')]=function(_0x4341b2,_0x4043df,_0x1b936f){var _0x3b8417={};var _0x39cbe7={};var _0x2a6edd;var _0x2229ca;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x4341b2[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x4043df,null))[_0x0820('0x37')](function(_0x593661){if(_0x593661){_0x2a6edd=_0x593661;_0x39cbe7['model']=_[_0x0820('0x51')](db[_0x0820('0xcc')]['rawAttributes']);_0x39cbe7[_0x0820('0x50')]=_[_0x0820('0x51')](_0x4341b2[_0x0820('0x50')]);_0x39cbe7[_0x0820('0x52')]=_[_0x0820('0x53')](_0x39cbe7[_0x0820('0x54')],_0x39cbe7[_0x0820('0x50')]);_0x3b8417[_0x0820('0x55')]=_[_0x0820('0x53')](_0x39cbe7['model'],qs['fields'](_0x4341b2[_0x0820('0x50')][_0x0820('0x56')]));_0x3b8417[_0x0820('0x55')]=_0x3b8417[_0x0820('0x55')]['length']?_0x3b8417[_0x0820('0x55')]:_0x39cbe7[_0x0820('0x54')];_0x3b8417[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x4341b2['query'][_0x0820('0x59')]);_0x3b8417[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x4341b2[_0x0820('0x50')],_0x39cbe7[_0x0820('0x52')]));if(_0x4341b2[_0x0820('0x50')][_0x0820('0x3d')]){_0x3b8417[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x3b8417[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x3b8417[_0x0820('0x55')],function(_0x23a32d){var _0x3bc195={};_0x3bc195[_0x23a32d]={'$like':'%'+_0x4341b2[_0x0820('0x50')]['filter']+'%'};return _0x3bc195;})});}_0x3b8417=_[_0x0820('0x5c')]({},_0x3b8417,_0x4341b2[_0x0820('0x60')]);return _0x2a6edd[_0x0820('0xcb')](_0x3b8417);}})[_0x0820('0x37')](function(_0x4f1768){if(_0x4f1768){_0x2229ca=_0x4f1768['length'];if(!_0x4341b2[_0x0820('0x50')][_0x0820('0xbe')](_0x0820('0x58'))){_0x3b8417['limit']=qs[_0x0820('0x32')](_0x4341b2[_0x0820('0x50')][_0x0820('0x32')]);_0x3b8417[_0x0820('0x31')]=qs['offset'](_0x4341b2[_0x0820('0x50')]['offset']);}return _0x2a6edd[_0x0820('0xcb')](_0x3b8417);}})[_0x0820('0x37')](function(_0x3d534c){if(_0x3d534c){return _0x3d534c?{'count':_0x2229ca,'rows':_0x3d534c}:null;}})[_0x0820('0x37')](respondWithResult(_0x4043df,null))['catch'](handleError(_0x4043df,null));};exports[_0x0820('0xcd')]=function(_0x3a4fa1,_0x81a7e0,_0x335dd5){var _0x408cf9={};var _0xe445be={};var _0xe7dd57;var _0x313423;return db[_0x0820('0x49')]['findOne']({'where':{'id':_0x3a4fa1[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x81a7e0,null))[_0x0820('0x37')](function(_0x2a06f6){if(_0x2a06f6){_0xe7dd57=_0x2a06f6;_0xe445be['model']=_['keys'](db[_0x0820('0xce')]['rawAttributes']);_0xe445be[_0x0820('0x50')]=_[_0x0820('0x51')](_0x3a4fa1[_0x0820('0x50')]);_0xe445be[_0x0820('0x52')]=_['intersection'](_0xe445be[_0x0820('0x54')],_0xe445be[_0x0820('0x50')]);_0x408cf9[_0x0820('0x55')]=_['intersection'](_0xe445be[_0x0820('0x54')],qs[_0x0820('0x56')](_0x3a4fa1['query']['fields']));_0x408cf9[_0x0820('0x55')]=_0x408cf9[_0x0820('0x55')]['length']?_0x408cf9[_0x0820('0x55')]:_0xe445be[_0x0820('0x54')];_0x408cf9[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x3a4fa1['query'][_0x0820('0x59')]);_0x408cf9[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x3a4fa1[_0x0820('0x50')],_0xe445be['filters']));if(_0x3a4fa1[_0x0820('0x50')][_0x0820('0x3d')]){_0x408cf9[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x408cf9[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x408cf9['attributes'],function(_0x3d42e6){var _0x19172d={};_0x19172d[_0x3d42e6]={'$like':'%'+_0x3a4fa1[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x19172d;})});}_0x408cf9=_[_0x0820('0x5c')]({},_0x408cf9,_0x3a4fa1[_0x0820('0x60')]);return _0xe7dd57[_0x0820('0xcd')](_0x408cf9);}})[_0x0820('0x37')](function(_0x3c3488){if(_0x3c3488){_0x313423=_0x3c3488['length'];if(!_0x3a4fa1['query']['hasOwnProperty'](_0x0820('0x58'))){_0x408cf9[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x3a4fa1[_0x0820('0x50')]['limit']);_0x408cf9['offset']=qs[_0x0820('0x31')](_0x3a4fa1[_0x0820('0x50')][_0x0820('0x31')]);}return _0xe7dd57[_0x0820('0xcd')](_0x408cf9);}})[_0x0820('0x37')](function(_0x50104b){if(_0x50104b){return _0x50104b?{'count':_0x313423,'rows':_0x50104b}:null;}})[_0x0820('0x37')](respondWithResult(_0x81a7e0,null))[_0x0820('0x2c')](handleError(_0x81a7e0,null));};exports[_0x0820('0xcf')]=function(_0x427d07,_0x9568f4,_0x59ada4){var _0x5c1124={'raw':!![],'where':{}};var _0x266713={};var _0x50c827={'count':0x0,'rows':[]};return db['User'][_0x0820('0x93')]({'where':{'id':_0x427d07[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x9568f4,null))['then'](function(_0x1055fc){if(_0x1055fc){_0x266713[_0x0820('0x54')]=_['keys'](db['MailInteraction'][_0x0820('0x4a')]);_0x266713[_0x0820('0x50')]=_[_0x0820('0x51')](_0x427d07['query']);_0x266713[_0x0820('0x52')]=_['intersection'](_0x266713[_0x0820('0x54')],_0x266713[_0x0820('0x50')]);_0x5c1124[_0x0820('0x55')]=_['intersection'](_0x266713['model'],qs[_0x0820('0x56')](_0x427d07[_0x0820('0x50')][_0x0820('0x56')]));_0x5c1124['attributes']=_0x5c1124[_0x0820('0x55')][_0x0820('0x57')]?_0x5c1124[_0x0820('0x55')]:_0x266713['model'];if(!_0x427d07[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x5c1124[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x427d07[_0x0820('0x50')]['limit']);_0x5c1124[_0x0820('0x31')]=qs['offset'](_0x427d07[_0x0820('0x50')][_0x0820('0x31')]);}_0x5c1124[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x427d07[_0x0820('0x50')]['sort']);_0x5c1124[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x427d07[_0x0820('0x50')],_0x266713[_0x0820('0x52')]));_0x5c1124['where'][_0x0820('0xc9')]=_0x1055fc['id'];if(_0x427d07[_0x0820('0x50')][_0x0820('0x3d')]){_0x5c1124[_0x0820('0x5b')]=_['merge'](_0x5c1124[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x5c1124[_0x0820('0x55')],function(_0x1a3aeb){var _0x1a61ef={};_0x1a61ef[_0x1a3aeb]={'$like':'%'+_0x427d07[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x1a61ef;})});}_0x5c1124=_['merge']({},_0x5c1124,_0x427d07[_0x0820('0x60')]);return db[_0x0820('0xd0')][_0x0820('0x30')]({'where':_0x5c1124['where']})[_0x0820('0x37')](function(_0xfa6f2b){_0x50c827[_0x0820('0x30')]=_0xfa6f2b;if(_0x427d07['query'][_0x0820('0x61')]){_0x5c1124[_0x0820('0x62')]=[{'all':!![]}];}return db['MailInteraction'][_0x0820('0x63')](_0x5c1124);})[_0x0820('0x37')](function(_0x2ed2d2){_0x50c827[_0x0820('0x64')]=_0x2ed2d2;return _0x50c827;});}})[_0x0820('0x37')](respondWithFilteredResult(_0x9568f4,_0x5c1124))[_0x0820('0x2c')](handleError(_0x9568f4,null));};exports[_0x0820('0xd1')]=function(_0x505aa1,_0x810865,_0x4a2bb1){var _0x2cf2a5={};var _0x370541={};var _0x44e4fe;var _0x2abac7;return db['User'][_0x0820('0x93')]({'where':{'id':_0x505aa1[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x810865,null))['then'](function(_0x5e4a52){if(_0x5e4a52){_0x44e4fe=_0x5e4a52;_0x370541[_0x0820('0x54')]=_['keys'](db['SmsInteraction'][_0x0820('0x4a')]);_0x370541[_0x0820('0x50')]=_[_0x0820('0x51')](_0x505aa1[_0x0820('0x50')]);_0x370541[_0x0820('0x52')]=_['intersection'](_0x370541[_0x0820('0x54')],_0x370541['query']);_0x2cf2a5['attributes']=_[_0x0820('0x53')](_0x370541[_0x0820('0x54')],qs['fields'](_0x505aa1['query']['fields']));_0x2cf2a5[_0x0820('0x55')]=_0x2cf2a5[_0x0820('0x55')][_0x0820('0x57')]?_0x2cf2a5[_0x0820('0x55')]:_0x370541['model'];_0x2cf2a5[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x505aa1[_0x0820('0x50')][_0x0820('0x59')]);_0x2cf2a5['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x505aa1[_0x0820('0x50')],_0x370541[_0x0820('0x52')]));if(_0x505aa1['query'][_0x0820('0x3d')]){_0x2cf2a5[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x2cf2a5['where'],{'$or':_['map'](_0x2cf2a5[_0x0820('0x55')],function(_0x3d2b5b){var _0x50078f={};_0x50078f[_0x3d2b5b]={'$like':'%'+_0x505aa1['query'][_0x0820('0x3d')]+'%'};return _0x50078f;})});}_0x2cf2a5=_[_0x0820('0x5c')]({},_0x2cf2a5,_0x505aa1[_0x0820('0x60')]);return _0x44e4fe[_0x0820('0xd1')](_0x2cf2a5);}})[_0x0820('0x37')](function(_0x15c05f){if(_0x15c05f){_0x2abac7=_0x15c05f['length'];if(!_0x505aa1[_0x0820('0x50')][_0x0820('0xbe')]('nolimit')){_0x2cf2a5[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x505aa1[_0x0820('0x50')][_0x0820('0x32')]);_0x2cf2a5[_0x0820('0x31')]=qs[_0x0820('0x31')](_0x505aa1[_0x0820('0x50')][_0x0820('0x31')]);}return _0x44e4fe[_0x0820('0xd1')](_0x2cf2a5);}})[_0x0820('0x37')](function(_0x44c8ff){if(_0x44c8ff){return _0x44c8ff?{'count':_0x2abac7,'rows':_0x44c8ff}:null;}})[_0x0820('0x37')](respondWithResult(_0x810865,null))[_0x0820('0x2c')](handleError(_0x810865,null));};exports[_0x0820('0xd2')]=function(_0x2c75bb,_0x2e709c,_0xde0d0c){var _0x572d6={};var _0x17ffb9={};var _0x5ed866;var _0x50dd28;return db[_0x0820('0x49')]['findOne']({'where':{'id':_0x2c75bb[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x2e709c,null))[_0x0820('0x37')](function(_0x2bcbd7){if(_0x2bcbd7){_0x5ed866=_0x2bcbd7;_0x17ffb9[_0x0820('0x54')]=_[_0x0820('0x51')](db[_0x0820('0xd3')][_0x0820('0x4a')]);_0x17ffb9[_0x0820('0x50')]=_[_0x0820('0x51')](_0x2c75bb['query']);_0x17ffb9['filters']=_['intersection'](_0x17ffb9['model'],_0x17ffb9[_0x0820('0x50')]);_0x572d6[_0x0820('0x55')]=_['intersection'](_0x17ffb9[_0x0820('0x54')],qs[_0x0820('0x56')](_0x2c75bb['query'][_0x0820('0x56')]));_0x572d6['attributes']=_0x572d6[_0x0820('0x55')]['length']?_0x572d6[_0x0820('0x55')]:_0x17ffb9[_0x0820('0x54')];_0x572d6['order']=qs[_0x0820('0x59')](_0x2c75bb[_0x0820('0x50')][_0x0820('0x59')]);_0x572d6[_0x0820('0x5b')]=qs[_0x0820('0x52')](_['pick'](_0x2c75bb[_0x0820('0x50')],_0x17ffb9[_0x0820('0x52')]));if(_0x2c75bb[_0x0820('0x50')][_0x0820('0x3d')]){_0x572d6[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x572d6[_0x0820('0x5b')],{'$or':_['map'](_0x572d6['attributes'],function(_0x424056){var _0x2d84d9={};_0x2d84d9[_0x424056]={'$like':'%'+_0x2c75bb[_0x0820('0x50')]['filter']+'%'};return _0x2d84d9;})});}_0x572d6=_['merge']({},_0x572d6,_0x2c75bb['options']);return _0x5ed866[_0x0820('0xd2')](_0x572d6);}})[_0x0820('0x37')](function(_0x580286){if(_0x580286){_0x50dd28=_0x580286[_0x0820('0x57')];if(!_0x2c75bb[_0x0820('0x50')]['hasOwnProperty']('nolimit')){_0x572d6[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x2c75bb[_0x0820('0x50')][_0x0820('0x32')]);_0x572d6['offset']=qs[_0x0820('0x31')](_0x2c75bb[_0x0820('0x50')][_0x0820('0x31')]);}return _0x5ed866['getFaxInteractions'](_0x572d6);}})[_0x0820('0x37')](function(_0x24eb13){if(_0x24eb13){return _0x24eb13?{'count':_0x50dd28,'rows':_0x24eb13}:null;}})[_0x0820('0x37')](respondWithResult(_0x2e709c,null))[_0x0820('0x2c')](handleError(_0x2e709c,null));};exports[_0x0820('0xd4')]=function(_0x442e45,_0x29e338,_0x1a2e76){var _0x2c77a4={};var _0x19f979={};var _0x5b8178;var _0x1e5a55;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x442e45[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x29e338,null))[_0x0820('0x37')](function(_0x3303dd){if(_0x3303dd){_0x5b8178=_0x3303dd;_0x19f979[_0x0820('0x54')]=_['keys'](db[_0x0820('0xd5')][_0x0820('0x4a')]);_0x19f979[_0x0820('0x50')]=_[_0x0820('0x51')](_0x442e45[_0x0820('0x50')]);_0x19f979[_0x0820('0x52')]=_[_0x0820('0x53')](_0x19f979[_0x0820('0x54')],_0x19f979['query']);_0x2c77a4[_0x0820('0x55')]=_[_0x0820('0x53')](_0x19f979[_0x0820('0x54')],qs[_0x0820('0x56')](_0x442e45[_0x0820('0x50')][_0x0820('0x56')]));_0x2c77a4[_0x0820('0x55')]=_0x2c77a4['attributes'][_0x0820('0x57')]?_0x2c77a4['attributes']:_0x19f979[_0x0820('0x54')];_0x2c77a4[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x442e45[_0x0820('0x50')]['sort']);_0x2c77a4[_0x0820('0x5b')]=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0x442e45[_0x0820('0x50')],_0x19f979[_0x0820('0x52')]));if(_0x442e45[_0x0820('0x50')][_0x0820('0x3d')]){_0x2c77a4[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x2c77a4['where'],{'$or':_['map'](_0x2c77a4['attributes'],function(_0x5c26c0){var _0x7c70d0={};_0x7c70d0[_0x5c26c0]={'$like':'%'+_0x442e45['query'][_0x0820('0x3d')]+'%'};return _0x7c70d0;})});}_0x2c77a4=_[_0x0820('0x5c')]({},_0x2c77a4,_0x442e45[_0x0820('0x60')]);return _0x5b8178[_0x0820('0xd4')](_0x2c77a4);}})['then'](function(_0x5e9c8b){if(_0x5e9c8b){_0x1e5a55=_0x5e9c8b[_0x0820('0x57')];if(!_0x442e45['query']['hasOwnProperty'](_0x0820('0x58'))){_0x2c77a4[_0x0820('0x32')]=qs[_0x0820('0x32')](_0x442e45[_0x0820('0x50')][_0x0820('0x32')]);_0x2c77a4['offset']=qs[_0x0820('0x31')](_0x442e45[_0x0820('0x50')][_0x0820('0x31')]);}return _0x5b8178[_0x0820('0xd4')](_0x2c77a4);}})[_0x0820('0x37')](function(_0x41b3e8){if(_0x41b3e8){return _0x41b3e8?{'count':_0x1e5a55,'rows':_0x41b3e8}:null;}})[_0x0820('0x37')](respondWithResult(_0x29e338,null))[_0x0820('0x2c')](handleError(_0x29e338,null));};exports[_0x0820('0xd6')]=function(_0x18dea1,_0x18d9e4,_0x5b7574){var _0x44b49b;var _0x70736d;var _0x3e0dac;var _0x37ec16=!_[_0x0820('0x79')](_0x18dea1['params']['id'])?_0x18dea1[_0x0820('0x66')]['id']:!_[_0x0820('0x79')](_0x18dea1['user']['id'])?_0x18dea1[_0x0820('0x39')]['id']:null;return db[_0x0820('0x49')][_0x0820('0x43')]({'where':{'id':_0x37ec16,'role':{'$or':['admin','user',_0x0820('0x3b')]}},'attributes':['id','name',_0x0820('0xd7'),_0x0820('0xd8'),_0x0820('0x42'),_0x0820('0x76'),_0x0820('0xd9')]})[_0x0820('0x37')](function(_0x23797f){if(_0x23797f){if(_0x23797f[_0x0820('0x42')]===_0x0820('0x3b')){_0x44b49b=_0x23797f;if(_0x18dea1['body'][_0x0820('0xa1')]){_0x3e0dac=util['format']('LOCAL/%s@from-sip/n',_0x44b49b[_0x18dea1[_0x0820('0x69')][_0x0820('0xa1')]]);}else if(_0x18dea1[_0x0820('0x69')][_0x0820('0xda')]){_0x3e0dac=util[_0x0820('0x73')]('SIP/%s',_0x18dea1[_0x0820('0x69')][_0x0820('0xda')]);}else{_0x3e0dac=util['format'](_0x0820('0xae'),_0x44b49b[_0x0820('0x44')]);}socket['to'](util['format']('user:%s',_0x44b49b['name']))['emit'](_0x0820('0xdb'),{'ip':_0x18dea1[_0x0820('0xdc')][_0x0820('0xdd')]||_0x18dea1[_0x0820('0xde')][_0x0820('0xdf')]||_0x18dea1['socket'][_0x0820('0xdf')]||_0x18dea1[_0x0820('0xde')]['socket'][_0x0820('0xdf')]});return db['UserVoiceQueueRt'][_0x0820('0x38')]({'where':{'membername':_0x44b49b[_0x0820('0x44')]},'individualHooks':!![]});}}else{throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x0820('0x37')](function(){if(_0x44b49b){return _0x44b49b['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x21c6b9){if(_0x44b49b){var _0x11768e=[];if(_0x21c6b9){_0x70736d=_0x21c6b9;if(_0x70736d[_0x0820('0x57')]){for(var _0x11abb7=0x0;_0x11abb7<_0x70736d[_0x0820('0x57')];_0x11abb7++){_0x11768e[_0x0820('0xad')]({'membername':_0x44b49b[_0x0820('0x44')],'UserId':_0x44b49b['id'],'queue_name':_0x70736d[_0x11abb7][_0x0820('0x44')],'VoiceQueueId':_0x70736d[_0x11abb7]['id'],'interface':_0x3e0dac,'paused':_0x44b49b['loginInPause']||![],'penalty':_0x70736d[_0x11abb7][_0x0820('0xe0')]||0x0});}return BPromise[_0x0820('0xaf')](_0x11768e,function(_0x1415da){return db[_0x0820('0xb3')]['upsert'](_0x1415da);});}}}})[_0x0820('0x37')](function(){if(_0x44b49b){return db[_0x0820('0xe1')][_0x0820('0x63')]({'where':{'membername':_0x44b49b['name'],'exitAt':null}});}})[_0x0820('0x37')](function(_0x4507b4){if(_0x44b49b){var _0x4f4417=[];_0x4507b4['forEach'](function(_0x1063dc){_0x4f4417[_0x0820('0xad')](_0x1063dc[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0820('0xe2')](_0x4f4417);}})['then'](function(){if(_0x44b49b){var _0x4de580=[];var _0x2892ac=[];var _0x6f8e3d=utils['getChannels']();var _0x1f9efb={'membername':_0x44b49b[_0x0820('0x44')],'interface':_0x3e0dac,'enterAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'role':_0x44b49b[_0x0820('0x42')],'internal':_0x44b49b[_0x0820('0x76')]};_0x6f8e3d[_0x0820('0xe4')](function(_0x5210f6){_0x4de580[_0x0820('0xad')](_[_0x0820('0x5c')]({'channel':_0x5210f6,'type':'LOGIN','data1':_0x18dea1[_0x0820('0x69')][_0x0820('0xe5')],'data2':_0x3e0dac},_0x1f9efb));if(_0x44b49b[_0x0820('0xd9')]){_0x2892ac['push'](_[_0x0820('0x5c')]({'channel':_0x5210f6,'type':_0x0820('0xe6'),'data1':_0x0820('0xe7')},_0x1f9efb));}});return db[_0x0820('0xe1')][_0x0820('0x68')](_0x4de580[_0x0820('0xe8')](_0x2892ac),{'individualHooks':!![]});}})['then'](function(){if(_0x44b49b){return _0x44b49b[_0x0820('0x36')]({'online':!![],'lastLoginAt':moment()['format'](_0x0820('0xe3')),'voicePause':_0x44b49b[_0x0820('0xd9')]||![],'mailPause':_0x44b49b[_0x0820('0xd9')]||![],'chatPause':_0x44b49b[_0x0820('0xd9')]||![],'faxPause':_0x44b49b[_0x0820('0xd9')]||![],'smsPause':_0x44b49b[_0x0820('0xd9')]||![],'openchannelPause':_0x44b49b[_0x0820('0xd9')]||![],'whatsappPause':_0x44b49b['loginInPause']||![],'pauseType':_0x44b49b['loginInPause']?'LOGININPAUSE':null,'interface':_0x3e0dac,'lastPauseAt':moment()[_0x0820('0x73')](_0x0820('0xe3'))});}})['then'](function(_0x463bdc){if(_0x18dea1['isMiddleware']){return _0x5b7574();}else{return BPromise[_0x0820('0xe9')](_0x463bdc)['then'](respondWithResult(_0x18d9e4,null));}})['catch'](handleError(_0x18d9e4,null));};exports['logout']=function(_0x9bed1f,_0x3e095e,_0x519332){var _0x4f7b05;return db['User']['find']({'where':{'id':_0x9bed1f[_0x0820('0x66')]['id'],'role':_0x0820('0x3b')},'attributes':['id','name',_0x0820('0x42')]})[_0x0820('0x37')](handleEntityNotFound(_0x3e095e,null))[_0x0820('0x37')](function(_0x4dfd6f){if(_0x4dfd6f){_0x4f7b05=_0x4dfd6f;return db[_0x0820('0xb3')][_0x0820('0x38')]({'where':{'membername':_0x4f7b05[_0x0820('0x44')]},'individualHooks':!![]});}})[_0x0820('0x37')](function(){return db['MemberReport'][_0x0820('0x63')]({'where':{'membername':_0x4f7b05[_0x0820('0x44')],'exitAt':null}});})[_0x0820('0x37')](function(_0x133091){var _0x182dc3=[];_0x133091[_0x0820('0xe4')](function(_0x22d5e9){_0x182dc3[_0x0820('0xad')](_0x22d5e9['update']({'exitAt':moment()[_0x0820('0x73')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0820('0xe2')](_0x182dc3);})[_0x0820('0x37')](function(){return _0x4f7b05[_0x0820('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0820('0x37')](respondWithResult(_0x3e095e,null))[_0x0820('0x2c')](handleError(_0x3e095e,null));};exports[_0x0820('0xea')]=function(_0x2d77ef,_0xa9dda7,_0x4b591d){var _0x3ecf86;return db['UserVoiceQueueRt'][_0x0820('0x36')]({'paused':0x1},{'where':{'UserId':_0x2d77ef[_0x0820('0x66')]['id']},'individualHooks':!![]})[_0x0820('0x37')](function(){return db['User'][_0x0820('0x43')]({'where':{'id':_0x2d77ef[_0x0820('0x66')]['id'],'role':_0x0820('0x3b')},'attributes':['id',_0x0820('0x44'),'role',_0x0820('0x76'),_0x0820('0xa1')]});})[_0x0820('0x37')](handleEntityNotFound(_0xa9dda7,null))[_0x0820('0x37')](function(_0x42e725){if(_0x42e725){_0x3ecf86=_0x42e725;return respondWithRpcPromise(_0x0820('0xeb'),_0x0820('0xea'),{'id':_0x3ecf86['id'],'name':_0x3ecf86[_0x0820('0x44')],'pause':!![]});}})[_0x0820('0x37')](function(){if(_0x3ecf86){return db[_0x0820('0xe1')][_0x0820('0x63')]({'where':{'membername':_0x3ecf86[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}});}})[_0x0820('0x37')](function(_0x4f40cf){if(_0x4f40cf['length']){var _0x406299=moment()[_0x0820('0x73')](_0x0820('0xe3'));for(var _0x366868=0x0,_0x5e02d1=_0x4f40cf[_0x0820('0x57')];_0x366868<_0x5e02d1;_0x366868++){_0x4f40cf[_0x366868][_0x0820('0xec')]({'exitAt':_0x406299});}}})['then'](function(){var _0x55e08d=[];var _0x113ca6=utils[_0x0820('0xed')]();_0x113ca6['forEach'](function(_0x4a498d){_0x55e08d['push']({'channel':_0x4a498d,'membername':_0x3ecf86[_0x0820('0x44')],'interface':_[_0x0820('0x79')](_0x3ecf86[_0x0820('0xa1')])?util[_0x0820('0x73')](_0x0820('0xae'),_0x3ecf86[_0x0820('0x44')]):_0x3ecf86[_0x0820('0xa1')],'type':_0x0820('0xe6'),'enterAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data1':_0x2d77ef[_0x0820('0x69')][_0x0820('0x4c')]||_0x0820('0xee'),'role':_0x3ecf86[_0x0820('0x42')],'internal':_0x3ecf86[_0x0820('0x76')]});});return db[_0x0820('0xe1')]['bulkCreate'](_0x55e08d,{'individualHooks':!![]});})['then'](function(){return _0x3ecf86[_0x0820('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2d77ef[_0x0820('0x69')][_0x0820('0x4c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0820('0x73')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0xa9dda7,null))[_0x0820('0x2c')](handleError(_0xa9dda7,null));};exports[_0x0820('0xef')]=function(_0x2000d0,_0x29bf54,_0x178a89){var _0x5f285a;return db['User'][_0x0820('0x43')]({'where':{'id':_0x2000d0[_0x0820('0x66')]['id']},'attributes':['id',_0x0820('0x44'),'role',_0x0820('0xa0'),_0x0820('0xf0'),'chatPause','faxPause','openchannelPause',_0x0820('0xf1'),_0x0820('0xf2'),'pauseType',_0x0820('0xf3')]})[_0x0820('0x37')](handleEntityNotFound(_0x29bf54,null))[_0x0820('0x37')](function(_0x302190){if(_0x302190){_0x5f285a=_0x302190;if(_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')]&&!utils[_0x0820('0xa2')](_0x2000d0[_0x0820('0x69')]['channel'])){throw new db[(_0x0820('0x20'))][(_0x0820('0x96'))](_0x0820('0xa3'));}switch(_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')]){case _0x0820('0xac'):return respondWithRpcPromise(_0x0820('0xeb'),_0x0820('0xef'),{'id':_0x5f285a['id'],'name':_0x5f285a[_0x0820('0x44')],'pause':![]})[_0x0820('0x37')](function(){return db['UserVoiceQueueRt'][_0x0820('0x36')]({'paused':0x0},{'where':{'UserId':_0x5f285a['id']},'individualHooks':!![]});})['then'](function(){return db[_0x0820('0xe1')][_0x0820('0x43')]({'where':{'channel':_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')],'membername':_0x5f285a[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}});})[_0x0820('0x37')](function(_0x98fa7a){if(_0x98fa7a){return _0x98fa7a[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data2':_0x0820('0xf4')},{'individualHooks':!![]});}return null;})[_0x0820('0x37')](function(){return _0x5f285a[_0x0820('0x36')]({'voicePause':![]});});case _0x0820('0xf5'):case _0x0820('0xf6'):case _0x0820('0xf7'):case'sms':case _0x0820('0xf8'):case _0x0820('0xf9'):return db['MemberReport'][_0x0820('0x43')]({'where':{'channel':_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')],'membername':_0x5f285a[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}})['then'](function(_0x413bea){if(_0x413bea){return _0x413bea[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x0820('0x37')](function(){var _0x76de13={};_['set'](_0x76de13,util[_0x0820('0x73')]('%s%s',_0x2000d0[_0x0820('0x69')][_0x0820('0x9e')],'Pause'),![]);return _0x5f285a['update'](_0x76de13);});default:return respondWithRpcPromise(_0x0820('0xeb'),_0x0820('0xef'),{'id':_0x5f285a['id'],'name':_0x5f285a[_0x0820('0x44')],'pause':![]})[_0x0820('0x37')](function(){return db[_0x0820('0xb3')][_0x0820('0x36')]({'paused':0x0},{'where':{'UserId':_0x5f285a['id']}});})[_0x0820('0x37')](function(){return db[_0x0820('0xe1')][_0x0820('0x63')]({'where':{'membername':_0x5f285a[_0x0820('0x44')],'type':_0x0820('0xe6'),'exitAt':null}});})['then'](function(_0x36fcfd){var _0x325478=[];_0x36fcfd['forEach'](function(_0x1d3d9f){_0x325478['push'](_0x1d3d9f[_0x0820('0x36')]({'exitAt':moment()[_0x0820('0x73')](_0x0820('0xe3')),'data2':_0x0820('0xf4')}));});return BPromise[_0x0820('0xe2')](_0x325478);})[_0x0820('0x37')](function(){return _0x5f285a[_0x0820('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0820('0x37')](respondWithResult(_0x29bf54,null))['catch'](handleError(_0x29bf54,null));};exports[_0x0820('0xfa')]=function(_0xc146e,_0x1b3e03,_0x447733){var _0x397563={};var _0xb07dcf={};var _0xb437a6;var _0x45453d;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0xc146e[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x1b3e03,null))['then'](function(_0x4b98fa){if(_0x4b98fa){_0xb437a6=_0x4b98fa;_0xb07dcf[_0x0820('0x54')]=_[_0x0820('0x51')](db['Team']['rawAttributes']);_0xb07dcf[_0x0820('0x50')]=_[_0x0820('0x51')](_0xc146e[_0x0820('0x50')]);_0xb07dcf[_0x0820('0x52')]=_[_0x0820('0x53')](_0xb07dcf[_0x0820('0x54')],_0xb07dcf[_0x0820('0x50')]);_0x397563[_0x0820('0x55')]=_[_0x0820('0x53')](_0xb07dcf[_0x0820('0x54')],qs[_0x0820('0x56')](_0xc146e[_0x0820('0x50')][_0x0820('0x56')]));_0x397563[_0x0820('0x55')]=_0x397563[_0x0820('0x55')][_0x0820('0x57')]?_0x397563[_0x0820('0x55')]:_0xb07dcf['model'];_0x397563[_0x0820('0xc5')]=qs['sort'](_0xc146e[_0x0820('0x50')][_0x0820('0x59')]);_0x397563['where']=qs[_0x0820('0x52')](_[_0x0820('0x5a')](_0xc146e[_0x0820('0x50')],_0xb07dcf[_0x0820('0x52')]));if(_0xc146e[_0x0820('0x50')][_0x0820('0x3d')]){_0x397563[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x397563[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x397563[_0x0820('0x55')],function(_0x5dedcd){var _0x2d049a={};_0x2d049a[_0x5dedcd]={'$like':'%'+_0xc146e[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x2d049a;})});}_0x397563=_['merge']({},_0x397563,_0xc146e[_0x0820('0x60')]);return _0xb437a6[_0x0820('0xfa')](_0x397563);}})[_0x0820('0x37')](function(_0x156677){if(_0x156677){_0x45453d=_0x156677[_0x0820('0x57')];if(!_0xc146e[_0x0820('0x50')][_0x0820('0xbe')]('nolimit')){_0x397563[_0x0820('0x32')]=qs[_0x0820('0x32')](_0xc146e['query'][_0x0820('0x32')]);_0x397563['offset']=qs[_0x0820('0x31')](_0xc146e[_0x0820('0x50')][_0x0820('0x31')]);}return _0xb437a6['getTeams'](_0x397563);}})[_0x0820('0x37')](function(_0x540567){if(_0x540567){return _0x540567?{'count':_0x45453d,'rows':_0x540567}:null;}})['then'](respondWithResult(_0x1b3e03,null))[_0x0820('0x2c')](handleError(_0x1b3e03,null));};exports[_0x0820('0xfb')]=function(_0x5ad079,_0x5f169a){return db[_0x0820('0x49')]['find']({'where':{'id':_0x5ad079[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x5f169a,null))[_0x0820('0x37')](function(_0x3e8dc8){if(_0x3e8dc8){var _0xc1d0cf=_0x3e8dc8[_0x0820('0x8b')]({'plain':!![]});return _0x3e8dc8[_0x0820('0xfb')](_0x5ad079[_0x0820('0x69')]['ids'],_[_0x0820('0x6c')](_0x5ad079[_0x0820('0x69')],[_0x0820('0x6d'),'id'])||{})[_0x0820('0x37')](function(){for(var _0x4e673e=0x0;_0x4e673e<_0x5ad079[_0x0820('0x69')][_0x0820('0x6d')][_0x0820('0x57')];_0x4e673e++){var _0x54bd20=[];db['Team'][_0x0820('0x93')]({'where':{'id':_0x5ad079[_0x0820('0x69')][_0x0820('0x6d')][_0x4e673e]}})[_0x0820('0x37')](function(_0x4d1fd3){_0x54bd20['push'](_0x4d1fd3[_0x0820('0xfc')]()['then'](function(_0x267162){for(var _0xe3963a=0x0;_0xe3963a<_0x267162['length'];_0xe3963a++){_0x267162[_0xe3963a][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0xfe'));}return _0x267162;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0xff')]()['then'](function(_0x48bec3){for(var _0x55d3d3=0x0;_0x55d3d3<_0x48bec3[_0x0820('0x57')];_0x55d3d3++){_0x48bec3[_0x55d3d3][_0x0820('0xfd')](_0x0820('0x9e'),'Chat');}return _0x48bec3;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x100')]()[_0x0820('0x37')](function(_0x4a142a){for(var _0x369bc3=0x0;_0x369bc3<_0x4a142a[_0x0820('0x57')];_0x369bc3++){_0x4a142a[_0x369bc3]['setDataValue'](_0x0820('0x9e'),_0x0820('0x101'));}return _0x4a142a;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x102')]()[_0x0820('0x37')](function(_0x3e70a2){for(var _0x3a8bb=0x0;_0x3a8bb<_0x3e70a2[_0x0820('0x57')];_0x3a8bb++){_0x3e70a2[_0x3a8bb][_0x0820('0xfd')]('channel',_0x0820('0x103'));}return _0x3e70a2;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x104')]()[_0x0820('0x37')](function(_0x5df062){for(var _0xa1e07b=0x0;_0xa1e07b<_0x5df062['length'];_0xa1e07b++){_0x5df062[_0xa1e07b][_0x0820('0xfd')]('channel',_0x0820('0x105'));}return _0x5df062;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x106')]()[_0x0820('0x37')](function(_0x1d6c42){for(var _0x16c9d3=0x0;_0x16c9d3<_0x1d6c42[_0x0820('0x57')];_0x16c9d3++){_0x1d6c42[_0x16c9d3][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0x107'));}return _0x1d6c42;}));_0x54bd20[_0x0820('0xad')](_0x4d1fd3[_0x0820('0x108')]()['then'](function(_0x3042f4){for(var _0x4a6e33=0x0;_0x4a6e33<_0x3042f4['length'];_0x4a6e33++){_0x3042f4[_0x4a6e33]['setDataValue'](_0x0820('0x9e'),'Openchannel');}return _0x3042f4;}));return BPromise['all'](_0x54bd20);})[_0x0820('0x37')](function(_0x2dc337){var _0x1607da=_[_0x0820('0x109')](_0x2dc337);_0x54bd20=[];return db[_0x0820('0x5d')][_0x0820('0x10a')](function(_0x2cce05){for(var _0x3cd237=0x0;_0x3cd237<_0x1607da['length'];_0x3cd237++){_0x54bd20['push'](_0x1607da[_0x3cd237][_0x0820('0x10b')](_0xc1d0cf['id']),{'transaction':_0x2cce05});}return BPromise['all'](_0x54bd20)[_0x0820('0x37')](function(){if(_0xc1d0cf[_0x0820('0x9f')]){return BPromise[_0x0820('0xaf')](_[_0x0820('0x3d')](_0x1607da,function(_0x492da9){return _0x492da9[_0x0820('0x10c')](_0x0820('0x9e'))===_0x0820('0xfe');}),function(_0x3753cc){return db[_0x0820('0xb3')]['upsert']({'membername':_0xc1d0cf[_0x0820('0x44')],'UserId':_0xc1d0cf['id'],'queue_name':_0x3753cc['name'],'VoiceQueueId':_0x3753cc['id'],'interface':_[_0x0820('0x79')](_0xc1d0cf[_0x0820('0xa1')])?util[_0x0820('0x73')](_0x0820('0xae'),_0xc1d0cf[_0x0820('0x44')]):_0xc1d0cf[_0x0820('0xa1')],'paused':_0xc1d0cf[_0x0820('0xa0')]||![],'penalty':_0xc1d0cf[_0x0820('0x10d')]},{'transaction':_0x2cce05});});}else{return;}})['then'](function(){for(var _0x5f2e06=0x0;_0x5f2e06<_0x1607da[_0x0820('0x57')];_0x5f2e06++){var _0x5216b3=_0x1607da[_0x5f2e06][_0x0820('0x10c')](_0x0820('0x9e'));var _0x2b48e7=_0x5216b3+_0x0820('0xa9');socket['emit'](_0x0820('0x39')+_0x5216b3+_0x0820('0xab'),{'UserId':_0xc1d0cf['id'],['queueField']:_0x1607da[_0x5f2e06]['id']});}});});});}});}})[_0x0820('0x37')](respondWithStatusCode(_0x5f169a,null))[_0x0820('0x2c')](handleError(_0x5f169a,null));};exports[_0x0820('0x10e')]=function(_0x28e597,_0x36c7ab){return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x28e597[_0x0820('0x66')]['id']}})[_0x0820('0x37')](handleEntityNotFound(_0x36c7ab,null))[_0x0820('0x37')](function(_0x259fb0){if(_0x259fb0){var _0xeabbec=_0x259fb0[_0x0820('0x8b')]({'plain':!![]});var _0xfa8e34=_0x28e597[_0x0820('0x50')][_0x0820('0x6d')];return _0x259fb0['removeTeams'](_0xfa8e34)[_0x0820('0x37')](function(){for(var _0x474151=0x0;_0x474151<_0xfa8e34[_0x0820('0x57')];_0x474151++){var _0xfcbd7=[];db[_0x0820('0x10f')][_0x0820('0x93')]({'where':{'id':_0xfa8e34[_0x474151]}})[_0x0820('0x37')](function(_0x4a120d){_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0xfc')]()[_0x0820('0x37')](function(_0x2f980c){for(var _0x68f7e5=0x0;_0x68f7e5<_0x2f980c[_0x0820('0x57')];_0x68f7e5++){_0x2f980c[_0x68f7e5]['setDataValue'](_0x0820('0x9e'),_0x0820('0xfe'));}return _0x2f980c;}));_0xfcbd7['push'](_0x4a120d[_0x0820('0xff')]()['then'](function(_0x6bfd17){for(var _0x4ac6ed=0x0;_0x4ac6ed<_0x6bfd17[_0x0820('0x57')];_0x4ac6ed++){_0x6bfd17[_0x4ac6ed]['setDataValue']('channel',_0x0820('0x110'));}return _0x6bfd17;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0x100')]()[_0x0820('0x37')](function(_0x5c5f4f){for(var _0x249b1b=0x0;_0x249b1b<_0x5c5f4f['length'];_0x249b1b++){_0x5c5f4f[_0x249b1b]['setDataValue'](_0x0820('0x9e'),'Mail');}return _0x5c5f4f;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0x102')]()[_0x0820('0x37')](function(_0x37a70e){for(var _0x5e9f41=0x0;_0x5e9f41<_0x37a70e['length'];_0x5e9f41++){_0x37a70e[_0x5e9f41][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0x103'));}return _0x37a70e;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d['getWhatsappQueues']()['then'](function(_0x2165f0){for(var _0x47872c=0x0;_0x47872c<_0x2165f0['length'];_0x47872c++){_0x2165f0[_0x47872c]['setDataValue'](_0x0820('0x9e'),_0x0820('0x105'));}return _0x2165f0;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d[_0x0820('0x106')]()[_0x0820('0x37')](function(_0x1ff0c9){for(var _0x3f7fd8=0x0;_0x3f7fd8<_0x1ff0c9[_0x0820('0x57')];_0x3f7fd8++){_0x1ff0c9[_0x3f7fd8]['setDataValue'](_0x0820('0x9e'),'Fax');}return _0x1ff0c9;}));_0xfcbd7[_0x0820('0xad')](_0x4a120d['getOpenchannelQueues']()[_0x0820('0x37')](function(_0x230cc9){for(var _0x1a84fa=0x0;_0x1a84fa<_0x230cc9[_0x0820('0x57')];_0x1a84fa++){_0x230cc9[_0x1a84fa][_0x0820('0xfd')](_0x0820('0x9e'),_0x0820('0x111'));}return _0x230cc9;}));return BPromise['all'](_0xfcbd7);})[_0x0820('0x37')](function(_0x1753a7){var _0x50b7e9=_[_0x0820('0x109')](_0x1753a7);_0xfcbd7=[];return db['sequelize'][_0x0820('0x10a')](function(_0x5671bb){for(var _0x4625fb=0x0;_0x4625fb<_0x50b7e9['length'];_0x4625fb++){_0xfcbd7[_0x0820('0xad')](_0x50b7e9[_0x4625fb][_0x0820('0x112')](_0xeabbec['id']),{'transaction':_0x5671bb});}return BPromise[_0x0820('0xe2')](_0xfcbd7)[_0x0820('0x37')](function(){if(_0xeabbec[_0x0820('0x9f')]){return BPromise['each'](_[_0x0820('0x3d')](_0x50b7e9,function(_0x251242){return _0x251242[_0x0820('0x10c')](_0x0820('0x9e'))===_0x0820('0xfe');}),function(_0x4bafad){return db['UserVoiceQueueRt'][_0x0820('0x38')]({'where':{'VoiceQueueId':_0x4bafad['id'],'UserId':_0xeabbec['id']},'transaction':_0x5671bb});});}else{return;}})[_0x0820('0x37')](function(){for(var _0x4a8916=0x0;_0x4a8916<_0x50b7e9[_0x0820('0x57')];_0x4a8916++){var _0x1c637d=_0x50b7e9[_0x4a8916][_0x0820('0x10c')](_0x0820('0x9e'));var _0x2cc861=_0x1c637d+'QueueId';socket[_0x0820('0xaa')](_0x0820('0x39')+_0x1c637d+_0x0820('0xb2'),{'UserId':_0xeabbec['id'],['queueField']:_0x50b7e9[_0x4a8916]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x36c7ab,null))[_0x0820('0x2c')](handleError(_0x36c7ab,null));};exports[_0x0820('0x113')]=function(_0x560f14,_0x32844d,_0xa7377e){var _0x48b5f0={};var _0x2ab60f={};var _0x1bc41a;var _0x476eff;return db[_0x0820('0x49')][_0x0820('0x93')]({'where':{'id':_0x560f14[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x32844d,null))['then'](function(_0x253613){if(_0x253613){_0x1bc41a=_0x253613;_0x2ab60f['model']=_['keys'](db[_0x0820('0x114')][_0x0820('0x4a')]);_0x2ab60f['query']=_[_0x0820('0x51')](_0x560f14[_0x0820('0x50')]);_0x2ab60f[_0x0820('0x52')]=_[_0x0820('0x53')](_0x2ab60f[_0x0820('0x54')],_0x2ab60f['query']);_0x48b5f0[_0x0820('0x55')]=_[_0x0820('0x53')](_0x2ab60f[_0x0820('0x54')],qs[_0x0820('0x56')](_0x560f14[_0x0820('0x50')][_0x0820('0x56')]));_0x48b5f0[_0x0820('0x55')]=_0x48b5f0[_0x0820('0x55')]['length']?_0x48b5f0['attributes']:_0x2ab60f['model'];_0x48b5f0[_0x0820('0xc5')]=qs[_0x0820('0x59')](_0x560f14['query']['sort']);_0x48b5f0[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x560f14[_0x0820('0x50')],_0x2ab60f[_0x0820('0x52')]));if(_0x560f14[_0x0820('0x50')][_0x0820('0x3d')]){_0x48b5f0[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x48b5f0[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x48b5f0['attributes'],function(_0x14bb38){var _0x76607b={};_0x76607b[_0x14bb38]={'$like':'%'+_0x560f14[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x76607b;})});}_0x48b5f0=_[_0x0820('0x5c')]({},_0x48b5f0,_0x560f14[_0x0820('0x60')]);return _0x1bc41a[_0x0820('0x113')](_0x48b5f0);}})[_0x0820('0x37')](function(_0x45ee5b){if(_0x45ee5b){_0x476eff=_0x45ee5b[_0x0820('0x57')];if(!_0x560f14[_0x0820('0x50')]['hasOwnProperty'](_0x0820('0x58'))){_0x48b5f0[_0x0820('0x32')]=qs['limit'](_0x560f14['query'][_0x0820('0x32')]);_0x48b5f0[_0x0820('0x31')]=qs['offset'](_0x560f14[_0x0820('0x50')][_0x0820('0x31')]);}return _0x1bc41a[_0x0820('0x113')](_0x48b5f0);}})[_0x0820('0x37')](function(_0x3f26d8){if(_0x3f26d8){return _0x3f26d8?{'count':_0x476eff,'rows':_0x3f26d8}:null;}})[_0x0820('0x37')](respondWithResult(_0x32844d,null))['catch'](handleError(_0x32844d,null));};exports[_0x0820('0x115')]=function(_0x50e116,_0x5a1c90,_0x2654d7){var _0x4bfd1c={};var _0x364951={};var _0x3e0005;var _0x57435e;return db['User'][_0x0820('0x93')]({'where':{'id':_0x50e116[_0x0820('0x66')]['id']}})['then'](handleEntityNotFound(_0x5a1c90,null))['then'](function(_0x301525){if(_0x301525){_0x3e0005=_0x301525;_0x364951['model']=_['keys'](db[_0x0820('0x49')][_0x0820('0x4a')]);_0x364951[_0x0820('0x50')]=_[_0x0820('0x51')](_0x50e116[_0x0820('0x50')]);_0x364951[_0x0820('0x52')]=_['intersection'](_0x364951['model'],_0x364951[_0x0820('0x50')]);_0x4bfd1c['attributes']=_[_0x0820('0x53')](_0x364951[_0x0820('0x54')],qs[_0x0820('0x56')](_0x50e116[_0x0820('0x50')]['fields']));_0x4bfd1c[_0x0820('0x55')]=_0x4bfd1c[_0x0820('0x55')][_0x0820('0x57')]?_0x4bfd1c[_0x0820('0x55')]:_0x364951['model'];_0x4bfd1c[_0x0820('0xc5')]=qs['sort'](_0x50e116['query']['sort']);_0x4bfd1c[_0x0820('0x5b')]=qs['filters'](_[_0x0820('0x5a')](_0x50e116['query'],_0x364951[_0x0820('0x52')]));if(_0x50e116[_0x0820('0x50')]['filter']){_0x4bfd1c[_0x0820('0x5b')]=_[_0x0820('0x5c')](_0x4bfd1c[_0x0820('0x5b')],{'$or':_[_0x0820('0x3f')](_0x4bfd1c[_0x0820('0x55')],function(_0x13a128){var _0x2aaf5d={};_0x2aaf5d[_0x13a128]={'$like':'%'+_0x50e116[_0x0820('0x50')][_0x0820('0x3d')]+'%'};return _0x2aaf5d;})});}_0x4bfd1c[_0x0820('0x54')]=db[_0x0820('0x49')];_0x4bfd1c['as']=_0x0820('0x3a');_0x4bfd1c=_[_0x0820('0x5c')]({},_0x4bfd1c,_0x50e116[_0x0820('0x60')]);return _0x3e0005['getVoiceQueues']({'include':[_0x4bfd1c]});}})[_0x0820('0x37')](function(_0x2b78d7){if(_0x2b78d7){var _0x2ebd4b={},_0x11b802=[],_0x317a84=0x0;for(var _0x4fe56d=0x0;_0x4fe56d<_0x2b78d7[_0x0820('0x57')];_0x4fe56d+=0x1){for(var _0x3d37dd=0x0,_0x46a771;_0x3d37dd<_0x2b78d7[_0x4fe56d][_0x0820('0x3a')][_0x0820('0x57')];_0x3d37dd+=0x1){_0x46a771=_0x2b78d7[_0x4fe56d][_0x0820('0x3a')][_0x3d37dd]['get']({'plain':!![]});_0x2ebd4b[_0x46a771['id']]=_0x46a771;}}_0x2ebd4b=_[_0x0820('0x116')](_0x2ebd4b);for(var _0x31a689=qs[_0x0820('0x31')](_0x50e116[_0x0820('0x50')][_0x0820('0x31')]);_0x31a689<_0x2ebd4b['length']&&_0x11b802[_0x0820('0x57')]=_0x437a5c){_0xbb2120=_0x437a5c;_0x4a30cd=0xc8;}else{_0x4a30cd=0xce;}_0x42e4d1[_0x0753('0x2f')](_0x4a30cd);return _0x42e4d1['set']('Content-Range',_0x3d4ef5+'-'+_0xbb2120+'/'+_0x437a5c)[_0x0753('0x2b')](_0x50e814);}return null;};}function patchUpdates(_0x12af7a){return function(_0x5cd9bf){try{jsonpatch[_0x0753('0x30')](_0x5cd9bf,_0x12af7a,!![]);}catch(_0x1a92ab){return BPromise['reject'](_0x1a92ab);}return _0x5cd9bf['save']();};}function saveUpdates(_0xd69c6f,_0x52e231){return function(_0x266576){if(_0x266576){return _0x266576[_0x0753('0x31')](_0xd69c6f)[_0x0753('0x20')](function(_0x3d7141){return _0x3d7141;});}return null;};}function removeEntity(_0x2ba724,_0x1a92d9){return function(_0x59d427){if(_0x59d427){return _0x59d427['destroy']()[_0x0753('0x20')](function(){var _0x5ed4e7=_0x59d427[_0x0753('0x32')]({'plain':!![]});var _0x41e2da=[{'name':_0x0753('0x33'),'value':_0x0753('0x34'),'ignore':!![]},{'name':'Agents','value':_0x0753('0x35'),'ignore':![]},{'name':_0x0753('0x36'),'value':_0x0753('0x37'),'ignore':![]}];var _0x4debae=_(_0x41e2da)[_0x0753('0x38')](_0x0753('0x39'))['map']('value')[_0x0753('0x3a')]();if(_[_0x0753('0x3b')](_0x4debae,_0x5ed4e7['role'])){return;}var _0x11435e=_[_0x0753('0x3c')](_0x41e2da,['value',_0x5ed4e7[_0x0753('0x3d')]])[_0x0753('0x3e')];return db['UserProfileResource'][_0x0753('0x3f')]({'where':{'type':_0x11435e,'resourceId':_0x5ed4e7['id']}})[_0x0753('0x20')](function(){return _0x59d427;});})[_0x0753('0x20')](function(){_0x2ba724[_0x0753('0x2f')](0xcc)[_0x0753('0x2a')]();});}};}function handleEntityNotFound(_0x2c8f25,_0x42b2c8){return function(_0x2f7ebc){if(!_0x2f7ebc){_0x2c8f25[_0x0753('0x40')](0x194);}return _0x2f7ebc;};}function handleError(_0x42f44e,_0x2c18c8){_0x2c18c8=_0x2c18c8||0x1f4;return function(_0x5c3d56){logger[_0x0753('0x25')](_0x5c3d56[_0x0753('0x41')]);if(_0x5c3d56[_0x0753('0x3e')]){delete _0x5c3d56[_0x0753('0x3e')];}_0x42f44e[_0x0753('0x2f')](_0x2c18c8)[_0x0753('0x42')](_0x5c3d56);};}exports[_0x0753('0x43')]=function(_0x307d4e,_0x5aa451){var _0x3f5560={},_0x2106ca={},_0x3f553c={'count':0x0,'rows':[]};var _0x1f8283=_['map'](db['User'][_0x0753('0x44')],function(_0x3bd66c){return{'name':_0x3bd66c['fieldName'],'type':_0x3bd66c[_0x0753('0x45')][_0x0753('0x46')]};});_0x2106ca[_0x0753('0x47')]=_['differenceBy'](_[_0x0753('0x48')](_0x1f8283,_0x0753('0x3e')),[_0x0753('0x49'),_0x0753('0x4a')]);_0x2106ca['query']=_[_0x0753('0x4b')](_0x307d4e[_0x0753('0x4c')]);_0x2106ca[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x2106ca[_0x0753('0x47')],_0x2106ca[_0x0753('0x4c')]);_0x3f5560[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x2106ca[_0x0753('0x47')],qs['fields'](_0x307d4e['query']['fields']));_0x3f5560[_0x0753('0x4f')]=_0x3f5560[_0x0753('0x4f')][_0x0753('0x50')]?_0x3f5560[_0x0753('0x4f')]:_0x2106ca[_0x0753('0x47')];if(!_0x307d4e[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x3f5560[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x307d4e[_0x0753('0x4c')][_0x0753('0x2e')]);_0x3f5560['offset']=qs['offset'](_0x307d4e[_0x0753('0x4c')][_0x0753('0x2d')]);}_0x3f5560['order']=qs[_0x0753('0x53')](_0x307d4e[_0x0753('0x4c')][_0x0753('0x53')]);_0x3f5560[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x307d4e[_0x0753('0x4c')],_0x2106ca[_0x0753('0x4d')]),_0x1f8283);if(_0x307d4e[_0x0753('0x4c')]['filter']){_0x3f5560[_0x0753('0x54')]=_[_0x0753('0x56')](_0x3f5560[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x1f8283,function(_0x3790e9){if(_0x3790e9[_0x0753('0x45')]!==_0x0753('0x57')){return db[_0x0753('0x58')][_0x0753('0x54')](db[_0x0753('0x58')]['fn'](_0x0753('0x59'),db['sequelize']['col'](_0x3790e9[_0x0753('0x3e')])),{'$like':db['sequelize']['fn'](_0x0753('0x59'),'%'+_0x307d4e['query'][_0x0753('0x38')]+'%')});}})});}_0x3f5560=_['merge']({},_0x3f5560,_0x307d4e[_0x0753('0x5a')]);var _0x2d6dd3={'where':_0x3f5560['where']};return db[_0x0753('0x5b')][_0x0753('0x2c')](_0x2d6dd3)[_0x0753('0x20')](function(_0x2b58a0){_0x3f553c[_0x0753('0x2c')]=_0x2b58a0;if(_0x307d4e[_0x0753('0x4c')][_0x0753('0x5c')]){_0x3f5560[_0x0753('0x5d')]=[{'all':!![]}];}return db['User'][_0x0753('0x5e')](_0x3f5560);})['then'](function(_0x4bc1d3){_0x3f553c[_0x0753('0x5f')]=_0x4bc1d3;return _0x3f553c;})['then'](respondWithFilteredResult(_0x5aa451,_0x3f5560))[_0x0753('0x29')](handleError(_0x5aa451,null));};exports['show']=function(_0x22f33d,_0x2ffed5){var _0x4f6fc9={'raw':![],'where':{'id':_0x22f33d[_0x0753('0x60')]['id']}},_0x52e4d2={};_0x52e4d2[_0x0753('0x47')]=_[_0x0753('0x61')](_['keys'](db[_0x0753('0x5b')][_0x0753('0x44')]),[_0x0753('0x49'),_0x0753('0x4a')]);_0x52e4d2[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x22f33d[_0x0753('0x4c')]);_0x52e4d2[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x52e4d2[_0x0753('0x47')],_0x52e4d2[_0x0753('0x4c')]);_0x4f6fc9[_0x0753('0x4f')]=_['intersection'](_0x52e4d2[_0x0753('0x47')],qs['fields'](_0x22f33d['query']['fields']));_0x4f6fc9[_0x0753('0x4f')]=_0x4f6fc9['attributes'][_0x0753('0x50')]?_0x4f6fc9[_0x0753('0x4f')]:_0x52e4d2['model'];if(_0x22f33d[_0x0753('0x4c')]['includeAll']){_0x4f6fc9[_0x0753('0x5d')]=[{'all':!![]}];}_0x4f6fc9=_['merge']({},_0x4f6fc9,_0x22f33d[_0x0753('0x5a')]);return db['User'][_0x0753('0x3c')](_0x4f6fc9)[_0x0753('0x20')](handleEntityNotFound(_0x2ffed5,null))[_0x0753('0x20')](respondWithResult(_0x2ffed5,null))[_0x0753('0x29')](handleError(_0x2ffed5,null));};exports[_0x0753('0x62')]=function(_0x22b039,_0x4a8c60){return db[_0x0753('0x5b')][_0x0753('0x62')](_0x22b039['body'],{'raw':![],'individualHooks':!![]})[_0x0753('0x20')](respondWithResult(_0x4a8c60,0xc9))['catch'](handleError(_0x4a8c60,null));};exports['update']=function(_0x4df65b,_0x2e5dcf){if(_0x4df65b[_0x0753('0x63')]['id']){delete _0x4df65b[_0x0753('0x63')]['id'];}delete _0x4df65b[_0x0753('0x63')][_0x0753('0x3d')];return db[_0x0753('0x5b')]['find']({'where':{'id':_0x4df65b[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2e5dcf,null))[_0x0753('0x20')](saveUpdates(_0x4df65b[_0x0753('0x63')],null))[_0x0753('0x20')](respondWithResult(_0x2e5dcf,null))['catch'](handleError(_0x2e5dcf,null));};exports[_0x0753('0x64')]=function(_0xb6bcc6,_0x36ac46){return db['User'][_0x0753('0x64')]()['then'](respondWithResult(_0x36ac46,null))['catch'](handleError(_0x36ac46,null));};exports[_0x0753('0x65')]=function(_0x4a9b03,_0x3848a1,_0x2c2c9d){return db[_0x0753('0x5b')]['find']({'where':{'id':_0x4a9b03['params']['id']}})['then'](handleEntityNotFound(_0x3848a1,null))[_0x0753('0x20')](function(_0x5af1fd){if(_0x5af1fd){return _0x5af1fd[_0x0753('0x65')](_0x4a9b03[_0x0753('0x63')][_0x0753('0x66')],_[_0x0753('0x67')](_0x4a9b03[_0x0753('0x63')],[_0x0753('0x66'),'id'])||{});}})[_0x0753('0x20')](respondWithResult(_0x3848a1,null))[_0x0753('0x29')](handleError(_0x3848a1,null));};var getLicense=function(_0x303f58){return new BPromise(function(_0x2a771e,_0x3a626a){var _0x1bbd42=0x0;_0x303f58['body']['role']==='agent'&&_0x2a771e('agent\x20role');return db['User'][_0x0753('0x2c')]({'where':{'$or':[{'role':_0x303f58['body'][_0x0753('0x3d')]===_0x0753('0x37')?_0x0753('0x37'):[_0x0753('0x68'),'user']}]}})[_0x0753('0x20')](function(_0x652fe8){_0x1bbd42=_0x652fe8;return require(_0x0753('0x69'))['getLicense']();})[_0x0753('0x20')](function(_0x2d797f){var _0x15e57f=_0x303f58[_0x0753('0x63')][_0x0753('0x3d')]==='telephone'?_0x0753('0x6a'):_0x0753('0x6b');if(!_['isNil'](_0x2d797f[_0x15e57f])&&_0x1bbd42>=_0x2d797f[_0x15e57f]){return _0x3a626a({'message':'License\x20limit\x20reached'});}return _0x2a771e(util['format']('count\x20%s:\x20%s',_0x15e57f,_0x1bbd42));})[_0x0753('0x29')](function(_0x148d34){return _0x3a626a(_0x148d34);});});};exports[_0x0753('0x6c')]=function(_0x4dedf1,_0x57b019){return getLicense(_0x4dedf1)[_0x0753('0x20')](function(_0x439453){if(!_0x4dedf1[_0x0753('0x63')]['internal']){var _0x382699;return db['Setting'][_0x0753('0x6d')](0x1)[_0x0753('0x20')](function(_0x584f9b){return checkPasswordPattern(_0x584f9b,_0x4dedf1['body'][_0x0753('0x49')],_0x584f9b['securePassword']);})[_0x0753('0x20')](function(_0x26c0c6){_0x382699=_0x26c0c6[_0x0753('0x6e')];return db['User']['max']('internal');})[_0x0753('0x20')](function(_0x42ba3e){if(_[_0x0753('0x6f')](_0x42ba3e)){if(_0x382699){_0x4dedf1[_0x0753('0x63')]['internal']=_0x382699;}else{_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]=0x1;}}else{if(_[_0x0753('0x6f')](_0x382699)||_0x382699==_0x42ba3e){_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]=_0x42ba3e+0x1;}else if(_0x382699>_0x42ba3e){_0x4dedf1['body']['internal']=_0x382699;}else{return db[_0x0753('0x58')]['query'](_0x0753('0x71'),{'type':db[_0x0753('0x58')]['QueryTypes'][_0x0753('0x72')]})[_0x0753('0x20')](function(_0x2b2d57){if(_0x2b2d57&&_0x2b2d57[_0x0753('0x50')]){for(var _0x89255e=0x0,_0x3a4d64=_0x2b2d57[_0x0753('0x50')];_0x89255e<_0x3a4d64&&_[_0x0753('0x6f')](_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]);_0x89255e++){if(_0x382699<=_0x2b2d57[_0x89255e]['from']){_0x4dedf1[_0x0753('0x63')]['internal']=_0x2b2d57[_0x89255e][_0x0753('0x73')];}else if(_0x382699>_0x2b2d57[_0x89255e][_0x0753('0x73')]&&_0x382699<=_0x2b2d57[_0x89255e]['to']){_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')]=_0x382699;}}}if(_['isNil'](_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')])){_0x4dedf1['body'][_0x0753('0x70')]=_0x42ba3e+0x1;}});}}});}})[_0x0753('0x20')](function(){if(_0x4dedf1[_0x0753('0x63')][_0x0753('0x74')]){_0x4dedf1[_0x0753('0x63')][_0x0753('0x75')]=_0x4dedf1[_0x0753('0x63')][_0x0753('0x70')];_0x4dedf1['body'][_0x0753('0x76')]={'mailbox':_0x4dedf1[_0x0753('0x63')]['internal'],'password':_0x4dedf1['body']['password'],'fullname':_0x4dedf1[_0x0753('0x63')][_0x0753('0x77')],'email':_0x4dedf1[_0x0753('0x63')][_0x0753('0x78')]};}if(_0x4dedf1[_0x0753('0x63')]&&_0x4dedf1[_0x0753('0x63')]['role']===_0x0753('0x35')){if(!_0x4dedf1['body'][_0x0753('0x79')]){_0x4dedf1[_0x0753('0x63')][_0x0753('0x79')]=[_0x0753('0x7a'),_0x0753('0x7b'),'103',_0x0753('0x7c'),_0x0753('0x7d'),_0x0753('0x7e'),_0x0753('0x7f'),_0x0753('0x80'),'107',_0x0753('0x81'),'109','100',_0x0753('0x82'),_0x0753('0x83')];}}return db[_0x0753('0x5b')][_0x0753('0x6c')](_0x4dedf1[_0x0753('0x63')],{'include':[{'model':db['VoiceMail'],'as':_0x0753('0x76')}]});})['then'](function(_0x560fd2){if(_0x4dedf1[_0x0753('0x63')][_0x0753('0x3d')]===_0x0753('0x34'))return _0x560fd2;var _0x56ed53=_0x4dedf1[_0x0753('0x34')][_0x0753('0x32')]({'plain':!![]});if(!_0x56ed53)throw new Error(_0x0753('0x84'));if(_0x56ed53[_0x0753('0x3d')]===_0x0753('0x34')){var _0x527889=_0x560fd2['get']({'plain':!![]});var _0x592e8d=[{'name':_0x0753('0x85'),'value':_0x0753('0x35')},{'name':'Telephones','value':'telephone'}];var _0x23854a=_[_0x0753('0x3c')](_0x592e8d,['value',_0x527889['role']])['name'];return db[_0x0753('0x86')][_0x0753('0x3c')]({'where':{'name':_0x23854a,'userProfileId':_0x56ed53['userProfileId']},'raw':!![]})['then'](function(_0x3b4e63){if(_0x3b4e63&&_0x3b4e63['autoAssociation']===0x0){return db[_0x0753('0x87')][_0x0753('0x6c')]({'name':_0x527889['name'],'resourceId':_0x527889['id'],'type':_0x3b4e63['name'],'sectionId':_0x3b4e63['id']},{})[_0x0753('0x20')](function(){return _0x560fd2;});}else{return _0x560fd2;}})[_0x0753('0x29')](function(_0x3b55fc){logger[_0x0753('0x25')](_0x0753('0x88'),_0x3b55fc);throw _0x3b55fc;});}return _0x560fd2;})[_0x0753('0x20')](respondWithResult(_0x57b019,0xc9))['catch'](handleError(_0x57b019,null));};exports[_0x0753('0x89')]=function(_0x4daae5,_0x4b73aa,_0x14ff33){var _0x398d78=![];if(_0x4daae5[_0x0753('0x63')]['id']){delete _0x4daae5[_0x0753('0x63')]['id'];}return db[_0x0753('0x8a')][_0x0753('0x8b')]({'attributes':['id',_0x0753('0x8c')]})['then'](function(_0x1b6ece){_0x398d78=_0x1b6ece[_0x0753('0x8c')];return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x4daae5[_0x0753('0x60')]['id']}});})[_0x0753('0x20')](function(_0x2d72b1){if(_0x2d72b1){if(_0x2d72b1['id']==_0x4daae5['user']['id']){if(!_0x4daae5[_0x0753('0x63')]['oldPassword']||!_0x4daae5[_0x0753('0x63')][_0x0753('0x8d')]){throw new db[(_0x0753('0x1c'))]['ValidationError'](_0x0753('0x8e'));}if(!_0x2d72b1['authenticate'](_0x4daae5['body']['oldPassword'])){throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0x8f'));}if(_0x4daae5[_0x0753('0x63')]['oldPassword']==_0x4daae5[_0x0753('0x63')]['newPassword']){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x90'));}return _0x2d72b1;}else if(_0x4daae5['user'][_0x0753('0x3d')]==_0x0753('0x68')){if(!_0x4daae5[_0x0753('0x63')]['newPassword']){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x2d72b1;}else if(_0x4daae5[_0x0753('0x34')][_0x0753('0x3d')]=='user'){if(!_0x4daae5[_0x0753('0x63')][_0x0753('0x8d')]){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x91'));}if(_0x2d72b1[_0x0753('0x3d')]!=_0x0753('0x35')){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x92'));}return _0x2d72b1;}else{throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0x92'));}}return null;})[_0x0753('0x20')](handleEntityNotFound(_0x4b73aa,null))[_0x0753('0x20')](function(_0x3bc356){return checkPasswordPattern(_0x3bc356,_0x4daae5[_0x0753('0x63')]['newPassword'],_0x398d78);})[_0x0753('0x20')](saveUpdates({'password':_0x4daae5['body'][_0x0753('0x8d')],'passwordResetAt':_0x4daae5['user']['id']==_0x4daae5[_0x0753('0x60')]['id']?moment():null},null))[_0x0753('0x20')](respondWithResult(_0x4b73aa,null))[_0x0753('0x29')](handleError(_0x4b73aa,null));};exports[_0x0753('0x93')]=function(_0x1cc794,_0x5b1ed8,_0x331432){var _0x3f5ef9=_0x1cc794[_0x0753('0x63')]['channel'];return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x1cc794['params']['id']},'attributes':['id',_0x0753('0x3e'),'role',_0x0753('0x94'),'loginInPause','voicePause','interface']})[_0x0753('0x20')](handleEntityNotFound(_0x5b1ed8,null))[_0x0753('0x20')](function(_0x45ec26){if(_0x45ec26){if(!utils['isValidChannel'](_0x3f5ef9)){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x95'));}return _0x45ec26['add'+_[_0x0753('0x96')](_0x3f5ef9['toLowerCase']())+_0x0753('0x97')](_0x1cc794[_0x0753('0x63')][_0x0753('0x66')],{'penalty':_0x1cc794['body']['penalty']||0x0})[_0x0753('0x98')](function(_0x259f59){for(var _0x2582db=0x0;_0x2582db<_0x1cc794[_0x0753('0x63')][_0x0753('0x66')][_0x0753('0x50')];_0x2582db+=0x1){var _0x4f997f={'UserId':_0x1cc794[_0x0753('0x60')]['id']};_0x4f997f[_[_0x0753('0x96')](_0x3f5ef9[_0x0753('0x99')]())+_0x0753('0x9a')]=_0x1cc794['body'][_0x0753('0x66')][_0x2582db];socket['emit'](_0x0753('0x34')+_[_0x0753('0x96')](_0x3f5ef9[_0x0753('0x99')]())+'Queue:save',_0x4f997f);}return _0x259f59;})['then'](function(){if(_0x3f5ef9===_0x0753('0x9b')){return db[_0x0753('0x9c')][_0x0753('0x5e')]({'where':{'id':_0x1cc794[_0x0753('0x63')][_0x0753('0x66')]||[]},'raw':!![],'attributes':['id',_0x0753('0x3e')]});}})['then'](function(_0xa50efe){var _0xd6575d=_0x45ec26[_0x0753('0x32')]({'plain':!![]});var _0x1800a7=[];if(_0x3f5ef9===_0x0753('0x9b')&&_0xd6575d['role']===_0x0753('0x35')&&_0xd6575d[_0x0753('0x94')]){for(var _0xfb15c1=0x0;_0xfb15c1<_0xa50efe[_0x0753('0x50')];_0xfb15c1+=0x1){_0x1800a7[_0x0753('0x9d')]({'membername':_0xd6575d[_0x0753('0x3e')],'UserId':_0xd6575d['id'],'queue_name':_0xa50efe[_0xfb15c1]['name'],'VoiceQueueId':_0xa50efe[_0xfb15c1]['id'],'interface':_['isNil'](_0xd6575d[_0x0753('0x9e')])?util[_0x0753('0x9f')](_0x0753('0xa0'),_0xd6575d[_0x0753('0x3e')]):_0xd6575d[_0x0753('0x9e')],'paused':_0xd6575d[_0x0753('0xa1')]||![],'penalty':_0x1cc794[_0x0753('0x63')][_0x0753('0xa2')]||0x0});}return BPromise[_0x0753('0xa3')](_0x1800a7,function(_0x5af10a){return db['UserVoiceQueueRt'][_0x0753('0xa4')](_0x5af10a);});}return _0x45ec26;});}})[_0x0753('0x20')](respondWithStatusCode(_0x5b1ed8,null))[_0x0753('0x29')](handleError(_0x5b1ed8,null));};exports['removeQueues']=function(_0x25341f,_0x514af9,_0x4077b3){var _0x2d706a;return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x25341f['params']['id']},'attributes':['id','name','role']})[_0x0753('0x20')](handleEntityNotFound(_0x514af9,null))['then'](function(_0x11c5cc){if(_0x11c5cc){_0x2d706a=_0x11c5cc;if(!_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')]||!utils[_0x0753('0xa6')](_0x25341f['query'][_0x0753('0xa5')])){throw new db[(_0x0753('0x1c'))]['ValidationError'](_0x0753('0x95'));}return _0x11c5cc[_0x0753('0xa7')+_[_0x0753('0x96')](_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')][_0x0753('0x99')]())+_0x0753('0x97')](_0x25341f[_0x0753('0x4c')][_0x0753('0x66')]);}})['then'](function(_0x5ee888){for(var _0x3c1975=0x0;_0x3c1975<_0x25341f[_0x0753('0x4c')]['ids'][_0x0753('0x50')];_0x3c1975+=0x1){var _0x4b92c5={'UserId':_0x25341f[_0x0753('0x60')]['id']};_0x4b92c5[_[_0x0753('0x96')](_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')][_0x0753('0x99')]())+'QueueId']=_0x25341f[_0x0753('0x4c')][_0x0753('0x66')][_0x3c1975];socket[_0x0753('0xa8')](_0x0753('0x34')+_['capitalize'](_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')][_0x0753('0x99')]())+_0x0753('0xa9'),_0x4b92c5);}return _0x5ee888;})[_0x0753('0x20')](function(){if(_0x25341f[_0x0753('0x4c')][_0x0753('0xa5')]===_0x0753('0x9b')){return db['UserVoiceQueueRt'][_0x0753('0x3f')]({'where':{'UserId':_0x25341f[_0x0753('0x60')]['id'],'VoiceQueueId':_0x25341f[_0x0753('0x4c')]['ids']},'individualHooks':!![]})[_0x0753('0x20')](function(){return _0x2d706a;});}return _0x2d706a;})[_0x0753('0x20')](respondWithStatusCode(_0x514af9,null))[_0x0753('0x29')](handleError(_0x514af9,null));};exports[_0x0753('0xaa')]=function(_0xd8cb23,_0x3e3d2d,_0x260fc8){_0xd8cb23['body'][_0x0753('0xab')]=_0xd8cb23[_0x0753('0xac')][_0x0753('0xad')];return db['User'][_0x0753('0x3c')]({'where':{'id':_0xd8cb23[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x3e3d2d,null))['then'](saveUpdates(_0xd8cb23['body'],null))[_0x0753('0x20')](respondWithResult(_0x3e3d2d,null))[_0x0753('0x29')](handleError(_0x3e3d2d,null));};exports[_0x0753('0xae')]=function(_0x30abd3,_0x24dda9,_0x4d0b5e){var _0xc4f059=path[_0x0753('0xaf')](config[_0x0753('0xb0')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x30abd3[_0x0753('0x60')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x0753('0x20')](handleEntityNotFound(_0x24dda9,null))[_0x0753('0x20')](function(_0x7f8218){if(_0x7f8218){if(_[_0x0753('0x6f')](_0x7f8218[_0x0753('0xab')])){return _0x24dda9[_0x0753('0xb1')](_0xc4f059);}else{if(!fs[_0x0753('0xb2')](path[_0x0753('0xaf')](config['root'],_0x0753('0xb3'),_0x7f8218['userpic']))){return _0x24dda9[_0x0753('0xb1')](_0xc4f059);}return _0x24dda9['download'](path[_0x0753('0xaf')](config['root'],_0x0753('0xb3'),_0x7f8218[_0x0753('0xab')]));}}})['catch'](handleError(_0x24dda9,null));};exports[_0x0753('0xb4')]=function(_0x34b9ff,_0xce010a,_0x36b12f){var _0x23be06={};var _0x594721={};var _0x1b8900;var _0x240fb6;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x34b9ff[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0xce010a,null))[_0x0753('0x20')](function(_0x5efbff){if(_0x5efbff){_0x1b8900=_0x5efbff;_0x594721['model']=_[_0x0753('0x4b')](db['CmContact'][_0x0753('0x44')]);_0x594721['query']=_[_0x0753('0x4b')](_0x34b9ff[_0x0753('0x4c')]);_0x594721['filters']=_['intersection'](_0x594721['model'],_0x594721[_0x0753('0x4c')]);_0x23be06[_0x0753('0x4f')]=_['intersection'](_0x594721[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x34b9ff[_0x0753('0x4c')][_0x0753('0xb5')]));_0x23be06['attributes']=_0x23be06[_0x0753('0x4f')]['length']?_0x23be06['attributes']:_0x594721[_0x0753('0x47')];_0x23be06[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x34b9ff[_0x0753('0x4c')][_0x0753('0x53')]);_0x23be06['where']=qs['filters'](_[_0x0753('0x55')](_0x34b9ff[_0x0753('0x4c')],_0x594721[_0x0753('0x4d')]));if(_0x34b9ff['query'][_0x0753('0x38')]){_0x23be06[_0x0753('0x54')]=_[_0x0753('0x56')](_0x23be06[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x23be06[_0x0753('0x4f')],function(_0x1cedd9){var _0x3655c1={};_0x3655c1[_0x1cedd9]={'$like':'%'+_0x34b9ff[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x3655c1;})});}_0x23be06=_[_0x0753('0x56')]({},_0x23be06,_0x34b9ff[_0x0753('0x5a')]);return _0x1b8900['getContacts'](_0x23be06);}})[_0x0753('0x20')](function(_0x4f1b03){if(_0x4f1b03){_0x240fb6=_0x4f1b03[_0x0753('0x50')];if(_0x34b9ff[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x5c'))){_0x23be06[_0x0753('0x5d')]=[{'model':db[_0x0753('0xb7')],'as':_0x0753('0xb8'),'required':![]},{'model':db[_0x0753('0xb9')],'as':_0x0753('0xba'),'attributes':['id',_0x0753('0x3e'),_0x0753('0xbb')],'where':_0x34b9ff[_0x0753('0x4c')][_0x0753('0xbc')]?{'id':_0x34b9ff[_0x0753('0x4c')][_0x0753('0xbc')]}:undefined,'required':_0x34b9ff[_0x0753('0x4c')]['tag']?!![]:![]}];}if(!_0x34b9ff['query'][_0x0753('0x51')](_0x0753('0x52'))){_0x23be06[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x34b9ff[_0x0753('0x4c')]['limit']);_0x23be06[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x34b9ff[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x1b8900[_0x0753('0xb4')](_0x23be06);}})['then'](function(_0x3f973c){if(_0x3f973c){return _0x3f973c?{'count':_0x240fb6,'rows':_0x3f973c}:null;}})['then'](respondWithResult(_0xce010a,null))['catch'](handleError(_0xce010a,null));};exports[_0x0753('0xbd')]=function(_0x18185e,_0x568959,_0x382b6b){var _0x1a4ce3;var _0x6a2f40;var _0xa2263c={};var _0x2e4dd1;return db['User']['findOne']({'where':{'id':_0x18185e[_0x0753('0x60')]['id']},'attributes':['id','name',_0x0753('0x3d')]})[_0x0753('0x20')](handleEntityNotFound(_0x568959,null))[_0x0753('0x20')](function(_0x3299c9){if(!utils[_0x0753('0xa6')](_0x18185e[_0x0753('0x4c')][_0x0753('0xa5')])){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x95'));}_0x1a4ce3=_0x3299c9;var _0x5ea118={};_0x5ea118['model']=_[_0x0753('0x4b')](db[_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')][_0x0753('0xa5')])+_0x0753('0xbe')]['rawAttributes']);_0x5ea118['query']=_['keys'](_0x18185e[_0x0753('0x4c')]);_0x5ea118['filters']=_[_0x0753('0x4e')](_0x5ea118['model'],_0x5ea118[_0x0753('0x4c')]);_0xa2263c['attributes']=_[_0x0753('0x4e')](_0x5ea118[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x18185e[_0x0753('0x4c')][_0x0753('0xb5')]));_0xa2263c[_0x0753('0x4f')]=_0xa2263c['attributes']['length']?_0xa2263c['attributes']:_0x5ea118[_0x0753('0x47')];_0xa2263c['order']=qs[_0x0753('0x53')](_0x18185e['query']['sort']);_0xa2263c[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x18185e[_0x0753('0x4c')],_0x5ea118[_0x0753('0x4d')]));if(_0x18185e[_0x0753('0x4c')][_0x0753('0x38')]){_0xa2263c[_0x0753('0x54')]=_['merge'](_0xa2263c[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0xa2263c[_0x0753('0x4f')],function(_0x48bace){var _0x3747c1={};_0x3747c1[_0x48bace]={'$like':'%'+_0x18185e[_0x0753('0x4c')]['filter']+'%'};return _0x3747c1;})});}_0xa2263c=_[_0x0753('0x56')]({},_0xa2263c,_0x18185e['options']);switch(_0x1a4ce3[_0x0753('0x3d')]){case _0x0753('0x68'):return db[_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')][_0x0753('0xa5')])+_0x0753('0xbe')][_0x0753('0x5e')](_0xa2263c);case _0x0753('0x34'):case _0x0753('0x35'):return _0x1a4ce3['get'+_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')]['channel'])+_0x0753('0x97')](_0xa2263c);default:throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0xbf'));}})[_0x0753('0x20')](function(_0xb59a6c){_0x2e4dd1=_0xb59a6c[_0x0753('0x50')];if(!_0x18185e[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0xa2263c[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x18185e['query'][_0x0753('0x2e')]);_0xa2263c[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x18185e[_0x0753('0x4c')]['offset']);}switch(_0x1a4ce3['role']){case _0x0753('0x68'):return db[_['capitalize'](_0x18185e['query'][_0x0753('0xa5')])+_0x0753('0xbe')]['findAll'](_0xa2263c);case _0x0753('0x34'):case _0x0753('0x35'):return _0x1a4ce3[_0x0753('0x32')+_[_0x0753('0x96')](_0x18185e[_0x0753('0x4c')]['channel'])+_0x0753('0x97')](_0xa2263c);}})[_0x0753('0x20')](function(_0x3d0b9a){return{'count':_0x2e4dd1,'rows':_0x3d0b9a};})[_0x0753('0x20')](respondWithResult(_0x568959,null))[_0x0753('0x29')](handleError(_0x568959,null));};exports[_0x0753('0xc0')]=function(_0x1628a4,_0x91a1d9,_0x44b24f){var _0x30ad0f={};var _0x453eff={};var _0x1d3896;var _0x793eb3;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x1628a4[_0x0753('0x60')]['id']}})['then'](handleEntityNotFound(_0x91a1d9,null))[_0x0753('0x20')](function(_0x30ddf6){if(_0x30ddf6){_0x1d3896=_0x30ddf6;_0x453eff['model']=_[_0x0753('0x4b')](db[_0x0753('0xc1')][_0x0753('0x44')]);_0x453eff['query']=_['keys'](_0x1628a4[_0x0753('0x4c')]);_0x453eff[_0x0753('0x4d')]=_['intersection'](_0x453eff['model'],_0x453eff[_0x0753('0x4c')]);_0x30ad0f[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x453eff['model'],qs['fields'](_0x1628a4[_0x0753('0x4c')][_0x0753('0xb5')]));_0x30ad0f['attributes']=_0x30ad0f[_0x0753('0x4f')][_0x0753('0x50')]?_0x30ad0f[_0x0753('0x4f')]:_0x453eff['model'];_0x30ad0f[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x1628a4[_0x0753('0x4c')][_0x0753('0x53')]);_0x30ad0f[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x1628a4[_0x0753('0x4c')],_0x453eff[_0x0753('0x4d')]));if(_0x1628a4[_0x0753('0x4c')][_0x0753('0x38')]){_0x30ad0f['where']=_['merge'](_0x30ad0f[_0x0753('0x54')],{'$or':_['map'](_0x30ad0f[_0x0753('0x4f')],function(_0x43291b){var _0x4eaee2={};_0x4eaee2[_0x43291b]={'$like':'%'+_0x1628a4['query']['filter']+'%'};return _0x4eaee2;})});}_0x30ad0f=_[_0x0753('0x56')]({},_0x30ad0f,_0x1628a4[_0x0753('0x5a')]);return _0x1d3896[_0x0753('0xc0')](_0x30ad0f);}})['then'](function(_0x42ddf2){if(_0x42ddf2){_0x793eb3=_0x42ddf2['length'];if(!_0x1628a4[_0x0753('0x4c')]['hasOwnProperty']('nolimit')){_0x30ad0f[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x1628a4[_0x0753('0x4c')][_0x0753('0x2e')]);_0x30ad0f[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x1628a4['query'][_0x0753('0x2d')]);}return _0x1d3896[_0x0753('0xc0')](_0x30ad0f);}})[_0x0753('0x20')](function(_0x242940){if(_0x242940){return _0x242940?{'count':_0x793eb3,'rows':_0x242940}:null;}})['then'](respondWithResult(_0x91a1d9,null))[_0x0753('0x29')](handleError(_0x91a1d9,null));};exports[_0x0753('0xc2')]=function(_0x1c9a17,_0x5587b5,_0x89c107){var _0x621401={};var _0x42ae51={};var _0x59d0d7;var _0x2f4210;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x1c9a17['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x5587b5,null))[_0x0753('0x20')](function(_0x338d0d){if(_0x338d0d){_0x59d0d7=_0x338d0d;_0x42ae51[_0x0753('0x47')]=_[_0x0753('0x4b')](db[_0x0753('0xc3')]['rawAttributes']);_0x42ae51[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x1c9a17[_0x0753('0x4c')]);_0x42ae51[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x42ae51['model'],_0x42ae51[_0x0753('0x4c')]);_0x621401[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x42ae51[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x1c9a17[_0x0753('0x4c')][_0x0753('0xb5')]));_0x621401[_0x0753('0x4f')]=_0x621401[_0x0753('0x4f')][_0x0753('0x50')]?_0x621401[_0x0753('0x4f')]:_0x42ae51[_0x0753('0x47')];_0x621401[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x1c9a17[_0x0753('0x4c')][_0x0753('0x53')]);_0x621401[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x1c9a17[_0x0753('0x4c')],_0x42ae51['filters']));if(_0x1c9a17[_0x0753('0x4c')]['filter']){_0x621401[_0x0753('0x54')]=_[_0x0753('0x56')](_0x621401['where'],{'$or':_['map'](_0x621401['attributes'],function(_0x119d80){var _0x30536e={};_0x30536e[_0x119d80]={'$like':'%'+_0x1c9a17[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x30536e;})});}_0x621401=_['merge']({},_0x621401,_0x1c9a17[_0x0753('0x5a')]);return _0x59d0d7[_0x0753('0xc2')](_0x621401);}})[_0x0753('0x20')](function(_0x3754b2){if(_0x3754b2){_0x2f4210=_0x3754b2[_0x0753('0x50')];if(!_0x1c9a17[_0x0753('0x4c')]['hasOwnProperty'](_0x0753('0x52'))){_0x621401['limit']=qs[_0x0753('0x2e')](_0x1c9a17['query']['limit']);_0x621401[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x1c9a17[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x59d0d7['getGroups'](_0x621401);}})[_0x0753('0x20')](function(_0x5073a1){if(_0x5073a1){return _0x5073a1?{'count':_0x2f4210,'rows':_0x5073a1}:null;}})['then'](respondWithResult(_0x5587b5,null))[_0x0753('0x29')](handleError(_0x5587b5,null));};exports['getRecordings']=function(_0x139511,_0x2d6411,_0x1b7939){var _0x2c05d3={'raw':!![],'where':{}};var _0x29b772={};var _0x5db6a8={'count':0x0,'rows':[]};return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x139511[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2d6411,null))[_0x0753('0x20')](function(_0x15bc4c){if(_0x15bc4c){_0x29b772[_0x0753('0x47')]=_[_0x0753('0x4b')](db['VoiceRecording'][_0x0753('0x44')]);_0x29b772['query']=_[_0x0753('0x4b')](_0x139511[_0x0753('0x4c')]);_0x29b772[_0x0753('0x4d')]=_['intersection'](_0x29b772[_0x0753('0x47')],_0x29b772[_0x0753('0x4c')]);_0x2c05d3['attributes']=_['intersection'](_0x29b772['model'],qs[_0x0753('0xb5')](_0x139511[_0x0753('0x4c')][_0x0753('0xb5')]));_0x2c05d3['attributes']=_0x2c05d3[_0x0753('0x4f')]['length']?_0x2c05d3[_0x0753('0x4f')]:_0x29b772['model'];if(!_0x139511['query'][_0x0753('0x51')](_0x0753('0x52'))){_0x2c05d3[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x139511[_0x0753('0x4c')][_0x0753('0x2e')]);_0x2c05d3[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x139511['query'][_0x0753('0x2d')]);}_0x2c05d3['order']=qs[_0x0753('0x53')](_0x139511[_0x0753('0x4c')][_0x0753('0x53')]);_0x2c05d3['where']=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x139511[_0x0753('0x4c')],_0x29b772[_0x0753('0x4d')]));_0x2c05d3[_0x0753('0x54')]['UserId']=_0x15bc4c['id'];if(_0x139511[_0x0753('0x4c')][_0x0753('0x38')]){_0x2c05d3[_0x0753('0x54')]=_[_0x0753('0x56')](_0x2c05d3[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2c05d3[_0x0753('0x4f')],function(_0xadb867){var _0x2d17ab={};_0x2d17ab[_0xadb867]={'$like':'%'+_0x139511[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x2d17ab;})});}_0x2c05d3=_[_0x0753('0x56')]({},_0x2c05d3,_0x139511[_0x0753('0x5a')]);return db['VoiceRecording']['count']({'where':_0x2c05d3[_0x0753('0x54')]})[_0x0753('0x20')](function(_0x21ad0d){_0x5db6a8[_0x0753('0x2c')]=_0x21ad0d;if(_0x139511[_0x0753('0x4c')][_0x0753('0x5c')]){_0x2c05d3[_0x0753('0x5d')]=[{'all':!![]}];}return db[_0x0753('0xc4')]['findAll'](_0x2c05d3);})[_0x0753('0x20')](function(_0x302367){_0x5db6a8[_0x0753('0x5f')]=_0x302367;return _0x5db6a8;});}})['then'](respondWithFilteredResult(_0x2d6411,_0x2c05d3))[_0x0753('0x29')](handleError(_0x2d6411,null));};exports['getScreenRecordings']=function(_0x5d4832,_0x4ac3ad,_0x4aea12){var _0x127990={'raw':!![],'where':{}};var _0xc43e9d={};var _0x2cb70d={'count':0x0,'rows':[]};return db['User'][_0x0753('0x8b')]({'where':{'id':_0x5d4832[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x4ac3ad,null))['then'](function(_0x4ac757){if(_0x4ac757){_0xc43e9d['model']=_[_0x0753('0x4b')](db['ScreenRecording'][_0x0753('0x44')]);_0xc43e9d[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x5d4832[_0x0753('0x4c')]);_0xc43e9d[_0x0753('0x4d')]=_['intersection'](_0xc43e9d[_0x0753('0x47')],_0xc43e9d[_0x0753('0x4c')]);_0x127990['attributes']=_[_0x0753('0x4e')](_0xc43e9d[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x5d4832[_0x0753('0x4c')][_0x0753('0xb5')]));_0x127990[_0x0753('0x4f')]=_0x127990[_0x0753('0x4f')]['length']?_0x127990[_0x0753('0x4f')]:_0xc43e9d[_0x0753('0x47')];if(!_0x5d4832[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x127990['limit']=qs[_0x0753('0x2e')](_0x5d4832['query'][_0x0753('0x2e')]);_0x127990[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x5d4832['query']['offset']);}_0x127990[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x5d4832[_0x0753('0x4c')][_0x0753('0x53')]);_0x127990[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x5d4832[_0x0753('0x4c')],_0xc43e9d[_0x0753('0x4d')]));_0x127990[_0x0753('0x54')][_0x0753('0xc5')]=_0x4ac757['id'];if(_0x5d4832['query'][_0x0753('0x38')]){_0x127990[_0x0753('0x54')]=_[_0x0753('0x56')](_0x127990[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x127990['attributes'],function(_0x2eba8b){var _0x4d56d8={};_0x4d56d8[_0x2eba8b]={'$like':'%'+_0x5d4832[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x4d56d8;})});}_0x127990=_[_0x0753('0x56')]({},_0x127990,_0x5d4832[_0x0753('0x5a')]);return db[_0x0753('0xc6')]['count']({'where':_0x127990['where']})[_0x0753('0x20')](function(_0x24f02a){_0x2cb70d['count']=_0x24f02a;if(_0x5d4832['query'][_0x0753('0x5c')]){_0x127990[_0x0753('0x5d')]=[{'all':!![]}];}return db[_0x0753('0xc6')][_0x0753('0x5e')](_0x127990);})['then'](function(_0x4d80f0){_0x2cb70d['rows']=_0x4d80f0;return _0x2cb70d;});}})[_0x0753('0x20')](respondWithFilteredResult(_0x4ac3ad,_0x127990))[_0x0753('0x29')](handleError(_0x4ac3ad,null));};exports[_0x0753('0xc7')]=function(_0x364b1a,_0x2488e8,_0x5c3a46){var _0x437c6b={};var _0x519758={};var _0x3a82fc;var _0x7e56c6;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x364b1a[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2488e8,null))['then'](function(_0x1b6e5e){if(_0x1b6e5e){_0x3a82fc=_0x1b6e5e;_0x519758[_0x0753('0x47')]=_['keys'](db[_0x0753('0xc8')][_0x0753('0x44')]);_0x519758[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x364b1a[_0x0753('0x4c')]);_0x519758[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x519758[_0x0753('0x47')],_0x519758[_0x0753('0x4c')]);_0x437c6b[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x519758[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x364b1a['query'][_0x0753('0xb5')]));_0x437c6b[_0x0753('0x4f')]=_0x437c6b[_0x0753('0x4f')][_0x0753('0x50')]?_0x437c6b[_0x0753('0x4f')]:_0x519758[_0x0753('0x47')];_0x437c6b[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x364b1a[_0x0753('0x4c')]['sort']);_0x437c6b[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x364b1a['query'],_0x519758[_0x0753('0x4d')]));if(_0x364b1a[_0x0753('0x4c')][_0x0753('0x38')]){_0x437c6b[_0x0753('0x54')]=_[_0x0753('0x56')](_0x437c6b[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x437c6b[_0x0753('0x4f')],function(_0x938cc7){var _0x1491f1={};_0x1491f1[_0x938cc7]={'$like':'%'+_0x364b1a[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x1491f1;})});}_0x437c6b=_[_0x0753('0x56')]({},_0x437c6b,_0x364b1a['options']);return _0x3a82fc[_0x0753('0xc7')](_0x437c6b);}})[_0x0753('0x20')](function(_0x1619e9){if(_0x1619e9){_0x7e56c6=_0x1619e9[_0x0753('0x50')];if(!_0x364b1a['query'][_0x0753('0x51')]('nolimit')){_0x437c6b[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x364b1a[_0x0753('0x4c')][_0x0753('0x2e')]);_0x437c6b[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x364b1a['query'][_0x0753('0x2d')]);}return _0x3a82fc[_0x0753('0xc7')](_0x437c6b);}})[_0x0753('0x20')](function(_0x2e80ad){if(_0x2e80ad){return _0x2e80ad?{'count':_0x7e56c6,'rows':_0x2e80ad}:null;}})[_0x0753('0x20')](respondWithResult(_0x2488e8,null))['catch'](handleError(_0x2488e8,null));};exports[_0x0753('0xc9')]=function(_0x42434a,_0x302e42,_0x55c240){var _0x2bb47f={};var _0x218e84={};var _0x1b1acb;var _0x31a7eb;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x42434a[_0x0753('0x60')]['id']}})['then'](handleEntityNotFound(_0x302e42,null))[_0x0753('0x20')](function(_0x362c8e){if(_0x362c8e){_0x1b1acb=_0x362c8e;_0x218e84['model']=_[_0x0753('0x4b')](db[_0x0753('0xca')][_0x0753('0x44')]);_0x218e84['query']=_[_0x0753('0x4b')](_0x42434a[_0x0753('0x4c')]);_0x218e84['filters']=_[_0x0753('0x4e')](_0x218e84[_0x0753('0x47')],_0x218e84[_0x0753('0x4c')]);_0x2bb47f[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x218e84[_0x0753('0x47')],qs['fields'](_0x42434a['query'][_0x0753('0xb5')]));_0x2bb47f[_0x0753('0x4f')]=_0x2bb47f['attributes'][_0x0753('0x50')]?_0x2bb47f[_0x0753('0x4f')]:_0x218e84[_0x0753('0x47')];_0x2bb47f[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x42434a['query'][_0x0753('0x53')]);_0x2bb47f['where']=qs['filters'](_['pick'](_0x42434a[_0x0753('0x4c')],_0x218e84[_0x0753('0x4d')]));if(_0x42434a['query'][_0x0753('0x38')]){_0x2bb47f[_0x0753('0x54')]=_[_0x0753('0x56')](_0x2bb47f[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2bb47f[_0x0753('0x4f')],function(_0xb6b35a){var _0x417f45={};_0x417f45[_0xb6b35a]={'$like':'%'+_0x42434a[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x417f45;})});}_0x2bb47f=_['merge']({},_0x2bb47f,_0x42434a[_0x0753('0x5a')]);return _0x1b1acb[_0x0753('0xc9')](_0x2bb47f);}})['then'](function(_0x1e7246){if(_0x1e7246){_0x31a7eb=_0x1e7246['length'];if(!_0x42434a[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x2bb47f[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x42434a['query']['limit']);_0x2bb47f['offset']=qs[_0x0753('0x2d')](_0x42434a[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x1b1acb[_0x0753('0xc9')](_0x2bb47f);}})['then'](function(_0x14089f){if(_0x14089f){return _0x14089f?{'count':_0x31a7eb,'rows':_0x14089f}:null;}})[_0x0753('0x20')](respondWithResult(_0x302e42,null))[_0x0753('0x29')](handleError(_0x302e42,null));};exports['getMailInteractions']=function(_0x16f7ae,_0xdbaeea,_0x21e432){var _0x5c4bb7={'raw':!![],'where':{}};var _0x517d58={};var _0x33db34={'count':0x0,'rows':[]};return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x16f7ae[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0xdbaeea,null))[_0x0753('0x20')](function(_0x1c5e81){if(_0x1c5e81){_0x517d58['model']=_['keys'](db[_0x0753('0xcb')][_0x0753('0x44')]);_0x517d58[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x16f7ae['query']);_0x517d58[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x517d58['model'],_0x517d58[_0x0753('0x4c')]);_0x5c4bb7[_0x0753('0x4f')]=_['intersection'](_0x517d58[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x16f7ae[_0x0753('0x4c')][_0x0753('0xb5')]));_0x5c4bb7['attributes']=_0x5c4bb7[_0x0753('0x4f')][_0x0753('0x50')]?_0x5c4bb7[_0x0753('0x4f')]:_0x517d58[_0x0753('0x47')];if(!_0x16f7ae[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x5c4bb7['limit']=qs[_0x0753('0x2e')](_0x16f7ae[_0x0753('0x4c')][_0x0753('0x2e')]);_0x5c4bb7[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x16f7ae[_0x0753('0x4c')]['offset']);}_0x5c4bb7[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x16f7ae[_0x0753('0x4c')][_0x0753('0x53')]);_0x5c4bb7['where']=qs[_0x0753('0x4d')](_['pick'](_0x16f7ae[_0x0753('0x4c')],_0x517d58[_0x0753('0x4d')]));_0x5c4bb7[_0x0753('0x54')][_0x0753('0xc5')]=_0x1c5e81['id'];if(_0x16f7ae[_0x0753('0x4c')][_0x0753('0x38')]){_0x5c4bb7['where']=_[_0x0753('0x56')](_0x5c4bb7[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x5c4bb7['attributes'],function(_0x1773c4){var _0x1415ad={};_0x1415ad[_0x1773c4]={'$like':'%'+_0x16f7ae[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x1415ad;})});}_0x5c4bb7=_['merge']({},_0x5c4bb7,_0x16f7ae[_0x0753('0x5a')]);return db['MailInteraction'][_0x0753('0x2c')]({'where':_0x5c4bb7[_0x0753('0x54')]})[_0x0753('0x20')](function(_0x320a93){_0x33db34[_0x0753('0x2c')]=_0x320a93;if(_0x16f7ae['query']['includeAll']){_0x5c4bb7[_0x0753('0x5d')]=[{'all':!![]}];}return db[_0x0753('0xcb')][_0x0753('0x5e')](_0x5c4bb7);})[_0x0753('0x20')](function(_0x12db45){_0x33db34['rows']=_0x12db45;return _0x33db34;});}})[_0x0753('0x20')](respondWithFilteredResult(_0xdbaeea,_0x5c4bb7))[_0x0753('0x29')](handleError(_0xdbaeea,null));};exports[_0x0753('0xcc')]=function(_0x4e8093,_0x3d56bd,_0x1c20af){var _0x2480a7={};var _0x496214={};var _0x4f7cc4;var _0x498bf2;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x4e8093[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x3d56bd,null))[_0x0753('0x20')](function(_0x180c44){if(_0x180c44){_0x4f7cc4=_0x180c44;_0x496214[_0x0753('0x47')]=_[_0x0753('0x4b')](db[_0x0753('0xcd')][_0x0753('0x44')]);_0x496214[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x4e8093[_0x0753('0x4c')]);_0x496214[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x496214[_0x0753('0x47')],_0x496214['query']);_0x2480a7[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x496214[_0x0753('0x47')],qs['fields'](_0x4e8093['query'][_0x0753('0xb5')]));_0x2480a7[_0x0753('0x4f')]=_0x2480a7[_0x0753('0x4f')][_0x0753('0x50')]?_0x2480a7['attributes']:_0x496214[_0x0753('0x47')];_0x2480a7[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x4e8093['query']['sort']);_0x2480a7[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x4e8093['query'],_0x496214[_0x0753('0x4d')]));if(_0x4e8093['query'][_0x0753('0x38')]){_0x2480a7[_0x0753('0x54')]=_['merge'](_0x2480a7[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2480a7[_0x0753('0x4f')],function(_0x5b7d07){var _0x3b80a6={};_0x3b80a6[_0x5b7d07]={'$like':'%'+_0x4e8093[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x3b80a6;})});}_0x2480a7=_[_0x0753('0x56')]({},_0x2480a7,_0x4e8093[_0x0753('0x5a')]);return _0x4f7cc4['getSmsInteractions'](_0x2480a7);}})['then'](function(_0x1dd7cb){if(_0x1dd7cb){_0x498bf2=_0x1dd7cb[_0x0753('0x50')];if(!_0x4e8093[_0x0753('0x4c')]['hasOwnProperty'](_0x0753('0x52'))){_0x2480a7[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x4e8093[_0x0753('0x4c')][_0x0753('0x2e')]);_0x2480a7[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x4e8093[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x4f7cc4[_0x0753('0xcc')](_0x2480a7);}})['then'](function(_0x37b97b){if(_0x37b97b){return _0x37b97b?{'count':_0x498bf2,'rows':_0x37b97b}:null;}})[_0x0753('0x20')](respondWithResult(_0x3d56bd,null))[_0x0753('0x29')](handleError(_0x3d56bd,null));};exports['getFaxInteractions']=function(_0x4f4027,_0x513bf9,_0x3b3eff){var _0x2a48f2={};var _0xe1776b={};var _0x2b2585;var _0x56bbfe;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x4f4027['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x513bf9,null))[_0x0753('0x20')](function(_0x47df79){if(_0x47df79){_0x2b2585=_0x47df79;_0xe1776b[_0x0753('0x47')]=_[_0x0753('0x4b')](db['FaxInteraction']['rawAttributes']);_0xe1776b[_0x0753('0x4c')]=_[_0x0753('0x4b')](_0x4f4027[_0x0753('0x4c')]);_0xe1776b['filters']=_[_0x0753('0x4e')](_0xe1776b[_0x0753('0x47')],_0xe1776b[_0x0753('0x4c')]);_0x2a48f2[_0x0753('0x4f')]=_['intersection'](_0xe1776b[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x4f4027[_0x0753('0x4c')][_0x0753('0xb5')]));_0x2a48f2[_0x0753('0x4f')]=_0x2a48f2[_0x0753('0x4f')][_0x0753('0x50')]?_0x2a48f2['attributes']:_0xe1776b[_0x0753('0x47')];_0x2a48f2[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x4f4027[_0x0753('0x4c')][_0x0753('0x53')]);_0x2a48f2[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x4f4027[_0x0753('0x4c')],_0xe1776b[_0x0753('0x4d')]));if(_0x4f4027[_0x0753('0x4c')][_0x0753('0x38')]){_0x2a48f2['where']=_[_0x0753('0x56')](_0x2a48f2['where'],{'$or':_[_0x0753('0x48')](_0x2a48f2[_0x0753('0x4f')],function(_0x2b4af2){var _0x20ac81={};_0x20ac81[_0x2b4af2]={'$like':'%'+_0x4f4027[_0x0753('0x4c')]['filter']+'%'};return _0x20ac81;})});}_0x2a48f2=_[_0x0753('0x56')]({},_0x2a48f2,_0x4f4027[_0x0753('0x5a')]);return _0x2b2585[_0x0753('0xce')](_0x2a48f2);}})[_0x0753('0x20')](function(_0x345954){if(_0x345954){_0x56bbfe=_0x345954[_0x0753('0x50')];if(!_0x4f4027[_0x0753('0x4c')]['hasOwnProperty'](_0x0753('0x52'))){_0x2a48f2[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x4f4027[_0x0753('0x4c')][_0x0753('0x2e')]);_0x2a48f2['offset']=qs[_0x0753('0x2d')](_0x4f4027[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x2b2585[_0x0753('0xce')](_0x2a48f2);}})[_0x0753('0x20')](function(_0x4d0569){if(_0x4d0569){return _0x4d0569?{'count':_0x56bbfe,'rows':_0x4d0569}:null;}})[_0x0753('0x20')](respondWithResult(_0x513bf9,null))[_0x0753('0x29')](handleError(_0x513bf9,null));};exports['getWhatsappInteractions']=function(_0x244732,_0x3bbb5f,_0x31ad78){var _0x432a30={};var _0x451de5={};var _0x176c07;var _0x3d6561;return db['User']['findOne']({'where':{'id':_0x244732[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x3bbb5f,null))[_0x0753('0x20')](function(_0x24794c){if(_0x24794c){_0x176c07=_0x24794c;_0x451de5[_0x0753('0x47')]=_['keys'](db[_0x0753('0xcf')][_0x0753('0x44')]);_0x451de5[_0x0753('0x4c')]=_['keys'](_0x244732['query']);_0x451de5[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x451de5[_0x0753('0x47')],_0x451de5[_0x0753('0x4c')]);_0x432a30[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x451de5['model'],qs[_0x0753('0xb5')](_0x244732[_0x0753('0x4c')]['fields']));_0x432a30[_0x0753('0x4f')]=_0x432a30[_0x0753('0x4f')][_0x0753('0x50')]?_0x432a30['attributes']:_0x451de5[_0x0753('0x47')];_0x432a30[_0x0753('0xb6')]=qs['sort'](_0x244732['query'][_0x0753('0x53')]);_0x432a30['where']=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x244732[_0x0753('0x4c')],_0x451de5[_0x0753('0x4d')]));if(_0x244732[_0x0753('0x4c')][_0x0753('0x38')]){_0x432a30[_0x0753('0x54')]=_[_0x0753('0x56')](_0x432a30[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x432a30[_0x0753('0x4f')],function(_0x1e4371){var _0x505d4c={};_0x505d4c[_0x1e4371]={'$like':'%'+_0x244732['query']['filter']+'%'};return _0x505d4c;})});}_0x432a30=_['merge']({},_0x432a30,_0x244732['options']);return _0x176c07[_0x0753('0xd0')](_0x432a30);}})[_0x0753('0x20')](function(_0x410f49){if(_0x410f49){_0x3d6561=_0x410f49[_0x0753('0x50')];if(!_0x244732[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x432a30[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x244732[_0x0753('0x4c')][_0x0753('0x2e')]);_0x432a30[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x244732[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x176c07[_0x0753('0xd0')](_0x432a30);}})['then'](function(_0x49725b){if(_0x49725b){return _0x49725b?{'count':_0x3d6561,'rows':_0x49725b}:null;}})['then'](respondWithResult(_0x3bbb5f,null))['catch'](handleError(_0x3bbb5f,null));};exports['login']=function(_0x43107b,_0x2294f2,_0x4bb095){var _0x27b133;var _0x289fe3;var _0x2296ad;var _0x570661=!_[_0x0753('0x6f')](_0x43107b[_0x0753('0x60')]['id'])?_0x43107b['params']['id']:!_[_0x0753('0x6f')](_0x43107b[_0x0753('0x34')]['id'])?_0x43107b['user']['id']:null;return db['User'][_0x0753('0x3c')]({'where':{'id':_0x570661,'role':{'$or':['admin',_0x0753('0x34'),_0x0753('0x35')]}},'attributes':['id',_0x0753('0x3e'),'phone',_0x0753('0xd1'),_0x0753('0x3d'),'internal',_0x0753('0xd2')]})[_0x0753('0x20')](function(_0x8d357b){if(_0x8d357b){if(_0x8d357b['role']===_0x0753('0x35')){_0x27b133=_0x8d357b;if(_0x43107b[_0x0753('0x63')][_0x0753('0x9e')]){_0x2296ad=util['format'](_0x0753('0xd3'),_0x27b133[_0x43107b['body'][_0x0753('0x9e')]]);}else if(_0x43107b[_0x0753('0x63')]['intrf']){_0x2296ad=util['format'](_0x0753('0xa0'),_0x43107b[_0x0753('0x63')][_0x0753('0xd4')]);}else{_0x2296ad=util[_0x0753('0x9f')]('SIP/%s',_0x27b133['name']);}socket['to'](util[_0x0753('0x9f')](_0x0753('0xd5'),_0x27b133[_0x0753('0x3e')]))[_0x0753('0xa8')]('user:forcelogout',{'ip':_0x43107b[_0x0753('0xd6')][_0x0753('0xd7')]||_0x43107b[_0x0753('0xd8')][_0x0753('0xd9')]||_0x43107b['socket'][_0x0753('0xd9')]||_0x43107b[_0x0753('0xd8')][_0x0753('0xda')]['remoteAddress']});return db[_0x0753('0xc1')][_0x0753('0x3f')]({'where':{'membername':_0x27b133['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x0753('0x1d'))](_0x0753('0xdb'));}})[_0x0753('0x20')](function(){if(_0x27b133){return _0x27b133[_0x0753('0xdc')]({'raw':!![]});}})[_0x0753('0x20')](function(_0x89d4a3){if(_0x27b133){var _0x369e29=[];if(_0x89d4a3){_0x289fe3=_0x89d4a3;if(_0x289fe3['length']){for(var _0x181e5c=0x0;_0x181e5c<_0x289fe3[_0x0753('0x50')];_0x181e5c++){_0x369e29[_0x0753('0x9d')]({'membername':_0x27b133['name'],'UserId':_0x27b133['id'],'queue_name':_0x289fe3[_0x181e5c]['name'],'VoiceQueueId':_0x289fe3[_0x181e5c]['id'],'interface':_0x2296ad,'paused':_0x27b133[_0x0753('0xd2')]||![],'penalty':_0x289fe3[_0x181e5c][_0x0753('0xdd')]||0x0});}return BPromise[_0x0753('0xa3')](_0x369e29,function(_0x5a85b5){return db['UserVoiceQueueRt'][_0x0753('0xa4')](_0x5a85b5);});}}}})[_0x0753('0x20')](function(){if(_0x27b133){return db[_0x0753('0xde')][_0x0753('0x5e')]({'where':{'membername':_0x27b133[_0x0753('0x3e')],'exitAt':null}});}})[_0x0753('0x20')](function(_0x108c9e){if(_0x27b133){var _0x232bba=[];_0x108c9e[_0x0753('0xdf')](function(_0x50b1bf){_0x232bba[_0x0753('0x9d')](_0x50b1bf[_0x0753('0x31')]({'exitAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))}));});return BPromise[_0x0753('0xe1')](_0x232bba);}})[_0x0753('0x20')](function(){if(_0x27b133){var _0x5e3115=[];var _0x5151cc=[];var _0x2cd092=utils[_0x0753('0xe2')]();var _0x4bed59={'membername':_0x27b133['name'],'interface':_0x2296ad,'enterAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'role':_0x27b133[_0x0753('0x3d')],'internal':_0x27b133[_0x0753('0x70')]};_0x2cd092['forEach'](function(_0x4094c9){_0x5e3115[_0x0753('0x9d')](_[_0x0753('0x56')]({'channel':_0x4094c9,'type':'LOGIN','data1':_0x43107b[_0x0753('0x63')][_0x0753('0xe3')],'data2':_0x2296ad},_0x4bed59));if(_0x27b133[_0x0753('0xd2')]){_0x5151cc[_0x0753('0x9d')](_['merge']({'channel':_0x4094c9,'type':_0x0753('0xe4'),'data1':'LOGININPAUSE'},_0x4bed59));}});return db[_0x0753('0xde')][_0x0753('0x62')](_0x5e3115[_0x0753('0xe5')](_0x5151cc),{'individualHooks':!![]});}})[_0x0753('0x20')](function(){if(_0x27b133){return _0x27b133[_0x0753('0x31')]({'online':!![],'lastLoginAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'voicePause':_0x27b133[_0x0753('0xd2')]||![],'mailPause':_0x27b133[_0x0753('0xd2')]||![],'chatPause':_0x27b133[_0x0753('0xd2')]||![],'faxPause':_0x27b133['loginInPause']||![],'smsPause':_0x27b133[_0x0753('0xd2')]||![],'openchannelPause':_0x27b133['loginInPause']||![],'whatsappPause':_0x27b133[_0x0753('0xd2')]||![],'pauseType':_0x27b133[_0x0753('0xd2')]?'LOGININPAUSE':null,'interface':_0x2296ad,'lastPauseAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))});}})[_0x0753('0x20')](function(_0x4ba045){if(_0x43107b['isMiddleware']){return _0x4bb095();}else{return BPromise[_0x0753('0xe6')](_0x4ba045)[_0x0753('0x20')](respondWithResult(_0x2294f2,null));}})[_0x0753('0x29')](handleError(_0x2294f2,null));};exports[_0x0753('0xe7')]=function(_0x5c55a8,_0x4c89c7,_0x22db39){var _0x2ae6e0;return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x5c55a8[_0x0753('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0x0753('0x3d')]})[_0x0753('0x20')](handleEntityNotFound(_0x4c89c7,null))[_0x0753('0x20')](function(_0x34ea0d){if(_0x34ea0d){_0x2ae6e0=_0x34ea0d;return db[_0x0753('0xc1')][_0x0753('0x3f')]({'where':{'membername':_0x2ae6e0[_0x0753('0x3e')]},'individualHooks':!![]});}})[_0x0753('0x20')](function(){return db[_0x0753('0xde')][_0x0753('0x5e')]({'where':{'membername':_0x2ae6e0[_0x0753('0x3e')],'exitAt':null}});})[_0x0753('0x20')](function(_0x4682e8){var _0xadafb2=[];_0x4682e8[_0x0753('0xdf')](function(_0x2c85d4){_0xadafb2[_0x0753('0x9d')](_0x2c85d4[_0x0753('0x31')]({'exitAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))}));});return BPromise['all'](_0xadafb2);})[_0x0753('0x20')](function(){return _0x2ae6e0['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0753('0x20')](respondWithResult(_0x4c89c7,null))[_0x0753('0x29')](handleError(_0x4c89c7,null));};exports[_0x0753('0xe8')]=function(_0x544365,_0x4db9fe,_0x59576e){var _0x43b45e;return db['UserVoiceQueueRt'][_0x0753('0x31')]({'paused':0x1},{'where':{'UserId':_0x544365[_0x0753('0x60')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x544365[_0x0753('0x60')]['id'],'role':_0x0753('0x35')},'attributes':['id',_0x0753('0x3e'),_0x0753('0x3d'),'internal',_0x0753('0x9e')]});})['then'](handleEntityNotFound(_0x4db9fe,null))['then'](function(_0x26991f){if(_0x26991f){_0x43b45e=_0x26991f;return respondWithRpcPromise(_0x0753('0xe9'),_0x0753('0xe8'),{'id':_0x43b45e['id'],'name':_0x43b45e[_0x0753('0x3e')],'pause':!![]});}})[_0x0753('0x20')](function(){if(_0x43b45e){return db['MemberReport'][_0x0753('0x5e')]({'where':{'membername':_0x43b45e[_0x0753('0x3e')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x494112){if(_0x494112[_0x0753('0x50')]){var _0x507410=moment()[_0x0753('0x9f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x561714=0x0,_0x27286b=_0x494112[_0x0753('0x50')];_0x561714<_0x27286b;_0x561714++){_0x494112[_0x561714][_0x0753('0xea')]({'exitAt':_0x507410});}}})[_0x0753('0x20')](function(){var _0x34d50b=[];var _0x35dd84=utils[_0x0753('0xe2')]();_0x35dd84[_0x0753('0xdf')](function(_0x31a118){_0x34d50b['push']({'channel':_0x31a118,'membername':_0x43b45e[_0x0753('0x3e')],'interface':_[_0x0753('0x6f')](_0x43b45e[_0x0753('0x9e')])?util['format'](_0x0753('0xa0'),_0x43b45e[_0x0753('0x3e')]):_0x43b45e['interface'],'type':_0x0753('0xe4'),'enterAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'data1':_0x544365[_0x0753('0x63')][_0x0753('0x45')]||_0x0753('0xeb'),'role':_0x43b45e['role'],'internal':_0x43b45e[_0x0753('0x70')]});});return db[_0x0753('0xde')]['bulkCreate'](_0x34d50b,{'individualHooks':!![]});})[_0x0753('0x20')](function(){return _0x43b45e[_0x0753('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x544365[_0x0753('0x63')][_0x0753('0x45')]||_0x0753('0xeb'),'lastPauseAt':moment()[_0x0753('0x9f')](_0x0753('0xe0'))});})[_0x0753('0x20')](respondWithResult(_0x4db9fe,null))[_0x0753('0x29')](handleError(_0x4db9fe,null));};exports['unpause']=function(_0x306c94,_0x226ea2,_0x16ccf1){var _0x54fe44;return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x306c94[_0x0753('0x60')]['id']},'attributes':['id',_0x0753('0x3e'),_0x0753('0x3d'),_0x0753('0xa1'),_0x0753('0xec'),_0x0753('0xed'),_0x0753('0xee'),_0x0753('0xef'),'smsPause',_0x0753('0xf0'),_0x0753('0xf1'),_0x0753('0xf2')]})[_0x0753('0x20')](handleEntityNotFound(_0x226ea2,null))[_0x0753('0x20')](function(_0x34fe2b){if(_0x34fe2b){_0x54fe44=_0x34fe2b;if(_0x306c94[_0x0753('0x63')][_0x0753('0xa5')]&&!utils[_0x0753('0xa6')](_0x306c94[_0x0753('0x63')]['channel'])){throw new db[(_0x0753('0x1c'))][(_0x0753('0x1d'))](_0x0753('0x95'));}switch(_0x306c94[_0x0753('0x63')][_0x0753('0xa5')]){case _0x0753('0x9b'):return respondWithRpcPromise(_0x0753('0xe9'),_0x0753('0xf3'),{'id':_0x54fe44['id'],'name':_0x54fe44[_0x0753('0x3e')],'pause':![]})[_0x0753('0x20')](function(){return db[_0x0753('0xc1')]['update']({'paused':0x0},{'where':{'UserId':_0x54fe44['id']},'individualHooks':!![]});})[_0x0753('0x20')](function(){return db['MemberReport'][_0x0753('0x3c')]({'where':{'channel':_0x306c94[_0x0753('0x63')][_0x0753('0xa5')],'membername':_0x54fe44['name'],'type':'PAUSE','exitAt':null}});})[_0x0753('0x20')](function(_0x4980d4){if(_0x4980d4){return _0x4980d4[_0x0753('0x31')]({'exitAt':moment()['format'](_0x0753('0xe0')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x54fe44[_0x0753('0x31')]({'voicePause':![]});});case _0x0753('0xf4'):case _0x0753('0xf5'):case _0x0753('0xf6'):case _0x0753('0xf7'):case _0x0753('0xf8'):case _0x0753('0xf9'):return db[_0x0753('0xde')][_0x0753('0x3c')]({'where':{'channel':_0x306c94[_0x0753('0x63')][_0x0753('0xa5')],'membername':_0x54fe44[_0x0753('0x3e')],'type':_0x0753('0xe4'),'exitAt':null}})[_0x0753('0x20')](function(_0x797a16){if(_0x797a16){return _0x797a16[_0x0753('0x31')]({'exitAt':moment()[_0x0753('0x9f')](_0x0753('0xe0')),'data2':_0x0753('0xfa')},{'individualHooks':!![]});}return null;})[_0x0753('0x20')](function(){var _0x591b30={};_[_0x0753('0xfb')](_0x591b30,util[_0x0753('0x9f')]('%s%s',_0x306c94[_0x0753('0x63')][_0x0753('0xa5')],_0x0753('0xfc')),![]);return _0x54fe44['update'](_0x591b30);});default:return respondWithRpcPromise(_0x0753('0xe9'),_0x0753('0xf3'),{'id':_0x54fe44['id'],'name':_0x54fe44[_0x0753('0x3e')],'pause':![]})[_0x0753('0x20')](function(){return db[_0x0753('0xc1')][_0x0753('0x31')]({'paused':0x0},{'where':{'UserId':_0x54fe44['id']}});})[_0x0753('0x20')](function(){return db[_0x0753('0xde')]['findAll']({'where':{'membername':_0x54fe44[_0x0753('0x3e')],'type':_0x0753('0xe4'),'exitAt':null}});})[_0x0753('0x20')](function(_0x4e9fb6){var _0x20d1c5=[];_0x4e9fb6[_0x0753('0xdf')](function(_0x1179b1){_0x20d1c5[_0x0753('0x9d')](_0x1179b1['update']({'exitAt':moment()['format'](_0x0753('0xe0')),'data2':'manual'}));});return BPromise[_0x0753('0xe1')](_0x20d1c5);})[_0x0753('0x20')](function(){return _0x54fe44[_0x0753('0x31')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0753('0x20')](respondWithResult(_0x226ea2,null))[_0x0753('0x29')](handleError(_0x226ea2,null));};exports[_0x0753('0xfd')]=function(_0x280133,_0xe13ec4,_0x53e66f){var _0x3ec0f={};var _0x5f5db6={};var _0x4e5272;var _0x699eb;return db['User'][_0x0753('0x8b')]({'where':{'id':_0x280133['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0xe13ec4,null))[_0x0753('0x20')](function(_0x3b1050){if(_0x3b1050){_0x4e5272=_0x3b1050;_0x5f5db6[_0x0753('0x47')]=_['keys'](db['Team'][_0x0753('0x44')]);_0x5f5db6['query']=_[_0x0753('0x4b')](_0x280133[_0x0753('0x4c')]);_0x5f5db6['filters']=_[_0x0753('0x4e')](_0x5f5db6[_0x0753('0x47')],_0x5f5db6[_0x0753('0x4c')]);_0x3ec0f[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x5f5db6[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x280133['query']['fields']));_0x3ec0f[_0x0753('0x4f')]=_0x3ec0f[_0x0753('0x4f')][_0x0753('0x50')]?_0x3ec0f['attributes']:_0x5f5db6[_0x0753('0x47')];_0x3ec0f[_0x0753('0xb6')]=qs[_0x0753('0x53')](_0x280133[_0x0753('0x4c')][_0x0753('0x53')]);_0x3ec0f[_0x0753('0x54')]=qs[_0x0753('0x4d')](_[_0x0753('0x55')](_0x280133['query'],_0x5f5db6[_0x0753('0x4d')]));if(_0x280133[_0x0753('0x4c')][_0x0753('0x38')]){_0x3ec0f['where']=_[_0x0753('0x56')](_0x3ec0f[_0x0753('0x54')],{'$or':_['map'](_0x3ec0f[_0x0753('0x4f')],function(_0x2bbf7a){var _0x3349b0={};_0x3349b0[_0x2bbf7a]={'$like':'%'+_0x280133[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x3349b0;})});}_0x3ec0f=_[_0x0753('0x56')]({},_0x3ec0f,_0x280133[_0x0753('0x5a')]);return _0x4e5272[_0x0753('0xfd')](_0x3ec0f);}})[_0x0753('0x20')](function(_0x5711f3){if(_0x5711f3){_0x699eb=_0x5711f3[_0x0753('0x50')];if(!_0x280133[_0x0753('0x4c')][_0x0753('0x51')]('nolimit')){_0x3ec0f[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x280133[_0x0753('0x4c')][_0x0753('0x2e')]);_0x3ec0f[_0x0753('0x2d')]=qs[_0x0753('0x2d')](_0x280133[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x4e5272[_0x0753('0xfd')](_0x3ec0f);}})[_0x0753('0x20')](function(_0x411a4e){if(_0x411a4e){return _0x411a4e?{'count':_0x699eb,'rows':_0x411a4e}:null;}})[_0x0753('0x20')](respondWithResult(_0xe13ec4,null))[_0x0753('0x29')](handleError(_0xe13ec4,null));};exports[_0x0753('0xfe')]=function(_0x239bdf,_0x5548aa){return db[_0x0753('0x5b')][_0x0753('0x3c')]({'where':{'id':_0x239bdf[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x5548aa,null))[_0x0753('0x20')](function(_0x5c90c0){if(_0x5c90c0){var _0x5027fb=_0x5c90c0[_0x0753('0x32')]({'plain':!![]});return _0x5c90c0[_0x0753('0xfe')](_0x239bdf[_0x0753('0x63')][_0x0753('0x66')],_['omit'](_0x239bdf[_0x0753('0x63')],['ids','id'])||{})[_0x0753('0x20')](function(){for(var _0x149e0b=0x0;_0x149e0b<_0x239bdf[_0x0753('0x63')][_0x0753('0x66')][_0x0753('0x50')];_0x149e0b++){var _0x1c7d24=[];db['Team'][_0x0753('0x8b')]({'where':{'id':_0x239bdf[_0x0753('0x63')][_0x0753('0x66')][_0x149e0b]}})[_0x0753('0x20')](function(_0x35d425){_0x1c7d24['push'](_0x35d425['getVoiceQueues']()[_0x0753('0x20')](function(_0x330d03){for(var _0x4d5c11=0x0;_0x4d5c11<_0x330d03[_0x0753('0x50')];_0x4d5c11++){_0x330d03[_0x4d5c11][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x100'));}return _0x330d03;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x101')]()[_0x0753('0x20')](function(_0x3b1c1d){for(var _0xec1c50=0x0;_0xec1c50<_0x3b1c1d['length'];_0xec1c50++){_0x3b1c1d[_0xec1c50]['setDataValue']('channel','Chat');}return _0x3b1c1d;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x102')]()[_0x0753('0x20')](function(_0x4f7576){for(var _0x2051da=0x0;_0x2051da<_0x4f7576[_0x0753('0x50')];_0x2051da++){_0x4f7576[_0x2051da][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x103'));}return _0x4f7576;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x104')]()[_0x0753('0x20')](function(_0xaa2f77){for(var _0x5cbda4=0x0;_0x5cbda4<_0xaa2f77[_0x0753('0x50')];_0x5cbda4++){_0xaa2f77[_0x5cbda4]['setDataValue']('channel','Sms');}return _0xaa2f77;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x105')]()[_0x0753('0x20')](function(_0x1bb2a9){for(var _0x2cfc7a=0x0;_0x2cfc7a<_0x1bb2a9[_0x0753('0x50')];_0x2cfc7a++){_0x1bb2a9[_0x2cfc7a][_0x0753('0xff')](_0x0753('0xa5'),'Whatsapp');}return _0x1bb2a9;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425['getFaxQueues']()[_0x0753('0x20')](function(_0x2fbae0){for(var _0x1a190f=0x0;_0x1a190f<_0x2fbae0[_0x0753('0x50')];_0x1a190f++){_0x2fbae0[_0x1a190f][_0x0753('0xff')]('channel',_0x0753('0x106'));}return _0x2fbae0;}));_0x1c7d24[_0x0753('0x9d')](_0x35d425[_0x0753('0x107')]()[_0x0753('0x20')](function(_0x36e1dd){for(var _0x504a9d=0x0;_0x504a9d<_0x36e1dd[_0x0753('0x50')];_0x504a9d++){_0x36e1dd[_0x504a9d][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x108'));}return _0x36e1dd;}));return BPromise[_0x0753('0xe1')](_0x1c7d24);})['then'](function(_0x5739e8){var _0x3a6ef5=_[_0x0753('0x109')](_0x5739e8);_0x1c7d24=[];return db[_0x0753('0x58')]['transaction'](function(_0x16bcdc){for(var _0x2c9158=0x0;_0x2c9158<_0x3a6ef5[_0x0753('0x50')];_0x2c9158++){_0x1c7d24[_0x0753('0x9d')](_0x3a6ef5[_0x2c9158][_0x0753('0x10a')](_0x5027fb['id']),{'transaction':_0x16bcdc});}return BPromise['all'](_0x1c7d24)[_0x0753('0x20')](function(){if(_0x5027fb[_0x0753('0x94')]){return BPromise['each'](_[_0x0753('0x38')](_0x3a6ef5,function(_0x42d017){return _0x42d017[_0x0753('0x10b')](_0x0753('0xa5'))===_0x0753('0x100');}),function(_0x575d22){return db[_0x0753('0xc1')][_0x0753('0xa4')]({'membername':_0x5027fb[_0x0753('0x3e')],'UserId':_0x5027fb['id'],'queue_name':_0x575d22['name'],'VoiceQueueId':_0x575d22['id'],'interface':_[_0x0753('0x6f')](_0x5027fb[_0x0753('0x9e')])?util[_0x0753('0x9f')](_0x0753('0xa0'),_0x5027fb['name']):_0x5027fb[_0x0753('0x9e')],'paused':_0x5027fb[_0x0753('0xa1')]||![],'penalty':_0x5027fb[_0x0753('0xa2')]},{'transaction':_0x16bcdc});});}else{return;}})[_0x0753('0x20')](function(){for(var _0x12f34e=0x0;_0x12f34e<_0x3a6ef5[_0x0753('0x50')];_0x12f34e++){var _0x44fc89=_0x3a6ef5[_0x12f34e]['getDataValue'](_0x0753('0xa5'));var _0x2db3b2=_0x44fc89+_0x0753('0x9a');socket[_0x0753('0xa8')]('user'+_0x44fc89+_0x0753('0x10c'),{'UserId':_0x5027fb['id'],['queueField']:_0x3a6ef5[_0x12f34e]['id']});}});});});}});}})[_0x0753('0x20')](respondWithStatusCode(_0x5548aa,null))['catch'](handleError(_0x5548aa,null));};exports['removeTeams']=function(_0x28b7b1,_0x31efec){return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x28b7b1[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x31efec,null))[_0x0753('0x20')](function(_0x5a17ab){if(_0x5a17ab){var _0x1b6716=_0x5a17ab['get']({'plain':!![]});var _0x1f0369=_0x28b7b1[_0x0753('0x4c')][_0x0753('0x66')];return _0x5a17ab['removeTeams'](_0x1f0369)['then'](function(){for(var _0x2ba3f9=0x0;_0x2ba3f9<_0x1f0369[_0x0753('0x50')];_0x2ba3f9++){var _0x4b6ee2=[];db[_0x0753('0x10d')]['findOne']({'where':{'id':_0x1f0369[_0x2ba3f9]}})[_0x0753('0x20')](function(_0xae0d79){_0x4b6ee2['push'](_0xae0d79[_0x0753('0xdc')]()[_0x0753('0x20')](function(_0x1f2a01){for(var _0x22cdae=0x0;_0x22cdae<_0x1f2a01[_0x0753('0x50')];_0x22cdae++){_0x1f2a01[_0x22cdae][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x100'));}return _0x1f2a01;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x101')]()[_0x0753('0x20')](function(_0x27371b){for(var _0x37a8ec=0x0;_0x37a8ec<_0x27371b[_0x0753('0x50')];_0x37a8ec++){_0x27371b[_0x37a8ec][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x10e'));}return _0x27371b;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x102')]()[_0x0753('0x20')](function(_0x410b03){for(var _0x27f661=0x0;_0x27f661<_0x410b03[_0x0753('0x50')];_0x27f661++){_0x410b03[_0x27f661][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x103'));}return _0x410b03;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x104')]()['then'](function(_0x10e2a9){for(var _0x5e32e6=0x0;_0x5e32e6<_0x10e2a9[_0x0753('0x50')];_0x5e32e6++){_0x10e2a9[_0x5e32e6]['setDataValue'](_0x0753('0xa5'),'Sms');}return _0x10e2a9;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x105')]()[_0x0753('0x20')](function(_0x52a782){for(var _0x549a00=0x0;_0x549a00<_0x52a782[_0x0753('0x50')];_0x549a00++){_0x52a782[_0x549a00][_0x0753('0xff')](_0x0753('0xa5'),_0x0753('0x10f'));}return _0x52a782;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x110')]()[_0x0753('0x20')](function(_0x12cb67){for(var _0x6663ec=0x0;_0x6663ec<_0x12cb67[_0x0753('0x50')];_0x6663ec++){_0x12cb67[_0x6663ec][_0x0753('0xff')](_0x0753('0xa5'),'Fax');}return _0x12cb67;}));_0x4b6ee2[_0x0753('0x9d')](_0xae0d79[_0x0753('0x107')]()[_0x0753('0x20')](function(_0x3d4382){for(var _0x432e3c=0x0;_0x432e3c<_0x3d4382[_0x0753('0x50')];_0x432e3c++){_0x3d4382[_0x432e3c]['setDataValue'](_0x0753('0xa5'),'Openchannel');}return _0x3d4382;}));return BPromise[_0x0753('0xe1')](_0x4b6ee2);})['then'](function(_0x10ae9e){var _0x16faf3=_[_0x0753('0x109')](_0x10ae9e);_0x4b6ee2=[];return db[_0x0753('0x58')][_0x0753('0x111')](function(_0x3eaeb4){for(var _0x5128dc=0x0;_0x5128dc<_0x16faf3[_0x0753('0x50')];_0x5128dc++){_0x4b6ee2['push'](_0x16faf3[_0x5128dc][_0x0753('0x112')](_0x1b6716['id']),{'transaction':_0x3eaeb4});}return BPromise[_0x0753('0xe1')](_0x4b6ee2)[_0x0753('0x20')](function(){if(_0x1b6716[_0x0753('0x94')]){return BPromise[_0x0753('0xa3')](_[_0x0753('0x38')](_0x16faf3,function(_0x4e16f6){return _0x4e16f6[_0x0753('0x10b')](_0x0753('0xa5'))===_0x0753('0x100');}),function(_0x5489cd){return db[_0x0753('0xc1')]['destroy']({'where':{'VoiceQueueId':_0x5489cd['id'],'UserId':_0x1b6716['id']},'transaction':_0x3eaeb4});});}else{return;}})[_0x0753('0x20')](function(){for(var _0x2d5169=0x0;_0x2d5169<_0x16faf3[_0x0753('0x50')];_0x2d5169++){var _0x302569=_0x16faf3[_0x2d5169][_0x0753('0x10b')]('channel');var _0x23bf4d=_0x302569+_0x0753('0x9a');socket[_0x0753('0xa8')]('user'+_0x302569+'Queue:remove',{'UserId':_0x1b6716['id'],['queueField']:_0x16faf3[_0x2d5169]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x31efec,null))['catch'](handleError(_0x31efec,null));};exports[_0x0753('0x113')]=function(_0x3bdc6b,_0x2e28ec,_0x56d73c){var _0x2fb8d0={};var _0xbfbcfd={};var _0x3dfdfc;var _0x3b8726;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x3bdc6b[_0x0753('0x60')]['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2e28ec,null))[_0x0753('0x20')](function(_0x5e5999){if(_0x5e5999){_0x3dfdfc=_0x5e5999;_0xbfbcfd[_0x0753('0x47')]=_['keys'](db[_0x0753('0xb7')][_0x0753('0x44')]);_0xbfbcfd['query']=_[_0x0753('0x4b')](_0x3bdc6b[_0x0753('0x4c')]);_0xbfbcfd['filters']=_[_0x0753('0x4e')](_0xbfbcfd[_0x0753('0x47')],_0xbfbcfd['query']);_0x2fb8d0[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0xbfbcfd['model'],qs[_0x0753('0xb5')](_0x3bdc6b['query'][_0x0753('0xb5')]));_0x2fb8d0[_0x0753('0x4f')]=_0x2fb8d0[_0x0753('0x4f')]['length']?_0x2fb8d0[_0x0753('0x4f')]:_0xbfbcfd['model'];_0x2fb8d0[_0x0753('0xb6')]=qs['sort'](_0x3bdc6b['query']['sort']);_0x2fb8d0['where']=qs['filters'](_[_0x0753('0x55')](_0x3bdc6b[_0x0753('0x4c')],_0xbfbcfd[_0x0753('0x4d')]));if(_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x38')]){_0x2fb8d0[_0x0753('0x54')]=_[_0x0753('0x56')](_0x2fb8d0[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0x2fb8d0['attributes'],function(_0x286658){var _0x4ef7a2={};_0x4ef7a2[_0x286658]={'$like':'%'+_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x4ef7a2;})});}_0x2fb8d0=_[_0x0753('0x56')]({},_0x2fb8d0,_0x3bdc6b[_0x0753('0x5a')]);return _0x3dfdfc['getLists'](_0x2fb8d0);}})[_0x0753('0x20')](function(_0x6daf08){if(_0x6daf08){_0x3b8726=_0x6daf08[_0x0753('0x50')];if(!_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x51')](_0x0753('0x52'))){_0x2fb8d0[_0x0753('0x2e')]=qs[_0x0753('0x2e')](_0x3bdc6b['query'][_0x0753('0x2e')]);_0x2fb8d0[_0x0753('0x2d')]=qs['offset'](_0x3bdc6b[_0x0753('0x4c')][_0x0753('0x2d')]);}return _0x3dfdfc[_0x0753('0x113')](_0x2fb8d0);}})[_0x0753('0x20')](function(_0x4135f8){if(_0x4135f8){return _0x4135f8?{'count':_0x3b8726,'rows':_0x4135f8}:null;}})[_0x0753('0x20')](respondWithResult(_0x2e28ec,null))[_0x0753('0x29')](handleError(_0x2e28ec,null));};exports[_0x0753('0x114')]=function(_0x617177,_0x2caf28,_0x5ecde0){var _0xfb62cf={};var _0x2f5d34={};var _0x31e4fa;var _0x260880;return db[_0x0753('0x5b')][_0x0753('0x8b')]({'where':{'id':_0x617177['params']['id']}})[_0x0753('0x20')](handleEntityNotFound(_0x2caf28,null))[_0x0753('0x20')](function(_0x41e22d){if(_0x41e22d){_0x31e4fa=_0x41e22d;_0x2f5d34[_0x0753('0x47')]=_[_0x0753('0x4b')](db[_0x0753('0x5b')][_0x0753('0x44')]);_0x2f5d34['query']=_[_0x0753('0x4b')](_0x617177['query']);_0x2f5d34[_0x0753('0x4d')]=_[_0x0753('0x4e')](_0x2f5d34['model'],_0x2f5d34[_0x0753('0x4c')]);_0xfb62cf[_0x0753('0x4f')]=_[_0x0753('0x4e')](_0x2f5d34[_0x0753('0x47')],qs[_0x0753('0xb5')](_0x617177['query'][_0x0753('0xb5')]));_0xfb62cf[_0x0753('0x4f')]=_0xfb62cf[_0x0753('0x4f')]['length']?_0xfb62cf['attributes']:_0x2f5d34[_0x0753('0x47')];_0xfb62cf[_0x0753('0xb6')]=qs['sort'](_0x617177[_0x0753('0x4c')]['sort']);_0xfb62cf['where']=qs['filters'](_[_0x0753('0x55')](_0x617177[_0x0753('0x4c')],_0x2f5d34[_0x0753('0x4d')]));if(_0x617177[_0x0753('0x4c')][_0x0753('0x38')]){_0xfb62cf[_0x0753('0x54')]=_['merge'](_0xfb62cf[_0x0753('0x54')],{'$or':_[_0x0753('0x48')](_0xfb62cf[_0x0753('0x4f')],function(_0x1ddbb8){var _0x2e5783={};_0x2e5783[_0x1ddbb8]={'$like':'%'+_0x617177[_0x0753('0x4c')][_0x0753('0x38')]+'%'};return _0x2e5783;})});}_0xfb62cf[_0x0753('0x47')]=db['User'];_0xfb62cf['as']='Agents';_0xfb62cf=_['merge']({},_0xfb62cf,_0x617177[_0x0753('0x5a')]);return _0x31e4fa[_0x0753('0xdc')]({'include':[_0xfb62cf]});}})[_0x0753('0x20')](function(_0x4fa660){if(_0x4fa660){var _0xcfe8df={},_0x13e0ab=[],_0x206913=0x0;for(var _0x56f242=0x0;_0x56f242<_0x4fa660[_0x0753('0x50')];_0x56f242+=0x1){for(var _0x31a8d0=0x0,_0x1ec78a;_0x31a8d0<_0x4fa660[_0x56f242][_0x0753('0x85')]['length'];_0x31a8d0+=0x1){_0x1ec78a=_0x4fa660[_0x56f242]['Agents'][_0x31a8d0][_0x0753('0x32')]({'plain':!![]});_0xcfe8df[_0x1ec78a['id']]=_0x1ec78a;}}_0xcfe8df=_[_0x0753('0x115')](_0xcfe8df);for(var _0x5331ff=qs[_0x0753('0x2d')](_0x617177['query'][_0x0753('0x2d')]);_0x5331ff<_0xcfe8df[_0x0753('0x50')]&&_0x13e0ab[_0x0753('0x50')]=_0x5bcdd4[_0xd954('0x52')]){throw new Error(_0xd954('0x53'));}})[_0xd954('0x23')](function(){if(_0x220f4e){return db[_0xd954('0x2d')][_0xd954('0x54')]({'where':{'membername':_0x220f4e[_0xd954('0x29')]},'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x220f4e){return _0x220f4e[_0xd954('0x55')]({'raw':!![]});}})['then'](function(_0x4e3691){if(_0x220f4e){if(_0x4e3691){var _0x971184=[];_0x3a7938=_0x4e3691;if(_0x3a7938[_0xd954('0x30')]){for(var _0xc1df5f=0x0;_0xc1df5f<_0x3a7938[_0xd954('0x30')];_0xc1df5f++){_0x971184[_0xd954('0x35')](db['UserVoiceQueueRt'][_0xd954('0x56')]({'membername':_0x220f4e['name'],'UserId':_0x220f4e['id'],'queue_name':_0x3a7938[_0xc1df5f][_0xd954('0x29')],'VoiceQueueId':_0x3a7938[_0xc1df5f]['id'],'interface':_0x5b2305,'paused':_0x220f4e[_0xd954('0x57')]||![],'penalty':_0x3a7938[_0xc1df5f]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xd954('0x49')](_0x971184);}}}})[_0xd954('0x23')](function(){if(_0x220f4e){return db[_0xd954('0x2e')][_0xd954('0x48')]({'where':{'membername':_0x220f4e[_0xd954('0x29')],'exitAt':null}});}})[_0xd954('0x23')](function(_0x8f58a4){if(_0x220f4e){if(_0x8f58a4&&_0x8f58a4[_0xd954('0x30')]){var _0x50f6ac=[];_0x8f58a4[_0xd954('0x34')](function(_0x417dfa){_0x50f6ac[_0xd954('0x35')](_0x417dfa[_0xd954('0x3c')]({'exitAt':moment()['format'](_0xd954('0x31'))}));});return BPromise[_0xd954('0x49')](_0x50f6ac);}}})['then'](function(_0x5143bd){if(_0x220f4e){var _0x1e4315=[];var _0x172fab=[];var _0x432da9=utils[_0xd954('0x33')]();var _0x26d2c3={'membername':_0x220f4e['name'],'interface':_0x5b2305,'enterAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'role':_0x220f4e[_0xd954('0x2a')],'internal':_0x220f4e[_0xd954('0x2b')]};_0x432da9['forEach'](function(_0x4edb4c){_0x1e4315[_0xd954('0x35')](_[_0xd954('0x58')]({'channel':_0x4edb4c,'type':'LOGIN','data1':_0xd954('0x59'),'data2':_0x5b2305},_0x26d2c3));if(_0x220f4e[_0xd954('0x57')]){_0x172fab['push'](_['merge']({'channel':_0x4edb4c,'type':_0xd954('0x2f'),'data1':'LOGININPAUSE'},_0x26d2c3));}});return db[_0xd954('0x2e')][_0xd954('0x3b')](_0x1e4315['concat'](_0x172fab),{'individualHooks':!![]});}})[_0xd954('0x23')](function(){if(_0x220f4e){return _0x220f4e[_0xd954('0x3c')]({'online':!![],'lastLoginAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'voicePause':_0x220f4e[_0xd954('0x57')]||![],'mailPause':_0x220f4e['loginInPause']||![],'chatPause':_0x220f4e[_0xd954('0x57')]||![],'faxPause':_0x220f4e[_0xd954('0x57')]||![],'smsPause':_0x220f4e[_0xd954('0x57')]||![],'openchannelPause':_0x220f4e[_0xd954('0x57')]||![],'pauseType':_0x220f4e[_0xd954('0x57')]?_0xd954('0x5a'):null,'lastPauseAt':moment()[_0xd954('0x37')](_0xd954('0x31')),'interface':_0x5b2305});}})[_0xd954('0x23')](function(_0x445590){_0x294ff4(_0x445590);})[_0xd954('0x1a')](function(_0xaba1c7){_0x401316(_0x2ed64c[_0xd954('0x16')](0x1f4,_0xaba1c7[_0xd954('0x18')]));});});}; \ No newline at end of file +var _0x133a=['channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','sms','openchannel','set','Pause','findAll','all','LogoutUser','destroy','LoginUser','mobile','loginInPause','SIP/%s','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','User','options','where','attributes','include','map','model','debug','find','raw','ShowUser','name','role','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','type','DEFAULT\x20PAUSE','internal','body','uniqueid','bulkCreate','update','findOne'];(function(_0x78929c,_0x529d2f){var _0x1c1c5c=function(_0x5c097b){while(--_0x5c097b){_0x78929c['push'](_0x78929c['shift']());}};_0x1c1c5c(++_0x529d2f);}(_0x133a,0x77));var _0xa133=function(_0x283ef3,_0x136ad1){_0x283ef3=_0x283ef3-0x0;var _0x1d4c24=_0x133a[_0x283ef3];return _0x1d4c24;};'use strict';var _=require(_0xa133('0x0'));var util=require(_0xa133('0x1'));var moment=require(_0xa133('0x2'));var BPromise=require(_0xa133('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa133('0x4'));var db=require(_0xa133('0x5'))['db'];var utils=require(_0xa133('0x6'));var logger=require(_0xa133('0x7'))(_0xa133('0x8'));var config=require(_0xa133('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa133('0xa')]({'port':0x232a});config[_0xa133('0xb')]=_[_0xa133('0xc')](config[_0xa133('0xb')],{'host':_0xa133('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa133('0xb')]));require(_0xa133('0xe'))[_0xa133('0xf')](socket);function respondWithRpcPromise(_0x32e47d,_0x2356b7,_0x5e1614){return new BPromise(function(_0x15a82e,_0x5d8f3f){return client['request'](_0x32e47d,_0x5e1614)[_0xa133('0x10')](function(_0x24ff63){logger[_0xa133('0x11')](_0xa133('0x12'),_0x2356b7,_0xa133('0x13'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x2356b7,_0xa133('0x13'),JSON[_0xa133('0x14')](_0x24ff63));if(_0x24ff63[_0xa133('0x15')]){if(_0x24ff63[_0xa133('0x15')][_0xa133('0x16')]===0x1f4){logger[_0xa133('0x15')]('User,\x20%s,\x20%s',_0x2356b7,_0x24ff63[_0xa133('0x15')][_0xa133('0x17')]);return _0x5d8f3f(_0x24ff63[_0xa133('0x15')][_0xa133('0x17')]);}logger[_0xa133('0x15')](_0xa133('0x12'),_0x2356b7,_0x24ff63['error']['message']);return _0x15a82e(_0x24ff63[_0xa133('0x15')]['message']);}else{logger[_0xa133('0x11')](_0xa133('0x12'),_0x2356b7,_0xa133('0x13'));_0x15a82e(_0x24ff63[_0xa133('0x18')][_0xa133('0x17')]);}})[_0xa133('0x19')](function(_0x4317e4){logger['error'](_0xa133('0x12'),_0x2356b7,_0x4317e4);_0x5d8f3f(_0x4317e4);});});}exports[_0xa133('0x1a')]=function(_0x1b417f){var _0x83877b=this;return new Promise(function(_0x535fd0,_0x4a3cf1){return db[_0xa133('0x1b')]['findAll']({'raw':_0x1b417f[_0xa133('0x1c')]?_0x1b417f[_0xa133('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1b417f[_0xa133('0x1c')]?_0x1b417f[_0xa133('0x1c')][_0xa133('0x1d')]||null:null,'attributes':_0x1b417f[_0xa133('0x1c')]?_0x1b417f[_0xa133('0x1c')][_0xa133('0x1e')]||null:null,'limit':_0x1b417f[_0xa133('0x1c')]?_0x1b417f[_0xa133('0x1c')]['limit']||null:null,'include':_0x1b417f['options']?_0x1b417f[_0xa133('0x1c')][_0xa133('0x1f')]?_[_0xa133('0x20')](_0x1b417f[_0xa133('0x1c')][_0xa133('0x1f')],function(_0xb80254){return{'model':db[_0xb80254[_0xa133('0x21')]],'as':_0xb80254['as'],'attributes':_0xb80254[_0xa133('0x1e')],'include':_0xb80254[_0xa133('0x1f')]?_[_0xa133('0x20')](_0xb80254[_0xa133('0x1f')],function(_0x1329f9){return{'model':db[_0x1329f9[_0xa133('0x21')]],'as':_0x1329f9['as'],'attributes':_0x1329f9[_0xa133('0x1e')],'include':_0x1329f9[_0xa133('0x1f')]?_['map'](_0x1329f9[_0xa133('0x1f')],function(_0x117c98){return{'model':db[_0x117c98[_0xa133('0x21')]],'as':_0x117c98['as'],'attributes':_0x117c98['attributes']};}):[]};}):[]};}):[]:[]})[_0xa133('0x10')](function(_0x3fc41b){logger[_0xa133('0x11')](_0xa133('0x1a'),_0x1b417f);logger[_0xa133('0x22')]('GetUser',_0x1b417f,JSON[_0xa133('0x14')](_0x3fc41b));_0x535fd0(_0x3fc41b);})[_0xa133('0x19')](function(_0x2f5385){logger[_0xa133('0x15')](_0xa133('0x1a'),_0x2f5385[_0xa133('0x17')],_0x1b417f);_0x4a3cf1(_0x83877b[_0xa133('0x15')](0x1f4,_0x2f5385[_0xa133('0x17')]));});});};exports['ShowUser']=function(_0x2bfcd5){var _0x32040c=this;return new Promise(function(_0x1b1b00,_0x3dee72){return db[_0xa133('0x1b')][_0xa133('0x23')]({'raw':_0x2bfcd5[_0xa133('0x1c')]?_0x2bfcd5['options'][_0xa133('0x24')]===undefined?!![]:![]:!![],'where':_0x2bfcd5[_0xa133('0x1c')]?_0x2bfcd5[_0xa133('0x1c')][_0xa133('0x1d')]||null:null,'attributes':_0x2bfcd5[_0xa133('0x1c')]?_0x2bfcd5[_0xa133('0x1c')][_0xa133('0x1e')]||null:null,'include':_0x2bfcd5[_0xa133('0x1c')]?_0x2bfcd5[_0xa133('0x1c')]['include']?_['map'](_0x2bfcd5[_0xa133('0x1c')][_0xa133('0x1f')],function(_0x2edc24){return{'model':db[_0x2edc24[_0xa133('0x21')]],'as':_0x2edc24['as'],'attributes':_0x2edc24[_0xa133('0x1e')],'include':_0x2edc24[_0xa133('0x1f')]?_[_0xa133('0x20')](_0x2edc24[_0xa133('0x1f')],function(_0x4dbc3b){return{'model':db[_0x4dbc3b[_0xa133('0x21')]],'as':_0x4dbc3b['as'],'attributes':_0x4dbc3b[_0xa133('0x1e')],'include':_0x4dbc3b[_0xa133('0x1f')]?_[_0xa133('0x20')](_0x4dbc3b[_0xa133('0x1f')],function(_0x564230){return{'model':db[_0x564230['model']],'as':_0x564230['as'],'attributes':_0x564230[_0xa133('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa133('0x10')](function(_0x1250b3){logger[_0xa133('0x11')](_0xa133('0x25'),_0x2bfcd5);logger[_0xa133('0x22')](_0xa133('0x25'),_0x2bfcd5,JSON[_0xa133('0x14')](_0x1250b3));_0x1b1b00(_0x1250b3);})[_0xa133('0x19')](function(_0x4ac9ca){logger[_0xa133('0x15')](_0xa133('0x25'),_0x4ac9ca['message'],_0x2bfcd5);_0x3dee72(_0x32040c[_0xa133('0x15')](0x1f4,_0x4ac9ca[_0xa133('0x17')]));});});};exports['PauseUser']=function(_0x466aa3){var _0x25a31a=this;return new Promise(function(_0x191015,_0x58846b){var _0x56de20;return db['User'][_0xa133('0x23')]({'where':_0x466aa3[_0xa133('0x1c')]['where']||{},'attributes':['id',_0xa133('0x26'),_0xa133('0x27'),'internal',_0xa133('0x28')]})[_0xa133('0x10')](function(_0x37876f){if(_0x37876f){_0x56de20=_0x37876f;return db[_0xa133('0x29')]['update']({'paused':0x1},{'where':{'UserId':_0x56de20['id']},'individualHooks':!![]});}})[_0xa133('0x10')](function(){if(_0x56de20){return db[_0xa133('0x2a')]['findAll']({'where':{'membername':_0x56de20[_0xa133('0x26')],'type':_0xa133('0x2b'),'exitAt':null}});}})[_0xa133('0x10')](function(_0x4646ea){if(_0x56de20){if(_0x4646ea&&_0x4646ea[_0xa133('0x2c')]){var _0xaa5d3d=moment()[_0xa133('0x2d')](_0xa133('0x2e'));for(var _0xd6cbe2=0x0,_0x168d99=_0x4646ea[_0xa133('0x2c')];_0xd6cbe2<_0x168d99;_0xd6cbe2++){_0x4646ea[_0xd6cbe2][_0xa133('0x2f')]({'exitAt':_0xaa5d3d});}}}})['then'](function(){if(_0x56de20){var _0x3ad0ca=[];var _0x333b90=utils[_0xa133('0x30')]();_0x333b90[_0xa133('0x31')](function(_0x1bdb92){_0x3ad0ca[_0xa133('0x32')]({'channel':_0x1bdb92,'membername':_0x56de20[_0xa133('0x26')],'interface':_['isNil'](_0x56de20[_0xa133('0x28')])?util['format']('SIP/%s',_0x56de20[_0xa133('0x26')]):_0x56de20[_0xa133('0x28')],'type':_0xa133('0x2b'),'enterAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'data1':_0x466aa3['body'][_0xa133('0x33')]||_0xa133('0x34'),'role':_0x56de20[_0xa133('0x27')],'internal':_0x56de20[_0xa133('0x35')],'uniqueid':_0x466aa3[_0xa133('0x36')][_0xa133('0x37')]||null});});return db[_0xa133('0x2a')][_0xa133('0x38')](_0x3ad0ca,{'individualHooks':!![]});}})['then'](function(){if(_0x56de20){return _0x56de20[_0xa133('0x39')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x466aa3[_0xa133('0x36')][_0xa133('0x33')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa133('0x2d')](_0xa133('0x2e'))});}})[_0xa133('0x10')](function(_0x30e99c){_0x191015(_0x30e99c);})['catch'](function(_0x32fc3b){_0x58846b(_0x25a31a[_0xa133('0x15')](0x1f4,_0x32fc3b['message']));});});};exports['UnpauseUser']=function(_0x286bb1){var _0x241d79=this;return new Promise(function(_0x34908e,_0x2c3482){var _0x1e82bb;return db[_0xa133('0x1b')][_0xa133('0x3a')]({'where':_0x286bb1[_0xa133('0x1c')][_0xa133('0x1d')]||{},'attributes':['id',_0xa133('0x26')]})[_0xa133('0x10')](function(_0x13837c){if(_0x13837c){_0x1e82bb=_0x13837c;if(_0x286bb1[_0xa133('0x36')][_0xa133('0x3b')]&&!utils[_0xa133('0x3c')](_0x286bb1['body'][_0xa133('0x3b')])){throw new Error(_0xa133('0x3d'));}switch(_0x286bb1[_0xa133('0x36')][_0xa133('0x3b')]){case _0xa133('0x3e'):return db[_0xa133('0x29')][_0xa133('0x39')]({'paused':0x0},{'where':{'UserId':_0x1e82bb['id']}})[_0xa133('0x10')](function(){return db[_0xa133('0x2a')][_0xa133('0x23')]({'where':{'channel':_0x286bb1[_0xa133('0x36')][_0xa133('0x3b')],'membername':_0x1e82bb[_0xa133('0x26')],'type':_0xa133('0x2b'),'exitAt':null}});})['then'](function(_0x478807){if(_0x478807){return _0x478807[_0xa133('0x39')]({'exitAt':moment()[_0xa133('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xa133('0x3f')},{'individualHooks':!![]});}return null;})[_0xa133('0x10')](function(){return _0x1e82bb[_0xa133('0x39')]({'voicePause':![]});});case _0xa133('0x40'):case _0xa133('0x41'):case'fax':case _0xa133('0x42'):case _0xa133('0x43'):return db[_0xa133('0x2a')][_0xa133('0x23')]({'where':{'channel':_0x286bb1[_0xa133('0x36')][_0xa133('0x3b')],'membername':_0x1e82bb[_0xa133('0x26')],'type':_0xa133('0x2b'),'exitAt':null}})[_0xa133('0x10')](function(_0x1f5844){return _0x1f5844[_0xa133('0x39')]({'exitAt':moment()['format'](_0xa133('0x2e')),'data2':'system'},{'individualHooks':!![]});})[_0xa133('0x10')](function(){var _0x5be188={};_[_0xa133('0x44')](_0x5be188,util['format']('%s%s',_0x286bb1[_0xa133('0x36')][_0xa133('0x3b')],_0xa133('0x45')),![]);return _0x1e82bb[_0xa133('0x39')](_0x5be188);});default:return db[_0xa133('0x29')][_0xa133('0x39')]({'paused':0x0},{'where':{'UserId':_0x1e82bb['id']}})[_0xa133('0x10')](function(){return db[_0xa133('0x2a')][_0xa133('0x46')]({'where':{'membername':_0x1e82bb[_0xa133('0x26')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x4a432a){var _0x301e7a=[];_0x4a432a[_0xa133('0x31')](function(_0x47549e){_0x301e7a[_0xa133('0x32')](_0x47549e['update']({'exitAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'data2':_0xa133('0x3f')}));});return BPromise[_0xa133('0x47')](_0x301e7a);})[_0xa133('0x10')](function(){return _0x1e82bb[_0xa133('0x39')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xa133('0x10')](function(_0xbf2135){_0x34908e(_0xbf2135);})[_0xa133('0x19')](function(_0x4a4f71){_0x2c3482(_0x241d79[_0xa133('0x15')](0x1f4,_0x4a4f71[_0xa133('0x17')]));});});};exports[_0xa133('0x48')]=function(_0x355216){var _0x1322b7=this;return new Promise(function(_0x54e3aa,_0x11e85d){var _0x1b2480;return db['User'][_0xa133('0x3a')]({'where':_0x355216[_0xa133('0x1c')][_0xa133('0x1d')]||{},'attributes':['id',_0xa133('0x26')]})['then'](function(_0x3be3c2){if(_0x3be3c2){_0x1b2480=_0x3be3c2;return db[_0xa133('0x29')][_0xa133('0x49')]({'where':{'membername':_0x1b2480[_0xa133('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x1b2480){return db[_0xa133('0x2a')][_0xa133('0x46')]({'where':{'membername':_0x1b2480['name'],'exitAt':null}});}})[_0xa133('0x10')](function(_0xc02cf1){if(_0x1b2480){if(_0xc02cf1&&_0xc02cf1['length']){var _0x2c5bb0=[];_0xc02cf1['forEach'](function(_0x23ec78){_0x2c5bb0[_0xa133('0x32')](_0x23ec78[_0xa133('0x39')]({'exitAt':moment()[_0xa133('0x2d')](_0xa133('0x2e'))}));});return BPromise['all'](_0x2c5bb0);}}})[_0xa133('0x10')](function(){if(_0x1b2480){return _0x1b2480[_0xa133('0x39')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1bf83b){_0x54e3aa(_0x1bf83b);})[_0xa133('0x19')](function(_0x2c3f45){_0x11e85d(_0x1322b7['error'](0x1f4,_0x2c3f45[_0xa133('0x17')]));});});};exports[_0xa133('0x4a')]=function(_0x287ff8){var _0x13e835=this;return new Promise(function(_0x46015a,_0x255454){var _0xb50843;var _0x56237b;var _0x3fdeb7;var _0x2ad672;return db[_0xa133('0x1b')][_0xa133('0x3a')]({'where':_0x287ff8[_0xa133('0x1c')]['where']||{},'attributes':['id',_0xa133('0x26'),'role',_0xa133('0x4b'),'phone',_0xa133('0x35'),_0xa133('0x4c'),'interface']})[_0xa133('0x10')](function(_0x27ec66){if(_0x27ec66){_0xb50843=_0x27ec66;_0x2ad672=_0x287ff8[_0xa133('0x36')][_0xa133('0x28')]?_0x287ff8[_0xa133('0x36')][_0xa133('0x28')]:util['format'](_0xa133('0x4d'),_0xb50843['name']);return db[_0xa133('0x1b')][_0xa133('0x4e')]({'where':{'role':_0xa133('0x4f'),'online':!![],'id':{'$ne':_0xb50843['id']}}});}})['then'](function(_0x4d3fa0){if(_0x4d3fa0){_0x3fdeb7=_0x4d3fa0;return require('../../config/license/util')[_0xa133('0x50')]();}})['then'](function(_0x1f53e4){if(_0x1f53e4&&_0x1f53e4[_0xa133('0x51')]&&_0x3fdeb7>=_0x1f53e4[_0xa133('0x51')]){throw new Error(_0xa133('0x52'));}})[_0xa133('0x10')](function(){if(_0xb50843){return db[_0xa133('0x29')]['destroy']({'where':{'membername':_0xb50843['name']},'individualHooks':!![]});}})[_0xa133('0x10')](function(){if(_0xb50843){return _0xb50843[_0xa133('0x53')]({'raw':!![]});}})['then'](function(_0x363387){if(_0xb50843){if(_0x363387){var _0x46d1b7=[];_0x56237b=_0x363387;if(_0x56237b[_0xa133('0x2c')]){for(var _0x3c3639=0x0;_0x3c3639<_0x56237b['length'];_0x3c3639++){_0x46d1b7['push'](db[_0xa133('0x29')]['upsert']({'membername':_0xb50843[_0xa133('0x26')],'UserId':_0xb50843['id'],'queue_name':_0x56237b[_0x3c3639][_0xa133('0x26')],'VoiceQueueId':_0x56237b[_0x3c3639]['id'],'interface':_0x2ad672,'paused':_0xb50843['loginInPause']||![],'penalty':_0x56237b[_0x3c3639][_0xa133('0x54')]||0x0}));}return BPromise['all'](_0x46d1b7);}}}})[_0xa133('0x10')](function(){if(_0xb50843){return db['MemberReport'][_0xa133('0x46')]({'where':{'membername':_0xb50843['name'],'exitAt':null}});}})[_0xa133('0x10')](function(_0x5718d8){if(_0xb50843){if(_0x5718d8&&_0x5718d8[_0xa133('0x2c')]){var _0x20dd1a=[];_0x5718d8['forEach'](function(_0x339182){_0x20dd1a[_0xa133('0x32')](_0x339182[_0xa133('0x39')]({'exitAt':moment()[_0xa133('0x2d')](_0xa133('0x2e'))}));});return BPromise[_0xa133('0x47')](_0x20dd1a);}}})[_0xa133('0x10')](function(_0x2d4081){if(_0xb50843){var _0x35b6a1=[];var _0x59e9d6=[];var _0x49d1c4=utils[_0xa133('0x30')]();var _0x4ed249={'membername':_0xb50843['name'],'interface':_0x2ad672,'enterAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'role':_0xb50843[_0xa133('0x27')],'internal':_0xb50843['internal']};_0x49d1c4[_0xa133('0x31')](function(_0x579ae1){_0x35b6a1[_0xa133('0x32')](_[_0xa133('0x55')]({'channel':_0x579ae1,'type':'LOGIN','data1':_0xa133('0x56'),'data2':_0x2ad672},_0x4ed249));if(_0xb50843['loginInPause']){_0x59e9d6[_0xa133('0x32')](_[_0xa133('0x55')]({'channel':_0x579ae1,'type':_0xa133('0x2b'),'data1':_0xa133('0x57')},_0x4ed249));}});return db[_0xa133('0x2a')][_0xa133('0x38')](_0x35b6a1[_0xa133('0x58')](_0x59e9d6),{'individualHooks':!![]});}})[_0xa133('0x10')](function(){if(_0xb50843){return _0xb50843[_0xa133('0x39')]({'online':!![],'lastLoginAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'voicePause':_0xb50843[_0xa133('0x4c')]||![],'mailPause':_0xb50843[_0xa133('0x4c')]||![],'chatPause':_0xb50843[_0xa133('0x4c')]||![],'faxPause':_0xb50843[_0xa133('0x4c')]||![],'smsPause':_0xb50843[_0xa133('0x4c')]||![],'openchannelPause':_0xb50843['loginInPause']||![],'pauseType':_0xb50843[_0xa133('0x4c')]?_0xa133('0x57'):null,'lastPauseAt':moment()[_0xa133('0x2d')](_0xa133('0x2e')),'interface':_0x2ad672});}})['then'](function(_0x2d9681){_0x46015a(_0x2d9681);})[_0xa133('0x19')](function(_0x1e0121){_0x255454(_0x13e835['error'](0x1f4,_0x1e0121[_0xa133('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 6de7415..4f9b58d 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 _0xcd5e=['length','./user.events','save','update','removeListener','register'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xcd5e,0x12d));var _0xecd5=function(_0x3d3c64,_0x4bf2da){_0x3d3c64=_0x3d3c64-0x0;var _0x313642=_0xcd5e[_0x3d3c64];return _0x313642;};'use strict';var UserEvents=require(_0xecd5('0x0'));var events=[_0xecd5('0x1'),'remove',_0xecd5('0x2')];function createListener(_0x5d16a6,_0x41be60){return function(_0x30fa79){_0x41be60['emit'](_0x5d16a6,_0x30fa79);};}function removeListener(_0x5a53c5,_0x2f5465){return function(){UserEvents[_0xecd5('0x3')](_0x5a53c5,_0x2f5465);};}exports[_0xecd5('0x4')]=function(_0x41546f){for(var _0x1cbdb7=0x0,_0x368673=events[_0xecd5('0x5')];_0x1cbdb7<_0x368673;_0x1cbdb7++){var _0x4b373f=events[_0x1cbdb7];var _0x59cf1a=createListener('user:'+_0x4b373f,_0x41546f);UserEvents['on'](_0x4b373f,_0x59cf1a);}}; \ No newline at end of file +var _0xd772=['emit','length','./user.events','save'];(function(_0x2778bb,_0x26e882){var _0x316daa=function(_0x26f317){while(--_0x26f317){_0x2778bb['push'](_0x2778bb['shift']());}};_0x316daa(++_0x26e882);}(_0xd772,0x1b6));var _0x2d77=function(_0x555f56,_0x334d65){_0x555f56=_0x555f56-0x0;var _0x56db9a=_0xd772[_0x555f56];return _0x56db9a;};'use strict';var UserEvents=require(_0x2d77('0x0'));var events=[_0x2d77('0x1'),'remove','update'];function createListener(_0x33ec65,_0x4cf839){return function(_0x54285f){_0x4cf839[_0x2d77('0x2')](_0x33ec65,_0x54285f);};}function removeListener(_0x127b2d,_0x2ec8b7){return function(){UserEvents['removeListener'](_0x127b2d,_0x2ec8b7);};}exports['register']=function(_0x209b72){for(var _0x59820e=0x0,_0xdbb4fd=events[_0x2d77('0x3')];_0x59820e<_0xdbb4fd;_0x59820e++){var _0x3b0071=events[_0x59820e];var _0x3cacee=createListener('user:'+_0x3b0071,_0x209b72);UserEvents['on'](_0x3b0071,_0x3cacee);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 48b2cd7..b7b2959 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 _0x5a4a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x3a6efb,_0x51f0df){var _0x32cbad=function(_0x3b86af){while(--_0x3b86af){_0x3a6efb['push'](_0x3a6efb['shift']());}};_0x32cbad(++_0x51f0df);}(_0x5a4a,0xfc));var _0xa5a4=function(_0x149c25,_0x402f03){_0x149c25=_0x149c25-0x0;var _0x2455fc=_0x5a4a[_0x149c25];return _0x2455fc;};'use strict';var multer=require(_0xa5a4('0x0'));var util=require(_0xa5a4('0x1'));var path=require(_0xa5a4('0x2'));var timeout=require(_0xa5a4('0x3'));var express=require(_0xa5a4('0x4'));var router=express[_0xa5a4('0x5')]();var auth=require(_0xa5a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa5a4('0x7'));module[_0xa5a4('0x8')]=router; \ No newline at end of file +var _0x6b86=['path','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x6b86,0x199));var _0x66b8=function(_0x22f9e6,_0x55e049){_0x22f9e6=_0x22f9e6-0x0;var _0xb47c38=_0x6b86[_0x22f9e6];return _0xb47c38;};'use strict';var multer=require(_0x66b8('0x0'));var util=require('util');var path=require(_0x66b8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x66b8('0x2'));var config=require(_0x66b8('0x3'));module[_0x66b8('0x4')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 0f900bf..859f3fc 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x4c67b8,_0x571e13){var _0xbc26e=function(_0x16e9ac){while(--_0x16e9ac){_0x4c67b8['push'](_0x4c67b8['shift']());}};_0xbc26e(++_0x571e13);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0xca0aae,_0x73d195){var _0x52bf57=function(_0x2aa299){while(--_0x2aa299){_0xca0aae['push'](_0xca0aae['shift']());}};_0x52bf57(++_0x73d195);}(_0xe706,0xa3));var _0x6e70=function(_0x10b4d3,_0x12e69b){_0x10b4d3=_0x10b4d3-0x0;var _0x12615b=_0xe706[_0x10b4d3];return _0x12615b;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 67f6639..2d86872 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 _0x4643=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','api','moment'];(function(_0x3c0c92,_0x267969){var _0xe3859b=function(_0x4d38f2){while(--_0x4d38f2){_0x3c0c92['push'](_0x3c0c92['shift']());}};_0xe3859b(++_0x267969);}(_0x4643,0x116));var _0x3464=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4643[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3464('0x0'));var moment=require(_0x3464('0x1'));var BPromise=require(_0x3464('0x2'));var rp=require(_0x3464('0x3'));var fs=require('fs');var path=require(_0x3464('0x4'));var rimraf=require(_0x3464('0x5'));var config=require(_0x3464('0x6'));var attributes=require(_0x3464('0x7'));module['exports']=function(_0xe5c7a9,_0x479d6e){return _0xe5c7a9['define'](_0x3464('0x8'),attributes,{'tableName':_0x3464('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d76=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userChatQueue.attributes','define'];(function(_0x49e61c,_0xba133c){var _0x2d4d06=function(_0x514908){while(--_0x514908){_0x49e61c['push'](_0x49e61c['shift']());}};_0x2d4d06(++_0xba133c);}(_0x4d76,0xc2));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x64d7('0x0'));var util=require(_0x64d7('0x1'));var logger=require(_0x64d7('0x2'))(_0x64d7('0x3'));var moment=require(_0x64d7('0x4'));var BPromise=require(_0x64d7('0x5'));var rp=require(_0x64d7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x64d7('0x7'));var attributes=require(_0x64d7('0x8'));module['exports']=function(_0x57f99f,_0x366b4c){return _0x57f99f[_0x64d7('0x9')](_0x64d7('0xa'),attributes,{'tableName':_0x64d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index d1b6e6c..c2765b6 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 _0x38c8=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38c8,0xbe));var _0x838c=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x38c8[_0x4f3b2d];return _0x3dddfa;};'use strict';var _=require(_0x838c('0x0'));var util=require(_0x838c('0x1'));var moment=require('moment');var BPromise=require(_0x838c('0x2'));var rs=require(_0x838c('0x3'));var fs=require('fs');var Redis=require(_0x838c('0x4'));var db=require(_0x838c('0x5'))['db'];var utils=require(_0x838c('0x6'));var logger=require(_0x838c('0x7'))(_0x838c('0x8'));var config=require(_0x838c('0x9'));var jayson=require(_0x838c('0xa'));var client=jayson['client'][_0x838c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fce3c,_0x47a847,_0x55e833){return new BPromise(function(_0x3c6574,_0x30e656){return client['request'](_0x2fce3c,_0x55e833)[_0x838c('0xc')](function(_0x19157b){logger[_0x838c('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x47a847,_0x838c('0xe'));logger['debug'](_0x838c('0xf'),_0x47a847,_0x838c('0xe'),JSON[_0x838c('0x10')](_0x19157b));if(_0x19157b['error']){if(_0x19157b[_0x838c('0x11')]['code']===0x1f4){logger['error'](_0x838c('0x12'),_0x47a847,_0x19157b['error'][_0x838c('0x13')]);return _0x30e656(_0x19157b[_0x838c('0x11')][_0x838c('0x13')]);}logger[_0x838c('0x11')](_0x838c('0x12'),_0x47a847,_0x19157b[_0x838c('0x11')][_0x838c('0x13')]);return _0x3c6574(_0x19157b['error'][_0x838c('0x13')]);}else{logger[_0x838c('0xd')](_0x838c('0x12'),_0x47a847,_0x838c('0xe'));_0x3c6574(_0x19157b[_0x838c('0x14')][_0x838c('0x13')]);}})[_0x838c('0x15')](function(_0x34a9d){logger[_0x838c('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x47a847,_0x34a9d);_0x30e656(_0x34a9d);});});} \ No newline at end of file +var _0xd923=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x214183,_0xa5dbb5){var _0x1712d8=function(_0x215a1f){while(--_0x215a1f){_0x214183['push'](_0x214183['shift']());}};_0x1712d8(++_0xa5dbb5);}(_0xd923,0x72));var _0x3d92=function(_0x1bf18c,_0x25439f){_0x1bf18c=_0x1bf18c-0x0;var _0xe819c3=_0xd923[_0x1bf18c];return _0xe819c3;};'use strict';var _=require('lodash');var util=require(_0x3d92('0x0'));var moment=require('moment');var BPromise=require(_0x3d92('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d92('0x2'));var db=require(_0x3d92('0x3'))['db'];var utils=require(_0x3d92('0x4'));var logger=require('../../config/logger')(_0x3d92('0x5'));var config=require(_0x3d92('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d92('0x7')][_0x3d92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ebd6b,_0x10ec2c,_0x4effd7){return new BPromise(function(_0x4b6a13,_0x1ebe15){return client[_0x3d92('0x9')](_0x1ebd6b,_0x4effd7)[_0x3d92('0xa')](function(_0x5564e3){logger[_0x3d92('0xb')](_0x3d92('0xc'),_0x10ec2c,_0x3d92('0xd'));logger[_0x3d92('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10ec2c,_0x3d92('0xd'),JSON['stringify'](_0x5564e3));if(_0x5564e3[_0x3d92('0xf')]){if(_0x5564e3[_0x3d92('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x10ec2c,_0x5564e3[_0x3d92('0xf')][_0x3d92('0x10')]);return _0x1ebe15(_0x5564e3[_0x3d92('0xf')][_0x3d92('0x10')]);}logger[_0x3d92('0xf')](_0x3d92('0xc'),_0x10ec2c,_0x5564e3[_0x3d92('0xf')][_0x3d92('0x10')]);return _0x4b6a13(_0x5564e3[_0x3d92('0xf')]['message']);}else{logger[_0x3d92('0xb')](_0x3d92('0xc'),_0x10ec2c,_0x3d92('0xd'));_0x4b6a13(_0x5564e3['result']['message']);}})[_0x3d92('0x11')](function(_0x3a39d5){logger['error'](_0x3d92('0xc'),_0x10ec2c,_0x3a39d5);_0x1ebe15(_0x3a39d5);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 61728b9..0298881 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 _0xe308=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x458e08,_0x4a97b1){var _0x1c088d=function(_0x254632){while(--_0x254632){_0x458e08['push'](_0x458e08['shift']());}};_0x1c088d(++_0x4a97b1);}(_0xe308,0x110));var _0x8e30=function(_0x40d9ec,_0x142a71){_0x40d9ec=_0x40d9ec-0x0;var _0x4dc31d=_0xe308[_0x40d9ec];return _0x4dc31d;};'use strict';var multer=require('multer');var util=require(_0x8e30('0x0'));var path=require(_0x8e30('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e30('0x2'));var router=express[_0x8e30('0x3')]();var auth=require(_0x8e30('0x4'));var interaction=require(_0x8e30('0x5'));var config=require(_0x8e30('0x6'));module['exports']=router; \ No newline at end of file +var _0xecc0=['Router','../../components/auth/service','../../components/interaction/service','exports','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecc0,0x97));var _0x0ecc=function(_0x159922,_0x16f6da){_0x159922=_0x159922-0x0;var _0x2ed37c=_0xecc0[_0x159922];return _0x2ed37c;};'use strict';var multer=require('multer');var util=require(_0x0ecc('0x0'));var path=require('path');var timeout=require(_0x0ecc('0x1'));var express=require(_0x0ecc('0x2'));var router=express[_0x0ecc('0x3')]();var auth=require(_0x0ecc('0x4'));var interaction=require(_0x0ecc('0x5'));var config=require('../../config/environment');module[_0x0ecc('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 062d3d0..0672815 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 _0xb03e=['INTEGER','STRING','exports'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x583a0a,_0x2d1dd6){_0x583a0a=_0x583a0a-0x0;var _0x4e6481=_0xb03e[_0x583a0a];return _0x4e6481;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'penalty':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xeb03('0x2')]}}; \ No newline at end of file +var _0xefda=['sequelize','INTEGER','STRING'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xefda,0x96));var _0xaefd=function(_0xe8a458,_0x55d3d6){_0xe8a458=_0xe8a458-0x0;var _0x468347=_0xefda[_0xe8a458];return _0x468347;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaefd('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9361b05..2a2ac9a 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 _0x5f2f=['bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x394cdf,_0xb53aa5){var _0x3b553f=function(_0x40b7f5){while(--_0x40b7f5){_0x394cdf['push'](_0x394cdf['shift']());}};_0x3b553f(++_0xb53aa5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x102539,_0x18d10a){_0x102539=_0x102539-0x0;var _0x4e3c3d=_0x5f2f[_0x102539];return _0x4e3c3d;};'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 +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xb10b,0x12a));var _0xbb10=function(_0x201211,_0x2e2788){_0x201211=_0x201211-0x0;var _0x3641da=_0xb10b[_0x201211];return _0x3641da;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 5c4d458..82d467f 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 _0xaaa6=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xaaa6,0xfd));var _0x6aaa=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0xaaa6[_0x1b8f5a];return _0x594189;};'use strict';var _=require(_0x6aaa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6aaa('0x1'));var rs=require(_0x6aaa('0x2'));var fs=require('fs');var Redis=require(_0x6aaa('0x3'));var db=require(_0x6aaa('0x4'))['db'];var utils=require(_0x6aaa('0x5'));var logger=require(_0x6aaa('0x6'))(_0x6aaa('0x7'));var config=require(_0x6aaa('0x8'));var jayson=require(_0x6aaa('0x9'));var client=jayson[_0x6aaa('0xa')][_0x6aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ec110,_0x35046d,_0x159130){return new BPromise(function(_0xb0a7aa,_0x129a77){return client['request'](_0x5ec110,_0x159130)[_0x6aaa('0xc')](function(_0x5834ad){logger['info'](_0x6aaa('0xd'),_0x35046d,'request\x20sent');logger[_0x6aaa('0xe')](_0x6aaa('0xf'),_0x35046d,_0x6aaa('0x10'),JSON[_0x6aaa('0x11')](_0x5834ad));if(_0x5834ad['error']){if(_0x5834ad[_0x6aaa('0x12')][_0x6aaa('0x13')]===0x1f4){logger[_0x6aaa('0x12')](_0x6aaa('0xd'),_0x35046d,_0x5834ad['error']['message']);return _0x129a77(_0x5834ad['error'][_0x6aaa('0x14')]);}logger[_0x6aaa('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x35046d,_0x5834ad['error'][_0x6aaa('0x14')]);return _0xb0a7aa(_0x5834ad[_0x6aaa('0x12')][_0x6aaa('0x14')]);}else{logger[_0x6aaa('0x15')]('UserFaxQueue,\x20%s,\x20%s',_0x35046d,_0x6aaa('0x10'));_0xb0a7aa(_0x5834ad[_0x6aaa('0x16')][_0x6aaa('0x14')]);}})['catch'](function(_0x5e2419){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x35046d,_0x5e2419);_0x129a77(_0x5e2419);});});} \ No newline at end of file +var _0x2b30=['UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x50c227,_0x55ffdc){var _0x1c51f3=function(_0x2c1ff2){while(--_0x2c1ff2){_0x50c227['push'](_0x50c227['shift']());}};_0x1c51f3(++_0x55ffdc);}(_0x2b30,0x171));var _0x02b3=function(_0x2e8525,_0x281b40){_0x2e8525=_0x2e8525-0x0;var _0x42fc54=_0x2b30[_0x2e8525];return _0x42fc54;};'use strict';var _=require(_0x02b3('0x0'));var util=require(_0x02b3('0x1'));var moment=require('moment');var BPromise=require(_0x02b3('0x2'));var rs=require(_0x02b3('0x3'));var fs=require('fs');var Redis=require(_0x02b3('0x4'));var db=require(_0x02b3('0x5'))['db'];var utils=require(_0x02b3('0x6'));var logger=require(_0x02b3('0x7'))('rpc');var config=require(_0x02b3('0x8'));var jayson=require(_0x02b3('0x9'));var client=jayson[_0x02b3('0xa')][_0x02b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a491,_0x5098ef,_0x2544d5){return new BPromise(function(_0x260a03,_0x457a16){return client[_0x02b3('0xc')](_0x36a491,_0x2544d5)[_0x02b3('0xd')](function(_0x7b7ddb){logger[_0x02b3('0xe')](_0x02b3('0xf'),_0x5098ef,'request\x20sent');logger[_0x02b3('0x10')](_0x02b3('0x11'),_0x5098ef,_0x02b3('0x12'),JSON['stringify'](_0x7b7ddb));if(_0x7b7ddb[_0x02b3('0x13')]){if(_0x7b7ddb[_0x02b3('0x13')][_0x02b3('0x14')]===0x1f4){logger['error'](_0x02b3('0xf'),_0x5098ef,_0x7b7ddb[_0x02b3('0x13')][_0x02b3('0x15')]);return _0x457a16(_0x7b7ddb['error']['message']);}logger[_0x02b3('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x5098ef,_0x7b7ddb['error'][_0x02b3('0x15')]);return _0x260a03(_0x7b7ddb[_0x02b3('0x13')][_0x02b3('0x15')]);}else{logger[_0x02b3('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5098ef,_0x02b3('0x12'));_0x260a03(_0x7b7ddb[_0x02b3('0x16')]['message']);}})[_0x02b3('0x17')](function(_0x54096e){logger[_0x02b3('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x5098ef,_0x54096e);_0x457a16(_0x54096e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 03d5a66..cf003cc 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 _0xa398=['../../components/interaction/service','exports','connect-timeout','express','Router'];(function(_0x342782,_0x4236e0){var _0xadb50c=function(_0x33ff6f){while(--_0x33ff6f){_0x342782['push'](_0x342782['shift']());}};_0xadb50c(++_0x4236e0);}(_0xa398,0xbb));var _0x8a39=function(_0x206290,_0x35fbd7){_0x206290=_0x206290-0x0;var _0x40373c=_0xa398[_0x206290];return _0x40373c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8a39('0x0'));var express=require(_0x8a39('0x1'));var router=express[_0x8a39('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8a39('0x3'));var config=require('../../config/environment');module[_0x8a39('0x4')]=router; \ No newline at end of file +var _0x48f4=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cbe53,_0x2acb6e){var _0x1323fc=function(_0x32a816){while(--_0x32a816){_0x1cbe53['push'](_0x1cbe53['shift']());}};_0x1323fc(++_0x2acb6e);}(_0x48f4,0x64));var _0x448f=function(_0x446789,_0x40aa74){_0x446789=_0x446789-0x0;var _0x534e45=_0x48f4[_0x446789];return _0x534e45;};'use strict';var multer=require(_0x448f('0x0'));var util=require('util');var path=require(_0x448f('0x1'));var timeout=require(_0x448f('0x2'));var express=require(_0x448f('0x3'));var router=express[_0x448f('0x4')]();var auth=require(_0x448f('0x5'));var interaction=require(_0x448f('0x6'));var config=require(_0x448f('0x7'));module[_0x448f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0a55b64..1cef40b 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 _0xd8b0=['exports','sequelize'];(function(_0x2967b4,_0x9b5a9b){var _0x483322=function(_0x4652d0){while(--_0x4652d0){_0x2967b4['push'](_0x2967b4['shift']());}};_0x483322(++_0x9b5a9b);}(_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 _0xb10b=['sequelize','INTEGER'];(function(_0x586a96,_0x4d4778){var _0x1b3b3c=function(_0x27e970){while(--_0x27e970){_0x586a96['push'](_0x586a96['shift']());}};_0x1b3b3c(++_0x4d4778);}(_0xb10b,0x12a));var _0xbb10=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0xb10b[_0x51b80a];return _0x22fdf0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a09f577..ddc7753 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(_0x27ac26,_0x68ae52){var _0x395e51=function(_0x1a4584){while(--_0x1a4584){_0x27ac26['push'](_0x27ac26['shift']());}};_0x395e51(++_0x68ae52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x4358eb,_0x285726){var _0x5399c3=function(_0x2ebbdb){while(--_0x2ebbdb){_0x4358eb['push'](_0x4358eb['shift']());}};_0x5399c3(++_0x285726);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 9a14445..d82624f 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 _0xdca7=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','request','then','info'];(function(_0x55dd5c,_0x2e550f){var _0x281104=function(_0x46c769){while(--_0x46c769){_0x55dd5c['push'](_0x55dd5c['shift']());}};_0x281104(++_0x2e550f);}(_0xdca7,0xe6));var _0x7dca=function(_0x3ec52a,_0x1da33e){_0x3ec52a=_0x3ec52a-0x0;var _0x1945f7=_0xdca7[_0x3ec52a];return _0x1945f7;};'use strict';var _=require(_0x7dca('0x0'));var util=require('util');var moment=require(_0x7dca('0x1'));var BPromise=require(_0x7dca('0x2'));var rs=require(_0x7dca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dca('0x4'))['db'];var utils=require(_0x7dca('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7dca('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbc4387,_0x4cab84,_0x5a27cc){return new BPromise(function(_0x38cb81,_0x189afd){return client[_0x7dca('0x7')](_0xbc4387,_0x5a27cc)[_0x7dca('0x8')](function(_0x323d54){logger[_0x7dca('0x9')](_0x7dca('0xa'),_0x4cab84,_0x7dca('0xb'));logger[_0x7dca('0xc')](_0x7dca('0xd'),_0x4cab84,_0x7dca('0xb'),JSON[_0x7dca('0xe')](_0x323d54));if(_0x323d54['error']){if(_0x323d54[_0x7dca('0xf')][_0x7dca('0x10')]===0x1f4){logger['error'](_0x7dca('0xa'),_0x4cab84,_0x323d54[_0x7dca('0xf')][_0x7dca('0x11')]);return _0x189afd(_0x323d54['error']['message']);}logger[_0x7dca('0xf')](_0x7dca('0xa'),_0x4cab84,_0x323d54[_0x7dca('0xf')][_0x7dca('0x11')]);return _0x38cb81(_0x323d54[_0x7dca('0xf')][_0x7dca('0x11')]);}else{logger[_0x7dca('0x9')](_0x7dca('0xa'),_0x4cab84,_0x7dca('0xb'));_0x38cb81(_0x323d54[_0x7dca('0x12')][_0x7dca('0x11')]);}})[_0x7dca('0x13')](function(_0x835781){logger[_0x7dca('0xf')](_0x7dca('0xa'),_0x4cab84,_0x835781);_0x189afd(_0x835781);});});} \ No newline at end of file +var _0x3c2a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x40a509,_0x58018f){_0x40a509=_0x40a509-0x0;var _0x45d0be=_0x3c2a[_0x40a509];return _0x45d0be;};'use strict';var _=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var moment=require('moment');var BPromise=require(_0xa3c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3c2('0x3'));var db=require(_0xa3c2('0x4'))['db'];var utils=require(_0xa3c2('0x5'));var logger=require(_0xa3c2('0x6'))(_0xa3c2('0x7'));var config=require(_0xa3c2('0x8'));var jayson=require(_0xa3c2('0x9'));var client=jayson[_0xa3c2('0xa')][_0xa3c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113c67,_0xe1037d,_0x1975f3){return new BPromise(function(_0x1d8df4,_0x1ef2d3){return client['request'](_0x113c67,_0x1975f3)['then'](function(_0x23497b){logger[_0xa3c2('0xc')](_0xa3c2('0xd'),_0xe1037d,_0xa3c2('0xe'));logger[_0xa3c2('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0xe1037d,_0xa3c2('0xe'),JSON['stringify'](_0x23497b));if(_0x23497b[_0xa3c2('0x10')]){if(_0x23497b['error']['code']===0x1f4){logger[_0xa3c2('0x10')](_0xa3c2('0xd'),_0xe1037d,_0x23497b['error'][_0xa3c2('0x11')]);return _0x1ef2d3(_0x23497b[_0xa3c2('0x10')][_0xa3c2('0x11')]);}logger[_0xa3c2('0x10')](_0xa3c2('0xd'),_0xe1037d,_0x23497b[_0xa3c2('0x10')]['message']);return _0x1d8df4(_0x23497b[_0xa3c2('0x10')][_0xa3c2('0x11')]);}else{logger[_0xa3c2('0xc')](_0xa3c2('0xd'),_0xe1037d,_0xa3c2('0xe'));_0x1d8df4(_0x23497b[_0xa3c2('0x12')][_0xa3c2('0x11')]);}})[_0xa3c2('0x13')](function(_0x1d544f){logger[_0xa3c2('0x10')](_0xa3c2('0xd'),_0xe1037d,_0x1d544f);_0x1ef2d3(_0x1d544f);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 58500db..d0a95b0 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 _0xa210=['path','../../components/auth/service','../../config/environment','exports','util'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0xa210,0xe5));var _0x0a21=function(_0x37215a,_0x5f0f9d){_0x37215a=_0x37215a-0x0;var _0x2e46f8=_0xa210[_0x37215a];return _0x2e46f8;};'use strict';var multer=require('multer');var util=require(_0x0a21('0x0'));var path=require(_0x0a21('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0a21('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x0a21('0x3'));module[_0x0a21('0x4')]=router; \ No newline at end of file +var _0x31dd=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x4eca83,_0x46750c){var _0x3ec0cd=function(_0x17e9d9){while(--_0x17e9d9){_0x4eca83['push'](_0x4eca83['shift']());}};_0x3ec0cd(++_0x46750c);}(_0x31dd,0x175));var _0xd31d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd31d('0x0'));var path=require(_0xd31d('0x1'));var timeout=require(_0xd31d('0x2'));var express=require(_0xd31d('0x3'));var router=express['Router']();var auth=require(_0xd31d('0x4'));var interaction=require(_0xd31d('0x5'));var config=require(_0xd31d('0x6'));module[_0xd31d('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 61d51c9..0849348 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 _0xbaf0=['exports','INTEGER'];(function(_0x101094,_0x5d3900){var _0x3d6d75=function(_0x10aa02){while(--_0x10aa02){_0x101094['push'](_0x101094['shift']());}};_0x3d6d75(++_0x5d3900);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x43d51a,_0x16f288){var _0x3fc5f3=function(_0x5b4fa6){while(--_0x5b4fa6){_0x43d51a['push'](_0x43d51a['shift']());}};_0x3fc5f3(++_0x16f288);}(_0xb10b,0x12a));var _0xbb10=function(_0x304bf7,_0x4fcafc){_0x304bf7=_0x304bf7-0x0;var _0x5036cd=_0xb10b[_0x304bf7];return _0x5036cd;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 9686035..803726a 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 _0x67e4=['api','moment','bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x1a68dd,_0x168fdd){var _0x564bc7=function(_0x36b497){while(--_0x36b497){_0x1a68dd['push'](_0x1a68dd['shift']());}};_0x564bc7(++_0x168fdd);}(_0x67e4,0x126));var _0x467e=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x67e4[_0x548627];return _0x844a84;};'use strict';var _=require(_0x467e('0x0'));var util=require(_0x467e('0x1'));var logger=require(_0x467e('0x2'))(_0x467e('0x3'));var moment=require(_0x467e('0x4'));var BPromise=require(_0x467e('0x5'));var rp=require(_0x467e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x467e('0x7'));var attributes=require(_0x467e('0x8'));module[_0x467e('0x9')]=function(_0x14c6c6,_0x4d2344){return _0x14c6c6['define']('UserOpenchannelQueue',attributes,{'tableName':_0x467e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4cc=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x54bdf9,_0x1d58a5){var _0x447729=function(_0x378d07){while(--_0x378d07){_0x54bdf9['push'](_0x54bdf9['shift']());}};_0x447729(++_0x1d58a5);}(_0xf4cc,0x69));var _0xcf4c=function(_0x101070,_0x4b6a91){_0x101070=_0x101070-0x0;var _0x4aac36=_0xf4cc[_0x101070];return _0x4aac36;};'use strict';var _=require(_0xcf4c('0x0'));var util=require(_0xcf4c('0x1'));var logger=require(_0xcf4c('0x2'))(_0xcf4c('0x3'));var moment=require(_0xcf4c('0x4'));var BPromise=require(_0xcf4c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf4c('0x6'));var rimraf=require(_0xcf4c('0x7'));var config=require(_0xcf4c('0x8'));var attributes=require(_0xcf4c('0x9'));module[_0xcf4c('0xa')]=function(_0x5c3160,_0x5444b9){return _0x5c3160[_0xcf4c('0xb')](_0xcf4c('0xc'),attributes,{'tableName':_0xcf4c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8723867..627bb02 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 _0x3254=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3254,0x1c8));var _0x4325=function(_0x129e1c,_0x3bab40){_0x129e1c=_0x129e1c-0x0;var _0x56b43a=_0x3254[_0x129e1c];return _0x56b43a;};'use strict';var _=require(_0x4325('0x0'));var util=require(_0x4325('0x1'));var moment=require(_0x4325('0x2'));var BPromise=require(_0x4325('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4325('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4325('0x5'));var logger=require(_0x4325('0x6'))(_0x4325('0x7'));var config=require(_0x4325('0x8'));var jayson=require(_0x4325('0x9'));var client=jayson[_0x4325('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x293f42,_0x34327b,_0x316da7){return new BPromise(function(_0x3bd4eb,_0x2bb065){return client[_0x4325('0xb')](_0x293f42,_0x316da7)[_0x4325('0xc')](function(_0x5310af){logger[_0x4325('0xd')](_0x4325('0xe'),_0x34327b,_0x4325('0xf'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x34327b,'request\x20sent',JSON[_0x4325('0x10')](_0x5310af));if(_0x5310af[_0x4325('0x11')]){if(_0x5310af['error'][_0x4325('0x12')]===0x1f4){logger[_0x4325('0x11')](_0x4325('0xe'),_0x34327b,_0x5310af['error'][_0x4325('0x13')]);return _0x2bb065(_0x5310af[_0x4325('0x11')][_0x4325('0x13')]);}logger[_0x4325('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34327b,_0x5310af[_0x4325('0x11')]['message']);return _0x3bd4eb(_0x5310af[_0x4325('0x11')][_0x4325('0x13')]);}else{logger['info'](_0x4325('0xe'),_0x34327b,_0x4325('0xf'));_0x3bd4eb(_0x5310af[_0x4325('0x14')]['message']);}})[_0x4325('0x15')](function(_0x272522){logger[_0x4325('0x11')](_0x4325('0xe'),_0x34327b,_0x272522);_0x2bb065(_0x272522);});});} \ No newline at end of file +var _0x22b6=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xfb6d6,_0x284cde){var _0xd46966=function(_0x3c6a0e){while(--_0x3c6a0e){_0xfb6d6['push'](_0xfb6d6['shift']());}};_0xd46966(++_0x284cde);}(_0x22b6,0xc7));var _0x622b=function(_0x4b9b58,_0x1d96a8){_0x4b9b58=_0x4b9b58-0x0;var _0x440d29=_0x22b6[_0x4b9b58];return _0x440d29;};'use strict';var _=require(_0x622b('0x0'));var util=require(_0x622b('0x1'));var moment=require(_0x622b('0x2'));var BPromise=require('bluebird');var rs=require(_0x622b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x622b('0x4'))['db'];var utils=require(_0x622b('0x5'));var logger=require(_0x622b('0x6'))(_0x622b('0x7'));var config=require(_0x622b('0x8'));var jayson=require(_0x622b('0x9'));var client=jayson[_0x622b('0xa')][_0x622b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5181e9,_0x470dd9,_0x20dc39){return new BPromise(function(_0x5b0345,_0x298066){return client[_0x622b('0xc')](_0x5181e9,_0x20dc39)[_0x622b('0xd')](function(_0x464682){logger[_0x622b('0xe')](_0x622b('0xf'),_0x470dd9,'request\x20sent');logger[_0x622b('0x10')](_0x622b('0x11'),_0x470dd9,_0x622b('0x12'),JSON[_0x622b('0x13')](_0x464682));if(_0x464682[_0x622b('0x14')]){if(_0x464682[_0x622b('0x14')][_0x622b('0x15')]===0x1f4){logger[_0x622b('0x14')](_0x622b('0xf'),_0x470dd9,_0x464682[_0x622b('0x14')][_0x622b('0x16')]);return _0x298066(_0x464682['error'][_0x622b('0x16')]);}logger['error'](_0x622b('0xf'),_0x470dd9,_0x464682[_0x622b('0x14')]['message']);return _0x5b0345(_0x464682[_0x622b('0x14')][_0x622b('0x16')]);}else{logger['info'](_0x622b('0xf'),_0x470dd9,_0x622b('0x12'));_0x5b0345(_0x464682[_0x622b('0x17')][_0x622b('0x16')]);}})[_0x622b('0x18')](function(_0xe24740){logger[_0x622b('0x14')](_0x622b('0xf'),_0x470dd9,_0xe24740);_0x298066(_0xe24740);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ed166e6..6c56d44 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 _0x16fd=['show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','put','update','delete','removeSections','removeResources','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/:id'];(function(_0x2cb7eb,_0x34817d){var _0x38a294=function(_0x384a02){while(--_0x384a02){_0x2cb7eb['push'](_0x2cb7eb['shift']());}};_0x38a294(++_0x34817d);}(_0x16fd,0x194));var _0xd16f=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0x16fd[_0x4320ce];return _0x537dae;};'use strict';var multer=require(_0xd16f('0x0'));var util=require('util');var path=require(_0xd16f('0x1'));var timeout=require('connect-timeout');var express=require(_0xd16f('0x2'));var router=express[_0xd16f('0x3')]();var auth=require(_0xd16f('0x4'));var interaction=require(_0xd16f('0x5'));var config=require(_0xd16f('0x6'));var controller=require(_0xd16f('0x7'));router[_0xd16f('0x8')]('/',auth[_0xd16f('0x9')](),controller[_0xd16f('0xa')]);router[_0xd16f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd16f('0x8')](_0xd16f('0xb'),auth[_0xd16f('0x9')](),controller[_0xd16f('0xc')]);router[_0xd16f('0x8')](_0xd16f('0xd'),auth[_0xd16f('0x9')](),controller[_0xd16f('0xe')]);router[_0xd16f('0x8')](_0xd16f('0xf'),auth['isAuthenticated'](),controller[_0xd16f('0x10')]);router[_0xd16f('0x11')]('/',auth[_0xd16f('0x9')](),controller['create']);router[_0xd16f('0x11')](_0xd16f('0x12'),auth[_0xd16f('0x9')](),controller[_0xd16f('0x13')]);router[_0xd16f('0x11')]('/:id/sections',auth[_0xd16f('0x9')](),controller[_0xd16f('0x14')]);router[_0xd16f('0x11')](_0xd16f('0xf'),auth['isAuthenticated'](),controller['addResources']);router[_0xd16f('0x15')](_0xd16f('0xb'),auth['isAuthenticated'](),controller[_0xd16f('0x16')]);router[_0xd16f('0x17')](_0xd16f('0xb'),auth[_0xd16f('0x9')](),controller['destroy']);router['delete'](_0xd16f('0xd'),auth['isAuthenticated'](),controller[_0xd16f('0x18')]);router['delete'](_0xd16f('0xf'),auth[_0xd16f('0x9')](),controller[_0xd16f('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7554=['describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','delete','destroy','removeSections','removeResources','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated'];(function(_0x53acc0,_0x488d85){var _0x5240db=function(_0x44b9be){while(--_0x44b9be){_0x53acc0['push'](_0x53acc0['shift']());}};_0x5240db(++_0x488d85);}(_0x7554,0x199));var _0x4755=function(_0x1174f2,_0x14ae38){_0x1174f2=_0x1174f2-0x0;var _0x1de599=_0x7554[_0x1174f2];return _0x1de599;};'use strict';var multer=require(_0x4755('0x0'));var util=require('util');var path=require(_0x4755('0x1'));var timeout=require(_0x4755('0x2'));var express=require(_0x4755('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4755('0x4'));var config=require(_0x4755('0x5'));var controller=require(_0x4755('0x6'));router[_0x4755('0x7')]('/',auth['isAuthenticated'](),controller[_0x4755('0x8')]);router[_0x4755('0x7')](_0x4755('0x9'),auth[_0x4755('0xa')](),controller[_0x4755('0xb')]);router[_0x4755('0x7')](_0x4755('0xc'),auth[_0x4755('0xa')](),controller[_0x4755('0xd')]);router[_0x4755('0x7')](_0x4755('0xe'),auth['isAuthenticated'](),controller[_0x4755('0xf')]);router[_0x4755('0x7')](_0x4755('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0x4755('0x11')]('/',auth[_0x4755('0xa')](),controller[_0x4755('0x12')]);router[_0x4755('0x11')](_0x4755('0x13'),auth['isAuthenticated'](),controller[_0x4755('0x14')]);router[_0x4755('0x11')](_0x4755('0xe'),auth[_0x4755('0xa')](),controller[_0x4755('0x15')]);router['post'](_0x4755('0x10'),auth[_0x4755('0xa')](),controller[_0x4755('0x16')]);router[_0x4755('0x17')]('/:id',auth[_0x4755('0xa')](),controller['update']);router[_0x4755('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x4755('0x19')]);router[_0x4755('0x18')](_0x4755('0xe'),auth[_0x4755('0xa')](),controller[_0x4755('0x1a')]);router[_0x4755('0x18')]('/:id/resources',auth[_0x4755('0xa')](),controller[_0x4755('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5dcf894..611f7d7 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 _0xd523=['setDataValue','crudPermissions','getDataValue','sequelize','exports','STRING','name'];(function(_0x482ac6,_0x182c1d){var _0x15b85f=function(_0xce6d67){while(--_0xce6d67){_0x482ac6['push'](_0x482ac6['shift']());}};_0x15b85f(++_0x182c1d);}(_0xd523,0x153));var _0x3d52=function(_0x3c1da7,_0x1a53c9){_0x3c1da7=_0x3c1da7-0x0;var _0x3e621d=_0xd523[_0x3c1da7];return _0x3e621d;};'use strict';var Sequelize=require(_0x3d52('0x0'));module[_0x3d52('0x1')]={'name':{'type':Sequelize[_0x3d52('0x2')],'allowNull':![],'unique':_0x3d52('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x20ccf9){this[_0x3d52('0x4')](_0x3d52('0x5'),_0x20ccf9?_0x20ccf9['join'](''):[]);},'get':function(){return this[_0x3d52('0x6')](_0x3d52('0x5'))?this[_0x3d52('0x6')](_0x3d52('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xa0ed=['join','getDataValue','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xa0ed,0x1a2));var _0xda0e=function(_0x41882a,_0x1a450b){_0x41882a=_0x41882a-0x0;var _0x278068=_0xa0ed[_0x41882a];return _0x278068;};'use strict';var Sequelize=require(_0xda0e('0x0'));module[_0xda0e('0x1')]={'name':{'type':Sequelize[_0xda0e('0x2')],'allowNull':![],'unique':_0xda0e('0x3')},'crudPermissions':{'type':Sequelize[_0xda0e('0x2')],'set':function(_0xf3eb4d){this[_0xda0e('0x4')](_0xda0e('0x5'),_0xf3eb4d?_0xf3eb4d[_0xda0e('0x6')](''):[]);},'get':function(){return this[_0xda0e('0x7')](_0xda0e('0x5'))?this['getDataValue'](_0xda0e('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xda0e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 6caf659..cc0fff8 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 _0x6e26=['CmContact','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','role','telephone','queue','inbound','VoiceQueue','musiconholds','chanspies','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','clone','params','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','findOne','all','union','hasOwnProperty','key','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom'];(function(_0x35d64e,_0x131178){var _0x61efa=function(_0x2ecb7a){while(--_0x2ecb7a){_0x35d64e['push'](_0x35d64e['shift']());}};_0x61efa(++_0x131178);}(_0x6e26,0x167));var _0x66e2=function(_0x244fb0,_0x41188e){_0x244fb0=_0x244fb0-0x0;var _0x19c25b=_0x6e26[_0x244fb0];return _0x19c25b;};'use strict';var pdf=require(_0x66e2('0x0'));var emlformat=require(_0x66e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x66e2('0x2'));var jsonpatch=require(_0x66e2('0x3'));var rp=require('request-promise');var moment=require(_0x66e2('0x4'));var BPromise=require(_0x66e2('0x5'));var Mustache=require(_0x66e2('0x6'));var util=require(_0x66e2('0x7'));var path=require(_0x66e2('0x8'));var sox=require(_0x66e2('0x9'));var csv=require(_0x66e2('0xa'));var ejs=require(_0x66e2('0xb'));var fs=require('fs');var _=require(_0x66e2('0xc'));var squel=require(_0x66e2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66e2('0xe'));var toCsv=require(_0x66e2('0xa'));var querystring=require(_0x66e2('0xf'));var Papa=require('papaparse');var Redis=require(_0x66e2('0x10'));var authService=require(_0x66e2('0x11'));var qs=require(_0x66e2('0x12'));var as=require(_0x66e2('0x13'));var hardwareService=require(_0x66e2('0x14'));var logger=require(_0x66e2('0x15'))('api');var utils=require(_0x66e2('0x16'));var config=require(_0x66e2('0x17'));var db=require(_0x66e2('0x18'))['db'];config['redis']=_['defaults'](config[_0x66e2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x66e2('0x1a'))(new Redis(config[_0x66e2('0x19')]));require(_0x66e2('0x1b'))[_0x66e2('0x1c')](socket);function respondWithStatusCode(_0x3532a8,_0xa82e5d){_0xa82e5d=_0xa82e5d||0xcc;return function(_0x5348c2){if(_0x5348c2){return _0x3532a8['sendStatus'](_0xa82e5d);}return _0x3532a8[_0x66e2('0x1d')](_0xa82e5d)['end']();};}function respondWithResult(_0x46e1a7,_0x5c71b8){_0x5c71b8=_0x5c71b8||0xc8;return function(_0x2fa72b){if(_0x2fa72b){return _0x46e1a7[_0x66e2('0x1d')](_0x5c71b8)[_0x66e2('0x1e')](_0x2fa72b);}};}function respondWithFilteredResult(_0x425238,_0x361031){return function(_0x3fa025){if(_0x3fa025){var _0x535f44=_0x3fa025[_0x66e2('0x1f')],_0x3226c0=_0x361031[_0x66e2('0x20')],_0x531630=_0x361031[_0x66e2('0x20')]+_0x361031[_0x66e2('0x21')],_0x10b1cb;if(_0x531630>=_0x535f44){_0x531630=_0x535f44;_0x10b1cb=0xc8;}else{_0x10b1cb=0xce;}_0x425238['status'](_0x10b1cb);return _0x425238[_0x66e2('0x22')](_0x66e2('0x23'),_0x3226c0+'-'+_0x531630+'/'+_0x535f44)[_0x66e2('0x1e')](_0x3fa025);}return null;};}function patchUpdates(_0x43e619){return function(_0x410b48){try{jsonpatch['apply'](_0x410b48,_0x43e619,!![]);}catch(_0x3db5b1){return BPromise[_0x66e2('0x24')](_0x3db5b1);}return _0x410b48[_0x66e2('0x25')]();};}function saveUpdates(_0x6101b1,_0x2086dc){return function(_0x344a4e){if(_0x344a4e){return _0x344a4e[_0x66e2('0x26')](_0x6101b1)[_0x66e2('0x27')](function(_0x4f9b7d){return _0x4f9b7d;});}return null;};}function removeEntity(_0x28b4ab,_0x292eb7){return function(_0x24708d){if(_0x24708d){return _0x24708d['destroy']()['then'](function(){_0x28b4ab[_0x66e2('0x1d')](0xcc)[_0x66e2('0x28')]();});}};}function handleEntityNotFound(_0x5af382,_0x2a9568){return function(_0xd23eac){if(!_0xd23eac){_0x5af382['sendStatus'](0x194);}return _0xd23eac;};}function handleError(_0x5158a2,_0xc0e15c){_0xc0e15c=_0xc0e15c||0x1f4;return function(_0x4db9e2){logger[_0x66e2('0x29')](_0x4db9e2[_0x66e2('0x2a')]);if(_0x4db9e2[_0x66e2('0x2b')]){delete _0x4db9e2[_0x66e2('0x2b')];}_0x5158a2[_0x66e2('0x1d')](_0xc0e15c)[_0x66e2('0x2c')](_0x4db9e2);};}exports['index']=function(_0x5a5576,_0x3197cd){var _0x7867dd={},_0x5279e8={},_0xdcf02={'count':0x0,'rows':[]};var _0x182087=_[_0x66e2('0x2d')](db[_0x66e2('0x2e')][_0x66e2('0x2f')],function(_0x2e0b97){return{'name':_0x2e0b97[_0x66e2('0x30')],'type':_0x2e0b97[_0x66e2('0x31')]['key']};});_0x5279e8[_0x66e2('0x32')]=_[_0x66e2('0x2d')](_0x182087,_0x66e2('0x2b'));_0x5279e8['query']=_[_0x66e2('0x33')](_0x5a5576[_0x66e2('0x34')]);_0x5279e8[_0x66e2('0x35')]=_[_0x66e2('0x36')](_0x5279e8[_0x66e2('0x32')],_0x5279e8[_0x66e2('0x34')]);_0x7867dd[_0x66e2('0x37')]=_[_0x66e2('0x36')](_0x5279e8['model'],qs['fields'](_0x5a5576['query'][_0x66e2('0x38')]));_0x7867dd[_0x66e2('0x37')]=_0x7867dd[_0x66e2('0x37')][_0x66e2('0x39')]?_0x7867dd[_0x66e2('0x37')]:_0x5279e8['model'];if(!_0x5a5576['query']['hasOwnProperty'](_0x66e2('0x3a'))){_0x7867dd[_0x66e2('0x21')]=qs[_0x66e2('0x21')](_0x5a5576[_0x66e2('0x34')][_0x66e2('0x21')]);_0x7867dd[_0x66e2('0x20')]=qs[_0x66e2('0x20')](_0x5a5576[_0x66e2('0x34')][_0x66e2('0x20')]);}_0x7867dd[_0x66e2('0x3b')]=qs['sort'](_0x5a5576[_0x66e2('0x34')][_0x66e2('0x3c')]);_0x7867dd[_0x66e2('0x3d')]=qs[_0x66e2('0x35')](_['pick'](_0x5a5576[_0x66e2('0x34')],_0x5279e8[_0x66e2('0x35')]),_0x182087);if(_0x5a5576[_0x66e2('0x34')][_0x66e2('0x3e')]){_0x7867dd[_0x66e2('0x3d')]=_[_0x66e2('0x3f')](_0x7867dd[_0x66e2('0x3d')],{'$or':_[_0x66e2('0x2d')](_0x182087,function(_0x39380c){if(_0x39380c[_0x66e2('0x31')]!=='VIRTUAL'){var _0x1bcd4a={};_0x1bcd4a[_0x39380c[_0x66e2('0x2b')]]={'$like':'%'+_0x5a5576[_0x66e2('0x34')][_0x66e2('0x3e')]+'%'};return _0x1bcd4a;}})});}_0x7867dd=_['merge']({},_0x7867dd,_0x5a5576[_0x66e2('0x40')]);var _0xc869e={'where':_0x7867dd[_0x66e2('0x3d')]};return db['UserProfile'][_0x66e2('0x1f')](_0xc869e)[_0x66e2('0x27')](function(_0x31167a){_0xdcf02['count']=_0x31167a;if(_0x5a5576[_0x66e2('0x34')][_0x66e2('0x41')]){_0x7867dd[_0x66e2('0x42')]=[{'all':!![]}];}return db[_0x66e2('0x2e')]['findAll'](_0x7867dd);})[_0x66e2('0x27')](function(_0x3ec782){_0xdcf02[_0x66e2('0x43')]=_0x3ec782;return _0xdcf02;})[_0x66e2('0x27')](respondWithFilteredResult(_0x3197cd,_0x7867dd))[_0x66e2('0x44')](handleError(_0x3197cd,null));};exports[_0x66e2('0x45')]=function(_0x558398,_0x53c113){var _0x29ec74={'raw':![],'where':{'id':_0x558398['params']['id']}},_0x45a41d={};_0x45a41d[_0x66e2('0x32')]=_[_0x66e2('0x33')](db['UserProfile'][_0x66e2('0x2f')]);_0x45a41d[_0x66e2('0x34')]=_[_0x66e2('0x33')](_0x558398['query']);_0x45a41d['filters']=_['intersection'](_0x45a41d[_0x66e2('0x32')],_0x45a41d[_0x66e2('0x34')]);_0x29ec74[_0x66e2('0x37')]=_[_0x66e2('0x36')](_0x45a41d['model'],qs[_0x66e2('0x38')](_0x558398[_0x66e2('0x34')][_0x66e2('0x38')]));_0x29ec74[_0x66e2('0x37')]=_0x29ec74[_0x66e2('0x37')][_0x66e2('0x39')]?_0x29ec74[_0x66e2('0x37')]:_0x45a41d['model'];if(_0x558398['query']['includeAll']){_0x29ec74[_0x66e2('0x42')]=[{'all':!![]}];}_0x29ec74=_[_0x66e2('0x3f')]({},_0x29ec74,_0x558398[_0x66e2('0x40')]);return db[_0x66e2('0x2e')][_0x66e2('0x46')](_0x29ec74)[_0x66e2('0x27')](handleEntityNotFound(_0x53c113,null))[_0x66e2('0x27')](respondWithResult(_0x53c113,null))['catch'](handleError(_0x53c113,null));};exports[_0x66e2('0x47')]=function(_0x147d36,_0x39f2d1){return db[_0x66e2('0x2e')][_0x66e2('0x47')](_0x147d36[_0x66e2('0x48')],{})[_0x66e2('0x27')](respondWithResult(_0x39f2d1,0xc9))['catch'](handleError(_0x39f2d1,null));};exports[_0x66e2('0x49')]=function(_0x43ce8a,_0x55ee30){var _0x3ded57={'where':{'id':_0x43ce8a[_0x66e2('0x4a')]['id']}},_0x5f0437={};_0x5f0437[_0x66e2('0x32')]=_[_0x66e2('0x33')](db['UserProfile'][_0x66e2('0x2f')]);_0x3ded57[_0x66e2('0x37')]=_['intersection'](_0x5f0437['model'],qs[_0x66e2('0x38')](_0x43ce8a[_0x66e2('0x34')][_0x66e2('0x38')]));_0x3ded57[_0x66e2('0x37')]=_0x3ded57[_0x66e2('0x37')][_0x66e2('0x39')]?_0x3ded57['attributes']:_0x5f0437['model'];if(_0x43ce8a[_0x66e2('0x34')][_0x66e2('0x41')]){_0x3ded57['include']=[{'all':!![]}];}_0x3ded57=_[_0x66e2('0x3f')]({},_0x3ded57,_0x43ce8a[_0x66e2('0x40')]);return db[_0x66e2('0x2e')]['find'](_0x3ded57)[_0x66e2('0x27')](handleEntityNotFound(_0x55ee30,null))[_0x66e2('0x27')](function(_0x48854d){if(_0x48854d){var _0x10110c=_0x48854d[_0x66e2('0x4b')]({'plain':!![]});_0x10110c=qs[_0x66e2('0x4c')](_0x10110c,['id','createdAt',_0x66e2('0x4d'),_0x66e2('0x4e')]);_0x43ce8a['body']=_[_0x66e2('0x4c')](_0x43ce8a[_0x66e2('0x48')],['id',_0x66e2('0x4f'),_0x66e2('0x4d')]);return db[_0x66e2('0x50')][_0x66e2('0x51')](function(_0x2e4758){return db[_0x66e2('0x2e')][_0x66e2('0x47')](_[_0x66e2('0x3f')](_0x10110c,_0x43ce8a[_0x66e2('0x48')]),{'include':_0x43ce8a[_0x66e2('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2e4758})[_0x66e2('0x27')](function(_0x226425){var _0x5ab4f0=_0x226425[_0x66e2('0x4b')]({'plain':!![]});return db[_0x66e2('0x52')][_0x66e2('0x53')]({'where':{'userProfileId':_0x43ce8a['params']['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x2fabc0){if(_0x2fabc0){return BPromise[_0x66e2('0x54')](_0x2fabc0,function(_0x46e7fa){return new BPromise(function(_0xc7853d,_0x1cacf8){if(_0x46e7fa[_0x66e2('0x55')]===null||_0x46e7fa[_0x66e2('0x55')]===0x1)_0xc7853d(null);return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x46e7fa['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x3f8a78){var _0x6f7c68=_['map'](_0x3f8a78,function(_0x2f8793){return qs['omit'](_0x2f8793,['id','createdAt',_0x66e2('0x4d'),_0x66e2('0x57')]);});_0xc7853d(_0x6f7c68);})['catch'](function(_0x40fe60){_0x1cacf8(_0x40fe60);});})[_0x66e2('0x27')](function(_0x573036){var _0x4fa2f0=qs['omit'](_0x46e7fa,['id',_0x66e2('0x4f'),_0x66e2('0x4d')]);_0x4fa2f0[_0x66e2('0x58')]=_0x5ab4f0['id'];if(_0x573036)_0x4fa2f0[_0x66e2('0x59')]=_0x573036;return _0x4fa2f0;})['then'](function(_0x692b1d){return db['UserProfileSection']['create'](_0x692b1d,{'include':[{'model':db[_0x66e2('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x2e4758});});})['then'](function(){return _0x5ab4f0;});}});});});}})['then'](respondWithResult(_0x55ee30,0xc9))[_0x66e2('0x44')](handleError(_0x55ee30,null));};exports[_0x66e2('0x26')]=function(_0x5c334e,_0x2928d2){if(_0x5c334e[_0x66e2('0x48')]['id']){delete _0x5c334e[_0x66e2('0x48')]['id'];}return db['UserProfile'][_0x66e2('0x46')]({'where':{'id':_0x5c334e['params']['id']}})['then'](handleEntityNotFound(_0x2928d2,null))[_0x66e2('0x27')](saveUpdates(_0x5c334e[_0x66e2('0x48')],null))[_0x66e2('0x27')](respondWithResult(_0x2928d2,null))[_0x66e2('0x44')](handleError(_0x2928d2,null));};exports[_0x66e2('0x5a')]=function(_0x42a370,_0x1906a2){return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x42a370[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x1906a2,null))['then'](removeEntity(_0x1906a2,null))[_0x66e2('0x44')](handleError(_0x1906a2,null));};exports[_0x66e2('0x5b')]=function(_0x1094b1,_0x4e0f3a){return db['UserProfile']['describe']()[_0x66e2('0x27')](respondWithResult(_0x4e0f3a,null))[_0x66e2('0x44')](handleError(_0x4e0f3a,null));};exports[_0x66e2('0x5c')]=function(_0x220185,_0xde1a6d){var _0x2cdcaa=_0x220185[_0x66e2('0x48')];return db[_0x66e2('0x2e')]['find']({'where':{'id':_0x220185[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0xde1a6d,null))[_0x66e2('0x27')](function(_0x4edbe3){if(_0x4edbe3){return db[_0x66e2('0x50')]['transaction'](function(_0x58319f){return db['UserProfileSection'][_0x66e2('0x5a')]({'where':{'userProfileId':_0x220185[_0x66e2('0x4a')]['id'],'sectionId':_['map'](_0x2cdcaa,function(_0x66dd2a){return _0x66dd2a[_0x66e2('0x57')];})},'transaction':_0x58319f})[_0x66e2('0x27')](function(){var _0x34846d=_[_0x66e2('0x2d')](_0x2cdcaa,function(_0x330cd9){_0x330cd9[_0x66e2('0x58')]=_0x220185['params']['id'];return _0x330cd9;});var _0x2e58bd=[];return BPromise['each'](_0x34846d,function(_0x23a5ad){return db[_0x66e2('0x52')][_0x66e2('0x47')](_0x23a5ad,{'include':[{'model':db['UserProfileResource'],'as':_0x66e2('0x59')}],'raw':!![],'transaction':_0x58319f})[_0x66e2('0x27')](function(_0x298022){_0x2e58bd[_0x66e2('0x5d')](_0x298022['get']({'plain':!![]}));});})[_0x66e2('0x27')](function(){return _0x2e58bd;});});});}})['then'](function(_0x1702f6){return _0x1702f6;})['then'](respondWithResult(_0xde1a6d,null))[_0x66e2('0x44')](handleError(_0xde1a6d,null));};exports[_0x66e2('0x5e')]=function(_0x2e7c0b,_0x26bf8c){var _0x4827b4;return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x2e7c0b[_0x66e2('0x4a')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x26bf8c,null))[_0x66e2('0x27')](function(_0x33c983){if(_0x33c983){_0x4827b4=_0x33c983;return db[_0x66e2('0x52')]['destroy']({'where':{'userProfileId':_0x2e7c0b[_0x66e2('0x4a')]['id'],'sectionId':_0x2e7c0b[_0x66e2('0x34')][_0x66e2('0x5f')]}});}})[_0x66e2('0x27')](function(){return _0x4827b4;})['then'](respondWithStatusCode(_0x26bf8c,null))[_0x66e2('0x44')](handleError(_0x26bf8c,null));};exports[_0x66e2('0x60')]=function(_0x26776f,_0x5e3142){var _0x55df4e=[];var _0x5d5caa=[];return db['UserProfileSection'][_0x66e2('0x53')]({'where':{'userProfileId':_0x26776f[_0x66e2('0x4a')]['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x326819){_0x55df4e=_['filter'](_0x326819,function(_0x2b7682){return _0x2b7682[_0x66e2('0x61')]===0x1||_[_0x66e2('0x62')]([0x3eb,0x709],_0x2b7682[_0x66e2('0x57')]);});if(!_[_0x66e2('0x63')](_0x55df4e)){return _['map'](_0x55df4e,function(_0x1ae790){return _0x1ae790[_0x66e2('0x57')];});}else{return;}})[_0x66e2('0x27')](function(_0x4dedff){if(_0x4dedff)_0x5d5caa=_0x4dedff;if(_[_0x66e2('0x62')](_0x5d5caa,0x64)){var _0x233e2a=_[_0x66e2('0x46')](_0x55df4e,{'sectionId':0x64});return hasDefaultDashboard(_0x233e2a)[_0x66e2('0x27')](function(_0x18a09c){return _[_0x66e2('0x2d')](_0x55df4e,function(_0x6ee218){if(_0x6ee218[_0x66e2('0x57')]===0x64){_0x6ee218['subsections']=_0x18a09c;}return _0x6ee218;});});}else{return;}})[_0x66e2('0x27')](function(_0x5ef473){if(_0x5ef473)_0x55df4e=_0x5ef473;if(_[_0x66e2('0x62')](_0x5d5caa,0x3eb)){var _0x3ae0bf=_[_0x66e2('0x46')](_0x55df4e,{'sectionId':0x3eb});return getCustomDashboards(_0x3ae0bf)['then'](function(_0x5bd957){return _['map'](_0x55df4e,function(_0x15a0f9){if(_0x3ae0bf[_0x66e2('0x61')]){if(_0x15a0f9[_0x66e2('0x57')]===0x3eb){_0x15a0f9[_0x66e2('0x64')]=_0x5bd957;}}else{if(_0x15a0f9[_0x66e2('0x57')]===0x64){_0x15a0f9[_0x66e2('0x64')]=_0x5bd957;}}return _0x15a0f9;});});}else{return;}})[_0x66e2('0x27')](function(_0x5003be){if(_0x5003be)_0x55df4e=_0x5003be;if(_[_0x66e2('0x62')](_0x5d5caa,0x709)){var _0x134128=_['find'](_0x55df4e,{'sectionId':0x709});return getPlugins(_0x134128)[_0x66e2('0x27')](function(_0x9553b7){if(_0x134128[_0x66e2('0x61')]){return _['map'](_0x55df4e,function(_0x4bcbad){if(_0x4bcbad[_0x66e2('0x57')]===0x709){_0x4bcbad[_0x66e2('0x64')]=_0x9553b7;}return _0x4bcbad;});}else{var _0x3909fc={'sectionId':0x76c,'enabled':0x1,'subsections':_0x9553b7};var _0x538d11=_[_0x66e2('0x2d')](_0x55df4e);_0x538d11[_0x66e2('0x5d')](_0x3909fc);return _0x538d11;}});}else{return;}})[_0x66e2('0x27')](function(_0x32353d){if(_0x32353d)_0x55df4e=_0x32353d;return _['filter'](_0x55df4e,[_0x66e2('0x61'),0x1]);})['then'](respondWithResult(_0x5e3142,null))[_0x66e2('0x44')](handleError(_0x5e3142,null));};function hasDefaultDashboard(_0x23529d){var _0x146b54=[0x65];return new BPromise(function(_0x5ab23c,_0x56e82f){try{if(_0x23529d[_0x66e2('0x55')]){_0x5ab23c(_0x146b54);}else{return db[_0x66e2('0x56')]['findOne']({'where':{'sectionId':_0x23529d['id']},'raw':!![]})['then'](function(_0xe2ae4a){_0xe2ae4a?_0x5ab23c(_0x146b54):_0x5ab23c();});}}catch(_0x3637bb){_0x56e82f(_0x3637bb);}});}function getCustomDashboards(_0x3cd568){var _0x16e3c6=[];return new BPromise(function(_0x23c16b,_0x5092a2){try{if(_0x3cd568[_0x66e2('0x55')]){return db[_0x66e2('0x65')]['findAll']({'raw':!![]})[_0x66e2('0x27')](function(_0x141573){_0x141573[_0x66e2('0x66')](function(_0x57d93a){_0x16e3c6['push'](_0x57d93a['id']+0x1869f);});_0x23c16b(_0x16e3c6);});}else{return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x3cd568['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x1c52db){_0x1c52db[_0x66e2('0x66')](function(_0x4577d7){_0x16e3c6[_0x66e2('0x5d')](_0x4577d7['resourceId']+0x1869f);});_0x23c16b(_0x16e3c6);});}}catch(_0x2f27be){_0x5092a2(_0x2f27be);}});}function getPlugins(_0x509b83){var _0x17dab3=[];return new BPromise(function(_0x2ec7b2,_0x398ea7){try{if(_0x509b83[_0x66e2('0x55')]){return db[_0x66e2('0x67')][_0x66e2('0x53')]({'raw':!![]})['then'](function(_0x29ff76){_0x29ff76[_0x66e2('0x66')](function(_0x4ce444){_0x17dab3['push'](_0x4ce444['id']+0x15b38);});_0x2ec7b2(_0x17dab3);});}else{return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x509b83['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x1475cb){_0x1475cb[_0x66e2('0x66')](function(_0x304a6b){_0x17dab3['push'](_0x304a6b[_0x66e2('0x68')]+0x15b38);});_0x2ec7b2(_0x17dab3);});}}catch(_0x3f28b8){_0x398ea7(_0x3f28b8);}});}exports[_0x66e2('0x69')]=function(_0x3fc565,_0x4b6d7e){return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x3fc565[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x4b6d7e,null))[_0x66e2('0x27')](function(_0x2edcb0){if(_0x2edcb0){return db[_0x66e2('0x50')][_0x66e2('0x51')](function(_0x3c7869){return db['UserProfileSection'][_0x66e2('0x53')]({'where':{'userProfileId':_0x3fc565['params']['id']},'attributes':['id'],'raw':!![]})[_0x66e2('0x27')](function(_0x109023){if(_0x109023){return db[_0x66e2('0x52')]['destroy']({'where':{'userProfileId':_0x3fc565[_0x66e2('0x4a')]['id'],'id':_[_0x66e2('0x2d')](_0x109023,function(_0x35bf05){return _0x35bf05['id'];})},'transaction':_0x3c7869});}})[_0x66e2('0x27')](function(_0xab66a3){var _0x55bfbf=_[_0x66e2('0x2d')](_0x3fc565[_0x66e2('0x48')],function(_0x138605){_0x138605['userProfileId']=_0x3fc565[_0x66e2('0x4a')]['id'];return _0x138605;});return db[_0x66e2('0x52')][_0x66e2('0x6a')](_0x55bfbf,{'raw':!![],'transaction':_0x3c7869});})[_0x66e2('0x27')](function(_0x50f926){var _0x287a4e=_[_0x66e2('0x3e')](_[_0x66e2('0x2d')](_0x50f926,function(_0x4656a5){return _0x4656a5[_0x66e2('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x287a4e){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3fc565[_0x66e2('0x4a')]['id'],'sectionId':_[_0x66e2('0x2d')](_0x287a4e,function(_0x180a3c){return _0x180a3c[_0x66e2('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x433236){var _0x37d232=_['map'](_0x3fc565['body'],function(_0x5baf26){_0x5baf26['userProfileId']=_0x3fc565[_0x66e2('0x4a')]['id'];return _0x5baf26;});return db[_0x66e2('0x56')]['bulkCreate'](_0x37d232,{'raw':!![],'transaction':_0x3c7869});});}})[_0x66e2('0x44')](handleError(_0x4b6d7e,null));});}})['then'](function(_0x453b4f){var _0x6ade2f=_[_0x66e2('0x2d')](_0x453b4f,function(_0x104ee3){return _0x104ee3[_0x66e2('0x4b')]({'plain':!![]});});})[_0x66e2('0x27')](respondWithResult(_0x4b6d7e,null))[_0x66e2('0x44')](handleError(_0x4b6d7e,null));};exports[_0x66e2('0x6b')]=function(_0x59fd8,_0x3ebb61,_0x52c721){return db[_0x66e2('0x2e')][_0x66e2('0x46')]({'where':{'id':_0x59fd8[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x3ebb61,null))['then'](function(_0x13e9e6){if(_0x13e9e6){return _0x13e9e6[_0x66e2('0x6b')](_0x59fd8[_0x66e2('0x34')][_0x66e2('0x5f')]);}})['then'](respondWithStatusCode(_0x3ebb61,null))['catch'](handleError(_0x3ebb61,null));};exports[_0x66e2('0x6c')]=function(_0x19377d,_0x177110){var _0x46436c={'raw':![],'where':{}};var _0x1baa99={};var _0x4e67b5={'count':0x0,'rows':[]};var _0x27eead=_0x19377d['query'][_0x66e2('0x6d')];if(typeof _0x27eead==='undefined'){throw new db[(_0x66e2('0x6e'))][(_0x66e2('0x6f'))](_0x66e2('0x70'));}var _0xe43529=_0x19377d[_0x66e2('0x34')][_0x66e2('0x71')]||![];var _0x2a258b=getQueryModels(_0x27eead,_0xe43529);if(typeof _0x2a258b[_0x66e2('0x72')]===_0x66e2('0x73')){throw new db[(_0x66e2('0x6e'))][(_0x66e2('0x6f'))]('Invalid\x20section\x20\x27'+_0x27eead+'\x27');}var _0x233cde=[];if(!_[_0x66e2('0x63')](_0x2a258b['parentSections'])){_0x233cde=_0x2a258b['parentSections'];}else{_0x233cde=[{'name':_0x27eead}];}return db[_0x66e2('0x2e')][_0x66e2('0x74')]({'where':{'id':_0x19377d[_0x66e2('0x4a')]['id']}})[_0x66e2('0x27')](handleEntityNotFound(_0x177110,null))[_0x66e2('0x27')](function(_0x58006f){if(_0x58006f){var _0x599a1e=[];for(var _0x51ebe1=0x0;_0x51ebe1<_0x233cde[_0x66e2('0x39')];_0x51ebe1++){_0x599a1e[_0x66e2('0x5d')](db[_0x66e2('0x52')][_0x66e2('0x74')]({'where':{'userProfileId':_0x58006f['id'],'name':_0x233cde[_0x51ebe1][_0x66e2('0x2b')]},'raw':!![]}));}return BPromise[_0x66e2('0x75')](_0x599a1e);}})['then'](function(_0x512905){var _0x4d95cc=_[_0x66e2('0x3e')](_0x512905,function(_0x167181){return _0x167181?_0x167181:undefined;});var _0x2c38b6=_[_0x66e2('0x3e')](_0x233cde,['ignore',!![]]);var _0x46e1ab=_['isEmpty'](_0x4d95cc)&&_[_0x66e2('0x63')](_0x2c38b6)?null:_[_0x66e2('0x76')](_0x2c38b6,_0x4d95cc);if(_0x46e1ab){var _0x19872a=[];for(var _0x1b90fa=0x0;_0x1b90fa<_0x46e1ab[_0x66e2('0x39')];_0x1b90fa++){var _0xdd4c26=_['find'](_0x233cde,function(_0x5cbbda){return _0x46e1ab[_0x1b90fa]?_0x5cbbda[_0x66e2('0x2b')]===_0x46e1ab[_0x1b90fa][_0x66e2('0x2b')]:null;});if(_0xdd4c26){if(_0x46e1ab[_0x1b90fa]['ignore']){_0x19872a[_0x66e2('0x5d')](getAllResources(_0x2a258b[_0x66e2('0x72')],_0x46e1ab[_0x1b90fa]));}else{if(!_0x46e1ab[_0x1b90fa]['autoAssociation']){_0x19872a[_0x66e2('0x5d')](getAllowedResources(_0xdd4c26,_0x46e1ab[_0x1b90fa],_0x2a258b['childModel']));}else{if(_0xdd4c26[_0x66e2('0x32')]){_0x19872a[_0x66e2('0x5d')](getAllFilteredResources(_0xdd4c26,_0x46e1ab[_0x1b90fa]));}}}}}return BPromise[_0x66e2('0x75')](_0x19872a);}else{return null;}})['then'](function(_0xbf29e6){var _0x481eba=_0xbf29e6;var _0x4ba58d=null;if(_0x481eba){_0x4ba58d=_0x481eba[_0x66e2('0x39')]===0x1?_0x481eba[0x0]:null;}if(_0x4ba58d||_0x481eba){var _0x49b431=db[_0x2a258b[_0x66e2('0x72')]][_0x66e2('0x2f')];_0x1baa99[_0x66e2('0x32')]=_['keys'](_0x49b431);_0x1baa99[_0x66e2('0x34')]=_[_0x66e2('0x33')](_0x19377d['query']);_0x1baa99[_0x66e2('0x35')]=_[_0x66e2('0x36')](_0x1baa99['model'],_0x1baa99[_0x66e2('0x34')]);_0x46436c[_0x66e2('0x37')]=_[_0x66e2('0x36')](_0x1baa99[_0x66e2('0x32')],qs[_0x66e2('0x38')](_0x19377d['query']['fields']));_0x46436c[_0x66e2('0x37')]=_0x46436c[_0x66e2('0x37')][_0x66e2('0x39')]?_0x46436c[_0x66e2('0x37')]:_0x1baa99[_0x66e2('0x32')];if(!_0x19377d['query'][_0x66e2('0x77')](_0x66e2('0x3a'))){_0x46436c[_0x66e2('0x21')]=qs[_0x66e2('0x21')](_0x19377d[_0x66e2('0x34')][_0x66e2('0x21')]);_0x46436c[_0x66e2('0x20')]=qs[_0x66e2('0x20')](_0x19377d[_0x66e2('0x34')]['offset']);}_0x46436c[_0x66e2('0x3b')]=qs[_0x66e2('0x3c')](_0x19377d[_0x66e2('0x34')][_0x66e2('0x3c')]);_0x46436c[_0x66e2('0x3d')]=qs[_0x66e2('0x35')](_['pick'](_0x19377d['query'],_0x1baa99[_0x66e2('0x35')]));if(_0x19377d[_0x66e2('0x34')][_0x66e2('0x3e')]){_0x46436c[_0x66e2('0x3d')]=_[_0x66e2('0x3f')](_0x46436c['where'],{'$or':_[_0x66e2('0x2d')](_0x49b431,function(_0x508a73){if(_0x508a73[_0x66e2('0x31')][_0x66e2('0x78')]!==_0x66e2('0x79')){var _0x6b719e={};_0x6b719e[_0x508a73[_0x66e2('0x7a')]]={'$like':'%'+_0x19377d['query']['filter']+'%'};return _0x6b719e;}})});}var _0x4a1a41=[];if(_0x4ba58d){var _0x251c00=_[_0x66e2('0x46')](_0x233cde,[_0x66e2('0x2b'),_0x4ba58d['name']]);if(_0x251c00[_0x66e2('0x7a')]){var _0x5e8399={};if(_0x2a258b[_0x66e2('0x72')]===_0x66e2('0x7b')){_0x5e8399[_0x251c00[_0x66e2('0x7c')]]=_['map'](_0x4ba58d[_0x66e2('0x7d')],'id');}else{_0x5e8399[_0x251c00[_0x66e2('0x7c')]]=_0x4ba58d['associatedResources'];}_0x4a1a41['push'](_0x5e8399);}else{_0x46436c[_0x66e2('0x3d')]['id']=_0x4ba58d[_0x66e2('0x7d')];}}else{for(var _0x3b9be4=0x0;_0x3b9be4<_0x481eba['length'];_0x3b9be4++){var _0x251c00=_[_0x66e2('0x46')](_0x233cde,[_0x66e2('0x2b'),_0x481eba[_0x3b9be4]['name']]);if(_0x251c00[_0x66e2('0x7a')]){var _0x5e8399={};_0x5e8399[_0x251c00['foreignKey']]=_0x481eba[_0x3b9be4][_0x66e2('0x7d')];_0x4a1a41[_0x66e2('0x5d')](_0x5e8399);}else{if(!_0x46436c[_0x66e2('0x3d')]['id'])_0x46436c[_0x66e2('0x3d')]['id']=[];_0x481eba[_0x3b9be4][_0x66e2('0x7d')][_0x66e2('0x66')](function(_0x38b3c6){_0x46436c[_0x66e2('0x3d')]['id'][_0x66e2('0x5d')](_0x38b3c6);});}}}if(!_[_0x66e2('0x63')](_0x4a1a41)){_0x46436c[_0x66e2('0x3d')]=_[_0x66e2('0x3f')](_0x46436c[_0x66e2('0x3d')],{'$and':{'$or':_0x4a1a41}});}_0x46436c=_['merge']({},_0x46436c,_0x19377d[_0x66e2('0x40')]);if(_0x4ba58d&&!_0x4ba58d[_0x66e2('0x55')]&&_0x2a258b[_0x66e2('0x72')]===_0x66e2('0x7b')){if(_0x19377d[_0x66e2('0x34')][_0x66e2('0x41')]){_0x46436c[_0x66e2('0x42')]=[{'all':!![]}];}return db[_0x2a258b[_0x66e2('0x72')]][_0x66e2('0x53')](_0x46436c)[_0x66e2('0x27')](function(_0x2f7cbf){var _0x4f4ade=[];_0x2f7cbf['forEach'](function(_0x1d6fb5){var _0x8e3d28;switch(_0x1d6fb5[_0x66e2('0x7e')]){case _0x66e2('0x7f'):_0x8e3d28=_[_0x66e2('0x46')](_0x4ba58d[_0x66e2('0x7d')],function(_0x1bf32a){return _0x1bf32a['id']===_0x1d6fb5[_0x66e2('0x80')]&&_0x1bf32a[_0x66e2('0x31')]===_0x66e2('0x81');});break;case _0x66e2('0x82'):_0x8e3d28=_['find'](_0x4ba58d[_0x66e2('0x7d')],function(_0x48a06b){return _0x48a06b['id']===_0x1d6fb5[_0x66e2('0x80')]&&_0x48a06b[_0x66e2('0x31')]==='CustomReports';});break;}if(_0x8e3d28)_0x4f4ade[_0x66e2('0x5d')](_0x1d6fb5);});_0x4e67b5[_0x66e2('0x1f')]=_0x4f4ade['length'];_0x4e67b5[_0x66e2('0x43')]=_0x4f4ade;return _0x4e67b5;});}else{return db[_0x2a258b['childModel']][_0x66e2('0x1f')]({'where':_0x46436c[_0x66e2('0x3d')]})[_0x66e2('0x27')](function(_0x1391cf){_0x4e67b5[_0x66e2('0x1f')]=_0x1391cf;if(_0x19377d[_0x66e2('0x34')]['includeAll']){if(_0x2a258b[_0x66e2('0x72')]===_0x66e2('0x83')){_0x46436c[_0x66e2('0x42')]=[{'model':db[_0x66e2('0x84')],'as':_0x66e2('0x85'),'attributes':['id',_0x66e2('0x2b'),_0x66e2('0x86')],'required':_0x19377d[_0x66e2('0x34')]['tag']?!![]:![]},{'model':db[_0x66e2('0x84')],'as':_0x66e2('0x87'),'attributes':['id','name','color'],'through':_0x19377d[_0x66e2('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0x19377d[_0x66e2('0x34')][_0x66e2('0x88')]||undefined}}:{},'required':_0x19377d['query'][_0x66e2('0x88')]?!![]:![]}];}else{_0x46436c[_0x66e2('0x42')]=[{'all':!![]}];}}return db[_0x2a258b[_0x66e2('0x72')]][_0x66e2('0x53')](_0x46436c);})[_0x66e2('0x27')](function(_0x5d1de2){_0x4e67b5[_0x66e2('0x43')]=_0x5d1de2;return _0x4e67b5;});}}else{return _0x4e67b5;}})['then'](respondWithFilteredResult(_0x177110,_0x46436c))['catch'](handleError(_0x177110,null));};function getAllResources(_0x40896a,_0x4ada9f){return new BPromise(function(_0x35befd,_0x5c740e){if(_0x4ada9f){var _0x17042d=_0x4ada9f[_0x66e2('0x3e')]?{[_0x4ada9f[_0x66e2('0x3e')][_0x66e2('0x7a')]]:_0x4ada9f[_0x66e2('0x3e')]['value']}:undefined;return db[_0x40896a][_0x66e2('0x53')]({'where':_0x17042d,'raw':!![]})[_0x66e2('0x27')](function(_0x418e6a){_0x4ada9f[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x418e6a,'id');_0x35befd(_0x4ada9f);})[_0x66e2('0x44')](function(_0x380045){_0x5c740e(_0x380045);});}else{_0x35befd(null);}});}function getAllFilteredResources(_0x273d00,_0x5f58e5){return new BPromise(function(_0x23ad03,_0x3d9e42){var _0x2f4bcd=_0x273d00[_0x66e2('0x3e')]?{[_0x273d00['filter'][_0x66e2('0x7a')]]:_0x273d00['filter'][_0x66e2('0x89')]}:undefined;return db[_0x273d00[_0x66e2('0x32')]][_0x66e2('0x53')]({'where':_0x2f4bcd,'raw':!![]})[_0x66e2('0x27')](function(_0x2b7730){_0x5f58e5[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x2b7730,function(_0x24c511){return _0x24c511[_0x66e2('0x2b')];});_0x23ad03(_0x5f58e5);})[_0x66e2('0x44')](function(_0x318472){_0x3d9e42(_0x318472);});});}function getAllowedResources(_0x1b7952,_0x4e97f5,_0x3d885d){return new BPromise(function(_0x12321f,_0x29b250){if(_0x4e97f5){return db[_0x66e2('0x56')][_0x66e2('0x53')]({'where':{'sectionId':_0x4e97f5['id']},'raw':!![]})[_0x66e2('0x27')](function(_0x30a85a){if(_0x1b7952[_0x66e2('0x7a')]&&_0x1b7952[_0x66e2('0x7a')]!=='id'){_0x4e97f5[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x30a85a,function(_0x49ddae){return _0x49ddae[_0x1b7952[_0x66e2('0x7a')]];});}else{if(_0x3d885d==='AnalyticExtractedReport'){_0x4e97f5['associatedResources']=_[_0x66e2('0x2d')](_0x30a85a,function(_0x2931d5){return{'id':_0x2931d5[_0x66e2('0x68')],'type':_0x2931d5['type']};});}else{_0x4e97f5[_0x66e2('0x7d')]=_[_0x66e2('0x2d')](_0x30a85a,function(_0x1808e8){return _0x1808e8['resourceId'];});}}_0x12321f(_0x4e97f5);})[_0x66e2('0x44')](function(_0x4740db){_0x29b250(_0x4740db);});}else{_0x12321f(null);}});}function getQueryModels(_0x2822c8,_0xf8e8fa){var _0x241bfa=_0x2822c8[_0x66e2('0x8a')]();var _0x1fc72c={'childModel':undefined,'parentSections':[]};switch(_0x241bfa){case _0x66e2('0x8b'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x8c');break;case'odbc':_0x1fc72c['childModel']=_0x66e2('0x8d');break;case _0x66e2('0x8e'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x8f');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0x91'),'field':_0x66e2('0x2b'),'foreignKey':'projectName'}];break;case _0x66e2('0x92'):_0x1fc72c[_0x66e2('0x72')]='JscriptyProject';break;case _0x66e2('0x93'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x83');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0x94'),'field':'id','foreignKey':_0x66e2('0x95')}];break;case _0x66e2('0x96'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x97');break;case _0x66e2('0x98'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x99');break;case _0x66e2('0x9a'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x9b');break;case _0x66e2('0x9c'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x9d');break;case'chatwebsites':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x9e');break;case _0x66e2('0x9f'):_0x1fc72c[_0x66e2('0x72')]='FaxQueue';break;case _0x66e2('0xa0'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa1');break;case _0x66e2('0xa2'):case _0x66e2('0xa3'):case'outboundroutes':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa4');break;case _0x66e2('0xa5'):_0x1fc72c[_0x66e2('0x72')]='VoiceContext';break;case _0x66e2('0xa6'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa7');break;case _0x66e2('0xa8'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xa9');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0xaa'),'field':'name','foreignKey':_0x66e2('0xab'),'model':'User','filter':{'field':'role','value':[_0x66e2('0xac')]}},{'name':_0x66e2('0xad'),'field':_0x66e2('0x2b'),'foreignKey':'membername','model':_0x66e2('0xae'),'filter':{'field':_0x66e2('0xaf'),'value':[_0x66e2('0xb0')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x66e2('0xb1'),'model':'VoiceQueue','filter':{'field':_0x66e2('0x31'),'value':[_0x66e2('0xb2')]}},{'name':'QueueCampaigns','field':_0x66e2('0x2b'),'foreignKey':_0x66e2('0xb1'),'model':_0x66e2('0xb3'),'filter':{'field':_0x66e2('0x31'),'value':['outbound']}}];break;case _0x66e2('0xb4'):_0x1fc72c[_0x66e2('0x72')]='VoiceMusicOnHold';break;case _0x66e2('0xb5'):_0x1fc72c['childModel']='VoiceChanSpy';break;case _0x66e2('0xb6'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb7');break;case'ivrcampaigns':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb8');break;case'mailqueues':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb9');break;case _0x66e2('0xba'):_0x1fc72c['childModel']=_0x66e2('0xbb');break;case'mailsubstatuses':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xbc');break;case _0x66e2('0xbd'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xbe');break;case _0x66e2('0xbf'):_0x1fc72c['childModel']=_0x66e2('0xc0');break;case _0x66e2('0xc1'):_0x1fc72c['childModel']=_0x66e2('0xc2');break;case _0x66e2('0xc3'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc4');break;case _0x66e2('0xc5'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc6');break;case'whatsappaccounts':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc7');break;case _0x66e2('0xc8'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc9');break;case'voicequeues':case'queuecampaigns':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xb3');if(_0xf8e8fa){_0x1fc72c['parentSections']=[{'name':_0x66e2('0xca')},{'name':_0x66e2('0xcb')}];}break;case _0x66e2('0xcc'):case _0x66e2('0xcd'):case _0x66e2('0xce'):_0x1fc72c[_0x66e2('0x72')]='User';if(_0xf8e8fa){_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0xcf'),'filter':{'field':_0x66e2('0xaf'),'value':[_0x66e2('0xd0'),_0x66e2('0xd1')]},'ignore':!![]},{'name':_0x66e2('0xaa')},{'name':'Telephones'}];}break;case _0x66e2('0xd2'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xd3');break;case _0x66e2('0xd4'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xd5');break;case'freshdeskaccounts':_0x1fc72c['childModel']=_0x66e2('0xd6');break;case _0x66e2('0xd7'):_0x1fc72c['childModel']=_0x66e2('0xd8');break;case _0x66e2('0xd9'):_0x1fc72c['childModel']=_0x66e2('0xda');break;case'zohoaccounts':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xdb');break;case _0x66e2('0xdc'):_0x1fc72c['childModel']='User';break;case _0x66e2('0xdd'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xde');break;case'dispositions':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xdf');break;case'customdashboards':_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x65');break;case _0x66e2('0xe0'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xe1');break;case _0x66e2('0xe2'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xe3');break;case _0x66e2('0xe4'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xe5');break;case _0x66e2('0xe6'):_0x1fc72c[_0x66e2('0x72')]='Sound';break;case _0x66e2('0xe7'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x84');break;case _0x66e2('0xe8'):_0x1fc72c['childModel']='Template';break;case _0x66e2('0xe9'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xea');break;case _0x66e2('0xeb'):_0x1fc72c['childModel']=_0x66e2('0xec');break;case _0x66e2('0xed'):_0x1fc72c['childModel']=_0x66e2('0xee');break;case _0x66e2('0xef'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x67');break;case _0x66e2('0xf0'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0x7b');_0x1fc72c[_0x66e2('0x90')]=[{'name':_0x66e2('0xf1'),'field':'id','foreignKey':_0x66e2('0x80')}];break;case _0x66e2('0xf2'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xf3');break;case _0x66e2('0xf4'):_0x1fc72c[_0x66e2('0x72')]=_0x66e2('0xc7');break;default:return _0x1fc72c;}return _0x1fc72c;} \ No newline at end of file +var _0xfc20=['triggers','Trigger','Trunk','Variable','plugins','metrics','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','length','include','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','ids','getSections','includes','subsections','enabled','findOne','findAll','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','isEmpty','parentSections','all','ignore','union','childModel','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','Lists','ListId','CmList','companies','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','templates','Template'];(function(_0x4ae1b0,_0x265fb1){var _0xf716c7=function(_0x2cc3ab){while(--_0x2cc3ab){_0x4ae1b0['push'](_0x4ae1b0['shift']());}};_0xf716c7(++_0x265fb1);}(_0xfc20,0x1df));var _0x0fc2=function(_0x49f823,_0x49bc41){_0x49f823=_0x49f823-0x0;var _0x443e8a=_0xfc20[_0x49f823];return _0x443e8a;};'use strict';var pdf=require(_0x0fc2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0fc2('0x1'));var jsonpatch=require(_0x0fc2('0x2'));var rp=require(_0x0fc2('0x3'));var moment=require(_0x0fc2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0fc2('0x5'));var util=require('util');var path=require(_0x0fc2('0x6'));var sox=require(_0x0fc2('0x7'));var csv=require(_0x0fc2('0x8'));var ejs=require(_0x0fc2('0x9'));var fs=require('fs');var _=require(_0x0fc2('0xa'));var squel=require(_0x0fc2('0xb'));var crypto=require(_0x0fc2('0xc'));var jsforce=require(_0x0fc2('0xd'));var deskjs=require(_0x0fc2('0xe'));var toCsv=require(_0x0fc2('0x8'));var querystring=require(_0x0fc2('0xf'));var Papa=require(_0x0fc2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0fc2('0x11'));var as=require(_0x0fc2('0x12'));var hardwareService=require(_0x0fc2('0x13'));var logger=require(_0x0fc2('0x14'))(_0x0fc2('0x15'));var utils=require('../../config/utils');var config=require(_0x0fc2('0x16'));var db=require(_0x0fc2('0x17'))['db'];config[_0x0fc2('0x18')]=_[_0x0fc2('0x19')](config['redis'],{'host':_0x0fc2('0x1a'),'port':0x18eb});var socket=require(_0x0fc2('0x1b'))(new Redis(config[_0x0fc2('0x18')]));require(_0x0fc2('0x1c'))[_0x0fc2('0x1d')](socket);function respondWithStatusCode(_0x1c58a5,_0x3b012c){_0x3b012c=_0x3b012c||0xcc;return function(_0x180633){if(_0x180633){return _0x1c58a5['sendStatus'](_0x3b012c);}return _0x1c58a5[_0x0fc2('0x1e')](_0x3b012c)[_0x0fc2('0x1f')]();};}function respondWithResult(_0x61829a,_0x40cfbb){_0x40cfbb=_0x40cfbb||0xc8;return function(_0x41562d){if(_0x41562d){return _0x61829a['status'](_0x40cfbb)['json'](_0x41562d);}};}function respondWithFilteredResult(_0x14b83c,_0x1cfc9a){return function(_0x345e3c){if(_0x345e3c){var _0x1cb177=_0x345e3c[_0x0fc2('0x20')],_0x38dffb=_0x1cfc9a[_0x0fc2('0x21')],_0x4911bb=_0x1cfc9a[_0x0fc2('0x21')]+_0x1cfc9a[_0x0fc2('0x22')],_0x178b8e;if(_0x4911bb>=_0x1cb177){_0x4911bb=_0x1cb177;_0x178b8e=0xc8;}else{_0x178b8e=0xce;}_0x14b83c[_0x0fc2('0x1e')](_0x178b8e);return _0x14b83c[_0x0fc2('0x23')](_0x0fc2('0x24'),_0x38dffb+'-'+_0x4911bb+'/'+_0x1cb177)[_0x0fc2('0x25')](_0x345e3c);}return null;};}function patchUpdates(_0x299f25){return function(_0x20c1f4){try{jsonpatch[_0x0fc2('0x26')](_0x20c1f4,_0x299f25,!![]);}catch(_0xe4991b){return BPromise[_0x0fc2('0x27')](_0xe4991b);}return _0x20c1f4['save']();};}function saveUpdates(_0x38af34,_0x990f4a){return function(_0x84ab09){if(_0x84ab09){return _0x84ab09[_0x0fc2('0x28')](_0x38af34)[_0x0fc2('0x29')](function(_0x4bbde6){return _0x4bbde6;});}return null;};}function removeEntity(_0x51c2c2,_0x4a48ae){return function(_0x2a9773){if(_0x2a9773){return _0x2a9773[_0x0fc2('0x2a')]()[_0x0fc2('0x29')](function(){_0x51c2c2[_0x0fc2('0x1e')](0xcc)[_0x0fc2('0x1f')]();});}};}function handleEntityNotFound(_0x4467ac,_0x2263a9){return function(_0x3f2968){if(!_0x3f2968){_0x4467ac[_0x0fc2('0x2b')](0x194);}return _0x3f2968;};}function handleError(_0x5d252a,_0x25d2ef){_0x25d2ef=_0x25d2ef||0x1f4;return function(_0x1b4deb){logger['error'](_0x1b4deb[_0x0fc2('0x2c')]);if(_0x1b4deb[_0x0fc2('0x2d')]){delete _0x1b4deb['name'];}_0x5d252a[_0x0fc2('0x1e')](_0x25d2ef)['send'](_0x1b4deb);};}exports[_0x0fc2('0x2e')]=function(_0x4bf673,_0x271bbf){var _0xd77766={},_0x299a70={},_0x191aec={'count':0x0,'rows':[]};var _0x529271=_[_0x0fc2('0x2f')](db[_0x0fc2('0x30')][_0x0fc2('0x31')],function(_0x1fdca6){return{'name':_0x1fdca6[_0x0fc2('0x32')],'type':_0x1fdca6[_0x0fc2('0x33')][_0x0fc2('0x34')]};});_0x299a70['model']=_[_0x0fc2('0x2f')](_0x529271,_0x0fc2('0x2d'));_0x299a70[_0x0fc2('0x35')]=_[_0x0fc2('0x36')](_0x4bf673[_0x0fc2('0x35')]);_0x299a70[_0x0fc2('0x37')]=_['intersection'](_0x299a70[_0x0fc2('0x38')],_0x299a70[_0x0fc2('0x35')]);_0xd77766[_0x0fc2('0x39')]=_[_0x0fc2('0x3a')](_0x299a70[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x3b')]));_0xd77766[_0x0fc2('0x39')]=_0xd77766[_0x0fc2('0x39')]['length']?_0xd77766[_0x0fc2('0x39')]:_0x299a70[_0x0fc2('0x38')];if(!_0x4bf673['query'][_0x0fc2('0x3c')](_0x0fc2('0x3d'))){_0xd77766['limit']=qs['limit'](_0x4bf673['query']['limit']);_0xd77766[_0x0fc2('0x21')]=qs[_0x0fc2('0x21')](_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x21')]);}_0xd77766[_0x0fc2('0x3e')]=qs[_0x0fc2('0x3f')](_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x3f')]);_0xd77766[_0x0fc2('0x40')]=qs[_0x0fc2('0x37')](_[_0x0fc2('0x41')](_0x4bf673['query'],_0x299a70[_0x0fc2('0x37')]),_0x529271);if(_0x4bf673['query'][_0x0fc2('0x42')]){_0xd77766[_0x0fc2('0x40')]=_[_0x0fc2('0x43')](_0xd77766[_0x0fc2('0x40')],{'$or':_[_0x0fc2('0x2f')](_0x529271,function(_0x5084cf){if(_0x5084cf['type']!=='VIRTUAL'){var _0x72262={};_0x72262[_0x5084cf[_0x0fc2('0x2d')]]={'$like':'%'+_0x4bf673[_0x0fc2('0x35')]['filter']+'%'};return _0x72262;}})});}_0xd77766=_[_0x0fc2('0x43')]({},_0xd77766,_0x4bf673[_0x0fc2('0x44')]);var _0x48c0cb={'where':_0xd77766['where']};return db[_0x0fc2('0x30')]['count'](_0x48c0cb)['then'](function(_0xc7a189){_0x191aec[_0x0fc2('0x20')]=_0xc7a189;if(_0x4bf673[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0xd77766['include']=[{'all':!![]}];}return db[_0x0fc2('0x30')]['findAll'](_0xd77766);})[_0x0fc2('0x29')](function(_0x3db1d5){_0x191aec[_0x0fc2('0x46')]=_0x3db1d5;return _0x191aec;})['then'](respondWithFilteredResult(_0x271bbf,_0xd77766))[_0x0fc2('0x47')](handleError(_0x271bbf,null));};exports[_0x0fc2('0x48')]=function(_0x3757a5,_0x2817eb){var _0x1fd998={'raw':![],'where':{'id':_0x3757a5[_0x0fc2('0x49')]['id']}},_0x52ad7c={};_0x52ad7c['model']=_[_0x0fc2('0x36')](db['UserProfile'][_0x0fc2('0x31')]);_0x52ad7c[_0x0fc2('0x35')]=_[_0x0fc2('0x36')](_0x3757a5[_0x0fc2('0x35')]);_0x52ad7c['filters']=_['intersection'](_0x52ad7c[_0x0fc2('0x38')],_0x52ad7c[_0x0fc2('0x35')]);_0x1fd998['attributes']=_[_0x0fc2('0x3a')](_0x52ad7c[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0x3757a5['query']['fields']));_0x1fd998[_0x0fc2('0x39')]=_0x1fd998[_0x0fc2('0x39')][_0x0fc2('0x4a')]?_0x1fd998[_0x0fc2('0x39')]:_0x52ad7c[_0x0fc2('0x38')];if(_0x3757a5[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0x1fd998[_0x0fc2('0x4b')]=[{'all':!![]}];}_0x1fd998=_['merge']({},_0x1fd998,_0x3757a5[_0x0fc2('0x44')]);return db[_0x0fc2('0x30')][_0x0fc2('0x4c')](_0x1fd998)[_0x0fc2('0x29')](handleEntityNotFound(_0x2817eb,null))[_0x0fc2('0x29')](respondWithResult(_0x2817eb,null))[_0x0fc2('0x47')](handleError(_0x2817eb,null));};exports[_0x0fc2('0x4d')]=function(_0x548718,_0x516fb1){return db[_0x0fc2('0x30')][_0x0fc2('0x4d')](_0x548718['body'],{})[_0x0fc2('0x29')](respondWithResult(_0x516fb1,0xc9))['catch'](handleError(_0x516fb1,null));};exports[_0x0fc2('0x4e')]=function(_0xcb5d43,_0x4afaa7){var _0x13f477={'where':{'id':_0xcb5d43[_0x0fc2('0x49')]['id']}},_0x3b1a07={};_0x3b1a07['model']=_[_0x0fc2('0x36')](db[_0x0fc2('0x30')][_0x0fc2('0x31')]);_0x13f477['attributes']=_[_0x0fc2('0x3a')](_0x3b1a07[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0xcb5d43['query'][_0x0fc2('0x3b')]));_0x13f477[_0x0fc2('0x39')]=_0x13f477[_0x0fc2('0x39')]['length']?_0x13f477[_0x0fc2('0x39')]:_0x3b1a07['model'];if(_0xcb5d43[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0x13f477[_0x0fc2('0x4b')]=[{'all':!![]}];}_0x13f477=_[_0x0fc2('0x43')]({},_0x13f477,_0xcb5d43[_0x0fc2('0x44')]);return db[_0x0fc2('0x30')][_0x0fc2('0x4c')](_0x13f477)[_0x0fc2('0x29')](handleEntityNotFound(_0x4afaa7,null))['then'](function(_0x4c8ec1){if(_0x4c8ec1){var _0x4b4adf=_0x4c8ec1[_0x0fc2('0x4f')]({'plain':!![]});_0x4b4adf=qs[_0x0fc2('0x50')](_0x4b4adf,['id',_0x0fc2('0x51'),_0x0fc2('0x52'),_0x0fc2('0x53')]);_0xcb5d43[_0x0fc2('0x54')]=_[_0x0fc2('0x50')](_0xcb5d43[_0x0fc2('0x54')],['id',_0x0fc2('0x51'),_0x0fc2('0x52')]);return db[_0x0fc2('0x55')][_0x0fc2('0x56')](function(_0x164836){return db['UserProfile'][_0x0fc2('0x4d')](_[_0x0fc2('0x43')](_0x4b4adf,_0xcb5d43[_0x0fc2('0x54')]),{'include':_0xcb5d43[_0x0fc2('0x35')][_0x0fc2('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x164836})[_0x0fc2('0x29')](function(_0x2ddf70){var _0x4e6a09=_0x2ddf70[_0x0fc2('0x4f')]({'plain':!![]});return db[_0x0fc2('0x57')]['findAll']({'where':{'userProfileId':_0xcb5d43[_0x0fc2('0x49')]['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x1d86fb){if(_0x1d86fb){return BPromise[_0x0fc2('0x58')](_0x1d86fb,function(_0x15c9e1){return new BPromise(function(_0x4aeb9d,_0x2c406f){if(_0x15c9e1['autoAssociation']===null||_0x15c9e1[_0x0fc2('0x59')]===0x1)_0x4aeb9d(null);return db[_0x0fc2('0x5a')]['findAll']({'where':{'sectionId':_0x15c9e1['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x4830b4){var _0x2bab85=_[_0x0fc2('0x2f')](_0x4830b4,function(_0x5d8219){return qs[_0x0fc2('0x50')](_0x5d8219,['id','createdAt',_0x0fc2('0x52'),_0x0fc2('0x5b')]);});_0x4aeb9d(_0x2bab85);})[_0x0fc2('0x47')](function(_0x14f442){_0x2c406f(_0x14f442);});})['then'](function(_0x4058fd){var _0x31310f=qs[_0x0fc2('0x50')](_0x15c9e1,['id',_0x0fc2('0x51'),'updatedAt']);_0x31310f[_0x0fc2('0x5c')]=_0x4e6a09['id'];if(_0x4058fd)_0x31310f[_0x0fc2('0x5d')]=_0x4058fd;return _0x31310f;})[_0x0fc2('0x29')](function(_0x59e066){return db[_0x0fc2('0x57')][_0x0fc2('0x4d')](_0x59e066,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x164836});});})[_0x0fc2('0x29')](function(){return _0x4e6a09;});}});});});}})[_0x0fc2('0x29')](respondWithResult(_0x4afaa7,0xc9))['catch'](handleError(_0x4afaa7,null));};exports[_0x0fc2('0x28')]=function(_0x587976,_0x49815d){if(_0x587976[_0x0fc2('0x54')]['id']){delete _0x587976['body']['id'];}return db[_0x0fc2('0x30')]['find']({'where':{'id':_0x587976[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x49815d,null))[_0x0fc2('0x29')](saveUpdates(_0x587976[_0x0fc2('0x54')],null))[_0x0fc2('0x29')](respondWithResult(_0x49815d,null))[_0x0fc2('0x47')](handleError(_0x49815d,null));};exports[_0x0fc2('0x2a')]=function(_0x5075b9,_0x1b84d7){return db[_0x0fc2('0x30')]['find']({'where':{'id':_0x5075b9[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x1b84d7,null))[_0x0fc2('0x29')](removeEntity(_0x1b84d7,null))[_0x0fc2('0x47')](handleError(_0x1b84d7,null));};exports[_0x0fc2('0x5e')]=function(_0x276484,_0x88dc67){return db[_0x0fc2('0x30')][_0x0fc2('0x5e')]()[_0x0fc2('0x29')](respondWithResult(_0x88dc67,null))[_0x0fc2('0x47')](handleError(_0x88dc67,null));};exports[_0x0fc2('0x5f')]=function(_0x52d8b6,_0x311a69){var _0x2ac947=_0x52d8b6[_0x0fc2('0x54')];return db[_0x0fc2('0x30')][_0x0fc2('0x4c')]({'where':{'id':_0x52d8b6['params']['id']}})['then'](handleEntityNotFound(_0x311a69,null))['then'](function(_0x326af7){if(_0x326af7){return db[_0x0fc2('0x55')]['transaction'](function(_0xb51fc6){return db[_0x0fc2('0x57')]['destroy']({'where':{'userProfileId':_0x52d8b6[_0x0fc2('0x49')]['id'],'sectionId':_['map'](_0x2ac947,function(_0x1c38e7){return _0x1c38e7[_0x0fc2('0x5b')];})},'transaction':_0xb51fc6})[_0x0fc2('0x29')](function(){var _0x47b998=_[_0x0fc2('0x2f')](_0x2ac947,function(_0x16732f){_0x16732f[_0x0fc2('0x5c')]=_0x52d8b6['params']['id'];return _0x16732f;});var _0x2c57a2=[];return BPromise['each'](_0x47b998,function(_0x44e364){return db['UserProfileSection'][_0x0fc2('0x4d')](_0x44e364,{'include':[{'model':db[_0x0fc2('0x5a')],'as':_0x0fc2('0x5d')}],'raw':!![],'transaction':_0xb51fc6})[_0x0fc2('0x29')](function(_0x12a464){_0x2c57a2[_0x0fc2('0x60')](_0x12a464['get']({'plain':!![]}));});})[_0x0fc2('0x29')](function(){return _0x2c57a2;});});});}})[_0x0fc2('0x29')](function(_0x1e96e8){return _0x1e96e8;})[_0x0fc2('0x29')](respondWithResult(_0x311a69,null))['catch'](handleError(_0x311a69,null));};exports['removeSections']=function(_0x3f89da,_0x32c3a7){var _0x14e993;return db['UserProfile'][_0x0fc2('0x4c')]({'where':{'id':_0x3f89da[_0x0fc2('0x49')]['id']},'attributes':['id',_0x0fc2('0x2d')]})['then'](handleEntityNotFound(_0x32c3a7,null))[_0x0fc2('0x29')](function(_0x494296){if(_0x494296){_0x14e993=_0x494296;return db['UserProfileSection'][_0x0fc2('0x2a')]({'where':{'userProfileId':_0x3f89da[_0x0fc2('0x49')]['id'],'sectionId':_0x3f89da[_0x0fc2('0x35')][_0x0fc2('0x61')]}});}})[_0x0fc2('0x29')](function(){return _0x14e993;})[_0x0fc2('0x29')](respondWithStatusCode(_0x32c3a7,null))[_0x0fc2('0x47')](handleError(_0x32c3a7,null));};exports[_0x0fc2('0x62')]=function(_0x59387e,_0x18bfdb){var _0x36c9a1=[];var _0x33d625=[];return db[_0x0fc2('0x57')]['findAll']({'where':{'userProfileId':_0x59387e['params']['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x250754){_0x36c9a1=_[_0x0fc2('0x42')](_0x250754,function(_0xb334f4){return _0xb334f4['enabled']===0x1||_[_0x0fc2('0x63')]([0x3eb,0x709],_0xb334f4[_0x0fc2('0x5b')]);});if(!_['isEmpty'](_0x36c9a1)){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x3b0c8b){return _0x3b0c8b[_0x0fc2('0x5b')];});}else{return;}})[_0x0fc2('0x29')](function(_0x4cc48f){if(_0x4cc48f)_0x33d625=_0x4cc48f;if(_[_0x0fc2('0x63')](_0x33d625,0x64)){var _0x1442ca=_[_0x0fc2('0x4c')](_0x36c9a1,{'sectionId':0x64});return hasDefaultDashboard(_0x1442ca)[_0x0fc2('0x29')](function(_0x1214dc){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x2f7af6){if(_0x2f7af6[_0x0fc2('0x5b')]===0x64){_0x2f7af6[_0x0fc2('0x64')]=_0x1214dc;}return _0x2f7af6;});});}else{return;}})[_0x0fc2('0x29')](function(_0x1841ad){if(_0x1841ad)_0x36c9a1=_0x1841ad;if(_[_0x0fc2('0x63')](_0x33d625,0x3eb)){var _0x495122=_[_0x0fc2('0x4c')](_0x36c9a1,{'sectionId':0x3eb});return getCustomDashboards(_0x495122)[_0x0fc2('0x29')](function(_0x4dd938){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x3eb750){if(_0x495122[_0x0fc2('0x65')]){if(_0x3eb750[_0x0fc2('0x5b')]===0x3eb){_0x3eb750['subsections']=_0x4dd938;}}else{if(_0x3eb750[_0x0fc2('0x5b')]===0x64){_0x3eb750[_0x0fc2('0x64')]=_0x4dd938;}}return _0x3eb750;});});}else{return;}})['then'](function(_0x29bc2f){if(_0x29bc2f)_0x36c9a1=_0x29bc2f;if(_[_0x0fc2('0x63')](_0x33d625,0x709)){var _0x180b30=_[_0x0fc2('0x4c')](_0x36c9a1,{'sectionId':0x709});return getPlugins(_0x180b30)[_0x0fc2('0x29')](function(_0x4e443a){if(_0x180b30[_0x0fc2('0x65')]){return _[_0x0fc2('0x2f')](_0x36c9a1,function(_0x1cf67a){if(_0x1cf67a[_0x0fc2('0x5b')]===0x709){_0x1cf67a[_0x0fc2('0x64')]=_0x4e443a;}return _0x1cf67a;});}else{var _0x5c9d0c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4e443a};var _0x2803b9=_[_0x0fc2('0x2f')](_0x36c9a1);_0x2803b9[_0x0fc2('0x60')](_0x5c9d0c);return _0x2803b9;}});}else{return;}})['then'](function(_0x46d800){if(_0x46d800)_0x36c9a1=_0x46d800;return _[_0x0fc2('0x42')](_0x36c9a1,[_0x0fc2('0x65'),0x1]);})['then'](respondWithResult(_0x18bfdb,null))[_0x0fc2('0x47')](handleError(_0x18bfdb,null));};function hasDefaultDashboard(_0x498296){var _0x4fd4a5=[0x65];return new BPromise(function(_0x5791a6,_0x30aeb7){try{if(_0x498296[_0x0fc2('0x59')]){_0x5791a6(_0x4fd4a5);}else{return db[_0x0fc2('0x5a')][_0x0fc2('0x66')]({'where':{'sectionId':_0x498296['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0xb5153e){_0xb5153e?_0x5791a6(_0x4fd4a5):_0x5791a6();});}}catch(_0x1155db){_0x30aeb7(_0x1155db);}});}function getCustomDashboards(_0x582356){var _0x59f65d=[];return new BPromise(function(_0x5235c0,_0x475799){try{if(_0x582356[_0x0fc2('0x59')]){return db['Dashboard'][_0x0fc2('0x67')]({'raw':!![]})[_0x0fc2('0x29')](function(_0x4d8215){_0x4d8215[_0x0fc2('0x68')](function(_0x3e2d56){_0x59f65d[_0x0fc2('0x60')](_0x3e2d56['id']+0x1869f);});_0x5235c0(_0x59f65d);});}else{return db[_0x0fc2('0x5a')][_0x0fc2('0x67')]({'where':{'sectionId':_0x582356['id']},'raw':!![]})['then'](function(_0xfa6b15){_0xfa6b15[_0x0fc2('0x68')](function(_0x3a51c9){_0x59f65d[_0x0fc2('0x60')](_0x3a51c9[_0x0fc2('0x69')]+0x1869f);});_0x5235c0(_0x59f65d);});}}catch(_0x21609c){_0x475799(_0x21609c);}});}function getPlugins(_0x2aa648){var _0xfb522c=[];return new BPromise(function(_0x3f227e,_0x129b49){try{if(_0x2aa648[_0x0fc2('0x59')]){return db[_0x0fc2('0x6a')]['findAll']({'raw':!![]})[_0x0fc2('0x29')](function(_0x190f1b){_0x190f1b[_0x0fc2('0x68')](function(_0x3674ed){_0xfb522c['push'](_0x3674ed['id']+0x15b38);});_0x3f227e(_0xfb522c);});}else{return db[_0x0fc2('0x5a')][_0x0fc2('0x67')]({'where':{'sectionId':_0x2aa648['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x22a474){_0x22a474[_0x0fc2('0x68')](function(_0x3a2579){_0xfb522c['push'](_0x3a2579[_0x0fc2('0x69')]+0x15b38);});_0x3f227e(_0xfb522c);});}}catch(_0x24cae7){_0x129b49(_0x24cae7);}});}exports[_0x0fc2('0x6b')]=function(_0x59df06,_0x329db6){return db[_0x0fc2('0x30')][_0x0fc2('0x4c')]({'where':{'id':_0x59df06[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x329db6,null))[_0x0fc2('0x29')](function(_0x220618){if(_0x220618){return db['sequelize']['transaction'](function(_0x5eeead){return db[_0x0fc2('0x57')]['findAll']({'where':{'userProfileId':_0x59df06[_0x0fc2('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x0fc2('0x29')](function(_0x2ac0aa){if(_0x2ac0aa){return db[_0x0fc2('0x57')][_0x0fc2('0x2a')]({'where':{'userProfileId':_0x59df06[_0x0fc2('0x49')]['id'],'id':_[_0x0fc2('0x2f')](_0x2ac0aa,function(_0x43e727){return _0x43e727['id'];})},'transaction':_0x5eeead});}})[_0x0fc2('0x29')](function(_0x2714d6){var _0x300811=_[_0x0fc2('0x2f')](_0x59df06['body'],function(_0x32f710){_0x32f710[_0x0fc2('0x5c')]=_0x59df06[_0x0fc2('0x49')]['id'];return _0x32f710;});return db[_0x0fc2('0x57')][_0x0fc2('0x6c')](_0x300811,{'raw':!![],'transaction':_0x5eeead});})['then'](function(_0x2d10c6){var _0x1a719b=_[_0x0fc2('0x42')](_[_0x0fc2('0x2f')](_0x2d10c6,function(_0x1a8314){return _0x1a8314['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1a719b){return db[_0x0fc2('0x57')][_0x0fc2('0x67')]({'where':{'userProfileId':_0x59df06['params']['id'],'sectionId':_[_0x0fc2('0x2f')](_0x1a719b,function(_0x22f4c8){return _0x22f4c8[_0x0fc2('0x5b')];})},'attributes':['id',_0x0fc2('0x5b')],'raw':!![]})['then'](function(_0x206762){var _0x2613aa=_[_0x0fc2('0x2f')](_0x59df06[_0x0fc2('0x54')],function(_0xd20943){_0xd20943[_0x0fc2('0x5c')]=_0x59df06['params']['id'];return _0xd20943;});return db[_0x0fc2('0x5a')][_0x0fc2('0x6c')](_0x2613aa,{'raw':!![],'transaction':_0x5eeead});});}})[_0x0fc2('0x47')](handleError(_0x329db6,null));});}})[_0x0fc2('0x29')](function(_0x35d2cd){var _0x4dca22=_[_0x0fc2('0x2f')](_0x35d2cd,function(_0x58d4dc){return _0x58d4dc[_0x0fc2('0x4f')]({'plain':!![]});});})[_0x0fc2('0x29')](respondWithResult(_0x329db6,null))['catch'](handleError(_0x329db6,null));};exports[_0x0fc2('0x6d')]=function(_0x29aba9,_0x5414a8,_0xdadda2){return db[_0x0fc2('0x30')]['find']({'where':{'id':_0x29aba9[_0x0fc2('0x49')]['id']}})['then'](handleEntityNotFound(_0x5414a8,null))[_0x0fc2('0x29')](function(_0x507d69){if(_0x507d69){return _0x507d69['removeResources'](_0x29aba9['query'][_0x0fc2('0x61')]);}})[_0x0fc2('0x29')](respondWithStatusCode(_0x5414a8,null))[_0x0fc2('0x47')](handleError(_0x5414a8,null));};exports[_0x0fc2('0x6e')]=function(_0x35ca05,_0x240e8f){var _0x1e5ce3={'raw':![],'where':{}};var _0x1e81d1={};var _0x557816={'count':0x0,'rows':[]};var _0x57c479=_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x6f')];if(typeof _0x57c479===_0x0fc2('0x70')){throw new db[(_0x0fc2('0x71'))][(_0x0fc2('0x72'))](_0x0fc2('0x73'));}var _0x1edbce=_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x74')]||![];var _0x330003=getQueryModels(_0x57c479,_0x1edbce);if(typeof _0x330003['childModel']==='undefined'){throw new db[(_0x0fc2('0x71'))][(_0x0fc2('0x72'))](_0x0fc2('0x75')+_0x57c479+'\x27');}var _0x12223b=[];if(!_[_0x0fc2('0x76')](_0x330003[_0x0fc2('0x77')])){_0x12223b=_0x330003[_0x0fc2('0x77')];}else{_0x12223b=[{'name':_0x57c479}];}return db['UserProfile'][_0x0fc2('0x66')]({'where':{'id':_0x35ca05[_0x0fc2('0x49')]['id']}})[_0x0fc2('0x29')](handleEntityNotFound(_0x240e8f,null))[_0x0fc2('0x29')](function(_0x1d9690){if(_0x1d9690){var _0x14f1b9=[];for(var _0x54858b=0x0;_0x54858b<_0x12223b[_0x0fc2('0x4a')];_0x54858b++){_0x14f1b9['push'](db[_0x0fc2('0x57')]['findOne']({'where':{'userProfileId':_0x1d9690['id'],'name':_0x12223b[_0x54858b][_0x0fc2('0x2d')]},'raw':!![]}));}return BPromise[_0x0fc2('0x78')](_0x14f1b9);}})['then'](function(_0x1c0d2e){var _0x14d6ca=_[_0x0fc2('0x42')](_0x1c0d2e,function(_0x15adf7){return _0x15adf7?_0x15adf7:undefined;});var _0x160274=_['filter'](_0x12223b,[_0x0fc2('0x79'),!![]]);var _0x33c464=_[_0x0fc2('0x76')](_0x14d6ca)&&_[_0x0fc2('0x76')](_0x160274)?null:_[_0x0fc2('0x7a')](_0x160274,_0x14d6ca);if(_0x33c464){var _0x4c9842=[];for(var _0x2f293c=0x0;_0x2f293c<_0x33c464['length'];_0x2f293c++){var _0x439253=_['find'](_0x12223b,function(_0x3a7f2b){return _0x33c464[_0x2f293c]?_0x3a7f2b[_0x0fc2('0x2d')]===_0x33c464[_0x2f293c][_0x0fc2('0x2d')]:null;});if(_0x439253){if(_0x33c464[_0x2f293c]['ignore']){_0x4c9842[_0x0fc2('0x60')](getAllResources(_0x330003[_0x0fc2('0x7b')],_0x33c464[_0x2f293c]));}else{if(!_0x33c464[_0x2f293c][_0x0fc2('0x59')]){_0x4c9842['push'](getAllowedResources(_0x439253,_0x33c464[_0x2f293c],_0x330003[_0x0fc2('0x7b')]));}else{if(_0x439253[_0x0fc2('0x38')]){_0x4c9842[_0x0fc2('0x60')](getAllFilteredResources(_0x439253,_0x33c464[_0x2f293c]));}}}}}return BPromise[_0x0fc2('0x78')](_0x4c9842);}else{return null;}})[_0x0fc2('0x29')](function(_0x58dfa1){var _0x19fbdd=_0x58dfa1;var _0x262d8b=null;if(_0x19fbdd){_0x262d8b=_0x19fbdd[_0x0fc2('0x4a')]===0x1?_0x19fbdd[0x0]:null;}if(_0x262d8b||_0x19fbdd){var _0x27b14a=db[_0x330003[_0x0fc2('0x7b')]]['rawAttributes'];_0x1e81d1[_0x0fc2('0x38')]=_['keys'](_0x27b14a);_0x1e81d1[_0x0fc2('0x35')]=_[_0x0fc2('0x36')](_0x35ca05[_0x0fc2('0x35')]);_0x1e81d1[_0x0fc2('0x37')]=_[_0x0fc2('0x3a')](_0x1e81d1[_0x0fc2('0x38')],_0x1e81d1[_0x0fc2('0x35')]);_0x1e5ce3[_0x0fc2('0x39')]=_['intersection'](_0x1e81d1[_0x0fc2('0x38')],qs[_0x0fc2('0x3b')](_0x35ca05['query'][_0x0fc2('0x3b')]));_0x1e5ce3[_0x0fc2('0x39')]=_0x1e5ce3['attributes']['length']?_0x1e5ce3['attributes']:_0x1e81d1['model'];if(!_0x35ca05['query'][_0x0fc2('0x3c')](_0x0fc2('0x3d'))){_0x1e5ce3[_0x0fc2('0x22')]=qs[_0x0fc2('0x22')](_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x22')]);_0x1e5ce3[_0x0fc2('0x21')]=qs['offset'](_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x21')]);}_0x1e5ce3[_0x0fc2('0x3e')]=qs[_0x0fc2('0x3f')](_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x3f')]);_0x1e5ce3[_0x0fc2('0x40')]=qs[_0x0fc2('0x37')](_['pick'](_0x35ca05[_0x0fc2('0x35')],_0x1e81d1[_0x0fc2('0x37')]));if(_0x35ca05[_0x0fc2('0x35')]['filter']){_0x1e5ce3[_0x0fc2('0x40')]=_[_0x0fc2('0x43')](_0x1e5ce3[_0x0fc2('0x40')],{'$or':_[_0x0fc2('0x2f')](_0x27b14a,function(_0x3568a9){if(_0x3568a9[_0x0fc2('0x33')][_0x0fc2('0x34')]!==_0x0fc2('0x7c')){var _0x412e28={};_0x412e28[_0x3568a9[_0x0fc2('0x7d')]]={'$like':'%'+_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x42')]+'%'};return _0x412e28;}})});}var _0x408c71=[];if(_0x262d8b){var _0x1b1d2d=_[_0x0fc2('0x4c')](_0x12223b,[_0x0fc2('0x2d'),_0x262d8b[_0x0fc2('0x2d')]]);if(_0x1b1d2d[_0x0fc2('0x7d')]){var _0x5986c8={};if(_0x330003[_0x0fc2('0x7b')]===_0x0fc2('0x7e')){_0x5986c8[_0x1b1d2d[_0x0fc2('0x7f')]]=_[_0x0fc2('0x2f')](_0x262d8b['associatedResources'],'id');}else{_0x5986c8[_0x1b1d2d[_0x0fc2('0x7f')]]=_0x262d8b[_0x0fc2('0x80')];}_0x408c71[_0x0fc2('0x60')](_0x5986c8);}else{_0x1e5ce3[_0x0fc2('0x40')]['id']=_0x262d8b['associatedResources'];}}else{for(var _0x27f5e6=0x0;_0x27f5e6<_0x19fbdd[_0x0fc2('0x4a')];_0x27f5e6++){var _0x1b1d2d=_[_0x0fc2('0x4c')](_0x12223b,[_0x0fc2('0x2d'),_0x19fbdd[_0x27f5e6]['name']]);if(_0x1b1d2d['field']){var _0x5986c8={};_0x5986c8[_0x1b1d2d[_0x0fc2('0x7f')]]=_0x19fbdd[_0x27f5e6][_0x0fc2('0x80')];_0x408c71[_0x0fc2('0x60')](_0x5986c8);}else{if(!_0x1e5ce3['where']['id'])_0x1e5ce3[_0x0fc2('0x40')]['id']=[];_0x19fbdd[_0x27f5e6][_0x0fc2('0x80')][_0x0fc2('0x68')](function(_0x29312f){_0x1e5ce3[_0x0fc2('0x40')]['id']['push'](_0x29312f);});}}}if(!_[_0x0fc2('0x76')](_0x408c71)){_0x1e5ce3[_0x0fc2('0x40')]=_[_0x0fc2('0x43')](_0x1e5ce3[_0x0fc2('0x40')],{'$and':{'$or':_0x408c71}});}_0x1e5ce3=_[_0x0fc2('0x43')]({},_0x1e5ce3,_0x35ca05[_0x0fc2('0x44')]);if(_0x262d8b&&!_0x262d8b[_0x0fc2('0x59')]&&_0x330003[_0x0fc2('0x7b')]==='AnalyticExtractedReport'){if(_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x45')]){_0x1e5ce3[_0x0fc2('0x4b')]=[{'all':!![]}];}return db[_0x330003[_0x0fc2('0x7b')]][_0x0fc2('0x67')](_0x1e5ce3)[_0x0fc2('0x29')](function(_0xfd615a){var _0x3b7e3f=[];_0xfd615a[_0x0fc2('0x68')](function(_0x20533c){var _0x3f587a;switch(_0x20533c[_0x0fc2('0x81')]){case _0x0fc2('0x82'):_0x3f587a=_[_0x0fc2('0x4c')](_0x262d8b[_0x0fc2('0x80')],function(_0x4a8f4f){return _0x4a8f4f['id']===_0x20533c[_0x0fc2('0x83')]&&_0x4a8f4f[_0x0fc2('0x33')]===_0x0fc2('0x84');});break;case'custom':_0x3f587a=_[_0x0fc2('0x4c')](_0x262d8b['associatedResources'],function(_0x4d4eff){return _0x4d4eff['id']===_0x20533c[_0x0fc2('0x83')]&&_0x4d4eff['type']===_0x0fc2('0x85');});break;}if(_0x3f587a)_0x3b7e3f[_0x0fc2('0x60')](_0x20533c);});_0x557816[_0x0fc2('0x20')]=_0x3b7e3f[_0x0fc2('0x4a')];_0x557816[_0x0fc2('0x46')]=_0x3b7e3f;return _0x557816;});}else{return db[_0x330003[_0x0fc2('0x7b')]][_0x0fc2('0x20')]({'where':_0x1e5ce3['where']})[_0x0fc2('0x29')](function(_0x4c3976){_0x557816['count']=_0x4c3976;if(_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x45')]){if(_0x330003[_0x0fc2('0x7b')]===_0x0fc2('0x86')){_0x1e5ce3[_0x0fc2('0x4b')]=[{'model':db[_0x0fc2('0x87')],'as':_0x0fc2('0x88'),'attributes':['id',_0x0fc2('0x2d'),_0x0fc2('0x89')],'required':_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x8a')]?!![]:![]},{'model':db['Tag'],'as':_0x0fc2('0x8b'),'attributes':['id',_0x0fc2('0x2d'),'color'],'through':_0x35ca05['query'][_0x0fc2('0x8a')]?{'attributes':[],'where':{'TagId':_0x35ca05['query'][_0x0fc2('0x8a')]||undefined}}:{},'required':_0x35ca05[_0x0fc2('0x35')][_0x0fc2('0x8a')]?!![]:![]}];}else{_0x1e5ce3[_0x0fc2('0x4b')]=[{'all':!![]}];}}return db[_0x330003[_0x0fc2('0x7b')]][_0x0fc2('0x67')](_0x1e5ce3);})[_0x0fc2('0x29')](function(_0x1c25af){_0x557816[_0x0fc2('0x46')]=_0x1c25af;return _0x557816;});}}else{return _0x557816;}})[_0x0fc2('0x29')](respondWithFilteredResult(_0x240e8f,_0x1e5ce3))[_0x0fc2('0x47')](handleError(_0x240e8f,null));};function getAllResources(_0x31c54a,_0x51dad3){return new BPromise(function(_0x59f7f0,_0x2d133a){if(_0x51dad3){var _0x5f31a7=_0x51dad3[_0x0fc2('0x42')]?{[_0x51dad3['filter'][_0x0fc2('0x7d')]]:_0x51dad3[_0x0fc2('0x42')]['value']}:undefined;return db[_0x31c54a][_0x0fc2('0x67')]({'where':_0x5f31a7,'raw':!![]})[_0x0fc2('0x29')](function(_0x4b9e25){_0x51dad3[_0x0fc2('0x80')]=_['map'](_0x4b9e25,'id');_0x59f7f0(_0x51dad3);})[_0x0fc2('0x47')](function(_0x3ff048){_0x2d133a(_0x3ff048);});}else{_0x59f7f0(null);}});}function getAllFilteredResources(_0x32ba0f,_0xe105e4){return new BPromise(function(_0x13f98a,_0x353c50){var _0x1f6261=_0x32ba0f[_0x0fc2('0x42')]?{[_0x32ba0f[_0x0fc2('0x42')]['field']]:_0x32ba0f[_0x0fc2('0x42')][_0x0fc2('0x8c')]}:undefined;return db[_0x32ba0f[_0x0fc2('0x38')]][_0x0fc2('0x67')]({'where':_0x1f6261,'raw':!![]})[_0x0fc2('0x29')](function(_0x2ae304){_0xe105e4[_0x0fc2('0x80')]=_[_0x0fc2('0x2f')](_0x2ae304,function(_0x406601){return _0x406601[_0x0fc2('0x2d')];});_0x13f98a(_0xe105e4);})['catch'](function(_0x2c0f5b){_0x353c50(_0x2c0f5b);});});}function getAllowedResources(_0x595620,_0x16dc6c,_0x45a21a){return new BPromise(function(_0x159bb5,_0x34ef13){if(_0x16dc6c){return db[_0x0fc2('0x5a')][_0x0fc2('0x67')]({'where':{'sectionId':_0x16dc6c['id']},'raw':!![]})[_0x0fc2('0x29')](function(_0x1c3838){if(_0x595620[_0x0fc2('0x7d')]&&_0x595620[_0x0fc2('0x7d')]!=='id'){_0x16dc6c[_0x0fc2('0x80')]=_[_0x0fc2('0x2f')](_0x1c3838,function(_0x588904){return _0x588904[_0x595620[_0x0fc2('0x7d')]];});}else{if(_0x45a21a==='AnalyticExtractedReport'){_0x16dc6c[_0x0fc2('0x80')]=_[_0x0fc2('0x2f')](_0x1c3838,function(_0x4808a0){return{'id':_0x4808a0[_0x0fc2('0x69')],'type':_0x4808a0[_0x0fc2('0x33')]};});}else{_0x16dc6c['associatedResources']=_['map'](_0x1c3838,function(_0x35746d){return _0x35746d[_0x0fc2('0x69')];});}}_0x159bb5(_0x16dc6c);})[_0x0fc2('0x47')](function(_0x36d60b){_0x34ef13(_0x36d60b);});}else{_0x159bb5(null);}});}function getQueryModels(_0x181ab3,_0x6d5772){var _0x22025d=_0x181ab3[_0x0fc2('0x8d')]();var _0x539682={'childModel':undefined,'parentSections':[]};switch(_0x22025d){case'squareprojects':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x8e');break;case _0x0fc2('0x8f'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x90');break;case'squarerecordings':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x91');_0x539682[_0x0fc2('0x77')]=[{'name':_0x0fc2('0x92'),'field':'name','foreignKey':_0x0fc2('0x93')}];break;case _0x0fc2('0x94'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x95');break;case'contacts':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x86');_0x539682[_0x0fc2('0x77')]=[{'name':_0x0fc2('0x96'),'field':'id','foreignKey':_0x0fc2('0x97')}];break;case'lists':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x98');break;case _0x0fc2('0x99'):_0x539682[_0x0fc2('0x7b')]='CmCompany';break;case _0x0fc2('0x9a'):_0x539682['childModel']='CmCustomField';break;case _0x0fc2('0x9b'):_0x539682[_0x0fc2('0x7b')]='ChatQueue';break;case _0x0fc2('0x9c'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x9d');break;case'faxqueues':_0x539682[_0x0fc2('0x7b')]='FaxQueue';break;case'faxaccounts':_0x539682[_0x0fc2('0x7b')]='FaxAccount';break;case'inboundroutes':case _0x0fc2('0x9e'):case _0x0fc2('0x9f'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa0');break;case _0x0fc2('0xa1'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa2');break;case'voicemails':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa3');break;case _0x0fc2('0xa4'):_0x539682['childModel']='VoiceRecording';_0x539682[_0x0fc2('0x77')]=[{'name':_0x0fc2('0xa5'),'field':_0x0fc2('0x2d'),'foreignKey':_0x0fc2('0xa6'),'model':_0x0fc2('0xa7'),'filter':{'field':'role','value':[_0x0fc2('0xa8')]}},{'name':_0x0fc2('0xa9'),'field':'name','foreignKey':_0x0fc2('0xa6'),'model':_0x0fc2('0xa7'),'filter':{'field':_0x0fc2('0xaa'),'value':[_0x0fc2('0xab')]}},{'name':_0x0fc2('0xac'),'field':_0x0fc2('0x2d'),'foreignKey':_0x0fc2('0xad'),'model':_0x0fc2('0xae'),'filter':{'field':_0x0fc2('0x33'),'value':['inbound']}},{'name':_0x0fc2('0xaf'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x0fc2('0x33'),'value':[_0x0fc2('0xb0')]}}];break;case _0x0fc2('0xb1'):_0x539682[_0x0fc2('0x7b')]='VoiceMusicOnHold';break;case _0x0fc2('0xb2'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xb3');break;case _0x0fc2('0xb4'):_0x539682[_0x0fc2('0x7b')]='VoicePrefix';break;case _0x0fc2('0xb5'):_0x539682[_0x0fc2('0x7b')]='Campaign';break;case _0x0fc2('0xb6'):_0x539682['childModel']=_0x0fc2('0xb7');break;case'mailaccounts':_0x539682['childModel']=_0x0fc2('0xb8');break;case _0x0fc2('0xb9'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xba');break;case _0x0fc2('0xbb'):_0x539682['childModel']='OpenchannelQueue';break;case'openchannelaccounts':_0x539682[_0x0fc2('0x7b')]='OpenchannelAccount';break;case _0x0fc2('0xbc'):_0x539682['childModel']=_0x0fc2('0xbd');break;case _0x0fc2('0xbe'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xbf');break;case'whatsappqueues':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xc0');break;case _0x0fc2('0xc1'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xc2');break;case _0x0fc2('0xc3'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xc4');break;case _0x0fc2('0xc5'):case _0x0fc2('0xc6'):_0x539682['childModel']=_0x0fc2('0xae');if(_0x6d5772){_0x539682[_0x0fc2('0x77')]=[{'name':'VoiceQueues'},{'name':_0x0fc2('0xaf')}];}break;case _0x0fc2('0xc7'):case _0x0fc2('0xc8'):case'telephones':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa7');if(_0x6d5772){_0x539682['parentSections']=[{'name':_0x0fc2('0xc9'),'filter':{'field':_0x0fc2('0xaa'),'value':[_0x0fc2('0xca'),_0x0fc2('0xcb')]},'ignore':!![]},{'name':_0x0fc2('0xa5')},{'name':_0x0fc2('0xa9')}];}break;case _0x0fc2('0xcc'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xcd');break;case _0x0fc2('0xce'):_0x539682['childModel']=_0x0fc2('0xcf');break;case'freshdeskaccounts':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xd0');break;case _0x0fc2('0xd1'):_0x539682[_0x0fc2('0x7b')]='SugarcrmAccount';break;case _0x0fc2('0xd2'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xd3');break;case _0x0fc2('0xd4'):_0x539682[_0x0fc2('0x7b')]='ZohoAccount';break;case _0x0fc2('0xd5'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xa7');break;case _0x0fc2('0xd6'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xd7');break;case _0x0fc2('0xd8'):_0x539682['childModel']=_0x0fc2('0xd9');break;case _0x0fc2('0xda'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xdb');break;case _0x0fc2('0xdc'):_0x539682['childModel']=_0x0fc2('0xdd');break;case _0x0fc2('0xde'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xdf');break;case _0x0fc2('0xe0'):_0x539682['childModel']=_0x0fc2('0xe1');break;case'sounds':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xe2');break;case'tags':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x87');break;case _0x0fc2('0xe3'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xe4');break;case _0x0fc2('0xe5'):_0x539682['childModel']=_0x0fc2('0xe6');break;case'trunks':_0x539682['childModel']=_0x0fc2('0xe7');break;case'variables':_0x539682['childModel']=_0x0fc2('0xe8');break;case _0x0fc2('0xe9'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x6a');break;case'extractedreports':_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0x7e');_0x539682['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x0fc2('0x83')}];break;case _0x0fc2('0xea'):_0x539682[_0x0fc2('0x7b')]=_0x0fc2('0xeb');break;case _0x0fc2('0xc1'):_0x539682['childModel']=_0x0fc2('0xc2');break;default:return _0x539682;}return _0x539682;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3c1440b..0804eda 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 _0xac57=['UserProfile','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xc23a26,_0x283345){var _0x13e139=function(_0x3e8918){while(--_0x3e8918){_0xc23a26['push'](_0xc23a26['shift']());}};_0x13e139(++_0x283345);}(_0xac57,0x136));var _0x7ac5=function(_0x1a362a,_0x532d2e){_0x1a362a=_0x1a362a-0x0;var _0x1c6fc4=_0xac57[_0x1a362a];return _0x1c6fc4;};'use strict';var EventEmitter=require(_0x7ac5('0x0'));var UserProfile=require(_0x7ac5('0x1'))['db'][_0x7ac5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7ac5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7ac5('0x4')};function emitEvent(_0x6518f7){return function(_0x5dfd48,_0x5766aa,_0x3099e3){UserProfileEvents[_0x7ac5('0x5')](_0x6518f7+':'+_0x5dfd48['id'],_0x5dfd48);UserProfileEvents[_0x7ac5('0x5')](_0x6518f7,_0x5dfd48);_0x3099e3(null);};}for(var e in events){if(events[_0x7ac5('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7ac5('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x005b=['exports','events','../../mysqldb','UserProfile','save','update','emit','hook'];(function(_0x1bb768,_0x325823){var _0x1817fc=function(_0x390db8){while(--_0x390db8){_0x1bb768['push'](_0x1bb768['shift']());}};_0x1817fc(++_0x325823);}(_0x005b,0x1a1));var _0xb005=function(_0x58e85b,_0x45680e){_0x58e85b=_0x58e85b-0x0;var _0x2c5859=_0x005b[_0x58e85b];return _0x2c5859;};'use strict';var EventEmitter=require(_0xb005('0x0'));var UserProfile=require(_0xb005('0x1'))['db'][_0xb005('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb005('0x3'),'afterUpdate':_0xb005('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20ab7b){return function(_0x2ebb67,_0x38dad1,_0x52b01f){UserProfileEvents[_0xb005('0x5')](_0x20ab7b+':'+_0x2ebb67['id'],_0x2ebb67);UserProfileEvents[_0xb005('0x5')](_0x20ab7b,_0x2ebb67);_0x52b01f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xb005('0x6')](e,emitEvent(event));}}module[_0xb005('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 91041e1..2cc04c0 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 _0xf12e=['UserProfile','util','../../config/logger','bluebird','request-promise','rimraf','./userProfile.attributes','exports','define'];(function(_0x3ffcf3,_0xbea246){var _0x54104a=function(_0xf28336){while(--_0xf28336){_0x3ffcf3['push'](_0x3ffcf3['shift']());}};_0x54104a(++_0xbea246);}(_0xf12e,0x1f0));var _0xef12=function(_0x32017c,_0x3991d4){_0x32017c=_0x32017c-0x0;var _0xca9140=_0xf12e[_0x32017c];return _0xca9140;};'use strict';var _=require('lodash');var util=require(_0xef12('0x0'));var logger=require(_0xef12('0x1'))('api');var moment=require('moment');var BPromise=require(_0xef12('0x2'));var rp=require(_0xef12('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef12('0x4'));var config=require('../../config/environment');var attributes=require(_0xef12('0x5'));module[_0xef12('0x6')]=function(_0x3ca57f,_0x5e85ed){return _0x3ca57f[_0xef12('0x7')](_0xef12('0x8'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7c8=['bluebird','request-promise','path','rimraf','exports','user_profiles','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc7c8,0x1df));var _0x8c7c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc7c8[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x8c7c('0x0'));var util=require(_0x8c7c('0x1'));var logger=require(_0x8c7c('0x2'))(_0x8c7c('0x3'));var moment=require(_0x8c7c('0x4'));var BPromise=require(_0x8c7c('0x5'));var rp=require(_0x8c7c('0x6'));var fs=require('fs');var path=require(_0x8c7c('0x7'));var rimraf=require(_0x8c7c('0x8'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0x8c7c('0x9')]=function(_0x24d915,_0x2144fd){return _0x24d915['define']('UserProfile',attributes,{'tableName':_0x8c7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d0d994b..fd9eff3 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 _0xac9d=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x217ef4,_0x2a9025){var _0x531d31=function(_0x385958){while(--_0x385958){_0x217ef4['push'](_0x217ef4['shift']());}};_0x531d31(++_0x2a9025);}(_0xac9d,0x14d));var _0xdac9=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xac9d[_0x71e493];return _0x3d40ab;};'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});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('UserProfile,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});} \ No newline at end of file +var _0x5d58=['localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x36608d,_0x16a803){_0x36608d=_0x36608d-0x0;var _0x5a8f09=_0x5d58[_0x36608d];return _0x5a8f09;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});config[_0x85d5('0x7')]=_['defaults'](config[_0x85d5('0x7')],{'host':_0x85d5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d5('0x7')]));require('./userProfile.socket')[_0x85d5('0x9')](socket);function respondWithRpcPromise(_0x2ce6b9,_0x258f0c,_0x488dcb){return new BPromise(function(_0x499b36,_0x4e147a){return client[_0x85d5('0xa')](_0x2ce6b9,_0x488dcb)[_0x85d5('0xb')](function(_0xde1063){logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));logger[_0x85d5('0xf')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x258f0c,'request\x20sent',JSON['stringify'](_0xde1063));if(_0xde1063[_0x85d5('0x10')]){if(_0xde1063[_0x85d5('0x10')][_0x85d5('0x11')]===0x1f4){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x4e147a(_0xde1063['error'][_0x85d5('0x12')]);}logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x499b36(_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);}else{logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));_0x499b36(_0xde1063[_0x85d5('0x13')][_0x85d5('0x12')]);}})[_0x85d5('0x14')](function(_0x3df634){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0x3df634);_0x4e147a(_0x3df634);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e313c68..3f10790 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 _0x3447=['update','emit','removeListener','userProfile:','./userProfile.events','save','remove'];(function(_0x189981,_0x1d4d5a){var _0x13f0ce=function(_0x38ca8f){while(--_0x38ca8f){_0x189981['push'](_0x189981['shift']());}};_0x13f0ce(++_0x1d4d5a);}(_0x3447,0x170));var _0x7344=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x3447[_0x3070dc];return _0x431489;};'use strict';var UserProfileEvents=require(_0x7344('0x0'));var events=[_0x7344('0x1'),_0x7344('0x2'),_0x7344('0x3')];function createListener(_0x11aea5,_0xb4695c){return function(_0x29aff7){_0xb4695c[_0x7344('0x4')](_0x11aea5,_0x29aff7);};}function removeListener(_0x59be46,_0x34396d){return function(){UserProfileEvents[_0x7344('0x5')](_0x59be46,_0x34396d);};}exports['register']=function(_0x435c3b){for(var _0xdbba67=0x0,_0x903647=events['length'];_0xdbba67<_0x903647;_0xdbba67++){var _0x4bb32d=events[_0xdbba67];var _0x220b32=createListener(_0x7344('0x6')+_0x4bb32d,_0x435c3b);UserProfileEvents['on'](_0x4bb32d,_0x220b32);}}; \ No newline at end of file +var _0x3729=['update','removeListener','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x5c956b,_0xa87d11){var _0xaff46a=function(_0x463d89){while(--_0x463d89){_0x5c956b['push'](_0x5c956b['shift']());}};_0xaff46a(++_0xa87d11);}(_0x3729,0x155));var _0x9372=function(_0x25777f,_0x4dd156){_0x25777f=_0x25777f-0x0;var _0x2df6a3=_0x3729[_0x25777f];return _0x2df6a3;};'use strict';var UserProfileEvents=require(_0x9372('0x0'));var events=[_0x9372('0x1'),_0x9372('0x2'),_0x9372('0x3')];function createListener(_0x3d03f6,_0x2f0a50){return function(_0x57d9c3){_0x2f0a50['emit'](_0x3d03f6,_0x57d9c3);};}function removeListener(_0x4de3cb,_0x23adca){return function(){UserProfileEvents[_0x9372('0x4')](_0x4de3cb,_0x23adca);};}exports[_0x9372('0x5')]=function(_0x15c606){for(var _0x1c9714=0x0,_0x2f3327=events[_0x9372('0x6')];_0x1c9714<_0x2f3327;_0x1c9714++){var _0x4bd96f=events[_0x1c9714];var _0x5033a0=createListener(_0x9372('0x7')+_0x4bd96f,_0x15c606);UserProfileEvents['on'](_0x4bd96f,_0x5033a0);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 159608a..7989cb4 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 _0x4dd2=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x4dd2,0xf1));var _0x24dd=function(_0x40eec9,_0x817a67){_0x40eec9=_0x40eec9-0x0;var _0xfee890=_0x4dd2[_0x40eec9];return _0xfee890;};'use strict';var multer=require('multer');var util=require(_0x24dd('0x0'));var path=require(_0x24dd('0x1'));var timeout=require(_0x24dd('0x2'));var express=require('express');var router=express[_0x24dd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x24dd('0x4'));var config=require('../../config/environment');var controller=require(_0x24dd('0x5'));router[_0x24dd('0x6')]('/',auth[_0x24dd('0x7')](),controller['index']);router['get'](_0x24dd('0x8'),auth[_0x24dd('0x7')](),controller[_0x24dd('0x9')]);router[_0x24dd('0x6')](_0x24dd('0xa'),auth['isAuthenticated'](),controller[_0x24dd('0xb')]);router[_0x24dd('0xc')]('/',auth[_0x24dd('0x7')](),controller[_0x24dd('0xd')]);router[_0x24dd('0xe')]('/:id',auth[_0x24dd('0x7')](),controller[_0x24dd('0xf')]);router[_0x24dd('0x10')](_0x24dd('0xa'),auth[_0x24dd('0x7')](),controller[_0x24dd('0x11')]);module[_0x24dd('0x12')]=router; \ No newline at end of file +var _0xaca0=['delete','destroy','util','path','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x3604fd,_0x3c6297){var _0x18c989=function(_0x465f63){while(--_0x465f63){_0x3604fd['push'](_0x3604fd['shift']());}};_0x18c989(++_0x3c6297);}(_0xaca0,0xd2));var _0x0aca=function(_0x33116f,_0xcc6aef){_0x33116f=_0x33116f-0x0;var _0x364b5c=_0xaca0[_0x33116f];return _0x364b5c;};'use strict';var multer=require('multer');var util=require(_0x0aca('0x0'));var path=require(_0x0aca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0aca('0x2'));var config=require('../../config/environment');var controller=require(_0x0aca('0x3'));router[_0x0aca('0x4')]('/',auth[_0x0aca('0x5')](),controller[_0x0aca('0x6')]);router[_0x0aca('0x4')]('/describe',auth[_0x0aca('0x5')](),controller[_0x0aca('0x7')]);router['get'](_0x0aca('0x8'),auth[_0x0aca('0x5')](),controller[_0x0aca('0x9')]);router[_0x0aca('0xa')]('/',auth[_0x0aca('0x5')](),controller[_0x0aca('0xb')]);router[_0x0aca('0xc')](_0x0aca('0x8'),auth['isAuthenticated'](),controller[_0x0aca('0xd')]);router[_0x0aca('0xe')](_0x0aca('0x8'),auth['isAuthenticated'](),controller[_0x0aca('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 64989a9..dd949b2 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 _0xaee4=['INTEGER','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaee4,0x1de));var _0x4aee=function(_0x163119,_0x9c69b4){_0x163119=_0x163119-0x0;var _0x234d1a=_0xaee4[_0x163119];return _0x234d1a;};'use strict';var Sequelize=require(_0x4aee('0x0'));module[_0x4aee('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4aee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4aee('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xb007=['INTEGER','sequelize'];(function(_0x5060b9,_0x5ad2a9){var _0x492912=function(_0x3bc514){while(--_0x3bc514){_0x5060b9['push'](_0x5060b9['shift']());}};_0x492912(++_0x5ad2a9);}(_0xb007,0x1bb));var _0x7b00=function(_0x3fcaa7,_0x308f38){_0x3fcaa7=_0x3fcaa7-0x0;var _0x3b4015=_0xb007[_0x3fcaa7];return _0x3b4015;};'use strict';var Sequelize=require(_0x7b00('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7b00('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9176c6b..9d76518 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 _0x3baf=['VIRTUAL','options','count','findAll','rows','show','params','keys','includeAll','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','error','stack','send','UserProfileResource','rawAttributes','fieldName','type','name','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where'];(function(_0x1ad447,_0x5457ae){var _0x23afb7=function(_0x3a8442){while(--_0x3a8442){_0x1ad447['push'](_0x1ad447['shift']());}};_0x23afb7(++_0x5457ae);}(_0x3baf,0xf7));var _0xf3ba=function(_0x42152e,_0x509b93){_0x42152e=_0x42152e-0x0;var _0x57bb09=_0x3baf[_0x42152e];return _0x57bb09;};'use strict';var pdf=require(_0xf3ba('0x0'));var emlformat=require(_0xf3ba('0x1'));var rimraf=require(_0xf3ba('0x2'));var zipdir=require(_0xf3ba('0x3'));var jsonpatch=require(_0xf3ba('0x4'));var rp=require(_0xf3ba('0x5'));var moment=require(_0xf3ba('0x6'));var BPromise=require(_0xf3ba('0x7'));var Mustache=require(_0xf3ba('0x8'));var util=require(_0xf3ba('0x9'));var path=require(_0xf3ba('0xa'));var sox=require(_0xf3ba('0xb'));var csv=require(_0xf3ba('0xc'));var ejs=require(_0xf3ba('0xd'));var fs=require('fs');var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var db=require(_0xf3ba('0x1b'))['db'];function respondWithStatusCode(_0x46c2cf,_0x85939e){_0x85939e=_0x85939e||0xcc;return function(_0x26cefe){if(_0x26cefe){return _0x46c2cf[_0xf3ba('0x1c')](_0x85939e);}return _0x46c2cf[_0xf3ba('0x1d')](_0x85939e)[_0xf3ba('0x1e')]();};}function respondWithResult(_0x505b8d,_0x327675){_0x327675=_0x327675||0xc8;return function(_0x56816b){if(_0x56816b){return _0x505b8d[_0xf3ba('0x1d')](_0x327675)[_0xf3ba('0x1f')](_0x56816b);}};}function respondWithFilteredResult(_0x4717be,_0x1e2969){return function(_0x235c8a){if(_0x235c8a){var _0x53f848=_0x235c8a['count'],_0x301856=_0x1e2969[_0xf3ba('0x20')],_0x29e45b=_0x1e2969[_0xf3ba('0x20')]+_0x1e2969[_0xf3ba('0x21')],_0x13d899;if(_0x29e45b>=_0x53f848){_0x29e45b=_0x53f848;_0x13d899=0xc8;}else{_0x13d899=0xce;}_0x4717be[_0xf3ba('0x1d')](_0x13d899);return _0x4717be['set'](_0xf3ba('0x22'),_0x301856+'-'+_0x29e45b+'/'+_0x53f848)[_0xf3ba('0x1f')](_0x235c8a);}return null;};}function patchUpdates(_0x4e601c){return function(_0x479d65){try{jsonpatch[_0xf3ba('0x23')](_0x479d65,_0x4e601c,!![]);}catch(_0x2bd5b8){return BPromise[_0xf3ba('0x24')](_0x2bd5b8);}return _0x479d65['save']();};}function saveUpdates(_0x375bcf,_0x327723){return function(_0x35d6d4){if(_0x35d6d4){return _0x35d6d4[_0xf3ba('0x25')](_0x375bcf)[_0xf3ba('0x26')](function(_0x3480cb){return _0x3480cb;});}return null;};}function removeEntity(_0x168961,_0x4caf74){return function(_0x4e94a7){if(_0x4e94a7){return _0x4e94a7['destroy']()[_0xf3ba('0x26')](function(){_0x168961[_0xf3ba('0x1d')](0xcc)[_0xf3ba('0x1e')]();});}};}function handleEntityNotFound(_0x3b6404,_0x2cc01a){return function(_0x545ee1){if(!_0x545ee1){_0x3b6404['sendStatus'](0x194);}return _0x545ee1;};}function handleError(_0x37fdda,_0xd6c2da){_0xd6c2da=_0xd6c2da||0x1f4;return function(_0x5410a2){logger[_0xf3ba('0x27')](_0x5410a2[_0xf3ba('0x28')]);if(_0x5410a2['name']){delete _0x5410a2['name'];}_0x37fdda[_0xf3ba('0x1d')](_0xd6c2da)[_0xf3ba('0x29')](_0x5410a2);};}exports['index']=function(_0x18a4fb,_0x318817){var _0x15ac44={},_0x5a880e={},_0x29ed57={'count':0x0,'rows':[]};var _0x4e1708=_['map'](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')],function(_0x5b4e0d){return{'name':_0x5b4e0d[_0xf3ba('0x2c')],'type':_0x5b4e0d[_0xf3ba('0x2d')]['key']};});_0x5a880e['model']=_['map'](_0x4e1708,_0xf3ba('0x2e'));_0x5a880e[_0xf3ba('0x2f')]=_['keys'](_0x18a4fb[_0xf3ba('0x2f')]);_0x5a880e['filters']=_['intersection'](_0x5a880e[_0xf3ba('0x30')],_0x5a880e[_0xf3ba('0x2f')]);_0x15ac44[_0xf3ba('0x31')]=_[_0xf3ba('0x32')](_0x5a880e[_0xf3ba('0x30')],qs[_0xf3ba('0x33')](_0x18a4fb['query'][_0xf3ba('0x33')]));_0x15ac44['attributes']=_0x15ac44[_0xf3ba('0x31')][_0xf3ba('0x34')]?_0x15ac44['attributes']:_0x5a880e[_0xf3ba('0x30')];if(!_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x35')](_0xf3ba('0x36'))){_0x15ac44['limit']=qs[_0xf3ba('0x21')](_0x18a4fb['query']['limit']);_0x15ac44['offset']=qs[_0xf3ba('0x20')](_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x20')]);}_0x15ac44[_0xf3ba('0x37')]=qs[_0xf3ba('0x38')](_0x18a4fb['query'][_0xf3ba('0x38')]);_0x15ac44['where']=qs[_0xf3ba('0x39')](_['pick'](_0x18a4fb[_0xf3ba('0x2f')],_0x5a880e[_0xf3ba('0x39')]),_0x4e1708);if(_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x3a')]){_0x15ac44['where']=_[_0xf3ba('0x3b')](_0x15ac44[_0xf3ba('0x3c')],{'$or':_['map'](_0x4e1708,function(_0x3d844d){if(_0x3d844d[_0xf3ba('0x2d')]!==_0xf3ba('0x3d')){var _0x498570={};_0x498570[_0x3d844d[_0xf3ba('0x2e')]]={'$like':'%'+_0x18a4fb[_0xf3ba('0x2f')][_0xf3ba('0x3a')]+'%'};return _0x498570;}})});}_0x15ac44=_['merge']({},_0x15ac44,_0x18a4fb[_0xf3ba('0x3e')]);var _0x527092={'where':_0x15ac44[_0xf3ba('0x3c')]};return db['UserProfileResource'][_0xf3ba('0x3f')](_0x527092)[_0xf3ba('0x26')](function(_0x1251b1){_0x29ed57[_0xf3ba('0x3f')]=_0x1251b1;if(_0x18a4fb[_0xf3ba('0x2f')]['includeAll']){_0x15ac44['include']=[{'all':!![]}];}return db[_0xf3ba('0x2a')][_0xf3ba('0x40')](_0x15ac44);})[_0xf3ba('0x26')](function(_0x433752){_0x29ed57[_0xf3ba('0x41')]=_0x433752;return _0x29ed57;})[_0xf3ba('0x26')](respondWithFilteredResult(_0x318817,_0x15ac44))['catch'](handleError(_0x318817,null));};exports[_0xf3ba('0x42')]=function(_0x4b9c9e,_0x42b805){var _0x239e2a={'raw':![],'where':{'id':_0x4b9c9e[_0xf3ba('0x43')]['id']}},_0x2328d5={};_0x2328d5[_0xf3ba('0x30')]=_[_0xf3ba('0x44')](db[_0xf3ba('0x2a')][_0xf3ba('0x2b')]);_0x2328d5['query']=_[_0xf3ba('0x44')](_0x4b9c9e[_0xf3ba('0x2f')]);_0x2328d5[_0xf3ba('0x39')]=_[_0xf3ba('0x32')](_0x2328d5[_0xf3ba('0x30')],_0x2328d5[_0xf3ba('0x2f')]);_0x239e2a[_0xf3ba('0x31')]=_['intersection'](_0x2328d5[_0xf3ba('0x30')],qs[_0xf3ba('0x33')](_0x4b9c9e['query'][_0xf3ba('0x33')]));_0x239e2a[_0xf3ba('0x31')]=_0x239e2a[_0xf3ba('0x31')][_0xf3ba('0x34')]?_0x239e2a[_0xf3ba('0x31')]:_0x2328d5[_0xf3ba('0x30')];if(_0x4b9c9e[_0xf3ba('0x2f')][_0xf3ba('0x45')]){_0x239e2a[_0xf3ba('0x46')]=[{'all':!![]}];}_0x239e2a=_[_0xf3ba('0x3b')]({},_0x239e2a,_0x4b9c9e[_0xf3ba('0x3e')]);return db[_0xf3ba('0x2a')][_0xf3ba('0x47')](_0x239e2a)[_0xf3ba('0x26')](handleEntityNotFound(_0x42b805,null))[_0xf3ba('0x26')](respondWithResult(_0x42b805,null))[_0xf3ba('0x48')](handleError(_0x42b805,null));};exports[_0xf3ba('0x49')]=function(_0x3afc3e,_0x4f251b){return db[_0xf3ba('0x2a')][_0xf3ba('0x49')](_0x3afc3e['body'],{})[_0xf3ba('0x26')](respondWithResult(_0x4f251b,0xc9))[_0xf3ba('0x48')](handleError(_0x4f251b,null));};exports[_0xf3ba('0x25')]=function(_0x36f476,_0x52ef61){if(_0x36f476['body']['id']){delete _0x36f476[_0xf3ba('0x4a')]['id'];}return db[_0xf3ba('0x2a')][_0xf3ba('0x47')]({'where':{'id':_0x36f476[_0xf3ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ef61,null))[_0xf3ba('0x26')](saveUpdates(_0x36f476[_0xf3ba('0x4a')],null))[_0xf3ba('0x26')](respondWithResult(_0x52ef61,null))['catch'](handleError(_0x52ef61,null));};exports[_0xf3ba('0x4b')]=function(_0x425304,_0x3dd531){return db[_0xf3ba('0x2a')][_0xf3ba('0x47')]({'where':{'id':_0x425304[_0xf3ba('0x43')]['id']}})[_0xf3ba('0x26')](handleEntityNotFound(_0x3dd531,null))[_0xf3ba('0x26')](removeEntity(_0x3dd531,null))[_0xf3ba('0x48')](handleError(_0x3dd531,null));};exports[_0xf3ba('0x4c')]=function(_0x534426,_0x5a30f9){return db[_0xf3ba('0x2a')][_0xf3ba('0x4c')]()[_0xf3ba('0x26')](respondWithResult(_0x5a30f9,null))['catch'](handleError(_0x5a30f9,null));}; \ No newline at end of file +var _0x3eea=['UserProfileResource','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xd58fc1,_0x1d931c){var _0xc71c40=function(_0x8f4d82){while(--_0x8f4d82){_0xd58fc1['push'](_0xd58fc1['shift']());}};_0xc71c40(++_0x1d931c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x475e2e,_0x59d51d){_0x475e2e=_0x475e2e-0x0;var _0x47987d=_0x3eea[_0x475e2e];return _0x47987d;};'use strict';var pdf=require(_0xa3ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ee('0x1'));var zipdir=require(_0xa3ee('0x2'));var jsonpatch=require(_0xa3ee('0x3'));var rp=require(_0xa3ee('0x4'));var moment=require(_0xa3ee('0x5'));var BPromise=require(_0xa3ee('0x6'));var Mustache=require(_0xa3ee('0x7'));var util=require(_0xa3ee('0x8'));var path=require(_0xa3ee('0x9'));var sox=require(_0xa3ee('0xa'));var csv=require(_0xa3ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xb'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa3ee('0x14'))['db'];function respondWithStatusCode(_0x30e652,_0x403518){_0x403518=_0x403518||0xcc;return function(_0x4363d1){if(_0x4363d1){return _0x30e652['sendStatus'](_0x403518);}return _0x30e652[_0xa3ee('0x15')](_0x403518)['end']();};}function respondWithResult(_0x43b3bc,_0x20535f){_0x20535f=_0x20535f||0xc8;return function(_0x2c34cf){if(_0x2c34cf){return _0x43b3bc[_0xa3ee('0x15')](_0x20535f)['json'](_0x2c34cf);}};}function respondWithFilteredResult(_0x2a82e5,_0x23df7d){return function(_0x5da681){if(_0x5da681){var _0x5358aa=_0x5da681[_0xa3ee('0x16')],_0x4b2c66=_0x23df7d[_0xa3ee('0x17')],_0x40decb=_0x23df7d['offset']+_0x23df7d[_0xa3ee('0x18')],_0x7277cd;if(_0x40decb>=_0x5358aa){_0x40decb=_0x5358aa;_0x7277cd=0xc8;}else{_0x7277cd=0xce;}_0x2a82e5[_0xa3ee('0x15')](_0x7277cd);return _0x2a82e5[_0xa3ee('0x19')](_0xa3ee('0x1a'),_0x4b2c66+'-'+_0x40decb+'/'+_0x5358aa)[_0xa3ee('0x1b')](_0x5da681);}return null;};}function patchUpdates(_0x4aac0e){return function(_0x377b9d){try{jsonpatch[_0xa3ee('0x1c')](_0x377b9d,_0x4aac0e,!![]);}catch(_0x35fbb2){return BPromise[_0xa3ee('0x1d')](_0x35fbb2);}return _0x377b9d[_0xa3ee('0x1e')]();};}function saveUpdates(_0x3195a7,_0x4f8c56){return function(_0x3f5d70){if(_0x3f5d70){return _0x3f5d70[_0xa3ee('0x1f')](_0x3195a7)['then'](function(_0x3a7cd3){return _0x3a7cd3;});}return null;};}function removeEntity(_0x4e7f32,_0x2fab5){return function(_0x29df43){if(_0x29df43){return _0x29df43[_0xa3ee('0x20')]()[_0xa3ee('0x21')](function(){_0x4e7f32[_0xa3ee('0x15')](0xcc)[_0xa3ee('0x22')]();});}};}function handleEntityNotFound(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(!_0x5ae0a1){_0x3ce61b[_0xa3ee('0x23')](0x194);}return _0x5ae0a1;};}function handleError(_0x5b682b,_0x1998b9){_0x1998b9=_0x1998b9||0x1f4;return function(_0x1dca29){logger[_0xa3ee('0x24')](_0x1dca29[_0xa3ee('0x25')]);if(_0x1dca29[_0xa3ee('0x26')]){delete _0x1dca29['name'];}_0x5b682b[_0xa3ee('0x15')](_0x1998b9)[_0xa3ee('0x27')](_0x1dca29);};}exports[_0xa3ee('0x28')]=function(_0xd9a7f8,_0x42e97c){var _0xa9e4d6={},_0x443507={},_0x30b12b={'count':0x0,'rows':[]};var _0xea54fe=_[_0xa3ee('0x29')](db['UserProfileResource']['rawAttributes'],function(_0x4abf49){return{'name':_0x4abf49[_0xa3ee('0x2a')],'type':_0x4abf49['type'][_0xa3ee('0x2b')]};});_0x443507[_0xa3ee('0x2c')]=_[_0xa3ee('0x29')](_0xea54fe,_0xa3ee('0x26'));_0x443507[_0xa3ee('0x2d')]=_[_0xa3ee('0x2e')](_0xd9a7f8[_0xa3ee('0x2d')]);_0x443507[_0xa3ee('0x2f')]=_[_0xa3ee('0x30')](_0x443507[_0xa3ee('0x2c')],_0x443507['query']);_0xa9e4d6[_0xa3ee('0x31')]=_['intersection'](_0x443507[_0xa3ee('0x2c')],qs[_0xa3ee('0x32')](_0xd9a7f8['query'][_0xa3ee('0x32')]));_0xa9e4d6['attributes']=_0xa9e4d6[_0xa3ee('0x31')]['length']?_0xa9e4d6[_0xa3ee('0x31')]:_0x443507[_0xa3ee('0x2c')];if(!_0xd9a7f8[_0xa3ee('0x2d')][_0xa3ee('0x33')](_0xa3ee('0x34'))){_0xa9e4d6['limit']=qs[_0xa3ee('0x18')](_0xd9a7f8[_0xa3ee('0x2d')][_0xa3ee('0x18')]);_0xa9e4d6['offset']=qs[_0xa3ee('0x17')](_0xd9a7f8['query'][_0xa3ee('0x17')]);}_0xa9e4d6['order']=qs[_0xa3ee('0x35')](_0xd9a7f8['query'][_0xa3ee('0x35')]);_0xa9e4d6[_0xa3ee('0x36')]=qs[_0xa3ee('0x2f')](_[_0xa3ee('0x37')](_0xd9a7f8[_0xa3ee('0x2d')],_0x443507[_0xa3ee('0x2f')]),_0xea54fe);if(_0xd9a7f8[_0xa3ee('0x2d')][_0xa3ee('0x38')]){_0xa9e4d6[_0xa3ee('0x36')]=_[_0xa3ee('0x39')](_0xa9e4d6[_0xa3ee('0x36')],{'$or':_[_0xa3ee('0x29')](_0xea54fe,function(_0x447efd){if(_0x447efd['type']!==_0xa3ee('0x3a')){var _0x2ee492={};_0x2ee492[_0x447efd[_0xa3ee('0x26')]]={'$like':'%'+_0xd9a7f8[_0xa3ee('0x2d')]['filter']+'%'};return _0x2ee492;}})});}_0xa9e4d6=_[_0xa3ee('0x39')]({},_0xa9e4d6,_0xd9a7f8[_0xa3ee('0x3b')]);var _0x1a9b63={'where':_0xa9e4d6['where']};return db[_0xa3ee('0x3c')][_0xa3ee('0x16')](_0x1a9b63)['then'](function(_0x319c26){_0x30b12b[_0xa3ee('0x16')]=_0x319c26;if(_0xd9a7f8['query'][_0xa3ee('0x3d')]){_0xa9e4d6[_0xa3ee('0x3e')]=[{'all':!![]}];}return db[_0xa3ee('0x3c')][_0xa3ee('0x3f')](_0xa9e4d6);})[_0xa3ee('0x21')](function(_0x28e8c3){_0x30b12b[_0xa3ee('0x40')]=_0x28e8c3;return _0x30b12b;})[_0xa3ee('0x21')](respondWithFilteredResult(_0x42e97c,_0xa9e4d6))[_0xa3ee('0x41')](handleError(_0x42e97c,null));};exports[_0xa3ee('0x42')]=function(_0xa0d2d5,_0x549d74){var _0x5aa4b3={'raw':![],'where':{'id':_0xa0d2d5[_0xa3ee('0x43')]['id']}},_0x548534={};_0x548534[_0xa3ee('0x2c')]=_['keys'](db[_0xa3ee('0x3c')][_0xa3ee('0x44')]);_0x548534[_0xa3ee('0x2d')]=_['keys'](_0xa0d2d5[_0xa3ee('0x2d')]);_0x548534['filters']=_[_0xa3ee('0x30')](_0x548534[_0xa3ee('0x2c')],_0x548534[_0xa3ee('0x2d')]);_0x5aa4b3[_0xa3ee('0x31')]=_[_0xa3ee('0x30')](_0x548534[_0xa3ee('0x2c')],qs[_0xa3ee('0x32')](_0xa0d2d5[_0xa3ee('0x2d')][_0xa3ee('0x32')]));_0x5aa4b3[_0xa3ee('0x31')]=_0x5aa4b3[_0xa3ee('0x31')][_0xa3ee('0x45')]?_0x5aa4b3[_0xa3ee('0x31')]:_0x548534[_0xa3ee('0x2c')];if(_0xa0d2d5[_0xa3ee('0x2d')][_0xa3ee('0x3d')]){_0x5aa4b3[_0xa3ee('0x3e')]=[{'all':!![]}];}_0x5aa4b3=_[_0xa3ee('0x39')]({},_0x5aa4b3,_0xa0d2d5['options']);return db[_0xa3ee('0x3c')][_0xa3ee('0x46')](_0x5aa4b3)[_0xa3ee('0x21')](handleEntityNotFound(_0x549d74,null))[_0xa3ee('0x21')](respondWithResult(_0x549d74,null))['catch'](handleError(_0x549d74,null));};exports[_0xa3ee('0x47')]=function(_0x4bd451,_0x3d6512){return db[_0xa3ee('0x3c')][_0xa3ee('0x47')](_0x4bd451[_0xa3ee('0x48')],{})[_0xa3ee('0x21')](respondWithResult(_0x3d6512,0xc9))[_0xa3ee('0x41')](handleError(_0x3d6512,null));};exports[_0xa3ee('0x1f')]=function(_0xbb0148,_0x3c3677){if(_0xbb0148[_0xa3ee('0x48')]['id']){delete _0xbb0148['body']['id'];}return db[_0xa3ee('0x3c')]['find']({'where':{'id':_0xbb0148['params']['id']}})[_0xa3ee('0x21')](handleEntityNotFound(_0x3c3677,null))[_0xa3ee('0x21')](saveUpdates(_0xbb0148[_0xa3ee('0x48')],null))[_0xa3ee('0x21')](respondWithResult(_0x3c3677,null))[_0xa3ee('0x41')](handleError(_0x3c3677,null));};exports[_0xa3ee('0x20')]=function(_0x1f8699,_0x501dad){return db[_0xa3ee('0x3c')][_0xa3ee('0x46')]({'where':{'id':_0x1f8699['params']['id']}})[_0xa3ee('0x21')](handleEntityNotFound(_0x501dad,null))[_0xa3ee('0x21')](removeEntity(_0x501dad,null))[_0xa3ee('0x41')](handleError(_0x501dad,null));};exports['describe']=function(_0x587a1a,_0x14335c){return db[_0xa3ee('0x3c')][_0xa3ee('0x49')]()[_0xa3ee('0x21')](respondWithResult(_0x14335c,null))[_0xa3ee('0x41')](handleError(_0x14335c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 01fa552..96bf01a 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 _0x9bde=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0x9bde,0xe1));var _0xe9bd=function(_0x36ea98,_0x2cf23d){_0x36ea98=_0x36ea98-0x0;var _0x4d0ec7=_0x9bde[_0x36ea98];return _0x4d0ec7;};'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')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x6f116f,_0x48c8bd){var _0x120342=function(_0xa8e20a){while(--_0xa8e20a){_0x6f116f['push'](_0x6f116f['shift']());}};_0x120342(++_0x48c8bd);}(_0x6c76,0x184));var _0x66c7=function(_0x338f5a,_0x74ceb){_0x338f5a=_0x338f5a-0x0;var _0x5ba9cd=_0x6c76[_0x338f5a];return _0x5ba9cd;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x66c7('0x9'),'fields':[_0x66c7('0xa'),_0x66c7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 567ce98..b483158 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 _0x3c22=['message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x15667d,_0x17a7f7){var _0x3a61bc=function(_0x58c88b){while(--_0x58c88b){_0x15667d['push'](_0x15667d['shift']());}};_0x3a61bc(++_0x17a7f7);}(_0x3c22,0x17c));var _0x23c2=function(_0x2b616b,_0x88aa3d){_0x2b616b=_0x2b616b-0x0;var _0x381ce6=_0x3c22[_0x2b616b];return _0x381ce6;};'use strict';var _=require(_0x23c2('0x0'));var util=require(_0x23c2('0x1'));var moment=require('moment');var BPromise=require(_0x23c2('0x2'));var rs=require(_0x23c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23c2('0x4'))['db'];var utils=require(_0x23c2('0x5'));var logger=require(_0x23c2('0x6'))(_0x23c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x23c2('0x8'));var client=jayson[_0x23c2('0x9')][_0x23c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ce61,_0x19ef7d,_0x3fd18d){return new BPromise(function(_0x11503c,_0x3e5ec8){return client['request'](_0x28ce61,_0x3fd18d)['then'](function(_0x3d6c20){logger[_0x23c2('0xb')](_0x23c2('0xc'),_0x19ef7d,_0x23c2('0xd'));logger[_0x23c2('0xe')](_0x23c2('0xf'),_0x19ef7d,_0x23c2('0xd'),JSON[_0x23c2('0x10')](_0x3d6c20));if(_0x3d6c20[_0x23c2('0x11')]){if(_0x3d6c20[_0x23c2('0x11')][_0x23c2('0x12')]===0x1f4){logger[_0x23c2('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x19ef7d,_0x3d6c20[_0x23c2('0x11')][_0x23c2('0x13')]);return _0x3e5ec8(_0x3d6c20[_0x23c2('0x11')][_0x23c2('0x13')]);}logger[_0x23c2('0x11')](_0x23c2('0xc'),_0x19ef7d,_0x3d6c20['error'][_0x23c2('0x13')]);return _0x11503c(_0x3d6c20[_0x23c2('0x11')]['message']);}else{logger['info'](_0x23c2('0xc'),_0x19ef7d,_0x23c2('0xd'));_0x11503c(_0x3d6c20[_0x23c2('0x14')][_0x23c2('0x13')]);}})['catch'](function(_0x5e6647){logger['error'](_0x23c2('0xc'),_0x19ef7d,_0x5e6647);_0x3e5ec8(_0x5e6647);});});} \ No newline at end of file +var _0xabb3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x588d79,_0x34bdbe){var _0x5c5cc8=function(_0x1a2543){while(--_0x1a2543){_0x588d79['push'](_0x588d79['shift']());}};_0x5c5cc8(++_0x34bdbe);}(_0xabb3,0x17b));var _0x3abb=function(_0x15fd2c,_0x2efe29){_0x15fd2c=_0x15fd2c-0x0;var _0x314c47=_0xabb3[_0x15fd2c];return _0x314c47;};'use strict';var _=require(_0x3abb('0x0'));var util=require(_0x3abb('0x1'));var moment=require(_0x3abb('0x2'));var BPromise=require(_0x3abb('0x3'));var rs=require(_0x3abb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3abb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3abb('0x6'))(_0x3abb('0x7'));var config=require(_0x3abb('0x8'));var jayson=require(_0x3abb('0x9'));var client=jayson[_0x3abb('0xa')][_0x3abb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b88f,_0x5997cb,_0xe76fe0){return new BPromise(function(_0x23116d,_0x388d3d){return client[_0x3abb('0xc')](_0x52b88f,_0xe76fe0)[_0x3abb('0xd')](function(_0xfb6b02){logger[_0x3abb('0xe')](_0x3abb('0xf'),_0x5997cb,'request\x20sent');logger[_0x3abb('0x10')](_0x3abb('0x11'),_0x5997cb,_0x3abb('0x12'),JSON[_0x3abb('0x13')](_0xfb6b02));if(_0xfb6b02[_0x3abb('0x14')]){if(_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x15')]===0x1f4){logger[_0x3abb('0x14')](_0x3abb('0xf'),_0x5997cb,_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x16')]);return _0x388d3d(_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x16')]);}logger[_0x3abb('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x5997cb,_0xfb6b02['error'][_0x3abb('0x16')]);return _0x23116d(_0xfb6b02[_0x3abb('0x14')][_0x3abb('0x16')]);}else{logger['info'](_0x3abb('0xf'),_0x5997cb,_0x3abb('0x12'));_0x23116d(_0xfb6b02[_0x3abb('0x17')][_0x3abb('0x16')]);}})[_0x3abb('0x18')](function(_0x5f028f){logger[_0x3abb('0x14')](_0x3abb('0xf'),_0x5997cb,_0x5f028f);_0x388d3d(_0x5f028f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9bbfbd4..304032d 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 _0xbaf4=['create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x527481,_0x4037d8){var _0x23ee32=function(_0x296155){while(--_0x296155){_0x527481['push'](_0x527481['shift']());}};_0x23ee32(++_0x4037d8);}(_0xbaf4,0xc4));var _0x4baf=function(_0x3a78fc,_0x5f4e8f){_0x3a78fc=_0x3a78fc-0x0;var _0x531f5f=_0xbaf4[_0x3a78fc];return _0x531f5f;};'use strict';var multer=require('multer');var util=require(_0x4baf('0x0'));var path=require('path');var timeout=require(_0x4baf('0x1'));var express=require(_0x4baf('0x2'));var router=express[_0x4baf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4baf('0x4'));var config=require(_0x4baf('0x5'));var controller=require(_0x4baf('0x6'));router[_0x4baf('0x7')]('/',auth[_0x4baf('0x8')](),controller[_0x4baf('0x9')]);router[_0x4baf('0x7')](_0x4baf('0xa'),auth[_0x4baf('0x8')](),controller[_0x4baf('0xb')]);router['get']('/:id',auth[_0x4baf('0x8')](),controller[_0x4baf('0xc')]);router[_0x4baf('0xd')]('/',auth[_0x4baf('0x8')](),controller[_0x4baf('0xe')]);router[_0x4baf('0xf')]('/:id',auth[_0x4baf('0x8')](),controller[_0x4baf('0x10')]);router[_0x4baf('0x11')](_0x4baf('0x12'),auth['isAuthenticated'](),controller[_0x4baf('0x13')]);module[_0x4baf('0x14')]=router; \ No newline at end of file +var _0xf5a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','show','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3438c9,_0x4fe558){var _0x5b4df7=function(_0x474a96){while(--_0x474a96){_0x3438c9['push'](_0x3438c9['shift']());}};_0x5b4df7(++_0x4fe558);}(_0xf5a7,0xba));var _0x7f5a=function(_0x5622e4,_0x228d5f){_0x5622e4=_0x5622e4-0x0;var _0x39c928=_0xf5a7[_0x5622e4];return _0x39c928;};'use strict';var multer=require(_0x7f5a('0x0'));var util=require(_0x7f5a('0x1'));var path=require('path');var timeout=require(_0x7f5a('0x2'));var express=require(_0x7f5a('0x3'));var router=express['Router']();var auth=require(_0x7f5a('0x4'));var interaction=require(_0x7f5a('0x5'));var config=require(_0x7f5a('0x6'));var controller=require(_0x7f5a('0x7'));router['get']('/',auth[_0x7f5a('0x8')](),controller[_0x7f5a('0x9')]);router[_0x7f5a('0xa')](_0x7f5a('0xb'),auth[_0x7f5a('0x8')](),controller[_0x7f5a('0xc')]);router['get']('/:id',auth[_0x7f5a('0x8')](),controller[_0x7f5a('0xd')]);router['post']('/',auth[_0x7f5a('0x8')](),controller[_0x7f5a('0xe')]);router['put'](_0x7f5a('0xf'),auth[_0x7f5a('0x8')](),controller['update']);router[_0x7f5a('0x10')](_0x7f5a('0xf'),auth[_0x7f5a('0x8')](),controller[_0x7f5a('0x11')]);module[_0x7f5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e49a9d6..03188a9 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 _0x50b9=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x50b9,0x171));var _0x950b=function(_0x6f114,_0x2ac0f9){_0x6f114=_0x6f114-0x0;var _0x40546b=_0x50b9[_0x6f114];return _0x40546b;};'use strict';var Sequelize=require(_0x950b('0x0'));module['exports']={'name':{'type':Sequelize[_0x950b('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x950b('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x950b('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x950b('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x950b('0x1')],'set':function(_0x237b83){this[_0x950b('0x4')](_0x950b('0x5'),_0x237b83?_0x237b83[_0x950b('0x6')](''):[]);},'get':function(){return this[_0x950b('0x7')]('crudPermissions')?this[_0x950b('0x7')](_0x950b('0x5'))[_0x950b('0x8')](''):[];}}}; \ No newline at end of file +var _0xb38e=['INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb38e,0xa7));var _0xeb38=function(_0x5356a3,_0x28d279){_0x5356a3=_0x5356a3-0x0;var _0x363bda=_0xb38e[_0x5356a3];return _0x363bda;};'use strict';var Sequelize=require(_0xeb38('0x0'));module[_0xeb38('0x1')]={'name':{'type':Sequelize[_0xeb38('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb38('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb38('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb38('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb38('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x33e6e9){this[_0xeb38('0x5')]('crudPermissions',_0x33e6e9?_0x33e6e9[_0xeb38('0x6')](''):[]);},'get':function(){return this[_0xeb38('0x7')](_0xeb38('0x8'))?this[_0xeb38('0x7')]('crudPermissions')[_0xeb38('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a2b9757..d76eb5c 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 _0x6b1c=['send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','UserProfileSection','findAll','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','destroy','sendStatus','error','name'];(function(_0x509506,_0x4df17f){var _0x2b8271=function(_0x7dd765){while(--_0x7dd765){_0x509506['push'](_0x509506['shift']());}};_0x2b8271(++_0x4df17f);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x296b66,_0x40766f){_0x296b66=_0x296b66-0x0;var _0x4a309c=_0x6b1c[_0x296b66];return _0x4a309c;};'use strict';var pdf=require(_0xc6b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc6b1('0x1'));var zipdir=require(_0xc6b1('0x2'));var jsonpatch=require(_0xc6b1('0x3'));var rp=require(_0xc6b1('0x4'));var moment=require(_0xc6b1('0x5'));var BPromise=require(_0xc6b1('0x6'));var Mustache=require('mustache');var util=require(_0xc6b1('0x7'));var path=require('path');var sox=require(_0xc6b1('0x8'));var csv=require(_0xc6b1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc6b1('0xa'));var squel=require(_0xc6b1('0xb'));var crypto=require(_0xc6b1('0xc'));var jsforce=require(_0xc6b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc6b1('0x9'));var querystring=require(_0xc6b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6b1('0xf'));var qs=require(_0xc6b1('0x10'));var as=require(_0xc6b1('0x11'));var hardwareService=require(_0xc6b1('0x12'));var logger=require(_0xc6b1('0x13'))(_0xc6b1('0x14'));var utils=require('../../config/utils');var config=require(_0xc6b1('0x15'));var db=require(_0xc6b1('0x16'))['db'];function respondWithStatusCode(_0x327fe0,_0x3c5b2b){_0x3c5b2b=_0x3c5b2b||0xcc;return function(_0x283072){if(_0x283072){return _0x327fe0['sendStatus'](_0x3c5b2b);}return _0x327fe0[_0xc6b1('0x17')](_0x3c5b2b)[_0xc6b1('0x18')]();};}function respondWithResult(_0x1a57e6,_0x61ad75){_0x61ad75=_0x61ad75||0xc8;return function(_0x4cf458){if(_0x4cf458){return _0x1a57e6['status'](_0x61ad75)[_0xc6b1('0x19')](_0x4cf458);}};}function respondWithFilteredResult(_0x12079c,_0x37ea66){return function(_0x1d31cf){if(_0x1d31cf){var _0xef7fda=_0x1d31cf[_0xc6b1('0x1a')],_0x6885bd=_0x37ea66[_0xc6b1('0x1b')],_0x4ba242=_0x37ea66[_0xc6b1('0x1b')]+_0x37ea66['limit'],_0x4fbf72;if(_0x4ba242>=_0xef7fda){_0x4ba242=_0xef7fda;_0x4fbf72=0xc8;}else{_0x4fbf72=0xce;}_0x12079c[_0xc6b1('0x17')](_0x4fbf72);return _0x12079c[_0xc6b1('0x1c')]('Content-Range',_0x6885bd+'-'+_0x4ba242+'/'+_0xef7fda)[_0xc6b1('0x19')](_0x1d31cf);}return null;};}function patchUpdates(_0x2c8ac5){return function(_0xf3f94a){try{jsonpatch['apply'](_0xf3f94a,_0x2c8ac5,!![]);}catch(_0x24e135){return BPromise[_0xc6b1('0x1d')](_0x24e135);}return _0xf3f94a[_0xc6b1('0x1e')]();};}function saveUpdates(_0xe1480f,_0x57a253){return function(_0x507a37){if(_0x507a37){return _0x507a37[_0xc6b1('0x1f')](_0xe1480f)[_0xc6b1('0x20')](function(_0x9ac881){return _0x9ac881;});}return null;};}function removeEntity(_0x1d86f5,_0x2d41c4){return function(_0x9cef9f){if(_0x9cef9f){return _0x9cef9f[_0xc6b1('0x21')]()[_0xc6b1('0x20')](function(){_0x1d86f5[_0xc6b1('0x17')](0xcc)[_0xc6b1('0x18')]();});}};}function handleEntityNotFound(_0x267e1f,_0x673d7f){return function(_0x279fbf){if(!_0x279fbf){_0x267e1f[_0xc6b1('0x22')](0x194);}return _0x279fbf;};}function handleError(_0x311b3f,_0x3976df){_0x3976df=_0x3976df||0x1f4;return function(_0x5c0dad){logger[_0xc6b1('0x23')](_0x5c0dad['stack']);if(_0x5c0dad[_0xc6b1('0x24')]){delete _0x5c0dad[_0xc6b1('0x24')];}_0x311b3f[_0xc6b1('0x17')](_0x3976df)[_0xc6b1('0x25')](_0x5c0dad);};}exports['index']=function(_0x836608,_0x2942bb){var _0x168187={},_0x71ce3e={},_0x443774={'count':0x0,'rows':[]};var _0x44bbf6=_[_0xc6b1('0x26')](db['UserProfileSection'][_0xc6b1('0x27')],function(_0x16ec61){return{'name':_0x16ec61[_0xc6b1('0x28')],'type':_0x16ec61[_0xc6b1('0x29')][_0xc6b1('0x2a')]};});_0x71ce3e[_0xc6b1('0x2b')]=_['map'](_0x44bbf6,_0xc6b1('0x24'));_0x71ce3e[_0xc6b1('0x2c')]=_[_0xc6b1('0x2d')](_0x836608['query']);_0x71ce3e[_0xc6b1('0x2e')]=_[_0xc6b1('0x2f')](_0x71ce3e[_0xc6b1('0x2b')],_0x71ce3e[_0xc6b1('0x2c')]);_0x168187['attributes']=_['intersection'](_0x71ce3e[_0xc6b1('0x2b')],qs['fields'](_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x30')]));_0x168187[_0xc6b1('0x31')]=_0x168187[_0xc6b1('0x31')][_0xc6b1('0x32')]?_0x168187[_0xc6b1('0x31')]:_0x71ce3e[_0xc6b1('0x2b')];if(!_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x33')](_0xc6b1('0x34'))){_0x168187['limit']=qs['limit'](_0x836608[_0xc6b1('0x2c')]['limit']);_0x168187[_0xc6b1('0x1b')]=qs[_0xc6b1('0x1b')](_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x1b')]);}_0x168187[_0xc6b1('0x35')]=qs[_0xc6b1('0x36')](_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x36')]);_0x168187[_0xc6b1('0x37')]=qs['filters'](_[_0xc6b1('0x38')](_0x836608[_0xc6b1('0x2c')],_0x71ce3e[_0xc6b1('0x2e')]),_0x44bbf6);if(_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x39')]){_0x168187[_0xc6b1('0x37')]=_[_0xc6b1('0x3a')](_0x168187[_0xc6b1('0x37')],{'$or':_['map'](_0x44bbf6,function(_0x541161){if(_0x541161['type']!=='VIRTUAL'){var _0x605a9f={};_0x605a9f[_0x541161[_0xc6b1('0x24')]]={'$like':'%'+_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x39')]+'%'};return _0x605a9f;}})});}_0x168187=_['merge']({},_0x168187,_0x836608[_0xc6b1('0x3b')]);var _0x801870={'where':_0x168187[_0xc6b1('0x37')]};return db['UserProfileSection'][_0xc6b1('0x1a')](_0x801870)[_0xc6b1('0x20')](function(_0x2cbfb1){_0x443774[_0xc6b1('0x1a')]=_0x2cbfb1;if(_0x836608[_0xc6b1('0x2c')][_0xc6b1('0x3c')]){_0x168187['include']=[{'all':!![]}];}return db[_0xc6b1('0x3d')][_0xc6b1('0x3e')](_0x168187);})[_0xc6b1('0x20')](function(_0x357111){_0x443774['rows']=_0x357111;return _0x443774;})[_0xc6b1('0x20')](respondWithFilteredResult(_0x2942bb,_0x168187))[_0xc6b1('0x3f')](handleError(_0x2942bb,null));};exports[_0xc6b1('0x40')]=function(_0x3114fa,_0x1734c9){var _0x5343f1={'raw':![],'where':{'id':_0x3114fa[_0xc6b1('0x41')]['id']}},_0x5555a7={};_0x5555a7['model']=_[_0xc6b1('0x2d')](db['UserProfileSection'][_0xc6b1('0x27')]);_0x5555a7[_0xc6b1('0x2c')]=_[_0xc6b1('0x2d')](_0x3114fa[_0xc6b1('0x2c')]);_0x5555a7[_0xc6b1('0x2e')]=_[_0xc6b1('0x2f')](_0x5555a7[_0xc6b1('0x2b')],_0x5555a7[_0xc6b1('0x2c')]);_0x5343f1[_0xc6b1('0x31')]=_[_0xc6b1('0x2f')](_0x5555a7[_0xc6b1('0x2b')],qs[_0xc6b1('0x30')](_0x3114fa[_0xc6b1('0x2c')][_0xc6b1('0x30')]));_0x5343f1[_0xc6b1('0x31')]=_0x5343f1[_0xc6b1('0x31')]['length']?_0x5343f1[_0xc6b1('0x31')]:_0x5555a7[_0xc6b1('0x2b')];if(_0x3114fa[_0xc6b1('0x2c')][_0xc6b1('0x3c')]){_0x5343f1['include']=[{'all':!![]}];}_0x5343f1=_[_0xc6b1('0x3a')]({},_0x5343f1,_0x3114fa['options']);return db[_0xc6b1('0x3d')][_0xc6b1('0x42')](_0x5343f1)[_0xc6b1('0x20')](handleEntityNotFound(_0x1734c9,null))[_0xc6b1('0x20')](respondWithResult(_0x1734c9,null))[_0xc6b1('0x3f')](handleError(_0x1734c9,null));};exports['create']=function(_0x420e1c,_0x3d0872){return db[_0xc6b1('0x3d')][_0xc6b1('0x43')](_0x420e1c[_0xc6b1('0x44')],{})[_0xc6b1('0x20')](respondWithResult(_0x3d0872,0xc9))[_0xc6b1('0x3f')](handleError(_0x3d0872,null));};exports['update']=function(_0x23b539,_0x59c5f1){if(_0x23b539[_0xc6b1('0x44')]['id']){delete _0x23b539[_0xc6b1('0x44')]['id'];}return db['UserProfileSection'][_0xc6b1('0x42')]({'where':{'id':_0x23b539[_0xc6b1('0x41')]['id']}})[_0xc6b1('0x20')](handleEntityNotFound(_0x59c5f1,null))['then'](saveUpdates(_0x23b539['body'],null))[_0xc6b1('0x20')](respondWithResult(_0x59c5f1,null))[_0xc6b1('0x3f')](handleError(_0x59c5f1,null));};exports[_0xc6b1('0x21')]=function(_0x2a4b36,_0x2b6e1a){return db[_0xc6b1('0x3d')][_0xc6b1('0x42')]({'where':{'id':_0x2a4b36[_0xc6b1('0x41')]['id']}})[_0xc6b1('0x20')](handleEntityNotFound(_0x2b6e1a,null))[_0xc6b1('0x20')](removeEntity(_0x2b6e1a,null))[_0xc6b1('0x3f')](handleError(_0x2b6e1a,null));};exports['describe']=function(_0x3c4359,_0x196fd5){return db[_0xc6b1('0x3d')][_0xc6b1('0x45')]()[_0xc6b1('0x20')](respondWithResult(_0x196fd5,null))[_0xc6b1('0x3f')](handleError(_0x196fd5,null));}; \ No newline at end of file +var _0x713d=['squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x713d,0x16f));var _0xd713=function(_0x1b69f9,_0xe342c5){_0x1b69f9=_0x1b69f9-0x0;var _0x23a34b=_0x713d[_0x1b69f9];return _0x23a34b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd713('0x0'));var rimraf=require(_0xd713('0x1'));var zipdir=require(_0xd713('0x2'));var jsonpatch=require(_0xd713('0x3'));var rp=require(_0xd713('0x4'));var moment=require(_0xd713('0x5'));var BPromise=require(_0xd713('0x6'));var Mustache=require(_0xd713('0x7'));var util=require(_0xd713('0x8'));var path=require(_0xd713('0x9'));var sox=require(_0xd713('0xa'));var csv=require('to-csv');var ejs=require(_0xd713('0xb'));var fs=require('fs');var _=require(_0xd713('0xc'));var squel=require(_0xd713('0xd'));var crypto=require(_0xd713('0xe'));var jsforce=require(_0xd713('0xf'));var deskjs=require(_0xd713('0x10'));var toCsv=require(_0xd713('0x11'));var querystring=require(_0xd713('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd713('0x13'));var hardwareService=require(_0xd713('0x14'));var logger=require('../../config/logger')(_0xd713('0x15'));var utils=require(_0xd713('0x16'));var config=require(_0xd713('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e57f5,_0x22ac28){_0x22ac28=_0x22ac28||0xcc;return function(_0x1c4592){if(_0x1c4592){return _0x5e57f5['sendStatus'](_0x22ac28);}return _0x5e57f5[_0xd713('0x18')](_0x22ac28)[_0xd713('0x19')]();};}function respondWithResult(_0x4e3557,_0x5de2ab){_0x5de2ab=_0x5de2ab||0xc8;return function(_0x538d4e){if(_0x538d4e){return _0x4e3557['status'](_0x5de2ab)['json'](_0x538d4e);}};}function respondWithFilteredResult(_0x104e21,_0x1225a6){return function(_0x5be7e7){if(_0x5be7e7){var _0x44801e=_0x5be7e7[_0xd713('0x1a')],_0x4f36fd=_0x1225a6[_0xd713('0x1b')],_0x1e2605=_0x1225a6['offset']+_0x1225a6[_0xd713('0x1c')],_0x3dd240;if(_0x1e2605>=_0x44801e){_0x1e2605=_0x44801e;_0x3dd240=0xc8;}else{_0x3dd240=0xce;}_0x104e21[_0xd713('0x18')](_0x3dd240);return _0x104e21[_0xd713('0x1d')](_0xd713('0x1e'),_0x4f36fd+'-'+_0x1e2605+'/'+_0x44801e)['json'](_0x5be7e7);}return null;};}function patchUpdates(_0x38a526){return function(_0x2615a0){try{jsonpatch[_0xd713('0x1f')](_0x2615a0,_0x38a526,!![]);}catch(_0x3cd638){return BPromise[_0xd713('0x20')](_0x3cd638);}return _0x2615a0[_0xd713('0x21')]();};}function saveUpdates(_0x2711c7,_0x49e634){return function(_0xc16b38){if(_0xc16b38){return _0xc16b38[_0xd713('0x22')](_0x2711c7)[_0xd713('0x23')](function(_0x1c1500){return _0x1c1500;});}return null;};}function removeEntity(_0x3cfa58,_0xa1b51c){return function(_0x37fcb2){if(_0x37fcb2){return _0x37fcb2[_0xd713('0x24')]()[_0xd713('0x23')](function(){_0x3cfa58[_0xd713('0x18')](0xcc)[_0xd713('0x19')]();});}};}function handleEntityNotFound(_0x8b6721,_0x4ecb92){return function(_0x3bf033){if(!_0x3bf033){_0x8b6721[_0xd713('0x25')](0x194);}return _0x3bf033;};}function handleError(_0x440922,_0x4b5abe){_0x4b5abe=_0x4b5abe||0x1f4;return function(_0x8835d2){logger[_0xd713('0x26')](_0x8835d2[_0xd713('0x27')]);if(_0x8835d2['name']){delete _0x8835d2[_0xd713('0x28')];}_0x440922[_0xd713('0x18')](_0x4b5abe)[_0xd713('0x29')](_0x8835d2);};}exports[_0xd713('0x2a')]=function(_0x170652,_0x3f11a4){var _0x47c10d={},_0x178442={},_0x4e7226={'count':0x0,'rows':[]};var _0x3d1a1c=_[_0xd713('0x2b')](db[_0xd713('0x2c')][_0xd713('0x2d')],function(_0x396e45){return{'name':_0x396e45[_0xd713('0x2e')],'type':_0x396e45['type'][_0xd713('0x2f')]};});_0x178442[_0xd713('0x30')]=_[_0xd713('0x2b')](_0x3d1a1c,_0xd713('0x28'));_0x178442['query']=_[_0xd713('0x31')](_0x170652['query']);_0x178442[_0xd713('0x32')]=_['intersection'](_0x178442[_0xd713('0x30')],_0x178442[_0xd713('0x33')]);_0x47c10d[_0xd713('0x34')]=_[_0xd713('0x35')](_0x178442[_0xd713('0x30')],qs['fields'](_0x170652[_0xd713('0x33')][_0xd713('0x36')]));_0x47c10d[_0xd713('0x34')]=_0x47c10d[_0xd713('0x34')][_0xd713('0x37')]?_0x47c10d['attributes']:_0x178442[_0xd713('0x30')];if(!_0x170652[_0xd713('0x33')][_0xd713('0x38')](_0xd713('0x39'))){_0x47c10d[_0xd713('0x1c')]=qs[_0xd713('0x1c')](_0x170652[_0xd713('0x33')][_0xd713('0x1c')]);_0x47c10d[_0xd713('0x1b')]=qs[_0xd713('0x1b')](_0x170652['query'][_0xd713('0x1b')]);}_0x47c10d[_0xd713('0x3a')]=qs[_0xd713('0x3b')](_0x170652['query']['sort']);_0x47c10d['where']=qs['filters'](_['pick'](_0x170652[_0xd713('0x33')],_0x178442[_0xd713('0x32')]),_0x3d1a1c);if(_0x170652[_0xd713('0x33')][_0xd713('0x3c')]){_0x47c10d['where']=_[_0xd713('0x3d')](_0x47c10d['where'],{'$or':_['map'](_0x3d1a1c,function(_0x14ecee){if(_0x14ecee[_0xd713('0x3e')]!==_0xd713('0x3f')){var _0x35ce2b={};_0x35ce2b[_0x14ecee[_0xd713('0x28')]]={'$like':'%'+_0x170652[_0xd713('0x33')]['filter']+'%'};return _0x35ce2b;}})});}_0x47c10d=_['merge']({},_0x47c10d,_0x170652[_0xd713('0x40')]);var _0xd186f8={'where':_0x47c10d[_0xd713('0x41')]};return db[_0xd713('0x2c')][_0xd713('0x1a')](_0xd186f8)[_0xd713('0x23')](function(_0x551184){_0x4e7226[_0xd713('0x1a')]=_0x551184;if(_0x170652[_0xd713('0x33')][_0xd713('0x42')]){_0x47c10d[_0xd713('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd713('0x44')](_0x47c10d);})['then'](function(_0x277a43){_0x4e7226[_0xd713('0x45')]=_0x277a43;return _0x4e7226;})['then'](respondWithFilteredResult(_0x3f11a4,_0x47c10d))[_0xd713('0x46')](handleError(_0x3f11a4,null));};exports['show']=function(_0x5460d0,_0x5bc4dc){var _0x26497c={'raw':![],'where':{'id':_0x5460d0[_0xd713('0x47')]['id']}},_0x439d48={};_0x439d48[_0xd713('0x30')]=_[_0xd713('0x31')](db[_0xd713('0x2c')][_0xd713('0x2d')]);_0x439d48[_0xd713('0x33')]=_['keys'](_0x5460d0[_0xd713('0x33')]);_0x439d48['filters']=_['intersection'](_0x439d48[_0xd713('0x30')],_0x439d48['query']);_0x26497c[_0xd713('0x34')]=_['intersection'](_0x439d48['model'],qs[_0xd713('0x36')](_0x5460d0[_0xd713('0x33')][_0xd713('0x36')]));_0x26497c[_0xd713('0x34')]=_0x26497c[_0xd713('0x34')][_0xd713('0x37')]?_0x26497c[_0xd713('0x34')]:_0x439d48[_0xd713('0x30')];if(_0x5460d0[_0xd713('0x33')][_0xd713('0x42')]){_0x26497c[_0xd713('0x43')]=[{'all':!![]}];}_0x26497c=_[_0xd713('0x3d')]({},_0x26497c,_0x5460d0[_0xd713('0x40')]);return db[_0xd713('0x2c')][_0xd713('0x48')](_0x26497c)[_0xd713('0x23')](handleEntityNotFound(_0x5bc4dc,null))[_0xd713('0x23')](respondWithResult(_0x5bc4dc,null))[_0xd713('0x46')](handleError(_0x5bc4dc,null));};exports[_0xd713('0x49')]=function(_0x529be3,_0x432fb6){return db['UserProfileSection'][_0xd713('0x49')](_0x529be3[_0xd713('0x4a')],{})[_0xd713('0x23')](respondWithResult(_0x432fb6,0xc9))['catch'](handleError(_0x432fb6,null));};exports[_0xd713('0x22')]=function(_0x1db5e8,_0x529aaf){if(_0x1db5e8[_0xd713('0x4a')]['id']){delete _0x1db5e8['body']['id'];}return db['UserProfileSection'][_0xd713('0x48')]({'where':{'id':_0x1db5e8['params']['id']}})[_0xd713('0x23')](handleEntityNotFound(_0x529aaf,null))[_0xd713('0x23')](saveUpdates(_0x1db5e8[_0xd713('0x4a')],null))[_0xd713('0x23')](respondWithResult(_0x529aaf,null))['catch'](handleError(_0x529aaf,null));};exports[_0xd713('0x24')]=function(_0x19ff91,_0x3f57bf){return db['UserProfileSection']['find']({'where':{'id':_0x19ff91[_0xd713('0x47')]['id']}})[_0xd713('0x23')](handleEntityNotFound(_0x3f57bf,null))['then'](removeEntity(_0x3f57bf,null))[_0xd713('0x46')](handleError(_0x3f57bf,null));};exports['describe']=function(_0x4de9cc,_0x1475e2){return db[_0xd713('0x2c')][_0xd713('0x4b')]()[_0xd713('0x23')](respondWithResult(_0x1475e2,null))['catch'](handleError(_0x1475e2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a292a82..6077c1e 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 _0x99c4=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x99c4,0x14d));var _0x499c=function(_0x2cc3fa,_0x1a4af2){_0x2cc3fa=_0x2cc3fa-0x0;var _0x5044eb=_0x99c4[_0x2cc3fa];return _0x5044eb;};'use strict';var _=require(_0x499c('0x0'));var util=require(_0x499c('0x1'));var logger=require(_0x499c('0x2'))(_0x499c('0x3'));var moment=require(_0x499c('0x4'));var BPromise=require(_0x499c('0x5'));var rp=require(_0x499c('0x6'));var fs=require('fs');var path=require(_0x499c('0x7'));var rimraf=require(_0x499c('0x8'));var config=require(_0x499c('0x9'));var attributes=require(_0x499c('0xa'));module[_0x499c('0xb')]=function(_0x29e7a2,_0x2fd0d7){return _0x29e7a2[_0x499c('0xc')]('UserProfileSection',attributes,{'tableName':_0x499c('0xd'),'paranoid':![],'indexes':[{'name':_0x499c('0xe'),'fields':[_0x499c('0xf'),_0x499c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcda6=['rimraf','../../config/environment','exports','define','compositeIndex','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcda6,0x15a));var _0x6cda=function(_0x4cfcbf,_0x357d6b){_0x4cfcbf=_0x4cfcbf-0x0;var _0x47e573=_0xcda6[_0x4cfcbf];return _0x47e573;};'use strict';var _=require(_0x6cda('0x0'));var util=require('util');var logger=require(_0x6cda('0x1'))(_0x6cda('0x2'));var moment=require('moment');var BPromise=require(_0x6cda('0x3'));var rp=require(_0x6cda('0x4'));var fs=require('fs');var path=require(_0x6cda('0x5'));var rimraf=require(_0x6cda('0x6'));var config=require(_0x6cda('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x6cda('0x8')]=function(_0x484bd8,_0x3a32f4){return _0x484bd8[_0x6cda('0x9')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x6cda('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 9bcd6dd..1fadac3 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 _0xd442=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd442,0x1b5));var _0x2d44=function(_0x4ee389,_0x4cc020){_0x4ee389=_0x4ee389-0x0;var _0x2d8657=_0xd442[_0x4ee389];return _0x2d8657;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d44('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d44('0x1'));var db=require(_0x2d44('0x2'))['db'];var utils=require(_0x2d44('0x3'));var logger=require(_0x2d44('0x4'))(_0x2d44('0x5'));var config=require(_0x2d44('0x6'));var jayson=require(_0x2d44('0x7'));var client=jayson[_0x2d44('0x8')][_0x2d44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307323,_0x47f26d,_0x444062){return new BPromise(function(_0x86211f,_0xefd015){return client[_0x2d44('0xa')](_0x307323,_0x444062)[_0x2d44('0xb')](function(_0x34c7cd){logger[_0x2d44('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x47f26d,_0x2d44('0xd'));logger[_0x2d44('0xe')](_0x2d44('0xf'),_0x47f26d,'request\x20sent',JSON[_0x2d44('0x10')](_0x34c7cd));if(_0x34c7cd[_0x2d44('0x11')]){if(_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x12')]===0x1f4){logger['error'](_0x2d44('0x13'),_0x47f26d,_0x34c7cd[_0x2d44('0x11')]['message']);return _0xefd015(_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x14')]);}logger[_0x2d44('0x11')](_0x2d44('0x13'),_0x47f26d,_0x34c7cd[_0x2d44('0x11')][_0x2d44('0x14')]);return _0x86211f(_0x34c7cd['error'][_0x2d44('0x14')]);}else{logger[_0x2d44('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x47f26d,'request\x20sent');_0x86211f(_0x34c7cd[_0x2d44('0x15')][_0x2d44('0x14')]);}})[_0x2d44('0x16')](function(_0x2ec9b2){logger[_0x2d44('0x11')](_0x2d44('0x13'),_0x47f26d,_0x2ec9b2);_0xefd015(_0x2ec9b2);});});} \ No newline at end of file +var _0xf4e3=['../../config/environment','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf4e3,0x12e));var _0x3f4e=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0xf4e3[_0x3c40f4];return _0x1209d;};'use strict';var _=require(_0x3f4e('0x0'));var util=require(_0x3f4e('0x1'));var moment=require(_0x3f4e('0x2'));var BPromise=require(_0x3f4e('0x3'));var rs=require(_0x3f4e('0x4'));var fs=require('fs');var Redis=require(_0x3f4e('0x5'));var db=require(_0x3f4e('0x6'))['db'];var utils=require(_0x3f4e('0x7'));var logger=require(_0x3f4e('0x8'))(_0x3f4e('0x9'));var config=require(_0x3f4e('0xa'));var jayson=require(_0x3f4e('0xb'));var client=jayson[_0x3f4e('0xc')][_0x3f4e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ae617,_0x11409f,_0x1eb383){return new BPromise(function(_0x12abae,_0x29a52d){return client['request'](_0x3ae617,_0x1eb383)['then'](function(_0xf8be92){logger[_0x3f4e('0xe')](_0x3f4e('0xf'),_0x11409f,_0x3f4e('0x10'));logger[_0x3f4e('0x11')](_0x3f4e('0x12'),_0x11409f,_0x3f4e('0x10'),JSON[_0x3f4e('0x13')](_0xf8be92));if(_0xf8be92[_0x3f4e('0x14')]){if(_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x15')]===0x1f4){logger[_0x3f4e('0x14')](_0x3f4e('0xf'),_0x11409f,_0xf8be92[_0x3f4e('0x14')]['message']);return _0x29a52d(_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x16')]);}logger['error'](_0x3f4e('0xf'),_0x11409f,_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x16')]);return _0x12abae(_0xf8be92[_0x3f4e('0x14')][_0x3f4e('0x16')]);}else{logger[_0x3f4e('0xe')](_0x3f4e('0xf'),_0x11409f,_0x3f4e('0x10'));_0x12abae(_0xf8be92['result'][_0x3f4e('0x16')]);}})[_0x3f4e('0x17')](function(_0x140c94){logger[_0x3f4e('0x14')](_0x3f4e('0xf'),_0x11409f,_0x140c94);_0x29a52d(_0x140c94);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e60b694..f99589a 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 _0x19cc=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x19cc,0x10e));var _0xc19c=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x19cc[_0x5df61d];return _0x24cc4c;};'use strict';var multer=require(_0xc19c('0x0'));var util=require(_0xc19c('0x1'));var path=require('path');var timeout=require(_0xc19c('0x2'));var express=require(_0xc19c('0x3'));var router=express[_0xc19c('0x4')]();var auth=require(_0xc19c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc19c('0x6'));module[_0xc19c('0x7')]=router; \ No newline at end of file +var _0x5ab2=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x5ab2,0xc0));var _0x25ab=function(_0x1c84cd,_0x47e634){_0x1c84cd=_0x1c84cd-0x0;var _0x4e2b23=_0x5ab2[_0x1c84cd];return _0x4e2b23;};'use strict';var multer=require(_0x25ab('0x0'));var util=require(_0x25ab('0x1'));var path=require('path');var timeout=require(_0x25ab('0x2'));var express=require('express');var router=express[_0x25ab('0x3')]();var auth=require(_0x25ab('0x4'));var interaction=require(_0x25ab('0x5'));var config=require(_0x25ab('0x6'));module[_0x25ab('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7cef96c..eb32ef0 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e22fbda..eb50671 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 _0x2d93=['../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x59e791,_0x1d7bb8){var _0x5df1ef=function(_0xf5643a){while(--_0xf5643a){_0x59e791['push'](_0x59e791['shift']());}};_0x5df1ef(++_0x1d7bb8);}(_0x2d93,0xf3));var _0x32d9=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x2d93[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var logger=require(_0x32d9('0x2'))(_0x32d9('0x3'));var moment=require(_0x32d9('0x4'));var BPromise=require(_0x32d9('0x5'));var rp=require(_0x32d9('0x6'));var fs=require('fs');var path=require(_0x32d9('0x7'));var rimraf=require(_0x32d9('0x8'));var config=require(_0x32d9('0x9'));var attributes=require(_0x32d9('0xa'));module[_0x32d9('0xb')]=function(_0x9b4979,_0x3529db){return _0x9b4979['define'](_0x32d9('0xc'),attributes,{'tableName':_0x32d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5825=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues'];(function(_0x15a357,_0x5701c3){var _0x485d96=function(_0x31ffa0){while(--_0x31ffa0){_0x15a357['push'](_0x15a357['shift']());}};_0x485d96(++_0x5701c3);}(_0x5825,0x78));var _0x5582=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5825[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var logger=require(_0x5582('0x2'))(_0x5582('0x3'));var moment=require('moment');var BPromise=require(_0x5582('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5582('0x5'));var rimraf=require(_0x5582('0x6'));var config=require(_0x5582('0x7'));var attributes=require(_0x5582('0x8'));module[_0x5582('0x9')]=function(_0x11eb87,_0x17a897){return _0x11eb87['define'](_0x5582('0xa'),attributes,{'tableName':_0x5582('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 4200361..0c59c2b 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 _0xc993=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18c057,_0x2ac2e3){var _0x2afcc1=function(_0x28ecd3){while(--_0x28ecd3){_0x18c057['push'](_0x18c057['shift']());}};_0x2afcc1(++_0x2ac2e3);}(_0xc993,0x9a));var _0x3c99=function(_0xfb9eb5,_0x468bc6){_0xfb9eb5=_0xfb9eb5-0x0;var _0x3d0096=_0xc993[_0xfb9eb5];return _0x3d0096;};'use strict';var _=require(_0x3c99('0x0'));var util=require(_0x3c99('0x1'));var moment=require(_0x3c99('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c99('0x3'));var fs=require('fs');var Redis=require(_0x3c99('0x4'));var db=require(_0x3c99('0x5'))['db'];var utils=require(_0x3c99('0x6'));var logger=require(_0x3c99('0x7'))('rpc');var config=require(_0x3c99('0x8'));var jayson=require(_0x3c99('0x9'));var client=jayson[_0x3c99('0xa')][_0x3c99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15c08f,_0x484b7c,_0x4c9036){return new BPromise(function(_0x177f99,_0x354111){return client[_0x3c99('0xc')](_0x15c08f,_0x4c9036)[_0x3c99('0xd')](function(_0x3bc3dc){logger[_0x3c99('0xe')](_0x3c99('0xf'),_0x484b7c,_0x3c99('0x10'));logger[_0x3c99('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x484b7c,_0x3c99('0x10'),JSON[_0x3c99('0x12')](_0x3bc3dc));if(_0x3bc3dc[_0x3c99('0x13')]){if(_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x14')]===0x1f4){logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x3bc3dc['error'][_0x3c99('0x15')]);return _0x354111(_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x15')]);}logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x3bc3dc[_0x3c99('0x13')][_0x3c99('0x15')]);return _0x177f99(_0x3bc3dc[_0x3c99('0x13')]['message']);}else{logger[_0x3c99('0xe')](_0x3c99('0xf'),_0x484b7c,_0x3c99('0x10'));_0x177f99(_0x3bc3dc['result']['message']);}})[_0x3c99('0x16')](function(_0x5eaa3c){logger[_0x3c99('0x13')](_0x3c99('0xf'),_0x484b7c,_0x5eaa3c);_0x354111(_0x5eaa3c);});});} \ No newline at end of file +var _0xaafe=['http','request','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21e2c6,_0x15548c){var _0xce8ddf=function(_0x28ece6){while(--_0x28ece6){_0x21e2c6['push'](_0x21e2c6['shift']());}};_0xce8ddf(++_0x15548c);}(_0xaafe,0x186));var _0xeaaf=function(_0x5365a3,_0x3552de){_0x5365a3=_0x5365a3-0x0;var _0x2fa252=_0xaafe[_0x5365a3];return _0x2fa252;};'use strict';var _=require(_0xeaaf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeaaf('0x1'));var rs=require(_0xeaaf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaaf('0x3'))['db'];var utils=require(_0xeaaf('0x4'));var logger=require(_0xeaaf('0x5'))(_0xeaaf('0x6'));var config=require(_0xeaaf('0x7'));var jayson=require(_0xeaaf('0x8'));var client=jayson[_0xeaaf('0x9')][_0xeaaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16bddf,_0x3fdf1c,_0x514b4e){return new BPromise(function(_0x3dcf95,_0xa555da){return client[_0xeaaf('0xb')](_0x16bddf,_0x514b4e)['then'](function(_0x4ad53f){logger[_0xeaaf('0xc')](_0xeaaf('0xd'),_0x3fdf1c,'request\x20sent');logger['debug'](_0xeaaf('0xe'),_0x3fdf1c,_0xeaaf('0xf'),JSON[_0xeaaf('0x10')](_0x4ad53f));if(_0x4ad53f['error']){if(_0x4ad53f['error'][_0xeaaf('0x11')]===0x1f4){logger[_0xeaaf('0x12')](_0xeaaf('0xd'),_0x3fdf1c,_0x4ad53f[_0xeaaf('0x12')][_0xeaaf('0x13')]);return _0xa555da(_0x4ad53f['error'][_0xeaaf('0x13')]);}logger['error'](_0xeaaf('0xd'),_0x3fdf1c,_0x4ad53f[_0xeaaf('0x12')][_0xeaaf('0x13')]);return _0x3dcf95(_0x4ad53f[_0xeaaf('0x12')]['message']);}else{logger[_0xeaaf('0xc')](_0xeaaf('0xd'),_0x3fdf1c,_0xeaaf('0xf'));_0x3dcf95(_0x4ad53f['result'][_0xeaaf('0x13')]);}})['catch'](function(_0x48537d){logger['error'](_0xeaaf('0xd'),_0x3fdf1c,_0x48537d);_0xa555da(_0x48537d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 05a459d..2c77cbf 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 _0x4d53=['express','Router','../../components/interaction/service','exports','util','path','connect-timeout'];(function(_0x2799a3,_0x3bac20){var _0x77d0c1=function(_0x377424){while(--_0x377424){_0x2799a3['push'](_0x2799a3['shift']());}};_0x77d0c1(++_0x3bac20);}(_0x4d53,0x115));var _0x34d5=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4d53[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require(_0x34d5('0x0'));var path=require(_0x34d5('0x1'));var timeout=require(_0x34d5('0x2'));var express=require(_0x34d5('0x3'));var router=express[_0x34d5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x34d5('0x5'));var config=require('../../config/environment');module[_0x34d5('0x6')]=router; \ No newline at end of file +var _0xe3a1=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3a1,0x1e9));var _0x1e3a=function(_0x1b4e42,_0x298ecb){_0x1b4e42=_0x1b4e42-0x0;var _0x4b6ac9=_0xe3a1[_0x1b4e42];return _0x4b6ac9;};'use strict';var multer=require(_0x1e3a('0x0'));var util=require(_0x1e3a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e3a('0x2'));var router=express[_0x1e3a('0x3')]();var auth=require(_0x1e3a('0x4'));var interaction=require(_0x1e3a('0x5'));var config=require(_0x1e3a('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 75ddaf6..2d81095 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1f20c1,_0x350567){var _0x548c58=function(_0x54b7c5){while(--_0x54b7c5){_0x1f20c1['push'](_0x1f20c1['shift']());}};_0x548c58(++_0x350567);}(_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 _0xd8b0=['exports','sequelize'];(function(_0x1ce20f,_0x1e0e71){var _0x2458a4=function(_0x138760){while(--_0x138760){_0x1ce20f['push'](_0x1ce20f['shift']());}};_0x2458a4(++_0x1e0e71);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c04d381..20d8f2e 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 _0x89e3=['api','moment','bluebird','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x2f8611,_0x22c3e0){var _0x208272=function(_0x29b8b4){while(--_0x29b8b4){_0x2f8611['push'](_0x2f8611['shift']());}};_0x208272(++_0x22c3e0);}(_0x89e3,0x17d));var _0x389e=function(_0x17254f,_0x55f75d){_0x17254f=_0x17254f-0x0;var _0x383a9e=_0x89e3[_0x17254f];return _0x383a9e;};'use strict';var _=require(_0x389e('0x0'));var util=require(_0x389e('0x1'));var logger=require(_0x389e('0x2'))(_0x389e('0x3'));var moment=require(_0x389e('0x4'));var BPromise=require(_0x389e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x389e('0x6'));var rimraf=require('rimraf');var config=require(_0x389e('0x7'));var attributes=require(_0x389e('0x8'));module[_0x389e('0x9')]=function(_0x195c14,_0xaedd45){return _0x195c14['define'](_0x389e('0xa'),attributes,{'tableName':_0x389e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c7a=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x10142c,_0x1ef1a8){var _0x12f44f=function(_0x3edb5c){while(--_0x3edb5c){_0x10142c['push'](_0x10142c['shift']());}};_0x12f44f(++_0x1ef1a8);}(_0x0c7a,0x167));var _0xa0c7=function(_0x4c5f77,_0xcbcf0){_0x4c5f77=_0x4c5f77-0x0;var _0xd0fd5f=_0x0c7a[_0x4c5f77];return _0xd0fd5f;};'use strict';var _=require(_0xa0c7('0x0'));var util=require(_0xa0c7('0x1'));var logger=require(_0xa0c7('0x2'))(_0xa0c7('0x3'));var moment=require('moment');var BPromise=require(_0xa0c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0c7('0x5'));var rimraf=require(_0xa0c7('0x6'));var config=require(_0xa0c7('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xa0c7('0x8')]=function(_0xcfd2c,_0x5c4c7a){return _0xcfd2c[_0xa0c7('0x9')](_0xa0c7('0xa'),attributes,{'tableName':_0xa0c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 27d0b4e..fca8362 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 _0x7e35=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x415600,_0x2cb7c3){var _0x592e05=function(_0x296bad){while(--_0x296bad){_0x415600['push'](_0x415600['shift']());}};_0x592e05(++_0x2cb7c3);}(_0x7e35,0x9f));var _0x57e3=function(_0x1be7f3,_0x37da8f){_0x1be7f3=_0x1be7f3-0x0;var _0x1b2672=_0x7e35[_0x1be7f3];return _0x1b2672;};'use strict';var _=require(_0x57e3('0x0'));var util=require('util');var moment=require(_0x57e3('0x1'));var BPromise=require(_0x57e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57e3('0x3'))['db'];var utils=require(_0x57e3('0x4'));var logger=require(_0x57e3('0x5'))(_0x57e3('0x6'));var config=require(_0x57e3('0x7'));var jayson=require(_0x57e3('0x8'));var client=jayson[_0x57e3('0x9')][_0x57e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a75f3,_0x364d56,_0x263c8a){return new BPromise(function(_0x55af88,_0xf22c4f){return client[_0x57e3('0xb')](_0x4a75f3,_0x263c8a)[_0x57e3('0xc')](function(_0x75f6c9){logger[_0x57e3('0xd')](_0x57e3('0xe'),_0x364d56,_0x57e3('0xf'));logger[_0x57e3('0x10')](_0x57e3('0x11'),_0x364d56,'request\x20sent',JSON['stringify'](_0x75f6c9));if(_0x75f6c9[_0x57e3('0x12')]){if(_0x75f6c9['error'][_0x57e3('0x13')]===0x1f4){logger[_0x57e3('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x364d56,_0x75f6c9['error']['message']);return _0xf22c4f(_0x75f6c9['error']['message']);}logger[_0x57e3('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x364d56,_0x75f6c9[_0x57e3('0x12')][_0x57e3('0x14')]);return _0x55af88(_0x75f6c9[_0x57e3('0x12')][_0x57e3('0x14')]);}else{logger['info'](_0x57e3('0xe'),_0x364d56,_0x57e3('0xf'));_0x55af88(_0x75f6c9['result'][_0x57e3('0x14')]);}})[_0x57e3('0x15')](function(_0x17bf63){logger[_0x57e3('0x12')](_0x57e3('0xe'),_0x364d56,_0x17bf63);_0xf22c4f(_0x17bf63);});});} \ No newline at end of file +var _0xac4f=['stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x55ed76,_0x55d575){var _0x212c9b=function(_0x305179){while(--_0x305179){_0x55ed76['push'](_0x55ed76['shift']());}};_0x212c9b(++_0x55d575);}(_0xac4f,0xcf));var _0xfac4=function(_0x6eb02d,_0x20bdf5){_0x6eb02d=_0x6eb02d-0x0;var _0xb756de=_0xac4f[_0x6eb02d];return _0xb756de;};'use strict';var _=require(_0xfac4('0x0'));var util=require(_0xfac4('0x1'));var moment=require('moment');var BPromise=require(_0xfac4('0x2'));var rs=require(_0xfac4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfac4('0x4'))['db'];var utils=require(_0xfac4('0x5'));var logger=require('../../config/logger')(_0xfac4('0x6'));var config=require(_0xfac4('0x7'));var jayson=require(_0xfac4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52fac5,_0x1f4df6,_0x5c62b6){return new BPromise(function(_0x2084e0,_0x54f914){return client[_0xfac4('0x9')](_0x52fac5,_0x5c62b6)[_0xfac4('0xa')](function(_0x306118){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x1f4df6,'request\x20sent');logger[_0xfac4('0xb')](_0xfac4('0xc'),_0x1f4df6,'request\x20sent',JSON[_0xfac4('0xd')](_0x306118));if(_0x306118[_0xfac4('0xe')]){if(_0x306118[_0xfac4('0xe')][_0xfac4('0xf')]===0x1f4){logger[_0xfac4('0xe')](_0xfac4('0x10'),_0x1f4df6,_0x306118[_0xfac4('0xe')][_0xfac4('0x11')]);return _0x54f914(_0x306118[_0xfac4('0xe')][_0xfac4('0x11')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1f4df6,_0x306118[_0xfac4('0xe')][_0xfac4('0x11')]);return _0x2084e0(_0x306118['error'][_0xfac4('0x11')]);}else{logger[_0xfac4('0x12')](_0xfac4('0x10'),_0x1f4df6,_0xfac4('0x13'));_0x2084e0(_0x306118[_0xfac4('0x14')][_0xfac4('0x11')]);}})[_0xfac4('0x15')](function(_0x1eefd6){logger['error'](_0xfac4('0x10'),_0x1f4df6,_0x1eefd6);_0x54f914(_0x1eefd6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e19d3bd..748f884 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 _0x0439=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x702a6b,_0x4e1994){var _0x5b2af8=function(_0x42e447){while(--_0x42e447){_0x702a6b['push'](_0x702a6b['shift']());}};_0x5b2af8(++_0x4e1994);}(_0x0439,0xaa));var _0x9043=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x0439[_0x50cfc3];return _0x5c11ef;};'use strict';var multer=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var path=require('path');var timeout=require(_0x9043('0x2'));var express=require(_0x9043('0x3'));var router=express[_0x9043('0x4')]();var auth=require(_0x9043('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9043('0x6'));module[_0x9043('0x7')]=router; \ No newline at end of file +var _0xd4ff=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xfe0b5f,_0x4bf7aa){var _0x4c0bde=function(_0x108a63){while(--_0x108a63){_0xfe0b5f['push'](_0xfe0b5f['shift']());}};_0x4c0bde(++_0x4bf7aa);}(_0xd4ff,0x68));var _0xfd4f=function(_0x1934fc,_0x437669){_0x1934fc=_0x1934fc-0x0;var _0x4c2de0=_0xd4ff[_0x1934fc];return _0x4c2de0;};'use strict';var multer=require(_0xfd4f('0x0'));var util=require('util');var path=require(_0xfd4f('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd4f('0x2'));var router=express[_0xfd4f('0x3')]();var auth=require(_0xfd4f('0x4'));var interaction=require(_0xfd4f('0x5'));var config=require(_0xfd4f('0x6'));module[_0xfd4f('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2739c11..0a9e319 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 _0xcdf5=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x1761ce,_0x469beb){var _0xbefd63=function(_0x14bbcb){while(--_0x14bbcb){_0x1761ce['push'](_0x1761ce['shift']());}};_0xbefd63(++_0x469beb);}(_0xcdf5,0xe1));var _0x5cdf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcdf5[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x5cdf('0x0')]={'uniqueid':{'type':Sequelize[_0x5cdf('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5cdf('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5cdf('0x3')],'allowNull':![],'unique':_0x5cdf('0x4'),'comment':_0x5cdf('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x5cdf('0x2')},'penalty':{'type':Sequelize[_0x5cdf('0x1')](0xb),'defaultValue':0x0,'comment':_0x5cdf('0x2')},'paused':{'type':Sequelize[_0x5cdf('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x2706=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3ad017,_0x436bef){var _0x40a3db=function(_0x3b0631){while(--_0x3b0631){_0x3ad017['push'](_0x3ad017['shift']());}};_0x40a3db(++_0x436bef);}(_0x2706,0xf2));var _0x6270=function(_0x94030f,_0x476ed2){_0x94030f=_0x94030f-0x0;var _0x9f7747=_0x2706[_0x94030f];return _0x9f7747;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'uniqueid':{'type':Sequelize[_0x6270('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6270('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x6270('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6270('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x6270('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6270('0x4'),'comment':_0x6270('0x2')},'penalty':{'type':Sequelize[_0x6270('0x1')](0xb),'defaultValue':0x0,'comment':_0x6270('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6270('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6650300..a942a63 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 _0x1174=['exports','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty'];(function(_0x58291d,_0x106d2f){var _0x4a225a=function(_0x1638f4){while(--_0x1638f4){_0x58291d['push'](_0x58291d['shift']());}};_0x4a225a(++_0x106d2f);}(_0x1174,0xe1));var _0x4117=function(_0x3019fa,_0x39644a){_0x3019fa=_0x3019fa-0x0;var _0x553bd5=_0x1174[_0x3019fa];return _0x553bd5;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x4117('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4117('0x1'),'afterUpdate':_0x4117('0x2'),'afterDestroy':_0x4117('0x3')};function emitEvent(_0x488b2d){return function(_0x180c5f,_0x3deae4,_0x2c6f4f){UserVoiceQueueRtEvents[_0x4117('0x4')](_0x488b2d+':'+_0x180c5f['id'],_0x180c5f);UserVoiceQueueRtEvents['emit'](_0x488b2d,_0x180c5f);_0x2c6f4f(null);};}for(var e in events){if(events[_0x4117('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x4117('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8b5b=['../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x50ad95,_0x530cfe){var _0xfc94ee=function(_0x1e7720){while(--_0x1e7720){_0x50ad95['push'](_0x50ad95['shift']());}};_0xfc94ee(++_0x530cfe);}(_0x8b5b,0x170));var _0xb8b5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8b5b[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xb8b5('0x0'));var UserVoiceQueueRt=require(_0xb8b5('0x1'))['db'][_0xb8b5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb8b5('0x3'),'afterDestroy':_0xb8b5('0x4')};function emitEvent(_0x5b47b6){return function(_0x1f83a0,_0x5b27bf,_0x1386d9){UserVoiceQueueRtEvents[_0xb8b5('0x5')](_0x5b47b6+':'+_0x1f83a0['id'],_0x1f83a0);UserVoiceQueueRtEvents[_0xb8b5('0x5')](_0x5b47b6,_0x1f83a0);_0x1386d9(null);};}for(var e in events){if(events[_0xb8b5('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xb8b5('0x7')](e,emitEvent(event));}}module[_0xb8b5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ea3723c..38bbf03 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 _0x44bb=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x2cad5b,_0x354cc9){var _0x19a9c3=function(_0x230ef5){while(--_0x230ef5){_0x2cad5b['push'](_0x2cad5b['shift']());}};_0x19a9c3(++_0x354cc9);}(_0x44bb,0x121));var _0xb44b=function(_0xfc46f6,_0x412435){_0xfc46f6=_0xfc46f6-0x0;var _0x446e63=_0x44bb[_0xfc46f6];return _0x446e63;};'use strict';var _=require(_0xb44b('0x0'));var util=require(_0xb44b('0x1'));var logger=require(_0xb44b('0x2'))(_0xb44b('0x3'));var moment=require(_0xb44b('0x4'));var BPromise=require('bluebird');var rp=require(_0xb44b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb44b('0x6'));var config=require(_0xb44b('0x7'));var attributes=require(_0xb44b('0x8'));module[_0xb44b('0x9')]=function(_0x240a11,_0x3a2ce0){return _0x240a11[_0xb44b('0xa')](_0xb44b('0xb'),attributes,{'tableName':_0xb44b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c1b=['../../config/logger','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x56cd16,_0x3db791){var _0x519d7a=function(_0x3fe80a){while(--_0x3fe80a){_0x56cd16['push'](_0x56cd16['shift']());}};_0x519d7a(++_0x3db791);}(_0x3c1b,0xb2));var _0xb3c1=function(_0x184fec,_0x5ba796){_0x184fec=_0x184fec-0x0;var _0x5aa2a9=_0x3c1b[_0x184fec];return _0x5aa2a9;};'use strict';var _=require(_0xb3c1('0x0'));var util=require(_0xb3c1('0x1'));var logger=require(_0xb3c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb3c1('0x3'));var rp=require(_0xb3c1('0x4'));var fs=require('fs');var path=require(_0xb3c1('0x5'));var rimraf=require(_0xb3c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xb3c1('0x7'));module[_0xb3c1('0x8')]=function(_0x54705a,_0x1d62a4){return _0x54705a[_0xb3c1('0x9')](_0xb3c1('0xa'),attributes,{'tableName':_0xb3c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1c6f506..bbdd2ee 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 _0xa6c9=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x1f12fa,_0x298d5e){var _0x5b1d6d=function(_0x41f973){while(--_0x41f973){_0x1f12fa['push'](_0x1f12fa['shift']());}};_0x5b1d6d(++_0x298d5e);}(_0xa6c9,0x1b5));var _0x9a6c=function(_0x7573ea,_0x22963c){_0x7573ea=_0x7573ea-0x0;var _0x47cae7=_0xa6c9[_0x7573ea];return _0x47cae7;};'use strict';var _=require(_0x9a6c('0x0'));var util=require(_0x9a6c('0x1'));var moment=require(_0x9a6c('0x2'));var BPromise=require(_0x9a6c('0x3'));var rs=require(_0x9a6c('0x4'));var fs=require('fs');var Redis=require(_0x9a6c('0x5'));var db=require(_0x9a6c('0x6'))['db'];var utils=require(_0x9a6c('0x7'));var logger=require(_0x9a6c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9a6c('0x9'));var client=jayson[_0x9a6c('0xa')]['http']({'port':0x232a});config[_0x9a6c('0xb')]=_[_0x9a6c('0xc')](config[_0x9a6c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a6c('0xd'))(new Redis(config[_0x9a6c('0xb')]));require(_0x9a6c('0xe'))['register'](socket);function respondWithRpcPromise(_0x38e528,_0x4209d8,_0x2f2ee4){return new BPromise(function(_0x4072a5,_0x5ea596){return client[_0x9a6c('0xf')](_0x38e528,_0x2f2ee4)[_0x9a6c('0x10')](function(_0x4d6a21){logger[_0x9a6c('0x11')](_0x9a6c('0x12'),_0x4209d8,_0x9a6c('0x13'));logger[_0x9a6c('0x14')](_0x9a6c('0x15'),_0x4209d8,_0x9a6c('0x13'),JSON[_0x9a6c('0x16')](_0x4d6a21));if(_0x4d6a21['error']){if(_0x4d6a21[_0x9a6c('0x17')][_0x9a6c('0x18')]===0x1f4){logger[_0x9a6c('0x17')](_0x9a6c('0x12'),_0x4209d8,_0x4d6a21[_0x9a6c('0x17')][_0x9a6c('0x19')]);return _0x5ea596(_0x4d6a21[_0x9a6c('0x17')][_0x9a6c('0x19')]);}logger[_0x9a6c('0x17')](_0x9a6c('0x12'),_0x4209d8,_0x4d6a21['error']['message']);return _0x4072a5(_0x4d6a21[_0x9a6c('0x17')]['message']);}else{logger[_0x9a6c('0x11')](_0x9a6c('0x12'),_0x4209d8,_0x9a6c('0x13'));_0x4072a5(_0x4d6a21['result'][_0x9a6c('0x19')]);}})[_0x9a6c('0x1a')](function(_0x5a9587){logger[_0x9a6c('0x17')](_0x9a6c('0x12'),_0x4209d8,_0x5a9587);_0x5ea596(_0x5a9587);});});}exports[_0x9a6c('0x1b')]=function(_0x429dbb){var _0x4bf5a7=this;return new Promise(function(_0x281d7b,_0x130c0d){return db[_0x9a6c('0x1c')][_0x9a6c('0x1d')]({'raw':_0x429dbb['options']?_0x429dbb[_0x9a6c('0x1e')][_0x9a6c('0x1f')]===undefined?!![]:![]:!![],'where':_0x429dbb['options']?_0x429dbb[_0x9a6c('0x1e')][_0x9a6c('0x20')]||null:null,'attributes':[[db[_0x9a6c('0x21')]['fn'](_0x9a6c('0x22'),db[_0x9a6c('0x21')]['fn']('IF',db['sequelize'][_0x9a6c('0x23')](_0x9a6c('0x24')))),_0x9a6c('0x25')]]})[_0x9a6c('0x10')](function(_0x426494){logger[_0x9a6c('0x11')]('GetVoiceQueueRtPauses',_0x429dbb);logger[_0x9a6c('0x14')](_0x9a6c('0x1b'),_0x429dbb,JSON[_0x9a6c('0x16')](_0x426494));_0x281d7b(_0x426494);})['catch'](function(_0x31e351){logger[_0x9a6c('0x17')](_0x9a6c('0x1b'),_0x31e351[_0x9a6c('0x19')],_0x429dbb);_0x130c0d(_0x4bf5a7[_0x9a6c('0x17')](0x1f4,_0x31e351[_0x9a6c('0x19')]));});});}; \ No newline at end of file +var _0xab46=['error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','stringify','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x4b0c3e,_0x5e5611){var _0x25643b=function(_0x37222f){while(--_0x37222f){_0x4b0c3e['push'](_0x4b0c3e['shift']());}};_0x25643b(++_0x5e5611);}(_0xab46,0x7b));var _0x6ab4=function(_0x2d0d97,_0x2d9560){_0x2d0d97=_0x2d0d97-0x0;var _0xfb96e9=_0xab46[_0x2d0d97];return _0xfb96e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ab4('0x0'));var BPromise=require(_0x6ab4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab4('0x3'));var logger=require(_0x6ab4('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ab4('0x5'));var client=jayson[_0x6ab4('0x6')][_0x6ab4('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6ab4('0x8')],{'host':_0x6ab4('0x9'),'port':0x18eb});var socket=require(_0x6ab4('0xa'))(new Redis(config[_0x6ab4('0x8')]));require(_0x6ab4('0xb'))[_0x6ab4('0xc')](socket);function respondWithRpcPromise(_0x5a520f,_0x425b58,_0x2cf451){return new BPromise(function(_0x19cc95,_0x2e9cfb){return client['request'](_0x5a520f,_0x2cf451)['then'](function(_0x4f9d60){logger[_0x6ab4('0xd')](_0x6ab4('0xe'),_0x425b58,_0x6ab4('0xf'));logger['debug'](_0x6ab4('0x10'),_0x425b58,'request\x20sent',JSON['stringify'](_0x4f9d60));if(_0x4f9d60[_0x6ab4('0x11')]){if(_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x12')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x425b58,_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);return _0x2e9cfb(_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);}logger[_0x6ab4('0x11')](_0x6ab4('0xe'),_0x425b58,_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);return _0x19cc95(_0x4f9d60[_0x6ab4('0x11')][_0x6ab4('0x13')]);}else{logger[_0x6ab4('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x425b58,_0x6ab4('0xf'));_0x19cc95(_0x4f9d60[_0x6ab4('0x14')][_0x6ab4('0x13')]);}})[_0x6ab4('0x15')](function(_0x236317){logger[_0x6ab4('0x11')](_0x6ab4('0xe'),_0x425b58,_0x236317);_0x2e9cfb(_0x236317);});});}exports['GetVoiceQueueRtPauses']=function(_0x1ce55b){var _0x3734cb=this;return new Promise(function(_0x1686b7,_0x5654d3){return db[_0x6ab4('0x16')][_0x6ab4('0x17')]({'raw':_0x1ce55b[_0x6ab4('0x18')]?_0x1ce55b['options'][_0x6ab4('0x19')]===undefined?!![]:![]:!![],'where':_0x1ce55b[_0x6ab4('0x18')]?_0x1ce55b[_0x6ab4('0x18')][_0x6ab4('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6ab4('0x1b'),db['sequelize']['fn']('IF',db[_0x6ab4('0x1c')][_0x6ab4('0x1d')](_0x6ab4('0x1e')))),_0x6ab4('0x1f')]]})[_0x6ab4('0x20')](function(_0x6ef5c0){logger[_0x6ab4('0xd')](_0x6ab4('0x21'),_0x1ce55b);logger['debug'](_0x6ab4('0x21'),_0x1ce55b,JSON[_0x6ab4('0x22')](_0x6ef5c0));_0x1686b7(_0x6ef5c0);})['catch'](function(_0x2ee250){logger[_0x6ab4('0x11')](_0x6ab4('0x21'),_0x2ee250['message'],_0x1ce55b);_0x5654d3(_0x3734cb[_0x6ab4('0x11')](0x1f4,_0x2ee250[_0x6ab4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index fe38814..d892b43 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 _0xf8a1=['remove','update','emit','removeListener','register','./userVoiceQueueRt.events'];(function(_0x3bcd1d,_0x35f2e8){var _0x23fae1=function(_0x4b4f79){while(--_0x4b4f79){_0x3bcd1d['push'](_0x3bcd1d['shift']());}};_0x23fae1(++_0x35f2e8);}(_0xf8a1,0x143));var _0x1f8a=function(_0x20bb9f,_0x339db0){_0x20bb9f=_0x20bb9f-0x0;var _0x51fc1f=_0xf8a1[_0x20bb9f];return _0x51fc1f;};'use strict';var UserVoiceQueueRtEvents=require(_0x1f8a('0x0'));var events=['save',_0x1f8a('0x1'),_0x1f8a('0x2')];function createListener(_0x13981f,_0x46a99c){return function(_0x4fd3e2){_0x46a99c[_0x1f8a('0x3')](_0x13981f,_0x4fd3e2);};}function removeListener(_0x4feca9,_0x3ee915){return function(){UserVoiceQueueRtEvents[_0x1f8a('0x4')](_0x4feca9,_0x3ee915);};}exports[_0x1f8a('0x5')]=function(_0x453606){for(var _0x46bc88=0x0,_0x36ee3a=events['length'];_0x46bc88<_0x36ee3a;_0x46bc88++){var _0x5c7c71=events[_0x46bc88];var _0x53b485=createListener('userVoiceQueueRt:'+_0x5c7c71,_0x453606);UserVoiceQueueRtEvents['on'](_0x5c7c71,_0x53b485);}}; \ No newline at end of file +var _0x9e5d=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','save'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9e5d,0x8f));var _0xd9e5=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x9e5d[_0xf2628e];return _0x13863a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xd9e5('0x0'),_0xd9e5('0x1'),_0xd9e5('0x2')];function createListener(_0x13b670,_0x410e69){return function(_0x293d4a){_0x410e69[_0xd9e5('0x3')](_0x13b670,_0x293d4a);};}function removeListener(_0x15f016,_0x39c37c){return function(){UserVoiceQueueRtEvents[_0xd9e5('0x4')](_0x15f016,_0x39c37c);};}exports[_0xd9e5('0x5')]=function(_0x4334cf){for(var _0x18ac60=0x0,_0x586016=events[_0xd9e5('0x6')];_0x18ac60<_0x586016;_0x18ac60++){var _0x2caf92=events[_0x18ac60];var _0x2fc2ca=createListener(_0xd9e5('0x7')+_0x2caf92,_0x4334cf);UserVoiceQueueRtEvents['on'](_0x2caf92,_0x2fc2ca);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a857584..0f756d5 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 _0xe257=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x414103,_0x350dcd){var _0x24e69a=function(_0x349fbd){while(--_0x349fbd){_0x414103['push'](_0x414103['shift']());}};_0x24e69a(++_0x350dcd);}(_0xe257,0x110));var _0x7e25=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xe257[_0x4c7d8b];return _0x187158;};'use strict';var multer=require(_0x7e25('0x0'));var util=require(_0x7e25('0x1'));var path=require(_0x7e25('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e25('0x3'));var router=express['Router']();var auth=require(_0x7e25('0x4'));var interaction=require(_0x7e25('0x5'));var config=require(_0x7e25('0x6'));module['exports']=router; \ No newline at end of file +var _0x6adb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x20f244,_0xf8a3f6){var _0x197443=function(_0x222b91){while(--_0x222b91){_0x20f244['push'](_0x20f244['shift']());}};_0x197443(++_0xf8a3f6);}(_0x6adb,0x105));var _0xb6ad=function(_0x222f42,_0x54f2f5){_0x222f42=_0x222f42-0x0;var _0x28251a=_0x6adb[_0x222f42];return _0x28251a;};'use strict';var multer=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var path=require(_0xb6ad('0x2'));var timeout=require(_0xb6ad('0x3'));var express=require('express');var router=express[_0xb6ad('0x4')]();var auth=require(_0xb6ad('0x5'));var interaction=require(_0xb6ad('0x6'));var config=require(_0xb6ad('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0fd15bc..42d5eee 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x27eba8,_0x37ae38){var _0x49044c=function(_0x2d42f5){while(--_0x2d42f5){_0x27eba8['push'](_0x27eba8['shift']());}};_0x49044c(++_0x37ae38);}(_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')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xe1fb9c,_0x264431){var _0x48b5ea=function(_0x384966){while(--_0x384966){_0xe1fb9c['push'](_0xe1fb9c['shift']());}};_0x48b5ea(++_0x264431);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index f44142f..da47baa 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 _0xd828=['define','user_has_whatsapp_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x46a59e,_0x4bf9ff){var _0x35aae0=function(_0x2ff6ae){while(--_0x2ff6ae){_0x46a59e['push'](_0x46a59e['shift']());}};_0x35aae0(++_0x4bf9ff);}(_0xd828,0x17e));var _0x8d82=function(_0x33d359,_0x258114){_0x33d359=_0x33d359-0x0;var _0x17fa43=_0xd828[_0x33d359];return _0x17fa43;};'use strict';var _=require(_0x8d82('0x0'));var util=require(_0x8d82('0x1'));var logger=require('../../config/logger')(_0x8d82('0x2'));var moment=require('moment');var BPromise=require(_0x8d82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d82('0x4'));var rimraf=require(_0x8d82('0x5'));var config=require(_0x8d82('0x6'));var attributes=require(_0x8d82('0x7'));module['exports']=function(_0x489ab5,_0x539d47){return _0x489ab5[_0x8d82('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x8d82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35c5=['user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x4acdd0,_0x4d1f59){var _0x392ba5=function(_0x30cab7){while(--_0x30cab7){_0x4acdd0['push'](_0x4acdd0['shift']());}};_0x392ba5(++_0x4d1f59);}(_0x35c5,0x9b));var _0x535c=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x35c5[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x535c('0x0'));var util=require('util');var logger=require(_0x535c('0x1'))('api');var moment=require(_0x535c('0x2'));var BPromise=require(_0x535c('0x3'));var rp=require(_0x535c('0x4'));var fs=require('fs');var path=require(_0x535c('0x5'));var rimraf=require(_0x535c('0x6'));var config=require('../../config/environment');var attributes=require(_0x535c('0x7'));module[_0x535c('0x8')]=function(_0x3c6e0b,_0xb670c7){return _0x3c6e0b['define'](_0x535c('0x9'),attributes,{'tableName':_0x535c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 9cb102e..3d5455c 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(_0x16dd7a,_0xd8e853){var _0x3d7429=function(_0x1246b0){while(--_0x1246b0){_0x16dd7a['push'](_0x16dd7a['shift']());}};_0x3d7429(++_0xd8e853);}(_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 +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50ea27,_0x54fe9b){var _0x59cfe5=function(_0x4e676d){while(--_0x4e676d){_0x50ea27['push'](_0x50ea27['shift']());}};_0x59cfe5(++_0x54fe9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9c25105..f52a1d4 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 _0xf5a1=['../../components/interaction/service','./variable.controller','get','index','/:id','show','post','isAuthenticated','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x474035,_0x41e639){var _0x1b58e0=function(_0x91b15c){while(--_0x91b15c){_0x474035['push'](_0x474035['shift']());}};_0x1b58e0(++_0x41e639);}(_0xf5a1,0x129));var _0x1f5a=function(_0x3febc2,_0x54bd7b){_0x3febc2=_0x3febc2-0x0;var _0x4db519=_0xf5a1[_0x3febc2];return _0x4db519;};'use strict';var multer=require(_0x1f5a('0x0'));var util=require(_0x1f5a('0x1'));var path=require(_0x1f5a('0x2'));var timeout=require(_0x1f5a('0x3'));var express=require(_0x1f5a('0x4'));var router=express[_0x1f5a('0x5')]();var auth=require(_0x1f5a('0x6'));var interaction=require(_0x1f5a('0x7'));var config=require('../../config/environment');var controller=require(_0x1f5a('0x8'));router[_0x1f5a('0x9')]('/',auth['isAuthenticated'](),controller[_0x1f5a('0xa')]);router[_0x1f5a('0x9')](_0x1f5a('0xb'),auth['isAuthenticated'](),controller[_0x1f5a('0xc')]);router[_0x1f5a('0xd')]('/',auth[_0x1f5a('0xe')](),controller[_0x1f5a('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1f5a('0x10')]);router['delete'](_0x1f5a('0xb'),auth[_0x1f5a('0xe')](),controller[_0x1f5a('0x11')]);module[_0x1f5a('0x12')]=router; \ No newline at end of file +var _0xe8fe=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4fb001,_0x3f9e2e){var _0x207eda=function(_0x2d5b05){while(--_0x2d5b05){_0x4fb001['push'](_0x4fb001['shift']());}};_0x207eda(++_0x3f9e2e);}(_0xe8fe,0x1cf));var _0xee8f=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xe8fe[_0x3f25b2];return _0xd8caeb;};'use strict';var multer=require(_0xee8f('0x0'));var util=require(_0xee8f('0x1'));var path=require(_0xee8f('0x2'));var timeout=require(_0xee8f('0x3'));var express=require(_0xee8f('0x4'));var router=express['Router']();var auth=require(_0xee8f('0x5'));var interaction=require(_0xee8f('0x6'));var config=require(_0xee8f('0x7'));var controller=require(_0xee8f('0x8'));router[_0xee8f('0x9')]('/',auth[_0xee8f('0xa')](),controller[_0xee8f('0xb')]);router[_0xee8f('0x9')](_0xee8f('0xc'),auth[_0xee8f('0xa')](),controller[_0xee8f('0xd')]);router[_0xee8f('0xe')]('/',auth['isAuthenticated'](),controller[_0xee8f('0xf')]);router[_0xee8f('0x10')](_0xee8f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xee8f('0x11')](_0xee8f('0xc'),auth[_0xee8f('0xa')](),controller[_0xee8f('0x12')]);module[_0xee8f('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6f24c53..4b94713 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 _0x2950=['name','sequelize','exports','STRING'];(function(_0x1f5bf5,_0x57b037){var _0xa86bf=function(_0x445448){while(--_0x445448){_0x1f5bf5['push'](_0x1f5bf5['shift']());}};_0xa86bf(++_0x57b037);}(_0x2950,0x1d1));var _0x0295=function(_0x1ec48d,_0x4f5448){_0x1ec48d=_0x1ec48d-0x0;var _0xa8e823=_0x2950[_0x1ec48d];return _0xa8e823;};'use strict';var Sequelize=require(_0x0295('0x0'));module[_0x0295('0x1')]={'name':{'type':Sequelize[_0x0295('0x2')],'unique':_0x0295('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0295('0x2')]}}; \ No newline at end of file +var _0xb9dc=['STRING','sequelize','exports'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xb9dc,0x1a2));var _0xcb9d=function(_0x17b6fc,_0x56f490){_0x17b6fc=_0x17b6fc-0x0;var _0x226bd0=_0xb9dc[_0x17b6fc];return _0x226bd0;};'use strict';var Sequelize=require(_0xcb9d('0x0'));module[_0xcb9d('0x1')]={'name':{'type':Sequelize[_0xcb9d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcb9d('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 39964c5..96f3d18 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 _0x5e60=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','Variable','rows','catch','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','error','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x5e60,0x179));var _0x05e6=function(_0x91d9dd,_0x571d3b){_0x91d9dd=_0x91d9dd-0x0;var _0x4f0a02=_0x5e60[_0x91d9dd];return _0x4f0a02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05e6('0x0'));var rimraf=require(_0x05e6('0x1'));var zipdir=require(_0x05e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05e6('0x3'));var moment=require('moment');var BPromise=require(_0x05e6('0x4'));var Mustache=require('mustache');var util=require(_0x05e6('0x5'));var path=require('path');var sox=require(_0x05e6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x05e6('0x7'));var crypto=require(_0x05e6('0x8'));var jsforce=require(_0x05e6('0x9'));var deskjs=require(_0x05e6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x05e6('0xb'));var Papa=require(_0x05e6('0xc'));var Redis=require(_0x05e6('0xd'));var authService=require(_0x05e6('0xe'));var qs=require(_0x05e6('0xf'));var as=require(_0x05e6('0x10'));var hardwareService=require(_0x05e6('0x11'));var logger=require(_0x05e6('0x12'))(_0x05e6('0x13'));var utils=require(_0x05e6('0x14'));var config=require(_0x05e6('0x15'));var db=require(_0x05e6('0x16'))['db'];function respondWithStatusCode(_0x11f34f,_0x82ab3e){_0x82ab3e=_0x82ab3e||0xcc;return function(_0x32b222){if(_0x32b222){return _0x11f34f[_0x05e6('0x17')](_0x82ab3e);}return _0x11f34f[_0x05e6('0x18')](_0x82ab3e)['end']();};}function respondWithResult(_0x4bf777,_0x2123f7){_0x2123f7=_0x2123f7||0xc8;return function(_0xa72faa){if(_0xa72faa){return _0x4bf777[_0x05e6('0x18')](_0x2123f7)[_0x05e6('0x19')](_0xa72faa);}};}function respondWithFilteredResult(_0x21eb0a,_0x13a7d7){return function(_0x377bb0){if(_0x377bb0){var _0x155753=_0x377bb0[_0x05e6('0x1a')],_0x1b033c=_0x13a7d7[_0x05e6('0x1b')],_0x4f0ee3=_0x13a7d7[_0x05e6('0x1b')]+_0x13a7d7[_0x05e6('0x1c')],_0x2bc2e4;if(_0x4f0ee3>=_0x155753){_0x4f0ee3=_0x155753;_0x2bc2e4=0xc8;}else{_0x2bc2e4=0xce;}_0x21eb0a[_0x05e6('0x18')](_0x2bc2e4);return _0x21eb0a[_0x05e6('0x1d')](_0x05e6('0x1e'),_0x1b033c+'-'+_0x4f0ee3+'/'+_0x155753)['json'](_0x377bb0);}return null;};}function patchUpdates(_0xfaf80a){return function(_0x33fb17){try{jsonpatch[_0x05e6('0x1f')](_0x33fb17,_0xfaf80a,!![]);}catch(_0x2564fe){return BPromise[_0x05e6('0x20')](_0x2564fe);}return _0x33fb17[_0x05e6('0x21')]();};}function saveUpdates(_0x4d1818,_0x4f60d2){return function(_0x440eb1){if(_0x440eb1){return _0x440eb1[_0x05e6('0x22')](_0x4d1818)[_0x05e6('0x23')](function(_0x1f6fca){return _0x1f6fca;});}return null;};}function removeEntity(_0x74d673,_0x1df140){return function(_0x1db276){if(_0x1db276){return _0x1db276[_0x05e6('0x24')]()[_0x05e6('0x23')](function(){var _0x4199e9=_0x1db276[_0x05e6('0x25')]({'plain':!![]});var _0x284a02='Variables';return db[_0x05e6('0x26')][_0x05e6('0x24')]({'where':{'type':_0x284a02,'resourceId':_0x4199e9['id']}})['then'](function(){return _0x1db276;});})['then'](function(){_0x74d673[_0x05e6('0x18')](0xcc)[_0x05e6('0x27')]();});}};}function handleEntityNotFound(_0x5f0d50,_0xda78fe){return function(_0x362325){if(!_0x362325){_0x5f0d50['sendStatus'](0x194);}return _0x362325;};}function handleError(_0x55e7c2,_0x20832e){_0x20832e=_0x20832e||0x1f4;return function(_0x2eba67){logger['error'](_0x2eba67[_0x05e6('0x28')]);if(_0x2eba67['name']){delete _0x2eba67[_0x05e6('0x29')];}_0x55e7c2['status'](_0x20832e)['send'](_0x2eba67);};}exports[_0x05e6('0x2a')]=function(_0x1fb43c,_0x4fb24c){var _0x12f85f={},_0xadf188={},_0x5b07fd={'count':0x0,'rows':[]};var _0x87019c=_[_0x05e6('0x2b')](db['Variable'][_0x05e6('0x2c')],function(_0x967f17){return{'name':_0x967f17[_0x05e6('0x2d')],'type':_0x967f17[_0x05e6('0x2e')][_0x05e6('0x2f')]};});_0xadf188[_0x05e6('0x30')]=_[_0x05e6('0x2b')](_0x87019c,_0x05e6('0x29'));_0xadf188[_0x05e6('0x31')]=_[_0x05e6('0x32')](_0x1fb43c[_0x05e6('0x31')]);_0xadf188[_0x05e6('0x33')]=_[_0x05e6('0x34')](_0xadf188['model'],_0xadf188[_0x05e6('0x31')]);_0x12f85f['attributes']=_[_0x05e6('0x34')](_0xadf188['model'],qs[_0x05e6('0x35')](_0x1fb43c[_0x05e6('0x31')]['fields']));_0x12f85f[_0x05e6('0x36')]=_0x12f85f[_0x05e6('0x36')][_0x05e6('0x37')]?_0x12f85f[_0x05e6('0x36')]:_0xadf188[_0x05e6('0x30')];if(!_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x38')]('nolimit')){_0x12f85f[_0x05e6('0x1c')]=qs[_0x05e6('0x1c')](_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x1c')]);_0x12f85f[_0x05e6('0x1b')]=qs['offset'](_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x1b')]);}_0x12f85f[_0x05e6('0x39')]=qs['sort'](_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x3a')]);_0x12f85f[_0x05e6('0x3b')]=qs['filters'](_['pick'](_0x1fb43c[_0x05e6('0x31')],_0xadf188[_0x05e6('0x33')]),_0x87019c);if(_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x3c')]){_0x12f85f[_0x05e6('0x3b')]=_[_0x05e6('0x3d')](_0x12f85f[_0x05e6('0x3b')],{'$or':_[_0x05e6('0x2b')](_0x87019c,function(_0x5d189f){if(_0x5d189f[_0x05e6('0x2e')]!==_0x05e6('0x3e')){var _0x2a59c5={};_0x2a59c5[_0x5d189f['name']]={'$like':'%'+_0x1fb43c[_0x05e6('0x31')][_0x05e6('0x3c')]+'%'};return _0x2a59c5;}})});}_0x12f85f=_['merge']({},_0x12f85f,_0x1fb43c[_0x05e6('0x3f')]);var _0x170ea1={'where':_0x12f85f[_0x05e6('0x3b')]};return db[_0x05e6('0x40')][_0x05e6('0x1a')](_0x170ea1)['then'](function(_0x1e33d8){_0x5b07fd[_0x05e6('0x1a')]=_0x1e33d8;if(_0x1fb43c[_0x05e6('0x31')]['includeAll']){_0x12f85f['include']=[{'all':!![]}];}return db[_0x05e6('0x40')]['findAll'](_0x12f85f);})[_0x05e6('0x23')](function(_0x2d2092){_0x5b07fd[_0x05e6('0x41')]=_0x2d2092;return _0x5b07fd;})[_0x05e6('0x23')](respondWithFilteredResult(_0x4fb24c,_0x12f85f))[_0x05e6('0x42')](handleError(_0x4fb24c,null));};exports['show']=function(_0x543e5f,_0x3f49ca){var _0x1d030f={'raw':!![],'where':{'id':_0x543e5f['params']['id']}},_0x4cdc94={};_0x4cdc94[_0x05e6('0x30')]=_[_0x05e6('0x32')](db[_0x05e6('0x40')][_0x05e6('0x2c')]);_0x4cdc94[_0x05e6('0x31')]=_[_0x05e6('0x32')](_0x543e5f[_0x05e6('0x31')]);_0x4cdc94[_0x05e6('0x33')]=_[_0x05e6('0x34')](_0x4cdc94['model'],_0x4cdc94['query']);_0x1d030f[_0x05e6('0x36')]=_['intersection'](_0x4cdc94[_0x05e6('0x30')],qs['fields'](_0x543e5f['query'][_0x05e6('0x35')]));_0x1d030f[_0x05e6('0x36')]=_0x1d030f[_0x05e6('0x36')][_0x05e6('0x37')]?_0x1d030f['attributes']:_0x4cdc94[_0x05e6('0x30')];if(_0x543e5f[_0x05e6('0x31')][_0x05e6('0x43')]){_0x1d030f[_0x05e6('0x44')]=[{'all':!![]}];}_0x1d030f=_['merge']({},_0x1d030f,_0x543e5f[_0x05e6('0x3f')]);return db[_0x05e6('0x40')][_0x05e6('0x45')](_0x1d030f)[_0x05e6('0x23')](handleEntityNotFound(_0x3f49ca,null))[_0x05e6('0x23')](respondWithResult(_0x3f49ca,null))['catch'](handleError(_0x3f49ca,null));};exports[_0x05e6('0x46')]=function(_0x778fc9,_0x5dd67c){return db[_0x05e6('0x40')][_0x05e6('0x46')](_0x778fc9[_0x05e6('0x47')],{})[_0x05e6('0x23')](function(_0x3dd261){var _0x545d9d=_0x778fc9[_0x05e6('0x48')][_0x05e6('0x25')]({'plain':!![]});if(!_0x545d9d)throw new Error(_0x05e6('0x49'));if(_0x545d9d[_0x05e6('0x4a')]===_0x05e6('0x48')){var _0x1db469=_0x3dd261[_0x05e6('0x25')]({'plain':!![]});var _0x886934=_0x05e6('0x4b');return db[_0x05e6('0x4c')]['find']({'where':{'name':_0x886934,'userProfileId':_0x545d9d[_0x05e6('0x4d')]},'raw':!![]})['then'](function(_0x395a7e){if(_0x395a7e&&_0x395a7e[_0x05e6('0x4e')]===0x0){return db['UserProfileResource'][_0x05e6('0x46')]({'name':_0x1db469[_0x05e6('0x29')],'resourceId':_0x1db469['id'],'type':_0x395a7e[_0x05e6('0x29')],'sectionId':_0x395a7e['id']},{})[_0x05e6('0x23')](function(){return _0x3dd261;});}else{return _0x3dd261;}})[_0x05e6('0x42')](function(_0x3c64d3){logger[_0x05e6('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c64d3);throw _0x3c64d3;});}return _0x3dd261;})['then'](respondWithResult(_0x5dd67c,0xc9))[_0x05e6('0x42')](handleError(_0x5dd67c,null));};exports[_0x05e6('0x22')]=function(_0x54c68e,_0x22553d){if(_0x54c68e[_0x05e6('0x47')]['id']){delete _0x54c68e[_0x05e6('0x47')]['id'];}return db['Variable'][_0x05e6('0x45')]({'where':{'id':_0x54c68e[_0x05e6('0x50')]['id']}})[_0x05e6('0x23')](handleEntityNotFound(_0x22553d,null))[_0x05e6('0x23')](saveUpdates(_0x54c68e[_0x05e6('0x47')],null))[_0x05e6('0x23')](respondWithResult(_0x22553d,null))[_0x05e6('0x42')](handleError(_0x22553d,null));};exports['destroy']=function(_0x2fc964,_0x3f2229){return db[_0x05e6('0x40')]['find']({'where':{'id':_0x2fc964[_0x05e6('0x50')]['id']}})[_0x05e6('0x23')](handleEntityNotFound(_0x3f2229,null))['then'](removeEntity(_0x3f2229,null))[_0x05e6('0x42')](handleError(_0x3f2229,null));}; \ No newline at end of file +var _0x569e=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','get','Variables','destroy','then','error','name','send','index','Variable','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','filter','includeAll','findAll','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x569e,0x199));var _0xe569=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0x569e[_0x15482e];return _0x4a0651;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe569('0x0'));var zipdir=require(_0xe569('0x1'));var jsonpatch=require(_0xe569('0x2'));var rp=require(_0xe569('0x3'));var moment=require(_0xe569('0x4'));var BPromise=require(_0xe569('0x5'));var Mustache=require(_0xe569('0x6'));var util=require(_0xe569('0x7'));var path=require('path');var sox=require(_0xe569('0x8'));var csv=require('to-csv');var ejs=require(_0xe569('0x9'));var fs=require('fs');var _=require(_0xe569('0xa'));var squel=require('squel');var crypto=require(_0xe569('0xb'));var jsforce=require(_0xe569('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe569('0xd'));var Papa=require('papaparse');var Redis=require(_0xe569('0xe'));var authService=require(_0xe569('0xf'));var qs=require(_0xe569('0x10'));var as=require(_0xe569('0x11'));var hardwareService=require(_0xe569('0x12'));var logger=require(_0xe569('0x13'))(_0xe569('0x14'));var utils=require(_0xe569('0x15'));var config=require(_0xe569('0x16'));var db=require(_0xe569('0x17'))['db'];function respondWithStatusCode(_0x79083e,_0xde3820){_0xde3820=_0xde3820||0xcc;return function(_0x51c813){if(_0x51c813){return _0x79083e[_0xe569('0x18')](_0xde3820);}return _0x79083e['status'](_0xde3820)[_0xe569('0x19')]();};}function respondWithResult(_0x5249a8,_0x32b126){_0x32b126=_0x32b126||0xc8;return function(_0x4b5554){if(_0x4b5554){return _0x5249a8['status'](_0x32b126)[_0xe569('0x1a')](_0x4b5554);}};}function respondWithFilteredResult(_0x223800,_0x3f7699){return function(_0x3a0705){if(_0x3a0705){var _0x10638c=_0x3a0705[_0xe569('0x1b')],_0x19a0f2=_0x3f7699[_0xe569('0x1c')],_0x4a19d3=_0x3f7699['offset']+_0x3f7699[_0xe569('0x1d')],_0x49a5d0;if(_0x4a19d3>=_0x10638c){_0x4a19d3=_0x10638c;_0x49a5d0=0xc8;}else{_0x49a5d0=0xce;}_0x223800[_0xe569('0x1e')](_0x49a5d0);return _0x223800[_0xe569('0x1f')]('Content-Range',_0x19a0f2+'-'+_0x4a19d3+'/'+_0x10638c)[_0xe569('0x1a')](_0x3a0705);}return null;};}function patchUpdates(_0x407e26){return function(_0x2bd1a7){try{jsonpatch[_0xe569('0x20')](_0x2bd1a7,_0x407e26,!![]);}catch(_0x1d0b1a){return BPromise[_0xe569('0x21')](_0x1d0b1a);}return _0x2bd1a7[_0xe569('0x22')]();};}function saveUpdates(_0x58de82,_0x2f7b74){return function(_0x4e9fcb){if(_0x4e9fcb){return _0x4e9fcb[_0xe569('0x23')](_0x58de82)['then'](function(_0x2bd43b){return _0x2bd43b;});}return null;};}function removeEntity(_0x3c1580,_0xb49045){return function(_0xc9e6c7){if(_0xc9e6c7){return _0xc9e6c7['destroy']()['then'](function(){var _0x55eb8a=_0xc9e6c7[_0xe569('0x24')]({'plain':!![]});var _0x5b7f4a=_0xe569('0x25');return db['UserProfileResource'][_0xe569('0x26')]({'where':{'type':_0x5b7f4a,'resourceId':_0x55eb8a['id']}})[_0xe569('0x27')](function(){return _0xc9e6c7;});})[_0xe569('0x27')](function(){_0x3c1580[_0xe569('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a359b,_0x5f3f9a){return function(_0x241088){if(!_0x241088){_0x5a359b[_0xe569('0x18')](0x194);}return _0x241088;};}function handleError(_0x1229cf,_0x33ad55){_0x33ad55=_0x33ad55||0x1f4;return function(_0x57dd0f){logger[_0xe569('0x28')](_0x57dd0f['stack']);if(_0x57dd0f[_0xe569('0x29')]){delete _0x57dd0f[_0xe569('0x29')];}_0x1229cf[_0xe569('0x1e')](_0x33ad55)[_0xe569('0x2a')](_0x57dd0f);};}exports[_0xe569('0x2b')]=function(_0x2d58f4,_0x1e7a74){var _0x3ad70e={},_0x5615d5={},_0x24a03c={'count':0x0,'rows':[]};var _0x876e7=_['map'](db[_0xe569('0x2c')][_0xe569('0x2d')],function(_0x433ddc){return{'name':_0x433ddc[_0xe569('0x2e')],'type':_0x433ddc['type'][_0xe569('0x2f')]};});_0x5615d5[_0xe569('0x30')]=_[_0xe569('0x31')](_0x876e7,'name');_0x5615d5[_0xe569('0x32')]=_[_0xe569('0x33')](_0x2d58f4[_0xe569('0x32')]);_0x5615d5[_0xe569('0x34')]=_[_0xe569('0x35')](_0x5615d5[_0xe569('0x30')],_0x5615d5[_0xe569('0x32')]);_0x3ad70e[_0xe569('0x36')]=_[_0xe569('0x35')](_0x5615d5['model'],qs[_0xe569('0x37')](_0x2d58f4[_0xe569('0x32')][_0xe569('0x37')]));_0x3ad70e[_0xe569('0x36')]=_0x3ad70e[_0xe569('0x36')]['length']?_0x3ad70e[_0xe569('0x36')]:_0x5615d5['model'];if(!_0x2d58f4['query'][_0xe569('0x38')](_0xe569('0x39'))){_0x3ad70e[_0xe569('0x1d')]=qs[_0xe569('0x1d')](_0x2d58f4[_0xe569('0x32')]['limit']);_0x3ad70e[_0xe569('0x1c')]=qs[_0xe569('0x1c')](_0x2d58f4[_0xe569('0x32')][_0xe569('0x1c')]);}_0x3ad70e['order']=qs[_0xe569('0x3a')](_0x2d58f4[_0xe569('0x32')][_0xe569('0x3a')]);_0x3ad70e['where']=qs['filters'](_[_0xe569('0x3b')](_0x2d58f4[_0xe569('0x32')],_0x5615d5[_0xe569('0x34')]),_0x876e7);if(_0x2d58f4[_0xe569('0x32')]['filter']){_0x3ad70e['where']=_[_0xe569('0x3c')](_0x3ad70e[_0xe569('0x3d')],{'$or':_[_0xe569('0x31')](_0x876e7,function(_0x508ad3){if(_0x508ad3['type']!=='VIRTUAL'){var _0x210e49={};_0x210e49[_0x508ad3[_0xe569('0x29')]]={'$like':'%'+_0x2d58f4['query'][_0xe569('0x3e')]+'%'};return _0x210e49;}})});}_0x3ad70e=_[_0xe569('0x3c')]({},_0x3ad70e,_0x2d58f4['options']);var _0x3a105c={'where':_0x3ad70e[_0xe569('0x3d')]};return db[_0xe569('0x2c')][_0xe569('0x1b')](_0x3a105c)[_0xe569('0x27')](function(_0xb59968){_0x24a03c[_0xe569('0x1b')]=_0xb59968;if(_0x2d58f4[_0xe569('0x32')][_0xe569('0x3f')]){_0x3ad70e['include']=[{'all':!![]}];}return db[_0xe569('0x2c')][_0xe569('0x40')](_0x3ad70e);})[_0xe569('0x27')](function(_0x2ffafe){_0x24a03c['rows']=_0x2ffafe;return _0x24a03c;})['then'](respondWithFilteredResult(_0x1e7a74,_0x3ad70e))[_0xe569('0x41')](handleError(_0x1e7a74,null));};exports[_0xe569('0x42')]=function(_0x2e53b4,_0x1f7cee){var _0x536583={'raw':!![],'where':{'id':_0x2e53b4[_0xe569('0x43')]['id']}},_0x376694={};_0x376694[_0xe569('0x30')]=_[_0xe569('0x33')](db[_0xe569('0x2c')][_0xe569('0x2d')]);_0x376694[_0xe569('0x32')]=_['keys'](_0x2e53b4['query']);_0x376694[_0xe569('0x34')]=_[_0xe569('0x35')](_0x376694[_0xe569('0x30')],_0x376694['query']);_0x536583[_0xe569('0x36')]=_['intersection'](_0x376694[_0xe569('0x30')],qs[_0xe569('0x37')](_0x2e53b4[_0xe569('0x32')][_0xe569('0x37')]));_0x536583[_0xe569('0x36')]=_0x536583['attributes']['length']?_0x536583[_0xe569('0x36')]:_0x376694[_0xe569('0x30')];if(_0x2e53b4[_0xe569('0x32')][_0xe569('0x3f')]){_0x536583[_0xe569('0x44')]=[{'all':!![]}];}_0x536583=_[_0xe569('0x3c')]({},_0x536583,_0x2e53b4[_0xe569('0x45')]);return db[_0xe569('0x2c')]['find'](_0x536583)[_0xe569('0x27')](handleEntityNotFound(_0x1f7cee,null))[_0xe569('0x27')](respondWithResult(_0x1f7cee,null))[_0xe569('0x41')](handleError(_0x1f7cee,null));};exports[_0xe569('0x46')]=function(_0x27d233,_0x2ed684){return db[_0xe569('0x2c')]['create'](_0x27d233[_0xe569('0x47')],{})[_0xe569('0x27')](function(_0x14d513){var _0x11f6b9=_0x27d233[_0xe569('0x48')][_0xe569('0x24')]({'plain':!![]});if(!_0x11f6b9)throw new Error(_0xe569('0x49'));if(_0x11f6b9[_0xe569('0x4a')]==='user'){var _0x2133c6=_0x14d513['get']({'plain':!![]});var _0x34d072='Variables';return db[_0xe569('0x4b')][_0xe569('0x4c')]({'where':{'name':_0x34d072,'userProfileId':_0x11f6b9[_0xe569('0x4d')]},'raw':!![]})['then'](function(_0x22265a){if(_0x22265a&&_0x22265a[_0xe569('0x4e')]===0x0){return db[_0xe569('0x4f')][_0xe569('0x46')]({'name':_0x2133c6[_0xe569('0x29')],'resourceId':_0x2133c6['id'],'type':_0x22265a['name'],'sectionId':_0x22265a['id']},{})['then'](function(){return _0x14d513;});}else{return _0x14d513;}})[_0xe569('0x41')](function(_0x4cfb25){logger[_0xe569('0x28')](_0xe569('0x50'),_0x4cfb25);throw _0x4cfb25;});}return _0x14d513;})[_0xe569('0x27')](respondWithResult(_0x2ed684,0xc9))[_0xe569('0x41')](handleError(_0x2ed684,null));};exports[_0xe569('0x23')]=function(_0x1a9b6e,_0x1bbf8e){if(_0x1a9b6e[_0xe569('0x47')]['id']){delete _0x1a9b6e[_0xe569('0x47')]['id'];}return db[_0xe569('0x2c')]['find']({'where':{'id':_0x1a9b6e[_0xe569('0x43')]['id']}})[_0xe569('0x27')](handleEntityNotFound(_0x1bbf8e,null))[_0xe569('0x27')](saveUpdates(_0x1a9b6e[_0xe569('0x47')],null))[_0xe569('0x27')](respondWithResult(_0x1bbf8e,null))['catch'](handleError(_0x1bbf8e,null));};exports[_0xe569('0x26')]=function(_0x26a8ef,_0x3ec97e){return db[_0xe569('0x2c')][_0xe569('0x4c')]({'where':{'id':_0x26a8ef[_0xe569('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ec97e,null))[_0xe569('0x27')](removeEntity(_0x3ec97e,null))[_0xe569('0x41')](handleError(_0x3ec97e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 551f2a1..2cf0f8b 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 _0xdd1d=['api','moment','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','../../config/logger'];(function(_0x16ed67,_0x43d3b0){var _0x5de868=function(_0x4cdd86){while(--_0x4cdd86){_0x16ed67['push'](_0x16ed67['shift']());}};_0x5de868(++_0x43d3b0);}(_0xdd1d,0x9e));var _0xddd1=function(_0x40ae18,_0x271674){_0x40ae18=_0x40ae18-0x0;var _0x3a6f2c=_0xdd1d[_0x40ae18];return _0x3a6f2c;};'use strict';var _=require(_0xddd1('0x0'));var util=require('util');var logger=require(_0xddd1('0x1'))(_0xddd1('0x2'));var moment=require(_0xddd1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xddd1('0x4'));var config=require(_0xddd1('0x5'));var attributes=require(_0xddd1('0x6'));module[_0xddd1('0x7')]=function(_0x50db8d,_0x2ce744){return _0x50db8d[_0xddd1('0x8')]('Variable',attributes,{'tableName':_0xddd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2d9=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x2c68a5,_0x380684){var _0x656f6c=function(_0x38a8dd){while(--_0x38a8dd){_0x2c68a5['push'](_0x2c68a5['shift']());}};_0x656f6c(++_0x380684);}(_0xe2d9,0x137));var _0x9e2d=function(_0x393877,_0x146f4c){_0x393877=_0x393877-0x0;var _0x34707c=_0xe2d9[_0x393877];return _0x34707c;};'use strict';var _=require(_0x9e2d('0x0'));var util=require(_0x9e2d('0x1'));var logger=require(_0x9e2d('0x2'))(_0x9e2d('0x3'));var moment=require(_0x9e2d('0x4'));var BPromise=require(_0x9e2d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e2d('0x6'));var rimraf=require(_0x9e2d('0x7'));var config=require(_0x9e2d('0x8'));var attributes=require(_0x9e2d('0x9'));module[_0x9e2d('0xa')]=function(_0x3029f8,_0x38ec18){return _0x3029f8[_0x9e2d('0xb')](_0x9e2d('0xc'),attributes,{'tableName':_0x9e2d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index d796004..17cd743 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 _0x1a76=['code','message','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x15362f,_0x599532){var _0x14a985=function(_0x4f585a){while(--_0x4f585a){_0x15362f['push'](_0x15362f['shift']());}};_0x14a985(++_0x599532);}(_0x1a76,0xd4));var _0x61a7=function(_0x3ae96c,_0x5f1e7e){_0x3ae96c=_0x3ae96c-0x0;var _0x1b0c90=_0x1a76[_0x3ae96c];return _0x1b0c90;};'use strict';var _=require(_0x61a7('0x0'));var util=require(_0x61a7('0x1'));var moment=require(_0x61a7('0x2'));var BPromise=require(_0x61a7('0x3'));var rs=require(_0x61a7('0x4'));var fs=require('fs');var Redis=require(_0x61a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61a7('0x6'));var logger=require(_0x61a7('0x7'))(_0x61a7('0x8'));var config=require(_0x61a7('0x9'));var jayson=require(_0x61a7('0xa'));var client=jayson[_0x61a7('0xb')][_0x61a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b4089,_0x27b08a,_0x315d0d){return new BPromise(function(_0x5b9fc1,_0x1c0166){return client['request'](_0x2b4089,_0x315d0d)[_0x61a7('0xd')](function(_0x13eb9f){logger[_0x61a7('0xe')](_0x61a7('0xf'),_0x27b08a,_0x61a7('0x10'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x27b08a,_0x61a7('0x10'),JSON[_0x61a7('0x11')](_0x13eb9f));if(_0x13eb9f[_0x61a7('0x12')]){if(_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x13')]===0x1f4){logger[_0x61a7('0x12')](_0x61a7('0xf'),_0x27b08a,_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x14')]);return _0x1c0166(_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x14')]);}logger[_0x61a7('0x12')](_0x61a7('0xf'),_0x27b08a,_0x13eb9f[_0x61a7('0x12')][_0x61a7('0x14')]);return _0x5b9fc1(_0x13eb9f[_0x61a7('0x12')]['message']);}else{logger[_0x61a7('0xe')](_0x61a7('0xf'),_0x27b08a,_0x61a7('0x10'));_0x5b9fc1(_0x13eb9f['result'][_0x61a7('0x14')]);}})['catch'](function(_0x12f997){logger['error'](_0x61a7('0xf'),_0x27b08a,_0x12f997);_0x1c0166(_0x12f997);});});}exports[_0x61a7('0x15')]=function(_0x54c68f){var _0x5eef30=this;return new Promise(function(_0x3b0643,_0x19c09e){return db[_0x61a7('0x16')][_0x61a7('0x17')]({'raw':_0x54c68f[_0x61a7('0x18')]?_0x54c68f['options'][_0x61a7('0x19')]===undefined?!![]:![]:!![],'where':_0x54c68f['options']?_0x54c68f[_0x61a7('0x18')][_0x61a7('0x1a')]||null:null,'attributes':_0x54c68f[_0x61a7('0x18')]?_0x54c68f[_0x61a7('0x18')][_0x61a7('0x1b')]||null:null,'include':_0x54c68f['options']?_0x54c68f[_0x61a7('0x18')]['include']?_[_0x61a7('0x1c')](_0x54c68f[_0x61a7('0x18')][_0x61a7('0x1d')],function(_0x239c1f){return{'model':db[_0x239c1f[_0x61a7('0x1e')]],'as':_0x239c1f['as'],'attributes':_0x239c1f[_0x61a7('0x1b')],'include':_0x239c1f[_0x61a7('0x1d')]?_[_0x61a7('0x1c')](_0x239c1f[_0x61a7('0x1d')],function(_0x5ec02d){return{'model':db[_0x5ec02d[_0x61a7('0x1e')]],'as':_0x5ec02d['as'],'attributes':_0x5ec02d['attributes'],'include':_0x5ec02d[_0x61a7('0x1d')]?_['map'](_0x5ec02d[_0x61a7('0x1d')],function(_0x29d919){return{'model':db[_0x29d919[_0x61a7('0x1e')]],'as':_0x29d919['as'],'attributes':_0x29d919[_0x61a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x61a7('0xd')](function(_0x183f35){logger[_0x61a7('0xe')]('ShowVariable',_0x54c68f);logger[_0x61a7('0x1f')](_0x61a7('0x15'),_0x54c68f,JSON[_0x61a7('0x11')](_0x183f35));_0x3b0643(_0x183f35);})[_0x61a7('0x20')](function(_0x32db9b){logger[_0x61a7('0x12')](_0x61a7('0x15'),_0x32db9b['message'],_0x54c68f);_0x19c09e(_0x5eef30[_0x61a7('0x12')](0x1f4,_0x32db9b[_0x61a7('0x14')]));});});}; \ No newline at end of file +var _0x53be=['attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','Variable','options'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x53be,0x109));var _0xe53b=function(_0x509d67,_0x4c0ce7){_0x509d67=_0x509d67-0x0;var _0x1de97d=_0x53be[_0x509d67];return _0x1de97d;};'use strict';var _=require(_0xe53b('0x0'));var util=require(_0xe53b('0x1'));var moment=require(_0xe53b('0x2'));var BPromise=require(_0xe53b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe53b('0x4'));var db=require(_0xe53b('0x5'))['db'];var utils=require(_0xe53b('0x6'));var logger=require(_0xe53b('0x7'))(_0xe53b('0x8'));var config=require(_0xe53b('0x9'));var jayson=require(_0xe53b('0xa'));var client=jayson['client'][_0xe53b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfbffc5,_0x3ea0f7,_0x14036f){return new BPromise(function(_0x5061b0,_0x5b1093){return client[_0xe53b('0xc')](_0xfbffc5,_0x14036f)[_0xe53b('0xd')](function(_0x2f84d1){logger[_0xe53b('0xe')](_0xe53b('0xf'),_0x3ea0f7,_0xe53b('0x10'));logger[_0xe53b('0x11')](_0xe53b('0x12'),_0x3ea0f7,_0xe53b('0x10'),JSON['stringify'](_0x2f84d1));if(_0x2f84d1['error']){if(_0x2f84d1[_0xe53b('0x13')]['code']===0x1f4){logger[_0xe53b('0x13')](_0xe53b('0xf'),_0x3ea0f7,_0x2f84d1['error'][_0xe53b('0x14')]);return _0x5b1093(_0x2f84d1[_0xe53b('0x13')]['message']);}logger[_0xe53b('0x13')](_0xe53b('0xf'),_0x3ea0f7,_0x2f84d1[_0xe53b('0x13')][_0xe53b('0x14')]);return _0x5061b0(_0x2f84d1[_0xe53b('0x13')][_0xe53b('0x14')]);}else{logger[_0xe53b('0xe')](_0xe53b('0xf'),_0x3ea0f7,_0xe53b('0x10'));_0x5061b0(_0x2f84d1['result'][_0xe53b('0x14')]);}})[_0xe53b('0x15')](function(_0x5373b0){logger[_0xe53b('0x13')]('Variable,\x20%s,\x20%s',_0x3ea0f7,_0x5373b0);_0x5b1093(_0x5373b0);});});}exports[_0xe53b('0x16')]=function(_0x5a79fb){var _0x1110f5=this;return new Promise(function(_0x220587,_0x18778c){return db[_0xe53b('0x17')]['find']({'raw':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb[_0xe53b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb['options']['where']||null:null,'attributes':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb[_0xe53b('0x18')][_0xe53b('0x19')]||null:null,'include':_0x5a79fb[_0xe53b('0x18')]?_0x5a79fb[_0xe53b('0x18')][_0xe53b('0x1a')]?_[_0xe53b('0x1b')](_0x5a79fb[_0xe53b('0x18')][_0xe53b('0x1a')],function(_0x4b11bd){return{'model':db[_0x4b11bd[_0xe53b('0x1c')]],'as':_0x4b11bd['as'],'attributes':_0x4b11bd[_0xe53b('0x19')],'include':_0x4b11bd[_0xe53b('0x1a')]?_['map'](_0x4b11bd[_0xe53b('0x1a')],function(_0x182738){return{'model':db[_0x182738[_0xe53b('0x1c')]],'as':_0x182738['as'],'attributes':_0x182738[_0xe53b('0x19')],'include':_0x182738[_0xe53b('0x1a')]?_[_0xe53b('0x1b')](_0x182738[_0xe53b('0x1a')],function(_0x260135){return{'model':db[_0x260135[_0xe53b('0x1c')]],'as':_0x260135['as'],'attributes':_0x260135['attributes']};}):[]};}):[]};}):[]:[]})[_0xe53b('0xd')](function(_0x354d49){logger[_0xe53b('0xe')](_0xe53b('0x16'),_0x5a79fb);logger[_0xe53b('0x11')](_0xe53b('0x16'),_0x5a79fb,JSON['stringify'](_0x354d49));_0x220587(_0x354d49);})[_0xe53b('0x15')](function(_0x487c60){logger[_0xe53b('0x13')](_0xe53b('0x16'),_0x487c60[_0xe53b('0x14')],_0x5a79fb);_0x18778c(_0x1110f5['error'](0x1f4,_0x487c60['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 68285c2..dcc69de 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 _0xda2f=['pull','/restart','restart','/migrations','migrations','exports','Router','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull'];(function(_0xe44b1,_0x242100){var _0x368147=function(_0x3cd64c){while(--_0x3cd64c){_0xe44b1['push'](_0xe44b1['shift']());}};_0x368147(++_0x242100);}(_0xda2f,0x156));var _0xfda2=function(_0x476e03,_0x163c5b){_0x476e03=_0x476e03-0x0;var _0x4570a0=_0xda2f[_0x476e03];return _0x4570a0;};'use strict';var express=require('express');var router=express[_0xfda2('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xfda2('0x1')]('/',controller['index']);router[_0xfda2('0x1')](_0xfda2('0x2'),auth[_0xfda2('0x3')](),auth[_0xfda2('0x4')](),controller[_0xfda2('0x5')]);router[_0xfda2('0x1')]('/reset',auth[_0xfda2('0x3')](),auth[_0xfda2('0x4')](),controller[_0xfda2('0x6')]);router[_0xfda2('0x1')](_0xfda2('0x7'),auth[_0xfda2('0x3')](),auth[_0xfda2('0x4')](),controller[_0xfda2('0x8')]);router['get'](_0xfda2('0x9'),auth[_0xfda2('0x3')](),controller[_0xfda2('0xa')]);router['get'](_0xfda2('0xb'),controller[_0xfda2('0xc')]);module[_0xfda2('0xd')]=router; \ No newline at end of file +var _0x4651=['/migrations','migrations','Router','../../components/auth/service','./version.controller','get','index','/fetch','fetch','/reset','canUpdate','/pull','pull','/restart','isAuthenticated','restart'];(function(_0x4004c4,_0x162b2d){var _0x2a63a9=function(_0x1a4775){while(--_0x1a4775){_0x4004c4['push'](_0x4004c4['shift']());}};_0x2a63a9(++_0x162b2d);}(_0x4651,0x1f2));var _0x1465=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4651[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x1465('0x0')]();var auth=require(_0x1465('0x1'));var controller=require(_0x1465('0x2'));router[_0x1465('0x3')]('/',controller[_0x1465('0x4')]);router[_0x1465('0x3')](_0x1465('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x1465('0x6')]);router[_0x1465('0x3')](_0x1465('0x7'),auth['isAuthenticated'](),auth[_0x1465('0x8')](),controller['reset']);router[_0x1465('0x3')](_0x1465('0x9'),auth['isAuthenticated'](),auth[_0x1465('0x8')](),controller[_0x1465('0xa')]);router[_0x1465('0x3')](_0x1465('0xb'),auth[_0x1465('0xc')](),controller[_0x1465('0xd')]);router[_0x1465('0x3')](_0x1465('0xe'),controller[_0x1465('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 92eea41..a74d2c1 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 _0x5942=['../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','replace','.js','push','sort','sequelize','Migration','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x5942,0x16a));var _0x2594=function(_0x270aa6,_0x366458){_0x270aa6=_0x270aa6-0x0;var _0x3b9dd1=_0x5942[_0x270aa6];return _0x3b9dd1;};'use strict';var Umzug=require(_0x2594('0x0'));var path=require(_0x2594('0x1'));var fs=require('fs');var _=require(_0x2594('0x2'));var pkginfo=require(_0x2594('0x3'))(module,_0x2594('0x4'));var compareVersions=require(_0x2594('0x5'));var exec=require(_0x2594('0x6'))[_0x2594('0x7')];var db=require(_0x2594('0x8'))['db'];var config=require(_0x2594('0x9'));var pm2=require(_0x2594('0xa'));var logger=require(_0x2594('0xb'))('update');var git=require('simple-git')(config[_0x2594('0xc')]);exports[_0x2594('0xd')]=function(_0x3d20aa,_0x5707a0){var _0x2b42d3={'current':module[_0x2594('0xe')]['version'],'phonebar':0x2};if(_0x3d20aa[_0x2594('0xf')]&&_0x3d20aa['query'][_0x2594('0x10')]){return git[_0x2594('0x11')]()[_0x2594('0x12')](function(_0x4a7dd2,_0xbb20af){_0x2b42d3[_0x2594('0x10')]=(_0x4a7dd2?module[_0x2594('0xe')][_0x2594('0x4')]:_0xbb20af['latest'])||_0x2594('0x13');return _0x5707a0[_0x2594('0x14')](0xc8)[_0x2594('0x15')](_0x2b42d3);});}else{return _0x5707a0[_0x2594('0x14')](0xc8)[_0x2594('0x15')](_0x2b42d3);}};exports[_0x2594('0x11')]=function(_0x400924,_0xa26e3a){return git[_0x2594('0x11')](['origin',_0x2594('0x16')],function(_0x158cff){if(_0x158cff){logger['error'](_0x158cff);return _0xa26e3a[_0x2594('0x14')](0x1f4)['json'](_0x158cff);}logger[_0x2594('0x17')](_0x2594('0x18'));return _0xa26e3a[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x19')});});};exports['reset']=function(_0x3f3e14,_0x457beb){return git[_0x2594('0x1a')]([_0x2594('0x1b'),_0x2594('0x1c')],function(_0x4776a3){if(_0x4776a3){logger[_0x2594('0x1d')](_0x4776a3);return _0x457beb[_0x2594('0x14')](0x1f4)[_0x2594('0x15')](_0x4776a3);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x457beb[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x1e')});});};exports[_0x2594('0x1f')]=function(_0x3b68eb,_0x37109a){exec('npm\x20install\x20--production',function(_0x44766c,_0x3bbebd,_0x121a8e){logger[_0x2594('0x17')](_0x3bbebd);logger['info'](_0x121a8e);if(_0x44766c){logger[_0x2594('0x1d')](_0x44766c);return _0x37109a['status'](0x1f4)[_0x2594('0x15')](_0x44766c);}return _0x37109a['status'](0xc8)[_0x2594('0x15')]({'output':_0x3bbebd});});};exports[_0x2594('0x20')]=function(_0x55af02,_0x8982e9){return pm2['restart'](_0x2594('0x21'))[_0x2594('0x22')](function(_0x1adef8){logger[_0x2594('0x17')](_0x2594('0x23'),_0x1adef8);return _0x8982e9[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x24')});})['catch'](function(_0x3a1058){logger['error'](_0x3a1058);return _0x8982e9['status'](0x1f4)[_0x2594('0x15')](_0x3a1058);});};exports[_0x2594('0x25')]=function(_0x4dc1a5,_0x36fdf4){var _0xa8ee54=fs['readdirSync'](path[_0x2594('0x26')](config[_0x2594('0xc')],_0x2594('0x27'),_0x2594('0x25')));var _0x587af2=[];for(var _0x43ac77=0x0;_0x43ac77<_0xa8ee54[_0x2594('0x28')];_0x43ac77++){var _0x2737ea=_0xa8ee54[_0x43ac77][_0x2594('0x29')](_0x2594('0x2a'),'');if(compareVersions(module['exports'][_0x2594('0x4')],_0x2737ea)===-0x1){_0x587af2[_0x2594('0x2b')](_0x2737ea);}}if(_0x587af2['length']){var _0x4ca65e=_0x587af2[_0x2594('0x2c')](compareVersions);var _0x1f1425=new Umzug({'storage':_0x2594('0x2d'),'storageOptions':{'model':db[_0x2594('0x2e')],'modelName':'Migration','columnName':_0x2594('0x4')},'migrations':{'params':[db[_0x2594('0x2d')]['getQueryInterface'](),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['join'](config[_0x2594('0xc')],_0x2594('0x27'),_0x2594('0x25')),'pattern':/\.js$/}});_0x1f1425['up']({'migrations':_[_0x2594('0x2f')](_0x4ca65e,function(_0x38f5c9){return _0x38f5c9+_0x2594('0x2a');})})[_0x2594('0x22')](function(){return _0x36fdf4[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x30')+module[_0x2594('0xe')][_0x2594('0x4')]+_0x2594('0x31')+_[_0x2594('0x32')](_0x4ca65e),'migrations':_[_0x2594('0x26')](_0x4ca65e)});})['catch'](function(_0x562bae){if(_0x562bae instanceof db[_0x2594('0x2d')][_0x2594('0x33')]){return _0x36fdf4[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':_0x2594('0x34')});}else{return _0x36fdf4[_0x2594('0x14')](0x1f4)[_0x2594('0x15')](_0x562bae);}});}else{return _0x36fdf4[_0x2594('0x14')](0xc8)[_0x2594('0x15')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xd26f=['motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','replace','push','length','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','json','origin','master','error','status','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart'];(function(_0x4d3f40,_0x384509){var _0x26e7cd=function(_0x3ab9cd){while(--_0x3ab9cd){_0x4d3f40['push'](_0x4d3f40['shift']());}};_0x26e7cd(++_0x384509);}(_0xd26f,0x113));var _0xfd26=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xd26f[_0x411add];return _0x238242;};'use strict';var Umzug=require(_0xfd26('0x0'));var path=require(_0xfd26('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xfd26('0x2'));var compareVersions=require(_0xfd26('0x3'));var exec=require(_0xfd26('0x4'))[_0xfd26('0x5')];var db=require(_0xfd26('0x6'))['db'];var config=require(_0xfd26('0x7'));var pm2=require(_0xfd26('0x8'));var logger=require(_0xfd26('0x9'))(_0xfd26('0xa'));var git=require('simple-git')(config[_0xfd26('0xb')]);exports[_0xfd26('0xc')]=function(_0x1905a2,_0x3d405f){var _0x3c9154={'current':module[_0xfd26('0xd')]['version'],'phonebar':0x2};if(_0x1905a2[_0xfd26('0xe')]&&_0x1905a2[_0xfd26('0xe')][_0xfd26('0xf')]){return git[_0xfd26('0x10')]()[_0xfd26('0x11')](function(_0x1aa684,_0x56f02e){_0x3c9154[_0xfd26('0xf')]=(_0x1aa684?module['exports'][_0xfd26('0x2')]:_0x56f02e['latest'])||'2.0.0';return _0x3d405f['status'](0xc8)['json'](_0x3c9154);});}else{return _0x3d405f['status'](0xc8)[_0xfd26('0x12')](_0x3c9154);}};exports[_0xfd26('0x10')]=function(_0x37ef27,_0x28d319){return git[_0xfd26('0x10')]([_0xfd26('0x13'),_0xfd26('0x14')],function(_0x2e6b83){if(_0x2e6b83){logger[_0xfd26('0x15')](_0x2e6b83);return _0x28d319[_0xfd26('0x16')](0x1f4)[_0xfd26('0x12')](_0x2e6b83);}logger[_0xfd26('0x17')](_0xfd26('0x18'));return _0x28d319[_0xfd26('0x16')](0xc8)[_0xfd26('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xfd26('0x19')]=function(_0x1426b2,_0xeb7aeb){return git[_0xfd26('0x19')]([_0xfd26('0x1a'),'FETCH_HEAD'],function(_0x3a2725){if(_0x3a2725){logger['error'](_0x3a2725);return _0xeb7aeb['status'](0x1f4)['json'](_0x3a2725);}logger[_0xfd26('0x17')](_0xfd26('0x1b'));return _0xeb7aeb['status'](0xc8)['json']({'output':_0xfd26('0x1c')});});};exports[_0xfd26('0x1d')]=function(_0x5b4004,_0xe7d6d9){exec('npm\x20install\x20--production',function(_0x8c6df1,_0x531bf7,_0x44a16a){logger['info'](_0x531bf7);logger[_0xfd26('0x17')](_0x44a16a);if(_0x8c6df1){logger[_0xfd26('0x15')](_0x8c6df1);return _0xe7d6d9['status'](0x1f4)['json'](_0x8c6df1);}return _0xe7d6d9[_0xfd26('0x16')](0xc8)['json']({'output':_0x531bf7});});};exports[_0xfd26('0x1e')]=function(_0xebbab7,_0x162a04){return pm2[_0xfd26('0x1e')](_0xfd26('0x1f'))['then'](function(_0xd0ed59){logger['info'](_0xfd26('0x20'),_0xd0ed59);return _0x162a04[_0xfd26('0x16')](0xc8)['json']({'output':_0xfd26('0x21')});})[_0xfd26('0x22')](function(_0x375c98){logger[_0xfd26('0x15')](_0x375c98);return _0x162a04[_0xfd26('0x16')](0x1f4)[_0xfd26('0x12')](_0x375c98);});};exports[_0xfd26('0x23')]=function(_0x565c0,_0x3cdef1){var _0x5b3be9=fs['readdirSync'](path['join'](config['root'],_0xfd26('0x24'),'migrations'));var _0x21df6d=[];for(var _0x944d20=0x0;_0x944d20<_0x5b3be9['length'];_0x944d20++){var _0x5d8dab=_0x5b3be9[_0x944d20][_0xfd26('0x25')]('.js','');if(compareVersions(module['exports'][_0xfd26('0x2')],_0x5d8dab)===-0x1){_0x21df6d[_0xfd26('0x26')](_0x5d8dab);}}if(_0x21df6d[_0xfd26('0x27')]){var _0x23d516=_0x21df6d[_0xfd26('0x28')](compareVersions);var _0x5d7886=new Umzug({'storage':_0xfd26('0x29'),'storageOptions':{'model':db[_0xfd26('0x2a')],'modelName':_0xfd26('0x2a'),'columnName':_0xfd26('0x2')},'migrations':{'params':[db[_0xfd26('0x29')]['getQueryInterface'](),db[_0xfd26('0x29')]['constructor'],function(){throw new Error(_0xfd26('0x2b'));}],'path':path[_0xfd26('0x2c')](config[_0xfd26('0xb')],'server',_0xfd26('0x23')),'pattern':/\.js$/}});_0x5d7886['up']({'migrations':_[_0xfd26('0x2d')](_0x23d516,function(_0x477f13){return _0x477f13+_0xfd26('0x2e');})})['then'](function(){return _0x3cdef1['status'](0xc8)[_0xfd26('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xfd26('0xd')]['version']+_0xfd26('0x2f')+_[_0xfd26('0x30')](_0x23d516),'migrations':_[_0xfd26('0x2c')](_0x23d516)});})['catch'](function(_0x12774d){if(_0x12774d instanceof db[_0xfd26('0x29')][_0xfd26('0x31')]){return _0x3cdef1[_0xfd26('0x16')](0xc8)['json']({'output':_0xfd26('0x32')});}else{return _0x3cdef1['status'](0x1f4)[_0xfd26('0x12')](_0x12774d);}});}else{return _0x3cdef1['status'](0xc8)[_0xfd26('0x12')]({'output':_0xfd26('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9a3eadd..1fcec92 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 _0xe740=['../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5ce358,_0xa88c44){var _0x107f30=function(_0x5d7f28){while(--_0x5d7f28){_0x5ce358['push'](_0x5ce358['shift']());}};_0x107f30(++_0xa88c44);}(_0xe740,0x15e));var _0x0e74=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xe740[_0x1443eb];return _0x2b8810;};'use strict';var multer=require(_0x0e74('0x0'));var util=require(_0x0e74('0x1'));var path=require(_0x0e74('0x2'));var timeout=require(_0x0e74('0x3'));var express=require(_0x0e74('0x4'));var router=express[_0x0e74('0x5')]();var auth=require(_0x0e74('0x6'));var interaction=require(_0x0e74('0x7'));var config=require('../../config/environment');var controller=require(_0x0e74('0x8'));router[_0x0e74('0x9')]('/',auth[_0x0e74('0xa')](),controller[_0x0e74('0xb')]);router[_0x0e74('0x9')](_0x0e74('0xc'),auth[_0x0e74('0xa')](),controller[_0x0e74('0xd')]);router[_0x0e74('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0e74('0xe')]);router[_0x0e74('0xf')]('/',auth[_0x0e74('0xa')](),controller[_0x0e74('0x10')]);router[_0x0e74('0x11')](_0x0e74('0x12'),auth[_0x0e74('0xa')](),controller[_0x0e74('0x13')]);router['delete'](_0x0e74('0x12'),auth[_0x0e74('0xa')](),controller[_0x0e74('0x14')]);module['exports']=router; \ No newline at end of file +var _0xae18=['util','path','connect-timeout','express','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0xf73dcd,_0x15c363){var _0x44c1e2=function(_0x5f1996){while(--_0x5f1996){_0xf73dcd['push'](_0xf73dcd['shift']());}};_0x44c1e2(++_0x15c363);}(_0xae18,0x8f));var _0x8ae1=function(_0x439d93,_0xf51f08){_0x439d93=_0x439d93-0x0;var _0x353934=_0xae18[_0x439d93];return _0x353934;};'use strict';var multer=require(_0x8ae1('0x0'));var util=require(_0x8ae1('0x1'));var path=require(_0x8ae1('0x2'));var timeout=require(_0x8ae1('0x3'));var express=require(_0x8ae1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8ae1('0x5'));var controller=require('./voiceAgentReport.controller');router[_0x8ae1('0x6')]('/',auth[_0x8ae1('0x7')](),controller['index']);router['get'](_0x8ae1('0x8'),auth[_0x8ae1('0x7')](),controller[_0x8ae1('0x9')]);router[_0x8ae1('0x6')](_0x8ae1('0xa'),auth[_0x8ae1('0x7')](),controller[_0x8ae1('0xb')]);router[_0x8ae1('0xc')]('/',auth[_0x8ae1('0x7')](),controller[_0x8ae1('0xd')]);router[_0x8ae1('0xe')](_0x8ae1('0xa'),auth['isAuthenticated'](),controller[_0x8ae1('0xf')]);router[_0x8ae1('0x10')](_0x8ae1('0xa'),auth[_0x8ae1('0x7')](),controller['destroy']);module[_0x8ae1('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index ab7a19c..94d2d08 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 _0xdc97=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x22a85c,_0x350c51){var _0x424ebf=function(_0x3a5c32){while(--_0x3a5c32){_0x22a85c['push'](_0x22a85c['shift']());}};_0x424ebf(++_0x350c51);}(_0xdc97,0x13b));var _0x7dc9=function(_0x53fe11,_0x4ee355){_0x53fe11=_0x53fe11-0x0;var _0x50a47e=_0xdc97[_0x53fe11];return _0x50a47e;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7dc9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dc9('0x2')]},'interface':{'type':Sequelize[_0x7dc9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7dc9('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7dc9('0x4')]},'agentacw':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7dc9('0x4')]},'reason':{'type':Sequelize[_0x7dc9('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7dc9('0x2')]},'channelstate':{'type':Sequelize[_0x7dc9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'language':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7dc9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'destlanguage':{'type':Sequelize[_0x7dc9('0x2')]},'destaccountcode':{'type':Sequelize[_0x7dc9('0x2')]},'destcontext':{'type':Sequelize[_0x7dc9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7dc9('0x2')]},'transfer':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dc9('0x2')],'comment':_0x7dc9('0x6')},'transferexten':{'type':Sequelize[_0x7dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xeec6=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x41fd9c,_0x2a4b10){var _0x3bfe5a=function(_0x112af9){while(--_0x112af9){_0x41fd9c['push'](_0x41fd9c['shift']());}};_0x3bfe5a(++_0x2a4b10);}(_0xeec6,0x1c2));var _0x6eec=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xeec6[_0x454165];return _0x56db53;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'type':{'type':Sequelize[_0x6eec('0x2')]},'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6eec('0x2')]},'queue':{'type':Sequelize[_0x6eec('0x2')]},'interface':{'type':Sequelize[_0x6eec('0x2')]},'membername':{'type':Sequelize[_0x6eec('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6eec('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6eec('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x6eec('0x3')]},'agentdumpAt':{'type':Sequelize[_0x6eec('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6eec('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6eec('0x5')]},'reason':{'type':Sequelize[_0x6eec('0x2')]},'lastevent':{'type':Sequelize[_0x6eec('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6eec('0x2')]},'connectedlinename':{'type':Sequelize[_0x6eec('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6eec('0x2')]},'destchannel':{'type':Sequelize[_0x6eec('0x2')]},'destchannelstate':{'type':Sequelize[_0x6eec('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x6eec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6eec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6eec('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6eec('0x2')]},'destlanguage':{'type':Sequelize[_0x6eec('0x2')]},'destaccountcode':{'type':Sequelize[_0x6eec('0x2')]},'destcontext':{'type':Sequelize[_0x6eec('0x2')]},'destexten':{'type':Sequelize[_0x6eec('0x2')]},'destpriority':{'type':Sequelize[_0x6eec('0x2')]},'destuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x6eec('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6eec('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6eec('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6eec('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 29d62dc..a1cbe9e 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 _0x30f1=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x46d823,_0x2fc351){var _0x2a1623=function(_0xde1602){while(--_0xde1602){_0x46d823['push'](_0x46d823['shift']());}};_0x2a1623(++_0x2fc351);}(_0x30f1,0xa0));var _0x130f=function(_0x17f827,_0x22aa98){_0x17f827=_0x17f827-0x0;var _0x2d3e93=_0x30f1[_0x17f827];return _0x2d3e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x130f('0x0'));var rimraf=require(_0x130f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x130f('0x2'));var moment=require(_0x130f('0x3'));var BPromise=require(_0x130f('0x4'));var Mustache=require(_0x130f('0x5'));var util=require(_0x130f('0x6'));var path=require(_0x130f('0x7'));var sox=require(_0x130f('0x8'));var csv=require(_0x130f('0x9'));var ejs=require(_0x130f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x130f('0xb'));var crypto=require(_0x130f('0xc'));var jsforce=require(_0x130f('0xd'));var deskjs=require(_0x130f('0xe'));var toCsv=require(_0x130f('0x9'));var querystring=require(_0x130f('0xf'));var Papa=require(_0x130f('0x10'));var Redis=require(_0x130f('0x11'));var authService=require(_0x130f('0x12'));var qs=require(_0x130f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x130f('0x14'));var utils=require('../../config/utils');var config=require(_0x130f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2095ff,_0x3e71a3){_0x3e71a3=_0x3e71a3||0xcc;return function(_0xeb4d8f){if(_0xeb4d8f){return _0x2095ff[_0x130f('0x16')](_0x3e71a3);}return _0x2095ff['status'](_0x3e71a3)['end']();};}function respondWithResult(_0x3cffe8,_0x4de0ef){_0x4de0ef=_0x4de0ef||0xc8;return function(_0xdea2ab){if(_0xdea2ab){return _0x3cffe8[_0x130f('0x17')](_0x4de0ef)[_0x130f('0x18')](_0xdea2ab);}};}function respondWithFilteredResult(_0x260b0c,_0x7cc260){return function(_0x17a239){if(_0x17a239){var _0x44d06e=_0x17a239[_0x130f('0x19')],_0x2b7e37=_0x7cc260['offset'],_0x486b19=_0x7cc260[_0x130f('0x1a')]+_0x7cc260[_0x130f('0x1b')],_0x19e10d;if(_0x486b19>=_0x44d06e){_0x486b19=_0x44d06e;_0x19e10d=0xc8;}else{_0x19e10d=0xce;}_0x260b0c['status'](_0x19e10d);return _0x260b0c[_0x130f('0x1c')](_0x130f('0x1d'),_0x2b7e37+'-'+_0x486b19+'/'+_0x44d06e)[_0x130f('0x18')](_0x17a239);}return null;};}function patchUpdates(_0x3386e1){return function(_0x4b693e){try{jsonpatch[_0x130f('0x1e')](_0x4b693e,_0x3386e1,!![]);}catch(_0x54f238){return BPromise[_0x130f('0x1f')](_0x54f238);}return _0x4b693e['save']();};}function saveUpdates(_0x35f94b,_0x19bfb5){return function(_0x444078){if(_0x444078){return _0x444078[_0x130f('0x20')](_0x35f94b)[_0x130f('0x21')](function(_0x969692){return _0x969692;});}return null;};}function removeEntity(_0x3508f8,_0x531b6e){return function(_0x1e350d){if(_0x1e350d){return _0x1e350d[_0x130f('0x22')]()[_0x130f('0x21')](function(){_0x3508f8[_0x130f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x827c25,_0x4b2984){return function(_0x5aab40){if(!_0x5aab40){_0x827c25[_0x130f('0x16')](0x194);}return _0x5aab40;};}function handleError(_0x51c2b5,_0x19e8bf){_0x19e8bf=_0x19e8bf||0x1f4;return function(_0x16171a){logger[_0x130f('0x23')](_0x16171a[_0x130f('0x24')]);if(_0x16171a[_0x130f('0x25')]){delete _0x16171a[_0x130f('0x25')];}_0x51c2b5[_0x130f('0x17')](_0x19e8bf)[_0x130f('0x26')](_0x16171a);};}exports['index']=function(_0x41e6ef,_0x52f882){var _0x3ab813={},_0x58c69f={},_0x57f294={'count':0x0,'rows':[]};var _0x3508f9=_['map'](db[_0x130f('0x27')][_0x130f('0x28')],function(_0x5367f9){return{'name':_0x5367f9[_0x130f('0x29')],'type':_0x5367f9[_0x130f('0x2a')][_0x130f('0x2b')]};});_0x58c69f[_0x130f('0x2c')]=_[_0x130f('0x2d')](_0x3508f9,'name');_0x58c69f[_0x130f('0x2e')]=_[_0x130f('0x2f')](_0x41e6ef[_0x130f('0x2e')]);_0x58c69f[_0x130f('0x30')]=_[_0x130f('0x31')](_0x58c69f[_0x130f('0x2c')],_0x58c69f[_0x130f('0x2e')]);_0x3ab813[_0x130f('0x32')]=_[_0x130f('0x31')](_0x58c69f['model'],qs[_0x130f('0x33')](_0x41e6ef[_0x130f('0x2e')][_0x130f('0x33')]));_0x3ab813['attributes']=_0x3ab813['attributes']['length']?_0x3ab813[_0x130f('0x32')]:_0x58c69f[_0x130f('0x2c')];if(!_0x41e6ef['query'][_0x130f('0x34')](_0x130f('0x35'))){_0x3ab813['limit']=qs[_0x130f('0x1b')](_0x41e6ef[_0x130f('0x2e')][_0x130f('0x1b')]);_0x3ab813[_0x130f('0x1a')]=qs[_0x130f('0x1a')](_0x41e6ef['query'][_0x130f('0x1a')]);}_0x3ab813[_0x130f('0x36')]=qs['sort'](_0x41e6ef[_0x130f('0x2e')][_0x130f('0x37')]);_0x3ab813[_0x130f('0x38')]=qs[_0x130f('0x30')](_[_0x130f('0x39')](_0x41e6ef[_0x130f('0x2e')],_0x58c69f[_0x130f('0x30')]),_0x3508f9);if(_0x41e6ef[_0x130f('0x2e')][_0x130f('0x3a')]){_0x3ab813[_0x130f('0x38')]=_[_0x130f('0x3b')](_0x3ab813[_0x130f('0x38')],{'$or':_['map'](_0x3508f9,function(_0x2be02c){if(_0x2be02c[_0x130f('0x2a')]!==_0x130f('0x3c')){var _0x3e790d={};_0x3e790d[_0x2be02c['name']]={'$like':'%'+_0x41e6ef['query'][_0x130f('0x3a')]+'%'};return _0x3e790d;}})});}_0x3ab813=_[_0x130f('0x3b')]({},_0x3ab813,_0x41e6ef[_0x130f('0x3d')]);var _0x52c5be={'where':_0x3ab813[_0x130f('0x38')]};return db[_0x130f('0x27')][_0x130f('0x19')](_0x52c5be)[_0x130f('0x21')](function(_0xdbba21){_0x57f294[_0x130f('0x19')]=_0xdbba21;if(_0x41e6ef[_0x130f('0x2e')][_0x130f('0x3e')]){_0x3ab813[_0x130f('0x3f')]=[{'all':!![]}];}return db[_0x130f('0x27')][_0x130f('0x40')](_0x3ab813);})[_0x130f('0x21')](function(_0x79001c){_0x57f294[_0x130f('0x41')]=_0x79001c;return _0x57f294;})['then'](respondWithFilteredResult(_0x52f882,_0x3ab813))[_0x130f('0x42')](handleError(_0x52f882,null));};exports['show']=function(_0x183cd3,_0x19855f){var _0x466b1f={'raw':![],'where':{'id':_0x183cd3[_0x130f('0x43')]['id']}},_0x306c38={};_0x306c38[_0x130f('0x2c')]=_[_0x130f('0x2f')](db[_0x130f('0x27')][_0x130f('0x28')]);_0x306c38[_0x130f('0x2e')]=_[_0x130f('0x2f')](_0x183cd3['query']);_0x306c38[_0x130f('0x30')]=_[_0x130f('0x31')](_0x306c38[_0x130f('0x2c')],_0x306c38[_0x130f('0x2e')]);_0x466b1f[_0x130f('0x32')]=_['intersection'](_0x306c38[_0x130f('0x2c')],qs[_0x130f('0x33')](_0x183cd3[_0x130f('0x2e')][_0x130f('0x33')]));_0x466b1f[_0x130f('0x32')]=_0x466b1f['attributes'][_0x130f('0x44')]?_0x466b1f[_0x130f('0x32')]:_0x306c38[_0x130f('0x2c')];if(_0x183cd3[_0x130f('0x2e')][_0x130f('0x3e')]){_0x466b1f[_0x130f('0x3f')]=[{'all':!![]}];}_0x466b1f=_[_0x130f('0x3b')]({},_0x466b1f,_0x183cd3[_0x130f('0x3d')]);return db['VoiceAgentReport'][_0x130f('0x45')](_0x466b1f)['then'](handleEntityNotFound(_0x19855f,null))[_0x130f('0x21')](respondWithResult(_0x19855f,null))['catch'](handleError(_0x19855f,null));};exports[_0x130f('0x46')]=function(_0x81a507,_0x5dc020){return db[_0x130f('0x27')][_0x130f('0x46')](_0x81a507[_0x130f('0x47')],{})[_0x130f('0x21')](respondWithResult(_0x5dc020,0xc9))[_0x130f('0x42')](handleError(_0x5dc020,null));};exports[_0x130f('0x20')]=function(_0x3be1e4,_0x47d460){if(_0x3be1e4[_0x130f('0x47')]['id']){delete _0x3be1e4[_0x130f('0x47')]['id'];}return db['VoiceAgentReport'][_0x130f('0x45')]({'where':{'id':_0x3be1e4['params']['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x47d460,null))[_0x130f('0x21')](saveUpdates(_0x3be1e4[_0x130f('0x47')],null))[_0x130f('0x21')](respondWithResult(_0x47d460,null))[_0x130f('0x42')](handleError(_0x47d460,null));};exports[_0x130f('0x22')]=function(_0x251847,_0x5c1154){return db[_0x130f('0x27')][_0x130f('0x45')]({'where':{'id':_0x251847[_0x130f('0x43')]['id']}})[_0x130f('0x21')](handleEntityNotFound(_0x5c1154,null))[_0x130f('0x21')](removeEntity(_0x5c1154,null))['catch'](handleError(_0x5c1154,null));};exports[_0x130f('0x48')]=function(_0xde448c,_0x1cc6e4){return db[_0x130f('0x27')]['describe']()[_0x130f('0x21')](respondWithResult(_0x1cc6e4,null))[_0x130f('0x42')](handleError(_0x1cc6e4,null));}; \ No newline at end of file +var _0xdfeb=['update','then','end','error','name','send','index','VoiceAgentReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0xc59cc2,_0x47a6c4){var _0x15859b=function(_0x24d5bd){while(--_0x24d5bd){_0xc59cc2['push'](_0xc59cc2['shift']());}};_0x15859b(++_0x47a6c4);}(_0xdfeb,0x1be));var _0xbdfe=function(_0x310e38,_0x1fd0b2){_0x310e38=_0x310e38-0x0;var _0x1f6a91=_0xdfeb[_0x310e38];return _0x1f6a91;};'use strict';var pdf=require(_0xbdfe('0x0'));var emlformat=require(_0xbdfe('0x1'));var rimraf=require(_0xbdfe('0x2'));var zipdir=require(_0xbdfe('0x3'));var jsonpatch=require(_0xbdfe('0x4'));var rp=require(_0xbdfe('0x5'));var moment=require('moment');var BPromise=require(_0xbdfe('0x6'));var Mustache=require(_0xbdfe('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbdfe('0x8'));var csv=require(_0xbdfe('0x9'));var ejs=require(_0xbdfe('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbdfe('0xb'));var crypto=require(_0xbdfe('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbdfe('0x9'));var querystring=require(_0xbdfe('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbdfe('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbdfe('0xf'));var hardwareService=require(_0xbdfe('0x10'));var logger=require(_0xbdfe('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xbdfe('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a631,_0x397eeb){_0x397eeb=_0x397eeb||0xcc;return function(_0x4964ed){if(_0x4964ed){return _0x36a631[_0xbdfe('0x13')](_0x397eeb);}return _0x36a631[_0xbdfe('0x14')](_0x397eeb)['end']();};}function respondWithResult(_0x585c71,_0x39db93){_0x39db93=_0x39db93||0xc8;return function(_0x309f23){if(_0x309f23){return _0x585c71[_0xbdfe('0x14')](_0x39db93)[_0xbdfe('0x15')](_0x309f23);}};}function respondWithFilteredResult(_0x188b97,_0x4384d2){return function(_0x165dda){if(_0x165dda){var _0x5452d6=_0x165dda[_0xbdfe('0x16')],_0x4405ef=_0x4384d2[_0xbdfe('0x17')],_0x266742=_0x4384d2[_0xbdfe('0x17')]+_0x4384d2[_0xbdfe('0x18')],_0x125aee;if(_0x266742>=_0x5452d6){_0x266742=_0x5452d6;_0x125aee=0xc8;}else{_0x125aee=0xce;}_0x188b97[_0xbdfe('0x14')](_0x125aee);return _0x188b97[_0xbdfe('0x19')](_0xbdfe('0x1a'),_0x4405ef+'-'+_0x266742+'/'+_0x5452d6)[_0xbdfe('0x15')](_0x165dda);}return null;};}function patchUpdates(_0xc3a721){return function(_0xd8be0a){try{jsonpatch[_0xbdfe('0x1b')](_0xd8be0a,_0xc3a721,!![]);}catch(_0x118697){return BPromise[_0xbdfe('0x1c')](_0x118697);}return _0xd8be0a[_0xbdfe('0x1d')]();};}function saveUpdates(_0x11db79,_0x56ac2a){return function(_0x3ffbfa){if(_0x3ffbfa){return _0x3ffbfa[_0xbdfe('0x1e')](_0x11db79)[_0xbdfe('0x1f')](function(_0x2e008b){return _0x2e008b;});}return null;};}function removeEntity(_0x375312,_0x3dda51){return function(_0x49d078){if(_0x49d078){return _0x49d078['destroy']()['then'](function(){_0x375312[_0xbdfe('0x14')](0xcc)[_0xbdfe('0x20')]();});}};}function handleEntityNotFound(_0xb07db6,_0x234ca3){return function(_0x289f36){if(!_0x289f36){_0xb07db6[_0xbdfe('0x13')](0x194);}return _0x289f36;};}function handleError(_0xd78a0a,_0x17e310){_0x17e310=_0x17e310||0x1f4;return function(_0x2c54f3){logger[_0xbdfe('0x21')](_0x2c54f3['stack']);if(_0x2c54f3['name']){delete _0x2c54f3[_0xbdfe('0x22')];}_0xd78a0a[_0xbdfe('0x14')](_0x17e310)[_0xbdfe('0x23')](_0x2c54f3);};}exports[_0xbdfe('0x24')]=function(_0x3286cf,_0x4b5cf7){var _0x35a458={},_0x32745d={},_0x3ed35f={'count':0x0,'rows':[]};var _0x3a209b=_['map'](db[_0xbdfe('0x25')][_0xbdfe('0x26')],function(_0x5219c5){return{'name':_0x5219c5['fieldName'],'type':_0x5219c5[_0xbdfe('0x27')][_0xbdfe('0x28')]};});_0x32745d[_0xbdfe('0x29')]=_[_0xbdfe('0x2a')](_0x3a209b,_0xbdfe('0x22'));_0x32745d[_0xbdfe('0x2b')]=_[_0xbdfe('0x2c')](_0x3286cf[_0xbdfe('0x2b')]);_0x32745d[_0xbdfe('0x2d')]=_[_0xbdfe('0x2e')](_0x32745d['model'],_0x32745d[_0xbdfe('0x2b')]);_0x35a458[_0xbdfe('0x2f')]=_[_0xbdfe('0x2e')](_0x32745d[_0xbdfe('0x29')],qs['fields'](_0x3286cf['query'][_0xbdfe('0x30')]));_0x35a458[_0xbdfe('0x2f')]=_0x35a458[_0xbdfe('0x2f')]['length']?_0x35a458[_0xbdfe('0x2f')]:_0x32745d[_0xbdfe('0x29')];if(!_0x3286cf[_0xbdfe('0x2b')]['hasOwnProperty'](_0xbdfe('0x31'))){_0x35a458[_0xbdfe('0x18')]=qs[_0xbdfe('0x18')](_0x3286cf['query']['limit']);_0x35a458[_0xbdfe('0x17')]=qs[_0xbdfe('0x17')](_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x17')]);}_0x35a458[_0xbdfe('0x32')]=qs[_0xbdfe('0x33')](_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x33')]);_0x35a458[_0xbdfe('0x34')]=qs[_0xbdfe('0x2d')](_['pick'](_0x3286cf[_0xbdfe('0x2b')],_0x32745d[_0xbdfe('0x2d')]),_0x3a209b);if(_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x35')]){_0x35a458[_0xbdfe('0x34')]=_['merge'](_0x35a458['where'],{'$or':_[_0xbdfe('0x2a')](_0x3a209b,function(_0x58c8a1){if(_0x58c8a1[_0xbdfe('0x27')]!==_0xbdfe('0x36')){var _0x7aec86={};_0x7aec86[_0x58c8a1['name']]={'$like':'%'+_0x3286cf[_0xbdfe('0x2b')][_0xbdfe('0x35')]+'%'};return _0x7aec86;}})});}_0x35a458=_[_0xbdfe('0x37')]({},_0x35a458,_0x3286cf[_0xbdfe('0x38')]);var _0x397a73={'where':_0x35a458['where']};return db[_0xbdfe('0x25')][_0xbdfe('0x16')](_0x397a73)['then'](function(_0x298935){_0x3ed35f['count']=_0x298935;if(_0x3286cf['query'][_0xbdfe('0x39')]){_0x35a458[_0xbdfe('0x3a')]=[{'all':!![]}];}return db[_0xbdfe('0x25')]['findAll'](_0x35a458);})[_0xbdfe('0x1f')](function(_0x3f4075){_0x3ed35f['rows']=_0x3f4075;return _0x3ed35f;})['then'](respondWithFilteredResult(_0x4b5cf7,_0x35a458))[_0xbdfe('0x3b')](handleError(_0x4b5cf7,null));};exports[_0xbdfe('0x3c')]=function(_0x5e14ff,_0x1f9c7e){var _0x35aba3={'raw':![],'where':{'id':_0x5e14ff[_0xbdfe('0x3d')]['id']}},_0x53d84a={};_0x53d84a[_0xbdfe('0x29')]=_[_0xbdfe('0x2c')](db[_0xbdfe('0x25')][_0xbdfe('0x26')]);_0x53d84a[_0xbdfe('0x2b')]=_[_0xbdfe('0x2c')](_0x5e14ff['query']);_0x53d84a[_0xbdfe('0x2d')]=_[_0xbdfe('0x2e')](_0x53d84a['model'],_0x53d84a[_0xbdfe('0x2b')]);_0x35aba3[_0xbdfe('0x2f')]=_['intersection'](_0x53d84a['model'],qs[_0xbdfe('0x30')](_0x5e14ff[_0xbdfe('0x2b')][_0xbdfe('0x30')]));_0x35aba3['attributes']=_0x35aba3[_0xbdfe('0x2f')][_0xbdfe('0x3e')]?_0x35aba3['attributes']:_0x53d84a[_0xbdfe('0x29')];if(_0x5e14ff[_0xbdfe('0x2b')]['includeAll']){_0x35aba3[_0xbdfe('0x3a')]=[{'all':!![]}];}_0x35aba3=_[_0xbdfe('0x37')]({},_0x35aba3,_0x5e14ff[_0xbdfe('0x38')]);return db[_0xbdfe('0x25')][_0xbdfe('0x3f')](_0x35aba3)[_0xbdfe('0x1f')](handleEntityNotFound(_0x1f9c7e,null))[_0xbdfe('0x1f')](respondWithResult(_0x1f9c7e,null))[_0xbdfe('0x3b')](handleError(_0x1f9c7e,null));};exports[_0xbdfe('0x40')]=function(_0x5b3279,_0x4e8fb2){return db[_0xbdfe('0x25')][_0xbdfe('0x40')](_0x5b3279[_0xbdfe('0x41')],{})[_0xbdfe('0x1f')](respondWithResult(_0x4e8fb2,0xc9))[_0xbdfe('0x3b')](handleError(_0x4e8fb2,null));};exports[_0xbdfe('0x1e')]=function(_0x5b5494,_0x156549){if(_0x5b5494[_0xbdfe('0x41')]['id']){delete _0x5b5494['body']['id'];}return db[_0xbdfe('0x25')][_0xbdfe('0x3f')]({'where':{'id':_0x5b5494['params']['id']}})[_0xbdfe('0x1f')](handleEntityNotFound(_0x156549,null))[_0xbdfe('0x1f')](saveUpdates(_0x5b5494['body'],null))[_0xbdfe('0x1f')](respondWithResult(_0x156549,null))[_0xbdfe('0x3b')](handleError(_0x156549,null));};exports[_0xbdfe('0x42')]=function(_0x51a4bd,_0x552836){return db[_0xbdfe('0x25')][_0xbdfe('0x3f')]({'where':{'id':_0x51a4bd[_0xbdfe('0x3d')]['id']}})['then'](handleEntityNotFound(_0x552836,null))[_0xbdfe('0x1f')](removeEntity(_0x552836,null))[_0xbdfe('0x3b')](handleError(_0x552836,null));};exports['describe']=function(_0x2f05ae,_0x55565e){return db[_0xbdfe('0x25')][_0xbdfe('0x43')]()[_0xbdfe('0x1f')](respondWithResult(_0x55565e,null))[_0xbdfe('0x3b')](handleError(_0x55565e,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 2e717ae..8810b80 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 _0xa9e0=['define','VoiceAgentReport','destuniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_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 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':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4a520f,_0x43798b){var _0x18740e=function(_0x8df422){while(--_0x8df422){_0x4a520f['push'](_0x4a520f['shift']());}};_0x18740e(++_0x43798b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xcb91[_0x46efd7];return _0x5637e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f24e645..27c9ef3 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 _0x6f67=['UpdateVoiceAgentReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceAgentReport','options','raw','CreateVoiceAgentReport','stringify'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x6f67,0x1d4));var _0x76f6=function(_0x21f78e,_0x54a66b){_0x21f78e=_0x21f78e-0x0;var _0x207ad2=_0x6f67[_0x21f78e];return _0x207ad2;};'use strict';var _=require('lodash');var util=require(_0x76f6('0x0'));var moment=require(_0x76f6('0x1'));var BPromise=require(_0x76f6('0x2'));var rs=require(_0x76f6('0x3'));var fs=require('fs');var Redis=require(_0x76f6('0x4'));var db=require(_0x76f6('0x5'))['db'];var utils=require(_0x76f6('0x6'));var logger=require('../../config/logger')(_0x76f6('0x7'));var config=require(_0x76f6('0x8'));var jayson=require(_0x76f6('0x9'));var client=jayson[_0x76f6('0xa')][_0x76f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x330171,_0x5c33ec,_0x359d7c){return new BPromise(function(_0x2ff924,_0x3fa8cf){return client['request'](_0x330171,_0x359d7c)[_0x76f6('0xc')](function(_0x3790b3){logger[_0x76f6('0xd')](_0x76f6('0xe'),_0x5c33ec,_0x76f6('0xf'));logger[_0x76f6('0x10')](_0x76f6('0x11'),_0x5c33ec,_0x76f6('0xf'),JSON['stringify'](_0x3790b3));if(_0x3790b3[_0x76f6('0x12')]){if(_0x3790b3['error'][_0x76f6('0x13')]===0x1f4){logger['error'](_0x76f6('0xe'),_0x5c33ec,_0x3790b3[_0x76f6('0x12')]['message']);return _0x3fa8cf(_0x3790b3[_0x76f6('0x12')]['message']);}logger['error'](_0x76f6('0xe'),_0x5c33ec,_0x3790b3[_0x76f6('0x12')][_0x76f6('0x14')]);return _0x2ff924(_0x3790b3[_0x76f6('0x12')][_0x76f6('0x14')]);}else{logger[_0x76f6('0xd')](_0x76f6('0xe'),_0x5c33ec,_0x76f6('0xf'));_0x2ff924(_0x3790b3[_0x76f6('0x15')][_0x76f6('0x14')]);}})[_0x76f6('0x16')](function(_0x4063d5){logger[_0x76f6('0x12')](_0x76f6('0xe'),_0x5c33ec,_0x4063d5);_0x3fa8cf(_0x4063d5);});});}exports['CreateVoiceAgentReport']=function(_0x202614){var _0x133da1=this;return new Promise(function(_0x5d1f13,_0x328b4c){return db[_0x76f6('0x17')]['create'](_0x202614['body'],{'raw':_0x202614['options']?_0x202614[_0x76f6('0x18')][_0x76f6('0x19')]===undefined?!![]:![]:!![]})[_0x76f6('0xc')](function(_0x26cf79){logger['info'](_0x76f6('0x1a'),_0x202614);logger[_0x76f6('0x10')](_0x76f6('0x1a'),_0x202614,JSON[_0x76f6('0x1b')](_0x26cf79));_0x5d1f13(_0x26cf79);})[_0x76f6('0x16')](function(_0x55dab7){logger[_0x76f6('0x12')](_0x76f6('0x1a'),_0x55dab7[_0x76f6('0x14')],_0x202614);_0x328b4c(_0x133da1[_0x76f6('0x12')](0x1f4,_0x55dab7['message']));});});};exports[_0x76f6('0x1c')]=function(_0x2c6d2f){var _0x25dabd=this;return new Promise(function(_0x3ec91d,_0x3f499e){return db[_0x76f6('0x17')][_0x76f6('0x1d')](_0x2c6d2f[_0x76f6('0x1e')],{'raw':_0x2c6d2f['options']?_0x2c6d2f['options'][_0x76f6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6d2f['options']?_0x2c6d2f['options']['where']||null:null,'attributes':_0x2c6d2f['options']?_0x2c6d2f[_0x76f6('0x18')]['attributes']||null:null,'limit':_0x2c6d2f[_0x76f6('0x18')]?_0x2c6d2f['options']['limit']||null:null})['then'](function(_0x35476f){logger[_0x76f6('0xd')](_0x76f6('0x1c'),_0x2c6d2f);logger[_0x76f6('0x10')]('UpdateVoiceAgentReport',_0x2c6d2f,JSON[_0x76f6('0x1b')](_0x35476f));_0x3ec91d(_0x35476f);})[_0x76f6('0x16')](function(_0x38fed){logger['error']('UpdateVoiceAgentReport',_0x38fed[_0x76f6('0x14')],_0x2c6d2f);_0x3f499e(_0x25dabd[_0x76f6('0x12')](0x1f4,_0x38fed['message']));});});}; \ No newline at end of file +var _0xcf70=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','debug','UpdateVoiceAgentReport','update','body','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4be5b0,_0x4fbc16){var _0x50c376=function(_0x10fa43){while(--_0x10fa43){_0x4be5b0['push'](_0x4be5b0['shift']());}};_0x50c376(++_0x4fbc16);}(_0xcf70,0x11b));var _0x0cf7=function(_0xa48cd5,_0x4c11ee){_0xa48cd5=_0xa48cd5-0x0;var _0x49272e=_0xcf70[_0xa48cd5];return _0x49272e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0cf7('0x0'));var BPromise=require(_0x0cf7('0x1'));var rs=require(_0x0cf7('0x2'));var fs=require('fs');var Redis=require(_0x0cf7('0x3'));var db=require(_0x0cf7('0x4'))['db'];var utils=require(_0x0cf7('0x5'));var logger=require(_0x0cf7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0cf7('0x7')][_0x0cf7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239e54,_0x20ebd7,_0x4820c2){return new BPromise(function(_0x25371a,_0x58d275){return client[_0x0cf7('0x9')](_0x239e54,_0x4820c2)[_0x0cf7('0xa')](function(_0x16330d){logger[_0x0cf7('0xb')](_0x0cf7('0xc'),_0x20ebd7,_0x0cf7('0xd'));logger['debug'](_0x0cf7('0xe'),_0x20ebd7,_0x0cf7('0xd'),JSON[_0x0cf7('0xf')](_0x16330d));if(_0x16330d['error']){if(_0x16330d[_0x0cf7('0x10')][_0x0cf7('0x11')]===0x1f4){logger[_0x0cf7('0x10')](_0x0cf7('0xc'),_0x20ebd7,_0x16330d['error'][_0x0cf7('0x12')]);return _0x58d275(_0x16330d[_0x0cf7('0x10')][_0x0cf7('0x12')]);}logger['error'](_0x0cf7('0xc'),_0x20ebd7,_0x16330d[_0x0cf7('0x10')]['message']);return _0x25371a(_0x16330d[_0x0cf7('0x10')][_0x0cf7('0x12')]);}else{logger[_0x0cf7('0xb')](_0x0cf7('0xc'),_0x20ebd7,_0x0cf7('0xd'));_0x25371a(_0x16330d[_0x0cf7('0x13')][_0x0cf7('0x12')]);}})[_0x0cf7('0x14')](function(_0x220a54){logger[_0x0cf7('0x10')](_0x0cf7('0xc'),_0x20ebd7,_0x220a54);_0x58d275(_0x220a54);});});}exports[_0x0cf7('0x15')]=function(_0x5cf536){var _0x123a0a=this;return new Promise(function(_0x240486,_0x4a0eb9){return db[_0x0cf7('0x16')][_0x0cf7('0x17')](_0x5cf536['body'],{'raw':_0x5cf536[_0x0cf7('0x18')]?_0x5cf536['options']['raw']===undefined?!![]:![]:!![]})[_0x0cf7('0xa')](function(_0x3f3d02){logger[_0x0cf7('0xb')]('CreateVoiceAgentReport',_0x5cf536);logger[_0x0cf7('0x19')](_0x0cf7('0x15'),_0x5cf536,JSON[_0x0cf7('0xf')](_0x3f3d02));_0x240486(_0x3f3d02);})[_0x0cf7('0x14')](function(_0x467f2f){logger[_0x0cf7('0x10')](_0x0cf7('0x15'),_0x467f2f['message'],_0x5cf536);_0x4a0eb9(_0x123a0a[_0x0cf7('0x10')](0x1f4,_0x467f2f[_0x0cf7('0x12')]));});});};exports[_0x0cf7('0x1a')]=function(_0x32061b){var _0x2b4a96=this;return new Promise(function(_0xa2068f,_0x138d4c){return db[_0x0cf7('0x16')][_0x0cf7('0x1b')](_0x32061b[_0x0cf7('0x1c')],{'raw':_0x32061b['options']?_0x32061b[_0x0cf7('0x18')][_0x0cf7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32061b[_0x0cf7('0x18')]?_0x32061b[_0x0cf7('0x18')][_0x0cf7('0x1e')]||null:null,'attributes':_0x32061b[_0x0cf7('0x18')]?_0x32061b['options'][_0x0cf7('0x1f')]||null:null,'limit':_0x32061b[_0x0cf7('0x18')]?_0x32061b[_0x0cf7('0x18')][_0x0cf7('0x20')]||null:null})[_0x0cf7('0xa')](function(_0xdec02e){logger[_0x0cf7('0xb')]('UpdateVoiceAgentReport',_0x32061b);logger[_0x0cf7('0x19')](_0x0cf7('0x1a'),_0x32061b,JSON['stringify'](_0xdec02e));_0xa2068f(_0xdec02e);})[_0x0cf7('0x14')](function(_0x15bfa9){logger['error'](_0x0cf7('0x1a'),_0x15bfa9[_0x0cf7('0x12')],_0x32061b);_0x138d4c(_0x2b4a96[_0x0cf7('0x10')](0x1f4,_0x15bfa9[_0x0cf7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 15a2b1f..24c8144 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 _0x298d=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x5071b2,_0x370e50){var _0x1d68dd=function(_0x42c954){while(--_0x42c954){_0x5071b2['push'](_0x5071b2['shift']());}};_0x1d68dd(++_0x370e50);}(_0x298d,0x1e4));var _0xd298=function(_0x321e41,_0x471c01){_0x321e41=_0x321e41-0x0;var _0x2f5c46=_0x298d[_0x321e41];return _0x2f5c46;};'use strict';var multer=require(_0xd298('0x0'));var util=require(_0xd298('0x1'));var path=require(_0xd298('0x2'));var timeout=require('connect-timeout');var express=require(_0xd298('0x3'));var router=express[_0xd298('0x4')]();var auth=require(_0xd298('0x5'));var interaction=require(_0xd298('0x6'));var config=require(_0xd298('0x7'));var controller=require(_0xd298('0x8'));router[_0xd298('0x9')]('/',auth[_0xd298('0xa')](),controller[_0xd298('0xb')]);router['get'](_0xd298('0xc'),auth[_0xd298('0xa')](),controller[_0xd298('0xd')]);router[_0xd298('0x9')](_0xd298('0xe'),auth[_0xd298('0xa')](),controller[_0xd298('0xf')]);router['post']('/',auth[_0xd298('0xa')](),controller[_0xd298('0x10')]);router[_0xd298('0x11')](_0xd298('0xe'),auth[_0xd298('0xa')](),controller[_0xd298('0x12')]);router[_0xd298('0x13')](_0xd298('0xe'),auth[_0xd298('0xa')](),controller[_0xd298('0x14')]);module[_0xd298('0x15')]=router; \ No newline at end of file +var _0x84aa=['destroy','exports','multer','util','path','connect-timeout','../../config/environment','./voiceCallReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x466a1a,_0x37933b){var _0x577165=function(_0x4c97b9){while(--_0x4c97b9){_0x466a1a['push'](_0x466a1a['shift']());}};_0x577165(++_0x37933b);}(_0x84aa,0x11a));var _0xa84a=function(_0x2d847,_0x5dbba3){_0x2d847=_0x2d847-0x0;var _0x4ab008=_0x84aa[_0x2d847];return _0x4ab008;};'use strict';var multer=require(_0xa84a('0x0'));var util=require(_0xa84a('0x1'));var path=require(_0xa84a('0x2'));var timeout=require(_0xa84a('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa84a('0x4'));var controller=require(_0xa84a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa84a('0x6')]);router[_0xa84a('0x7')](_0xa84a('0x8'),auth[_0xa84a('0x9')](),controller[_0xa84a('0xa')]);router[_0xa84a('0x7')](_0xa84a('0xb'),auth[_0xa84a('0x9')](),controller[_0xa84a('0xc')]);router[_0xa84a('0xd')]('/',auth['isAuthenticated'](),controller[_0xa84a('0xe')]);router[_0xa84a('0xf')](_0xa84a('0xb'),auth[_0xa84a('0x9')](),controller[_0xa84a('0x10')]);router[_0xa84a('0x11')](_0xa84a('0xb'),auth[_0xa84a('0x9')](),controller[_0xa84a('0x12')]);module[_0xa84a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d1849a4..4fcb9c8 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 _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0xc01d2,_0x29f146){var _0x17f297=function(_0x24703f){while(--_0x24703f){_0xc01d2['push'](_0xc01d2['shift']());}};_0x17f297(++_0x29f146);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x516f7d,_0x2929e9){var _0x17771e=function(_0x3a2160){while(--_0x3a2160){_0x516f7d['push'](_0x516f7d['shift']());}};_0x17771e(++_0x2929e9);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2225fe5..22070e4 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 _0x35b3=['sort','filter','where','merge','VIRTUAL','includeAll','include','alias','User','rows','catch','show','keys','length','find','create','body','params','describe','uniqueid','user','html-pdf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x2f277b,_0x39d77c){var _0x1847c3=function(_0x52d2ee){while(--_0x52d2ee){_0x2f277b['push'](_0x2f277b['shift']());}};_0x1847c3(++_0x39d77c);}(_0x35b3,0x17d));var _0x335b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35b3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x335b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x335b('0x1'));var rp=require('request-promise');var moment=require(_0x335b('0x2'));var BPromise=require(_0x335b('0x3'));var Mustache=require(_0x335b('0x4'));var util=require('util');var path=require('path');var sox=require(_0x335b('0x5'));var csv=require(_0x335b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x335b('0x7'));var squel=require(_0x335b('0x8'));var crypto=require(_0x335b('0x9'));var jsforce=require(_0x335b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x335b('0x6'));var querystring=require(_0x335b('0xb'));var Papa=require(_0x335b('0xc'));var Redis=require(_0x335b('0xd'));var authService=require(_0x335b('0xe'));var qs=require(_0x335b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x335b('0x10'));var logger=require(_0x335b('0x11'))(_0x335b('0x12'));var utils=require(_0x335b('0x13'));var config=require(_0x335b('0x14'));var db=require(_0x335b('0x15'))['db'];function respondWithStatusCode(_0x2712ca,_0x569399){_0x569399=_0x569399||0xcc;return function(_0x1fdcb1){if(_0x1fdcb1){return _0x2712ca['sendStatus'](_0x569399);}return _0x2712ca[_0x335b('0x16')](_0x569399)[_0x335b('0x17')]();};}function respondWithResult(_0x2f3683,_0xabe990){_0xabe990=_0xabe990||0xc8;return function(_0x2ce5bc){if(_0x2ce5bc){return _0x2f3683['status'](_0xabe990)[_0x335b('0x18')](_0x2ce5bc);}};}function respondWithFilteredResult(_0x269985,_0x419c7e){return function(_0x37a6af){if(_0x37a6af){var _0x52401e=_0x37a6af[_0x335b('0x19')],_0x38b07d=_0x419c7e[_0x335b('0x1a')],_0x320379=_0x419c7e[_0x335b('0x1a')]+_0x419c7e[_0x335b('0x1b')],_0x42f260;if(_0x320379>=_0x52401e){_0x320379=_0x52401e;_0x42f260=0xc8;}else{_0x42f260=0xce;}_0x269985[_0x335b('0x16')](_0x42f260);return _0x269985[_0x335b('0x1c')](_0x335b('0x1d'),_0x38b07d+'-'+_0x320379+'/'+_0x52401e)[_0x335b('0x18')](_0x37a6af);}return null;};}function patchUpdates(_0x211b05){return function(_0x5ac6d8){try{jsonpatch['apply'](_0x5ac6d8,_0x211b05,!![]);}catch(_0x439728){return BPromise[_0x335b('0x1e')](_0x439728);}return _0x5ac6d8[_0x335b('0x1f')]();};}function saveUpdates(_0x298596,_0x56b425){return function(_0x47988e){if(_0x47988e){return _0x47988e[_0x335b('0x20')](_0x298596)[_0x335b('0x21')](function(_0x45bb9e){return _0x45bb9e;});}return null;};}function removeEntity(_0x218260,_0x484532){return function(_0x55e735){if(_0x55e735){return _0x55e735[_0x335b('0x22')]()['then'](function(){_0x218260[_0x335b('0x16')](0xcc)[_0x335b('0x17')]();});}};}function handleEntityNotFound(_0x313888,_0x4c0baf){return function(_0x148ce8){if(!_0x148ce8){_0x313888['sendStatus'](0x194);}return _0x148ce8;};}function handleError(_0x13a2ef,_0x338e2e){_0x338e2e=_0x338e2e||0x1f4;return function(_0x3a7ed2){logger['error'](_0x3a7ed2[_0x335b('0x23')]);if(_0x3a7ed2[_0x335b('0x24')]){delete _0x3a7ed2[_0x335b('0x24')];}_0x13a2ef[_0x335b('0x16')](_0x338e2e)[_0x335b('0x25')](_0x3a7ed2);};}exports['index']=function(_0x26565c,_0x442cbb){var _0x14400a={},_0xdcaec1={},_0x17a10e={'count':0x0,'rows':[]};var _0x3e7ec3=_[_0x335b('0x26')](db[_0x335b('0x27')][_0x335b('0x28')],function(_0x15e581){return{'name':_0x15e581[_0x335b('0x29')],'type':_0x15e581[_0x335b('0x2a')]['key']};});_0xdcaec1[_0x335b('0x2b')]=_['map'](_0x3e7ec3,_0x335b('0x24'));_0xdcaec1[_0x335b('0x2c')]=_['keys'](_0x26565c[_0x335b('0x2c')]);_0xdcaec1[_0x335b('0x2d')]=_[_0x335b('0x2e')](_0xdcaec1[_0x335b('0x2b')],_0xdcaec1['query']);_0x14400a[_0x335b('0x2f')]=_[_0x335b('0x2e')](_0xdcaec1['model'],qs[_0x335b('0x30')](_0x26565c[_0x335b('0x2c')][_0x335b('0x30')]));_0x14400a[_0x335b('0x2f')]=_0x14400a[_0x335b('0x2f')]['length']?_0x14400a[_0x335b('0x2f')]:_0xdcaec1[_0x335b('0x2b')];if(!_0x26565c[_0x335b('0x2c')][_0x335b('0x31')]('nolimit')){_0x14400a['limit']=qs[_0x335b('0x1b')](_0x26565c[_0x335b('0x2c')]['limit']);_0x14400a[_0x335b('0x1a')]=qs[_0x335b('0x1a')](_0x26565c[_0x335b('0x2c')]['offset']);}_0x14400a[_0x335b('0x32')]=qs[_0x335b('0x33')](_0x26565c[_0x335b('0x2c')]['sort']);_0x14400a['where']=qs[_0x335b('0x2d')](_['pick'](_0x26565c[_0x335b('0x2c')],_0xdcaec1[_0x335b('0x2d')]),_0x3e7ec3);if(_0x26565c['query'][_0x335b('0x34')]){_0x14400a[_0x335b('0x35')]=_[_0x335b('0x36')](_0x14400a[_0x335b('0x35')],{'$or':_[_0x335b('0x26')](_0x3e7ec3,function(_0x398d32){if(_0x398d32['type']!==_0x335b('0x37')){var _0x1009f2={};_0x1009f2[_0x398d32[_0x335b('0x24')]]={'$like':'%'+_0x26565c[_0x335b('0x2c')][_0x335b('0x34')]+'%'};return _0x1009f2;}})});}_0x14400a=_[_0x335b('0x36')]({},_0x14400a,_0x26565c['options']);var _0x1600d5={'where':_0x14400a[_0x335b('0x35')]};return db[_0x335b('0x27')][_0x335b('0x19')](_0x1600d5)[_0x335b('0x21')](function(_0x272b74){_0x17a10e[_0x335b('0x19')]=_0x272b74;if(_0x26565c[_0x335b('0x2c')][_0x335b('0x38')]){_0x14400a[_0x335b('0x39')]=[{'attributes':['id','name','fullname',_0x335b('0x3a')],'model':db[_0x335b('0x3b')],'as':'User'}];}return db[_0x335b('0x27')]['findAll'](_0x14400a);})[_0x335b('0x21')](function(_0x464302){_0x17a10e[_0x335b('0x3c')]=_0x464302;return _0x17a10e;})[_0x335b('0x21')](respondWithFilteredResult(_0x442cbb,_0x14400a))[_0x335b('0x3d')](handleError(_0x442cbb,null));};exports[_0x335b('0x3e')]=function(_0x80dc13,_0x53d5c5){var _0x509404={'raw':!![],'where':{'id':_0x80dc13['params']['id']}},_0x5b5034={};_0x5b5034['model']=_['keys'](db[_0x335b('0x27')][_0x335b('0x28')]);_0x5b5034[_0x335b('0x2c')]=_[_0x335b('0x3f')](_0x80dc13[_0x335b('0x2c')]);_0x5b5034[_0x335b('0x2d')]=_[_0x335b('0x2e')](_0x5b5034['model'],_0x5b5034[_0x335b('0x2c')]);_0x509404[_0x335b('0x2f')]=_['intersection'](_0x5b5034[_0x335b('0x2b')],qs[_0x335b('0x30')](_0x80dc13['query'][_0x335b('0x30')]));_0x509404[_0x335b('0x2f')]=_0x509404[_0x335b('0x2f')][_0x335b('0x40')]?_0x509404['attributes']:_0x5b5034[_0x335b('0x2b')];if(_0x80dc13['query'][_0x335b('0x38')]){_0x509404[_0x335b('0x39')]=[{'all':!![]}];}_0x509404=_['merge']({},_0x509404,_0x80dc13['options']);return db['VoiceCallReport'][_0x335b('0x41')](_0x509404)['then'](handleEntityNotFound(_0x53d5c5,null))[_0x335b('0x21')](respondWithResult(_0x53d5c5,null))[_0x335b('0x3d')](handleError(_0x53d5c5,null));};exports[_0x335b('0x42')]=function(_0x3dfe74,_0x568556){return db['VoiceCallReport'][_0x335b('0x42')](_0x3dfe74[_0x335b('0x43')],{})[_0x335b('0x21')](respondWithResult(_0x568556,0xc9))[_0x335b('0x3d')](handleError(_0x568556,null));};exports[_0x335b('0x22')]=function(_0x9caf5f,_0x5323de){return db[_0x335b('0x27')][_0x335b('0x41')]({'where':{'id':_0x9caf5f[_0x335b('0x44')]['id']}})[_0x335b('0x21')](handleEntityNotFound(_0x5323de,null))[_0x335b('0x21')](removeEntity(_0x5323de,null))[_0x335b('0x3d')](handleError(_0x5323de,null));};exports[_0x335b('0x45')]=function(_0x4468d7,_0xca0b87){return db['VoiceCallReport']['describe']()[_0x335b('0x21')](respondWithResult(_0xca0b87,null))[_0x335b('0x3d')](handleError(_0xca0b87,null));};exports['update']=function(_0x3e2510,_0x211534){if(_0x3e2510[_0x335b('0x43')][_0x335b('0x46')]){delete _0x3e2510['body'][_0x335b('0x46')];}return db[_0x335b('0x27')][_0x335b('0x41')]({'where':{'uniqueid':_0x3e2510['params']['id'],'UserId':{'$or':[null,_0x3e2510[_0x335b('0x47')]['id']]}}})[_0x335b('0x21')](handleEntityNotFound(_0x211534,null))[_0x335b('0x21')](saveUpdates(_0x3e2510[_0x335b('0x43')],null))[_0x335b('0x21')](respondWithResult(_0x211534,null))[_0x335b('0x3d')](handleError(_0x211534,null));}; \ No newline at end of file +var _0x599b=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceCallReport','includeAll','fullname','alias','User','findAll','catch','params','include','create','body','find','describe','update','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x599b,0x1ef));var _0xb599=function(_0xbb5dd2,_0x142d00){_0xbb5dd2=_0xbb5dd2-0x0;var _0xe8c642=_0x599b[_0xbb5dd2];return _0xe8c642;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb599('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb599('0x1'));var jsonpatch=require(_0xb599('0x2'));var rp=require(_0xb599('0x3'));var moment=require(_0xb599('0x4'));var BPromise=require(_0xb599('0x5'));var Mustache=require(_0xb599('0x6'));var util=require('util');var path=require(_0xb599('0x7'));var sox=require(_0xb599('0x8'));var csv=require(_0xb599('0x9'));var ejs=require(_0xb599('0xa'));var fs=require('fs');var _=require(_0xb599('0xb'));var squel=require(_0xb599('0xc'));var crypto=require(_0xb599('0xd'));var jsforce=require(_0xb599('0xe'));var deskjs=require(_0xb599('0xf'));var toCsv=require(_0xb599('0x9'));var querystring=require(_0xb599('0x10'));var Papa=require(_0xb599('0x11'));var Redis=require(_0xb599('0x12'));var authService=require(_0xb599('0x13'));var qs=require(_0xb599('0x14'));var as=require(_0xb599('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb599('0x16'))(_0xb599('0x17'));var utils=require(_0xb599('0x18'));var config=require(_0xb599('0x19'));var db=require(_0xb599('0x1a'))['db'];function respondWithStatusCode(_0x1745ea,_0x42466b){_0x42466b=_0x42466b||0xcc;return function(_0x229163){if(_0x229163){return _0x1745ea[_0xb599('0x1b')](_0x42466b);}return _0x1745ea[_0xb599('0x1c')](_0x42466b)[_0xb599('0x1d')]();};}function respondWithResult(_0x30c6e5,_0x4e7a0b){_0x4e7a0b=_0x4e7a0b||0xc8;return function(_0x3995dd){if(_0x3995dd){return _0x30c6e5[_0xb599('0x1c')](_0x4e7a0b)[_0xb599('0x1e')](_0x3995dd);}};}function respondWithFilteredResult(_0x7273db,_0x533ac7){return function(_0x59b385){if(_0x59b385){var _0xa8cdf4=_0x59b385[_0xb599('0x1f')],_0xdc236a=_0x533ac7['offset'],_0xda028e=_0x533ac7[_0xb599('0x20')]+_0x533ac7[_0xb599('0x21')],_0x5c2562;if(_0xda028e>=_0xa8cdf4){_0xda028e=_0xa8cdf4;_0x5c2562=0xc8;}else{_0x5c2562=0xce;}_0x7273db[_0xb599('0x1c')](_0x5c2562);return _0x7273db['set']('Content-Range',_0xdc236a+'-'+_0xda028e+'/'+_0xa8cdf4)[_0xb599('0x1e')](_0x59b385);}return null;};}function patchUpdates(_0x2ba034){return function(_0x2f76d1){try{jsonpatch['apply'](_0x2f76d1,_0x2ba034,!![]);}catch(_0x378d51){return BPromise[_0xb599('0x22')](_0x378d51);}return _0x2f76d1[_0xb599('0x23')]();};}function saveUpdates(_0x209433,_0x521a3c){return function(_0x41ee75){if(_0x41ee75){return _0x41ee75['update'](_0x209433)[_0xb599('0x24')](function(_0x133309){return _0x133309;});}return null;};}function removeEntity(_0x108337,_0x40e690){return function(_0x2ea247){if(_0x2ea247){return _0x2ea247[_0xb599('0x25')]()['then'](function(){_0x108337['status'](0xcc)[_0xb599('0x1d')]();});}};}function handleEntityNotFound(_0x56f132,_0x1a854c){return function(_0x407c7d){if(!_0x407c7d){_0x56f132[_0xb599('0x1b')](0x194);}return _0x407c7d;};}function handleError(_0xae28cd,_0x2ac265){_0x2ac265=_0x2ac265||0x1f4;return function(_0xd90627){logger['error'](_0xd90627[_0xb599('0x26')]);if(_0xd90627[_0xb599('0x27')]){delete _0xd90627[_0xb599('0x27')];}_0xae28cd[_0xb599('0x1c')](_0x2ac265)[_0xb599('0x28')](_0xd90627);};}exports[_0xb599('0x29')]=function(_0x2e2957,_0x59a3f0){var _0x16fe29={},_0x246a07={},_0x5d05c4={'count':0x0,'rows':[]};var _0x35cea7=_[_0xb599('0x2a')](db['VoiceCallReport'][_0xb599('0x2b')],function(_0x1ec0a8){return{'name':_0x1ec0a8[_0xb599('0x2c')],'type':_0x1ec0a8[_0xb599('0x2d')]['key']};});_0x246a07[_0xb599('0x2e')]=_[_0xb599('0x2a')](_0x35cea7,_0xb599('0x27'));_0x246a07[_0xb599('0x2f')]=_[_0xb599('0x30')](_0x2e2957['query']);_0x246a07[_0xb599('0x31')]=_[_0xb599('0x32')](_0x246a07[_0xb599('0x2e')],_0x246a07[_0xb599('0x2f')]);_0x16fe29['attributes']=_[_0xb599('0x32')](_0x246a07[_0xb599('0x2e')],qs['fields'](_0x2e2957['query'][_0xb599('0x33')]));_0x16fe29['attributes']=_0x16fe29[_0xb599('0x34')][_0xb599('0x35')]?_0x16fe29[_0xb599('0x34')]:_0x246a07[_0xb599('0x2e')];if(!_0x2e2957['query'][_0xb599('0x36')](_0xb599('0x37'))){_0x16fe29[_0xb599('0x21')]=qs['limit'](_0x2e2957[_0xb599('0x2f')][_0xb599('0x21')]);_0x16fe29['offset']=qs['offset'](_0x2e2957[_0xb599('0x2f')][_0xb599('0x20')]);}_0x16fe29[_0xb599('0x38')]=qs[_0xb599('0x39')](_0x2e2957[_0xb599('0x2f')]['sort']);_0x16fe29[_0xb599('0x3a')]=qs['filters'](_['pick'](_0x2e2957[_0xb599('0x2f')],_0x246a07[_0xb599('0x31')]),_0x35cea7);if(_0x2e2957['query'][_0xb599('0x3b')]){_0x16fe29[_0xb599('0x3a')]=_[_0xb599('0x3c')](_0x16fe29['where'],{'$or':_[_0xb599('0x2a')](_0x35cea7,function(_0xaddfa){if(_0xaddfa[_0xb599('0x2d')]!==_0xb599('0x3d')){var _0x5823c6={};_0x5823c6[_0xaddfa[_0xb599('0x27')]]={'$like':'%'+_0x2e2957['query'][_0xb599('0x3b')]+'%'};return _0x5823c6;}})});}_0x16fe29=_['merge']({},_0x16fe29,_0x2e2957[_0xb599('0x3e')]);var _0x4b86f2={'where':_0x16fe29[_0xb599('0x3a')]};return db[_0xb599('0x3f')][_0xb599('0x1f')](_0x4b86f2)[_0xb599('0x24')](function(_0x3458f5){_0x5d05c4[_0xb599('0x1f')]=_0x3458f5;if(_0x2e2957[_0xb599('0x2f')][_0xb599('0x40')]){_0x16fe29['include']=[{'attributes':['id','name',_0xb599('0x41'),_0xb599('0x42')],'model':db[_0xb599('0x43')],'as':_0xb599('0x43')}];}return db[_0xb599('0x3f')][_0xb599('0x44')](_0x16fe29);})[_0xb599('0x24')](function(_0x4a9e3a){_0x5d05c4['rows']=_0x4a9e3a;return _0x5d05c4;})[_0xb599('0x24')](respondWithFilteredResult(_0x59a3f0,_0x16fe29))[_0xb599('0x45')](handleError(_0x59a3f0,null));};exports['show']=function(_0x3a0dce,_0x5769b9){var _0x484ec7={'raw':!![],'where':{'id':_0x3a0dce[_0xb599('0x46')]['id']}},_0x4de171={};_0x4de171[_0xb599('0x2e')]=_[_0xb599('0x30')](db[_0xb599('0x3f')][_0xb599('0x2b')]);_0x4de171[_0xb599('0x2f')]=_['keys'](_0x3a0dce[_0xb599('0x2f')]);_0x4de171[_0xb599('0x31')]=_[_0xb599('0x32')](_0x4de171[_0xb599('0x2e')],_0x4de171[_0xb599('0x2f')]);_0x484ec7[_0xb599('0x34')]=_['intersection'](_0x4de171[_0xb599('0x2e')],qs[_0xb599('0x33')](_0x3a0dce['query'][_0xb599('0x33')]));_0x484ec7[_0xb599('0x34')]=_0x484ec7[_0xb599('0x34')]['length']?_0x484ec7[_0xb599('0x34')]:_0x4de171[_0xb599('0x2e')];if(_0x3a0dce[_0xb599('0x2f')]['includeAll']){_0x484ec7[_0xb599('0x47')]=[{'all':!![]}];}_0x484ec7=_[_0xb599('0x3c')]({},_0x484ec7,_0x3a0dce['options']);return db[_0xb599('0x3f')]['find'](_0x484ec7)['then'](handleEntityNotFound(_0x5769b9,null))['then'](respondWithResult(_0x5769b9,null))[_0xb599('0x45')](handleError(_0x5769b9,null));};exports[_0xb599('0x48')]=function(_0x55c9a4,_0x3aac11){return db[_0xb599('0x3f')][_0xb599('0x48')](_0x55c9a4[_0xb599('0x49')],{})[_0xb599('0x24')](respondWithResult(_0x3aac11,0xc9))[_0xb599('0x45')](handleError(_0x3aac11,null));};exports[_0xb599('0x25')]=function(_0x3558e4,_0x228fd4){return db[_0xb599('0x3f')][_0xb599('0x4a')]({'where':{'id':_0x3558e4['params']['id']}})[_0xb599('0x24')](handleEntityNotFound(_0x228fd4,null))['then'](removeEntity(_0x228fd4,null))['catch'](handleError(_0x228fd4,null));};exports[_0xb599('0x4b')]=function(_0x4bd9de,_0x59c65a){return db[_0xb599('0x3f')][_0xb599('0x4b')]()[_0xb599('0x24')](respondWithResult(_0x59c65a,null))['catch'](handleError(_0x59c65a,null));};exports[_0xb599('0x4c')]=function(_0x2e2f91,_0x150556){if(_0x2e2f91[_0xb599('0x49')]['uniqueid']){delete _0x2e2f91['body'][_0xb599('0x4d')];}return db[_0xb599('0x3f')][_0xb599('0x4a')]({'where':{'uniqueid':_0x2e2f91[_0xb599('0x46')]['id'],'UserId':{'$or':[null,_0x2e2f91['user']['id']]}}})[_0xb599('0x24')](handleEntityNotFound(_0x150556,null))[_0xb599('0x24')](saveUpdates(_0x2e2f91[_0xb599('0x49')],null))[_0xb599('0x24')](respondWithResult(_0x150556,null))[_0xb599('0x45')](handleError(_0x150556,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 943f406..4b98d23 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 _0x36af=['VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x345ce9,_0xfeba2e){var _0x59e5ff=function(_0x3ed9a4){while(--_0x3ed9a4){_0x345ce9['push'](_0x345ce9['shift']());}};_0x59e5ff(++_0xfeba2e);}(_0x36af,0xdb));var _0xf36a=function(_0x5cf890,_0x106f66){_0x5cf890=_0x5cf890-0x0;var _0x16a18e=_0x36af[_0x5cf890];return _0x16a18e;};'use strict';var _=require(_0xf36a('0x0'));var util=require(_0xf36a('0x1'));var logger=require('../../config/logger')(_0xf36a('0x2'));var moment=require(_0xf36a('0x3'));var BPromise=require(_0xf36a('0x4'));var rp=require(_0xf36a('0x5'));var fs=require('fs');var path=require(_0xf36a('0x6'));var rimraf=require(_0xf36a('0x7'));var config=require(_0xf36a('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x38fd92,_0x3794c6){return _0x38fd92['define'](_0xf36a('0x9'),attributes,{'tableName':_0xf36a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf36a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce1=['define','VoiceCallReport','report_call','uniqueid','lodash','api','bluebird','path','rimraf'];(function(_0x2f8680,_0x51d9e3){var _0x432272=function(_0x35ee31){while(--_0x35ee31){_0x2f8680['push'](_0x2f8680['shift']());}};_0x432272(++_0x51d9e3);}(_0x1ce1,0x136));var _0x11ce=function(_0x281edd,_0x554bec){_0x281edd=_0x281edd-0x0;var _0x209b40=_0x1ce1[_0x281edd];return _0x209b40;};'use strict';var _=require(_0x11ce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x11ce('0x1'));var moment=require('moment');var BPromise=require(_0x11ce('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11ce('0x3'));var rimraf=require(_0x11ce('0x4'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x1fbc6e,_0xf1bf82){return _0x1fbc6e[_0x11ce('0x5')](_0x11ce('0x6'),attributes,{'tableName':_0x11ce('0x7'),'paranoid':![],'indexes':[{'fields':[_0x11ce('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 87ce1ba..3cdd531 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 _0xedbd=['code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','debug','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c4303,_0x15212f){var _0xc87c1b=function(_0x3de432){while(--_0x3de432){_0x5c4303['push'](_0x5c4303['shift']());}};_0xc87c1b(++_0x15212f);}(_0xedbd,0x12c));var _0xdedb=function(_0xdbc022,_0x2edbdd){_0xdbc022=_0xdbc022-0x0;var _0x4c8ae3=_0xedbd[_0xdbc022];return _0x4c8ae3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdedb('0x0'));var BPromise=require(_0xdedb('0x1'));var rs=require(_0xdedb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdedb('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdedb('0x4'));var config=require(_0xdedb('0x5'));var jayson=require(_0xdedb('0x6'));var client=jayson[_0xdedb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b7e5f,_0xf612bb,_0x5eaa61){return new BPromise(function(_0x46ea1f,_0x51b77f){return client[_0xdedb('0x8')](_0x5b7e5f,_0x5eaa61)[_0xdedb('0x9')](function(_0x140a8e){logger[_0xdedb('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0xf612bb,_0xdedb('0xb'));logger['debug'](_0xdedb('0xc'),_0xf612bb,_0xdedb('0xb'),JSON[_0xdedb('0xd')](_0x140a8e));if(_0x140a8e[_0xdedb('0xe')]){if(_0x140a8e[_0xdedb('0xe')][_0xdedb('0xf')]===0x1f4){logger[_0xdedb('0xe')](_0xdedb('0x10'),_0xf612bb,_0x140a8e[_0xdedb('0xe')][_0xdedb('0x11')]);return _0x51b77f(_0x140a8e['error']['message']);}logger[_0xdedb('0xe')](_0xdedb('0x10'),_0xf612bb,_0x140a8e['error'][_0xdedb('0x11')]);return _0x46ea1f(_0x140a8e[_0xdedb('0xe')][_0xdedb('0x11')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0xf612bb,_0xdedb('0xb'));_0x46ea1f(_0x140a8e['result'][_0xdedb('0x11')]);}})[_0xdedb('0x12')](function(_0x48067c){logger[_0xdedb('0xe')](_0xdedb('0x10'),_0xf612bb,_0x48067c);_0x51b77f(_0x48067c);});});}exports[_0xdedb('0x13')]=function(_0x440d01){var _0x55ca42=this;return new Promise(function(_0x25d5e8,_0x27dca3){return db[_0xdedb('0x14')]['findAll']({'raw':_0x440d01[_0xdedb('0x15')]?_0x440d01['options'][_0xdedb('0x16')]===undefined?!![]:![]:!![],'where':_0x440d01[_0xdedb('0x15')]?_0x440d01[_0xdedb('0x15')][_0xdedb('0x17')]||null:null,'attributes':_0x440d01[_0xdedb('0x15')]?_0x440d01[_0xdedb('0x15')][_0xdedb('0x18')]||null:null,'limit':_0x440d01['options']?_0x440d01[_0xdedb('0x15')][_0xdedb('0x19')]||null:null,'include':_0x440d01[_0xdedb('0x15')]?_0x440d01[_0xdedb('0x15')]['include']?_['map'](_0x440d01[_0xdedb('0x15')]['include'],function(_0x58fb40){return{'model':db[_0x58fb40['model']],'as':_0x58fb40['as'],'attributes':_0x58fb40[_0xdedb('0x18')],'include':_0x58fb40['include']?_[_0xdedb('0x1a')](_0x58fb40[_0xdedb('0x1b')],function(_0x5d4633){return{'model':db[_0x5d4633[_0xdedb('0x1c')]],'as':_0x5d4633['as'],'attributes':_0x5d4633[_0xdedb('0x18')],'include':_0x5d4633[_0xdedb('0x1b')]?_[_0xdedb('0x1a')](_0x5d4633[_0xdedb('0x1b')],function(_0x5af242){return{'model':db[_0x5af242[_0xdedb('0x1c')]],'as':_0x5af242['as'],'attributes':_0x5af242[_0xdedb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdedb('0x9')](function(_0x82e084){logger[_0xdedb('0xa')]('GetVoiceCallReport',_0x440d01);logger[_0xdedb('0x1d')]('GetVoiceCallReport',_0x440d01,JSON[_0xdedb('0xd')](_0x82e084));_0x25d5e8(_0x82e084);})[_0xdedb('0x12')](function(_0xe9568b){logger['error'](_0xdedb('0x13'),_0xe9568b['message'],_0x440d01);_0x27dca3(_0x55ca42[_0xdedb('0xe')](0x1f4,_0xe9568b[_0xdedb('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x19af07){var _0x2eab24=this;return new Promise(function(_0x5bbe2b,_0x220c08){return db[_0xdedb('0x14')][_0xdedb('0x1e')](_0x19af07[_0xdedb('0x1f')],{'raw':_0x19af07[_0xdedb('0x15')]?_0x19af07[_0xdedb('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xdedb('0x9')](function(_0x229c1f){logger[_0xdedb('0xa')](_0xdedb('0x20'),_0x19af07);logger[_0xdedb('0x1d')](_0xdedb('0x20'),_0x19af07,JSON[_0xdedb('0xd')](_0x229c1f));_0x5bbe2b(_0x229c1f);})[_0xdedb('0x12')](function(_0x531dc9){logger[_0xdedb('0xe')](_0xdedb('0x20'),_0x531dc9['message'],_0x19af07);_0x220c08(_0x2eab24[_0xdedb('0xe')](0x1f4,_0x531dc9[_0xdedb('0x11')]));});});};exports[_0xdedb('0x21')]=function(_0x50f755){var _0x3abf11=this;return new Promise(function(_0x2057cc,_0x15faaf){return db['VoiceCallReport'][_0xdedb('0x22')](_0x50f755['body'],{'raw':_0x50f755[_0xdedb('0x15')]?_0x50f755[_0xdedb('0x15')][_0xdedb('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50f755['options']?_0x50f755[_0xdedb('0x15')]['where']||null:null,'attributes':_0x50f755['options']?_0x50f755[_0xdedb('0x15')]['attributes']||null:null,'limit':_0x50f755[_0xdedb('0x15')]?_0x50f755['options'][_0xdedb('0x19')]||null:null})['then'](function(_0x52463d){logger['info'](_0xdedb('0x21'),_0x50f755);logger[_0xdedb('0x1d')](_0xdedb('0x21'),_0x50f755,JSON['stringify'](_0x52463d));_0x2057cc(_0x52463d);})[_0xdedb('0x12')](function(_0x22b7ad){logger[_0xdedb('0xe')](_0xdedb('0x21'),_0x22b7ad[_0xdedb('0x11')],_0x50f755);_0x15faaf(_0x3abf11[_0xdedb('0xe')](0x1f4,_0x22b7ad[_0xdedb('0x11')]));});});}; \ No newline at end of file +var _0x03fa=['error','message','result','catch','GetVoiceCallReport','options','raw','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x03fa,0xcc));var _0xa03f=function(_0x504653,_0x54fb83){_0x504653=_0x504653-0x0;var _0x48f553=_0x03fa[_0x504653];return _0x48f553;};'use strict';var _=require(_0xa03f('0x0'));var util=require(_0xa03f('0x1'));var moment=require(_0xa03f('0x2'));var BPromise=require(_0xa03f('0x3'));var rs=require(_0xa03f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa03f('0x5'))['db'];var utils=require(_0xa03f('0x6'));var logger=require(_0xa03f('0x7'))(_0xa03f('0x8'));var config=require(_0xa03f('0x9'));var jayson=require(_0xa03f('0xa'));var client=jayson[_0xa03f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1337e9,_0x59c2d9,_0xf93c27){return new BPromise(function(_0x190272,_0x112063){return client['request'](_0x1337e9,_0xf93c27)[_0xa03f('0xc')](function(_0x38ee92){logger[_0xa03f('0xd')](_0xa03f('0xe'),_0x59c2d9,_0xa03f('0xf'));logger[_0xa03f('0x10')](_0xa03f('0x11'),_0x59c2d9,'request\x20sent',JSON['stringify'](_0x38ee92));if(_0x38ee92[_0xa03f('0x12')]){if(_0x38ee92[_0xa03f('0x12')]['code']===0x1f4){logger[_0xa03f('0x12')](_0xa03f('0xe'),_0x59c2d9,_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);return _0x112063(_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x59c2d9,_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);return _0x190272(_0x38ee92[_0xa03f('0x12')][_0xa03f('0x13')]);}else{logger[_0xa03f('0xd')](_0xa03f('0xe'),_0x59c2d9,_0xa03f('0xf'));_0x190272(_0x38ee92[_0xa03f('0x14')][_0xa03f('0x13')]);}})[_0xa03f('0x15')](function(_0x5d60ab){logger[_0xa03f('0x12')](_0xa03f('0xe'),_0x59c2d9,_0x5d60ab);_0x112063(_0x5d60ab);});});}exports[_0xa03f('0x16')]=function(_0x1eed43){var _0x4880c8=this;return new Promise(function(_0x1bbc17,_0xd210c3){return db['VoiceCallReport']['findAll']({'raw':_0x1eed43[_0xa03f('0x17')]?_0x1eed43['options'][_0xa03f('0x18')]===undefined?!![]:![]:!![],'where':_0x1eed43['options']?_0x1eed43[_0xa03f('0x17')]['where']||null:null,'attributes':_0x1eed43[_0xa03f('0x17')]?_0x1eed43['options'][_0xa03f('0x19')]||null:null,'limit':_0x1eed43[_0xa03f('0x17')]?_0x1eed43[_0xa03f('0x17')][_0xa03f('0x1a')]||null:null,'include':_0x1eed43[_0xa03f('0x17')]?_0x1eed43['options'][_0xa03f('0x1b')]?_[_0xa03f('0x1c')](_0x1eed43[_0xa03f('0x17')][_0xa03f('0x1b')],function(_0x358012){return{'model':db[_0x358012[_0xa03f('0x1d')]],'as':_0x358012['as'],'attributes':_0x358012[_0xa03f('0x19')],'include':_0x358012[_0xa03f('0x1b')]?_[_0xa03f('0x1c')](_0x358012['include'],function(_0x464502){return{'model':db[_0x464502[_0xa03f('0x1d')]],'as':_0x464502['as'],'attributes':_0x464502[_0xa03f('0x19')],'include':_0x464502[_0xa03f('0x1b')]?_[_0xa03f('0x1c')](_0x464502[_0xa03f('0x1b')],function(_0x118bce){return{'model':db[_0x118bce['model']],'as':_0x118bce['as'],'attributes':_0x118bce[_0xa03f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa03f('0xc')](function(_0x351d1d){logger[_0xa03f('0xd')]('GetVoiceCallReport',_0x1eed43);logger[_0xa03f('0x10')](_0xa03f('0x16'),_0x1eed43,JSON[_0xa03f('0x1e')](_0x351d1d));_0x1bbc17(_0x351d1d);})['catch'](function(_0x16e8cc){logger['error']('GetVoiceCallReport',_0x16e8cc[_0xa03f('0x13')],_0x1eed43);_0xd210c3(_0x4880c8[_0xa03f('0x12')](0x1f4,_0x16e8cc[_0xa03f('0x13')]));});});};exports[_0xa03f('0x1f')]=function(_0x5294a3){var _0x1790fd=this;return new Promise(function(_0x4f0ef6,_0xd25458){return db[_0xa03f('0x20')][_0xa03f('0x21')](_0x5294a3[_0xa03f('0x22')],{'raw':_0x5294a3[_0xa03f('0x17')]?_0x5294a3[_0xa03f('0x17')][_0xa03f('0x18')]===undefined?!![]:![]:!![]})[_0xa03f('0xc')](function(_0x51ca4e){logger[_0xa03f('0xd')](_0xa03f('0x1f'),_0x5294a3);logger[_0xa03f('0x10')](_0xa03f('0x1f'),_0x5294a3,JSON[_0xa03f('0x1e')](_0x51ca4e));_0x4f0ef6(_0x51ca4e);})[_0xa03f('0x15')](function(_0x501cb3){logger[_0xa03f('0x12')]('CreateVoiceCallReport',_0x501cb3['message'],_0x5294a3);_0xd25458(_0x1790fd[_0xa03f('0x12')](0x1f4,_0x501cb3[_0xa03f('0x13')]));});});};exports[_0xa03f('0x23')]=function(_0x3c78cd){var _0x28dfd9=this;return new Promise(function(_0x177470,_0x233bf3){return db['VoiceCallReport'][_0xa03f('0x24')](_0x3c78cd['body'],{'raw':_0x3c78cd[_0xa03f('0x17')]?_0x3c78cd['options'][_0xa03f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c78cd[_0xa03f('0x17')]?_0x3c78cd[_0xa03f('0x17')]['where']||null:null,'attributes':_0x3c78cd[_0xa03f('0x17')]?_0x3c78cd[_0xa03f('0x17')][_0xa03f('0x19')]||null:null,'limit':_0x3c78cd['options']?_0x3c78cd[_0xa03f('0x17')]['limit']||null:null})[_0xa03f('0xc')](function(_0x4911ca){logger[_0xa03f('0xd')](_0xa03f('0x23'),_0x3c78cd);logger[_0xa03f('0x10')](_0xa03f('0x23'),_0x3c78cd,JSON['stringify'](_0x4911ca));_0x177470(_0x4911ca);})[_0xa03f('0x15')](function(_0x3a66c1){logger[_0xa03f('0x12')](_0xa03f('0x23'),_0x3a66c1[_0xa03f('0x13')],_0x3c78cd);_0x233bf3(_0x28dfd9[_0xa03f('0x12')](0x1f4,_0x3a66c1[_0xa03f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 93f5c8d..8b1d95f 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 _0x9137=['path','express','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','put','update','delete','util'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x9137,0x15d));var _0x7913=function(_0xb065e3,_0x2d01cf){_0xb065e3=_0xb065e3-0x0;var _0x1db262=_0x9137[_0xb065e3];return _0x1db262;};'use strict';var multer=require('multer');var util=require(_0x7913('0x0'));var path=require(_0x7913('0x1'));var timeout=require('connect-timeout');var express=require(_0x7913('0x2'));var router=express['Router']();var auth=require(_0x7913('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7913('0x4'));var controller=require(_0x7913('0x5'));router[_0x7913('0x6')]('/',auth[_0x7913('0x7')](),controller['index']);router['get'](_0x7913('0x8'),auth[_0x7913('0x7')](),controller[_0x7913('0x9')]);router[_0x7913('0xa')]('/',auth[_0x7913('0x7')](),controller['create']);router[_0x7913('0xb')](_0x7913('0x8'),auth[_0x7913('0x7')](),controller[_0x7913('0xc')]);router[_0x7913('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1c45=['isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','./voiceChanSpy.controller','get','index','/:id'];(function(_0x73301c,_0x3fd870){var _0x1f357b=function(_0x42e027){while(--_0x42e027){_0x73301c['push'](_0x73301c['shift']());}};_0x1f357b(++_0x3fd870);}(_0x1c45,0x7f));var _0x51c4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c45[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x51c4('0x0'));var util=require(_0x51c4('0x1'));var path=require(_0x51c4('0x2'));var timeout=require(_0x51c4('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51c4('0x4'));router[_0x51c4('0x5')]('/',auth['isAuthenticated'](),controller[_0x51c4('0x6')]);router[_0x51c4('0x5')](_0x51c4('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x51c4('0x8')](),controller[_0x51c4('0x9')]);router[_0x51c4('0xa')](_0x51c4('0x7'),auth['isAuthenticated'](),controller[_0x51c4('0xb')]);router[_0x51c4('0xc')](_0x51c4('0x7'),auth[_0x51c4('0x8')](),controller[_0x51c4('0xd')]);module[_0x51c4('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1ef9d09..5ba6d03 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 _0xd9d0=['setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0xd9d0,0xb0));var _0x0d9d=function(_0x398ec3,_0x403e6c){_0x398ec3=_0x398ec3-0x0;var _0x231f76=_0xd9d0[_0x398ec3];return _0x231f76;};'use strict';var Sequelize=require(_0x0d9d('0x0'));module[_0x0d9d('0x1')]={'name':{'type':Sequelize[_0x0d9d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x0d9d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0d9d('0x2')],'set':function(_0x5958f6){this[_0x0d9d('0x4')]('options',_0x5958f6?_0x5958f6[_0x0d9d('0x5')](''):[]);},'get':function(){return this[_0x0d9d('0x6')](_0x0d9d('0x7'))?this['getDataValue'](_0x0d9d('0x7'))[_0x0d9d('0x8')](''):[];}},'auth':{'type':Sequelize[_0x0d9d('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x0d9d('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0d9d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb13e=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','getDataValue','options','split'];(function(_0xf7379b,_0x44ec77){var _0x96a568=function(_0x496b79){while(--_0x496b79){_0xf7379b['push'](_0xf7379b['shift']());}};_0x96a568(++_0x44ec77);}(_0xb13e,0xa3));var _0xeb13=function(_0x3846b9,_0x495363){_0x3846b9=_0x3846b9-0x0;var _0x5b7a18=_0xb13e[_0x3846b9];return _0x5b7a18;};'use strict';var Sequelize=require(_0xeb13('0x0'));module[_0xeb13('0x1')]={'name':{'type':Sequelize[_0xeb13('0x2')]},'prefix':{'type':Sequelize[_0xeb13('0x2')],'unique':_0xeb13('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xeb13('0x2')],'set':function(_0x536176){this[_0xeb13('0x4')]('options',_0x536176?_0x536176['join'](''):[]);},'get':function(){return this[_0xeb13('0x5')](_0xeb13('0x6'))?this[_0xeb13('0x5')](_0xeb13('0x6'))[_0xeb13('0x7')](''):[];}},'auth':{'type':Sequelize[_0xeb13('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xeb13('0x2')]},'record':{'type':Sequelize[_0xeb13('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb13('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d4aa5df..a240ab5 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 _0xd455=['attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceChanSpy','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x45a383,_0x49848c){var _0x3f4cce=function(_0x43af93){while(--_0x43af93){_0x45a383['push'](_0x45a383['shift']());}};_0x3f4cce(++_0x49848c);}(_0xd455,0xbe));var _0x5d45=function(_0x2dfddd,_0x1457ba){_0x2dfddd=_0x2dfddd-0x0;var _0x5cfdbb=_0xd455[_0x2dfddd];return _0x5cfdbb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d45('0x1'));var jsonpatch=require(_0x5d45('0x2'));var rp=require('request-promise');var moment=require(_0x5d45('0x3'));var BPromise=require(_0x5d45('0x4'));var Mustache=require(_0x5d45('0x5'));var util=require(_0x5d45('0x6'));var path=require(_0x5d45('0x7'));var sox=require(_0x5d45('0x8'));var csv=require(_0x5d45('0x9'));var ejs=require(_0x5d45('0xa'));var fs=require('fs');var _=require(_0x5d45('0xb'));var squel=require(_0x5d45('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d45('0xd'));var toCsv=require(_0x5d45('0x9'));var querystring=require(_0x5d45('0xe'));var Papa=require('papaparse');var Redis=require(_0x5d45('0xf'));var authService=require(_0x5d45('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5d45('0x11'));var hardwareService=require(_0x5d45('0x12'));var logger=require(_0x5d45('0x13'))(_0x5d45('0x14'));var utils=require('../../config/utils');var config=require(_0x5d45('0x15'));var db=require(_0x5d45('0x16'))['db'];function respondWithStatusCode(_0x3ba65d,_0x33abb2){_0x33abb2=_0x33abb2||0xcc;return function(_0x26bee1){if(_0x26bee1){return _0x3ba65d[_0x5d45('0x17')](_0x33abb2);}return _0x3ba65d[_0x5d45('0x18')](_0x33abb2)[_0x5d45('0x19')]();};}function respondWithResult(_0x53f1f6,_0x22f3ae){_0x22f3ae=_0x22f3ae||0xc8;return function(_0x2aa744){if(_0x2aa744){return _0x53f1f6['status'](_0x22f3ae)[_0x5d45('0x1a')](_0x2aa744);}};}function respondWithFilteredResult(_0x44f351,_0x39e90b){return function(_0x21c64a){if(_0x21c64a){var _0x1b6781=_0x21c64a[_0x5d45('0x1b')],_0x26174d=_0x39e90b[_0x5d45('0x1c')],_0xdd58d5=_0x39e90b[_0x5d45('0x1c')]+_0x39e90b[_0x5d45('0x1d')],_0x3afb5c;if(_0xdd58d5>=_0x1b6781){_0xdd58d5=_0x1b6781;_0x3afb5c=0xc8;}else{_0x3afb5c=0xce;}_0x44f351['status'](_0x3afb5c);return _0x44f351['set'](_0x5d45('0x1e'),_0x26174d+'-'+_0xdd58d5+'/'+_0x1b6781)[_0x5d45('0x1a')](_0x21c64a);}return null;};}function patchUpdates(_0x419ade){return function(_0x325234){try{jsonpatch['apply'](_0x325234,_0x419ade,!![]);}catch(_0x4adf6c){return BPromise['reject'](_0x4adf6c);}return _0x325234[_0x5d45('0x1f')]();};}function saveUpdates(_0x2ac048,_0x416bfe){return function(_0x421fd2){if(_0x421fd2){return _0x421fd2[_0x5d45('0x20')](_0x2ac048)[_0x5d45('0x21')](function(_0x4c39e8){return _0x4c39e8;});}return null;};}function removeEntity(_0x2cc548,_0x4cc3f9){return function(_0x28bf14){if(_0x28bf14){return _0x28bf14[_0x5d45('0x22')]()['then'](function(){var _0x335ee7=_0x28bf14[_0x5d45('0x23')]({'plain':!![]});var _0x4d655c=_0x5d45('0x24');return db[_0x5d45('0x25')]['destroy']({'where':{'type':_0x4d655c,'resourceId':_0x335ee7['id']}})[_0x5d45('0x21')](function(){return _0x28bf14;});})[_0x5d45('0x21')](function(){_0x2cc548[_0x5d45('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41c1e4,_0x19a7b9){return function(_0x25d3f3){if(!_0x25d3f3){_0x41c1e4[_0x5d45('0x17')](0x194);}return _0x25d3f3;};}function handleError(_0x2982d3,_0x26bb4b){_0x26bb4b=_0x26bb4b||0x1f4;return function(_0x1ed82b){logger[_0x5d45('0x26')](_0x1ed82b['stack']);if(_0x1ed82b[_0x5d45('0x27')]){delete _0x1ed82b[_0x5d45('0x27')];}_0x2982d3[_0x5d45('0x18')](_0x26bb4b)[_0x5d45('0x28')](_0x1ed82b);};}exports['index']=function(_0x5e1c66,_0x7bc39c){var _0x4ba36a={},_0x4161da={},_0x1b16e7={'count':0x0,'rows':[]};var _0x1286f2=_['map'](db['VoiceChanSpy'][_0x5d45('0x29')],function(_0xb88bfc){return{'name':_0xb88bfc[_0x5d45('0x2a')],'type':_0xb88bfc[_0x5d45('0x2b')][_0x5d45('0x2c')]};});_0x4161da[_0x5d45('0x2d')]=_[_0x5d45('0x2e')](_0x1286f2,'name');_0x4161da[_0x5d45('0x2f')]=_[_0x5d45('0x30')](_0x5e1c66[_0x5d45('0x2f')]);_0x4161da[_0x5d45('0x31')]=_['intersection'](_0x4161da[_0x5d45('0x2d')],_0x4161da[_0x5d45('0x2f')]);_0x4ba36a[_0x5d45('0x32')]=_[_0x5d45('0x33')](_0x4161da[_0x5d45('0x2d')],qs[_0x5d45('0x34')](_0x5e1c66[_0x5d45('0x2f')]['fields']));_0x4ba36a[_0x5d45('0x32')]=_0x4ba36a[_0x5d45('0x32')][_0x5d45('0x35')]?_0x4ba36a[_0x5d45('0x32')]:_0x4161da[_0x5d45('0x2d')];if(!_0x5e1c66['query']['hasOwnProperty'](_0x5d45('0x36'))){_0x4ba36a[_0x5d45('0x1d')]=qs[_0x5d45('0x1d')](_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x1d')]);_0x4ba36a[_0x5d45('0x1c')]=qs[_0x5d45('0x1c')](_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x1c')]);}_0x4ba36a[_0x5d45('0x37')]=qs[_0x5d45('0x38')](_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x38')]);_0x4ba36a['where']=qs[_0x5d45('0x31')](_[_0x5d45('0x39')](_0x5e1c66['query'],_0x4161da[_0x5d45('0x31')]),_0x1286f2);if(_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x3a')]){_0x4ba36a[_0x5d45('0x3b')]=_[_0x5d45('0x3c')](_0x4ba36a[_0x5d45('0x3b')],{'$or':_[_0x5d45('0x2e')](_0x1286f2,function(_0x1dd519){if(_0x1dd519[_0x5d45('0x2b')]!==_0x5d45('0x3d')){var _0x1ba6c3={};_0x1ba6c3[_0x1dd519[_0x5d45('0x27')]]={'$like':'%'+_0x5e1c66[_0x5d45('0x2f')][_0x5d45('0x3a')]+'%'};return _0x1ba6c3;}})});}_0x4ba36a=_['merge']({},_0x4ba36a,_0x5e1c66[_0x5d45('0x3e')]);var _0x18d911={'where':_0x4ba36a[_0x5d45('0x3b')]};return db[_0x5d45('0x3f')][_0x5d45('0x1b')](_0x18d911)[_0x5d45('0x21')](function(_0x578d55){_0x1b16e7['count']=_0x578d55;if(_0x5e1c66[_0x5d45('0x2f')]['includeAll']){_0x4ba36a[_0x5d45('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x5d45('0x41')](_0x4ba36a);})[_0x5d45('0x21')](function(_0x5c2ffd){_0x1b16e7[_0x5d45('0x42')]=_0x5c2ffd;return _0x1b16e7;})['then'](respondWithFilteredResult(_0x7bc39c,_0x4ba36a))[_0x5d45('0x43')](handleError(_0x7bc39c,null));};exports[_0x5d45('0x44')]=function(_0x1f4fc3,_0x33eea0){var _0x5de928={'raw':![],'where':{'id':_0x1f4fc3['params']['id']}},_0x39ef8e={};_0x39ef8e['model']=_[_0x5d45('0x30')](db[_0x5d45('0x3f')][_0x5d45('0x29')]);_0x39ef8e['query']=_[_0x5d45('0x30')](_0x1f4fc3['query']);_0x39ef8e['filters']=_[_0x5d45('0x33')](_0x39ef8e['model'],_0x39ef8e[_0x5d45('0x2f')]);_0x5de928['attributes']=_['intersection'](_0x39ef8e[_0x5d45('0x2d')],qs[_0x5d45('0x34')](_0x1f4fc3[_0x5d45('0x2f')]['fields']));_0x5de928[_0x5d45('0x32')]=_0x5de928['attributes'][_0x5d45('0x35')]?_0x5de928[_0x5d45('0x32')]:_0x39ef8e[_0x5d45('0x2d')];if(_0x1f4fc3[_0x5d45('0x2f')][_0x5d45('0x45')]){_0x5de928[_0x5d45('0x40')]=[{'all':!![]}];}_0x5de928=_[_0x5d45('0x3c')]({},_0x5de928,_0x1f4fc3[_0x5d45('0x3e')]);return db[_0x5d45('0x3f')][_0x5d45('0x46')](_0x5de928)[_0x5d45('0x21')](handleEntityNotFound(_0x33eea0,null))['then'](respondWithResult(_0x33eea0,null))[_0x5d45('0x43')](handleError(_0x33eea0,null));};exports[_0x5d45('0x47')]=function(_0x34ac96,_0x31e06a){return db[_0x5d45('0x3f')][_0x5d45('0x47')](_0x34ac96[_0x5d45('0x48')],{})[_0x5d45('0x21')](function(_0x256319){var _0x4e8a09=_0x34ac96[_0x5d45('0x49')]['get']({'plain':!![]});if(!_0x4e8a09)throw new Error(_0x5d45('0x4a'));if(_0x4e8a09[_0x5d45('0x4b')]===_0x5d45('0x49')){var _0x35c949=_0x256319[_0x5d45('0x23')]({'plain':!![]});var _0x3ff2c1=_0x5d45('0x24');return db['UserProfileSection'][_0x5d45('0x46')]({'where':{'name':_0x3ff2c1,'userProfileId':_0x4e8a09[_0x5d45('0x4c')]},'raw':!![]})['then'](function(_0x1ea056){if(_0x1ea056&&_0x1ea056[_0x5d45('0x4d')]===0x0){return db['UserProfileResource'][_0x5d45('0x47')]({'name':_0x35c949[_0x5d45('0x27')],'resourceId':_0x35c949['id'],'type':_0x1ea056[_0x5d45('0x27')],'sectionId':_0x1ea056['id']},{})['then'](function(){return _0x256319;});}else{return _0x256319;}})[_0x5d45('0x43')](function(_0x55a646){logger['error'](_0x5d45('0x4e'),_0x55a646);throw _0x55a646;});}return _0x256319;})[_0x5d45('0x21')](respondWithResult(_0x31e06a,0xc9))[_0x5d45('0x43')](handleError(_0x31e06a,null));};exports['update']=function(_0x342934,_0x457481){if(_0x342934[_0x5d45('0x48')]['id']){delete _0x342934[_0x5d45('0x48')]['id'];}return db[_0x5d45('0x3f')]['find']({'where':{'id':_0x342934[_0x5d45('0x4f')]['id']}})[_0x5d45('0x21')](handleEntityNotFound(_0x457481,null))[_0x5d45('0x21')](saveUpdates(_0x342934[_0x5d45('0x48')],null))[_0x5d45('0x21')](respondWithResult(_0x457481,null))[_0x5d45('0x43')](handleError(_0x457481,null));};exports[_0x5d45('0x22')]=function(_0x4ef10f,_0x363050){return db[_0x5d45('0x3f')][_0x5d45('0x46')]({'where':{'id':_0x4ef10f[_0x5d45('0x4f')]['id']}})['then'](handleEntityNotFound(_0x363050,null))[_0x5d45('0x21')](removeEntity(_0x363050,null))[_0x5d45('0x43')](handleError(_0x363050,null));}; \ No newline at end of file +var _0xe08a=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','VoiceChanSpy','count','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir'];(function(_0x46ceb8,_0x59f368){var _0x4b109d=function(_0x5ddc47){while(--_0x5ddc47){_0x46ceb8['push'](_0x46ceb8['shift']());}};_0x4b109d(++_0x59f368);}(_0xe08a,0x1ef));var _0xae08=function(_0x443777,_0x2d05ef){_0x443777=_0x443777-0x0;var _0x2a4b6b=_0xe08a[_0x443777];return _0x2a4b6b;};'use strict';var pdf=require(_0xae08('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xae08('0x1'));var zipdir=require(_0xae08('0x2'));var jsonpatch=require(_0xae08('0x3'));var rp=require(_0xae08('0x4'));var moment=require(_0xae08('0x5'));var BPromise=require(_0xae08('0x6'));var Mustache=require('mustache');var util=require(_0xae08('0x7'));var path=require('path');var sox=require(_0xae08('0x8'));var csv=require(_0xae08('0x9'));var ejs=require(_0xae08('0xa'));var fs=require('fs');var _=require(_0xae08('0xb'));var squel=require(_0xae08('0xc'));var crypto=require('crypto');var jsforce=require(_0xae08('0xd'));var deskjs=require(_0xae08('0xe'));var toCsv=require(_0xae08('0x9'));var querystring=require(_0xae08('0xf'));var Papa=require(_0xae08('0x10'));var Redis=require('ioredis');var authService=require(_0xae08('0x11'));var qs=require(_0xae08('0x12'));var as=require(_0xae08('0x13'));var hardwareService=require(_0xae08('0x14'));var logger=require('../../config/logger')(_0xae08('0x15'));var utils=require(_0xae08('0x16'));var config=require(_0xae08('0x17'));var db=require(_0xae08('0x18'))['db'];function respondWithStatusCode(_0x34c06e,_0x46ead4){_0x46ead4=_0x46ead4||0xcc;return function(_0x307754){if(_0x307754){return _0x34c06e['sendStatus'](_0x46ead4);}return _0x34c06e['status'](_0x46ead4)[_0xae08('0x19')]();};}function respondWithResult(_0x3bec94,_0x2e9765){_0x2e9765=_0x2e9765||0xc8;return function(_0x12436f){if(_0x12436f){return _0x3bec94[_0xae08('0x1a')](_0x2e9765)[_0xae08('0x1b')](_0x12436f);}};}function respondWithFilteredResult(_0x42d400,_0x5ddf8b){return function(_0x5c7412){if(_0x5c7412){var _0x332bd7=_0x5c7412['count'],_0x411ca1=_0x5ddf8b[_0xae08('0x1c')],_0x3662af=_0x5ddf8b[_0xae08('0x1c')]+_0x5ddf8b[_0xae08('0x1d')],_0x287b99;if(_0x3662af>=_0x332bd7){_0x3662af=_0x332bd7;_0x287b99=0xc8;}else{_0x287b99=0xce;}_0x42d400[_0xae08('0x1a')](_0x287b99);return _0x42d400[_0xae08('0x1e')](_0xae08('0x1f'),_0x411ca1+'-'+_0x3662af+'/'+_0x332bd7)[_0xae08('0x1b')](_0x5c7412);}return null;};}function patchUpdates(_0x3e6a7b){return function(_0x3582dc){try{jsonpatch[_0xae08('0x20')](_0x3582dc,_0x3e6a7b,!![]);}catch(_0x11bcbc){return BPromise[_0xae08('0x21')](_0x11bcbc);}return _0x3582dc[_0xae08('0x22')]();};}function saveUpdates(_0x123a2b,_0x1f6095){return function(_0x4b35bc){if(_0x4b35bc){return _0x4b35bc[_0xae08('0x23')](_0x123a2b)['then'](function(_0x335ef1){return _0x335ef1;});}return null;};}function removeEntity(_0x5a711b,_0x10d4f5){return function(_0x3f00f3){if(_0x3f00f3){return _0x3f00f3[_0xae08('0x24')]()[_0xae08('0x25')](function(){var _0x32e950=_0x3f00f3[_0xae08('0x26')]({'plain':!![]});var _0x2dbbcd=_0xae08('0x27');return db[_0xae08('0x28')][_0xae08('0x24')]({'where':{'type':_0x2dbbcd,'resourceId':_0x32e950['id']}})[_0xae08('0x25')](function(){return _0x3f00f3;});})[_0xae08('0x25')](function(){_0x5a711b['status'](0xcc)[_0xae08('0x19')]();});}};}function handleEntityNotFound(_0x53eb8c,_0x21061f){return function(_0x4bea21){if(!_0x4bea21){_0x53eb8c[_0xae08('0x29')](0x194);}return _0x4bea21;};}function handleError(_0x405666,_0x3ab1bc){_0x3ab1bc=_0x3ab1bc||0x1f4;return function(_0x16d8c7){logger[_0xae08('0x2a')](_0x16d8c7[_0xae08('0x2b')]);if(_0x16d8c7[_0xae08('0x2c')]){delete _0x16d8c7['name'];}_0x405666[_0xae08('0x1a')](_0x3ab1bc)[_0xae08('0x2d')](_0x16d8c7);};}exports[_0xae08('0x2e')]=function(_0x74a0d3,_0x41bd3c){var _0x3b40a2={},_0x1c7639={},_0x38d04b={'count':0x0,'rows':[]};var _0x1f93f9=_['map'](db['VoiceChanSpy'][_0xae08('0x2f')],function(_0x1f8b01){return{'name':_0x1f8b01['fieldName'],'type':_0x1f8b01[_0xae08('0x30')][_0xae08('0x31')]};});_0x1c7639[_0xae08('0x32')]=_[_0xae08('0x33')](_0x1f93f9,_0xae08('0x2c'));_0x1c7639[_0xae08('0x34')]=_[_0xae08('0x35')](_0x74a0d3[_0xae08('0x34')]);_0x1c7639['filters']=_['intersection'](_0x1c7639[_0xae08('0x32')],_0x1c7639[_0xae08('0x34')]);_0x3b40a2['attributes']=_[_0xae08('0x36')](_0x1c7639[_0xae08('0x32')],qs[_0xae08('0x37')](_0x74a0d3['query'][_0xae08('0x37')]));_0x3b40a2[_0xae08('0x38')]=_0x3b40a2[_0xae08('0x38')][_0xae08('0x39')]?_0x3b40a2[_0xae08('0x38')]:_0x1c7639[_0xae08('0x32')];if(!_0x74a0d3['query']['hasOwnProperty'](_0xae08('0x3a'))){_0x3b40a2['limit']=qs[_0xae08('0x1d')](_0x74a0d3[_0xae08('0x34')][_0xae08('0x1d')]);_0x3b40a2['offset']=qs[_0xae08('0x1c')](_0x74a0d3[_0xae08('0x34')][_0xae08('0x1c')]);}_0x3b40a2[_0xae08('0x3b')]=qs[_0xae08('0x3c')](_0x74a0d3[_0xae08('0x34')][_0xae08('0x3c')]);_0x3b40a2[_0xae08('0x3d')]=qs[_0xae08('0x3e')](_['pick'](_0x74a0d3[_0xae08('0x34')],_0x1c7639[_0xae08('0x3e')]),_0x1f93f9);if(_0x74a0d3[_0xae08('0x34')]['filter']){_0x3b40a2['where']=_[_0xae08('0x3f')](_0x3b40a2[_0xae08('0x3d')],{'$or':_[_0xae08('0x33')](_0x1f93f9,function(_0x257ac7){if(_0x257ac7['type']!==_0xae08('0x40')){var _0x1ae05a={};_0x1ae05a[_0x257ac7['name']]={'$like':'%'+_0x74a0d3[_0xae08('0x34')][_0xae08('0x41')]+'%'};return _0x1ae05a;}})});}_0x3b40a2=_['merge']({},_0x3b40a2,_0x74a0d3[_0xae08('0x42')]);var _0x34931e={'where':_0x3b40a2[_0xae08('0x3d')]};return db[_0xae08('0x43')][_0xae08('0x44')](_0x34931e)[_0xae08('0x25')](function(_0x9e3a59){_0x38d04b['count']=_0x9e3a59;if(_0x74a0d3[_0xae08('0x34')][_0xae08('0x45')]){_0x3b40a2[_0xae08('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3b40a2);})['then'](function(_0x2d8a43){_0x38d04b['rows']=_0x2d8a43;return _0x38d04b;})[_0xae08('0x25')](respondWithFilteredResult(_0x41bd3c,_0x3b40a2))[_0xae08('0x47')](handleError(_0x41bd3c,null));};exports['show']=function(_0x457e9a,_0xdf19d3){var _0x2076ab={'raw':![],'where':{'id':_0x457e9a[_0xae08('0x48')]['id']}},_0x17bf31={};_0x17bf31[_0xae08('0x32')]=_[_0xae08('0x35')](db[_0xae08('0x43')][_0xae08('0x2f')]);_0x17bf31['query']=_[_0xae08('0x35')](_0x457e9a['query']);_0x17bf31[_0xae08('0x3e')]=_[_0xae08('0x36')](_0x17bf31[_0xae08('0x32')],_0x17bf31[_0xae08('0x34')]);_0x2076ab['attributes']=_[_0xae08('0x36')](_0x17bf31[_0xae08('0x32')],qs[_0xae08('0x37')](_0x457e9a[_0xae08('0x34')][_0xae08('0x37')]));_0x2076ab[_0xae08('0x38')]=_0x2076ab[_0xae08('0x38')]['length']?_0x2076ab[_0xae08('0x38')]:_0x17bf31[_0xae08('0x32')];if(_0x457e9a[_0xae08('0x34')][_0xae08('0x45')]){_0x2076ab[_0xae08('0x46')]=[{'all':!![]}];}_0x2076ab=_[_0xae08('0x3f')]({},_0x2076ab,_0x457e9a['options']);return db[_0xae08('0x43')][_0xae08('0x49')](_0x2076ab)[_0xae08('0x25')](handleEntityNotFound(_0xdf19d3,null))[_0xae08('0x25')](respondWithResult(_0xdf19d3,null))[_0xae08('0x47')](handleError(_0xdf19d3,null));};exports[_0xae08('0x4a')]=function(_0x58b623,_0x3f1735){return db[_0xae08('0x43')][_0xae08('0x4a')](_0x58b623[_0xae08('0x4b')],{})[_0xae08('0x25')](function(_0x2cd2f0){var _0x355881=_0x58b623[_0xae08('0x4c')]['get']({'plain':!![]});if(!_0x355881)throw new Error(_0xae08('0x4d'));if(_0x355881[_0xae08('0x4e')]===_0xae08('0x4c')){var _0x45aee5=_0x2cd2f0[_0xae08('0x26')]({'plain':!![]});var _0x1d077f=_0xae08('0x27');return db[_0xae08('0x4f')][_0xae08('0x49')]({'where':{'name':_0x1d077f,'userProfileId':_0x355881[_0xae08('0x50')]},'raw':!![]})[_0xae08('0x25')](function(_0x2a5bdb){if(_0x2a5bdb&&_0x2a5bdb[_0xae08('0x51')]===0x0){return db[_0xae08('0x28')]['create']({'name':_0x45aee5[_0xae08('0x2c')],'resourceId':_0x45aee5['id'],'type':_0x2a5bdb[_0xae08('0x2c')],'sectionId':_0x2a5bdb['id']},{})[_0xae08('0x25')](function(){return _0x2cd2f0;});}else{return _0x2cd2f0;}})[_0xae08('0x47')](function(_0x493d4c){logger['error'](_0xae08('0x52'),_0x493d4c);throw _0x493d4c;});}return _0x2cd2f0;})[_0xae08('0x25')](respondWithResult(_0x3f1735,0xc9))[_0xae08('0x47')](handleError(_0x3f1735,null));};exports[_0xae08('0x23')]=function(_0x17375f,_0x6855ff){if(_0x17375f[_0xae08('0x4b')]['id']){delete _0x17375f['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x17375f['params']['id']}})[_0xae08('0x25')](handleEntityNotFound(_0x6855ff,null))[_0xae08('0x25')](saveUpdates(_0x17375f[_0xae08('0x4b')],null))[_0xae08('0x25')](respondWithResult(_0x6855ff,null))[_0xae08('0x47')](handleError(_0x6855ff,null));};exports['destroy']=function(_0x4b881c,_0x124cee){return db[_0xae08('0x43')][_0xae08('0x49')]({'where':{'id':_0x4b881c[_0xae08('0x48')]['id']}})[_0xae08('0x25')](handleEntityNotFound(_0x124cee,null))['then'](removeEntity(_0x124cee,null))[_0xae08('0x47')](handleError(_0x124cee,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8008ca9..8172d55 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 _0x10a5=['from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','concat','internal','User','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x10a5,0x163));var _0x510a=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x10a5[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x510a('0x0'));var util=require(_0x510a('0x1'));var BPromise=require(_0x510a('0x2'));var attributes=require(_0x510a('0x3'));var getUserApplications=function(_0x15a46b,_0x3dce5a,_0x68c824){var _0x29c239=0x1;var _0xc8089=[];var _0x5f6539={'context':_0x3dce5a[_0x510a('0x4')]||_0x510a('0x5'),'exten':util[_0x510a('0x6')](_0x510a('0x7'),_0x15a46b['prefix'],_0x68c824),'type':'system','isApp':![],'ChanSpyId':_0x15a46b['id'],'UserId':_0x3dce5a['id']};_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0xa'),'appdata':util[_0x510a('0x6')](_0x510a('0xb'),_0x510a('0xc')),'priority':_0x29c239++},_0x5f6539));if(_0x15a46b[_0x510a('0xd')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':'MixMonitor','appdata':util[_0x510a('0x6')](_0x510a('0xe'),_0x15a46b['recordingFormat']),'priority':_0x29c239++},_0x5f6539));}if(_0x15a46b[_0x510a('0xf')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x10'),'appdata':_0x15a46b[_0x510a('0x11')],'priority':_0x29c239++},_0x5f6539));}_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x12'),'appdata':util['format'](_0x510a('0x13'),_0x3dce5a[_0x510a('0x14')],_0x15a46b['options']?_0x15a46b['options']['join'](''):''),'priority':_0x29c239++},_0x5f6539));if(_0x15a46b[_0x510a('0xd')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x15'),'priority':_0x29c239++},_0x5f6539));}return _0xc8089;};var getChanSpyApplications=function(_0x15fd06,_0x2d15af){var _0x5a079c=[];for(var _0x19f5c4=0x0,_0x11e0dc=0x1;_0x19f5c4<_0x2d15af['length'];_0x19f5c4++,_0x11e0dc=0x1){_0x5a079c=_0x5a079c[_0x510a('0x16')](getUserApplications(_0x15fd06,_0x2d15af[_0x19f5c4],_0x2d15af[_0x19f5c4][_0x510a('0x17')]));if(_0x2d15af[_0x19f5c4][_0x510a('0x17')]!=_0x2d15af[_0x19f5c4]['name']){_0x5a079c=_0x5a079c[_0x510a('0x16')](getUserApplications(_0x15fd06,_0x2d15af[_0x19f5c4],_0x2d15af[_0x19f5c4]['name']));}}return _0x5a079c;};var getChanSpyPromise=function(_0x167721,_0x1d78c1){return new BPromise(function(_0x3e64d4,_0x22ff84){return _0x167721[_0x510a('0x18')]['findAll']({'attributes':['id',_0x510a('0x14'),_0x510a('0x17')],'where':{'role':_0x510a('0x19'),'chanspy':!![]},'raw':!![]})[_0x510a('0x1a')](function(_0x157127){if(_0x157127){return _0x3e64d4(getChanSpyApplications(_0x1d78c1,_0x157127));}return _0x3e64d4([]);})[_0x510a('0x1b')](function(_0x5b24fb){_0x22ff84(_0x5b24fb);});});};module[_0x510a('0x1c')]=function(_0x4ee01f,_0xc23844){var _0x3cec5b=_0x4ee01f[_0x510a('0x1d')];return _0x4ee01f['define'](_0x510a('0x1e'),attributes,{'tableName':_0x510a('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e923e,_0xab5f53,_0x54cc9c){return getChanSpyPromise(_0x3cec5b,_0x5e923e)[_0x510a('0x1a')](function(_0x26bcf1){if(_0x26bcf1&&_0x26bcf1[_0x510a('0x20')]){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x22')](_0x26bcf1);}})[_0x510a('0x1a')](function(){_0x54cc9c();})[_0x510a('0x1b')](function(_0x197da9){_0x54cc9c(_0x197da9);});},'afterUpdate':function(_0xf08430,_0x26b4f8,_0x24fc29){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x23')]({'where':{'ChanSpyId':_0xf08430['id']}})[_0x510a('0x1a')](function(){return getChanSpyPromise(_0x3cec5b,_0xf08430);})[_0x510a('0x1a')](function(_0x1b7e4b){if(_0x1b7e4b&&_0x1b7e4b[_0x510a('0x20')]){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x22')](_0x1b7e4b);}})[_0x510a('0x1a')](function(){_0x24fc29();})[_0x510a('0x1b')](function(_0x57f0a6){_0x24fc29(_0x57f0a6);});},'afterDestroy':function(_0x340fef,_0x2a4bd2,_0x48f9eb){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x23')]({'where':{'ChanSpyId':_0x340fef['id']}})['then'](function(){_0x48f9eb();})[_0x510a('0x1b')](function(_0x2cbac5){_0x48f9eb(_0x2cbac5);});}}});}; \ No newline at end of file +var _0x4bcc=['record','StopMixMonitor','concat','internal','User','catch','exports','models','define','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','merge','Set','format','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0xa9293d,_0x320042){var _0x1890c8=function(_0x58d6a4){while(--_0x58d6a4){_0xa9293d['push'](_0xa9293d['shift']());}};_0x1890c8(++_0x320042);}(_0x4bcc,0x1a6));var _0xc4bc=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x4bcc[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xc4bc('0x0'));var util=require(_0xc4bc('0x1'));var BPromise=require(_0xc4bc('0x2'));var attributes=require(_0xc4bc('0x3'));var getUserApplications=function(_0x5a8454,_0xe9107f,_0x222c2b){var _0x5df112=0x1;var _0x28064a=[];var _0x2bcb80={'context':_0xe9107f['context']||_0xc4bc('0x4'),'exten':util['format'](_0xc4bc('0x5'),_0x5a8454['prefix'],_0x222c2b),'type':'system','isApp':![],'ChanSpyId':_0x5a8454['id'],'UserId':_0xe9107f['id']};_0x28064a['push'](_[_0xc4bc('0x6')]({'app':_0xc4bc('0x7'),'appdata':util[_0xc4bc('0x8')](_0xc4bc('0x9'),_0xc4bc('0xa')),'priority':_0x5df112++},_0x2bcb80));if(_0x5a8454['record']){_0x28064a[_0xc4bc('0xb')](_[_0xc4bc('0x6')]({'app':_0xc4bc('0xc'),'appdata':util['format'](_0xc4bc('0xd'),_0x5a8454['recordingFormat']),'priority':_0x5df112++},_0x2bcb80));}if(_0x5a8454[_0xc4bc('0xe')]){_0x28064a[_0xc4bc('0xb')](_[_0xc4bc('0x6')]({'app':_0xc4bc('0xf'),'appdata':_0x5a8454[_0xc4bc('0x10')],'priority':_0x5df112++},_0x2bcb80));}_0x28064a[_0xc4bc('0xb')](_['merge']({'app':_0xc4bc('0x11'),'appdata':util[_0xc4bc('0x8')](_0xc4bc('0x12'),_0xe9107f[_0xc4bc('0x13')],_0x5a8454[_0xc4bc('0x14')]?_0x5a8454['options'][_0xc4bc('0x15')](''):''),'priority':_0x5df112++},_0x2bcb80));if(_0x5a8454[_0xc4bc('0x16')]){_0x28064a[_0xc4bc('0xb')](_['merge']({'app':_0xc4bc('0x17'),'priority':_0x5df112++},_0x2bcb80));}return _0x28064a;};var getChanSpyApplications=function(_0x3c5b38,_0xcb204a){var _0x59223f=[];for(var _0x55ddb1=0x0,_0x1493cb=0x1;_0x55ddb1<_0xcb204a['length'];_0x55ddb1++,_0x1493cb=0x1){_0x59223f=_0x59223f[_0xc4bc('0x18')](getUserApplications(_0x3c5b38,_0xcb204a[_0x55ddb1],_0xcb204a[_0x55ddb1][_0xc4bc('0x19')]));if(_0xcb204a[_0x55ddb1][_0xc4bc('0x19')]!=_0xcb204a[_0x55ddb1][_0xc4bc('0x13')]){_0x59223f=_0x59223f[_0xc4bc('0x18')](getUserApplications(_0x3c5b38,_0xcb204a[_0x55ddb1],_0xcb204a[_0x55ddb1][_0xc4bc('0x13')]));}}return _0x59223f;};var getChanSpyPromise=function(_0x569928,_0x155002){return new BPromise(function(_0x2eea18,_0x16bd95){return _0x569928[_0xc4bc('0x1a')]['findAll']({'attributes':['id',_0xc4bc('0x13'),_0xc4bc('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x58b833){if(_0x58b833){return _0x2eea18(getChanSpyApplications(_0x155002,_0x58b833));}return _0x2eea18([]);})[_0xc4bc('0x1b')](function(_0x43df19){_0x16bd95(_0x43df19);});});};module[_0xc4bc('0x1c')]=function(_0x52a460,_0x2cd602){var _0x28f044=_0x52a460[_0xc4bc('0x1d')];return _0x52a460[_0xc4bc('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xc4bc('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x403907,_0x102eb3,_0x19dfd5){return getChanSpyPromise(_0x28f044,_0x403907)[_0xc4bc('0x20')](function(_0x6da23e){if(_0x6da23e&&_0x6da23e[_0xc4bc('0x21')]){return _0x28f044[_0xc4bc('0x22')][_0xc4bc('0x23')](_0x6da23e);}})['then'](function(){_0x19dfd5();})[_0xc4bc('0x1b')](function(_0x40dad3){_0x19dfd5(_0x40dad3);});},'afterUpdate':function(_0xe8e49e,_0x283bd1,_0x96f97){return _0x28f044[_0xc4bc('0x22')][_0xc4bc('0x24')]({'where':{'ChanSpyId':_0xe8e49e['id']}})[_0xc4bc('0x20')](function(){return getChanSpyPromise(_0x28f044,_0xe8e49e);})['then'](function(_0x5431dc){if(_0x5431dc&&_0x5431dc[_0xc4bc('0x21')]){return _0x28f044['VoiceExtension'][_0xc4bc('0x23')](_0x5431dc);}})['then'](function(){_0x96f97();})[_0xc4bc('0x1b')](function(_0x111ab5){_0x96f97(_0x111ab5);});},'afterDestroy':function(_0x1604f1,_0x2c9f9b,_0x5e9520){return _0x28f044['VoiceExtension'][_0xc4bc('0x24')]({'where':{'ChanSpyId':_0x1604f1['id']}})['then'](function(){_0x5e9520();})[_0xc4bc('0x1b')](function(_0x56b6d0){_0x5e9520(_0x56b6d0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b23553c..d1c99b7 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 _0xa9e4=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring'];(function(_0x574d9b,_0x2063da){var _0x31d2a5=function(_0x97ce4c){while(--_0x97ce4c){_0x574d9b['push'](_0x574d9b['shift']());}};_0x31d2a5(++_0x2063da);}(_0xa9e4,0x10f));var _0x4a9e=function(_0x18e67c,_0x18d6a6){_0x18e67c=_0x18e67c-0x0;var _0x551e11=_0xa9e4[_0x18e67c];return _0x551e11;};'use strict';var _=require(_0x4a9e('0x0'));var util=require(_0x4a9e('0x1'));var moment=require(_0x4a9e('0x2'));var BPromise=require(_0x4a9e('0x3'));var rs=require(_0x4a9e('0x4'));var fs=require('fs');var Redis=require(_0x4a9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a9e('0x6'));var logger=require(_0x4a9e('0x7'))('rpc');var config=require(_0x4a9e('0x8'));var jayson=require(_0x4a9e('0x9'));var client=jayson[_0x4a9e('0xa')][_0x4a9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566814,_0x5bf4f0,_0x13a919){return new BPromise(function(_0x3da296,_0x25d2e2){return client['request'](_0x566814,_0x13a919)[_0x4a9e('0xc')](function(_0x10770a){logger[_0x4a9e('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x5bf4f0,_0x4a9e('0xe'));logger[_0x4a9e('0xf')](_0x4a9e('0x10'),_0x5bf4f0,_0x4a9e('0xe'),JSON[_0x4a9e('0x11')](_0x10770a));if(_0x10770a[_0x4a9e('0x12')]){if(_0x10770a[_0x4a9e('0x12')][_0x4a9e('0x13')]===0x1f4){logger[_0x4a9e('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x5bf4f0,_0x10770a[_0x4a9e('0x12')][_0x4a9e('0x14')]);return _0x25d2e2(_0x10770a['error'][_0x4a9e('0x14')]);}logger[_0x4a9e('0x12')](_0x4a9e('0x15'),_0x5bf4f0,_0x10770a['error']['message']);return _0x3da296(_0x10770a[_0x4a9e('0x12')][_0x4a9e('0x14')]);}else{logger[_0x4a9e('0xd')](_0x4a9e('0x15'),_0x5bf4f0,_0x4a9e('0xe'));_0x3da296(_0x10770a[_0x4a9e('0x16')][_0x4a9e('0x14')]);}})['catch'](function(_0x324c29){logger[_0x4a9e('0x12')](_0x4a9e('0x15'),_0x5bf4f0,_0x324c29);_0x25d2e2(_0x324c29);});});} \ No newline at end of file +var _0xca6e=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xca6e,0x12b));var _0xeca6=function(_0x34a05a,_0x3ae3e8){_0x34a05a=_0x34a05a-0x0;var _0x2e883f=_0xca6e[_0x34a05a];return _0x2e883f;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var moment=require(_0xeca6('0x2'));var BPromise=require(_0xeca6('0x3'));var rs=require(_0xeca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca6('0x5'))['db'];var utils=require(_0xeca6('0x6'));var logger=require(_0xeca6('0x7'))(_0xeca6('0x8'));var config=require(_0xeca6('0x9'));var jayson=require(_0xeca6('0xa'));var client=jayson[_0xeca6('0xb')][_0xeca6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eb354,_0x4654ea,_0x280520){return new BPromise(function(_0x1566aa,_0x406dbb){return client[_0xeca6('0xd')](_0x5eb354,_0x280520)[_0xeca6('0xe')](function(_0x5504b2){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4654ea,_0xeca6('0xf'));logger[_0xeca6('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4654ea,'request\x20sent',JSON[_0xeca6('0x11')](_0x5504b2));if(_0x5504b2[_0xeca6('0x12')]){if(_0x5504b2['error'][_0xeca6('0x13')]===0x1f4){logger[_0xeca6('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x4654ea,_0x5504b2[_0xeca6('0x12')][_0xeca6('0x14')]);return _0x406dbb(_0x5504b2['error']['message']);}logger[_0xeca6('0x12')](_0xeca6('0x15'),_0x4654ea,_0x5504b2[_0xeca6('0x12')]['message']);return _0x1566aa(_0x5504b2[_0xeca6('0x12')][_0xeca6('0x14')]);}else{logger['info'](_0xeca6('0x15'),_0x4654ea,_0xeca6('0xf'));_0x1566aa(_0x5504b2[_0xeca6('0x16')][_0xeca6('0x14')]);}})['catch'](function(_0x270546){logger['error'](_0xeca6('0x15'),_0x4654ea,_0x270546);_0x406dbb(_0x270546);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index de3151d..dd2b9d1 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 _0xd659=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x20a29a,_0x414104){var _0x4de1d4=function(_0x3beb42){while(--_0x3beb42){_0x20a29a['push'](_0x20a29a['shift']());}};_0x4de1d4(++_0x414104);}(_0xd659,0xf2));var _0x9d65=function(_0x233102,_0x2664bd){_0x233102=_0x233102-0x0;var _0x1531d1=_0xd659[_0x233102];return _0x1531d1;};'use strict';var multer=require('multer');var util=require(_0x9d65('0x0'));var path=require(_0x9d65('0x1'));var timeout=require(_0x9d65('0x2'));var express=require(_0x9d65('0x3'));var router=express[_0x9d65('0x4')]();var auth=require(_0x9d65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d65('0x6'));var controller=require('./voiceContext.controller');router[_0x9d65('0x7')]('/',auth[_0x9d65('0x8')](),controller[_0x9d65('0x9')]);router[_0x9d65('0x7')](_0x9d65('0xa'),auth[_0x9d65('0x8')](),controller[_0x9d65('0xb')]);router[_0x9d65('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d65('0xd')]);router[_0x9d65('0xe')](_0x9d65('0xa'),auth['isAuthenticated'](),controller[_0x9d65('0xf')]);router[_0x9d65('0x10')](_0x9d65('0xa'),auth['isAuthenticated'](),controller[_0x9d65('0x11')]);module[_0x9d65('0x12')]=router; \ No newline at end of file +var _0x077a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1e1131,_0x4a7ab4){var _0xa73eaf=function(_0xec5ced){while(--_0xec5ced){_0x1e1131['push'](_0x1e1131['shift']());}};_0xa73eaf(++_0x4a7ab4);}(_0x077a,0xfb));var _0xa077=function(_0x1a3488,_0x3874b0){_0x1a3488=_0x1a3488-0x0;var _0x8398da=_0x077a[_0x1a3488];return _0x8398da;};'use strict';var multer=require(_0xa077('0x0'));var util=require(_0xa077('0x1'));var path=require(_0xa077('0x2'));var timeout=require(_0xa077('0x3'));var express=require(_0xa077('0x4'));var router=express[_0xa077('0x5')]();var auth=require(_0xa077('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa077('0x7'));var controller=require(_0xa077('0x8'));router[_0xa077('0x9')]('/',auth[_0xa077('0xa')](),controller[_0xa077('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa077('0xc')]);router[_0xa077('0xd')]('/',auth[_0xa077('0xa')](),controller[_0xa077('0xe')]);router[_0xa077('0xf')](_0xa077('0x10'),auth[_0xa077('0xa')](),controller[_0xa077('0x11')]);router[_0xa077('0x12')](_0xa077('0x10'),auth[_0xa077('0xa')](),controller[_0xa077('0x13')]);module[_0xa077('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index bcc2716..ecbe659 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x328da0,_0x3103f4){var _0x3360a9=function(_0x149917){while(--_0x149917){_0x328da0['push'](_0x328da0['shift']());}};_0x3360a9(++_0x3103f4);}(_0x34e8,0x12c));var _0x834e=function(_0x16948b,_0x2e98fa){_0x16948b=_0x16948b-0x0;var _0x534f72=_0x34e8[_0x16948b];return _0x534f72;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x5e319f,_0x12e95a){var _0x15be36=function(_0x4bcdda){while(--_0x4bcdda){_0x5e319f['push'](_0x5e319f['shift']());}};_0x15be36(++_0x12e95a);}(_0x34e8,0x12c));var _0x834e=function(_0x53db62,_0x21d138){_0x53db62=_0x53db62-0x0;var _0x5d2f3b=_0x34e8[_0x53db62];return _0x5d2f3b;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 7688b06..7b15bf6 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 _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(_0x3626ab,_0x46cf71){var _0x3d3f52=function(_0x3f7e88){while(--_0x3f7e88){_0x3626ab['push'](_0x3626ab['shift']());}};_0x3d3f52(++_0x46cf71);}(_0xe14b,0x93));var _0xbe14=function(_0x252df5,_0x4bdd0a){_0x252df5=_0x252df5-0x0;var _0x4800be=_0xe14b[_0x252df5];return _0x4800be;};'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 +var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 6290644..e82bc51 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(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4c0fce,_0x606b3a){var _0x377d2a=function(_0x77adf6){while(--_0x77adf6){_0x4c0fce['push'](_0x4c0fce['shift']());}};_0x377d2a(++_0x606b3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 7f56109..2bdfd79 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 _0xf5ee=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5ee,0xbe));var _0xef5e=function(_0x382544,_0x5cc6f8){_0x382544=_0x382544-0x0;var _0x23e476=_0xf5ee[_0x382544];return _0x23e476;};'use strict';var _=require('lodash');var util=require(_0xef5e('0x0'));var moment=require(_0xef5e('0x1'));var BPromise=require(_0xef5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef5e('0x3'));var db=require(_0xef5e('0x4'))['db'];var utils=require(_0xef5e('0x5'));var logger=require('../../config/logger')(_0xef5e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef5e('0x7')][_0xef5e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3951b7,_0x9199f0,_0x34c345){return new BPromise(function(_0x55590b,_0x44e505){return client[_0xef5e('0x9')](_0x3951b7,_0x34c345)['then'](function(_0x4f05e2){logger[_0xef5e('0xa')](_0xef5e('0xb'),_0x9199f0,_0xef5e('0xc'));logger['debug'](_0xef5e('0xd'),_0x9199f0,'request\x20sent',JSON['stringify'](_0x4f05e2));if(_0x4f05e2[_0xef5e('0xe')]){if(_0x4f05e2[_0xef5e('0xe')][_0xef5e('0xf')]===0x1f4){logger[_0xef5e('0xe')]('VoiceContext,\x20%s,\x20%s',_0x9199f0,_0x4f05e2[_0xef5e('0xe')][_0xef5e('0x10')]);return _0x44e505(_0x4f05e2[_0xef5e('0xe')]['message']);}logger['error'](_0xef5e('0xb'),_0x9199f0,_0x4f05e2[_0xef5e('0xe')][_0xef5e('0x10')]);return _0x55590b(_0x4f05e2[_0xef5e('0xe')][_0xef5e('0x10')]);}else{logger[_0xef5e('0xa')]('VoiceContext,\x20%s,\x20%s',_0x9199f0,_0xef5e('0xc'));_0x55590b(_0x4f05e2[_0xef5e('0x11')][_0xef5e('0x10')]);}})[_0xef5e('0x12')](function(_0x126059){logger[_0xef5e('0xe')](_0xef5e('0xb'),_0x9199f0,_0x126059);_0x44e505(_0x126059);});});} \ No newline at end of file +var _0xab61=['request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','VoiceContext,\x20%s,\x20%s'];(function(_0x4c41c4,_0x75bc8a){var _0x2bdc48=function(_0x2ea5e8){while(--_0x2ea5e8){_0x4c41c4['push'](_0x4c41c4['shift']());}};_0x2bdc48(++_0x75bc8a);}(_0xab61,0x196));var _0x1ab6=function(_0x5cf28f,_0x1b6a0b){_0x5cf28f=_0x5cf28f-0x0;var _0x496403=_0xab61[_0x5cf28f];return _0x496403;};'use strict';var _=require(_0x1ab6('0x0'));var util=require(_0x1ab6('0x1'));var moment=require(_0x1ab6('0x2'));var BPromise=require(_0x1ab6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ab6('0x4'));var db=require(_0x1ab6('0x5'))['db'];var utils=require(_0x1ab6('0x6'));var logger=require(_0x1ab6('0x7'))(_0x1ab6('0x8'));var config=require(_0x1ab6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1ab6('0xa')][_0x1ab6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1284ef,_0x2be323,_0x3b9791){return new BPromise(function(_0x589228,_0x19f995){return client['request'](_0x1284ef,_0x3b9791)[_0x1ab6('0xc')](function(_0x17e10d){logger['info'](_0x1ab6('0xd'),_0x2be323,_0x1ab6('0xe'));logger['debug'](_0x1ab6('0xf'),_0x2be323,_0x1ab6('0xe'),JSON[_0x1ab6('0x10')](_0x17e10d));if(_0x17e10d[_0x1ab6('0x11')]){if(_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x12')]===0x1f4){logger[_0x1ab6('0x11')](_0x1ab6('0xd'),_0x2be323,_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);return _0x19f995(_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);}logger['error'](_0x1ab6('0xd'),_0x2be323,_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);return _0x589228(_0x17e10d[_0x1ab6('0x11')][_0x1ab6('0x13')]);}else{logger['info'](_0x1ab6('0xd'),_0x2be323,'request\x20sent');_0x589228(_0x17e10d[_0x1ab6('0x14')][_0x1ab6('0x13')]);}})['catch'](function(_0x2a705e){logger[_0x1ab6('0x11')](_0x1ab6('0xd'),_0x2be323,_0x2a705e);_0x19f995(_0x2a705e);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 901ad35..188aff9 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 _0xf545=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x269fab,_0xd76e80){var _0x21982b=function(_0x572ae6){while(--_0x572ae6){_0x269fab['push'](_0x269fab['shift']());}};_0x21982b(++_0xd76e80);}(_0xf545,0x1af));var _0x5f54=function(_0x1879a4,_0x581a4a){_0x1879a4=_0x1879a4-0x0;var _0x38e837=_0xf545[_0x1879a4];return _0x38e837;};'use strict';var multer=require(_0x5f54('0x0'));var util=require('util');var path=require(_0x5f54('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f54('0x2'));var router=express[_0x5f54('0x3')]();var auth=require(_0x5f54('0x4'));var interaction=require(_0x5f54('0x5'));var config=require(_0x5f54('0x6'));var controller=require(_0x5f54('0x7'));router[_0x5f54('0x8')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xa')]);router['get']('/describe',auth[_0x5f54('0x9')](),controller['describe']);router[_0x5f54('0x8')](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0xc')]);router[_0x5f54('0xd')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xe')]);router[_0x5f54('0xf')](_0x5f54('0xb'),auth[_0x5f54('0x9')](),controller[_0x5f54('0x10')]);router[_0x5f54('0x11')]('/:id',auth[_0x5f54('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x954a=['show','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x18aa9b,_0x4a8fc9){var _0x92ca21=function(_0x4dcabe){while(--_0x4dcabe){_0x18aa9b['push'](_0x18aa9b['shift']());}};_0x92ca21(++_0x4a8fc9);}(_0x954a,0x83));var _0xa954=function(_0x4d771c,_0x1e930e){_0x4d771c=_0x4d771c-0x0;var _0x3600bc=_0x954a[_0x4d771c];return _0x3600bc;};'use strict';var multer=require(_0xa954('0x0'));var util=require(_0xa954('0x1'));var path=require(_0xa954('0x2'));var timeout=require(_0xa954('0x3'));var express=require(_0xa954('0x4'));var router=express[_0xa954('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa954('0x6'));var config=require(_0xa954('0x7'));var controller=require('./voiceDialReport.controller');router[_0xa954('0x8')]('/',auth[_0xa954('0x9')](),controller[_0xa954('0xa')]);router[_0xa954('0x8')]('/describe',auth[_0xa954('0x9')](),controller[_0xa954('0xb')]);router['get'](_0xa954('0xc'),auth['isAuthenticated'](),controller[_0xa954('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa954('0xc'),auth['isAuthenticated'](),controller[_0xa954('0xe')]);router['delete'](_0xa954('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa954('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 710d310..85291bb 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 _0x479a=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x479a,0xb4));var _0xa479=function(_0x2b650f,_0x518dd9){_0x2b650f=_0x2b650f-0x0;var _0x341c51=_0x479a[_0x2b650f];return _0x341c51;};'use strict';var Sequelize=require(_0xa479('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa479('0x1')]},'channel':{'type':Sequelize[_0xa479('0x1')]},'channelstate':{'type':Sequelize[_0xa479('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa479('0x1')]},'calleridnum':{'type':Sequelize[_0xa479('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa479('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa479('0x1')]},'context':{'type':Sequelize[_0xa479('0x1')]},'exten':{'type':Sequelize[_0xa479('0x1')]},'priority':{'type':Sequelize[_0xa479('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa479('0x1')]},'destchannel':{'type':Sequelize[_0xa479('0x1')]},'destchannelstate':{'type':Sequelize[_0xa479('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa479('0x1')]},'destcalleridname':{'type':Sequelize[_0xa479('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xa479('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa479('0x1')]},'destlanguage':{'type':Sequelize[_0xa479('0x1')]},'destaccountcode':{'type':Sequelize[_0xa479('0x1')]},'destcontext':{'type':Sequelize[_0xa479('0x1')]},'destexten':{'type':Sequelize[_0xa479('0x1')]},'destpriority':{'type':Sequelize[_0xa479('0x2')]},'destuniqueid':{'type':Sequelize[_0xa479('0x1')]},'destlinkedid':{'type':Sequelize[_0xa479('0x1')]},'dialstring':{'type':Sequelize[_0xa479('0x1')]},'dialstatus':{'type':Sequelize[_0xa479('0x1')]},'starttime':{'type':Sequelize[_0xa479('0x3')]},'answertime':{'type':Sequelize[_0xa479('0x3')]},'endtime':{'type':Sequelize[_0xa479('0x3')]},'lastevent':{'type':Sequelize[_0xa479('0x1')],'comment':_0xa479('0x4')},'routeId':{'type':Sequelize[_0xa479('0x2')]},'duration':{'type':Sequelize[_0xa479('0x2')]},'holdtime':{'type':Sequelize[_0xa479('0x2')]},'billableseconds':{'type':Sequelize[_0xa479('0x2')]}}; \ No newline at end of file +var _0x504d=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x1a84c1,_0x30a2ae){var _0x103098=function(_0xc5453f){while(--_0xc5453f){_0x1a84c1['push'](_0x1a84c1['shift']());}};_0x103098(++_0x30a2ae);}(_0x504d,0xca));var _0xd504=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x504d[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xd504('0x0')]={'privilege':{'type':Sequelize[_0xd504('0x1')]},'channel':{'type':Sequelize[_0xd504('0x1')]},'channelstate':{'type':Sequelize[_0xd504('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd504('0x1')]},'calleridname':{'type':Sequelize[_0xd504('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd504('0x1')]},'language':{'type':Sequelize[_0xd504('0x1')]},'accountcode':{'type':Sequelize[_0xd504('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd504('0x1')]},'priority':{'type':Sequelize[_0xd504('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd504('0x1')]},'destchannelstate':{'type':Sequelize[_0xd504('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd504('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd504('0x1')]},'destcalleridname':{'type':Sequelize[_0xd504('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd504('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd504('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd504('0x2')]},'destuniqueid':{'type':Sequelize[_0xd504('0x1')]},'destlinkedid':{'type':Sequelize[_0xd504('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd504('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd504('0x3')]},'lastevent':{'type':Sequelize[_0xd504('0x1')],'comment':_0xd504('0x4')},'routeId':{'type':Sequelize[_0xd504('0x2')]},'duration':{'type':Sequelize[_0xd504('0x2')]},'holdtime':{'type':Sequelize[_0xd504('0x2')]},'billableseconds':{'type':Sequelize[_0xd504('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 7e8e5a5..daac0a9 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 _0xa639=['rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','VoiceDialReport'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0xa639,0x140));var _0x9a63=function(_0x2f4d54,_0x1cb759){_0x2f4d54=_0x2f4d54-0x0;var _0x21c76d=_0xa639[_0x2f4d54];return _0x21c76d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a63('0x0'));var rimraf=require(_0x9a63('0x1'));var zipdir=require(_0x9a63('0x2'));var jsonpatch=require(_0x9a63('0x3'));var rp=require(_0x9a63('0x4'));var moment=require('moment');var BPromise=require(_0x9a63('0x5'));var Mustache=require('mustache');var util=require(_0x9a63('0x6'));var path=require('path');var sox=require(_0x9a63('0x7'));var csv=require(_0x9a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a63('0x9'));var squel=require(_0x9a63('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a63('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9a63('0x8'));var querystring=require(_0x9a63('0xc'));var Papa=require(_0x9a63('0xd'));var Redis=require(_0x9a63('0xe'));var authService=require(_0x9a63('0xf'));var qs=require(_0x9a63('0x10'));var as=require(_0x9a63('0x11'));var hardwareService=require(_0x9a63('0x12'));var logger=require('../../config/logger')(_0x9a63('0x13'));var utils=require('../../config/utils');var config=require(_0x9a63('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4a86,_0x216567){_0x216567=_0x216567||0xcc;return function(_0x4050ff){if(_0x4050ff){return _0x4a4a86[_0x9a63('0x15')](_0x216567);}return _0x4a4a86[_0x9a63('0x16')](_0x216567)['end']();};}function respondWithResult(_0x2b8b2f,_0x116786){_0x116786=_0x116786||0xc8;return function(_0x486a5b){if(_0x486a5b){return _0x2b8b2f[_0x9a63('0x16')](_0x116786)[_0x9a63('0x17')](_0x486a5b);}};}function respondWithFilteredResult(_0x285929,_0x1c40ac){return function(_0x16f835){if(_0x16f835){var _0x19af35=_0x16f835[_0x9a63('0x18')],_0x2479e7=_0x1c40ac[_0x9a63('0x19')],_0x3947da=_0x1c40ac[_0x9a63('0x19')]+_0x1c40ac['limit'],_0x1b97ad;if(_0x3947da>=_0x19af35){_0x3947da=_0x19af35;_0x1b97ad=0xc8;}else{_0x1b97ad=0xce;}_0x285929[_0x9a63('0x16')](_0x1b97ad);return _0x285929[_0x9a63('0x1a')](_0x9a63('0x1b'),_0x2479e7+'-'+_0x3947da+'/'+_0x19af35)[_0x9a63('0x17')](_0x16f835);}return null;};}function patchUpdates(_0x1fea01){return function(_0x16d112){try{jsonpatch[_0x9a63('0x1c')](_0x16d112,_0x1fea01,!![]);}catch(_0x58edf6){return BPromise[_0x9a63('0x1d')](_0x58edf6);}return _0x16d112[_0x9a63('0x1e')]();};}function saveUpdates(_0xd84360,_0xf31ed4){return function(_0x3b8459){if(_0x3b8459){return _0x3b8459[_0x9a63('0x1f')](_0xd84360)['then'](function(_0x1ec0cb){return _0x1ec0cb;});}return null;};}function removeEntity(_0x3f170f,_0x1dbf11){return function(_0x54226c){if(_0x54226c){return _0x54226c[_0x9a63('0x20')]()['then'](function(){_0x3f170f[_0x9a63('0x16')](0xcc)[_0x9a63('0x21')]();});}};}function handleEntityNotFound(_0xb8bd4a,_0x17aabc){return function(_0x4c7a6a){if(!_0x4c7a6a){_0xb8bd4a['sendStatus'](0x194);}return _0x4c7a6a;};}function handleError(_0x32576e,_0x4f8e6c){_0x4f8e6c=_0x4f8e6c||0x1f4;return function(_0x50701d){logger[_0x9a63('0x22')](_0x50701d[_0x9a63('0x23')]);if(_0x50701d['name']){delete _0x50701d[_0x9a63('0x24')];}_0x32576e['status'](_0x4f8e6c)[_0x9a63('0x25')](_0x50701d);};}exports[_0x9a63('0x26')]=function(_0x25c997,_0x155fe4){var _0xd67322={},_0x4d010a={},_0x21ecc9={'count':0x0,'rows':[]};var _0x2d9306=_['map'](db[_0x9a63('0x27')][_0x9a63('0x28')],function(_0x44a1b2){return{'name':_0x44a1b2['fieldName'],'type':_0x44a1b2[_0x9a63('0x29')]['key']};});_0x4d010a[_0x9a63('0x2a')]=_[_0x9a63('0x2b')](_0x2d9306,_0x9a63('0x24'));_0x4d010a[_0x9a63('0x2c')]=_[_0x9a63('0x2d')](_0x25c997[_0x9a63('0x2c')]);_0x4d010a[_0x9a63('0x2e')]=_[_0x9a63('0x2f')](_0x4d010a[_0x9a63('0x2a')],_0x4d010a[_0x9a63('0x2c')]);_0xd67322['attributes']=_[_0x9a63('0x2f')](_0x4d010a['model'],qs[_0x9a63('0x30')](_0x25c997[_0x9a63('0x2c')][_0x9a63('0x30')]));_0xd67322[_0x9a63('0x31')]=_0xd67322[_0x9a63('0x31')][_0x9a63('0x32')]?_0xd67322[_0x9a63('0x31')]:_0x4d010a[_0x9a63('0x2a')];if(!_0x25c997[_0x9a63('0x2c')][_0x9a63('0x33')](_0x9a63('0x34'))){_0xd67322[_0x9a63('0x35')]=qs[_0x9a63('0x35')](_0x25c997[_0x9a63('0x2c')]['limit']);_0xd67322[_0x9a63('0x19')]=qs[_0x9a63('0x19')](_0x25c997[_0x9a63('0x2c')][_0x9a63('0x19')]);}_0xd67322[_0x9a63('0x36')]=qs[_0x9a63('0x37')](_0x25c997[_0x9a63('0x2c')][_0x9a63('0x37')]);_0xd67322[_0x9a63('0x38')]=qs[_0x9a63('0x2e')](_[_0x9a63('0x39')](_0x25c997[_0x9a63('0x2c')],_0x4d010a[_0x9a63('0x2e')]),_0x2d9306);if(_0x25c997['query']['filter']){_0xd67322[_0x9a63('0x38')]=_[_0x9a63('0x3a')](_0xd67322['where'],{'$or':_[_0x9a63('0x2b')](_0x2d9306,function(_0x48e3ad){if(_0x48e3ad[_0x9a63('0x29')]!==_0x9a63('0x3b')){var _0x4cf384={};_0x4cf384[_0x48e3ad[_0x9a63('0x24')]]={'$like':'%'+_0x25c997[_0x9a63('0x2c')]['filter']+'%'};return _0x4cf384;}})});}_0xd67322=_[_0x9a63('0x3a')]({},_0xd67322,_0x25c997[_0x9a63('0x3c')]);var _0x4051a2={'where':_0xd67322[_0x9a63('0x38')]};return db['VoiceDialReport']['count'](_0x4051a2)[_0x9a63('0x3d')](function(_0x3bca41){_0x21ecc9[_0x9a63('0x18')]=_0x3bca41;if(_0x25c997[_0x9a63('0x2c')][_0x9a63('0x3e')]){_0xd67322[_0x9a63('0x3f')]=[{'all':!![]}];}return db[_0x9a63('0x27')][_0x9a63('0x40')](_0xd67322);})['then'](function(_0x279cda){_0x21ecc9['rows']=_0x279cda;return _0x21ecc9;})['then'](respondWithFilteredResult(_0x155fe4,_0xd67322))[_0x9a63('0x41')](handleError(_0x155fe4,null));};exports[_0x9a63('0x42')]=function(_0x33032f,_0x450060){var _0x403364={'raw':!![],'where':{'id':_0x33032f[_0x9a63('0x43')]['id']}},_0x462a0e={};_0x462a0e[_0x9a63('0x2a')]=_[_0x9a63('0x2d')](db['VoiceDialReport'][_0x9a63('0x28')]);_0x462a0e[_0x9a63('0x2c')]=_[_0x9a63('0x2d')](_0x33032f['query']);_0x462a0e[_0x9a63('0x2e')]=_[_0x9a63('0x2f')](_0x462a0e[_0x9a63('0x2a')],_0x462a0e['query']);_0x403364[_0x9a63('0x31')]=_[_0x9a63('0x2f')](_0x462a0e[_0x9a63('0x2a')],qs[_0x9a63('0x30')](_0x33032f[_0x9a63('0x2c')][_0x9a63('0x30')]));_0x403364[_0x9a63('0x31')]=_0x403364[_0x9a63('0x31')][_0x9a63('0x32')]?_0x403364[_0x9a63('0x31')]:_0x462a0e[_0x9a63('0x2a')];if(_0x33032f[_0x9a63('0x2c')][_0x9a63('0x3e')]){_0x403364[_0x9a63('0x3f')]=[{'all':!![]}];}_0x403364=_[_0x9a63('0x3a')]({},_0x403364,_0x33032f[_0x9a63('0x3c')]);return db[_0x9a63('0x27')][_0x9a63('0x44')](_0x403364)['then'](handleEntityNotFound(_0x450060,null))[_0x9a63('0x3d')](respondWithResult(_0x450060,null))[_0x9a63('0x41')](handleError(_0x450060,null));};exports[_0x9a63('0x45')]=function(_0x520bdf,_0x5c2d17){return db[_0x9a63('0x27')][_0x9a63('0x45')](_0x520bdf[_0x9a63('0x46')],{})[_0x9a63('0x3d')](respondWithResult(_0x5c2d17,0xc9))[_0x9a63('0x41')](handleError(_0x5c2d17,null));};exports[_0x9a63('0x1f')]=function(_0x21c09c,_0x31c582){if(_0x21c09c['body']['id']){delete _0x21c09c['body']['id'];}return db[_0x9a63('0x27')][_0x9a63('0x44')]({'where':{'id':_0x21c09c[_0x9a63('0x43')]['id']}})[_0x9a63('0x3d')](handleEntityNotFound(_0x31c582,null))[_0x9a63('0x3d')](saveUpdates(_0x21c09c[_0x9a63('0x46')],null))[_0x9a63('0x3d')](respondWithResult(_0x31c582,null))['catch'](handleError(_0x31c582,null));};exports[_0x9a63('0x20')]=function(_0x1eb09d,_0x324d2d){return db[_0x9a63('0x27')][_0x9a63('0x44')]({'where':{'id':_0x1eb09d[_0x9a63('0x43')]['id']}})['then'](handleEntityNotFound(_0x324d2d,null))[_0x9a63('0x3d')](removeEntity(_0x324d2d,null))[_0x9a63('0x41')](handleError(_0x324d2d,null));};exports[_0x9a63('0x47')]=function(_0x45e118,_0x932b2d){return db['VoiceDialReport'][_0x9a63('0x47')]()['then'](respondWithResult(_0x932b2d,null))[_0x9a63('0x41')](handleError(_0x932b2d,null));}; \ No newline at end of file +var _0xcd16=['destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xcd16,0x13e));var _0x6cd1=function(_0x415e30,_0x33e944){_0x415e30=_0x415e30-0x0;var _0x401aaa=_0xcd16[_0x415e30];return _0x401aaa;};'use strict';var pdf=require(_0x6cd1('0x0'));var emlformat=require(_0x6cd1('0x1'));var rimraf=require(_0x6cd1('0x2'));var zipdir=require(_0x6cd1('0x3'));var jsonpatch=require(_0x6cd1('0x4'));var rp=require(_0x6cd1('0x5'));var moment=require(_0x6cd1('0x6'));var BPromise=require(_0x6cd1('0x7'));var Mustache=require(_0x6cd1('0x8'));var util=require(_0x6cd1('0x9'));var path=require(_0x6cd1('0xa'));var sox=require(_0x6cd1('0xb'));var csv=require(_0x6cd1('0xc'));var ejs=require(_0x6cd1('0xd'));var fs=require('fs');var _=require(_0x6cd1('0xe'));var squel=require(_0x6cd1('0xf'));var crypto=require(_0x6cd1('0x10'));var jsforce=require(_0x6cd1('0x11'));var deskjs=require(_0x6cd1('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6cd1('0x13'));var Papa=require(_0x6cd1('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cd1('0x15'));var as=require(_0x6cd1('0x16'));var hardwareService=require(_0x6cd1('0x17'));var logger=require(_0x6cd1('0x18'))(_0x6cd1('0x19'));var utils=require('../../config/utils');var config=require(_0x6cd1('0x1a'));var db=require(_0x6cd1('0x1b'))['db'];function respondWithStatusCode(_0x5a274f,_0x1651c3){_0x1651c3=_0x1651c3||0xcc;return function(_0x1b328f){if(_0x1b328f){return _0x5a274f[_0x6cd1('0x1c')](_0x1651c3);}return _0x5a274f['status'](_0x1651c3)[_0x6cd1('0x1d')]();};}function respondWithResult(_0x233b6f,_0x221831){_0x221831=_0x221831||0xc8;return function(_0x34b401){if(_0x34b401){return _0x233b6f[_0x6cd1('0x1e')](_0x221831)[_0x6cd1('0x1f')](_0x34b401);}};}function respondWithFilteredResult(_0x51eba0,_0x4c50dd){return function(_0x59b4bb){if(_0x59b4bb){var _0x228153=_0x59b4bb[_0x6cd1('0x20')],_0x414262=_0x4c50dd[_0x6cd1('0x21')],_0x430385=_0x4c50dd['offset']+_0x4c50dd[_0x6cd1('0x22')],_0x55a6cc;if(_0x430385>=_0x228153){_0x430385=_0x228153;_0x55a6cc=0xc8;}else{_0x55a6cc=0xce;}_0x51eba0[_0x6cd1('0x1e')](_0x55a6cc);return _0x51eba0['set'](_0x6cd1('0x23'),_0x414262+'-'+_0x430385+'/'+_0x228153)[_0x6cd1('0x1f')](_0x59b4bb);}return null;};}function patchUpdates(_0x525757){return function(_0x22809d){try{jsonpatch[_0x6cd1('0x24')](_0x22809d,_0x525757,!![]);}catch(_0x19d7df){return BPromise['reject'](_0x19d7df);}return _0x22809d[_0x6cd1('0x25')]();};}function saveUpdates(_0x59b7dd,_0x2017df){return function(_0x36aa39){if(_0x36aa39){return _0x36aa39[_0x6cd1('0x26')](_0x59b7dd)[_0x6cd1('0x27')](function(_0x19da03){return _0x19da03;});}return null;};}function removeEntity(_0x5e1e28,_0x41ce38){return function(_0x3c6416){if(_0x3c6416){return _0x3c6416['destroy']()[_0x6cd1('0x27')](function(){_0x5e1e28[_0x6cd1('0x1e')](0xcc)[_0x6cd1('0x1d')]();});}};}function handleEntityNotFound(_0x1c34e2,_0x2c4825){return function(_0x3b11d1){if(!_0x3b11d1){_0x1c34e2[_0x6cd1('0x1c')](0x194);}return _0x3b11d1;};}function handleError(_0x2e6511,_0x22b6d2){_0x22b6d2=_0x22b6d2||0x1f4;return function(_0x581d9e){logger[_0x6cd1('0x28')](_0x581d9e[_0x6cd1('0x29')]);if(_0x581d9e[_0x6cd1('0x2a')]){delete _0x581d9e[_0x6cd1('0x2a')];}_0x2e6511[_0x6cd1('0x1e')](_0x22b6d2)[_0x6cd1('0x2b')](_0x581d9e);};}exports['index']=function(_0x59d6a6,_0x27dc32){var _0x2f28b1={},_0x4536ad={},_0x954fb={'count':0x0,'rows':[]};var _0xc3cd5a=_[_0x6cd1('0x2c')](db[_0x6cd1('0x2d')][_0x6cd1('0x2e')],function(_0x5e2956){return{'name':_0x5e2956[_0x6cd1('0x2f')],'type':_0x5e2956['type'][_0x6cd1('0x30')]};});_0x4536ad[_0x6cd1('0x31')]=_[_0x6cd1('0x2c')](_0xc3cd5a,_0x6cd1('0x2a'));_0x4536ad['query']=_[_0x6cd1('0x32')](_0x59d6a6[_0x6cd1('0x33')]);_0x4536ad[_0x6cd1('0x34')]=_[_0x6cd1('0x35')](_0x4536ad[_0x6cd1('0x31')],_0x4536ad[_0x6cd1('0x33')]);_0x2f28b1[_0x6cd1('0x36')]=_['intersection'](_0x4536ad[_0x6cd1('0x31')],qs[_0x6cd1('0x37')](_0x59d6a6[_0x6cd1('0x33')]['fields']));_0x2f28b1[_0x6cd1('0x36')]=_0x2f28b1[_0x6cd1('0x36')][_0x6cd1('0x38')]?_0x2f28b1[_0x6cd1('0x36')]:_0x4536ad[_0x6cd1('0x31')];if(!_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x39')]('nolimit')){_0x2f28b1[_0x6cd1('0x22')]=qs[_0x6cd1('0x22')](_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x22')]);_0x2f28b1[_0x6cd1('0x21')]=qs['offset'](_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x21')]);}_0x2f28b1[_0x6cd1('0x3a')]=qs[_0x6cd1('0x3b')](_0x59d6a6[_0x6cd1('0x33')]['sort']);_0x2f28b1[_0x6cd1('0x3c')]=qs[_0x6cd1('0x34')](_[_0x6cd1('0x3d')](_0x59d6a6['query'],_0x4536ad[_0x6cd1('0x34')]),_0xc3cd5a);if(_0x59d6a6['query']['filter']){_0x2f28b1['where']=_['merge'](_0x2f28b1[_0x6cd1('0x3c')],{'$or':_['map'](_0xc3cd5a,function(_0x1cf5cf){if(_0x1cf5cf[_0x6cd1('0x3e')]!==_0x6cd1('0x3f')){var _0x5a70da={};_0x5a70da[_0x1cf5cf['name']]={'$like':'%'+_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x40')]+'%'};return _0x5a70da;}})});}_0x2f28b1=_[_0x6cd1('0x41')]({},_0x2f28b1,_0x59d6a6[_0x6cd1('0x42')]);var _0x220ee5={'where':_0x2f28b1['where']};return db[_0x6cd1('0x2d')][_0x6cd1('0x20')](_0x220ee5)[_0x6cd1('0x27')](function(_0x3f7438){_0x954fb[_0x6cd1('0x20')]=_0x3f7438;if(_0x59d6a6[_0x6cd1('0x33')][_0x6cd1('0x43')]){_0x2f28b1[_0x6cd1('0x44')]=[{'all':!![]}];}return db[_0x6cd1('0x2d')][_0x6cd1('0x45')](_0x2f28b1);})['then'](function(_0x2d524a){_0x954fb[_0x6cd1('0x46')]=_0x2d524a;return _0x954fb;})['then'](respondWithFilteredResult(_0x27dc32,_0x2f28b1))[_0x6cd1('0x47')](handleError(_0x27dc32,null));};exports[_0x6cd1('0x48')]=function(_0x3f457f,_0x568fc4){var _0x1bfdd0={'raw':!![],'where':{'id':_0x3f457f[_0x6cd1('0x49')]['id']}},_0x5be2f9={};_0x5be2f9[_0x6cd1('0x31')]=_[_0x6cd1('0x32')](db['VoiceDialReport'][_0x6cd1('0x2e')]);_0x5be2f9[_0x6cd1('0x33')]=_[_0x6cd1('0x32')](_0x3f457f['query']);_0x5be2f9[_0x6cd1('0x34')]=_[_0x6cd1('0x35')](_0x5be2f9[_0x6cd1('0x31')],_0x5be2f9['query']);_0x1bfdd0['attributes']=_[_0x6cd1('0x35')](_0x5be2f9[_0x6cd1('0x31')],qs[_0x6cd1('0x37')](_0x3f457f[_0x6cd1('0x33')]['fields']));_0x1bfdd0[_0x6cd1('0x36')]=_0x1bfdd0[_0x6cd1('0x36')]['length']?_0x1bfdd0[_0x6cd1('0x36')]:_0x5be2f9[_0x6cd1('0x31')];if(_0x3f457f[_0x6cd1('0x33')][_0x6cd1('0x43')]){_0x1bfdd0[_0x6cd1('0x44')]=[{'all':!![]}];}_0x1bfdd0=_[_0x6cd1('0x41')]({},_0x1bfdd0,_0x3f457f[_0x6cd1('0x42')]);return db[_0x6cd1('0x2d')][_0x6cd1('0x4a')](_0x1bfdd0)['then'](handleEntityNotFound(_0x568fc4,null))[_0x6cd1('0x27')](respondWithResult(_0x568fc4,null))[_0x6cd1('0x47')](handleError(_0x568fc4,null));};exports[_0x6cd1('0x4b')]=function(_0x588e01,_0x48ab0d){return db['VoiceDialReport'][_0x6cd1('0x4b')](_0x588e01['body'],{})[_0x6cd1('0x27')](respondWithResult(_0x48ab0d,0xc9))[_0x6cd1('0x47')](handleError(_0x48ab0d,null));};exports['update']=function(_0x59067c,_0x147b35){if(_0x59067c[_0x6cd1('0x4c')]['id']){delete _0x59067c[_0x6cd1('0x4c')]['id'];}return db[_0x6cd1('0x2d')]['find']({'where':{'id':_0x59067c['params']['id']}})[_0x6cd1('0x27')](handleEntityNotFound(_0x147b35,null))[_0x6cd1('0x27')](saveUpdates(_0x59067c['body'],null))['then'](respondWithResult(_0x147b35,null))['catch'](handleError(_0x147b35,null));};exports[_0x6cd1('0x4d')]=function(_0xa1ae6e,_0x18df46){return db[_0x6cd1('0x2d')][_0x6cd1('0x4a')]({'where':{'id':_0xa1ae6e['params']['id']}})[_0x6cd1('0x27')](handleEntityNotFound(_0x18df46,null))[_0x6cd1('0x27')](removeEntity(_0x18df46,null))[_0x6cd1('0x47')](handleError(_0x18df46,null));};exports[_0x6cd1('0x4e')]=function(_0x3a578a,_0x22d34b){return db[_0x6cd1('0x2d')][_0x6cd1('0x4e')]()['then'](respondWithResult(_0x22d34b,null))[_0x6cd1('0x47')](handleError(_0x22d34b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e7b8e0e..1764a02 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 _0x297a=['path','exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x297a,0xd4));var _0xa297=function(_0x25abed,_0x1a25b3){_0x25abed=_0x25abed-0x0;var _0x45374e=_0x297a[_0x25abed];return _0x45374e;};'use strict';var _=require(_0xa297('0x0'));var util=require(_0xa297('0x1'));var logger=require(_0xa297('0x2'))(_0xa297('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa297('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xa297('0x5')]=function(_0x21dc09,_0x10407d){return _0x21dc09['define'](_0xa297('0x6'),attributes,{'tableName':_0xa297('0x7'),'paranoid':![],'indexes':[{'fields':[_0xa297('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8228=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','report_dial','uniqueid','util','../../config/logger'];(function(_0x4019c9,_0x1762ac){var _0x49cf80=function(_0x591f1a){while(--_0x591f1a){_0x4019c9['push'](_0x4019c9['shift']());}};_0x49cf80(++_0x1762ac);}(_0x8228,0x1de));var _0x8822=function(_0x240257,_0x567545){_0x240257=_0x240257-0x0;var _0x4315ea=_0x8228[_0x240257];return _0x4315ea;};'use strict';var _=require('lodash');var util=require(_0x8822('0x0'));var logger=require(_0x8822('0x1'))(_0x8822('0x2'));var moment=require(_0x8822('0x3'));var BPromise=require('bluebird');var rp=require(_0x8822('0x4'));var fs=require('fs');var path=require(_0x8822('0x5'));var rimraf=require(_0x8822('0x6'));var config=require(_0x8822('0x7'));var attributes=require(_0x8822('0x8'));module['exports']=function(_0x2185a3,_0x3d6725){return _0x2185a3[_0x8822('0x9')]('VoiceDialReport',attributes,{'tableName':_0x8822('0xa'),'paranoid':![],'indexes':[{'fields':[_0x8822('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 24dccdb..27bcb72 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 _0x089f=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xefe1b6,_0x308cc8){var _0x3b3256=function(_0x3804e5){while(--_0x3804e5){_0xefe1b6['push'](_0xefe1b6['shift']());}};_0x3b3256(++_0x308cc8);}(_0x089f,0x1c7));var _0xf089=function(_0x2251c4,_0x262b18){_0x2251c4=_0x2251c4-0x0;var _0x4df075=_0x089f[_0x2251c4];return _0x4df075;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var moment=require(_0xf089('0x1'));var BPromise=require(_0xf089('0x2'));var rs=require(_0xf089('0x3'));var fs=require('fs');var Redis=require(_0xf089('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf089('0x5'));var logger=require(_0xf089('0x6'))(_0xf089('0x7'));var config=require('../../config/environment');var jayson=require(_0xf089('0x8'));var client=jayson[_0xf089('0x9')][_0xf089('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b977,_0x21a3f7,_0x1987d9){return new BPromise(function(_0x115de6,_0x55e37a){return client[_0xf089('0xb')](_0x49b977,_0x1987d9)[_0xf089('0xc')](function(_0x433553){logger[_0xf089('0xd')](_0xf089('0xe'),_0x21a3f7,_0xf089('0xf'));logger['debug'](_0xf089('0x10'),_0x21a3f7,_0xf089('0xf'),JSON[_0xf089('0x11')](_0x433553));if(_0x433553['error']){if(_0x433553[_0xf089('0x12')][_0xf089('0x13')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x21a3f7,_0x433553[_0xf089('0x12')][_0xf089('0x14')]);return _0x55e37a(_0x433553['error'][_0xf089('0x14')]);}logger[_0xf089('0x12')](_0xf089('0xe'),_0x21a3f7,_0x433553[_0xf089('0x12')]['message']);return _0x115de6(_0x433553[_0xf089('0x12')]['message']);}else{logger[_0xf089('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x21a3f7,_0xf089('0xf'));_0x115de6(_0x433553['result'][_0xf089('0x14')]);}})[_0xf089('0x15')](function(_0x157371){logger[_0xf089('0x12')](_0xf089('0xe'),_0x21a3f7,_0x157371);_0x55e37a(_0x157371);});});}exports['CreateVoiceDialReport']=function(_0x7fbed5){var _0x4e714a=this;return new Promise(function(_0x407263,_0x3418c4){return db['VoiceDialReport'][_0xf089('0x16')](_0x7fbed5[_0xf089('0x17')],{'raw':_0x7fbed5['options']?_0x7fbed5[_0xf089('0x18')][_0xf089('0x19')]===undefined?!![]:![]:!![]})[_0xf089('0xc')](function(_0x2ab659){logger[_0xf089('0xd')](_0xf089('0x1a'),_0x7fbed5);logger[_0xf089('0x1b')](_0xf089('0x1a'),_0x7fbed5,JSON[_0xf089('0x11')](_0x2ab659));_0x407263(_0x2ab659);})[_0xf089('0x15')](function(_0x581180){logger[_0xf089('0x12')](_0xf089('0x1a'),_0x581180[_0xf089('0x14')],_0x7fbed5);_0x3418c4(_0x4e714a[_0xf089('0x12')](0x1f4,_0x581180[_0xf089('0x14')]));});});};exports[_0xf089('0x1c')]=function(_0x249b88){var _0x94df4d=this;return new Promise(function(_0x22f2f2,_0x3a78fc){return db['VoiceDialReport'][_0xf089('0x1d')](_0x249b88['body'],{'raw':_0x249b88[_0xf089('0x18')]?_0x249b88[_0xf089('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x249b88[_0xf089('0x18')]?_0x249b88['options']['where']||null:null,'attributes':_0x249b88[_0xf089('0x18')]?_0x249b88[_0xf089('0x18')][_0xf089('0x1e')]||null:null,'limit':_0x249b88[_0xf089('0x18')]?_0x249b88[_0xf089('0x18')]['limit']||null:null})[_0xf089('0xc')](function(_0x531dd2){logger[_0xf089('0xd')](_0xf089('0x1c'),_0x249b88);logger[_0xf089('0x1b')](_0xf089('0x1c'),_0x249b88,JSON[_0xf089('0x11')](_0x531dd2));_0x22f2f2(_0x531dd2);})[_0xf089('0x15')](function(_0x3268ca){logger[_0xf089('0x12')](_0xf089('0x1c'),_0x3268ca[_0xf089('0x14')],_0x249b88);_0x3a78fc(_0x94df4d[_0xf089('0x12')](0x1f4,_0x3268ca[_0xf089('0x14')]));});});}; \ No newline at end of file +var _0x8e94=['error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','update','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','../../config/utils','jayson/promise','client','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8e94,0xf8));var _0x48e9=function(_0x25c92b,_0x41b368){_0x25c92b=_0x25c92b-0x0;var _0xc59d85=_0x8e94[_0x25c92b];return _0xc59d85;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var moment=require('moment');var BPromise=require(_0x48e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48e9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x48e9('0x5'));var client=jayson[_0x48e9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac9d7,_0x58332f,_0x409f7b){return new BPromise(function(_0x50124c,_0x2e3df6){return client[_0x48e9('0x7')](_0x3ac9d7,_0x409f7b)[_0x48e9('0x8')](function(_0x371e53){logger['info'](_0x48e9('0x9'),_0x58332f,_0x48e9('0xa'));logger['debug'](_0x48e9('0xb'),_0x58332f,'request\x20sent',JSON[_0x48e9('0xc')](_0x371e53));if(_0x371e53[_0x48e9('0xd')]){if(_0x371e53[_0x48e9('0xd')][_0x48e9('0xe')]===0x1f4){logger[_0x48e9('0xd')](_0x48e9('0x9'),_0x58332f,_0x371e53['error'][_0x48e9('0xf')]);return _0x2e3df6(_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);}logger['error'](_0x48e9('0x9'),_0x58332f,_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);return _0x50124c(_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);}else{logger[_0x48e9('0x10')](_0x48e9('0x9'),_0x58332f,_0x48e9('0xa'));_0x50124c(_0x371e53[_0x48e9('0x11')][_0x48e9('0xf')]);}})[_0x48e9('0x12')](function(_0x18135a){logger[_0x48e9('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x58332f,_0x18135a);_0x2e3df6(_0x18135a);});});}exports[_0x48e9('0x13')]=function(_0x421508){var _0x2c0c31=this;return new Promise(function(_0x51ab2d,_0xdb0db){return db[_0x48e9('0x14')][_0x48e9('0x15')](_0x421508[_0x48e9('0x16')],{'raw':_0x421508[_0x48e9('0x17')]?_0x421508[_0x48e9('0x17')][_0x48e9('0x18')]===undefined?!![]:![]:!![]})[_0x48e9('0x8')](function(_0x54f07d){logger[_0x48e9('0x10')](_0x48e9('0x13'),_0x421508);logger[_0x48e9('0x19')]('CreateVoiceDialReport',_0x421508,JSON['stringify'](_0x54f07d));_0x51ab2d(_0x54f07d);})[_0x48e9('0x12')](function(_0x5fa95d){logger[_0x48e9('0xd')](_0x48e9('0x13'),_0x5fa95d['message'],_0x421508);_0xdb0db(_0x2c0c31[_0x48e9('0xd')](0x1f4,_0x5fa95d[_0x48e9('0xf')]));});});};exports['UpdateVoiceDialReport']=function(_0x2035dd){var _0x213472=this;return new Promise(function(_0x3047fa,_0x49216a){return db[_0x48e9('0x14')][_0x48e9('0x1a')](_0x2035dd['body'],{'raw':_0x2035dd['options']?_0x2035dd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2035dd[_0x48e9('0x17')]?_0x2035dd[_0x48e9('0x17')]['where']||null:null,'attributes':_0x2035dd[_0x48e9('0x17')]?_0x2035dd[_0x48e9('0x17')]['attributes']||null:null,'limit':_0x2035dd[_0x48e9('0x17')]?_0x2035dd[_0x48e9('0x17')][_0x48e9('0x1b')]||null:null})[_0x48e9('0x8')](function(_0x976ae1){logger['info'](_0x48e9('0x1c'),_0x2035dd);logger[_0x48e9('0x19')]('UpdateVoiceDialReport',_0x2035dd,JSON[_0x48e9('0xc')](_0x976ae1));_0x3047fa(_0x976ae1);})[_0x48e9('0x12')](function(_0x36b27f){logger['error'](_0x48e9('0x1c'),_0x36b27f['message'],_0x2035dd);_0x49216a(_0x213472[_0x48e9('0xd')](0x1f4,_0x36b27f[_0x48e9('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3e30537..97a513c 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 _0xa58f=['addApplications','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated','show','post','create','/:id/applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa58f,0x17f));var _0xfa58=function(_0x4726ba,_0x17a603){_0x4726ba=_0x4726ba-0x0;var _0x17e45d=_0xa58f[_0x4726ba];return _0x17e45d;};'use strict';var multer=require('multer');var util=require(_0xfa58('0x0'));var path=require(_0xfa58('0x1'));var timeout=require(_0xfa58('0x2'));var express=require(_0xfa58('0x3'));var router=express[_0xfa58('0x4')]();var auth=require(_0xfa58('0x5'));var interaction=require(_0xfa58('0x6'));var config=require(_0xfa58('0x7'));var controller=require(_0xfa58('0x8'));router[_0xfa58('0x9')]('/',auth['isAuthenticated'](),controller[_0xfa58('0xa')]);router[_0xfa58('0x9')]('/:id',auth[_0xfa58('0xb')](),controller[_0xfa58('0xc')]);router[_0xfa58('0xd')]('/',auth[_0xfa58('0xb')](),controller[_0xfa58('0xe')]);router[_0xfa58('0xd')](_0xfa58('0xf'),auth[_0xfa58('0xb')](),controller[_0xfa58('0x10')]);router['put'](_0xfa58('0x11'),auth[_0xfa58('0xb')](),controller[_0xfa58('0x12')]);router['delete']('/:id',auth[_0xfa58('0xb')](),controller[_0xfa58('0x13')]);module[_0xfa58('0x14')]=router; \ No newline at end of file +var _0x28f1=['isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','update','destroy','exports','path','express','../../components/interaction/service','./voiceExtension.controller','get'];(function(_0x5e0e90,_0x1c8363){var _0x33cfe3=function(_0x44f842){while(--_0x44f842){_0x5e0e90['push'](_0x5e0e90['shift']());}};_0x33cfe3(++_0x1c8363);}(_0x28f1,0x1db));var _0x128f=function(_0x50e2f0,_0x4197f8){_0x50e2f0=_0x50e2f0-0x0;var _0x3612e1=_0x28f1[_0x50e2f0];return _0x3612e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x128f('0x0'));var timeout=require('connect-timeout');var express=require(_0x128f('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x128f('0x2'));var config=require('../../config/environment');var controller=require(_0x128f('0x3'));router[_0x128f('0x4')]('/',auth[_0x128f('0x5')](),controller[_0x128f('0x6')]);router[_0x128f('0x4')](_0x128f('0x7'),auth[_0x128f('0x5')](),controller[_0x128f('0x8')]);router[_0x128f('0x9')]('/',auth[_0x128f('0x5')](),controller[_0x128f('0xa')]);router['post'](_0x128f('0xb'),auth[_0x128f('0x5')](),controller[_0x128f('0xc')]);router['put'](_0x128f('0x7'),auth[_0x128f('0x5')](),controller[_0x128f('0xd')]);router['delete']('/:id',auth[_0x128f('0x5')](),controller[_0x128f('0xe')]);module[_0x128f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 49a6281..f0e3390 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(_0x44654b,_0x167f38){var _0x423e96=function(_0x17026c){while(--_0x17026c){_0x44654b['push'](_0x44654b['shift']());}};_0x423e96(++_0x167f38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x5a952b,_0x2c673d){var _0x4fe808=function(_0x12f682){while(--_0x12f682){_0x5a952b['push'](_0x5a952b['shift']());}};_0x4fe808(++_0x2c673d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b914b6c..8395360 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 _0xef0f=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x28dae9,_0x41ebe6){var _0x1c9f27=function(_0x35944f){while(--_0x35944f){_0x28dae9['push'](_0x28dae9['shift']());}};_0x1c9f27(++_0x41ebe6);}(_0xef0f,0x168));var _0xfef0=function(_0x3c6c44,_0x3aae67){_0x3c6c44=_0x3c6c44-0x0;var _0x1ecffd=_0xef0f[_0x3c6c44];return _0x1ecffd;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var db=require(_0xfef0('0x19'))['db'];config[_0xfef0('0x1a')]=_['defaults'](config[_0xfef0('0x1a')],{'host':_0xfef0('0x1b'),'port':0x18eb});var socket=require(_0xfef0('0x1c'))(new Redis(config[_0xfef0('0x1a')]));require(_0xfef0('0x1d'))[_0xfef0('0x1e')](socket);function respondWithStatusCode(_0xa9f040,_0x573ae7){_0x573ae7=_0x573ae7||0xcc;return function(_0x3d1f02){if(_0x3d1f02){return _0xa9f040['sendStatus'](_0x573ae7);}return _0xa9f040['status'](_0x573ae7)['end']();};}function respondWithResult(_0x118b8d,_0x284b6d){_0x284b6d=_0x284b6d||0xc8;return function(_0x3510a7){if(_0x3510a7){return _0x118b8d[_0xfef0('0x1f')](_0x284b6d)[_0xfef0('0x20')](_0x3510a7);}};}function respondWithFilteredResult(_0x3f9a6c,_0x155833){return function(_0x2887e6){if(_0x2887e6){var _0x581459=_0x2887e6[_0xfef0('0x21')],_0xd60678=_0x155833[_0xfef0('0x22')],_0x1642cd=_0x155833['offset']+_0x155833[_0xfef0('0x23')],_0x1577fa;if(_0x1642cd>=_0x581459){_0x1642cd=_0x581459;_0x1577fa=0xc8;}else{_0x1577fa=0xce;}_0x3f9a6c['status'](_0x1577fa);return _0x3f9a6c[_0xfef0('0x24')](_0xfef0('0x25'),_0xd60678+'-'+_0x1642cd+'/'+_0x581459)[_0xfef0('0x20')](_0x2887e6);}return null;};}function patchUpdates(_0x48408a){return function(_0x2be956){try{jsonpatch['apply'](_0x2be956,_0x48408a,!![]);}catch(_0x4074b7){return BPromise[_0xfef0('0x26')](_0x4074b7);}return _0x2be956['save']();};}function saveUpdates(_0x4897af,_0x4b8b22){return function(_0x19fde8){if(_0x19fde8){return _0x19fde8['update'](_0x4897af)[_0xfef0('0x27')](function(_0x46b34a){return _0x46b34a;});}return null;};}function removeEntity(_0x1a8d66,_0x4483f2){return function(_0x249fe4){if(_0x249fe4){return _0x249fe4[_0xfef0('0x28')]()['then'](function(){var _0x4ac8c5=_0x249fe4[_0xfef0('0x29')]({'plain':!![]});var _0x1ffaa4=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b'),'ignore':![]},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d'),'ignore':![]},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f'),'ignore':![]}];var _0x391279=_(_0x1ffaa4)['filter'](_0xfef0('0x30'))[_0xfef0('0x31')](_0xfef0('0x32'))[_0xfef0('0x32')]();if(_[_0xfef0('0x33')](_0x391279,_0x4ac8c5[_0xfef0('0x34')])){return;}var _0x3e3c4c=_[_0xfef0('0x35')](_0x1ffaa4,[_0xfef0('0x32'),_0x4ac8c5[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x37')]['destroy']({'where':{'type':_0x3e3c4c,'resourceId':_0x4ac8c5['id']}})[_0xfef0('0x27')](function(){return _0x249fe4;});})['then'](function(){_0x1a8d66['status'](0xcc)[_0xfef0('0x38')]();});}};}function handleEntityNotFound(_0x2ae54a,_0x4a481d){return function(_0x4bbdba){if(!_0x4bbdba){_0x2ae54a['sendStatus'](0x194);}return _0x4bbdba;};}function handleError(_0x4f65cd,_0x4cce8a){_0x4cce8a=_0x4cce8a||0x1f4;return function(_0x417535){logger[_0xfef0('0x39')](_0x417535[_0xfef0('0x3a')]);if(_0x417535['name']){delete _0x417535['name'];}_0x4f65cd['status'](_0x4cce8a)[_0xfef0('0x3b')](_0x417535);};}exports['index']=function(_0x215032,_0x3783f9){var _0x1b9f39={},_0x4a2773={},_0x3cad13={'count':0x0,'rows':[]};var _0x4c3a0f=_[_0xfef0('0x31')](db[_0xfef0('0x3c')][_0xfef0('0x3d')],function(_0xe5188e){return{'name':_0xe5188e[_0xfef0('0x3e')],'type':_0xe5188e[_0xfef0('0x34')][_0xfef0('0x3f')]};});_0x4a2773[_0xfef0('0x40')]=_['map'](_0x4c3a0f,_0xfef0('0x36'));_0x4a2773[_0xfef0('0x41')]=_[_0xfef0('0x42')](_0x215032[_0xfef0('0x41')]);_0x4a2773[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],_0x4a2773[_0xfef0('0x41')]);_0x1b9f39[_0xfef0('0x45')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],qs[_0xfef0('0x46')](_0x215032[_0xfef0('0x41')]['fields']));_0x1b9f39[_0xfef0('0x45')]=_0x1b9f39['attributes'][_0xfef0('0x47')]?_0x1b9f39[_0xfef0('0x45')]:_0x4a2773[_0xfef0('0x40')];if(!_0x215032['query'][_0xfef0('0x48')](_0xfef0('0x49'))){_0x1b9f39[_0xfef0('0x23')]=qs['limit'](_0x215032[_0xfef0('0x41')][_0xfef0('0x23')]);_0x1b9f39[_0xfef0('0x22')]=qs['offset'](_0x215032[_0xfef0('0x41')]['offset']);}_0x1b9f39['order']=qs[_0xfef0('0x4a')](_0x215032['query']['sort']);_0x1b9f39[_0xfef0('0x4b')]=qs[_0xfef0('0x43')](_[_0xfef0('0x4c')](_0x215032[_0xfef0('0x41')],_0x4a2773[_0xfef0('0x43')]),_0x4c3a0f);if(_0x215032[_0xfef0('0x41')]['filter']){_0x1b9f39[_0xfef0('0x4b')]=_[_0xfef0('0x4d')](_0x1b9f39['where'],{'$or':_['map'](_0x4c3a0f,function(_0x1d554e){if(_0x1d554e['type']!==_0xfef0('0x4e')){var _0x22c940={};_0x22c940[_0x1d554e[_0xfef0('0x36')]]={'$like':'%'+_0x215032[_0xfef0('0x41')][_0xfef0('0x4f')]+'%'};return _0x22c940;}})});}_0x1b9f39=_[_0xfef0('0x4d')]({},_0x1b9f39,_0x215032[_0xfef0('0x50')]);var _0x15b4a6={'where':_0x1b9f39['where']};return db[_0xfef0('0x3c')]['count'](_0x15b4a6)['then'](function(_0x18c656){_0x3cad13[_0xfef0('0x21')]=_0x18c656;if(_0x215032['query'][_0xfef0('0x51')]){_0x1b9f39['include']=[{'all':!![]}];}return db[_0xfef0('0x3c')][_0xfef0('0x52')](_0x1b9f39);})[_0xfef0('0x27')](function(_0x115e64){_0x3cad13['rows']=_0x115e64;return _0x3cad13;})[_0xfef0('0x27')](respondWithFilteredResult(_0x3783f9,_0x1b9f39))[_0xfef0('0x53')](handleError(_0x3783f9,null));};exports['show']=function(_0x4cafd1,_0x392607){var _0x4f3231={'raw':![],'where':{'id':_0x4cafd1[_0xfef0('0x54')]['id']}},_0x32392a={};_0x32392a[_0xfef0('0x40')]=_[_0xfef0('0x42')](db[_0xfef0('0x3c')][_0xfef0('0x3d')]);_0x32392a['query']=_[_0xfef0('0x42')](_0x4cafd1['query']);_0x32392a['filters']=_[_0xfef0('0x44')](_0x32392a[_0xfef0('0x40')],_0x32392a[_0xfef0('0x41')]);_0x4f3231['attributes']=_[_0xfef0('0x44')](_0x32392a['model'],qs['fields'](_0x4cafd1['query'][_0xfef0('0x46')]));_0x4f3231[_0xfef0('0x45')]=_0x4f3231[_0xfef0('0x45')][_0xfef0('0x47')]?_0x4f3231[_0xfef0('0x45')]:_0x32392a[_0xfef0('0x40')];if(_0x4cafd1[_0xfef0('0x41')][_0xfef0('0x51')]){_0x4f3231[_0xfef0('0x55')]=[{'all':!![]}];}_0x4f3231=_['merge']({},_0x4f3231,_0x4cafd1['options']);return db[_0xfef0('0x3c')][_0xfef0('0x35')](_0x4f3231)[_0xfef0('0x27')](handleEntityNotFound(_0x392607,null))[_0xfef0('0x27')](respondWithResult(_0x392607,null))[_0xfef0('0x53')](handleError(_0x392607,null));};exports[_0xfef0('0x28')]=function(_0x1ec15d,_0x20b647){return db['VoiceExtension'][_0xfef0('0x35')]({'where':{'id':_0x1ec15d[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0x20b647,null))[_0xfef0('0x27')](removeEntity(_0x20b647,null))[_0xfef0('0x53')](handleError(_0x20b647,null));};exports['create']=function(_0x5b3592,_0x523763){if(_0x5b3592[_0xfef0('0x56')][_0xfef0('0x34')]===_0xfef0('0x2d')&&!_[_0xfef0('0x57')](_0x5b3592['body'][_0xfef0('0x58')],'_')){_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]='_'[_0xfef0('0x59')](_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]);}return db[_0xfef0('0x3c')]['create'](_0x5b3592[_0xfef0('0x56')],{'raw':![]})[_0xfef0('0x27')](function(_0x47f17a){var _0x291f3f=_0x5b3592['user'][_0xfef0('0x29')]({'plain':!![]});if(!_0x291f3f)throw new Error(_0xfef0('0x5a'));if(_0x291f3f['role']===_0xfef0('0x5b')){var _0x49ec3c=_0x47f17a['get']({'plain':!![]});var _0x4812c7=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b')},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d')},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f')}];var _0x5b5664=_[_0xfef0('0x35')](_0x4812c7,[_0xfef0('0x32'),_0x49ec3c[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x5c')]['find']({'where':{'name':_0x5b5664,'userProfileId':_0x291f3f[_0xfef0('0x5d')]},'raw':!![]})['then'](function(_0x135653){if(_0x135653&&_0x135653['autoAssociation']===0x0){return db[_0xfef0('0x37')][_0xfef0('0x5e')]({'name':_0x49ec3c[_0xfef0('0x36')],'resourceId':_0x49ec3c['id'],'type':_0x135653[_0xfef0('0x36')],'sectionId':_0x135653['id']},{})[_0xfef0('0x27')](function(){return _0x47f17a;});}else{return _0x47f17a;}})['catch'](function(_0x2abdb7){logger['error'](_0xfef0('0x5f'),_0x2abdb7);throw _0x2abdb7;});}return _0x47f17a;})[_0xfef0('0x27')](respondWithResult(_0x523763,0xc9))['catch'](handleError(_0x523763,null));};exports[_0xfef0('0x60')]=function(_0x3c5640,_0xd6de4d){if(_0x3c5640[_0xfef0('0x56')]['id']){delete _0x3c5640[_0xfef0('0x56')]['id'];}return db[_0xfef0('0x3c')][_0xfef0('0x35')]({'where':{'id':_0x3c5640[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0xd6de4d,null))[_0xfef0('0x27')](function(_0x2acb4e){if(_0x2acb4e){return db[_0xfef0('0x3c')]['update'](_[_0xfef0('0x4c')](_0x3c5640[_0xfef0('0x56')],[_0xfef0('0x58'),_0xfef0('0x61'),_0xfef0('0x62'),'recordingFormat',_0xfef0('0x63'),_0xfef0('0x64')]),{'where':{'context':_0x2acb4e[_0xfef0('0x61')],'exten':_0x2acb4e[_0xfef0('0x58')]},'individualHooks':!![]})[_0xfef0('0x27')](function(_0x1765e2){return _0x1765e2;});}return null;})[_0xfef0('0x27')](respondWithStatusCode(_0xd6de4d,null))[_0xfef0('0x53')](handleError(_0xd6de4d,null));};exports[_0xfef0('0x65')]=function(_0x3f26d9,_0x4f7ad3,_0x100c6a){return db['VoiceExtension'][_0xfef0('0x66')]({'where':{'id':_0x3f26d9[_0xfef0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7ad3,null))[_0xfef0('0x27')](function(_0x20c2ec){if(_0x20c2ec){return db[_0xfef0('0x67')][_0xfef0('0x68')](function(_0x1e0ad5){return db['VoiceExtension'][_0xfef0('0x28')]({'where':{'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'transaction':_0x1e0ad5})[_0xfef0('0x27')](function(_0x4f0737){var _0x117b74=_[_0xfef0('0x31')](_0x3f26d9[_0xfef0('0x56')],function(_0x6f759a){_0x6f759a[_0xfef0('0x69')]=_0x3f26d9[_0xfef0('0x54')]['id'];return _0x6f759a;});return db[_0xfef0('0x3c')]['bulkCreate'](_0x117b74,{'transaction':_0x1e0ad5});});})[_0xfef0('0x27')](function(){return db[_0xfef0('0x3c')][_0xfef0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'order':_0xfef0('0x6b')});});}})[_0xfef0('0x27')](respondWithResult(_0x4f7ad3,null))['catch'](handleError(_0x4f7ad3,null));}; \ No newline at end of file +var _0xc2c7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','params','intersection','merge','catch','startsWith','exten','concat','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x1a107f,_0xea772b){var _0x443fda=function(_0x411f45){while(--_0x411f45){_0x1a107f['push'](_0x1a107f['shift']());}};_0x443fda(++_0xea772b);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1f95df,_0x297772){_0x1f95df=_0x1f95df-0x0;var _0xda32c3=_0xc2c7[_0x1f95df];return _0xda32c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c2c('0x0'));var rimraf=require(_0x7c2c('0x1'));var zipdir=require(_0x7c2c('0x2'));var jsonpatch=require(_0x7c2c('0x3'));var rp=require(_0x7c2c('0x4'));var moment=require(_0x7c2c('0x5'));var BPromise=require(_0x7c2c('0x6'));var Mustache=require(_0x7c2c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7c2c('0x8'));var csv=require(_0x7c2c('0x9'));var ejs=require(_0x7c2c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x9'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var db=require(_0x7c2c('0x17'))['db'];config[_0x7c2c('0x18')]=_[_0x7c2c('0x19')](config[_0x7c2c('0x18')],{'host':_0x7c2c('0x1a'),'port':0x18eb});var socket=require(_0x7c2c('0x1b'))(new Redis(config[_0x7c2c('0x18')]));require(_0x7c2c('0x1c'))['register'](socket);function respondWithStatusCode(_0x5b5729,_0x102778){_0x102778=_0x102778||0xcc;return function(_0xd1a3db){if(_0xd1a3db){return _0x5b5729[_0x7c2c('0x1d')](_0x102778);}return _0x5b5729['status'](_0x102778)[_0x7c2c('0x1e')]();};}function respondWithResult(_0x206ecd,_0x5e55e0){_0x5e55e0=_0x5e55e0||0xc8;return function(_0x88f54b){if(_0x88f54b){return _0x206ecd['status'](_0x5e55e0)[_0x7c2c('0x1f')](_0x88f54b);}};}function respondWithFilteredResult(_0x51b73c,_0x342ea2){return function(_0x3c948a){if(_0x3c948a){var _0x14453f=_0x3c948a[_0x7c2c('0x20')],_0x2a9539=_0x342ea2[_0x7c2c('0x21')],_0x17df4a=_0x342ea2[_0x7c2c('0x21')]+_0x342ea2[_0x7c2c('0x22')],_0x26be0f;if(_0x17df4a>=_0x14453f){_0x17df4a=_0x14453f;_0x26be0f=0xc8;}else{_0x26be0f=0xce;}_0x51b73c[_0x7c2c('0x23')](_0x26be0f);return _0x51b73c[_0x7c2c('0x24')]('Content-Range',_0x2a9539+'-'+_0x17df4a+'/'+_0x14453f)[_0x7c2c('0x1f')](_0x3c948a);}return null;};}function patchUpdates(_0x4adb62){return function(_0x506d47){try{jsonpatch[_0x7c2c('0x25')](_0x506d47,_0x4adb62,!![]);}catch(_0x3a71d7){return BPromise[_0x7c2c('0x26')](_0x3a71d7);}return _0x506d47[_0x7c2c('0x27')]();};}function saveUpdates(_0x41552f,_0x1883b5){return function(_0xa84620){if(_0xa84620){return _0xa84620['update'](_0x41552f)[_0x7c2c('0x28')](function(_0x4dedd8){return _0x4dedd8;});}return null;};}function removeEntity(_0x302c93,_0x57f510){return function(_0x3d4387){if(_0x3d4387){return _0x3d4387[_0x7c2c('0x29')]()[_0x7c2c('0x28')](function(){var _0x481867=_0x3d4387['get']({'plain':!![]});var _0x31a50c=[{'name':_0x7c2c('0x2a'),'value':_0x7c2c('0x2b'),'ignore':![]},{'name':_0x7c2c('0x2c'),'value':_0x7c2c('0x2d'),'ignore':![]},{'name':_0x7c2c('0x2e'),'value':_0x7c2c('0x2f'),'ignore':![]}];var _0x4b1dd0=_(_0x31a50c)[_0x7c2c('0x30')](_0x7c2c('0x31'))[_0x7c2c('0x32')](_0x7c2c('0x33'))[_0x7c2c('0x33')]();if(_[_0x7c2c('0x34')](_0x4b1dd0,_0x481867[_0x7c2c('0x35')])){return;}var _0x26f472=_[_0x7c2c('0x36')](_0x31a50c,['value',_0x481867[_0x7c2c('0x35')]])[_0x7c2c('0x37')];return db[_0x7c2c('0x38')][_0x7c2c('0x29')]({'where':{'type':_0x26f472,'resourceId':_0x481867['id']}})['then'](function(){return _0x3d4387;});})[_0x7c2c('0x28')](function(){_0x302c93[_0x7c2c('0x23')](0xcc)[_0x7c2c('0x1e')]();});}};}function handleEntityNotFound(_0x1ef88b,_0x1859c2){return function(_0x3ad837){if(!_0x3ad837){_0x1ef88b[_0x7c2c('0x1d')](0x194);}return _0x3ad837;};}function handleError(_0x57af44,_0x1969f4){_0x1969f4=_0x1969f4||0x1f4;return function(_0x1acf75){logger[_0x7c2c('0x39')](_0x1acf75[_0x7c2c('0x3a')]);if(_0x1acf75[_0x7c2c('0x37')]){delete _0x1acf75['name'];}_0x57af44['status'](_0x1969f4)[_0x7c2c('0x3b')](_0x1acf75);};}exports['index']=function(_0x4b97bb,_0x15ee13){var _0x31b1f2={},_0x199b13={},_0x156c03={'count':0x0,'rows':[]};var _0x536dcf=_[_0x7c2c('0x32')](db[_0x7c2c('0x3c')][_0x7c2c('0x3d')],function(_0x19783d){return{'name':_0x19783d[_0x7c2c('0x3e')],'type':_0x19783d[_0x7c2c('0x35')][_0x7c2c('0x3f')]};});_0x199b13[_0x7c2c('0x40')]=_[_0x7c2c('0x32')](_0x536dcf,_0x7c2c('0x37'));_0x199b13[_0x7c2c('0x41')]=_[_0x7c2c('0x42')](_0x4b97bb[_0x7c2c('0x41')]);_0x199b13['filters']=_['intersection'](_0x199b13[_0x7c2c('0x40')],_0x199b13['query']);_0x31b1f2['attributes']=_['intersection'](_0x199b13[_0x7c2c('0x40')],qs[_0x7c2c('0x43')](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x43')]));_0x31b1f2[_0x7c2c('0x44')]=_0x31b1f2[_0x7c2c('0x44')][_0x7c2c('0x45')]?_0x31b1f2[_0x7c2c('0x44')]:_0x199b13[_0x7c2c('0x40')];if(!_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x46')]('nolimit')){_0x31b1f2['limit']=qs[_0x7c2c('0x22')](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x22')]);_0x31b1f2[_0x7c2c('0x21')]=qs['offset'](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x21')]);}_0x31b1f2[_0x7c2c('0x47')]=qs[_0x7c2c('0x48')](_0x4b97bb[_0x7c2c('0x41')][_0x7c2c('0x48')]);_0x31b1f2[_0x7c2c('0x49')]=qs[_0x7c2c('0x4a')](_[_0x7c2c('0x4b')](_0x4b97bb['query'],_0x199b13[_0x7c2c('0x4a')]),_0x536dcf);if(_0x4b97bb['query'][_0x7c2c('0x30')]){_0x31b1f2[_0x7c2c('0x49')]=_['merge'](_0x31b1f2[_0x7c2c('0x49')],{'$or':_['map'](_0x536dcf,function(_0x3014fb){if(_0x3014fb[_0x7c2c('0x35')]!==_0x7c2c('0x4c')){var _0x26351e={};_0x26351e[_0x3014fb['name']]={'$like':'%'+_0x4b97bb[_0x7c2c('0x41')]['filter']+'%'};return _0x26351e;}})});}_0x31b1f2=_['merge']({},_0x31b1f2,_0x4b97bb[_0x7c2c('0x4d')]);var _0xd0a1d3={'where':_0x31b1f2[_0x7c2c('0x49')]};return db['VoiceExtension'][_0x7c2c('0x20')](_0xd0a1d3)[_0x7c2c('0x28')](function(_0x5a1c93){_0x156c03[_0x7c2c('0x20')]=_0x5a1c93;if(_0x4b97bb['query'][_0x7c2c('0x4e')]){_0x31b1f2[_0x7c2c('0x4f')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x31b1f2);})[_0x7c2c('0x28')](function(_0x1c7c2b){_0x156c03['rows']=_0x1c7c2b;return _0x156c03;})[_0x7c2c('0x28')](respondWithFilteredResult(_0x15ee13,_0x31b1f2))['catch'](handleError(_0x15ee13,null));};exports['show']=function(_0x1e3e31,_0x2ca193){var _0x45bda3={'raw':![],'where':{'id':_0x1e3e31[_0x7c2c('0x50')]['id']}},_0x2dbfc8={};_0x2dbfc8[_0x7c2c('0x40')]=_[_0x7c2c('0x42')](db[_0x7c2c('0x3c')][_0x7c2c('0x3d')]);_0x2dbfc8['query']=_['keys'](_0x1e3e31[_0x7c2c('0x41')]);_0x2dbfc8[_0x7c2c('0x4a')]=_[_0x7c2c('0x51')](_0x2dbfc8['model'],_0x2dbfc8['query']);_0x45bda3[_0x7c2c('0x44')]=_[_0x7c2c('0x51')](_0x2dbfc8[_0x7c2c('0x40')],qs[_0x7c2c('0x43')](_0x1e3e31['query']['fields']));_0x45bda3['attributes']=_0x45bda3[_0x7c2c('0x44')][_0x7c2c('0x45')]?_0x45bda3[_0x7c2c('0x44')]:_0x2dbfc8[_0x7c2c('0x40')];if(_0x1e3e31[_0x7c2c('0x41')]['includeAll']){_0x45bda3[_0x7c2c('0x4f')]=[{'all':!![]}];}_0x45bda3=_[_0x7c2c('0x52')]({},_0x45bda3,_0x1e3e31['options']);return db[_0x7c2c('0x3c')]['find'](_0x45bda3)[_0x7c2c('0x28')](handleEntityNotFound(_0x2ca193,null))[_0x7c2c('0x28')](respondWithResult(_0x2ca193,null))[_0x7c2c('0x53')](handleError(_0x2ca193,null));};exports['destroy']=function(_0x5835cd,_0x327f3a){return db['VoiceExtension'][_0x7c2c('0x36')]({'where':{'id':_0x5835cd[_0x7c2c('0x50')]['id']}})['then'](handleEntityNotFound(_0x327f3a,null))[_0x7c2c('0x28')](removeEntity(_0x327f3a,null))[_0x7c2c('0x53')](handleError(_0x327f3a,null));};exports['create']=function(_0x25e278,_0x5d4d02){if(_0x25e278['body'][_0x7c2c('0x35')]===_0x7c2c('0x2d')&&!_[_0x7c2c('0x54')](_0x25e278['body'][_0x7c2c('0x55')],'_')){_0x25e278['body'][_0x7c2c('0x55')]='_'[_0x7c2c('0x56')](_0x25e278['body'][_0x7c2c('0x55')]);}return db[_0x7c2c('0x3c')][_0x7c2c('0x57')](_0x25e278[_0x7c2c('0x58')],{'raw':![]})['then'](function(_0xaa7a47){var _0x330be6=_0x25e278['user'][_0x7c2c('0x59')]({'plain':!![]});if(!_0x330be6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x330be6[_0x7c2c('0x5a')]===_0x7c2c('0x5b')){var _0x26b557=_0xaa7a47[_0x7c2c('0x59')]({'plain':!![]});var _0x35fcba=[{'name':'InboundRoutes','value':_0x7c2c('0x2b')},{'name':_0x7c2c('0x2c'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x1da746=_['find'](_0x35fcba,[_0x7c2c('0x33'),_0x26b557['type']])[_0x7c2c('0x37')];return db[_0x7c2c('0x5c')][_0x7c2c('0x36')]({'where':{'name':_0x1da746,'userProfileId':_0x330be6[_0x7c2c('0x5d')]},'raw':!![]})[_0x7c2c('0x28')](function(_0x1ee34d){if(_0x1ee34d&&_0x1ee34d[_0x7c2c('0x5e')]===0x0){return db[_0x7c2c('0x38')]['create']({'name':_0x26b557['name'],'resourceId':_0x26b557['id'],'type':_0x1ee34d['name'],'sectionId':_0x1ee34d['id']},{})[_0x7c2c('0x28')](function(){return _0xaa7a47;});}else{return _0xaa7a47;}})[_0x7c2c('0x53')](function(_0x233e9c){logger[_0x7c2c('0x39')](_0x7c2c('0x5f'),_0x233e9c);throw _0x233e9c;});}return _0xaa7a47;})[_0x7c2c('0x28')](respondWithResult(_0x5d4d02,0xc9))[_0x7c2c('0x53')](handleError(_0x5d4d02,null));};exports[_0x7c2c('0x60')]=function(_0x4c50c8,_0x54990d){if(_0x4c50c8[_0x7c2c('0x58')]['id']){delete _0x4c50c8[_0x7c2c('0x58')]['id'];}return db['VoiceExtension'][_0x7c2c('0x36')]({'where':{'id':_0x4c50c8['params']['id']}})['then'](handleEntityNotFound(_0x54990d,null))[_0x7c2c('0x28')](function(_0x118728){if(_0x118728){return db[_0x7c2c('0x3c')][_0x7c2c('0x60')](_[_0x7c2c('0x4b')](_0x4c50c8[_0x7c2c('0x58')],[_0x7c2c('0x55'),_0x7c2c('0x61'),_0x7c2c('0x62'),_0x7c2c('0x63'),_0x7c2c('0x64'),_0x7c2c('0x65')]),{'where':{'context':_0x118728[_0x7c2c('0x61')],'exten':_0x118728[_0x7c2c('0x55')]},'individualHooks':!![]})['then'](function(_0x1af153){return _0x1af153;});}return null;})['then'](respondWithStatusCode(_0x54990d,null))['catch'](handleError(_0x54990d,null));};exports['addApplications']=function(_0x4c0d0f,_0x719aa4,_0x34984b){return db[_0x7c2c('0x3c')][_0x7c2c('0x66')]({'where':{'id':_0x4c0d0f[_0x7c2c('0x50')]['id']}})[_0x7c2c('0x28')](handleEntityNotFound(_0x719aa4,null))['then'](function(_0x26fea7){if(_0x26fea7){return db[_0x7c2c('0x67')][_0x7c2c('0x68')](function(_0x21c5ff){return db[_0x7c2c('0x3c')][_0x7c2c('0x29')]({'where':{'VoiceExtensionId':_0x4c0d0f['params']['id']},'transaction':_0x21c5ff})[_0x7c2c('0x28')](function(_0x1935bf){var _0x49872b=_[_0x7c2c('0x32')](_0x4c0d0f[_0x7c2c('0x58')],function(_0x53e81e){_0x53e81e[_0x7c2c('0x69')]=_0x4c0d0f[_0x7c2c('0x50')]['id'];return _0x53e81e;});return db['VoiceExtension']['bulkCreate'](_0x49872b,{'transaction':_0x21c5ff});});})[_0x7c2c('0x28')](function(){return db['VoiceExtension'][_0x7c2c('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4c0d0f['params']['id']},'order':_0x7c2c('0x6b')});});}})[_0x7c2c('0x28')](respondWithResult(_0x719aa4,null))['catch'](handleError(_0x719aa4,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a0ddeee..f9de119 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 _0xd6b9=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension'];(function(_0x1939e1,_0x386ccc){var _0x852e36=function(_0x5400a7){while(--_0x5400a7){_0x1939e1['push'](_0x1939e1['shift']());}};_0x852e36(++_0x386ccc);}(_0xd6b9,0xee));var _0x9d6b=function(_0x1c1483,_0x344989){_0x1c1483=_0x1c1483-0x0;var _0x435d4d=_0xd6b9[_0x1c1483];return _0x435d4d;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9d6b('0x0'))['db'][_0x9d6b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9d6b('0x2')](0x0);var events={'afterCreate':_0x9d6b('0x3'),'afterUpdate':_0x9d6b('0x4'),'afterDestroy':_0x9d6b('0x5')};function emitEvent(_0x272069){return function(_0xfde96b,_0x12ffb3,_0x285775){VoiceExtensionEvents[_0x9d6b('0x6')](_0x272069+':'+_0xfde96b['id'],_0xfde96b);VoiceExtensionEvents[_0x9d6b('0x6')](_0x272069,_0xfde96b);_0x285775(null);};}for(var e in events){if(events[_0x9d6b('0x7')](e)){var event=events[e];VoiceExtension[_0x9d6b('0x8')](e,emitEvent(event));}}module[_0x9d6b('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x84bb=['../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x20830b,_0x3c5859){var _0x2bc4af=function(_0x5980f8){while(--_0x5980f8){_0x20830b['push'](_0x20830b['shift']());}};_0x2bc4af(++_0x3c5859);}(_0x84bb,0x1d7));var _0xb84b=function(_0x26f68f,_0x125079){_0x26f68f=_0x26f68f-0x0;var _0x3047dd=_0x84bb[_0x26f68f];return _0x3047dd;};'use strict';var EventEmitter=require(_0xb84b('0x0'));var VoiceExtension=require(_0xb84b('0x1'))['db'][_0xb84b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb84b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb84b('0x4')};function emitEvent(_0x3213c8){return function(_0x257657,_0x112af5,_0x2136e3){VoiceExtensionEvents[_0xb84b('0x5')](_0x3213c8+':'+_0x257657['id'],_0x257657);VoiceExtensionEvents[_0xb84b('0x5')](_0x3213c8,_0x257657);_0x2136e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb84b('0x6')](e,emitEvent(event));}}module[_0xb84b('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 832a88f..fd46470 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 _0x0b0e=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x332cca,_0x27d1ee){var _0xe67530=function(_0x12fa75){while(--_0x12fa75){_0x332cca['push'](_0x332cca['shift']());}};_0xe67530(++_0x27d1ee);}(_0x0b0e,0x187));var _0xe0b0=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x0b0e[_0x16cb03];return _0x10944e;};'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')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceExtension.attributes'];(function(_0x585ba0,_0x2836e3){var _0xa4e968=function(_0x4ff9a6){while(--_0x4ff9a6){_0x585ba0['push'](_0x585ba0['shift']());}};_0xa4e968(++_0x2836e3);}(_0x2ef3,0xba));var _0x32ef=function(_0x12f457,_0xa9b466){_0x12f457=_0x12f457-0x0;var _0x596059=_0x2ef3[_0x12f457];return _0x596059;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 30bd38b..0e77703 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 _0x2d76=['util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','debug','lodash'];(function(_0x47c60a,_0x433c7f){var _0x2d1a3d=function(_0x250f35){while(--_0x250f35){_0x47c60a['push'](_0x47c60a['shift']());}};_0x2d1a3d(++_0x433c7f);}(_0x2d76,0x1a1));var _0x62d7=function(_0x4f027d,_0x3f9587){_0x4f027d=_0x4f027d-0x0;var _0xc46890=_0x2d76[_0x4f027d];return _0xc46890;};'use strict';var _=require(_0x62d7('0x0'));var util=require(_0x62d7('0x1'));var moment=require('moment');var BPromise=require(_0x62d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62d7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x62d7('0x4'))(_0x62d7('0x5'));var config=require(_0x62d7('0x6'));var jayson=require(_0x62d7('0x7'));var client=jayson[_0x62d7('0x8')][_0x62d7('0x9')]({'port':0x232a});config[_0x62d7('0xa')]=_[_0x62d7('0xb')](config[_0x62d7('0xa')],{'host':_0x62d7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62d7('0xa')]));require(_0x62d7('0xd'))[_0x62d7('0xe')](socket);function respondWithRpcPromise(_0x2a7f16,_0x2d0170,_0xe77f7e){return new BPromise(function(_0x56562f,_0x15a547){return client[_0x62d7('0xf')](_0x2a7f16,_0xe77f7e)[_0x62d7('0x10')](function(_0x3f8b0a){logger[_0x62d7('0x11')](_0x62d7('0x12'),_0x2d0170,'request\x20sent');logger['debug'](_0x62d7('0x13'),_0x2d0170,_0x62d7('0x14'),JSON[_0x62d7('0x15')](_0x3f8b0a));if(_0x3f8b0a[_0x62d7('0x16')]){if(_0x3f8b0a[_0x62d7('0x16')]['code']===0x1f4){logger[_0x62d7('0x16')](_0x62d7('0x12'),_0x2d0170,_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);return _0x15a547(_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2d0170,_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);return _0x56562f(_0x3f8b0a[_0x62d7('0x16')][_0x62d7('0x17')]);}else{logger[_0x62d7('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x2d0170,'request\x20sent');_0x56562f(_0x3f8b0a[_0x62d7('0x18')]['message']);}})[_0x62d7('0x19')](function(_0x61252c){logger[_0x62d7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x2d0170,_0x61252c);_0x15a547(_0x61252c);});});}exports['GetVoiceExtension']=function(_0x501a09){var _0x38d11b=this;return new Promise(function(_0x1b0866,_0x3584d2){return db[_0x62d7('0x1a')][_0x62d7('0x1b')]({'raw':_0x501a09['options']?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x1d')]===undefined?!![]:![]:!![],'where':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x1e')]||null:null,'attributes':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x1f')]||null:null,'limit':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x20')]||null:null,'include':_0x501a09[_0x62d7('0x1c')]?_0x501a09[_0x62d7('0x1c')][_0x62d7('0x21')]?_[_0x62d7('0x22')](_0x501a09[_0x62d7('0x1c')][_0x62d7('0x21')],function(_0x32fceb){return{'model':db[_0x32fceb[_0x62d7('0x23')]],'as':_0x32fceb['as'],'attributes':_0x32fceb[_0x62d7('0x1f')],'include':_0x32fceb['include']?_[_0x62d7('0x22')](_0x32fceb[_0x62d7('0x21')],function(_0x273f49){return{'model':db[_0x273f49[_0x62d7('0x23')]],'as':_0x273f49['as'],'attributes':_0x273f49[_0x62d7('0x1f')],'include':_0x273f49[_0x62d7('0x21')]?_[_0x62d7('0x22')](_0x273f49['include'],function(_0x56e4b9){return{'model':db[_0x56e4b9['model']],'as':_0x56e4b9['as'],'attributes':_0x56e4b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x62d7('0x10')](function(_0x59997d){logger[_0x62d7('0x11')](_0x62d7('0x24'),_0x501a09);logger[_0x62d7('0x25')](_0x62d7('0x24'),_0x501a09,JSON[_0x62d7('0x15')](_0x59997d));_0x1b0866(_0x59997d);})[_0x62d7('0x19')](function(_0x4602bd){logger[_0x62d7('0x16')](_0x62d7('0x24'),_0x4602bd[_0x62d7('0x17')],_0x501a09);_0x3584d2(_0x38d11b['error'](0x1f4,_0x4602bd[_0x62d7('0x17')]));});});}; \ No newline at end of file +var _0x6f1f=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','catch','lodash'];(function(_0x4159e9,_0x1714ff){var _0x30a9ae=function(_0x47465a){while(--_0x47465a){_0x4159e9['push'](_0x4159e9['shift']());}};_0x30a9ae(++_0x1714ff);}(_0x6f1f,0x185));var _0xf6f1=function(_0xf0dbc3,_0x52926f){_0xf0dbc3=_0xf0dbc3-0x0;var _0xa95a79=_0x6f1f[_0xf0dbc3];return _0xa95a79;};'use strict';var _=require(_0xf6f1('0x0'));var util=require(_0xf6f1('0x1'));var moment=require(_0xf6f1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf6f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf6f1('0x4'));var logger=require(_0xf6f1('0x5'))(_0xf6f1('0x6'));var config=require('../../config/environment');var jayson=require(_0xf6f1('0x7'));var client=jayson[_0xf6f1('0x8')][_0xf6f1('0x9')]({'port':0x232a});config[_0xf6f1('0xa')]=_[_0xf6f1('0xb')](config['redis'],{'host':_0xf6f1('0xc'),'port':0x18eb});var socket=require(_0xf6f1('0xd'))(new Redis(config[_0xf6f1('0xa')]));require(_0xf6f1('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d18e0,_0x2db8ed,_0x3f6d1f){return new BPromise(function(_0x593e94,_0x447539){return client[_0xf6f1('0xf')](_0x5d18e0,_0x3f6d1f)[_0xf6f1('0x10')](function(_0x468453){logger[_0xf6f1('0x11')](_0xf6f1('0x12'),_0x2db8ed,_0xf6f1('0x13'));logger[_0xf6f1('0x14')](_0xf6f1('0x15'),_0x2db8ed,'request\x20sent',JSON[_0xf6f1('0x16')](_0x468453));if(_0x468453[_0xf6f1('0x17')]){if(_0x468453[_0xf6f1('0x17')][_0xf6f1('0x18')]===0x1f4){logger[_0xf6f1('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x2db8ed,_0x468453['error'][_0xf6f1('0x19')]);return _0x447539(_0x468453[_0xf6f1('0x17')][_0xf6f1('0x19')]);}logger[_0xf6f1('0x17')](_0xf6f1('0x12'),_0x2db8ed,_0x468453[_0xf6f1('0x17')]['message']);return _0x593e94(_0x468453[_0xf6f1('0x17')]['message']);}else{logger[_0xf6f1('0x11')](_0xf6f1('0x12'),_0x2db8ed,_0xf6f1('0x13'));_0x593e94(_0x468453[_0xf6f1('0x1a')][_0xf6f1('0x19')]);}})['catch'](function(_0x49747a){logger[_0xf6f1('0x17')](_0xf6f1('0x12'),_0x2db8ed,_0x49747a);_0x447539(_0x49747a);});});}exports[_0xf6f1('0x1b')]=function(_0x30d6f2){var _0x4fbf70=this;return new Promise(function(_0x5fcdab,_0x1c5d9e){return db[_0xf6f1('0x1c')][_0xf6f1('0x1d')]({'raw':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x1f')]===undefined?!![]:![]:!![],'where':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x20')]||null:null,'attributes':_0x30d6f2['options']?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x21')]||null:null,'limit':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x22')]||null:null,'include':_0x30d6f2[_0xf6f1('0x1e')]?_0x30d6f2[_0xf6f1('0x1e')]['include']?_[_0xf6f1('0x23')](_0x30d6f2[_0xf6f1('0x1e')][_0xf6f1('0x24')],function(_0x499828){return{'model':db[_0x499828['model']],'as':_0x499828['as'],'attributes':_0x499828['attributes'],'include':_0x499828[_0xf6f1('0x24')]?_[_0xf6f1('0x23')](_0x499828[_0xf6f1('0x24')],function(_0x2d6a76){return{'model':db[_0x2d6a76['model']],'as':_0x2d6a76['as'],'attributes':_0x2d6a76[_0xf6f1('0x21')],'include':_0x2d6a76['include']?_[_0xf6f1('0x23')](_0x2d6a76[_0xf6f1('0x24')],function(_0x10f721){return{'model':db[_0x10f721[_0xf6f1('0x25')]],'as':_0x10f721['as'],'attributes':_0x10f721[_0xf6f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf6f1('0x10')](function(_0x17eef3){logger[_0xf6f1('0x11')](_0xf6f1('0x1b'),_0x30d6f2);logger[_0xf6f1('0x14')](_0xf6f1('0x1b'),_0x30d6f2,JSON[_0xf6f1('0x16')](_0x17eef3));_0x5fcdab(_0x17eef3);})[_0xf6f1('0x26')](function(_0x49a578){logger['error'](_0xf6f1('0x1b'),_0x49a578[_0xf6f1('0x19')],_0x30d6f2);_0x1c5d9e(_0x4fbf70[_0xf6f1('0x17')](0x1f4,_0x49a578[_0xf6f1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 083776a..c2cda1d 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 _0xe1a2=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x15ef66,_0x5cdaf9){var _0x5bd16b=function(_0x5550ea){while(--_0x5550ea){_0x15ef66['push'](_0x15ef66['shift']());}};_0x5bd16b(++_0x5cdaf9);}(_0xe1a2,0x162));var _0x2e1a=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xe1a2[_0x71e493];return _0x3d40ab;};'use strict';var VoiceExtensionEvents=require(_0x2e1a('0x0'));var events=[_0x2e1a('0x1'),_0x2e1a('0x2'),_0x2e1a('0x3')];function createListener(_0x341ffe,_0x285d01){return function(_0x14d226){_0x285d01[_0x2e1a('0x4')](_0x341ffe,_0x14d226);};}function removeListener(_0x51a5e2,_0x47372b){return function(){VoiceExtensionEvents[_0x2e1a('0x5')](_0x51a5e2,_0x47372b);};}exports[_0x2e1a('0x6')]=function(_0x4463c3){for(var _0x588b86=0x0,_0x199e96=events[_0x2e1a('0x7')];_0x588b86<_0x199e96;_0x588b86++){var _0x346eac=events[_0x588b86];var _0x170840=createListener(_0x2e1a('0x8')+_0x346eac,_0x4463c3);VoiceExtensionEvents['on'](_0x346eac,_0x170840);}}; \ No newline at end of file +var _0x299c=['register','length','voiceExtension:','./voiceExtension.events','remove','update'];(function(_0x251678,_0x51067b){var _0x2da780=function(_0x281c11){while(--_0x281c11){_0x251678['push'](_0x251678['shift']());}};_0x2da780(++_0x51067b);}(_0x299c,0xe1));var _0xc299=function(_0x246dd5,_0x514b86){_0x246dd5=_0x246dd5-0x0;var _0xaffcba=_0x299c[_0x246dd5];return _0xaffcba;};'use strict';var VoiceExtensionEvents=require(_0xc299('0x0'));var events=['save',_0xc299('0x1'),_0xc299('0x2')];function createListener(_0x114921,_0x5c3e3d){return function(_0x48d2e4){_0x5c3e3d['emit'](_0x114921,_0x48d2e4);};}function removeListener(_0x35c10b,_0x22c480){return function(){VoiceExtensionEvents['removeListener'](_0x35c10b,_0x22c480);};}exports[_0xc299('0x3')]=function(_0x15c662){for(var _0x12d279=0x0,_0x5ac5c=events[_0xc299('0x4')];_0x12d279<_0x5ac5c;_0x12d279++){var _0x1b843f=events[_0x12d279];var _0x5cb191=createListener(_0xc299('0x5')+_0x1b843f,_0x15c662);VoiceExtensionEvents['on'](_0x1b843f,_0x5cb191);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 2286eea..575dda0 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 _0x8152=['exports','util','path','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy'];(function(_0x55f004,_0x57bd0b){var _0xd0620a=function(_0x265995){while(--_0x265995){_0x55f004['push'](_0x55f004['shift']());}};_0xd0620a(++_0x57bd0b);}(_0x8152,0x19f));var _0x2815=function(_0x42fc12,_0x51f9a8){_0x42fc12=_0x42fc12-0x0;var _0x586edd=_0x8152[_0x42fc12];return _0x586edd;};'use strict';var multer=require('multer');var util=require(_0x2815('0x0'));var path=require(_0x2815('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2815('0x2'));var config=require(_0x2815('0x3'));var controller=require(_0x2815('0x4'));router['get']('/',auth[_0x2815('0x5')](),controller[_0x2815('0x6')]);router['get'](_0x2815('0x7'),auth[_0x2815('0x5')](),controller[_0x2815('0x8')]);router['get'](_0x2815('0x9'),auth[_0x2815('0x5')](),controller[_0x2815('0xa')]);router[_0x2815('0xb')]('/',auth[_0x2815('0x5')](),controller[_0x2815('0xc')]);router[_0x2815('0xd')](_0x2815('0x7'),auth[_0x2815('0x5')](),controller[_0x2815('0xe')]);router[_0x2815('0xf')]('/:id',auth[_0x2815('0x5')](),controller[_0x2815('0x10')]);module[_0x2815('0x11')]=router; \ No newline at end of file +var _0xa13c=['isAuthenticated','index','/:id','show','/:id/messages','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../config/environment','./voiceMail.controller','get'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xa13c,0xad));var _0xca13=function(_0x3311a8,_0x687538){_0x3311a8=_0x3311a8-0x0;var _0x596ee6=_0xa13c[_0x3311a8];return _0x596ee6;};'use strict';var multer=require('multer');var util=require(_0xca13('0x0'));var path=require('path');var timeout=require(_0xca13('0x1'));var express=require(_0xca13('0x2'));var router=express[_0xca13('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xca13('0x4'));var controller=require(_0xca13('0x5'));router[_0xca13('0x6')]('/',auth[_0xca13('0x7')](),controller[_0xca13('0x8')]);router[_0xca13('0x6')](_0xca13('0x9'),auth['isAuthenticated'](),controller[_0xca13('0xa')]);router[_0xca13('0x6')](_0xca13('0xb'),auth[_0xca13('0x7')](),controller['getMessages']);router[_0xca13('0xc')]('/',auth['isAuthenticated'](),controller[_0xca13('0xd')]);router['put'](_0xca13('0x9'),auth[_0xca13('0x7')](),controller[_0xca13('0xe')]);router[_0xca13('0xf')](_0xca13('0x9'),auth[_0xca13('0x7')](),controller[_0xca13('0x10')]);module[_0xca13('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 8bb89d4..1fd2a6f 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x3a6c22,_0x25539e){var _0x61930a=function(_0x69ae65){while(--_0x69ae65){_0x3a6c22['push'](_0x3a6c22['shift']());}};_0x61930a(++_0x25539e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file +var _0x8603=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x36153d,_0x4fed67){var _0xfdacff=function(_0x2ad55d){while(--_0x2ad55d){_0x36153d['push'](_0x36153d['shift']());}};_0xfdacff(++_0x4fed67);}(_0x8603,0x190));var _0x3860=function(_0x533984,_0x55d0c4){_0x533984=_0x533984-0x0;var _0x533873=_0x8603[_0x533984];return _0x533873;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'customer_id':{'type':Sequelize[_0x3860('0x1')]},'context':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3860('0x2')},'password':{'type':Sequelize[_0x3860('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3860('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56f8c5){this[_0x3860('0x3')](_0x3860('0x4'),typeof _0x56f8c5===_0x3860('0x5')&&_0x56f8c5[_0x3860('0x6')]()?_0x56f8c5[_0x3860('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3860('0x1')]},'callback':{'type':Sequelize[_0x3860('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3860('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'stamp':{'type':_0x3860('0xa')},'emailsubject':{'type':Sequelize[_0x3860('0x1')]},'emailbody':{'type':Sequelize[_0x3860('0x1')]},'maxsecs':{'type':Sequelize[_0x3860('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0xc')](_0x3860('0xd'))+_0x3860('0xe')+this['getDataValue'](_0x3860('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 69528f8..f15dade 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 _0x74b8=['VoiceMail','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Voicemails','sendStatus','error','stack','name','index','map'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0x74b8,0x82));var _0x874b=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x74b8[_0x5037ab];return _0x512adb;};'use strict';var pdf=require(_0x874b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x874b('0x1'));var zipdir=require(_0x874b('0x2'));var jsonpatch=require(_0x874b('0x3'));var rp=require('request-promise');var moment=require(_0x874b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x874b('0x5'));var path=require('path');var sox=require(_0x874b('0x6'));var csv=require(_0x874b('0x7'));var ejs=require(_0x874b('0x8'));var fs=require('fs');var _=require(_0x874b('0x9'));var squel=require('squel');var crypto=require(_0x874b('0xa'));var jsforce=require(_0x874b('0xb'));var deskjs=require(_0x874b('0xc'));var toCsv=require(_0x874b('0x7'));var querystring=require(_0x874b('0xd'));var Papa=require(_0x874b('0xe'));var Redis=require('ioredis');var authService=require(_0x874b('0xf'));var qs=require(_0x874b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x874b('0x11'));var logger=require(_0x874b('0x12'))(_0x874b('0x13'));var utils=require(_0x874b('0x14'));var config=require('../../config/environment');var db=require(_0x874b('0x15'))['db'];function respondWithStatusCode(_0x5cadfe,_0x5ebaaa){_0x5ebaaa=_0x5ebaaa||0xcc;return function(_0x34a8b5){if(_0x34a8b5){return _0x5cadfe['sendStatus'](_0x5ebaaa);}return _0x5cadfe['status'](_0x5ebaaa)[_0x874b('0x16')]();};}function respondWithResult(_0x2b0952,_0x166262){_0x166262=_0x166262||0xc8;return function(_0x518764){if(_0x518764){return _0x2b0952[_0x874b('0x17')](_0x166262)[_0x874b('0x18')](_0x518764);}};}function respondWithFilteredResult(_0x2230a4,_0x2c2717){return function(_0x1f6448){if(_0x1f6448){var _0x219a19=_0x1f6448[_0x874b('0x19')],_0x1202db=_0x2c2717[_0x874b('0x1a')],_0x2e2919=_0x2c2717[_0x874b('0x1a')]+_0x2c2717['limit'],_0x531f29;if(_0x2e2919>=_0x219a19){_0x2e2919=_0x219a19;_0x531f29=0xc8;}else{_0x531f29=0xce;}_0x2230a4['status'](_0x531f29);return _0x2230a4[_0x874b('0x1b')](_0x874b('0x1c'),_0x1202db+'-'+_0x2e2919+'/'+_0x219a19)[_0x874b('0x18')](_0x1f6448);}return null;};}function patchUpdates(_0x39b680){return function(_0x471428){try{jsonpatch[_0x874b('0x1d')](_0x471428,_0x39b680,!![]);}catch(_0x3f00a5){return BPromise[_0x874b('0x1e')](_0x3f00a5);}return _0x471428['save']();};}function saveUpdates(_0x343811,_0x23b158){return function(_0x12e076){if(_0x12e076){return _0x12e076[_0x874b('0x1f')](_0x343811)[_0x874b('0x20')](function(_0x1c9b82){return _0x1c9b82;});}return null;};}function removeEntity(_0x818f2c,_0x159e70){return function(_0x2cdc07){if(_0x2cdc07){return _0x2cdc07[_0x874b('0x21')]()[_0x874b('0x20')](function(){var _0x406fab=_0x2cdc07[_0x874b('0x22')]({'plain':!![]});var _0x550615=_0x874b('0x23');return db['UserProfileResource'][_0x874b('0x21')]({'where':{'type':_0x550615,'resourceId':_0x406fab['id']}})[_0x874b('0x20')](function(){return _0x2cdc07;});})[_0x874b('0x20')](function(){_0x818f2c['status'](0xcc)[_0x874b('0x16')]();});}};}function handleEntityNotFound(_0x5f4dd1,_0x1d5343){return function(_0x261759){if(!_0x261759){_0x5f4dd1[_0x874b('0x24')](0x194);}return _0x261759;};}function handleError(_0x19fe91,_0x4e0ec1){_0x4e0ec1=_0x4e0ec1||0x1f4;return function(_0x4d2755){logger[_0x874b('0x25')](_0x4d2755[_0x874b('0x26')]);if(_0x4d2755[_0x874b('0x27')]){delete _0x4d2755[_0x874b('0x27')];}_0x19fe91[_0x874b('0x17')](_0x4e0ec1)['send'](_0x4d2755);};}exports[_0x874b('0x28')]=function(_0x49c0f8,_0xfcd66){var _0x35c0f6={},_0x3eae27={},_0x2284a2={'count':0x0,'rows':[]};var _0x119823=_[_0x874b('0x29')](db[_0x874b('0x2a')][_0x874b('0x2b')],function(_0xfa3969){return{'name':_0xfa3969[_0x874b('0x2c')],'type':_0xfa3969[_0x874b('0x2d')][_0x874b('0x2e')]};});_0x3eae27['model']=_[_0x874b('0x29')](_0x119823,'name');_0x3eae27[_0x874b('0x2f')]=_['keys'](_0x49c0f8[_0x874b('0x2f')]);_0x3eae27['filters']=_[_0x874b('0x30')](_0x3eae27[_0x874b('0x31')],_0x3eae27[_0x874b('0x2f')]);_0x35c0f6['attributes']=_[_0x874b('0x30')](_0x3eae27['model'],qs[_0x874b('0x32')](_0x49c0f8[_0x874b('0x2f')][_0x874b('0x32')]));_0x35c0f6[_0x874b('0x33')]=_0x35c0f6[_0x874b('0x33')][_0x874b('0x34')]?_0x35c0f6[_0x874b('0x33')]:_0x3eae27[_0x874b('0x31')];if(!_0x49c0f8[_0x874b('0x2f')][_0x874b('0x35')](_0x874b('0x36'))){_0x35c0f6['limit']=qs[_0x874b('0x37')](_0x49c0f8[_0x874b('0x2f')][_0x874b('0x37')]);_0x35c0f6[_0x874b('0x1a')]=qs[_0x874b('0x1a')](_0x49c0f8[_0x874b('0x2f')]['offset']);}_0x35c0f6[_0x874b('0x38')]=qs[_0x874b('0x39')](_0x49c0f8[_0x874b('0x2f')][_0x874b('0x39')]);_0x35c0f6[_0x874b('0x3a')]=qs[_0x874b('0x3b')](_['pick'](_0x49c0f8[_0x874b('0x2f')],_0x3eae27['filters']),_0x119823);if(_0x49c0f8[_0x874b('0x2f')][_0x874b('0x3c')]){_0x35c0f6[_0x874b('0x3a')]=_[_0x874b('0x3d')](_0x35c0f6[_0x874b('0x3a')],{'$or':_[_0x874b('0x29')](_0x119823,function(_0x5393a9){if(_0x5393a9[_0x874b('0x2d')]!==_0x874b('0x3e')){var _0x27ff14={};_0x27ff14[_0x5393a9['name']]={'$like':'%'+_0x49c0f8[_0x874b('0x2f')]['filter']+'%'};return _0x27ff14;}})});}_0x35c0f6=_['merge']({},_0x35c0f6,_0x49c0f8[_0x874b('0x3f')]);var _0x48d7bf={'where':_0x35c0f6[_0x874b('0x3a')]};return db[_0x874b('0x2a')][_0x874b('0x19')](_0x48d7bf)[_0x874b('0x20')](function(_0x141f91){_0x2284a2['count']=_0x141f91;if(_0x49c0f8['query'][_0x874b('0x40')]){_0x35c0f6['include']=[{'all':!![]}];}return db[_0x874b('0x2a')]['findAll'](_0x35c0f6);})[_0x874b('0x20')](function(_0x302d0a){_0x2284a2[_0x874b('0x41')]=_0x302d0a;return _0x2284a2;})[_0x874b('0x20')](respondWithFilteredResult(_0xfcd66,_0x35c0f6))[_0x874b('0x42')](handleError(_0xfcd66,null));};exports[_0x874b('0x43')]=function(_0x595b01,_0x3da51d){var _0x25f5fc={'raw':!![],'where':{'id':_0x595b01[_0x874b('0x44')]['id']}},_0x24c92e={};_0x24c92e[_0x874b('0x31')]=_[_0x874b('0x45')](db['VoiceMail']['rawAttributes']);_0x24c92e[_0x874b('0x2f')]=_[_0x874b('0x45')](_0x595b01['query']);_0x24c92e[_0x874b('0x3b')]=_[_0x874b('0x30')](_0x24c92e[_0x874b('0x31')],_0x24c92e[_0x874b('0x2f')]);_0x25f5fc[_0x874b('0x33')]=_['intersection'](_0x24c92e[_0x874b('0x31')],qs['fields'](_0x595b01['query'][_0x874b('0x32')]));_0x25f5fc[_0x874b('0x33')]=_0x25f5fc[_0x874b('0x33')][_0x874b('0x34')]?_0x25f5fc[_0x874b('0x33')]:_0x24c92e[_0x874b('0x31')];if(_0x595b01[_0x874b('0x2f')][_0x874b('0x40')]){_0x25f5fc[_0x874b('0x46')]=[{'all':!![]}];}_0x25f5fc=_[_0x874b('0x3d')]({},_0x25f5fc,_0x595b01[_0x874b('0x3f')]);return db[_0x874b('0x2a')]['find'](_0x25f5fc)[_0x874b('0x20')](handleEntityNotFound(_0x3da51d,null))[_0x874b('0x20')](respondWithResult(_0x3da51d,null))[_0x874b('0x42')](handleError(_0x3da51d,null));};exports[_0x874b('0x47')]=function(_0x533716,_0x348f78){return db['VoiceMail'][_0x874b('0x47')](_0x533716[_0x874b('0x48')],{})[_0x874b('0x20')](function(_0x31ff56){var _0x5507c5=_0x533716[_0x874b('0x49')][_0x874b('0x22')]({'plain':!![]});if(!_0x5507c5)throw new Error(_0x874b('0x4a'));if(_0x5507c5[_0x874b('0x4b')]===_0x874b('0x49')){var _0x2395ff=_0x31ff56[_0x874b('0x22')]({'plain':!![]});var _0x15b81c='Voicemails';return db[_0x874b('0x4c')][_0x874b('0x4d')]({'where':{'name':_0x15b81c,'userProfileId':_0x5507c5[_0x874b('0x4e')]},'raw':!![]})['then'](function(_0xd3935e){if(_0xd3935e&&_0xd3935e[_0x874b('0x4f')]===0x0){return db[_0x874b('0x50')]['create']({'name':_0x2395ff[_0x874b('0x27')],'resourceId':_0x2395ff['id'],'type':_0xd3935e['name'],'sectionId':_0xd3935e['id']},{})[_0x874b('0x20')](function(){return _0x31ff56;});}else{return _0x31ff56;}})['catch'](function(_0x183ea6){logger[_0x874b('0x25')](_0x874b('0x51'),_0x183ea6);throw _0x183ea6;});}return _0x31ff56;})['then'](respondWithResult(_0x348f78,0xc9))[_0x874b('0x42')](handleError(_0x348f78,null));};exports[_0x874b('0x1f')]=function(_0x47da39,_0x54efef){if(_0x47da39[_0x874b('0x48')]['id']){delete _0x47da39[_0x874b('0x48')]['id'];}return db[_0x874b('0x2a')][_0x874b('0x4d')]({'where':{'id':_0x47da39['params']['id']}})[_0x874b('0x20')](handleEntityNotFound(_0x54efef,null))[_0x874b('0x20')](saveUpdates(_0x47da39['body'],null))[_0x874b('0x20')](respondWithResult(_0x54efef,null))[_0x874b('0x42')](handleError(_0x54efef,null));};exports[_0x874b('0x21')]=function(_0x483a5e,_0x53ca13){return db[_0x874b('0x2a')][_0x874b('0x4d')]({'where':{'id':_0x483a5e['params']['id']}})[_0x874b('0x20')](handleEntityNotFound(_0x53ca13,null))[_0x874b('0x20')](removeEntity(_0x53ca13,null))['catch'](handleError(_0x53ca13,null));};exports['getMessages']=function(_0x5aee0c,_0x175d82,_0x13d75e){return db[_0x874b('0x2a')][_0x874b('0x52')]({'where':{'id':_0x5aee0c[_0x874b('0x44')]['id']}})['then'](handleEntityNotFound(_0x175d82,null))[_0x874b('0x20')](function(_0x4e6ade){var _0x2ce305;var _0x5175e1={},_0x5b4d6e={};_0x5b4d6e[_0x874b('0x31')]=_['keys'](db[_0x874b('0x53')]['rawAttributes']);_0x5b4d6e[_0x874b('0x2f')]=_[_0x874b('0x45')](_0x5aee0c[_0x874b('0x2f')]);_0x5b4d6e['filters']=_[_0x874b('0x30')](_0x5b4d6e['model'],_0x5b4d6e[_0x874b('0x2f')]);_0x5175e1[_0x874b('0x33')]=_['intersection'](_0x5b4d6e['model'],qs['fields'](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x32')]));_0x5175e1[_0x874b('0x33')]=_0x5175e1[_0x874b('0x33')][_0x874b('0x34')]?_0x5175e1[_0x874b('0x33')]:_0x5b4d6e[_0x874b('0x31')];if(!_0x5aee0c[_0x874b('0x2f')][_0x874b('0x35')](_0x874b('0x36'))){_0x5175e1[_0x874b('0x37')]=qs[_0x874b('0x37')](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x37')]);_0x5175e1['offset']=qs[_0x874b('0x1a')](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x1a')]);}_0x5175e1[_0x874b('0x38')]=qs['sort'](_0x5aee0c[_0x874b('0x2f')][_0x874b('0x39')]);_0x5175e1['where']=qs[_0x874b('0x3b')](_['pick'](_0x5aee0c[_0x874b('0x2f')],_0x5b4d6e[_0x874b('0x3b')]));if(_0x5aee0c[_0x874b('0x2f')][_0x874b('0x3c')]){_0x5175e1[_0x874b('0x3a')]=_[_0x874b('0x3d')](_0x5175e1['where'],{'$or':_[_0x874b('0x29')](_0x5175e1['attributes'],function(_0x358d8d){var _0x3b2c4f={};_0x3b2c4f[_0x358d8d]={'$like':'%'+_0x5aee0c['query'][_0x874b('0x3c')]+'%'};return _0x3b2c4f;})});}_0x5175e1['where']=_[_0x874b('0x3d')](_0x5175e1[_0x874b('0x3a')],{'mailboxuser':_0x4e6ade[_0x874b('0x54')]});_0x5175e1=_['merge']({},_0x5175e1,_0x5aee0c[_0x874b('0x3f')]);return db[_0x874b('0x53')][_0x874b('0x55')](_0x5175e1)[_0x874b('0x20')](respondWithFilteredResult(_0x175d82,_0x5175e1));})[_0x874b('0x42')](handleError(_0x175d82,null));}; \ No newline at end of file +var _0x8fea=['status','json','count','offset','set','apply','save','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','VoiceMail','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','options','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x8fea,0x8c));var _0xa8fe=function(_0x47ab21,_0x3907b6){_0x47ab21=_0x47ab21-0x0;var _0x1104e3=_0x8fea[_0x47ab21];return _0x1104e3;};'use strict';var pdf=require(_0xa8fe('0x0'));var emlformat=require(_0xa8fe('0x1'));var rimraf=require(_0xa8fe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8fe('0x3'));var rp=require(_0xa8fe('0x4'));var moment=require(_0xa8fe('0x5'));var BPromise=require(_0xa8fe('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa8fe('0x7'));var sox=require(_0xa8fe('0x8'));var csv=require('to-csv');var ejs=require(_0xa8fe('0x9'));var fs=require('fs');var _=require(_0xa8fe('0xa'));var squel=require(_0xa8fe('0xb'));var crypto=require(_0xa8fe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa8fe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa8fe('0xe'));var Papa=require('papaparse');var Redis=require(_0xa8fe('0xf'));var authService=require(_0xa8fe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa8fe('0x11'));var hardwareService=require(_0xa8fe('0x12'));var logger=require('../../config/logger')(_0xa8fe('0x13'));var utils=require(_0xa8fe('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ae854,_0x574829){_0x574829=_0x574829||0xcc;return function(_0x103a70){if(_0x103a70){return _0x5ae854[_0xa8fe('0x15')](_0x574829);}return _0x5ae854[_0xa8fe('0x16')](_0x574829)['end']();};}function respondWithResult(_0x142a0d,_0x5b1acc){_0x5b1acc=_0x5b1acc||0xc8;return function(_0x212165){if(_0x212165){return _0x142a0d[_0xa8fe('0x16')](_0x5b1acc)[_0xa8fe('0x17')](_0x212165);}};}function respondWithFilteredResult(_0x158178,_0x33329b){return function(_0x487443){if(_0x487443){var _0x596f7b=_0x487443[_0xa8fe('0x18')],_0x1594d4=_0x33329b[_0xa8fe('0x19')],_0x36cf96=_0x33329b['offset']+_0x33329b['limit'],_0x9231dd;if(_0x36cf96>=_0x596f7b){_0x36cf96=_0x596f7b;_0x9231dd=0xc8;}else{_0x9231dd=0xce;}_0x158178['status'](_0x9231dd);return _0x158178[_0xa8fe('0x1a')]('Content-Range',_0x1594d4+'-'+_0x36cf96+'/'+_0x596f7b)[_0xa8fe('0x17')](_0x487443);}return null;};}function patchUpdates(_0x29115f){return function(_0x5b9989){try{jsonpatch[_0xa8fe('0x1b')](_0x5b9989,_0x29115f,!![]);}catch(_0x4b58c6){return BPromise['reject'](_0x4b58c6);}return _0x5b9989[_0xa8fe('0x1c')]();};}function saveUpdates(_0x336d16,_0x467d7c){return function(_0x2ff329){if(_0x2ff329){return _0x2ff329['update'](_0x336d16)[_0xa8fe('0x1d')](function(_0x442c0c){return _0x442c0c;});}return null;};}function removeEntity(_0x5a6bfb,_0x4fd70a){return function(_0x3c7fa9){if(_0x3c7fa9){return _0x3c7fa9['destroy']()[_0xa8fe('0x1d')](function(){var _0x40f758=_0x3c7fa9[_0xa8fe('0x1e')]({'plain':!![]});var _0x3f70ff=_0xa8fe('0x1f');return db[_0xa8fe('0x20')][_0xa8fe('0x21')]({'where':{'type':_0x3f70ff,'resourceId':_0x40f758['id']}})[_0xa8fe('0x1d')](function(){return _0x3c7fa9;});})[_0xa8fe('0x1d')](function(){_0x5a6bfb[_0xa8fe('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3cdc,_0x5a37b1){return function(_0x3fc680){if(!_0x3fc680){_0x5f3cdc[_0xa8fe('0x15')](0x194);}return _0x3fc680;};}function handleError(_0x3d4965,_0x1ab0df){_0x1ab0df=_0x1ab0df||0x1f4;return function(_0x5c29bc){logger[_0xa8fe('0x22')](_0x5c29bc[_0xa8fe('0x23')]);if(_0x5c29bc[_0xa8fe('0x24')]){delete _0x5c29bc[_0xa8fe('0x24')];}_0x3d4965[_0xa8fe('0x16')](_0x1ab0df)[_0xa8fe('0x25')](_0x5c29bc);};}exports['index']=function(_0x17d1e5,_0x2221a7){var _0x1d2dd4={},_0x5ecedd={},_0x9e3113={'count':0x0,'rows':[]};var _0x51ff25=_['map'](db[_0xa8fe('0x26')][_0xa8fe('0x27')],function(_0x4b5aa2){return{'name':_0x4b5aa2[_0xa8fe('0x28')],'type':_0x4b5aa2['type'][_0xa8fe('0x29')]};});_0x5ecedd[_0xa8fe('0x2a')]=_[_0xa8fe('0x2b')](_0x51ff25,_0xa8fe('0x24'));_0x5ecedd[_0xa8fe('0x2c')]=_[_0xa8fe('0x2d')](_0x17d1e5[_0xa8fe('0x2c')]);_0x5ecedd[_0xa8fe('0x2e')]=_['intersection'](_0x5ecedd[_0xa8fe('0x2a')],_0x5ecedd['query']);_0x1d2dd4[_0xa8fe('0x2f')]=_[_0xa8fe('0x30')](_0x5ecedd[_0xa8fe('0x2a')],qs['fields'](_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x31')]));_0x1d2dd4['attributes']=_0x1d2dd4['attributes'][_0xa8fe('0x32')]?_0x1d2dd4[_0xa8fe('0x2f')]:_0x5ecedd[_0xa8fe('0x2a')];if(!_0x17d1e5[_0xa8fe('0x2c')]['hasOwnProperty']('nolimit')){_0x1d2dd4['limit']=qs[_0xa8fe('0x33')](_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x33')]);_0x1d2dd4['offset']=qs['offset'](_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x19')]);}_0x1d2dd4['order']=qs[_0xa8fe('0x34')](_0x17d1e5['query'][_0xa8fe('0x34')]);_0x1d2dd4[_0xa8fe('0x35')]=qs[_0xa8fe('0x2e')](_[_0xa8fe('0x36')](_0x17d1e5[_0xa8fe('0x2c')],_0x5ecedd[_0xa8fe('0x2e')]),_0x51ff25);if(_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x37')]){_0x1d2dd4[_0xa8fe('0x35')]=_[_0xa8fe('0x38')](_0x1d2dd4[_0xa8fe('0x35')],{'$or':_[_0xa8fe('0x2b')](_0x51ff25,function(_0x39e16b){if(_0x39e16b['type']!==_0xa8fe('0x39')){var _0x46b6e6={};_0x46b6e6[_0x39e16b['name']]={'$like':'%'+_0x17d1e5['query'][_0xa8fe('0x37')]+'%'};return _0x46b6e6;}})});}_0x1d2dd4=_[_0xa8fe('0x38')]({},_0x1d2dd4,_0x17d1e5['options']);var _0x3977dd={'where':_0x1d2dd4['where']};return db[_0xa8fe('0x26')][_0xa8fe('0x18')](_0x3977dd)[_0xa8fe('0x1d')](function(_0x41e333){_0x9e3113['count']=_0x41e333;if(_0x17d1e5[_0xa8fe('0x2c')][_0xa8fe('0x3a')]){_0x1d2dd4[_0xa8fe('0x3b')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x1d2dd4);})[_0xa8fe('0x1d')](function(_0x44c8a5){_0x9e3113[_0xa8fe('0x3c')]=_0x44c8a5;return _0x9e3113;})[_0xa8fe('0x1d')](respondWithFilteredResult(_0x2221a7,_0x1d2dd4))[_0xa8fe('0x3d')](handleError(_0x2221a7,null));};exports['show']=function(_0x5e099e,_0x150b18){var _0x5e34e3={'raw':!![],'where':{'id':_0x5e099e[_0xa8fe('0x3e')]['id']}},_0x430a60={};_0x430a60['model']=_['keys'](db[_0xa8fe('0x26')][_0xa8fe('0x27')]);_0x430a60[_0xa8fe('0x2c')]=_[_0xa8fe('0x2d')](_0x5e099e['query']);_0x430a60['filters']=_[_0xa8fe('0x30')](_0x430a60[_0xa8fe('0x2a')],_0x430a60[_0xa8fe('0x2c')]);_0x5e34e3['attributes']=_[_0xa8fe('0x30')](_0x430a60[_0xa8fe('0x2a')],qs[_0xa8fe('0x31')](_0x5e099e[_0xa8fe('0x2c')][_0xa8fe('0x31')]));_0x5e34e3[_0xa8fe('0x2f')]=_0x5e34e3['attributes']['length']?_0x5e34e3['attributes']:_0x430a60[_0xa8fe('0x2a')];if(_0x5e099e[_0xa8fe('0x2c')][_0xa8fe('0x3a')]){_0x5e34e3['include']=[{'all':!![]}];}_0x5e34e3=_['merge']({},_0x5e34e3,_0x5e099e['options']);return db[_0xa8fe('0x26')][_0xa8fe('0x3f')](_0x5e34e3)[_0xa8fe('0x1d')](handleEntityNotFound(_0x150b18,null))[_0xa8fe('0x1d')](respondWithResult(_0x150b18,null))[_0xa8fe('0x3d')](handleError(_0x150b18,null));};exports['create']=function(_0x3021d2,_0x320b32){return db[_0xa8fe('0x26')]['create'](_0x3021d2[_0xa8fe('0x40')],{})[_0xa8fe('0x1d')](function(_0x44bff6){var _0xf2b9af=_0x3021d2[_0xa8fe('0x41')]['get']({'plain':!![]});if(!_0xf2b9af)throw new Error(_0xa8fe('0x42'));if(_0xf2b9af[_0xa8fe('0x43')]===_0xa8fe('0x41')){var _0x3e883d=_0x44bff6[_0xa8fe('0x1e')]({'plain':!![]});var _0x144cd9=_0xa8fe('0x1f');return db[_0xa8fe('0x44')][_0xa8fe('0x3f')]({'where':{'name':_0x144cd9,'userProfileId':_0xf2b9af[_0xa8fe('0x45')]},'raw':!![]})[_0xa8fe('0x1d')](function(_0x32cfca){if(_0x32cfca&&_0x32cfca[_0xa8fe('0x46')]===0x0){return db[_0xa8fe('0x20')][_0xa8fe('0x47')]({'name':_0x3e883d[_0xa8fe('0x24')],'resourceId':_0x3e883d['id'],'type':_0x32cfca[_0xa8fe('0x24')],'sectionId':_0x32cfca['id']},{})[_0xa8fe('0x1d')](function(){return _0x44bff6;});}else{return _0x44bff6;}})['catch'](function(_0x3e2883){logger[_0xa8fe('0x22')](_0xa8fe('0x48'),_0x3e2883);throw _0x3e2883;});}return _0x44bff6;})['then'](respondWithResult(_0x320b32,0xc9))[_0xa8fe('0x3d')](handleError(_0x320b32,null));};exports[_0xa8fe('0x49')]=function(_0xa83fc5,_0x339863){if(_0xa83fc5[_0xa8fe('0x40')]['id']){delete _0xa83fc5[_0xa8fe('0x40')]['id'];}return db[_0xa8fe('0x26')][_0xa8fe('0x3f')]({'where':{'id':_0xa83fc5[_0xa8fe('0x3e')]['id']}})[_0xa8fe('0x1d')](handleEntityNotFound(_0x339863,null))['then'](saveUpdates(_0xa83fc5[_0xa8fe('0x40')],null))[_0xa8fe('0x1d')](respondWithResult(_0x339863,null))[_0xa8fe('0x3d')](handleError(_0x339863,null));};exports[_0xa8fe('0x21')]=function(_0x9c116,_0x1afc23){return db[_0xa8fe('0x26')][_0xa8fe('0x3f')]({'where':{'id':_0x9c116[_0xa8fe('0x3e')]['id']}})[_0xa8fe('0x1d')](handleEntityNotFound(_0x1afc23,null))['then'](removeEntity(_0x1afc23,null))[_0xa8fe('0x3d')](handleError(_0x1afc23,null));};exports[_0xa8fe('0x4a')]=function(_0x2e8c39,_0x2ceba5,_0x5149ae){return db[_0xa8fe('0x26')][_0xa8fe('0x4b')]({'where':{'id':_0x2e8c39[_0xa8fe('0x3e')]['id']}})[_0xa8fe('0x1d')](handleEntityNotFound(_0x2ceba5,null))[_0xa8fe('0x1d')](function(_0x972c95){var _0x2b9093;var _0x2f0a05={},_0xedbf1d={};_0xedbf1d[_0xa8fe('0x2a')]=_[_0xa8fe('0x2d')](db[_0xa8fe('0x4c')][_0xa8fe('0x27')]);_0xedbf1d['query']=_['keys'](_0x2e8c39[_0xa8fe('0x2c')]);_0xedbf1d[_0xa8fe('0x2e')]=_[_0xa8fe('0x30')](_0xedbf1d['model'],_0xedbf1d['query']);_0x2f0a05[_0xa8fe('0x2f')]=_['intersection'](_0xedbf1d[_0xa8fe('0x2a')],qs[_0xa8fe('0x31')](_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x31')]));_0x2f0a05[_0xa8fe('0x2f')]=_0x2f0a05[_0xa8fe('0x2f')]['length']?_0x2f0a05[_0xa8fe('0x2f')]:_0xedbf1d[_0xa8fe('0x2a')];if(!_0x2e8c39[_0xa8fe('0x2c')]['hasOwnProperty'](_0xa8fe('0x4d'))){_0x2f0a05['limit']=qs[_0xa8fe('0x33')](_0x2e8c39['query'][_0xa8fe('0x33')]);_0x2f0a05[_0xa8fe('0x19')]=qs[_0xa8fe('0x19')](_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x19')]);}_0x2f0a05['order']=qs[_0xa8fe('0x34')](_0x2e8c39[_0xa8fe('0x2c')]['sort']);_0x2f0a05['where']=qs[_0xa8fe('0x2e')](_[_0xa8fe('0x36')](_0x2e8c39[_0xa8fe('0x2c')],_0xedbf1d['filters']));if(_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x37')]){_0x2f0a05[_0xa8fe('0x35')]=_[_0xa8fe('0x38')](_0x2f0a05[_0xa8fe('0x35')],{'$or':_[_0xa8fe('0x2b')](_0x2f0a05[_0xa8fe('0x2f')],function(_0x5f03bb){var _0x13a429={};_0x13a429[_0x5f03bb]={'$like':'%'+_0x2e8c39[_0xa8fe('0x2c')][_0xa8fe('0x37')]+'%'};return _0x13a429;})});}_0x2f0a05[_0xa8fe('0x35')]=_[_0xa8fe('0x38')](_0x2f0a05['where'],{'mailboxuser':_0x972c95[_0xa8fe('0x4e')]});_0x2f0a05=_[_0xa8fe('0x38')]({},_0x2f0a05,_0x2e8c39[_0xa8fe('0x4f')]);return db['VoiceMailMessage'][_0xa8fe('0x50')](_0x2f0a05)[_0xa8fe('0x1d')](respondWithFilteredResult(_0x2ceba5,_0x2f0a05));})['catch'](handleError(_0x2ceba5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 75f3065..3dd6c05 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 _0x3e44=['mailbox_context','mailbox','context','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMail','voice_voicemail'];(function(_0x43fd84,_0x408c0c){var _0x3bd971=function(_0x5ea0b0){while(--_0x5ea0b0){_0x43fd84['push'](_0x43fd84['shift']());}};_0x3bd971(++_0x408c0c);}(_0x3e44,0x1df));var _0x43e4=function(_0xb4b7a,_0x45d071){_0xb4b7a=_0xb4b7a-0x0;var _0x474e23=_0x3e44[_0xb4b7a];return _0x474e23;};'use strict';var _=require(_0x43e4('0x0'));var util=require(_0x43e4('0x1'));var logger=require(_0x43e4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x43e4('0x3'));var rp=require(_0x43e4('0x4'));var fs=require('fs');var path=require(_0x43e4('0x5'));var rimraf=require('rimraf');var config=require(_0x43e4('0x6'));var attributes=require('./voiceMail.attributes');module[_0x43e4('0x7')]=function(_0x511aef,_0x3d0fb6){return _0x511aef[_0x43e4('0x8')](_0x43e4('0x9'),attributes,{'tableName':_0x43e4('0xa'),'paranoid':![],'indexes':[{'name':_0x43e4('0xb'),'fields':[_0x43e4('0xc'),_0x43e4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90d5=['mailbox_context','mailbox','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x4b0bb1,_0x35fb68){var _0x50ee3a=function(_0x1350d1){while(--_0x1350d1){_0x4b0bb1['push'](_0x4b0bb1['shift']());}};_0x50ee3a(++_0x35fb68);}(_0x90d5,0x152));var _0x590d=function(_0x5b77fc,_0xf10e52){_0x5b77fc=_0x5b77fc-0x0;var _0x5afaea=_0x90d5[_0x5b77fc];return _0x5afaea;};'use strict';var _=require(_0x590d('0x0'));var util=require(_0x590d('0x1'));var logger=require('../../config/logger')(_0x590d('0x2'));var moment=require(_0x590d('0x3'));var BPromise=require(_0x590d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590d('0x5'));var config=require(_0x590d('0x6'));var attributes=require(_0x590d('0x7'));module[_0x590d('0x8')]=function(_0x3bcfee,_0x24e9da){return _0x3bcfee[_0x590d('0x9')](_0x590d('0xa'),attributes,{'tableName':_0x590d('0xb'),'paranoid':![],'indexes':[{'name':_0x590d('0xc'),'fields':[_0x590d('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 82d4d92..b19e5c1 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 _0xd38f=['../../config/environment','jayson/promise','client','request','then','info','debug','error','code','VoiceMail,\x20%s,\x20%s','message','request\x20sent','result','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xd38f,0xf1));var _0xfd38=function(_0x58abe0,_0x3b559f){_0x58abe0=_0x58abe0-0x0;var _0x13c0d9=_0xd38f[_0x58abe0];return _0x13c0d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd38('0x0'));var BPromise=require('bluebird');var rs=require(_0xfd38('0x1'));var fs=require('fs');var Redis=require(_0xfd38('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd38('0x3'));var logger=require(_0xfd38('0x4'))(_0xfd38('0x5'));var config=require(_0xfd38('0x6'));var jayson=require(_0xfd38('0x7'));var client=jayson[_0xfd38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589d59,_0x2d2040,_0xc3d89a){return new BPromise(function(_0x49f39,_0x135430){return client[_0xfd38('0x9')](_0x589d59,_0xc3d89a)[_0xfd38('0xa')](function(_0x5ed8ec){logger[_0xfd38('0xb')]('VoiceMail,\x20%s,\x20%s',_0x2d2040,'request\x20sent');logger[_0xfd38('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2d2040,'request\x20sent',JSON['stringify'](_0x5ed8ec));if(_0x5ed8ec[_0xfd38('0xd')]){if(_0x5ed8ec['error'][_0xfd38('0xe')]===0x1f4){logger[_0xfd38('0xd')](_0xfd38('0xf'),_0x2d2040,_0x5ed8ec[_0xfd38('0xd')][_0xfd38('0x10')]);return _0x135430(_0x5ed8ec['error']['message']);}logger['error'](_0xfd38('0xf'),_0x2d2040,_0x5ed8ec[_0xfd38('0xd')][_0xfd38('0x10')]);return _0x49f39(_0x5ed8ec[_0xfd38('0xd')][_0xfd38('0x10')]);}else{logger[_0xfd38('0xb')](_0xfd38('0xf'),_0x2d2040,_0xfd38('0x11'));_0x49f39(_0x5ed8ec[_0xfd38('0x12')][_0xfd38('0x10')]);}})['catch'](function(_0x395ac9){logger[_0xfd38('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2d2040,_0x395ac9);_0x135430(_0x395ac9);});});} \ No newline at end of file +var _0x7e8b=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x50da8a,_0x311832){var _0x177d43=function(_0x568e08){while(--_0x568e08){_0x50da8a['push'](_0x50da8a['shift']());}};_0x177d43(++_0x311832);}(_0x7e8b,0x1a7));var _0xb7e8=function(_0x229be5,_0x9156f6){_0x229be5=_0x229be5-0x0;var _0x326189=_0x7e8b[_0x229be5];return _0x326189;};'use strict';var _=require('lodash');var util=require(_0xb7e8('0x0'));var moment=require(_0xb7e8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7e8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb7e8('0x3'));var config=require(_0xb7e8('0x4'));var jayson=require(_0xb7e8('0x5'));var client=jayson[_0xb7e8('0x6')][_0xb7e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f901a,_0x9039bc,_0x592d11){return new BPromise(function(_0x53fe28,_0x3f04e8){return client[_0xb7e8('0x8')](_0x2f901a,_0x592d11)['then'](function(_0x4466e9){logger[_0xb7e8('0x9')](_0xb7e8('0xa'),_0x9039bc,_0xb7e8('0xb'));logger['debug'](_0xb7e8('0xc'),_0x9039bc,_0xb7e8('0xb'),JSON[_0xb7e8('0xd')](_0x4466e9));if(_0x4466e9[_0xb7e8('0xe')]){if(_0x4466e9[_0xb7e8('0xe')]['code']===0x1f4){logger['error'](_0xb7e8('0xa'),_0x9039bc,_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);return _0x3f04e8(_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);}logger[_0xb7e8('0xe')](_0xb7e8('0xa'),_0x9039bc,_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);return _0x53fe28(_0x4466e9[_0xb7e8('0xe')][_0xb7e8('0xf')]);}else{logger[_0xb7e8('0x9')](_0xb7e8('0xa'),_0x9039bc,_0xb7e8('0xb'));_0x53fe28(_0x4466e9[_0xb7e8('0x10')][_0xb7e8('0xf')]);}})[_0xb7e8('0x11')](function(_0x33397d){logger[_0xb7e8('0xe')](_0xb7e8('0xa'),_0x9039bc,_0x33397d);_0x3f04e8(_0x33397d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8146ac2..77cc193 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 _0x7a54=['show','/:id/download','create','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x45cc8d,_0x2f240a){var _0x4d1d2b=function(_0x2d65be){while(--_0x2d65be){_0x45cc8d['push'](_0x45cc8d['shift']());}};_0x4d1d2b(++_0x2f240a);}(_0x7a54,0x106));var _0x47a5=function(_0x26cbbb,_0x330bcd){_0x26cbbb=_0x26cbbb-0x0;var _0x43bfcf=_0x7a54[_0x26cbbb];return _0x43bfcf;};'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')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xe')](_0x47a5('0xd'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x687b=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x687b,0x14a));var _0xb687=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0x687b[_0x5dc927];return _0x416440;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0x8')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0xe')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xf')]);router[_0xb687('0x10')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')]('/:id',auth[_0xb687('0x9')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2c1b9ce..1648f3f 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 _0x74a1=['BLOB','TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING'];(function(_0x372171,_0x27e97c){var _0xb05392=function(_0x1bcb9c){while(--_0x1bcb9c){_0x372171['push'](_0x372171['shift']());}};_0xb05392(++_0x27e97c);}(_0x74a1,0x122));var _0x174a=function(_0x4c9d00,_0x5092d5){_0x4c9d00=_0x4c9d00-0x0;var _0x4a73f5=_0x74a1[_0x4c9d00];return _0x4a73f5;};'use strict';var Sequelize=require(_0x174a('0x0'));module['exports']={'name':{'type':Sequelize[_0x174a('0x1')],'get':function(_0x5b75f4){return this[_0x174a('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x174a('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x174a('0x3')],'defaultValue':''},'stamp':{'type':_0x174a('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0xd395=['STRING','BLOB','TIMESTAMP','sequelize','exports','getDataValue','INTEGER'];(function(_0x2ff980,_0xf5e589){var _0x3e4a63=function(_0xd40f69){while(--_0xd40f69){_0x2ff980['push'](_0x2ff980['shift']());}};_0x3e4a63(++_0xf5e589);}(_0xd395,0x1a7));var _0x5d39=function(_0x355dfc,_0xd28c0d){_0x355dfc=_0x355dfc-0x0;var _0x4ac428=_0xd395[_0x355dfc];return _0x4ac428;};'use strict';var Sequelize=require(_0x5d39('0x0'));module[_0x5d39('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x582c0d){return this[_0x5d39('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x5d39('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5d39('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5d39('0x4')],'defaultValue':''},'stamp':{'type':_0x5d39('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a404195..3e3670d 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 _0x7341=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','save','then','destroy','stack','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa10a8f,_0x4d5a24){var _0x48eb98=function(_0xd193b4){while(--_0xd193b4){_0xa10a8f['push'](_0xa10a8f['shift']());}};_0x48eb98(++_0x4d5a24);}(_0x7341,0xe4));var _0x1734=function(_0x4ffec7,_0x2ff519){_0x4ffec7=_0x4ffec7-0x0;var _0x4e13af=_0x7341[_0x4ffec7];return _0x4e13af;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1734('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1734('0x1'));var rp=require(_0x1734('0x2'));var moment=require('moment');var BPromise=require(_0x1734('0x3'));var Mustache=require(_0x1734('0x4'));var util=require(_0x1734('0x5'));var path=require(_0x1734('0x6'));var sox=require(_0x1734('0x7'));var csv=require(_0x1734('0x8'));var ejs=require(_0x1734('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var db=require(_0x1734('0x16'))['db'];function respondWithStatusCode(_0x59830b,_0x4391a1){_0x4391a1=_0x4391a1||0xcc;return function(_0x449ab1){if(_0x449ab1){return _0x59830b[_0x1734('0x17')](_0x4391a1);}return _0x59830b[_0x1734('0x18')](_0x4391a1)[_0x1734('0x19')]();};}function respondWithResult(_0x424a23,_0x9e7cf5){_0x9e7cf5=_0x9e7cf5||0xc8;return function(_0xd2f288){if(_0xd2f288){return _0x424a23[_0x1734('0x18')](_0x9e7cf5)[_0x1734('0x1a')](_0xd2f288);}};}function respondWithFilteredResult(_0x444527,_0x27679e){return function(_0x2162c9){if(_0x2162c9){var _0x2dd53c=_0x2162c9[_0x1734('0x1b')],_0x3989a6=_0x27679e[_0x1734('0x1c')],_0x24bbf3=_0x27679e['offset']+_0x27679e['limit'],_0x2b375d;if(_0x24bbf3>=_0x2dd53c){_0x24bbf3=_0x2dd53c;_0x2b375d=0xc8;}else{_0x2b375d=0xce;}_0x444527[_0x1734('0x18')](_0x2b375d);return _0x444527[_0x1734('0x1d')]('Content-Range',_0x3989a6+'-'+_0x24bbf3+'/'+_0x2dd53c)[_0x1734('0x1a')](_0x2162c9);}return null;};}function patchUpdates(_0x58f566){return function(_0x530f66){try{jsonpatch['apply'](_0x530f66,_0x58f566,!![]);}catch(_0x14347d){return BPromise['reject'](_0x14347d);}return _0x530f66[_0x1734('0x1e')]();};}function saveUpdates(_0xc4b4cc,_0x4fc4ed){return function(_0x54b1bd){if(_0x54b1bd){return _0x54b1bd['update'](_0xc4b4cc)[_0x1734('0x1f')](function(_0x53f13d){return _0x53f13d;});}return null;};}function removeEntity(_0x183f7a,_0x5ad801){return function(_0x215ae4){if(_0x215ae4){return _0x215ae4[_0x1734('0x20')]()[_0x1734('0x1f')](function(){_0x183f7a[_0x1734('0x18')](0xcc)[_0x1734('0x19')]();});}};}function handleEntityNotFound(_0x45593e,_0x4285ee){return function(_0x44e420){if(!_0x44e420){_0x45593e[_0x1734('0x17')](0x194);}return _0x44e420;};}function handleError(_0x5c1be3,_0x34ac29){_0x34ac29=_0x34ac29||0x1f4;return function(_0x568e0c){logger['error'](_0x568e0c[_0x1734('0x21')]);if(_0x568e0c[_0x1734('0x22')]){delete _0x568e0c[_0x1734('0x22')];}_0x5c1be3[_0x1734('0x18')](_0x34ac29)[_0x1734('0x23')](_0x568e0c);};}exports[_0x1734('0x24')]=function(_0x3616c1,_0x27d6e5){var _0x4a670a={},_0x381960={},_0x52eaf5={'count':0x0,'rows':[]};var _0x17e068=_[_0x1734('0x25')](db[_0x1734('0x26')]['rawAttributes'],function(_0x3eb31b){return{'name':_0x3eb31b[_0x1734('0x27')],'type':_0x3eb31b[_0x1734('0x28')]['key']};});_0x381960[_0x1734('0x29')]=_[_0x1734('0x2a')](_['map'](_0x17e068,_0x1734('0x22')),[_0x1734('0x22')]);_0x381960[_0x1734('0x2b')]=_[_0x1734('0x2c')](_0x3616c1['query']);_0x381960[_0x1734('0x2d')]=_[_0x1734('0x2e')](_0x381960['model'],_0x381960['query']);_0x4a670a[_0x1734('0x2f')]=_[_0x1734('0x2e')](_0x381960[_0x1734('0x29')],qs[_0x1734('0x30')](_0x3616c1[_0x1734('0x2b')][_0x1734('0x30')]));_0x4a670a[_0x1734('0x2f')]=_0x4a670a[_0x1734('0x2f')][_0x1734('0x31')]?_0x4a670a[_0x1734('0x2f')]:_0x381960[_0x1734('0x29')];if(!_0x3616c1[_0x1734('0x2b')][_0x1734('0x32')](_0x1734('0x33'))){_0x4a670a[_0x1734('0x34')]=qs[_0x1734('0x34')](_0x3616c1[_0x1734('0x2b')]['limit']);_0x4a670a[_0x1734('0x1c')]=qs['offset'](_0x3616c1[_0x1734('0x2b')][_0x1734('0x1c')]);}_0x4a670a[_0x1734('0x35')]=qs[_0x1734('0x36')](_0x3616c1[_0x1734('0x2b')][_0x1734('0x36')]);_0x4a670a[_0x1734('0x37')]=qs[_0x1734('0x2d')](_['pick'](_0x3616c1[_0x1734('0x2b')],_0x381960[_0x1734('0x2d')]),_0x17e068);if(_0x3616c1[_0x1734('0x2b')][_0x1734('0x38')]){_0x4a670a[_0x1734('0x37')]=_[_0x1734('0x39')](_0x4a670a[_0x1734('0x37')],{'$or':_['map'](_0x17e068,function(_0x1f67b4){if(_0x1f67b4[_0x1734('0x28')]!==_0x1734('0x3a')){var _0x3a9bcd={};_0x3a9bcd[_0x1f67b4[_0x1734('0x22')]]={'$like':'%'+_0x3616c1[_0x1734('0x2b')][_0x1734('0x38')]+'%'};return _0x3a9bcd;}})});}_0x4a670a=_[_0x1734('0x39')]({},_0x4a670a,_0x3616c1['options']);var _0x1f5cc6={'where':_0x4a670a['where']};return db[_0x1734('0x26')][_0x1734('0x1b')](_0x1f5cc6)[_0x1734('0x1f')](function(_0x387aab){_0x52eaf5[_0x1734('0x1b')]=_0x387aab;if(_0x3616c1[_0x1734('0x2b')][_0x1734('0x3b')]){_0x4a670a[_0x1734('0x3c')]=[{'all':!![]}];}return db[_0x1734('0x26')][_0x1734('0x3d')](_0x4a670a);})[_0x1734('0x1f')](function(_0x55d67c){_0x52eaf5[_0x1734('0x3e')]=_0x55d67c;return _0x52eaf5;})[_0x1734('0x1f')](respondWithFilteredResult(_0x27d6e5,_0x4a670a))[_0x1734('0x3f')](handleError(_0x27d6e5,null));};exports[_0x1734('0x40')]=function(_0x5f34e1,_0x4369a2){var _0x562be1={'raw':!![],'where':{'id':_0x5f34e1[_0x1734('0x41')]['id']}},_0x539270={};_0x539270[_0x1734('0x29')]=_[_0x1734('0x2c')](db[_0x1734('0x26')]['rawAttributes']);_0x539270[_0x1734('0x2b')]=_[_0x1734('0x2c')](_0x5f34e1['query']);_0x539270[_0x1734('0x2d')]=_[_0x1734('0x2e')](_0x539270['model'],_0x539270[_0x1734('0x2b')]);_0x562be1['attributes']=_[_0x1734('0x2e')](_0x539270[_0x1734('0x29')],qs[_0x1734('0x30')](_0x5f34e1[_0x1734('0x2b')][_0x1734('0x30')]));_0x562be1[_0x1734('0x2f')]=_0x562be1[_0x1734('0x2f')]['length']?_0x562be1[_0x1734('0x2f')]:_0x539270[_0x1734('0x29')];if(_0x5f34e1['query'][_0x1734('0x3b')]){_0x562be1[_0x1734('0x3c')]=[{'all':!![]}];}_0x562be1=_[_0x1734('0x39')]({},_0x562be1,_0x5f34e1[_0x1734('0x42')]);return db['VoiceMailMessage'][_0x1734('0x43')](_0x562be1)[_0x1734('0x1f')](handleEntityNotFound(_0x4369a2,null))[_0x1734('0x1f')](respondWithResult(_0x4369a2,null))['catch'](handleError(_0x4369a2,null));};exports[_0x1734('0x44')]=function(_0x245420,_0xa86be6){return db[_0x1734('0x26')][_0x1734('0x44')](_0x245420[_0x1734('0x45')],{})[_0x1734('0x1f')](respondWithResult(_0xa86be6,0xc9))[_0x1734('0x3f')](handleError(_0xa86be6,null));};exports[_0x1734('0x46')]=function(_0x408b12,_0x1ef5d6){if(_0x408b12[_0x1734('0x45')]['id']){delete _0x408b12[_0x1734('0x45')]['id'];}return db[_0x1734('0x26')][_0x1734('0x43')]({'where':{'id':_0x408b12[_0x1734('0x41')]['id']}})[_0x1734('0x1f')](handleEntityNotFound(_0x1ef5d6,null))[_0x1734('0x1f')](saveUpdates(_0x408b12['body'],null))[_0x1734('0x1f')](respondWithResult(_0x1ef5d6,null))['catch'](handleError(_0x1ef5d6,null));};exports[_0x1734('0x20')]=function(_0x3d49d6,_0x95d24f){return db[_0x1734('0x26')]['find']({'where':{'id':_0x3d49d6['params']['id']}})[_0x1734('0x1f')](handleEntityNotFound(_0x95d24f,null))[_0x1734('0x1f')](removeEntity(_0x95d24f,null))['catch'](handleError(_0x95d24f,null));};exports[_0x1734('0x47')]=function(_0x1c5d2f,_0x2a71cf,_0x427cd8){return db[_0x1734('0x26')][_0x1734('0x43')]({'where':{'id':_0x1c5d2f[_0x1734('0x41')]['id']},'attributes':['id','recording',_0x1734('0x48')]})[_0x1734('0x1f')](handleEntityNotFound(_0x2a71cf,null))[_0x1734('0x1f')](function(_0x47cd87){if(_0x47cd87){if(!_0x47cd87[_0x1734('0x49')]){throw new db[(_0x1734('0x4a'))][(_0x1734('0x4b'))](_0x1734('0x4c'));}var _0x5c1d5d={'Content-Type':_0x1734('0x4d'),'Content-Disposition':_0x1734('0x4e')};if(_0x47cd87[_0x1734('0x48')]){_0x5c1d5d[_0x1734('0x4f')]=_0x1734('0x50')+_0x47cd87['msg_id']+_0x1734('0x51');}_0x2a71cf['set'](_0x5c1d5d);return _0x2a71cf['send'](new Buffer(_0x47cd87[_0x1734('0x49')]));}})[_0x1734('0x3f')](handleError(_0x2a71cf,null));}; \ No newline at end of file +var _0x6308=['count','includeAll','include','findAll','rows','catch','params','create','body','find','download','recording','msg_id','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options'];(function(_0x1bfdd0,_0x1f8767){var _0x14ab46=function(_0x3793ae){while(--_0x3793ae){_0x1bfdd0['push'](_0x1bfdd0['shift']());}};_0x14ab46(++_0x1f8767);}(_0x6308,0x1f2));var _0x8630=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x6308[_0x266618];return _0x54dbf5;};'use strict';var pdf=require(_0x8630('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8630('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8630('0x2'));var moment=require(_0x8630('0x3'));var BPromise=require(_0x8630('0x4'));var Mustache=require(_0x8630('0x5'));var util=require(_0x8630('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8630('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0x7'));var querystring=require('querystring');var Papa=require(_0x8630('0xd'));var Redis=require('ioredis');var authService=require(_0x8630('0xe'));var qs=require(_0x8630('0xf'));var as=require(_0x8630('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x11'))(_0x8630('0x12'));var utils=require(_0x8630('0x13'));var config=require('../../config/environment');var db=require(_0x8630('0x14'))['db'];function respondWithStatusCode(_0x2cef7e,_0x5b6d75){_0x5b6d75=_0x5b6d75||0xcc;return function(_0x54073b){if(_0x54073b){return _0x2cef7e[_0x8630('0x15')](_0x5b6d75);}return _0x2cef7e[_0x8630('0x16')](_0x5b6d75)['end']();};}function respondWithResult(_0x3040be,_0x4db686){_0x4db686=_0x4db686||0xc8;return function(_0xf31c17){if(_0xf31c17){return _0x3040be['status'](_0x4db686)[_0x8630('0x17')](_0xf31c17);}};}function respondWithFilteredResult(_0x594e75,_0x53f236){return function(_0x29a42d){if(_0x29a42d){var _0x86c262=_0x29a42d['count'],_0x49fce1=_0x53f236[_0x8630('0x18')],_0x5c0ba0=_0x53f236[_0x8630('0x18')]+_0x53f236[_0x8630('0x19')],_0x3ea754;if(_0x5c0ba0>=_0x86c262){_0x5c0ba0=_0x86c262;_0x3ea754=0xc8;}else{_0x3ea754=0xce;}_0x594e75[_0x8630('0x16')](_0x3ea754);return _0x594e75[_0x8630('0x1a')](_0x8630('0x1b'),_0x49fce1+'-'+_0x5c0ba0+'/'+_0x86c262)[_0x8630('0x17')](_0x29a42d);}return null;};}function patchUpdates(_0x39edd5){return function(_0xe1ecd0){try{jsonpatch['apply'](_0xe1ecd0,_0x39edd5,!![]);}catch(_0x59bda7){return BPromise[_0x8630('0x1c')](_0x59bda7);}return _0xe1ecd0[_0x8630('0x1d')]();};}function saveUpdates(_0x557e74,_0x5cff5c){return function(_0x1325dc){if(_0x1325dc){return _0x1325dc[_0x8630('0x1e')](_0x557e74)[_0x8630('0x1f')](function(_0x491c65){return _0x491c65;});}return null;};}function removeEntity(_0x5ce487,_0xcc7454){return function(_0x58c0b5){if(_0x58c0b5){return _0x58c0b5[_0x8630('0x20')]()[_0x8630('0x1f')](function(){_0x5ce487[_0x8630('0x16')](0xcc)[_0x8630('0x21')]();});}};}function handleEntityNotFound(_0x4c2851,_0x37c224){return function(_0xf24c11){if(!_0xf24c11){_0x4c2851[_0x8630('0x15')](0x194);}return _0xf24c11;};}function handleError(_0x3d1eec,_0x41871a){_0x41871a=_0x41871a||0x1f4;return function(_0x309d04){logger[_0x8630('0x22')](_0x309d04['stack']);if(_0x309d04['name']){delete _0x309d04[_0x8630('0x23')];}_0x3d1eec[_0x8630('0x16')](_0x41871a)[_0x8630('0x24')](_0x309d04);};}exports[_0x8630('0x25')]=function(_0x2b1196,_0x1c012d){var _0x149a8e={},_0x349c4d={},_0x306ca2={'count':0x0,'rows':[]};var _0x357c15=_[_0x8630('0x26')](db[_0x8630('0x27')][_0x8630('0x28')],function(_0x4285ee){return{'name':_0x4285ee[_0x8630('0x29')],'type':_0x4285ee[_0x8630('0x2a')][_0x8630('0x2b')]};});_0x349c4d['model']=_[_0x8630('0x2c')](_[_0x8630('0x26')](_0x357c15,_0x8630('0x23')),[_0x8630('0x23')]);_0x349c4d['query']=_[_0x8630('0x2d')](_0x2b1196[_0x8630('0x2e')]);_0x349c4d[_0x8630('0x2f')]=_[_0x8630('0x30')](_0x349c4d[_0x8630('0x31')],_0x349c4d[_0x8630('0x2e')]);_0x149a8e['attributes']=_[_0x8630('0x30')](_0x349c4d[_0x8630('0x31')],qs[_0x8630('0x32')](_0x2b1196['query'][_0x8630('0x32')]));_0x149a8e[_0x8630('0x33')]=_0x149a8e[_0x8630('0x33')][_0x8630('0x34')]?_0x149a8e[_0x8630('0x33')]:_0x349c4d[_0x8630('0x31')];if(!_0x2b1196['query'][_0x8630('0x35')](_0x8630('0x36'))){_0x149a8e[_0x8630('0x19')]=qs[_0x8630('0x19')](_0x2b1196[_0x8630('0x2e')][_0x8630('0x19')]);_0x149a8e[_0x8630('0x18')]=qs[_0x8630('0x18')](_0x2b1196[_0x8630('0x2e')][_0x8630('0x18')]);}_0x149a8e[_0x8630('0x37')]=qs[_0x8630('0x38')](_0x2b1196[_0x8630('0x2e')][_0x8630('0x38')]);_0x149a8e[_0x8630('0x39')]=qs[_0x8630('0x2f')](_[_0x8630('0x3a')](_0x2b1196['query'],_0x349c4d[_0x8630('0x2f')]),_0x357c15);if(_0x2b1196[_0x8630('0x2e')]['filter']){_0x149a8e['where']=_[_0x8630('0x3b')](_0x149a8e[_0x8630('0x39')],{'$or':_[_0x8630('0x26')](_0x357c15,function(_0x580fd){if(_0x580fd[_0x8630('0x2a')]!=='VIRTUAL'){var _0x21e879={};_0x21e879[_0x580fd[_0x8630('0x23')]]={'$like':'%'+_0x2b1196[_0x8630('0x2e')][_0x8630('0x3c')]+'%'};return _0x21e879;}})});}_0x149a8e=_['merge']({},_0x149a8e,_0x2b1196[_0x8630('0x3d')]);var _0x437fde={'where':_0x149a8e[_0x8630('0x39')]};return db[_0x8630('0x27')][_0x8630('0x3e')](_0x437fde)[_0x8630('0x1f')](function(_0x2fbb8c){_0x306ca2['count']=_0x2fbb8c;if(_0x2b1196[_0x8630('0x2e')][_0x8630('0x3f')]){_0x149a8e[_0x8630('0x40')]=[{'all':!![]}];}return db[_0x8630('0x27')][_0x8630('0x41')](_0x149a8e);})[_0x8630('0x1f')](function(_0x25cb36){_0x306ca2[_0x8630('0x42')]=_0x25cb36;return _0x306ca2;})[_0x8630('0x1f')](respondWithFilteredResult(_0x1c012d,_0x149a8e))[_0x8630('0x43')](handleError(_0x1c012d,null));};exports['show']=function(_0x358431,_0x53882a){var _0x8b40e1={'raw':!![],'where':{'id':_0x358431[_0x8630('0x44')]['id']}},_0x475bb4={};_0x475bb4[_0x8630('0x31')]=_[_0x8630('0x2d')](db[_0x8630('0x27')]['rawAttributes']);_0x475bb4[_0x8630('0x2e')]=_[_0x8630('0x2d')](_0x358431[_0x8630('0x2e')]);_0x475bb4['filters']=_[_0x8630('0x30')](_0x475bb4[_0x8630('0x31')],_0x475bb4[_0x8630('0x2e')]);_0x8b40e1[_0x8630('0x33')]=_[_0x8630('0x30')](_0x475bb4[_0x8630('0x31')],qs['fields'](_0x358431[_0x8630('0x2e')][_0x8630('0x32')]));_0x8b40e1[_0x8630('0x33')]=_0x8b40e1['attributes'][_0x8630('0x34')]?_0x8b40e1[_0x8630('0x33')]:_0x475bb4['model'];if(_0x358431[_0x8630('0x2e')][_0x8630('0x3f')]){_0x8b40e1[_0x8630('0x40')]=[{'all':!![]}];}_0x8b40e1=_['merge']({},_0x8b40e1,_0x358431['options']);return db[_0x8630('0x27')]['find'](_0x8b40e1)['then'](handleEntityNotFound(_0x53882a,null))[_0x8630('0x1f')](respondWithResult(_0x53882a,null))['catch'](handleError(_0x53882a,null));};exports[_0x8630('0x45')]=function(_0x35a3c8,_0x4892f2){return db[_0x8630('0x27')][_0x8630('0x45')](_0x35a3c8[_0x8630('0x46')],{})[_0x8630('0x1f')](respondWithResult(_0x4892f2,0xc9))[_0x8630('0x43')](handleError(_0x4892f2,null));};exports['update']=function(_0x40c47d,_0x231289){if(_0x40c47d['body']['id']){delete _0x40c47d[_0x8630('0x46')]['id'];}return db[_0x8630('0x27')][_0x8630('0x47')]({'where':{'id':_0x40c47d['params']['id']}})[_0x8630('0x1f')](handleEntityNotFound(_0x231289,null))[_0x8630('0x1f')](saveUpdates(_0x40c47d[_0x8630('0x46')],null))[_0x8630('0x1f')](respondWithResult(_0x231289,null))[_0x8630('0x43')](handleError(_0x231289,null));};exports[_0x8630('0x20')]=function(_0xf70c93,_0x1fbf26){return db[_0x8630('0x27')]['find']({'where':{'id':_0xf70c93['params']['id']}})[_0x8630('0x1f')](handleEntityNotFound(_0x1fbf26,null))[_0x8630('0x1f')](removeEntity(_0x1fbf26,null))[_0x8630('0x43')](handleError(_0x1fbf26,null));};exports[_0x8630('0x48')]=function(_0x40cdec,_0x24a363,_0x4436aa){return db['VoiceMailMessage'][_0x8630('0x47')]({'where':{'id':_0x40cdec[_0x8630('0x44')]['id']},'attributes':['id',_0x8630('0x49'),_0x8630('0x4a')]})[_0x8630('0x1f')](handleEntityNotFound(_0x24a363,null))['then'](function(_0x398ea7){if(_0x398ea7){if(!_0x398ea7[_0x8630('0x49')]){throw new db[(_0x8630('0x4b'))][(_0x8630('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x250dd8={'Content-Type':_0x8630('0x4d'),'Content-Disposition':'attachment'};if(_0x398ea7[_0x8630('0x4a')]){_0x250dd8[_0x8630('0x4e')]=_0x8630('0x4f')+_0x398ea7[_0x8630('0x4a')]+'.wav\x22';}_0x24a363[_0x8630('0x1a')](_0x250dd8);return _0x24a363[_0x8630('0x24')](new Buffer(_0x398ea7['recording']));}})['catch'](handleError(_0x24a363,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 61ac62a..742800a 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 _0xd7d1=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x4387f2,_0x5e49b4){var _0x3ed955=function(_0x177d07){while(--_0x177d07){_0x4387f2['push'](_0x4387f2['shift']());}};_0x3ed955(++_0x5e49b4);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1d2252,_0x5b48d9){_0x1d2252=_0x1d2252-0x0;var _0x107e09=_0xd7d1[_0x1d2252];return _0x107e09;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[{'name':_0x1d7d('0xf'),'fields':[_0x1d7d('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0ffc=['voice_voicemail_messages','dir','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x10681c,_0x2ca74a){var _0x26aa5e=function(_0x211078){while(--_0x211078){_0x10681c['push'](_0x10681c['shift']());}};_0x26aa5e(++_0x2ca74a);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x46b1d0,_0x15ad34){_0x46b1d0=_0x46b1d0-0x0;var _0x29e368=_0x0ffc[_0x46b1d0];return _0x29e368;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var logger=require(_0xc0ff('0x1'))('api');var moment=require(_0xc0ff('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0ff('0x3'));var fs=require('fs');var path=require(_0xc0ff('0x4'));var rimraf=require(_0xc0ff('0x5'));var config=require(_0xc0ff('0x6'));var attributes=require(_0xc0ff('0x7'));module[_0xc0ff('0x8')]=function(_0x2fe7a2,_0x1b69a1){return _0x2fe7a2[_0xc0ff('0x9')]('VoiceMailMessage',attributes,{'tableName':_0xc0ff('0xa'),'paranoid':![],'indexes':[{'name':_0xc0ff('0xb'),'fields':[_0xc0ff('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 602284e..ef5ba0b 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x47e97c,_0x580b25){var _0x2f2891=function(_0x5a58e6){while(--_0x5a58e6){_0x47e97c['push'](_0x47e97c['shift']());}};_0x2f2891(++_0x580b25);}(_0x57ca,0x108));var _0xa57c=function(_0x49a6ba,_0x116f2c){_0x49a6ba=_0x49a6ba-0x0;var _0x517537=_0x57ca[_0x49a6ba];return _0x517537;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x109bbf,_0x382eed){var _0x36aac4=function(_0x1b300c){while(--_0x1b300c){_0x109bbf['push'](_0x109bbf['shift']());}};_0x36aac4(++_0x382eed);}(_0x1a85,0x178));var _0x51a8=function(_0x4d209b,_0x1a05e8){_0x4d209b=_0x4d209b-0x0;var _0xc5e693=_0x1a85[_0x4d209b];return _0xc5e693;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 92c5b6e..ffe3eda 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 _0x0346=['update','destroy','/:id/sounds/:id2','removeSound','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','addSound','put'];(function(_0x18e7fe,_0x2686fc){var _0x704fe2=function(_0x4f9138){while(--_0x4f9138){_0x18e7fe['push'](_0x18e7fe['shift']());}};_0x704fe2(++_0x2686fc);}(_0x0346,0x130));var _0x6034=function(_0x160170,_0x5596e0){_0x160170=_0x160170-0x0;var _0x1d81e7=_0x0346[_0x160170];return _0x1d81e7;};'use strict';var multer=require('multer');var util=require(_0x6034('0x0'));var path=require(_0x6034('0x1'));var timeout=require('connect-timeout');var express=require(_0x6034('0x2'));var router=express['Router']();var auth=require(_0x6034('0x3'));var interaction=require(_0x6034('0x4'));var config=require(_0x6034('0x5'));var controller=require(_0x6034('0x6'));router[_0x6034('0x7')]('/',auth[_0x6034('0x8')](),controller[_0x6034('0x9')]);router['get'](_0x6034('0xa'),auth[_0x6034('0x8')](),controller[_0x6034('0xb')]);router[_0x6034('0x7')](_0x6034('0xc'),auth[_0x6034('0x8')](),controller[_0x6034('0xd')]);router['post']('/',auth[_0x6034('0x8')](),controller[_0x6034('0xe')]);router[_0x6034('0xf')](_0x6034('0xc'),auth[_0x6034('0x8')](),controller[_0x6034('0x10')]);router[_0x6034('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6034('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6034('0x13')]);router['delete'](_0x6034('0x14'),auth['isAuthenticated'](),controller[_0x6034('0x15')]);module[_0x6034('0x16')]=router; \ No newline at end of file +var _0x47a5=['put','update','delete','/:id/sounds/:id2','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','post','create','/:id/sounds'];(function(_0x467578,_0x3ed8c7){var _0x52427f=function(_0x49c184){while(--_0x49c184){_0x467578['push'](_0x467578['shift']());}};_0x52427f(++_0x3ed8c7);}(_0x47a5,0x15a));var _0x547a=function(_0x25726d,_0x5b40ce){_0x25726d=_0x25726d-0x0;var _0x2f7b01=_0x47a5[_0x25726d];return _0x2f7b01;};'use strict';var multer=require(_0x547a('0x0'));var util=require(_0x547a('0x1'));var path=require('path');var timeout=require(_0x547a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x547a('0x3'));var interaction=require(_0x547a('0x4'));var config=require(_0x547a('0x5'));var controller=require(_0x547a('0x6'));router[_0x547a('0x7')]('/',auth[_0x547a('0x8')](),controller['index']);router[_0x547a('0x7')](_0x547a('0x9'),auth[_0x547a('0x8')](),controller[_0x547a('0xa')]);router[_0x547a('0x7')]('/:id/sounds',auth[_0x547a('0x8')](),controller['getSounds']);router[_0x547a('0xb')]('/',auth[_0x547a('0x8')](),controller[_0x547a('0xc')]);router['post'](_0x547a('0xd'),auth[_0x547a('0x8')](),controller['addSound']);router[_0x547a('0xe')](_0x547a('0x9'),auth[_0x547a('0x8')](),controller[_0x547a('0xf')]);router[_0x547a('0x10')]('/:id',auth[_0x547a('0x8')](),controller['destroy']);router[_0x547a('0x10')](_0x547a('0x11'),auth[_0x547a('0x8')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 141b3f8..484cc16 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 _0xc634=['files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3ce4af,_0x13187a){var _0x43985e=function(_0xebf2d5){while(--_0xebf2d5){_0x3ce4af['push'](_0x3ce4af['shift']());}};_0x43985e(++_0x13187a);}(_0xc634,0x173));var _0x4c63=function(_0x3b2c8e,_0x53910b){_0x3b2c8e=_0x3b2c8e-0x0;var _0x3ebe3d=_0xc634[_0x3b2c8e];return _0x3ebe3d;};'use strict';var Sequelize=require(_0x4c63('0x0'));module[_0x4c63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x4c63('0x2')]('custom',_0x4c63('0x3'),_0x4c63('0x4'),_0x4c63('0x5'),_0x4c63('0x6'),_0x4c63('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![],'defaultValue':_0x4c63('0x9')},'format':{'type':Sequelize[_0x4c63('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x4c63('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8bd5=['STRING','ENUM','files','mp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x343f84,_0x2723a4){var _0x434f34=function(_0x21ee02){while(--_0x21ee02){_0x343f84['push'](_0x343f84['shift']());}};_0x434f34(++_0x2723a4);}(_0x8bd5,0xd7));var _0x58bd=function(_0x18f58b,_0x91084a){_0x18f58b=_0x18f58b-0x0;var _0x2d9f69=_0x8bd5[_0x18f58b];return _0x2d9f69;};'use strict';var Sequelize=require(_0x58bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x58bd('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x58bd('0x2')]('custom',_0x58bd('0x3'),_0x58bd('0x4'),'quietmp3nb','quietmp3',_0x58bd('0x5')),'allowNull':!![],'defaultValue':_0x58bd('0x3')},'directory':{'type':Sequelize[_0x58bd('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x58bd('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x58bd('0x1')],'allowNull':!![],'defaultValue':_0x58bd('0x6')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x58bd('0x7')},'defaultEntry':{'type':Sequelize[_0x58bd('0x8')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index c37c5bc..d4e9a95 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(_0x351d6d,_0x4a3b0a){var _0x27336e=function(_0x4baa63){while(--_0x4baa63){_0x351d6d['push'](_0x351d6d['shift']());}};_0x27336e(++_0x4a3b0a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41f0a3,_0x2dfb5b){_0x41f0a3=_0x41f0a3-0x0;var _0x415a7d=_0x5f2f[_0x41f0a3];return _0x415a7d;};'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(_0x23ceda,_0x2314f9){var _0x19dfbf=function(_0xa80357){while(--_0xa80357){_0x23ceda['push'](_0x23ceda['shift']());}};_0x19dfbf(++_0x2314f9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a5e11,_0x346470){_0x3a5e11=_0x3a5e11-0x0;var _0x2ca2ba=_0xb10b[_0x3a5e11];return _0x2ca2ba;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 081e857..b4caed1 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 _0x0cc8=['request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x0cc8,0xd7));var _0x80cc=function(_0x5d76cc,_0x195736){_0x5d76cc=_0x5d76cc-0x0;var _0x4acce4=_0x0cc8[_0x5d76cc];return _0x4acce4;};'use strict';var _=require(_0x80cc('0x0'));var util=require(_0x80cc('0x1'));var logger=require(_0x80cc('0x2'))(_0x80cc('0x3'));var moment=require(_0x80cc('0x4'));var BPromise=require(_0x80cc('0x5'));var rp=require(_0x80cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80cc('0x7'));var config=require(_0x80cc('0x8'));var attributes=require(_0x80cc('0x9'));module[_0x80cc('0xa')]=function(_0x396eec,_0x30797e){return _0x396eec[_0x80cc('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x80cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2a=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda2a,0x143));var _0xada2=function(_0x2dbb87,_0x437249){_0x2dbb87=_0x2dbb87-0x0;var _0x41d28a=_0xda2a[_0x2dbb87];return _0x41d28a;};'use strict';var _=require(_0xada2('0x0'));var util=require('util');var logger=require(_0xada2('0x1'))(_0xada2('0x2'));var moment=require('moment');var BPromise=require(_0xada2('0x3'));var rp=require(_0xada2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xada2('0x5'));var config=require(_0xada2('0x6'));var attributes=require(_0xada2('0x7'));module[_0xada2('0x8')]=function(_0xf99488,_0xfc6052){return _0xf99488[_0xada2('0x9')](_0xada2('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index b78d97a..8bfe7dd 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 _0x07f6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3fbb93,_0x1f2e7f){var _0x270434=function(_0x20d29b){while(--_0x20d29b){_0x3fbb93['push'](_0x3fbb93['shift']());}};_0x270434(++_0x1f2e7f);}(_0x07f6,0x7b));var _0x607f=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x07f6[_0x3b87f4];return _0x63d16e;};'use strict';var _=require(_0x607f('0x0'));var util=require('util');var moment=require(_0x607f('0x1'));var BPromise=require('bluebird');var rs=require(_0x607f('0x2'));var fs=require('fs');var Redis=require(_0x607f('0x3'));var db=require(_0x607f('0x4'))['db'];var utils=require(_0x607f('0x5'));var logger=require(_0x607f('0x6'))(_0x607f('0x7'));var config=require(_0x607f('0x8'));var jayson=require(_0x607f('0x9'));var client=jayson[_0x607f('0xa')][_0x607f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ace71,_0x3c61ce,_0x21ca04){return new BPromise(function(_0x12fc31,_0x4aaa91){return client[_0x607f('0xc')](_0x4ace71,_0x21ca04)[_0x607f('0xd')](function(_0x15acf6){logger[_0x607f('0xe')](_0x607f('0xf'),_0x3c61ce,_0x607f('0x10'));logger[_0x607f('0x11')](_0x607f('0x12'),_0x3c61ce,'request\x20sent',JSON[_0x607f('0x13')](_0x15acf6));if(_0x15acf6[_0x607f('0x14')]){if(_0x15acf6[_0x607f('0x14')][_0x607f('0x15')]===0x1f4){logger[_0x607f('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3c61ce,_0x15acf6[_0x607f('0x14')][_0x607f('0x16')]);return _0x4aaa91(_0x15acf6[_0x607f('0x14')][_0x607f('0x16')]);}logger[_0x607f('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3c61ce,_0x15acf6[_0x607f('0x14')][_0x607f('0x16')]);return _0x12fc31(_0x15acf6['error']['message']);}else{logger['info'](_0x607f('0xf'),_0x3c61ce,_0x607f('0x10'));_0x12fc31(_0x15acf6[_0x607f('0x17')][_0x607f('0x16')]);}})[_0x607f('0x18')](function(_0x3ea7cb){logger['error'](_0x607f('0xf'),_0x3c61ce,_0x3ea7cb);_0x4aaa91(_0x3ea7cb);});});} \ No newline at end of file +var _0x658d=['request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x3d7e4a,_0x405640){var _0x43b14=function(_0x105ff4){while(--_0x105ff4){_0x3d7e4a['push'](_0x3d7e4a['shift']());}};_0x43b14(++_0x405640);}(_0x658d,0x6a));var _0xd658=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x658d[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0xd658('0x0'));var util=require('util');var moment=require(_0xd658('0x1'));var BPromise=require(_0xd658('0x2'));var rs=require(_0xd658('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd658('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd658('0x5'));var config=require(_0xd658('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd658('0x7')][_0xd658('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38324a,_0x19c2ee,_0x1049db){return new BPromise(function(_0x37c7e1,_0x59c525){return client[_0xd658('0x9')](_0x38324a,_0x1049db)[_0xd658('0xa')](function(_0x591b7e){logger[_0xd658('0xb')](_0xd658('0xc'),_0x19c2ee,'request\x20sent');logger['debug'](_0xd658('0xd'),_0x19c2ee,_0xd658('0xe'),JSON[_0xd658('0xf')](_0x591b7e));if(_0x591b7e['error']){if(_0x591b7e[_0xd658('0x10')][_0xd658('0x11')]===0x1f4){logger['error'](_0xd658('0xc'),_0x19c2ee,_0x591b7e[_0xd658('0x10')][_0xd658('0x12')]);return _0x59c525(_0x591b7e[_0xd658('0x10')]['message']);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x19c2ee,_0x591b7e[_0xd658('0x10')][_0xd658('0x12')]);return _0x37c7e1(_0x591b7e[_0xd658('0x10')]['message']);}else{logger[_0xd658('0xb')](_0xd658('0xc'),_0x19c2ee,_0xd658('0xe'));_0x37c7e1(_0x591b7e['result'][_0xd658('0x12')]);}})[_0xd658('0x13')](function(_0x391894){logger['error'](_0xd658('0xc'),_0x19c2ee,_0x391894);_0x59c525(_0x391894);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7aa1a36..095c2e2 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 _0xf96a=['describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf96a,0x13a));var _0xaf96=function(_0x4cc95a,_0x15c4c7){_0x4cc95a=_0x4cc95a-0x0;var _0x4abee3=_0xf96a[_0x4cc95a];return _0x4abee3;};'use strict';var multer=require(_0xaf96('0x0'));var util=require('util');var path=require(_0xaf96('0x1'));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('../../config/environment');var controller=require(_0xaf96('0x7'));router[_0xaf96('0x8')]('/',auth[_0xaf96('0x9')](),controller['index']);router[_0xaf96('0x8')](_0xaf96('0xa'),auth[_0xaf96('0x9')](),controller[_0xaf96('0xb')]);router[_0xaf96('0x8')](_0xaf96('0xc'),auth[_0xaf96('0x9')](),controller[_0xaf96('0xd')]);router[_0xaf96('0x8')](_0xaf96('0xe'),auth['isAuthenticated'](),controller[_0xaf96('0xf')]);router[_0xaf96('0x10')]('/',auth[_0xaf96('0x9')](),controller[_0xaf96('0x11')]);router[_0xaf96('0x10')]('/:id/users',auth[_0xaf96('0x9')](),controller[_0xaf96('0x12')]);router[_0xaf96('0x13')](_0xaf96('0xc'),auth['isAuthenticated'](),controller[_0xaf96('0x14')]);router['delete']('/:id',auth[_0xaf96('0x9')](),controller[_0xaf96('0x15')]);router[_0xaf96('0x16')](_0xaf96('0xe'),auth[_0xaf96('0x9')](),controller[_0xaf96('0x17')]);module[_0xaf96('0x18')]=router; \ No newline at end of file +var _0x6e80=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/users','addAgents'];(function(_0x45fd31,_0xd821b0){var _0x3e887f=function(_0x1c190c){while(--_0x1c190c){_0x45fd31['push'](_0x45fd31['shift']());}};_0x3e887f(++_0xd821b0);}(_0x6e80,0x1cd));var _0x06e8=function(_0xc4b034,_0x3eb4fa){_0xc4b034=_0xc4b034-0x0;var _0x55f2c1=_0x6e80[_0xc4b034];return _0x55f2c1;};'use strict';var multer=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var path=require(_0x06e8('0x2'));var timeout=require(_0x06e8('0x3'));var express=require(_0x06e8('0x4'));var router=express['Router']();var auth=require(_0x06e8('0x5'));var interaction=require(_0x06e8('0x6'));var config=require(_0x06e8('0x7'));var controller=require('./voicePrefix.controller');router[_0x06e8('0x8')]('/',auth[_0x06e8('0x9')](),controller[_0x06e8('0xa')]);router[_0x06e8('0x8')](_0x06e8('0xb'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xc')]);router['get'](_0x06e8('0xd'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xe')]);router[_0x06e8('0x8')]('/:id/users',auth[_0x06e8('0x9')](),controller['getAgents']);router[_0x06e8('0xf')]('/',auth['isAuthenticated'](),controller[_0x06e8('0x10')]);router[_0x06e8('0xf')](_0x06e8('0x11'),auth['isAuthenticated'](),controller[_0x06e8('0x12')]);router[_0x06e8('0x13')](_0x06e8('0xd'),auth[_0x06e8('0x9')](),controller[_0x06e8('0x14')]);router[_0x06e8('0x15')]('/:id',auth[_0x06e8('0x9')](),controller[_0x06e8('0x16')]);router[_0x06e8('0x15')](_0x06e8('0x11'),auth[_0x06e8('0x9')](),controller['removeAgents']);module[_0x06e8('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8113087..28c3198 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 _0xa35d=['VIRTUAL','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x373bec,_0x4790b5){var _0x33088f=function(_0x1edfe6){while(--_0x1edfe6){_0x373bec['push'](_0x373bec['shift']());}};_0x33088f(++_0x4790b5);}(_0xa35d,0x1d8));var _0xda35=function(_0x2fc3ae,_0x42da14){_0x2fc3ae=_0x2fc3ae-0x0;var _0x26175b=_0xa35d[_0x2fc3ae];return _0x26175b;};'use strict';var Sequelize=require(_0xda35('0x0'));module[_0xda35('0x1')]={'name':{'type':Sequelize[_0xda35('0x2')],'allowNull':![],'unique':_0xda35('0x3')},'prefix':{'type':Sequelize[_0xda35('0x4')],'get':function(_0xba556b){return'system-'+this[_0xda35('0x5')](_0xda35('0x3'))+'-';}},'description':{'type':Sequelize[_0xda35('0x2')]},'callerIdAll':{'type':Sequelize[_0xda35('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xda35('0x6')]}}; \ No newline at end of file +var _0x2964=['sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0xfea00d,_0x2f9177){var _0xa901f0=function(_0x4fad25){while(--_0x4fad25){_0xfea00d['push'](_0xfea00d['shift']());}};_0xa901f0(++_0x2f9177);}(_0x2964,0x108));var _0x4296=function(_0x113493,_0x17821d){_0x113493=_0x113493-0x0;var _0x2dd269=_0x2964[_0x113493];return _0x2dd269;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'name':{'type':Sequelize[_0x4296('0x2')],'allowNull':![],'unique':_0x4296('0x3')},'prefix':{'type':Sequelize[_0x4296('0x4')],'get':function(_0x1d5ab8){return _0x4296('0x5')+this[_0x4296('0x6')](_0x4296('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x4296('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4296('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5dffa5c..89ece40 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 _0x8513=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','include','findAll','rows','catch','options','create','sequelize','body','VoiceExtension','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','params','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8513,0x1b2));var _0x3851=function(_0x56d10b,_0x5e511b){_0x56d10b=_0x56d10b-0x0;var _0x5a9969=_0x8513[_0x56d10b];return _0x5a9969;};'use strict';var pdf=require(_0x3851('0x0'));var emlformat=require(_0x3851('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3851('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3851('0x3'));var moment=require(_0x3851('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3851('0x5'));var util=require(_0x3851('0x6'));var path=require('path');var sox=require(_0x3851('0x7'));var csv=require(_0x3851('0x8'));var ejs=require(_0x3851('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3851('0xa'));var crypto=require(_0x3851('0xb'));var jsforce=require(_0x3851('0xc'));var deskjs=require(_0x3851('0xd'));var toCsv=require(_0x3851('0x8'));var querystring=require('querystring');var Papa=require(_0x3851('0xe'));var Redis=require('ioredis');var authService=require(_0x3851('0xf'));var qs=require(_0x3851('0x10'));var as=require(_0x3851('0x11'));var hardwareService=require(_0x3851('0x12'));var logger=require('../../config/logger')(_0x3851('0x13'));var utils=require(_0x3851('0x14'));var config=require(_0x3851('0x15'));var db=require('../../mysqldb')['db'];config[_0x3851('0x16')]=_[_0x3851('0x17')](config[_0x3851('0x16')],{'host':_0x3851('0x18'),'port':0x18eb});var socket=require(_0x3851('0x19'))(new Redis(config[_0x3851('0x16')]));require(_0x3851('0x1a'))['register'](socket);function respondWithStatusCode(_0x3f33da,_0x5ec4cf){_0x5ec4cf=_0x5ec4cf||0xcc;return function(_0x4f7d7c){if(_0x4f7d7c){return _0x3f33da[_0x3851('0x1b')](_0x5ec4cf);}return _0x3f33da[_0x3851('0x1c')](_0x5ec4cf)[_0x3851('0x1d')]();};}function respondWithResult(_0x5250f2,_0x6d55bb){_0x6d55bb=_0x6d55bb||0xc8;return function(_0x573596){if(_0x573596){return _0x5250f2[_0x3851('0x1c')](_0x6d55bb)[_0x3851('0x1e')](_0x573596);}};}function respondWithFilteredResult(_0x20c8df,_0x5142d8){return function(_0x3c19dd){if(_0x3c19dd){var _0x4743ba=_0x3c19dd[_0x3851('0x1f')],_0x4f3e5d=_0x5142d8[_0x3851('0x20')],_0x5566cb=_0x5142d8[_0x3851('0x20')]+_0x5142d8[_0x3851('0x21')],_0xbc7696;if(_0x5566cb>=_0x4743ba){_0x5566cb=_0x4743ba;_0xbc7696=0xc8;}else{_0xbc7696=0xce;}_0x20c8df['status'](_0xbc7696);return _0x20c8df[_0x3851('0x22')](_0x3851('0x23'),_0x4f3e5d+'-'+_0x5566cb+'/'+_0x4743ba)[_0x3851('0x1e')](_0x3c19dd);}return null;};}function patchUpdates(_0x1916cc){return function(_0xbb19ef){try{jsonpatch[_0x3851('0x24')](_0xbb19ef,_0x1916cc,!![]);}catch(_0x1bbd57){return BPromise[_0x3851('0x25')](_0x1bbd57);}return _0xbb19ef['save']();};}function saveUpdates(_0x2113b4,_0x8ffb84){return function(_0x49b8fb){if(_0x49b8fb){return _0x49b8fb[_0x3851('0x26')](_0x2113b4)[_0x3851('0x27')](function(_0x373733){return _0x373733;});}return null;};}function removeEntity(_0x52462a,_0x49ed4f){return function(_0x55a67f){if(_0x55a67f){return _0x55a67f[_0x3851('0x28')]()[_0x3851('0x27')](function(){var _0xd05492=_0x55a67f[_0x3851('0x29')]({'plain':!![]});var _0x2e6125=_0x3851('0x2a');return db['UserProfileResource'][_0x3851('0x28')]({'where':{'type':_0x2e6125,'resourceId':_0xd05492['id']}})[_0x3851('0x27')](function(){return _0x55a67f;});})[_0x3851('0x27')](function(){_0x52462a[_0x3851('0x1c')](0xcc)[_0x3851('0x1d')]();});}};}function handleEntityNotFound(_0x58f0cc,_0x20fd39){return function(_0x4bbddd){if(!_0x4bbddd){_0x58f0cc[_0x3851('0x1b')](0x194);}return _0x4bbddd;};}function handleError(_0x461d5e,_0x39f2d0){_0x39f2d0=_0x39f2d0||0x1f4;return function(_0x29e387){logger[_0x3851('0x2b')](_0x29e387[_0x3851('0x2c')]);if(_0x29e387['name']){delete _0x29e387[_0x3851('0x2d')];}_0x461d5e[_0x3851('0x1c')](_0x39f2d0)[_0x3851('0x2e')](_0x29e387);};}exports['index']=function(_0x3a1b98,_0x30dc13){var _0x1ffbe1={},_0x355f82={},_0x1d6fc1={'count':0x0,'rows':[]};var _0x1eb9e9=_[_0x3851('0x2f')](db[_0x3851('0x30')][_0x3851('0x31')],function(_0x2434d3){return{'name':_0x2434d3[_0x3851('0x32')],'type':_0x2434d3[_0x3851('0x33')][_0x3851('0x34')]};});_0x355f82[_0x3851('0x35')]=_['map'](_0x1eb9e9,_0x3851('0x2d'));_0x355f82[_0x3851('0x36')]=_[_0x3851('0x37')](_0x3a1b98[_0x3851('0x36')]);_0x355f82[_0x3851('0x38')]=_[_0x3851('0x39')](_0x355f82[_0x3851('0x35')],_0x355f82['query']);_0x1ffbe1['attributes']=_['intersection'](_0x355f82[_0x3851('0x35')],qs[_0x3851('0x3a')](_0x3a1b98[_0x3851('0x36')]['fields']));_0x1ffbe1[_0x3851('0x3b')]=_0x1ffbe1[_0x3851('0x3b')][_0x3851('0x3c')]?_0x1ffbe1['attributes']:_0x355f82[_0x3851('0x35')];if(!_0x3a1b98[_0x3851('0x36')][_0x3851('0x3d')](_0x3851('0x3e'))){_0x1ffbe1[_0x3851('0x21')]=qs[_0x3851('0x21')](_0x3a1b98['query'][_0x3851('0x21')]);_0x1ffbe1[_0x3851('0x20')]=qs['offset'](_0x3a1b98[_0x3851('0x36')]['offset']);}_0x1ffbe1[_0x3851('0x3f')]=qs[_0x3851('0x40')](_0x3a1b98[_0x3851('0x36')][_0x3851('0x40')]);_0x1ffbe1[_0x3851('0x41')]=qs[_0x3851('0x38')](_['pick'](_0x3a1b98['query'],_0x355f82[_0x3851('0x38')]),_0x1eb9e9);if(_0x3a1b98['query']['filter']){_0x1ffbe1['where']=_[_0x3851('0x42')](_0x1ffbe1[_0x3851('0x41')],{'$or':_[_0x3851('0x2f')](_0x1eb9e9,function(_0x223ee0){if(_0x223ee0[_0x3851('0x33')]!=='VIRTUAL'){var _0x553ebd={};_0x553ebd[_0x223ee0[_0x3851('0x2d')]]={'$like':'%'+_0x3a1b98[_0x3851('0x36')][_0x3851('0x43')]+'%'};return _0x553ebd;}})});}_0x1ffbe1=_[_0x3851('0x42')]({},_0x1ffbe1,_0x3a1b98['options']);var _0x1bc245={'where':_0x1ffbe1[_0x3851('0x41')]};return db['VoicePrefix'][_0x3851('0x1f')](_0x1bc245)[_0x3851('0x27')](function(_0x1634fb){_0x1d6fc1[_0x3851('0x1f')]=_0x1634fb;if(_0x3a1b98['query'][_0x3851('0x44')]){_0x1ffbe1[_0x3851('0x45')]=[{'all':!![]}];}return db[_0x3851('0x30')][_0x3851('0x46')](_0x1ffbe1);})[_0x3851('0x27')](function(_0x224ed0){_0x1d6fc1[_0x3851('0x47')]=_0x224ed0;return _0x1d6fc1;})[_0x3851('0x27')](respondWithFilteredResult(_0x30dc13,_0x1ffbe1))[_0x3851('0x48')](handleError(_0x30dc13,null));};exports['show']=function(_0x4f2403,_0x3508ab){var _0x3baba1={'raw':![],'where':{'id':_0x4f2403['params']['id']}},_0x3ef700={};_0x3ef700[_0x3851('0x35')]=_[_0x3851('0x37')](db[_0x3851('0x30')]['rawAttributes']);_0x3ef700[_0x3851('0x36')]=_[_0x3851('0x37')](_0x4f2403[_0x3851('0x36')]);_0x3ef700[_0x3851('0x38')]=_['intersection'](_0x3ef700[_0x3851('0x35')],_0x3ef700['query']);_0x3baba1['attributes']=_['intersection'](_0x3ef700[_0x3851('0x35')],qs[_0x3851('0x3a')](_0x4f2403['query'][_0x3851('0x3a')]));_0x3baba1[_0x3851('0x3b')]=_0x3baba1[_0x3851('0x3b')][_0x3851('0x3c')]?_0x3baba1[_0x3851('0x3b')]:_0x3ef700[_0x3851('0x35')];if(_0x4f2403['query'][_0x3851('0x44')]){_0x3baba1[_0x3851('0x45')]=[{'all':!![]}];}_0x3baba1=_['merge']({},_0x3baba1,_0x4f2403[_0x3851('0x49')]);return db[_0x3851('0x30')]['find'](_0x3baba1)['then'](handleEntityNotFound(_0x3508ab,null))[_0x3851('0x27')](respondWithResult(_0x3508ab,null))[_0x3851('0x48')](handleError(_0x3508ab,null));};exports['destroy']=function(_0x2930a1,_0x3a2624){return db[_0x3851('0x30')]['find']({'where':{'id':_0x2930a1['params']['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x3a2624,null))[_0x3851('0x27')](removeEntity(_0x3a2624,null))[_0x3851('0x48')](handleError(_0x3a2624,null));};exports['describe']=function(_0x366440,_0x29362d){return db['VoicePrefix']['describe']()[_0x3851('0x27')](respondWithResult(_0x29362d,null))[_0x3851('0x48')](handleError(_0x29362d,null));};exports[_0x3851('0x4a')]=function(_0x308f5d,_0x29d5d2){var _0x59ecbe;return db[_0x3851('0x4b')]['transaction'](function(_0x2b4e25){return db[_0x3851('0x30')]['create'](_0x308f5d[_0x3851('0x4c')],{'transaction':_0x2b4e25})['then'](function(_0x814b3){_0x59ecbe=_0x814b3[_0x3851('0x29')]({'plain':!![]});return db[_0x3851('0x4d')][_0x3851('0x4e')]({'where':{'id':_0x59ecbe['VoiceExtensionId']},'raw':!![]})[_0x3851('0x27')](function(_0x57eba5){return createVoicePrefixExtensions(_0x59ecbe,_0x57eba5,_0x2b4e25);});});})[_0x3851('0x27')](function(){var _0x19870f=_0x308f5d[_0x3851('0x4f')][_0x3851('0x29')]({'plain':!![]});if(!_0x19870f)throw new Error(_0x3851('0x50'));if(_0x19870f[_0x3851('0x51')]===_0x3851('0x4f')){var _0x3e2225=_0x59ecbe;return db[_0x3851('0x52')]['find']({'where':{'name':_0x3851('0x2a'),'userProfileId':_0x19870f['userProfileId']},'raw':!![]})['then'](function(_0x536588){if(_0x536588&&_0x536588['autoAssociation']===0x0){return db[_0x3851('0x53')][_0x3851('0x4a')]({'name':_0x3e2225[_0x3851('0x2d')],'resourceId':_0x3e2225['id'],'type':_0x536588[_0x3851('0x2d')],'sectionId':_0x536588['id']},{})[_0x3851('0x27')](function(){return _0x59ecbe;});}else{return _0x59ecbe;}})[_0x3851('0x48')](function(_0x659621){logger['error'](_0x3851('0x54'),_0x659621);throw _0x659621;});}return _0x59ecbe;})[_0x3851('0x27')](respondWithResult(_0x29d5d2,null))['catch'](handleError(_0x29d5d2,null));};function Extension(_0x5c01bd,_0x23daa4,_0x5c128d,_0x31121a){this['context']='from-sip';this[_0x3851('0x55')]=_0x5c01bd;this[_0x3851('0x56')]=_0x5c128d;this[_0x3851('0x33')]=_0x3851('0x57');this[_0x3851('0x58')]='Voice\x20Prefix\x20Extension';this[_0x3851('0x59')]=_0x23daa4;this[_0x3851('0x5a')]=_0x31121a;}function createVoicePrefixExtensions(_0x1ec38a,_0x47663e,_0x2022a7){return new BPromise(function(_0x58f290,_0x57ff83){var _0xf55816=new Extension(formatPrefixName(_0x1ec38a[_0x3851('0x5b')]),0x1,_0x3851('0x5c'),_0x3851('0x5d'));_0xf55816[_0x3851('0x5e')]=_0x1ec38a['id'];return db[_0x3851('0x4d')][_0x3851('0x4a')](_0xf55816,{'transaction':_0x2022a7})['then'](function(_0x2d79ff){var _0x49f2de=_0x2d79ff[_0x3851('0x29')]({'plain':!![]});var _0x4055d2=_['map'](addVoicePrefixExtensions(_0x1ec38a,_0x47663e),function(_0x1ecb61){_0x1ecb61[_0x3851('0x5f')]=_0x49f2de['id'];_0x1ecb61[_0x3851('0x5e')]=_0x1ec38a['id'];return _0x1ecb61;});return db[_0x3851('0x4d')][_0x3851('0x60')](_0x4055d2,{'transaction':_0x2022a7})[_0x3851('0x27')](function(_0xc07e6f){if(!_0xc07e6f){return _0x57ff83(_0x3851('0x61'));}else{return _0x58f290(_0xc07e6f);}})['catch'](function(_0x5452d7){return _0x57ff83(_0x5452d7);});});;});};function addVoicePrefixExtensions(_0x16cca9,_0x29970f){var _0x34dda5=[];var _0x565dc6=formatPrefixName(_0x16cca9[_0x3851('0x5b')]);_0x34dda5['push'](new Extension(_0x565dc6,0x2,'Set',_0x3851('0x62')+_0x16cca9[_0x3851('0x2d')]));if(_0x16cca9[_0x3851('0x63')]){_0x34dda5[_0x3851('0x64')](new Extension(_0x565dc6,0x3,_0x3851('0x65'),_0x3851('0x66')+_0x16cca9[_0x3851('0x63')]));}else{_0x34dda5[_0x3851('0x64')](new Extension(_0x565dc6,0x3,_0x3851('0x5c'),_0x3851('0x67')));}_0x34dda5['push'](new Extension(_0x565dc6,0x4,'goto',_0x29970f['context']+','+_0x3851('0x68')+(0x8+_0x16cca9[_0x3851('0x2d')]['length'])+'}'+','+0x1));return _0x34dda5;}function formatPrefixName(_0x48b41b){var _0x8e269f='_';for(var _0x5e3b55=0x0;_0x5e3b55<_0x48b41b[_0x3851('0x3c')];_0x5e3b55++){if(_0x48b41b[_0x3851('0x69')](_0x5e3b55)=='-'){_0x8e269f+=_0x48b41b['charAt'](_0x5e3b55);}else{_0x8e269f+='['+_0x48b41b[_0x3851('0x69')](_0x5e3b55)+']';}}_0x8e269f+='.';return _0x8e269f;}exports['update']=function(_0x330fee,_0x1d3435,_0x59c0a0){var _0x2f2c0d=_0x330fee[_0x3851('0x4c')];_0x2f2c0d['prefix']=_0x3851('0x6a')+_0x2f2c0d[_0x3851('0x2d')]+'-';return db[_0x3851('0x4b')][_0x3851('0x6b')](function(_0x1a7995){return db[_0x3851('0x30')][_0x3851('0x26')](_0x2f2c0d,{'where':{'id':_0x2f2c0d['id']},'transaction':_0x1a7995})[_0x3851('0x27')](function(){return db[_0x3851('0x4d')]['destroy']({'where':{'VoicePrefixId':_0x2f2c0d['id']},'transaction':_0x1a7995})[_0x3851('0x27')](function(){return db['VoiceExtension'][_0x3851('0x4e')]({'where':{'id':_0x2f2c0d[_0x3851('0x5f')]},'raw':!![]})[_0x3851('0x27')](function(_0x10fc8e){return createVoicePrefixExtensions(_0x2f2c0d,_0x10fc8e,_0x1a7995);});});});})[_0x3851('0x27')](function(){return db[_0x3851('0x30')][_0x3851('0x6c')](_0x2f2c0d['id']);})[_0x3851('0x27')](respondWithResult(_0x1d3435,null))[_0x3851('0x48')](handleError(_0x1d3435,null));};exports[_0x3851('0x6d')]=function(_0x24f29b,_0x488ac0,_0x5ad8a7){return db[_0x3851('0x30')][_0x3851('0x4e')]({'where':{'id':_0x24f29b[_0x3851('0x6e')]['id']}})['then'](handleEntityNotFound(_0x488ac0,null))[_0x3851('0x27')](function(_0x55edde){if(_0x55edde){return _0x55edde[_0x3851('0x6d')](_0x24f29b[_0x3851('0x4c')]['ids'],_[_0x3851('0x6f')](_0x24f29b[_0x3851('0x4c')],[_0x3851('0x70'),'id'])||{})[_0x3851('0x71')](function(_0x265996){for(var _0x2a0ebf=0x0;_0x2a0ebf<_0x24f29b[_0x3851('0x4c')][_0x3851('0x70')][_0x3851('0x3c')];_0x2a0ebf+=0x1){socket[_0x3851('0x72')](_0x3851('0x73'),{'UserId':_0x24f29b[_0x3851('0x4c')][_0x3851('0x70')][_0x2a0ebf],'VoicePrefixId':_0x24f29b[_0x3851('0x6e')]['id']});}return _0x265996;});}})[_0x3851('0x27')](respondWithResult(_0x488ac0,null))['catch'](handleError(_0x488ac0,null));};exports['removeAgents']=function(_0x4a5c54,_0x5abd1f,_0x597c74){return db[_0x3851('0x30')][_0x3851('0x4e')]({'where':{'id':_0x4a5c54[_0x3851('0x6e')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x5abd1f,null))[_0x3851('0x27')](function(_0x1f8bf5){if(_0x1f8bf5){return _0x1f8bf5[_0x3851('0x74')](_0x4a5c54[_0x3851('0x36')][_0x3851('0x70')])[_0x3851('0x27')](function(){if(_[_0x3851('0x75')](_0x4a5c54[_0x3851('0x36')]['ids'])){for(var _0x523661=0x0;_0x523661<_0x4a5c54[_0x3851('0x36')]['ids'][_0x3851('0x3c')];_0x523661+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4a5c54[_0x3851('0x36')][_0x3851('0x70')][_0x523661]),'VoicePrefixId':Number(_0x4a5c54[_0x3851('0x6e')]['id'])});}}else{socket[_0x3851('0x72')](_0x3851('0x76'),{'UserId':Number(_0x4a5c54[_0x3851('0x36')][_0x3851('0x70')]),'VoicePrefixId':Number(_0x4a5c54['params']['id'])});}});}})[_0x3851('0x27')](respondWithStatusCode(_0x5abd1f,null))[_0x3851('0x48')](handleError(_0x5abd1f,null));};exports[_0x3851('0x77')]=function(_0x3c2a37,_0x2f4dbc,_0x377801){var _0x2441e5={};var _0x5a132f={};var _0x1d39b9;var _0x242eef;return db[_0x3851('0x30')][_0x3851('0x78')]({'where':{'id':_0x3c2a37[_0x3851('0x6e')]['id']}})[_0x3851('0x27')](handleEntityNotFound(_0x2f4dbc,null))[_0x3851('0x27')](function(_0x28f87b){if(_0x28f87b){_0x1d39b9=_0x28f87b;_0x5a132f['model']=_[_0x3851('0x37')](db[_0x3851('0x79')][_0x3851('0x31')]);_0x5a132f[_0x3851('0x36')]=_[_0x3851('0x37')](_0x3c2a37[_0x3851('0x36')]);_0x5a132f[_0x3851('0x38')]=_[_0x3851('0x39')](_0x5a132f[_0x3851('0x35')],_0x5a132f[_0x3851('0x36')]);_0x2441e5['attributes']=_[_0x3851('0x39')](_0x5a132f[_0x3851('0x35')],qs[_0x3851('0x3a')](_0x3c2a37[_0x3851('0x36')][_0x3851('0x3a')]));_0x2441e5[_0x3851('0x3b')]=_0x2441e5[_0x3851('0x3b')]['length']?_0x2441e5['attributes']:_0x5a132f[_0x3851('0x35')];_0x2441e5['order']=qs['sort'](_0x3c2a37[_0x3851('0x36')][_0x3851('0x40')]);_0x2441e5[_0x3851('0x41')]=qs['filters'](_[_0x3851('0x7a')](_0x3c2a37[_0x3851('0x36')],_0x5a132f[_0x3851('0x38')]));if(_0x3c2a37['query'][_0x3851('0x43')]){_0x2441e5[_0x3851('0x41')]=_[_0x3851('0x42')](_0x2441e5[_0x3851('0x41')],{'$or':_[_0x3851('0x2f')](_0x2441e5['attributes'],function(_0x5df43e){var _0x561482={};_0x561482[_0x5df43e]={'$like':'%'+_0x3c2a37[_0x3851('0x36')][_0x3851('0x43')]+'%'};return _0x561482;})});}_0x2441e5=_[_0x3851('0x42')]({},_0x2441e5,_0x3c2a37[_0x3851('0x49')]);return _0x1d39b9[_0x3851('0x77')](_0x2441e5);}})[_0x3851('0x27')](function(_0x2000c7){if(_0x2000c7){_0x242eef=_0x2000c7[_0x3851('0x3c')];if(!_0x3c2a37[_0x3851('0x36')]['hasOwnProperty'](_0x3851('0x3e'))){_0x2441e5[_0x3851('0x21')]=qs['limit'](_0x3c2a37['query'][_0x3851('0x21')]);_0x2441e5[_0x3851('0x20')]=qs[_0x3851('0x20')](_0x3c2a37[_0x3851('0x36')][_0x3851('0x20')]);}return _0x1d39b9['getAgents'](_0x2441e5);}})[_0x3851('0x27')](function(_0x21c6fb){if(_0x21c6fb){return _0x21c6fb?{'count':_0x242eef,'rows':_0x21c6fb}:null;}})['then'](respondWithResult(_0x2f4dbc,null))[_0x3851('0x48')](handleError(_0x2f4dbc,null));}; \ No newline at end of file +var _0x1816=['destroy','error','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','length','find','describe','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','charAt','findById','addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get'];(function(_0x3d0c55,_0x141639){var _0x2f5712=function(_0x1f3ce1){while(--_0x1f3ce1){_0x3d0c55['push'](_0x3d0c55['shift']());}};_0x2f5712(++_0x141639);}(_0x1816,0x1c3));var _0x6181=function(_0x46bb1c,_0x127bcf){_0x46bb1c=_0x46bb1c-0x0;var _0x476450=_0x1816[_0x46bb1c];return _0x476450;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6181('0x0'));var zipdir=require(_0x6181('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6181('0x2'));var BPromise=require(_0x6181('0x3'));var Mustache=require(_0x6181('0x4'));var util=require(_0x6181('0x5'));var path=require(_0x6181('0x6'));var sox=require('sox');var csv=require(_0x6181('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6181('0x8'));var squel=require('squel');var crypto=require(_0x6181('0x9'));var jsforce=require(_0x6181('0xa'));var deskjs=require(_0x6181('0xb'));var toCsv=require(_0x6181('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6181('0xc'));var authService=require(_0x6181('0xd'));var qs=require(_0x6181('0xe'));var as=require(_0x6181('0xf'));var hardwareService=require(_0x6181('0x10'));var logger=require(_0x6181('0x11'))(_0x6181('0x12'));var utils=require(_0x6181('0x13'));var config=require(_0x6181('0x14'));var db=require(_0x6181('0x15'))['db'];config[_0x6181('0x16')]=_['defaults'](config['redis'],{'host':_0x6181('0x17'),'port':0x18eb});var socket=require(_0x6181('0x18'))(new Redis(config[_0x6181('0x16')]));require(_0x6181('0x19'))[_0x6181('0x1a')](socket);function respondWithStatusCode(_0xb1a14f,_0x2afbae){_0x2afbae=_0x2afbae||0xcc;return function(_0x1a2c5d){if(_0x1a2c5d){return _0xb1a14f[_0x6181('0x1b')](_0x2afbae);}return _0xb1a14f[_0x6181('0x1c')](_0x2afbae)[_0x6181('0x1d')]();};}function respondWithResult(_0x24530d,_0x3c1f95){_0x3c1f95=_0x3c1f95||0xc8;return function(_0x2d8d37){if(_0x2d8d37){return _0x24530d['status'](_0x3c1f95)[_0x6181('0x1e')](_0x2d8d37);}};}function respondWithFilteredResult(_0x27bc9b,_0x2363e8){return function(_0x1f0292){if(_0x1f0292){var _0x1d7376=_0x1f0292[_0x6181('0x1f')],_0x4313bd=_0x2363e8[_0x6181('0x20')],_0x1f3831=_0x2363e8[_0x6181('0x20')]+_0x2363e8['limit'],_0x27b35d;if(_0x1f3831>=_0x1d7376){_0x1f3831=_0x1d7376;_0x27b35d=0xc8;}else{_0x27b35d=0xce;}_0x27bc9b[_0x6181('0x1c')](_0x27b35d);return _0x27bc9b[_0x6181('0x21')](_0x6181('0x22'),_0x4313bd+'-'+_0x1f3831+'/'+_0x1d7376)[_0x6181('0x1e')](_0x1f0292);}return null;};}function patchUpdates(_0x10acaf){return function(_0x46597b){try{jsonpatch[_0x6181('0x23')](_0x46597b,_0x10acaf,!![]);}catch(_0x336885){return BPromise[_0x6181('0x24')](_0x336885);}return _0x46597b[_0x6181('0x25')]();};}function saveUpdates(_0x30bd21,_0xee3e9c){return function(_0x2dde1a){if(_0x2dde1a){return _0x2dde1a[_0x6181('0x26')](_0x30bd21)[_0x6181('0x27')](function(_0x4eab2e){return _0x4eab2e;});}return null;};}function removeEntity(_0x8e643a,_0x277815){return function(_0x166e34){if(_0x166e34){return _0x166e34['destroy']()[_0x6181('0x27')](function(){var _0x1851e8=_0x166e34[_0x6181('0x28')]({'plain':!![]});var _0x535c69='VoicePrefixes';return db['UserProfileResource'][_0x6181('0x29')]({'where':{'type':_0x535c69,'resourceId':_0x1851e8['id']}})[_0x6181('0x27')](function(){return _0x166e34;});})['then'](function(){_0x8e643a[_0x6181('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e2396,_0x18d254){return function(_0x5e780d){if(!_0x5e780d){_0x6e2396[_0x6181('0x1b')](0x194);}return _0x5e780d;};}function handleError(_0x5c37d1,_0x48a355){_0x48a355=_0x48a355||0x1f4;return function(_0x432102){logger[_0x6181('0x2a')](_0x432102[_0x6181('0x2b')]);if(_0x432102[_0x6181('0x2c')]){delete _0x432102[_0x6181('0x2c')];}_0x5c37d1[_0x6181('0x1c')](_0x48a355)[_0x6181('0x2d')](_0x432102);};}exports[_0x6181('0x2e')]=function(_0x309951,_0x24e80e){var _0x23badd={},_0x4e583c={},_0x492674={'count':0x0,'rows':[]};var _0x138732=_[_0x6181('0x2f')](db['VoicePrefix']['rawAttributes'],function(_0x2f0046){return{'name':_0x2f0046[_0x6181('0x30')],'type':_0x2f0046[_0x6181('0x31')]['key']};});_0x4e583c[_0x6181('0x32')]=_[_0x6181('0x2f')](_0x138732,'name');_0x4e583c['query']=_[_0x6181('0x33')](_0x309951[_0x6181('0x34')]);_0x4e583c[_0x6181('0x35')]=_['intersection'](_0x4e583c[_0x6181('0x32')],_0x4e583c[_0x6181('0x34')]);_0x23badd['attributes']=_[_0x6181('0x36')](_0x4e583c[_0x6181('0x32')],qs[_0x6181('0x37')](_0x309951[_0x6181('0x34')]['fields']));_0x23badd[_0x6181('0x38')]=_0x23badd[_0x6181('0x38')]['length']?_0x23badd[_0x6181('0x38')]:_0x4e583c[_0x6181('0x32')];if(!_0x309951[_0x6181('0x34')][_0x6181('0x39')]('nolimit')){_0x23badd[_0x6181('0x3a')]=qs[_0x6181('0x3a')](_0x309951[_0x6181('0x34')][_0x6181('0x3a')]);_0x23badd[_0x6181('0x20')]=qs[_0x6181('0x20')](_0x309951[_0x6181('0x34')][_0x6181('0x20')]);}_0x23badd[_0x6181('0x3b')]=qs[_0x6181('0x3c')](_0x309951[_0x6181('0x34')][_0x6181('0x3c')]);_0x23badd['where']=qs[_0x6181('0x35')](_[_0x6181('0x3d')](_0x309951[_0x6181('0x34')],_0x4e583c[_0x6181('0x35')]),_0x138732);if(_0x309951[_0x6181('0x34')]['filter']){_0x23badd['where']=_['merge'](_0x23badd[_0x6181('0x3e')],{'$or':_[_0x6181('0x2f')](_0x138732,function(_0x3938da){if(_0x3938da[_0x6181('0x31')]!==_0x6181('0x3f')){var _0x5282a6={};_0x5282a6[_0x3938da[_0x6181('0x2c')]]={'$like':'%'+_0x309951[_0x6181('0x34')][_0x6181('0x40')]+'%'};return _0x5282a6;}})});}_0x23badd=_[_0x6181('0x41')]({},_0x23badd,_0x309951[_0x6181('0x42')]);var _0x97732a={'where':_0x23badd[_0x6181('0x3e')]};return db[_0x6181('0x43')][_0x6181('0x1f')](_0x97732a)[_0x6181('0x27')](function(_0x5359c1){_0x492674['count']=_0x5359c1;if(_0x309951['query'][_0x6181('0x44')]){_0x23badd[_0x6181('0x45')]=[{'all':!![]}];}return db[_0x6181('0x43')][_0x6181('0x46')](_0x23badd);})[_0x6181('0x27')](function(_0x4bfb1b){_0x492674[_0x6181('0x47')]=_0x4bfb1b;return _0x492674;})[_0x6181('0x27')](respondWithFilteredResult(_0x24e80e,_0x23badd))[_0x6181('0x48')](handleError(_0x24e80e,null));};exports[_0x6181('0x49')]=function(_0x9ff42f,_0x4481db){var _0x22ed45={'raw':![],'where':{'id':_0x9ff42f[_0x6181('0x4a')]['id']}},_0x2cc138={};_0x2cc138[_0x6181('0x32')]=_[_0x6181('0x33')](db['VoicePrefix']['rawAttributes']);_0x2cc138[_0x6181('0x34')]=_[_0x6181('0x33')](_0x9ff42f['query']);_0x2cc138[_0x6181('0x35')]=_['intersection'](_0x2cc138['model'],_0x2cc138['query']);_0x22ed45[_0x6181('0x38')]=_[_0x6181('0x36')](_0x2cc138[_0x6181('0x32')],qs['fields'](_0x9ff42f[_0x6181('0x34')][_0x6181('0x37')]));_0x22ed45[_0x6181('0x38')]=_0x22ed45[_0x6181('0x38')][_0x6181('0x4b')]?_0x22ed45[_0x6181('0x38')]:_0x2cc138[_0x6181('0x32')];if(_0x9ff42f[_0x6181('0x34')][_0x6181('0x44')]){_0x22ed45[_0x6181('0x45')]=[{'all':!![]}];}_0x22ed45=_[_0x6181('0x41')]({},_0x22ed45,_0x9ff42f[_0x6181('0x42')]);return db[_0x6181('0x43')]['find'](_0x22ed45)['then'](handleEntityNotFound(_0x4481db,null))[_0x6181('0x27')](respondWithResult(_0x4481db,null))[_0x6181('0x48')](handleError(_0x4481db,null));};exports[_0x6181('0x29')]=function(_0x50d024,_0x558384){return db['VoicePrefix'][_0x6181('0x4c')]({'where':{'id':_0x50d024[_0x6181('0x4a')]['id']}})[_0x6181('0x27')](handleEntityNotFound(_0x558384,null))[_0x6181('0x27')](removeEntity(_0x558384,null))['catch'](handleError(_0x558384,null));};exports[_0x6181('0x4d')]=function(_0x3e9800,_0x2e50a){return db[_0x6181('0x43')][_0x6181('0x4d')]()['then'](respondWithResult(_0x2e50a,null))[_0x6181('0x48')](handleError(_0x2e50a,null));};exports[_0x6181('0x4e')]=function(_0x14b3c5,_0x2176b5){var _0x41d4e4;return db[_0x6181('0x4f')][_0x6181('0x50')](function(_0x13afa6){return db['VoicePrefix'][_0x6181('0x4e')](_0x14b3c5[_0x6181('0x51')],{'transaction':_0x13afa6})[_0x6181('0x27')](function(_0x1a7352){_0x41d4e4=_0x1a7352[_0x6181('0x28')]({'plain':!![]});return db[_0x6181('0x52')]['find']({'where':{'id':_0x41d4e4['VoiceExtensionId']},'raw':!![]})[_0x6181('0x27')](function(_0x8ed0da){return createVoicePrefixExtensions(_0x41d4e4,_0x8ed0da,_0x13afa6);});});})[_0x6181('0x27')](function(){var _0x106c96=_0x14b3c5[_0x6181('0x53')][_0x6181('0x28')]({'plain':!![]});if(!_0x106c96)throw new Error(_0x6181('0x54'));if(_0x106c96['role']==='user'){var _0x13edfe=_0x41d4e4;return db[_0x6181('0x55')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x106c96[_0x6181('0x56')]},'raw':!![]})[_0x6181('0x27')](function(_0x308ce4){if(_0x308ce4&&_0x308ce4[_0x6181('0x57')]===0x0){return db[_0x6181('0x58')][_0x6181('0x4e')]({'name':_0x13edfe[_0x6181('0x2c')],'resourceId':_0x13edfe['id'],'type':_0x308ce4[_0x6181('0x2c')],'sectionId':_0x308ce4['id']},{})[_0x6181('0x27')](function(){return _0x41d4e4;});}else{return _0x41d4e4;}})[_0x6181('0x48')](function(_0x283d0d){logger['error'](_0x6181('0x59'),_0x283d0d);throw _0x283d0d;});}return _0x41d4e4;})[_0x6181('0x27')](respondWithResult(_0x2176b5,null))[_0x6181('0x48')](handleError(_0x2176b5,null));};function Extension(_0xca8e09,_0x40b53e,_0x461e41,_0x39ffbd){this[_0x6181('0x5a')]=_0x6181('0x5b');this[_0x6181('0x5c')]=_0xca8e09;this['app']=_0x461e41;this[_0x6181('0x31')]=_0x6181('0x5d');this['description']=_0x6181('0x5e');this[_0x6181('0x5f')]=_0x40b53e;this['appdata']=_0x39ffbd;}function createVoicePrefixExtensions(_0x2bed3b,_0x42761e,_0x5622d5){return new BPromise(function(_0xde8d67,_0x5b2b52){var _0x1f0453=new Extension(formatPrefixName(_0x2bed3b[_0x6181('0x60')]),0x1,_0x6181('0x61'),_0x6181('0x62'));_0x1f0453[_0x6181('0x63')]=_0x2bed3b['id'];return db['VoiceExtension']['create'](_0x1f0453,{'transaction':_0x5622d5})[_0x6181('0x27')](function(_0x4ada29){var _0x42dc4a=_0x4ada29[_0x6181('0x28')]({'plain':!![]});var _0x31c335=_[_0x6181('0x2f')](addVoicePrefixExtensions(_0x2bed3b,_0x42761e),function(_0x1cadb7){_0x1cadb7[_0x6181('0x64')]=_0x42dc4a['id'];_0x1cadb7[_0x6181('0x63')]=_0x2bed3b['id'];return _0x1cadb7;});return db[_0x6181('0x52')][_0x6181('0x65')](_0x31c335,{'transaction':_0x5622d5})[_0x6181('0x27')](function(_0xd0ca40){if(!_0xd0ca40){return _0x5b2b52(_0x6181('0x66'));}else{return _0xde8d67(_0xd0ca40);}})[_0x6181('0x48')](function(_0x463cb4){return _0x5b2b52(_0x463cb4);});});;});};function addVoicePrefixExtensions(_0x1aba9e,_0x3d7fee){var _0x571ce9=[];var _0x372b88=formatPrefixName(_0x1aba9e[_0x6181('0x60')]);_0x571ce9[_0x6181('0x67')](new Extension(_0x372b88,0x2,_0x6181('0x68'),_0x6181('0x69')+_0x1aba9e[_0x6181('0x2c')]));if(_0x1aba9e[_0x6181('0x6a')]){_0x571ce9['push'](new Extension(_0x372b88,0x3,_0x6181('0x68'),'PREFIX-CALLERIDALL='+_0x1aba9e[_0x6181('0x6a')]));}else{_0x571ce9[_0x6181('0x67')](new Extension(_0x372b88,0x3,_0x6181('0x61'),'No\x20callerid\x20available'));}_0x571ce9[_0x6181('0x67')](new Extension(_0x372b88,0x4,_0x6181('0x6b'),_0x3d7fee[_0x6181('0x5a')]+','+'${EXTEN:'+(0x8+_0x1aba9e[_0x6181('0x2c')][_0x6181('0x4b')])+'}'+','+0x1));return _0x571ce9;}function formatPrefixName(_0x2091a6){var _0x12478b='_';for(var _0x5cb79d=0x0;_0x5cb79d<_0x2091a6[_0x6181('0x4b')];_0x5cb79d++){if(_0x2091a6[_0x6181('0x6c')](_0x5cb79d)=='-'){_0x12478b+=_0x2091a6[_0x6181('0x6c')](_0x5cb79d);}else{_0x12478b+='['+_0x2091a6[_0x6181('0x6c')](_0x5cb79d)+']';}}_0x12478b+='.';return _0x12478b;}exports[_0x6181('0x26')]=function(_0x48777c,_0x1eb1ad,_0x41ce3a){var _0x5d34c3=_0x48777c[_0x6181('0x51')];_0x5d34c3[_0x6181('0x60')]='system-'+_0x5d34c3[_0x6181('0x2c')]+'-';return db['sequelize']['transaction'](function(_0x15a645){return db[_0x6181('0x43')][_0x6181('0x26')](_0x5d34c3,{'where':{'id':_0x5d34c3['id']},'transaction':_0x15a645})['then'](function(){return db[_0x6181('0x52')][_0x6181('0x29')]({'where':{'VoicePrefixId':_0x5d34c3['id']},'transaction':_0x15a645})[_0x6181('0x27')](function(){return db[_0x6181('0x52')][_0x6181('0x4c')]({'where':{'id':_0x5d34c3[_0x6181('0x64')]},'raw':!![]})[_0x6181('0x27')](function(_0x1cc1aa){return createVoicePrefixExtensions(_0x5d34c3,_0x1cc1aa,_0x15a645);});});});})['then'](function(){return db[_0x6181('0x43')][_0x6181('0x6d')](_0x5d34c3['id']);})['then'](respondWithResult(_0x1eb1ad,null))[_0x6181('0x48')](handleError(_0x1eb1ad,null));};exports['addAgents']=function(_0x580e3e,_0x350403,_0x2cab5a){return db['VoicePrefix'][_0x6181('0x4c')]({'where':{'id':_0x580e3e['params']['id']}})[_0x6181('0x27')](handleEntityNotFound(_0x350403,null))[_0x6181('0x27')](function(_0x4b20ce){if(_0x4b20ce){return _0x4b20ce[_0x6181('0x6e')](_0x580e3e['body']['ids'],_[_0x6181('0x6f')](_0x580e3e[_0x6181('0x51')],[_0x6181('0x70'),'id'])||{})[_0x6181('0x71')](function(_0x504aac){for(var _0xe1e2a8=0x0;_0xe1e2a8<_0x580e3e['body'][_0x6181('0x70')]['length'];_0xe1e2a8+=0x1){socket['emit'](_0x6181('0x72'),{'UserId':_0x580e3e['body']['ids'][_0xe1e2a8],'VoicePrefixId':_0x580e3e[_0x6181('0x4a')]['id']});}return _0x504aac;});}})[_0x6181('0x27')](respondWithResult(_0x350403,null))[_0x6181('0x48')](handleError(_0x350403,null));};exports[_0x6181('0x73')]=function(_0x195aa0,_0x3b166f,_0x52be47){return db[_0x6181('0x43')][_0x6181('0x4c')]({'where':{'id':_0x195aa0[_0x6181('0x4a')]['id']}})[_0x6181('0x27')](handleEntityNotFound(_0x3b166f,null))[_0x6181('0x27')](function(_0x8985de){if(_0x8985de){return _0x8985de[_0x6181('0x73')](_0x195aa0[_0x6181('0x34')][_0x6181('0x70')])[_0x6181('0x27')](function(){if(_[_0x6181('0x74')](_0x195aa0[_0x6181('0x34')][_0x6181('0x70')])){for(var _0x19f427=0x0;_0x19f427<_0x195aa0['query'][_0x6181('0x70')][_0x6181('0x4b')];_0x19f427+=0x1){socket[_0x6181('0x75')](_0x6181('0x76'),{'UserId':Number(_0x195aa0[_0x6181('0x34')][_0x6181('0x70')][_0x19f427]),'VoicePrefixId':Number(_0x195aa0[_0x6181('0x4a')]['id'])});}}else{socket[_0x6181('0x75')](_0x6181('0x76'),{'UserId':Number(_0x195aa0[_0x6181('0x34')][_0x6181('0x70')]),'VoicePrefixId':Number(_0x195aa0[_0x6181('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b166f,null))[_0x6181('0x48')](handleError(_0x3b166f,null));};exports[_0x6181('0x77')]=function(_0x55bfbe,_0xf61ce9,_0x58c7ba){var _0x25cf79={};var _0x5add56={};var _0x52534;var _0x3884b2;return db['VoicePrefix'][_0x6181('0x78')]({'where':{'id':_0x55bfbe[_0x6181('0x4a')]['id']}})[_0x6181('0x27')](handleEntityNotFound(_0xf61ce9,null))[_0x6181('0x27')](function(_0x536e62){if(_0x536e62){_0x52534=_0x536e62;_0x5add56['model']=_['keys'](db[_0x6181('0x79')][_0x6181('0x7a')]);_0x5add56[_0x6181('0x34')]=_[_0x6181('0x33')](_0x55bfbe['query']);_0x5add56['filters']=_[_0x6181('0x36')](_0x5add56['model'],_0x5add56[_0x6181('0x34')]);_0x25cf79[_0x6181('0x38')]=_[_0x6181('0x36')](_0x5add56[_0x6181('0x32')],qs[_0x6181('0x37')](_0x55bfbe[_0x6181('0x34')][_0x6181('0x37')]));_0x25cf79[_0x6181('0x38')]=_0x25cf79[_0x6181('0x38')][_0x6181('0x4b')]?_0x25cf79['attributes']:_0x5add56[_0x6181('0x32')];_0x25cf79[_0x6181('0x3b')]=qs[_0x6181('0x3c')](_0x55bfbe[_0x6181('0x34')][_0x6181('0x3c')]);_0x25cf79[_0x6181('0x3e')]=qs[_0x6181('0x35')](_[_0x6181('0x3d')](_0x55bfbe['query'],_0x5add56['filters']));if(_0x55bfbe[_0x6181('0x34')][_0x6181('0x40')]){_0x25cf79[_0x6181('0x3e')]=_[_0x6181('0x41')](_0x25cf79[_0x6181('0x3e')],{'$or':_[_0x6181('0x2f')](_0x25cf79[_0x6181('0x38')],function(_0x49bfc6){var _0x445307={};_0x445307[_0x49bfc6]={'$like':'%'+_0x55bfbe[_0x6181('0x34')]['filter']+'%'};return _0x445307;})});}_0x25cf79=_[_0x6181('0x41')]({},_0x25cf79,_0x55bfbe[_0x6181('0x42')]);return _0x52534['getAgents'](_0x25cf79);}})['then'](function(_0x5b934a){if(_0x5b934a){_0x3884b2=_0x5b934a[_0x6181('0x4b')];if(!_0x55bfbe[_0x6181('0x34')][_0x6181('0x39')]('nolimit')){_0x25cf79[_0x6181('0x3a')]=qs[_0x6181('0x3a')](_0x55bfbe[_0x6181('0x34')][_0x6181('0x3a')]);_0x25cf79[_0x6181('0x20')]=qs['offset'](_0x55bfbe[_0x6181('0x34')][_0x6181('0x20')]);}return _0x52534[_0x6181('0x77')](_0x25cf79);}})[_0x6181('0x27')](function(_0x5cbeb4){if(_0x5cbeb4){return _0x5cbeb4?{'count':_0x3884b2,'rows':_0x5cbeb4}:null;}})[_0x6181('0x27')](respondWithResult(_0xf61ce9,null))[_0x6181('0x48')](handleError(_0xf61ce9,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5b233bf..51cb816 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x34e8,0x12c));var _0x834e=function(_0x49917a,_0x38e29a){_0x49917a=_0x49917a-0x0;var _0x1ae91e=_0x34e8[_0x49917a];return _0x1ae91e;};'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 +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x4d84b8,_0x11645f){var _0x179857=function(_0x2a23b9){while(--_0x2a23b9){_0x4d84b8['push'](_0x4d84b8['shift']());}};_0x179857(++_0x11645f);}(_0x008c,0x188));var _0xc008=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x008c[_0x4c06ac];return _0x2333cb;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ac01f4b..33ec691 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 _0xeddd=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','lodash'];(function(_0x101237,_0x448f24){var _0x50ede4=function(_0x4d858d){while(--_0x4d858d){_0x101237['push'](_0x101237['shift']());}};_0x50ede4(++_0x448f24);}(_0xeddd,0xd0));var _0xdedd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeddd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdedd('0x2'));var BPromise=require(_0xdedd('0x3'));var rp=require(_0xdedd('0x4'));var fs=require('fs');var path=require(_0xdedd('0x5'));var rimraf=require(_0xdedd('0x6'));var config=require(_0xdedd('0x7'));var attributes=require('./voicePrefix.attributes');module[_0xdedd('0x8')]=function(_0x5b0d82,_0x36fe1e){return _0x5b0d82[_0xdedd('0x9')](_0xdedd('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9559=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','VoicePrefix'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x9559,0xcf));var _0x9955=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x9559[_0x107f10];return _0x811cab;};'use strict';var _=require('lodash');var util=require(_0x9955('0x0'));var logger=require(_0x9955('0x1'))(_0x9955('0x2'));var moment=require('moment');var BPromise=require(_0x9955('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9955('0x4'));var rimraf=require('rimraf');var config=require(_0x9955('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x9955('0x6')]=function(_0x2bda7c,_0x41eca4){return _0x2bda7c[_0x9955('0x7')](_0x9955('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index bb928fa..badef6b 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 _0x6b89=['localhost','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x6b89,0x186));var _0x96b8=function(_0x460452,_0x3b0d60){_0x460452=_0x460452-0x0;var _0xa06647=_0x6b89[_0x460452];return _0xa06647;};'use strict';var _=require('lodash');var util=require(_0x96b8('0x0'));var moment=require(_0x96b8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b8('0x2'));var db=require(_0x96b8('0x3'))['db'];var utils=require(_0x96b8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x96b8('0x5'));var jayson=require(_0x96b8('0x6'));var client=jayson['client'][_0x96b8('0x7')]({'port':0x232a});config['redis']=_[_0x96b8('0x8')](config[_0x96b8('0x9')],{'host':_0x96b8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x96b8('0xb'))['register'](socket);function respondWithRpcPromise(_0x3824a4,_0x3e6237,_0x3d331c){return new BPromise(function(_0x23d805,_0x47d6aa){return client[_0x96b8('0xc')](_0x3824a4,_0x3d331c)[_0x96b8('0xd')](function(_0x17883a){logger['info'](_0x96b8('0xe'),_0x3e6237,_0x96b8('0xf'));logger[_0x96b8('0x10')](_0x96b8('0x11'),_0x3e6237,'request\x20sent',JSON[_0x96b8('0x12')](_0x17883a));if(_0x17883a['error']){if(_0x17883a['error'][_0x96b8('0x13')]===0x1f4){logger[_0x96b8('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x3e6237,_0x17883a[_0x96b8('0x14')][_0x96b8('0x15')]);return _0x47d6aa(_0x17883a['error']['message']);}logger[_0x96b8('0x14')](_0x96b8('0xe'),_0x3e6237,_0x17883a[_0x96b8('0x14')][_0x96b8('0x15')]);return _0x23d805(_0x17883a['error'][_0x96b8('0x15')]);}else{logger[_0x96b8('0x16')](_0x96b8('0xe'),_0x3e6237,_0x96b8('0xf'));_0x23d805(_0x17883a[_0x96b8('0x17')]['message']);}})[_0x96b8('0x18')](function(_0x36af6e){logger[_0x96b8('0x14')](_0x96b8('0xe'),_0x3e6237,_0x36af6e);_0x47d6aa(_0x36af6e);});});} \ No newline at end of file +var _0x6094=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket','register','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x36625f,_0x727bd6){var _0x135981=function(_0x1d8f24){while(--_0x1d8f24){_0x36625f['push'](_0x36625f['shift']());}};_0x135981(++_0x727bd6);}(_0x6094,0x9c));var _0x4609=function(_0x5ceff9,_0x366c83){_0x5ceff9=_0x5ceff9-0x0;var _0x4a95cc=_0x6094[_0x5ceff9];return _0x4a95cc;};'use strict';var _=require(_0x4609('0x0'));var util=require(_0x4609('0x1'));var moment=require(_0x4609('0x2'));var BPromise=require('bluebird');var rs=require(_0x4609('0x3'));var fs=require('fs');var Redis=require(_0x4609('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4609('0x5'));var logger=require(_0x4609('0x6'))(_0x4609('0x7'));var config=require(_0x4609('0x8'));var jayson=require(_0x4609('0x9'));var client=jayson[_0x4609('0xa')][_0x4609('0xb')]({'port':0x232a});config[_0x4609('0xc')]=_['defaults'](config[_0x4609('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4609('0xd'))(new Redis(config[_0x4609('0xc')]));require(_0x4609('0xe'))[_0x4609('0xf')](socket);function respondWithRpcPromise(_0x4cef76,_0x2d9650,_0x481fe6){return new BPromise(function(_0x41857a,_0x2f1884){return client['request'](_0x4cef76,_0x481fe6)['then'](function(_0x214ded){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2d9650,_0x4609('0x10'));logger[_0x4609('0x11')](_0x4609('0x12'),_0x2d9650,_0x4609('0x10'),JSON[_0x4609('0x13')](_0x214ded));if(_0x214ded[_0x4609('0x14')]){if(_0x214ded['error'][_0x4609('0x15')]===0x1f4){logger[_0x4609('0x14')](_0x4609('0x16'),_0x2d9650,_0x214ded['error'][_0x4609('0x17')]);return _0x2f1884(_0x214ded[_0x4609('0x14')]['message']);}logger['error'](_0x4609('0x16'),_0x2d9650,_0x214ded[_0x4609('0x14')][_0x4609('0x17')]);return _0x41857a(_0x214ded[_0x4609('0x14')][_0x4609('0x17')]);}else{logger[_0x4609('0x18')](_0x4609('0x16'),_0x2d9650,_0x4609('0x10'));_0x41857a(_0x214ded[_0x4609('0x19')][_0x4609('0x17')]);}})[_0x4609('0x1a')](function(_0x364268){logger[_0x4609('0x14')](_0x4609('0x16'),_0x2d9650,_0x364268);_0x2f1884(_0x364268);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 490c939..e584da4 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 _0x172f=['length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener','register'];(function(_0x14b66e,_0xcc9bd7){var _0x455907=function(_0x2bccef){while(--_0x2bccef){_0x14b66e['push'](_0x14b66e['shift']());}};_0x455907(++_0xcc9bd7);}(_0x172f,0xfa));var _0xf172=function(_0x28e90d,_0x3d6244){_0x28e90d=_0x28e90d-0x0;var _0x103d54=_0x172f[_0x28e90d];return _0x103d54;};'use strict';var VoicePrefixEvents=require(_0xf172('0x0'));var events=[_0xf172('0x1'),_0xf172('0x2'),'update'];function createListener(_0xa1d60,_0x30d46f){return function(_0x3d145a){_0x30d46f[_0xf172('0x3')](_0xa1d60,_0x3d145a);};}function removeListener(_0xd38b74,_0x2c00a0){return function(){VoicePrefixEvents[_0xf172('0x4')](_0xd38b74,_0x2c00a0);};}exports[_0xf172('0x5')]=function(_0x4d97d4){for(var _0x442ba4=0x0,_0x308782=events[_0xf172('0x6')];_0x442ba4<_0x308782;_0x442ba4++){var _0x14275c=events[_0x442ba4];var _0x494049=createListener(_0xf172('0x7')+_0x14275c,_0x4d97d4);VoicePrefixEvents['on'](_0x14275c,_0x494049);}}; \ No newline at end of file +var _0x1f13=['./voicePrefix.events','save','remove','emit','removeListener','length','voicePrefix:'];(function(_0x596722,_0x118ded){var _0x39aece=function(_0x23c09c){while(--_0x23c09c){_0x596722['push'](_0x596722['shift']());}};_0x39aece(++_0x118ded);}(_0x1f13,0x165));var _0x31f1=function(_0x2165e9,_0x119d54){_0x2165e9=_0x2165e9-0x0;var _0x5faaaf=_0x1f13[_0x2165e9];return _0x5faaaf;};'use strict';var VoicePrefixEvents=require(_0x31f1('0x0'));var events=[_0x31f1('0x1'),_0x31f1('0x2'),'update'];function createListener(_0x36d62a,_0x2ecd41){return function(_0x2d3982){_0x2ecd41[_0x31f1('0x3')](_0x36d62a,_0x2d3982);};}function removeListener(_0x205d6d,_0x57a12c){return function(){VoicePrefixEvents[_0x31f1('0x4')](_0x205d6d,_0x57a12c);};}exports['register']=function(_0x26b68e){for(var _0x9b6388=0x0,_0x48f28d=events[_0x31f1('0x5')];_0x9b6388<_0x48f28d;_0x9b6388++){var _0x2a4468=events[_0x9b6388];var _0x41e1e6=createListener(_0x31f1('0x6')+_0x2a4468,_0x26b68e);VoicePrefixEvents['on'](_0x2a4468,_0x41e1e6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 528ae85..e725a80 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 _0xe15a=['/:id/hopper_finals','getHopperFinals','getAgents','/:id/members','getMembers','getLists','post','create','/:id/clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','update','destroy','delete','/:id/teams','removeTeams','/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x440031,_0x4d84f5){var _0x4d2561=function(_0x25a6dd){while(--_0x25a6dd){_0x440031['push'](_0x440031['shift']());}};_0x4d2561(++_0x4d84f5);}(_0xe15a,0xb4));var _0xae15=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xe15a[_0x178f52];return _0x556f99;};'use strict';var multer=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var path=require(_0xae15('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae15('0x3')]();var auth=require(_0xae15('0x4'));var interaction=require(_0xae15('0x5'));var config=require('../../config/environment');var controller=require(_0xae15('0x6'));router[_0xae15('0x7')]('/',auth[_0xae15('0x8')](),controller[_0xae15('0x9')]);router[_0xae15('0x7')](_0xae15('0xa'),auth[_0xae15('0x8')](),controller['show']);router['get'](_0xae15('0xb'),auth[_0xae15('0x8')](),controller[_0xae15('0xc')]);router['get'](_0xae15('0xd'),auth['isAuthenticated'](),controller[_0xae15('0xe')]);router['get'](_0xae15('0xf'),auth['isAuthenticated'](),controller[_0xae15('0x10')]);router[_0xae15('0x7')]('/:id/hopper_black',auth[_0xae15('0x8')](),controller['getHopperBlacks']);router[_0xae15('0x7')]('/:id/teams',auth[_0xae15('0x8')](),controller['getTeams']);router[_0xae15('0x7')]('/:id/users',auth[_0xae15('0x8')](),controller[_0xae15('0x11')]);router[_0xae15('0x7')](_0xae15('0x12'),auth[_0xae15('0x8')](),controller[_0xae15('0x13')]);router['get']('/:id/lists',auth[_0xae15('0x8')](),controller[_0xae15('0x14')]);router[_0xae15('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0xae15('0x15')]('/',auth[_0xae15('0x8')](),controller[_0xae15('0x16')]);router[_0xae15('0x15')](_0xae15('0x17'),auth[_0xae15('0x8')](),controller['clone']);router[_0xae15('0x15')]('/:id/teams',auth[_0xae15('0x8')](),controller[_0xae15('0x18')]);router[_0xae15('0x15')](_0xae15('0x19'),auth[_0xae15('0x8')](),controller[_0xae15('0x1a')]);router[_0xae15('0x15')]('/:id/lists',auth[_0xae15('0x8')](),controller[_0xae15('0x1b')]);router[_0xae15('0x15')]('/:id/blacklists',auth[_0xae15('0x8')](),controller[_0xae15('0x1c')]);router[_0xae15('0x1d')](_0xae15('0xa'),auth[_0xae15('0x8')](),controller[_0xae15('0x1e')]);router['delete'](_0xae15('0xa'),auth[_0xae15('0x8')](),controller[_0xae15('0x1f')]);router[_0xae15('0x20')](_0xae15('0x21'),auth[_0xae15('0x8')](),controller[_0xae15('0x22')]);router[_0xae15('0x20')](_0xae15('0x19'),auth[_0xae15('0x8')](),controller['removeAgents']);router[_0xae15('0x20')](_0xae15('0x23'),auth['isAuthenticated'](),controller[_0xae15('0x24')]);router[_0xae15('0x20')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xae15('0x25')]);module[_0xae15('0x26')]=router; \ No newline at end of file +var _0x2dbc=['getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','/:id/clone','clone','post','addTeams','addAgents','addLists','/:id/blacklists','addBlackLists','/:id','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams'];(function(_0x154766,_0x24b85f){var _0x5c5d21=function(_0x464a90){while(--_0x464a90){_0x154766['push'](_0x154766['shift']());}};_0x5c5d21(++_0x24b85f);}(_0x2dbc,0x16e));var _0xc2db=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2dbc[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xc2db('0x0'));var util=require(_0xc2db('0x1'));var path=require(_0xc2db('0x2'));var timeout=require(_0xc2db('0x3'));var express=require(_0xc2db('0x4'));var router=express[_0xc2db('0x5')]();var auth=require(_0xc2db('0x6'));var interaction=require(_0xc2db('0x7'));var config=require(_0xc2db('0x8'));var controller=require(_0xc2db('0x9'));router['get']('/',auth[_0xc2db('0xa')](),controller['index']);router[_0xc2db('0xb')]('/:id',auth[_0xc2db('0xa')](),controller[_0xc2db('0xc')]);router[_0xc2db('0xb')](_0xc2db('0xd'),auth[_0xc2db('0xa')](),controller[_0xc2db('0xe')]);router['get'](_0xc2db('0xf'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x10')]);router[_0xc2db('0xb')]('/:id/hopper_finals',auth[_0xc2db('0xa')](),controller[_0xc2db('0x11')]);router[_0xc2db('0xb')](_0xc2db('0x12'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x13')]);router[_0xc2db('0xb')](_0xc2db('0x14'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x15')]);router[_0xc2db('0xb')](_0xc2db('0x16'),auth['isAuthenticated'](),controller[_0xc2db('0x17')]);router[_0xc2db('0xb')](_0xc2db('0x18'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x19')]);router[_0xc2db('0xb')](_0xc2db('0x1a'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x1b')]);router[_0xc2db('0xb')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xc2db('0x1c')]);router['post']('/',auth[_0xc2db('0xa')](),controller['create']);router['post'](_0xc2db('0x1d'),auth['isAuthenticated'](),controller[_0xc2db('0x1e')]);router[_0xc2db('0x1f')](_0xc2db('0x14'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x20')]);router['post'](_0xc2db('0x16'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x21')]);router[_0xc2db('0x1f')](_0xc2db('0x1a'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x22')]);router[_0xc2db('0x1f')](_0xc2db('0x23'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x24')]);router['put'](_0xc2db('0x25'),auth['isAuthenticated'](),controller[_0xc2db('0x26')]);router[_0xc2db('0x27')]('/:id',auth[_0xc2db('0xa')](),controller['destroy']);router[_0xc2db('0x27')](_0xc2db('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc2db('0x27')](_0xc2db('0x16'),auth[_0xc2db('0xa')](),controller['removeAgents']);router[_0xc2db('0x27')](_0xc2db('0x1a'),auth[_0xc2db('0xa')](),controller[_0xc2db('0x28')]);router[_0xc2db('0x27')]('/:id/blacklists',auth[_0xc2db('0xa')](),controller[_0xc2db('0x29')]);module[_0xc2db('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 06a2dc1..defce4c 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(_0x2f229a,_0x542731){var _0xdd2c1f=function(_0x39f8f4){while(--_0x39f8f4){_0x2f229a['push'](_0x2f229a['shift']());}};_0xdd2c1f(++_0x542731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 18f3a47..01d4337 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 _0x242d=['include','findAll','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','options','rows','order','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','isNil','interface','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','cm_contacts','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./voiceQueue.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','name','UserProfileResource','send','index','VoiceQueue','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x242d,0x11e));var _0xd242=function(_0x37bb3e,_0x295424){_0x37bb3e=_0x37bb3e-0x0;var _0x5331d2=_0x242d[_0x37bb3e];return _0x5331d2;};'use strict';var pdf=require(_0xd242('0x0'));var emlformat=require(_0xd242('0x1'));var rimraf=require(_0xd242('0x2'));var zipdir=require(_0xd242('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd242('0x4'));var moment=require('moment');var BPromise=require(_0xd242('0x5'));var Mustache=require(_0xd242('0x6'));var util=require(_0xd242('0x7'));var path=require(_0xd242('0x8'));var sox=require('sox');var csv=require(_0xd242('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd242('0xa'));var squel=require(_0xd242('0xb'));var crypto=require(_0xd242('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd242('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd242('0xe'));var Papa=require(_0xd242('0xf'));var Redis=require(_0xd242('0x10'));var authService=require(_0xd242('0x11'));var qs=require(_0xd242('0x12'));var as=require(_0xd242('0x13'));var hardwareService=require(_0xd242('0x14'));var logger=require(_0xd242('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd242('0x16'));var db=require(_0xd242('0x17'))['db'];config[_0xd242('0x18')]=_[_0xd242('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd242('0x18')]));require(_0xd242('0x1a'))['register'](socket);function respondWithStatusCode(_0x515de4,_0x5ca96b){_0x5ca96b=_0x5ca96b||0xcc;return function(_0xc85a12){if(_0xc85a12){return _0x515de4[_0xd242('0x1b')](_0x5ca96b);}return _0x515de4[_0xd242('0x1c')](_0x5ca96b)[_0xd242('0x1d')]();};}function respondWithResult(_0x4df330,_0x50a39d){_0x50a39d=_0x50a39d||0xc8;return function(_0x183082){if(_0x183082){return _0x4df330[_0xd242('0x1c')](_0x50a39d)['json'](_0x183082);}};}function respondWithFilteredResult(_0x470d3e,_0xeddf9c){return function(_0x1496c7){if(_0x1496c7){var _0x585ce7=_0x1496c7[_0xd242('0x1e')],_0x3112a6=_0xeddf9c[_0xd242('0x1f')],_0x552a76=_0xeddf9c[_0xd242('0x1f')]+_0xeddf9c[_0xd242('0x20')],_0x2c56e6;if(_0x552a76>=_0x585ce7){_0x552a76=_0x585ce7;_0x2c56e6=0xc8;}else{_0x2c56e6=0xce;}_0x470d3e[_0xd242('0x1c')](_0x2c56e6);return _0x470d3e[_0xd242('0x21')](_0xd242('0x22'),_0x3112a6+'-'+_0x552a76+'/'+_0x585ce7)[_0xd242('0x23')](_0x1496c7);}return null;};}function patchUpdates(_0x33738b){return function(_0xea24a8){try{jsonpatch[_0xd242('0x24')](_0xea24a8,_0x33738b,!![]);}catch(_0x316a05){return BPromise['reject'](_0x316a05);}return _0xea24a8[_0xd242('0x25')]();};}function saveUpdates(_0x4c4828,_0x38d9f5){return function(_0x4210b8){if(_0x4210b8){return _0x4210b8[_0xd242('0x26')](_0x4c4828)[_0xd242('0x27')](function(_0x270457){return _0x270457;});}return null;};}function removeEntity(_0x4f2052,_0x3a2d37){return function(_0x209e66){if(_0x209e66){return _0x209e66[_0xd242('0x28')]()[_0xd242('0x27')](function(){var _0x4b957d=_0x209e66[_0xd242('0x29')]({'plain':!![]});var _0x2f1920=[{'name':_0xd242('0x2a'),'value':'inbound','ignore':![]},{'name':_0xd242('0x2b'),'value':_0xd242('0x2c'),'ignore':![]}];var _0x412383=_(_0x2f1920)[_0xd242('0x2d')](_0xd242('0x2e'))[_0xd242('0x2f')](_0xd242('0x30'))[_0xd242('0x30')]();if(_[_0xd242('0x31')](_0x412383,_0x4b957d['type'])){return;}var _0x180065=_[_0xd242('0x32')](_0x2f1920,[_0xd242('0x30'),_0x4b957d[_0xd242('0x33')]])[_0xd242('0x34')];return db[_0xd242('0x35')]['destroy']({'where':{'type':_0x180065,'resourceId':_0x4b957d['id']}})['then'](function(){return _0x209e66;});})['then'](function(){_0x4f2052[_0xd242('0x1c')](0xcc)[_0xd242('0x1d')]();});}};}function handleEntityNotFound(_0x43f733,_0x5276fe){return function(_0x45576c){if(!_0x45576c){_0x43f733[_0xd242('0x1b')](0x194);}return _0x45576c;};}function handleError(_0x3881aa,_0x112867){_0x112867=_0x112867||0x1f4;return function(_0x5b922f){logger['error'](_0x5b922f['stack']);if(_0x5b922f[_0xd242('0x34')]){delete _0x5b922f[_0xd242('0x34')];}_0x3881aa[_0xd242('0x1c')](_0x112867)[_0xd242('0x36')](_0x5b922f);};}exports[_0xd242('0x37')]=function(_0x47ea9f,_0x279699){var _0x49cee8={},_0x92af8f={},_0x28783f={'count':0x0,'rows':[]};var _0x42f7bb=_['map'](db[_0xd242('0x38')]['rawAttributes'],function(_0x2dd862){return{'name':_0x2dd862[_0xd242('0x39')],'type':_0x2dd862['type']['key']};});_0x92af8f['model']=_[_0xd242('0x2f')](_0x42f7bb,_0xd242('0x34'));_0x92af8f['query']=_[_0xd242('0x3a')](_0x47ea9f[_0xd242('0x3b')]);_0x92af8f[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x92af8f[_0xd242('0x3e')],_0x92af8f[_0xd242('0x3b')]);_0x49cee8[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x92af8f['model'],qs[_0xd242('0x40')](_0x47ea9f['query']['fields']));_0x49cee8[_0xd242('0x3f')]=_0x49cee8[_0xd242('0x3f')][_0xd242('0x41')]?_0x49cee8[_0xd242('0x3f')]:_0x92af8f[_0xd242('0x3e')];if(!_0x47ea9f[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x49cee8[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x47ea9f[_0xd242('0x3b')][_0xd242('0x20')]);_0x49cee8['offset']=qs['offset'](_0x47ea9f[_0xd242('0x3b')][_0xd242('0x1f')]);}_0x49cee8['order']=qs['sort'](_0x47ea9f[_0xd242('0x3b')][_0xd242('0x44')]);_0x49cee8[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x47ea9f[_0xd242('0x3b')],_0x92af8f['filters']),_0x42f7bb);if(_0x47ea9f[_0xd242('0x3b')]['filter']){_0x49cee8[_0xd242('0x45')]=_[_0xd242('0x47')](_0x49cee8[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x42f7bb,function(_0x7e621e){if(_0x7e621e[_0xd242('0x33')]!==_0xd242('0x48')){var _0x2352ae={};_0x2352ae[_0x7e621e[_0xd242('0x34')]]={'$like':'%'+_0x47ea9f[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x2352ae;}})});}_0x49cee8=_[_0xd242('0x47')]({},_0x49cee8,_0x47ea9f['options']);var _0x2c247c={'where':_0x49cee8[_0xd242('0x45')]};return db[_0xd242('0x38')][_0xd242('0x1e')](_0x2c247c)[_0xd242('0x27')](function(_0x4590ef){_0x28783f['count']=_0x4590ef;if(_0x47ea9f[_0xd242('0x3b')][_0xd242('0x49')]){_0x49cee8[_0xd242('0x4a')]=[{'all':!![]}];}return db[_0xd242('0x38')][_0xd242('0x4b')](_0x49cee8);})[_0xd242('0x27')](function(_0xede711){_0x28783f['rows']=_0xede711;return _0x28783f;})['then'](respondWithFilteredResult(_0x279699,_0x49cee8))[_0xd242('0x4c')](handleError(_0x279699,null));};exports['show']=function(_0x427278,_0x149420){var _0x20c01a={'raw':![],'where':{'id':_0x427278[_0xd242('0x4d')]['id']}},_0x149967={};_0x149967[_0xd242('0x3e')]=_['keys'](db[_0xd242('0x38')][_0xd242('0x4e')]);_0x149967[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x427278[_0xd242('0x3b')]);_0x149967[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x149967[_0xd242('0x3e')],_0x149967['query']);_0x20c01a['attributes']=_[_0xd242('0x3d')](_0x149967['model'],qs['fields'](_0x427278['query'][_0xd242('0x40')]));_0x20c01a[_0xd242('0x3f')]=_0x20c01a[_0xd242('0x3f')][_0xd242('0x41')]?_0x20c01a[_0xd242('0x3f')]:_0x149967[_0xd242('0x3e')];if(_0x427278[_0xd242('0x3b')][_0xd242('0x49')]){_0x20c01a['include']=[{'all':!![]}];}_0x20c01a=_[_0xd242('0x47')]({},_0x20c01a,_0x427278['options']);return db[_0xd242('0x38')][_0xd242('0x32')](_0x20c01a)['then'](handleEntityNotFound(_0x149420,null))['then'](respondWithResult(_0x149420,null))[_0xd242('0x4c')](handleError(_0x149420,null));};exports[_0xd242('0x4f')]=function(_0x2d1cb0,_0x1d04e0){return db[_0xd242('0x38')]['create'](_0x2d1cb0[_0xd242('0x50')],{})[_0xd242('0x27')](function(_0x192f03){var _0x595be8=_0x2d1cb0[_0xd242('0x51')][_0xd242('0x29')]({'plain':!![]});if(!_0x595be8)throw new Error(_0xd242('0x52'));if(_0x595be8[_0xd242('0x53')]===_0xd242('0x51')){var _0x3bbafd=_0x192f03['get']({'plain':!![]});var _0x1f95a6=[{'name':_0xd242('0x2a'),'value':_0xd242('0x54')},{'name':_0xd242('0x2b'),'value':_0xd242('0x2c')}];var _0x1a4982=_[_0xd242('0x32')](_0x1f95a6,[_0xd242('0x30'),_0x3bbafd[_0xd242('0x33')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x1a4982,'userProfileId':_0x595be8[_0xd242('0x55')]},'raw':!![]})[_0xd242('0x27')](function(_0x536285){if(_0x536285&&_0x536285[_0xd242('0x56')]===0x0){return db[_0xd242('0x35')]['create']({'name':_0x3bbafd[_0xd242('0x34')],'resourceId':_0x3bbafd['id'],'type':_0x536285['name'],'sectionId':_0x536285['id']},{})[_0xd242('0x27')](function(){return _0x192f03;});}else{return _0x192f03;}})[_0xd242('0x4c')](function(_0x10583a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10583a);throw _0x10583a;});}return _0x192f03;})[_0xd242('0x27')](respondWithResult(_0x1d04e0,0xc9))[_0xd242('0x4c')](handleError(_0x1d04e0,null));};exports[_0xd242('0x57')]=function(_0x2df019,_0x49020b){var _0x4c08e6={'where':{'id':_0x2df019[_0xd242('0x4d')]['id']}},_0x14147e={};_0x14147e[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x38')][_0xd242('0x4e')]);_0x4c08e6[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x14147e[_0xd242('0x3e')],qs['fields'](_0x2df019['query'][_0xd242('0x40')]));_0x4c08e6['attributes']=_0x4c08e6['attributes'][_0xd242('0x41')]?_0x4c08e6['attributes']:_0x14147e[_0xd242('0x3e')];if(_0x2df019[_0xd242('0x3b')][_0xd242('0x49')]){_0x4c08e6[_0xd242('0x4a')]=[{'all':!![]}];}_0x4c08e6=_['merge']({},_0x4c08e6,_0x2df019['options']);return db['VoiceQueue'][_0xd242('0x32')](_0x4c08e6)[_0xd242('0x27')](handleEntityNotFound(_0x49020b,null))[_0xd242('0x27')](function(_0x24338a){if(_0x24338a){var _0xccf050=_0x24338a[_0xd242('0x29')]({'plain':!![]});_0xccf050=qs[_0xd242('0x58')](_0xccf050,['id',_0xd242('0x59'),'updatedAt']);_0x2df019[_0xd242('0x50')]=_['omit'](_0x2df019[_0xd242('0x50')],['id',_0xd242('0x59'),_0xd242('0x5a')]);return db['VoiceQueue'][_0xd242('0x4f')](_[_0xd242('0x47')](_0xccf050,_0x2df019[_0xd242('0x50')]),{'include':_0x2df019[_0xd242('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xd242('0x27')](function(_0x5604c3){var _0x255420=_0x2df019[_0xd242('0x51')][_0xd242('0x29')]({'plain':!![]});if(!_0x255420)throw new Error(_0xd242('0x52'));if(_0x255420[_0xd242('0x53')]==='user'){var _0x3dd3ab=_0x5604c3['get']({'plain':!![]});var _0x4b18c=[{'name':_0xd242('0x2a'),'value':_0xd242('0x54')},{'name':_0xd242('0x2b'),'value':_0xd242('0x2c')}];var _0x3c0d94=_[_0xd242('0x32')](_0x4b18c,[_0xd242('0x30'),_0x3dd3ab[_0xd242('0x33')]])[_0xd242('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x3c0d94,'userProfileId':_0x255420[_0xd242('0x55')]},'raw':!![]})[_0xd242('0x27')](function(_0x4116ed){if(_0x4116ed&&_0x4116ed[_0xd242('0x56')]===0x0){return db[_0xd242('0x35')]['create']({'name':_0x3dd3ab['name'],'resourceId':_0x3dd3ab['id'],'type':_0x4116ed['name'],'sectionId':_0x4116ed['id']},{})[_0xd242('0x27')](function(){return _0x5604c3;});}else{return _0x5604c3;}})[_0xd242('0x4c')](function(_0x34367f){logger[_0xd242('0x5b')](_0xd242('0x5c'),_0x34367f);throw _0x34367f;});}return _0x5604c3;});}})[_0xd242('0x27')](respondWithResult(_0x49020b,0xc9))['catch'](handleError(_0x49020b,null));};exports[_0xd242('0x26')]=function(_0x56a2c6,_0x202b80){if(_0x56a2c6['body']['id']){delete _0x56a2c6[_0xd242('0x50')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x56a2c6[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x202b80,null))[_0xd242('0x27')](saveUpdates(_0x56a2c6[_0xd242('0x50')],null))[_0xd242('0x27')](respondWithResult(_0x202b80,null))[_0xd242('0x4c')](handleError(_0x202b80,null));};exports[_0xd242('0x28')]=function(_0x3ffc82,_0x8b8ff9){return db[_0xd242('0x38')]['find']({'where':{'id':_0x3ffc82[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x8b8ff9,null))[_0xd242('0x27')](removeEntity(_0x8b8ff9,null))[_0xd242('0x4c')](handleError(_0x8b8ff9,null));};exports[_0xd242('0x5d')]=function(_0x53fb21,_0x57b5be,_0x3c4e54){var _0xe0b9b5={'raw':![],'where':{}};var _0x1d9939={};var _0x404c8e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd242('0x5e')]({'where':{'id':_0x53fb21[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x57b5be,null))['then'](function(_0xc8f749){if(_0xc8f749){_0x1d9939[_0xd242('0x3e')]=_['keys'](db[_0xd242('0x5f')][_0xd242('0x4e')]);_0x1d9939['query']=_[_0xd242('0x3a')](_0x53fb21[_0xd242('0x3b')]);_0x1d9939['filters']=_[_0xd242('0x3d')](_0x1d9939[_0xd242('0x3e')],_0x1d9939['query']);_0xe0b9b5['attributes']=_[_0xd242('0x3d')](_0x1d9939['model'],qs[_0xd242('0x40')](_0x53fb21[_0xd242('0x3b')][_0xd242('0x40')]));_0xe0b9b5[_0xd242('0x3f')]=_0xe0b9b5['attributes'][_0xd242('0x41')]?_0xe0b9b5[_0xd242('0x3f')]:_0x1d9939[_0xd242('0x3e')];if(!_0x53fb21[_0xd242('0x3b')][_0xd242('0x42')]('nolimit')){_0xe0b9b5['limit']=qs[_0xd242('0x20')](_0x53fb21[_0xd242('0x3b')][_0xd242('0x20')]);_0xe0b9b5[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x53fb21[_0xd242('0x3b')][_0xd242('0x1f')]);}_0xe0b9b5['order']=qs[_0xd242('0x44')](_0x53fb21['query'][_0xd242('0x44')]);_0xe0b9b5[_0xd242('0x45')]=qs['filters'](_[_0xd242('0x46')](_0x53fb21['query'],_0x1d9939['filters']));_0xe0b9b5[_0xd242('0x45')][_0xd242('0x60')]=_0xc8f749['id'];if(_0x53fb21[_0xd242('0x3b')][_0xd242('0x2d')]){_0xe0b9b5[_0xd242('0x45')]=_[_0xd242('0x47')](_0xe0b9b5['where'],{'$or':_[_0xd242('0x2f')](_0xe0b9b5[_0xd242('0x3f')],function(_0x3e0d22){var _0x589c2a={};_0x589c2a[_0x3e0d22]={'$like':'%'+_0x53fb21[_0xd242('0x3b')]['filter']+'%'};return _0x589c2a;})});}_0xe0b9b5=_[_0xd242('0x47')]({},_0xe0b9b5,_0x53fb21[_0xd242('0x61')]);return db[_0xd242('0x5f')][_0xd242('0x1e')]({'where':_0xe0b9b5[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x49de0d){_0x404c8e[_0xd242('0x1e')]=_0x49de0d;if(_0x53fb21[_0xd242('0x3b')][_0xd242('0x49')]){_0xe0b9b5[_0xd242('0x4a')]=[{'all':!![]}];}return db[_0xd242('0x5f')]['findAll'](_0xe0b9b5);})[_0xd242('0x27')](function(_0x3b8b74){_0x404c8e[_0xd242('0x62')]=_0x3b8b74;return _0x404c8e;});}})[_0xd242('0x27')](respondWithFilteredResult(_0x57b5be,_0xe0b9b5))[_0xd242('0x4c')](handleError(_0x57b5be,null));};exports['getHopperHistories']=function(_0x2c1590,_0xfe4dc,_0x466158){var _0x381541={'raw':!![],'where':{}};var _0x54035f={};var _0xa9ee8f={'count':0x0,'rows':[]};return db[_0xd242('0x38')]['findOne']({'where':{'id':_0x2c1590['params']['id']}})[_0xd242('0x27')](handleEntityNotFound(_0xfe4dc,null))[_0xd242('0x27')](function(_0x2a5726){if(_0x2a5726){_0x54035f['model']=_[_0xd242('0x3a')](db['CmHopperHistory']['rawAttributes']);_0x54035f[_0xd242('0x3b')]=_['keys'](_0x2c1590[_0xd242('0x3b')]);_0x54035f[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x54035f[_0xd242('0x3e')],_0x54035f[_0xd242('0x3b')]);_0x381541['attributes']=_['intersection'](_0x54035f[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x40')]));_0x381541[_0xd242('0x3f')]=_0x381541[_0xd242('0x3f')]['length']?_0x381541[_0xd242('0x3f')]:_0x54035f[_0xd242('0x3e')];if(!_0x2c1590[_0xd242('0x3b')]['hasOwnProperty'](_0xd242('0x43'))){_0x381541['limit']=qs[_0xd242('0x20')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x20')]);_0x381541[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x1f')]);}_0x381541[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x2c1590[_0xd242('0x3b')][_0xd242('0x44')]);_0x381541[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x2c1590[_0xd242('0x3b')],_0x54035f[_0xd242('0x3c')]));_0x381541[_0xd242('0x45')]['VoiceQueueId']=_0x2a5726['id'];if(_0x2c1590['query']['filter']){_0x381541['where']=_['merge'](_0x381541[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x381541[_0xd242('0x3f')],function(_0xefebb1){var _0x8b5468={};_0x8b5468[_0xefebb1]={'$like':'%'+_0x2c1590[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x8b5468;})});}_0x381541=_[_0xd242('0x47')]({},_0x381541,_0x2c1590[_0xd242('0x61')]);return db[_0xd242('0x64')][_0xd242('0x1e')]({'where':_0x381541[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x141914){_0xa9ee8f[_0xd242('0x1e')]=_0x141914;if(_0x2c1590[_0xd242('0x3b')][_0xd242('0x49')]){_0x381541[_0xd242('0x4a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd242('0x4b')](_0x381541);})[_0xd242('0x27')](function(_0x49e845){_0xa9ee8f[_0xd242('0x62')]=_0x49e845;return _0xa9ee8f;});}})[_0xd242('0x27')](respondWithFilteredResult(_0xfe4dc,_0x381541))[_0xd242('0x4c')](handleError(_0xfe4dc,null));};exports[_0xd242('0x65')]=function(_0x290a52,_0x16fc73,_0x43b06f){var _0x11518a={'raw':!![],'where':{}};var _0x5a7273={};var _0x12ed5b={'count':0x0,'rows':[]};return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x290a52['params']['id']}})['then'](handleEntityNotFound(_0x16fc73,null))[_0xd242('0x27')](function(_0x3ca86c){if(_0x3ca86c){_0x5a7273[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x66')][_0xd242('0x4e')]);_0x5a7273[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x290a52[_0xd242('0x3b')]);_0x5a7273[_0xd242('0x3c')]=_['intersection'](_0x5a7273[_0xd242('0x3e')],_0x5a7273['query']);_0x11518a[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x5a7273[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x290a52[_0xd242('0x3b')][_0xd242('0x40')]));_0x11518a['attributes']=_0x11518a[_0xd242('0x3f')]['length']?_0x11518a[_0xd242('0x3f')]:_0x5a7273[_0xd242('0x3e')];if(!_0x290a52[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x11518a['limit']=qs[_0xd242('0x20')](_0x290a52[_0xd242('0x3b')][_0xd242('0x20')]);_0x11518a['offset']=qs['offset'](_0x290a52[_0xd242('0x3b')][_0xd242('0x1f')]);}_0x11518a[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x290a52[_0xd242('0x3b')][_0xd242('0x44')]);_0x11518a[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x290a52[_0xd242('0x3b')],_0x5a7273[_0xd242('0x3c')]));_0x11518a[_0xd242('0x45')][_0xd242('0x60')]=_0x3ca86c['id'];if(_0x290a52[_0xd242('0x3b')][_0xd242('0x2d')]){_0x11518a[_0xd242('0x45')]=_[_0xd242('0x47')](_0x11518a[_0xd242('0x45')],{'$or':_['map'](_0x11518a[_0xd242('0x3f')],function(_0x54e42d){var _0x15aab1={};_0x15aab1[_0x54e42d]={'$like':'%'+_0x290a52[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x15aab1;})});}_0x11518a=_[_0xd242('0x47')]({},_0x11518a,_0x290a52[_0xd242('0x61')]);return db[_0xd242('0x66')][_0xd242('0x1e')]({'where':_0x11518a[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x44b480){_0x12ed5b[_0xd242('0x1e')]=_0x44b480;if(_0x290a52[_0xd242('0x3b')][_0xd242('0x49')]){_0x11518a[_0xd242('0x4a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd242('0x4b')](_0x11518a);})[_0xd242('0x27')](function(_0x5c0f1c){_0x12ed5b[_0xd242('0x62')]=_0x5c0f1c;return _0x12ed5b;});}})[_0xd242('0x27')](respondWithFilteredResult(_0x16fc73,_0x11518a))['catch'](handleError(_0x16fc73,null));};exports['getHopperBlacks']=function(_0x2a14a0,_0x3a5351,_0x14ab34){var _0x5605c2={'raw':!![],'where':{}};var _0x467232={};var _0x16040a={'count':0x0,'rows':[]};return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x2a14a0[_0xd242('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3a5351,null))[_0xd242('0x27')](function(_0x27b4f2){if(_0x27b4f2){_0x467232[_0xd242('0x3e')]=_[_0xd242('0x3a')](db['CmHopperBlack'][_0xd242('0x4e')]);_0x467232[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x2a14a0['query']);_0x467232['filters']=_[_0xd242('0x3d')](_0x467232['model'],_0x467232['query']);_0x5605c2[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x467232[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x2a14a0[_0xd242('0x3b')][_0xd242('0x40')]));_0x5605c2[_0xd242('0x3f')]=_0x5605c2['attributes']['length']?_0x5605c2[_0xd242('0x3f')]:_0x467232[_0xd242('0x3e')];if(!_0x2a14a0['query'][_0xd242('0x42')](_0xd242('0x43'))){_0x5605c2['limit']=qs[_0xd242('0x20')](_0x2a14a0[_0xd242('0x3b')][_0xd242('0x20')]);_0x5605c2[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x2a14a0['query'][_0xd242('0x1f')]);}_0x5605c2[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x2a14a0[_0xd242('0x3b')][_0xd242('0x44')]);_0x5605c2[_0xd242('0x45')]=qs[_0xd242('0x3c')](_['pick'](_0x2a14a0[_0xd242('0x3b')],_0x467232[_0xd242('0x3c')]));_0x5605c2['where'][_0xd242('0x60')]=_0x27b4f2['id'];if(_0x2a14a0[_0xd242('0x3b')][_0xd242('0x2d')]){_0x5605c2[_0xd242('0x45')]=_[_0xd242('0x47')](_0x5605c2[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x5605c2[_0xd242('0x3f')],function(_0x1d3c6b){var _0x1bc52d={};_0x1bc52d[_0x1d3c6b]={'$like':'%'+_0x2a14a0[_0xd242('0x3b')]['filter']+'%'};return _0x1bc52d;})});}_0x5605c2=_[_0xd242('0x47')]({},_0x5605c2,_0x2a14a0['options']);return db[_0xd242('0x67')][_0xd242('0x1e')]({'where':_0x5605c2[_0xd242('0x45')]})[_0xd242('0x27')](function(_0x4be7da){_0x16040a['count']=_0x4be7da;if(_0x2a14a0['query'][_0xd242('0x49')]){_0x5605c2[_0xd242('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5605c2);})[_0xd242('0x27')](function(_0x42604f){_0x16040a[_0xd242('0x62')]=_0x42604f;return _0x16040a;});}})['then'](respondWithFilteredResult(_0x3a5351,_0x5605c2))[_0xd242('0x4c')](handleError(_0x3a5351,null));};exports['getTeams']=function(_0xdcc54a,_0x3b3dc7,_0x339e8c){var _0x28c0c0={};var _0x521faf={};var _0x47eac2;var _0x9d727b;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0xdcc54a[_0xd242('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b3dc7,null))['then'](function(_0x422b50){if(_0x422b50){_0x47eac2=_0x422b50;_0x521faf[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x68')][_0xd242('0x4e')]);_0x521faf[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0xdcc54a[_0xd242('0x3b')]);_0x521faf[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x521faf[_0xd242('0x3e')],_0x521faf[_0xd242('0x3b')]);_0x28c0c0[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x521faf[_0xd242('0x3e')],qs[_0xd242('0x40')](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x40')]));_0x28c0c0[_0xd242('0x3f')]=_0x28c0c0[_0xd242('0x3f')][_0xd242('0x41')]?_0x28c0c0['attributes']:_0x521faf[_0xd242('0x3e')];_0x28c0c0[_0xd242('0x63')]=qs['sort'](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x44')]);_0x28c0c0[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0xdcc54a[_0xd242('0x3b')],_0x521faf[_0xd242('0x3c')]));if(_0xdcc54a[_0xd242('0x3b')][_0xd242('0x2d')]){_0x28c0c0[_0xd242('0x45')]=_[_0xd242('0x47')](_0x28c0c0[_0xd242('0x45')],{'$or':_[_0xd242('0x2f')](_0x28c0c0['attributes'],function(_0x59a54c){var _0x47b90e={};_0x47b90e[_0x59a54c]={'$like':'%'+_0xdcc54a[_0xd242('0x3b')]['filter']+'%'};return _0x47b90e;})});}_0x28c0c0=_[_0xd242('0x47')]({},_0x28c0c0,_0xdcc54a[_0xd242('0x61')]);return _0x47eac2['getTeams'](_0x28c0c0);}})[_0xd242('0x27')](function(_0x11b35e){if(_0x11b35e){_0x9d727b=_0x11b35e[_0xd242('0x41')];if(!_0xdcc54a['query'][_0xd242('0x42')](_0xd242('0x43'))){_0x28c0c0['limit']=qs[_0xd242('0x20')](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x20')]);_0x28c0c0['offset']=qs[_0xd242('0x1f')](_0xdcc54a[_0xd242('0x3b')][_0xd242('0x1f')]);}return _0x47eac2[_0xd242('0x69')](_0x28c0c0);}})['then'](function(_0x4dcb6c){if(_0x4dcb6c){return _0x4dcb6c?{'count':_0x9d727b,'rows':_0x4dcb6c}:null;}})['then'](respondWithResult(_0x3b3dc7,null))[_0xd242('0x4c')](handleError(_0x3b3dc7,null));};exports[_0xd242('0x6a')]=function(_0x342561,_0x152d74,_0x1dbf1d){var _0x1b41f0=_0x342561[_0xd242('0x50')][_0xd242('0x6b')];var _0x273e1c=_[_0xd242('0x2f')](_0x1b41f0,'id');return db[_0xd242('0x68')]['findAll']({'where':{'id':_0x273e1c},'attributes':['id'],'include':[{'model':db[_0xd242('0x6c')],'as':_0xd242('0x6d'),'attributes':['id',_0xd242('0x34'),_0xd242('0x6e'),_0xd242('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x285642){if(_0x285642){var _0x174aa9=_[_0xd242('0x70')](_0x285642,function(_0x51edef){var _0x239b6d=_0x51edef[_0xd242('0x29')]({'plain':!![]});_0x239b6d['Agents'][_0xd242('0x71')](function(_0x2d7c99){_0x2d7c99[_0xd242('0x72')]=_[_0xd242('0x32')](_0x1b41f0,{'id':_0x239b6d['id']})[_0xd242('0x72')];});return _0x239b6d['Agents'];});return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x342561[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](function(_0x534b06){return db[_0xd242('0x73')][_0xd242('0x74')](function(_0x4adc9b){return _0x534b06[_0xd242('0x6a')](_0x273e1c,{'transaction':_0x4adc9b})[_0xd242('0x27')](function(){return BPromise['each'](_0x174aa9,function(_0x19939f){return db[_0xd242('0x75')][_0xd242('0x76')]({'where':{'UserId':_0x19939f['id'],'VoiceQueueId':_0x342561[_0xd242('0x4d')]['id']},'defaults':{'penalty':_0x19939f[_0xd242('0x72')]},'transaction':_0x4adc9b});});})[_0xd242('0x27')](function(){return BPromise[_0xd242('0x77')](_[_0xd242('0x2d')](_0x174aa9,{'online':!![]}),function(_0x56430d){return db[_0xd242('0x78')]['upsert']({'membername':_0x56430d[_0xd242('0x34')],'UserId':_0x56430d['id'],'queue_name':_0x534b06[_0xd242('0x34')],'VoiceQueueId':_0x534b06['id'],'interface':_[_0xd242('0x79')](_0x56430d[_0xd242('0x7a')])?util['format'](_0xd242('0x7b'),_0x56430d['name']):_0x56430d[_0xd242('0x7a')],'paused':_0x56430d[_0xd242('0x6f')]||![],'penalty':_0x56430d['penalty']},{'transaction':_0x4adc9b});});})['then'](function(){_0x174aa9[_0xd242('0x71')](function(_0x27103e){socket['emit'](_0xd242('0x7c'),{'UserId':_0x27103e['id'],'VoiceQueueId':_0x534b06['id']});});});});});}})[_0xd242('0x27')](respondWithStatusCode(_0x152d74,null))[_0xd242('0x4c')](handleError(_0x152d74,null));};exports[_0xd242('0x7d')]=function(_0x49ef43,_0x43707f,_0x455b67){return db['Team'][_0xd242('0x4b')]({'where':{'id':_0x49ef43['query'][_0xd242('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xd242('0x6c')],'as':_0xd242('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xd242('0x27')](handleEntityNotFound(_0x43707f,null))[_0xd242('0x27')](function(_0x31914d){var _0xf1f3b5=_[_0xd242('0x2f')](_0x31914d,'id');var _0x331e01=[];var _0x3432b9=[];var _0x4f23d5=squel[_0xd242('0x7f')]();_0x4f23d5['field']('tq.TeamId')['from'](_0xd242('0x80'),'tq')['join'](_0xd242('0x81'),'ut',_0xd242('0x82'))[_0xd242('0x45')](_0xd242('0x83'),_0x49ef43['params']['id']);for(var _0x40d251=0x0;_0x40d251<_0x31914d['length'];_0x40d251+=0x1){let _0x1b396f=_0x31914d[_0x40d251];for(var _0x4217a9=0x0;_0x4217a9<_0x1b396f[_0xd242('0x6d')]['length'];_0x4217a9+=0x1){let _0x57ed57=_0x1b396f[_0xd242('0x6d')][_0x4217a9];var _0x6f5c6=_0x4f23d5['clone']();_0x6f5c6[_0xd242('0x45')](_0xd242('0x84'),_0x57ed57['id']);_0x3432b9[_0xd242('0x85')](db[_0xd242('0x73')]['query'](_0x6f5c6[_0xd242('0x86')](),{'type':db[_0xd242('0x73')][_0xd242('0x87')]['SELECT']})[_0xd242('0x27')](function(_0x31bfb6){if(_0x31bfb6[_0xd242('0x41')]===0x1){return _0x57ed57['id'];}else{var _0x3935dc=_[_0xd242('0x88')](_[_0xd242('0x2f')](_0x31bfb6,_0xd242('0x89')),function(_0x17d2ee){return _[_0xd242('0x31')](_0xf1f3b5,_0x17d2ee);});if(_0x3935dc){return _0x57ed57['id'];}}}));}}return BPromise[_0xd242('0x8a')](_0x3432b9)[_0xd242('0x27')](function(_0x8c2054){_0x331e01=_(_0x331e01)[_0xd242('0x8b')](_0x8c2054)[_0xd242('0x8c')]()[_0xd242('0x30')]();return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x49ef43[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](function(_0x41522e){return db[_0xd242('0x73')][_0xd242('0x74')](function(_0x2d5409){return _0x41522e[_0xd242('0x7d')](_0x49ef43[_0xd242('0x3b')][_0xd242('0x7e')],{'transaction':_0x2d5409})[_0xd242('0x27')](function(){if(!_['isEmpty'](_0x331e01)){return _0x41522e[_0xd242('0x8d')](_0x331e01,{'transaction':_0x2d5409})[_0xd242('0x27')](function(){return db[_0xd242('0x78')]['destroy']({'where':{'VoiceQueueId':_0x49ef43[_0xd242('0x4d')]['id'],'UserId':_0x331e01},'transaction':_0x2d5409});});}})[_0xd242('0x27')](function(){_0x331e01['forEach'](function(_0x21ae31){socket[_0xd242('0x8e')](_0xd242('0x8f'),{'UserId':_0x21ae31,'VoiceQueueId':_0x41522e['id']});});});});});});})[_0xd242('0x27')](respondWithStatusCode(_0x43707f,null))['catch'](handleError(_0x43707f,null));};exports[_0xd242('0x90')]=function(_0x260f1d,_0x159373,_0xf532d2){var _0xaf5e76,_0x121548;return db['VoiceQueue']['find']({'where':{'id':_0x260f1d[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x159373,null))[_0xd242('0x27')](function(_0x1b00d3){if(_0x1b00d3){_0x121548=_0x1b00d3;return _0x1b00d3[_0xd242('0x90')](_0x260f1d[_0xd242('0x50')][_0xd242('0x7e')],_[_0xd242('0x58')](_0x260f1d[_0xd242('0x50')],[_0xd242('0x7e'),'id'])||{})[_0xd242('0x91')](function(_0x3bdb88){for(var _0x58cfb5=0x0;_0x58cfb5<_0x260f1d[_0xd242('0x50')][_0xd242('0x7e')]['length'];_0x58cfb5+=0x1){socket[_0xd242('0x8e')](_0xd242('0x7c'),{'UserId':_0x260f1d['body']['ids'][_0x58cfb5],'VoiceQueueId':_0x260f1d[_0xd242('0x4d')]['id']});}return _0x3bdb88;});}})['then'](function(_0x48e375){_0xaf5e76=_0x48e375||[];if(_0x121548){return db[_0xd242('0x6c')]['findAll']({'where':{'id':_0x260f1d[_0xd242('0x50')]['ids']},'attributes':['id',_0xd242('0x34'),_0xd242('0x6e'),_0xd242('0x6f'),_0xd242('0x7a')],'raw':!![]});}})[_0xd242('0x27')](function(_0x2f5666){if(!_[_0xd242('0x92')](_0x2f5666)){var _0x23aae5=[];for(var _0x499d48=0x0;_0x499d48<_0x2f5666[_0xd242('0x41')];_0x499d48++){if(_0x2f5666[_0x499d48][_0xd242('0x6e')]){_0x23aae5[_0xd242('0x85')](db['UserVoiceQueueRt']['upsert']({'membername':_0x2f5666[_0x499d48][_0xd242('0x34')],'UserId':_0x2f5666[_0x499d48]['id'],'queue_name':_0x121548[_0xd242('0x34')],'VoiceQueueId':_0x121548['id'],'interface':_[_0xd242('0x79')](_0x2f5666[_0x499d48][_0xd242('0x7a')])?util['format'](_0xd242('0x7b'),_0x2f5666[_0x499d48][_0xd242('0x34')]):_0x2f5666[_0x499d48][_0xd242('0x7a')],'paused':_0x2f5666[_0x499d48][_0xd242('0x6f')]||![],'penalty':_0x260f1d['body'][_0xd242('0x72')]||0x0}));}}return BPromise[_0xd242('0x8a')](_0x23aae5);}})[_0xd242('0x27')](function(){return _0xaf5e76;})[_0xd242('0x27')](respondWithResult(_0x159373,null))['catch'](handleError(_0x159373,null));};exports[_0xd242('0x8d')]=function(_0x5d13bf,_0x25049a,_0x587467){return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x5d13bf[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x25049a,null))[_0xd242('0x27')](function(_0x15d6df){if(_0x15d6df){return _0x15d6df[_0xd242('0x8d')](_0x5d13bf[_0xd242('0x3b')][_0xd242('0x7e')])['then'](function(){if(_[_0xd242('0x93')](_0x5d13bf[_0xd242('0x3b')][_0xd242('0x7e')])){for(var _0x4f72cc=0x0;_0x4f72cc<_0x5d13bf[_0xd242('0x3b')][_0xd242('0x7e')][_0xd242('0x41')];_0x4f72cc+=0x1){socket[_0xd242('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x5d13bf[_0xd242('0x3b')]['ids'][_0x4f72cc]),'VoiceQueueId':Number(_0x5d13bf[_0xd242('0x4d')]['id'])});}}else{socket['emit'](_0xd242('0x8f'),{'UserId':Number(_0x5d13bf[_0xd242('0x3b')]['ids']),'VoiceQueueId':Number(_0x5d13bf[_0xd242('0x4d')]['id'])});}});}})['then'](function(_0x20d169){return db['UserVoiceQueueRt'][_0xd242('0x28')]({'where':{'VoiceQueueId':_0x5d13bf[_0xd242('0x4d')]['id'],'UserId':_0x5d13bf['query'][_0xd242('0x7e')]}})[_0xd242('0x27')](function(){return _0x20d169;});})[_0xd242('0x27')](respondWithStatusCode(_0x25049a,null))[_0xd242('0x4c')](handleError(_0x25049a,null));};exports['getAgents']=function(_0x36ccd5,_0x4e8139,_0xa12310){var _0x51ee24={};var _0x3daf6a={};var _0x3fb985;var _0x3746f0;return db[_0xd242('0x38')]['findOne']({'where':{'id':_0x36ccd5[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x4e8139,null))[_0xd242('0x27')](function(_0x5855f7){if(_0x5855f7){_0x3fb985=_0x5855f7;_0x3daf6a['model']=_[_0xd242('0x3a')](db[_0xd242('0x6c')][_0xd242('0x4e')]);_0x3daf6a[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x36ccd5[_0xd242('0x3b')]);_0x3daf6a[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x3daf6a[_0xd242('0x3e')],_0x3daf6a['query']);_0x51ee24[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x3daf6a[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x36ccd5[_0xd242('0x3b')][_0xd242('0x40')]));_0x51ee24[_0xd242('0x3f')]=_0x51ee24[_0xd242('0x3f')][_0xd242('0x41')]?_0x51ee24[_0xd242('0x3f')]:_0x3daf6a[_0xd242('0x3e')];_0x51ee24[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x36ccd5['query'][_0xd242('0x44')]);_0x51ee24['where']=qs[_0xd242('0x3c')](_['pick'](_0x36ccd5[_0xd242('0x3b')],_0x3daf6a['filters']));if(_0x36ccd5[_0xd242('0x3b')][_0xd242('0x2d')]){_0x51ee24[_0xd242('0x45')]=_[_0xd242('0x47')](_0x51ee24['where'],{'$or':_['map'](_0x51ee24[_0xd242('0x3f')],function(_0x31ff2a){var _0x175472={};_0x175472[_0x31ff2a]={'$like':'%'+_0x36ccd5[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x175472;})});}_0x51ee24=_[_0xd242('0x47')]({},_0x51ee24,_0x36ccd5[_0xd242('0x61')]);return _0x3fb985[_0xd242('0x94')](_0x51ee24);}})[_0xd242('0x27')](function(_0x5cbda4){if(_0x5cbda4){_0x3746f0=_0x5cbda4[_0xd242('0x41')];if(!_0x36ccd5[_0xd242('0x3b')]['hasOwnProperty'](_0xd242('0x43'))){_0x51ee24[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x36ccd5[_0xd242('0x3b')][_0xd242('0x20')]);_0x51ee24[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x36ccd5[_0xd242('0x3b')][_0xd242('0x1f')]);}return _0x3fb985[_0xd242('0x94')](_0x51ee24);}})['then'](function(_0x1c6ee8){if(_0x1c6ee8){return _0x1c6ee8?{'count':_0x3746f0,'rows':_0x1c6ee8}:null;}})[_0xd242('0x27')](respondWithResult(_0x4e8139,null))['catch'](handleError(_0x4e8139,null));};exports[_0xd242('0x95')]=function(_0x5e3afc,_0x32c138,_0x1d52a1){var _0x38b279={};var _0x5736b={};var _0x241d62;var _0x2d3204;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x5e3afc[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x32c138,null))[_0xd242('0x27')](function(_0x367ad4){if(_0x367ad4){_0x241d62=_0x367ad4;_0x5736b[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0x78')][_0xd242('0x4e')]);_0x5736b[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x5e3afc[_0xd242('0x3b')]);_0x5736b[_0xd242('0x3c')]=_['intersection'](_0x5736b[_0xd242('0x3e')],_0x5736b[_0xd242('0x3b')]);_0x38b279[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x5736b[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x5e3afc[_0xd242('0x3b')][_0xd242('0x40')]));_0x38b279[_0xd242('0x3f')]=_0x38b279[_0xd242('0x3f')]['length']?_0x38b279[_0xd242('0x3f')]:_0x5736b['model'];_0x38b279[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x5e3afc['query'][_0xd242('0x44')]);_0x38b279[_0xd242('0x45')]=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x5e3afc['query'],_0x5736b[_0xd242('0x3c')]));if(_0x5e3afc[_0xd242('0x3b')]['filter']){_0x38b279[_0xd242('0x45')]=_[_0xd242('0x47')](_0x38b279[_0xd242('0x45')],{'$or':_['map'](_0x38b279[_0xd242('0x3f')],function(_0x28bb54){var _0x1ea338={};_0x1ea338[_0x28bb54]={'$like':'%'+_0x5e3afc[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0x1ea338;})});}_0x38b279=_['merge']({},_0x38b279,_0x5e3afc['options']);return _0x241d62[_0xd242('0x95')](_0x38b279);}})[_0xd242('0x27')](function(_0xea30f5){if(_0xea30f5){_0x2d3204=_0xea30f5[_0xd242('0x41')];if(!_0x5e3afc[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x38b279[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x5e3afc[_0xd242('0x3b')][_0xd242('0x20')]);_0x38b279[_0xd242('0x1f')]=qs[_0xd242('0x1f')](_0x5e3afc[_0xd242('0x3b')]['offset']);}return _0x241d62[_0xd242('0x95')](_0x38b279);}})[_0xd242('0x27')](function(_0x44482e){return _0x44482e?{'count':_0x2d3204,'rows':_0x44482e}:null;})['then'](respondWithResult(_0x32c138,null))[_0xd242('0x4c')](handleError(_0x32c138,null));};exports[_0xd242('0x96')]=function(_0x1212fd,_0x5d204a,_0x16db7f){var _0x165d81={};var _0x3c5ac1={};var _0x4f185c;var _0x346573;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x1212fd['params']['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x5d204a,null))[_0xd242('0x27')](function(_0xb66563){if(_0xb66563){_0x4f185c=_0xb66563;_0x3c5ac1[_0xd242('0x3e')]=_[_0xd242('0x3a')](db['CmList'][_0xd242('0x4e')]);_0x3c5ac1[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x1212fd[_0xd242('0x3b')]);_0x3c5ac1[_0xd242('0x3c')]=_[_0xd242('0x3d')](_0x3c5ac1[_0xd242('0x3e')],_0x3c5ac1[_0xd242('0x3b')]);_0x165d81[_0xd242('0x3f')]=_[_0xd242('0x3d')](_0x3c5ac1[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x1212fd[_0xd242('0x3b')][_0xd242('0x40')]));_0x165d81[_0xd242('0x3f')]=_0x165d81[_0xd242('0x3f')]['length']?_0x165d81[_0xd242('0x3f')]:_0x3c5ac1[_0xd242('0x3e')];_0x165d81[_0xd242('0x63')]=qs[_0xd242('0x44')](_0x1212fd[_0xd242('0x3b')][_0xd242('0x44')]);_0x165d81['where']=qs[_0xd242('0x3c')](_[_0xd242('0x46')](_0x1212fd['query'],_0x3c5ac1[_0xd242('0x3c')]));if(_0x1212fd['query'][_0xd242('0x2d')]){_0x165d81[_0xd242('0x45')]=_[_0xd242('0x47')](_0x165d81[_0xd242('0x45')],{'$or':_['map'](_0x165d81[_0xd242('0x3f')],function(_0x1d57a5){var _0xd9dca5={};_0xd9dca5[_0x1d57a5]={'$like':'%'+_0x1212fd[_0xd242('0x3b')][_0xd242('0x2d')]+'%'};return _0xd9dca5;})});}_0x165d81=_[_0xd242('0x47')]({},_0x165d81,_0x1212fd[_0xd242('0x61')]);return _0x4f185c[_0xd242('0x96')](_0x165d81);}})['then'](function(_0x6423f3){if(_0x6423f3){_0x346573=_0x6423f3['length'];if(!_0x1212fd[_0xd242('0x3b')]['hasOwnProperty'](_0xd242('0x43'))){_0x165d81[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x1212fd[_0xd242('0x3b')][_0xd242('0x20')]);_0x165d81['offset']=qs[_0xd242('0x1f')](_0x1212fd['query'][_0xd242('0x1f')]);}return _0x4f185c['getLists'](_0x165d81);}})['then'](function(_0x2b481a){if(_0x2b481a){return _0x2b481a?{'count':_0x346573,'rows':_0x2b481a}:null;}})['then'](respondWithResult(_0x5d204a,null))['catch'](handleError(_0x5d204a,null));};exports[_0xd242('0x97')]=function(_0x267c10,_0x407d09,_0x42ef1f){var _0x8fff15,_0x27b565;return db[_0xd242('0x38')]['find']({'where':{'id':_0x267c10[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x407d09,null))[_0xd242('0x27')](function(_0x5e3522){if(_0x5e3522){_0x27b565=_0x5e3522;return _0x5e3522[_0xd242('0x97')](_0x267c10['body'][_0xd242('0x7e')],_[_0xd242('0x58')](_0x267c10['body'],[_0xd242('0x7e'),'id'])||{});}return null;})[_0xd242('0x91')](function(_0x196660){var _0x348757;_0x8fff15=_0x196660||[];var _0x46d31e=[];if(_0x196660){for(var _0x235441=0x0;_0x235441<_0x196660['length'];_0x235441+=0x1){var _0x324501=_0x196660[_0x235441][_0xd242('0x29')]({'plain':!![]});_0x27b565[_0xd242('0x98')]=_0x267c10[_0xd242('0x50')]['dialCheckDuplicateType']?_0x267c10[_0xd242('0x50')][_0xd242('0x98')]:_0x27b565[_0xd242('0x98')];switch(_0x27b565[_0xd242('0x98')]){case _0xd242('0x99'):_0x348757=squel[_0xd242('0x9a')]()[_0xd242('0x9b')](_0xd242('0x9c'))[_0xd242('0x9d')]([_0xd242('0x9e'),_0xd242('0x9f'),_0xd242('0xa0'),_0xd242('0xa1'),_0xd242('0x60'),_0xd242('0x59'),'updatedAt'],squel[_0xd242('0x7f')]()[_0xd242('0xa2')]('phone','phone')[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x9f'))[_0xd242('0xa2')]('id',_0xd242('0xa0'))[_0xd242('0xa2')](_0x324501[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))[_0xd242('0xa2')](_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')](),_0xd242('0x60'))[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x59'))[_0xd242('0xa2')]('NOW()',_0xd242('0x5a'))[_0xd242('0xa5')]('cm_contacts')['where'](_0xd242('0xa6'))['where'](_0xd242('0xa7'),_0x324501[_0xd242('0xa4')]['toString']())[_0xd242('0x45')](_0xd242('0xa8'))[_0xd242('0x45')](_0xd242('0xa9'),squel[_0xd242('0x7f')]()[_0xd242('0xa2')](_0xd242('0xaa'))['from'](_0xd242('0xab'))['where'](_0xd242('0x83'),_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')]()))['where'](_0xd242('0xa9'),squel['select']()[_0xd242('0xa2')](_0xd242('0xac'))['from'](_0xd242('0x9c'))[_0xd242('0x45')](_0xd242('0x83'),_0x267c10['params']['id'][_0xd242('0x86')]())))[_0xd242('0x86')]();break;case'onlyIfOpen':_0x348757=squel[_0xd242('0x9a')]()['into'](_0xd242('0x9c'))[_0xd242('0x9d')](['phone',_0xd242('0x9f'),'ContactId',_0xd242('0xa1'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xd242('0x7f')]()['field'](_0xd242('0x9e'),'phone')[_0xd242('0xa2')]('NOW()',_0xd242('0x9f'))[_0xd242('0xa2')]('id',_0xd242('0xa0'))[_0xd242('0xa2')](_0x324501[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))[_0xd242('0xa2')](_0x267c10[_0xd242('0x4d')]['id']['toString'](),_0xd242('0x60'))[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x59'))[_0xd242('0xa2')](_0xd242('0xa3'),_0xd242('0x5a'))[_0xd242('0xa5')]('cm_contacts')[_0xd242('0x45')](_0xd242('0xa6'))[_0xd242('0x45')](_0xd242('0xa7'),_0x324501[_0xd242('0xa4')][_0xd242('0x86')]())[_0xd242('0x45')](_0xd242('0xa8'))[_0xd242('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd242('0x7f')]()[_0xd242('0xa2')](_0xd242('0xac'))[_0xd242('0xa5')](_0xd242('0x9c'))[_0xd242('0x45')]('VoiceQueueId\x20=\x20?',_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')]())))['toString']();break;default:_0x348757=squel['insert']()[_0xd242('0x9b')](_0xd242('0x9c'))['fromQuery']([_0xd242('0x9e'),_0xd242('0x9f'),_0xd242('0xa0'),_0xd242('0xa1'),_0xd242('0x60'),_0xd242('0x59'),_0xd242('0x5a')],squel[_0xd242('0x7f')]()['field'](_0xd242('0x9e'),_0xd242('0x9e'))['field'](_0xd242('0xa3'),_0xd242('0x9f'))[_0xd242('0xa2')]('id','ContactId')[_0xd242('0xa2')](_0x324501[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))[_0xd242('0xa2')](_0x267c10[_0xd242('0x4d')]['id'][_0xd242('0x86')](),_0xd242('0x60'))['field']('NOW()','createdAt')['field']('NOW()',_0xd242('0x5a'))[_0xd242('0xa5')]('cm_contacts')['where'](_0xd242('0xa6'))[_0xd242('0x45')](_0xd242('0xa7'),_0x324501[_0xd242('0xa4')][_0xd242('0x86')]())[_0xd242('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xd242('0x86')]();}_0x46d31e['push'](db[_0xd242('0x73')][_0xd242('0x3b')](_0x348757));}return BPromise[_0xd242('0x8a')](_0x46d31e);}})[_0xd242('0x27')](function(){return _0x8fff15;})['then'](respondWithResult(_0x407d09,null))[_0xd242('0x4c')](handleError(_0x407d09,null));};exports[_0xd242('0xad')]=function(_0x5e4d4b,_0x2f8396,_0xfbd955){return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x5e4d4b[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x2f8396,null))[_0xd242('0x27')](function(_0x5e9f6b){if(_0x5e9f6b){return _0x5e9f6b[_0xd242('0xad')](_0x5e4d4b[_0xd242('0x3b')][_0xd242('0x7e')]);}})[_0xd242('0x27')](function(_0x2a5296){if(_0x2a5296){return db['CmHopper'][_0xd242('0x28')]({'where':{'ListId':_0x5e4d4b['query']['ids'],'VoiceQueueId':_0x5e4d4b[_0xd242('0x4d')]['id']}})['then'](function(){return _0x2a5296;});}})[_0xd242('0x27')](respondWithStatusCode(_0x2f8396,null))[_0xd242('0x4c')](handleError(_0x2f8396,null));};exports[_0xd242('0xae')]=function(_0x5ce0f3,_0x2222c8,_0x46d3af){var _0x80f70f={};var _0x3475f8={};var _0x302ffa;var _0x4e89b3;return db[_0xd242('0x38')][_0xd242('0x5e')]({'where':{'id':_0x5ce0f3[_0xd242('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2222c8,null))[_0xd242('0x27')](function(_0x4cf7ac){if(_0x4cf7ac){_0x302ffa=_0x4cf7ac;_0x3475f8[_0xd242('0x3e')]=_[_0xd242('0x3a')](db[_0xd242('0xaf')][_0xd242('0x4e')]);_0x3475f8[_0xd242('0x3b')]=_[_0xd242('0x3a')](_0x5ce0f3['query']);_0x3475f8['filters']=_[_0xd242('0x3d')](_0x3475f8['model'],_0x3475f8[_0xd242('0x3b')]);_0x80f70f[_0xd242('0x3f')]=_['intersection'](_0x3475f8[_0xd242('0x3e')],qs[_0xd242('0x40')](_0x5ce0f3['query'][_0xd242('0x40')]));_0x80f70f['attributes']=_0x80f70f[_0xd242('0x3f')][_0xd242('0x41')]?_0x80f70f['attributes']:_0x3475f8[_0xd242('0x3e')];_0x80f70f['order']=qs[_0xd242('0x44')](_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x44')]);_0x80f70f[_0xd242('0x45')]=qs['filters'](_[_0xd242('0x46')](_0x5ce0f3[_0xd242('0x3b')],_0x3475f8[_0xd242('0x3c')]));if(_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x2d')]){_0x80f70f[_0xd242('0x45')]=_[_0xd242('0x47')](_0x80f70f['where'],{'$or':_[_0xd242('0x2f')](_0x80f70f[_0xd242('0x3f')],function(_0x30ad52){var _0x55cdce={};_0x55cdce[_0x30ad52]={'$like':'%'+_0x5ce0f3['query'][_0xd242('0x2d')]+'%'};return _0x55cdce;})});}_0x80f70f=_[_0xd242('0x47')]({},_0x80f70f,_0x5ce0f3[_0xd242('0x61')]);return _0x302ffa[_0xd242('0xae')](_0x80f70f);}})[_0xd242('0x27')](function(_0x36472f){if(_0x36472f){_0x4e89b3=_0x36472f[_0xd242('0x41')];if(!_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x42')](_0xd242('0x43'))){_0x80f70f[_0xd242('0x20')]=qs[_0xd242('0x20')](_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x20')]);_0x80f70f['offset']=qs[_0xd242('0x1f')](_0x5ce0f3[_0xd242('0x3b')][_0xd242('0x1f')]);}return _0x302ffa[_0xd242('0xae')](_0x80f70f);}})[_0xd242('0x27')](function(_0x29674f){if(_0x29674f){return _0x29674f?{'count':_0x4e89b3,'rows':_0x29674f}:null;}})[_0xd242('0x27')](respondWithResult(_0x2222c8,null))[_0xd242('0x4c')](handleError(_0x2222c8,null));};exports[_0xd242('0xb0')]=function(_0x5272c5,_0x553c87,_0x522ce2){var _0x5260f5,_0x2ffb1c;return db['VoiceQueue'][_0xd242('0x32')]({'where':{'id':_0x5272c5['params']['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x553c87,null))[_0xd242('0x27')](function(_0x589ead){if(_0x589ead){_0x2ffb1c=_0x589ead;return _0x589ead['addBlackLists'](_0x5272c5[_0xd242('0x50')]['ids'],_['omit'](_0x5272c5[_0xd242('0x50')],[_0xd242('0x7e'),'id'])||{});}return null;})[_0xd242('0x91')](function(_0x24aa6e){var _0x278ccb;_0x5260f5=_0x24aa6e||[];var _0x1c56d5=[];if(_0x24aa6e){for(var _0x3cebd3=0x0;_0x3cebd3<_0x24aa6e[_0xd242('0x41')];_0x3cebd3+=0x1){var _0x17dd02=_0x24aa6e[_0x3cebd3][_0xd242('0x29')]({'plain':!![]});_0x278ccb=squel[_0xd242('0x9a')]()[_0xd242('0x9b')](_0xd242('0xb1'))[_0xd242('0x9d')]([_0xd242('0x9e'),_0xd242('0xa0'),_0xd242('0xa1'),'VoiceQueueId',_0xd242('0x59'),_0xd242('0x5a')],squel[_0xd242('0x7f')]()[_0xd242('0xa2')]('phone',_0xd242('0x9e'))[_0xd242('0xa2')]('id',_0xd242('0xa0'))[_0xd242('0xa2')](_0x17dd02[_0xd242('0xa4')][_0xd242('0x86')](),_0xd242('0xa1'))['field'](_0x5272c5[_0xd242('0x4d')]['id'][_0xd242('0x86')](),_0xd242('0x60'))['field'](_0xd242('0xa3'),_0xd242('0x59'))['field']('NOW()',_0xd242('0x5a'))[_0xd242('0xa5')](_0xd242('0xb2'))[_0xd242('0x45')](_0xd242('0xa6'))['where']('ListId\x20=\x20?',_0x17dd02['CmListId']['toString']())['where'](_0xd242('0xa8')))['toString']();_0x1c56d5[_0xd242('0x85')](db[_0xd242('0x73')]['query'](_0x278ccb));}return BPromise[_0xd242('0x8a')](_0x1c56d5);}})[_0xd242('0x27')](function(){return _0x5260f5;})[_0xd242('0x27')](respondWithResult(_0x553c87,null))[_0xd242('0x4c')](handleError(_0x553c87,null));};exports[_0xd242('0xb3')]=function(_0x4c6e88,_0x5a9622,_0x4720c8){return db[_0xd242('0x38')][_0xd242('0x32')]({'where':{'id':_0x4c6e88[_0xd242('0x4d')]['id']}})[_0xd242('0x27')](handleEntityNotFound(_0x5a9622,null))[_0xd242('0x27')](function(_0x58d2e5){if(_0x58d2e5){return _0x58d2e5[_0xd242('0xb3')](_0x4c6e88[_0xd242('0x3b')]['ids']);}})[_0xd242('0x27')](function(_0x1704db){if(_0x1704db){return db[_0xd242('0x67')][_0xd242('0x28')]({'where':{'ListId':_0x4c6e88['query'][_0xd242('0x7e')],'VoiceQueueId':_0x4c6e88[_0xd242('0x4d')]['id']}})['then'](function(){return _0x1704db;});}})[_0xd242('0x27')](respondWithStatusCode(_0x5a9622,null))[_0xd242('0x4c')](handleError(_0x5a9622,null));}; \ No newline at end of file +var _0xf374=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','intersection','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','CmHopper','rows','CmHopperHistory','getHopperFinals','findOne','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','upsert','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','isNil','format','SIP/%s','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','index','VoiceQueue','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','merge','options','includeAll','include','findAll','show','params','filters','find','create','body','user','get','role','VoiceQueues','outbound','UserProfileSection','autoAssociation','catch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf374,0x118));var _0x4f37=function(_0x51bd2d,_0x48cb6a){_0x51bd2d=_0x51bd2d-0x0;var _0x1c4a9f=_0xf374[_0x51bd2d];return _0x1c4a9f;};'use strict';var pdf=require(_0x4f37('0x0'));var emlformat=require(_0x4f37('0x1'));var rimraf=require(_0x4f37('0x2'));var zipdir=require(_0x4f37('0x3'));var jsonpatch=require(_0x4f37('0x4'));var rp=require(_0x4f37('0x5'));var moment=require(_0x4f37('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4f37('0x7'));var util=require(_0x4f37('0x8'));var path=require(_0x4f37('0x9'));var sox=require(_0x4f37('0xa'));var csv=require('to-csv');var ejs=require(_0x4f37('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f37('0xc'));var crypto=require(_0x4f37('0xd'));var jsforce=require(_0x4f37('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f37('0xf'));var querystring=require('querystring');var Papa=require(_0x4f37('0x10'));var Redis=require(_0x4f37('0x11'));var authService=require(_0x4f37('0x12'));var qs=require(_0x4f37('0x13'));var as=require(_0x4f37('0x14'));var hardwareService=require(_0x4f37('0x15'));var logger=require('../../config/logger')(_0x4f37('0x16'));var utils=require('../../config/utils');var config=require(_0x4f37('0x17'));var db=require(_0x4f37('0x18'))['db'];config[_0x4f37('0x19')]=_[_0x4f37('0x1a')](config[_0x4f37('0x19')],{'host':_0x4f37('0x1b'),'port':0x18eb});var socket=require(_0x4f37('0x1c'))(new Redis(config['redis']));require(_0x4f37('0x1d'))[_0x4f37('0x1e')](socket);function respondWithStatusCode(_0x1ebad3,_0x94f97c){_0x94f97c=_0x94f97c||0xcc;return function(_0x2f5750){if(_0x2f5750){return _0x1ebad3['sendStatus'](_0x94f97c);}return _0x1ebad3[_0x4f37('0x1f')](_0x94f97c)[_0x4f37('0x20')]();};}function respondWithResult(_0x4ae325,_0xbca7c9){_0xbca7c9=_0xbca7c9||0xc8;return function(_0x495a85){if(_0x495a85){return _0x4ae325[_0x4f37('0x1f')](_0xbca7c9)[_0x4f37('0x21')](_0x495a85);}};}function respondWithFilteredResult(_0x5d3998,_0x55aa5c){return function(_0x49e8f7){if(_0x49e8f7){var _0x56b836=_0x49e8f7[_0x4f37('0x22')],_0xdf1dca=_0x55aa5c[_0x4f37('0x23')],_0x38314d=_0x55aa5c[_0x4f37('0x23')]+_0x55aa5c[_0x4f37('0x24')],_0x20a03c;if(_0x38314d>=_0x56b836){_0x38314d=_0x56b836;_0x20a03c=0xc8;}else{_0x20a03c=0xce;}_0x5d3998[_0x4f37('0x1f')](_0x20a03c);return _0x5d3998[_0x4f37('0x25')](_0x4f37('0x26'),_0xdf1dca+'-'+_0x38314d+'/'+_0x56b836)[_0x4f37('0x21')](_0x49e8f7);}return null;};}function patchUpdates(_0x28558e){return function(_0x58d612){try{jsonpatch['apply'](_0x58d612,_0x28558e,!![]);}catch(_0x4c1209){return BPromise['reject'](_0x4c1209);}return _0x58d612[_0x4f37('0x27')]();};}function saveUpdates(_0x53580c,_0x954a66){return function(_0x4c4ca0){if(_0x4c4ca0){return _0x4c4ca0[_0x4f37('0x28')](_0x53580c)['then'](function(_0x3bb542){return _0x3bb542;});}return null;};}function removeEntity(_0x5778d1,_0x4820b5){return function(_0x383ad4){if(_0x383ad4){return _0x383ad4[_0x4f37('0x29')]()[_0x4f37('0x2a')](function(){var _0x588f70=_0x383ad4['get']({'plain':!![]});var _0x53b0c=[{'name':'VoiceQueues','value':_0x4f37('0x2b'),'ignore':![]},{'name':_0x4f37('0x2c'),'value':'outbound','ignore':![]}];var _0x16f3f5=_(_0x53b0c)[_0x4f37('0x2d')]('ignore')[_0x4f37('0x2e')](_0x4f37('0x2f'))[_0x4f37('0x2f')]();if(_[_0x4f37('0x30')](_0x16f3f5,_0x588f70[_0x4f37('0x31')])){return;}var _0x3f035c=_['find'](_0x53b0c,[_0x4f37('0x2f'),_0x588f70['type']])['name'];return db[_0x4f37('0x32')][_0x4f37('0x29')]({'where':{'type':_0x3f035c,'resourceId':_0x588f70['id']}})[_0x4f37('0x2a')](function(){return _0x383ad4;});})['then'](function(){_0x5778d1['status'](0xcc)[_0x4f37('0x20')]();});}};}function handleEntityNotFound(_0x1fa463,_0x38d2f6){return function(_0x18e8e3){if(!_0x18e8e3){_0x1fa463['sendStatus'](0x194);}return _0x18e8e3;};}function handleError(_0x42b646,_0x4cc479){_0x4cc479=_0x4cc479||0x1f4;return function(_0x2749f4){logger['error'](_0x2749f4['stack']);if(_0x2749f4['name']){delete _0x2749f4['name'];}_0x42b646[_0x4f37('0x1f')](_0x4cc479)['send'](_0x2749f4);};}exports[_0x4f37('0x33')]=function(_0xefdb7b,_0x3854d0){var _0x48c3ab={},_0xfafeee={},_0x31b2d1={'count':0x0,'rows':[]};var _0x455c3a=_[_0x4f37('0x2e')](db[_0x4f37('0x34')][_0x4f37('0x35')],function(_0x139537){return{'name':_0x139537['fieldName'],'type':_0x139537[_0x4f37('0x31')][_0x4f37('0x36')]};});_0xfafeee[_0x4f37('0x37')]=_[_0x4f37('0x2e')](_0x455c3a,'name');_0xfafeee[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0xefdb7b[_0x4f37('0x38')]);_0xfafeee['filters']=_['intersection'](_0xfafeee[_0x4f37('0x37')],_0xfafeee['query']);_0x48c3ab[_0x4f37('0x3a')]=_['intersection'](_0xfafeee[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0xefdb7b[_0x4f37('0x38')]['fields']));_0x48c3ab[_0x4f37('0x3a')]=_0x48c3ab['attributes'][_0x4f37('0x3c')]?_0x48c3ab[_0x4f37('0x3a')]:_0xfafeee[_0x4f37('0x37')];if(!_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x48c3ab[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0xefdb7b[_0x4f37('0x38')]['limit']);_0x48c3ab['offset']=qs[_0x4f37('0x23')](_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x23')]);}_0x48c3ab[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0xefdb7b['query'][_0x4f37('0x40')]);_0x48c3ab[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0xefdb7b[_0x4f37('0x38')],_0xfafeee['filters']),_0x455c3a);if(_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x48c3ab[_0x4f37('0x41')]=_['merge'](_0x48c3ab[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x455c3a,function(_0x518a37){if(_0x518a37[_0x4f37('0x31')]!==_0x4f37('0x43')){var _0xbad421={};_0xbad421[_0x518a37[_0x4f37('0x44')]]={'$like':'%'+_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0xbad421;}})});}_0x48c3ab=_[_0x4f37('0x45')]({},_0x48c3ab,_0xefdb7b[_0x4f37('0x46')]);var _0x4fab8a={'where':_0x48c3ab[_0x4f37('0x41')]};return db[_0x4f37('0x34')][_0x4f37('0x22')](_0x4fab8a)[_0x4f37('0x2a')](function(_0x123cd2){_0x31b2d1[_0x4f37('0x22')]=_0x123cd2;if(_0xefdb7b[_0x4f37('0x38')][_0x4f37('0x47')]){_0x48c3ab[_0x4f37('0x48')]=[{'all':!![]}];}return db['VoiceQueue'][_0x4f37('0x49')](_0x48c3ab);})[_0x4f37('0x2a')](function(_0x2ce244){_0x31b2d1['rows']=_0x2ce244;return _0x31b2d1;})[_0x4f37('0x2a')](respondWithFilteredResult(_0x3854d0,_0x48c3ab))['catch'](handleError(_0x3854d0,null));};exports[_0x4f37('0x4a')]=function(_0x5e86c9,_0xb2d9a0){var _0x50eefc={'raw':![],'where':{'id':_0x5e86c9[_0x4f37('0x4b')]['id']}},_0x4af5c6={};_0x4af5c6[_0x4f37('0x37')]=_['keys'](db[_0x4f37('0x34')][_0x4f37('0x35')]);_0x4af5c6[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x5e86c9[_0x4f37('0x38')]);_0x4af5c6[_0x4f37('0x4c')]=_['intersection'](_0x4af5c6[_0x4f37('0x37')],_0x4af5c6[_0x4f37('0x38')]);_0x50eefc[_0x4f37('0x3a')]=_['intersection'](_0x4af5c6['model'],qs[_0x4f37('0x3b')](_0x5e86c9[_0x4f37('0x38')]['fields']));_0x50eefc[_0x4f37('0x3a')]=_0x50eefc[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x50eefc[_0x4f37('0x3a')]:_0x4af5c6[_0x4f37('0x37')];if(_0x5e86c9[_0x4f37('0x38')][_0x4f37('0x47')]){_0x50eefc[_0x4f37('0x48')]=[{'all':!![]}];}_0x50eefc=_[_0x4f37('0x45')]({},_0x50eefc,_0x5e86c9[_0x4f37('0x46')]);return db[_0x4f37('0x34')][_0x4f37('0x4d')](_0x50eefc)[_0x4f37('0x2a')](handleEntityNotFound(_0xb2d9a0,null))[_0x4f37('0x2a')](respondWithResult(_0xb2d9a0,null))['catch'](handleError(_0xb2d9a0,null));};exports['create']=function(_0x72781f,_0x574b08){return db[_0x4f37('0x34')][_0x4f37('0x4e')](_0x72781f[_0x4f37('0x4f')],{})['then'](function(_0x48fa20){var _0x17ee5f=_0x72781f[_0x4f37('0x50')][_0x4f37('0x51')]({'plain':!![]});if(!_0x17ee5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17ee5f[_0x4f37('0x52')]===_0x4f37('0x50')){var _0x353087=_0x48fa20[_0x4f37('0x51')]({'plain':!![]});var _0x59ce32=[{'name':_0x4f37('0x53'),'value':_0x4f37('0x2b')},{'name':_0x4f37('0x2c'),'value':_0x4f37('0x54')}];var _0x3630b5=_[_0x4f37('0x4d')](_0x59ce32,[_0x4f37('0x2f'),_0x353087[_0x4f37('0x31')]])[_0x4f37('0x44')];return db[_0x4f37('0x55')][_0x4f37('0x4d')]({'where':{'name':_0x3630b5,'userProfileId':_0x17ee5f['userProfileId']},'raw':!![]})[_0x4f37('0x2a')](function(_0x2059af){if(_0x2059af&&_0x2059af[_0x4f37('0x56')]===0x0){return db[_0x4f37('0x32')][_0x4f37('0x4e')]({'name':_0x353087['name'],'resourceId':_0x353087['id'],'type':_0x2059af[_0x4f37('0x44')],'sectionId':_0x2059af['id']},{})[_0x4f37('0x2a')](function(){return _0x48fa20;});}else{return _0x48fa20;}})[_0x4f37('0x57')](function(_0x533abd){logger[_0x4f37('0x58')](_0x4f37('0x59'),_0x533abd);throw _0x533abd;});}return _0x48fa20;})[_0x4f37('0x2a')](respondWithResult(_0x574b08,0xc9))[_0x4f37('0x57')](handleError(_0x574b08,null));};exports[_0x4f37('0x5a')]=function(_0x4f1e98,_0x5e9e84){var _0x5a80cf={'where':{'id':_0x4f1e98[_0x4f37('0x4b')]['id']}},_0x5ed7fb={};_0x5ed7fb[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x34')]['rawAttributes']);_0x5a80cf[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x5ed7fb[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x4f1e98['query'][_0x4f37('0x3b')]));_0x5a80cf['attributes']=_0x5a80cf[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x5a80cf[_0x4f37('0x3a')]:_0x5ed7fb['model'];if(_0x4f1e98['query'][_0x4f37('0x47')]){_0x5a80cf[_0x4f37('0x48')]=[{'all':!![]}];}_0x5a80cf=_[_0x4f37('0x45')]({},_0x5a80cf,_0x4f1e98['options']);return db[_0x4f37('0x34')][_0x4f37('0x4d')](_0x5a80cf)[_0x4f37('0x2a')](handleEntityNotFound(_0x5e9e84,null))['then'](function(_0x393b51){if(_0x393b51){var _0x208fad=_0x393b51[_0x4f37('0x51')]({'plain':!![]});_0x208fad=qs[_0x4f37('0x5c')](_0x208fad,['id','createdAt',_0x4f37('0x5d')]);_0x4f1e98['body']=_['omit'](_0x4f1e98['body'],['id',_0x4f37('0x5e'),'updatedAt']);return db[_0x4f37('0x34')][_0x4f37('0x4e')](_[_0x4f37('0x45')](_0x208fad,_0x4f1e98[_0x4f37('0x4f')]),{'include':_0x4f1e98[_0x4f37('0x38')][_0x4f37('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x30413){var _0x3257e5=_0x4f1e98['user'][_0x4f37('0x51')]({'plain':!![]});if(!_0x3257e5)throw new Error(_0x4f37('0x5f'));if(_0x3257e5[_0x4f37('0x52')]===_0x4f37('0x50')){var _0x5ab293=_0x30413[_0x4f37('0x51')]({'plain':!![]});var _0x16b890=[{'name':_0x4f37('0x53'),'value':'inbound'},{'name':_0x4f37('0x2c'),'value':_0x4f37('0x54')}];var _0x2754fd=_[_0x4f37('0x4d')](_0x16b890,['value',_0x5ab293[_0x4f37('0x31')]])['name'];return db[_0x4f37('0x55')][_0x4f37('0x4d')]({'where':{'name':_0x2754fd,'userProfileId':_0x3257e5[_0x4f37('0x60')]},'raw':!![]})['then'](function(_0x23f644){if(_0x23f644&&_0x23f644[_0x4f37('0x56')]===0x0){return db['UserProfileResource'][_0x4f37('0x4e')]({'name':_0x5ab293[_0x4f37('0x44')],'resourceId':_0x5ab293['id'],'type':_0x23f644[_0x4f37('0x44')],'sectionId':_0x23f644['id']},{})[_0x4f37('0x2a')](function(){return _0x30413;});}else{return _0x30413;}})[_0x4f37('0x57')](function(_0x2c1187){logger[_0x4f37('0x58')](_0x4f37('0x59'),_0x2c1187);throw _0x2c1187;});}return _0x30413;});}})[_0x4f37('0x2a')](respondWithResult(_0x5e9e84,0xc9))[_0x4f37('0x57')](handleError(_0x5e9e84,null));};exports['update']=function(_0x2ef201,_0x225fb3){if(_0x2ef201[_0x4f37('0x4f')]['id']){delete _0x2ef201[_0x4f37('0x4f')]['id'];}return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x2ef201[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x225fb3,null))[_0x4f37('0x2a')](saveUpdates(_0x2ef201[_0x4f37('0x4f')],null))['then'](respondWithResult(_0x225fb3,null))['catch'](handleError(_0x225fb3,null));};exports[_0x4f37('0x29')]=function(_0x11b3c0,_0x350d26){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x11b3c0[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x350d26,null))[_0x4f37('0x2a')](removeEntity(_0x350d26,null))[_0x4f37('0x57')](handleError(_0x350d26,null));};exports['getHoppers']=function(_0x3018d0,_0x58ab0c,_0x512569){var _0x132adf={'raw':![],'where':{}};var _0x2fe80e={};var _0x4c1bbb={'count':0x0,'rows':[]};return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x3018d0[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x58ab0c,null))[_0x4f37('0x2a')](function(_0x1b3a35){if(_0x1b3a35){_0x2fe80e[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x61')][_0x4f37('0x35')]);_0x2fe80e[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x3018d0[_0x4f37('0x38')]);_0x2fe80e[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x2fe80e['model'],_0x2fe80e[_0x4f37('0x38')]);_0x132adf['attributes']=_[_0x4f37('0x5b')](_0x2fe80e[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x3018d0['query'][_0x4f37('0x3b')]));_0x132adf[_0x4f37('0x3a')]=_0x132adf[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x132adf[_0x4f37('0x3a')]:_0x2fe80e[_0x4f37('0x37')];if(!_0x3018d0[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x132adf[_0x4f37('0x24')]=qs['limit'](_0x3018d0[_0x4f37('0x38')][_0x4f37('0x24')]);_0x132adf[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x3018d0['query']['offset']);}_0x132adf[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x3018d0[_0x4f37('0x38')][_0x4f37('0x40')]);_0x132adf[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x3018d0[_0x4f37('0x38')],_0x2fe80e['filters']));_0x132adf[_0x4f37('0x41')]['VoiceQueueId']=_0x1b3a35['id'];if(_0x3018d0[_0x4f37('0x38')]['filter']){_0x132adf[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x132adf[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x132adf[_0x4f37('0x3a')],function(_0x5b6b1e){var _0x1e01d2={};_0x1e01d2[_0x5b6b1e]={'$like':'%'+_0x3018d0[_0x4f37('0x38')]['filter']+'%'};return _0x1e01d2;})});}_0x132adf=_[_0x4f37('0x45')]({},_0x132adf,_0x3018d0[_0x4f37('0x46')]);return db[_0x4f37('0x61')][_0x4f37('0x22')]({'where':_0x132adf[_0x4f37('0x41')]})[_0x4f37('0x2a')](function(_0x55faa0){_0x4c1bbb[_0x4f37('0x22')]=_0x55faa0;if(_0x3018d0['query'][_0x4f37('0x47')]){_0x132adf[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x61')]['findAll'](_0x132adf);})['then'](function(_0x2a2de5){_0x4c1bbb[_0x4f37('0x62')]=_0x2a2de5;return _0x4c1bbb;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x58ab0c,_0x132adf))[_0x4f37('0x57')](handleError(_0x58ab0c,null));};exports['getHopperHistories']=function(_0x3ad4cd,_0x28d689,_0x284e8d){var _0x51d11d={'raw':!![],'where':{}};var _0x56bd13={};var _0x4ee342={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ad4cd[_0x4f37('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28d689,null))[_0x4f37('0x2a')](function(_0x565383){if(_0x565383){_0x56bd13[_0x4f37('0x37')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x56bd13[_0x4f37('0x38')]=_['keys'](_0x3ad4cd[_0x4f37('0x38')]);_0x56bd13['filters']=_['intersection'](_0x56bd13[_0x4f37('0x37')],_0x56bd13['query']);_0x51d11d[_0x4f37('0x3a')]=_['intersection'](_0x56bd13['model'],qs[_0x4f37('0x3b')](_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x51d11d[_0x4f37('0x3a')]=_0x51d11d['attributes'][_0x4f37('0x3c')]?_0x51d11d['attributes']:_0x56bd13[_0x4f37('0x37')];if(!_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x51d11d[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x3ad4cd['query']['limit']);_0x51d11d[_0x4f37('0x23')]=qs['offset'](_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x23')]);}_0x51d11d['order']=qs['sort'](_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x40')]);_0x51d11d['where']=qs['filters'](_['pick'](_0x3ad4cd[_0x4f37('0x38')],_0x56bd13[_0x4f37('0x4c')]));_0x51d11d[_0x4f37('0x41')]['VoiceQueueId']=_0x565383['id'];if(_0x3ad4cd['query'][_0x4f37('0x2d')]){_0x51d11d[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x51d11d[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x51d11d[_0x4f37('0x3a')],function(_0x54cf){var _0x902c62={};_0x902c62[_0x54cf]={'$like':'%'+_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x902c62;})});}_0x51d11d=_['merge']({},_0x51d11d,_0x3ad4cd['options']);return db['CmHopperHistory'][_0x4f37('0x22')]({'where':_0x51d11d[_0x4f37('0x41')]})[_0x4f37('0x2a')](function(_0x99161e){_0x4ee342['count']=_0x99161e;if(_0x3ad4cd[_0x4f37('0x38')][_0x4f37('0x47')]){_0x51d11d[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x63')][_0x4f37('0x49')](_0x51d11d);})[_0x4f37('0x2a')](function(_0x1ecd07){_0x4ee342[_0x4f37('0x62')]=_0x1ecd07;return _0x4ee342;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x28d689,_0x51d11d))[_0x4f37('0x57')](handleError(_0x28d689,null));};exports[_0x4f37('0x64')]=function(_0x44fc68,_0x4a88e6,_0x415953){var _0x1e5af0={'raw':!![],'where':{}};var _0x3e8556={};var _0xdd4655={'count':0x0,'rows':[]};return db[_0x4f37('0x34')][_0x4f37('0x65')]({'where':{'id':_0x44fc68['params']['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x4a88e6,null))[_0x4f37('0x2a')](function(_0x155308){if(_0x155308){_0x3e8556[_0x4f37('0x37')]=_[_0x4f37('0x39')](db['CmHopperFinal']['rawAttributes']);_0x3e8556[_0x4f37('0x38')]=_['keys'](_0x44fc68[_0x4f37('0x38')]);_0x3e8556[_0x4f37('0x4c')]=_['intersection'](_0x3e8556[_0x4f37('0x37')],_0x3e8556['query']);_0x1e5af0[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x3e8556[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x44fc68['query']['fields']));_0x1e5af0['attributes']=_0x1e5af0['attributes'][_0x4f37('0x3c')]?_0x1e5af0['attributes']:_0x3e8556[_0x4f37('0x37')];if(!_0x44fc68[_0x4f37('0x38')][_0x4f37('0x3d')]('nolimit')){_0x1e5af0[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x44fc68[_0x4f37('0x38')][_0x4f37('0x24')]);_0x1e5af0[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x44fc68[_0x4f37('0x38')]['offset']);}_0x1e5af0[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x44fc68['query']['sort']);_0x1e5af0[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0x44fc68[_0x4f37('0x38')],_0x3e8556[_0x4f37('0x4c')]));_0x1e5af0[_0x4f37('0x41')][_0x4f37('0x66')]=_0x155308['id'];if(_0x44fc68[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x1e5af0[_0x4f37('0x41')]=_['merge'](_0x1e5af0[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x1e5af0[_0x4f37('0x3a')],function(_0x324252){var _0x3e1bdf={};_0x3e1bdf[_0x324252]={'$like':'%'+_0x44fc68[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x3e1bdf;})});}_0x1e5af0=_[_0x4f37('0x45')]({},_0x1e5af0,_0x44fc68[_0x4f37('0x46')]);return db['CmHopperFinal']['count']({'where':_0x1e5af0[_0x4f37('0x41')]})[_0x4f37('0x2a')](function(_0x380054){_0xdd4655[_0x4f37('0x22')]=_0x380054;if(_0x44fc68[_0x4f37('0x38')][_0x4f37('0x47')]){_0x1e5af0[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x67')][_0x4f37('0x49')](_0x1e5af0);})[_0x4f37('0x2a')](function(_0x37b744){_0xdd4655[_0x4f37('0x62')]=_0x37b744;return _0xdd4655;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x4a88e6,_0x1e5af0))[_0x4f37('0x57')](handleError(_0x4a88e6,null));};exports[_0x4f37('0x68')]=function(_0x506e9f,_0x14a904,_0x2324f7){var _0x3b8a80={'raw':!![],'where':{}};var _0x13b580={};var _0x3687f3={'count':0x0,'rows':[]};return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x506e9f[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x14a904,null))[_0x4f37('0x2a')](function(_0x15906d){if(_0x15906d){_0x13b580[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x69')][_0x4f37('0x35')]);_0x13b580[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x506e9f[_0x4f37('0x38')]);_0x13b580[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x13b580['model'],_0x13b580['query']);_0x3b8a80[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x13b580['model'],qs[_0x4f37('0x3b')](_0x506e9f[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x3b8a80[_0x4f37('0x3a')]=_0x3b8a80[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x3b8a80['attributes']:_0x13b580[_0x4f37('0x37')];if(!_0x506e9f[_0x4f37('0x38')]['hasOwnProperty']('nolimit')){_0x3b8a80[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x506e9f[_0x4f37('0x38')][_0x4f37('0x24')]);_0x3b8a80[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x506e9f[_0x4f37('0x38')]['offset']);}_0x3b8a80[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x506e9f[_0x4f37('0x38')][_0x4f37('0x40')]);_0x3b8a80[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x506e9f[_0x4f37('0x38')],_0x13b580[_0x4f37('0x4c')]));_0x3b8a80[_0x4f37('0x41')][_0x4f37('0x66')]=_0x15906d['id'];if(_0x506e9f[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x3b8a80[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x3b8a80['where'],{'$or':_['map'](_0x3b8a80[_0x4f37('0x3a')],function(_0x22b815){var _0x390bbf={};_0x390bbf[_0x22b815]={'$like':'%'+_0x506e9f['query'][_0x4f37('0x2d')]+'%'};return _0x390bbf;})});}_0x3b8a80=_[_0x4f37('0x45')]({},_0x3b8a80,_0x506e9f['options']);return db[_0x4f37('0x69')]['count']({'where':_0x3b8a80['where']})['then'](function(_0x2cacf6){_0x3687f3['count']=_0x2cacf6;if(_0x506e9f[_0x4f37('0x38')]['includeAll']){_0x3b8a80[_0x4f37('0x48')]=[{'all':!![]}];}return db[_0x4f37('0x69')][_0x4f37('0x49')](_0x3b8a80);})[_0x4f37('0x2a')](function(_0x1ddd17){_0x3687f3['rows']=_0x1ddd17;return _0x3687f3;});}})[_0x4f37('0x2a')](respondWithFilteredResult(_0x14a904,_0x3b8a80))[_0x4f37('0x57')](handleError(_0x14a904,null));};exports['getTeams']=function(_0x469208,_0x3ddc48,_0x333a4b){var _0x10d3d6={};var _0x2c5c02={};var _0x45c34e;var _0x5d4a16;return db[_0x4f37('0x34')][_0x4f37('0x65')]({'where':{'id':_0x469208[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x3ddc48,null))[_0x4f37('0x2a')](function(_0x106c22){if(_0x106c22){_0x45c34e=_0x106c22;_0x2c5c02[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x6a')][_0x4f37('0x35')]);_0x2c5c02[_0x4f37('0x38')]=_['keys'](_0x469208[_0x4f37('0x38')]);_0x2c5c02['filters']=_['intersection'](_0x2c5c02[_0x4f37('0x37')],_0x2c5c02[_0x4f37('0x38')]);_0x10d3d6[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x2c5c02[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x469208[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x10d3d6['attributes']=_0x10d3d6['attributes']['length']?_0x10d3d6[_0x4f37('0x3a')]:_0x2c5c02[_0x4f37('0x37')];_0x10d3d6[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x469208['query'][_0x4f37('0x40')]);_0x10d3d6['where']=qs['filters'](_[_0x4f37('0x42')](_0x469208['query'],_0x2c5c02['filters']));if(_0x469208[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x10d3d6[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x10d3d6['where'],{'$or':_['map'](_0x10d3d6['attributes'],function(_0x1f20de){var _0x2c05e4={};_0x2c05e4[_0x1f20de]={'$like':'%'+_0x469208['query'][_0x4f37('0x2d')]+'%'};return _0x2c05e4;})});}_0x10d3d6=_[_0x4f37('0x45')]({},_0x10d3d6,_0x469208['options']);return _0x45c34e[_0x4f37('0x6b')](_0x10d3d6);}})[_0x4f37('0x2a')](function(_0x22ee08){if(_0x22ee08){_0x5d4a16=_0x22ee08[_0x4f37('0x3c')];if(!_0x469208[_0x4f37('0x38')]['hasOwnProperty'](_0x4f37('0x3e'))){_0x10d3d6[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x469208['query'][_0x4f37('0x24')]);_0x10d3d6[_0x4f37('0x23')]=qs['offset'](_0x469208[_0x4f37('0x38')][_0x4f37('0x23')]);}return _0x45c34e['getTeams'](_0x10d3d6);}})[_0x4f37('0x2a')](function(_0xb7baaf){if(_0xb7baaf){return _0xb7baaf?{'count':_0x5d4a16,'rows':_0xb7baaf}:null;}})['then'](respondWithResult(_0x3ddc48,null))[_0x4f37('0x57')](handleError(_0x3ddc48,null));};exports['addTeams']=function(_0x2b3588,_0x37efb2,_0x5a389b){var _0x2ed4d5=_0x2b3588['body'][_0x4f37('0x6c')];var _0x22bba4=_[_0x4f37('0x2e')](_0x2ed4d5,'id');return db[_0x4f37('0x6a')][_0x4f37('0x49')]({'where':{'id':_0x22bba4},'attributes':['id'],'include':[{'model':db[_0x4f37('0x6d')],'as':_0x4f37('0x6e'),'attributes':['id','name',_0x4f37('0x6f'),_0x4f37('0x70'),_0x4f37('0x71')],'raw':!![]}]})[_0x4f37('0x2a')](function(_0x3b1402){if(_0x3b1402){var _0x40ee09=_[_0x4f37('0x72')](_0x3b1402,function(_0x27e5f9){var _0x4ad3ab=_0x27e5f9['get']({'plain':!![]});_0x4ad3ab[_0x4f37('0x6e')][_0x4f37('0x73')](function(_0x3b8273){_0x3b8273[_0x4f37('0x74')]=_[_0x4f37('0x4d')](_0x2ed4d5,{'id':_0x4ad3ab['id']})[_0x4f37('0x74')];});return _0x4ad3ab[_0x4f37('0x6e')];});return db['VoiceQueue'][_0x4f37('0x4d')]({'where':{'id':_0x2b3588[_0x4f37('0x4b')]['id']}})['then'](function(_0x4d2053){return db[_0x4f37('0x75')][_0x4f37('0x76')](function(_0x3ed499){return _0x4d2053[_0x4f37('0x77')](_0x22bba4,{'transaction':_0x3ed499})[_0x4f37('0x2a')](function(){return BPromise[_0x4f37('0x78')](_0x40ee09,function(_0x2a5b11){return db[_0x4f37('0x79')][_0x4f37('0x7a')]({'where':{'UserId':_0x2a5b11['id'],'VoiceQueueId':_0x2b3588['params']['id']},'defaults':{'penalty':_0x2a5b11[_0x4f37('0x74')]},'transaction':_0x3ed499});});})['then'](function(){return BPromise['each'](_['filter'](_0x40ee09,{'online':!![]}),function(_0x3b5833){return db['UserVoiceQueueRt'][_0x4f37('0x7b')]({'membername':_0x3b5833[_0x4f37('0x44')],'UserId':_0x3b5833['id'],'queue_name':_0x4d2053['name'],'VoiceQueueId':_0x4d2053['id'],'interface':_['isNil'](_0x3b5833['interface'])?util['format']('SIP/%s',_0x3b5833[_0x4f37('0x44')]):_0x3b5833['interface'],'paused':_0x3b5833['voicePause']||![],'penalty':_0x3b5833[_0x4f37('0x74')]},{'transaction':_0x3ed499});});})[_0x4f37('0x2a')](function(){_0x40ee09['forEach'](function(_0x127d27){socket[_0x4f37('0x7c')](_0x4f37('0x7d'),{'UserId':_0x127d27['id'],'VoiceQueueId':_0x4d2053['id']});});});});});}})['then'](respondWithStatusCode(_0x37efb2,null))[_0x4f37('0x57')](handleError(_0x37efb2,null));};exports[_0x4f37('0x7e')]=function(_0x1ab0e6,_0x4823ac,_0x36bdb4){return db[_0x4f37('0x6a')][_0x4f37('0x49')]({'where':{'id':_0x1ab0e6['query'][_0x4f37('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x4f37('0x6d')],'as':_0x4f37('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x4f37('0x2a')](handleEntityNotFound(_0x4823ac,null))[_0x4f37('0x2a')](function(_0x59b5f3){var _0x35b87f=_['map'](_0x59b5f3,'id');var _0x30b10d=[];var _0x25cdb3=[];var _0x9f8593=squel[_0x4f37('0x80')]();_0x9f8593['field'](_0x4f37('0x81'))[_0x4f37('0x82')](_0x4f37('0x83'),'tq')[_0x4f37('0x84')](_0x4f37('0x85'),'ut',_0x4f37('0x86'))['where'](_0x4f37('0x87'),_0x1ab0e6[_0x4f37('0x4b')]['id']);for(var _0x3308f9=0x0;_0x3308f9<_0x59b5f3[_0x4f37('0x3c')];_0x3308f9+=0x1){let _0x5e46d0=_0x59b5f3[_0x3308f9];for(var _0x2d0130=0x0;_0x2d0130<_0x5e46d0[_0x4f37('0x6e')][_0x4f37('0x3c')];_0x2d0130+=0x1){let _0xbac67b=_0x5e46d0[_0x4f37('0x6e')][_0x2d0130];var _0x188e10=_0x9f8593['clone']();_0x188e10[_0x4f37('0x41')](_0x4f37('0x88'),_0xbac67b['id']);_0x25cdb3[_0x4f37('0x89')](db[_0x4f37('0x75')]['query'](_0x188e10[_0x4f37('0x8a')](),{'type':db['sequelize'][_0x4f37('0x8b')]['SELECT']})[_0x4f37('0x2a')](function(_0x5cbecc){if(_0x5cbecc[_0x4f37('0x3c')]===0x1){return _0xbac67b['id'];}else{var _0x55d77f=_[_0x4f37('0x8c')](_[_0x4f37('0x2e')](_0x5cbecc,_0x4f37('0x8d')),function(_0x184aaf){return _['includes'](_0x35b87f,_0x184aaf);});if(_0x55d77f){return _0xbac67b['id'];}}}));}}return BPromise[_0x4f37('0x8e')](_0x25cdb3)[_0x4f37('0x2a')](function(_0x3e9474){_0x30b10d=_(_0x30b10d)[_0x4f37('0x8f')](_0x3e9474)[_0x4f37('0x90')]()[_0x4f37('0x2f')]();return db[_0x4f37('0x34')]['find']({'where':{'id':_0x1ab0e6[_0x4f37('0x4b')]['id']}})['then'](function(_0x3196c5){return db[_0x4f37('0x75')][_0x4f37('0x76')](function(_0x1a56b3){return _0x3196c5[_0x4f37('0x7e')](_0x1ab0e6['query']['ids'],{'transaction':_0x1a56b3})['then'](function(){if(!_[_0x4f37('0x91')](_0x30b10d)){return _0x3196c5[_0x4f37('0x92')](_0x30b10d,{'transaction':_0x1a56b3})[_0x4f37('0x2a')](function(){return db[_0x4f37('0x93')][_0x4f37('0x29')]({'where':{'VoiceQueueId':_0x1ab0e6[_0x4f37('0x4b')]['id'],'UserId':_0x30b10d},'transaction':_0x1a56b3});});}})['then'](function(){_0x30b10d[_0x4f37('0x73')](function(_0x280cab){socket[_0x4f37('0x7c')](_0x4f37('0x94'),{'UserId':_0x280cab,'VoiceQueueId':_0x3196c5['id']});});});});});});})[_0x4f37('0x2a')](respondWithStatusCode(_0x4823ac,null))[_0x4f37('0x57')](handleError(_0x4823ac,null));};exports[_0x4f37('0x95')]=function(_0x526470,_0x426469,_0x53a11a){var _0x2fef99,_0x375ebe;return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x526470[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x426469,null))['then'](function(_0x1da924){if(_0x1da924){_0x375ebe=_0x1da924;return _0x1da924[_0x4f37('0x95')](_0x526470[_0x4f37('0x4f')][_0x4f37('0x7f')],_[_0x4f37('0x5c')](_0x526470[_0x4f37('0x4f')],[_0x4f37('0x7f'),'id'])||{})[_0x4f37('0x96')](function(_0x30908e){for(var _0xcba955=0x0;_0xcba955<_0x526470[_0x4f37('0x4f')][_0x4f37('0x7f')]['length'];_0xcba955+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x526470['body'][_0x4f37('0x7f')][_0xcba955],'VoiceQueueId':_0x526470[_0x4f37('0x4b')]['id']});}return _0x30908e;});}})[_0x4f37('0x2a')](function(_0x27b839){_0x2fef99=_0x27b839||[];if(_0x375ebe){return db['User'][_0x4f37('0x49')]({'where':{'id':_0x526470[_0x4f37('0x4f')][_0x4f37('0x7f')]},'attributes':['id',_0x4f37('0x44'),'online',_0x4f37('0x70'),_0x4f37('0x71')],'raw':!![]});}})[_0x4f37('0x2a')](function(_0x917974){if(!_['isEmpty'](_0x917974)){var _0x1705c3=[];for(var _0x26426e=0x0;_0x26426e<_0x917974[_0x4f37('0x3c')];_0x26426e++){if(_0x917974[_0x26426e][_0x4f37('0x6f')]){_0x1705c3[_0x4f37('0x89')](db[_0x4f37('0x93')]['upsert']({'membername':_0x917974[_0x26426e]['name'],'UserId':_0x917974[_0x26426e]['id'],'queue_name':_0x375ebe[_0x4f37('0x44')],'VoiceQueueId':_0x375ebe['id'],'interface':_[_0x4f37('0x97')](_0x917974[_0x26426e][_0x4f37('0x71')])?util[_0x4f37('0x98')](_0x4f37('0x99'),_0x917974[_0x26426e]['name']):_0x917974[_0x26426e][_0x4f37('0x71')],'paused':_0x917974[_0x26426e][_0x4f37('0x70')]||![],'penalty':_0x526470['body']['penalty']||0x0}));}}return BPromise[_0x4f37('0x8e')](_0x1705c3);}})['then'](function(){return _0x2fef99;})[_0x4f37('0x2a')](respondWithResult(_0x426469,null))[_0x4f37('0x57')](handleError(_0x426469,null));};exports[_0x4f37('0x92')]=function(_0x935bc5,_0x28ce58,_0x1052b5){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x935bc5[_0x4f37('0x4b')]['id']}})['then'](handleEntityNotFound(_0x28ce58,null))[_0x4f37('0x2a')](function(_0x518c32){if(_0x518c32){return _0x518c32[_0x4f37('0x92')](_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')])[_0x4f37('0x2a')](function(){if(_[_0x4f37('0x9a')](_0x935bc5['query']['ids'])){for(var _0x15ddc8=0x0;_0x15ddc8<_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')][_0x4f37('0x3c')];_0x15ddc8+=0x1){socket[_0x4f37('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')][_0x15ddc8]),'VoiceQueueId':Number(_0x935bc5[_0x4f37('0x4b')]['id'])});}}else{socket[_0x4f37('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')]),'VoiceQueueId':Number(_0x935bc5[_0x4f37('0x4b')]['id'])});}});}})['then'](function(_0x5f50b5){return db[_0x4f37('0x93')][_0x4f37('0x29')]({'where':{'VoiceQueueId':_0x935bc5['params']['id'],'UserId':_0x935bc5[_0x4f37('0x38')][_0x4f37('0x7f')]}})['then'](function(){return _0x5f50b5;});})['then'](respondWithStatusCode(_0x28ce58,null))[_0x4f37('0x57')](handleError(_0x28ce58,null));};exports[_0x4f37('0x9b')]=function(_0x40ec78,_0x239426,_0x36ec91){var _0x5f57df={};var _0x344dd3={};var _0x209fbb;var _0x2f0a9c;return db[_0x4f37('0x34')][_0x4f37('0x65')]({'where':{'id':_0x40ec78[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x239426,null))[_0x4f37('0x2a')](function(_0x1b0d86){if(_0x1b0d86){_0x209fbb=_0x1b0d86;_0x344dd3[_0x4f37('0x37')]=_['keys'](db[_0x4f37('0x6d')][_0x4f37('0x35')]);_0x344dd3[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x40ec78[_0x4f37('0x38')]);_0x344dd3[_0x4f37('0x4c')]=_['intersection'](_0x344dd3[_0x4f37('0x37')],_0x344dd3[_0x4f37('0x38')]);_0x5f57df[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x344dd3[_0x4f37('0x37')],qs['fields'](_0x40ec78['query'][_0x4f37('0x3b')]));_0x5f57df[_0x4f37('0x3a')]=_0x5f57df['attributes']['length']?_0x5f57df[_0x4f37('0x3a')]:_0x344dd3[_0x4f37('0x37')];_0x5f57df['order']=qs['sort'](_0x40ec78['query']['sort']);_0x5f57df[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0x40ec78[_0x4f37('0x38')],_0x344dd3[_0x4f37('0x4c')]));if(_0x40ec78[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x5f57df[_0x4f37('0x41')]=_['merge'](_0x5f57df[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x5f57df[_0x4f37('0x3a')],function(_0x46f368){var _0x4844b9={};_0x4844b9[_0x46f368]={'$like':'%'+_0x40ec78['query'][_0x4f37('0x2d')]+'%'};return _0x4844b9;})});}_0x5f57df=_['merge']({},_0x5f57df,_0x40ec78['options']);return _0x209fbb[_0x4f37('0x9b')](_0x5f57df);}})[_0x4f37('0x2a')](function(_0x56c004){if(_0x56c004){_0x2f0a9c=_0x56c004[_0x4f37('0x3c')];if(!_0x40ec78[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x5f57df[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x40ec78[_0x4f37('0x38')][_0x4f37('0x24')]);_0x5f57df[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x40ec78['query'][_0x4f37('0x23')]);}return _0x209fbb[_0x4f37('0x9b')](_0x5f57df);}})[_0x4f37('0x2a')](function(_0x1c863b){if(_0x1c863b){return _0x1c863b?{'count':_0x2f0a9c,'rows':_0x1c863b}:null;}})[_0x4f37('0x2a')](respondWithResult(_0x239426,null))[_0x4f37('0x57')](handleError(_0x239426,null));};exports['getMembers']=function(_0x1dfa01,_0x2e16ed,_0xf6c76b){var _0x29105b={};var _0xa11f20={};var _0x4334d9;var _0x32af19;return db['VoiceQueue'][_0x4f37('0x65')]({'where':{'id':_0x1dfa01[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x2e16ed,null))[_0x4f37('0x2a')](function(_0x1c83f6){if(_0x1c83f6){_0x4334d9=_0x1c83f6;_0xa11f20[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x93')][_0x4f37('0x35')]);_0xa11f20[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x1dfa01['query']);_0xa11f20[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0xa11f20[_0x4f37('0x37')],_0xa11f20[_0x4f37('0x38')]);_0x29105b[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0xa11f20['model'],qs['fields'](_0x1dfa01[_0x4f37('0x38')]['fields']));_0x29105b[_0x4f37('0x3a')]=_0x29105b[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x29105b[_0x4f37('0x3a')]:_0xa11f20['model'];_0x29105b[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x1dfa01['query']['sort']);_0x29105b[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x1dfa01[_0x4f37('0x38')],_0xa11f20[_0x4f37('0x4c')]));if(_0x1dfa01['query'][_0x4f37('0x2d')]){_0x29105b[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x29105b[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x29105b['attributes'],function(_0x300272){var _0x456a61={};_0x456a61[_0x300272]={'$like':'%'+_0x1dfa01[_0x4f37('0x38')]['filter']+'%'};return _0x456a61;})});}_0x29105b=_['merge']({},_0x29105b,_0x1dfa01[_0x4f37('0x46')]);return _0x4334d9[_0x4f37('0x9c')](_0x29105b);}})[_0x4f37('0x2a')](function(_0x3c8b7f){if(_0x3c8b7f){_0x32af19=_0x3c8b7f[_0x4f37('0x3c')];if(!_0x1dfa01[_0x4f37('0x38')]['hasOwnProperty'](_0x4f37('0x3e'))){_0x29105b['limit']=qs['limit'](_0x1dfa01['query'][_0x4f37('0x24')]);_0x29105b[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x1dfa01[_0x4f37('0x38')][_0x4f37('0x23')]);}return _0x4334d9[_0x4f37('0x9c')](_0x29105b);}})[_0x4f37('0x2a')](function(_0x3c68d6){return _0x3c68d6?{'count':_0x32af19,'rows':_0x3c68d6}:null;})['then'](respondWithResult(_0x2e16ed,null))[_0x4f37('0x57')](handleError(_0x2e16ed,null));};exports['getLists']=function(_0x2f97ad,_0x3203f6,_0x29c1a1){var _0x5d4523={};var _0x3acd55={};var _0x5773af;var _0x1bdb32;return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x2f97ad[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x3203f6,null))[_0x4f37('0x2a')](function(_0x1ec95f){if(_0x1ec95f){_0x5773af=_0x1ec95f;_0x3acd55[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x9d')]['rawAttributes']);_0x3acd55[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x2f97ad[_0x4f37('0x38')]);_0x3acd55[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x3acd55['model'],_0x3acd55[_0x4f37('0x38')]);_0x5d4523[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x3acd55['model'],qs[_0x4f37('0x3b')](_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x5d4523['attributes']=_0x5d4523[_0x4f37('0x3a')][_0x4f37('0x3c')]?_0x5d4523[_0x4f37('0x3a')]:_0x3acd55[_0x4f37('0x37')];_0x5d4523[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x2f97ad['query'][_0x4f37('0x40')]);_0x5d4523[_0x4f37('0x41')]=qs[_0x4f37('0x4c')](_[_0x4f37('0x42')](_0x2f97ad['query'],_0x3acd55[_0x4f37('0x4c')]));if(_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x5d4523[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x5d4523[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x5d4523[_0x4f37('0x3a')],function(_0x5e9130){var _0x547bb7={};_0x547bb7[_0x5e9130]={'$like':'%'+_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x547bb7;})});}_0x5d4523=_[_0x4f37('0x45')]({},_0x5d4523,_0x2f97ad[_0x4f37('0x46')]);return _0x5773af[_0x4f37('0x9e')](_0x5d4523);}})[_0x4f37('0x2a')](function(_0x10acb0){if(_0x10acb0){_0x1bdb32=_0x10acb0[_0x4f37('0x3c')];if(!_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x5d4523[_0x4f37('0x24')]=qs['limit'](_0x2f97ad[_0x4f37('0x38')][_0x4f37('0x24')]);_0x5d4523[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x2f97ad[_0x4f37('0x38')]['offset']);}return _0x5773af[_0x4f37('0x9e')](_0x5d4523);}})[_0x4f37('0x2a')](function(_0x49026f){if(_0x49026f){return _0x49026f?{'count':_0x1bdb32,'rows':_0x49026f}:null;}})[_0x4f37('0x2a')](respondWithResult(_0x3203f6,null))[_0x4f37('0x57')](handleError(_0x3203f6,null));};exports[_0x4f37('0x9f')]=function(_0x1c8979,_0x5366b3,_0x442e7a){var _0x2e87d3,_0x57f73d;return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x1c8979['params']['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x5366b3,null))['then'](function(_0x1a7962){if(_0x1a7962){_0x57f73d=_0x1a7962;return _0x1a7962['addLists'](_0x1c8979[_0x4f37('0x4f')][_0x4f37('0x7f')],_[_0x4f37('0x5c')](_0x1c8979[_0x4f37('0x4f')],[_0x4f37('0x7f'),'id'])||{});}return null;})[_0x4f37('0x96')](function(_0x10d181){var _0x3928f1;_0x2e87d3=_0x10d181||[];var _0x5c2b63=[];if(_0x10d181){for(var _0x2f52b3=0x0;_0x2f52b3<_0x10d181[_0x4f37('0x3c')];_0x2f52b3+=0x1){var _0x21fca2=_0x10d181[_0x2f52b3][_0x4f37('0x51')]({'plain':!![]});_0x57f73d[_0x4f37('0xa0')]=_0x1c8979[_0x4f37('0x4f')]['dialCheckDuplicateType']?_0x1c8979[_0x4f37('0x4f')][_0x4f37('0xa0')]:_0x57f73d[_0x4f37('0xa0')];switch(_0x57f73d[_0x4f37('0xa0')]){case'always':_0x3928f1=squel[_0x4f37('0xa1')]()[_0x4f37('0xa2')](_0x4f37('0xa3'))[_0x4f37('0xa4')]([_0x4f37('0xa5'),_0x4f37('0xa6'),_0x4f37('0xa7'),_0x4f37('0xa8'),_0x4f37('0x66'),'createdAt','updatedAt'],squel[_0x4f37('0x80')]()[_0x4f37('0xa9')]('phone',_0x4f37('0xa5'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0xa6'))[_0x4f37('0xa9')]('id',_0x4f37('0xa7'))[_0x4f37('0xa9')](_0x21fca2[_0x4f37('0xab')][_0x4f37('0x8a')](),_0x4f37('0xa8'))[_0x4f37('0xa9')](_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')](),_0x4f37('0x66'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5e'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5d'))[_0x4f37('0x82')](_0x4f37('0xac'))['where'](_0x4f37('0xad'))[_0x4f37('0x41')](_0x4f37('0xae'),_0x21fca2['CmListId'][_0x4f37('0x8a')]())[_0x4f37('0x41')](_0x4f37('0xaf'))[_0x4f37('0x41')](_0x4f37('0xb0'),squel[_0x4f37('0x80')]()['field'](_0x4f37('0xb1'))[_0x4f37('0x82')]('cm_hopper_final')[_0x4f37('0x41')](_0x4f37('0x87'),_0x1c8979['params']['id'][_0x4f37('0x8a')]()))[_0x4f37('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4f37('0x80')]()['field'](_0x4f37('0xb2'))['from'](_0x4f37('0xa3'))['where']('VoiceQueueId\x20=\x20?',_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')]())))[_0x4f37('0x8a')]();break;case _0x4f37('0xb3'):_0x3928f1=squel[_0x4f37('0xa1')]()[_0x4f37('0xa2')](_0x4f37('0xa3'))[_0x4f37('0xa4')](['phone',_0x4f37('0xa6'),_0x4f37('0xa7'),'ListId',_0x4f37('0x66'),_0x4f37('0x5e'),_0x4f37('0x5d')],squel['select']()['field'](_0x4f37('0xa5'),_0x4f37('0xa5'))[_0x4f37('0xa9')]('NOW()',_0x4f37('0xa6'))[_0x4f37('0xa9')]('id','ContactId')[_0x4f37('0xa9')](_0x21fca2['CmListId'][_0x4f37('0x8a')](),_0x4f37('0xa8'))[_0x4f37('0xa9')](_0x1c8979[_0x4f37('0x4b')]['id']['toString'](),_0x4f37('0x66'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5e'))[_0x4f37('0xa9')](_0x4f37('0xaa'),_0x4f37('0x5d'))[_0x4f37('0x82')]('cm_contacts')['where'](_0x4f37('0xad'))['where'](_0x4f37('0xae'),_0x21fca2['CmListId'][_0x4f37('0x8a')]())['where'](_0x4f37('0xaf'))[_0x4f37('0x41')](_0x4f37('0xb0'),squel['select']()['field'](_0x4f37('0xb2'))[_0x4f37('0x82')](_0x4f37('0xa3'))[_0x4f37('0x41')](_0x4f37('0x87'),_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')]())))[_0x4f37('0x8a')]();break;default:_0x3928f1=squel[_0x4f37('0xa1')]()['into'](_0x4f37('0xa3'))[_0x4f37('0xa4')](['phone',_0x4f37('0xa6'),_0x4f37('0xa7'),_0x4f37('0xa8'),_0x4f37('0x66'),_0x4f37('0x5e'),_0x4f37('0x5d')],squel['select']()['field'](_0x4f37('0xa5'),_0x4f37('0xa5'))[_0x4f37('0xa9')](_0x4f37('0xaa'),'scheduledAt')[_0x4f37('0xa9')]('id','ContactId')[_0x4f37('0xa9')](_0x21fca2[_0x4f37('0xab')][_0x4f37('0x8a')](),_0x4f37('0xa8'))['field'](_0x1c8979[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')](),_0x4f37('0x66'))[_0x4f37('0xa9')]('NOW()','createdAt')[_0x4f37('0xa9')]('NOW()',_0x4f37('0x5d'))[_0x4f37('0x82')](_0x4f37('0xac'))[_0x4f37('0x41')](_0x4f37('0xad'))[_0x4f37('0x41')]('ListId\x20=\x20?',_0x21fca2[_0x4f37('0xab')][_0x4f37('0x8a')]())[_0x4f37('0x41')](_0x4f37('0xaf')))[_0x4f37('0x8a')]();}_0x5c2b63[_0x4f37('0x89')](db[_0x4f37('0x75')][_0x4f37('0x38')](_0x3928f1));}return BPromise[_0x4f37('0x8e')](_0x5c2b63);}})[_0x4f37('0x2a')](function(){return _0x2e87d3;})[_0x4f37('0x2a')](respondWithResult(_0x5366b3,null))['catch'](handleError(_0x5366b3,null));};exports[_0x4f37('0xb4')]=function(_0x4fa81f,_0x147cbb,_0x35beae){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x4fa81f['params']['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x147cbb,null))[_0x4f37('0x2a')](function(_0x556e99){if(_0x556e99){return _0x556e99[_0x4f37('0xb4')](_0x4fa81f[_0x4f37('0x38')][_0x4f37('0x7f')]);}})['then'](function(_0x2c2269){if(_0x2c2269){return db[_0x4f37('0x61')][_0x4f37('0x29')]({'where':{'ListId':_0x4fa81f[_0x4f37('0x38')][_0x4f37('0x7f')],'VoiceQueueId':_0x4fa81f[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](function(){return _0x2c2269;});}})[_0x4f37('0x2a')](respondWithStatusCode(_0x147cbb,null))[_0x4f37('0x57')](handleError(_0x147cbb,null));};exports['getBlackLists']=function(_0x9ee3a0,_0x446fbf,_0x22f44a){var _0x3a6f42={};var _0x5ed714={};var _0x368b61;var _0x444b5f;return db[_0x4f37('0x34')]['findOne']({'where':{'id':_0x9ee3a0[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x446fbf,null))['then'](function(_0x47f0d4){if(_0x47f0d4){_0x368b61=_0x47f0d4;_0x5ed714[_0x4f37('0x37')]=_[_0x4f37('0x39')](db[_0x4f37('0x9d')][_0x4f37('0x35')]);_0x5ed714[_0x4f37('0x38')]=_[_0x4f37('0x39')](_0x9ee3a0[_0x4f37('0x38')]);_0x5ed714[_0x4f37('0x4c')]=_[_0x4f37('0x5b')](_0x5ed714['model'],_0x5ed714[_0x4f37('0x38')]);_0x3a6f42[_0x4f37('0x3a')]=_[_0x4f37('0x5b')](_0x5ed714[_0x4f37('0x37')],qs[_0x4f37('0x3b')](_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x3b')]));_0x3a6f42['attributes']=_0x3a6f42[_0x4f37('0x3a')]['length']?_0x3a6f42[_0x4f37('0x3a')]:_0x5ed714[_0x4f37('0x37')];_0x3a6f42[_0x4f37('0x3f')]=qs[_0x4f37('0x40')](_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x40')]);_0x3a6f42[_0x4f37('0x41')]=qs['filters'](_[_0x4f37('0x42')](_0x9ee3a0[_0x4f37('0x38')],_0x5ed714[_0x4f37('0x4c')]));if(_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x2d')]){_0x3a6f42[_0x4f37('0x41')]=_[_0x4f37('0x45')](_0x3a6f42[_0x4f37('0x41')],{'$or':_[_0x4f37('0x2e')](_0x3a6f42[_0x4f37('0x3a')],function(_0x13810c){var _0x2a9b1d={};_0x2a9b1d[_0x13810c]={'$like':'%'+_0x9ee3a0[_0x4f37('0x38')][_0x4f37('0x2d')]+'%'};return _0x2a9b1d;})});}_0x3a6f42=_['merge']({},_0x3a6f42,_0x9ee3a0['options']);return _0x368b61[_0x4f37('0xb5')](_0x3a6f42);}})[_0x4f37('0x2a')](function(_0x3a7a53){if(_0x3a7a53){_0x444b5f=_0x3a7a53[_0x4f37('0x3c')];if(!_0x9ee3a0['query'][_0x4f37('0x3d')](_0x4f37('0x3e'))){_0x3a6f42[_0x4f37('0x24')]=qs[_0x4f37('0x24')](_0x9ee3a0[_0x4f37('0x38')]['limit']);_0x3a6f42[_0x4f37('0x23')]=qs[_0x4f37('0x23')](_0x9ee3a0['query']['offset']);}return _0x368b61[_0x4f37('0xb5')](_0x3a6f42);}})[_0x4f37('0x2a')](function(_0x149443){if(_0x149443){return _0x149443?{'count':_0x444b5f,'rows':_0x149443}:null;}})['then'](respondWithResult(_0x446fbf,null))[_0x4f37('0x57')](handleError(_0x446fbf,null));};exports['addBlackLists']=function(_0x3ce35f,_0xf4f73d,_0xc0dec2){var _0x49e3b2,_0x4d68ca;return db[_0x4f37('0x34')]['find']({'where':{'id':_0x3ce35f[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0xf4f73d,null))[_0x4f37('0x2a')](function(_0x57eae1){if(_0x57eae1){_0x4d68ca=_0x57eae1;return _0x57eae1[_0x4f37('0xb6')](_0x3ce35f[_0x4f37('0x4f')][_0x4f37('0x7f')],_['omit'](_0x3ce35f[_0x4f37('0x4f')],[_0x4f37('0x7f'),'id'])||{});}return null;})['spread'](function(_0x412850){var _0x373b50;_0x49e3b2=_0x412850||[];var _0x49597d=[];if(_0x412850){for(var _0x5b57dc=0x0;_0x5b57dc<_0x412850[_0x4f37('0x3c')];_0x5b57dc+=0x1){var _0x56bf7a=_0x412850[_0x5b57dc][_0x4f37('0x51')]({'plain':!![]});_0x373b50=squel[_0x4f37('0xa1')]()[_0x4f37('0xa2')](_0x4f37('0xb7'))[_0x4f37('0xa4')](['phone',_0x4f37('0xa7'),_0x4f37('0xa8'),_0x4f37('0x66'),_0x4f37('0x5e'),_0x4f37('0x5d')],squel[_0x4f37('0x80')]()[_0x4f37('0xa9')](_0x4f37('0xa5'),_0x4f37('0xa5'))['field']('id',_0x4f37('0xa7'))[_0x4f37('0xa9')](_0x56bf7a['CmListId'][_0x4f37('0x8a')](),_0x4f37('0xa8'))[_0x4f37('0xa9')](_0x3ce35f[_0x4f37('0x4b')]['id'][_0x4f37('0x8a')](),_0x4f37('0x66'))['field']('NOW()','createdAt')['field'](_0x4f37('0xaa'),_0x4f37('0x5d'))['from']('cm_contacts')[_0x4f37('0x41')](_0x4f37('0xad'))[_0x4f37('0x41')](_0x4f37('0xae'),_0x56bf7a['CmListId'][_0x4f37('0x8a')]())['where'](_0x4f37('0xaf')))[_0x4f37('0x8a')]();_0x49597d[_0x4f37('0x89')](db[_0x4f37('0x75')]['query'](_0x373b50));}return BPromise[_0x4f37('0x8e')](_0x49597d);}})['then'](function(){return _0x49e3b2;})[_0x4f37('0x2a')](respondWithResult(_0xf4f73d,null))[_0x4f37('0x57')](handleError(_0xf4f73d,null));};exports['removeBlackLists']=function(_0x41b34e,_0x8a116d,_0x511f7f){return db[_0x4f37('0x34')][_0x4f37('0x4d')]({'where':{'id':_0x41b34e[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](handleEntityNotFound(_0x8a116d,null))[_0x4f37('0x2a')](function(_0x51fd6d){if(_0x51fd6d){return _0x51fd6d['removeBlackLists'](_0x41b34e[_0x4f37('0x38')]['ids']);}})[_0x4f37('0x2a')](function(_0x48f433){if(_0x48f433){return db[_0x4f37('0x69')][_0x4f37('0x29')]({'where':{'ListId':_0x41b34e['query']['ids'],'VoiceQueueId':_0x41b34e[_0x4f37('0x4b')]['id']}})[_0x4f37('0x2a')](function(){return _0x48f433;});}})[_0x4f37('0x2a')](respondWithStatusCode(_0x8a116d,null))[_0x4f37('0x57')](handleError(_0x8a116d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f671a9e..938478a 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 _0xfd50=['hasOwnProperty','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x54d782,_0x1ff092){var _0x24bbbb=function(_0x49fd2d){while(--_0x49fd2d){_0x54d782['push'](_0x54d782['shift']());}};_0x24bbbb(++_0x1ff092);}(_0xfd50,0x160));var _0x0fd5=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xfd50[_0x4914e2];return _0x2dcd07;};'use strict';var EventEmitter=require(_0x0fd5('0x0'));var VoiceQueue=require(_0x0fd5('0x1'))['db'][_0x0fd5('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0fd5('0x3')](0x0);var events={'afterCreate':_0x0fd5('0x4'),'afterUpdate':_0x0fd5('0x5'),'afterDestroy':_0x0fd5('0x6')};function emitEvent(_0x12c888){return function(_0x366031,_0x11f267,_0xeb967){VoiceQueueEvents[_0x0fd5('0x7')](_0x12c888+':'+_0x366031['id'],_0x366031);VoiceQueueEvents[_0x0fd5('0x7')](_0x12c888,_0x366031);_0xeb967(null);};}for(var e in events){if(events[_0x0fd5('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x308f=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1d74be,_0x3fdda7){var _0x1535db=function(_0x516b31){while(--_0x516b31){_0x1d74be['push'](_0x1d74be['shift']());}};_0x1535db(++_0x3fdda7);}(_0x308f,0x70));var _0xf308=function(_0x5d94cd,_0x8a495b){_0x5d94cd=_0x5d94cd-0x0;var _0x4a7533=_0x308f[_0x5d94cd];return _0x4a7533;};'use strict';var EventEmitter=require(_0xf308('0x0'));var VoiceQueue=require(_0xf308('0x1'))['db'][_0xf308('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf308('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf308('0x4'),'afterDestroy':_0xf308('0x5')};function emitEvent(_0x3fe2d4){return function(_0x3f2799,_0xd6c95f,_0x29e69e){VoiceQueueEvents[_0xf308('0x6')](_0x3fe2d4+':'+_0x3f2799['id'],_0x3f2799);VoiceQueueEvents['emit'](_0x3fe2d4,_0x3f2799);_0x29e69e(null);};}for(var e in events){if(events[_0xf308('0x7')](e)){var event=events[e];VoiceQueue[_0xf308('0x8')](e,emitEvent(event));}}module[_0xf308('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 63a9d19..7d5a146 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 _0x35ce=['exports','define','voice_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35ce,0x15f));var _0xe35c=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x35ce[_0x3d38ae];return _0x3757ee;};'use strict';var _=require('lodash');var util=require(_0xe35c('0x0'));var logger=require(_0xe35c('0x1'))(_0xe35c('0x2'));var moment=require(_0xe35c('0x3'));var BPromise=require(_0xe35c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe35c('0x5'));var rimraf=require(_0xe35c('0x6'));var config=require(_0xe35c('0x7'));var attributes=require(_0xe35c('0x8'));module[_0xe35c('0x9')]=function(_0x584550,_0x14dcbd){return _0x584550[_0xe35c('0xa')]('VoiceQueue',attributes,{'tableName':_0xe35c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe718=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe718,0x88));var _0x8e71=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0xe718[_0x587693];return _0x510a1a;};'use strict';var _=require(_0x8e71('0x0'));var util=require(_0x8e71('0x1'));var logger=require(_0x8e71('0x2'))(_0x8e71('0x3'));var moment=require(_0x8e71('0x4'));var BPromise=require(_0x8e71('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e71('0x6'));var config=require(_0x8e71('0x7'));var attributes=require(_0x8e71('0x8'));module[_0x8e71('0x9')]=function(_0x213d2e,_0x1b55f8){return _0x213d2e[_0x8e71('0xa')]('VoiceQueue',attributes,{'tableName':_0x8e71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e70c5f4..bb5d350 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 _0x6780=['stringify','error','code','message','result','catch','options','raw','attributes','limit','include','model','map','debug','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','register','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6780,0x81));var _0x0678=function(_0x11c871,_0x74b0ba){_0x11c871=_0x11c871-0x0;var _0x4fcc7e=_0x6780[_0x11c871];return _0x4fcc7e;};'use strict';var _=require(_0x0678('0x0'));var util=require(_0x0678('0x1'));var moment=require(_0x0678('0x2'));var BPromise=require('bluebird');var rs=require(_0x0678('0x3'));var fs=require('fs');var Redis=require(_0x0678('0x4'));var db=require(_0x0678('0x5'))['db'];var utils=require(_0x0678('0x6'));var logger=require(_0x0678('0x7'))('rpc');var config=require(_0x0678('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0678('0x9')][_0x0678('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0678('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0678('0xb')]));require('./voiceQueue.socket')[_0x0678('0xc')](socket);function respondWithRpcPromise(_0xaac680,_0x2e0347,_0x45ef91){return new BPromise(function(_0x1e8e84,_0x3ac000){return client[_0x0678('0xd')](_0xaac680,_0x45ef91)[_0x0678('0xe')](function(_0x252ce4){logger[_0x0678('0xf')](_0x0678('0x10'),_0x2e0347,'request\x20sent');logger['debug'](_0x0678('0x11'),_0x2e0347,_0x0678('0x12'),JSON[_0x0678('0x13')](_0x252ce4));if(_0x252ce4[_0x0678('0x14')]){if(_0x252ce4[_0x0678('0x14')][_0x0678('0x15')]===0x1f4){logger['error'](_0x0678('0x10'),_0x2e0347,_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);return _0x3ac000(_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x2e0347,_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);return _0x1e8e84(_0x252ce4[_0x0678('0x14')][_0x0678('0x16')]);}else{logger[_0x0678('0xf')](_0x0678('0x10'),_0x2e0347,_0x0678('0x12'));_0x1e8e84(_0x252ce4[_0x0678('0x17')][_0x0678('0x16')]);}})[_0x0678('0x18')](function(_0x40a25b){logger[_0x0678('0x14')](_0x0678('0x10'),_0x2e0347,_0x40a25b);_0x3ac000(_0x40a25b);});});}exports['GetVoiceQueue']=function(_0x4c296b){var _0x1116ab=this;return new Promise(function(_0x577b4,_0x3dea20){return db['VoiceQueue']['findAll']({'raw':_0x4c296b[_0x0678('0x19')]?_0x4c296b['options'][_0x0678('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c296b[_0x0678('0x19')]?_0x4c296b['options']['where']||null:null,'attributes':_0x4c296b['options']?_0x4c296b[_0x0678('0x19')][_0x0678('0x1b')]||null:null,'limit':_0x4c296b[_0x0678('0x19')]?_0x4c296b[_0x0678('0x19')][_0x0678('0x1c')]||null:null,'include':_0x4c296b['options']?_0x4c296b['options'][_0x0678('0x1d')]?_['map'](_0x4c296b[_0x0678('0x19')]['include'],function(_0x4ca4ca){return{'model':db[_0x4ca4ca[_0x0678('0x1e')]],'as':_0x4ca4ca['as'],'attributes':_0x4ca4ca[_0x0678('0x1b')],'include':_0x4ca4ca[_0x0678('0x1d')]?_[_0x0678('0x1f')](_0x4ca4ca['include'],function(_0x4c15fa){return{'model':db[_0x4c15fa['model']],'as':_0x4c15fa['as'],'attributes':_0x4c15fa[_0x0678('0x1b')],'include':_0x4c15fa[_0x0678('0x1d')]?_[_0x0678('0x1f')](_0x4c15fa['include'],function(_0xd8a184){return{'model':db[_0xd8a184[_0x0678('0x1e')]],'as':_0xd8a184['as'],'attributes':_0xd8a184[_0x0678('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0678('0xe')](function(_0x1659e2){logger[_0x0678('0xf')]('GetVoiceQueue',_0x4c296b);logger[_0x0678('0x20')](_0x0678('0x21'),_0x4c296b,JSON[_0x0678('0x13')](_0x1659e2));_0x577b4(_0x1659e2);})[_0x0678('0x18')](function(_0x232ed1){logger['error']('GetVoiceQueue',_0x232ed1[_0x0678('0x16')],_0x4c296b);_0x3dea20(_0x1116ab['error'](0x1f4,_0x232ed1['message']));});});};exports[_0x0678('0x22')]=function(_0xfa0015){var _0x94163f=this;return new Promise(function(_0x5abf46,_0x184b92){return db[_0x0678('0x23')]['find']({'raw':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')][_0x0678('0x24')]||null:null,'attributes':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')][_0x0678('0x1b')]||null:null,'include':_0xfa0015[_0x0678('0x19')]?_0xfa0015[_0x0678('0x19')][_0x0678('0x1d')]?_[_0x0678('0x1f')](_0xfa0015['options']['include'],function(_0x2d3d8d){return{'model':db[_0x2d3d8d['model']],'as':_0x2d3d8d['as'],'attributes':_0x2d3d8d[_0x0678('0x1b')],'include':_0x2d3d8d['include']?_[_0x0678('0x1f')](_0x2d3d8d[_0x0678('0x1d')],function(_0x601c6b){return{'model':db[_0x601c6b['model']],'as':_0x601c6b['as'],'attributes':_0x601c6b['attributes'],'include':_0x601c6b['include']?_[_0x0678('0x1f')](_0x601c6b[_0x0678('0x1d')],function(_0x3ad6f0){return{'model':db[_0x3ad6f0[_0x0678('0x1e')]],'as':_0x3ad6f0['as'],'attributes':_0x3ad6f0[_0x0678('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0678('0xe')](function(_0x163a6e){logger[_0x0678('0xf')](_0x0678('0x22'),_0xfa0015);logger['debug'](_0x0678('0x22'),_0xfa0015,JSON[_0x0678('0x13')](_0x163a6e));_0x5abf46(_0x163a6e);})[_0x0678('0x18')](function(_0x36b87f){logger[_0x0678('0x14')](_0x0678('0x22'),_0x36b87f[_0x0678('0x16')],_0xfa0015);_0x184b92(_0x94163f['error'](0x1f4,_0x36b87f[_0x0678('0x16')]));});});}; \ No newline at end of file +var _0x8699=['catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x8699,0x193));var _0x9869=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x8699[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require(_0x9869('0x0'));var moment=require(_0x9869('0x1'));var BPromise=require(_0x9869('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9869('0x3'));var db=require(_0x9869('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9869('0x5'))(_0x9869('0x6'));var config=require('../../config/environment');var jayson=require(_0x9869('0x7'));var client=jayson[_0x9869('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9869('0x9')](config[_0x9869('0xa')],{'host':_0x9869('0xb'),'port':0x18eb});var socket=require(_0x9869('0xc'))(new Redis(config[_0x9869('0xa')]));require(_0x9869('0xd'))['register'](socket);function respondWithRpcPromise(_0x41ba6e,_0x400a6a,_0x11489c){return new BPromise(function(_0x9ff368,_0x12d7f7){return client[_0x9869('0xe')](_0x41ba6e,_0x11489c)[_0x9869('0xf')](function(_0x37a00e){logger[_0x9869('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x400a6a,_0x9869('0x11'));logger[_0x9869('0x12')](_0x9869('0x13'),_0x400a6a,_0x9869('0x11'),JSON[_0x9869('0x14')](_0x37a00e));if(_0x37a00e[_0x9869('0x15')]){if(_0x37a00e[_0x9869('0x15')][_0x9869('0x16')]===0x1f4){logger['error'](_0x9869('0x17'),_0x400a6a,_0x37a00e[_0x9869('0x15')][_0x9869('0x18')]);return _0x12d7f7(_0x37a00e[_0x9869('0x15')]['message']);}logger['error'](_0x9869('0x17'),_0x400a6a,_0x37a00e[_0x9869('0x15')][_0x9869('0x18')]);return _0x9ff368(_0x37a00e['error'][_0x9869('0x18')]);}else{logger[_0x9869('0x10')](_0x9869('0x17'),_0x400a6a,_0x9869('0x11'));_0x9ff368(_0x37a00e[_0x9869('0x19')][_0x9869('0x18')]);}})[_0x9869('0x1a')](function(_0x1afbf0){logger['error'](_0x9869('0x17'),_0x400a6a,_0x1afbf0);_0x12d7f7(_0x1afbf0);});});}exports['GetVoiceQueue']=function(_0x213278){var _0x4b112c=this;return new Promise(function(_0x501635,_0x4e65e8){return db[_0x9869('0x1b')][_0x9869('0x1c')]({'raw':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x1e')]===undefined?!![]:![]:!![],'where':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x1f')]||null:null,'attributes':_0x213278['options']?_0x213278[_0x9869('0x1d')][_0x9869('0x20')]||null:null,'limit':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x21')]||null:null,'include':_0x213278[_0x9869('0x1d')]?_0x213278[_0x9869('0x1d')][_0x9869('0x22')]?_['map'](_0x213278[_0x9869('0x1d')]['include'],function(_0x18a76e){return{'model':db[_0x18a76e['model']],'as':_0x18a76e['as'],'attributes':_0x18a76e[_0x9869('0x20')],'include':_0x18a76e['include']?_[_0x9869('0x23')](_0x18a76e[_0x9869('0x22')],function(_0x1e88ab){return{'model':db[_0x1e88ab[_0x9869('0x24')]],'as':_0x1e88ab['as'],'attributes':_0x1e88ab['attributes'],'include':_0x1e88ab['include']?_[_0x9869('0x23')](_0x1e88ab[_0x9869('0x22')],function(_0xcf27b4){return{'model':db[_0xcf27b4[_0x9869('0x24')]],'as':_0xcf27b4['as'],'attributes':_0xcf27b4[_0x9869('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9869('0xf')](function(_0x1e0be2){logger[_0x9869('0x10')](_0x9869('0x25'),_0x213278);logger[_0x9869('0x12')](_0x9869('0x25'),_0x213278,JSON[_0x9869('0x14')](_0x1e0be2));_0x501635(_0x1e0be2);})[_0x9869('0x1a')](function(_0x48fdda){logger[_0x9869('0x15')]('GetVoiceQueue',_0x48fdda[_0x9869('0x18')],_0x213278);_0x4e65e8(_0x4b112c['error'](0x1f4,_0x48fdda['message']));});});};exports[_0x9869('0x26')]=function(_0x45637a){var _0x2cbaef=this;return new Promise(function(_0x30247a,_0x439b5c){return db[_0x9869('0x1b')]['find']({'raw':_0x45637a[_0x9869('0x1d')]?_0x45637a[_0x9869('0x1d')][_0x9869('0x1e')]===undefined?!![]:![]:!![],'where':_0x45637a[_0x9869('0x1d')]?_0x45637a[_0x9869('0x1d')][_0x9869('0x1f')]||null:null,'attributes':_0x45637a['options']?_0x45637a[_0x9869('0x1d')][_0x9869('0x20')]||null:null,'include':_0x45637a[_0x9869('0x1d')]?_0x45637a['options'][_0x9869('0x22')]?_['map'](_0x45637a[_0x9869('0x1d')]['include'],function(_0x1b224c){return{'model':db[_0x1b224c['model']],'as':_0x1b224c['as'],'attributes':_0x1b224c[_0x9869('0x20')],'include':_0x1b224c['include']?_[_0x9869('0x23')](_0x1b224c[_0x9869('0x22')],function(_0x28b87d){return{'model':db[_0x28b87d[_0x9869('0x24')]],'as':_0x28b87d['as'],'attributes':_0x28b87d[_0x9869('0x20')],'include':_0x28b87d[_0x9869('0x22')]?_[_0x9869('0x23')](_0x28b87d[_0x9869('0x22')],function(_0x2dfbd8){return{'model':db[_0x2dfbd8[_0x9869('0x24')]],'as':_0x2dfbd8['as'],'attributes':_0x2dfbd8[_0x9869('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f0e7e){logger[_0x9869('0x10')](_0x9869('0x26'),_0x45637a);logger[_0x9869('0x12')](_0x9869('0x26'),_0x45637a,JSON[_0x9869('0x14')](_0x3f0e7e));_0x30247a(_0x3f0e7e);})[_0x9869('0x1a')](function(_0x3fb9dd){logger[_0x9869('0x15')](_0x9869('0x26'),_0x3fb9dd['message'],_0x45637a);_0x439b5c(_0x2cbaef[_0x9869('0x15')](0x1f4,_0x3fb9dd[_0x9869('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7568d16..f7ad3e1 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 _0x09ac=['update','emit','removeListener','register','length','save','remove'];(function(_0x3e2583,_0x57051c){var _0x574b35=function(_0x4da108){while(--_0x4da108){_0x3e2583['push'](_0x3e2583['shift']());}};_0x574b35(++_0x57051c);}(_0x09ac,0x14e));var _0xc09a=function(_0x160b71,_0x2ed489){_0x160b71=_0x160b71-0x0;var _0x32a6e1=_0x09ac[_0x160b71];return _0x32a6e1;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xc09a('0x0'),_0xc09a('0x1'),_0xc09a('0x2')];function createListener(_0x4dca9d,_0x40247f){return function(_0x405d0f){_0x40247f[_0xc09a('0x3')](_0x4dca9d,_0x405d0f);};}function removeListener(_0x20d348,_0x556afc){return function(){VoiceQueueEvents[_0xc09a('0x4')](_0x20d348,_0x556afc);};}exports[_0xc09a('0x5')]=function(_0x4ab14a){for(var _0x4992d3=0x0,_0x5db0b9=events[_0xc09a('0x6')];_0x4992d3<_0x5db0b9;_0x4992d3++){var _0x3c5c92=events[_0x4992d3];var _0x142dc7=createListener('voiceQueue:'+_0x3c5c92,_0x4ab14a);VoiceQueueEvents['on'](_0x3c5c92,_0x142dc7);}}; \ No newline at end of file +var _0xe664=['length','voiceQueue:','./voiceQueue.events','save','removeListener'];(function(_0x1f2b31,_0x3d43e8){var _0x158043=function(_0x555558){while(--_0x555558){_0x1f2b31['push'](_0x1f2b31['shift']());}};_0x158043(++_0x3d43e8);}(_0xe664,0x1c4));var _0x4e66=function(_0x1b3229,_0x58511d){_0x1b3229=_0x1b3229-0x0;var _0x56ca84=_0xe664[_0x1b3229];return _0x56ca84;};'use strict';var VoiceQueueEvents=require(_0x4e66('0x0'));var events=[_0x4e66('0x1'),'remove','update'];function createListener(_0x15a987,_0x1401b7){return function(_0x58431d){_0x1401b7['emit'](_0x15a987,_0x58431d);};}function removeListener(_0x51f2bb,_0x36aed5){return function(){VoiceQueueEvents[_0x4e66('0x2')](_0x51f2bb,_0x36aed5);};}exports['register']=function(_0xc60168){for(var _0x5dab08=0x0,_0x531df6=events[_0x4e66('0x3')];_0x5dab08<_0x531df6;_0x5dab08++){var _0x42365f=events[_0x5dab08];var _0x2c645a=createListener(_0x4e66('0x4')+_0x42365f,_0xc60168);VoiceQueueEvents['on'](_0x42365f,_0x2c645a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a212b26..d144f5a 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 _0x3fa4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/index','getVoiceQueuesReport','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','express'];(function(_0x95e21a,_0x5bda41){var _0x2165d4=function(_0x4c4524){while(--_0x4c4524){_0x95e21a['push'](_0x95e21a['shift']());}};_0x2165d4(++_0x5bda41);}(_0x3fa4,0xf0));var _0x43fa=function(_0x9520a5,_0x2849cc){_0x9520a5=_0x9520a5-0x0;var _0x228795=_0x3fa4[_0x9520a5];return _0x228795;};'use strict';var multer=require(_0x43fa('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43fa('0x1'));var router=express[_0x43fa('0x2')]();var auth=require(_0x43fa('0x3'));var interaction=require(_0x43fa('0x4'));var config=require(_0x43fa('0x5'));var controller=require(_0x43fa('0x6'));router[_0x43fa('0x7')]('/',auth['isAuthenticated'](),controller[_0x43fa('0x8')]);router[_0x43fa('0x7')](_0x43fa('0x9'),auth['isAuthenticated'](),controller[_0x43fa('0xa')]);router[_0x43fa('0x7')](_0x43fa('0xb'),auth['isAuthenticated'](),controller[_0x43fa('0xc')]);router[_0x43fa('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x43fa('0xd')]);router[_0x43fa('0xe')]('/',auth[_0x43fa('0xf')](),controller[_0x43fa('0x10')]);router[_0x43fa('0x11')]('/:id',auth[_0x43fa('0xf')](),controller[_0x43fa('0x12')]);router[_0x43fa('0x13')]('/:id',auth[_0x43fa('0xf')](),controller[_0x43fa('0x14')]);module[_0x43fa('0x15')]=router; \ No newline at end of file +var _0x627e=['describe','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x21bede,_0x542949){var _0x38fbee=function(_0x4d3319){while(--_0x4d3319){_0x21bede['push'](_0x21bede['shift']());}};_0x38fbee(++_0x542949);}(_0x627e,0x14a));var _0xe627=function(_0x1f331f,_0x1c21a6){_0x1f331f=_0x1f331f-0x0;var _0x4a5002=_0x627e[_0x1f331f];return _0x4a5002;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var auth=require(_0xe627('0x5'));var interaction=require(_0xe627('0x6'));var config=require(_0xe627('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe627('0x8')]);router[_0xe627('0x9')](_0xe627('0xa'),auth[_0xe627('0xb')](),controller[_0xe627('0xc')]);router[_0xe627('0x9')]('/index',auth[_0xe627('0xb')](),controller['getVoiceQueuesReport']);router['get'](_0xe627('0xd'),auth[_0xe627('0xb')](),controller['show']);router['post']('/',auth[_0xe627('0xb')](),controller[_0xe627('0xe')]);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0xb')](),controller[_0xe627('0x10')]);router[_0xe627('0x11')](_0xe627('0xd'),auth[_0xe627('0xb')](),controller['destroy']);module[_0xe627('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5817b0a..b8bc0bd 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 _0xe2ec=['sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x42c790,_0x34d709){var _0x487bb8=function(_0x3362e9){while(--_0x3362e9){_0x42c790['push'](_0x42c790['shift']());}};_0x487bb8(++_0x34d709);}(_0xe2ec,0xe1));var _0xce2e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe2ec[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0xce2e('0x0'));var moment=require(_0xce2e('0x1'));module[_0xce2e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xce2e('0x3')]},'calleridnum':{'type':Sequelize[_0xce2e('0x3')]},'calleridname':{'type':Sequelize[_0xce2e('0x3')]},'queue':{'type':Sequelize[_0xce2e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xce2e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xce2e('0x4')],'set':function(_0x6b07a4){var _0x2f2e4f=moment(_0x6b07a4);var _0xf1d341=moment(this[_0xce2e('0x5')]('queuecallerjoinAt'))['format'](_0xce2e('0x6'));var _0x2fe03d=_0x2f2e4f[_0xce2e('0x7')](_0xf1d341,_0xce2e('0x8'));this[_0xce2e('0x9')]('queuecallerleaveAt',_0x6b07a4);this[_0xce2e('0x9')](_0xce2e('0xa'),_0x2fe03d||null);}},'position':{'type':Sequelize[_0xce2e('0xb')]},'count':{'type':Sequelize[_0xce2e('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xce2e('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xce2e('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xce2e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xce2e('0x3')],'comment':_0xce2e('0xd')},'originalposition':{'type':Sequelize[_0xce2e('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xce2e('0x3')]},'connectedlinename':{'type':Sequelize[_0xce2e('0x3')]},'accountcode':{'type':Sequelize[_0xce2e('0x3')]},'context':{'type':Sequelize[_0xce2e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xce2e('0x3')]},'holdtime':{'type':Sequelize[_0xce2e('0xb')]},'mohtime':{'type':Sequelize[_0xce2e('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xce2e('0x3')]},'transfer':{'type':Sequelize[_0xce2e('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xce2e('0x3')],'comment':_0xce2e('0xe')},'transferexten':{'type':Sequelize[_0xce2e('0x3')]},'transferuniqueid':{'type':Sequelize[_0xce2e('0x3')]},'disposition':{'type':Sequelize[_0xce2e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xce2e('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2275=['getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2275,0xfa));var _0x5227=function(_0x350803,_0x4ffe67){_0x350803=_0x350803-0x0;var _0xeb8039=_0x2275[_0x350803];return _0xeb8039;};'use strict';var Sequelize=require(_0x5227('0x0'));var moment=require(_0x5227('0x1'));module[_0x5227('0x2')]={'type':{'type':Sequelize[_0x5227('0x3')]},'uniqueid':{'type':Sequelize[_0x5227('0x3')]},'calleridnum':{'type':Sequelize[_0x5227('0x3')]},'calleridname':{'type':Sequelize[_0x5227('0x3')]},'queue':{'type':Sequelize[_0x5227('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5227('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5227('0x4')],'set':function(_0x1dec7a){var _0x2aa9ea=moment(_0x1dec7a);var _0x351ad1=moment(this[_0x5227('0x5')]('queuecallerjoinAt'))[_0x5227('0x6')](_0x5227('0x7'));var _0x2d9323=_0x2aa9ea[_0x5227('0x8')](_0x351ad1,_0x5227('0x9'));this['setDataValue'](_0x5227('0xa'),_0x1dec7a);this[_0x5227('0xb')]('holdtime',_0x2d9323||null);}},'position':{'type':Sequelize[_0x5227('0xc')]},'count':{'type':Sequelize[_0x5227('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5227('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5227('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x5227('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5227('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5227('0x3')]},'context':{'type':Sequelize[_0x5227('0x3')]},'exten':{'type':Sequelize[_0x5227('0x3')]},'priority':{'type':Sequelize[_0x5227('0x3')]},'holdtime':{'type':Sequelize[_0x5227('0xc')]},'mohtime':{'type':Sequelize[_0x5227('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5227('0x3')]},'transfer':{'type':Sequelize[_0x5227('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5227('0x3')],'comment':_0x5227('0xe')},'transferexten':{'type':Sequelize[_0x5227('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5227('0x3')]},'disposition':{'type':Sequelize[_0x5227('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x5227('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 431d0e9..3374154 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(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x7a54,0x106));var _0x47a5=function(_0x202267,_0x2f8479){_0x202267=_0x202267-0x0;var _0x289389=_0x7a54[_0x202267];return _0x289389;};'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(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x7a54,0x106));var _0x47a5=function(_0x481cf5,_0x2dc933){_0x481cf5=_0x481cf5-0x0;var _0x3ae4c7=_0x7a54[_0x481cf5];return _0x3ae4c7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6e2df84..7e20533 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 _0x93c5=['hook','exports','events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xe6f6be,_0x4fa9a9){var _0x2e88b6=function(_0x57836f){while(--_0x57836f){_0xe6f6be['push'](_0xe6f6be['shift']());}};_0x2e88b6(++_0x4fa9a9);}(_0x93c5,0x16a));var _0x593c=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x93c5[_0x16d10f];return _0x50c823;};'use strict';var EventEmitter=require(_0x593c('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x593c('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x593c('0x2')](0x0);var events={'afterCreate':_0x593c('0x3'),'afterUpdate':_0x593c('0x4'),'afterDestroy':_0x593c('0x5')};function emitEvent(_0x10bbab){return function(_0x13c4dc,_0x539f51,_0x418a5b){VoiceQueueReportEvents[_0x593c('0x6')](_0x10bbab+':'+_0x13c4dc['id'],_0x13c4dc);VoiceQueueReportEvents['emit'](_0x10bbab,_0x13c4dc);_0x418a5b(null);};}for(var e in events){if(events[_0x593c('0x7')](e)){var event=events[e];VoiceQueueReport[_0x593c('0x8')](e,emitEvent(event));}}module[_0x593c('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0634=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','remove','emit'];(function(_0x4d7c91,_0xb6827e){var _0x1953e7=function(_0x328213){while(--_0x328213){_0x4d7c91['push'](_0x4d7c91['shift']());}};_0x1953e7(++_0xb6827e);}(_0x0634,0xc7));var _0x4063=function(_0x21331a,_0x57fc48){_0x21331a=_0x21331a-0x0;var _0x325c55=_0x0634[_0x21331a];return _0x325c55;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x4063('0x0'))['db'][_0x4063('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4063('0x2')};function emitEvent(_0x513c9f){return function(_0x3527fe,_0x51f29c,_0x8bc9ba){VoiceQueueReportEvents[_0x4063('0x3')](_0x513c9f+':'+_0x3527fe['id'],_0x3527fe);VoiceQueueReportEvents[_0x4063('0x3')](_0x513c9f,_0x3527fe);_0x8bc9ba(null);};}for(var e in events){if(events[_0x4063('0x4')](e)){var event=events[e];VoiceQueueReport[_0x4063('0x5')](e,emitEvent(event));}}module[_0x4063('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e4950a0..c911118 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 _0x1fcb=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','api','moment'];(function(_0x57bc1d,_0x4fc48a){var _0x127745=function(_0xb67723){while(--_0xb67723){_0x57bc1d['push'](_0x57bc1d['shift']());}};_0x127745(++_0x4fc48a);}(_0x1fcb,0x96));var _0xb1fc=function(_0x1efe9a,_0x4e96db){_0x1efe9a=_0x1efe9a-0x0;var _0x4385b4=_0x1fcb[_0x1efe9a];return _0x4385b4;};'use strict';var _=require(_0xb1fc('0x0'));var util=require(_0xb1fc('0x1'));var logger=require('../../config/logger')(_0xb1fc('0x2'));var moment=require(_0xb1fc('0x3'));var BPromise=require(_0xb1fc('0x4'));var rp=require(_0xb1fc('0x5'));var fs=require('fs');var path=require(_0xb1fc('0x6'));var rimraf=require(_0xb1fc('0x7'));var config=require(_0xb1fc('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xb1fc('0x9')]=function(_0x4ea231,_0x2527c6){return _0x4ea231[_0xb1fc('0xa')](_0xb1fc('0xb'),attributes,{'tableName':_0xb1fc('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb1fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0739=['define','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1bb8c0,_0x422534){var _0x16b733=function(_0x24b01a){while(--_0x24b01a){_0x1bb8c0['push'](_0x1bb8c0['shift']());}};_0x16b733(++_0x422534);}(_0x0739,0xba));var _0x9073=function(_0x7064b2,_0x38300f){_0x7064b2=_0x7064b2-0x0;var _0x5e60ce=_0x0739[_0x7064b2];return _0x5e60ce;};'use strict';var _=require(_0x9073('0x0'));var util=require(_0x9073('0x1'));var logger=require(_0x9073('0x2'))(_0x9073('0x3'));var moment=require('moment');var BPromise=require(_0x9073('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9073('0x5'));var config=require(_0x9073('0x6'));var attributes=require(_0x9073('0x7'));module[_0x9073('0x8')]=function(_0x5511e2,_0x17adc2){return _0x5511e2[_0x9073('0x9')](_0x9073('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9073('0xb')]},{'fields':[_0x9073('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a6ae05d..0e743d6 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 _0xfee2=['findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info','result','catch','GetVoiceQueueReport'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xfee2,0x176));var _0x2fee=function(_0x2ae0bf,_0x41bd97){_0x2ae0bf=_0x2ae0bf-0x0;var _0x41480c=_0xfee2[_0x2ae0bf];return _0x41480c;};'use strict';var _=require(_0x2fee('0x0'));var util=require(_0x2fee('0x1'));var moment=require(_0x2fee('0x2'));var BPromise=require(_0x2fee('0x3'));var rs=require(_0x2fee('0x4'));var fs=require('fs');var Redis=require(_0x2fee('0x5'));var db=require(_0x2fee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fee('0x7'))(_0x2fee('0x8'));var config=require(_0x2fee('0x9'));var jayson=require(_0x2fee('0xa'));var client=jayson['client'][_0x2fee('0xb')]({'port':0x232a});config[_0x2fee('0xc')]=_[_0x2fee('0xd')](config['redis'],{'host':_0x2fee('0xe'),'port':0x18eb});var socket=require(_0x2fee('0xf'))(new Redis(config[_0x2fee('0xc')]));require(_0x2fee('0x10'))[_0x2fee('0x11')](socket);function respondWithRpcPromise(_0x1f08a5,_0x4184e2,_0x3fee91){return new BPromise(function(_0x375add,_0x1a600b){return client['request'](_0x1f08a5,_0x3fee91)[_0x2fee('0x12')](function(_0x627760){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x4184e2,_0x2fee('0x13'));logger[_0x2fee('0x14')](_0x2fee('0x15'),_0x4184e2,_0x2fee('0x13'),JSON[_0x2fee('0x16')](_0x627760));if(_0x627760[_0x2fee('0x17')]){if(_0x627760[_0x2fee('0x17')][_0x2fee('0x18')]===0x1f4){logger[_0x2fee('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x4184e2,_0x627760[_0x2fee('0x17')][_0x2fee('0x19')]);return _0x1a600b(_0x627760[_0x2fee('0x17')][_0x2fee('0x19')]);}logger[_0x2fee('0x17')](_0x2fee('0x1a'),_0x4184e2,_0x627760['error'][_0x2fee('0x19')]);return _0x375add(_0x627760['error'][_0x2fee('0x19')]);}else{logger[_0x2fee('0x1b')](_0x2fee('0x1a'),_0x4184e2,_0x2fee('0x13'));_0x375add(_0x627760[_0x2fee('0x1c')][_0x2fee('0x19')]);}})[_0x2fee('0x1d')](function(_0x191871){logger[_0x2fee('0x17')](_0x2fee('0x1a'),_0x4184e2,_0x191871);_0x1a600b(_0x191871);});});}exports[_0x2fee('0x1e')]=function(_0x1d8417){var _0x2cbf9c=this;return new Promise(function(_0x477e03,_0x2d99e7){return db['VoiceQueueReport'][_0x2fee('0x1f')]({'raw':_0x1d8417[_0x2fee('0x20')]?_0x1d8417[_0x2fee('0x20')][_0x2fee('0x21')]===undefined?!![]:![]:!![],'where':_0x1d8417[_0x2fee('0x20')]?_0x1d8417[_0x2fee('0x20')][_0x2fee('0x22')]||null:null,'attributes':_0x1d8417[_0x2fee('0x20')]?_0x1d8417['options'][_0x2fee('0x23')]||null:null,'limit':_0x1d8417[_0x2fee('0x20')]?_0x1d8417['options'][_0x2fee('0x24')]||null:null,'include':_0x1d8417[_0x2fee('0x20')]?_0x1d8417[_0x2fee('0x20')]['include']?_[_0x2fee('0x25')](_0x1d8417[_0x2fee('0x20')][_0x2fee('0x26')],function(_0x28c31b){return{'model':db[_0x28c31b[_0x2fee('0x27')]],'as':_0x28c31b['as'],'attributes':_0x28c31b[_0x2fee('0x23')],'include':_0x28c31b[_0x2fee('0x26')]?_[_0x2fee('0x25')](_0x28c31b[_0x2fee('0x26')],function(_0x7e4ae6){return{'model':db[_0x7e4ae6[_0x2fee('0x27')]],'as':_0x7e4ae6['as'],'attributes':_0x7e4ae6[_0x2fee('0x23')],'include':_0x7e4ae6[_0x2fee('0x26')]?_[_0x2fee('0x25')](_0x7e4ae6[_0x2fee('0x26')],function(_0x2a9963){return{'model':db[_0x2a9963['model']],'as':_0x2a9963['as'],'attributes':_0x2a9963[_0x2fee('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2fee('0x12')](function(_0x499420){logger[_0x2fee('0x1b')]('GetVoiceQueueReport',_0x1d8417);logger[_0x2fee('0x14')]('GetVoiceQueueReport',_0x1d8417,JSON['stringify'](_0x499420));_0x477e03(_0x499420);})['catch'](function(_0x48dc85){logger[_0x2fee('0x17')]('GetVoiceQueueReport',_0x48dc85['message'],_0x1d8417);_0x2d99e7(_0x2cbf9c['error'](0x1f4,_0x48dc85['message']));});});};exports[_0x2fee('0x28')]=function(_0x16edbe){var _0xb5bbc7=this;return new Promise(function(_0xdb45bb,_0x44d7a4){return db['VoiceQueueReport'][_0x2fee('0x29')](_0x16edbe[_0x2fee('0x2a')],{'raw':_0x16edbe['options']?_0x16edbe[_0x2fee('0x20')][_0x2fee('0x21')]===undefined?!![]:![]:!![]})[_0x2fee('0x12')](function(_0x3d74d1){logger[_0x2fee('0x1b')](_0x2fee('0x28'),_0x16edbe);logger['debug'](_0x2fee('0x28'),_0x16edbe,JSON[_0x2fee('0x16')](_0x3d74d1));_0xdb45bb(_0x3d74d1);})[_0x2fee('0x1d')](function(_0x4fb98f){logger[_0x2fee('0x17')]('CreateVoiceQueueReport',_0x4fb98f['message'],_0x16edbe);_0x44d7a4(_0xb5bbc7[_0x2fee('0x17')](0x1f4,_0x4fb98f[_0x2fee('0x19')]));});});};exports[_0x2fee('0x2b')]=function(_0x53bb0e){var _0x2caf75=this;return new Promise(function(_0x416843,_0x235e5a){return db[_0x2fee('0x2c')]['update'](_0x53bb0e[_0x2fee('0x2a')],{'raw':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e[_0x2fee('0x20')][_0x2fee('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e[_0x2fee('0x20')][_0x2fee('0x22')]||null:null,'attributes':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e[_0x2fee('0x20')][_0x2fee('0x23')]||null:null,'limit':_0x53bb0e[_0x2fee('0x20')]?_0x53bb0e['options'][_0x2fee('0x24')]||null:null})[_0x2fee('0x12')](function(_0x363697){logger[_0x2fee('0x1b')]('UpdateVoiceQueueReport',_0x53bb0e);logger['debug'](_0x2fee('0x2b'),_0x53bb0e,JSON[_0x2fee('0x16')](_0x363697));_0x416843(_0x363697);})[_0x2fee('0x1d')](function(_0x1a4c1c){logger[_0x2fee('0x17')](_0x2fee('0x2b'),_0x1a4c1c[_0x2fee('0x19')],_0x53bb0e);_0x235e5a(_0x2caf75[_0x2fee('0x17')](0x1f4,_0x1a4c1c[_0x2fee('0x19')]));});});}; \ No newline at end of file +var _0x583e=['info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request'];(function(_0x2c2c0d,_0x477f6c){var _0x556d2c=function(_0x2089dd){while(--_0x2089dd){_0x2c2c0d['push'](_0x2c2c0d['shift']());}};_0x556d2c(++_0x477f6c);}(_0x583e,0x18a));var _0xe583=function(_0x44210e,_0x1c76d6){_0x44210e=_0x44210e-0x0;var _0x2c6399=_0x583e[_0x44210e];return _0x2c6399;};'use strict';var _=require(_0xe583('0x0'));var util=require('util');var moment=require(_0xe583('0x1'));var BPromise=require('bluebird');var rs=require(_0xe583('0x2'));var fs=require('fs');var Redis=require(_0xe583('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe583('0x4'))(_0xe583('0x5'));var config=require(_0xe583('0x6'));var jayson=require(_0xe583('0x7'));var client=jayson[_0xe583('0x8')][_0xe583('0x9')]({'port':0x232a});config[_0xe583('0xa')]=_[_0xe583('0xb')](config[_0xe583('0xa')],{'host':_0xe583('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe583('0xa')]));require(_0xe583('0xd'))[_0xe583('0xe')](socket);function respondWithRpcPromise(_0x19a8b6,_0x2bbac1,_0x43059c){return new BPromise(function(_0x8c8c02,_0x1b1a82){return client[_0xe583('0xf')](_0x19a8b6,_0x43059c)['then'](function(_0x26b4ae){logger[_0xe583('0x10')](_0xe583('0x11'),_0x2bbac1,'request\x20sent');logger[_0xe583('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2bbac1,_0xe583('0x13'),JSON[_0xe583('0x14')](_0x26b4ae));if(_0x26b4ae[_0xe583('0x15')]){if(_0x26b4ae[_0xe583('0x15')]['code']===0x1f4){logger[_0xe583('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2bbac1,_0x26b4ae['error']['message']);return _0x1b1a82(_0x26b4ae[_0xe583('0x15')][_0xe583('0x16')]);}logger[_0xe583('0x15')](_0xe583('0x11'),_0x2bbac1,_0x26b4ae['error'][_0xe583('0x16')]);return _0x8c8c02(_0x26b4ae['error']['message']);}else{logger[_0xe583('0x10')](_0xe583('0x11'),_0x2bbac1,'request\x20sent');_0x8c8c02(_0x26b4ae[_0xe583('0x17')][_0xe583('0x16')]);}})[_0xe583('0x18')](function(_0x30d3a7){logger[_0xe583('0x15')](_0xe583('0x11'),_0x2bbac1,_0x30d3a7);_0x1b1a82(_0x30d3a7);});});}exports[_0xe583('0x19')]=function(_0xcba8b1){var _0x2e874a=this;return new Promise(function(_0xb3dc97,_0x41491a){return db[_0xe583('0x1a')]['findAll']({'raw':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1[_0xe583('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1[_0xe583('0x1b')][_0xe583('0x1c')]||null:null,'attributes':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1[_0xe583('0x1b')][_0xe583('0x1d')]||null:null,'limit':_0xcba8b1['options']?_0xcba8b1[_0xe583('0x1b')][_0xe583('0x1e')]||null:null,'include':_0xcba8b1[_0xe583('0x1b')]?_0xcba8b1['options'][_0xe583('0x1f')]?_[_0xe583('0x20')](_0xcba8b1['options'][_0xe583('0x1f')],function(_0x3b348c){return{'model':db[_0x3b348c[_0xe583('0x21')]],'as':_0x3b348c['as'],'attributes':_0x3b348c['attributes'],'include':_0x3b348c[_0xe583('0x1f')]?_[_0xe583('0x20')](_0x3b348c[_0xe583('0x1f')],function(_0x439dfe){return{'model':db[_0x439dfe[_0xe583('0x21')]],'as':_0x439dfe['as'],'attributes':_0x439dfe[_0xe583('0x1d')],'include':_0x439dfe[_0xe583('0x1f')]?_[_0xe583('0x20')](_0x439dfe[_0xe583('0x1f')],function(_0x39a3c7){return{'model':db[_0x39a3c7[_0xe583('0x21')]],'as':_0x39a3c7['as'],'attributes':_0x39a3c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xe583('0x22')](function(_0x2cf0f2){logger[_0xe583('0x10')]('GetVoiceQueueReport',_0xcba8b1);logger['debug'](_0xe583('0x19'),_0xcba8b1,JSON[_0xe583('0x14')](_0x2cf0f2));_0xb3dc97(_0x2cf0f2);})[_0xe583('0x18')](function(_0x5d4421){logger[_0xe583('0x15')](_0xe583('0x19'),_0x5d4421['message'],_0xcba8b1);_0x41491a(_0x2e874a[_0xe583('0x15')](0x1f4,_0x5d4421[_0xe583('0x16')]));});});};exports[_0xe583('0x23')]=function(_0x2824f0){var _0x28a030=this;return new Promise(function(_0x2c5dab,_0x302b18){return db[_0xe583('0x1a')][_0xe583('0x24')](_0x2824f0[_0xe583('0x25')],{'raw':_0x2824f0[_0xe583('0x1b')]?_0x2824f0[_0xe583('0x1b')][_0xe583('0x26')]===undefined?!![]:![]:!![]})[_0xe583('0x22')](function(_0x165a24){logger[_0xe583('0x10')]('CreateVoiceQueueReport',_0x2824f0);logger['debug'](_0xe583('0x23'),_0x2824f0,JSON[_0xe583('0x14')](_0x165a24));_0x2c5dab(_0x165a24);})[_0xe583('0x18')](function(_0x2f9f03){logger[_0xe583('0x15')]('CreateVoiceQueueReport',_0x2f9f03[_0xe583('0x16')],_0x2824f0);_0x302b18(_0x28a030[_0xe583('0x15')](0x1f4,_0x2f9f03[_0xe583('0x16')]));});});};exports[_0xe583('0x27')]=function(_0x4e7998){var _0x259ca3=this;return new Promise(function(_0x31eeaf,_0x1caa0c){return db[_0xe583('0x1a')][_0xe583('0x28')](_0x4e7998[_0xe583('0x25')],{'raw':_0x4e7998[_0xe583('0x1b')]?_0x4e7998[_0xe583('0x1b')][_0xe583('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7998[_0xe583('0x1b')]?_0x4e7998[_0xe583('0x1b')][_0xe583('0x1c')]||null:null,'attributes':_0x4e7998[_0xe583('0x1b')]?_0x4e7998['options'][_0xe583('0x1d')]||null:null,'limit':_0x4e7998[_0xe583('0x1b')]?_0x4e7998[_0xe583('0x1b')][_0xe583('0x1e')]||null:null})[_0xe583('0x22')](function(_0x422be5){logger[_0xe583('0x10')](_0xe583('0x27'),_0x4e7998);logger[_0xe583('0x12')](_0xe583('0x27'),_0x4e7998,JSON['stringify'](_0x422be5));_0x31eeaf(_0x422be5);})[_0xe583('0x18')](function(_0x114784){logger[_0xe583('0x15')](_0xe583('0x27'),_0x114784[_0xe583('0x16')],_0x4e7998);_0x1caa0c(_0x259ca3[_0xe583('0x15')](0x1f4,_0x114784['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4fae9fa..aeb7b36 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 _0xd00b=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x5a93e1,_0x353625){var _0x524249=function(_0x3e2f07){while(--_0x3e2f07){_0x5a93e1['push'](_0x5a93e1['shift']());}};_0x524249(++_0x353625);}(_0xd00b,0x107));var _0xbd00=function(_0x3f7e59,_0x1c6293){_0x3f7e59=_0x3f7e59-0x0;var _0x52ff9d=_0xd00b[_0x3f7e59];return _0x52ff9d;};'use strict';var VoiceQueueReportEvents=require(_0xbd00('0x0'));var events=[_0xbd00('0x1'),_0xbd00('0x2'),_0xbd00('0x3')];function createListener(_0x3db048,_0x263637){return function(_0x1eff2f){_0x263637[_0xbd00('0x4')](_0x3db048,_0x1eff2f);};}function removeListener(_0x42aee3,_0x10cef3){return function(){VoiceQueueReportEvents[_0xbd00('0x5')](_0x42aee3,_0x10cef3);};}exports[_0xbd00('0x6')]=function(_0x4ac3da){for(var _0x332ab8=0x0,_0x23d5ff=events[_0xbd00('0x7')];_0x332ab8<_0x23d5ff;_0x332ab8++){var _0x1c3306=events[_0x332ab8];var _0x467300=createListener(_0xbd00('0x8')+_0x1c3306,_0x4ac3da);VoiceQueueReportEvents['on'](_0x1c3306,_0x467300);}}; \ No newline at end of file +var _0x8872=['update','emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x1647a4,_0x160e79){var _0x60cb4a=function(_0x35a8e6){while(--_0x35a8e6){_0x1647a4['push'](_0x1647a4['shift']());}};_0x60cb4a(++_0x160e79);}(_0x8872,0x1d3));var _0x2887=function(_0x5567af,_0x545f4d){_0x5567af=_0x5567af-0x0;var _0x20c8b5=_0x8872[_0x5567af];return _0x20c8b5;};'use strict';var VoiceQueueReportEvents=require(_0x2887('0x0'));var events=[_0x2887('0x1'),'remove',_0x2887('0x2')];function createListener(_0x397849,_0x55520d){return function(_0x5dc871){_0x55520d[_0x2887('0x3')](_0x397849,_0x5dc871);};}function removeListener(_0x698437,_0x27c329){return function(){VoiceQueueReportEvents[_0x2887('0x4')](_0x698437,_0x27c329);};}exports[_0x2887('0x5')]=function(_0xf80700){for(var _0x417bfb=0x0,_0x5597a3=events['length'];_0x417bfb<_0x5597a3;_0x417bfb++){var _0x580d3b=events[_0x417bfb];var _0x5af2ed=createListener(_0x2887('0x6')+_0x580d3b,_0xf80700);VoiceQueueReportEvents['on'](_0x580d3b,_0x5af2ed);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 36aa944..53d7a79 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 _0x20c0=['delete','destroy','util','path','express','Router','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x2a90d1,_0x1caf6c){var _0x13a99a=function(_0x55f21a){while(--_0x55f21a){_0x2a90d1['push'](_0x2a90d1['shift']());}};_0x13a99a(++_0x1caf6c);}(_0x20c0,0x13d));var _0x020c=function(_0x5863cc,_0x10ad34){_0x5863cc=_0x5863cc-0x0;var _0x55c055=_0x20c0[_0x5863cc];return _0x55c055;};'use strict';var multer=require('multer');var util=require(_0x020c('0x0'));var path=require(_0x020c('0x1'));var timeout=require('connect-timeout');var express=require(_0x020c('0x2'));var router=express[_0x020c('0x3')]();var auth=require(_0x020c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x020c('0x5'));router[_0x020c('0x6')]('/',auth[_0x020c('0x7')](),controller[_0x020c('0x8')]);router['get']('/:id',auth[_0x020c('0x7')](),controller[_0x020c('0x9')]);router[_0x020c('0xa')]('/',auth['isAuthenticated'](),controller[_0x020c('0xb')]);router['put'](_0x020c('0xc'),auth[_0x020c('0x7')](),controller['update']);router[_0x020c('0xd')](_0x020c('0xc'),auth[_0x020c('0x7')](),controller[_0x020c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x21f2=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0xf00af9,_0x3d3ae8){var _0xcdd1f4=function(_0x18a5ed){while(--_0x18a5ed){_0xf00af9['push'](_0xf00af9['shift']());}};_0xcdd1f4(++_0x3d3ae8);}(_0x21f2,0x158));var _0x221f=function(_0x35fced,_0x22a43a){_0x35fced=_0x35fced-0x0;var _0x3813c1=_0x21f2[_0x35fced];return _0x3813c1;};'use strict';var multer=require('multer');var util=require(_0x221f('0x0'));var path=require(_0x221f('0x1'));var timeout=require(_0x221f('0x2'));var express=require(_0x221f('0x3'));var router=express[_0x221f('0x4')]();var auth=require(_0x221f('0x5'));var interaction=require(_0x221f('0x6'));var config=require(_0x221f('0x7'));var controller=require(_0x221f('0x8'));router[_0x221f('0x9')]('/',auth[_0x221f('0xa')](),controller['index']);router[_0x221f('0x9')](_0x221f('0xb'),auth[_0x221f('0xa')](),controller[_0x221f('0xc')]);router[_0x221f('0xd')]('/',auth['isAuthenticated'](),controller[_0x221f('0xe')]);router[_0x221f('0xf')](_0x221f('0xb'),auth[_0x221f('0xa')](),controller[_0x221f('0x10')]);router[_0x221f('0x11')](_0x221f('0xb'),auth[_0x221f('0xa')](),controller[_0x221f('0x12')]);module[_0x221f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 017dc5a..47eda5c 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 _0xcb70=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x4f6a88,_0x174e85){var _0x1b7594=function(_0x5ad264){while(--_0x5ad264){_0x4f6a88['push'](_0x4f6a88['shift']());}};_0x1b7594(++_0x174e85);}(_0xcb70,0x111));var _0x0cb7=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xcb70[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0cb7('0x0'));module[_0x0cb7('0x1')]={'time':{'type':Sequelize[_0x0cb7('0x2')]},'callid':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0cb7('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0cb7('0x3')],'allowNull':![],'defaultValue':moment()[_0x0cb7('0x4')](_0x0cb7('0x5'))}}; \ No newline at end of file +var _0xd05a=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x156ee1,_0x4bcf10){var _0x72c113=function(_0x5034c4){while(--_0x5034c4){_0x156ee1['push'](_0x156ee1['shift']());}};_0x72c113(++_0x4bcf10);}(_0xd05a,0xdf));var _0xad05=function(_0x2b545d,_0xdb928e){_0x2b545d=_0x2b545d-0x0;var _0x44675b=_0xd05a[_0x2b545d];return _0x44675b;};'use strict';var Sequelize=require(_0xad05('0x0'));var moment=require(_0xad05('0x1'));module[_0xad05('0x2')]={'time':{'type':Sequelize[_0xad05('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xad05('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xad05('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xad05('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9791a4f..155e6db 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(_0x177fde,_0x2458d9){var _0x195b91=function(_0x2e5eb3){while(--_0x2e5eb3){_0x177fde['push'](_0x177fde['shift']());}};_0x195b91(++_0x2458d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x45ccd2,_0x4ecb10){_0x45ccd2=_0x45ccd2-0x0;var _0x554dff=_0xb10b[_0x45ccd2];return _0x554dff;};'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(_0x353204,_0x3ea389){var _0x53b2a6=function(_0x217298){while(--_0x217298){_0x353204['push'](_0x353204['shift']());}};_0x53b2a6(++_0x3ea389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 732ee48..6e85c12 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 _0x2675=['rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','lodash','moment','bluebird','path'];(function(_0x57122d,_0x2dee6d){var _0x290e18=function(_0x58ff52){while(--_0x58ff52){_0x57122d['push'](_0x57122d['shift']());}};_0x290e18(++_0x2dee6d);}(_0x2675,0x75));var _0x5267=function(_0x1575f8,_0x158acf){_0x1575f8=_0x1575f8-0x0;var _0x55410c=_0x2675[_0x1575f8];return _0x55410c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x6f47=['VoiceQueuesLog','event_dtm','event','dtm','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0x6f47,0xc7));var _0x76f4=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6f47[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x76f4('0xa'),'fields':[_0x76f4('0xb'),_0x76f4('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ff87aa0..7af3807 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 _0x2e54=['rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2db534,_0x46b832){_0x2db534=_0x2db534-0x0;var _0x39c2be=_0x2e54[_0x2db534];return _0x39c2be;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});} \ No newline at end of file +var _0x7be1=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','stringify','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x7be1,0x165));var _0x17be=function(_0x55fe01,_0x12ed37){_0x55fe01=_0x55fe01-0x0;var _0x5b42f0=_0x7be1[_0x55fe01];return _0x5b42f0;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5b0c,_0x326f4d,_0x23f19f){return new BPromise(function(_0x2c74b2,_0xfd9c5){return client[_0x17be('0xa')](_0x4f5b0c,_0x23f19f)[_0x17be('0xb')](function(_0x582848){logger[_0x17be('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x326f4d,_0x17be('0xd'));logger[_0x17be('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x326f4d,_0x17be('0xd'),JSON[_0x17be('0xf')](_0x582848));if(_0x582848[_0x17be('0x10')]){if(_0x582848[_0x17be('0x10')]['code']===0x1f4){logger[_0x17be('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x326f4d,_0x582848[_0x17be('0x10')]['message']);return _0xfd9c5(_0x582848[_0x17be('0x10')][_0x17be('0x11')]);}logger[_0x17be('0x10')](_0x17be('0x12'),_0x326f4d,_0x582848[_0x17be('0x10')]['message']);return _0x2c74b2(_0x582848[_0x17be('0x10')]['message']);}else{logger['info'](_0x17be('0x12'),_0x326f4d,'request\x20sent');_0x2c74b2(_0x582848[_0x17be('0x13')]['message']);}})[_0x17be('0x14')](function(_0x312b2e){logger['error'](_0x17be('0x12'),_0x326f4d,_0x312b2e);_0xfd9c5(_0x312b2e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 80b540a..9c4d147 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(_0x318d23,_0x3ff6d7){var _0x44f7d2=function(_0x62a1d7){while(--_0x62a1d7){_0x318d23['push'](_0x318d23['shift']());}};_0x44f7d2(++_0x3ff6d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0xf361a3,_0x438658){var _0x8db071=function(_0x5c54cf){while(--_0x5c54cf){_0xf361a3['push'](_0xf361a3['shift']());}};_0x8db071(++_0x438658);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e18ce78..017a8c4 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 _0xa1dc=['membername','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','toString','moment','path','exports','value','getDataValue','STRING','setDataValue','channel'];(function(_0x208ba7,_0x40bdb7){var _0x4e13d8=function(_0x558856){while(--_0x558856){_0x208ba7['push'](_0x208ba7['shift']());}};_0x4e13d8(++_0x40bdb7);}(_0xa1dc,0x161));var _0xca1d=function(_0x4c6426,_0x490363){_0x4c6426=_0x4c6426-0x0;var _0x23f077=_0xa1dc[_0x4c6426];return _0x23f077;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xca1d('0x0'));var path=require(_0xca1d('0x1'));module[_0xca1d('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xca1d('0x3'))?path['extname'](this[_0xca1d('0x4')](_0xca1d('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xca1d('0x5')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x4db10b){if(_0x4db10b){this[_0xca1d('0x6')](_0xca1d('0x7'),_0x4db10b);this[_0xca1d('0x6')](_0xca1d('0x8'),_0x4db10b['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xca1d('0x5')]},'calleridname':{'type':Sequelize[_0xca1d('0x5')]},'connectedlinenum':{'type':Sequelize[_0xca1d('0x5')]},'connectedlinename':{'type':Sequelize[_0xca1d('0x5')]},'accountcode':{'type':Sequelize[_0xca1d('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xca1d('0x5')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xca1d('0x5')]},'userDisposition':{'type':Sequelize[_0xca1d('0x5')]},'location':{'type':Sequelize[_0xca1d('0x9')]},'transcribeName':{'type':Sequelize[_0xca1d('0x5')]},'transcribeStatus':{'type':Sequelize[_0xca1d('0x5')],'defaultValue':_0xca1d('0xa')},'fileUri':{'type':Sequelize[_0xca1d('0x9')]},'fileText':{'type':Sequelize[_0xca1d('0x9')]},'failureReason':{'type':Sequelize[_0xca1d('0x9')]},'sentiment':{'type':Sequelize[_0xca1d('0x5')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xca1d('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0xca1d('0xb')]},'tempSentiment':{'type':Sequelize[_0xca1d('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xca1d('0x4')](_0xca1d('0xd')))[_0xca1d('0xe')](_0xca1d('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0xca1d('0x10')],'get':function(){return moment(this[_0xca1d('0x4')](_0xca1d('0x11')))[_0xca1d('0xe')](_0xca1d('0xf'))[_0xca1d('0x12')]();}}}; \ No newline at end of file +var _0x54ce=['createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE'];(function(_0x47d044,_0x1c8551){var _0x22052a=function(_0x54e010){while(--_0x54e010){_0x47d044['push'](_0x47d044['shift']());}};_0x22052a(++_0x1c8551);}(_0x54ce,0xe1));var _0xe54c=function(_0x4391d7,_0x2a1c93){_0x4391d7=_0x4391d7-0x0;var _0x4ab0f8=_0x54ce[_0x4391d7];return _0x4ab0f8;};'use strict';var Sequelize=require(_0xe54c('0x0'));var moment=require('moment');var path=require(_0xe54c('0x1'));module[_0xe54c('0x2')]={'format':{'type':Sequelize[_0xe54c('0x3')],'get':function(){return this[_0xe54c('0x4')](_0xe54c('0x5'))?path[_0xe54c('0x6')](this[_0xe54c('0x4')](_0xe54c('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xe54c('0x7')]},'channel':{'type':Sequelize[_0xe54c('0x7')],'set':function(_0x519dba){if(_0x519dba){this[_0xe54c('0x8')](_0xe54c('0x9'),_0x519dba);this['setDataValue'](_0xe54c('0xa'),_0x519dba[_0xe54c('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe54c('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe54c('0x7')]},'connectedlinenum':{'type':Sequelize[_0xe54c('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe54c('0x7')]},'context':{'type':Sequelize[_0xe54c('0x7')]},'exten':{'type':Sequelize[_0xe54c('0x7')]},'value':{'type':Sequelize[_0xe54c('0x7')]},'type':{'type':Sequelize[_0xe54c('0x7')]},'rating':{'type':Sequelize[_0xe54c('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe54c('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xe54c('0xd')]},'transcribeName':{'type':Sequelize[_0xe54c('0x7')]},'transcribeStatus':{'type':Sequelize[_0xe54c('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0xe54c('0xd')]},'fileText':{'type':Sequelize[_0xe54c('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xe54c('0x7')]},'sPositive':{'type':Sequelize[_0xe54c('0xe')]},'sNegative':{'type':Sequelize[_0xe54c('0xe')]},'sNeutral':{'type':Sequelize[_0xe54c('0xe')]},'sMixed':{'type':Sequelize[_0xe54c('0xe')]},'tempSentiment':{'type':Sequelize[_0xe54c('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xe54c('0x10')],'get':function(){return moment(this[_0xe54c('0x4')](_0xe54c('0x11')))[_0xe54c('0x12')](_0xe54c('0x13'))[_0xe54c('0x14')]();}},'updatedAt':{'type':Sequelize[_0xe54c('0x10')],'get':function(){return moment(this['getDataValue'](_0xe54c('0x15')))['format'](_0xe54c('0x13'))[_0xe54c('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 08bdbf1..6d0ee8f 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 _0x681c=['readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','limit','sort','where','pick','filter','VIRTUAL','merge','options','VoiceRecording','includeAll','findAll','show','params','length','include','create','body','catch','describe','download','../../components/encryptor','uniqueid','find','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename'];(function(_0x24bf6c,_0x5ea7d0){var _0x16cb2a=function(_0x37bfa9){while(--_0x37bfa9){_0x24bf6c['push'](_0x24bf6c['shift']());}};_0x16cb2a(++_0x5ea7d0);}(_0x681c,0x15a));var _0xc681=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x681c[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0xc681('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc681('0x1'));var zipdir=require(_0xc681('0x2'));var jsonpatch=require(_0xc681('0x3'));var rp=require('request-promise');var moment=require(_0xc681('0x4'));var BPromise=require(_0xc681('0x5'));var Mustache=require('mustache');var util=require(_0xc681('0x6'));var path=require(_0xc681('0x7'));var sox=require(_0xc681('0x8'));var csv=require(_0xc681('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc681('0xa'));var squel=require(_0xc681('0xb'));var crypto=require(_0xc681('0xc'));var jsforce=require(_0xc681('0xd'));var deskjs=require(_0xc681('0xe'));var toCsv=require(_0xc681('0x9'));var querystring=require('querystring');var Papa=require(_0xc681('0xf'));var AWS=require(_0xc681('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xc681('0x11'));var authService=require(_0xc681('0x12'));var qs=require(_0xc681('0x13'));var as=require(_0xc681('0x14'));var hardwareService=require(_0xc681('0x15'));var logger=require('../../config/logger')(_0xc681('0x16'));var utils=require(_0xc681('0x17'));var config=require(_0xc681('0x18'));var db=require(_0xc681('0x19'))['db'];function respondWithStatusCode(_0x429840,_0x2f3bba){_0x2f3bba=_0x2f3bba||0xcc;return function(_0x194d72){if(_0x194d72){return _0x429840[_0xc681('0x1a')](_0x2f3bba);}return _0x429840[_0xc681('0x1b')](_0x2f3bba)[_0xc681('0x1c')]();};}function respondWithResult(_0x201c92,_0x4e3e21){_0x4e3e21=_0x4e3e21||0xc8;return function(_0x3bbc92){if(_0x3bbc92){return _0x201c92[_0xc681('0x1b')](_0x4e3e21)[_0xc681('0x1d')](_0x3bbc92);}};}function respondWithFilteredResult(_0x3ee234,_0x51ce9b){return function(_0x429823){if(_0x429823){var _0x7addf3=_0x429823['count'],_0x1cb769=_0x51ce9b[_0xc681('0x1e')],_0x5636ac=_0x51ce9b[_0xc681('0x1e')]+_0x51ce9b['limit'],_0x13c11c;if(_0x5636ac>=_0x7addf3){_0x5636ac=_0x7addf3;_0x13c11c=0xc8;}else{_0x13c11c=0xce;}_0x3ee234[_0xc681('0x1b')](_0x13c11c);return _0x3ee234[_0xc681('0x1f')](_0xc681('0x20'),_0x1cb769+'-'+_0x5636ac+'/'+_0x7addf3)[_0xc681('0x1d')](_0x429823);}return null;};}function patchUpdates(_0x2f62ab){return function(_0x125180){try{jsonpatch[_0xc681('0x21')](_0x125180,_0x2f62ab,!![]);}catch(_0x570d7c){return BPromise[_0xc681('0x22')](_0x570d7c);}return _0x125180['save']();};}function saveUpdates(_0x41ff08,_0x22862f){return function(_0x44231f){if(_0x44231f){return _0x44231f[_0xc681('0x23')](_0x41ff08)[_0xc681('0x24')](function(_0x3786e4){return _0x3786e4;});}return null;};}function removeEntity(_0x7f1d6a,_0x5cf537){return function(_0x34a87e){if(_0x34a87e){return _0x34a87e[_0xc681('0x25')]()['then'](function(){_0x7f1d6a[_0xc681('0x1b')](0xcc)[_0xc681('0x1c')]();});}};}function handleEntityNotFound(_0x5448aa,_0x156958){return function(_0x375325){if(!_0x375325){_0x5448aa[_0xc681('0x1a')](0x194);}return _0x375325;};}function handleError(_0x8c4f66,_0xf74f){_0xf74f=_0xf74f||0x1f4;return function(_0x5b933c){logger['error'](_0x5b933c[_0xc681('0x26')]);if(_0x5b933c[_0xc681('0x27')]){delete _0x5b933c['name'];}_0x8c4f66[_0xc681('0x1b')](_0xf74f)[_0xc681('0x28')](_0x5b933c);};}exports[_0xc681('0x29')]=function(_0x20764c,_0x129fec){var _0x334d81={},_0x31e68c={},_0x392189={'count':0x0,'rows':[]};var _0x431ebf=_[_0xc681('0x2a')](db['VoiceRecording'][_0xc681('0x2b')],function(_0x3f7057){return{'name':_0x3f7057[_0xc681('0x2c')],'type':_0x3f7057[_0xc681('0x2d')][_0xc681('0x2e')]};});_0x31e68c[_0xc681('0x2f')]=_[_0xc681('0x30')](_['map'](_0x431ebf,'name'),[_0xc681('0x31')]);_0x31e68c[_0xc681('0x32')]=_[_0xc681('0x33')](_0x20764c[_0xc681('0x32')]);_0x31e68c[_0xc681('0x34')]=_[_0xc681('0x35')](_0x31e68c[_0xc681('0x2f')],_0x31e68c[_0xc681('0x32')]);_0x334d81[_0xc681('0x36')]=_['intersection'](_0x31e68c[_0xc681('0x2f')],qs[_0xc681('0x37')](_0x20764c[_0xc681('0x32')][_0xc681('0x37')]));_0x334d81['attributes']=_0x334d81[_0xc681('0x36')]['length']?_0x334d81[_0xc681('0x36')]:_0x31e68c[_0xc681('0x2f')];if(!_0x20764c['query']['hasOwnProperty']('nolimit')){_0x334d81[_0xc681('0x38')]=qs[_0xc681('0x38')](_0x20764c[_0xc681('0x32')][_0xc681('0x38')]);_0x334d81['offset']=qs[_0xc681('0x1e')](_0x20764c[_0xc681('0x32')]['offset']);}_0x334d81['order']=qs[_0xc681('0x39')](_0x20764c[_0xc681('0x32')]['sort']);_0x334d81[_0xc681('0x3a')]=qs[_0xc681('0x34')](_[_0xc681('0x3b')](_0x20764c[_0xc681('0x32')],_0x31e68c[_0xc681('0x34')]),_0x431ebf);if(_0x20764c[_0xc681('0x32')][_0xc681('0x3c')]){_0x334d81['where']=_['merge'](_0x334d81[_0xc681('0x3a')],{'$or':_[_0xc681('0x2a')](_0x431ebf,function(_0x3d17ce){if(_0x3d17ce[_0xc681('0x2d')]!==_0xc681('0x3d')){var _0x57a3e8={};_0x57a3e8[_0x3d17ce[_0xc681('0x27')]]={'$like':'%'+_0x20764c[_0xc681('0x32')]['filter']+'%'};return _0x57a3e8;}})});}_0x334d81=_[_0xc681('0x3e')]({},_0x334d81,_0x20764c[_0xc681('0x3f')]);var _0x35b405={'where':_0x334d81[_0xc681('0x3a')]};return db[_0xc681('0x40')]['count'](_0x35b405)[_0xc681('0x24')](function(_0x458760){_0x392189['count']=_0x458760;if(_0x20764c[_0xc681('0x32')][_0xc681('0x41')]){_0x334d81['include']=[{'all':!![]}];}return db[_0xc681('0x40')][_0xc681('0x42')](_0x334d81);})['then'](function(_0x3d089c){_0x392189['rows']=_0x3d089c;return _0x392189;})[_0xc681('0x24')](respondWithFilteredResult(_0x129fec,_0x334d81))['catch'](handleError(_0x129fec,null));};exports[_0xc681('0x43')]=function(_0x3abefe,_0x26c0a3){var _0x2a9824={'raw':![],'where':{'id':_0x3abefe[_0xc681('0x44')]['id']}},_0x353b45={};_0x353b45[_0xc681('0x2f')]=_[_0xc681('0x33')](db[_0xc681('0x40')]['rawAttributes']);_0x353b45[_0xc681('0x32')]=_[_0xc681('0x33')](_0x3abefe[_0xc681('0x32')]);_0x353b45[_0xc681('0x34')]=_[_0xc681('0x35')](_0x353b45[_0xc681('0x2f')],_0x353b45[_0xc681('0x32')]);_0x2a9824[_0xc681('0x36')]=_[_0xc681('0x35')](_0x353b45[_0xc681('0x2f')],qs[_0xc681('0x37')](_0x3abefe['query'][_0xc681('0x37')]));_0x2a9824[_0xc681('0x36')]=_0x2a9824['attributes'][_0xc681('0x45')]?_0x2a9824[_0xc681('0x36')]:_0x353b45[_0xc681('0x2f')];if(_0x3abefe['query'][_0xc681('0x41')]){_0x2a9824[_0xc681('0x46')]=[{'all':!![]}];}_0x2a9824=_[_0xc681('0x3e')]({},_0x2a9824,_0x3abefe[_0xc681('0x3f')]);return db['VoiceRecording']['find'](_0x2a9824)[_0xc681('0x24')](handleEntityNotFound(_0x26c0a3,null))[_0xc681('0x24')](respondWithResult(_0x26c0a3,null))['catch'](handleError(_0x26c0a3,null));};exports['create']=function(_0x257549,_0x5f9adc){return db[_0xc681('0x40')][_0xc681('0x47')](_0x257549[_0xc681('0x48')],{})['then'](respondWithResult(_0x5f9adc,0xc9))['catch'](handleError(_0x5f9adc,null));};exports[_0xc681('0x23')]=function(_0x8e5c5b,_0x1e8c1b){if(_0x8e5c5b[_0xc681('0x48')]['id']){delete _0x8e5c5b[_0xc681('0x48')]['id'];}return db[_0xc681('0x40')]['find']({'where':{'id':_0x8e5c5b[_0xc681('0x44')]['id']}})[_0xc681('0x24')](handleEntityNotFound(_0x1e8c1b,null))[_0xc681('0x24')](saveUpdates(_0x8e5c5b[_0xc681('0x48')],null))[_0xc681('0x24')](respondWithResult(_0x1e8c1b,null))[_0xc681('0x49')](handleError(_0x1e8c1b,null));};exports[_0xc681('0x4a')]=function(_0x62da2c,_0x11bf6f){return db['VoiceRecording'][_0xc681('0x4a')]()[_0xc681('0x24')](respondWithResult(_0x11bf6f,null))[_0xc681('0x49')](handleError(_0x11bf6f,null));};exports[_0xc681('0x4b')]=function(_0x3bb6d8,_0x4fccf5,_0x23d0bd){var _0x1f4653=require(_0xc681('0x4c'));var _0x227e07=![];var _0x16b44b={};if(_0x3bb6d8[_0xc681('0x32')][_0xc681('0x2d')]&&_0x3bb6d8[_0xc681('0x32')][_0xc681('0x2d')]==='uniqueid'){_0x16b44b[_0xc681('0x4d')]=_0x3bb6d8[_0xc681('0x44')]['id'];}else{_0x16b44b['id']=_0x3bb6d8[_0xc681('0x44')]['id'];}return db['VoiceRecording'][_0xc681('0x4e')]({'where':_0x16b44b,'attributes':['id',_0xc681('0x4f')],'raw':!![]})[_0xc681('0x24')](handleEntityNotFound(_0x4fccf5,null))[_0xc681('0x24')](function(_0x4131b9){if(_0x4131b9){var _0x1dd797=_0x4131b9[_0xc681('0x4f')];var _0x7efb50=util['format']('%s.cypher',_0x1dd797);if(fs[_0xc681('0x50')](_0x7efb50)){_0x227e07=!![];return _0x1f4653[_0xc681('0x51')](_0x7efb50,_0x1dd797,config[_0xc681('0x52')][_0xc681('0x53')])['then'](function(){return _0x4131b9;});}return _0x4131b9;}})[_0xc681('0x24')](function(_0x28fc19){if(_0x28fc19){var _0x28fec2=_0x28fc19[_0xc681('0x4f')];if(!fs['existsSync'](_0x28fec2)){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))](_0xc681('0x56'));}if(_0x28fc19[_0xc681('0x57')]){return _0x4fccf5[_0xc681('0x4b')](_0x28fec2,_0x28fc19[_0xc681('0x57')]+path['extname'](_0x28fec2),function(){if(_0x227e07){fs[_0xc681('0x58')](_0x28fec2);}});}else{return _0x4fccf5['download'](_0x28fec2,function(_0x47b160){if(_0x227e07){fs[_0xc681('0x58')](_0x28fec2);}});}}})[_0xc681('0x49')](function(_0x339870){if(_0x339870[_0xc681('0x59')]===_0xc681('0x56')){_0x4fccf5[_0xc681('0x1b')](0x194)['send'](_0xc681('0x5a'));}else{return handleError(_0x4fccf5,null);}});};exports['downloads']=function(_0x226109,_0x4e7c69,_0x22bc30){var _0x15f9a4=require('../../components/encryptor');var _0x2e64ab=![];var _0x55e1b9={'$and':[db[_0xc681('0x5b')][_0xc681('0x3a')](db[_0xc681('0x5b')]['fn'](_0xc681('0x5c'),db['sequelize'][_0xc681('0x5d')](_0xc681('0x4d'))),_0x226109[_0xc681('0x32')][_0xc681('0x5e')])]};if(_0x226109[_0xc681('0x32')][_0xc681('0x2d')]&&_0x226109[_0xc681('0x32')][_0xc681('0x2d')]===_0xc681('0x4d')){_0x55e1b9[_0xc681('0x5f')][_0xc681('0x60')]({'uniqueid':_0x226109[_0xc681('0x44')]['id']});}else{_0x55e1b9['$and'][_0xc681('0x60')]({'id':_0x226109[_0xc681('0x44')]['id']});}return db['VoiceRecording'][_0xc681('0x4e')]({'where':_0x55e1b9,'attributes':['id','value'],'raw':!![]})[_0xc681('0x24')](handleEntityNotFound(_0x4e7c69,null))[_0xc681('0x24')](function(_0x2a5c17){if(_0x2a5c17){var _0x428799=util['format'](_0xc681('0x61'),_0x2a5c17[_0xc681('0x4f')]);if(fs[_0xc681('0x50')](_0x428799)){_0x2e64ab=!![];return _0x15f9a4[_0xc681('0x51')](_0x428799,_0x2a5c17[_0xc681('0x4f')],config[_0xc681('0x52')][_0xc681('0x53')])[_0xc681('0x24')](function(){return _0x2a5c17;});}return _0x2a5c17;}})[_0xc681('0x24')](function(_0x5584f0){if(_0x5584f0){if(!fs[_0xc681('0x50')](_0x5584f0[_0xc681('0x4f')])){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))](_0xc681('0x56'));}if(_0x5584f0[_0xc681('0x57')]){return _0x4e7c69[_0xc681('0x4b')](_0x5584f0['value'],_0x5584f0[_0xc681('0x57')]+path['extname'](_0x5584f0[_0xc681('0x4f')]),function(){if(_0x2e64ab){fs[_0xc681('0x58')](_0x5584f0['value']);}});}else{return _0x4e7c69['download'](_0x5584f0[_0xc681('0x4f')],function(_0x3a138d){if(_0x2e64ab){fs['unlink'](_0x5584f0[_0xc681('0x4f')]);}});}}})['catch'](handleError(_0x4e7c69,null));};exports[_0xc681('0x25')]=function(_0x12f2d8,_0x2f3ea1){return db[_0xc681('0x40')][_0xc681('0x4e')]({'where':{'id':_0x12f2d8[_0xc681('0x44')]['id']}})[_0xc681('0x24')](function(_0x27721d){if(!_0x27721d)throw new ReferenceError(_0xc681('0x62'));return _0x27721d;})[_0xc681('0x24')](function(_0x160953){var _0x22a798=_0x160953['value'];logger['info'](_0xc681('0x63'),_0x22a798);if(!_[_0xc681('0x64')](_0x160953['value'])&&fs[_0xc681('0x50')](_0x22a798)){logger[_0xc681('0x65')]('File:\x20\x22'+_0x22a798+_0xc681('0x66'));fs[_0xc681('0x67')](_0x22a798);}_0x22a798=_0x22a798+_0xc681('0x68');if(!_['isNil'](_0x160953[_0xc681('0x4f')])&&fs['existsSync'](_0x22a798)){logger[_0xc681('0x65')](_0xc681('0x69')+_0x22a798+_0xc681('0x66'));fs[_0xc681('0x67')](_0x22a798);}return _0x160953;})[_0xc681('0x24')](function(_0x8cbc49){if(!_0x8cbc49)throw new InternalError();return _0x8cbc49[_0xc681('0x25')]();})[_0xc681('0x24')](function(){_0x2f3ea1['status'](0xcc)[_0xc681('0x1c')]();})['catch'](handleError(_0x2f3ea1,null));};function getBucketslist(_0x308e45,_0x31d9eb,_0x10500f){return new Promise(function(_0x5ecee8,_0x2d6852){var _0x57f336=new AWS['S3']({'accessKeyId':_0x31d9eb,'secretAccessKey':_0x308e45,'region':_0x10500f});_0x57f336[_0xc681('0x6a')]({},function(_0x1c5a0d,_0xf3dce2){if(_0x1c5a0d){return _0x2d6852(_0x1c5a0d);}else{return _0x5ecee8(_0xf3dce2);}});});}function createBucket(_0x2cbfd4,_0x53ff1a,_0x1d91d0,_0x517531){return new Promise(function(_0x3fdb4e,_0x797b77){var _0x18cc3d=new AWS['S3']({'accessKeyId':_0x53ff1a,'secretAccessKey':_0x2cbfd4,'region':_0x1d91d0});_0x18cc3d[_0xc681('0x6b')]({'Bucket':_0x517531},function(_0x1e45c7,_0x2bb752){if(_0x1e45c7){return _0x797b77(_0x1e45c7);}else{return _0x3fdb4e(_0x2bb752);}});});}function uploadFile(_0x12d751,_0x45d695,_0x4b33df,_0x1938a8,_0x2e7cc6,_0x56894f){return new Promise(function(_0x360298,_0x5915f5){var _0x288612=new AWS['S3']({'accessKeyId':_0x45d695,'secretAccessKey':_0x12d751,'region':_0x4b33df});_0x288612[_0xc681('0x6c')]({'Bucket':_0x1938a8,'Key':_0x2e7cc6,'Body':_0x56894f},function(_0x31d273,_0x1bd860){if(_0x31d273){return _0x5915f5(_0x31d273);}else{return _0x360298(_0x1bd860);}});});}function startTranscribe(_0x17769e,_0x5cef16,_0x20bdb3,_0x252398,_0x554cad,_0x4c7aa7){return new Promise(function(_0x311ff9,_0x48d18c){var _0x181063=new AWS[(_0xc681('0x6d'))]({'accessKeyId':_0x5cef16,'secretAccessKey':_0x17769e,'region':_0x20bdb3});_0x181063[_0xc681('0x6e')]({'TranscriptionJobName':_0x252398,'LanguageCode':_0x554cad,'Media':{'MediaFileUri':_0x4c7aa7}},function(_0x321ded,_0x4513d6){if(_0x321ded){return _0x48d18c(_0x321ded);}else{return _0x311ff9(_0x4513d6);}});});}function transcribe(_0xe91d69,_0x3454a3,_0x4ca87a,_0x38b959,_0x3ab23b,_0x83c2ae,_0x4e48be){return new Promise(function(_0x777d2d,_0x476255){var _0xa32d60={};logger[_0xc681('0x65')](util[_0xc681('0x31')](_0xc681('0x6f'),_0xe91d69,_0x3ab23b));return uploadFile(_0x3454a3,_0x4ca87a,_0x38b959,_0x3ab23b,path[_0xc681('0x70')](_0x83c2ae),fs[_0xc681('0x71')](_0x83c2ae))['then'](function(_0x3df6d7){logger[_0xc681('0x65')](util[_0xc681('0x31')](_0xc681('0x72'),_0xe91d69,_0x3ab23b,_0x3df6d7[_0xc681('0x73')]));_0xa32d60[_0xc681('0x74')]=_0x3df6d7['Bucket'];_0xa32d60[_0xc681('0x75')]=_0x3df6d7[_0xc681('0x73')];logger['info'](util['format'](_0xc681('0x76'),_0xe91d69));return startTranscribe(_0x3454a3,_0x4ca87a,_0x38b959,uuidv4(),_0x4e48be,_0x3df6d7[_0xc681('0x73')]);})[_0xc681('0x24')](function(_0x92a7d5){logger[_0xc681('0x65')](util['format'](_0xc681('0x77'),_0xe91d69,_0x92a7d5[_0xc681('0x78')][_0xc681('0x79')]));_0xa32d60[_0xc681('0x7a')]=_0x92a7d5[_0xc681('0x78')][_0xc681('0x79')];_0xa32d60['transcribeStatus']=_0x92a7d5[_0xc681('0x78')][_0xc681('0x7b')];return _0x777d2d(_0xa32d60);})[_0xc681('0x49')](function(_0x20c740){return _0x476255(_0x20c740);});});}exports[_0xc681('0x7c')]=function(_0x1cc974,_0x1612ff,_0x557fbe){var _0x3030f0;var _0x15dcf9;var _0x1bcf73;var _0x55f1f4=require('../../components/encryptor');return db[_0xc681('0x40')][_0xc681('0x7d')]({'where':{'id':_0x1cc974[_0xc681('0x44')]['id']}})[_0xc681('0x24')](function(_0x1ea3e2){if(_0x1ea3e2){var _0x53b28a=util[_0xc681('0x31')](_0xc681('0x61'),_0x1ea3e2[_0xc681('0x4f')]);if(fs[_0xc681('0x50')](_0x53b28a)){cypher=!![];return _0x55f1f4[_0xc681('0x51')](_0x53b28a,_0x1ea3e2['value'],config[_0xc681('0x52')]['recording'])[_0xc681('0x24')](function(){return _0x1ea3e2;});}return _0x1ea3e2;}})[_0xc681('0x24')](function(_0x3d9ae2){if(!_0x3d9ae2){throw new db[(_0xc681('0x54'))]['ValidationError'](_0xc681('0x7e'));}_0x15dcf9=_0x3d9ae2;return db[_0xc681('0x7f')][_0xc681('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1612ff,null))[_0xc681('0x24')](function(_0x30045c){if(_0x30045c){_0x3030f0=_0x30045c;if(!_0x3030f0[_0xc681('0x80')]||!_0x3030f0[_0xc681('0x81')]||!_0x3030f0[_0xc681('0x82')]||!_0x3030f0[_0xc681('0x83')]||!_0x3030f0['bucket']){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))]('Transcribe\x20not\x20configured');}if(_0x1cc974[_0xc681('0x48')][_0xc681('0x84')]&&(!_0x3030f0[_0xc681('0x85')]||!_0x3030f0[_0xc681('0x86')]||!_0x3030f0[_0xc681('0x87')]||!_0x3030f0[_0xc681('0x83')]||!_0x3030f0['bucket'])){throw new db[(_0xc681('0x54'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xc681('0x7d')]({'where':{'id':_0x3030f0[_0xc681('0x81')]}});}})[_0xc681('0x24')](function(_0xad709a){if(!_0xad709a){throw new db[(_0xc681('0x54'))]['ValidationError'](_0xc681('0x88'));}if(!_0xad709a[_0xc681('0x89')]||!_0xad709a[_0xc681('0x8a')]){throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x1bcf73=_0xad709a;return getBucketslist(_0x1bcf73['data1'],_0x1bcf73[_0xc681('0x8a')],_0x3030f0[_0xc681('0x82')]);})['then'](function(_0x5ace60){if(_0x5ace60&&_0x5ace60[_0xc681('0x8b')]){var _0x1035b0=_[_0xc681('0x4e')](_0x5ace60['Buckets'],function(_0x334ec3){return _0x334ec3[_0xc681('0x8c')]===_0x3030f0[_0xc681('0x74')];});if(!_0x1035b0){logger[_0xc681('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1cc974[_0xc681('0x44')]['id'],_0x3030f0[_0xc681('0x74')]));return createBucket(_0x1bcf73[_0xc681('0x89')],_0x1bcf73[_0xc681('0x8a')],_0x3030f0['transcribeRegion'],_0x3030f0['bucket']);}logger['info'](util[_0xc681('0x31')](_0xc681('0x8d'),_0x1cc974['params']['id'],_0x3030f0[_0xc681('0x74')]));return;}})['then'](function(_0xcbf44e){if(_0x15dcf9[_0xc681('0x8e')]===_0xc681('0x8f')){return transcribe(_0x1cc974['params']['id'],_0x1bcf73[_0xc681('0x89')],_0x1bcf73['data2'],_0x3030f0[_0xc681('0x82')],_0x3030f0[_0xc681('0x74')],_0x15dcf9[_0xc681('0x4f')],_0x3030f0['language']);}else{logger[_0xc681('0x65')](util[_0xc681('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1cc974[_0xc681('0x44')]['id']));return{'transcribeStatus':_0xc681('0x90')};}})['then'](function(_0x3fdbda){if(_0x3fdbda){_0x3fdbda[_0xc681('0x91')]=_0x1cc974[_0xc681('0x48')][_0xc681('0x84')];return _0x15dcf9[_0xc681('0x92')](_0x3fdbda);}})['then'](respondWithResult(_0x1612ff,null))[_0xc681('0x49')](handleError(_0x1612ff,null));};function writeFile(_0x38a91c,_0x381a14){return new Promise(function(_0xae14bc,_0x4b962d){fs[_0xc681('0x93')](_0x381a14,_0x38a91c,function(_0x2b8292,_0x43f47c){if(_0x2b8292){return _0x4b962d(_0x2b8292);}else{return _0xae14bc(_0x43f47c);}});});}exports[_0xc681('0x94')]=function(_0x16be6b,_0x3fec48,_0x5bcc93){return db[_0xc681('0x40')]['findOne']({'where':{'id':_0x16be6b[_0xc681('0x44')]['id']}})[_0xc681('0x24')](handleEntityNotFound(_0x3fec48))[_0xc681('0x24')](function(_0x32faae){if(_0x32faae&&_0x32faae[_0xc681('0x95')]){var _0x30dfff=_0x32faae[_0xc681('0x95')];var _0x4fb602=config[_0xc681('0x96')]+'/server/files/transcribes/transcribe_'+_0x32faae['id']+_0xc681('0x97');if(fs[_0xc681('0x50')](_0x4fb602)){return _0x4fb602;}return writeFile(_0x30dfff,_0x4fb602)[_0xc681('0x24')](function(){return _0x4fb602;});}else{throw new db[(_0xc681('0x54'))][(_0xc681('0x55'))](_0xc681('0x98'));}})[_0xc681('0x24')](function(_0x508d8e){return _0x3fec48['download'](_0x508d8e);})[_0xc681('0x49')](handleError(_0x3fec48));}; \ No newline at end of file +var _0x6738=['transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','then','stack','name','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','find','create','update','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','MD5','col','token','$and','push','ValidationError','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob'];(function(_0x344c9a,_0x11e5e8){var _0x55ffbf=function(_0x6e3a5d){while(--_0x6e3a5d){_0x344c9a['push'](_0x344c9a['shift']());}};_0x55ffbf(++_0x11e5e8);}(_0x6738,0xbf));var _0x8673=function(_0x23b2fc,_0x5f2ee2){_0x23b2fc=_0x23b2fc-0x0;var _0x30e1d1=_0x6738[_0x23b2fc];return _0x30e1d1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8673('0x0'));var rimraf=require(_0x8673('0x1'));var zipdir=require(_0x8673('0x2'));var jsonpatch=require(_0x8673('0x3'));var rp=require(_0x8673('0x4'));var moment=require(_0x8673('0x5'));var BPromise=require(_0x8673('0x6'));var Mustache=require(_0x8673('0x7'));var util=require('util');var path=require(_0x8673('0x8'));var sox=require(_0x8673('0x9'));var csv=require(_0x8673('0xa'));var ejs=require(_0x8673('0xb'));var fs=require('fs');var _=require(_0x8673('0xc'));var squel=require(_0x8673('0xd'));var crypto=require(_0x8673('0xe'));var jsforce=require(_0x8673('0xf'));var deskjs=require(_0x8673('0x10'));var toCsv=require(_0x8673('0xa'));var querystring=require(_0x8673('0x11'));var Papa=require(_0x8673('0x12'));var AWS=require(_0x8673('0x13'));var uuidv4=require(_0x8673('0x14'));var Redis=require('ioredis');var authService=require(_0x8673('0x15'));var qs=require(_0x8673('0x16'));var as=require(_0x8673('0x17'));var hardwareService=require(_0x8673('0x18'));var logger=require(_0x8673('0x19'))(_0x8673('0x1a'));var utils=require(_0x8673('0x1b'));var config=require(_0x8673('0x1c'));var db=require(_0x8673('0x1d'))['db'];function respondWithStatusCode(_0x5d26ca,_0x265695){_0x265695=_0x265695||0xcc;return function(_0x1ab17a){if(_0x1ab17a){return _0x5d26ca[_0x8673('0x1e')](_0x265695);}return _0x5d26ca[_0x8673('0x1f')](_0x265695)[_0x8673('0x20')]();};}function respondWithResult(_0x5b562b,_0x3e174a){_0x3e174a=_0x3e174a||0xc8;return function(_0x1da3db){if(_0x1da3db){return _0x5b562b['status'](_0x3e174a)[_0x8673('0x21')](_0x1da3db);}};}function respondWithFilteredResult(_0x3f9b3c,_0x581da5){return function(_0x5b0ae6){if(_0x5b0ae6){var _0x38353a=_0x5b0ae6['count'],_0xc615c8=_0x581da5[_0x8673('0x22')],_0x16f2c0=_0x581da5[_0x8673('0x22')]+_0x581da5[_0x8673('0x23')],_0x55a242;if(_0x16f2c0>=_0x38353a){_0x16f2c0=_0x38353a;_0x55a242=0xc8;}else{_0x55a242=0xce;}_0x3f9b3c['status'](_0x55a242);return _0x3f9b3c['set']('Content-Range',_0xc615c8+'-'+_0x16f2c0+'/'+_0x38353a)[_0x8673('0x21')](_0x5b0ae6);}return null;};}function patchUpdates(_0x35145e){return function(_0x1e13cb){try{jsonpatch[_0x8673('0x24')](_0x1e13cb,_0x35145e,!![]);}catch(_0x5d11ff){return BPromise[_0x8673('0x25')](_0x5d11ff);}return _0x1e13cb['save']();};}function saveUpdates(_0x45d250,_0x17f38e){return function(_0x2ac179){if(_0x2ac179){return _0x2ac179['update'](_0x45d250)[_0x8673('0x26')](function(_0x3bb0f1){return _0x3bb0f1;});}return null;};}function removeEntity(_0xa250ca,_0x385cff){return function(_0x1b4df8){if(_0x1b4df8){return _0x1b4df8['destroy']()[_0x8673('0x26')](function(){_0xa250ca[_0x8673('0x1f')](0xcc)[_0x8673('0x20')]();});}};}function handleEntityNotFound(_0x39b5f3,_0x401862){return function(_0x2e1cea){if(!_0x2e1cea){_0x39b5f3[_0x8673('0x1e')](0x194);}return _0x2e1cea;};}function handleError(_0x3dd6f0,_0x23481e){_0x23481e=_0x23481e||0x1f4;return function(_0x3b705c){logger['error'](_0x3b705c[_0x8673('0x27')]);if(_0x3b705c[_0x8673('0x28')]){delete _0x3b705c[_0x8673('0x28')];}_0x3dd6f0[_0x8673('0x1f')](_0x23481e)['send'](_0x3b705c);};}exports[_0x8673('0x29')]=function(_0x48f6f7,_0x3cb2f8){var _0x16f683={},_0x148259={},_0x35d4ab={'count':0x0,'rows':[]};var _0x19bdb8=_['map'](db[_0x8673('0x2a')][_0x8673('0x2b')],function(_0x40d976){return{'name':_0x40d976[_0x8673('0x2c')],'type':_0x40d976[_0x8673('0x2d')][_0x8673('0x2e')]};});_0x148259[_0x8673('0x2f')]=_[_0x8673('0x30')](_['map'](_0x19bdb8,_0x8673('0x28')),[_0x8673('0x31')]);_0x148259[_0x8673('0x32')]=_['keys'](_0x48f6f7[_0x8673('0x32')]);_0x148259[_0x8673('0x33')]=_[_0x8673('0x34')](_0x148259['model'],_0x148259[_0x8673('0x32')]);_0x16f683[_0x8673('0x35')]=_['intersection'](_0x148259[_0x8673('0x2f')],qs['fields'](_0x48f6f7['query']['fields']));_0x16f683[_0x8673('0x35')]=_0x16f683[_0x8673('0x35')]['length']?_0x16f683[_0x8673('0x35')]:_0x148259[_0x8673('0x2f')];if(!_0x48f6f7[_0x8673('0x32')][_0x8673('0x36')](_0x8673('0x37'))){_0x16f683[_0x8673('0x23')]=qs[_0x8673('0x23')](_0x48f6f7['query']['limit']);_0x16f683[_0x8673('0x22')]=qs['offset'](_0x48f6f7['query']['offset']);}_0x16f683[_0x8673('0x38')]=qs[_0x8673('0x39')](_0x48f6f7[_0x8673('0x32')][_0x8673('0x39')]);_0x16f683['where']=qs[_0x8673('0x33')](_[_0x8673('0x3a')](_0x48f6f7['query'],_0x148259[_0x8673('0x33')]),_0x19bdb8);if(_0x48f6f7[_0x8673('0x32')][_0x8673('0x3b')]){_0x16f683[_0x8673('0x3c')]=_[_0x8673('0x3d')](_0x16f683[_0x8673('0x3c')],{'$or':_[_0x8673('0x3e')](_0x19bdb8,function(_0x2990cc){if(_0x2990cc[_0x8673('0x2d')]!=='VIRTUAL'){var _0x3ce096={};_0x3ce096[_0x2990cc['name']]={'$like':'%'+_0x48f6f7[_0x8673('0x32')][_0x8673('0x3b')]+'%'};return _0x3ce096;}})});}_0x16f683=_[_0x8673('0x3d')]({},_0x16f683,_0x48f6f7[_0x8673('0x3f')]);var _0x29892a={'where':_0x16f683[_0x8673('0x3c')]};return db[_0x8673('0x2a')][_0x8673('0x40')](_0x29892a)[_0x8673('0x26')](function(_0x571b11){_0x35d4ab['count']=_0x571b11;if(_0x48f6f7[_0x8673('0x32')][_0x8673('0x41')]){_0x16f683['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x8673('0x42')](_0x16f683);})[_0x8673('0x26')](function(_0x3087f7){_0x35d4ab[_0x8673('0x43')]=_0x3087f7;return _0x35d4ab;})[_0x8673('0x26')](respondWithFilteredResult(_0x3cb2f8,_0x16f683))[_0x8673('0x44')](handleError(_0x3cb2f8,null));};exports[_0x8673('0x45')]=function(_0x26c8f9,_0x3a8a25){var _0x5d5422={'raw':![],'where':{'id':_0x26c8f9[_0x8673('0x46')]['id']}},_0x4a63b5={};_0x4a63b5[_0x8673('0x2f')]=_['keys'](db[_0x8673('0x2a')][_0x8673('0x2b')]);_0x4a63b5[_0x8673('0x32')]=_[_0x8673('0x47')](_0x26c8f9[_0x8673('0x32')]);_0x4a63b5[_0x8673('0x33')]=_[_0x8673('0x34')](_0x4a63b5[_0x8673('0x2f')],_0x4a63b5[_0x8673('0x32')]);_0x5d5422['attributes']=_[_0x8673('0x34')](_0x4a63b5['model'],qs[_0x8673('0x48')](_0x26c8f9[_0x8673('0x32')][_0x8673('0x48')]));_0x5d5422[_0x8673('0x35')]=_0x5d5422[_0x8673('0x35')][_0x8673('0x49')]?_0x5d5422['attributes']:_0x4a63b5[_0x8673('0x2f')];if(_0x26c8f9['query'][_0x8673('0x41')]){_0x5d5422[_0x8673('0x4a')]=[{'all':!![]}];}_0x5d5422=_['merge']({},_0x5d5422,_0x26c8f9['options']);return db['VoiceRecording'][_0x8673('0x4b')](_0x5d5422)[_0x8673('0x26')](handleEntityNotFound(_0x3a8a25,null))['then'](respondWithResult(_0x3a8a25,null))['catch'](handleError(_0x3a8a25,null));};exports['create']=function(_0x5d1444,_0x3b3877){return db[_0x8673('0x2a')][_0x8673('0x4c')](_0x5d1444['body'],{})[_0x8673('0x26')](respondWithResult(_0x3b3877,0xc9))[_0x8673('0x44')](handleError(_0x3b3877,null));};exports[_0x8673('0x4d')]=function(_0x43816c,_0x551316){if(_0x43816c[_0x8673('0x4e')]['id']){delete _0x43816c[_0x8673('0x4e')]['id'];}return db[_0x8673('0x2a')]['find']({'where':{'id':_0x43816c[_0x8673('0x46')]['id']}})[_0x8673('0x26')](handleEntityNotFound(_0x551316,null))[_0x8673('0x26')](saveUpdates(_0x43816c['body'],null))['then'](respondWithResult(_0x551316,null))[_0x8673('0x44')](handleError(_0x551316,null));};exports['describe']=function(_0x1a8096,_0x3b699d){return db[_0x8673('0x2a')][_0x8673('0x4f')]()['then'](respondWithResult(_0x3b699d,null))[_0x8673('0x44')](handleError(_0x3b699d,null));};exports[_0x8673('0x50')]=function(_0xe656d4,_0x54771a,_0x4b4339){var _0x177145=require(_0x8673('0x51'));var _0x18315f=![];var _0xda836d={};if(_0xe656d4[_0x8673('0x32')][_0x8673('0x2d')]&&_0xe656d4['query']['type']===_0x8673('0x52')){_0xda836d[_0x8673('0x52')]=_0xe656d4[_0x8673('0x46')]['id'];}else{_0xda836d['id']=_0xe656d4[_0x8673('0x46')]['id'];}return db[_0x8673('0x2a')][_0x8673('0x4b')]({'where':_0xda836d,'attributes':['id',_0x8673('0x53')],'raw':!![]})[_0x8673('0x26')](handleEntityNotFound(_0x54771a,null))[_0x8673('0x26')](function(_0xb97a3b){if(_0xb97a3b){var _0x60cbf5=_0xb97a3b[_0x8673('0x53')];var _0x520f5e=util[_0x8673('0x31')](_0x8673('0x54'),_0x60cbf5);if(fs[_0x8673('0x55')](_0x520f5e)){_0x18315f=!![];return _0x177145[_0x8673('0x56')](_0x520f5e,_0x60cbf5,config['secrets'][_0x8673('0x57')])[_0x8673('0x26')](function(){return _0xb97a3b;});}return _0xb97a3b;}})[_0x8673('0x26')](function(_0x1efca8){if(_0x1efca8){var _0x606449=_0x1efca8[_0x8673('0x53')];if(!fs[_0x8673('0x55')](_0x606449)){throw new db[(_0x8673('0x58'))]['ValidationError'](_0x8673('0x59'));}if(_0x1efca8[_0x8673('0x5a')]){return _0x54771a[_0x8673('0x50')](_0x606449,_0x1efca8[_0x8673('0x5a')]+path[_0x8673('0x5b')](_0x606449),function(){if(_0x18315f){fs['unlink'](_0x606449);}});}else{return _0x54771a['download'](_0x606449,function(_0x5a7d0d){if(_0x18315f){fs[_0x8673('0x5c')](_0x606449);}});}}})[_0x8673('0x44')](function(_0x486462){if(_0x486462[_0x8673('0x5d')]===_0x8673('0x59')){_0x54771a['status'](0x194)[_0x8673('0x5e')](_0x8673('0x5f'));}else{return handleError(_0x54771a,null);}});};exports['downloads']=function(_0x1816da,_0x9610b6,_0x34763f){var _0x3a92ad=require(_0x8673('0x51'));var _0x2abebf=![];var _0x2a8cff={'$and':[db[_0x8673('0x60')][_0x8673('0x3c')](db[_0x8673('0x60')]['fn'](_0x8673('0x61'),db[_0x8673('0x60')][_0x8673('0x62')](_0x8673('0x52'))),_0x1816da[_0x8673('0x32')][_0x8673('0x63')])]};if(_0x1816da[_0x8673('0x32')]['type']&&_0x1816da[_0x8673('0x32')][_0x8673('0x2d')]===_0x8673('0x52')){_0x2a8cff[_0x8673('0x64')][_0x8673('0x65')]({'uniqueid':_0x1816da[_0x8673('0x46')]['id']});}else{_0x2a8cff[_0x8673('0x64')][_0x8673('0x65')]({'id':_0x1816da[_0x8673('0x46')]['id']});}return db[_0x8673('0x2a')]['find']({'where':_0x2a8cff,'attributes':['id',_0x8673('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x9610b6,null))[_0x8673('0x26')](function(_0x1f4388){if(_0x1f4388){var _0x173f90=util[_0x8673('0x31')](_0x8673('0x54'),_0x1f4388['value']);if(fs[_0x8673('0x55')](_0x173f90)){_0x2abebf=!![];return _0x3a92ad[_0x8673('0x56')](_0x173f90,_0x1f4388[_0x8673('0x53')],config['secrets'][_0x8673('0x57')])[_0x8673('0x26')](function(){return _0x1f4388;});}return _0x1f4388;}})[_0x8673('0x26')](function(_0x5cf333){if(_0x5cf333){if(!fs[_0x8673('0x55')](_0x5cf333[_0x8673('0x53')])){throw new db[(_0x8673('0x58'))][(_0x8673('0x66'))](_0x8673('0x59'));}if(_0x5cf333['filename']){return _0x9610b6[_0x8673('0x50')](_0x5cf333['value'],_0x5cf333[_0x8673('0x5a')]+path['extname'](_0x5cf333[_0x8673('0x53')]),function(){if(_0x2abebf){fs['unlink'](_0x5cf333[_0x8673('0x53')]);}});}else{return _0x9610b6[_0x8673('0x50')](_0x5cf333['value'],function(_0x1ac7ce){if(_0x2abebf){fs[_0x8673('0x5c')](_0x5cf333[_0x8673('0x53')]);}});}}})[_0x8673('0x44')](handleError(_0x9610b6,null));};exports[_0x8673('0x67')]=function(_0x3691ed,_0x268cac){return db[_0x8673('0x2a')][_0x8673('0x4b')]({'where':{'id':_0x3691ed[_0x8673('0x46')]['id']}})[_0x8673('0x26')](function(_0x733d88){if(!_0x733d88)throw new ReferenceError(_0x8673('0x68'));return _0x733d88;})[_0x8673('0x26')](function(_0x258f81){var _0x551b48=_0x258f81[_0x8673('0x53')];logger['info'](_0x8673('0x69'),_0x551b48);if(!_[_0x8673('0x6a')](_0x258f81[_0x8673('0x53')])&&fs[_0x8673('0x55')](_0x551b48)){logger[_0x8673('0x6b')](_0x8673('0x6c')+_0x551b48+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x551b48);}_0x551b48=_0x551b48+_0x8673('0x6d');if(!_[_0x8673('0x6a')](_0x258f81[_0x8673('0x53')])&&fs['existsSync'](_0x551b48)){logger['info'](_0x8673('0x6c')+_0x551b48+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8673('0x6e')](_0x551b48);}return _0x258f81;})['then'](function(_0x3ef115){if(!_0x3ef115)throw new InternalError();return _0x3ef115['destroy']();})[_0x8673('0x26')](function(){_0x268cac[_0x8673('0x1f')](0xcc)[_0x8673('0x20')]();})[_0x8673('0x44')](handleError(_0x268cac,null));};function getBucketslist(_0x3ce808,_0xd22f94,_0x49fb5b){return new Promise(function(_0x4fdfa7,_0x50783f){var _0x492ca9=new AWS['S3']({'accessKeyId':_0xd22f94,'secretAccessKey':_0x3ce808,'region':_0x49fb5b});_0x492ca9[_0x8673('0x6f')]({},function(_0x508d91,_0x9a7a9e){if(_0x508d91){return _0x50783f(_0x508d91);}else{return _0x4fdfa7(_0x9a7a9e);}});});}function createBucket(_0x524b64,_0x2def4c,_0x28dc3a,_0x167d8a){return new Promise(function(_0x40d55c,_0x463b2f){var _0x3d2007=new AWS['S3']({'accessKeyId':_0x2def4c,'secretAccessKey':_0x524b64,'region':_0x28dc3a});_0x3d2007[_0x8673('0x70')]({'Bucket':_0x167d8a},function(_0x58bbab,_0x4591db){if(_0x58bbab){return _0x463b2f(_0x58bbab);}else{return _0x40d55c(_0x4591db);}});});}function uploadFile(_0x771d32,_0x21f29a,_0x3c6911,_0x4a78fe,_0x4b0ecb,_0x49b890){return new Promise(function(_0x4c9688,_0x383872){var _0x4ff5bc=new AWS['S3']({'accessKeyId':_0x21f29a,'secretAccessKey':_0x771d32,'region':_0x3c6911});_0x4ff5bc[_0x8673('0x71')]({'Bucket':_0x4a78fe,'Key':_0x4b0ecb,'Body':_0x49b890},function(_0x3ee828,_0x4e704f){if(_0x3ee828){return _0x383872(_0x3ee828);}else{return _0x4c9688(_0x4e704f);}});});}function startTranscribe(_0xed03a7,_0x3fb32d,_0x3585ba,_0x50002b,_0x2a6325,_0x18f2b0){return new Promise(function(_0x333853,_0x1dd1e7){var _0x1bbdd6=new AWS[(_0x8673('0x72'))]({'accessKeyId':_0x3fb32d,'secretAccessKey':_0xed03a7,'region':_0x3585ba});_0x1bbdd6['startTranscriptionJob']({'TranscriptionJobName':_0x50002b,'LanguageCode':_0x2a6325,'Media':{'MediaFileUri':_0x18f2b0}},function(_0x2e5ded,_0x35b83a){if(_0x2e5ded){return _0x1dd1e7(_0x2e5ded);}else{return _0x333853(_0x35b83a);}});});}function transcribe(_0x5bdba7,_0x20fc6c,_0x18d922,_0x5ded21,_0x479aa4,_0x491bef,_0x123d72){return new Promise(function(_0x3b67b5,_0x4bf64e){var _0x273447={};logger[_0x8673('0x6b')](util['format'](_0x8673('0x73'),_0x5bdba7,_0x479aa4));return uploadFile(_0x20fc6c,_0x18d922,_0x5ded21,_0x479aa4,path[_0x8673('0x74')](_0x491bef),fs[_0x8673('0x75')](_0x491bef))['then'](function(_0x2181e4){logger['info'](util[_0x8673('0x31')](_0x8673('0x76'),_0x5bdba7,_0x479aa4,_0x2181e4['Location']));_0x273447[_0x8673('0x77')]=_0x2181e4['Bucket'];_0x273447[_0x8673('0x78')]=_0x2181e4[_0x8673('0x79')];logger[_0x8673('0x6b')](util[_0x8673('0x31')](_0x8673('0x7a'),_0x5bdba7));return startTranscribe(_0x20fc6c,_0x18d922,_0x5ded21,uuidv4(),_0x123d72,_0x2181e4[_0x8673('0x79')]);})[_0x8673('0x26')](function(_0x22fd66){logger[_0x8673('0x6b')](util[_0x8673('0x31')](_0x8673('0x7b'),_0x5bdba7,_0x22fd66['TranscriptionJob'][_0x8673('0x7c')]));_0x273447[_0x8673('0x7d')]=_0x22fd66[_0x8673('0x7e')][_0x8673('0x7c')];_0x273447[_0x8673('0x7f')]=_0x22fd66[_0x8673('0x7e')][_0x8673('0x80')];return _0x3b67b5(_0x273447);})[_0x8673('0x44')](function(_0x24bbb2){return _0x4bf64e(_0x24bbb2);});});}exports[_0x8673('0x81')]=function(_0x59b24c,_0x2ce04c,_0x79936c){var _0x357834;var _0x2d6ad3;var _0x17c6b8;var _0x5d7d47=require('../../components/encryptor');return db[_0x8673('0x2a')][_0x8673('0x82')]({'where':{'id':_0x59b24c[_0x8673('0x46')]['id']}})['then'](function(_0x35d3fa){if(_0x35d3fa){var _0x9be2a1=util[_0x8673('0x31')](_0x8673('0x54'),_0x35d3fa['value']);if(fs[_0x8673('0x55')](_0x9be2a1)){cypher=!![];return _0x5d7d47['decryptFile'](_0x9be2a1,_0x35d3fa[_0x8673('0x53')],config[_0x8673('0x83')][_0x8673('0x57')])[_0x8673('0x26')](function(){return _0x35d3fa;});}return _0x35d3fa;}})[_0x8673('0x26')](function(_0x3a591f){if(!_0x3a591f){throw new db['Sequelize']['ValidationError'](_0x8673('0x84'));}_0x2d6ad3=_0x3a591f;return db[_0x8673('0x85')][_0x8673('0x82')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x2ce04c,null))[_0x8673('0x26')](function(_0x2338f8){if(_0x2338f8){_0x357834=_0x2338f8;if(!_0x357834['transcribe']||!_0x357834[_0x8673('0x86')]||!_0x357834[_0x8673('0x87')]||!_0x357834[_0x8673('0x88')]||!_0x357834['bucket']){throw new db[(_0x8673('0x58'))][(_0x8673('0x66'))](_0x8673('0x89'));}if(_0x59b24c[_0x8673('0x4e')]['runSentiment']&&(!_0x357834[_0x8673('0x8a')]||!_0x357834[_0x8673('0x8b')]||!_0x357834[_0x8673('0x8c')]||!_0x357834[_0x8673('0x88')]||!_0x357834[_0x8673('0x77')])){throw new db[(_0x8673('0x58'))][(_0x8673('0x66'))](_0x8673('0x8d'));}return db[_0x8673('0x8e')][_0x8673('0x82')]({'where':{'id':_0x357834[_0x8673('0x86')]}});}})['then'](function(_0x4f02d7){if(!_0x4f02d7){throw new db[(_0x8673('0x58'))]['ValidationError'](_0x8673('0x8f'));}if(!_0x4f02d7['data1']||!_0x4f02d7[_0x8673('0x90')]){throw new db[(_0x8673('0x58'))]['ValidationError'](_0x8673('0x91'));}_0x17c6b8=_0x4f02d7;return getBucketslist(_0x17c6b8['data1'],_0x17c6b8['data2'],_0x357834[_0x8673('0x87')]);})[_0x8673('0x26')](function(_0x625ae6){if(_0x625ae6&&_0x625ae6[_0x8673('0x92')]){var _0x2c357c=_[_0x8673('0x4b')](_0x625ae6[_0x8673('0x92')],function(_0x39e7c7){return _0x39e7c7[_0x8673('0x93')]===_0x357834['bucket'];});if(!_0x2c357c){logger[_0x8673('0x6b')](util[_0x8673('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x59b24c['params']['id'],_0x357834[_0x8673('0x77')]));return createBucket(_0x17c6b8[_0x8673('0x94')],_0x17c6b8[_0x8673('0x90')],_0x357834[_0x8673('0x87')],_0x357834[_0x8673('0x77')]);}logger[_0x8673('0x6b')](util[_0x8673('0x31')](_0x8673('0x95'),_0x59b24c[_0x8673('0x46')]['id'],_0x357834[_0x8673('0x77')]));return;}})['then'](function(_0x18124c){if(_0x2d6ad3['transcribeStatus']===_0x8673('0x96')){return transcribe(_0x59b24c['params']['id'],_0x17c6b8[_0x8673('0x94')],_0x17c6b8[_0x8673('0x90')],_0x357834[_0x8673('0x87')],_0x357834[_0x8673('0x77')],_0x2d6ad3[_0x8673('0x53')],_0x357834[_0x8673('0x88')]);}else{logger[_0x8673('0x6b')](util['format'](_0x8673('0x97'),_0x59b24c[_0x8673('0x46')]['id']));return{'transcribeStatus':_0x8673('0x98')};}})[_0x8673('0x26')](function(_0x1a926d){if(_0x1a926d){_0x1a926d['tempSentiment']=_0x59b24c[_0x8673('0x4e')]['runSentiment'];return _0x2d6ad3['updateAttributes'](_0x1a926d);}})[_0x8673('0x26')](respondWithResult(_0x2ce04c,null))['catch'](handleError(_0x2ce04c,null));};function writeFile(_0x48520c,_0x48b7d7){return new Promise(function(_0x24ff5d,_0x35c922){fs[_0x8673('0x99')](_0x48b7d7,_0x48520c,function(_0x3057b0,_0x13f3f5){if(_0x3057b0){return _0x35c922(_0x3057b0);}else{return _0x24ff5d(_0x13f3f5);}});});}exports[_0x8673('0x9a')]=function(_0xd769fd,_0x33d72e,_0x1a2972){return db['VoiceRecording'][_0x8673('0x82')]({'where':{'id':_0xd769fd[_0x8673('0x46')]['id']}})[_0x8673('0x26')](handleEntityNotFound(_0x33d72e))[_0x8673('0x26')](function(_0x2fd9c4){if(_0x2fd9c4&&_0x2fd9c4[_0x8673('0x9b')]){var _0x2ba75f=_0x2fd9c4[_0x8673('0x9b')];var _0x5167d4=config[_0x8673('0x9c')]+_0x8673('0x9d')+_0x2fd9c4['id']+'.txt';if(fs['existsSync'](_0x5167d4)){return _0x5167d4;}return writeFile(_0x2ba75f,_0x5167d4)[_0x8673('0x26')](function(){return _0x5167d4;});}else{throw new db['Sequelize'][(_0x8673('0x66'))](_0x8673('0x9e'));}})['then'](function(_0xa5e3be){return _0x33d72e[_0x8673('0x50')](_0xa5e3be);})[_0x8673('0x44')](handleError(_0x33d72e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 23e464e..9d7fce6 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 _0xd9ef=['exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x16415c,_0x10d369){var _0x2f25d2=function(_0x4c8b46){while(--_0x4c8b46){_0x16415c['push'](_0x16415c['shift']());}};_0x2f25d2(++_0x10d369);}(_0xd9ef,0x95));var _0xfd9e=function(_0x5c7198,_0x198b54){_0x5c7198=_0x5c7198-0x0;var _0x530b11=_0xd9ef[_0x5c7198];return _0x530b11;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var logger=require('../../config/logger')(_0xfd9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd9e('0x3'));var rimraf=require(_0xfd9e('0x4'));var config=require(_0xfd9e('0x5'));var attributes=require(_0xfd9e('0x6'));module[_0xfd9e('0x7')]=function(_0x178ceb,_0x2d549f){return _0x178ceb[_0xfd9e('0x8')](_0xfd9e('0x9'),attributes,{'tableName':_0xfd9e('0xa'),'paranoid':![],'indexes':[{'name':_0xfd9e('0xb'),'fields':[_0xfd9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x078a=['rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x078a,0x12d));var _0xa078=function(_0x58cf00,_0x4ac400){_0x58cf00=_0x58cf00-0x0;var _0x36dfbe=_0x078a[_0x58cf00];return _0x36dfbe;};'use strict';var _=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var logger=require(_0xa078('0x2'))(_0xa078('0x3'));var moment=require(_0xa078('0x4'));var BPromise=require(_0xa078('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa078('0x6'));var rimraf=require(_0xa078('0x7'));var config=require(_0xa078('0x8'));var attributes=require('./voiceRecording.attributes');module[_0xa078('0x9')]=function(_0x4a65f2,_0x453616){return _0x4a65f2[_0xa078('0xa')](_0xa078('0xb'),attributes,{'tableName':_0xa078('0xc'),'paranoid':![],'indexes':[{'name':_0xa078('0xd'),'fields':[_0xa078('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e9ca326..d27cbe7 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(_0x247583,_0x1c9c28){var _0x4af33e=function(_0x38cd0b){while(--_0x38cd0b){_0x247583['push'](_0x247583['shift']());}};_0x4af33e(++_0x1c9c28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});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(_0x159f9b,_0x5b015c){var _0x5af408=function(_0x3d8a15){while(--_0x3d8a15){_0x159f9b['push'](_0x159f9b['shift']());}};_0x5af408(++_0x5b015c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index eacbd34..1b29861 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x5a3fd7,_0x5919da){var _0x572299=function(_0x21b6dd){while(--_0x21b6dd){_0x5a3fd7['push'](_0x5a3fd7['shift']());}};_0x572299(++_0x5919da);}(_0x2542,0x169));var _0x2254=function(_0x162f05,_0x328e0f){_0x162f05=_0x162f05-0x0;var _0x54f59a=_0x2542[_0x162f05];return _0x54f59a;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file +var _0x31f0=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x31f0,0xb7));var _0x031f=function(_0x297ffb,_0x1d8003){_0x297ffb=_0x297ffb-0x0;var _0x2a7ee2=_0x31f0[_0x297ffb];return _0x2a7ee2;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xc')]);router['put'](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index aa044d4..e49de9c 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 _0xe755=['sequelize','moment','exports','ENUM','blind','STRING','Yes'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xe755,0x70));var _0x5e75=function(_0x1ca5bf,_0x3eb983){_0x1ca5bf=_0x1ca5bf-0x0;var _0x37cb08=_0xe755[_0x1ca5bf];return _0x37cb08;};'use strict';var Sequelize=require(_0x5e75('0x0'));var moment=require(_0x5e75('0x1'));module[_0x5e75('0x2')]={'type':{'type':Sequelize[_0x5e75('0x3')](_0x5e75('0x4'),'attended')},'result':{'type':Sequelize[_0x5e75('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x5e75('0x5')]},'transferercalleridname':{'type':Sequelize[_0x5e75('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5e75('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x5e75('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5e75('0x5')]},'transferercontext':{'type':Sequelize[_0x5e75('0x5')]},'transfererexten':{'type':Sequelize[_0x5e75('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x5e75('0x5')]},'transfereechannel':{'type':Sequelize[_0x5e75('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5e75('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5e75('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5e75('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5e75('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5e75('0x5')]},'transfereecontext':{'type':Sequelize[_0x5e75('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x5e75('0x5')]},'isexternal':{'type':Sequelize[_0x5e75('0x3')](_0x5e75('0x6'),'No')},'context':{'type':Sequelize[_0x5e75('0x5')]},'extension':{'type':Sequelize[_0x5e75('0x5')]}}; \ No newline at end of file +var _0x9eaa=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9eaa,0x13c));var _0xa9ea=function(_0x1aa474,_0x536aec){_0x1aa474=_0x1aa474-0x0;var _0x4a1191=_0x9eaa[_0x1aa474];return _0x4a1191;};'use strict';var Sequelize=require(_0xa9ea('0x0'));var moment=require(_0xa9ea('0x1'));module[_0xa9ea('0x2')]={'type':{'type':Sequelize[_0xa9ea('0x3')](_0xa9ea('0x4'),_0xa9ea('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xa9ea('0x6')]},'transferercalleridname':{'type':Sequelize[_0xa9ea('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa9ea('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xa9ea('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xa9ea('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xa9ea('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xa9ea('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xa9ea('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa9ea('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xa9ea('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xa9ea('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xa9ea('0x6')]},'isexternal':{'type':Sequelize[_0xa9ea('0x3')](_0xa9ea('0x7'),'No')},'context':{'type':Sequelize[_0xa9ea('0x6')]},'extension':{'type':Sequelize[_0xa9ea('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4c9a618..aa92dec 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 _0x42a3=['options','count','include','VoiceTransferReport','findAll','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','end','error','stack','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge'];(function(_0x3da5ea,_0x284691){var _0x22ad25=function(_0xc1b419){while(--_0xc1b419){_0x3da5ea['push'](_0x3da5ea['shift']());}};_0x22ad25(++_0x284691);}(_0x42a3,0x1d6));var _0x342a=function(_0x1e0f17,_0x332b6c){_0x1e0f17=_0x1e0f17-0x0;var _0x40eb93=_0x42a3[_0x1e0f17];return _0x40eb93;};'use strict';var pdf=require(_0x342a('0x0'));var emlformat=require(_0x342a('0x1'));var rimraf=require(_0x342a('0x2'));var zipdir=require(_0x342a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x342a('0x4'));var moment=require(_0x342a('0x5'));var BPromise=require(_0x342a('0x6'));var Mustache=require(_0x342a('0x7'));var util=require('util');var path=require(_0x342a('0x8'));var sox=require(_0x342a('0x9'));var csv=require(_0x342a('0xa'));var ejs=require(_0x342a('0xb'));var fs=require('fs');var _=require(_0x342a('0xc'));var squel=require(_0x342a('0xd'));var crypto=require(_0x342a('0xe'));var jsforce=require(_0x342a('0xf'));var deskjs=require(_0x342a('0x10'));var toCsv=require(_0x342a('0xa'));var querystring=require(_0x342a('0x11'));var Papa=require(_0x342a('0x12'));var Redis=require(_0x342a('0x13'));var authService=require(_0x342a('0x14'));var qs=require(_0x342a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x342a('0x16'));var logger=require(_0x342a('0x17'))(_0x342a('0x18'));var utils=require(_0x342a('0x19'));var config=require(_0x342a('0x1a'));var db=require(_0x342a('0x1b'))['db'];function respondWithStatusCode(_0x165acd,_0x2081ea){_0x2081ea=_0x2081ea||0xcc;return function(_0x2283ed){if(_0x2283ed){return _0x165acd[_0x342a('0x1c')](_0x2081ea);}return _0x165acd[_0x342a('0x1d')](_0x2081ea)['end']();};}function respondWithResult(_0x5e2e8a,_0x5da8a5){_0x5da8a5=_0x5da8a5||0xc8;return function(_0xe3159a){if(_0xe3159a){return _0x5e2e8a[_0x342a('0x1d')](_0x5da8a5)[_0x342a('0x1e')](_0xe3159a);}};}function respondWithFilteredResult(_0x31d1fd,_0x2532d3){return function(_0x2e0462){if(_0x2e0462){var _0x35b6d2=_0x2e0462['count'],_0xd31a6e=_0x2532d3['offset'],_0x2bcfeb=_0x2532d3[_0x342a('0x1f')]+_0x2532d3[_0x342a('0x20')],_0x1dd617;if(_0x2bcfeb>=_0x35b6d2){_0x2bcfeb=_0x35b6d2;_0x1dd617=0xc8;}else{_0x1dd617=0xce;}_0x31d1fd[_0x342a('0x1d')](_0x1dd617);return _0x31d1fd[_0x342a('0x21')](_0x342a('0x22'),_0xd31a6e+'-'+_0x2bcfeb+'/'+_0x35b6d2)[_0x342a('0x1e')](_0x2e0462);}return null;};}function patchUpdates(_0x360ecb){return function(_0x5c505e){try{jsonpatch['apply'](_0x5c505e,_0x360ecb,!![]);}catch(_0x55b3b9){return BPromise[_0x342a('0x23')](_0x55b3b9);}return _0x5c505e[_0x342a('0x24')]();};}function saveUpdates(_0x248dd0,_0x1938c3){return function(_0x3a0847){if(_0x3a0847){return _0x3a0847['update'](_0x248dd0)[_0x342a('0x25')](function(_0x3492a7){return _0x3492a7;});}return null;};}function removeEntity(_0x56e25c,_0x2c5dd3){return function(_0x6f2bf0){if(_0x6f2bf0){return _0x6f2bf0['destroy']()[_0x342a('0x25')](function(){_0x56e25c[_0x342a('0x1d')](0xcc)[_0x342a('0x26')]();});}};}function handleEntityNotFound(_0x53e36a,_0x167acf){return function(_0x791957){if(!_0x791957){_0x53e36a[_0x342a('0x1c')](0x194);}return _0x791957;};}function handleError(_0x5b8f18,_0x337a82){_0x337a82=_0x337a82||0x1f4;return function(_0x2cae49){logger[_0x342a('0x27')](_0x2cae49[_0x342a('0x28')]);if(_0x2cae49[_0x342a('0x29')]){delete _0x2cae49[_0x342a('0x29')];}_0x5b8f18[_0x342a('0x1d')](_0x337a82)['send'](_0x2cae49);};}exports[_0x342a('0x2a')]=function(_0x29712a,_0x477402){var _0x522284={},_0x3beeda={},_0x5cdca6={'count':0x0,'rows':[]};var _0x32c00a=_['map'](db['VoiceTransferReport'][_0x342a('0x2b')],function(_0x36bbf4){return{'name':_0x36bbf4['fieldName'],'type':_0x36bbf4['type'][_0x342a('0x2c')]};});_0x3beeda[_0x342a('0x2d')]=_[_0x342a('0x2e')](_0x32c00a,'name');_0x3beeda[_0x342a('0x2f')]=_[_0x342a('0x30')](_0x29712a[_0x342a('0x2f')]);_0x3beeda[_0x342a('0x31')]=_[_0x342a('0x32')](_0x3beeda[_0x342a('0x2d')],_0x3beeda[_0x342a('0x2f')]);_0x522284[_0x342a('0x33')]=_[_0x342a('0x32')](_0x3beeda[_0x342a('0x2d')],qs['fields'](_0x29712a['query'][_0x342a('0x34')]));_0x522284[_0x342a('0x33')]=_0x522284['attributes'][_0x342a('0x35')]?_0x522284[_0x342a('0x33')]:_0x3beeda['model'];if(!_0x29712a[_0x342a('0x2f')][_0x342a('0x36')](_0x342a('0x37'))){_0x522284[_0x342a('0x20')]=qs[_0x342a('0x20')](_0x29712a[_0x342a('0x2f')][_0x342a('0x20')]);_0x522284['offset']=qs[_0x342a('0x1f')](_0x29712a[_0x342a('0x2f')][_0x342a('0x1f')]);}_0x522284[_0x342a('0x38')]=qs['sort'](_0x29712a[_0x342a('0x2f')][_0x342a('0x39')]);_0x522284[_0x342a('0x3a')]=qs[_0x342a('0x31')](_['pick'](_0x29712a[_0x342a('0x2f')],_0x3beeda[_0x342a('0x31')]),_0x32c00a);if(_0x29712a[_0x342a('0x2f')]['filter']){_0x522284[_0x342a('0x3a')]=_['merge'](_0x522284[_0x342a('0x3a')],{'$or':_[_0x342a('0x2e')](_0x32c00a,function(_0x2a2342){if(_0x2a2342['type']!==_0x342a('0x3b')){var _0x2cc8a4={};_0x2cc8a4[_0x2a2342[_0x342a('0x29')]]={'$like':'%'+_0x29712a[_0x342a('0x2f')][_0x342a('0x3c')]+'%'};return _0x2cc8a4;}})});}_0x522284=_[_0x342a('0x3d')]({},_0x522284,_0x29712a[_0x342a('0x3e')]);var _0x2f0d0e={'where':_0x522284[_0x342a('0x3a')]};return db['VoiceTransferReport'][_0x342a('0x3f')](_0x2f0d0e)['then'](function(_0x18ce7b){_0x5cdca6[_0x342a('0x3f')]=_0x18ce7b;if(_0x29712a[_0x342a('0x2f')]['includeAll']){_0x522284[_0x342a('0x40')]=[{'all':!![]}];}return db[_0x342a('0x41')][_0x342a('0x42')](_0x522284);})['then'](function(_0x43eab8){_0x5cdca6[_0x342a('0x43')]=_0x43eab8;return _0x5cdca6;})[_0x342a('0x25')](respondWithFilteredResult(_0x477402,_0x522284))[_0x342a('0x44')](handleError(_0x477402,null));};exports[_0x342a('0x45')]=function(_0x4bffd6,_0x46322a){var _0x123c91={'raw':!![],'where':{'id':_0x4bffd6[_0x342a('0x46')]['id']}},_0xf78174={};_0xf78174[_0x342a('0x2d')]=_[_0x342a('0x30')](db['VoiceTransferReport'][_0x342a('0x2b')]);_0xf78174[_0x342a('0x2f')]=_[_0x342a('0x30')](_0x4bffd6['query']);_0xf78174[_0x342a('0x31')]=_[_0x342a('0x32')](_0xf78174[_0x342a('0x2d')],_0xf78174[_0x342a('0x2f')]);_0x123c91[_0x342a('0x33')]=_[_0x342a('0x32')](_0xf78174[_0x342a('0x2d')],qs['fields'](_0x4bffd6['query'][_0x342a('0x34')]));_0x123c91[_0x342a('0x33')]=_0x123c91['attributes'][_0x342a('0x35')]?_0x123c91['attributes']:_0xf78174[_0x342a('0x2d')];if(_0x4bffd6['query'][_0x342a('0x47')]){_0x123c91['include']=[{'all':!![]}];}_0x123c91=_[_0x342a('0x3d')]({},_0x123c91,_0x4bffd6[_0x342a('0x3e')]);return db[_0x342a('0x41')][_0x342a('0x48')](_0x123c91)['then'](handleEntityNotFound(_0x46322a,null))[_0x342a('0x25')](respondWithResult(_0x46322a,null))[_0x342a('0x44')](handleError(_0x46322a,null));};exports[_0x342a('0x49')]=function(_0x18f813,_0x20c237){return db[_0x342a('0x41')][_0x342a('0x49')](_0x18f813[_0x342a('0x4a')],{})[_0x342a('0x25')](respondWithResult(_0x20c237,0xc9))[_0x342a('0x44')](handleError(_0x20c237,null));};exports[_0x342a('0x4b')]=function(_0x240a6d,_0x54e3b0){if(_0x240a6d[_0x342a('0x4a')]['id']){delete _0x240a6d[_0x342a('0x4a')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x240a6d['params']['id']}})[_0x342a('0x25')](handleEntityNotFound(_0x54e3b0,null))[_0x342a('0x25')](saveUpdates(_0x240a6d[_0x342a('0x4a')],null))[_0x342a('0x25')](respondWithResult(_0x54e3b0,null))[_0x342a('0x44')](handleError(_0x54e3b0,null));};exports['destroy']=function(_0x375965,_0x3839b2){return db[_0x342a('0x41')][_0x342a('0x48')]({'where':{'id':_0x375965[_0x342a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3839b2,null))[_0x342a('0x25')](removeEntity(_0x3839b2,null))[_0x342a('0x44')](handleError(_0x3839b2,null));}; \ No newline at end of file +var _0x8b02=['mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','options','where','VoiceTransferReport','includeAll','include','findAll','rows','show','params','length','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8b02,0x89));var _0x28b0=function(_0x4efe04,_0x2dbc26){_0x4efe04=_0x4efe04-0x0;var _0x1004b2=_0x8b02[_0x4efe04];return _0x1004b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28b0('0x0'));var rimraf=require(_0x28b0('0x1'));var zipdir=require(_0x28b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b0('0x3'));var moment=require(_0x28b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28b0('0x5'));var util=require(_0x28b0('0x6'));var path=require('path');var sox=require(_0x28b0('0x7'));var csv=require('to-csv');var ejs=require(_0x28b0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28b0('0x9'));var crypto=require(_0x28b0('0xa'));var jsforce=require(_0x28b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28b0('0xc'));var querystring=require('querystring');var Papa=require(_0x28b0('0xd'));var Redis=require(_0x28b0('0xe'));var authService=require(_0x28b0('0xf'));var qs=require(_0x28b0('0x10'));var as=require(_0x28b0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x28b0('0x12'));var utils=require(_0x28b0('0x13'));var config=require('../../config/environment');var db=require(_0x28b0('0x14'))['db'];function respondWithStatusCode(_0x5380b6,_0x21c51b){_0x21c51b=_0x21c51b||0xcc;return function(_0x41289f){if(_0x41289f){return _0x5380b6['sendStatus'](_0x21c51b);}return _0x5380b6[_0x28b0('0x15')](_0x21c51b)[_0x28b0('0x16')]();};}function respondWithResult(_0x5c4772,_0x390484){_0x390484=_0x390484||0xc8;return function(_0x25f6cf){if(_0x25f6cf){return _0x5c4772[_0x28b0('0x15')](_0x390484)['json'](_0x25f6cf);}};}function respondWithFilteredResult(_0x13875d,_0x53c785){return function(_0x5a4247){if(_0x5a4247){var _0x1086c5=_0x5a4247[_0x28b0('0x17')],_0x2d19fa=_0x53c785[_0x28b0('0x18')],_0x22ce6e=_0x53c785[_0x28b0('0x18')]+_0x53c785[_0x28b0('0x19')],_0x814158;if(_0x22ce6e>=_0x1086c5){_0x22ce6e=_0x1086c5;_0x814158=0xc8;}else{_0x814158=0xce;}_0x13875d['status'](_0x814158);return _0x13875d[_0x28b0('0x1a')](_0x28b0('0x1b'),_0x2d19fa+'-'+_0x22ce6e+'/'+_0x1086c5)[_0x28b0('0x1c')](_0x5a4247);}return null;};}function patchUpdates(_0x17f0b4){return function(_0x35f718){try{jsonpatch[_0x28b0('0x1d')](_0x35f718,_0x17f0b4,!![]);}catch(_0x6564b2){return BPromise[_0x28b0('0x1e')](_0x6564b2);}return _0x35f718[_0x28b0('0x1f')]();};}function saveUpdates(_0xf21bc1,_0x263fc4){return function(_0x4b8e04){if(_0x4b8e04){return _0x4b8e04[_0x28b0('0x20')](_0xf21bc1)['then'](function(_0x1fea7c){return _0x1fea7c;});}return null;};}function removeEntity(_0x419885,_0x2b2d5f){return function(_0x155824){if(_0x155824){return _0x155824[_0x28b0('0x21')]()[_0x28b0('0x22')](function(){_0x419885[_0x28b0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24050c,_0x5b805a){return function(_0x187e8c){if(!_0x187e8c){_0x24050c[_0x28b0('0x23')](0x194);}return _0x187e8c;};}function handleError(_0x194c79,_0x23457d){_0x23457d=_0x23457d||0x1f4;return function(_0x199ef5){logger[_0x28b0('0x24')](_0x199ef5['stack']);if(_0x199ef5[_0x28b0('0x25')]){delete _0x199ef5[_0x28b0('0x25')];}_0x194c79[_0x28b0('0x15')](_0x23457d)[_0x28b0('0x26')](_0x199ef5);};}exports[_0x28b0('0x27')]=function(_0x1d5c64,_0x44f378){var _0x44a295={},_0x538d4f={},_0x212d3a={'count':0x0,'rows':[]};var _0x5d4f45=_[_0x28b0('0x28')](db['VoiceTransferReport'][_0x28b0('0x29')],function(_0x3f207e){return{'name':_0x3f207e[_0x28b0('0x2a')],'type':_0x3f207e[_0x28b0('0x2b')]['key']};});_0x538d4f[_0x28b0('0x2c')]=_['map'](_0x5d4f45,_0x28b0('0x25'));_0x538d4f[_0x28b0('0x2d')]=_[_0x28b0('0x2e')](_0x1d5c64['query']);_0x538d4f[_0x28b0('0x2f')]=_['intersection'](_0x538d4f[_0x28b0('0x2c')],_0x538d4f['query']);_0x44a295[_0x28b0('0x30')]=_[_0x28b0('0x31')](_0x538d4f[_0x28b0('0x2c')],qs[_0x28b0('0x32')](_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x32')]));_0x44a295[_0x28b0('0x30')]=_0x44a295[_0x28b0('0x30')]['length']?_0x44a295[_0x28b0('0x30')]:_0x538d4f[_0x28b0('0x2c')];if(!_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x33')](_0x28b0('0x34'))){_0x44a295['limit']=qs['limit'](_0x1d5c64['query']['limit']);_0x44a295['offset']=qs[_0x28b0('0x18')](_0x1d5c64[_0x28b0('0x2d')]['offset']);}_0x44a295['order']=qs[_0x28b0('0x35')](_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x35')]);_0x44a295['where']=qs['filters'](_[_0x28b0('0x36')](_0x1d5c64[_0x28b0('0x2d')],_0x538d4f[_0x28b0('0x2f')]),_0x5d4f45);if(_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x37')]){_0x44a295['where']=_[_0x28b0('0x38')](_0x44a295['where'],{'$or':_[_0x28b0('0x28')](_0x5d4f45,function(_0x1f25c9){if(_0x1f25c9['type']!=='VIRTUAL'){var _0x344a21={};_0x344a21[_0x1f25c9['name']]={'$like':'%'+_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x37')]+'%'};return _0x344a21;}})});}_0x44a295=_[_0x28b0('0x38')]({},_0x44a295,_0x1d5c64[_0x28b0('0x39')]);var _0x1e97af={'where':_0x44a295[_0x28b0('0x3a')]};return db[_0x28b0('0x3b')]['count'](_0x1e97af)[_0x28b0('0x22')](function(_0x7a41e1){_0x212d3a[_0x28b0('0x17')]=_0x7a41e1;if(_0x1d5c64[_0x28b0('0x2d')][_0x28b0('0x3c')]){_0x44a295[_0x28b0('0x3d')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x28b0('0x3e')](_0x44a295);})[_0x28b0('0x22')](function(_0xf9bff7){_0x212d3a[_0x28b0('0x3f')]=_0xf9bff7;return _0x212d3a;})[_0x28b0('0x22')](respondWithFilteredResult(_0x44f378,_0x44a295))['catch'](handleError(_0x44f378,null));};exports[_0x28b0('0x40')]=function(_0x5d400b,_0x2bf1c5){var _0x10b58f={'raw':!![],'where':{'id':_0x5d400b[_0x28b0('0x41')]['id']}},_0x143d29={};_0x143d29[_0x28b0('0x2c')]=_['keys'](db['VoiceTransferReport'][_0x28b0('0x29')]);_0x143d29[_0x28b0('0x2d')]=_[_0x28b0('0x2e')](_0x5d400b['query']);_0x143d29['filters']=_['intersection'](_0x143d29['model'],_0x143d29[_0x28b0('0x2d')]);_0x10b58f[_0x28b0('0x30')]=_[_0x28b0('0x31')](_0x143d29[_0x28b0('0x2c')],qs[_0x28b0('0x32')](_0x5d400b[_0x28b0('0x2d')][_0x28b0('0x32')]));_0x10b58f[_0x28b0('0x30')]=_0x10b58f[_0x28b0('0x30')][_0x28b0('0x42')]?_0x10b58f['attributes']:_0x143d29[_0x28b0('0x2c')];if(_0x5d400b['query'][_0x28b0('0x3c')]){_0x10b58f[_0x28b0('0x3d')]=[{'all':!![]}];}_0x10b58f=_[_0x28b0('0x38')]({},_0x10b58f,_0x5d400b[_0x28b0('0x39')]);return db[_0x28b0('0x3b')]['find'](_0x10b58f)[_0x28b0('0x22')](handleEntityNotFound(_0x2bf1c5,null))[_0x28b0('0x22')](respondWithResult(_0x2bf1c5,null))['catch'](handleError(_0x2bf1c5,null));};exports[_0x28b0('0x43')]=function(_0x170bae,_0x675495){return db[_0x28b0('0x3b')]['create'](_0x170bae[_0x28b0('0x44')],{})[_0x28b0('0x22')](respondWithResult(_0x675495,0xc9))[_0x28b0('0x45')](handleError(_0x675495,null));};exports[_0x28b0('0x20')]=function(_0xc2d793,_0x4bfc5b){if(_0xc2d793[_0x28b0('0x44')]['id']){delete _0xc2d793[_0x28b0('0x44')]['id'];}return db['VoiceTransferReport'][_0x28b0('0x46')]({'where':{'id':_0xc2d793[_0x28b0('0x41')]['id']}})[_0x28b0('0x22')](handleEntityNotFound(_0x4bfc5b,null))[_0x28b0('0x22')](saveUpdates(_0xc2d793[_0x28b0('0x44')],null))[_0x28b0('0x22')](respondWithResult(_0x4bfc5b,null))['catch'](handleError(_0x4bfc5b,null));};exports['destroy']=function(_0xf068aa,_0x2df73f){return db['VoiceTransferReport'][_0x28b0('0x46')]({'where':{'id':_0xf068aa[_0x28b0('0x41')]['id']}})[_0x28b0('0x22')](handleEntityNotFound(_0x2df73f,null))['then'](removeEntity(_0x2df73f,null))[_0x28b0('0x45')](handleError(_0x2df73f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d0b94ba..6eb7032 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 _0xe439=['rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe439,0x1da));var _0x9e43=function(_0x5073c7,_0x49ed94){_0x5073c7=_0x5073c7-0x0;var _0x41093a=_0xe439[_0x5073c7];return _0x41093a;};'use strict';var _=require(_0x9e43('0x0'));var util=require(_0x9e43('0x1'));var logger=require(_0x9e43('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e43('0x3'));var rp=require(_0x9e43('0x4'));var fs=require('fs');var path=require(_0x9e43('0x5'));var rimraf=require(_0x9e43('0x6'));var config=require('../../config/environment');var attributes=require(_0x9e43('0x7'));module[_0x9e43('0x8')]=function(_0x2e940d,_0x13a2da){return _0x2e940d[_0x9e43('0x9')](_0x9e43('0xa'),attributes,{'tableName':_0x9e43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5420=['util','api','moment','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','lodash'];(function(_0x56aa78,_0x1bc1dc){var _0x49bc2d=function(_0x11ab5b){while(--_0x11ab5b){_0x56aa78['push'](_0x56aa78['shift']());}};_0x49bc2d(++_0x1bc1dc);}(_0x5420,0x121));var _0x0542=function(_0x107a2a,_0x10f962){_0x107a2a=_0x107a2a-0x0;var _0xd2732a=_0x5420[_0x107a2a];return _0xd2732a;};'use strict';var _=require(_0x0542('0x0'));var util=require(_0x0542('0x1'));var logger=require('../../config/logger')(_0x0542('0x2'));var moment=require(_0x0542('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0542('0x4'));var rimraf=require(_0x0542('0x5'));var config=require(_0x0542('0x6'));var attributes=require(_0x0542('0x7'));module['exports']=function(_0x24b416,_0xb30d00){return _0x24b416[_0x0542('0x8')](_0x0542('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index bcbe0ea..f28cdd4 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 _0xd35f=['VoiceTransferReport','create','options','raw','catch','lodash','util','bluebird','randomstring','../../mysqldb','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport'];(function(_0x2cd71d,_0xb13927){var _0x4c98b1=function(_0x3f01e9){while(--_0x3f01e9){_0x2cd71d['push'](_0x2cd71d['shift']());}};_0x4c98b1(++_0xb13927);}(_0xd35f,0x82));var _0xfd35=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0xd35f[_0x1190c2];return _0x6ec988;};'use strict';var _=require(_0xfd35('0x0'));var util=require(_0xfd35('0x1'));var moment=require('moment');var BPromise=require(_0xfd35('0x2'));var rs=require(_0xfd35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd35('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd35('0x5')][_0xfd35('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402b8d,_0x4a80eb,_0x40e9f2){return new BPromise(function(_0x385c0f,_0x325797){return client[_0xfd35('0x7')](_0x402b8d,_0x40e9f2)[_0xfd35('0x8')](function(_0x365114){logger[_0xfd35('0x9')](_0xfd35('0xa'),_0x4a80eb,_0xfd35('0xb'));logger[_0xfd35('0xc')](_0xfd35('0xd'),_0x4a80eb,_0xfd35('0xb'),JSON[_0xfd35('0xe')](_0x365114));if(_0x365114[_0xfd35('0xf')]){if(_0x365114[_0xfd35('0xf')][_0xfd35('0x10')]===0x1f4){logger[_0xfd35('0xf')](_0xfd35('0xa'),_0x4a80eb,_0x365114[_0xfd35('0xf')][_0xfd35('0x11')]);return _0x325797(_0x365114['error'][_0xfd35('0x11')]);}logger[_0xfd35('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x4a80eb,_0x365114[_0xfd35('0xf')]['message']);return _0x385c0f(_0x365114['error'][_0xfd35('0x11')]);}else{logger[_0xfd35('0x9')](_0xfd35('0xa'),_0x4a80eb,'request\x20sent');_0x385c0f(_0x365114[_0xfd35('0x12')][_0xfd35('0x11')]);}})['catch'](function(_0x4f5d60){logger[_0xfd35('0xf')](_0xfd35('0xa'),_0x4a80eb,_0x4f5d60);_0x325797(_0x4f5d60);});});}exports[_0xfd35('0x13')]=function(_0xdcd29c){var _0x18b2f0=this;return new Promise(function(_0x1b55f9,_0x487a15){return db[_0xfd35('0x14')][_0xfd35('0x15')](_0xdcd29c['body'],{'raw':_0xdcd29c[_0xfd35('0x16')]?_0xdcd29c[_0xfd35('0x16')][_0xfd35('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x29ad98){logger['info'](_0xfd35('0x13'),_0xdcd29c);logger[_0xfd35('0xc')]('CreateVoiceTransferReport',_0xdcd29c,JSON['stringify'](_0x29ad98));_0x1b55f9(_0x29ad98);})[_0xfd35('0x18')](function(_0x1123f7){logger[_0xfd35('0xf')](_0xfd35('0x13'),_0x1123f7[_0xfd35('0x11')],_0xdcd29c);_0x487a15(_0x18b2f0[_0xfd35('0xf')](0x1f4,_0x1123f7[_0xfd35('0x11')]));});});}; \ No newline at end of file +var _0xfbd7=['error','code','message','CreateVoiceTransferReport','VoiceTransferReport','create','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e1f53,_0xa76472){var _0x2bfbd6=function(_0x461e63){while(--_0x461e63){_0x2e1f53['push'](_0x2e1f53['shift']());}};_0x2bfbd6(++_0xa76472);}(_0xfbd7,0x1cc));var _0x7fbd=function(_0x520236,_0x5c8564){_0x520236=_0x520236-0x0;var _0x4d6664=_0xfbd7[_0x520236];return _0x4d6664;};'use strict';var _=require(_0x7fbd('0x0'));var util=require(_0x7fbd('0x1'));var moment=require(_0x7fbd('0x2'));var BPromise=require(_0x7fbd('0x3'));var rs=require(_0x7fbd('0x4'));var fs=require('fs');var Redis=require(_0x7fbd('0x5'));var db=require(_0x7fbd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7fbd('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fbd('0x8'));var client=jayson['client'][_0x7fbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404588,_0x3c8317,_0x423e73){return new BPromise(function(_0x2d1d02,_0x2b3b58){return client['request'](_0x404588,_0x423e73)['then'](function(_0x314c1a){logger[_0x7fbd('0xa')](_0x7fbd('0xb'),_0x3c8317,_0x7fbd('0xc'));logger['debug'](_0x7fbd('0xd'),_0x3c8317,_0x7fbd('0xc'),JSON[_0x7fbd('0xe')](_0x314c1a));if(_0x314c1a['error']){if(_0x314c1a[_0x7fbd('0xf')][_0x7fbd('0x10')]===0x1f4){logger[_0x7fbd('0xf')](_0x7fbd('0xb'),_0x3c8317,_0x314c1a[_0x7fbd('0xf')][_0x7fbd('0x11')]);return _0x2b3b58(_0x314c1a[_0x7fbd('0xf')]['message']);}logger['error'](_0x7fbd('0xb'),_0x3c8317,_0x314c1a[_0x7fbd('0xf')]['message']);return _0x2d1d02(_0x314c1a[_0x7fbd('0xf')][_0x7fbd('0x11')]);}else{logger[_0x7fbd('0xa')](_0x7fbd('0xb'),_0x3c8317,_0x7fbd('0xc'));_0x2d1d02(_0x314c1a['result'][_0x7fbd('0x11')]);}})['catch'](function(_0x200a73){logger[_0x7fbd('0xf')](_0x7fbd('0xb'),_0x3c8317,_0x200a73);_0x2b3b58(_0x200a73);});});}exports[_0x7fbd('0x12')]=function(_0x58281f){var _0x265ebc=this;return new Promise(function(_0x3aee61,_0x5ece44){return db[_0x7fbd('0x13')][_0x7fbd('0x14')](_0x58281f['body'],{'raw':_0x58281f['options']?_0x58281f['options'][_0x7fbd('0x15')]===undefined?!![]:![]:!![]})[_0x7fbd('0x16')](function(_0x2b15f6){logger[_0x7fbd('0xa')]('CreateVoiceTransferReport',_0x58281f);logger[_0x7fbd('0x17')](_0x7fbd('0x12'),_0x58281f,JSON['stringify'](_0x2b15f6));_0x3aee61(_0x2b15f6);})[_0x7fbd('0x18')](function(_0x2489df){logger[_0x7fbd('0xf')](_0x7fbd('0x12'),_0x2489df['message'],_0x58281f);_0x5ece44(_0x265ebc['error'](0x1f4,_0x2489df[_0x7fbd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 2eda151..bbf6b2c 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 _0xac7f=['/hold','hold','unhold','/calls','calls','/transfer','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer'];(function(_0x2c8fe3,_0x9f0818){var _0x2fc448=function(_0xadb375){while(--_0xadb375){_0x2c8fe3['push'](_0x2c8fe3['shift']());}};_0x2fc448(++_0x9f0818);}(_0xac7f,0x1e2));var _0xfac7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xac7f[_0x36eaaa];return _0x461349;};'use strict';var express=require(_0xfac7('0x0'));var router=express['Router']();var auth=require(_0xfac7('0x1'));var controller=require(_0xfac7('0x2'));router[_0xfac7('0x3')]('/originate',auth[_0xfac7('0x4')](),auth[_0xfac7('0x5')](),controller[_0xfac7('0x6')]);router[_0xfac7('0x3')](_0xfac7('0x7'),auth[_0xfac7('0x4')](),auth['canUpdate'](),controller[_0xfac7('0x8')]);router['post'](_0xfac7('0x9'),auth[_0xfac7('0x4')](),auth['canUpdate'](),controller[_0xfac7('0xa')]);router[_0xfac7('0x3')](_0xfac7('0xb'),auth['isAuthenticated'](),auth[_0xfac7('0x5')](),controller[_0xfac7('0xc')]);router['post']('/unhold',auth[_0xfac7('0x4')](),auth[_0xfac7('0x5')](),controller[_0xfac7('0xd')]);router[_0xfac7('0x3')](_0xfac7('0xe'),auth['isAuthenticated'](),auth[_0xfac7('0x5')](),controller[_0xfac7('0xf')]);router[_0xfac7('0x3')](_0xfac7('0x10'),auth[_0xfac7('0x4')](),auth[_0xfac7('0x5')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x295f=['../../components/auth/service','./webbar.controller','/originate','isAuthenticated','post','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','calls','/transfer','transfer','exports','Router'];(function(_0x30537e,_0x458a27){var _0x12423b=function(_0x2e0a69){while(--_0x2e0a69){_0x30537e['push'](_0x30537e['shift']());}};_0x12423b(++_0x458a27);}(_0x295f,0x168));var _0xf295=function(_0x59b059,_0x1526ea){_0x59b059=_0x59b059-0x0;var _0x5c5028=_0x295f[_0x59b059];return _0x5c5028;};'use strict';var express=require('express');var router=express[_0xf295('0x0')]();var auth=require(_0xf295('0x1'));var controller=require(_0xf295('0x2'));router['post'](_0xf295('0x3'),auth[_0xf295('0x4')](),auth['canUpdate'](),controller['originate']);router[_0xf295('0x5')](_0xf295('0x6'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0x8')]);router['post'](_0xf295('0x9'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0xa')]);router[_0xf295('0x5')](_0xf295('0xb'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0xc')]);router[_0xf295('0x5')](_0xf295('0xd'),auth[_0xf295('0x4')](),auth['canUpdate'](),controller[_0xf295('0xe')]);router[_0xf295('0x5')]('/calls',auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0xf')]);router[_0xf295('0x5')](_0xf295('0x10'),auth[_0xf295('0x4')](),auth[_0xf295('0x7')](),controller[_0xf295('0x11')]);module[_0xf295('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4642935..e6c0927 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 _0x4536=['lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','request','then','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','user:%s','answer','answer\x20fired:','length','userId','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','entityFound:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path'];(function(_0x3cb615,_0x26d81a){var _0x365c24=function(_0x351434){while(--_0x351434){_0x3cb615['push'](_0x3cb615['shift']());}};_0x365c24(++_0x26d81a);}(_0x4536,0xe9));var _0x6453=function(_0x2fac1e,_0x5a3a9d){_0x2fac1e=_0x2fac1e-0x0;var _0x432c6b=_0x4536[_0x2fac1e];return _0x432c6b;};'use strict';var path=require(_0x6453('0x0'));var fs=require('fs');var _=require(_0x6453('0x1'));var db=require(_0x6453('0x2'))['db'];var config=require(_0x6453('0x3'));var util=require('util');var BPromise=require(_0x6453('0x4'));var jayson=require(_0x6453('0x5'));var amiClient=jayson['client'][_0x6453('0x6')]({'port':0x232a});var logger=require(_0x6453('0x7'))(_0x6453('0x8'));var Redis=require('ioredis');config[_0x6453('0x9')]=_[_0x6453('0xa')](config['redis'],{'host':_0x6453('0xb'),'port':0x18eb});var io=require(_0x6453('0xc'))(new Redis(config['redis']));var Schema=require(_0x6453('0xd'));var originateValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'callNumber':{'type':_0x6453('0x10'),'required':[!![],_0x6453('0x11')]},'callerId':{'type':_0x6453('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6453('0xf')]},'sessionId':{'type':_0x6453('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'sessionId':{'type':_0x6453('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x6453('0x10'),'required':[!![],_0x6453('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]},'sessionId':{'type':_0x6453('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6453('0xe'),'required':[!![],_0x6453('0xf')]}});function emit(_0x3e7c5e,_0x405a42,_0x2c4383){logger[_0x6453('0x13')](_0x3e7c5e,_0x405a42,JSON[_0x6453('0x14')](_0x2c4383));io['to'](_0x3e7c5e)['emit'](_0x405a42,_0x2c4383);}function handleError(_0x334128){return function(_0x446707){console[_0x6453('0x15')](_0x6453('0x16'),_0x446707,_0x446707 instanceof RangeError);logger[_0x6453('0x17')](_0x446707[_0x6453('0x18')]);if(_0x446707 instanceof RangeError){if(_0x446707[_0x6453('0x19')]){delete _0x446707['name'];}_0x334128[_0x6453('0x1a')](0x194)[_0x6453('0x1b')](_0x446707);}else{if(_0x446707[_0x6453('0x19')]){delete _0x446707[_0x6453('0x19')];}_0x334128[_0x6453('0x1a')](0x1f4)['send'](_0x446707);}};}function checkError(){return function(_0x30f201){if(!_0x30f201){throw new RangeError('NotFound');}return _0x30f201;};}function respondWithRpcPromise(_0x1f9ae4,_0x411240){return new BPromise(function(_0x3c80f4,_0x2a82d9){var _0x28d953=amiClient;return _0x28d953[_0x6453('0x1c')](_0x1f9ae4,_0x411240)[_0x6453('0x1d')](function(_0x3fa66d){if(_0x3fa66d[_0x6453('0x17')]){if(_0x3fa66d[_0x6453('0x17')][_0x6453('0x1e')]===0x1f4){return _0x2a82d9(_0x3fa66d[_0x6453('0x17')][_0x6453('0x1f')]);}return _0x3c80f4(_0x3fa66d[_0x6453('0x17')]['message']);}else{_0x3c80f4(_0x3fa66d[_0x6453('0x20')]);}})[_0x6453('0x21')](function(_0x408783){_0x2a82d9(_0x408783);});});}function getAgent(_0x3a2a31){return db['User'][_0x6453('0x22')]({'where':{'id':_0x3a2a31,'role':_0x6453('0x23')}})[_0x6453('0x1d')](checkError());}function getAgentCheckSession(_0x557e90,_0x1fde34){return new BPromise(function(_0x380d8e,_0x8e5c88){var _0x390ecc=respondWithRpcPromise(_0x6453('0x24'));var _0x4ae0da=getAgent(_0x557e90);Promise[_0x6453('0x25')]([_0x390ecc,_0x4ae0da])[_0x6453('0x1d')](function(_0x1b5750){var _0xa39cd5=_0x1b5750[0x0];var _0x5f2140=_0x1b5750[0x1];var _0x2f0c09=_[_0x6453('0x26')](_0xa39cd5[_0x6453('0x27')],function(_0x21726d){return _0x21726d[_0x6453('0x28')]==_0x5f2140['id']&&_0x21726d[_0x6453('0x29')]==_0x1fde34;});if(_0x2f0c09['length']==0x1){_0x380d8e(_0x5f2140);}else{_0x8e5c88(new RangeError('sessionId\x20'+_0x1fde34+_0x6453('0x2a')));}});});}exports[_0x6453('0x2b')]=function(_0x32dd73,_0x9a1363){logger[_0x6453('0x13')](_0x6453('0x2c'),_0x32dd73[_0x6453('0x2d')]);var _0x143cf3=originateValidation[_0x6453('0xd')](_0x32dd73['body']);if(_0x143cf3['length']>0x0){return _0x9a1363[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x143cf3);}var _0x2a6dd2=_0x32dd73[_0x6453('0x2d')]['userId'];var _0x270f48=_0x32dd73['body'][_0x6453('0x2f')];var _0x47e6b4=_0x32dd73['body'][_0x6453('0x30')];var _0x39695b=_0x32dd73[_0x6453('0x2d')][_0x6453('0x31')];return getAgent(_0x2a6dd2)[_0x6453('0x1d')](function(_0x3a0369){logger['info']('entityFound:',_0x3a0369[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x3a0369[_0x6453('0x19')]),_0x6453('0x33'),{'callNumber':_0x270f48,'callerId':_0x47e6b4,'callbackUrl':_0x39695b});return _0x9a1363['status'](0xc8)['json']({'error':![],'message':_0x6453('0x34')});})[_0x6453('0x21')](handleError(_0x9a1363));};exports[_0x6453('0x35')]=function(_0x7f0f4b,_0x2081b3){logger[_0x6453('0x13')](_0x6453('0x36'),_0x7f0f4b[_0x6453('0x2d')]);var _0x43bb89=hangupValidation[_0x6453('0xd')](_0x7f0f4b['body']);if(_0x43bb89['length']>0x0){return _0x2081b3[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x43bb89);}var _0x85af05=_0x7f0f4b[_0x6453('0x2d')]['userId'];var _0x16aa58=_0x7f0f4b[_0x6453('0x2d')][_0x6453('0x29')];return getAgent(_0x85af05)['then'](function(_0x311bf0){logger[_0x6453('0x13')]('entityFound:',_0x311bf0[_0x6453('0x19')]);emit(util[_0x6453('0x32')](_0x6453('0x37'),_0x311bf0[_0x6453('0x19')]),'webbar:hangup',{'sessionId':_0x16aa58});return _0x2081b3[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x6453('0x21')](handleError(_0x2081b3));};exports[_0x6453('0x38')]=function(_0x4027f0,_0x48e4ac){logger[_0x6453('0x13')](_0x6453('0x39'),_0x4027f0['body']);var _0x31e5e3=answerValidation[_0x6453('0xd')](_0x4027f0[_0x6453('0x2d')]);if(_0x31e5e3[_0x6453('0x3a')]>0x0){return _0x48e4ac[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x31e5e3);}var _0x38d563=_0x4027f0['body'][_0x6453('0x3b')];var _0x10d66e=_0x4027f0[_0x6453('0x2d')][_0x6453('0x29')];return getAgent(_0x38d563)['then'](function(_0x475723){logger['info']('entityFound:',_0x475723[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x475723[_0x6453('0x19')]),_0x6453('0x3c'),{'sessionId':_0x10d66e});return _0x48e4ac[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x3d')});})[_0x6453('0x21')](handleError(_0x48e4ac));};exports[_0x6453('0x3e')]=function(_0x571a11,_0x374d4e){logger[_0x6453('0x13')]('hold\x20fired:',_0x571a11['body']);var _0x5cb8b2=holdValidation['validate'](_0x571a11['body']);if(_0x5cb8b2[_0x6453('0x3a')]>0x0){return _0x374d4e[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x5cb8b2);}var _0x51f1e5=_0x571a11[_0x6453('0x2d')]['userId'];var _0x165928=_0x571a11[_0x6453('0x2d')][_0x6453('0x29')];return getAgent(_0x51f1e5)[_0x6453('0x1d')](function(_0x3a3254){logger['info']('entityFound:',_0x3a3254[_0x6453('0x19')]);emit(util['format']('user:%s',_0x3a3254[_0x6453('0x19')]),'webbar:hold',{'sessionId':_0x165928});return _0x374d4e[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x3f')});})[_0x6453('0x21')](handleError(_0x374d4e));};exports[_0x6453('0x40')]=function(_0x5979b4,_0x59aec9){logger[_0x6453('0x13')](_0x6453('0x41'),_0x5979b4[_0x6453('0x2d')]);var _0x13766e=unholdValidation[_0x6453('0xd')](_0x5979b4['body']);if(_0x13766e[_0x6453('0x3a')]>0x0){return _0x59aec9[_0x6453('0x1a')](0x190)[_0x6453('0x2e')](_0x13766e);}var _0x56f6ed=_0x5979b4[_0x6453('0x2d')]['userId'];var _0x4ca691=_0x5979b4[_0x6453('0x2d')]['sessionId'];return getAgent(_0x56f6ed)[_0x6453('0x1d')](function(_0x27c07c){logger[_0x6453('0x13')]('entityFound:',_0x27c07c[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x27c07c[_0x6453('0x19')]),'webbar:unhold',{'sessionId':_0x4ca691});return _0x59aec9[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x42')});})[_0x6453('0x21')](handleError(_0x59aec9));};exports[_0x6453('0x43')]=function(_0x55d1c0,_0x36e6ec){logger[_0x6453('0x13')](_0x6453('0x44'),_0x36e6ec[_0x6453('0x2d')]);var _0x3cc446=callsValidation['validate'](_0x55d1c0['body']);if(_0x3cc446[_0x6453('0x3a')]>0x0){return _0x36e6ec[_0x6453('0x1a')](0x190)['json'](_0x3cc446);}var _0x3a5061=_0x55d1c0[_0x6453('0x2d')][_0x6453('0x3b')];var _0xb9ba1a=respondWithRpcPromise(_0x6453('0x24'));var _0x3c394c=getAgent(_0x3a5061);return Promise['all']([_0xb9ba1a,_0x3c394c])[_0x6453('0x1d')](function(_0x3f3f74){var _0x24ffe8=_0x3f3f74[0x0];var _0x288989=_0x3f3f74[0x1];var _0x44ac7b=_[_0x6453('0x26')](_0x24ffe8[_0x6453('0x27')],function(_0x5bb47d){return _0x5bb47d[_0x6453('0x28')]==_0x288989['id'];});return _0x36e6ec[_0x6453('0x1a')](0xc8)[_0x6453('0x2e')]({'count':_0x44ac7b[_0x6453('0x3a')],'rows':_0x44ac7b});})['catch'](handleError(_0x36e6ec));};exports[_0x6453('0x45')]=function(_0x28849b,_0x574a92){logger[_0x6453('0x13')](_0x6453('0x46'),_0x28849b[_0x6453('0x2d')]);var _0x377641=conferenceValidation[_0x6453('0xd')](_0x28849b[_0x6453('0x2d')]);if(_0x377641[_0x6453('0x3a')]>0x0){return _0x574a92[_0x6453('0x1a')](0x190)['json'](_0x377641);}var _0x3246e6=_0x28849b['body']['userId'];return getAgent(_0x3246e6)[_0x6453('0x1d')](function(_0x2dc963){logger[_0x6453('0x13')](_0x6453('0x47'),_0x2dc963[_0x6453('0x19')]);emit(util[_0x6453('0x32')]('user:%s',_0x2dc963[_0x6453('0x19')]),'webbar:conference');return _0x574a92['status'](0xc8)['json']({'error':![],'message':_0x6453('0x48')});})['catch'](handleError(_0x574a92));};exports[_0x6453('0x49')]=function(_0x296c87,_0x542d81){logger[_0x6453('0x13')](_0x6453('0x4a'),_0x296c87[_0x6453('0x2d')]);var _0xa60c0f=transferValidation[_0x6453('0xd')](_0x296c87['body']);if(_0xa60c0f[_0x6453('0x3a')]>0x0){return _0x542d81[_0x6453('0x1a')](0x190)['json'](_0xa60c0f);}var _0x47108a=_0x296c87[_0x6453('0x2d')][_0x6453('0x3b')];var _0x4e143a=_0x296c87['body']['sessionId'];var _0xf87fb2=_0x296c87[_0x6453('0x2d')][_0x6453('0x4b')];return getAgent(_0x47108a)[_0x6453('0x1d')](function(_0x4ba440){logger[_0x6453('0x13')](_0x6453('0x47'),_0x4ba440[_0x6453('0x19')]);emit(util[_0x6453('0x32')](_0x6453('0x37'),_0x4ba440[_0x6453('0x19')]),_0x6453('0x4c'),{'sessionId':_0x4e143a,'transferNumber':_0xf87fb2});return _0x542d81['status'](0xc8)[_0x6453('0x2e')]({'error':![],'message':_0x6453('0x4d')});})[_0x6453('0x21')](handleError(_0x542d81));}; \ No newline at end of file +var _0xd33b=['userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','length','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId\x20','originate','body','json'];(function(_0x5a3c43,_0x4a4ba0){var _0x4304ef=function(_0x4bf707){while(--_0x4bf707){_0x5a3c43['push'](_0x5a3c43['shift']());}};_0x4304ef(++_0x4a4ba0);}(_0xd33b,0x1af));var _0xbd33=function(_0x11d011,_0x1e2f64){_0x11d011=_0x11d011-0x0;var _0x490ab0=_0xd33b[_0x11d011];return _0x490ab0;};'use strict';var path=require(_0xbd33('0x0'));var fs=require('fs');var _=require(_0xbd33('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbd33('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xbd33('0x3')][_0xbd33('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xbd33('0x5'));var Redis=require(_0xbd33('0x6'));config[_0xbd33('0x7')]=_[_0xbd33('0x8')](config['redis'],{'host':_0xbd33('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd33('0x7')]));var Schema=require(_0xbd33('0xa'));var originateValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'callNumber':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0xe')]},'callerId':{'type':_0xbd33('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0xf')]},'transferNumber':{'type':_0xbd33('0xd'),'required':[!![],_0xbd33('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbd33('0xb'),'required':[!![],_0xbd33('0xc')]},'sessionId':{'type':_0xbd33('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x3f5964,_0x322341,_0x4ba160){logger[_0xbd33('0x11')](_0x3f5964,_0x322341,JSON[_0xbd33('0x12')](_0x4ba160));io['to'](_0x3f5964)['emit'](_0x322341,_0x4ba160);}function handleError(_0x13bcda){return function(_0x381a36){console[_0xbd33('0x13')](_0xbd33('0x14'),_0x381a36,_0x381a36 instanceof RangeError);logger['error'](_0x381a36[_0xbd33('0x15')]);if(_0x381a36 instanceof RangeError){if(_0x381a36[_0xbd33('0x16')]){delete _0x381a36[_0xbd33('0x16')];}_0x13bcda[_0xbd33('0x17')](0x194)[_0xbd33('0x18')](_0x381a36);}else{if(_0x381a36[_0xbd33('0x16')]){delete _0x381a36['name'];}_0x13bcda['status'](0x1f4)['send'](_0x381a36);}};}function checkError(){return function(_0x311c5b){if(!_0x311c5b){throw new RangeError(_0xbd33('0x19'));}return _0x311c5b;};}function respondWithRpcPromise(_0x500c80,_0x4a3be2){return new BPromise(function(_0x4d021a,_0x48f4af){var _0x9c2f99=amiClient;return _0x9c2f99['request'](_0x500c80,_0x4a3be2)[_0xbd33('0x1a')](function(_0x1a0dcd){if(_0x1a0dcd[_0xbd33('0x1b')]){if(_0x1a0dcd[_0xbd33('0x1b')][_0xbd33('0x1c')]===0x1f4){return _0x48f4af(_0x1a0dcd['error']['message']);}return _0x4d021a(_0x1a0dcd[_0xbd33('0x1b')][_0xbd33('0x1d')]);}else{_0x4d021a(_0x1a0dcd[_0xbd33('0x1e')]);}})[_0xbd33('0x1f')](function(_0x1be515){_0x48f4af(_0x1be515);});});}function getAgent(_0x463f36){return db[_0xbd33('0x20')][_0xbd33('0x21')]({'where':{'id':_0x463f36,'role':_0xbd33('0x22')}})[_0xbd33('0x1a')](checkError());}function getAgentCheckSession(_0x5a3e37,_0x5d51ab){return new BPromise(function(_0x4f4b63,_0x3f2c91){var _0x1d43bd=respondWithRpcPromise(_0xbd33('0x23'));var _0x22a9c9=getAgent(_0x5a3e37);Promise[_0xbd33('0x24')]([_0x1d43bd,_0x22a9c9])[_0xbd33('0x1a')](function(_0x47ce9f){var _0x30848c=_0x47ce9f[0x0];var _0x3806c3=_0x47ce9f[0x1];var _0x2cb9df=_[_0xbd33('0x25')](_0x30848c[_0xbd33('0x26')],function(_0x29204f){return _0x29204f['UserId']==_0x3806c3['id']&&_0x29204f['sessionId']==_0x5d51ab;});if(_0x2cb9df['length']==0x1){_0x4f4b63(_0x3806c3);}else{_0x3f2c91(new RangeError(_0xbd33('0x27')+_0x5d51ab+'\x20not\x20found!'));}});});}exports[_0xbd33('0x28')]=function(_0x1f82b4,_0x22c33f){logger[_0xbd33('0x11')]('originate\x20fired:',_0x1f82b4[_0xbd33('0x29')]);var _0x1d007e=originateValidation['validate'](_0x1f82b4[_0xbd33('0x29')]);if(_0x1d007e['length']>0x0){return _0x22c33f[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x1d007e);}var _0x1b501b=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x4bc639=_0x1f82b4[_0xbd33('0x29')]['callNumber'];var _0x2ffd45=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2c')];var _0x483fa1=_0x1f82b4[_0xbd33('0x29')][_0xbd33('0x2d')];return getAgent(_0x1b501b)[_0xbd33('0x1a')](function(_0x1a2677){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x1a2677[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x1a2677['name']),_0xbd33('0x31'),{'callNumber':_0x4bc639,'callerId':_0x2ffd45,'callbackUrl':_0x483fa1});return _0x22c33f[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x32')});})['catch'](handleError(_0x22c33f));};exports[_0xbd33('0x33')]=function(_0x2eca01,_0x8f5a3){logger['info'](_0xbd33('0x34'),_0x2eca01['body']);var _0x5dffe1=hangupValidation[_0xbd33('0xa')](_0x2eca01[_0xbd33('0x29')]);if(_0x5dffe1[_0xbd33('0x35')]>0x0){return _0x8f5a3[_0xbd33('0x17')](0x190)['json'](_0x5dffe1);}var _0x1e978e=_0x2eca01[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x15056e=_0x2eca01[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x1e978e)[_0xbd33('0x1a')](function(_0x411277){logger['info'](_0xbd33('0x2e'),_0x411277['name']);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x411277[_0xbd33('0x16')]),_0xbd33('0x37'),{'sessionId':_0x15056e});return _0x8f5a3[_0xbd33('0x17')](0xc8)['json']({'error':![],'message':_0xbd33('0x38')});})[_0xbd33('0x1f')](handleError(_0x8f5a3));};exports[_0xbd33('0x39')]=function(_0x2bca10,_0x1e70d2){logger[_0xbd33('0x11')](_0xbd33('0x3a'),_0x2bca10[_0xbd33('0x29')]);var _0x27250c=answerValidation['validate'](_0x2bca10[_0xbd33('0x29')]);if(_0x27250c['length']>0x0){return _0x1e70d2['status'](0x190)[_0xbd33('0x2a')](_0x27250c);}var _0xfb6776=_0x2bca10['body'][_0xbd33('0x2b')];var _0x2022cc=_0x2bca10['body'][_0xbd33('0x36')];return getAgent(_0xfb6776)[_0xbd33('0x1a')](function(_0x2c2aea){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x2c2aea[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x2c2aea['name']),_0xbd33('0x3b'),{'sessionId':_0x2022cc});return _0x1e70d2['status'](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x3c')});})['catch'](handleError(_0x1e70d2));};exports[_0xbd33('0x3d')]=function(_0x4ce968,_0x496835){logger[_0xbd33('0x11')](_0xbd33('0x3e'),_0x4ce968[_0xbd33('0x29')]);var _0x4ce9c7=holdValidation[_0xbd33('0xa')](_0x4ce968[_0xbd33('0x29')]);if(_0x4ce9c7[_0xbd33('0x35')]>0x0){return _0x496835[_0xbd33('0x17')](0x190)['json'](_0x4ce9c7);}var _0x29d55c=_0x4ce968[_0xbd33('0x29')]['userId'];var _0x3d5feb=_0x4ce968[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x29d55c)[_0xbd33('0x1a')](function(_0x276ffb){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x276ffb[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x276ffb['name']),_0xbd33('0x3f'),{'sessionId':_0x3d5feb});return _0x496835[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x40')});})[_0xbd33('0x1f')](handleError(_0x496835));};exports[_0xbd33('0x41')]=function(_0x1dfcb7,_0x5850e8){logger[_0xbd33('0x11')](_0xbd33('0x42'),_0x1dfcb7[_0xbd33('0x29')]);var _0x2ddce4=unholdValidation['validate'](_0x1dfcb7[_0xbd33('0x29')]);if(_0x2ddce4[_0xbd33('0x35')]>0x0){return _0x5850e8[_0xbd33('0x17')](0x190)['json'](_0x2ddce4);}var _0x51d21a=_0x1dfcb7[_0xbd33('0x29')]['userId'];var _0x59819b=_0x1dfcb7[_0xbd33('0x29')][_0xbd33('0x36')];return getAgent(_0x51d21a)['then'](function(_0x26af0d){logger['info']('entityFound:',_0x26af0d[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x26af0d[_0xbd33('0x16')]),_0xbd33('0x43'),{'sessionId':_0x59819b});return _0x5850e8['status'](0xc8)[_0xbd33('0x2a')]({'error':![],'message':_0xbd33('0x44')});})[_0xbd33('0x1f')](handleError(_0x5850e8));};exports['calls']=function(_0x1a64a8,_0x3e70b4){logger['info'](_0xbd33('0x45'),_0x3e70b4[_0xbd33('0x29')]);var _0x4bf784=callsValidation[_0xbd33('0xa')](_0x1a64a8[_0xbd33('0x29')]);if(_0x4bf784[_0xbd33('0x35')]>0x0){return _0x3e70b4[_0xbd33('0x17')](0x190)['json'](_0x4bf784);}var _0x40d030=_0x1a64a8[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x4ce0fd=respondWithRpcPromise('VoiceChannels');var _0x875a45=getAgent(_0x40d030);return Promise[_0xbd33('0x24')]([_0x4ce0fd,_0x875a45])[_0xbd33('0x1a')](function(_0x2ff73f){var _0x3fbd20=_0x2ff73f[0x0];var _0x3e4142=_0x2ff73f[0x1];var _0x527ea4=_[_0xbd33('0x25')](_0x3fbd20['rows'],function(_0xa92727){return _0xa92727[_0xbd33('0x46')]==_0x3e4142['id'];});return _0x3e70b4[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'count':_0x527ea4[_0xbd33('0x35')],'rows':_0x527ea4});})['catch'](handleError(_0x3e70b4));};exports[_0xbd33('0x47')]=function(_0x5b554e,_0x30c199){logger[_0xbd33('0x11')](_0xbd33('0x48'),_0x5b554e[_0xbd33('0x29')]);var _0x468a56=conferenceValidation[_0xbd33('0xa')](_0x5b554e[_0xbd33('0x29')]);if(_0x468a56[_0xbd33('0x35')]>0x0){return _0x30c199[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x468a56);}var _0x42a3ee=_0x5b554e['body'][_0xbd33('0x2b')];return getAgent(_0x42a3ee)[_0xbd33('0x1a')](function(_0x11a675){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x11a675[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')]('user:%s',_0x11a675[_0xbd33('0x16')]),_0xbd33('0x49'));return _0x30c199[_0xbd33('0x17')](0xc8)[_0xbd33('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0xbd33('0x1f')](handleError(_0x30c199));};exports[_0xbd33('0x4a')]=function(_0x18456a,_0x9b53bf){logger[_0xbd33('0x11')](_0xbd33('0x4b'),_0x18456a[_0xbd33('0x29')]);var _0x102af8=transferValidation['validate'](_0x18456a[_0xbd33('0x29')]);if(_0x102af8[_0xbd33('0x35')]>0x0){return _0x9b53bf[_0xbd33('0x17')](0x190)[_0xbd33('0x2a')](_0x102af8);}var _0x10790a=_0x18456a[_0xbd33('0x29')][_0xbd33('0x2b')];var _0x20b3f2=_0x18456a[_0xbd33('0x29')][_0xbd33('0x36')];var _0x1fa444=_0x18456a[_0xbd33('0x29')][_0xbd33('0x4c')];return getAgent(_0x10790a)[_0xbd33('0x1a')](function(_0x2f7dd6){logger[_0xbd33('0x11')](_0xbd33('0x2e'),_0x2f7dd6[_0xbd33('0x16')]);emit(util[_0xbd33('0x2f')](_0xbd33('0x30'),_0x2f7dd6[_0xbd33('0x16')]),_0xbd33('0x4d'),{'sessionId':_0x20b3f2,'transferNumber':_0x1fa444});return _0x9b53bf[_0xbd33('0x17')](0xc8)['json']({'error':![],'message':_0xbd33('0x4e')});})[_0xbd33('0x1f')](handleError(_0x9b53bf));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3fa4fdb..be82026 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 _0xb94a=['getAgents','post','create','addDisposition','addAnswer','addAgents','/:id/applications','/:id/notify','notify','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','express','Router','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','/:id/users'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb94a,0x1ec));var _0xab94=function(_0x46f261,_0x2f1b1d){_0x46f261=_0x46f261-0x0;var _0x1cc482=_0xb94a[_0x46f261];return _0x1cc482;};'use strict';var multer=require('multer');var util=require(_0xab94('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xab94('0x1'));var router=express[_0xab94('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xab94('0x3')]('/',auth[_0xab94('0x4')](),controller[_0xab94('0x5')]);router[_0xab94('0x3')](_0xab94('0x6'),auth[_0xab94('0x4')](),controller[_0xab94('0x7')]);router[_0xab94('0x3')](_0xab94('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xab94('0x3')](_0xab94('0x9'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xab94('0x3')](_0xab94('0xa'),auth[_0xab94('0x4')](),controller['getAnswers']);router[_0xab94('0x3')](_0xab94('0xb'),auth[_0xab94('0x4')](),controller[_0xab94('0xc')]);router[_0xab94('0x3')]('/:id/applications',auth[_0xab94('0x4')](),controller['getApplications']);router[_0xab94('0xd')]('/',auth['isAuthenticated'](),controller[_0xab94('0xe')]);router[_0xab94('0xd')](_0xab94('0x9'),auth[_0xab94('0x4')](),controller[_0xab94('0xf')]);router[_0xab94('0xd')](_0xab94('0xa'),auth[_0xab94('0x4')](),controller[_0xab94('0x10')]);router['post']('/:id/users',auth[_0xab94('0x4')](),controller[_0xab94('0x11')]);router[_0xab94('0xd')](_0xab94('0x12'),auth[_0xab94('0x4')](),controller['addApplications']);router[_0xab94('0xd')](_0xab94('0x13'),controller[_0xab94('0x14')]);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xab94('0x15')]('/:id',auth[_0xab94('0x4')](),controller[_0xab94('0x16')]);router[_0xab94('0x17')](_0xab94('0x8'),auth[_0xab94('0x4')](),controller['destroy']);router[_0xab94('0x17')](_0xab94('0x9'),auth[_0xab94('0x4')](),controller[_0xab94('0x18')]);router['delete'](_0xab94('0xa'),auth[_0xab94('0x4')](),controller[_0xab94('0x19')]);router[_0xab94('0x17')]('/:id/users',auth[_0xab94('0x4')](),controller[_0xab94('0x1a')]);module[_0xab94('0x1b')]=router; \ No newline at end of file +var _0x4534=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path'];(function(_0x3bf720,_0x1510d6){var _0x2d2aab=function(_0x3d1459){while(--_0x3d1459){_0x3bf720['push'](_0x3bf720['shift']());}};_0x2d2aab(++_0x1510d6);}(_0x4534,0x141));var _0x4453=function(_0x4591ab,_0xa00f62){_0x4591ab=_0x4591ab-0x0;var _0x3b6d4f=_0x4534[_0x4591ab];return _0x3b6d4f;};'use strict';var multer=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var path=require(_0x4453('0x2'));var timeout=require(_0x4453('0x3'));var express=require('express');var router=express[_0x4453('0x4')]();var auth=require(_0x4453('0x5'));var interaction=require(_0x4453('0x6'));var config=require(_0x4453('0x7'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x4453('0x8')](),controller[_0x4453('0x9')]);router[_0x4453('0xa')](_0x4453('0xb'),auth[_0x4453('0x8')](),controller[_0x4453('0xc')]);router[_0x4453('0xa')](_0x4453('0xd'),auth['isAuthenticated'](),controller[_0x4453('0xe')]);router[_0x4453('0xa')](_0x4453('0xf'),auth[_0x4453('0x8')](),controller[_0x4453('0x10')]);router[_0x4453('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4453('0x11')]);router['get'](_0x4453('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4453('0xa')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x4453('0x13')]('/',auth[_0x4453('0x8')](),controller[_0x4453('0x14')]);router[_0x4453('0x13')](_0x4453('0xf'),auth[_0x4453('0x8')](),controller[_0x4453('0x15')]);router[_0x4453('0x13')](_0x4453('0x16'),auth['isAuthenticated'](),controller[_0x4453('0x17')]);router[_0x4453('0x13')](_0x4453('0x12'),auth['isAuthenticated'](),controller[_0x4453('0x18')]);router['post'](_0x4453('0x19'),auth[_0x4453('0x8')](),controller['addApplications']);router[_0x4453('0x13')](_0x4453('0x1a'),controller[_0x4453('0x1b')]);router[_0x4453('0x13')](_0x4453('0x1c'),auth[_0x4453('0x8')](),controller['send']);router[_0x4453('0x1d')](_0x4453('0xd'),auth[_0x4453('0x8')](),controller[_0x4453('0x1e')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4453('0x1f')]);router[_0x4453('0x20')](_0x4453('0xf'),auth[_0x4453('0x8')](),controller[_0x4453('0x21')]);router['delete'](_0x4453('0x16'),auth[_0x4453('0x8')](),controller[_0x4453('0x22')]);router[_0x4453('0x20')]('/:id/users',auth[_0x4453('0x8')](),controller['removeAgents']);module[_0x4453('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ea87bfd..365094a 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 _0xc4ed=['STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x1a0016,_0x3d80e1){var _0x2945df=function(_0x2e82b2){while(--_0x2e82b2){_0x1a0016['push'](_0x1a0016['shift']());}};_0x2945df(++_0x3d80e1);}(_0xc4ed,0x185));var _0xdc4e=function(_0x87d3ec,_0x387888){_0x87d3ec=_0x87d3ec-0x0;var _0x5f3f6f=_0xc4ed[_0x87d3ec];return _0x5f3f6f;};'use strict';var Sequelize=require(_0xdc4e('0x0'));var rs=require(_0xdc4e('0x1'));module[_0xdc4e('0x2')]={'name':{'type':Sequelize[_0xdc4e('0x3')],'unique':_0xdc4e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xdc4e('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc4e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdc4e('0x3')],'defaultValue':function(){return rs[_0xdc4e('0x5')]();}},'phone':{'type':Sequelize[_0xdc4e('0x3')]},'type':{'type':Sequelize[_0xdc4e('0x6')](_0xdc4e('0x7'))},'accountSid':{'type':Sequelize[_0xdc4e('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdc4e('0x8');}},'notificationSound':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc4e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc4e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc4e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc4e('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdc4e('0x9')],'defaultValue':![],'comment':_0xdc4e('0xb'),'set':function(_0x5ed1b8){if(!_0x5ed1b8){this[_0xdc4e('0xc')](_0xdc4e('0xd'),null);}this[_0xdc4e('0xc')]('mandatoryDisposition',_0x5ed1b8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2750=['mandatoryDisposition','exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x72445e,_0xfddac1){var _0x2bdf6e=function(_0x3e0db0){while(--_0x3e0db0){_0x72445e['push'](_0x72445e['shift']());}};_0x2bdf6e(++_0xfddac1);}(_0x2750,0x9b));var _0x0275=function(_0x80df57,_0x11390f){_0x80df57=_0x80df57-0x0;var _0x2d0c44=_0x2750[_0x80df57];return _0x2d0c44;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0275('0x0')]={'name':{'type':Sequelize[_0x0275('0x1')],'unique':_0x0275('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0275('0x3')]();}},'phone':{'type':Sequelize[_0x0275('0x1')]},'type':{'type':Sequelize['ENUM'](_0x0275('0x4'))},'accountSid':{'type':Sequelize[_0x0275('0x1')]},'authToken':{'type':Sequelize[_0x0275('0x1')]},'notificationTemplate':{'type':Sequelize[_0x0275('0x5')],'defaultValue':function(){return _0x0275('0x6');}},'notificationSound':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0275('0x8')],'comment':_0x0275('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x0275('0x7')],'defaultValue':![],'comment':_0x0275('0xa'),'set':function(_0x46dc62){if(!_0x46dc62){this['setDataValue'](_0x0275('0xb'),null);}this[_0x0275('0xc')](_0x0275('0xd'),_0x46dc62);}},'description':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d1eaae9..1ea7da5 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 _0x2e54=['type','VIRTUAL','options','include','findAll','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','asc','account','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','WhatsappMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','send','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','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','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x143447,_0xdd222f){_0x143447=_0x143447-0x0;var _0x415de1=_0x2e54[_0x143447];return _0x415de1;};'use strict';var pdf=require(_0x42e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x42e5('0x1'));var jsonpatch=require(_0x42e5('0x2'));var rp=require(_0x42e5('0x3'));var moment=require(_0x42e5('0x4'));var BPromise=require(_0x42e5('0x5'));var Mustache=require(_0x42e5('0x6'));var util=require(_0x42e5('0x7'));var path=require('path');var sox=require(_0x42e5('0x8'));var csv=require(_0x42e5('0x9'));var ejs=require(_0x42e5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x9'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var db=require('../../mysqldb')['db'];config[_0x42e5('0x17')]=_[_0x42e5('0x18')](config[_0x42e5('0x17')],{'host':_0x42e5('0x19'),'port':0x18eb});var socket=require(_0x42e5('0x1a'))(new Redis(config[_0x42e5('0x17')]));require(_0x42e5('0x1b'))[_0x42e5('0x1c')](socket);var jayson=require(_0x42e5('0x1d'));var client=jayson[_0x42e5('0x1e')]['http']({'port':0x232c});function checkPasswordPattern(_0x3b3dd9,_0x1d8e52,_0x4034bd){if(_0x4034bd){var _0x388300=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x388300[_0x42e5('0x1f')](_0x1d8e52)){return _0x3b3dd9;}else{throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))](_0x42e5('0x22'));}}else{return _0x3b3dd9;}}function respondWithRpcPromise(_0x16c753,_0x3c7b79,_0x22655f,_0x38282d){return new BPromise(function(_0x11550e,_0x23fe09){var _0x54fcfc=_0x38282d||client;return _0x54fcfc[_0x42e5('0x23')](_0x16c753,_0x22655f)['then'](function(_0x5f4428){logger[_0x42e5('0x24')](_0x42e5('0x25'),_0x3c7b79,'request\x20sent');logger[_0x42e5('0x26')](_0x42e5('0x27'),_0x3c7b79,_0x42e5('0x28'),JSON[_0x42e5('0x29')](_0x5f4428));if(_0x5f4428[_0x42e5('0x2a')]){if(_0x5f4428[_0x42e5('0x2a')][_0x42e5('0x2b')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3c7b79,_0x5f4428[_0x42e5('0x2a')]['message']);return _0x23fe09(_0x5f4428[_0x42e5('0x2a')][_0x42e5('0x2c')]);}logger[_0x42e5('0x2a')](_0x42e5('0x25'),_0x3c7b79,_0x5f4428[_0x42e5('0x2a')]['message']);return _0x11550e(_0x5f4428[_0x42e5('0x2a')][_0x42e5('0x2c')]);}else{logger[_0x42e5('0x24')](_0x42e5('0x25'),_0x3c7b79,_0x42e5('0x28'));_0x11550e(_0x5f4428['result']['message']);}})[_0x42e5('0x2d')](function(_0x534a26){logger['error'](_0x42e5('0x25'),_0x3c7b79,_0x534a26);_0x23fe09(_0x534a26);});});}function respondWithStatusCode(_0x5b1727,_0x392c6b){_0x392c6b=_0x392c6b||0xcc;return function(_0x2d9e65){if(_0x2d9e65){return _0x5b1727[_0x42e5('0x2e')](_0x392c6b);}return _0x5b1727[_0x42e5('0x2f')](_0x392c6b)[_0x42e5('0x30')]();};}function respondWithResult(_0x2f1edc,_0x59a46b){_0x59a46b=_0x59a46b||0xc8;return function(_0x3e2ea5){if(_0x3e2ea5){return _0x2f1edc[_0x42e5('0x2f')](_0x59a46b)[_0x42e5('0x31')](_0x3e2ea5);}};}function respondWithFilteredResult(_0x2c53d4,_0x1d22ba){return function(_0xd62a0f){if(_0xd62a0f){var _0x383e97=_0xd62a0f[_0x42e5('0x32')],_0x282cbf=_0x1d22ba[_0x42e5('0x33')],_0x5a4930=_0x1d22ba[_0x42e5('0x33')]+_0x1d22ba['limit'],_0x2ba9ef;if(_0x5a4930>=_0x383e97){_0x5a4930=_0x383e97;_0x2ba9ef=0xc8;}else{_0x2ba9ef=0xce;}_0x2c53d4[_0x42e5('0x2f')](_0x2ba9ef);return _0x2c53d4[_0x42e5('0x34')](_0x42e5('0x35'),_0x282cbf+'-'+_0x5a4930+'/'+_0x383e97)[_0x42e5('0x31')](_0xd62a0f);}return null;};}function patchUpdates(_0x5bdc87){return function(_0x539254){try{jsonpatch[_0x42e5('0x36')](_0x539254,_0x5bdc87,!![]);}catch(_0x59f8d6){return BPromise[_0x42e5('0x37')](_0x59f8d6);}return _0x539254['save']();};}function saveUpdates(_0x472600,_0x188d9d){return function(_0x860000){if(_0x860000){return _0x860000['update'](_0x472600)[_0x42e5('0x38')](function(_0x3a8d1c){return _0x3a8d1c;});}return null;};}function removeEntity(_0x5b99da,_0x1ae59c){return function(_0x57558d){if(_0x57558d){return _0x57558d[_0x42e5('0x39')]()[_0x42e5('0x38')](function(){var _0x25a040=_0x57558d[_0x42e5('0x3a')]({'plain':!![]});var _0x3c12c6=_0x42e5('0x3b');return db[_0x42e5('0x3c')]['destroy']({'where':{'type':_0x3c12c6,'resourceId':_0x25a040['id']}})['then'](function(){return _0x57558d;});})[_0x42e5('0x38')](function(){_0x5b99da[_0x42e5('0x2f')](0xcc)[_0x42e5('0x30')]();});}};}function handleEntityNotFound(_0x4a1a8a,_0x56804a){return function(_0x5da91c){if(!_0x5da91c){_0x4a1a8a['sendStatus'](0x194);}return _0x5da91c;};}function handleError(_0x245cda,_0x288fb0){_0x288fb0=_0x288fb0||0x1f4;return function(_0x24958b){logger[_0x42e5('0x2a')](_0x24958b[_0x42e5('0x3d')]);if(_0x24958b[_0x42e5('0x3e')]){delete _0x24958b[_0x42e5('0x3e')];}_0x245cda[_0x42e5('0x2f')](_0x288fb0)['send'](_0x24958b);};}exports[_0x42e5('0x3f')]=function(_0x587832,_0x470338){var _0x343363={'include':[{'model':db[_0x42e5('0x40')],'as':_0x42e5('0x41')}]},_0x340caf={},_0x53a5c8={'count':0x0,'rows':[]};var _0xd5e7f5=_['map'](db[_0x42e5('0x42')][_0x42e5('0x43')],function(_0x5362c8){return{'name':_0x5362c8[_0x42e5('0x44')],'type':_0x5362c8['type']['key']};});_0x340caf['model']=_[_0x42e5('0x45')](_0xd5e7f5,_0x42e5('0x3e'));_0x340caf[_0x42e5('0x46')]=_[_0x42e5('0x47')](_0x587832[_0x42e5('0x46')]);_0x340caf[_0x42e5('0x48')]=_[_0x42e5('0x49')](_0x340caf['model'],_0x340caf[_0x42e5('0x46')]);_0x343363[_0x42e5('0x4a')]=_['intersection'](_0x340caf[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x587832['query'][_0x42e5('0x4c')]));_0x343363[_0x42e5('0x4a')]=_0x343363[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x343363[_0x42e5('0x4a')]:_0x340caf['model'];if(!_0x587832[_0x42e5('0x46')][_0x42e5('0x4e')](_0x42e5('0x4f'))){_0x343363[_0x42e5('0x50')]=qs['limit'](_0x587832[_0x42e5('0x46')][_0x42e5('0x50')]);_0x343363[_0x42e5('0x33')]=qs[_0x42e5('0x33')](_0x587832[_0x42e5('0x46')][_0x42e5('0x33')]);}_0x343363[_0x42e5('0x51')]=qs[_0x42e5('0x52')](_0x587832['query'][_0x42e5('0x52')]);_0x343363['where']=qs['filters'](_[_0x42e5('0x53')](_0x587832[_0x42e5('0x46')],_0x340caf[_0x42e5('0x48')]),_0xd5e7f5);if(_0x587832[_0x42e5('0x46')][_0x42e5('0x54')]){_0x343363[_0x42e5('0x55')]=_[_0x42e5('0x56')](_0x343363['where'],{'$or':_[_0x42e5('0x45')](_0xd5e7f5,function(_0x27681a){if(_0x27681a[_0x42e5('0x57')]!==_0x42e5('0x58')){var _0x1086b2={};_0x1086b2[_0x27681a[_0x42e5('0x3e')]]={'$like':'%'+_0x587832[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x1086b2;}})});}_0x343363=_['merge']({},_0x343363,_0x587832[_0x42e5('0x59')]);var _0x3fbccb={'where':_0x343363[_0x42e5('0x55')]};return db[_0x42e5('0x42')][_0x42e5('0x32')](_0x3fbccb)[_0x42e5('0x38')](function(_0xffc1e2){_0x53a5c8[_0x42e5('0x32')]=_0xffc1e2;if(_0x587832[_0x42e5('0x46')]['includeAll']){_0x343363[_0x42e5('0x5a')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x42e5('0x5b')](_0x343363);})[_0x42e5('0x38')](function(_0x326086){_0x53a5c8['rows']=_0x326086;return _0x53a5c8;})['then'](respondWithFilteredResult(_0x470338,_0x343363))['catch'](handleError(_0x470338,null));};exports[_0x42e5('0x5c')]=function(_0x2601c6,_0x11fd3c){var _0x148d2c={'raw':![],'where':{'id':_0x2601c6[_0x42e5('0x5d')]['id']},'include':[{'model':db[_0x42e5('0x40')],'as':_0x42e5('0x41')}]},_0x53edc8={};_0x53edc8['model']=_[_0x42e5('0x47')](db['WhatsappAccount'][_0x42e5('0x43')]);_0x53edc8[_0x42e5('0x46')]=_['keys'](_0x2601c6[_0x42e5('0x46')]);_0x53edc8[_0x42e5('0x48')]=_[_0x42e5('0x49')](_0x53edc8[_0x42e5('0x4b')],_0x53edc8[_0x42e5('0x46')]);_0x148d2c[_0x42e5('0x4a')]=_[_0x42e5('0x49')](_0x53edc8[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x2601c6[_0x42e5('0x46')]['fields']));_0x148d2c[_0x42e5('0x4a')]=_0x148d2c[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x148d2c[_0x42e5('0x4a')]:_0x53edc8[_0x42e5('0x4b')];if(_0x2601c6['query'][_0x42e5('0x5e')]){_0x148d2c[_0x42e5('0x5a')]=[{'all':!![]}];}_0x148d2c=_[_0x42e5('0x56')]({},_0x148d2c,_0x2601c6[_0x42e5('0x59')]);return db['WhatsappAccount']['find'](_0x148d2c)['then'](handleEntityNotFound(_0x11fd3c,null))[_0x42e5('0x38')](respondWithResult(_0x11fd3c,null))[_0x42e5('0x2d')](handleError(_0x11fd3c,null));};exports['create']=function(_0x42094e,_0xb73aa8){return db[_0x42e5('0x42')][_0x42e5('0x5f')](_0x42094e[_0x42e5('0x60')],{})[_0x42e5('0x38')](function(_0x2ec142){var _0x2c76e0=_0x42094e[_0x42e5('0x61')]['get']({'plain':!![]});if(!_0x2c76e0)throw new Error(_0x42e5('0x62'));if(_0x2c76e0['role']===_0x42e5('0x61')){var _0x2d05b5=_0x2ec142[_0x42e5('0x3a')]({'plain':!![]});var _0x3b4836=_0x42e5('0x3b');return db[_0x42e5('0x63')][_0x42e5('0x64')]({'where':{'name':_0x3b4836,'userProfileId':_0x2c76e0[_0x42e5('0x65')]},'raw':!![]})[_0x42e5('0x38')](function(_0x397481){if(_0x397481&&_0x397481[_0x42e5('0x66')]===0x0){return db['UserProfileResource'][_0x42e5('0x5f')]({'name':_0x2d05b5['name'],'resourceId':_0x2d05b5['id'],'type':_0x397481[_0x42e5('0x3e')],'sectionId':_0x397481['id']},{})['then'](function(){return _0x2ec142;});}else{return _0x2ec142;}})[_0x42e5('0x2d')](function(_0x3068fa){logger['error'](_0x42e5('0x67'),_0x3068fa);throw _0x3068fa;});}return _0x2ec142;})[_0x42e5('0x38')](respondWithResult(_0xb73aa8,0xc9))['catch'](handleError(_0xb73aa8,null));};exports[_0x42e5('0x68')]=function(_0x9b93a9,_0x513b80){if(_0x9b93a9[_0x42e5('0x60')]['id']){delete _0x9b93a9[_0x42e5('0x60')]['id'];}return db[_0x42e5('0x42')]['find']({'where':{'id':_0x9b93a9[_0x42e5('0x5d')]['id']},'include':[{'model':db[_0x42e5('0x40')],'as':_0x42e5('0x41')}]})[_0x42e5('0x38')](handleEntityNotFound(_0x513b80,null))['then'](saveUpdates(_0x9b93a9[_0x42e5('0x60')],null))['then'](respondWithResult(_0x513b80,null))[_0x42e5('0x2d')](handleError(_0x513b80,null));};exports[_0x42e5('0x39')]=function(_0x1f1d6e,_0x474095){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x1f1d6e[_0x42e5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x474095,null))[_0x42e5('0x38')](removeEntity(_0x474095,null))[_0x42e5('0x2d')](handleError(_0x474095,null));};exports[_0x42e5('0x69')]=function(_0x93c05d,_0x21a8aa){return db[_0x42e5('0x42')][_0x42e5('0x69')]()[_0x42e5('0x38')](respondWithResult(_0x21a8aa,null))[_0x42e5('0x2d')](handleError(_0x21a8aa,null));};exports['addDisposition']=function(_0x1cf8e4,_0x30d2b5,_0x2af01f){if(_0x1cf8e4[_0x42e5('0x60')]['id']){delete _0x1cf8e4['body']['id'];}return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x1cf8e4[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x30d2b5,null))['then'](function(_0x5cbc4c){if(_0x5cbc4c){_0x1cf8e4['body'][_0x42e5('0x6a')]=_0x5cbc4c['id'];return db[_0x42e5('0x6b')][_0x42e5('0x5f')](_0x1cf8e4[_0x42e5('0x60')]);}})[_0x42e5('0x38')](respondWithResult(_0x30d2b5,null))[_0x42e5('0x2d')](handleError(_0x30d2b5,null));};exports[_0x42e5('0x6c')]=function(_0x3cc383,_0x2a28ce,_0x5d1c15){var _0x1d0660={'raw':![],'where':{}};var _0x43e7d0={};var _0xdd32a0={'count':0x0,'rows':[]};return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x3cc383[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x2a28ce,null))[_0x42e5('0x38')](function(_0x4d5357){if(_0x4d5357){_0x43e7d0['model']=_[_0x42e5('0x47')](db[_0x42e5('0x6b')]['rawAttributes']);_0x43e7d0['query']=_['keys'](_0x3cc383[_0x42e5('0x46')]);_0x43e7d0[_0x42e5('0x48')]=_['intersection'](_0x43e7d0[_0x42e5('0x4b')],_0x43e7d0[_0x42e5('0x46')]);_0x1d0660['attributes']=_[_0x42e5('0x49')](_0x43e7d0[_0x42e5('0x4b')],qs['fields'](_0x3cc383[_0x42e5('0x46')]['fields']));_0x1d0660['attributes']=_0x1d0660['attributes']['length']?_0x1d0660[_0x42e5('0x4a')]:_0x43e7d0[_0x42e5('0x4b')];if(!_0x3cc383['query'][_0x42e5('0x4e')](_0x42e5('0x4f'))){_0x1d0660[_0x42e5('0x50')]=qs[_0x42e5('0x50')](_0x3cc383[_0x42e5('0x46')][_0x42e5('0x50')]);_0x1d0660['offset']=qs[_0x42e5('0x33')](_0x3cc383[_0x42e5('0x46')]['offset']);}_0x1d0660['order']=qs[_0x42e5('0x52')](_0x3cc383[_0x42e5('0x46')][_0x42e5('0x52')]);_0x1d0660[_0x42e5('0x55')]=qs[_0x42e5('0x48')](_[_0x42e5('0x53')](_0x3cc383[_0x42e5('0x46')],_0x43e7d0['filters']));_0x1d0660['where']['WhatsappAccountId']=_0x4d5357['id'];if(_0x3cc383['query'][_0x42e5('0x54')]){_0x1d0660[_0x42e5('0x55')]=_['merge'](_0x1d0660[_0x42e5('0x55')],{'$or':_['map'](_0x1d0660[_0x42e5('0x4a')],function(_0x2982a2){var _0x3493d4={};_0x3493d4[_0x2982a2]={'$like':'%'+_0x3cc383[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x3493d4;})});}_0x1d0660=_[_0x42e5('0x56')]({},_0x1d0660,_0x3cc383[_0x42e5('0x59')]);return db[_0x42e5('0x6b')][_0x42e5('0x32')]({'where':_0x1d0660[_0x42e5('0x55')]})[_0x42e5('0x38')](function(_0x78573b){_0xdd32a0[_0x42e5('0x32')]=_0x78573b;if(_0x3cc383[_0x42e5('0x46')][_0x42e5('0x5e')]){_0x1d0660[_0x42e5('0x5a')]=[{'all':!![]}];}return db[_0x42e5('0x6b')][_0x42e5('0x5b')](_0x1d0660);})['then'](function(_0x42b60b){_0xdd32a0[_0x42e5('0x6e')]=_0x42b60b;return _0xdd32a0;});}})[_0x42e5('0x38')](respondWithFilteredResult(_0x2a28ce,_0x1d0660))[_0x42e5('0x2d')](handleError(_0x2a28ce,null));};exports[_0x42e5('0x6f')]=function(_0x161874,_0x437589,_0x103338){return db['WhatsappAccount'][_0x42e5('0x64')]({'where':{'id':_0x161874[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x437589,null))[_0x42e5('0x38')](function(_0xb0d649){if(_0xb0d649){return _0xb0d649['removeDispositions'](_0x161874['query'][_0x42e5('0x70')]);}})[_0x42e5('0x38')](respondWithStatusCode(_0x437589,null))[_0x42e5('0x2d')](handleError(_0x437589,null));};exports[_0x42e5('0x71')]=function(_0x1cf03d,_0x2ff615,_0x2f0556){if(_0x1cf03d[_0x42e5('0x60')]['id']){delete _0x1cf03d[_0x42e5('0x60')]['id'];}return db['WhatsappAccount'][_0x42e5('0x64')]({'where':{'id':_0x1cf03d[_0x42e5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2ff615,null))[_0x42e5('0x38')](function(_0x44d9ff){if(_0x44d9ff){_0x1cf03d[_0x42e5('0x60')][_0x42e5('0x6a')]=_0x44d9ff['id'];return db['CannedAnswer']['create'](_0x1cf03d['body']);}})[_0x42e5('0x38')](respondWithResult(_0x2ff615,null))[_0x42e5('0x2d')](handleError(_0x2ff615,null));};exports[_0x42e5('0x72')]=function(_0x32f5d5,_0x66a72,_0x1f1843){var _0x259b83={'raw':![],'where':{}};var _0x5713b9={};var _0x321188={'count':0x0,'rows':[]};return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x32f5d5['params']['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x66a72,null))['then'](function(_0x561a99){if(_0x561a99){_0x5713b9[_0x42e5('0x4b')]=_[_0x42e5('0x47')](db[_0x42e5('0x73')]['rawAttributes']);_0x5713b9['query']=_[_0x42e5('0x47')](_0x32f5d5['query']);_0x5713b9['filters']=_[_0x42e5('0x49')](_0x5713b9[_0x42e5('0x4b')],_0x5713b9['query']);_0x259b83[_0x42e5('0x4a')]=_[_0x42e5('0x49')](_0x5713b9[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x4c')]));_0x259b83['attributes']=_0x259b83[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x259b83[_0x42e5('0x4a')]:_0x5713b9['model'];if(!_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x4e')]('nolimit')){_0x259b83[_0x42e5('0x50')]=qs[_0x42e5('0x50')](_0x32f5d5[_0x42e5('0x46')]['limit']);_0x259b83[_0x42e5('0x33')]=qs[_0x42e5('0x33')](_0x32f5d5['query']['offset']);}_0x259b83[_0x42e5('0x51')]=qs['sort'](_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x52')]);_0x259b83[_0x42e5('0x55')]=qs[_0x42e5('0x48')](_[_0x42e5('0x53')](_0x32f5d5['query'],_0x5713b9[_0x42e5('0x48')]));_0x259b83[_0x42e5('0x55')][_0x42e5('0x6a')]=_0x561a99['id'];if(_0x32f5d5['query'][_0x42e5('0x54')]){_0x259b83[_0x42e5('0x55')]=_[_0x42e5('0x56')](_0x259b83[_0x42e5('0x55')],{'$or':_['map'](_0x259b83[_0x42e5('0x4a')],function(_0x543bba){var _0x5721a9={};_0x5721a9[_0x543bba]={'$like':'%'+_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x5721a9;})});}_0x259b83=_[_0x42e5('0x56')]({},_0x259b83,_0x32f5d5[_0x42e5('0x59')]);return db[_0x42e5('0x73')]['count']({'where':_0x259b83[_0x42e5('0x55')]})[_0x42e5('0x38')](function(_0x3be24d){_0x321188[_0x42e5('0x32')]=_0x3be24d;if(_0x32f5d5[_0x42e5('0x46')][_0x42e5('0x5e')]){_0x259b83[_0x42e5('0x5a')]=[{'all':!![]}];}return db[_0x42e5('0x73')][_0x42e5('0x5b')](_0x259b83);})['then'](function(_0xf7b3d3){_0x321188[_0x42e5('0x6e')]=_0xf7b3d3;return _0x321188;});}})[_0x42e5('0x38')](respondWithFilteredResult(_0x66a72,_0x259b83))[_0x42e5('0x2d')](handleError(_0x66a72,null));};exports[_0x42e5('0x74')]=function(_0x42c6d5,_0x39c46,_0x432105){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x42c6d5['params']['id']}})['then'](handleEntityNotFound(_0x39c46,null))['then'](function(_0x5cbf7){if(_0x5cbf7){return _0x5cbf7[_0x42e5('0x74')](_0x42c6d5['query'][_0x42e5('0x70')]);}})['then'](respondWithStatusCode(_0x39c46,null))[_0x42e5('0x2d')](handleError(_0x39c46,null));};exports['addAgents']=function(_0x4e335c,_0x4a5920,_0x275d80){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x4e335c[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x4a5920,null))['then'](function(_0x4b5500){if(_0x4b5500){return _0x4b5500[_0x42e5('0x75')](_0x4e335c[_0x42e5('0x60')][_0x42e5('0x70')],_[_0x42e5('0x76')](_0x4e335c[_0x42e5('0x60')],['ids','id'])||{})[_0x42e5('0x77')](function(_0x3d3b01){for(var _0x3ec86e=0x0;_0x3ec86e<_0x4e335c['body']['ids']['length'];_0x3ec86e+=0x1){socket[_0x42e5('0x78')]('userWhatsappAccount:save',{'UserId':_0x4e335c[_0x42e5('0x60')][_0x42e5('0x70')][_0x3ec86e],'WhatsappAccountId':_0x4e335c['params']['id']});}return _0x3d3b01;});}})[_0x42e5('0x38')](respondWithResult(_0x4a5920,null))[_0x42e5('0x2d')](handleError(_0x4a5920,null));};exports[_0x42e5('0x79')]=function(_0x5773c6,_0x106257,_0xa1efc){return db[_0x42e5('0x42')][_0x42e5('0x64')]({'where':{'id':_0x5773c6[_0x42e5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x106257,null))[_0x42e5('0x38')](function(_0x190029){if(_0x190029){return _0x190029[_0x42e5('0x79')](_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')])['then'](function(){if(_[_0x42e5('0x7a')](_0x5773c6[_0x42e5('0x46')]['ids'])){for(var _0x2cf42b=0x0;_0x2cf42b<_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')][_0x42e5('0x4d')];_0x2cf42b+=0x1){socket[_0x42e5('0x78')](_0x42e5('0x7b'),{'UserId':Number(_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')][_0x2cf42b]),'WhatsappAccountId':Number(_0x5773c6['params']['id'])});}}else{socket[_0x42e5('0x78')](_0x42e5('0x7b'),{'UserId':Number(_0x5773c6[_0x42e5('0x46')][_0x42e5('0x70')]),'WhatsappAccountId':Number(_0x5773c6[_0x42e5('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x106257,null))[_0x42e5('0x2d')](handleError(_0x106257,null));};exports[_0x42e5('0x7c')]=function(_0x2e252a,_0x18bd47,_0x5190b0){var _0x444033={};var _0x2030a5={};var _0x1f74a3;var _0x2e54f5;return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x2e252a[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x18bd47,null))[_0x42e5('0x38')](function(_0x36cdac){if(_0x36cdac){_0x1f74a3=_0x36cdac;_0x2030a5['model']=_[_0x42e5('0x47')](db['User'][_0x42e5('0x43')]);_0x2030a5['query']=_['keys'](_0x2e252a[_0x42e5('0x46')]);_0x2030a5[_0x42e5('0x48')]=_[_0x42e5('0x49')](_0x2030a5[_0x42e5('0x4b')],_0x2030a5[_0x42e5('0x46')]);_0x444033[_0x42e5('0x4a')]=_[_0x42e5('0x49')](_0x2030a5[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x2e252a[_0x42e5('0x46')][_0x42e5('0x4c')]));_0x444033[_0x42e5('0x4a')]=_0x444033[_0x42e5('0x4a')][_0x42e5('0x4d')]?_0x444033['attributes']:_0x2030a5[_0x42e5('0x4b')];_0x444033[_0x42e5('0x51')]=qs[_0x42e5('0x52')](_0x2e252a['query'][_0x42e5('0x52')]);_0x444033['where']=qs['filters'](_[_0x42e5('0x53')](_0x2e252a[_0x42e5('0x46')],_0x2030a5['filters']));if(_0x2e252a[_0x42e5('0x46')][_0x42e5('0x54')]){_0x444033[_0x42e5('0x55')]=_['merge'](_0x444033[_0x42e5('0x55')],{'$or':_[_0x42e5('0x45')](_0x444033[_0x42e5('0x4a')],function(_0x5a7744){var _0x1f173f={};_0x1f173f[_0x5a7744]={'$like':'%'+_0x2e252a[_0x42e5('0x46')]['filter']+'%'};return _0x1f173f;})});}_0x444033=_[_0x42e5('0x56')]({},_0x444033,_0x2e252a[_0x42e5('0x59')]);return _0x1f74a3[_0x42e5('0x7c')](_0x444033);}})['then'](function(_0x22f0a8){if(_0x22f0a8){_0x2e54f5=_0x22f0a8[_0x42e5('0x4d')];if(!_0x2e252a['query'][_0x42e5('0x4e')]('nolimit')){_0x444033[_0x42e5('0x50')]=qs[_0x42e5('0x50')](_0x2e252a['query'][_0x42e5('0x50')]);_0x444033[_0x42e5('0x33')]=qs[_0x42e5('0x33')](_0x2e252a[_0x42e5('0x46')][_0x42e5('0x33')]);}return _0x1f74a3[_0x42e5('0x7c')](_0x444033);}})[_0x42e5('0x38')](function(_0xdb1042){if(_0xdb1042){return _0xdb1042?{'count':_0x2e54f5,'rows':_0xdb1042}:null;}})[_0x42e5('0x38')](respondWithResult(_0x18bd47,null))[_0x42e5('0x2d')](handleError(_0x18bd47,null));};exports[_0x42e5('0x7d')]=function(_0x44daee,_0x1d99b2,_0x5d519b){return db['WhatsappAccount'][_0x42e5('0x6d')]({'where':{'id':_0x44daee[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0x1d99b2,null))[_0x42e5('0x38')](function(_0x140f2f){if(_0x140f2f){return db[_0x42e5('0x7e')][_0x42e5('0x7f')](function(_0x4e5fc3){return db[_0x42e5('0x80')][_0x42e5('0x39')]({'where':{'WhatsappAccountId':_0x44daee[_0x42e5('0x5d')]['id']},'transaction':_0x4e5fc3})[_0x42e5('0x38')](function(_0x3e56b1){var _0x3df3d9=_['map'](_0x44daee[_0x42e5('0x60')],function(_0x2f6e12){_0x2f6e12['WhatsappAccountId']=_0x44daee[_0x42e5('0x5d')]['id'];return _0x2f6e12;});return db[_0x42e5('0x80')][_0x42e5('0x81')](_0x3df3d9,{'transaction':_0x4e5fc3});});})['then'](function(){return db[_0x42e5('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x44daee[_0x42e5('0x5d')]['id']},'order':_0x42e5('0x82')});});}})[_0x42e5('0x38')](respondWithResult(_0x1d99b2,null))['catch'](handleError(_0x1d99b2,null));};exports[_0x42e5('0x83')]=function(_0x39ef97,_0xe61208,_0x23efc9){var _0x47770d={};var _0x187013={};var _0x35f5f2;var _0x4db653;return db[_0x42e5('0x42')][_0x42e5('0x6d')]({'where':{'id':_0x39ef97[_0x42e5('0x5d')]['id']}})[_0x42e5('0x38')](handleEntityNotFound(_0xe61208,null))[_0x42e5('0x38')](function(_0x584da4){if(_0x584da4){_0x35f5f2=_0x584da4;_0x187013[_0x42e5('0x4b')]=_[_0x42e5('0x47')](db[_0x42e5('0x80')]['rawAttributes']);_0x187013['query']=_[_0x42e5('0x47')](_0x39ef97['query']);_0x187013[_0x42e5('0x48')]=_['intersection'](_0x187013[_0x42e5('0x4b')],_0x187013['query']);_0x47770d['attributes']=_[_0x42e5('0x49')](_0x187013[_0x42e5('0x4b')],qs[_0x42e5('0x4c')](_0x39ef97['query'][_0x42e5('0x4c')]));_0x47770d[_0x42e5('0x4a')]=_0x47770d[_0x42e5('0x4a')]['length']?_0x47770d[_0x42e5('0x4a')]:_0x187013[_0x42e5('0x4b')];_0x47770d[_0x42e5('0x51')]=qs[_0x42e5('0x52')](_0x39ef97['query']['sort']);_0x47770d[_0x42e5('0x55')]=qs[_0x42e5('0x48')](_[_0x42e5('0x53')](_0x39ef97[_0x42e5('0x46')],_0x187013[_0x42e5('0x48')]));if(_0x39ef97[_0x42e5('0x46')]['filter']){_0x47770d[_0x42e5('0x55')]=_[_0x42e5('0x56')](_0x47770d[_0x42e5('0x55')],{'$or':_['map'](_0x47770d[_0x42e5('0x4a')],function(_0x238633){var _0x268064={};_0x268064[_0x238633]={'$like':'%'+_0x39ef97[_0x42e5('0x46')][_0x42e5('0x54')]+'%'};return _0x268064;})});}_0x47770d=_[_0x42e5('0x56')]({},_0x47770d,_0x39ef97[_0x42e5('0x59')]);return _0x35f5f2[_0x42e5('0x83')](_0x47770d);}})['then'](function(_0x5de903){if(_0x5de903){_0x4db653=_0x5de903['length'];if(!_0x39ef97[_0x42e5('0x46')][_0x42e5('0x4e')](_0x42e5('0x4f'))){_0x47770d['limit']=qs[_0x42e5('0x50')](_0x39ef97[_0x42e5('0x46')]['limit']);_0x47770d[_0x42e5('0x33')]=qs['offset'](_0x39ef97['query'][_0x42e5('0x33')]);}return _0x35f5f2[_0x42e5('0x83')](_0x47770d);}})['then'](function(_0x5d510c){if(_0x5d510c){return _0x5d510c?{'count':_0x4db653,'rows':_0x5d510c}:null;}})[_0x42e5('0x38')](respondWithResult(_0xe61208,null))[_0x42e5('0x2d')](handleError(_0xe61208,null));};exports[_0x42e5('0x84')]=function(_0xfca9e7,_0x22addd,_0x34b0f1){var _0x591e1f={'channel':_0x42e5('0x85')};var _0x49ba4d=[];var _0x5621c4=[];var _0x347698={};return db[_0x42e5('0x42')]['find']({'where':{'id':_0xfca9e7['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x22addd,null))[_0x42e5('0x38')](function(_0x140fe3){_0x591e1f['account']=_0x140fe3;_0x591e1f['applications']=_['orderBy'](_0x140fe3[_0x42e5('0x86')],[_0x42e5('0x82')],[_0x42e5('0x87')]);if(_0x591e1f[_0x42e5('0x88')]['Applications']){delete _0x591e1f[_0x42e5('0x88')]['Applications'];}return db[_0x42e5('0x89')][_0x42e5('0x69')]();})[_0x42e5('0x38')](function(_0x12b4ea){if(!_0x12b4ea){throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))](_0x42e5('0x8a'));}_0x49ba4d=_[_0x42e5('0x8b')](_[_0x42e5('0x47')](_0x12b4ea),[_0x42e5('0x8c'),'updatedAt']);_0x5621c4=_[_0x42e5('0x8b')](_[_0x42e5('0x47')](_0x12b4ea),[_0x42e5('0x8c'),_0x42e5('0x8d'),_0x42e5('0x8e'),_0x42e5('0x8f')]);_0x591e1f[_0x42e5('0x60')]={'mapKey':_0x42e5('0x90')};if(_0x591e1f['account'][_0x42e5('0x57')]&&_0x591e1f[_0x42e5('0x88')][_0x42e5('0x57')]===_0x42e5('0x91')){_0x591e1f['body'][_0x42e5('0x92')]=_0xfca9e7[_0x42e5('0x60')][_0x42e5('0x93')][_0x42e5('0x94')](_0x42e5('0x95'),'');_0x591e1f[_0x42e5('0x60')]['body']=_0xfca9e7['body'][_0x42e5('0x96')];_0x591e1f[_0x42e5('0x60')]['messageId']=_0xfca9e7[_0x42e5('0x60')][_0x42e5('0x97')];}if(_0x591e1f[_0x42e5('0x60')]['id']){delete _0x591e1f[_0x42e5('0x60')]['id'];}if(_[_0x42e5('0x98')](_0x591e1f['body'][_0x42e5('0x92')])){throw new db['Sequelize'][(_0x42e5('0x21'))](_0x42e5('0x99'));}if(_[_0x42e5('0x98')](_0x591e1f[_0x42e5('0x60')][_0x42e5('0x60')])||_0x591e1f[_0x42e5('0x60')][_0x42e5('0x60')]===''){throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x591e1f['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x42e5('0x9a')+_0x5621c4);}if(!_[_0x42e5('0x9b')](_0x5621c4,_0x591e1f[_0x42e5('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x42e5('0x21'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5621c4);}_0x347698[_0x591e1f[_0x42e5('0x60')][_0x42e5('0x9c')]]=_0x591e1f[_0x42e5('0x60')][_0x42e5('0x92')];return db[_0x42e5('0x9d')][_0x42e5('0x64')]({'where':{'id':_0x591e1f[_0x42e5('0x88')][_0x42e5('0x8f')]},'include':[{'model':db[_0x42e5('0x89')],'as':_0x42e5('0x9e'),'where':_0x347698,'limit':0x1,'order':[['updatedAt',_0x42e5('0x9f')]]}]});})[_0x42e5('0x38')](handleEntityNotFound(_0x22addd,null))[_0x42e5('0x38')](function(_0x35798b){if(_0x35798b){_0x591e1f[_0x42e5('0xa0')]=_[_0x42e5('0x76')](_0x35798b,[_0x42e5('0x9e')]);if(_0x35798b[_0x42e5('0x9e')]['length']){return _0x35798b['Contacts'][0x0];}var _0x15abfa=_[_0x42e5('0x18')](_0x591e1f['body'],{'firstName':_0x591e1f['body'][_0x42e5('0x92')],'ListId':_0x35798b['id']});_0x15abfa[_0x591e1f[_0x42e5('0x60')][_0x42e5('0x9c')]]=_0x591e1f[_0x42e5('0x60')][_0x42e5('0x92')];return db['CmContact']['create'](_0x15abfa,{'fields':_0x49ba4d,'raw':!![]});}})[_0x42e5('0x38')](handleEntityNotFound(_0x22addd,null))['then'](function(_0x28fab1){if(_0x28fab1){_0x591e1f[_0x42e5('0xa1')]=_0x28fab1;var _0xbaa50a={'ContactId':_0x28fab1['id'],'phone':_0x591e1f['body']['from'],'WhatsappAccountId':_0xfca9e7['params']['id']};var _0x234213={'ContactId':_0x28fab1['id'],'WhatsappAccountId':_0xfca9e7[_0x42e5('0x5d')]['id'],'closed':![]};return db[_0x42e5('0xa2')][_0x42e5('0x64')]({'where':_0x234213})[_0x42e5('0x38')](function(_0x125f20){if(_0x125f20){return[_0x125f20,![]];}return db['WhatsappInteraction'][_0x42e5('0x5f')](_0xbaa50a)[_0x42e5('0x38')](function(_0x3ff915){return[_0x3ff915,!![]];});});}})[_0x42e5('0x77')](function(_0x38b18c,_0x61eba){_0x591e1f[_0x42e5('0xa3')]=_0x38b18c[_0x42e5('0x3a')]({'plain':!![]});_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xa4')]=![];if(_0x61eba){if(_0x591e1f[_0x42e5('0x88')][_0x42e5('0xa5')]){_0x591e1f[_0x42e5('0xa6')][_0x42e5('0xa7')]({'id':0x0,'priority':_0x591e1f['applications'][_0x42e5('0x4d')]+0x1,'app':_0x42e5('0xa8'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xa4')]=!![];}return db[_0x42e5('0xa9')][_0x42e5('0x5f')]({'phone':_0x591e1f[_0x42e5('0x60')][_0x42e5('0x92')],'messageId':_0x591e1f['body']['messageId'],'body':_0x591e1f['body'][_0x42e5('0x60')],'WhatsappAccountId':_0xfca9e7[_0x42e5('0x5d')]['id'],'WhatsappInteractionId':_0x38b18c['id'],'direction':'in','ContactId':_0x38b18c['ContactId'],'AttachmentId':_0x591e1f['body']['AttachmentId']});})[_0x42e5('0x38')](function(_0x23551d){_0x591e1f[_0x42e5('0x2c')]=_0x23551d;if(_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xaa')]){return db[_0x42e5('0xab')]['find']({'attributes':['id',_0x42e5('0x3e')],'where':{'id':_0x591e1f[_0x42e5('0xa3')][_0x42e5('0xaa')]}})[_0x42e5('0x38')](function(_0xc1a11){if(_0xc1a11){_0x591e1f['applications'][_0x42e5('0xac')]({'id':0x0,'priority':0x0,'app':_0x42e5('0xad'),'appdata':_0xc1a11[_0x42e5('0x3e')]+','+(_0x591e1f[_0x42e5('0x88')][_0x42e5('0xae')]||0xa),'interval':_0x42e5('0xaf')});}return respondWithRpcPromise(_0x42e5('0xb0'),'startRouting',_0x591e1f);});}return respondWithRpcPromise(_0x42e5('0xb0'),_0x42e5('0xb1'),_0x591e1f);})[_0x42e5('0x38')](function(_0x52ac9b){if(_0x52ac9b){var _0x4dc094=0xc8;var _0x2e96d7=_0x42e5('0xb2');logger[_0x42e5('0x24')](_0x42e5('0x27'),_0x2e96d7,_0x4dc094,_0x42e5('0xb3'));logger[_0x42e5('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2e96d7,_0x4dc094,'entity\x20found',JSON[_0x42e5('0x29')](_0x52ac9b));if(_0x591e1f[_0x42e5('0x88')][_0x42e5('0x57')]==='twilio'){return _0x22addd[_0x42e5('0x2f')](_0x4dc094)[_0x42e5('0x34')](_0x42e5('0xb4'),_0x42e5('0xb5'))['send'](_0x42e5('0xb6'));}else{return _0x22addd[_0x42e5('0x2f')](_0x4dc094)['json'](_0x52ac9b);}}})[_0x42e5('0x2d')](handleError(_0x22addd,null));};exports[_0x42e5('0xb7')]=function(_0x112a57,_0x128122,_0x36bf71){var _0x17b370,_0x3ba5e7,_0x12f4ae;if(_[_0x42e5('0x98')](_0x112a57['body'][_0x42e5('0x60')])||_0x112a57[_0x42e5('0x60')]['body']===''){throw new db[(_0x42e5('0x20'))][(_0x42e5('0x21'))](_0x42e5('0xb8'));}if(_[_0x42e5('0x98')](_0x112a57[_0x42e5('0x60')]['to'])){throw new db[(_0x42e5('0x20'))]['ValidationError']('to\x20is\x20mandatory');}_0x17b370=_0x112a57[_0x42e5('0x60')]['to'];return db[_0x42e5('0x42')]['find']({'where':{'id':_0x112a57['params']['id']},'include':[{'model':db[_0x42e5('0x9d')],'as':_0x42e5('0xb9'),'include':[{'model':db[_0x42e5('0x89')],'as':_0x42e5('0x9e'),'where':{'mobile':_0x17b370},'limit':0x1,'order':[['updatedAt',_0x42e5('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x128122,null))[_0x42e5('0x38')](function(_0x29de97){if(_0x29de97&&_0x29de97[_0x42e5('0xb9')]){_0x3ba5e7=_0x29de97[_0x42e5('0x3a')]({'plain':!![]});if(_0x3ba5e7[_0x42e5('0xb9')]&&_0x3ba5e7[_0x42e5('0xb9')]['Contacts'][_0x42e5('0x4d')]){return _0x3ba5e7[_0x42e5('0xb9')][_0x42e5('0x9e')][0x0];}return db[_0x42e5('0x89')][_0x42e5('0x5f')](_[_0x42e5('0x18')](_0x112a57[_0x42e5('0x60')],{'firstName':_0x17b370,'mobile':_0x17b370,'phone':_0x17b370,'ListId':_0x3ba5e7[_0x42e5('0x8f')]}));}})[_0x42e5('0x38')](handleEntityNotFound(_0x128122,null))[_0x42e5('0x38')](function(_0x1b2e09){if(_0x1b2e09){_0x12f4ae=_0x1b2e09;return db[_0x42e5('0xa2')][_0x42e5('0x64')]({'where':{'ContactId':_0x12f4ae['id'],'closed':![],'WhatsappAccountId':_0x3ba5e7['id']}})[_0x42e5('0x38')](function(_0x201947){if(_0x201947){return[_0x201947,![]];}return db[_0x42e5('0xa2')][_0x42e5('0x5f')]({'UserId':_0x112a57[_0x42e5('0x61')]['id'],'ContactId':_0x12f4ae['id'],'WhatsappAccountId':_0x3ba5e7['id'],'phone':_0x17b370,'firstMsgDirection':'out','Messages':[_[_0x42e5('0x56')](_0x112a57[_0x42e5('0x60')],{'read':![],'body':_0x112a57[_0x42e5('0x60')]['body'],'phone':_0x17b370,'WhatsappAccountId':_0x3ba5e7['id'],'UserId':_0x112a57[_0x42e5('0x61')]['id'],'ContactId':_0x12f4ae['id']})]},{'include':[{'model':db[_0x42e5('0xa9')],'as':_0x42e5('0xba')}]})[_0x42e5('0x38')](function(_0x5d6771){return[_0x5d6771,!![]];});});}})[_0x42e5('0x77')](function(_0x23da35,_0x116b83){if(_0x116b83){return _0x23da35;}return db[_0x42e5('0xa9')][_0x42e5('0x5f')](_['merge'](_0x112a57[_0x42e5('0x60')],{'read':![],'body':_0x112a57[_0x42e5('0x60')][_0x42e5('0x60')],'phone':_0x17b370,'WhatsappAccountId':_0x3ba5e7['id'],'WhatsappInteractionId':_0x23da35['id'],'UserId':_0x112a57[_0x42e5('0x61')]['id'],'ContactId':_0x12f4ae['id']}))['then'](function(_0x3e2c29){_0x23da35[_0x42e5('0xbb')][_0x42e5('0xba')]=[];_0x23da35[_0x42e5('0xbb')][_0x42e5('0xba')][_0x42e5('0xa7')](_0x3e2c29[_0x42e5('0xbb')]);return _0x23da35;});})[_0x42e5('0x38')](respondWithResult(_0x128122,null))['catch'](handleError(_0x128122,null));}; \ No newline at end of file +var _0xf109=['unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','WhatsappMessage','dataValues','Messages','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','reject','save','update','destroy','get','WhatsappAccounts','name','index','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','Pause','mandatoryDispositionPause','keys','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','Disposition','findOne','hasOwnProperty','order','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','messageId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId'];(function(_0x4eca8b,_0xd59631){var _0xa77097=function(_0x4e3870){while(--_0x4e3870){_0x4eca8b['push'](_0x4eca8b['shift']());}};_0xa77097(++_0xd59631);}(_0xf109,0xce));var _0x9f10=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xf109[_0x35da42];return _0x370035;};'use strict';var pdf=require(_0x9f10('0x0'));var emlformat=require(_0x9f10('0x1'));var rimraf=require(_0x9f10('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f10('0x3'));var BPromise=require(_0x9f10('0x4'));var Mustache=require(_0x9f10('0x5'));var util=require(_0x9f10('0x6'));var path=require(_0x9f10('0x7'));var sox=require(_0x9f10('0x8'));var csv=require(_0x9f10('0x9'));var ejs=require(_0x9f10('0xa'));var fs=require('fs');var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x9'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var db=require(_0x9f10('0x17'))['db'];config['redis']=_[_0x9f10('0x18')](config[_0x9f10('0x19')],{'host':_0x9f10('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f10('0x19')]));require(_0x9f10('0x1b'))['register'](socket);var jayson=require(_0x9f10('0x1c'));var client=jayson[_0x9f10('0x1d')]['http']({'port':0x232c});function checkPasswordPattern(_0x59bcad,_0x2b6c4c,_0x177918){if(_0x177918){var _0x549217=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x549217[_0x9f10('0x1e')](_0x2b6c4c)){return _0x59bcad;}else{throw new db['Sequelize'][(_0x9f10('0x1f'))](_0x9f10('0x20'));}}else{return _0x59bcad;}}function respondWithRpcPromise(_0x4b1b8f,_0x11cc56,_0xd2950c,_0x509fba){return new BPromise(function(_0x150813,_0x53bfbd){var _0xe221d0=_0x509fba||client;return _0xe221d0['request'](_0x4b1b8f,_0xd2950c)[_0x9f10('0x21')](function(_0x56fb44){logger['info'](_0x9f10('0x22'),_0x11cc56,_0x9f10('0x23'));logger[_0x9f10('0x24')](_0x9f10('0x25'),_0x11cc56,_0x9f10('0x23'),JSON[_0x9f10('0x26')](_0x56fb44));if(_0x56fb44[_0x9f10('0x27')]){if(_0x56fb44['error'][_0x9f10('0x28')]===0x1f4){logger['error'](_0x9f10('0x22'),_0x11cc56,_0x56fb44[_0x9f10('0x27')][_0x9f10('0x29')]);return _0x53bfbd(_0x56fb44['error'][_0x9f10('0x29')]);}logger[_0x9f10('0x27')](_0x9f10('0x22'),_0x11cc56,_0x56fb44['error'][_0x9f10('0x29')]);return _0x150813(_0x56fb44[_0x9f10('0x27')][_0x9f10('0x29')]);}else{logger['info'](_0x9f10('0x22'),_0x11cc56,_0x9f10('0x23'));_0x150813(_0x56fb44[_0x9f10('0x2a')][_0x9f10('0x29')]);}})['catch'](function(_0x57539b){logger['error'](_0x9f10('0x22'),_0x11cc56,_0x57539b);_0x53bfbd(_0x57539b);});});}function respondWithStatusCode(_0x4a0407,_0x314794){_0x314794=_0x314794||0xcc;return function(_0x1de75a){if(_0x1de75a){return _0x4a0407[_0x9f10('0x2b')](_0x314794);}return _0x4a0407[_0x9f10('0x2c')](_0x314794)[_0x9f10('0x2d')]();};}function respondWithResult(_0x4f6b0c,_0x522805){_0x522805=_0x522805||0xc8;return function(_0x22814f){if(_0x22814f){return _0x4f6b0c[_0x9f10('0x2c')](_0x522805)[_0x9f10('0x2e')](_0x22814f);}};}function respondWithFilteredResult(_0x181aec,_0x2c4373){return function(_0x581b1d){if(_0x581b1d){var _0x358d3f=_0x581b1d['count'],_0x501ee=_0x2c4373[_0x9f10('0x2f')],_0x44207f=_0x2c4373[_0x9f10('0x2f')]+_0x2c4373[_0x9f10('0x30')],_0x1b03ee;if(_0x44207f>=_0x358d3f){_0x44207f=_0x358d3f;_0x1b03ee=0xc8;}else{_0x1b03ee=0xce;}_0x181aec['status'](_0x1b03ee);return _0x181aec[_0x9f10('0x31')]('Content-Range',_0x501ee+'-'+_0x44207f+'/'+_0x358d3f)[_0x9f10('0x2e')](_0x581b1d);}return null;};}function patchUpdates(_0x362cab){return function(_0x13532b){try{jsonpatch['apply'](_0x13532b,_0x362cab,!![]);}catch(_0x3ac139){return BPromise[_0x9f10('0x32')](_0x3ac139);}return _0x13532b[_0x9f10('0x33')]();};}function saveUpdates(_0x11f128,_0x148a5b){return function(_0x47bb88){if(_0x47bb88){return _0x47bb88[_0x9f10('0x34')](_0x11f128)['then'](function(_0x24d21d){return _0x24d21d;});}return null;};}function removeEntity(_0x17081c,_0x1990da){return function(_0x11ee9c){if(_0x11ee9c){return _0x11ee9c[_0x9f10('0x35')]()[_0x9f10('0x21')](function(){var _0x4b87b0=_0x11ee9c[_0x9f10('0x36')]({'plain':!![]});var _0x3a1601=_0x9f10('0x37');return db['UserProfileResource'][_0x9f10('0x35')]({'where':{'type':_0x3a1601,'resourceId':_0x4b87b0['id']}})[_0x9f10('0x21')](function(){return _0x11ee9c;});})['then'](function(){_0x17081c[_0x9f10('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x428bf0,_0x1b7a66){return function(_0x26df66){if(!_0x26df66){_0x428bf0[_0x9f10('0x2b')](0x194);}return _0x26df66;};}function handleError(_0x20605a,_0x1ba4be){_0x1ba4be=_0x1ba4be||0x1f4;return function(_0x12036c){logger[_0x9f10('0x27')](_0x12036c['stack']);if(_0x12036c[_0x9f10('0x38')]){delete _0x12036c[_0x9f10('0x38')];}_0x20605a[_0x9f10('0x2c')](_0x1ba4be)['send'](_0x12036c);};}exports[_0x9f10('0x39')]=function(_0x193b59,_0x52914c){var _0x30b04b={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x26f0ba={},_0x433c7a={'count':0x0,'rows':[]};var _0x2e4e2d=_[_0x9f10('0x3a')](db[_0x9f10('0x3b')][_0x9f10('0x3c')],function(_0x2e5e46){return{'name':_0x2e5e46[_0x9f10('0x3d')],'type':_0x2e5e46[_0x9f10('0x3e')][_0x9f10('0x3f')]};});_0x26f0ba[_0x9f10('0x40')]=_[_0x9f10('0x3a')](_0x2e4e2d,_0x9f10('0x38'));_0x26f0ba[_0x9f10('0x41')]=_['keys'](_0x193b59['query']);_0x26f0ba['filters']=_[_0x9f10('0x42')](_0x26f0ba['model'],_0x26f0ba[_0x9f10('0x41')]);_0x30b04b[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x26f0ba['model'],qs[_0x9f10('0x44')](_0x193b59[_0x9f10('0x41')][_0x9f10('0x44')]));_0x30b04b[_0x9f10('0x43')]=_0x30b04b[_0x9f10('0x43')]['length']?_0x30b04b['attributes']:_0x26f0ba['model'];if(!_0x193b59[_0x9f10('0x41')]['hasOwnProperty'](_0x9f10('0x45'))){_0x30b04b['limit']=qs[_0x9f10('0x30')](_0x193b59[_0x9f10('0x41')][_0x9f10('0x30')]);_0x30b04b[_0x9f10('0x2f')]=qs['offset'](_0x193b59[_0x9f10('0x41')][_0x9f10('0x2f')]);}_0x30b04b['order']=qs[_0x9f10('0x46')](_0x193b59[_0x9f10('0x41')][_0x9f10('0x46')]);_0x30b04b[_0x9f10('0x47')]=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0x193b59[_0x9f10('0x41')],_0x26f0ba[_0x9f10('0x48')]),_0x2e4e2d);if(_0x193b59[_0x9f10('0x41')][_0x9f10('0x4a')]){_0x30b04b['where']=_[_0x9f10('0x4b')](_0x30b04b[_0x9f10('0x47')],{'$or':_['map'](_0x2e4e2d,function(_0x403ec6){if(_0x403ec6[_0x9f10('0x3e')]!==_0x9f10('0x4c')){var _0x1807b3={};_0x1807b3[_0x403ec6['name']]={'$like':'%'+_0x193b59[_0x9f10('0x41')][_0x9f10('0x4a')]+'%'};return _0x1807b3;}})});}_0x30b04b=_[_0x9f10('0x4b')]({},_0x30b04b,_0x193b59[_0x9f10('0x4d')]);var _0x26f39a={'where':_0x30b04b[_0x9f10('0x47')]};return db['WhatsappAccount'][_0x9f10('0x4e')](_0x26f39a)[_0x9f10('0x21')](function(_0x1ba49d){_0x433c7a[_0x9f10('0x4e')]=_0x1ba49d;if(_0x193b59[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x30b04b['include']=[{'all':!![]}];}return db[_0x9f10('0x3b')][_0x9f10('0x50')](_0x30b04b);})[_0x9f10('0x21')](function(_0x14c808){_0x433c7a[_0x9f10('0x51')]=_0x14c808;return _0x433c7a;})[_0x9f10('0x21')](respondWithFilteredResult(_0x52914c,_0x30b04b))[_0x9f10('0x52')](handleError(_0x52914c,null));};exports[_0x9f10('0x53')]=function(_0x578fc6,_0xd1da11){var _0x59cf43={'raw':![],'where':{'id':_0x578fc6['params']['id']},'include':[{'model':db[_0x9f10('0x54')],'as':_0x9f10('0x55')}]},_0x26b1e8={};_0x26b1e8[_0x9f10('0x40')]=_[_0x9f10('0x56')](db[_0x9f10('0x3b')]['rawAttributes']);_0x26b1e8[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x578fc6[_0x9f10('0x41')]);_0x26b1e8[_0x9f10('0x48')]=_['intersection'](_0x26b1e8['model'],_0x26b1e8[_0x9f10('0x41')]);_0x59cf43[_0x9f10('0x43')]=_['intersection'](_0x26b1e8['model'],qs[_0x9f10('0x44')](_0x578fc6[_0x9f10('0x41')][_0x9f10('0x44')]));_0x59cf43['attributes']=_0x59cf43[_0x9f10('0x43')][_0x9f10('0x57')]?_0x59cf43[_0x9f10('0x43')]:_0x26b1e8['model'];if(_0x578fc6[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x59cf43[_0x9f10('0x58')]=[{'all':!![]}];}_0x59cf43=_['merge']({},_0x59cf43,_0x578fc6[_0x9f10('0x4d')]);return db[_0x9f10('0x3b')]['find'](_0x59cf43)[_0x9f10('0x21')](handleEntityNotFound(_0xd1da11,null))[_0x9f10('0x21')](respondWithResult(_0xd1da11,null))[_0x9f10('0x52')](handleError(_0xd1da11,null));};exports[_0x9f10('0x59')]=function(_0x334ab4,_0x55cb99){return db[_0x9f10('0x3b')]['create'](_0x334ab4['body'],{})[_0x9f10('0x21')](function(_0x19b489){var _0x1f109a=_0x334ab4[_0x9f10('0x5a')][_0x9f10('0x36')]({'plain':!![]});if(!_0x1f109a)throw new Error(_0x9f10('0x5b'));if(_0x1f109a[_0x9f10('0x5c')]==='user'){var _0x53a80c=_0x19b489[_0x9f10('0x36')]({'plain':!![]});var _0x4e5e30=_0x9f10('0x37');return db[_0x9f10('0x5d')][_0x9f10('0x5e')]({'where':{'name':_0x4e5e30,'userProfileId':_0x1f109a[_0x9f10('0x5f')]},'raw':!![]})[_0x9f10('0x21')](function(_0x526184){if(_0x526184&&_0x526184[_0x9f10('0x60')]===0x0){return db[_0x9f10('0x61')]['create']({'name':_0x53a80c[_0x9f10('0x38')],'resourceId':_0x53a80c['id'],'type':_0x526184[_0x9f10('0x38')],'sectionId':_0x526184['id']},{})['then'](function(){return _0x19b489;});}else{return _0x19b489;}})[_0x9f10('0x52')](function(_0x3542ab){logger['error'](_0x9f10('0x62'),_0x3542ab);throw _0x3542ab;});}return _0x19b489;})['then'](respondWithResult(_0x55cb99,0xc9))[_0x9f10('0x52')](handleError(_0x55cb99,null));};exports[_0x9f10('0x34')]=function(_0x1a1f7b,_0x208d48){if(_0x1a1f7b[_0x9f10('0x63')]['id']){delete _0x1a1f7b['body']['id'];}return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x1a1f7b[_0x9f10('0x64')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9f10('0x21')](handleEntityNotFound(_0x208d48,null))[_0x9f10('0x21')](saveUpdates(_0x1a1f7b[_0x9f10('0x63')],null))[_0x9f10('0x21')](respondWithResult(_0x208d48,null))[_0x9f10('0x52')](handleError(_0x208d48,null));};exports[_0x9f10('0x35')]=function(_0x2fd96b,_0x56e527){return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x2fd96b['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x56e527,null))['then'](removeEntity(_0x56e527,null))[_0x9f10('0x52')](handleError(_0x56e527,null));};exports[_0x9f10('0x65')]=function(_0x5ebfc4,_0x3f669c){return db['WhatsappAccount'][_0x9f10('0x65')]()[_0x9f10('0x21')](respondWithResult(_0x3f669c,null))[_0x9f10('0x52')](handleError(_0x3f669c,null));};exports['addDisposition']=function(_0x35bfbd,_0x53e320,_0x2d704b){if(_0x35bfbd[_0x9f10('0x63')]['id']){delete _0x35bfbd[_0x9f10('0x63')]['id'];}return db['WhatsappAccount'][_0x9f10('0x5e')]({'where':{'id':_0x35bfbd['params']['id']}})['then'](handleEntityNotFound(_0x53e320,null))[_0x9f10('0x21')](function(_0x34520c){if(_0x34520c){_0x35bfbd[_0x9f10('0x63')]['WhatsappAccountId']=_0x34520c['id'];return db[_0x9f10('0x66')]['create'](_0x35bfbd['body']);}})[_0x9f10('0x21')](respondWithResult(_0x53e320,null))['catch'](handleError(_0x53e320,null));};exports['getDispositions']=function(_0x13a2cb,_0x5302d3,_0x1a08f5){var _0x9f6f4b={'raw':![],'where':{}};var _0x42f559={};var _0x5bc191={'count':0x0,'rows':[]};return db[_0x9f10('0x3b')][_0x9f10('0x67')]({'where':{'id':_0x13a2cb['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x5302d3,null))['then'](function(_0x5bc6ce){if(_0x5bc6ce){_0x42f559[_0x9f10('0x40')]=_[_0x9f10('0x56')](db[_0x9f10('0x66')][_0x9f10('0x3c')]);_0x42f559[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x13a2cb[_0x9f10('0x41')]);_0x42f559['filters']=_[_0x9f10('0x42')](_0x42f559[_0x9f10('0x40')],_0x42f559[_0x9f10('0x41')]);_0x9f6f4b[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x42f559[_0x9f10('0x40')],qs[_0x9f10('0x44')](_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x44')]));_0x9f6f4b['attributes']=_0x9f6f4b[_0x9f10('0x43')][_0x9f10('0x57')]?_0x9f6f4b[_0x9f10('0x43')]:_0x42f559[_0x9f10('0x40')];if(!_0x13a2cb['query'][_0x9f10('0x68')](_0x9f10('0x45'))){_0x9f6f4b[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0x13a2cb['query']['limit']);_0x9f6f4b[_0x9f10('0x2f')]=qs[_0x9f10('0x2f')](_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x2f')]);}_0x9f6f4b[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x46')]);_0x9f6f4b[_0x9f10('0x47')]=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0x13a2cb[_0x9f10('0x41')],_0x42f559[_0x9f10('0x48')]));_0x9f6f4b[_0x9f10('0x47')][_0x9f10('0x6a')]=_0x5bc6ce['id'];if(_0x13a2cb['query'][_0x9f10('0x4a')]){_0x9f6f4b[_0x9f10('0x47')]=_['merge'](_0x9f6f4b[_0x9f10('0x47')],{'$or':_[_0x9f10('0x3a')](_0x9f6f4b[_0x9f10('0x43')],function(_0x24118b){var _0x515b89={};_0x515b89[_0x24118b]={'$like':'%'+_0x13a2cb[_0x9f10('0x41')]['filter']+'%'};return _0x515b89;})});}_0x9f6f4b=_[_0x9f10('0x4b')]({},_0x9f6f4b,_0x13a2cb[_0x9f10('0x4d')]);return db[_0x9f10('0x66')]['count']({'where':_0x9f6f4b[_0x9f10('0x47')]})[_0x9f10('0x21')](function(_0x4139c6){_0x5bc191['count']=_0x4139c6;if(_0x13a2cb[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x9f6f4b[_0x9f10('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x9f6f4b);})['then'](function(_0x5b78cd){_0x5bc191['rows']=_0x5b78cd;return _0x5bc191;});}})['then'](respondWithFilteredResult(_0x5302d3,_0x9f6f4b))['catch'](handleError(_0x5302d3,null));};exports[_0x9f10('0x6b')]=function(_0x2571a6,_0x4dc5d5,_0xa0988b){return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x2571a6[_0x9f10('0x64')]['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x4dc5d5,null))[_0x9f10('0x21')](function(_0x45ebcc){if(_0x45ebcc){return _0x45ebcc[_0x9f10('0x6b')](_0x2571a6[_0x9f10('0x41')][_0x9f10('0x6c')]);}})['then'](respondWithStatusCode(_0x4dc5d5,null))[_0x9f10('0x52')](handleError(_0x4dc5d5,null));};exports[_0x9f10('0x6d')]=function(_0x480978,_0x42a8bf,_0x5b2f86){if(_0x480978['body']['id']){delete _0x480978[_0x9f10('0x63')]['id'];}return db[_0x9f10('0x3b')]['find']({'where':{'id':_0x480978[_0x9f10('0x64')]['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x42a8bf,null))['then'](function(_0x3ef019){if(_0x3ef019){_0x480978[_0x9f10('0x63')][_0x9f10('0x6a')]=_0x3ef019['id'];return db['CannedAnswer'][_0x9f10('0x59')](_0x480978[_0x9f10('0x63')]);}})['then'](respondWithResult(_0x42a8bf,null))['catch'](handleError(_0x42a8bf,null));};exports[_0x9f10('0x6e')]=function(_0x3d64e8,_0x505e7a,_0x19b616){var _0x3f8cfd={'raw':![],'where':{}};var _0x4ceae4={};var _0x4db9be={'count':0x0,'rows':[]};return db[_0x9f10('0x3b')][_0x9f10('0x67')]({'where':{'id':_0x3d64e8['params']['id']}})['then'](handleEntityNotFound(_0x505e7a,null))[_0x9f10('0x21')](function(_0x13a8a8){if(_0x13a8a8){_0x4ceae4['model']=_[_0x9f10('0x56')](db[_0x9f10('0x6f')][_0x9f10('0x3c')]);_0x4ceae4[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x3d64e8['query']);_0x4ceae4['filters']=_['intersection'](_0x4ceae4[_0x9f10('0x40')],_0x4ceae4[_0x9f10('0x41')]);_0x3f8cfd[_0x9f10('0x43')]=_['intersection'](_0x4ceae4[_0x9f10('0x40')],qs['fields'](_0x3d64e8[_0x9f10('0x41')]['fields']));_0x3f8cfd['attributes']=_0x3f8cfd['attributes'][_0x9f10('0x57')]?_0x3f8cfd[_0x9f10('0x43')]:_0x4ceae4[_0x9f10('0x40')];if(!_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x68')](_0x9f10('0x45'))){_0x3f8cfd[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0x3d64e8['query'][_0x9f10('0x30')]);_0x3f8cfd[_0x9f10('0x2f')]=qs[_0x9f10('0x2f')](_0x3d64e8['query'][_0x9f10('0x2f')]);}_0x3f8cfd[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x46')]);_0x3f8cfd['where']=qs[_0x9f10('0x48')](_['pick'](_0x3d64e8[_0x9f10('0x41')],_0x4ceae4[_0x9f10('0x48')]));_0x3f8cfd['where'][_0x9f10('0x6a')]=_0x13a8a8['id'];if(_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x4a')]){_0x3f8cfd[_0x9f10('0x47')]=_['merge'](_0x3f8cfd[_0x9f10('0x47')],{'$or':_['map'](_0x3f8cfd[_0x9f10('0x43')],function(_0x40debc){var _0x4e0a49={};_0x4e0a49[_0x40debc]={'$like':'%'+_0x3d64e8['query'][_0x9f10('0x4a')]+'%'};return _0x4e0a49;})});}_0x3f8cfd=_['merge']({},_0x3f8cfd,_0x3d64e8['options']);return db['CannedAnswer'][_0x9f10('0x4e')]({'where':_0x3f8cfd[_0x9f10('0x47')]})['then'](function(_0x144567){_0x4db9be[_0x9f10('0x4e')]=_0x144567;if(_0x3d64e8[_0x9f10('0x41')][_0x9f10('0x4f')]){_0x3f8cfd[_0x9f10('0x58')]=[{'all':!![]}];}return db[_0x9f10('0x6f')][_0x9f10('0x50')](_0x3f8cfd);})[_0x9f10('0x21')](function(_0x15043f){_0x4db9be[_0x9f10('0x51')]=_0x15043f;return _0x4db9be;});}})['then'](respondWithFilteredResult(_0x505e7a,_0x3f8cfd))['catch'](handleError(_0x505e7a,null));};exports['removeAnswers']=function(_0x5bdcc3,_0x4222c6,_0xeaa529){return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x5bdcc3[_0x9f10('0x64')]['id']}})['then'](handleEntityNotFound(_0x4222c6,null))[_0x9f10('0x21')](function(_0x3dd01e){if(_0x3dd01e){return _0x3dd01e['removeAnswers'](_0x5bdcc3[_0x9f10('0x41')][_0x9f10('0x6c')]);}})[_0x9f10('0x21')](respondWithStatusCode(_0x4222c6,null))[_0x9f10('0x52')](handleError(_0x4222c6,null));};exports[_0x9f10('0x70')]=function(_0x2a9986,_0x4504bd,_0x405fca){return db[_0x9f10('0x3b')]['find']({'where':{'id':_0x2a9986['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x4504bd,null))[_0x9f10('0x21')](function(_0x45c82c){if(_0x45c82c){return _0x45c82c[_0x9f10('0x70')](_0x2a9986['body'][_0x9f10('0x6c')],_[_0x9f10('0x71')](_0x2a9986[_0x9f10('0x63')],[_0x9f10('0x6c'),'id'])||{})[_0x9f10('0x72')](function(_0x2c4ce4){for(var _0x4cc25c=0x0;_0x4cc25c<_0x2a9986['body']['ids'][_0x9f10('0x57')];_0x4cc25c+=0x1){socket[_0x9f10('0x73')](_0x9f10('0x74'),{'UserId':_0x2a9986[_0x9f10('0x63')][_0x9f10('0x6c')][_0x4cc25c],'WhatsappAccountId':_0x2a9986[_0x9f10('0x64')]['id']});}return _0x2c4ce4;});}})[_0x9f10('0x21')](respondWithResult(_0x4504bd,null))[_0x9f10('0x52')](handleError(_0x4504bd,null));};exports[_0x9f10('0x75')]=function(_0x527cb4,_0x3fd751,_0x35a005){return db[_0x9f10('0x3b')]['find']({'where':{'id':_0x527cb4[_0x9f10('0x64')]['id']}})['then'](handleEntityNotFound(_0x3fd751,null))[_0x9f10('0x21')](function(_0x257daa){if(_0x257daa){return _0x257daa['removeAgents'](_0x527cb4[_0x9f10('0x41')][_0x9f10('0x6c')])[_0x9f10('0x21')](function(){if(_[_0x9f10('0x76')](_0x527cb4[_0x9f10('0x41')]['ids'])){for(var _0x442334=0x0;_0x442334<_0x527cb4['query'][_0x9f10('0x6c')]['length'];_0x442334+=0x1){socket['emit'](_0x9f10('0x77'),{'UserId':Number(_0x527cb4[_0x9f10('0x41')][_0x9f10('0x6c')][_0x442334]),'WhatsappAccountId':Number(_0x527cb4[_0x9f10('0x64')]['id'])});}}else{socket[_0x9f10('0x73')](_0x9f10('0x77'),{'UserId':Number(_0x527cb4['query'][_0x9f10('0x6c')]),'WhatsappAccountId':Number(_0x527cb4[_0x9f10('0x64')]['id'])});}});}})[_0x9f10('0x21')](respondWithStatusCode(_0x3fd751,null))[_0x9f10('0x52')](handleError(_0x3fd751,null));};exports[_0x9f10('0x78')]=function(_0x22add9,_0xf7c500,_0x4048ca){var _0x1ea477={};var _0x204b3e={};var _0x21b883;var _0x168bf3;return db['WhatsappAccount'][_0x9f10('0x67')]({'where':{'id':_0x22add9['params']['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0xf7c500,null))[_0x9f10('0x21')](function(_0x866476){if(_0x866476){_0x21b883=_0x866476;_0x204b3e['model']=_[_0x9f10('0x56')](db[_0x9f10('0x79')][_0x9f10('0x3c')]);_0x204b3e[_0x9f10('0x41')]=_[_0x9f10('0x56')](_0x22add9[_0x9f10('0x41')]);_0x204b3e['filters']=_[_0x9f10('0x42')](_0x204b3e[_0x9f10('0x40')],_0x204b3e['query']);_0x1ea477[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x204b3e[_0x9f10('0x40')],qs[_0x9f10('0x44')](_0x22add9['query']['fields']));_0x1ea477[_0x9f10('0x43')]=_0x1ea477['attributes'][_0x9f10('0x57')]?_0x1ea477[_0x9f10('0x43')]:_0x204b3e['model'];_0x1ea477[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0x22add9[_0x9f10('0x41')][_0x9f10('0x46')]);_0x1ea477['where']=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0x22add9['query'],_0x204b3e[_0x9f10('0x48')]));if(_0x22add9['query']['filter']){_0x1ea477[_0x9f10('0x47')]=_[_0x9f10('0x4b')](_0x1ea477[_0x9f10('0x47')],{'$or':_[_0x9f10('0x3a')](_0x1ea477[_0x9f10('0x43')],function(_0x4e7496){var _0x3a1f83={};_0x3a1f83[_0x4e7496]={'$like':'%'+_0x22add9['query'][_0x9f10('0x4a')]+'%'};return _0x3a1f83;})});}_0x1ea477=_[_0x9f10('0x4b')]({},_0x1ea477,_0x22add9['options']);return _0x21b883[_0x9f10('0x78')](_0x1ea477);}})['then'](function(_0x3218b9){if(_0x3218b9){_0x168bf3=_0x3218b9[_0x9f10('0x57')];if(!_0x22add9[_0x9f10('0x41')][_0x9f10('0x68')](_0x9f10('0x45'))){_0x1ea477[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0x22add9[_0x9f10('0x41')]['limit']);_0x1ea477[_0x9f10('0x2f')]=qs[_0x9f10('0x2f')](_0x22add9[_0x9f10('0x41')][_0x9f10('0x2f')]);}return _0x21b883[_0x9f10('0x78')](_0x1ea477);}})[_0x9f10('0x21')](function(_0x21372c){if(_0x21372c){return _0x21372c?{'count':_0x168bf3,'rows':_0x21372c}:null;}})[_0x9f10('0x21')](respondWithResult(_0xf7c500,null))[_0x9f10('0x52')](handleError(_0xf7c500,null));};exports['addApplications']=function(_0x501562,_0x51a0db,_0xa2c256){return db['WhatsappAccount'][_0x9f10('0x67')]({'where':{'id':_0x501562[_0x9f10('0x64')]['id']}})['then'](handleEntityNotFound(_0x51a0db,null))[_0x9f10('0x21')](function(_0x1b48e0){if(_0x1b48e0){return db[_0x9f10('0x7a')][_0x9f10('0x7b')](function(_0x36d169){return db[_0x9f10('0x7c')][_0x9f10('0x35')]({'where':{'WhatsappAccountId':_0x501562[_0x9f10('0x64')]['id']},'transaction':_0x36d169})[_0x9f10('0x21')](function(_0x37eb7b){var _0x1bb7f5=_['map'](_0x501562[_0x9f10('0x63')],function(_0x195dca){_0x195dca[_0x9f10('0x6a')]=_0x501562[_0x9f10('0x64')]['id'];return _0x195dca;});return db['WhatsappApplication'][_0x9f10('0x7d')](_0x1bb7f5,{'transaction':_0x36d169});});})[_0x9f10('0x21')](function(){return db[_0x9f10('0x7c')][_0x9f10('0x7e')]({'where':{'WhatsappAccountId':_0x501562[_0x9f10('0x64')]['id']},'order':'priority'});});}})[_0x9f10('0x21')](respondWithResult(_0x51a0db,null))[_0x9f10('0x52')](handleError(_0x51a0db,null));};exports[_0x9f10('0x7f')]=function(_0xe1b053,_0x1e124e,_0x17bdee){var _0x12b9ec={};var _0x5da96e={};var _0x293341;var _0x5934ac;return db[_0x9f10('0x3b')][_0x9f10('0x67')]({'where':{'id':_0xe1b053[_0x9f10('0x64')]['id']}})[_0x9f10('0x21')](handleEntityNotFound(_0x1e124e,null))['then'](function(_0x4bb770){if(_0x4bb770){_0x293341=_0x4bb770;_0x5da96e[_0x9f10('0x40')]=_[_0x9f10('0x56')](db['WhatsappApplication'][_0x9f10('0x3c')]);_0x5da96e['query']=_[_0x9f10('0x56')](_0xe1b053[_0x9f10('0x41')]);_0x5da96e[_0x9f10('0x48')]=_[_0x9f10('0x42')](_0x5da96e[_0x9f10('0x40')],_0x5da96e[_0x9f10('0x41')]);_0x12b9ec[_0x9f10('0x43')]=_[_0x9f10('0x42')](_0x5da96e[_0x9f10('0x40')],qs[_0x9f10('0x44')](_0xe1b053['query']['fields']));_0x12b9ec['attributes']=_0x12b9ec[_0x9f10('0x43')][_0x9f10('0x57')]?_0x12b9ec[_0x9f10('0x43')]:_0x5da96e['model'];_0x12b9ec[_0x9f10('0x69')]=qs[_0x9f10('0x46')](_0xe1b053['query'][_0x9f10('0x46')]);_0x12b9ec[_0x9f10('0x47')]=qs[_0x9f10('0x48')](_[_0x9f10('0x49')](_0xe1b053[_0x9f10('0x41')],_0x5da96e[_0x9f10('0x48')]));if(_0xe1b053[_0x9f10('0x41')][_0x9f10('0x4a')]){_0x12b9ec[_0x9f10('0x47')]=_['merge'](_0x12b9ec[_0x9f10('0x47')],{'$or':_[_0x9f10('0x3a')](_0x12b9ec[_0x9f10('0x43')],function(_0x549b1f){var _0x1ae7e1={};_0x1ae7e1[_0x549b1f]={'$like':'%'+_0xe1b053[_0x9f10('0x41')][_0x9f10('0x4a')]+'%'};return _0x1ae7e1;})});}_0x12b9ec=_[_0x9f10('0x4b')]({},_0x12b9ec,_0xe1b053[_0x9f10('0x4d')]);return _0x293341[_0x9f10('0x7f')](_0x12b9ec);}})['then'](function(_0x30d249){if(_0x30d249){_0x5934ac=_0x30d249[_0x9f10('0x57')];if(!_0xe1b053['query'][_0x9f10('0x68')]('nolimit')){_0x12b9ec[_0x9f10('0x30')]=qs[_0x9f10('0x30')](_0xe1b053[_0x9f10('0x41')]['limit']);_0x12b9ec['offset']=qs[_0x9f10('0x2f')](_0xe1b053[_0x9f10('0x41')][_0x9f10('0x2f')]);}return _0x293341[_0x9f10('0x7f')](_0x12b9ec);}})[_0x9f10('0x21')](function(_0xe3cd33){if(_0xe3cd33){return _0xe3cd33?{'count':_0x5934ac,'rows':_0xe3cd33}:null;}})[_0x9f10('0x21')](respondWithResult(_0x1e124e,null))[_0x9f10('0x52')](handleError(_0x1e124e,null));};exports[_0x9f10('0x80')]=function(_0x598dd9,_0x2dc23f,_0x115b36){var _0x39087c={'channel':_0x9f10('0x81')};var _0x3f06ac=[];var _0xe1e75f=[];var _0xcd1fba={};return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0x598dd9[_0x9f10('0x64')]['id']},'include':[{'model':db[_0x9f10('0x7c')],'as':_0x9f10('0x82')}]})['then'](handleEntityNotFound(_0x2dc23f,null))[_0x9f10('0x21')](function(_0x54900c){_0x39087c['account']=_0x54900c;_0x39087c[_0x9f10('0x83')]=_[_0x9f10('0x84')](_0x54900c[_0x9f10('0x82')],[_0x9f10('0x85')],[_0x9f10('0x86')]);if(_0x39087c['account']['Applications']){delete _0x39087c[_0x9f10('0x87')][_0x9f10('0x82')];}return db[_0x9f10('0x88')][_0x9f10('0x65')]();})['then'](function(_0x5bc74b){if(!_0x5bc74b){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x8a'));}_0x3f06ac=_[_0x9f10('0x8b')](_[_0x9f10('0x56')](_0x5bc74b),[_0x9f10('0x8c'),'updatedAt']);_0xe1e75f=_[_0x9f10('0x8b')](_[_0x9f10('0x56')](_0x5bc74b),[_0x9f10('0x8c'),_0x9f10('0x8d'),'CompanyId',_0x9f10('0x8e')]);_0x39087c[_0x9f10('0x63')]={'mapKey':_0x9f10('0x8f')};if(_0x39087c[_0x9f10('0x87')][_0x9f10('0x3e')]&&_0x39087c[_0x9f10('0x87')][_0x9f10('0x3e')]===_0x9f10('0x90')){_0x39087c['body'][_0x9f10('0x91')]=_0x598dd9[_0x9f10('0x63')][_0x9f10('0x92')][_0x9f10('0x93')]('whatsapp:','');_0x39087c[_0x9f10('0x63')][_0x9f10('0x63')]=_0x598dd9[_0x9f10('0x63')]['Body'];_0x39087c[_0x9f10('0x63')][_0x9f10('0x94')]=_0x598dd9[_0x9f10('0x63')]['MessageSid'];}if(_0x39087c[_0x9f10('0x63')]['id']){delete _0x39087c[_0x9f10('0x63')]['id'];}if(_['isNil'](_0x39087c['body']['from'])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x95'));}if(_[_0x9f10('0x96')](_0x39087c[_0x9f10('0x63')]['body'])||_0x39087c[_0x9f10('0x63')]['body']===''){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9f10('0x96')](_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x98')+_0xe1e75f);}if(!_['includes'](_0xe1e75f,_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0x99')+_0xe1e75f);}_0xcd1fba[_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')]]=_0x39087c[_0x9f10('0x63')][_0x9f10('0x91')];return db['CmList'][_0x9f10('0x5e')]({'where':{'id':_0x39087c[_0x9f10('0x87')]['ListId']},'include':[{'model':db[_0x9f10('0x88')],'as':_0x9f10('0x9a'),'where':_0xcd1fba,'limit':0x1,'order':[[_0x9f10('0x8d'),'DESC']]}]});})[_0x9f10('0x21')](handleEntityNotFound(_0x2dc23f,null))[_0x9f10('0x21')](function(_0x2d2cc1){if(_0x2d2cc1){_0x39087c[_0x9f10('0x9b')]=_['omit'](_0x2d2cc1,['Contacts']);if(_0x2d2cc1['Contacts'][_0x9f10('0x57')]){return _0x2d2cc1[_0x9f10('0x9a')][0x0];}var _0x4ccd7a=_['defaults'](_0x39087c[_0x9f10('0x63')],{'firstName':_0x39087c['body']['from'],'ListId':_0x2d2cc1['id']});_0x4ccd7a[_0x39087c[_0x9f10('0x63')][_0x9f10('0x97')]]=_0x39087c[_0x9f10('0x63')][_0x9f10('0x91')];return db[_0x9f10('0x88')]['create'](_0x4ccd7a,{'fields':_0x3f06ac,'raw':!![]});}})[_0x9f10('0x21')](handleEntityNotFound(_0x2dc23f,null))['then'](function(_0x5782c2){if(_0x5782c2){_0x39087c[_0x9f10('0x9c')]=_0x5782c2;var _0xb658c8={'ContactId':_0x5782c2['id'],'phone':_0x39087c['body']['from'],'WhatsappAccountId':_0x598dd9[_0x9f10('0x64')]['id']};var _0xd36646={'ContactId':_0x5782c2['id'],'WhatsappAccountId':_0x598dd9[_0x9f10('0x64')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0xd36646})[_0x9f10('0x21')](function(_0x3bc4d9){if(_0x3bc4d9){return[_0x3bc4d9,![]];}return db[_0x9f10('0x9d')][_0x9f10('0x59')](_0xb658c8)[_0x9f10('0x21')](function(_0x4636fc){return[_0x4636fc,!![]];});});}})[_0x9f10('0x72')](function(_0x4853e0,_0x385f79){_0x39087c[_0x9f10('0x9e')]=_0x4853e0['get']({'plain':!![]});_0x39087c[_0x9f10('0x9e')][_0x9f10('0x9f')]=![];if(_0x385f79){if(_0x39087c['account'][_0x9f10('0xa0')]){_0x39087c[_0x9f10('0x83')][_0x9f10('0xa1')]({'id':0x0,'priority':_0x39087c[_0x9f10('0x83')][_0x9f10('0x57')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9f10('0xa2')});}_0x39087c[_0x9f10('0x9e')][_0x9f10('0x9f')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x39087c[_0x9f10('0x63')][_0x9f10('0x91')],'messageId':_0x39087c['body']['messageId'],'body':_0x39087c['body']['body'],'WhatsappAccountId':_0x598dd9[_0x9f10('0x64')]['id'],'WhatsappInteractionId':_0x4853e0['id'],'direction':'in','ContactId':_0x4853e0[_0x9f10('0xa3')],'AttachmentId':_0x39087c[_0x9f10('0x63')][_0x9f10('0xa4')]});})[_0x9f10('0x21')](function(_0x1d49c1){_0x39087c['message']=_0x1d49c1;if(_0x39087c[_0x9f10('0x9e')][_0x9f10('0xa5')]){return db[_0x9f10('0x79')][_0x9f10('0x5e')]({'attributes':['id',_0x9f10('0x38')],'where':{'id':_0x39087c[_0x9f10('0x9e')][_0x9f10('0xa5')]}})[_0x9f10('0x21')](function(_0x162f72){if(_0x162f72){_0x39087c[_0x9f10('0x83')][_0x9f10('0xa6')]({'id':0x0,'priority':0x0,'app':_0x9f10('0xa7'),'appdata':_0x162f72[_0x9f10('0x38')]+','+(_0x39087c[_0x9f10('0x87')][_0x9f10('0xa8')]||0xa),'interval':_0x9f10('0xa2')});}return respondWithRpcPromise(_0x9f10('0xa9'),'startRouting',_0x39087c);});}return respondWithRpcPromise(_0x9f10('0xa9'),_0x9f10('0xaa'),_0x39087c);})[_0x9f10('0x21')](function(_0xad8d56){if(_0xad8d56){var _0x5a7bb8=0xc8;var _0x29465f=_0x9f10('0xab');logger[_0x9f10('0xac')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x29465f,_0x5a7bb8,_0x9f10('0xad'));logger['debug'](_0x9f10('0xae'),_0x29465f,_0x5a7bb8,'entity\x20found',JSON['stringify'](_0xad8d56));if(_0x39087c[_0x9f10('0x87')]['type']===_0x9f10('0x90')){return _0x2dc23f[_0x9f10('0x2c')](_0x5a7bb8)[_0x9f10('0x31')](_0x9f10('0xaf'),'text/xml')[_0x9f10('0xb0')](_0x9f10('0xb1'));}else{return _0x2dc23f[_0x9f10('0x2c')](_0x5a7bb8)['json'](_0xad8d56);}}})[_0x9f10('0x52')](handleError(_0x2dc23f,null));};exports[_0x9f10('0xb0')]=function(_0xe27bde,_0x136a3c,_0x3334fc){var _0x25ed02,_0x3a5932,_0x492f30;if(_['isNil'](_0xe27bde['body']['body'])||_0xe27bde[_0x9f10('0x63')][_0x9f10('0x63')]===''){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0xb2'));}if(_[_0x9f10('0x96')](_0xe27bde[_0x9f10('0x63')]['to'])){throw new db[(_0x9f10('0x89'))][(_0x9f10('0x1f'))](_0x9f10('0xb3'));}_0x25ed02=_0xe27bde[_0x9f10('0x63')]['to'];return db[_0x9f10('0x3b')][_0x9f10('0x5e')]({'where':{'id':_0xe27bde[_0x9f10('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x9f10('0xb4'),'include':[{'model':db[_0x9f10('0x88')],'as':_0x9f10('0x9a'),'where':{'mobile':_0x25ed02},'limit':0x1,'order':[[_0x9f10('0x8d'),_0x9f10('0xb5')]]}]}]})['then'](handleEntityNotFound(_0x136a3c,null))[_0x9f10('0x21')](function(_0x418e34){if(_0x418e34&&_0x418e34[_0x9f10('0xb4')]){_0x3a5932=_0x418e34[_0x9f10('0x36')]({'plain':!![]});if(_0x3a5932[_0x9f10('0xb4')]&&_0x3a5932[_0x9f10('0xb4')][_0x9f10('0x9a')][_0x9f10('0x57')]){return _0x3a5932[_0x9f10('0xb4')][_0x9f10('0x9a')][0x0];}return db[_0x9f10('0x88')][_0x9f10('0x59')](_[_0x9f10('0x18')](_0xe27bde[_0x9f10('0x63')],{'firstName':_0x25ed02,'mobile':_0x25ed02,'phone':_0x25ed02,'ListId':_0x3a5932[_0x9f10('0x8e')]}));}})[_0x9f10('0x21')](handleEntityNotFound(_0x136a3c,null))[_0x9f10('0x21')](function(_0x50d895){if(_0x50d895){_0x492f30=_0x50d895;return db[_0x9f10('0x9d')]['find']({'where':{'ContactId':_0x492f30['id'],'closed':![],'WhatsappAccountId':_0x3a5932['id']}})[_0x9f10('0x21')](function(_0xc4e595){if(_0xc4e595){return[_0xc4e595,![]];}return db[_0x9f10('0x9d')]['create']({'UserId':_0xe27bde[_0x9f10('0x5a')]['id'],'ContactId':_0x492f30['id'],'WhatsappAccountId':_0x3a5932['id'],'phone':_0x25ed02,'firstMsgDirection':_0x9f10('0xb6'),'Messages':[_[_0x9f10('0x4b')](_0xe27bde['body'],{'read':![],'body':_0xe27bde[_0x9f10('0x63')][_0x9f10('0x63')],'phone':_0x25ed02,'WhatsappAccountId':_0x3a5932['id'],'UserId':_0xe27bde[_0x9f10('0x5a')]['id'],'ContactId':_0x492f30['id']})]},{'include':[{'model':db[_0x9f10('0xb7')],'as':'Messages'}]})[_0x9f10('0x21')](function(_0x4aa55a){return[_0x4aa55a,!![]];});});}})[_0x9f10('0x72')](function(_0x1a843a,_0x18b8c1){if(_0x18b8c1){return _0x1a843a;}return db[_0x9f10('0xb7')]['create'](_[_0x9f10('0x4b')](_0xe27bde[_0x9f10('0x63')],{'read':![],'body':_0xe27bde[_0x9f10('0x63')][_0x9f10('0x63')],'phone':_0x25ed02,'WhatsappAccountId':_0x3a5932['id'],'WhatsappInteractionId':_0x1a843a['id'],'UserId':_0xe27bde[_0x9f10('0x5a')]['id'],'ContactId':_0x492f30['id']}))[_0x9f10('0x21')](function(_0x1ddcc2){_0x1a843a[_0x9f10('0xb8')][_0x9f10('0xb9')]=[];_0x1a843a['dataValues']['Messages'][_0x9f10('0xa1')](_0x1ddcc2[_0x9f10('0xb8')]);return _0x1a843a;});})[_0x9f10('0x21')](respondWithResult(_0x136a3c,null))['catch'](handleError(_0x136a3c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 53e2f2b..a498a8a 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 _0x4137=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x7413('0x0'));var WhatsappAccount=require(_0x7413('0x1'))['db'][_0x7413('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7413('0x3')](0x0);var events={'afterCreate':_0x7413('0x4'),'afterUpdate':_0x7413('0x5'),'afterDestroy':_0x7413('0x6')};function emitEvent(_0x299eea){return function(_0x258255,_0x3dc48a,_0x451a96){WhatsappAccountEvents[_0x7413('0x7')](_0x299eea+':'+_0x258255['id'],_0x258255);WhatsappAccountEvents['emit'](_0x299eea,_0x258255);_0x451a96(null);};}for(var e in events){if(events[_0x7413('0x8')](e)){var event=events[e];WhatsappAccount[_0x7413('0x9')](e,emitEvent(event));}}module[_0x7413('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0xf072=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','remove'];(function(_0x50ecca,_0xc5e72d){var _0x44b43a=function(_0xe9fcde){while(--_0xe9fcde){_0x50ecca['push'](_0x50ecca['shift']());}};_0x44b43a(++_0xc5e72d);}(_0xf072,0x1cf));var _0x2f07=function(_0x36256a,_0x3aa9d1){_0x36256a=_0x36256a-0x0;var _0x4eab9d=_0xf072[_0x36256a];return _0x4eab9d;};'use strict';var EventEmitter=require(_0x2f07('0x0'));var WhatsappAccount=require(_0x2f07('0x1'))['db'][_0x2f07('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f07('0x3'),'afterUpdate':'update','afterDestroy':_0x2f07('0x4')};function emitEvent(_0x432696){return function(_0x1536c3,_0x48d7b6,_0x1d5a33){WhatsappAccountEvents[_0x2f07('0x5')](_0x432696+':'+_0x1536c3['id'],_0x1536c3);WhatsappAccountEvents[_0x2f07('0x5')](_0x432696,_0x1536c3);_0x1d5a33(null);};}for(var e in events){if(events[_0x2f07('0x6')](e)){var event=events[e];WhatsappAccount[_0x2f07('0x7')](e,emitEvent(event));}}module[_0x2f07('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index be1ebea..75417e1 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 _0x308f=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash'];(function(_0x21b820,_0x537133){var _0x2bacfc=function(_0x299b91){while(--_0x299b91){_0x21b820['push'](_0x21b820['shift']());}};_0x2bacfc(++_0x537133);}(_0x308f,0xbc));var _0xf308=function(_0x40b4c8,_0x20c6b6){_0x40b4c8=_0x40b4c8-0x0;var _0x301728=_0x308f[_0x40b4c8];return _0x301728;};'use strict';var _=require(_0xf308('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf308('0x1'));var rp=require(_0xf308('0x2'));var fs=require('fs');var path=require(_0xf308('0x3'));var rimraf=require(_0xf308('0x4'));var config=require('../../config/environment');var attributes=require(_0xf308('0x5'));module[_0xf308('0x6')]=function(_0x4fdff9,_0x1b59e7){return _0x4fdff9[_0xf308('0x7')]('WhatsappAccount',attributes,{'tableName':_0xf308('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0374=['whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0374,0x169));var _0x4037=function(_0x2c25e1,_0x49a87a){_0x2c25e1=_0x2c25e1-0x0;var _0x49acfc=_0x0374[_0x2c25e1];return _0x49acfc;};'use strict';var _=require(_0x4037('0x0'));var util=require(_0x4037('0x1'));var logger=require(_0x4037('0x2'))(_0x4037('0x3'));var moment=require(_0x4037('0x4'));var BPromise=require(_0x4037('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4037('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4037('0x7'));module[_0x4037('0x8')]=function(_0x53874a,_0x7a72a){return _0x53874a[_0x4037('0x9')](_0x4037('0xa'),attributes,{'tableName':_0x4037('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 1cda81d..fd7322b 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 _0xf7a3=['client','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','WhatsappAccount','find','options','raw','where','attributes','include','map','model','info','ShowWhatsappAccount','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf7a3,0xac));var _0x3f7a=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xf7a3[_0x314a8c];return _0x1d4607;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f7a('0x0'));var BPromise=require(_0x3f7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f7a('0x2'));var db=require(_0x3f7a('0x3'))['db'];var utils=require(_0x3f7a('0x4'));var logger=require(_0x3f7a('0x5'))(_0x3f7a('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f7a('0x7'));var client=jayson[_0x3f7a('0x8')]['http']({'port':0x232a});config[_0x3f7a('0x9')]=_[_0x3f7a('0xa')](config[_0x3f7a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f7a('0xb'))(new Redis(config[_0x3f7a('0x9')]));require(_0x3f7a('0xc'))[_0x3f7a('0xd')](socket);function respondWithRpcPromise(_0xe8dbb8,_0x54c855,_0x424a1f){return new BPromise(function(_0x3d41d4,_0x2dbb93){return client[_0x3f7a('0xe')](_0xe8dbb8,_0x424a1f)[_0x3f7a('0xf')](function(_0x34b746){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x54c855,_0x3f7a('0x10'));logger[_0x3f7a('0x11')](_0x3f7a('0x12'),_0x54c855,'request\x20sent',JSON[_0x3f7a('0x13')](_0x34b746));if(_0x34b746['error']){if(_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x15')]===0x1f4){logger[_0x3f7a('0x14')](_0x3f7a('0x16'),_0x54c855,_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x17')]);return _0x2dbb93(_0x34b746['error']['message']);}logger['error'](_0x3f7a('0x16'),_0x54c855,_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x17')]);return _0x3d41d4(_0x34b746[_0x3f7a('0x14')][_0x3f7a('0x17')]);}else{logger['info'](_0x3f7a('0x16'),_0x54c855,'request\x20sent');_0x3d41d4(_0x34b746['result'][_0x3f7a('0x17')]);}})['catch'](function(_0x26840d){logger[_0x3f7a('0x14')](_0x3f7a('0x16'),_0x54c855,_0x26840d);_0x2dbb93(_0x26840d);});});}exports['ShowWhatsappAccount']=function(_0x20503e){var _0xcc0f8f=this;return new Promise(function(_0x3fabfa,_0x5ceb2d){return db[_0x3f7a('0x18')][_0x3f7a('0x19')]({'raw':_0x20503e[_0x3f7a('0x1a')]?_0x20503e['options'][_0x3f7a('0x1b')]===undefined?!![]:![]:!![],'where':_0x20503e['options']?_0x20503e[_0x3f7a('0x1a')][_0x3f7a('0x1c')]||null:null,'attributes':_0x20503e[_0x3f7a('0x1a')]?_0x20503e[_0x3f7a('0x1a')][_0x3f7a('0x1d')]||null:null,'include':_0x20503e['options']?_0x20503e['options'][_0x3f7a('0x1e')]?_[_0x3f7a('0x1f')](_0x20503e[_0x3f7a('0x1a')][_0x3f7a('0x1e')],function(_0x39bd0d){return{'model':db[_0x39bd0d[_0x3f7a('0x20')]],'as':_0x39bd0d['as'],'attributes':_0x39bd0d[_0x3f7a('0x1d')],'include':_0x39bd0d[_0x3f7a('0x1e')]?_[_0x3f7a('0x1f')](_0x39bd0d[_0x3f7a('0x1e')],function(_0x3ceb2d){return{'model':db[_0x3ceb2d[_0x3f7a('0x20')]],'as':_0x3ceb2d['as'],'attributes':_0x3ceb2d[_0x3f7a('0x1d')],'include':_0x3ceb2d[_0x3f7a('0x1e')]?_[_0x3f7a('0x1f')](_0x3ceb2d[_0x3f7a('0x1e')],function(_0x4ec654){return{'model':db[_0x4ec654['model']],'as':_0x4ec654['as'],'attributes':_0x4ec654[_0x3f7a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd9f3){logger[_0x3f7a('0x21')](_0x3f7a('0x22'),_0x20503e);logger[_0x3f7a('0x11')](_0x3f7a('0x22'),_0x20503e,JSON[_0x3f7a('0x13')](_0x3dd9f3));_0x3fabfa(_0x3dd9f3);})[_0x3f7a('0x23')](function(_0x471101){logger[_0x3f7a('0x14')](_0x3f7a('0x22'),_0x471101['message'],_0x20503e);_0x5ceb2d(_0xcc0f8f['error'](0x1f4,_0x471101['message']));});});}; \ No newline at end of file +var _0xb5f5=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','info','lodash','util','moment','bluebird','ioredis'];(function(_0x441658,_0x5f555b){var _0x2918e7=function(_0x3f71ef){while(--_0x3f71ef){_0x441658['push'](_0x441658['shift']());}};_0x2918e7(++_0x5f555b);}(_0xb5f5,0x177));var _0x5b5f=function(_0x342028,_0x47ad85){_0x342028=_0x342028-0x0;var _0x571d82=_0xb5f5[_0x342028];return _0x571d82;};'use strict';var _=require(_0x5b5f('0x0'));var util=require(_0x5b5f('0x1'));var moment=require(_0x5b5f('0x2'));var BPromise=require(_0x5b5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b5f('0x4'));var db=require(_0x5b5f('0x5'))['db'];var utils=require(_0x5b5f('0x6'));var logger=require(_0x5b5f('0x7'))('rpc');var config=require(_0x5b5f('0x8'));var jayson=require(_0x5b5f('0x9'));var client=jayson[_0x5b5f('0xa')][_0x5b5f('0xb')]({'port':0x232a});config[_0x5b5f('0xc')]=_[_0x5b5f('0xd')](config[_0x5b5f('0xc')],{'host':_0x5b5f('0xe'),'port':0x18eb});var socket=require(_0x5b5f('0xf'))(new Redis(config[_0x5b5f('0xc')]));require('./whatsappAccount.socket')[_0x5b5f('0x10')](socket);function respondWithRpcPromise(_0x1ca179,_0x4aab45,_0x2c8f6a){return new BPromise(function(_0x4d9dba,_0x35bbf9){return client[_0x5b5f('0x11')](_0x1ca179,_0x2c8f6a)[_0x5b5f('0x12')](function(_0x47dab7){logger['info'](_0x5b5f('0x13'),_0x4aab45,_0x5b5f('0x14'));logger[_0x5b5f('0x15')](_0x5b5f('0x16'),_0x4aab45,_0x5b5f('0x14'),JSON[_0x5b5f('0x17')](_0x47dab7));if(_0x47dab7[_0x5b5f('0x18')]){if(_0x47dab7['error']['code']===0x1f4){logger[_0x5b5f('0x18')](_0x5b5f('0x13'),_0x4aab45,_0x47dab7[_0x5b5f('0x18')][_0x5b5f('0x19')]);return _0x35bbf9(_0x47dab7[_0x5b5f('0x18')][_0x5b5f('0x19')]);}logger[_0x5b5f('0x18')](_0x5b5f('0x13'),_0x4aab45,_0x47dab7[_0x5b5f('0x18')][_0x5b5f('0x19')]);return _0x4d9dba(_0x47dab7['error']['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4aab45,'request\x20sent');_0x4d9dba(_0x47dab7[_0x5b5f('0x1a')]['message']);}})[_0x5b5f('0x1b')](function(_0x590b22){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4aab45,_0x590b22);_0x35bbf9(_0x590b22);});});}exports[_0x5b5f('0x1c')]=function(_0x3416e8){var _0x5d9455=this;return new Promise(function(_0x39e026,_0x5478cf){return db[_0x5b5f('0x1d')][_0x5b5f('0x1e')]({'raw':_0x3416e8[_0x5b5f('0x1f')]?_0x3416e8[_0x5b5f('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3416e8[_0x5b5f('0x1f')]?_0x3416e8['options'][_0x5b5f('0x20')]||null:null,'attributes':_0x3416e8['options']?_0x3416e8[_0x5b5f('0x1f')][_0x5b5f('0x21')]||null:null,'include':_0x3416e8[_0x5b5f('0x1f')]?_0x3416e8[_0x5b5f('0x1f')][_0x5b5f('0x22')]?_[_0x5b5f('0x23')](_0x3416e8[_0x5b5f('0x1f')][_0x5b5f('0x22')],function(_0x5e8970){return{'model':db[_0x5e8970[_0x5b5f('0x24')]],'as':_0x5e8970['as'],'attributes':_0x5e8970['attributes'],'include':_0x5e8970[_0x5b5f('0x22')]?_[_0x5b5f('0x23')](_0x5e8970[_0x5b5f('0x22')],function(_0x14f38b){return{'model':db[_0x14f38b[_0x5b5f('0x24')]],'as':_0x14f38b['as'],'attributes':_0x14f38b[_0x5b5f('0x21')],'include':_0x14f38b[_0x5b5f('0x22')]?_[_0x5b5f('0x23')](_0x14f38b[_0x5b5f('0x22')],function(_0x16a843){return{'model':db[_0x16a843[_0x5b5f('0x24')]],'as':_0x16a843['as'],'attributes':_0x16a843[_0x5b5f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5b5f('0x12')](function(_0x1df6cb){logger[_0x5b5f('0x25')](_0x5b5f('0x1c'),_0x3416e8);logger[_0x5b5f('0x15')](_0x5b5f('0x1c'),_0x3416e8,JSON[_0x5b5f('0x17')](_0x1df6cb));_0x39e026(_0x1df6cb);})[_0x5b5f('0x1b')](function(_0x2c7a3d){logger[_0x5b5f('0x18')](_0x5b5f('0x1c'),_0x2c7a3d[_0x5b5f('0x19')],_0x3416e8);_0x5478cf(_0x5d9455[_0x5b5f('0x18')](0x1f4,_0x2c7a3d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 763bc96..16d59ff 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 _0x47e1=['emit','./whatsappAccount.events','remove'];(function(_0x268823,_0x3f8fd8){var _0x5dedfd=function(_0x4f3a42){while(--_0x4f3a42){_0x268823['push'](_0x268823['shift']());}};_0x5dedfd(++_0x3f8fd8);}(_0x47e1,0x9a));var _0x147e=function(_0x4714aa,_0x2454cb){_0x4714aa=_0x4714aa-0x0;var _0x1a41af=_0x47e1[_0x4714aa];return _0x1a41af;};'use strict';var WhatsappAccountEvents=require(_0x147e('0x0'));var events=['save',_0x147e('0x1'),'update'];function createListener(_0x30b88f,_0x2d5bc2){return function(_0x1cf47b){_0x2d5bc2[_0x147e('0x2')](_0x30b88f,_0x1cf47b);};}function removeListener(_0x4d4b19,_0x21a588){return function(){WhatsappAccountEvents['removeListener'](_0x4d4b19,_0x21a588);};}exports['register']=function(_0x290903){for(var _0x4aeaa1=0x0,_0x442058=events['length'];_0x4aeaa1<_0x442058;_0x4aeaa1++){var _0x270e3b=events[_0x4aeaa1];var _0x216e82=createListener('whatsappAccount:'+_0x270e3b,_0x290903);WhatsappAccountEvents['on'](_0x270e3b,_0x216e82);}}; \ No newline at end of file +var _0xa3f9=['save','update','emit','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x3a4bae,_0x1f9d18){var _0x4e6283=function(_0x5281fc){while(--_0x5281fc){_0x3a4bae['push'](_0x3a4bae['shift']());}};_0x4e6283(++_0x1f9d18);}(_0xa3f9,0x1b5));var _0x9a3f=function(_0x183259,_0x1d01ba){_0x183259=_0x183259-0x0;var _0x13fc5e=_0xa3f9[_0x183259];return _0x13fc5e;};'use strict';var WhatsappAccountEvents=require(_0x9a3f('0x0'));var events=[_0x9a3f('0x1'),'remove',_0x9a3f('0x2')];function createListener(_0x5e1126,_0x1c8f8e){return function(_0x77c485){_0x1c8f8e[_0x9a3f('0x3')](_0x5e1126,_0x77c485);};}function removeListener(_0x4145c3,_0x4b3c32){return function(){WhatsappAccountEvents['removeListener'](_0x4145c3,_0x4b3c32);};}exports[_0x9a3f('0x4')]=function(_0x1b2fb8){for(var _0x332d96=0x0,_0x5e79d1=events['length'];_0x332d96<_0x5e79d1;_0x332d96++){var _0x560214=events[_0x332d96];var _0x463bd2=createListener(_0x9a3f('0x5')+_0x560214,_0x1b2fb8);WhatsappAccountEvents['on'](_0x560214,_0x463bd2);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e8d9fb2..d445f7a 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 _0xaaba=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xaaba,0x99));var _0xaaab=function(_0x2733ba,_0x5813a9){_0x2733ba=_0x2733ba-0x0;var _0x172196=_0xaaba[_0x2733ba];return _0x172196;};'use strict';var multer=require(_0xaaab('0x0'));var util=require(_0xaaab('0x1'));var path=require('path');var timeout=require(_0xaaab('0x2'));var express=require(_0xaaab('0x3'));var router=express[_0xaaab('0x4')]();var auth=require(_0xaaab('0x5'));var interaction=require(_0xaaab('0x6'));var config=require(_0xaaab('0x7'));var controller=require(_0xaaab('0x8'));router['get']('/',auth[_0xaaab('0x9')](),controller['index']);router['get'](_0xaaab('0xa'),auth['isAuthenticated'](),controller[_0xaaab('0xb')]);router[_0xaaab('0xc')]('/',auth[_0xaaab('0x9')](),controller[_0xaaab('0xd')]);router[_0xaaab('0xe')](_0xaaab('0xa'),auth[_0xaaab('0x9')](),controller[_0xaaab('0xf')]);router[_0xaaab('0x10')](_0xaaab('0xa'),auth[_0xaaab('0x9')](),controller[_0xaaab('0x11')]);module[_0xaaab('0x12')]=router; \ No newline at end of file +var _0xfee6=['./whatsappApplication.controller','get','index','/:id','show','isAuthenticated','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2fcda4,_0x5e9c40){var _0x4e0da3=function(_0xdba3d0){while(--_0xdba3d0){_0x2fcda4['push'](_0x2fcda4['shift']());}};_0x4e0da3(++_0x5e9c40);}(_0xfee6,0x1b9));var _0x6fee=function(_0x5789ec,_0x11aa96){_0x5789ec=_0x5789ec-0x0;var _0x30aacb=_0xfee6[_0x5789ec];return _0x30aacb;};'use strict';var multer=require('multer');var util=require(_0x6fee('0x0'));var path=require('path');var timeout=require(_0x6fee('0x1'));var express=require(_0x6fee('0x2'));var router=express[_0x6fee('0x3')]();var auth=require(_0x6fee('0x4'));var interaction=require(_0x6fee('0x5'));var config=require(_0x6fee('0x6'));var controller=require(_0x6fee('0x7'));router[_0x6fee('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fee('0x9')]);router['get'](_0x6fee('0xa'),auth['isAuthenticated'](),controller[_0x6fee('0xb')]);router['post']('/',auth[_0x6fee('0xc')](),controller['create']);router['put'](_0x6fee('0xa'),auth[_0x6fee('0xc')](),controller['update']);router[_0x6fee('0xd')](_0x6fee('0xa'),auth[_0x6fee('0xc')](),controller[_0x6fee('0xe')]);module[_0x6fee('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 159ce8a..c682c96 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 _0x1882=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2fc980,_0x511242){var _0x1a3792=function(_0x3bc3f7){while(--_0x3bc3f7){_0x2fc980['push'](_0x2fc980['shift']());}};_0x1a3792(++_0x511242);}(_0x1882,0x169));var _0x2188=function(_0x1d43cb,_0x4aac5d){_0x1d43cb=_0x1d43cb-0x0;var _0x39010d=_0x1882[_0x1d43cb];return _0x39010d;};'use strict';var Sequelize=require(_0x2188('0x0'));module[_0x2188('0x1')]={'priority':{'type':Sequelize[_0x2188('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2188('0x3')],'allowNull':![],'defaultValue':_0x2188('0x4')},'appdata':{'type':Sequelize[_0x2188('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2188('0x3')],'defaultValue':_0x2188('0x6')}}; \ No newline at end of file +var _0xb43c=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xb43c,0x191));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcb43('0x0'));module[_0xcb43('0x1')]={'priority':{'type':Sequelize[_0xcb43('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcb43('0x3')],'allowNull':![],'defaultValue':_0xcb43('0x4')},'appdata':{'type':Sequelize[_0xcb43('0x5')]()},'description':{'type':Sequelize[_0xcb43('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcb43('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index b0c7e31..63c48ad 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 _0xfda8=['filters','intersection','attributes','model','fields','length','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','keys','find','create','catch','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','reject','save','update','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','query'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfda8,0x9e));var _0x8fda=function(_0x27dd52,_0x1617f6){_0x27dd52=_0x27dd52-0x0;var _0x41093e=_0xfda8[_0x27dd52];return _0x41093e;};'use strict';var pdf=require(_0x8fda('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8fda('0x1'));var zipdir=require(_0x8fda('0x2'));var jsonpatch=require(_0x8fda('0x3'));var rp=require(_0x8fda('0x4'));var moment=require(_0x8fda('0x5'));var BPromise=require(_0x8fda('0x6'));var Mustache=require(_0x8fda('0x7'));var util=require('util');var path=require(_0x8fda('0x8'));var sox=require(_0x8fda('0x9'));var csv=require(_0x8fda('0xa'));var ejs=require(_0x8fda('0xb'));var fs=require('fs');var _=require(_0x8fda('0xc'));var squel=require(_0x8fda('0xd'));var crypto=require('crypto');var jsforce=require(_0x8fda('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8fda('0xf'));var Papa=require('papaparse');var Redis=require(_0x8fda('0x10'));var authService=require(_0x8fda('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8fda('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8fda('0x13'));var utils=require('../../config/utils');var config=require(_0x8fda('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184ac5,_0x3cf3b3){_0x3cf3b3=_0x3cf3b3||0xcc;return function(_0x630ce0){if(_0x630ce0){return _0x184ac5[_0x8fda('0x15')](_0x3cf3b3);}return _0x184ac5[_0x8fda('0x16')](_0x3cf3b3)[_0x8fda('0x17')]();};}function respondWithResult(_0x4f9e7e,_0x367366){_0x367366=_0x367366||0xc8;return function(_0x39f089){if(_0x39f089){return _0x4f9e7e[_0x8fda('0x16')](_0x367366)[_0x8fda('0x18')](_0x39f089);}};}function respondWithFilteredResult(_0x19bb75,_0x57cecb){return function(_0x5b04a7){if(_0x5b04a7){var _0x3b9225=_0x5b04a7['count'],_0x54b415=_0x57cecb[_0x8fda('0x19')],_0x4c8780=_0x57cecb['offset']+_0x57cecb[_0x8fda('0x1a')],_0x64e6c1;if(_0x4c8780>=_0x3b9225){_0x4c8780=_0x3b9225;_0x64e6c1=0xc8;}else{_0x64e6c1=0xce;}_0x19bb75[_0x8fda('0x16')](_0x64e6c1);return _0x19bb75[_0x8fda('0x1b')]('Content-Range',_0x54b415+'-'+_0x4c8780+'/'+_0x3b9225)[_0x8fda('0x18')](_0x5b04a7);}return null;};}function patchUpdates(_0x32e4f2){return function(_0x56fa6d){try{jsonpatch['apply'](_0x56fa6d,_0x32e4f2,!![]);}catch(_0x19350f){return BPromise[_0x8fda('0x1c')](_0x19350f);}return _0x56fa6d[_0x8fda('0x1d')]();};}function saveUpdates(_0x29ad58,_0x459f4d){return function(_0x16970f){if(_0x16970f){return _0x16970f[_0x8fda('0x1e')](_0x29ad58)[_0x8fda('0x1f')](function(_0x508df7){return _0x508df7;});}return null;};}function removeEntity(_0x200308,_0x2c2ff9){return function(_0xeb2853){if(_0xeb2853){return _0xeb2853['destroy']()[_0x8fda('0x1f')](function(){_0x200308[_0x8fda('0x16')](0xcc)[_0x8fda('0x17')]();});}};}function handleEntityNotFound(_0x3cc617,_0x5cf465){return function(_0x355c6a){if(!_0x355c6a){_0x3cc617[_0x8fda('0x15')](0x194);}return _0x355c6a;};}function handleError(_0x1236a0,_0xfad51e){_0xfad51e=_0xfad51e||0x1f4;return function(_0xff4311){logger[_0x8fda('0x20')](_0xff4311[_0x8fda('0x21')]);if(_0xff4311['name']){delete _0xff4311[_0x8fda('0x22')];}_0x1236a0[_0x8fda('0x16')](_0xfad51e)[_0x8fda('0x23')](_0xff4311);};}exports['index']=function(_0x1d2426,_0x51dd55){var _0xbfdd58={},_0x2a3b31={},_0x17aaff={'count':0x0,'rows':[]};var _0xdc335a=_[_0x8fda('0x24')](db[_0x8fda('0x25')][_0x8fda('0x26')],function(_0x8355e1){return{'name':_0x8355e1[_0x8fda('0x27')],'type':_0x8355e1[_0x8fda('0x28')][_0x8fda('0x29')]};});_0x2a3b31['model']=_[_0x8fda('0x24')](_0xdc335a,_0x8fda('0x22'));_0x2a3b31[_0x8fda('0x2a')]=_['keys'](_0x1d2426['query']);_0x2a3b31[_0x8fda('0x2b')]=_[_0x8fda('0x2c')](_0x2a3b31['model'],_0x2a3b31[_0x8fda('0x2a')]);_0xbfdd58[_0x8fda('0x2d')]=_[_0x8fda('0x2c')](_0x2a3b31[_0x8fda('0x2e')],qs[_0x8fda('0x2f')](_0x1d2426[_0x8fda('0x2a')]['fields']));_0xbfdd58['attributes']=_0xbfdd58[_0x8fda('0x2d')][_0x8fda('0x30')]?_0xbfdd58[_0x8fda('0x2d')]:_0x2a3b31[_0x8fda('0x2e')];if(!_0x1d2426[_0x8fda('0x2a')]['hasOwnProperty'](_0x8fda('0x31'))){_0xbfdd58[_0x8fda('0x1a')]=qs[_0x8fda('0x1a')](_0x1d2426[_0x8fda('0x2a')]['limit']);_0xbfdd58['offset']=qs[_0x8fda('0x19')](_0x1d2426['query'][_0x8fda('0x19')]);}_0xbfdd58['order']=qs[_0x8fda('0x32')](_0x1d2426[_0x8fda('0x2a')][_0x8fda('0x32')]);_0xbfdd58[_0x8fda('0x33')]=qs['filters'](_['pick'](_0x1d2426[_0x8fda('0x2a')],_0x2a3b31['filters']),_0xdc335a);if(_0x1d2426[_0x8fda('0x2a')]['filter']){_0xbfdd58[_0x8fda('0x33')]=_['merge'](_0xbfdd58[_0x8fda('0x33')],{'$or':_['map'](_0xdc335a,function(_0x461e7e){if(_0x461e7e[_0x8fda('0x28')]!==_0x8fda('0x34')){var _0x9753b3={};_0x9753b3[_0x461e7e[_0x8fda('0x22')]]={'$like':'%'+_0x1d2426[_0x8fda('0x2a')][_0x8fda('0x35')]+'%'};return _0x9753b3;}})});}_0xbfdd58=_[_0x8fda('0x36')]({},_0xbfdd58,_0x1d2426[_0x8fda('0x37')]);var _0x23dc72={'where':_0xbfdd58[_0x8fda('0x33')]};return db[_0x8fda('0x25')]['count'](_0x23dc72)[_0x8fda('0x1f')](function(_0x329d52){_0x17aaff['count']=_0x329d52;if(_0x1d2426[_0x8fda('0x2a')][_0x8fda('0x38')]){_0xbfdd58[_0x8fda('0x39')]=[{'all':!![]}];}return db[_0x8fda('0x25')][_0x8fda('0x3a')](_0xbfdd58);})[_0x8fda('0x1f')](function(_0x2966bd){_0x17aaff['rows']=_0x2966bd;return _0x17aaff;})[_0x8fda('0x1f')](respondWithFilteredResult(_0x51dd55,_0xbfdd58))['catch'](handleError(_0x51dd55,null));};exports[_0x8fda('0x3b')]=function(_0x84eae8,_0x3bfc53){var _0x1e1dda={'raw':!![],'where':{'id':_0x84eae8[_0x8fda('0x3c')]['id']}},_0x517d27={};_0x517d27['model']=_[_0x8fda('0x3d')](db['WhatsappApplication'][_0x8fda('0x26')]);_0x517d27[_0x8fda('0x2a')]=_[_0x8fda('0x3d')](_0x84eae8[_0x8fda('0x2a')]);_0x517d27['filters']=_[_0x8fda('0x2c')](_0x517d27[_0x8fda('0x2e')],_0x517d27[_0x8fda('0x2a')]);_0x1e1dda[_0x8fda('0x2d')]=_['intersection'](_0x517d27[_0x8fda('0x2e')],qs[_0x8fda('0x2f')](_0x84eae8['query'][_0x8fda('0x2f')]));_0x1e1dda[_0x8fda('0x2d')]=_0x1e1dda[_0x8fda('0x2d')]['length']?_0x1e1dda['attributes']:_0x517d27['model'];if(_0x84eae8[_0x8fda('0x2a')][_0x8fda('0x38')]){_0x1e1dda[_0x8fda('0x39')]=[{'all':!![]}];}_0x1e1dda=_[_0x8fda('0x36')]({},_0x1e1dda,_0x84eae8[_0x8fda('0x37')]);return db['WhatsappApplication'][_0x8fda('0x3e')](_0x1e1dda)[_0x8fda('0x1f')](handleEntityNotFound(_0x3bfc53,null))[_0x8fda('0x1f')](respondWithResult(_0x3bfc53,null))['catch'](handleError(_0x3bfc53,null));};exports[_0x8fda('0x3f')]=function(_0x73e03c,_0x3f8bb5){return db[_0x8fda('0x25')][_0x8fda('0x3f')](_0x73e03c['body'],{})[_0x8fda('0x1f')](respondWithResult(_0x3f8bb5,0xc9))[_0x8fda('0x40')](handleError(_0x3f8bb5,null));};exports[_0x8fda('0x1e')]=function(_0xb39e7a,_0x6ac1e2){if(_0xb39e7a[_0x8fda('0x41')]['id']){delete _0xb39e7a['body']['id'];}return db['WhatsappApplication'][_0x8fda('0x3e')]({'where':{'id':_0xb39e7a[_0x8fda('0x3c')]['id']}})['then'](handleEntityNotFound(_0x6ac1e2,null))['then'](saveUpdates(_0xb39e7a[_0x8fda('0x41')],null))[_0x8fda('0x1f')](respondWithResult(_0x6ac1e2,null))[_0x8fda('0x40')](handleError(_0x6ac1e2,null));};exports[_0x8fda('0x42')]=function(_0x504ab6,_0x5aad54){return db['WhatsappApplication']['find']({'where':{'id':_0x504ab6[_0x8fda('0x3c')]['id']}})[_0x8fda('0x1f')](handleEntityNotFound(_0x5aad54,null))[_0x8fda('0x1f')](removeEntity(_0x5aad54,null))[_0x8fda('0x40')](handleError(_0x5aad54,null));}; \ No newline at end of file +var _0x6d03=['where','filter','merge','options','includeAll','WhatsappApplication','rows','show','include','find','create','body','params','catch','html-pdf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','map','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x6d03,0x19a));var _0x36d0=function(_0x11c989,_0x48693f){_0x11c989=_0x11c989-0x0;var _0x1b988d=_0x6d03[_0x11c989];return _0x1b988d;};'use strict';var pdf=require(_0x36d0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36d0('0x2'));var moment=require(_0x36d0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x36d0('0x4'));var path=require(_0x36d0('0x5'));var sox=require(_0x36d0('0x6'));var csv=require(_0x36d0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x36d0('0x8'));var squel=require(_0x36d0('0x9'));var crypto=require('crypto');var jsforce=require(_0x36d0('0xa'));var deskjs=require(_0x36d0('0xb'));var toCsv=require(_0x36d0('0x7'));var querystring=require('querystring');var Papa=require(_0x36d0('0xc'));var Redis=require(_0x36d0('0xd'));var authService=require(_0x36d0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x36d0('0xf'));var hardwareService=require(_0x36d0('0x10'));var logger=require(_0x36d0('0x11'))(_0x36d0('0x12'));var utils=require(_0x36d0('0x13'));var config=require(_0x36d0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58a546,_0x490f56){_0x490f56=_0x490f56||0xcc;return function(_0x55ede4){if(_0x55ede4){return _0x58a546['sendStatus'](_0x490f56);}return _0x58a546['status'](_0x490f56)['end']();};}function respondWithResult(_0x1efc93,_0x3d6d9e){_0x3d6d9e=_0x3d6d9e||0xc8;return function(_0x4257cd){if(_0x4257cd){return _0x1efc93[_0x36d0('0x15')](_0x3d6d9e)[_0x36d0('0x16')](_0x4257cd);}};}function respondWithFilteredResult(_0x31c899,_0x141560){return function(_0x31df8e){if(_0x31df8e){var _0xf1621c=_0x31df8e[_0x36d0('0x17')],_0x11db26=_0x141560[_0x36d0('0x18')],_0x183943=_0x141560['offset']+_0x141560[_0x36d0('0x19')],_0x155d9b;if(_0x183943>=_0xf1621c){_0x183943=_0xf1621c;_0x155d9b=0xc8;}else{_0x155d9b=0xce;}_0x31c899[_0x36d0('0x15')](_0x155d9b);return _0x31c899['set'](_0x36d0('0x1a'),_0x11db26+'-'+_0x183943+'/'+_0xf1621c)[_0x36d0('0x16')](_0x31df8e);}return null;};}function patchUpdates(_0x80e997){return function(_0x1d19f1){try{jsonpatch[_0x36d0('0x1b')](_0x1d19f1,_0x80e997,!![]);}catch(_0x2633e8){return BPromise[_0x36d0('0x1c')](_0x2633e8);}return _0x1d19f1[_0x36d0('0x1d')]();};}function saveUpdates(_0x4cb53b,_0x169560){return function(_0x45584d){if(_0x45584d){return _0x45584d[_0x36d0('0x1e')](_0x4cb53b)[_0x36d0('0x1f')](function(_0x386fd){return _0x386fd;});}return null;};}function removeEntity(_0x52c0ac,_0x524fd7){return function(_0x7284e8){if(_0x7284e8){return _0x7284e8[_0x36d0('0x20')]()['then'](function(){_0x52c0ac[_0x36d0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f6b6d,_0x30221c){return function(_0x961b41){if(!_0x961b41){_0x1f6b6d[_0x36d0('0x21')](0x194);}return _0x961b41;};}function handleError(_0x443488,_0x5d3385){_0x5d3385=_0x5d3385||0x1f4;return function(_0x15a2d8){logger[_0x36d0('0x22')](_0x15a2d8[_0x36d0('0x23')]);if(_0x15a2d8['name']){delete _0x15a2d8['name'];}_0x443488[_0x36d0('0x15')](_0x5d3385)['send'](_0x15a2d8);};}exports['index']=function(_0x4a4cf0,_0x3a3be7){var _0x1aeb95={},_0x3141da={},_0x30a3ba={'count':0x0,'rows':[]};var _0x28f942=_[_0x36d0('0x24')](db['WhatsappApplication'][_0x36d0('0x25')],function(_0x22c6db){return{'name':_0x22c6db[_0x36d0('0x26')],'type':_0x22c6db[_0x36d0('0x27')]['key']};});_0x3141da[_0x36d0('0x28')]=_[_0x36d0('0x24')](_0x28f942,_0x36d0('0x29'));_0x3141da['query']=_[_0x36d0('0x2a')](_0x4a4cf0['query']);_0x3141da[_0x36d0('0x2b')]=_[_0x36d0('0x2c')](_0x3141da[_0x36d0('0x28')],_0x3141da[_0x36d0('0x2d')]);_0x1aeb95[_0x36d0('0x2e')]=_[_0x36d0('0x2c')](_0x3141da['model'],qs['fields'](_0x4a4cf0['query'][_0x36d0('0x2f')]));_0x1aeb95['attributes']=_0x1aeb95['attributes'][_0x36d0('0x30')]?_0x1aeb95['attributes']:_0x3141da[_0x36d0('0x28')];if(!_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x31')](_0x36d0('0x32'))){_0x1aeb95['limit']=qs[_0x36d0('0x19')](_0x4a4cf0['query']['limit']);_0x1aeb95[_0x36d0('0x18')]=qs[_0x36d0('0x18')](_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x18')]);}_0x1aeb95['order']=qs['sort'](_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x33')]);_0x1aeb95[_0x36d0('0x34')]=qs[_0x36d0('0x2b')](_['pick'](_0x4a4cf0[_0x36d0('0x2d')],_0x3141da[_0x36d0('0x2b')]),_0x28f942);if(_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x35')]){_0x1aeb95['where']=_[_0x36d0('0x36')](_0x1aeb95[_0x36d0('0x34')],{'$or':_['map'](_0x28f942,function(_0x1a67d8){if(_0x1a67d8['type']!=='VIRTUAL'){var _0x86b9ef={};_0x86b9ef[_0x1a67d8[_0x36d0('0x29')]]={'$like':'%'+_0x4a4cf0['query']['filter']+'%'};return _0x86b9ef;}})});}_0x1aeb95=_[_0x36d0('0x36')]({},_0x1aeb95,_0x4a4cf0[_0x36d0('0x37')]);var _0x15000b={'where':_0x1aeb95[_0x36d0('0x34')]};return db['WhatsappApplication'][_0x36d0('0x17')](_0x15000b)[_0x36d0('0x1f')](function(_0x35ddd4){_0x30a3ba['count']=_0x35ddd4;if(_0x4a4cf0[_0x36d0('0x2d')][_0x36d0('0x38')]){_0x1aeb95['include']=[{'all':!![]}];}return db[_0x36d0('0x39')]['findAll'](_0x1aeb95);})[_0x36d0('0x1f')](function(_0x1a8bec){_0x30a3ba[_0x36d0('0x3a')]=_0x1a8bec;return _0x30a3ba;})[_0x36d0('0x1f')](respondWithFilteredResult(_0x3a3be7,_0x1aeb95))['catch'](handleError(_0x3a3be7,null));};exports[_0x36d0('0x3b')]=function(_0x45aeb4,_0x2ff111){var _0x4580e2={'raw':!![],'where':{'id':_0x45aeb4['params']['id']}},_0x4162a0={};_0x4162a0[_0x36d0('0x28')]=_[_0x36d0('0x2a')](db[_0x36d0('0x39')][_0x36d0('0x25')]);_0x4162a0[_0x36d0('0x2d')]=_[_0x36d0('0x2a')](_0x45aeb4['query']);_0x4162a0[_0x36d0('0x2b')]=_[_0x36d0('0x2c')](_0x4162a0['model'],_0x4162a0['query']);_0x4580e2[_0x36d0('0x2e')]=_[_0x36d0('0x2c')](_0x4162a0['model'],qs[_0x36d0('0x2f')](_0x45aeb4['query'][_0x36d0('0x2f')]));_0x4580e2[_0x36d0('0x2e')]=_0x4580e2[_0x36d0('0x2e')][_0x36d0('0x30')]?_0x4580e2[_0x36d0('0x2e')]:_0x4162a0[_0x36d0('0x28')];if(_0x45aeb4['query'][_0x36d0('0x38')]){_0x4580e2[_0x36d0('0x3c')]=[{'all':!![]}];}_0x4580e2=_[_0x36d0('0x36')]({},_0x4580e2,_0x45aeb4[_0x36d0('0x37')]);return db[_0x36d0('0x39')][_0x36d0('0x3d')](_0x4580e2)[_0x36d0('0x1f')](handleEntityNotFound(_0x2ff111,null))[_0x36d0('0x1f')](respondWithResult(_0x2ff111,null))['catch'](handleError(_0x2ff111,null));};exports[_0x36d0('0x3e')]=function(_0x20edfd,_0x14e6bc){return db[_0x36d0('0x39')][_0x36d0('0x3e')](_0x20edfd['body'],{})['then'](respondWithResult(_0x14e6bc,0xc9))['catch'](handleError(_0x14e6bc,null));};exports[_0x36d0('0x1e')]=function(_0x174ab9,_0x959fa7){if(_0x174ab9['body']['id']){delete _0x174ab9[_0x36d0('0x3f')]['id'];}return db[_0x36d0('0x39')][_0x36d0('0x3d')]({'where':{'id':_0x174ab9[_0x36d0('0x40')]['id']}})['then'](handleEntityNotFound(_0x959fa7,null))[_0x36d0('0x1f')](saveUpdates(_0x174ab9[_0x36d0('0x3f')],null))[_0x36d0('0x1f')](respondWithResult(_0x959fa7,null))['catch'](handleError(_0x959fa7,null));};exports['destroy']=function(_0x1fe055,_0x2c3bdd){return db[_0x36d0('0x39')][_0x36d0('0x3d')]({'where':{'id':_0x1fe055[_0x36d0('0x40')]['id']}})[_0x36d0('0x1f')](handleEntityNotFound(_0x2c3bdd,null))['then'](removeEntity(_0x2c3bdd,null))[_0x36d0('0x41')](handleError(_0x2c3bdd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 56ef6c0..679089a 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 _0xabad=['api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x7903b1,_0x1cb471){var _0xdff432=function(_0x5e2b47){while(--_0x5e2b47){_0x7903b1['push'](_0x7903b1['shift']());}};_0xdff432(++_0x1cb471);}(_0xabad,0x150));var _0xdaba=function(_0x531a19,_0x43e019){_0x531a19=_0x531a19-0x0;var _0x4845d2=_0xabad[_0x531a19];return _0x4845d2;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var logger=require(_0xdaba('0x1'))(_0xdaba('0x2'));var moment=require(_0xdaba('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaba('0x4'));var fs=require('fs');var path=require(_0xdaba('0x5'));var rimraf=require('rimraf');var config=require(_0xdaba('0x6'));var attributes=require(_0xdaba('0x7'));module[_0xdaba('0x8')]=function(_0x387d02,_0x20fd9f){return _0x387d02[_0xdaba('0x9')](_0xdaba('0xa'),attributes,{'tableName':_0xdaba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdaba('0xc')});}; \ No newline at end of file +var _0x180d=['moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x532972,_0x23f2da){var _0x308435=function(_0x4d0ebc){while(--_0x4d0ebc){_0x532972['push'](_0x532972['shift']());}};_0x308435(++_0x23f2da);}(_0x180d,0xf9));var _0xd180=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x180d[_0x243b59];return _0x3e1676;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var logger=require(_0xd180('0x1'))(_0xd180('0x2'));var moment=require(_0xd180('0x3'));var BPromise=require(_0xd180('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd180('0x5'));var rimraf=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var attributes=require(_0xd180('0x8'));module[_0xd180('0x9')]=function(_0x44cf0b,_0x570b44){return _0x44cf0b['define'](_0xd180('0xa'),attributes,{'tableName':_0xd180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd180('0xc'),'collate':_0xd180('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2718baa..03e292d 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 _0x11e5=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x11e5,0x8b));var _0x511e=function(_0xa0aee9,_0x36c6dc){_0xa0aee9=_0xa0aee9-0x0;var _0xd912e5=_0x11e5[_0xa0aee9];return _0xd912e5;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var moment=require(_0x511e('0x1'));var BPromise=require(_0x511e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x511e('0x3'));var db=require(_0x511e('0x4'))['db'];var utils=require(_0x511e('0x5'));var logger=require('../../config/logger')(_0x511e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x511e('0x7')][_0x511e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x466dec,_0x57cac3,_0x47cf56){return new BPromise(function(_0x3ebc4b,_0xf0ba86){return client[_0x511e('0x9')](_0x466dec,_0x47cf56)[_0x511e('0xa')](function(_0x4449c4){logger[_0x511e('0xb')](_0x511e('0xc'),_0x57cac3,_0x511e('0xd'));logger[_0x511e('0xe')](_0x511e('0xf'),_0x57cac3,_0x511e('0xd'),JSON['stringify'](_0x4449c4));if(_0x4449c4[_0x511e('0x10')]){if(_0x4449c4['error']['code']===0x1f4){logger[_0x511e('0x10')](_0x511e('0xc'),_0x57cac3,_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);return _0xf0ba86(_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);}logger['error'](_0x511e('0xc'),_0x57cac3,_0x4449c4[_0x511e('0x10')]['message']);return _0x3ebc4b(_0x4449c4[_0x511e('0x10')][_0x511e('0x11')]);}else{logger['info'](_0x511e('0xc'),_0x57cac3,_0x511e('0xd'));_0x3ebc4b(_0x4449c4[_0x511e('0x12')][_0x511e('0x11')]);}})['catch'](function(_0x3e0415){logger[_0x511e('0x10')](_0x511e('0xc'),_0x57cac3,_0x3e0415);_0xf0ba86(_0x3e0415);});});} \ No newline at end of file +var _0x37cc=['http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x6ad834,_0x52a4aa){var _0x44c4d4=function(_0x175e14){while(--_0x175e14){_0x6ad834['push'](_0x6ad834['shift']());}};_0x44c4d4(++_0x52a4aa);}(_0x37cc,0x185));var _0xc37c=function(_0x3f66d8,_0xfccc95){_0x3f66d8=_0x3f66d8-0x0;var _0x3334dd=_0x37cc[_0x3f66d8];return _0x3334dd;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index cfe8b92..e6f648f 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 _0xf26a=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','express','../../components/auth/service'];(function(_0x4495c7,_0x36a025){var _0x3d0e93=function(_0x1112f3){while(--_0x1112f3){_0x4495c7['push'](_0x4495c7['shift']());}};_0x3d0e93(++_0x36a025);}(_0xf26a,0x158));var _0xaf26=function(_0x58dbcd,_0x11bccf){_0x58dbcd=_0x58dbcd-0x0;var _0x2448ea=_0xf26a[_0x58dbcd];return _0x2448ea;};'use strict';var multer=require(_0xaf26('0x0'));var util=require(_0xaf26('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaf26('0x2'));var router=express['Router']();var auth=require(_0xaf26('0x3'));var interaction=require(_0xaf26('0x4'));var config=require(_0xaf26('0x5'));var controller=require(_0xaf26('0x6'));router[_0xaf26('0x7')]('/',auth[_0xaf26('0x8')](),controller[_0xaf26('0x9')]);router[_0xaf26('0x7')](_0xaf26('0xa'),auth[_0xaf26('0x8')](),controller[_0xaf26('0xb')]);router[_0xaf26('0x7')](_0xaf26('0xc'),auth[_0xaf26('0x8')](),controller['show']);router[_0xaf26('0x7')]('/:id/messages',auth[_0xaf26('0x8')](),controller['getMessages']);router[_0xaf26('0x7')](_0xaf26('0xd'),auth[_0xaf26('0x8')](),controller[_0xaf26('0xe')]);router['post']('/',auth[_0xaf26('0x8')](),controller['create']);router[_0xaf26('0xf')](_0xaf26('0x10'),auth[_0xaf26('0x8')](),controller[_0xaf26('0x11')]);router['post'](_0xaf26('0x12'),auth[_0xaf26('0x8')](),interaction[_0xaf26('0x13')](_0xaf26('0x14'),_0xaf26('0x15')),controller['addTags']);router[_0xaf26('0x16')](_0xaf26('0xc'),auth[_0xaf26('0x8')](),interaction['tracked'](_0xaf26('0x14'),_0xaf26('0x17')),controller[_0xaf26('0x18')]);router[_0xaf26('0x19')](_0xaf26('0xc'),auth[_0xaf26('0x8')](),interaction[_0xaf26('0x13')](_0xaf26('0x14'),'whatsappinteraction:destroy'),controller[_0xaf26('0x1a')]);router['delete'](_0xaf26('0x12'),auth[_0xaf26('0x8')](),controller[_0xaf26('0x1b')]);module[_0xaf26('0x1c')]=router; \ No newline at end of file +var _0xf288=['destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','download','create','post','/:id/messages','addMessage','whatsapp','whatsappinteraction:addtags','put','tracked'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf288,0xf7));var _0x8f28=function(_0x279f6d,_0x122316){_0x279f6d=_0x279f6d-0x0;var _0x5874a5=_0xf288[_0x279f6d];return _0x5874a5;};'use strict';var multer=require(_0x8f28('0x0'));var util=require(_0x8f28('0x1'));var path=require(_0x8f28('0x2'));var timeout=require(_0x8f28('0x3'));var express=require(_0x8f28('0x4'));var router=express['Router']();var auth=require(_0x8f28('0x5'));var interaction=require(_0x8f28('0x6'));var config=require('../../config/environment');var controller=require(_0x8f28('0x7'));router['get']('/',auth[_0x8f28('0x8')](),controller[_0x8f28('0x9')]);router['get'](_0x8f28('0xa'),auth[_0x8f28('0x8')](),controller[_0x8f28('0xb')]);router[_0x8f28('0xc')](_0x8f28('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8f28('0xc')]('/:id/messages',auth[_0x8f28('0x8')](),controller['getMessages']);router[_0x8f28('0xc')]('/:id/download',auth['isAuthenticated'](),controller[_0x8f28('0xe')]);router['post']('/',auth[_0x8f28('0x8')](),controller[_0x8f28('0xf')]);router[_0x8f28('0x10')](_0x8f28('0x11'),auth[_0x8f28('0x8')](),controller[_0x8f28('0x12')]);router[_0x8f28('0x10')]('/:id/tags',auth[_0x8f28('0x8')](),interaction['tracked'](_0x8f28('0x13'),_0x8f28('0x14')),controller['addTags']);router[_0x8f28('0x15')](_0x8f28('0xd'),auth['isAuthenticated'](),interaction[_0x8f28('0x16')](_0x8f28('0x13'),'whatsappinteraction:update'),controller['update']);router['delete']('/:id',auth[_0x8f28('0x8')](),interaction['tracked'](_0x8f28('0x13'),'whatsappinteraction:destroy'),controller[_0x8f28('0x17')]);router[_0x8f28('0x18')]('/:id/tags',auth[_0x8f28('0x8')](),controller[_0x8f28('0x19')]);module[_0x8f28('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a4d483b..8bd1f5c 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 _0x186a=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x186a,0x75));var _0xa186=function(_0x2169d3,_0x333b7c){_0x2169d3=_0x2169d3-0x0;var _0x49551c=_0x186a[_0x2169d3];return _0x49551c;};'use strict';var Sequelize=require(_0xa186('0x0'));var moment=require(_0xa186('0x1'));module[_0xa186('0x2')]={'closed':{'type':Sequelize[_0xa186('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa186('0x4')]},'disposition':{'type':Sequelize[_0xa186('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa186('0x5')]},'read1stAt':{'type':Sequelize[_0xa186('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa186('0x6')]('in',_0xa186('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa186('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa186('0x6')]('in',_0xa186('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa2a8=['STRING','DATE','ENUM','out','sequelize','moment','exports'];(function(_0x2e0015,_0x4c0e16){var _0x3aff01=function(_0x505a91){while(--_0x505a91){_0x2e0015['push'](_0x2e0015['shift']());}};_0x3aff01(++_0x4c0e16);}(_0xa2a8,0x18c));var _0x8a2a=function(_0x37fb26,_0x356172){_0x37fb26=_0x37fb26-0x0;var _0x5109eb=_0xa2a8[_0x37fb26];return _0x5109eb;};'use strict';var Sequelize=require(_0x8a2a('0x0'));var moment=require(_0x8a2a('0x1'));module[_0x8a2a('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8a2a('0x3')]},'note':{'type':Sequelize[_0x8a2a('0x3')]},'phone':{'type':Sequelize[_0x8a2a('0x3')]},'read1stAt':{'type':Sequelize[_0x8a2a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8a2a('0x5')]('in',_0x8a2a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a2a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8a2a('0x5')]('in',_0x8a2a('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 86e6d86..ae11a69 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x359354,_0x441c6a){var _0x46d78d=function(_0x201a92){while(--_0x201a92){_0x359354['push'](_0x359354['shift']());}};_0x46d78d(++_0x441c6a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x19cac7,_0x335437){var _0xc7f7c5=function(_0xba83b){while(--_0xba83b){_0x19cac7['push'](_0x19cac7['shift']());}};_0xc7f7c5(++_0x335437);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a44cbef..cf66abf 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 _0x18b8=['WhatsappInteraction','../../mysqldb','WhatsappMessage','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','exports','events'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x18b8,0x1bf));var _0x818b=function(_0x4a3fd3,_0x1b2a6d){_0x4a3fd3=_0x4a3fd3-0x0;var _0x5a3226=_0x18b8[_0x4a3fd3];return _0x5a3226;};'use strict';var EventEmitter=require(_0x818b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x818b('0x1')];var WhatsappMessage=require(_0x818b('0x2'))['db'][_0x818b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x818b('0x4'),'afterUpdate':_0x818b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3302a1){return function(_0x1bffd1,_0x3f7c20,_0x411e83){_0x1bffd1[_0x818b('0x6')]({'attributes':['id'],'raw':!![]})[_0x818b('0x7')](function(_0x474eba){_0x1bffd1[_0x818b('0x8')](_0x818b('0x9'),_0x474eba[_0x818b('0xa')](function(_0x1e07b2){return{'id':_0x1e07b2['id']};}));return WhatsappMessage[_0x818b('0xb')]({'where':{'WhatsappInteractionId':_0x1bffd1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x818b('0x7')](function(_0x3c2ba2){_0x1bffd1[_0x818b('0x8')]('unreadMessages',_0x3c2ba2[_0x818b('0xc')]);WhatsappInteractionEvents[_0x818b('0xd')](_0x3302a1+':'+_0x1bffd1['id'],_0x1bffd1);WhatsappInteractionEvents['emit'](_0x3302a1,_0x1bffd1);_0x411e83(null);})['catch'](_0x411e83(null));};}for(var e in events){if(events[_0x818b('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x818b('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x02b0=['catch','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x02b0,0x1cf));var _0x002b=function(_0x6ca7bb,_0x4ef1fd){_0x6ca7bb=_0x6ca7bb-0x0;var _0x1cf86d=_0x02b0[_0x6ca7bb];return _0x1cf86d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x002b('0x0'))['db'][_0x002b('0x1')];var WhatsappMessage=require(_0x002b('0x0'))['db'][_0x002b('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x002b('0x3')](0x0);var events={'afterCreate':_0x002b('0x4'),'afterUpdate':_0x002b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10e0d4){return function(_0x53ef15,_0x3887fc,_0x3f44d7){_0x53ef15[_0x002b('0x6')]({'attributes':['id'],'raw':!![]})[_0x002b('0x7')](function(_0x5ed53e){_0x53ef15[_0x002b('0x8')]('Users',_0x5ed53e['map'](function(_0x2cff6d){return{'id':_0x2cff6d['id']};}));return WhatsappMessage[_0x002b('0x9')]({'where':{'WhatsappInteractionId':_0x53ef15['id'],'direction':'in','read':![]},'raw':!![]});})[_0x002b('0x7')](function(_0x1a5057){_0x53ef15['setDataValue'](_0x002b('0xa'),_0x1a5057[_0x002b('0xb')]);WhatsappInteractionEvents[_0x002b('0xc')](_0x10e0d4+':'+_0x53ef15['id'],_0x53ef15);WhatsappInteractionEvents[_0x002b('0xc')](_0x10e0d4,_0x53ef15);_0x3f44d7(null);})[_0x002b('0xd')](_0x3f44d7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ceb8926..46f755b 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(_0x3913c1,_0x62265f){var _0x2b3e90=function(_0x1babc8){while(--_0x1babc8){_0x3913c1['push'](_0x3913c1['shift']());}};_0x2b3e90(++_0x62265f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x43f58b,_0x223639){var _0x3c3572=function(_0x10a038){while(--_0x10a038){_0x43f58b['push'](_0x43f58b['shift']());}};_0x3c3572(++_0x223639);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index da9211d..2211b81 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 _0xc687=['catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc687,0xbd));var _0x7c68=function(_0x31b26d,_0x4d24c5){_0x31b26d=_0x31b26d-0x0;var _0x59d29c=_0xc687[_0x31b26d];return _0x59d29c;};'use strict';var _=require(_0x7c68('0x0'));var util=require('util');var moment=require(_0x7c68('0x1'));var BPromise=require(_0x7c68('0x2'));var rs=require(_0x7c68('0x3'));var fs=require('fs');var Redis=require(_0x7c68('0x4'));var db=require(_0x7c68('0x5'))['db'];var utils=require(_0x7c68('0x6'));var logger=require(_0x7c68('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c68('0x8')][_0x7c68('0x9')]({'port':0x232a});config[_0x7c68('0xa')]=_[_0x7c68('0xb')](config[_0x7c68('0xa')],{'host':_0x7c68('0xc'),'port':0x18eb});var socket=require(_0x7c68('0xd'))(new Redis(config[_0x7c68('0xa')]));require(_0x7c68('0xe'))['register'](socket);function respondWithRpcPromise(_0x172d86,_0x183ccf,_0x24d89a){return new BPromise(function(_0x2c03dc,_0x10e52d){return client[_0x7c68('0xf')](_0x172d86,_0x24d89a)[_0x7c68('0x10')](function(_0x3c7693){logger[_0x7c68('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x183ccf,_0x7c68('0x12'));logger[_0x7c68('0x13')](_0x7c68('0x14'),_0x183ccf,_0x7c68('0x12'),JSON[_0x7c68('0x15')](_0x3c7693));if(_0x3c7693[_0x7c68('0x16')]){if(_0x3c7693[_0x7c68('0x16')][_0x7c68('0x17')]===0x1f4){logger[_0x7c68('0x16')](_0x7c68('0x18'),_0x183ccf,_0x3c7693[_0x7c68('0x16')][_0x7c68('0x19')]);return _0x10e52d(_0x3c7693['error'][_0x7c68('0x19')]);}logger['error'](_0x7c68('0x18'),_0x183ccf,_0x3c7693[_0x7c68('0x16')][_0x7c68('0x19')]);return _0x2c03dc(_0x3c7693[_0x7c68('0x16')][_0x7c68('0x19')]);}else{logger[_0x7c68('0x11')](_0x7c68('0x18'),_0x183ccf,_0x7c68('0x12'));_0x2c03dc(_0x3c7693['result'][_0x7c68('0x19')]);}})[_0x7c68('0x1a')](function(_0x4f8494){logger[_0x7c68('0x16')](_0x7c68('0x18'),_0x183ccf,_0x4f8494);_0x10e52d(_0x4f8494);});});}exports[_0x7c68('0x1b')]=function(_0xd0009f){var _0x3db36b=this;return new Promise(function(_0x159ed3,_0x566497){return db['WhatsappInteraction'][_0x7c68('0x1c')](_0xd0009f[_0x7c68('0x1d')],{'raw':_0xd0009f[_0x7c68('0x1e')]?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd0009f[_0x7c68('0x1e')]?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x20')]||null:null,'attributes':_0xd0009f['options']?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x21')]||null:null,'limit':_0xd0009f[_0x7c68('0x1e')]?_0xd0009f[_0x7c68('0x1e')][_0x7c68('0x22')]||null:null})[_0x7c68('0x10')](function(_0x34f614){logger[_0x7c68('0x11')](_0x7c68('0x1b'),_0xd0009f);logger[_0x7c68('0x13')](_0x7c68('0x1b'),_0xd0009f,JSON[_0x7c68('0x15')](_0x34f614));_0x159ed3(_0x34f614);})[_0x7c68('0x1a')](function(_0x1fd6be){logger[_0x7c68('0x16')]('UpdateWhatsappInteraction',_0x1fd6be[_0x7c68('0x19')],_0xd0009f);_0x566497(_0x3db36b[_0x7c68('0x16')](0x1f4,_0x1fd6be[_0x7c68('0x19')]));});});};exports[_0x7c68('0x23')]=function(_0x1fc737){return new Promise(function(_0x376497,_0x3164d9){return db[_0x7c68('0x24')][_0x7c68('0x25')]({'where':_0x1fc737[_0x7c68('0x1e')]?_0x1fc737[_0x7c68('0x1e')][_0x7c68('0x20')]||null:null})[_0x7c68('0x10')](function(_0x4d113c){if(_0x4d113c){return _0x4d113c[_0x7c68('0x26')](_0x1fc737[_0x7c68('0x1d')]['ids'],_[_0x7c68('0x27')](_0x1fc737['body'],[_0x7c68('0x28'),'id'])||{});}})[_0x7c68('0x29')](function(_0x46e422){logger[_0x7c68('0x11')]('AddTags',_0x1fc737);logger[_0x7c68('0x13')](_0x7c68('0x2a'),_0x1fc737,JSON[_0x7c68('0x15')](_0x46e422));_0x376497(_0x46e422);})[_0x7c68('0x1a')](function(_0x4dd126){logger[_0x7c68('0x16')](_0x7c68('0x2a'),_0x4dd126['message'],_0x1fc737);_0x3164d9(_this[_0x7c68('0x16')](0x1f4,_0x4dd126[_0x7c68('0x19')]));});});}; \ No newline at end of file +var _0x5c26=['result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x98ef49,_0x26da9d){var _0x18e506=function(_0x8416e3){while(--_0x8416e3){_0x98ef49['push'](_0x98ef49['shift']());}};_0x18e506(++_0x26da9d);}(_0x5c26,0x181));var _0x65c2=function(_0x72ab12,_0x896e1){_0x72ab12=_0x72ab12-0x0;var _0x3000af=_0x5c26[_0x72ab12];return _0x3000af;};'use strict';var _=require(_0x65c2('0x0'));var util=require(_0x65c2('0x1'));var moment=require('moment');var BPromise=require(_0x65c2('0x2'));var rs=require(_0x65c2('0x3'));var fs=require('fs');var Redis=require(_0x65c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x65c2('0x5'));var logger=require(_0x65c2('0x6'))(_0x65c2('0x7'));var config=require(_0x65c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x65c2('0x9')][_0x65c2('0xa')]({'port':0x232a});config[_0x65c2('0xb')]=_[_0x65c2('0xc')](config[_0x65c2('0xb')],{'host':_0x65c2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65c2('0xb')]));require('./whatsappInteraction.socket')[_0x65c2('0xe')](socket);function respondWithRpcPromise(_0x5208af,_0x4436dc,_0x494426){return new BPromise(function(_0x56974b,_0x25c667){return client[_0x65c2('0xf')](_0x5208af,_0x494426)[_0x65c2('0x10')](function(_0x520e11){logger['info'](_0x65c2('0x11'),_0x4436dc,_0x65c2('0x12'));logger[_0x65c2('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4436dc,_0x65c2('0x12'),JSON[_0x65c2('0x14')](_0x520e11));if(_0x520e11[_0x65c2('0x15')]){if(_0x520e11[_0x65c2('0x15')][_0x65c2('0x16')]===0x1f4){logger['error'](_0x65c2('0x11'),_0x4436dc,_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);return _0x25c667(_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);}logger['error'](_0x65c2('0x11'),_0x4436dc,_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);return _0x56974b(_0x520e11[_0x65c2('0x15')][_0x65c2('0x17')]);}else{logger[_0x65c2('0x18')](_0x65c2('0x11'),_0x4436dc,'request\x20sent');_0x56974b(_0x520e11[_0x65c2('0x19')]['message']);}})[_0x65c2('0x1a')](function(_0x48f578){logger['error'](_0x65c2('0x11'),_0x4436dc,_0x48f578);_0x25c667(_0x48f578);});});}exports[_0x65c2('0x1b')]=function(_0x4666c1){var _0x372fd8=this;return new Promise(function(_0x5f4de6,_0x1e4020){return db[_0x65c2('0x1c')][_0x65c2('0x1d')](_0x4666c1[_0x65c2('0x1e')],{'raw':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x21')]||null:null,'attributes':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x22')]||null:null,'limit':_0x4666c1[_0x65c2('0x1f')]?_0x4666c1[_0x65c2('0x1f')][_0x65c2('0x23')]||null:null})['then'](function(_0x14f890){logger[_0x65c2('0x18')](_0x65c2('0x1b'),_0x4666c1);logger[_0x65c2('0x13')](_0x65c2('0x1b'),_0x4666c1,JSON['stringify'](_0x14f890));_0x5f4de6(_0x14f890);})[_0x65c2('0x1a')](function(_0x77b1f){logger[_0x65c2('0x15')](_0x65c2('0x1b'),_0x77b1f[_0x65c2('0x17')],_0x4666c1);_0x1e4020(_0x372fd8['error'](0x1f4,_0x77b1f[_0x65c2('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x57a4c4){return new Promise(function(_0xfa114b,_0x276cde){return db[_0x65c2('0x1c')][_0x65c2('0x24')]({'where':_0x57a4c4[_0x65c2('0x1f')]?_0x57a4c4[_0x65c2('0x1f')][_0x65c2('0x21')]||null:null})[_0x65c2('0x10')](function(_0x44736f){if(_0x44736f){return _0x44736f[_0x65c2('0x25')](_0x57a4c4['body']['ids'],_['omit'](_0x57a4c4['body'],[_0x65c2('0x26'),'id'])||{});}})[_0x65c2('0x27')](function(_0x5d422a){logger['info'](_0x65c2('0x28'),_0x57a4c4);logger['debug'](_0x65c2('0x28'),_0x57a4c4,JSON['stringify'](_0x5d422a));_0xfa114b(_0x5d422a);})[_0x65c2('0x1a')](function(_0x1e2093){logger['error'](_0x65c2('0x28'),_0x1e2093[_0x65c2('0x17')],_0x57a4c4);_0x276cde(_this['error'](0x1f4,_0x1e2093[_0x65c2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c7c0144..b3fa329 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 _0x8a78=['register','./whatsappInteraction.events','save','remove','update','removeListener'];(function(_0x1d1e82,_0x12b0ac){var _0x4a352c=function(_0x233858){while(--_0x233858){_0x1d1e82['push'](_0x1d1e82['shift']());}};_0x4a352c(++_0x12b0ac);}(_0x8a78,0xa9));var _0x88a7=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x8a78[_0x14d250];return _0xb991d8;};'use strict';var WhatsappInteractionEvents=require(_0x88a7('0x0'));var events=[_0x88a7('0x1'),_0x88a7('0x2'),_0x88a7('0x3')];function createListener(_0x743542,_0xf59111){return function(_0xdfc96d){_0xf59111['emit'](_0x743542,_0xdfc96d);};}function removeListener(_0x95d044,_0x1b744e){return function(){WhatsappInteractionEvents[_0x88a7('0x4')](_0x95d044,_0x1b744e);};}exports[_0x88a7('0x5')]=function(_0x5eb63f){for(var _0xa9519c=0x0,_0x4b18e1=events['length'];_0xa9519c<_0x4b18e1;_0xa9519c++){var _0x426004=events[_0xa9519c];var _0x1d0df9=createListener('whatsappInteraction:'+_0x426004,_0x5eb63f);WhatsappInteractionEvents['on'](_0x426004,_0x1d0df9);}}; \ No newline at end of file +var _0x9fca=['length','whatsappInteraction:','./whatsappInteraction.events','remove','register'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9fca,0x16f));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var WhatsappInteractionEvents=require(_0xa9fc('0x0'));var events=['save',_0xa9fc('0x1'),'update'];function createListener(_0x4858d8,_0x2aa0fd){return function(_0x2c5255){_0x2aa0fd['emit'](_0x4858d8,_0x2c5255);};}function removeListener(_0x26f7ff,_0x595667){return function(){WhatsappInteractionEvents['removeListener'](_0x26f7ff,_0x595667);};}exports[_0xa9fc('0x2')]=function(_0x5b0625){for(var _0x4958b3=0x0,_0x302f59=events[_0xa9fc('0x3')];_0x4958b3<_0x302f59;_0x4958b3++){var _0xa53d73=events[_0x4958b3];var _0x5535e8=createListener(_0xa9fc('0x4')+_0xa53d73,_0x5b0625);WhatsappInteractionEvents['on'](_0xa53d73,_0x5535e8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3b16ac0..2873153 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 _0x5c6f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','whatsapp','post','/:id/status','status','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router'];(function(_0x44a618,_0x41bbdc){var _0x331e5f=function(_0x4e7fa6){while(--_0x4e7fa6){_0x44a618['push'](_0x44a618['shift']());}};_0x331e5f(++_0x41bbdc);}(_0x5c6f,0x98));var _0xf5c6=function(_0x3102d3,_0x1b86e8){_0x3102d3=_0x3102d3-0x0;var _0x1b46ed=_0x5c6f[_0x3102d3];return _0x1b46ed;};'use strict';var multer=require('multer');var util=require(_0xf5c6('0x0'));var path=require(_0xf5c6('0x1'));var timeout=require(_0xf5c6('0x2'));var express=require('express');var router=express[_0xf5c6('0x3')]();var auth=require(_0xf5c6('0x4'));var interaction=require(_0xf5c6('0x5'));var config=require(_0xf5c6('0x6'));var controller=require(_0xf5c6('0x7'));router[_0xf5c6('0x8')]('/',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0xa')]);router[_0xf5c6('0x8')]('/describe',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0xb')]);router[_0xf5c6('0x8')](_0xf5c6('0xc'),auth[_0xf5c6('0x9')](),controller[_0xf5c6('0xd')]);router['post']('/',auth[_0xf5c6('0x9')](),interaction[_0xf5c6('0xe')](_0xf5c6('0xf'),'whatsappmessage:create'),controller['create']);router[_0xf5c6('0x10')](_0xf5c6('0x11'),controller[_0xf5c6('0x12')]);router[_0xf5c6('0x13')]('/:id',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0x14')]);router['put']('/:id/accept',auth[_0xf5c6('0x9')](),controller[_0xf5c6('0x15')]);router[_0xf5c6('0x13')](_0xf5c6('0x16'),auth[_0xf5c6('0x9')](),controller[_0xf5c6('0x17')]);router[_0xf5c6('0x18')](_0xf5c6('0xc'),auth[_0xf5c6('0x9')](),controller['destroy']);module[_0xf5c6('0x19')]=router; \ No newline at end of file +var _0xa887=['get','isAuthenticated','index','/describe','show','post','tracked','whatsapp','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x45743d,_0x136710){var _0x2c3680=function(_0x5f894b){while(--_0x5f894b){_0x45743d['push'](_0x45743d['shift']());}};_0x2c3680(++_0x136710);}(_0xa887,0x9a));var _0x7a88=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa887[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7a88('0x0'));var util=require('util');var path=require(_0x7a88('0x1'));var timeout=require(_0x7a88('0x2'));var express=require('express');var router=express[_0x7a88('0x3')]();var auth=require(_0x7a88('0x4'));var interaction=require(_0x7a88('0x5'));var config=require(_0x7a88('0x6'));var controller=require(_0x7a88('0x7'));router[_0x7a88('0x8')]('/',auth[_0x7a88('0x9')](),controller[_0x7a88('0xa')]);router[_0x7a88('0x8')](_0x7a88('0xb'),auth[_0x7a88('0x9')](),controller['describe']);router[_0x7a88('0x8')]('/:id',auth[_0x7a88('0x9')](),controller[_0x7a88('0xc')]);router[_0x7a88('0xd')]('/',auth[_0x7a88('0x9')](),interaction[_0x7a88('0xe')](_0x7a88('0xf'),'whatsappmessage:create'),controller[_0x7a88('0x10')]);router[_0x7a88('0xd')](_0x7a88('0x11'),controller[_0x7a88('0x12')]);router[_0x7a88('0x13')]('/:id',auth[_0x7a88('0x9')](),controller['update']);router[_0x7a88('0x13')](_0x7a88('0x14'),auth[_0x7a88('0x9')](),controller[_0x7a88('0x15')]);router[_0x7a88('0x13')](_0x7a88('0x16'),auth[_0x7a88('0x9')](),controller[_0x7a88('0x17')]);router[_0x7a88('0x18')](_0x7a88('0x19'),auth[_0x7a88('0x9')](),controller[_0x7a88('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8ef53b9..4bee5af 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 _0x878f=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4d4c09,_0xd16a9b){var _0x5c89d8=function(_0xb0c641){while(--_0xb0c641){_0x4d4c09['push'](_0x4d4c09['shift']());}};_0x5c89d8(++_0xd16a9b);}(_0x878f,0x124));var _0xf878=function(_0x27e8d6,_0xb78ece){_0x27e8d6=_0x27e8d6-0x0;var _0x591454=_0x878f[_0x27e8d6];return _0x591454;};'use strict';var Sequelize=require(_0xf878('0x0'));module[_0xf878('0x1')]={'body':{'type':Sequelize[_0xf878('0x2')](_0xf878('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf878('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf878('0x5')]('in',_0xf878('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf878('0x7')]},'readAt':{'type':Sequelize[_0xf878('0x8')]},'secret':{'type':Sequelize[_0xf878('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0a2c=['medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x414027,_0x525a0c){var _0x82dec9=function(_0x4c424d){while(--_0x4c424d){_0x414027['push'](_0x414027['shift']());}};_0x82dec9(++_0x525a0c);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x59c795,_0x138f0b){_0x59c795=_0x59c795-0x0;var _0x75028d=_0x0a2c[_0x59c795];return _0x75028d;};'use strict';var Sequelize=require(_0xc0a2('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xc0a2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc0a2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc0a2('0x3')]('in','out'),'defaultValue':_0xc0a2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc0a2('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc0a2('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e78e67a..437dcaa 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 _0xecca=['save','sendStatus','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','keys','include','find','body','update','params','destroy','describe','whatsapp-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','read1stAt','interaction','role','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','acceptmessage','whatsapp','agent','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','event','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x383c94,_0x2c7402){var _0x149b61=function(_0x33dac0){while(--_0x33dac0){_0x383c94['push'](_0x383c94['shift']());}};_0x149b61(++_0x2c7402);}(_0xecca,0x1d6));var _0xaecc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xecca[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0xaecc('0x0'));var emlformat=require(_0xaecc('0x1'));var rimraf=require(_0xaecc('0x2'));var zipdir=require(_0xaecc('0x3'));var jsonpatch=require(_0xaecc('0x4'));var rp=require(_0xaecc('0x5'));var moment=require(_0xaecc('0x6'));var BPromise=require(_0xaecc('0x7'));var Mustache=require(_0xaecc('0x8'));var util=require(_0xaecc('0x9'));var path=require('path');var sox=require(_0xaecc('0xa'));var csv=require('to-csv');var ejs=require(_0xaecc('0xb'));var fs=require('fs');var _=require(_0xaecc('0xc'));var squel=require(_0xaecc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaecc('0xe'));var querystring=require(_0xaecc('0xf'));var Papa=require(_0xaecc('0x10'));var Redis=require(_0xaecc('0x11'));var authService=require(_0xaecc('0x12'));var qs=require(_0xaecc('0x13'));var as=require(_0xaecc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaecc('0x15'))(_0xaecc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xaecc('0x17'))['db'];config[_0xaecc('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaecc('0x19'))(new Redis(config[_0xaecc('0x18')]));require('./whatsappMessage.socket')[_0xaecc('0x1a')](socket);var jayson=require(_0xaecc('0x1b'));var client=jayson[_0xaecc('0x1c')][_0xaecc('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x14f97c,_0x148445,_0x8c963c){if(_0x8c963c){var _0x26a05f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26a05f[_0xaecc('0x1e')](_0x148445)){return _0x14f97c;}else{throw new db[(_0xaecc('0x1f'))]['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 _0x14f97c;}}function respondWithRpcPromise(_0x57b0a7,_0x2ac8be,_0x527dd6,_0x2bc6ec){return new BPromise(function(_0x4d5cc1,_0x591858){var _0x2980b8=_0x2bc6ec||client;return _0x2980b8[_0xaecc('0x20')](_0x57b0a7,_0x527dd6)[_0xaecc('0x21')](function(_0x54a18a){logger[_0xaecc('0x22')](_0xaecc('0x23'),_0x2ac8be,_0xaecc('0x24'));logger[_0xaecc('0x25')](_0xaecc('0x26'),_0x2ac8be,_0xaecc('0x24'),JSON[_0xaecc('0x27')](_0x54a18a));if(_0x54a18a[_0xaecc('0x28')]){if(_0x54a18a[_0xaecc('0x28')][_0xaecc('0x29')]===0x1f4){logger['error'](_0xaecc('0x23'),_0x2ac8be,_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);return _0x591858(_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);}logger['error'](_0xaecc('0x23'),_0x2ac8be,_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);return _0x4d5cc1(_0x54a18a[_0xaecc('0x28')][_0xaecc('0x2a')]);}else{logger[_0xaecc('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x2ac8be,_0xaecc('0x24'));_0x4d5cc1(_0x54a18a[_0xaecc('0x2b')][_0xaecc('0x2a')]);}})[_0xaecc('0x2c')](function(_0x4362ef){logger[_0xaecc('0x28')](_0xaecc('0x23'),_0x2ac8be,_0x4362ef);_0x591858(_0x4362ef);});});}function respondWithStatusCode(_0x257116,_0x233b91){_0x233b91=_0x233b91||0xcc;return function(_0x5f3964){if(_0x5f3964){return _0x257116['sendStatus'](_0x233b91);}return _0x257116[_0xaecc('0x2d')](_0x233b91)[_0xaecc('0x2e')]();};}function respondWithResult(_0x3d67e0,_0x4ab695){_0x4ab695=_0x4ab695||0xc8;return function(_0x4ae310){if(_0x4ae310){return _0x3d67e0[_0xaecc('0x2d')](_0x4ab695)[_0xaecc('0x2f')](_0x4ae310);}};}function respondWithFilteredResult(_0x50bdf4,_0x10e5dc){return function(_0xd9a6d){if(_0xd9a6d){var _0x5bf227=_0xd9a6d[_0xaecc('0x30')],_0x556bc6=_0x10e5dc[_0xaecc('0x31')],_0x59f610=_0x10e5dc[_0xaecc('0x31')]+_0x10e5dc[_0xaecc('0x32')],_0x50e7c2;if(_0x59f610>=_0x5bf227){_0x59f610=_0x5bf227;_0x50e7c2=0xc8;}else{_0x50e7c2=0xce;}_0x50bdf4[_0xaecc('0x2d')](_0x50e7c2);return _0x50bdf4[_0xaecc('0x33')](_0xaecc('0x34'),_0x556bc6+'-'+_0x59f610+'/'+_0x5bf227)[_0xaecc('0x2f')](_0xd9a6d);}return null;};}function patchUpdates(_0x405acc){return function(_0x5169dd){try{jsonpatch[_0xaecc('0x35')](_0x5169dd,_0x405acc,!![]);}catch(_0x26dbd8){return BPromise['reject'](_0x26dbd8);}return _0x5169dd[_0xaecc('0x36')]();};}function saveUpdates(_0x4bee41,_0x12d835){return function(_0x1582d2){if(_0x1582d2){return _0x1582d2['update'](_0x4bee41)[_0xaecc('0x21')](function(_0x52b387){return _0x52b387;});}return null;};}function removeEntity(_0x2fcedf,_0x19ee62){return function(_0x2b9753){if(_0x2b9753){return _0x2b9753['destroy']()[_0xaecc('0x21')](function(){_0x2fcedf[_0xaecc('0x2d')](0xcc)[_0xaecc('0x2e')]();});}};}function handleEntityNotFound(_0x13c268,_0x2d081f){return function(_0x1b489c){if(!_0x1b489c){_0x13c268[_0xaecc('0x37')](0x194);}return _0x1b489c;};}function handleError(_0x4d8378,_0x121a7f){_0x121a7f=_0x121a7f||0x1f4;return function(_0x8cee3c){logger[_0xaecc('0x28')](_0x8cee3c['stack']);if(_0x8cee3c['name']){delete _0x8cee3c[_0xaecc('0x38')];}_0x4d8378[_0xaecc('0x2d')](_0x121a7f)[_0xaecc('0x39')](_0x8cee3c);};}exports[_0xaecc('0x3a')]=function(_0x30d375,_0x59f6ba){var _0x3d72b5={},_0xc5d502={},_0x264583={'count':0x0,'rows':[]};var _0x17d3f7=_[_0xaecc('0x3b')](db[_0xaecc('0x3c')][_0xaecc('0x3d')],function(_0x4d030b){return{'name':_0x4d030b[_0xaecc('0x3e')],'type':_0x4d030b['type']['key']};});_0xc5d502[_0xaecc('0x3f')]=_['map'](_0x17d3f7,'name');_0xc5d502[_0xaecc('0x40')]=_['keys'](_0x30d375[_0xaecc('0x40')]);_0xc5d502[_0xaecc('0x41')]=_['intersection'](_0xc5d502['model'],_0xc5d502[_0xaecc('0x40')]);_0x3d72b5[_0xaecc('0x42')]=_[_0xaecc('0x43')](_0xc5d502[_0xaecc('0x3f')],qs[_0xaecc('0x44')](_0x30d375[_0xaecc('0x40')]['fields']));_0x3d72b5['attributes']=_0x3d72b5[_0xaecc('0x42')]['length']?_0x3d72b5[_0xaecc('0x42')]:_0xc5d502[_0xaecc('0x3f')];if(!_0x30d375[_0xaecc('0x40')][_0xaecc('0x45')](_0xaecc('0x46'))){_0x3d72b5['limit']=qs[_0xaecc('0x32')](_0x30d375['query'][_0xaecc('0x32')]);_0x3d72b5[_0xaecc('0x31')]=qs[_0xaecc('0x31')](_0x30d375['query'][_0xaecc('0x31')]);}_0x3d72b5[_0xaecc('0x47')]=qs['sort'](_0x30d375[_0xaecc('0x40')][_0xaecc('0x48')]);_0x3d72b5[_0xaecc('0x49')]=qs[_0xaecc('0x41')](_[_0xaecc('0x4a')](_0x30d375['query'],_0xc5d502['filters']),_0x17d3f7);if(_0x30d375[_0xaecc('0x40')][_0xaecc('0x4b')]){_0x3d72b5['where']=_[_0xaecc('0x4c')](_0x3d72b5['where'],{'$or':_['map'](_0x17d3f7,function(_0x4060ea){if(_0x4060ea[_0xaecc('0x4d')]!==_0xaecc('0x4e')){var _0x10f3c5={};_0x10f3c5[_0x4060ea['name']]={'$like':'%'+_0x30d375['query'][_0xaecc('0x4b')]+'%'};return _0x10f3c5;}})});}_0x3d72b5=_[_0xaecc('0x4c')]({},_0x3d72b5,_0x30d375[_0xaecc('0x4f')]);var _0x5c793b={'where':_0x3d72b5[_0xaecc('0x49')]};return db[_0xaecc('0x3c')][_0xaecc('0x30')](_0x5c793b)[_0xaecc('0x21')](function(_0x3fa20a){_0x264583['count']=_0x3fa20a;if(_0x30d375[_0xaecc('0x40')][_0xaecc('0x50')]){_0x3d72b5['include']=[{'all':!![]}];}return db[_0xaecc('0x3c')][_0xaecc('0x51')](_0x3d72b5);})[_0xaecc('0x21')](function(_0x5d8a2e){_0x264583['rows']=_0x5d8a2e;return _0x264583;})[_0xaecc('0x21')](respondWithFilteredResult(_0x59f6ba,_0x3d72b5))['catch'](handleError(_0x59f6ba,null));};exports['show']=function(_0x54adef,_0x3f019c){var _0x4a0ede={'raw':!![],'where':{'id':_0x54adef['params']['id']}},_0x55742d={};_0x55742d[_0xaecc('0x3f')]=_[_0xaecc('0x52')](db['WhatsappMessage'][_0xaecc('0x3d')]);_0x55742d['query']=_[_0xaecc('0x52')](_0x54adef[_0xaecc('0x40')]);_0x55742d['filters']=_[_0xaecc('0x43')](_0x55742d[_0xaecc('0x3f')],_0x55742d[_0xaecc('0x40')]);_0x4a0ede['attributes']=_[_0xaecc('0x43')](_0x55742d['model'],qs['fields'](_0x54adef['query'][_0xaecc('0x44')]));_0x4a0ede['attributes']=_0x4a0ede[_0xaecc('0x42')]['length']?_0x4a0ede[_0xaecc('0x42')]:_0x55742d[_0xaecc('0x3f')];if(_0x54adef[_0xaecc('0x40')][_0xaecc('0x50')]){_0x4a0ede[_0xaecc('0x53')]=[{'all':!![]}];}_0x4a0ede=_[_0xaecc('0x4c')]({},_0x4a0ede,_0x54adef['options']);return db[_0xaecc('0x3c')][_0xaecc('0x54')](_0x4a0ede)[_0xaecc('0x21')](handleEntityNotFound(_0x3f019c,null))[_0xaecc('0x21')](respondWithResult(_0x3f019c,null))[_0xaecc('0x2c')](handleError(_0x3f019c,null));};exports['create']=function(_0x1b64d6,_0x3173a5){return db[_0xaecc('0x3c')]['create'](_0x1b64d6[_0xaecc('0x55')],{})[_0xaecc('0x21')](respondWithResult(_0x3173a5,0xc9))[_0xaecc('0x2c')](handleError(_0x3173a5,null));};exports[_0xaecc('0x56')]=function(_0x551900,_0x16131a){if(_0x551900[_0xaecc('0x55')]['id']){delete _0x551900[_0xaecc('0x55')]['id'];}return db[_0xaecc('0x3c')]['find']({'where':{'id':_0x551900[_0xaecc('0x57')]['id']}})[_0xaecc('0x21')](handleEntityNotFound(_0x16131a,null))[_0xaecc('0x21')](saveUpdates(_0x551900[_0xaecc('0x55')],null))[_0xaecc('0x21')](respondWithResult(_0x16131a,null))['catch'](handleError(_0x16131a,null));};exports[_0xaecc('0x58')]=function(_0x49751c,_0x43021a){return db[_0xaecc('0x3c')][_0xaecc('0x54')]({'where':{'id':_0x49751c[_0xaecc('0x57')]['id']}})[_0xaecc('0x21')](handleEntityNotFound(_0x43021a,null))[_0xaecc('0x21')](removeEntity(_0x43021a,null))[_0xaecc('0x2c')](handleError(_0x43021a,null));};exports[_0xaecc('0x59')]=function(_0x58eb63,_0x18caec){return db[_0xaecc('0x3c')][_0xaecc('0x59')]()[_0xaecc('0x21')](respondWithResult(_0x18caec,null))[_0xaecc('0x2c')](handleError(_0x18caec,null));};var interaction_log=require('../../config/logger')(_0xaecc('0x5a'));exports[_0xaecc('0x5b')]=function(_0x1089a7,_0x2ef5ed,_0x2dc52f){var _0x511996={'channel':'whatsapp'};if(_0x1089a7[_0xaecc('0x55')]['id']){delete _0x1089a7[_0xaecc('0x55')]['id'];}_0x1089a7['body'][_0xaecc('0x5c')]=!![];_0x1089a7[_0xaecc('0x55')]['readAt']=moment()[_0xaecc('0x5d')](_0xaecc('0x5e'));_0x1089a7['body'][_0xaecc('0x5f')]=_0x1089a7[_0xaecc('0x55')]['UserId']||_0x1089a7[_0xaecc('0x60')]['id'];return db[_0xaecc('0x3c')][_0xaecc('0x54')]({'where':{'id':_0x1089a7['params']['id'],'UserId':null},'include':[{'model':db[_0xaecc('0x61')],'as':_0xaecc('0x62')}]})[_0xaecc('0x21')](handleEntityNotFound(_0x2ef5ed,null))[_0xaecc('0x21')](saveUpdates(_0x1089a7['body'],null))[_0xaecc('0x21')](function(_0x17807c){if(_0x17807c){_0x511996[_0xaecc('0x2a')]=_0x17807c[_0xaecc('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0xaecc('0x54')]({'where':{'id':_0x17807c['WhatsappInteractionId']}});}return null;})[_0xaecc('0x21')](handleEntityNotFound(_0x2ef5ed,null))[_0xaecc('0x21')](function(_0x36d037){if(_0x36d037){return _0x36d037[_0xaecc('0x56')]({'UserId':_0x1089a7[_0xaecc('0x55')][_0xaecc('0x5f')],'read1stAt':_['isNil'](_0x36d037[_0xaecc('0x64')])?moment()['format'](_0xaecc('0x5e')):undefined});}return null;})[_0xaecc('0x21')](function(_0x4b9918){if(_0x4b9918){_0x511996[_0xaecc('0x65')]=_0x4b9918['get']({'plain':!![]});interaction_log[_0xaecc('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1089a7['user']['id'],_0x1089a7['user'][_0xaecc('0x38')],_0x1089a7['user'][_0xaecc('0x66')],_0x511996['interaction']['id'],_0x1089a7[_0xaecc('0x55')]?JSON['stringify'](_0x1089a7[_0xaecc('0x55')]):'null');return respondWithRpcPromise(_0xaecc('0x67'),_0xaecc('0x68'),_0x511996);}return null;})[_0xaecc('0x21')](function(_0x48b459){if(_0x48b459){if(_0x1089a7['body'][_0xaecc('0x69')]){_0x511996['message'][_0xaecc('0x6a')]=util[_0xaecc('0x5d')]('SIP/%s',_0x1089a7[_0xaecc('0x60')][_0xaecc('0x38')]);_0x511996[_0xaecc('0x2a')][_0xaecc('0x6b')]=_0x511996['channel'];_0x511996['message']['event']=_0xaecc('0x5b');return respondWithRpcPromise(_0xaecc('0x6c'),_0xaecc('0x6c'),{'event':_0xaecc('0x6d'),'message':_0x511996[_0xaecc('0x2a')]},client9002)[_0xaecc('0x21')](function(){return _0x511996;});}return _0x511996;}return null;})[_0xaecc('0x21')](respondWithResult(_0x2ef5ed,null))[_0xaecc('0x2c')](handleError(_0x2ef5ed,null));};var interaction_log=require(_0xaecc('0x15'))('whatsapp-interactions');exports['reject']=function(_0x1c53e2,_0x56e105,_0x167f45){var _0x51cfa1={'agent':{},'channel':_0xaecc('0x6e')};if(_0x1c53e2[_0xaecc('0x55')]['id']){delete _0x1c53e2['body']['id'];}_0x1c53e2[_0xaecc('0x55')][_0xaecc('0x5f')]=_0x1c53e2['body'][_0xaecc('0x5f')]||_0x1c53e2['user']['id'];_0x51cfa1[_0xaecc('0x6f')]['id']=_0x1c53e2[_0xaecc('0x55')][_0xaecc('0x5f')];return db[_0xaecc('0x3c')]['find']({'where':{'id':_0x1c53e2[_0xaecc('0x57')]['id'],'UserId':null}})[_0xaecc('0x21')](handleEntityNotFound(_0x56e105,null))[_0xaecc('0x21')](function(_0x2f533b){if(_0x2f533b){_0x51cfa1['message']=_0x2f533b[_0xaecc('0x63')]({'plain':!![]});return db[_0xaecc('0x70')][_0xaecc('0x54')]({'where':{'id':_0x2f533b[_0xaecc('0x71')]}});}return null;})[_0xaecc('0x21')](handleEntityNotFound(_0x56e105,null))[_0xaecc('0x21')](function(_0xef9841){if(_0xef9841){_0x51cfa1[_0xaecc('0x65')]=_0xef9841[_0xaecc('0x63')]({'plain':!![]});interaction_log['info'](_0xaecc('0x72'),_0x1c53e2['user']['id'],_0x1c53e2[_0xaecc('0x60')][_0xaecc('0x38')],_0x1c53e2[_0xaecc('0x60')][_0xaecc('0x66')],_0x51cfa1[_0xaecc('0x65')]['id'],_0x1c53e2[_0xaecc('0x55')]?JSON[_0xaecc('0x27')](_0x1c53e2['body']):_0xaecc('0x73'));return respondWithRpcPromise(_0xaecc('0x74'),_0xaecc('0x75'),_0x51cfa1);}return null;})['then'](function(_0x3fab0d){if(_0x3fab0d){_0x3fab0d[_0xaecc('0x2a')]['interface']=util[_0xaecc('0x5d')](_0xaecc('0x76'),_0x1c53e2[_0xaecc('0x60')][_0xaecc('0x38')]);_0x3fab0d['message'][_0xaecc('0x6b')]=_0x51cfa1[_0xaecc('0x6b')];_0x3fab0d[_0xaecc('0x2a')][_0xaecc('0x77')]=_0xaecc('0x78');respondWithRpcPromise(_0xaecc('0x6c'),_0xaecc('0x6c'),{'event':_0xaecc('0x79'),'message':_0x3fab0d['message']},client9002);return _0x51cfa1;}return null;})['then'](respondWithResult(_0x56e105,null))[_0xaecc('0x2c')](handleError(_0x56e105,null));};exports[_0xaecc('0x2d')]=function(_0x789644,_0x2baad2,_0x290d7a){if(_0x789644['body']['id']){delete _0x789644[_0xaecc('0x55')]['id'];}var _0x285c31;return db[_0xaecc('0x3c')]['find']({'where':{'id':_0x789644['params']['id']}})[_0xaecc('0x21')](handleEntityNotFound(_0x2baad2,null))['then'](function(_0xeae7f8){if(_0xeae7f8){_0x285c31=_0xeae7f8;return db[_0xaecc('0x7a')]['find']({'where':{'id':_0xeae7f8['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2baad2,null))['then'](function(_0x405b24){if(_0x405b24){logger[_0xaecc('0x25')](_0xaecc('0x7b'),_0xaecc('0x2d'),_0xaecc('0x7c'),_0x405b24[_0xaecc('0x4d')],util[_0xaecc('0x7d')](_0x789644[_0xaecc('0x55')],{'showHidden':![],'depth':null}));switch(_0x405b24[_0xaecc('0x4d')]){case _0xaecc('0x7e'):if(_0x789644[_0xaecc('0x55')][_0xaecc('0x7f')]&&_0x789644[_0xaecc('0x55')][_0xaecc('0x7f')]===_0x285c31[_0xaecc('0x80')]&&_0x789644['body']['MessageStatus']&&_0x789644[_0xaecc('0x55')][_0xaecc('0x81')]===_0xaecc('0x5c')){return _0x285c31['update']({'read':!![]});}else{logger[_0xaecc('0x28')](_0xaecc('0x82'),_0xaecc('0x2d'),_0xaecc('0x7e'),util[_0xaecc('0x7d')](_0x789644[_0xaecc('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x285c31;}})[_0xaecc('0x21')](respondWithResult(_0x2baad2,null))[_0xaecc('0x2c')](handleError(_0x2baad2,null));}; \ No newline at end of file +var _0xd270=['request','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','code','error','WhatsappMessage,\x20%s,\x20%s','message','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','user','role','stringify','manual','interface','SIP/%s','channel','event','EventManager','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./whatsappMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x1cac3b,_0x344896){var _0x36c22b=function(_0x24ef81){while(--_0x24ef81){_0x1cac3b['push'](_0x1cac3b['shift']());}};_0x36c22b(++_0x344896);}(_0xd270,0x16f));var _0x0d27=function(_0x471ea3,_0x187175){_0x471ea3=_0x471ea3-0x0;var _0x5b835b=_0xd270[_0x471ea3];return _0x5b835b;};'use strict';var pdf=require(_0x0d27('0x0'));var emlformat=require(_0x0d27('0x1'));var rimraf=require(_0x0d27('0x2'));var zipdir=require(_0x0d27('0x3'));var jsonpatch=require(_0x0d27('0x4'));var rp=require(_0x0d27('0x5'));var moment=require(_0x0d27('0x6'));var BPromise=require(_0x0d27('0x7'));var Mustache=require(_0x0d27('0x8'));var util=require('util');var path=require(_0x0d27('0x9'));var sox=require(_0x0d27('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d27('0xb'));var squel=require(_0x0d27('0xc'));var crypto=require(_0x0d27('0xd'));var jsforce=require(_0x0d27('0xe'));var deskjs=require(_0x0d27('0xf'));var toCsv=require(_0x0d27('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d27('0x11'));var qs=require(_0x0d27('0x12'));var as=require(_0x0d27('0x13'));var hardwareService=require(_0x0d27('0x14'));var logger=require(_0x0d27('0x15'))(_0x0d27('0x16'));var utils=require(_0x0d27('0x17'));var config=require('../../config/environment');var db=require(_0x0d27('0x18'))['db'];config[_0x0d27('0x19')]=_[_0x0d27('0x1a')](config[_0x0d27('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d27('0x19')]));require(_0x0d27('0x1b'))['register'](socket);var jayson=require(_0x0d27('0x1c'));var client=jayson[_0x0d27('0x1d')][_0x0d27('0x1e')]({'port':0x232c});var client9002=jayson[_0x0d27('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x16774d,_0x4ec813,_0x28af94){if(_0x28af94){var _0x2cfb18=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cfb18[_0x0d27('0x1f')](_0x4ec813)){return _0x16774d;}else{throw new db[(_0x0d27('0x20'))][(_0x0d27('0x21'))](_0x0d27('0x22'));}}else{return _0x16774d;}}function respondWithRpcPromise(_0x560e93,_0x412559,_0x6cfd,_0x47ad25){return new BPromise(function(_0x4138c6,_0x4d6be1){var _0x245751=_0x47ad25||client;return _0x245751[_0x0d27('0x23')](_0x560e93,_0x6cfd)['then'](function(_0x52aac7){logger[_0x0d27('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x412559,_0x0d27('0x25'));logger['debug'](_0x0d27('0x26'),_0x412559,_0x0d27('0x25'),JSON['stringify'](_0x52aac7));if(_0x52aac7['error']){if(_0x52aac7['error'][_0x0d27('0x27')]===0x1f4){logger[_0x0d27('0x28')](_0x0d27('0x29'),_0x412559,_0x52aac7[_0x0d27('0x28')][_0x0d27('0x2a')]);return _0x4d6be1(_0x52aac7[_0x0d27('0x28')][_0x0d27('0x2a')]);}logger[_0x0d27('0x28')](_0x0d27('0x29'),_0x412559,_0x52aac7[_0x0d27('0x28')]['message']);return _0x4138c6(_0x52aac7[_0x0d27('0x28')]['message']);}else{logger[_0x0d27('0x24')](_0x0d27('0x29'),_0x412559,'request\x20sent');_0x4138c6(_0x52aac7['result'][_0x0d27('0x2a')]);}})['catch'](function(_0x48cc94){logger[_0x0d27('0x28')](_0x0d27('0x29'),_0x412559,_0x48cc94);_0x4d6be1(_0x48cc94);});});}function respondWithStatusCode(_0x2a60a7,_0x5069a7){_0x5069a7=_0x5069a7||0xcc;return function(_0x2c7153){if(_0x2c7153){return _0x2a60a7['sendStatus'](_0x5069a7);}return _0x2a60a7[_0x0d27('0x2b')](_0x5069a7)[_0x0d27('0x2c')]();};}function respondWithResult(_0x54a279,_0x3dfdd1){_0x3dfdd1=_0x3dfdd1||0xc8;return function(_0x2cd833){if(_0x2cd833){return _0x54a279[_0x0d27('0x2b')](_0x3dfdd1)[_0x0d27('0x2d')](_0x2cd833);}};}function respondWithFilteredResult(_0x200a39,_0x27c0e2){return function(_0x320b6d){if(_0x320b6d){var _0x6e77e3=_0x320b6d[_0x0d27('0x2e')],_0x183331=_0x27c0e2['offset'],_0x3ddac8=_0x27c0e2[_0x0d27('0x2f')]+_0x27c0e2['limit'],_0x4ac9b1;if(_0x3ddac8>=_0x6e77e3){_0x3ddac8=_0x6e77e3;_0x4ac9b1=0xc8;}else{_0x4ac9b1=0xce;}_0x200a39[_0x0d27('0x2b')](_0x4ac9b1);return _0x200a39[_0x0d27('0x30')](_0x0d27('0x31'),_0x183331+'-'+_0x3ddac8+'/'+_0x6e77e3)['json'](_0x320b6d);}return null;};}function patchUpdates(_0x29f734){return function(_0x442ea5){try{jsonpatch[_0x0d27('0x32')](_0x442ea5,_0x29f734,!![]);}catch(_0x557b19){return BPromise[_0x0d27('0x33')](_0x557b19);}return _0x442ea5[_0x0d27('0x34')]();};}function saveUpdates(_0xd9b84c,_0x2c3a5f){return function(_0x38594a){if(_0x38594a){return _0x38594a[_0x0d27('0x35')](_0xd9b84c)[_0x0d27('0x36')](function(_0x25e4eb){return _0x25e4eb;});}return null;};}function removeEntity(_0x55d37f,_0x43022f){return function(_0x4f5c83){if(_0x4f5c83){return _0x4f5c83[_0x0d27('0x37')]()['then'](function(){_0x55d37f[_0x0d27('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ac9fb,_0x6c1fb8){return function(_0x3c0f11){if(!_0x3c0f11){_0x1ac9fb['sendStatus'](0x194);}return _0x3c0f11;};}function handleError(_0x53fd31,_0x211d4b){_0x211d4b=_0x211d4b||0x1f4;return function(_0x473e1a){logger[_0x0d27('0x28')](_0x473e1a[_0x0d27('0x38')]);if(_0x473e1a[_0x0d27('0x39')]){delete _0x473e1a[_0x0d27('0x39')];}_0x53fd31[_0x0d27('0x2b')](_0x211d4b)[_0x0d27('0x3a')](_0x473e1a);};}exports[_0x0d27('0x3b')]=function(_0x407db8,_0x2969c2){var _0x4b1b5b={},_0x5c3a52={},_0x1e5884={'count':0x0,'rows':[]};var _0x191433=_[_0x0d27('0x3c')](db[_0x0d27('0x3d')][_0x0d27('0x3e')],function(_0x5829e5){return{'name':_0x5829e5[_0x0d27('0x3f')],'type':_0x5829e5['type'][_0x0d27('0x40')]};});_0x5c3a52[_0x0d27('0x41')]=_[_0x0d27('0x3c')](_0x191433,_0x0d27('0x39'));_0x5c3a52['query']=_[_0x0d27('0x42')](_0x407db8[_0x0d27('0x43')]);_0x5c3a52[_0x0d27('0x44')]=_['intersection'](_0x5c3a52[_0x0d27('0x41')],_0x5c3a52[_0x0d27('0x43')]);_0x4b1b5b[_0x0d27('0x45')]=_[_0x0d27('0x46')](_0x5c3a52[_0x0d27('0x41')],qs[_0x0d27('0x47')](_0x407db8[_0x0d27('0x43')][_0x0d27('0x47')]));_0x4b1b5b['attributes']=_0x4b1b5b[_0x0d27('0x45')][_0x0d27('0x48')]?_0x4b1b5b[_0x0d27('0x45')]:_0x5c3a52[_0x0d27('0x41')];if(!_0x407db8[_0x0d27('0x43')]['hasOwnProperty'](_0x0d27('0x49'))){_0x4b1b5b['limit']=qs['limit'](_0x407db8[_0x0d27('0x43')]['limit']);_0x4b1b5b['offset']=qs[_0x0d27('0x2f')](_0x407db8[_0x0d27('0x43')]['offset']);}_0x4b1b5b[_0x0d27('0x4a')]=qs[_0x0d27('0x4b')](_0x407db8[_0x0d27('0x43')][_0x0d27('0x4b')]);_0x4b1b5b['where']=qs[_0x0d27('0x44')](_[_0x0d27('0x4c')](_0x407db8['query'],_0x5c3a52[_0x0d27('0x44')]),_0x191433);if(_0x407db8['query'][_0x0d27('0x4d')]){_0x4b1b5b[_0x0d27('0x4e')]=_[_0x0d27('0x4f')](_0x4b1b5b[_0x0d27('0x4e')],{'$or':_[_0x0d27('0x3c')](_0x191433,function(_0x5a3592){if(_0x5a3592[_0x0d27('0x50')]!==_0x0d27('0x51')){var _0xa67130={};_0xa67130[_0x5a3592['name']]={'$like':'%'+_0x407db8[_0x0d27('0x43')][_0x0d27('0x4d')]+'%'};return _0xa67130;}})});}_0x4b1b5b=_[_0x0d27('0x4f')]({},_0x4b1b5b,_0x407db8[_0x0d27('0x52')]);var _0x275a95={'where':_0x4b1b5b[_0x0d27('0x4e')]};return db[_0x0d27('0x3d')][_0x0d27('0x2e')](_0x275a95)[_0x0d27('0x36')](function(_0x3b2d0a){_0x1e5884['count']=_0x3b2d0a;if(_0x407db8[_0x0d27('0x43')][_0x0d27('0x53')]){_0x4b1b5b[_0x0d27('0x54')]=[{'all':!![]}];}return db[_0x0d27('0x3d')][_0x0d27('0x55')](_0x4b1b5b);})[_0x0d27('0x36')](function(_0x34496b){_0x1e5884[_0x0d27('0x56')]=_0x34496b;return _0x1e5884;})[_0x0d27('0x36')](respondWithFilteredResult(_0x2969c2,_0x4b1b5b))[_0x0d27('0x57')](handleError(_0x2969c2,null));};exports[_0x0d27('0x58')]=function(_0xe614e3,_0x35e401){var _0x485e22={'raw':!![],'where':{'id':_0xe614e3[_0x0d27('0x59')]['id']}},_0x1a7348={};_0x1a7348['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x1a7348['query']=_[_0x0d27('0x42')](_0xe614e3[_0x0d27('0x43')]);_0x1a7348[_0x0d27('0x44')]=_['intersection'](_0x1a7348[_0x0d27('0x41')],_0x1a7348[_0x0d27('0x43')]);_0x485e22[_0x0d27('0x45')]=_[_0x0d27('0x46')](_0x1a7348[_0x0d27('0x41')],qs['fields'](_0xe614e3[_0x0d27('0x43')][_0x0d27('0x47')]));_0x485e22['attributes']=_0x485e22[_0x0d27('0x45')]['length']?_0x485e22['attributes']:_0x1a7348[_0x0d27('0x41')];if(_0xe614e3[_0x0d27('0x43')][_0x0d27('0x53')]){_0x485e22['include']=[{'all':!![]}];}_0x485e22=_[_0x0d27('0x4f')]({},_0x485e22,_0xe614e3[_0x0d27('0x52')]);return db[_0x0d27('0x3d')][_0x0d27('0x5a')](_0x485e22)[_0x0d27('0x36')](handleEntityNotFound(_0x35e401,null))[_0x0d27('0x36')](respondWithResult(_0x35e401,null))['catch'](handleError(_0x35e401,null));};exports[_0x0d27('0x5b')]=function(_0x52a020,_0x5e0789){return db[_0x0d27('0x3d')][_0x0d27('0x5b')](_0x52a020['body'],{})[_0x0d27('0x36')](respondWithResult(_0x5e0789,0xc9))['catch'](handleError(_0x5e0789,null));};exports[_0x0d27('0x35')]=function(_0x311f10,_0x3aaaec){if(_0x311f10[_0x0d27('0x5c')]['id']){delete _0x311f10['body']['id'];}return db[_0x0d27('0x3d')]['find']({'where':{'id':_0x311f10['params']['id']}})[_0x0d27('0x36')](handleEntityNotFound(_0x3aaaec,null))[_0x0d27('0x36')](saveUpdates(_0x311f10[_0x0d27('0x5c')],null))[_0x0d27('0x36')](respondWithResult(_0x3aaaec,null))['catch'](handleError(_0x3aaaec,null));};exports[_0x0d27('0x37')]=function(_0x1af378,_0x1e92f3){return db[_0x0d27('0x3d')]['find']({'where':{'id':_0x1af378['params']['id']}})[_0x0d27('0x36')](handleEntityNotFound(_0x1e92f3,null))[_0x0d27('0x36')](removeEntity(_0x1e92f3,null))['catch'](handleError(_0x1e92f3,null));};exports[_0x0d27('0x5d')]=function(_0x3c626d,_0x4ac86f){return db['WhatsappMessage'][_0x0d27('0x5d')]()[_0x0d27('0x36')](respondWithResult(_0x4ac86f,null))['catch'](handleError(_0x4ac86f,null));};var interaction_log=require(_0x0d27('0x15'))(_0x0d27('0x5e'));exports[_0x0d27('0x5f')]=function(_0x8afda6,_0xa35bfd,_0x464c61){var _0x374f81={'channel':_0x0d27('0x60')};if(_0x8afda6[_0x0d27('0x5c')]['id']){delete _0x8afda6['body']['id'];}_0x8afda6[_0x0d27('0x5c')]['read']=!![];_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x61')]=moment()[_0x0d27('0x62')](_0x0d27('0x63'));_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x64')]=_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x64')]||_0x8afda6['user']['id'];return db[_0x0d27('0x3d')][_0x0d27('0x5a')]({'where':{'id':_0x8afda6[_0x0d27('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x0d27('0x65')],'as':_0x0d27('0x66')}]})[_0x0d27('0x36')](handleEntityNotFound(_0xa35bfd,null))['then'](saveUpdates(_0x8afda6[_0x0d27('0x5c')],null))['then'](function(_0x4c8cd9){if(_0x4c8cd9){_0x374f81[_0x0d27('0x2a')]=_0x4c8cd9[_0x0d27('0x67')]({'plain':!![]});return db[_0x0d27('0x68')][_0x0d27('0x5a')]({'where':{'id':_0x4c8cd9[_0x0d27('0x69')]}});}return null;})['then'](handleEntityNotFound(_0xa35bfd,null))[_0x0d27('0x36')](function(_0x49c369){if(_0x49c369){return _0x49c369[_0x0d27('0x35')]({'UserId':_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x64')],'read1stAt':_[_0x0d27('0x6a')](_0x49c369[_0x0d27('0x6b')])?moment()['format'](_0x0d27('0x63')):undefined});}return null;})[_0x0d27('0x36')](function(_0xe37c71){if(_0xe37c71){_0x374f81[_0x0d27('0x6c')]=_0xe37c71[_0x0d27('0x67')]({'plain':!![]});interaction_log[_0x0d27('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8afda6[_0x0d27('0x6d')]['id'],_0x8afda6[_0x0d27('0x6d')][_0x0d27('0x39')],_0x8afda6['user'][_0x0d27('0x6e')],_0x374f81[_0x0d27('0x6c')]['id'],_0x8afda6[_0x0d27('0x5c')]?JSON[_0x0d27('0x6f')](_0x8afda6[_0x0d27('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x374f81);}return null;})[_0x0d27('0x36')](function(_0x2fe9e5){if(_0x2fe9e5){if(_0x8afda6[_0x0d27('0x5c')][_0x0d27('0x70')]){_0x374f81[_0x0d27('0x2a')][_0x0d27('0x71')]=util[_0x0d27('0x62')](_0x0d27('0x72'),_0x8afda6[_0x0d27('0x6d')][_0x0d27('0x39')]);_0x374f81['message']['channel']=_0x374f81[_0x0d27('0x73')];_0x374f81[_0x0d27('0x2a')][_0x0d27('0x74')]=_0x0d27('0x5f');return respondWithRpcPromise(_0x0d27('0x75'),'EventManager',{'event':'acceptmessage','message':_0x374f81[_0x0d27('0x2a')]},client9002)[_0x0d27('0x36')](function(){return _0x374f81;});}return _0x374f81;}return null;})[_0x0d27('0x36')](respondWithResult(_0xa35bfd,null))[_0x0d27('0x57')](handleError(_0xa35bfd,null));};var interaction_log=require(_0x0d27('0x15'))(_0x0d27('0x5e'));exports[_0x0d27('0x33')]=function(_0xca8ef1,_0x2c3048,_0x2ec6b6){var _0x1e1a16={'agent':{},'channel':_0x0d27('0x60')};if(_0xca8ef1['body']['id']){delete _0xca8ef1['body']['id'];}_0xca8ef1[_0x0d27('0x5c')][_0x0d27('0x64')]=_0xca8ef1[_0x0d27('0x5c')][_0x0d27('0x64')]||_0xca8ef1[_0x0d27('0x6d')]['id'];_0x1e1a16[_0x0d27('0x76')]['id']=_0xca8ef1[_0x0d27('0x5c')][_0x0d27('0x64')];return db[_0x0d27('0x3d')][_0x0d27('0x5a')]({'where':{'id':_0xca8ef1[_0x0d27('0x59')]['id'],'UserId':null}})[_0x0d27('0x36')](handleEntityNotFound(_0x2c3048,null))[_0x0d27('0x36')](function(_0x27467b){if(_0x27467b){_0x1e1a16['message']=_0x27467b[_0x0d27('0x67')]({'plain':!![]});return db[_0x0d27('0x68')][_0x0d27('0x5a')]({'where':{'id':_0x27467b[_0x0d27('0x69')]}});}return null;})[_0x0d27('0x36')](handleEntityNotFound(_0x2c3048,null))[_0x0d27('0x36')](function(_0xa95a35){if(_0xa95a35){_0x1e1a16['interaction']=_0xa95a35['get']({'plain':!![]});interaction_log[_0x0d27('0x24')](_0x0d27('0x77'),_0xca8ef1[_0x0d27('0x6d')]['id'],_0xca8ef1[_0x0d27('0x6d')]['name'],_0xca8ef1['user'][_0x0d27('0x6e')],_0x1e1a16[_0x0d27('0x6c')]['id'],_0xca8ef1['body']?JSON[_0x0d27('0x6f')](_0xca8ef1['body']):_0x0d27('0x78'));return respondWithRpcPromise(_0x0d27('0x79'),_0x0d27('0x7a'),_0x1e1a16);}return null;})[_0x0d27('0x36')](function(_0x1c10a0){if(_0x1c10a0){_0x1c10a0[_0x0d27('0x2a')][_0x0d27('0x71')]=util[_0x0d27('0x62')]('SIP/%s',_0xca8ef1[_0x0d27('0x6d')][_0x0d27('0x39')]);_0x1c10a0[_0x0d27('0x2a')][_0x0d27('0x73')]=_0x1e1a16[_0x0d27('0x73')];_0x1c10a0[_0x0d27('0x2a')]['event']=_0x0d27('0x33');respondWithRpcPromise('EventManager',_0x0d27('0x75'),{'event':'rejectmessage','message':_0x1c10a0['message']},client9002);return _0x1e1a16;}return null;})[_0x0d27('0x36')](respondWithResult(_0x2c3048,null))[_0x0d27('0x57')](handleError(_0x2c3048,null));};exports[_0x0d27('0x2b')]=function(_0x3d483d,_0x5731e7,_0x33a9c1){if(_0x3d483d[_0x0d27('0x5c')]['id']){delete _0x3d483d['body']['id'];}var _0x4df305;return db[_0x0d27('0x3d')][_0x0d27('0x5a')]({'where':{'id':_0x3d483d[_0x0d27('0x59')]['id']}})[_0x0d27('0x36')](handleEntityNotFound(_0x5731e7,null))[_0x0d27('0x36')](function(_0x5f1b54){if(_0x5f1b54){_0x4df305=_0x5f1b54;return db[_0x0d27('0x7b')]['find']({'where':{'id':_0x5f1b54[_0x0d27('0x7c')]}});}})[_0x0d27('0x36')](handleEntityNotFound(_0x5731e7,null))[_0x0d27('0x36')](function(_0x5b060e){if(_0x5b060e){logger[_0x0d27('0x7d')](_0x0d27('0x7e'),_0x0d27('0x2b'),'received\x20delivery\x20report\x20from',_0x5b060e[_0x0d27('0x50')],util[_0x0d27('0x7f')](_0x3d483d[_0x0d27('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5b060e['type']){case _0x0d27('0x80'):if(_0x3d483d[_0x0d27('0x5c')][_0x0d27('0x81')]&&_0x3d483d['body'][_0x0d27('0x81')]===_0x4df305[_0x0d27('0x82')]&&_0x3d483d[_0x0d27('0x5c')][_0x0d27('0x83')]&&_0x3d483d[_0x0d27('0x5c')][_0x0d27('0x83')]===_0x0d27('0x84')){return _0x4df305[_0x0d27('0x35')]({'read':!![]});}else{logger[_0x0d27('0x28')](_0x0d27('0x85'),_0x0d27('0x2b'),_0x0d27('0x80'),util['inspect'](_0x3d483d['body'],{'showHidden':![],'depth':null}));}break;}return _0x4df305;}})[_0x0d27('0x36')](respondWithResult(_0x5731e7,null))['catch'](handleError(_0x5731e7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b19f92a..688b61a 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(_0xbe1862,_0x4e6d18){var _0x25bd0f=function(_0x3766a2){while(--_0x3766a2){_0xbe1862['push'](_0xbe1862['shift']());}};_0x25bd0f(++_0x4e6d18);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55dd9e,_0x56d484){_0x55dd9e=_0x55dd9e-0x0;var _0x52f534=_0x5f2f[_0x55dd9e];return _0x52f534;};'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 _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x19950a,_0x48872f){var _0x37d31a=function(_0x4a6e76){while(--_0x4a6e76){_0x19950a['push'](_0x19950a['shift']());}};_0x37d31a(++_0x48872f);}(_0xb10b,0x12a));var _0xbb10=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xb10b[_0x17a32f];return _0x15a293;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d82de22..87a1244 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 _0xa63f=['WhatsappAccount','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','sid','catch','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','error'];(function(_0x54b0c6,_0x5432f0){var _0x4a4a48=function(_0x407167){while(--_0x407167){_0x54b0c6['push'](_0x54b0c6['shift']());}};_0x4a4a48(++_0x5432f0);}(_0xa63f,0x70));var _0xfa63=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xa63f[_0x4cd690];return _0x4a74a9;};'use strict';var _=require(_0xfa63('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfa63('0x1'));var moment=require(_0xfa63('0x2'));var BPromise=require(_0xfa63('0x3'));var rp=require(_0xfa63('0x4'));var fs=require('fs');var path=require(_0xfa63('0x5'));var rimraf=require('rimraf');var config=require(_0xfa63('0x6'));var attributes=require(_0xfa63('0x7'));module[_0xfa63('0x8')]=function(_0x2de68d,_0x526d30){return _0x2de68d[_0xfa63('0x9')](_0xfa63('0xa'),attributes,{'tableName':_0xfa63('0xb'),'paranoid':![],'indexes':[{'name':_0xfa63('0xc'),'fields':[_0xfa63('0xc')]},{'name':_0xfa63('0xd'),'fields':[_0xfa63('0xe')],'type':_0xfa63('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x504d18,_0x2c1143,_0x3231be){var _0x1026d6=_0x2de68d[_0xfa63('0x10')];var _0x31160a=_0x504d18[_0xfa63('0x11')]({'plain':!![]});if(_0x31160a[_0xfa63('0x12')][_0xfa63('0x13')]()==='in'||_0x31160a[_0xfa63('0x12')][_0xfa63('0x13')]()===_0xfa63('0x14')&&!_0x31160a[_0xfa63('0x15')]&&!_[_0xfa63('0x16')](_0x31160a[_0xfa63('0x17')])){_0x1026d6[_0xfa63('0x18')][_0xfa63('0x19')]({'where':{'id':_0x31160a['WhatsappInteractionId']}})[_0xfa63('0x1a')](function(_0x30e740){if(_0x30e740){_0x30e740[_0xfa63('0x1b')]({'lastMsgAt':_0x31160a['createdAt'],'lastMsgDirection':_0x31160a[_0xfa63('0x12')][_0xfa63('0x13')]()});}})['catch'](function(_0x5cd619){console[_0xfa63('0x1c')](_0x5cd619);});}if(_0x31160a[_0xfa63('0x12')]==='out'&&!_0x31160a[_0xfa63('0x15')]){var _0x37010e;_0x1026d6[_0xfa63('0x1d')]['find']({'where':{'id':_0x31160a['WhatsappAccountId']},'raw':!![]})[_0xfa63('0x1a')](function(_0x392531){_0x37010e=_0x392531;if(_0x37010e&&_0x37010e[_0xfa63('0x1e')]){switch(_0x37010e[_0xfa63('0x1e')]){case _0xfa63('0x1f'):var _0x4b7112=require(_0xfa63('0x1f'));if(_0x37010e['accountSid']&&_0x37010e[_0xfa63('0x20')]&&_0x37010e[_0xfa63('0x21')]){var _0x20f90b=new _0x4b7112(_0x37010e[_0xfa63('0x22')],_0x37010e[_0xfa63('0x20')]);_0x20f90b[_0xfa63('0x23')][_0xfa63('0x24')]({'body':_0x31160a[_0xfa63('0xe')],'to':_0xfa63('0x25')+_0x31160a['phone'],'from':_0xfa63('0x25')+_0x37010e[_0xfa63('0x21')],'statusCallback':_0x37010e[_0xfa63('0x26')]+'/api/whatsapp/messages/'+_0x31160a['id']+_0xfa63('0x27')+_0x37010e[_0xfa63('0x28')]})[_0xfa63('0x1a')](function(_0x25936c){if(_0x25936c[_0xfa63('0x29')]){return _0x504d18['update']({'messageId':_0x25936c['sid']});}})[_0xfa63('0x2a')](function(_0x204db1){logger[_0xfa63('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfa63('0x2b'),_0xfa63('0x1f'),util['inspect'](_0x204db1,{'showHidden':![],'depth':null}));});}else{logger[_0xfa63('0x1c')](_0xfa63('0x2c'),_0xfa63('0x2b'),_0xfa63('0x1f'),_0xfa63('0x2d'));}break;}}})[_0xfa63('0x2e')](function(){_0x3231be();});}else{_0x3231be();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe23b=['WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','then','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','../../config/environment','./whatsappMessage.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe23b,0x8a));var _0xbe23=function(_0x2a58f8,_0x18c18f){_0x2a58f8=_0x2a58f8-0x0;var _0x5262b6=_0xe23b[_0x2a58f8];return _0x5262b6;};'use strict';var _=require(_0xbe23('0x0'));var util=require(_0xbe23('0x1'));var logger=require('../../config/logger')(_0xbe23('0x2'));var moment=require('moment');var BPromise=require(_0xbe23('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe23('0x4'));var rimraf=require('rimraf');var config=require(_0xbe23('0x5'));var attributes=require(_0xbe23('0x6'));module[_0xbe23('0x7')]=function(_0x55b50c,_0x25e37c){return _0x55b50c[_0xbe23('0x8')](_0xbe23('0x9'),attributes,{'tableName':_0xbe23('0xa'),'paranoid':![],'indexes':[{'name':_0xbe23('0xb'),'fields':[_0xbe23('0xb')]},{'name':_0xbe23('0xc'),'fields':[_0xbe23('0xd')],'type':_0xbe23('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f23ae,_0x3d30f9,_0x2c979f){var _0x5e541c=_0x55b50c['models'];var _0x11559d=_0x3f23ae[_0xbe23('0xf')]({'plain':!![]});if(_0x11559d[_0xbe23('0x10')][_0xbe23('0x11')]()==='in'||_0x11559d['direction']['toLowerCase']()===_0xbe23('0x12')&&!_0x11559d['secret']&&!_[_0xbe23('0x13')](_0x11559d[_0xbe23('0x14')])){_0x5e541c[_0xbe23('0x15')][_0xbe23('0x16')]({'where':{'id':_0x11559d['WhatsappInteractionId']}})['then'](function(_0x59084f){if(_0x59084f){_0x59084f[_0xbe23('0x17')]({'lastMsgAt':_0x11559d[_0xbe23('0x18')],'lastMsgDirection':_0x11559d[_0xbe23('0x10')]['toLowerCase']()});}})['catch'](function(_0x156256){console[_0xbe23('0x19')](_0x156256);});}if(_0x11559d[_0xbe23('0x10')]==='out'&&!_0x11559d[_0xbe23('0x1a')]){var _0x3e6eb3;_0x5e541c[_0xbe23('0x1b')][_0xbe23('0x1c')]({'where':{'id':_0x11559d[_0xbe23('0x1d')]},'raw':!![]})['then'](function(_0x29e8ce){_0x3e6eb3=_0x29e8ce;if(_0x3e6eb3&&_0x3e6eb3['type']){switch(_0x3e6eb3['type']){case _0xbe23('0x1e'):var _0x4148c8=require(_0xbe23('0x1e'));if(_0x3e6eb3[_0xbe23('0x1f')]&&_0x3e6eb3[_0xbe23('0x20')]&&_0x3e6eb3['phone']){var _0x28a2a7=new _0x4148c8(_0x3e6eb3[_0xbe23('0x1f')],_0x3e6eb3['authToken']);_0x28a2a7['messages']['create']({'body':_0x11559d[_0xbe23('0xd')],'to':_0xbe23('0x21')+_0x11559d[_0xbe23('0x22')],'from':_0xbe23('0x21')+_0x3e6eb3[_0xbe23('0x22')],'statusCallback':_0x3e6eb3[_0xbe23('0x23')]+_0xbe23('0x24')+_0x11559d['id']+_0xbe23('0x25')+_0x3e6eb3[_0xbe23('0x26')]})[_0xbe23('0x27')](function(_0x3a04ff){if(_0x3a04ff[_0xbe23('0x28')]){return _0x3f23ae[_0xbe23('0x17')]({'messageId':_0x3a04ff[_0xbe23('0x28')]});}})[_0xbe23('0x29')](function(_0x2eeaa6){logger['error'](_0xbe23('0x2a'),'afterCreate','twilio',util[_0xbe23('0x2b')](_0x2eeaa6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbe23('0x2a'),_0xbe23('0x2c'),'twilio',_0xbe23('0x2d'));}break;}}})[_0xbe23('0x2e')](function(){_0x2c979f();});}else{_0x2c979f();}}},'charset':_0xbe23('0x2f'),'collate':_0xbe23('0x30')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0c65408..1237aaa 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 _0x19c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','register','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x397b38,_0xe81a28){var _0x108e60=function(_0x2beacf){while(--_0x2beacf){_0x397b38['push'](_0x397b38['shift']());}};_0x108e60(++_0xe81a28);}(_0x19c3,0x102));var _0x319c=function(_0x3f009a,_0x19fb63){_0x3f009a=_0x3f009a-0x0;var _0x180345=_0x19c3[_0x3f009a];return _0x180345;};'use strict';var _=require(_0x319c('0x0'));var util=require(_0x319c('0x1'));var moment=require(_0x319c('0x2'));var BPromise=require(_0x319c('0x3'));var rs=require(_0x319c('0x4'));var fs=require('fs');var Redis=require(_0x319c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x319c('0x6'));var logger=require(_0x319c('0x7'))(_0x319c('0x8'));var config=require(_0x319c('0x9'));var jayson=require(_0x319c('0xa'));var client=jayson[_0x319c('0xb')][_0x319c('0xc')]({'port':0x232a});config[_0x319c('0xd')]=_['defaults'](config['redis'],{'host':_0x319c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x319c('0xf'))[_0x319c('0x10')](socket);function respondWithRpcPromise(_0x1a6a91,_0x277f0c,_0x1fd67e){return new BPromise(function(_0x32e5bf,_0x578f2b){return client[_0x319c('0x11')](_0x1a6a91,_0x1fd67e)[_0x319c('0x12')](function(_0x4ef970){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x277f0c,_0x319c('0x13'));logger['debug'](_0x319c('0x14'),_0x277f0c,'request\x20sent',JSON[_0x319c('0x15')](_0x4ef970));if(_0x4ef970[_0x319c('0x16')]){if(_0x4ef970['error']['code']===0x1f4){logger[_0x319c('0x16')](_0x319c('0x17'),_0x277f0c,_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);return _0x578f2b(_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);}logger[_0x319c('0x16')](_0x319c('0x17'),_0x277f0c,_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);return _0x32e5bf(_0x4ef970[_0x319c('0x16')][_0x319c('0x18')]);}else{logger[_0x319c('0x19')](_0x319c('0x17'),_0x277f0c,_0x319c('0x13'));_0x32e5bf(_0x4ef970[_0x319c('0x1a')][_0x319c('0x18')]);}})[_0x319c('0x1b')](function(_0x2205ad){logger['error'](_0x319c('0x17'),_0x277f0c,_0x2205ad);_0x578f2b(_0x2205ad);});});}exports[_0x319c('0x1c')]=function(_0x152512){var _0x32b03b=this;return new Promise(function(_0x135cd9,_0x506fd0){return db[_0x319c('0x1d')][_0x319c('0x1e')](_0x152512['body'],{'raw':_0x152512[_0x319c('0x1f')]?_0x152512[_0x319c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x319c('0x12')](function(_0x4d6247){logger[_0x319c('0x19')]('CreateWhatsappMessage',_0x152512);logger[_0x319c('0x20')]('CreateWhatsappMessage',_0x152512,JSON[_0x319c('0x15')](_0x4d6247));_0x135cd9(_0x4d6247);})[_0x319c('0x1b')](function(_0x328677){logger['error'](_0x319c('0x1c'),_0x328677[_0x319c('0x18')],_0x152512);_0x506fd0(_0x32b03b[_0x319c('0x16')](0x1f4,_0x328677['message']));});});}; \ No newline at end of file +var _0x99bd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x99bd,0x116));var _0xd99b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x99bd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd99b('0x0'));var util=require('util');var moment=require(_0xd99b('0x1'));var BPromise=require(_0xd99b('0x2'));var rs=require(_0xd99b('0x3'));var fs=require('fs');var Redis=require(_0xd99b('0x4'));var db=require(_0xd99b('0x5'))['db'];var utils=require(_0xd99b('0x6'));var logger=require(_0xd99b('0x7'))(_0xd99b('0x8'));var config=require(_0xd99b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd99b('0xa')]({'port':0x232a});config[_0xd99b('0xb')]=_[_0xd99b('0xc')](config[_0xd99b('0xb')],{'host':_0xd99b('0xd'),'port':0x18eb});var socket=require(_0xd99b('0xe'))(new Redis(config['redis']));require(_0xd99b('0xf'))['register'](socket);function respondWithRpcPromise(_0x515a37,_0x1f4814,_0x3079ad){return new BPromise(function(_0x14aea2,_0x59133e){return client[_0xd99b('0x10')](_0x515a37,_0x3079ad)['then'](function(_0xbc8a98){logger[_0xd99b('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x1f4814,_0xd99b('0x12'));logger[_0xd99b('0x13')](_0xd99b('0x14'),_0x1f4814,'request\x20sent',JSON[_0xd99b('0x15')](_0xbc8a98));if(_0xbc8a98[_0xd99b('0x16')]){if(_0xbc8a98[_0xd99b('0x16')]['code']===0x1f4){logger[_0xd99b('0x16')](_0xd99b('0x17'),_0x1f4814,_0xbc8a98[_0xd99b('0x16')][_0xd99b('0x18')]);return _0x59133e(_0xbc8a98['error'][_0xd99b('0x18')]);}logger[_0xd99b('0x16')](_0xd99b('0x17'),_0x1f4814,_0xbc8a98['error'][_0xd99b('0x18')]);return _0x14aea2(_0xbc8a98[_0xd99b('0x16')]['message']);}else{logger[_0xd99b('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x1f4814,_0xd99b('0x12'));_0x14aea2(_0xbc8a98[_0xd99b('0x19')][_0xd99b('0x18')]);}})[_0xd99b('0x1a')](function(_0x2b2cda){logger[_0xd99b('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1f4814,_0x2b2cda);_0x59133e(_0x2b2cda);});});}exports[_0xd99b('0x1b')]=function(_0x56da19){var _0x4ccf85=this;return new Promise(function(_0x343dcf,_0x399f52){return db[_0xd99b('0x1c')][_0xd99b('0x1d')](_0x56da19['body'],{'raw':_0x56da19[_0xd99b('0x1e')]?_0x56da19[_0xd99b('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x56c16f){logger[_0xd99b('0x11')](_0xd99b('0x1b'),_0x56da19);logger[_0xd99b('0x13')](_0xd99b('0x1b'),_0x56da19,JSON[_0xd99b('0x15')](_0x56c16f));_0x343dcf(_0x56c16f);})[_0xd99b('0x1a')](function(_0x22c13a){logger['error'](_0xd99b('0x1b'),_0x22c13a[_0xd99b('0x18')],_0x56da19);_0x399f52(_0x4ccf85[_0xd99b('0x16')](0x1f4,_0x22c13a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c37cc2f..9e431d1 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 _0x3f2b=['remove','update','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x43dc27,_0x1c7a69){var _0xda3954=function(_0x1a8f2a){while(--_0x1a8f2a){_0x43dc27['push'](_0x43dc27['shift']());}};_0xda3954(++_0x1c7a69);}(_0x3f2b,0x13c));var _0xb3f2=function(_0x39661d,_0x48ad03){_0x39661d=_0x39661d-0x0;var _0x1e6639=_0x3f2b[_0x39661d];return _0x1e6639;};'use strict';var WhatsappMessageEvents=require(_0xb3f2('0x0'));var events=[_0xb3f2('0x1'),_0xb3f2('0x2'),_0xb3f2('0x3')];function createListener(_0x319af5,_0x1f9de6){return function(_0x40920a){_0x1f9de6['emit'](_0x319af5,_0x40920a);};}function removeListener(_0x39dd35,_0x45a7e7){return function(){WhatsappMessageEvents['removeListener'](_0x39dd35,_0x45a7e7);};}exports['register']=function(_0x1ce440){for(var _0x286d6b=0x0,_0x65a50d=events[_0xb3f2('0x4')];_0x286d6b<_0x65a50d;_0x286d6b++){var _0x256699=events[_0x286d6b];var _0x2422e1=createListener(_0xb3f2('0x5')+_0x256699,_0x1ce440);WhatsappMessageEvents['on'](_0x256699,_0x2422e1);}}; \ No newline at end of file +var _0x1737=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x1737,0x147));var _0x7173=function(_0x2eec52,_0x2a3f38){_0x2eec52=_0x2eec52-0x0;var _0x18547d=_0x1737[_0x2eec52];return _0x18547d;};'use strict';var WhatsappMessageEvents=require(_0x7173('0x0'));var events=[_0x7173('0x1'),'remove',_0x7173('0x2')];function createListener(_0x103b74,_0x5dbcfb){return function(_0x29c2e8){_0x5dbcfb[_0x7173('0x3')](_0x103b74,_0x29c2e8);};}function removeListener(_0x4db1c8,_0x11c18d){return function(){WhatsappMessageEvents['removeListener'](_0x4db1c8,_0x11c18d);};}exports[_0x7173('0x4')]=function(_0x415ad2){for(var _0x411706=0x0,_0x3029ee=events[_0x7173('0x5')];_0x411706<_0x3029ee;_0x411706++){var _0x3e1f34=events[_0x411706];var _0x3c97f9=createListener(_0x7173('0x6')+_0x3e1f34,_0x415ad2);WhatsappMessageEvents['on'](_0x3e1f34,_0x3c97f9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7018bd4..5ff35fe 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 _0x6f1c=['post','create','addTeams','/:id/users','addAgents','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6f1c,0x160));var _0xc6f1=function(_0x17e48f,_0x2e36e9){_0x17e48f=_0x17e48f-0x0;var _0x49ee3e=_0x6f1c[_0x17e48f];return _0x49ee3e;};'use strict';var multer=require(_0xc6f1('0x0'));var util=require(_0xc6f1('0x1'));var path=require(_0xc6f1('0x2'));var timeout=require(_0xc6f1('0x3'));var express=require('express');var router=express[_0xc6f1('0x4')]();var auth=require(_0xc6f1('0x5'));var interaction=require(_0xc6f1('0x6'));var config=require(_0xc6f1('0x7'));var controller=require(_0xc6f1('0x8'));router[_0xc6f1('0x9')]('/',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xb')]);router[_0xc6f1('0x9')](_0xc6f1('0xc'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xd')]);router[_0xc6f1('0x9')]('/:id',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0xe')]);router['get'](_0xc6f1('0xf'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x10')]);router[_0xc6f1('0x9')](_0xc6f1('0x11'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x12')]);router['get']('/:id/users',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x13')]);router[_0xc6f1('0x14')]('/',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x15')]);router[_0xc6f1('0x14')](_0xc6f1('0x11'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x16')]);router[_0xc6f1('0x14')](_0xc6f1('0x17'),auth['isAuthenticated'](),controller[_0xc6f1('0x18')]);router['put'](_0xc6f1('0x19'),auth[_0xc6f1('0xa')](),controller['update']);router[_0xc6f1('0x1a')]('/:id',auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1b')]);router[_0xc6f1('0x1a')](_0xc6f1('0x11'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1c')]);router['delete'](_0xc6f1('0x17'),auth[_0xc6f1('0xa')](),controller[_0xc6f1('0x1d')]);module[_0xc6f1('0x1e')]=router; \ No newline at end of file +var _0x36c8=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer'];(function(_0x4f02ac,_0x5b385e){var _0x463598=function(_0x1bf373){while(--_0x1bf373){_0x4f02ac['push'](_0x4f02ac['shift']());}};_0x463598(++_0x5b385e);}(_0x36c8,0x13e));var _0x836c=function(_0x47d3a4,_0x5b1e1c){_0x47d3a4=_0x47d3a4-0x0;var _0x2650c5=_0x36c8[_0x47d3a4];return _0x2650c5;};'use strict';var multer=require(_0x836c('0x0'));var util=require(_0x836c('0x1'));var path=require(_0x836c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x836c('0x3')]();var auth=require(_0x836c('0x4'));var interaction=require(_0x836c('0x5'));var config=require(_0x836c('0x6'));var controller=require(_0x836c('0x7'));router[_0x836c('0x8')]('/',auth[_0x836c('0x9')](),controller['index']);router[_0x836c('0x8')](_0x836c('0xa'),auth[_0x836c('0x9')](),controller['describe']);router['get'](_0x836c('0xb'),auth[_0x836c('0x9')](),controller[_0x836c('0xc')]);router['get']('/:id/members',auth[_0x836c('0x9')](),controller[_0x836c('0xd')]);router[_0x836c('0x8')](_0x836c('0xe'),auth[_0x836c('0x9')](),controller[_0x836c('0xf')]);router[_0x836c('0x8')](_0x836c('0x10'),auth[_0x836c('0x9')](),controller[_0x836c('0x11')]);router[_0x836c('0x12')]('/',auth[_0x836c('0x9')](),controller[_0x836c('0x13')]);router['post']('/:id/teams',auth[_0x836c('0x9')](),controller[_0x836c('0x14')]);router[_0x836c('0x12')]('/:id/users',auth[_0x836c('0x9')](),controller[_0x836c('0x15')]);router[_0x836c('0x16')](_0x836c('0xb'),auth[_0x836c('0x9')](),controller[_0x836c('0x17')]);router['delete'](_0x836c('0xb'),auth['isAuthenticated'](),controller[_0x836c('0x18')]);router[_0x836c('0x19')](_0x836c('0xe'),auth[_0x836c('0x9')](),controller[_0x836c('0x1a')]);router[_0x836c('0x19')](_0x836c('0x10'),auth[_0x836c('0x9')](),controller[_0x836c('0x1b')]);module[_0x836c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f944c4f..f941ad5 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 _0x4d00=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x4f1608,_0x401631){var _0x53a0a8=function(_0x4df0f3){while(--_0x4df0f3){_0x4f1608['push'](_0x4f1608['shift']());}};_0x53a0a8(++_0x401631);}(_0x4d00,0xe3));var _0x04d0=function(_0xa7cb80,_0x4d636a){_0xa7cb80=_0xa7cb80-0x0;var _0x5dbf8a=_0x4d00[_0xa7cb80];return _0x5dbf8a;};'use strict';var Sequelize=require('sequelize');module[_0x04d0('0x0')]={'name':{'type':Sequelize[_0x04d0('0x1')],'unique':_0x04d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x04d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x04d0('0x4')](_0x04d0('0x5'),_0x04d0('0x6'),_0x04d0('0x7'))},'description':{'type':Sequelize[_0x04d0('0x1')]}}; \ No newline at end of file +var _0x6e53=['sequelize','exports','ENUM','rrmemory','beepall','roundrobin'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6e53,0x19e));var _0x36e5=function(_0xee0152,_0xfe1ea7){_0xee0152=_0xee0152-0x0;var _0x1a69d1=_0x6e53[_0xee0152];return _0x1a69d1;};'use strict';var Sequelize=require(_0x36e5('0x0'));module[_0x36e5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36e5('0x2')](_0x36e5('0x3'),_0x36e5('0x4'),_0x36e5('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5b006d6..9155513 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 _0x683c=['WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent','rows','format','SIP','whatsappPause','createdAt','getTeams','Team','pick','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x683c,0x1e8));var _0xc683=function(_0x39809d,_0x4fc32f){_0x39809d=_0x39809d-0x0;var _0x1541d3=_0x683c[_0x39809d];return _0x1541d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc683('0x0'));var rimraf=require(_0xc683('0x1'));var zipdir=require(_0xc683('0x2'));var jsonpatch=require(_0xc683('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc683('0x4'));var Mustache=require(_0xc683('0x5'));var util=require(_0xc683('0x6'));var path=require(_0xc683('0x7'));var sox=require(_0xc683('0x8'));var csv=require('to-csv');var ejs=require(_0xc683('0x9'));var fs=require('fs');var _=require(_0xc683('0xa'));var squel=require(_0xc683('0xb'));var crypto=require(_0xc683('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc683('0xd'));var toCsv=require(_0xc683('0xe'));var querystring=require(_0xc683('0xf'));var Papa=require(_0xc683('0x10'));var Redis=require(_0xc683('0x11'));var authService=require(_0xc683('0x12'));var qs=require(_0xc683('0x13'));var as=require(_0xc683('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc683('0x15'))(_0xc683('0x16'));var utils=require('../../config/utils');var config=require(_0xc683('0x17'));var db=require(_0xc683('0x18'))['db'];config[_0xc683('0x19')]=_['defaults'](config[_0xc683('0x19')],{'host':_0xc683('0x1a'),'port':0x18eb});var socket=require(_0xc683('0x1b'))(new Redis(config['redis']));require(_0xc683('0x1c'))[_0xc683('0x1d')](socket);function respondWithStatusCode(_0x30acc3,_0x7f9b92){_0x7f9b92=_0x7f9b92||0xcc;return function(_0x106d14){if(_0x106d14){return _0x30acc3[_0xc683('0x1e')](_0x7f9b92);}return _0x30acc3['status'](_0x7f9b92)[_0xc683('0x1f')]();};}function respondWithResult(_0x18c550,_0x122b18){_0x122b18=_0x122b18||0xc8;return function(_0x31b935){if(_0x31b935){return _0x18c550[_0xc683('0x20')](_0x122b18)['json'](_0x31b935);}};}function respondWithFilteredResult(_0x155e69,_0x315b53){return function(_0x2b090d){if(_0x2b090d){var _0x1c9f93=_0x2b090d[_0xc683('0x21')],_0xc105cb=_0x315b53[_0xc683('0x22')],_0x2e4034=_0x315b53[_0xc683('0x22')]+_0x315b53[_0xc683('0x23')],_0x4c1d9a;if(_0x2e4034>=_0x1c9f93){_0x2e4034=_0x1c9f93;_0x4c1d9a=0xc8;}else{_0x4c1d9a=0xce;}_0x155e69[_0xc683('0x20')](_0x4c1d9a);return _0x155e69[_0xc683('0x24')](_0xc683('0x25'),_0xc105cb+'-'+_0x2e4034+'/'+_0x1c9f93)[_0xc683('0x26')](_0x2b090d);}return null;};}function patchUpdates(_0x457a7e){return function(_0xc6763b){try{jsonpatch[_0xc683('0x27')](_0xc6763b,_0x457a7e,!![]);}catch(_0x38b444){return BPromise[_0xc683('0x28')](_0x38b444);}return _0xc6763b[_0xc683('0x29')]();};}function saveUpdates(_0x5f46ae,_0x5af207){return function(_0x2812e){if(_0x2812e){return _0x2812e[_0xc683('0x2a')](_0x5f46ae)[_0xc683('0x2b')](function(_0x3dcf76){return _0x3dcf76;});}return null;};}function removeEntity(_0x1fb338,_0x1ffcf7){return function(_0x6767ab){if(_0x6767ab){return _0x6767ab[_0xc683('0x2c')]()[_0xc683('0x2b')](function(){var _0x3b0095=_0x6767ab[_0xc683('0x2d')]({'plain':!![]});var _0x6135e5=_0xc683('0x2e');return db[_0xc683('0x2f')][_0xc683('0x2c')]({'where':{'type':_0x6135e5,'resourceId':_0x3b0095['id']}})[_0xc683('0x2b')](function(){return _0x6767ab;});})['then'](function(){_0x1fb338[_0xc683('0x20')](0xcc)[_0xc683('0x1f')]();});}};}function handleEntityNotFound(_0x2169df,_0x2750e5){return function(_0x3fb328){if(!_0x3fb328){_0x2169df['sendStatus'](0x194);}return _0x3fb328;};}function handleError(_0x3b2475,_0x289011){_0x289011=_0x289011||0x1f4;return function(_0x4f3645){logger[_0xc683('0x30')](_0x4f3645[_0xc683('0x31')]);if(_0x4f3645[_0xc683('0x32')]){delete _0x4f3645[_0xc683('0x32')];}_0x3b2475['status'](_0x289011)[_0xc683('0x33')](_0x4f3645);};}exports[_0xc683('0x34')]=function(_0x23f302,_0x4b0ccb){var _0x3d4876={},_0x2add3c={},_0x206c83={'count':0x0,'rows':[]};var _0x4ec959=_[_0xc683('0x35')](db[_0xc683('0x36')][_0xc683('0x37')],function(_0x537b18){return{'name':_0x537b18[_0xc683('0x38')],'type':_0x537b18[_0xc683('0x39')][_0xc683('0x3a')]};});_0x2add3c[_0xc683('0x3b')]=_['map'](_0x4ec959,_0xc683('0x32'));_0x2add3c[_0xc683('0x3c')]=_['keys'](_0x23f302[_0xc683('0x3c')]);_0x2add3c['filters']=_['intersection'](_0x2add3c[_0xc683('0x3b')],_0x2add3c[_0xc683('0x3c')]);_0x3d4876[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x2add3c['model'],qs[_0xc683('0x3f')](_0x23f302['query'][_0xc683('0x3f')]));_0x3d4876[_0xc683('0x3d')]=_0x3d4876[_0xc683('0x3d')][_0xc683('0x40')]?_0x3d4876[_0xc683('0x3d')]:_0x2add3c['model'];if(!_0x23f302['query'][_0xc683('0x41')](_0xc683('0x42'))){_0x3d4876[_0xc683('0x23')]=qs[_0xc683('0x23')](_0x23f302[_0xc683('0x3c')][_0xc683('0x23')]);_0x3d4876[_0xc683('0x22')]=qs['offset'](_0x23f302[_0xc683('0x3c')][_0xc683('0x22')]);}_0x3d4876[_0xc683('0x43')]=qs[_0xc683('0x44')](_0x23f302['query'][_0xc683('0x44')]);_0x3d4876[_0xc683('0x45')]=qs[_0xc683('0x46')](_['pick'](_0x23f302[_0xc683('0x3c')],_0x2add3c[_0xc683('0x46')]),_0x4ec959);if(_0x23f302[_0xc683('0x3c')][_0xc683('0x47')]){_0x3d4876[_0xc683('0x45')]=_[_0xc683('0x48')](_0x3d4876[_0xc683('0x45')],{'$or':_['map'](_0x4ec959,function(_0x2fb4e9){if(_0x2fb4e9[_0xc683('0x39')]!==_0xc683('0x49')){var _0x5e0080={};_0x5e0080[_0x2fb4e9[_0xc683('0x32')]]={'$like':'%'+_0x23f302[_0xc683('0x3c')][_0xc683('0x47')]+'%'};return _0x5e0080;}})});}_0x3d4876=_['merge']({},_0x3d4876,_0x23f302[_0xc683('0x4a')]);var _0x407ee2={'where':_0x3d4876[_0xc683('0x45')]};return db['WhatsappQueue'][_0xc683('0x21')](_0x407ee2)[_0xc683('0x2b')](function(_0x42a140){_0x206c83[_0xc683('0x21')]=_0x42a140;if(_0x23f302[_0xc683('0x3c')][_0xc683('0x4b')]){_0x3d4876[_0xc683('0x4c')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x3d4876);})['then'](function(_0x3d66c2){_0x206c83['rows']=_0x3d66c2;return _0x206c83;})[_0xc683('0x2b')](respondWithFilteredResult(_0x4b0ccb,_0x3d4876))[_0xc683('0x4d')](handleError(_0x4b0ccb,null));};exports['show']=function(_0x3c22eb,_0x424f48){var _0x5cf166={'raw':!![],'where':{'id':_0x3c22eb[_0xc683('0x4e')]['id']}},_0x4016fd={};_0x4016fd[_0xc683('0x3b')]=_[_0xc683('0x4f')](db[_0xc683('0x36')][_0xc683('0x37')]);_0x4016fd['query']=_[_0xc683('0x4f')](_0x3c22eb['query']);_0x4016fd[_0xc683('0x46')]=_['intersection'](_0x4016fd[_0xc683('0x3b')],_0x4016fd[_0xc683('0x3c')]);_0x5cf166[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x4016fd[_0xc683('0x3b')],qs['fields'](_0x3c22eb[_0xc683('0x3c')]['fields']));_0x5cf166[_0xc683('0x3d')]=_0x5cf166[_0xc683('0x3d')][_0xc683('0x40')]?_0x5cf166['attributes']:_0x4016fd[_0xc683('0x3b')];if(_0x3c22eb[_0xc683('0x3c')]['includeAll']){_0x5cf166[_0xc683('0x4c')]=[{'all':!![]}];}_0x5cf166=_[_0xc683('0x48')]({},_0x5cf166,_0x3c22eb['options']);return db[_0xc683('0x36')][_0xc683('0x50')](_0x5cf166)[_0xc683('0x2b')](handleEntityNotFound(_0x424f48,null))[_0xc683('0x2b')](respondWithResult(_0x424f48,null))['catch'](handleError(_0x424f48,null));};exports['create']=function(_0x3ad500,_0x213052){return db[_0xc683('0x36')][_0xc683('0x51')](_0x3ad500[_0xc683('0x52')],{})[_0xc683('0x2b')](function(_0x275f8e){var _0xcb4337=_0x3ad500[_0xc683('0x53')]['get']({'plain':!![]});if(!_0xcb4337)throw new Error(_0xc683('0x54'));if(_0xcb4337[_0xc683('0x55')]==='user'){var _0x47397b=_0x275f8e['get']({'plain':!![]});var _0x3bd6f5=_0xc683('0x2e');return db[_0xc683('0x56')]['find']({'where':{'name':_0x3bd6f5,'userProfileId':_0xcb4337[_0xc683('0x57')]},'raw':!![]})['then'](function(_0x4a1ec1){if(_0x4a1ec1&&_0x4a1ec1['autoAssociation']===0x0){return db[_0xc683('0x2f')][_0xc683('0x51')]({'name':_0x47397b[_0xc683('0x32')],'resourceId':_0x47397b['id'],'type':_0x4a1ec1['name'],'sectionId':_0x4a1ec1['id']},{})[_0xc683('0x2b')](function(){return _0x275f8e;});}else{return _0x275f8e;}})[_0xc683('0x4d')](function(_0x51b4b0){logger['error'](_0xc683('0x58'),_0x51b4b0);throw _0x51b4b0;});}return _0x275f8e;})[_0xc683('0x2b')](respondWithResult(_0x213052,0xc9))['catch'](handleError(_0x213052,null));};exports['update']=function(_0x314e2d,_0x57e0e2){if(_0x314e2d[_0xc683('0x52')]['id']){delete _0x314e2d[_0xc683('0x52')]['id'];}return db['WhatsappQueue'][_0xc683('0x50')]({'where':{'id':_0x314e2d['params']['id']}})['then'](handleEntityNotFound(_0x57e0e2,null))[_0xc683('0x2b')](saveUpdates(_0x314e2d[_0xc683('0x52')],null))['then'](respondWithResult(_0x57e0e2,null))[_0xc683('0x4d')](handleError(_0x57e0e2,null));};exports['destroy']=function(_0x2f6342,_0x34fe31){return db[_0xc683('0x36')][_0xc683('0x50')]({'where':{'id':_0x2f6342[_0xc683('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34fe31,null))[_0xc683('0x2b')](removeEntity(_0x34fe31,null))[_0xc683('0x4d')](handleError(_0x34fe31,null));};exports[_0xc683('0x59')]=function(_0x2c1fc1,_0x335532){return db[_0xc683('0x36')][_0xc683('0x59')]()['then'](respondWithResult(_0x335532,null))[_0xc683('0x4d')](handleError(_0x335532,null));};exports[_0xc683('0x5a')]=function(_0x1c0168,_0x4685d2,_0x3de37c){var _0x34a9e0={'raw':!![],'where':{}},_0x21588e={},_0x2168aa;return db[_0xc683('0x36')][_0xc683('0x5b')]({'where':{'id':_0x1c0168[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x4685d2,null))[_0xc683('0x2b')](function(_0x1f0e73){if(_0x1f0e73){_0x2168aa=_0x1f0e73[_0xc683('0x2d')]({'plain':!![]});_0x21588e[_0xc683('0x3b')]=_['keys'](db['UserWhatsappQueue'][_0xc683('0x37')]);_0x21588e[_0xc683('0x3c')]=_['keys'](_0x1c0168['query']);_0x21588e[_0xc683('0x46')]=_['intersection'](_0x21588e[_0xc683('0x3b')],_0x21588e['query']);_0x34a9e0[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x21588e['model'],qs['fields'](_0x1c0168[_0xc683('0x3c')][_0xc683('0x3f')]));_0x34a9e0[_0xc683('0x3d')]=_0x34a9e0[_0xc683('0x3d')][_0xc683('0x40')]?_0x34a9e0[_0xc683('0x3d')]:_0x21588e[_0xc683('0x3b')];if(!_0x1c0168[_0xc683('0x3c')][_0xc683('0x41')](_0xc683('0x42'))){_0x34a9e0[_0xc683('0x23')]=qs[_0xc683('0x23')](_0x1c0168['query'][_0xc683('0x23')]);_0x34a9e0[_0xc683('0x22')]=qs[_0xc683('0x22')](_0x1c0168[_0xc683('0x3c')][_0xc683('0x22')]);}_0x34a9e0[_0xc683('0x43')]=qs[_0xc683('0x44')](_0x1c0168['query'][_0xc683('0x44')]);_0x34a9e0['where']=qs[_0xc683('0x46')](_['pick'](_0x1c0168[_0xc683('0x3c')],_0x21588e[_0xc683('0x46')]));_0x34a9e0['where'][_0xc683('0x5c')]=_0x1f0e73['id'];if(_0x1c0168[_0xc683('0x3c')][_0xc683('0x47')]){_0x34a9e0['where']=_[_0xc683('0x48')](_0x34a9e0['where'],{'$or':_[_0xc683('0x35')](_0x34a9e0['attributes'],function(_0x1052e2){var _0x376fd5={};_0x376fd5[_0x1052e2]={'$like':'%'+_0x1c0168[_0xc683('0x3c')][_0xc683('0x47')]+'%'};return _0x376fd5;})});}_0x34a9e0=_[_0xc683('0x48')]({},_0x34a9e0,_0x1c0168['options']);return db[_0xc683('0x5d')]['findAll'](_0x34a9e0);}})[_0xc683('0x2b')](function(_0x368bf2){if(_0x368bf2){return db[_0xc683('0x5e')][_0xc683('0x5f')]({'where':{'id':_[_0xc683('0x35')](_0x368bf2,'UserId'),'role':_0xc683('0x60')},'attributes':['id',_0xc683('0x32'),'whatsappPause','updatedAt','createdAt']});}})[_0xc683('0x2b')](function(_0x2b037d){if(_0x2b037d){return{'count':_0x2b037d[_0xc683('0x21')],'rows':_[_0xc683('0x35')](_0x2b037d[_0xc683('0x61')],function(_0x353999){return{'membername':_0x353999[_0xc683('0x32')],'UserId':_0x353999['id'],'queue_name':_0x2168aa['name'],'WhatsappQueueId':_0x2168aa['id'],'interface':util[_0xc683('0x62')]('%s/%s',_0xc683('0x63'),_0x353999['name']),'penalty':0x0,'paused':_0x353999[_0xc683('0x64')],'createdAt':_0x353999[_0xc683('0x65')],'updatedAt':_0x353999['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc683('0x2b')](respondWithFilteredResult(_0x4685d2,_0x34a9e0))[_0xc683('0x4d')](handleError(_0x4685d2,null));};exports[_0xc683('0x66')]=function(_0x51f5ce,_0x3a7a9a,_0x4e631f){var _0xa3461a={};var _0x368aae={};var _0x209f45;var _0x2b5170;return db[_0xc683('0x36')][_0xc683('0x5b')]({'where':{'id':_0x51f5ce[_0xc683('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a7a9a,null))[_0xc683('0x2b')](function(_0x3ee647){if(_0x3ee647){_0x209f45=_0x3ee647;_0x368aae[_0xc683('0x3b')]=_[_0xc683('0x4f')](db[_0xc683('0x67')][_0xc683('0x37')]);_0x368aae[_0xc683('0x3c')]=_['keys'](_0x51f5ce[_0xc683('0x3c')]);_0x368aae[_0xc683('0x46')]=_[_0xc683('0x3e')](_0x368aae[_0xc683('0x3b')],_0x368aae['query']);_0xa3461a['attributes']=_[_0xc683('0x3e')](_0x368aae[_0xc683('0x3b')],qs[_0xc683('0x3f')](_0x51f5ce[_0xc683('0x3c')][_0xc683('0x3f')]));_0xa3461a[_0xc683('0x3d')]=_0xa3461a['attributes']['length']?_0xa3461a['attributes']:_0x368aae[_0xc683('0x3b')];_0xa3461a[_0xc683('0x43')]=qs[_0xc683('0x44')](_0x51f5ce[_0xc683('0x3c')][_0xc683('0x44')]);_0xa3461a[_0xc683('0x45')]=qs['filters'](_[_0xc683('0x68')](_0x51f5ce[_0xc683('0x3c')],_0x368aae[_0xc683('0x46')]));if(_0x51f5ce[_0xc683('0x3c')]['filter']){_0xa3461a['where']=_[_0xc683('0x48')](_0xa3461a[_0xc683('0x45')],{'$or':_[_0xc683('0x35')](_0xa3461a['attributes'],function(_0x29ab78){var _0x2891dc={};_0x2891dc[_0x29ab78]={'$like':'%'+_0x51f5ce[_0xc683('0x3c')][_0xc683('0x47')]+'%'};return _0x2891dc;})});}_0xa3461a=_[_0xc683('0x48')]({},_0xa3461a,_0x51f5ce['options']);return _0x209f45[_0xc683('0x66')](_0xa3461a);}})['then'](function(_0xf5ac4b){if(_0xf5ac4b){_0x2b5170=_0xf5ac4b[_0xc683('0x40')];if(!_0x51f5ce[_0xc683('0x3c')][_0xc683('0x41')](_0xc683('0x42'))){_0xa3461a['limit']=qs[_0xc683('0x23')](_0x51f5ce[_0xc683('0x3c')][_0xc683('0x23')]);_0xa3461a['offset']=qs[_0xc683('0x22')](_0x51f5ce['query'][_0xc683('0x22')]);}return _0x209f45[_0xc683('0x66')](_0xa3461a);}})[_0xc683('0x2b')](function(_0x287175){if(_0x287175){return _0x287175?{'count':_0x2b5170,'rows':_0x287175}:null;}})[_0xc683('0x2b')](respondWithResult(_0x3a7a9a,null))['catch'](handleError(_0x3a7a9a,null));};exports[_0xc683('0x69')]=function(_0x564fdb,_0x3f5c05,_0x50befa){var _0x4a0aa1=_0x564fdb[_0xc683('0x52')][_0xc683('0x6a')];return db['Team'][_0xc683('0x6b')]({'where':{'id':_0x4a0aa1},'attributes':['id'],'include':[{'model':db[_0xc683('0x5e')],'as':_0xc683('0x6c'),'attributes':['id',_0xc683('0x32'),_0xc683('0x6d'),_0xc683('0x6e'),_0xc683('0x6f')],'raw':!![]}]})[_0xc683('0x2b')](function(_0x4b50d7){if(_0x4b50d7){var _0x3c77db=_[_0xc683('0x70')](_0x4b50d7,function(_0x621552){var _0x535fa2=_0x621552['get']({'plain':!![]});return _0x535fa2[_0xc683('0x6c')];});return db[_0xc683('0x36')]['find']({'where':{'id':_0x564fdb['params']['id']}})[_0xc683('0x2b')](function(_0x36e8d0){return db[_0xc683('0x71')][_0xc683('0x72')](function(_0x43025e){return _0x36e8d0[_0xc683('0x69')](_0x4a0aa1,{'transaction':_0x43025e})[_0xc683('0x2b')](function(){return BPromise[_0xc683('0x73')](_0x3c77db,function(_0x467061){return db[_0xc683('0x5d')][_0xc683('0x74')]({'where':{'UserId':_0x467061['id'],'WhatsappQueueId':_0x564fdb['params']['id']},'transaction':_0x43025e});});})[_0xc683('0x2b')](function(){_0x3c77db[_0xc683('0x75')](function(_0x17091b){socket[_0xc683('0x76')]('userWhatsappQueue:save',{'UserId':_0x17091b['id'],'WhatsappQueueId':_0x36e8d0['id']});});});});});}})[_0xc683('0x2b')](respondWithStatusCode(_0x3f5c05,null))[_0xc683('0x4d')](handleError(_0x3f5c05,null));};exports[_0xc683('0x77')]=function(_0xb1d43a,_0x503f15,_0x216f23){return db[_0xc683('0x67')]['findAll']({'where':{'id':_0xb1d43a[_0xc683('0x3c')][_0xc683('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xc683('0x5e')],'as':_0xc683('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xc683('0x2b')](handleEntityNotFound(_0x503f15,null))[_0xc683('0x2b')](function(_0x48289f){var _0x514363=_['map'](_0x48289f,'id');var _0x2d0f9d=[];var _0x3876d5=[];var _0x22ec11=squel[_0xc683('0x78')]();_0x22ec11['field'](_0xc683('0x79'))[_0xc683('0x7a')](_0xc683('0x7b'),'tq')[_0xc683('0x7c')](_0xc683('0x7d'),'ut',_0xc683('0x7e'))[_0xc683('0x45')](_0xc683('0x7f'),_0xb1d43a[_0xc683('0x4e')]['id']);for(var _0x51abeb=0x0;_0x51abeb<_0x48289f[_0xc683('0x40')];_0x51abeb+=0x1){let _0x235768=_0x48289f[_0x51abeb];for(var _0x1cecb1=0x0;_0x1cecb1<_0x235768[_0xc683('0x6c')][_0xc683('0x40')];_0x1cecb1+=0x1){let _0x924e6d=_0x235768[_0xc683('0x6c')][_0x1cecb1];var _0x53df64=_0x22ec11[_0xc683('0x80')]();_0x53df64[_0xc683('0x45')](_0xc683('0x81'),_0x924e6d['id']);_0x3876d5['push'](db[_0xc683('0x71')][_0xc683('0x3c')](_0x53df64[_0xc683('0x82')](),{'type':db[_0xc683('0x71')]['QueryTypes'][_0xc683('0x83')]})[_0xc683('0x2b')](function(_0x36453f){if(_0x36453f['length']===0x1){return _0x924e6d['id'];}else{var _0x4a5ae6=_[_0xc683('0x84')](_[_0xc683('0x35')](_0x36453f,'TeamId'),function(_0x51eb8d){return _[_0xc683('0x85')](_0x514363,_0x51eb8d);});if(_0x4a5ae6){return _0x924e6d['id'];}}}));}}return BPromise[_0xc683('0x86')](_0x3876d5)[_0xc683('0x2b')](function(_0x542924){_0x2d0f9d=_(_0x2d0f9d)[_0xc683('0x87')](_0x542924)[_0xc683('0x88')]()['value']();return db[_0xc683('0x36')][_0xc683('0x50')]({'where':{'id':_0xb1d43a['params']['id']}})[_0xc683('0x2b')](function(_0x17ddc0){return db[_0xc683('0x71')][_0xc683('0x72')](function(_0x2080a9){return _0x17ddc0['removeTeams'](_0xb1d43a[_0xc683('0x3c')][_0xc683('0x6a')],{'transaction':_0x2080a9})[_0xc683('0x2b')](function(){if(!_[_0xc683('0x89')](_0x2d0f9d)){return _0x17ddc0[_0xc683('0x8a')](_0x2d0f9d,{'transaction':_0x2080a9});}})[_0xc683('0x2b')](function(){_0x2d0f9d[_0xc683('0x75')](function(_0x21af53){socket[_0xc683('0x76')]('userWhatsappQueue:remove',{'UserId':_0x21af53,'WhatsappQueueId':_0x17ddc0['id']});});});});});});})[_0xc683('0x2b')](respondWithStatusCode(_0x503f15,null))['catch'](handleError(_0x503f15,null));};exports['addAgents']=function(_0xd78b6a,_0x2cb45c,_0x2ae571){return db['WhatsappQueue'][_0xc683('0x50')]({'where':{'id':_0xd78b6a[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x2cb45c,null))[_0xc683('0x2b')](function(_0x41c342){if(_0x41c342){return _0x41c342[_0xc683('0x8b')](_0xd78b6a['body'][_0xc683('0x6a')],_[_0xc683('0x8c')](_0xd78b6a[_0xc683('0x52')],[_0xc683('0x6a'),'id'])||{})[_0xc683('0x8d')](function(_0x2ebb05){for(var _0x615b61=0x0;_0x615b61<_0xd78b6a[_0xc683('0x52')][_0xc683('0x6a')][_0xc683('0x40')];_0x615b61+=0x1){socket[_0xc683('0x76')](_0xc683('0x8e'),{'UserId':_0xd78b6a[_0xc683('0x52')][_0xc683('0x6a')][_0x615b61],'WhatsappQueueId':_0xd78b6a[_0xc683('0x4e')]['id']});}return _0x2ebb05;});}})[_0xc683('0x2b')](respondWithResult(_0x2cb45c,null))['catch'](handleError(_0x2cb45c,null));};exports[_0xc683('0x8a')]=function(_0x378f68,_0x42218d,_0x212a99){return db[_0xc683('0x36')][_0xc683('0x50')]({'where':{'id':_0x378f68[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x42218d,null))['then'](function(_0x329fd7){if(_0x329fd7){return _0x329fd7[_0xc683('0x8a')](_0x378f68[_0xc683('0x3c')][_0xc683('0x6a')])['then'](function(){if(_['isArray'](_0x378f68[_0xc683('0x3c')][_0xc683('0x6a')])){for(var _0x51bb06=0x0;_0x51bb06<_0x378f68[_0xc683('0x3c')]['ids'][_0xc683('0x40')];_0x51bb06+=0x1){socket[_0xc683('0x76')](_0xc683('0x8f'),{'UserId':Number(_0x378f68[_0xc683('0x3c')][_0xc683('0x6a')][_0x51bb06]),'WhatsappQueueId':Number(_0x378f68[_0xc683('0x4e')]['id'])});}}else{socket[_0xc683('0x76')](_0xc683('0x8f'),{'UserId':Number(_0x378f68['query'][_0xc683('0x6a')]),'WhatsappQueueId':Number(_0x378f68[_0xc683('0x4e')]['id'])});}});}})[_0xc683('0x2b')](respondWithStatusCode(_0x42218d,null))[_0xc683('0x4d')](handleError(_0x42218d,null));};exports[_0xc683('0x90')]=function(_0x4d6658,_0x4125b2,_0x46f83f){var _0xf01c7={};var _0x769782={};var _0x2ca404;var _0x16482e;return db[_0xc683('0x36')]['findOne']({'where':{'id':_0x4d6658[_0xc683('0x4e')]['id']}})[_0xc683('0x2b')](handleEntityNotFound(_0x4125b2,null))[_0xc683('0x2b')](function(_0x11bb78){if(_0x11bb78){_0x2ca404=_0x11bb78;_0x769782['model']=_['keys'](db['User']['rawAttributes']);_0x769782['query']=_[_0xc683('0x4f')](_0x4d6658['query']);_0x769782[_0xc683('0x46')]=_[_0xc683('0x3e')](_0x769782['model'],_0x769782[_0xc683('0x3c')]);_0xf01c7[_0xc683('0x3d')]=_[_0xc683('0x3e')](_0x769782['model'],qs[_0xc683('0x3f')](_0x4d6658[_0xc683('0x3c')][_0xc683('0x3f')]));_0xf01c7[_0xc683('0x3d')]=_0xf01c7[_0xc683('0x3d')][_0xc683('0x40')]?_0xf01c7[_0xc683('0x3d')]:_0x769782[_0xc683('0x3b')];_0xf01c7[_0xc683('0x43')]=qs['sort'](_0x4d6658[_0xc683('0x3c')][_0xc683('0x44')]);_0xf01c7['where']=qs[_0xc683('0x46')](_['pick'](_0x4d6658[_0xc683('0x3c')],_0x769782[_0xc683('0x46')]));if(_0x4d6658['query'][_0xc683('0x47')]){_0xf01c7['where']=_[_0xc683('0x48')](_0xf01c7['where'],{'$or':_[_0xc683('0x35')](_0xf01c7[_0xc683('0x3d')],function(_0x4e7e1b){var _0x115c9f={};_0x115c9f[_0x4e7e1b]={'$like':'%'+_0x4d6658['query'][_0xc683('0x47')]+'%'};return _0x115c9f;})});}_0xf01c7=_[_0xc683('0x48')]({},_0xf01c7,_0x4d6658[_0xc683('0x4a')]);return _0x2ca404['getAgents'](_0xf01c7);}})['then'](function(_0x546080){if(_0x546080){_0x16482e=_0x546080[_0xc683('0x40')];if(!_0x4d6658[_0xc683('0x3c')][_0xc683('0x41')](_0xc683('0x42'))){_0xf01c7[_0xc683('0x23')]=qs['limit'](_0x4d6658[_0xc683('0x3c')][_0xc683('0x23')]);_0xf01c7[_0xc683('0x22')]=qs[_0xc683('0x22')](_0x4d6658[_0xc683('0x3c')][_0xc683('0x22')]);}return _0x2ca404[_0xc683('0x90')](_0xf01c7);}})[_0xc683('0x2b')](function(_0x2fbe9c){if(_0x2fbe9c){return _0x2fbe9c?{'count':_0x16482e,'rows':_0x2fbe9c}:null;}})[_0xc683('0x2b')](respondWithResult(_0x4125b2,null))[_0xc683('0x4d')](handleError(_0x4125b2,null));}; \ No newline at end of file +var _0x6dd6=['getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./whatsappQueue.socket','register','status','json','offset','set','Content-Range','apply','reject','save','update','then','WhatsappQueues','UserProfileResource','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','WhatsappQueue','count','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','updatedAt','%s/%s','SIP','whatsappPause','createdAt','Team','getTeams','addTeams','Agents','online','voicePause','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','field','tq.TeamId','from','user_has_teams','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x6dd6,0x19c));var _0x66dd=function(_0x4f51f2,_0x277484){_0x4f51f2=_0x4f51f2-0x0;var _0x1cfdf3=_0x6dd6[_0x4f51f2];return _0x1cfdf3;};'use strict';var pdf=require(_0x66dd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66dd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66dd('0x2'));var moment=require(_0x66dd('0x3'));var BPromise=require(_0x66dd('0x4'));var Mustache=require(_0x66dd('0x5'));var util=require('util');var path=require(_0x66dd('0x6'));var sox=require(_0x66dd('0x7'));var csv=require(_0x66dd('0x8'));var ejs=require(_0x66dd('0x9'));var fs=require('fs');var _=require(_0x66dd('0xa'));var squel=require(_0x66dd('0xb'));var crypto=require(_0x66dd('0xc'));var jsforce=require(_0x66dd('0xd'));var deskjs=require(_0x66dd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x66dd('0xf'));var Papa=require(_0x66dd('0x10'));var Redis=require(_0x66dd('0x11'));var authService=require(_0x66dd('0x12'));var qs=require(_0x66dd('0x13'));var as=require(_0x66dd('0x14'));var hardwareService=require(_0x66dd('0x15'));var logger=require(_0x66dd('0x16'))(_0x66dd('0x17'));var utils=require(_0x66dd('0x18'));var config=require(_0x66dd('0x19'));var db=require('../../mysqldb')['db'];config[_0x66dd('0x1a')]=_[_0x66dd('0x1b')](config[_0x66dd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66dd('0x1a')]));require(_0x66dd('0x1c'))[_0x66dd('0x1d')](socket);function respondWithStatusCode(_0x46aec9,_0x341cfd){_0x341cfd=_0x341cfd||0xcc;return function(_0x407c36){if(_0x407c36){return _0x46aec9['sendStatus'](_0x341cfd);}return _0x46aec9['status'](_0x341cfd)['end']();};}function respondWithResult(_0x544335,_0x53a257){_0x53a257=_0x53a257||0xc8;return function(_0x5bfe48){if(_0x5bfe48){return _0x544335[_0x66dd('0x1e')](_0x53a257)[_0x66dd('0x1f')](_0x5bfe48);}};}function respondWithFilteredResult(_0x39051d,_0x284b30){return function(_0x40359e){if(_0x40359e){var _0x4341d4=_0x40359e['count'],_0x396638=_0x284b30[_0x66dd('0x20')],_0x4e2730=_0x284b30['offset']+_0x284b30['limit'],_0x4ce306;if(_0x4e2730>=_0x4341d4){_0x4e2730=_0x4341d4;_0x4ce306=0xc8;}else{_0x4ce306=0xce;}_0x39051d[_0x66dd('0x1e')](_0x4ce306);return _0x39051d[_0x66dd('0x21')](_0x66dd('0x22'),_0x396638+'-'+_0x4e2730+'/'+_0x4341d4)[_0x66dd('0x1f')](_0x40359e);}return null;};}function patchUpdates(_0xc7dc1d){return function(_0x270a56){try{jsonpatch[_0x66dd('0x23')](_0x270a56,_0xc7dc1d,!![]);}catch(_0x3bfffc){return BPromise[_0x66dd('0x24')](_0x3bfffc);}return _0x270a56[_0x66dd('0x25')]();};}function saveUpdates(_0x1f6373,_0x3ecd74){return function(_0x57eea2){if(_0x57eea2){return _0x57eea2[_0x66dd('0x26')](_0x1f6373)['then'](function(_0x923cc0){return _0x923cc0;});}return null;};}function removeEntity(_0x728fac,_0x1426f2){return function(_0x3a8413){if(_0x3a8413){return _0x3a8413['destroy']()[_0x66dd('0x27')](function(){var _0x1ffb35=_0x3a8413['get']({'plain':!![]});var _0x24b49b=_0x66dd('0x28');return db[_0x66dd('0x29')]['destroy']({'where':{'type':_0x24b49b,'resourceId':_0x1ffb35['id']}})[_0x66dd('0x27')](function(){return _0x3a8413;});})['then'](function(){_0x728fac[_0x66dd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8a07,_0x2396ef){return function(_0x51a088){if(!_0x51a088){_0x3f8a07[_0x66dd('0x2a')](0x194);}return _0x51a088;};}function handleError(_0x1a2de3,_0xd28719){_0xd28719=_0xd28719||0x1f4;return function(_0x1fc66d){logger['error'](_0x1fc66d[_0x66dd('0x2b')]);if(_0x1fc66d['name']){delete _0x1fc66d['name'];}_0x1a2de3[_0x66dd('0x1e')](_0xd28719)[_0x66dd('0x2c')](_0x1fc66d);};}exports[_0x66dd('0x2d')]=function(_0x20c3be,_0x4ecf59){var _0x63132={},_0x4e07de={},_0x507149={'count':0x0,'rows':[]};var _0x54994b=_[_0x66dd('0x2e')](db['WhatsappQueue'][_0x66dd('0x2f')],function(_0x192b00){return{'name':_0x192b00[_0x66dd('0x30')],'type':_0x192b00[_0x66dd('0x31')][_0x66dd('0x32')]};});_0x4e07de[_0x66dd('0x33')]=_['map'](_0x54994b,_0x66dd('0x34'));_0x4e07de['query']=_['keys'](_0x20c3be[_0x66dd('0x35')]);_0x4e07de['filters']=_['intersection'](_0x4e07de['model'],_0x4e07de[_0x66dd('0x35')]);_0x63132[_0x66dd('0x36')]=_['intersection'](_0x4e07de[_0x66dd('0x33')],qs[_0x66dd('0x37')](_0x20c3be['query'][_0x66dd('0x37')]));_0x63132['attributes']=_0x63132['attributes'][_0x66dd('0x38')]?_0x63132[_0x66dd('0x36')]:_0x4e07de[_0x66dd('0x33')];if(!_0x20c3be[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x63132['limit']=qs['limit'](_0x20c3be[_0x66dd('0x35')][_0x66dd('0x3b')]);_0x63132['offset']=qs['offset'](_0x20c3be[_0x66dd('0x35')][_0x66dd('0x20')]);}_0x63132[_0x66dd('0x3c')]=qs[_0x66dd('0x3d')](_0x20c3be[_0x66dd('0x35')][_0x66dd('0x3d')]);_0x63132[_0x66dd('0x3e')]=qs[_0x66dd('0x3f')](_[_0x66dd('0x40')](_0x20c3be[_0x66dd('0x35')],_0x4e07de['filters']),_0x54994b);if(_0x20c3be[_0x66dd('0x35')]['filter']){_0x63132[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x63132['where'],{'$or':_[_0x66dd('0x2e')](_0x54994b,function(_0x11d32d){if(_0x11d32d[_0x66dd('0x31')]!=='VIRTUAL'){var _0x38c67c={};_0x38c67c[_0x11d32d[_0x66dd('0x34')]]={'$like':'%'+_0x20c3be['query'][_0x66dd('0x42')]+'%'};return _0x38c67c;}})});}_0x63132=_[_0x66dd('0x41')]({},_0x63132,_0x20c3be[_0x66dd('0x43')]);var _0x32b868={'where':_0x63132[_0x66dd('0x3e')]};return db[_0x66dd('0x44')][_0x66dd('0x45')](_0x32b868)[_0x66dd('0x27')](function(_0x13567a){_0x507149['count']=_0x13567a;if(_0x20c3be[_0x66dd('0x35')][_0x66dd('0x46')]){_0x63132[_0x66dd('0x47')]=[{'all':!![]}];}return db[_0x66dd('0x44')][_0x66dd('0x48')](_0x63132);})[_0x66dd('0x27')](function(_0x32a072){_0x507149[_0x66dd('0x49')]=_0x32a072;return _0x507149;})[_0x66dd('0x27')](respondWithFilteredResult(_0x4ecf59,_0x63132))[_0x66dd('0x4a')](handleError(_0x4ecf59,null));};exports[_0x66dd('0x4b')]=function(_0x3fd988,_0x409708){var _0x270923={'raw':!![],'where':{'id':_0x3fd988['params']['id']}},_0x28385a={};_0x28385a[_0x66dd('0x33')]=_[_0x66dd('0x4c')](db[_0x66dd('0x44')][_0x66dd('0x2f')]);_0x28385a['query']=_[_0x66dd('0x4c')](_0x3fd988[_0x66dd('0x35')]);_0x28385a[_0x66dd('0x3f')]=_['intersection'](_0x28385a[_0x66dd('0x33')],_0x28385a[_0x66dd('0x35')]);_0x270923[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x28385a['model'],qs[_0x66dd('0x37')](_0x3fd988[_0x66dd('0x35')][_0x66dd('0x37')]));_0x270923['attributes']=_0x270923['attributes'][_0x66dd('0x38')]?_0x270923[_0x66dd('0x36')]:_0x28385a[_0x66dd('0x33')];if(_0x3fd988['query'][_0x66dd('0x46')]){_0x270923[_0x66dd('0x47')]=[{'all':!![]}];}_0x270923=_[_0x66dd('0x41')]({},_0x270923,_0x3fd988[_0x66dd('0x43')]);return db[_0x66dd('0x44')][_0x66dd('0x4e')](_0x270923)[_0x66dd('0x27')](handleEntityNotFound(_0x409708,null))[_0x66dd('0x27')](respondWithResult(_0x409708,null))[_0x66dd('0x4a')](handleError(_0x409708,null));};exports[_0x66dd('0x4f')]=function(_0x4529ef,_0x37519e){return db[_0x66dd('0x44')][_0x66dd('0x4f')](_0x4529ef[_0x66dd('0x50')],{})[_0x66dd('0x27')](function(_0xe2e24a){var _0x5a9001=_0x4529ef[_0x66dd('0x51')][_0x66dd('0x52')]({'plain':!![]});if(!_0x5a9001)throw new Error(_0x66dd('0x53'));if(_0x5a9001[_0x66dd('0x54')]==='user'){var _0xeae18a=_0xe2e24a[_0x66dd('0x52')]({'plain':!![]});var _0x32138f=_0x66dd('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x32138f,'userProfileId':_0x5a9001[_0x66dd('0x55')]},'raw':!![]})[_0x66dd('0x27')](function(_0x520e50){if(_0x520e50&&_0x520e50[_0x66dd('0x56')]===0x0){return db[_0x66dd('0x29')]['create']({'name':_0xeae18a[_0x66dd('0x34')],'resourceId':_0xeae18a['id'],'type':_0x520e50['name'],'sectionId':_0x520e50['id']},{})[_0x66dd('0x27')](function(){return _0xe2e24a;});}else{return _0xe2e24a;}})[_0x66dd('0x4a')](function(_0x2057d9){logger[_0x66dd('0x57')](_0x66dd('0x58'),_0x2057d9);throw _0x2057d9;});}return _0xe2e24a;})[_0x66dd('0x27')](respondWithResult(_0x37519e,0xc9))[_0x66dd('0x4a')](handleError(_0x37519e,null));};exports[_0x66dd('0x26')]=function(_0x5533cd,_0x2c05e5){if(_0x5533cd[_0x66dd('0x50')]['id']){delete _0x5533cd[_0x66dd('0x50')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x5533cd[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c05e5,null))[_0x66dd('0x27')](saveUpdates(_0x5533cd[_0x66dd('0x50')],null))[_0x66dd('0x27')](respondWithResult(_0x2c05e5,null))[_0x66dd('0x4a')](handleError(_0x2c05e5,null));};exports[_0x66dd('0x5a')]=function(_0x1b9fa8,_0x2566ad){return db['WhatsappQueue'][_0x66dd('0x4e')]({'where':{'id':_0x1b9fa8[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](handleEntityNotFound(_0x2566ad,null))[_0x66dd('0x27')](removeEntity(_0x2566ad,null))[_0x66dd('0x4a')](handleError(_0x2566ad,null));};exports[_0x66dd('0x5b')]=function(_0x5604b1,_0x3ce4f1){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x3ce4f1,null))['catch'](handleError(_0x3ce4f1,null));};exports[_0x66dd('0x5c')]=function(_0x26bb45,_0xdca0ff,_0x5e9473){var _0x59ac38={'raw':!![],'where':{}},_0x2289a5={},_0x38f6d7;return db[_0x66dd('0x44')][_0x66dd('0x5d')]({'where':{'id':_0x26bb45[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](handleEntityNotFound(_0xdca0ff,null))[_0x66dd('0x27')](function(_0x4bbfe6){if(_0x4bbfe6){_0x38f6d7=_0x4bbfe6[_0x66dd('0x52')]({'plain':!![]});_0x2289a5[_0x66dd('0x33')]=_[_0x66dd('0x4c')](db['UserWhatsappQueue']['rawAttributes']);_0x2289a5[_0x66dd('0x35')]=_[_0x66dd('0x4c')](_0x26bb45[_0x66dd('0x35')]);_0x2289a5[_0x66dd('0x3f')]=_['intersection'](_0x2289a5[_0x66dd('0x33')],_0x2289a5[_0x66dd('0x35')]);_0x59ac38[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x2289a5[_0x66dd('0x33')],qs['fields'](_0x26bb45[_0x66dd('0x35')]['fields']));_0x59ac38['attributes']=_0x59ac38[_0x66dd('0x36')][_0x66dd('0x38')]?_0x59ac38[_0x66dd('0x36')]:_0x2289a5['model'];if(!_0x26bb45[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x59ac38[_0x66dd('0x3b')]=qs[_0x66dd('0x3b')](_0x26bb45[_0x66dd('0x35')][_0x66dd('0x3b')]);_0x59ac38['offset']=qs[_0x66dd('0x20')](_0x26bb45[_0x66dd('0x35')][_0x66dd('0x20')]);}_0x59ac38[_0x66dd('0x3c')]=qs[_0x66dd('0x3d')](_0x26bb45[_0x66dd('0x35')][_0x66dd('0x3d')]);_0x59ac38['where']=qs[_0x66dd('0x3f')](_[_0x66dd('0x40')](_0x26bb45[_0x66dd('0x35')],_0x2289a5['filters']));_0x59ac38[_0x66dd('0x3e')][_0x66dd('0x5e')]=_0x4bbfe6['id'];if(_0x26bb45[_0x66dd('0x35')][_0x66dd('0x42')]){_0x59ac38[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x59ac38['where'],{'$or':_[_0x66dd('0x2e')](_0x59ac38[_0x66dd('0x36')],function(_0x1762a8){var _0x5a7468={};_0x5a7468[_0x1762a8]={'$like':'%'+_0x26bb45[_0x66dd('0x35')][_0x66dd('0x42')]+'%'};return _0x5a7468;})});}_0x59ac38=_[_0x66dd('0x41')]({},_0x59ac38,_0x26bb45[_0x66dd('0x43')]);return db[_0x66dd('0x5f')][_0x66dd('0x48')](_0x59ac38);}})[_0x66dd('0x27')](function(_0x3c72fd){if(_0x3c72fd){return db[_0x66dd('0x60')][_0x66dd('0x61')]({'where':{'id':_[_0x66dd('0x2e')](_0x3c72fd,'UserId'),'role':'agent'},'attributes':['id','name','whatsappPause',_0x66dd('0x62'),'createdAt']});}})[_0x66dd('0x27')](function(_0x3f08e1){if(_0x3f08e1){return{'count':_0x3f08e1[_0x66dd('0x45')],'rows':_[_0x66dd('0x2e')](_0x3f08e1[_0x66dd('0x49')],function(_0x24ef84){return{'membername':_0x24ef84[_0x66dd('0x34')],'UserId':_0x24ef84['id'],'queue_name':_0x38f6d7[_0x66dd('0x34')],'WhatsappQueueId':_0x38f6d7['id'],'interface':util['format'](_0x66dd('0x63'),_0x66dd('0x64'),_0x24ef84[_0x66dd('0x34')]),'penalty':0x0,'paused':_0x24ef84[_0x66dd('0x65')],'createdAt':_0x24ef84[_0x66dd('0x66')],'updatedAt':_0x24ef84['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xdca0ff,_0x59ac38))[_0x66dd('0x4a')](handleError(_0xdca0ff,null));};exports['getTeams']=function(_0x14dfe7,_0x1aae61,_0x26e8e8){var _0x3244fa={};var _0x55e8da={};var _0x2fdc25;var _0x3944ae;return db[_0x66dd('0x44')][_0x66dd('0x5d')]({'where':{'id':_0x14dfe7[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x1aae61,null))[_0x66dd('0x27')](function(_0x5c9285){if(_0x5c9285){_0x2fdc25=_0x5c9285;_0x55e8da['model']=_[_0x66dd('0x4c')](db[_0x66dd('0x67')][_0x66dd('0x2f')]);_0x55e8da['query']=_['keys'](_0x14dfe7[_0x66dd('0x35')]);_0x55e8da[_0x66dd('0x3f')]=_['intersection'](_0x55e8da[_0x66dd('0x33')],_0x55e8da[_0x66dd('0x35')]);_0x3244fa[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x55e8da[_0x66dd('0x33')],qs[_0x66dd('0x37')](_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x37')]));_0x3244fa[_0x66dd('0x36')]=_0x3244fa[_0x66dd('0x36')][_0x66dd('0x38')]?_0x3244fa[_0x66dd('0x36')]:_0x55e8da['model'];_0x3244fa[_0x66dd('0x3c')]=qs[_0x66dd('0x3d')](_0x14dfe7['query'][_0x66dd('0x3d')]);_0x3244fa[_0x66dd('0x3e')]=qs[_0x66dd('0x3f')](_[_0x66dd('0x40')](_0x14dfe7['query'],_0x55e8da[_0x66dd('0x3f')]));if(_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x42')]){_0x3244fa[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x3244fa['where'],{'$or':_[_0x66dd('0x2e')](_0x3244fa[_0x66dd('0x36')],function(_0xbc977e){var _0x48d103={};_0x48d103[_0xbc977e]={'$like':'%'+_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x42')]+'%'};return _0x48d103;})});}_0x3244fa=_['merge']({},_0x3244fa,_0x14dfe7[_0x66dd('0x43')]);return _0x2fdc25['getTeams'](_0x3244fa);}})['then'](function(_0x4282f0){if(_0x4282f0){_0x3944ae=_0x4282f0[_0x66dd('0x38')];if(!_0x14dfe7[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x3244fa['limit']=qs[_0x66dd('0x3b')](_0x14dfe7[_0x66dd('0x35')]['limit']);_0x3244fa[_0x66dd('0x20')]=qs[_0x66dd('0x20')](_0x14dfe7['query'][_0x66dd('0x20')]);}return _0x2fdc25[_0x66dd('0x68')](_0x3244fa);}})[_0x66dd('0x27')](function(_0x4d6c88){if(_0x4d6c88){return _0x4d6c88?{'count':_0x3944ae,'rows':_0x4d6c88}:null;}})['then'](respondWithResult(_0x1aae61,null))['catch'](handleError(_0x1aae61,null));};exports[_0x66dd('0x69')]=function(_0x2265a4,_0x1df23e,_0x3ac90e){var _0x4c6b97=_0x2265a4['body']['ids'];return db[_0x66dd('0x67')][_0x66dd('0x48')]({'where':{'id':_0x4c6b97},'attributes':['id'],'include':[{'model':db['User'],'as':_0x66dd('0x6a'),'attributes':['id','name',_0x66dd('0x6b'),_0x66dd('0x6c'),'interface'],'raw':!![]}]})[_0x66dd('0x27')](function(_0x1eadc9){if(_0x1eadc9){var _0x374132=_['flatMap'](_0x1eadc9,function(_0x374da2){var _0x1ee3e1=_0x374da2[_0x66dd('0x52')]({'plain':!![]});return _0x1ee3e1[_0x66dd('0x6a')];});return db[_0x66dd('0x44')]['find']({'where':{'id':_0x2265a4[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](function(_0x1839c4){return db['sequelize'][_0x66dd('0x6d')](function(_0x23f827){return _0x1839c4['addTeams'](_0x4c6b97,{'transaction':_0x23f827})[_0x66dd('0x27')](function(){return BPromise[_0x66dd('0x6e')](_0x374132,function(_0x1827c3){return db[_0x66dd('0x5f')][_0x66dd('0x6f')]({'where':{'UserId':_0x1827c3['id'],'WhatsappQueueId':_0x2265a4[_0x66dd('0x59')]['id']},'transaction':_0x23f827});});})[_0x66dd('0x27')](function(){_0x374132[_0x66dd('0x70')](function(_0x15eba8){socket[_0x66dd('0x71')](_0x66dd('0x72'),{'UserId':_0x15eba8['id'],'WhatsappQueueId':_0x1839c4['id']});});});});});}})[_0x66dd('0x27')](respondWithStatusCode(_0x1df23e,null))['catch'](handleError(_0x1df23e,null));};exports[_0x66dd('0x73')]=function(_0x2ea43e,_0x3cef2f,_0x5841f1){return db[_0x66dd('0x67')][_0x66dd('0x48')]({'where':{'id':_0x2ea43e[_0x66dd('0x35')][_0x66dd('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x66dd('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x66dd('0x27')](handleEntityNotFound(_0x3cef2f,null))[_0x66dd('0x27')](function(_0x2d4efe){var _0x57843d=_[_0x66dd('0x2e')](_0x2d4efe,'id');var _0x106e65=[];var _0xd6a857=[];var _0x39e6e7=squel['select']();_0x39e6e7[_0x66dd('0x75')](_0x66dd('0x76'))[_0x66dd('0x77')]('team_has_whatsapp_queues','tq')['join'](_0x66dd('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x66dd('0x3e')](_0x66dd('0x79'),_0x2ea43e[_0x66dd('0x59')]['id']);for(var _0x2047d9=0x0;_0x2047d9<_0x2d4efe['length'];_0x2047d9+=0x1){let _0x5bccd4=_0x2d4efe[_0x2047d9];for(var _0x5ce2d8=0x0;_0x5ce2d8<_0x5bccd4[_0x66dd('0x6a')][_0x66dd('0x38')];_0x5ce2d8+=0x1){let _0xb433e4=_0x5bccd4[_0x66dd('0x6a')][_0x5ce2d8];var _0x141712=_0x39e6e7[_0x66dd('0x7a')]();_0x141712[_0x66dd('0x3e')]('ut.UserId\x20=\x20?',_0xb433e4['id']);_0xd6a857['push'](db[_0x66dd('0x7b')][_0x66dd('0x35')](_0x141712[_0x66dd('0x7c')](),{'type':db[_0x66dd('0x7b')][_0x66dd('0x7d')][_0x66dd('0x7e')]})['then'](function(_0x43373f){if(_0x43373f[_0x66dd('0x38')]===0x1){return _0xb433e4['id'];}else{var _0x16581e=_[_0x66dd('0x7f')](_[_0x66dd('0x2e')](_0x43373f,'TeamId'),function(_0xecbe21){return _['includes'](_0x57843d,_0xecbe21);});if(_0x16581e){return _0xb433e4['id'];}}}));}}return BPromise[_0x66dd('0x80')](_0xd6a857)[_0x66dd('0x27')](function(_0x201ac6){_0x106e65=_(_0x106e65)['union'](_0x201ac6)['compact']()[_0x66dd('0x81')]();return db[_0x66dd('0x44')][_0x66dd('0x4e')]({'where':{'id':_0x2ea43e[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](function(_0x3b87e7){return db[_0x66dd('0x7b')][_0x66dd('0x6d')](function(_0x1a6b6c){return _0x3b87e7[_0x66dd('0x73')](_0x2ea43e[_0x66dd('0x35')][_0x66dd('0x74')],{'transaction':_0x1a6b6c})['then'](function(){if(!_[_0x66dd('0x82')](_0x106e65)){return _0x3b87e7[_0x66dd('0x83')](_0x106e65,{'transaction':_0x1a6b6c});}})[_0x66dd('0x27')](function(){_0x106e65[_0x66dd('0x70')](function(_0x18c15c){socket[_0x66dd('0x71')](_0x66dd('0x84'),{'UserId':_0x18c15c,'WhatsappQueueId':_0x3b87e7['id']});});});});});});})[_0x66dd('0x27')](respondWithStatusCode(_0x3cef2f,null))['catch'](handleError(_0x3cef2f,null));};exports[_0x66dd('0x85')]=function(_0x9a789c,_0x400879,_0x17b51c){return db[_0x66dd('0x44')]['find']({'where':{'id':_0x9a789c[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x400879,null))[_0x66dd('0x27')](function(_0x4949a8){if(_0x4949a8){return _0x4949a8[_0x66dd('0x85')](_0x9a789c[_0x66dd('0x50')][_0x66dd('0x74')],_[_0x66dd('0x86')](_0x9a789c[_0x66dd('0x50')],['ids','id'])||{})['spread'](function(_0x415b8f){for(var _0x4df177=0x0;_0x4df177<_0x9a789c[_0x66dd('0x50')][_0x66dd('0x74')]['length'];_0x4df177+=0x1){socket['emit'](_0x66dd('0x72'),{'UserId':_0x9a789c[_0x66dd('0x50')]['ids'][_0x4df177],'WhatsappQueueId':_0x9a789c[_0x66dd('0x59')]['id']});}return _0x415b8f;});}})['then'](respondWithResult(_0x400879,null))[_0x66dd('0x4a')](handleError(_0x400879,null));};exports['removeAgents']=function(_0x2a4ebf,_0x53af3d,_0x28d185){return db['WhatsappQueue'][_0x66dd('0x4e')]({'where':{'id':_0x2a4ebf[_0x66dd('0x59')]['id']}})[_0x66dd('0x27')](handleEntityNotFound(_0x53af3d,null))['then'](function(_0x2b3827){if(_0x2b3827){return _0x2b3827[_0x66dd('0x83')](_0x2a4ebf['query']['ids'])[_0x66dd('0x27')](function(){if(_[_0x66dd('0x87')](_0x2a4ebf['query'][_0x66dd('0x74')])){for(var _0x54bd35=0x0;_0x54bd35<_0x2a4ebf[_0x66dd('0x35')][_0x66dd('0x74')][_0x66dd('0x38')];_0x54bd35+=0x1){socket['emit'](_0x66dd('0x84'),{'UserId':Number(_0x2a4ebf[_0x66dd('0x35')]['ids'][_0x54bd35]),'WhatsappQueueId':Number(_0x2a4ebf[_0x66dd('0x59')]['id'])});}}else{socket[_0x66dd('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x2a4ebf[_0x66dd('0x35')][_0x66dd('0x74')]),'WhatsappQueueId':Number(_0x2a4ebf[_0x66dd('0x59')]['id'])});}});}})[_0x66dd('0x27')](respondWithStatusCode(_0x53af3d,null))[_0x66dd('0x4a')](handleError(_0x53af3d,null));};exports[_0x66dd('0x88')]=function(_0x221e77,_0x4e9335,_0x5b00f0){var _0x27edd5={};var _0x17d0fc={};var _0x241033;var _0x25d347;return db[_0x66dd('0x44')][_0x66dd('0x5d')]({'where':{'id':_0x221e77[_0x66dd('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e9335,null))['then'](function(_0x5b550f){if(_0x5b550f){_0x241033=_0x5b550f;_0x17d0fc[_0x66dd('0x33')]=_[_0x66dd('0x4c')](db['User'][_0x66dd('0x2f')]);_0x17d0fc['query']=_[_0x66dd('0x4c')](_0x221e77[_0x66dd('0x35')]);_0x17d0fc[_0x66dd('0x3f')]=_[_0x66dd('0x4d')](_0x17d0fc['model'],_0x17d0fc[_0x66dd('0x35')]);_0x27edd5[_0x66dd('0x36')]=_[_0x66dd('0x4d')](_0x17d0fc[_0x66dd('0x33')],qs[_0x66dd('0x37')](_0x221e77[_0x66dd('0x35')][_0x66dd('0x37')]));_0x27edd5[_0x66dd('0x36')]=_0x27edd5[_0x66dd('0x36')][_0x66dd('0x38')]?_0x27edd5['attributes']:_0x17d0fc['model'];_0x27edd5[_0x66dd('0x3c')]=qs['sort'](_0x221e77['query']['sort']);_0x27edd5['where']=qs['filters'](_[_0x66dd('0x40')](_0x221e77[_0x66dd('0x35')],_0x17d0fc[_0x66dd('0x3f')]));if(_0x221e77[_0x66dd('0x35')][_0x66dd('0x42')]){_0x27edd5[_0x66dd('0x3e')]=_[_0x66dd('0x41')](_0x27edd5['where'],{'$or':_[_0x66dd('0x2e')](_0x27edd5['attributes'],function(_0x18e307){var _0x54a9b0={};_0x54a9b0[_0x18e307]={'$like':'%'+_0x221e77[_0x66dd('0x35')][_0x66dd('0x42')]+'%'};return _0x54a9b0;})});}_0x27edd5=_['merge']({},_0x27edd5,_0x221e77[_0x66dd('0x43')]);return _0x241033[_0x66dd('0x88')](_0x27edd5);}})[_0x66dd('0x27')](function(_0x3367e4){if(_0x3367e4){_0x25d347=_0x3367e4[_0x66dd('0x38')];if(!_0x221e77[_0x66dd('0x35')][_0x66dd('0x39')](_0x66dd('0x3a'))){_0x27edd5['limit']=qs[_0x66dd('0x3b')](_0x221e77[_0x66dd('0x35')][_0x66dd('0x3b')]);_0x27edd5[_0x66dd('0x20')]=qs[_0x66dd('0x20')](_0x221e77[_0x66dd('0x35')][_0x66dd('0x20')]);}return _0x241033[_0x66dd('0x88')](_0x27edd5);}})[_0x66dd('0x27')](function(_0x26b50f){if(_0x26b50f){return _0x26b50f?{'count':_0x25d347,'rows':_0x26b50f}:null;}})[_0x66dd('0x27')](respondWithResult(_0x4e9335,null))[_0x66dd('0x4a')](handleError(_0x4e9335,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 8a1ab18..a0d365e 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 _0x51f0=['emit','exports','events','setMaxListeners','save'];(function(_0x54f0b7,_0x1f969e){var _0x3c1e8f=function(_0x5c6aa0){while(--_0x5c6aa0){_0x54f0b7['push'](_0x54f0b7['shift']());}};_0x3c1e8f(++_0x1f969e);}(_0x51f0,0x7a));var _0x051f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x51f0[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x051f('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x051f('0x1')](0x0);var events={'afterCreate':_0x051f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xcbc31c){return function(_0x3eebe9,_0x488ea3,_0x1c7d68){WhatsappQueueEvents[_0x051f('0x3')](_0xcbc31c+':'+_0x3eebe9['id'],_0x3eebe9);WhatsappQueueEvents[_0x051f('0x3')](_0xcbc31c,_0x3eebe9);_0x1c7d68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x051f('0x4')]=WhatsappQueueEvents; \ No newline at end of file +var _0x77ad=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x11a880,_0x7486ae){var _0x2e4e68=function(_0x9d62e0){while(--_0x9d62e0){_0x11a880['push'](_0x11a880['shift']());}};_0x2e4e68(++_0x7486ae);}(_0x77ad,0xd0));var _0xd77a=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x77ad[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0xd77a('0x0'));var WhatsappQueue=require(_0xd77a('0x1'))['db'][_0xd77a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd77a('0x3')](0x0);var events={'afterCreate':_0xd77a('0x4'),'afterUpdate':_0xd77a('0x5'),'afterDestroy':_0xd77a('0x6')};function emitEvent(_0x57b212){return function(_0x4973ad,_0x3e3613,_0x52731c){WhatsappQueueEvents[_0xd77a('0x7')](_0x57b212+':'+_0x4973ad['id'],_0x4973ad);WhatsappQueueEvents[_0xd77a('0x7')](_0x57b212,_0x4973ad);_0x52731c(null);};}for(var e in events){if(events[_0xd77a('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xd77a('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f23df5f..98ec950 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 _0x300e=['../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x300e,0x16d));var _0xe300=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x300e[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xe300('0x0'));var util=require(_0xe300('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe300('0x2'));var BPromise=require(_0xe300('0x3'));var rp=require(_0xe300('0x4'));var fs=require('fs');var path=require(_0xe300('0x5'));var rimraf=require(_0xe300('0x6'));var config=require(_0xe300('0x7'));var attributes=require(_0xe300('0x8'));module[_0xe300('0x9')]=function(_0x1f231c,_0x2c6c86){return _0x1f231c['define'](_0xe300('0xa'),attributes,{'tableName':_0xe300('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3436=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x14a3a4,_0x301918){var _0x520315=function(_0x2f6762){while(--_0x2f6762){_0x14a3a4['push'](_0x14a3a4['shift']());}};_0x520315(++_0x301918);}(_0x3436,0x97));var _0x6343=function(_0x320c28,_0xb93600){_0x320c28=_0x320c28-0x0;var _0x3252=_0x3436[_0x320c28];return _0x3252;};'use strict';var _=require(_0x6343('0x0'));var util=require('util');var logger=require(_0x6343('0x1'))('api');var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rp=require(_0x6343('0x4'));var fs=require('fs');var path=require(_0x6343('0x5'));var rimraf=require(_0x6343('0x6'));var config=require(_0x6343('0x7'));var attributes=require(_0x6343('0x8'));module[_0x6343('0x9')]=function(_0x2f589b,_0x5f4401){return _0x2f589b[_0x6343('0xa')](_0x6343('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 9f0fb36..04b842d 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 _0x165e=['attributes','limit','include','map','model','debug','stringify','ShowWhatsappQueue','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where'];(function(_0x1b8c5d,_0x304d9c){var _0x58c702=function(_0x3bf7c1){while(--_0x3bf7c1){_0x1b8c5d['push'](_0x1b8c5d['shift']());}};_0x58c702(++_0x304d9c);}(_0x165e,0x199));var _0xe165=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x165e[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0xe165('0x0'));var util=require('util');var moment=require(_0xe165('0x1'));var BPromise=require(_0xe165('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe165('0x3'));var db=require(_0xe165('0x4'))['db'];var utils=require(_0xe165('0x5'));var logger=require('../../config/logger')(_0xe165('0x6'));var config=require(_0xe165('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe165('0x8')][_0xe165('0x9')]({'port':0x232a});config[_0xe165('0xa')]=_[_0xe165('0xb')](config[_0xe165('0xa')],{'host':_0xe165('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe165('0xd'))[_0xe165('0xe')](socket);function respondWithRpcPromise(_0x4e9fe5,_0x402605,_0x5e4d29){return new BPromise(function(_0x1e9674,_0x498d6b){return client[_0xe165('0xf')](_0x4e9fe5,_0x5e4d29)[_0xe165('0x10')](function(_0x4486d5){logger[_0xe165('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x402605,_0xe165('0x12'));logger['debug'](_0xe165('0x13'),_0x402605,_0xe165('0x12'),JSON['stringify'](_0x4486d5));if(_0x4486d5[_0xe165('0x14')]){if(_0x4486d5[_0xe165('0x14')][_0xe165('0x15')]===0x1f4){logger['error'](_0xe165('0x16'),_0x402605,_0x4486d5[_0xe165('0x14')][_0xe165('0x17')]);return _0x498d6b(_0x4486d5[_0xe165('0x14')]['message']);}logger[_0xe165('0x14')](_0xe165('0x16'),_0x402605,_0x4486d5['error'][_0xe165('0x17')]);return _0x1e9674(_0x4486d5['error'][_0xe165('0x17')]);}else{logger[_0xe165('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x402605,_0xe165('0x12'));_0x1e9674(_0x4486d5[_0xe165('0x18')][_0xe165('0x17')]);}})['catch'](function(_0x4d7ae5){logger[_0xe165('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x402605,_0x4d7ae5);_0x498d6b(_0x4d7ae5);});});}exports[_0xe165('0x19')]=function(_0x5a6b5a){var _0x4f47d1=this;return new Promise(function(_0x515eae,_0x507c32){return db[_0xe165('0x1a')][_0xe165('0x1b')]({'raw':_0x5a6b5a[_0xe165('0x1c')]?_0x5a6b5a['options'][_0xe165('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a6b5a['options']?_0x5a6b5a['options'][_0xe165('0x1e')]||null:null,'attributes':_0x5a6b5a[_0xe165('0x1c')]?_0x5a6b5a[_0xe165('0x1c')][_0xe165('0x1f')]||null:null,'limit':_0x5a6b5a[_0xe165('0x1c')]?_0x5a6b5a[_0xe165('0x1c')][_0xe165('0x20')]||null:null,'include':_0x5a6b5a['options']?_0x5a6b5a[_0xe165('0x1c')][_0xe165('0x21')]?_[_0xe165('0x22')](_0x5a6b5a['options'][_0xe165('0x21')],function(_0x6e08b7){return{'model':db[_0x6e08b7[_0xe165('0x23')]],'as':_0x6e08b7['as'],'attributes':_0x6e08b7[_0xe165('0x1f')],'include':_0x6e08b7[_0xe165('0x21')]?_[_0xe165('0x22')](_0x6e08b7[_0xe165('0x21')],function(_0x3604d5){return{'model':db[_0x3604d5[_0xe165('0x23')]],'as':_0x3604d5['as'],'attributes':_0x3604d5['attributes'],'include':_0x3604d5['include']?_[_0xe165('0x22')](_0x3604d5[_0xe165('0x21')],function(_0x472df0){return{'model':db[_0x472df0[_0xe165('0x23')]],'as':_0x472df0['as'],'attributes':_0x472df0[_0xe165('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe165('0x10')](function(_0x1431c6){logger[_0xe165('0x11')]('GetWhatsappQueue',_0x5a6b5a);logger[_0xe165('0x24')]('GetWhatsappQueue',_0x5a6b5a,JSON[_0xe165('0x25')](_0x1431c6));_0x515eae(_0x1431c6);})['catch'](function(_0x4f99fb){logger[_0xe165('0x14')]('GetWhatsappQueue',_0x4f99fb['message'],_0x5a6b5a);_0x507c32(_0x4f47d1[_0xe165('0x14')](0x1f4,_0x4f99fb[_0xe165('0x17')]));});});};exports[_0xe165('0x26')]=function(_0x3caf74){var _0x3774bd=this;return new Promise(function(_0x1b7d5d,_0x456478){return db[_0xe165('0x1a')]['find']({'raw':_0x3caf74['options']?_0x3caf74[_0xe165('0x1c')][_0xe165('0x1d')]===undefined?!![]:![]:!![],'where':_0x3caf74[_0xe165('0x1c')]?_0x3caf74[_0xe165('0x1c')]['where']||null:null,'attributes':_0x3caf74['options']?_0x3caf74[_0xe165('0x1c')][_0xe165('0x1f')]||null:null,'include':_0x3caf74[_0xe165('0x1c')]?_0x3caf74[_0xe165('0x1c')][_0xe165('0x21')]?_[_0xe165('0x22')](_0x3caf74[_0xe165('0x1c')][_0xe165('0x21')],function(_0x4032af){return{'model':db[_0x4032af[_0xe165('0x23')]],'as':_0x4032af['as'],'attributes':_0x4032af[_0xe165('0x1f')],'include':_0x4032af[_0xe165('0x21')]?_[_0xe165('0x22')](_0x4032af[_0xe165('0x21')],function(_0x4a0792){return{'model':db[_0x4a0792[_0xe165('0x23')]],'as':_0x4a0792['as'],'attributes':_0x4a0792[_0xe165('0x1f')],'include':_0x4a0792[_0xe165('0x21')]?_[_0xe165('0x22')](_0x4a0792[_0xe165('0x21')],function(_0x121418){return{'model':db[_0x121418[_0xe165('0x23')]],'as':_0x121418['as'],'attributes':_0x121418[_0xe165('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1408f7){logger[_0xe165('0x11')]('ShowWhatsappQueue',_0x3caf74);logger['debug'](_0xe165('0x26'),_0x3caf74,JSON[_0xe165('0x25')](_0x1408f7));_0x1b7d5d(_0x1408f7);})[_0xe165('0x27')](function(_0x528db4){logger[_0xe165('0x14')](_0xe165('0x26'),_0x528db4[_0xe165('0x17')],_0x3caf74);_0x456478(_0x3774bd['error'](0x1f4,_0x528db4[_0xe165('0x17')]));});});}; \ No newline at end of file +var _0x2c50=['options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueue'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x2c50,0x8a));var _0x02c5=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x2c50[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x02c5('0x0'));var util=require(_0x02c5('0x1'));var moment=require(_0x02c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x02c5('0x3'));var fs=require('fs');var Redis=require(_0x02c5('0x4'));var db=require(_0x02c5('0x5'))['db'];var utils=require(_0x02c5('0x6'));var logger=require(_0x02c5('0x7'))(_0x02c5('0x8'));var config=require(_0x02c5('0x9'));var jayson=require(_0x02c5('0xa'));var client=jayson[_0x02c5('0xb')]['http']({'port':0x232a});config[_0x02c5('0xc')]=_[_0x02c5('0xd')](config[_0x02c5('0xc')],{'host':_0x02c5('0xe'),'port':0x18eb});var socket=require(_0x02c5('0xf'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x02c5('0x10')](socket);function respondWithRpcPromise(_0x22c945,_0x3e8053,_0x26c67d){return new BPromise(function(_0x42094c,_0x3121c4){return client[_0x02c5('0x11')](_0x22c945,_0x26c67d)[_0x02c5('0x12')](function(_0x44ea4c){logger[_0x02c5('0x13')](_0x02c5('0x14'),_0x3e8053,_0x02c5('0x15'));logger[_0x02c5('0x16')](_0x02c5('0x17'),_0x3e8053,_0x02c5('0x15'),JSON[_0x02c5('0x18')](_0x44ea4c));if(_0x44ea4c[_0x02c5('0x19')]){if(_0x44ea4c[_0x02c5('0x19')][_0x02c5('0x1a')]===0x1f4){logger[_0x02c5('0x19')](_0x02c5('0x14'),_0x3e8053,_0x44ea4c[_0x02c5('0x19')][_0x02c5('0x1b')]);return _0x3121c4(_0x44ea4c[_0x02c5('0x19')]['message']);}logger[_0x02c5('0x19')](_0x02c5('0x14'),_0x3e8053,_0x44ea4c['error'][_0x02c5('0x1b')]);return _0x42094c(_0x44ea4c[_0x02c5('0x19')][_0x02c5('0x1b')]);}else{logger[_0x02c5('0x13')](_0x02c5('0x14'),_0x3e8053,_0x02c5('0x15'));_0x42094c(_0x44ea4c[_0x02c5('0x1c')]['message']);}})['catch'](function(_0x162708){logger[_0x02c5('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x3e8053,_0x162708);_0x3121c4(_0x162708);});});}exports['GetWhatsappQueue']=function(_0x5cb657){var _0x564906=this;return new Promise(function(_0x8b1ae0,_0x66768e){return db[_0x02c5('0x1d')]['findAll']({'raw':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657['options'][_0x02c5('0x1f')]===undefined?!![]:![]:!![],'where':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x20')]||null:null,'attributes':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x21')]||null:null,'limit':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x22')]||null:null,'include':_0x5cb657[_0x02c5('0x1e')]?_0x5cb657[_0x02c5('0x1e')][_0x02c5('0x23')]?_['map'](_0x5cb657[_0x02c5('0x1e')]['include'],function(_0x293ed0){return{'model':db[_0x293ed0['model']],'as':_0x293ed0['as'],'attributes':_0x293ed0['attributes'],'include':_0x293ed0['include']?_[_0x02c5('0x24')](_0x293ed0['include'],function(_0x3eb518){return{'model':db[_0x3eb518[_0x02c5('0x25')]],'as':_0x3eb518['as'],'attributes':_0x3eb518['attributes'],'include':_0x3eb518[_0x02c5('0x23')]?_['map'](_0x3eb518[_0x02c5('0x23')],function(_0x32781f){return{'model':db[_0x32781f[_0x02c5('0x25')]],'as':_0x32781f['as'],'attributes':_0x32781f[_0x02c5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x02c5('0x12')](function(_0x5d2ad0){logger[_0x02c5('0x13')](_0x02c5('0x26'),_0x5cb657);logger['debug']('GetWhatsappQueue',_0x5cb657,JSON['stringify'](_0x5d2ad0));_0x8b1ae0(_0x5d2ad0);})[_0x02c5('0x27')](function(_0x5614bb){logger[_0x02c5('0x19')](_0x02c5('0x26'),_0x5614bb[_0x02c5('0x1b')],_0x5cb657);_0x66768e(_0x564906['error'](0x1f4,_0x5614bb['message']));});});};exports[_0x02c5('0x28')]=function(_0x1b288d){var _0x346c0e=this;return new Promise(function(_0x427398,_0x1b7b50){return db['WhatsappQueue'][_0x02c5('0x29')]({'raw':_0x1b288d[_0x02c5('0x1e')]?_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b288d[_0x02c5('0x1e')]?_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x20')]||null:null,'attributes':_0x1b288d['options']?_0x1b288d['options']['attributes']||null:null,'include':_0x1b288d['options']?_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x23')]?_[_0x02c5('0x24')](_0x1b288d[_0x02c5('0x1e')][_0x02c5('0x23')],function(_0x2cd11c){return{'model':db[_0x2cd11c['model']],'as':_0x2cd11c['as'],'attributes':_0x2cd11c[_0x02c5('0x21')],'include':_0x2cd11c['include']?_['map'](_0x2cd11c['include'],function(_0x4aaa7e){return{'model':db[_0x4aaa7e[_0x02c5('0x25')]],'as':_0x4aaa7e['as'],'attributes':_0x4aaa7e[_0x02c5('0x21')],'include':_0x4aaa7e[_0x02c5('0x23')]?_[_0x02c5('0x24')](_0x4aaa7e[_0x02c5('0x23')],function(_0x4b7e6f){return{'model':db[_0x4b7e6f[_0x02c5('0x25')]],'as':_0x4b7e6f['as'],'attributes':_0x4b7e6f[_0x02c5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x02c5('0x12')](function(_0x2cd2d6){logger[_0x02c5('0x13')](_0x02c5('0x28'),_0x1b288d);logger[_0x02c5('0x16')]('ShowWhatsappQueue',_0x1b288d,JSON['stringify'](_0x2cd2d6));_0x427398(_0x2cd2d6);})[_0x02c5('0x27')](function(_0x58956d){logger[_0x02c5('0x19')](_0x02c5('0x28'),_0x58956d['message'],_0x1b288d);_0x1b7b50(_0x346c0e[_0x02c5('0x19')](0x1f4,_0x58956d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 45b3c5b..59672db 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 _0x0e97=['register','length','./whatsappQueue.events','save','remove','update','emit'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0e97,0x64));var _0x70e9=function(_0x34ea65,_0x5f1d4c){_0x34ea65=_0x34ea65-0x0;var _0xcc7845=_0x0e97[_0x34ea65];return _0xcc7845;};'use strict';var WhatsappQueueEvents=require(_0x70e9('0x0'));var events=[_0x70e9('0x1'),_0x70e9('0x2'),_0x70e9('0x3')];function createListener(_0x5129b3,_0x5ec2f0){return function(_0x1640ab){_0x5ec2f0[_0x70e9('0x4')](_0x5129b3,_0x1640ab);};}function removeListener(_0x2df2db,_0x403d09){return function(){WhatsappQueueEvents['removeListener'](_0x2df2db,_0x403d09);};}exports[_0x70e9('0x5')]=function(_0x748baf){for(var _0x488cf1=0x0,_0x13cd2b=events[_0x70e9('0x6')];_0x488cf1<_0x13cd2b;_0x488cf1++){var _0x3353af=events[_0x488cf1];var _0x1b6887=createListener('whatsappQueue:'+_0x3353af,_0x748baf);WhatsappQueueEvents['on'](_0x3353af,_0x1b6887);}}; \ No newline at end of file +var _0x1545=['length','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x2060f8,_0x155202){var _0x533d1c=function(_0x42f71b){while(--_0x42f71b){_0x2060f8['push'](_0x2060f8['shift']());}};_0x533d1c(++_0x155202);}(_0x1545,0x1b3));var _0x5154=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x1545[_0x166953];return _0x4a8baf;};'use strict';var WhatsappQueueEvents=require(_0x5154('0x0'));var events=[_0x5154('0x1'),_0x5154('0x2'),_0x5154('0x3')];function createListener(_0x2963bb,_0x4b7e9c){return function(_0x1f3362){_0x4b7e9c['emit'](_0x2963bb,_0x1f3362);};}function removeListener(_0x5f0757,_0x23c3c2){return function(){WhatsappQueueEvents[_0x5154('0x4')](_0x5f0757,_0x23c3c2);};}exports[_0x5154('0x5')]=function(_0x329b1e){for(var _0x2d17d8=0x0,_0x2498f9=events[_0x5154('0x6')];_0x2d17d8<_0x2498f9;_0x2d17d8++){var _0x273bd7=events[_0x2d17d8];var _0x13f56f=createListener('whatsappQueue:'+_0x273bd7,_0x329b1e);WhatsappQueueEvents['on'](_0x273bd7,_0x13f56f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5d2f817..d8f8ea0 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 _0x6eec=['../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x68361,_0x231f90){var _0xbb709a=function(_0x47e656){while(--_0x47e656){_0x68361['push'](_0x68361['shift']());}};_0xbb709a(++_0x231f90);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var path=require(_0xc6ee('0x2'));var timeout=require(_0xc6ee('0x3'));var express=require('express');var router=express[_0xc6ee('0x4')]();var auth=require(_0xc6ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6ee('0x6'));var controller=require(_0xc6ee('0x7'));router[_0xc6ee('0x8')]('/',auth[_0xc6ee('0x9')](),controller[_0xc6ee('0xa')]);router[_0xc6ee('0x8')](_0xc6ee('0xb'),auth[_0xc6ee('0x9')](),controller[_0xc6ee('0xc')]);router['get']('/:id',auth[_0xc6ee('0x9')](),controller[_0xc6ee('0xd')]);router['post']('/',auth[_0xc6ee('0x9')](),controller['create']);router[_0xc6ee('0xe')](_0xc6ee('0xf'),auth[_0xc6ee('0x9')](),controller[_0xc6ee('0x10')]);router['delete'](_0xc6ee('0xf'),auth[_0xc6ee('0x9')](),controller[_0xc6ee('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb145=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','put','update','delete'];(function(_0x292440,_0x1ca5d9){var _0x17db5f=function(_0x29fb04){while(--_0x29fb04){_0x292440['push'](_0x292440['shift']());}};_0x17db5f(++_0x1ca5d9);}(_0xb145,0xa3));var _0x5b14=function(_0x50e876,_0x29a6a5){_0x50e876=_0x50e876-0x0;var _0x4e9491=_0xb145[_0x50e876];return _0x4e9491;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var auth=require(_0x5b14('0x5'));var interaction=require(_0x5b14('0x6'));var config=require(_0x5b14('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x5b14('0x8')]('/',auth[_0x5b14('0x9')](),controller[_0x5b14('0xa')]);router[_0x5b14('0x8')]('/describe',auth[_0x5b14('0x9')](),controller[_0x5b14('0xb')]);router[_0x5b14('0x8')](_0x5b14('0xc'),auth[_0x5b14('0x9')](),controller['show']);router[_0x5b14('0xd')]('/',auth[_0x5b14('0x9')](),controller['create']);router[_0x5b14('0xe')](_0x5b14('0xc'),auth[_0x5b14('0x9')](),controller[_0x5b14('0xf')]);router[_0x5b14('0x10')]('/:id',auth[_0x5b14('0x9')](),controller['destroy']);module[_0x5b14('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 4247dd4..5c2a917 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 _0x6aa7=['DATE','sequelize','STRING'];(function(_0x430350,_0x3ec8d1){var _0x31f73e=function(_0x384ea2){while(--_0x384ea2){_0x430350['push'](_0x430350['shift']());}};_0x31f73e(++_0x3ec8d1);}(_0x6aa7,0x178));var _0x76aa=function(_0x1a1226,_0x594347){_0x1a1226=_0x1a1226-0x0;var _0xf2db27=_0x6aa7[_0x1a1226];return _0xf2db27;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x77694d,_0x12531a){var _0x2f0cba=function(_0x4df11a){while(--_0x4df11a){_0x77694d['push'](_0x77694d['shift']());}};_0x2f0cba(++_0x12531a);}(_0x34e8,0x12c));var _0x834e=function(_0x348391,_0x1ed6d1){_0x348391=_0x348391-0x0;var _0x960d59=_0x34e8[_0x348391];return _0x960d59;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 082cda0..33e0d8c 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 _0xafec=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x1de487,_0x2d1056){var _0x55c07e=function(_0x50abdf){while(--_0x50abdf){_0x1de487['push'](_0x1de487['shift']());}};_0x55c07e(++_0x2d1056);}(_0xafec,0x161));var _0xcafe=function(_0x3b2fbf,_0x477fc9){_0x3b2fbf=_0x3b2fbf-0x0;var _0x3236c0=_0xafec[_0x3b2fbf];return _0x3236c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcafe('0x0'));var rimraf=require(_0xcafe('0x1'));var zipdir=require(_0xcafe('0x2'));var jsonpatch=require(_0xcafe('0x3'));var rp=require('request-promise');var moment=require(_0xcafe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcafe('0x5'));var util=require(_0xcafe('0x6'));var path=require('path');var sox=require(_0xcafe('0x7'));var csv=require(_0xcafe('0x8'));var ejs=require(_0xcafe('0x9'));var fs=require('fs');var _=require(_0xcafe('0xa'));var squel=require(_0xcafe('0xb'));var crypto=require(_0xcafe('0xc'));var jsforce=require(_0xcafe('0xd'));var deskjs=require(_0xcafe('0xe'));var toCsv=require(_0xcafe('0x8'));var querystring=require(_0xcafe('0xf'));var Papa=require(_0xcafe('0x10'));var Redis=require(_0xcafe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcafe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcafe('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcafe('0x14'));var config=require(_0xcafe('0x15'));var db=require(_0xcafe('0x16'))['db'];function respondWithStatusCode(_0x5987c6,_0x36b734){_0x36b734=_0x36b734||0xcc;return function(_0x40780b){if(_0x40780b){return _0x5987c6[_0xcafe('0x17')](_0x36b734);}return _0x5987c6[_0xcafe('0x18')](_0x36b734)['end']();};}function respondWithResult(_0xde913f,_0x435bf8){_0x435bf8=_0x435bf8||0xc8;return function(_0x4ce537){if(_0x4ce537){return _0xde913f[_0xcafe('0x18')](_0x435bf8)[_0xcafe('0x19')](_0x4ce537);}};}function respondWithFilteredResult(_0x572321,_0x37016d){return function(_0x8dddd3){if(_0x8dddd3){var _0x20fbc1=_0x8dddd3[_0xcafe('0x1a')],_0x316cf8=_0x37016d['offset'],_0x2e26ef=_0x37016d[_0xcafe('0x1b')]+_0x37016d[_0xcafe('0x1c')],_0x1a4a47;if(_0x2e26ef>=_0x20fbc1){_0x2e26ef=_0x20fbc1;_0x1a4a47=0xc8;}else{_0x1a4a47=0xce;}_0x572321[_0xcafe('0x18')](_0x1a4a47);return _0x572321[_0xcafe('0x1d')](_0xcafe('0x1e'),_0x316cf8+'-'+_0x2e26ef+'/'+_0x20fbc1)[_0xcafe('0x19')](_0x8dddd3);}return null;};}function patchUpdates(_0x51616f){return function(_0x324132){try{jsonpatch[_0xcafe('0x1f')](_0x324132,_0x51616f,!![]);}catch(_0x1aadcc){return BPromise[_0xcafe('0x20')](_0x1aadcc);}return _0x324132[_0xcafe('0x21')]();};}function saveUpdates(_0x3f1563,_0xd8b76d){return function(_0xcddca6){if(_0xcddca6){return _0xcddca6['update'](_0x3f1563)[_0xcafe('0x22')](function(_0x3563b5){return _0x3563b5;});}return null;};}function removeEntity(_0x579e65,_0x409f16){return function(_0x14f11b){if(_0x14f11b){return _0x14f11b[_0xcafe('0x23')]()[_0xcafe('0x22')](function(){_0x579e65[_0xcafe('0x18')](0xcc)[_0xcafe('0x24')]();});}};}function handleEntityNotFound(_0x5f470f,_0x39aaf9){return function(_0x1cb09f){if(!_0x1cb09f){_0x5f470f[_0xcafe('0x17')](0x194);}return _0x1cb09f;};}function handleError(_0x926138,_0x5a49d9){_0x5a49d9=_0x5a49d9||0x1f4;return function(_0x13a57b){logger[_0xcafe('0x25')](_0x13a57b['stack']);if(_0x13a57b[_0xcafe('0x26')]){delete _0x13a57b[_0xcafe('0x26')];}_0x926138['status'](_0x5a49d9)[_0xcafe('0x27')](_0x13a57b);};}exports['index']=function(_0x2f5239,_0x3b7e6f){var _0x33b77d={},_0x4ef74f={},_0x3d31d1={'count':0x0,'rows':[]};var _0x997192=_[_0xcafe('0x28')](db[_0xcafe('0x29')][_0xcafe('0x2a')],function(_0x4053fb){return{'name':_0x4053fb[_0xcafe('0x2b')],'type':_0x4053fb[_0xcafe('0x2c')][_0xcafe('0x2d')]};});_0x4ef74f[_0xcafe('0x2e')]=_[_0xcafe('0x28')](_0x997192,_0xcafe('0x26'));_0x4ef74f[_0xcafe('0x2f')]=_['keys'](_0x2f5239[_0xcafe('0x2f')]);_0x4ef74f[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x4ef74f[_0xcafe('0x2e')],_0x4ef74f[_0xcafe('0x2f')]);_0x33b77d[_0xcafe('0x32')]=_['intersection'](_0x4ef74f['model'],qs[_0xcafe('0x33')](_0x2f5239['query'][_0xcafe('0x33')]));_0x33b77d[_0xcafe('0x32')]=_0x33b77d['attributes'][_0xcafe('0x34')]?_0x33b77d['attributes']:_0x4ef74f[_0xcafe('0x2e')];if(!_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x35')](_0xcafe('0x36'))){_0x33b77d['limit']=qs['limit'](_0x2f5239['query'][_0xcafe('0x1c')]);_0x33b77d[_0xcafe('0x1b')]=qs['offset'](_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x1b')]);}_0x33b77d[_0xcafe('0x37')]=qs[_0xcafe('0x38')](_0x2f5239[_0xcafe('0x2f')]['sort']);_0x33b77d[_0xcafe('0x39')]=qs['filters'](_[_0xcafe('0x3a')](_0x2f5239[_0xcafe('0x2f')],_0x4ef74f[_0xcafe('0x30')]),_0x997192);if(_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x3b')]){_0x33b77d[_0xcafe('0x39')]=_[_0xcafe('0x3c')](_0x33b77d['where'],{'$or':_[_0xcafe('0x28')](_0x997192,function(_0x2388c7){if(_0x2388c7[_0xcafe('0x2c')]!==_0xcafe('0x3d')){var _0x21eb47={};_0x21eb47[_0x2388c7['name']]={'$like':'%'+_0x2f5239[_0xcafe('0x2f')][_0xcafe('0x3b')]+'%'};return _0x21eb47;}})});}_0x33b77d=_[_0xcafe('0x3c')]({},_0x33b77d,_0x2f5239['options']);var _0x4b575c={'where':_0x33b77d[_0xcafe('0x39')]};return db[_0xcafe('0x29')]['count'](_0x4b575c)[_0xcafe('0x22')](function(_0x1a11e4){_0x3d31d1[_0xcafe('0x1a')]=_0x1a11e4;if(_0x2f5239['query'][_0xcafe('0x3e')]){_0x33b77d[_0xcafe('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xcafe('0x40')](_0x33b77d);})[_0xcafe('0x22')](function(_0x27e49e){_0x3d31d1['rows']=_0x27e49e;return _0x3d31d1;})[_0xcafe('0x22')](respondWithFilteredResult(_0x3b7e6f,_0x33b77d))[_0xcafe('0x41')](handleError(_0x3b7e6f,null));};exports[_0xcafe('0x42')]=function(_0xc957c8,_0x2ba297){var _0x285324={'raw':!![],'where':{'id':_0xc957c8[_0xcafe('0x43')]['id']}},_0x491d16={};_0x491d16[_0xcafe('0x2e')]=_['keys'](db[_0xcafe('0x29')][_0xcafe('0x2a')]);_0x491d16[_0xcafe('0x2f')]=_[_0xcafe('0x44')](_0xc957c8[_0xcafe('0x2f')]);_0x491d16[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x491d16[_0xcafe('0x2e')],_0x491d16['query']);_0x285324['attributes']=_[_0xcafe('0x31')](_0x491d16[_0xcafe('0x2e')],qs[_0xcafe('0x33')](_0xc957c8[_0xcafe('0x2f')][_0xcafe('0x33')]));_0x285324[_0xcafe('0x32')]=_0x285324['attributes']['length']?_0x285324[_0xcafe('0x32')]:_0x491d16[_0xcafe('0x2e')];if(_0xc957c8[_0xcafe('0x2f')][_0xcafe('0x3e')]){_0x285324[_0xcafe('0x3f')]=[{'all':!![]}];}_0x285324=_[_0xcafe('0x3c')]({},_0x285324,_0xc957c8[_0xcafe('0x45')]);return db[_0xcafe('0x29')][_0xcafe('0x46')](_0x285324)[_0xcafe('0x22')](handleEntityNotFound(_0x2ba297,null))['then'](respondWithResult(_0x2ba297,null))[_0xcafe('0x41')](handleError(_0x2ba297,null));};exports['create']=function(_0x12503c,_0x16cb0a){return db[_0xcafe('0x29')][_0xcafe('0x47')](_0x12503c[_0xcafe('0x48')],{})[_0xcafe('0x22')](respondWithResult(_0x16cb0a,0xc9))[_0xcafe('0x41')](handleError(_0x16cb0a,null));};exports[_0xcafe('0x49')]=function(_0x50fdc7,_0x2a02e2){if(_0x50fdc7[_0xcafe('0x48')]['id']){delete _0x50fdc7[_0xcafe('0x48')]['id'];}return db[_0xcafe('0x29')][_0xcafe('0x46')]({'where':{'id':_0x50fdc7['params']['id']}})[_0xcafe('0x22')](handleEntityNotFound(_0x2a02e2,null))[_0xcafe('0x22')](saveUpdates(_0x50fdc7[_0xcafe('0x48')],null))[_0xcafe('0x22')](respondWithResult(_0x2a02e2,null))[_0xcafe('0x41')](handleError(_0x2a02e2,null));};exports[_0xcafe('0x23')]=function(_0x47022c,_0x3fe32c){return db[_0xcafe('0x29')][_0xcafe('0x46')]({'where':{'id':_0x47022c[_0xcafe('0x43')]['id']}})[_0xcafe('0x22')](handleEntityNotFound(_0x3fe32c,null))[_0xcafe('0x22')](removeEntity(_0x3fe32c,null))[_0xcafe('0x41')](handleError(_0x3fe32c,null));};exports[_0xcafe('0x4a')]=function(_0x52a2b6,_0x1a5c39){return db[_0xcafe('0x29')]['describe']()['then'](respondWithResult(_0x1a5c39,null))[_0xcafe('0x41')](handleError(_0x1a5c39,null));}; \ No newline at end of file +var _0x6237=['then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','WhatsappQueueReport','include','findAll','rows','catch','show','params','keys','length','includeAll','create','update','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save'];(function(_0x30bdff,_0x308063){var _0x1e7ca9=function(_0x1a6e16){while(--_0x1a6e16){_0x30bdff['push'](_0x30bdff['shift']());}};_0x1e7ca9(++_0x308063);}(_0x6237,0xc4));var _0x7623=function(_0x363618,_0x5ebf3a){_0x363618=_0x363618-0x0;var _0x496dee=_0x6237[_0x363618];return _0x496dee;};'use strict';var pdf=require(_0x7623('0x0'));var emlformat=require(_0x7623('0x1'));var rimraf=require(_0x7623('0x2'));var zipdir=require(_0x7623('0x3'));var jsonpatch=require(_0x7623('0x4'));var rp=require(_0x7623('0x5'));var moment=require('moment');var BPromise=require(_0x7623('0x6'));var Mustache=require(_0x7623('0x7'));var util=require(_0x7623('0x8'));var path=require('path');var sox=require(_0x7623('0x9'));var csv=require(_0x7623('0xa'));var ejs=require(_0x7623('0xb'));var fs=require('fs');var _=require(_0x7623('0xc'));var squel=require('squel');var crypto=require(_0x7623('0xd'));var jsforce=require(_0x7623('0xe'));var deskjs=require(_0x7623('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7623('0x10'));var Papa=require(_0x7623('0x11'));var Redis=require(_0x7623('0x12'));var authService=require(_0x7623('0x13'));var qs=require(_0x7623('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7623('0x15'));var logger=require('../../config/logger')(_0x7623('0x16'));var utils=require(_0x7623('0x17'));var config=require(_0x7623('0x18'));var db=require(_0x7623('0x19'))['db'];function respondWithStatusCode(_0x1d82bb,_0xc4c6ee){_0xc4c6ee=_0xc4c6ee||0xcc;return function(_0x545b45){if(_0x545b45){return _0x1d82bb[_0x7623('0x1a')](_0xc4c6ee);}return _0x1d82bb[_0x7623('0x1b')](_0xc4c6ee)['end']();};}function respondWithResult(_0x58b10d,_0xc1a820){_0xc1a820=_0xc1a820||0xc8;return function(_0x4ef92a){if(_0x4ef92a){return _0x58b10d['status'](_0xc1a820)[_0x7623('0x1c')](_0x4ef92a);}};}function respondWithFilteredResult(_0x2693ad,_0x14520f){return function(_0x57d2a9){if(_0x57d2a9){var _0x542cd8=_0x57d2a9[_0x7623('0x1d')],_0x26e536=_0x14520f[_0x7623('0x1e')],_0x1f4214=_0x14520f[_0x7623('0x1e')]+_0x14520f['limit'],_0xf1972e;if(_0x1f4214>=_0x542cd8){_0x1f4214=_0x542cd8;_0xf1972e=0xc8;}else{_0xf1972e=0xce;}_0x2693ad['status'](_0xf1972e);return _0x2693ad[_0x7623('0x1f')](_0x7623('0x20'),_0x26e536+'-'+_0x1f4214+'/'+_0x542cd8)[_0x7623('0x1c')](_0x57d2a9);}return null;};}function patchUpdates(_0x2c9ffa){return function(_0xd288d4){try{jsonpatch['apply'](_0xd288d4,_0x2c9ffa,!![]);}catch(_0x966f9b){return BPromise[_0x7623('0x21')](_0x966f9b);}return _0xd288d4[_0x7623('0x22')]();};}function saveUpdates(_0x238593,_0x4fe221){return function(_0x2d9bce){if(_0x2d9bce){return _0x2d9bce['update'](_0x238593)[_0x7623('0x23')](function(_0x1070be){return _0x1070be;});}return null;};}function removeEntity(_0x33f68a,_0x2e306d){return function(_0x2cb2d8){if(_0x2cb2d8){return _0x2cb2d8[_0x7623('0x24')]()[_0x7623('0x23')](function(){_0x33f68a[_0x7623('0x1b')](0xcc)[_0x7623('0x25')]();});}};}function handleEntityNotFound(_0x3916cf,_0x3cac7c){return function(_0x34cdd2){if(!_0x34cdd2){_0x3916cf[_0x7623('0x1a')](0x194);}return _0x34cdd2;};}function handleError(_0x405440,_0x5a88d9){_0x5a88d9=_0x5a88d9||0x1f4;return function(_0x58ea19){logger[_0x7623('0x26')](_0x58ea19[_0x7623('0x27')]);if(_0x58ea19[_0x7623('0x28')]){delete _0x58ea19[_0x7623('0x28')];}_0x405440['status'](_0x5a88d9)[_0x7623('0x29')](_0x58ea19);};}exports['index']=function(_0x555a2a,_0x1c73ff){var _0x3d5b90={},_0x253f48={},_0x2505cc={'count':0x0,'rows':[]};var _0x237ac7=_[_0x7623('0x2a')](db['WhatsappQueueReport'][_0x7623('0x2b')],function(_0xf6b458){return{'name':_0xf6b458[_0x7623('0x2c')],'type':_0xf6b458[_0x7623('0x2d')][_0x7623('0x2e')]};});_0x253f48[_0x7623('0x2f')]=_[_0x7623('0x2a')](_0x237ac7,_0x7623('0x28'));_0x253f48[_0x7623('0x30')]=_['keys'](_0x555a2a[_0x7623('0x30')]);_0x253f48['filters']=_['intersection'](_0x253f48[_0x7623('0x2f')],_0x253f48[_0x7623('0x30')]);_0x3d5b90[_0x7623('0x31')]=_[_0x7623('0x32')](_0x253f48[_0x7623('0x2f')],qs[_0x7623('0x33')](_0x555a2a[_0x7623('0x30')]['fields']));_0x3d5b90[_0x7623('0x31')]=_0x3d5b90[_0x7623('0x31')]['length']?_0x3d5b90[_0x7623('0x31')]:_0x253f48['model'];if(!_0x555a2a[_0x7623('0x30')][_0x7623('0x34')](_0x7623('0x35'))){_0x3d5b90['limit']=qs[_0x7623('0x36')](_0x555a2a[_0x7623('0x30')][_0x7623('0x36')]);_0x3d5b90[_0x7623('0x1e')]=qs['offset'](_0x555a2a['query'][_0x7623('0x1e')]);}_0x3d5b90[_0x7623('0x37')]=qs[_0x7623('0x38')](_0x555a2a[_0x7623('0x30')]['sort']);_0x3d5b90[_0x7623('0x39')]=qs[_0x7623('0x3a')](_[_0x7623('0x3b')](_0x555a2a[_0x7623('0x30')],_0x253f48['filters']),_0x237ac7);if(_0x555a2a[_0x7623('0x30')]['filter']){_0x3d5b90['where']=_[_0x7623('0x3c')](_0x3d5b90[_0x7623('0x39')],{'$or':_[_0x7623('0x2a')](_0x237ac7,function(_0x52074c){if(_0x52074c['type']!=='VIRTUAL'){var _0x4b3747={};_0x4b3747[_0x52074c['name']]={'$like':'%'+_0x555a2a[_0x7623('0x30')][_0x7623('0x3d')]+'%'};return _0x4b3747;}})});}_0x3d5b90=_[_0x7623('0x3c')]({},_0x3d5b90,_0x555a2a[_0x7623('0x3e')]);var _0x623ce3={'where':_0x3d5b90['where']};return db[_0x7623('0x3f')][_0x7623('0x1d')](_0x623ce3)[_0x7623('0x23')](function(_0x3d88b7){_0x2505cc['count']=_0x3d88b7;if(_0x555a2a['query']['includeAll']){_0x3d5b90[_0x7623('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x7623('0x41')](_0x3d5b90);})['then'](function(_0x43a1bf){_0x2505cc[_0x7623('0x42')]=_0x43a1bf;return _0x2505cc;})[_0x7623('0x23')](respondWithFilteredResult(_0x1c73ff,_0x3d5b90))[_0x7623('0x43')](handleError(_0x1c73ff,null));};exports[_0x7623('0x44')]=function(_0x40f6f4,_0x85766a){var _0x2d42df={'raw':!![],'where':{'id':_0x40f6f4[_0x7623('0x45')]['id']}},_0x591822={};_0x591822[_0x7623('0x2f')]=_[_0x7623('0x46')](db['WhatsappQueueReport'][_0x7623('0x2b')]);_0x591822[_0x7623('0x30')]=_['keys'](_0x40f6f4['query']);_0x591822[_0x7623('0x3a')]=_[_0x7623('0x32')](_0x591822[_0x7623('0x2f')],_0x591822[_0x7623('0x30')]);_0x2d42df[_0x7623('0x31')]=_['intersection'](_0x591822[_0x7623('0x2f')],qs[_0x7623('0x33')](_0x40f6f4[_0x7623('0x30')][_0x7623('0x33')]));_0x2d42df[_0x7623('0x31')]=_0x2d42df[_0x7623('0x31')][_0x7623('0x47')]?_0x2d42df[_0x7623('0x31')]:_0x591822['model'];if(_0x40f6f4[_0x7623('0x30')][_0x7623('0x48')]){_0x2d42df[_0x7623('0x40')]=[{'all':!![]}];}_0x2d42df=_['merge']({},_0x2d42df,_0x40f6f4[_0x7623('0x3e')]);return db['WhatsappQueueReport']['find'](_0x2d42df)[_0x7623('0x23')](handleEntityNotFound(_0x85766a,null))[_0x7623('0x23')](respondWithResult(_0x85766a,null))[_0x7623('0x43')](handleError(_0x85766a,null));};exports['create']=function(_0x2a6e87,_0x25947e){return db[_0x7623('0x3f')][_0x7623('0x49')](_0x2a6e87['body'],{})[_0x7623('0x23')](respondWithResult(_0x25947e,0xc9))[_0x7623('0x43')](handleError(_0x25947e,null));};exports[_0x7623('0x4a')]=function(_0x537dbe,_0x4d718f){if(_0x537dbe[_0x7623('0x4b')]['id']){delete _0x537dbe[_0x7623('0x4b')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x537dbe[_0x7623('0x45')]['id']}})[_0x7623('0x23')](handleEntityNotFound(_0x4d718f,null))[_0x7623('0x23')](saveUpdates(_0x537dbe[_0x7623('0x4b')],null))[_0x7623('0x23')](respondWithResult(_0x4d718f,null))[_0x7623('0x43')](handleError(_0x4d718f,null));};exports['destroy']=function(_0x277319,_0x595654){return db[_0x7623('0x3f')][_0x7623('0x4c')]({'where':{'id':_0x277319[_0x7623('0x45')]['id']}})[_0x7623('0x23')](handleEntityNotFound(_0x595654,null))[_0x7623('0x23')](removeEntity(_0x595654,null))[_0x7623('0x43')](handleError(_0x595654,null));};exports['describe']=function(_0x3ed8f0,_0x10e34a){return db[_0x7623('0x3f')]['describe']()[_0x7623('0x23')](respondWithResult(_0x10e34a,null))[_0x7623('0x43')](handleError(_0x10e34a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e50fa6c..e785270 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 _0xfe89=['../../config/environment','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x29cb57,_0x58226c){var _0x5036f8=function(_0x352eef){while(--_0x352eef){_0x29cb57['push'](_0x29cb57['shift']());}};_0x5036f8(++_0x58226c);}(_0xfe89,0x19d));var _0x9fe8=function(_0x3d3dff,_0x5d4d62){_0x3d3dff=_0x3d3dff-0x0;var _0x350140=_0xfe89[_0x3d3dff];return _0x350140;};'use strict';var _=require(_0x9fe8('0x0'));var util=require(_0x9fe8('0x1'));var logger=require(_0x9fe8('0x2'))(_0x9fe8('0x3'));var moment=require(_0x9fe8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fe8('0x5'));var rimraf=require(_0x9fe8('0x6'));var config=require(_0x9fe8('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x9fe8('0x8')]=function(_0x1cbcfd,_0x40d964){return _0x1cbcfd[_0x9fe8('0x9')](_0x9fe8('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x9fe8('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e7b=['WhatsappQueueReport','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define'];(function(_0x5f3bf3,_0x20b162){var _0x6fc2bf=function(_0xae927){while(--_0xae927){_0x5f3bf3['push'](_0x5f3bf3['shift']());}};_0x6fc2bf(++_0x20b162);}(_0x7e7b,0x1d0));var _0xb7e7=function(_0x42223e,_0x5b0d77){_0x42223e=_0x42223e-0x0;var _0x1fa5fb=_0x7e7b[_0x42223e];return _0x1fa5fb;};'use strict';var _=require(_0xb7e7('0x0'));var util=require('util');var logger=require(_0xb7e7('0x1'))('api');var moment=require(_0xb7e7('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7e7('0x3'));var fs=require('fs');var path=require(_0xb7e7('0x4'));var rimraf=require(_0xb7e7('0x5'));var config=require(_0xb7e7('0x6'));var attributes=require(_0xb7e7('0x7'));module['exports']=function(_0xa101f9,_0x46f889){return _0xa101f9[_0xb7e7('0x8')](_0xb7e7('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xb7e7('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 891591a..956ef9b 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 _0xf92d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','where','attributes','limit','then','util','moment'];(function(_0x4db9e6,_0x4ad84b){var _0xc8814a=function(_0x43aba5){while(--_0x43aba5){_0x4db9e6['push'](_0x4db9e6['shift']());}};_0xc8814a(++_0x4ad84b);}(_0xf92d,0x196));var _0xdf92=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf92d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdf92('0x0'));var moment=require(_0xdf92('0x1'));var BPromise=require(_0xdf92('0x2'));var rs=require(_0xdf92('0x3'));var fs=require('fs');var Redis=require(_0xdf92('0x4'));var db=require(_0xdf92('0x5'))['db'];var utils=require(_0xdf92('0x6'));var logger=require(_0xdf92('0x7'))(_0xdf92('0x8'));var config=require(_0xdf92('0x9'));var jayson=require(_0xdf92('0xa'));var client=jayson['client'][_0xdf92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb88c35,_0x4d560f,_0x4b7ef2){return new BPromise(function(_0x5b0e61,_0x47d335){return client[_0xdf92('0xc')](_0xb88c35,_0x4b7ef2)['then'](function(_0x65e831){logger[_0xdf92('0xd')](_0xdf92('0xe'),_0x4d560f,'request\x20sent');logger[_0xdf92('0xf')](_0xdf92('0x10'),_0x4d560f,'request\x20sent',JSON['stringify'](_0x65e831));if(_0x65e831[_0xdf92('0x11')]){if(_0x65e831['error'][_0xdf92('0x12')]===0x1f4){logger[_0xdf92('0x11')](_0xdf92('0xe'),_0x4d560f,_0x65e831[_0xdf92('0x11')]['message']);return _0x47d335(_0x65e831[_0xdf92('0x11')][_0xdf92('0x13')]);}logger[_0xdf92('0x11')](_0xdf92('0xe'),_0x4d560f,_0x65e831[_0xdf92('0x11')][_0xdf92('0x13')]);return _0x5b0e61(_0x65e831[_0xdf92('0x11')]['message']);}else{logger['info'](_0xdf92('0xe'),_0x4d560f,_0xdf92('0x14'));_0x5b0e61(_0x65e831[_0xdf92('0x15')][_0xdf92('0x13')]);}})[_0xdf92('0x16')](function(_0x2a8be8){logger[_0xdf92('0x11')](_0xdf92('0xe'),_0x4d560f,_0x2a8be8);_0x47d335(_0x2a8be8);});});}exports[_0xdf92('0x17')]=function(_0x36ccd7){var _0x3bf22a=this;return new Promise(function(_0x415234,_0x2ea63e){return db[_0xdf92('0x18')]['create'](_0x36ccd7[_0xdf92('0x19')],{'raw':_0x36ccd7[_0xdf92('0x1a')]?_0x36ccd7['options'][_0xdf92('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x19884e){logger[_0xdf92('0xd')](_0xdf92('0x17'),_0x36ccd7);logger[_0xdf92('0xf')](_0xdf92('0x17'),_0x36ccd7,JSON[_0xdf92('0x1c')](_0x19884e));_0x415234(_0x19884e);})['catch'](function(_0xca92c7){logger[_0xdf92('0x11')]('CreateWhatsappQueueReport',_0xca92c7[_0xdf92('0x13')],_0x36ccd7);_0x2ea63e(_0x3bf22a[_0xdf92('0x11')](0x1f4,_0xca92c7[_0xdf92('0x13')]));});});};exports[_0xdf92('0x1d')]=function(_0x29257e){var _0x2f479d=this;return new Promise(function(_0x2d6575,_0x39127d){return db[_0xdf92('0x18')]['update'](_0x29257e[_0xdf92('0x19')],{'raw':_0x29257e['options']?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29257e['options']?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x1e')]||null:null,'attributes':_0x29257e[_0xdf92('0x1a')]?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x1f')]||null:null,'limit':_0x29257e['options']?_0x29257e[_0xdf92('0x1a')][_0xdf92('0x20')]||null:null})[_0xdf92('0x21')](function(_0x3f0b2a){logger[_0xdf92('0xd')](_0xdf92('0x1d'),_0x29257e);logger['debug'](_0xdf92('0x1d'),_0x29257e,JSON[_0xdf92('0x1c')](_0x3f0b2a));_0x2d6575(_0x3f0b2a);})[_0xdf92('0x16')](function(_0x507851){logger[_0xdf92('0x11')](_0xdf92('0x1d'),_0x507851[_0xdf92('0x13')],_0x29257e);_0x39127d(_0x2f479d[_0xdf92('0x11')](0x1f4,_0x507851[_0xdf92('0x13')]));});});}; \ No newline at end of file +var _0x8b47=['http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','create','body','options','CreateWhatsappQueueReport','catch','raw','where','attributes','limit','UpdateWhatsappQueueReport','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e30cf,_0x33f57){var _0x2357c9=function(_0x5c204d){while(--_0x5c204d){_0x3e30cf['push'](_0x3e30cf['shift']());}};_0x2357c9(++_0x33f57);}(_0x8b47,0x1d4));var _0x78b4=function(_0x23b876,_0x31804d){_0x23b876=_0x23b876-0x0;var _0x5230d5=_0x8b47[_0x23b876];return _0x5230d5;};'use strict';var _=require('lodash');var util=require(_0x78b4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78b4('0x1'));var db=require(_0x78b4('0x2'))['db'];var utils=require(_0x78b4('0x3'));var logger=require('../../config/logger')(_0x78b4('0x4'));var config=require(_0x78b4('0x5'));var jayson=require(_0x78b4('0x6'));var client=jayson[_0x78b4('0x7')][_0x78b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c44ba,_0x51ec41,_0x48f65f){return new BPromise(function(_0x185f2c,_0x34189b){return client['request'](_0x2c44ba,_0x48f65f)['then'](function(_0x1a8c39){logger[_0x78b4('0x9')](_0x78b4('0xa'),_0x51ec41,_0x78b4('0xb'));logger[_0x78b4('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x51ec41,_0x78b4('0xb'),JSON[_0x78b4('0xd')](_0x1a8c39));if(_0x1a8c39['error']){if(_0x1a8c39['error'][_0x78b4('0xe')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x51ec41,_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);return _0x34189b(_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);}logger[_0x78b4('0xf')](_0x78b4('0xa'),_0x51ec41,_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);return _0x185f2c(_0x1a8c39[_0x78b4('0xf')][_0x78b4('0x10')]);}else{logger[_0x78b4('0x9')](_0x78b4('0xa'),_0x51ec41,'request\x20sent');_0x185f2c(_0x1a8c39[_0x78b4('0x11')][_0x78b4('0x10')]);}})['catch'](function(_0x2fbe00){logger[_0x78b4('0xf')](_0x78b4('0xa'),_0x51ec41,_0x2fbe00);_0x34189b(_0x2fbe00);});});}exports['CreateWhatsappQueueReport']=function(_0x5b9f97){var _0x34cd5b=this;return new Promise(function(_0x233d63,_0x56bdd3){return db['WhatsappQueueReport'][_0x78b4('0x12')](_0x5b9f97[_0x78b4('0x13')],{'raw':_0x5b9f97[_0x78b4('0x14')]?_0x5b9f97[_0x78b4('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bf862){logger[_0x78b4('0x9')](_0x78b4('0x15'),_0x5b9f97);logger[_0x78b4('0xc')](_0x78b4('0x15'),_0x5b9f97,JSON[_0x78b4('0xd')](_0x3bf862));_0x233d63(_0x3bf862);})[_0x78b4('0x16')](function(_0x56f105){logger[_0x78b4('0xf')](_0x78b4('0x15'),_0x56f105['message'],_0x5b9f97);_0x56bdd3(_0x34cd5b[_0x78b4('0xf')](0x1f4,_0x56f105[_0x78b4('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x40b837){var _0x46f099=this;return new Promise(function(_0x3a30ba,_0xc13aaf){return db['WhatsappQueueReport']['update'](_0x40b837[_0x78b4('0x13')],{'raw':_0x40b837['options']?_0x40b837['options'][_0x78b4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40b837[_0x78b4('0x14')]?_0x40b837[_0x78b4('0x14')][_0x78b4('0x18')]||null:null,'attributes':_0x40b837[_0x78b4('0x14')]?_0x40b837[_0x78b4('0x14')][_0x78b4('0x19')]||null:null,'limit':_0x40b837[_0x78b4('0x14')]?_0x40b837[_0x78b4('0x14')][_0x78b4('0x1a')]||null:null})['then'](function(_0x15d3e6){logger[_0x78b4('0x9')](_0x78b4('0x1b'),_0x40b837);logger[_0x78b4('0xc')](_0x78b4('0x1b'),_0x40b837,JSON[_0x78b4('0xd')](_0x15d3e6));_0x3a30ba(_0x15d3e6);})[_0x78b4('0x16')](function(_0x11451d){logger[_0x78b4('0xf')](_0x78b4('0x1b'),_0x11451d[_0x78b4('0x10')],_0x40b837);_0xc13aaf(_0x46f099[_0x78b4('0xf')](0x1f4,_0x11451d[_0x78b4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3f4cf22..7a614b0 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 _0x6b52=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x235080,_0x2b35ce){var _0x4d1b05=function(_0x605fe8){while(--_0x605fe8){_0x235080['push'](_0x235080['shift']());}};_0x4d1b05(++_0x2b35ce);}(_0x6b52,0xdf));var _0x26b5=function(_0x4cda06,_0x3cb29c){_0x4cda06=_0x4cda06-0x0;var _0x48f3fa=_0x6b52[_0x4cda06];return _0x48f3fa;};'use strict';var multer=require(_0x26b5('0x0'));var util=require(_0x26b5('0x1'));var path=require(_0x26b5('0x2'));var timeout=require(_0x26b5('0x3'));var express=require(_0x26b5('0x4'));var router=express[_0x26b5('0x5')]();var auth=require(_0x26b5('0x6'));var interaction=require(_0x26b5('0x7'));var config=require(_0x26b5('0x8'));var controller=require(_0x26b5('0x9'));router['get']('/',auth[_0x26b5('0xa')](),controller[_0x26b5('0xb')]);router[_0x26b5('0xc')](_0x26b5('0xd'),auth['isAuthenticated'](),controller[_0x26b5('0xe')]);router[_0x26b5('0xc')](_0x26b5('0xf'),auth['isAuthenticated'](),controller[_0x26b5('0x10')]);router[_0x26b5('0x11')]('/',auth[_0x26b5('0xa')](),controller[_0x26b5('0x12')]);router[_0x26b5('0x13')](_0x26b5('0xf'),auth[_0x26b5('0xa')](),controller[_0x26b5('0x14')]);router[_0x26b5('0x15')](_0x26b5('0xf'),auth[_0x26b5('0xa')](),controller[_0x26b5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x297f=['create','update','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post'];(function(_0x41fed8,_0x168adf){var _0x5d6c66=function(_0x2d3fce){while(--_0x2d3fce){_0x41fed8['push'](_0x41fed8['shift']());}};_0x5d6c66(++_0x168adf);}(_0x297f,0x1f0));var _0xf297=function(_0x364f01,_0x440c65){_0x364f01=_0x364f01-0x0;var _0x4fbe6d=_0x297f[_0x364f01];return _0x4fbe6d;};'use strict';var multer=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf297('0x2'));var router=express[_0xf297('0x3')]();var auth=require(_0xf297('0x4'));var interaction=require(_0xf297('0x5'));var config=require('../../config/environment');var controller=require(_0xf297('0x6'));router['get']('/',auth[_0xf297('0x7')](),controller[_0xf297('0x8')]);router[_0xf297('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf297('0xa')]);router[_0xf297('0x9')](_0xf297('0xb'),auth['isAuthenticated'](),controller[_0xf297('0xc')]);router[_0xf297('0xd')]('/',auth['isAuthenticated'](),controller[_0xf297('0xe')]);router['put'](_0xf297('0xb'),auth[_0xf297('0x7')](),controller[_0xf297('0xf')]);router['delete'](_0xf297('0xb'),auth['isAuthenticated'](),controller[_0xf297('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 93a9898..fcbac5d 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 _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x0b0e[_0x2418e0];return _0x55ffbf;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x4dc854,_0x3c6947){var _0x4e3456=function(_0x5926ad){while(--_0x5926ad){_0x4dc854['push'](_0x4dc854['shift']());}};_0x4e3456(++_0x3c6947);}(_0x2032,0xd9));var _0x2203=function(_0x44439c,_0xed5061){_0x44439c=_0x44439c-0x0;var _0x1fc7d4=_0x2032[_0x44439c];return _0x1fc7d4;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 894389c..5a2b8ea 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 _0x38e2=['path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0xe36ac8,_0x1a4924){var _0x4b36f1=function(_0x1cec49){while(--_0x1cec49){_0xe36ac8['push'](_0xe36ac8['shift']());}};_0x4b36f1(++_0x1a4924);}(_0x38e2,0x8b));var _0x238e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x38e2[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x238e('0x0'));var emlformat=require(_0x238e('0x1'));var rimraf=require(_0x238e('0x2'));var zipdir=require(_0x238e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x238e('0x4'));var moment=require(_0x238e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x238e('0x6'));var util=require('util');var path=require(_0x238e('0x7'));var sox=require('sox');var csv=require(_0x238e('0x8'));var ejs=require(_0x238e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x238e('0xa'));var crypto=require(_0x238e('0xb'));var jsforce=require(_0x238e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x238e('0xd'));var Papa=require(_0x238e('0xe'));var Redis=require(_0x238e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x238e('0x10'));var as=require(_0x238e('0x11'));var hardwareService=require(_0x238e('0x12'));var logger=require(_0x238e('0x13'))(_0x238e('0x14'));var utils=require(_0x238e('0x15'));var config=require('../../config/environment');var db=require(_0x238e('0x16'))['db'];function respondWithStatusCode(_0x31524b,_0x411443){_0x411443=_0x411443||0xcc;return function(_0x5b6f18){if(_0x5b6f18){return _0x31524b[_0x238e('0x17')](_0x411443);}return _0x31524b[_0x238e('0x18')](_0x411443)[_0x238e('0x19')]();};}function respondWithResult(_0x571ff7,_0x2638b3){_0x2638b3=_0x2638b3||0xc8;return function(_0x2a2c67){if(_0x2a2c67){return _0x571ff7['status'](_0x2638b3)[_0x238e('0x1a')](_0x2a2c67);}};}function respondWithFilteredResult(_0x7b696c,_0x2f261a){return function(_0x11fd7d){if(_0x11fd7d){var _0x2858a1=_0x11fd7d[_0x238e('0x1b')],_0x11961d=_0x2f261a[_0x238e('0x1c')],_0x10666a=_0x2f261a[_0x238e('0x1c')]+_0x2f261a[_0x238e('0x1d')],_0x594a7c;if(_0x10666a>=_0x2858a1){_0x10666a=_0x2858a1;_0x594a7c=0xc8;}else{_0x594a7c=0xce;}_0x7b696c[_0x238e('0x18')](_0x594a7c);return _0x7b696c[_0x238e('0x1e')](_0x238e('0x1f'),_0x11961d+'-'+_0x10666a+'/'+_0x2858a1)[_0x238e('0x1a')](_0x11fd7d);}return null;};}function patchUpdates(_0x209d87){return function(_0x40cde4){try{jsonpatch[_0x238e('0x20')](_0x40cde4,_0x209d87,!![]);}catch(_0xaa3484){return BPromise[_0x238e('0x21')](_0xaa3484);}return _0x40cde4[_0x238e('0x22')]();};}function saveUpdates(_0x595241,_0xcc89d8){return function(_0x1a3f63){if(_0x1a3f63){return _0x1a3f63[_0x238e('0x23')](_0x595241)[_0x238e('0x24')](function(_0x213452){return _0x213452;});}return null;};}function removeEntity(_0x4ed2d6,_0x5f4ebf){return function(_0x30b0e1){if(_0x30b0e1){return _0x30b0e1[_0x238e('0x25')]()[_0x238e('0x24')](function(){_0x4ed2d6[_0x238e('0x18')](0xcc)[_0x238e('0x19')]();});}};}function handleEntityNotFound(_0x17dc4c,_0x4d5fdc){return function(_0x4807ed){if(!_0x4807ed){_0x17dc4c['sendStatus'](0x194);}return _0x4807ed;};}function handleError(_0x421c37,_0x1d72ee){_0x1d72ee=_0x1d72ee||0x1f4;return function(_0x22b283){logger[_0x238e('0x26')](_0x22b283['stack']);if(_0x22b283[_0x238e('0x27')]){delete _0x22b283[_0x238e('0x27')];}_0x421c37[_0x238e('0x18')](_0x1d72ee)['send'](_0x22b283);};}exports[_0x238e('0x28')]=function(_0x5a99c5,_0x5ef3e5){var _0x5efb14={},_0x4d8ea1={},_0x40dc70={'count':0x0,'rows':[]};var _0x153558=_[_0x238e('0x29')](db[_0x238e('0x2a')][_0x238e('0x2b')],function(_0x3a0040){return{'name':_0x3a0040[_0x238e('0x2c')],'type':_0x3a0040[_0x238e('0x2d')]['key']};});_0x4d8ea1[_0x238e('0x2e')]=_[_0x238e('0x29')](_0x153558,_0x238e('0x27'));_0x4d8ea1[_0x238e('0x2f')]=_[_0x238e('0x30')](_0x5a99c5[_0x238e('0x2f')]);_0x4d8ea1[_0x238e('0x31')]=_[_0x238e('0x32')](_0x4d8ea1['model'],_0x4d8ea1[_0x238e('0x2f')]);_0x5efb14['attributes']=_['intersection'](_0x4d8ea1[_0x238e('0x2e')],qs[_0x238e('0x33')](_0x5a99c5['query'][_0x238e('0x33')]));_0x5efb14[_0x238e('0x34')]=_0x5efb14[_0x238e('0x34')][_0x238e('0x35')]?_0x5efb14[_0x238e('0x34')]:_0x4d8ea1[_0x238e('0x2e')];if(!_0x5a99c5['query'][_0x238e('0x36')](_0x238e('0x37'))){_0x5efb14[_0x238e('0x1d')]=qs[_0x238e('0x1d')](_0x5a99c5[_0x238e('0x2f')][_0x238e('0x1d')]);_0x5efb14['offset']=qs[_0x238e('0x1c')](_0x5a99c5[_0x238e('0x2f')]['offset']);}_0x5efb14[_0x238e('0x38')]=qs[_0x238e('0x39')](_0x5a99c5[_0x238e('0x2f')]['sort']);_0x5efb14[_0x238e('0x3a')]=qs[_0x238e('0x31')](_[_0x238e('0x3b')](_0x5a99c5[_0x238e('0x2f')],_0x4d8ea1[_0x238e('0x31')]),_0x153558);if(_0x5a99c5['query'][_0x238e('0x3c')]){_0x5efb14['where']=_[_0x238e('0x3d')](_0x5efb14[_0x238e('0x3a')],{'$or':_['map'](_0x153558,function(_0x58cd33){if(_0x58cd33[_0x238e('0x2d')]!==_0x238e('0x3e')){var _0x2333e9={};_0x2333e9[_0x58cd33[_0x238e('0x27')]]={'$like':'%'+_0x5a99c5[_0x238e('0x2f')][_0x238e('0x3c')]+'%'};return _0x2333e9;}})});}_0x5efb14=_[_0x238e('0x3d')]({},_0x5efb14,_0x5a99c5['options']);var _0x40ecaa={'where':_0x5efb14['where']};return db['WhatsappTransferReport'][_0x238e('0x1b')](_0x40ecaa)[_0x238e('0x24')](function(_0x34c981){_0x40dc70[_0x238e('0x1b')]=_0x34c981;if(_0x5a99c5[_0x238e('0x2f')][_0x238e('0x3f')]){_0x5efb14[_0x238e('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x5efb14);})['then'](function(_0x319e82){_0x40dc70[_0x238e('0x41')]=_0x319e82;return _0x40dc70;})[_0x238e('0x24')](respondWithFilteredResult(_0x5ef3e5,_0x5efb14))['catch'](handleError(_0x5ef3e5,null));};exports['show']=function(_0x12090f,_0x41b1a5){var _0x320a61={'raw':!![],'where':{'id':_0x12090f[_0x238e('0x42')]['id']}},_0x10307a={};_0x10307a[_0x238e('0x2e')]=_[_0x238e('0x30')](db[_0x238e('0x2a')][_0x238e('0x2b')]);_0x10307a[_0x238e('0x2f')]=_[_0x238e('0x30')](_0x12090f['query']);_0x10307a[_0x238e('0x31')]=_['intersection'](_0x10307a[_0x238e('0x2e')],_0x10307a[_0x238e('0x2f')]);_0x320a61[_0x238e('0x34')]=_[_0x238e('0x32')](_0x10307a[_0x238e('0x2e')],qs[_0x238e('0x33')](_0x12090f[_0x238e('0x2f')][_0x238e('0x33')]));_0x320a61[_0x238e('0x34')]=_0x320a61['attributes']['length']?_0x320a61[_0x238e('0x34')]:_0x10307a[_0x238e('0x2e')];if(_0x12090f[_0x238e('0x2f')]['includeAll']){_0x320a61[_0x238e('0x40')]=[{'all':!![]}];}_0x320a61=_['merge']({},_0x320a61,_0x12090f[_0x238e('0x43')]);return db[_0x238e('0x2a')][_0x238e('0x44')](_0x320a61)['then'](handleEntityNotFound(_0x41b1a5,null))[_0x238e('0x24')](respondWithResult(_0x41b1a5,null))[_0x238e('0x45')](handleError(_0x41b1a5,null));};exports['create']=function(_0x52a665,_0x1ad352){return db['WhatsappTransferReport'][_0x238e('0x46')](_0x52a665['body'],{})[_0x238e('0x24')](respondWithResult(_0x1ad352,0xc9))[_0x238e('0x45')](handleError(_0x1ad352,null));};exports[_0x238e('0x23')]=function(_0x3977c6,_0x16d356){if(_0x3977c6[_0x238e('0x47')]['id']){delete _0x3977c6[_0x238e('0x47')]['id'];}return db[_0x238e('0x2a')][_0x238e('0x44')]({'where':{'id':_0x3977c6[_0x238e('0x42')]['id']}})[_0x238e('0x24')](handleEntityNotFound(_0x16d356,null))[_0x238e('0x24')](saveUpdates(_0x3977c6[_0x238e('0x47')],null))[_0x238e('0x24')](respondWithResult(_0x16d356,null))[_0x238e('0x45')](handleError(_0x16d356,null));};exports[_0x238e('0x25')]=function(_0x25c865,_0x2efc09){return db[_0x238e('0x2a')][_0x238e('0x44')]({'where':{'id':_0x25c865[_0x238e('0x42')]['id']}})[_0x238e('0x24')](handleEntityNotFound(_0x2efc09,null))[_0x238e('0x24')](removeEntity(_0x2efc09,null))[_0x238e('0x45')](handleError(_0x2efc09,null));};exports[_0x238e('0x48')]=function(_0x22dba3,_0x53ae8a){return db[_0x238e('0x2a')][_0x238e('0x48')]()['then'](respondWithResult(_0x53ae8a,null))[_0x238e('0x45')](handleError(_0x53ae8a,null));}; \ No newline at end of file +var _0xddd1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','then','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','squel','jsforce','desk.js'];(function(_0x45faea,_0x575f86){var _0x4e27c2=function(_0x5034e4){while(--_0x5034e4){_0x45faea['push'](_0x45faea['shift']());}};_0x4e27c2(++_0x575f86);}(_0xddd1,0x10e));var _0x1ddd=function(_0x52f692,_0x57fd3c){_0x52f692=_0x52f692-0x0;var _0x37ace5=_0xddd1[_0x52f692];return _0x37ace5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ddd('0x0'));var rimraf=require(_0x1ddd('0x1'));var zipdir=require(_0x1ddd('0x2'));var jsonpatch=require(_0x1ddd('0x3'));var rp=require('request-promise');var moment=require(_0x1ddd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ddd('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1ddd('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1ddd('0x7'));var crypto=require('crypto');var jsforce=require(_0x1ddd('0x8'));var deskjs=require(_0x1ddd('0x9'));var toCsv=require(_0x1ddd('0x6'));var querystring=require(_0x1ddd('0xa'));var Papa=require(_0x1ddd('0xb'));var Redis=require(_0x1ddd('0xc'));var authService=require(_0x1ddd('0xd'));var qs=require(_0x1ddd('0xe'));var as=require(_0x1ddd('0xf'));var hardwareService=require(_0x1ddd('0x10'));var logger=require(_0x1ddd('0x11'))(_0x1ddd('0x12'));var utils=require('../../config/utils');var config=require(_0x1ddd('0x13'));var db=require(_0x1ddd('0x14'))['db'];function respondWithStatusCode(_0x599f12,_0x4ac338){_0x4ac338=_0x4ac338||0xcc;return function(_0x31b232){if(_0x31b232){return _0x599f12['sendStatus'](_0x4ac338);}return _0x599f12['status'](_0x4ac338)[_0x1ddd('0x15')]();};}function respondWithResult(_0x3173ba,_0x28b40b){_0x28b40b=_0x28b40b||0xc8;return function(_0x72cc47){if(_0x72cc47){return _0x3173ba[_0x1ddd('0x16')](_0x28b40b)['json'](_0x72cc47);}};}function respondWithFilteredResult(_0x3d2782,_0x1cc8ef){return function(_0x110f71){if(_0x110f71){var _0x1e606d=_0x110f71['count'],_0x32301e=_0x1cc8ef[_0x1ddd('0x17')],_0x19db51=_0x1cc8ef[_0x1ddd('0x17')]+_0x1cc8ef[_0x1ddd('0x18')],_0x2c7b88;if(_0x19db51>=_0x1e606d){_0x19db51=_0x1e606d;_0x2c7b88=0xc8;}else{_0x2c7b88=0xce;}_0x3d2782[_0x1ddd('0x16')](_0x2c7b88);return _0x3d2782[_0x1ddd('0x19')](_0x1ddd('0x1a'),_0x32301e+'-'+_0x19db51+'/'+_0x1e606d)[_0x1ddd('0x1b')](_0x110f71);}return null;};}function patchUpdates(_0x2fc25c){return function(_0x476aec){try{jsonpatch[_0x1ddd('0x1c')](_0x476aec,_0x2fc25c,!![]);}catch(_0x1005e3){return BPromise[_0x1ddd('0x1d')](_0x1005e3);}return _0x476aec[_0x1ddd('0x1e')]();};}function saveUpdates(_0x517928,_0x21af2d){return function(_0x204201){if(_0x204201){return _0x204201[_0x1ddd('0x1f')](_0x517928)['then'](function(_0x181b3d){return _0x181b3d;});}return null;};}function removeEntity(_0x414140,_0x1ce3c0){return function(_0x54bff0){if(_0x54bff0){return _0x54bff0['destroy']()['then'](function(){_0x414140[_0x1ddd('0x16')](0xcc)[_0x1ddd('0x15')]();});}};}function handleEntityNotFound(_0x3c1e20,_0x24ced7){return function(_0x392856){if(!_0x392856){_0x3c1e20['sendStatus'](0x194);}return _0x392856;};}function handleError(_0x28eb54,_0x21bff7){_0x21bff7=_0x21bff7||0x1f4;return function(_0x14013b){logger['error'](_0x14013b['stack']);if(_0x14013b['name']){delete _0x14013b[_0x1ddd('0x20')];}_0x28eb54[_0x1ddd('0x16')](_0x21bff7)[_0x1ddd('0x21')](_0x14013b);};}exports[_0x1ddd('0x22')]=function(_0x1369f4,_0x2c9e54){var _0x4b4410={},_0x1b7290={},_0x536522={'count':0x0,'rows':[]};var _0x415709=_['map'](db[_0x1ddd('0x23')][_0x1ddd('0x24')],function(_0x42e4cd){return{'name':_0x42e4cd[_0x1ddd('0x25')],'type':_0x42e4cd['type'][_0x1ddd('0x26')]};});_0x1b7290[_0x1ddd('0x27')]=_[_0x1ddd('0x28')](_0x415709,_0x1ddd('0x20'));_0x1b7290['query']=_[_0x1ddd('0x29')](_0x1369f4[_0x1ddd('0x2a')]);_0x1b7290[_0x1ddd('0x2b')]=_[_0x1ddd('0x2c')](_0x1b7290['model'],_0x1b7290[_0x1ddd('0x2a')]);_0x4b4410['attributes']=_[_0x1ddd('0x2c')](_0x1b7290['model'],qs['fields'](_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x2d')]));_0x4b4410['attributes']=_0x4b4410['attributes'][_0x1ddd('0x2e')]?_0x4b4410[_0x1ddd('0x2f')]:_0x1b7290[_0x1ddd('0x27')];if(!_0x1369f4['query'][_0x1ddd('0x30')]('nolimit')){_0x4b4410[_0x1ddd('0x18')]=qs[_0x1ddd('0x18')](_0x1369f4['query'][_0x1ddd('0x18')]);_0x4b4410[_0x1ddd('0x17')]=qs['offset'](_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x17')]);}_0x4b4410[_0x1ddd('0x31')]=qs[_0x1ddd('0x32')](_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x32')]);_0x4b4410[_0x1ddd('0x33')]=qs[_0x1ddd('0x2b')](_[_0x1ddd('0x34')](_0x1369f4['query'],_0x1b7290[_0x1ddd('0x2b')]),_0x415709);if(_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x35')]){_0x4b4410['where']=_[_0x1ddd('0x36')](_0x4b4410[_0x1ddd('0x33')],{'$or':_[_0x1ddd('0x28')](_0x415709,function(_0x24fdf7){if(_0x24fdf7[_0x1ddd('0x37')]!==_0x1ddd('0x38')){var _0x26fdcb={};_0x26fdcb[_0x24fdf7[_0x1ddd('0x20')]]={'$like':'%'+_0x1369f4[_0x1ddd('0x2a')][_0x1ddd('0x35')]+'%'};return _0x26fdcb;}})});}_0x4b4410=_['merge']({},_0x4b4410,_0x1369f4['options']);var _0x2eedb2={'where':_0x4b4410[_0x1ddd('0x33')]};return db[_0x1ddd('0x23')][_0x1ddd('0x39')](_0x2eedb2)[_0x1ddd('0x3a')](function(_0x2ee56d){_0x536522[_0x1ddd('0x39')]=_0x2ee56d;if(_0x1369f4[_0x1ddd('0x2a')]['includeAll']){_0x4b4410['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x1ddd('0x3b')](_0x4b4410);})[_0x1ddd('0x3a')](function(_0x5b2843){_0x536522[_0x1ddd('0x3c')]=_0x5b2843;return _0x536522;})[_0x1ddd('0x3a')](respondWithFilteredResult(_0x2c9e54,_0x4b4410))[_0x1ddd('0x3d')](handleError(_0x2c9e54,null));};exports[_0x1ddd('0x3e')]=function(_0x567e01,_0x31b14a){var _0x3d21f3={'raw':!![],'where':{'id':_0x567e01[_0x1ddd('0x3f')]['id']}},_0xa55d7c={};_0xa55d7c[_0x1ddd('0x27')]=_[_0x1ddd('0x29')](db[_0x1ddd('0x23')][_0x1ddd('0x24')]);_0xa55d7c[_0x1ddd('0x2a')]=_[_0x1ddd('0x29')](_0x567e01[_0x1ddd('0x2a')]);_0xa55d7c[_0x1ddd('0x2b')]=_['intersection'](_0xa55d7c[_0x1ddd('0x27')],_0xa55d7c[_0x1ddd('0x2a')]);_0x3d21f3[_0x1ddd('0x2f')]=_[_0x1ddd('0x2c')](_0xa55d7c[_0x1ddd('0x27')],qs[_0x1ddd('0x2d')](_0x567e01[_0x1ddd('0x2a')][_0x1ddd('0x2d')]));_0x3d21f3[_0x1ddd('0x2f')]=_0x3d21f3[_0x1ddd('0x2f')][_0x1ddd('0x2e')]?_0x3d21f3[_0x1ddd('0x2f')]:_0xa55d7c['model'];if(_0x567e01[_0x1ddd('0x2a')][_0x1ddd('0x40')]){_0x3d21f3[_0x1ddd('0x41')]=[{'all':!![]}];}_0x3d21f3=_[_0x1ddd('0x36')]({},_0x3d21f3,_0x567e01['options']);return db['WhatsappTransferReport'][_0x1ddd('0x42')](_0x3d21f3)[_0x1ddd('0x3a')](handleEntityNotFound(_0x31b14a,null))['then'](respondWithResult(_0x31b14a,null))[_0x1ddd('0x3d')](handleError(_0x31b14a,null));};exports[_0x1ddd('0x43')]=function(_0x1b9e41,_0x174c55){return db[_0x1ddd('0x23')][_0x1ddd('0x43')](_0x1b9e41[_0x1ddd('0x44')],{})[_0x1ddd('0x3a')](respondWithResult(_0x174c55,0xc9))[_0x1ddd('0x3d')](handleError(_0x174c55,null));};exports[_0x1ddd('0x1f')]=function(_0x56cd74,_0x10141a){if(_0x56cd74[_0x1ddd('0x44')]['id']){delete _0x56cd74[_0x1ddd('0x44')]['id'];}return db[_0x1ddd('0x23')][_0x1ddd('0x42')]({'where':{'id':_0x56cd74[_0x1ddd('0x3f')]['id']}})[_0x1ddd('0x3a')](handleEntityNotFound(_0x10141a,null))[_0x1ddd('0x3a')](saveUpdates(_0x56cd74[_0x1ddd('0x44')],null))[_0x1ddd('0x3a')](respondWithResult(_0x10141a,null))[_0x1ddd('0x3d')](handleError(_0x10141a,null));};exports['destroy']=function(_0x59318a,_0x4ee8c5){return db[_0x1ddd('0x23')][_0x1ddd('0x42')]({'where':{'id':_0x59318a[_0x1ddd('0x3f')]['id']}})[_0x1ddd('0x3a')](handleEntityNotFound(_0x4ee8c5,null))[_0x1ddd('0x3a')](removeEntity(_0x4ee8c5,null))['catch'](handleError(_0x4ee8c5,null));};exports[_0x1ddd('0x45')]=function(_0x5afb59,_0x4bda01){return db[_0x1ddd('0x23')][_0x1ddd('0x45')]()['then'](respondWithResult(_0x4bda01,null))[_0x1ddd('0x3d')](handleError(_0x4bda01,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4b119d5..be528f9 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 _0x30cc=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x59a3c5,_0x29f03a){var _0x3c5cdf=function(_0x56d55b){while(--_0x56d55b){_0x59a3c5['push'](_0x59a3c5['shift']());}};_0x3c5cdf(++_0x29f03a);}(_0x30cc,0x1e3));var _0xc30c=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x30cc[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require('lodash');var util=require(_0xc30c('0x0'));var logger=require('../../config/logger')(_0xc30c('0x1'));var moment=require(_0xc30c('0x2'));var BPromise=require('bluebird');var rp=require(_0xc30c('0x3'));var fs=require('fs');var path=require(_0xc30c('0x4'));var rimraf=require(_0xc30c('0x5'));var config=require('../../config/environment');var attributes=require(_0xc30c('0x6'));module[_0xc30c('0x7')]=function(_0x1413b6,_0x18f0c9){return _0x1413b6[_0xc30c('0x8')](_0xc30c('0x9'),attributes,{'tableName':_0xc30c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc30c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1bc=['api','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x48ced2,_0x42d43c){var _0x185702=function(_0x11035f){while(--_0x11035f){_0x48ced2['push'](_0x48ced2['shift']());}};_0x185702(++_0x42d43c);}(_0xe1bc,0xbe));var _0xce1b=function(_0x45e629,_0x792656){_0x45e629=_0x45e629-0x0;var _0x43a2a7=_0xe1bc[_0x45e629];return _0x43a2a7;};'use strict';var _=require(_0xce1b('0x0'));var util=require(_0xce1b('0x1'));var logger=require('../../config/logger')(_0xce1b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xce1b('0x3'));var fs=require('fs');var path=require(_0xce1b('0x4'));var rimraf=require(_0xce1b('0x5'));var config=require(_0xce1b('0x6'));var attributes=require(_0xce1b('0x7'));module[_0xce1b('0x8')]=function(_0x2dfb7f,_0x2a238d){return _0x2dfb7f[_0xce1b('0x9')](_0xce1b('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xce1b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 23cf3e7..352e750 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(_0x74c5e9,_0x4c8709){var _0x5711f1=function(_0x32b82a){while(--_0x32b82a){_0x74c5e9['push'](_0x74c5e9['shift']());}};_0x5711f1(++_0x4c8709);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x1b9243,_0x5a388d){var _0x1f3b68=function(_0x1102d0){while(--_0x1102d0){_0x1b9243['push'](_0x1b9243['shift']());}};_0x1f3b68(++_0x5a388d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index acd3bd8..ed9122c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc28=['map','filter','online','name','Offline\x20apps:','status','join','None','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','then','listen','start','info','Online\x20apps:'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcc28,0xc2));var _0x8cc2=function(_0x34abb8,_0x3adab3){_0x34abb8=_0x34abb8-0x0;var _0x5b5344=_0xcc28[_0x34abb8];return _0x5b5344;};'use strict';var _=require(_0x8cc2('0x0'));var mysqldb=require(_0x8cc2('0x1'));var rpc=require(_0x8cc2('0x2'));var config=require(_0x8cc2('0x3'));var logger=require(_0x8cc2('0x4'))(_0x8cc2('0x5'));var pm2=require(_0x8cc2('0x6'));var pm2Config=require(_0x8cc2('0x7'));var schedule=require(_0x8cc2('0x8'));var chat=require(_0x8cc2('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x8cc2('0xa')]['sync']()[_0x8cc2('0xb')](function(){return rpc[_0x8cc2('0xc')]();})[_0x8cc2('0xb')](function(_0x2d1941){logger['info'](_0x2d1941);return chat[_0x8cc2('0xd')]();})[_0x8cc2('0xb')](function(){return schedule[_0x8cc2('0xd')]();})['then'](function(){return transcribe[_0x8cc2('0xd')]();})[_0x8cc2('0xb')](function(_0x441ae5){logger[_0x8cc2('0xe')](_0x441ae5);return pm2['start'](pm2Config);})[_0x8cc2('0xb')](function(_0x4cd172){logger[_0x8cc2('0xe')](_0x8cc2('0xf'),_[_0x8cc2('0x10')](_[_0x8cc2('0x11')](_0x4cd172,{'status':_0x8cc2('0x12')}),_0x8cc2('0x13'))['join']());logger[_0x8cc2('0xe')](_0x8cc2('0x14'),_['map'](_[_0x8cc2('0x11')](_0x4cd172,function(_0x224786){return _0x224786[_0x8cc2('0x15')]!==_0x8cc2('0x12');}),_0x8cc2('0x13'))[_0x8cc2('0x16')]()||_0x8cc2('0x17'));config[_0x8cc2('0x18')]&&require('./config/seedDB')[_0x8cc2('0x19')]();require(_0x8cc2('0x1a'))['default']();})[_0x8cc2('0x1b')](function(_0x255992){logger[_0x8cc2('0x1c')](_0x8cc2('0x1d'),_0x255992);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xf7bc=['listen','start','info','Online\x20apps:','map','filter','online','name','join','status','None','seedDB','default','./config/license','catch','exit','lodash','./mysqldb','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','sequelize','sync','then'];(function(_0x3e295d,_0x161bd7){var _0x5f17ae=function(_0xaf0437){while(--_0xaf0437){_0x3e295d['push'](_0x3e295d['shift']());}};_0x5f17ae(++_0x161bd7);}(_0xf7bc,0x78));var _0xcf7b=function(_0x5a11bb,_0x454dc5){_0x5a11bb=_0x5a11bb-0x0;var _0x137993=_0xf7bc[_0x5a11bb];return _0x137993;};'use strict';var _=require(_0xcf7b('0x0'));var mysqldb=require(_0xcf7b('0x1'));var rpc=require(_0xcf7b('0x2'));var config=require('./config/environment');var logger=require(_0xcf7b('0x3'))('app');var pm2=require(_0xcf7b('0x4'));var pm2Config=require(_0xcf7b('0x5'));var schedule=require('./config/schedule');var chat=require(_0xcf7b('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xcf7b('0x7')][_0xcf7b('0x8')]()[_0xcf7b('0x9')](function(){return rpc[_0xcf7b('0xa')]();})[_0xcf7b('0x9')](function(_0x5463a2){logger['info'](_0x5463a2);return chat[_0xcf7b('0xb')]();})['then'](function(){return schedule[_0xcf7b('0xb')]();})[_0xcf7b('0x9')](function(){return transcribe['start']();})[_0xcf7b('0x9')](function(_0xab6ee1){logger[_0xcf7b('0xc')](_0xab6ee1);return pm2[_0xcf7b('0xb')](pm2Config);})[_0xcf7b('0x9')](function(_0x10911f){logger[_0xcf7b('0xc')](_0xcf7b('0xd'),_[_0xcf7b('0xe')](_[_0xcf7b('0xf')](_0x10911f,{'status':_0xcf7b('0x10')}),_0xcf7b('0x11'))[_0xcf7b('0x12')]());logger[_0xcf7b('0xc')]('Offline\x20apps:',_[_0xcf7b('0xe')](_['filter'](_0x10911f,function(_0x1aee40){return _0x1aee40[_0xcf7b('0x13')]!=='online';}),_0xcf7b('0x11'))['join']()||_0xcf7b('0x14'));config[_0xcf7b('0x15')]&&require('./config/seedDB')[_0xcf7b('0x16')]();require(_0xcf7b('0x17'))[_0xcf7b('0x16')]();})[_0xcf7b('0x18')](function(_0x1ec992){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1ec992);process[_0xcf7b('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 609ee17..9a71f72 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 _0x240e=['now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','secrets','session','role','name','permissions','md5secret','voicePause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','then','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','Basic','User','pass','status','json','user','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','promisify','sign','verify','randomBytes','toString','hex','floor'];(function(_0x87485,_0x2c760b){var _0x30b0b9=function(_0xdfb934){while(--_0xdfb934){_0x87485['push'](_0x87485['shift']());}};_0x30b0b9(++_0x2c760b);}(_0x240e,0x1dd));var _0xe240=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x240e[_0x43d11d];return _0x38cd08;};'use strict';var db=require(_0xe240('0x0'))['db'];var config=require(_0xe240('0x1'));var hardwareConf=require(_0xe240('0x2'));var _=require('lodash');var jwt=require(_0xe240('0x3'));var expressJwt=require(_0xe240('0x4'));var compose=require(_0xe240('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0xe240('0x6'));var BPromise=require(_0xe240('0x7'));var validateJwt=expressJwt({'secret':config[_0xe240('0x8')][_0xe240('0x9')]});var userAttributes=['id',_0xe240('0xa'),'fullname',_0xe240('0xb'),'internal','email','userpic',_0xe240('0xc'),_0xe240('0xd'),_0xe240('0xe'),'chatPause','mailPause','faxPause',_0xe240('0xf'),'openchannelPause',_0xe240('0x10'),_0xe240('0x11'),_0xe240('0x12'),_0xe240('0x13'),_0xe240('0x14'),_0xe240('0x15'),_0xe240('0x16'),_0xe240('0x17'),_0xe240('0x18'),_0xe240('0x19'),_0xe240('0x1a'),_0xe240('0x1b'),_0xe240('0x1c'),_0xe240('0x1d'),_0xe240('0x1e'),_0xe240('0x1f'),'phoneBarRemoteControl',_0xe240('0x20'),_0xe240('0x21'),_0xe240('0x22'),_0xe240('0x23')];exports[_0xe240('0x24')]=function(){return this[_0xe240('0x25')](!![])[_0xe240('0x26')](function(_0x55c591,_0x5c919c,_0x24dd1f){if(_0x55c591['user']){_0x24dd1f();}else{return db[_0xe240('0x27')][_0xe240('0x28')]({'where':{'id':_0x55c591[_0xe240('0x29')]['id']},'attributes':['id',_0xe240('0x2a'),'disposition'],'raw':!![]})[_0xe240('0x2b')](function(_0x2a5cde){if(_0x2a5cde&&_0x2a5cde['closed']){return _0x5c919c['status'](_0x2a5cde[_0xe240('0x2c')]===_0xe240('0x2d')?0x195:0x193)['json']({'message':_0x2a5cde[_0xe240('0x2c')]===_0xe240('0x2d')?_0xe240('0x2e'):_0xe240('0x2f')});}else{_0x24dd1f();}})[_0xe240('0x30')](function(_0x42b39a){_0x24dd1f(_0x42b39a);});}});};exports[_0xe240('0x25')]=function isAuthenticated(_0x32951f){return compose()['use'](function(_0x8dba93,_0x26aca7,_0x3121e4){if(_0x8dba93[_0xe240('0x31')]['authorization']){if(_[_0xe240('0x32')](_0x8dba93[_0xe240('0x31')][_0xe240('0x33')],_0xe240('0x34'))){var _0x3445ed=basicAuth(_0x8dba93);db[_0xe240('0x35')]['find']({'where':{'name':_0x3445ed['name']}})[_0xe240('0x2b')](function(_0x1df8ae){if(!_0x1df8ae||!_0x1df8ae['authenticate'](_0x3445ed[_0xe240('0x36')])){return _0x26aca7[_0xe240('0x37')](0x191)[_0xe240('0x38')]({'message':'Wrong\x20credentials.'});}_0x8dba93[_0xe240('0x39')]={'id':_0x1df8ae['id']};_0x3121e4();})['catch'](function(_0x4e923b){_0x3121e4(_0x4e923b);});}else if(_['startsWith'](_0x8dba93[_0xe240('0x31')][_0xe240('0x33')],'Bearer')){validateJwt(_0x8dba93,_0x26aca7,_0x3121e4);}else{if(_0x32951f){_0x3121e4();}else{return _0x26aca7[_0xe240('0x37')](0x193)[_0xe240('0x38')]({'message':_0xe240('0x3a')});}}}else if(_0x8dba93['query'][_0xe240('0x3b')]){try{var _0x1e612b={'audience':hardwareConf[_0xe240('0x3c')](),'issuer':hardwareConf[_0xe240('0x3c')]()};verifyJwt(_0x8dba93[_0xe240('0x3d')][_0xe240('0x3b')],_0x1e612b)[_0xe240('0x2b')](function(_0x4d808d){return db[_0xe240('0x35')][_0xe240('0x3e')]({'where':{'id':_0x4d808d[_0xe240('0x3f')]}})[_0xe240('0x2b')](function(_0x373569){if(!_0x373569||!_[_0xe240('0x40')](_0x373569[_0xe240('0x41')],_0x4d808d[_0xe240('0x42')])){return _0x26aca7[_0xe240('0x37')](0x191)[_0xe240('0x38')]({'message':_0xe240('0x43')});}_0x8dba93[_0xe240('0x39')]={'id':_0x373569['id']};_0x3121e4();});})[_0xe240('0x30')](function(){return _0x26aca7['status'](0x191)[_0xe240('0x38')]({'message':_0xe240('0x44')});});}catch(_0x3cd0ac){_0x3121e4(_0x3cd0ac);}}else if(_0x32951f){_0x3121e4();}else{return _0x26aca7[_0xe240('0x37')](0x193)[_0xe240('0x38')]({'message':_0xe240('0x3a')});}})['use'](function(_0x2542c8,_0x43a239,_0x422b80){if(_0x2542c8[_0xe240('0x39')]){db[_0xe240('0x35')][_0xe240('0x3e')]({'where':{'id':_0x2542c8[_0xe240('0x39')]['id']},'attributes':userAttributes})[_0xe240('0x2b')](function(_0x166b91){if(!_0x166b91){return _0x43a239['status'](0x194)[_0xe240('0x38')]({'message':_0xe240('0x45')});}_0x2542c8[_0xe240('0x39')]=_0x166b91;_0x422b80();})[_0xe240('0x30')](function(_0x1eeedb){_0x422b80(_0x1eeedb);});}else if(_0x32951f){_0x422b80();}else{return _0x43a239[_0xe240('0x37')](0x194)[_0xe240('0x38')]({'message':_0xe240('0x46')});}});};exports[_0xe240('0x47')]=function canUpdate(){return compose()[_0xe240('0x26')](function(_0x2243e3,_0x55a181,_0x27bb5a){return require(_0xe240('0x48'))['getLicense']()[_0xe240('0x2b')](function(_0x14eb96){if(_0x14eb96[_0xe240('0x49')]){_0x27bb5a();}else{return _0x55a181[_0xe240('0x37')](0x193)[_0xe240('0x38')]({'message':_0xe240('0x4a')});}})['catch'](function(_0x1f9a29){_0x27bb5a(_0x1f9a29);});});};exports[_0xe240('0x4b')]=function(_0x1e26dc,_0x433b1d,_0x4ca12d){_0x1e26dc[_0xe240('0x4b')]=!![];return _0x4ca12d();};exports[_0xe240('0x4c')]=function signToken(_0x2db07a){return signJwt(_0x2db07a);};exports[_0xe240('0x4d')]=function(_0x3778da,_0x117934){if(!_0x3778da['user']){return _0x117934[_0xe240('0x37')](0x194)[_0xe240('0x38')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c380={'payload':{'id':_0x3778da[_0xe240('0x39')]['id'],'role':_0x3778da[_0xe240('0x39')][_0xe240('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x46c380)['then'](function(_0x55437f){_0x117934[_0xe240('0x4e')]('motion.token',_0x55437f);_0x117934[_0xe240('0x4f')](_0xe240('0x50'));})['catch'](function(_0x1741e8){return _0x117934[_0xe240('0x37')](0x1f4)[_0xe240('0x51')](_0x1741e8);});};exports['retrieveApiKey']=function(_0x1345b8){if(_['isNil'](_0x1345b8[_0xe240('0x41')])||_[_0xe240('0x52')](_0x1345b8['apiKeyIat'])){return null;}else{return createJwt(_0x1345b8);}};exports[_0xe240('0x53')]=function(_0xbcfe98){_0xbcfe98[_0xe240('0x41')]=generateNonce();_0xbcfe98[_0xe240('0x54')]=generateIssuedAt();return createJwt(_0xbcfe98);};exports[_0xe240('0x55')]=function(_0x55cd24,_0x211b25){var _0x464957=_0x55cd24[_0xe240('0x3d')][_0xe240('0x3b')];if(_0x464957){var _0x2127cf={'nonce':_0x211b25[_0xe240('0x41')],'iat':_0x211b25[_0xe240('0x54')],'audience':hardwareConf[_0xe240('0x3c')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x464957,_0x2127cf)[_0xe240('0x2b')](function(){return generateApiKey(_0x211b25);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x322561){var _0x368aee=BPromise[_0xe240('0x56')](jwt[_0xe240('0x57')],{'context':jwt});var _0x5c0de3=_0x322561['secret']||config[_0xe240('0x8')]['session'];return new BPromise(function(_0xa19422,_0x3bfead){_0x368aee(_0x322561['payload'],_0x5c0de3,_0x322561['options'])['then'](function(_0x13df1e){_0xa19422(_0x13df1e);})[_0xe240('0x30')](function(_0x431a5a){_0x3bfead(_0x431a5a);});});}function verifyJwt(_0x22dde6,_0x478c35,_0x5e67dc){var _0x4f94e0=BPromise[_0xe240('0x56')](jwt[_0xe240('0x58')],{'context':jwt});var _0x1f3426=_0x5e67dc||config[_0xe240('0x8')][_0xe240('0x9')];return new BPromise(function(_0x3ccc46,_0x4acf73){_0x4f94e0(_0x22dde6,_0x1f3426,_0x478c35)[_0xe240('0x2b')](function(_0x144d44){_0x3ccc46(_0x144d44);})['catch'](function(_0x5ccad7){_0x4acf73(_0x5ccad7);});});}function generateNonce(){return crypto[_0xe240('0x59')](0x10)[_0xe240('0x5a')](_0xe240('0x5b'));}function generateIssuedAt(){return Math[_0xe240('0x5c')](Date[_0xe240('0x5d')]()/0x3e8)[_0xe240('0x5a')]();}function createJwt(_0x516949){var _0x443d0b={'payload':{'iat':_0x516949[_0xe240('0x54')],'nonce':_0x516949[_0xe240('0x41')]},'options':{'algorithm':_0xe240('0x5e'),'subject':_0x516949['id'][_0xe240('0x5a')](),'issuer':hardwareConf[_0xe240('0x3c')](),'audience':hardwareConf[_0xe240('0x3c')]()}};return signJwt(_0x443d0b)['then'](function(_0x331a4f){return{'iat':_0x516949[_0xe240('0x54')],'nonce':_0x516949[_0xe240('0x41')],'token':_0x331a4f};});} \ No newline at end of file +var _0xc921=['pauseType','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','User','find','authenticate','pass','Bearer','query','apikey','getUuid','sub','isEqual','nonce','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','promisify','sign','secret','payload','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','openchannelPause'];(function(_0x3b1703,_0x38fb3a){var _0x58306b=function(_0x18455b){while(--_0x18455b){_0x3b1703['push'](_0x3b1703['shift']());}};_0x58306b(++_0x38fb3a);}(_0xc921,0xa9));var _0x1c92=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc921[_0x13d07a];return _0x5ee0ee;};'use strict';var db=require(_0x1c92('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x1c92('0x1'));var _=require(_0x1c92('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x1c92('0x3'));var compose=require(_0x1c92('0x4'));var basicAuth=require(_0x1c92('0x5'));var crypto=require(_0x1c92('0x6'));var BPromise=require(_0x1c92('0x7'));var validateJwt=expressJwt({'secret':config[_0x1c92('0x8')][_0x1c92('0x9')]});var userAttributes=['id',_0x1c92('0xa'),_0x1c92('0xb'),_0x1c92('0xc'),_0x1c92('0xd'),'email',_0x1c92('0xe'),_0x1c92('0xf'),_0x1c92('0x10'),_0x1c92('0x11'),_0x1c92('0x12'),_0x1c92('0x13'),'faxPause','smsPause',_0x1c92('0x14'),_0x1c92('0x15'),'showWebBar','lastLoginAt',_0x1c92('0x16'),_0x1c92('0x17'),_0x1c92('0x18'),_0x1c92('0x19'),'alias',_0x1c92('0x1a'),_0x1c92('0x1b'),_0x1c92('0x1c'),_0x1c92('0x1d'),_0x1c92('0x1e'),'phoneBarEnableSettings',_0x1c92('0x1f'),_0x1c92('0x20'),_0x1c92('0x21'),_0x1c92('0x22'),_0x1c92('0x23'),'interface',_0x1c92('0x24')];exports[_0x1c92('0x25')]=function(){return this['isAuthenticated'](!![])[_0x1c92('0x26')](function(_0x457d24,_0x1b0d1d,_0x2d0a4d){if(_0x457d24[_0x1c92('0x27')]){_0x2d0a4d();}else{return db[_0x1c92('0x28')][_0x1c92('0x29')]({'where':{'id':_0x457d24[_0x1c92('0x2a')]['id']},'attributes':['id',_0x1c92('0x2b'),_0x1c92('0x2c')],'raw':!![]})[_0x1c92('0x2d')](function(_0x636eec){if(_0x636eec&&_0x636eec[_0x1c92('0x2b')]){return _0x1b0d1d[_0x1c92('0x2e')](_0x636eec[_0x1c92('0x2c')]===_0x1c92('0x2f')?0x195:0x193)[_0x1c92('0x30')]({'message':_0x636eec['disposition']===_0x1c92('0x2f')?_0x1c92('0x31'):'Forbidden.'});}else{_0x2d0a4d();}})[_0x1c92('0x32')](function(_0x39e2b4){_0x2d0a4d(_0x39e2b4);});}});};exports['isAuthenticated']=function isAuthenticated(_0x32e16b){return compose()[_0x1c92('0x26')](function(_0x5d7598,_0xc47b72,_0x1adba9){if(_0x5d7598[_0x1c92('0x33')][_0x1c92('0x34')]){if(_[_0x1c92('0x35')](_0x5d7598[_0x1c92('0x33')][_0x1c92('0x34')],'Basic')){var _0x10dd41=basicAuth(_0x5d7598);db[_0x1c92('0x36')][_0x1c92('0x37')]({'where':{'name':_0x10dd41[_0x1c92('0xc')]}})[_0x1c92('0x2d')](function(_0x23cee7){if(!_0x23cee7||!_0x23cee7[_0x1c92('0x38')](_0x10dd41[_0x1c92('0x39')])){return _0xc47b72[_0x1c92('0x2e')](0x191)[_0x1c92('0x30')]({'message':'Wrong\x20credentials.'});}_0x5d7598[_0x1c92('0x27')]={'id':_0x23cee7['id']};_0x1adba9();})[_0x1c92('0x32')](function(_0x2968cd){_0x1adba9(_0x2968cd);});}else if(_['startsWith'](_0x5d7598['headers'][_0x1c92('0x34')],_0x1c92('0x3a'))){validateJwt(_0x5d7598,_0xc47b72,_0x1adba9);}else{if(_0x32e16b){_0x1adba9();}else{return _0xc47b72[_0x1c92('0x2e')](0x193)[_0x1c92('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d7598[_0x1c92('0x3b')][_0x1c92('0x3c')]){try{var _0x5391c4={'audience':hardwareConf[_0x1c92('0x3d')](),'issuer':hardwareConf[_0x1c92('0x3d')]()};verifyJwt(_0x5d7598[_0x1c92('0x3b')][_0x1c92('0x3c')],_0x5391c4)[_0x1c92('0x2d')](function(_0x53d2c5){return db[_0x1c92('0x36')]['find']({'where':{'id':_0x53d2c5[_0x1c92('0x3e')]}})[_0x1c92('0x2d')](function(_0x1d4a4d){if(!_0x1d4a4d||!_[_0x1c92('0x3f')](_0x1d4a4d['apiKeyNonce'],_0x53d2c5[_0x1c92('0x40')])){return _0xc47b72[_0x1c92('0x2e')](0x191)[_0x1c92('0x30')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x5d7598[_0x1c92('0x27')]={'id':_0x1d4a4d['id']};_0x1adba9();});})[_0x1c92('0x32')](function(){return _0xc47b72[_0x1c92('0x2e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1b53cb){_0x1adba9(_0x1b53cb);}}else if(_0x32e16b){_0x1adba9();}else{return _0xc47b72[_0x1c92('0x2e')](0x193)[_0x1c92('0x30')]({'message':_0x1c92('0x41')});}})[_0x1c92('0x26')](function(_0x24a0ff,_0x589fa5,_0x183aee){if(_0x24a0ff[_0x1c92('0x27')]){db['User'][_0x1c92('0x37')]({'where':{'id':_0x24a0ff[_0x1c92('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x44fe1f){if(!_0x44fe1f){return _0x589fa5[_0x1c92('0x2e')](0x194)[_0x1c92('0x30')]({'message':_0x1c92('0x42')});}_0x24a0ff[_0x1c92('0x27')]=_0x44fe1f;_0x183aee();})[_0x1c92('0x32')](function(_0x38dfdc){_0x183aee(_0x38dfdc);});}else if(_0x32e16b){_0x183aee();}else{return _0x589fa5[_0x1c92('0x2e')](0x194)[_0x1c92('0x30')]({'message':_0x1c92('0x43')});}});};exports[_0x1c92('0x44')]=function canUpdate(){return compose()[_0x1c92('0x26')](function(_0x5afbb2,_0x3315c7,_0x2b79f7){return require(_0x1c92('0x45'))[_0x1c92('0x46')]()[_0x1c92('0x2d')](function(_0x19907b){if(_0x19907b[_0x1c92('0x47')]){_0x2b79f7();}else{return _0x3315c7['status'](0x193)[_0x1c92('0x30')]({'message':_0x1c92('0x48')});}})['catch'](function(_0x33b6ae){_0x2b79f7(_0x33b6ae);});});};exports['isMiddleware']=function(_0x1af500,_0x494921,_0x48b273){_0x1af500[_0x1c92('0x49')]=!![];return _0x48b273();};exports[_0x1c92('0x4a')]=function signToken(_0x2e576d){return signJwt(_0x2e576d);};exports['setTokenCookie']=function(_0x340ed2,_0x39d653){if(!_0x340ed2[_0x1c92('0x27')]){return _0x39d653[_0x1c92('0x2e')](0x194)[_0x1c92('0x30')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1e9d0e={'payload':{'id':_0x340ed2['user']['id'],'role':_0x340ed2['user'][_0x1c92('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1e9d0e)[_0x1c92('0x2d')](function(_0x21c529){_0x39d653[_0x1c92('0x4b')](_0x1c92('0x4c'),_0x21c529);_0x39d653[_0x1c92('0x4d')](_0x1c92('0x4e'));})[_0x1c92('0x32')](function(_0x5593ef){return _0x39d653[_0x1c92('0x2e')](0x1f4)['send'](_0x5593ef);});};exports['retrieveApiKey']=function(_0x5ecd43){if(_[_0x1c92('0x4f')](_0x5ecd43['apiKeyNonce'])||_['isNil'](_0x5ecd43[_0x1c92('0x50')])){return null;}else{return createJwt(_0x5ecd43);}};exports[_0x1c92('0x51')]=function(_0x12ba22){_0x12ba22[_0x1c92('0x52')]=generateNonce();_0x12ba22[_0x1c92('0x50')]=generateIssuedAt();return createJwt(_0x12ba22);};exports[_0x1c92('0x53')]=function(_0x3bace4,_0x74032){var _0xf983d6=_0x3bace4['query']['apikey'];if(_0xf983d6){var _0x2f29c8={'nonce':_0x74032['apiKeyNonce'],'iat':_0x74032['apiKeyIat'],'audience':hardwareConf[_0x1c92('0x3d')](),'issuer':hardwareConf[_0x1c92('0x3d')]()};return verifyJwt(_0xf983d6,_0x2f29c8)[_0x1c92('0x2d')](function(){return generateApiKey(_0x74032);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x1debed){var _0x2c1786=BPromise[_0x1c92('0x54')](jwt[_0x1c92('0x55')],{'context':jwt});var _0x497e1f=_0x1debed[_0x1c92('0x56')]||config[_0x1c92('0x8')][_0x1c92('0x9')];return new BPromise(function(_0x40c21d,_0x43d44d){_0x2c1786(_0x1debed[_0x1c92('0x57')],_0x497e1f,_0x1debed[_0x1c92('0x58')])['then'](function(_0x21ed36){_0x40c21d(_0x21ed36);})[_0x1c92('0x32')](function(_0x476a0c){_0x43d44d(_0x476a0c);});});}function verifyJwt(_0x1fa1ea,_0x3af690,_0x3886a5){var _0x2d7501=BPromise[_0x1c92('0x54')](jwt[_0x1c92('0x59')],{'context':jwt});var _0x100a8a=_0x3886a5||config[_0x1c92('0x8')][_0x1c92('0x9')];return new BPromise(function(_0x5d3113,_0x82133a){_0x2d7501(_0x1fa1ea,_0x100a8a,_0x3af690)[_0x1c92('0x2d')](function(_0xe34eb0){_0x5d3113(_0xe34eb0);})['catch'](function(_0x55f56c){_0x82133a(_0x55f56c);});});}function generateNonce(){return crypto[_0x1c92('0x5a')](0x10)[_0x1c92('0x5b')]('hex');}function generateIssuedAt(){return Math[_0x1c92('0x5c')](Date[_0x1c92('0x5d')]()/0x3e8)[_0x1c92('0x5b')]();}function createJwt(_0x4f80fb){var _0x1aa9e2={'payload':{'iat':_0x4f80fb['apiKeyIat'],'nonce':_0x4f80fb['apiKeyNonce']},'options':{'algorithm':_0x1c92('0x5e'),'subject':_0x4f80fb['id']['toString'](),'issuer':hardwareConf[_0x1c92('0x3d')](),'audience':hardwareConf[_0x1c92('0x3d')]()}};return signJwt(_0x1aa9e2)[_0x1c92('0x2d')](function(_0x4d01d0){return{'iat':_0x4f80fb[_0x1c92('0x50')],'nonce':_0x4f80fb[_0x1c92('0x52')],'token':_0x4d01d0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 12b1488..ddabb6e 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(_0x1020a8,_0x1c3f0a){var _0xb37592=function(_0x2fda4f){while(--_0x2fda4f){_0x1020a8['push'](_0x1020a8['shift']());}};_0xb37592(++_0x1c3f0a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7e7[_0x1d24eb];return _0x1dc576;};'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 _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x234014,_0x1f8591){var _0x2a66ff=function(_0x1e3d3f){while(--_0x1e3d3f){_0x234014['push'](_0x234014['shift']());}};_0x2a66ff(++_0x1f8591);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xcb91[_0x4c6d6f];return _0x2d4478;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 370c10f..bc2a027 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 _0x55e0=['util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x55e0,0xdc));var _0x055e=function(_0x8314a6,_0x8833c9){_0x8314a6=_0x8314a6-0x0;var _0x46af07=_0x55e0[_0x8314a6];return _0x46af07;};'use strict';var util=require(_0x055e('0x0'));var path=require(_0x055e('0x1'));var _=require(_0x055e('0x2'));var csv=require(_0x055e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x055e('0x4'));var db=require(_0x055e('0x5'))['db'];var dbH=require(_0x055e('0x5'))[_0x055e('0x6')];var logger=require(_0x055e('0x7'))(_0x055e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x055e('0x9')][0x4];function analyticExtractedReport(_0x4a442e,_0x8e7824){var _0x3c4cf={'status':_0x4a442e};var _0x376618={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7824){_0x3c4cf[_0x055e('0xa')]=_0x8e7824;}return db[_0x055e('0xb')]['update'](_0x3c4cf,_0x376618);}function main(){var _0x40779c=0x1388;var _0xd67814;logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x055e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x055e('0x10')]})[_0x055e('0x11')](function(_0x72d424){if(_0x72d424){_0xd67814=_0x72d424;_0x40779c=_0xd67814[_0x055e('0x10')]||0x1388;}})[_0x055e('0x11')](function(){return dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x14'),QUERY),{'type':dbH[_0x055e('0x12')][_0x055e('0x15')][_0x055e('0x16')]});})[_0x055e('0x11')](function(_0x56af18){if(!_0x56af18[0x0][_0x055e('0x17')]){return analyticExtractedReport(_0x055e('0x18'));}var _0x111cdb=[];var _0x599533=0x0;var _0x3f2d0e=!![];if(_0x56af18&&_0x56af18[_0x055e('0x19')]){var _0xb4e6ca=_0x56af18[0x0][_0x055e('0x17')]%(_0x599533+_0x40779c);if(_0xd67814[_0x055e('0x1a')]){for(;_0x3f2d0e;_0x599533+=_0x40779c,_0xb4e6ca=_0x56af18[0x0]['num']%(_0x599533+_0x40779c)){if(_0xb4e6ca==0x0||_0xb4e6ca==_0x56af18[0x0][_0x055e('0x17')]){_0x3f2d0e=![];}_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x1c'),QUERY,_0x40779c,_0x599533),{'type':dbH[_0x055e('0x12')]['QueryTypes'][_0x055e('0x16')]}));}}else{_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](QUERY,{'type':dbH[_0x055e('0x12')][_0x055e('0x15')]['SELECT']}));}}var _0x31c355=path[_0x055e('0x1d')](PATH);var _0x211594=path['basename'](PATH,_0x055e('0x1e'));var _0x2da6b=_0xd67814[_0x055e('0x1a')]&&_0x111cdb[_0x055e('0x19')]>0x1;var _0x51df23=[];if(!fs[_0x055e('0x1f')](path['join'](_0x31c355,_0x211594))&&_0x2da6b){fs[_0x055e('0x20')](path[_0x055e('0x21')](_0x31c355,_0x211594));}return BPromise[_0x055e('0x22')](_0x111cdb,function(_0x1a76c6){_0x51df23[_0x055e('0x1b')](_0x1a76c6);})[_0x055e('0x11')](function(){for(var _0x58caf9=0x0;_0x58caf9<_0x51df23[_0x055e('0x19')];_0x58caf9+=0x1){var _0x1f90a9;var _0x2a82f8=_0x51df23[_0x58caf9];if(_0x2da6b){_0x1f90a9=path['join'](_0x31c355,_0x211594,util[_0x055e('0xd')](_0x055e('0x23'),_0x211594,_0x58caf9,_0x055e('0x24')));}else{_0x1f90a9=path[_0x055e('0x21')](_0x31c355,util['format'](_0x055e('0x25'),_0x211594,'csv'));}fs[_0x055e('0x26')](_0x1f90a9,csv(_0x2a82f8));}})[_0x055e('0x11')](function(){if(_0x2da6b){zipdir(path[_0x055e('0x21')](_0x31c355,_0x211594),{'saveTo':path[_0x055e('0x21')](_0x31c355,util[_0x055e('0xd')]('%s.%s',_0x211594,_0x055e('0x27')))},function(_0x453e5e,_0x293062){});rimraf(path[_0x055e('0x21')](_0x31c355,_0x211594),function(){});}})[_0x055e('0x11')](function(){logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x055e('0x29'),_0x2da6b?util[_0x055e('0xd')]('%s.%s',_0x211594,_0x2da6b?_0x055e('0x27'):_0x055e('0x24')):null);});})[_0x055e('0x2a')](function(_0x20717b){logger[_0x055e('0xc')](util[_0x055e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x055e('0x2b')](_0x20717b,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xa8a8=['SELECT','Empty','length','num','push','query','dirname','basename','.csv','split','existsSync','mkdirSync','join','each','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x40f109,_0x1fb273){var _0x2c8974=function(_0x2044bc){while(--_0x2044bc){_0x40f109['push'](_0x40f109['shift']());}};_0x2c8974(++_0x1fb273);}(_0xa8a8,0xec));var _0x8a8a=function(_0x18fc3d,_0x55d75d){_0x18fc3d=_0x18fc3d-0x0;var _0x198f9e=_0xa8a8[_0x18fc3d];return _0x198f9e;};'use strict';var util=require(_0x8a8a('0x0'));var path=require(_0x8a8a('0x1'));var _=require(_0x8a8a('0x2'));var csv=require(_0x8a8a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8a8a('0x4'));var rimraf=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];var dbH=require(_0x8a8a('0x6'))[_0x8a8a('0x7')];var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8a8a('0xa')][0x2]);var QUERY=process[_0x8a8a('0xa')][0x3];var PATH=process[_0x8a8a('0xa')][0x4];function analyticExtractedReport(_0x1d7121,_0x8e7aa0){var _0x4225b9={'status':_0x1d7121};var _0xecaa6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7aa0){_0x4225b9[_0x8a8a('0xb')]=_0x8e7aa0;}return db['AnalyticExtractedReport']['update'](_0x4225b9,_0xecaa6f);}function main(){var _0x3c01cd=0x1388;var _0x497b8a;logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a8a('0xe')));return db[_0x8a8a('0xf')][_0x8a8a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8a8a('0x11')]})[_0x8a8a('0x12')](function(_0x330796){if(_0x330796){_0x497b8a=_0x330796;_0x3c01cd=_0x497b8a[_0x8a8a('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8a8a('0x13')]['query'](util[_0x8a8a('0xd')](_0x8a8a('0x14'),QUERY),{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]});})[_0x8a8a('0x12')](function(_0x16d38d){if(!_0x16d38d[0x0]['num']){return analyticExtractedReport(_0x8a8a('0x17'));}var _0x568b83=[];var _0x1f36b6=0x0;var _0x3046ae=!![];if(_0x16d38d&&_0x16d38d[_0x8a8a('0x18')]){var _0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd);if(_0x497b8a['split']){for(;_0x3046ae;_0x1f36b6+=_0x3c01cd,_0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd)){if(_0x4291e9==0x0||_0x4291e9==_0x16d38d[0x0][_0x8a8a('0x19')]){_0x3046ae=![];}_0x568b83[_0x8a8a('0x1a')](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](util[_0x8a8a('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c01cd,_0x1f36b6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x568b83['push'](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](QUERY,{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]}));}}var _0x2f6af2=path[_0x8a8a('0x1c')](PATH);var _0xe0321c=path[_0x8a8a('0x1d')](PATH,_0x8a8a('0x1e'));var _0xb9db78=_0x497b8a[_0x8a8a('0x1f')]&&_0x568b83[_0x8a8a('0x18')]>0x1;var _0x625c1b=[];if(!fs[_0x8a8a('0x20')](path['join'](_0x2f6af2,_0xe0321c))&&_0xb9db78){fs[_0x8a8a('0x21')](path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c));}return BPromise[_0x8a8a('0x23')](_0x568b83,function(_0x7662e){_0x625c1b[_0x8a8a('0x1a')](_0x7662e);})[_0x8a8a('0x12')](function(){for(var _0x3aa46d=0x0;_0x3aa46d<_0x625c1b['length'];_0x3aa46d+=0x1){var _0x31d21a;var _0x38c1e0=_0x625c1b[_0x3aa46d];if(_0xb9db78){_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c,util['format']('%s%d.%s',_0xe0321c,_0x3aa46d,_0x8a8a('0x24')));}else{_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,util['format']('%s.%s',_0xe0321c,'csv'));}fs[_0x8a8a('0x25')](_0x31d21a,csv(_0x38c1e0));}})['then'](function(){if(_0xb9db78){zipdir(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),{'saveTo':path[_0x8a8a('0x22')](_0x2f6af2,util['format'](_0x8a8a('0x26'),_0xe0321c,_0x8a8a('0x27')))},function(_0x250852,_0x8df0cb){});rimraf(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),function(){});}})[_0x8a8a('0x12')](function(){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0xb9db78?util[_0x8a8a('0xd')](_0x8a8a('0x26'),_0xe0321c,_0xb9db78?'zip':_0x8a8a('0x24')):null);});})[_0x8a8a('0x28')](function(_0x481e92){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')](_0x8a8a('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x481e92,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8a8a('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 011e599..8a8e155 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x47d8b8,_0x11a38b){var _0xad183=function(_0x99dc70){while(--_0x99dc70){_0x47d8b8['push'](_0x47d8b8['shift']());}};_0xad183(++_0x11a38b);}(_0xb10b,0x12a));var _0xbb10=function(_0x31038b,_0x3ac1c9){_0x31038b=_0x31038b-0x0;var _0x1c9d3c=_0xb10b[_0x31038b];return _0x1c9d3c;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x5ad93d,_0x2ce502){var _0x53d505=function(_0xdb5119){while(--_0xdb5119){_0x5ad93d['push'](_0x5ad93d['shift']());}};_0x53d505(++_0x2ce502);}(_0xb10b,0x12a));var _0xbb10=function(_0x1427e2,_0x5a60ba){_0x1427e2=_0x1427e2-0x0;var _0x3b2772=_0xb10b[_0x1427e2];return _0x3b2772;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index eddbf22..285d7c5 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 _0x853e=['sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','push','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x853e,0x1ea));var _0xe853=function(_0x5988c3,_0x552fa9){_0x5988c3=_0x5988c3-0x0;var _0x429c0a=_0x853e[_0x5988c3];return _0x429c0a;};'use strict';var util=require('util');var path=require(_0xe853('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xe853('0x1'));var BPromise=require('bluebird');var zipdir=require(_0xe853('0x2'));var rimraf=require('rimraf');var db=require(_0xe853('0x3'))['db'];var dbH=require(_0xe853('0x3'))[_0xe853('0x4')];var logger=require(_0xe853('0x5'))(_0xe853('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe853('0x7')][0x3];var PATH=process[_0xe853('0x7')][0x4];function analyticExtractedReport(_0xab8d0d,_0x25e6e1){var _0xe3d468={'status':_0xab8d0d};var _0x36d502={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25e6e1){_0xe3d468[_0xe853('0x8')]=_0x25e6e1;}return db[_0xe853('0x9')][_0xe853('0xa')](_0xe3d468,_0x36d502);}function main(){var _0x15bfe2=0x1388;var _0x478b19;logger['info'](util['format'](_0xe853('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xe853('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe853('0xd'),_0xe853('0xe')]})['then'](function(_0x88883f){if(_0x88883f){_0x478b19=_0x88883f;_0x15bfe2=_0x478b19[_0xe853('0xe')]||0x1388;}})[_0xe853('0xf')](function(){return dbH[_0xe853('0x10')][_0xe853('0x11')](util[_0xe853('0x12')](_0xe853('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x156940){if(!_0x156940[0x0][_0xe853('0x14')]){return analyticExtractedReport(_0xe853('0x15'));}var _0x11e4a0=[];var _0x21c5f0=0x0;var _0x9309a5=!![];if(_0x478b19[_0xe853('0xd')]){if(_0x156940&&_0x156940[_0xe853('0x16')]){var _0x2a98fa=_0x156940[0x0][_0xe853('0x14')]%(_0x21c5f0+_0x15bfe2);for(;_0x9309a5;_0x21c5f0+=_0x15bfe2,_0x2a98fa=_0x156940[0x0][_0xe853('0x14')]%(_0x21c5f0+_0x15bfe2)){if(_0x2a98fa==0x0||_0x2a98fa==_0x156940[0x0][_0xe853('0x14')]){_0x9309a5=![];}_0x11e4a0[_0xe853('0x17')](dbH[_0xe853('0x10')][_0xe853('0x11')](util[_0xe853('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x15bfe2,_0x21c5f0),{'type':dbH[_0xe853('0x10')][_0xe853('0x18')][_0xe853('0x19')]}));}}}else{_0x11e4a0[_0xe853('0x17')](dbH[_0xe853('0x10')][_0xe853('0x11')](QUERY,{'type':dbH[_0xe853('0x10')][_0xe853('0x18')][_0xe853('0x19')]}));}var _0x16ca53=path[_0xe853('0x1a')](PATH);var _0x4d895e=path[_0xe853('0x1b')](PATH,_0xe853('0x1c'));var _0xfadfc6=_0x478b19[_0xe853('0xd')]&&_0x11e4a0[_0xe853('0x16')]>0x1;var _0xc875b2=[];if(!fs[_0xe853('0x1d')](path[_0xe853('0x1e')](_0x16ca53,_0x4d895e))&&_0xfadfc6){fs['mkdirSync'](path[_0xe853('0x1e')](_0x16ca53,_0x4d895e));}return BPromise[_0xe853('0x1f')](_0x11e4a0,function(_0x198895){_0xc875b2[_0xe853('0x17')](_0x198895);})[_0xe853('0xf')](function(){for(var _0x58454e=0x0;_0x58454e<_0xc875b2[_0xe853('0x16')];_0x58454e+=0x1){var _0x33e0b0;var _0x49d8ed=_0xc875b2[_0x58454e];if(_0xfadfc6){_0x33e0b0=path[_0xe853('0x1e')](_0x16ca53,_0x4d895e,util['format'](_0xe853('0x20'),_0x4d895e,_0x58454e,'xlsx'));}else{_0x33e0b0=path['join'](_0x16ca53,util[_0xe853('0x12')](_0xe853('0x21'),_0x4d895e,_0xe853('0x22')));}fs[_0xe853('0x23')](_0x33e0b0,json2xls(_0x49d8ed),_0xe853('0x24'));}})[_0xe853('0xf')](function(){if(_0xfadfc6){zipdir(path[_0xe853('0x1e')](_0x16ca53,_0x4d895e),{'saveTo':path[_0xe853('0x1e')](_0x16ca53,util[_0xe853('0x12')](_0xe853('0x21'),_0x4d895e,_0xe853('0x25')))},function(_0x5d4876,_0x139fa2){});rimraf(path[_0xe853('0x1e')](_0x16ca53,_0x4d895e),function(){});}})['then'](function(){logger[_0xe853('0x26')](util['format'](_0xe853('0x27'),EXTRACTED_REPORT_ID,_0xe853('0x28')));return analyticExtractedReport(_0xe853('0x29'),_0xfadfc6?util['format'](_0xe853('0x21'),_0x4d895e,_0xfadfc6?_0xe853('0x25'):_0xe853('0x22')):null);});})[_0xe853('0x2a')](function(_0x245fda){logger[_0xe853('0x26')](util[_0xe853('0x12')](_0xe853('0x2b'),EXTRACTED_REPORT_ID,_0xe853('0x28')),util[_0xe853('0x2c')](_0x245fda,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe853('0x2d'));});}main(); \ No newline at end of file +var _0xdaa3=['push','%s%d.%s','xlsx','binary','%s.%s','zip','info','catch','Failed','util','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','join','mkdirSync','each'];(function(_0x97ec0e,_0x10eb67){var _0x1fd9dd=function(_0x187652){while(--_0x187652){_0x97ec0e['push'](_0x97ec0e['shift']());}};_0x1fd9dd(++_0x10eb67);}(_0xdaa3,0xe0));var _0x3daa=function(_0x347f7a,_0x38663e){_0x347f7a=_0x347f7a-0x0;var _0x1d772d=_0xdaa3[_0x347f7a];return _0x1d772d;};'use strict';var util=require(_0x3daa('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x3daa('0x1'));var BPromise=require(_0x3daa('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x3daa('0x3'));var db=require(_0x3daa('0x4'))['db'];var dbH=require(_0x3daa('0x4'))[_0x3daa('0x5')];var logger=require(_0x3daa('0x6'))(_0x3daa('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3daa('0x8')][0x2]);var QUERY=process[_0x3daa('0x8')][0x3];var PATH=process[_0x3daa('0x8')][0x4];function analyticExtractedReport(_0x15540a,_0x55a694){var _0x2b3ec4={'status':_0x15540a};var _0x56eb36={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x55a694){_0x2b3ec4[_0x3daa('0x9')]=_0x55a694;}return db[_0x3daa('0xa')][_0x3daa('0xb')](_0x2b3ec4,_0x56eb36);}function main(){var _0x4e1717=0x1388;var _0x1acb76;logger['info'](util[_0x3daa('0xc')](_0x3daa('0xd'),EXTRACTED_REPORT_ID,_0x3daa('0xe')));return db[_0x3daa('0xf')][_0x3daa('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3daa('0x11'),_0x3daa('0x12')]})['then'](function(_0x151c9b){if(_0x151c9b){_0x1acb76=_0x151c9b;_0x4e1717=_0x1acb76[_0x3daa('0x12')]||0x1388;}})[_0x3daa('0x13')](function(){return dbH[_0x3daa('0x14')][_0x3daa('0x15')](util['format'](_0x3daa('0x16'),QUERY),{'type':dbH[_0x3daa('0x14')]['QueryTypes']['SELECT']});})['then'](function(_0x3f25c1){if(!_0x3f25c1[0x0][_0x3daa('0x17')]){return analyticExtractedReport(_0x3daa('0x18'));}var _0x35afa7=[];var _0x4121e=0x0;var _0x3429ab=!![];if(_0x1acb76[_0x3daa('0x11')]){if(_0x3f25c1&&_0x3f25c1[_0x3daa('0x19')]){var _0x12974d=_0x3f25c1[0x0]['num']%(_0x4121e+_0x4e1717);for(;_0x3429ab;_0x4121e+=_0x4e1717,_0x12974d=_0x3f25c1[0x0][_0x3daa('0x17')]%(_0x4121e+_0x4e1717)){if(_0x12974d==0x0||_0x12974d==_0x3f25c1[0x0][_0x3daa('0x17')]){_0x3429ab=![];}_0x35afa7['push'](dbH[_0x3daa('0x14')][_0x3daa('0x15')](util['format'](_0x3daa('0x1a'),QUERY,_0x4e1717,_0x4121e),{'type':dbH[_0x3daa('0x14')][_0x3daa('0x1b')][_0x3daa('0x1c')]}));}}}else{_0x35afa7['push'](dbH[_0x3daa('0x14')][_0x3daa('0x15')](QUERY,{'type':dbH[_0x3daa('0x14')][_0x3daa('0x1b')][_0x3daa('0x1c')]}));}var _0x3a641b=path[_0x3daa('0x1d')](PATH);var _0x372073=path[_0x3daa('0x1e')](PATH,'.xlsx');var _0x5b9621=_0x1acb76[_0x3daa('0x11')]&&_0x35afa7[_0x3daa('0x19')]>0x1;var _0x5c44f2=[];if(!fs['existsSync'](path[_0x3daa('0x1f')](_0x3a641b,_0x372073))&&_0x5b9621){fs[_0x3daa('0x20')](path[_0x3daa('0x1f')](_0x3a641b,_0x372073));}return BPromise[_0x3daa('0x21')](_0x35afa7,function(_0x19f1cc){_0x5c44f2[_0x3daa('0x22')](_0x19f1cc);})['then'](function(){for(var _0x2f9dd5=0x0;_0x2f9dd5<_0x5c44f2['length'];_0x2f9dd5+=0x1){var _0x5aee17;var _0x39e3e2=_0x5c44f2[_0x2f9dd5];if(_0x5b9621){_0x5aee17=path[_0x3daa('0x1f')](_0x3a641b,_0x372073,util['format'](_0x3daa('0x23'),_0x372073,_0x2f9dd5,_0x3daa('0x24')));}else{_0x5aee17=path[_0x3daa('0x1f')](_0x3a641b,util[_0x3daa('0xc')]('%s.%s',_0x372073,'xlsx'));}fs['writeFileSync'](_0x5aee17,json2xls(_0x39e3e2),_0x3daa('0x25'));}})[_0x3daa('0x13')](function(){if(_0x5b9621){zipdir(path['join'](_0x3a641b,_0x372073),{'saveTo':path[_0x3daa('0x1f')](_0x3a641b,util[_0x3daa('0xc')](_0x3daa('0x26'),_0x372073,_0x3daa('0x27')))},function(_0x823e05,_0x508d15){});rimraf(path['join'](_0x3a641b,_0x372073),function(){});}})[_0x3daa('0x13')](function(){logger[_0x3daa('0x28')](util[_0x3daa('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x5b9621?util['format']('%s.%s',_0x372073,_0x5b9621?'zip':_0x3daa('0x24')):null);});})[_0x3daa('0x29')](function(_0x46a42f){logger[_0x3daa('0x28')](util[_0x3daa('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3daa('0xe')),util['inspect'](_0x46a42f,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3daa('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3c3e48a..f810f75 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 _0x8cfd=['VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','extensions','extension','find','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','IntervalId','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','then','intervals'];(function(_0x5b8a43,_0x451c94){var _0x4f899f=function(_0x5273be){while(--_0x5273be){_0x5b8a43['push'](_0x5b8a43['shift']());}};_0x4f899f(++_0x451c94);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8cfd[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));function rewrite(_0x370288,_0x1935a9){var _0x6ea39=this;return _0x370288[_0xd8cf('0x2')]['Interval'][_0xd8cf('0x3')]({'raw':!![]})[_0xd8cf('0x4')](function(_0x35b295){_0x6ea39[_0xd8cf('0x5')]=_0x35b295;return _0x370288[_0xd8cf('0x2')][_0xd8cf('0x6')][_0xd8cf('0x3')]({'where':{'IntervalId':_0x1935a9['IntervalId']},'raw':!![]});})['then'](function(_0x3fe2d2){return _0x370288[_0xd8cf('0x2')][_0xd8cf('0x6')][_0xd8cf('0x3')]({'where':{'exten':{'$in':_[_0xd8cf('0x7')](_[_0xd8cf('0x8')](_0x3fe2d2,'exten'))}},'order':[{'raw':_0xd8cf('0x9')}],'raw':!![]});})[_0xd8cf('0x4')](function(_0x34aeff){var _0x895caf=_[_0xd8cf('0xa')](_0x34aeff,{'priority':'1'});var _0xb8081=_[_0xd8cf('0xa')](_0x34aeff,{'isApp':0x1});var _0x2c267a=_[_0xd8cf('0xb')](_0xb8081,_0xd8cf('0xc'));var _0x2df373=[_0xd8cf('0xd'),'playback'];var _0x8e55f2=[];var _0x507c1d=[];for(var _0x293985 in _0x2c267a){if(_0x2c267a[_0xd8cf('0xe')](_0x293985)){_0x6ea39['priority']=0x2;_0x6ea39[_0xd8cf('0xf')]=[];_0x6ea39[_0xd8cf('0x10')]=_[_0xd8cf('0x11')](_0x895caf,{'exten':_0x2c267a[_0x293985][0x0]['exten']});_0x6ea39[_0xd8cf('0xf')]['push']({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':util[_0xd8cf('0x14')](_0xd8cf('0x15'),_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')]),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});if(_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')]===_0xd8cf('0x19')){if(_0x6ea39[_0xd8cf('0x10')]){_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x1b')+(_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x1c')]?_0xd8cf('0x1d')+_0x6ea39[_0xd8cf('0x10')]['cutdigits']+'}':_0xd8cf('0x1e')),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}_0x6ea39['extensions'][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')],'context':_0x2c267a[_0x293985][0x0]['context'],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});var _0x667f44=_0x6ea39['priority']++;_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x20')+(_0x667f44+0x2)+_0xd8cf('0x21')+(_0x667f44+0x1)+')','context':_0x2c267a[_0x293985][0x0]['context'],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x667f44,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});if(_0x6ea39['extension']){_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0x6ea39[_0xd8cf('0x10')]['cutdigits']?_0xd8cf('0x22')+_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x1c')]+'}':_0xd8cf('0x23'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}_0x6ea39['extensions'][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':'Set','appdata':_0xd8cf('0x24')+_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')],'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0]['VoiceExtensionId']});if(_0x6ea39[_0xd8cf('0x10')]&&_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0xe')](_0xd8cf('0x25'))&&_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x25')]!==_0xd8cf('0x26')){_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39['priority']++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x6ea39[_0xd8cf('0xf')]['push']({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x27')+_0x6ea39[_0xd8cf('0x10')][_0xd8cf('0x25')]||_0xd8cf('0x28'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39['priority']++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}}_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0]['type'],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x29'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x6ea39[_0xd8cf('0xf')][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x2a'),'context':_0x2c267a[_0x293985][0x0]['context'],'exten':_0x2c267a[_0x293985][0x0]['exten'],'priority':_0x6ea39['priority']++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x6ea39['extensions']['push']({'type':_0x2c267a[_0x293985][0x0]['type'],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x2b'),'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'priority':_0x6ea39[_0xd8cf('0x17')]++,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});for(var _0x59de32=0x0,_0x242696=0x0;_0x59de32<_0x2c267a[_0x293985][_0xd8cf('0x2c')];_0x59de32+=0x1,_0x242696=0x0){var _0x43f650=_0x2c267a[_0x293985][_0x59de32];if(_0x43f650[_0xd8cf('0x12')]){_0x43f650[_0xd8cf('0x12')]=_0x43f650[_0xd8cf('0x12')][_0xd8cf('0x2d')]();}var _0x3e0abb=[];var _0x533e48=[];delete _0x43f650['id'];delete _0x43f650[_0xd8cf('0x2e')];delete _0x43f650[_0xd8cf('0x2f')];var _0x3972aa=_0x43f650['interval']!==_0xd8cf('0x30')?[_0x43f650['interval']]:_0x43f650[_0xd8cf('0x31')]?_['map'](_['filter'](_0x6ea39['intervals'],{'IntervalId':_0x43f650['IntervalId']}),_0xd8cf('0x32')):[];if(_0x43f650[_0xd8cf('0xe')](_0xd8cf('0x33'))){if(_0x43f650['tag']&&_0x43f650['tag']!=='--'){_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x34')+_0x43f650['tag'],'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39['priority']+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}}if(_0x43f650[_0xd8cf('0x12')]===_0xd8cf('0x19')&&_0x43f650[_0xd8cf('0xe')](_0xd8cf('0x35'))){if(_0x43f650[_0xd8cf('0x35')]){_0x3e0abb['push']({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x36')+_0x43f650[_0xd8cf('0x35')]+')','context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa['length']+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}else{_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650['type'],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x37'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}}if(_0x43f650[_0xd8cf('0xe')]('answer')){if(_0x2df373[_0xd8cf('0x38')](_0x43f650[_0xd8cf('0x39')][_0xd8cf('0x2d')]())>=0x0&&_0x43f650[_0xd8cf('0x3a')]!==_0xd8cf('0x3b')){if(_0x43f650[_0xd8cf('0x3c')]){_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x3d'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x3e'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650['exten'],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}else{_0x3e0abb['push']({'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x1f'),'appdata':_0xd8cf('0x3f'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650[_0xd8cf('0xc')],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39['priority']+_0x242696++,'VoiceExtensionId':_0x43f650['VoiceExtensionId']});_0x3e0abb[_0xd8cf('0x1a')]({'type':_0x43f650['type'],'app':_0xd8cf('0x13'),'appdata':_0xd8cf('0x40'),'context':_0x43f650[_0xd8cf('0x16')],'exten':_0x43f650['exten'],'priority':_0x3972aa[_0xd8cf('0x2c')]+_0x6ea39[_0xd8cf('0x17')]+_0x242696++,'VoiceExtensionId':_0x43f650[_0xd8cf('0x18')]});}}}for(var _0x326592=0x0;_0x326592<_0x3972aa[_0xd8cf('0x2c')];_0x326592+=0x1){var _0x1e247e=_0x6ea39[_0xd8cf('0x17')]+_0x3972aa['length'];var _0x399beb=_0x326592===_0x3972aa[_0xd8cf('0x2c')]-0x1?_0x6ea39[_0xd8cf('0x17')]+_0x3e0abb['length']+_0x533e48[_0xd8cf('0x2c')]+0x2:_0x6ea39[_0xd8cf('0x17')]+_0x326592+0x1;_0x3e0abb[_0xd8cf('0x41')](_0x326592,0x0,{'type':_0x43f650[_0xd8cf('0x12')],'app':_0xd8cf('0x42'),'appdata':_0x3972aa[_0x326592]+'?'+_0x43f650[_0xd8cf('0x16')]+_0xd8cf('0x43')+_0x1e247e+':'+_0x43f650['context']+_0xd8cf('0x43')+_0x399beb,'exten':_0x43f650[_0xd8cf('0xc')],'context':_0x43f650[_0xd8cf('0x16')],'priority':_0x6ea39['priority']+_0x326592,'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});}_0x43f650['priority']=_0x3e0abb[_0xd8cf('0x2c')]?_[_0xd8cf('0x44')](_0x3e0abb)['priority']+0x1:_0x6ea39[_0xd8cf('0x17')];_0x6ea39[_0xd8cf('0x17')]=(_0x533e48[_0xd8cf('0x2c')]?_['last'](_0x533e48)[_0xd8cf('0x17')]:_0x43f650['priority'])+0x1;_0x6ea39[_0xd8cf('0xf')]=_[_0xd8cf('0x45')](_0x6ea39[_0xd8cf('0xf')],_0x3e0abb,[_0x43f650],_0x533e48);}_0x6ea39['extensions'][_0xd8cf('0x1a')]({'type':_0x2c267a[_0x293985][0x0][_0xd8cf('0x12')],'app':_0xd8cf('0x46'),'exten':_0x2c267a[_0x293985][0x0][_0xd8cf('0xc')],'context':_0x2c267a[_0x293985][0x0][_0xd8cf('0x16')],'priority':_0x6ea39[_0xd8cf('0x17')],'VoiceExtensionId':_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]});_0x8e55f2[_0xd8cf('0x1a')](_0x2c267a[_0x293985][0x0][_0xd8cf('0x18')]);_0x507c1d=_[_0xd8cf('0x45')](_0x507c1d,_0x6ea39[_0xd8cf('0xf')]);}}return _0x370288[_0xd8cf('0x47')](function(_0x36317b){return _0x370288[_0xd8cf('0x2')][_0xd8cf('0x6')][_0xd8cf('0x48')]({'where':{'VoiceExtensionId':{'$in':_0x8e55f2}},'transaction':_0x36317b})['then'](function(_0x2f9459){return _0x370288['models'][_0xd8cf('0x6')][_0xd8cf('0x49')](_[_0xd8cf('0x4a')](_0x507c1d,_0xd8cf('0x17')),{'transaction':_0x36317b});});});})[_0xd8cf('0x4b')](function(_0x342d48){console[_0xd8cf('0x4c')](_0x342d48);});}exports[_0xd8cf('0x4d')]=rewrite; \ No newline at end of file +var _0xee5b=['CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','destroy','bulkCreate','catch','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extension','push','type','Set','CDR(type)=%s','priority','VoiceExtensionId','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN:','context'];(function(_0x1d74ba,_0x35594e){var _0x407357=function(_0x17e68f){while(--_0x17e68f){_0x1d74ba['push'](_0x1d74ba['shift']());}};_0x407357(++_0x35594e);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1aa59c,_0x1f8f9a){_0x1aa59c=_0x1aa59c-0x0;var _0xfa71e4=_0xee5b[_0x1aa59c];return _0xfa71e4;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');function rewrite(_0x7b2344,_0x203bba){var _0x4f850a=this;return _0x7b2344[_0xbee5('0x1')][_0xbee5('0x2')][_0xbee5('0x3')]({'raw':!![]})[_0xbee5('0x4')](function(_0x4bd202){_0x4f850a['intervals']=_0x4bd202;return _0x7b2344[_0xbee5('0x1')][_0xbee5('0x5')][_0xbee5('0x3')]({'where':{'IntervalId':_0x203bba[_0xbee5('0x6')]},'raw':!![]});})['then'](function(_0x5505e3){return _0x7b2344['models']['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0xbee5('0x7')](_[_0xbee5('0x8')](_0x5505e3,_0xbee5('0x9')))}},'order':[{'raw':_0xbee5('0xa')}],'raw':!![]});})['then'](function(_0x143bd6){var _0x305921=_[_0xbee5('0xb')](_0x143bd6,{'priority':'1'});var _0x2edb3c=_[_0xbee5('0xb')](_0x143bd6,{'isApp':0x1});var _0x1509c7=_[_0xbee5('0xc')](_0x2edb3c,_0xbee5('0x9'));var _0xcef158=['queue',_0xbee5('0xd')];var _0x532a78=[];var _0x183877=[];for(var _0x180edd in _0x1509c7){if(_0x1509c7[_0xbee5('0xe')](_0x180edd)){_0x4f850a['priority']=0x2;_0x4f850a['extensions']=[];_0x4f850a[_0xbee5('0xf')]=_['find'](_0x305921,{'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')]});_0x4f850a['extensions'][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':util['format'](_0xbee5('0x13'),_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')]),'context':_0x1509c7[_0x180edd][0x0]['context'],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});if(_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')]===_0xbee5('0x16')){if(_0x4f850a[_0xbee5('0xf')]){_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x18')+(_0x4f850a[_0xbee5('0xf')][_0xbee5('0x19')]?_0xbee5('0x1a')+_0x4f850a[_0xbee5('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});}_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x1c')+_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')],'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a['priority']++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']});var _0x519473=_0x4f850a['priority']++;_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x1e')+(_0x519473+0x2)+_0xbee5('0x1f')+(_0x519473+0x1)+')','context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x519473,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});if(_0x4f850a[_0xbee5('0xf')]){_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':'Set','appdata':_0x4f850a[_0xbee5('0xf')][_0xbee5('0x19')]?_0xbee5('0x20')+_0x4f850a[_0xbee5('0xf')][_0xbee5('0x19')]+'}':_0xbee5('0x21'),'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']});}_0x4f850a[_0xbee5('0x17')]['push']({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':'Set','appdata':_0xbee5('0x22')+_0x1509c7[_0x180edd][0x0]['VoiceExtensionId'],'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});if(_0x4f850a[_0xbee5('0xf')]&&_0x4f850a[_0xbee5('0xf')]['hasOwnProperty'](_0xbee5('0x23'))&&_0x4f850a[_0xbee5('0xf')][_0xbee5('0x23')]!==_0xbee5('0x24')){_0x4f850a['extensions'][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x25'),'context':_0x1509c7[_0x180edd][0x0]['context'],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});_0x4f850a[_0xbee5('0x17')]['push']({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':'Set','appdata':_0xbee5('0x26')+_0x4f850a['extension']['recordingFormat']||'wav','context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});}}_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0]['exten'],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});_0x4f850a[_0xbee5('0x17')][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0]['type'],'app':_0xbee5('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1509c7[_0x180edd][0x0]['context'],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});_0x4f850a[_0xbee5('0x17')]['push']({'type':_0x1509c7[_0x180edd][0x0][_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x27'),'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'priority':_0x4f850a[_0xbee5('0x14')]++,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});for(var _0x297294=0x0,_0x2b3f0=0x0;_0x297294<_0x1509c7[_0x180edd][_0xbee5('0x28')];_0x297294+=0x1,_0x2b3f0=0x0){var _0x5f3f8a=_0x1509c7[_0x180edd][_0x297294];if(_0x5f3f8a[_0xbee5('0x11')]){_0x5f3f8a[_0xbee5('0x11')]=_0x5f3f8a['type'][_0xbee5('0x29')]();}var _0xebbcc5=[];var _0x426934=[];delete _0x5f3f8a['id'];delete _0x5f3f8a[_0xbee5('0x2a')];delete _0x5f3f8a['updatedAt'];var _0x4cfe54=_0x5f3f8a['interval']!==_0xbee5('0x2b')?[_0x5f3f8a[_0xbee5('0x2c')]]:_0x5f3f8a[_0xbee5('0x6')]?_[_0xbee5('0x8')](_[_0xbee5('0xb')](_0x4f850a[_0xbee5('0x2d')],{'IntervalId':_0x5f3f8a[_0xbee5('0x6')]}),_0xbee5('0x2c')):[];if(_0x5f3f8a[_0xbee5('0xe')]('tag')){if(_0x5f3f8a['tag']&&_0x5f3f8a[_0xbee5('0x2e')]!=='--'){_0xebbcc5['push']({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':'CDR(tag)='+_0x5f3f8a[_0xbee5('0x2e')],'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a['exten'],'priority':_0x4cfe54['length']+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});}}if(_0x5f3f8a['type']===_0xbee5('0x16')&&_0x5f3f8a[_0xbee5('0xe')]('callerID')){if(_0x5f3f8a[_0xbee5('0x2f')]){_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x30')+_0x5f3f8a[_0xbee5('0x2f')]+')','context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a['exten'],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});}else{_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a['type'],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x31'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a['exten'],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a['VoiceExtensionId']});}}if(_0x5f3f8a['hasOwnProperty']('answer')){if(_0xcef158[_0xbee5('0x32')](_0x5f3f8a['app'][_0xbee5('0x29')]())>=0x0&&_0x5f3f8a[_0xbee5('0x33')]!==_0xbee5('0x34')){if(_0x5f3f8a[_0xbee5('0x35')]){_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':'ExecIf','appdata':_0xbee5('0x36'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a['priority']+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});_0xebbcc5['push']({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x12'),'appdata':_0xbee5('0x37'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});}else{_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':_0xbee5('0x1d'),'appdata':_0xbee5('0x38'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54[_0xbee5('0x28')]+_0x4f850a['priority']+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a[_0xbee5('0x15')]});_0xebbcc5[_0xbee5('0x10')]({'type':_0x5f3f8a[_0xbee5('0x11')],'app':'Set','appdata':_0xbee5('0x39'),'context':_0x5f3f8a[_0xbee5('0x1b')],'exten':_0x5f3f8a[_0xbee5('0x9')],'priority':_0x4cfe54['length']+_0x4f850a[_0xbee5('0x14')]+_0x2b3f0++,'VoiceExtensionId':_0x5f3f8a['VoiceExtensionId']});}}}for(var _0x131c45=0x0;_0x131c45<_0x4cfe54['length'];_0x131c45+=0x1){var _0x91fb7a=_0x4f850a[_0xbee5('0x14')]+_0x4cfe54[_0xbee5('0x28')];var _0x594f87=_0x131c45===_0x4cfe54['length']-0x1?_0x4f850a['priority']+_0xebbcc5[_0xbee5('0x28')]+_0x426934[_0xbee5('0x28')]+0x2:_0x4f850a[_0xbee5('0x14')]+_0x131c45+0x1;_0xebbcc5['splice'](_0x131c45,0x0,{'type':_0x5f3f8a[_0xbee5('0x11')],'app':'GotoIfTime','appdata':_0x4cfe54[_0x131c45]+'?'+_0x5f3f8a[_0xbee5('0x1b')]+_0xbee5('0x3a')+_0x91fb7a+':'+_0x5f3f8a[_0xbee5('0x1b')]+',${EXTEN},'+_0x594f87,'exten':_0x5f3f8a[_0xbee5('0x9')],'context':_0x5f3f8a[_0xbee5('0x1b')],'priority':_0x4f850a[_0xbee5('0x14')]+_0x131c45,'VoiceExtensionId':_0x1509c7[_0x180edd][0x0][_0xbee5('0x15')]});}_0x5f3f8a[_0xbee5('0x14')]=_0xebbcc5[_0xbee5('0x28')]?_[_0xbee5('0x3b')](_0xebbcc5)[_0xbee5('0x14')]+0x1:_0x4f850a[_0xbee5('0x14')];_0x4f850a[_0xbee5('0x14')]=(_0x426934[_0xbee5('0x28')]?_[_0xbee5('0x3b')](_0x426934)[_0xbee5('0x14')]:_0x5f3f8a[_0xbee5('0x14')])+0x1;_0x4f850a[_0xbee5('0x17')]=_[_0xbee5('0x3c')](_0x4f850a[_0xbee5('0x17')],_0xebbcc5,[_0x5f3f8a],_0x426934);}_0x4f850a['extensions'][_0xbee5('0x10')]({'type':_0x1509c7[_0x180edd][0x0]['type'],'app':'Hangup','exten':_0x1509c7[_0x180edd][0x0][_0xbee5('0x9')],'context':_0x1509c7[_0x180edd][0x0][_0xbee5('0x1b')],'priority':_0x4f850a['priority'],'VoiceExtensionId':_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']});_0x532a78[_0xbee5('0x10')](_0x1509c7[_0x180edd][0x0]['VoiceExtensionId']);_0x183877=_[_0xbee5('0x3c')](_0x183877,_0x4f850a[_0xbee5('0x17')]);}}return _0x7b2344['transaction'](function(_0x928e67){return _0x7b2344[_0xbee5('0x1')][_0xbee5('0x5')][_0xbee5('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x532a78}},'transaction':_0x928e67})['then'](function(_0x205784){return _0x7b2344['models'][_0xbee5('0x5')][_0xbee5('0x3e')](_['sortBy'](_0x183877,_0xbee5('0x14')),{'transaction':_0x928e67});});});})[_0xbee5('0x3f')](function(_0x4a5127){console[_0xbee5('0x40')](_0x4a5127);});}exports[_0xbee5('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3140179..610900a 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 _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(_0xf6ad79,_0x49fd00){var _0x52efe0=function(_0x3b5d65){while(--_0x3b5d65){_0xf6ad79['push'](_0xf6ad79['shift']());}};_0x52efe0(++_0x49fd00);}(_0xe706,0xa3));var _0x6e70=function(_0x1a4528,_0x54d423){_0x1a4528=_0x1a4528-0x0;var _0x368a2c=_0xe706[_0x1a4528];return _0x368a2c;};'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 +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x4d111a,_0x847227){var _0x3fa8f0=function(_0x3ddbb1){while(--_0x3ddbb1){_0x4d111a['push'](_0x4d111a['shift']());}};_0x3fa8f0(++_0x847227);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1a7ec85..51c4baa 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(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x7a54,0x106));var _0x47a5=function(_0x454fd6,_0xb29e29){_0x454fd6=_0x454fd6-0x0;var _0x116dd6=_0x7a54[_0x454fd6];return _0x116dd6;};'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 _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x7a54,0x106));var _0x47a5=function(_0x27bdee,_0x478485){_0x27bdee=_0x27bdee-0x0;var _0x26b28c=_0x7a54[_0x27bdee];return _0x26b28c;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 6a2b20a..32e7ba5 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 _0x8979=['YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','path','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','then','message','AdditionalPhones','all','split','CmContactHasItem','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','fromQuery','updatedAt','.id\x20=\x20','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','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','CompanyId','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','code','catch','main','send','start','binding','root','server/files/tmp','body','ContactItemType','findAll','name','parse','createReadStream','rows','data','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email\x20wrong\x20format','dateOfBirth'];(function(_0x26cb44,_0x2e96c0){var _0x40a431=function(_0x2708c8){while(--_0x2708c8){_0x26cb44['push'](_0x26cb44['shift']());}};_0x40a431(++_0x2e96c0);}(_0x8979,0xb2));var _0x9897=function(_0x1e24a9,_0x50df33){_0x1e24a9=_0x1e24a9-0x0;var _0x8e9211=_0x8979[_0x1e24a9];return _0x8e9211;};'use strict';var fs=require('fs');var path=require(_0x9897('0x0'));var _=require('lodash');var Papa=require(_0x9897('0x1'));var util=require(_0x9897('0x2'));var BPromise=require(_0x9897('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x9897('0x4'));var db=require(_0x9897('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x9897('0x6'))('import');config['redis']=_[_0x9897('0x7')](config[_0x9897('0x8')],{'host':_0x9897('0x9'),'port':0x18eb});var socket=require(_0x9897('0xa'))(new Redis(config[_0x9897('0x8')]));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()[_0x9897('0xb')](_0x9897('0xc'));var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x40ef5a){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))*$/[_0x9897('0xd')](_0x40ef5a);}function selectNotIn(_0x3a2296,_0x4f5792,_0x16d419,_0xcf8268,_0x50d393){return squel[_0x9897('0xe')]()[_0x9897('0xf')](_0x9897('0x10'))[_0x9897('0x11')](_0xcf8268)[_0x9897('0x12')](_0x4f5792,null,_0x4f5792+'.id\x20=\x20'+_0xcf8268+'.'+_0x16d419)[_0x9897('0x13')](_0xcf8268+'.'+_0x16d419+_0x9897('0x14')+_0x3a2296+'.'+_0x16d419)[_0x9897('0x13')](_0x4f5792+_0x9897('0x15')+_0x50d393[_0x9897('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4d1d24,_0x419929){promisesAdditionalPhones=[];promisesContact=[];return db[_0x9897('0x16')][_0x9897('0x17')](_0x9897('0x18')+tempTableName)[_0x9897('0x19')](function(_0x4aebcf){if(_0x4aebcf!==null){var _0x3820f9=[];for(var _0x11c23e=0x0;_0x11c23e<_0x4aebcf[_0x9897('0x1a')];_0x11c23e++){var _0x125ab7=_0x4aebcf[_0x11c23e];if(!_[_0x9897('0x1b')](_0x125ab7['phone'])){if(!_[_0x9897('0x1b')](_0x125ab7['AdditionalPhones']))_0x3820f9[_0x9897('0x1c')](insertAdditionalPhones(_0x125ab7));promisesContact[_0x9897('0x1c')]({'contact':_0x125ab7});}}}Promise['all'](_0x3820f9)[_0x9897('0x1d')](function(){_0x4d1d24({'val':0x1});});})['catch'](function(_0xf2cd38){logger['error'](_0xf2cd38[_0x9897('0x1e')]);});});}function insertAdditionalPhones(_0x164bf0){return new Promise(function(_0x3f8632,_0x5eb0ab){var _0x3915b2=_0x164bf0[_0x9897('0x1f')];if(_['isNil'](_0x3915b2))_0x5eb0ab({'val':0x0});else{var _0x1deb36=_0x3915b2['split'](';');var _0x735ba4=[];orderBy=0x0;for(var _0x5928d2=0x0;_0x5928d2<_0x1deb36[_0x9897('0x1a')];_0x5928d2++){_0x735ba4['push'](splitAdditionalPhone(_0x164bf0['id'],_0x1deb36[_0x5928d2]));}Promise[_0x9897('0x20')](_0x735ba4)[_0x9897('0x1d')](function(){_0x3f8632({'val':_0x1deb36['length']});});}});}function splitAdditionalPhone(_0xf51a9c,_0x2b0667){return new Promise(function(_0x58b8bd,_0x105dfd){var _0x5f5d30=_0x2b0667[_0x9897('0x21')](':');var _0x18dc06=_0x5f5d30[0x0];var _0x3c1223=_0x5f5d30[0x1];if(_0x3c1223!==''){var _0x17fdad=_0x3c1223[_0x9897('0x21')]('|');var _0x54e6f2=[];for(var _0x948d12=0x0;_0x948d12<_0x17fdad[_0x9897('0x1a')];_0x948d12++){if(_0x17fdad[_0x948d12]!==''){var _0x191386=_['filter'](promisesAdditionalPhones,{'contactId':_0xf51a9c,'phone':_0x17fdad[_0x948d12]});if(_0x191386['length']==0x0){orderBy++;promisesAdditionalPhones[_0x9897('0x1c')]({'contactId':_0xf51a9c,'contactTypeId':_0x18dc06,'phone':_0x17fdad[_0x948d12],'orderBy':orderBy});}}}_0x58b8bd({'ok':0x1});}else _0x58b8bd({'res':0x0});});}function createAdditionalPhone(_0x1d3143,_0x2c8aea,_0x38f24e,_0xf19293){return new Promise(function(_0x18c3f2,_0x49bbd8){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1d3143,'item':_0x38f24e}})[_0x9897('0x1d')](function(_0x326aa4){if(_0x326aa4){return db[_0x9897('0x22')]['update']({'ItemTypeId':_0x2c8aea,'OrderBy':_0xf19293},{'where':{'CmContactId':_0x1d3143,'item':_0x38f24e}})[_0x9897('0x1d')](function(_0x240c92){_0x18c3f2({'res':'updated'});});}else{return db[_0x9897('0x22')]['create']({'CmContactId':_0x1d3143,'item':_0x38f24e,'ItemTypeId':_0x2c8aea,'OrderBy':_0xf19293,'ItemClass':_0x9897('0x23')})[_0x9897('0x1d')](function(_0x20fe50){_0x18c3f2({'res':'inserted'});});}});});}function updateContact(_0x4ebc9f){return new Promise(function(_0x5d96d5,_0x35113e){var _0x3135ec=_0x4ebc9f['id'];delete _0x4ebc9f['id'];return db[_0x9897('0x24')][_0x9897('0x25')](_0x4ebc9f,{'where':{'id':_0x3135ec}})[_0x9897('0x1d')](function(_0x1dc32){updatedRows+=0x1;return db[_0x9897('0x26')][_0x9897('0x25')]({'phone':_0x4ebc9f['phone']},{'where':{'ContactId':_0x3135ec}})[_0x9897('0x1d')](function(_0x5f424e){_0x5d96d5({'ret':'OK'});});});});}function insertCmHopper(_0x517a3f,_0x57acc9,_0x34c14c,_0x155fb6,_0x1c8ba5){var _0x462978=[_0x9897('0x27'),_0x9897('0x28'),_0x9897('0x29'),_0x9897('0x2a'),_0x57acc9+'.'+_0x155fb6,'cm_contacts.createdAt',_0x9897('0x2b'),_0x9897('0x2c'),'cm_contacts.UserId','\x22'+_0x1c8ba5+'\x22'];return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x2f'))['fromQuery']([_0x9897('0x10'),_0x9897('0x30'),_0x9897('0x31'),_0x9897('0x32'),_0x155fb6,_0x9897('0x33'),'updatedAt',_0x9897('0x34'),_0x9897('0x35'),_0x9897('0x36')],squel['select']()[_0x9897('0x37')](_0x462978)[_0x9897('0x11')](_0x57acc9)['join'](_0x9897('0x38'),null,_0x9897('0x39')+_0x57acc9+_0x9897('0x3a'))[_0x9897('0x12')](_0x34c14c,null,_0x34c14c+'.id\x20=\x20'+_0x57acc9+'.'+_0x155fb6)[_0x9897('0x13')](_0x57acc9+_0x9897('0x3b'),_0x517a3f)['where'](_0x9897('0x3c'),NOW)[_0x9897('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x57acc9,_0x34c14c,_0x155fb6,_0x9897('0x2f'),['\x22always\x22',_0x9897('0x3d')]))['where'](_0x9897('0x3e'),selectNotIn(_0x57acc9,_0x34c14c,_0x155fb6,_0x9897('0x2f'),['\x22always\x22'])))[_0x9897('0x3f')]();}function insertCmHopperBlack(_0xc4fc1c,_0x1b442b,_0x5c8e8c,_0x4d7d8f){var _0x4a879d=['cm_contacts.phone',_0x9897('0x29'),_0x9897('0x2a'),_0x1b442b+'.'+_0x4d7d8f,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x40'))[_0x9897('0x41')]([_0x9897('0x10'),_0x9897('0x31'),_0x9897('0x32'),_0x4d7d8f,'createdAt',_0x9897('0x42')],squel[_0x9897('0xe')]()[_0x9897('0x37')](_0x4a879d)['from'](_0x1b442b)[_0x9897('0x12')]('cm_contacts',null,_0x9897('0x39')+_0x1b442b+_0x9897('0x3a'))[_0x9897('0x12')](_0x5c8e8c,null,_0x5c8e8c+_0x9897('0x43')+_0x1b442b+'.'+_0x4d7d8f)[_0x9897('0x13')](_0x1b442b+_0x9897('0x3b'),_0xc4fc1c)[_0x9897('0x13')](_0x9897('0x3c'),NOW)[_0x9897('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x9897('0xe')]()[_0x9897('0xf')](_0x9897('0x10'))['from'](_0x9897('0x40'))[_0x9897('0x13')](_0x9897('0x44'),_0xc4fc1c)[_0x9897('0x13')](_0x4d7d8f+'\x20=\x20?',_0x1b442b+'.'+_0x4d7d8f)))[_0x9897('0x3f')]();}function insertCmHopperAdditionalPhones(_0x1a0d11){var _0x20fc0e=[_0x9897('0x45'),_0x9897('0x46'),'cm_contact_has_items.OrderBy',_0x9897('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x48'))[_0x9897('0x41')]([_0x9897('0x49'),_0x9897('0x10'),_0x9897('0x4a'),_0x9897('0x33'),_0x9897('0x42')],squel[_0x9897('0xe')]()[_0x9897('0x37')](_0x20fc0e)[_0x9897('0x11')]('cm_hopper')[_0x9897('0x12')](_0x9897('0x38'),null,_0x9897('0x4b'))[_0x9897('0x12')](_0x9897('0x4c'),null,_0x9897('0x4d'))[_0x9897('0x13')](_0x9897('0x4e'),_0x1a0d11)['where'](_0x9897('0x3c'),NOW))['toString']();}function insertCmContact(_0x5030a9,_0xba3a28,_0x5cb6bf,_0x5a968c){var _0x390d9d=_[_0x9897('0x4f')](_[_0x9897('0x50')](_0x5a968c),[_0x9897('0x32'),_0x9897('0x51'),'createdAt',_0x9897('0x42')]);return squel[_0x9897('0x2d')]()[_0x9897('0x2e')](_0x9897('0x38'))['fromQuery'](_0x390d9d,squel[_0x9897('0xe')]()[_0x9897('0x37')](_0x390d9d)['from'](_0xba3a28)['where']('('+_0x5cb6bf[_0x9897('0x12')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x5cb6bf)[_0x9897('0x11')](_0x9897('0x38'))[_0x9897('0x13')](_0x9897('0x44'),_0x5030a9))[_0x9897('0x13')](_0x9897('0x52'),squel[_0x9897('0xe')]()[_0x9897('0xf')](_0x9897('0x53'),_0x9897('0x54'))['from'](_0xba3a28)['group'](_0x5cb6bf[_0x9897('0x12')](','))))[_0x9897('0x3f')]();}function handleStop(){logger[_0x9897('0x55')](_0x9897('0x56'));stopped=!![];}function handleUncaughtException(_0x121945){logger[_0x9897('0x57')](_0x121945['message']);process[_0x9897('0x58')](0x1);}function handleError(_0x357021,_0x1d0c65){stats[_0x9897('0x59')][_0x9897('0x1c')]({'name':_0x1d0c65[_0x9897('0x5a')],'message':_0x1d0c65[_0x9897('0x1e')],'row':_0x357021});}function handleQuery(_0x59f6df){logger[_0x9897('0x55')](_0x59f6df);return db[_0x9897('0x16')][_0x9897('0x17')](_0x59f6df)[_0x9897('0x19')](function(_0x21b091){results['push'](_0x21b091);})[_0x9897('0x5b')](function(_0x4aea0c){logger[_0x9897('0x57')](_0x4aea0c['message']);});}function main(_0x20893d,_0x576cdc,_0x449595,_0x2035ea){logger[_0x9897('0x55')](_0x9897('0x5c'),_0x20893d,JSON['stringify'](_0x576cdc));process[_0x9897('0x5d')](_0x9897('0x5e'));var _0x8e8c84=_0x576cdc[_0x9897('0x5f')];var _0x221b0a=_['clone'](_0x8e8c84);var _0x173189=_0x576cdc['socket_timestamp'];var _0x4a8e5b=path[_0x9897('0x12')](config[_0x9897('0x60')],_0x9897('0x61'),_0x173189+'.csv');logger[_0x9897('0x55')](_0x9897('0x62'),_0x576cdc);db[_0x9897('0x63')][_0x9897('0x64')]({'raw':!![],'attributes':['id','name']})[_0x9897('0x1d')](function(_0x180772){for(var _0x3c5d62=0x0;_0x3c5d62<_0x180772[_0x9897('0x1a')];_0x3c5d62++){if(_0x180772[_0x3c5d62][_0x9897('0x65')]in _0x8e8c84){contactItemTypes['push'](_0x180772[_0x3c5d62]);delete _0x221b0a[_0x180772[_0x3c5d62]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x221b0a[_0x9897('0x1f')]='';var _0x2b7264=_['keys'](_0x221b0a)['join']();logger[_0x9897('0x55')]('header',_0x2b7264);fs['writeFileSync'](_0x4a8e5b,_0x2b7264+'\x0a');Papa[_0x9897('0x66')](fs[_0x9897('0x67')](_0x20893d),{'header':!![],'skipEmptyLines':!![],'step':function(_0xd635c5,_0x465016){try{for(var _0x7614d3=0x0,_0x355559=[];_0x7614d3<_0xd635c5['data']['length'];_0x7614d3++){stats[_0x9897('0x68')]+=0x1;if(_0xd635c5[_0x9897('0x59')][_0x7614d3]){handleError(_0xd635c5[_0x9897('0x69')][_0x7614d3],_0xd635c5[_0x9897('0x59')][_0x7614d3]);}else{var _0x4f0760=[];var _0x325fcb=[];for(var _0x1a195f in _0x8e8c84){let _0x1f155f=contactItemTypes[_0x9897('0x6a')](_0xb05ee9=>_0xb05ee9[_0x9897('0x65')]===_0x1a195f);if(_[_0x9897('0x1b')](_0x1f155f)){if(_0x8e8c84[_0x9897('0x6b')](_0x1a195f)){if(_0xd635c5[_0x9897('0x69')][_0x7614d3][_0x8e8c84[_0x1a195f]]){var _0x468b82=_[_0x9897('0x6c')](_0xd635c5[_0x9897('0x69')][_0x7614d3][_0x8e8c84[_0x1a195f]]['replace'](/"/g,'\x27'));switch(_0x1a195f){case _0x9897('0x30'):var _0x2eccc9=moment(_0x468b82,_0x9897('0xc'),!![]);if(_0x2eccc9[_0x9897('0x6d')]()){_0x355559['push']('\x22'+_0x468b82+'\x22');}else{_0x4f0760[_0x9897('0x1c')](_0x9897('0x6e'));}break;case'priority':var _0x46475a=parseInt(_0x468b82);_0x468b82=_[_0x9897('0x6f')](_0x46475a)||_0x46475a<0x0||_0x46475a>0x4?_0x2035ea?0x3:0x2:_0x46475a;_0x355559['push']('\x22'+_0x468b82+'\x22');break;case _0x9897('0x35'):var _0x43b13a=parseInt(_0x468b82);if(_[_0x9897('0x70')](_0x43b13a)&&_[_0x9897('0x71')](_0x449595,_0x43b13a)){_0x355559[_0x9897('0x1c')]('\x22'+_0x43b13a+'\x22');}else{_0x4f0760[_0x9897('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x468b82)){_0x355559[_0x9897('0x1c')]('\x22'+_0x468b82+'\x22');}else{_0x4f0760['push'](_0x9897('0x72'));}break;case _0x9897('0x73'):var _0x40cdb8=moment(_0x468b82,_0x9897('0x74'),!![]);if(_0x40cdb8[_0x9897('0x6d')]()){_0x355559['push']('\x22'+_0x468b82+'\x22');}else{_0x4f0760[_0x9897('0x1c')](_0x9897('0x75'));}break;default:_0x355559['push']('\x22'+_0x468b82+'\x22');}}else{switch(_0x1a195f){case _0x9897('0x76'):case _0x9897('0x10'):_0x4f0760['push'](_0x1a195f+_0x9897('0x77'));break;default:_0x355559[_0x9897('0x1c')]('\x22\x22');}}}}else{var _0xb62092='';for(var _0x4057a7=0x0;_0x4057a7<_0x8e8c84[_0x1a195f][_0x9897('0x1a')];_0x4057a7++){var _0x468b82=_[_0x9897('0x6c')](_0xd635c5[_0x9897('0x69')][_0x7614d3][_0x8e8c84[_0x1a195f][_0x4057a7]][_0x9897('0x78')](/"/g,'\x27'));if(_0xb62092=='')_0xb62092=_0x468b82;else _0xb62092+='|'+_0x468b82;}_0x325fcb['push'](_0x1f155f['id']+':'+_0xb62092);}}if(hasAdditionalPhones){_0x355559[_0x9897('0x1c')]('\x22'+_0x325fcb[_0x9897('0x12')](';')+'\x22');}if(_0x4f0760[_0x9897('0x1a')]){handleError(_0xd635c5[_0x9897('0x69')][_0x7614d3],{'code':'SystemRow','message':_0x4f0760['join']()});}else{fs[_0x9897('0x79')](_0x4a8e5b,_0x355559[_0x9897('0x12')]()+'\x0a');}_0x355559=[];}if(!(stats['rows']%0xc8)){socket[_0x9897('0x7a')](_0x9897('0x7b')+_0x173189,stats);stats[_0x9897('0x59')]=[];}}if(stopped){logger['info'](_0x9897('0x7c'));_0x465016[_0x9897('0x7d')]();}}catch(_0x544d7d){handleError(_0xd635c5[_0x9897('0x69')][_0x7614d3],{'code':_0x9897('0x7e'),'message':_0x544d7d['message']});logger[_0x9897('0x57')]('step',_0x544d7d[_0x9897('0x1e')]);}},'complete':function(){try{var _0x4287fc=[];var _0x337d3b=tempTableName;_0x4287fc[_0x9897('0x1c')](_0x9897('0x7f')+_0x337d3b+_0x9897('0x80'));logger[_0x9897('0x55')](_0x9897('0x81'),contactItemTypes['length']);var _0x24c45c=util[_0x9897('0xb')](_0x9897('0x82'),_0x4a8e5b,_0x337d3b,_0x2b7264,_0x576cdc[_0x9897('0x32')],_0x576cdc['CompanyId']||null,NOW,NOW);if(_[_0x9897('0x1b')](_0x8e8c84[_0x9897('0x30')])){_0x24c45c+=_0x9897('0x83');}_0x4287fc[_0x9897('0x1c')](_0x24c45c);BPromise['each'](_0x4287fc,handleQuery)[_0x9897('0x1d')](function(_0x3a00ad){BPromise[_0x9897('0x20')]([handleAdditionalPhones()])[_0x9897('0x1d')](function(){_0x4287fc=[];for(var _0x2cdc7d=0x0;_0x2cdc7d\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','field','phone','from','join','where','\x20=\x20','sequelize','query','spread','isNil','AdditionalPhones','push','then','error','message','split','length','all','filter','CmContactHasItem'];(function(_0x236c98,_0x522c76){var _0x53d653=function(_0x277c0d){while(--_0x277c0d){_0x236c98['push'](_0x236c98['shift']());}};_0x53d653(++_0x522c76);}(_0x428f,0x110));var _0xf428=function(_0x216da7,_0x30626d){_0x216da7=_0x216da7-0x0;var _0x2e106a=_0x428f[_0x216da7];return _0x2e106a;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf428('0x0'));var Papa=require(_0xf428('0x1'));var util=require(_0xf428('0x2'));var BPromise=require(_0xf428('0x3'));var moment=require(_0xf428('0x4'));var squel=require(_0xf428('0x5'));var Redis=require('ioredis');var db=require(_0xf428('0x6'))['db'];var config=require(_0xf428('0x7'));var logger=require(_0xf428('0x8'))('import');config[_0xf428('0x9')]=_[_0xf428('0xa')](config[_0xf428('0x9')],{'host':_0xf428('0xb'),'port':0x18eb});var socket=require(_0xf428('0xc'))(new Redis(config[_0xf428('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf428('0xd')](_0xf428('0xe'));var tempTableName=_0xf428('0xf')+moment()['format'](_0xf428('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x542b68){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xf428('0x11')](_0x542b68);}function selectNotIn(_0x41456e,_0x222b17,_0x37ba7a,_0x566269,_0xc81c6){return squel['select']()[_0xf428('0x12')](_0xf428('0x13'))[_0xf428('0x14')](_0x566269)[_0xf428('0x15')](_0x222b17,null,_0x222b17+'.id\x20=\x20'+_0x566269+'.'+_0x37ba7a)[_0xf428('0x16')](_0x566269+'.'+_0x37ba7a+_0xf428('0x17')+_0x41456e+'.'+_0x37ba7a)[_0xf428('0x16')](_0x222b17+'.dialCheckDuplicateType\x20IN\x20('+_0xc81c6[_0xf428('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x32e4dd,_0x5a5be4){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf428('0x18')][_0xf428('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0xf428('0x1a')](function(_0x4e50e1){if(_0x4e50e1!==null){var _0x7e0a2d=[];for(var _0x51acd6=0x0;_0x51acd6<_0x4e50e1['length'];_0x51acd6++){var _0x4c05ce=_0x4e50e1[_0x51acd6];if(!_[_0xf428('0x1b')](_0x4c05ce[_0xf428('0x13')])){if(!_[_0xf428('0x1b')](_0x4c05ce[_0xf428('0x1c')]))_0x7e0a2d[_0xf428('0x1d')](insertAdditionalPhones(_0x4c05ce));promisesContact['push']({'contact':_0x4c05ce});}}}Promise['all'](_0x7e0a2d)[_0xf428('0x1e')](function(){_0x32e4dd({'val':0x1});});})['catch'](function(_0x4551b1){logger[_0xf428('0x1f')](_0x4551b1[_0xf428('0x20')]);});});}function insertAdditionalPhones(_0x251e36){return new Promise(function(_0x561a82,_0x52bf51){var _0x1b4b1b=_0x251e36['AdditionalPhones'];if(_[_0xf428('0x1b')](_0x1b4b1b))_0x52bf51({'val':0x0});else{var _0x155f01=_0x1b4b1b[_0xf428('0x21')](';');var _0x5bc400=[];orderBy=0x0;for(var _0x5e0a7e=0x0;_0x5e0a7e<_0x155f01[_0xf428('0x22')];_0x5e0a7e++){_0x5bc400[_0xf428('0x1d')](splitAdditionalPhone(_0x251e36['id'],_0x155f01[_0x5e0a7e]));}Promise[_0xf428('0x23')](_0x5bc400)[_0xf428('0x1e')](function(){_0x561a82({'val':_0x155f01[_0xf428('0x22')]});});}});}function splitAdditionalPhone(_0x3aea7e,_0x34211f){return new Promise(function(_0x4e6fa2,_0x409b09){var _0x1ef86a=_0x34211f['split'](':');var _0x4a25ed=_0x1ef86a[0x0];var _0x1a0446=_0x1ef86a[0x1];if(_0x1a0446!==''){var _0x155b49=_0x1a0446[_0xf428('0x21')]('|');var _0x10f5ce=[];for(var _0x15a74c=0x0;_0x15a74c<_0x155b49['length'];_0x15a74c++){if(_0x155b49[_0x15a74c]!==''){var _0x3d677b=_[_0xf428('0x24')](promisesAdditionalPhones,{'contactId':_0x3aea7e,'phone':_0x155b49[_0x15a74c]});if(_0x3d677b[_0xf428('0x22')]==0x0){orderBy++;promisesAdditionalPhones[_0xf428('0x1d')]({'contactId':_0x3aea7e,'contactTypeId':_0x4a25ed,'phone':_0x155b49[_0x15a74c],'orderBy':orderBy});}}}_0x4e6fa2({'ok':0x1});}else _0x4e6fa2({'res':0x0});});}function createAdditionalPhone(_0x5aeb3c,_0xa0942f,_0xf71970,_0x5cde78){return new Promise(function(_0x35bfab,_0x4020b2){return db[_0xf428('0x25')][_0xf428('0x26')]({'where':{'CmContactId':_0x5aeb3c,'item':_0xf71970}})[_0xf428('0x1e')](function(_0x2d5e82){if(_0x2d5e82){return db[_0xf428('0x25')][_0xf428('0x27')]({'ItemTypeId':_0xa0942f,'OrderBy':_0x5cde78},{'where':{'CmContactId':_0x5aeb3c,'item':_0xf71970}})[_0xf428('0x1e')](function(_0x1834d3){_0x35bfab({'res':'updated'});});}else{return db[_0xf428('0x25')]['create']({'CmContactId':_0x5aeb3c,'item':_0xf71970,'ItemTypeId':_0xa0942f,'OrderBy':_0x5cde78,'ItemClass':_0xf428('0x28')})[_0xf428('0x1e')](function(_0x5603d4){_0x35bfab({'res':_0xf428('0x29')});});}});});}function updateContact(_0x2e2ddf){return new Promise(function(_0x735378,_0x52ee4b){var _0x3f3c9b=_0x2e2ddf['id'];delete _0x2e2ddf['id'];return db[_0xf428('0x2a')]['update'](_0x2e2ddf,{'where':{'id':_0x3f3c9b}})[_0xf428('0x1e')](function(_0x30fcc7){updatedRows+=0x1;return db[_0xf428('0x2b')][_0xf428('0x27')]({'phone':_0x2e2ddf[_0xf428('0x13')]},{'where':{'ContactId':_0x3f3c9b}})[_0xf428('0x1e')](function(_0x4e6cc8){_0x735378({'ret':'OK'});});});});}function insertCmHopper(_0x213480,_0x44497b,_0x1cfc67,_0x47ae56,_0x4f2ad7){var _0x54aa77=[_0xf428('0x2c'),'cm_contacts.scheduledat',_0xf428('0x2d'),_0xf428('0x2e'),_0x44497b+'.'+_0x47ae56,'cm_contacts.createdAt',_0xf428('0x2f'),_0xf428('0x30'),_0xf428('0x31'),'\x22'+_0x4f2ad7+'\x22'];return squel[_0xf428('0x32')]()[_0xf428('0x33')]('cm_hopper')[_0xf428('0x34')](['phone',_0xf428('0x35'),_0xf428('0x36'),_0xf428('0x37'),_0x47ae56,_0xf428('0x38'),_0xf428('0x39'),_0xf428('0x3a'),'UserId',_0xf428('0x3b')],squel[_0xf428('0x3c')]()[_0xf428('0x3d')](_0x54aa77)[_0xf428('0x14')](_0x44497b)[_0xf428('0x15')](_0xf428('0x3e'),null,_0xf428('0x3f')+_0x44497b+_0xf428('0x40'))[_0xf428('0x15')](_0x1cfc67,null,_0x1cfc67+_0xf428('0x41')+_0x44497b+'.'+_0x47ae56)['where'](_0x44497b+'.CmListId\x20=\x20?',_0x213480)[_0xf428('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf428('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44497b,_0x1cfc67,_0x47ae56,_0xf428('0x42'),[_0xf428('0x43'),_0xf428('0x44')]))[_0xf428('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44497b,_0x1cfc67,_0x47ae56,_0xf428('0x42'),[_0xf428('0x43')])))['toString']();}function insertCmHopperBlack(_0x304413,_0x2bfe9b,_0xf4861b,_0x305f1f){var _0x121323=[_0xf428('0x2c'),'cm_contacts.id',_0xf428('0x2e'),_0x2bfe9b+'.'+_0x305f1f,_0xf428('0x45'),'cm_contacts.updatedAt'];return squel[_0xf428('0x32')]()[_0xf428('0x33')](_0xf428('0x46'))['fromQuery']([_0xf428('0x13'),'ContactId',_0xf428('0x37'),_0x305f1f,_0xf428('0x38'),'updatedAt'],squel[_0xf428('0x3c')]()[_0xf428('0x3d')](_0x121323)[_0xf428('0x14')](_0x2bfe9b)['join'](_0xf428('0x3e'),null,_0xf428('0x3f')+_0x2bfe9b+_0xf428('0x40'))[_0xf428('0x15')](_0xf4861b,null,_0xf4861b+'.id\x20=\x20'+_0x2bfe9b+'.'+_0x305f1f)[_0xf428('0x16')](_0x2bfe9b+_0xf428('0x47'),_0x304413)[_0xf428('0x16')](_0xf428('0x48'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf428('0x12')]('phone')[_0xf428('0x14')](_0xf428('0x46'))[_0xf428('0x16')](_0xf428('0x49'),_0x304413)[_0xf428('0x16')](_0x305f1f+'\x20=\x20?',_0x2bfe9b+'.'+_0x305f1f)))['toString']();}function insertCmHopperAdditionalPhones(_0x4bc409){var _0x4b4402=[_0xf428('0x4a'),'cm_contact_has_items.item',_0xf428('0x4b'),_0xf428('0x4c'),_0xf428('0x4d')];return squel[_0xf428('0x32')]()[_0xf428('0x33')](_0xf428('0x4e'))[_0xf428('0x34')]([_0xf428('0x4f'),_0xf428('0x13'),'OrderBy',_0xf428('0x38'),'updatedAt'],squel[_0xf428('0x3c')]()['fields'](_0x4b4402)[_0xf428('0x14')](_0xf428('0x42'))[_0xf428('0x15')](_0xf428('0x3e'),null,_0xf428('0x50'))[_0xf428('0x15')](_0xf428('0x51'),null,_0xf428('0x52'))[_0xf428('0x16')](_0xf428('0x53'),_0x4bc409)[_0xf428('0x16')](_0xf428('0x48'),NOW))['toString']();}function insertCmContact(_0x50be98,_0xb2b6b6,_0x369ff0,_0x279679){var _0x31c645=_['concat'](_[_0xf428('0x54')](_0x279679),[_0xf428('0x37'),_0xf428('0x55'),_0xf428('0x38'),_0xf428('0x39')]);return squel[_0xf428('0x32')]()['into'](_0xf428('0x3e'))['fromQuery'](_0x31c645,squel[_0xf428('0x3c')]()['fields'](_0x31c645)[_0xf428('0x14')](_0xb2b6b6)[_0xf428('0x16')]('('+_0x369ff0[_0xf428('0x15')](',')+_0xf428('0x56'),squel[_0xf428('0x3c')]()[_0xf428('0x3d')](_0x369ff0)[_0xf428('0x14')](_0xf428('0x3e'))[_0xf428('0x16')](_0xf428('0x49'),_0x50be98))['where']('id\x20IN\x20?',squel[_0xf428('0x3c')]()[_0xf428('0x12')](_0xf428('0x57'),_0xf428('0x58'))[_0xf428('0x14')](_0xb2b6b6)[_0xf428('0x59')](_0x369ff0['join'](','))))[_0xf428('0x5a')]();}function handleStop(){logger[_0xf428('0x5b')](_0xf428('0x5c'));stopped=!![];}function handleUncaughtException(_0x325d48){logger['error'](_0x325d48[_0xf428('0x20')]);process[_0xf428('0x5d')](0x1);}function handleError(_0x1d3670,_0xed0b82){stats[_0xf428('0x5e')][_0xf428('0x1d')]({'name':_0xed0b82[_0xf428('0x5f')],'message':_0xed0b82[_0xf428('0x20')],'row':_0x1d3670});}function handleQuery(_0x4d4d49){logger['info'](_0x4d4d49);return db['sequelize'][_0xf428('0x19')](_0x4d4d49)['spread'](function(_0x1b4b27){results['push'](_0x1b4b27);})[_0xf428('0x60')](function(_0x521600){logger['error'](_0x521600[_0xf428('0x20')]);});}function main(_0x58ab30,_0x43d73c,_0x13c6b5,_0x2e47a3){logger[_0xf428('0x5b')](_0xf428('0x61'),_0x58ab30,JSON[_0xf428('0x62')](_0x43d73c));process[_0xf428('0x63')](_0xf428('0x64'));var _0x46e16c=_0x43d73c[_0xf428('0x65')];var _0x209fe4=_[_0xf428('0x66')](_0x46e16c);var _0x1f2a8d=_0x43d73c[_0xf428('0x67')];var _0x526edd=path[_0xf428('0x15')](config[_0xf428('0x68')],_0xf428('0x69'),_0x1f2a8d+'.csv');logger[_0xf428('0x5b')](_0xf428('0x6a'),_0x43d73c);db[_0xf428('0x6b')][_0xf428('0x6c')]({'raw':!![],'attributes':['id',_0xf428('0x6d')]})['then'](function(_0x5edcab){for(var _0x5ea7fc=0x0;_0x5ea7fc<_0x5edcab[_0xf428('0x22')];_0x5ea7fc++){if(_0x5edcab[_0x5ea7fc][_0xf428('0x6d')]in _0x46e16c){contactItemTypes[_0xf428('0x1d')](_0x5edcab[_0x5ea7fc]);delete _0x209fe4[_0x5edcab[_0x5ea7fc]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x209fe4[_0xf428('0x1c')]='';var _0x1fea89=_[_0xf428('0x54')](_0x209fe4)['join']();logger['info'](_0xf428('0x6e'),_0x1fea89);fs[_0xf428('0x6f')](_0x526edd,_0x1fea89+'\x0a');Papa[_0xf428('0x70')](fs[_0xf428('0x71')](_0x58ab30),{'header':!![],'skipEmptyLines':!![],'step':function(_0x177c48,_0x2e44bd){try{for(var _0x3127c8=0x0,_0xdddb4a=[];_0x3127c8<_0x177c48[_0xf428('0x72')][_0xf428('0x22')];_0x3127c8++){stats[_0xf428('0x73')]+=0x1;if(_0x177c48['errors'][_0x3127c8]){handleError(_0x177c48[_0xf428('0x72')][_0x3127c8],_0x177c48[_0xf428('0x5e')][_0x3127c8]);}else{var _0x54cbbd=[];var _0x1ff594=[];for(var _0x57fd2b in _0x46e16c){let _0x56d1d4=contactItemTypes[_0xf428('0x74')](_0x51eaed=>_0x51eaed[_0xf428('0x6d')]===_0x57fd2b);if(_['isNil'](_0x56d1d4)){if(_0x46e16c['hasOwnProperty'](_0x57fd2b)){if(_0x177c48[_0xf428('0x72')][_0x3127c8][_0x46e16c[_0x57fd2b]]){var _0x33bee9=_['trim'](_0x177c48[_0xf428('0x72')][_0x3127c8][_0x46e16c[_0x57fd2b]]['replace'](/"/g,'\x27'));switch(_0x57fd2b){case _0xf428('0x35'):var _0x6be48d=moment(_0x33bee9,_0xf428('0xe'),!![]);if(_0x6be48d['isValid']()){_0xdddb4a['push']('\x22'+_0x33bee9+'\x22');}else{_0x54cbbd[_0xf428('0x1d')](_0xf428('0x75'));}break;case _0xf428('0x3a'):var _0x1005be=parseInt(_0x33bee9);_0x33bee9=_[_0xf428('0x76')](_0x1005be)||_0x1005be<0x0||_0x1005be>0x4?_0x2e47a3?0x3:0x2:_0x1005be;_0xdddb4a[_0xf428('0x1d')]('\x22'+_0x33bee9+'\x22');break;case _0xf428('0x77'):var _0x119cfb=parseInt(_0x33bee9);if(_['isNumber'](_0x119cfb)&&_[_0xf428('0x78')](_0x13c6b5,_0x119cfb)){_0xdddb4a['push']('\x22'+_0x119cfb+'\x22');}else{_0x54cbbd[_0xf428('0x1d')](_0xf428('0x79'));}break;case'email':if(isEmail(_0x33bee9)){_0xdddb4a['push']('\x22'+_0x33bee9+'\x22');}else{_0x54cbbd[_0xf428('0x1d')](_0xf428('0x7a'));}break;case _0xf428('0x7b'):var _0x4566f8=moment(_0x33bee9,'YYYY-MM-DD',!![]);if(_0x4566f8[_0xf428('0x7c')]()){_0xdddb4a[_0xf428('0x1d')]('\x22'+_0x33bee9+'\x22');}else{_0x54cbbd[_0xf428('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xdddb4a[_0xf428('0x1d')]('\x22'+_0x33bee9+'\x22');}}else{switch(_0x57fd2b){case'firstName':case _0xf428('0x13'):_0x54cbbd[_0xf428('0x1d')](_0x57fd2b+_0xf428('0x7d'));break;default:_0xdddb4a[_0xf428('0x1d')]('\x22\x22');}}}}else{var _0x29f32f='';for(var _0x2466f3=0x0;_0x2466f3<_0x46e16c[_0x57fd2b][_0xf428('0x22')];_0x2466f3++){var _0x33bee9=_[_0xf428('0x7e')](_0x177c48['data'][_0x3127c8][_0x46e16c[_0x57fd2b][_0x2466f3]][_0xf428('0x7f')](/"/g,'\x27'));if(_0x29f32f=='')_0x29f32f=_0x33bee9;else _0x29f32f+='|'+_0x33bee9;}_0x1ff594[_0xf428('0x1d')](_0x56d1d4['id']+':'+_0x29f32f);}}if(hasAdditionalPhones){_0xdddb4a['push']('\x22'+_0x1ff594['join'](';')+'\x22');}if(_0x54cbbd['length']){handleError(_0x177c48[_0xf428('0x72')][_0x3127c8],{'code':_0xf428('0x80'),'message':_0x54cbbd[_0xf428('0x15')]()});}else{fs[_0xf428('0x81')](_0x526edd,_0xdddb4a[_0xf428('0x15')]()+'\x0a');}_0xdddb4a=[];}if(!(stats[_0xf428('0x73')]%0xc8)){socket[_0xf428('0x82')](_0xf428('0x83')+_0x1f2a8d,stats);stats[_0xf428('0x5e')]=[];}}if(stopped){logger['info'](_0xf428('0x84'));_0x2e44bd['abort']();}}catch(_0x1e2d43){handleError(_0x177c48[_0xf428('0x72')][_0x3127c8],{'code':_0xf428('0x85'),'message':_0x1e2d43[_0xf428('0x20')]});logger[_0xf428('0x1f')](_0xf428('0x86'),_0x1e2d43[_0xf428('0x20')]);}},'complete':function(){try{var _0x222ad4=[];var _0x18f161=tempTableName;_0x222ad4[_0xf428('0x1d')](_0xf428('0x87')+_0x18f161+_0xf428('0x88'));logger[_0xf428('0x5b')](_0xf428('0x89'),contactItemTypes[_0xf428('0x22')]);var _0x5eda05=util[_0xf428('0xd')](_0xf428('0x8a'),_0x526edd,_0x18f161,_0x1fea89,_0x43d73c['ListId'],_0x43d73c[_0xf428('0x55')]||null,NOW,NOW);if(_[_0xf428('0x1b')](_0x46e16c['scheduledat'])){_0x5eda05+=_0xf428('0x8b');}_0x222ad4['push'](_0x5eda05);BPromise[_0xf428('0x8c')](_0x222ad4,handleQuery)['then'](function(_0x55cba2){BPromise[_0xf428('0x23')]([handleAdditionalPhones()])[_0xf428('0x1e')](function(){_0x222ad4=[];for(var _0x195753=0x0;_0x195753=_0x4a6349){return _0xef659f[_0xfc6c('0x12')](0x193)['json']({'message':util[_0xfc6c('0x13')](_0xfc6c('0x14'),_0x4cb18d)});}_0x2d6825();})[_0xfc6c('0x15')](function(_0x1a992a){_0x2d6825(_0x1a992a);});});}function isUserLimit(){return isLimit(_0xfc6c('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0xfc6c('0x17')},{'role':'user'}]}});}exports[_0xfc6c('0x18')]=isUserLimit; \ No newline at end of file +var _0xcb12=['User','admin','user','isUserLimit','crypto','util','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','use','License','findOne','then','count','status','json','users'];(function(_0x4a8812,_0x430080){var _0x55a784=function(_0x4b25cf){while(--_0x4b25cf){_0x4a8812['push'](_0x4a8812['shift']());}};_0x55a784(++_0x430080);}(_0xcb12,0xf4));var _0x2cb1=function(_0x1a90d9,_0x54cd18){_0x1a90d9=_0x1a90d9-0x0;var _0x55a17d=_0xcb12[_0x1a90d9];return _0x55a17d;};'use strict';var crypto=require(_0x2cb1('0x0'));var util=require(_0x2cb1('0x1'));var compose=require('composable-middleware');var db=require(_0x2cb1('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x403379,_0x1ee080){if(_0x403379&&_0x1ee080){if(_0x1ee080[_0x2cb1('0x3')]&&_0x1ee080['license']){var _0x4a2777=_0x1ee080[_0x2cb1('0x3')];var _0x4b437b=_0x1ee080[_0x2cb1('0x4')];var _0x407292=_0x4a2777['split']('-')[0x4];var _0x234deb=_0x4a2777[_0x2cb1('0x5')]('-')[0x0];var _0x36b988=crypto[_0x2cb1('0x6')](_0x2cb1('0x7'),util[_0x2cb1('0x8')]('%s:%s:%s',_0x407292,_0x4a2777,_0x234deb));var _0x2ef81e=_0x36b988[_0x2cb1('0x9')](_0x4b437b,_0x2cb1('0xa'),_0x2cb1('0xb'));_0x2ef81e+=_0x36b988['final'](_0x2cb1('0xb'));var _0x438019=JSON['parse'](_0x2ef81e);return _0x438019['hasOwnProperty'](_0x403379)?_0x438019[_0x403379]:null;}}return null;}function isLimit(_0x24294c,_0x2a45cb,_0x30b0a4,_0x4df0db){var _0x5daf22=_0x2a45cb;return compose()[_0x2cb1('0xc')](function(_0x3219e7,_0x1fc485,_0x35a620){return db[_0x2cb1('0xd')][_0x2cb1('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x2cb1('0xf')](function(_0x1bef04){var _0x3340d2=getValueFromLicense(_0x24294c,_0x1bef04);return _0x3340d2?_0x3340d2:_0x5daf22;})[_0x2cb1('0xf')](function(_0x3bf21d){_0x5daf22=_0x3bf21d;return _0x30b0a4[_0x2cb1('0x10')](_0x4df0db);})[_0x2cb1('0xf')](function(_0x36d0f3){if(_0x36d0f3>=_0x5daf22){return _0x1fc485[_0x2cb1('0x11')](0x193)[_0x2cb1('0x12')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x24294c)});}_0x35a620();})['catch'](function(_0x4de19a){_0x35a620(_0x4de19a);});});}function isUserLimit(){return isLimit(_0x2cb1('0x13'),0x1,db[_0x2cb1('0x14')],{'where':{'$or':[{'role':_0x2cb1('0x15')},{'role':_0x2cb1('0x16')}]}});}exports[_0x2cb1('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 485b846..14590f1 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 _0x3175=['operator','$eq','value','includes','$gt','$lte','days','format','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','shift','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','and','replace','[$or]','split','length','slice','forEach','indexOf','conditions','push','DATE'];(function(_0x532382,_0x42949f){var _0x2f7b66=function(_0xf73c69){while(--_0xf73c69){_0x532382['push'](_0x532382['shift']());}};_0x2f7b66(++_0x42949f);}(_0x3175,0xb1));var _0x5317=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x3175[_0x11946c];return _0x383935;};'use strict';var _=require(_0x5317('0x0'));var moment=require(_0x5317('0x1'));exports[_0x5317('0x2')]=function(_0x158950){var _0x5b708a={'conditions':[]};_0x5b708a[_0x5317('0x3')]=_['startsWith'](_0x158950,'[$or]')?'or':_0x5317('0x4');var _0x3187ab=_0x158950['replace']('[$and]','')[_0x5317('0x5')](_0x5317('0x6'),'')[_0x5317('0x7')]('||');for(var _0x768d70=0x0;_0x768d70<_0x3187ab[_0x5317('0x8')];_0x768d70++){var _0x36e185=_0x3187ab[_0x768d70][_0x5317('0x7')](':=');var _0x4f2193=_0x36e185[0x0];var _0x220397=_0x36e185[_0x5317('0x9')](0x1);_0x220397[_0x5317('0xa')](function(_0xc68645){var _0x3f0277=_0xc68645['split']('[')['shift']();var _0x122706=_0xc68645['match'](/\[(.*?)\]/g);_0x122706[_0x5317('0xa')](function(_0x3773c6){var _0x3bd706=_0x3773c6[_0x5317('0x7')]('[')['filter'](function(_0x252f4f){return _0x252f4f[_0x5317('0xb')](']')>-0x1;})['map'](function(_0x267087){return _0x267087[_0x5317('0x7')](']')[0x0];})[0x0];_0x5b708a[_0x5317('0xc')][_0x5317('0xd')]({'field':_0x4f2193,'operator':_0x3f0277,'value':_0x3bd706});});});}return _0x5b708a;};exports['buildExpression']=function(_0x16b299,_0x4c40ad,_0x24c1b){var _0x2bc039={};if(_0x4c40ad===_0x5317('0xe')){if(_0x24c1b[_0x5317('0xf')]===_0x5317('0x10')){_0x24c1b['operator']='$between';_0x24c1b[_0x5317('0x11')]+=','+_0x24c1b[_0x5317('0x11')];}else if(_[_0x5317('0x12')]([_0x5317('0x13'),_0x5317('0x14')],_0x24c1b[_0x5317('0xf')])){_0x24c1b[_0x5317('0x11')]=moment(_0x24c1b[_0x5317('0x11')])['add'](0x1,_0x5317('0x15'))[_0x5317('0x16')]('YYYY-MM-DD');}}if(_0x24c1b[_0x5317('0x17')]){_0x4c40ad=_0x24c1b['castTo'];_0x2bc039['text']='CAST('+_0x16b299+'.'+_0x24c1b[_0x5317('0x18')]+_0x5317('0x19')+_0x24c1b[_0x5317('0x17')]+')\x20'+parseOperator(_0x24c1b[_0x5317('0xf')]);}else{_0x2bc039['text']=_0x16b299+'.'+_0x24c1b[_0x5317('0x18')]+'\x20'+parseOperator(_0x24c1b['operator']);}if(_[_0x5317('0x12')]([_0x5317('0x1a'),_0x5317('0x1b')],_0x24c1b[_0x5317('0xf')]))_0x2bc039[_0x5317('0x1c')]='('+_0x2bc039['text']+'\x20OR\x20'+_0x16b299+'.'+_0x24c1b[_0x5317('0x18')]+_0x5317('0x1d');_0x2bc039[_0x5317('0x11')]=parseValue(_0x4c40ad,_0x24c1b['operator'],_0x24c1b['value']);return _0x2bc039;};function parseOperator(_0x6a342e){var _0x2d78a5;switch(_0x6a342e){case'$in':_0x2d78a5=_0x5317('0x1e');break;case _0x5317('0x1b'):_0x2d78a5='NOT\x20IN\x20?';break;case _0x5317('0x10'):_0x2d78a5=_0x5317('0x1f');break;case _0x5317('0x1a'):_0x2d78a5=_0x5317('0x20');break;case _0x5317('0x21'):case'$startsWith':case _0x5317('0x22'):_0x2d78a5=_0x5317('0x23');break;case _0x5317('0x24'):_0x2d78a5=_0x5317('0x25');break;case _0x5317('0x13'):_0x2d78a5='>\x20?';break;case _0x5317('0x14'):_0x2d78a5='<=\x20?';break;case _0x5317('0x26'):_0x2d78a5=_0x5317('0x27');break;case'$between':_0x2d78a5=_0x5317('0x28');break;}return _0x2d78a5;}function parseValue(_0x25faea,_0x4e85ba,_0x28ea09){var _0x12d622={'start':undefined,'end':undefined};switch(_0x4e85ba){case'$in':case _0x5317('0x1b'):_0x12d622[_0x5317('0x29')]=_0x28ea09[_0x5317('0x7')](',');break;case _0x5317('0x21'):_0x12d622[_0x5317('0x29')]='%'+_0x28ea09+'%';break;case _0x5317('0x2a'):_0x12d622[_0x5317('0x29')]=_0x28ea09+'%';break;case _0x5317('0x22'):_0x12d622[_0x5317('0x29')]='%'+_0x28ea09;break;case'$between':var _0x2903f4=_0x28ea09['split'](',');var _0x28ea09=_0x2903f4[_0x5317('0x2b')]();var _0x2f3401=_0x2903f4['pop']();if(_0x25faea==='DATE'){_0x28ea09=moment(_0x28ea09)[_0x5317('0x2c')](0x0,!![])[_0x5317('0x16')]();_0x2f3401=moment(_0x2f3401)[_0x5317('0x2c')](0x0,!![])[_0x5317('0x2d')](0x17,'hours')['add'](0x3b,_0x5317('0x2e'))[_0x5317('0x2d')](0x3b,_0x5317('0x2f'))[_0x5317('0x16')]();}_0x12d622={'start':_0x28ea09,'end':_0x2f3401};break;default:_0x12d622[_0x5317('0x29')]=_0x28ea09;break;}return _0x12d622;} \ No newline at end of file +var _0xfa7d=['[$or]','and','replace','split','forEach','shift','match','indexOf','map','conditions','buildExpression','DATE','$eq','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','\x20AS\x20','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator'];(function(_0x29ac5d,_0x3df3e0){var _0xef6f60=function(_0x4cdf74){while(--_0x4cdf74){_0x29ac5d['push'](_0x29ac5d['shift']());}};_0xef6f60(++_0x3df3e0);}(_0xfa7d,0x146));var _0xdfa7=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xfa7d[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xdfa7('0x0'));var moment=require(_0xdfa7('0x1'));exports[_0xdfa7('0x2')]=function(_0x1c7c3f){var _0x52f9ae={'conditions':[]};_0x52f9ae[_0xdfa7('0x3')]=_['startsWith'](_0x1c7c3f,_0xdfa7('0x4'))?'or':_0xdfa7('0x5');var _0x250bc1=_0x1c7c3f[_0xdfa7('0x6')]('[$and]','')[_0xdfa7('0x6')](_0xdfa7('0x4'),'')[_0xdfa7('0x7')]('||');for(var _0x51df9f=0x0;_0x51df9f<_0x250bc1['length'];_0x51df9f++){var _0x4ccdbb=_0x250bc1[_0x51df9f]['split'](':=');var _0x3afce7=_0x4ccdbb[0x0];var _0x40e4ce=_0x4ccdbb['slice'](0x1);_0x40e4ce[_0xdfa7('0x8')](function(_0x3cf5b0){var _0x4bb050=_0x3cf5b0[_0xdfa7('0x7')]('[')[_0xdfa7('0x9')]();var _0x5241ba=_0x3cf5b0[_0xdfa7('0xa')](/\[(.*?)\]/g);_0x5241ba[_0xdfa7('0x8')](function(_0x1e631d){var _0x1c5914=_0x1e631d[_0xdfa7('0x7')]('[')['filter'](function(_0x307618){return _0x307618[_0xdfa7('0xb')](']')>-0x1;})[_0xdfa7('0xc')](function(_0x29a77b){return _0x29a77b[_0xdfa7('0x7')](']')[0x0];})[0x0];_0x52f9ae[_0xdfa7('0xd')]['push']({'field':_0x3afce7,'operator':_0x4bb050,'value':_0x1c5914});});});}return _0x52f9ae;};exports[_0xdfa7('0xe')]=function(_0x2dc8eb,_0x52d8ff,_0x42a169){var _0x3f0c40={};if(_0x52d8ff===_0xdfa7('0xf')){if(_0x42a169['operator']===_0xdfa7('0x10')){_0x42a169[_0xdfa7('0x11')]=_0xdfa7('0x12');_0x42a169[_0xdfa7('0x13')]+=','+_0x42a169[_0xdfa7('0x13')];}else if(_[_0xdfa7('0x14')](['$gt',_0xdfa7('0x15')],_0x42a169[_0xdfa7('0x11')])){_0x42a169['value']=moment(_0x42a169[_0xdfa7('0x13')])[_0xdfa7('0x16')](0x1,_0xdfa7('0x17'))[_0xdfa7('0x18')](_0xdfa7('0x19'));}}if(_0x42a169[_0xdfa7('0x1a')]){_0x52d8ff=_0x42a169[_0xdfa7('0x1a')];_0x3f0c40['text']='CAST('+_0x2dc8eb+'.'+_0x42a169['field']+_0xdfa7('0x1b')+_0x42a169[_0xdfa7('0x1a')]+')\x20'+parseOperator(_0x42a169[_0xdfa7('0x11')]);}else{_0x3f0c40[_0xdfa7('0x1c')]=_0x2dc8eb+'.'+_0x42a169[_0xdfa7('0x1d')]+'\x20'+parseOperator(_0x42a169[_0xdfa7('0x11')]);}if(_[_0xdfa7('0x14')]([_0xdfa7('0x1e'),_0xdfa7('0x1f')],_0x42a169[_0xdfa7('0x11')]))_0x3f0c40[_0xdfa7('0x1c')]='('+_0x3f0c40['text']+_0xdfa7('0x20')+_0x2dc8eb+'.'+_0x42a169[_0xdfa7('0x1d')]+_0xdfa7('0x21');_0x3f0c40[_0xdfa7('0x13')]=parseValue(_0x52d8ff,_0x42a169[_0xdfa7('0x11')],_0x42a169[_0xdfa7('0x13')]);return _0x3f0c40;};function parseOperator(_0x4418f4){var _0x3923de;switch(_0x4418f4){case _0xdfa7('0x22'):_0x3923de=_0xdfa7('0x23');break;case _0xdfa7('0x1f'):_0x3923de=_0xdfa7('0x24');break;case'$eq':_0x3923de=_0xdfa7('0x25');break;case'$ne':_0x3923de='<>\x20?';break;case _0xdfa7('0x26'):case _0xdfa7('0x27'):case _0xdfa7('0x28'):_0x3923de=_0xdfa7('0x29');break;case _0xdfa7('0x2a'):_0x3923de=_0xdfa7('0x2b');break;case _0xdfa7('0x2c'):_0x3923de=_0xdfa7('0x2d');break;case _0xdfa7('0x15'):_0x3923de=_0xdfa7('0x2e');break;case _0xdfa7('0x2f'):_0x3923de=_0xdfa7('0x30');break;case _0xdfa7('0x12'):_0x3923de=_0xdfa7('0x31');break;}return _0x3923de;}function parseValue(_0x1a4eb4,_0x256184,_0x17d713){var _0x251ceb={'start':undefined,'end':undefined};switch(_0x256184){case _0xdfa7('0x22'):case _0xdfa7('0x1f'):_0x251ceb['start']=_0x17d713['split'](',');break;case _0xdfa7('0x26'):_0x251ceb[_0xdfa7('0x32')]='%'+_0x17d713+'%';break;case _0xdfa7('0x27'):_0x251ceb[_0xdfa7('0x32')]=_0x17d713+'%';break;case _0xdfa7('0x28'):_0x251ceb[_0xdfa7('0x32')]='%'+_0x17d713;break;case _0xdfa7('0x12'):var _0x213baa=_0x17d713[_0xdfa7('0x7')](',');var _0x17d713=_0x213baa[_0xdfa7('0x9')]();var _0x563433=_0x213baa['pop']();if(_0x1a4eb4===_0xdfa7('0xf')){_0x17d713=moment(_0x17d713)['utcOffset'](0x0,!![])[_0xdfa7('0x18')]();_0x563433=moment(_0x563433)[_0xdfa7('0x33')](0x0,!![])[_0xdfa7('0x16')](0x17,_0xdfa7('0x34'))[_0xdfa7('0x16')](0x3b,_0xdfa7('0x35'))[_0xdfa7('0x16')](0x3b,_0xdfa7('0x36'))[_0xdfa7('0x18')]();}_0x251ceb={'start':_0x17d713,'end':_0x563433};break;default:_0x251ceb[_0xdfa7('0x32')]=_0x17d713;break;}return _0x251ceb;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4df8293..8c03d7d 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 _0xec53=['utc','subtract','isArray','split','limit','map','priority','cast','col','unsigned','substr','ASC','omit','length','unset','isNumeric','^[0-9]*$','isEmail','forEach','toString','join','moment','filters','isEmpty','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','$lte'];(function(_0xa7991d,_0x32459c){var _0x459970=function(_0x5f536f){while(--_0x5f536f){_0xa7991d['push'](_0xa7991d['shift']());}};_0x459970(++_0x32459c);}(_0xec53,0x1e6));var _0x3ec5=function(_0x5f348b,_0x2b45ab){_0x5f348b=_0x5f348b-0x0;var _0x2ed87b=_0xec53[_0x5f348b];return _0x2ed87b;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x3ec5('0x0'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x1df5b8){var _0x440e6f=null;if(_0x1df5b8){_0x440e6f=_0x1df5b8['split'](',');}return _0x440e6f;};exports[_0x3ec5('0x1')]=function(_0x45da39,_0x4ecbe4){var _0x12b1b0={};if(!_[_0x3ec5('0x2')](_0x45da39)){_['forOwn'](_0x45da39,function(_0x4c4448,_0x5013bd){try{if(_0x4ecbe4){var _0x540d8c=_['find'](_0x4ecbe4,{'name':_0x5013bd})||{};if(_0x540d8c[_0x3ec5('0x3')]===_0x3ec5('0x4')&&_[_0x3ec5('0x5')](_0x4c4448)){var _0x1807e9=JSON[_0x3ec5('0x6')](_0x4c4448);var _0x10a7ca={'$gte':moment(moment(_0x1807e9['$gte'])[_0x3ec5('0x7')](_0x3ec5('0x8')))['utc']()[_0x3ec5('0x7')](),'$lte':moment(moment(_0x1807e9[_0x3ec5('0x9')])[_0x3ec5('0x7')](_0x3ec5('0x8')))[_0x3ec5('0xa')]()[_0x3ec5('0xb')](0x1,'s')[_0x3ec5('0x7')]()};_0x12b1b0[_0x5013bd]=_0x10a7ca;}else{_0x12b1b0[_0x5013bd]=_[_0x3ec5('0xc')](_0x4c4448)?_0x4c4448:JSON[_0x3ec5('0x6')](_0x4c4448);}}else{_0x12b1b0[_0x5013bd]=_[_0x3ec5('0xc')](_0x4c4448)?_0x4c4448:JSON[_0x3ec5('0x6')](_0x4c4448);}}catch(_0x52e0c4){_0x12b1b0[_0x5013bd]=_0x4c4448[_0x3ec5('0xd')](',');}});}return _0x12b1b0;};exports[_0x3ec5('0xe')]=function(_0x81c785){_0x81c785=parseInt(_0x81c785,0xa);if(!_0x81c785||_0x81c785<0x0){_0x81c785=LIMIT_VALUE;}return _0x81c785;};exports['offset']=function(_0x5cf63f){_0x5cf63f=parseInt(_0x5cf63f,0xa);if(!_0x5cf63f||_0x5cf63f<0x0){_0x5cf63f=0x0;}return _0x5cf63f;};exports['sort']=function(_0x1fcba4){var _0x582b99,_0x285eec=null;if(_0x1fcba4){_0x582b99=_0x1fcba4[_0x3ec5('0xd')](',');_0x285eec=_[_0x3ec5('0xf')](_0x582b99,function(_0x19bfd7){if(_0x19bfd7['indexOf']('-')===0x0){return[_0x19bfd7===_0x3ec5('0x10')?sequelize[_0x3ec5('0x11')](sequelize[_0x3ec5('0x12')](_0x3ec5('0x10')),_0x3ec5('0x13')):_0x19bfd7[_0x3ec5('0x14')](0x1),'DESC'];}else{return[_0x19bfd7===_0x3ec5('0x10')?sequelize['cast'](sequelize[_0x3ec5('0x12')](_0x3ec5('0x10')),_0x3ec5('0x13')):_0x19bfd7,_0x3ec5('0x15')];}});}return _0x285eec;};exports[_0x3ec5('0x16')]=function(_0xfec2a7,_0x35f716){if(_['isEmpty'](_0xfec2a7)){return _0xfec2a7;}if(_[_0x3ec5('0xc')](_0xfec2a7)){for(var _0x5b895a=0x0;_0x5b895a<_0xfec2a7[_0x3ec5('0x17')];_0x5b895a+=0x1){_0xfec2a7[_0x5b895a]=this[_0x3ec5('0x16')](_0xfec2a7[_0x5b895a],_0x35f716);}return _0xfec2a7;}if(!_['isObject'](_0xfec2a7)){return _0xfec2a7;}if(_['isString'](_0x35f716)){_0x35f716=[_0x35f716];}if(!_[_0x3ec5('0xc')](_0x35f716)){return _0xfec2a7;}for(var _0x48fad6=0x0;_0x48fad6<_0x35f716[_0x3ec5('0x17')];_0x48fad6+=0x1){_[_0x3ec5('0x18')](_0xfec2a7,_0x35f716[_0x48fad6]);}for(var _0x34ac5c in _0xfec2a7){if(_0xfec2a7['hasOwnProperty'](_0x34ac5c)){_0xfec2a7[_0x34ac5c]=this[_0x3ec5('0x16')](_0xfec2a7[_0x34ac5c],_0x35f716);}}return _0xfec2a7;};exports[_0x3ec5('0x19')]=function(_0x5e6c89){return _0x5e6c89['match'](RegExp(_0x3ec5('0x1a')))?!![]:![];};exports[_0x3ec5('0x1b')]=function(_0x4bb7b4){return _0x4bb7b4['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1caac2){var _0x4e60ba=[];_0x1caac2['split']('\x20')[_0x3ec5('0x1c')](function(_0x2b266e){_0x4e60ba['push']('+'+_0x2b266e[_0x3ec5('0x1d')]()+'*');});return _0x4e60ba[_0x3ec5('0x1e')]('\x20');}; \ No newline at end of file +var _0xedd8=['find','type','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','unset','match','^[0-9]*$','isEmail','push','toString','lodash','sequelize','moment','fields','split','isEmpty','forOwn'];(function(_0x338e66,_0x35c501){var _0x292c1e=function(_0x169f76){while(--_0x169f76){_0x338e66['push'](_0x338e66['shift']());}};_0x292c1e(++_0x35c501);}(_0xedd8,0xb2));var _0x8edd=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0xedd8[_0x55d911];return _0x3104c2;};'use strict';var _=require(_0x8edd('0x0'));var sequelize=require(_0x8edd('0x1'));var moment=require(_0x8edd('0x2'));var LIMIT_VALUE=0xfa;exports[_0x8edd('0x3')]=function(_0x1fdaf0){var _0x54a8bc=null;if(_0x1fdaf0){_0x54a8bc=_0x1fdaf0[_0x8edd('0x4')](',');}return _0x54a8bc;};exports['filters']=function(_0x240a71,_0x25050e){var _0x2be6d2={};if(!_[_0x8edd('0x5')](_0x240a71)){_[_0x8edd('0x6')](_0x240a71,function(_0x2a921d,_0x47f073){try{if(_0x25050e){var _0xb80de6=_[_0x8edd('0x7')](_0x25050e,{'name':_0x47f073})||{};if(_0xb80de6[_0x8edd('0x8')]==='DATE'&&_[_0x8edd('0x9')](_0x2a921d)){var _0x303e92=JSON[_0x8edd('0xa')](_0x2a921d);var _0x535790={'$gte':moment(moment(_0x303e92['$gte'])[_0x8edd('0xb')](_0x8edd('0xc')))[_0x8edd('0xd')]()[_0x8edd('0xb')](),'$lte':moment(moment(_0x303e92[_0x8edd('0xe')])[_0x8edd('0xb')](_0x8edd('0xc')))[_0x8edd('0xd')]()['subtract'](0x1,'s')[_0x8edd('0xb')]()};_0x2be6d2[_0x47f073]=_0x535790;}else{_0x2be6d2[_0x47f073]=_[_0x8edd('0xf')](_0x2a921d)?_0x2a921d:JSON[_0x8edd('0xa')](_0x2a921d);}}else{_0x2be6d2[_0x47f073]=_['isArray'](_0x2a921d)?_0x2a921d:JSON[_0x8edd('0xa')](_0x2a921d);}}catch(_0x1601f9){_0x2be6d2[_0x47f073]=_0x2a921d[_0x8edd('0x4')](',');}});}return _0x2be6d2;};exports[_0x8edd('0x10')]=function(_0x450471){_0x450471=parseInt(_0x450471,0xa);if(!_0x450471||_0x450471<0x0){_0x450471=LIMIT_VALUE;}return _0x450471;};exports[_0x8edd('0x11')]=function(_0x5aaace){_0x5aaace=parseInt(_0x5aaace,0xa);if(!_0x5aaace||_0x5aaace<0x0){_0x5aaace=0x0;}return _0x5aaace;};exports[_0x8edd('0x12')]=function(_0x463fb1){var _0x261cd9,_0x11240b=null;if(_0x463fb1){_0x261cd9=_0x463fb1['split'](',');_0x11240b=_[_0x8edd('0x13')](_0x261cd9,function(_0x1b19cc){if(_0x1b19cc[_0x8edd('0x14')]('-')===0x0){return[_0x1b19cc===_0x8edd('0x15')?sequelize[_0x8edd('0x16')](sequelize[_0x8edd('0x17')](_0x8edd('0x15')),_0x8edd('0x18')):_0x1b19cc[_0x8edd('0x19')](0x1),'DESC'];}else{return[_0x1b19cc==='priority'?sequelize[_0x8edd('0x16')](sequelize['col'](_0x8edd('0x15')),_0x8edd('0x18')):_0x1b19cc,_0x8edd('0x1a')];}});}return _0x11240b;};exports[_0x8edd('0x1b')]=function(_0x375a9e,_0x566a84){if(_[_0x8edd('0x5')](_0x375a9e)){return _0x375a9e;}if(_[_0x8edd('0xf')](_0x375a9e)){for(var _0x3e2c98=0x0;_0x3e2c98<_0x375a9e[_0x8edd('0x1c')];_0x3e2c98+=0x1){_0x375a9e[_0x3e2c98]=this[_0x8edd('0x1b')](_0x375a9e[_0x3e2c98],_0x566a84);}return _0x375a9e;}if(!_[_0x8edd('0x1d')](_0x375a9e)){return _0x375a9e;}if(_[_0x8edd('0x1e')](_0x566a84)){_0x566a84=[_0x566a84];}if(!_[_0x8edd('0xf')](_0x566a84)){return _0x375a9e;}for(var _0x1130c3=0x0;_0x1130c3<_0x566a84[_0x8edd('0x1c')];_0x1130c3+=0x1){_[_0x8edd('0x1f')](_0x375a9e,_0x566a84[_0x1130c3]);}for(var _0x50ca3b in _0x375a9e){if(_0x375a9e['hasOwnProperty'](_0x50ca3b)){_0x375a9e[_0x50ca3b]=this[_0x8edd('0x1b')](_0x375a9e[_0x50ca3b],_0x566a84);}}return _0x375a9e;};exports['isNumeric']=function(_0x3708a9){return _0x3708a9[_0x8edd('0x20')](RegExp(_0x8edd('0x21')))?!![]:![];};exports[_0x8edd('0x22')]=function(_0x741fec){return _0x741fec['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4447f9){var _0x5ee816=[];_0x4447f9[_0x8edd('0x4')]('\x20')['forEach'](function(_0x890349){_0x5ee816[_0x8edd('0x23')]('+'+_0x890349[_0x8edd('0x24')]()+'*');});return _0x5ee816['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3928847..06234e5 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60d2=['initialize','express','serve-favicon','method-override','errorhandler','path','passport','cors','moment','./environment','default','get','env','production','set','appPath','join','root','public','development','use','json\x20replacer','toISOString','static','engine','html','renderFile','view\x20engine'];(function(_0x50e86a,_0x326c7){var _0x57d539=function(_0x1156db){while(--_0x1156db){_0x50e86a['push'](_0x50e86a['shift']());}};_0x57d539(++_0x326c7);}(_0x60d2,0xfd));var _0x260d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x60d2[_0x2070da];return _0x4f9fe1;};'use strict';var express=require(_0x260d('0x0'));var favicon=require(_0x260d('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x260d('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x260d('0x3'));var path=require(_0x260d('0x4'));var passport=require(_0x260d('0x5'));var cors=require(_0x260d('0x6'));var moment=require(_0x260d('0x7'));var config=require(_0x260d('0x8'));var db=require('../mysqldb')['db'];exports[_0x260d('0x9')]=function(_0x5bafe1){var _0x557594=_0x5bafe1[_0x260d('0xa')](_0x260d('0xb'));if(_0x557594===_0x260d('0xc')){_0x5bafe1[_0x260d('0xd')](_0x260d('0xe'),path[_0x260d('0xf')](config[_0x260d('0x10')],_0x260d('0x11')));}if(_0x557594===_0x260d('0x12')||_0x557594==='test'){_0x5bafe1[_0x260d('0xd')](_0x260d('0xe'),path[_0x260d('0xf')](config[_0x260d('0x10')],'client'));_0x5bafe1[_0x260d('0x13')](errorHandler());}_0x5bafe1[_0x260d('0xd')](_0x260d('0x14'),function(_0x3be784,_0x3c24c6){if(this[_0x3be784]instanceof Date){_0x3c24c6=this[_0x3be784][_0x260d('0x15')]()['split']('.')[0x0]+'Z';}return _0x3c24c6;});_0x5bafe1[_0x260d('0x13')](express[_0x260d('0x16')](_0x5bafe1['get']('appPath')));_0x5bafe1['set']('views',config[_0x260d('0x10')]+'/server/views');_0x5bafe1[_0x260d('0x17')](_0x260d('0x18'),require('ejs')[_0x260d('0x19')]);_0x5bafe1['set'](_0x260d('0x1a'),'html');_0x5bafe1[_0x260d('0x13')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x5bafe1[_0x260d('0x13')](bodyParser['json']({'limit':'50mb'}));_0x5bafe1[_0x260d('0x13')](cors());_0x5bafe1[_0x260d('0x13')](methodOverride());_0x5bafe1['use'](cookieParser());_0x5bafe1['use'](passport[_0x260d('0x1b')]());}; \ No newline at end of file +var _0x8f49=['50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','cors','moment','./environment','default','get','env','production','set','appPath','join','public','development','test','root','client','use','json\x20replacer','toISOString','split','views','/server/views','ejs','renderFile','view\x20engine','urlencoded'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x8f49,0x1df));var _0x98f4=function(_0x2482c0,_0x2caade){_0x2482c0=_0x2482c0-0x0;var _0x4eb983=_0x8f49[_0x2482c0];return _0x4eb983;};'use strict';var express=require(_0x98f4('0x0'));var favicon=require(_0x98f4('0x1'));var bodyParser=require(_0x98f4('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x98f4('0x3'));var errorHandler=require(_0x98f4('0x4'));var path=require(_0x98f4('0x5'));var passport=require('passport');var cors=require(_0x98f4('0x6'));var moment=require(_0x98f4('0x7'));var config=require(_0x98f4('0x8'));var db=require('../mysqldb')['db'];exports[_0x98f4('0x9')]=function(_0x3d614a){var _0x59d7b6=_0x3d614a[_0x98f4('0xa')](_0x98f4('0xb'));if(_0x59d7b6===_0x98f4('0xc')){_0x3d614a[_0x98f4('0xd')](_0x98f4('0xe'),path[_0x98f4('0xf')](config['root'],_0x98f4('0x10')));}if(_0x59d7b6===_0x98f4('0x11')||_0x59d7b6===_0x98f4('0x12')){_0x3d614a[_0x98f4('0xd')](_0x98f4('0xe'),path[_0x98f4('0xf')](config[_0x98f4('0x13')],_0x98f4('0x14')));_0x3d614a[_0x98f4('0x15')](errorHandler());}_0x3d614a[_0x98f4('0xd')](_0x98f4('0x16'),function(_0x23c294,_0x170d40){if(this[_0x23c294]instanceof Date){_0x170d40=this[_0x23c294][_0x98f4('0x17')]()[_0x98f4('0x18')]('.')[0x0]+'Z';}return _0x170d40;});_0x3d614a['use'](express['static'](_0x3d614a[_0x98f4('0xa')](_0x98f4('0xe'))));_0x3d614a[_0x98f4('0xd')](_0x98f4('0x19'),config[_0x98f4('0x13')]+_0x98f4('0x1a'));_0x3d614a['engine']('html',require(_0x98f4('0x1b'))[_0x98f4('0x1c')]);_0x3d614a[_0x98f4('0xd')](_0x98f4('0x1d'),'html');_0x3d614a[_0x98f4('0x15')](bodyParser[_0x98f4('0x1e')]({'limit':_0x98f4('0x1f'),'extended':!![]}));_0x3d614a['use'](bodyParser[_0x98f4('0x20')]({'limit':_0x98f4('0x1f')}));_0x3d614a['use'](cors());_0x3d614a[_0x98f4('0x15')](methodOverride());_0x3d614a[_0x98f4('0x15')](cookieParser());_0x3d614a[_0x98f4('0x15')](passport[_0x98f4('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7908b88..73aa932 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 _0x24ca=['update','digest','hex','getUuid','platform','win32','replace','hostname','macAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','md5'];(function(_0x3f68eb,_0x5968de){var _0x5b5604=function(_0xb496a9){while(--_0xb496a9){_0x3f68eb['push'](_0x3f68eb['shift']());}};_0x5b5604(++_0x5968de);}(_0x24ca,0x1bc));var _0xa24c=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0x24ca[_0x258b93];return _0x35484b;};'use strict';var _=require(_0xa24c('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xa24c('0x1'));var exec=require(_0xa24c('0x2'))[_0xa24c('0x3')];function getInterfaces(){var _0x5876d6=[];var _0x18497e=os[_0xa24c('0x4')]();var _0x195e60=_[_0xa24c('0x5')](_[_0xa24c('0x6')](_0x18497e));for(var _0x15a5cd=0x0;_0x15a5cd<_0x195e60[_0xa24c('0x7')];_0x15a5cd++){var _0x3c0aaa=_0x18497e[_0x195e60[_0x15a5cd]][_0xa24c('0x8')](function(_0x257264){return _0x257264[_0xa24c('0x9')]==='IPv4'&&_0x257264[_0xa24c('0xa')]===![];});_0x5876d6=_0x5876d6[_0xa24c('0xb')](_0x3c0aaa);}return _0x5876d6;}function getFirstInterface(){var _0x2d645c=_['head'](getInterfaces());return{'macAddress':_0x2d645c&&_0x2d645c[_0xa24c('0xc')]?_0x2d645c[_0xa24c('0xc')]:_0xa24c('0xd'),'ipAddress':_0x2d645c&&_0x2d645c[_0xa24c('0xe')]?_0x2d645c[_0xa24c('0xe')]:_0xa24c('0xf')};}exports[_0xa24c('0x10')]=getFirstInterface;function getCPUhash(){var _0xc82af0=_[_0xa24c('0x5')](os['cpus']()[_0xa24c('0x11')](function(_0x11090c){return _0x11090c[_0xa24c('0x12')];}))[_0xa24c('0x13')](':');return crypto['createHash'](_0xa24c('0x14'))[_0xa24c('0x15')](_0xc82af0)[_0xa24c('0x16')](_0xa24c('0x17'));}exports[_0xa24c('0x18')]=function(){switch(os[_0xa24c('0x19')]()){case _0xa24c('0x1a'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xa24c('0x1b')]('\x0d\x0a','');default:var _0x87aa90=getFirstInterface();var _0x49ce53=getCPUhash();var _0x5babb5=_0x49ce53+'|'+os[_0xa24c('0x1c')]()+'|'+_0x87aa90[_0xa24c('0x1d')]+'|'+_0x87aa90['ipAddress'];var _0x2a64ff=crypto['createHash'](_0xa24c('0x14'))[_0xa24c('0x15')](_0x5babb5)[_0xa24c('0x16')](_0xa24c('0x17'));return _0x2a64ff['substring'](0x0,0x8)+'-'+_0x2a64ff[_0xa24c('0x1e')](0x8,0xc)+'-'+_0x2a64ff[_0xa24c('0x1e')](0xc,0x10)+'-'+_0x2a64ff[_0xa24c('0x1e')](0x10,0x14)+'-'+_0x2a64ff['substring'](0x14);}}; \ No newline at end of file +var _0x394e=['127.0.0.1','getFirstInterface','cpus','map','md5','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','digest','substring','lodash','crypto','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','mac','00:00:00:00:00:00','address'];(function(_0x24ad48,_0x31c1d6){var _0x6b5cc1=function(_0x597f57){while(--_0x597f57){_0x24ad48['push'](_0x24ad48['shift']());}};_0x6b5cc1(++_0x31c1d6);}(_0x394e,0x88));var _0xe394=function(_0xb3a764,_0x22fdc0){_0xb3a764=_0xb3a764-0x0;var _0x2de877=_0x394e[_0xb3a764];return _0x2de877;};'use strict';var _=require(_0xe394('0x0'));var os=require('os');var crypto=require(_0xe394('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xe394('0x2'))[_0xe394('0x3')];function getInterfaces(){var _0x373028=[];var _0x1a96cc=os['networkInterfaces']();var _0x4269f4=_[_0xe394('0x4')](_[_0xe394('0x5')](_0x1a96cc));for(var _0x322cd4=0x0;_0x322cd4<_0x4269f4[_0xe394('0x6')];_0x322cd4++){var _0x272c30=_0x1a96cc[_0x4269f4[_0x322cd4]][_0xe394('0x7')](function(_0x169910){return _0x169910[_0xe394('0x8')]===_0xe394('0x9')&&_0x169910[_0xe394('0xa')]===![];});_0x373028=_0x373028['concat'](_0x272c30);}return _0x373028;}function getFirstInterface(){var _0x50c6c1=_['head'](getInterfaces());return{'macAddress':_0x50c6c1&&_0x50c6c1[_0xe394('0xb')]?_0x50c6c1[_0xe394('0xb')]:_0xe394('0xc'),'ipAddress':_0x50c6c1&&_0x50c6c1[_0xe394('0xd')]?_0x50c6c1[_0xe394('0xd')]:_0xe394('0xe')};}exports[_0xe394('0xf')]=getFirstInterface;function getCPUhash(){var _0x4706bb=_[_0xe394('0x4')](os[_0xe394('0x10')]()[_0xe394('0x11')](function(_0x383e2c){return _0x383e2c['model'];}))['join'](':');return crypto['createHash'](_0xe394('0x12'))[_0xe394('0x13')](_0x4706bb)['digest'](_0xe394('0x14'));}exports[_0xe394('0x15')]=function(){switch(os[_0xe394('0x16')]()){case _0xe394('0x17'):return exec(_0xe394('0x18'),{'encoding':_0xe394('0x19')})['replace']('\x0d\x0a','');default:var _0x47afc4=getFirstInterface();var _0x1b8777=getCPUhash();var _0x3196d0=_0x1b8777+'|'+os[_0xe394('0x1a')]()+'|'+_0x47afc4[_0xe394('0x1b')]+'|'+_0x47afc4['ipAddress'];var _0x507392=crypto['createHash'](_0xe394('0x12'))[_0xe394('0x13')](_0x3196d0)[_0xe394('0x1c')]('hex');return _0x507392[_0xe394('0x1d')](0x0,0x8)+'-'+_0x507392[_0xe394('0x1d')](0x8,0xc)+'-'+_0x507392[_0xe394('0x1d')](0xc,0x10)+'-'+_0x507392['substring'](0x10,0x14)+'-'+_0x507392[_0xe394('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7d7c988..d129451 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 _0xb470=['request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','GET','then','catch','secrets','update','base64','final','createDecipher','aes-256-ctr','session','utf8','User','findOne','fullname','|reason|','|uuid|','|machineUuid|','|name|','|email|','email','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment'];(function(_0x110e2a,_0x346f85){var _0x189aec=function(_0x51804c){while(--_0x51804c){_0x110e2a['push'](_0x110e2a['shift']());}};_0x189aec(++_0x346f85);}(_0xb470,0x75));var _0x0b47=function(_0x3ccc43,_0xe4e1b3){_0x3ccc43=_0x3ccc43-0x0;var _0x5e6b38=_0xb470[_0x3ccc43];return _0x5e6b38;};'use strict';var util=require(_0x0b47('0x0'));var crypto=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var rp=require(_0x0b47('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x0b47('0x4'))(module,_0x0b47('0x5'));var db=require(_0x0b47('0x6'))['db'];var config=require('../environment');var hardware=require(_0x0b47('0x7'));var logger=require(_0x0b47('0x8'))(_0x0b47('0x9'));var jira=require(_0x0b47('0xa'));var HOST=_0x0b47('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x23d960){return new BPromise(function(_0x201ab2,_0x37eb18){var _0x4bfebf=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x23d960,module['exports'][_0x0b47('0x5')]);if(oldToken){_0x4bfebf=util[_0x0b47('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x23d960,module[_0x0b47('0xd')][_0x0b47('0x5')],oldToken);}var _0x243f01={'uri':_0x4bfebf,'method':_0x0b47('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x243f01)[_0x0b47('0xf')](function(_0x26036){_0x201ab2(_0x26036);})[_0x0b47('0x10')](function(_0x457146){_0x37eb18(_0x457146);});});}function encryptDate(_0x58b8d){var _0x3d8949=crypto['createCipher']('aes-256-ctr',config[_0x0b47('0x11')]['session']);var _0x1e58a5=_0x3d8949[_0x0b47('0x12')](_0x58b8d,'utf8',_0x0b47('0x13'));_0x1e58a5+=_0x3d8949[_0x0b47('0x14')](_0x0b47('0x13'));return _0x1e58a5;}function decryptDate(_0x379c9d){var _0x387084=crypto[_0x0b47('0x15')](_0x0b47('0x16'),config[_0x0b47('0x11')][_0x0b47('0x17')]);var _0x1da847=_0x387084['update'](_0x379c9d,_0x0b47('0x13'),'utf8');_0x1da847+=_0x387084[_0x0b47('0x14')](_0x0b47('0x18'));return _0x1da847;}function sendJiraAlert(_0x2b1024,_0x478caa,_0x5cf426){var _0x5aee61='||FIELD||VALUE||\x0a';return db[_0x0b47('0x19')][_0x0b47('0x1a')]({'where':{'role':'admin'},'attributes':[_0x0b47('0x1b'),'email'],'raw':!![]})[_0x0b47('0xf')](function(_0x43e0e4){ADMIN=_0x43e0e4;_0x5aee61+=_0x0b47('0x1c')+_0x5cf426+'|\x0a';_0x5aee61+=_0x0b47('0x1d')+_0x2b1024+'|\x0a';_0x5aee61+=_0x0b47('0x1e')+_0x478caa+'|\x0a';_0x5aee61+=_0x0b47('0x1f')+ADMIN[_0x0b47('0x1b')]+'|\x0a';_0x5aee61+=_0x0b47('0x20')+ADMIN[_0x0b47('0x21')]+'|\x0a';return _0x5aee61;})[_0x0b47('0xf')](function(_0x3e37e8){var _0x4f79d4=hardware[_0x0b47('0x22')]()[_0x0b47('0x23')];return jira['openIssue']({'key':_0x0b47('0x24'),'summary':_0x0b47('0x25'),'description':_0x3e37e8,'issuetype':_0x0b47('0x26'),'oldToken':_0x2b1024,'newToken':_0x478caa,'email':ADMIN[_0x0b47('0x21')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x4f79d4});});}function manageLicense(_0x47d1b2,_0x375983){var _0x4228e5=_0x375983['get']({'plain':!![]});httpRequest(_0x47d1b2)[_0x0b47('0xf')](function(_0x4509fc){if(oldToken){oldToken=undefined;}if(_0x4509fc[_0x0b47('0x27')]){if(!_0x4228e5[_0x0b47('0x9')]&&_0x4228e5[_0x0b47('0x9')]!=_0x4509fc[_0x0b47('0x9')]||_0x4228e5[_0x0b47('0x9')]&&_0x4228e5[_0x0b47('0x28')]){logger[_0x0b47('0x29')](_0x0b47('0x2a'));}if(_0x4228e5[_0x0b47('0x9')]&&!_0x4228e5['data2']&&_0x4228e5['license']!=_0x4509fc[_0x0b47('0x9')]){logger['info'](_0x0b47('0x2b'));}if(_0x4228e5[_0x0b47('0x9')]&&!_0x4228e5[_0x0b47('0x28')]&&_0x4228e5[_0x0b47('0x9')]==_0x4509fc[_0x0b47('0x9')]){return _0x375983;}return _0x375983['update']({'data1':_0x47d1b2,'data2':null,'license':_0x4509fc[_0x0b47('0x9')]});}else{if(_0x4509fc[_0x0b47('0x9')]||_0x4228e5[_0x0b47('0x9')]){if(!_0x4228e5['data2']){if(_0x4228e5[_0x0b47('0x2c')]==_0x47d1b2){GRAY_PERIOD_REASON=_0x0b47('0x2d');logger[_0x0b47('0x29')](_0x0b47('0x2e'));}else{GRAY_PERIOD_REASON=_0x0b47('0x2f');oldToken=_0x4228e5[_0x0b47('0x2c')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4228e5[_0x0b47('0x2c')],_0x47d1b2);}sendJiraAlert(_0x4228e5[_0x0b47('0x2c')],_0x4509fc[_0x0b47('0x30')],GRAY_PERIOD_REASON);logger[_0x0b47('0x29')](_0x0b47('0x31'),GRAY_PERIOD_REASON[_0x0b47('0x32')](),moment()[_0x0b47('0xc')](_0x0b47('0x33')));return _0x375983[_0x0b47('0x12')]({'data2':encryptDate(moment()[_0x0b47('0xc')](_0x0b47('0x33')))});}else{if(moment()['diff'](decryptDate(_0x4228e5['data2']),_0x0b47('0x34'))>DAYS){logger['info'](_0x0b47('0x35'),moment()[_0x0b47('0xc')](_0x0b47('0x33')));return _0x375983[_0x0b47('0x12')]({'data1':_0x47d1b2,'data2':null,'license':null});}}}else{if(_0x4228e5[_0x0b47('0x2c')]!=_0x47d1b2){logger[_0x0b47('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4228e5['data1'],_0x47d1b2);return _0x375983['update']({'data1':_0x47d1b2,'data2':null,'license':null});}}}return _0x375983;})[_0x0b47('0xf')](function(_0x368c2a){_0x375983=_0x368c2a;})[_0x0b47('0x10')](function(_0x326653){logger[_0x0b47('0x36')](_0x326653[_0x0b47('0x37')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0b47('0x38')](),_0x375983);},TIME);});}function defaultLicense(){var _0x967bc1=hardware[_0x0b47('0x38')]();if(_0x967bc1){return db[_0x0b47('0x39')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x967bc1}})['spread'](function(_0x4648d6,_0x46f0cf){logger['info'](_0x0b47('0x3a'),_0x967bc1);manageLicense(_0x967bc1,_0x4648d6);})[_0x0b47('0x10')](function(_0xa332b7){logger['error'](_0xa332b7['message']);});}}exports[_0x0b47('0x3b')]=defaultLicense; \ No newline at end of file +var _0xdeb3=['./hardware','../logger','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','update','utf8','final','base64','createDecipher','secrets','||FIELD||VALUE||\x0a','User','admin','fullname','email','|uuid|','|machineUuid|','|name|','|email|','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','crypto','moment','request-promise','version','../../mysqldb','../environment'];(function(_0x56e37a,_0x2440bb){var _0x2cbfd4=function(_0xa17c43){while(--_0xa17c43){_0x56e37a['push'](_0x56e37a['shift']());}};_0x2cbfd4(++_0x2440bb);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var util=require('util');var crypto=require(_0x3deb('0x0'));var moment=require(_0x3deb('0x1'));var rp=require(_0x3deb('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x3deb('0x3'));var db=require(_0x3deb('0x4'))['db'];var config=require(_0x3deb('0x5'));var hardware=require(_0x3deb('0x6'));var logger=require(_0x3deb('0x7'))('license');var jira=require(_0x3deb('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x469e98){return new BPromise(function(_0x5455e4,_0x37db86){var _0x1bf486=util[_0x3deb('0x9')](_0x3deb('0xa'),HOST,_0x469e98,module[_0x3deb('0xb')][_0x3deb('0x3')]);if(oldToken){_0x1bf486=util[_0x3deb('0x9')](_0x3deb('0xc'),HOST,_0x469e98,module[_0x3deb('0xb')]['version'],oldToken);}var _0x5a50f5={'uri':_0x1bf486,'method':_0x3deb('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5a50f5)[_0x3deb('0xe')](function(_0x756238){_0x5455e4(_0x756238);})['catch'](function(_0x435ae5){_0x37db86(_0x435ae5);});});}function encryptDate(_0x2bc594){var _0xc65b64=crypto[_0x3deb('0xf')]('aes-256-ctr',config['secrets']['session']);var _0x258d26=_0xc65b64[_0x3deb('0x10')](_0x2bc594,_0x3deb('0x11'),'base64');_0x258d26+=_0xc65b64[_0x3deb('0x12')](_0x3deb('0x13'));return _0x258d26;}function decryptDate(_0x55c13c){var _0x24b516=crypto[_0x3deb('0x14')]('aes-256-ctr',config[_0x3deb('0x15')]['session']);var _0x465f33=_0x24b516['update'](_0x55c13c,'base64',_0x3deb('0x11'));_0x465f33+=_0x24b516[_0x3deb('0x12')](_0x3deb('0x11'));return _0x465f33;}function sendJiraAlert(_0x9ba4f,_0x8b65f,_0x145d16){var _0x4c8242=_0x3deb('0x16');return db[_0x3deb('0x17')]['findOne']({'where':{'role':_0x3deb('0x18')},'attributes':[_0x3deb('0x19'),_0x3deb('0x1a')],'raw':!![]})[_0x3deb('0xe')](function(_0xe1e928){ADMIN=_0xe1e928;_0x4c8242+='|reason|'+_0x145d16+'|\x0a';_0x4c8242+=_0x3deb('0x1b')+_0x9ba4f+'|\x0a';_0x4c8242+=_0x3deb('0x1c')+_0x8b65f+'|\x0a';_0x4c8242+=_0x3deb('0x1d')+ADMIN[_0x3deb('0x19')]+'|\x0a';_0x4c8242+=_0x3deb('0x1e')+ADMIN[_0x3deb('0x1a')]+'|\x0a';return _0x4c8242;})[_0x3deb('0xe')](function(_0x1f535e){var _0x42a8d5=hardware['getFirstInterface']()[_0x3deb('0x1f')];return jira['openIssue']({'key':_0x3deb('0x20'),'summary':_0x3deb('0x21'),'description':_0x1f535e,'issuetype':_0x3deb('0x22'),'oldToken':_0x9ba4f,'newToken':_0x8b65f,'email':ADMIN[_0x3deb('0x1a')],'name':ADMIN[_0x3deb('0x19')],'reason':GRAY_PERIOD_REASON,'ip':_0x42a8d5});});}function manageLicense(_0x245544,_0x297946){var _0x255fa5=_0x297946[_0x3deb('0x23')]({'plain':!![]});httpRequest(_0x245544)[_0x3deb('0xe')](function(_0x27a6f9){if(oldToken){oldToken=undefined;}if(_0x27a6f9[_0x3deb('0x24')]){if(!_0x255fa5[_0x3deb('0x25')]&&_0x255fa5[_0x3deb('0x25')]!=_0x27a6f9[_0x3deb('0x25')]||_0x255fa5[_0x3deb('0x25')]&&_0x255fa5[_0x3deb('0x26')]){logger[_0x3deb('0x27')](_0x3deb('0x28'));}if(_0x255fa5[_0x3deb('0x25')]&&!_0x255fa5['data2']&&_0x255fa5[_0x3deb('0x25')]!=_0x27a6f9[_0x3deb('0x25')]){logger['info'](_0x3deb('0x29'));}if(_0x255fa5['license']&&!_0x255fa5[_0x3deb('0x26')]&&_0x255fa5[_0x3deb('0x25')]==_0x27a6f9[_0x3deb('0x25')]){return _0x297946;}return _0x297946[_0x3deb('0x10')]({'data1':_0x245544,'data2':null,'license':_0x27a6f9[_0x3deb('0x25')]});}else{if(_0x27a6f9[_0x3deb('0x25')]||_0x255fa5['license']){if(!_0x255fa5[_0x3deb('0x26')]){if(_0x255fa5[_0x3deb('0x2a')]==_0x245544){GRAY_PERIOD_REASON=_0x3deb('0x2b');logger[_0x3deb('0x27')](_0x3deb('0x2c'));}else{GRAY_PERIOD_REASON=_0x3deb('0x2d');oldToken=_0x255fa5[_0x3deb('0x2a')];logger[_0x3deb('0x27')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x255fa5[_0x3deb('0x2a')],_0x245544);}sendJiraAlert(_0x255fa5[_0x3deb('0x2a')],_0x27a6f9[_0x3deb('0x2e')],GRAY_PERIOD_REASON);logger[_0x3deb('0x27')](_0x3deb('0x2f'),GRAY_PERIOD_REASON[_0x3deb('0x30')](),moment()[_0x3deb('0x9')](_0x3deb('0x31')));return _0x297946[_0x3deb('0x10')]({'data2':encryptDate(moment()[_0x3deb('0x9')](_0x3deb('0x31')))});}else{if(moment()[_0x3deb('0x32')](decryptDate(_0x255fa5[_0x3deb('0x26')]),_0x3deb('0x33'))>DAYS){logger[_0x3deb('0x27')](_0x3deb('0x34'),moment()[_0x3deb('0x9')](_0x3deb('0x31')));return _0x297946[_0x3deb('0x10')]({'data1':_0x245544,'data2':null,'license':null});}}}else{if(_0x255fa5['data1']!=_0x245544){logger[_0x3deb('0x27')](_0x3deb('0x35'),_0x255fa5[_0x3deb('0x2a')],_0x245544);return _0x297946[_0x3deb('0x10')]({'data1':_0x245544,'data2':null,'license':null});}}}return _0x297946;})['then'](function(_0x42d09b){_0x297946=_0x42d09b;})[_0x3deb('0x36')](function(_0x22d13d){logger[_0x3deb('0x37')](_0x22d13d[_0x3deb('0x38')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x297946);},TIME);});}function defaultLicense(){var _0x2953d8=hardware[_0x3deb('0x39')]();if(_0x2953d8){return db[_0x3deb('0x3a')][_0x3deb('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x2953d8}})[_0x3deb('0x3c')](function(_0xf875e6,_0x27499b){logger[_0x3deb('0x27')](_0x3deb('0x3d'),_0x2953d8);manageLicense(_0x2953d8,_0xf875e6);})[_0x3deb('0x36')](function(_0x218159){logger['error'](_0x218159[_0x3deb('0x38')]);});}}exports[_0x3deb('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e8a9244..993a7d5 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 _0x1320=['final','gray','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','Demo\x20license','getLicense','License','defaults','then','crypto','util','lodash','moment','./hardware','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse','uuid','machineUuid','getUuid','secrets','session','update'];(function(_0x2aa010,_0x13cf4b){var _0x5b30af=function(_0x360997){while(--_0x360997){_0x2aa010['push'](_0x2aa010['shift']());}};_0x5b30af(++_0x13cf4b);}(_0x1320,0x128));var _0x0132=function(_0x3f996d,_0x33c258){_0x3f996d=_0x3f996d-0x0;var _0x397e8a=_0x1320[_0x3f996d];return _0x397e8a;};'use strict';var crypto=require(_0x0132('0x0'));var util=require(_0x0132('0x1'));var _=require(_0x0132('0x2'));var moment=require(_0x0132('0x3'));var hardware=require(_0x0132('0x4'));var config=require(_0x0132('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x4f1267,_0x1a13a3){if(_0x4f1267){try{var _0x3dce73=_0x1a13a3||_0x4f1267[_0x0132('0x6')];if(_[_0x0132('0x7')](_0x3dce73)){throw new Error(_0x0132('0x8'));}var _0x34408b=_0x4f1267['data1'];var _0x442d09=_0x4f1267[_0x0132('0x9')];var _0x4baa1a=_0x34408b[_0x0132('0xa')]('-')[0x4];var _0x221db7=_0x34408b['split']('-')[0x0];var _0x56ae36=crypto[_0x0132('0xb')](_0x0132('0xc'),util[_0x0132('0xd')](_0x0132('0xe'),_0x4baa1a,_0x34408b,_0x221db7));var _0x2b4b4d=_0x56ae36['update'](_0x3dce73,_0x0132('0xf'),'utf8');_0x2b4b4d+=_0x56ae36['final'](_0x0132('0x10'));var _0x9c947c=JSON[_0x0132('0x11')](_0x2b4b4d);_0x9c947c['demo']=![];_0x9c947c[_0x0132('0x12')]=_0x34408b;_0x9c947c[_0x0132('0x13')]=hardware[_0x0132('0x14')]();if(_0x442d09){var _0x3b32b9=crypto[_0x0132('0xb')](_0x0132('0xc'),config[_0x0132('0x15')][_0x0132('0x16')]);var _0x34ffdc=_0x3b32b9[_0x0132('0x17')](_0x442d09,_0x0132('0xf'),_0x0132('0x10'));_0x34ffdc+=_0x3b32b9[_0x0132('0x18')](_0x0132('0x10'));_0x9c947c[_0x0132('0x19')]=_0x34ffdc;_0x9c947c['deadline']=moment(_0x34ffdc)[_0x0132('0x1a')](0x7,_0x0132('0x1b'))[_0x0132('0xd')]();_0x9c947c[_0x0132('0x1c')]=_0x9c947c[_0x0132('0x12')]!=_0x9c947c['machineUuid']?_0x0132('0x1d'):_0x0132('0x1e');}return _0x9c947c;}catch(_0x52798a){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0132('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0132('0x20'),'uuid':_0x4f1267[_0x0132('0x21')],'machineUuid':hardware['getUuid'](),'message':_0x52798a[_0x0132('0x22')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0132('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0132('0x23'),'uuid':_0x4f1267[_0x0132('0x21')],'machineUuid':hardware[_0x0132('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x0132('0x24')]=function(_0x51255d){return db[_0x0132('0x25')]['find'](_[_0x0132('0x26')](_0x51255d,{'raw':!![],'where':{'id':0x1}}))[_0x0132('0x27')](function(_0x940d8b){return checkLicense(_0x940d8b,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0xe4eb=['session','gray','deadline','add','days','grayReason','uuid','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','find','defaults','then','checkLicense','crypto','util','moment','./hardware','../environment','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','format','update','base64','utf8','parse','demo','machineUuid','getUuid','createDecipher'];(function(_0x323970,_0x5bde6f){var _0x3217da=function(_0x4dcdf3){while(--_0x4dcdf3){_0x323970['push'](_0x323970['shift']());}};_0x3217da(++_0x5bde6f);}(_0xe4eb,0x9b));var _0xbe4e=function(_0x433e3f,_0x41fb31){_0x433e3f=_0x433e3f-0x0;var _0x1c6c05=_0xe4eb[_0x433e3f];return _0x1c6c05;};'use strict';var crypto=require(_0xbe4e('0x0'));var util=require(_0xbe4e('0x1'));var _=require('lodash');var moment=require(_0xbe4e('0x2'));var hardware=require(_0xbe4e('0x3'));var config=require(_0xbe4e('0x4'));var db=require('../../mysqldb')['db'];function checkLicense(_0x253fbb,_0x9a14a9){if(_0x253fbb){try{var _0x3b2b21=_0x9a14a9||_0x253fbb['license'];if(_[_0xbe4e('0x5')](_0x3b2b21)){throw new Error(_0xbe4e('0x6'));}var _0x2e4bd6=_0x253fbb[_0xbe4e('0x7')];var _0x36c131=_0x253fbb[_0xbe4e('0x8')];var _0x3ad104=_0x2e4bd6[_0xbe4e('0x9')]('-')[0x4];var _0x2ac40e=_0x2e4bd6[_0xbe4e('0x9')]('-')[0x0];var _0x335d22=crypto['createDecipher'](_0xbe4e('0xa'),util[_0xbe4e('0xb')]('%s:%s:%s',_0x3ad104,_0x2e4bd6,_0x2ac40e));var _0x49f82e=_0x335d22[_0xbe4e('0xc')](_0x3b2b21,_0xbe4e('0xd'),_0xbe4e('0xe'));_0x49f82e+=_0x335d22['final'](_0xbe4e('0xe'));var _0x116a2a=JSON[_0xbe4e('0xf')](_0x49f82e);_0x116a2a[_0xbe4e('0x10')]=![];_0x116a2a['uuid']=_0x2e4bd6;_0x116a2a[_0xbe4e('0x11')]=hardware[_0xbe4e('0x12')]();if(_0x36c131){var _0x3c7a95=crypto[_0xbe4e('0x13')]('aes-256-ctr',config['secrets'][_0xbe4e('0x14')]);var _0x485a0e=_0x3c7a95[_0xbe4e('0xc')](_0x36c131,_0xbe4e('0xd'),_0xbe4e('0xe'));_0x485a0e+=_0x3c7a95['final']('utf8');_0x116a2a[_0xbe4e('0x15')]=_0x485a0e;_0x116a2a[_0xbe4e('0x16')]=moment(_0x485a0e)[_0xbe4e('0x17')](0x7,_0xbe4e('0x18'))[_0xbe4e('0xb')]();_0x116a2a[_0xbe4e('0x19')]=_0x116a2a[_0xbe4e('0x1a')]!=_0x116a2a[_0xbe4e('0x11')]?'changed':_0xbe4e('0x1b');}return _0x116a2a;}catch(_0x3b196d){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbe4e('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbe4e('0x1d'),'uuid':_0x253fbb['data1'],'machineUuid':hardware[_0xbe4e('0x12')](),'message':_0x3b196d[_0xbe4e('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbe4e('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x253fbb['data1'],'machineUuid':hardware[_0xbe4e('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x1caa8c){return db['License'][_0xbe4e('0x1f')](_[_0xbe4e('0x20')](_0x1caa8c,{'raw':!![],'where':{'id':0x1}}))[_0xbe4e('0x21')](function(_0x3efb46){return checkLicense(_0x3efb46,null);});};exports[_0xbe4e('0x22')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9391b61..50f735f 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 _0xc7ee=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x5d7831,_0x18d6ce){var _0x39a223=function(_0x3b73ba){while(--_0x3b73ba){_0x5d7831['push'](_0x5d7831['shift']());}};_0x39a223(++_0x18d6ce);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc7ee[_0x167cc1];return _0x10bc4b;};'use strict';module[_0xec7e('0x0')]={'DOMAIN':_0xec7e('0x1'),'SESSION_SECRET':_0xec7e('0x2'),'GOOGLE_ID':_0xec7e('0x3'),'GOOGLE_SECRET':_0xec7e('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x5dc7=['exports','http://localhost:9000','app-id','secret'];(function(_0x46361c,_0x5e8a98){var _0x244ad8=function(_0x5f0463){while(--_0x5f0463){_0x46361c['push'](_0x46361c['shift']());}};_0x244ad8(++_0x5e8a98);}(_0x5dc7,0x148));var _0x75dc=function(_0x396e58,_0x3524a3){_0x396e58=_0x396e58-0x0;var _0x51a876=_0x5dc7[_0x396e58];return _0x51a876;};'use strict';module[_0x75dc('0x0')]={'DOMAIN':_0x75dc('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x75dc('0x2'),'GOOGLE_SECRET':_0x75dc('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ae3a9b6..8acf91c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbddc=['transports','error','File','%s-%s','info','Console','env','moment','winston','path','join','/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xbddc,0x118));var _0xcbdd=function(_0x4a452b,_0x17e2f1){_0x4a452b=_0x4a452b-0x0;var _0x304b39=_0xbddc[_0x4a452b];return _0x304b39;};'use strict';var moment=require(_0xcbdd('0x0'));var winston=require(_0xcbdd('0x1'));var util=require('util');var path=require(_0xcbdd('0x2'));var debugLevel='INFO';function filename(_0x25487a,_0x119e76){return path[_0xcbdd('0x3')](_0xcbdd('0x4'),_0xcbdd('0x5'),_0xcbdd('0x6'),util['format']('%s-%s.log',_0x25487a,_0x119e76));}function formatter(_0x5e7edd,_0x337eee){return util[_0xcbdd('0x7')](_0xcbdd('0x8'),moment()[_0xcbdd('0x7')](_0xcbdd('0x9')),_0x337eee[_0xcbdd('0xa')][_0xcbdd('0xb')](),_0x5e7edd,_0x337eee['message']);}module[_0xcbdd('0xc')]=function(_0x44cfee){return new winston[(_0xcbdd('0xd'))]({'transports':[new winston[(_0xcbdd('0xe'))]['File']({'name':util[_0xcbdd('0x7')]('%s-%s',_0x44cfee,_0xcbdd('0xf')),'filename':filename(_0x44cfee,'error'),'level':_0xcbdd('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x14fc1a){return formatter(_0x44cfee,_0x14fc1a);}}),new winston[(_0xcbdd('0xe'))][(_0xcbdd('0x10'))]({'name':util[_0xcbdd('0x7')](_0xcbdd('0x11'),_0x44cfee,_0xcbdd('0x12')),'filename':filename(_0x44cfee,_0xcbdd('0x12')),'level':_0xcbdd('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x97957){return formatter(_0x44cfee,_0x97957);}}),new winston[(_0xcbdd('0xe'))][(_0xcbdd('0x13'))]({'level':process[_0xcbdd('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x52e563){return formatter(_0x44cfee,_0x52e563);}})]});}; \ No newline at end of file +var _0xdbc2=['transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util','path','/var','log','xcally','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','Logger'];(function(_0x3d592c,_0x4856fd){var _0x43e287=function(_0x2315dd){while(--_0x2315dd){_0x3d592c['push'](_0x3d592c['shift']());}};_0x43e287(++_0x4856fd);}(_0xdbc2,0xb0));var _0x2dbc=function(_0x590caa,_0x19e924){_0x590caa=_0x590caa-0x0;var _0x508f6f=_0xdbc2[_0x590caa];return _0x508f6f;};'use strict';var moment=require(_0x2dbc('0x0'));var winston=require('winston');var util=require(_0x2dbc('0x1'));var path=require(_0x2dbc('0x2'));var debugLevel='INFO';function filename(_0x55d22e,_0x3f0ded){return path['join'](_0x2dbc('0x3'),_0x2dbc('0x4'),_0x2dbc('0x5'),util['format'](_0x2dbc('0x6'),_0x55d22e,_0x3f0ded));}function formatter(_0x3f1942,_0xb6ec1a){return util[_0x2dbc('0x7')](_0x2dbc('0x8'),moment()[_0x2dbc('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0xb6ec1a[_0x2dbc('0x9')][_0x2dbc('0xa')](),_0x3f1942,_0xb6ec1a[_0x2dbc('0xb')]);}module['exports']=function(_0x22e98d){return new winston[(_0x2dbc('0xc'))]({'transports':[new winston[(_0x2dbc('0xd'))][(_0x2dbc('0xe'))]({'name':util[_0x2dbc('0x7')](_0x2dbc('0xf'),_0x22e98d,_0x2dbc('0x10')),'filename':filename(_0x22e98d,_0x2dbc('0x10')),'level':_0x2dbc('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe3ee8c){return formatter(_0x22e98d,_0xe3ee8c);}}),new winston[(_0x2dbc('0xd'))][(_0x2dbc('0xe'))]({'name':util[_0x2dbc('0x7')]('%s-%s',_0x22e98d,'info'),'filename':filename(_0x22e98d,'info'),'level':_0x2dbc('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x16de2e){return formatter(_0x22e98d,_0x16de2e);}}),new winston['transports'][(_0x2dbc('0x12'))]({'level':process[_0x2dbc('0x13')][_0x2dbc('0x14')]||debugLevel,'json':![],'formatter':function(_0x118639){return formatter(_0x22e98d,_0x118639);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2581a6a..a68fdb0 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 _0x89c4=['path','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89c4,0xc6));var _0x489c=function(_0x3cb466,_0x2d53df){_0x3cb466=_0x3cb466-0x0;var _0x3a7d00=_0x89c4[_0x3cb466];return _0x3a7d00;};'use strict';var path=require(_0x489c('0x0'));var os=require('os');var config={'apps':[{'name':_0x489c('0x1'),'script':path[_0x489c('0x2')](__dirname,_0x489c('0x3'))},{'name':_0x489c('0x4'),'script':path[_0x489c('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x489c('0x5'),'script':path[_0x489c('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x489c('0x6'),'script':path[_0x489c('0x2')](__dirname,_0x489c('0x7'))},{'name':_0x489c('0x8'),'script':path[_0x489c('0x2')](__dirname,_0x489c('0x9'))},{'name':_0x489c('0xa'),'script':path[_0x489c('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0xb223=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','express','ami','join','../../services/ami/index.js','agi','email'];(function(_0x3276b6,_0x472d15){var _0x5530f0=function(_0x7003e1){while(--_0x7003e1){_0x3276b6['push'](_0x3276b6['shift']());}};_0x5530f0(++_0x472d15);}(_0xb223,0x194));var _0x3b22=function(_0x485d66,_0x6f04c){_0x485d66=_0x485d66-0x0;var _0x416fe2=_0xb223[_0x485d66];return _0x416fe2;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x3b22('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x3b22('0x1'),'script':path[_0x3b22('0x2')](__dirname,_0x3b22('0x3'))},{'name':_0x3b22('0x4'),'script':path[_0x3b22('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x3b22('0x5'),'script':path[_0x3b22('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x3b22('0x6'),'script':path[_0x3b22('0x2')](__dirname,_0x3b22('0x7'))},{'name':_0x3b22('0x8'),'script':path[_0x3b22('0x2')](__dirname,_0x3b22('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 1624dcb..c097a89 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 _0x2297=['bluebird','./config','connect','connected','start','disconnect','stop','then','restart','describe','delete','dump','saved'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2297,0x186));var _0x7229=function(_0x534cd7,_0xc7c8d8){_0x534cd7=_0x534cd7-0x0;var _0x5bd431=_0x2297[_0x534cd7];return _0x5bd431;};'use strict';var pm2=require('pm2');var BPromise=require(_0x7229('0x0'));var config=require(_0x7229('0x1'));function connect(){return new BPromise(function(_0x7a9ae8,_0x565ffb){return pm2[_0x7229('0x2')](function(_0x150791){if(_0x150791){return _0x565ffb(_0x150791);}return _0x7a9ae8(_0x7229('0x3'));});});};exports['start']=function(_0x36caa5){return connect()['then'](function(){return new BPromise(function(_0x123933,_0x4b9909){return pm2[_0x7229('0x4')](_0x36caa5,function(_0x46f6bd,_0xf1a0a2){if(_0x46f6bd){return _0x4b9909(_0x46f6bd);}pm2[_0x7229('0x5')]();return _0x123933(_0xf1a0a2);});});});};exports[_0x7229('0x6')]=function(_0x3100bf){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x3fa74f,_0x3c8a2f){return pm2[_0x7229('0x6')](_0x3100bf,function(_0x1ac8a4,_0x535c3e){if(_0x1ac8a4){return _0x3c8a2f(_0x1ac8a4);}pm2[_0x7229('0x5')]();return _0x3fa74f(_0x535c3e);});});});};exports[_0x7229('0x8')]=function(_0x3fcbc3){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x2bb2e8,_0x48f1ba){return pm2['restart'](_0x3fcbc3,function(_0x1304ba,_0x3cb1b3){if(_0x1304ba){return _0x48f1ba(_0x1304ba);}pm2[_0x7229('0x5')]();return _0x2bb2e8(_0x3cb1b3);});});});};exports['list']=function(){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x2006ba,_0x1582eb){return pm2['list'](function(_0x5c74fd,_0x2a99dc){if(_0x5c74fd){return _0x1582eb(_0x5c74fd);}pm2[_0x7229('0x5')]();return _0x2006ba(_0x2a99dc);});});});};exports[_0x7229('0x9')]=function(_0x5201a4){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x28c88f,_0x3a5984){return pm2[_0x7229('0x9')](_0x5201a4,function(_0x4b1b53,_0x42b9c1){if(_0x4b1b53){return _0x3a5984(_0x4b1b53);}pm2[_0x7229('0x5')]();return _0x28c88f(_0x42b9c1);});});});};exports[_0x7229('0xa')]=function(_0x27cf20){return connect()[_0x7229('0x7')](function(){return new BPromise(function(_0x183828,_0xa536bf){return pm2[_0x7229('0xa')](_0x27cf20,function(_0x4f7bd2,_0x693a82){if(_0x4f7bd2){return _0xa536bf(_0x4f7bd2);}pm2[_0x7229('0x5')]();return _0x183828(_0x693a82);});});});};exports[_0x7229('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3ccafd,_0x1802d7){return pm2['dump'](function(_0x1d25d9){if(_0x1d25d9){return _0x1802d7(_0x1d25d9);}return _0x3ccafd(_0x7229('0xc'));});});});}; \ No newline at end of file +var _0x952a=['bluebird','connect','connected','then','start','stop','restart','disconnect','list','describe','delete','dump','saved','pm2'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x952a,0x1b1));var _0xa952=function(_0x4848c5,_0x2d28c3){_0x4848c5=_0x4848c5-0x0;var _0x74a692=_0x952a[_0x4848c5];return _0x74a692;};'use strict';var pm2=require(_0xa952('0x0'));var BPromise=require(_0xa952('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x413ad6,_0xce2283){return pm2[_0xa952('0x2')](function(_0x26678b){if(_0x26678b){return _0xce2283(_0x26678b);}return _0x413ad6(_0xa952('0x3'));});});};exports['start']=function(_0x427f80){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x2c41db,_0xdd66b6){return pm2[_0xa952('0x5')](_0x427f80,function(_0x2f727c,_0x5dbb1b){if(_0x2f727c){return _0xdd66b6(_0x2f727c);}pm2['disconnect']();return _0x2c41db(_0x5dbb1b);});});});};exports[_0xa952('0x6')]=function(_0x4d6df9){return connect()['then'](function(){return new BPromise(function(_0x2129e7,_0x4c21c6){return pm2['stop'](_0x4d6df9,function(_0x5977a2,_0x2d114f){if(_0x5977a2){return _0x4c21c6(_0x5977a2);}pm2['disconnect']();return _0x2129e7(_0x2d114f);});});});};exports[_0xa952('0x7')]=function(_0x49a864){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x2ffdf3,_0x537c41){return pm2[_0xa952('0x7')](_0x49a864,function(_0x165579,_0x261be3){if(_0x165579){return _0x537c41(_0x165579);}pm2[_0xa952('0x8')]();return _0x2ffdf3(_0x261be3);});});});};exports['list']=function(){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x3ccf0a,_0x2c9f2c){return pm2[_0xa952('0x9')](function(_0xa4c827,_0x44dfbf){if(_0xa4c827){return _0x2c9f2c(_0xa4c827);}pm2[_0xa952('0x8')]();return _0x3ccf0a(_0x44dfbf);});});});};exports['describe']=function(_0x4aa17e){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0xa89509,_0x2cc488){return pm2[_0xa952('0xa')](_0x4aa17e,function(_0x50d733,_0x31e997){if(_0x50d733){return _0x2cc488(_0x50d733);}pm2['disconnect']();return _0xa89509(_0x31e997);});});});};exports[_0xa952('0xb')]=function(_0x153d55){return connect()[_0xa952('0x4')](function(){return new BPromise(function(_0x47fb31,_0x20e920){return pm2[_0xa952('0xb')](_0x153d55,function(_0x305c19,_0x3edf9d){if(_0x305c19){return _0x20e920(_0x305c19);}pm2[_0xa952('0x8')]();return _0x47fb31(_0x3edf9d);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x2848b3,_0x2484c4){return pm2[_0xa952('0xc')](function(_0x1ac470){if(_0x1ac470){return _0x2484c4(_0x1ac470);}return _0x2848b3(_0xa952('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ee84b14..de28853 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 _0xc5a0=['chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','catch','error','moment','ioredis','redis','defaults','localhost','Setting','then'];(function(_0xf365cf,_0x461f3d){var _0x1261a0=function(_0x2f0c99){while(--_0x2f0c99){_0xf365cf['push'](_0xf365cf['shift']());}};_0x1261a0(++_0x461f3d);}(_0xc5a0,0x10d));var _0x0c5a=function(_0x30d4eb,_0x377d52){_0x30d4eb=_0x30d4eb-0x0;var _0x1356e5=_0xc5a0[_0x30d4eb];return _0x1356e5;};'use strict';var _=require('lodash');var moment=require(_0x0c5a('0x0'));var Redis=require(_0x0c5a('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');config[_0x0c5a('0x2')]=_[_0x0c5a('0x3')](config['redis'],{'host':_0x0c5a('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0c5a('0x2')]));function closeInteractions(){var _0x1a6654=0x0;var _0x5200e5=[];return db[_0x0c5a('0x5')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x0c5a('0x6')](function(_0x509195){_0x1a6654=_0x509195[_0x0c5a('0x7')];if(_0x1a6654){return db[_0x0c5a('0x8')][_0x0c5a('0x9')]({'raw':!![],'attributes':['id',_0x0c5a('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x509195['chatTimeout'],_0x0c5a('0xb'))}}});}else{return[];}})[_0x0c5a('0x6')](function(_0x4e0897){_0x5200e5=_0x4e0897;if(_0x1a6654){return db[_0x0c5a('0x8')][_0x0c5a('0xc')]({'closeReason':_0x0c5a('0xd'),'disposition':_0x0c5a('0xe'),'closed':!![],'closedAt':moment()[_0x0c5a('0xf')](_0x0c5a('0x10'))},{'where':{'id':_[_0x0c5a('0x11')](_0x5200e5||[],'id')}});}})[_0x0c5a('0x6')](function(_0xb67ea1){for(var _0x22b7b4=0x0;_0x22b7b4<_0x5200e5[_0x0c5a('0x12')];_0x22b7b4++){io[_0x0c5a('0x13')](_0x0c5a('0x14'),{'id':_0x5200e5[_0x22b7b4]['id'],'closed':!![]});}})[_0x0c5a('0x15')](function(_0x109730){console[_0x0c5a('0x16')](_0x109730);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x138b=['chatInteraction:update','error','moment','ioredis','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit'];(function(_0x3bc3df,_0x3c19ff){var _0x258ac5=function(_0x2f9a36){while(--_0x2f9a36){_0x3bc3df['push'](_0x3bc3df['shift']());}};_0x258ac5(++_0x3c19ff);}(_0x138b,0x13a));var _0xb138=function(_0x215fe9,_0x493d04){_0x215fe9=_0x215fe9-0x0;var _0x5a196b=_0x138b[_0x215fe9];return _0x5a196b;};'use strict';var _=require('lodash');var moment=require(_0xb138('0x0'));var Redis=require(_0xb138('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xb138('0x2'));config[_0xb138('0x3')]=_[_0xb138('0x4')](config[_0xb138('0x3')],{'host':_0xb138('0x5'),'port':0x18eb});var io=require(_0xb138('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x2151f1=0x0;var _0x46e517=[];return db[_0xb138('0x7')][_0xb138('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xb138('0x9')](function(_0x31de33){_0x2151f1=_0x31de33[_0xb138('0xa')];if(_0x2151f1){return db[_0xb138('0xb')][_0xb138('0xc')]({'raw':!![],'attributes':['id',_0xb138('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb138('0xe')](_0x31de33[_0xb138('0xa')],_0xb138('0xf'))}}});}else{return[];}})[_0xb138('0x9')](function(_0x51c033){_0x46e517=_0x51c033;if(_0x2151f1){return db[_0xb138('0xb')]['update']({'closeReason':_0xb138('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb138('0x11')](_0xb138('0x12'))},{'where':{'id':_[_0xb138('0x13')](_0x46e517||[],'id')}});}})['then'](function(_0x28b7d7){for(var _0x5d9476=0x0;_0x5d9476<_0x46e517[_0xb138('0x14')];_0x5d9476++){io[_0xb138('0x15')](_0xb138('0x16'),{'id':_0x46e517[_0x5d9476]['id'],'closed':!![]});}})['catch'](function(_0x2d35ad){console[_0xb138('0x17')](_0x2d35ad);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9d9df40..ba0e89d 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 _0xd4fd=['endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','catch','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xd4fd,0x115));var _0xdd4f=function(_0x4a3e13,_0x24079d){_0x4a3e13=_0x4a3e13-0x0;var _0x54b398=_0xd4fd[_0x4a3e13];return _0x54b398;};'use strict';var fs=require('fs');var util=require(_0xdd4f('0x0'));var path=require(_0xdd4f('0x1'));var _=require(_0xdd4f('0x2'));var moment=require(_0xdd4f('0x3'));var CronJobManager=require(_0xdd4f('0x4'));var jayson=require(_0xdd4f('0x5'));var BPromise=require(_0xdd4f('0x6'));var logger=require(_0xdd4f('0x7'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xdd4f('0x8'));var client=jayson[_0xdd4f('0x9')][_0xdd4f('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xeaaf7,_0x17f26c){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xeaaf7[_0xdd4f('0xb')]);var _0xa43da3=!![];var _0x45cf82={'tls':{'rejectUnauthorized':![]}};if(_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')]['service']){_0x45cf82[_0xdd4f('0xe')]=_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0xe')];}else{_0x45cf82[_0xdd4f('0xf')]=_0xeaaf7[_0xdd4f('0xc')]['Smtp']['host'];_0x45cf82[_0xdd4f('0x10')]=_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x10')];_0x45cf82[_0xdd4f('0x11')]=_0xeaaf7['MailAccount'][_0xdd4f('0xd')][_0xdd4f('0x11')];}if(_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x12')]){_0x45cf82[_0xdd4f('0x13')]={'user':_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x14')],'pass':_0xeaaf7['MailAccount']['Smtp']['pass']};}var _0x28be5d={'account':_0x45cf82,'message':{'from':util[_0xdd4f('0x15')]('\x22%s\x22\x20<%s>',_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0x16')],_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xb')]||_0xeaaf7[_0xdd4f('0xc')][_0xdd4f('0xd')][_0xdd4f('0x14')]),'to':_0xeaaf7['email'],'cc':_0xeaaf7['cc'],'bcc':_0xeaaf7['bcc'],'subject':util['format'](_0xdd4f('0x17'),_0x17f26c[_0xdd4f('0x16')],_0xeaaf7[_0xdd4f('0x18')],_0xeaaf7['subtractUnit'])}};var _0x5d7449=path[_0xdd4f('0x19')](__dirname,_0xdd4f('0x1a'));var _0x3bf1d0=_0x17f26c['savename'];var _0x66de1a=util['format'](_0xdd4f('0x1b'),path[_0xdd4f('0x1c')](_0x17f26c[_0xdd4f('0x1d')],path[_0xdd4f('0x1e')](_0x17f26c['savename'])),_0xdd4f('0x1f'));var _0x4cd059=path[_0xdd4f('0x19')](_0x5d7449,_0x3bf1d0);var _0x5dcc83=path[_0xdd4f('0x19')](_0x5d7449,_0x66de1a);if(fs[_0xdd4f('0x20')](_0x4cd059)){_0x17f26c[_0xdd4f('0x21')]=_0xdd4f('0x22');_0x28be5d[_0xdd4f('0x23')][_0xdd4f('0x24')]=[{'filename':_0x3bf1d0,'path':_0x4cd059}];_0x28be5d['message']['text']=util[_0xdd4f('0x15')](_0xdd4f('0x25'),JSON[_0xdd4f('0x26')](_0x17f26c,null,0x2));}else if(fs['existsSync'](_0x5dcc83)){_0x17f26c['status']='Sent';_0x28be5d[_0xdd4f('0x23')][_0xdd4f('0x24')]=[{'filename':_0x66de1a,'path':_0x5dcc83}];}else{_0x28be5d[_0xdd4f('0x23')][_0xdd4f('0x27')]=_0xdd4f('0x28');if(!_0xeaaf7[_0xdd4f('0x29')]){_0xa43da3=![];logger[_0xdd4f('0x2a')](_0xdd4f('0x2b'));}}if(_0xa43da3){return client[_0xdd4f('0x2c')]('SendMail',_0x28be5d)['then'](function(_0x1727e2){if(_0x1727e2[_0xdd4f('0x2d')]){return logger['error'](_0xdd4f('0x2e'),JSON['stringify'](_0x1727e2));}return logger['info']('email\x20sent');})[_0xdd4f('0x2f')](function(_0x24fae6){return logger[_0xdd4f('0x2d')](_0xdd4f('0x2e'),JSON['stringify'](_0x24fae6));});}};}function handleError(){return function(_0x4554f2){return logger[_0xdd4f('0x2d')](JSON[_0xdd4f('0x26')](_0x4554f2));};}function handleResult(_0x297221){return function(_0x1fa598){logger[_0xdd4f('0x2a')](_0xdd4f('0x30'),JSON[_0xdd4f('0x26')](_0x1fa598));if(_0x297221[_0xdd4f('0xc')]&&_0x297221['MailAccount'][_0xdd4f('0xd')]&&!_[_0xdd4f('0x31')](_0x297221[_0xdd4f('0xb')])){setTimeout(handleSendEmail(_0x297221,_0x1fa598),0x3c*0x3e8);}};}function handleJob(_0x3904a1){return function(){try{if(_['isNil'](_0x3904a1['subtractNumber'])){return logger[_0xdd4f('0x2a')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xdd4f('0x31')](_0x3904a1[_0xdd4f('0x32')])){return logger[_0xdd4f('0x2a')](_0xdd4f('0x33'));}var _0x4df04f={'startDate':moment()['subtract'](_0x3904a1[_0xdd4f('0x18')],_0x3904a1[_0xdd4f('0x32')])[_0xdd4f('0x15')](_0xdd4f('0x34')),'endDate':moment()[_0xdd4f('0x15')](_0xdd4f('0x34')),'type':'scheduled','output':_0x3904a1[_0xdd4f('0x35')],'name':_0x3904a1['name']};if(!_['isNil'](_0x3904a1['DefaultReportId'])){logger['info'](_0xdd4f('0x36'),_0x3904a1[_0xdd4f('0x37')]);return analyticDefaultReportController[_0xdd4f('0x38')]({'id':_0x3904a1[_0xdd4f('0x37')]},_0x4df04f)[_0xdd4f('0x39')](handleResult(_0x3904a1))['catch'](handleError());}if(!_[_0xdd4f('0x31')](_0x3904a1[_0xdd4f('0x3a')])){logger[_0xdd4f('0x2a')](_0xdd4f('0x3b'),_0x3904a1['CustomReportId']);return analyticCustomReportController[_0xdd4f('0x38')]({'id':_0x3904a1['CustomReportId']},_0x4df04f)[_0xdd4f('0x39')](handleResult(_0x3904a1))[_0xdd4f('0x2f')](handleError());}}catch(_0x39f71f){logger[_0xdd4f('0x2d')](JSON[_0xdd4f('0x26')](_0x39f71f));}return logger[_0xdd4f('0x2a')](_0xdd4f('0x3c'));};}function getJobs(_0x2b5f56){var _0x4f9d79={};if(_0x2b5f56){_0x4f9d79['id']=_0x2b5f56;}return db[_0xdd4f('0x3d')][_0xdd4f('0x3e')]({'where':_0x4f9d79,'include':[{'model':db['MailAccount'],'attributes':['id',_0xdd4f('0x16'),_0xdd4f('0xb')],'include':[{'model':db[_0xdd4f('0x3f')],'as':_0xdd4f('0xd')}]}]})[_0xdd4f('0x39')](function(_0x5ef05d){var _0x5a0e54=_['keys'](manager[_0xdd4f('0x40')]);var _0x2e782a=_[_0xdd4f('0x41')](_0x5ef05d,function(_0x24b251){return _0x24b251['id'][_0xdd4f('0x42')]();});var _0x3f2c4d=_[_0xdd4f('0x43')](_0x5ef05d,function(_0x1bf649){return _0x1bf649['id'][_0xdd4f('0x42')]();});var _0x1aa39d=_0x2b5f56?_0x2e782a:_['difference'](_0x2e782a,_0x5a0e54);var _0x53e0bd=_[_0xdd4f('0x44')](_0x2e782a,_0x5a0e54);var _0x3e35a0=_[_0xdd4f('0x45')](_0x5a0e54,_0x2e782a);var _0x3ac41a;var _0x35358e;for(_0x3ac41a=0x0;_0x3ac41a<_0x3e35a0[_0xdd4f('0x46')]&&!_0x2b5f56;_0x3ac41a+=0x1){_0x35358e=_0x3e35a0[_0x3ac41a]['toString']();if(manager[_0xdd4f('0x47')](_0x35358e)){manager[_0xdd4f('0x48')](_0x35358e);manager[_0xdd4f('0x49')](_0x35358e);logger[_0xdd4f('0x2a')](_0xdd4f('0x4a'),_0x35358e);}}logger[_0xdd4f('0x2a')]('toRun',JSON[_0xdd4f('0x26')](_0x1aa39d));for(_0x3ac41a=0x0;_0x3ac41a<_0x1aa39d[_0xdd4f('0x46')];_0x3ac41a+=0x1){_0x35358e=_0x1aa39d[_0x3ac41a][_0xdd4f('0x42')]();logger[_0xdd4f('0x2a')](_0xdd4f('0x4b'),_0x35358e);if(_0x2b5f56){logger[_0xdd4f('0x2a')](_0xdd4f('0x4c'),_0x2b5f56);logger['info'](JSON[_0xdd4f('0x26')](_0x3f2c4d[_0x35358e]));BPromise[_0xdd4f('0x4d')]()[_0xdd4f('0x39')](handleJob(_0x3f2c4d[_0x35358e]));logger[_0xdd4f('0x2a')](_0xdd4f('0x4e'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}else if(_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]&&_0x3f2c4d[_0x35358e][_0xdd4f('0x50')]&&moment()[_0xdd4f('0x51')](_0x3f2c4d[_0x35358e][_0xdd4f('0x52')],_0x3f2c4d[_0x35358e][_0xdd4f('0x53')])){manager[_0xdd4f('0x54')](_0x35358e,_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')],handleJob(_0x3f2c4d[_0x35358e]));manager['start'](_0x35358e);logger['info'](_0xdd4f('0x55'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e]['cron']);}else if(manager[_0xdd4f('0x47')](_0x35358e)){manager[_0xdd4f('0x48')](_0x35358e);manager['deleteJob'](_0x35358e);logger[_0xdd4f('0x2a')](_0xdd4f('0x56'),_0x3f2c4d[_0x35358e]['name'],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}}for(_0x3ac41a=0x0,_0x35358e;_0x3ac41a<_0x53e0bd[_0xdd4f('0x46')]&&!_0x2b5f56;_0x3ac41a+=0x1){_0x35358e=_0x53e0bd[_0x3ac41a][_0xdd4f('0x42')]();if(manager['exists'](_0x35358e)){if(_0x3f2c4d[_0x35358e]['cron']&&_0x3f2c4d[_0x35358e][_0xdd4f('0x50')]&&moment()[_0xdd4f('0x51')](_0x3f2c4d[_0x35358e][_0xdd4f('0x52')],_0x3f2c4d[_0x35358e][_0xdd4f('0x53')])){manager[_0xdd4f('0x57')](_0x35358e,_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')],handleJob(_0x3f2c4d[_0x35358e]));logger['info'](_0xdd4f('0x58'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}else{manager[_0xdd4f('0x48')](_0x35358e);manager[_0xdd4f('0x49')](_0x35358e);logger[_0xdd4f('0x2a')](_0xdd4f('0x56'),_0x3f2c4d[_0x35358e][_0xdd4f('0x16')],_0x3f2c4d[_0x35358e][_0xdd4f('0x4f')]);}}}})[_0xdd4f('0x2f')](function(_0x3fd070){logger['error'](JSON[_0xdd4f('0x26')](_0x3fd070));});}exports[_0xdd4f('0x59')]=function(_0x57055b){return getJobs(_0x57055b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x400b=['info','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','keyBy','difference','intersection','length','toString','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','stop\x20cron','active','update','update\x20cron','run','start','util','path','jayson/promise','bluebird','../logger','schedule','../../mysqldb','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','format','%s.%s','basename','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','stringify'];(function(_0x534fa5,_0x2d904c){var _0x51c992=function(_0x2f342a){while(--_0x2f342a){_0x534fa5['push'](_0x534fa5['shift']());}};_0x51c992(++_0x2d904c);}(_0x400b,0x7f));var _0xb400=function(_0xf6c441,_0x3b068e){_0xf6c441=_0xf6c441-0x0;var _0x2e073e=_0x400b[_0xf6c441];return _0x2e073e;};'use strict';var fs=require('fs');var util=require(_0xb400('0x0'));var path=require(_0xb400('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xb400('0x2'));var BPromise=require(_0xb400('0x3'));var logger=require(_0xb400('0x4'))(_0xb400('0x5'));var db=require(_0xb400('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xb400('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2ba702,_0x1b6b57){return function(){logger['info'](_0xb400('0x8'),_0x2ba702[_0xb400('0x9')]);var _0x216bf5=!![];var _0xba4f4a={'tls':{'rejectUnauthorized':![]}};if(_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0xc')]){_0xba4f4a[_0xb400('0xc')]=_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0xc')];}else{_0xba4f4a[_0xb400('0xd')]=_0x2ba702[_0xb400('0xa')][_0xb400('0xb')]['host'];_0xba4f4a[_0xb400('0xe')]=_0x2ba702[_0xb400('0xa')]['Smtp'][_0xb400('0xe')];_0xba4f4a[_0xb400('0xf')]=_0x2ba702[_0xb400('0xa')]['Smtp'][_0xb400('0xf')];}if(_0x2ba702['MailAccount']['Smtp'][_0xb400('0x10')]){_0xba4f4a[_0xb400('0x11')]={'user':_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0x12')],'pass':_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0x13')]};}var _0xb08797={'account':_0xba4f4a,'message':{'from':util['format'](_0xb400('0x14'),_0x2ba702['MailAccount'][_0xb400('0x15')],_0x2ba702[_0xb400('0xa')]['email']||_0x2ba702[_0xb400('0xa')][_0xb400('0xb')][_0xb400('0x12')]),'to':_0x2ba702[_0xb400('0x9')],'cc':_0x2ba702['cc'],'bcc':_0x2ba702[_0xb400('0x16')],'subject':util['format'](_0xb400('0x17'),_0x1b6b57['name'],_0x2ba702[_0xb400('0x18')],_0x2ba702['subtractUnit'])}};var _0x4a61b6=path[_0xb400('0x19')](__dirname,_0xb400('0x1a'));var _0x635fd4=_0x1b6b57[_0xb400('0x1b')];var _0x4380fb=util[_0xb400('0x1c')](_0xb400('0x1d'),path[_0xb400('0x1e')](_0x1b6b57[_0xb400('0x1b')],path['extname'](_0x1b6b57[_0xb400('0x1b')])),_0xb400('0x1f'));var _0x1c0efe=path['join'](_0x4a61b6,_0x635fd4);var _0x33ae40=path[_0xb400('0x19')](_0x4a61b6,_0x4380fb);if(fs[_0xb400('0x20')](_0x1c0efe)){_0x1b6b57['status']=_0xb400('0x21');_0xb08797[_0xb400('0x22')][_0xb400('0x23')]=[{'filename':_0x635fd4,'path':_0x1c0efe}];_0xb08797[_0xb400('0x22')][_0xb400('0x24')]=util[_0xb400('0x1c')](_0xb400('0x25'),JSON['stringify'](_0x1b6b57,null,0x2));}else if(fs[_0xb400('0x20')](_0x33ae40)){_0x1b6b57['status']=_0xb400('0x21');_0xb08797['message'][_0xb400('0x23')]=[{'filename':_0x4380fb,'path':_0x33ae40}];}else{_0xb08797['message'][_0xb400('0x24')]=_0xb400('0x26');if(!_0x2ba702[_0xb400('0x27')]){_0x216bf5=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x216bf5){return client[_0xb400('0x28')]('SendMail',_0xb08797)[_0xb400('0x29')](function(_0x49c622){if(_0x49c622[_0xb400('0x2a')]){return logger[_0xb400('0x2a')](_0xb400('0x2b'),JSON[_0xb400('0x2c')](_0x49c622));}return logger[_0xb400('0x2d')]('email\x20sent');})[_0xb400('0x2e')](function(_0x20ea0e){return logger[_0xb400('0x2a')]('error\x20mail',JSON[_0xb400('0x2c')](_0x20ea0e));});}};}function handleError(){return function(_0x5d9529){return logger[_0xb400('0x2a')](JSON[_0xb400('0x2c')](_0x5d9529));};}function handleResult(_0x2f01a1){return function(_0x3ef401){logger[_0xb400('0x2d')](_0xb400('0x2f'),JSON['stringify'](_0x3ef401));if(_0x2f01a1[_0xb400('0xa')]&&_0x2f01a1[_0xb400('0xa')][_0xb400('0xb')]&&!_[_0xb400('0x30')](_0x2f01a1[_0xb400('0x9')])){setTimeout(handleSendEmail(_0x2f01a1,_0x3ef401),0x3c*0x3e8);}};}function handleJob(_0x3a3388){return function(){try{if(_[_0xb400('0x30')](_0x3a3388[_0xb400('0x18')])){return logger[_0xb400('0x2d')](_0xb400('0x31'));}if(_[_0xb400('0x30')](_0x3a3388[_0xb400('0x32')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x4fec20={'startDate':moment()[_0xb400('0x33')](_0x3a3388[_0xb400('0x18')],_0x3a3388['subtractUnit'])[_0xb400('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xb400('0x34')),'type':'scheduled','output':_0x3a3388[_0xb400('0x35')],'name':_0x3a3388[_0xb400('0x15')]};if(!_[_0xb400('0x30')](_0x3a3388[_0xb400('0x36')])){logger[_0xb400('0x2d')]('exec\x20defaul\x20report\x20id:%s',_0x3a3388[_0xb400('0x36')]);return analyticDefaultReportController[_0xb400('0x37')]({'id':_0x3a3388[_0xb400('0x36')]},_0x4fec20)[_0xb400('0x29')](handleResult(_0x3a3388))[_0xb400('0x2e')](handleError());}if(!_[_0xb400('0x30')](_0x3a3388[_0xb400('0x38')])){logger[_0xb400('0x2d')]('exec\x20custom\x20report\x20id:%s',_0x3a3388[_0xb400('0x38')]);return analyticCustomReportController[_0xb400('0x37')]({'id':_0x3a3388[_0xb400('0x38')]},_0x4fec20)['then'](handleResult(_0x3a3388))[_0xb400('0x2e')](handleError());}}catch(_0x53ef24){logger[_0xb400('0x2a')](JSON['stringify'](_0x53ef24));}return logger[_0xb400('0x2d')](_0xb400('0x39'));};}function getJobs(_0x316960){var _0x447c5a={};if(_0x316960){_0x447c5a['id']=_0x316960;}return db[_0xb400('0x3a')][_0xb400('0x3b')]({'where':_0x447c5a,'include':[{'model':db[_0xb400('0xa')],'attributes':['id',_0xb400('0x15'),'email'],'include':[{'model':db[_0xb400('0x3c')],'as':_0xb400('0xb')}]}]})[_0xb400('0x29')](function(_0x266c89){var _0x459d2c=_['keys'](manager[_0xb400('0x3d')]);var _0x5c165c=_[_0xb400('0x3e')](_0x266c89,function(_0x6c710d){return _0x6c710d['id']['toString']();});var _0x20d8bd=_[_0xb400('0x3f')](_0x266c89,function(_0x1f775a){return _0x1f775a['id']['toString']();});var _0x1e8fde=_0x316960?_0x5c165c:_[_0xb400('0x40')](_0x5c165c,_0x459d2c);var _0x808a65=_[_0xb400('0x41')](_0x5c165c,_0x459d2c);var _0x32f34b=_[_0xb400('0x40')](_0x459d2c,_0x5c165c);var _0xd2bea3;var _0xad99d8;for(_0xd2bea3=0x0;_0xd2bea3<_0x32f34b[_0xb400('0x42')]&&!_0x316960;_0xd2bea3+=0x1){_0xad99d8=_0x32f34b[_0xd2bea3][_0xb400('0x43')]();if(manager[_0xb400('0x44')](_0xad99d8)){manager[_0xb400('0x45')](_0xad99d8);manager[_0xb400('0x46')](_0xad99d8);logger[_0xb400('0x2d')](_0xb400('0x47'),_0xad99d8);}}logger[_0xb400('0x2d')]('toRun',JSON['stringify'](_0x1e8fde));for(_0xd2bea3=0x0;_0xd2bea3<_0x1e8fde[_0xb400('0x42')];_0xd2bea3+=0x1){_0xad99d8=_0x1e8fde[_0xd2bea3][_0xb400('0x43')]();logger[_0xb400('0x2d')](_0xb400('0x48'),_0xad99d8);if(_0x316960){logger[_0xb400('0x2d')](_0xb400('0x49'),_0x316960);logger['info'](JSON[_0xb400('0x2c')](_0x20d8bd[_0xad99d8]));BPromise[_0xb400('0x4a')]()['then'](handleJob(_0x20d8bd[_0xad99d8]));logger['info'](_0xb400('0x4b'),_0x20d8bd[_0xad99d8]['name'],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}else if(_0x20d8bd[_0xad99d8][_0xb400('0x4c')]&&_0x20d8bd[_0xad99d8]['active']&&moment()[_0xb400('0x4d')](_0x20d8bd[_0xad99d8][_0xb400('0x4e')],_0x20d8bd[_0xad99d8][_0xb400('0x4f')])){manager['add'](_0xad99d8,_0x20d8bd[_0xad99d8][_0xb400('0x4c')],handleJob(_0x20d8bd[_0xad99d8]));manager['start'](_0xad99d8);logger['info']('add\x20cron',_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}else if(manager[_0xb400('0x44')](_0xad99d8)){manager[_0xb400('0x45')](_0xad99d8);manager[_0xb400('0x46')](_0xad99d8);logger[_0xb400('0x2d')](_0xb400('0x50'),_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}}for(_0xd2bea3=0x0,_0xad99d8;_0xd2bea3<_0x808a65['length']&&!_0x316960;_0xd2bea3+=0x1){_0xad99d8=_0x808a65[_0xd2bea3][_0xb400('0x43')]();if(manager[_0xb400('0x44')](_0xad99d8)){if(_0x20d8bd[_0xad99d8][_0xb400('0x4c')]&&_0x20d8bd[_0xad99d8][_0xb400('0x51')]&&moment()[_0xb400('0x4d')](_0x20d8bd[_0xad99d8][_0xb400('0x4e')],_0x20d8bd[_0xad99d8][_0xb400('0x4f')])){manager[_0xb400('0x52')](_0xad99d8,_0x20d8bd[_0xad99d8][_0xb400('0x4c')],handleJob(_0x20d8bd[_0xad99d8]));logger[_0xb400('0x2d')](_0xb400('0x53'),_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8][_0xb400('0x4c')]);}else{manager[_0xb400('0x45')](_0xad99d8);manager[_0xb400('0x46')](_0xad99d8);logger[_0xb400('0x2d')](_0xb400('0x50'),_0x20d8bd[_0xad99d8][_0xb400('0x15')],_0x20d8bd[_0xad99d8]['cron']);}}}})[_0xb400('0x2e')](function(_0x1ac1b1){logger[_0xb400('0x2a')](JSON[_0xb400('0x2c')](_0x1ac1b1));});}exports[_0xb400('0x54')]=function(_0x4c536b){return getJobs(_0x4c536b);};exports[_0xb400('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index ab38a84..ebb57dd 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 _0x16bd=['inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','request-promise','util','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','tempSentiment','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Sentiment','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x424ebf,_0x4c64d3){var _0x4c6aef=function(_0x3e17eb){while(--_0x3e17eb){_0x424ebf['push'](_0x424ebf['shift']());}};_0x4c6aef(++_0x4c64d3);}(_0x16bd,0x16a));var _0xd16b=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0x16bd[_0x11b1b3];return _0x437029;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xd16b('0x0'));var util=require(_0xd16b('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xd16b('0x2'))(_0xd16b('0x3'));function getTranscriptionJob(_0x68b591,_0x2b1f1b,_0x2f6163,_0x584e95){return new Promise(function(_0x2fafa5,_0x4ccb64){var _0x3cf684=new AWS[(_0xd16b('0x4'))]({'accessKeyId':_0x2b1f1b,'secretAccessKey':_0x68b591,'region':_0x2f6163});_0x3cf684['getTranscriptionJob']({'TranscriptionJobName':_0x584e95},function(_0x16e77e,_0x386c0e){if(_0x16e77e){return _0x4ccb64(_0x16e77e);}else{return _0x2fafa5(_0x386c0e);}});});}function sentiment(_0x33f52a,_0x46add8,_0xf382ae,_0x510104,_0x8df5c7){return new Promise(function(_0x329891,_0x43cfbc){var _0x376914=new AWS[(_0xd16b('0x5'))]({'accessKeyId':_0x46add8,'secretAccessKey':_0x33f52a,'region':_0xf382ae});_0x376914[_0xd16b('0x6')]({'Text':_0x510104,'LanguageCode':_0x8df5c7[_0xd16b('0x7')](0x0,0x2)},function(_0x495e3e,_0x4dc990){if(_0x495e3e){return _0x43cfbc(_0x495e3e);}else{return _0x329891(_0x4dc990);}});});}function checkTranscribeJob(_0x1962d2,_0x2fd3f6,_0x1182d4){var _0x449955;return new BPromise(function(_0x4fef4b,_0x2469eb){logger['info'](util[_0xd16b('0x8')](_0xd16b('0x9'),_0x1962d2['id'],_0x1962d2['transcribeName']));return getTranscriptionJob(_0x1182d4[_0xd16b('0xa')],_0x1182d4[_0xd16b('0xb')],_0x2fd3f6[_0xd16b('0xc')],_0x1962d2[_0xd16b('0xd')])[_0xd16b('0xe')](function(_0x28a37c){logger[_0xd16b('0xf')](util['format'](_0xd16b('0x10'),_0x1962d2['id'],_0x1962d2['transcribeName'],_0x28a37c[_0xd16b('0x11')][_0xd16b('0x12')]));if(!_0x1962d2[_0xd16b('0x13')]){switch(_0x28a37c['TranscriptionJob'][_0xd16b('0x12')]){case'COMPLETED':var _0x1d06e9={'transcribeStatus':_0x28a37c['TranscriptionJob'][_0xd16b('0x12')],'fileUri':_0x28a37c['TranscriptionJob'][_0xd16b('0x14')][_0xd16b('0x15')]};logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Get\x20transcript',_0x1962d2['id']));return rp({'uri':_0x28a37c[_0xd16b('0x11')]['Transcript'][_0xd16b('0x15')],'json':!![]})[_0xd16b('0xe')](function(_0x529325){logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x16'),_0x1962d2['id']));if(_0x529325&&_0x529325[_0xd16b('0x17')]&&_0x529325['results'][_0xd16b('0x18')]&&_0x529325[_0xd16b('0x17')]['transcripts']['length']){_0x1d06e9[_0xd16b('0x13')]='';for(var _0x428d41=0x0;_0x428d41<_0x529325[_0xd16b('0x17')][_0xd16b('0x18')]['length'];_0x428d41++){_0x1d06e9[_0xd16b('0x13')]+=_0x529325['results'][_0xd16b('0x18')][_0x428d41][_0xd16b('0x19')]+'';}}return _0x1962d2['update'](_0x1d06e9);})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1962d2['id']));if(!_0x1962d2['tempSentiment']){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x1c'));}if(!_0x2fd3f6[_0xd16b('0x1d')]||!_0x2fd3f6[_0xd16b('0x1e')]||!_0x2fd3f6[_0xd16b('0x1f')]||!_0x2fd3f6[_0xd16b('0x20')]||!_0x2fd3f6[_0xd16b('0x21')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x22'));}if(!_0x1d06e9[_0xd16b('0x13')]){throw new Error(_0xd16b('0x23'));}if(_0x2fd3f6[_0xd16b('0x1e')]===_0x1182d4['id']){return _0x1182d4;}else{return db[_0xd16b('0x24')][_0xd16b('0x25')]({'where':{'id':_settings[_0xd16b('0x1e')]}});}})[_0xd16b('0xe')](function(_0x4ed516){if(!_0x4ed516){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4ed516[_0xd16b('0xa')]||!_0x4ed516[_0xd16b('0xb')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x449955=_0x4ed516;logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x26'),_0x1962d2['id']));return sentiment(_0x449955[_0xd16b('0xa')],_0x449955[_0xd16b('0xb')],_0x2fd3f6[_0xd16b('0x1f')],_0x1d06e9[_0xd16b('0x13')],_0x2fd3f6[_0xd16b('0x20')]);})[_0xd16b('0xe')](function(_0x286192){logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1962d2['id']));return _0x1962d2[_0xd16b('0x27')]({'sentiment':_0x286192['Sentiment'],'sPositive':_0x286192['SentimentScore'][_0xd16b('0x28')],'sNegative':_0x286192[_0xd16b('0x29')][_0xd16b('0x2a')],'sMixed':_0x286192[_0xd16b('0x29')][_0xd16b('0x2b')],'sNeutral':_0x286192[_0xd16b('0x29')][_0xd16b('0x2c')]});})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x2d'),_0x1962d2['id']));_0x4fef4b();});case _0xd16b('0x2e'):return _0x1962d2[_0xd16b('0x27')]({'transcribeStatus':'FAILED','failureReason':_0x28a37c[_0xd16b('0x11')]['FailureReason']})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util['format'](_0xd16b('0x2d'),_0x1962d2['id']));_0x4fef4b();});default:logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x1962d2['id']));break;}}else{return BPromise[_0xd16b('0x2f')]()[_0xd16b('0xe')](function(){if(!_0x1962d2[_0xd16b('0x30')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2fd3f6[_0xd16b('0x1d')]||!_0x2fd3f6['sentimentAccountId']||!_0x2fd3f6['sentimentRegion']||!_0x2fd3f6['language']||!_0x2fd3f6[_0xd16b('0x21')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x22'));}if(!_0x1962d2['fileText']){throw new Error(_0xd16b('0x23'));}if(_0x2fd3f6['sentimentAccountId']===_0x1182d4['id']){return _0x1182d4;}else{return db[_0xd16b('0x24')][_0xd16b('0x25')]({'where':{'id':_settings[_0xd16b('0x1e')]}});}})['then'](function(_0x267ed4){if(!_0x267ed4){throw new db['Sequelize'][(_0xd16b('0x1b'))](_0xd16b('0x31'));}if(!_0x267ed4[_0xd16b('0xa')]||!_0x267ed4['data2']){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x32'));}_0x449955=_0x267ed4;logger[_0xd16b('0xf')](util[_0xd16b('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1962d2['id']));return sentiment(_0x449955[_0xd16b('0xa')],_0x449955[_0xd16b('0xb')],_0x2fd3f6[_0xd16b('0x1f')],_0x1962d2[_0xd16b('0x13')],_0x2fd3f6[_0xd16b('0x20')]);})[_0xd16b('0xe')](function(_0x52240c){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1962d2['id']));return _0x1962d2[_0xd16b('0x27')]({'sentiment':_0x52240c[_0xd16b('0x33')],'sPositive':_0x52240c[_0xd16b('0x29')][_0xd16b('0x28')],'sNegative':_0x52240c[_0xd16b('0x29')][_0xd16b('0x2a')],'sMixed':_0x52240c['SentimentScore'][_0xd16b('0x2b')],'sNeutral':_0x52240c[_0xd16b('0x29')][_0xd16b('0x2c')],'transcribeStatus':_0xd16b('0x34')});})[_0xd16b('0xe')](function(){logger[_0xd16b('0xf')](util[_0xd16b('0x8')](_0xd16b('0x2d'),_0x1962d2['id']));_0x4fef4b();});}})[_0xd16b('0x35')](function(_0x52c728){if(_0x52c728){if(!_0x52c728[_0xd16b('0x36')]||_0x52c728['name']!==_0xd16b('0x37')){logger[_0xd16b('0x38')](util[_0xd16b('0x8')](_0xd16b('0x39'),_0x1962d2['id']),util[_0xd16b('0x3a')](_0x52c728,{'showHidden':![],'depth':null}));}}_0x4fef4b();});});}function checkTranscribe(){var _0x49a375;var _0x1c6728;var _0x56c5f0;return db[_0xd16b('0x3b')][_0xd16b('0x3c')]({'where':{'transcribeStatus':_0xd16b('0x3d')}})[_0xd16b('0xe')](function(_0x2e72d4){if(!_0x2e72d4||!_0x2e72d4[_0xd16b('0x3e')]){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x3f'));}_0x49a375=_0x2e72d4;return db['Setting'][_0xd16b('0x25')]({'where':{'id':0x1}});})['then'](function(_0x245b8c){if(!_0x245b8c){throw new db['Sequelize'][(_0xd16b('0x1b'))](_0xd16b('0x40'));}_0x1c6728=_0x245b8c;if(!_0x1c6728[_0xd16b('0x3')]||!_0x1c6728[_0xd16b('0x41')]||!_0x1c6728[_0xd16b('0xc')]||!_0x1c6728[_0xd16b('0x20')]||!_0x1c6728['bucket']){throw new db['Sequelize'][(_0xd16b('0x1b'))](_0xd16b('0x42'));}return db[_0xd16b('0x24')][_0xd16b('0x25')]({'where':{'id':_0x1c6728[_0xd16b('0x41')]}});})[_0xd16b('0xe')](function(_0x528297){if(!_0x528297){throw new db[(_0xd16b('0x1a'))][(_0xd16b('0x1b'))](_0xd16b('0x31'));}if(!_0x528297['data1']||!_0x528297[_0xd16b('0xb')]){throw new db['Sequelize']['ValidationError'](_0xd16b('0x32'));}_0x56c5f0=_0x528297;var _0x3cc4ef=[];_0x49a375[_0xd16b('0x43')](function(_0x4ece6a){_0x3cc4ef[_0xd16b('0x44')](checkTranscribeJob(_0x4ece6a,_0x1c6728,_0x56c5f0));});return BPromise[_0xd16b('0x45')](_0x3cc4ef);})[_0xd16b('0x35')](function(_0x5a7f6d){if(_0x5a7f6d){if(!_0x5a7f6d[_0xd16b('0x36')]||_0x5a7f6d['name']!==_0xd16b('0x37')){logger[_0xd16b('0x38')](util['inspect'](_0x5a7f6d,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe24b=['request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20configured','catch','SequelizeValidationError','error','VoiceRecording','findAll','Setting','transcribeAccountId','forEach','push','name','start','lodash','aws-sdk'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xe24b,0x1da));var _0xbe24=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xe24b[_0x2f5a22];return _0x326b70;};var _=require(_0xbe24('0x0'));var AWS=require(_0xbe24('0x1'));var rp=require(_0xbe24('0x2'));var util=require(_0xbe24('0x3'));var BPromise=require(_0xbe24('0x4'));var db=require(_0xbe24('0x5'))['db'];var logger=require(_0xbe24('0x6'))(_0xbe24('0x7'));function getTranscriptionJob(_0x1b5d11,_0x4b1419,_0x5cb582,_0x24da15){return new Promise(function(_0x55d723,_0xd16ea5){var _0x317e46=new AWS[(_0xbe24('0x8'))]({'accessKeyId':_0x4b1419,'secretAccessKey':_0x1b5d11,'region':_0x5cb582});_0x317e46['getTranscriptionJob']({'TranscriptionJobName':_0x24da15},function(_0x2e6970,_0x3721b2){if(_0x2e6970){return _0xd16ea5(_0x2e6970);}else{return _0x55d723(_0x3721b2);}});});}function sentiment(_0x9f707d,_0x43f898,_0x1d11d6,_0x2d11b7,_0x4ff4ec){return new Promise(function(_0x3a4d1f,_0x4e878f){var _0x56cd73=new AWS['Comprehend']({'accessKeyId':_0x43f898,'secretAccessKey':_0x9f707d,'region':_0x1d11d6});_0x56cd73[_0xbe24('0x9')]({'Text':_0x2d11b7,'LanguageCode':_0x4ff4ec[_0xbe24('0xa')](0x0,0x2)},function(_0x1d7afa,_0xa300d5){if(_0x1d7afa){return _0x4e878f(_0x1d7afa);}else{return _0x3a4d1f(_0xa300d5);}});});}function checkTranscribeJob(_0x2c4bff,_0x2962cb,_0x436928){var _0x2281a8;return new BPromise(function(_0x215291,_0x1d485d){logger['info'](util[_0xbe24('0xb')](_0xbe24('0xc'),_0x2c4bff['id'],_0x2c4bff[_0xbe24('0xd')]));return getTranscriptionJob(_0x436928[_0xbe24('0xe')],_0x436928[_0xbe24('0xf')],_0x2962cb[_0xbe24('0x10')],_0x2c4bff['transcribeName'])[_0xbe24('0x11')](function(_0x5dbad6){logger['info'](util[_0xbe24('0xb')](_0xbe24('0x12'),_0x2c4bff['id'],_0x2c4bff[_0xbe24('0xd')],_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x14')]));if(!_0x2c4bff[_0xbe24('0x15')]){switch(_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x14')]){case _0xbe24('0x16'):var _0x3aafa9={'transcribeStatus':_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x14')],'fileUri':_0x5dbad6[_0xbe24('0x13')]['Transcript'][_0xbe24('0x17')]};logger[_0xbe24('0x18')](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x2c4bff['id']));return rp({'uri':_0x5dbad6[_0xbe24('0x13')]['Transcript'][_0xbe24('0x17')],'json':!![]})[_0xbe24('0x11')](function(_0x64aa44){logger[_0xbe24('0x18')](util[_0xbe24('0xb')](_0xbe24('0x19'),_0x2c4bff['id']));if(_0x64aa44&&_0x64aa44['results']&&_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')]&&_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')][_0xbe24('0x1c')]){_0x3aafa9[_0xbe24('0x15')]='';for(var _0x1ac651=0x0;_0x1ac651<_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')][_0xbe24('0x1c')];_0x1ac651++){_0x3aafa9[_0xbe24('0x15')]+=_0x64aa44[_0xbe24('0x1a')][_0xbe24('0x1b')][_0x1ac651][_0xbe24('0x1d')]+'';}}return _0x2c4bff['update'](_0x3aafa9);})['then'](function(){logger[_0xbe24('0x18')](util['format'](_0xbe24('0x1e'),_0x2c4bff['id']));if(!_0x2c4bff[_0xbe24('0x1f')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2962cb[_0xbe24('0x22')]||!_0x2962cb['sentimentAccountId']||!_0x2962cb['sentimentRegion']||!_0x2962cb['language']||!_0x2962cb[_0xbe24('0x23')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x24'));}if(!_0x3aafa9[_0xbe24('0x15')]){throw new Error(_0xbe24('0x25'));}if(_0x2962cb['sentimentAccountId']===_0x436928['id']){return _0x436928;}else{return db[_0xbe24('0x26')][_0xbe24('0x27')]({'where':{'id':_settings[_0xbe24('0x28')]}});}})['then'](function(_0x4d6441){if(!_0x4d6441){throw new db[(_0xbe24('0x20'))]['ValidationError'](_0xbe24('0x29'));}if(!_0x4d6441[_0xbe24('0xe')]||!_0x4d6441[_0xbe24('0xf')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x2281a8=_0x4d6441;logger[_0xbe24('0x18')](util[_0xbe24('0xb')](_0xbe24('0x2a'),_0x2c4bff['id']));return sentiment(_0x2281a8[_0xbe24('0xe')],_0x2281a8[_0xbe24('0xf')],_0x2962cb[_0xbe24('0x2b')],_0x3aafa9['fileText'],_0x2962cb[_0xbe24('0x2c')]);})[_0xbe24('0x11')](function(_0x3af21f){logger['info'](util['format'](_0xbe24('0x2d'),_0x2c4bff['id']));return _0x2c4bff[_0xbe24('0x2e')]({'sentiment':_0x3af21f[_0xbe24('0x2f')],'sPositive':_0x3af21f[_0xbe24('0x30')]['Positive'],'sNegative':_0x3af21f[_0xbe24('0x30')][_0xbe24('0x31')],'sMixed':_0x3af21f[_0xbe24('0x30')][_0xbe24('0x32')],'sNeutral':_0x3af21f[_0xbe24('0x30')][_0xbe24('0x33')]});})[_0xbe24('0x11')](function(){logger[_0xbe24('0x18')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c4bff['id']));_0x215291();});case _0xbe24('0x34'):return _0x2c4bff[_0xbe24('0x2e')]({'transcribeStatus':_0xbe24('0x34'),'failureReason':_0x5dbad6[_0xbe24('0x13')][_0xbe24('0x35')]})[_0xbe24('0x11')](function(){logger['info'](util['format'](_0xbe24('0x1e'),_0x2c4bff['id']));_0x215291();});default:logger['info'](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2c4bff['id']));break;}}else{return BPromise[_0xbe24('0x36')]()['then'](function(){if(!_0x2c4bff[_0xbe24('0x1f')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x37'));}if(!_0x2962cb['sentiment']||!_0x2962cb['sentimentAccountId']||!_0x2962cb[_0xbe24('0x2b')]||!_0x2962cb['language']||!_0x2962cb[_0xbe24('0x23')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x24'));}if(!_0x2c4bff[_0xbe24('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x2962cb[_0xbe24('0x28')]===_0x436928['id']){return _0x436928;}else{return db[_0xbe24('0x26')][_0xbe24('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xbe24('0x11')](function(_0x1907fe){if(!_0x1907fe){throw new db['Sequelize']['ValidationError'](_0xbe24('0x29'));}if(!_0x1907fe[_0xbe24('0xe')]||!_0x1907fe[_0xbe24('0xf')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x38'));}_0x2281a8=_0x1907fe;logger[_0xbe24('0x18')](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2c4bff['id']));return sentiment(_0x2281a8[_0xbe24('0xe')],_0x2281a8['data2'],_0x2962cb['sentimentRegion'],_0x2c4bff[_0xbe24('0x15')],_0x2962cb['language']);})[_0xbe24('0x11')](function(_0x3a31cd){logger[_0xbe24('0x18')](util[_0xbe24('0xb')](_0xbe24('0x2d'),_0x2c4bff['id']));return _0x2c4bff['update']({'sentiment':_0x3a31cd[_0xbe24('0x2f')],'sPositive':_0x3a31cd[_0xbe24('0x30')]['Positive'],'sNegative':_0x3a31cd[_0xbe24('0x30')][_0xbe24('0x31')],'sMixed':_0x3a31cd[_0xbe24('0x30')][_0xbe24('0x32')],'sNeutral':_0x3a31cd['SentimentScore']['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xbe24('0x11')](function(){logger[_0xbe24('0x18')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c4bff['id']));_0x215291();});}})[_0xbe24('0x39')](function(_0x89837f){if(_0x89837f){if(!_0x89837f['name']||_0x89837f['name']!==_0xbe24('0x3a')){logger[_0xbe24('0x3b')](util[_0xbe24('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2c4bff['id']),util['inspect'](_0x89837f,{'showHidden':![],'depth':null}));}}_0x215291();});});}function checkTranscribe(){var _0x2dee5e;var _0xeaed72;var _0x30db39;return db[_0xbe24('0x3c')][_0xbe24('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x2d7670){if(!_0x2d7670||!_0x2d7670['length']){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2dee5e=_0x2d7670;return db[_0xbe24('0x3e')][_0xbe24('0x27')]({'where':{'id':0x1}});})[_0xbe24('0x11')](function(_0x410c22){if(!_0x410c22){throw new db['Sequelize'][(_0xbe24('0x21'))]('Settings\x20not\x20available');}_0xeaed72=_0x410c22;if(!_0xeaed72[_0xbe24('0x7')]||!_0xeaed72[_0xbe24('0x3f')]||!_0xeaed72[_0xbe24('0x10')]||!_0xeaed72[_0xbe24('0x2c')]||!_0xeaed72[_0xbe24('0x23')]){throw new db['Sequelize'][(_0xbe24('0x21'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xbe24('0x27')]({'where':{'id':_0xeaed72['transcribeAccountId']}});})[_0xbe24('0x11')](function(_0x831c86){if(!_0x831c86){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))](_0xbe24('0x29'));}if(!_0x831c86[_0xbe24('0xe')]||!_0x831c86[_0xbe24('0xf')]){throw new db[(_0xbe24('0x20'))][(_0xbe24('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x30db39=_0x831c86;var _0x1bbd0b=[];_0x2dee5e[_0xbe24('0x40')](function(_0x444411){_0x1bbd0b[_0xbe24('0x41')](checkTranscribeJob(_0x444411,_0xeaed72,_0x30db39));});return BPromise['all'](_0x1bbd0b);})[_0xbe24('0x39')](function(_0x12cbef){if(_0x12cbef){if(!_0x12cbef[_0xbe24('0x42')]||_0x12cbef[_0xbe24('0x42')]!==_0xbe24('0x3a')){logger[_0xbe24('0x3b')](util['inspect'](_0x12cbef,{'showHidden':![],'depth':null}));}}});}exports[_0xbe24('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2da2734..7b3942c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9901=['bulkCreate','log','contacts1','CmHopper','destroy','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','push','innocenzo.biondo','@xcally.com','now','then','CmContact'];(function(_0x10e568,_0x4cdd92){var _0x2257de=function(_0x55ccc4){while(--_0x55ccc4){_0x10e568['push'](_0x10e568['shift']());}};_0x2257de(++_0x4cdd92);}(_0x9901,0x1d1));var _0x1990=function(_0x2c34ff,_0x1e8bee){_0x2c34ff=_0x2c34ff-0x0;var _0x476508=_0x9901[_0x2c34ff];return _0x476508;};'use strict';var util=require(_0x1990('0x0'));var db=require(_0x1990('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1990('0x2')+i,'lastName':_0x1990('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1990('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1990('0x4')]({'id':i,'firstName':_0x1990('0x2')+i,'lastName':_0x1990('0x3')+i,'phone':0xf879fb460+i,'email':_0x1990('0x5')+i+_0x1990('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x1990('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1990('0x7')](),'updatedAt':Date[_0x1990('0x7')]()});}db['CmContact']['destroy']({'where':{}})[_0x1990('0x8')](function(){return db[_0x1990('0x9')][_0x1990('0xa')](contacts);})[_0x1990('0x8')](function(){console[_0x1990('0xb')]('finished\x20populating',_0x1990('0xc'));return db[_0x1990('0xd')][_0x1990('0xe')]({'where':{}});})['then'](function(){return db[_0x1990('0xd')][_0x1990('0xa')](hopper);})[_0x1990('0x8')](function(){console[_0x1990('0xb')](_0x1990('0xf'),'hopper1');return db[_0x1990('0x9')]['bulkCreate'](contacts2);})[_0x1990('0x8')](function(){console[_0x1990('0xb')](_0x1990('0xf'),_0x1990('0x10'));return db[_0x1990('0xd')][_0x1990('0xa')](hopper2);})[_0x1990('0x8')](function(){console[_0x1990('0xb')]('finished\x20populating',_0x1990('0x11'));})[_0x1990('0x12')](function(_0x1c25fb){console[_0x1990('0xb')](_0x1c25fb);}); \ No newline at end of file +var _0x0801=['CmContact','destroy','bulkCreate','then','log','finished\x20populating','hopper1','CmHopper','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x77a260,_0x407209){var _0x30e22a=function(_0xb6c00a){while(--_0xb6c00a){_0x77a260['push'](_0x77a260['shift']());}};_0x30e22a(++_0x407209);}(_0x0801,0xb4));var _0x1080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0801[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1080('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1080('0x1')]({'id':i,'firstName':_0x1080('0x2')+i,'lastName':_0x1080('0x3')+i,'phone':0xf879fb460+i,'email':_0x1080('0x4')+i+_0x1080('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1080('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1080('0x6')](),'updatedAt':Date[_0x1080('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x1080('0x2')+i,'lastName':_0x1080('0x3')+i,'phone':0xf879fb460+i,'email':_0x1080('0x4')+i+_0x1080('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1080('0x6')](),'updatedAt':Date[_0x1080('0x6')]()});}db[_0x1080('0x7')][_0x1080('0x8')]({'where':{}})['then'](function(){return db[_0x1080('0x7')][_0x1080('0x9')](contacts);})[_0x1080('0xa')](function(){console[_0x1080('0xb')](_0x1080('0xc'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})[_0x1080('0xa')](function(){return db['CmHopper'][_0x1080('0x9')](hopper);})['then'](function(){console[_0x1080('0xb')](_0x1080('0xc'),_0x1080('0xd'));return db[_0x1080('0x7')]['bulkCreate'](contacts2);})[_0x1080('0xa')](function(){console[_0x1080('0xb')](_0x1080('0xc'),'contacts2');return db[_0x1080('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0x1080('0xb')](_0x1080('0xc'),_0x1080('0xf'));})[_0x1080('0x10')](function(_0x1d9145){console[_0x1080('0xb')](_0x1d9145);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1a68a8d..d9e2d04 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8981=['format','%s%s@xcally.com','password','udp','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','%s%s','agent'];(function(_0x108cd1,_0xbfd7ff){var _0x2d205f=function(_0xce8f31){while(--_0xce8f31){_0x108cd1['push'](_0x108cd1['shift']());}};_0x2d205f(++_0xbfd7ff);}(_0x8981,0x79));var _0x1898=function(_0x61445a,_0x3ad70b){_0x61445a=_0x61445a-0x0;var _0x227eec=_0x8981[_0x61445a];return _0x227eec;};'use strict';var util=require(_0x1898('0x0'));var db=require(_0x1898('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1898('0x2')]({'name':util['format'](_0x1898('0x3'),_0x1898('0x4'),i),'fullname':util[_0x1898('0x5')]('%s%s',_0x1898('0x4'),i),'email':util[_0x1898('0x5')](_0x1898('0x6'),_0x1898('0x4'),i),'role':_0x1898('0x4'),'password':_0x1898('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x1898('0x8'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x1898('0x5')](_0x1898('0x3'),'agent',i),'encryption':_0x1898('0x9'),'avpf':_0x1898('0x9'),'force_avp':'yes','icesupport':_0x1898('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x1898('0xa'),'dtlsprivatekey':_0x1898('0xb'),'dtlssetup':'actpass','callerid':util[_0x1898('0x5')](_0x1898('0xc'),util[_0x1898('0x5')](_0x1898('0x3'),_0x1898('0x4'),i),0xfa0+i)});}db[_0x1898('0xd')][_0x1898('0xe')](users)[_0x1898('0xf')](function(){console[_0x1898('0x10')](_0x1898('0x11'));})['catch'](function(_0xfdfe66){console[_0x1898('0x10')](_0xfdfe66);}); \ No newline at end of file +var _0x34b1=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','../mysqldb','%s%s','format','agent','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x34b1,0x83));var _0x134b=function(_0x4e0d45,_0x55f937){_0x4e0d45=_0x4e0d45-0x0;var _0xb25758=_0x34b1[_0x4e0d45];return _0xb25758;};'use strict';var util=require('util');var db=require(_0x134b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x134b('0x1'),'agent',i),'fullname':util[_0x134b('0x2')](_0x134b('0x1'),_0x134b('0x3'),i),'email':util['format'](_0x134b('0x4'),_0x134b('0x3'),i),'role':_0x134b('0x3'),'password':_0x134b('0x5'),'internal':0xfa0+i,'type':_0x134b('0x6'),'transport':[_0x134b('0x7'),'ws',_0x134b('0x8')],'disallow':[_0x134b('0x9')],'allow':[_0x134b('0xa')],'defaultuser':util[_0x134b('0x2')](_0x134b('0x1'),_0x134b('0x3'),i),'encryption':_0x134b('0xb'),'avpf':'yes','force_avp':_0x134b('0xb'),'icesupport':_0x134b('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x134b('0xc'),'dtlsprivatekey':_0x134b('0xd'),'dtlssetup':_0x134b('0xe'),'callerid':util[_0x134b('0x2')](_0x134b('0xf'),util[_0x134b('0x2')](_0x134b('0x1'),_0x134b('0x3'),i),0xfa0+i)});}db[_0x134b('0x10')][_0x134b('0x11')](users)[_0x134b('0x12')](function(){console[_0x134b('0x13')]('add\x20user');})['catch'](function(_0x4272ed){console['log'](_0x4272ed);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 54a6b06..99a9d38 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a45=['SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','VoiceQueue','ChatQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','connectedAt'];(function(_0x56a12d,_0x13960b){var _0x2b06cd=function(_0x151282){while(--_0x151282){_0x56a12d['push'](_0x56a12d['shift']());}};_0x2b06cd(++_0x13960b);}(_0x4a45,0x6b));var _0x54a4=function(_0x178b54,_0x2ddb75){_0x178b54=_0x178b54-0x0;var _0x169aff=_0x4a45[_0x178b54];return _0x169aff;};'use strict';var _=require(_0x54a4('0x0'));var util=require(_0x54a4('0x1'));var BPromise=require(_0x54a4('0x2'));var db=require(_0x54a4('0x3'))['db'];var config=require(_0x54a4('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x54a4('0x5'),'model':db[_0x54a4('0x6')],'attributes':['id',_0x54a4('0x7'),_0x54a4('0x8')],'raw':!![],'where':{'role':_0x54a4('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x54a4('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x54a4('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x54a4('0x7')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x54a4('0xb')],'where':{'type':_0x54a4('0xc')}};function getAssociatedResources(_0x260b8a,_0x3169ee,_0x1501bd){return db['UserProfileSection'][_0x54a4('0xd')]({'where':{'name':_0x260b8a,'userProfileId':_0x3169ee},'raw':!![]})[_0x54a4('0xe')](function(_0x311171){if(_0x311171){if(_0x311171[_0x54a4('0xf')]){switch(_0x260b8a){case'VoiceQueues':case'ChatQueues':case _0x54a4('0x10'):case _0x54a4('0x11'):case _0x54a4('0x12'):case'OpenchannelQueues':case _0x54a4('0x13'):return db[_0x1501bd][_0x54a4('0x14')](queryQueues);case _0x54a4('0x15'):return db[_0x1501bd]['findAll'](queryTelephones);case _0x54a4('0x16'):return db[_0x1501bd][_0x54a4('0x14')](queryTrunks);case _0x54a4('0x17'):return db[_0x1501bd][_0x54a4('0x14')](queryCampaigns);}}else{return db[_0x54a4('0x18')]['findAll']({'attributes':[_0x54a4('0x19')],'where':{'sectionId':_0x311171['id']},'raw':!![]})[_0x54a4('0xe')](function(_0x5081f5){if(_0x5081f5){var _0x231087={'where':{'id':_[_0x54a4('0x1a')](_0x5081f5,_0x54a4('0x19'))},'raw':!![]};switch(_0x1501bd){case _0x54a4('0x6'):_0x231087['where'][_0x54a4('0x8')]=_0x54a4('0xa');break;case'Campaign':_0x231087['where'][_0x54a4('0xb')]=_0x54a4('0xc');break;}return db[_0x1501bd][_0x54a4('0x14')](_0x231087);}else{return[];}});}}else{return[];}})[_0x54a4('0xe')](function(_0x20d422){return _0x20d422;});}function joinOrLeaveQueues(_0x46b8be,_0x3cf39b,_0x15f9cd,_0x388d48){_0x46b8be[_0x3cf39b](util[_0x54a4('0x1b')](_0x54a4('0x1c'),_0x15f9cd,_0x388d48[_0x54a4('0x7')]));if(_0x388d48[_0x54a4('0x5')]){for(var _0x5d8656=0x0;_0x5d8656<_0x388d48[_0x54a4('0x5')]['length'];_0x5d8656+=0x1){_0x46b8be[_0x3cf39b](util[_0x54a4('0x1b')](_0x54a4('0x1d'),_0x388d48[_0x54a4('0x5')][_0x5d8656][_0x54a4('0x7')]));}}}function joinOrLeave(_0x4d8e50,_0x4bff0f,_0x5d927e){var _0x31a870;if(_0x4d8e50[_0x54a4('0x1e')][_0x54a4('0x1f')]['id']){db['User'][_0x54a4('0x20')]({'attributes':['id',_0x54a4('0x7'),_0x54a4('0x8'),_0x54a4('0x21')],'where':{'id':_0x4d8e50[_0x54a4('0x1e')][_0x54a4('0x1f')]['id']},'include':[{'model':db[_0x54a4('0x22')],'as':_0x54a4('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x24')],'as':_0x54a4('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x26')],'as':_0x54a4('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x28')],'as':_0x54a4('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x54a4('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x54a4('0x2b')],'as':_0x54a4('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x54a4('0xe')](function(_0x5262d6){if(_0x5262d6){_0x31a870=_0x5262d6;_0x4d8e50[_0x4bff0f](util['format'](_0x54a4('0x1d'),_0x5262d6[_0x54a4('0x7')]));var _0x5a016b=[];switch(_0x5262d6[_0x54a4('0x8')]){case _0x54a4('0x2d'):_0x4d8e50[_0x4bff0f](_0x54a4('0x2e'));_0x4d8e50[_0x4bff0f](_0x54a4('0x2f'));if(queryQueues[_0x54a4('0x30')](_0x54a4('0x31'))){delete queryQueues[_0x54a4('0x31')];}_0x5a016b['push'](db['VoiceQueue'][_0x54a4('0x14')](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x33')][_0x54a4('0x14')](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x34')][_0x54a4('0x14')](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x35')]['findAll'](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x36')]['findAll'](queryQueues));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x37')][_0x54a4('0x14')](queryQueues));_0x5a016b['push'](db[_0x54a4('0x38')]['findAll'](queryQueues));_0x5a016b[_0x54a4('0x32')](db['User'][_0x54a4('0x14')](queryTelephones));_0x5a016b['push'](db[_0x54a4('0x39')][_0x54a4('0x14')](queryTrunks));_0x5a016b[_0x54a4('0x32')](db[_0x54a4('0x3a')][_0x54a4('0x14')](queryCampaigns));_0x5a016b['push'](db[_0x54a4('0x6')][_0x54a4('0x14')](queryAgents));break;case _0x54a4('0x3b'):_0x4d8e50[_0x4bff0f](_0x54a4('0x2e'));_0x4d8e50[_0x4bff0f](_0x54a4('0x2f'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources('VoiceQueues',_0x5262d6['userProfileId'],_0x54a4('0x3c')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x3d'),_0x5262d6[_0x54a4('0x21')],'ChatQueue'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x10'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x34')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x11'),_0x5262d6[_0x54a4('0x21')],'SmsQueue'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x12'),_0x5262d6['userProfileId'],_0x54a4('0x36')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x3e'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x37')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x13'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x38')));_0x5a016b['push'](getAssociatedResources(_0x54a4('0x15'),_0x5262d6[_0x54a4('0x21')],'User'));_0x5a016b[_0x54a4('0x32')](getAssociatedResources(_0x54a4('0x16'),_0x5262d6[_0x54a4('0x21')],_0x54a4('0x39')));_0x5a016b[_0x54a4('0x32')](getAssociatedResources('IvrCampaigns',_0x5262d6['userProfileId'],'Campaign'));_0x5a016b[_0x54a4('0x32')](db['User'][_0x54a4('0x14')](queryAgents));break;case _0x54a4('0x9'):_0x4d8e50[_0x4bff0f](_0x54a4('0x2e'));_0x4d8e50[_0x4bff0f](_0x54a4('0x2f'));_0x5a016b['push'](_0x5262d6[_0x54a4('0x3f')]({'attributes':['id','name']}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x40')]({'attributes':['id',_0x54a4('0x7')]}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x41')]({'attributes':['id','name']}));_0x5a016b['push'](_0x5262d6[_0x54a4('0x42')]({'attributes':['id',_0x54a4('0x7')]}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x43')]({'attributes':['id','name']}));_0x5a016b['push'](_0x5262d6[_0x54a4('0x44')]({'attributes':['id','name']}));_0x5a016b[_0x54a4('0x32')](_0x5262d6[_0x54a4('0x45')]({'attributes':['id',_0x54a4('0x7')]}));break;}return BPromise[_0x54a4('0x46')](_0x5a016b);}})['then'](function(_0x4e3034){if(_0x4e3034&&_0x4e3034[_0x54a4('0x47')]){for(var _0x525559=0x0;_0x525559<_0x4e3034[_0x54a4('0x47')];_0x525559+=0x1){for(var _0x598742=0x0;_0x598742<_0x4e3034[_0x525559][_0x54a4('0x47')];_0x598742+=0x1){switch(_0x525559){case 0x0:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x48'),_0x4e3034[_0x525559][_0x598742]);break;case 0x1:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,'chat',_0x4e3034[_0x525559][_0x598742]);break;case 0x2:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x49'),_0x4e3034[_0x525559][_0x598742]);break;case 0x3:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x4a'),_0x4e3034[_0x525559][_0x598742]);break;case 0x4:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,'mail',_0x4e3034[_0x525559][_0x598742]);break;case 0x5:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,_0x54a4('0x4b'),_0x4e3034[_0x525559][_0x598742]);break;case 0x6:joinOrLeaveQueues(_0x4d8e50,_0x4bff0f,'whatsapp',_0x4e3034[_0x525559][_0x598742]);break;case 0x7:_0x4d8e50[_0x4bff0f](util['format'](_0x54a4('0x4c'),_0x4e3034[_0x525559][_0x598742][_0x54a4('0x7')]));break;case 0x8:_0x4d8e50[_0x4bff0f](util['format']('trunk:%s',_0x4e3034[_0x525559][_0x598742]['name']));break;case 0x9:_0x4d8e50[_0x4bff0f](util['format'](_0x54a4('0x4d'),_0x4e3034[_0x525559][_0x598742][_0x54a4('0xb')],_0x4e3034[_0x525559][_0x598742][_0x54a4('0x7')]));break;case 0xa:_0x4d8e50[_0x4bff0f](util['format']('user:%s',_0x4e3034[_0x525559][_0x598742][_0x54a4('0x7')]));break;}}}}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x1c1279=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x23')],'id');return _0x31a870[_0x54a4('0x4f')](_0x1c1279)['then'](function(){for(var _0x5f0437=0x0;_0x5f0437<_0x1c1279[_0x54a4('0x47')];_0x5f0437+=0x1){_0x5d927e['emit'](_0x54a4('0x50'),{'ChatInteractionId':Number(_0x1c1279[_0x5f0437]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x394e44=_[_0x54a4('0x1a')](_0x31a870['MailInteractions'],'id');return _0x31a870[_0x54a4('0x51')](_0x394e44)['then'](function(){for(var _0x3ac0db=0x0;_0x3ac0db<_0x394e44['length'];_0x3ac0db+=0x1){_0x5d927e[_0x54a4('0x52')](_0x54a4('0x53'),{'MailInteractionId':Number(_0x394e44[_0x3ac0db]),'UserId':Number(_0x31a870['id'])});}});}})['then'](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x479f92=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x27')],'id');return _0x31a870[_0x54a4('0x54')](_0x479f92)['then'](function(){for(var _0x31c5bf=0x0;_0x31c5bf<_0x479f92[_0x54a4('0x47')];_0x31c5bf+=0x1){_0x5d927e['emit'](_0x54a4('0x55'),{'FaxInteractionId':Number(_0x479f92[_0x31c5bf]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x56c732=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x29')],'id');return _0x31a870[_0x54a4('0x56')](_0x56c732)[_0x54a4('0xe')](function(){for(var _0x5f046f=0x0;_0x5f046f<_0x56c732[_0x54a4('0x47')];_0x5f046f+=0x1){_0x5d927e[_0x54a4('0x52')](_0x54a4('0x57'),{'SmsInteractionId':Number(_0x56c732[_0x5f046f]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x796a25=_['map'](_0x31a870['OpenchannelInteractions'],'id');return _0x31a870[_0x54a4('0x58')](_0x796a25)[_0x54a4('0xe')](function(){for(var _0x3571eb=0x0;_0x3571eb<_0x796a25[_0x54a4('0x47')];_0x3571eb+=0x1){_0x5d927e[_0x54a4('0x52')](_0x54a4('0x59'),{'OpenchannelInteractionId':Number(_0x796a25[_0x3571eb]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0xe')](function(){if(_0x4bff0f===_0x54a4('0x4e')){var _0x32f262=_[_0x54a4('0x1a')](_0x31a870[_0x54a4('0x2c')],'id');return _0x31a870[_0x54a4('0x5a')](_0x32f262)[_0x54a4('0xe')](function(){for(var _0x65465e=0x0;_0x65465e<_0x32f262['length'];_0x65465e+=0x1){_0x5d927e['emit'](_0x54a4('0x5b'),{'WhatsappInteractionId':Number(_0x32f262[_0x65465e]),'UserId':Number(_0x31a870['id'])});}});}})[_0x54a4('0x5c')](function(_0x50467a){_0x4d8e50[_0x54a4('0x5d')](_0x50467a);});}}function onDisconnect(_0x4b869f,_0xef3d31){joinOrLeave(_0x4b869f,'leave',_0xef3d31);}function onConnect(_0x34e0f3){joinOrLeave(_0x34e0f3,_0x54a4('0x5e'));}exports['default']=function(_0x1054dc){_0x1054dc['on'](_0x54a4('0x5f'),function(_0x302592){_0x302592['setMaxListeners'](0x0);_0x302592[_0x54a4('0x60')]=_0x302592[_0x54a4('0x61')][_0x54a4('0x5f')][_0x54a4('0x62')]+':'+_0x302592[_0x54a4('0x61')][_0x54a4('0x5f')][_0x54a4('0x63')];_0x302592[_0x54a4('0x64')]=new Date();_0x302592[_0x54a4('0x5d')]=function(_0x201163){console[_0x54a4('0x5d')](_0x54a4('0x65')+_0x302592['nsp']['name']+'['+_0x302592[_0x54a4('0x60')]+']',_0x201163);};_0x302592['on']('disconnect',function(){onDisconnect(_0x302592,_0x1054dc);_0x302592[_0x54a4('0x5d')](_0x54a4('0x66'));});onConnect(_0x302592);_0x302592[_0x54a4('0x5d')](_0x54a4('0x67'));});}; \ No newline at end of file +var _0x8646=['include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','FaxQueue','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','where','Campaign','type','length','format','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound'];(function(_0x1cc2fb,_0x5e51ae){var _0x160ee9=function(_0xabd69c){while(--_0xabd69c){_0x1cc2fb['push'](_0x1cc2fb['shift']());}};_0x160ee9(++_0x5e51ae);}(_0x8646,0xf1));var _0x6864=function(_0x5e2caa,_0x527b88){_0x5e2caa=_0x5e2caa-0x0;var _0x3b6216=_0x8646[_0x5e2caa];return _0x3b6216;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x6864('0x0'));var db=require(_0x6864('0x1'))['db'];var config=require(_0x6864('0x2'));var queryQueues={'attributes':['id',_0x6864('0x3')],'include':[{'as':_0x6864('0x4'),'model':db[_0x6864('0x5')],'attributes':['id',_0x6864('0x3'),_0x6864('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6864('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6864('0x3')],'where':{'role':_0x6864('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6864('0x3'),'type'],'where':{'type':_0x6864('0x9')}};function getAssociatedResources(_0x142780,_0xfbc65f,_0x280c00){return db[_0x6864('0xa')][_0x6864('0xb')]({'where':{'name':_0x142780,'userProfileId':_0xfbc65f},'raw':!![]})[_0x6864('0xc')](function(_0x31b709){if(_0x31b709){if(_0x31b709['autoAssociation']){switch(_0x142780){case _0x6864('0xd'):case _0x6864('0xe'):case _0x6864('0xf'):case'SmsQueues':case _0x6864('0x10'):case'OpenchannelQueues':case _0x6864('0x11'):return db[_0x280c00][_0x6864('0x12')](queryQueues);case'Telephones':return db[_0x280c00][_0x6864('0x12')](queryTelephones);case _0x6864('0x13'):return db[_0x280c00]['findAll'](queryTrunks);case _0x6864('0x14'):return db[_0x280c00][_0x6864('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x6864('0x12')]({'attributes':[_0x6864('0x15')],'where':{'sectionId':_0x31b709['id']},'raw':!![]})['then'](function(_0x5cf9f2){if(_0x5cf9f2){var _0x2b5fec={'where':{'id':_[_0x6864('0x16')](_0x5cf9f2,_0x6864('0x15'))},'raw':!![]};switch(_0x280c00){case'User':_0x2b5fec[_0x6864('0x17')][_0x6864('0x6')]=_0x6864('0x7');break;case _0x6864('0x18'):_0x2b5fec[_0x6864('0x17')][_0x6864('0x19')]='ivr';break;}return db[_0x280c00][_0x6864('0x12')](_0x2b5fec);}else{return[];}});}}else{return[];}})['then'](function(_0x1efd18){return _0x1efd18;});}function joinOrLeaveQueues(_0x33654b,_0x562c87,_0x280431,_0x512b0f){_0x33654b[_0x562c87](util['format']('%s:queue:%s',_0x280431,_0x512b0f[_0x6864('0x3')]));if(_0x512b0f['Agents']){for(var _0x4ee39b=0x0;_0x4ee39b<_0x512b0f[_0x6864('0x4')][_0x6864('0x1a')];_0x4ee39b+=0x1){_0x33654b[_0x562c87](util[_0x6864('0x1b')](_0x6864('0x1c'),_0x512b0f[_0x6864('0x4')][_0x4ee39b]['name']));}}}function joinOrLeave(_0x1d5ac2,_0x32bb00,_0x4b7f68){var _0x47b287;if(_0x1d5ac2[_0x6864('0x1d')][_0x6864('0x1e')]['id']){db[_0x6864('0x5')][_0x6864('0x1f')]({'attributes':['id',_0x6864('0x3'),'role','userProfileId'],'where':{'id':_0x1d5ac2[_0x6864('0x1d')][_0x6864('0x1e')]['id']},'include':[{'model':db[_0x6864('0x20')],'as':_0x6864('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x22')],'as':_0x6864('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x24')],'as':_0x6864('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x26')],'as':_0x6864('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x28')],'as':_0x6864('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x6864('0x2a')],'as':_0x6864('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x6864('0xc')](function(_0x4c670f){if(_0x4c670f){_0x47b287=_0x4c670f;_0x1d5ac2[_0x32bb00](util['format'](_0x6864('0x1c'),_0x4c670f['name']));var _0x1df9a3=[];switch(_0x4c670f[_0x6864('0x6')]){case _0x6864('0x2c'):_0x1d5ac2[_0x32bb00](_0x6864('0x2d'));_0x1d5ac2[_0x32bb00](_0x6864('0x2e'));if(queryQueues['hasOwnProperty'](_0x6864('0x2f'))){delete queryQueues[_0x6864('0x2f')];}_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x31')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x32')][_0x6864('0x12')](queryQueues));_0x1df9a3['push'](db['FaxQueue'][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x33')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x34')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x35')][_0x6864('0x12')](queryQueues));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x36')]['findAll'](queryQueues));_0x1df9a3['push'](db['User']['findAll'](queryTelephones));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x37')][_0x6864('0x12')](queryTrunks));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x18')]['findAll'](queryCampaigns));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x5')][_0x6864('0x12')](queryAgents));break;case _0x6864('0x38'):_0x1d5ac2[_0x32bb00](_0x6864('0x2d'));_0x1d5ac2[_0x32bb00](_0x6864('0x2e'));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0xd'),_0x4c670f['userProfileId'],'VoiceQueue'));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0xe'),_0x4c670f['userProfileId'],_0x6864('0x32')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0xf'),_0x4c670f[_0x6864('0x39')],_0x6864('0x3a')));_0x1df9a3['push'](getAssociatedResources('SmsQueues',_0x4c670f[_0x6864('0x39')],'SmsQueue'));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0x10'),_0x4c670f['userProfileId'],_0x6864('0x34')));_0x1df9a3['push'](getAssociatedResources('OpenchannelQueues',_0x4c670f[_0x6864('0x39')],_0x6864('0x35')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources(_0x6864('0x11'),_0x4c670f['userProfileId'],_0x6864('0x36')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources('Telephones',_0x4c670f[_0x6864('0x39')],_0x6864('0x5')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources('Trunks',_0x4c670f[_0x6864('0x39')],_0x6864('0x37')));_0x1df9a3[_0x6864('0x30')](getAssociatedResources('IvrCampaigns',_0x4c670f[_0x6864('0x39')],_0x6864('0x18')));_0x1df9a3[_0x6864('0x30')](db[_0x6864('0x5')][_0x6864('0x12')](queryAgents));break;case _0x6864('0x8'):_0x1d5ac2[_0x32bb00](_0x6864('0x2d'));_0x1d5ac2[_0x32bb00](_0x6864('0x2e'));_0x1df9a3[_0x6864('0x30')](_0x4c670f['getVoiceQueues']({'attributes':['id','name']}));_0x1df9a3['push'](_0x4c670f['getChatQueues']({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3['push'](_0x4c670f[_0x6864('0x3b')]({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f['getSmsQueues']({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f['getMailQueues']({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f[_0x6864('0x3c')]({'attributes':['id',_0x6864('0x3')]}));_0x1df9a3[_0x6864('0x30')](_0x4c670f[_0x6864('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0x6864('0x3e')](_0x1df9a3);}})[_0x6864('0xc')](function(_0x7d9c68){if(_0x7d9c68&&_0x7d9c68['length']){for(var _0x499c7b=0x0;_0x499c7b<_0x7d9c68[_0x6864('0x1a')];_0x499c7b+=0x1){for(var _0x5866fc=0x0;_0x5866fc<_0x7d9c68[_0x499c7b][_0x6864('0x1a')];_0x5866fc+=0x1){switch(_0x499c7b){case 0x0:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,'voice',_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x1:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x3f'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x2:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x40'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x3:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x41'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x4:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x42'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x5:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,_0x6864('0x43'),_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x6:joinOrLeaveQueues(_0x1d5ac2,_0x32bb00,'whatsapp',_0x7d9c68[_0x499c7b][_0x5866fc]);break;case 0x7:_0x1d5ac2[_0x32bb00](util[_0x6864('0x1b')]('telephone:%s',_0x7d9c68[_0x499c7b][_0x5866fc][_0x6864('0x3')]));break;case 0x8:_0x1d5ac2[_0x32bb00](util['format'](_0x6864('0x44'),_0x7d9c68[_0x499c7b][_0x5866fc]['name']));break;case 0x9:_0x1d5ac2[_0x32bb00](util['format']('campaign:%s:%s',_0x7d9c68[_0x499c7b][_0x5866fc][_0x6864('0x19')],_0x7d9c68[_0x499c7b][_0x5866fc]['name']));break;case 0xa:_0x1d5ac2[_0x32bb00](util[_0x6864('0x1b')](_0x6864('0x1c'),_0x7d9c68[_0x499c7b][_0x5866fc][_0x6864('0x3')]));break;}}}}})['then'](function(){if(_0x32bb00===_0x6864('0x45')){var _0x415820=_[_0x6864('0x16')](_0x47b287[_0x6864('0x21')],'id');return _0x47b287[_0x6864('0x46')](_0x415820)[_0x6864('0xc')](function(){for(var _0x3a843f=0x0;_0x3a843f<_0x415820[_0x6864('0x1a')];_0x3a843f+=0x1){_0x4b7f68['emit'](_0x6864('0x47'),{'ChatInteractionId':Number(_0x415820[_0x3a843f]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0xc')](function(){if(_0x32bb00===_0x6864('0x45')){var _0x8e4eb8=_[_0x6864('0x16')](_0x47b287[_0x6864('0x23')],'id');return _0x47b287[_0x6864('0x48')](_0x8e4eb8)[_0x6864('0xc')](function(){for(var _0x4aafd0=0x0;_0x4aafd0<_0x8e4eb8[_0x6864('0x1a')];_0x4aafd0+=0x1){_0x4b7f68[_0x6864('0x49')](_0x6864('0x4a'),{'MailInteractionId':Number(_0x8e4eb8[_0x4aafd0]),'UserId':Number(_0x47b287['id'])});}});}})['then'](function(){if(_0x32bb00==='leave'){var _0x48723e=_[_0x6864('0x16')](_0x47b287[_0x6864('0x25')],'id');return _0x47b287[_0x6864('0x4b')](_0x48723e)[_0x6864('0xc')](function(){for(var _0x56ff7b=0x0;_0x56ff7b<_0x48723e[_0x6864('0x1a')];_0x56ff7b+=0x1){_0x4b7f68['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x48723e[_0x56ff7b]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0xc')](function(){if(_0x32bb00===_0x6864('0x45')){var _0x577ea5=_['map'](_0x47b287[_0x6864('0x27')],'id');return _0x47b287[_0x6864('0x4c')](_0x577ea5)[_0x6864('0xc')](function(){for(var _0xac9e36=0x0;_0xac9e36<_0x577ea5[_0x6864('0x1a')];_0xac9e36+=0x1){_0x4b7f68[_0x6864('0x49')](_0x6864('0x4d'),{'SmsInteractionId':Number(_0x577ea5[_0xac9e36]),'UserId':Number(_0x47b287['id'])});}});}})['then'](function(){if(_0x32bb00===_0x6864('0x45')){var _0x3d482d=_['map'](_0x47b287[_0x6864('0x29')],'id');return _0x47b287['removeOpenchannelInteractions'](_0x3d482d)[_0x6864('0xc')](function(){for(var _0x2e0058=0x0;_0x2e0058<_0x3d482d[_0x6864('0x1a')];_0x2e0058+=0x1){_0x4b7f68[_0x6864('0x49')](_0x6864('0x4e'),{'OpenchannelInteractionId':Number(_0x3d482d[_0x2e0058]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0xc')](function(){if(_0x32bb00===_0x6864('0x45')){var _0x42a3e4=_[_0x6864('0x16')](_0x47b287[_0x6864('0x2b')],'id');return _0x47b287[_0x6864('0x4f')](_0x42a3e4)[_0x6864('0xc')](function(){for(var _0x4c8fd2=0x0;_0x4c8fd2<_0x42a3e4[_0x6864('0x1a')];_0x4c8fd2+=0x1){_0x4b7f68['emit'](_0x6864('0x50'),{'WhatsappInteractionId':Number(_0x42a3e4[_0x4c8fd2]),'UserId':Number(_0x47b287['id'])});}});}})[_0x6864('0x51')](function(_0x26e07e){_0x1d5ac2['log'](_0x26e07e);});}}function onDisconnect(_0x340d04,_0x24603e){joinOrLeave(_0x340d04,_0x6864('0x45'),_0x24603e);}function onConnect(_0x118676){joinOrLeave(_0x118676,_0x6864('0x52'));}exports[_0x6864('0x53')]=function(_0x5aec39){_0x5aec39['on']('connection',function(_0x9da6d3){_0x9da6d3[_0x6864('0x54')](0x0);_0x9da6d3[_0x6864('0x55')]=_0x9da6d3[_0x6864('0x56')][_0x6864('0x57')][_0x6864('0x58')]+':'+_0x9da6d3['request'][_0x6864('0x57')][_0x6864('0x59')];_0x9da6d3['connectedAt']=new Date();_0x9da6d3['log']=function(_0x1bf745){console[_0x6864('0x5a')](_0x6864('0x5b')+_0x9da6d3[_0x6864('0x5c')][_0x6864('0x3')]+'['+_0x9da6d3['address']+']',_0x1bf745);};_0x9da6d3['on'](_0x6864('0x5d'),function(){onDisconnect(_0x9da6d3,_0x5aec39);_0x9da6d3[_0x6864('0x5a')](_0x6864('0x5e'));});onConnect(_0x9da6d3);_0x9da6d3[_0x6864('0x5a')](_0x6864('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ae83774..c4fe44e 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 _0x76c8=['jayson/promise','triggers','client','http','Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','SmsInteraction','newinteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','EventManager','then','info','error','code','Trigger,\x20%s','get','channel','event','direction','UserId','User','find','interface','SIP/%s','name','incomingmessage','catch','outgoingmessage','opened','changed','closed','format','default','length','model','hook','callback','toLowerCase','condition','../../mysqldb'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x76c8,0xaa));var _0x876c=function(_0x5fe854,_0xfa2357){_0x5fe854=_0x5fe854-0x0;var _0x5cb9f4=_0x76c8[_0x5fe854];return _0x5cb9f4;};'use strict';var util=require('util');var db=require(_0x876c('0x0'))['db'];var jayson=require(_0x876c('0x1'));var logger=require('../logger')(_0x876c('0x2'));var client=jayson[_0x876c('0x3')][_0x876c('0x4')]({'port':0x232a});var triggers=[{'channel':_0x876c('0x5'),'model':_0x876c('0x6'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x876c('0x5'),'model':'ChatInteraction','event':_0x876c('0x7'),'condition':_0x876c('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0x876c('0x9'),'event':_0x876c('0xa'),'condition':_0x876c('0xb'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x876c('0xc'),'event':'afterCreate','condition':_0x876c('0xd'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x876c('0x7'),'condition':_0x876c('0x8'),'callback':afterUpdate},{'channel':_0x876c('0xe'),'model':_0x876c('0xf'),'event':'afterCreate','condition':_0x876c('0xb'),'callback':afterCreateMessage},{'channel':_0x876c('0x10'),'model':'WhatsappInteraction','event':_0x876c('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x876c('0x10'),'model':_0x876c('0x11'),'event':_0x876c('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x876c('0x12'),'event':'afterCreate','condition':_0x876c('0xb'),'callback':afterCreateMessage},{'channel':_0x876c('0x13'),'model':_0x876c('0x14'),'event':_0x876c('0xa'),'condition':_0x876c('0xd'),'callback':afterCreate},{'channel':_0x876c('0x13'),'model':_0x876c('0x14'),'event':_0x876c('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x876c('0x13'),'model':_0x876c('0x15'),'event':_0x876c('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x876c('0x16'),'model':'MailInteraction','event':'afterCreate','condition':_0x876c('0xd'),'callback':afterCreate},{'channel':_0x876c('0x16'),'model':_0x876c('0x17'),'event':_0x876c('0x7'),'condition':_0x876c('0x8'),'callback':afterUpdate},{'channel':_0x876c('0x16'),'model':_0x876c('0x18'),'event':_0x876c('0xa'),'condition':_0x876c('0xb'),'callback':afterCreateMessage},{'channel':_0x876c('0x19'),'model':_0x876c('0x1a'),'event':_0x876c('0xa'),'condition':_0x876c('0xd'),'callback':afterCreate},{'channel':_0x876c('0x19'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x876c('0x8'),'callback':afterUpdate},{'channel':_0x876c('0x19'),'model':'OpenchannelMessage','event':_0x876c('0xa'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x1fa80f){return client['request'](_0x876c('0x1b'),_0x1fa80f)[_0x876c('0x1c')](function(_0xd9cc7c){logger[_0x876c('0x1d')]('Trigger,\x20%s',_0x876c('0x1b'),_0xd9cc7c);if(_0xd9cc7c[_0x876c('0x1e')]){if(_0xd9cc7c[_0x876c('0x1e')][_0x876c('0x1f')]===0x1f4){logger[_0x876c('0x1e')]('Trigger,\x20%s','EventManager',_0xd9cc7c[_0x876c('0x1e')]);}}})['catch'](function(_0x400cd4){logger[_0x876c('0x1e')](_0x876c('0x20'),'EventManager',_0x400cd4);});}function afterCreateMessage(_0x417139,_0x49dd94){return function(_0x179536,_0x3c9287){_0x179536=_0x179536[_0x876c('0x21')]({'plain':!![]});_0x179536[_0x876c('0x22')]=_0x417139;_0x179536[_0x876c('0x23')]=_0x179536[_0x876c('0x24')];if(_0x179536[_0x876c('0x25')]){return db[_0x876c('0x26')][_0x876c('0x27')]({'where':{'id':_0x179536[_0x876c('0x25')]},'attributes':['id','name'],'raw':!![]})[_0x876c('0x1c')](function(_0x549823){_0x179536[_0x876c('0x28')]=util['format'](_0x876c('0x29'),_0x549823[_0x876c('0x2a')]);_0x179536['channel']=_0x417139;return request({'event':_0x876c('0x2b'),'message':_0x179536});})[_0x876c('0x2c')](function(_0x1a60e0){console[_0x876c('0x1e')](_0x1a60e0);});}else{return request({'event':_0x876c('0x2d'),'message':_0x179536});}};}function afterCreate(_0x479525,_0xd15c6){return function(_0x53eabf,_0x9a7b70){_0x53eabf=_0x53eabf[_0x876c('0x21')]({'plain':!![]});_0x53eabf[_0x876c('0x22')]=_0x479525;_0x53eabf[_0x876c('0x23')]=_0x876c('0x2e');return request({'event':_0xd15c6,'message':_0x53eabf});};}function afterUpdate(_0x26a20c,_0x439a1b){return function(_0x4cd0fd,_0x18f578){if(_0x4cd0fd[_0x876c('0x2f')](_0x876c('0x30'))&&_0x4cd0fd[_0x876c('0x30')]){_0x4cd0fd=_0x4cd0fd[_0x876c('0x21')]({'plain':!![]});_0x4cd0fd['channel']=_0x26a20c;_0x4cd0fd['event']=_0x876c('0x30');if(_0x4cd0fd['UserId']){return db[_0x876c('0x26')][_0x876c('0x27')]({'where':{'id':_0x4cd0fd[_0x876c('0x25')]},'attributes':['id',_0x876c('0x2a')],'raw':!![]})['then'](function(_0x4f980f){_0x4cd0fd[_0x876c('0x28')]=util[_0x876c('0x31')]('SIP/%s',_0x4f980f[_0x876c('0x2a')]);return request({'event':_0x439a1b,'message':_0x4cd0fd});})[_0x876c('0x2c')](function(_0x31b415){console[_0x876c('0x1e')](_0x31b415);});}else{return request({'event':_0x439a1b,'message':_0x4cd0fd});}}};}exports[_0x876c('0x32')]=function(){for(var _0x1b93b7=0x0;_0x1b93b7=_0x2f7078['agents']){throw Error(_0xe3f9('0x12'));}_0x33a7af(_0x3b2697);})[_0xe3f9('0x13')](function(_0x1ccfd7){_0x103309(_0x1ccfd7);});});}; \ No newline at end of file +var _0x7ed4=['updateAttributes','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x7ed4,0x18f));var _0x47ed=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0x7ed4[_0x18c8b5];return _0x358984;};'use strict';var _=require(_0x47ed('0x0'));var BPromise=require(_0x47ed('0x1'));var db=require(_0x47ed('0x2'))['db'];var util=require(_0x47ed('0x3'));var channels=[_0x47ed('0x4'),_0x47ed('0x5'),_0x47ed('0x6'),'fax',_0x47ed('0x7'),'whatsapp',_0x47ed('0x8')];exports[_0x47ed('0x9')]=function(){return channels;};exports[_0x47ed('0xa')]=function(_0x164c6a){_0x164c6a=_0x164c6a[_0x47ed('0xb')]();return _[_0x47ed('0xc')](channels,_0x164c6a);};exports[_0x47ed('0xd')]=function(_0xcd8de1,_0x32aeb7,_0x15fb1e,_0x4af757){var _0x584313={'loginAttempts':_0x32aeb7,'blocked':_0x15fb1e};if(!_['isUndefined'](_0x4af757)){_0x584313[_0x47ed('0xe')]=_0x4af757;}return _0xcd8de1[_0x47ed('0xf')](_0x584313);};exports['getLicense']=function(_0xbf7f81){return new BPromise(function(_0x5525b1,_0xad3ca5){var _0x1e4a99=0x0;if(_0xbf7f81[_0x47ed('0x10')]!==_0x47ed('0x11')){_0x5525b1(_0xbf7f81);}db[_0x47ed('0x12')][_0x47ed('0x13')]({'where':{'role':_0x47ed('0x11'),'online':!![],'id':{'$ne':_0xbf7f81['id']}}})[_0x47ed('0x14')](function(_0x29d537){_0x1e4a99=_0x29d537;return util['getLicense']();})[_0x47ed('0x14')](function(_0x255dc0){if(_0x255dc0&&_0x255dc0[_0x47ed('0x15')]&&_0x1e4a99>=_0x255dc0[_0x47ed('0x15')]){throw Error(_0x47ed('0x16'));}_0x5525b1(_0xbf7f81);})['catch'](function(_0x41e784){_0xad3ca5(_0x41e784);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 91d0a8c..3882328 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c23=['status','json','send','exports'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x6c23,0xbb));var _0x36c2=function(_0xdc3dc0,_0x127c86){_0xdc3dc0=_0xdc3dc0-0x0;var _0x534389=_0x6c23[_0xdc3dc0];return _0x534389;};'use strict';module[_0x36c2('0x0')][0x194]=function pageNotFound(_0x235476,_0x3e2ed4){var _0x207fc0='404';var _0x5e73e8=0x194;var _0x3cc20={'status':_0x5e73e8};_0x3e2ed4[_0x36c2('0x1')](_0x3cc20['status']);_0x3e2ed4['render'](_0x207fc0,{},function(_0x466b3a,_0x2efd6a){if(_0x466b3a){return _0x3e2ed4[_0x36c2('0x1')](_0x3cc20['status'])[_0x36c2('0x2')](_0x3cc20);}_0x3e2ed4[_0x36c2('0x3')](_0x2efd6a);});}; \ No newline at end of file +var _0xa55a=['status','json','send','exports','404'];(function(_0x2f1908,_0x5d837d){var _0x357795=function(_0x5bf606){while(--_0x5bf606){_0x2f1908['push'](_0x2f1908['shift']());}};_0x357795(++_0x5d837d);}(_0xa55a,0x170));var _0xaa55=function(_0xfaa7a8,_0x55aea0){_0xfaa7a8=_0xfaa7a8-0x0;var _0xc47bee=_0xa55a[_0xfaa7a8];return _0xc47bee;};'use strict';module[_0xaa55('0x0')][0x194]=function pageNotFound(_0x3e71a8,_0x20fabd){var _0x2d89ae=_0xaa55('0x1');var _0x29fad0=0x194;var _0xc393b5={'status':_0x29fad0};_0x20fabd[_0xaa55('0x2')](_0xc393b5['status']);_0x20fabd['render'](_0x2d89ae,{},function(_0x45e67a,_0x5c3d9b){if(_0x45e67a){return _0x20fabd[_0xaa55('0x2')](_0xc393b5[_0xaa55('0x2')])[_0xaa55('0x3')](_0xc393b5);}_0x20fabd[_0xaa55('0x4')](_0x5c3d9b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0bb44a7..99d2608 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x536e=['../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../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','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','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','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','License','../api/license/license.model','Campaign','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','cascade','HopperFinals','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteraction','Notifications','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','Team','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','VoiceExtension','SpiedAgents','Sound','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','belongsTo','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','MailServerIn','MailAccountId','MailServerOut','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','ContactId','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','MailInteractionId','Attachments','restrict','TagId','Items','FaxAccountId','FaxApplication','Applications','Exntensions','user_has_fax_accounts','FaxMessage','Account','fax_interaction_has_tags','Interaction','FaxInteractionId','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ChatWebsiteId','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','Members','CompanyId','CmHopperFinal','CmCompany','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','TriggerAnyId','Actions','Fields','DefaultReportId','MetricId','SalesforceAccount','SalesforceConfiguration','Configurations','AccountId','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Variable','VariableId','SugarcrmConfiguration','Subjects','Field','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','SmsQueueReport','JscriptyProject','ProjectId','user_has_square_projects','user_has_teams','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromUserId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappApplication','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../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','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount'];(function(_0x4d120d,_0x55a2c9){var _0x12b156=function(_0x3b0aae){while(--_0x3b0aae){_0x4d120d['push'](_0x4d120d['shift']());}};_0x12b156(++_0x55a2c9);}(_0x536e,0x155));var _0xe536=function(_0x37dd9d,_0x317c54){_0x37dd9d=_0x37dd9d-0x0;var _0x33ec83=_0x536e[_0x37dd9d];return _0x33ec83;};'use strict';var path=require(_0xe536('0x0'));var config=require(_0xe536('0x1'));var Sequelize=require(_0xe536('0x2'));var _=require(_0xe536('0x3'));var jstz=require(_0xe536('0x4'));var timezone=jstz[_0xe536('0x5')]();config[_0xe536('0x2')]=_[_0xe536('0x6')](config[_0xe536('0x2')],{'database':_0xe536('0x7'),'username':_0xe536('0x8'),'password':_0xe536('0x9'),'options':{'host':_0xe536('0xa'),'port':0xcea,'dialect':_0xe536('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe536('0xc'),'collate':_0xe536('0xd')}}});config['sequelizeHistory']=_[_0xe536('0x6')](config[_0xe536('0xe')],{'database':_0xe536('0x7'),'username':_0xe536('0x8'),'password':_0xe536('0x9'),'options':{'host':_0xe536('0xa'),'port':0xcea,'dialect':_0xe536('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe536('0xc'),'collate':_0xe536('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xe536('0xf')],config[_0xe536('0x2')][_0xe536('0x10')],config[_0xe536('0x2')][_0xe536('0x11')],config[_0xe536('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe536('0xe')][_0xe536('0xf')],config[_0xe536('0xe')][_0xe536('0x10')],config[_0xe536('0xe')]['password'],config[_0xe536('0xe')][_0xe536('0x12')])};db[_0xe536('0x13')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x15'));db[_0xe536('0x16')]=db[_0xe536('0x2')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe536('0x17')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x18'));db['VoiceExtension']=db['sequelize'][_0xe536('0x14')](_0xe536('0x19'));db[_0xe536('0x1a')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x1b'));db[_0xe536('0x1c')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x1d'));db[_0xe536('0x1e')]=db['sequelize']['import'](_0xe536('0x1f'));db[_0xe536('0x20')]=db[_0xe536('0x2')]['import'](_0xe536('0x21'));db[_0xe536('0x22')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x23'));db[_0xe536('0x24')]=db['sequelize'][_0xe536('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe536('0x25')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x26'));db['VoiceDialReport']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe536('0x27')]=db[_0xe536('0x2')]['import'](_0xe536('0x28'));db[_0xe536('0x29')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x2a'));db['MemberReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x2b'));db[_0xe536('0x2c')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x2d'));db[_0xe536('0x2e')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x2f'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0xe536('0x30'));db['UserVoiceQueue']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x31'));db[_0xe536('0x32')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x33'));db['UserMailQueue']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x34'));db['UserFaxQueue']=db['sequelize'][_0xe536('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0xe536('0x35')]=db[_0xe536('0x2')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xe536('0x36')]=db['sequelize'][_0xe536('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xe536('0x37')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x38'));db['MailServerIn']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x39'));db[_0xe536('0x3a')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x3b'));db[_0xe536('0x3c')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailQueue/mailQueue.model');db[_0xe536('0x3d')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x3e'));db[_0xe536('0x3f')]=db[_0xe536('0x2')]['import']('../api/mailMessage/mailMessage.model');db[_0xe536('0x40')]=db['sequelize']['import'](_0xe536('0x41'));db[_0xe536('0x42')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe536('0x43')]=db[_0xe536('0x2')]['import'](_0xe536('0x44'));db[_0xe536('0x45')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x46'));db[_0xe536('0x47')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/faxApplication/faxApplication.model');db[_0xe536('0x48')]=db[_0xe536('0x2')]['import'](_0xe536('0x49'));db['FaxMessage']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x4a'));db[_0xe536('0x4b')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x4c'));db[_0xe536('0x4d')]=db[_0xe536('0x2')]['import'](_0xe536('0x4e'));db[_0xe536('0x4f')]=db['sequelize'][_0xe536('0x14')]('../api/smsAccount/smsAccount.model');db[_0xe536('0x50')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x51'));db[_0xe536('0x52')]=db[_0xe536('0x2')]['import'](_0xe536('0x53'));db[_0xe536('0x54')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x55'));db[_0xe536('0x56')]=db['sequelize'][_0xe536('0x14')]('../api/smsQueue/smsQueue.model');db[_0xe536('0x57')]=db['sequelize'][_0xe536('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0xe536('0x58')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x59'));db[_0xe536('0x5a')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xe536('0x5b')]=db['sequelize']['import'](_0xe536('0x5c'));db[_0xe536('0x5d')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x5e'));db[_0xe536('0x5f')]=db['sequelize']['import'](_0xe536('0x60'));db['OpenchannelQueueReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x61'));db[_0xe536('0x62')]=db[_0xe536('0x2')]['import'](_0xe536('0x63'));db[_0xe536('0x64')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x65'));db[_0xe536('0x66')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x67'));db['ChatOfflineMessage']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x68'));db['ChatQueue']=db[_0xe536('0x2')]['import']('../api/chatQueue/chatQueue.model');db[_0xe536('0x69')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x6a'));db[_0xe536('0x6b')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x6c'));db['CmCompany']=db[_0xe536('0x2')]['import']('../api/cmCompany/cmCompany.model');db[_0xe536('0x6d')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x6e'));db[_0xe536('0x6f')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x70'));db[_0xe536('0x71')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0xe536('0x2')]['import'](_0xe536('0x72'));db[_0xe536('0x73')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x74'));db[_0xe536('0x75')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x76'));db['CmCustomField']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x77'));db[_0xe536('0x78')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x79'));db[_0xe536('0x7a')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x7b'));db[_0xe536('0x7c')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x7d'));db[_0xe536('0x7e')]=db[_0xe536('0x2')]['import']('../api/disposition/disposition.model');db[_0xe536('0x7f')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x80'));db[_0xe536('0x81')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x82'));db[_0xe536('0x83')]=db[_0xe536('0x2')]['import'](_0xe536('0x84'));db[_0xe536('0x85')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x86'));db['VoiceQueuesLog']=db[_0xe536('0x2')][_0xe536('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xe536('0x87')]=db['sequelize']['import'](_0xe536('0x88'));db['Sound']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x89'));db['Tag']=db['sequelize'][_0xe536('0x14')](_0xe536('0x8a'));db['Template']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x8b'));db[_0xe536('0x8c')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x8d'));db['Variable']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x8e'));db[_0xe536('0x8f')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x90'));db['IntegrationReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x91'));db['AnalyticCustomReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x92'));db[_0xe536('0x93')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x94'));db[_0xe536('0x95')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x96'));db[_0xe536('0x97')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x98'));db[_0xe536('0x99')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xe536('0x9a')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x9b'));db['SalesforceAccount']=db[_0xe536('0x2')]['import'](_0xe536('0x9c'));db['SalesforceConfiguration']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x9d'));db[_0xe536('0x9e')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x9f'));db[_0xe536('0xa0')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xa1'));db[_0xe536('0xa2')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xa3'));db[_0xe536('0xa4')]=db[_0xe536('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xe536('0xa5')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xa6'));db[_0xe536('0xa7')]=db[_0xe536('0x2')]['import'](_0xe536('0xa8'));db[_0xe536('0xa9')]=db[_0xe536('0x2')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xe536('0xaa')]=db['sequelize']['import'](_0xe536('0xab'));db['ZohoField']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xac'));db[_0xe536('0xad')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe536('0xae')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xaf'));db[_0xe536('0xb0')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xb1'));db[_0xe536('0xb2')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xb3'));db[_0xe536('0xb4')]=db[_0xe536('0x2')]['import'](_0xe536('0xb5'));db[_0xe536('0xb6')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xb7'));db[_0xe536('0xb8')]=db[_0xe536('0x2')]['import'](_0xe536('0xb9'));db[_0xe536('0xba')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xbb'));db[_0xe536('0xbc')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xbd'));db[_0xe536('0xbe')]=db[_0xe536('0x2')]['import'](_0xe536('0xbf'));db['ServicenowConfiguration']=db['sequelize'][_0xe536('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xe536('0xc0')]=db['sequelize']['import'](_0xe536('0xc1'));db[_0xe536('0xc2')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xc3'));db[_0xe536('0xc4')]=db['sequelize']['import'](_0xe536('0xc5'));db[_0xe536('0xc6')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xc7'));db[_0xe536('0xc8')]=db[_0xe536('0x2')]['import'](_0xe536('0xc9'));db[_0xe536('0xca')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xcb'));db[_0xe536('0xcc')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x90'));db[_0xe536('0xcd')]=db[_0xe536('0x2')]['import'](_0xe536('0xce'));db[_0xe536('0xcf')]=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xe536('0xd0')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd1'));db['JscriptyAnswerReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd2'));db['JscriptyQuestionReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd3'));db[_0xe536('0xd4')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd5'));db['SmsQueueReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd6'));db[_0xe536('0xd7')]=db[_0xe536('0x2')]['import'](_0xe536('0xd8'));db['SquareDetailsReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xd9'));db['JscriptyProject']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xda'));db[_0xe536('0xdb')]=db[_0xe536('0x2')]['import'](_0xe536('0xdc'));db[_0xe536('0xdd')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xde'));db[_0xe536('0xdf')]=db['sequelize'][_0xe536('0x14')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xe0'));db[_0xe536('0xe1')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db['sequelize'][_0xe536('0x14')]('../api/team/team.model');db[_0xe536('0xe2')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xe3'));db[_0xe536('0xe4')]=db['sequelize'][_0xe536('0x14')]('../api/campaign/campaign.model');db[_0xe536('0xe5')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/migration/migration.model');db[_0xe536('0xe6')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xe7'));db[_0xe536('0xe8')]=db[_0xe536('0x2')]['import'](_0xe536('0xe9'));db['MailTransferReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xea'));db[_0xe536('0xeb')]=db['sequelize'][_0xe536('0x14')](_0xe536('0xec'));db['FaxTransferReport']=db['sequelize'][_0xe536('0x14')](_0xe536('0xed'));db[_0xe536('0xee')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xef'));db[_0xe536('0xf0')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xf1'));db['CmList']=db[_0xe536('0x2')]['import']('../api/cmList/cmList.model');db[_0xe536('0xf2')]=db[_0xe536('0x2')]['import'](_0xe536('0xf3'));db[_0xe536('0xf4')]=db[_0xe536('0x2')]['import'](_0xe536('0xf5'));db['UserProfileSection']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xf6'));db[_0xe536('0xf7')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xf8'));db[_0xe536('0xf9')]=db[_0xe536('0x2')]['import'](_0xe536('0xfa'));db['WhatsappAccount']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0xfb'));db['WhatsappApplication']=db[_0xe536('0x2')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xe536('0xfc')]=db[_0xe536('0x2')][_0xe536('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe536('0xfd')]=db[_0xe536('0x2')]['import'](_0xe536('0xfe'));db[_0xe536('0xff')]=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x100'));db['WhatsappTransferReport']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x101'));db['WhatsappQueue']=db[_0xe536('0x2')][_0xe536('0x14')](_0xe536('0x102'));db[_0xe536('0x103')]=db['sequelize'][_0xe536('0x14')](_0xe536('0x104'));db[_0xe536('0x13')][_0xe536('0x105')](db[_0xe536('0x22')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x1e')],{'as':_0xe536('0x108'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db['UserVoiceQueueRt'],{'as':_0xe536('0x109'),'foreignKey':_0xe536('0x106')});db['User'][_0xe536('0x107')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x13')][_0xe536('0x107')](db['CmHopperFinal'],{'as':_0xe536('0x10b'),'foreignKey':'UserId'});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x73')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xe536('0x13')][_0xe536('0x107')](db['ReportAgentPreview'],{'as':_0xe536('0x75'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db['OpenchannelInteraction'],{'as':_0xe536('0x10c'),'foreignKey':'UserId'});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x64')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User'][_0xe536('0x107')](db[_0xe536('0x52')],{'as':_0xe536('0x10d'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x48')],{'as':_0xe536('0x10e'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0x10f')],{'as':'MailInteractions','foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0xe536('0x106')});db[_0xe536('0x13')][_0xe536('0x107')](db[_0xe536('0xf9')],{'as':_0xe536('0x110'),'foreignKey':'SenderId'});db[_0xe536('0x13')]['belongsTo'](db[_0xe536('0xf4')],{'as':'UserProfile','foreignKey':_0xe536('0x111')});db[_0xe536('0x13')]['belongsToMany'](db['ChatGroup'],{'as':_0xe536('0x112'),'through':_0xe536('0x113')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x6d')],{'as':_0xe536('0x115'),'through':_0xe536('0x116')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':_0xe536('0x118'),'through':_0xe536('0x119')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x11a')],{'through':'user_has_teams'});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x10f')],{'as':_0xe536('0x11b'),'through':_0xe536('0x11c')});db[_0xe536('0x13')][_0xe536('0x114')](db['ChatInteraction'],{'as':_0xe536('0x11d'),'through':_0xe536('0x11e')});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x48')],{'as':_0xe536('0x10e'),'through':_0xe536('0x11f')});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x52')],{'as':_0xe536('0x10d'),'through':_0xe536('0x120')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x5a')],{'as':_0xe536('0x10c'),'through':'user_has_openchannel_interactions'});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0xfc')],{'as':_0xe536('0x121'),'through':_0xe536('0x122')});db['User'][_0xe536('0x114')](db[_0xe536('0x1c')],{'as':_0xe536('0x123'),'through':_0xe536('0x124'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db['MailQueue'],{'as':_0xe536('0x125'),'through':_0xe536('0x126'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db['ChatQueue'],{'as':_0xe536('0x127'),'through':_0xe536('0x32'),'required':![],'hooks':!![]});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x4b')],{'as':_0xe536('0x128'),'through':_0xe536('0x129'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x56')],{'as':_0xe536('0x12a'),'through':'UserSmsQueue','required':![]});db['User'][_0xe536('0x114')](db[_0xe536('0x5d')],{'as':'OpenchannelQueues','through':_0xe536('0x36'),'required':![]});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x12b')],{'as':_0xe536('0x12c'),'through':'UserWhatsappQueue','required':![]});db[_0xe536('0x13')]['belongsToMany'](db[_0xe536('0x117')],{'through':_0xe536('0x119')});db[_0xe536('0x13')][_0xe536('0x114')](db['VoicePrefix'],{'as':_0xe536('0x12d'),'through':_0xe536('0x12e'),'required':![]});db['User']['belongsToMany'](db[_0xe536('0x5f')],{'as':_0xe536('0x12f'),'through':'user_has_chat_websites'});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x47')],{'as':_0xe536('0x130'),'through':'user_has_fax_accounts'});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x3a')],{'as':'MailAccounts','through':_0xe536('0x131')});db[_0xe536('0x13')][_0xe536('0x114')](db['OpenchannelAccount'],{'as':_0xe536('0x132'),'through':_0xe536('0x133')});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0x4f')],{'as':_0xe536('0x134'),'through':_0xe536('0x135')});db[_0xe536('0x13')][_0xe536('0x114')](db['WhatsappAccount'],{'as':_0xe536('0x136'),'through':'user_has_whatsapp_accounts'});db[_0xe536('0x13')][_0xe536('0x114')](db[_0xe536('0xdf')],{'as':_0xe536('0x137'),'through':'user_has_square_projects'});db[_0xe536('0x16')][_0xe536('0x107')](db[_0xe536('0x138')],{'as':_0xe536('0x139'),'onDelete':_0xe536('0x10a'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0xe536('0x107')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xe536('0x138')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0xe536('0x10a')});db[_0xe536('0x1a')]['belongsToMany'](db[_0xe536('0x13a')],{'as':'Sounds','through':_0xe536('0x13b')});db['VoiceQueue'][_0xe536('0x107')](db[_0xe536('0x13c')],{'as':'Members','foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')][_0xe536('0x107')](db[_0xe536('0x6f')],{'as':_0xe536('0x13e'),'foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')]['hasMany'](db['CmHopperFinal'],{'as':_0xe536('0x10b'),'foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')][_0xe536('0x107')](db[_0xe536('0x73')],{'as':_0xe536('0x13f'),'foreignKey':_0xe536('0x13d')});db['VoiceQueue'][_0xe536('0x107')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')]['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xe536('0x13d')});db[_0xe536('0x1c')][_0xe536('0x107')](db[_0xe536('0xd4')],{'as':_0xe536('0x140'),'foreignKey':'VoiceQueueId'});db[_0xe536('0x1c')]['belongsTo'](db[_0xe536('0x2c')],{'as':_0xe536('0x2c'),'foreignKey':_0xe536('0x141')});db['VoiceQueue']['belongsTo'](db[_0xe536('0x2c')],{'as':_0xe536('0x142'),'foreignKey':_0xe536('0x143')});db['VoiceQueue']['belongsTo'](db[_0xe536('0x81')],{'as':_0xe536('0x81'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x1c')][_0xe536('0x145')](db['Pause'],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x1c')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':'Lists','through':_0xe536('0x148')});db[_0xe536('0x1c')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x124')});db[_0xe536('0x1c')][_0xe536('0x114')](db['Team'],{'as':_0xe536('0x14a'),'through':_0xe536('0x14b')});db[_0xe536('0x1c')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':_0xe536('0x14c'),'through':_0xe536('0x14d')});db[_0xe536('0x1e')]['belongsTo'](db[_0xe536('0x13')],{'as':'User','foreignKey':_0xe536('0x106')});db[_0xe536('0x20')]['belongsTo'](db[_0xe536('0x13')],{'as':'User','foreignKey':'UserId'});db[_0xe536('0x22')]['hasMany'](db[_0xe536('0x24')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x14f'),'sourceKey':'mailbox'});db[_0xe536('0x24')]['belongsTo'](db[_0xe536('0x22')],{'foreignKey':_0xe536('0x14f'),'targetKey':_0xe536('0x150')});db[_0xe536('0x25')][_0xe536('0x107')](db[_0xe536('0x29')],{'as':_0xe536('0x151'),'foreignKey':_0xe536('0x152'),'constraints':![]});db[_0xe536('0x25')][_0xe536('0x107')](db[_0xe536('0x27')],{'as':'AgentReports','foreignKey':_0xe536('0x152'),'constraints':![]});db['VoiceCallReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x25')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db[_0xe536('0x154')][_0xe536('0x145')](db[_0xe536('0x3a')],{'as':_0xe536('0x3a'),'foreignKey':_0xe536('0x155')});db[_0xe536('0x156')][_0xe536('0x145')](db[_0xe536('0x3a')],{'as':_0xe536('0x3a'),'foreignKey':_0xe536('0x155')});db[_0xe536('0x3a')][_0xe536('0x105')](db[_0xe536('0x154')],{'as':'Imap','onDelete':_0xe536('0x10a')});db['MailAccount'][_0xe536('0x105')](db[_0xe536('0x156')],{'as':_0xe536('0x157'),'onDelete':'cascade'});db[_0xe536('0x3a')]['hasMany'](db[_0xe536('0x7e')],{'as':_0xe536('0x158'),'foreignKey':'MailAccountId'});db[_0xe536('0x3a')][_0xe536('0x107')](db['CannedAnswer'],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x155')});db['MailAccount'][_0xe536('0x107')](db['MailMessage'],{'as':_0xe536('0x14e'),'foreignKey':_0xe536('0x155')});db[_0xe536('0x3a')]['hasMany'](db[_0xe536('0x10f')],{'as':_0xe536('0x15a')});db[_0xe536('0x3a')]['hasMany'](db[_0xe536('0x40')],{'as':'Applications'});db['MailAccount'][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db['MailAccount'][_0xe536('0x145')](db[_0xe536('0x15d')],{'as':_0xe536('0x15d'),'foreignKey':_0xe536('0x15e')});db['MailAccount'][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x3a')]['belongsToMany'](db['User'],{'as':_0xe536('0x149'),'through':_0xe536('0x131')});db[_0xe536('0x3c')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':'UserMailQueue'});db[_0xe536('0x3c')][_0xe536('0x114')](db[_0xe536('0x11a')],{'through':_0xe536('0x15f'),'as':'Teams'});db[_0xe536('0x10f')][_0xe536('0x107')](db[_0xe536('0x3f')],{'as':'Messages','onDelete':_0xe536('0x10a'),'foreignKey':'MailInteractionId'});db[_0xe536('0x10f')]['belongsTo'](db[_0xe536('0x3a')],{'as':'Account','foreignKey':_0xe536('0x155')});db[_0xe536('0x10f')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db['MailInteraction'][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x161'),'foreignKey':'UserId'});db['MailInteraction'][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x162'),'as':_0xe536('0x163')});db[_0xe536('0x10f')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x162'),'as':_0xe536('0x165')});db[_0xe536('0x10f')][_0xe536('0x114')](db['User'],{'as':_0xe536('0x166'),'through':_0xe536('0x11c'),'foreignKey':_0xe536('0x167')});db[_0xe536('0x3f')][_0xe536('0x107')](db[_0xe536('0xe6')],{'as':_0xe536('0x168'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x3f')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13')});db[_0xe536('0x3f')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0xe536('0x3f')][_0xe536('0x145')](db[_0xe536('0x10f')],{'as':'Interaction','foreignKey':_0xe536('0x167')});db[_0xe536('0x3f')][_0xe536('0x145')](db[_0xe536('0x3a')],{'as':'Account','foreignKey':_0xe536('0x155')});db[_0xe536('0x40')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x40')][_0xe536('0x145')](db[_0xe536('0x3c')],{'onDelete':'restrict'});db[_0xe536('0x40')]['belongsTo'](db[_0xe536('0x3a')],{'onDelete':'restrict'});db['MailApplication'][_0xe536('0x145')](db[_0xe536('0x81')],{'onDelete':_0xe536('0x169'),'foreignKey':'IntervalId'});db[_0xe536('0x40')][_0xe536('0x145')](db[_0xe536('0x164')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db[_0xe536('0x42')][_0xe536('0x145')](db['MailAccount'],{});db[_0xe536('0x42')]['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x42')]['belongsTo'](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db[_0xe536('0x10f')],{});db[_0xe536('0x42')]['belongsTo'](db['MailMessage'],{});db[_0xe536('0x42')][_0xe536('0x145')](db['User'],{});db[_0xe536('0x42')][_0xe536('0x145')](db[_0xe536('0x3c')],{});db['Dashboard'][_0xe536('0x107')](db[_0xe536('0x45')],{'as':_0xe536('0x16b'),'onDelete':'cascade'});db[_0xe536('0x47')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':'Dispositions','foreignKey':_0xe536('0x16c')});db[_0xe536('0x47')][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x16c')});db[_0xe536('0x47')][_0xe536('0x107')](db['FaxInteraction'],{'as':_0xe536('0x15a')});db[_0xe536('0x47')][_0xe536('0x107')](db[_0xe536('0x16d')],{'as':_0xe536('0x16e')});db['FaxAccount'][_0xe536('0x107')](db['VoiceExtension'],{'as':_0xe536('0x16f'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x47')]['hasMany'](db['FaxMessage'],{'as':_0xe536('0x14e')});db[_0xe536('0x47')]['belongsTo'](db[_0xe536('0x2c')],{'as':'Trunk'});db[_0xe536('0x47')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x47')][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x47')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x170')});db['FaxApplication']['belongsTo'](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db['FaxApplication'][_0xe536('0x145')](db[_0xe536('0x4b')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x16d')][_0xe536('0x145')](db['FaxAccount'],{'onDelete':_0xe536('0x169')});db[_0xe536('0x16d')][_0xe536('0x145')](db[_0xe536('0x164')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db['FaxInteraction'][_0xe536('0x107')](db[_0xe536('0x171')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0xe536('0x145')](db[_0xe536('0x47')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x16c')});db[_0xe536('0x48')][_0xe536('0x145')](db['CmContact'],{'as':'Contact','foreignKey':_0xe536('0x160')});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0xe536('0x161'),'foreignKey':_0xe536('0x106')});db['FaxInteraction'][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x173'),'as':_0xe536('0x163')});db[_0xe536('0x48')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x173'),'as':'ThroughTags'});db[_0xe536('0x48')][_0xe536('0x114')](db['User'],{'as':'Users','through':_0xe536('0x11f'),'foreignKey':'FaxInteractionId'});db[_0xe536('0x171')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x13')});db['FaxMessage']['belongsTo'](db[_0xe536('0x48')],{'as':_0xe536('0x174'),'foreignKey':_0xe536('0x175')});db['FaxMessage'][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153')});db[_0xe536('0x171')][_0xe536('0x145')](db[_0xe536('0xe6')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xe536('0x171')][_0xe536('0x145')](db[_0xe536('0x47')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x16c')});db['FaxQueue']['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x129')});db[_0xe536('0x4b')][_0xe536('0x114')](db[_0xe536('0x11a')],{'through':'team_has_fax_queues','as':_0xe536('0x14a')});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x47')],{});db['FaxQueueReport']['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x4d')][_0xe536('0x145')](db['CmContact'],{'as':'Contact','foreignKey':_0xe536('0x160')});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x48')],{});db['FaxQueueReport'][_0xe536('0x145')](db[_0xe536('0x171')],{});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0x4d')][_0xe536('0x145')](db[_0xe536('0x4b')],{});db[_0xe536('0x4f')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':_0xe536('0x158'),'foreignKey':_0xe536('0x176')});db[_0xe536('0x4f')][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':_0xe536('0x14e'),'foreignKey':_0xe536('0x176')});db[_0xe536('0x4f')][_0xe536('0x107')](db['SmsInteraction'],{'as':_0xe536('0x15a')});db[_0xe536('0x4f')]['hasMany'](db[_0xe536('0x50')],{'as':_0xe536('0x16e')});db[_0xe536('0x4f')][_0xe536('0x145')](db['CmList'],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db[_0xe536('0x4f')][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe536('0x4f')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':'user_has_sms_accounts'});db[_0xe536('0x50')]['belongsTo'](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x50')]['belongsTo'](db[_0xe536('0x56')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x50')][_0xe536('0x145')](db[_0xe536('0x4f')],{'onDelete':'restrict'});db[_0xe536('0x50')][_0xe536('0x145')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xe536('0x50')]['belongsTo'](db[_0xe536('0x164')],{'onDelete':'restrict','foreignKey':_0xe536('0x16a')});db[_0xe536('0x52')][_0xe536('0x107')](db[_0xe536('0x54')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':'SmsInteractionId'});db[_0xe536('0x52')][_0xe536('0x145')](db['SmsAccount'],{'as':'Account','foreignKey':_0xe536('0x176')});db[_0xe536('0x52')][_0xe536('0x145')](db['CmContact'],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x52')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xe536('0x106')});db['SmsInteraction'][_0xe536('0x114')](db[_0xe536('0x164')],{'through':'sms_interaction_has_tags','as':_0xe536('0x163')});db[_0xe536('0x52')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x177'),'as':_0xe536('0x165')});db[_0xe536('0x52')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':_0xe536('0x120'),'foreignKey':'SmsInteractionId'});db[_0xe536('0x54')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13')});db[_0xe536('0x54')][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153')});db[_0xe536('0x54')][_0xe536('0x145')](db[_0xe536('0x52')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x174'),'foreignKey':_0xe536('0x178')});db['SmsMessage'][_0xe536('0x145')](db['SmsAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x176')});db['SmsQueue'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':'UserSmsQueue','foreignKey':_0xe536('0x179')});db['SmsQueue'][_0xe536('0x114')](db['Team'],{'through':_0xe536('0x17a'),'as':_0xe536('0x14a')});db[_0xe536('0x57')][_0xe536('0x107')](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x17b')});db['OpenchannelAccount'][_0xe536('0x107')](db['OpenchannelInteraction'],{'as':_0xe536('0x15a'),'foreignKey':_0xe536('0x17b')});db['OpenchannelAccount'][_0xe536('0x107')](db[_0xe536('0x5b')],{'as':_0xe536('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0xe536('0x57')][_0xe536('0x107')](db[_0xe536('0x58')],{'as':'Applications','foreignKey':_0xe536('0x17b')});db[_0xe536('0x57')][_0xe536('0x145')](db['CmList'],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x57')][_0xe536('0x145')](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe536('0x57')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Agents','through':_0xe536('0x133')});db[_0xe536('0x58')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x58')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x17c')});db['OpenchannelApplication'][_0xe536('0x145')](db[_0xe536('0x57')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x17b')});db[_0xe536('0x58')]['belongsTo'](db[_0xe536('0x81')],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x58')]['belongsTo'](db[_0xe536('0x164')],{'onDelete':'restrict','foreignKey':_0xe536('0x16a')});db[_0xe536('0x5a')]['hasMany'](db['OpenchannelMessage'],{'as':_0xe536('0x14e'),'onDelete':'cascade','foreignKey':_0xe536('0x17d')});db[_0xe536('0x5a')][_0xe536('0x145')](db[_0xe536('0x57')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x17b')});db[_0xe536('0x5a')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db[_0xe536('0x5a')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction'][_0xe536('0x114')](db[_0xe536('0x164')],{'through':'openchannel_interaction_has_tags','as':_0xe536('0x163')});db[_0xe536('0x5a')]['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x17e'),'as':_0xe536('0x165')});db[_0xe536('0x5a')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':'user_has_openchannel_interactions','foreignKey':_0xe536('0x17d')});db[_0xe536('0x5b')][_0xe536('0x145')](db['User'],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x13')});db[_0xe536('0x5b')][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':'cascade','as':_0xe536('0x153')});db[_0xe536('0x5b')][_0xe536('0x145')](db['OpenchannelInteraction'],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x174'),'foreignKey':_0xe536('0x17d')});db[_0xe536('0x5b')][_0xe536('0x145')](db[_0xe536('0xe6')],{'as':_0xe536('0xe6'),'foreignKey':_0xe536('0x17f')});db[_0xe536('0x5b')]['belongsTo'](db[_0xe536('0x57')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x17b')});db[_0xe536('0x5d')][_0xe536('0x114')](db['User'],{'as':_0xe536('0x149'),'through':_0xe536('0x36'),'foreignKey':_0xe536('0x17c')});db[_0xe536('0x5d')]['belongsToMany'](db[_0xe536('0x11a')],{'through':'team_has_openchannel_queues','as':_0xe536('0x14a')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':_0xe536('0x158'),'foreignKey':_0xe536('0x180')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x7c')],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x180')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x6b')],{'as':_0xe536('0x181')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x64')],{'as':'Interactions'});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x62')],{'as':_0xe536('0x16e')});db[_0xe536('0x5f')][_0xe536('0x107')](db[_0xe536('0x66')],{'as':'Messages'});db['ChatWebsite'][_0xe536('0x145')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xe536('0x5f')][_0xe536('0x145')](db[_0xe536('0x81')],{'as':_0xe536('0x81'),'foreignKey':_0xe536('0x144')});db['ChatWebsite'][_0xe536('0x145')](db[_0xe536('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xe536('0x147')});db['ChatWebsite'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x182')});db[_0xe536('0x183')][_0xe536('0x145')](db['OpenchannelAccount'],{});db[_0xe536('0x183')]['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db[_0xe536('0x183')][_0xe536('0x145')](db['CmContact'],{'as':_0xe536('0x153'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xe536('0x145')](db[_0xe536('0x5a')],{});db[_0xe536('0x183')]['belongsTo'](db[_0xe536('0x5b')],{});db[_0xe536('0x183')][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0x183')]['belongsTo'](db[_0xe536('0x5d')],{});db['ChatApplication'][_0xe536('0x145')](db['User'],{'as':_0xe536('0x184'),'foreignKey':_0xe536('0x106'),'onDelete':_0xe536('0x169')});db[_0xe536('0x62')][_0xe536('0x145')](db[_0xe536('0x185')],{'as':_0xe536('0x186'),'foreignKey':_0xe536('0x187'),'onDelete':_0xe536('0x169')});db[_0xe536('0x62')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':_0xe536('0x188'),'foreignKey':_0xe536('0x180'),'onDelete':_0xe536('0x169')});db[_0xe536('0x62')][_0xe536('0x145')](db['Tag'],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db[_0xe536('0x64')]['hasMany'](db[_0xe536('0x66')],{'as':_0xe536('0x14e'),'onDelete':'cascade','foreignKey':_0xe536('0x189')});db[_0xe536('0x64')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':_0xe536('0x172'),'foreignKey':'ChatWebsiteId'});db[_0xe536('0x64')]['belongsTo'](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db[_0xe536('0x64')]['belongsTo'](db[_0xe536('0x13')],{'as':_0xe536('0x161'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x18a'),'as':'Tags'});db['ChatInteraction'][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x18a'),'as':_0xe536('0x165')});db[_0xe536('0x64')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':_0xe536('0x11e'),'foreignKey':'ChatInteractionId'});db[_0xe536('0x66')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':'cascade','as':'User'});db[_0xe536('0x66')][_0xe536('0x145')](db['CmContact'],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x66')]['belongsTo'](db[_0xe536('0x64')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x174'),'foreignKey':_0xe536('0x189')});db[_0xe536('0x66')][_0xe536('0x145')](db[_0xe536('0xe6')],{'as':_0xe536('0xe6'),'foreignKey':_0xe536('0x17f')});db[_0xe536('0x66')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':'Account','foreignKey':_0xe536('0x180')});db[_0xe536('0x18b')][_0xe536('0x145')](db[_0xe536('0x6d')],{'onDelete':_0xe536('0x10a'),'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db['ChatOfflineMessage'][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x180')});db['ChatQueue'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Agents','through':_0xe536('0x32'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0xe536('0x11a')],{'through':_0xe536('0x18c'),'as':'Teams'});db[_0xe536('0x69')][_0xe536('0x107')](db[_0xe536('0xd0')],{'as':_0xe536('0x14e'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db['ChatGroup'][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x18d'),'through':_0xe536('0x113')});db[_0xe536('0x6b')][_0xe536('0x145')](db[_0xe536('0x5f')],{'as':'Website','foreignKey':_0xe536('0x180')});db['CmCompany'][_0xe536('0x107')](db[_0xe536('0x6d')],{'as':_0xe536('0x115'),'foreignKey':_0xe536('0x18e')});db[_0xe536('0x6d')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xe536('0x18f')],{'as':_0xe536('0x10b'),'foreignKey':'ContactId'});db[_0xe536('0x6d')]['hasMany'](db[_0xe536('0x73')],{'as':_0xe536('0x13f'),'foreignKey':'ContactId'});db[_0xe536('0x6d')][_0xe536('0x107')](db[_0xe536('0x75')],{'as':_0xe536('0x75'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x6d')][_0xe536('0x107')](db['JscriptySessionReport'],{'as':_0xe536('0x140'),'foreignKey':_0xe536('0x160')});db[_0xe536('0x6d')][_0xe536('0x107')](db[_0xe536('0x5a')],{'as':_0xe536('0x10c'),'foreignKey':'ContactId','onDelete':_0xe536('0x169')});db[_0xe536('0x6d')]['hasMany'](db[_0xe536('0x64')],{'as':_0xe536('0x11d'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x169')});db[_0xe536('0x6d')][_0xe536('0x107')](db[_0xe536('0x52')],{'as':_0xe536('0x10d'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x169')});db[_0xe536('0x6d')][_0xe536('0x107')](db['FaxInteraction'],{'as':_0xe536('0x10e'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x169')});db[_0xe536('0x6d')]['hasMany'](db[_0xe536('0x10f')],{'as':_0xe536('0x11b'),'foreignKey':'ContactId','onDelete':_0xe536('0x169')});db[_0xe536('0x6d')]['belongsTo'](db[_0xe536('0x190')],{'as':_0xe536('0x191'),'foreignKey':_0xe536('0x18e')});db[_0xe536('0x6d')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xe536('0x6d')][_0xe536('0x114')](db['User'],{'as':_0xe536('0x166'),'through':'cm_user_has_contacts'});db[_0xe536('0x6d')][_0xe536('0x114')](db[_0xe536('0x164')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xe536('0x6d')]['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x192'),'as':_0xe536('0x165')});db[_0xe536('0x6f')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x6f')]['belongsTo'](db[_0xe536('0x117')],{'as':'List','foreignKey':_0xe536('0x15c'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x6f')]['belongsTo'](db['User'],{'as':_0xe536('0x184'),'foreignKey':_0xe536('0x106')});db[_0xe536('0x6f')][_0xe536('0x145')](db[_0xe536('0x1c')],{'as':_0xe536('0x186'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe536('0x6f')]['belongsTo'](db[_0xe536('0xe4')],{'as':_0xe536('0xe4'),'foreignKey':'CampaignId','onDelete':_0xe536('0x10a')});db[_0xe536('0x6f')]['belongsTo'](db[_0xe536('0x13')],{'as':_0xe536('0x161'),'foreignKey':_0xe536('0x193')});db[_0xe536('0x71')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x71')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x71')]['belongsTo'](db[_0xe536('0x1c')],{'as':_0xe536('0x186'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe536('0x71')][_0xe536('0x145')](db['Campaign'],{'as':_0xe536('0xe4'),'foreignKey':_0xe536('0x194'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x7a')][_0xe536('0x107')](db['Condition'],{'as':{'plural':_0xe536('0x195'),'singular':_0xe536('0x196')},'foreignKey':_0xe536('0x197'),'onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x7a')][_0xe536('0x107')](db[_0xe536('0x7f')],{'as':{'plural':_0xe536('0x198'),'singular':_0xe536('0x199')},'foreignKey':_0xe536('0x19a'),'onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x7a')][_0xe536('0x107')](db['Action'],{'as':'Actions','foreignKey':_0xe536('0x19b'),'onDelete':'cascade','hooks':!![]});db['Interval'][_0xe536('0x107')](db[_0xe536('0x81')],{'as':_0xe536('0x19c'),'foreignKey':'IntervalId','onDelete':_0xe536('0x10a'),'hooks':!![],'required':![]});db[_0xe536('0x81')][_0xe536('0x107')](db[_0xe536('0x138')],{'as':_0xe536('0x19d'),'foreignKey':_0xe536('0x144'),'onDelete':_0xe536('0x169')});db['Interval']['hasMany'](db['MailApplication'],{'as':_0xe536('0x19e'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x81')][_0xe536('0x107')](db[_0xe536('0x62')],{'as':_0xe536('0x19f'),'foreignKey':_0xe536('0x144')});db['Interval'][_0xe536('0x107')](db[_0xe536('0x16d')],{'as':_0xe536('0x1a0'),'foreignKey':'IntervalId'});db[_0xe536('0x81')]['hasMany'](db['SmsApplication'],{'as':_0xe536('0x1a1'),'foreignKey':_0xe536('0x144')});db[_0xe536('0x87')]['belongsTo'](db['MailAccount'],{});db['Schedule'][_0xe536('0x145')](db[_0xe536('0x93')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0xe536('0x1a2')],{'foreignKey':_0xe536('0x1a3')});db[_0xe536('0x13a')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0xe536('0x1a4'),'through':_0xe536('0x13b'),'onDelete':_0xe536('0x169')});db[_0xe536('0x164')][_0xe536('0x114')](db[_0xe536('0x6d')],{'through':_0xe536('0x192')});db[_0xe536('0x164')][_0xe536('0x114')](db[_0xe536('0x64')],{'through':_0xe536('0x18a')});db['Tag'][_0xe536('0x114')](db[_0xe536('0x10f')],{'through':_0xe536('0x162')});db[_0xe536('0x164')]['belongsToMany'](db[_0xe536('0x52')],{'through':_0xe536('0x177')});db[_0xe536('0x164')]['belongsToMany'](db[_0xe536('0x48')],{'through':_0xe536('0x173')});db[_0xe536('0x164')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xe536('0x17e')});db[_0xe536('0x164')][_0xe536('0x114')](db[_0xe536('0xfc')],{'through':_0xe536('0x1a5')});db[_0xe536('0x8c')][_0xe536('0x107')](db[_0xe536('0x7f')],{'as':{'plural':_0xe536('0x1a6'),'singular':_0xe536('0x1a7')},'foreignKey':'TriggerAllId','onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x8c')][_0xe536('0x107')](db[_0xe536('0x7f')],{'as':{'plural':_0xe536('0x1a8'),'singular':'AnyCondition'},'foreignKey':_0xe536('0x1a9'),'onDelete':_0xe536('0x10a'),'hooks':!![]});db[_0xe536('0x8c')]['hasMany'](db[_0xe536('0x78')],{'as':_0xe536('0x1aa'),'foreignKey':'TriggerId','onDelete':_0xe536('0x10a'),'hooks':!![]});db['AnalyticCustomReport'][_0xe536('0x107')](db[_0xe536('0x99')],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1a3'),'hooks':!![]});db[_0xe536('0x93')][_0xe536('0x107')](db[_0xe536('0x99')],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1ac')});db[_0xe536('0x97')][_0xe536('0x107')](db[_0xe536('0x99')],{'as':_0xe536('0x1ab'),'onDelete':'cascade','foreignKey':_0xe536('0x1ad')});db['AnalyticFieldReport']['belongsTo'](db[_0xe536('0x97')],{'foreignKey':_0xe536('0x1ad')});db[_0xe536('0x1ae')][_0xe536('0x107')](db[_0xe536('0x1af')],{'as':_0xe536('0x1b0'),'onDelete':'cascade','foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1af')]['hasMany'](db[_0xe536('0x9e')],{'as':'Subjects','onDelete':_0xe536('0x10a'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xe536('0x107')](db['SalesforceField'],{'as':_0xe536('0x1b2'),'onDelete':'cascade','foreignKey':_0xe536('0x1b3')});db['SalesforceConfiguration'][_0xe536('0x107')](db[_0xe536('0x9e')],{'as':_0xe536('0x1ab'),'onDelete':'cascade','foreignKey':_0xe536('0x1b4')});db[_0xe536('0x1af')][_0xe536('0x145')](db[_0xe536('0x1ae')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x9e')][_0xe536('0x107')](db['SalesforceField'],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0x9e')][_0xe536('0x107')](db['SalesforceField'],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x9e')]['hasMany'](db[_0xe536('0x9e')],{'as':'Field','foreignKey':_0xe536('0x1b4')});db['SalesforceField'][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xa0')][_0xe536('0x107')](db[_0xe536('0x1ba')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1ba')][_0xe536('0x107')](db[_0xe536('0xa2')],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0x1ba')]['hasMany'](db[_0xe536('0xa2')],{'as':_0xe536('0x1b2'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x1ba')][_0xe536('0x107')](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xe536('0x1ba')][_0xe536('0x145')](db[_0xe536('0xa0')],{'as':'Account','foreignKey':'AccountId'});db[_0xe536('0xa2')][_0xe536('0x107')](db['SugarcrmField'],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xa2')][_0xe536('0x107')](db[_0xe536('0xa2')],{'as':_0xe536('0x1b7'),'foreignKey':'DescriptionId'});db[_0xe536('0xa2')][_0xe536('0x107')](db[_0xe536('0xa2')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xa2')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':'VariableId'});db['DeskAccount'][_0xe536('0x107')](db[_0xe536('0xa5')],{'as':_0xe536('0x1b0'),'onDelete':'cascade','foreignKey':_0xe536('0x1b1')});db[_0xe536('0xa5')][_0xe536('0x107')](db['DeskField'],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xa5')][_0xe536('0x107')](db[_0xe536('0xa7')],{'as':_0xe536('0x1b2'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xa5')]['hasMany'](db['DeskField'],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xa5')][_0xe536('0x145')](db[_0xe536('0xa4')],{'as':'Account','foreignKey':_0xe536('0x1b1')});db[_0xe536('0xa5')][_0xe536('0x114')](db[_0xe536('0x164')],{'through':_0xe536('0x1bd')});db['DeskField']['hasMany'](db[_0xe536('0xa7')],{'as':_0xe536('0x1b5'),'foreignKey':'SubjectId'});db[_0xe536('0xa7')]['hasMany'](db[_0xe536('0xa7')],{'as':'Description','foreignKey':_0xe536('0x1b3')});db[_0xe536('0xa7')][_0xe536('0x107')](db[_0xe536('0xa7')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db['DeskField'][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db['ZohoAccount'][_0xe536('0x107')](db[_0xe536('0xaa')],{'as':'Configurations','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db['ZohoConfiguration'][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xaa')][_0xe536('0x107')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db['ZohoConfiguration'][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1ab'),'onDelete':_0xe536('0x10a'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xe536('0x145')](db[_0xe536('0xa9')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1be')][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0x1be')][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x1be')][_0xe536('0x107')](db[_0xe536('0x1be')],{'as':_0xe536('0x1bc'),'foreignKey':'FieldId'});db['ZohoField'][_0xe536('0x145')](db['Variable'],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db['ZendeskAccount'][_0xe536('0x107')](db['ZendeskConfiguration'],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xae')]['hasMany'](db[_0xe536('0xb0')],{'as':_0xe536('0x1bb'),'foreignKey':'SubjectId'});db[_0xe536('0xae')][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1b2'),'foreignKey':_0xe536('0x1b3')});db['ZendeskConfiguration'][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1ab'),'foreignKey':'FieldId'});db[_0xe536('0xae')]['belongsTo'](db['ZendeskAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xae')][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x1bf')});db[_0xe536('0xb0')][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db['ZendeskField'][_0xe536('0x107')](db[_0xe536('0xb0')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xb0')][_0xe536('0x107')](db['ZendeskField'],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xb0')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xb2')][_0xe536('0x107')](db['FreshdeskConfiguration'],{'as':_0xe536('0x1b0'),'onDelete':'cascade','foreignKey':_0xe536('0x1b1')});db[_0xe536('0xb4')][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':_0xe536('0x1bb'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xb4')]['hasMany'](db[_0xe536('0xb6')],{'as':'Descriptions','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xb4')][_0xe536('0x107')](db['FreshdeskField'],{'as':'Fields','onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xb4')]['belongsTo'](db[_0xe536('0xb2')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xb4')][_0xe536('0x114')](db['Tag'],{'through':_0xe536('0x1c0')});db['FreshdeskField'][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xb6')][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':'Description','foreignKey':_0xe536('0x1b3')});db['FreshdeskField'][_0xe536('0x107')](db[_0xe536('0xb6')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db['FreshdeskField']['belongsTo'](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db['VtigerAccount']['hasMany'](db[_0xe536('0xba')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xba')][_0xe536('0x107')](db[_0xe536('0xbc')],{'as':'Subjects','foreignKey':_0xe536('0x1b6')});db['VtigerConfiguration'][_0xe536('0x107')](db[_0xe536('0xbc')],{'as':_0xe536('0x1b2'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xe536('0x107')](db['VtigerField'],{'as':_0xe536('0x1ab'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xba')][_0xe536('0x145')](db['VtigerAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xbc')]['hasMany'](db[_0xe536('0xbc')],{'as':'Subject','foreignKey':_0xe536('0x1b6')});db[_0xe536('0xbc')]['hasMany'](db['VtigerField'],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xbc')][_0xe536('0x107')](db[_0xe536('0xbc')],{'as':_0xe536('0x1bc'),'foreignKey':_0xe536('0x1b4')});db[_0xe536('0xbc')][_0xe536('0x145')](db['Variable'],{'as':'Variable','foreignKey':_0xe536('0x1b9')});db[_0xe536('0xbe')][_0xe536('0x107')](db[_0xe536('0x1c1')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0x1c1')]['hasMany'](db[_0xe536('0xc0')],{'as':_0xe536('0x1bb'),'foreignKey':'SubjectId'});db[_0xe536('0x1c1')][_0xe536('0x107')](db[_0xe536('0xc0')],{'as':_0xe536('0x1b2'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0x1c1')][_0xe536('0x107')](db[_0xe536('0xc0')],{'as':'Fields','foreignKey':_0xe536('0x1b4')});db[_0xe536('0x1c1')][_0xe536('0x145')](db['ServicenowAccount'],{'as':_0xe536('0x172'),'foreignKey':'AccountId'});db[_0xe536('0xc0')]['hasMany'](db[_0xe536('0xc0')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xc0')][_0xe536('0x107')](db[_0xe536('0xc0')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xc0')]['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':_0xe536('0x1b4')});db[_0xe536('0xc0')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xc2')][_0xe536('0x107')](db[_0xe536('0xc4')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xe536('0x107')](db[_0xe536('0xc6')],{'as':_0xe536('0x1b2'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xc4')][_0xe536('0x107')](db[_0xe536('0xc6')],{'as':_0xe536('0x1ab'),'onDelete':'cascade','foreignKey':_0xe536('0x1b4')});db['Dynamics365Configuration']['belongsTo'](db[_0xe536('0xc2')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xc6')][_0xe536('0x107')](db[_0xe536('0xc6')],{'as':_0xe536('0x1b5'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xc6')][_0xe536('0x107')](db['Dynamics365Field'],{'as':_0xe536('0x1b7'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Field','foreignKey':_0xe536('0x1b4')});db[_0xe536('0xc6')][_0xe536('0x145')](db['Variable'],{'as':'Variable','foreignKey':_0xe536('0x1b9')});db[_0xe536('0xc8')]['hasMany'](db[_0xe536('0xca')],{'as':_0xe536('0x1b0'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xca')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1bb'),'foreignKey':_0xe536('0x1b6')});db[_0xe536('0xca')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':'Descriptions','foreignKey':_0xe536('0x1b3')});db[_0xe536('0xca')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1ab'),'foreignKey':'FieldId'});db[_0xe536('0xca')][_0xe536('0x145')](db[_0xe536('0xc8')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1b1')});db[_0xe536('0xcc')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe536('0xcc')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1b7'),'foreignKey':_0xe536('0x1b3')});db[_0xe536('0xcc')][_0xe536('0x107')](db[_0xe536('0xcc')],{'as':_0xe536('0x1bc'),'foreignKey':'FieldId'});db[_0xe536('0xcc')][_0xe536('0x145')](db[_0xe536('0x1b8')],{'as':_0xe536('0x1b8'),'foreignKey':_0xe536('0x1b9')});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x5f')],{});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db[_0xe536('0xcf')][_0xe536('0x145')](db['ChatInteraction'],{});db[_0xe536('0xcf')][_0xe536('0x145')](db['ChatMessage'],{});db[_0xe536('0xcf')][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0xcf')]['belongsTo'](db[_0xe536('0x185')],{});db[_0xe536('0xd0')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1c2')});db[_0xe536('0xd0')][_0xe536('0x145')](db[_0xe536('0x13')],{'onDelete':'cascade','foreignKey':_0xe536('0x1c3')});db[_0xe536('0xd4')]['hasMany'](db[_0xe536('0x1c4')],{'foreignKey':_0xe536('0x1c5'),'onDelete':'cascade'});db[_0xe536('0xd4')][_0xe536('0x107')](db[_0xe536('0x1c6')],{'foreignKey':_0xe536('0x1c5'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x1c7')]['belongsTo'](db[_0xe536('0x4f')],{});db[_0xe536('0x1c7')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':_0xe536('0x15c')});db['SmsQueueReport']['belongsTo'](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db['SmsQueueReport']['belongsTo'](db[_0xe536('0x52')],{});db[_0xe536('0x1c7')][_0xe536('0x145')](db['SmsMessage'],{});db[_0xe536('0x1c7')]['belongsTo'](db[_0xe536('0x13')],{});db[_0xe536('0x1c7')]['belongsTo'](db['SmsQueue'],{});db[_0xe536('0x1c8')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0xe536('0x1c8')][_0xe536('0x107')](db[_0xe536('0x1c4')],{'foreignKey':_0xe536('0x1c9')});db[_0xe536('0x1c8')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xe536('0xdf')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Users','through':_0xe536('0x1ca')});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x1cb')});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x1c')],{'through':_0xe536('0x14b'),'as':'VoiceQueues'});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x3c')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x185')],{'through':_0xe536('0x18c'),'as':_0xe536('0x127')});db[_0xe536('0x11a')][_0xe536('0x114')](db[_0xe536('0x4b')],{'through':'team_has_fax_queues','as':_0xe536('0x128')});db[_0xe536('0x11a')][_0xe536('0x114')](db['SmsQueue'],{'through':_0xe536('0x17a'),'as':'SmsQueues'});db['Team'][_0xe536('0x114')](db['OpenchannelQueue'],{'through':_0xe536('0x1cc'),'as':_0xe536('0x1cd')});db['Team'][_0xe536('0x114')](db[_0xe536('0x12b')],{'through':_0xe536('0x1ce'),'as':_0xe536('0x12c')});db[_0xe536('0xe4')][_0xe536('0x107')](db[_0xe536('0x6f')],{'as':_0xe536('0x13e'),'foreignKey':_0xe536('0x194')});db[_0xe536('0xe4')][_0xe536('0x107')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe536('0x194')});db['Campaign'][_0xe536('0x107')](db[_0xe536('0x73')],{'as':_0xe536('0x13f'),'foreignKey':_0xe536('0x194')});db[_0xe536('0xe4')]['hasMany'](db[_0xe536('0x71')],{'as':_0xe536('0x1cf'),'foreignKey':'CampaignId'});db[_0xe536('0xe4')]['belongsTo'](db[_0xe536('0x2c')],{'as':'Trunk','foreignKey':_0xe536('0x141')});db[_0xe536('0xe4')][_0xe536('0x145')](db[_0xe536('0x2c')],{'as':_0xe536('0x142'),'foreignKey':_0xe536('0x143')});db[_0xe536('0xe4')][_0xe536('0x145')](db[_0xe536('0x81')],{'as':'Interval','foreignKey':_0xe536('0x144')});db['Campaign'][_0xe536('0x145')](db[_0xe536('0xdf')],{'as':_0xe536('0xdf'),'foreignKey':_0xe536('0x1d0')});db[_0xe536('0xe4')][_0xe536('0x114')](db[_0xe536('0x117')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xe536('0xe4')][_0xe536('0x114')](db['CmList'],{'as':'BlackLists','through':_0xe536('0x1d1')});db[_0xe536('0x1d2')][_0xe536('0x145')](db[_0xe536('0x3f')],{});db['MailTransferReport']['belongsTo'](db[_0xe536('0x10f')],{});db[_0xe536('0x1d2')][_0xe536('0x145')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xe536('0x1d3')});db['MailTransferReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':'FromUserId','as':_0xe536('0x1d4')});db[_0xe536('0x1d2')][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1d5'),'as':_0xe536('0x1d6')});db[_0xe536('0x1d2')]['belongsTo'](db[_0xe536('0x3c')],{'foreignKey':_0xe536('0x1d7'),'as':'ToQueue'});db[_0xe536('0x1d2')]['belongsTo'](db[_0xe536('0x3a')],{'foreignKey':_0xe536('0x1d8'),'as':'ToAccount'});db[_0xe536('0xeb')]['belongsTo'](db[_0xe536('0x66')],{});db[_0xe536('0xeb')][_0xe536('0x145')](db[_0xe536('0x64')],{});db[_0xe536('0xeb')]['belongsTo'](db[_0xe536('0x5f')],{'foreignKey':_0xe536('0x1d9'),'as':'FromAccount'});db['ChatTransferReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db[_0xe536('0xeb')][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe536('0xeb')][_0xe536('0x145')](db[_0xe536('0x185')],{'foreignKey':'ToChatQueueId','as':_0xe536('0x1db')});db['ChatTransferReport'][_0xe536('0x145')](db[_0xe536('0x5f')],{'foreignKey':_0xe536('0x1dc'),'as':'ToAccount'});db['FaxTransferReport'][_0xe536('0x145')](db[_0xe536('0x171')],{});db['FaxTransferReport'][_0xe536('0x145')](db[_0xe536('0x48')],{});db[_0xe536('0x1dd')][_0xe536('0x145')](db['FaxAccount'],{'foreignKey':_0xe536('0x1de'),'as':_0xe536('0x1d3')});db['FaxTransferReport'][_0xe536('0x145')](db['User'],{'foreignKey':_0xe536('0x1da'),'as':'FromAgent'});db['FaxTransferReport'][_0xe536('0x145')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe536('0x1dd')][_0xe536('0x145')](db[_0xe536('0x4b')],{'foreignKey':_0xe536('0x1df'),'as':'ToQueue'});db[_0xe536('0x1dd')]['belongsTo'](db[_0xe536('0x47')],{'foreignKey':'ToFaxAccountId','as':_0xe536('0x1e0')});db['OpenchannelTransferReport'][_0xe536('0x145')](db['OpenchannelMessage'],{});db[_0xe536('0xee')][_0xe536('0x145')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xe536('0x145')](db['OpenchannelAccount'],{'foreignKey':_0xe536('0x1e1'),'as':_0xe536('0x1d3')});db[_0xe536('0xee')][_0xe536('0x145')](db['User'],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db['OpenchannelTransferReport'][_0xe536('0x145')](db['User'],{'foreignKey':'ToUserId','as':_0xe536('0x1d6')});db[_0xe536('0xee')][_0xe536('0x145')](db[_0xe536('0x5d')],{'foreignKey':_0xe536('0x1e2'),'as':_0xe536('0x1db')});db[_0xe536('0xee')][_0xe536('0x145')](db[_0xe536('0x57')],{'foreignKey':'ToOpenchannelAccountId','as':_0xe536('0x1e0')});db[_0xe536('0xf0')]['belongsTo'](db['SmsMessage'],{});db[_0xe536('0xf0')][_0xe536('0x145')](db[_0xe536('0x52')],{});db[_0xe536('0xf0')][_0xe536('0x145')](db[_0xe536('0x4f')],{'foreignKey':_0xe536('0x1e3'),'as':_0xe536('0x1d3')});db[_0xe536('0xf0')][_0xe536('0x145')](db['User'],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db[_0xe536('0xf0')]['belongsTo'](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1d5'),'as':_0xe536('0x1d6')});db[_0xe536('0xf0')]['belongsTo'](db[_0xe536('0x56')],{'foreignKey':_0xe536('0x1e4'),'as':_0xe536('0x1db')});db[_0xe536('0xf0')][_0xe536('0x145')](db[_0xe536('0x4f')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x7e')],{'as':'Dispositions','foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')]['hasMany'](db[_0xe536('0x1e5')],{'as':'CustomFields','foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x6d')],{'as':_0xe536('0x115'),'onDelete':_0xe536('0x10a'),'foreignKey':'ListId'});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x18f')],{'as':_0xe536('0x10b'),'foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')][_0xe536('0x107')](db[_0xe536('0x73')],{'as':'HopperHistory','foreignKey':_0xe536('0x15c')});db[_0xe536('0x117')][_0xe536('0x107')](db['ReportAgentPreview'],{'as':_0xe536('0x75'),'foreignKey':'ListId'});db['CmList'][_0xe536('0x114')](db[_0xe536('0x1c')],{'as':_0xe536('0x1e6'),'through':_0xe536('0x148')});db[_0xe536('0x117')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x119')});db[_0xe536('0xf2')][_0xe536('0x107')](db['VoiceExtension'],{'as':_0xe536('0x19d'),'onDelete':_0xe536('0x10a')});db[_0xe536('0xf2')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x149'),'through':_0xe536('0x12e')});db[_0xe536('0xf4')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xe536('0x111')});db['UserProfile'][_0xe536('0x107')](db[_0xe536('0x1e7')],{'as':_0xe536('0x1e8'),'foreignKey':_0xe536('0x111'),'onDelete':_0xe536('0x10a')});db[_0xe536('0x1e7')][_0xe536('0x107')](db['UserProfileResource'],{'as':_0xe536('0x1e9'),'foreignKey':_0xe536('0x1ea'),'onDelete':_0xe536('0x10a')});db['WhatsappAccount'][_0xe536('0x107')](db['Disposition'],{'as':_0xe536('0x158'),'foreignKey':'WhatsappAccountId'});db[_0xe536('0x1eb')][_0xe536('0x107')](db['CannedAnswer'],{'as':_0xe536('0x159'),'foreignKey':_0xe536('0x1ec')});db[_0xe536('0x1eb')][_0xe536('0x107')](db[_0xe536('0xfd')],{'as':_0xe536('0x14e'),'foreignKey':_0xe536('0x1ec')});db[_0xe536('0x1eb')]['hasMany'](db[_0xe536('0xfc')],{'as':_0xe536('0x15a')});db[_0xe536('0x1eb')][_0xe536('0x107')](db['WhatsappApplication'],{'as':'Applications'});db[_0xe536('0x1eb')][_0xe536('0x145')](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db['WhatsappAccount']['belongsTo'](db[_0xe536('0x83')],{'as':_0xe536('0x146'),'foreignKey':_0xe536('0x147')});db[_0xe536('0x1eb')][_0xe536('0x114')](db['User'],{'as':'Agents','through':_0xe536('0x1ed')});db[_0xe536('0x1ee')]['belongsTo'](db['User'],{'onDelete':_0xe536('0x169')});db[_0xe536('0x1ee')][_0xe536('0x145')](db[_0xe536('0x12b')],{'onDelete':_0xe536('0x169')});db[_0xe536('0x1ee')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'onDelete':'restrict'});db[_0xe536('0x1ee')][_0xe536('0x145')](db[_0xe536('0x81')],{'onDelete':'restrict','foreignKey':_0xe536('0x144')});db[_0xe536('0x1ee')]['belongsTo'](db['Tag'],{'onDelete':_0xe536('0x169'),'foreignKey':_0xe536('0x16a')});db['WhatsappInteraction']['hasMany'](db[_0xe536('0xfd')],{'as':_0xe536('0x14e'),'onDelete':_0xe536('0x10a'),'foreignKey':_0xe536('0x1ef')});db[_0xe536('0xfc')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1ec')});db[_0xe536('0xfc')]['belongsTo'](db[_0xe536('0x6d')],{'as':'Contact','foreignKey':_0xe536('0x160')});db[_0xe536('0xfc')][_0xe536('0x145')](db[_0xe536('0x13')],{'as':'Owner','foreignKey':_0xe536('0x106')});db['WhatsappInteraction']['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x1a5'),'as':_0xe536('0x163')});db['WhatsappInteraction']['belongsToMany'](db[_0xe536('0x164')],{'through':_0xe536('0x1a5'),'as':_0xe536('0x165')});db[_0xe536('0xfc')]['belongsToMany'](db[_0xe536('0x13')],{'as':_0xe536('0x166'),'through':_0xe536('0x122'),'foreignKey':_0xe536('0x1ef')});db['WhatsappMessage'][_0xe536('0x145')](db[_0xe536('0x13')],{'as':_0xe536('0x13')});db[_0xe536('0xfd')][_0xe536('0x145')](db['CmContact'],{'onDelete':'cascade','as':_0xe536('0x153')});db['WhatsappMessage'][_0xe536('0x145')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xe536('0x174'),'foreignKey':'WhatsappInteractionId'});db[_0xe536('0xfd')][_0xe536('0x145')](db['WhatsappAccount'],{'as':_0xe536('0x172'),'foreignKey':_0xe536('0x1ec')});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0x1eb')],{});db[_0xe536('0xff')]['belongsTo'](db[_0xe536('0x117')],{'as':_0xe536('0x15b'),'foreignKey':'ListId'});db[_0xe536('0xff')][_0xe536('0x145')](db[_0xe536('0x6d')],{'as':_0xe536('0x153'),'foreignKey':_0xe536('0x160')});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0xfc')],{});db[_0xe536('0xff')][_0xe536('0x145')](db[_0xe536('0x12b')],{});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0xfd')],{});db['WhatsappQueueReport'][_0xe536('0x145')](db[_0xe536('0x13')],{});db[_0xe536('0x1f0')][_0xe536('0x145')](db['WhatsappMessage'],{});db[_0xe536('0x1f0')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xe536('0x1f0')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'foreignKey':_0xe536('0x1f1'),'as':_0xe536('0x1d3')});db[_0xe536('0x1f0')][_0xe536('0x145')](db[_0xe536('0x1eb')],{'foreignKey':_0xe536('0x1f2'),'as':_0xe536('0x1e0')});db['WhatsappTransferReport'][_0xe536('0x145')](db[_0xe536('0x12b')],{'foreignKey':_0xe536('0x1f3'),'as':_0xe536('0x1db')});db['WhatsappTransferReport'][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':_0xe536('0x1da'),'as':_0xe536('0x1d4')});db[_0xe536('0x1f0')][_0xe536('0x145')](db[_0xe536('0x13')],{'foreignKey':'ToUserId','as':_0xe536('0x1d6')});db[_0xe536('0x12b')][_0xe536('0x114')](db[_0xe536('0x13')],{'as':'Agents','through':_0xe536('0x37'),'foreignKey':_0xe536('0x1f4')});db['WhatsappQueue']['belongsToMany'](db[_0xe536('0x11a')],{'through':_0xe536('0x1ce'),'as':_0xe536('0x14a')});module[_0xe536('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6dd1=['License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','Notifications','SenderId','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sounds','CmHopper','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','Interval','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','MailQueue','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','IntervalId','TagId','FaxAccountId','Exntensions','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Tags','AttachmentId','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsMessage','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatWebsiteId','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','CompanyId','Hoppers','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','OneAny','Actions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','AnalyticMetric','MetricId','SalesforceAccount','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','Configurations','SugarcrmField','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','FromId','ToId','JscriptyAnswerReport','SessionId','ProjectId','team_has_fax_queues','team_has_openchannel_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToUserId','ToSmsQueueId','ToSmsAccountId','CustomFields','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','sequelizeHistory','utf8','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6dd1,0x111));var _0x16dd=function(_0x26019f,_0x264a38){_0x26019f=_0x26019f-0x0;var _0x211f44=_0x6dd1[_0x26019f];return _0x211f44;};'use strict';var path=require(_0x16dd('0x0'));var config=require('../config/environment');var Sequelize=require(_0x16dd('0x1'));var _=require(_0x16dd('0x2'));var jstz=require('jstz');var timezone=jstz[_0x16dd('0x3')]();config[_0x16dd('0x1')]=_[_0x16dd('0x4')](config[_0x16dd('0x1')],{'database':_0x16dd('0x5'),'username':_0x16dd('0x6'),'password':_0x16dd('0x7'),'options':{'host':_0x16dd('0x8'),'port':0xcea,'dialect':_0x16dd('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x16dd('0xa')]=_[_0x16dd('0x4')](config[_0x16dd('0xa')],{'database':_0x16dd('0x5'),'username':'xcall','password':_0x16dd('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x16dd('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x16dd('0xb'),'collate':_0x16dd('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x16dd('0xd')],config[_0x16dd('0x1')][_0x16dd('0xe')],config['sequelize'][_0x16dd('0xf')],config[_0x16dd('0x1')][_0x16dd('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x16dd('0xa')][_0x16dd('0xd')],config['sequelizeHistory']['username'],config[_0x16dd('0xa')]['password'],config[_0x16dd('0xa')][_0x16dd('0x10')])};db[_0x16dd('0x11')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x13'));db[_0x16dd('0x14')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x15'));db[_0x16dd('0x16')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x17'));db['VoiceExtension']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x18'));db[_0x16dd('0x19')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x1a'));db[_0x16dd('0x1b')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x16dd('0x1c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x1d'));db[_0x16dd('0x1e')]=db['sequelize']['import'](_0x16dd('0x1f'));db[_0x16dd('0x20')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x21'));db[_0x16dd('0x22')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x23'));db[_0x16dd('0x24')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x25'));db[_0x16dd('0x26')]=db['sequelize']['import'](_0x16dd('0x27'));db[_0x16dd('0x28')]=db['sequelize']['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x16dd('0x29')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x16dd('0x2a')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x2b'));db['Trunk']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/trunk/trunk.model');db[_0x16dd('0x2c')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x2d'));db['UserVoiceQueueRt']=db[_0x16dd('0x1')]['import'](_0x16dd('0x2e'));db[_0x16dd('0x2f')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x30'));db[_0x16dd('0x31')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x32'));db[_0x16dd('0x33')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x34'));db[_0x16dd('0x35')]=db['sequelize'][_0x16dd('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x16dd('0x36')]=db[_0x16dd('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x16dd('0x37')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x38'));db[_0x16dd('0x39')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x3a'));db[_0x16dd('0x3b')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x3c'));db[_0x16dd('0x3d')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x3e'));db[_0x16dd('0x3f')]=db[_0x16dd('0x1')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db['sequelize'][_0x16dd('0x12')]('../api/mailQueue/mailQueue.model');db[_0x16dd('0x40')]=db['sequelize'][_0x16dd('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x16dd('0x41')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x42'));db[_0x16dd('0x43')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x44'));db[_0x16dd('0x45')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x46'));db[_0x16dd('0x47')]=db['sequelize']['import'](_0x16dd('0x48'));db['Dashboard']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x49'));db[_0x16dd('0x4a')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x4b'));db[_0x16dd('0x4c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x4d'));db[_0x16dd('0x4e')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x4f'));db[_0x16dd('0x50')]=db[_0x16dd('0x1')]['import']('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x51'));db[_0x16dd('0x52')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x53'));db[_0x16dd('0x54')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/smsAccount/smsAccount.model');db[_0x16dd('0x55')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x56'));db[_0x16dd('0x57')]=db['sequelize']['import'](_0x16dd('0x58'));db['SmsMessage']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x59'));db[_0x16dd('0x5a')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x5b'));db[_0x16dd('0x5c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x5d'));db[_0x16dd('0x5e')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x5f'));db[_0x16dd('0x60')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x61'));db['OpenchannelMessage']=db[_0x16dd('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x16dd('0x62')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x63'));db['ChatWebsite']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x64'));db[_0x16dd('0x65')]=db['sequelize'][_0x16dd('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x16dd('0x66')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x67'));db['ChatInteraction']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x68'));db['ChatMessage']=db[_0x16dd('0x1')]['import'](_0x16dd('0x69'));db[_0x16dd('0x6a')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x6b'));db[_0x16dd('0x6c')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x6d'));db['ChatGroup']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/chatGroup/chatGroup.model');db[_0x16dd('0x6e')]=db['sequelize']['import'](_0x16dd('0x6f'));db[_0x16dd('0x70')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x71'));db[_0x16dd('0x72')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x73'));db['CmHopper']=db[_0x16dd('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0x16dd('0x74')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x75'));db[_0x16dd('0x76')]=db[_0x16dd('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x16dd('0x1')]['import'](_0x16dd('0x77'));db['ReportAgentPreview']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x78'));db[_0x16dd('0x79')]=db[_0x16dd('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x16dd('0x7a')]=db[_0x16dd('0x1')]['import']('../api/action/action.model');db[_0x16dd('0x7b')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x7c'));db[_0x16dd('0x7d')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x7e'));db['Disposition']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x7f'));db[_0x16dd('0x80')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x81'));db['Interval']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x82'));db[_0x16dd('0x83')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x84'));db['Cdr']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x85'));db['VoiceQueuesLog']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x16dd('0x86')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x87'));db[_0x16dd('0x88')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x89'));db[_0x16dd('0x8a')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x8b'));db[_0x16dd('0x8c')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x8d'));db[_0x16dd('0x8e')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x8f'));db['Variable']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x90'));db[_0x16dd('0x91')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x92'));db[_0x16dd('0x93')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x94'));db['AnalyticCustomReport']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x95'));db[_0x16dd('0x96')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x97'));db['AnalyticExtractedReport']=db['sequelize']['import'](_0x16dd('0x98'));db['AnalyticMetric']=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0x16dd('0x99')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0x9a'));db[_0x16dd('0x9b')]=db[_0x16dd('0x1')]['import'](_0x16dd('0x9c'));db['SalesforceAccount']=db[_0x16dd('0x1')]['import'](_0x16dd('0x9d'));db[_0x16dd('0x9e')]=db[_0x16dd('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x16dd('0x1')]['import'](_0x16dd('0x9f'));db['SugarcrmAccount']=db[_0x16dd('0x1')]['import'](_0x16dd('0xa0'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0x16dd('0xa1'));db['SugarcrmField']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa2'));db[_0x16dd('0xa3')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa4'));db[_0x16dd('0xa5')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa6'));db[_0x16dd('0xa7')]=db['sequelize'][_0x16dd('0x12')]('../api/intDeskField/intDeskField.model');db[_0x16dd('0xa8')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xa9'));db['ZohoConfiguration']=db[_0x16dd('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x16dd('0xaa')]=db['sequelize']['import'](_0x16dd('0xab'));db[_0x16dd('0xac')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xad'));db[_0x16dd('0xae')]=db['sequelize'][_0x16dd('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x16dd('0xaf')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb0'));db[_0x16dd('0xb1')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb2'));db['FreshdeskConfiguration']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb3'));db[_0x16dd('0xb4')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xb5'));db[_0x16dd('0xb6')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x16dd('0xb7')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xb8'));db[_0x16dd('0xb9')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x16dd('0xba')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xbb'));db[_0x16dd('0xbc')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xbd'));db['Dynamics365Configuration']=db['sequelize']['import'](_0x16dd('0xbe'));db[_0x16dd('0xbf')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x16dd('0xc0')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xc1'));db[_0x16dd('0xc2')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xc3'));db[_0x16dd('0xc4')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xc5'));db[_0x16dd('0x91')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/integration/integration.model');db['Network']=db['sequelize']['import'](_0x16dd('0xc6'));db[_0x16dd('0xc7')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xc8'));db[_0x16dd('0xc9')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xca'));db['JscriptyAnswerReport']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x16dd('0xcb')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xcc'));db[_0x16dd('0xcd')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x16dd('0xce')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xcf'));db[_0x16dd('0xd0')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xd1'));db[_0x16dd('0xd2')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xd3'));db[_0x16dd('0xd4')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xd5'));db[_0x16dd('0xd6')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xd7'));db['SquareProject']=db['sequelize']['import']('../api/squareProject/squareProject.model');db['SquareRecording']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xd8'));db['SquareMessage']=db[_0x16dd('0x1')]['import'](_0x16dd('0xd9'));db['Team']=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/team/team.model');db[_0x16dd('0xda')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/license/license.model');db[_0x16dd('0xdb')]=db['sequelize']['import'](_0x16dd('0xdc'));db['Migration']=db[_0x16dd('0x1')]['import'](_0x16dd('0xdd'));db[_0x16dd('0xde')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/attachment/attachment.model');db[_0x16dd('0xdf')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xe0'));db[_0x16dd('0xe1')]=db['sequelize']['import'](_0x16dd('0xe2'));db[_0x16dd('0xe3')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x16dd('0x1')]['import'](_0x16dd('0xe4'));db[_0x16dd('0xe5')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xe6'));db[_0x16dd('0xe7')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xe8'));db[_0x16dd('0xe9')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xea'));db[_0x16dd('0xeb')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xec'));db[_0x16dd('0xed')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xee'));db[_0x16dd('0xef')]=db[_0x16dd('0x1')]['import'](_0x16dd('0xf0'));db[_0x16dd('0xf1')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf2'));db[_0x16dd('0xf3')]=db[_0x16dd('0x1')]['import']('../api/notification/notification.model');db[_0x16dd('0xf4')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf5'));db[_0x16dd('0xf6')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf7'));db[_0x16dd('0xf8')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xf9'));db[_0x16dd('0xfa')]=db['sequelize'][_0x16dd('0x12')](_0x16dd('0xfb'));db[_0x16dd('0xfc')]=db[_0x16dd('0x1')][_0x16dd('0x12')](_0x16dd('0xfd'));db[_0x16dd('0xfe')]=db['sequelize']['import'](_0x16dd('0xff'));db[_0x16dd('0x100')]=db[_0x16dd('0x1')][_0x16dd('0x12')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0x16dd('0x12')](_0x16dd('0x101'));db[_0x16dd('0x11')][_0x16dd('0x102')](db['VoiceMail'],{'as':_0x16dd('0x20'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x104')});db['User'][_0x16dd('0x105')](db['VoiceRecording'],{'as':_0x16dd('0x106'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x107')],{'as':_0x16dd('0x108'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')]['hasMany'](db[_0x16dd('0x109')],{'as':_0x16dd('0x10a'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x76')],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')]['hasMany'](db[_0x16dd('0x10c')],{'as':_0x16dd('0x10d'),'foreignKey':'UserId'});db['User'][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':_0x16dd('0x10e'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x60')],{'as':_0x16dd('0x10f'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x110')],{'as':_0x16dd('0x111'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x57')],{'as':_0x16dd('0x112'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x11')]['hasMany'](db['FaxInteraction'],{'as':_0x16dd('0x113'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0x41')],{'as':_0x16dd('0x114'),'foreignKey':'UserId'});db[_0x16dd('0x11')][_0x16dd('0x105')](db[_0x16dd('0xf8')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x16dd('0x11')]['hasMany'](db['Notification'],{'as':_0x16dd('0x115'),'foreignKey':_0x16dd('0x116')});db[_0x16dd('0x11')]['belongsTo'](db[_0x16dd('0xed')],{'as':'UserProfile','foreignKey':_0x16dd('0x117')});db['User'][_0x16dd('0x118')](db[_0x16dd('0x119')],{'as':_0x16dd('0x11a'),'through':_0x16dd('0x11b')});db[_0x16dd('0x11')][_0x16dd('0x118')](db['CmContact'],{'as':_0x16dd('0x11c'),'through':_0x16dd('0x11d')});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':'Lists','through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0x16dd('0x11e')],{'through':_0x16dd('0x11f')});db['User']['belongsToMany'](db[_0x16dd('0x41')],{'as':_0x16dd('0x114'),'through':'user_has_mail_interactions'});db[_0x16dd('0x11')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x16dd('0x120')});db[_0x16dd('0x11')][_0x16dd('0x118')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x16dd('0x121')});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x57')],{'as':_0x16dd('0x112'),'through':'user_has_sms_interactions'});db[_0x16dd('0x11')][_0x16dd('0x118')](db['OpenchannelInteraction'],{'as':_0x16dd('0x10f'),'through':'user_has_openchannel_interactions'});db['User'][_0x16dd('0x118')](db['WhatsappInteraction'],{'as':_0x16dd('0x122'),'through':_0x16dd('0x123')});db[_0x16dd('0x11')][_0x16dd('0x118')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x16dd('0x2f'),'required':![]});db['User'][_0x16dd('0x118')](db['MailQueue'],{'as':_0x16dd('0x124'),'through':_0x16dd('0x33'),'required':![]});db['User'][_0x16dd('0x118')](db[_0x16dd('0x6c')],{'as':'ChatQueues','through':_0x16dd('0x31'),'required':![],'hooks':!![]});db['User'][_0x16dd('0x118')](db['FaxQueue'],{'as':_0x16dd('0x125'),'through':_0x16dd('0x35'),'required':![]});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0x5a')],{'as':'SmsQueues','through':_0x16dd('0x36'),'required':![]});db['User'][_0x16dd('0x118')](db[_0x16dd('0x62')],{'as':_0x16dd('0x126'),'through':_0x16dd('0x37'),'required':![]});db['User'][_0x16dd('0x118')](db[_0x16dd('0x100')],{'as':_0x16dd('0x127'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x16dd('0x118')](db['CmList'],{'through':_0x16dd('0x128')});db['User'][_0x16dd('0x118')](db[_0x16dd('0xeb')],{'as':_0x16dd('0x129'),'through':_0x16dd('0x12a'),'required':![]});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x12b')],{'as':_0x16dd('0x12c'),'through':_0x16dd('0x12d')});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x12e')],{'as':_0x16dd('0x12f'),'through':_0x16dd('0x130')});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x3f')],{'as':_0x16dd('0x131'),'through':'user_has_mail_accounts'});db[_0x16dd('0x11')]['belongsToMany'](db[_0x16dd('0x5c')],{'as':_0x16dd('0x132'),'through':_0x16dd('0x133')});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0x54')],{'as':_0x16dd('0x134'),'through':_0x16dd('0x135')});db[_0x16dd('0x11')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x16dd('0x136'),'through':_0x16dd('0x137')});db[_0x16dd('0x11')][_0x16dd('0x118')](db[_0x16dd('0x138')],{'as':_0x16dd('0x139'),'through':_0x16dd('0x13a')});db[_0x16dd('0x14')][_0x16dd('0x105')](db[_0x16dd('0x109')],{'as':_0x16dd('0x13b'),'onDelete':_0x16dd('0x103'),'foreignKey':'ChanSpyId'});db[_0x16dd('0x16')]['hasMany'](db[_0x16dd('0x109')],{'onDelete':_0x16dd('0x103')});db[_0x16dd('0x109')][_0x16dd('0x105')](db[_0x16dd('0x109')],{'as':_0x16dd('0x13c'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x19')][_0x16dd('0x118')](db[_0x16dd('0x88')],{'as':_0x16dd('0x13d'),'through':'moh_has_sounds'});db[_0x16dd('0x1b')]['hasMany'](db[_0x16dd('0x107')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x16dd('0x1b')][_0x16dd('0x105')](db[_0x16dd('0x13e')],{'as':'Hoppers','foreignKey':_0x16dd('0x13f')});db['VoiceQueue'][_0x16dd('0x105')](db[_0x16dd('0x76')],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x13f')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0x16dd('0x140'),'foreignKey':_0x16dd('0x13f')});db[_0x16dd('0x1b')][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':_0x16dd('0x10e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x16dd('0x105')](db[_0x16dd('0x74')],{'as':_0x16dd('0x141'),'foreignKey':_0x16dd('0x13f')});db[_0x16dd('0x1b')]['hasMany'](db[_0x16dd('0xcd')],{'as':_0x16dd('0x142'),'foreignKey':_0x16dd('0x13f')});db[_0x16dd('0x1b')][_0x16dd('0x143')](db[_0x16dd('0x144')],{'as':'Trunk','foreignKey':_0x16dd('0x145')});db['VoiceQueue'][_0x16dd('0x143')](db[_0x16dd('0x144')],{'as':_0x16dd('0x146'),'foreignKey':'TrunkBackupId'});db[_0x16dd('0x1b')][_0x16dd('0x143')](db['Interval'],{'as':_0x16dd('0x147'),'foreignKey':'IntervalId'});db[_0x16dd('0x1b')][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':_0x16dd('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x16dd('0x1b')]['belongsToMany'](db[_0x16dd('0xe9')],{'as':_0x16dd('0x149'),'through':_0x16dd('0x14a')});db[_0x16dd('0x1b')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x2f')});db['VoiceQueue'][_0x16dd('0x118')](db[_0x16dd('0x11e')],{'as':_0x16dd('0x14c'),'through':_0x16dd('0x14d')});db[_0x16dd('0x1b')][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':'BlackLists','through':_0x16dd('0x14e')});db['VoiceRecording']['belongsTo'](db[_0x16dd('0x11')],{'as':_0x16dd('0x11'),'foreignKey':'UserId'});db[_0x16dd('0x1e')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x11'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x20')][_0x16dd('0x105')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x16dd('0x14f'),'sourceKey':_0x16dd('0x150')});db[_0x16dd('0x22')][_0x16dd('0x143')](db[_0x16dd('0x20')],{'foreignKey':_0x16dd('0x14f'),'targetKey':_0x16dd('0x150')});db[_0x16dd('0x24')][_0x16dd('0x105')](db[_0x16dd('0x29')],{'as':_0x16dd('0x151'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x16dd('0x105')](db[_0x16dd('0x28')],{'as':_0x16dd('0x152'),'foreignKey':_0x16dd('0x153'),'constraints':![]});db[_0x16dd('0x24')]['belongsTo'](db[_0x16dd('0x11')],{'as':_0x16dd('0x11'),'foreignKey':_0x16dd('0x104')});db['VoiceCallReport'][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':'Contact','foreignKey':_0x16dd('0x154')});db[_0x16dd('0x3b')]['belongsTo'](db['MailAccount'],{'as':_0x16dd('0x3f'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3d')][_0x16dd('0x143')](db[_0x16dd('0x3f')],{'as':_0x16dd('0x3f'),'foreignKey':_0x16dd('0x155')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':_0x16dd('0x156'),'onDelete':_0x16dd('0x103')});db['MailAccount'][_0x16dd('0x102')](db[_0x16dd('0x3d')],{'as':_0x16dd('0x157'),'onDelete':'cascade'});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x43')],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x3f')]['hasMany'](db[_0x16dd('0x41')],{'as':_0x16dd('0x15c')});db[_0x16dd('0x3f')][_0x16dd('0x105')](db[_0x16dd('0x45')],{'as':'Applications'});db['MailAccount'][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0x3f')][_0x16dd('0x143')](db[_0x16dd('0x8c')],{'as':_0x16dd('0x8c'),'foreignKey':_0x16dd('0x15f')});db['MailAccount'][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x16dd('0x160')});db[_0x16dd('0x3f')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x161')});db[_0x16dd('0x162')]['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x33')});db[_0x16dd('0x162')][_0x16dd('0x118')](db['Team'],{'through':_0x16dd('0x163'),'as':'Teams'});db[_0x16dd('0x41')][_0x16dd('0x105')](db[_0x16dd('0x43')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x164')});db[_0x16dd('0x41')]['belongsTo'](db[_0x16dd('0x3f')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x155')});db['MailInteraction']['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x41')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x41')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x168'),'as':'Tags'});db[_0x16dd('0x41')][_0x16dd('0x118')](db['Tag'],{'through':_0x16dd('0x168'),'as':_0x16dd('0x169')});db['MailInteraction'][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x16b'),'foreignKey':_0x16dd('0x164')});db[_0x16dd('0x43')][_0x16dd('0x105')](db[_0x16dd('0xde')],{'as':_0x16dd('0x16c'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x43')][_0x16dd('0x143')](db['User'],{'as':_0x16dd('0x11')});db[_0x16dd('0x43')]['belongsTo'](db['CmContact'],{'onDelete':_0x16dd('0x103'),'as':'Contact'});db[_0x16dd('0x43')]['belongsTo'](db[_0x16dd('0x41')],{'as':_0x16dd('0x16d'),'foreignKey':_0x16dd('0x164')});db['MailMessage']['belongsTo'](db[_0x16dd('0x3f')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x155')});db[_0x16dd('0x45')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':'restrict'});db[_0x16dd('0x45')]['belongsTo'](db['MailQueue'],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x45')][_0x16dd('0x143')](db[_0x16dd('0x3f')],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x45')][_0x16dd('0x143')](db['Interval'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x45')][_0x16dd('0x143')](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db['MailQueueReport']['belongsTo'](db[_0x16dd('0x3f')],{});db[_0x16dd('0x47')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0x47')]['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0x47')][_0x16dd('0x143')](db['MailInteraction'],{});db['MailQueueReport'][_0x16dd('0x143')](db['MailMessage'],{});db[_0x16dd('0x47')][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x16dd('0x105')](db['DashboardItem'],{'as':'Items','onDelete':_0x16dd('0x103')});db['FaxAccount']['hasMany'](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x171')});db[_0x16dd('0x12e')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x171')});db['FaxAccount'][_0x16dd('0x105')](db[_0x16dd('0x4e')],{'as':_0x16dd('0x15c')});db[_0x16dd('0x12e')]['hasMany'](db[_0x16dd('0x4c')],{'as':_0x16dd('0x13c')});db[_0x16dd('0x12e')][_0x16dd('0x105')](db['VoiceExtension'],{'as':_0x16dd('0x172'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x12e')][_0x16dd('0x105')](db['FaxMessage'],{'as':'Messages'});db[_0x16dd('0x12e')][_0x16dd('0x143')](db[_0x16dd('0x144')],{'as':'Trunk'});db[_0x16dd('0x12e')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0x12e')]['belongsTo'](db[_0x16dd('0x83')],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0x12e')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':'Agents','through':_0x16dd('0x130')});db[_0x16dd('0x4c')][_0x16dd('0x143')](db['User'],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x4c')]['belongsTo'](db[_0x16dd('0x173')],{'onDelete':'restrict'});db[_0x16dd('0x4c')][_0x16dd('0x143')](db[_0x16dd('0x12e')],{'onDelete':'restrict'});db[_0x16dd('0x4c')]['belongsTo'](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db[_0x16dd('0x4e')][_0x16dd('0x105')](db[_0x16dd('0x50')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x174')});db[_0x16dd('0x4e')][_0x16dd('0x143')](db['FaxAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x171')});db[_0x16dd('0x4e')][_0x16dd('0x143')](db['CmContact'],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x4e')][_0x16dd('0x143')](db['User'],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x104')});db[_0x16dd('0x4e')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x175'),'as':_0x16dd('0x176')});db[_0x16dd('0x4e')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x175'),'as':_0x16dd('0x169')});db['FaxInteraction'][_0x16dd('0x118')](db['User'],{'as':'Users','through':_0x16dd('0x121'),'foreignKey':_0x16dd('0x174')});db[_0x16dd('0x50')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':'cascade','as':_0x16dd('0x11')});db[_0x16dd('0x50')]['belongsTo'](db[_0x16dd('0x4e')],{'as':_0x16dd('0x16d'),'foreignKey':_0x16dd('0x174')});db[_0x16dd('0x50')]['belongsTo'](db['CmContact'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166')});db[_0x16dd('0x50')]['belongsTo'](db[_0x16dd('0xde')],{'as':_0x16dd('0xde'),'foreignKey':_0x16dd('0x177')});db[_0x16dd('0x50')]['belongsTo'](db[_0x16dd('0x12e')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x171')});db[_0x16dd('0x173')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':'UserFaxQueue'});db[_0x16dd('0x173')][_0x16dd('0x118')](db['Team'],{'through':'team_has_fax_queues','as':_0x16dd('0x14c')});db[_0x16dd('0x52')]['belongsTo'](db[_0x16dd('0x12e')],{});db[_0x16dd('0x52')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0x52')]['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0x52')]['belongsTo'](db[_0x16dd('0x4e')],{});db['FaxQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x50')],{});db[_0x16dd('0x52')][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db[_0x16dd('0x52')][_0x16dd('0x143')](db[_0x16dd('0x173')],{});db['SmsAccount'][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x178')});db[_0x16dd('0x54')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x178')});db[_0x16dd('0x54')][_0x16dd('0x105')](db['SmsMessage'],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x178')});db[_0x16dd('0x54')][_0x16dd('0x105')](db[_0x16dd('0x57')],{'as':'Interactions'});db[_0x16dd('0x54')][_0x16dd('0x105')](db[_0x16dd('0x55')],{'as':'Applications'});db[_0x16dd('0x54')]['belongsTo'](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db['SmsAccount'][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0x54')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':'user_has_sms_accounts'});db[_0x16dd('0x55')]['belongsTo'](db['User'],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x55')]['belongsTo'](db[_0x16dd('0x5a')],{'onDelete':'restrict'});db['SmsApplication'][_0x16dd('0x143')](db[_0x16dd('0x54')],{'onDelete':'restrict'});db[_0x16dd('0x55')][_0x16dd('0x143')](db[_0x16dd('0x147')],{'onDelete':_0x16dd('0x16e'),'foreignKey':'IntervalId'});db[_0x16dd('0x55')]['belongsTo'](db['Tag'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db['SmsInteraction']['hasMany'](db['SmsMessage'],{'as':'Messages','onDelete':_0x16dd('0x103'),'foreignKey':'SmsInteractionId'});db[_0x16dd('0x57')][_0x16dd('0x143')](db['SmsAccount'],{'as':_0x16dd('0x165'),'foreignKey':'SmsAccountId'});db[_0x16dd('0x57')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x57')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':'Owner','foreignKey':_0x16dd('0x104')});db[_0x16dd('0x57')][_0x16dd('0x118')](db['Tag'],{'through':_0x16dd('0x179'),'as':_0x16dd('0x176')});db[_0x16dd('0x57')]['belongsToMany'](db[_0x16dd('0x8a')],{'through':'sms_interaction_has_tags','as':_0x16dd('0x169')});db[_0x16dd('0x57')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x17a'),'foreignKey':_0x16dd('0x17b')});db[_0x16dd('0x17c')][_0x16dd('0x143')](db['User'],{'as':_0x16dd('0x11')});db[_0x16dd('0x17c')]['belongsTo'](db[_0x16dd('0x72')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166')});db[_0x16dd('0x17c')][_0x16dd('0x143')](db[_0x16dd('0x57')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x16d'),'foreignKey':_0x16dd('0x17b')});db[_0x16dd('0x17c')][_0x16dd('0x143')](db[_0x16dd('0x54')],{'as':'Account','foreignKey':_0x16dd('0x178')});db[_0x16dd('0x5a')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x36'),'foreignKey':'SmsQueueId'});db[_0x16dd('0x5a')]['belongsToMany'](db[_0x16dd('0x11e')],{'through':_0x16dd('0x17d'),'as':_0x16dd('0x14c')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db['Disposition'],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x17e')});db['OpenchannelAccount'][_0x16dd('0x105')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db[_0x16dd('0x60')],{'as':_0x16dd('0x15c'),'foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5c')][_0x16dd('0x105')](db['OpenchannelApplication'],{'as':_0x16dd('0x13c'),'foreignKey':_0x16dd('0x17e')});db['OpenchannelAccount'][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0x5c')][_0x16dd('0x143')](db['Pause'],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0x5c')]['belongsToMany'](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':'user_has_openchannel_accounts'});db[_0x16dd('0x5e')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x5e')][_0x16dd('0x143')](db['OpenchannelQueue'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x17f')});db[_0x16dd('0x5e')][_0x16dd('0x143')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x16dd('0x17e')});db[_0x16dd('0x5e')]['belongsTo'](db[_0x16dd('0x147')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x16f')});db['OpenchannelApplication'][_0x16dd('0x143')](db['Tag'],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db['OpenchannelInteraction'][_0x16dd('0x105')](db[_0x16dd('0x180')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':'OpenchannelInteractionId'});db[_0x16dd('0x60')][_0x16dd('0x143')](db['OpenchannelAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x17e')});db['OpenchannelInteraction'][_0x16dd('0x143')](db['CmContact'],{'as':'Contact','foreignKey':_0x16dd('0x154')});db[_0x16dd('0x60')]['belongsTo'](db[_0x16dd('0x11')],{'as':'Owner','foreignKey':_0x16dd('0x104')});db[_0x16dd('0x60')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x181'),'as':_0x16dd('0x176')});db[_0x16dd('0x60')][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':'openchannel_interaction_has_tags','as':_0x16dd('0x169')});db[_0x16dd('0x60')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x182'),'foreignKey':_0x16dd('0x183')});db[_0x16dd('0x180')][_0x16dd('0x143')](db['User'],{'onDelete':'cascade','as':_0x16dd('0x11')});db['OpenchannelMessage'][_0x16dd('0x143')](db[_0x16dd('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0x16dd('0x180')][_0x16dd('0x143')](db[_0x16dd('0x60')],{'onDelete':'cascade','as':_0x16dd('0x16d'),'foreignKey':'OpenchannelInteractionId'});db[_0x16dd('0x180')][_0x16dd('0x143')](db[_0x16dd('0xde')],{'as':'Attachment','foreignKey':_0x16dd('0x177')});db['OpenchannelMessage'][_0x16dd('0x143')](db[_0x16dd('0x5c')],{'as':_0x16dd('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0x16dd('0x62')]['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x16dd('0x62')][_0x16dd('0x118')](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x16dd('0x12b')][_0x16dd('0x105')](db['Disposition'],{'as':_0x16dd('0x159'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x16dd('0x12b')][_0x16dd('0x105')](db[_0x16dd('0x6e')],{'as':_0x16dd('0x184')});db[_0x16dd('0x12b')][_0x16dd('0x105')](db[_0x16dd('0x110')],{'as':_0x16dd('0x15c')});db[_0x16dd('0x12b')][_0x16dd('0x105')](db[_0x16dd('0x66')],{'as':'Applications'});db['ChatWebsite'][_0x16dd('0x105')](db[_0x16dd('0x185')],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db[_0x16dd('0xe9')],{'as':'List','foreignKey':_0x16dd('0x15e')});db['ChatWebsite'][_0x16dd('0x143')](db[_0x16dd('0x147')],{'as':_0x16dd('0x147'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x12b')][_0x16dd('0x143')](db[_0x16dd('0x83')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':'user_has_chat_websites'});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0x5c')],{});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db['OpenchannelQueueReport']['belongsTo'](db[_0x16dd('0x60')],{});db[_0x16dd('0x65')][_0x16dd('0x143')](db[_0x16dd('0x180')],{});db[_0x16dd('0x65')]['belongsTo'](db[_0x16dd('0x11')],{});db['OpenchannelQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x62')],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0x16dd('0x186'),'foreignKey':_0x16dd('0x104'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x66')][_0x16dd('0x143')](db[_0x16dd('0x6c')],{'as':_0x16dd('0x187'),'foreignKey':_0x16dd('0x188'),'onDelete':_0x16dd('0x16e')});db['ChatApplication']['belongsTo'](db[_0x16dd('0x12b')],{'as':_0x16dd('0x189'),'foreignKey':_0x16dd('0x18a'),'onDelete':_0x16dd('0x16e')});db['ChatApplication'][_0x16dd('0x143')](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db[_0x16dd('0x110')][_0x16dd('0x105')](db[_0x16dd('0x185')],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x18b')});db[_0x16dd('0x110')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x16dd('0x18a')});db[_0x16dd('0x110')][_0x16dd('0x143')](db['CmContact'],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db['ChatInteraction'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x104')});db['ChatInteraction'][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':'chat_interaction_has_tags','as':_0x16dd('0x176')});db[_0x16dd('0x110')][_0x16dd('0x118')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x16dd('0x169')});db[_0x16dd('0x110')][_0x16dd('0x118')](db['User'],{'as':'Users','through':_0x16dd('0x120'),'foreignKey':'ChatInteractionId'});db[_0x16dd('0x185')][_0x16dd('0x143')](db['User'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x11')});db[_0x16dd('0x185')]['belongsTo'](db[_0x16dd('0x72')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db['ChatMessage'][_0x16dd('0x143')](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x16dd('0x18b')});db[_0x16dd('0x185')][_0x16dd('0x143')](db[_0x16dd('0xde')],{'as':_0x16dd('0xde'),'foreignKey':_0x16dd('0x177')});db['ChatMessage'][_0x16dd('0x143')](db[_0x16dd('0x12b')],{'as':_0x16dd('0x165'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x16dd('0x143')](db['CmContact'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0x6a')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x16dd('0x18a')});db[_0x16dd('0x6c')]['belongsToMany'](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x31'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x16dd('0x11e')],{'through':_0x16dd('0x18c'),'as':_0x16dd('0x14c')});db[_0x16dd('0x119')]['hasMany'](db[_0x16dd('0xc9')],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x18d'),'onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db[_0x16dd('0x11')],{'as':_0x16dd('0x18e'),'through':_0x16dd('0x11b')});db[_0x16dd('0x6e')]['belongsTo'](db[_0x16dd('0x12b')],{'as':_0x16dd('0x189'),'foreignKey':_0x16dd('0x18a')});db[_0x16dd('0x70')][_0x16dd('0x105')](db[_0x16dd('0x72')],{'as':'Contacts','foreignKey':_0x16dd('0x18f')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x13e')],{'as':_0x16dd('0x190'),'foreignKey':'ContactId'});db[_0x16dd('0x72')]['hasMany'](db[_0x16dd('0x76')],{'as':'HopperFinals','foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x10c')],{'as':_0x16dd('0x140'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':_0x16dd('0x10e'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0xcd')],{'as':_0x16dd('0x142'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x60')],{'as':_0x16dd('0x10f'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db['CmContact'][_0x16dd('0x105')](db[_0x16dd('0x110')],{'as':_0x16dd('0x111'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x57')],{'as':'SmsInteractions','foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')][_0x16dd('0x105')](db[_0x16dd('0x4e')],{'as':_0x16dd('0x113'),'foreignKey':'ContactId','onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')]['hasMany'](db[_0x16dd('0x41')],{'as':_0x16dd('0x114'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x72')][_0x16dd('0x143')](db[_0x16dd('0x70')],{'as':'Company','foreignKey':_0x16dd('0x18f')});db[_0x16dd('0x72')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x72')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x11d')});db[_0x16dd('0x72')][_0x16dd('0x118')](db['Tag'],{'as':_0x16dd('0x176'),'through':'cm_contact_has_tags'});db[_0x16dd('0x72')][_0x16dd('0x118')](db['Tag'],{'through':_0x16dd('0x191'),'as':'ThroughTags'});db['CmHopper'][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db['User'],{'as':'Agent','foreignKey':_0x16dd('0x104')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db[_0x16dd('0x1b')],{'as':_0x16dd('0x187'),'foreignKey':_0x16dd('0x13f'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db[_0x16dd('0xdb')],{'as':'Campaign','foreignKey':_0x16dd('0x192'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0x13e')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x167'),'foreignKey':_0x16dd('0x193')});db[_0x16dd('0x74')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154'),'onDelete':'cascade'});db[_0x16dd('0x74')][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e'),'onDelete':'cascade'});db['CmHopperBlack'][_0x16dd('0x143')](db[_0x16dd('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x16dd('0x103')});db[_0x16dd('0x74')][_0x16dd('0x143')](db[_0x16dd('0xdb')],{'as':_0x16dd('0xdb'),'foreignKey':_0x16dd('0x192'),'onDelete':_0x16dd('0x103')});db['Automation'][_0x16dd('0x105')](db[_0x16dd('0x80')],{'as':{'plural':_0x16dd('0x194'),'singular':_0x16dd('0x195')},'foreignKey':'AutomationAllId','onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x7b')][_0x16dd('0x105')](db['Condition'],{'as':{'plural':_0x16dd('0x196'),'singular':_0x16dd('0x197')},'foreignKey':'AutomationAnyId','onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x7b')]['hasMany'](db[_0x16dd('0x7a')],{'as':_0x16dd('0x198'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x16dd('0x147')]['hasMany'](db[_0x16dd('0x147')],{'as':'Intervals','foreignKey':_0x16dd('0x16f'),'onDelete':_0x16dd('0x103'),'hooks':!![],'required':![]});db[_0x16dd('0x147')][_0x16dd('0x105')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x16dd('0x16f'),'onDelete':_0x16dd('0x16e')});db[_0x16dd('0x147')]['hasMany'](db[_0x16dd('0x45')],{'as':_0x16dd('0x199'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x147')]['hasMany'](db[_0x16dd('0x66')],{'as':_0x16dd('0x19a'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x147')][_0x16dd('0x105')](db[_0x16dd('0x4c')],{'as':_0x16dd('0x19b'),'foreignKey':_0x16dd('0x16f')});db[_0x16dd('0x147')][_0x16dd('0x105')](db['SmsApplication'],{'as':_0x16dd('0x19c'),'foreignKey':'IntervalId'});db[_0x16dd('0x86')]['belongsTo'](db[_0x16dd('0x3f')],{});db[_0x16dd('0x86')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0x16dd('0x19d')});db[_0x16dd('0x86')][_0x16dd('0x143')](db[_0x16dd('0x19e')],{'foreignKey':'CustomReportId'});db[_0x16dd('0x88')]['belongsToMany'](db[_0x16dd('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x16dd('0x16e')});db['Tag'][_0x16dd('0x118')](db[_0x16dd('0x72')],{'through':_0x16dd('0x191')});db[_0x16dd('0x8a')][_0x16dd('0x118')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x16dd('0x8a')][_0x16dd('0x118')](db[_0x16dd('0x41')],{'through':'mail_interaction_has_tags'});db[_0x16dd('0x8a')][_0x16dd('0x118')](db['SmsInteraction'],{'through':_0x16dd('0x179')});db[_0x16dd('0x8a')][_0x16dd('0x118')](db['FaxInteraction'],{'through':_0x16dd('0x175')});db[_0x16dd('0x8a')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x16dd('0x181')});db['Tag'][_0x16dd('0x118')](db[_0x16dd('0xf8')],{'through':_0x16dd('0x19f')});db[_0x16dd('0x8e')][_0x16dd('0x105')](db[_0x16dd('0x80')],{'as':{'plural':_0x16dd('0x1a0'),'singular':_0x16dd('0x1a1')},'foreignKey':_0x16dd('0x1a2'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db['Trigger'][_0x16dd('0x105')](db[_0x16dd('0x80')],{'as':{'plural':'AnyConditions','singular':_0x16dd('0x1a3')},'foreignKey':_0x16dd('0x1a4'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db['Trigger'][_0x16dd('0x105')](db[_0x16dd('0x7a')],{'as':_0x16dd('0x198'),'foreignKey':_0x16dd('0x1a5'),'onDelete':_0x16dd('0x103'),'hooks':!![]});db[_0x16dd('0x19e')][_0x16dd('0x105')](db[_0x16dd('0x99')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1a7'),'hooks':!![]});db[_0x16dd('0x96')][_0x16dd('0x105')](db[_0x16dd('0x99')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x16dd('0x105')](db[_0x16dd('0x99')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':'MetricId'});db[_0x16dd('0x99')][_0x16dd('0x143')](db[_0x16dd('0x1a8')],{'foreignKey':_0x16dd('0x1a9')});db[_0x16dd('0x1aa')][_0x16dd('0x105')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x9e')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db['SalesforceConfiguration'][_0x16dd('0x105')](db['SalesforceField'],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':'DescriptionId'});db[_0x16dd('0x9e')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':'Fields','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x9e')][_0x16dd('0x143')](db[_0x16dd('0x1aa')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1ac')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0x1ac')]['hasMany'](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1ac')][_0x16dd('0x105')](db[_0x16dd('0x1ac')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1ac')][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0x1b7')]['hasMany'](db[_0x16dd('0x1b8')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1b8')]['hasMany'](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x16dd('0x105')](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1b8')][_0x16dd('0x105')](db[_0x16dd('0x1ba')],{'as':'Fields','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1b8')][_0x16dd('0x143')](db[_0x16dd('0x1b7')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db['SugarcrmField']['hasMany'](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db['SugarcrmField']['hasMany'](db[_0x16dd('0x1ba')],{'as':'Description','foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1ba')][_0x16dd('0x105')](db[_0x16dd('0x1ba')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db['SugarcrmField'][_0x16dd('0x143')](db['Variable'],{'as':'Variable','foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0xa3')]['hasMany'](db[_0x16dd('0xa5')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xa5')][_0x16dd('0x105')](db[_0x16dd('0xa7')],{'as':'Subjects','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xa5')]['hasMany'](db[_0x16dd('0xa7')],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xa5')][_0x16dd('0x105')](db['DeskField'],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':'FieldId'});db[_0x16dd('0xa5')]['belongsTo'](db[_0x16dd('0xa3')],{'as':'Account','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xa5')][_0x16dd('0x118')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x16dd('0xa7')]['hasMany'](db['DeskField'],{'as':'Subject','foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xa7')]['hasMany'](db[_0x16dd('0xa7')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xa7')][_0x16dd('0x105')](db[_0x16dd('0xa7')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xa7')][_0x16dd('0x143')](db['Variable'],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0xa8')][_0x16dd('0x105')](db[_0x16dd('0x1bb')],{'as':_0x16dd('0x1b9'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db['ZohoConfiguration'][_0x16dd('0x105')](db['ZohoField'],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db['ZohoConfiguration'][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':'Descriptions','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1bb')][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':'Fields','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1bb')][_0x16dd('0x143')](db['ZohoAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xaa')][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':'Subject','foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xaa')][_0x16dd('0x105')](db[_0x16dd('0xaa')],{'as':_0x16dd('0x1b2'),'foreignKey':'DescriptionId'});db[_0x16dd('0xaa')]['hasMany'](db[_0x16dd('0xaa')],{'as':_0x16dd('0x1b4'),'foreignKey':'FieldId'});db[_0x16dd('0xaa')][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xac')][_0x16dd('0x105')](db[_0x16dd('0xae')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xae')]['hasMany'](db[_0x16dd('0xaf')],{'as':_0x16dd('0x1ad'),'foreignKey':'SubjectId'});db[_0x16dd('0xae')][_0x16dd('0x105')](db[_0x16dd('0xaf')],{'as':'Descriptions','foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xae')][_0x16dd('0x105')](db[_0x16dd('0xaf')],{'as':_0x16dd('0x1a6'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0x16dd('0xac')],{'as':_0x16dd('0x165'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db[_0x16dd('0x8a')],{'through':_0x16dd('0x1bc')});db['ZendeskField'][_0x16dd('0x105')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x16dd('0x1ae')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0x16dd('0x1b3')});db['ZendeskField'][_0x16dd('0x105')](db[_0x16dd('0xaf')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db['ZendeskField']['belongsTo'](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xb1')][_0x16dd('0x105')](db[_0x16dd('0x1bd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1bd')]['hasMany'](db[_0x16dd('0xb4')],{'as':_0x16dd('0x1ad'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0x1bd')][_0x16dd('0x105')](db['FreshdeskField'],{'as':_0x16dd('0x1af'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0x1bd')][_0x16dd('0x105')](db[_0x16dd('0xb4')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db['FreshdeskConfiguration'][_0x16dd('0x143')](db[_0x16dd('0xb1')],{'as':_0x16dd('0x165'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x16dd('0x118')](db[_0x16dd('0x8a')],{'through':_0x16dd('0x1be')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db['FreshdeskField']['hasMany'](db[_0x16dd('0xb4')],{'as':_0x16dd('0x1b2'),'foreignKey':'DescriptionId'});db[_0x16dd('0xb4')]['hasMany'](db['FreshdeskField'],{'as':'Field','foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xb4')]['belongsTo'](db[_0x16dd('0x1b5')],{'as':'Variable','foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0x1bf')]['hasMany'](db[_0x16dd('0xb6')],{'as':_0x16dd('0x1b9'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xb6')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1ad'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xb6')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1af'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xb6')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1a6'),'foreignKey':'FieldId'});db[_0x16dd('0xb6')][_0x16dd('0x143')](db[_0x16dd('0x1bf')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xb7')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xb7')][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':'Description','foreignKey':_0x16dd('0x1b3')});db['VtigerField'][_0x16dd('0x105')](db[_0x16dd('0xb7')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xb7')][_0x16dd('0x143')](db['Variable'],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db['ServicenowAccount'][_0x16dd('0x105')](db['ServicenowConfiguration'],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x16dd('0xb9')]['hasMany'](db[_0x16dd('0xba')],{'as':_0x16dd('0x1ad'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xb9')][_0x16dd('0x105')](db[_0x16dd('0xba')],{'as':_0x16dd('0x1af'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xb9')][_0x16dd('0x105')](db[_0x16dd('0xba')],{'as':_0x16dd('0x1a6'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xb9')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xba')]['hasMany'](db[_0x16dd('0xba')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xba')][_0x16dd('0x105')](db[_0x16dd('0xba')],{'as':_0x16dd('0x1b2'),'foreignKey':'DescriptionId'});db[_0x16dd('0xba')][_0x16dd('0x105')](db['ServicenowField'],{'as':'Field','foreignKey':_0x16dd('0x1b0')});db['ServicenowField'][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':_0x16dd('0x1b6')});db[_0x16dd('0xbc')]['hasMany'](db[_0x16dd('0x1c0')],{'as':_0x16dd('0x1b9'),'onDelete':'cascade','foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0x1c0')][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1ad'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ae')});db['Dynamics365Configuration'][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':'Descriptions','onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b3')});db['Dynamics365Configuration'][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1a6'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0x1c0')]['belongsTo'](db[_0x16dd('0xbc')],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db['Dynamics365Field'][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xbf')][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db[_0x16dd('0xbf')][_0x16dd('0x105')](db[_0x16dd('0xbf')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xbf')][_0x16dd('0x143')](db['Variable'],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xc0')]['hasMany'](db[_0x16dd('0xc2')],{'as':_0x16dd('0x1b9'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1ab')});db['FreshsalesConfiguration'][_0x16dd('0x105')](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1ad'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xc2')][_0x16dd('0x105')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x16dd('0x105')](db[_0x16dd('0xc4')],{'as':'Fields','foreignKey':_0x16dd('0x1b0')});db['FreshsalesConfiguration'][_0x16dd('0x143')](db['FreshsalesAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1ab')});db[_0x16dd('0xc4')]['hasMany'](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1b1'),'foreignKey':_0x16dd('0x1ae')});db[_0x16dd('0xc4')][_0x16dd('0x105')](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1b2'),'foreignKey':_0x16dd('0x1b3')});db['FreshsalesField']['hasMany'](db[_0x16dd('0xc4')],{'as':_0x16dd('0x1b4'),'foreignKey':_0x16dd('0x1b0')});db[_0x16dd('0xc4')][_0x16dd('0x143')](db[_0x16dd('0x1b5')],{'as':_0x16dd('0x1b5'),'foreignKey':'VariableId'});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0x12b')],{});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':'List','foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0xc7')]['belongsTo'](db['ChatInteraction'],{});db[_0x16dd('0xc7')]['belongsTo'](db[_0x16dd('0x185')],{});db['ChatQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db[_0x16dd('0xc7')][_0x16dd('0x143')](db[_0x16dd('0x6c')],{});db[_0x16dd('0xc9')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1c1')});db['ChatInternalMessage'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x1c2')});db[_0x16dd('0xcd')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x16dd('0x103')});db['JscriptySessionReport'][_0x16dd('0x105')](db[_0x16dd('0x1c3')],{'foreignKey':_0x16dd('0x1c4'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0xce')]['belongsTo'](db['SmsAccount'],{});db[_0x16dd('0xce')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xce')]['belongsTo'](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db[_0x16dd('0xce')][_0x16dd('0x143')](db['SmsInteraction'],{});db[_0x16dd('0xce')][_0x16dd('0x143')](db[_0x16dd('0x17c')],{});db['SmsQueueReport']['belongsTo'](db[_0x16dd('0x11')],{});db[_0x16dd('0xce')][_0x16dd('0x143')](db[_0x16dd('0x5a')],{});db[_0x16dd('0xd2')]['hasMany'](db[_0x16dd('0xcd')],{'foreignKey':_0x16dd('0x1c5')});db[_0x16dd('0xd2')]['hasMany'](db[_0x16dd('0xcb')],{'foreignKey':_0x16dd('0x1c5')});db['JscriptyProject'][_0x16dd('0x105')](db[_0x16dd('0x1c3')],{'foreignKey':_0x16dd('0x1c5')});db[_0x16dd('0x138')]['belongsToMany'](db['User'],{'as':_0x16dd('0x16a'),'through':_0x16dd('0x13a')});db[_0x16dd('0x11e')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x11f')});db['Team'][_0x16dd('0x118')](db[_0x16dd('0x1b')],{'through':_0x16dd('0x14d'),'as':'VoiceQueues'});db[_0x16dd('0x11e')]['belongsToMany'](db['MailQueue'],{'through':_0x16dd('0x163'),'as':_0x16dd('0x124')});db['Team'][_0x16dd('0x118')](db[_0x16dd('0x6c')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x16dd('0x11e')][_0x16dd('0x118')](db[_0x16dd('0x173')],{'through':_0x16dd('0x1c6'),'as':'FaxQueues'});db[_0x16dd('0x11e')][_0x16dd('0x118')](db[_0x16dd('0x5a')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x16dd('0x62')],{'through':_0x16dd('0x1c7'),'as':_0x16dd('0x126')});db['Team'][_0x16dd('0x118')](db[_0x16dd('0x100')],{'through':'team_has_whatsapp_queues','as':_0x16dd('0x127')});db[_0x16dd('0xdb')][_0x16dd('0x105')](db['CmHopper'],{'as':_0x16dd('0x190'),'foreignKey':'CampaignId'});db['Campaign'][_0x16dd('0x105')](db[_0x16dd('0x76')],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x192')});db[_0x16dd('0xdb')]['hasMany'](db[_0x16dd('0x10c')],{'as':_0x16dd('0x140'),'foreignKey':_0x16dd('0x192')});db[_0x16dd('0xdb')][_0x16dd('0x105')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x16dd('0x192')});db[_0x16dd('0xdb')]['belongsTo'](db['Trunk'],{'as':_0x16dd('0x144'),'foreignKey':_0x16dd('0x145')});db['Campaign']['belongsTo'](db[_0x16dd('0x144')],{'as':_0x16dd('0x146'),'foreignKey':_0x16dd('0x1c8')});db['Campaign']['belongsTo'](db[_0x16dd('0x147')],{'as':'Interval','foreignKey':_0x16dd('0x16f')});db[_0x16dd('0xdb')][_0x16dd('0x143')](db[_0x16dd('0x138')],{'as':_0x16dd('0x138'),'foreignKey':_0x16dd('0x1c9')});db[_0x16dd('0xdb')][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':'Lists','through':_0x16dd('0x1ca')});db['Campaign'][_0x16dd('0x118')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x1cb'),'through':_0x16dd('0x1cc')});db[_0x16dd('0xe1')][_0x16dd('0x143')](db[_0x16dd('0x43')],{});db[_0x16dd('0xe1')]['belongsTo'](db['MailInteraction'],{});db[_0x16dd('0xe1')][_0x16dd('0x143')](db['MailAccount'],{'foreignKey':_0x16dd('0x1cd'),'as':_0x16dd('0x1ce')});db['MailTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db[_0x16dd('0xe1')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x16dd('0xe1')][_0x16dd('0x143')](db[_0x16dd('0x162')],{'foreignKey':_0x16dd('0x1d1'),'as':_0x16dd('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x16dd('0x3f')],{'foreignKey':_0x16dd('0x1d3'),'as':_0x16dd('0x1d4')});db[_0x16dd('0xe3')]['belongsTo'](db[_0x16dd('0x185')],{});db[_0x16dd('0xe3')]['belongsTo'](db['ChatInteraction'],{});db[_0x16dd('0xe3')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x16dd('0x1ce')});db[_0x16dd('0xe3')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db[_0x16dd('0xe3')][_0x16dd('0x143')](db['User'],{'foreignKey':'ToUserId','as':_0x16dd('0x1d5')});db['ChatTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x6c')],{'foreignKey':_0x16dd('0x1d6'),'as':_0x16dd('0x1d2')});db[_0x16dd('0xe3')]['belongsTo'](db[_0x16dd('0x12b')],{'foreignKey':'ToChatWebsiteId','as':_0x16dd('0x1d4')});db['FaxTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x50')],{});db['FaxTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x4e')],{});db[_0x16dd('0x1d7')][_0x16dd('0x143')](db[_0x16dd('0x12e')],{'foreignKey':_0x16dd('0x1d8'),'as':_0x16dd('0x1ce')});db[_0x16dd('0x1d7')][_0x16dd('0x143')](db['User'],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db['FaxTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':'ToUserId','as':_0x16dd('0x1d5')});db[_0x16dd('0x1d7')]['belongsTo'](db[_0x16dd('0x173')],{'foreignKey':'ToFaxQueueId','as':_0x16dd('0x1d2')});db[_0x16dd('0x1d7')][_0x16dd('0x143')](db[_0x16dd('0x12e')],{'foreignKey':_0x16dd('0x1d9'),'as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x16dd('0x180')],{});db[_0x16dd('0xe5')][_0x16dd('0x143')](db[_0x16dd('0x60')],{});db[_0x16dd('0xe5')][_0x16dd('0x143')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x16dd('0x1ce')});db[_0x16dd('0xe5')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':'FromUserId','as':_0x16dd('0x1d0')});db[_0x16dd('0xe5')]['belongsTo'](db[_0x16dd('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x62')],{'foreignKey':_0x16dd('0x1da'),'as':'ToQueue'});db[_0x16dd('0xe5')][_0x16dd('0x143')](db[_0x16dd('0x5c')],{'foreignKey':_0x16dd('0x1db'),'as':_0x16dd('0x1d4')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db[_0x16dd('0x17c')],{});db[_0x16dd('0xe7')]['belongsTo'](db[_0x16dd('0x57')],{});db[_0x16dd('0xe7')][_0x16dd('0x143')](db[_0x16dd('0x54')],{'foreignKey':_0x16dd('0x1dc'),'as':'FromAccount'});db['SmsTransferReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db['User'],{'foreignKey':_0x16dd('0x1dd'),'as':_0x16dd('0x1d5')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db['SmsQueue'],{'foreignKey':_0x16dd('0x1de'),'as':_0x16dd('0x1d2')});db[_0x16dd('0xe7')][_0x16dd('0x143')](db['SmsAccount'],{'foreignKey':_0x16dd('0x1df'),'as':_0x16dd('0x1d4')});db['CmList'][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x79')],{'as':_0x16dd('0x1e0'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x72')],{'as':_0x16dd('0x11c'),'onDelete':_0x16dd('0x103'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db['CmHopperFinal'],{'as':_0x16dd('0x10b'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x10c')],{'as':_0x16dd('0x10d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x105')](db[_0x16dd('0x10e')],{'as':'ReportAgentPreview','foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xe9')][_0x16dd('0x118')](db[_0x16dd('0x1b')],{'as':'Queues','through':_0x16dd('0x14a')});db[_0x16dd('0xe9')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x128')});db['VoicePrefix'][_0x16dd('0x105')](db[_0x16dd('0x109')],{'as':_0x16dd('0x10a'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0xeb')][_0x16dd('0x118')](db['User'],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x12a')});db[_0x16dd('0xed')][_0x16dd('0x105')](db[_0x16dd('0x11')],{'as':'Users','foreignKey':'userProfileId'});db[_0x16dd('0xed')]['hasMany'](db[_0x16dd('0xef')],{'as':'UserProfileSections','foreignKey':_0x16dd('0x117'),'onDelete':_0x16dd('0x103')});db[_0x16dd('0xef')][_0x16dd('0x105')](db[_0x16dd('0xf1')],{'as':_0x16dd('0x1e1'),'foreignKey':_0x16dd('0x1e2'),'onDelete':'cascade'});db[_0x16dd('0xf4')][_0x16dd('0x105')](db[_0x16dd('0x158')],{'as':_0x16dd('0x159'),'foreignKey':_0x16dd('0x1e3')});db[_0x16dd('0xf4')][_0x16dd('0x105')](db[_0x16dd('0x7d')],{'as':_0x16dd('0x15a'),'foreignKey':_0x16dd('0x1e3')});db['WhatsappAccount']['hasMany'](db[_0x16dd('0xfa')],{'as':_0x16dd('0x15b'),'foreignKey':_0x16dd('0x1e3')});db[_0x16dd('0xf4')][_0x16dd('0x105')](db['WhatsappInteraction'],{'as':_0x16dd('0x15c')});db[_0x16dd('0xf4')]['hasMany'](db[_0x16dd('0xf6')],{'as':_0x16dd('0x13c')});db['WhatsappAccount'][_0x16dd('0x143')](db['CmList'],{'as':_0x16dd('0x15d'),'foreignKey':'ListId'});db[_0x16dd('0xf4')][_0x16dd('0x143')](db['Pause'],{'as':_0x16dd('0x148'),'foreignKey':_0x16dd('0x160')});db[_0x16dd('0xf4')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x16dd('0xf6')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'onDelete':_0x16dd('0x16e')});db[_0x16dd('0xf6')][_0x16dd('0x143')](db[_0x16dd('0x100')],{'onDelete':'restrict'});db[_0x16dd('0xf6')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'onDelete':_0x16dd('0x16e')});db['WhatsappApplication']['belongsTo'](db[_0x16dd('0x147')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x16f')});db['WhatsappApplication'][_0x16dd('0x143')](db[_0x16dd('0x8a')],{'onDelete':_0x16dd('0x16e'),'foreignKey':_0x16dd('0x170')});db[_0x16dd('0xf8')][_0x16dd('0x105')](db['WhatsappMessage'],{'as':_0x16dd('0x15b'),'onDelete':_0x16dd('0x103'),'foreignKey':'WhatsappInteractionId'});db[_0x16dd('0xf8')]['belongsTo'](db['WhatsappAccount'],{'as':_0x16dd('0x165'),'foreignKey':_0x16dd('0x1e3')});db[_0x16dd('0xf8')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':'Owner','foreignKey':_0x16dd('0x104')});db[_0x16dd('0xf8')][_0x16dd('0x118')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x16dd('0xf8')]['belongsToMany'](db[_0x16dd('0x8a')],{'through':_0x16dd('0x19f'),'as':_0x16dd('0x169')});db['WhatsappInteraction']['belongsToMany'](db[_0x16dd('0x11')],{'as':'Users','through':_0x16dd('0x123'),'foreignKey':_0x16dd('0x1e4')});db[_0x16dd('0xfa')][_0x16dd('0x143')](db[_0x16dd('0x11')],{'as':_0x16dd('0x11')});db[_0x16dd('0xfa')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x166')});db[_0x16dd('0xfa')][_0x16dd('0x143')](db['WhatsappInteraction'],{'onDelete':_0x16dd('0x103'),'as':_0x16dd('0x16d'),'foreignKey':'WhatsappInteractionId'});db[_0x16dd('0xfa')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'as':'Account','foreignKey':_0x16dd('0x1e3')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappAccount'],{});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0xe9')],{'as':_0x16dd('0x15d'),'foreignKey':_0x16dd('0x15e')});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0x72')],{'as':_0x16dd('0x166'),'foreignKey':_0x16dd('0x154')});db[_0x16dd('0xfc')]['belongsTo'](db[_0x16dd('0xf8')],{});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0x100')],{});db[_0x16dd('0xfc')][_0x16dd('0x143')](db[_0x16dd('0xfa')],{});db['WhatsappQueueReport'][_0x16dd('0x143')](db[_0x16dd('0x11')],{});db[_0x16dd('0xfe')][_0x16dd('0x143')](db[_0x16dd('0xfa')],{});db['WhatsappTransferReport'][_0x16dd('0x143')](db[_0x16dd('0xf8')],{});db[_0x16dd('0xfe')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'foreignKey':_0x16dd('0x1e5'),'as':_0x16dd('0x1ce')});db[_0x16dd('0xfe')][_0x16dd('0x143')](db[_0x16dd('0xf4')],{'foreignKey':_0x16dd('0x1e6'),'as':'ToAccount'});db[_0x16dd('0xfe')]['belongsTo'](db[_0x16dd('0x100')],{'foreignKey':_0x16dd('0x1e7'),'as':_0x16dd('0x1d2')});db['WhatsappTransferReport']['belongsTo'](db[_0x16dd('0x11')],{'foreignKey':_0x16dd('0x1cf'),'as':_0x16dd('0x1d0')});db['WhatsappTransferReport'][_0x16dd('0x143')](db['User'],{'foreignKey':'ToUserId','as':_0x16dd('0x1d5')});db[_0x16dd('0x100')][_0x16dd('0x118')](db[_0x16dd('0x11')],{'as':_0x16dd('0x14b'),'through':_0x16dd('0x39'),'foreignKey':_0x16dd('0x1e8')});db[_0x16dd('0x100')][_0x16dd('0x118')](db[_0x16dd('0x11e')],{'through':_0x16dd('0x1e9'),'as':_0x16dd('0x14c')});module[_0x16dd('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3e84961..b97d688 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa101=['./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/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/license','/api/campaigns','/api/migrations','./api/migration','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','express-winston','util','./errors','./config/environment','api','auth','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','use','logger','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/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/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations'];(function(_0x54abd7,_0x1013da){var _0x57ac1c=function(_0x313b20){while(--_0x313b20){_0x54abd7['push'](_0x54abd7['shift']());}};_0x57ac1c(++_0x1013da);}(_0xa101,0x182));var _0x1a10=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0xa101[_0x2c7dc6];return _0x10002b;};'use strict';var path=require(_0x1a10('0x0'));var express=require(_0x1a10('0x1'));var ewinston=require(_0x1a10('0x2'));var util=require(_0x1a10('0x3'));var errors=require(_0x1a10('0x4'));var config=require(_0x1a10('0x5'));var logger=require('./config/logger')(_0x1a10('0x6'));var authLogger=require('./config/logger')(_0x1a10('0x7'));exports['default']=function(_0x56b87f){_0x56b87f['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5eee27,_0x289375){return util[_0x1a10('0x8')](_0x1a10('0x9'),_0x5eee27[_0x1a10('0xa')],_0x5eee27[_0x1a10('0xb')][_0x1a10('0xc')]?_0x5eee27[_0x1a10('0xb')][_0x1a10('0xc')]:_0x5eee27[_0x1a10('0xd')][_0x1a10('0xe')]||_0x5eee27['ip'],_0x5eee27['url'],_0x289375[_0x1a10('0xf')],_0x289375[_0x1a10('0x10')],_0x5eee27[_0x1a10('0x11')]?_0x5eee27[_0x1a10('0x11')]['id']:null,_0x5eee27[_0x1a10('0x11')]?_0x5eee27[_0x1a10('0x11')][_0x1a10('0x12')]:null,_0x5eee27[_0x1a10('0x11')]?_0x5eee27['user'][_0x1a10('0x13')]:null);}}));_0x56b87f[_0x1a10('0x14')](ewinston[_0x1a10('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4cf6bd,_0x73120c){var _0x206bc3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x17')]&&_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x18')]){_0x206bc3=_0x1a10('0x19');}return util[_0x1a10('0x8')](_0x206bc3,_0x4cf6bd[_0x1a10('0xa')],_0x4cf6bd[_0x1a10('0xb')][_0x1a10('0xc')]?_0x4cf6bd[_0x1a10('0xb')][_0x1a10('0xc')]:_0x4cf6bd[_0x1a10('0xd')][_0x1a10('0xe')]||_0x4cf6bd['ip'],_0x4cf6bd[_0x1a10('0x1a')],_0x73120c[_0x1a10('0xf')],_0x73120c['responseTime'],_0x4cf6bd[_0x1a10('0x11')]?_0x4cf6bd['user']['id']:null,_0x4cf6bd['user']?_0x4cf6bd[_0x1a10('0x11')][_0x1a10('0x12')]:null,_0x4cf6bd[_0x1a10('0x11')]?_0x4cf6bd[_0x1a10('0x11')][_0x1a10('0x13')]:null,_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd['body'][_0x1a10('0x17')]?_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x17')]:'other',_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd['body'][_0x1a10('0x18')]?_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x18')]:'',_0x4cf6bd[_0x1a10('0x16')]&&_0x4cf6bd[_0x1a10('0x16')][_0x1a10('0x1b')]?_0x4cf6bd['body'][_0x1a10('0x1b')]:'');},'ignoreRoute':function(_0xf8783f){var _0x10e121=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x10e121[_0x1a10('0x1c')](_0xf8783f['url']);}}));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x1d'),require(_0x1a10('0x1e')));_0x56b87f['use'](_0x1a10('0x1f'),require(_0x1a10('0x20')));_0x56b87f[_0x1a10('0x14')]('/api/voice/contexts',require(_0x1a10('0x21')));_0x56b87f['use'](_0x1a10('0x22'),require(_0x1a10('0x23')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x24'),require(_0x1a10('0x25')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x26'),require(_0x1a10('0x27')));_0x56b87f['use'](_0x1a10('0x28'),require(_0x1a10('0x29')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x2a'),require(_0x1a10('0x2b')));_0x56b87f['use']('/api/voice/mails',require('./api/voiceMail'));_0x56b87f[_0x1a10('0x14')]('/api/voice/mails/messages',require(_0x1a10('0x2c')));_0x56b87f['use'](_0x1a10('0x2d'),require('./api/voiceCallReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x2e'),require(_0x1a10('0x2f')));_0x56b87f[_0x1a10('0x14')]('/api/voice/agents/reports',require(_0x1a10('0x30')));_0x56b87f['use'](_0x1a10('0x31'),require('./api/voiceQueueReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x32'),require(_0x1a10('0x33')));_0x56b87f['use']('/api/trunks',require(_0x1a10('0x34')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x35'),require('./api/voiceTransferReport'));_0x56b87f[_0x1a10('0x14')]('/api/mail/out_servers',require(_0x1a10('0x36')));_0x56b87f['use'](_0x1a10('0x37'),require('./api/mailAccount'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x38'),require(_0x1a10('0x39')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x3a'),require('./api/mailSubstatus'));_0x56b87f['use'](_0x1a10('0x3b'),require('./api/mailInteraction'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x3c'),require(_0x1a10('0x3d')));_0x56b87f['use']('/api/mail/applications',require(_0x1a10('0x3e')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x3f'),require(_0x1a10('0x40')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x41'),require(_0x1a10('0x42')));_0x56b87f[_0x1a10('0x14')]('/api/dashboards/items',require('./api/dashboardItem'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x43'),require(_0x1a10('0x44')));_0x56b87f['use'](_0x1a10('0x45'),require('./api/faxApplication'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x46'),require(_0x1a10('0x47')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x48'),require(_0x1a10('0x49')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x4a'),require(_0x1a10('0x4b')));_0x56b87f[_0x1a10('0x14')]('/api/fax/reports/queue',require(_0x1a10('0x4c')));_0x56b87f[_0x1a10('0x14')]('/api/sms/accounts',require('./api/smsAccount'));_0x56b87f[_0x1a10('0x14')]('/api/sms/applications',require(_0x1a10('0x4d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x4e'),require(_0x1a10('0x4f')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x50'),require(_0x1a10('0x51')));_0x56b87f[_0x1a10('0x14')]('/api/sms/queues',require(_0x1a10('0x52')));_0x56b87f['use']('/api/openchannel/accounts',require(_0x1a10('0x53')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x54'),require(_0x1a10('0x55')));_0x56b87f[_0x1a10('0x14')]('/api/openchannel/interactions',require(_0x1a10('0x56')));_0x56b87f['use'](_0x1a10('0x57'),require(_0x1a10('0x58')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x59'),require(_0x1a10('0x5a')));_0x56b87f[_0x1a10('0x14')]('/api/chat/websites',require('./api/chatWebsite'));_0x56b87f[_0x1a10('0x14')]('/api/openchannel/reports/queue',require(_0x1a10('0x5b')));_0x56b87f['use'](_0x1a10('0x5c'),require(_0x1a10('0x5d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x5e'),require(_0x1a10('0x5f')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x60'),require(_0x1a10('0x61')));_0x56b87f[_0x1a10('0x14')]('/api/chat/offline_messages',require(_0x1a10('0x62')));_0x56b87f['use'](_0x1a10('0x63'),require(_0x1a10('0x64')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x65'),require(_0x1a10('0x66')));_0x56b87f[_0x1a10('0x14')]('/api/chat/proactive_actions',require(_0x1a10('0x67')));_0x56b87f['use'](_0x1a10('0x68'),require('./api/cmCompany'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x69'),require('./api/cmContact'));_0x56b87f['use'](_0x1a10('0x6a'),require(_0x1a10('0x6b')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x6c'),require(_0x1a10('0x6d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x6e'),require(_0x1a10('0x6f')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x70'),require(_0x1a10('0x71')));_0x56b87f[_0x1a10('0x14')]('/api/cm/custom_fields',require(_0x1a10('0x72')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x73'),require(_0x1a10('0x74')));_0x56b87f[_0x1a10('0x14')]('/api/automations',require('./api/automation'));_0x56b87f[_0x1a10('0x14')]('/api/canned_answers',require(_0x1a10('0x75')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x76'),require(_0x1a10('0x77')));_0x56b87f['use']('/api/conditions',require(_0x1a10('0x78')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x79'),require(_0x1a10('0x7a')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x7b'),require('./api/pause'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x7c'),require(_0x1a10('0x7d')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x7e'),require(_0x1a10('0x7f')));_0x56b87f['use']('/api/schedules',require('./api/schedule'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x80'),require('./api/sound'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x81'),require(_0x1a10('0x82')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x83'),require(_0x1a10('0x84')));_0x56b87f[_0x1a10('0x14')]('/api/triggers',require(_0x1a10('0x85')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x86'),require(_0x1a10('0x87')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x88'),require(_0x1a10('0x89')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8a'),require(_0x1a10('0x8b')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8c'),require('./api/analyticCustomReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8d'),require(_0x1a10('0x8e')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x8f'),require('./api/analyticExtractedReport'));_0x56b87f['use']('/api/analytics/metrics',require(_0x1a10('0x90')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x91'),require('./api/analyticFieldReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x92'),require(_0x1a10('0x93')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x94'),require(_0x1a10('0x95')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x96'),require(_0x1a10('0x97')));_0x56b87f['use'](_0x1a10('0x98'),require('./api/intSalesforceField'));_0x56b87f[_0x1a10('0x14')]('/api/integrations/sugarcrm/accounts',require(_0x1a10('0x99')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/sugarcrm/configurations',require(_0x1a10('0x9a')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/sugarcrm/fields',require(_0x1a10('0x9b')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x9c'),require(_0x1a10('0x9d')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/desk/configurations',require(_0x1a10('0x9e')));_0x56b87f['use'](_0x1a10('0x9f'),require(_0x1a10('0xa0')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xa1'),require(_0x1a10('0xa2')));_0x56b87f['use'](_0x1a10('0xa3'),require(_0x1a10('0xa4')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/zoho/fields',require(_0x1a10('0xa5')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xa6'),require(_0x1a10('0xa7')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xa8'),require('./api/intZendeskConfiguration'));_0x56b87f['use'](_0x1a10('0xa9'),require(_0x1a10('0xaa')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xab'),require(_0x1a10('0xac')));_0x56b87f['use'](_0x1a10('0xad'),require(_0x1a10('0xae')));_0x56b87f['use'](_0x1a10('0xaf'),require(_0x1a10('0xb0')));_0x56b87f['use'](_0x1a10('0xb1'),require(_0x1a10('0xb2')));_0x56b87f['use'](_0x1a10('0xb3'),require(_0x1a10('0xb4')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xb5'),require(_0x1a10('0xb6')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x56b87f['use']('/api/integrations/servicenow/configurations',require(_0x1a10('0xb7')));_0x56b87f[_0x1a10('0x14')]('/api/integrations/servicenow/fields',require(_0x1a10('0xb8')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xb9'),require(_0x1a10('0xba')));_0x56b87f['use'](_0x1a10('0xbb'),require(_0x1a10('0xbc')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xbd'),require(_0x1a10('0xbe')));_0x56b87f['use'](_0x1a10('0xbf'),require('./api/intFreshsalesAccount'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc0'),require(_0x1a10('0xc1')));_0x56b87f['use'](_0x1a10('0xc2'),require('./api/intFreshsalesField'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc3'),require(_0x1a10('0xc4')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc5'),require(_0x1a10('0xc6')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc7'),require(_0x1a10('0xc8')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xc9'),require(_0x1a10('0xca')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xcb'),require(_0x1a10('0xcc')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xcd'),require(_0x1a10('0xce')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xcf'),require(_0x1a10('0xd0')));_0x56b87f[_0x1a10('0x14')]('/api/square/reports',require(_0x1a10('0xd1')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd2'),require(_0x1a10('0xd3')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd4'),require(_0x1a10('0xd5')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd6'),require('./api/setting'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd7'),require(_0x1a10('0xd8')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xd9'),require(_0x1a10('0xda')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xdb'),require(_0x1a10('0xdc')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xdd'),require(_0x1a10('0xde')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xdf'),require(_0x1a10('0xe0')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe1'),require(_0x1a10('0xe2')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe3'),require('./api/campaign'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe4'),require(_0x1a10('0xe5')));_0x56b87f[_0x1a10('0x14')]('/api/attachments',require('./api/attachment'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xe6'),require(_0x1a10('0xe7')));_0x56b87f[_0x1a10('0x14')]('/api/mail/reports/transfer',require(_0x1a10('0xe8')));_0x56b87f['use'](_0x1a10('0xe9'),require(_0x1a10('0xea')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xeb'),require(_0x1a10('0xec')));_0x56b87f['use']('/api/openchannel/reports/transfer',require(_0x1a10('0xed')));_0x56b87f[_0x1a10('0x14')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x56b87f['use'](_0x1a10('0xee'),require(_0x1a10('0xef')));_0x56b87f[_0x1a10('0x14')]('/api/voice/prefixes',require(_0x1a10('0xf0')));_0x56b87f[_0x1a10('0x14')]('/api/userProfiles',require(_0x1a10('0xf1')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xf2'),require(_0x1a10('0xf3')));_0x56b87f['use'](_0x1a10('0xf4'),require(_0x1a10('0xf5')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xf6'),require(_0x1a10('0xf7')));_0x56b87f[_0x1a10('0x14')]('/api/whatsapp/accounts',require(_0x1a10('0xf8')));_0x56b87f['use'](_0x1a10('0xf9'),require('./api/whatsappApplication'));_0x56b87f['use']('/api/whatsapp/interactions',require(_0x1a10('0xfa')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xfb'),require(_0x1a10('0xfc')));_0x56b87f[_0x1a10('0x14')]('/api/whatsapp/reports/queue',require(_0x1a10('0xfd')));_0x56b87f[_0x1a10('0x14')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0xfe'),require(_0x1a10('0xff')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x100'),require('./api/cloudProvider'));_0x56b87f['use'](_0x1a10('0x101'),require(_0x1a10('0x102')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x103'),require(_0x1a10('0x104')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x105'),require(_0x1a10('0x106')));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x107'),require('./api/rpc'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x108'),require(_0x1a10('0x109')));_0x56b87f['use'](_0x1a10('0x10a'),require(_0x1a10('0x10b')));_0x56b87f[_0x1a10('0x14')]('/api/pm2',require('./api/pm2'));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x10c'),require(_0x1a10('0x10d')));_0x56b87f['use'](_0x1a10('0x10e'),express[_0x1a10('0x10f')](path['join'](config['root'],'/apidoc')));_0x56b87f[_0x1a10('0x14')]('/www',express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config[_0x1a10('0x111')],_0x1a10('0x112'))));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x113'),express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config[_0x1a10('0x111')],'/demo')));_0x56b87f['use'](_0x1a10('0x114'),express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config['root'],_0x1a10('0x115'),_0x1a10('0x116'))));_0x56b87f[_0x1a10('0x14')](_0x1a10('0x117'),express[_0x1a10('0x10f')](path[_0x1a10('0x110')](config[_0x1a10('0x111')],_0x1a10('0x118'))));_0x56b87f[_0x1a10('0x119')](_0x1a10('0x11a'))[_0x1a10('0x11b')](errors[0x194]);_0x56b87f[_0x1a10('0x119')]('/*')[_0x1a10('0x11b')](function(_0x2502e4,_0x5da05e){_0x5da05e[_0x1a10('0x11c')](path[_0x1a10('0x11d')](_0x56b87f[_0x1a10('0x11b')]('appPath')+_0x1a10('0x11e')));});}; \ No newline at end of file +var _0x3ad3=['/api/templates','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express-winston','./errors','./config/environment','./config/logger','auth','use','logger','format','method','x-forwarded-for','connection','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','remoteAddress','statusCode','device','agent_name','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x3ad3,0x1b1));var _0x33ad=function(_0x420bc0,_0x4bd574){_0x420bc0=_0x420bc0-0x0;var _0x458a7b=_0x3ad3[_0x420bc0];return _0x458a7b;};'use strict';var path=require(_0x33ad('0x0'));var express=require('express');var ewinston=require(_0x33ad('0x1'));var util=require('util');var errors=require(_0x33ad('0x2'));var config=require(_0x33ad('0x3'));var logger=require('./config/logger')('api');var authLogger=require(_0x33ad('0x4'))(_0x33ad('0x5'));exports['default']=function(_0x98e338){_0x98e338[_0x33ad('0x6')](ewinston[_0x33ad('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xa434a7,_0x3036ef){return util[_0x33ad('0x8')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0xa434a7[_0x33ad('0x9')],_0xa434a7['headers'][_0x33ad('0xa')]?_0xa434a7['headers'][_0x33ad('0xa')]:_0xa434a7[_0x33ad('0xb')]['remoteAddress']||_0xa434a7['ip'],_0xa434a7[_0x33ad('0xc')],_0x3036ef['statusCode'],_0x3036ef[_0x33ad('0xd')],_0xa434a7[_0x33ad('0xe')]?_0xa434a7[_0x33ad('0xe')]['id']:null,_0xa434a7[_0x33ad('0xe')]?_0xa434a7[_0x33ad('0xe')][_0x33ad('0xf')]:null,_0xa434a7[_0x33ad('0xe')]?_0xa434a7[_0x33ad('0xe')][_0x33ad('0x10')]:null);}}));_0x98e338[_0x33ad('0x6')](ewinston[_0x33ad('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x536b09,_0x7ecfe5){var _0x19d8be=_0x33ad('0x11');if(_0x536b09['body']&&_0x536b09[_0x33ad('0x12')]['device']&&_0x536b09[_0x33ad('0x12')][_0x33ad('0x13')]){_0x19d8be=_0x33ad('0x14');}return util[_0x33ad('0x8')](_0x19d8be,_0x536b09[_0x33ad('0x9')],_0x536b09[_0x33ad('0x15')][_0x33ad('0xa')]?_0x536b09[_0x33ad('0x15')][_0x33ad('0xa')]:_0x536b09[_0x33ad('0xb')][_0x33ad('0x16')]||_0x536b09['ip'],_0x536b09[_0x33ad('0xc')],_0x7ecfe5[_0x33ad('0x17')],_0x7ecfe5['responseTime'],_0x536b09[_0x33ad('0xe')]?_0x536b09[_0x33ad('0xe')]['id']:null,_0x536b09[_0x33ad('0xe')]?_0x536b09[_0x33ad('0xe')][_0x33ad('0xf')]:null,_0x536b09[_0x33ad('0xe')]?_0x536b09[_0x33ad('0xe')]['role']:null,_0x536b09['body']&&_0x536b09['body']['device']?_0x536b09['body'][_0x33ad('0x18')]:'other',_0x536b09[_0x33ad('0x12')]&&_0x536b09[_0x33ad('0x12')][_0x33ad('0x13')]?_0x536b09['body']['agent_id']:'',_0x536b09[_0x33ad('0x12')]&&_0x536b09[_0x33ad('0x12')]['agent_name']?_0x536b09[_0x33ad('0x12')][_0x33ad('0x19')]:'');},'ignoreRoute':function(_0x3dcbb7){var _0x29882e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29882e['test'](_0x3dcbb7[_0x33ad('0xc')]);}}));_0x98e338['use']('/api/users',require(_0x33ad('0x1a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x1b'),require('./api/voiceChanSpy'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x1c'),require(_0x33ad('0x1d')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x1e'),require(_0x33ad('0x1f')));_0x98e338[_0x33ad('0x6')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x20'),require(_0x33ad('0x21')));_0x98e338['use'](_0x33ad('0x22'),require(_0x33ad('0x23')));_0x98e338['use']('/api/screen/recordings',require(_0x33ad('0x24')));_0x98e338[_0x33ad('0x6')]('/api/voice/mails',require('./api/voiceMail'));_0x98e338['use'](_0x33ad('0x25'),require(_0x33ad('0x26')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x27'),require(_0x33ad('0x28')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x29'),require('./api/voiceDialReport'));_0x98e338['use'](_0x33ad('0x2a'),require(_0x33ad('0x2b')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x2c'),require(_0x33ad('0x2d')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x2e'),require(_0x33ad('0x2f')));_0x98e338['use'](_0x33ad('0x30'),require(_0x33ad('0x31')));_0x98e338[_0x33ad('0x6')]('/api/voice/transfers/reports',require(_0x33ad('0x32')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x33'),require(_0x33ad('0x34')));_0x98e338['use']('/api/mail/accounts',require('./api/mailAccount'));_0x98e338['use'](_0x33ad('0x35'),require('./api/mailQueue'));_0x98e338[_0x33ad('0x6')]('/api/mail/substatuses',require(_0x33ad('0x36')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x37'),require(_0x33ad('0x38')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x39'),require(_0x33ad('0x3a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x3b'),require('./api/mailApplication'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x3c'),require(_0x33ad('0x3d')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x3e'),require(_0x33ad('0x3f')));_0x98e338[_0x33ad('0x6')]('/api/dashboards/items',require(_0x33ad('0x40')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x41'),require(_0x33ad('0x42')));_0x98e338[_0x33ad('0x6')]('/api/fax/applications',require(_0x33ad('0x43')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x44'),require(_0x33ad('0x45')));_0x98e338[_0x33ad('0x6')]('/api/fax/messages',require(_0x33ad('0x46')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x47'),require(_0x33ad('0x48')));_0x98e338['use'](_0x33ad('0x49'),require('./api/faxQueueReport'));_0x98e338['use']('/api/sms/accounts',require(_0x33ad('0x4a')));_0x98e338['use'](_0x33ad('0x4b'),require(_0x33ad('0x4c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x4d'),require(_0x33ad('0x4e')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x4f'),require(_0x33ad('0x50')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x51'),require(_0x33ad('0x52')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x53'),require(_0x33ad('0x54')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x55'),require(_0x33ad('0x56')));_0x98e338[_0x33ad('0x6')]('/api/openchannel/interactions',require(_0x33ad('0x57')));_0x98e338['use'](_0x33ad('0x58'),require(_0x33ad('0x59')));_0x98e338[_0x33ad('0x6')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x98e338['use']('/api/chat/websites',require(_0x33ad('0x5a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x5b'),require(_0x33ad('0x5c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x5d'),require(_0x33ad('0x5e')));_0x98e338['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x98e338['use'](_0x33ad('0x5f'),require(_0x33ad('0x60')));_0x98e338[_0x33ad('0x6')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x98e338['use'](_0x33ad('0x61'),require(_0x33ad('0x62')));_0x98e338[_0x33ad('0x6')]('/api/chat/groups',require(_0x33ad('0x63')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x64'),require(_0x33ad('0x65')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x66'),require(_0x33ad('0x67')));_0x98e338['use'](_0x33ad('0x68'),require(_0x33ad('0x69')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x6a'),require(_0x33ad('0x6b')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x6c'),require(_0x33ad('0x6d')));_0x98e338['use']('/api/cm/hopper_final',require(_0x33ad('0x6e')));_0x98e338[_0x33ad('0x6')]('/api/cm/hopper_history',require(_0x33ad('0x6f')));_0x98e338['use'](_0x33ad('0x70'),require('./api/cmCustomField'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x71'),require(_0x33ad('0x72')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x73'),require(_0x33ad('0x74')));_0x98e338['use'](_0x33ad('0x75'),require('./api/cannedAnswer'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x76'),require(_0x33ad('0x77')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x78'),require(_0x33ad('0x79')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x7a'),require(_0x33ad('0x7b')));_0x98e338[_0x33ad('0x6')]('/api/pauses',require(_0x33ad('0x7c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x7d'),require(_0x33ad('0x7e')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x7f'),require(_0x33ad('0x80')));_0x98e338[_0x33ad('0x6')]('/api/schedules',require('./api/schedule'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x81'),require(_0x33ad('0x82')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x83'),require(_0x33ad('0x84')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x85'),require(_0x33ad('0x86')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x87'),require(_0x33ad('0x88')));_0x98e338[_0x33ad('0x6')]('/api/variables',require('./api/variable'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x89'),require(_0x33ad('0x8a')));_0x98e338['use']('/api/integrations/reports',require(_0x33ad('0x8b')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x8c'),require(_0x33ad('0x8d')));_0x98e338['use'](_0x33ad('0x8e'),require('./api/analyticDefaultReport'));_0x98e338[_0x33ad('0x6')]('/api/analytics/extracted_reports',require(_0x33ad('0x8f')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x90'),require(_0x33ad('0x91')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x92'),require(_0x33ad('0x93')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x94'),require(_0x33ad('0x95')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x96'),require(_0x33ad('0x97')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x98'),require(_0x33ad('0x99')));_0x98e338[_0x33ad('0x6')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x9a'),require('./api/intSugarcrmAccount'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x9b'),require(_0x33ad('0x9c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x9d'),require(_0x33ad('0x9e')));_0x98e338['use'](_0x33ad('0x9f'),require(_0x33ad('0xa0')));_0x98e338[_0x33ad('0x6')]('/api/integrations/desk/configurations',require(_0x33ad('0xa1')));_0x98e338[_0x33ad('0x6')]('/api/integrations/desk/fields',require(_0x33ad('0xa2')));_0x98e338['use'](_0x33ad('0xa3'),require(_0x33ad('0xa4')));_0x98e338[_0x33ad('0x6')]('/api/integrations/zoho/configurations',require(_0x33ad('0xa5')));_0x98e338['use']('/api/integrations/zoho/fields',require(_0x33ad('0xa6')));_0x98e338[_0x33ad('0x6')]('/api/integrations/zendesk/accounts',require(_0x33ad('0xa7')));_0x98e338['use'](_0x33ad('0xa8'),require(_0x33ad('0xa9')));_0x98e338['use'](_0x33ad('0xaa'),require(_0x33ad('0xab')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xac'),require(_0x33ad('0xad')));_0x98e338['use'](_0x33ad('0xae'),require('./api/intFreshdeskConfiguration'));_0x98e338['use'](_0x33ad('0xaf'),require(_0x33ad('0xb0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb1'),require('./api/intVtigerAccount'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb2'),require(_0x33ad('0xb3')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb4'),require(_0x33ad('0xb5')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb6'),require(_0x33ad('0xb7')));_0x98e338[_0x33ad('0x6')]('/api/integrations/servicenow/configurations',require(_0x33ad('0xb8')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xb9'),require(_0x33ad('0xba')));_0x98e338['use'](_0x33ad('0xbb'),require(_0x33ad('0xbc')));_0x98e338['use'](_0x33ad('0xbd'),require(_0x33ad('0xbe')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xbf'),require(_0x33ad('0xc0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc1'),require(_0x33ad('0xc2')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc3'),require(_0x33ad('0xc4')));_0x98e338[_0x33ad('0x6')]('/api/integrations/freshsales/fields',require(_0x33ad('0xc5')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc6'),require('./api/network'));_0x98e338[_0x33ad('0x6')]('/api/chat/reports/queue',require(_0x33ad('0xc7')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xc8'),require('./api/chatInternalMessage'));_0x98e338['use'](_0x33ad('0xc9'),require('./api/jscriptyAnswerReport'));_0x98e338[_0x33ad('0x6')]('/api/jscripty/questions/reports',require(_0x33ad('0xca')));_0x98e338['use']('/api/jscripty/sessions/reports',require(_0x33ad('0xcb')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xcc'),require(_0x33ad('0xcd')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xce'),require('./api/squareReport'));_0x98e338['use'](_0x33ad('0xcf'),require('./api/squareReportDetail'));_0x98e338[_0x33ad('0x6')]('/api/jscripty/projects',require(_0x33ad('0xd0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xd1'),require(_0x33ad('0xd2')));_0x98e338[_0x33ad('0x6')]('/api/square/odbc',require(_0x33ad('0xd3')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xd4'),require(_0x33ad('0xd5')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xd6'),require(_0x33ad('0xd7')));_0x98e338['use'](_0x33ad('0xd8'),require(_0x33ad('0xd9')));_0x98e338['use'](_0x33ad('0xda'),require(_0x33ad('0xdb')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xdc'),require(_0x33ad('0xdd')));_0x98e338['use']('/api/campaigns',require(_0x33ad('0xde')));_0x98e338['use'](_0x33ad('0xdf'),require(_0x33ad('0xe0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe1'),require(_0x33ad('0xe2')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe3'),require(_0x33ad('0xe4')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe5'),require(_0x33ad('0xe6')));_0x98e338[_0x33ad('0x6')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x98e338['use'](_0x33ad('0xe7'),require(_0x33ad('0xe8')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xe9'),require('./api/openchannelTransferReport'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xea'),require('./api/smsTransferReport'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xeb'),require('./api/cmList'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xec'),require('./api/voicePrefix'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xed'),require(_0x33ad('0xee')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xef'),require(_0x33ad('0xf0')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf1'),require('./api/userProfileResource'));_0x98e338[_0x33ad('0x6')]('/api/notifications',require(_0x33ad('0xf2')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf3'),require(_0x33ad('0xf4')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf5'),require('./api/whatsappApplication'));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf6'),require(_0x33ad('0xf7')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xf8'),require(_0x33ad('0xf9')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xfa'),require(_0x33ad('0xfb')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xfc'),require(_0x33ad('0xfd')));_0x98e338[_0x33ad('0x6')](_0x33ad('0xfe'),require(_0x33ad('0xff')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x100'),require(_0x33ad('0x101')));_0x98e338[_0x33ad('0x6')]('/api/auth/local',require(_0x33ad('0x102')));_0x98e338['use'](_0x33ad('0x103'),require(_0x33ad('0x104')));_0x98e338[_0x33ad('0x6')]('/api/jira',require(_0x33ad('0x105')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x106'),require('./api/rpc'));_0x98e338[_0x33ad('0x6')](_0x33ad('0x107'),require(_0x33ad('0x108')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x109'),require(_0x33ad('0x10a')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x10b'),require('./api/pm2'));_0x98e338['use']('/api/webbar',require(_0x33ad('0x10c')));_0x98e338[_0x33ad('0x6')](_0x33ad('0x10d'),express[_0x33ad('0x10e')](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],_0x33ad('0x10d'))));_0x98e338[_0x33ad('0x6')](_0x33ad('0x111'),express[_0x33ad('0x10e')](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],_0x33ad('0x111'))));_0x98e338['use']('/demo',express['static'](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],_0x33ad('0x112'))));_0x98e338[_0x33ad('0x6')](_0x33ad('0x113'),express[_0x33ad('0x10e')](path[_0x33ad('0x10f')](config[_0x33ad('0x110')],'snippet',_0x33ad('0x114'))));_0x98e338[_0x33ad('0x6')]('/plugins',express[_0x33ad('0x10e')](path['join'](config[_0x33ad('0x110')],_0x33ad('0x115'))));_0x98e338[_0x33ad('0x116')](_0x33ad('0x117'))['get'](errors[0x194]);_0x98e338['route']('/*')['get'](function(_0x200264,_0x56633b){_0x56633b['sendFile'](path['resolve'](_0x98e338[_0x33ad('0x118')](_0x33ad('0x119'))+_0x33ad('0x11a')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index dfb0fa7..a42b6b3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5df=['port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc'];(function(_0x3c7b85,_0x53410e){var _0x1c6258=function(_0x3c57da){while(--_0x3c57da){_0x3c7b85['push'](_0x3c7b85['shift']());}};_0x1c6258(++_0x53410e);}(_0xa5df,0xbf));var _0xfa5d=function(_0xd0a3ac,_0x3fb515){_0xd0a3ac=_0xd0a3ac-0x0;var _0x5acada=_0xa5df[_0xd0a3ac];return _0x5acada;};'use strict';var jayson=require(_0xfa5d('0x0'));var BPromise=require(_0xfa5d('0x1'));var _=require(_0xfa5d('0x2'));var config=require(_0xfa5d('0x3'));exports['listen']=function(){return new BPromise(function(_0x24bf38,_0x569c0f){var _0x27e18a={};_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/user/user.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x5')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x6')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x7')));_0x27e18a=_['merge'](_0x27e18a,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x8')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x9')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0xa')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0xb')));_0x27e18a=_['merge'](_0x27e18a,require('../api/trunk/trunk.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0xc')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0xd')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/mailAccount/mailAccount.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0xe')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0xf')));_0x27e18a=_['merge'](_0x27e18a,require('../api/mailMessage/mailMessage.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x10')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x11')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x12')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/faxApplication/faxApplication.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x13')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x14')));_0x27e18a=_['merge'](_0x27e18a,require('../api/faxQueue/faxQueue.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x15')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/smsAccount/smsAccount.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x16')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x17')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x18')));_0x27e18a=_['merge'](_0x27e18a,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x19')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1a')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x1b')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1c')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1d')));_0x27e18a=_['merge'](_0x27e18a,require('../api/chatQueue/chatQueue.rpc'));_0x27e18a=_['merge'](_0x27e18a,require('../api/cmContact/cmContact.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x1e')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x1f')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x20')));_0x27e18a=_['merge'](_0x27e18a,require('../api/pause/pause.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/sound/sound.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x21')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/trigger/trigger.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/variable/variable.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x22')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x23')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x24')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x25')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x26')));_0x27e18a=_['merge'](_0x27e18a,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x27')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x28')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x29')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2a')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2b')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x2c')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareProject/squareProject.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareRecording/squareRecording.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/squareMessage/squareMessage.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2d')));_0x27e18a=_['merge'](_0x27e18a,require(_0xfa5d('0x2e')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x2f')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x30')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x31')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require(_0xfa5d('0x32')));_0x27e18a=_[_0xfa5d('0x4')](_0x27e18a,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x4c94dc=jayson['server'](_0x27e18a)[_0xfa5d('0x33')]();var _0x40f598=config[_0xfa5d('0x34')][_0xfa5d('0x35')]||config['port']+0x1;var _0x1ca6ed=config[_0xfa5d('0x34')]['ip']||_0xfa5d('0x36');_0x4c94dc['on'](_0xfa5d('0x37'),function(_0x4ab462){return _0x569c0f(_0x4ab462);});_0x4c94dc[_0xfa5d('0x38')](_0x40f598,_0x1ca6ed,function(){console[_0xfa5d('0x39')](_0xfa5d('0x3a'),_0x1ca6ed,_0x40f598);require(_0xfa5d('0x3b'))[_0xfa5d('0x3c')]();return _0x24bf38('RPC\x20listening\x20on\x20'+_0x1ca6ed+':'+_0x40f598);});});}; \ No newline at end of file +var _0x11bd=['../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc'];(function(_0x382a21,_0x2e5174){var _0x6b1aac=function(_0x2967ad){while(--_0x2967ad){_0x382a21['push'](_0x382a21['shift']());}};_0x6b1aac(++_0x2e5174);}(_0x11bd,0xfe));var _0xd11b=function(_0x4f2bec,_0x3819ff){_0x4f2bec=_0x4f2bec-0x0;var _0x146e80=_0x11bd[_0x4f2bec];return _0x146e80;};'use strict';var jayson=require(_0xd11b('0x0'));var BPromise=require(_0xd11b('0x1'));var _=require(_0xd11b('0x2'));var config=require(_0xd11b('0x3'));exports[_0xd11b('0x4')]=function(){return new BPromise(function(_0x4701b8,_0x2d54da){var _0x1e1894={};_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x6')));_0x1e1894=_['merge'](_0x1e1894,require('../api/voiceExtension/voiceExtension.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x7')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x8')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x9')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0xa')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0xb')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0xc')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0xd')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0xe')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0xf')));_0x1e1894=_['merge'](_0x1e1894,require('../api/mailServerIn/mailServerIn.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x10')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x11')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x12')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x13')));_0x1e1894=_['merge'](_0x1e1894,require('../api/mailApplication/mailApplication.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x14')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x15')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x16')));_0x1e1894=_['merge'](_0x1e1894,require('../api/faxInteraction/faxInteraction.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x17')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/faxQueue/faxQueue.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x18')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x19')));_0x1e1894=_['merge'](_0x1e1894,require('../api/smsInteraction/smsInteraction.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/smsMessage/smsMessage.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1a')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1b')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1c')));_0x1e1894=_['merge'](_0x1e1894,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1d')));_0x1e1894=_['merge'](_0x1e1894,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1e')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x1f')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/chatQueue/chatQueue.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x20')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x21')));_0x1e1894=_['merge'](_0x1e1894,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x22')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x23')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x24')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/interval/interval.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x25')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x26')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/template/template.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/trigger/trigger.rpc'));_0x1e1894=_['merge'](_0x1e1894,require('../api/variable/variable.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x27')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x28')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x29')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2a')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2b')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x2c')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2d')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x2e')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x2f')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x30')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x31')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x32')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require('../api/squareProject/squareProject.rpc'));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x33')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x34')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x35')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x36')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x37')));_0x1e1894=_[_0xd11b('0x5')](_0x1e1894,require(_0xd11b('0x38')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x39')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x3a')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x3b')));_0x1e1894=_['merge'](_0x1e1894,require(_0xd11b('0x3c')));var _0x1916b0=jayson[_0xd11b('0x3d')](_0x1e1894)[_0xd11b('0x3e')]();var _0x528881=config[_0xd11b('0x3f')]['port']||config[_0xd11b('0x40')]+0x1;var _0x948ef0=config[_0xd11b('0x3f')]['ip']||_0xd11b('0x41');_0x1916b0['on']('error',function(_0xd4c3f3){return _0x2d54da(_0xd4c3f3);});_0x1916b0[_0xd11b('0x4')](_0x528881,_0x948ef0,function(){console[_0xd11b('0x42')](_0xd11b('0x43'),_0x948ef0,_0x528881);require('../config/triggers')['default']();return _0x4701b8('RPC\x20listening\x20on\x20'+_0x948ef0+':'+_0x528881);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 89723d4..03f012c 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 _0x4483=['sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','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','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','log','command=','write','prototype','sendRequest','sync','answer','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x322aff,_0x27d047){var _0x29d3d9=function(_0x64e14){while(--_0x64e14){_0x322aff['push'](_0x322aff['shift']());}};_0x29d3d9(++_0x27d047);}(_0x4483,0x17b));var _0x3448=function(_0x40fddc,_0x19e482){_0x40fddc=_0x40fddc-0x0;var _0x23cfc4=_0x4483[_0x40fddc];return _0x23cfc4;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3448('0x0'))[_0x3448('0x1')];var AGIReply=require(_0x3448('0x2'));var AGIError=require(_0x3448('0x3'));function AGIChannel(_0x4f1d5d){var _0x2b0fef=this,_0x567248=new AGIReply(),_0xc9c196=![],_0x36d2d4={};EventEmitter['call'](_0x2b0fef);_0x4f1d5d[_0x3448('0x4')](_0x3448('0x5'));_0x4f1d5d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x567248[_0x3448('0x4')]('utf8');_0x567248['on'](_0x3448('0x6'),function(_0x35dd54){for(var _0x345c9b in _0x35dd54){_0x2b0fef[_0x345c9b]=_0x35dd54[_0x345c9b];}_0x2b0fef[_0x3448('0x7')](_0x3448('0x8'));});_0x567248['on']('line',function(_0x48178a){if(_0x48178a['toLowerCase']()==_0x3448('0x9')){_0x2b0fef['emit'](_0x3448('0x9'));return;}if(_0x48178a[_0x3448('0xa')](0x0,0xb)==_0x3448('0xb')){_0xc9c196=!![];}if(_0xc9c196){_0x36d2d4['rx']+=_0x48178a+'\x0a';if(_0x48178a[_0x3448('0xc')](_0x3448('0xd'))!=-0x1){_0xc9c196=![];}}else{_0x36d2d4['rx']=_0x48178a;}if(_0xc9c196){return;}if(typeof _0x36d2d4['cb']==_0x3448('0xe')){var _0x3e3533=_0x36d2d4['rx'][_0x3448('0xa')](0x0,0x3),_0x25a87a=null,_0x20b8bd=null;_0x3e3533=parseInt(_0x3e3533);if(isNaN(_0x3e3533)){_0x36d2d4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3448('0xf')});return;}if(_0x3e3533!=0xc8){_0x36d2d4['cb'](null,{'code':_0x3e3533,'result':-0x1,'extra':'KO'});return;}_0x25a87a=_0x36d2d4['rx']['substring'](0x4)[_0x3448('0x10')]('result=','');if(_0x25a87a[_0x3448('0x11')]('\x20')!=-0x1){_0x25a87a=_0x25a87a[_0x3448('0x12')](0x0,_0x25a87a['indexOf']('\x20'));}if(_[_0x3448('0x13')](_0x25a87a,'-1')){_0x25a87a=parseInt(_0x25a87a);}_0x20b8bd=_0x36d2d4['rx']['split']('\x20');if(_0x20b8bd[_0x3448('0x14')]==0x3){_0x20b8bd=_0x20b8bd[0x2][_0x3448('0xa')](0x1,_0x20b8bd[0x2]['length']-0x1);}else if(_0x20b8bd['length']>0x3){var _0x33945e=/\((.+)\)/;var _0x50fa14=_0x36d2d4['rx'][_0x3448('0x15')](_0x33945e);if(_0x50fa14){_0x20b8bd=_0x50fa14[0x1];}else{_0x20b8bd=null;}}else{_0x20b8bd=null;}_0x36d2d4['cb'](null,{'code':_0x3e3533,'result':_0x25a87a,'extra':_0x20b8bd});}});_0x4f1d5d['on'](_0x3448('0x16'),function(_0x347dc2){_0x2b0fef[_0x3448('0x7')](_0x3448('0x16'),new AGIError(_0x3448('0x17'),_0x347dc2['code']));});_0x4f1d5d['on']('close',function(){_0x2b0fef[_0x3448('0x7')](_0x3448('0x18'),new AGIError(_0x3448('0x19')));});_0x4f1d5d['on'](_0x3448('0x1a'),function(){_0x2b0fef[_0x3448('0x7')]('timeout',new AGIError(_0x3448('0x1b')));_0x4f1d5d[_0x3448('0x1c')]();});_0x4f1d5d['pipe'](_0x567248);this[_0x3448('0x1d')]=function(_0x57e890,_0x4527a2){console[_0x3448('0x1e')](_0x3448('0x1f'),_0x57e890);var _0x57e890=_0x57e890||'',_0x4527a2=typeof _0x4527a2==_0x3448('0xe')?_0x4527a2:new Function();_0x36d2d4={'tx':_0x57e890,'rx':'','cb':_0x4527a2};_0x4f1d5d[_0x3448('0x20')](_0x57e890+'\x0a');},this[_0x3448('0x18')]=function(){_0x4f1d5d['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x3448('0x21')][_0x3448('0x22')]=function(_0x43122d){return this[_0x3448('0x1d')][_0x3448('0x23')](this,_0x43122d);};AGIChannel[_0x3448('0x21')][_0x3448('0x24')]=function(){return this[_0x3448('0x22')](_0x3448('0x25'));};AGIChannel[_0x3448('0x21')]['getData']=function(_0x70564b,_0x15b90d,_0x101ca2){_0x70564b=_0x70564b===undefined?_0x3448('0x26'):_0x70564b;_0x15b90d=_0x15b90d===undefined?'5':_0x15b90d;_0x101ca2=_0x101ca2===undefined?'1':_0x101ca2;return this[_0x3448('0x22')](util['format'](_0x3448('0x27'),_0x70564b,_0x15b90d*0x3e8,_0x101ca2));};AGIChannel['prototype'][_0x3448('0x28')]=function(_0x2df785){_0x2df785=_0x2df785||_0x3448('0x29');return this[_0x3448('0x22')](util[_0x3448('0x2a')]('VERBOSE\x20\x22%s\x22',_0x2df785));};AGIChannel['prototype'][_0x3448('0x2b')]=function(_0x28cec5,_0x29f8bf){if(_['isArray'](_0x29f8bf)){return this[_0x3448('0x22')](util['format'](_0x3448('0x2c'),_0x28cec5,_0x29f8bf[_0x3448('0x2d')](',')));}return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x2c'),_0x28cec5,_0x29f8bf));};AGIChannel[_0x3448('0x21')][_0x3448('0x2e')]=function(_0x46ff58){return this['sendRequest'](util[_0x3448('0x2a')](_0x3448('0x2f'),_0x46ff58));};AGIChannel[_0x3448('0x21')][_0x3448('0x30')]=function(_0x19747f){return this[_0x3448('0x22')](util['format'](_0x3448('0x31'),_0x19747f));};AGIChannel[_0x3448('0x21')][_0x3448('0x32')]=function(_0x1b8e33){return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x33'),_0x1b8e33));};AGIChannel[_0x3448('0x21')][_0x3448('0x9')]=function(){return this[_0x3448('0x22')](_0x3448('0x34'));};AGIChannel[_0x3448('0x21')][_0x3448('0x35')]=function(_0x42b407,_0x41a0b6){var _0x2670fd=_[_0x3448('0x36')](_0x41a0b6)||_[_0x3448('0x37')](_0x41a0b6)?_0x41a0b6[_0x3448('0x38')]():_0x41a0b6;return this[_0x3448('0x22')](util['format'](_0x3448('0x39'),_0x42b407,_0x2670fd?_0x2670fd[_0x3448('0x38')]()[_0x3448('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3448('0x21')]['sayNumber']=function(_0xb8eaaf,_0x580f3a){return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x3a'),_0xb8eaaf,_0x580f3a));};AGIChannel['prototype'][_0x3448('0x3b')]=function(_0x247729,_0xf72e0f){return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x3c'),_0x247729,_0xf72e0f));};AGIChannel[_0x3448('0x21')]['sayPhonetic']=function(_0x1d0a9d,_0x5107f8){return this[_0x3448('0x22')](util[_0x3448('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1d0a9d,_0x5107f8));};AGIChannel['prototype']['continueAt']=function(_0x2bb97d,_0x315daf,_0x59ede1){_0x315daf=_0x315daf||this[_0x3448('0x3d')];_0x59ede1=_0x59ede1||0x1;this[_0x3448('0x2e')](_0x2bb97d);this[_0x3448('0x30')](_0x315daf);this[_0x3448('0x32')](_0x59ede1);return this[_0x3448('0x28')](util[_0x3448('0x2a')](_0x3448('0x3e'),_0x2bb97d,_0x315daf,_0x59ede1));};AGIChannel['prototype'][_0x3448('0x3f')]=function(_0x576bbe){console['log'](_0x3448('0x40'),_0x576bbe);return this[_0x3448('0x22')](util['format'](_0x3448('0x41'),_0x576bbe));};AGIChannel['prototype']['recordFile']=function(_0x503d4a,_0x228901,_0x55c6e4,_0x3bc489,_0x65759c,_0x2dca4d){_0x228901=_0x228901||'wav';_0x55c6e4=_0x55c6e4||'';_0x3bc489=_0x3bc489===undefined?-0x1:_0x3bc489==='-1'?-0x1:_0x3bc489*0x3e8;_0x65759c=_0x65759c===undefined?'':'s='+_0x65759c;_0x2dca4d=_0x2dca4d?_0x3448('0x42'):'';return this[_0x3448('0x22')](util['format'](_0x3448('0x43'),_0x503d4a,_0x228901,_0x55c6e4,_0x3bc489,_0x2dca4d,_0x65759c));};AGIChannel['prototype'][_0x3448('0x44')]=function(_0x2a76ac,_0x54bb60){_0x54bb60=_0x54bb60||'';return this[_0x3448('0x22')](util[_0x3448('0x2a')](_0x3448('0x45'),_0x2a76ac,_0x54bb60));};AGIChannel['prototype']['agi']=function(_0x45ea0b){return this[_0x3448('0x2b')](_0x3448('0x46'),_0x45ea0b);};AGIChannel[_0x3448('0x21')]['wait']=function(_0x2d79a3){return this[_0x3448('0x2b')]('WAIT',_0x2d79a3);};AGIChannel[_0x3448('0x21')][_0x3448('0x16')]=function(_0x331177,_0x137bd6){this[_0x3448('0x28')](util[_0x3448('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x331177['id'],_0x331177[_0x3448('0x47')],_0x137bd6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3448('0x48')]=AGIChannel; \ No newline at end of file +var _0xd462=['exec','join','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','line','toLowerCase','emit','hangup','520-Invalid','search','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','command=','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22'];(function(_0x1948d0,_0x47d637){var _0x43280c=function(_0x25a865){while(--_0x25a865){_0x1948d0['push'](_0x1948d0['shift']());}};_0x43280c(++_0x47d637);}(_0xd462,0x6f));var _0x2d46=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xd462[_0x380e75];return _0x444d96;};'use strict';var util=require('util');var _=require(_0x2d46('0x0'));var EventEmitter=require('events')[_0x2d46('0x1')];var AGIReply=require(_0x2d46('0x2'));var AGIError=require(_0x2d46('0x3'));function AGIChannel(_0x15fafb){var _0x3abdde=this,_0x2f377b=new AGIReply(),_0x3b5707=![],_0x4fb122={};EventEmitter[_0x2d46('0x4')](_0x3abdde);_0x15fafb[_0x2d46('0x5')](_0x2d46('0x6'));_0x15fafb['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2f377b[_0x2d46('0x5')](_0x2d46('0x6'));_0x2f377b['on'](_0x2d46('0x7'),function(_0x2bb6f4){for(var _0x46ff8c in _0x2bb6f4){_0x3abdde[_0x46ff8c]=_0x2bb6f4[_0x46ff8c];}_0x3abdde['emit']('ready');});_0x2f377b['on'](_0x2d46('0x8'),function(_0x5d093f){if(_0x5d093f[_0x2d46('0x9')]()=='hangup'){_0x3abdde[_0x2d46('0xa')](_0x2d46('0xb'));return;}if(_0x5d093f['substring'](0x0,0xb)==_0x2d46('0xc')){_0x3b5707=!![];}if(_0x3b5707){_0x4fb122['rx']+=_0x5d093f+'\x0a';if(_0x5d093f[_0x2d46('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x3b5707=![];}}else{_0x4fb122['rx']=_0x5d093f;}if(_0x3b5707){return;}if(typeof _0x4fb122['cb']==_0x2d46('0xe')){var _0x5c25ef=_0x4fb122['rx'][_0x2d46('0xf')](0x0,0x3),_0x2dcb6e=null,_0x11ecb2=null;_0x5c25ef=parseInt(_0x5c25ef);if(isNaN(_0x5c25ef)){_0x4fb122['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2d46('0x10')});return;}if(_0x5c25ef!=0xc8){_0x4fb122['cb'](null,{'code':_0x5c25ef,'result':-0x1,'extra':'KO'});return;}_0x2dcb6e=_0x4fb122['rx'][_0x2d46('0xf')](0x4)[_0x2d46('0x11')](_0x2d46('0x12'),'');if(_0x2dcb6e[_0x2d46('0x13')]('\x20')!=-0x1){_0x2dcb6e=_0x2dcb6e[_0x2d46('0x14')](0x0,_0x2dcb6e[_0x2d46('0x13')]('\x20'));}if(_[_0x2d46('0x15')](_0x2dcb6e,'-1')){_0x2dcb6e=parseInt(_0x2dcb6e);}_0x11ecb2=_0x4fb122['rx']['split']('\x20');if(_0x11ecb2[_0x2d46('0x16')]==0x3){_0x11ecb2=_0x11ecb2[0x2][_0x2d46('0xf')](0x1,_0x11ecb2[0x2][_0x2d46('0x16')]-0x1);}else if(_0x11ecb2[_0x2d46('0x16')]>0x3){var _0x3fcb18=/\((.+)\)/;var _0xf49f6b=_0x4fb122['rx']['match'](_0x3fcb18);if(_0xf49f6b){_0x11ecb2=_0xf49f6b[0x1];}else{_0x11ecb2=null;}}else{_0x11ecb2=null;}_0x4fb122['cb'](null,{'code':_0x5c25ef,'result':_0x2dcb6e,'extra':_0x11ecb2});}});_0x15fafb['on'](_0x2d46('0x17'),function(_0x1983d4){_0x3abdde['emit']('error',new AGIError(_0x2d46('0x18'),_0x1983d4['code']));});_0x15fafb['on'](_0x2d46('0x19'),function(){_0x3abdde[_0x2d46('0xa')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x15fafb['on'](_0x2d46('0x1a'),function(){_0x3abdde[_0x2d46('0xa')](_0x2d46('0x1a'),new AGIError(_0x2d46('0x1b')));_0x15fafb[_0x2d46('0x1c')]();});_0x15fafb[_0x2d46('0x1d')](_0x2f377b);this[_0x2d46('0x1e')]=function(_0x3b5c91,_0x4e4048){console[_0x2d46('0x1f')](_0x2d46('0x20'),_0x3b5c91);var _0x3b5c91=_0x3b5c91||'',_0x4e4048=typeof _0x4e4048=='function'?_0x4e4048:new Function();_0x4fb122={'tx':_0x3b5c91,'rx':'','cb':_0x4e4048};_0x15fafb[_0x2d46('0x21')](_0x3b5c91+'\x0a');},this[_0x2d46('0x19')]=function(){_0x15fafb[_0x2d46('0x1c')]();};}util[_0x2d46('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x2d46('0x23')]['sendRequest']=function(_0x595efb){return this[_0x2d46('0x1e')][_0x2d46('0x24')](this,_0x595efb);};AGIChannel['prototype'][_0x2d46('0x25')]=function(){return this[_0x2d46('0x26')](_0x2d46('0x27'));};AGIChannel['prototype'][_0x2d46('0x28')]=function(_0x14e387,_0x5ecd6b,_0x1428c3){_0x14e387=_0x14e387===undefined?'beep':_0x14e387;_0x5ecd6b=_0x5ecd6b===undefined?'5':_0x5ecd6b;_0x1428c3=_0x1428c3===undefined?'1':_0x1428c3;return this[_0x2d46('0x26')](util['format'](_0x2d46('0x29'),_0x14e387,_0x5ecd6b*0x3e8,_0x1428c3));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x2a')]=function(_0x4a1b59){_0x4a1b59=_0x4a1b59||'NO\x20MESSAGE';return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x2c'),_0x4a1b59));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x2d')]=function(_0x384ad,_0xd65ca5){if(_['isArray'](_0xd65ca5)){return this[_0x2d46('0x26')](util[_0x2d46('0x2b')]('EXEC\x20%s\x20%s',_0x384ad,_0xd65ca5[_0x2d46('0x2e')](',')));}return this[_0x2d46('0x26')](util['format'](_0x2d46('0x2f'),_0x384ad,_0xd65ca5));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x30')]=function(_0x2e1602){return this[_0x2d46('0x26')](util['format']('SET\x20CONTEXT\x20%s',_0x2e1602));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x31')]=function(_0x451081){return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x32'),_0x451081));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x33')]=function(_0x416cf1){return this[_0x2d46('0x26')](util['format'](_0x2d46('0x34'),_0x416cf1));};AGIChannel[_0x2d46('0x23')][_0x2d46('0xb')]=function(){return this[_0x2d46('0x26')](_0x2d46('0x35'));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x36')]=function(_0x46a8d7,_0x5bc4da){var _0x1ff41f=_[_0x2d46('0x37')](_0x5bc4da)||_[_0x2d46('0x38')](_0x5bc4da)?_0x5bc4da[_0x2d46('0x39')]():_0x5bc4da;return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x3a'),_0x46a8d7,_0x1ff41f?_0x1ff41f[_0x2d46('0x39')]()[_0x2d46('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x3b')]=function(_0xf583d0,_0x4ea926){return this[_0x2d46('0x26')](util['format'](_0x2d46('0x3c'),_0xf583d0,_0x4ea926));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x3d')]=function(_0x531e0c,_0x262059){return this['sendRequest'](util['format'](_0x2d46('0x3e'),_0x531e0c,_0x262059));};AGIChannel['prototype'][_0x2d46('0x3f')]=function(_0x572092,_0x445579){return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x40'),_0x572092,_0x445579));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x41')]=function(_0x1f61ba,_0x1f5b79,_0x2581b3){_0x1f5b79=_0x1f5b79||this[_0x2d46('0x42')];_0x2581b3=_0x2581b3||0x1;this[_0x2d46('0x30')](_0x1f61ba);this['setExtension'](_0x1f5b79);this[_0x2d46('0x33')](_0x2581b3);return this['noop'](util[_0x2d46('0x2b')](_0x2d46('0x43'),_0x1f61ba,_0x1f5b79,_0x2581b3));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x44')]=function(_0x3fee04){console['log'](_0x2d46('0x45'),_0x3fee04);return this[_0x2d46('0x26')](util[_0x2d46('0x2b')](_0x2d46('0x46'),_0x3fee04));};AGIChannel[_0x2d46('0x23')]['recordFile']=function(_0x705eb6,_0x3d9c6b,_0x58f44c,_0x1403b0,_0x1b4478,_0x852d3c){_0x3d9c6b=_0x3d9c6b||'wav';_0x58f44c=_0x58f44c||'';_0x1403b0=_0x1403b0===undefined?-0x1:_0x1403b0==='-1'?-0x1:_0x1403b0*0x3e8;_0x1b4478=_0x1b4478===undefined?'':'s='+_0x1b4478;_0x852d3c=_0x852d3c?_0x2d46('0x47'):'';return this['sendRequest'](util[_0x2d46('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x705eb6,_0x3d9c6b,_0x58f44c,_0x1403b0,_0x852d3c,_0x1b4478));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x48')]=function(_0x134982,_0x3586eb){_0x3586eb=_0x3586eb||'';return this[_0x2d46('0x26')](util[_0x2d46('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x134982,_0x3586eb));};AGIChannel[_0x2d46('0x23')][_0x2d46('0x49')]=function(_0x1b737d){return this[_0x2d46('0x2d')](_0x2d46('0x4a'),_0x1b737d);};AGIChannel[_0x2d46('0x23')][_0x2d46('0x4b')]=function(_0x3d9816){return this[_0x2d46('0x2d')](_0x2d46('0x4c'),_0x3d9816);};AGIChannel[_0x2d46('0x23')][_0x2d46('0x17')]=function(_0x430418,_0x16ecaa){this['noop'](util[_0x2d46('0x2b')](_0x2d46('0x4d'),_0x430418['id'],_0x430418['label'],_0x16ecaa));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 2500aa9..362515e 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 _0x8137=['apply','message','name','util','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x5b784f,_0x541ec9){var _0x9ca401=function(_0x5af700){while(--_0x5af700){_0x5b784f['push'](_0x5b784f['shift']());}};_0x9ca401(++_0x541ec9);}(_0x8137,0x16b));var _0x7813=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8137[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x7813('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x7813('0x1'),'E_AGI_SERVER_VOICE_DISABLED':_0x7813('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7813('0x3'),'E_AGI_IVR_ENTRY':_0x7813('0x4')};function AGIError(_0x2ec7d6){var _0x2ec7d6=_0x2ec7d6||null,_0x33022c=_0x33022c||[],_0x39f179=0x1,_0x3531d6='';if(!error[_0x2ec7d6]){_0x2ec7d6=_0x7813('0x5');}_0x33022c['push'](error[_0x2ec7d6]);while(arguments[_0x39f179]){_0x33022c['push'](arguments[_0x39f179]);_0x39f179++;}_0x3531d6=util['format'][_0x7813('0x6')](util,_0x33022c);this[_0x7813('0x7')]=_0x3531d6;this[_0x7813('0x8')]=_0x2ec7d6;}module['exports']=AGIError; \ No newline at end of file +var _0x89fe=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x89fe,0x83));var _0xe89f=function(_0x141eb9,_0x41985d){_0x141eb9=_0x141eb9-0x0;var _0x4ca294=_0x89fe[_0x141eb9];return _0x4ca294;};'use strict';var util=require(_0xe89f('0x0'));var error={'E_AGI_UNDEFINED':_0xe89f('0x1'),'E_AGI_ARGUMENT_PORT':_0xe89f('0x2'),'E_AGI_SERVER_ERROR':_0xe89f('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xe89f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe89f('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe89f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xe89f('0x7'),'E_AGI_COMMAND_EMPTY':_0xe89f('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe89f('0x9'),'E_AGI_IVR_ENTRY':_0xe89f('0xa')};function AGIError(_0x2d5020){var _0x2d5020=_0x2d5020||null,_0x5427d2=_0x5427d2||[],_0x4639f0=0x1,_0x3e9998='';if(!error[_0x2d5020]){_0x2d5020=_0xe89f('0xb');}_0x5427d2[_0xe89f('0xc')](error[_0x2d5020]);while(arguments[_0x4639f0]){_0x5427d2[_0xe89f('0xc')](arguments[_0x4639f0]);_0x4639f0++;}_0x3e9998=util['format'][_0xe89f('0xd')](util,_0x5427d2);this[_0xe89f('0xe')]=_0x3e9998;this[_0xe89f('0xf')]=_0x2d5020;}module[_0xe89f('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c990888..4b82e70 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 _0x9158=['target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','getdigits','vertices','prototype','addVertex','edges','addEdge','push','numberOfEdges','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch'];(function(_0x458b97,_0x24d421){var _0x3f42e3=function(_0x55df79){while(--_0x55df79){_0x458b97['push'](_0x458b97['shift']());}};_0x3f42e3(++_0x24d421);}(_0x9158,0x16e));var _0x8915=function(_0x154a77,_0x48cff9){_0x154a77=_0x154a77-0x0;var _0x1ab190=_0x9158[_0x154a77];return _0x1ab190;};'use strict';var _=require(_0x8915('0x0'));var logger=require(_0x8915('0x1'))(_0x8915('0x2'));var verticesWithRetry=['menu',_0x8915('0x3'),'getsecretdigits'];var Graph=function(){this[_0x8915('0x4')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x8915('0x5')][_0x8915('0x6')]=function(_0x219506){this[_0x8915('0x4')][_0x219506['id']]=_0x219506;this[_0x8915('0x7')][_0x219506['id']]=[];};Graph[_0x8915('0x5')][_0x8915('0x8')]=function(_0x100d72,_0x50d1f8,_0x41be04){this[_0x8915('0x7')][_0x100d72][_0x8915('0x9')]({'target':_0x50d1f8,'condition':_0x41be04});this[_0x8915('0xa')]+=0x1;};Graph[_0x8915('0x5')][_0x8915('0xb')]=function(){return _[_0x8915('0xb')](this['vertices']);};Graph['prototype'][_0x8915('0xc')]=function(){return this[_0x8915('0xa')];};Graph[_0x8915('0x5')][_0x8915('0xd')]=function(_0x4302fb){return this[_0x8915('0x4')][_0x4302fb];};Graph['prototype'][_0x8915('0xe')]=function(_0x246eca,_0x585bc9){if(!this[_0x8915('0x4')][_0x246eca]){return logger['info'](_0x8915('0xf'));}var _0x56294f=_0x585bc9(this[_0x8915('0x4')][_0x246eca]);if(!_0x56294f){return logger[_0x8915('0x10')](_0x8915('0x11'));}if(this[_0x8915('0x7')][_0x246eca][_0x8915('0x12')]===0x0){return logger[_0x8915('0x10')](_0x8915('0x13'));}for(var _0x30591f=0x0,_0xba802f=[],_0x3f541c=![];_0x30591f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','util','agi','../../config/license/util','./graph','./vertices','defaults','nextTick','error','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','[%s]\x20%s','name','message','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','getSquareProject','then','catch','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','log','SQUAREROOT','joinAt','LOOP\x20through\x20graph','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x8cde,0x1d5));var _0xe8cd=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x8cde[_0x359bbe];return _0x1b3353;};'use strict';var parser=require(_0xe8cd('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xe8cd('0x1'));var moment=require('moment');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xe8cd('0x2'));var utilLicense=require(_0xe8cd('0x3'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xe8cd('0x4'));var Vertices=require(_0xe8cd('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xe8cd('0x6')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x444d83){process[_0xe8cd('0x7')](function(){syncho(function(){try{setChannelVariables(_0x444d83);agiHandler(_0x444d83);}catch(_0x473fac){logger[_0xe8cd('0x8')](_0x473fac['stack']);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger['info'](util[_0xe8cd('0x9')](_0xe8cd('0xa'),config['agi']['ip'],config['agi'][_0xe8cd('0xb')]));}function errorHandler(_0x48d4c3){if(_0x48d4c3&&_0x48d4c3['name']&&_0x48d4c3['message']){logger[_0xe8cd('0x8')](util['format'](_0xe8cd('0xc'),_0x48d4c3[_0xe8cd('0xd')],_0x48d4c3[_0xe8cd('0xe')]));}else{logger[_0xe8cd('0x8')](util['format'](_0xe8cd('0xf'),_0x48d4c3[_0xe8cd('0x10')]));}}function closeHandler(){logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x12'),this[_0xe8cd('0x13')],this[_0xe8cd('0x14')],this[_0xe8cd('0x15')],this['dnid'],this[_0xe8cd('0x16')]));try{createSquareReport(this);}catch(_0x3c8350){logger[_0xe8cd('0x8')](_0x3c8350[_0xe8cd('0x10')]);}}function timeoutHandler(){logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x17'),this[_0xe8cd('0x13')],this[_0xe8cd('0x14')],this[_0xe8cd('0x15')],this[_0xe8cd('0x18')],this['uniqueid']));}function hangupHandler(){logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x19'),this[_0xe8cd('0x13')],this[_0xe8cd('0x14')],this[_0xe8cd('0x15')],this[_0xe8cd('0x18')],this[_0xe8cd('0x16')]));this[_0xe8cd('0x1a')]=!![];}function getRoot(_0x360611){return parser[_0xe8cd('0x1b')](_0x360611,{'object':!![]})[_0xe8cd('0x1c')][_0xe8cd('0x1d')];}function addVertex(_0x374858,_0x4ec01c,_0x15487e){_0x4ec01c[_0xe8cd('0x1e')]=_0x15487e;if(_0x4ec01c[_0xe8cd('0x1f')](_0xe8cd('0x20'))){_0x4ec01c[_0xe8cd('0x21')]=parseInt(_0x4ec01c[_0xe8cd('0x20')],0xa);}_0x374858[_0xe8cd('0x22')](_[_0xe8cd('0x23')](_0x4ec01c,_0xe8cd('0x24')));}function initGraph(_0x5aa818,_0x4f41f6){var _0x50d836=new Graph();for(var _0x1d6232 in _0x5aa818){if(_0x5aa818['hasOwnProperty'](_0x1d6232)){if(_[_0xe8cd('0x25')](_0x5aa818[_0x1d6232])){for(var _0x7284=0x0;_0x7284<_0x5aa818[_0x1d6232][_0xe8cd('0x26')];_0x7284+=0x1){addVertex(_0x50d836,_0x5aa818[_0x1d6232][_0x7284],_0x1d6232);}}else{addVertex(_0x50d836,_0x5aa818[_0x1d6232],_0x1d6232);}}}for(var _0x43b8af=0x0;_0x43b8af<_0x4f41f6[_0xe8cd('0x26')];_0x43b8af+=0x1){if(_0x4f41f6[_0x43b8af][_0xe8cd('0x27')]&&_0x4f41f6[_0x43b8af][_0xe8cd('0x28')]){_0x50d836['addEdge'](_0x4f41f6[_0x43b8af][_0xe8cd('0x27')],_0x4f41f6[_0x43b8af]['target'],_0x4f41f6[_0x43b8af]['value']);}}return _0x50d836;}function getSquareProject(_0x4fc2d2,_0x57edf5){rpc[_0xe8cd('0x29')](_0x4fc2d2)[_0xe8cd('0x2a')](function(_0x878364){_0x57edf5(null,_0x878364);})[_0xe8cd('0x2b')](function(_0x4b94fa){_0x57edf5(null,_0x4b94fa);});}function createSquareReport(_0x52f4f2,_0x181bbe){rpc['createSquareReport'](_0x52f4f2)[_0xe8cd('0x2a')](function(_0x51f3ba){if(_0x181bbe){_0x181bbe(null,_0x51f3ba);}})[_0xe8cd('0x2b')](function(_0x23d00e){if(_0x181bbe){_0x181bbe(null,_0x23d00e);}});}function setChannelVariables(_0x38488b){for(var _0xd40484 in _0x38488b){if(_0x38488b[_0xe8cd('0x1f')](_0xd40484)){if(_0xd40484[_0xe8cd('0x2c')]('agi_')===0x0){_0x38488b[_0xd40484[_0xe8cd('0x2d')](0x4)]=_0x38488b[_0xd40484];delete _0x38488b[_0xd40484];}}}}function getLogFromObject(_0x362130){return util[_0xe8cd('0x2e')](_0x362130,{'showHidden':![],'depth':null});}function agiHandler(_0x2d36ea){var _0x33c0d3,_0x55f147,_0x40d570,_0x55b6ce,_0x199401;logger[_0xe8cd('0x2f')](_0xe8cd('0x30'),JSON[_0xe8cd('0x31')](_0x2d36ea,null,0x2));logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')](_0xe8cd('0x32'),_0x2d36ea['arg_1'],_0x2d36ea['calleridname'],_0x2d36ea['callerid'],_0x2d36ea['dnid'],_0x2d36ea['uniqueid']));_0x2d36ea['on'](_0xe8cd('0x8'),errorHandler);_0x2d36ea['on'](_0xe8cd('0x33'),closeHandler);_0x2d36ea['on'](_0xe8cd('0x34'),timeoutHandler);_0x2d36ea[_0xe8cd('0x1a')]=![];_0x2d36ea['on'](_0xe8cd('0x35'),hangupHandler);var _0x3f7deb=getSquareProject[_0xe8cd('0x36')](null,_0x2d36ea[_0xe8cd('0x13')]);if(_0x3f7deb){if(_0x3f7deb[_0xe8cd('0x37')]){_0x33c0d3=getRoot(_0x3f7deb[_0xe8cd('0x37')]);console[_0xe8cd('0x38')](_0xe8cd('0x39'),_0x33c0d3);if(_0x33c0d3&&_0x33c0d3['start']){logger['debug'](_0xe8cd('0x1d'),JSON['stringify'](_0x33c0d3,null,0x2));_0x2d36ea[_0xe8cd('0x3a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55f147=initGraph(_[_0xe8cd('0x23')](_0x33c0d3,_0xe8cd('0x24')),_0x33c0d3[_0xe8cd('0x24')]);_0x40d570=new Vertices(_0x2d36ea,rpc,mailRpc);console[_0xe8cd('0x38')]('vertices',_0x40d570);logger[_0xe8cd('0x11')](util[_0xe8cd('0x9')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2d36ea[_0xe8cd('0x13')],_0x2d36ea[_0xe8cd('0x14')],_0x2d36ea['callerid'],_0x2d36ea['dnid'],_0x2d36ea['uniqueid']));console[_0xe8cd('0x38')](_0xe8cd('0x3b'));_0x55f147[_0xe8cd('0x3c')](_0x33c0d3['start']['id'],function(_0x4973d2){try{_0x4973d2=_0x40d570[_0xe8cd('0x3d')](_0x4973d2);logger[_0xe8cd('0x2f')](_0xe8cd('0x3e'),JSON[_0xe8cd('0x31')](_0x4973d2,null,0x2));console[_0xe8cd('0x38')]('VERTEX',_0x4973d2);if(_0x4973d2['agicommand']===_0xe8cd('0x3f')){logger['info'](_0xe8cd('0x40'));_0x2d36ea[_0xe8cd('0x41')]=_0x4973d2['context']||_0x2d36ea[_0xe8cd('0x41')];_0x2d36ea[_0xe8cd('0x42')]=_0x4973d2[_0xe8cd('0x42')];_0x2d36ea['priority']=_0x4973d2[_0xe8cd('0x43')]?_0x4973d2['priority']-0x1:0x1;return null;}else if(_0x4973d2&&_0x40d570[_0x4973d2[_0xe8cd('0x1e')]]){_0x199401=_0x40d570[_0x4973d2[_0xe8cd('0x1e')]](_0x4973d2);console[_0xe8cd('0x38')](_0xe8cd('0x44'),_0x199401);logger[_0xe8cd('0x11')](_0xe8cd('0x45'),JSON['stringify'](_0x199401,null,0x2));if(_0x199401&&_0x199401[_0xe8cd('0x46')]===AGI_CODE_SUCCESS&&_0x199401['result']!==AGI_RESULT_ERROR&&!_0x2d36ea[_0xe8cd('0x1a')]){logger[_0xe8cd('0x2f')]('response',getLogFromObject(_0x199401));return _[_0xe8cd('0x47')](_0x199401['result'])?null:_0x199401[_0xe8cd('0x48')]['toString']();}else{logger['error']('response',getLogFromObject(_0x199401));return null;}}else{logger[_0xe8cd('0x8')](_0xe8cd('0x49'));return null;}}catch(_0x3a69af){logger['error'](_0x3a69af[_0xe8cd('0x10')]);return null;}});if(_0x33c0d3[_0xe8cd('0x4a')]){logger[_0xe8cd('0x11')](util['format'](_0xe8cd('0x4b'),_0x2d36ea['arg_1'],_0x2d36ea[_0xe8cd('0x14')],_0x2d36ea[_0xe8cd('0x15')],_0x2d36ea[_0xe8cd('0x18')],_0x2d36ea[_0xe8cd('0x16')]));_0x55f147['traverseBFS'](_0x33c0d3[_0xe8cd('0x4a')]['id'],function(_0x1abccd){try{_0x1abccd=_0x40d570['clear'](_0x1abccd);logger[_0xe8cd('0x2f')]('vertex',JSON[_0xe8cd('0x31')](_0x1abccd,null,0x2));if(_0x1abccd&&_0x40d570[_0x1abccd[_0xe8cd('0x1e')]]){_0x199401=_0x40d570[_0x1abccd['agicommand']](_0x1abccd);if(_0x199401){logger[_0xe8cd('0x2f')](_0xe8cd('0x45'),getLogFromObject(_0x199401));return _[_0xe8cd('0x47')](_0x199401[_0xe8cd('0x48')])?null:_0x199401[_0xe8cd('0x48')][_0xe8cd('0x4c')]();}else{logger[_0xe8cd('0x8')](_0xe8cd('0x45'),getLogFromObject(_0x199401));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4db058){logger[_0xe8cd('0x8')](_0x4db058[_0xe8cd('0x10')]);return null;}});}logger[_0xe8cd('0x11')](util['format'](_0xe8cd('0x4d'),_0x2d36ea['arg_1'],_0x2d36ea[_0xe8cd('0x14')],_0x2d36ea[_0xe8cd('0x15')],_0x2d36ea[_0xe8cd('0x18')],_0x2d36ea[_0xe8cd('0x16')]));logger['info'](util[_0xe8cd('0x9')](_0xe8cd('0x4e'),_0x2d36ea[_0xe8cd('0x41')],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea['priority'],0xa)+0x1));_0x2d36ea[_0xe8cd('0x4f')](_0x2d36ea['context'],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea[_0xe8cd('0x43')],0xa)+0x1);_0x2d36ea[_0xe8cd('0x33')]();}}else{logger['error'](util[_0xe8cd('0x9')](_0xe8cd('0x50'),_0x2d36ea[_0xe8cd('0x13')]));_0x2d36ea[_0xe8cd('0x4f')](_0x2d36ea[_0xe8cd('0x41')],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea[_0xe8cd('0x43')],0xa)+0x1);_0x2d36ea[_0xe8cd('0x33')]();}}else{logger[_0xe8cd('0x8')](util[_0xe8cd('0x9')](_0xe8cd('0x51'),_0x2d36ea[_0xe8cd('0x13')]));_0x2d36ea[_0xe8cd('0x4f')](_0x2d36ea[_0xe8cd('0x41')],_0x2d36ea[_0xe8cd('0x42')],parseInt(_0x2d36ea['priority'],0xa)+0x1);_0x2d36ea[_0xe8cd('0x33')]();}}function main(){var _0x51492c;return utilLicense[_0xe8cd('0x52')]()[_0xe8cd('0x2a')](function(_0x50785a){if(_0x50785a){if(_0x50785a[_0xe8cd('0x53')]){if(_0x50785a[_0xe8cd('0x54')]&&_0x50785a['callysquare']>0x0){logger[_0xe8cd('0x11')](util['format'](_0xe8cd('0x55'),_0x50785a[_0xe8cd('0x54')]));_0x51492c=_0x50785a['callysquare'];}else{logger[_0xe8cd('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xe8cd('0x11')](_0xe8cd('0x56'));_0x51492c=-0x1;}}})[_0xe8cd('0x2b')](function(_0xb2354e){logger[_0xe8cd('0x8')]('[LICENSE]',_0xb2354e[_0xe8cd('0x10')]);})['finally'](function(){var _0x588c50=require(_0xe8cd('0x57'))(config[_0xe8cd('0x2')]['port'],config[_0xe8cd('0x2')]['ip'],_0x51492c);_0x588c50['on'](_0xe8cd('0x8'),errorHandler);_0x588c50['on'](_0xe8cd('0x58'),listeningHandler);_0x588c50['on'](_0xe8cd('0x59'),connectionHandler);_0x588c50['on'](_0xe8cd('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0x18c9=['SQUAREROOT','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','start','clear','vertex','VERTEX','context','extension','priority','vresponse','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','[%s]\x20%s','[ERROR]\x20%s','uniqueid','arg_1','calleridname','dnid','toJson','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','indexOf','agi_','substring','stringify','callerid','close','timeout','hangup','sync','production'];(function(_0x283e4d,_0xd4043c){var _0x3ee73a=function(_0x3aaaaa){while(--_0x3aaaaa){_0x283e4d['push'](_0x283e4d['shift']());}};_0x3ee73a(++_0xd4043c);}(_0x18c9,0x13c));var _0x918c=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x18c9[_0xe66cf2];return _0x2d84e7;};'use strict';var parser=require(_0x918c('0x0'));var _=require(_0x918c('0x1'));var syncho=require(_0x918c('0x2'));var util=require(_0x918c('0x3'));var moment=require(_0x918c('0x4'));var config=require(_0x918c('0x5'));var logger=require('../../config/logger')(_0x918c('0x6'));var utilLicense=require(_0x918c('0x7'));var rpc=require('./rpc');var mailRpc=require(_0x918c('0x8'));var Graph=require('./graph');var Vertices=require(_0x918c('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x918c('0x6')]=_[_0x918c('0xa')](config[_0x918c('0x6')],{'ip':_0x918c('0xb'),'port':0x11dd});function connectionHandler(_0x4ad426){process[_0x918c('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4ad426);agiHandler(_0x4ad426);}catch(_0x542f92){logger['error'](_0x542f92[_0x918c('0xd')]);}});});}function listeningHandler(){console[_0x918c('0xe')](_0x918c('0xf'),config[_0x918c('0x6')][_0x918c('0x10')]);logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x13'),config['agi']['ip'],config['agi'][_0x918c('0x10')]));}function errorHandler(_0x114f0c){if(_0x114f0c&&_0x114f0c[_0x918c('0x14')]&&_0x114f0c[_0x918c('0x15')]){logger[_0x918c('0x16')](util['format'](_0x918c('0x17'),_0x114f0c[_0x918c('0x14')],_0x114f0c[_0x918c('0x15')]));}else{logger[_0x918c('0x16')](util[_0x918c('0x12')](_0x918c('0x18'),_0x114f0c[_0x918c('0xd')]));}}function closeHandler(){logger[_0x918c('0x11')](util[_0x918c('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0x918c('0x19')]));try{createSquareReport(this);}catch(_0x54f9fa){logger[_0x918c('0x16')](_0x54f9fa[_0x918c('0xd')]);}}function timeoutHandler(){logger[_0x918c('0x11')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this[_0x918c('0x1c')],this[_0x918c('0x19')]));}function hangupHandler(){logger[_0x918c('0x11')](util[_0x918c('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x918c('0x1a')],this[_0x918c('0x1b')],this['callerid'],this['dnid'],this[_0x918c('0x19')]));this['evtHangup']=!![];}function getRoot(_0x5c27d1){return parser[_0x918c('0x1d')](_0x5c27d1,{'object':!![]})['mxGraphModel'][_0x918c('0x1e')];}function addVertex(_0xf3252,_0x4f97be,_0x3780db){_0x4f97be[_0x918c('0x1f')]=_0x3780db;if(_0x4f97be[_0x918c('0x20')](_0x918c('0x21'))){_0x4f97be['maxRetry']=parseInt(_0x4f97be[_0x918c('0x21')],0xa);}_0xf3252[_0x918c('0x22')](_[_0x918c('0x23')](_0x4f97be,_0x918c('0x24')));}function initGraph(_0x124e3d,_0xebf958){var _0x4cf95c=new Graph();for(var _0xed8db9 in _0x124e3d){if(_0x124e3d[_0x918c('0x20')](_0xed8db9)){if(_[_0x918c('0x25')](_0x124e3d[_0xed8db9])){for(var _0x11e8bf=0x0;_0x11e8bf<_0x124e3d[_0xed8db9]['length'];_0x11e8bf+=0x1){addVertex(_0x4cf95c,_0x124e3d[_0xed8db9][_0x11e8bf],_0xed8db9);}}else{addVertex(_0x4cf95c,_0x124e3d[_0xed8db9],_0xed8db9);}}}for(var _0x194e7e=0x0;_0x194e7e<_0xebf958[_0x918c('0x26')];_0x194e7e+=0x1){if(_0xebf958[_0x194e7e]['source']&&_0xebf958[_0x194e7e][_0x918c('0x27')]){_0x4cf95c[_0x918c('0x28')](_0xebf958[_0x194e7e][_0x918c('0x29')],_0xebf958[_0x194e7e][_0x918c('0x27')],_0xebf958[_0x194e7e][_0x918c('0x2a')]);}}return _0x4cf95c;}function getSquareProject(_0x2a1a7e,_0xdf5735){rpc[_0x918c('0x2b')](_0x2a1a7e)[_0x918c('0x2c')](function(_0x344bbb){_0xdf5735(null,_0x344bbb);})['catch'](function(_0x183d31){_0xdf5735(null,_0x183d31);});}function createSquareReport(_0x38c253,_0x4e7981){rpc['createSquareReport'](_0x38c253)[_0x918c('0x2c')](function(_0x2cba74){if(_0x4e7981){_0x4e7981(null,_0x2cba74);}})[_0x918c('0x2d')](function(_0x4ba726){if(_0x4e7981){_0x4e7981(null,_0x4ba726);}});}function setChannelVariables(_0x1c9341){for(var _0x551f56 in _0x1c9341){if(_0x1c9341[_0x918c('0x20')](_0x551f56)){if(_0x551f56[_0x918c('0x2e')](_0x918c('0x2f'))===0x0){_0x1c9341[_0x551f56[_0x918c('0x30')](0x4)]=_0x1c9341[_0x551f56];delete _0x1c9341[_0x551f56];}}}}function getLogFromObject(_0x1476cb){return util['inspect'](_0x1476cb,{'showHidden':![],'depth':null});}function agiHandler(_0x18b46a){var _0x593c0e,_0x46555a,_0x132ccd,_0x90222e,_0x1cff82;logger['debug']('variables',JSON[_0x918c('0x31')](_0x18b46a,null,0x2));logger['info'](util[_0x918c('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18b46a['arg_1'],_0x18b46a[_0x918c('0x1b')],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a['uniqueid']));_0x18b46a['on']('error',errorHandler);_0x18b46a['on'](_0x918c('0x33'),closeHandler);_0x18b46a['on'](_0x918c('0x34'),timeoutHandler);_0x18b46a['evtHangup']=![];_0x18b46a['on'](_0x918c('0x35'),hangupHandler);var _0x1f10a3=getSquareProject[_0x918c('0x36')](null,_0x18b46a[_0x918c('0x1a')]);if(_0x1f10a3){if(_0x1f10a3[_0x918c('0x37')]){_0x593c0e=getRoot(_0x1f10a3['production']);console[_0x918c('0xe')](_0x918c('0x38'),_0x593c0e);if(_0x593c0e&&_0x593c0e['start']){logger[_0x918c('0x39')]('root',JSON[_0x918c('0x31')](_0x593c0e,null,0x2));_0x18b46a[_0x918c('0x3a')]=moment()['format'](_0x918c('0x3b'));_0x46555a=initGraph(_[_0x918c('0x23')](_0x593c0e,_0x918c('0x24')),_0x593c0e[_0x918c('0x24')]);_0x132ccd=new Vertices(_0x18b46a,rpc,mailRpc);console[_0x918c('0xe')](_0x918c('0x3c'),_0x132ccd);logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x3d'),_0x18b46a[_0x918c('0x1a')],_0x18b46a['calleridname'],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a[_0x918c('0x19')]));console[_0x918c('0xe')](_0x918c('0x3e'));_0x46555a['traverseBFS'](_0x593c0e[_0x918c('0x3f')]['id'],function(_0x3b39e2){try{_0x3b39e2=_0x132ccd[_0x918c('0x40')](_0x3b39e2);logger[_0x918c('0x39')](_0x918c('0x41'),JSON['stringify'](_0x3b39e2,null,0x2));console[_0x918c('0xe')](_0x918c('0x42'),_0x3b39e2);if(_0x3b39e2[_0x918c('0x1f')]==='gotoc'){logger[_0x918c('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x18b46a[_0x918c('0x43')]=_0x3b39e2[_0x918c('0x43')]||_0x18b46a[_0x918c('0x43')];_0x18b46a[_0x918c('0x44')]=_0x3b39e2['extension'];_0x18b46a[_0x918c('0x45')]=_0x3b39e2[_0x918c('0x45')]?_0x3b39e2[_0x918c('0x45')]-0x1:0x1;return null;}else if(_0x3b39e2&&_0x132ccd[_0x3b39e2[_0x918c('0x1f')]]){_0x1cff82=_0x132ccd[_0x3b39e2['agicommand']](_0x3b39e2);console[_0x918c('0xe')](_0x918c('0x46'),_0x1cff82);logger[_0x918c('0x11')]('response',JSON[_0x918c('0x31')](_0x1cff82,null,0x2));if(_0x1cff82&&_0x1cff82['code']===AGI_CODE_SUCCESS&&_0x1cff82[_0x918c('0x47')]!==AGI_RESULT_ERROR&&!_0x18b46a[_0x918c('0x48')]){logger[_0x918c('0x39')](_0x918c('0x49'),getLogFromObject(_0x1cff82));return _[_0x918c('0x4a')](_0x1cff82[_0x918c('0x47')])?null:_0x1cff82[_0x918c('0x47')][_0x918c('0x4b')]();}else{logger[_0x918c('0x16')]('response',getLogFromObject(_0x1cff82));return null;}}else{logger[_0x918c('0x16')](_0x918c('0x4c'));return null;}}catch(_0x3d363f){logger[_0x918c('0x16')](_0x3d363f[_0x918c('0xd')]);return null;}});if(_0x593c0e[_0x918c('0x4d')]){logger['info'](util[_0x918c('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18b46a[_0x918c('0x1a')],_0x18b46a[_0x918c('0x1b')],_0x18b46a[_0x918c('0x32')],_0x18b46a[_0x918c('0x1c')],_0x18b46a[_0x918c('0x19')]));_0x46555a[_0x918c('0x4e')](_0x593c0e[_0x918c('0x4d')]['id'],function(_0x23bc40){try{_0x23bc40=_0x132ccd[_0x918c('0x40')](_0x23bc40);logger[_0x918c('0x39')]('vertex',JSON[_0x918c('0x31')](_0x23bc40,null,0x2));if(_0x23bc40&&_0x132ccd[_0x23bc40[_0x918c('0x1f')]]){_0x1cff82=_0x132ccd[_0x23bc40['agicommand']](_0x23bc40);if(_0x1cff82){logger[_0x918c('0x39')](_0x918c('0x49'),getLogFromObject(_0x1cff82));return _[_0x918c('0x4a')](_0x1cff82[_0x918c('0x47')])?null:_0x1cff82[_0x918c('0x47')]['toString']();}else{logger['error'](_0x918c('0x49'),getLogFromObject(_0x1cff82));return null;}}else{logger[_0x918c('0x16')](_0x918c('0x4c'));return null;}}catch(_0x44a0de){logger['error'](_0x44a0de[_0x918c('0xd')]);return null;}});}logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x4f'),_0x18b46a['arg_1'],_0x18b46a[_0x918c('0x1b')],_0x18b46a['callerid'],_0x18b46a['dnid'],_0x18b46a[_0x918c('0x19')]));logger['info'](util[_0x918c('0x12')](_0x918c('0x50'),_0x18b46a['context'],_0x18b46a['extension'],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1));_0x18b46a['continueAt'](_0x18b46a[_0x918c('0x43')],_0x18b46a['extension'],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}else{logger[_0x918c('0x16')](util[_0x918c('0x12')]('Project\x20%s\x20not\x20published',_0x18b46a[_0x918c('0x1a')]));_0x18b46a[_0x918c('0x51')](_0x18b46a['context'],_0x18b46a[_0x918c('0x44')],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}else{logger[_0x918c('0x16')](util['format'](_0x918c('0x52'),_0x18b46a[_0x918c('0x1a')]));_0x18b46a[_0x918c('0x51')](_0x18b46a[_0x918c('0x43')],_0x18b46a[_0x918c('0x44')],parseInt(_0x18b46a[_0x918c('0x45')],0xa)+0x1);_0x18b46a[_0x918c('0x33')]();}}function main(){var _0x1d194f;return utilLicense[_0x918c('0x53')]()['then'](function(_0x291eb0){if(_0x291eb0){if(_0x291eb0[_0x918c('0x54')]){if(_0x291eb0[_0x918c('0x55')]&&_0x291eb0['callysquare']>0x0){logger[_0x918c('0x11')](util[_0x918c('0x12')](_0x918c('0x56'),_0x291eb0[_0x918c('0x55')]));_0x1d194f=_0x291eb0[_0x918c('0x55')];}else{logger[_0x918c('0x11')](_0x918c('0x57'));}}else{logger['info'](_0x918c('0x58'));_0x1d194f=-0x1;}}})['catch'](function(_0x50fdda){logger[_0x918c('0x16')](_0x918c('0x59'),_0x50fdda[_0x918c('0xd')]);})['finally'](function(){var _0x190c3e=require(_0x918c('0x5a'))(config['agi'][_0x918c('0x10')],config[_0x918c('0x6')]['ip'],_0x1d194f);_0x190c3e['on']('error',errorHandler);_0x190c3e['on'](_0x918c('0x5b'),listeningHandler);_0x190c3e['on'](_0x918c('0x5c'),connectionHandler);_0x190c3e['on'](_0x918c('0x33'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 1422b58..cd7905f 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(_0x5db3dd,_0x15091a){var _0x3f20bf=function(_0x543b48){while(--_0x543b48){_0x5db3dd['push'](_0x5db3dd['shift']());}};_0x3f20bf(++_0x15091a);}(_0x814b,0x1a2));var _0xb814=function(_0x250f95,_0x5a5728){_0x250f95=_0x250f95-0x0;var _0x4ada97=_0x814b[_0x250f95];return _0x4ada97;};'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(_0x4e0c5e,_0x47612a){var _0xf3627a=function(_0x309bff){while(--_0x309bff){_0x4e0c5e['push'](_0x4e0c5e['shift']());}};_0xf3627a(++_0x47612a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d19f664..6d4c809 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x299d67,_0x52c048){var _0xb8027b=function(_0x47543d){while(--_0x47543d){_0x299d67['push'](_0x299d67['shift']());}};_0xb8027b(++_0x52c048);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e0ce0,_0x1f23eb){_0x2e0ce0=_0x2e0ce0-0x0;var _0x2f3dd7=_0x5f2f[_0x2e0ce0];return _0x2f3dd7;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x167281,_0x1cbdcf){var _0x175151=function(_0x46229d){while(--_0x46229d){_0x167281['push'](_0x167281['shift']());}};_0x175151(++_0x1cbdcf);}(_0x7a54,0x106));var _0x47a5=function(_0x294d3b,_0x497e61){_0x294d3b=_0x294d3b-0x0;var _0x3dcc8e=_0x7a54[_0x294d3b];return _0x3dcc8e;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index a23ed0e..b8909ae 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 _0x7825=['createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','util','jayson/promise','client','then','error','message','catch','getSquareProject','getMailAccountById','MailServerOut','Smtp','name','email','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage'];(function(_0x6ece45,_0x296347){var _0x410be4=function(_0x3d0314){while(--_0x3d0314){_0x6ece45['push'](_0x6ece45['shift']());}};_0x410be4(++_0x296347);}(_0x7825,0x7a));var _0x5782=function(_0x30eab3,_0x5abc1c){_0x30eab3=_0x30eab3-0x0;var _0x1ef923=_0x7825[_0x30eab3];return _0x1ef923;};'use strict';var BPromise=require(_0x5782('0x0'));var moment=require(_0x5782('0x1'));var _=require('lodash');var util=require(_0x5782('0x2'));var jayson=require(_0x5782('0x3'));var client=jayson[_0x5782('0x4')]['http']({'port':0x2329});function request(_0x56d935,_0x2da41e){return new BPromise(function(_0x44a639,_0x4c51b6){return client['request'](_0x56d935,_0x2da41e)[_0x5782('0x5')](function(_0x37293c){if(_0x37293c['error']){return _0x4c51b6(_0x37293c[_0x5782('0x6')][_0x5782('0x7')]);}else{return _0x44a639(_0x37293c['result']);}})[_0x5782('0x8')](function(_0x16a95e){return _0x4c51b6(_0x16a95e);});});}exports[_0x5782('0x9')]=function(_0x265476){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x265476},'attributes':['production']}});};exports[_0x5782('0xa')]=function(_0x2071b8){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2071b8},'include':[{'model':_0x5782('0xb'),'as':_0x5782('0xc')}],'attributes':['id',_0x5782('0xd'),_0x5782('0xe')]}});};exports['getSquareProjectById']=function(_0x4b5c06){return request(_0x5782('0xf'),{'options':{'where':{'id':_0x4b5c06},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0xd3eaa4){return request(_0x5782('0x10'),{'options':{'where':{'id':_0xd3eaa4},'attributes':['name']}});};exports[_0x5782('0x11')]=function(_0x43ac44){return request(_0x5782('0x12'),{'options':{'where':{'id':_0x43ac44},'attributes':[_0x5782('0xd')]}});};exports['getSquareOdbcById']=function(_0x118138){return request(_0x5782('0x13'),{'options':{'where':{'id':_0x118138},'attributes':[_0x5782('0x14')]}});};exports['getUserById']=function(_0x339532){return request(_0x5782('0x15'),{'options':{'where':{'id':_0x339532},'attributes':[_0x5782('0xd')]}});};exports[_0x5782('0x16')]=function(_0x36783d){console['log']('rpcreq',_0x36783d);return request('GetContactByPhone',{'options':{'where':{'phone':_0x36783d},'attributes':['id']}});};exports[_0x5782('0x17')]=function(_0x1385e4){return request('ShowTrunk',{'options':{'where':{'id':_0x1385e4},'attributes':['name']}});};exports[_0x5782('0x18')]=function(_0x220222){return request('ShowSound',{'options':{'where':{'id':_0x220222},'attributes':[_0x5782('0x19')]}});};exports[_0x5782('0x1a')]=function(_0x65a4eb){return request(_0x5782('0x1b'),{'options':{'raw':![],'where':{'id':_0x65a4eb},'include':[{'model':_0x5782('0x1c'),'as':_0x5782('0x1d')}]}});};exports['getSmsAccountById']=function(_0x4cbf17){return request(_0x5782('0x1e'),{'options':{'where':{'id':_0x4cbf17},'attributes':['id',_0x5782('0xd')]}});};exports[_0x5782('0x1f')]=function(_0x192947){return request(_0x5782('0x20'),{'body':_0x192947});};exports['createSquareDetailsReport']=function(_0x537d3e){return request('CreateSquareDetailsReport',{'body':_0x537d3e});};exports['createSquareReport']=function(_0x3eb771){return request(_0x5782('0x21'),{'body':_[_0x5782('0x22')](_0x3eb771,{'project_name':_0x3eb771[_0x5782('0x23')],'prev_project_name':_0x3eb771[_0x5782('0x24')]||'','is_subproject':_0x3eb771[_0x5782('0x24')]?!![]:![],'leaveAt':moment()[_0x5782('0x25')](_0x5782('0x26'))})});};exports[_0x5782('0x27')]=function(_0x4b8717){return request(_0x5782('0x28'),{'body':_0x4b8717});};exports[_0x5782('0x29')]=function(_0x3a36d4){return request(_0x5782('0x2a'),{'body':_0x3a36d4});};exports[_0x5782('0x2b')]=function(_0x3fa959){return request(_0x5782('0x2c'),{'options':{'raw':![],'where':{'phone':_0x3fa959['phone'],'ListId':_0x3fa959[_0x5782('0x2d')]}}})[_0x5782('0x5')](function(_0x486a7f){if(_0x486a7f){return _0x486a7f;}return request(_0x5782('0x2e'),{'body':_0x3fa959});});};exports[_0x5782('0x2f')]=function(_0x2ecb4f){return request(_0x5782('0x30'),{'options':{'where':{'id':_0x2ecb4f},'attributes':[_0x5782('0xd')]}});};exports['agentLogin']=function(_0xf574f2,_0x38ae0e){return request(_0x5782('0x31'),{'body':{'interface':_0x38ae0e},'options':{'where':_0xf574f2}});};exports[_0x5782('0x32')]=function(_0x5d750b,_0x465f72,_0x22a49e){return request(_0x5782('0x33'),{'body':{'type':_0x465f72,'uniqueid':_0x22a49e},'options':{'where':_0x5d750b}});};exports[_0x5782('0x34')]=function(_0x4c5544){return request(_0x5782('0x35'),{'body':{},'options':{'where':_0x4c5544}});};exports[_0x5782('0x36')]=function(_0x4b187c){return request('LogoutUser',{'body':{},'options':{'where':_0x4b187c}});}; \ No newline at end of file +var _0xe2de=['Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','rpcreq','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','ShowInterval'];(function(_0x5f3aba,_0x2bcab7){var _0x3aafec=function(_0x294123){while(--_0x294123){_0x5f3aba['push'](_0x5f3aba['shift']());}};_0x3aafec(++_0x2bcab7);}(_0xe2de,0xd2));var _0xee2d=function(_0x44cca4,_0x1c0550){_0x44cca4=_0x44cca4-0x0;var _0x46c0d6=_0xe2de[_0x44cca4];return _0x46c0d6;};'use strict';var BPromise=require(_0xee2d('0x0'));var moment=require(_0xee2d('0x1'));var _=require(_0xee2d('0x2'));var util=require(_0xee2d('0x3'));var jayson=require(_0xee2d('0x4'));var client=jayson[_0xee2d('0x5')][_0xee2d('0x6')]({'port':0x2329});function request(_0x23a425,_0x47004b){return new BPromise(function(_0x1a8ca4,_0x1844a2){return client[_0xee2d('0x7')](_0x23a425,_0x47004b)[_0xee2d('0x8')](function(_0x374ded){if(_0x374ded[_0xee2d('0x9')]){return _0x1844a2(_0x374ded[_0xee2d('0x9')]['message']);}else{return _0x1a8ca4(_0x374ded['result']);}})[_0xee2d('0xa')](function(_0x31101d){return _0x1844a2(_0x31101d);});});}exports[_0xee2d('0xb')]=function(_0x273d50){return request(_0xee2d('0xc'),{'options':{'raw':![],'where':{'name':_0x273d50},'attributes':[_0xee2d('0xd')]}});};exports['getMailAccountById']=function(_0x3f9c19){return request(_0xee2d('0xe'),{'options':{'raw':![],'where':{'id':_0x3f9c19},'include':[{'model':_0xee2d('0xf'),'as':_0xee2d('0x10')}],'attributes':['id',_0xee2d('0x11'),_0xee2d('0x12')]}});};exports[_0xee2d('0x13')]=function(_0x50cf55){return request('ShowSquareProject',{'options':{'where':{'id':_0x50cf55},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x525469){return request(_0xee2d('0x14'),{'options':{'where':{'id':_0x525469},'attributes':['name']}});};exports[_0xee2d('0x15')]=function(_0x63cd50){return request(_0xee2d('0x16'),{'options':{'where':{'id':_0x63cd50},'attributes':[_0xee2d('0x11')]}});};exports['getSquareOdbcById']=function(_0x20e444){return request(_0xee2d('0x17'),{'options':{'where':{'id':_0x20e444},'attributes':[_0xee2d('0x18')]}});};exports[_0xee2d('0x19')]=function(_0xfccb0){return request(_0xee2d('0x1a'),{'options':{'where':{'id':_0xfccb0},'attributes':['name']}});};exports[_0xee2d('0x1b')]=function(_0x542ef0){console['log'](_0xee2d('0x1c'),_0x542ef0);return request(_0xee2d('0x1d'),{'options':{'where':{'phone':_0x542ef0},'attributes':['id']}});};exports[_0xee2d('0x1e')]=function(_0x3b7798){return request(_0xee2d('0x1f'),{'options':{'where':{'id':_0x3b7798},'attributes':[_0xee2d('0x11')]}});};exports['getSoundById']=function(_0x264cc4){return request(_0xee2d('0x20'),{'options':{'where':{'id':_0x264cc4},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x4ec9ee){return request(_0xee2d('0x21'),{'options':{'raw':![],'where':{'id':_0x4ec9ee},'include':[{'model':_0xee2d('0x22'),'as':_0xee2d('0x23')}]}});};exports[_0xee2d('0x24')]=function(_0x5a7669){return request(_0xee2d('0x25'),{'options':{'where':{'id':_0x5a7669},'attributes':['id',_0xee2d('0x11')]}});};exports[_0xee2d('0x26')]=function(_0x5d1c24){return request('CreateSmsMessage',{'body':_0x5d1c24});};exports[_0xee2d('0x27')]=function(_0x5e2321){return request('CreateSquareDetailsReport',{'body':_0x5e2321});};exports[_0xee2d('0x28')]=function(_0x13078a){return request(_0xee2d('0x29'),{'body':_[_0xee2d('0x2a')](_0x13078a,{'project_name':_0x13078a[_0xee2d('0x2b')],'prev_project_name':_0x13078a[_0xee2d('0x2c')]||'','is_subproject':_0x13078a[_0xee2d('0x2c')]?!![]:![],'leaveAt':moment()[_0xee2d('0x2d')](_0xee2d('0x2e'))})});};exports['createSquareRecording']=function(_0x5c4123){return request('CreateSquareRecording',{'body':_0x5c4123});};exports[_0xee2d('0x2f')]=function(_0x470e3d){return request('CreateSquareMessage',{'body':_0x470e3d});};exports[_0xee2d('0x30')]=function(_0x2f0818){return request(_0xee2d('0x31'),{'options':{'raw':![],'where':{'phone':_0x2f0818[_0xee2d('0x32')],'ListId':_0x2f0818[_0xee2d('0x33')]}}})[_0xee2d('0x8')](function(_0x3fc6c5){if(_0x3fc6c5){return _0x3fc6c5;}return request(_0xee2d('0x34'),{'body':_0x2f0818});});};exports[_0xee2d('0x35')]=function(_0x1a29dd){return request(_0xee2d('0x36'),{'options':{'where':{'id':_0x1a29dd},'attributes':[_0xee2d('0x11')]}});};exports[_0xee2d('0x37')]=function(_0x50ebcf,_0x5e77b8){return request(_0xee2d('0x38'),{'body':{'interface':_0x5e77b8},'options':{'where':_0x50ebcf}});};exports[_0xee2d('0x39')]=function(_0x49f2e7,_0x20f4e6,_0x238493){return request(_0xee2d('0x3a'),{'body':{'type':_0x20f4e6,'uniqueid':_0x238493},'options':{'where':_0x49f2e7}});};exports[_0xee2d('0x3b')]=function(_0x4af5b2){return request('UnpauseUser',{'body':{},'options':{'where':_0x4af5b2}});};exports['agentLogout']=function(_0x34f837){return request(_0xee2d('0x3c'),{'body':{},'options':{'where':_0x34f837}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index ad6ccc1..0582df3 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 _0x9f62=['./lex'];(function(_0x170a36,_0x3894aa){var _0x8fcff1=function(_0x3c3ebd){while(--_0x3c3ebd){_0x170a36['push'](_0x170a36['shift']());}};_0x8fcff1(++_0x3894aa);}(_0x9f62,0x154));var _0x29f6=function(_0x158bf9,_0x2a2731){_0x158bf9=_0x158bf9-0x0;var _0x2baad0=_0x9f62[_0x158bf9];return _0x2baad0;};var polly=require('./polly');var lex=require(_0x29f6('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x222f=['./polly','./lex','exports'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x222f,0x1a4));var _0xf222=function(_0x2a3d50,_0x516d5f){_0x2a3d50=_0x2a3d50-0x0;var _0x41861b=_0x222f[_0x2a3d50];return _0x41861b;};var polly=require(_0xf222('0x0'));var lex=require(_0xf222('0x1'));module[_0xf222('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5d9137c..31707e6 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ No newline at end of file +var _0xbb95=['exports','./lib/api'];(function(_0x5b5251,_0x24f556){var _0x5768d1=function(_0x3969e4){while(--_0x3969e4){_0x5b5251['push'](_0x5b5251['shift']());}};_0x5768d1(++_0x24f556);}(_0xbb95,0x7f));var _0x5bb9=function(_0x4e441e,_0x48f13e){_0x4e441e=_0x4e441e-0x0;var _0x2add8e=_0xbb95[_0x4e441e];return _0x2add8e;};'use strict';var lex=require(_0x5bb9('0x0'));module[_0x5bb9('0x1')]=function(_0x4d775a,_0x53e718,_0x15492a,_0x2a9386,_0x535716,_0xbb4ae9){return lex(_0x4d775a,_0x53e718,_0x15492a,_0x2a9386,_0x535716,_0xbb4ae9);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 695fe45..f84b79b 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 _0xb563=['bluebird','aws-sdk','slots','exports','$LATEST'];(function(_0xbf3f20,_0x5bf459){var _0x4b8870=function(_0x59962d){while(--_0x59962d){_0xbf3f20['push'](_0xbf3f20['shift']());}};_0x4b8870(++_0x5bf459);}(_0xb563,0xb4));var _0x3b56=function(_0x42664d,_0x2b17fa){_0x42664d=_0x42664d-0x0;var _0x18688c=_0xb563[_0x42664d];return _0x18688c;};'use strict';var BPromise=require(_0x3b56('0x0'));var AWS=require(_0x3b56('0x1'));function lexResult(_0x38184e,_0x3a87f0){return new BPromise(function(_0x358915,_0x5953ab){_0x38184e['postText'](_0x3a87f0,function(_0x4de2fb,_0x194d9e){if(_0x4de2fb){_0x5953ab(_0x4de2fb);}if(_0x194d9e[_0x3b56('0x2')]){for(const _0x58d29b in _0x194d9e[_0x3b56('0x2')]){if(_0x194d9e[_0x3b56('0x2')]['hasOwnProperty'](_0x58d29b)){var _0x123ca0=_0x194d9e['slots'][_0x58d29b];_0x194d9e['slot_'+_0x58d29b]=_0x123ca0;}}}_0x358915(_0x194d9e);});});}module[_0x3b56('0x3')]=function(_0x3c01da,_0x182769,_0x54938b,_0x2b7010,_0x5968d7,_0x707be){var _0x154013=new AWS['LexRuntime']({'accessKeyId':_0x182769,'secretAccessKey':_0x54938b,'region':_0x2b7010});var _0x570c0c={'botAlias':_0x3b56('0x4'),'botName':_0x707be,'inputText':_0x5968d7,'userId':_0x3c01da};return lexResult(_0x154013,_0x570c0c);}; \ No newline at end of file +var _0x493d=['bluebird','aws-sdk','postText','slots','exports','LexRuntime','$LATEST'];(function(_0x223c84,_0x87fe63){var _0x29108a=function(_0x4c85ef){while(--_0x4c85ef){_0x223c84['push'](_0x223c84['shift']());}};_0x29108a(++_0x87fe63);}(_0x493d,0x93));var _0xd493=function(_0x12d5e9,_0x1decd6){_0x12d5e9=_0x12d5e9-0x0;var _0x343939=_0x493d[_0x12d5e9];return _0x343939;};'use strict';var BPromise=require(_0xd493('0x0'));var AWS=require(_0xd493('0x1'));function lexResult(_0x38635c,_0x46bf0c){return new BPromise(function(_0x2eca7c,_0x1121ba){_0x38635c[_0xd493('0x2')](_0x46bf0c,function(_0x755c83,_0x277056){if(_0x755c83){_0x1121ba(_0x755c83);}if(_0x277056[_0xd493('0x3')]){for(const _0x4c5b5a in _0x277056[_0xd493('0x3')]){if(_0x277056[_0xd493('0x3')]['hasOwnProperty'](_0x4c5b5a)){var _0x2d1393=_0x277056[_0xd493('0x3')][_0x4c5b5a];_0x277056['slot_'+_0x4c5b5a]=_0x2d1393;}}}_0x2eca7c(_0x277056);});});}module[_0xd493('0x4')]=function(_0x16b8d4,_0x2c52f1,_0x578a66,_0x5c8a8f,_0x16013b,_0x1595f0){var _0x3b5afc=new AWS[(_0xd493('0x5'))]({'accessKeyId':_0x2c52f1,'secretAccessKey':_0x578a66,'region':_0x5c8a8f});var _0x503749={'botAlias':_0xd493('0x6'),'botName':_0x1595f0,'inputText':_0x16013b,'userId':_0x16b8d4};return lexResult(_0x3b5afc,_0x503749);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 52e9ad9..c2c7b4b 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 _0x7923=['./lib/api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7923,0x184));var _0x3792=function(_0x31c2e,_0x127193){_0x31c2e=_0x31c2e-0x0;var _0x6f6873=_0x7923[_0x31c2e];return _0x6f6873;};'use strict';var polly=require(_0x3792('0x0'));module['exports']=function(_0x54ca58,_0x1ba2b4,_0x539863,_0x1e1c05,_0x5eb82a,_0x18b3a5,_0x477028){return polly(_0x54ca58,_0x1ba2b4,_0x539863,_0x1e1c05,_0x5eb82a,_0x18b3a5,_0x477028);}; \ No newline at end of file +var _0xedc3=['exports'];(function(_0x427bd6,_0x5d0a2b){var _0x2a88b9=function(_0x3cb8d8){while(--_0x3cb8d8){_0x427bd6['push'](_0x427bd6['shift']());}};_0x2a88b9(++_0x5d0a2b);}(_0xedc3,0xdb));var _0x3edc=function(_0x34886e,_0x3184b0){_0x34886e=_0x34886e-0x0;var _0x2f03e0=_0xedc3[_0x34886e];return _0x2f03e0;};'use strict';var polly=require('./lib/api');module[_0x3edc('0x0')]=function(_0x2250ad,_0x96e26f,_0x153674,_0x549635,_0xd515f,_0x35905f,_0x31021b){return polly(_0x2250ad,_0x96e26f,_0x153674,_0x549635,_0xd515f,_0x35905f,_0x31021b);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 04a98b2..f7af1c7 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 _0x4734=['aws-sdk','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','path','randomstring'];(function(_0xf1998e,_0x277f5){var _0x4c91c1=function(_0x53de13){while(--_0x53de13){_0xf1998e['push'](_0xf1998e['shift']());}};_0x4c91c1(++_0x277f5);}(_0x4734,0x106));var _0x4473=function(_0x167c4e,_0x5b60d7){_0x167c4e=_0x167c4e-0x0;var _0x3ed21d=_0x4734[_0x167c4e];return _0x3ed21d;};'use strict';var fs=require('fs');var path=require(_0x4473('0x0'));var BPromise=require('bluebird');var rs=require(_0x4473('0x1'));var AWS=require(_0x4473('0x2'));function pollyResult(_0x190ea7,_0x443472,_0x3adfc0){return new BPromise(function(_0x7e118a,_0x7c884f){_0x190ea7[_0x4473('0x3')](_0x443472,function(_0x1c4703,_0x966f60){if(_0x1c4703){_0x7c884f(_0x1c4703);}else if(_0x966f60){if(_0x966f60['AudioStream']instanceof Buffer){fs['writeFile'](_0x3adfc0,_0x966f60[_0x4473('0x4')],function(_0x20af35){if(_0x20af35){_0x7c884f(_0x20af35);}else{_0x7e118a();}});}else{_0x7c884f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x7c884f(new Error(_0x4473('0x5')));}});});}module[_0x4473('0x6')]=function(_0xffb90c,_0x13c4d7,_0x5bd7cd,_0x375833,_0xb261f,_0x2be6ac,_0x46d61d){var _0x2234ff=new AWS['Polly']({'accessKeyId':_0xffb90c,'secretAccessKey':_0x13c4d7,'region':_0x5bd7cd});var _0x4ecb64={'Text':_0xb261f,'TextType':_0x2be6ac||_0x4473('0x7'),'OutputFormat':'mp3','VoiceId':_0x375833};return pollyResult(_0x2234ff,_0x4ecb64,_0x46d61d);}; \ No newline at end of file +var _0xe675=['text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x4c2181,_0x3bc6c8){var _0x5e0f7b=function(_0x1b81aa){while(--_0x1b81aa){_0x4c2181['push'](_0x4c2181['shift']());}};_0x5e0f7b(++_0x3bc6c8);}(_0xe675,0x19c));var _0x5e67=function(_0x307b61,_0x3f3445){_0x307b61=_0x307b61-0x0;var _0x367866=_0xe675[_0x307b61];return _0x367866;};'use strict';var fs=require('fs');var path=require(_0x5e67('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e67('0x1'));var AWS=require(_0x5e67('0x2'));function pollyResult(_0x4afe86,_0x48586e,_0x4cb378){return new BPromise(function(_0x288b62,_0x24bfc6){_0x4afe86[_0x5e67('0x3')](_0x48586e,function(_0x1b65fd,_0x24f98c){if(_0x1b65fd){_0x24bfc6(_0x1b65fd);}else if(_0x24f98c){if(_0x24f98c[_0x5e67('0x4')]instanceof Buffer){fs[_0x5e67('0x5')](_0x4cb378,_0x24f98c[_0x5e67('0x4')],function(_0x556ebe){if(_0x556ebe){_0x24bfc6(_0x556ebe);}else{_0x288b62();}});}else{_0x24bfc6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x24bfc6(new Error(_0x5e67('0x6')));}});});}module[_0x5e67('0x7')]=function(_0x137612,_0x2df7c4,_0x8153a6,_0x7add2d,_0x1ce9bd,_0x26327b,_0x1dd7cb){var _0x491b4e=new AWS['Polly']({'accessKeyId':_0x137612,'secretAccessKey':_0x2df7c4,'region':_0x8153a6});var _0xba7c63={'Text':_0x1ce9bd,'TextType':_0x26327b||_0x5e67('0x8'),'OutputFormat':_0x5e67('0x9'),'VoiceId':_0x7add2d};return pollyResult(_0x491b4e,_0xba7c63,_0x1dd7cb);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 9bb4942..90a28a7 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 _0x76f9=['./lib/api'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x76f9,0x1c1));var _0x976f=function(_0x410e82,_0x51d5eb){_0x410e82=_0x410e82-0x0;var _0xa04bb6=_0x76f9[_0x410e82];return _0xa04bb6;};'use strict';var asr=require(_0x976f('0x0'));module['exports']=function(_0x527312,_0x3e0b41,_0x17b782,_0x59e092){return asr(_0x527312,_0x3e0b41,_0x17b782);}; \ No newline at end of file +var _0xd029=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd029,0x99));var _0x9d02=function(_0x2e254c,_0x4dada0){_0x2e254c=_0x2e254c-0x0;var _0x579ab3=_0xd029[_0x2e254c];return _0x579ab3;};'use strict';var asr=require(_0x9d02('0x0'));module['exports']=function(_0x8f60df,_0x213509,_0x239229,_0x15f922){return asr(_0x8f60df,_0x213509,_0x239229);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 3ea7f06..b48be62 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 _0xdf1a=['key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','8000','url','https://speech.googleapis.com','exports','string','length'];(function(_0x4e753f,_0x17dbd7){var _0x3ec076=function(_0x169a55){while(--_0x169a55){_0x4e753f['push'](_0x4e753f['shift']());}};_0x3ec076(++_0x17dbd7);}(_0xdf1a,0xeb));var _0xadf1=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xdf1a[_0x4a9beb];return _0x2d4c58;};'use strict';var url=require(_0xadf1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xadf1('0x1');module[_0xadf1('0x2')]=function(_0x8d65f9,_0x4d84d7,_0xcdcca9){return new BPromise(function(_0x2a4254,_0x1d8e26){var _0x52eaab;if(typeof _0x8d65f9!==_0xadf1('0x3')||_0x8d65f9[_0xadf1('0x4')]===0x0){return _0x1d8e26('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4d84d7!==_0xadf1('0x3')||_0x4d84d7[_0xadf1('0x4')]===0x0){return _0x1d8e26(_0xadf1('0x5'));}if(typeof _0xcdcca9!=='undefined'&&(typeof _0xcdcca9!==_0xadf1('0x3')||_0xcdcca9[_0xadf1('0x4')]===0x0)){return _0x1d8e26('lang\x20should\x20be\x20a\x20string');}try{_0x52eaab=fs[_0xadf1('0x6')](_0x8d65f9)[_0xadf1('0x7')](_0xadf1('0x8'));}catch(_0x25ca57){return _0x1d8e26(_0x25ca57);}return _0x2a4254({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x4d84d7,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xadf1('0x9'),'languageCode':_0xcdcca9},'audio':{'content':_0x52eaab}},'json':!![]});});}; \ No newline at end of file +var _0x4b04=['length','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','exports','string'];(function(_0x199b42,_0x3d19c7){var _0x3920d4=function(_0x5bca04){while(--_0x5bca04){_0x199b42['push'](_0x199b42['shift']());}};_0x3920d4(++_0x3d19c7);}(_0x4b04,0x1d6));var _0x44b0=function(_0x368fb5,_0x5bc585){_0x368fb5=_0x368fb5-0x0;var _0x495810=_0x4b04[_0x368fb5];return _0x495810;};'use strict';var url=require('url');var BPromise=require(_0x44b0('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x44b0('0x1')]=function(_0x2dca4b,_0x5c193c,_0x4ddfcd){return new BPromise(function(_0x2aa53c,_0x384dd5){var _0x141d7f;if(typeof _0x2dca4b!==_0x44b0('0x2')||_0x2dca4b['length']===0x0){return _0x384dd5('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5c193c!==_0x44b0('0x2')||_0x5c193c[_0x44b0('0x3')]===0x0){return _0x384dd5('key\x20should\x20be\x20a\x20string');}if(typeof _0x4ddfcd!=='undefined'&&(typeof _0x4ddfcd!=='string'||_0x4ddfcd[_0x44b0('0x3')]===0x0)){return _0x384dd5(_0x44b0('0x4'));}try{_0x141d7f=fs[_0x44b0('0x5')](_0x2dca4b)['toString'](_0x44b0('0x6'));}catch(_0x4a201b){return _0x384dd5(_0x4a201b);}return _0x2aa53c({'method':_0x44b0('0x7'),'uri':host+_0x44b0('0x8')+_0x5c193c,'body':{'config':{'encoding':_0x44b0('0x9'),'sampleRateHertz':_0x44b0('0xa'),'languageCode':_0x4ddfcd},'audio':{'content':_0x141d7f}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 20a7df7..5d84fdb 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 _0xe56e=['./asr'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0xe56e,0xd8));var _0xee56=function(_0x2186bc,_0x136d12){_0x2186bc=_0x2186bc-0x0;var _0x25e4d8=_0xe56e[_0x2186bc];return _0x25e4d8;};var asr=require(_0xee56('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x56d6=['./asr','exports'];(function(_0x335366,_0x24517d){var _0x52da07=function(_0x27ccae){while(--_0x27ccae){_0x335366['push'](_0x335366['shift']());}};_0x52da07(++_0x24517d);}(_0x56d6,0x18e));var _0x656d=function(_0x18065c,_0x5c7cbb){_0x18065c=_0x18065c-0x0;var _0x5c0432=_0x56d6[_0x18065c];return _0x5c0432;};var asr=require(_0x656d('0x0'));module[_0x656d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 941c224..915fd2d 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 _0x83b4=['info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','777','googleCloudTTS\x20path','split','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','stringify','source','result','resolvedQuery','action','actionIncomplete','fulfillment','status','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20confidence','awsPolly','awsLex','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','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','path','http','url','parse','bluebird','sox','request-promise','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','WHAT_EVER','data','transcode','error\x20convert'];(function(_0x4a5cb1,_0x42580d){var _0x410a2b=function(_0x426dc3){while(--_0x426dc3){_0x4a5cb1['push'](_0x4a5cb1['shift']());}};_0x410a2b(++_0x42580d);}(_0x83b4,0x11c));var _0x483b=function(_0x41dbad,_0x4c5186){_0x41dbad=_0x41dbad-0x0;var _0x52fa4e=_0x83b4[_0x41dbad];return _0x52fa4e;};'use strict';var fs=require('fs');var path=require(_0x483b('0x0'));var http=require(_0x483b('0x1'));var https=require('https');var urlParse=require(_0x483b('0x2'))[_0x483b('0x3')];var BPromise=require(_0x483b('0x4'));var rs=require('randomstring');var sox=require(_0x483b('0x5'));var rp=require(_0x483b('0x6'));var util=require('util');var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require(_0x483b('0x7'));var md5=require(_0x483b('0x8'));var google=require(_0x483b('0x9'));var aws=require(_0x483b('0xa'));var tilde=require(_0x483b('0xb'));var sestek=require(_0x483b('0xc'));var logger=require(_0x483b('0xd'))('agi');var ISPEECH_API=_0x483b('0xe');function downloadFile(_0x20772d,_0x4c0250){return new BPromise(function(_0x4f6d5f,_0x34584d){var _0x5d64ed=urlParse(_0x20772d);var _0x3c38e5=_0x5d64ed[_0x483b('0xf')]===_0x483b('0x10')?https:http;var _0x30040a={'host':_0x5d64ed['host'],'path':_0x5d64ed[_0x483b('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x3c38e5[_0x483b('0x11')](_0x30040a,function(_0x8756a4){if(_0x8756a4[_0x483b('0x12')]!==0xc8){logger[_0x483b('0x13')](_0x483b('0x14')+_0x20772d+_0x483b('0x15')+_0x8756a4[_0x483b('0x12')]+'\x20('+_0x8756a4[_0x483b('0x16')]+')');_0x34584d(new Error(_0x483b('0x14')+_0x20772d+_0x483b('0x15')+_0x8756a4[_0x483b('0x12')]+'\x20('+_0x8756a4[_0x483b('0x16')]+')'));return;}var _0x559dfe=fs[_0x483b('0x17')](_0x4c0250);_0x559dfe['on']('finish',function(){logger['info'](_0x483b('0x18'));_0x559dfe['close'](_0x4f6d5f);});_0x559dfe['on']('error',function(_0x29ac6b){fs[_0x483b('0x19')](_0x4c0250);logger[_0x483b('0x13')](_0x483b('0x1a'),_0x29ac6b);_0x34584d(_0x29ac6b);});_0x8756a4[_0x483b('0x1b')](_0x559dfe);})['on']('error',function(_0x38ff38){logger[_0x483b('0x13')](_0x38ff38);_0x34584d(_0x38ff38);})[_0x483b('0x1c')]();});}function uploadFile(_0x30042d){return new BPromise(function(_0xc27ec0,_0x47ccbb){var _0x104256=urlParse(_0x30042d);var _0x73c7f5=_0x104256[_0x483b('0xf')]===_0x483b('0x10')?https:http;var _0x1a5613={'host':_0x104256[_0x483b('0x1d')],'path':_0x104256[_0x483b('0x0')],'headers':{'user-agent':_0x483b('0x1e')}};_0x73c7f5[_0x483b('0x11')](_0x1a5613,function(_0x5d6402){if(_0x5d6402[_0x483b('0x12')]!==0xc8){_0x47ccbb(new Error(_0x483b('0x14')+_0x30042d+_0x483b('0x15')+_0x5d6402[_0x483b('0x12')]+'\x20('+_0x5d6402['statusMessage']+')'));return;}var _0x2144de='';_0x5d6402['on'](_0x483b('0x1f'),function(_0x36cba8){_0x2144de+=_0x36cba8;});_0x5d6402['on'](_0x483b('0x1c'),function(){_0xc27ec0(_0x2144de);});})['on'](_0x483b('0x13'),function(_0x4756c6){_0x47ccbb(_0x4756c6);})[_0x483b('0x1c')]();});}function convertFile(_0x1c6358,_0x2da9fa){return new BPromise(function(_0x756982,_0x5e0e4b){var _0x29d650=sox[_0x483b('0x20')](_0x1c6358,_0x2da9fa,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29d650['on']('error',function(_0x58aac5){logger['error'](_0x483b('0x21'),_0x58aac5);_0x5e0e4b(_0x58aac5);});_0x29d650['on']('end',function(){logger[_0x483b('0x22')](_0x483b('0x23'));_0x756982();});_0x29d650['start']();});}function base64Decode(_0x182e3d,_0x33471f){var _0x6da921=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x27'));fs[_0x483b('0x28')](_0x6da921,_0x182e3d,_0x483b('0x29'));return convertFile(_0x6da921,_0x33471f)[_0x483b('0x2a')](function(){try{fs[_0x483b('0x19')](_0x6da921);fs['chmodSync'](_0x33471f,'777');}catch(_0x2f5073){logger[_0x483b('0x13')](_0x2f5073);}return _0x33471f['split']('.')[0x0];});}function base64Encode(_0x31f213){var _0x322a7b=fs['readFileSync'](_0x31f213);return new Buffer(_0x322a7b)[_0x483b('0x2b')]('base64');}exports[_0x483b('0x2c')]=function(_0x3486b1,_0x49db8d,_0x42bc14,_0x3f08cb,_0x428196,_0x56ddcc){var _0x12e6a7,_0x37d9c3;var _0x5a6962=_0x483b('0x2d');var _0x4a6d96=_0x483b('0x2e')+_0x3486b1;var _0x3d49d7={};if(_0x49db8d==='ssml'){_0x3d49d7[_0x483b('0x2f')]={'ssml':_0x42bc14};}else{_0x3d49d7[_0x483b('0x2f')]={'text':_0x42bc14};};_0x3d49d7[_0x483b('0x30')]={'languageCode':_0x3f08cb,'ssmlGender':_0x428196};_0x3d49d7[_0x483b('0x31')]={'audioEncoding':_0x483b('0x32'),'sampleRateHertz':0x1f40};var _0x1ae52b={'url':_0x5a6962+_0x483b('0x33')+_0x4a6d96,'method':_0x483b('0x34'),'json':!![],'body':_0x3d49d7};return rp(_0x1ae52b)[_0x483b('0x2a')](function(_0xbb89a5){return new BPromise(function(_0x512b02,_0x4802ea){_0x12e6a7=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x35'));var _0x355a47=Buffer[_0x483b('0x36')](_0xbb89a5[_0x483b('0x37')],_0x483b('0x29'));return fs['writeFile'](_0x12e6a7,_0x355a47,function(_0x3e8103){_0x4802ea(_0x3e8103);},function(_0x1319ce){fs[_0x483b('0x38')](_0x12e6a7,'777');_0x512b02(_0x1319ce);});});})[_0x483b('0x2a')](function(_0x4173a7){_0x37d9c3=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x27'));return convertFile(_0x12e6a7,_0x37d9c3);})['then'](function(){try{fs[_0x483b('0x19')](_0x12e6a7);fs[_0x483b('0x38')](_0x37d9c3,_0x483b('0x39'));}catch(_0x276b55){logger[_0x483b('0x13')](_0x276b55);}logger[_0x483b('0x22')](_0x483b('0x3a'),_0x37d9c3[_0x483b('0x3b')]('.')[0x0]);return _0x37d9c3[_0x483b('0x3b')]('.')[0x0];});};exports[_0x483b('0x3c')]=function(_0x50f000,_0x3b483e){var _0x2748b5,_0x3bde4a;return tts(_0x50f000,_0x3b483e||'en',0x1)[_0x483b('0x2a')](function(_0x10b1d1){logger[_0x483b('0x22')](_0x10b1d1);_0x2748b5=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs['generate'](0x4)+_0x483b('0x35'));return downloadFile(_0x10b1d1,_0x2748b5);})[_0x483b('0x2a')](function(){_0x3bde4a=path['resolve'](__dirname,_0x483b('0x25'),rs['generate'](0x4)+_0x483b('0x27'));return convertFile(_0x2748b5,_0x3bde4a);})['then'](function(){try{fs[_0x483b('0x19')](_0x2748b5);fs[_0x483b('0x38')](_0x3bde4a,_0x483b('0x39'));}catch(_0x4a4192){logger[_0x483b('0x13')](_0x4a4192);}logger[_0x483b('0x22')](_0x483b('0x3d'),_0x3bde4a[_0x483b('0x3b')]('.')[0x0]);return _0x3bde4a[_0x483b('0x3b')]('.')[0x0];});};exports[_0x483b('0x3e')]=function(_0x587863,_0x2a12b1,_0x562d38){return google[_0x483b('0x3f')](_0x587863,_0x2a12b1,_0x562d38)[_0x483b('0x2a')](function(_0x122c0a){logger[_0x483b('0x22')](_0x122c0a[_0x483b('0x40')]);return rp(_0x122c0a);})[_0x483b('0x2a')](function(_0x5d064b){var _0x2ea77a='';var _0x40640b=0x0;try{fs[_0x483b('0x19')](_0x587863);}catch(_0x573e82){logger[_0x483b('0x13')](_0x573e82);}if(_0x5d064b&&_0x5d064b[_0x483b('0x41')]){_0x2ea77a=_0x5d064b['results']['map'](function(_0x5665ae){return _0x5665ae&&_0x5665ae[_0x483b('0x42')][0x0]&&_0x5665ae[_0x483b('0x42')][0x0][_0x483b('0x43')]?_0x5665ae[_0x483b('0x42')][0x0][_0x483b('0x43')]:'';})[_0x483b('0x44')]('\x0a');_0x40640b=_0x5d064b[_0x483b('0x41')][_0x483b('0x45')](function(_0x142cc2){return _0x142cc2&&_0x142cc2[_0x483b('0x42')][0x0]&&_0x142cc2[_0x483b('0x42')][0x0]['confidence']?_0x142cc2['alternatives'][0x0][_0x483b('0x46')]:0x0;})['join']('\x0a');}logger[_0x483b('0x22')](_0x483b('0x47'),_0x2ea77a);logger['info'](_0x483b('0x48'),_0x40640b);return{'transcript':_0x2ea77a,'confidence':_0x40640b};})[_0x483b('0x49')](function(_0x5e98df){logger['error']('[%s]\x20%s:%s',_0x5e98df[_0x483b('0x12')],_0x5e98df[_0x483b('0x4a')],_0x5e98df[_0x483b('0x4b')]);});};exports[_0x483b('0x4c')]=function(_0x4bd1da,_0x5305ce,_0x43fa7a,_0x2aaa55){var _0x126573=apiai(_0x5305ce,{'language':_0x2aaa55||'en'});return _0x126573[_0x483b('0x4d')](_0x43fa7a,{'sessionId':md5(_0x4bd1da)})[_0x483b('0x2a')](function(_0x4a1abb){logger[_0x483b('0x22')](JSON[_0x483b('0x4e')](_0x4a1abb));return{'source':_0x4a1abb['result'][_0x483b('0x4f')],'resolvedQuery':_0x4a1abb[_0x483b('0x50')][_0x483b('0x51')],'action':_0x4a1abb['result'][_0x483b('0x52')],'actionIncomplete':_0x4a1abb['result'][_0x483b('0x53')],'speech':_0x4a1abb[_0x483b('0x50')][_0x483b('0x54')]['speech'],'score':_0x4a1abb['result']['score'],'statusCode':_0x4a1abb[_0x483b('0x55')][_0x483b('0x56')],'endConversation':_0x4a1abb['result'][_0x483b('0x57')][_0x483b('0x58')]||![],'isFallbackIntent':_0x4a1abb[_0x483b('0x50')][_0x483b('0x57')][_0x483b('0x59')]};});};exports['tildeASR']=function(_0x56b4f5,_0x40acad,_0x5549c1,_0x5d269c){return tilde[_0x483b('0x3f')](_0x56b4f5,_0x40acad,_0x5549c1,_0x5d269c)[_0x483b('0x2a')](function(_0x112db7){try{fs['unlink'](_0x56b4f5);}catch(_0x2e24d8){logger[_0x483b('0x13')](_0x2e24d8);}logger[_0x483b('0x22')]('Tilde\x20ASR\x20transcription',_0x112db7[_0x483b('0x43')]);logger[_0x483b('0x22')](_0x483b('0x5a'),_0x112db7[_0x483b('0x46')]);return _0x112db7;});};exports[_0x483b('0x5b')]=function(_0x3551a1,_0x6866be,_0x1997d1,_0x2bc3a9,_0x3ebc7e,_0x546eb2){var _0x4e32dc=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+'.mp3');var _0x44e06e;return aws['polly'](_0x3551a1,_0x6866be,_0x1997d1,_0x2bc3a9,_0x3ebc7e,_0x546eb2,_0x4e32dc)[_0x483b('0x2a')](function(){_0x44e06e=path['resolve'](__dirname,'tmp',rs[_0x483b('0x26')](0x4)+'.wav');return convertFile(_0x4e32dc,_0x44e06e);})[_0x483b('0x2a')](function(){try{fs[_0x483b('0x19')](_0x4e32dc);fs[_0x483b('0x38')](_0x44e06e,_0x483b('0x39'));}catch(_0x3efcf2){logger[_0x483b('0x13')](_0x3efcf2);}return _0x44e06e[_0x483b('0x3b')]('.')[0x0];});};exports[_0x483b('0x5c')]=function(_0x1bb126,_0x8c6a17,_0x3b58ad,_0x4c0476,_0xd2b704,_0x2df3e1){return aws['lex'](_0x1bb126,_0x8c6a17,_0x3b58ad,_0x4c0476,_0xd2b704,_0x2df3e1)[_0x483b('0x2a')](function(_0x2ecd16){logger[_0x483b('0x22')](JSON[_0x483b('0x4e')](_0x2ecd16));return _0x2ecd16;});};exports[_0x483b('0x5d')]=function(_0x5e7f47,_0x442ec8,_0x2f41b4,_0x5c3485){var _0x2b797a=util['format'](_0x483b('0x5e'),ISPEECH_API,_0x5e7f47,encodeURIComponent(_0x442ec8),_0x2f41b4,_0x5c3485);var _0x14812c=path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs[_0x483b('0x26')](0x4)+_0x483b('0x35'));var _0x281e10;return downloadFile(_0x2b797a,_0x14812c)[_0x483b('0x2a')](function(){_0x281e10=path[_0x483b('0x24')](__dirname,'tmp',rs[_0x483b('0x26')](0x4)+_0x483b('0x27'));return convertFile(_0x14812c,_0x281e10);})['then'](function(){try{fs[_0x483b('0x19')](_0x14812c);fs[_0x483b('0x38')](_0x281e10,'777');}catch(_0x13f265){logger['error'](_0x13f265);}return _0x281e10[_0x483b('0x3b')]('.')[0x0];});};exports['ispeechASR']=function(_0x27e717,_0x452233,_0x232278,_0x2c516f){var _0x17ce4c=util[_0x483b('0x5f')](_0x483b('0x60'),ISPEECH_API,_0x452233,_0x232278,base64Encode(_0x27e717),_0x2c516f?util['format']('model=%s',encodeURIComponent(_0x2c516f)):_0x483b('0x61'));return uploadFile(_0x17ce4c)[_0x483b('0x2a')](function(_0x477b07){return querystring[_0x483b('0x3')](_0x477b07);});};exports[_0x483b('0x62')]=function(_0xd5aca2,_0x13d88b){return sestek[_0x483b('0x63')](_0xd5aca2,_0x13d88b)[_0x483b('0x2a')](function(_0x3ec6cc){logger[_0x483b('0x22')](JSON[_0x483b('0x4e')](_0x3ec6cc));var _0x15efa8={'speech':_0x3ec6cc[_0x483b('0x64')],'action':_0x3ec6cc['channelData']?_0x3ec6cc[_0x483b('0x65')]['CustomAction']:undefined,'actiondata':_0x3ec6cc[_0x483b('0x65')]?_0x3ec6cc[_0x483b('0x65')][_0x483b('0x66')]:undefined};if(_0x3ec6cc[_0x483b('0x65')]&&_0x3ec6cc[_0x483b('0x65')][_0x483b('0x67')]){return base64Decode(_0x3ec6cc['channelData'][_0x483b('0x67')][_0x483b('0x68')],path[_0x483b('0x24')](__dirname,_0x483b('0x25'),rs['generate'](0x4)+'.wav'))[_0x483b('0x2a')](function(_0x3b56b1){_0x15efa8['audiofile']=_0x3b56b1;return _0x15efa8;});}return _0x15efa8;});};exports[_0x483b('0x69')]=function(){return __dirname;}; \ No newline at end of file +var _0x1c31=['asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','stringify','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','https','parse','randomstring','sox','util','querystring','apiai-promise','md5','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','path','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','pipe','protocol','request\x20to\x20','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','then','tmp','.mp3','from','writeFile','777','unlink','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent'];(function(_0x1761bf,_0x30a915){var _0xf5727b=function(_0x18d752){while(--_0x18d752){_0x1761bf['push'](_0x1761bf['shift']());}};_0xf5727b(++_0x30a915);}(_0x1c31,0x81));var _0x11c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c31[_0x2c91e9];return _0x13f0ff;};'use strict';var fs=require('fs');var path=require('path');var http=require('http');var https=require(_0x11c3('0x0'));var urlParse=require('url')[_0x11c3('0x1')];var BPromise=require('bluebird');var rs=require(_0x11c3('0x2'));var sox=require(_0x11c3('0x3'));var rp=require('request-promise');var util=require(_0x11c3('0x4'));var querystring=require(_0x11c3('0x5'));var tts=require('google-tts-api');var apiai=require(_0x11c3('0x6'));var md5=require(_0x11c3('0x7'));var google=require('./google');var aws=require(_0x11c3('0x8'));var tilde=require(_0x11c3('0x9'));var sestek=require('./sestek');var logger=require(_0x11c3('0xa'))(_0x11c3('0xb'));var ISPEECH_API=_0x11c3('0xc');function downloadFile(_0xb9ee80,_0x387ba8){return new BPromise(function(_0x100141,_0x444a33){var _0x3b2d2e=urlParse(_0xb9ee80);var _0xb59438=_0x3b2d2e['protocol']===_0x11c3('0xd')?https:http;var _0xfa362e={'host':_0x3b2d2e[_0x11c3('0xe')],'path':_0x3b2d2e[_0x11c3('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0xb59438[_0x11c3('0x10')](_0xfa362e,function(_0x3fba7b){if(_0x3fba7b[_0x11c3('0x11')]!==0xc8){logger['error']('request\x20to\x20'+_0xb9ee80+_0x11c3('0x12')+_0x3fba7b['statusCode']+'\x20('+_0x3fba7b['statusMessage']+')');_0x444a33(new Error('request\x20to\x20'+_0xb9ee80+_0x11c3('0x12')+_0x3fba7b[_0x11c3('0x11')]+'\x20('+_0x3fba7b[_0x11c3('0x13')]+')'));return;}var _0xe8c2d5=fs[_0x11c3('0x14')](_0x387ba8);_0xe8c2d5['on'](_0x11c3('0x15'),function(){logger[_0x11c3('0x16')](_0x11c3('0x17'));_0xe8c2d5['close'](_0x100141);});_0xe8c2d5['on']('error',function(_0x5aa209){fs['unlink'](_0x387ba8);logger[_0x11c3('0x18')](_0x11c3('0x19'),_0x5aa209);_0x444a33(_0x5aa209);});_0x3fba7b[_0x11c3('0x1a')](_0xe8c2d5);})['on'](_0x11c3('0x18'),function(_0x3b45b3){logger[_0x11c3('0x18')](_0x3b45b3);_0x444a33(_0x3b45b3);})['end']();});}function uploadFile(_0x983f88){return new BPromise(function(_0x537762,_0x9e12c4){var _0x46a532=urlParse(_0x983f88);var _0x1f01ce=_0x46a532[_0x11c3('0x1b')]===_0x11c3('0xd')?https:http;var _0xb325e4={'host':_0x46a532[_0x11c3('0xe')],'path':_0x46a532[_0x11c3('0xf')],'headers':{'user-agent':'WHAT_EVER'}};_0x1f01ce[_0x11c3('0x10')](_0xb325e4,function(_0x4ca0ef){if(_0x4ca0ef[_0x11c3('0x11')]!==0xc8){_0x9e12c4(new Error(_0x11c3('0x1c')+_0x983f88+_0x11c3('0x12')+_0x4ca0ef[_0x11c3('0x11')]+'\x20('+_0x4ca0ef[_0x11c3('0x13')]+')'));return;}var _0x569e51='';_0x4ca0ef['on'](_0x11c3('0x1d'),function(_0x4f3a76){_0x569e51+=_0x4f3a76;});_0x4ca0ef['on'](_0x11c3('0x1e'),function(){_0x537762(_0x569e51);});})['on'](_0x11c3('0x18'),function(_0x585403){_0x9e12c4(_0x585403);})[_0x11c3('0x1e')]();});}function convertFile(_0x556a88,_0x534b22){return new BPromise(function(_0x483cec,_0x5c6c3e){var _0x36fc40=sox[_0x11c3('0x1f')](_0x556a88,_0x534b22,{'sampleRate':0x1f40,'format':_0x11c3('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36fc40['on'](_0x11c3('0x18'),function(_0x48368a){logger[_0x11c3('0x18')](_0x11c3('0x21'),_0x48368a);_0x5c6c3e(_0x48368a);});_0x36fc40['on'](_0x11c3('0x1e'),function(){logger[_0x11c3('0x16')](_0x11c3('0x22'));_0x483cec();});_0x36fc40['start']();});}function base64Decode(_0x2943da,_0x544391){var _0x4fa2d7=path[_0x11c3('0x23')](__dirname,'tmp',rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25'));fs[_0x11c3('0x26')](_0x4fa2d7,_0x2943da,_0x11c3('0x27'));return convertFile(_0x4fa2d7,_0x544391)['then'](function(){try{fs['unlink'](_0x4fa2d7);fs[_0x11c3('0x28')](_0x544391,'777');}catch(_0x47f037){logger['error'](_0x47f037);}return _0x544391[_0x11c3('0x29')]('.')[0x0];});}function base64Encode(_0x206004){var _0x594f18=fs[_0x11c3('0x2a')](_0x206004);return new Buffer(_0x594f18)[_0x11c3('0x2b')](_0x11c3('0x27'));}exports['googleCloudTTS']=function(_0x42ebc4,_0x1f9642,_0x5211c4,_0xafbbe2,_0x4fa860,_0x2a3235){var _0x3eee91,_0x4112ae;var _0x9a7f40=_0x11c3('0x2c');var _0x11fb86='?key='+_0x42ebc4;var _0x7fed8d={};if(_0x1f9642===_0x11c3('0x2d')){_0x7fed8d['input']={'ssml':_0x5211c4};}else{_0x7fed8d[_0x11c3('0x2e')]={'text':_0x5211c4};};_0x7fed8d['voice']={'languageCode':_0xafbbe2,'ssmlGender':_0x4fa860};_0x7fed8d[_0x11c3('0x2f')]={'audioEncoding':_0x11c3('0x30'),'sampleRateHertz':0x1f40};var _0x35f872={'url':_0x9a7f40+_0x11c3('0x31')+_0x11fb86,'method':_0x11c3('0x32'),'json':!![],'body':_0x7fed8d};return rp(_0x35f872)[_0x11c3('0x33')](function(_0x232940){return new BPromise(function(_0xc798da,_0x3805e8){_0x3eee91=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x35'));var _0x365266=Buffer[_0x11c3('0x36')](_0x232940['audioContent'],_0x11c3('0x27'));return fs[_0x11c3('0x37')](_0x3eee91,_0x365266,function(_0x579cae){_0x3805e8(_0x579cae);},function(_0x735891){fs[_0x11c3('0x28')](_0x3eee91,_0x11c3('0x38'));_0xc798da(_0x735891);});});})['then'](function(_0x3c831f){_0x4112ae=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs['generate'](0x4)+_0x11c3('0x25'));return convertFile(_0x3eee91,_0x4112ae);})[_0x11c3('0x33')](function(){try{fs[_0x11c3('0x39')](_0x3eee91);fs[_0x11c3('0x28')](_0x4112ae,'777');}catch(_0x224958){logger[_0x11c3('0x18')](_0x224958);}logger['info'](_0x11c3('0x3a'),_0x4112ae[_0x11c3('0x29')]('.')[0x0]);return _0x4112ae['split']('.')[0x0];});};exports[_0x11c3('0x3b')]=function(_0x5a788a,_0x1f83da){var _0x34dbf1,_0x4b541a;return tts(_0x5a788a,_0x1f83da||'en',0x1)[_0x11c3('0x33')](function(_0x1a17a1){logger[_0x11c3('0x16')](_0x1a17a1);_0x34dbf1=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x35'));return downloadFile(_0x1a17a1,_0x34dbf1);})[_0x11c3('0x33')](function(){_0x4b541a=path[_0x11c3('0x23')](__dirname,'tmp',rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25'));return convertFile(_0x34dbf1,_0x4b541a);})['then'](function(){try{fs['unlink'](_0x34dbf1);fs[_0x11c3('0x28')](_0x4b541a,_0x11c3('0x38'));}catch(_0x3f3a94){logger[_0x11c3('0x18')](_0x3f3a94);}logger['info'](_0x11c3('0x3c'),_0x4b541a[_0x11c3('0x29')]('.')[0x0]);return _0x4b541a[_0x11c3('0x29')]('.')[0x0];});};exports[_0x11c3('0x3d')]=function(_0x26d4dd,_0x3b0c31,_0x5cef56){return google['asr'](_0x26d4dd,_0x3b0c31,_0x5cef56)['then'](function(_0x3cabe5){logger[_0x11c3('0x16')](_0x3cabe5[_0x11c3('0x3e')]);return rp(_0x3cabe5);})[_0x11c3('0x33')](function(_0x212dff){var _0x3441fd='';var _0x24ee7f=0x0;try{fs['unlink'](_0x26d4dd);}catch(_0x3909f2){logger[_0x11c3('0x18')](_0x3909f2);}if(_0x212dff&&_0x212dff[_0x11c3('0x3f')]){_0x3441fd=_0x212dff[_0x11c3('0x3f')][_0x11c3('0x40')](function(_0x539c48){return _0x539c48&&_0x539c48[_0x11c3('0x41')][0x0]&&_0x539c48[_0x11c3('0x41')][0x0][_0x11c3('0x42')]?_0x539c48[_0x11c3('0x41')][0x0][_0x11c3('0x42')]:'';})['join']('\x0a');_0x24ee7f=_0x212dff[_0x11c3('0x3f')][_0x11c3('0x40')](function(_0x4c50b6){return _0x4c50b6&&_0x4c50b6[_0x11c3('0x41')][0x0]&&_0x4c50b6['alternatives'][0x0]['confidence']?_0x4c50b6['alternatives'][0x0][_0x11c3('0x43')]:0x0;})[_0x11c3('0x44')]('\x0a');}logger[_0x11c3('0x16')](_0x11c3('0x45'),_0x3441fd);logger[_0x11c3('0x16')](_0x11c3('0x46'),_0x24ee7f);return{'transcript':_0x3441fd,'confidence':_0x24ee7f};})[_0x11c3('0x47')](function(_0x504db7){logger[_0x11c3('0x18')](_0x11c3('0x48'),_0x504db7[_0x11c3('0x11')],_0x504db7[_0x11c3('0x49')],_0x504db7[_0x11c3('0x4a')]);});};exports[_0x11c3('0x4b')]=function(_0x13734b,_0x23688c,_0x2aa999,_0x501e99){var _0x24bb30=apiai(_0x23688c,{'language':_0x501e99||'en'});return _0x24bb30[_0x11c3('0x4c')](_0x2aa999,{'sessionId':md5(_0x13734b)})['then'](function(_0x18e6c1){logger[_0x11c3('0x16')](JSON['stringify'](_0x18e6c1));return{'source':_0x18e6c1['result'][_0x11c3('0x4d')],'resolvedQuery':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x4f')],'action':_0x18e6c1['result'][_0x11c3('0x50')],'actionIncomplete':_0x18e6c1['result'][_0x11c3('0x51')],'speech':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x52')][_0x11c3('0x53')],'score':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x54')],'statusCode':_0x18e6c1['status'][_0x11c3('0x55')],'endConversation':_0x18e6c1['result'][_0x11c3('0x56')][_0x11c3('0x57')]||![],'isFallbackIntent':_0x18e6c1[_0x11c3('0x4e')][_0x11c3('0x56')][_0x11c3('0x58')]};});};exports['tildeASR']=function(_0x33d386,_0x13b1e5,_0x10c161,_0x183ad9){return tilde[_0x11c3('0x59')](_0x33d386,_0x13b1e5,_0x10c161,_0x183ad9)[_0x11c3('0x33')](function(_0x4ac0e6){try{fs[_0x11c3('0x39')](_0x33d386);}catch(_0xdcde1d){logger[_0x11c3('0x18')](_0xdcde1d);}logger[_0x11c3('0x16')](_0x11c3('0x5a'),_0x4ac0e6[_0x11c3('0x42')]);logger['info'](_0x11c3('0x5b'),_0x4ac0e6[_0x11c3('0x43')]);return _0x4ac0e6;});};exports['awsPolly']=function(_0x5a7db3,_0x35d2ba,_0x5f5881,_0x4c963a,_0x5f1149,_0x51a1e0){var _0x11d523=path[_0x11c3('0x23')](__dirname,'tmp',rs[_0x11c3('0x24')](0x4)+_0x11c3('0x35'));var _0x45d59e;return aws['polly'](_0x5a7db3,_0x35d2ba,_0x5f5881,_0x4c963a,_0x5f1149,_0x51a1e0,_0x11d523)[_0x11c3('0x33')](function(){_0x45d59e=path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25'));return convertFile(_0x11d523,_0x45d59e);})[_0x11c3('0x33')](function(){try{fs[_0x11c3('0x39')](_0x11d523);fs[_0x11c3('0x28')](_0x45d59e,_0x11c3('0x38'));}catch(_0x490832){logger[_0x11c3('0x18')](_0x490832);}return _0x45d59e[_0x11c3('0x29')]('.')[0x0];});};exports[_0x11c3('0x5c')]=function(_0x60fa10,_0x202afd,_0x5b1c46,_0x5265b9,_0x5e8d0f,_0x40bb28){return aws['lex'](_0x60fa10,_0x202afd,_0x5b1c46,_0x5265b9,_0x5e8d0f,_0x40bb28)[_0x11c3('0x33')](function(_0x557348){logger[_0x11c3('0x16')](JSON[_0x11c3('0x5d')](_0x557348));return _0x557348;});};exports['ispeechTTS']=function(_0x4058af,_0x279274,_0x33cc6a,_0x5be72d){var _0x2dfd34=util[_0x11c3('0x5e')](_0x11c3('0x5f'),ISPEECH_API,_0x4058af,encodeURIComponent(_0x279274),_0x33cc6a,_0x5be72d);var _0xe3028b=path['resolve'](__dirname,_0x11c3('0x34'),rs['generate'](0x4)+'.mp3');var _0x380238;return downloadFile(_0x2dfd34,_0xe3028b)['then'](function(){_0x380238=path['resolve'](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+'.wav');return convertFile(_0xe3028b,_0x380238);})['then'](function(){try{fs['unlink'](_0xe3028b);fs[_0x11c3('0x28')](_0x380238,_0x11c3('0x38'));}catch(_0x11a1e3){logger['error'](_0x11a1e3);}return _0x380238[_0x11c3('0x29')]('.')[0x0];});};exports[_0x11c3('0x60')]=function(_0x129b95,_0x365ce1,_0x3fca73,_0x48de33){var _0x159871=util[_0x11c3('0x5e')](_0x11c3('0x61'),ISPEECH_API,_0x365ce1,_0x3fca73,base64Encode(_0x129b95),_0x48de33?util['format']('model=%s',encodeURIComponent(_0x48de33)):_0x11c3('0x62'));return uploadFile(_0x159871)[_0x11c3('0x33')](function(_0xec5590){return querystring[_0x11c3('0x1')](_0xec5590);});};exports[_0x11c3('0x63')]=function(_0x24d873,_0xdf6441){return sestek[_0x11c3('0x64')](_0x24d873,_0xdf6441)['then'](function(_0x4e5f17){logger[_0x11c3('0x16')](JSON[_0x11c3('0x5d')](_0x4e5f17));var _0x1535db={'speech':_0x4e5f17[_0x11c3('0x65')],'action':_0x4e5f17['channelData']?_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x67')]:undefined,'actiondata':_0x4e5f17[_0x11c3('0x66')]?_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x68')]:undefined};if(_0x4e5f17[_0x11c3('0x66')]&&_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x69')]){return base64Decode(_0x4e5f17[_0x11c3('0x66')][_0x11c3('0x69')][_0x11c3('0x6a')],path[_0x11c3('0x23')](__dirname,_0x11c3('0x34'),rs[_0x11c3('0x24')](0x4)+_0x11c3('0x25')))[_0x11c3('0x33')](function(_0x2fb7c7){_0x1535db[_0x11c3('0x6b')]=_0x2fb7c7;return _0x1535db;});}return _0x1535db;});};exports[_0x11c3('0x6c')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 6dd1b31..fccb99c 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 _0xf278=['exports','./nda'];(function(_0x48d7d8,_0xf470ef){var _0x37f3d0=function(_0x1162f3){while(--_0x1162f3){_0x48d7d8['push'](_0x48d7d8['shift']());}};_0x37f3d0(++_0xf470ef);}(_0xf278,0x185));var _0x8f27=function(_0x551ece,_0x23d845){_0x551ece=_0x551ece-0x0;var _0x24ac88=_0xf278[_0x551ece];return _0x24ac88;};var nda=require(_0x8f27('0x0'));module[_0x8f27('0x1')]={'nda':nda}; \ No newline at end of file +var _0xd8e3=['exports'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xd8e3,0x1e0));var _0x3d8e=function(_0x510909,_0x38f9fe){_0x510909=_0x510909-0x0;var _0x2faa1a=_0xd8e3[_0x510909];return _0x2faa1a;};var nda=require('./nda');module[_0x3d8e('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index aecad22..5022392 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 _0x8477=['request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','custom_action','CustomActionData','custom_action_data','info','stringify'];(function(_0x4b80e0,_0x2dc469){var _0x4266df=function(_0xcd7b1f){while(--_0xcd7b1f){_0x4b80e0['push'](_0x4b80e0['shift']());}};_0x4266df(++_0x2dc469);}(_0x8477,0xe0));var _0x7847=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x8477[_0x4b7e4d];return _0x38d6af;};'use strict';var rp=require(_0x7847('0x0'));var url=require(_0x7847('0x1'));var logger=require(_0x7847('0x2'))(_0x7847('0x3'));module['exports']=function(_0x5119f7,_0x4eeba3){var _0x1c487f={'method':_0x7847('0x4'),'uri':url[_0x7847('0x5')](_0x4eeba3[_0x7847('0x6')],_0x7847('0x7')),'form':{'grant_type':_0x7847('0x8'),'username':_0x4eeba3['username'],'password':_0x4eeba3[_0x7847('0x8')]},'json':!![]};return rp(_0x1c487f)[_0x7847('0x9')](function(_0x53aae6){var _0x14e6ae={'method':_0x7847('0x4'),'uri':url['resolve'](_0x4eeba3[_0x7847('0xa')],_0x7847('0xb')),'body':{'type':_0x4eeba3[_0x7847('0xc')]||_0x7847('0xd'),'channelId':_0x7847('0xe'),'conversation':{'id':_0x5119f7['uniqueid']},'from':{'id':_0x5119f7[_0x7847('0xf')],'name':_0x5119f7[_0x7847('0x10')]},'recipient':{'id':_0x5119f7[_0x7847('0x11')],'name':_0x5119f7[_0x7847('0x12')]},'text':_0x4eeba3[_0x7847('0x13')],'channelData':{}},'headers':{'Authorization':_0x7847('0x14')+_0x53aae6[_0x7847('0x15')]},'json':!![]};if(_0x4eeba3[_0x7847('0x16')]){_0x14e6ae[_0x7847('0x17')][_0x7847('0x18')][_0x7847('0x19')]=_0x4eeba3[_0x7847('0x16')];}if(_0x4eeba3['ndagenerate_audio']=='1'){_0x14e6ae[_0x7847('0x17')][_0x7847('0x18')][_0x7847('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x4eeba3['custom_action']){_0x14e6ae['body']['channelData']['CustomAction']=_0x4eeba3[_0x7847('0x1b')];if(_0x4eeba3['custom_action_data']){_0x14e6ae['body'][_0x7847('0x18')][_0x7847('0x1c')]=_0x4eeba3[_0x7847('0x1d')];}}logger[_0x7847('0x1e')](JSON[_0x7847('0x1f')](_0x14e6ae));return rp(_0x14e6ae);});}; \ No newline at end of file +var _0x4d0f=['calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','agi','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x4d0f,0x13a));var _0xf4d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d0f[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xf4d0('0x0'));var url=require(_0xf4d0('0x1'));var logger=require('../../../../../config/logger')(_0xf4d0('0x2'));module['exports']=function(_0x323ea8,_0x49c830){var _0x255075={'method':'POST','uri':url[_0xf4d0('0x3')](_0x49c830[_0xf4d0('0x4')],_0xf4d0('0x5')),'form':{'grant_type':_0xf4d0('0x6'),'username':_0x49c830[_0xf4d0('0x7')],'password':_0x49c830[_0xf4d0('0x6')]},'json':!![]};return rp(_0x255075)[_0xf4d0('0x8')](function(_0x35c2b6){var _0x383e2d={'method':_0xf4d0('0x9'),'uri':url[_0xf4d0('0x3')](_0x49c830[_0xf4d0('0xa')],_0xf4d0('0xb')),'body':{'type':_0x49c830[_0xf4d0('0xc')]||_0xf4d0('0xd'),'channelId':_0xf4d0('0xe'),'conversation':{'id':_0x323ea8['uniqueid']},'from':{'id':_0x323ea8[_0xf4d0('0xf')],'name':_0x323ea8[_0xf4d0('0x10')]},'recipient':{'id':_0x323ea8[_0xf4d0('0x11')],'name':_0x323ea8['extension']},'text':_0x49c830[_0xf4d0('0x12')],'channelData':{}},'headers':{'Authorization':_0xf4d0('0x13')+_0x35c2b6[_0xf4d0('0x14')]},'json':!![]};if(_0x49c830[_0xf4d0('0x15')]){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x18')]=_0x49c830[_0xf4d0('0x15')];}if(_0x49c830[_0xf4d0('0x19')]=='1'){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf4d0('0x1b')};}if(_0x49c830['custom_action']){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x1c')]=_0x49c830[_0xf4d0('0x1d')];if(_0x49c830[_0xf4d0('0x1e')]){_0x383e2d[_0xf4d0('0x16')][_0xf4d0('0x17')][_0xf4d0('0x1f')]=_0x49c830['custom_action_data'];}}logger[_0xf4d0('0x20')](JSON['stringify'](_0x383e2d));return rp(_0x383e2d);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index f43b77a..c7c8721 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 _0x9498=['./lib/api','exports'];(function(_0x46596d,_0x52918c){var _0x5d017f=function(_0x476740){while(--_0x476740){_0x46596d['push'](_0x46596d['shift']());}};_0x5d017f(++_0x52918c);}(_0x9498,0x1e8));var _0x8949=function(_0x3a30f8,_0x3cfeec){_0x3a30f8=_0x3a30f8-0x0;var _0x18958e=_0x9498[_0x3a30f8];return _0x18958e;};'use strict';var asr=require(_0x8949('0x0'));module[_0x8949('0x1')]=function(_0x28e247,_0x130114,_0x1ba9b2,_0x9dcedf){return asr(_0x28e247,_0x130114,_0x1ba9b2,_0x9dcedf);}; \ No newline at end of file +var _0xccf1=['./lib/api','exports'];(function(_0x40971a,_0x5cf1d9){var _0x393040=function(_0x5a498d){while(--_0x5a498d){_0x40971a['push'](_0x40971a['shift']());}};_0x393040(++_0x5cf1d9);}(_0xccf1,0xf8));var _0x1ccf=function(_0x3b500a,_0xbbeb08){_0x3b500a=_0x3b500a-0x0;var _0x230eda=_0xccf1[_0x3b500a];return _0x230eda;};'use strict';var asr=require(_0x1ccf('0x0'));module[_0x1ccf('0x1')]=function(_0x4f8d82,_0x2543aa,_0x1cf18d,_0x17a3fd){return asr(_0x4f8d82,_0x2543aa,_0x1cf18d,_0x17a3fd);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 347a283..1f599b4 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 _0xea79=['isNil','isObject','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','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'];(function(_0x1e49ee,_0x3257b6){var _0x3dcf1e=function(_0x62a4fa){while(--_0x62a4fa){_0x1e49ee['push'](_0x1e49ee['shift']());}};_0x3dcf1e(++_0x3257b6);}(_0xea79,0x162));var _0x9ea7=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xea79[_0x310504];return _0x5b36d0;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9ea7('0x0'));var crypto=require(_0x9ea7('0x1'));var logger=require(_0x9ea7('0x2'))(_0x9ea7('0x3'));module[_0x9ea7('0x4')]=function(_0x49e791,_0x70bcd6,_0x175c86,_0x53181b){return new BPromise(function(_0x262f22,_0x2f34d4){logger[_0x9ea7('0x5')](_0x9ea7('0x6'),_0x53181b||_0x9ea7('0x7'));var _0x527f09=new WebSocket(_0x53181b||_0x9ea7('0x7'),{'perMessageDeflate':![]});var _0x9ae1f5='';var _0x410091='0';var _0x50cc1b='1';var _0x3be103=_0x9ea7('0x8');function _0x54ef05(_0x30cdee){var _0x339221=crypto[_0x9ea7('0x9')](_0x9ea7('0xa'));_0x339221[_0x9ea7('0xb')](_0x30cdee);return _0x339221[_0x9ea7('0xc')](_0x9ea7('0xd'));}function _0x1d8859(){try{logger[_0x9ea7('0x5')](_0x9ea7('0xe'));var _0x1b7b03=moment()[_0x9ea7('0xf')]();var _0x25af97=_0x54ef05(_0x1b7b03+_0x70bcd6+_0x175c86);_0x527f09[_0x9ea7('0x10')](JSON[_0x9ea7('0x11')]({'appID':_0x70bcd6,'timestamp':_0x1b7b03,'appKey':_0x25af97}));var _0xe91f38=fs[_0x9ea7('0x12')](_0x49e791);_0xe91f38['on']('data',function(_0x3c4131){_0x527f09[_0x9ea7('0x10')](_0x3c4131);});_0xe91f38['on'](_0x9ea7('0x13'),function(){_0x527f09[_0x9ea7('0x10')]('EOS');});}catch(_0x38a24e){logger[_0x9ea7('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x9ea7('0x11')](_0x38a24e));_0x527f09[_0x9ea7('0x15')]();}}function _0x131cc4(_0x3748a1){try{if(_0x3748a1){var _0x5640e8=JSON[_0x9ea7('0x16')](_0x3748a1);switch(_0x5640e8[_0x9ea7('0x17')]){case 0x0:if(_0x5640e8['result']){if(_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x19')]){logger['info'](_0x9ea7('0x1a'),JSON[_0x9ea7('0x11')](_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x1b')]));_0x9ae1f5=_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x1b')][0x0][_0x9ea7('0x1c')];_0x410091=_0x5640e8[_0x9ea7('0x18')][_0x9ea7('0x1b')][0x0]['likelihood'];_0x50cc1b='0';_0x3be103=_0x9ea7('0x1d');_0x527f09[_0x9ea7('0x15')]();}}break;case 0x1:logger['info'](_0x9ea7('0x8'));_0x50cc1b='1';_0x3be103=_0x9ea7('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x50cc1b='2';_0x3be103=_0x9ea7('0x1e');break;case 0x9:logger['info'](_0x9ea7('0x1f'));_0x50cc1b='9';_0x3be103=_0x9ea7('0x1f');break;case 0xa:logger[_0x9ea7('0x5')](_0x9ea7('0x20'));_0x50cc1b='10';_0x3be103='Authentication\x20failed.';break;case 0xb:logger[_0x9ea7('0x5')](_0x9ea7('0x21'));_0x50cc1b='11';_0x3be103=_0x9ea7('0x21');}}}catch(_0x540235){logger[_0x9ea7('0x14')](_0x9ea7('0x22'),JSON[_0x9ea7('0x11')](_0x540235));_0x527f09[_0x9ea7('0x15')]();}}function _0x21f89a(){logger[_0x9ea7('0x5')](_0x9ea7('0x23'));_0x262f22({'transcript':_0x9ae1f5,'confidence':_0x410091,'status':_0x50cc1b,'status_message':_0x3be103});}function _0x342a2b(_0x29d7c3){logger[_0x9ea7('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x9ea7('0x24')](_0x29d7c3)){logger[_0x9ea7('0x14')](_[_0x9ea7('0x25')](_0x29d7c3)?JSON[_0x9ea7('0x11')](_0x29d7c3):_0x29d7c3);}}_0x527f09['on']('open',_0x1d8859);_0x527f09['on'](_0x9ea7('0x26'),_0x131cc4);_0x527f09['on']('close',_0x21f89a);_0x527f09['on'](_0x9ea7('0x14'),_0x342a2b);});}; \ No newline at end of file +var _0xbe60=['exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','likelihood','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','close','bluebird','lodash','moment','crypto'];(function(_0x421a10,_0x2465aa){var _0x589ca0=function(_0x4cd6ca){while(--_0x4cd6ca){_0x421a10['push'](_0x421a10['shift']());}};_0x589ca0(++_0x2465aa);}(_0xbe60,0x1dc));var _0x0be6=function(_0x155940,_0xd01433){_0x155940=_0x155940-0x0;var _0x51aa9e=_0xbe60[_0x155940];return _0x51aa9e;};'use strict';var BPromise=require(_0x0be6('0x0'));var _=require(_0x0be6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0be6('0x2'));var crypto=require(_0x0be6('0x3'));var logger=require('../../../../../../config/logger')('agi');module[_0x0be6('0x4')]=function(_0x17719b,_0x1c4c86,_0x551e05,_0x4d72eb){return new BPromise(function(_0x20c395,_0x283cf3){logger[_0x0be6('0x5')](_0x0be6('0x6'),_0x4d72eb||_0x0be6('0x7'));var _0x22090e=new WebSocket(_0x4d72eb||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2b7ef5='';var _0x36bc76='0';var _0x55fc02='1';var _0x4772b1='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3e8b62(_0x909c8d){var _0x37274f=crypto[_0x0be6('0x8')](_0x0be6('0x9'));_0x37274f[_0x0be6('0xa')](_0x909c8d);return _0x37274f[_0x0be6('0xb')](_0x0be6('0xc'));}function _0x391ee8(){try{logger[_0x0be6('0x5')](_0x0be6('0xd'));var _0x4b473b=moment()[_0x0be6('0xe')]();var _0x2317e3=_0x3e8b62(_0x4b473b+_0x1c4c86+_0x551e05);_0x22090e[_0x0be6('0xf')](JSON['stringify']({'appID':_0x1c4c86,'timestamp':_0x4b473b,'appKey':_0x2317e3}));var _0x5bc51d=fs[_0x0be6('0x10')](_0x17719b);_0x5bc51d['on'](_0x0be6('0x11'),function(_0x3480c3){_0x22090e['send'](_0x3480c3);});_0x5bc51d['on']('close',function(){_0x22090e[_0x0be6('0xf')](_0x0be6('0x12'));});}catch(_0x5e5243){logger[_0x0be6('0x13')](_0x0be6('0x14'),JSON['stringify'](_0x5e5243));_0x22090e['terminate']();}}function _0x7f194(_0x276aa7){try{if(_0x276aa7){var _0x273e54=JSON[_0x0be6('0x15')](_0x276aa7);switch(_0x273e54['status']){case 0x0:if(_0x273e54['result']){if(_0x273e54[_0x0be6('0x16')][_0x0be6('0x17')]){logger['info'](_0x0be6('0x18'),JSON[_0x0be6('0x19')](_0x273e54['result'][_0x0be6('0x1a')]));_0x2b7ef5=_0x273e54[_0x0be6('0x16')][_0x0be6('0x1a')][0x0][_0x0be6('0x1b')];_0x36bc76=_0x273e54[_0x0be6('0x16')][_0x0be6('0x1a')][0x0][_0x0be6('0x1c')];_0x55fc02='0';_0x4772b1='Success.';_0x22090e[_0x0be6('0x1d')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x55fc02='1';_0x4772b1=_0x0be6('0x1e');break;case 0x2:logger['info'](_0x0be6('0x1f'));_0x55fc02='2';_0x4772b1=_0x0be6('0x1f');break;case 0x9:logger[_0x0be6('0x5')](_0x0be6('0x20'));_0x55fc02='9';_0x4772b1=_0x0be6('0x20');break;case 0xa:logger['info']('Authentication\x20failed.');_0x55fc02='10';_0x4772b1=_0x0be6('0x21');break;case 0xb:logger[_0x0be6('0x5')](_0x0be6('0x22'));_0x55fc02='11';_0x4772b1='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x494c12){logger[_0x0be6('0x13')](_0x0be6('0x23'),JSON[_0x0be6('0x19')](_0x494c12));_0x22090e[_0x0be6('0x1d')]();}}function _0x4347e8(){logger[_0x0be6('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x20c395({'transcript':_0x2b7ef5,'confidence':_0x36bc76,'status':_0x55fc02,'status_message':_0x4772b1});}function _0x595b0e(_0x48acb9){logger[_0x0be6('0x13')](_0x0be6('0x24'));if(!_[_0x0be6('0x25')](_0x48acb9)){logger[_0x0be6('0x13')](_[_0x0be6('0x26')](_0x48acb9)?JSON[_0x0be6('0x19')](_0x48acb9):_0x48acb9);}}_0x22090e['on']('open',_0x391ee8);_0x22090e['on']('message',_0x7f194);_0x22090e['on'](_0x0be6('0x27'),_0x4347e8);_0x22090e['on'](_0x0be6('0x13'),_0x595b0e);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 98092c7..4865560 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 _0x8b6c=['exports','./asr'];(function(_0xd9dd19,_0x3f788b){var _0x3d25f8=function(_0xc22ddc){while(--_0xc22ddc){_0xd9dd19['push'](_0xd9dd19['shift']());}};_0x3d25f8(++_0x3f788b);}(_0x8b6c,0x1b7));var _0xc8b6=function(_0x432ac3,_0x123070){_0x432ac3=_0x432ac3-0x0;var _0x39d07e=_0x8b6c[_0x432ac3];return _0x39d07e;};var asr=require(_0xc8b6('0x0'));module[_0xc8b6('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb7db=['exports','./asr'];(function(_0x1ecc7a,_0x1e3d77){var _0x40aa20=function(_0x128147){while(--_0x128147){_0x1ecc7a['push'](_0x1ecc7a['shift']());}};_0x40aa20(++_0x1e3d77);}(_0xb7db,0x1e7));var _0xbb7d=function(_0x56679b,_0x4fd310){_0x56679b=_0x56679b-0x0;var _0x211abf=_0xb7db[_0x56679b];return _0x211abf;};var asr=require(_0xbb7d('0x0'));module[_0xbb7d('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 75f881b..6e501d3 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 _0xdfcc=['./error','./channel','call','emit','error','createServer','listening','connection','getConnections','destroy','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events'];(function(_0x2cc7ad,_0x32c01a){var _0x2de1d7=function(_0x215a29){while(--_0x215a29){_0x2cc7ad['push'](_0x2cc7ad['shift']());}};_0x2de1d7(++_0x32c01a);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0xdfcc[_0x2feb53];return _0x5700ee;};'use strict';var util=require(_0xcdfc('0x0'));var net=require(_0xcdfc('0x1'));var EventEmitter=require(_0xcdfc('0x2'))['EventEmitter'];var AGIError=require(_0xcdfc('0x3'));var AGIChannel=require(_0xcdfc('0x4'));var AGIServer=function(_0x54bd16,_0x4aef49,_0x468275){var _0x4e9e63=this,_0x54bd16=_0x54bd16||0x11dd,_0x4aef49=_0x4aef49||'127.0.0.1',_0xa928f6=null,_0x155d4c=0x0;EventEmitter[_0xcdfc('0x5')](_0x4e9e63);function _0x35a524(){if(!_0x54bd16){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0xa928f6=net[_0xcdfc('0x8')]();_0xa928f6['listen'](_0x54bd16,_0x4aef49);_0xa928f6['on'](_0xcdfc('0x9'),function(){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x9'));});_0xa928f6['on'](_0xcdfc('0xa'),function(_0x4537b6){_0xa928f6[_0xcdfc('0xb')](function(_0x5575e5,_0x5f1d46){if(_0x5575e5){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x5575e5));}else if(_0x468275&&_0x468275<0x0){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x4537b6[_0xcdfc('0xc')]();}else if(_0x468275&&_0x468275>0x0&&_0x468275<_0x5f1d46){_0x155d4c+=0x1;_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x155d4c));_0x4537b6[_0xcdfc('0xc')]();}else{var _0xb5a56a=new AGIChannel(_0x4537b6);_0xb5a56a['on']('ready',function(){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0xa'),_0xb5a56a);});}});});_0xa928f6['on'](_0xcdfc('0x7'),function(_0x5189bd){_0x4e9e63[_0xcdfc('0x6')](_0xcdfc('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x5189bd[_0xcdfc('0xd')]));});_0xa928f6['on'](_0xcdfc('0xe'),function(){_0x4e9e63['emit'](_0xcdfc('0xe'),new AGIError(_0xcdfc('0xf')));});}process[_0xcdfc('0x10')](function(){_0x35a524();});};util['inherits'](AGIServer,EventEmitter);module[_0xcdfc('0x11')]=function(_0x8daa88,_0x5ad601,_0x3e1707){return new AGIServer(_0x8daa88,_0x5ad601,_0x3e1707);}; \ No newline at end of file +var _0x9f3e=['createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x117f4b,_0x56b75f){_0x117f4b=_0x117f4b-0x0;var _0x5903ec=_0x9f3e[_0x117f4b];return _0x5903ec;};'use strict';var util=require(_0xe9f3('0x0'));var net=require(_0xe9f3('0x1'));var EventEmitter=require(_0xe9f3('0x2'))[_0xe9f3('0x3')];var AGIError=require(_0xe9f3('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x597538,_0x4c3a39,_0x1ea33c){var _0x4bc414=this,_0x597538=_0x597538||0x11dd,_0x4c3a39=_0x4c3a39||_0xe9f3('0x5'),_0x46f926=null,_0x3693ef=0x0;EventEmitter[_0xe9f3('0x6')](_0x4bc414);function _0x407123(){if(!_0x597538){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0x8'),new AGIError(_0xe9f3('0x9')));return![];}_0x46f926=net[_0xe9f3('0xa')]();_0x46f926[_0xe9f3('0xb')](_0x597538,_0x4c3a39);_0x46f926['on'](_0xe9f3('0xc'),function(){_0x4bc414['emit'](_0xe9f3('0xc'));});_0x46f926['on'](_0xe9f3('0xd'),function(_0x250599){_0x46f926[_0xe9f3('0xe')](function(_0x22ed98,_0x48ae22){if(_0x22ed98){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x22ed98));}else if(_0x1ea33c&&_0x1ea33c<0x0){_0x4bc414[_0xe9f3('0x7')]('error',new AGIError(_0xe9f3('0xf')));_0x250599[_0xe9f3('0x10')]();}else if(_0x1ea33c&&_0x1ea33c>0x0&&_0x1ea33c<_0x48ae22){_0x3693ef+=0x1;_0x4bc414[_0xe9f3('0x7')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3693ef));_0x250599[_0xe9f3('0x10')]();}else{var _0x158f4c=new AGIChannel(_0x250599);_0x158f4c['on']('ready',function(){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0xd'),_0x158f4c);});}});});_0x46f926['on'](_0xe9f3('0x8'),function(_0x25abdc){_0x4bc414[_0xe9f3('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x25abdc[_0xe9f3('0x11')]));});_0x46f926['on'](_0xe9f3('0x12'),function(){_0x4bc414[_0xe9f3('0x7')](_0xe9f3('0x12'),new AGIError(_0xe9f3('0x13')));});}process['nextTick'](function(){_0x407123();});};util[_0xe9f3('0x14')](AGIServer,EventEmitter);module[_0xe9f3('0x15')]=function(_0x570dc0,_0x2b21b9,_0x679a80){return new AGIServer(_0x570dc0,_0x2b21b9,_0x679a80);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c571893..1612ec1 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 _0x73bd=['variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','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','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','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','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','open','error','info','query','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','createSquareMessage','log','in\x20createcmcontact\x20callback','has','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','RETVALRPC','TZ\x20found\x20in\x20shared:','createCmContact','callback_','isEmpty','lastName','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','MP3','googleTTS','restAPI','url','method','timeout','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','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_region','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','%s.%s','setVariable','replaceall\x20init','split','length','replaceAll','toString','replaceall\x20end','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','label','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20odbc\x20database\x20found','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','keys','%s[%s][%s]','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','speech','out','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','operation','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s]'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x73bd,0x6b));var _0xd73b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x73bd[_0x21a9d9];return _0x46adce;};'use strict';var fs=require('fs');var path=require(_0xd73b('0x0'));var util=require('util');var _=require(_0xd73b('0x1'));var sh=require(_0xd73b('0x2'));var odbc=require(_0xd73b('0x3'))();var rs=require(_0xd73b('0x4'));var moment=require('moment');var Mustache=require(_0xd73b('0x5'));var rp=require(_0xd73b('0x6'));var logger=require('../../config/logger')(_0xd73b('0x7'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0xd73b('0x8'));var FILES_PATH=_0xd73b('0x9');var recursiveMapAttributes=[_0xd73b('0xa'),_0xd73b('0xb')];var verticesWithRetry=[_0xd73b('0xc'),_0xd73b('0xd'),'getsecretdigits'];var AGIVertices=function(_0x1840d4,_0x18b10c,_0x5ccecb){this['channel']=_0x1840d4;this[_0xd73b('0xe')]=_0x18b10c;this[_0xd73b('0xf')]=_0x5ccecb;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x11')]=function(_0x575ba3,_0x60879a){this[_0xd73b('0xe')]['getVariableById'](_0x575ba3)[_0xd73b('0x12')](function(_0x4a3d61){_0x60879a(null,_0x4a3d61?_0x4a3d61['name']:![]);})['catch'](function(_0x195817){_0x60879a(_0x195817);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x13')]=function(_0x132782,_0x3142bb){this[_0xd73b('0xe')][_0xd73b('0x14')](_0x132782)[_0xd73b('0x12')](function(_0x4ee79d){_0x3142bb(null,_0x4ee79d?_0x4ee79d[_0xd73b('0x15')]:![]);})[_0xd73b('0x16')](function(_0x3fefaa){_0x3142bb(_0x3fefaa);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x17')]=function(_0x5b9558,_0x163c64){this[_0xd73b('0xe')][_0xd73b('0x18')](_0x5b9558)[_0xd73b('0x12')](function(_0x53a909){_0x163c64(null,_0x53a909?_0x53a909['name']:![]);})['catch'](function(_0x529576){_0x163c64(_0x529576);});};AGIVertices[_0xd73b('0x10')]['getSquareOdbc']=function(_0x55ed89,_0x42a79c){this[_0xd73b('0xe')][_0xd73b('0x19')](_0x55ed89)[_0xd73b('0x12')](function(_0x19b50e){_0x42a79c(null,_0x19b50e?_0x19b50e['dsn']:![]);})[_0xd73b('0x16')](function(_0x354a9c){_0x42a79c(_0x354a9c);});};AGIVertices['prototype']['getUser']=function(_0xc948f8,_0x4ee410){this[_0xd73b('0xe')][_0xd73b('0x1a')](_0xc948f8)[_0xd73b('0x12')](function(_0x197dd7){_0x4ee410(null,_0x197dd7?_0x197dd7[_0xd73b('0x15')]:![]);})['catch'](function(_0x5607f2){_0x4ee410(_0x5607f2);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1b')]=function(_0x5ee402,_0x27f071){this['rpc'][_0xd73b('0x1c')](_0x5ee402)['then'](function(_0x41b090){_0x27f071(null,_0x41b090?_0x41b090[_0xd73b('0x15')]:![]);})['catch'](function(_0x978f69){_0x27f071(_0x978f69);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1d')]=function(_0x1ea0e6,_0x25204d){var _0x4aa1a4=this;this[_0xd73b('0xe')][_0xd73b('0x1e')](_0x1ea0e6)[_0xd73b('0x12')](function(_0xb6a6a2){_0x25204d(null,_0xb6a6a2?_0x4aa1a4[_0xd73b('0x1f')](_0xb6a6a2[_0xd73b('0x20')]):![]);})['catch'](function(_0x222e08){_0x25204d(_0x222e08);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x21')]=function(_0x1e7414,_0x19f676){this[_0xd73b('0xe')]['getMailAccountById'](_0x1e7414)['then'](function(_0x51325a){_0x19f676(null,_0x51325a?_0x51325a:![]);})[_0xd73b('0x16')](function(_0x3e0e8d){_0x19f676(_0x3e0e8d);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x22')]=function(_0x4bd1b2,_0x534887,_0x5d3f9e){this[_0xd73b('0xf')][_0xd73b('0x22')](_0x4bd1b2,_0x534887)[_0xd73b('0x12')](function(){_0x5d3f9e(null);})['catch'](function(_0x536bd0){_0x5d3f9e(_0x536bd0);});};AGIVertices['prototype'][_0xd73b('0x23')]=function(_0xb16eec,_0x42b9e4){this[_0xd73b('0xe')]['getIntervalById'](_0xb16eec)[_0xd73b('0x12')](function(_0x378076){if(_0x378076){if(_0x378076[_0xd73b('0x24')]){_0x42b9e4(null,[_0x378076[_0xd73b('0x25')]]);}else{_0x42b9e4(null,_[_0xd73b('0x26')](_0x378076['Intervals'],_0xd73b('0x25')));}}else{_0x42b9e4(null,![]);}})[_0xd73b('0x16')](function(_0xb3563){_0x42b9e4(_0xb3563);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1f')]=function(_0x41a188){return util[_0xd73b('0x27')](_0xd73b('0x28'),FILES_PATH,_0x41a188);};AGIVertices['prototype']['getQueryOdbc']=function(_0x5d75f2,_0x373ed9,_0x59b128){odbc[_0xd73b('0x29')](_0x5d75f2,function(_0x42f8dd){if(_0x42f8dd){logger[_0xd73b('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x42f8dd);_0x59b128(_0x42f8dd);}else{logger[_0xd73b('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0xd73b('0x2c')](_0x373ed9,function(_0x418608,_0x33135a){if(_0x418608){logger[_0xd73b('0x2b')]('Error\x20executing\x20query\x20%s',_0x373ed9);_0x59b128(_0x418608);}else{logger[_0xd73b('0x2b')](_0xd73b('0x2d'),_0x373ed9);odbc['close'](function(_0x557411){if(_0x557411){logger[_0xd73b('0x2a')](_0xd73b('0x2e'),_0x557411);}_0x59b128(null,_0x33135a);});}});}});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x2f')]=function(_0x5156a7,_0x3ebfa1){this[_0xd73b('0xe')][_0xd73b('0x30')](_0x5156a7)['then'](function(_0x529347){_0x3ebfa1(null,_0x529347?_0x529347:![]);})['catch'](function(_0x5b8f4f){_0x3ebfa1(_0x5b8f4f);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x31')]=function(_0x48e2fa,_0x593646){this[_0xd73b('0xe')]['createSmsMessage'](_0x48e2fa)[_0xd73b('0x12')](function(_0x143562){_0x593646(null,_0x143562);})[_0xd73b('0x16')](function(_0x26b275){_0x593646(_0x26b275);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x2c82ec,_0x415476,_0x2ad83e){this[_0xd73b('0xe')][_0xd73b('0x32')]({'uniqueid':this[_0xd73b('0x33')][_0xd73b('0x34')],'node':_0x2c82ec['label'],'application':_0x2c82ec[_0xd73b('0x35')],'data':_0x415476||null,'project_name':this[_0xd73b('0x33')][_0xd73b('0x36')],'callerid':this[_0xd73b('0x33')]['callerid']})[_0xd73b('0x12')](function(_0x484dea){if(_0x2ad83e){_0x2ad83e(null,_0x484dea);}})[_0xd73b('0x16')](function(_0x45c017){if(_0x2ad83e){_0x2ad83e(_0x45c017);}});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x37')]=function(_0x326c68,_0x2277ef,_0x825860,_0x212970){this[_0xd73b('0xe')][_0xd73b('0x37')]({'uniqueid':this[_0xd73b('0x33')]['uniqueid'],'callerid':this[_0xd73b('0x33')][_0xd73b('0x38')],'calleridname':this[_0xd73b('0x33')][_0xd73b('0x39')],'context':this['channel']['context'],'extension':this[_0xd73b('0x33')][_0xd73b('0x3a')],'priority':this[_0xd73b('0x33')][_0xd73b('0x3b')],'accountcode':this[_0xd73b('0x33')][_0xd73b('0x3c')],'dnid':this['channel'][_0xd73b('0x3d')],'projectName':this[_0xd73b('0x33')][_0xd73b('0x36')],'saveName':_0x2277ef,'filename':_0x326c68['file']||_0x2277ef,'savePath':_0x825860})['then'](function(_0x590948){_0x212970(null,_0x590948);})[_0xd73b('0x16')](function(_0x5f1473){_0x212970(_0x5f1473);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x3e')]=function(_0x5c48c0,_0x4add6e,_0x2c9fbd){this[_0xd73b('0xe')]['createSquareMessage']({'uniqueid':this[_0xd73b('0x33')]['uniqueid'],'body':_0x5c48c0,'direction':_0x4add6e})['then'](function(_0x5c1764){if(_0x2c9fbd){_0x2c9fbd(null,_0x5c1764);}})['catch'](function(_0xcf20b2){if(_0x2c9fbd){_0x2c9fbd(_0xcf20b2);}});};AGIVertices['prototype']['createCmContact']=function(_0x41091d,_0x5efb7c){console[_0xd73b('0x3f')]('in\x20createcmcontact',_0x41091d);console['log'](_0xd73b('0x40'),_0x5efb7c);var _0x3e2f40=0x0;if(_[_0xd73b('0x41')](_0x41091d,_0xd73b('0x42'))){if(!_[_0xd73b('0x43')](_0x41091d[_0xd73b('0x42')])){var _0x1fadd2=_0x41091d[_0xd73b('0x42')];console[_0xd73b('0x3f')](_0xd73b('0x44'),_0x1fadd2);if(_0x41091d['dialTimezone']==_0xd73b('0x45')){this[_0xd73b('0xe')][_0xd73b('0x46')]({'phone':_0x41091d[_0xd73b('0x47')]})[_0xd73b('0x12')](function(_0x58c639){console[_0xd73b('0x3f')](_0xd73b('0x48'),_0x58c639);_0x5efb7c(null,_0x58c639);});}else{console[_0xd73b('0x3f')](_0xd73b('0x49'),shared[_0x1fadd2]);}}}this['rpc'][_0xd73b('0x4a')]({'firstName':_['isEmpty'](_0x41091d[_0xd73b('0x15')])||_[_0xd73b('0x43')](_0x41091d[_0xd73b('0x15')])?_0xd73b('0x4b')+Math['random']():_0x41091d[_0xd73b('0x15')],'lastName':_[_0xd73b('0x4c')](_0x41091d[_0xd73b('0x4d')])||_[_0xd73b('0x43')](_0x41091d[_0xd73b('0x4d')])?null:_0x41091d[_0xd73b('0x4d')],'phone':_0x41091d[_0xd73b('0x47')],'ListId':_0x41091d['list_id'],'scheduledat':_0x41091d[_0xd73b('0x4e')],'callbackUniqueid':this[_0xd73b('0x33')][_0xd73b('0x34')],'tags':'callback','description':_0xd73b('0x4f')+_0x41091d[_0xd73b('0x4e')]['toString'](),'priority':_0x41091d[_0xd73b('0x50')]})['then'](function(_0x26f5b7){_0x5efb7c(null,_0x26f5b7);})['catch'](function(_0x32eb29){_0x5efb7c(_0x32eb29);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x51')]=function(_0x2381c9,_0x4614b8){this[_0xd73b('0xe')]['getPauseById'](_0x2381c9)[_0xd73b('0x12')](function(_0x5d6faa){_0x4614b8(null,_0x5d6faa?_0x5d6faa[_0xd73b('0x15')]:![]);})['catch'](function(_0x104d4e){_0x4614b8(_0x104d4e);});};AGIVertices[_0xd73b('0x10')]['agentPause']=function(_0x45dcc5,_0x4b095e,_0x5112a9){var _0x33c1b8={'role':_0xd73b('0x52')};_0x33c1b8[_0x45dcc5]=this['channel']['callerid'];this[_0xd73b('0xe')][_0xd73b('0x53')](_0x33c1b8,_0x4b095e,this[_0xd73b('0x33')][_0xd73b('0x34')])['then'](function(_0x5d2206){_0x5112a9(null,_[_0xd73b('0x43')](_0x5d2206)?![]:!![]);})[_0xd73b('0x16')](function(_0x350f14){logger[_0xd73b('0x2a')](_0x350f14);_0x5112a9(null,![]);});};AGIVertices['prototype'][_0xd73b('0x54')]=function(_0x481cfb,_0x4964c3){var _0x2ebb3e={'role':_0xd73b('0x52')};_0x2ebb3e[_0x481cfb]=this[_0xd73b('0x33')][_0xd73b('0x38')];this[_0xd73b('0xe')][_0xd73b('0x54')](_0x2ebb3e)[_0xd73b('0x12')](function(_0xd4d0ab){_0x4964c3(null,_[_0xd73b('0x43')](_0xd4d0ab)?![]:!![]);})[_0xd73b('0x16')](function(_0x5aa38b){logger[_0xd73b('0x2a')](_0x5aa38b);_0x4964c3(null,![]);});};AGIVertices['prototype'][_0xd73b('0x55')]=function(_0x2a4b72,_0x100b10){var _0x1eb661={'role':_0xd73b('0x52')};_0x1eb661[_0x2a4b72]=this['channel'][_0xd73b('0x38')];this[_0xd73b('0xe')][_0xd73b('0x55')](_0x1eb661)['then'](function(_0x2200ed){_0x100b10(null,_[_0xd73b('0x43')](_0x2200ed)?![]:!![]);})[_0xd73b('0x16')](function(_0x593606){logger[_0xd73b('0x2a')](_0x593606);_0x100b10(null,![]);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x56')]=function(_0x42cfd7,_0x584b99){var _0x39ef41={'role':_0xd73b('0x52')};_0x39ef41[_0x42cfd7]=this[_0xd73b('0x33')][_0xd73b('0x38')];var _0x3a9689=_0x42cfd7!='internal'?util[_0xd73b('0x27')](_0xd73b('0x57'),_0xd73b('0x58'),this['channel']['callerid']):undefined;this[_0xd73b('0xe')][_0xd73b('0x56')](_0x39ef41,_0x3a9689)[_0xd73b('0x12')](function(_0x49947f){_0x584b99(null,_[_0xd73b('0x43')](_0x49947f)?![]:!![]);})[_0xd73b('0x16')](function(_0x5677b4){logger[_0xd73b('0x2a')](_0x5677b4);_0x584b99(null,![]);});};AGIVertices[_0xd73b('0x10')]['shellCommand']=function(_0x1b9fe1,_0x2f426c){sh[_0xd73b('0x59')](_[_0xd73b('0x5a')](_0x1b9fe1),function(_0x58cab9,_0xbdf41e){var _0x2c6511=_0xbdf41e['replace'](/(\r\n|\n|\r)/gm,'');_0x2f426c(null,_0x2c6511);});};AGIVertices['prototype'][_0xd73b('0x5b')]=function(_0x7e5182,_0x1a81cb){scripts[_0xd73b('0x5b')](_0x7e5182['apiKey'],_0x7e5182[_0xd73b('0x5c')]||_0xd73b('0x5d'),_0x7e5182[_0xd73b('0x5d')],_0x7e5182[_0xd73b('0x5e')]||_0xd73b('0x5f'),_0x7e5182['ssmlGender']||_0xd73b('0x60'),_0x7e5182['audioEncoding']||_0xd73b('0x61'))[_0xd73b('0x12')](function(_0x594c76){_0x1a81cb(null,_0x594c76);})[_0xd73b('0x16')](function(_0x34c4d3){_0x1a81cb(_0x34c4d3);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x62')]=function(_0x47960d,_0x15d09d){scripts['googleTTS'](_0x47960d[_0xd73b('0x5d')],_0x47960d['google_tts_language']||'en',0x1)[_0xd73b('0x12')](function(_0x963746){_0x15d09d(null,_0x963746);})[_0xd73b('0x16')](function(_0x1739c8){_0x15d09d(_0x1739c8);});};AGIVertices['prototype'][_0xd73b('0x63')]=function(_0xbad79a,_0x2851e2){var _0x179b1d={'uri':_0xbad79a[_0xd73b('0x64')],'method':_0xbad79a[_0xd73b('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xbad79a['timeout'])==='number'&&parseInt(_0xbad79a[_0xd73b('0x66')])>=0x1?parseInt(_0xbad79a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xd73b('0x67')]([_0xd73b('0x68'),_0xd73b('0x69')],_0x179b1d[_0xd73b('0x65')][_0xd73b('0x6a')]())){try{_0x179b1d[_0xd73b('0x6b')]=_0xbad79a[_0xd73b('0xb')]?JSON[_0xd73b('0x6c')](_0xbad79a[_0xd73b('0xb')]):{};}catch(_0x211e23){logger[_0xd73b('0x2a')](_0xd73b('0x6d'),_0x211e23);}}try{_0x179b1d[_0xd73b('0x6e')]=_0xbad79a[_0xd73b('0xa')]?JSON[_0xd73b('0x6c')](_0xbad79a[_0xd73b('0xa')]):{};}catch(_0x7255ee){logger[_0xd73b('0x2a')](_0xd73b('0x6f'),_0x7255ee);}if(_0xbad79a[_0xd73b('0x70')]){try{var _0x500090=require(_0xbad79a['computedVariables'])[_0xd73b('0x71')](this,_0x179b1d);_0x179b1d[_0xd73b('0x72')]=Mustache['render'](_0xbad79a[_0xd73b('0x64')],_0x500090,{},['$$','$$']);if(_0x179b1d[_0xd73b('0x6e')]){_0x179b1d[_0xd73b('0x6e')]=JSON[_0xd73b('0x6c')](Mustache[_0xd73b('0x73')](JSON[_0xd73b('0x74')](_0x179b1d['headers']),_0x500090,{},['$$','$$']));}if(_0x179b1d['body']){_0x179b1d['body']=JSON[_0xd73b('0x6c')](Mustache['render'](JSON[_0xd73b('0x74')](_0x179b1d[_0xd73b('0x6b')]),_0x500090,{},['$$','$$']));}}catch(_0xd54ddb){logger['error'](_0xd73b('0x75'),_0xd54ddb);}}rp(_0x179b1d)['then'](function(_0x488b2d){var _0x39c0e4={'statusCode':_0x488b2d[_0xd73b('0x76')]||0xc8,'statusMessage':_0x488b2d['statusMessage']||'OK','headers':_0x488b2d[_0xd73b('0x6e')]||{},'body':_0x488b2d[_0xd73b('0x6b')]||{}};_0x2851e2(null,_0x39c0e4);})[_0xd73b('0x16')](function(_0x4ca124){var _0x34514c={'statusCode':_0x4ca124['statusCode']||0x1f4,'statusMessage':_0x4ca124[_0xd73b('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4ca124[_0xd73b('0x78')]['headers']||{},'body':_0x4ca124[_0xd73b('0x78')][_0xd73b('0x6b')]||{}};_0x2851e2(null,_0x34514c);});};AGIVertices['prototype'][_0xd73b('0x79')]=function(_0x43e294,_0x31eb69){scripts[_0xd73b('0x79')](this[_0xd73b('0x33')]['uniqueid'],_0x43e294[_0xd73b('0x7a')],_0x43e294[_0xd73b('0x5d')],_0x43e294['dialogflow_language']||'en')[_0xd73b('0x12')](function(_0x1c2337){_0x31eb69(null,_0x1c2337);})[_0xd73b('0x16')](function(_0x3f19ef){_0x31eb69(_0x3f19ef);});};AGIVertices['prototype'][_0xd73b('0x7b')]=function(_0x5d19d1,_0x39e1e8){scripts[_0xd73b('0x7b')](this['channel'],_0x5d19d1)[_0xd73b('0x12')](function(_0x1f95b4){_0x39e1e8(null,_0x1f95b4);})['catch'](function(_0x1d8862){_0x39e1e8(_0x1d8862);});};AGIVertices['prototype'][_0xd73b('0x7c')]=function(_0x9b4769,_0x5373e9){scripts[_0xd73b('0x7c')](_0x9b4769[_0xd73b('0x7a')],_0x9b4769['text'],_0x9b4769[_0xd73b('0x7d')]||_0xd73b('0x5f'),_0x9b4769[_0xd73b('0x7e')])[_0xd73b('0x12')](function(_0x228d51){_0x5373e9(null,_0x228d51);})[_0xd73b('0x16')](function(_0x2fcbd1){_0x5373e9(_0x2fcbd1);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x7f')]=function(_0x2c07c6,_0x28efd0,_0x137ec8){scripts[_0xd73b('0x7f')](_0x28efd0,_0x2c07c6[_0xd73b('0x7a')],_0x2c07c6[_0xd73b('0x80')]||_0xd73b('0x5f'),this['isConfigured'](_0x2c07c6[_0xd73b('0x81')])?_0x2c07c6['model']:undefined)[_0xd73b('0x12')](function(_0x4d6d49){_0x137ec8(null,_0x4d6d49);})[_0xd73b('0x16')](function(_0x3f1347){_0x137ec8(_0x3f1347);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x82')]=function(_0xde6554,_0x4fdca0){scripts['awsPolly'](_0xde6554['aws_access_key_id'],_0xde6554['aws_secret_access_key'],_0xde6554[_0xd73b('0x83')],_0xde6554['aws_polly_voice']||'Amy',_0xde6554['text'],_0xde6554['aws_text_type']||'text')['then'](function(_0xbf7cfb){_0x4fdca0(null,_0xbf7cfb);})['catch'](function(_0x56f02c){_0x4fdca0(_0x56f02c);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x84')]=function(_0x39765f,_0x34d04e){scripts[_0xd73b('0x84')](this[_0xd73b('0x33')][_0xd73b('0x34')],_0x39765f['aws_access_key_id'],_0x39765f[_0xd73b('0x85')],_0x39765f['aws_lex_region'],_0x39765f[_0xd73b('0x5d')],_0x39765f[_0xd73b('0x86')])['then'](function(_0x568995){_0x34d04e(null,_0x568995);})['catch'](function(_0x14fef5){_0x34d04e(_0x14fef5);});};AGIVertices['prototype'][_0xd73b('0x87')]=function(_0x3b1a8d,_0x4410ae,_0x2187dc){scripts[_0xd73b('0x87')](_0x4410ae,_0x3b1a8d['key'],_0x3b1a8d[_0xd73b('0x88')]||_0xd73b('0x5f'))[_0xd73b('0x12')](function(_0x27a81e){_0x2187dc(null,_0x27a81e);})[_0xd73b('0x16')](function(_0x22ba9f){_0x2187dc(_0x22ba9f);});};AGIVertices[_0xd73b('0x10')][_0xd73b('0x89')]=function(_0xd2a634,_0x5dcbd5,_0x341c10){scripts[_0xd73b('0x89')](_0x5dcbd5,_0xd2a634['appid'],_0xd2a634[_0xd73b('0x8a')],_0xd2a634[_0xd73b('0x72')])[_0xd73b('0x12')](function(_0x4d0fd0){_0x341c10(null,_0x4d0fd0);})[_0xd73b('0x16')](function(_0x10e289){_0x341c10(_0x10e289);});};AGIVertices[_0xd73b('0x10')]['clear']=function(_0x56ba5d){var _0x283721=_[_0xd73b('0x67')](verticesWithRetry,_0x56ba5d[_0xd73b('0x35')])?_0x56ba5d:_[_0xd73b('0x8b')](_0x56ba5d);for(var _0x295e72 in _0x283721){if(_0x283721['hasOwnProperty'](_0x295e72)){if(_0x283721[_0x295e72]&&_[_0xd73b('0x8c')](_0x283721[_0x295e72])){if(_[_0xd73b('0x67')](recursiveMapAttributes,_0x295e72)){_0x283721[_0x295e72]=this[_0xd73b('0x8d')](_0x283721[_0x295e72]);}else{_0x283721[_0x295e72]=this[_0xd73b('0x8e')](_0x283721[_0x295e72]);}}}}return _0x283721;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x8f')]=function(_0x349f43){for(var _0x2ae4d1 in _0x349f43){if(_0x349f43[_0xd73b('0x90')](_0x2ae4d1)){if(_[_0xd73b('0x91')](_0x349f43[_0x2ae4d1])){this['recursiveNodeIndex'](_0x349f43[_0x2ae4d1]);}else if(_[_0xd73b('0x92')](_0x349f43[_0x2ae4d1])){for(var _0x2bb27a=0x0;_0x2bb27a<_0x349f43[_0x2ae4d1]['length'];_0x2bb27a++){this[_0xd73b('0x8f')](_0x349f43[_0x2ae4d1][_0x2bb27a]);}}else if(_['isString'](_0x349f43[_0x2ae4d1])){_0x349f43[_0x2ae4d1]=this[_0xd73b('0x8e')](_0x349f43[_0x2ae4d1]);}}}};AGIVertices['prototype'][_0xd73b('0x93')]=function(_0x4de56c,_0x2fcf0d){for(var _0x4c4cad in _0x4de56c){if(_0x4de56c[_0xd73b('0x90')](_0x4c4cad)){if(_[_0xd73b('0x91')](_0x4de56c[_0x4c4cad])){if(!_[_0xd73b('0x4c')](_0x4de56c[_0x4c4cad])){this[_0xd73b('0x93')](_0x4de56c[_0x4c4cad],util[_0xd73b('0x27')](_0xd73b('0x94'),_0x2fcf0d,_0x4c4cad));}}else if(_[_0xd73b('0x92')](_0x4de56c[_0x4c4cad])){for(var _0x1e2569=0x0;_0x1e2569<_0x4de56c[_0x4c4cad]['length'];_0x1e2569++){this[_0xd73b('0x93')](_0x4de56c[_0x4c4cad][_0x1e2569],util['format'](_0xd73b('0x94'),_0x2fcf0d,_0x4c4cad+'['+_0x1e2569+']'));}}else{if(!_['isNil'](_0x4de56c[_0x4c4cad])){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x94'),_0x2fcf0d,_0x4c4cad),_0x4de56c[_0x4c4cad]);}}}}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x8d')]=function(_0x4d276e){try{var _0x191f4b=JSON['parse'](_0x4d276e);this[_0xd73b('0x8f')](_0x191f4b);return JSON[_0xd73b('0x74')](_0x191f4b);}catch(_0x42e1bc){return this[_0xd73b('0x8e')](_0x4d276e);}};AGIVertices['prototype'][_0xd73b('0x8e')]=function(_0x5f55f2){console['log'](_0xd73b('0x96'),_0x5f55f2);var _0x12fe93=_0x5f55f2['split']('{');for(var _0x54f5d0=0x1;_0x54f5d0<_0x12fe93['length'];_0x54f5d0+=0x1){var _0x25287b=_0x12fe93[_0x54f5d0][_0xd73b('0x97')]('}');console[_0xd73b('0x3f')]('nextbracket',_0x25287b);if(_0x25287b[_0xd73b('0x98')]>0x1){_0x5f55f2=_0x5f55f2[_0xd73b('0x99')]('{'+_0x25287b[0x0]+'}',this['channel']['getVariable'](_0x25287b[0x0])['extra']||_0x25287b[0x0]);}}if(_0x12fe93[_0xd73b('0x98')]===0x1){return _0x5f55f2[_0xd73b('0x9a')]();}console['log'](_0xd73b('0x9b'),_0x5f55f2);return this[_0xd73b('0x8e')](_0x5f55f2);};AGIVertices[_0xd73b('0x10')]['getAndSetVariable']=function(_0x5d7c3d,_0x374f32){var _0x54729a=this['channel']['getVariable'](_0x5d7c3d);if(_0x54729a[_0xd73b('0x9c')]===-0x1){return _0x54729a;}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x9d'),_0x374f32,_0x54729a['extra']));return this[_0xd73b('0x33')][_0xd73b('0x95')](_0x374f32,_0x54729a[_0xd73b('0x9e')]);};AGIVertices['prototype'][_0xd73b('0x9f')]=function(_0x4a11ca){return _0x4a11ca&&_0x4a11ca!=='0'&&_0x4a11ca!=='-1'&&_0x4a11ca!=='';};AGIVertices[_0xd73b('0x10')][_0xd73b('0xa0')]=function(_0x2e7568){this['createSquareDetailsReport']['sync'](this,_0x2e7568,'-');_0x2e7568[_0xd73b('0xa1')]=_0x2e7568[_0xd73b('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd73b('0x10')][_0xd73b('0xa2')]=function(_0x185bd2){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0xa3'),_0x185bd2['label']));if(!this[_0xd73b('0x9f')](_0x185bd2['text'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}var _0x11db80='\x22'+_0x185bd2['text']+'\x22';if(this[_0xd73b('0x9f')](_0x185bd2[_0xd73b('0x78')])){_0x11db80+=','+_0x185bd2['options'];}var _0x481149=this['channel'][_0xd73b('0x59')](_0xd73b('0xa6'),_0x11db80);if(_0x481149[_0xd73b('0x9c')]===-0x1){return _0x481149;}return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0xa7'),_0x11db80));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xa8')]=function(_0x122eb){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xa9'),_0x122eb['label']));if(!this[_0xd73b('0x9f')](_0x122eb[_0xd73b('0xaa')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20grammar\x20configured');}var _0x35864b=_0x122eb[_0xd73b('0xaa')];if(this[_0xd73b('0x9f')](_0x122eb[_0xd73b('0x78')])){_0x35864b+=','+_0x122eb[_0xd73b('0x78')];}var _0x2acd77=this[_0xd73b('0x33')][_0xd73b('0x59')]('MRCPRecog',_0x35864b);if(_0x2acd77[_0xd73b('0x9c')]===-0x1){return _0x2acd77;}var _0x468a20=this[_0xd73b('0xab')](_0xd73b('0xac'),_0xd73b('0xad'));if(_0x468a20[_0xd73b('0x9c')]===-0x1){return _0x468a20;}var _0x1309e7=this[_0xd73b('0xab')](_0xd73b('0xae'),_0xd73b('0xaf'));if(_0x1309e7[_0xd73b('0x9c')]===-0x1){return _0x1309e7;}var _0x29c721=this['getAndSetVariable'](_0xd73b('0xb0'),_0xd73b('0xb1'));if(_0x29c721[_0xd73b('0x9c')]===-0x1){return _0x29c721;}return this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xb2'),_0x35864b));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x7')]=function(_0x29f796){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xb3'),_0x29f796[_0xd73b('0xb4')]));return this[_0xd73b('0x33')]['agi']([_0x29f796['command'],_0x29f796[_0xd73b('0xb5')]]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0xb6')]=function(_0xa7e8c6){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xb7'),_0xa7e8c6['label']));if(this[_0xd73b('0x9f')](_0xa7e8c6[_0xd73b('0x66')])){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xb8'),_0xa7e8c6['timeout']));var _0x28ba0a=this[_0xd73b('0x33')]['wait'](_0xa7e8c6[_0xd73b('0x66')]);if(_0x28ba0a[_0xd73b('0x9c')]===-0x1){return _0x28ba0a;}}return this[_0xd73b('0x33')][_0xd73b('0xb6')]();};AGIVertices['prototype'][_0xd73b('0xb9')]=function(_0x519269){console['log'](_0xd73b('0xba'),_0x519269);logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xbb'),_0x519269[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x519269[_0xd73b('0xbc')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x519269,_0xd73b('0xbd'));}_0x519269['scheduledAt']=moment();if(this[_0xd73b('0x9f')](_0x519269[_0xd73b('0xbe')])){_0x519269[_0xd73b('0x4e')]=moment()[_0xd73b('0xbf')](_0x519269[_0xd73b('0xbe')],_0xd73b('0xc0'));}if(!this[_0xd73b('0x9f')](_0x519269[_0xd73b('0x50')])){_0x519269[_0xd73b('0x50')]=0x2;}console[_0xd73b('0x3f')](_0xd73b('0xc1'),_0x519269);this[_0xd73b('0x4a')][_0xd73b('0x71')](this,_0x519269);return this['channel'][_0xd73b('0xa4')](util['format'](_0xd73b('0xc2'),_0x519269[_0xd73b('0x47')],_0x519269[_0xd73b('0xbc')],_0x519269[_0xd73b('0x4e')]));};AGIVertices['prototype'][_0xd73b('0xc3')]=function(_0x12d1dd){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x12d1dd['label']));var _0xaa4775=this[_0xd73b('0x33')][_0xd73b('0x59')](_0x12d1dd[_0xd73b('0xc4')],_0x12d1dd[_0xd73b('0x78')]);if(_0xaa4775[_0xd73b('0x9c')]===-0x1){return _0xaa4775;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xc5'),_0x12d1dd['application'],_0x12d1dd[_0xd73b('0x78')]));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xc6')]=function(_0x4bc33e){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xc7'),_0x4bc33e[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x4bc33e[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20text\x20configured');}var _0x2ef41e='\x22'+_0x4bc33e[_0xd73b('0x5d')]+'\x22';if(this[_0xd73b('0x9f')](_0x4bc33e[_0xd73b('0x78')])){_0x2ef41e+=','+_0x4bc33e['options'];}var _0x3c1e9d=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xa6'),_0x2ef41e);if(_0x3c1e9d['result']===-0x1){return _0x3c1e9d;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2ef41e));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xc8')]=function(_0x2df483){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xc9'),_0x2df483[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x2df483[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20text\x20configured');}var _0x48d48f='\x22'+_0x2df483[_0xd73b('0x5d')]+'\x22';if(this[_0xd73b('0x9f')](_0x2df483[_0xd73b('0x78')])){_0x48d48f+=','+_0x2df483['options'];}var _0x20c6ad=this[_0xd73b('0x33')][_0xd73b('0x59')]('MRCPSynth',_0x48d48f);if(_0x20c6ad[_0xd73b('0x9c')]===-0x1){return _0x20c6ad;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x48d48f));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xca')]=function(_0x2c483a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xcb'),_0x2c483a[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x2c483a[_0xd73b('0xaa')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xcc'));}var _0x5dc88f=_0x2c483a['grammar'];if(this[_0xd73b('0x9f')](_0x2c483a[_0xd73b('0x78')])){_0x5dc88f+=','+_0x2c483a['options'];}var _0x421887=this['channel'][_0xd73b('0x59')](_0xd73b('0xcd'),_0x5dc88f);if(_0x421887['result']===-0x1){return _0x421887;}var _0x241c13=this[_0xd73b('0xab')]('RECOG_CONFIDENCE()',_0xd73b('0xce'));if(_0x241c13['result']===-0x1){return _0x241c13;}var _0x4eb970=this['getAndSetVariable'](_0xd73b('0xae'),_0xd73b('0xcf'));if(_0x4eb970[_0xd73b('0x9c')]===-0x1){return _0x4eb970;}var _0x5bdebd=this[_0xd73b('0xab')](_0xd73b('0xb0'),_0xd73b('0xd0'));if(_0x5bdebd[_0xd73b('0x9c')]===-0x1){return _0x5bdebd;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5dc88f));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xd1')]=function(_0x52f7d1){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0xd2'),_0x52f7d1[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x52f7d1[_0xd73b('0xaa')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xcc'));}var _0x574940=_0x52f7d1[_0xd73b('0xaa')];if(this['isConfigured'](_0x52f7d1['options'])){_0x574940+=','+_0x52f7d1[_0xd73b('0x78')];}var _0x201f40=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xcd'),_0x574940);if(_0x201f40['result']===-0x1){return _0x201f40;}var _0x47d7a8=this[_0xd73b('0xab')](_0xd73b('0xac'),'SESTEK_ASR_CONFIDENCE');if(_0x47d7a8['result']===-0x1){return _0x47d7a8;}var _0xc84431=this[_0xd73b('0xab')](_0xd73b('0xae'),_0xd73b('0xd3'));if(_0xc84431[_0xd73b('0x9c')]===-0x1){return _0xc84431;}var _0x71534d=this[_0xd73b('0xab')]('RECOG_INSTANCE()',_0xd73b('0xd4'));if(_0x71534d[_0xd73b('0x9c')]===-0x1){return _0x71534d;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x574940));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xd5')]=function(_0x5c5a9b){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5c5a9b[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x5c5a9b['odbc_id'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x5c5a9b,'no\x20database\x20selected');}var _0x35107a=this['getSquareOdbc'][_0xd73b('0x71')](this,_0x5c5a9b['odbc_id']);if(!_0x35107a){return this[_0xd73b('0x33')]['error'](_0x5c5a9b,_0xd73b('0xd6'));}if(!this[_0xd73b('0x9f')](_0x5c5a9b[_0xd73b('0x2c')])){return this['channel'][_0xd73b('0x2a')](_0x5c5a9b,'no\x20query\x20configured');}var _0x5e99c9=_0x5c5a9b[_0xd73b('0x2c')][_0xd73b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xd8'),_0x5e99c9));var _0x247988=this[_0xd73b('0xd9')][_0xd73b('0x71')](this,_0x35107a,_0x5e99c9);this[_0xd73b('0x32')]['sync'](this,_0x5c5a9b,_0x5e99c9);if(!this[_0xd73b('0x9f')](_0x5c5a9b[_0xd73b('0xda')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x8c52a8=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x5c5a9b['variable_id']);if(!_0x8c52a8){return this['channel'][_0xd73b('0x2a')](_0x5c5a9b,_0xd73b('0xdb'));}var _0x2cad2f=this;_0x247988['forEach'](function(_0xb3e848,_0x5c037d){Object[_0xd73b('0xdc')](_0xb3e848)['forEach'](function(_0x1eb1e0){_0x2cad2f[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0xdd'),_0x8c52a8,_0x5c037d,_0x1eb1e0),_0xb3e848[_0x1eb1e0]);});});this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')]('%s_ROWS_COUNT',_0x8c52a8),_0x247988[_0xd73b('0x98')]);return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('variable\x20%s\x20set',_0x8c52a8));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xde')]=function(_0x47dc4b){logger[_0xd73b('0xdf')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x47dc4b[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x47dc4b[_0xd73b('0xe0')])){return this['channel'][_0xd73b('0x2a')](_0x47dc4b,_0xd73b('0xe1'));}var _0x456af9=this[_0xd73b('0xe2')][_0xd73b('0x71')](this,_0x47dc4b[_0xd73b('0xe0')]);if(!_0x456af9){return this['channel'][_0xd73b('0x2a')](_0x47dc4b,_0xd73b('0xe3'));}var _0x4e1bca=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xe4'),[util[_0xd73b('0x27')]('SIP/%s',_0x456af9),_0x47dc4b[_0xd73b('0x66')],_0x47dc4b[_0xd73b('0xe5')],_0x47dc4b['url']]);if(_0x4e1bca['result']===-0x1){return _0x4e1bca;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xe6'),'DIAL'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xe7')]=function(_0x1a03e1){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xe8'),_0x1a03e1[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x1a03e1[_0xd73b('0x7a')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xe9'));}if(!this[_0xd73b('0x9f')](_0x1a03e1[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')][_0xd73b('0xea')]=!![];this[_0xd73b('0x32')](_0x1a03e1);this[_0xd73b('0x3e')](_0x1a03e1['text'],'in');this['channel'][_0xd73b('0xa4')](util['format']('Trying\x20Dialogflow:\x20%s',_0x1a03e1[_0xd73b('0x5d')]));var _0x39951f=this[_0xd73b('0x79')][_0xd73b('0x71')](this,_0x1a03e1);if(_0x39951f){for(var _0x195a59 in _0x39951f){if(_0x39951f[_0xd73b('0x90')](_0x195a59)){this[_0xd73b('0x33')]['setVariable'](util[_0xd73b('0x27')](_0xd73b('0xeb'),_0x195a59[_0xd73b('0x6a')]()),_0x39951f[_0x195a59]);}}this[_0xd73b('0x3e')](_0x39951f['speech'],'out');return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Dialogflow\x20Result\x20%s',_0x39951f['speech']));}return this[_0xd73b('0x33')]['error'](_0x1a03e1,_0xd73b('0xec'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0xed')]=function(_0x116756){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x116756[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x116756[_0xd73b('0xee')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xef'));}if(!this['isConfigured'](_0x116756[_0xd73b('0xf0')])){return this['channel']['noop'](_0xd73b('0xf1'));}if(!this[_0xd73b('0x9f')](_0x116756[_0xd73b('0xf2')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xf3'));}if(!this['isConfigured'](_0x116756['ndassistant_url'])){return this['channel'][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')]['bot']=!![];this['createSquareDetailsReport'](_0x116756);this['createSquareMessage'](_0x116756[_0xd73b('0x5d')],'in');this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Trying\x20SestekNDA:\x20%s',_0x116756[_0xd73b('0x5d')]));var _0x3e5607=this[_0xd73b('0x7b')][_0xd73b('0x71')](this,_0x116756);if(_0x3e5607){for(var _0x17aa79 in _0x3e5607){if(_0x3e5607['hasOwnProperty'](_0x17aa79)){this['channel'][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0xf4'),_0x17aa79[_0xd73b('0x6a')]()),_0x3e5607[_0x17aa79]);}}this['createSquareMessage'](_0x3e5607[_0xd73b('0xf5')],_0xd73b('0xf6'));if(_0x3e5607['audiofile']){this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xf7'),_0x3e5607[_0xd73b('0xf8')]));var _0x56533b=this[_0xd73b('0x33')]['streamFile'](_0x3e5607['audiofile']);try{fs['unlink'](_0x3e5607[_0xd73b('0xf8')]+_0xd73b('0xf9'));}catch(_0x57540b){logger[_0xd73b('0x2a')](_0x57540b);}return _0x56533b;}else{return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')]('SestekNDA\x20Result\x20%s',_0x3e5607[_0xd73b('0xf5')]));}}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x116756,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xd73b('0xfa')]=function(_0x5286e8){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x5286e8[_0xd73b('0xb4')]));return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xfa'));};AGIVertices['prototype'][_0xd73b('0xfb')]=function(_0x475893){logger['info'](util[_0xd73b('0x27')](_0xd73b('0xfc'),_0x475893['label']));var _0x3c2d66='';if(_0x475893[_0xd73b('0xfd')]){if(!this[_0xd73b('0x9f')](_0x475893['trunk_id'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x475893,_0xd73b('0xfe'));}else{var _0x4e8308=parseInt(_0x475893[_0xd73b('0xfd')],0xa);if(isNaN(_0x4e8308)){_0x3c2d66=_0x475893[_0xd73b('0xfd')];}else{_0x3c2d66=this[_0xd73b('0x1b')][_0xd73b('0x71')](this,_0x475893[_0xd73b('0xfd')]);if(!_0x3c2d66){return this['channel'][_0xd73b('0x2a')](_0x475893,_0xd73b('0xff'));}}}}else if(_0x475893[_0xd73b('0x100')]){_0x3c2d66=_0x475893[_0xd73b('0x100')];}else{return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x475893,'no\x20trunk\x20selected');}var _0x262ec2=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0xe4'),[util[_0xd73b('0x27')](_0xd73b('0x101'),_0x3c2d66,_0x475893[_0xd73b('0x47')]),_0x475893[_0xd73b('0x66')],_0x475893[_0xd73b('0xe5')],_0x475893[_0xd73b('0x64')]]);if(_0x262ec2['result']===-0x1){return _0x262ec2;}return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0xe6'),_0xd73b('0xe4')));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x102')]=function(_0x5c4529){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5c4529[_0xd73b('0xb4')]));return this[_0xd73b('0x33')]['noop'](_0xd73b('0x102'));};AGIVertices[_0xd73b('0x10')]['getdigits']=function(_0x3c33b3){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x103'),_0x3c33b3[_0xd73b('0xb4')]));if(_0x3c33b3['retry']===0x0){return this[_0xd73b('0xa0')](_0x3c33b3);}_0x3c33b3[_0xd73b('0xa1')]-=0x1;if(!this[_0xd73b('0x9f')](_0x3c33b3[_0xd73b('0x104')])){return this[_0xd73b('0x33')]['error'](_0x3c33b3,_0xd73b('0x105'));}var _0xc333e4=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x3c33b3['file_id']);if(!_0xc333e4){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3c33b3,'no\x20file\x20audio\x20found');}if(!this[_0xd73b('0x9f')](_0x3c33b3[_0xd73b('0xda')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18dcb4=this[_0xd73b('0x33')][_0xd73b('0x106')](_0xc333e4,_0x3c33b3['response'],_0x3c33b3['maxdigit']);var _0x4859ef=_0x18dcb4[_0xd73b('0x9c')]?_0x18dcb4[_0xd73b('0x9c')][_0xd73b('0x9a')]():'';logger[_0xd73b('0x2b')](_0xd73b('0x107'),JSON[_0xd73b('0x74')](_0x18dcb4));if(_0x18dcb4['result']===-0x1){this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,_0x4859ef);return _0x18dcb4;}else if(_0x18dcb4['extra']===_0xd73b('0x66')){_0x18dcb4[_0xd73b('0x9c')]=_0x4859ef[_0xd73b('0x98')]>=parseInt(_0x3c33b3[_0xd73b('0x108')])?'x':'i';}else{_0x18dcb4[_0xd73b('0x9c')]=_0x4859ef[_0xd73b('0x98')]>=parseInt(_0x3c33b3['mindigit'])&&_0x4859ef[_0xd73b('0x98')]<=parseInt(_0x3c33b3[_0xd73b('0x109')])?'x':'i';}var _0x5f44a0=this['getVariable'][_0xd73b('0x71')](this,_0x3c33b3[_0xd73b('0xda')]);if(!_0x5f44a0){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3c33b3,'no\x20variable\x20found');}this[_0xd73b('0x33')][_0xd73b('0x95')](_0x5f44a0,_0x4859ef);if(this[_0xd73b('0x9f')](_0x3c33b3[_0xd73b('0x10a')])){var _0x541d91=parseInt(_0x3c33b3['hiddendigitsnum'],0xa);var _0x2a2eee=rs[_0xd73b('0x10b')]({'charset':'*','length':_0x541d91});var _0x11992d=_0x4859ef[_0xd73b('0x98')];if(_0x11992d>0x0){if(_0x11992d>_0x541d91){this[_0xd73b('0x32')]['sync'](this,_0x3c33b3,_0x3c33b3['hiddendigitspos']==='first'?_0x2a2eee+_0x4859ef[_0xd73b('0x10c')](_0x541d91):_0x4859ef[_0xd73b('0x10c')](0x0,_0x11992d-_0x541d91)+_0x2a2eee);}else{this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,rs['generate']({'charset':'*','length':_0x11992d}));}}else{this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,'');}}else{this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3c33b3,_0x4859ef);}return _0x18dcb4;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x10d')]=function(_0x43fdac){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x43fdac[_0xd73b('0xb4')]));return this['getdigits'](_0x43fdac);};AGIVertices['prototype'][_0xd73b('0x10e')]=function(_0x3b5740){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x10f'),_0x3b5740[_0xd73b('0xb4')]));this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3b5740,_0x3b5740[_0xd73b('0x110')]);return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x111'),_0x3b5740['goalname']));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x112')]=function(_0x2d3645){logger[_0xd73b('0x2b')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2d3645[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x2d3645[_0xd73b('0x113')])||!this['isConfigured'](_0x2d3645[_0xd73b('0x85')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x114'));}if(!this[_0xd73b('0x9f')](_0x2d3645['text'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x115'),_0x2d3645[_0xd73b('0x5d')]));var _0x3c8a84=this[_0xd73b('0x82')][_0xd73b('0x71')](this,_0x2d3645);if(_0x3c8a84){this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x116'),_0x3c8a84));var _0x523c74=this[_0xd73b('0x33')][_0xd73b('0x117')](_0x3c8a84);try{fs[_0xd73b('0x118')](_0x3c8a84+'.wav');}catch(_0x24f92a){logger[_0xd73b('0x2a')](_0x24f92a);}return _0x523c74;}return this['channel']['error'](_0x2d3645,_0xd73b('0x119'));};AGIVertices[_0xd73b('0x10')]['awslex']=function(_0x5420b3){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x11a'),_0x5420b3[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x5420b3[_0xd73b('0x113')])||!this[_0xd73b('0x9f')](_0x5420b3['aws_secret_access_key'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd73b('0x9f')](_0x5420b3[_0xd73b('0x86')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0x11b'));}if(!this[_0xd73b('0x9f')](_0x5420b3[_0xd73b('0x5d')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this[_0xd73b('0x33')][_0xd73b('0xea')]=!![];this[_0xd73b('0x32')](_0x5420b3);this[_0xd73b('0x3e')](_0x5420b3['text'],'in');this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x11c'),_0x5420b3[_0xd73b('0x5d')]));var _0x7cc87c=this[_0xd73b('0x84')]['sync'](this,_0x5420b3);if(_0x7cc87c){for(var _0x597d48 in _0x7cc87c){if(_0x7cc87c[_0xd73b('0x90')](_0x597d48)&&_[_0xd73b('0x8c')](_0x7cc87c[_0x597d48])){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x11d'),_0x597d48[_0xd73b('0x6a')]()),_0x7cc87c[_0x597d48]);}}if(_[_0xd73b('0x43')](_0x7cc87c[_0xd73b('0x77')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xd73b('0x3e')](_0x7cc87c[_0xd73b('0x77')],_0xd73b('0xf6'));return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x7cc87c[_0xd73b('0x77')]));}}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x5420b3,_0xd73b('0x11e'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x11f')]=function(_0x4309cc){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x120'),_0x4309cc['label'],_0x4309cc[_0xd73b('0x66')]));if(!this[_0xd73b('0x9f')](_0x4309cc['key'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20key\x20configured');}var _0x262886=_0xd73b('0x121');var _0xadad16=util[_0xd73b('0x27')](_0xd73b('0x122'),FILES_PATH,rs[_0xd73b('0x10b')](0x4));var _0xaabb9b=util[_0xd73b('0x27')](_0xd73b('0x94'),_0xadad16,_0x262886);var _0x5a5b0f=!![];if(_0x4309cc[_0xd73b('0x123')]===_0xd73b('0x124')){_0x5a5b0f=![];}var _0x4beb23=this[_0xd73b('0x33')][_0xd73b('0x125')](_0xadad16,_0x262886,_0x4309cc[_0xd73b('0x126')],_0x4309cc[_0xd73b('0x66')],undefined,_0x5a5b0f);if(_0x4beb23[_0xd73b('0x9c')]!==-0x1){this[_0xd73b('0x33')]['noop'](util['format'](_0xd73b('0x127'),_0xaabb9b));var _0xae64b2=this[_0xd73b('0x87')][_0xd73b('0x71')](this,_0x4309cc,_0xaabb9b);if(_0xae64b2){for(var _0x15accb in _0xae64b2){if(_0xae64b2[_0xd73b('0x90')](_0x15accb)){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x128'),_0x15accb[_0xd73b('0x6a')]()),_0xae64b2[_0x15accb]);}}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x129'),JSON[_0xd73b('0x74')](_0xae64b2)));}}return _0x4beb23;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x12a')]=function(_0x424431){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x12b'),_0x424431['label']));if(!this[_0xd73b('0x9f')](_0x424431[_0xd73b('0x12c')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x12d'));}if(!this[_0xd73b('0x9f')](_0x424431[_0xd73b('0x8a')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0x12e'));}var _0x1047b6=_0xd73b('0x121');var _0x5b7b13=util[_0xd73b('0x27')](_0xd73b('0x122'),FILES_PATH,rs['generate'](0x4));var _0x5706bd=util[_0xd73b('0x27')]('%s.%s',_0x5b7b13,_0x1047b6);var _0x39b855=!![];if(_0x424431[_0xd73b('0x123')]===_0xd73b('0x124')){_0x39b855=![];}var _0xc7c1b5=this[_0xd73b('0x33')][_0xd73b('0x125')](_0x5b7b13,_0x1047b6,_0x424431['intKey'],_0x424431[_0xd73b('0x66')],undefined,_0x39b855);if(_0xc7c1b5[_0xd73b('0x9c')]!==-0x1){this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x12f'),_0x5706bd));var _0x2827bf=this['tildeASR']['sync'](this,_0x424431,_0x5706bd);if(_0x2827bf){for(var _0x11f622 in _0x2827bf){if(_0x2827bf[_0xd73b('0x90')](_0x11f622)){this[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x130'),_0x11f622[_0xd73b('0x6a')]()),_0x2827bf[_0x11f622]);}}return this[_0xd73b('0x33')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x2827bf)));}}return _0xc7c1b5;};AGIVertices[_0xd73b('0x10')]['gotoc']=function(_0x4467dc){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x131'),_0x4467dc[_0xd73b('0xb4')]));return this[_0xd73b('0x33')][_0xd73b('0x132')](_0x4467dc[_0xd73b('0x133')],_0x4467dc[_0xd73b('0x3a')],_0x4467dc[_0xd73b('0x3b')]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0x134')]=function(_0xe7d5be){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x135'),_0xe7d5be[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0xe7d5be[_0xd73b('0x136')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0xe7d5be,'no\x20condition\x20configured');}try{var _0x4dd5cb=eval(_0xe7d5be[_0xd73b('0x136')])?_0xd73b('0x137'):_0xd73b('0x138');this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x139'),_0xe7d5be[_0xd73b('0x136')],_0x4dd5cb));return{'code':0xc8,'result':_0x4dd5cb};}catch(_0x30a92f){return{'code':0xc8,'result':_0xd73b('0x138')};}};AGIVertices[_0xd73b('0x10')]['gotoiftime']=function(_0x1152a0){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x13a'),_0x1152a0[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x1152a0[_0xd73b('0x13b')])){return this['channel']['error'](_0x1152a0,'no\x20interval\x20configured');}var _0x34acbc=this[_0xd73b('0x23')]['sync'](this,_0x1152a0[_0xd73b('0x13b')]);if(!_0x34acbc){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x1152a0,_0xd73b('0x13c'));}for(var _0x4e7559=0x0;_0x4e7559<_0x34acbc[_0xd73b('0x98')];_0x4e7559+=0x1){var _0x3ffd03=this[_0xd73b('0x33')][_0xd73b('0x11')](util[_0xd73b('0x27')](_0xd73b('0x13d'),_0x34acbc[_0x4e7559]));if(_0x3ffd03[_0xd73b('0x9c')]===-0x1){return _0x3ffd03;}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('IFTIME\x20%s\x20%s',_0x34acbc[_0x4e7559],_0x3ffd03['extra']));if(_0x3ffd03[_0xd73b('0x9e')]===_0xd73b('0x137')){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('IFTIME\x20%s\x20%s',_0x34acbc[_0x4e7559],_0xd73b('0x137')));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('IFTIME\x20%s\x20%s',_0x34acbc[_0x4e7559],_0xd73b('0x137')));return{'code':0xc8,'result':_0xd73b('0x137')};}else{logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x13e'),_0x34acbc[_0x4e7559],_0xd73b('0x138')));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x13e'),_0x34acbc[_0x4e7559],_0xd73b('0x138')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xd73b('0x13f')]=function(_0x213a90){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x140'),_0x213a90[_0xd73b('0xb4')]));return this['channel'][_0xd73b('0x13f')]();};AGIVertices[_0xd73b('0x10')][_0xd73b('0x141')]=function(_0x479c8f){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x479c8f['label']));if(!this[_0xd73b('0x9f')](_0x479c8f[_0xd73b('0x7a')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x3f7c89=_0xd73b('0x121');var _0x5b0540=util['format'](_0xd73b('0x122'),FILES_PATH,rs[_0xd73b('0x10b')](0x4));var _0x5e65a3=util[_0xd73b('0x27')](_0xd73b('0x94'),_0x5b0540,_0x3f7c89);var _0x581283=!![];if(_0x479c8f[_0xd73b('0x123')]==='NOBEEP'){_0x581283=![];}var _0x1433a2=this[_0xd73b('0x33')][_0xd73b('0x125')](_0x5b0540,_0x3f7c89,_0x479c8f['intKey'],_0x479c8f['timeout'],undefined,_0x581283);if(_0x1433a2['result']!==-0x1){this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('ispeech\x20%s\x20file\x20created',_0x5e65a3));var _0x794bfe=this[_0xd73b('0x7f')]['sync'](this,_0x479c8f,_0x5e65a3);if(_0x794bfe){for(var _0x1a3141 in _0x794bfe){if(_0x794bfe[_0xd73b('0x90')](_0x1a3141)){this[_0xd73b('0x33')][_0xd73b('0x95')](util['format'](_0xd73b('0x142'),_0x1a3141['toUpperCase']()),_0x794bfe[_0x1a3141]);}}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x143'),JSON[_0xd73b('0x74')](_0x794bfe)));}}return _0x1433a2;};AGIVertices[_0xd73b('0x10')][_0xd73b('0x144')]=function(_0x62755e){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x145'),_0x62755e[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x62755e[_0xd73b('0x7a')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xe9'));}if(!this['isConfigured'](_0x62755e[_0xd73b('0x5d')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0xa5'));}this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x146'),_0x62755e['text']));var _0x340e37=this['ispeechTTS'][_0xd73b('0x71')](this,_0x62755e);if(_0x340e37){this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x147'),_0x340e37));var _0x431892=this[_0xd73b('0x33')]['streamFile'](_0x340e37,_0x62755e[_0xd73b('0x126')]);try{fs[_0xd73b('0x118')](_0x340e37+_0xd73b('0xf9'));}catch(_0x5d1d57){logger[_0xd73b('0x2a')](_0x5d1d57);}return _0x431892;}return this['channel'][_0xd73b('0x2a')](_0x62755e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xd73b('0x148')]=function(_0x597553){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x597553[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x597553['findBy'])){return this[_0xd73b('0x33')]['error'](_0x597553,_0xd73b('0x149'));}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14a'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));var _0x151911=this[_0xd73b('0x56')][_0xd73b('0x71')](this,_0x597553['findBy']);if(_0x151911){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x14d'),this['channel'][_0xd73b('0x38')],_0x597553[_0xd73b('0x14b')]));this[_0xd73b('0x33')]['noop'](util['format'](_0xd73b('0x14d'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x597553['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x14e')]=function(_0x5a62dc){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x14f'),_0x5a62dc['label']));if(!this[_0xd73b('0x9f')](_0x5a62dc[_0xd73b('0x14b')])){return this[_0xd73b('0x33')]['error'](_0x5a62dc,_0xd73b('0x149'));}logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14a'),this['channel'][_0xd73b('0x38')],_0x5a62dc[_0xd73b('0x14b')]));var _0x1e4c8d=this[_0xd73b('0x55')][_0xd73b('0x71')](this,_0x5a62dc[_0xd73b('0x14b')]);if(_0x1e4c8d){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5a62dc[_0xd73b('0x14b')]));this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this['channel'][_0xd73b('0x38')],_0x5a62dc['findBy']));return{'code':0xc8,'result':_0xd73b('0x150')};}else{logger['info'](util[_0xd73b('0x27')](_0xd73b('0x14d'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5a62dc[_0xd73b('0x14b')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14d'),this[_0xd73b('0x33')]['callerid'],_0x5a62dc[_0xd73b('0x14b')]));return{'code':0xc8,'result':_0xd73b('0x151')};}};AGIVertices['prototype'][_0xd73b('0x152')]=function(_0x28005a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x28005a[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x28005a[_0xd73b('0x153')])){return this['channel'][_0xd73b('0x2a')](_0x28005a,'no\x20operation\x20configured');}this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x154'),_0x28005a[_0xd73b('0x153')]));var _0xd4669a=eval(_0x28005a[_0xd73b('0x153')]);if(!this[_0xd73b('0x9f')](_0x28005a[_0xd73b('0xda')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x155'));}var _0x12efb=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x28005a[_0xd73b('0xda')]);if(!_0x12efb){return this[_0xd73b('0x33')]['error'](_0x28005a,'no\x20variable\x20found');}if(_[_0xd73b('0x92')](_0xd4669a)){var _0x4ecf85=this;_0xd4669a[_0xd73b('0x156')](function(_0x1f8d16,_0x5f3c76){_0x4ecf85[_0xd73b('0x33')][_0xd73b('0x95')](util[_0xd73b('0x27')](_0xd73b('0x157'),_0x12efb,_0x5f3c76),_0x1f8d16);});return this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x158'),_0x12efb));}else{return this[_0xd73b('0x33')][_0xd73b('0x95')](_0x12efb,_0xd4669a);}};AGIVertices['prototype'][_0xd73b('0xc')]=function(_0x249635){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x249635[_0xd73b('0xb4')]));if(_0x249635['retry']===0x0){return this[_0xd73b('0xa0')](_0x249635);}_0x249635[_0xd73b('0xa1')]-=0x1;if(!this[_0xd73b('0x9f')](_0x249635[_0xd73b('0x104')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x249635,_0xd73b('0x105'));}var _0x188683=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x249635[_0xd73b('0x104')]);if(!_0x188683){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x249635,_0xd73b('0x159'));}var _0x4855e9=this['channel']['getData'](_0x188683,_0x249635[_0xd73b('0x15a')],_0x249635[_0xd73b('0x15b')]);var _0xe17ef0=_0x4855e9[_0xd73b('0x9c')];if(_0x4855e9[_0xd73b('0x9c')]===-0x1){this['createSquareDetailsReport'][_0xd73b('0x71')](this,_0x249635,'-1');return _0x4855e9;}else if(_0x4855e9['extra']===_0xd73b('0x66')){_0x4855e9['result']=_0x4855e9[_0xd73b('0x9c')][_0xd73b('0x98')]>0x0?_0x4855e9[_0xd73b('0x9c')]:'t';}else if(_['isEmpty'](_0x4855e9[_0xd73b('0x9c')])){_0x4855e9[_0xd73b('0x9c')]='#';_0xe17ef0='#';}if(!this[_0xd73b('0x9f')](_0x249635[_0xd73b('0xda')])){this[_0xd73b('0x33')][_0xd73b('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x52c51d=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x249635['variable_id']);if(!_0x52c51d){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x249635,'no\x20variable\x20found');}this[_0xd73b('0x33')]['setVariable'](_0x52c51d,_0xe17ef0);}this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x249635,_0xe17ef0);return _0x4855e9;};AGIVertices['prototype'][_0xd73b('0xa4')]=function(_0x568183){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x15c'),_0x568183['label']));return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0x568183['output']||_0x568183[_0xd73b('0xb4')]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0x15d')]=function(_0x5e2380){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x15e'),_0x5e2380[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x5e2380[_0xd73b('0x14b')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x5e2380,_0xd73b('0x149'));}logger[_0xd73b('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5e2380[_0xd73b('0x14b')]));var _0x1f5994=this[_0xd73b('0x51')][_0xd73b('0x71')](this,_0x5e2380[_0xd73b('0x15f')]);var _0x33de69=this[_0xd73b('0x53')][_0xd73b('0x71')](this,_0x5e2380['findBy'],_0x1f5994);if(_0x33de69){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xd73b('0x38')],_0x5e2380['findBy']));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')]['callerid'],_0x5e2380[_0xd73b('0x14b')]));return{'code':0xc8,'result':_0xd73b('0x150')};}else{logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5e2380['findBy']));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x5e2380[_0xd73b('0x14b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x160')]=function(_0x4fb19d){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x161'),_0x4fb19d[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x4fb19d['file_id'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4fb19d,_0xd73b('0x105'));}var _0x16e7d8=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x4fb19d[_0xd73b('0x104')]);if(!_0x16e7d8){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4fb19d,_0xd73b('0x159'));}var _0x317987=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0x162'),[_0x16e7d8,_0x4fb19d[_0xd73b('0xe5')]]);if(_0x317987[_0xd73b('0x9c')]===-0x1){return _0x317987;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0xd73b('0x162'),_0x16e7d8));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x163')]=function(_0x3f34a0){logger['info'](util['format'](_0xd73b('0x164'),_0x3f34a0[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x3f34a0[_0xd73b('0x165')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3f34a0,_0xd73b('0x166'));}var _0x508ba1='';var _0x51c5e9=parseInt(_0x3f34a0['queue_id'],0xa);if(isNaN(_0x51c5e9)){_0x508ba1=_0x3f34a0[_0xd73b('0x165')];}else{_0x508ba1=this[_0xd73b('0x13')]['sync'](this,_0x3f34a0[_0xd73b('0x165')]);if(!_0x508ba1){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x3f34a0,_0xd73b('0x167'));}}var _0x2fe3c3='';if(this['isConfigured'](_0x3f34a0[_0xd73b('0x104')])){var _0x3af351=this[_0xd73b('0x1d')][_0xd73b('0x71')](this,_0x3f34a0[_0xd73b('0x104')]);if(_0x3af351){_0x2fe3c3=_0x3af351;}}this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x3f34a0,_0x508ba1);if(_0x3f34a0['opts'][_0xd73b('0x168')]('x')<0x0){_0x3f34a0[_0xd73b('0xe5')]+='x';}if(_0x3f34a0['opts'][_0xd73b('0x168')]('X')<0x0){_0x3f34a0[_0xd73b('0xe5')]+='X';}this[_0xd73b('0x33')][_0xd73b('0x95')]('XMCS-QUEUE',_0x508ba1?_0x508ba1[_0xd73b('0x169')]():'');var _0x6e13fd=this[_0xd73b('0x33')]['exec'](_0xd73b('0x16a'),[_0x508ba1,_0x3f34a0[_0xd73b('0xe5')],_0x3f34a0[_0xd73b('0x64')],_0x2fe3c3,_0x3f34a0[_0xd73b('0x66')],_0x3f34a0[_0xd73b('0x7')],_0x3f34a0[_0xd73b('0x16b')],_0x3f34a0[_0xd73b('0x16c')],'',_0x3f34a0[_0xd73b('0x16d')]]);if(_0x6e13fd[_0xd73b('0x9c')]===-0x1){return _0x6e13fd;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0xc5'),_0xd73b('0x16a'),_0x508ba1));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x16e')]=function(_0x377685){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x377685[_0xd73b('0xb4')]));var _0x1de58f=_0x377685[_0xd73b('0x16f')]||_0xd73b('0x121');var _0x3535ec=util[_0xd73b('0x27')](_0xd73b('0x170'),this[_0xd73b('0x33')]['uniqueid'],rs[_0xd73b('0x10b')](0x5));var _0x2f4e08=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x3535ec,_0x1de58f);var _0xd808f9=util['format'](_0xd73b('0x122'),FILES_PATH,_0x3535ec);this['createSquareRecording']['sync'](this,_0x377685,_0x3535ec,_0x2f4e08);this['channel']['setVariable'](_0xd73b('0x171'),_0x3535ec);logger[_0xd73b('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xd808f9,_0x1de58f,_0x377685['escape_digits'],_0x377685[_0xd73b('0x66')]);return this[_0xd73b('0x33')][_0xd73b('0x125')](_0xd808f9,_0x1de58f,_0x377685[_0xd73b('0x172')],_0x377685[_0xd73b('0x66')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x48591d){logger['info'](util['format'](_0xd73b('0x173'),_0x48591d[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x48591d[_0xd73b('0x64')])){return this['channel'][_0xd73b('0xa4')](_0xd73b('0x174'));}var _0x55d7bf=this[_0xd73b('0x63')][_0xd73b('0x71')](this,_0x48591d);logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x175'),util[_0xd73b('0x176')](_0x55d7bf,{'showHidden':![],'depth':null})));if(!this[_0xd73b('0x9f')](_0x48591d[_0xd73b('0xda')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x177'));}var _0x54fe73=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x48591d[_0xd73b('0xda')]);if(!_0x54fe73){return this['channel']['error'](_0x48591d,'no\x20variable\x20found');}this['channel']['setVariable'](util['format'](_0xd73b('0x178'),_0x54fe73),_0x55d7bf[_0xd73b('0x76')]?_0x55d7bf[_0xd73b('0x76')]:_0xd73b('0x179'));this[_0xd73b('0x33')]['setVariable'](util[_0xd73b('0x27')](_0xd73b('0x17a'),_0x54fe73),_0x55d7bf[_0xd73b('0x17b')]?_0x55d7bf[_0xd73b('0x17b')]:'OK');if(_0x55d7bf[_0xd73b('0x6b')]){try{this[_0xd73b('0x93')](_0x55d7bf[_0xd73b('0x6b')],_0x54fe73);}catch(_0x2ee7a8){logger[_0xd73b('0x2a')](util[_0xd73b('0x27')](_0xd73b('0x17c'),_0x54fe73));}}return this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x17d'),_0x54fe73));};AGIVertices['prototype'][_0xd73b('0x17e')]=function(_0x5e1514){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x17f'),_0x5e1514[_0xd73b('0xb4')]));return this['channel'][_0xd73b('0x180')](_0x5e1514[_0xd73b('0x181')][_0xd73b('0xd7')](/\s+/g,''),_0x5e1514[_0xd73b('0x172')]);};AGIVertices[_0xd73b('0x10')]['saynumber']=function(_0x1f12ae){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x182'),_0x1f12ae[_0xd73b('0xb4')]));return this[_0xd73b('0x33')]['sayNumber'](_0x1f12ae['number']['replace'](/\s+/g,''),_0x1f12ae[_0xd73b('0x172')]);};AGIVertices[_0xd73b('0x10')]['sayphonetic']=function(_0x55376f){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x183'),_0x55376f['label']));return this[_0xd73b('0x33')][_0xd73b('0x184')](_0x55376f[_0xd73b('0x5d')],_0x55376f[_0xd73b('0x172')]);};AGIVertices[_0xd73b('0x10')][_0xd73b('0x185')]=function(_0x30dc50){logger['info'](util[_0xd73b('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x30dc50[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x30dc50[_0xd73b('0x186')])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0x187'));}var _0x19f9ad=this[_0xd73b('0x21')][_0xd73b('0x71')](this,_0x30dc50[_0xd73b('0x186')]);if(!_0x19f9ad||!_0x19f9ad[_0xd73b('0x188')]){return this['channel'][_0xd73b('0x2a')](_0x30dc50,_0xd73b('0x189'));}var _0x1df58a={'from':util['format'](_0xd73b('0x18a'),_0x19f9ad[_0xd73b('0x15')],_0x19f9ad[_0xd73b('0x18b')]||_0x19f9ad['Smtp']['user']),'to':_0x30dc50['to']||'','cc':_0x30dc50['cc']||'','bcc':_0x30dc50['bcc']||'','subject':_0x30dc50[_0xd73b('0x18c')],'html':_0x30dc50[_0xd73b('0x5d')],'text':_0x30dc50[_0xd73b('0x5d')]};var _0x2ecfe2={'tls':{'rejectUnauthorized':![]}};if(_0x19f9ad[_0xd73b('0x188')]['service']){_0x2ecfe2[_0xd73b('0x18d')]=_0x19f9ad[_0xd73b('0x188')][_0xd73b('0x18d')];}else{_0x2ecfe2[_0xd73b('0x18e')]=_0x19f9ad['Smtp']['host'];_0x2ecfe2[_0xd73b('0x18f')]=_0x19f9ad[_0xd73b('0x188')][_0xd73b('0x18f')];_0x2ecfe2[_0xd73b('0x190')]=_0x19f9ad['Smtp']['secure'];}if(_0x19f9ad[_0xd73b('0x188')][_0xd73b('0x191')]){_0x2ecfe2[_0xd73b('0x192')]={'user':_0x19f9ad['Smtp']['user'],'pass':_0x19f9ad[_0xd73b('0x188')]['pass']};}if(this['isConfigured'](_0x30dc50[_0xd73b('0x193')])){}logger[_0xd73b('0xdf')](_0xd73b('0x194'),JSON[_0xd73b('0x74')](_0x1df58a));this[_0xd73b('0x32')]['sync'](this,_0x30dc50,_0x30dc50[_0xd73b('0x186')]);this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x195'),_0x19f9ad[_0xd73b('0x15')]));this['sendMailMessage'][_0xd73b('0x71')](this,_0x2ecfe2,_0x1df58a);return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x196'));};AGIVertices['prototype'][_0xd73b('0x197')]=function(_0x3e320b){logger[_0xd73b('0x2b')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3e320b[_0xd73b('0xb4')]));return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x198'));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x199')]=function(_0x205afa){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x205afa[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x205afa[_0xd73b('0x19a')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x19b'));}var _0x363cf7=this['getSmsAccount'][_0xd73b('0x71')](this,_0x205afa[_0xd73b('0x19a')]);if(!_0x363cf7){return this[_0xd73b('0x33')]['error'](_0x205afa,_0xd73b('0x19c'));}var _0x47c2e7={'body':_0x205afa[_0xd73b('0x19d')],'phone':_0x205afa['to']||'','SmsAccountId':_0x363cf7['id']};logger['debug'](_0xd73b('0x19e'),JSON['stringify'](_0x47c2e7));this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x205afa,_0x205afa[_0xd73b('0x19a')]);this[_0xd73b('0x33')]['noop'](util[_0xd73b('0x27')](_0xd73b('0x19f'),_0x363cf7[_0xd73b('0x15')]));this[_0xd73b('0x31')][_0xd73b('0x71')](this,_0x47c2e7);return this[_0xd73b('0x33')]['noop'](_0xd73b('0x1a0'));};AGIVertices[_0xd73b('0x10')]['set']=function(_0x7df637){logger['info'](util[_0xd73b('0x27')](_0xd73b('0x1a1'),_0x7df637[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x7df637[_0xd73b('0xda')])){return this['channel'][_0xd73b('0x2a')](_0x7df637,_0xd73b('0x1a2'));}var _0x3e6b0d=this[_0xd73b('0x11')]['sync'](this,_0x7df637[_0xd73b('0xda')]);if(!_0x3e6b0d){return this['channel'][_0xd73b('0x2a')](_0x7df637,_0xd73b('0xdb'));}return this[_0xd73b('0x33')][_0xd73b('0x95')](_0x3e6b0d,_0x7df637[_0xd73b('0x1a3')]);};AGIVertices['prototype']['start']=function(_0x18d2da){logger[_0xd73b('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x18d2da[_0xd73b('0xb4')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x1a4'));if(_0x18d2da['answer']===_0xd73b('0x1a5')){this[_0xd73b('0x33')][_0xd73b('0xa4')]('Answer');return this[_0xd73b('0x33')][_0xd73b('0xb6')]();}return this[_0xd73b('0x33')][_0xd73b('0xa4')]('Skipped\x20Answer');};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1a6')]=function(_0x4f35df){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x1a7'),_0x4f35df[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x4f35df[_0xd73b('0x1a8')])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4f35df,'no\x20subproject\x20selected');}var _0x527d2a=this['getSquareProject'][_0xd73b('0x71')](this,_0x4f35df['project_id']);if(!this[_0xd73b('0x9f')](_0x527d2a)){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x4f35df,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4f35df['project_id']));}if(_0x527d2a===this[_0xd73b('0x33')][_0xd73b('0x36')]){return this['channel'][_0xd73b('0x2a')](_0x4f35df,_0xd73b('0x1a9'));}this[_0xd73b('0x32')][_0xd73b('0x71')](this,_0x4f35df,_0x527d2a);var _0x21bef5=this[_0xd73b('0x33')][_0xd73b('0x59')](_0xd73b('0x1aa'),util['format'](_0xd73b('0x1ab'),config[_0xd73b('0x7')][_0xd73b('0x18e')]||_0xd73b('0x1ac'),_0x527d2a,this[_0xd73b('0x33')][_0xd73b('0x36')]));if(_0x21bef5[_0xd73b('0x9c')]===-0x1){return _0x21bef5;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20%s\x20%s',_0xd73b('0x1aa'),_0x527d2a));};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1ad')]=function(_0x14eca8){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x1ae'),_0x14eca8[_0xd73b('0xb4')]));var _0x3807ff=this[_0xd73b('0x1af')][_0xd73b('0x71')](this,_0x14eca8[_0xd73b('0x1b0')]);this[_0xd73b('0x32')]['sync'](this,_0x14eca8,_0x14eca8['command']);if(this[_0xd73b('0x9f')](_0x14eca8['variable_id'])){var _0xdcc0e7=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x14eca8['variable_id']);if(_0xdcc0e7){this['channel'][_0xd73b('0x95')](_0xdcc0e7,_0x3807ff);return this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x1b1'),_0x14eca8[_0xd73b('0x1b0')],_0xdcc0e7));}}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')](_0xd73b('0x1b2'),_0x14eca8[_0xd73b('0x1b0')]));};AGIVertices[_0xd73b('0x10')]['google_cloud_tts']=function(_0xaa47b2){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xaa47b2[_0xd73b('0xb4')]));_0xaa47b2['text']=_0xaa47b2[_0xd73b('0x5d')][_0xd73b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd73b('0x9f')](_0xaa47b2[_0xd73b('0x1b3')])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0x1b4'));}if(!this[_0xd73b('0x9f')](_0xaa47b2['text'])){return this[_0xd73b('0x33')]['noop'](_0xd73b('0xa5'));}this['channel'][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0xaa47b2['text']));var _0x1db312=this[_0xd73b('0x5b')][_0xd73b('0x71')](this,_0xaa47b2);if(_0x1db312){this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1db312));var _0x2aa278=this['channel']['streamFile'](_0x1db312);try{fs[_0xd73b('0x118')](_0x1db312+_0xd73b('0xf9'));}catch(_0x4543c6){logger['error'](_0x4543c6);}return _0x2aa278;}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0xaa47b2,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xd73b('0x1b5')]=function(_0x1d3ef6){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x1b6'),_0x1d3ef6[_0xd73b('0xb4')]));_0x1d3ef6[_0xd73b('0x5d')]=_0x1d3ef6[_0xd73b('0x5d')][_0xd73b('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd73b('0x9f')](_0x1d3ef6['text'])){return this[_0xd73b('0x33')][_0xd73b('0xa4')](_0xd73b('0xa5'));}this['channel'][_0xd73b('0xa4')](util['format'](_0xd73b('0x1b7'),_0x1d3ef6[_0xd73b('0x5d')]));var _0x36ce0e=this[_0xd73b('0x62')][_0xd73b('0x71')](this,_0x1d3ef6);if(_0x36ce0e){this[_0xd73b('0x33')][_0xd73b('0xa4')](util['format'](_0xd73b('0x1b8'),_0x36ce0e));var _0x355acc=this[_0xd73b('0x33')][_0xd73b('0x117')](_0x36ce0e);try{fs[_0xd73b('0x118')](_0x36ce0e+_0xd73b('0xf9'));}catch(_0x8aeeac){logger[_0xd73b('0x2a')](_0x8aeeac);}return _0x355acc;}return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x1d3ef6,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1b9')]=function(_0x1877b5){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x1ba'),_0x1877b5[_0xd73b('0xb4')]));if(!this[_0xd73b('0x9f')](_0x1877b5['findBy'])){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x1877b5,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd73b('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));var _0x29571a=this[_0xd73b('0x54')][_0xd73b('0x71')](this,_0x1877b5[_0xd73b('0x14b')]);if(_0x29571a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x14c'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xd73b('0x14d'),this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd73b('0x33')][_0xd73b('0x38')],_0x1877b5[_0xd73b('0x14b')]));return{'code':0xc8,'result':_0xd73b('0x151')};}};AGIVertices[_0xd73b('0x10')][_0xd73b('0x1bb')]=function(_0xe8aec2){logger[_0xd73b('0x2b')](util['format'](_0xd73b('0x1bc'),_0xe8aec2[_0xd73b('0xb4')]));var _0x49a239=this[_0xd73b('0x33')]['exec'](_0xd73b('0x1bd'),[_0xe8aec2['mailbox'],_0xe8aec2['options']]);if(_0x49a239[_0xd73b('0x9c')]===-0x1){return _0x49a239;}return this[_0xd73b('0x33')][_0xd73b('0xa4')](util[_0xd73b('0x27')]('Executed\x20command\x20%s\x20%s',_0xd73b('0x1bd'),_0xe8aec2[_0xd73b('0x1be')]));};AGIVertices['prototype'][_0xd73b('0x1bf')]=function(_0x185e6a){logger[_0xd73b('0x2b')](util[_0xd73b('0x27')](_0xd73b('0x1c0'),_0x185e6a[_0xd73b('0xb4')]));if(!this['isConfigured'](_0x185e6a[_0xd73b('0xda')])){return this['channel']['error'](_0x185e6a,_0xd73b('0x1a2'));}var _0x192b5d=this[_0xd73b('0x11')][_0xd73b('0x71')](this,_0x185e6a[_0xd73b('0xda')]);if(!_0x192b5d){return this[_0xd73b('0x33')][_0xd73b('0x2a')](_0x185e6a,_0xd73b('0xdb'));}var _0x230e18=this['channel']['getVariable'](_0x192b5d);return{'code':0xc8,'result':_0x230e18[_0xd73b('0x9e')]?_0x230e18[_0xd73b('0x9e')]:'-'};};String['prototype']['replaceAll']=function(_0x4d2e23,_0x2d3a59){return this[_0xd73b('0x97')](_0x4d2e23)[_0xd73b('0x1c1')](_0x2d3a59);};module[_0xd73b('0x1c2')]=AGIVertices; \ No newline at end of file +var _0xb0b9=['Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','success','voicemail','VOICEMAIL','mailbox','vswitch','path','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','prototype','getVariable','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isNil','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','isEmpty','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','nextbracket','replaceAll','extra','getAndSetVariable','result','setVariable','isConfigured','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','no\x20list\x20selected','delay','add','before\x20createcmcontact','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','sestektts','no\x20text\x20configured','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','opts','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getdigits','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','subject','service','host','port','secure','authentication','auth','user','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x497037,_0x38d1d7){_0x497037=_0x497037-0x0;var _0x53d6ef=_0xb0b9[_0x497037];return _0x53d6ef;};'use strict';var fs=require('fs');var path=require(_0x9b0b('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0x9b0b('0x1'));var odbc=require(_0x9b0b('0x2'))();var rs=require(_0x9b0b('0x3'));var moment=require(_0x9b0b('0x4'));var Mustache=require(_0x9b0b('0x5'));var rp=require(_0x9b0b('0x6'));var logger=require(_0x9b0b('0x7'))(_0x9b0b('0x8'));var config=require(_0x9b0b('0x9'));var shared=require(_0x9b0b('0xa'));var scripts=require(_0x9b0b('0xb'));var FILES_PATH=_0x9b0b('0xc');var recursiveMapAttributes=[_0x9b0b('0xd'),_0x9b0b('0xe')];var verticesWithRetry=['menu','getdigits',_0x9b0b('0xf')];var AGIVertices=function(_0x40c5e6,_0x22e8bd,_0x2b0384){this[_0x9b0b('0x10')]=_0x40c5e6;this[_0x9b0b('0x11')]=_0x22e8bd;this['mailRpc']=_0x2b0384;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x13')]=function(_0x2ae7a2,_0x40c06b){this['rpc']['getVariableById'](_0x2ae7a2)[_0x9b0b('0x14')](function(_0x4b3ed5){_0x40c06b(null,_0x4b3ed5?_0x4b3ed5[_0x9b0b('0x15')]:![]);})['catch'](function(_0x235d28){_0x40c06b(_0x235d28);});};AGIVertices[_0x9b0b('0x12')]['getVoiceQueue']=function(_0x5974af,_0x5f0555){this[_0x9b0b('0x11')][_0x9b0b('0x16')](_0x5974af)['then'](function(_0x248ff9){_0x5f0555(null,_0x248ff9?_0x248ff9[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x1e92c1){_0x5f0555(_0x1e92c1);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x18')]=function(_0x8ed071,_0x39e3d0){this[_0x9b0b('0x11')][_0x9b0b('0x19')](_0x8ed071)[_0x9b0b('0x14')](function(_0x3f2733){_0x39e3d0(null,_0x3f2733?_0x3f2733[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x51277a){_0x39e3d0(_0x51277a);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1a')]=function(_0x7cf37c,_0x57117b){this[_0x9b0b('0x11')][_0x9b0b('0x1b')](_0x7cf37c)[_0x9b0b('0x14')](function(_0x565d35){_0x57117b(null,_0x565d35?_0x565d35[_0x9b0b('0x1c')]:![]);})[_0x9b0b('0x17')](function(_0x27b8e3){_0x57117b(_0x27b8e3);});};AGIVertices[_0x9b0b('0x12')]['getUser']=function(_0x30bfe8,_0x408f70){this['rpc'][_0x9b0b('0x1d')](_0x30bfe8)[_0x9b0b('0x14')](function(_0x3f433c){_0x408f70(null,_0x3f433c?_0x3f433c[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x29b39c){_0x408f70(_0x29b39c);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1e')]=function(_0x1067be,_0x5771fd){this[_0x9b0b('0x11')][_0x9b0b('0x1f')](_0x1067be)[_0x9b0b('0x14')](function(_0x476482){_0x5771fd(null,_0x476482?_0x476482['name']:![]);})[_0x9b0b('0x17')](function(_0xb31c25){_0x5771fd(_0xb31c25);});};AGIVertices['prototype'][_0x9b0b('0x20')]=function(_0x1e25fb,_0x1a31ba){var _0x47a135=this;this[_0x9b0b('0x11')][_0x9b0b('0x21')](_0x1e25fb)[_0x9b0b('0x14')](function(_0x5507e1){_0x1a31ba(null,_0x5507e1?_0x47a135[_0x9b0b('0x22')](_0x5507e1[_0x9b0b('0x23')]):![]);})[_0x9b0b('0x17')](function(_0x22ce12){_0x1a31ba(_0x22ce12);});};AGIVertices['prototype'][_0x9b0b('0x24')]=function(_0xfa71df,_0x48d324){this[_0x9b0b('0x11')][_0x9b0b('0x25')](_0xfa71df)[_0x9b0b('0x14')](function(_0x976095){_0x48d324(null,_0x976095?_0x976095:![]);})[_0x9b0b('0x17')](function(_0x26e90c){_0x48d324(_0x26e90c);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x26')]=function(_0x4ef44d,_0x4afc53,_0x3fcf01){this['mailRpc'][_0x9b0b('0x26')](_0x4ef44d,_0x4afc53)['then'](function(){_0x3fcf01(null);})['catch'](function(_0x597d46){_0x3fcf01(_0x597d46);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x27')]=function(_0xff3528,_0x212b85){this[_0x9b0b('0x11')][_0x9b0b('0x28')](_0xff3528)[_0x9b0b('0x14')](function(_0x305169){if(_0x305169){if(_0x305169[_0x9b0b('0x29')]){_0x212b85(null,[_0x305169[_0x9b0b('0x2a')]]);}else{_0x212b85(null,_[_0x9b0b('0x2b')](_0x305169[_0x9b0b('0x2c')],_0x9b0b('0x2a')));}}else{_0x212b85(null,![]);}})['catch'](function(_0x2a4135){_0x212b85(_0x2a4135);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x22')]=function(_0x405f6a){return util[_0x9b0b('0x2d')](_0x9b0b('0x2e'),FILES_PATH,_0x405f6a);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x2f')]=function(_0x37007e,_0x23c47b,_0x37569e){odbc[_0x9b0b('0x30')](_0x37007e,function(_0x97d73a){if(_0x97d73a){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x97d73a);_0x37569e(_0x97d73a);}else{logger[_0x9b0b('0x31')](_0x9b0b('0x32'));odbc[_0x9b0b('0x33')](_0x23c47b,function(_0x141563,_0x3ff876){if(_0x141563){logger['info'](_0x9b0b('0x34'),_0x23c47b);_0x37569e(_0x141563);}else{logger[_0x9b0b('0x31')](_0x9b0b('0x35'),_0x23c47b);odbc[_0x9b0b('0x36')](function(_0x4d32b5){if(_0x4d32b5){logger['error'](_0x9b0b('0x37'),_0x4d32b5);}_0x37569e(null,_0x3ff876);});}});}});};AGIVertices['prototype'][_0x9b0b('0x38')]=function(_0x316d86,_0x17a764){this[_0x9b0b('0x11')][_0x9b0b('0x39')](_0x316d86)[_0x9b0b('0x14')](function(_0x4486ed){_0x17a764(null,_0x4486ed?_0x4486ed:![]);})[_0x9b0b('0x17')](function(_0x1e42bd){_0x17a764(_0x1e42bd);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x3a')]=function(_0x33c539,_0x4049ad){this[_0x9b0b('0x11')][_0x9b0b('0x3a')](_0x33c539)['then'](function(_0x5123f4){_0x4049ad(null,_0x5123f4);})['catch'](function(_0x42bf3f){_0x4049ad(_0x42bf3f);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x3b')]=function(_0x424d9b,_0x161871,_0x52d8db){this['rpc'][_0x9b0b('0x3b')]({'uniqueid':this[_0x9b0b('0x10')][_0x9b0b('0x3c')],'node':_0x424d9b[_0x9b0b('0x3d')],'application':_0x424d9b['agicommand'],'data':_0x161871||null,'project_name':this[_0x9b0b('0x10')][_0x9b0b('0x3e')],'callerid':this[_0x9b0b('0x10')][_0x9b0b('0x3f')]})[_0x9b0b('0x14')](function(_0x5c86ba){if(_0x52d8db){_0x52d8db(null,_0x5c86ba);}})[_0x9b0b('0x17')](function(_0x1d9b96){if(_0x52d8db){_0x52d8db(_0x1d9b96);}});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x40')]=function(_0x14e8a2,_0x1a4dbb,_0x444d95,_0x37a27a){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x9b0b('0x3c')],'callerid':this[_0x9b0b('0x10')][_0x9b0b('0x3f')],'calleridname':this[_0x9b0b('0x10')][_0x9b0b('0x41')],'context':this[_0x9b0b('0x10')][_0x9b0b('0x42')],'extension':this[_0x9b0b('0x10')][_0x9b0b('0x43')],'priority':this[_0x9b0b('0x10')][_0x9b0b('0x44')],'accountcode':this['channel'][_0x9b0b('0x45')],'dnid':this[_0x9b0b('0x10')]['dnid'],'projectName':this['channel'][_0x9b0b('0x3e')],'saveName':_0x1a4dbb,'filename':_0x14e8a2[_0x9b0b('0x46')]||_0x1a4dbb,'savePath':_0x444d95})[_0x9b0b('0x14')](function(_0x1ea242){_0x37a27a(null,_0x1ea242);})['catch'](function(_0x3c9675){_0x37a27a(_0x3c9675);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x47')]=function(_0x2ed8b4,_0x21f4c1,_0x1bfdca){this[_0x9b0b('0x11')][_0x9b0b('0x47')]({'uniqueid':this[_0x9b0b('0x10')]['uniqueid'],'body':_0x2ed8b4,'direction':_0x21f4c1})[_0x9b0b('0x14')](function(_0x5383d9){if(_0x1bfdca){_0x1bfdca(null,_0x5383d9);}})[_0x9b0b('0x17')](function(_0x5eb636){if(_0x1bfdca){_0x1bfdca(_0x5eb636);}});};AGIVertices['prototype'][_0x9b0b('0x48')]=function(_0x2238d1,_0x369752){console[_0x9b0b('0x49')](_0x9b0b('0x4a'),_0x2238d1);console[_0x9b0b('0x49')](_0x9b0b('0x4b'),_0x369752);var _0x495b3e=0x0;if(_['has'](_0x2238d1,'dialTimezone')){if(!_[_0x9b0b('0x4c')](_0x2238d1[_0x9b0b('0x4d')])){var _0x2a2420=_0x2238d1[_0x9b0b('0x4d')];console[_0x9b0b('0x49')](_0x9b0b('0x4e'),_0x2a2420);if(_0x2238d1['dialTimezone']==_0x9b0b('0x4f')){this[_0x9b0b('0x11')]['getContactByPhone']({'phone':_0x2238d1['phone']})['then'](function(_0x8f664e){console[_0x9b0b('0x49')]('RETVALRPC',_0x8f664e);_0x369752(null,_0x8f664e);});}else{console['log']('TZ\x20found\x20in\x20shared:',shared[_0x2a2420]);}}}this[_0x9b0b('0x11')][_0x9b0b('0x48')]({'firstName':_[_0x9b0b('0x50')](_0x2238d1[_0x9b0b('0x15')])||_[_0x9b0b('0x4c')](_0x2238d1[_0x9b0b('0x15')])?_0x9b0b('0x51')+Math[_0x9b0b('0x52')]():_0x2238d1[_0x9b0b('0x15')],'lastName':_[_0x9b0b('0x50')](_0x2238d1[_0x9b0b('0x53')])||_['isNil'](_0x2238d1[_0x9b0b('0x53')])?null:_0x2238d1[_0x9b0b('0x53')],'phone':_0x2238d1['phone'],'ListId':_0x2238d1[_0x9b0b('0x54')],'scheduledat':_0x2238d1[_0x9b0b('0x55')],'callbackUniqueid':this['channel'][_0x9b0b('0x3c')],'tags':_0x9b0b('0x56'),'description':_0x9b0b('0x57')+_0x2238d1[_0x9b0b('0x55')][_0x9b0b('0x58')](),'priority':_0x2238d1['callback_priority']})[_0x9b0b('0x14')](function(_0x26852a){_0x369752(null,_0x26852a);})[_0x9b0b('0x17')](function(_0x24270e){_0x369752(_0x24270e);});};AGIVertices['prototype']['getPause']=function(_0x25553d,_0xebf21a){this['rpc']['getPauseById'](_0x25553d)[_0x9b0b('0x14')](function(_0x3b714c){_0xebf21a(null,_0x3b714c?_0x3b714c[_0x9b0b('0x15')]:![]);})[_0x9b0b('0x17')](function(_0x36654a){_0xebf21a(_0x36654a);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x59')]=function(_0x18f35a,_0x4aa3a4,_0x53af3){var _0x38ff6d={'role':_0x9b0b('0x5a')};_0x38ff6d[_0x18f35a]=this[_0x9b0b('0x10')]['callerid'];this[_0x9b0b('0x11')]['agentPause'](_0x38ff6d,_0x4aa3a4,this[_0x9b0b('0x10')][_0x9b0b('0x3c')])[_0x9b0b('0x14')](function(_0x269991){_0x53af3(null,_[_0x9b0b('0x4c')](_0x269991)?![]:!![]);})['catch'](function(_0x168253){logger[_0x9b0b('0x5b')](_0x168253);_0x53af3(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x5c')]=function(_0x56b8cd,_0x2b2196){var _0x259340={'role':_0x9b0b('0x5a')};_0x259340[_0x56b8cd]=this[_0x9b0b('0x10')][_0x9b0b('0x3f')];this['rpc'][_0x9b0b('0x5c')](_0x259340)[_0x9b0b('0x14')](function(_0x51914d){_0x2b2196(null,_[_0x9b0b('0x4c')](_0x51914d)?![]:!![]);})[_0x9b0b('0x17')](function(_0x2f4de3){logger[_0x9b0b('0x5b')](_0x2f4de3);_0x2b2196(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x5d')]=function(_0x51b955,_0x23efce){var _0x1c0192={'role':_0x9b0b('0x5a')};_0x1c0192[_0x51b955]=this[_0x9b0b('0x10')][_0x9b0b('0x3f')];this[_0x9b0b('0x11')]['agentLogout'](_0x1c0192)[_0x9b0b('0x14')](function(_0x107595){_0x23efce(null,_['isNil'](_0x107595)?![]:!![]);})['catch'](function(_0x27e1f2){logger['error'](_0x27e1f2);_0x23efce(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x5e')]=function(_0x3024e6,_0x1572be){var _0x1d4eb2={'role':_0x9b0b('0x5a')};_0x1d4eb2[_0x3024e6]=this['channel'][_0x9b0b('0x3f')];var _0x1b73b8=_0x3024e6!=_0x9b0b('0x5f')?util[_0x9b0b('0x2d')](_0x9b0b('0x60'),_0x9b0b('0x61'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')]):undefined;this[_0x9b0b('0x11')][_0x9b0b('0x5e')](_0x1d4eb2,_0x1b73b8)[_0x9b0b('0x14')](function(_0x4479cf){_0x1572be(null,_[_0x9b0b('0x4c')](_0x4479cf)?![]:!![]);})[_0x9b0b('0x17')](function(_0x4b3558){logger[_0x9b0b('0x5b')](_0x4b3558);_0x1572be(null,![]);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x62')]=function(_0x1b232b,_0x33ab52){sh[_0x9b0b('0x63')](_[_0x9b0b('0x64')](_0x1b232b),function(_0x20c546,_0x44e368){var _0x127ee4=_0x44e368[_0x9b0b('0x65')](/(\r\n|\n|\r)/gm,'');_0x33ab52(null,_0x127ee4);});};AGIVertices['prototype'][_0x9b0b('0x66')]=function(_0x40bb40,_0x5f30bd){scripts['googleCloudTTS'](_0x40bb40[_0x9b0b('0x67')],_0x40bb40[_0x9b0b('0x68')]||_0x9b0b('0x69'),_0x40bb40[_0x9b0b('0x69')],_0x40bb40[_0x9b0b('0x6a')]||_0x9b0b('0x6b'),_0x40bb40['ssmlGender']||_0x9b0b('0x6c'),_0x40bb40[_0x9b0b('0x6d')]||_0x9b0b('0x6e'))['then'](function(_0x4a0c50){_0x5f30bd(null,_0x4a0c50);})[_0x9b0b('0x17')](function(_0x1872fe){_0x5f30bd(_0x1872fe);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x6f')]=function(_0x306dd9,_0x2db4fc){scripts['googleTTS'](_0x306dd9['text'],_0x306dd9['google_tts_language']||'en',0x1)['then'](function(_0x35edf3){_0x2db4fc(null,_0x35edf3);})['catch'](function(_0x2c3737){_0x2db4fc(_0x2c3737);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x70')]=function(_0x3fc983,_0x2efcc3){var _0x341b17={'uri':_0x3fc983[_0x9b0b('0x71')],'method':_0x3fc983[_0x9b0b('0x72')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3fc983['timeout'])===_0x9b0b('0x73')&&parseInt(_0x3fc983['timeout'])>=0x1?parseInt(_0x3fc983[_0x9b0b('0x74')])*0x3e8:0x5*0x3e8};if(_[_0x9b0b('0x75')]([_0x9b0b('0x76'),_0x9b0b('0x77')],_0x341b17[_0x9b0b('0x72')][_0x9b0b('0x78')]())){try{_0x341b17[_0x9b0b('0x79')]=_0x3fc983[_0x9b0b('0xe')]?JSON[_0x9b0b('0x7a')](_0x3fc983[_0x9b0b('0xe')]):{};}catch(_0xe502b){logger[_0x9b0b('0x5b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0xe502b);}}try{_0x341b17[_0x9b0b('0x7b')]=_0x3fc983[_0x9b0b('0xd')]?JSON['parse'](_0x3fc983['rawHeaders']):{};}catch(_0x2049c9){logger[_0x9b0b('0x5b')](_0x9b0b('0x7c'),_0x2049c9);}if(_0x3fc983['computedVariables']){try{var _0x39cec7=require(_0x3fc983[_0x9b0b('0x7d')])['sync'](this,_0x341b17);_0x341b17[_0x9b0b('0x7e')]=Mustache[_0x9b0b('0x7f')](_0x3fc983[_0x9b0b('0x71')],_0x39cec7,{},['$$','$$']);if(_0x341b17['headers']){_0x341b17[_0x9b0b('0x7b')]=JSON[_0x9b0b('0x7a')](Mustache[_0x9b0b('0x7f')](JSON['stringify'](_0x341b17[_0x9b0b('0x7b')]),_0x39cec7,{},['$$','$$']));}if(_0x341b17[_0x9b0b('0x79')]){_0x341b17['body']=JSON[_0x9b0b('0x7a')](Mustache[_0x9b0b('0x7f')](JSON[_0x9b0b('0x80')](_0x341b17[_0x9b0b('0x79')]),_0x39cec7,{},['$$','$$']));}}catch(_0x27d00b){logger[_0x9b0b('0x5b')](_0x9b0b('0x81'),_0x27d00b);}}rp(_0x341b17)[_0x9b0b('0x14')](function(_0x40c624){var _0x4c4085={'statusCode':_0x40c624[_0x9b0b('0x82')]||0xc8,'statusMessage':_0x40c624[_0x9b0b('0x83')]||'OK','headers':_0x40c624[_0x9b0b('0x7b')]||{},'body':_0x40c624[_0x9b0b('0x79')]||{}};_0x2efcc3(null,_0x4c4085);})[_0x9b0b('0x17')](function(_0x2d3833){var _0x43e3a3={'statusCode':_0x2d3833[_0x9b0b('0x82')]||0x1f4,'statusMessage':_0x2d3833[_0x9b0b('0x84')]||_0x9b0b('0x85'),'headers':_0x2d3833['options'][_0x9b0b('0x7b')]||{},'body':_0x2d3833[_0x9b0b('0x86')]['body']||{}};_0x2efcc3(null,_0x43e3a3);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x87')]=function(_0xd104fe,_0x5e9e82){scripts['googleDialogflow'](this['channel']['uniqueid'],_0xd104fe[_0x9b0b('0x88')],_0xd104fe[_0x9b0b('0x69')],_0xd104fe[_0x9b0b('0x89')]||'en')[_0x9b0b('0x14')](function(_0x1050ec){_0x5e9e82(null,_0x1050ec);})['catch'](function(_0x153311){_0x5e9e82(_0x153311);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x8a')]=function(_0xd6ef98,_0x3e44e8){scripts['sestekNDA'](this['channel'],_0xd6ef98)[_0x9b0b('0x14')](function(_0x217a8d){_0x3e44e8(null,_0x217a8d);})[_0x9b0b('0x17')](function(_0x426ea9){_0x3e44e8(_0x426ea9);});};AGIVertices[_0x9b0b('0x12')]['ispeechTTS']=function(_0x30ebb9,_0x503cb2){scripts[_0x9b0b('0x8b')](_0x30ebb9[_0x9b0b('0x88')],_0x30ebb9[_0x9b0b('0x69')],_0x30ebb9[_0x9b0b('0x8c')]||'en-US',_0x30ebb9[_0x9b0b('0x8d')])['then'](function(_0x5dd1d5){_0x503cb2(null,_0x5dd1d5);})[_0x9b0b('0x17')](function(_0x465c5f){_0x503cb2(_0x465c5f);});};AGIVertices[_0x9b0b('0x12')]['ispeechASR']=function(_0x5d4ed2,_0x244e35,_0x370a7a){scripts[_0x9b0b('0x8e')](_0x244e35,_0x5d4ed2['key'],_0x5d4ed2[_0x9b0b('0x8f')]||_0x9b0b('0x6b'),this['isConfigured'](_0x5d4ed2[_0x9b0b('0x90')])?_0x5d4ed2[_0x9b0b('0x90')]:undefined)[_0x9b0b('0x14')](function(_0x39720d){_0x370a7a(null,_0x39720d);})[_0x9b0b('0x17')](function(_0xad8bd0){_0x370a7a(_0xad8bd0);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x91')]=function(_0x44ca9f,_0x361fd9){scripts[_0x9b0b('0x91')](_0x44ca9f[_0x9b0b('0x92')],_0x44ca9f[_0x9b0b('0x93')],_0x44ca9f['aws_polly_region'],_0x44ca9f[_0x9b0b('0x94')]||_0x9b0b('0x95'),_0x44ca9f[_0x9b0b('0x69')],_0x44ca9f['aws_text_type']||_0x9b0b('0x69'))[_0x9b0b('0x14')](function(_0x167cc3){_0x361fd9(null,_0x167cc3);})[_0x9b0b('0x17')](function(_0x2d6523){_0x361fd9(_0x2d6523);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x96')]=function(_0x32cd4b,_0x5771e7){scripts[_0x9b0b('0x96')](this['channel'][_0x9b0b('0x3c')],_0x32cd4b[_0x9b0b('0x92')],_0x32cd4b[_0x9b0b('0x93')],_0x32cd4b['aws_lex_region'],_0x32cd4b[_0x9b0b('0x69')],_0x32cd4b['aws_bot_name'])[_0x9b0b('0x14')](function(_0x42c19e){_0x5771e7(null,_0x42c19e);})[_0x9b0b('0x17')](function(_0x3b9c3c){_0x5771e7(_0x3b9c3c);});};AGIVertices['prototype'][_0x9b0b('0x97')]=function(_0x1fa8b3,_0x3a89e2,_0x105a58){scripts[_0x9b0b('0x97')](_0x3a89e2,_0x1fa8b3['key'],_0x1fa8b3[_0x9b0b('0x98')]||_0x9b0b('0x6b'))[_0x9b0b('0x14')](function(_0x2494fe){_0x105a58(null,_0x2494fe);})[_0x9b0b('0x17')](function(_0x2f38e2){_0x105a58(_0x2f38e2);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x99')]=function(_0x299e60,_0x38cb2e,_0x51fe92){scripts[_0x9b0b('0x99')](_0x38cb2e,_0x299e60[_0x9b0b('0x9a')],_0x299e60[_0x9b0b('0x9b')],_0x299e60[_0x9b0b('0x7e')])[_0x9b0b('0x14')](function(_0x2a74f6){_0x51fe92(null,_0x2a74f6);})[_0x9b0b('0x17')](function(_0x453c36){_0x51fe92(_0x453c36);});};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x9c')]=function(_0x51d212){var _0x132428=_[_0x9b0b('0x75')](verticesWithRetry,_0x51d212[_0x9b0b('0x9d')])?_0x51d212:_[_0x9b0b('0x9e')](_0x51d212);for(var _0x23c6ef in _0x132428){if(_0x132428['hasOwnProperty'](_0x23c6ef)){if(_0x132428[_0x23c6ef]&&_[_0x9b0b('0x9f')](_0x132428[_0x23c6ef])){if(_[_0x9b0b('0x75')](recursiveMapAttributes,_0x23c6ef)){_0x132428[_0x23c6ef]=this[_0x9b0b('0xa0')](_0x132428[_0x23c6ef]);}else{_0x132428[_0x23c6ef]=this[_0x9b0b('0xa1')](_0x132428[_0x23c6ef]);}}}}return _0x132428;};AGIVertices['prototype'][_0x9b0b('0xa2')]=function(_0x121d0d){for(var _0x14615d in _0x121d0d){if(_0x121d0d[_0x9b0b('0xa3')](_0x14615d)){if(_[_0x9b0b('0xa4')](_0x121d0d[_0x14615d])){this[_0x9b0b('0xa2')](_0x121d0d[_0x14615d]);}else if(_[_0x9b0b('0xa5')](_0x121d0d[_0x14615d])){for(var _0x2c6839=0x0;_0x2c6839<_0x121d0d[_0x14615d][_0x9b0b('0xa6')];_0x2c6839++){this[_0x9b0b('0xa2')](_0x121d0d[_0x14615d][_0x2c6839]);}}else if(_['isString'](_0x121d0d[_0x14615d])){_0x121d0d[_0x14615d]=this[_0x9b0b('0xa1')](_0x121d0d[_0x14615d]);}}}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xa7')]=function(_0x1f67a7,_0x4d3ccd){for(var _0x2272bb in _0x1f67a7){if(_0x1f67a7['hasOwnProperty'](_0x2272bb)){if(_[_0x9b0b('0xa4')](_0x1f67a7[_0x2272bb])){if(!_[_0x9b0b('0x50')](_0x1f67a7[_0x2272bb])){this[_0x9b0b('0xa7')](_0x1f67a7[_0x2272bb],util['format']('%s.%s',_0x4d3ccd,_0x2272bb));}}else if(_[_0x9b0b('0xa5')](_0x1f67a7[_0x2272bb])){for(var _0x37f3ca=0x0;_0x37f3ca<_0x1f67a7[_0x2272bb][_0x9b0b('0xa6')];_0x37f3ca++){this[_0x9b0b('0xa7')](_0x1f67a7[_0x2272bb][_0x37f3ca],util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x4d3ccd,_0x2272bb+'['+_0x37f3ca+']'));}}else{if(!_['isNil'](_0x1f67a7[_0x2272bb])){this['channel']['setVariable'](util['format'](_0x9b0b('0xa8'),_0x4d3ccd,_0x2272bb),_0x1f67a7[_0x2272bb]);}}}}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xa0')]=function(_0x772f82){try{var _0xc1d278=JSON[_0x9b0b('0x7a')](_0x772f82);this['recursiveNodeIndex'](_0xc1d278);return JSON['stringify'](_0xc1d278);}catch(_0x9a642){return this[_0x9b0b('0xa1')](_0x772f82);}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xa1')]=function(_0x32d1f5){console[_0x9b0b('0x49')]('replaceall\x20init',_0x32d1f5);var _0xb76b66=_0x32d1f5[_0x9b0b('0xa9')]('{');for(var _0x191c44=0x1;_0x191c44<_0xb76b66['length'];_0x191c44+=0x1){var _0x106e5e=_0xb76b66[_0x191c44][_0x9b0b('0xa9')]('}');console[_0x9b0b('0x49')](_0x9b0b('0xaa'),_0x106e5e);if(_0x106e5e[_0x9b0b('0xa6')]>0x1){_0x32d1f5=_0x32d1f5[_0x9b0b('0xab')]('{'+_0x106e5e[0x0]+'}',this[_0x9b0b('0x10')]['getVariable'](_0x106e5e[0x0])[_0x9b0b('0xac')]||_0x106e5e[0x0]);}}if(_0xb76b66[_0x9b0b('0xa6')]===0x1){return _0x32d1f5[_0x9b0b('0x58')]();}console[_0x9b0b('0x49')]('replaceall\x20end',_0x32d1f5);return this[_0x9b0b('0xa1')](_0x32d1f5);};AGIVertices['prototype'][_0x9b0b('0xad')]=function(_0x1de769,_0x2538be){var _0x50d0e4=this[_0x9b0b('0x10')]['getVariable'](_0x1de769);if(_0x50d0e4[_0x9b0b('0xae')]===-0x1){return _0x50d0e4;}logger['info'](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2538be,_0x50d0e4['extra']));return this['channel'][_0x9b0b('0xaf')](_0x2538be,_0x50d0e4[_0x9b0b('0xac')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xb0')]=function(_0x474d4b){return _0x474d4b&&_0x474d4b!=='0'&&_0x474d4b!=='-1'&&_0x474d4b!=='';};AGIVertices[_0x9b0b('0x12')]['maxRetry']=function(_0x8c8728){this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x8c8728,'-');_0x8c8728['retry']=_0x8c8728[_0x9b0b('0xb2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9b0b('0xb3')]=function(_0x91ac83){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xb4'),_0x91ac83[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x91ac83['text'])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('no\x20text\x20configured');}var _0x53f4dc='\x22'+_0x91ac83[_0x9b0b('0x69')]+'\x22';if(this['isConfigured'](_0x91ac83[_0x9b0b('0x86')])){_0x53f4dc+=','+_0x91ac83[_0x9b0b('0x86')];}var _0x2a85a5=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0xb6'),_0x53f4dc);if(_0x2a85a5[_0x9b0b('0xae')]===-0x1){return _0x2a85a5;}return this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xb7'),_0x53f4dc));};AGIVertices['prototype'][_0x9b0b('0xb8')]=function(_0x3b4eb5){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xb9'),_0x3b4eb5[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x3b4eb5['grammar'])){return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0xba'));}var _0x557926=_0x3b4eb5[_0x9b0b('0xbb')];if(this[_0x9b0b('0xb0')](_0x3b4eb5[_0x9b0b('0x86')])){_0x557926+=','+_0x3b4eb5[_0x9b0b('0x86')];}var _0x514269=this['channel']['exec'](_0x9b0b('0xbc'),_0x557926);if(_0x514269[_0x9b0b('0xae')]===-0x1){return _0x514269;}var _0x469f80=this[_0x9b0b('0xad')](_0x9b0b('0xbd'),'MRCP_RECOG_CONFIDENCE');if(_0x469f80[_0x9b0b('0xae')]===-0x1){return _0x469f80;}var _0x163294=this['getAndSetVariable'](_0x9b0b('0xbe'),'MRCP_RECOG_TRANSCRIPT');if(_0x163294[_0x9b0b('0xae')]===-0x1){return _0x163294;}var _0x46c103=this[_0x9b0b('0xad')](_0x9b0b('0xbf'),_0x9b0b('0xc0'));if(_0x46c103[_0x9b0b('0xae')]===-0x1){return _0x46c103;}return this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xc1'),_0x557926));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x8')]=function(_0x5566f3){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0xc2'),_0x5566f3['label']));return this['channel'][_0x9b0b('0x8')]([_0x5566f3['command'],_0x5566f3[_0x9b0b('0xc3')]]);};AGIVertices['prototype'][_0x9b0b('0xc4')]=function(_0x3c6910){logger['info'](util['format'](_0x9b0b('0xc5'),_0x3c6910[_0x9b0b('0x3d')]));if(this['isConfigured'](_0x3c6910['timeout'])){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0xc6'),_0x3c6910['timeout']));var _0x5956d3=this['channel'][_0x9b0b('0xc7')](_0x3c6910['timeout']);if(_0x5956d3[_0x9b0b('0xae')]===-0x1){return _0x5956d3;}}return this[_0x9b0b('0x10')][_0x9b0b('0xc4')]();};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x56')]=function(_0x59597a){console[_0x9b0b('0x49')](_0x9b0b('0xc8'),_0x59597a);logger['info'](util[_0x9b0b('0x2d')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x59597a[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x59597a[_0x9b0b('0x54')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x59597a,_0x9b0b('0xc9'));}_0x59597a[_0x9b0b('0x55')]=moment();if(this['isConfigured'](_0x59597a[_0x9b0b('0xca')])){_0x59597a[_0x9b0b('0x55')]=moment()[_0x9b0b('0xcb')](_0x59597a['delay'],'minutes');}if(!this[_0x9b0b('0xb0')](_0x59597a['callback_priority'])){_0x59597a['callback_priority']=0x2;}console[_0x9b0b('0x49')](_0x9b0b('0xcc'),_0x59597a);this[_0x9b0b('0x48')][_0x9b0b('0xb1')](this,_0x59597a);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x59597a[_0x9b0b('0xcd')],_0x59597a[_0x9b0b('0x54')],_0x59597a[_0x9b0b('0x55')]));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xce')]=function(_0x3e88e0){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xcf'),_0x3e88e0[_0x9b0b('0x3d')]));var _0x4474d6=this[_0x9b0b('0x10')]['exec'](_0x3e88e0['application'],_0x3e88e0[_0x9b0b('0x86')]);if(_0x4474d6[_0x9b0b('0xae')]===-0x1){return _0x4474d6;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),_0x3e88e0[_0x9b0b('0xd1')],_0x3e88e0['options']));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xd2')]=function(_0x577163){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x577163['label']));if(!this[_0x9b0b('0xb0')](_0x577163[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')]['noop']('no\x20text\x20configured');}var _0xbe5d21='\x22'+_0x577163[_0x9b0b('0x69')]+'\x22';if(this[_0x9b0b('0xb0')](_0x577163[_0x9b0b('0x86')])){_0xbe5d21+=','+_0x577163[_0x9b0b('0x86')];}var _0x1fa49f=this[_0x9b0b('0x10')][_0x9b0b('0x63')]('MRCPSynth',_0xbe5d21);if(_0x1fa49f[_0x9b0b('0xae')]===-0x1){return _0x1fa49f;}return this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xb7'),_0xbe5d21));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xd3')]=function(_0x3b5c8a){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3b5c8a['label']));if(!this[_0x9b0b('0xb0')](_0x3b5c8a[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}var _0x19efcd='\x22'+_0x3b5c8a[_0x9b0b('0x69')]+'\x22';if(this[_0x9b0b('0xb0')](_0x3b5c8a['options'])){_0x19efcd+=','+_0x3b5c8a['options'];}var _0x4fd8ee=this[_0x9b0b('0x10')]['exec'](_0x9b0b('0xb6'),_0x19efcd);if(_0x4fd8ee[_0x9b0b('0xae')]===-0x1){return _0x4fd8ee;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x19efcd));};AGIVertices[_0x9b0b('0x12')]['lumenvoxasr']=function(_0x1ee6ca){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0xd5'),_0x1ee6ca[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x1ee6ca[_0x9b0b('0xbb')])){return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0xba'));}var _0x42043f=_0x1ee6ca['grammar'];if(this[_0x9b0b('0xb0')](_0x1ee6ca[_0x9b0b('0x86')])){_0x42043f+=','+_0x1ee6ca[_0x9b0b('0x86')];}var _0x557af8=this[_0x9b0b('0x10')]['exec'](_0x9b0b('0xbc'),_0x42043f);if(_0x557af8['result']===-0x1){return _0x557af8;}var _0x46daa2=this[_0x9b0b('0xad')](_0x9b0b('0xbd'),_0x9b0b('0xd6'));if(_0x46daa2['result']===-0x1){return _0x46daa2;}var _0xf10cbe=this['getAndSetVariable'](_0x9b0b('0xbe'),_0x9b0b('0xd7'));if(_0xf10cbe[_0x9b0b('0xae')]===-0x1){return _0xf10cbe;}var _0x35ad3e=this[_0x9b0b('0xad')](_0x9b0b('0xbf'),_0x9b0b('0xd8'));if(_0x35ad3e[_0x9b0b('0xae')]===-0x1){return _0x35ad3e;}return this['channel'][_0x9b0b('0xb5')](util['format'](_0x9b0b('0xc1'),_0x42043f));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xd9')]=function(_0x57d3df){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x57d3df['label']));if(!this[_0x9b0b('0xb0')](_0x57d3df['grammar'])){return this[_0x9b0b('0x10')]['noop']('no\x20grammar\x20configured');}var _0x2d2c1b=_0x57d3df[_0x9b0b('0xbb')];if(this[_0x9b0b('0xb0')](_0x57d3df[_0x9b0b('0x86')])){_0x2d2c1b+=','+_0x57d3df[_0x9b0b('0x86')];}var _0x5738bc=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0xbc'),_0x2d2c1b);if(_0x5738bc[_0x9b0b('0xae')]===-0x1){return _0x5738bc;}var _0x425d68=this[_0x9b0b('0xad')](_0x9b0b('0xbd'),_0x9b0b('0xda'));if(_0x425d68['result']===-0x1){return _0x425d68;}var _0x349496=this[_0x9b0b('0xad')](_0x9b0b('0xbe'),_0x9b0b('0xdb'));if(_0x349496[_0x9b0b('0xae')]===-0x1){return _0x349496;}var _0x52c63d=this[_0x9b0b('0xad')](_0x9b0b('0xbf'),_0x9b0b('0xdc'));if(_0x52c63d[_0x9b0b('0xae')]===-0x1){return _0x52c63d;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0xc1'),_0x2d2c1b));};AGIVertices['prototype'][_0x9b0b('0xdd')]=function(_0x3e20bd){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0xde'),_0x3e20bd['label']));if(!this['isConfigured'](_0x3e20bd[_0x9b0b('0xdf')])){return this['channel'][_0x9b0b('0x5b')](_0x3e20bd,_0x9b0b('0xe0'));}var _0x3481cc=this[_0x9b0b('0x1a')][_0x9b0b('0xb1')](this,_0x3e20bd[_0x9b0b('0xdf')]);if(!_0x3481cc){return this[_0x9b0b('0x10')]['error'](_0x3e20bd,'no\x20odbc\x20database\x20found');}if(!this[_0x9b0b('0xb0')](_0x3e20bd[_0x9b0b('0x33')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x3e20bd,_0x9b0b('0xe1'));}var _0x21e382=_0x3e20bd[_0x9b0b('0x33')][_0x9b0b('0x65')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format']('query:\x20%s',_0x21e382));var _0x35dd17=this['getQueryOdbc'][_0x9b0b('0xb1')](this,_0x3481cc,_0x21e382);this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x3e20bd,_0x21e382);if(!this[_0x9b0b('0xb0')](_0x3e20bd[_0x9b0b('0xe2')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xe3'));}var _0x35bb4d=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x3e20bd[_0x9b0b('0xe2')]);if(!_0x35bb4d){return this['channel'][_0x9b0b('0x5b')](_0x3e20bd,_0x9b0b('0xe4'));}var _0x927f8d=this;_0x35dd17['forEach'](function(_0x1b3f74,_0x5b301b){Object[_0x9b0b('0xe5')](_0x1b3f74)['forEach'](function(_0x5ce2cb){_0x927f8d[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0xe6'),_0x35bb4d,_0x5b301b,_0x5ce2cb),_0x1b3f74[_0x5ce2cb]);});});this[_0x9b0b('0x10')]['setVariable'](util[_0x9b0b('0x2d')]('%s_ROWS_COUNT',_0x35bb4d),_0x35dd17['length']);return this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xe7'),_0x35bb4d));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xe8')]=function(_0x289ba8){logger['debug'](util['format'](_0x9b0b('0xe9'),_0x289ba8[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x289ba8[_0x9b0b('0xea')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x289ba8,'no\x20user\x20selected');}var _0x343d50=this['getUser'][_0x9b0b('0xb1')](this,_0x289ba8[_0x9b0b('0xea')]);if(!_0x343d50){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x289ba8,'no\x20user\x20found');}var _0x3d58a3=this[_0x9b0b('0x10')][_0x9b0b('0x63')]('DIAL',[util['format']('SIP/%s',_0x343d50),_0x289ba8[_0x9b0b('0x74')],_0x289ba8[_0x9b0b('0xeb')],_0x289ba8['url']]);if(_0x3d58a3['result']===-0x1){return _0x3d58a3;}return this[_0x9b0b('0x10')]['noop'](util['format']('Executed\x20command\x20%s',_0x9b0b('0xec')));};AGIVertices['prototype']['dialogflow']=function(_0x7abd4c){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xed'),_0x7abd4c[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x7abd4c['key'])){return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0xee'));}if(!this[_0x9b0b('0xb0')](_0x7abd4c[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('no\x20text\x20configured');}this['channel'][_0x9b0b('0xef')]=!![];this[_0x9b0b('0x3b')](_0x7abd4c);this['createSquareMessage'](_0x7abd4c[_0x9b0b('0x69')],'in');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xf0'),_0x7abd4c['text']));var _0xeab0b1=this[_0x9b0b('0x87')]['sync'](this,_0x7abd4c);if(_0xeab0b1){for(var _0x28f9b3 in _0xeab0b1){if(_0xeab0b1[_0x9b0b('0xa3')](_0x28f9b3)){this['channel'][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0xf1'),_0x28f9b3[_0x9b0b('0x78')]()),_0xeab0b1[_0x28f9b3]);}}this['createSquareMessage'](_0xeab0b1[_0x9b0b('0xf2')],_0x9b0b('0xf3'));return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xf4'),_0xeab0b1[_0x9b0b('0xf2')]));}return this[_0x9b0b('0x10')]['error'](_0x7abd4c,_0x9b0b('0xf5'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xf6')]=function(_0x2bbaf9){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0xf7'),_0x2bbaf9[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x2bbaf9[_0x9b0b('0xf8')])){return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0xf9'));}if(!this[_0x9b0b('0xb0')](_0x2bbaf9[_0x9b0b('0xfa')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xfb'));}if(!this['isConfigured'](_0x2bbaf9[_0x9b0b('0xfc')])){return this[_0x9b0b('0x10')]['noop']('no\x20password\x20configured');}if(!this[_0x9b0b('0xb0')](_0x2bbaf9[_0x9b0b('0xfd')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')][_0x9b0b('0xef')]=!![];this['createSquareDetailsReport'](_0x2bbaf9);this['createSquareMessage'](_0x2bbaf9['text'],'in');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xfe'),_0x2bbaf9[_0x9b0b('0x69')]));var _0x47c833=this[_0x9b0b('0x8a')][_0x9b0b('0xb1')](this,_0x2bbaf9);if(_0x47c833){for(var _0x530f33 in _0x47c833){if(_0x47c833[_0x9b0b('0xa3')](_0x530f33)){this[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0xff'),_0x530f33[_0x9b0b('0x78')]()),_0x47c833[_0x530f33]);}}this[_0x9b0b('0x47')](_0x47c833[_0x9b0b('0xf2')],_0x9b0b('0xf3'));if(_0x47c833[_0x9b0b('0x100')]){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x101'),_0x47c833[_0x9b0b('0x100')]));var _0x33d1cf=this[_0x9b0b('0x10')][_0x9b0b('0x102')](_0x47c833[_0x9b0b('0x100')]);try{fs[_0x9b0b('0x103')](_0x47c833[_0x9b0b('0x100')]+_0x9b0b('0x104'));}catch(_0x1ec712){logger[_0x9b0b('0x5b')](_0x1ec712);}return _0x33d1cf;}else{return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x105'),_0x47c833[_0x9b0b('0xf2')]));}}return this['channel'][_0x9b0b('0x5b')](_0x2bbaf9,_0x9b0b('0x106'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x107')]=function(_0x2217a7){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x108'),_0x2217a7['label']));return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('end');};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x109')]=function(_0x567267){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x10a'),_0x567267[_0x9b0b('0x3d')]));var _0x2405b7='';if(_0x567267['trunk_id']){if(!this[_0x9b0b('0xb0')](_0x567267[_0x9b0b('0x10b')])){return this['channel'][_0x9b0b('0x5b')](_0x567267,_0x9b0b('0x10c'));}else{var _0x2df181=parseInt(_0x567267[_0x9b0b('0x10b')],0xa);if(isNaN(_0x2df181)){_0x2405b7=_0x567267[_0x9b0b('0x10b')];}else{_0x2405b7=this['getTrunk'][_0x9b0b('0xb1')](this,_0x567267['trunk_id']);if(!_0x2405b7){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x567267,_0x9b0b('0x10d'));}}}}else if(_0x567267[_0x9b0b('0x10e')]){_0x2405b7=_0x567267[_0x9b0b('0x10e')];}else{return this['channel'][_0x9b0b('0x5b')](_0x567267,_0x9b0b('0x10c'));}var _0x62e97d=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0xec'),[util[_0x9b0b('0x2d')](_0x9b0b('0x10f'),_0x2405b7,_0x567267[_0x9b0b('0xcd')]),_0x567267[_0x9b0b('0x74')],_0x567267[_0x9b0b('0xeb')],_0x567267[_0x9b0b('0x71')]]);if(_0x62e97d[_0x9b0b('0xae')]===-0x1){return _0x62e97d;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x110'),_0x9b0b('0xec')));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x111')]=function(_0x10ada9){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x112'),_0x10ada9['label']));return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('finally');};AGIVertices[_0x9b0b('0x12')]['getdigits']=function(_0x2b7f9b){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x113'),_0x2b7f9b[_0x9b0b('0x3d')]));if(_0x2b7f9b[_0x9b0b('0x114')]===0x0){return this[_0x9b0b('0xb2')](_0x2b7f9b);}_0x2b7f9b[_0x9b0b('0x114')]-=0x1;if(!this[_0x9b0b('0xb0')](_0x2b7f9b[_0x9b0b('0x115')])){return this['channel'][_0x9b0b('0x5b')](_0x2b7f9b,_0x9b0b('0x116'));}var _0x1e4386=this[_0x9b0b('0x20')][_0x9b0b('0xb1')](this,_0x2b7f9b['file_id']);if(!_0x1e4386){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x2b7f9b,_0x9b0b('0x117'));}if(!this[_0x9b0b('0xb0')](_0x2b7f9b[_0x9b0b('0xe2')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x9b0b('0xe3'));}var _0x5eb1c9=this[_0x9b0b('0x10')]['getData'](_0x1e4386,_0x2b7f9b['response'],_0x2b7f9b[_0x9b0b('0x118')]);var _0x325607=_0x5eb1c9[_0x9b0b('0xae')]?_0x5eb1c9[_0x9b0b('0xae')][_0x9b0b('0x58')]():'';logger[_0x9b0b('0x31')](_0x9b0b('0x119'),JSON[_0x9b0b('0x80')](_0x5eb1c9));if(_0x5eb1c9[_0x9b0b('0xae')]===-0x1){this[_0x9b0b('0x3b')]['sync'](this,_0x2b7f9b,_0x325607);return _0x5eb1c9;}else if(_0x5eb1c9[_0x9b0b('0xac')]===_0x9b0b('0x74')){_0x5eb1c9[_0x9b0b('0xae')]=_0x325607[_0x9b0b('0xa6')]>=parseInt(_0x2b7f9b[_0x9b0b('0x11a')])?'x':'i';}else{_0x5eb1c9[_0x9b0b('0xae')]=_0x325607[_0x9b0b('0xa6')]>=parseInt(_0x2b7f9b[_0x9b0b('0x11a')])&&_0x325607['length']<=parseInt(_0x2b7f9b[_0x9b0b('0x118')])?'x':'i';}var _0x1e5bdb=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x2b7f9b[_0x9b0b('0xe2')]);if(!_0x1e5bdb){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x2b7f9b,_0x9b0b('0xe4'));}this[_0x9b0b('0x10')][_0x9b0b('0xaf')](_0x1e5bdb,_0x325607);if(this['isConfigured'](_0x2b7f9b['hiddendigitsnum'])){var _0x250129=parseInt(_0x2b7f9b[_0x9b0b('0x11b')],0xa);var _0x19e3be=rs[_0x9b0b('0x11c')]({'charset':'*','length':_0x250129});var _0x1659e0=_0x325607['length'];if(_0x1659e0>0x0){if(_0x1659e0>_0x250129){this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x2b7f9b,_0x2b7f9b[_0x9b0b('0x11d')]===_0x9b0b('0x11e')?_0x19e3be+_0x325607[_0x9b0b('0x11f')](_0x250129):_0x325607[_0x9b0b('0x11f')](0x0,_0x1659e0-_0x250129)+_0x19e3be);}else{this['createSquareDetailsReport']['sync'](this,_0x2b7f9b,rs[_0x9b0b('0x11c')]({'charset':'*','length':_0x1659e0}));}}else{this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x2b7f9b,'');}}else{this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x2b7f9b,_0x325607);}return _0x5eb1c9;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0xf')]=function(_0x1272b1){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1272b1[_0x9b0b('0x3d')]));return this[_0x9b0b('0x120')](_0x1272b1);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x121')]=function(_0x57c996){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x57c996['label']));this['createSquareDetailsReport'][_0x9b0b('0xb1')](this,_0x57c996,_0x57c996[_0x9b0b('0x122')]);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format']('GOAL\x20%s',_0x57c996[_0x9b0b('0x122')]));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x123')]=function(_0x3dd3fe){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x124'),_0x3dd3fe[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x3dd3fe[_0x9b0b('0x92')])||!this[_0x9b0b('0xb0')](_0x3dd3fe[_0x9b0b('0x93')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x125'));}if(!this[_0x9b0b('0xb0')](_0x3dd3fe[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x126'),_0x3dd3fe[_0x9b0b('0x69')]));var _0x59f865=this['awsPolly']['sync'](this,_0x3dd3fe);if(_0x59f865){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x127'),_0x59f865));var _0x32e4fc=this[_0x9b0b('0x10')][_0x9b0b('0x102')](_0x59f865);try{fs[_0x9b0b('0x103')](_0x59f865+_0x9b0b('0x104'));}catch(_0x37fd63){logger['error'](_0x37fd63);}return _0x32e4fc;}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x3dd3fe,_0x9b0b('0x128'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x129')]=function(_0x26c5c6){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x12a'),_0x26c5c6[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x26c5c6[_0x9b0b('0x92')])||!this[_0x9b0b('0xb0')](_0x26c5c6[_0x9b0b('0x93')])){return this[_0x9b0b('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x26c5c6[_0x9b0b('0x12b')])){return this['channel'][_0x9b0b('0xb5')]('no\x20bot\x20name\x20configured');}if(!this[_0x9b0b('0xb0')](_0x26c5c6[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')]['bot']=!![];this[_0x9b0b('0x3b')](_0x26c5c6);this[_0x9b0b('0x47')](_0x26c5c6[_0x9b0b('0x69')],'in');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x12c'),_0x26c5c6[_0x9b0b('0x69')]));var _0x2b4bc0=this[_0x9b0b('0x96')][_0x9b0b('0xb1')](this,_0x26c5c6);if(_0x2b4bc0){for(var _0x4d3795 in _0x2b4bc0){if(_0x2b4bc0['hasOwnProperty'](_0x4d3795)&&_[_0x9b0b('0x9f')](_0x2b4bc0[_0x4d3795])){this[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0x12d'),_0x4d3795[_0x9b0b('0x78')]()),_0x2b4bc0[_0x4d3795]);}}if(_[_0x9b0b('0x4c')](_0x2b4bc0[_0x9b0b('0x84')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x12e'));}else{this[_0x9b0b('0x47')](_0x2b4bc0[_0x9b0b('0x84')],_0x9b0b('0xf3'));return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x12f'),_0x2b4bc0[_0x9b0b('0x84')]));}}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x26c5c6,_0x9b0b('0x130'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x131')]=function(_0x1ea04f){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x132'),_0x1ea04f['label'],_0x1ea04f['timeout']));if(!this['isConfigured'](_0x1ea04f[_0x9b0b('0x88')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('no\x20key\x20configured');}var _0x1ed0f9='wav';var _0x12c9b7=util['format'](_0x9b0b('0x133'),FILES_PATH,rs['generate'](0x4));var _0x5e4115=util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x12c9b7,_0x1ed0f9);var _0x37d522=!![];if(_0x1ea04f[_0x9b0b('0x134')]===_0x9b0b('0x135')){_0x37d522=![];}var _0x13a796=this[_0x9b0b('0x10')][_0x9b0b('0x136')](_0x12c9b7,_0x1ed0f9,_0x1ea04f[_0x9b0b('0x137')],_0x1ea04f[_0x9b0b('0x74')],undefined,_0x37d522);if(_0x13a796[_0x9b0b('0xae')]!==-0x1){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x138'),_0x5e4115));var _0x2e6330=this['googleASR'][_0x9b0b('0xb1')](this,_0x1ea04f,_0x5e4115);if(_0x2e6330){for(var _0x1b4951 in _0x2e6330){if(_0x2e6330[_0x9b0b('0xa3')](_0x1b4951)){this[_0x9b0b('0x10')][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')]('GOOGLE_ASR_%s',_0x1b4951[_0x9b0b('0x78')]()),_0x2e6330[_0x1b4951]);}}return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x139'),JSON['stringify'](_0x2e6330)));}}return _0x13a796;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x13a')]=function(_0x467845){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x13b'),_0x467845[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x467845[_0x9b0b('0x9a')])){return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0x13c'));}if(!this[_0x9b0b('0xb0')](_0x467845[_0x9b0b('0x9b')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x13d'));}var _0x582b7a='wav';var _0x41c0eb=util[_0x9b0b('0x2d')](_0x9b0b('0x133'),FILES_PATH,rs[_0x9b0b('0x11c')](0x4));var _0x4972cf=util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x41c0eb,_0x582b7a);var _0x237dca=!![];if(_0x467845[_0x9b0b('0x134')]===_0x9b0b('0x135')){_0x237dca=![];}var _0x447c2e=this[_0x9b0b('0x10')][_0x9b0b('0x136')](_0x41c0eb,_0x582b7a,_0x467845[_0x9b0b('0x137')],_0x467845['timeout'],undefined,_0x237dca);if(_0x447c2e[_0x9b0b('0xae')]!==-0x1){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('tilde\x20%s\x20file\x20created',_0x4972cf));var _0x49b34e=this[_0x9b0b('0x99')][_0x9b0b('0xb1')](this,_0x467845,_0x4972cf);if(_0x49b34e){for(var _0x3b0c0f in _0x49b34e){if(_0x49b34e[_0x9b0b('0xa3')](_0x3b0c0f)){this['channel'][_0x9b0b('0xaf')](util[_0x9b0b('0x2d')](_0x9b0b('0x13e'),_0x3b0c0f['toUpperCase']()),_0x49b34e[_0x3b0c0f]);}}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x13f'),JSON[_0x9b0b('0x80')](_0x49b34e)));}}return _0x447c2e;};AGIVertices[_0x9b0b('0x12')]['gotoc']=function(_0x15adaa){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x140'),_0x15adaa[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x141')](_0x15adaa[_0x9b0b('0x42')],_0x15adaa[_0x9b0b('0x43')],_0x15adaa['priority']);};AGIVertices[_0x9b0b('0x12')]['gotoif']=function(_0x5e903d){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5e903d[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x5e903d[_0x9b0b('0x142')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x5e903d,_0x9b0b('0x143'));}try{var _0x5df7ef=eval(_0x5e903d['condition'])?_0x9b0b('0x144'):_0x9b0b('0x145');this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x146'),_0x5e903d['condition'],_0x5df7ef));return{'code':0xc8,'result':_0x5df7ef};}catch(_0x4404ec){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x147')]=function(_0x54975d){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x54975d[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x54975d[_0x9b0b('0x148')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x54975d,_0x9b0b('0x149'));}var _0x2494a2=this[_0x9b0b('0x27')]['sync'](this,_0x54975d[_0x9b0b('0x148')]);if(!_0x2494a2){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x54975d,_0x9b0b('0x14a'));}for(var _0x85799c=0x0;_0x85799c<_0x2494a2[_0x9b0b('0xa6')];_0x85799c+=0x1){var _0xed918=this[_0x9b0b('0x10')][_0x9b0b('0x13')](util['format'](_0x9b0b('0x14b'),_0x2494a2[_0x85799c]));if(_0xed918[_0x9b0b('0xae')]===-0x1){return _0xed918;}logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],_0xed918[_0x9b0b('0xac')]));if(_0xed918[_0x9b0b('0xac')]===_0x9b0b('0x144')){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],'true'));this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],'true'));return{'code':0xc8,'result':_0x9b0b('0x144')};}else{logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x14c'),_0x2494a2[_0x85799c],_0x9b0b('0x145')));this[_0x9b0b('0x10')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x2494a2[_0x85799c],_0x9b0b('0x145')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x14d')]=function(_0x1c95cc){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x14e'),_0x1c95cc[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x14d')]();};AGIVertices[_0x9b0b('0x12')]['ispeechasr']=function(_0x21d18d){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x14f'),_0x21d18d[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x21d18d[_0x9b0b('0x88')])){return this['channel'][_0x9b0b('0xb5')]('no\x20key\x20configured');}var _0x4512d2=_0x9b0b('0x150');var _0x27c46d=util[_0x9b0b('0x2d')](_0x9b0b('0x133'),FILES_PATH,rs[_0x9b0b('0x11c')](0x4));var _0x208116=util[_0x9b0b('0x2d')](_0x9b0b('0xa8'),_0x27c46d,_0x4512d2);var _0x188059=!![];if(_0x21d18d[_0x9b0b('0x134')]===_0x9b0b('0x135')){_0x188059=![];}var _0x2cea64=this[_0x9b0b('0x10')][_0x9b0b('0x136')](_0x27c46d,_0x4512d2,_0x21d18d[_0x9b0b('0x137')],_0x21d18d['timeout'],undefined,_0x188059);if(_0x2cea64['result']!==-0x1){this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x151'),_0x208116));var _0x179a77=this[_0x9b0b('0x8e')][_0x9b0b('0xb1')](this,_0x21d18d,_0x208116);if(_0x179a77){for(var _0x31c672 in _0x179a77){if(_0x179a77[_0x9b0b('0xa3')](_0x31c672)){this[_0x9b0b('0x10')]['setVariable'](util[_0x9b0b('0x2d')](_0x9b0b('0x152'),_0x31c672['toUpperCase']()),_0x179a77[_0x31c672]);}}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x153'),JSON[_0x9b0b('0x80')](_0x179a77)));}}return _0x2cea64;};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x154')]=function(_0x341b68){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x155'),_0x341b68['label']));if(!this[_0x9b0b('0xb0')](_0x341b68[_0x9b0b('0x88')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xee'));}if(!this[_0x9b0b('0xb0')](_0x341b68[_0x9b0b('0x69')])){return this['channel'][_0x9b0b('0xb5')]('no\x20text\x20configured');}this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x156'),_0x341b68[_0x9b0b('0x69')]));var _0x2e057c=this['ispeechTTS'][_0x9b0b('0xb1')](this,_0x341b68);if(_0x2e057c){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x151'),_0x2e057c));var _0x7287ff=this['channel'][_0x9b0b('0x102')](_0x2e057c,_0x341b68[_0x9b0b('0x137')]);try{fs[_0x9b0b('0x103')](_0x2e057c+_0x9b0b('0x104'));}catch(_0x3bae3e){logger[_0x9b0b('0x5b')](_0x3bae3e);}return _0x7287ff;}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x341b68,_0x9b0b('0x157'));};AGIVertices['prototype'][_0x9b0b('0x158')]=function(_0xc2ec96){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xc2ec96['label']));if(!this[_0x9b0b('0xb0')](_0xc2ec96[_0x9b0b('0x159')])){return this['channel'][_0x9b0b('0x5b')](_0xc2ec96,_0x9b0b('0x15a'));}logger[_0x9b0b('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9b0b('0x10')]['callerid'],_0xc2ec96[_0x9b0b('0x159')]));var _0x2ebfcf=this[_0x9b0b('0x5e')][_0x9b0b('0xb1')](this,_0xc2ec96[_0x9b0b('0x159')]);if(_0x2ebfcf){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96['findBy']));this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0x15b'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96[_0x9b0b('0x159')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96[_0x9b0b('0x159')]));this['channel']['noop'](util['format'](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0xc2ec96['findBy']));return{'code':0xc8,'result':_0x9b0b('0x15d')};}};AGIVertices[_0x9b0b('0x12')]['logout']=function(_0x3ea5cb){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x15e'),_0x3ea5cb['label']));if(!this[_0x9b0b('0xb0')](_0x3ea5cb[_0x9b0b('0x159')])){return this['channel']['error'](_0x3ea5cb,_0x9b0b('0x15a'));}logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x15f'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb['findBy']));var _0x40acf4=this[_0x9b0b('0x5d')][_0x9b0b('0xb1')](this,_0x3ea5cb[_0x9b0b('0x159')]);if(_0x40acf4){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x15b'),this[_0x9b0b('0x10')]['callerid'],_0x3ea5cb[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x15b'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb[_0x9b0b('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb['findBy']));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x3ea5cb[_0x9b0b('0x159')]));return{'code':0xc8,'result':_0x9b0b('0x15d')};}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x160')]=function(_0x357435){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x161'),_0x357435[_0x9b0b('0x3d')]));if(!this['isConfigured'](_0x357435[_0x9b0b('0x162')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x357435,_0x9b0b('0x163'));}this[_0x9b0b('0x10')]['noop'](util['format'](_0x9b0b('0x164'),_0x357435[_0x9b0b('0x162')]));var _0x26a2a9=eval(_0x357435['operation']);if(!this[_0x9b0b('0xb0')](_0x357435[_0x9b0b('0xe2')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xe3'));}var _0x27873d=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x357435['variable_id']);if(!_0x27873d){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x357435,_0x9b0b('0xe4'));}if(_[_0x9b0b('0xa5')](_0x26a2a9)){var _0xbe0fd6=this;_0x26a2a9[_0x9b0b('0x165')](function(_0x3f2f4e,_0x381464){_0xbe0fd6[_0x9b0b('0x10')][_0x9b0b('0xaf')](util['format'](_0x9b0b('0x166'),_0x27873d,_0x381464),_0x3f2f4e);});return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x167'),_0x27873d));}else{return this[_0x9b0b('0x10')]['setVariable'](_0x27873d,_0x26a2a9);}};AGIVertices['prototype'][_0x9b0b('0x168')]=function(_0xffd521){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x169'),_0xffd521[_0x9b0b('0x3d')]));if(_0xffd521[_0x9b0b('0x114')]===0x0){return this[_0x9b0b('0xb2')](_0xffd521);}_0xffd521[_0x9b0b('0x114')]-=0x1;if(!this[_0x9b0b('0xb0')](_0xffd521[_0x9b0b('0x115')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0xffd521,'no\x20file\x20audio\x20selected');}var _0x3431fd=this[_0x9b0b('0x20')]['sync'](this,_0xffd521[_0x9b0b('0x115')]);if(!_0x3431fd){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0xffd521,_0x9b0b('0x117'));}var _0x576337=this[_0x9b0b('0x10')][_0x9b0b('0x16a')](_0x3431fd,_0xffd521['response'],_0xffd521[_0x9b0b('0x16b')]);var _0x1cd5e3=_0x576337[_0x9b0b('0xae')];if(_0x576337['result']===-0x1){this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0xffd521,'-1');return _0x576337;}else if(_0x576337[_0x9b0b('0xac')]===_0x9b0b('0x74')){_0x576337['result']=_0x576337[_0x9b0b('0xae')][_0x9b0b('0xa6')]>0x0?_0x576337[_0x9b0b('0xae')]:'t';}else if(_[_0x9b0b('0x50')](_0x576337['result'])){_0x576337[_0x9b0b('0xae')]='#';_0x1cd5e3='#';}if(!this[_0x9b0b('0xb0')](_0xffd521[_0x9b0b('0xe2')])){this[_0x9b0b('0x10')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x24aa05=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0xffd521[_0x9b0b('0xe2')]);if(!_0x24aa05){return this['channel'][_0x9b0b('0x5b')](_0xffd521,_0x9b0b('0xe4'));}this['channel']['setVariable'](_0x24aa05,_0x1cd5e3);}this['createSquareDetailsReport'][_0x9b0b('0xb1')](this,_0xffd521,_0x1cd5e3);return _0x576337;};AGIVertices[_0x9b0b('0x12')]['noop']=function(_0x4187fa){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x16c'),_0x4187fa[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x4187fa[_0x9b0b('0x16d')]||_0x4187fa[_0x9b0b('0x3d')]);};AGIVertices[_0x9b0b('0x12')]['pause']=function(_0x465c58){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x16e'),_0x465c58[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x465c58[_0x9b0b('0x159')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x465c58,_0x9b0b('0x15a'));}logger['info'](util[_0x9b0b('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58['findBy']));var _0x26b9cb=this[_0x9b0b('0x16f')]['sync'](this,_0x465c58[_0x9b0b('0x170')]);var _0x3b6a8c=this['agentPause']['sync'](this,_0x465c58[_0x9b0b('0x159')],_0x26b9cb);if(_0x3b6a8c){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x465c58[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x15b'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58[_0x9b0b('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x465c58[_0x9b0b('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x9b0b('0x171')]=function(_0x134d15){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x172'),_0x134d15[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x134d15[_0x9b0b('0x115')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x134d15,_0x9b0b('0x116'));}var _0x3d40f7=this[_0x9b0b('0x20')][_0x9b0b('0xb1')](this,_0x134d15[_0x9b0b('0x115')]);if(!_0x3d40f7){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x134d15,'no\x20file\x20audio\x20found');}var _0x41c33e=this[_0x9b0b('0x10')]['exec'](_0x9b0b('0x173'),[_0x3d40f7,_0x134d15['opts']]);if(_0x41c33e[_0x9b0b('0xae')]===-0x1){return _0x41c33e;}return this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),_0x9b0b('0x173'),_0x3d40f7));};AGIVertices['prototype'][_0x9b0b('0x174')]=function(_0x47e693){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x47e693[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x47e693[_0x9b0b('0x175')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x47e693,'no\x20queue\x20selected');}var _0x47ec14='';var _0x247ecb=parseInt(_0x47e693[_0x9b0b('0x175')],0xa);if(isNaN(_0x247ecb)){_0x47ec14=_0x47e693[_0x9b0b('0x175')];}else{_0x47ec14=this[_0x9b0b('0x176')][_0x9b0b('0xb1')](this,_0x47e693[_0x9b0b('0x175')]);if(!_0x47ec14){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x47e693,_0x9b0b('0x177'));}}var _0x43b623='';if(this[_0x9b0b('0xb0')](_0x47e693[_0x9b0b('0x115')])){var _0x4e0748=this[_0x9b0b('0x20')]['sync'](this,_0x47e693[_0x9b0b('0x115')]);if(_0x4e0748){_0x43b623=_0x4e0748;}}this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x47e693,_0x47ec14);if(_0x47e693[_0x9b0b('0xeb')][_0x9b0b('0x178')]('x')<0x0){_0x47e693['opts']+='x';}if(_0x47e693[_0x9b0b('0xeb')][_0x9b0b('0x178')]('X')<0x0){_0x47e693['opts']+='X';}this[_0x9b0b('0x10')][_0x9b0b('0xaf')]('XMCS-QUEUE',_0x47ec14?_0x47ec14[_0x9b0b('0x179')]():'');var _0x3d77e0=this[_0x9b0b('0x10')][_0x9b0b('0x63')]('QUEUE',[_0x47ec14,_0x47e693[_0x9b0b('0xeb')],_0x47e693['url'],_0x43b623,_0x47e693[_0x9b0b('0x74')],_0x47e693[_0x9b0b('0x8')],_0x47e693['macro'],_0x47e693[_0x9b0b('0x17a')],'',_0x47e693[_0x9b0b('0x17b')]]);if(_0x3d77e0['result']===-0x1){return _0x3d77e0;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),'QUEUE',_0x47ec14));};AGIVertices[_0x9b0b('0x12')]['record']=function(_0x436c8f){logger['info'](util['format'](_0x9b0b('0x17c'),_0x436c8f[_0x9b0b('0x3d')]));var _0x3c4c9c=_0x436c8f[_0x9b0b('0x17d')]||_0x9b0b('0x150');var _0x3a8099=util[_0x9b0b('0x2d')](_0x9b0b('0x17e'),this[_0x9b0b('0x10')]['uniqueid'],rs[_0x9b0b('0x11c')](0x5));var _0x2d42f1=util['format'](_0x9b0b('0x17f'),FILES_PATH,_0x3a8099,_0x3c4c9c);var _0x12d441=util[_0x9b0b('0x2d')](_0x9b0b('0x133'),FILES_PATH,_0x3a8099);this[_0x9b0b('0x40')][_0x9b0b('0xb1')](this,_0x436c8f,_0x3a8099,_0x2d42f1);this[_0x9b0b('0x10')][_0x9b0b('0xaf')](_0x9b0b('0x180'),_0x3a8099);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x12d441,_0x3c4c9c,_0x436c8f[_0x9b0b('0x181')],_0x436c8f[_0x9b0b('0x74')]);return this['channel']['recordFile'](_0x12d441,_0x3c4c9c,_0x436c8f[_0x9b0b('0x181')],_0x436c8f['timeout'],undefined,!![]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x182')]=function(_0x35b5e6){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x183'),_0x35b5e6[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x35b5e6[_0x9b0b('0x71')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x184'));}var _0xfa5435=this[_0x9b0b('0x70')][_0x9b0b('0xb1')](this,_0x35b5e6);logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x185'),util[_0x9b0b('0x186')](_0xfa5435,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x35b5e6['variable_id'])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x187'));}var _0x5dcae=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x35b5e6[_0x9b0b('0xe2')]);if(!_0x5dcae){return this['channel'][_0x9b0b('0x5b')](_0x35b5e6,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x9b0b('0x2d')]('%s_STATUS_CODE',_0x5dcae),_0xfa5435[_0x9b0b('0x82')]?_0xfa5435[_0x9b0b('0x82')]:_0x9b0b('0x188'));this[_0x9b0b('0x10')]['setVariable'](util[_0x9b0b('0x2d')](_0x9b0b('0x189'),_0x5dcae),_0xfa5435['statusMessage']?_0xfa5435['statusMessage']:'OK');if(_0xfa5435[_0x9b0b('0x79')]){try{this[_0x9b0b('0xa7')](_0xfa5435['body'],_0x5dcae);}catch(_0x20bd21){logger['error'](util['format'](_0x9b0b('0x18a'),_0x5dcae));}}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('variable\x20%s\x20set',_0x5dcae));};AGIVertices['prototype']['saydigits']=function(_0x150514){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x18b'),_0x150514[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x18c')](_0x150514[_0x9b0b('0x18d')][_0x9b0b('0x65')](/\s+/g,''),_0x150514[_0x9b0b('0x181')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x18e')]=function(_0x3ec32f){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x18f'),_0x3ec32f[_0x9b0b('0x3d')]));return this['channel'][_0x9b0b('0x190')](_0x3ec32f[_0x9b0b('0x73')][_0x9b0b('0x65')](/\s+/g,''),_0x3ec32f['escape_digits']);};AGIVertices[_0x9b0b('0x12')]['sayphonetic']=function(_0x5ce9ff){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x191'),_0x5ce9ff[_0x9b0b('0x3d')]));return this[_0x9b0b('0x10')][_0x9b0b('0x192')](_0x5ce9ff[_0x9b0b('0x69')],_0x5ce9ff[_0x9b0b('0x181')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x193')]=function(_0x5cef28){logger['info'](util[_0x9b0b('0x2d')](_0x9b0b('0x194'),_0x5cef28[_0x9b0b('0x3d')]));if(!this['isConfigured'](_0x5cef28[_0x9b0b('0x195')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x196'));}var _0xd8ac5f=this[_0x9b0b('0x24')][_0x9b0b('0xb1')](this,_0x5cef28[_0x9b0b('0x195')]);if(!_0xd8ac5f||!_0xd8ac5f[_0x9b0b('0x197')]){return this['channel'][_0x9b0b('0x5b')](_0x5cef28,_0x9b0b('0x198'));}var _0x1a55ef={'from':util[_0x9b0b('0x2d')](_0x9b0b('0x199'),_0xd8ac5f['name'],_0xd8ac5f['email']||_0xd8ac5f['Smtp']['user']),'to':_0x5cef28['to']||'','cc':_0x5cef28['cc']||'','bcc':_0x5cef28['bcc']||'','subject':_0x5cef28[_0x9b0b('0x19a')],'html':_0x5cef28[_0x9b0b('0x69')],'text':_0x5cef28[_0x9b0b('0x69')]};var _0x4a7501={'tls':{'rejectUnauthorized':![]}};if(_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19b')]){_0x4a7501[_0x9b0b('0x19b')]=_0xd8ac5f['Smtp'][_0x9b0b('0x19b')];}else{_0x4a7501[_0x9b0b('0x19c')]=_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19c')];_0x4a7501[_0x9b0b('0x19d')]=_0xd8ac5f[_0x9b0b('0x197')]['port'];_0x4a7501[_0x9b0b('0x19e')]=_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19e')];}if(_0xd8ac5f[_0x9b0b('0x197')][_0x9b0b('0x19f')]){_0x4a7501[_0x9b0b('0x1a0')]={'user':_0xd8ac5f['Smtp'][_0x9b0b('0x1a1')],'pass':_0xd8ac5f[_0x9b0b('0x197')]['pass']};}if(this[_0x9b0b('0xb0')](_0x5cef28['template_id'])){}logger[_0x9b0b('0x1a2')](_0x9b0b('0x1a3'),JSON[_0x9b0b('0x80')](_0x1a55ef));this['createSquareDetailsReport'][_0x9b0b('0xb1')](this,_0x5cef28,_0x5cef28[_0x9b0b('0x195')]);this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1a4'),_0xd8ac5f[_0x9b0b('0x15')]));this[_0x9b0b('0x26')]['sync'](this,_0x4a7501,_0x1a55ef);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x3d395e){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x1a5'),_0x3d395e['label']));return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0x1a6'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1a7')]=function(_0x4c80f4){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x1a8'),_0x4c80f4['label']));if(!this[_0x9b0b('0xb0')](_0x4c80f4[_0x9b0b('0x1a9')])){return this['channel']['noop'](_0x9b0b('0x1aa'));}var _0xafe5e1=this[_0x9b0b('0x38')][_0x9b0b('0xb1')](this,_0x4c80f4[_0x9b0b('0x1a9')]);if(!_0xafe5e1){return this['channel'][_0x9b0b('0x5b')](_0x4c80f4,'no\x20sms\x20account\x20found');}var _0x3e4e70={'body':_0x4c80f4[_0x9b0b('0x1ab')],'phone':_0x4c80f4['to']||'','SmsAccountId':_0xafe5e1['id']};logger['debug'](_0x9b0b('0x1ac'),JSON['stringify'](_0x3e4e70));this[_0x9b0b('0x3b')]['sync'](this,_0x4c80f4,_0x4c80f4[_0x9b0b('0x1a9')]);this[_0x9b0b('0x10')]['noop'](util[_0x9b0b('0x2d')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xafe5e1[_0x9b0b('0x15')]));this[_0x9b0b('0x3a')][_0x9b0b('0xb1')](this,_0x3e4e70);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0x1ad'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1ae')]=function(_0x2c275f){logger['info'](util['format'](_0x9b0b('0x1af'),_0x2c275f[_0x9b0b('0x3d')]));if(!this['isConfigured'](_0x2c275f[_0x9b0b('0xe2')])){return this['channel'][_0x9b0b('0x5b')](_0x2c275f,_0x9b0b('0x1b0'));}var _0x57a339=this[_0x9b0b('0x13')][_0x9b0b('0xb1')](this,_0x2c275f[_0x9b0b('0xe2')]);if(!_0x57a339){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x2c275f,_0x9b0b('0xe4'));}return this[_0x9b0b('0x10')][_0x9b0b('0xaf')](_0x57a339,_0x2c275f[_0x9b0b('0x1b1')]);};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1b2')]=function(_0x3134f7){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3134f7[_0x9b0b('0x3d')]));this['channel']['noop'](_0x9b0b('0x1b3'));if(_0x3134f7[_0x9b0b('0xc4')]===_0x9b0b('0x1b4')){this[_0x9b0b('0x10')][_0x9b0b('0xb5')]('Answer');return this[_0x9b0b('0x10')]['answer']();}return this['channel'][_0x9b0b('0xb5')](_0x9b0b('0x1b5'));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1b6')]=function(_0x4f7ded){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x1b7'),_0x4f7ded[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x4f7ded[_0x9b0b('0x1b8')])){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x4f7ded,_0x9b0b('0x1b9'));}var _0x370037=this[_0x9b0b('0x18')][_0x9b0b('0xb1')](this,_0x4f7ded['project_id']);if(!this[_0x9b0b('0xb0')](_0x370037)){return this[_0x9b0b('0x10')]['error'](_0x4f7ded,util[_0x9b0b('0x2d')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4f7ded['project_id']));}if(_0x370037===this[_0x9b0b('0x10')][_0x9b0b('0x3e')]){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x4f7ded,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x4f7ded,_0x370037);var _0x341762=this[_0x9b0b('0x10')]['exec']('AGI',util[_0x9b0b('0x2d')](_0x9b0b('0x1ba'),config[_0x9b0b('0x8')][_0x9b0b('0x19c')]||_0x9b0b('0x1bb'),_0x370037,this[_0x9b0b('0x10')]['arg_1']));if(_0x341762[_0x9b0b('0xae')]===-0x1){return _0x341762;}return this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0xd0'),_0x9b0b('0x1bc'),_0x370037));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1bd')]=function(_0x105b69){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x1be'),_0x105b69[_0x9b0b('0x3d')]));var _0x27efce=this[_0x9b0b('0x62')][_0x9b0b('0xb1')](this,_0x105b69[_0x9b0b('0x1bf')]);this[_0x9b0b('0x3b')][_0x9b0b('0xb1')](this,_0x105b69,_0x105b69[_0x9b0b('0x1bf')]);if(this[_0x9b0b('0xb0')](_0x105b69[_0x9b0b('0xe2')])){var _0xe5bc76=this['getVariable'][_0x9b0b('0xb1')](this,_0x105b69[_0x9b0b('0xe2')]);if(_0xe5bc76){this[_0x9b0b('0x10')]['setVariable'](_0xe5bc76,_0x27efce);return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util['format'](_0x9b0b('0x1c0'),_0x105b69[_0x9b0b('0x1bf')],_0xe5bc76));}}return this['channel']['noop'](util[_0x9b0b('0x2d')](_0x9b0b('0x1c1'),_0x105b69[_0x9b0b('0x1bf')]));};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1c2')]=function(_0x588e72){logger[_0x9b0b('0x31')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x588e72[_0x9b0b('0x3d')]));_0x588e72[_0x9b0b('0x69')]=_0x588e72[_0x9b0b('0x69')][_0x9b0b('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b0b('0xb0')](_0x588e72['apiKey'])){return this[_0x9b0b('0x10')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x9b0b('0xb0')](_0x588e72[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](_0x9b0b('0xd4'));}this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c3'),_0x588e72[_0x9b0b('0x69')]));var _0x207cff=this[_0x9b0b('0x66')][_0x9b0b('0xb1')](this,_0x588e72);if(_0x207cff){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c4'),_0x207cff));var _0x47cd18=this[_0x9b0b('0x10')]['streamFile'](_0x207cff);try{fs['unlink'](_0x207cff+_0x9b0b('0x104'));}catch(_0xc90b55){logger[_0x9b0b('0x5b')](_0xc90b55);}return _0x47cd18;}return this[_0x9b0b('0x10')]['error'](_0x588e72,_0x9b0b('0x1c5'));};AGIVertices[_0x9b0b('0x12')]['tts']=function(_0x35aae8){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x35aae8[_0x9b0b('0x3d')]));_0x35aae8['text']=_0x35aae8[_0x9b0b('0x69')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b0b('0xb0')](_0x35aae8[_0x9b0b('0x69')])){return this[_0x9b0b('0x10')]['noop'](_0x9b0b('0xd4'));}this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c6'),_0x35aae8[_0x9b0b('0x69')]));var _0x35261c=this[_0x9b0b('0x6f')][_0x9b0b('0xb1')](this,_0x35aae8);if(_0x35261c){this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x1c7'),_0x35261c));var _0x37fa60=this[_0x9b0b('0x10')][_0x9b0b('0x102')](_0x35261c);try{fs[_0x9b0b('0x103')](_0x35261c+_0x9b0b('0x104'));}catch(_0x5b8ff1){logger[_0x9b0b('0x5b')](_0x5b8ff1);}return _0x37fa60;}return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x35aae8,_0x9b0b('0x1c8'));};AGIVertices['prototype'][_0x9b0b('0x1c9')]=function(_0x4dac39){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')](_0x9b0b('0x1ca'),_0x4dac39[_0x9b0b('0x3d')]));if(!this[_0x9b0b('0xb0')](_0x4dac39[_0x9b0b('0x159')])){return this['channel']['error'](_0x4dac39,_0x9b0b('0x15a'));}logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9b0b('0x3f')],_0x4dac39['findBy']));var _0x2d8271=this[_0x9b0b('0x5c')][_0x9b0b('0xb1')](this,_0x4dac39[_0x9b0b('0x159')]);if(_0x2d8271){logger[_0x9b0b('0x31')](util['format'](_0x9b0b('0x15b'),this[_0x9b0b('0x10')]['callerid'],_0x4dac39[_0x9b0b('0x159')]));this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4dac39[_0x9b0b('0x159')]));return{'code':0xc8,'result':_0x9b0b('0x1cb')};}else{logger['info'](util[_0x9b0b('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x4dac39[_0x9b0b('0x159')]));this['channel'][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')](_0x9b0b('0x15c'),this[_0x9b0b('0x10')][_0x9b0b('0x3f')],_0x4dac39[_0x9b0b('0x159')]));return{'code':0xc8,'result':_0x9b0b('0x15d')};}};AGIVertices[_0x9b0b('0x12')][_0x9b0b('0x1cc')]=function(_0x285a29){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x285a29[_0x9b0b('0x3d')]));var _0x585bf8=this[_0x9b0b('0x10')][_0x9b0b('0x63')](_0x9b0b('0x1cd'),[_0x285a29[_0x9b0b('0x1ce')],_0x285a29[_0x9b0b('0x86')]]);if(_0x585bf8[_0x9b0b('0xae')]===-0x1){return _0x585bf8;}return this[_0x9b0b('0x10')][_0x9b0b('0xb5')](util[_0x9b0b('0x2d')]('Executed\x20command\x20%s\x20%s',_0x9b0b('0x1cd'),_0x285a29[_0x9b0b('0x1ce')]));};AGIVertices['prototype'][_0x9b0b('0x1cf')]=function(_0x38f50a){logger[_0x9b0b('0x31')](util[_0x9b0b('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x38f50a['label']));if(!this['isConfigured'](_0x38f50a[_0x9b0b('0xe2')])){return this['channel']['error'](_0x38f50a,'no\x20variable\x20selected');}var _0x126ca7=this['getVariable']['sync'](this,_0x38f50a[_0x9b0b('0xe2')]);if(!_0x126ca7){return this[_0x9b0b('0x10')][_0x9b0b('0x5b')](_0x38f50a,_0x9b0b('0xe4'));}var _0x5bc0fc=this['channel'][_0x9b0b('0x13')](_0x126ca7);return{'code':0xc8,'result':_0x5bc0fc[_0x9b0b('0xac')]?_0x5bc0fc['extra']:'-'};};String[_0x9b0b('0x12')]['replaceAll']=function(_0x76465c,_0x425297){return this[_0x9b0b('0xa9')](_0x76465c)['join'](_0x425297);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 24d4c2a..e722519 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 _0x3e74=['acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','attended','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','exports','util','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','agentringnoanswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3e74,0x175));var _0x43e7=function(_0xa2f415,_0xde87d){_0xa2f415=_0xa2f415-0x0;var _0x435dde=_0x3e74[_0xa2f415];return _0x435dde;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var moment=require(_0x43e7('0x1'));var ami=require(_0x43e7('0x2'));var logger=require(_0x43e7('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x43e7('0x4'));function Acw(_0x4f9bbe){this[_0x43e7('0x5')]=_0x4f9bbe[_0x43e7('0x5')];this[_0x43e7('0x6')]=_0x4f9bbe[_0x43e7('0x6')];this[_0x43e7('0x7')]=_0x4f9bbe['timers'];this[_0x43e7('0x8')]={};ami['on'](_0x43e7('0x9'),this[_0x43e7('0xa')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xc'),this['syncHangupRequest'][_0x43e7('0xb')](this));ami['on']('hangup',this['syncHangup'][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xd'),this['syncAgentRingNoAnswer'][_0x43e7('0xb')](this));ami['on']('attendedtransfer',this[_0x43e7('0xe')][_0x43e7('0xb')](this));ami['on']('blindtransfer',this[_0x43e7('0xf')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0x10'),this[_0x43e7('0x11')]['bind'](this));}function getDiff(_0x583d85){var _0x2fcb36=moment()[_0x43e7('0x12')](0x0);var _0x44b0bd=moment(_0x583d85)['milliseconds'](0x0);return _0x2fcb36['diff'](_0x44b0bd,_0x43e7('0x13'));}Acw[_0x43e7('0x14')][_0x43e7('0x15')]=function(_0x328445){try{var _0x4de324=this;var _0x5c4eaa=this[_0x43e7('0x8')][_0x328445][_0x43e7('0x16')];var _0x273a32=this['channels'][_0x328445]['queue'];var _0x446986=this[_0x43e7('0x5')][_0x273a32];var _0x9037d3=![];var _0x140657=_0x43e7('0x17');if(_0x446986[_0x43e7('0x18')]){if(_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')]){_0x9037d3=!![];_0x140657=_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')];}}ami[_0x43e7('0x1b')]({'action':_0x43e7('0x1c'),'interface':_0x5c4eaa,'paused':!![],'reason':_0x140657})['then'](function(_0xef1a5a){if(_0x4de324[_0x43e7('0x6')][_0x5c4eaa]){return RpcUser['getAgent'](_0x4de324[_0x43e7('0x6')][_0x5c4eaa]['id'])[_0x43e7('0x1d')](function(_0x3945bb){if(_0x3945bb&&!_0x3945bb[_0x43e7('0x1e')]){logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x328445,_0x5c4eaa,_0x273a32);var _0x54a9e7=_0x4de324[_0x43e7('0x8')][_0x328445]['attended']&&_0x4de324['channels'][_0x328445][_0x43e7('0x21')]?_0x4de324[_0x43e7('0x8')][_0x328445]['destlinkedid']:_0x328445;return RpcUser[_0x43e7('0x22')](_0x4de324['agents'][_0x5c4eaa],_0x140657,_0x54a9e7)[_0x43e7('0x1d')](function(_0x5c5e67){if(!_0x9037d3){_0x4de324[_0x43e7('0x7')][_0x5c4eaa]={};logger[_0x43e7('0x1f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);_0x4de324['timers'][_0x5c4eaa][_0x43e7('0x24')]=setTimeout(_0x4de324['stopAcw'][_0x43e7('0xb')](_0x4de324,_0x5c4eaa),_0x4de324[_0x43e7('0x5')][_0x273a32][_0x43e7('0x25')]*0x3e8);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['lastPauseAt']=moment()[_0x43e7('0x26')](_0x43e7('0x27'));_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')]=_0x328445;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x29')]=_0x273a32;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2a')]=function(){var _0x3bf475=getDiff(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2b')]);clearTimeout(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x24')]);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['timer']=![];RpcVoiceAgentReport[_0x43e7('0x2c')]({'acwtime':_0x3bf475},_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')],_0x5c4eaa)[_0x43e7('0x1d')](function(_0x4251c8){logger['info'](_0x43e7('0x2d'),_0x328445,_0x3bf475,_0x4251c8);})[_0x43e7('0x2e')](function(_0x30d47e){logger[_0x43e7('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x328445,_0x30d47e);});delete _0x4de324['timers'][_0x5c4eaa];};}});}else{logger['info'](_0x43e7('0x30'),_0x328445,_0x5c4eaa,_0x273a32);}});}})[_0x43e7('0x2e')](function(_0x117c07){logger[_0x43e7('0x2f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);})['finally'](function(){delete _0x4de324['channels'][_0x328445];});}catch(_0x59e5b2){logger['error']('[ACW][START]\x20%s',_0x59e5b2['message']);}};Acw[_0x43e7('0x14')]['stopAcw']=function(_0x2b4bfd){try{var _0x8e9f40=this;if(_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]){_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd][_0x43e7('0x24')]=![];var _0x449803=_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]['uniqueid'];var _0x5332d9=_0x8e9f40['timers'][_0x2b4bfd][_0x43e7('0x29')];var _0xfe70e9=_0x8e9f40[_0x43e7('0x5')][_0x5332d9][_0x43e7('0x25')];logger[_0x43e7('0x1f')](_0x43e7('0x31'),_0x2b4bfd);RpcUser[_0x43e7('0x32')](this[_0x43e7('0x6')][_0x2b4bfd]);RpcVoiceAgentReport['update']({'acwtime':_0xfe70e9,'agentacw':!![]},_0x449803,_0x2b4bfd)[_0x43e7('0x1d')](function(_0x2b0ffe){logger['info'](_0x43e7('0x2d'),_0x449803,_0xfe70e9,_0x2b0ffe);})['catch'](function(_0x44d8e4){logger[_0x43e7('0x2f')](_0x43e7('0x33'),_0x449803,_0x44d8e4);});}else{logger[_0x43e7('0x2f')](_0x43e7('0x34'),_0x2b4bfd);if(_0x8e9f40[_0x43e7('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x43e7('0x35')](_0x8e9f40[_0x43e7('0x7')]));}}}catch(_0x44b6ae){logger[_0x43e7('0x2f')](_0x43e7('0x36'),_0x44b6ae['message']);}};Acw[_0x43e7('0x14')][_0x43e7('0xa')]=function(_0x575439){try{if(this[_0x43e7('0x5')][_0x575439['queue']]&&(this[_0x43e7('0x5')][_0x575439['queue']][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x575439[_0x43e7('0x29')]][_0x43e7('0x18')])){if(this['agents'][_0x575439['interface']]){this[_0x43e7('0x8')][_0x575439[_0x43e7('0x28')]]={'queue':_0x575439[_0x43e7('0x29')],'interface':_0x575439[_0x43e7('0x16')],'destlinkedid':_0x575439['destlinkedid']};}}}catch(_0x583047){logger['error'](_0x43e7('0x38'),_0x583047['message']);}};Acw[_0x43e7('0x14')]['syncAgentConnectPreview']=function(_0x5b28db){try{if(this[_0x43e7('0x5')][_0x5b28db['queue']]&&(this[_0x43e7('0x5')][_0x5b28db[_0x43e7('0x29')]][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x5b28db['queue']][_0x43e7('0x18')])){if(this[_0x43e7('0x6')][_0x5b28db[_0x43e7('0x16')]]){this[_0x43e7('0x8')][_0x5b28db[_0x43e7('0x28')]]={'queue':_0x5b28db[_0x43e7('0x29')],'interface':_0x5b28db['interface']};}}}catch(_0x4930a2){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4930a2[_0x43e7('0x3a')]);}};Acw['prototype']['syncHangupRequest']=function(_0x56489b){try{if(this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]]&&_['isUndefined'](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]][_0x43e7('0x3b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x56489b['uniqueid']);this['startAcw'](_0x56489b[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x56489b['linkedid']]&&_[_0x43e7('0x3c')](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x3d')]][_0x43e7('0x3b')])){logger['info'](_0x43e7('0x3e'),_0x56489b['linkedid']);this['startAcw'](_0x56489b[_0x43e7('0x3d')]);}}catch(_0x12f9ba){logger[_0x43e7('0x2f')](_0x43e7('0x3f'),_0x12f9ba[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0x40')]=function(_0x256ddd){try{if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x28')]]&&this['channels'][_0x256ddd[_0x43e7('0x28')]][_0x43e7('0x3b')]){logger['info'](_0x43e7('0x41'),_0x256ddd['uniqueid']);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x3d')]]&&this[_0x43e7('0x8')][_0x256ddd['linkedid']]['attended']){logger[_0x43e7('0x1f')](_0x43e7('0x42'),_0x256ddd[_0x43e7('0x3d')]);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x3d')]);}}catch(_0x25bb44){logger[_0x43e7('0x2f')](_0x43e7('0x43'),_0x25bb44[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xe')]=function(_0x4ace49){try{if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49['transfereeuniqueid']])){this[_0x43e7('0x15')](_0x4ace49[_0x43e7('0x45')]);if(this[_0x43e7('0x8')][_0x4ace49['secondtransfereruniqueid']]){this['channels'][_0x4ace49[_0x43e7('0x46')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49[_0x43e7('0x47')]]=this['channels'][_0x4ace49['secondtransfereruniqueid']];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x46')]];}}else if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x47')]])){this['startAcw'](_0x4ace49[_0x43e7('0x47')]);if(this[_0x43e7('0x8')][_0x4ace49['origtransfereruniqueid']]){this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49['transfereeuniqueid']]=this['channels'][_0x4ace49[_0x43e7('0x48')]];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]];}}}catch(_0x3a6404){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3a6404[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xf')]=function(_0x5dd349){try{if(this['channels'][_0x5dd349[_0x43e7('0x49')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4a'),JSON[_0x43e7('0x35')](_0x5dd349[_0x43e7('0x49')]));this[_0x43e7('0x15')](_0x5dd349[_0x43e7('0x49')]);}else if(this[_0x43e7('0x8')][_0x5dd349[_0x43e7('0x4b')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4c'),JSON['stringify'](_0x5dd349['transfererlinkedid']));this[_0x43e7('0x15')](_0x5dd349['transfererlinkedid']);}}catch(_0x501616){logger['error'](_0x43e7('0x4d'),_0x501616[_0x43e7('0x3a')]);}};Acw['prototype'][_0x43e7('0x4e')]=function(_0x135791){try{if(this[_0x43e7('0x5')][_0x135791['queue']]&&this[_0x43e7('0x5')][_0x135791[_0x43e7('0x29')]][_0x43e7('0x4f')]===_0x43e7('0x50')){if(this[_0x43e7('0x6')][_0x135791[_0x43e7('0x16')]]){logger[_0x43e7('0x1f')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x135791[_0x43e7('0x28')],_0x135791[_0x43e7('0x16')],_0x135791[_0x43e7('0x29')]);return RpcUser['savePause'](this['agents'][_0x135791[_0x43e7('0x16')]],'Auto-Pause',_0x135791['uniqueid']);}}}catch(_0x1b793d){logger[_0x43e7('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1b793d[_0x43e7('0x3a')]);}};module[_0x43e7('0x51')]=Acw; \ No newline at end of file +var _0x5fd1=['../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','stopAcw','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami'];(function(_0x13f186,_0xd8356d){var _0x93fcb0=function(_0x2f6ba4){while(--_0x2f6ba4){_0x13f186['push'](_0x13f186['shift']());}};_0x93fcb0(++_0xd8356d);}(_0x5fd1,0x155));var _0x15fd=function(_0x206959,_0x3ed81f){_0x206959=_0x206959-0x0;var _0x4d04b1=_0x5fd1[_0x206959];return _0x4d04b1;};'use strict';var util=require(_0x15fd('0x0'));var _=require('lodash');var moment=require(_0x15fd('0x1'));var ami=require(_0x15fd('0x2'));var logger=require(_0x15fd('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x15fd('0x4'));function Acw(_0x3138f3){this[_0x15fd('0x5')]=_0x3138f3['voiceQueues'];this[_0x15fd('0x6')]=_0x3138f3[_0x15fd('0x6')];this[_0x15fd('0x7')]=_0x3138f3[_0x15fd('0x7')];this[_0x15fd('0x8')]={};ami['on']('agentconnect',this[_0x15fd('0x9')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xb'),this['syncHangupRequest'][_0x15fd('0xa')](this));ami['on']('hangup',this[_0x15fd('0xc')][_0x15fd('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x15fd('0xd'),this[_0x15fd('0xe')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0xf'),this[_0x15fd('0x10')][_0x15fd('0xa')](this));ami['on'](_0x15fd('0x11'),this[_0x15fd('0x12')][_0x15fd('0xa')](this));}function getDiff(_0x4cb391){var _0x5b7af0=moment()['milliseconds'](0x0);var _0x3fda60=moment(_0x4cb391)[_0x15fd('0x13')](0x0);return _0x5b7af0[_0x15fd('0x14')](_0x3fda60,_0x15fd('0x15'));}Acw[_0x15fd('0x16')][_0x15fd('0x17')]=function(_0x2c5375){try{var _0x44a63a=this;var _0x5aae13=this['channels'][_0x2c5375][_0x15fd('0x18')];var _0x5ca5a2=this[_0x15fd('0x8')][_0x2c5375]['queue'];var _0x917fe4=this[_0x15fd('0x5')][_0x5ca5a2];var _0x855bae=![];var _0x49ceac=_0x15fd('0x19');if(_0x917fe4[_0x15fd('0x1a')]){if(_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')]){_0x855bae=!![];_0x49ceac=_0x917fe4[_0x15fd('0x1b')][_0x15fd('0x1c')];}}ami[_0x15fd('0x1d')]({'action':_0x15fd('0x1e'),'interface':_0x5aae13,'paused':!![],'reason':_0x49ceac})[_0x15fd('0x1f')](function(_0x1eab55){if(_0x44a63a[_0x15fd('0x6')][_0x5aae13]){return RpcUser['getAgent'](_0x44a63a['agents'][_0x5aae13]['id'])[_0x15fd('0x1f')](function(_0x36b21e){if(_0x36b21e&&!_0x36b21e[_0x15fd('0x20')]){logger[_0x15fd('0x21')](_0x15fd('0x22'),_0x2c5375,_0x5aae13,_0x5ca5a2);var _0x11496a=_0x44a63a[_0x15fd('0x8')][_0x2c5375]['attended']&&_0x44a63a[_0x15fd('0x8')][_0x2c5375][_0x15fd('0x23')]?_0x44a63a[_0x15fd('0x8')][_0x2c5375]['destlinkedid']:_0x2c5375;return RpcUser[_0x15fd('0x24')](_0x44a63a['agents'][_0x5aae13],_0x49ceac,_0x11496a)[_0x15fd('0x1f')](function(_0x1fc24f){if(!_0x855bae){_0x44a63a[_0x15fd('0x7')][_0x5aae13]={};logger['info'](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')],_0x5aae13,_0x5ca5a2);_0x44a63a['timers'][_0x5aae13][_0x15fd('0x27')]=setTimeout(_0x44a63a['stopAcw'][_0x15fd('0xa')](_0x44a63a,_0x5aae13),_0x44a63a[_0x15fd('0x5')][_0x5ca5a2][_0x15fd('0x26')]*0x3e8);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x28')]=moment()[_0x15fd('0x29')](_0x15fd('0x2a'));_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')]=_0x2c5375;_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2c')]=_0x5ca5a2;_0x44a63a['timers'][_0x5aae13][_0x15fd('0x2d')]=function(){var _0x2fe61e=getDiff(_0x44a63a['timers'][_0x5aae13][_0x15fd('0x28')]);clearTimeout(_0x44a63a[_0x15fd('0x7')][_0x5aae13]['timer']);_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2fe61e},_0x44a63a[_0x15fd('0x7')][_0x5aae13][_0x15fd('0x2b')],_0x5aae13)[_0x15fd('0x1f')](function(_0x476828){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x2c5375,_0x2fe61e,_0x476828);})['catch'](function(_0x2d647c){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x2c5375,_0x2d647c);});delete _0x44a63a[_0x15fd('0x7')][_0x5aae13];};}});}else{logger['info'](_0x15fd('0x31'),_0x2c5375,_0x5aae13,_0x5ca5a2);}});}})[_0x15fd('0x32')](function(_0x11b3a1){logger[_0x15fd('0x2f')](_0x15fd('0x25'),_0x2c5375,_0x44a63a[_0x15fd('0x5')][_0x5ca5a2]['acwTimeout'],_0x5aae13,_0x5ca5a2);})[_0x15fd('0x33')](function(){delete _0x44a63a[_0x15fd('0x8')][_0x2c5375];});}catch(_0x57c118){logger[_0x15fd('0x2f')](_0x15fd('0x34'),_0x57c118[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0x36')]=function(_0x309851){try{var _0x1732bc=this;if(_0x1732bc[_0x15fd('0x7')][_0x309851]){_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x27')]=![];var _0x4d7259=_0x1732bc['timers'][_0x309851]['uniqueid'];var _0x340d17=_0x1732bc[_0x15fd('0x7')][_0x309851][_0x15fd('0x2c')];var _0x4e608d=_0x1732bc['voiceQueues'][_0x340d17][_0x15fd('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x309851);RpcUser['saveUnpause'](this[_0x15fd('0x6')][_0x309851]);RpcVoiceAgentReport[_0x15fd('0x37')]({'acwtime':_0x4e608d,'agentacw':!![]},_0x4d7259,_0x309851)[_0x15fd('0x1f')](function(_0x59d0d7){logger[_0x15fd('0x21')](_0x15fd('0x2e'),_0x4d7259,_0x4e608d,_0x59d0d7);})[_0x15fd('0x32')](function(_0x5beb6e){logger[_0x15fd('0x2f')](_0x15fd('0x30'),_0x4d7259,_0x5beb6e);});}else{logger[_0x15fd('0x2f')](_0x15fd('0x38'),_0x309851);if(_0x1732bc[_0x15fd('0x7')]){logger[_0x15fd('0x21')](_0x15fd('0x39'),JSON[_0x15fd('0x3a')](_0x1732bc[_0x15fd('0x7')]));}}}catch(_0x5dd3c4){logger[_0x15fd('0x2f')](_0x15fd('0x3b'),_0x5dd3c4[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x9')]=function(_0x5f9429){try{if(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]]&&(this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x5f9429[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x5f9429['interface']]){this[_0x15fd('0x8')][_0x5f9429[_0x15fd('0x2b')]]={'queue':_0x5f9429[_0x15fd('0x2c')],'interface':_0x5f9429[_0x15fd('0x18')],'destlinkedid':_0x5f9429[_0x15fd('0x23')]};}}}catch(_0x44d08b){logger[_0x15fd('0x2f')](_0x15fd('0x3d'),_0x44d08b['message']);}};Acw['prototype'][_0x15fd('0x12')]=function(_0x57bbd5){try{if(this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]]&&(this['voiceQueues'][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x3c')]||this[_0x15fd('0x5')][_0x57bbd5[_0x15fd('0x2c')]][_0x15fd('0x1a')])){if(this[_0x15fd('0x6')][_0x57bbd5['interface']]){this[_0x15fd('0x8')][_0x57bbd5[_0x15fd('0x2b')]]={'queue':_0x57bbd5[_0x15fd('0x2c')],'interface':_0x57bbd5[_0x15fd('0x18')]};}}}catch(_0xcce802){logger[_0x15fd('0x2f')](_0x15fd('0x3e'),_0xcce802[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x3f')]=function(_0x16b4f5){try{if(this[_0x15fd('0x8')][_0x16b4f5['uniqueid']]&&_[_0x15fd('0x40')](this['channels'][_0x16b4f5[_0x15fd('0x2b')]][_0x15fd('0x41')])){logger[_0x15fd('0x21')]('[%s][HANGUP:UNIQUEID]',_0x16b4f5[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x16b4f5[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x16b4f5['linkedid']]&&_[_0x15fd('0x40')](this[_0x15fd('0x8')][_0x16b4f5[_0x15fd('0x42')]][_0x15fd('0x41')])){logger['info'](_0x15fd('0x43'),_0x16b4f5[_0x15fd('0x42')]);this['startAcw'](_0x16b4f5['linkedid']);}}catch(_0x5da44c){logger[_0x15fd('0x2f')](_0x15fd('0x44'),_0x5da44c[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0xc')]=function(_0x33a128){try{if(this['channels'][_0x33a128[_0x15fd('0x2b')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x2b')]]['attended']){logger[_0x15fd('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x33a128[_0x15fd('0x2b')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x2b')]);}else if(this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]]&&this[_0x15fd('0x8')][_0x33a128[_0x15fd('0x42')]][_0x15fd('0x41')]){logger[_0x15fd('0x21')](_0x15fd('0x45'),_0x33a128[_0x15fd('0x42')]);this[_0x15fd('0x17')](_0x33a128[_0x15fd('0x42')]);}}catch(_0x5343b8){logger[_0x15fd('0x2f')]('[ACW][syncHangup]\x20%s',_0x5343b8[_0x15fd('0x35')]);}};Acw['prototype'][_0x15fd('0xe')]=function(_0x1fac7f){try{if(!_[_0x15fd('0x46')](this['channels'][_0x1fac7f['transfereeuniqueid']])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x47')]);if(this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]]){this['channels'][_0x1fac7f[_0x15fd('0x48')]][_0x15fd('0x41')]=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]]=this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x48')]];delete this['channels'][_0x1fac7f[_0x15fd('0x48')]];}}else if(!_[_0x15fd('0x46')](this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x49')]])){this[_0x15fd('0x17')](_0x1fac7f[_0x15fd('0x49')]);if(this['channels'][_0x1fac7f['origtransfereruniqueid']]){this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]]['attended']=!![];this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x47')]]=this['channels'][_0x1fac7f[_0x15fd('0x4a')]];delete this[_0x15fd('0x8')][_0x1fac7f[_0x15fd('0x4a')]];}}}catch(_0x53bfd7){logger[_0x15fd('0x2f')](_0x15fd('0x4b'),_0x53bfd7[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x10')]=function(_0x1f4581){try{if(this[_0x15fd('0x8')][_0x1f4581[_0x15fd('0x4c')]]){logger[_0x15fd('0x21')](_0x15fd('0x4d'),JSON['stringify'](_0x1f4581[_0x15fd('0x4c')]));this[_0x15fd('0x17')](_0x1f4581['transfereruniqueid']);}else if(this['channels'][_0x1f4581[_0x15fd('0x4e')]]){logger[_0x15fd('0x21')](_0x15fd('0x4f'),JSON[_0x15fd('0x3a')](_0x1f4581[_0x15fd('0x4e')]));this[_0x15fd('0x17')](_0x1f4581['transfererlinkedid']);}}catch(_0x41d398){logger[_0x15fd('0x2f')](_0x15fd('0x50'),_0x41d398[_0x15fd('0x35')]);}};Acw[_0x15fd('0x16')][_0x15fd('0x51')]=function(_0xf27ab4){try{if(this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]&&this[_0x15fd('0x5')][_0xf27ab4[_0x15fd('0x2c')]]['autopause']==='all'){if(this[_0x15fd('0x6')][_0xf27ab4[_0x15fd('0x18')]]){logger[_0x15fd('0x21')](_0x15fd('0x52'),_0xf27ab4[_0x15fd('0x2b')],_0xf27ab4[_0x15fd('0x18')],_0xf27ab4[_0x15fd('0x2c')]);return RpcUser['savePause'](this[_0x15fd('0x6')][_0xf27ab4['interface']],_0x15fd('0x53'),_0xf27ab4['uniqueid']);}}}catch(_0x1c2828){logger['error'](_0x15fd('0x54'),_0x1c2828[_0x15fd('0x35')]);}};module[_0x15fd('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c3c54bd..195eaba 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 _0x5624=['actionQueueSummary','queuesummary','actionCoreShowChannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','username','inspect','fullybooted','resolve','then','log','exports','asterisk-manager','bluebird','moment','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','action','error','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','sippeerstatus'];(function(_0x3e19ca,_0x5a88a0){var _0x51b3b8=function(_0x3e822c){while(--_0x3e822c){_0x3e19ca['push'](_0x3e19ca['shift']());}};_0x51b3b8(++_0x5a88a0);}(_0x5624,0x19c));var _0x4562=function(_0x527372,_0x173b25){_0x527372=_0x527372-0x0;var _0x4f88b2=_0x5624[_0x527372];return _0x4f88b2;};'use strict';var Manager=require(_0x4562('0x0'));var BPromise=require(_0x4562('0x1'));var moment=require(_0x4562('0x2'));var util=require('util');var _=require('lodash');var logger=require(_0x4562('0x3'))(_0x4562('0x4'));var config=require(_0x4562('0x5'));var ami=new Manager(config[_0x4562('0x6')]['port'],config[_0x4562('0x6')]['ip'],config[_0x4562('0x6')]['username'],config[_0x4562('0x6')][_0x4562('0x7')],!![]);ami[_0x4562('0x8')]();ami[_0x4562('0x9')]=BPromise['promisify'](ami[_0x4562('0xa')]);function error(_0x145769){logger[_0x4562('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x4562('0x6')]['username'],config[_0x4562('0x6')]['ip'],config['asterisk'][_0x4562('0xc')],util['inspect'](_0x145769,![],null)));}function close(){logger[_0x4562('0xb')](util['format'](_0x4562('0xd'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x4562('0x6')]['port']));}ami[_0x4562('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x4562('0xf')]=function(){return function(){return ami[_0x4562('0x9')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x4562('0x9')]({'action':_0x4562('0x10')});};};ami[_0x4562('0x11')]=function(){return function(){return ami[_0x4562('0x9')]({'action':_0x4562('0x12')});};};ami[_0x4562('0x13')]=function(){return function(){return ami[_0x4562('0x9')]({'action':'coreshowchannels'});};};function connect(_0x5e8f1f){logger[_0x4562('0x14')](util[_0x4562('0x15')](_0x4562('0x16'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk'][_0x4562('0xc')]));ami[_0x4562('0x17')](_0x4562('0xb'),error);ami['once'](_0x4562('0x18'),close);}ami['on']('connect',connect);ami['on'](_0x4562('0x19'),function(_0x19ac8a){logger['info'](util[_0x4562('0x15')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x4562('0x1a')],config[_0x4562('0x6')]['ip'],config[_0x4562('0x6')][_0x4562('0xc')],util[_0x4562('0x1b')](_0x19ac8a,![],null)));});ami['on'](_0x4562('0x1c'),function(_0x1a32ae){logger[_0x4562('0x14')](util[_0x4562('0x15')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x4562('0x1a')],config[_0x4562('0x6')]['ip'],config[_0x4562('0x6')][_0x4562('0xc')]));return BPromise[_0x4562('0x1d')]()['then'](ami[_0x4562('0xe')]())[_0x4562('0x1e')](ami[_0x4562('0xf')]())[_0x4562('0x1e')](ami['actionSipPeerStatus']())[_0x4562('0x1e')](ami[_0x4562('0x11')]())[_0x4562('0x1e')](ami[_0x4562('0x13')]())['catch'](function(_0x3c700e){console[_0x4562('0x1f')](_0x3c700e);});});ami[_0x4562('0x17')](_0x4562('0xb'),error);ami[_0x4562('0x17')]('close',close);module[_0x4562('0x20')]=ami; \ No newline at end of file +var _0xaaa7=['then','actionSipShowRegistry','actionSipPeerStatus','catch','log','exports','asterisk-manager','bluebird','moment','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','inspect','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','fullybooted','resolve'];(function(_0x5d54f1,_0x213f3e){var _0x3273e8=function(_0x1cf975){while(--_0x1cf975){_0x5d54f1['push'](_0x5d54f1['shift']());}};_0x3273e8(++_0x213f3e);}(_0xaaa7,0x1c2));var _0x7aaa=function(_0x20fa8a,_0x262756){_0x20fa8a=_0x20fa8a-0x0;var _0x5d2c93=_0xaaa7[_0x20fa8a];return _0x5d2c93;};'use strict';var Manager=require(_0x7aaa('0x0'));var BPromise=require(_0x7aaa('0x1'));var moment=require(_0x7aaa('0x2'));var util=require(_0x7aaa('0x3'));var _=require('lodash');var logger=require(_0x7aaa('0x4'))('ami');var config=require(_0x7aaa('0x5'));var ami=new Manager(config[_0x7aaa('0x6')][_0x7aaa('0x7')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')][_0x7aaa('0x9')],!![]);ami[_0x7aaa('0xa')]();ami[_0x7aaa('0xb')]=BPromise[_0x7aaa('0xc')](ami[_0x7aaa('0xd')]);function error(_0x22f6f3){logger[_0x7aaa('0xe')](util[_0x7aaa('0xf')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config['asterisk']['ip'],config[_0x7aaa('0x6')]['port'],util[_0x7aaa('0x10')](_0x22f6f3,![],null)));}function close(){logger[_0x7aaa('0xe')](util[_0x7aaa('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x7aaa('0x11')]=function(){return function(){return ami[_0x7aaa('0xb')]({'action':_0x7aaa('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x7aaa('0x13')});};};ami[_0x7aaa('0x14')]=function(){return function(){return ami[_0x7aaa('0xb')]({'action':'queuesummary'});};};ami[_0x7aaa('0x15')]=function(){return function(){return ami[_0x7aaa('0xb')]({'action':_0x7aaa('0x16')});};};function connect(_0x25b3c8){logger['info'](util[_0x7aaa('0xf')](_0x7aaa('0x17'),config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x7')]));ami[_0x7aaa('0x18')]('error',error);ami['once'](_0x7aaa('0x19'),close);}ami['on'](_0x7aaa('0x1a'),connect);ami['on'](_0x7aaa('0x1b'),function(_0x24069f){logger[_0x7aaa('0x1c')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config[_0x7aaa('0x6')][_0x7aaa('0x7')],util[_0x7aaa('0x10')](_0x24069f,![],null)));});ami['on'](_0x7aaa('0x1d'),function(_0x135584){logger[_0x7aaa('0x1c')](util[_0x7aaa('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x7aaa('0x6')][_0x7aaa('0x8')],config[_0x7aaa('0x6')]['ip'],config['asterisk']['port']));return BPromise[_0x7aaa('0x1e')]()[_0x7aaa('0x1f')](ami[_0x7aaa('0x20')]())['then'](ami[_0x7aaa('0x11')]())[_0x7aaa('0x1f')](ami[_0x7aaa('0x21')]())['then'](ami['actionQueueSummary']())[_0x7aaa('0x1f')](ami[_0x7aaa('0x15')]())[_0x7aaa('0x22')](function(_0x3647c4){console[_0x7aaa('0x23')](_0x3647c4);});});ami[_0x7aaa('0x18')]('error',error);ami[_0x7aaa('0x18')](_0x7aaa('0x19'),close);module[_0x7aaa('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a591cca..488f28b 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 _0x810c=['jayson/promise','../../config/logger','ami','client','Request','request','memberReport','error','rpc','message','catch','exports'];(function(_0x552c27,_0x478dc2){var _0x2a0922=function(_0x22617c){while(--_0x22617c){_0x552c27['push'](_0x552c27['shift']());}};_0x2a0922(++_0x478dc2);}(_0x810c,0x15c));var _0xc810=function(_0x230df3,_0x2a972e){_0x230df3=_0x230df3-0x0;var _0x14c031=_0x810c[_0x230df3];return _0x14c031;};'use strict';var jayson=require(_0xc810('0x0'));var BPromise=require('bluebird');var logger=require(_0xc810('0x1'))(_0xc810('0x2'));var client=jayson[_0xc810('0x3')]['http']({'port':0x2329});client[_0xc810('0x4')]=function(_0x33793a,_0x87dc6){return new BPromise(function(_0x46aef8,_0x4586e0){return client[_0xc810('0x5')](_0x33793a,_0x87dc6)['then'](function(_0x2b6c81){logger['debug']('rpc',_0xc810('0x6'),_0x33793a,_0x87dc6,_0x2b6c81);if(_0x2b6c81[_0xc810('0x7')]){logger[_0xc810('0x7')](_0xc810('0x8'),_0xc810('0x6'),_0x33793a,_0x2b6c81[_0xc810('0x7')][_0xc810('0x9')],_0x87dc6);return _0x4586e0(_0x2b6c81[_0xc810('0x7')][_0xc810('0x9')]);}else{return _0x46aef8(_0x2b6c81['result']);}})[_0xc810('0xa')](function(_0x4d718c){logger['error'](_0xc810('0x8'),'memberReport',_0x33793a,_0x4d718c,_0x87dc6);return _0x4586e0(_0x4d718c);});});};module[_0xc810('0xb')]=client; \ No newline at end of file +var _0xa250=['then','debug','rpc','memberReport','error','message','result','jayson/promise','bluebird','../../config/logger','ami','client','http','Request'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa250,0x1b9));var _0x0a25=function(_0x3a90b6,_0x782086){_0x3a90b6=_0x3a90b6-0x0;var _0x56f71a=_0xa250[_0x3a90b6];return _0x56f71a;};'use strict';var jayson=require(_0x0a25('0x0'));var BPromise=require(_0x0a25('0x1'));var logger=require(_0x0a25('0x2'))(_0x0a25('0x3'));var client=jayson[_0x0a25('0x4')][_0x0a25('0x5')]({'port':0x2329});client[_0x0a25('0x6')]=function(_0x59c29a,_0x2b7633){return new BPromise(function(_0x505766,_0x50ee06){return client['request'](_0x59c29a,_0x2b7633)[_0x0a25('0x7')](function(_0x4d0feb){logger[_0x0a25('0x8')](_0x0a25('0x9'),_0x0a25('0xa'),_0x59c29a,_0x2b7633,_0x4d0feb);if(_0x4d0feb['error']){logger[_0x0a25('0xb')](_0x0a25('0x9'),_0x0a25('0xa'),_0x59c29a,_0x4d0feb[_0x0a25('0xb')][_0x0a25('0xc')],_0x2b7633);return _0x50ee06(_0x4d0feb['error']['message']);}else{return _0x505766(_0x4d0feb[_0x0a25('0xd')]);}})['catch'](function(_0x3e8684){logger[_0x0a25('0xb')](_0x0a25('0x9'),_0x0a25('0xa'),_0x59c29a,_0x3e8684,_0x2b7633);return _0x50ee06(_0x3e8684);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3c887d2..c02c8c8 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 _0x0d74=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','getQueue','queue','exports','util','lodash','string','isNil','uniqueid','Contact','phone','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x1a3dd5,_0x497e31){var _0x2749a2=function(_0x52c4ec){while(--_0x52c4ec){_0x1a3dd5['push'](_0x1a3dd5['shift']());}};_0x2749a2(++_0x497e31);}(_0x0d74,0x146));var _0x40d7=function(_0x130b96,_0x16244d){_0x130b96=_0x130b96-0x0;var _0xac0d23=_0x0d74[_0x130b96];return _0xac0d23;};'use strict';var util=require(_0x40d7('0x0'));var _=require(_0x40d7('0x1'));var moment=require('moment');function checkNameSurname(_0x4d472e,_0x325b84,_0x30c393){var _0x5c22af='';if(!_['isNil'](_0x325b84)&&_0x40d7('0x2')===typeof _0x325b84){_0x5c22af+=_0x325b84;}if(!_[_0x40d7('0x3')](_0x30c393)&&_0x40d7('0x2')===typeof _0x30c393){_0x5c22af+='\x20'+_0x30c393;}if(_0x5c22af!==''){return _0x5c22af;}return _0x4d472e;}function Action(_0x41b9cb,_0x5edb57,_0x5280f0){this['voiceQueue']=_0x41b9cb;this[_0x40d7('0x4')]=_0x5280f0||undefined;this['name']=checkNameSurname(_0x5edb57[_0x40d7('0x5')][_0x40d7('0x6')],_0x5edb57['Contact'][_0x40d7('0x7')],_0x5edb57[_0x40d7('0x5')][_0x40d7('0x8')]);this[_0x40d7('0x9')]=_0x5edb57[_0x40d7('0x5')][_0x40d7('0x6')];this['queue']=_0x41b9cb[_0x40d7('0xa')];this[_0x40d7('0xb')]=_0x5edb57[_0x40d7('0xb')]||![];this[_0x40d7('0xc')]=_0x41b9cb[_0x40d7('0xc')];this['dialQueueTimeout']=_0x41b9cb[_0x40d7('0xd')]||0x3;this[_0x40d7('0xe')]=_0x5edb57[_0x40d7('0xe')];this[_0x40d7('0xf')]=_0x5edb57['countbusyretry'];this[_0x40d7('0x10')]=_0x5edb57[_0x40d7('0x10')];this[_0x40d7('0x11')]=_0x5edb57[_0x40d7('0x11')];this[_0x40d7('0x12')]=_0x5edb57[_0x40d7('0x12')];this[_0x40d7('0x13')]=_0x5edb57[_0x40d7('0x13')];this[_0x40d7('0x14')]=_0x5edb57['countabandonedretry'];this['countmachineretry']=_0x5edb57['countmachineretry'];this[_0x40d7('0x15')]=_0x5edb57[_0x40d7('0x15')];this['ContactId']=_0x5edb57['ContactId'];this[_0x40d7('0x16')]=_0x5edb57['ListId'];this['UserId']=_0x5edb57[_0x40d7('0x17')];this[_0x40d7('0x18')]=_0x5edb57[_0x40d7('0x18')];this[_0x40d7('0x19')]=_0x5edb57[_0x40d7('0x19')];this[_0x40d7('0x1a')]=_0x5edb57['id'];this[_0x40d7('0x1b')]=_0x5edb57[_0x40d7('0x5')]['firstName']||'';this['starttime']=moment()['format'](_0x40d7('0x1c'));this['callback']=_0x5edb57[_0x40d7('0x1d')];this[_0x40d7('0x1e')]=_0x5edb57[_0x40d7('0x1e')];this[_0x40d7('0x1f')]=_0x5edb57[_0x40d7('0x1f')];this[_0x40d7('0x20')]=_0x5edb57[_0x40d7('0x20')];this[_0x40d7('0x21')]='';this[_0x40d7('0x22')]='';}Action[_0x40d7('0x23')][_0x40d7('0x24')]=function(){return util['format'](_0x40d7('0x25'),this[_0x40d7('0xa')],this[_0x40d7('0x26')][_0x40d7('0x27')]>0x0?this['number']['substring'](this[_0x40d7('0x26')]['dialCutDigit']):this['number']);};Action[_0x40d7('0x23')][_0x40d7('0x28')]=function(){return this[_0x40d7('0x29')];};module[_0x40d7('0x2a')]=Action; \ No newline at end of file +var _0x9354=['VoiceQueueId','CampaignId','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','number','phone','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x2ffb08,_0x5eeb5c){var _0x3f51d6=function(_0x1bcbbc){while(--_0x1bcbbc){_0x2ffb08['push'](_0x2ffb08['shift']());}};_0x3f51d6(++_0x5eeb5c);}(_0x9354,0x96));var _0x4935=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x9354[_0x30e004];return _0x5ca247;};'use strict';var util=require('util');var _=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));function checkNameSurname(_0x4896da,_0x263dd5,_0x2a4993){var _0x29d1eb='';if(!_[_0x4935('0x2')](_0x263dd5)&&'string'===typeof _0x263dd5){_0x29d1eb+=_0x263dd5;}if(!_[_0x4935('0x2')](_0x2a4993)&&_0x4935('0x3')===typeof _0x2a4993){_0x29d1eb+='\x20'+_0x2a4993;}if(_0x29d1eb!==''){return _0x29d1eb;}return _0x4896da;}function Action(_0x127226,_0x2d518a,_0x263864){this[_0x4935('0x4')]=_0x127226;this[_0x4935('0x5')]=_0x263864||undefined;this[_0x4935('0x6')]=checkNameSurname(_0x2d518a[_0x4935('0x7')]['phone'],_0x2d518a[_0x4935('0x7')]['firstName'],_0x2d518a[_0x4935('0x7')][_0x4935('0x8')]);this[_0x4935('0x9')]=_0x2d518a[_0x4935('0x7')][_0x4935('0xa')];this[_0x4935('0xb')]=_0x127226['name'];this['active']=_0x2d518a[_0x4935('0xc')]||![];this['type']=_0x127226['type'];this[_0x4935('0xd')]=_0x127226[_0x4935('0xd')]||0x3;this[_0x4935('0xe')]=_0x2d518a[_0x4935('0xe')];this[_0x4935('0xf')]=_0x2d518a[_0x4935('0xf')];this[_0x4935('0x10')]=_0x2d518a[_0x4935('0x10')];this[_0x4935('0x11')]=_0x2d518a[_0x4935('0x11')];this[_0x4935('0x12')]=_0x2d518a[_0x4935('0x12')];this[_0x4935('0x13')]=_0x2d518a[_0x4935('0x13')];this[_0x4935('0x14')]=_0x2d518a[_0x4935('0x14')];this['countmachineretry']=_0x2d518a[_0x4935('0x15')];this[_0x4935('0x16')]=_0x2d518a[_0x4935('0x16')];this[_0x4935('0x17')]=_0x2d518a[_0x4935('0x17')];this[_0x4935('0x18')]=_0x2d518a['ListId'];this[_0x4935('0x19')]=_0x2d518a[_0x4935('0x19')];this['VoiceQueueId']=_0x2d518a[_0x4935('0x1a')];this[_0x4935('0x1b')]=_0x2d518a[_0x4935('0x1b')];this['idHopper']=_0x2d518a['id'];this['ContactFirstName']=_0x2d518a[_0x4935('0x7')][_0x4935('0x1c')]||'';this[_0x4935('0x1d')]=moment()[_0x4935('0x1e')](_0x4935('0x1f'));this[_0x4935('0x20')]=_0x2d518a[_0x4935('0x20')];this[_0x4935('0x21')]=_0x2d518a['callbackuniqueid'];this[_0x4935('0x22')]=_0x2d518a[_0x4935('0x22')];this[_0x4935('0x23')]=_0x2d518a[_0x4935('0x23')];this[_0x4935('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x4935('0x25')]=function(){return util[_0x4935('0x1e')](_0x4935('0x26'),this[_0x4935('0x6')],this[_0x4935('0x4')][_0x4935('0x27')]>0x0?this[_0x4935('0x9')][_0x4935('0x28')](this[_0x4935('0x4')][_0x4935('0x27')]):this[_0x4935('0x9')]);};Action[_0x4935('0x29')][_0x4935('0x2a')]=function(){return this[_0x4935('0xb')];};module[_0x4935('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index dad936a..99d703f 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 _0xb7c2=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7c2,0x114));var _0x2b7c=function(_0x28cb93,_0x3a63e8){_0x28cb93=_0x28cb93-0x0;var _0xe43116=_0xb7c2[_0x28cb93];return _0xe43116;};'use strict';var util=require(_0x2b7c('0x0'));var _=require(_0x2b7c('0x1'));var moment=require(_0x2b7c('0x2'));function getSeconds(_0x3dd0d8,_0x1de8ae){var _0x25e203=moment(_0x3dd0d8)[_0x2b7c('0x3')](0x0);var _0x2c22b9=moment(_0x1de8ae)[_0x2b7c('0x3')](0x0);return _0x25e203[_0x2b7c('0x4')](_0x2c22b9,_0x2b7c('0x5'));}function AdditionalPhone(_0x387efe){this[_0x2b7c('0x6')]=_0x387efe[_0x2b7c('0x6')];this[_0x2b7c('0x7')]=_0x387efe[_0x2b7c('0x7')]||undefined;this[_0x2b7c('0x8')]=_0x387efe[_0x2b7c('0x8')];this[_0x2b7c('0x9')]=_0x387efe[_0x2b7c('0x8')]===_0x2b7c('0xa')?'queue':_0x387efe[_0x2b7c('0x8')];this[_0x2b7c('0xb')]=_0x387efe[_0x2b7c('0xb')];this[_0x2b7c('0xc')]=_0x387efe[_0x2b7c('0xc')];this[_0x2b7c('0xd')]=_0x387efe[_0x2b7c('0xd')];this['countglobal']=_0x387efe['countbusyretry']+_0x387efe['countcongestionretry']+_0x387efe[_0x2b7c('0xd')]+_0x387efe[_0x2b7c('0xe')]+_0x387efe['countdropretry']+_0x387efe[_0x2b7c('0xf')]+_0x387efe[_0x2b7c('0x10')]+_0x387efe[_0x2b7c('0x11')];this[_0x2b7c('0xe')]=_0x387efe[_0x2b7c('0xe')];this['countdropretry']=_0x387efe['countdropretry'];this[_0x2b7c('0xf')]=_0x387efe[_0x2b7c('0xf')];this[_0x2b7c('0x10')]=_0x387efe[_0x2b7c('0x10')];this[_0x2b7c('0x11')]=_0x387efe[_0x2b7c('0x11')];this['queue']=_0x387efe[_0x2b7c('0x12')];this['calleridname']=_0x387efe[_0x2b7c('0x13')];this[_0x2b7c('0x14')]=_0x387efe[_0x2b7c('0x15')];this['starttime']=_0x387efe['starttime'];this[_0x2b7c('0x16')]=_0x387efe[_0x2b7c('0x16')];this[_0x2b7c('0x17')]=_0x387efe[_0x2b7c('0x16')];this[_0x2b7c('0x18')]=getSeconds(_0x387efe['responsetime'],_0x387efe[_0x2b7c('0x19')]);this[_0x2b7c('0x1a')]=0x0;this[_0x2b7c('0x1b')]=0x0;this[_0x2b7c('0x1c')]=_0x387efe['callback'];this[_0x2b7c('0x1d')]=_0x387efe[_0x2b7c('0x1d')];this[_0x2b7c('0x1e')]=_0x387efe[_0x2b7c('0x1e')];this[_0x2b7c('0x1f')]=_0x387efe[_0x2b7c('0x1f')];this['ContactId']=_0x387efe[_0x2b7c('0x20')];this[_0x2b7c('0x21')]=_0x387efe[_0x2b7c('0x21')];this[_0x2b7c('0x22')]=_0x387efe[_0x2b7c('0x22')];this[_0x2b7c('0x23')]=_0x387efe[_0x2b7c('0x23')];this['CampaignId']=_0x387efe['CampaignId'];this[_0x2b7c('0x24')]=_0x387efe[_0x2b7c('0x24')]||'';this[_0x2b7c('0x25')]=_0x387efe[_0x2b7c('0x25')]||'';}module[_0x2b7c('0x26')]=History; \ No newline at end of file +var _0x9ec0=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','name','calleridnum','number','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x14301d,_0x70dde9){var _0x1638dc=function(_0x22bf3c){while(--_0x22bf3c){_0x14301d['push'](_0x14301d['shift']());}};_0x1638dc(++_0x70dde9);}(_0x9ec0,0x73));var _0x09ec=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0x9ec0[_0x45cb89];return _0x5948c1;};'use strict';var util=require(_0x09ec('0x0'));var _=require(_0x09ec('0x1'));var moment=require(_0x09ec('0x2'));function getSeconds(_0x51e531,_0x2e35c7){var _0x18dded=moment(_0x51e531)[_0x09ec('0x3')](0x0);var _0x4965cf=moment(_0x2e35c7)[_0x09ec('0x3')](0x0);return _0x18dded['diff'](_0x4965cf,_0x09ec('0x4'));}function AdditionalPhone(_0x16875c){this['uniqueid']=_0x16875c[_0x09ec('0x5')];this[_0x09ec('0x6')]=_0x16875c['scheduledat']||undefined;this[_0x09ec('0x7')]=_0x16875c['type'];this[_0x09ec('0x8')]=_0x16875c[_0x09ec('0x7')]===_0x09ec('0x9')?_0x09ec('0xa'):_0x16875c[_0x09ec('0x7')];this[_0x09ec('0xb')]=_0x16875c[_0x09ec('0xb')];this[_0x09ec('0xc')]=_0x16875c['countcongestionretry'];this['countnoanswerretry']=_0x16875c[_0x09ec('0xd')];this['countglobal']=_0x16875c[_0x09ec('0xb')]+_0x16875c['countcongestionretry']+_0x16875c[_0x09ec('0xd')]+_0x16875c[_0x09ec('0xe')]+_0x16875c[_0x09ec('0xf')]+_0x16875c['countabandonedretry']+_0x16875c['countmachineretry']+_0x16875c[_0x09ec('0x10')];this['countnosuchnumberretry']=_0x16875c[_0x09ec('0xe')];this['countdropretry']=_0x16875c[_0x09ec('0xf')];this['countabandonedretry']=_0x16875c[_0x09ec('0x11')];this[_0x09ec('0x12')]=_0x16875c[_0x09ec('0x12')];this[_0x09ec('0x10')]=_0x16875c[_0x09ec('0x10')];this[_0x09ec('0xa')]=_0x16875c[_0x09ec('0xa')];this['calleridname']=_0x16875c[_0x09ec('0x13')];this[_0x09ec('0x14')]=_0x16875c[_0x09ec('0x15')];this[_0x09ec('0x16')]=_0x16875c[_0x09ec('0x16')];this['responsetime']=_0x16875c[_0x09ec('0x17')];this['endtime']=_0x16875c[_0x09ec('0x17')];this['ringtime']=getSeconds(_0x16875c[_0x09ec('0x17')],_0x16875c[_0x09ec('0x16')]);this['holdtime']=0x0;this[_0x09ec('0x18')]=0x0;this[_0x09ec('0x19')]=_0x16875c[_0x09ec('0x19')];this[_0x09ec('0x1a')]=_0x16875c[_0x09ec('0x1a')];this[_0x09ec('0x1b')]=_0x16875c[_0x09ec('0x1b')];this[_0x09ec('0x1c')]=_0x16875c[_0x09ec('0x1c')];this[_0x09ec('0x1d')]=_0x16875c[_0x09ec('0x1d')];this[_0x09ec('0x1e')]=_0x16875c[_0x09ec('0x1e')];this[_0x09ec('0x1f')]=_0x16875c[_0x09ec('0x1f')];this[_0x09ec('0x20')]=_0x16875c['VoiceQueueId'];this[_0x09ec('0x21')]=_0x16875c[_0x09ec('0x21')];this[_0x09ec('0x22')]=_0x16875c['originatecalleridnum']||'';this[_0x09ec('0x23')]=_0x16875c[_0x09ec('0x23')]||'';}module[_0x09ec('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index dcf1410..743affb 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 _0x3a2d=['countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry'];(function(_0x1dee76,_0x145b16){var _0x41ab9a=function(_0x356ea8){while(--_0x356ea8){_0x1dee76['push'](_0x1dee76['shift']());}};_0x41ab9a(++_0x145b16);}(_0x3a2d,0x76));var _0xd3a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a2d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xd3a2('0x0'));var moment=require('moment');function getSeconds(_0x448c1e,_0x1d4c5e){var _0x3ed309=moment(_0x448c1e)['milliseconds'](0x0);var _0x277aac=moment(_0x1d4c5e)[_0xd3a2('0x1')](0x0);return _0x3ed309[_0xd3a2('0x2')](_0x277aac,_0xd3a2('0x3'));}function AgentComplete(_0x1b8119,_0x3fbd6f){this[_0xd3a2('0x4')]=0x4;this[_0xd3a2('0x5')]=_0xd3a2('0x6');this[_0xd3a2('0x7')]=_0x1b8119['scheduledat'];this[_0xd3a2('0x8')]=_0x1b8119[_0xd3a2('0x8')];this[_0xd3a2('0x9')]=_0x1b8119[_0xd3a2('0x8')]===_0xd3a2('0xa')?_0xd3a2('0xb'):_0x1b8119[_0xd3a2('0x8')];this['countbusyretry']=_0x1b8119['countbusyretry'];this[_0xd3a2('0xc')]=_0x1b8119[_0xd3a2('0xc')];this[_0xd3a2('0xd')]=_0x1b8119[_0xd3a2('0xd')];this['countglobal']=_0x1b8119[_0xd3a2('0xe')]+_0x1b8119[_0xd3a2('0xc')]+_0x1b8119[_0xd3a2('0xd')]+_0x1b8119[_0xd3a2('0xf')]+_0x1b8119[_0xd3a2('0x10')]+_0x1b8119[_0xd3a2('0x11')]+_0x1b8119[_0xd3a2('0x12')]+_0x1b8119['countagentrejectretry'];this[_0xd3a2('0xf')]=_0x1b8119[_0xd3a2('0xf')];this[_0xd3a2('0x10')]=_0x1b8119[_0xd3a2('0x10')];this[_0xd3a2('0x11')]=_0x1b8119[_0xd3a2('0x11')];this[_0xd3a2('0x12')]=_0x1b8119[_0xd3a2('0x12')];this['countagentrejectretry']=_0x1b8119[_0xd3a2('0x13')];this[_0xd3a2('0x14')]=_0x3fbd6f[_0xd3a2('0x14')];this['calleridname']=_0x1b8119['name'];this[_0xd3a2('0x15')]=_0x1b8119[_0xd3a2('0x16')];this['starttime']=_0x1b8119[_0xd3a2('0x17')];this[_0xd3a2('0x18')]=_0x1b8119[_0xd3a2('0x18')];this['answertime']=_0x1b8119[_0xd3a2('0x19')];this['endtime']=moment()[_0xd3a2('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd3a2('0x1b')]=getSeconds(_0x1b8119['responsetime'],_0x1b8119['starttime']);this[_0xd3a2('0x1c')]=getSeconds(_0x1b8119[_0xd3a2('0x19')],_0x1b8119[_0xd3a2('0x18')]);this[_0xd3a2('0x1d')]=getSeconds(this[_0xd3a2('0x1e')],_0x1b8119[_0xd3a2('0x19')]);this['queue']=_0x3fbd6f['queue'];this[_0xd3a2('0x1f')]=_0x3fbd6f[_0xd3a2('0x1f')];this[_0xd3a2('0x20')]=_0x3fbd6f[_0xd3a2('0x20')];this['callback']=_0x1b8119[_0xd3a2('0x21')];this[_0xd3a2('0x22')]=_0x1b8119[_0xd3a2('0x22')];this['callbackat']=_0x1b8119['callbackat'];this[_0xd3a2('0x23')]=_0x1b8119[_0xd3a2('0x23')];this[_0xd3a2('0x24')]=_0x1b8119[_0xd3a2('0x24')];this[_0xd3a2('0x25')]=_0x1b8119[_0xd3a2('0x25')];this[_0xd3a2('0x26')]=_0x1b8119[_0xd3a2('0x26')];this[_0xd3a2('0x27')]=_0x1b8119[_0xd3a2('0x27')];this[_0xd3a2('0x28')]=_0x1b8119[_0xd3a2('0x28')];this[_0xd3a2('0x29')]=_0x1b8119[_0xd3a2('0x29')]||'';this['originatecalleridname']=_0x1b8119[_0xd3a2('0x2a')]||'';}module[_0xd3a2('0x2b')]=AgentComplete; \ No newline at end of file +var _0xa1c3=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime'];(function(_0x2865ce,_0x29e4e2){var _0x149a6a=function(_0x5826b6){while(--_0x5826b6){_0x2865ce['push'](_0x2865ce['shift']());}};_0x149a6a(++_0x29e4e2);}(_0xa1c3,0x1ad));var _0x3a1c=function(_0x59ec65,_0x33e455){_0x59ec65=_0x59ec65-0x0;var _0x2f560c=_0xa1c3[_0x59ec65];return _0x2f560c;};'use strict';var util=require('util');var _=require(_0x3a1c('0x0'));var moment=require(_0x3a1c('0x1'));function getSeconds(_0x4646a9,_0x5ab896){var _0x2ccc12=moment(_0x4646a9)['milliseconds'](0x0);var _0x4a7f0b=moment(_0x5ab896)[_0x3a1c('0x2')](0x0);return _0x2ccc12['diff'](_0x4a7f0b,_0x3a1c('0x3'));}function AgentComplete(_0x12d575,_0x1c2278){this[_0x3a1c('0x4')]=0x4;this[_0x3a1c('0x5')]=_0x3a1c('0x6');this[_0x3a1c('0x7')]=_0x12d575[_0x3a1c('0x7')];this[_0x3a1c('0x8')]=_0x12d575[_0x3a1c('0x8')];this[_0x3a1c('0x9')]=_0x12d575[_0x3a1c('0x8')]===_0x3a1c('0xa')?_0x3a1c('0xb'):_0x12d575[_0x3a1c('0x8')];this['countbusyretry']=_0x12d575[_0x3a1c('0xc')];this[_0x3a1c('0xd')]=_0x12d575[_0x3a1c('0xd')];this['countnoanswerretry']=_0x12d575[_0x3a1c('0xe')];this[_0x3a1c('0xf')]=_0x12d575[_0x3a1c('0xc')]+_0x12d575[_0x3a1c('0xd')]+_0x12d575[_0x3a1c('0xe')]+_0x12d575[_0x3a1c('0x10')]+_0x12d575[_0x3a1c('0x11')]+_0x12d575[_0x3a1c('0x12')]+_0x12d575[_0x3a1c('0x13')]+_0x12d575[_0x3a1c('0x14')];this['countnosuchnumberretry']=_0x12d575[_0x3a1c('0x10')];this[_0x3a1c('0x11')]=_0x12d575['countdropretry'];this['countabandonedretry']=_0x12d575[_0x3a1c('0x12')];this[_0x3a1c('0x13')]=_0x12d575[_0x3a1c('0x13')];this[_0x3a1c('0x14')]=_0x12d575[_0x3a1c('0x14')];this[_0x3a1c('0x15')]=_0x1c2278['uniqueid'];this[_0x3a1c('0x16')]=_0x12d575[_0x3a1c('0x17')];this[_0x3a1c('0x18')]=_0x12d575[_0x3a1c('0x19')];this[_0x3a1c('0x1a')]=_0x12d575[_0x3a1c('0x1a')];this[_0x3a1c('0x1b')]=_0x12d575[_0x3a1c('0x1b')];this[_0x3a1c('0x1c')]=_0x12d575[_0x3a1c('0x1c')];this[_0x3a1c('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3a1c('0x1e')]=getSeconds(_0x12d575[_0x3a1c('0x1b')],_0x12d575[_0x3a1c('0x1a')]);this[_0x3a1c('0x1f')]=getSeconds(_0x12d575[_0x3a1c('0x1c')],_0x12d575[_0x3a1c('0x1b')]);this[_0x3a1c('0x20')]=getSeconds(this[_0x3a1c('0x1d')],_0x12d575[_0x3a1c('0x1c')]);this[_0x3a1c('0xb')]=_0x1c2278[_0x3a1c('0xb')];this[_0x3a1c('0x21')]=_0x1c2278['membername'];this[_0x3a1c('0x22')]=_0x1c2278[_0x3a1c('0x22')];this[_0x3a1c('0x23')]=_0x12d575[_0x3a1c('0x23')];this[_0x3a1c('0x24')]=_0x12d575[_0x3a1c('0x24')];this['callbackat']=_0x12d575[_0x3a1c('0x25')];this[_0x3a1c('0x26')]=_0x12d575[_0x3a1c('0x26')];this[_0x3a1c('0x27')]=_0x12d575[_0x3a1c('0x27')];this[_0x3a1c('0x28')]=_0x12d575[_0x3a1c('0x28')];this[_0x3a1c('0x29')]=_0x12d575['UserId'];this['VoiceQueueId']=_0x12d575['VoiceQueueId'];this[_0x3a1c('0x2a')]=_0x12d575[_0x3a1c('0x2a')];this[_0x3a1c('0x2b')]=_0x12d575['originatecalleridnum']||'';this[_0x3a1c('0x2c')]=_0x12d575['originatecalleridname']||'';}module[_0x3a1c('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index d3c3bb5..d59900a 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 _0xbc4c=['type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x5c0e95,_0x4d0c46){var _0x5e6279=function(_0x52505a){while(--_0x52505a){_0x5c0e95['push'](_0x5c0e95['shift']());}};_0x5e6279(++_0x4d0c46);}(_0xbc4c,0xee));var _0xcbc4=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xbc4c[_0x9e0cb3];return _0x5926b7;};'use strict';var util=require(_0xcbc4('0x0'));var _=require('lodash');var moment=require(_0xcbc4('0x1'));function getSeconds(_0x119122,_0x350d4e){var _0x2a22fd=moment(_0x119122)['milliseconds'](0x0);var _0x536331=moment(_0x350d4e)[_0xcbc4('0x2')](0x0);return _0x2a22fd[_0xcbc4('0x3')](_0x536331,_0xcbc4('0x4'));}function Final(_0x37e646){this[_0xcbc4('0x5')]=_0x37e646[_0xcbc4('0x5')];this['scheduledat']=_0x37e646[_0xcbc4('0x6')];this[_0xcbc4('0x7')]=_0x37e646[_0xcbc4('0x7')];this['campaigntype']=_0x37e646['type']===_0xcbc4('0x8')?_0xcbc4('0x9'):_0x37e646[_0xcbc4('0x7')];this[_0xcbc4('0xa')]=_0x37e646[_0xcbc4('0xa')];this[_0xcbc4('0xb')]=_0x37e646[_0xcbc4('0xb')];this[_0xcbc4('0xc')]=_0x37e646['countnoanswerretry'];this[_0xcbc4('0xd')]=_0x37e646[_0xcbc4('0xa')]+_0x37e646['countcongestionretry']+_0x37e646['countnoanswerretry']+_0x37e646[_0xcbc4('0xe')]+_0x37e646[_0xcbc4('0xf')]+_0x37e646[_0xcbc4('0x10')]+_0x37e646[_0xcbc4('0x11')]+_0x37e646[_0xcbc4('0x12')];this[_0xcbc4('0xe')]=_0x37e646[_0xcbc4('0xe')];this[_0xcbc4('0xf')]=_0x37e646[_0xcbc4('0xf')];this['countabandonedretry']=_0x37e646[_0xcbc4('0x10')];this[_0xcbc4('0x11')]=_0x37e646[_0xcbc4('0x11')];this[_0xcbc4('0x12')]=_0x37e646['countagentrejectretry'];this[_0xcbc4('0x9')]=_0x37e646['queue'];this[_0xcbc4('0x13')]=_0x37e646[_0xcbc4('0x13')];this[_0xcbc4('0x14')]=_0x37e646['calleridnum'];this[_0xcbc4('0x15')]=_0x37e646['starttime'];this[_0xcbc4('0x16')]=_0x37e646[_0xcbc4('0x16')];this['endtime']=_0x37e646[_0xcbc4('0x16')];this['ringtime']=_0x37e646['ringtime']||0x0;this['holdtime']=_0x37e646[_0xcbc4('0x17')]||0x0;this[_0xcbc4('0x18')]=_0x37e646[_0xcbc4('0x18')]||0x0;this['callback']=_0x37e646[_0xcbc4('0x19')];this['callbackuniqueid']=_0x37e646['callbackuniqueid'];this['callbackat']=_0x37e646[_0xcbc4('0x1a')];this['recallme']=_0x37e646[_0xcbc4('0x1b')];this[_0xcbc4('0x1c')]=_0x37e646[_0xcbc4('0x1c')];this[_0xcbc4('0x1d')]=_0x37e646['ListId'];this['UserId']=_0x37e646[_0xcbc4('0x1e')];this[_0xcbc4('0x1f')]=_0x37e646['VoiceQueueId'];this[_0xcbc4('0x20')]=_0x37e646[_0xcbc4('0x20')];this[_0xcbc4('0x21')]=_0x37e646['originatecalleridnum']||'';this[_0xcbc4('0x22')]=_0x37e646[_0xcbc4('0x22')]||'';}module['exports']=Final; \ No newline at end of file +var _0x1c4e=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridnum'];(function(_0x322f23,_0x357d82){var _0x426660=function(_0x53de8c){while(--_0x53de8c){_0x322f23['push'](_0x322f23['shift']());}};_0x426660(++_0x357d82);}(_0x1c4e,0x1b4));var _0xe1c4=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x1c4e[_0xabfec4];return _0x7bafa2;};'use strict';var util=require('util');var _=require(_0xe1c4('0x0'));var moment=require(_0xe1c4('0x1'));function getSeconds(_0x1096cd,_0x4b913e){var _0x46e568=moment(_0x1096cd)[_0xe1c4('0x2')](0x0);var _0x194615=moment(_0x4b913e)[_0xe1c4('0x2')](0x0);return _0x46e568[_0xe1c4('0x3')](_0x194615,_0xe1c4('0x4'));}function Final(_0x5437f1){this[_0xe1c4('0x5')]=_0x5437f1[_0xe1c4('0x5')];this['scheduledat']=_0x5437f1[_0xe1c4('0x6')];this[_0xe1c4('0x7')]=_0x5437f1[_0xe1c4('0x7')];this['campaigntype']=_0x5437f1[_0xe1c4('0x7')]===_0xe1c4('0x8')?'queue':_0x5437f1[_0xe1c4('0x7')];this[_0xe1c4('0x9')]=_0x5437f1[_0xe1c4('0x9')];this[_0xe1c4('0xa')]=_0x5437f1[_0xe1c4('0xa')];this[_0xe1c4('0xb')]=_0x5437f1[_0xe1c4('0xb')];this[_0xe1c4('0xc')]=_0x5437f1['countbusyretry']+_0x5437f1[_0xe1c4('0xa')]+_0x5437f1[_0xe1c4('0xb')]+_0x5437f1['countnosuchnumberretry']+_0x5437f1[_0xe1c4('0xd')]+_0x5437f1[_0xe1c4('0xe')]+_0x5437f1[_0xe1c4('0xf')]+_0x5437f1[_0xe1c4('0x10')];this['countnosuchnumberretry']=_0x5437f1[_0xe1c4('0x11')];this['countdropretry']=_0x5437f1[_0xe1c4('0xd')];this[_0xe1c4('0xe')]=_0x5437f1[_0xe1c4('0xe')];this['countmachineretry']=_0x5437f1['countmachineretry'];this[_0xe1c4('0x10')]=_0x5437f1[_0xe1c4('0x10')];this[_0xe1c4('0x12')]=_0x5437f1[_0xe1c4('0x12')];this['calleridname']=_0x5437f1['calleridname'];this[_0xe1c4('0x13')]=_0x5437f1[_0xe1c4('0x13')];this['starttime']=_0x5437f1[_0xe1c4('0x14')];this['responsetime']=_0x5437f1[_0xe1c4('0x15')];this[_0xe1c4('0x16')]=_0x5437f1[_0xe1c4('0x15')];this[_0xe1c4('0x17')]=_0x5437f1['ringtime']||0x0;this[_0xe1c4('0x18')]=_0x5437f1['holdtime']||0x0;this[_0xe1c4('0x19')]=_0x5437f1[_0xe1c4('0x19')]||0x0;this[_0xe1c4('0x1a')]=_0x5437f1[_0xe1c4('0x1a')];this[_0xe1c4('0x1b')]=_0x5437f1[_0xe1c4('0x1b')];this[_0xe1c4('0x1c')]=_0x5437f1[_0xe1c4('0x1c')];this[_0xe1c4('0x1d')]=_0x5437f1['recallme'];this[_0xe1c4('0x1e')]=_0x5437f1[_0xe1c4('0x1e')];this[_0xe1c4('0x1f')]=_0x5437f1['ListId'];this[_0xe1c4('0x20')]=_0x5437f1[_0xe1c4('0x20')];this[_0xe1c4('0x21')]=_0x5437f1[_0xe1c4('0x21')];this[_0xe1c4('0x22')]=_0x5437f1[_0xe1c4('0x22')];this[_0xe1c4('0x23')]=_0x5437f1['originatecalleridnum']||'';this[_0xe1c4('0x24')]=_0x5437f1[_0xe1c4('0x24')]||'';}module[_0xe1c4('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index f860728..b0a8794 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 _0x4090=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0x5afa04,_0x2221ed){var _0x2ac04e=function(_0x32c963){while(--_0x32c963){_0x5afa04['push'](_0x5afa04['shift']());}};_0x2ac04e(++_0x2221ed);}(_0x4090,0x1e4));var _0x0409=function(_0x31b7b6,_0x164709){_0x31b7b6=_0x31b7b6-0x0;var _0x1408bb=_0x4090[_0x31b7b6];return _0x1408bb;};'use strict';var util=require(_0x0409('0x0'));var _=require(_0x0409('0x1'));var moment=require(_0x0409('0x2'));function getSeconds(_0x56d38b,_0x23449f){var _0x214a01=moment(_0x56d38b)[_0x0409('0x3')](0x0);var _0x153c95=moment(_0x23449f)[_0x0409('0x3')](0x0);return _0x214a01[_0x0409('0x4')](_0x153c95,_0x0409('0x5'));}function Hangup(_0x166848,_0x28ee7a){this[_0x0409('0x6')]=0x4;this[_0x0409('0x7')]=_0x0409('0x8');this['scheduledat']=_0x166848[_0x0409('0x9')];this[_0x0409('0xa')]=_0x166848[_0x0409('0xa')];this[_0x0409('0xb')]=_0x166848['type']===_0x0409('0xc')?_0x0409('0xd'):_0x166848[_0x0409('0xa')];this['countbusyretry']=_0x166848[_0x0409('0xe')];this[_0x0409('0xf')]=_0x166848[_0x0409('0xf')];this[_0x0409('0x10')]=_0x166848[_0x0409('0x10')];this[_0x0409('0x11')]=_0x166848[_0x0409('0xe')]+_0x166848['countcongestionretry']+_0x166848[_0x0409('0x10')]+_0x166848[_0x0409('0x12')]+_0x166848[_0x0409('0x13')]+_0x166848[_0x0409('0x14')]+_0x166848['countmachineretry']+_0x166848[_0x0409('0x15')];this['countnosuchnumberretry']=_0x166848[_0x0409('0x12')];this[_0x0409('0x13')]=_0x166848[_0x0409('0x13')];this[_0x0409('0x14')]=_0x166848['countabandonedretry'];this[_0x0409('0x16')]=_0x166848['countmachineretry'];this[_0x0409('0x15')]=_0x166848[_0x0409('0x15')];this[_0x0409('0x17')]=_0x28ee7a[_0x0409('0x17')];this[_0x0409('0x18')]=_0x166848['name'];this[_0x0409('0x19')]=_0x166848[_0x0409('0x1a')];this[_0x0409('0x1b')]=_0x166848[_0x0409('0x1b')];this[_0x0409('0x1c')]=_0x166848['responsetime'];this[_0x0409('0x1d')]=moment()[_0x0409('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0409('0x1f')]=getSeconds(_0x166848[_0x0409('0x1c')],_0x166848[_0x0409('0x1b')]);this[_0x0409('0x20')]=0x0;this['talktime']=getSeconds(this[_0x0409('0x1d')],_0x166848[_0x0409('0x1c')]);this[_0x0409('0xd')]=_0x166848[_0x0409('0xd')];this[_0x0409('0x21')]=_0x0409('0x22');this['reason']=_0x28ee7a[_0x0409('0x23')];this[_0x0409('0x24')]=_0x166848[_0x0409('0x24')];this[_0x0409('0x25')]=_0x166848[_0x0409('0x25')];this[_0x0409('0x26')]=_0x166848[_0x0409('0x26')];this[_0x0409('0x27')]=_0x166848[_0x0409('0x27')];this[_0x0409('0x28')]=_0x166848[_0x0409('0x28')];this['ListId']=_0x166848[_0x0409('0x29')];this[_0x0409('0x2a')]=_0x166848[_0x0409('0x2a')];this[_0x0409('0x2b')]=_0x166848[_0x0409('0x2b')];this['CampaignId']=_0x166848[_0x0409('0x2c')];}module['exports']=Hangup; \ No newline at end of file +var _0x6f4e=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x38bb9a,_0x28c1ca){var _0x113665=function(_0x5e4cca){while(--_0x5e4cca){_0x38bb9a['push'](_0x38bb9a['shift']());}};_0x113665(++_0x28c1ca);}(_0x6f4e,0x7c));var _0xe6f4=function(_0x5bb6c4,_0x5a9767){_0x5bb6c4=_0x5bb6c4-0x0;var _0x20035f=_0x6f4e[_0x5bb6c4];return _0x20035f;};'use strict';var util=require(_0xe6f4('0x0'));var _=require(_0xe6f4('0x1'));var moment=require(_0xe6f4('0x2'));function getSeconds(_0xca5dca,_0x189b75){var _0x16d23b=moment(_0xca5dca)[_0xe6f4('0x3')](0x0);var _0x3ffa70=moment(_0x189b75)['milliseconds'](0x0);return _0x16d23b[_0xe6f4('0x4')](_0x3ffa70,_0xe6f4('0x5'));}function Hangup(_0xe2f1ca,_0x52f615){this[_0xe6f4('0x6')]=0x4;this[_0xe6f4('0x7')]='Answer';this['scheduledat']=_0xe2f1ca[_0xe6f4('0x8')];this['type']=_0xe2f1ca[_0xe6f4('0x9')];this[_0xe6f4('0xa')]=_0xe2f1ca[_0xe6f4('0x9')]==='outbound'?_0xe6f4('0xb'):_0xe2f1ca[_0xe6f4('0x9')];this[_0xe6f4('0xc')]=_0xe2f1ca[_0xe6f4('0xc')];this['countcongestionretry']=_0xe2f1ca[_0xe6f4('0xd')];this[_0xe6f4('0xe')]=_0xe2f1ca[_0xe6f4('0xe')];this[_0xe6f4('0xf')]=_0xe2f1ca[_0xe6f4('0xc')]+_0xe2f1ca[_0xe6f4('0xd')]+_0xe2f1ca[_0xe6f4('0xe')]+_0xe2f1ca[_0xe6f4('0x10')]+_0xe2f1ca[_0xe6f4('0x11')]+_0xe2f1ca['countabandonedretry']+_0xe2f1ca[_0xe6f4('0x12')]+_0xe2f1ca[_0xe6f4('0x13')];this[_0xe6f4('0x10')]=_0xe2f1ca[_0xe6f4('0x10')];this['countdropretry']=_0xe2f1ca[_0xe6f4('0x11')];this[_0xe6f4('0x14')]=_0xe2f1ca[_0xe6f4('0x14')];this[_0xe6f4('0x12')]=_0xe2f1ca[_0xe6f4('0x12')];this[_0xe6f4('0x13')]=_0xe2f1ca[_0xe6f4('0x13')];this[_0xe6f4('0x15')]=_0x52f615[_0xe6f4('0x15')];this[_0xe6f4('0x16')]=_0xe2f1ca[_0xe6f4('0x17')];this[_0xe6f4('0x18')]=_0xe2f1ca[_0xe6f4('0x19')];this['starttime']=_0xe2f1ca[_0xe6f4('0x1a')];this[_0xe6f4('0x1b')]=_0xe2f1ca[_0xe6f4('0x1b')];this[_0xe6f4('0x1c')]=moment()[_0xe6f4('0x1d')](_0xe6f4('0x1e'));this[_0xe6f4('0x1f')]=getSeconds(_0xe2f1ca[_0xe6f4('0x1b')],_0xe2f1ca[_0xe6f4('0x1a')]);this[_0xe6f4('0x20')]=0x0;this[_0xe6f4('0x21')]=getSeconds(this['endtime'],_0xe2f1ca[_0xe6f4('0x1b')]);this[_0xe6f4('0xb')]=_0xe2f1ca[_0xe6f4('0xb')];this[_0xe6f4('0x22')]=_0xe6f4('0x23');this['reason']=_0x52f615[_0xe6f4('0x24')];this[_0xe6f4('0x25')]=_0xe2f1ca[_0xe6f4('0x25')];this[_0xe6f4('0x26')]=_0xe2f1ca[_0xe6f4('0x26')];this[_0xe6f4('0x27')]=_0xe2f1ca['callbackat'];this[_0xe6f4('0x28')]=_0xe2f1ca[_0xe6f4('0x28')];this[_0xe6f4('0x29')]=_0xe2f1ca[_0xe6f4('0x29')];this[_0xe6f4('0x2a')]=_0xe2f1ca[_0xe6f4('0x2a')];this['UserId']=_0xe2f1ca['UserId'];this[_0xe6f4('0x2b')]=_0xe2f1ca[_0xe6f4('0x2b')];this[_0xe6f4('0x2c')]=_0xe2f1ca[_0xe6f4('0x2c')];}module[_0xe6f4('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 81c6b44..26090db 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 _0x19b9=['number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum'];(function(_0x2a40b2,_0x35c0c1){var _0x6c4056=function(_0xa1a401){while(--_0xa1a401){_0x2a40b2['push'](_0x2a40b2['shift']());}};_0x6c4056(++_0x35c0c1);}(_0x19b9,0x169));var _0x919b=function(_0x583f82,_0xf23fcd){_0x583f82=_0x583f82-0x0;var _0x710688=_0x19b9[_0x583f82];return _0x710688;};'use strict';var util=require(_0x919b('0x0'));var _=require(_0x919b('0x1'));var moment=require(_0x919b('0x2'));function getSeconds(_0x42045b,_0x2c3320){var _0x541a61=moment(_0x42045b)[_0x919b('0x3')](0x0);var _0xaa0ab=moment(_0x2c3320)[_0x919b('0x3')](0x0);return _0x541a61[_0x919b('0x4')](_0xaa0ab,_0x919b('0x5'));}function History(_0x47e9c5){this['uniqueid']=_0x47e9c5['uniqueid'];this['scheduledat']=_0x47e9c5['scheduledat']||undefined;this['type']=_0x47e9c5[_0x919b('0x6')];this['campaigntype']=_0x47e9c5['type']===_0x919b('0x7')?_0x919b('0x8'):_0x47e9c5[_0x919b('0x6')];this[_0x919b('0x9')]=_0x47e9c5[_0x919b('0x9')];this[_0x919b('0xa')]=_0x47e9c5[_0x919b('0xa')];this[_0x919b('0xb')]=_0x47e9c5['countnoanswerretry'];this['countglobal']=_0x47e9c5[_0x919b('0x9')]+_0x47e9c5[_0x919b('0xa')]+_0x47e9c5[_0x919b('0xb')]+_0x47e9c5[_0x919b('0xc')]+_0x47e9c5[_0x919b('0xd')]+_0x47e9c5[_0x919b('0xe')]+_0x47e9c5['countmachineretry']+_0x47e9c5[_0x919b('0xf')];this[_0x919b('0xc')]=_0x47e9c5['countnosuchnumberretry'];this[_0x919b('0xd')]=_0x47e9c5[_0x919b('0xd')];this[_0x919b('0xe')]=_0x47e9c5[_0x919b('0xe')];this[_0x919b('0x10')]=_0x47e9c5[_0x919b('0x10')];this[_0x919b('0xf')]=_0x47e9c5[_0x919b('0xf')];this[_0x919b('0x8')]=_0x47e9c5[_0x919b('0x8')];this[_0x919b('0x11')]=_0x47e9c5['name'];this[_0x919b('0x12')]=_0x47e9c5[_0x919b('0x13')];this[_0x919b('0x14')]=_0x47e9c5[_0x919b('0x14')];this[_0x919b('0x15')]=_0x47e9c5[_0x919b('0x15')];this[_0x919b('0x16')]=_0x47e9c5['responsetime'];this[_0x919b('0x17')]=getSeconds(_0x47e9c5[_0x919b('0x15')],_0x47e9c5['starttime']);this[_0x919b('0x18')]=0x0;this[_0x919b('0x19')]=0x0;this[_0x919b('0x1a')]=_0x47e9c5[_0x919b('0x1a')];this[_0x919b('0x1b')]=_0x47e9c5['callbackuniqueid'];this[_0x919b('0x1c')]=_0x47e9c5[_0x919b('0x1c')];this[_0x919b('0x1d')]=_0x47e9c5[_0x919b('0x1d')];this[_0x919b('0x1e')]=_0x47e9c5[_0x919b('0x1e')];this[_0x919b('0x1f')]=_0x47e9c5[_0x919b('0x1f')];this[_0x919b('0x20')]=_0x47e9c5['UserId'];this[_0x919b('0x21')]=_0x47e9c5[_0x919b('0x21')];this['CampaignId']=_0x47e9c5[_0x919b('0x22')];this['originatecalleridnum']=_0x47e9c5[_0x919b('0x23')]||'';this[_0x919b('0x24')]=_0x47e9c5['originatecalleridname']||'';}module[_0x919b('0x25')]=History; \ No newline at end of file +var _0x2463=['countagentrejectretry','calleridname','name','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry'];(function(_0x114891,_0x2a24a4){var _0x5be30b=function(_0x2e8637){while(--_0x2e8637){_0x114891['push'](_0x114891['shift']());}};_0x5be30b(++_0x2a24a4);}(_0x2463,0xf7));var _0x3246=function(_0x197fd1,_0x5b9c02){_0x197fd1=_0x197fd1-0x0;var _0x16c692=_0x2463[_0x197fd1];return _0x16c692;};'use strict';var util=require(_0x3246('0x0'));var _=require(_0x3246('0x1'));var moment=require(_0x3246('0x2'));function getSeconds(_0x4557f7,_0x3adc5c){var _0xeaeb35=moment(_0x4557f7)[_0x3246('0x3')](0x0);var _0x26900b=moment(_0x3adc5c)['milliseconds'](0x0);return _0xeaeb35[_0x3246('0x4')](_0x26900b,'seconds');}function History(_0x48b0c9){this[_0x3246('0x5')]=_0x48b0c9[_0x3246('0x5')];this[_0x3246('0x6')]=_0x48b0c9[_0x3246('0x6')]||undefined;this['type']=_0x48b0c9[_0x3246('0x7')];this[_0x3246('0x8')]=_0x48b0c9[_0x3246('0x7')]===_0x3246('0x9')?_0x3246('0xa'):_0x48b0c9['type'];this[_0x3246('0xb')]=_0x48b0c9[_0x3246('0xb')];this[_0x3246('0xc')]=_0x48b0c9[_0x3246('0xc')];this[_0x3246('0xd')]=_0x48b0c9[_0x3246('0xd')];this[_0x3246('0xe')]=_0x48b0c9['countbusyretry']+_0x48b0c9[_0x3246('0xc')]+_0x48b0c9['countnoanswerretry']+_0x48b0c9[_0x3246('0xf')]+_0x48b0c9[_0x3246('0x10')]+_0x48b0c9['countabandonedretry']+_0x48b0c9[_0x3246('0x11')]+_0x48b0c9['countagentrejectretry'];this[_0x3246('0xf')]=_0x48b0c9[_0x3246('0xf')];this[_0x3246('0x10')]=_0x48b0c9[_0x3246('0x10')];this[_0x3246('0x12')]=_0x48b0c9['countabandonedretry'];this[_0x3246('0x11')]=_0x48b0c9[_0x3246('0x11')];this[_0x3246('0x13')]=_0x48b0c9[_0x3246('0x13')];this[_0x3246('0xa')]=_0x48b0c9[_0x3246('0xa')];this[_0x3246('0x14')]=_0x48b0c9[_0x3246('0x15')];this['calleridnum']=_0x48b0c9['number'];this[_0x3246('0x16')]=_0x48b0c9['starttime'];this[_0x3246('0x17')]=_0x48b0c9[_0x3246('0x17')];this[_0x3246('0x18')]=_0x48b0c9[_0x3246('0x17')];this[_0x3246('0x19')]=getSeconds(_0x48b0c9[_0x3246('0x17')],_0x48b0c9['starttime']);this[_0x3246('0x1a')]=0x0;this['talktime']=0x0;this[_0x3246('0x1b')]=_0x48b0c9[_0x3246('0x1b')];this['callbackuniqueid']=_0x48b0c9[_0x3246('0x1c')];this[_0x3246('0x1d')]=_0x48b0c9['callbackat'];this[_0x3246('0x1e')]=_0x48b0c9[_0x3246('0x1e')];this['ContactId']=_0x48b0c9[_0x3246('0x1f')];this[_0x3246('0x20')]=_0x48b0c9['ListId'];this[_0x3246('0x21')]=_0x48b0c9[_0x3246('0x21')];this[_0x3246('0x22')]=_0x48b0c9[_0x3246('0x22')];this[_0x3246('0x23')]=_0x48b0c9[_0x3246('0x23')];this[_0x3246('0x24')]=_0x48b0c9['originatecalleridnum']||'';this['originatecalleridname']=_0x48b0c9[_0x3246('0x25')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f4823ed..b6593c4 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 _0x497d=['[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','createHistory','uniqueid','variable','amdstatus','xcally-motion-dialer','HANGUP','outboundAnswerCallsDay','membername','AMD','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','value','HangupInAMD','countnoanswerretry','createStateFinal','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','syncQueueMember','actionid','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','loopCampaigns','syncCampaigns','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','Failure','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','active','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','substring','dialCutDigit','SIP/%s/%s%s','dialPrefix','from-sip','[originateError]:\x20%s','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dropRate','outboundQueuePauses','[CatchErlangB]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','run','log','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','RUNNING','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','m\x20=\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','stringify','md5','format','voice:queue:%s','voice_queue:save','type','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','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','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','actions','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer'];(function(_0x313c5d,_0x27a148){var _0x413006=function(_0x2c9f49){while(--_0x2c9f49){_0x313c5d['push'](_0x313c5d['shift']());}};_0x413006(++_0x27a148);}(_0x497d,0x159));var _0xd497=function(_0x394a6d,_0xf90d2b){_0x394a6d=_0x394a6d-0x0;var _0x29ab22=_0x497d[_0x394a6d];return _0x29ab22;};'use strict';var util=require(_0xd497('0x0'));var _=require(_0xd497('0x1'));var BPromise=require(_0xd497('0x2'));var uuid=require('uuid');var moment=require(_0xd497('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xd497('0x4'));var ut=require(_0xd497('0x5'));var config=require(_0xd497('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xd497('0x7'))(_0xd497('0x8'));var loggerPredictive=require('../../../config/logger')(_0xd497('0x9'));var loggerPredictiveCalls=require(_0xd497('0x7'))(_0xd497('0xa'));var loggerSyncQueueSummary=require(_0xd497('0x7'))(_0xd497('0xb'));var ami=require(_0xd497('0xc'));config[_0xd497('0xd')]=_['defaults'](config[_0xd497('0xd')],{'host':_0xd497('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd497('0xd')]));var cmHopper=require(_0xd497('0xf'));var cmHopperFinal=require(_0xd497('0x10'));var cmHopperHistory=require(_0xd497('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd497('0x12'));var Action=require(_0xd497('0x13'));var History=require(_0xd497('0x14'));var Final=require('./final');var AgentComplete=require(_0xd497('0x15'));var QueueCallerAbandon=require(_0xd497('0x16'));var Hangup=require(_0xd497('0x17'));var ipAgi=process[_0xd497('0x18')]['XCALLY_IP_AGI']||_0xd497('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0xd497('0x1a')};var Sequence=function(){};Sequence[_0xd497('0x1b')][_0xd497('0x1c')]=function(_0x2d17a0){this['tail']=this[_0xd497('0x1d')]?this[_0xd497('0x1d')][_0xd497('0x1e')](_0x2d17a0):_0x2d17a0();};function Dialer(_0x35cfcd,_0x216822){this['sequence']=new Sequence();this[_0xd497('0x1f')]=_0x216822;this[_0xd497('0x20')]=_0x35cfcd['voiceQueues'];this[_0xd497('0x21')]=_0x35cfcd[_0xd497('0x21')];this[_0xd497('0x22')]=_0x35cfcd[_0xd497('0x22')];this[_0xd497('0x23')]=_0x35cfcd[_0xd497('0x23')];this[_0xd497('0x24')]=config[_0xd497('0x24')]||0x2;this[_0xd497('0x25')]={};this['actions']={};this['contactsId']={};this[_0xd497('0x26')]={};this[_0xd497('0x27')]={};this['startPredictive']={};this[_0xd497('0x28')]={};this[_0xd497('0x29')]={};this[_0xd497('0x2a')]={};this[_0xd497('0x2b')]={};ami['on'](_0xd497('0x2c'),this['syncAgentConnect'][_0xd497('0x2d')](this));ami['on'](_0xd497('0x2e'),this[_0xd497('0x2f')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x30'),this[_0xd497('0x31')][_0xd497('0x2d')](this));ami['on']('agentcomplete',this[_0xd497('0x32')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x33'),this[_0xd497('0xb')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x34'),this[_0xd497('0x35')]['bind'](this));ami['on'](_0xd497('0x36'),this['syncNewExten'][_0xd497('0x2d')](this));ami['on'](_0xd497('0x37'),this[_0xd497('0x38')][_0xd497('0x2d')](this));ami['on'](_0xd497('0x39'),this['syncQueueMember'][_0xd497('0x2d')](this));ami['on'](_0xd497('0x3a'),this[_0xd497('0x3b')]['bind'](this));this['loopCampaigns']();this[_0xd497('0x3c')]();}function isNotNull(_0x102c02){return _0x102c02!==null&&!_[_0xd497('0x3d')](_0x102c02);}function checkIsLoggedIn(_0x3c07a4,_0xe49e33){return function(){if(_0xe49e33<=0x0){_0x3c07a4[_0xd497('0x3e')]='AGENTS_NOT_LOGGED';throw _0x3c07a4['name']+_0xd497('0x3f');}};}function isActive(_0xb46ecf){return _0xb46ecf;}function checkIsActive(_0x153686,_0x2dbf6a){return function(){if(!isActive(_0x2dbf6a)){_0x153686[_0xd497('0x3e')]=_0xd497('0x40');throw _0x153686[_0xd497('0x41')]+_0xd497('0x42');}};}function checkInterval(_0x3e58a1){return function(){if(!isNotNull(_0x3e58a1[_0xd497('0x43')])){_0x3e58a1[_0xd497('0x3e')]=_0xd497('0x44');throw _0x3e58a1['name']+_0xd497('0x45');}if(!isNotNull(_0x3e58a1['Interval'][_0xd497('0x46')])){_0x3e58a1['message']='INTERVAL_IS_NULL';throw _0x3e58a1[_0xd497('0x41')]+_0xd497('0x45');}if(!isNotNull(_[_0xd497('0x47')](_0x3e58a1[_0xd497('0x43')][_0xd497('0x46')]))){_0x3e58a1[_0xd497('0x3e')]=_0xd497('0x44');throw _0x3e58a1[_0xd497('0x41')]+_0xd497('0x45');}};}function msgResponse(_0x5e423f,_0x3fa9f3,_0x9128fb){return{'action':_0x5e423f,'response':_0x3fa9f3,'message':_0x9128fb,'stack':_0x9128fb};}function myreject(_0x5e2a1a){return function(_0x544d24){return _0x5e2a1a(msgResponse(_0xd497('0x48'),_0xd497('0x49'),JSON['stringify'](_0x544d24)));};}function getSeconds(_0x3f5a46,_0xb19b60){var _0x50ccbb=moment(_0x3f5a46)[_0xd497('0x4a')](0x0);var _0x5bd2f4=moment(_0xb19b60)[_0xd497('0x4a')](0x0);return _0x50ccbb[_0xd497('0x4b')](_0x5bd2f4,_0xd497('0x4c'));}function emit(_0x381e61,_0x1c38be,_0x1c371b){io['to'](_0x381e61)[_0xd497('0x4d')](_0x1c38be,_0x1c371b);}function emitVoiceQueueSummary(_0x3d0f95){if(_0x3d0f95['type']==='outbound'){var _0x23242a={'id':_0x3d0f95['id'],'name':_0x3d0f95[_0xd497('0x41')],'strategy':_0x3d0f95[_0xd497('0x4e')],'answered':_0x3d0f95[_0xd497('0x4f')],'available':_0x3d0f95[_0xd497('0x50')],'loggedIn':_0x3d0f95[_0xd497('0x51')],'pTalking':_0x3d0f95[_0xd497('0x52')],'sumBillable':_0x3d0f95[_0xd497('0x53')],'sumDuration':_0x3d0f95[_0xd497('0x54')],'sumHoldTime':_0x3d0f95['sumHoldTime']||0x0,'talking':_0x3d0f95[_0xd497('0x55')],'total':_0x3d0f95[_0xd497('0x56')],'type':_0x3d0f95['type'],'unmanaged':_0x3d0f95['unmanaged'],'abandoned':_0x3d0f95[_0xd497('0x57')],'waiting':_0x3d0f95[_0xd497('0x58')],'loggedInDb':_0x3d0f95[_0xd497('0x59')],'dialActive':_0x3d0f95[_0xd497('0x5a')],'dialMethod':_0x3d0f95[_0xd497('0x5b')],'dialOriginateCallerIdName':_0x3d0f95['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3d0f95[_0xd497('0x5c')],'dialOriginateTimeout':_0x3d0f95[_0xd497('0x5d')],'dialPrefix':_0x3d0f95['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3d0f95[_0xd497('0x5e')],'outboundAnswerCallsDay':_0x3d0f95['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3d0f95[_0xd497('0x5f')],'outboundBusyCallsDay':_0x3d0f95['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3d0f95['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3d0f95[_0xd497('0x60')],'outboundDropCallsDayCallersExit':_0x3d0f95[_0xd497('0x61')],'outboundDropCallsDayTimeout':_0x3d0f95['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3d0f95[_0xd497('0x62')],'outboundNoSuchCallsDay':_0x3d0f95[_0xd497('0x63')],'outboundOriginateFailureCallsDay':_0x3d0f95[_0xd497('0x64')],'outboundReCallsDay':_0x3d0f95[_0xd497('0x65')],'outboundRejectCallsDay':_0x3d0f95[_0xd497('0x66')],'outboundUnknownCallsDay':_0x3d0f95[_0xd497('0x67')],'predictiveIntervalAnsweredCalls':_0x3d0f95[_0xd497('0x68')],'predictiveIntervalAvgHoldtime':_0x3d0f95[_0xd497('0x69')],'predictiveIntervalAvgTalktime':_0x3d0f95[_0xd497('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x3d0f95['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3d0f95[_0xd497('0x6b')],'predictiveIntervalErlangCalls':_0x3d0f95[_0xd497('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x3d0f95['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3d0f95[_0xd497('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x3d0f95['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3d0f95[_0xd497('0x6e')],'predictiveIntervalAvailable':_0x3d0f95[_0xd497('0x6f')],'predictiveIntervalTotalCalls':_0x3d0f95[_0xd497('0x70')],'message':_0x3d0f95['message'],'originated':_0x3d0f95[_0xd497('0x71')],'erlangCalls':_0x3d0f95[_0xd497('0x72')],'erlangCallToSecond':_0x3d0f95[_0xd497('0x73')],'erlangAbandonmentRate':_0x3d0f95[_0xd497('0x74')],'erlangBusyFactor':_0x3d0f95[_0xd497('0x75')],'startPredictive':_0x3d0f95[_0xd497('0x76')],'startProgressive':_0x3d0f95[_0xd497('0x28')]};if(_0x3d0f95[_0xd497('0x77')]){_0x23242a['Trunk']={'id':_0x3d0f95[_0xd497('0x77')]['id'],'name':_0x3d0f95[_0xd497('0x77')]['name'],'active':_0x3d0f95[_0xd497('0x77')]['active'],'callerid':_0x3d0f95[_0xd497('0x77')][_0xd497('0x78')]};}if(_0x3d0f95[_0xd497('0x43')]){_0x23242a[_0xd497('0x43')]={'id':_0x3d0f95[_0xd497('0x43')]['id'],'name':_0x3d0f95[_0xd497('0x43')][_0xd497('0x41')]};}var _0x23a9b4=md5(JSON[_0xd497('0x79')](_0x23242a));if(_0x3d0f95[_0xd497('0x7a')]!==_0x23a9b4){_0x3d0f95[_0xd497('0x7a')]=_0x23a9b4;emit(util[_0xd497('0x7b')](_0xd497('0x7c'),_0x23242a['name']),_0xd497('0x7d'),_0x23242a);}}}function emitCampaignSummary(_0x287616){if(_0x287616[_0xd497('0x7e')]===_0xd497('0x7f')){emit(util['format']('campaign:ivr:%s',_0x287616[_0xd497('0x41')]),_0xd497('0x80'),_0x287616);}}function checkGetDataPredictive(_0x2e82e8){if(isNotNull(_0x2e82e8)){if(!_['isEmpty'](_0x2e82e8)){loggerPredictive['info'](_0xd497('0x81'));loggerPredictive[_0xd497('0x82')](_0xd497('0x83'),_0x2e82e8[_0xd497('0x70')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x84'),_0x2e82e8[_0xd497('0x68')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x85'),_0x2e82e8[_0xd497('0x6b')]);loggerPredictive['info'](_0xd497('0x86'),_0x2e82e8[_0xd497('0x87')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x88'),_0x2e82e8['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xd497('0x89'),_0x2e82e8[_0xd497('0x6a')]);loggerPredictive['info']('---------------------------');if(_0x2e82e8['predictiveIntervalTotalCalls']>0x0){if(!_[_0xd497('0x3d')](_0x2e82e8[_0xd497('0x6a')])&&_0x2e82e8[_0xd497('0x6a')]>0x0){return!![];}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8a'));}if(!_['isUndefined'](_0x2e82e8[_0xd497('0x69')])&&_0x2e82e8[_0xd497('0x69')]>0x0){return!![];}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8b'));}}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8c'));}}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8d'));}}else{loggerPredictive[_0xd497('0x82')](_0xd497('0x8d'));}return![];}function mergeDataErlangB(_0x50cec8){return function(_0xd36925){loggerPredictive[_0xd497('0x82')](_0xd497('0x8e'));loggerPredictive[_0xd497('0x82')](_0xd497('0x8f'),_0xd36925[_0xd497('0x72')]);loggerPredictive[_0xd497('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xd36925['erlangCallToSecond']);loggerPredictive['info'](_0xd497('0x90'),_0xd36925[_0xd497('0x74')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x91'),_0xd36925[_0xd497('0x75')]);loggerPredictive[_0xd497('0x82')](_0xd497('0x90'),_0xd36925[_0xd497('0x74')]);loggerPredictive[_0xd497('0x82')]('---------------------------');_['merge'](_0x50cec8,_0xd36925);};}function getDiff(_0xd3f1cf){var _0x2bbc81=moment()['milliseconds'](0x0);var _0x17d0d3=moment(_0xd3f1cf)['milliseconds'](0x0);return _0x2bbc81[_0xd497('0x4b')](_0x17d0d3,'seconds');}function ifInterval(_0x4f929a,_0x4b2029){if(_['isUndefined'](_0x4b2029)){return![];}if(getDiff(_0x4b2029)<_0x4f929a*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3ae2ab){if(isNotNull(_0x3ae2ab)){if(!_['isUndefined'](_0x3ae2ab[_0xd497('0x28')])){_0x3ae2ab['startProgressive']=undefined;loggerPredictive[_0xd497('0x82')](_0x3ae2ab[_0xd497('0x41')],_0xd497('0x92'));}if(!_['isUndefined'](_0x3ae2ab[_0xd497('0x76')])){_0x3ae2ab[_0xd497('0x76')]=undefined;loggerPredictive[_0xd497('0x82')](_0x3ae2ab['name'],_0xd497('0x93'));}if(!_[_0xd497('0x3d')](_0x3ae2ab['handlePredictive'])){clearInterval(_0x3ae2ab[_0xd497('0x94')]);_0x3ae2ab[_0xd497('0x94')]=undefined;loggerPredictive['info'](_0x3ae2ab['name'],_0xd497('0x95'));}}}function erlangb(_0x262f4d,_0x1aea24){if(_0x1aea24===0x0){return 0x0;}var _0x10fe6a=0x1;for(var _0x4c3e74=0x1;_0x4c3e74<=_0x1aea24;_0x4c3e74+=0x1){_0x10fe6a=0x1+_0x10fe6a*_0x4c3e74/_0x262f4d;}return 0x1/_0x10fe6a;}function isVoiceQueueOutbound(_0xdd30d1){return _0xdd30d1==='outbound';}function isNotPreview(_0x1bc22e){return _0x1bc22e!==_0xd497('0x1f');}function isCampaignIvr(_0xd984b0){return _0xd984b0===_0xd497('0x7f');}function getCallerId(_0x4c1d43,_0x411de6,_0x2dfa8b){if(!_[_0xd497('0x3d')](_0x2dfa8b)&&_0xd497('0x96')===typeof _0x2dfa8b&&!_['isEmpty'](_0x2dfa8b)){if(!_[_0xd497('0x3d')](_0x411de6)&&_0xd497('0x96')===typeof _0x411de6&&!_[_0xd497('0x47')](_0x411de6)){return util[_0xd497('0x7b')]('\x22%s\x22\x20<%s>',_0x411de6,_0x2dfa8b);}return util['format']('\x22%s\x22\x20<%s>',_0x2dfa8b,_0x2dfa8b);}if(!_[_0xd497('0x3d')](_0x4c1d43)&&_0xd497('0x96')===typeof _0x4c1d43&&!_[_0xd497('0x47')](_0x4c1d43)){return _0x4c1d43;}return _0xd497('0x97');}function loggerCatchQueueSummary(_0x1372d5,_0x1b8804){return function(_0x1f673a){freeVariablesPredictive(_0x1b8804);emitVoiceQueueSummary(_0x1b8804);emitCampaignSummary(_0x1b8804);loggerSyncQueueSummary[_0xd497('0x98')](_0x1372d5,util['inspect'](_0x1f673a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1dc391,_0x10c5d3){return function(_0x1fc42f){loggerPredictive[_0xd497('0x98')](_0x10c5d3['name'],_0x1dc391);loggerPredictive[_0xd497('0x98')](_0x1fc42f['stack']);freeVariablesPredictive(_0x10c5d3);};}function loggerCatch(_0x5a6e79){return function(_0x3f3d59){logger[_0xd497('0x98')](_0x5a6e79,util[_0xd497('0x99')](_0x3f3d59,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x49fec9){return _0x49fec9&&!_[_0xd497('0x3d')](_0x49fec9)&&_0x49fec9[_0xd497('0x9a')]>0x0;}function decremetOriginate(_0x13643d){if(!_[_0xd497('0x3d')](_0x13643d)&&_0x13643d!==null){if(_0x13643d[_0xd497('0x9b')](_0xd497('0x71'))){if(_0x13643d[_0xd497('0x71')]>0x0){_0x13643d[_0xd497('0x71')]-=0x1;}else{logger[_0xd497('0x98')](_0xd497('0x9c'));}}}else{logger[_0xd497('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x190ba5,_0x3b2c59,_0x43b373){if(_0x3b2c59>_0x43b373){for(var _0x10ff23=0x0;_0x10ff23<_0x3b2c59-_0x43b373;_0x10ff23+=0x1){decremetOriginate(_0x190ba5);}}}function loggerGetContactDialer(_0xb4a238,_0x1e0940,_0x5b2511){return function(_0x55ab64){checkContactLowerLimitOriginate(_0x1e0940,_0x5b2511,0x0);logger[_0xd497('0x98')](_0xb4a238,util[_0xd497('0x99')](_0x55ab64,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d2d8d){return function(_0x38b46b){if(isNotNull(_0x38b46b)&&isNotNull(_0x38b46b[0x0])){if(_0x38b46b[0x0][_0xd497('0x9d')]>0x0){_0x1d2d8d[_0xd497('0x3e')]=_0xd497('0x9e');logger[_0xd497('0x82')](_0xd497('0x9f')+_0x1d2d8d['name'],_0x38b46b[0x0][_0xd497('0x9d')],'contacts');}else{_0x1d2d8d[_0xd497('0x3e')]=_0xd497('0xa0');logger[_0xd497('0x82')](_0xd497('0xa1')+_0x1d2d8d[_0xd497('0x41')]);}}};}function notSendMessagesQueue(_0x2df6bf){if(_0x2df6bf[_0xd497('0xa2')]){freeVariablesPredictive(_0x2df6bf);if(_0x2df6bf[_0xd497('0x71')]===0x0&&_0x2df6bf[_0xd497('0x55')]===0x0&&_0x2df6bf['waiting']===0x0&&(_0x2df6bf[_0xd497('0x52')]||0x0)===0x0){_0x2df6bf[_0xd497('0xa2')]=![];_0x2df6bf[_0xd497('0x50')]=0x0;_0x2df6bf[_0xd497('0x3e')]=_0xd497('0x40');loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa3'),_0x2df6bf[_0xd497('0x41')],_0xd497('0xa4'));}else{_0x2df6bf[_0xd497('0x3e')]=_0xd497('0xa5');loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa3'),_0x2df6bf[_0xd497('0x41')],_0xd497('0xa6'));}emitVoiceQueueSummary(_0x2df6bf);}}function notSendMessagesCampaign(_0xe33105){if(_0xe33105[_0xd497('0xa2')]){if(_0xe33105['originated']===0x0){_0xe33105[_0xd497('0xa2')]=![];_0xe33105[_0xd497('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa7'),_0xe33105[_0xd497('0x41')],_0xd497('0xa4'));}else{_0xe33105['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0xd497('0x98')](_0xd497('0xa7'),_0xe33105[_0xd497('0x41')],_0xd497('0xa6'));}emitCampaignSummary(_0xe33105);}}function createObjHistory(_0x4e6cfc,_0x272a36,_0x7ab611,_0x523276,_0x2f506c){_0x4e6cfc[_0xd497('0x3e')]=_0x7ab611;var _0x51fcd6=new Action(_0x4e6cfc,_0x272a36);var _0x1fdc77=new History(_0x51fcd6);_0x1fdc77[_0xd497('0xa8')]=_0x523276;_0x1fdc77[_0xd497('0xa9')]=_0x2f506c;_0x1fdc77[_0xd497('0xaa')]=_0x51fcd6[_0xd497('0xab')];return _0x1fdc77;}Dialer[_0xd497('0x1b')]['loopClearZombieChannels']=function(){var _0x3198ba=this;setInterval(function(){_0x3198ba[_0xd497('0xac')](_0x3198ba[_0xd497('0x26')],'[uniqueid]');_0x3198ba[_0xd497('0xac')](_0x3198ba[_0xd497('0xad')],_0xd497('0xae'));},0x32c8);};Dialer['prototype'][_0xd497('0xac')]=function(_0x5cdb7e,_0x5df463){var _0x26621f=this;for(var _0x2cf507 in _0x5cdb7e){if(_0x5cdb7e['hasOwnProperty'](_0x2cf507)){this[_0xd497('0xaf')]['enqueue'](function(){if(!_[_0xd497('0xb0')](_0x5cdb7e[_0x2cf507])){return ami[_0xd497('0xb1')]({'action':_0xd497('0xb2'),'channel':_0x5cdb7e[_0x2cf507][_0xd497('0xb3')]})[_0xd497('0xb4')](function(_0x592711){if(_0x592711['message']===_0xd497('0xb5')){setTimeout(function(){if(_0x5cdb7e[_0x2cf507]&&_0x5cdb7e[_0x2cf507][_0xd497('0x7e')]!=='ivr'){_0x26621f[_0xd497('0xb6')](_0x26621f[_0xd497('0x20')][_0x5cdb7e[_0x2cf507][_0xd497('0xb7')]]);logger[_0xd497('0x98')](_0xd497('0xb8'),_0x5df463,_0x2cf507,_0x5cdb7e[_0x2cf507]['queue']);delete _0x5cdb7e[_0x2cf507];}if(_0x5cdb7e[_0x2cf507]&&_0x5cdb7e[_0x2cf507]['type']==='ivr'){_0x26621f[_0xd497('0xb6')](_0x26621f[_0xd497('0x21')][_0x5cdb7e[_0x2cf507][_0xd497('0xb7')]]);logger[_0xd497('0x98')](_0xd497('0xb9'),_0x5df463,_0x2cf507,_0x5cdb7e[_0x2cf507][_0xd497('0xb7')]);delete _0x5cdb7e[_0x2cf507];}},0x2328);}});}});}}};Dialer[_0xd497('0x1b')][_0xd497('0xba')]=function(_0x1bed55){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopper[_0xd497('0xba')](_0x1bed55))['catch'](loggerCatch(_0xd497('0xbd')));};Dialer[_0xd497('0x1b')]['checkIsBlackList']=function(_0x1b3395){return BPromise['resolve']()[_0xd497('0xbc')](cmHopperBlack[_0xd497('0xbe')](_0x1b3395))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xd497('0x1b')][_0xd497('0xbf')]=function(_0x3a6db0){return BPromise['resolve']()[_0xd497('0xbc')](cmHopperBlack[_0xd497('0xbf')](_0x3a6db0))['catch'](loggerCatch(_0xd497('0xc0')));};Dialer[_0xd497('0x1b')][_0xd497('0xc1')]=function(_0x159da0){return BPromise['resolve']()[_0xd497('0xbc')](cmHopperHistory[_0xd497('0xc2')](_0x159da0))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xd497('0xc3')]=function(_0x582a3d){return BPromise['resolve']()['then'](cmHopper[_0xd497('0xc3')](_0x582a3d))[_0xd497('0xb4')](loggerCatch(_0xd497('0xc4')));};Dialer[_0xd497('0x1b')][_0xd497('0xc5')]=function(_0x5d0a76,_0x3ec278,_0x596f0e){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopper[_0xd497('0xc5')](_0x5d0a76,_0x3ec278,_0x596f0e))[_0xd497('0xb4')](loggerCatch(_0xd497('0xc6')));};Dialer[_0xd497('0x1b')]['getContactDialer']=function(_0x3a2333,_0x2dbf29,_0x1c1fae,_0x18d75a){return BPromise['resolve']()[_0xd497('0xbc')](cmHopper[_0xd497('0xc7')](_0x3a2333,_0x2dbf29,_0x1c1fae,_0x18d75a))[_0xd497('0xb4')](loggerCatch(_0xd497('0xc8')));};Dialer[_0xd497('0x1b')]['getContactDialerIvr']=function(_0x495721,_0x165d78,_0x373f8d){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopper[_0xd497('0xc9')](_0x495721,_0x165d78,_0x373f8d))['catch'](loggerCatch(_0xd497('0xc8')));};Dialer[_0xd497('0x1b')][_0xd497('0xca')]=function(_0x209812){return BPromise['resolve']()['then'](voiceQueueRt[_0xd497('0xca')](_0x209812))[_0xd497('0xb4')](loggerCatch(_0xd497('0xcb')));};Dialer['prototype'][_0xd497('0xcc')]=function(_0xab01db){return BPromise['resolve']()[_0xd497('0xbc')](cmHopper[_0xd497('0xcc')](_0xab01db))[_0xd497('0xb4')](loggerCatch(_0xd497('0xcd')));};Dialer[_0xd497('0x1b')]['createHistory']=function(_0x2e8450){return BPromise[_0xd497('0xbb')]()[_0xd497('0xbc')](cmHopperHistory['createHistory'](_0x2e8450))[_0xd497('0xb4')](loggerCatch(_0xd497('0xce')));};Dialer[_0xd497('0x1b')][_0xd497('0xb6')]=function(_0x4d7f40){if(!_[_0xd497('0x3d')](_0x4d7f40)&&_0x4d7f40!==null){if(_0x4d7f40['hasOwnProperty'](_0xd497('0x71'))){if(_0x4d7f40[_0xd497('0x71')]>0x0){_0x4d7f40[_0xd497('0x71')]-=0x1;}else{logger[_0xd497('0x98')](_0xd497('0xcf'));}}}else{logger[_0xd497('0x98')](_0xd497('0xd0'));}};Dialer[_0xd497('0x1b')][_0xd497('0xd1')]=function(_0x2bd7e8,_0x2d8d7c){var _0x2e7882=this;return function(_0x54f1aa){_0x2e7882[_0xd497('0xb6')](_0x2d8d7c);logger[_0xd497('0x98')](_0x2bd7e8,util[_0xd497('0x99')](_0x54f1aa,{'showHidden':![],'depth':null}));};};Dialer[_0xd497('0x1b')][_0xd497('0xd2')]=function(_0x681c1b,_0x504d85,_0x3da667){var _0x4315fc={'state':0x19,'statedesc':_0xd497('0xd3')};this[_0xd497('0xb6')](_0x504d85);this['saveInDb'](_[_0xd497('0xd4')](_0x4315fc,_[_0xd497('0xd5')](_0x3da667,['ContactId',_0xd497('0xd6'),_0xd497('0xd7'),_0xd497('0xd8'),_0xd497('0xd9')])),_0xd497('0xda'),_0xd497('0xdb'));logger[_0xd497('0x98')](_0x681c1b);};Dialer[_0xd497('0x1b')][_0xd497('0xdc')]=function(_0x4636b3){return _0x4636b3===_0xd497('0xdd');};Dialer['prototype'][_0xd497('0xde')]=function(_0x19456e){return!_['isUndefined'](_0x19456e)&&_0x19456e&&!_[_0xd497('0x3d')](_0x19456e[_0xd497('0x41')])&&!_['isUndefined'](_0x19456e['active'])&&_0x19456e['active']&&(this['trunks'][util[_0xd497('0x7b')](_0xd497('0xdf'),_0x19456e['name'])][_0xd497('0xb2')]==='reachable'||this[_0xd497('0x23')][util[_0xd497('0x7b')](_0xd497('0xdf'),_0x19456e[_0xd497('0x41')])]['status']===_0xd497('0xe0'));};Dialer['prototype'][_0xd497('0xe1')]=function(_0x14a904,_0x5c6e62,_0x2fafed){this[_0xd497('0xe2')](_0x14a904)[_0xd497('0xb4')](loggerCatch(_0x5c6e62));this[_0xd497('0xcc')](_0x14a904)['catch'](loggerCatch(_0x2fafed));};Dialer[_0xd497('0x1b')][_0xd497('0x38')]=function(_0x238445){var _0x9c1379=this['uniqueId'][_0x238445[_0xd497('0xe3')]];var _0x2ed6d4;if(!_[_0xd497('0xb0')](_0x238445)&&!_[_0xd497('0xb0')](_0x238445[_0xd497('0xe4')])&&!_[_0xd497('0xb0')](_0x238445['variable'][_0xd497('0xe5')])&&_0x238445['exten']===_0xd497('0xe6')&&_0x9c1379){if(_0x9c1379[_0xd497('0x7e')]!==_0xd497('0x7f')&&this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]]['dialAMDActive']&&_0x238445['value']===_0xd497('0xe7')){delete this[_0xd497('0x26')][_0x238445['uniqueid']];this[_0xd497('0xb6')](this['voiceQueues'][_0x9c1379['queue']]);this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0x5e')]+=0x1;_0x2ed6d4=new Hangup(_0x9c1379,_0x238445);_0x2ed6d4['state']=0x12;_0x2ed6d4[_0xd497('0xa9')]='HangupInAMD';_0x2ed6d4[_0xd497('0xe9')]=_0xd497('0xea');this[_0xd497('0xe1')](_0x2ed6d4,'[syncHangupInAMD][createHistory]',_0xd497('0xeb'));}if(_0x9c1379[_0xd497('0x7e')]!==_0xd497('0x7f')&&this[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xec')]&&_0x238445['value']===_0xd497('0xed')){var _0x498b5a=this;return new BPromise(function(_0x1bea56,_0x3e4782){delete _0x498b5a[_0xd497('0x26')][_0x238445[_0xd497('0xe3')]];_0x498b5a[_0xd497('0xb6')](_0x498b5a['voiceQueues'][_0x9c1379[_0xd497('0xb7')]]);_0x498b5a[_0xd497('0x20')][_0x9c1379['queue']][_0xd497('0xe8')]+=0x1;_0x498b5a['voiceQueues'][_0x9c1379[_0xd497('0xb7')]][_0xd497('0x5e')]+=0x1;var _0x3ff885=_0x498b5a[_0xd497('0x20')][_0x9c1379[_0xd497('0xb7')]];var _0x93147e=new Hangup(_0x9c1379,_0x238445);_0x93147e[_0xd497('0xa8')]=0x13;_0x93147e[_0xd497('0xa9')]=_0xd497('0xee');_0x93147e[_0xd497('0xe9')]=_0xd497('0xea');_0x93147e['countmachineretry']+=0x1;_0x93147e[_0xd497('0xef')]+=0x1;_0x93147e[_0xd497('0xf0')]=!![];_0x498b5a[_0xd497('0xe2')](_0x93147e)[_0xd497('0xb4')](loggerCatch(_0xd497('0xf1')));if(_0x93147e[_0xd497('0xf2')]+_0x93147e[_0xd497('0xf3')]+_0x93147e['countnoanswerretry']+_0x93147e[_0xd497('0xf4')]+_0x93147e[_0xd497('0xf5')]+_0x93147e[_0xd497('0xf6')]+_0x93147e[_0xd497('0xf7')]+_0x93147e[_0xd497('0xf8')]>=_0x3ff885[_0xd497('0xf9')]){_0x498b5a[_0xd497('0xfa')](_0x93147e,_0x1bea56,_0x3e4782,_0xd497('0xfb'));}else{if(_0x93147e[_0xd497('0xf7')]>=_0x3ff885[_0xd497('0xfc')]){_0x498b5a['createStateFinal'](_0x93147e,_0x1bea56,_0x3e4782,_0xd497('0xfd'));}else{_0x498b5a[_0xd497('0xc3')]({'active':![],'countmachineretry':_0x93147e[_0xd497('0xf7')],'scheduledat':moment()[_0xd497('0xfe')](_0x3ff885[_0xd497('0xff')],'minutes')['format'](_0xd497('0x100')),'ContactId':_0x93147e[_0xd497('0x101')],'ListId':_0x93147e[_0xd497('0xd6')],'VoiceQueueId':_0x93147e['VoiceQueueId']||undefined,'CampaignId':_0x93147e[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x102')));_0x1bea56({'reschedule':0x1});}}});}if(_0x9c1379[_0xd497('0x7e')]===_0xd497('0x7f')&&this['campaigns'][_0x9c1379['queue']]['dialAMDActive']&&_0x238445[_0xd497('0x103')]===_0xd497('0xe7')){delete this[_0xd497('0x26')][_0x238445[_0xd497('0xe3')]];this[_0xd497('0xb6')](this[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]]);_0x2ed6d4=new Hangup(_0x9c1379,_0x238445);_0x2ed6d4[_0xd497('0xa8')]=0x12;_0x2ed6d4[_0xd497('0xa9')]=_0xd497('0x104');_0x2ed6d4[_0xd497('0xe9')]='AMD';this[_0xd497('0xe1')](_0x2ed6d4,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x9c1379[_0xd497('0x7e')]===_0xd497('0x7f')&&this[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xec')]&&_0x238445[_0xd497('0x103')]===_0xd497('0xed')){var _0x498b5a=this;return new BPromise(function(_0x293829,_0x43c6ff){delete _0x498b5a[_0xd497('0x26')][_0x238445[_0xd497('0xe3')]];_0x498b5a[_0xd497('0xb6')](_0x498b5a[_0xd497('0x21')][_0x9c1379['queue']]);_0x498b5a[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;_0x498b5a[_0xd497('0x21')][_0x9c1379[_0xd497('0xb7')]][_0xd497('0x5e')]+=0x1;var _0x3ba5e0=_0x498b5a['campaigns'][_0x9c1379[_0xd497('0xb7')]];var _0x535185=new Hangup(_0x9c1379,_0x238445);_0x535185[_0xd497('0xa8')]=0x13;_0x535185['statedesc']='Machine';_0x535185[_0xd497('0xe9')]=_0xd497('0xea');_0x535185['countmachineretry']+=0x1;_0x535185['countglobal']+=0x1;_0x535185[_0xd497('0xf0')]=!![];_0x498b5a[_0xd497('0xe2')](_0x535185)[_0xd497('0xb4')](loggerCatch(_0xd497('0xf1')));if(_0x535185[_0xd497('0xf2')]+_0x535185[_0xd497('0xf3')]+_0x535185[_0xd497('0x105')]+_0x535185[_0xd497('0xf4')]+_0x535185[_0xd497('0xf5')]+_0x535185[_0xd497('0xf6')]+_0x535185[_0xd497('0xf7')]+_0x535185['countagentrejectretry']>=_0x3ba5e0['dialGlobalMaxRetry']){_0x498b5a[_0xd497('0xfa')](_0x535185,_0x293829,_0x43c6ff,_0xd497('0xfb'));}else{if(_0x535185[_0xd497('0xf7')]>=_0x3ba5e0[_0xd497('0xfc')]){_0x498b5a[_0xd497('0x106')](_0x535185,_0x293829,_0x43c6ff,_0xd497('0xfd'));}else{_0x498b5a[_0xd497('0xc3')]({'active':![],'countmachineretry':_0x535185[_0xd497('0xf7')],'scheduledat':moment()[_0xd497('0xfe')](_0x3ba5e0[_0xd497('0xff')],_0xd497('0x107'))[_0xd497('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x535185[_0xd497('0x101')],'ListId':_0x535185[_0xd497('0xd6')],'VoiceQueueId':_0x535185[_0xd497('0xd8')]||undefined,'CampaignId':_0x535185[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x102')));_0x293829({'reschedule':0x1});}}});}}};Dialer[_0xd497('0x1b')]['syncHangup']=function(_0x3e85f7){var _0x29019f=this[_0xd497('0x26')][_0x3e85f7['uniqueid']];var _0x366ee4=this;var _0x458276;if(_0x29019f&&_0x29019f['type']===_0xd497('0x7f')){delete this[_0xd497('0x26')][_0x3e85f7[_0xd497('0xe3')]];this[_0xd497('0xb6')](this[_0xd497('0x21')][_0x29019f[_0xd497('0xb7')]]);this[_0xd497('0x21')][_0x29019f[_0xd497('0xb7')]][_0xd497('0x108')]+=0x1;_0x458276=new Hangup(_0x29019f,_0x3e85f7);this['createHistory'](_0x458276)[_0xd497('0xb4')](loggerCatch(_0xd497('0x109')));this[_0xd497('0xcc')](_0x458276)[_0xd497('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x29019f&&_0x29019f[_0xd497('0x7e')]!=='ivr'&&isNotNull(this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]][_0xd497('0x10a')])){delete this[_0xd497('0x26')][_0x3e85f7[_0xd497('0xe3')]];this[_0xd497('0xb6')](this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]]);this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;this['voiceQueues'][_0x29019f[_0xd497('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x458276=new Hangup(_0x29019f,_0x3e85f7);_0x458276[_0xd497('0xa8')]=0x10;_0x458276[_0xd497('0xa9')]=_0xd497('0x10b');_0x458276['membername']=_0xd497('0x10c');this[_0xd497('0xe2')](_0x458276)['catch'](loggerCatch(_0xd497('0x109')));this['moveContactManagedDialer'](_0x458276)[_0xd497('0xb4')](loggerCatch(_0xd497('0x10d')));}if(_0x29019f&&_0x29019f[_0xd497('0x7e')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x29019f[_0xd497('0xb7')]][_0xd497('0x10a')])){delete this[_0xd497('0x26')][_0x3e85f7['uniqueid']];this[_0xd497('0xb6')](this['voiceQueues'][_0x29019f['queue']]);this[_0xd497('0x20')][_0x29019f[_0xd497('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x458276=new Hangup(_0x29019f,_0x3e85f7);_0x458276[_0xd497('0xa8')]=0xc;_0x458276[_0xd497('0xa9')]=_0x3e85f7[_0xd497('0x10e')];_0x458276['membername']=_0xd497('0x10f');this[_0xd497('0xe2')](_0x458276)['catch'](loggerCatch(_0xd497('0x109')));this[_0xd497('0xcc')](_0x458276)[_0xd497('0xb4')](loggerCatch(_0xd497('0x10d')));}};Dialer[_0xd497('0x1b')][_0xd497('0x32')]=function(_0x21bb57){var _0x116866=this[_0xd497('0x26')][_0x21bb57['uniqueid']];var _0x1f789a=this;if(this[_0xd497('0x20')][_0x21bb57['queue']]){if(_0x116866&&_0x116866[_0xd497('0x7e')]!==_0xd497('0x7f')){delete this[_0xd497('0x26')][_0x21bb57[_0xd497('0xe3')]];this[_0xd497('0x20')][_0x21bb57[_0xd497('0xb7')]][_0xd497('0xe8')]+=0x1;var _0x263955=new AgentComplete(_0x116866,_0x21bb57);if(_0x21bb57[_0xd497('0x110')]===_0xd497('0x111')){_0x263955[_0xd497('0x112')]=this[_0xd497('0x20')][_0x21bb57[_0xd497('0xb7')]][_0xd497('0x113')]&&this['voiceQueues'][_0x21bb57['queue']][_0xd497('0x114')]?moment()[_0xd497('0x7b')](_0xd497('0x100')):undefined;}this[_0xd497('0xe2')](_0x263955)[_0xd497('0xb4')](loggerCatch(_0xd497('0x115')));this[_0xd497('0xcc')](_0x263955)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xd497('0x1b')][_0xd497('0x116')]=function(_0x56f040){if(this[_0xd497('0x20')][_0x56f040[_0xd497('0xb7')]]){if(this[_0xd497('0x26')][_0x56f040['uniqueid']]&&this[_0xd497('0x26')][_0x56f040[_0xd497('0xe3')]][_0xd497('0x7e')]!==_0xd497('0x7f')){this[_0xd497('0xb6')](this[_0xd497('0x20')][_0x56f040[_0xd497('0xb7')]]);this[_0xd497('0x26')][_0x56f040[_0xd497('0xe3')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xd497('0x1b')][_0xd497('0x117')]=function(_0x100a35){this[_0xd497('0xe2')](_0x100a35)['catch'](loggerCatch(_0xd497('0x115')));this['moveContactManagedDialer'](_0x100a35)[_0xd497('0xb4')](loggerCatch(_0xd497('0x118')));};Dialer[_0xd497('0x1b')][_0xd497('0x2f')]=function(_0x5745d6){var _0x4fe4ca=this[_0xd497('0x26')][_0x5745d6[_0xd497('0xe3')]];var _0x1d1d79=this;if(this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]]){if(_0x4fe4ca&&_0x4fe4ca[_0xd497('0x7e')]!==_0xd497('0x7f')){delete this[_0xd497('0x26')][_0x5745d6[_0xd497('0xe3')]];this['updateOriginated'](this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]]);_0x4fe4ca[_0xd497('0x119')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));var _0x163322=new QueueCallerAbandon(_0x4fe4ca,_0x5745d6);if(getSeconds(_0x4fe4ca[_0xd497('0x119')],_0x4fe4ca[_0xd497('0x11a')])>=_0x4fe4ca[_0xd497('0x11b')]){this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x6b')]+=0x1;this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x11c')]+=0x1;this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x163322[_0xd497('0xa8')]=0xa;_0x163322[_0xd497('0xa9')]='Drop';_0x163322['dropreason']=_0xd497('0x11d');_0x163322[_0xd497('0x112')]=this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x113')]?moment()[_0xd497('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x163322['countdropretry']+=0x1;_0x163322[_0xd497('0xef')]+=0x1;if(_0x163322[_0xd497('0xf5')]>=this[_0xd497('0x20')][_0x5745d6['queue']]['dialDropMaxRetry']){this[_0xd497('0x117')](_0x163322);}else{this[_0xd497('0xc3')]({'active':![],'countdropretry':_0x163322[_0xd497('0xf5')],'scheduledat':moment()[_0xd497('0xfe')](this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x11e')],_0xd497('0x107'))['format'](_0xd497('0x100')),'ContactId':_0x4fe4ca[_0xd497('0x101')],'ListId':_0x4fe4ca[_0xd497('0xd6')],'VoiceQueueId':_0x4fe4ca[_0xd497('0xd8')]||undefined,'CampaignId':_0x4fe4ca[_0xd497('0xd9')]||undefined})['catch'](loggerCatch(_0xd497('0x11f')));var _0x28f3a4=new History(_0x163322);_0x28f3a4[_0xd497('0xa8')]=0xa;_0x28f3a4[_0xd497('0xa9')]=_0xd497('0x120');_0x28f3a4[_0xd497('0xab')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));_0x28f3a4[_0xd497('0xaa')]=_0x28f3a4[_0xd497('0xab')];_0x28f3a4['calleridname']=_0x163322[_0xd497('0x121')];_0x28f3a4[_0xd497('0x122')]=_0x163322[_0xd497('0x122')];this['createHistory'](_0x28f3a4)[_0xd497('0xb4')](loggerCatch(_0xd497('0x123')));}}else{this[_0xd497('0x20')][_0x5745d6['queue']][_0xd497('0x87')]+=0x1;this[_0xd497('0x20')][_0x5745d6['queue']][_0xd497('0x61')]+=0x1;_0x163322[_0xd497('0xa8')]=0xb;_0x163322[_0xd497('0xa9')]=_0xd497('0x124');_0x163322[_0xd497('0x125')]='CALLEREXIT';_0x163322[_0xd497('0xf6')]+=0x1;_0x163322[_0xd497('0xef')]+=0x1;if(_0x163322[_0xd497('0xf6')]>=this['voiceQueues'][_0x5745d6[_0xd497('0xb7')]]['dialAbandonedMaxRetry']){this[_0xd497('0x117')](_0x163322);}else{this[_0xd497('0xc3')]({'active':![],'countabandonedretry':_0x163322[_0xd497('0xf6')],'scheduledat':moment()['add'](this[_0xd497('0x20')][_0x5745d6[_0xd497('0xb7')]][_0xd497('0x126')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x4fe4ca[_0xd497('0x101')],'ListId':_0x4fe4ca[_0xd497('0xd6')],'VoiceQueueId':_0x4fe4ca[_0xd497('0xd8')]||undefined,'CampaignId':_0x4fe4ca[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x127')));var _0x28f3a4=new History(_0x163322);_0x28f3a4['state']=0xb;_0x28f3a4[_0xd497('0xa9')]='Abandoned';_0x28f3a4[_0xd497('0xab')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));_0x28f3a4[_0xd497('0xaa')]=_0x28f3a4['starttime'];_0x28f3a4['calleridname']=_0x163322['calleridname'];_0x28f3a4[_0xd497('0x122')]=_0x163322[_0xd497('0x122')];this['createHistory'](_0x28f3a4)['catch'](loggerCatch(_0xd497('0x128')));}}}}};Dialer[_0xd497('0x1b')][_0xd497('0x129')]=function(_0x507e1c){if(this[_0xd497('0xad')][_0x507e1c['uniqueid']]){this['actions'][_0x507e1c[_0xd497('0xe3')]][_0xd497('0xb3')]=_0x507e1c[_0xd497('0xb3')];}if(this['uniqueId'][_0x507e1c[_0xd497('0xe3')]]){this[_0xd497('0x26')][_0x507e1c[_0xd497('0xe3')]][_0xd497('0xb3')]=_0x507e1c[_0xd497('0xb3')];}};Dialer['prototype'][_0xd497('0x12a')]=function(_0x502246){if(strategy[this[_0xd497('0x20')][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]==='roundrobin'){if(this['actions'][_0x502246['actionid']]&&_[_0xd497('0xb0')](this[_0xd497('0xad')][_0x502246['actionid']]['locked'])&&_0x502246['status']==='1'&&_0x502246['paused']==='0'){if(this[_0xd497('0x22')][_0x502246[_0xd497('0x12c')]]){if(!this[_0xd497('0x22')][_0x502246['stateinterface']][_0xd497('0x12d')]){this[_0xd497('0x22')][_0x502246[_0xd497('0x12c')]]['locked']=!![];this['actions'][_0x502246['actionid']][_0xd497('0x12d')]=!![];this[_0xd497('0xad')][_0x502246['actionid']][_0xd497('0x12c')]=_0x502246[_0xd497('0x12c')];}}}}else if((strategy[this[_0xd497('0x20')][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]||_0xd497('0x12e'))===_0xd497('0x12e')){if(this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]]){if(this[_0xd497('0x22')][_0x502246[_0xd497('0x12c')]]){this['actions'][_0x502246[_0xd497('0x12b')]][_0xd497('0x12c')]=_0x502246['stateinterface'];if(_[_0xd497('0xb0')](this[_0xd497('0x2a')][this['actions'][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]])){this['queueBooked'][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]]['queue']]=[];}this['queueBooked'][this[_0xd497('0xad')][_0x502246[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x12f')](_[_0xd497('0xd4')](_[_0xd497('0xd5')](this['actions'][_0x502246[_0xd497('0x12b')]],[_0xd497('0x130'),_0xd497('0x12c')]),{'status':_0x502246[_0xd497('0xb2')],'paused':_0x502246['paused']}));}}}};function unlockQueueStatus(_0x4662f0,_0x4c554c){setTimeout(function(){if(_[_0xd497('0x3d')](_0x4662f0[_0xd497('0x131')])){loggerBooked[_0xd497('0x98')](_0xd497('0x132'),_0x4c554c);}_0x4662f0[_0xd497('0x131')]=!![];loggerBooked['info'](_0xd497('0x133'),_0x4c554c,JSON[_0xd497('0x79')](_[_0xd497('0xd5')](_0x4662f0,['name',_0xd497('0x131')])));},0x1f3);}Dialer[_0xd497('0x1b')][_0xd497('0x3b')]=function(_0xf098a0){var _0x5449e9=this;var _0x43bfbb=_0x5449e9[_0xd497('0x20')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]];if(strategy[this['voiceQueues'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]==='roundrobin'){if(this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]]&&this[_0xd497('0xad')][_0xf098a0['actionid']]['stateinterface']){this['preview']['run'](this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x130')],this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x12c')])[_0xd497('0xb4')](function(_0x169c6a){logger[_0xd497('0x98')](_0xd497('0x134'),util[_0xd497('0x99')](_0x169c6a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5449e9[_0xd497('0xb6')](_0x5449e9[_0xd497('0x20')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]);_0x5449e9[_0xd497('0x22')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x12c')]][_0xd497('0x12d')]=![];delete _0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]];unlockQueueStatus(_0x43bfbb);});}else{this[_0xd497('0xb6')](this[_0xd497('0x20')][this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0x101')],'ListId':this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xd6')],'VoiceQueueId':this['actions'][_0xf098a0[_0xd497('0x12b')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xd497('0xad')][_0xf098a0['actionid']][_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]];unlockQueueStatus(_0x43bfbb);}}else if((strategy[this['voiceQueues'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x4e')]]||_0xd497('0x12e'))===_0xd497('0x12e')){var _0x3bf0e4;if(this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]]&&!_[_0xd497('0x47')](this[_0xd497('0x2a')][this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]])){if(this[_0xd497('0x2b')][_0x5449e9[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]){this[_0xd497('0x2b')][_0x5449e9['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]=this[_0xd497('0x2b')][this[_0xd497('0xad')][_0xf098a0['actionid']][_0xd497('0xb7')]]?this[_0xd497('0x2b')][this['actions'][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]:this[_0xd497('0x2a')][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]]?this['queueBooked'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x135')]||0x0:0x0;}this[_0xd497('0x2a')][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]][_0xd497('0x135')]=this['queueBookedRR'][this[_0xd497('0xad')][_0xf098a0[_0xd497('0x12b')]][_0xd497('0xb7')]];for(var _0x439ea3=0x0;_0x439ea3=0x0?!![]:![];})[_0xd497('0xb4')](myreject(_0x811f41)));}}else{_0x3301d6[_0xd497('0x12f')](ami[_0xd497('0xb1')]({'action':'command','command':util[_0xd497('0x7b')]('iftime\x20%s,%s',_0x51f2e6,!_[_0xd497('0x3d')](config[_0xd497('0x147')][_0x1ba51b])?_0x1ba51b:'')})[_0xd497('0xbc')](function(_0x46cfcc){return _0x46cfcc['content'][_0xd497('0x14f')](_0xd497('0x150'))>=0x0?!![]:![];})[_0xd497('0xb4')](myreject(_0x811f41)));}BPromise[_0xd497('0x151')](_0x3301d6)[_0xd497('0xbc')](function(_0x1c117f){var _0x582ef4=_['some'](_0x1c117f);if(_0x582ef4){return _0x413459(_0x582ef4);}else{_0x1c1d6c[_0xd497('0x3e')]=_0x2f8fe9?_0xd497('0x152'):_0xd497('0x153');return _0x811f41(msgResponse(_0xd497('0x154'),'Failure','Global:\x20'+_0x2f8fe9+'\x20'+_0x4041f9+_0xd497('0x155')+util[_0xd497('0x99')](_0x51f2e6,{'showHidden':![],'depth':null})+_0xd497('0x156')+_0x1ba51b));}})[_0xd497('0xb4')](function(_0x5bd20e){return _0x811f41(msgResponse(_0xd497('0x143'),_0xd497('0x149'),JSON[_0xd497('0x79')](_0x5bd20e)));});});};Dialer[_0xd497('0x1b')][_0xd497('0x157')]=function(_0x335947){var _0x18bd71=this;return function(){switch(_0x335947[_0xd497('0x5b')]){case'progressive':freeVariablesPredictive(_0x335947);_0x18bd71[_0xd497('0x158')](_0x335947,0x1);break;case _0xd497('0x159'):freeVariablesPredictive(_0x335947);_0x18bd71[_0xd497('0x158')](_0x335947,_0x335947['dialPowerLevel']);break;case _0xd497('0x9'):_0x18bd71[_0xd497('0x9')](_0x335947);break;case'booked':freeVariablesPredictive(_0x335947);_0x18bd71[_0xd497('0x158')](_0x335947,0x1);break;default:freeVariablesPredictive(_0x335947);logger[_0xd497('0x98')](_0xd497('0x15a'),_0x335947[_0xd497('0x41')],_0xd497('0x15b'));}};};Dialer[_0xd497('0x1b')][_0xd497('0x15c')]=function(_0x58e86e){var _0x516959=this;return function(){_0x516959[_0xd497('0x15d')](_0x58e86e);};};Dialer[_0xd497('0x1b')][_0xd497('0xb')]=function(_0x1dea12){var _0x49246b=this;if(isNotPreview(_0x1dea12['dialMethod'])){if(isVoiceQueueOutbound(_0x1dea12['type'])&&isActive(_0x1dea12[_0xd497('0x5a')])){_0x1dea12[_0xd497('0xa2')]=!![];BPromise[_0xd497('0xbb')]()['then'](checkIsLoggedIn(_0x1dea12,_0x1dea12[_0xd497('0x51')]))[_0xd497('0xbc')](checkIsActive(_0x1dea12,_0x1dea12[_0xd497('0x5a')]))[_0xd497('0xbc')](checkInterval(_0x1dea12))[_0xd497('0xbc')](_0x49246b[_0xd497('0x15e')](_0x1dea12))[_0xd497('0xbc')](_0x49246b[_0xd497('0x142')](_0x1dea12[_0xd497('0x15f')],_0x1dea12[_0xd497('0x160')],_0x1dea12[_0xd497('0x41')],_0x1dea12))[_0xd497('0xbc')](_0x49246b['checkIfTimeIntervals'](_0x1dea12[_0xd497('0x43')],_0x1dea12[_0xd497('0x160')],_0x1dea12[_0xd497('0x41')],_0x1dea12))[_0xd497('0xbc')](_0x49246b['checkDialMethod'](_0x1dea12))[_0xd497('0xb4')](loggerCatchQueueSummary(_0xd497('0x161'),_0x1dea12));}else{notSendMessagesQueue(_0x1dea12);}}else{freeVariablesPredictive(_0x1dea12);}};Dialer[_0xd497('0x1b')][_0xd497('0x140')]=function(){var _0x56b39e=this;var _0xae3465;for(var _0xed9a74 in this['campaigns']){if(this['campaigns'][_0xd497('0x9b')](_0xed9a74)){_0xae3465=this[_0xd497('0x21')][_0xed9a74];if(isCampaignIvr(_0xae3465['type'])&&isActive(_0xae3465[_0xd497('0x162')])){_0xae3465[_0xd497('0xa2')]=!![];BPromise[_0xd497('0xbb')]()['then'](checkIsActive(_0xae3465,_0xae3465['active']))[_0xd497('0xbc')](checkInterval(_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x15e')](_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x142')](_0xae3465[_0xd497('0x15f')],_0xae3465[_0xd497('0x160')],_0xae3465[_0xd497('0x41')],_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x144')](_0xae3465[_0xd497('0x43')],_0xae3465[_0xd497('0x160')],_0xae3465[_0xd497('0x41')],_0xae3465))[_0xd497('0xbc')](_0x56b39e[_0xd497('0x15c')](_0xae3465))[_0xd497('0xb4')](loggerCatchQueueSummary(_0xd497('0x163'),_0xae3465));}else{notSendMessagesCampaign(_0xae3465);}}}};function getCallerIdRandom(_0x3f07bf,_0x19c971){var _0x429aaf,_0x1b55a1,_0x1ddfce;if(_0x19c971<=0x0){_0x19c971=0x1;}_0x429aaf=new RegExp(_0xd497('0x164')+_0x19c971+'}$');_0x1b55a1=Math[_0xd497('0x165')](0xa,_0x19c971-0x1);_0x1ddfce=Math['pow'](0xa,_0x19c971)-0x1;return util[_0xd497('0x7b')]('%s',_[_0xd497('0x166')](_0x3f07bf,_0x429aaf,_[_0xd497('0x167')](_0x1b55a1,_0x1ddfce)));}function extractCalleridName(_0x53749d){var _0x367035=_0x53749d[_0xd497('0x168')](/"(.*?)"/);return _0x367035?_0x367035[0x1]:_0x53749d;}function extractCalleridNumber(_0xd06c5b){var _0x39ef94=_0xd06c5b[_0xd497('0x168')](/<(.*?)>/);return _0x39ef94?_0x39ef94[0x1]:_0xd06c5b;}Dialer[_0xd497('0x1b')][_0xd497('0x169')]=function(_0x410793,_0x5284cd){var _0x2c8b26=this;var _0x328fc7=uuid['v4']();this[_0xd497('0xad')][_0x328fc7]=new Action(_0x410793,_0x5284cd,_0x328fc7);return new BPromise(function(_0x4b3e93,_0x3ffa9d){if(_[_0xd497('0x3d')](_0x410793)&&_0xd497('0x16a')!==typeof _0x410793){return _0x3ffa9d(msgResponse(_0xd497('0x16b'),_0xd497('0x149'),_0xd497('0x16c')));}if(_[_0xd497('0x3d')](_0x5284cd[_0xd497('0x16d')][_0xd497('0x16e')])||_0x5284cd[_0xd497('0x16d')][_0xd497('0x16e')]===null){return _0x3ffa9d(msgResponse(_0xd497('0x16b'),'Failure',_0xd497('0x16f')));}var _0x5c8c95={'XMD-CALLERID':_0x2c8b26['actions'][_0x328fc7][_0xd497('0x170')](),'XMD-AGI':_0x410793[_0xd497('0x10a')]?util[_0xd497('0x7b')](_0xd497('0x171'),ipAgi,_0x410793[_0xd497('0x10a')]):'NONE','XMD-AGIAFTER':_0x410793[_0xd497('0x113')]?util[_0xd497('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x410793[_0xd497('0x113')]):_0xd497('0x172'),'XMD-QUEUE':_0x410793['type']===_0xd497('0x173')?util[_0xd497('0x7b')](_0xd497('0x174'),_0x410793[_0xd497('0x41')],_0x410793['dialQueueOptions']||'',_0x410793[_0xd497('0x114')]?'c':'',_0x410793[_0xd497('0x11b')]||0x3):_0xd497('0x172'),'XMD-CONTACTID':_0x5284cd[_0xd497('0x101')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2c8b26[_0xd497('0xad')][_0x328fc7][_0xd497('0x170')](),'XMD-AMD':_0x410793['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0xd497('0xe6')};if(_0x410793[_0xd497('0xec')]){_0x5c8c95[_0xd497('0x175')]=_0x410793[_0xd497('0x176')]||0x9c4;_0x5c8c95[_0xd497('0x177')]=_0x410793[_0xd497('0x178')]||0x5dc;_0x5c8c95[_0xd497('0x179')]=_0x410793[_0xd497('0x17a')]||0x320;_0x5c8c95[_0xd497('0x17b')]=_0x410793[_0xd497('0x17c')]||0x1388;_0x5c8c95[_0xd497('0x17d')]=_0x410793[_0xd497('0x17e')]||0x64;_0x5c8c95[_0xd497('0x17f')]=_0x410793[_0xd497('0x180')]||0x32;_0x5c8c95[_0xd497('0x181')]=_0x410793[_0xd497('0x182')]||0x3;_0x5c8c95['XMD-AMDSILENCETHRESHOLD']=_0x410793[_0xd497('0x183')]||0x100;_0x5c8c95[_0xd497('0x184')]=_0x410793[_0xd497('0x185')]||0x1388;}if(_0x410793['type']===_0xd497('0x173')){_0x5c8c95[_0xd497('0x186')]=_0x5284cd[_0xd497('0xd8')];}else{_0x5c8c95['XMD-CAMPAIGNID']=_0x5284cd[_0xd497('0xd9')];}for(var _0x2638a7 in _0x5284cd[_0xd497('0x16d')]){if(_0x5284cd[_0xd497('0x16d')][_0xd497('0x9b')](_0x2638a7)){if(isNotNull(_0x5284cd[_0xd497('0x16d')][_0x2638a7])&&_0x2638a7!=='id'&&_0x2638a7!=='tags'&&_0x2638a7!==_0xd497('0x187')&&_0x2638a7!==_0xd497('0x188')){_0x5c8c95[util[_0xd497('0x7b')](_0xd497('0x189'),'XMD-',_[_0xd497('0x18a')](_0x2638a7))]=_0x5284cd[_0xd497('0x16d')][_0x2638a7];}}}var _0x2edece=_0x2c8b26['isTrunkReachable'](_0x410793[_0xd497('0x77')])?getCallerId(_0x410793['Trunk'][_0xd497('0x78')],_0x410793[_0xd497('0x18b')],_0x410793[_0xd497('0x18c')]>0x0?getCallerIdRandom(_0x410793['dialOriginateCallerIdNumber'],_0x410793[_0xd497('0x18c')]):_0x410793[_0xd497('0x5c')]):getCallerId(_['isNil'](_0x410793[_0xd497('0x18d')])?_0x410793[_0xd497('0x77')]['callerid']:_0x410793[_0xd497('0x18d')][_0xd497('0x78')],_0x410793['dialOriginateCallerIdName'],_0x410793[_0xd497('0x18c')]>0x0?getCallerIdRandom(_0x410793[_0xd497('0x5c')],_0x410793[_0xd497('0x18c')]):_0x410793['dialOriginateCallerIdNumber']);if(_0x2edece){_0x5c8c95[_0xd497('0x18e')]=_0x2c8b26[_0xd497('0xad')][_0x328fc7][_0xd497('0x18f')]=extractCalleridName(_0x2edece);_0x5c8c95[_0xd497('0x190')]=_0x2c8b26['actions'][_0x328fc7]['originatecalleridnum']=extractCalleridNumber(_0x2edece);}return ami[_0xd497('0xb1')]({'actionid':_0x328fc7,'action':'originate','channel':_0x2c8b26[_0xd497('0xde')](_0x410793[_0xd497('0x77')])?util[_0xd497('0x7b')]('SIP/%s/%s%s',_0x410793[_0xd497('0x77')][_0xd497('0x41')],isNotNull(_0x410793['dialPrefix'])?_0x410793['dialPrefix'][_0xd497('0x191')]()||'':'',_0x410793['dialCutDigit']>0x0?_0x5284cd[_0xd497('0x16d')]['phone'][_0xd497('0x192')](_0x410793[_0xd497('0x193')]):_0x5284cd[_0xd497('0x16d')]['phone']):util[_0xd497('0x7b')](_0xd497('0x194'),_[_0xd497('0xb0')](_0x410793['TrunkBackup'])?_0x410793[_0xd497('0x77')][_0xd497('0x41')]:_0x410793[_0xd497('0x18d')]['name'],isNotNull(_0x410793[_0xd497('0x195')])?_0x410793[_0xd497('0x195')][_0xd497('0x191')]()||'':'',_0x410793[_0xd497('0x193')]>0x0?_0x5284cd[_0xd497('0x16d')][_0xd497('0x16e')][_0xd497('0x192')](_0x410793['dialCutDigit']):_0x5284cd[_0xd497('0x16d')]['phone']),'callerid':_0x2edece,'Exten':_0xd497('0xe6'),'Context':_0xd497('0x196'),'Priority':'1','variable':_0x5c8c95,'timeout':(_0x410793[_0xd497('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x328fc7})['then'](function(_0x493f6d){return _0x4b3e93(_0x493f6d);})['catch'](function(_0xd6760e){_0x410793[_0xd497('0x64')]+=0x1;var _0x520ccf=new History(_0x2c8b26[_0xd497('0xad')][_0x328fc7]);logger[_0xd497('0x98')](util[_0xd497('0x7b')](_0xd497('0x197'),JSON[_0xd497('0x79')](_0xd6760e)));_0x520ccf[_0xd497('0xa8')]=0xe;_0x520ccf[_0xd497('0xa9')]='OriginateError';_0x520ccf[_0xd497('0xab')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));_0x520ccf[_0xd497('0xaa')]=_0x520ccf['starttime'];_0x2c8b26[_0xd497('0xe2')](_0x520ccf)[_0xd497('0xb4')](loggerCatch(_0xd497('0x198')));_0x2c8b26['moveContactManagedDialer'](_0x520ccf)[_0xd497('0xb4')](loggerCatch(_0xd497('0x198')))['finally'](function(){delete _0x2c8b26[_0xd497('0xad')][_0x328fc7];return _0x3ffa9d(msgResponse(_0xd497('0x16b'),_0xd497('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0xd497('0x1b')]['syncOriginateResponse']=function(_0x1a42dd){var _0x5f0cf6=this['actions'][_0x1a42dd['actionid']];var _0x532d66=this;if(_0x5f0cf6){delete this[_0xd497('0xad')][_0x1a42dd['actionid']];_0x5f0cf6[_0xd497('0x11a')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));var _0x1d9741=_0x5f0cf6[_0xd497('0x7e')]===_0xd497('0x7f')?this['campaigns'][_0x5f0cf6['queue']]:this[_0xd497('0x20')][_0x5f0cf6[_0xd497('0x199')]()];if(!this[_0xd497('0xdc')](_0x1a42dd['response'])){this[_0xd497('0xb6')](_0x1d9741);return this[_0xd497('0x19a')](_0x5f0cf6,_0x1d9741,_0x1a42dd)['then'](function(_0x539286){})[_0xd497('0xb4')](loggerCatch(_0xd497('0x19b')));}else{this[_0xd497('0x26')][_0x1a42dd[_0xd497('0xe3')]]=_0x5f0cf6;}}};Dialer[_0xd497('0x1b')][_0xd497('0x19c')]=function(_0x5d8978,_0x3a0106,_0x7ef2c2){var _0x9c6906=new History(_0x3a0106);if(_0x9c6906[_0xd497('0xf2')]+_0x9c6906[_0xd497('0xf3')]+_0x9c6906[_0xd497('0x105')]+_0x9c6906[_0xd497('0xf4')]+_0x9c6906[_0xd497('0xf5')]+_0x9c6906[_0xd497('0xf6')]+_0x9c6906[_0xd497('0xf7')]+_0x9c6906[_0xd497('0xf8')]>=_0x7ef2c2[_0xd497('0xf9')]-0x1){return!![];}switch(_0x5d8978){case 0x3:if(_0x9c6906['countnoanswerretry']>=_0x7ef2c2['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countnoanswerretry':_0x9c6906[_0xd497('0x105')]+=0x1,'scheduledat':moment()['add'](_0x7ef2c2[_0xd497('0x19d')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906['ListId'],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x19e')));}break;case 0x5:if(_0x9c6906[_0xd497('0xf2')]>=_0x7ef2c2[_0xd497('0x19f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x9c6906[_0xd497('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x7ef2c2['dialBusyRetryFrequency'],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906['ListId'],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})['catch'](loggerCatch(_0xd497('0x1a0')));}break;case 0x8:if(_0x9c6906[_0xd497('0xf3')]>=_0x7ef2c2[_0xd497('0x1a1')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countcongestionretry':_0x9c6906[_0xd497('0xf3')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0x1a2')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906['CampaignId']||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1a3')));}break;case 0x0:if(_0x9c6906[_0xd497('0xf4')]>=_0x7ef2c2[_0xd497('0x1a4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x9c6906['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x7ef2c2[_0xd497('0x1a5')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x9c6906[_0xd497('0xf5')]>=_0x7ef2c2[_0xd497('0x1a6')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countdropretry':_0x9c6906[_0xd497('0xf5')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2['dialDropRetryFrequency'],_0xd497('0x107'))['format'](_0xd497('0x100')),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906['CampaignId']||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x11f')));}break;case 0xb:if(_0x9c6906[_0xd497('0xf6')]>=_0x7ef2c2[_0xd497('0x1a7')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countabandonedretry':_0x9c6906[_0xd497('0xf6')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0x126')],'minutes')['format'](_0xd497('0x100')),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906['ListId'],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906['CampaignId']||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x127')));}break;case 0x13:if(_0x9c6906[_0xd497('0xf7')]>=_0x7ef2c2[_0xd497('0xfc')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countmachineretry':_0x9c6906[_0xd497('0xf7')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0xff')],_0xd497('0x107'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x9c6906[_0xd497('0x101')],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906[_0xd497('0xd8')]||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x102')));}break;case 0x14:if(_0x9c6906['countagentrejectretry']>=_0x7ef2c2[_0xd497('0x1a8')]-0x1){return!![];}else{this[_0xd497('0xc3')]({'active':![],'countagentrejectretry':_0x9c6906[_0xd497('0xf8')]+=0x1,'scheduledat':moment()[_0xd497('0xfe')](_0x7ef2c2[_0xd497('0x1a9')],_0xd497('0x107'))[_0xd497('0x7b')](_0xd497('0x100')),'ContactId':_0x9c6906['ContactId'],'ListId':_0x9c6906[_0xd497('0xd6')],'VoiceQueueId':_0x9c6906['VoiceQueueId']||undefined,'CampaignId':_0x9c6906[_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1aa')));}break;default:return!![];}};Dialer[_0xd497('0x1b')][_0xd497('0x19a')]=function(_0x498b27,_0x252ccd,_0x4411ba){var _0x1c439a=this;var _0x499cc3=new History(_0x498b27);return new BPromise(function(_0x426500,_0x38351d){if(_[_0xd497('0x3d')](_0x252ccd)&&_0xd497('0x16a')!==typeof _0x252ccd){return _0x38351d(msgResponse(_0xd497('0x1ab'),_0xd497('0x149'),_0xd497('0x1ac')));}if(_['isUndefined'](_0x4411ba)&&'object'!==typeof _0x4411ba){return _0x38351d(msgResponse('[callProgressDetecting]',_0xd497('0x149'),_0xd497('0x1ad')));}switch(_0x4411ba['reason']){case'0':_0x252ccd[_0xd497('0x63')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x0;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1ae');_0x499cc3[_0xd497('0xf4')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')](_0xd497('0x1af'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1b1')));_0x1c439a['createHistory'](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0xf1')));if(_0x1c439a[_0xd497('0x19c')](0x0,_0x498b27,_0x252ccd)){if(_0x499cc3['countnosuchnumberretry']>=_0x252ccd[_0xd497('0x1a4')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b2'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b2'));}}break;case'3':_0x252ccd[_0xd497('0x62')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x3;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1b3');_0x499cc3[_0xd497('0x105')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')](_0xd497('0x1b4'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1b5')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x1b6')));if(_0x1c439a[_0xd497('0x19c')](0x3,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0x105')]>=_0x252ccd[_0xd497('0x1b7')]){_0x1c439a['createStateFinal'](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b8'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1b8'));}}break;case'5':_0x252ccd[_0xd497('0x1b9')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x5;_0x499cc3['statedesc']=_0xd497('0x1ba');_0x499cc3[_0xd497('0xf2')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')]('custom:agentbusy',ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1bb')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x1bc')));if(_0x1c439a[_0xd497('0x19c')](0x5,_0x498b27,_0x252ccd)){if(_0x499cc3['countbusyretry']>=_0x252ccd['dialBusyMaxRetry']){_0x1c439a['createStateFinal'](_0x499cc3,_0x426500,_0x38351d,'reason\x205\x20busy');}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1bd'));}}break;case'8':_0x252ccd['outboundCongestionCallsDay']+=0x1;_0x499cc3[_0xd497('0xa8')]=0x8;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1be');_0x499cc3[_0xd497('0xf3')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami[_0xd497('0x4d')](_0xd497('0x1bf'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1c0')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x1c1')));if(_0x1c439a['checkRetriveMax'](0x8,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf3')]>=_0x252ccd[_0xd497('0x1a1')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c2'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c2'));}}break;case'11':_0x252ccd[_0xd497('0x1c3')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0xb;_0x499cc3['statedesc']=_0xd497('0x124');_0x499cc3[_0xd497('0xf6')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch(_0xd497('0x128')));if(_0x1c439a['checkRetriveMax'](0xb,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf6')]>=_0x252ccd[_0xd497('0x1a7')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c4'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c4'));}}break;case'20':_0x252ccd[_0xd497('0x66')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0x14;_0x499cc3[_0xd497('0xa9')]=_0xd497('0x1c5');_0x499cc3[_0xd497('0xf8')]+=0x1;_0x499cc3[_0xd497('0xef')]+=0x1;ami['emit'](_0xd497('0x1c6'),ut[_0xd497('0x1b0')](_0x498b27,_0xd497('0x1c7')));_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1c439a[_0xd497('0x19c')](0x14,_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf8')]>=_0x252ccd[_0xd497('0x1a8')]){_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c8'));}else{_0x1c439a[_0xd497('0xfa')](_0x499cc3,_0x426500,_0x38351d,_0xd497('0x1c8'));}}break;default:_0x252ccd[_0xd497('0x67')]+=0x1;_0x499cc3[_0xd497('0xa8')]=0xc;_0x499cc3[_0xd497('0xa9')]=_0x4411ba[_0xd497('0x110')];_0x1c439a[_0xd497('0xe2')](_0x499cc3)[_0xd497('0xb4')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1c439a[_0xd497('0x19c')](_0x4411ba[_0xd497('0x110')],_0x498b27,_0x252ccd)){if(_0x499cc3[_0xd497('0xf2')]+_0x499cc3[_0xd497('0xf3')]+_0x499cc3[_0xd497('0x105')]+_0x499cc3['countnosuchnumberretry']+_0x499cc3[_0xd497('0xf5')]+_0x499cc3[_0xd497('0xf6')]+_0x499cc3[_0xd497('0xf7')]+_0x499cc3[_0xd497('0xf8')]>=_0x252ccd[_0xd497('0xf9')]){_0x1c439a['stateGlobal'](_0x499cc3,_0x426500,_0x38351d,_0x4411ba['reason']);}else{_0x1c439a[_0xd497('0x106')](_0x499cc3,_0x426500,_0x38351d,_0x4411ba[_0xd497('0x110')]);}}}});};Dialer[_0xd497('0x1b')][_0xd497('0xfa')]=function(_0xf0a9f7,_0x526711,_0x2b4c70,_0x1535ad){var _0x5ab60e=new Final(_0xf0a9f7);_0x5ab60e[_0xd497('0xa8')]=0xf;_0x5ab60e['statedesc']=_0xd497('0x1c9');this[_0xd497('0x106')](_0x5ab60e,_0x526711,_0x2b4c70,_0x1535ad);};Dialer[_0xd497('0x1b')][_0xd497('0x106')]=function(_0x370033,_0x58deb2,_0x455223,_0x9ed40a){this[_0xd497('0xcc')](_0x370033)['then'](function(_0x42d0ab){return _0x58deb2(msgResponse(_0xd497('0x1ab'),_0xd497('0xdd'),_0x9ed40a));})[_0xd497('0xb4')](function(_0x5cdbee){return _0x455223(msgResponse(_0xd497('0x1ca'),_0xd497('0x149'),_0xd497('0x1cb')));});};Dialer[_0xd497('0x1b')][_0xd497('0x9')]=function(_0x527f70){var _0x132ae4=this;var _0x28f0c7=_0x527f70[_0xd497('0x1cc')]/0x64;var _0xb4db2e=_0x527f70[_0xd497('0x11c')]/(_0x527f70[_0xd497('0x11c')]+_0x527f70[_0xd497('0xe8')]);var _0x2983a8=Math[_0xd497('0x1cd')](_0x527f70['predictiveIntervalAvailable']*(_0x527f70['predictiveIntervalMaxThreshold']/0x64));var _0x5496d8=Math[_0xd497('0x1cd')](_0x527f70['predictiveIntervalAvailable']*(_0x527f70[_0xd497('0x1ce')]/0x64));var _0x514e10=_0x527f70[_0xd497('0x50')]+_0x527f70['talking'];var _0x5d4da3=Math[_0xd497('0x1cf')](_0x527f70[_0xd497('0x72')]*_0x527f70[_0xd497('0x74')]*_0x527f70['predictiveIntervalHitRate']*_0x527f70['predictiveIntervalMultiplicativeFactor']);if(_[_0xd497('0x3d')](_0x527f70[_0xd497('0x28')])){if(!_[_0xd497('0x3d')](_0x527f70[_0xd497('0x76')])){_0x527f70[_0xd497('0x76')]=undefined;loggerPredictive[_0xd497('0x98')](_0xd497('0x1d0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd497('0x3d')](_0x527f70[_0xd497('0x94')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xd497('0x1d1'));clearInterval(_0x527f70[_0xd497('0x94')]);_0x527f70[_0xd497('0x94')]=undefined;}_0x527f70[_0xd497('0x28')]=moment()[_0xd497('0x7b')](_0xd497('0x100'));loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],_0xd497('0x1d2'),_0x527f70[_0xd497('0x28')]);this[_0xd497('0x158')](_0x527f70,0x1);}else if(ifInterval(_0x527f70[_0xd497('0x1d3')],_0x527f70[_0xd497('0x28')])){this[_0xd497('0x158')](_0x527f70,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x527f70['startProgressive'],_0x527f70[_0xd497('0x41')]);_0x527f70['erlangCalls']=0x0;_0x527f70[_0xd497('0x1d4')]=0x0;}else if(_0x28f0c7<_0xb4db2e&&_0x527f70[_0xd497('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x527f70);loggerPredictive[_0xd497('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0xb4db2e,_0xd497('0x28'),_0x527f70['name']);}else if(_0x5d4da3<_0x527f70['predictiveIntervalErlangCallsDroppedCalls']&&_0x527f70[_0xd497('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x527f70);loggerPredictive['info'](_0xd497('0x1d6'),'Max\x20Drop\x20',_0x5d4da3,_0xd497('0x1d7'),_0x527f70[_0xd497('0x1d4')],'startProgressive',_0x527f70[_0xd497('0x41')]);}else if(!ifInterval(_0x527f70[_0xd497('0x1d3')],_0x527f70[_0xd497('0x28')])&&_[_0xd497('0x3d')](_0x527f70[_0xd497('0x76')])&&!_[_0xd497('0x3d')](_0x527f70[_0xd497('0x28')])){_0x527f70['startPredictive']=moment()[_0xd497('0x7b')](_0xd497('0x100'));loggerPredictive['info'](_0x527f70[_0xd497('0x41')],_0xd497('0x1d8'),_0x527f70[_0xd497('0x76')]);this[_0xd497('0xc1')](_0x527f70['dialPredictiveInterval'])[_0xd497('0xbc')](this['getDataPredictive'](_0x527f70))[_0xd497('0xbc')](mergeDataErlangB(_0x527f70))['then'](this[_0xd497('0x1d9')](_0x527f70))[_0xd497('0xb4')](loggerCatchPredictive(_0xd497('0x1da'),_0x527f70));}else if(!ifInterval(_0x527f70[_0xd497('0x1d3')],_0x527f70[_0xd497('0x76')])){_0x527f70[_0xd497('0x1d4')]=0x0;_0x527f70['startPredictive']=moment()[_0xd497('0x7b')](_0xd497('0x100'));loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],_0xd497('0x1db'),_0x527f70['startPredictive']);clearInterval(_0x527f70[_0xd497('0x94')]);_0x527f70[_0xd497('0x94')]=undefined;this[_0xd497('0xc1')](_0x527f70['dialPredictiveInterval'])[_0xd497('0xbc')](this[_0xd497('0x1dc')](_0x527f70))[_0xd497('0xbc')](mergeDataErlangB(_0x527f70))[_0xd497('0xbc')](this[_0xd497('0x1d9')](_0x527f70))[_0xd497('0xb4')](loggerCatchPredictive(_0xd497('0x1dd'),_0x527f70));}else if(_0x527f70[_0xd497('0x6f')]&&_0x514e10<_0x527f70['predictiveIntervalAvailable']-_0x5496d8){freeVariablesPredictive(_0x527f70);loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x514e10,')\x20are\x20less\x20than\x20threshold\x20(',_0x527f70['predictiveIntervalAvailable'],'-',_0x5496d8,'=',_0x527f70[_0xd497('0x6f')]-_0x5496d8,')');}else if(_0x527f70[_0xd497('0x6f')]&&_0x514e10>_0x527f70['predictiveIntervalAvailable']+_0x2983a8){freeVariablesPredictive(_0x527f70);loggerPredictive[_0xd497('0x82')](_0x527f70[_0xd497('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x514e10,_0xd497('0x1de'),_0x527f70[_0xd497('0x6f')],'+',_0x2983a8,'=',_0x527f70[_0xd497('0x6f')]+_0x2983a8,')');}};Dialer['prototype']['getDataPredictive']=function(_0x5c4c11){var _0x2b3632=this;return function(_0x28aff8){return new BPromise(function(_0x4bb2f7,_0x506abe){_[_0xd497('0xd4')](_0x5c4c11,_0x28aff8[0x0]);if(checkGetDataPredictive(_0x28aff8[0x0])){var _0x136a6a=_0x5c4c11[_0xd497('0x6f')]=_0x5c4c11[_0xd497('0x55')]+_0x5c4c11[_0xd497('0x50')];var _0x413d44=_0x5c4c11[_0xd497('0x1d3')]*0x3c;var _0x18d5da=_0x28aff8[0x0][_0xd497('0x6a')]+_0x28aff8[0x0]['predictiveIntervalAvgHoldtime'];var _0x39405d=(_0x28aff8[0x0][_0xd497('0x68')]+_0x28aff8[0x0][_0xd497('0x6b')]+_0x28aff8[0x0][_0xd497('0x87')])/_0x28aff8[0x0][_0xd497('0x70')];_0x5c4c11[_0xd497('0x6d')]=_0x39405d>0x0?_0x39405d:0x1;switch(_0x5c4c11[_0xd497('0x1d5')]){case'dropRate':var _0x3f5712=_0x5c4c11['dialPredictiveOptimizationPercentage']/0x64;return _0x2b3632[_0xd497('0x1df')](_0x136a6a,_0x413d44,_0x18d5da,_0x39405d,_0x3f5712)['then'](function(_0x2a4c26){return _0x4bb2f7(_0x2a4c26);});case _0xd497('0x1e0'):var _0x50f379=_0x5c4c11[_0xd497('0x1cc')]/0x64;return _0x2b3632[_0xd497('0x1e1')](_0x136a6a,_0x413d44,_0x18d5da,_0x39405d,_0x50f379)[_0xd497('0xbc')](function(_0x13d85a){return _0x4bb2f7(_0x13d85a);});default:return _0x506abe(msgResponse(_0xd497('0x1e2'),'Failure',_0xd497('0x1e3')));}}else{return _0x506abe(msgResponse('[getDataPredictive]',_0xd497('0x149'),_0xd497('0x1e4')));}});};};Dialer[_0xd497('0x1b')][_0xd497('0x1e5')]=function(_0x4d665d){var _0x2bcc16=this;return function(_0x2042fc){return new BPromise(function(_0x479f82,_0x26cd2f){_[_0xd497('0xd4')](_0x4d665d,_0x2042fc[0x0]);if(checkGetDataPredictive(_0x2042fc[0x0])){loggerPredictive[_0xd497('0x82')](JSON[_0xd497('0x79')](_0x2042fc[0x0]));if(_0x4d665d[_0xd497('0x1d5')]===_0xd497('0x1e6')){return _0x2bcc16[_0xd497('0xca')](_0x4d665d['id'])['then'](function(_0x33ca51){var _0xec5fca=_0x4d665d[_0xd497('0x51')]-_0x33ca51[0x0][_0xd497('0x1e7')];var _0x4f2290=_0x4d665d[_0xd497('0x1d3')]*0x3c;var _0x1f5c8b=_0x2042fc[0x0]['predictiveIntervalAvgTalktime']+_0x2042fc[0x0][_0xd497('0x69')];var _0x229c5f=(_0x2042fc[0x0][_0xd497('0x68')]+_0x2042fc[0x0][_0xd497('0x6b')]+_0x2042fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2042fc[0x0]['predictiveIntervalTotalCalls'];var _0x25c414=_0x4d665d[_0xd497('0x1cc')]/0x64;_0x4d665d[_0xd497('0x6e')]=_0x33ca51[0x0][_0xd497('0x1e7')]||0x0;_0x4d665d['predictiveIntervalHitRate']=_0x229c5f>0x0?_0x229c5f:0x1;return _0x2bcc16[_0xd497('0x1df')](_0xec5fca,_0x4f2290,_0x1f5c8b,_0x229c5f,_0x25c414);})[_0xd497('0xbc')](function(_0x225f23){return _0x479f82(_0x225f23);})['catch'](function(_0x49602d){return _0x26cd2f(msgResponse(_0xd497('0x1e8'),_0xd497('0x149'),JSON['stringify'](_0x49602d)));});}if(_0x4d665d[_0xd497('0x1d5')]===_0xd497('0x1e0')){return _0x2bcc16[_0xd497('0xca')](_0x4d665d['id'])['then'](function(_0x26a293){var _0x1a1abd=_0x4d665d[_0xd497('0x51')]-_0x26a293[0x0][_0xd497('0x1e7')];var _0xf87e03=_0x4d665d['dialPredictiveInterval']*0x3c;var _0x1ee77b=_0x2042fc[0x0]['predictiveIntervalAvgTalktime']+_0x2042fc[0x0][_0xd497('0x69')];var _0x16ab8c=(_0x2042fc[0x0][_0xd497('0x68')]+_0x2042fc[0x0][_0xd497('0x6b')]+_0x2042fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2042fc[0x0]['predictiveIntervalTotalCalls'];var _0xbceace=_0x4d665d['dialPredictiveOptimizationPercentage']/0x64;_0x4d665d[_0xd497('0x6e')]=_0x26a293[0x0][_0xd497('0x1e7')]||0x0;_0x4d665d[_0xd497('0x6d')]=_0x16ab8c>0x0?_0x16ab8c:0x1;return _0x2bcc16[_0xd497('0x1e1')](_0x1a1abd,_0xf87e03,_0x1ee77b,_0x16ab8c,_0xbceace);})[_0xd497('0xbc')](function(_0x121ef8){return _0x479f82(_0x121ef8);})[_0xd497('0xb4')](function(_0x1bf2f9){return _0x26cd2f(msgResponse('[CatchErlangB]',_0xd497('0x149'),JSON['stringify'](_0x1bf2f9)));});}}else{return _0x26cd2f(msgResponse(_0xd497('0x1e2'),_0xd497('0x149'),'check\x20failure'));}});};};Dialer[_0xd497('0x1b')][_0xd497('0x1d9')]=function(_0xc7575){var _0x310a6d=this;return function(){var _0xbfab31=0x0;var _0x38fd25=Math[_0xd497('0x1cf')](_0xc7575[_0xd497('0x73')]*0x3e8);if(_0x38fd25>0x0){_0x38fd25=_0x38fd25<0x64?0x64:_0x38fd25;loggerPredictive[_0xd497('0x82')](_0xc7575[_0xd497('0x41')],'one\x20call\x20every:',_0x38fd25,_0xd497('0x4a'));_0xc7575['handlePredictive']=setInterval(function(){_0x310a6d[_0xd497('0x94')](_0xc7575);loggerPredictiveCalls['info']('[handlePredictive]',_0xbfab31+=0x1);},_0x38fd25);}else{loggerPredictive[_0xd497('0x82')](_0xc7575[_0xd497('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xd497('0x1b')][_0xd497('0x1e9')]=function(_0x4e8ff8,_0x185387){var _0x4e13c2=this;return function(_0x3317cd){if(_[_0xd497('0x47')](_0x3317cd)){if(_[_0xd497('0xb0')](_0x185387[_0xd497('0xd7')])||!_0x185387[_0xd497('0x1ea')]){if(_0x4e8ff8[_0xd497('0x5b')]===_0xd497('0x8')){_0x4e8ff8[_0xd497('0x131')]=_['isUndefined'](_0x4e8ff8[_0xd497('0x131')])?!![]:_0x4e8ff8['queueStatusComplete'];var _0x9bd9af=uuid['v4']();_0x4e13c2[_0xd497('0xad')][_0x9bd9af]=new Action(_0x4e8ff8,_0x185387,_0x9bd9af);loggerBooked[_0xd497('0x82')](_0xd497('0x1eb'),_0x9bd9af,_0xd497('0x1ec'),JSON['stringify'](_0x4e8ff8[_0xd497('0x131')]),_0xd497('0x1ed'),_0x4e8ff8['name']);if(_0x4e8ff8['queueStatusComplete']){_0x4e8ff8[_0xd497('0x131')]=![];_0x4e13c2[_0xd497('0x2a')][_0x4e13c2[_0xd497('0xad')][_0x9bd9af]['queue']]=[];ami[_0xd497('0xb1')]({'actionid':_0x9bd9af,'action':'queuestatus','queue':_0x4e8ff8[_0xd497('0x41')]})['catch'](function(_0x51f188){_0x4e13c2['updateOriginated'](_0x4e8ff8);_0x4e13c2[_0xd497('0xc3')]({'active':![],'ContactId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0x101')],'ListId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd6')],'VoiceQueueId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd8')]||undefined,'CampaignId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1ee')));delete _0x4e13c2[_0xd497('0xad')][_0x9bd9af];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xd497('0x79')](_0x4e8ff8[_0xd497('0x131')]),'Queue:\x20',_0x4e8ff8['name']);_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);_0x4e13c2['rescheduleContact']({'active':![],'ContactId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0x101')],'ListId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd6')],'VoiceQueueId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af]['VoiceQueueId']||undefined,'CampaignId':_0x4e13c2[_0xd497('0xad')][_0x9bd9af][_0xd497('0xd9')]||undefined})[_0xd497('0xb4')](loggerCatch(_0xd497('0x1ee')));delete _0x4e13c2[_0xd497('0xad')][_0x9bd9af];}}else{return _0x4e13c2['actionOriginate'](_0x4e8ff8,_0x185387);}}else{if(getDiff(_0x185387['scheduledat'])<_0x4e8ff8[_0xd497('0x1ef')]*0x3c){if(_0x185387['Agent']&&!_0x185387[_0xd497('0x1f0')][_0xd497('0x1f1')]){_0x4e13c2[_0xd497('0x1f')][_0xd497('0x1f2')](_0x185387['id'])[_0xd497('0x1e')](function(){_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);});}else{_0x4e13c2['unlockContact']({'active':![]},_0x185387['id'],0x1)[_0xd497('0x1e')](function(){console[_0xd497('0x1f3')]('Contact\x20updated');_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);});}}else{_0x4e8ff8[_0xd497('0x65')]+=0x1;_0x4e13c2[_0xd497('0xb6')](_0x4e8ff8);if(_0x4e8ff8[_0xd497('0x1f4')]){_0x4e13c2[_0xd497('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x185387[_0xd497('0x101')],'ListId':_0x185387['ListId'],'VoiceQueueId':_0x185387['VoiceQueueId']||undefined,'CampaignId':_0x185387[_0xd497('0xd9')]||undefined})['catch'](loggerCatch(_0xd497('0x1f5')));_0x4e13c2[_0xd497('0xe2')](createObjHistory(_0x4e8ff8,_0x185387,'RECALLINQUEUE',0x17,_0xd497('0x1f6')))[_0xd497('0xb4')](loggerCatch(_0xd497('0x1f7')));}else{_0x4e13c2[_0xd497('0xe1')](createObjHistory(_0x4e8ff8,_0x185387,_0xd497('0x1f8'),0x16,_0xd497('0x1f9')),_0xd497('0x1fa'),_0xd497('0x1fb'));}}}}else{_0x4e8ff8[_0xd497('0x5f')]+=0x1;_0x4e13c2[_0xd497('0xe1')](createObjHistory(_0x4e8ff8,_0x185387,_0xd497('0x1fc'),0xd,_0xd497('0x1fd')),'[Originate][historyBlacklist]',_0xd497('0x1fe'));throw _0xd497('0x1ff');}};};Dialer[_0xd497('0x1b')][_0xd497('0x15d')]=function(_0x249bd0){var _0x4f080e=this;var _0x285a37=[];var _0x2ffae6=_0x249bd0[_0xd497('0x200')]-_0x249bd0[_0xd497('0x71')]-_0x249bd0[_0xd497('0x201')];emitCampaignSummary(_0x249bd0);if(_0x2ffae6>0x0){if(_0x2ffae6>this['maxNumberOriginate']){_0x2ffae6=this[_0xd497('0x24')];}_0x249bd0[_0xd497('0x201')]+=_0x2ffae6;this[_0xd497('0xc9')](_0x249bd0['id'],_0x2ffae6,_0x249bd0['dialOrderByScheduledAt'])[_0xd497('0xbc')](function(_0x2459f7){_0x249bd0[_0xd497('0x201')]-=_0x2ffae6;_0x249bd0['temp']=_0x249bd0[_0xd497('0x201')]>0x0?_0x249bd0[_0xd497('0x201')]:0x0;if(!checkContactEmpty(_0x2459f7)){_0x249bd0[_0xd497('0x3e')]=_0xd497('0xa0');logger[_0xd497('0x82')]('[getContactCampaign2][Empty]'+_0x249bd0[_0xd497('0x41')]);}else{_0x249bd0[_0xd497('0x71')]+=_0x2459f7[_0xd497('0x9a')];_0x249bd0['message']='RUNNING';for(var _0xb80f5a=0x0;_0xb80f5a<_0x2459f7[_0xd497('0x9a')];_0xb80f5a+=0x1){_0x249bd0[_0xd497('0x202')]+=0x1;if(_[_0xd497('0xb0')](_0x2459f7[_0xb80f5a])||_['isNil'](_0x2459f7[_0xb80f5a][_0xd497('0x16d')])||_['isNil'](_0x2459f7[_0xb80f5a][_0xd497('0x16d')][_0xd497('0x16e')])){_0x4f080e[_0xd497('0xd2')](_0xd497('0x203'),_0x249bd0,_0x2459f7[_0xb80f5a]);}else{_0x4f080e[_0xd497('0xbf')](_[_0xd497('0xd5')](_0x2459f7[_0xb80f5a],['CampaignId','Contact.phone']))['then'](_0x4f080e[_0xd497('0x1e9')](_0x249bd0,_0x2459f7[_0xb80f5a]))[_0xd497('0xb4')](_0x4f080e[_0xd497('0xd1')](_0xd497('0x204'),_0x249bd0));}}}})['catch'](loggerGetContactDialer(_0xd497('0x205'),_0x249bd0,_0x2ffae6));}};Dialer[_0xd497('0x1b')][_0xd497('0x158')]=function(_0x23e45e,_0xd08ffb){var _0x4db406=this;var _0x22a736=[];var _0x1f1e28=_0xd08ffb>=0x1?_0xd08ffb:0x1;var _0x22df3a=[];if(_0x23e45e[_0xd497('0x5b')]===_0xd497('0x8')){_0x1f1e28=0x1;}var _0x297986=Math[_0xd497('0x1cf')](_0x23e45e[_0xd497('0x50')]*_0x1f1e28)-_0x23e45e[_0xd497('0x71')]-_0x23e45e[_0xd497('0x201')];emitVoiceQueueSummary(_0x23e45e);if(_0x23e45e[_0xd497('0x206')]>0x0){var _0x2b7112=_0x23e45e['dialLimitQueue']-_0x23e45e[_0xd497('0x71')]-_0x23e45e[_0xd497('0x55')]-_0x23e45e[_0xd497('0x201')]-_0x23e45e[_0xd497('0x52')];if(_0x297986>_0x2b7112){_0x297986=_0x2b7112;}}if(_0x297986>0x0){if(_0x23e45e[_0xd497('0x5b')]==='booked'){_0x297986=0x1;}if(_0x297986>this[_0xd497('0x24')]){_0x297986=this[_0xd497('0x24')];}_0x23e45e[_0xd497('0x201')]+=_0x297986;for(var _0x377559 in this[_0xd497('0x22')]){if(this[_0xd497('0x22')][_0xd497('0x9b')](_0x377559)){if(this[_0xd497('0x22')][_0x377559][_0xd497('0xa8')]===_0xd497('0x207')&&this[_0xd497('0x22')][_0x377559][_0xd497('0xb2')]==='reachable'){_0x22a736[_0xd497('0x12f')](this[_0xd497('0x22')][_0x377559]['id']);}}}this['getContactDialer'](_0x23e45e['id'],_0x22a736,_0x297986,_0x23e45e[_0xd497('0x208')])[_0xd497('0xbc')](function(_0x2f069b){_0x23e45e['temp']-=_0x297986;_0x23e45e[_0xd497('0x201')]=_0x23e45e[_0xd497('0x201')]>0x0?_0x23e45e['temp']:0x0;if(!checkContactEmpty(_0x2f069b)){_0x4db406[_0xd497('0xba')](_0x23e45e)[_0xd497('0xbc')](sendMessageReschedule(_0x23e45e))[_0xd497('0xb4')](loggerCatch(_0xd497('0xbd')));}else{_0x23e45e[_0xd497('0x71')]+=_0x2f069b[_0xd497('0x9a')];_0x23e45e[_0xd497('0x3e')]=_0x23e45e[_0xd497('0x5b')]==='booked'?'ACTIVE':_0xd497('0x209');for(var _0x2499af=0x0;_0x2499af<_0x2f069b['length'];_0x2499af+=0x1){if(_[_0xd497('0xb0')](_0x2f069b[_0x2499af])||_[_0xd497('0xb0')](_0x2f069b[_0x2499af][_0xd497('0x16d')])||_[_0xd497('0xb0')](_0x2f069b[_0x2499af][_0xd497('0x16d')]['phone'])){_0x4db406[_0xd497('0xd2')](_0xd497('0x203'),_0x23e45e,_0x2f069b[_0x2499af]);}else{_0x4db406[_0xd497('0xbe')](_['pick'](_0x2f069b[_0x2499af],[_0xd497('0xd8'),_0xd497('0x20a')]))[_0xd497('0xbc')](_0x4db406['checkContactBlack'](_0x23e45e,_0x2f069b[_0x2499af]))[_0xd497('0xb4')](_0x4db406['loggerHandler'](_0xd497('0x203'),_0x23e45e));}}}})['catch'](loggerGetContactDialer(_0xd497('0x20b'),_0x23e45e,_0x297986));}};Dialer[_0xd497('0x1b')][_0xd497('0x94')]=function(_0x171eb5){var _0x5c4971=this;if(_0x171eb5[_0xd497('0x206')]>0x0){var _0x4cc5e=_0x171eb5['dialLimitQueue']-_0x171eb5[_0xd497('0x71')]-_0x171eb5[_0xd497('0x55')];if(_0x4cc5e>0x0){this[_0xd497('0x20c')](_0x171eb5);}else{loggerPredictiveCalls['info'](_0xd497('0x20d'));}}else{this[_0xd497('0x20c')](_0x171eb5);}};Dialer[_0xd497('0x1b')][_0xd497('0x20c')]=function(_0x1aea57){var _0x833c2f=this;var _0x492057=[];_0x1aea57[_0xd497('0x71')]+=0x1;for(var _0x219a4b in this[_0xd497('0x22')]){if(this[_0xd497('0x22')]['hasOwnProperty'](_0x219a4b)){if(this[_0xd497('0x22')][_0x219a4b]['state']===_0xd497('0x207')&&this['agents'][_0x219a4b]['status']===_0xd497('0x20e')){_0x492057[_0xd497('0x12f')](this['agents'][_0x219a4b]['id']);}}}this[_0xd497('0xc7')](_0x1aea57['id'],_0x492057,0x1,_0x1aea57[_0xd497('0x208')])[_0xd497('0xbc')](function(_0x138d0a){if(!checkContactEmpty(_0x138d0a)){checkContactLowerLimitOriginate(_0x1aea57,0x1,0x0);_0x833c2f[_0xd497('0xba')](_0x1aea57)[_0xd497('0xbc')](sendMessageReschedule(_0x1aea57))[_0xd497('0xb4')](loggerCatch(_0xd497('0xbd')));}else{_0x1aea57['message']=_0xd497('0x209');if(_[_0xd497('0xb0')](_0x138d0a[0x0])||_[_0xd497('0xb0')](_0x138d0a[0x0][_0xd497('0x16d')])||_['isNil'](_0x138d0a[0x0][_0xd497('0x16d')][_0xd497('0x16e')])){_0x833c2f[_0xd497('0xd2')](_0xd497('0x203'),_0x1aea57,_0x138d0a[0x0]);}else{_0x833c2f[_0xd497('0xbe')](_['pick'](_0x138d0a[0x0],[_0xd497('0xd8'),'Contact.phone']))[_0xd497('0xbc')](_0x833c2f[_0xd497('0x1e9')](_0x1aea57,_0x138d0a[0x0]))['catch'](_0x833c2f['loggerHandler'](_0xd497('0x20f'),_0x1aea57));}}})[_0xd497('0xb4')](loggerGetContactDialer(_0xd497('0x210'),_0x1aea57,0x1));emitVoiceQueueSummary(_0x1aea57);};Dialer[_0xd497('0x1b')][_0xd497('0x1df')]=function(_0x326cbb,_0x2fb4d7,_0x123283,_0x351576,_0x807670,_0x43b14b){loggerPredictive['info'](_0xd497('0x211'));loggerPredictive['info'](_0xd497('0x212'),_0x326cbb);loggerPredictive[_0xd497('0x82')](_0xd497('0x213'),_0x2fb4d7);loggerPredictive[_0xd497('0x82')](_0xd497('0x214'),_0x123283);loggerPredictive[_0xd497('0x82')](_0xd497('0x215'),_0x351576);loggerPredictive[_0xd497('0x82')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x807670);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x54ca88,_0x5d0ca5){if(_0x326cbb<=0x0||isNaN(_0x326cbb)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),'Error','m\x20=\x20'+_0x326cbb));}if(_0x123283<=0x0||isNaN(_0x123283)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),_0xd497('0x49'),'Ts\x20=\x20'+_0x123283));}if(_0x351576<=0x0||isNaN(_0x351576)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),_0xd497('0x49'),_0xd497('0x217')+_0x351576));}if(_0x2fb4d7<=0x0||isNaN(_0x2fb4d7)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),_0xd497('0x49'),'interval\x20=\x20'+_0x2fb4d7));}if(_0x807670<=0x0||isNaN(_0x807670)){return _0x5d0ca5(msgResponse(_0xd497('0x216'),'Error',_0xd497('0x218')+_0x807670));}_0x43b14b=_0x43b14b||0x0;var _0x4f4bcf=0x1/_0x123283;var _0x331f63=0x0;var _0x1c5078=0x0;var _0x1b9ebc=0x0;var _0x5a8def=0x0;for(var _0x296b2d=0x0;_0x1b9ebc<_0x807670;_0x296b2d+=0x1){_0x1c5078=_0x296b2d/_0x2fb4d7;_0x331f63=(_0x351576*_0x1c5078+_0x43b14b)/_0x4f4bcf;_0x1b9ebc=erlangb(_0x331f63,_0x326cbb);_0x5a8def=_0x331f63/_0x326cbb*(0x1-erlangb(_0x331f63,_0x326cbb));}return _0x54ca88({'erlangCalls':_0x296b2d,'erlangCallToSecond':_0x2fb4d7/_0x296b2d,'erlangAbandonmentRate':_0x1b9ebc,'erlangBusyFactor':_0x5a8def});});};Dialer['prototype'][_0xd497('0x1e1')]=function(_0x25e7cd,_0x2cfef2,_0x1c8e96,_0x55a80d,_0x37beae,_0x29e7fa){loggerPredictive[_0xd497('0x82')](_0xd497('0x219'));loggerPredictive[_0xd497('0x82')](_0xd497('0x212'),_0x25e7cd);loggerPredictive[_0xd497('0x82')](_0xd497('0x213'),_0x2cfef2);loggerPredictive[_0xd497('0x82')](_0xd497('0x214'),_0x1c8e96);loggerPredictive[_0xd497('0x82')](_0xd497('0x215'),_0x55a80d);loggerPredictive[_0xd497('0x82')](_0xd497('0x21a'),_0x37beae);loggerPredictive[_0xd497('0x82')](_0xd497('0x21b'));return new BPromise(function(_0x33541a,_0x5f237e){if(_0x25e7cd<=0x0||isNaN(_0x25e7cd)){return _0x5f237e(msgResponse('[busyFactor]','Error',_0xd497('0x21c')+_0x25e7cd));}if(_0x1c8e96<=0x0||isNaN(_0x1c8e96)){return _0x5f237e(msgResponse(_0xd497('0x21d'),'Error',_0xd497('0x21e')+_0x1c8e96));}if(_0x55a80d<=0x0||isNaN(_0x55a80d)){return _0x5f237e(msgResponse(_0xd497('0x21d'),_0xd497('0x49'),'p\x20=\x20'+_0x55a80d));}if(_0x2cfef2<=0x0||isNaN(_0x2cfef2)){return _0x5f237e(msgResponse(_0xd497('0x21d'),_0xd497('0x49'),'interval\x20=\x20'+_0x2cfef2));}if(_0x37beae<=0x0||isNaN(_0x37beae)){return _0x5f237e(msgResponse(_0xd497('0x21d'),_0xd497('0x49'),_0xd497('0x21f')+_0x37beae));}_0x29e7fa=_0x29e7fa||0x0;var _0x37756c=0x1/_0x1c8e96;var _0x58081a=0x0;var _0x42eb93=0x0;var _0x129ca3=0x0;var _0x3471f9=0x0;for(var _0x2d4cdd=0x0;_0x3471f9<_0x37beae;_0x2d4cdd+=0x1){_0x42eb93=_0x2d4cdd/_0x2cfef2;_0x58081a=(_0x55a80d*_0x42eb93+_0x29e7fa)/_0x37756c;_0x129ca3=erlangb(_0x58081a,_0x25e7cd);_0x3471f9=_0x58081a/_0x25e7cd*(0x1-erlangb(_0x58081a,_0x25e7cd));}return _0x33541a({'erlangCalls':_0x2d4cdd,'erlangCallToSecond':_0x2cfef2/_0x2d4cdd,'erlangAbandonmentRate':_0x129ca3,'erlangBusyFactor':_0x3471f9});});};module[_0xd497('0x220')]=Dialer; \ No newline at end of file +var _0x1322=['NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','loggerHandler','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','voice:queue:%s','voice_queue:save','ivr','format','-----\x20Stats\x20Predictive\x20---','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','enqueue','isNil','Action','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','reachable','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerCallsDay','countnoanswerretry','reason\x2019\x20machine....','syncHangup','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','syncNewExten','actionid','locked','paused','stateinterface','push','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','command','iftime\x20%s,%s','interval','indexOf','true','timezones','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Failure','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....'];(function(_0x292b74,_0x431bf1){var _0x33490d=function(_0xbbcc38){while(--_0xbbcc38){_0x292b74['push'](_0x292b74['shift']());}};_0x33490d(++_0x431bf1);}(_0x1322,0x72));var _0x2132=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1322[_0x40220a];return _0x3903cc;};'use strict';var util=require(_0x2132('0x0'));var _=require('lodash');var BPromise=require(_0x2132('0x1'));var uuid=require(_0x2132('0x2'));var moment=require(_0x2132('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x2132('0x4'));var ut=require(_0x2132('0x5'));var config=require(_0x2132('0x6'));var logger=require(_0x2132('0x7'))('dialer');var loggerBooked=require(_0x2132('0x7'))('booked');var loggerPredictive=require(_0x2132('0x7'))(_0x2132('0x8'));var loggerPredictiveCalls=require(_0x2132('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x2132('0x9'));var ami=require(_0x2132('0xa'));config[_0x2132('0xb')]=_[_0x2132('0xc')](config[_0x2132('0xb')],{'host':_0x2132('0xd'),'port':0x18eb});var io=require(_0x2132('0xe'))(new Redis(config[_0x2132('0xb')]));var cmHopper=require(_0x2132('0xf'));var cmHopperFinal=require(_0x2132('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2132('0x11'));var voiceQueueRt=require(_0x2132('0x12'));var Action=require(_0x2132('0x13'));var History=require(_0x2132('0x14'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x2132('0x15'));var Hangup=require(_0x2132('0x16'));var ipAgi=process[_0x2132('0x17')][_0x2132('0x18')]||_0x2132('0x19');var strategy={'rrmemory':_0x2132('0x1a'),'roundrobin':_0x2132('0x1b')};var Sequence=function(){};Sequence[_0x2132('0x1c')]['enqueue']=function(_0x5b8a6b){this[_0x2132('0x1d')]=this[_0x2132('0x1d')]?this[_0x2132('0x1d')][_0x2132('0x1e')](_0x5b8a6b):_0x5b8a6b();};function Dialer(_0x519ee8,_0x40fff4){this['sequence']=new Sequence();this[_0x2132('0x1f')]=_0x40fff4;this[_0x2132('0x20')]=_0x519ee8[_0x2132('0x20')];this['campaigns']=_0x519ee8[_0x2132('0x21')];this[_0x2132('0x22')]=_0x519ee8[_0x2132('0x22')];this[_0x2132('0x23')]=_0x519ee8[_0x2132('0x23')];this[_0x2132('0x24')]=config['maxNumberOriginate']||0x2;this[_0x2132('0x25')]={};this['actions']={};this['contactsId']={};this[_0x2132('0x26')]={};this[_0x2132('0x27')]={};this[_0x2132('0x28')]={};this[_0x2132('0x29')]={};this[_0x2132('0x2a')]={};this[_0x2132('0x2b')]={};this[_0x2132('0x2c')]={};ami['on'](_0x2132('0x2d'),this['syncAgentConnect'][_0x2132('0x2e')](this));ami['on']('queuecallerabandon',this[_0x2132('0x2f')]['bind'](this));ami['on'](_0x2132('0x30'),this[_0x2132('0x31')]['bind'](this));ami['on'](_0x2132('0x32'),this[_0x2132('0x33')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x2132('0x2e')](this));ami['on'](_0x2132('0x34'),this['syncHangup'][_0x2132('0x2e')](this));ami['on'](_0x2132('0x35'),this['syncNewExten']['bind'](this));ami['on'](_0x2132('0x36'),this[_0x2132('0x37')][_0x2132('0x2e')](this));ami['on']('queuemember',this[_0x2132('0x38')]['bind'](this));ami['on'](_0x2132('0x39'),this[_0x2132('0x3a')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x38b7e0){return _0x38b7e0!==null&&!_[_0x2132('0x3b')](_0x38b7e0);}function checkIsLoggedIn(_0x7f35b4,_0x53da8f){return function(){if(_0x53da8f<=0x0){_0x7f35b4[_0x2132('0x3c')]=_0x2132('0x3d');throw _0x7f35b4[_0x2132('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x5b0ad8){return _0x5b0ad8;}function checkIsActive(_0x188935,_0xee0f22){return function(){if(!isActive(_0xee0f22)){_0x188935[_0x2132('0x3c')]=_0x2132('0x3f');throw _0x188935['name']+_0x2132('0x40');}};}function checkInterval(_0x4a0ade){return function(){if(!isNotNull(_0x4a0ade[_0x2132('0x41')])){_0x4a0ade[_0x2132('0x3c')]=_0x2132('0x42');throw _0x4a0ade[_0x2132('0x3e')]+_0x2132('0x43');}if(!isNotNull(_0x4a0ade[_0x2132('0x41')][_0x2132('0x44')])){_0x4a0ade[_0x2132('0x3c')]=_0x2132('0x42');throw _0x4a0ade['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x2132('0x45')](_0x4a0ade[_0x2132('0x41')]['Intervals']))){_0x4a0ade[_0x2132('0x3c')]='INTERVAL_IS_NULL';throw _0x4a0ade[_0x2132('0x3e')]+_0x2132('0x43');}};}function msgResponse(_0x2a3cd2,_0x3c28f4,_0xa5ab09){return{'action':_0x2a3cd2,'response':_0x3c28f4,'message':_0xa5ab09,'stack':_0xa5ab09};}function myreject(_0x1f0599){return function(_0x3506c5){return _0x1f0599(msgResponse(_0x2132('0x46'),_0x2132('0x47'),JSON[_0x2132('0x48')](_0x3506c5)));};}function getSeconds(_0x486459,_0x51c4f1){var _0x3dbf81=moment(_0x486459)[_0x2132('0x49')](0x0);var _0x6a3e24=moment(_0x51c4f1)['milliseconds'](0x0);return _0x3dbf81[_0x2132('0x4a')](_0x6a3e24,'seconds');}function emit(_0x295f77,_0x318a29,_0x5780a9){io['to'](_0x295f77)[_0x2132('0x4b')](_0x318a29,_0x5780a9);}function emitVoiceQueueSummary(_0x57b0c2){if(_0x57b0c2[_0x2132('0x4c')]==='outbound'){var _0x45477f={'id':_0x57b0c2['id'],'name':_0x57b0c2['name'],'strategy':_0x57b0c2[_0x2132('0x4d')],'answered':_0x57b0c2['answered'],'available':_0x57b0c2['available'],'loggedIn':_0x57b0c2[_0x2132('0x4e')],'pTalking':_0x57b0c2[_0x2132('0x4f')],'sumBillable':_0x57b0c2[_0x2132('0x50')],'sumDuration':_0x57b0c2[_0x2132('0x51')],'sumHoldTime':_0x57b0c2[_0x2132('0x52')]||0x0,'talking':_0x57b0c2[_0x2132('0x53')],'total':_0x57b0c2['total'],'type':_0x57b0c2[_0x2132('0x4c')],'unmanaged':_0x57b0c2[_0x2132('0x54')],'abandoned':_0x57b0c2['abandoned'],'waiting':_0x57b0c2[_0x2132('0x55')],'loggedInDb':_0x57b0c2['loggedInDb'],'dialActive':_0x57b0c2[_0x2132('0x56')],'dialMethod':_0x57b0c2[_0x2132('0x57')],'dialOriginateCallerIdName':_0x57b0c2[_0x2132('0x58')],'dialOriginateCallerIdNumber':_0x57b0c2[_0x2132('0x59')],'dialOriginateTimeout':_0x57b0c2[_0x2132('0x5a')],'dialPrefix':_0x57b0c2[_0x2132('0x5b')],'outboundAnswerAgiCallsDay':_0x57b0c2['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x57b0c2['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x57b0c2[_0x2132('0x5c')],'outboundBusyCallsDay':_0x57b0c2[_0x2132('0x5d')],'outboundCongestionCallsDay':_0x57b0c2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x57b0c2[_0x2132('0x5e')],'outboundDropCallsDayCallersExit':_0x57b0c2[_0x2132('0x5f')],'outboundDropCallsDayTimeout':_0x57b0c2[_0x2132('0x60')],'outboundNoAnswerCallsDay':_0x57b0c2[_0x2132('0x61')],'outboundNoSuchCallsDay':_0x57b0c2[_0x2132('0x62')],'outboundOriginateFailureCallsDay':_0x57b0c2[_0x2132('0x63')],'outboundReCallsDay':_0x57b0c2[_0x2132('0x64')],'outboundRejectCallsDay':_0x57b0c2[_0x2132('0x65')],'outboundUnknownCallsDay':_0x57b0c2['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x57b0c2[_0x2132('0x66')],'predictiveIntervalAvgHoldtime':_0x57b0c2[_0x2132('0x67')],'predictiveIntervalAvgTalktime':_0x57b0c2[_0x2132('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x57b0c2[_0x2132('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x57b0c2[_0x2132('0x6a')],'predictiveIntervalErlangCalls':_0x57b0c2[_0x2132('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x57b0c2[_0x2132('0x6c')],'predictiveIntervalHitRate':_0x57b0c2[_0x2132('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x57b0c2[_0x2132('0x6e')],'predictiveIntervalPauses':_0x57b0c2[_0x2132('0x6f')],'predictiveIntervalAvailable':_0x57b0c2[_0x2132('0x70')],'predictiveIntervalTotalCalls':_0x57b0c2[_0x2132('0x71')],'message':_0x57b0c2[_0x2132('0x3c')],'originated':_0x57b0c2[_0x2132('0x72')],'erlangCalls':_0x57b0c2['erlangCalls'],'erlangCallToSecond':_0x57b0c2[_0x2132('0x73')],'erlangAbandonmentRate':_0x57b0c2[_0x2132('0x74')],'erlangBusyFactor':_0x57b0c2[_0x2132('0x75')],'startPredictive':_0x57b0c2['startPredictive'],'startProgressive':_0x57b0c2[_0x2132('0x29')]};if(_0x57b0c2['Trunk']){_0x45477f['Trunk']={'id':_0x57b0c2['Trunk']['id'],'name':_0x57b0c2[_0x2132('0x76')][_0x2132('0x3e')],'active':_0x57b0c2['Trunk']['active'],'callerid':_0x57b0c2[_0x2132('0x76')][_0x2132('0x77')]};}if(_0x57b0c2[_0x2132('0x41')]){_0x45477f['Interval']={'id':_0x57b0c2[_0x2132('0x41')]['id'],'name':_0x57b0c2[_0x2132('0x41')][_0x2132('0x3e')]};}var _0x2c8e8e=md5(JSON['stringify'](_0x45477f));if(_0x57b0c2[_0x2132('0x78')]!==_0x2c8e8e){_0x57b0c2[_0x2132('0x78')]=_0x2c8e8e;emit(util['format'](_0x2132('0x79'),_0x45477f[_0x2132('0x3e')]),_0x2132('0x7a'),_0x45477f);}}}function emitCampaignSummary(_0x1ee572){if(_0x1ee572[_0x2132('0x4c')]===_0x2132('0x7b')){emit(util[_0x2132('0x7c')]('campaign:ivr:%s',_0x1ee572[_0x2132('0x3e')]),'campaign:save',_0x1ee572);}}function checkGetDataPredictive(_0x3a89f7){if(isNotNull(_0x3a89f7)){if(!_[_0x2132('0x45')](_0x3a89f7)){loggerPredictive['info'](_0x2132('0x7d'));loggerPredictive[_0x2132('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x71')]);loggerPredictive[_0x2132('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x66')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x6a')]);loggerPredictive[_0x2132('0x7e')](_0x2132('0x7f'),_0x3a89f7['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a89f7[_0x2132('0x67')]);loggerPredictive[_0x2132('0x7e')](_0x2132('0x80'),_0x3a89f7[_0x2132('0x68')]);loggerPredictive[_0x2132('0x7e')]('---------------------------');if(_0x3a89f7['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2132('0x3b')](_0x3a89f7['predictiveIntervalAvgTalktime'])&&_0x3a89f7[_0x2132('0x68')]>0x0){return!![];}else{loggerPredictive[_0x2132('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x2132('0x3b')](_0x3a89f7['predictiveIntervalAvgHoldtime'])&&_0x3a89f7[_0x2132('0x67')]>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2132('0x7e')](_0x2132('0x81'));}}else{loggerPredictive[_0x2132('0x7e')]('History\x20information\x20are\x20empty');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x310cc1){return function(_0x3d725b){loggerPredictive[_0x2132('0x7e')](_0x2132('0x82'));loggerPredictive[_0x2132('0x7e')](_0x2132('0x83'),_0x3d725b['erlangCalls']);loggerPredictive['info'](_0x2132('0x84'),_0x3d725b[_0x2132('0x73')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d725b[_0x2132('0x74')]);loggerPredictive['info'](_0x2132('0x85'),_0x3d725b[_0x2132('0x75')]);loggerPredictive[_0x2132('0x7e')](_0x2132('0x86'),_0x3d725b[_0x2132('0x74')]);loggerPredictive['info']('---------------------------');_[_0x2132('0x87')](_0x310cc1,_0x3d725b);};}function getDiff(_0x3b41b6){var _0x1497e7=moment()['milliseconds'](0x0);var _0xfacd59=moment(_0x3b41b6)[_0x2132('0x49')](0x0);return _0x1497e7[_0x2132('0x4a')](_0xfacd59,'seconds');}function ifInterval(_0x8ad88e,_0x1d4199){if(_[_0x2132('0x3b')](_0x1d4199)){return![];}if(getDiff(_0x1d4199)<_0x8ad88e*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3bd555){if(isNotNull(_0x3bd555)){if(!_[_0x2132('0x3b')](_0x3bd555['startProgressive'])){_0x3bd555[_0x2132('0x29')]=undefined;loggerPredictive[_0x2132('0x7e')](_0x3bd555[_0x2132('0x3e')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3bd555[_0x2132('0x28')])){_0x3bd555[_0x2132('0x28')]=undefined;loggerPredictive['info'](_0x3bd555[_0x2132('0x3e')],_0x2132('0x88'));}if(!_[_0x2132('0x3b')](_0x3bd555[_0x2132('0x89')])){clearInterval(_0x3bd555[_0x2132('0x89')]);_0x3bd555[_0x2132('0x89')]=undefined;loggerPredictive[_0x2132('0x7e')](_0x3bd555[_0x2132('0x3e')],_0x2132('0x8a'));}}}function erlangb(_0x4bdcae,_0x28ac0f){if(_0x28ac0f===0x0){return 0x0;}var _0x1da9e0=0x1;for(var _0x585092=0x1;_0x585092<=_0x28ac0f;_0x585092+=0x1){_0x1da9e0=0x1+_0x1da9e0*_0x585092/_0x4bdcae;}return 0x1/_0x1da9e0;}function isVoiceQueueOutbound(_0x47a37a){return _0x47a37a===_0x2132('0x8b');}function isNotPreview(_0x220afa){return _0x220afa!==_0x2132('0x1f');}function isCampaignIvr(_0x34d538){return _0x34d538==='ivr';}function getCallerId(_0x444605,_0x3b53bf,_0x4e4a0c){if(!_[_0x2132('0x3b')](_0x4e4a0c)&&'string'===typeof _0x4e4a0c&&!_['isEmpty'](_0x4e4a0c)){if(!_[_0x2132('0x3b')](_0x3b53bf)&&_0x2132('0x8c')===typeof _0x3b53bf&&!_['isEmpty'](_0x3b53bf)){return util[_0x2132('0x7c')](_0x2132('0x8d'),_0x3b53bf,_0x4e4a0c);}return util[_0x2132('0x7c')](_0x2132('0x8d'),_0x4e4a0c,_0x4e4a0c);}if(!_[_0x2132('0x3b')](_0x444605)&&_0x2132('0x8c')===typeof _0x444605&&!_['isEmpty'](_0x444605)){return _0x444605;}return _0x2132('0x8e');}function loggerCatchQueueSummary(_0xa80375,_0x387b69){return function(_0x5a2f1a){freeVariablesPredictive(_0x387b69);emitVoiceQueueSummary(_0x387b69);emitCampaignSummary(_0x387b69);loggerSyncQueueSummary['error'](_0xa80375,util[_0x2132('0x8f')](_0x5a2f1a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x439d07,_0x5afc26){return function(_0x1bb661){loggerPredictive[_0x2132('0x90')](_0x5afc26[_0x2132('0x3e')],_0x439d07);loggerPredictive[_0x2132('0x90')](_0x1bb661[_0x2132('0x91')]);freeVariablesPredictive(_0x5afc26);};}function loggerCatch(_0x14d73b){return function(_0x32ef87){logger['error'](_0x14d73b,util['inspect'](_0x32ef87,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3b52d){return _0x3b52d&&!_[_0x2132('0x3b')](_0x3b52d)&&_0x3b52d[_0x2132('0x92')]>0x0;}function decremetOriginate(_0x305935){if(!_['isUndefined'](_0x305935)&&_0x305935!==null){if(_0x305935[_0x2132('0x93')](_0x2132('0x72'))){if(_0x305935['originated']>0x0){_0x305935[_0x2132('0x72')]-=0x1;}else{logger[_0x2132('0x90')](_0x2132('0x94'));}}}else{logger[_0x2132('0x90')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2de5d4,_0x3cd683,_0x16bff1){if(_0x3cd683>_0x16bff1){for(var _0x160ffc=0x0;_0x160ffc<_0x3cd683-_0x16bff1;_0x160ffc+=0x1){decremetOriginate(_0x2de5d4);}}}function loggerGetContactDialer(_0x5b601a,_0x2382b5,_0x414edb){return function(_0xdb26d5){checkContactLowerLimitOriginate(_0x2382b5,_0x414edb,0x0);logger[_0x2132('0x90')](_0x5b601a,util[_0x2132('0x8f')](_0xdb26d5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1b710e){return function(_0x5a27a6){if(isNotNull(_0x5a27a6)&&isNotNull(_0x5a27a6[0x0])){if(_0x5a27a6[0x0]['contactsRescheduled']>0x0){_0x1b710e[_0x2132('0x3c')]=_0x2132('0x95');logger[_0x2132('0x7e')](_0x2132('0x96')+_0x1b710e[_0x2132('0x3e')],_0x5a27a6[0x0][_0x2132('0x97')],_0x2132('0x98'));}else{_0x1b710e['message']=_0x2132('0x99');logger[_0x2132('0x7e')]('[getContactDialer2][Empty]'+_0x1b710e[_0x2132('0x3e')]);}}};}function notSendMessagesQueue(_0x2b8073){if(_0x2b8073[_0x2132('0x9a')]){freeVariablesPredictive(_0x2b8073);if(_0x2b8073[_0x2132('0x72')]===0x0&&_0x2b8073[_0x2132('0x53')]===0x0&&_0x2b8073['waiting']===0x0&&(_0x2b8073[_0x2132('0x4f')]||0x0)===0x0){_0x2b8073[_0x2132('0x9a')]=![];_0x2b8073[_0x2132('0x9b')]=0x0;_0x2b8073[_0x2132('0x3c')]=_0x2132('0x3f');loggerSyncQueueSummary[_0x2132('0x90')](_0x2132('0x9c'),_0x2b8073[_0x2132('0x3e')],'is\x20not\x20active');}else{_0x2b8073[_0x2132('0x3c')]=_0x2132('0x9d');loggerSyncQueueSummary[_0x2132('0x90')](_0x2132('0x9c'),_0x2b8073[_0x2132('0x3e')],_0x2132('0x9e'));}emitVoiceQueueSummary(_0x2b8073);}}function notSendMessagesCampaign(_0xd9f47f){if(_0xd9f47f[_0x2132('0x9a')]){if(_0xd9f47f['originated']===0x0){_0xd9f47f[_0x2132('0x9a')]=![];_0xd9f47f[_0x2132('0x3c')]=_0x2132('0x3f');loggerSyncQueueSummary['error'](_0x2132('0x9f'),_0xd9f47f[_0x2132('0x3e')],_0x2132('0xa0'));}else{_0xd9f47f[_0x2132('0x3c')]=_0x2132('0x9d');loggerSyncQueueSummary[_0x2132('0x90')](_0x2132('0x9f'),_0xd9f47f[_0x2132('0x3e')],_0x2132('0x9e'));}emitCampaignSummary(_0xd9f47f);}}function createObjHistory(_0x3f815e,_0x44dcda,_0x4e5aa3,_0xbeb47,_0x21d835){_0x3f815e[_0x2132('0x3c')]=_0x4e5aa3;var _0x23f810=new Action(_0x3f815e,_0x44dcda);var _0x128c0e=new History(_0x23f810);_0x128c0e[_0x2132('0xa1')]=_0xbeb47;_0x128c0e[_0x2132('0xa2')]=_0x21d835;_0x128c0e[_0x2132('0xa3')]=_0x23f810[_0x2132('0xa4')];return _0x128c0e;}Dialer[_0x2132('0x1c')][_0x2132('0xa5')]=function(){var _0x11e9c8=this;setInterval(function(){_0x11e9c8[_0x2132('0xa6')](_0x11e9c8[_0x2132('0x26')],_0x2132('0xa7'));_0x11e9c8['clearZombieChannels'](_0x11e9c8[_0x2132('0xa8')],_0x2132('0xa9'));},0x32c8);};Dialer['prototype'][_0x2132('0xa6')]=function(_0x49f658,_0x2489ab){var _0x2afdec=this;for(var _0x6d8989 in _0x49f658){if(_0x49f658[_0x2132('0x93')](_0x6d8989)){this[_0x2132('0xaa')][_0x2132('0xab')](function(){if(!_[_0x2132('0xac')](_0x49f658[_0x6d8989])){return ami[_0x2132('0xad')]({'action':'status','channel':_0x49f658[_0x6d8989][_0x2132('0xae')]})[_0x2132('0xaf')](function(_0x4f4a18){if(_0x4f4a18['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x49f658[_0x6d8989]&&_0x49f658[_0x6d8989][_0x2132('0x4c')]!==_0x2132('0x7b')){_0x2afdec[_0x2132('0xb0')](_0x2afdec['voiceQueues'][_0x49f658[_0x6d8989][_0x2132('0xb1')]]);logger['error']('[Dialer][checkChannel]',_0x2489ab,_0x6d8989,_0x49f658[_0x6d8989][_0x2132('0xb1')]);delete _0x49f658[_0x6d8989];}if(_0x49f658[_0x6d8989]&&_0x49f658[_0x6d8989]['type']===_0x2132('0x7b')){_0x2afdec[_0x2132('0xb0')](_0x2afdec[_0x2132('0x21')][_0x49f658[_0x6d8989][_0x2132('0xb1')]]);logger[_0x2132('0x90')](_0x2132('0xb2'),_0x2489ab,_0x6d8989,_0x49f658[_0x6d8989][_0x2132('0xb1')]);delete _0x49f658[_0x6d8989];}},0x2328);}});}});}}};Dialer[_0x2132('0x1c')][_0x2132('0xb3')]=function(_0x32b3d7){return BPromise['resolve']()['then'](cmHopper[_0x2132('0xb3')](_0x32b3d7))[_0x2132('0xaf')](loggerCatch(_0x2132('0xb4')));};Dialer[_0x2132('0x1c')][_0x2132('0xb5')]=function(_0x4eaf9c){return BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](cmHopperBlack['checkIsBlackList'](_0x4eaf9c))[_0x2132('0xaf')](loggerCatch(_0x2132('0xb8')));};Dialer[_0x2132('0x1c')][_0x2132('0xb9')]=function(_0x2462a4){return BPromise[_0x2132('0xb6')]()['then'](cmHopperBlack[_0x2132('0xb9')](_0x2462a4))[_0x2132('0xaf')](loggerCatch(_0x2132('0xba')));};Dialer[_0x2132('0x1c')]['averageHandleTime']=function(_0x5cdc6f){return BPromise['resolve']()[_0x2132('0xb7')](cmHopperHistory[_0x2132('0xbb')](_0x5cdc6f))[_0x2132('0xaf')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x2132('0x1c')][_0x2132('0xbc')]=function(_0x17b261){return BPromise[_0x2132('0xb6')]()['then'](cmHopper[_0x2132('0xbc')](_0x17b261))[_0x2132('0xaf')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x2132('0x1c')][_0x2132('0xbd')]=function(_0x2b9599,_0x39eb34,_0x24034b){return BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](cmHopper[_0x2132('0xbd')](_0x2b9599,_0x39eb34,_0x24034b))[_0x2132('0xaf')](loggerCatch(_0x2132('0xbe')));};Dialer[_0x2132('0x1c')][_0x2132('0xbf')]=function(_0x497cee,_0x157704,_0x392064,_0xf8b373){return BPromise[_0x2132('0xb6')]()['then'](cmHopper['getContactDialer'](_0x497cee,_0x157704,_0x392064,_0xf8b373))[_0x2132('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x2132('0x1c')]['getContactDialerIvr']=function(_0x7c4961,_0x16e1d6,_0x13355f){return BPromise[_0x2132('0xb6')]()['then'](cmHopper[_0x2132('0xc0')](_0x7c4961,_0x16e1d6,_0x13355f))[_0x2132('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x13d16b){return BPromise[_0x2132('0xb6')]()['then'](voiceQueueRt[_0x2132('0xc1')](_0x13d16b))[_0x2132('0xaf')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2132('0x1c')][_0x2132('0xc2')]=function(_0xbe8c0a){return BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](cmHopper[_0x2132('0xc2')](_0xbe8c0a))[_0x2132('0xaf')](loggerCatch(_0x2132('0xc3')));};Dialer['prototype'][_0x2132('0xc4')]=function(_0x290811){return BPromise['resolve']()[_0x2132('0xb7')](cmHopperHistory[_0x2132('0xc4')](_0x290811))[_0x2132('0xaf')](loggerCatch(_0x2132('0xc5')));};Dialer[_0x2132('0x1c')][_0x2132('0xb0')]=function(_0x29ddc0){if(!_[_0x2132('0x3b')](_0x29ddc0)&&_0x29ddc0!==null){if(_0x29ddc0['hasOwnProperty'](_0x2132('0x72'))){if(_0x29ddc0['originated']>0x0){_0x29ddc0[_0x2132('0x72')]-=0x1;}else{logger[_0x2132('0x90')](_0x2132('0xc6'));}}}else{logger[_0x2132('0x90')](_0x2132('0xc7'));}};Dialer[_0x2132('0x1c')]['loggerHandler']=function(_0x291e68,_0x2cfb92){var _0x1c267a=this;return function(_0x148a24){_0x1c267a[_0x2132('0xb0')](_0x2cfb92);logger[_0x2132('0x90')](_0x291e68,util[_0x2132('0x8f')](_0x148a24,{'showHidden':![],'depth':null}));};};Dialer[_0x2132('0x1c')][_0x2132('0xc8')]=function(_0x5b55f6,_0x5789d2,_0x36925c){var _0x1592f2={'state':0x19,'statedesc':_0x2132('0xc9')};this[_0x2132('0xb0')](_0x5789d2);this['saveInDb'](_[_0x2132('0x87')](_0x1592f2,_[_0x2132('0xca')](_0x36925c,[_0x2132('0xcb'),_0x2132('0xcc'),_0x2132('0xcd'),_0x2132('0xce'),'CampaignId'])),_0x2132('0xcf'),_0x2132('0xd0'));logger['error'](_0x5b55f6);};Dialer[_0x2132('0x1c')][_0x2132('0xd1')]=function(_0x1ee1ee){return _0x1ee1ee===_0x2132('0xd2');};Dialer['prototype'][_0x2132('0xd3')]=function(_0x2e5bf5){return!_['isUndefined'](_0x2e5bf5)&&_0x2e5bf5&&!_[_0x2132('0x3b')](_0x2e5bf5[_0x2132('0x3e')])&&!_[_0x2132('0x3b')](_0x2e5bf5[_0x2132('0xd4')])&&_0x2e5bf5[_0x2132('0xd4')]&&(this[_0x2132('0x23')][util[_0x2132('0x7c')](_0x2132('0xd5'),_0x2e5bf5['name'])][_0x2132('0xd6')]===_0x2132('0xd7')||this[_0x2132('0x23')][util[_0x2132('0x7c')](_0x2132('0xd5'),_0x2e5bf5[_0x2132('0x3e')])][_0x2132('0xd6')]==='unmonitored');};Dialer[_0x2132('0x1c')][_0x2132('0xd8')]=function(_0x3ed506,_0x209b76,_0x4f8656){this[_0x2132('0xc4')](_0x3ed506)[_0x2132('0xaf')](loggerCatch(_0x209b76));this[_0x2132('0xc2')](_0x3ed506)[_0x2132('0xaf')](loggerCatch(_0x4f8656));};Dialer[_0x2132('0x1c')][_0x2132('0x37')]=function(_0x38ae77){var _0x256f59=this[_0x2132('0x26')][_0x38ae77[_0x2132('0xd9')]];var _0x255ce3;if(!_['isNil'](_0x38ae77)&&!_[_0x2132('0xac')](_0x38ae77[_0x2132('0xda')])&&!_['isNil'](_0x38ae77[_0x2132('0xda')][_0x2132('0xdb')])&&_0x38ae77[_0x2132('0xdc')]===_0x2132('0xdd')&&_0x256f59){if(_0x256f59[_0x2132('0x4c')]!==_0x2132('0x7b')&&this[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]==='HANGUP'){delete this['uniqueId'][_0x38ae77[_0x2132('0xd9')]];this[_0x2132('0xb0')](this['voiceQueues'][_0x256f59['queue']]);this['voiceQueues'][_0x256f59[_0x2132('0xb1')]]['outboundAnswerCallsDay']+=0x1;this[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;_0x255ce3=new Hangup(_0x256f59,_0x38ae77);_0x255ce3['state']=0x12;_0x255ce3['statedesc']=_0x2132('0xe1');_0x255ce3[_0x2132('0xe2')]=_0x2132('0xe3');this[_0x2132('0xd8')](_0x255ce3,_0x2132('0xe4'),_0x2132('0xe5'));}if(_0x256f59[_0x2132('0x4c')]!=='ivr'&&this[_0x2132('0x20')][_0x256f59['queue']][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]===_0x2132('0xe6')){var _0x15d3c1=this;return new BPromise(function(_0x447876,_0xdd2d68){delete _0x15d3c1[_0x2132('0x26')][_0x38ae77['uniqueid']];_0x15d3c1['updateOriginated'](_0x15d3c1['voiceQueues'][_0x256f59[_0x2132('0xb1')]]);_0x15d3c1[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x15d3c1[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;var _0x592fb0=_0x15d3c1[_0x2132('0x20')][_0x256f59[_0x2132('0xb1')]];var _0x38227e=new Hangup(_0x256f59,_0x38ae77);_0x38227e[_0x2132('0xa1')]=0x13;_0x38227e['statedesc']='Machine';_0x38227e[_0x2132('0xe2')]=_0x2132('0xe3');_0x38227e[_0x2132('0xe7')]+=0x1;_0x38227e[_0x2132('0xe8')]+=0x1;_0x38227e[_0x2132('0xe9')]=!![];_0x15d3c1['createHistory'](_0x38227e)[_0x2132('0xaf')](loggerCatch(_0x2132('0xea')));if(_0x38227e[_0x2132('0xeb')]+_0x38227e[_0x2132('0xec')]+_0x38227e['countnoanswerretry']+_0x38227e[_0x2132('0xed')]+_0x38227e[_0x2132('0xee')]+_0x38227e[_0x2132('0xef')]+_0x38227e[_0x2132('0xe7')]+_0x38227e[_0x2132('0xf0')]>=_0x592fb0[_0x2132('0xf1')]){_0x15d3c1[_0x2132('0xf2')](_0x38227e,_0x447876,_0xdd2d68,_0x2132('0xf3'));}else{if(_0x38227e[_0x2132('0xe7')]>=_0x592fb0[_0x2132('0xf4')]){_0x15d3c1[_0x2132('0xf5')](_0x38227e,_0x447876,_0xdd2d68,'reason\x2019\x20machine....');}else{_0x15d3c1[_0x2132('0xbc')]({'active':![],'countmachineretry':_0x38227e[_0x2132('0xe7')],'scheduledat':moment()[_0x2132('0xf6')](_0x592fb0[_0x2132('0xf7')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x38227e['ContactId'],'ListId':_0x38227e[_0x2132('0xcc')],'VoiceQueueId':_0x38227e[_0x2132('0xce')]||undefined,'CampaignId':_0x38227e['CampaignId']||undefined})[_0x2132('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0x447876({'reschedule':0x1});}}});}if(_0x256f59[_0x2132('0x4c')]===_0x2132('0x7b')&&this[_0x2132('0x21')][_0x256f59['queue']][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]==='HANGUP'){delete this[_0x2132('0x26')][_0x38ae77[_0x2132('0xd9')]];this[_0x2132('0xb0')](this[_0x2132('0x21')][_0x256f59[_0x2132('0xb1')]]);_0x255ce3=new Hangup(_0x256f59,_0x38ae77);_0x255ce3['state']=0x12;_0x255ce3[_0x2132('0xa2')]=_0x2132('0xe1');_0x255ce3[_0x2132('0xe2')]=_0x2132('0xe3');this[_0x2132('0xd8')](_0x255ce3,_0x2132('0xfa'),_0x2132('0xfb'));}if(_0x256f59[_0x2132('0x4c')]===_0x2132('0x7b')&&this[_0x2132('0x21')][_0x256f59['queue']][_0x2132('0xde')]&&_0x38ae77[_0x2132('0xdf')]===_0x2132('0xe6')){var _0x15d3c1=this;return new BPromise(function(_0xf599e1,_0x40e5fb){delete _0x15d3c1[_0x2132('0x26')][_0x38ae77[_0x2132('0xd9')]];_0x15d3c1[_0x2132('0xb0')](_0x15d3c1[_0x2132('0x21')][_0x256f59[_0x2132('0xb1')]]);_0x15d3c1[_0x2132('0x21')][_0x256f59['queue']][_0x2132('0xfc')]+=0x1;_0x15d3c1[_0x2132('0x21')][_0x256f59[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;var _0x5cbb1d=_0x15d3c1[_0x2132('0x21')][_0x256f59['queue']];var _0x235ba1=new Hangup(_0x256f59,_0x38ae77);_0x235ba1[_0x2132('0xa1')]=0x13;_0x235ba1[_0x2132('0xa2')]='Machine';_0x235ba1[_0x2132('0xe2')]=_0x2132('0xe3');_0x235ba1['countmachineretry']+=0x1;_0x235ba1[_0x2132('0xe8')]+=0x1;_0x235ba1[_0x2132('0xe9')]=!![];_0x15d3c1[_0x2132('0xc4')](_0x235ba1)[_0x2132('0xaf')](loggerCatch(_0x2132('0xea')));if(_0x235ba1[_0x2132('0xeb')]+_0x235ba1[_0x2132('0xec')]+_0x235ba1[_0x2132('0xfd')]+_0x235ba1[_0x2132('0xed')]+_0x235ba1[_0x2132('0xee')]+_0x235ba1[_0x2132('0xef')]+_0x235ba1[_0x2132('0xe7')]+_0x235ba1[_0x2132('0xf0')]>=_0x5cbb1d[_0x2132('0xf1')]){_0x15d3c1[_0x2132('0xf2')](_0x235ba1,_0xf599e1,_0x40e5fb,_0x2132('0xf3'));}else{if(_0x235ba1[_0x2132('0xe7')]>=_0x5cbb1d['dialMachineMaxRetry']){_0x15d3c1['createStateFinal'](_0x235ba1,_0xf599e1,_0x40e5fb,_0x2132('0xfe'));}else{_0x15d3c1['rescheduleContact']({'active':![],'countmachineretry':_0x235ba1['countmachineretry'],'scheduledat':moment()[_0x2132('0xf6')](_0x5cbb1d[_0x2132('0xf7')],_0x2132('0xf8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x235ba1[_0x2132('0xcb')],'ListId':_0x235ba1[_0x2132('0xcc')],'VoiceQueueId':_0x235ba1[_0x2132('0xce')]||undefined,'CampaignId':_0x235ba1['CampaignId']||undefined})[_0x2132('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0xf599e1({'reschedule':0x1});}}});}}};Dialer[_0x2132('0x1c')][_0x2132('0xff')]=function(_0x33e9df){var _0xc4d798=this[_0x2132('0x26')][_0x33e9df[_0x2132('0xd9')]];var _0x5cfc96=this;var _0x1a73b4;if(_0xc4d798&&_0xc4d798['type']===_0x2132('0x7b')){delete this['uniqueId'][_0x33e9df[_0x2132('0xd9')]];this['updateOriginated'](this[_0x2132('0x21')][_0xc4d798['queue']]);this[_0x2132('0x21')][_0xc4d798['queue']]['ivrAnswerCallsDay']+=0x1;_0x1a73b4=new Hangup(_0xc4d798,_0x33e9df);this[_0x2132('0xc4')](_0x1a73b4)[_0x2132('0xaf')](loggerCatch(_0x2132('0x100')));this[_0x2132('0xc2')](_0x1a73b4)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xc4d798&&_0xc4d798['type']!==_0x2132('0x7b')&&isNotNull(this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]][_0x2132('0x101')])){delete this[_0x2132('0x26')][_0x33e9df[_0x2132('0xd9')]];this['updateOriginated'](this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]]);this['voiceQueues'][_0xc4d798[_0x2132('0xb1')]][_0x2132('0xfc')]+=0x1;this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]][_0x2132('0xe0')]+=0x1;_0x1a73b4=new Hangup(_0xc4d798,_0x33e9df);_0x1a73b4[_0x2132('0xa1')]=0x10;_0x1a73b4[_0x2132('0xa2')]=_0x2132('0x102');_0x1a73b4['membername']=_0x2132('0x103');this[_0x2132('0xc4')](_0x1a73b4)['catch'](loggerCatch(_0x2132('0x100')));this[_0x2132('0xc2')](_0x1a73b4)[_0x2132('0xaf')](loggerCatch(_0x2132('0x104')));}if(_0xc4d798&&_0xc4d798[_0x2132('0x4c')]!==_0x2132('0x7b')&&!isNotNull(this[_0x2132('0x20')][_0xc4d798['queue']]['dialQueueProject'])){delete this[_0x2132('0x26')][_0x33e9df[_0x2132('0xd9')]];this[_0x2132('0xb0')](this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]]);this[_0x2132('0x20')][_0xc4d798[_0x2132('0xb1')]]['outboundUnknownCallsDay']+=0x1;_0x1a73b4=new Hangup(_0xc4d798,_0x33e9df);_0x1a73b4[_0x2132('0xa1')]=0xc;_0x1a73b4['statedesc']=_0x33e9df[_0x2132('0x105')];_0x1a73b4[_0x2132('0xe2')]=_0x2132('0x106');this['createHistory'](_0x1a73b4)['catch'](loggerCatch(_0x2132('0x100')));this['moveContactManagedDialer'](_0x1a73b4)['catch'](loggerCatch(_0x2132('0x104')));}};Dialer[_0x2132('0x1c')][_0x2132('0x33')]=function(_0x1882f8){var _0x191eb1=this['uniqueId'][_0x1882f8[_0x2132('0xd9')]];var _0x177842=this;if(this[_0x2132('0x20')][_0x1882f8['queue']]){if(_0x191eb1&&_0x191eb1[_0x2132('0x4c')]!==_0x2132('0x7b')){delete this['uniqueId'][_0x1882f8[_0x2132('0xd9')]];this[_0x2132('0x20')][_0x1882f8[_0x2132('0xb1')]][_0x2132('0xfc')]+=0x1;var _0x5f2cad=new AgentComplete(_0x191eb1,_0x1882f8);if(_0x1882f8[_0x2132('0x107')]==='agent'){_0x5f2cad[_0x2132('0x108')]=this[_0x2132('0x20')][_0x1882f8[_0x2132('0xb1')]][_0x2132('0x109')]&&this[_0x2132('0x20')][_0x1882f8[_0x2132('0xb1')]][_0x2132('0x10a')]?moment()[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2132('0xc4')](_0x5f2cad)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2132('0xc2')](_0x5f2cad)[_0x2132('0xaf')](loggerCatch(_0x2132('0x10b')));}}};Dialer[_0x2132('0x1c')][_0x2132('0x10c')]=function(_0x3f5a51){if(this[_0x2132('0x20')][_0x3f5a51[_0x2132('0xb1')]]){if(this[_0x2132('0x26')][_0x3f5a51[_0x2132('0xd9')]]&&this[_0x2132('0x26')][_0x3f5a51[_0x2132('0xd9')]][_0x2132('0x4c')]!==_0x2132('0x7b')){this['updateOriginated'](this[_0x2132('0x20')][_0x3f5a51[_0x2132('0xb1')]]);this[_0x2132('0x26')][_0x3f5a51[_0x2132('0xd9')]][_0x2132('0x10d')]=moment()[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x2132('0x1c')][_0x2132('0x10e')]=function(_0x1be001){this[_0x2132('0xc4')](_0x1be001)[_0x2132('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1be001)['catch'](loggerCatch(_0x2132('0x10f')));};Dialer['prototype'][_0x2132('0x2f')]=function(_0x13270c){var _0x2b6381=this[_0x2132('0x26')][_0x13270c[_0x2132('0xd9')]];var _0x3dcfc1=this;if(this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]]){if(_0x2b6381&&_0x2b6381['type']!==_0x2132('0x7b')){delete this['uniqueId'][_0x13270c[_0x2132('0xd9')]];this[_0x2132('0xb0')](this[_0x2132('0x20')][_0x13270c['queue']]);_0x2b6381[_0x2132('0x110')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4ed68c=new QueueCallerAbandon(_0x2b6381,_0x13270c);if(getSeconds(_0x2b6381[_0x2132('0x110')],_0x2b6381[_0x2132('0x111')])>=_0x2b6381[_0x2132('0x112')]){this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]][_0x2132('0x60')]+=0x1;this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x6c')]+=0x1;_0x4ed68c[_0x2132('0xa1')]=0xa;_0x4ed68c[_0x2132('0xa2')]=_0x2132('0x113');_0x4ed68c[_0x2132('0x114')]=_0x2132('0x115');_0x4ed68c[_0x2132('0x108')]=this[_0x2132('0x20')][_0x13270c[_0x2132('0xb1')]][_0x2132('0x109')]?moment()[_0x2132('0x7c')](_0x2132('0xf9')):undefined;_0x4ed68c['countdropretry']+=0x1;_0x4ed68c[_0x2132('0xe8')]+=0x1;if(_0x4ed68c[_0x2132('0xee')]>=this[_0x2132('0x20')][_0x13270c['queue']][_0x2132('0x116')]){this[_0x2132('0x10e')](_0x4ed68c);}else{this[_0x2132('0xbc')]({'active':![],'countdropretry':_0x4ed68c[_0x2132('0xee')],'scheduledat':moment()[_0x2132('0xf6')](this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x117')],'minutes')[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x2b6381[_0x2132('0xcb')],'ListId':_0x2b6381[_0x2132('0xcc')],'VoiceQueueId':_0x2b6381['VoiceQueueId']||undefined,'CampaignId':_0x2b6381['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3dbfdb=new History(_0x4ed68c);_0x3dbfdb['state']=0xa;_0x3dbfdb[_0x2132('0xa2')]='Drop';_0x3dbfdb[_0x2132('0xa4')]=moment()[_0x2132('0x7c')](_0x2132('0xf9'));_0x3dbfdb[_0x2132('0xa3')]=_0x3dbfdb[_0x2132('0xa4')];_0x3dbfdb[_0x2132('0x118')]=_0x4ed68c[_0x2132('0x118')];_0x3dbfdb[_0x2132('0x119')]=_0x4ed68c[_0x2132('0x119')];this[_0x2132('0xc4')](_0x3dbfdb)[_0x2132('0xaf')](loggerCatch(_0x2132('0x11a')));}}else{this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x69')]+=0x1;this['voiceQueues'][_0x13270c[_0x2132('0xb1')]][_0x2132('0x5f')]+=0x1;_0x4ed68c['state']=0xb;_0x4ed68c[_0x2132('0xa2')]=_0x2132('0x11b');_0x4ed68c[_0x2132('0x114')]=_0x2132('0x11c');_0x4ed68c['countabandonedretry']+=0x1;_0x4ed68c[_0x2132('0xe8')]+=0x1;if(_0x4ed68c[_0x2132('0xef')]>=this[_0x2132('0x20')][_0x13270c['queue']][_0x2132('0x11d')]){this[_0x2132('0x10e')](_0x4ed68c);}else{this[_0x2132('0xbc')]({'active':![],'countabandonedretry':_0x4ed68c[_0x2132('0xef')],'scheduledat':moment()['add'](this[_0x2132('0x20')][_0x13270c['queue']]['dialAbandonedRetryFrequency'],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x2b6381['ContactId'],'ListId':_0x2b6381[_0x2132('0xcc')],'VoiceQueueId':_0x2b6381['VoiceQueueId']||undefined,'CampaignId':_0x2b6381[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x11f')));var _0x3dbfdb=new History(_0x4ed68c);_0x3dbfdb[_0x2132('0xa1')]=0xb;_0x3dbfdb[_0x2132('0xa2')]='Abandoned';_0x3dbfdb['starttime']=moment()['format'](_0x2132('0xf9'));_0x3dbfdb['endtime']=_0x3dbfdb[_0x2132('0xa4')];_0x3dbfdb[_0x2132('0x118')]=_0x4ed68c['calleridname'];_0x3dbfdb[_0x2132('0x119')]=_0x4ed68c[_0x2132('0x119')];this[_0x2132('0xc4')](_0x3dbfdb)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x2132('0x1c')][_0x2132('0x120')]=function(_0x3b8ef2){if(this['actions'][_0x3b8ef2[_0x2132('0xd9')]]){this[_0x2132('0xa8')][_0x3b8ef2['uniqueid']][_0x2132('0xae')]=_0x3b8ef2[_0x2132('0xae')];}if(this['uniqueId'][_0x3b8ef2[_0x2132('0xd9')]]){this[_0x2132('0x26')][_0x3b8ef2[_0x2132('0xd9')]][_0x2132('0xae')]=_0x3b8ef2[_0x2132('0xae')];}};Dialer[_0x2132('0x1c')][_0x2132('0x38')]=function(_0x4d385d){if(strategy[this['voiceQueues'][this['actions'][_0x4d385d[_0x2132('0x121')]]['queue']][_0x2132('0x4d')]]===_0x2132('0x1b')){if(this['actions'][_0x4d385d[_0x2132('0x121')]]&&_[_0x2132('0xac')](this['actions'][_0x4d385d['actionid']][_0x2132('0x122')])&&_0x4d385d[_0x2132('0xd6')]==='1'&&_0x4d385d[_0x2132('0x123')]==='0'){if(this['agents'][_0x4d385d['stateinterface']]){if(!this[_0x2132('0x22')][_0x4d385d['stateinterface']][_0x2132('0x122')]){this[_0x2132('0x22')][_0x4d385d[_0x2132('0x124')]]['locked']=!![];this[_0x2132('0xa8')][_0x4d385d[_0x2132('0x121')]]['locked']=!![];this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0x124')]=_0x4d385d[_0x2132('0x124')];}}}}else if((strategy[this[_0x2132('0x20')][this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0xb1')]][_0x2132('0x4d')]]||'rrmemory')===_0x2132('0x1a')){if(this['actions'][_0x4d385d[_0x2132('0x121')]]){if(this[_0x2132('0x22')][_0x4d385d[_0x2132('0x124')]]){this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0x124')]=_0x4d385d[_0x2132('0x124')];if(_['isNil'](this['queueBooked'][this['actions'][_0x4d385d[_0x2132('0x121')]][_0x2132('0xb1')]])){this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x4d385d['actionid']]['queue']]=[];}this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x4d385d['actionid']][_0x2132('0xb1')]][_0x2132('0x125')](_[_0x2132('0x87')](_[_0x2132('0xca')](this[_0x2132('0xa8')][_0x4d385d[_0x2132('0x121')]],['idHopper',_0x2132('0x124')]),{'status':_0x4d385d[_0x2132('0xd6')],'paused':_0x4d385d[_0x2132('0x123')]}));}}}};function unlockQueueStatus(_0x250d72,_0x5cb00d){setTimeout(function(){if(_[_0x2132('0x3b')](_0x250d72['queueStatusComplete'])){loggerBooked[_0x2132('0x90')]('[unlockQueueStatus][undefined]',_0x5cb00d);}_0x250d72[_0x2132('0x126')]=!![];loggerBooked[_0x2132('0x7e')](_0x2132('0x127'),_0x5cb00d,JSON[_0x2132('0x48')](_[_0x2132('0xca')](_0x250d72,['name',_0x2132('0x126')])));},0x1f3);}Dialer[_0x2132('0x1c')][_0x2132('0x3a')]=function(_0x2485c1){var _0x3b816d=this;var _0x22ae72=_0x3b816d[_0x2132('0x20')][_0x3b816d[_0x2132('0xa8')][_0x2485c1['actionid']][_0x2132('0xb1')]];if(strategy[this[_0x2132('0x20')][this['actions'][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]][_0x2132('0x4d')]]===_0x2132('0x1b')){if(this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]&&this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0x124')]){this['preview'][_0x2132('0x128')](this['actions'][_0x2485c1[_0x2132('0x121')]][_0x2132('0x129')],this[_0x2132('0xa8')][_0x2485c1['actionid']][_0x2132('0x124')])['catch'](function(_0x39eb48){logger[_0x2132('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x39eb48,{'showHidden':![],'depth':null}));})[_0x2132('0x1e')](function(){_0x3b816d[_0x2132('0xb0')](_0x3b816d[_0x2132('0x20')][_0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]['queue']]);_0x3b816d['agents'][_0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0x124')]][_0x2132('0x122')]=![];delete _0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]];unlockQueueStatus(_0x22ae72);});}else{this[_0x2132('0xb0')](this[_0x2132('0x20')][this['actions'][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]]);this[_0x2132('0xbc')]({'active':![],'ContactId':this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xcb')],'ListId':this['actions'][_0x2485c1[_0x2132('0x121')]]['ListId'],'VoiceQueueId':this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xce')]||undefined,'CampaignId':this['actions'][_0x2485c1['actionid']][_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x12a')));delete this[_0x2132('0xa8')][_0x2485c1['actionid']];unlockQueueStatus(_0x22ae72);}}else if((strategy[this['voiceQueues'][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]]['strategy']]||_0x2132('0x1a'))==='rrmemory'){var _0x31b848;if(this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]&&!_['isEmpty'](this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]])){if(this[_0x2132('0x2c')][_0x3b816d[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]['queue']]){this['queueBookedRR'][_0x3b816d[_0x2132('0xa8')][_0x2485c1['actionid']][_0x2132('0xb1')]]=this['queueBookedRR'][this['actions'][_0x2485c1[_0x2132('0x121')]]['queue']]?this[_0x2132('0x2c')][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]]['queue']]:this[_0x2132('0x2b')][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]]?this[_0x2132('0x2b')][this['actions'][_0x2485c1['actionid']]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x2132('0xa8')][_0x2485c1[_0x2132('0x121')]][_0x2132('0xb1')]][_0x2132('0x12b')]=this[_0x2132('0x2c')][this['actions'][_0x2485c1['actionid']][_0x2132('0xb1')]];for(var _0x33d77c=0x0;_0x33d77c=0x0?!![]:![];})[_0x2132('0xaf')](myreject(_0x2978bd)));}}else{_0x2a66d3['push'](ami[_0x2132('0xad')]({'action':'command','command':util[_0x2132('0x7c')](_0x2132('0x141'),_0x188d3b,!_['isUndefined'](config[_0x2132('0x145')][_0x46f034])?_0x46f034:'')})[_0x2132('0xb7')](function(_0x2c89f2){return _0x2c89f2[_0x2132('0x146')]['indexOf'](_0x2132('0x144'))>=0x0?!![]:![];})[_0x2132('0xaf')](myreject(_0x2978bd)));}BPromise[_0x2132('0x147')](_0x2a66d3)['then'](function(_0x479589){var _0x39e1a5=_[_0x2132('0x148')](_0x479589);if(_0x39e1a5){return _0x1a0cdf(_0x39e1a5);}else{_0x3192aa[_0x2132('0x3c')]=_0x3033a5?_0x2132('0x149'):'INTERVAL_IS_OVERTIME';return _0x2978bd(msgResponse(_0x2132('0x14a'),_0x2132('0x14b'),_0x2132('0x14c')+_0x3033a5+'\x20'+_0x36c33c+_0x2132('0x14d')+util['inspect'](_0x188d3b,{'showHidden':![],'depth':null})+_0x2132('0x14e')+_0x46f034));}})[_0x2132('0xaf')](function(_0x9c82cc){return _0x2978bd(msgResponse(_0x2132('0x13c'),_0x2132('0x14b'),JSON['stringify'](_0x9c82cc)));});});};Dialer[_0x2132('0x1c')][_0x2132('0x14f')]=function(_0x3be92d){var _0x19c5a3=this;return function(){switch(_0x3be92d['dialMethod']){case _0x2132('0x150'):freeVariablesPredictive(_0x3be92d);_0x19c5a3[_0x2132('0x151')](_0x3be92d,0x1);break;case _0x2132('0x152'):freeVariablesPredictive(_0x3be92d);_0x19c5a3[_0x2132('0x151')](_0x3be92d,_0x3be92d['dialPowerLevel']);break;case _0x2132('0x8'):_0x19c5a3['predictive'](_0x3be92d);break;case _0x2132('0x153'):freeVariablesPredictive(_0x3be92d);_0x19c5a3[_0x2132('0x151')](_0x3be92d,0x1);break;default:freeVariablesPredictive(_0x3be92d);logger['error'](_0x2132('0x154'),_0x3be92d[_0x2132('0x3e')],_0x2132('0x155'));}};};Dialer[_0x2132('0x1c')][_0x2132('0x156')]=function(_0x55b34){var _0x2c1e48=this;return function(){_0x2c1e48[_0x2132('0x157')](_0x55b34);};};Dialer['prototype'][_0x2132('0x9')]=function(_0x2b3166){var _0x461071=this;if(isNotPreview(_0x2b3166[_0x2132('0x57')])){if(isVoiceQueueOutbound(_0x2b3166[_0x2132('0x4c')])&&isActive(_0x2b3166[_0x2132('0x56')])){_0x2b3166[_0x2132('0x9a')]=!![];BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](checkIsLoggedIn(_0x2b3166,_0x2b3166[_0x2132('0x4e')]))[_0x2132('0xb7')](checkIsActive(_0x2b3166,_0x2b3166[_0x2132('0x56')]))[_0x2132('0xb7')](checkInterval(_0x2b3166))[_0x2132('0xb7')](_0x461071[_0x2132('0x138')](_0x2b3166))[_0x2132('0xb7')](_0x461071[_0x2132('0x13b')](_0x2b3166[_0x2132('0x158')],_0x2b3166[_0x2132('0x159')],_0x2b3166[_0x2132('0x3e')],_0x2b3166))[_0x2132('0xb7')](_0x461071['checkIfTimeIntervals'](_0x2b3166[_0x2132('0x41')],_0x2b3166[_0x2132('0x159')],_0x2b3166[_0x2132('0x3e')],_0x2b3166))[_0x2132('0xb7')](_0x461071[_0x2132('0x14f')](_0x2b3166))[_0x2132('0xaf')](loggerCatchQueueSummary(_0x2132('0x15a'),_0x2b3166));}else{notSendMessagesQueue(_0x2b3166);}}else{freeVariablesPredictive(_0x2b3166);}};Dialer[_0x2132('0x1c')][_0x2132('0x137')]=function(){var _0x44e175=this;var _0x593200;for(var _0x3a22a in this[_0x2132('0x21')]){if(this[_0x2132('0x21')]['hasOwnProperty'](_0x3a22a)){_0x593200=this[_0x2132('0x21')][_0x3a22a];if(isCampaignIvr(_0x593200[_0x2132('0x4c')])&&isActive(_0x593200[_0x2132('0xd4')])){_0x593200['sendMessageOneNotActive']=!![];BPromise[_0x2132('0xb6')]()[_0x2132('0xb7')](checkIsActive(_0x593200,_0x593200[_0x2132('0xd4')]))['then'](checkInterval(_0x593200))[_0x2132('0xb7')](_0x44e175['checkIsTrunkReachable'](_0x593200))['then'](_0x44e175[_0x2132('0x13b')](_0x593200['dialGlobalInterval'],_0x593200['dialTimezone'],_0x593200[_0x2132('0x3e')],_0x593200))['then'](_0x44e175[_0x2132('0x15b')](_0x593200['Interval'],_0x593200[_0x2132('0x159')],_0x593200[_0x2132('0x3e')],_0x593200))[_0x2132('0xb7')](_0x44e175[_0x2132('0x156')](_0x593200))['catch'](loggerCatchQueueSummary(_0x2132('0x15c'),_0x593200));}else{notSendMessagesCampaign(_0x593200);}}}};function getCallerIdRandom(_0x3bdf39,_0x5e1ee2){var _0x633742,_0x49e10a,_0x2a3a1a;if(_0x5e1ee2<=0x0){_0x5e1ee2=0x1;}_0x633742=new RegExp('\x5cw{0,'+_0x5e1ee2+'}$');_0x49e10a=Math[_0x2132('0x15d')](0xa,_0x5e1ee2-0x1);_0x2a3a1a=Math[_0x2132('0x15d')](0xa,_0x5e1ee2)-0x1;return util['format']('%s',_[_0x2132('0x15e')](_0x3bdf39,_0x633742,_[_0x2132('0x15f')](_0x49e10a,_0x2a3a1a)));}function extractCalleridName(_0x2d144d){var _0x4d0856=_0x2d144d[_0x2132('0x160')](/"(.*?)"/);return _0x4d0856?_0x4d0856[0x1]:_0x2d144d;}function extractCalleridNumber(_0x4d3c89){var _0x5359f9=_0x4d3c89['match'](/<(.*?)>/);return _0x5359f9?_0x5359f9[0x1]:_0x4d3c89;}Dialer[_0x2132('0x1c')]['actionOriginate']=function(_0x54a510,_0x194b8b){var _0xa6a50e=this;var _0xe64cb1=uuid['v4']();this[_0x2132('0xa8')][_0xe64cb1]=new Action(_0x54a510,_0x194b8b,_0xe64cb1);return new BPromise(function(_0x5b04d8,_0x284744){if(_['isUndefined'](_0x54a510)&&_0x2132('0x161')!==typeof _0x54a510){return _0x284744(msgResponse('originate',_0x2132('0x14b'),_0x2132('0x162')));}if(_[_0x2132('0x3b')](_0x194b8b[_0x2132('0x163')][_0x2132('0x164')])||_0x194b8b[_0x2132('0x163')]['phone']===null){return _0x284744(msgResponse('originate',_0x2132('0x14b'),_0x2132('0x165')));}var _0x59de78={'XMD-CALLERID':_0xa6a50e[_0x2132('0xa8')][_0xe64cb1]['getCaller'](),'XMD-AGI':_0x54a510[_0x2132('0x101')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x54a510[_0x2132('0x101')]):_0x2132('0x166'),'XMD-AGIAFTER':_0x54a510[_0x2132('0x109')]?util[_0x2132('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x54a510[_0x2132('0x109')]):'NONE','XMD-QUEUE':_0x54a510['type']===_0x2132('0x8b')?util[_0x2132('0x7c')](_0x2132('0x167'),_0x54a510[_0x2132('0x3e')],_0x54a510[_0x2132('0x168')]||'',_0x54a510[_0x2132('0x10a')]?'c':'',_0x54a510[_0x2132('0x112')]||0x3):_0x2132('0x166'),'XMD-CONTACTID':_0x194b8b['ContactId'],'XMD-CDRTYPE':_0x2132('0x169'),'CALLERID(all)':_0xa6a50e[_0x2132('0xa8')][_0xe64cb1]['getCaller'](),'XMD-AMD':_0x54a510[_0x2132('0xde')]?_0x2132('0x16a'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x54a510[_0x2132('0xde')]){_0x59de78['XMD-AMDINITIALSILENCE']=_0x54a510[_0x2132('0x16b')]||0x9c4;_0x59de78['XMD-AMDGREETING']=_0x54a510[_0x2132('0x16c')]||0x5dc;_0x59de78['XMD-AMDAFTERGREETINGSILENCE']=_0x54a510[_0x2132('0x16d')]||0x320;_0x59de78['XMD-AMDTOTALANALYSISTIME']=_0x54a510[_0x2132('0x16e')]||0x1388;_0x59de78[_0x2132('0x16f')]=_0x54a510[_0x2132('0x170')]||0x64;_0x59de78[_0x2132('0x171')]=_0x54a510[_0x2132('0x172')]||0x32;_0x59de78[_0x2132('0x173')]=_0x54a510[_0x2132('0x174')]||0x3;_0x59de78[_0x2132('0x175')]=_0x54a510[_0x2132('0x176')]||0x100;_0x59de78['XMD-AMDMAXIMUMWORDLENGTH']=_0x54a510[_0x2132('0x177')]||0x1388;}if(_0x54a510[_0x2132('0x4c')]===_0x2132('0x8b')){_0x59de78[_0x2132('0x178')]=_0x194b8b['VoiceQueueId'];}else{_0x59de78[_0x2132('0x179')]=_0x194b8b['CampaignId'];}for(var _0x4910f6 in _0x194b8b[_0x2132('0x163')]){if(_0x194b8b[_0x2132('0x163')][_0x2132('0x93')](_0x4910f6)){if(isNotNull(_0x194b8b[_0x2132('0x163')][_0x4910f6])&&_0x4910f6!=='id'&&_0x4910f6!==_0x2132('0x17a')&&_0x4910f6!==_0x2132('0x17b')&&_0x4910f6!==_0x2132('0x17c')){_0x59de78[util['format']('%s%s',_0x2132('0x17d'),_[_0x2132('0x17e')](_0x4910f6))]=_0x194b8b[_0x2132('0x163')][_0x4910f6];}}}var _0x188884=_0xa6a50e['isTrunkReachable'](_0x54a510['Trunk'])?getCallerId(_0x54a510[_0x2132('0x76')]['callerid'],_0x54a510['dialOriginateCallerIdName'],_0x54a510[_0x2132('0x17f')]>0x0?getCallerIdRandom(_0x54a510['dialOriginateCallerIdNumber'],_0x54a510[_0x2132('0x17f')]):_0x54a510[_0x2132('0x59')]):getCallerId(_['isNil'](_0x54a510[_0x2132('0x180')])?_0x54a510[_0x2132('0x76')][_0x2132('0x77')]:_0x54a510['TrunkBackup'][_0x2132('0x77')],_0x54a510[_0x2132('0x58')],_0x54a510['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x54a510['dialOriginateCallerIdNumber'],_0x54a510['dialRandomLastDigitCallerIdNumber']):_0x54a510['dialOriginateCallerIdNumber']);if(_0x188884){_0x59de78[_0x2132('0x181')]=_0xa6a50e[_0x2132('0xa8')][_0xe64cb1][_0x2132('0x182')]=extractCalleridName(_0x188884);_0x59de78[_0x2132('0x183')]=_0xa6a50e[_0x2132('0xa8')][_0xe64cb1][_0x2132('0x184')]=extractCalleridNumber(_0x188884);}return ami[_0x2132('0xad')]({'actionid':_0xe64cb1,'action':_0x2132('0x185'),'channel':_0xa6a50e[_0x2132('0xd3')](_0x54a510['Trunk'])?util[_0x2132('0x7c')](_0x2132('0x186'),_0x54a510[_0x2132('0x76')][_0x2132('0x3e')],isNotNull(_0x54a510[_0x2132('0x5b')])?_0x54a510['dialPrefix'][_0x2132('0x187')]()||'':'',_0x54a510[_0x2132('0x188')]>0x0?_0x194b8b[_0x2132('0x163')]['phone'][_0x2132('0x189')](_0x54a510[_0x2132('0x188')]):_0x194b8b['Contact'][_0x2132('0x164')]):util[_0x2132('0x7c')]('SIP/%s/%s%s',_[_0x2132('0xac')](_0x54a510['TrunkBackup'])?_0x54a510[_0x2132('0x76')][_0x2132('0x3e')]:_0x54a510['TrunkBackup']['name'],isNotNull(_0x54a510[_0x2132('0x5b')])?_0x54a510[_0x2132('0x5b')]['trim']()||'':'',_0x54a510[_0x2132('0x188')]>0x0?_0x194b8b[_0x2132('0x163')]['phone'][_0x2132('0x189')](_0x54a510[_0x2132('0x188')]):_0x194b8b[_0x2132('0x163')][_0x2132('0x164')]),'callerid':_0x188884,'Exten':_0x2132('0xdd'),'Context':_0x2132('0x18a'),'Priority':'1','variable':_0x59de78,'timeout':(_0x54a510[_0x2132('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0xe64cb1})[_0x2132('0xb7')](function(_0x5ea1fa){return _0x5b04d8(_0x5ea1fa);})[_0x2132('0xaf')](function(_0x2f3376){_0x54a510[_0x2132('0x63')]+=0x1;var _0xfaf91=new History(_0xa6a50e[_0x2132('0xa8')][_0xe64cb1]);logger[_0x2132('0x90')](util['format'](_0x2132('0x18b'),JSON[_0x2132('0x48')](_0x2f3376)));_0xfaf91['state']=0xe;_0xfaf91[_0x2132('0xa2')]=_0x2132('0x18c');_0xfaf91[_0x2132('0xa4')]=moment()['format'](_0x2132('0xf9'));_0xfaf91[_0x2132('0xa3')]=_0xfaf91[_0x2132('0xa4')];_0xa6a50e[_0x2132('0xc4')](_0xfaf91)[_0x2132('0xaf')](loggerCatch(_0x2132('0x18d')));_0xa6a50e['moveContactManagedDialer'](_0xfaf91)[_0x2132('0xaf')](loggerCatch(_0x2132('0x18d')))[_0x2132('0x1e')](function(){delete _0xa6a50e[_0x2132('0xa8')][_0xe64cb1];return _0x284744(msgResponse(_0x2132('0x185'),_0x2132('0x47'),_0x2132('0x18e')));});});});};Dialer[_0x2132('0x1c')][_0x2132('0x31')]=function(_0x3ed06d){var _0x3f8fd3=this[_0x2132('0xa8')][_0x3ed06d[_0x2132('0x121')]];var _0x59b5b7=this;if(_0x3f8fd3){delete this[_0x2132('0xa8')][_0x3ed06d['actionid']];_0x3f8fd3['responsetime']=moment()[_0x2132('0x7c')](_0x2132('0xf9'));var _0x336d09=_0x3f8fd3['type']==='ivr'?this[_0x2132('0x21')][_0x3f8fd3['queue']]:this['voiceQueues'][_0x3f8fd3['getQueue']()];if(!this['isSuccess'](_0x3ed06d[_0x2132('0x18f')])){this[_0x2132('0xb0')](_0x336d09);return this['callProgressDetecting'](_0x3f8fd3,_0x336d09,_0x3ed06d)[_0x2132('0xb7')](function(_0xa094f6){})[_0x2132('0xaf')](loggerCatch(_0x2132('0x190')));}else{this[_0x2132('0x26')][_0x3ed06d[_0x2132('0xd9')]]=_0x3f8fd3;}}};Dialer[_0x2132('0x1c')]['checkRetriveMax']=function(_0x2aaf2d,_0x10395f,_0x1b6746){var _0x573b76=new History(_0x10395f);if(_0x573b76[_0x2132('0xeb')]+_0x573b76[_0x2132('0xec')]+_0x573b76[_0x2132('0xfd')]+_0x573b76[_0x2132('0xed')]+_0x573b76[_0x2132('0xee')]+_0x573b76['countabandonedretry']+_0x573b76[_0x2132('0xe7')]+_0x573b76['countagentrejectretry']>=_0x1b6746[_0x2132('0xf1')]-0x1){return!![];}switch(_0x2aaf2d){case 0x3:if(_0x573b76['countnoanswerretry']>=_0x1b6746[_0x2132('0x191')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countnoanswerretry':_0x573b76['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0x192')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x193')));}break;case 0x5:if(_0x573b76['countbusyretry']>=_0x1b6746[_0x2132('0x194')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countbusyretry':_0x573b76[_0x2132('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x1b6746[_0x2132('0x195')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x573b76[_0x2132('0xec')]>=_0x1b6746[_0x2132('0x196')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countcongestionretry':_0x573b76[_0x2132('0xec')]+=0x1,'scheduledat':moment()['add'](_0x1b6746[_0x2132('0x197')],'minutes')[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x573b76[_0x2132('0xed')]>=_0x1b6746[_0x2132('0x198')]-0x1){return!![];}else{this[_0x2132('0xbc')]({'active':![],'countnosuchnumberretry':_0x573b76[_0x2132('0xed')]+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0x199')],_0x2132('0xf8'))['format'](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x19a')));}break;case 0xa:if(_0x573b76['countdropretry']>=_0x1b6746[_0x2132('0x116')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x573b76[_0x2132('0xee')]+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0x117')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76['ListId'],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})['catch'](loggerCatch(_0x2132('0x19b')));}break;case 0xb:if(_0x573b76[_0x2132('0xef')]>=_0x1b6746[_0x2132('0x11d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x573b76['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746['dialAbandonedRetryFrequency'],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76['VoiceQueueId']||undefined,'CampaignId':_0x573b76['CampaignId']||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x11f')));}break;case 0x13:if(_0x573b76[_0x2132('0xe7')]>=_0x1b6746[_0x2132('0xf4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x573b76['countmachineretry']+=0x1,'scheduledat':moment()[_0x2132('0xf6')](_0x1b6746[_0x2132('0xf7')],_0x2132('0xf8'))['format'](_0x2132('0xf9')),'ContactId':_0x573b76['ContactId'],'ListId':_0x573b76[_0x2132('0xcc')],'VoiceQueueId':_0x573b76['VoiceQueueId']||undefined,'CampaignId':_0x573b76['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x573b76['countagentrejectretry']>=_0x1b6746[_0x2132('0x19c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x573b76[_0x2132('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x1b6746[_0x2132('0x19d')],_0x2132('0xf8'))[_0x2132('0x7c')](_0x2132('0xf9')),'ContactId':_0x573b76[_0x2132('0xcb')],'ListId':_0x573b76['ListId'],'VoiceQueueId':_0x573b76[_0x2132('0xce')]||undefined,'CampaignId':_0x573b76[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x19e')));}break;default:return!![];}};Dialer[_0x2132('0x1c')][_0x2132('0x19f')]=function(_0x3d7d54,_0x339783,_0x375fd6){var _0x51ae55=this;var _0xcf0d27=new History(_0x3d7d54);return new BPromise(function(_0x2784f8,_0x5c611a){if(_['isUndefined'](_0x339783)&&_0x2132('0x161')!==typeof _0x339783){return _0x5c611a(msgResponse(_0x2132('0x1a0'),'Failure',_0x2132('0x1a1')));}if(_[_0x2132('0x3b')](_0x375fd6)&&'object'!==typeof _0x375fd6){return _0x5c611a(msgResponse(_0x2132('0x1a0'),'Failure',_0x2132('0x1a2')));}switch(_0x375fd6[_0x2132('0x107')]){case'0':_0x339783['outboundNoSuchCallsDay']+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x0;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1a3');_0xcf0d27[_0x2132('0xed')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1a4'),ut[_0x2132('0x1a5')](_0x3d7d54,_0x2132('0x1a6')));_0x51ae55['createHistory'](_0xcf0d27)['catch'](loggerCatch(_0x2132('0xea')));if(_0x51ae55[_0x2132('0x1a7')](0x0,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xed')]>=_0x339783[_0x2132('0x198')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1a8'));}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1a8'));}}break;case'3':_0x339783[_0x2132('0x61')]+=0x1;_0xcf0d27['state']=0x3;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1a9');_0xcf0d27[_0x2132('0xfd')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1aa'),ut['buildObj'](_0x3d7d54,_0x2132('0x1ab')));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1ac')));if(_0x51ae55['checkRetriveMax'](0x3,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xfd')]>=_0x339783['dialNoAnswerMaxRetry']){_0x51ae55['createStateFinal'](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1ad'));}else{_0x51ae55['stateGlobal'](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x339783[_0x2132('0x5d')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x5;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1ae');_0xcf0d27['countbusyretry']+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1af'),ut[_0x2132('0x1a5')](_0x3d7d54,_0x2132('0x1b0')));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1b1')));if(_0x51ae55[_0x2132('0x1a7')](0x5,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xeb')]>=_0x339783[_0x2132('0x194')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1b2'));}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1b2'));}}break;case'8':_0x339783[_0x2132('0x1b3')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x8;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1b4');_0xcf0d27[_0x2132('0xec')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1b5'),ut['buildObj'](_0x3d7d54,'congestion'));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x51ae55[_0x2132('0x1a7')](0x8,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xec')]>=_0x339783[_0x2132('0x196')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x208\x20congestion');}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x208\x20congestion');}}break;case'11':_0x339783[_0x2132('0x1b6')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0xb;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x11b');_0xcf0d27[_0x2132('0xef')]+=0x1;_0xcf0d27['countglobal']+=0x1;_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1b7')));if(_0x51ae55['checkRetriveMax'](0xb,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xef')]>=_0x339783['dialAbandonedMaxRetry']){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x2011\x20abandoned');}else{_0x51ae55[_0x2132('0xf2')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1b8'));}}break;case'20':_0x339783[_0x2132('0x65')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0x14;_0xcf0d27[_0x2132('0xa2')]=_0x2132('0x1b9');_0xcf0d27[_0x2132('0xf0')]+=0x1;_0xcf0d27[_0x2132('0xe8')]+=0x1;ami[_0x2132('0x4b')](_0x2132('0x1ba'),ut[_0x2132('0x1a5')](_0x3d7d54,_0x2132('0x1bb')));_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1bc')));if(_0x51ae55['checkRetriveMax'](0x14,_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xf0')]>=_0x339783[_0x2132('0x19c')]){_0x51ae55[_0x2132('0xf5')](_0xcf0d27,_0x2784f8,_0x5c611a,_0x2132('0x1bd'));}else{_0x51ae55['stateGlobal'](_0xcf0d27,_0x2784f8,_0x5c611a,'reason\x2020\x20agentreject');}}break;default:_0x339783[_0x2132('0x1be')]+=0x1;_0xcf0d27[_0x2132('0xa1')]=0xc;_0xcf0d27['statedesc']=_0x375fd6['reason'];_0x51ae55[_0x2132('0xc4')](_0xcf0d27)[_0x2132('0xaf')](loggerCatch(_0x2132('0x1bf')));if(_0x51ae55[_0x2132('0x1a7')](_0x375fd6[_0x2132('0x107')],_0x3d7d54,_0x339783)){if(_0xcf0d27[_0x2132('0xeb')]+_0xcf0d27[_0x2132('0xec')]+_0xcf0d27[_0x2132('0xfd')]+_0xcf0d27['countnosuchnumberretry']+_0xcf0d27[_0x2132('0xee')]+_0xcf0d27['countabandonedretry']+_0xcf0d27['countmachineretry']+_0xcf0d27[_0x2132('0xf0')]>=_0x339783[_0x2132('0xf1')]){_0x51ae55['stateGlobal'](_0xcf0d27,_0x2784f8,_0x5c611a,_0x375fd6['reason']);}else{_0x51ae55['createStateFinal'](_0xcf0d27,_0x2784f8,_0x5c611a,_0x375fd6[_0x2132('0x107')]);}}}});};Dialer[_0x2132('0x1c')][_0x2132('0xf2')]=function(_0x2dc90b,_0x39596e,_0x201f8a,_0x19a768){var _0x42805c=new Final(_0x2dc90b);_0x42805c[_0x2132('0xa1')]=0xf;_0x42805c[_0x2132('0xa2')]=_0x2132('0x1c0');this['createStateFinal'](_0x42805c,_0x39596e,_0x201f8a,_0x19a768);};Dialer['prototype']['createStateFinal']=function(_0x2605b9,_0x3d99ba,_0x15d192,_0x2c26f7){this[_0x2132('0xc2')](_0x2605b9)['then'](function(_0x426088){return _0x3d99ba(msgResponse(_0x2132('0x1a0'),_0x2132('0xd2'),_0x2c26f7));})[_0x2132('0xaf')](function(_0xfbd3d5){return _0x15d192(msgResponse(_0x2132('0x1c1'),'Failure',_0x2132('0x1c2')));});};Dialer[_0x2132('0x1c')]['predictive']=function(_0x118676){var _0x7184be=this;var _0x293790=_0x118676['dialPredictiveOptimizationPercentage']/0x64;var _0x5c42c7=_0x118676[_0x2132('0x60')]/(_0x118676[_0x2132('0x60')]+_0x118676['outboundAnswerCallsDay']);var _0x28cb5b=Math[_0x2132('0x1c3')](_0x118676[_0x2132('0x70')]*(_0x118676[_0x2132('0x1c4')]/0x64));var _0x47e77=Math[_0x2132('0x1c3')](_0x118676[_0x2132('0x70')]*(_0x118676[_0x2132('0x1c5')]/0x64));var _0xa47ac0=_0x118676['available']+_0x118676[_0x2132('0x53')];var _0x2ab38a=Math[_0x2132('0x1c6')](_0x118676[_0x2132('0x1c7')]*_0x118676[_0x2132('0x74')]*_0x118676[_0x2132('0x6d')]*_0x118676['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x118676[_0x2132('0x29')])){if(!_[_0x2132('0x3b')](_0x118676[_0x2132('0x28')])){_0x118676[_0x2132('0x28')]=undefined;loggerPredictive[_0x2132('0x90')](_0x2132('0x1c8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2132('0x3b')](_0x118676[_0x2132('0x89')])){loggerPredictive[_0x2132('0x90')](_0x2132('0x1c8'),_0x2132('0x1c9'));clearInterval(_0x118676['handlePredictive']);_0x118676[_0x2132('0x89')]=undefined;}_0x118676[_0x2132('0x29')]=moment()[_0x2132('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2132('0x7e')](_0x118676['name'],'collection\x20data\x20in\x20progressive\x20at',_0x118676[_0x2132('0x29')]);this['handlePower'](_0x118676,0x1);}else if(ifInterval(_0x118676[_0x2132('0x1ca')],_0x118676[_0x2132('0x29')])){this['handlePower'](_0x118676,0x1);loggerPredictiveCalls[_0x2132('0x7e')](_0x2132('0x1cb'),_0x118676['startProgressive'],_0x118676[_0x2132('0x3e')]);_0x118676[_0x2132('0x1c7')]=0x0;_0x118676[_0x2132('0x6c')]=0x0;}else if(_0x293790<_0x5c42c7&&_0x118676[_0x2132('0x1cc')]===_0x2132('0x1cd')){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x5c42c7,_0x2132('0x29'),_0x118676['name']);}else if(_0x2ab38a<_0x118676[_0x2132('0x6c')]&&_0x118676['dialPredictiveOptimization']===_0x2132('0x1cd')){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')](_0x2132('0x1ce'),_0x2132('0x1cf'),_0x2ab38a,'Drop\x20in\x20this\x20interval',_0x118676[_0x2132('0x6c')],'startProgressive',_0x118676[_0x2132('0x3e')]);}else if(!ifInterval(_0x118676[_0x2132('0x1ca')],_0x118676[_0x2132('0x29')])&&_['isUndefined'](_0x118676['startPredictive'])&&!_[_0x2132('0x3b')](_0x118676['startProgressive'])){_0x118676[_0x2132('0x28')]=moment()[_0x2132('0x7c')](_0x2132('0xf9'));loggerPredictive[_0x2132('0x7e')](_0x118676[_0x2132('0x3e')],_0x2132('0x1d0'),_0x118676[_0x2132('0x28')]);this[_0x2132('0x1d1')](_0x118676['dialPredictiveInterval'])[_0x2132('0xb7')](this[_0x2132('0x1d2')](_0x118676))[_0x2132('0xb7')](mergeDataErlangB(_0x118676))[_0x2132('0xb7')](this[_0x2132('0x1d3')](_0x118676))[_0x2132('0xaf')](loggerCatchPredictive(_0x2132('0x1d4'),_0x118676));}else if(!ifInterval(_0x118676['dialPredictiveInterval'],_0x118676[_0x2132('0x28')])){_0x118676[_0x2132('0x6c')]=0x0;_0x118676[_0x2132('0x28')]=moment()['format'](_0x2132('0xf9'));loggerPredictive[_0x2132('0x7e')](_0x118676['name'],'recalculate\x20predictive\x20at',_0x118676[_0x2132('0x28')]);clearInterval(_0x118676[_0x2132('0x89')]);_0x118676['handlePredictive']=undefined;this[_0x2132('0x1d1')](_0x118676[_0x2132('0x1ca')])[_0x2132('0xb7')](this[_0x2132('0x1d2')](_0x118676))[_0x2132('0xb7')](mergeDataErlangB(_0x118676))[_0x2132('0xb7')](this[_0x2132('0x1d3')](_0x118676))[_0x2132('0xaf')](loggerCatchPredictive(_0x2132('0x1d5'),_0x118676));}else if(_0x118676[_0x2132('0x70')]&&_0xa47ac0<_0x118676[_0x2132('0x70')]-_0x47e77){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')](_0x118676[_0x2132('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xa47ac0,_0x2132('0x1d6'),_0x118676['predictiveIntervalAvailable'],'-',_0x47e77,'=',_0x118676[_0x2132('0x70')]-_0x47e77,')');}else if(_0x118676[_0x2132('0x70')]&&_0xa47ac0>_0x118676['predictiveIntervalAvailable']+_0x28cb5b){freeVariablesPredictive(_0x118676);loggerPredictive[_0x2132('0x7e')](_0x118676[_0x2132('0x3e')],_0x2132('0x1d7'),_0xa47ac0,')\x20are\x20more\x20than\x20threshold\x20(',_0x118676[_0x2132('0x70')],'+',_0x28cb5b,'=',_0x118676[_0x2132('0x70')]+_0x28cb5b,')');}};Dialer[_0x2132('0x1c')]['getDataPredictive']=function(_0x4ce645){var _0x546504=this;return function(_0x4b7e14){return new BPromise(function(_0x545481,_0x8df18a){_[_0x2132('0x87')](_0x4ce645,_0x4b7e14[0x0]);if(checkGetDataPredictive(_0x4b7e14[0x0])){var _0x260179=_0x4ce645[_0x2132('0x70')]=_0x4ce645[_0x2132('0x53')]+_0x4ce645[_0x2132('0x9b')];var _0x7fe419=_0x4ce645['dialPredictiveInterval']*0x3c;var _0x237566=_0x4b7e14[0x0]['predictiveIntervalAvgTalktime']+_0x4b7e14[0x0][_0x2132('0x67')];var _0x129fdf=(_0x4b7e14[0x0][_0x2132('0x66')]+_0x4b7e14[0x0][_0x2132('0x6a')]+_0x4b7e14[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4b7e14[0x0][_0x2132('0x71')];_0x4ce645[_0x2132('0x6d')]=_0x129fdf>0x0?_0x129fdf:0x1;switch(_0x4ce645[_0x2132('0x1cc')]){case'dropRate':var _0x2903de=_0x4ce645['dialPredictiveOptimizationPercentage']/0x64;return _0x546504['abandonmentRate'](_0x260179,_0x7fe419,_0x237566,_0x129fdf,_0x2903de)[_0x2132('0xb7')](function(_0x4deeab){return _0x545481(_0x4deeab);});case _0x2132('0x1d8'):var _0x53285a=_0x4ce645[_0x2132('0x1d9')]/0x64;return _0x546504[_0x2132('0x1da')](_0x260179,_0x7fe419,_0x237566,_0x129fdf,_0x53285a)[_0x2132('0xb7')](function(_0x18a0f2){return _0x545481(_0x18a0f2);});default:return _0x8df18a(msgResponse(_0x2132('0x1db'),_0x2132('0x14b'),_0x2132('0x1dc')));}}else{return _0x8df18a(msgResponse('[getDataPredictive]','Failure',_0x2132('0x1dd')));}});};};Dialer['prototype'][_0x2132('0x1de')]=function(_0x2799ea){var _0x52cde2=this;return function(_0xb15804){return new BPromise(function(_0x36daee,_0x39c63a){_[_0x2132('0x87')](_0x2799ea,_0xb15804[0x0]);if(checkGetDataPredictive(_0xb15804[0x0])){loggerPredictive['info'](JSON[_0x2132('0x48')](_0xb15804[0x0]));if(_0x2799ea['dialPredictiveOptimization']===_0x2132('0x1cd')){return _0x52cde2['getVoiceQueueRtPauses'](_0x2799ea['id'])[_0x2132('0xb7')](function(_0x99cb1b){var _0x179eb8=_0x2799ea['loggedIn']-_0x99cb1b[0x0][_0x2132('0x1df')];var _0xade7ee=_0x2799ea[_0x2132('0x1ca')]*0x3c;var _0x84f71a=_0xb15804[0x0][_0x2132('0x68')]+_0xb15804[0x0]['predictiveIntervalAvgHoldtime'];var _0x4c6188=(_0xb15804[0x0]['predictiveIntervalAnsweredCalls']+_0xb15804[0x0][_0x2132('0x6a')]+_0xb15804[0x0][_0x2132('0x69')])/_0xb15804[0x0][_0x2132('0x71')];var _0x3f6a5a=_0x2799ea[_0x2132('0x1d9')]/0x64;_0x2799ea[_0x2132('0x6f')]=_0x99cb1b[0x0][_0x2132('0x1df')]||0x0;_0x2799ea['predictiveIntervalHitRate']=_0x4c6188>0x0?_0x4c6188:0x1;return _0x52cde2[_0x2132('0x1e0')](_0x179eb8,_0xade7ee,_0x84f71a,_0x4c6188,_0x3f6a5a);})[_0x2132('0xb7')](function(_0x3d0e44){return _0x36daee(_0x3d0e44);})[_0x2132('0xaf')](function(_0x5adce0){return _0x39c63a(msgResponse(_0x2132('0x1e1'),_0x2132('0x14b'),JSON[_0x2132('0x48')](_0x5adce0)));});}if(_0x2799ea[_0x2132('0x1cc')]===_0x2132('0x1d8')){return _0x52cde2[_0x2132('0xc1')](_0x2799ea['id'])[_0x2132('0xb7')](function(_0x2150bc){var _0x5e63e1=_0x2799ea[_0x2132('0x4e')]-_0x2150bc[0x0][_0x2132('0x1df')];var _0x5c6722=_0x2799ea[_0x2132('0x1ca')]*0x3c;var _0x50a649=_0xb15804[0x0][_0x2132('0x68')]+_0xb15804[0x0]['predictiveIntervalAvgHoldtime'];var _0x26b8ca=(_0xb15804[0x0][_0x2132('0x66')]+_0xb15804[0x0][_0x2132('0x6a')]+_0xb15804[0x0][_0x2132('0x69')])/_0xb15804[0x0]['predictiveIntervalTotalCalls'];var _0x5404f6=_0x2799ea[_0x2132('0x1d9')]/0x64;_0x2799ea[_0x2132('0x6f')]=_0x2150bc[0x0][_0x2132('0x1df')]||0x0;_0x2799ea[_0x2132('0x6d')]=_0x26b8ca>0x0?_0x26b8ca:0x1;return _0x52cde2[_0x2132('0x1da')](_0x5e63e1,_0x5c6722,_0x50a649,_0x26b8ca,_0x5404f6);})[_0x2132('0xb7')](function(_0x2b0ebc){return _0x36daee(_0x2b0ebc);})[_0x2132('0xaf')](function(_0x1a75cb){return _0x39c63a(msgResponse(_0x2132('0x1e1'),'Failure',JSON[_0x2132('0x48')](_0x1a75cb)));});}}else{return _0x39c63a(msgResponse(_0x2132('0x1db'),_0x2132('0x14b'),_0x2132('0x1dd')));}});};};Dialer[_0x2132('0x1c')][_0x2132('0x1d3')]=function(_0x285af3){var _0x4a323e=this;return function(){var _0x161c2e=0x0;var _0x11eaef=Math['floor'](_0x285af3[_0x2132('0x73')]*0x3e8);if(_0x11eaef>0x0){_0x11eaef=_0x11eaef<0x64?0x64:_0x11eaef;loggerPredictive[_0x2132('0x7e')](_0x285af3[_0x2132('0x3e')],_0x2132('0x1e2'),_0x11eaef,_0x2132('0x49'));_0x285af3['handlePredictive']=setInterval(function(){_0x4a323e[_0x2132('0x89')](_0x285af3);loggerPredictiveCalls[_0x2132('0x7e')]('[handlePredictive]',_0x161c2e+=0x1);},_0x11eaef);}else{loggerPredictive[_0x2132('0x7e')](_0x285af3[_0x2132('0x3e')],_0x2132('0x1e3'));}};};Dialer[_0x2132('0x1c')]['checkContactBlack']=function(_0x1cfc79,_0xb8a89a){var _0x5979b7=this;return function(_0x4063e2){if(_['isEmpty'](_0x4063e2)){if(_[_0x2132('0xac')](_0xb8a89a[_0x2132('0xcd')])||!_0xb8a89a[_0x2132('0x1e4')]){if(_0x1cfc79[_0x2132('0x57')]===_0x2132('0x153')){_0x1cfc79[_0x2132('0x126')]=_[_0x2132('0x3b')](_0x1cfc79[_0x2132('0x126')])?!![]:_0x1cfc79[_0x2132('0x126')];var _0x597f58=uuid['v4']();_0x5979b7[_0x2132('0xa8')][_0x597f58]=new Action(_0x1cfc79,_0xb8a89a,_0x597f58);loggerBooked['info']('[booked][checkContactBlack]',_0x597f58,_0x2132('0x1e5'),JSON[_0x2132('0x48')](_0x1cfc79[_0x2132('0x126')]),'Queue:\x20',_0x1cfc79[_0x2132('0x3e')]);if(_0x1cfc79[_0x2132('0x126')]){_0x1cfc79[_0x2132('0x126')]=![];_0x5979b7['queueBooked'][_0x5979b7[_0x2132('0xa8')][_0x597f58]['queue']]=[];ami[_0x2132('0xad')]({'actionid':_0x597f58,'action':_0x2132('0x1e6'),'queue':_0x1cfc79[_0x2132('0x3e')]})[_0x2132('0xaf')](function(_0x5e4016){_0x5979b7['updateOriginated'](_0x1cfc79);_0x5979b7[_0x2132('0xbc')]({'active':![],'ContactId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcb')],'ListId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcc')],'VoiceQueueId':_0x5979b7['actions'][_0x597f58][_0x2132('0xce')]||undefined,'CampaignId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x1e7')));delete _0x5979b7['actions'][_0x597f58];});}else{loggerBooked[_0x2132('0x7e')](_0x2132('0x1e8'),JSON[_0x2132('0x48')](_0x1cfc79[_0x2132('0x126')]),'Queue:\x20',_0x1cfc79[_0x2132('0x3e')]);_0x5979b7[_0x2132('0xb0')](_0x1cfc79);_0x5979b7[_0x2132('0xbc')]({'active':![],'ContactId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcb')],'ListId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0xcc')],'VoiceQueueId':_0x5979b7[_0x2132('0xa8')][_0x597f58]['VoiceQueueId']||undefined,'CampaignId':_0x5979b7[_0x2132('0xa8')][_0x597f58][_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x1e7')));delete _0x5979b7[_0x2132('0xa8')][_0x597f58];}}else{return _0x5979b7['actionOriginate'](_0x1cfc79,_0xb8a89a);}}else{if(getDiff(_0xb8a89a[_0x2132('0x1e9')])<_0x1cfc79[_0x2132('0x1ea')]*0x3c){if(_0xb8a89a[_0x2132('0x1eb')]&&!_0xb8a89a[_0x2132('0x1eb')][_0x2132('0x1ec')]){_0x5979b7[_0x2132('0x1f')][_0x2132('0x128')](_0xb8a89a['id'])[_0x2132('0x1e')](function(){_0x5979b7[_0x2132('0xb0')](_0x1cfc79);});}else{_0x5979b7[_0x2132('0xbd')]({'active':![]},_0xb8a89a['id'],0x1)[_0x2132('0x1e')](function(){console[_0x2132('0x1ed')]('Contact\x20updated');_0x5979b7[_0x2132('0xb0')](_0x1cfc79);});}}else{_0x1cfc79[_0x2132('0x64')]+=0x1;_0x5979b7[_0x2132('0xb0')](_0x1cfc79);if(_0x1cfc79[_0x2132('0x1ee')]){_0x5979b7[_0x2132('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb8a89a[_0x2132('0xcb')],'ListId':_0xb8a89a['ListId'],'VoiceQueueId':_0xb8a89a[_0x2132('0xce')]||undefined,'CampaignId':_0xb8a89a[_0x2132('0x11e')]||undefined})[_0x2132('0xaf')](loggerCatch(_0x2132('0x1ef')));_0x5979b7[_0x2132('0xc4')](createObjHistory(_0x1cfc79,_0xb8a89a,_0x2132('0x1f0'),0x17,_0x2132('0x1f1')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5979b7[_0x2132('0xd8')](createObjHistory(_0x1cfc79,_0xb8a89a,_0x2132('0x1f2'),0x16,_0x2132('0x1f3')),_0x2132('0x1f4'),_0x2132('0x1f5'));}}}}else{_0x1cfc79[_0x2132('0x5c')]+=0x1;_0x5979b7[_0x2132('0xd8')](createObjHistory(_0x1cfc79,_0xb8a89a,_0x2132('0x1f6'),0xd,_0x2132('0x1f7')),_0x2132('0x1f8'),_0x2132('0x1f9'));throw'inBlackList';}};};Dialer[_0x2132('0x1c')]['handleIvr']=function(_0x149706){var _0x5c26f9=this;var _0x40284f=[];var _0x36e080=_0x149706['limitCalls']-_0x149706[_0x2132('0x72')]-_0x149706[_0x2132('0x1fa')];emitCampaignSummary(_0x149706);if(_0x36e080>0x0){if(_0x36e080>this[_0x2132('0x24')]){_0x36e080=this[_0x2132('0x24')];}_0x149706[_0x2132('0x1fa')]+=_0x36e080;this[_0x2132('0xc0')](_0x149706['id'],_0x36e080,_0x149706[_0x2132('0x1fb')])[_0x2132('0xb7')](function(_0x282833){_0x149706[_0x2132('0x1fa')]-=_0x36e080;_0x149706[_0x2132('0x1fa')]=_0x149706[_0x2132('0x1fa')]>0x0?_0x149706[_0x2132('0x1fa')]:0x0;if(!checkContactEmpty(_0x282833)){_0x149706[_0x2132('0x3c')]=_0x2132('0x99');logger[_0x2132('0x7e')](_0x2132('0x1fc')+_0x149706[_0x2132('0x3e')]);}else{_0x149706[_0x2132('0x72')]+=_0x282833[_0x2132('0x92')];_0x149706[_0x2132('0x3c')]=_0x2132('0x1fd');for(var _0x4b1afa=0x0;_0x4b1afa<_0x282833[_0x2132('0x92')];_0x4b1afa+=0x1){_0x149706[_0x2132('0x1fe')]+=0x1;if(_['isNil'](_0x282833[_0x4b1afa])||_[_0x2132('0xac')](_0x282833[_0x4b1afa][_0x2132('0x163')])||_['isNil'](_0x282833[_0x4b1afa][_0x2132('0x163')][_0x2132('0x164')])){_0x5c26f9[_0x2132('0xc8')](_0x2132('0x1ff'),_0x149706,_0x282833[_0x4b1afa]);}else{_0x5c26f9[_0x2132('0xb9')](_[_0x2132('0xca')](_0x282833[_0x4b1afa],[_0x2132('0x11e'),'Contact.phone']))['then'](_0x5c26f9[_0x2132('0x200')](_0x149706,_0x282833[_0x4b1afa]))[_0x2132('0xaf')](_0x5c26f9[_0x2132('0x201')]('[actionOriginateIvr]\x20',_0x149706));}}}})[_0x2132('0xaf')](loggerGetContactDialer(_0x2132('0x202'),_0x149706,_0x36e080));}};Dialer[_0x2132('0x1c')][_0x2132('0x151')]=function(_0x240db2,_0xf90f1a){var _0xad695=this;var _0x13a687=[];var _0xb1db03=_0xf90f1a>=0x1?_0xf90f1a:0x1;var _0x5227b8=[];if(_0x240db2[_0x2132('0x57')]===_0x2132('0x153')){_0xb1db03=0x1;}var _0x54d9a6=Math[_0x2132('0x1c6')](_0x240db2[_0x2132('0x9b')]*_0xb1db03)-_0x240db2[_0x2132('0x72')]-_0x240db2[_0x2132('0x1fa')];emitVoiceQueueSummary(_0x240db2);if(_0x240db2['dialLimitQueue']>0x0){var _0x4a495b=_0x240db2[_0x2132('0x203')]-_0x240db2[_0x2132('0x72')]-_0x240db2[_0x2132('0x53')]-_0x240db2[_0x2132('0x1fa')]-_0x240db2['pTalking'];if(_0x54d9a6>_0x4a495b){_0x54d9a6=_0x4a495b;}}if(_0x54d9a6>0x0){if(_0x240db2[_0x2132('0x57')]===_0x2132('0x153')){_0x54d9a6=0x1;}if(_0x54d9a6>this['maxNumberOriginate']){_0x54d9a6=this[_0x2132('0x24')];}_0x240db2[_0x2132('0x1fa')]+=_0x54d9a6;for(var _0x1d6530 in this['agents']){if(this[_0x2132('0x22')]['hasOwnProperty'](_0x1d6530)){if(this[_0x2132('0x22')][_0x1d6530]['state']===_0x2132('0x204')&&this[_0x2132('0x22')][_0x1d6530][_0x2132('0xd6')]===_0x2132('0xd7')){_0x13a687[_0x2132('0x125')](this[_0x2132('0x22')][_0x1d6530]['id']);}}}this[_0x2132('0xbf')](_0x240db2['id'],_0x13a687,_0x54d9a6,_0x240db2[_0x2132('0x1fb')])[_0x2132('0xb7')](function(_0x2fd263){_0x240db2['temp']-=_0x54d9a6;_0x240db2[_0x2132('0x1fa')]=_0x240db2['temp']>0x0?_0x240db2[_0x2132('0x1fa')]:0x0;if(!checkContactEmpty(_0x2fd263)){_0xad695['countReScheduled'](_0x240db2)[_0x2132('0xb7')](sendMessageReschedule(_0x240db2))[_0x2132('0xaf')](loggerCatch(_0x2132('0xb4')));}else{_0x240db2['originated']+=_0x2fd263['length'];_0x240db2[_0x2132('0x3c')]=_0x240db2[_0x2132('0x57')]===_0x2132('0x153')?_0x2132('0x16a'):'RUNNING';for(var _0xfd43d9=0x0;_0xfd43d9<_0x2fd263[_0x2132('0x92')];_0xfd43d9+=0x1){if(_[_0x2132('0xac')](_0x2fd263[_0xfd43d9])||_[_0x2132('0xac')](_0x2fd263[_0xfd43d9][_0x2132('0x163')])||_[_0x2132('0xac')](_0x2fd263[_0xfd43d9][_0x2132('0x163')]['phone'])){_0xad695[_0x2132('0xc8')](_0x2132('0x1ff'),_0x240db2,_0x2fd263[_0xfd43d9]);}else{_0xad695[_0x2132('0xb5')](_['pick'](_0x2fd263[_0xfd43d9],['VoiceQueueId',_0x2132('0x205')]))['then'](_0xad695[_0x2132('0x200')](_0x240db2,_0x2fd263[_0xfd43d9]))[_0x2132('0xaf')](_0xad695[_0x2132('0x201')]('[actionOriginate]\x20',_0x240db2));}}}})[_0x2132('0xaf')](loggerGetContactDialer(_0x2132('0x206'),_0x240db2,_0x54d9a6));}};Dialer['prototype'][_0x2132('0x89')]=function(_0x175620){var _0x25f861=this;if(_0x175620[_0x2132('0x203')]>0x0){var _0x4b9658=_0x175620[_0x2132('0x203')]-_0x175620[_0x2132('0x72')]-_0x175620[_0x2132('0x53')];if(_0x4b9658>0x0){this[_0x2132('0x207')](_0x175620);}else{loggerPredictiveCalls[_0x2132('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x2132('0x207')](_0x175620);}};Dialer['prototype'][_0x2132('0x207')]=function(_0x5e870b){var _0x5ad920=this;var _0x8cf1f=[];_0x5e870b[_0x2132('0x72')]+=0x1;for(var _0x132abe in this[_0x2132('0x22')]){if(this[_0x2132('0x22')]['hasOwnProperty'](_0x132abe)){if(this[_0x2132('0x22')][_0x132abe][_0x2132('0xa1')]===_0x2132('0x204')&&this[_0x2132('0x22')][_0x132abe]['status']===_0x2132('0xd7')){_0x8cf1f[_0x2132('0x125')](this[_0x2132('0x22')][_0x132abe]['id']);}}}this[_0x2132('0xbf')](_0x5e870b['id'],_0x8cf1f,0x1,_0x5e870b[_0x2132('0x1fb')])[_0x2132('0xb7')](function(_0x3afdb6){if(!checkContactEmpty(_0x3afdb6)){checkContactLowerLimitOriginate(_0x5e870b,0x1,0x0);_0x5ad920[_0x2132('0xb3')](_0x5e870b)[_0x2132('0xb7')](sendMessageReschedule(_0x5e870b))['catch'](loggerCatch(_0x2132('0xb4')));}else{_0x5e870b[_0x2132('0x3c')]=_0x2132('0x1fd');if(_[_0x2132('0xac')](_0x3afdb6[0x0])||_[_0x2132('0xac')](_0x3afdb6[0x0]['Contact'])||_[_0x2132('0xac')](_0x3afdb6[0x0][_0x2132('0x163')][_0x2132('0x164')])){_0x5ad920[_0x2132('0xc8')](_0x2132('0x1ff'),_0x5e870b,_0x3afdb6[0x0]);}else{_0x5ad920[_0x2132('0xb5')](_[_0x2132('0xca')](_0x3afdb6[0x0],[_0x2132('0xce'),'Contact.phone']))[_0x2132('0xb7')](_0x5ad920[_0x2132('0x200')](_0x5e870b,_0x3afdb6[0x0]))['catch'](_0x5ad920['loggerHandler'](_0x2132('0x208'),_0x5e870b));}}})[_0x2132('0xaf')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5e870b,0x1));emitVoiceQueueSummary(_0x5e870b);};Dialer[_0x2132('0x1c')][_0x2132('0x1e0')]=function(_0x4bf0b6,_0x436525,_0x4f7a5b,_0x2e860d,_0x1d52d7,_0x5cffe9){loggerPredictive[_0x2132('0x7e')](_0x2132('0x209'));loggerPredictive['info'](_0x2132('0x20a'),_0x4bf0b6);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20b'),_0x436525);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20c'),_0x4f7a5b);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20d'),_0x2e860d);loggerPredictive['info'](_0x2132('0x20e'),_0x1d52d7);loggerPredictive[_0x2132('0x7e')]('---------------------------');return new BPromise(function(_0x383720,_0x1dc552){if(_0x4bf0b6<=0x0||isNaN(_0x4bf0b6)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x210')+_0x4bf0b6));}if(_0x4f7a5b<=0x0||isNaN(_0x4f7a5b)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x211')+_0x4f7a5b));}if(_0x2e860d<=0x0||isNaN(_0x2e860d)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x212')+_0x2e860d));}if(_0x436525<=0x0||isNaN(_0x436525)){return _0x1dc552(msgResponse('[abandonmentRate]',_0x2132('0x47'),_0x2132('0x213')+_0x436525));}if(_0x1d52d7<=0x0||isNaN(_0x1d52d7)){return _0x1dc552(msgResponse(_0x2132('0x20f'),_0x2132('0x47'),_0x2132('0x214')+_0x1d52d7));}_0x5cffe9=_0x5cffe9||0x0;var _0x348012=0x1/_0x4f7a5b;var _0x2dd6f4=0x0;var _0x2cef3c=0x0;var _0x1c876b=0x0;var _0x264cfc=0x0;for(var _0x40c293=0x0;_0x1c876b<_0x1d52d7;_0x40c293+=0x1){_0x2cef3c=_0x40c293/_0x436525;_0x2dd6f4=(_0x2e860d*_0x2cef3c+_0x5cffe9)/_0x348012;_0x1c876b=erlangb(_0x2dd6f4,_0x4bf0b6);_0x264cfc=_0x2dd6f4/_0x4bf0b6*(0x1-erlangb(_0x2dd6f4,_0x4bf0b6));}return _0x383720({'erlangCalls':_0x40c293,'erlangCallToSecond':_0x436525/_0x40c293,'erlangAbandonmentRate':_0x1c876b,'erlangBusyFactor':_0x264cfc});});};Dialer[_0x2132('0x1c')][_0x2132('0x1da')]=function(_0x4be64b,_0x543ec2,_0x1d54f3,_0x2b7fe2,_0x1b5a2a,_0x3d033d){loggerPredictive[_0x2132('0x7e')](_0x2132('0x215'));loggerPredictive[_0x2132('0x7e')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4be64b);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20b'),_0x543ec2);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20c'),_0x1d54f3);loggerPredictive[_0x2132('0x7e')](_0x2132('0x20d'),_0x2b7fe2);loggerPredictive[_0x2132('0x7e')](_0x2132('0x216'),_0x1b5a2a);loggerPredictive[_0x2132('0x7e')](_0x2132('0x217'));return new BPromise(function(_0x4215a7,_0x12ed5a){if(_0x4be64b<=0x0||isNaN(_0x4be64b)){return _0x12ed5a(msgResponse(_0x2132('0x218'),_0x2132('0x47'),_0x2132('0x210')+_0x4be64b));}if(_0x1d54f3<=0x0||isNaN(_0x1d54f3)){return _0x12ed5a(msgResponse('[busyFactor]',_0x2132('0x47'),'Ts\x20=\x20'+_0x1d54f3));}if(_0x2b7fe2<=0x0||isNaN(_0x2b7fe2)){return _0x12ed5a(msgResponse(_0x2132('0x218'),'Error','p\x20=\x20'+_0x2b7fe2));}if(_0x543ec2<=0x0||isNaN(_0x543ec2)){return _0x12ed5a(msgResponse(_0x2132('0x218'),'Error',_0x2132('0x213')+_0x543ec2));}if(_0x1b5a2a<=0x0||isNaN(_0x1b5a2a)){return _0x12ed5a(msgResponse(_0x2132('0x218'),_0x2132('0x47'),_0x2132('0x219')+_0x1b5a2a));}_0x3d033d=_0x3d033d||0x0;var _0x5b5809=0x1/_0x1d54f3;var _0x147ea7=0x0;var _0x5eeb5c=0x0;var _0x4778d0=0x0;var _0x3ae44c=0x0;for(var _0x2a418a=0x0;_0x3ae44c<_0x1b5a2a;_0x2a418a+=0x1){_0x5eeb5c=_0x2a418a/_0x543ec2;_0x147ea7=(_0x2b7fe2*_0x5eeb5c+_0x3d033d)/_0x5b5809;_0x4778d0=erlangb(_0x147ea7,_0x4be64b);_0x3ae44c=_0x147ea7/_0x4be64b*(0x1-erlangb(_0x147ea7,_0x4be64b));}return _0x4215a7({'erlangCalls':_0x2a418a,'erlangCallToSecond':_0x543ec2/_0x2a418a,'erlangAbandonmentRate':_0x4778d0,'erlangBusyFactor':_0x3ae44c});});};module[_0x2132('0x21a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 3c44974..737178d 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 _0x9f25=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','droptime','endtime','ringtime','reason','callback','callbackuniqueid','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x5b6e9e,_0x2111c1){var _0x903b5b=function(_0x3b22f1){while(--_0x3b22f1){_0x5b6e9e['push'](_0x5b6e9e['shift']());}};_0x903b5b(++_0x2111c1);}(_0x9f25,0xb3));var _0x59f2=function(_0xc905bf,_0x3fb45d){_0xc905bf=_0xc905bf-0x0;var _0x3ffd14=_0x9f25[_0xc905bf];return _0x3ffd14;};'use strict';var util=require(_0x59f2('0x0'));var _=require(_0x59f2('0x1'));var moment=require(_0x59f2('0x2'));function getSeconds(_0x2f84c8,_0x2d6c7b){var _0x41d27a=moment(_0x2f84c8)[_0x59f2('0x3')](0x0);var _0x22dd8c=moment(_0x2d6c7b)[_0x59f2('0x3')](0x0);return _0x41d27a[_0x59f2('0x4')](_0x22dd8c,_0x59f2('0x5'));}function QueueCallerAbandon(_0x1835d3,_0x16eeb1){this['scheduledat']=_0x1835d3[_0x59f2('0x6')];this[_0x59f2('0x7')]=_0x1835d3[_0x59f2('0x7')];this[_0x59f2('0x8')]=_0x1835d3[_0x59f2('0x7')]===_0x59f2('0x9')?_0x59f2('0xa'):_0x1835d3[_0x59f2('0x7')];this[_0x59f2('0xb')]=_0x1835d3[_0x59f2('0xb')];this[_0x59f2('0xc')]=_0x1835d3['countcongestionretry'];this[_0x59f2('0xd')]=_0x1835d3['countnoanswerretry'];this[_0x59f2('0xe')]=_0x1835d3[_0x59f2('0xb')]+_0x1835d3[_0x59f2('0xc')]+_0x1835d3[_0x59f2('0xd')]+_0x1835d3[_0x59f2('0xf')]+_0x1835d3[_0x59f2('0x10')]+_0x1835d3[_0x59f2('0x11')]+_0x1835d3[_0x59f2('0x12')]+_0x1835d3['countagentrejectretry'];this['countnosuchnumberretry']=_0x1835d3[_0x59f2('0xf')];this[_0x59f2('0x10')]=_0x1835d3['countdropretry'];this[_0x59f2('0x11')]=_0x1835d3[_0x59f2('0x11')];this['countmachineretry']=_0x1835d3[_0x59f2('0x12')];this[_0x59f2('0x13')]=_0x1835d3[_0x59f2('0x13')];this[_0x59f2('0x14')]=_0x16eeb1['uniqueid'];this[_0x59f2('0x15')]=_0x1835d3['name'];this[_0x59f2('0x16')]=_0x1835d3[_0x59f2('0x17')];this['starttime']=_0x1835d3['starttime'];this[_0x59f2('0x18')]=_0x1835d3[_0x59f2('0x18')];this[_0x59f2('0x19')]=_0x1835d3[_0x59f2('0x19')];this[_0x59f2('0x1a')]=this[_0x59f2('0x19')];this[_0x59f2('0x1b')]=getSeconds(_0x1835d3['responsetime'],_0x1835d3['starttime']);this['holdtime']=getSeconds(this[_0x59f2('0x19')],_0x1835d3['responsetime']);this['talktime']=0x0;this[_0x59f2('0xa')]=_0x16eeb1[_0x59f2('0xa')];this['membername']=_0x16eeb1['connectedlinename'];this[_0x59f2('0x1c')]=_0x16eeb1['reason'];this[_0x59f2('0x1d')]=_0x1835d3[_0x59f2('0x1d')];this[_0x59f2('0x1e')]=_0x1835d3[_0x59f2('0x1e')];this['callbackat']=_0x1835d3['callbackat'];this[_0x59f2('0x1f')]=_0x1835d3[_0x59f2('0x1f')];this['ContactId']=_0x1835d3['ContactId'];this[_0x59f2('0x20')]=_0x1835d3[_0x59f2('0x20')];this[_0x59f2('0x21')]=_0x1835d3[_0x59f2('0x21')];this[_0x59f2('0x22')]=_0x1835d3[_0x59f2('0x22')];this[_0x59f2('0x23')]=_0x1835d3['CampaignId'];this[_0x59f2('0x24')]=_0x1835d3['originatecalleridnum']||'';this['originatecalleridname']=_0x1835d3[_0x59f2('0x25')]||'';}module[_0x59f2('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x3539=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countglobal'];(function(_0x34a904,_0x23af96){var _0x23d658=function(_0x4c3177){while(--_0x4c3177){_0x34a904['push'](_0x34a904['shift']());}};_0x23d658(++_0x23af96);}(_0x3539,0x145));var _0x9353=function(_0xa8ca73,_0x1bf155){_0xa8ca73=_0xa8ca73-0x0;var _0x223616=_0x3539[_0xa8ca73];return _0x223616;};'use strict';var util=require(_0x9353('0x0'));var _=require('lodash');var moment=require(_0x9353('0x1'));function getSeconds(_0x505a66,_0x45461f){var _0x2273df=moment(_0x505a66)[_0x9353('0x2')](0x0);var _0x3a0b26=moment(_0x45461f)[_0x9353('0x2')](0x0);return _0x2273df[_0x9353('0x3')](_0x3a0b26,'seconds');}function QueueCallerAbandon(_0x16126e,_0x56fef5){this[_0x9353('0x4')]=_0x16126e['scheduledat'];this[_0x9353('0x5')]=_0x16126e[_0x9353('0x5')];this[_0x9353('0x6')]=_0x16126e['type']===_0x9353('0x7')?_0x9353('0x8'):_0x16126e[_0x9353('0x5')];this['countbusyretry']=_0x16126e[_0x9353('0x9')];this['countcongestionretry']=_0x16126e['countcongestionretry'];this['countnoanswerretry']=_0x16126e['countnoanswerretry'];this[_0x9353('0xa')]=_0x16126e['countbusyretry']+_0x16126e[_0x9353('0xb')]+_0x16126e[_0x9353('0xc')]+_0x16126e[_0x9353('0xd')]+_0x16126e['countdropretry']+_0x16126e[_0x9353('0xe')]+_0x16126e[_0x9353('0xf')]+_0x16126e[_0x9353('0x10')];this[_0x9353('0xd')]=_0x16126e[_0x9353('0xd')];this['countdropretry']=_0x16126e[_0x9353('0x11')];this[_0x9353('0xe')]=_0x16126e[_0x9353('0xe')];this[_0x9353('0xf')]=_0x16126e[_0x9353('0xf')];this[_0x9353('0x10')]=_0x16126e[_0x9353('0x10')];this[_0x9353('0x12')]=_0x56fef5[_0x9353('0x12')];this[_0x9353('0x13')]=_0x16126e[_0x9353('0x14')];this[_0x9353('0x15')]=_0x16126e[_0x9353('0x16')];this[_0x9353('0x17')]=_0x16126e[_0x9353('0x17')];this[_0x9353('0x18')]=_0x16126e[_0x9353('0x18')];this[_0x9353('0x19')]=_0x16126e[_0x9353('0x19')];this['endtime']=this[_0x9353('0x19')];this['ringtime']=getSeconds(_0x16126e[_0x9353('0x18')],_0x16126e['starttime']);this[_0x9353('0x1a')]=getSeconds(this[_0x9353('0x19')],_0x16126e['responsetime']);this[_0x9353('0x1b')]=0x0;this[_0x9353('0x8')]=_0x56fef5['queue'];this[_0x9353('0x1c')]=_0x56fef5[_0x9353('0x1d')];this[_0x9353('0x1e')]=_0x56fef5[_0x9353('0x1e')];this[_0x9353('0x1f')]=_0x16126e[_0x9353('0x1f')];this[_0x9353('0x20')]=_0x16126e[_0x9353('0x20')];this[_0x9353('0x21')]=_0x16126e[_0x9353('0x21')];this[_0x9353('0x22')]=_0x16126e[_0x9353('0x22')];this[_0x9353('0x23')]=_0x16126e['ContactId'];this['ListId']=_0x16126e[_0x9353('0x24')];this[_0x9353('0x25')]=_0x16126e['UserId'];this['VoiceQueueId']=_0x16126e[_0x9353('0x26')];this[_0x9353('0x27')]=_0x16126e[_0x9353('0x27')];this[_0x9353('0x28')]=_0x16126e[_0x9353('0x28')]||'';this['originatecalleridname']=_0x16126e[_0x9353('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0bb5e47..b72fd43 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 _0x72fd=['util','lodash','moment','uniqueid','channel','format','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x3a966d,_0x3a5994){var _0x3f3880=function(_0x1846fc){while(--_0x1846fc){_0x3a966d['push'](_0x3a966d['shift']());}};_0x3f3880(++_0x3a5994);}(_0x72fd,0xfc));var _0xd72f=function(_0x57b756,_0x39346b){_0x57b756=_0x57b756-0x0;var _0xd3580e=_0x72fd[_0x57b756];return _0xd3580e;};'use strict';var util=require(_0xd72f('0x0'));var _=require(_0xd72f('0x1'));var moment=require(_0xd72f('0x2'));function Action(_0x397cd6,_0x24e752,_0x1b1d57){this[_0xd72f('0x3')]=_0x397cd6||undefined;this[_0xd72f('0x4')]=util[_0xd72f('0x5')]('%s/%s/%s',_0x24e752['tech'],_0x24e752[_0xd72f('0x6')][_0xd72f('0x7')],_0x1b1d57[_0xd72f('0x8')]);this[_0xd72f('0x9')]=_0x24e752[_0xd72f('0x9')];this[_0xd72f('0xa')]=_0x24e752[_0xd72f('0xa')];this[_0xd72f('0xb')]=_0x1b1d57[_0xd72f('0xb')];this[_0xd72f('0xc')]=_0x1b1d57[_0xd72f('0xc')];}module[_0xd72f('0xd')]=Action; \ No newline at end of file +var _0xa78d=['headerinfo','AttachmentId','exports','moment','uniqueid','channel','format','%s/%s/%s','tech','name','localstationid'];(function(_0x5bdbff,_0x8bbf61){var _0x4734b4=function(_0x401224){while(--_0x401224){_0x5bdbff['push'](_0x5bdbff['shift']());}};_0x4734b4(++_0x8bbf61);}(_0xa78d,0xbe));var _0xda78=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa78d[_0x1d24eb];return _0x1dc576;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xda78('0x0'));function Action(_0x700abf,_0x411feb,_0x5eb438){this[_0xda78('0x1')]=_0x700abf||undefined;this[_0xda78('0x2')]=util[_0xda78('0x3')](_0xda78('0x4'),_0x411feb[_0xda78('0x5')],_0x411feb['Trunk'][_0xda78('0x6')],_0x5eb438['fax']);this[_0xda78('0x7')]=_0x411feb[_0xda78('0x7')];this[_0xda78('0x8')]=_0x411feb['headerinfo'];this['path']=_0x5eb438['path'];this[_0xda78('0x9')]=_0x5eb438[_0xda78('0x9')];}module[_0xda78('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 95fa7cd..be5f41b 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 _0xedea=['isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','faxstatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','channel','uniqueid','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','syncNewExten','value','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext'];(function(_0x16cab8,_0x130774){var _0x252212=function(_0x2bc113){while(--_0x2bc113){_0x16cab8['push'](_0x16cab8['shift']());}};_0x252212(++_0x130774);}(_0xedea,0x1c9));var _0xaede=function(_0x36a66e,_0x51d84a){_0x36a66e=_0x36a66e-0x0;var _0x1a0f79=_0xedea[_0x36a66e];return _0x1a0f79;};'use strict';var util=require(_0xaede('0x0'));var _=require(_0xaede('0x1'));var BPromise=require('bluebird');var uuid=require(_0xaede('0x2'));var moment=require('moment');var path=require(_0xaede('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xaede('0x4'));var logger=require(_0xaede('0x5'))(_0xaede('0x6'));var ami=require('../ami');var rpcDb=require(_0xaede('0x7'));var Channel=require(_0xaede('0x8'));var ut=require('./util/util');var Action=require(_0xaede('0x9'));var faxAccount=require(_0xaede('0xa'));var attachment=require(_0xaede('0xb'));var faxMessage=require(_0xaede('0xc'));function Fax(_0x813a00){this[_0xaede('0xd')]={};this[_0xaede('0xe')]=_0x813a00['faxAccounts'];this[_0xaede('0xf')]=_0x813a00['trunks'];this['actions']={};ami['on']('newchannel',this[_0xaede('0x10')]['bind'](this));ami['on'](_0xaede('0x11'),this[_0xaede('0x12')][_0xaede('0x13')](this));ami['on'](_0xaede('0x14'),this[_0xaede('0x15')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xaede('0x13')](this));ami['on'](_0xaede('0x16'),this['syncFaxStatus'][_0xaede('0x13')](this));ami['on'](_0xaede('0x17'),this[_0xaede('0x18')][_0xaede('0x13')](this));ami['on']('hangup',this['syncHangup'][_0xaede('0x13')](this));ami['on']('originateresponse',this[_0xaede('0x19')][_0xaede('0x13')](this));}Fax[_0xaede('0x1a')][_0xaede('0x10')]=function(_0x558821){if(_0x558821[_0xaede('0x1b')]===_0xaede('0x1c')){for(var _0x269434 in this[_0xaede('0xe')]){if(this[_0xaede('0xe')][_0xaede('0x1d')](_0x269434)){if(_0x558821['exten']===this['faxAccounts'][_0x269434]['localstationid']){this[_0xaede('0xd')][_0x558821['uniqueid']]={};this[_0xaede('0xd')][_0x558821['uniqueid']][_0xaede('0x1e')]=_0x558821[_0xaede('0x1e')];this[_0xaede('0xd')][_0x558821[_0xaede('0x1f')]]['id']=this[_0xaede('0xe')][_0x269434]['id'];this[_0xaede('0xd')][_0x558821[_0xaede('0x1f')]]['name']=this[_0xaede('0xe')][_0x269434][_0xaede('0x20')];logger[_0xaede('0x21')](_0x558821[_0xaede('0x1f')],_0xaede('0x22'));}}}}if(this[_0xaede('0x23')][_0x558821[_0xaede('0x1f')]]){this[_0xaede('0xd')][_0x558821[_0xaede('0x1f')]]={};this['channels'][_0x558821[_0xaede('0x1f')]][_0xaede('0x1e')]=_0x558821[_0xaede('0x1e')];logger[_0xaede('0x21')](_0x558821[_0xaede('0x1f')],_0xaede('0x22'));}};Fax[_0xaede('0x1a')][_0xaede('0x12')]=function(_0x2d420c){if(this[_0xaede('0xd')][_0x2d420c[_0xaede('0x1f')]]){for(var _0x14719f in _0x2d420c[_0xaede('0x24')]){if(_0x2d420c[_0xaede('0x24')][_0xaede('0x1d')](_0x14719f)){this['channels'][_0x2d420c[_0xaede('0x1f')]][_0x14719f]=_0x2d420c['value'];}}}};Fax[_0xaede('0x1a')][_0xaede('0x15')]=function(_0x1384a2){if(this[_0xaede('0xd')][_0x1384a2[_0xaede('0x1f')]]){this['channels'][_0x1384a2['uniqueid']][_0xaede('0x25')]=_0x1384a2[_0xaede('0x25')];this[_0xaede('0xd')][_0x1384a2['uniqueid']]['channelstatedesc']=_0x1384a2['channelstatedesc'];}};Fax['prototype'][_0xaede('0x26')]=function(_0x26673e){if(this[_0xaede('0xd')][_0x26673e[_0xaede('0x1f')]]){for(var _0xcaf1c4 in _0x26673e[_0xaede('0x24')]){if(_0x26673e[_0xaede('0x24')]['hasOwnProperty'](_0xcaf1c4)){this[_0xaede('0xd')][_0x26673e[_0xaede('0x1f')]][_0xcaf1c4]=_0x26673e[_0xaede('0x27')];}}}};Fax[_0xaede('0x1a')]['syncFaxStatus']=function(_0xdc4386){if(this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]]){this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]]['operation']=_0xdc4386[_0xaede('0x28')];this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]][_0xaede('0x29')]=_0xdc4386[_0xaede('0x29')];this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]][_0xaede('0x2a')]=_0xdc4386[_0xaede('0x2a')];this[_0xaede('0xd')][_0xdc4386[_0xaede('0x1f')]][_0xaede('0x2b')]=_0xdc4386['filename'];logger['info'](_0xdc4386[_0xaede('0x1f')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xaede('0x18')]=function(_0x217e64){var _0x450452=this;if(this['channels'][_0x217e64['uniqueid']]){var _0x4e074d=this['channels'][_0x217e64['uniqueid']]['id'];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]]['remotestationid']=_0x217e64[_0xaede('0x2c')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2d')]=_0x217e64['pagestransferred'];this['channels'][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2a')]=_0x217e64[_0xaede('0x2a')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]]['resolution']=_0x217e64[_0xaede('0x2e')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2f')]=_0x217e64[_0xaede('0x2f')];this[_0xaede('0xd')][_0x217e64[_0xaede('0x1f')]][_0xaede('0x2b')]=_0x217e64[_0xaede('0x2b')];this['channels'][_0x217e64[_0xaede('0x1f')]][_0xaede('0x30')]=_0x217e64[_0xaede('0x30')];if(this[_0xaede('0xd')][_0x217e64['uniqueid']][_0xaede('0x2d')]>0x0){tiff2pdf(_0x217e64['filename'],_0xaede('0x31'),function(_0x5cf09e){logger['info'](_0x217e64['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x5cf09e[_0xaede('0x32')]);attachment['create']({'name':path[_0xaede('0x33')](_0x217e64[_0xaede('0x2b')])[_0xaede('0x20')],'basename':path[_0xaede('0x33')](_0x217e64[_0xaede('0x2b')])['name']+_0xaede('0x34'),'type':_0xaede('0x35')})[_0xaede('0x36')](function(_0x4d0ea1){faxAccount[_0xaede('0x37')](_0x4e074d,{'from':_0x217e64[_0xaede('0x30')],'mapKey':_0xaede('0x6'),'body':path['parse'](_0x217e64['filename'])['name']+_0xaede('0x34'),'AttachmentId':_0x4d0ea1['id']})['catch'](function(_0x44b3be){logger[_0xaede('0x38')](_0x217e64[_0xaede('0x1f')],_0xaede('0x39'),JSON['stringify'](_0x44b3be));});})[_0xaede('0x3a')](function(_0x3a9af1){logger[_0xaede('0x38')](_0x217e64[_0xaede('0x1f')],_0xaede('0x3b'),JSON[_0xaede('0x3c')](_0x3a9af1));});});}logger[_0xaede('0x21')](_0x217e64[_0xaede('0x1f')],'\x20receiveFax\x20');}};Fax[_0xaede('0x1a')][_0xaede('0x19')]=function(_0x294a8d){if(this[_0xaede('0x23')][_0x294a8d[_0xaede('0x1f')]]){_[_0xaede('0x3d')](this[_0xaede('0xd')][_0x294a8d[_0xaede('0x1f')]],_[_0xaede('0x3e')](_0x294a8d,[_0xaede('0x3f'),'reason']));}};function updateStatus(_0x205be1){if(_0x205be1[_0xaede('0x40')]){faxMessage[_0xaede('0x41')](_0x205be1[_0xaede('0x40')],{'failMessage':_0xaede('0x42')})[_0xaede('0x36')](function(_0x450c47){ut['logger']('[Fax][Message][Error][Updated]',_0x450c47);})[_0xaede('0x3a')](function(_0x4620bc){ut[_0xaede('0x43')](_0xaede('0x44'),_0x4620bc);});}else{ut[_0xaede('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xaede('0x1a')]['updateStatus']=function(_0x4d4366,_0x23c227,_0x576783){var _0xfffdc1=this;var _0x32573f={};if(_0x23c227){_0x32573f={'read':_0x23c227};}else{_0x32573f={'failMessage':_0x576783};}if(this[_0xaede('0x23')][_0x4d4366][_0xaede('0x40')]){faxMessage[_0xaede('0x41')](this[_0xaede('0x23')][_0x4d4366][_0xaede('0x40')],_0x32573f)[_0xaede('0x36')](function(_0xab2fd1){ut['logger'](_0xaede('0x45'),_0xab2fd1);})[_0xaede('0x3a')](function(_0x50e267){ut[_0xaede('0x43')](_0xaede('0x46'),_0x50e267);})[_0xaede('0x47')](function(){delete _0xfffdc1[_0xaede('0xd')][_0x4d4366];delete _0xfffdc1[_0xaede('0x23')][_0x4d4366];});}else{ut[_0xaede('0x43')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x4d4366];delete this[_0xaede('0x23')][_0x4d4366];}};Fax[_0xaede('0x1a')][_0xaede('0x48')]=function(_0x23487d){var _0x7c68a5=this;if(this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]]){if(this[_0xaede('0x23')][_0x23487d[_0xaede('0x1f')]]){this['channels'][_0x23487d['uniqueid']]['id']=this['actions'][_0x23487d[_0xaede('0x1f')]]['id'];this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]][_0xaede('0x20')]=this['actions'][_0x23487d[_0xaede('0x1f')]]['name'];}logger[_0xaede('0x21')](_0x23487d[_0xaede('0x1f')],this[_0xaede('0x23')][_0x23487d[_0xaede('0x1f')]]?_0xaede('0x49'):_0xaede('0x4a'),JSON[_0xaede('0x3c')](this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]]));if(this[_0xaede('0x23')][_0x23487d[_0xaede('0x1f')]]){if(this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]]['faxpages']>0x0&&this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]][_0xaede('0x16')]===_0xaede('0x4b')){this[_0xaede('0x4c')](_0x23487d[_0xaede('0x1f')],!![]);}else{this[_0xaede('0x4c')](_0x23487d[_0xaede('0x1f')],![],this['channels'][_0x23487d[_0xaede('0x1f')]][_0xaede('0x4d')]?'SENDING\x20FAILED:\x20'+this[_0xaede('0xd')][_0x23487d[_0xaede('0x1f')]][_0xaede('0x4d')]:_0xaede('0x4e'));}}}};Fax[_0xaede('0x1a')][_0xaede('0x4f')]=function(_0x751b1e){var _0x9e6385=this;return new BPromise(function(_0xdb843,_0x12e853){_0x9e6385['execOriginate'](_0x751b1e,_0x9e6385['faxAccounts'][_0x751b1e['FaxAccountId']])[_0xaede('0x36')](function(_0x3f9f80){ut[_0xaede('0x43')](_0xaede('0x50'),_0x3f9f80);_0xdb843(ut[_0xaede('0x32')](_0xaede('0x51')));})[_0xaede('0x3a')](function(_0xf84b86){ut[_0xaede('0x43')](_0xaede('0x52'),_0xf84b86);updateStatus(_0x751b1e);_0x12e853(ut[_0xaede('0x32')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x3e51e3){var _0x2d42c1=this;return new BPromise(function(_0x411b30,_0x57e960){var _0x4c50e6=_0x2d42c1['checkTrunk'](_0x2d42c1['faxAccounts'][_0x3e51e3[_0xaede('0x53')]][_0xaede('0x54')],_0x3e51e3);if(_0x4c50e6[_0xaede('0x55')]){_0x411b30(ut[_0xaede('0x32')](_0xaede('0x56')));}else{_0x57e960(ut[_0xaede('0x32')](_0x4c50e6[_0xaede('0x32')]));}});};function originate(_0x4716e1,_0x5948ca,_0x397de1){return new BPromise(function(_0x4a4bad,_0x225227){if(_0x397de1){var _0x27f64b=util[_0xaede('0x57')](_0xaede('0x58'),path[_0xaede('0x33')](_0x4716e1[_0xaede('0x3')])[_0xaede('0x20')],_0x4716e1[_0xaede('0x3')]);gs[_0xaede('0x59')](_0x27f64b)[_0xaede('0x36')](function(){_0x4716e1[_0xaede('0x3')]=util[_0xaede('0x57')](_0xaede('0x5a'),path[_0xaede('0x33')](_0x4716e1[_0xaede('0x3')])[_0xaede('0x5b')],path[_0xaede('0x33')](_0x4716e1['path'])[_0xaede('0x20')]);_0x5948ca['XMF-PATH']=_0x4716e1[_0xaede('0x3')];ut[_0xaede('0x43')](_0xaede('0x5c'),'');ami[_0xaede('0x5d')](ut[_0xaede('0x5e')](_0x4716e1,_0x5948ca))[_0xaede('0x36')](function(_0x23ce85){_0x4a4bad(_0x23ce85);})[_0xaede('0x3a')](function(_0x5dc860){_0x225227(_0x5dc860);});})[_0xaede('0x3a')](function(_0x56b952){_0x225227(_0x56b952);});}else{ami[_0xaede('0x5d')](ut['variablesAction'](_0x4716e1,_0x5948ca))[_0xaede('0x36')](function(_0xf7e430){_0x4a4bad(_0xf7e430);})[_0xaede('0x3a')](function(_0x221caf){_0x225227(_0x221caf);});}});}Fax[_0xaede('0x1a')][_0xaede('0x5f')]=function(_0x3453d6,_0x2b0b28){var _0x538f57=this;return new BPromise(function(_0x40dcd8,_0x3836f6){var _0x2e9ae4=uuid['v4']();var _0x31fb04=ut[_0xaede('0x60')](_0x3453d6,_0x2b0b28);_0x538f57[_0xaede('0x23')][_0x2e9ae4]=new Action(_0x2e9ae4,_0x2b0b28,_0x3453d6);var _0x250359=_0x538f57[_0xaede('0x23')][_0x2e9ae4];if(path['parse'](_0x3453d6['path'])[_0xaede('0x61')]===_0xaede('0x34')){originate(_0x250359,_0x31fb04,!![])[_0xaede('0x36')](function(_0xa28c7f){_0x40dcd8(_0xa28c7f);})[_0xaede('0x3a')](function(_0x40267e){_0x3836f6(_0x40267e);});}else{originate(_0x250359,_0x31fb04,![])[_0xaede('0x36')](function(_0xc9f38c){_0x40dcd8(_0xc9f38c);})['catch'](function(_0x59aa42){_0x3836f6(_0x59aa42);});}});};Fax[_0xaede('0x1a')][_0xaede('0x62')]=function(_0x3565eb){return!_[_0xaede('0x63')](_0x3565eb)&&!_['isNil'](_0x3565eb['name'])&&!_[_0xaede('0x63')](_0x3565eb[_0xaede('0x64')])&&_0x3565eb[_0xaede('0x64')]&&!_[_0xaede('0x63')](this[_0xaede('0xf')][util[_0xaede('0x57')](_0xaede('0x65'),_0x3565eb[_0xaede('0x20')])])&&!_[_0xaede('0x63')](this[_0xaede('0xf')][util['format']('SIP/%s',_0x3565eb[_0xaede('0x20')])]['status'])&&(this[_0xaede('0xf')][util[_0xaede('0x57')](_0xaede('0x65'),_0x3565eb['name'])][_0xaede('0x29')]==='reachable'||this['trunks'][util['format']('SIP/%s',_0x3565eb[_0xaede('0x20')])][_0xaede('0x29')]===_0xaede('0x66'));};Fax[_0xaede('0x1a')]['checkTrunk']=function(_0xd9687f,_0x32affd){if(!this['isTrunkReachable'](_0xd9687f)){ut[_0xaede('0x43')](_0xaede('0x67'),_[_0xaede('0x63')](_0xd9687f)?'':_0xd9687f['name']+_0xaede('0x68'));return{'isValid':![],'message':_0xaede('0x69')};}if(_[_0xaede('0x63')](_0x32affd['fax'])){ut[_0xaede('0x43')](_0xaede('0x6a'),JSON['stringify'](_0x32affd));return{'isValid':![],'message':_0xaede('0x6b')};}if(_['isNil'](_0x32affd[_0xaede('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xaede('0x3c')](_0x32affd));return{'isValid':![],'message':_0xaede('0x6c')};}return{'isValid':!![],'message':_0xaede('0x6d')};};module[_0xaede('0x6e')]=Fax; \ No newline at end of file +var _0xadcb=['../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','notify','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','reason','AttachmentId','then','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20failed','checkAfterSend','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xadcb,0x1c1));var _0xbadc=function(_0x28c4d2,_0x17a999){_0x28c4d2=_0x28c4d2-0x0;var _0x3067d5=_0xadcb[_0x28c4d2];return _0x3067d5;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xbadc('0x0'));var uuid=require(_0xbadc('0x1'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xbadc('0x2'));var gs=require(_0xbadc('0x3'));var logger=require(_0xbadc('0x4'))(_0xbadc('0x5'));var ami=require(_0xbadc('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xbadc('0x7'));var ut=require('./util/util');var Action=require(_0xbadc('0x8'));var faxAccount=require(_0xbadc('0x9'));var attachment=require(_0xbadc('0xa'));var faxMessage=require(_0xbadc('0xb'));function Fax(_0x4ff0c0){this[_0xbadc('0xc')]={};this[_0xbadc('0xd')]=_0x4ff0c0[_0xbadc('0xd')];this[_0xbadc('0xe')]=_0x4ff0c0[_0xbadc('0xe')];this[_0xbadc('0xf')]={};ami['on']('newchannel',this[_0xbadc('0x10')]['bind'](this));ami['on'](_0xbadc('0x11'),this[_0xbadc('0x12')][_0xbadc('0x13')](this));ami['on']('newstate',this[_0xbadc('0x14')][_0xbadc('0x13')](this));ami['on'](_0xbadc('0x15'),this[_0xbadc('0x16')][_0xbadc('0x13')](this));ami['on'](_0xbadc('0x17'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0xbadc('0x18')][_0xbadc('0x13')](this));ami['on']('hangup',this[_0xbadc('0x19')]['bind'](this));ami['on'](_0xbadc('0x1a'),this[_0xbadc('0x1b')][_0xbadc('0x13')](this));}Fax[_0xbadc('0x1c')][_0xbadc('0x10')]=function(_0x4d9117){if(_0x4d9117[_0xbadc('0x1d')]===_0xbadc('0x1e')){for(var _0x344d7c in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x344d7c)){if(_0x4d9117[_0xbadc('0x1f')]===this['faxAccounts'][_0x344d7c][_0xbadc('0x20')]){this[_0xbadc('0xc')][_0x4d9117[_0xbadc('0x21')]]={};this[_0xbadc('0xc')][_0x4d9117['uniqueid']][_0xbadc('0x22')]=_0x4d9117[_0xbadc('0x22')];this['channels'][_0x4d9117[_0xbadc('0x21')]]['id']=this[_0xbadc('0xd')][_0x344d7c]['id'];this['channels'][_0x4d9117[_0xbadc('0x21')]][_0xbadc('0x23')]=this[_0xbadc('0xd')][_0x344d7c]['name'];logger[_0xbadc('0x24')](_0x4d9117['uniqueid'],_0xbadc('0x25'));}}}}if(this[_0xbadc('0xf')][_0x4d9117[_0xbadc('0x21')]]){this[_0xbadc('0xc')][_0x4d9117[_0xbadc('0x21')]]={};this[_0xbadc('0xc')][_0x4d9117[_0xbadc('0x21')]]['channel']=_0x4d9117[_0xbadc('0x22')];logger[_0xbadc('0x24')](_0x4d9117[_0xbadc('0x21')],_0xbadc('0x25'));}};Fax[_0xbadc('0x1c')][_0xbadc('0x12')]=function(_0x3980c6){if(this['channels'][_0x3980c6[_0xbadc('0x21')]]){for(var _0x57e0c3 in _0x3980c6[_0xbadc('0x26')]){if(_0x3980c6[_0xbadc('0x26')][_0xbadc('0x27')](_0x57e0c3)){this[_0xbadc('0xc')][_0x3980c6['uniqueid']][_0x57e0c3]=_0x3980c6[_0xbadc('0x28')];}}}};Fax[_0xbadc('0x1c')][_0xbadc('0x14')]=function(_0x24edb9){if(this[_0xbadc('0xc')][_0x24edb9[_0xbadc('0x21')]]){this['channels'][_0x24edb9[_0xbadc('0x21')]][_0xbadc('0x29')]=_0x24edb9[_0xbadc('0x29')];this[_0xbadc('0xc')][_0x24edb9['uniqueid']][_0xbadc('0x2a')]=_0x24edb9[_0xbadc('0x2a')];}};Fax['prototype'][_0xbadc('0x16')]=function(_0x1a608a){if(this['channels'][_0x1a608a[_0xbadc('0x21')]]){for(var _0x363c04 in _0x1a608a['variable']){if(_0x1a608a['variable']['hasOwnProperty'](_0x363c04)){this[_0xbadc('0xc')][_0x1a608a[_0xbadc('0x21')]][_0x363c04]=_0x1a608a[_0xbadc('0x28')];}}}};Fax[_0xbadc('0x1c')][_0xbadc('0x2b')]=function(_0x2a61f7){if(this[_0xbadc('0xc')][_0x2a61f7[_0xbadc('0x21')]]){this[_0xbadc('0xc')][_0x2a61f7[_0xbadc('0x21')]][_0xbadc('0x2c')]=_0x2a61f7[_0xbadc('0x2c')];this[_0xbadc('0xc')][_0x2a61f7[_0xbadc('0x21')]][_0xbadc('0x2d')]=_0x2a61f7[_0xbadc('0x2d')];this[_0xbadc('0xc')][_0x2a61f7['uniqueid']][_0xbadc('0x20')]=_0x2a61f7[_0xbadc('0x20')];this[_0xbadc('0xc')][_0x2a61f7['uniqueid']][_0xbadc('0x2e')]=_0x2a61f7[_0xbadc('0x2e')];logger[_0xbadc('0x24')](_0x2a61f7[_0xbadc('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0xbadc('0x1c')][_0xbadc('0x18')]=function(_0x457c54){var _0x5122b3=this;if(this[_0xbadc('0xc')][_0x457c54['uniqueid']]){var _0x4d3f76=this[_0xbadc('0xc')][_0x457c54[_0xbadc('0x21')]]['id'];this['channels'][_0x457c54[_0xbadc('0x21')]]['remotestationid']=_0x457c54[_0xbadc('0x2f')];this['channels'][_0x457c54[_0xbadc('0x21')]][_0xbadc('0x30')]=_0x457c54[_0xbadc('0x30')];this[_0xbadc('0xc')][_0x457c54['uniqueid']]['localstationid']=_0x457c54[_0xbadc('0x20')];this[_0xbadc('0xc')][_0x457c54[_0xbadc('0x21')]][_0xbadc('0x31')]=_0x457c54['resolution'];this[_0xbadc('0xc')][_0x457c54[_0xbadc('0x21')]]['transferrate']=_0x457c54[_0xbadc('0x32')];this[_0xbadc('0xc')][_0x457c54['uniqueid']]['filename']=_0x457c54[_0xbadc('0x2e')];this['channels'][_0x457c54[_0xbadc('0x21')]]['calleridnum']=_0x457c54[_0xbadc('0x33')];if(this['channels'][_0x457c54[_0xbadc('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x457c54['filename'],_0xbadc('0x34'),function(_0x25ff8d){logger['info'](_0x457c54[_0xbadc('0x21')],'\x20result\x20conversion\x20file\x20',_0x25ff8d['message']);attachment[_0xbadc('0x35')]({'name':path[_0xbadc('0x36')](_0x457c54[_0xbadc('0x2e')])[_0xbadc('0x23')],'basename':path[_0xbadc('0x36')](_0x457c54[_0xbadc('0x2e')])['name']+_0xbadc('0x37'),'type':_0xbadc('0x38')})['then'](function(_0x4cf7ac){faxAccount[_0xbadc('0x39')](_0x4d3f76,{'from':_0x457c54[_0xbadc('0x33')],'mapKey':'fax','body':path[_0xbadc('0x36')](_0x457c54[_0xbadc('0x2e')])[_0xbadc('0x23')]+'.pdf','AttachmentId':_0x4cf7ac['id']})['catch'](function(_0x4d9806){logger['error'](_0x457c54[_0xbadc('0x21')],_0xbadc('0x3a'),JSON[_0xbadc('0x3b')](_0x4d9806));});})['catch'](function(_0x5aca80){logger[_0xbadc('0x3c')](_0x457c54[_0xbadc('0x21')],_0xbadc('0x3d'),JSON[_0xbadc('0x3b')](_0x5aca80));});});}logger[_0xbadc('0x24')](_0x457c54['uniqueid'],_0xbadc('0x3d'));}};Fax[_0xbadc('0x1c')][_0xbadc('0x1b')]=function(_0x32773e){if(this[_0xbadc('0xf')][_0x32773e[_0xbadc('0x21')]]){_[_0xbadc('0x3e')](this[_0xbadc('0xc')][_0x32773e[_0xbadc('0x21')]],_[_0xbadc('0x3f')](_0x32773e,['response',_0xbadc('0x40')]));}};function updateStatus(_0x153610){if(_0x153610[_0xbadc('0x41')]){faxMessage['update'](_0x153610[_0xbadc('0x41')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xbadc('0x42')](function(_0x224b71){ut[_0xbadc('0x43')](_0xbadc('0x44'),_0x224b71);})[_0xbadc('0x45')](function(_0x24f9e8){ut[_0xbadc('0x43')](_0xbadc('0x46'),_0x24f9e8);});}else{ut[_0xbadc('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0xbadc('0x47')]=function(_0x27d620,_0x37bf48,_0x52b7e8){var _0x4ff8c2=this;var _0x4e45ec={};if(_0x37bf48){_0x4e45ec={'read':_0x37bf48};}else{_0x4e45ec={'failMessage':_0x52b7e8};}if(this[_0xbadc('0xf')][_0x27d620][_0xbadc('0x41')]){faxMessage['update'](this['actions'][_0x27d620][_0xbadc('0x41')],_0x4e45ec)[_0xbadc('0x42')](function(_0x247af8){ut['logger']('[Fax][Message][Updated]',_0x247af8);})[_0xbadc('0x45')](function(_0x394408){ut[_0xbadc('0x43')](_0xbadc('0x48'),_0x394408);})[_0xbadc('0x49')](function(){delete _0x4ff8c2[_0xbadc('0xc')][_0x27d620];delete _0x4ff8c2[_0xbadc('0xf')][_0x27d620];});}else{ut[_0xbadc('0x43')]('[Fax][Message][NoUpdate2]');delete this[_0xbadc('0xc')][_0x27d620];delete this[_0xbadc('0xf')][_0x27d620];}};Fax['prototype'][_0xbadc('0x19')]=function(_0x2b2309){var _0x3812fb=this;if(this['channels'][_0x2b2309[_0xbadc('0x21')]]){if(this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]]){this[_0xbadc('0xc')][_0x2b2309['uniqueid']]['id']=this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]]['id'];this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]][_0xbadc('0x23')]=this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]][_0xbadc('0x23')];}logger[_0xbadc('0x24')](_0x2b2309[_0xbadc('0x21')],this['actions'][_0x2b2309['uniqueid']]?_0xbadc('0x4a'):_0xbadc('0x4b'),JSON[_0xbadc('0x3b')](this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]]));if(this[_0xbadc('0xf')][_0x2b2309[_0xbadc('0x21')]]){if(this['channels'][_0x2b2309[_0xbadc('0x21')]][_0xbadc('0x4c')]>0x0&&this[_0xbadc('0xc')][_0x2b2309['uniqueid']][_0xbadc('0x17')]===_0xbadc('0x4d')){this[_0xbadc('0x47')](_0x2b2309[_0xbadc('0x21')],!![]);}else{this[_0xbadc('0x47')](_0x2b2309['uniqueid'],![],this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]]['faxstatusstring']?_0xbadc('0x4e')+this[_0xbadc('0xc')][_0x2b2309[_0xbadc('0x21')]]['faxstatusstring']:_0xbadc('0x4f'));}}}};Fax[_0xbadc('0x1c')][_0xbadc('0x50')]=function(_0x31fb3e){var _0x489784=this;return new BPromise(function(_0x353267,_0x5ee745){_0x489784['execOriginate'](_0x31fb3e,_0x489784[_0xbadc('0xd')][_0x31fb3e[_0xbadc('0x51')]])[_0xbadc('0x42')](function(_0x22d2cc){ut[_0xbadc('0x43')](_0xbadc('0x52'),_0x22d2cc);_0x353267(ut[_0xbadc('0x53')]('Fax\x20received'));})[_0xbadc('0x45')](function(_0x7f7098){ut[_0xbadc('0x43')]('[Fax][execOriginate][failure]',_0x7f7098);updateStatus(_0x31fb3e);_0x5ee745(ut['message'](_0xbadc('0x54')));});});};Fax[_0xbadc('0x1c')][_0xbadc('0x55')]=function(_0x46b553){var _0x5c4b7a=this;return new BPromise(function(_0x395906,_0x2899b4){var _0x132c9f=_0x5c4b7a['checkTrunk'](_0x5c4b7a[_0xbadc('0xd')][_0x46b553[_0xbadc('0x51')]][_0xbadc('0x56')],_0x46b553);if(_0x132c9f[_0xbadc('0x57')]){_0x395906(ut[_0xbadc('0x53')]('Trunk\x20Reachable'));}else{_0x2899b4(ut['message'](_0x132c9f[_0xbadc('0x53')]));}});};function originate(_0x40ee72,_0x3b22a6,_0x3dacac){return new BPromise(function(_0x433199,_0x2cbcf2){if(_0x3dacac){var _0x55fd3c=util['format'](_0xbadc('0x58'),path[_0xbadc('0x36')](_0x40ee72['path'])[_0xbadc('0x23')],_0x40ee72[_0xbadc('0x59')]);gs[_0xbadc('0x5a')](_0x55fd3c)['then'](function(){_0x40ee72['path']=util[_0xbadc('0x5b')](_0xbadc('0x5c'),path['parse'](_0x40ee72[_0xbadc('0x59')])[_0xbadc('0x5d')],path[_0xbadc('0x36')](_0x40ee72[_0xbadc('0x59')])['name']);_0x3b22a6[_0xbadc('0x5e')]=_0x40ee72[_0xbadc('0x59')];ut[_0xbadc('0x43')](_0xbadc('0x5f'),'');ami[_0xbadc('0x60')](ut['variablesAction'](_0x40ee72,_0x3b22a6))['then'](function(_0x1d4a24){_0x433199(_0x1d4a24);})['catch'](function(_0x416ee3){_0x2cbcf2(_0x416ee3);});})[_0xbadc('0x45')](function(_0x40dab4){_0x2cbcf2(_0x40dab4);});}else{ami['Action'](ut[_0xbadc('0x61')](_0x40ee72,_0x3b22a6))[_0xbadc('0x42')](function(_0x4f97c9){_0x433199(_0x4f97c9);})[_0xbadc('0x45')](function(_0x2ff851){_0x2cbcf2(_0x2ff851);});}});}Fax['prototype'][_0xbadc('0x62')]=function(_0x5227de,_0x8f41d7){var _0x19a6e6=this;return new BPromise(function(_0x5ebc4a,_0x5e32fc){var _0x5eff35=uuid['v4']();var _0x279b9b=ut[_0xbadc('0x63')](_0x5227de,_0x8f41d7);_0x19a6e6['actions'][_0x5eff35]=new Action(_0x5eff35,_0x8f41d7,_0x5227de);var _0x483b14=_0x19a6e6[_0xbadc('0xf')][_0x5eff35];if(path['parse'](_0x5227de[_0xbadc('0x59')])[_0xbadc('0x64')]===_0xbadc('0x37')){originate(_0x483b14,_0x279b9b,!![])[_0xbadc('0x42')](function(_0xab4bd7){_0x5ebc4a(_0xab4bd7);})[_0xbadc('0x45')](function(_0x340fdc){_0x5e32fc(_0x340fdc);});}else{originate(_0x483b14,_0x279b9b,![])[_0xbadc('0x42')](function(_0x25637b){_0x5ebc4a(_0x25637b);})[_0xbadc('0x45')](function(_0x125312){_0x5e32fc(_0x125312);});}});};Fax[_0xbadc('0x1c')][_0xbadc('0x65')]=function(_0x1ddca4){return!_[_0xbadc('0x66')](_0x1ddca4)&&!_[_0xbadc('0x66')](_0x1ddca4[_0xbadc('0x23')])&&!_[_0xbadc('0x66')](_0x1ddca4[_0xbadc('0x67')])&&_0x1ddca4[_0xbadc('0x67')]&&!_[_0xbadc('0x66')](this['trunks'][util[_0xbadc('0x5b')]('SIP/%s',_0x1ddca4['name'])])&&!_['isNil'](this[_0xbadc('0xe')][util[_0xbadc('0x5b')](_0xbadc('0x68'),_0x1ddca4[_0xbadc('0x23')])]['status'])&&(this[_0xbadc('0xe')][util[_0xbadc('0x5b')](_0xbadc('0x68'),_0x1ddca4[_0xbadc('0x23')])][_0xbadc('0x2d')]===_0xbadc('0x69')||this[_0xbadc('0xe')][util['format']('SIP/%s',_0x1ddca4[_0xbadc('0x23')])][_0xbadc('0x2d')]===_0xbadc('0x6a'));};Fax[_0xbadc('0x1c')][_0xbadc('0x6b')]=function(_0x108b15,_0x3b473a){if(!this[_0xbadc('0x65')](_0x108b15)){ut[_0xbadc('0x43')](_0xbadc('0x6c'),_[_0xbadc('0x66')](_0x108b15)?'':_0x108b15[_0xbadc('0x23')]+_0xbadc('0x6d'));return{'isValid':![],'message':_0xbadc('0x6e')};}if(_[_0xbadc('0x66')](_0x3b473a[_0xbadc('0x5')])){ut[_0xbadc('0x43')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x3b473a));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xbadc('0x66')](_0x3b473a[_0xbadc('0x59')])){ut[_0xbadc('0x43')](_0xbadc('0x6f'),JSON[_0xbadc('0x3b')](_0x3b473a));return{'isValid':![],'message':_0xbadc('0x70')};}return{'isValid':!![],'message':_0xbadc('0x71')};};module[_0xbadc('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 145e1cb..25dd54a 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 _0x743b=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify','then'];(function(_0x4d4d9f,_0x50f769){var _0x57b383=function(_0x5027b5){while(--_0x5027b5){_0x4d4d9f['push'](_0x4d4d9f['shift']());}};_0x57b383(++_0x50f769);}(_0x743b,0x124));var _0xb743=function(_0x459ef9,_0x5624fe){_0x459ef9=_0x459ef9-0x0;var _0x2751b8=_0x743b[_0x459ef9];return _0x2751b8;};'use strict';var util=require(_0xb743('0x0'));var BPromise=require(_0xb743('0x1'));var logger=require(_0xb743('0x2'))(_0xb743('0x3'));var _=require(_0xb743('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x7a7d06){return function(_0x40b261){logger[_0xb743('0x5')](_0x7a7d06,util['inspect'](_0x40b261,{'showHidden':![],'depth':null}));};}exports[_0xb743('0x6')]=function(_0x3e8b83,_0x536cd7){return BPromise['resolve']()[_0xb743('0x7')](faxAccount['notify'](_0x3e8b83,_0x536cd7))[_0xb743('0x8')](loggerCatch(_0xb743('0x9')));}; \ No newline at end of file +var _0x668c=['error','notify','util','bluebird','../../../config/logger','preview','../rpc/faxAccount'];(function(_0x11b710,_0x3805eb){var _0x565030=function(_0x5788de){while(--_0x5788de){_0x11b710['push'](_0x11b710['shift']());}};_0x565030(++_0x3805eb);}(_0x668c,0x1bb));var _0xc668=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0x668c[_0x1f3c56];return _0x569524;};'use strict';var util=require(_0xc668('0x0'));var BPromise=require(_0xc668('0x1'));var logger=require(_0xc668('0x2'))(_0xc668('0x3'));var _=require('lodash');var faxAccount=require(_0xc668('0x4'));function loggerCatch(_0x248445){return function(_0x1e39b3){logger[_0xc668('0x5')](_0x248445,util['inspect'](_0x1e39b3,{'showHidden':![],'depth':null}));};}exports[_0xc668('0x6')]=function(_0x207247,_0x17d143){return BPromise['resolve']()['then'](faxAccount[_0xc668('0x6')](_0x207247,_0x17d143))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 0ce28d2..d45f876 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 _0x40c1=['util','../../../../config/logger','bluebird','exec','Exec\x20gs','info','\x20Error\x20:','inspect'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x40c1,0x130));var _0x140c=function(_0x17a495,_0x7e24ed){_0x17a495=_0x17a495-0x0;var _0x53bf9b=_0x40c1[_0x17a495];return _0x53bf9b;};'use strict';var util=require(_0x140c('0x0'));var logger=require(_0x140c('0x1'))('fax');var BPromise=require(_0x140c('0x2'));var exec=require('child_process')[_0x140c('0x3')];exports['execute']=function(_0x428ac3){return new BPromise(function(_0x16936b,_0x4b2845){exec(_0x428ac3,function(_0x16cb06,_0x282246,_0x420b56){logger['info'](_0x140c('0x4'),_0x282246);if(_0x16cb06){logger[_0x140c('0x5')]('Exec\x20gs',_0x140c('0x6'),util[_0x140c('0x7')](_0x16cb06,{'showHidden':![],'depth':null}),_0x282246,_0x420b56);_0x4b2845(_0x16cb06);}_0x16936b(_0x282246);});});}; \ No newline at end of file +var _0x42ac=['bluebird','child_process','exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x4f62fd,_0x515bda){var _0x406878=function(_0x1975d2){while(--_0x1975d2){_0x4f62fd['push'](_0x4f62fd['shift']());}};_0x406878(++_0x515bda);}(_0x42ac,0x151));var _0xc42a=function(_0x178f2f,_0x40480e){_0x178f2f=_0x178f2f-0x0;var _0x4f890b=_0x42ac[_0x178f2f];return _0x4f890b;};'use strict';var util=require(_0xc42a('0x0'));var logger=require(_0xc42a('0x1'))(_0xc42a('0x2'));var BPromise=require(_0xc42a('0x3'));var exec=require(_0xc42a('0x4'))[_0xc42a('0x5')];exports[_0xc42a('0x6')]=function(_0x117350){return new BPromise(function(_0x1d883a,_0x4878a0){exec(_0x117350,function(_0xb944e8,_0x1765c8,_0x2a87df){logger['info'](_0xc42a('0x7'),_0x1765c8);if(_0xb944e8){logger['info'](_0xc42a('0x7'),_0xc42a('0x8'),util[_0xc42a('0x9')](_0xb944e8,{'showHidden':![],'depth':null}),_0x1765c8,_0x2a87df);_0x4878a0(_0xb944e8);}_0x1d883a(_0x1765c8);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 89f7131..65cd831 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 _0xbb53=['modem','faxdetect','path','variablesAction','originate','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','format','\x22%s\x22'];(function(_0xd3a712,_0x33cd67){var _0x50e8f9=function(_0x501d63){while(--_0x501d63){_0xd3a712['push'](_0xd3a712['shift']());}};_0x50e8f9(++_0x33cd67);}(_0xbb53,0x121));var _0x3bb5=function(_0x4dee51,_0x290293){_0x4dee51=_0x4dee51-0x0;var _0x7b92d1=_0xbb53[_0x4dee51];return _0x7b92d1;};'use strict';var util=require(_0x3bb5('0x0'));var _=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var logger=require(_0x3bb5('0x3'))(_0x3bb5('0x4'));exports[_0x3bb5('0x5')]=function(_0x414da7){return{'message':_0x414da7};};exports[_0x3bb5('0x6')]=function(_0x83e44b,_0x450d9e){logger['info'](_0x83e44b,util['inspect'](_0x450d9e,{'showHidden':![],'depth':null}));};exports[_0x3bb5('0x7')]=function(_0x2460b0,_0x28aa7d){var _0x157e04={'XMF-ECM':_0x28aa7d[_0x3bb5('0x8')],'XMF-HEADERINFO':_0x28aa7d['headerinfo'],'XMF-MINRATE':_0x28aa7d['minrate'],'XMF-MAXRATE':_0x28aa7d['maxrate'],'XMF-MODEM':util[_0x3bb5('0x9')](_0x3bb5('0xa'),_0x28aa7d[_0x3bb5('0xb')]),'XMF-GATEWAY':_0x28aa7d['gateway'],'XMF-FAXDETECT':_0x28aa7d[_0x3bb5('0xc')],'XMF-T38TIMEOUT':_0x28aa7d['t38timeout'],'XMF-LOCALSTATIONID':_0x28aa7d['localstationid'],'XMF-PATH':_0x2460b0[_0x3bb5('0xd')]};return _0x157e04;};exports[_0x3bb5('0xe')]=function(_0x5cfc6b,_0xe00ace){return{'actionid':_0x5cfc6b['uniqueid'],'action':_0x3bb5('0xf'),'channel':_0x5cfc6b['channel'],'Exten':'xcally-motion-fax','Context':_0x3bb5('0x10'),'Priority':'1','callerid':util[_0x3bb5('0x9')](_0x3bb5('0x11'),_0x5cfc6b['headerinfo']?_0x5cfc6b[_0x3bb5('0x12')]:'',_0x5cfc6b[_0x3bb5('0x13')]),'variable':_0xe00ace,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5cfc6b['uniqueid']};}; \ No newline at end of file +var _0xc368=['from-sip','\x22%s\x22\x20<%s>','localstationid','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc368,0x7b));var _0x8c36=function(_0x234acb,_0x1f265b){_0x234acb=_0x234acb-0x0;var _0x463fab=_0xc368[_0x234acb];return _0x463fab;};'use strict';var util=require('util');var _=require(_0x8c36('0x0'));var moment=require('moment');var logger=require(_0x8c36('0x1'))(_0x8c36('0x2'));exports[_0x8c36('0x3')]=function(_0x2640c5){return{'message':_0x2640c5};};exports[_0x8c36('0x4')]=function(_0x5d3b27,_0x3e9034){logger[_0x8c36('0x5')](_0x5d3b27,util[_0x8c36('0x6')](_0x3e9034,{'showHidden':![],'depth':null}));};exports[_0x8c36('0x7')]=function(_0x5ebfc1,_0x554022){var _0x8ed437={'XMF-ECM':_0x554022[_0x8c36('0x8')],'XMF-HEADERINFO':_0x554022[_0x8c36('0x9')],'XMF-MINRATE':_0x554022[_0x8c36('0xa')],'XMF-MAXRATE':_0x554022[_0x8c36('0xb')],'XMF-MODEM':util[_0x8c36('0xc')]('\x22%s\x22',_0x554022['modem']),'XMF-GATEWAY':_0x554022['gateway'],'XMF-FAXDETECT':_0x554022[_0x8c36('0xd')],'XMF-T38TIMEOUT':_0x554022[_0x8c36('0xe')],'XMF-LOCALSTATIONID':_0x554022['localstationid'],'XMF-PATH':_0x5ebfc1[_0x8c36('0xf')]};return _0x8ed437;};exports[_0x8c36('0x10')]=function(_0x1d5c61,_0xe7857e){return{'actionid':_0x1d5c61[_0x8c36('0x11')],'action':_0x8c36('0x12'),'channel':_0x1d5c61[_0x8c36('0x13')],'Exten':_0x8c36('0x14'),'Context':_0x8c36('0x15'),'Priority':'1','callerid':util[_0x8c36('0xc')](_0x8c36('0x16'),_0x1d5c61[_0x8c36('0x9')]?_0x1d5c61[_0x8c36('0x9')]:'',_0x1d5c61[_0x8c36('0x17')]),'variable':_0xe7857e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1d5c61['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index c219033..87289b5 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 _0xb7e8=['sync','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen'];(function(_0xfa49d0,_0x4437d1){var _0x12184e=function(_0x1029d7){while(--_0x1029d7){_0xfa49d0['push'](_0xfa49d0['shift']());}};_0x12184e(++_0x4437d1);}(_0xb7e8,0x1e9));var _0x8b7e=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0xb7e8[_0x1aab74];return _0x396af2;};'use strict';var BPromise=require(_0x8b7e('0x0'));var util=require('util');var moment=require(_0x8b7e('0x1'));var server=require(_0x8b7e('0x2'));var Realtime=require(_0x8b7e('0x3'));var Report=require(_0x8b7e('0x4'));var Acw=require('./acw');var Trigger=require(_0x8b7e('0x5'));var Dialer=require(_0x8b7e('0x6'));var Preview=require('./preview');var Fax=require(_0x8b7e('0x7'));var user=require(_0x8b7e('0x8'));var voiceQueue=require(_0x8b7e('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x8b7e('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x8b7e('0xb'));var template=require(_0x8b7e('0xc'));var cmHopperHistory=require(_0x8b7e('0xd'));var campaign=require(_0x8b7e('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x8b7e('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x8b7e('0x10'));var sugarcrm=require(_0x8b7e('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x8b7e('0x12'));var dynamics365=require(_0x8b7e('0x13'));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()[_0x8b7e('0x14')](_0x8b7e('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8b7e('0x14')](_0x8b7e('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8b7e('0x16')]()[_0x8b7e('0x17')](user[_0x8b7e('0x18')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x19')]())[_0x8b7e('0x17')](user[_0x8b7e('0x1a')]())[_0x8b7e('0x17')](realtime['initTelephones']())[_0x8b7e('0x17')](trunk[_0x8b7e('0x1b')]())['then'](realtime[_0x8b7e('0x1c')]())[_0x8b7e('0x17')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x8b7e('0x1d')]())[_0x8b7e('0x17')](trigger['getTriggers']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x1e')]())['then'](template['getTemplates']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x1f')]())[_0x8b7e('0x17')](zendesk['getZendeskAccounts']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x20')]())[_0x8b7e('0x17')](salesforce[_0x8b7e('0x21')]())[_0x8b7e('0x17')](realtime['initSalesforceAccounts']())['then'](sugarcrm['getSugarcrmAccounts']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x22')]())[_0x8b7e('0x17')](freshdesk[_0x8b7e('0x23')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x24')]())[_0x8b7e('0x17')](desk['getDeskAccounts']())['then'](realtime[_0x8b7e('0x25')]())[_0x8b7e('0x17')](zoho['getZohoAccounts']())[_0x8b7e('0x17')](realtime[_0x8b7e('0x26')]())[_0x8b7e('0x17')](vtiger[_0x8b7e('0x27')]())[_0x8b7e('0x17')](realtime['initVtigerAccounts']())[_0x8b7e('0x17')](freshsales[_0x8b7e('0x28')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x29')]())['then'](servicenow[_0x8b7e('0x2a')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x2b')]())[_0x8b7e('0x17')](dynamics365[_0x8b7e('0x2c')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x2d')]())[_0x8b7e('0x17')](campaign[_0x8b7e('0x2e')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x2f')]())[_0x8b7e('0x17')](voiceExtension[_0x8b7e('0x30')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x31')]())['then'](faxAccount[_0x8b7e('0x32')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x33')]())[_0x8b7e('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x8b7e('0x16')]()[_0x8b7e('0x17')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x8b7e('0x34')]())[_0x8b7e('0x17')](cmHopperHistory[_0x8b7e('0x35')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x36')]())[_0x8b7e('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0x8b7e('0x17')](realtime['initCampaignHopperHistory']())[_0x8b7e('0x17')](voiceCallReport[_0x8b7e('0x37')]())[_0x8b7e('0x17')](realtime[_0x8b7e('0x38')]())[_0x8b7e('0x17')](function(_0xf9e6f0){})[_0x8b7e('0x39')](function(_0x4fa775){console[_0x8b7e('0x3a')](_0x4fa775);});}function main(){return server[_0x8b7e('0x3b')](realtime,preview,fax)['then'](function(_0x1d6762){return initRealtime();})[_0x8b7e('0x17')](function(){return initParams();})[_0x8b7e('0x17')](function(){report[_0x8b7e('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3372be){console[_0x8b7e('0x3a')](_0x3372be);});}main(); \ No newline at end of file +var _0x8221=['initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x8221,0xaa));var _0x1822=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x8221[_0x1602ef];return _0x5870ee;};'use strict';var BPromise=require(_0x1822('0x0'));var util=require(_0x1822('0x1'));var moment=require(_0x1822('0x2'));var server=require(_0x1822('0x3'));var Realtime=require('./realtime');var Report=require(_0x1822('0x4'));var Acw=require(_0x1822('0x5'));var Trigger=require(_0x1822('0x6'));var Dialer=require(_0x1822('0x7'));var Preview=require(_0x1822('0x8'));var Fax=require(_0x1822('0x9'));var user=require(_0x1822('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x1822('0xb'));var voiceCallReport=require(_0x1822('0xc'));var trunk=require(_0x1822('0xd'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x1822('0xe'));var campaign=require(_0x1822('0xf'));var voiceExtension=require(_0x1822('0x10'));var faxAccount=require(_0x1822('0x11'));var zendesk=require(_0x1822('0x12'));var salesforce=require(_0x1822('0x13'));var sugarcrm=require(_0x1822('0x14'));var freshdesk=require(_0x1822('0x15'));var desk=require(_0x1822('0x16'));var zoho=require(_0x1822('0x17'));var vtiger=require(_0x1822('0x18'));var freshsales=require(_0x1822('0x19'));var servicenow=require(_0x1822('0x1a'));var dynamics365=require(_0x1822('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1822('0x1c')](_0x1822('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1822('0x1e')]()[_0x1822('0x1f')](user['getAgents']())[_0x1822('0x1f')](realtime[_0x1822('0x20')]())[_0x1822('0x1f')](user[_0x1822('0x21')]())[_0x1822('0x1f')](realtime[_0x1822('0x22')]())[_0x1822('0x1f')](trunk[_0x1822('0x23')]())[_0x1822('0x1f')](realtime[_0x1822('0x24')]())[_0x1822('0x1f')](voiceQueue[_0x1822('0x25')]())['then'](realtime[_0x1822('0x26')]())['then'](trigger[_0x1822('0x27')]())['then'](realtime[_0x1822('0x28')]())[_0x1822('0x1f')](template[_0x1822('0x29')]())[_0x1822('0x1f')](realtime[_0x1822('0x2a')]())['then'](zendesk['getZendeskAccounts']())[_0x1822('0x1f')](realtime[_0x1822('0x2b')]())[_0x1822('0x1f')](salesforce[_0x1822('0x2c')]())[_0x1822('0x1f')](realtime[_0x1822('0x2d')]())[_0x1822('0x1f')](sugarcrm[_0x1822('0x2e')]())['then'](realtime[_0x1822('0x2f')]())['then'](freshdesk[_0x1822('0x30')]())['then'](realtime['initFreshdeskAccounts']())[_0x1822('0x1f')](desk[_0x1822('0x31')]())[_0x1822('0x1f')](realtime[_0x1822('0x32')]())[_0x1822('0x1f')](zoho[_0x1822('0x33')]())['then'](realtime[_0x1822('0x34')]())[_0x1822('0x1f')](vtiger[_0x1822('0x35')]())[_0x1822('0x1f')](realtime[_0x1822('0x36')]())[_0x1822('0x1f')](freshsales['getFreshsalesAccounts']())[_0x1822('0x1f')](realtime[_0x1822('0x37')]())[_0x1822('0x1f')](servicenow['getServicenowAccounts']())[_0x1822('0x1f')](realtime[_0x1822('0x38')]())[_0x1822('0x1f')](dynamics365['getDynamics365Accounts']())[_0x1822('0x1f')](realtime[_0x1822('0x39')]())[_0x1822('0x1f')](campaign[_0x1822('0x3a')]())[_0x1822('0x1f')](realtime['initCampaigns']())['then'](voiceExtension['getVoiceExtensions']())[_0x1822('0x1f')](realtime[_0x1822('0x3b')]())['then'](faxAccount[_0x1822('0x3c')]())[_0x1822('0x1f')](realtime[_0x1822('0x3d')]())[_0x1822('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x1822('0x1e')]()[_0x1822('0x1f')](voiceQueueReport[_0x1822('0x3e')]())[_0x1822('0x1f')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x1822('0x3f')]())[_0x1822('0x1f')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x1822('0x40')]())[_0x1822('0x1f')](realtime[_0x1822('0x41')]())[_0x1822('0x1f')](voiceCallReport['getVoiceCallReports']())[_0x1822('0x1f')](realtime[_0x1822('0x42')]())[_0x1822('0x1f')](function(_0x370736){})[_0x1822('0x43')](function(_0x1b0ba8){console['log'](_0x1b0ba8);});}function main(){return server[_0x1822('0x44')](realtime,preview,fax)['then'](function(_0x18f2fe){return initRealtime();})[_0x1822('0x1f')](function(){return initParams();})[_0x1822('0x1f')](function(){report[_0x1822('0x45')]();setInterval(initRealtime,0x1388);})[_0x1822('0x43')](function(_0x1ecd59){console[_0x1822('0x46')](_0x1ecd59);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1da24b8..ed29c05 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 _0xf22c=['ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','prototype','toLowerCase','not_inuse','talking','toNumber','format','voiceStatusQueue','onhold','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5'];(function(_0xfd066f,_0x192341){var _0x28767d=function(_0x1b962b){while(--_0x1b962b){_0xfd066f['push'](_0xfd066f['shift']());}};_0x28767d(++_0x192341);}(_0xf22c,0x88));var _0xcf22=function(_0x46697f,_0x45e50e){_0x46697f=_0x46697f-0x0;var _0xd0ad9=_0xf22c[_0x46697f];return _0xd0ad9;};'use strict';var _=require(_0xcf22('0x0'));var util=require(_0xcf22('0x1'));var moment=require(_0xcf22('0x2'));var md5=require(_0xcf22('0x3'));var Redis=require(_0xcf22('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xcf22('0x5')],{'host':_0xcf22('0x6'),'port':0x18eb});var io=require(_0xcf22('0x7'))(new Redis(config['redis']));function Agent(_0x44e306){this['id']=_0x44e306['id']||0x0;this[_0xcf22('0x8')]=_0x44e306[_0xcf22('0x8')]||'';this[_0xcf22('0x9')]=_0x44e306[_0xcf22('0x9')]||'';this[_0xcf22('0xa')]=_0x44e306[_0xcf22('0xa')]||'';this[_0xcf22('0xb')]=_0x44e306[_0xcf22('0xb')]||'';this[_0xcf22('0xc')]='unknown';this[_0xcf22('0xd')]=0x0;this[_0xcf22('0xe')]=_0xcf22('0xf');this[_0xcf22('0x10')]='';this['phone']='';this[_0xcf22('0x11')]='';this['interface']='';this[_0xcf22('0x12')]=_0x44e306['online']||![];this[_0xcf22('0x13')]=_0xcf22('0xf');this[_0xcf22('0x14')]=0x0;this[_0xcf22('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0xcf22('0x3')]='';}Agent[_0xcf22('0x16')]['updateStatusRealtime']=function(_0x4b93de){var _0x4f91b9;if(_0x4b93de&&_0x4b93de['state']){_0x4f91b9=_0x4b93de[_0xcf22('0xc')][_0xcf22('0x17')]();switch(_0x4f91b9){case _0xcf22('0x18'):_0x4f91b9='idle';break;case'inuse':_0x4f91b9=_0xcf22('0x19');break;}}if(_0x4f91b9&&this[_0xcf22('0x13')]!==_0x4f91b9||_0x4b93de['statePause']){this[_0xcf22('0x14')]=_[_0xcf22('0x1a')](moment()[_0xcf22('0x1b')]('x'));}if(_0x4f91b9){this['voiceStatus']=_0x4f91b9;}var _0x3fa154={'id':this['id'],'name':this[_0xcf22('0x8')],'email':this[_0xcf22('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xcf22('0xb')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0xcf22('0x12')],'voiceStatus':this[_0xcf22('0x13')],'voiceStatusTime':this[_0xcf22('0x14')],'voiceStatusCallerIdNumber':this[_0xcf22('0x15')],'voiceStatusQueue':this[_0xcf22('0x1c')],'interface':this['interface'],'onhold':this[_0xcf22('0x1d')]};var _0x2fac88=md5(JSON[_0xcf22('0x1e')](_0x3fa154));if(this['md5']!==_0x2fac88){this['md5']=_0x2fac88;io['to'](util['format'](_0xcf22('0x1f'),_0x3fa154['name']))[_0xcf22('0x20')](_0xcf22('0x21'),_0x3fa154);}};module[_0xcf22('0x22')]=Agent; \ No newline at end of file +var _0x7c02=['name','email','accountcode','fullname','state','unknown','stateTime','status','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','address','onhold','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter'];(function(_0xb34da7,_0x232e55){var _0x22c1c5=function(_0x36df2d){while(--_0x36df2d){_0xb34da7['push'](_0xb34da7['shift']());}};_0x22c1c5(++_0x232e55);}(_0x7c02,0x6f));var _0x27c0=function(_0x511630,_0x23f1f2){_0x511630=_0x511630-0x0;var _0x2b2d03=_0x7c02[_0x511630];return _0x2b2d03;};'use strict';var _=require(_0x27c0('0x0'));var util=require(_0x27c0('0x1'));var moment=require(_0x27c0('0x2'));var md5=require(_0x27c0('0x3'));var Redis=require(_0x27c0('0x4'));var config=require(_0x27c0('0x5'));config[_0x27c0('0x6')]=_['defaults'](config['redis'],{'host':_0x27c0('0x7'),'port':0x18eb});var io=require(_0x27c0('0x8'))(new Redis(config[_0x27c0('0x6')]));function Agent(_0x309486){this['id']=_0x309486['id']||0x0;this[_0x27c0('0x9')]=_0x309486[_0x27c0('0x9')]||'';this[_0x27c0('0xa')]=_0x309486[_0x27c0('0xa')]||'';this[_0x27c0('0xb')]=_0x309486[_0x27c0('0xb')]||'';this[_0x27c0('0xc')]=_0x309486[_0x27c0('0xc')]||'';this[_0x27c0('0xd')]=_0x27c0('0xe');this[_0x27c0('0xf')]=0x0;this[_0x27c0('0x10')]='unknown';this['address']='';this['phone']='';this[_0x27c0('0x11')]='';this['interface']='';this[_0x27c0('0x12')]=_0x309486['online']||![];this['voiceStatus']=_0x27c0('0xe');this[_0x27c0('0x13')]=0x0;this[_0x27c0('0x14')]='';this[_0x27c0('0x15')]='';this['onhold']=![];this[_0x27c0('0x16')]=![];this['md5']='';}Agent[_0x27c0('0x17')][_0x27c0('0x18')]=function(_0x38f564){var _0x2fb755;if(_0x38f564&&_0x38f564[_0x27c0('0xd')]){_0x2fb755=_0x38f564[_0x27c0('0xd')]['toLowerCase']();switch(_0x2fb755){case _0x27c0('0x19'):_0x2fb755=_0x27c0('0x1a');break;case _0x27c0('0x1b'):_0x2fb755=_0x27c0('0x1c');break;}}if(_0x2fb755&&this[_0x27c0('0x1d')]!==_0x2fb755||_0x38f564[_0x27c0('0x1e')]){this[_0x27c0('0x13')]=_[_0x27c0('0x1f')](moment()[_0x27c0('0x20')]('x'));}if(_0x2fb755){this[_0x27c0('0x1d')]=_0x2fb755;}var _0x479270={'id':this['id'],'name':this[_0x27c0('0x9')],'email':this[_0x27c0('0xa')],'accountcode':this[_0x27c0('0xb')],'fullname':this[_0x27c0('0xc')],'state':this[_0x27c0('0xd')],'stateTime':this[_0x27c0('0xf')],'status':this[_0x27c0('0x10')],'address':this[_0x27c0('0x21')],'online':this['online'],'voiceStatus':this[_0x27c0('0x1d')],'voiceStatusTime':this[_0x27c0('0x13')],'voiceStatusCallerIdNumber':this[_0x27c0('0x14')],'voiceStatusQueue':this[_0x27c0('0x15')],'interface':this['interface'],'onhold':this[_0x27c0('0x22')]};var _0x57c86c=md5(JSON[_0x27c0('0x23')](_0x479270));if(this[_0x27c0('0x3')]!==_0x57c86c){this[_0x27c0('0x3')]=_0x57c86c;io['to'](util[_0x27c0('0x20')](_0x27c0('0x24'),_0x479270['name']))[_0x27c0('0x25')](_0x27c0('0x26'),_0x479270);}};module[_0x27c0('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6a0d806..67d086d 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 _0x9b15=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x114e73,_0x1ccb13){var _0x673e28=function(_0x5e894a){while(--_0x5e894a){_0x114e73['push'](_0x114e73['shift']());}};_0x673e28(++_0x1ccb13);}(_0x9b15,0x191));var _0x59b1=function(_0x5e9ff7,_0x327315){_0x5e9ff7=_0x5e9ff7-0x0;var _0x49f6a2=_0x9b15[_0x5e9ff7];return _0x49f6a2;};'use strict';function Campaign(_0x23303e){this['id']=_0x23303e['id']||0x0;this[_0x59b1('0x0')]=_0x23303e[_0x59b1('0x0')]||'';this[_0x59b1('0x1')]=_0x23303e[_0x59b1('0x1')]||_0x59b1('0x2');this[_0x59b1('0x3')]=0x0;this[_0x59b1('0x4')]=0x0;this[_0x59b1('0x5')]=0x0;this[_0x59b1('0x6')]=0x0;this[_0x59b1('0x7')]='';this[_0x59b1('0x8')]=!![];this[_0x59b1('0x9')]=_0x23303e[_0x59b1('0x9')];this['limitCalls']=_0x23303e[_0x59b1('0xa')];this['dialTimezone']=_0x23303e[_0x59b1('0xb')]||null;this[_0x59b1('0xc')]=_0x23303e[_0x59b1('0xc')]?_0x23303e['dialGlobalInterval']:null;this[_0x59b1('0xd')]=_0x23303e[_0x59b1('0xd')];this[_0x59b1('0xe')]=_0x23303e[_0x59b1('0xe')];this[_0x59b1('0xf')]=_0x23303e[_0x59b1('0xf')]||0x1e;this[_0x59b1('0x10')]=_0x23303e[_0x59b1('0x10')];this[_0x59b1('0x11')]=_0x23303e[_0x59b1('0x11')];this[_0x59b1('0x12')]=_0x23303e[_0x59b1('0x12')];this['dialBusyRetryFrequency']=_0x23303e[_0x59b1('0x13')];this[_0x59b1('0x14')]=_0x23303e['dialNoAnswerMaxRetry'];this[_0x59b1('0x15')]=_0x23303e[_0x59b1('0x15')];this[_0x59b1('0x16')]=_0x23303e[_0x59b1('0x16')];this[_0x59b1('0x17')]=_0x23303e[_0x59b1('0x17')]||0x3;this[_0x59b1('0x18')]=_0x23303e[_0x59b1('0x18')]||0x96;this[_0x59b1('0x19')]=_0x23303e[_0x59b1('0x19')]||0x3;this[_0x59b1('0x1a')]=_0x23303e[_0x59b1('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x23303e['dialAbandonedMaxRetry']||0x3;this[_0x59b1('0x1b')]=_0x23303e['dialAbandonedRetryFrequency']||0x96;this[_0x59b1('0x1c')]=_0x23303e['dialMachineMaxRetry']||0x3;this[_0x59b1('0x1d')]=_0x23303e[_0x59b1('0x1d')]||0x96;this[_0x59b1('0x1e')]=_0x23303e['dialAgentRejectMaxRetry']||0x3;this[_0x59b1('0x1f')]=_0x23303e[_0x59b1('0x1f')]||0x96;this[_0x59b1('0x20')]=_0x23303e[_0x59b1('0x20')]||_0x59b1('0x21');this['dialPrefix']=_0x23303e[_0x59b1('0x22')]||undefined;this[_0x59b1('0x23')]=_0x23303e[_0x59b1('0x23')]||undefined;this['dialCutDigit']=_0x23303e[_0x59b1('0x24')]||undefined;this[_0x59b1('0x25')]=_0x23303e[_0x59b1('0x25')]?_0x23303e[_0x59b1('0x25')]:undefined;this[_0x59b1('0x26')]=_0x23303e[_0x59b1('0x26')]?_0x23303e[_0x59b1('0x26')]:undefined;this['Interval']=_0x23303e[_0x59b1('0x27')]?_0x23303e[_0x59b1('0x27')]:undefined;this[_0x59b1('0x28')]=_0x23303e[_0x59b1('0x28')]?_0x23303e[_0x59b1('0x28')]:undefined;this[_0x59b1('0x29')]=_0x23303e[_0x59b1('0x28')]?_0x23303e[_0x59b1('0x28')]['name']:undefined;this[_0x59b1('0x2a')]=_0x23303e[_0x59b1('0x2a')]||![];this[_0x59b1('0x2b')]=_0x23303e[_0x59b1('0x2b')];this[_0x59b1('0x2c')]=_0x23303e[_0x59b1('0x2c')];this[_0x59b1('0x2d')]=_0x23303e[_0x59b1('0x2d')];this[_0x59b1('0x2e')]=_0x23303e['dialAMDTotalAnalysisTime'];this[_0x59b1('0x2f')]=_0x23303e[_0x59b1('0x2f')];this[_0x59b1('0x30')]=_0x23303e[_0x59b1('0x30')];this[_0x59b1('0x31')]=_0x23303e[_0x59b1('0x31')];this[_0x59b1('0x32')]=_0x23303e['dialAMDSilenceThreshold'];this[_0x59b1('0x33')]=_0x23303e[_0x59b1('0x33')];}module[_0x59b1('0x34')]=Campaign; \ No newline at end of file +var _0x4977=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x9afd90,_0x55b893){var _0x1c89df=function(_0x101249){while(--_0x101249){_0x9afd90['push'](_0x9afd90['shift']());}};_0x1c89df(++_0x55b893);}(_0x4977,0x103));var _0x7497=function(_0x445327,_0x4f51d4){_0x445327=_0x445327-0x0;var _0x5da98e=_0x4977[_0x445327];return _0x5da98e;};'use strict';function Campaign(_0x1c41eb){this['id']=_0x1c41eb['id']||0x0;this[_0x7497('0x0')]=_0x1c41eb[_0x7497('0x0')]||'';this['type']=_0x1c41eb['type']||_0x7497('0x1');this[_0x7497('0x2')]=0x0;this[_0x7497('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7497('0x4')]='';this[_0x7497('0x5')]=!![];this[_0x7497('0x6')]=_0x1c41eb[_0x7497('0x6')];this['limitCalls']=_0x1c41eb[_0x7497('0x7')];this[_0x7497('0x8')]=_0x1c41eb[_0x7497('0x8')]||null;this[_0x7497('0x9')]=_0x1c41eb[_0x7497('0x9')]?_0x1c41eb[_0x7497('0x9')]:null;this[_0x7497('0xa')]=_0x1c41eb[_0x7497('0xa')];this[_0x7497('0xb')]=_0x1c41eb[_0x7497('0xb')];this[_0x7497('0xc')]=_0x1c41eb[_0x7497('0xc')]||0x1e;this[_0x7497('0xd')]=_0x1c41eb['dialCongestionMaxRetry'];this[_0x7497('0xe')]=_0x1c41eb[_0x7497('0xe')];this[_0x7497('0xf')]=_0x1c41eb[_0x7497('0xf')];this[_0x7497('0x10')]=_0x1c41eb[_0x7497('0x10')];this[_0x7497('0x11')]=_0x1c41eb[_0x7497('0x11')];this[_0x7497('0x12')]=_0x1c41eb['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1c41eb[_0x7497('0x13')];this[_0x7497('0x14')]=_0x1c41eb['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1c41eb[_0x7497('0x15')]||0x96;this[_0x7497('0x16')]=_0x1c41eb[_0x7497('0x16')]||0x3;this[_0x7497('0x17')]=_0x1c41eb[_0x7497('0x17')]||0x96;this[_0x7497('0x18')]=_0x1c41eb[_0x7497('0x18')]||0x3;this[_0x7497('0x19')]=_0x1c41eb[_0x7497('0x19')]||0x96;this['dialMachineMaxRetry']=_0x1c41eb[_0x7497('0x1a')]||0x3;this[_0x7497('0x1b')]=_0x1c41eb[_0x7497('0x1b')]||0x96;this[_0x7497('0x1c')]=_0x1c41eb[_0x7497('0x1c')]||0x3;this[_0x7497('0x1d')]=_0x1c41eb[_0x7497('0x1d')]||0x96;this[_0x7497('0x1e')]=_0x1c41eb['dialOrderByScheduledAt']||_0x7497('0x1f');this[_0x7497('0x20')]=_0x1c41eb[_0x7497('0x20')]||undefined;this[_0x7497('0x21')]=_0x1c41eb[_0x7497('0x21')]||undefined;this[_0x7497('0x22')]=_0x1c41eb[_0x7497('0x22')]||undefined;this['TrunkBackup']=_0x1c41eb[_0x7497('0x23')]?_0x1c41eb[_0x7497('0x23')]:undefined;this[_0x7497('0x24')]=_0x1c41eb[_0x7497('0x24')]?_0x1c41eb[_0x7497('0x24')]:undefined;this[_0x7497('0x25')]=_0x1c41eb[_0x7497('0x25')]?_0x1c41eb[_0x7497('0x25')]:undefined;this[_0x7497('0x26')]=_0x1c41eb[_0x7497('0x26')]?_0x1c41eb[_0x7497('0x26')]:undefined;this['dialQueueProject']=_0x1c41eb[_0x7497('0x26')]?_0x1c41eb['SquareProject'][_0x7497('0x0')]:undefined;this[_0x7497('0x27')]=_0x1c41eb[_0x7497('0x27')]||![];this[_0x7497('0x28')]=_0x1c41eb[_0x7497('0x28')];this[_0x7497('0x29')]=_0x1c41eb[_0x7497('0x29')];this[_0x7497('0x2a')]=_0x1c41eb[_0x7497('0x2a')];this[_0x7497('0x2b')]=_0x1c41eb[_0x7497('0x2b')];this[_0x7497('0x2c')]=_0x1c41eb[_0x7497('0x2c')];this[_0x7497('0x2d')]=_0x1c41eb[_0x7497('0x2d')];this[_0x7497('0x2e')]=_0x1c41eb['dialAMDMaximumNumberOfWords'];this[_0x7497('0x2f')]=_0x1c41eb[_0x7497('0x2f')];this[_0x7497('0x30')]=_0x1c41eb['dialAMDMaximumWordLength'];}module[_0x7497('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 855f77b..8346038 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 _0x1c45=['lastdata','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication'];(function(_0x47b6fc,_0x125766){var _0x2e424b=function(_0x2db4d0){while(--_0x2db4d0){_0x47b6fc['push'](_0x47b6fc['shift']());}};_0x2e424b(++_0x125766);}(_0x1c45,0x1b0));var _0x51c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1c45[_0xa464c9];return _0x3d73c4;};'use strict';function Channel(){this[_0x51c4('0x0')]=null;this[_0x51c4('0x1')]='';this[_0x51c4('0x2')]='';this[_0x51c4('0x3')]=0x0;this[_0x51c4('0x4')]='';this[_0x51c4('0x5')]=undefined;this[_0x51c4('0x6')]=undefined;this[_0x51c4('0x7')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x51c4('0x8')]=0x0;this[_0x51c4('0x9')]=0x0;this[_0x51c4('0xa')]=![];this[_0x51c4('0xb')]=null;this[_0x51c4('0xc')]=null;this[_0x51c4('0xd')]=![];this[_0x51c4('0xe')]=![];this[_0x51c4('0xf')]='';this[_0x51c4('0x10')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x51c4('0x11')]=0x0;this[_0x51c4('0x12')]=null;this[_0x51c4('0x13')]=null;this[_0x51c4('0x14')]=null;this[_0x51c4('0x15')]=![];this[_0x51c4('0x16')]=null;this['queue']=null;this[_0x51c4('0x17')]=[];this[_0x51c4('0x18')]=undefined;this[_0x51c4('0x19')]=undefined;this[_0x51c4('0x1a')]=0x0;}module[_0x51c4('0x1b')]=Channel; \ No newline at end of file +var _0x1c7c=['linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1e809f,_0x4fbeb1){_0x1e809f=_0x1e809f-0x0;var _0x46d1a9=_0x1c7c[_0x1e809f];return _0x46d1a9;};'use strict';function Channel(){this[_0xc1c7('0x0')]=null;this[_0xc1c7('0x1')]='';this[_0xc1c7('0x2')]='';this[_0xc1c7('0x3')]=0x0;this['calleridname']='';this[_0xc1c7('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xc1c7('0x5')]=0x0;this[_0xc1c7('0x6')]='';this[_0xc1c7('0x7')]=0x0;this[_0xc1c7('0x8')]=0x0;this[_0xc1c7('0x9')]=0x0;this[_0xc1c7('0xa')]=![];this[_0xc1c7('0xb')]=null;this[_0xc1c7('0xc')]=null;this[_0xc1c7('0xd')]=![];this[_0xc1c7('0xe')]=![];this[_0xc1c7('0xf')]='';this[_0xc1c7('0x10')]='';this[_0xc1c7('0x11')]=0x0;this[_0xc1c7('0x12')]=0x0;this[_0xc1c7('0x13')]=0x0;this[_0xc1c7('0x14')]=null;this[_0xc1c7('0x15')]=null;this['disposition']=null;this[_0xc1c7('0x16')]=![];this[_0xc1c7('0x17')]=null;this['queue']=null;this[_0xc1c7('0x18')]=[];this[_0xc1c7('0x19')]=undefined;this[_0xc1c7('0x1a')]=undefined;this['mohtime']=0x0;}module[_0xc1c7('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9ad882d..8877223 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 _0xea03=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0xea03,0x1ba));var _0x3ea0=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xea03[_0x31e29a];return _0x32d892;};'use strict';function DeskAccount(_0x3fb489){this['id']=_0x3fb489['id']||0x0;this['name']=_0x3fb489[_0x3ea0('0x0')]||'';this[_0x3ea0('0x1')]=_0x3fb489[_0x3ea0('0x1')]||'';this[_0x3ea0('0x2')]=_0x3fb489[_0x3ea0('0x2')]||'';this['authType']=_0x3fb489['authType']||'';this['password']=_0x3fb489[_0x3ea0('0x3')]||'';this[_0x3ea0('0x4')]=_0x3fb489[_0x3ea0('0x4')]||'';this[_0x3ea0('0x5')]=_0x3fb489[_0x3ea0('0x5')]||'';this['token']=_0x3fb489[_0x3ea0('0x6')]||'';this[_0x3ea0('0x7')]=_0x3fb489[_0x3ea0('0x7')]||'';this[_0x3ea0('0x8')]=_0x3fb489[_0x3ea0('0x8')]||'';this[_0x3ea0('0x9')]=_0x3fb489[_0x3ea0('0x9')]||'';this['Configurations']=_0x3fb489[_0x3ea0('0xa')]||{};}module[_0x3ea0('0xb')]=DeskAccount; \ No newline at end of file +var _0xb458=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerSecret'];(function(_0x39b7d4,_0x31d6c9){var _0x321014=function(_0x354974){while(--_0x354974){_0x39b7d4['push'](_0x39b7d4['shift']());}};_0x321014(++_0x31d6c9);}(_0xb458,0x103));var _0x8b45=function(_0x3907f1,_0x20eee7){_0x3907f1=_0x3907f1-0x0;var _0x37c3ae=_0xb458[_0x3907f1];return _0x37c3ae;};'use strict';function DeskAccount(_0x4c884c){this['id']=_0x4c884c['id']||0x0;this[_0x8b45('0x0')]=_0x4c884c[_0x8b45('0x0')]||'';this['username']=_0x4c884c['username']||'';this[_0x8b45('0x1')]=_0x4c884c[_0x8b45('0x1')]||'';this[_0x8b45('0x2')]=_0x4c884c[_0x8b45('0x2')]||'';this['password']=_0x4c884c[_0x8b45('0x3')]||'';this['consumerKey']=_0x4c884c['consumerKey']||'';this[_0x8b45('0x4')]=_0x4c884c[_0x8b45('0x4')]||'';this[_0x8b45('0x5')]=_0x4c884c[_0x8b45('0x5')]||'';this[_0x8b45('0x6')]=_0x4c884c['tokenSecret']||'';this[_0x8b45('0x7')]=_0x4c884c[_0x8b45('0x7')]||'';this[_0x8b45('0x8')]=_0x4c884c[_0x8b45('0x8')]||'';this[_0x8b45('0x9')]=_0x4c884c['Configurations']||{};}module[_0x8b45('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 1790b92..d8344f0 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 _0xc196=['clientId','clientSecret','serverUrl','Configurations','name','password','remoteUri','tenantId'];(function(_0x2467bf,_0x16eb13){var _0x5a8e82=function(_0xb16ad1){while(--_0xb16ad1){_0x2467bf['push'](_0x2467bf['shift']());}};_0x5a8e82(++_0x16eb13);}(_0xc196,0x9c));var _0x6c19=function(_0xd75577,_0x4f6e3d){_0xd75577=_0xd75577-0x0;var _0xb081cc=_0xc196[_0xd75577];return _0xb081cc;};'use strict';function Dynamics365Account(_0x31be2f){this['id']=_0x31be2f['id']||0x0;this[_0x6c19('0x0')]=_0x31be2f[_0x6c19('0x0')]||'';this['username']=_0x31be2f['username']||'';this[_0x6c19('0x1')]=_0x31be2f[_0x6c19('0x1')]||'';this[_0x6c19('0x2')]=_0x31be2f['remoteUri']||'';this[_0x6c19('0x3')]=_0x31be2f[_0x6c19('0x3')]||'';this[_0x6c19('0x4')]=_0x31be2f[_0x6c19('0x4')]||'';this[_0x6c19('0x5')]=_0x31be2f['clientSecret']||{};this[_0x6c19('0x6')]=_0x31be2f[_0x6c19('0x6')]||'';this[_0x6c19('0x7')]=_0x31be2f[_0x6c19('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x5fde=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x3dac83,_0x2a89b7){var _0x5ab791=function(_0x593efc){while(--_0x593efc){_0x3dac83['push'](_0x3dac83['shift']());}};_0x5ab791(++_0x2a89b7);}(_0x5fde,0xc2));var _0xe5fd=function(_0x4bb632,_0x5176c9){_0x4bb632=_0x4bb632-0x0;var _0x39ec02=_0x5fde[_0x4bb632];return _0x39ec02;};'use strict';function Dynamics365Account(_0x5e6c8a){this['id']=_0x5e6c8a['id']||0x0;this[_0xe5fd('0x0')]=_0x5e6c8a['name']||'';this['username']=_0x5e6c8a[_0xe5fd('0x1')]||'';this['password']=_0x5e6c8a[_0xe5fd('0x2')]||'';this[_0xe5fd('0x3')]=_0x5e6c8a[_0xe5fd('0x3')]||'';this[_0xe5fd('0x4')]=_0x5e6c8a[_0xe5fd('0x4')]||'';this[_0xe5fd('0x5')]=_0x5e6c8a['clientId']||'';this[_0xe5fd('0x6')]=_0x5e6c8a['clientSecret']||{};this[_0xe5fd('0x7')]=_0x5e6c8a[_0xe5fd('0x7')]||'';this[_0xe5fd('0x8')]=_0x5e6c8a['Configurations']||{};}module[_0xe5fd('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2d1f3b2..632e91d 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 _0xc558=['key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc558,0x79));var _0x8c55=function(_0x3f988a,_0x1ce0be){_0x3f988a=_0x3f988a-0x0;var _0x37c39b=_0xc558[_0x3f988a];return _0x37c39b;};'use strict';function FaxAccount(_0x1e2796){this['id']=_0x1e2796['id']||0x0;this['name']=_0x1e2796['name']||'';this[_0x8c55('0x0')]=_0x1e2796['description'];this[_0x8c55('0x1')]=_0x1e2796['ecm'];this[_0x8c55('0x2')]=_0x1e2796[_0x8c55('0x2')];this['localstationid']=_0x1e2796[_0x8c55('0x3')];this[_0x8c55('0x4')]=_0x1e2796['minrate']||0x960;this['maxrate']=_0x1e2796[_0x8c55('0x5')]||0x3840;this[_0x8c55('0x6')]=_0x1e2796[_0x8c55('0x6')]||_0x8c55('0x7');this[_0x8c55('0x8')]=_0x1e2796[_0x8c55('0x8')]||'no';this[_0x8c55('0x9')]=_0x1e2796[_0x8c55('0x9')]||'no';this['t38timeout']=_0x1e2796[_0x8c55('0xa')]||0x1388;this[_0x8c55('0xb')]=_0x1e2796['tech']||_0x8c55('0xc');this[_0x8c55('0xd')]=_0x1e2796[_0x8c55('0xd')]?_0x1e2796[_0x8c55('0xd')]:undefined;this['ListId']=_0x1e2796[_0x8c55('0xe')];this[_0x8c55('0xf')]=_0x1e2796[_0x8c55('0xf')];}module[_0x8c55('0x10')]=FaxAccount; \ No newline at end of file +var _0x62a7=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x19eb57,_0x2cbd82){var _0x2abd76=function(_0x36b860){while(--_0x36b860){_0x19eb57['push'](_0x19eb57['shift']());}};_0x2abd76(++_0x2cbd82);}(_0x62a7,0x84));var _0x762a=function(_0x1bff41,_0x386880){_0x1bff41=_0x1bff41-0x0;var _0x4db66b=_0x62a7[_0x1bff41];return _0x4db66b;};'use strict';function FaxAccount(_0x303ad2){this['id']=_0x303ad2['id']||0x0;this[_0x762a('0x0')]=_0x303ad2[_0x762a('0x0')]||'';this[_0x762a('0x1')]=_0x303ad2[_0x762a('0x1')];this[_0x762a('0x2')]=_0x303ad2[_0x762a('0x2')];this[_0x762a('0x3')]=_0x303ad2[_0x762a('0x3')];this[_0x762a('0x4')]=_0x303ad2['localstationid'];this[_0x762a('0x5')]=_0x303ad2[_0x762a('0x5')]||0x960;this['maxrate']=_0x303ad2[_0x762a('0x6')]||0x3840;this[_0x762a('0x7')]=_0x303ad2[_0x762a('0x7')]||_0x762a('0x8');this[_0x762a('0x9')]=_0x303ad2[_0x762a('0x9')]||'no';this[_0x762a('0xa')]=_0x303ad2[_0x762a('0xa')]||'no';this['t38timeout']=_0x303ad2[_0x762a('0xb')]||0x1388;this['tech']=_0x303ad2[_0x762a('0xc')]||_0x762a('0xd');this[_0x762a('0xe')]=_0x303ad2[_0x762a('0xe')]?_0x303ad2[_0x762a('0xe')]:undefined;this[_0x762a('0xf')]=_0x303ad2[_0x762a('0xf')];this[_0x762a('0x10')]=_0x303ad2['key'];}module[_0x762a('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f9e7bb1..9ed36b4 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 _0x1744=['Configurations','exports','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4e9f1a,_0x35e3f3){var _0x441f20=function(_0x25f063){while(--_0x25f063){_0x4e9f1a['push'](_0x4e9f1a['shift']());}};_0x441f20(++_0x35e3f3);}(_0x1744,0xf7));var _0x4174=function(_0x2fb453,_0x19dc6f){_0x2fb453=_0x2fb453-0x0;var _0x3e47be=_0x1744[_0x2fb453];return _0x3e47be;};'use strict';function FreshdeskAccount(_0x5ab4d8){this['id']=_0x5ab4d8['id']||0x0;this['name']=_0x5ab4d8['name']||'';this[_0x4174('0x0')]=_0x5ab4d8['username']||'';this[_0x4174('0x1')]=_0x5ab4d8[_0x4174('0x2')]||'';this['remoteUri']=_0x5ab4d8[_0x4174('0x3')]||'';this[_0x4174('0x4')]=_0x5ab4d8[_0x4174('0x4')]||'';this[_0x4174('0x5')]=_0x5ab4d8[_0x4174('0x5')]||{};}module[_0x4174('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x48de=['name','username','apiKey','remoteUri','serverUrl','exports'];(function(_0x10980b,_0x347714){var _0x11ff47=function(_0x1e22f3){while(--_0x1e22f3){_0x10980b['push'](_0x10980b['shift']());}};_0x11ff47(++_0x347714);}(_0x48de,0x10e));var _0xe48d=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x48de[_0x550d12];return _0x12103d;};'use strict';function FreshdeskAccount(_0x1f72a0){this['id']=_0x1f72a0['id']||0x0;this[_0xe48d('0x0')]=_0x1f72a0[_0xe48d('0x0')]||'';this['username']=_0x1f72a0[_0xe48d('0x1')]||'';this[_0xe48d('0x2')]=_0x1f72a0['token']||'';this[_0xe48d('0x3')]=_0x1f72a0[_0xe48d('0x3')]||'';this[_0xe48d('0x4')]=_0x1f72a0[_0xe48d('0x4')]||'';this['Configurations']=_0x1f72a0['Configurations']||{};}module[_0xe48d('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e768fcb..782593f 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 _0xf6a4=['name','username','token','serverUrl','Configurations','exports'];(function(_0xf63d4e,_0xbc63d6){var _0x4aa0d3=function(_0xcd69cf){while(--_0xcd69cf){_0xf63d4e['push'](_0xf63d4e['shift']());}};_0x4aa0d3(++_0xbc63d6);}(_0xf6a4,0xb4));var _0x4f6a=function(_0xa4262b,_0x19294f){_0xa4262b=_0xa4262b-0x0;var _0x37480e=_0xf6a4[_0xa4262b];return _0x37480e;};'use strict';function FreshsalesAccount(_0x251175){this['id']=_0x251175['id']||0x0;this[_0x4f6a('0x0')]=_0x251175[_0x4f6a('0x0')]||'';this[_0x4f6a('0x1')]=_0x251175[_0x4f6a('0x1')]||'';this['apiKey']=_0x251175[_0x4f6a('0x2')]||'';this['remoteUri']=_0x251175['remoteUri']||'';this[_0x4f6a('0x3')]=_0x251175[_0x4f6a('0x3')]||'';this[_0x4f6a('0x4')]=_0x251175[_0x4f6a('0x4')]||{};}module[_0x4f6a('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xe597=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x4fdf94,_0x2c0b5d){var _0x99e069=function(_0x3d1d62){while(--_0x3d1d62){_0x4fdf94['push'](_0x4fdf94['shift']());}};_0x99e069(++_0x2c0b5d);}(_0xe597,0x157));var _0x7e59=function(_0x6863c,_0x590734){_0x6863c=_0x6863c-0x0;var _0x493c5b=_0xe597[_0x6863c];return _0x493c5b;};'use strict';function FreshsalesAccount(_0x49943e){this['id']=_0x49943e['id']||0x0;this[_0x7e59('0x0')]=_0x49943e[_0x7e59('0x0')]||'';this[_0x7e59('0x1')]=_0x49943e[_0x7e59('0x1')]||'';this[_0x7e59('0x2')]=_0x49943e[_0x7e59('0x3')]||'';this[_0x7e59('0x4')]=_0x49943e[_0x7e59('0x4')]||'';this[_0x7e59('0x5')]=_0x49943e['serverUrl']||'';this[_0x7e59('0x6')]=_0x49943e[_0x7e59('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1292690..8b098ff 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 _0x1b55=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt'];(function(_0x341c67,_0x471a5f){var _0x1966db=function(_0x10e062){while(--_0x10e062){_0x341c67['push'](_0x341c67['shift']());}};_0x1966db(++_0x471a5f);}(_0x1b55,0x1ca));var _0x51b5=function(_0x133442,_0x5c14f1){_0x133442=_0x133442-0x0;var _0x49d417=_0x1b55[_0x133442];return _0x49d417;};'use strict';function QueueReport(){this[_0x51b5('0x0')]=_0x51b5('0x1');this[_0x51b5('0x2')]='';this[_0x51b5('0x3')]='';this['calleridname']='';this[_0x51b5('0x4')]='';this[_0x51b5('0x5')]=null;this[_0x51b5('0x6')]=null;this[_0x51b5('0x7')]=0x1;this['count']=0x1;this[_0x51b5('0x8')]=![];this[_0x51b5('0x9')]=null;this[_0x51b5('0xa')]=![];this[_0x51b5('0xb')]=null;this['queuecallerexit']=![];this[_0x51b5('0xc')]=null;this[_0x51b5('0xd')]=0x1;this['channel']='';this[_0x51b5('0xe')]='';this[_0x51b5('0xf')]='';this[_0x51b5('0x10')]='';this[_0x51b5('0x11')]='';this[_0x51b5('0x12')]='';this[_0x51b5('0x13')]='';this[_0x51b5('0x14')]=0x0;this[_0x51b5('0x15')]=![];this[_0x51b5('0x16')]='';this[_0x51b5('0x17')]=0x0;this[_0x51b5('0x18')]={};}module[_0x51b5('0x19')]=QueueReport; \ No newline at end of file +var _0xcfe7=['calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','variables','exports','type','inbound'];(function(_0x5b7ca3,_0xe2c9db){var _0x3f48d5=function(_0x137e8e){while(--_0x137e8e){_0x5b7ca3['push'](_0x5b7ca3['shift']());}};_0x3f48d5(++_0xe2c9db);}(_0xcfe7,0xfb));var _0x7cfe=function(_0x36e872,_0x2cbdf8){_0x36e872=_0x36e872-0x0;var _0x1601b6=_0xcfe7[_0x36e872];return _0x1601b6;};'use strict';function QueueReport(){this[_0x7cfe('0x0')]=_0x7cfe('0x1');this['uniqueid']='';this[_0x7cfe('0x2')]='';this[_0x7cfe('0x3')]='';this['queue']='';this[_0x7cfe('0x4')]=null;this[_0x7cfe('0x5')]=null;this[_0x7cfe('0x6')]=0x1;this['count']=0x1;this[_0x7cfe('0x7')]=![];this[_0x7cfe('0x8')]=null;this[_0x7cfe('0x9')]=![];this[_0x7cfe('0xa')]=null;this[_0x7cfe('0xb')]=![];this['queuecallerexitAt']=null;this[_0x7cfe('0xc')]=0x1;this[_0x7cfe('0xd')]='';this[_0x7cfe('0xe')]='';this[_0x7cfe('0xf')]='';this[_0x7cfe('0x10')]='';this[_0x7cfe('0x11')]='';this['exten']='';this[_0x7cfe('0x12')]='';this[_0x7cfe('0x13')]=0x0;this[_0x7cfe('0x14')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x7cfe('0x15')]={};}module[_0x7cfe('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ee854e6..a7fb9ac 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 _0xeb01=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x2ff41f,_0x154b66){var _0x137429=function(_0x366b95){while(--_0x366b95){_0x2ff41f['push'](_0x2ff41f['shift']());}};_0x137429(++_0x154b66);}(_0xeb01,0x17b));var _0x1eb0=function(_0x36fdfb,_0x46ecf7){_0x36fdfb=_0x36fdfb-0x0;var _0x4c9e03=_0xeb01[_0x36fdfb];return _0x4c9e03;};'use strict';function SalesforceAccount(_0x141a13){this['id']=_0x141a13['id']||0x0;this[_0x1eb0('0x0')]=_0x141a13[_0x1eb0('0x0')]||'';this[_0x1eb0('0x1')]=_0x141a13[_0x1eb0('0x1')]||'';this['remoteUri']=_0x141a13[_0x1eb0('0x2')]||'';this['password']=_0x141a13[_0x1eb0('0x3')]||'';this['clientId']=_0x141a13[_0x1eb0('0x4')]||'';this[_0x1eb0('0x5')]=_0x141a13[_0x1eb0('0x5')]||'';this[_0x1eb0('0x6')]=_0x141a13[_0x1eb0('0x6')]||'';this[_0x1eb0('0x7')]=_0x141a13[_0x1eb0('0x7')]||_0x1eb0('0x8');this[_0x1eb0('0x9')]=_0x141a13['serverUrl']||'';this[_0x1eb0('0xa')]=_0x141a13[_0x1eb0('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x6d9a=['serverUrl','Configurations','exports','name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x184b23,_0x20e9e9){var _0x155b6a=function(_0x47475e){while(--_0x47475e){_0x184b23['push'](_0x184b23['shift']());}};_0x155b6a(++_0x20e9e9);}(_0x6d9a,0x179));var _0xa6d9=function(_0x4263a2,_0x179e62){_0x4263a2=_0x4263a2-0x0;var _0x48e444=_0x6d9a[_0x4263a2];return _0x48e444;};'use strict';function SalesforceAccount(_0x5e557e){this['id']=_0x5e557e['id']||0x0;this[_0xa6d9('0x0')]=_0x5e557e[_0xa6d9('0x0')]||'';this[_0xa6d9('0x1')]=_0x5e557e['username']||'';this[_0xa6d9('0x2')]=_0x5e557e[_0xa6d9('0x2')]||'';this['password']=_0x5e557e['password']||'';this[_0xa6d9('0x3')]=_0x5e557e[_0xa6d9('0x3')]||'';this[_0xa6d9('0x4')]=_0x5e557e[_0xa6d9('0x4')]||'';this[_0xa6d9('0x5')]=_0x5e557e[_0xa6d9('0x5')]||'';this[_0xa6d9('0x6')]=_0x5e557e[_0xa6d9('0x6')]||_0xa6d9('0x7');this[_0xa6d9('0x8')]=_0x5e557e['serverUrl']||'';this[_0xa6d9('0x9')]=_0x5e557e['Configurations']||{};}module[_0xa6d9('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 31fdf7a..22361cd 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 _0x1db1=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x1da72c,_0x15d2e9){var _0x58d9e7=function(_0x1487e3){while(--_0x1487e3){_0x1da72c['push'](_0x1da72c['shift']());}};_0x58d9e7(++_0x15d2e9);}(_0x1db1,0x168));var _0x11db=function(_0x360fa9,_0x40e248){_0x360fa9=_0x360fa9-0x0;var _0x1bf5e6=_0x1db1[_0x360fa9];return _0x1bf5e6;};'use strict';function ServicenowAccount(_0x4a95c0){this['id']=_0x4a95c0['id']||0x0;this[_0x11db('0x0')]=_0x4a95c0[_0x11db('0x0')]||'';this[_0x11db('0x1')]=_0x4a95c0[_0x11db('0x1')]||'';this['password']=_0x4a95c0[_0x11db('0x2')]||'';this[_0x11db('0x3')]=_0x4a95c0[_0x11db('0x3')]||'';this[_0x11db('0x4')]=_0x4a95c0[_0x11db('0x4')]||'';this['Configurations']=_0x4a95c0[_0x11db('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xffac=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffac,0x179));var _0xcffa=function(_0x3f87c7,_0x1a0fca){_0x3f87c7=_0x3f87c7-0x0;var _0x28d7f9=_0xffac[_0x3f87c7];return _0x28d7f9;};'use strict';function ServicenowAccount(_0x257209){this['id']=_0x257209['id']||0x0;this[_0xcffa('0x0')]=_0x257209['name']||'';this['username']=_0x257209[_0xcffa('0x1')]||'';this[_0xcffa('0x2')]=_0x257209[_0xcffa('0x2')]||'';this[_0xcffa('0x3')]=_0x257209[_0xcffa('0x3')]||'';this[_0xcffa('0x4')]=_0x257209[_0xcffa('0x4')]||'';this[_0xcffa('0x5')]=_0x257209[_0xcffa('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 321298c..1f8d198 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 _0xcbfa=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0xc40c93,_0x204fea){var _0x2ce727=function(_0x20dafa){while(--_0x20dafa){_0xc40c93['push'](_0xc40c93['shift']());}};_0x2ce727(++_0x204fea);}(_0xcbfa,0x19f));var _0xacbf=function(_0x17788a,_0x150887){_0x17788a=_0x17788a-0x0;var _0x33f47c=_0xcbfa[_0x17788a];return _0x33f47c;};'use strict';function SugarcrmAccount(_0x1bc78f){this['id']=_0x1bc78f['id']||0x0;this[_0xacbf('0x0')]=_0x1bc78f[_0xacbf('0x0')]||'';this[_0xacbf('0x1')]=_0x1bc78f['username']||'';this[_0xacbf('0x2')]=_0x1bc78f[_0xacbf('0x2')]||'';this[_0xacbf('0x3')]=_0x1bc78f[_0xacbf('0x3')]||'';this[_0xacbf('0x4')]=_0x1bc78f[_0xacbf('0x4')]||'';this[_0xacbf('0x5')]=_0x1bc78f[_0xacbf('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x041e=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x4fa820,_0x3a43b5){var _0x13b6da=function(_0x35ac51){while(--_0x35ac51){_0x4fa820['push'](_0x4fa820['shift']());}};_0x13b6da(++_0x3a43b5);}(_0x041e,0xc1));var _0xe041=function(_0xd33347,_0x110f93){_0xd33347=_0xd33347-0x0;var _0x5bf12a=_0x041e[_0xd33347];return _0x5bf12a;};'use strict';function SugarcrmAccount(_0x49fcfc){this['id']=_0x49fcfc['id']||0x0;this[_0xe041('0x0')]=_0x49fcfc[_0xe041('0x0')]||'';this['username']=_0x49fcfc[_0xe041('0x1')]||'';this['password']=_0x49fcfc[_0xe041('0x2')]||'';this[_0xe041('0x3')]=_0x49fcfc[_0xe041('0x3')]||'';this[_0xe041('0x4')]=_0x49fcfc[_0xe041('0x4')]||'';this[_0xe041('0x5')]=_0x49fcfc[_0xe041('0x5')]||{};}module[_0xe041('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c15aa3f..8123a81 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 _0x7e7b=['name','accountcode','state','stateTime','status','unknown','address','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e7b,0x150));var _0xb7e7=function(_0xd01db9,_0x2cc3a5){_0xd01db9=_0xd01db9-0x0;var _0x288624=_0x7e7b[_0xd01db9];return _0x288624;};'use strict';function Telephone(_0x27bf5c){this['id']=_0x27bf5c['id']||0x0;this['name']=_0x27bf5c[_0xb7e7('0x0')]||'';this[_0xb7e7('0x1')]=_0x27bf5c['accountcode']||'';this[_0xb7e7('0x2')]='unknown';this[_0xb7e7('0x3')]=0x0;this[_0xb7e7('0x4')]=_0xb7e7('0x5');this[_0xb7e7('0x6')]='';}module[_0xb7e7('0x7')]=Telephone; \ No newline at end of file +var _0xca46=['unknown','stateTime','address','name','accountcode','state'];(function(_0x5f0703,_0xc91fd9){var _0x11c3da=function(_0x5ab71a){while(--_0x5ab71a){_0x5f0703['push'](_0x5f0703['shift']());}};_0x11c3da(++_0xc91fd9);}(_0xca46,0xab));var _0x6ca4=function(_0x2feb26,_0x44701e){_0x2feb26=_0x2feb26-0x0;var _0x4025ac=_0xca46[_0x2feb26];return _0x4025ac;};'use strict';function Telephone(_0x4a1ad0){this['id']=_0x4a1ad0['id']||0x0;this[_0x6ca4('0x0')]=_0x4a1ad0[_0x6ca4('0x0')]||'';this[_0x6ca4('0x1')]=_0x4a1ad0['accountcode']||'';this[_0x6ca4('0x2')]=_0x6ca4('0x3');this[_0x6ca4('0x4')]=0x0;this['status']=_0x6ca4('0x3');this[_0x6ca4('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 24424c4..34df453 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 _0xea44=['exports','name','html'];(function(_0x4f1ee6,_0x3a0ac1){var _0x331ef3=function(_0x2ca0dd){while(--_0x2ca0dd){_0x4f1ee6['push'](_0x4f1ee6['shift']());}};_0x331ef3(++_0x3a0ac1);}(_0xea44,0x1a5));var _0x4ea4=function(_0x2fbb93,_0x1ca17d){_0x2fbb93=_0x2fbb93-0x0;var _0x3433b0=_0xea44[_0x2fbb93];return _0x3433b0;};'use strict';function template(_0x3b4dcc){this['id']=_0x3b4dcc['id']||0x0;this[_0x4ea4('0x0')]=_0x3b4dcc[_0x4ea4('0x0')]||'';this[_0x4ea4('0x1')]=_0x3b4dcc['html']||'';}module[_0x4ea4('0x2')]=template; \ No newline at end of file +var _0x92f6=['name','html','exports'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x92f6,0x108));var _0x692f=function(_0x49a570,_0x522418){_0x49a570=_0x49a570-0x0;var _0x428d74=_0x92f6[_0x49a570];return _0x428d74;};'use strict';function template(_0x35d88d){this['id']=_0x35d88d['id']||0x0;this['name']=_0x35d88d[_0x692f('0x0')]||'';this['html']=_0x35d88d[_0x692f('0x1')]||'';}module[_0x692f('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5d57f82..66f37df 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x334cac,_0x502359){var _0x5c01ce=function(_0x12d850){while(--_0x12d850){_0x334cac['push'](_0x334cac['shift']());}};_0x5c01ce(++_0x502359);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 87d638a..6968a5c 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 _0x0267=['stateTime','status','registry','split','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown'];(function(_0x567391,_0x1da640){var _0x1a9eca=function(_0x11f3ea){while(--_0x11f3ea){_0x567391['push'](_0x567391['shift']());}};_0x1a9eca(++_0x1da640);}(_0x0267,0xb0));var _0x7026=function(_0x606c39,_0x2cc86d){_0x606c39=_0x606c39-0x0;var _0x1efcd8=_0x0267[_0x606c39];return _0x1efcd8;};'use strict';function Trunk(_0x1e1c23){this['id']=_0x1e1c23['id']||0x0;this[_0x7026('0x0')]=_0x1e1c23[_0x7026('0x0')]||![];this['name']=_0x1e1c23[_0x7026('0x1')]||'';this[_0x7026('0x2')]=_0x7026('0x3');this[_0x7026('0x4')]=0x0;this[_0x7026('0x5')]=_0x7026('0x3');this['registry']=_0x1e1c23['registry']&&_0x1e1c23[_0x7026('0x6')]['indexOf'](':')?_0x1e1c23[_0x7026('0x6')][_0x7026('0x7')](':')[0x0]:'';this['host']='';this[_0x7026('0x8')]='';this['domain']='';this[_0x7026('0x9')]='';this[_0x7026('0xa')]='';this[_0x7026('0xb')]=_0x7026('0x3');this[_0x7026('0xc')]='';this[_0x7026('0xd')]='';}module[_0x7026('0xe')]=Trunk; \ No newline at end of file +var _0x7a23=['stateTime','registry','split','host','domainport','stateRegistry','address','exports','active','name','state','unknown'];(function(_0x4a0c05,_0x3217de){var _0x54050b=function(_0x8a5cde){while(--_0x8a5cde){_0x4a0c05['push'](_0x4a0c05['shift']());}};_0x54050b(++_0x3217de);}(_0x7a23,0x170));var _0x37a2=function(_0x573810,_0x5a478c){_0x573810=_0x573810-0x0;var _0x234737=_0x7a23[_0x573810];return _0x234737;};'use strict';function Trunk(_0x2e444c){this['id']=_0x2e444c['id']||0x0;this['active']=_0x2e444c[_0x37a2('0x0')]||![];this[_0x37a2('0x1')]=_0x2e444c[_0x37a2('0x1')]||'';this[_0x37a2('0x2')]=_0x37a2('0x3');this[_0x37a2('0x4')]=0x0;this['status']=_0x37a2('0x3');this[_0x37a2('0x5')]=_0x2e444c[_0x37a2('0x5')]&&_0x2e444c['registry']['indexOf'](':')?_0x2e444c[_0x37a2('0x5')][_0x37a2('0x6')](':')[0x0]:'';this[_0x37a2('0x7')]='';this['port']='';this['domain']='';this[_0x37a2('0x8')]='';this['refresh']='';this[_0x37a2('0x9')]=_0x37a2('0x3');this['registrationtime']='';this[_0x37a2('0xa')]='';}module[_0x37a2('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6cecc91..2b9bd41 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 _0x81ce=['exten','recordingFormat','exports'];(function(_0x44f728,_0x2ca620){var _0x41c2a3=function(_0x45d226){while(--_0x45d226){_0x44f728['push'](_0x44f728['shift']());}};_0x41c2a3(++_0x2ca620);}(_0x81ce,0xe7));var _0xe81c=function(_0x22bd74,_0x3b231b){_0x22bd74=_0x22bd74-0x0;var _0x4b9505=_0x81ce[_0x22bd74];return _0x4b9505;};'use strict';function voiceExtension(_0x27f4ce){this['id']=_0x27f4ce['id']||0x0;this['exten']=_0x27f4ce[_0xe81c('0x0')]||'';this['recordingFormat']=_0x27f4ce[_0xe81c('0x1')]||'none';this['mandatoryDisposition']=_0x27f4ce['mandatoryDisposition']||![];}module[_0xe81c('0x2')]=voiceExtension; \ No newline at end of file +var _0xfc2d=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x2f30f0,_0x56aa74){var _0x56a36a=function(_0x34c738){while(--_0x34c738){_0x2f30f0['push'](_0x2f30f0['shift']());}};_0x56a36a(++_0x56aa74);}(_0xfc2d,0xce));var _0xdfc2=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xfc2d[_0x1793de];return _0x4f0309;};'use strict';function voiceExtension(_0x1f4170){this['id']=_0x1f4170['id']||0x0;this[_0xdfc2('0x0')]=_0x1f4170[_0xdfc2('0x0')]||'';this['recordingFormat']=_0x1f4170[_0xdfc2('0x1')]||_0xdfc2('0x2');this[_0xdfc2('0x3')]=_0x1f4170[_0xdfc2('0x3')]||![];}module[_0xdfc2('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 2c5e106..6cab749 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 _0xc76f=['Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','invalid','unavailable','ringing','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix'];(function(_0x3f3fe2,_0x579235){var _0x39514d=function(_0x5146d4){while(--_0x5146d4){_0x3f3fe2['push'](_0x3f3fe2['shift']());}};_0x39514d(++_0x579235);}(_0xc76f,0xb1));var _0xfc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76f[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=['unknown',_0xfc76('0x0'),'inuse',_0xfc76('0x1'),_0xfc76('0x2'),_0xfc76('0x3'),_0xfc76('0x4'),'ringinuse',_0xfc76('0x5')];var monitorFormat={'wav':_0xfc76('0x6'),'wav49':_0xfc76('0x7'),'gsm':_0xfc76('0x8')};var strategy={'rrmemory':_0xfc76('0x9'),'roundrobin':_0xfc76('0xa')};function VoiceQueue(_0x2ad338){this['id']=_0x2ad338['id']||0x0;this[_0xfc76('0xb')]=_0x2ad338[_0xfc76('0xb')]||'';this['monitor_format']=_0x2ad338[_0xfc76('0xc')]||'';this[_0xfc76('0xd')]=_0x2ad338['type']||_0xfc76('0xe');this[_0xfc76('0xf')]=0x0;this[_0xfc76('0x10')]=0x0;this[_0xfc76('0x11')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xfc76('0x12')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xfc76('0x13')]=0x0;this[_0xfc76('0x14')]=0x0;this['acw']=_0x2ad338[_0xfc76('0x15')]||![];this[_0xfc76('0x16')]=_0x2ad338[_0xfc76('0x16')]||0xa;this[_0xfc76('0x17')]=_0x2ad338[_0xfc76('0x17')]||'no';this[_0xfc76('0x18')]=!![];this[_0xfc76('0x19')]='';this[_0xfc76('0x1a')]=0x0;this[_0xfc76('0x1b')]=0x0;this[_0xfc76('0x1c')]=_0x2ad338[_0xfc76('0x1c')]||null;this[_0xfc76('0x1d')]=_0x2ad338['dialGlobalInterval']?_0x2ad338[_0xfc76('0x1d')]:null;this[_0xfc76('0x1e')]=_0x2ad338[_0xfc76('0x1e')];this[_0xfc76('0x1f')]=_0x2ad338[_0xfc76('0x1f')]||_0xfc76('0x20');this['dialLimitChannel']=_0x2ad338[_0xfc76('0x21')]||0x0;this[_0xfc76('0x22')]=_0x2ad338[_0xfc76('0x22')]||0x0;this[_0xfc76('0x23')]=_0x2ad338[_0xfc76('0x23')]||0x1;this[_0xfc76('0x24')]=_0x2ad338[_0xfc76('0x24')]||_0xfc76('0x25');this[_0xfc76('0x26')]=_0x2ad338[_0xfc76('0x26')]||0.03;this[_0xfc76('0x27')]=_0x2ad338['dialPredictiveInterval']||0x258;this[_0xfc76('0x28')]=_0x2ad338[_0xfc76('0x28')]||_0xfc76('0x29');this[_0xfc76('0x2a')]=_0x2ad338['dialOriginateCallerIdNumber']||'anonymous';this[_0xfc76('0x2b')]=_0x2ad338[_0xfc76('0x2b')]||0x1e;this[_0xfc76('0x2c')]=_0x2ad338[_0xfc76('0x2c')]||_0xfc76('0x2d');this['dialQueueTimeout']=_0x2ad338[_0xfc76('0x2e')]||0x3;this[_0xfc76('0x2f')]=_0x2ad338[_0xfc76('0x2f')]||undefined;this[_0xfc76('0x30')]=_0x2ad338[_0xfc76('0x30')]||0x3;this[_0xfc76('0x31')]=_0x2ad338[_0xfc76('0x31')]||0x96;this['dialBusyMaxRetry']=_0x2ad338[_0xfc76('0x32')]||0x3;this[_0xfc76('0x33')]=_0x2ad338['dialBusyRetryFrequency']||0x96;this[_0xfc76('0x34')]=_0x2ad338[_0xfc76('0x34')]||0x3;this[_0xfc76('0x35')]=_0x2ad338[_0xfc76('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2ad338[_0xfc76('0x36')]||0x3;this[_0xfc76('0x37')]=_0x2ad338[_0xfc76('0x37')]||0x96;this[_0xfc76('0x38')]=_0x2ad338[_0xfc76('0x38')]||0x3;this[_0xfc76('0x39')]=_0x2ad338[_0xfc76('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x2ad338[_0xfc76('0x3a')]||0x3;this[_0xfc76('0x3b')]=_0x2ad338[_0xfc76('0x3b')]||0x96;this[_0xfc76('0x3c')]=_0x2ad338['dialMachineMaxRetry']||0x3;this[_0xfc76('0x3d')]=_0x2ad338[_0xfc76('0x3d')]||0x96;this[_0xfc76('0x3e')]=_0x2ad338[_0xfc76('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2ad338['dialAgentRejectRetryFrequency']||0x96;this[_0xfc76('0x3f')]=_0x2ad338[_0xfc76('0x3f')]||0x4;this['Trunk']=_0x2ad338[_0xfc76('0x40')]?_0x2ad338[_0xfc76('0x40')]:undefined;this[_0xfc76('0x41')]=_0x2ad338[_0xfc76('0x41')]?_0x2ad338['TrunkBackup']:undefined;this['dialPrefix']=_0x2ad338[_0xfc76('0x42')]||undefined;this[_0xfc76('0x43')]=_0x2ad338['Interval']?_0x2ad338['Interval']:undefined;this['dialOrderByScheduledAt']=_0x2ad338[_0xfc76('0x44')]||_0xfc76('0x45');this[_0xfc76('0x46')]=_0x2ad338['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xfc76('0x47')]=_0x2ad338['dialCutDigit']||undefined;this[_0xfc76('0x48')]=strategy[_0x2ad338[_0xfc76('0x48')]]||'rrmemory';this[_0xfc76('0x49')]=!![];this['dialAMDActive']=_0x2ad338['dialAMDActive']||![];this[_0xfc76('0x4a')]=_0x2ad338[_0xfc76('0x4a')];this[_0xfc76('0x4b')]=_0x2ad338[_0xfc76('0x4b')];this[_0xfc76('0x4c')]=_0x2ad338[_0xfc76('0x4c')];this[_0xfc76('0x4d')]=_0x2ad338[_0xfc76('0x4d')];this[_0xfc76('0x4e')]=_0x2ad338['dialAMDMinWordLength'];this[_0xfc76('0x4f')]=_0x2ad338[_0xfc76('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x2ad338[_0xfc76('0x50')];this[_0xfc76('0x51')]=_0x2ad338[_0xfc76('0x51')];this[_0xfc76('0x52')]=_0x2ad338[_0xfc76('0x52')];this[_0xfc76('0x53')]=0x0;this[_0xfc76('0x54')]=0x0;this[_0xfc76('0x55')]=_0x2ad338[_0xfc76('0x55')];this[_0xfc76('0x56')]=0x0;this[_0xfc76('0x57')]=0x0;this[_0xfc76('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xfc76('0x59')]=0x0;this[_0xfc76('0x5a')]=0x0;this[_0xfc76('0x5b')]=0x0;this[_0xfc76('0x5c')]=0x0;this[_0xfc76('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xfc76('0x5e')]=0x0;this[_0xfc76('0x5f')]=0x0;this[_0xfc76('0x60')]=0x0;this[_0xfc76('0x61')]=undefined;this[_0xfc76('0x62')]=undefined;this[_0xfc76('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xfc76('0x64')]=0x0;this[_0xfc76('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xfc76('0x66')]=0x0;this[_0xfc76('0x67')]=0x0;this[_0xfc76('0x68')]=0x0;this[_0xfc76('0x69')]=0x0;this[_0xfc76('0x6a')]=0x0;this[_0xfc76('0x6b')]=_0x2ad338[_0xfc76('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0x2ad338[_0xfc76('0x6c')]||0xa;this[_0xfc76('0x6d')]=0x0;this[_0xfc76('0x6e')]=0x0;this[_0xfc76('0x6f')]=0x1;this[_0xfc76('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0xfc76('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xfc76('0x72')]=_0x2ad338[_0xfc76('0x72')]||0x1e;this[_0xfc76('0x73')]=_0x2ad338[_0xfc76('0x73')]||![];this[_0xfc76('0x74')]=_0x2ad338['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2ad338[_0xfc76('0x75')]||![];this[_0xfc76('0x76')]=_0x2ad338[_0xfc76('0x76')]||![];this['monitor_format']=monitorFormat[_0x2ad338['monitor_format']]?monitorFormat[_0x2ad338[_0xfc76('0xc')]]:undefined;this[_0xfc76('0x77')]=_0x2ad338[_0xfc76('0x77')]||![];this['mandatoryDispositionPause']=_0x2ad338[_0xfc76('0x78')]?_0x2ad338[_0xfc76('0x78')]:undefined;}module[_0xfc76('0x79')]=VoiceQueue; \ No newline at end of file +var _0xb8db=['type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','ringing','ringinuse','onhold','wav49','rrmemory','roundrobin','name','monitor_format'];(function(_0x22746d,_0x132884){var _0x3b19fd=function(_0x1aeeea){while(--_0x1aeeea){_0x22746d['push'](_0x22746d['shift']());}};_0x3b19fd(++_0x132884);}(_0xb8db,0x6b));var _0xbb8d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb8db[_0x14add3];return _0x4a174f;};'use strict';var statusDesc=[_0xbb8d('0x0'),'not_inuse',_0xbb8d('0x1'),_0xbb8d('0x2'),'invalid','unavailable',_0xbb8d('0x3'),_0xbb8d('0x4'),_0xbb8d('0x5')];var monitorFormat={'wav':'wav','wav49':_0xbb8d('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0xbb8d('0x7'),'roundrobin':_0xbb8d('0x8')};function VoiceQueue(_0x1cc354){this['id']=_0x1cc354['id']||0x0;this['name']=_0x1cc354[_0xbb8d('0x9')]||'';this[_0xbb8d('0xa')]=_0x1cc354['monitor_format']||'';this['type']=_0x1cc354[_0xbb8d('0xb')]||_0xbb8d('0xc');this[_0xbb8d('0xd')]=0x0;this['talking']=0x0;this[_0xbb8d('0xe')]=0x0;this['answered']=0x0;this[_0xbb8d('0xf')]=0x0;this[_0xbb8d('0x10')]=0x0;this[_0xbb8d('0x11')]=0x0;this[_0xbb8d('0x12')]=0x0;this['abandoned']=0x0;this[_0xbb8d('0x13')]=0x0;this[_0xbb8d('0x14')]=0x0;this[_0xbb8d('0x15')]=_0x1cc354['acw']||![];this['acwTimeout']=_0x1cc354[_0xbb8d('0x16')]||0xa;this[_0xbb8d('0x17')]=_0x1cc354[_0xbb8d('0x17')]||'no';this[_0xbb8d('0x18')]=!![];this['message']='';this[_0xbb8d('0x19')]=0x0;this[_0xbb8d('0x1a')]=0x0;this[_0xbb8d('0x1b')]=_0x1cc354[_0xbb8d('0x1b')]||null;this[_0xbb8d('0x1c')]=_0x1cc354[_0xbb8d('0x1c')]?_0x1cc354[_0xbb8d('0x1c')]:null;this[_0xbb8d('0x1d')]=_0x1cc354['dialActive'];this[_0xbb8d('0x1e')]=_0x1cc354[_0xbb8d('0x1e')]||_0xbb8d('0x1f');this[_0xbb8d('0x20')]=_0x1cc354[_0xbb8d('0x20')]||0x0;this['dialLimitQueue']=_0x1cc354[_0xbb8d('0x21')]||0x0;this[_0xbb8d('0x22')]=_0x1cc354[_0xbb8d('0x22')]||0x1;this[_0xbb8d('0x23')]=_0x1cc354[_0xbb8d('0x23')]||_0xbb8d('0x24');this[_0xbb8d('0x25')]=_0x1cc354[_0xbb8d('0x25')]||0.03;this['dialPredictiveInterval']=_0x1cc354[_0xbb8d('0x26')]||0x258;this[_0xbb8d('0x27')]=_0x1cc354[_0xbb8d('0x27')]||_0xbb8d('0x28');this[_0xbb8d('0x29')]=_0x1cc354[_0xbb8d('0x29')]||_0xbb8d('0x28');this[_0xbb8d('0x2a')]=_0x1cc354['dialOriginateTimeout']||0x1e;this[_0xbb8d('0x2b')]=_0x1cc354[_0xbb8d('0x2b')]||'tTxX';this[_0xbb8d('0x2c')]=_0x1cc354[_0xbb8d('0x2c')]||0x3;this[_0xbb8d('0x2d')]=_0x1cc354[_0xbb8d('0x2d')]||undefined;this[_0xbb8d('0x2e')]=_0x1cc354['dialCongestionMaxRetry']||0x3;this[_0xbb8d('0x2f')]=_0x1cc354[_0xbb8d('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x1cc354[_0xbb8d('0x30')]||0x3;this[_0xbb8d('0x31')]=_0x1cc354['dialBusyRetryFrequency']||0x96;this[_0xbb8d('0x32')]=_0x1cc354[_0xbb8d('0x32')]||0x3;this['dialNoAnswerRetryFrequency']=_0x1cc354[_0xbb8d('0x33')]||0x96;this[_0xbb8d('0x34')]=_0x1cc354['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1cc354[_0xbb8d('0x35')]||0x96;this[_0xbb8d('0x36')]=_0x1cc354[_0xbb8d('0x36')]||0x3;this[_0xbb8d('0x37')]=_0x1cc354[_0xbb8d('0x37')]||0x96;this[_0xbb8d('0x38')]=_0x1cc354['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1cc354[_0xbb8d('0x39')]||0x96;this['dialMachineMaxRetry']=_0x1cc354[_0xbb8d('0x3a')]||0x3;this[_0xbb8d('0x3b')]=_0x1cc354[_0xbb8d('0x3b')]||0x96;this[_0xbb8d('0x3c')]=_0x1cc354['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x1cc354[_0xbb8d('0x3d')]||0x96;this[_0xbb8d('0x3e')]=_0x1cc354[_0xbb8d('0x3e')]||0x4;this[_0xbb8d('0x3f')]=_0x1cc354[_0xbb8d('0x3f')]?_0x1cc354[_0xbb8d('0x3f')]:undefined;this[_0xbb8d('0x40')]=_0x1cc354[_0xbb8d('0x40')]?_0x1cc354[_0xbb8d('0x40')]:undefined;this['dialPrefix']=_0x1cc354[_0xbb8d('0x41')]||undefined;this['Interval']=_0x1cc354['Interval']?_0x1cc354['Interval']:undefined;this[_0xbb8d('0x42')]=_0x1cc354[_0xbb8d('0x42')]||_0xbb8d('0x43');this[_0xbb8d('0x44')]=_0x1cc354[_0xbb8d('0x44')]||undefined;this[_0xbb8d('0x45')]=_0x1cc354[_0xbb8d('0x45')]||undefined;this[_0xbb8d('0x46')]=strategy[_0x1cc354[_0xbb8d('0x46')]]||_0xbb8d('0x7');this[_0xbb8d('0x47')]=!![];this['dialAMDActive']=_0x1cc354[_0xbb8d('0x48')]||![];this[_0xbb8d('0x49')]=_0x1cc354[_0xbb8d('0x49')];this['dialAMDGreeting']=_0x1cc354[_0xbb8d('0x4a')];this[_0xbb8d('0x4b')]=_0x1cc354[_0xbb8d('0x4b')];this[_0xbb8d('0x4c')]=_0x1cc354['dialAMDTotalAnalysisTime'];this[_0xbb8d('0x4d')]=_0x1cc354['dialAMDMinWordLength'];this[_0xbb8d('0x4e')]=_0x1cc354[_0xbb8d('0x4e')];this[_0xbb8d('0x4f')]=_0x1cc354[_0xbb8d('0x4f')];this[_0xbb8d('0x50')]=_0x1cc354['dialAMDSilenceThreshold'];this[_0xbb8d('0x51')]=_0x1cc354[_0xbb8d('0x51')];this['outboundRejectCallsDay']=0x0;this[_0xbb8d('0x52')]=0x0;this[_0xbb8d('0x53')]=_0x1cc354[_0xbb8d('0x53')];this[_0xbb8d('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xbb8d('0x55')]=0x0;this[_0xbb8d('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xbb8d('0x57')]=0x0;this[_0xbb8d('0x58')]=0x0;this[_0xbb8d('0x59')]=0x0;this[_0xbb8d('0x5a')]=0x0;this[_0xbb8d('0x5b')]=0x0;this[_0xbb8d('0x5c')]=0x0;this[_0xbb8d('0x5d')]=0x0;this['startProgressive']=undefined;this[_0xbb8d('0x5e')]=undefined;this[_0xbb8d('0x5f')]=undefined;this[_0xbb8d('0x60')]=1.05;this[_0xbb8d('0x61')]=0x0;this[_0xbb8d('0x62')]=0x0;this[_0xbb8d('0x63')]=0x0;this[_0xbb8d('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xbb8d('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xbb8d('0x66')]=0x0;this[_0xbb8d('0x67')]=_0x1cc354[_0xbb8d('0x68')]||0x14;this[_0xbb8d('0x69')]=_0x1cc354['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xbb8d('0x6a')]=0x0;this[_0xbb8d('0x6b')]=0x0;this[_0xbb8d('0x6c')]=0x1;this[_0xbb8d('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0xbb8d('0x6e')]=0x0;this[_0xbb8d('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x1cc354['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x1cc354[_0xbb8d('0x70')]||![];this['dialQueueProject2']=_0x1cc354['dialQueueProject2']||undefined;this[_0xbb8d('0x71')]=_0x1cc354['dialAgiAfterHangupClient']||![];this[_0xbb8d('0x72')]=_0x1cc354[_0xbb8d('0x72')]||![];this[_0xbb8d('0xa')]=monitorFormat[_0x1cc354[_0xbb8d('0xa')]]?monitorFormat[_0x1cc354[_0xbb8d('0xa')]]:undefined;this[_0xbb8d('0x73')]=_0x1cc354[_0xbb8d('0x73')]||![];this[_0xbb8d('0x74')]=_0x1cc354[_0xbb8d('0x74')]?_0x1cc354['mandatoryDispositionPause']:undefined;}module[_0xbb8d('0x75')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f697be9..3edd386 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 _0xd03a=['remoteUri','Configurations','name','username'];(function(_0x273fd1,_0x388bbe){var _0x5d3dbf=function(_0xd435e7){while(--_0xd435e7){_0x273fd1['push'](_0x273fd1['shift']());}};_0x5d3dbf(++_0x388bbe);}(_0xd03a,0x1a2));var _0xad03=function(_0x34f533,_0x251aee){_0x34f533=_0x34f533-0x0;var _0x1b37d2=_0xd03a[_0x34f533];return _0x1b37d2;};'use strict';function VtigerAccount(_0x31cbfb){this['id']=_0x31cbfb['id']||0x0;this[_0xad03('0x0')]=_0x31cbfb[_0xad03('0x0')]||'';this[_0xad03('0x1')]=_0x31cbfb[_0xad03('0x1')]||'';this['accessKey']=_0x31cbfb['accessKey']||'';this[_0xad03('0x2')]=_0x31cbfb[_0xad03('0x2')]||'';this['serverUrl']=_0x31cbfb['serverUrl']||'';this[_0xad03('0x3')]=_0x31cbfb['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x6071=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3645a5,_0x476d5c){var _0x1124a3=function(_0x2d3bb4){while(--_0x2d3bb4){_0x3645a5['push'](_0x3645a5['shift']());}};_0x1124a3(++_0x476d5c);}(_0x6071,0x72));var _0x1607=function(_0x30720e,_0x55753f){_0x30720e=_0x30720e-0x0;var _0x5674ac=_0x6071[_0x30720e];return _0x5674ac;};'use strict';function VtigerAccount(_0xdf7a01){this['id']=_0xdf7a01['id']||0x0;this[_0x1607('0x0')]=_0xdf7a01['name']||'';this[_0x1607('0x1')]=_0xdf7a01[_0x1607('0x1')]||'';this[_0x1607('0x2')]=_0xdf7a01[_0x1607('0x2')]||'';this['remoteUri']=_0xdf7a01[_0x1607('0x3')]||'';this[_0x1607('0x4')]=_0xdf7a01[_0x1607('0x4')]||'';this[_0x1607('0x5')]=_0xdf7a01['Configurations']||{};}module[_0x1607('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e0036f5..9a1bee6 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x45837d,_0x2f0f81){_0x45837d=_0x45837d-0x0;var _0xa4d0c6=_0xdb28[_0x45837d];return _0xa4d0c6;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x24007e,_0x4e2ba5){var _0x30e406=function(_0x197c71){while(--_0x197c71){_0x24007e['push'](_0x24007e['shift']());}};_0x30e406(++_0x4e2ba5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7d60c03..a9eb411 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 _0xa664=['name','description','host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x160951,_0x4508b3){var _0x4e30a2=function(_0x143629){while(--_0x143629){_0x160951['push'](_0x160951['shift']());}};_0x4e30a2(++_0x4508b3);}(_0xa664,0x132));var _0x4a66=function(_0x14481a,_0x10fd61){_0x14481a=_0x14481a-0x0;var _0x5da7c9=_0xa664[_0x14481a];return _0x5da7c9;};'use strict';function ZohoAccount(_0xa8e91a){this['id']=_0xa8e91a['id']||0x0;this[_0x4a66('0x0')]=_0xa8e91a[_0x4a66('0x0')]||'';this[_0x4a66('0x1')]=_0xa8e91a[_0x4a66('0x1')]||'';this['host']=_0xa8e91a[_0x4a66('0x2')]||'';this['zone']=_0xa8e91a['zone']||'';this[_0x4a66('0x3')]=_0xa8e91a[_0x4a66('0x3')]||'';this[_0x4a66('0x4')]=_0xa8e91a[_0x4a66('0x4')]||'';this[_0x4a66('0x5')]=_0xa8e91a[_0x4a66('0x5')]||'';this[_0x4a66('0x6')]=_0xa8e91a['code']||'';this[_0x4a66('0x7')]=_0xa8e91a[_0x4a66('0x7')]||'';this[_0x4a66('0x8')]=_0xa8e91a[_0x4a66('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x3f9b=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId'];(function(_0x4133a8,_0x584733){var _0x1a62fe=function(_0x47f746){while(--_0x47f746){_0x4133a8['push'](_0x4133a8['shift']());}};_0x1a62fe(++_0x584733);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x3f9b[_0x56740a];return _0x257144;};'use strict';function ZohoAccount(_0x47caab){this['id']=_0x47caab['id']||0x0;this['name']=_0x47caab[_0xb3f9('0x0')]||'';this['description']=_0x47caab[_0xb3f9('0x1')]||'';this[_0xb3f9('0x2')]=_0x47caab['host']||'';this['zone']=_0x47caab['zone']||'';this[_0xb3f9('0x3')]=_0x47caab[_0xb3f9('0x3')]||'';this[_0xb3f9('0x4')]=_0x47caab['clientSecret']||'';this[_0xb3f9('0x5')]=_0x47caab[_0xb3f9('0x5')]||'';this[_0xb3f9('0x6')]=_0x47caab[_0xb3f9('0x6')]||'';this[_0xb3f9('0x7')]=_0x47caab['refreshToken']||'';this['Configurations']=_0x47caab[_0xb3f9('0x8')]||{};}module[_0xb3f9('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 6c80dbc..283145c 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 _0x733e=['lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x733e,0x1b0));var _0xe733=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0x733e[_0x566168];return _0x4e1f7a;};'use strict';var util=require(_0xe733('0x0'));var _=require(_0xe733('0x1'));var moment=require(_0xe733('0x2'));function checkNameSurname(_0x313aaf,_0x34122d,_0xa8f4a5){var _0x2993c6='';if(!_[_0xe733('0x3')](_0x34122d)&&_0xe733('0x4')===typeof _0x34122d){_0x2993c6+=_0x34122d;}if(!_[_0xe733('0x3')](_0xa8f4a5)&&'string'===typeof _0xa8f4a5){_0x2993c6+='\x20'+_0xa8f4a5;}if(_0x2993c6!==''){return _0x2993c6;}return _0x313aaf;}function Action(_0x43ba34,_0x481fc1,_0x448706,_0x108a28,_0x9b3d84){this['uniqueid']=_0x448706||undefined;this[_0xe733('0x5')]=_0x43ba34['id'];this[_0xe733('0x6')]=_0x481fc1[_0xe733('0x7')];this[_0xe733('0x8')]=_0x481fc1[_0xe733('0x8')];this[_0xe733('0x9')]='queue';this[_0xe733('0xa')]=![];this[_0xe733('0xb')]=_[_0xe733('0x3')](_0x43ba34[_0xe733('0xc')])?undefined:_0x43ba34['Agent'][_0xe733('0x7')];this[_0xe733('0xd')]=this[_0xe733('0xb')]?util[_0xe733('0xe')](_0xe733('0xf'),this[_0xe733('0xb')]):_0x108a28||undefined;this[_0xe733('0x10')]=checkNameSurname(_0x43ba34[_0xe733('0x11')][_0xe733('0x12')],_0x43ba34[_0xe733('0x11')]['firstName'],_0x43ba34[_0xe733('0x11')][_0xe733('0x13')]);this[_0xe733('0x14')]=_0x43ba34[_0xe733('0x14')]||![];this['calleridnum']=_0x43ba34[_0xe733('0x11')][_0xe733('0x12')];this[_0xe733('0x15')]=_0x43ba34[_0xe733('0x15')];this[_0xe733('0x16')]=_0x43ba34[_0xe733('0x16')]||0x0;this[_0xe733('0x17')]=_0x43ba34[_0xe733('0x17')]||0x0;this[_0xe733('0x18')]=_0x43ba34['countnoanswerretry']||0x0;this['countglobal']=(_0x43ba34[_0xe733('0x16')]||0x0)+(_0x43ba34[_0xe733('0x17')]||0x0)+(_0x43ba34['countnoanswerretry']||0x0)+(_0x43ba34[_0xe733('0x19')]||0x0)+(_0x43ba34['countdropretry']||0x0)+(_0x43ba34[_0xe733('0x1a')]||0x0)+(_0x43ba34[_0xe733('0x1b')]||0x0)+(_0x43ba34[_0xe733('0x1c')]||0x0);this[_0xe733('0x19')]=_0x43ba34[_0xe733('0x19')]||0x0;this['countdropretry']=_0x43ba34[_0xe733('0x1d')]||0x0;this['countabandonedretry']=_0x43ba34[_0xe733('0x1a')]||0x0;this[_0xe733('0x1b')]=_0x43ba34[_0xe733('0x1b')]||0x0;this[_0xe733('0x1c')]=_0x43ba34[_0xe733('0x1c')]||0x0;this[_0xe733('0x1e')]=_0x43ba34[_0xe733('0x1e')];this[_0xe733('0x1f')]=_0x43ba34[_0xe733('0x1f')];this['callbackat']=_0x43ba34['callbackat'];this[_0xe733('0x20')]=_0x43ba34[_0xe733('0x20')];this[_0xe733('0x21')]=_0x43ba34[_0xe733('0x21')];this[_0xe733('0x22')]=_0x43ba34['ListId'];this[_0xe733('0x23')]=_[_0xe733('0x3')](_0x43ba34[_0xe733('0xc')])?_0x43ba34[_0xe733('0x23')]:_0x43ba34[_0xe733('0xc')]['id'];this[_0xe733('0x24')]=_0x43ba34['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xe733('0x25')][_0xe733('0x26')]=function(){return util[_0xe733('0xe')](_0xe733('0x27'),this[_0xe733('0x10')],this['number']);};module[_0xe733('0x28')]=Action; \ No newline at end of file +var _0xd5f9=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','idContact','queue','type','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone','firstName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x4be573,_0x18ec20){var _0x2b6e0a=function(_0x43a80d){while(--_0x43a80d){_0x4be573['push'](_0x4be573['shift']());}};_0x2b6e0a(++_0x18ec20);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0xd5f9[_0x2b5b44];return _0x32cb66;};'use strict';var util=require(_0x9d5f('0x0'));var _=require(_0x9d5f('0x1'));var moment=require(_0x9d5f('0x2'));function checkNameSurname(_0xc76d42,_0x4ed934,_0x3f3bb1){var _0x3e73bf='';if(!_[_0x9d5f('0x3')](_0x4ed934)&&_0x9d5f('0x4')===typeof _0x4ed934){_0x3e73bf+=_0x4ed934;}if(!_[_0x9d5f('0x3')](_0x3f3bb1)&&_0x9d5f('0x4')===typeof _0x3f3bb1){_0x3e73bf+='\x20'+_0x3f3bb1;}if(_0x3e73bf!==''){return _0x3e73bf;}return _0xc76d42;}function Action(_0x530d09,_0x546c04,_0x58edae,_0x1dca4b,_0x2e1c4e){this['uniqueid']=_0x58edae||undefined;this[_0x9d5f('0x5')]=_0x530d09['id'];this[_0x9d5f('0x6')]=_0x546c04['name'];this[_0x9d5f('0x7')]=_0x546c04[_0x9d5f('0x7')];this['campaigntype']=_0x9d5f('0x6');this['dialAnswer']=![];this[_0x9d5f('0x8')]=_[_0x9d5f('0x3')](_0x530d09[_0x9d5f('0x9')])?undefined:_0x530d09[_0x9d5f('0x9')][_0x9d5f('0xa')];this['channelAgent']=this[_0x9d5f('0x8')]?util[_0x9d5f('0xb')](_0x9d5f('0xc'),this[_0x9d5f('0x8')]):_0x1dca4b||undefined;this[_0x9d5f('0xd')]=checkNameSurname(_0x530d09[_0x9d5f('0xe')][_0x9d5f('0xf')],_0x530d09[_0x9d5f('0xe')][_0x9d5f('0x10')],_0x530d09['Contact']['lastName']);this['active']=_0x530d09['active']||![];this[_0x9d5f('0x11')]=_0x530d09[_0x9d5f('0xe')]['phone'];this[_0x9d5f('0x12')]=_0x530d09[_0x9d5f('0x12')];this[_0x9d5f('0x13')]=_0x530d09[_0x9d5f('0x13')]||0x0;this[_0x9d5f('0x14')]=_0x530d09['countcongestionretry']||0x0;this[_0x9d5f('0x15')]=_0x530d09[_0x9d5f('0x15')]||0x0;this[_0x9d5f('0x16')]=(_0x530d09[_0x9d5f('0x13')]||0x0)+(_0x530d09[_0x9d5f('0x14')]||0x0)+(_0x530d09[_0x9d5f('0x15')]||0x0)+(_0x530d09[_0x9d5f('0x17')]||0x0)+(_0x530d09['countdropretry']||0x0)+(_0x530d09[_0x9d5f('0x18')]||0x0)+(_0x530d09[_0x9d5f('0x19')]||0x0)+(_0x530d09[_0x9d5f('0x1a')]||0x0);this['countnosuchnumberretry']=_0x530d09['countnosuchnumberretry']||0x0;this[_0x9d5f('0x1b')]=_0x530d09[_0x9d5f('0x1b')]||0x0;this[_0x9d5f('0x18')]=_0x530d09[_0x9d5f('0x18')]||0x0;this['countmachineretry']=_0x530d09[_0x9d5f('0x19')]||0x0;this['countagentrejectretry']=_0x530d09[_0x9d5f('0x1a')]||0x0;this['callback']=_0x530d09[_0x9d5f('0x1c')];this[_0x9d5f('0x1d')]=_0x530d09[_0x9d5f('0x1d')];this[_0x9d5f('0x1e')]=_0x530d09[_0x9d5f('0x1e')];this['recallme']=_0x530d09[_0x9d5f('0x1f')];this[_0x9d5f('0x20')]=_0x530d09['ContactId'];this[_0x9d5f('0x21')]=_0x530d09[_0x9d5f('0x21')];this[_0x9d5f('0x22')]=_[_0x9d5f('0x3')](_0x530d09[_0x9d5f('0x9')])?_0x530d09['UserId']:_0x530d09[_0x9d5f('0x9')]['id'];this[_0x9d5f('0x23')]=_0x530d09[_0x9d5f('0x23')];this['originatecalleridnum']='';this[_0x9d5f('0x24')]='';}Action['prototype'][_0x9d5f('0x25')]=function(){return util[_0x9d5f('0xb')]('\x22%s\x22\x20<%s>',this[_0x9d5f('0xd')],this[_0x9d5f('0x26')]);};module[_0x9d5f('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ab55527..7a5b190 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 _0xc462=['custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','pTalking','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','then','length','getDiff','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','createCustomerFinal','[HistoryRecallClose]','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc462,0x15e));var _0x2c46=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc462[_0x4f9b18];return _0x29f20c;};'use strict';var util=require(_0x2c46('0x0'));var _=require(_0x2c46('0x1'));var BPromise=require(_0x2c46('0x2'));var uuid=require(_0x2c46('0x3'));var moment=require(_0x2c46('0x4'));var md5=require(_0x2c46('0x5'));var Redis=require(_0x2c46('0x6'));var config=require('../../../config/environment');var logger=require(_0x2c46('0x7'))(_0x2c46('0x8'));var loggerAction=require(_0x2c46('0x7'))(_0x2c46('0x9'));var ami=require('../ami');var rpcDb=require(_0x2c46('0xa'));var Action=require(_0x2c46('0xb'));var ut=require(_0x2c46('0xc'));config['redis']=_[_0x2c46('0xd')](config[_0x2c46('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x2c46('0xf'))(new Redis(config[_0x2c46('0xe')]));var Sequence=function(){};Sequence['prototype'][_0x2c46('0x10')]=function(_0x51e7f4){this[_0x2c46('0x11')]=this[_0x2c46('0x11')]?this[_0x2c46('0x11')][_0x2c46('0x12')](_0x51e7f4):_0x51e7f4();};function Preview(_0x309c42){this[_0x2c46('0x13')]=new Sequence();this[_0x2c46('0x14')]=_0x309c42[_0x2c46('0x15')];this[_0x2c46('0x16')]=_0x309c42[_0x2c46('0x16')];this[_0x2c46('0x17')]={};this[_0x2c46('0x18')]=_0x309c42[_0x2c46('0x18')];this[_0x2c46('0x19')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x1b'),this[_0x2c46('0x1c')][_0x2c46('0x1a')](this));ami['on']('hanguprequest',this[_0x2c46('0x1d')][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x1e'),this[_0x2c46('0x1f')][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x20'),this['syncNewExten'][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x21'),this['syncVarSet'][_0x2c46('0x1a')](this));ami['on'](_0x2c46('0x22'),this[_0x2c46('0x23')][_0x2c46('0x1a')](this));ami['on']('blindtransfer',this[_0x2c46('0x24')][_0x2c46('0x1a')](this));this[_0x2c46('0x25')](this[_0x2c46('0x14')]);}function emit(_0x576c04,_0x3fb034,_0x458b18){io['to'](_0x576c04)[_0x2c46('0x26')](_0x3fb034,_0x458b18);}function emitCampaignPreview(_0x3ddf3f){if(_0x3ddf3f[_0x2c46('0x27')]===_0x2c46('0x28')){var _0x5751b5={'id':_0x3ddf3f['id'],'name':_0x3ddf3f[_0x2c46('0x29')],'strategy':_0x3ddf3f['strategy'],'answered':_0x3ddf3f[_0x2c46('0x2a')],'available':_0x3ddf3f[_0x2c46('0x2b')],'loggedIn':_0x3ddf3f[_0x2c46('0x2c')],'pTalking':_0x3ddf3f['pTalking'],'sumBillable':_0x3ddf3f[_0x2c46('0x2d')],'sumDuration':_0x3ddf3f['sumDuration'],'sumHoldTime':_0x3ddf3f[_0x2c46('0x2e')]||0x0,'talking':_0x3ddf3f[_0x2c46('0x2f')],'total':_0x3ddf3f[_0x2c46('0x30')],'type':_0x3ddf3f['type'],'unmanaged':_0x3ddf3f['unmanaged'],'abandoned':_0x3ddf3f[_0x2c46('0x31')],'waiting':_0x3ddf3f['waiting'],'loggedInDb':_0x3ddf3f['loggedInDb'],'dialActive':_0x3ddf3f[_0x2c46('0x32')],'dialMethod':_0x3ddf3f[_0x2c46('0x33')],'dialOriginateCallerIdName':_0x3ddf3f[_0x2c46('0x34')],'dialOriginateCallerIdNumber':_0x3ddf3f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3ddf3f[_0x2c46('0x35')],'dialPrefix':_0x3ddf3f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3ddf3f[_0x2c46('0x36')],'outboundAnswerCallsDay':_0x3ddf3f[_0x2c46('0x37')],'outboundBlacklistCallsDay':_0x3ddf3f[_0x2c46('0x38')],'outboundBusyCallsDay':_0x3ddf3f[_0x2c46('0x39')],'outboundCongestionCallsDay':_0x3ddf3f[_0x2c46('0x3a')],'outboundDropCallsDayACS':_0x3ddf3f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3ddf3f[_0x2c46('0x3b')],'outboundDropCallsDayTimeout':_0x3ddf3f[_0x2c46('0x3c')],'outboundNoAnswerCallsDay':_0x3ddf3f[_0x2c46('0x3d')],'outboundNoSuchCallsDay':_0x3ddf3f[_0x2c46('0x3e')],'outboundOriginateFailureCallsDay':_0x3ddf3f[_0x2c46('0x3f')],'outboundReCallsDay':_0x3ddf3f[_0x2c46('0x40')],'outboundRejectCallsDay':_0x3ddf3f[_0x2c46('0x41')],'outboundUnknownCallsDay':_0x3ddf3f[_0x2c46('0x42')],'outboundAbandonedCallsDay':_0x3ddf3f[_0x2c46('0x43')],'predictiveIntervalAnsweredCalls':_0x3ddf3f[_0x2c46('0x44')],'predictiveIntervalAvgHoldtime':_0x3ddf3f[_0x2c46('0x45')],'predictiveIntervalAvgTalktime':_0x3ddf3f[_0x2c46('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x3ddf3f['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3ddf3f[_0x2c46('0x47')],'predictiveIntervalErlangCalls':_0x3ddf3f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3ddf3f[_0x2c46('0x48')],'predictiveIntervalHitRate':_0x3ddf3f[_0x2c46('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3ddf3f[_0x2c46('0x4a')],'predictiveIntervalPauses':_0x3ddf3f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3ddf3f[_0x2c46('0x4b')],'predictiveIntervalTotalCalls':_0x3ddf3f[_0x2c46('0x4c')],'message':_0x3ddf3f[_0x2c46('0x4d')],'originated':_0x3ddf3f[_0x2c46('0x4e')],'erlangCalls':_0x3ddf3f[_0x2c46('0x4f')],'erlangCallToSecond':_0x3ddf3f['erlangCallToSecond'],'erlangAbandonmentRate':_0x3ddf3f[_0x2c46('0x50')],'erlangBusyFactor':_0x3ddf3f['erlangBusyFactor'],'startPredictive':_0x3ddf3f[_0x2c46('0x51')],'startProgressive':_0x3ddf3f[_0x2c46('0x52')]};if(_0x3ddf3f[_0x2c46('0x53')]){_0x5751b5[_0x2c46('0x53')]={'id':_0x3ddf3f['Trunk']['id'],'name':_0x3ddf3f[_0x2c46('0x53')]['name'],'active':_0x3ddf3f[_0x2c46('0x53')][_0x2c46('0x54')],'callerid':_0x3ddf3f[_0x2c46('0x53')]['callerid']};}if(_0x3ddf3f[_0x2c46('0x55')]){_0x5751b5['Interval']={'id':_0x3ddf3f['Interval']['id'],'name':_0x3ddf3f['Interval']['name']};}var _0x1b3dcc=md5(JSON['stringify'](_0x5751b5));if(_0x3ddf3f[_0x2c46('0x5')]!==_0x1b3dcc){_0x3ddf3f[_0x2c46('0x5')]=_0x1b3dcc;emit(util[_0x2c46('0x56')]('voice:queue:%s',_0x5751b5[_0x2c46('0x29')]),_0x2c46('0x57'),_0x5751b5);}}}function emitVoiceQueueChannelRemove(_0x39fd03){logger[_0x2c46('0x58')](_0x2c46('0x59'),JSON[_0x2c46('0x5a')](_0x39fd03));emit(util[_0x2c46('0x56')](_0x2c46('0x5b'),_0x39fd03[_0x2c46('0x29')]),_0x2c46('0x5c'),_0x39fd03);}function notSendMessagesQueue(_0x2e6ff1){if(_0x2e6ff1['sendMessageOneNotActive']){if(_0x2e6ff1[_0x2c46('0x4e')]===0x0&&_0x2e6ff1[_0x2c46('0x5d')]===0x0){_0x2e6ff1[_0x2c46('0x5e')]=![];_0x2e6ff1[_0x2c46('0x2b')]=0x0;_0x2e6ff1[_0x2c46('0x5f')]=0x0;_0x2e6ff1[_0x2c46('0x4d')]='NOT_ACTIVE';ut[_0x2c46('0x60')](_0x2c46('0x61'),_0x2e6ff1[_0x2c46('0x29')]+_0x2c46('0x62'));}else{_0x2e6ff1[_0x2c46('0x4d')]='IS_DISACTIVED';ut[_0x2c46('0x60')](_0x2c46('0x61'),_0x2e6ff1[_0x2c46('0x29')]+_0x2c46('0x63'));}emitCampaignPreview(_0x2e6ff1);}}Preview[_0x2c46('0x64')][_0x2c46('0x25')]=function(){var _0x543930=this;setInterval(function(){_0x543930[_0x2c46('0x65')]();},0x7cf);};Preview[_0x2c46('0x64')][_0x2c46('0x65')]=function(){var _0x43f123=this[_0x2c46('0x14')];this[_0x2c46('0x19')]+=0x1;for(var _0x159f64 in _0x43f123){if(_0x43f123[_0x2c46('0x66')](_0x159f64)&&(_0x43f123[_0x159f64][_0x2c46('0x33')]===_0x2c46('0x8')||_0x43f123[_0x159f64][_0x2c46('0x33')]===_0x2c46('0x67'))&&_0x43f123[_0x159f64][_0x2c46('0x27')]===_0x2c46('0x28')){if(this[_0x2c46('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x2c46('0x68')]();}}if(_0x43f123[_0x2c46('0x66')](_0x159f64)&&_0x43f123[_0x159f64][_0x2c46('0x33')]===_0x2c46('0x8')&&_0x43f123[_0x159f64]['type']===_0x2c46('0x28')){if(_0x43f123[_0x159f64]['dialActive']){this[_0x2c46('0x69')](_0x43f123[_0x159f64]);this[_0x2c46('0x6a')](_0x43f123[_0x159f64]);}else{notSendMessagesQueue(_0x43f123[_0x159f64]);}}}};Preview[_0x2c46('0x64')][_0x2c46('0x6b')]=function(_0x4d9202){var _0x4f22f1=this;this[_0x2c46('0x13')][_0x2c46('0x10')](function(){if(!_[_0x2c46('0x6c')](_0x4f22f1[_0x2c46('0x17')][_0x4d9202])){loggerAction[_0x2c46('0x58')](_0x2c46('0x6d'),_0x4d9202,_0x2c46('0x6e'),_0x4f22f1['actions'][_0x4d9202][_0x2c46('0x6f')],'originated:\x20',JSON['stringify'](_0x4f22f1['campaignsPreview'][_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]][_0x2c46('0x4e')]),_0x2c46('0x70'),JSON['stringify'](_0x4f22f1[_0x2c46('0x14')][_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]][_0x2c46('0x5d')]),JSON[_0x2c46('0x5a')](_0x4f22f1['actions'][_0x4d9202][_0x2c46('0x71')]),JSON[_0x2c46('0x5a')](_[_0x2c46('0x72')](_0x4f22f1[_0x2c46('0x17')][_0x4d9202],[_0x2c46('0x73'),_0x2c46('0x74'),_0x2c46('0x75'),_0x2c46('0x76')])));return ami['Action']({'action':_0x2c46('0x77'),'channel':_0x4f22f1['actions'][_0x4d9202][_0x2c46('0x78')]})[_0x2c46('0x79')](function(_0x17504b){if(_0x17504b['message']===_0x2c46('0x7a')){setTimeout(function(){if(_0x4f22f1[_0x2c46('0x17')][_0x4d9202]){ut[_0x2c46('0x7b')](_0x4f22f1[_0x2c46('0x14')][_0x4f22f1[_0x2c46('0x17')][_0x4d9202]['queue']],'[clearZombieChannel]');if(_0x4f22f1[_0x2c46('0x17')][_0x4d9202]['dialAnswer']===!![]){ut[_0x2c46('0x7c')](_0x4f22f1['campaignsPreview'][_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]],_0x2c46('0x7d'));ut[_0x2c46('0x7e')](_0x2c46('0x7f')+_0x4d9202,_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]);}ut[_0x2c46('0x7e')]('[Dialer][checkChannel][Preview]'+_0x4d9202,_0x4f22f1[_0x2c46('0x17')][_0x4d9202][_0x2c46('0x6f')]);delete _0x4f22f1[_0x2c46('0x17')][_0x4d9202];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3b1555=this;loggerAction[_0x2c46('0x58')](_0x2c46('0x80'),_[_0x2c46('0x81')](this[_0x2c46('0x17')]));for(var _0x5c5e06 in this[_0x2c46('0x17')]){if(_0x3b1555['actions'][_0x2c46('0x66')](_0x5c5e06)){_0x3b1555[_0x2c46('0x6b')](_0x5c5e06);}}};Preview[_0x2c46('0x64')][_0x2c46('0x6a')]=function(_0x5688a8){var _0x1d4049=this;rpcDb['getContactRecallMe'](_0x5688a8['id'],ut['agentReadyId'](this[_0x2c46('0x18')]))[_0x2c46('0x82')](function(_0x5d9474){if(!_[_0x2c46('0x6c')](_0x5d9474)){for(var _0x55bc70=0x0;_0x55bc70<_0x5d9474[_0x2c46('0x83')];_0x55bc70+=0x1){if(ut[_0x2c46('0x84')](_0x5d9474[_0x55bc70]['scheduledat'])<_0x5688a8['dialRecallMeTimeout']*0x3c){if(_0x5d9474[_0x55bc70][_0x2c46('0x85')]&&!_0x5d9474[_0x55bc70][_0x2c46('0x85')][_0x2c46('0x86')]){_0x1d4049[_0x2c46('0x87')](_0x5d9474[_0x55bc70]['id'])['then'](ut[_0x2c46('0x88')](_0x2c46('0x89')))[_0x2c46('0x79')](ut['logger2'](_0x2c46('0x89')));}else{rpcDb[_0x2c46('0x8a')](_0x5d9474[_0x55bc70]['id']);}}else{var _0x510e5c=new Action(_0x5d9474[_0x55bc70],_0x5688a8);_0x510e5c[_0x2c46('0x8b')]=moment()['format'](_0x2c46('0x8c'));_0x5688a8[_0x2c46('0x40')]+=0x1;ut['logCustomer'](_0x510e5c,0x17,_0x2c46('0x8d'));if(_0x5688a8['dialRecallInQueue']){rpcDb[_0x2c46('0x8e')](ut[_0x2c46('0x8f')](_0x5d9474[_0x55bc70]));rpcDb[_0x2c46('0x90')](_0x510e5c,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x2c46('0x91')](_0x510e5c,0x16,'RecallFailedTimeout');rpcDb[_0x2c46('0x90')](_0x510e5c,'[HistoryRecallClose]');rpcDb[_0x2c46('0x92')](_0x510e5c,_0x2c46('0x93'));}}}}})[_0x2c46('0x79')](ut['logger2']('[getContactRecallMe]'));};Preview[_0x2c46('0x64')][_0x2c46('0x69')]=function(_0x16e16e){_0x16e16e[_0x2c46('0x5e')]=!![];if(ut['IsNotLoggedIn'](_0x16e16e['loggedIn'])){_0x16e16e[_0x2c46('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x2c46('0x94')](_0x16e16e[_0x2c46('0x32')])){_0x16e16e[_0x2c46('0x4d')]=_0x2c46('0x95');}else if(!this[_0x2c46('0x96')](_0x16e16e[_0x2c46('0x53')])){if(!this[_0x2c46('0x96')](_0x16e16e[_0x2c46('0x97')])){_0x16e16e['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x16e16e['message']='ACTIVE';}}else{_0x16e16e[_0x2c46('0x4d')]='ACTIVE';}emitCampaignPreview(_0x16e16e);};Preview[_0x2c46('0x64')][_0x2c46('0x98')]=function(_0x32c1f8,_0x2a3105,_0x4592ff){var _0x39db5a=this;var _0x580f2e=this[_0x2c46('0x17')][_0x2a3105];var _0x3e0e3e=this[_0x2c46('0x14')][_0x580f2e[_0x2c46('0x6f')]];var _0x5e0219;if(_0x3e0e3e){switch(_0x4592ff){case'1':_0x3e0e3e[_0x2c46('0x3e')]+=0x1;_0x580f2e[_0x2c46('0x99')]+=0x1;_0x580f2e['countglobal']=ut[_0x2c46('0x9a')](_0x580f2e);ut['logCustomer'](_0x580f2e,0x0,_0x2c46('0x9b'));ami[_0x2c46('0x26')](_0x2c46('0x9c'),ut[_0x2c46('0x9d')](_0x580f2e,'nosuchnumber'));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0x9e'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e['dialGlobalMaxRetry']){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xa1'));}else{if(_0x580f2e['countnosuchnumberretry']>=_0x3e0e3e[_0x2c46('0xa2')]){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xa1'));}else{rpcDb[_0x2c46('0xa3')](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0x99'),_0x3e0e3e['dialNoSuchNumberRetryFrequency']),_0x580f2e[_0x2c46('0xa5')],_0x580f2e[_0x2c46('0xa6')]);}}delete this['actions'][_0x32c1f8[_0x2c46('0xa7')]];break;case'ANSWER':var _0x5c7c17=moment()[_0x2c46('0x56')](_0x2c46('0x8c'));_0x580f2e[_0x2c46('0xa8')]=_0x5c7c17;_0x580f2e[_0x2c46('0xa9')]=_0x5c7c17;_0x580f2e[_0x2c46('0x71')]=!![];_0x3e0e3e[_0x2c46('0x5d')]+=0x1;logger['info'](_0x2c46('0xaa'),_0x580f2e[_0x2c46('0xab')],_0x2c46('0xac'),_0x3e0e3e[_0x2c46('0x29')],'pTalking:\x20',_0x3e0e3e[_0x2c46('0x5d')]);ami[_0x2c46('0x26')]('custom:agentconnect',ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xad')));if(_0x3e0e3e[_0x2c46('0xae')]){ami[_0x2c46('0x26')](_0x2c46('0xaf'),ut['buildAcw'](_0x580f2e));}break;case'16':ami['emit'](_0x2c46('0xb0'),ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xb1')));emitVoiceQueueChannelRemove(ut[_0x2c46('0x9d')](_0x580f2e,'complete'));_0x3e0e3e[_0x2c46('0x37')]+=0x1;_0x3e0e3e[_0x2c46('0x30')]+=0x1;_0x3e0e3e[_0x2c46('0x2a')]+=0x1;ut[_0x2c46('0x7c')](_0x3e0e3e,'[16]');_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0x4,_0x2c46('0xb3'));rpcDb['createCustomerHistory'](_0x580f2e,_0x2c46('0xb4'));rpcDb[_0x2c46('0x92')](_0x580f2e,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x2c46('0xb5')](_0x580f2e);_0x3e0e3e[_0x2c46('0xb6')]+=_0x580f2e[_0x2c46('0xb7')];_0x3e0e3e[_0x2c46('0x2d')]+=_0x580f2e[_0x2c46('0xb7')];logger[_0x2c46('0x58')](_0x2c46('0xb8'),_0x580f2e[_0x2c46('0xab')],_0x2c46('0xac'),_0x3e0e3e[_0x2c46('0x29')],_0x2c46('0x70'),_0x3e0e3e[_0x2c46('0x5d')]);delete this[_0x2c46('0x17')][_0x32c1f8[_0x2c46('0xa7')]];break;case _0x2c46('0xb9'):_0x3e0e3e[_0x2c46('0x39')]+=0x1;_0x580f2e[_0x2c46('0xba')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0x5,_0x2c46('0xbb'));ami['emit'](_0x2c46('0xbc'),ut[_0x2c46('0x9d')](_0x580f2e,'busy'));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xbd'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e['dialGlobalMaxRetry']){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb['createCustomerFinal'](_0x5e0219,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x580f2e['countbusyretry']>=_0x3e0e3e['dialBusyMaxRetry']){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xbd'));}else{rpcDb['rescheduleContact'](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0xba'),_0x3e0e3e[_0x2c46('0xbe')]),_0x580f2e[_0x2c46('0xa5')],_0x580f2e[_0x2c46('0xa6')]);}}break;case _0x2c46('0xbf'):_0x3e0e3e[_0x2c46('0x3d')]+=0x1;_0x580f2e[_0x2c46('0xc0')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut['totalGlobal'](_0x580f2e);ut['logCustomer'](_0x580f2e,0x3,_0x2c46('0xc1'));ami[_0x2c46('0x26')](_0x2c46('0xc2'),ut[_0x2c46('0x9d')](_0x580f2e,'noanswer'));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xc3'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xc5'));}else{if(_0x580f2e['countnoanswerretry']>=_0x3e0e3e[_0x2c46('0xc6')]){rpcDb['createCustomerFinal'](_0x580f2e,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0xc0'),_0x3e0e3e[_0x2c46('0xc7')]),_0x580f2e[_0x2c46('0xa5')],_0x580f2e['activeContact']);}}break;case _0x2c46('0xc8'):_0x3e0e3e[_0x2c46('0x3a')]+=0x1;_0x580f2e[_0x2c46('0xc9')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut['logCustomer'](_0x580f2e,0x8,_0x2c46('0xca'));ami[_0x2c46('0x26')](_0x2c46('0xcb'),ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xcc')));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xcd'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xce'));}else{if(_0x580f2e[_0x2c46('0xc9')]>=_0x3e0e3e[_0x2c46('0xcf')]){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xcd'));}else{rpcDb[_0x2c46('0xa3')](ut['scheduledAt'](_0x580f2e,_0x2c46('0xc9'),_0x3e0e3e[_0x2c46('0xbe')]),_0x580f2e[_0x2c46('0xa5')],_0x580f2e[_0x2c46('0xa6')]);}}break;case'CANCEL':_0x3e0e3e[_0x2c46('0x41')]+=0x1;_0x580f2e['countagentrejectretry']+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut['totalGlobal'](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0x14,_0x2c46('0xd0'));ami[_0x2c46('0x26')](_0x2c46('0xd1'),ut[_0x2c46('0x9d')](_0x580f2e,_0x2c46('0xd2')));rpcDb[_0x2c46('0x90')](_0x580f2e,_0x2c46('0xd3'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut['cloneAction'](_0x580f2e,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x5e0219,_0x2c46('0xd4'));}else{if(_0x580f2e[_0x2c46('0xd5')]>=_0x3e0e3e['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x580f2e,_0x2c46('0xd4'));}else{rpcDb[_0x2c46('0xa3')](ut[_0x2c46('0xa4')](_0x580f2e,_0x2c46('0xd5'),_0x3e0e3e['dialAgentRejectRetryFrequency']),_0x580f2e['unlockAgent'],_0x580f2e[_0x2c46('0xa6')]);}}break;case _0x2c46('0xd6'):_0x3e0e3e['outboundAbandonedCallsDay']+=0x1;_0x580f2e[_0x2c46('0xd7')]+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut[_0x2c46('0x9a')](_0x580f2e);ut['logCustomer'](_0x580f2e,0xb,_0x2c46('0xd8'));rpcDb[_0x2c46('0x90')](_0x580f2e,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut[_0x2c46('0x9f')](_0x580f2e,0xf,_0x2c46('0xa0'));rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xd9'));}else{if(_0x580f2e[_0x2c46('0xda')]>=_0x3e0e3e['dialAbandonedMaxRety']){rpcDb[_0x2c46('0x92')](_0x580f2e,_0x2c46('0xd9'));}else{rpcDb[_0x2c46('0xa3')](ut[_0x2c46('0xa4')](_0x580f2e,'countabandonedretry',_0x3e0e3e['dialAbandonedRetryFrequency']),_0x580f2e[_0x2c46('0xa5')],_0x580f2e['activeContact']);}}break;default:if(_0x580f2e[_0x2c46('0x71')]){ut['decrementTalkink'](_0x3e0e3e,'[default]');ut[_0x2c46('0x7e')](_0x2c46('0xdb')+_0x3e0e3e['name'],_0x32c1f8);}_0x3e0e3e['outboundUnknownCallsDay']+=0x1;_0x580f2e[_0x2c46('0xb2')]=ut['totalGlobal'](_0x580f2e);ut[_0x2c46('0x91')](_0x580f2e,0xc,_0x32c1f8['cause-txt']||_0x32c1f8[_0x2c46('0xdc')]);rpcDb['createCustomerHistory'](_0x580f2e,_0x2c46('0xdd'));if(ut[_0x2c46('0x9a')](_0x580f2e)>=_0x3e0e3e[_0x2c46('0xc4')]){_0x5e0219=ut['cloneAction'](_0x580f2e,0xf,'Global');rpcDb[_0x2c46('0x92')](_0x5e0219,_0x2c46('0xde'));}else{rpcDb[_0x2c46('0x92')](_0x580f2e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x2c46('0x17')][_0x32c1f8['linkedid']];}if(!(_0x580f2e[_0x2c46('0x71')]&&_0x4592ff==='16')){ut[_0x2c46('0x7b')](_0x3e0e3e,'[callProgressDetectingCustomer]');logger['info'](_0x2c46('0xdf'),_0x580f2e['uniqueid'],_0x2c46('0xac'),_0x3e0e3e['name'],_0x2c46('0xe0'),_0x3e0e3e[_0x2c46('0x4e')]);}if(_0x4592ff!==_0x2c46('0xe1')){delete this['actions'][_0x32c1f8[_0x2c46('0xa7')]];delete this['actions'][_0x32c1f8['destlinkedid']];}}};Preview[_0x2c46('0x64')][_0x2c46('0xe2')]=function(_0x52fe37,_0x5143b8,_0x186674){if(_[_0x2c46('0xe3')](_0x5143b8)&&_0x2c46('0xe4')!==typeof _0x5143b8){return;}if(_[_0x2c46('0xe3')](_0x186674)&&_0x2c46('0xe4')!==typeof _0x186674){return;}switch(_0x186674[_0x2c46('0xe5')]){case'0':ut['logAgent'](_0x52fe37,0x0,_0x2c46('0x9b'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xe7'));break;case'3':ut[_0x2c46('0xe8')](_0x52fe37,0x3,_0x2c46('0xc1'));rpcDb[_0x2c46('0xe6')](_0x52fe37,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x2c46('0xe8')](_0x52fe37,0x5,_0x2c46('0xbb'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xe9'));break;case'8':ut[_0x2c46('0xe8')](_0x52fe37,0x8,_0x2c46('0xca'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xea'));break;case'22':ut[_0x2c46('0xe8')](_0x52fe37,0x16,_0x2c46('0xeb'));rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xec'));break;default:ut[_0x2c46('0xe8')](_0x52fe37,0xc,_0x186674['reason']);rpcDb[_0x2c46('0xe6')](_0x52fe37,_0x2c46('0xea'));}ut[_0x2c46('0x7b')](_0x5143b8,_0x2c46('0xed'));logger[_0x2c46('0x58')]('[originated][decrement][callProgressDetectingAgent]',_0x52fe37['uniqueid'],_0x2c46('0xac'),_0x5143b8[_0x2c46('0x29')],_0x2c46('0xe0'),_0x5143b8[_0x2c46('0x4e')]);delete this['actions'][_0x52fe37['uniqueid']];};Preview[_0x2c46('0x64')][_0x2c46('0xee')]=function(_0x3b361e,_0x3b2dfb,_0x524b55,_0x5e979d,_0x43ca69){var _0x39b563=this;return new BPromise(function(_0x30fc81,_0x344a89){if(_[_0x2c46('0x6c')](_0x3b2dfb)||_[_0x2c46('0x6c')](_0x3b2dfb[_0x2c46('0xef')])||_[_0x2c46('0x6c')](_0x3b2dfb[_0x2c46('0xef')]['phone'])||_[_0x2c46('0x6c')](_0x3b2dfb[_0x2c46('0x75')])){_0x344a89(ut['message']('Contact\x20is\x20undefined',_0x5e979d,_0x43ca69));return;}var _0x200a6a=uuid['v4']();var _0x2851a7=_0x39b563[_0x2c46('0x14')][_0x3b2dfb[_0x2c46('0x6e')][_0x2c46('0x29')]];var _0x43c4d0=_0x524b55?_0x39b563[_0x2c46('0x18')][_0x524b55]['id']:undefined;_0x39b563[_0x2c46('0x17')][_0x200a6a]=new Action(_0x3b2dfb,_0x2851a7,_0x200a6a,_0x524b55,_0x43c4d0);var _0x263f25=_0x39b563[_0x2c46('0x17')][_0x200a6a];_0x263f25[_0x2c46('0xa5')]=_0x5e979d;_0x263f25[_0x2c46('0xa6')]=_0x43ca69;_0x263f25[_0x2c46('0xf0')]=_0x524b55;if(_[_0x2c46('0xf1')](_0x3b361e)){_0x39b563['execCall'](_0x263f25,_0x2851a7,_0x3b2dfb,_0x524b55)[_0x2c46('0x82')](function(_0x233a2e){logger[_0x2c46('0x58')](_0x2c46('0xf2'),'Queue:\x20'+_0x263f25['queue']+_0x2c46('0xf3')+_0x263f25[_0x2c46('0xf4')],JSON[_0x2c46('0x5a')](_0x233a2e));ami['emit'](_0x2c46('0xf5'),ut[_0x2c46('0x9d')](_0x263f25,_0x2c46('0xf6')));_0x30fc81(ut[_0x2c46('0x4d')]('Calling'));})[_0x2c46('0x79')](function(_0x3e546a){ut[_0x2c46('0x60')]('[Preview][execCall][failure]',_0x3e546a);_0x344a89(ut[_0x2c46('0x4d')](_0x2c46('0xf7'),_0x5e979d,_0x43ca69));});}else{_0x2851a7[_0x2c46('0x38')]+=0x1;ut['logBlacklist'](_0x263f25);rpcDb['createHistory'](_0x263f25,_0x2c46('0xf8'));delete _0x39b563[_0x2c46('0x17')][_0x200a6a];_0x344a89(ut[_0x2c46('0x4d')](_0x2c46('0xf9'),_0x5e979d,_0x43ca69));}});};Preview['prototype']['isTrunkReachable']=function(_0xf2e9ed){return!_[_0x2c46('0x6c')](_0xf2e9ed)&&!_[_0x2c46('0x6c')](_0xf2e9ed[_0x2c46('0x29')])&&!_[_0x2c46('0x6c')](_0xf2e9ed[_0x2c46('0x54')])&&_0xf2e9ed['active']&&!_['isNil'](this[_0x2c46('0x16')][util['format'](_0x2c46('0xfa'),_0xf2e9ed[_0x2c46('0x29')])])&&!_['isNil'](this['trunks'][util[_0x2c46('0x56')](_0x2c46('0xfa'),_0xf2e9ed['name'])][_0x2c46('0x77')])&&(this['trunks'][util['format'](_0x2c46('0xfa'),_0xf2e9ed[_0x2c46('0x29')])][_0x2c46('0x77')]===_0x2c46('0xfb')||this['trunks'][util['format']('SIP/%s',_0xf2e9ed[_0x2c46('0x29')])]['status']===_0x2c46('0xfc'));};Preview[_0x2c46('0x64')][_0x2c46('0x87')]=function(_0x428be0,_0x28dd61){var _0x2cf46d=this;return new BPromise(function(_0x408a37,_0x19d296){_0x2cf46d[_0x2c46('0xfd')](_0x428be0,_0x28dd61)[_0x2c46('0x82')](function(_0x55a0d7){_0x408a37(_[_0x2c46('0x72')](_0x55a0d7,['message']));})[_0x2c46('0x79')](function(_0x16a8b4){if(_0x16a8b4[_0x2c46('0xfe')]){rpcDb[_0x2c46('0xff')](_0x428be0);}if(_0x16a8b4['active']){rpcDb[_0x2c46('0x8a')](_0x428be0);}_0x19d296(_['pick'](_0x16a8b4,[_0x2c46('0x4d')]));});});};Preview[_0x2c46('0x64')][_0x2c46('0xfd')]=function(_0x151f94,_0x3c1e55){var _0x5d6542=this;return new BPromise(function(_0xffb877,_0x39a485){var _0x1560e3,_0x4a2805;rpcDb[_0x2c46('0x100')](_0x151f94)[_0x2c46('0x82')](function(_0xc97661){if(!_['isNil'](_0xc97661[0x0])){_0x4a2805=_0xc97661[0x0][_0x2c46('0x101')]?![]:!![];_0x1560e3=_0xc97661[0x0][_0x2c46('0x101')]?!![]:![];_0x1560e3=_0x3c1e55?!![]:_0x1560e3;}var _0x41b09c=_0x5d6542[_0x2c46('0x102')](_0xc97661);if(_0x41b09c[_0x2c46('0x103')]){rpcDb[_0x2c46('0x104')](_[_0x2c46('0x72')](_0xc97661[0x0],[_0x2c46('0x75'),_0x2c46('0x105')]))['then'](function(_0x5d13ce){_0x5d6542['checkInBlack'](_0x5d13ce,_0xc97661[0x0],_0x3c1e55,_0x4a2805,_0x1560e3)[_0x2c46('0x82')](function(_0x317ae4){_0xffb877(_0x317ae4);})[_0x2c46('0x79')](function(_0xedb9d1){_0x39a485(_0xedb9d1);});})[_0x2c46('0x79')](function(_0x2eba34){ut['logger'](_0x2c46('0x106'),_0x2eba34);_0x39a485(ut['message'](_0x2c46('0x107'),_0x4a2805,_0x1560e3));});}else{_0x39a485(ut['message'](_0x41b09c['message'],_0x4a2805,_0x1560e3));}})[_0x2c46('0x79')](function(_0x5f2ea8){ut[_0x2c46('0x60')](_0x2c46('0x108'),_0x5f2ea8);_0x39a485(ut['message'](_0x2c46('0x107'),![],!![]));});});};Preview[_0x2c46('0x64')][_0x2c46('0x102')]=function(_0x319d98){if(_[_0x2c46('0x6c')](_0x319d98)||_[_0x2c46('0xf1')](_0x319d98)||!_[_0x2c46('0x6c')](_0x319d98[0x0][_0x2c46('0x85')])&&_[_0x2c46('0x6c')](_0x319d98[0x0][_0x2c46('0x85')][_0x2c46('0x29')])){ut[_0x2c46('0x60')](_0x2c46('0x109'),_0x319d98);return{'isValid':![],'message':_0x2c46('0x10a')};}var _0x249496=this[_0x2c46('0x14')][_0x319d98[0x0]['Queue'][_0x2c46('0x29')]];_0x249496['message']=_0x2c46('0x10b');if(_[_0x2c46('0x6c')](_0x249496)){ut[_0x2c46('0x60')](_0x2c46('0x10c'),_0x249496);return{'isValid':![],'message':_0x2c46('0x10d')};}if(!this['isTrunkReachable'](_0x249496[_0x2c46('0x53')])){ut[_0x2c46('0x60')](_0x2c46('0x10e'),_0x2c46('0x10f')+_0x249496[_0x2c46('0x29')]+_0x2c46('0x110'));if(!this['isTrunkReachable'](_0x249496[_0x2c46('0x97')])){ut['logger'](_0x2c46('0x10e'),_0x249496[_0x2c46('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x2c46('0x111')};}}if(!ut['isActive'](_0x249496[_0x2c46('0x32')])){ut[_0x2c46('0x60')](_0x2c46('0x112'),_0x249496[_0x2c46('0x29')]+_0x2c46('0x113'));return{'isValid':![],'message':_0x2c46('0x10f')+_0x249496[_0x2c46('0x29')]+_0x2c46('0x113')};}return{'isValid':!![],'message':_0x2c46('0x114')};};Preview['prototype'][_0x2c46('0x115')]=function(_0x5c1310,_0x47f4ea,_0xe22e2e,_0x92b495){var _0x3eb4b3=this;return new BPromise(function(_0x3f174b,_0x5235db){var _0x30dcfe=_0x5c1310[_0x2c46('0xab')];var _0x3f0f69=_0x3eb4b3[_0x2c46('0x96')](_0x47f4ea[_0x2c46('0x53')])?util[_0x2c46('0x56')]('SIP/%s/%s%s',_0x47f4ea[_0x2c46('0x53')][_0x2c46('0x29')],_[_0x2c46('0x6c')](_0x47f4ea[_0x2c46('0x116')])?'':_0x47f4ea[_0x2c46('0x116')][_0x2c46('0x117')]()||'',_0x47f4ea[_0x2c46('0x118')]>0x0?_0xe22e2e[_0x2c46('0xef')][_0x2c46('0x119')][_0x2c46('0x11a')](_0x47f4ea['dialCutDigit']):_0xe22e2e[_0x2c46('0xef')]['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x47f4ea[_0x2c46('0x97')])?_0x47f4ea['Trunk'][_0x2c46('0x29')]:_0x47f4ea[_0x2c46('0x97')]['name'],_[_0x2c46('0x6c')](_0x47f4ea[_0x2c46('0x116')])?'':_0x47f4ea[_0x2c46('0x116')][_0x2c46('0x117')]()||'',_0x47f4ea[_0x2c46('0x118')]>0x0?_0xe22e2e[_0x2c46('0xef')][_0x2c46('0x119')][_0x2c46('0x11a')](_0x47f4ea[_0x2c46('0x118')]):_0xe22e2e['Contact'][_0x2c46('0x119')]);var _0x2802da=_0x3eb4b3[_0x2c46('0x96')](_0x47f4ea[_0x2c46('0x53')])?ut[_0x2c46('0x11b')](_0x47f4ea[_0x2c46('0x53')][_0x2c46('0x11c')],_0x47f4ea[_0x2c46('0x34')],_0x47f4ea[_0x2c46('0x11d')]>0x0?ut['getCallerIdRandom'](_0x47f4ea['dialOriginateCallerIdNumber'],_0x47f4ea[_0x2c46('0x11d')]):_0x47f4ea[_0x2c46('0x11e')]):ut[_0x2c46('0x11b')](_[_0x2c46('0x6c')](_0x47f4ea[_0x2c46('0x97')])?_0x47f4ea[_0x2c46('0x53')]['callerid']:_0x47f4ea[_0x2c46('0x97')]['callerid'],_0x47f4ea[_0x2c46('0x34')],_0x47f4ea[_0x2c46('0x11d')]>0x0?ut[_0x2c46('0x11f')](_0x47f4ea['dialOriginateCallerIdNumber'],_0x47f4ea[_0x2c46('0x11d')]):_0x47f4ea['dialOriginateCallerIdNumber']);if(_0x2802da){_0x5c1310[_0x2c46('0x120')]=ut[_0x2c46('0x121')](_0x2802da);_0x5c1310[_0x2c46('0x122')]=ut[_0x2c46('0x123')](_0x2802da);}var _0x28694b=ut[_0x2c46('0x124')](_0x47f4ea,_0xe22e2e,_0x3f0f69,_0x2802da,_0x30dcfe,_0x5c1310);_[_0x2c46('0x125')](_0x5c1310,ut[_0x2c46('0x126')](_0x28694b));_0x5c1310['starttime']=moment()['format'](_0x2c46('0x8c'));ami[_0x2c46('0x127')](ut[_0x2c46('0x128')](_0x5c1310,_0x47f4ea,_0x28694b,_0x5c1310[_0x2c46('0xa6')],_0x92b495))[_0x2c46('0x82')](function(_0x308890){_0x47f4ea[_0x2c46('0x4e')]+=0x1;logger[_0x2c46('0x58')](_0x2c46('0x129'),_0x30dcfe,_0x2c46('0xac'),_0x47f4ea[_0x2c46('0x29')],_0x2c46('0xe0'),_0x47f4ea[_0x2c46('0x4e')]);_0x3f174b(_0x308890);})['catch'](function(_0x171f72){ut[_0x2c46('0xe8')](_0x5c1310,0xe,_0x2c46('0x12a'));rpcDb[_0x2c46('0xe6')](_0x5c1310,_0x2c46('0x12b'));_0x5235db(_0x171f72);});});};Preview[_0x2c46('0x64')]['syncNewExten']=function(_0x403fcf){if(this[_0x2c46('0x17')][_0x403fcf[_0x2c46('0xa7')]]){this[_0x2c46('0x17')][_0x403fcf[_0x2c46('0xa7')]]['channel']=_0x403fcf[_0x2c46('0x78')];}};Preview[_0x2c46('0x64')][_0x2c46('0x12c')]=function(_0x377109){var _0x3e85fa=this;var _0x2e8104=this[_0x2c46('0x17')][_0x377109[_0x2c46('0x12d')]];if(_0x2e8104){if(_0x2e8104['lookAgent']&&this[_0x2c46('0x18')][_0x2e8104[_0x2c46('0xf0')]]){ut[_0x2c46('0x12e')](_0x2e8104,this[_0x2c46('0x18')][_0x2e8104[_0x2c46('0xf0')]][_0x2c46('0x29')],this['agents'][_0x2e8104['lookAgent']]['id']);}var _0x3338c4=_[_0x2c46('0x12f')](_0x2e8104);_0x3338c4[_0x2c46('0xa8')]=moment()['format'](_0x2c46('0x8c'));var _0x42c168=_0x3e85fa[_0x2c46('0x14')][_0x2e8104['queue']];if(ut[_0x2c46('0x130')](_0x377109[_0x2c46('0x131')])){if(_0x2e8104[_0x2c46('0xa5')]){rpcDb['unlockContact'](_0x2e8104[_0x2c46('0xf4')]);}if(_0x2e8104[_0x2c46('0xa6')]){rpcDb[_0x2c46('0x8a')](_0x2e8104[_0x2c46('0xf4')]);}ami[_0x2c46('0x26')](_0x2c46('0x132'),ut[_0x2c46('0x9d')](_0x2e8104,_0x2c46('0x133')));this[_0x2c46('0xe2')](_0x3338c4,_0x42c168,_0x377109);}else{_0x2e8104['starttime']=moment()[_0x2c46('0x56')](_0x2c46('0x8c'));ut[_0x2c46('0xe8')](_0x3338c4,0x4,'Answer');rpcDb[_0x2c46('0xe6')](_0x3338c4,_0x2c46('0x134'));}}};Preview[_0x2c46('0x64')]['syncHangup']=function(_0x5afd8d){var _0x1a6282=this;var _0xdd991=this[_0x2c46('0x17')][_0x5afd8d['linkedid']];var _0x18bff6;if(_0xdd991){_0x18bff6=this[_0x2c46('0x14')][_0xdd991[_0x2c46('0x6f')]];logger[_0x2c46('0x58')](_0x2c46('0x135'),_0x5afd8d[_0x2c46('0xa7')],'\x20Queue',_0x18bff6[_0x2c46('0x29')],_0x2c46('0x70'),_0x18bff6[_0x2c46('0x5d')]);}if(this[_0x2c46('0x17')][_0x5afd8d['linkedid']]&&_0x5afd8d[_0x2c46('0xa7')]!==_0x5afd8d[_0x2c46('0xab')]){if(_0x5afd8d[_0x2c46('0x136')]==='16'&&this[_0x2c46('0x17')][_0x5afd8d[_0x2c46('0xa7')]]['dialAnswer']){this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')]);}else if(this['actions'][_0x5afd8d[_0x2c46('0xa7')]][_0x2c46('0x71')]){logger['info']('[syncHangup][talking][cause]',_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')],_0x2c46('0xac'),_0x18bff6['name'],_0x2c46('0x70'),_0x18bff6[_0x2c46('0x5d')]);this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')]);}}else if(_0xdd991&&_[_0x2c46('0x6c')](_0xdd991['statedesc'])&&_0x18bff6[_0x2c46('0x137')]&&_0x5afd8d['linkedid']===_0x5afd8d[_0x2c46('0xab')]&&_[_0x2c46('0x6c')](_0x5afd8d[_0x2c46('0xe5')])&&_0x5afd8d[_0x2c46('0x136')]==='16'&&_0x5afd8d[_0x2c46('0x138')]==='6'&&_['isUndefined'](_0xdd991[_0x2c46('0x139')])){if(_0xdd991['unlockAgent']){rpcDb['unlockContact'](_0xdd991[_0x2c46('0xf4')]);}if(_0xdd991[_0x2c46('0xa6')]){rpcDb[_0x2c46('0x8a')](_0xdd991[_0x2c46('0xf4')]);}_0x5afd8d['reason']='22';this[_0x2c46('0xe2')](_0xdd991,_0x18bff6,_0x5afd8d);}else if(_0xdd991&&_0xdd991[_0x2c46('0x139')]){if(_0x5afd8d[_0x2c46('0x136')]==='16'&&this['actions'][_0x5afd8d[_0x2c46('0xa7')]][_0x2c46('0x71')]){logger[_0x2c46('0x58')](_0x2c46('0x13a'),_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')],'\x20Queue',_0x18bff6[_0x2c46('0x29')],'pTalking:\x20',_0x18bff6[_0x2c46('0x5d')]);this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d['linkedid'],_0x5afd8d[_0x2c46('0x136')]);}else if(this[_0x2c46('0x17')][_0x5afd8d[_0x2c46('0xa7')]][_0x2c46('0x71')]){logger[_0x2c46('0x58')](_0x2c46('0x13b'),_0x5afd8d[_0x2c46('0xa7')],_0x5afd8d[_0x2c46('0x136')],_0x2c46('0xac'),_0x18bff6[_0x2c46('0x29')],'pTalking:\x20',_0x18bff6[_0x2c46('0x5d')]);this[_0x2c46('0x98')](_0x5afd8d,_0x5afd8d['linkedid'],_0x5afd8d[_0x2c46('0x136')]);}}};Preview[_0x2c46('0x64')][_0x2c46('0x1f')]=function(_0x1b79c4){if(this[_0x2c46('0x17')][_0x1b79c4[_0x2c46('0x13c')]]&&_0x1b79c4[_0x2c46('0x13c')]!==_0x1b79c4[_0x2c46('0x13d')]){this[_0x2c46('0x98')](_0x1b79c4,_0x1b79c4[_0x2c46('0x13c')],_0x1b79c4['dialstatus']);}};Preview[_0x2c46('0x64')][_0x2c46('0x1d')]=function(_0x5ebbbf){if(this[_0x2c46('0x17')][_0x5ebbbf[_0x2c46('0xa7')]]&&_0x5ebbbf[_0x2c46('0xa7')]!==_0x5ebbbf[_0x2c46('0xab')]&&!this[_0x2c46('0x17')][_0x5ebbbf[_0x2c46('0xa7')]][_0x2c46('0x71')]){if(_0x5ebbbf['cause']==='1'){this[_0x2c46('0x98')](_0x5ebbbf,_0x5ebbbf[_0x2c46('0xa7')],_0x5ebbbf[_0x2c46('0x136')]);}}};Preview[_0x2c46('0x64')][_0x2c46('0x13e')]=function(_0x1854cf,_0x6c7dc4,_0x479806){if(this['actions'][_0x1854cf]){if(_['isNil'](this[_0x2c46('0x17')][_0x1854cf][_0x2c46('0x13f')])){this[_0x2c46('0x17')][_0x1854cf][_0x2c46('0x13f')]={};}this[_0x2c46('0x17')][_0x1854cf]['variables'][_0x6c7dc4]=_0x479806;}};Preview[_0x2c46('0x64')][_0x2c46('0x140')]=function(_0x39191a){try{if(!_[_0x2c46('0x6c')](_0x39191a)){if(ut[_0x2c46('0x141')](_['keys'](_0x39191a['variable'])[0x0])){this[_0x2c46('0x13e')](_0x39191a[_0x2c46('0xab')],_[_0x2c46('0x142')](_0x39191a['variable'])[0x0],_0x39191a['value']);}}}catch(_0x42bc7f){logger[_0x2c46('0x143')](_0x2c46('0x144'),util[_0x2c46('0x145')](_0x42bc7f,{'showHidden':![],'depth':null}));}};Preview[_0x2c46('0x64')][_0x2c46('0x23')]=function(_0x348ab3){if(_0x348ab3){if(this[_0x2c46('0x17')][_0x348ab3[_0x2c46('0x146')]]){this['actions'][_0x348ab3[_0x2c46('0x146')]]['transfer']=!![];}}};Preview[_0x2c46('0x64')][_0x2c46('0x24')]=function(_0x15f364){if(_0x15f364){if(this[_0x2c46('0x17')][_0x15f364['transfererlinkedid']]){this[_0x2c46('0x17')][_0x15f364[_0x2c46('0x147')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x019d=['available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalAvailable','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','campaignsPreview','preview','booked','hasOwnProperty','setMessage','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','Agent','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','createCustomerFinal','countnosuchnumberretry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','pTalking','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','dialBusyRetryFrequency','unlockAgent','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','util','lodash','uuid','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','loopCampaigns','emit','type','outbound','name','strategy','answered'];(function(_0x32d861,_0xef1bac){var _0x181651=function(_0x2a4fab){while(--_0x2a4fab){_0x32d861['push'](_0x32d861['shift']());}};_0x181651(++_0xef1bac);}(_0x019d,0x129));var _0xd019=function(_0x32ab6e,_0x3b77ed){_0x32ab6e=_0x32ab6e-0x0;var _0x366c54=_0x019d[_0x32ab6e];return _0x366c54;};'use strict';var util=require(_0xd019('0x0'));var _=require(_0xd019('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd019('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0xd019('0x3'));var logger=require(_0xd019('0x4'))('preview');var loggerAction=require(_0xd019('0x4'))(_0xd019('0x5'));var ami=require('../ami');var rpcDb=require(_0xd019('0x6'));var Action=require('./action');var ut=require(_0xd019('0x7'));config['redis']=_[_0xd019('0x8')](config[_0xd019('0x9')],{'host':_0xd019('0xa'),'port':0x18eb});var io=require(_0xd019('0xb'))(new Redis(config[_0xd019('0x9')]));var Sequence=function(){};Sequence[_0xd019('0xc')][_0xd019('0xd')]=function(_0x1191b1){this[_0xd019('0xe')]=this[_0xd019('0xe')]?this[_0xd019('0xe')][_0xd019('0xf')](_0x1191b1):_0x1191b1();};function Preview(_0x3b04a5){this[_0xd019('0x10')]=new Sequence();this['campaignsPreview']=_0x3b04a5[_0xd019('0x11')];this[_0xd019('0x12')]=_0x3b04a5[_0xd019('0x12')];this[_0xd019('0x13')]={};this['agents']=_0x3b04a5[_0xd019('0x14')];this[_0xd019('0x15')]=0x0;ami['on']('originateresponse',this[_0xd019('0x16')]['bind'](this));ami['on'](_0xd019('0x17'),this[_0xd019('0x18')][_0xd019('0x19')](this));ami['on'](_0xd019('0x1a'),this[_0xd019('0x1b')][_0xd019('0x19')](this));ami['on'](_0xd019('0x1c'),this[_0xd019('0x1d')]['bind'](this));ami['on'](_0xd019('0x1e'),this[_0xd019('0x1f')]['bind'](this));ami['on'](_0xd019('0x20'),this[_0xd019('0x21')]['bind'](this));ami['on'](_0xd019('0x22'),this['syncAttendedTransfer'][_0xd019('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0xd019('0x23')](this['campaignsPreview']);}function emit(_0x4bf138,_0x34ad7a,_0x444e09){io['to'](_0x4bf138)[_0xd019('0x24')](_0x34ad7a,_0x444e09);}function emitCampaignPreview(_0x225035){if(_0x225035[_0xd019('0x25')]===_0xd019('0x26')){var _0xf1fed4={'id':_0x225035['id'],'name':_0x225035[_0xd019('0x27')],'strategy':_0x225035[_0xd019('0x28')],'answered':_0x225035[_0xd019('0x29')],'available':_0x225035[_0xd019('0x2a')],'loggedIn':_0x225035[_0xd019('0x2b')],'pTalking':_0x225035['pTalking'],'sumBillable':_0x225035[_0xd019('0x2c')],'sumDuration':_0x225035[_0xd019('0x2d')],'sumHoldTime':_0x225035[_0xd019('0x2e')]||0x0,'talking':_0x225035[_0xd019('0x2f')],'total':_0x225035[_0xd019('0x30')],'type':_0x225035[_0xd019('0x25')],'unmanaged':_0x225035[_0xd019('0x31')],'abandoned':_0x225035['abandoned'],'waiting':_0x225035[_0xd019('0x32')],'loggedInDb':_0x225035[_0xd019('0x33')],'dialActive':_0x225035['dialActive'],'dialMethod':_0x225035[_0xd019('0x34')],'dialOriginateCallerIdName':_0x225035[_0xd019('0x35')],'dialOriginateCallerIdNumber':_0x225035[_0xd019('0x36')],'dialOriginateTimeout':_0x225035[_0xd019('0x37')],'dialPrefix':_0x225035[_0xd019('0x38')],'outboundAnswerAgiCallsDay':_0x225035[_0xd019('0x39')],'outboundAnswerCallsDay':_0x225035['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x225035[_0xd019('0x3a')],'outboundBusyCallsDay':_0x225035['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x225035['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x225035['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x225035[_0xd019('0x3b')],'outboundDropCallsDayTimeout':_0x225035[_0xd019('0x3c')],'outboundNoAnswerCallsDay':_0x225035[_0xd019('0x3d')],'outboundNoSuchCallsDay':_0x225035[_0xd019('0x3e')],'outboundOriginateFailureCallsDay':_0x225035[_0xd019('0x3f')],'outboundReCallsDay':_0x225035[_0xd019('0x40')],'outboundRejectCallsDay':_0x225035[_0xd019('0x41')],'outboundUnknownCallsDay':_0x225035['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x225035[_0xd019('0x42')],'predictiveIntervalAnsweredCalls':_0x225035[_0xd019('0x43')],'predictiveIntervalAvgHoldtime':_0x225035[_0xd019('0x44')],'predictiveIntervalAvgTalktime':_0x225035[_0xd019('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x225035['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x225035[_0xd019('0x46')],'predictiveIntervalErlangCalls':_0x225035[_0xd019('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x225035[_0xd019('0x48')],'predictiveIntervalHitRate':_0x225035['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x225035['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x225035['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x225035[_0xd019('0x49')],'predictiveIntervalTotalCalls':_0x225035['predictiveIntervalTotalCalls'],'message':_0x225035[_0xd019('0x4a')],'originated':_0x225035[_0xd019('0x4b')],'erlangCalls':_0x225035['erlangCalls'],'erlangCallToSecond':_0x225035[_0xd019('0x4c')],'erlangAbandonmentRate':_0x225035[_0xd019('0x4d')],'erlangBusyFactor':_0x225035[_0xd019('0x4e')],'startPredictive':_0x225035[_0xd019('0x4f')],'startProgressive':_0x225035[_0xd019('0x50')]};if(_0x225035[_0xd019('0x51')]){_0xf1fed4[_0xd019('0x51')]={'id':_0x225035[_0xd019('0x51')]['id'],'name':_0x225035[_0xd019('0x51')][_0xd019('0x27')],'active':_0x225035[_0xd019('0x51')][_0xd019('0x52')],'callerid':_0x225035[_0xd019('0x51')][_0xd019('0x53')]};}if(_0x225035[_0xd019('0x54')]){_0xf1fed4[_0xd019('0x54')]={'id':_0x225035[_0xd019('0x54')]['id'],'name':_0x225035[_0xd019('0x54')][_0xd019('0x27')]};}var _0x147b69=md5(JSON[_0xd019('0x55')](_0xf1fed4));if(_0x225035[_0xd019('0x56')]!==_0x147b69){_0x225035[_0xd019('0x56')]=_0x147b69;emit(util[_0xd019('0x57')]('voice:queue:%s',_0xf1fed4[_0xd019('0x27')]),_0xd019('0x58'),_0xf1fed4);}}}function emitVoiceQueueChannelRemove(_0x5edc6f){logger[_0xd019('0x59')](_0xd019('0x5a'),JSON[_0xd019('0x55')](_0x5edc6f));emit(util[_0xd019('0x57')](_0xd019('0x5b'),_0x5edc6f[_0xd019('0x27')]),_0xd019('0x5c'),_0x5edc6f);}function notSendMessagesQueue(_0x28c143){if(_0x28c143[_0xd019('0x5d')]){if(_0x28c143[_0xd019('0x4b')]===0x0&&_0x28c143['pTalking']===0x0){_0x28c143[_0xd019('0x5d')]=![];_0x28c143[_0xd019('0x2a')]=0x0;_0x28c143[_0xd019('0x5e')]=0x0;_0x28c143[_0xd019('0x4a')]=_0xd019('0x5f');ut['logger'](_0xd019('0x60'),_0x28c143[_0xd019('0x27')]+_0xd019('0x61'));}else{_0x28c143[_0xd019('0x4a')]=_0xd019('0x62');ut[_0xd019('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x28c143[_0xd019('0x27')]+_0xd019('0x64'));}emitCampaignPreview(_0x28c143);}}Preview['prototype'][_0xd019('0x23')]=function(){var _0x39811f=this;setInterval(function(){_0x39811f[_0xd019('0x65')]();},0x7cf);};Preview[_0xd019('0xc')][_0xd019('0x65')]=function(){var _0xc5876=this[_0xd019('0x66')];this[_0xd019('0x15')]+=0x1;for(var _0x36d98a in _0xc5876){if(_0xc5876['hasOwnProperty'](_0x36d98a)&&(_0xc5876[_0x36d98a]['dialMethod']===_0xd019('0x67')||_0xc5876[_0x36d98a][_0xd019('0x34')]===_0xd019('0x68'))&&_0xc5876[_0x36d98a][_0xd019('0x25')]===_0xd019('0x26')){if(this[_0xd019('0x15')]>0x7){this[_0xd019('0x15')]=0x0;this['clearZombieChannels']();}}if(_0xc5876[_0xd019('0x69')](_0x36d98a)&&_0xc5876[_0x36d98a][_0xd019('0x34')]===_0xd019('0x67')&&_0xc5876[_0x36d98a][_0xd019('0x25')]===_0xd019('0x26')){if(_0xc5876[_0x36d98a]['dialActive']){this[_0xd019('0x6a')](_0xc5876[_0x36d98a]);this['recallMe'](_0xc5876[_0x36d98a]);}else{notSendMessagesQueue(_0xc5876[_0x36d98a]);}}}};Preview[_0xd019('0xc')][_0xd019('0x6b')]=function(_0x36f51d){var _0x7ca41d=this;this[_0xd019('0x10')][_0xd019('0xd')](function(){if(!_['isNil'](_0x7ca41d[_0xd019('0x13')][_0x36f51d])){loggerAction[_0xd019('0x59')](_0xd019('0x6c'),_0x36f51d,_0xd019('0x6d'),_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')],_0xd019('0x6f'),JSON[_0xd019('0x55')](_0x7ca41d[_0xd019('0x66')][_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')]]['originated']),_0xd019('0x70'),JSON[_0xd019('0x55')](_0x7ca41d[_0xd019('0x66')][_0x7ca41d['actions'][_0x36f51d][_0xd019('0x6e')]]['pTalking']),JSON['stringify'](_0x7ca41d['actions'][_0x36f51d][_0xd019('0x71')]),JSON[_0xd019('0x55')](_[_0xd019('0x72')](_0x7ca41d['actions'][_0x36f51d],['contactId','UserId',_0xd019('0x73'),_0xd019('0x74')])));return ami[_0xd019('0x75')]({'action':_0xd019('0x76'),'channel':_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x77')]})[_0xd019('0x78')](function(_0x1438e3){if(_0x1438e3[_0xd019('0x4a')]===_0xd019('0x79')){setTimeout(function(){if(_0x7ca41d[_0xd019('0x13')][_0x36f51d]){ut['updateOriginated'](_0x7ca41d[_0xd019('0x66')][_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')]],'[clearZombieChannel]');if(_0x7ca41d['actions'][_0x36f51d][_0xd019('0x71')]===!![]){ut[_0xd019('0x7a')](_0x7ca41d[_0xd019('0x66')][_0x7ca41d[_0xd019('0x13')][_0x36f51d]['queue']],_0xd019('0x7b'));ut[_0xd019('0x7c')](_0xd019('0x7d')+_0x36f51d,_0x7ca41d[_0xd019('0x13')][_0x36f51d]['queue']);}ut[_0xd019('0x7c')]('[Dialer][checkChannel][Preview]'+_0x36f51d,_0x7ca41d[_0xd019('0x13')][_0x36f51d][_0xd019('0x6e')]);delete _0x7ca41d[_0xd019('0x13')][_0x36f51d];}},0x2328);}});}});};Preview[_0xd019('0xc')]['clearZombieChannels']=function(){var _0x241edd=this;loggerAction[_0xd019('0x59')](_0xd019('0x7e'),_[_0xd019('0x7f')](this['actions']));for(var _0x39af21 in this[_0xd019('0x13')]){if(_0x241edd[_0xd019('0x13')][_0xd019('0x69')](_0x39af21)){_0x241edd[_0xd019('0x6b')](_0x39af21);}}};Preview[_0xd019('0xc')][_0xd019('0x80')]=function(_0x5eef24){var _0x2944bf=this;rpcDb[_0xd019('0x81')](_0x5eef24['id'],ut[_0xd019('0x82')](this[_0xd019('0x14')]))[_0xd019('0x83')](function(_0x1ed144){if(!_['isNil'](_0x1ed144)){for(var _0x5b0def=0x0;_0x5b0def<_0x1ed144[_0xd019('0x84')];_0x5b0def+=0x1){if(ut[_0xd019('0x85')](_0x1ed144[_0x5b0def]['scheduledat'])<_0x5eef24['dialRecallMeTimeout']*0x3c){if(_0x1ed144[_0x5b0def][_0xd019('0x86')]&&!_0x1ed144[_0x5b0def][_0xd019('0x86')]['voicePause']){_0x2944bf[_0xd019('0x87')](_0x1ed144[_0x5b0def]['id'])[_0xd019('0x83')](ut['logger2']('[RecallMe]'))[_0xd019('0x78')](ut['logger2'](_0xd019('0x88')));}else{rpcDb[_0xd019('0x89')](_0x1ed144[_0x5b0def]['id']);}}else{var _0x48c726=new Action(_0x1ed144[_0x5b0def],_0x5eef24);_0x48c726[_0xd019('0x8a')]=moment()['format'](_0xd019('0x8b'));_0x5eef24[_0xd019('0x40')]+=0x1;ut[_0xd019('0x8c')](_0x48c726,0x17,_0xd019('0x8d'));if(_0x5eef24[_0xd019('0x8e')]){rpcDb[_0xd019('0x8f')](ut[_0xd019('0x90')](_0x1ed144[_0x5b0def]));rpcDb[_0xd019('0x91')](_0x48c726,_0xd019('0x92'));}else{ut[_0xd019('0x8c')](_0x48c726,0x16,_0xd019('0x93'));rpcDb['createCustomerHistory'](_0x48c726,_0xd019('0x94'));rpcDb['createCustomerFinal'](_0x48c726,_0xd019('0x94'));}}}}})[_0xd019('0x78')](ut['logger2'](_0xd019('0x95')));};Preview['prototype'][_0xd019('0x6a')]=function(_0x1cd2e7){_0x1cd2e7[_0xd019('0x5d')]=!![];if(ut[_0xd019('0x96')](_0x1cd2e7[_0xd019('0x2b')])){_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x97');}else if(!ut[_0xd019('0x98')](_0x1cd2e7[_0xd019('0x99')])){_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x5f');}else if(!this[_0xd019('0x9a')](_0x1cd2e7[_0xd019('0x51')])){if(!this[_0xd019('0x9a')](_0x1cd2e7[_0xd019('0x9b')])){_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x9c');}else{_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x9d');}}else{_0x1cd2e7[_0xd019('0x4a')]=_0xd019('0x9d');}emitCampaignPreview(_0x1cd2e7);};Preview[_0xd019('0xc')][_0xd019('0x9e')]=function(_0x5a1574,_0x9800fb,_0x12575e){var _0x37f291=this;var _0x12aa05=this[_0xd019('0x13')][_0x9800fb];var _0x2ffaea=this[_0xd019('0x66')][_0x12aa05[_0xd019('0x6e')]];var _0x5b196d;if(_0x2ffaea){switch(_0x12575e){case'1':_0x2ffaea['outboundNoSuchCallsDay']+=0x1;_0x12aa05['countnosuchnumberretry']+=0x1;_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x0,_0xd019('0xa1'));ami[_0xd019('0x24')](_0xd019('0xa2'),ut[_0xd019('0xa3')](_0x12aa05,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x12aa05,_0xd019('0xa4'));if(ut['totalGlobal'](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut[_0xd019('0xa6')](_0x12aa05,0xf,'Global');rpcDb[_0xd019('0xa7')](_0x5b196d,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x12aa05[_0xd019('0xa8')]>=_0x2ffaea['dialNoSuchNumberMaxRetry']){rpcDb[_0xd019('0xa7')](_0x12aa05,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xd019('0xa9')](_0x12aa05,_0xd019('0xa8'),_0x2ffaea[_0xd019('0xaa')]),_0x12aa05['unlockAgent'],_0x12aa05[_0xd019('0xab')]);}}delete this['actions'][_0x5a1574[_0xd019('0xac')]];break;case _0xd019('0xad'):var _0x502678=moment()['format'](_0xd019('0x8b'));_0x12aa05[_0xd019('0xae')]=_0x502678;_0x12aa05[_0xd019('0xaf')]=_0x502678;_0x12aa05[_0xd019('0x71')]=!![];_0x2ffaea[_0xd019('0xb0')]+=0x1;logger[_0xd019('0x59')](_0xd019('0xb1'),_0x12aa05[_0xd019('0xb2')],_0xd019('0xb3'),_0x2ffaea[_0xd019('0x27')],'pTalking:\x20',_0x2ffaea['pTalking']);ami[_0xd019('0x24')](_0xd019('0xb4'),ut['buildObj'](_0x12aa05,_0xd019('0xb5')));if(_0x2ffaea[_0xd019('0xb6')]){ami[_0xd019('0x24')](_0xd019('0xb7'),ut[_0xd019('0xb8')](_0x12aa05));}break;case'16':ami[_0xd019('0x24')](_0xd019('0xb9'),ut[_0xd019('0xa3')](_0x12aa05,'complete'));emitVoiceQueueChannelRemove(ut[_0xd019('0xa3')](_0x12aa05,'complete'));_0x2ffaea[_0xd019('0xba')]+=0x1;_0x2ffaea[_0xd019('0x30')]+=0x1;_0x2ffaea[_0xd019('0x29')]+=0x1;ut[_0xd019('0x7a')](_0x2ffaea,_0xd019('0xbb'));_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x4,_0xd019('0xbc'));rpcDb['createCustomerHistory'](_0x12aa05,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xbd'));rpcDb[_0xd019('0xbe')](_0x12aa05);_0x2ffaea[_0xd019('0x2d')]+=_0x12aa05[_0xd019('0xbf')];_0x2ffaea[_0xd019('0x2c')]+=_0x12aa05[_0xd019('0xbf')];logger[_0xd019('0x59')](_0xd019('0xc0'),_0x12aa05[_0xd019('0xb2')],_0xd019('0xb3'),_0x2ffaea[_0xd019('0x27')],_0xd019('0x70'),_0x2ffaea[_0xd019('0xb0')]);delete this[_0xd019('0x13')][_0x5a1574[_0xd019('0xac')]];break;case'BUSY':_0x2ffaea['outboundBusyCallsDay']+=0x1;_0x12aa05[_0xd019('0xc1')]+=0x1;_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x5,_0xd019('0xc2'));ami[_0xd019('0x24')](_0xd019('0xc3'),ut[_0xd019('0xa3')](_0x12aa05,_0xd019('0xc4')));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xc5'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea['dialGlobalMaxRetry']){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb['createCustomerFinal'](_0x5b196d,_0xd019('0xc7'));}else{if(_0x12aa05[_0xd019('0xc1')]>=_0x2ffaea['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x12aa05,_0xd019('0xc5'));}else{rpcDb[_0xd019('0xc8')](ut[_0xd019('0xa9')](_0x12aa05,'countbusyretry',_0x2ffaea[_0xd019('0xc9')]),_0x12aa05[_0xd019('0xca')],_0x12aa05['activeContact']);}}break;case'NOANSWER':_0x2ffaea[_0xd019('0x3d')]+=0x1;_0x12aa05[_0xd019('0xcb')]+=0x1;_0x12aa05['countglobal']=ut['totalGlobal'](_0x12aa05);ut['logCustomer'](_0x12aa05,0x3,_0xd019('0xcc'));ami['emit'](_0xd019('0xcd'),ut[_0xd019('0xa3')](_0x12aa05,_0xd019('0xce')));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xcf'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xd0'));}else{if(_0x12aa05[_0xd019('0xcb')]>=_0x2ffaea[_0xd019('0xd1')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xcf'));}else{rpcDb[_0xd019('0xc8')](ut['scheduledAt'](_0x12aa05,_0xd019('0xcb'),_0x2ffaea[_0xd019('0xd2')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;case _0xd019('0xd3'):_0x2ffaea[_0xd019('0xd4')]+=0x1;_0x12aa05['countcongestionretry']+=0x1;_0x12aa05[_0xd019('0x9f')]=ut['totalGlobal'](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x8,_0xd019('0xd5'));ami['emit'](_0xd019('0xd6'),ut[_0xd019('0xa3')](_0x12aa05,_0xd019('0xd7')));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xd8'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea['dialGlobalMaxRetry']){_0x5b196d=ut[_0xd019('0xa6')](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xd9'));}else{if(_0x12aa05['countcongestionretry']>=_0x2ffaea[_0xd019('0xda')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xd8'));}else{rpcDb[_0xd019('0xc8')](ut[_0xd019('0xa9')](_0x12aa05,_0xd019('0xdb'),_0x2ffaea[_0xd019('0xc9')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;case _0xd019('0xdc'):_0x2ffaea[_0xd019('0x41')]+=0x1;_0x12aa05[_0xd019('0xdd')]+=0x1;_0x12aa05[_0xd019('0x9f')]=ut[_0xd019('0xa0')](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0x14,'AgentReject');ami['emit'](_0xd019('0xde'),ut['buildObj'](_0x12aa05,_0xd019('0xdf')));rpcDb['createCustomerHistory'](_0x12aa05,_0xd019('0xe0'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut[_0xd019('0xa6')](_0x12aa05,0x14,_0xd019('0xe1'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xe2'));}else{if(_0x12aa05[_0xd019('0xdd')]>=_0x2ffaea[_0xd019('0xe3')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0xd019('0xa9')](_0x12aa05,_0xd019('0xdd'),_0x2ffaea[_0xd019('0xe4')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;case _0xd019('0xe5'):_0x2ffaea[_0xd019('0x42')]+=0x1;_0x12aa05['countabandonedretry']+=0x1;_0x12aa05['countglobal']=ut['totalGlobal'](_0x12aa05);ut['logCustomer'](_0x12aa05,0xb,_0xd019('0xe6'));rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xe7'));if(ut['totalGlobal'](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,_0xd019('0xe7'));}else{if(_0x12aa05[_0xd019('0xe8')]>=_0x2ffaea[_0xd019('0xe9')]){rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xe7'));}else{rpcDb[_0xd019('0xc8')](ut[_0xd019('0xa9')](_0x12aa05,'countabandonedretry',_0x2ffaea[_0xd019('0xea')]),_0x12aa05[_0xd019('0xca')],_0x12aa05[_0xd019('0xab')]);}}break;default:if(_0x12aa05[_0xd019('0x71')]){ut[_0xd019('0x7a')](_0x2ffaea,_0xd019('0xeb'));ut[_0xd019('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2ffaea['name'],_0x5a1574);}_0x2ffaea[_0xd019('0xec')]+=0x1;_0x12aa05[_0xd019('0x9f')]=ut['totalGlobal'](_0x12aa05);ut[_0xd019('0x8c')](_0x12aa05,0xc,_0x5a1574[_0xd019('0xed')]||_0x5a1574[_0xd019('0xee')]);rpcDb[_0xd019('0x91')](_0x12aa05,_0xd019('0xef'));if(ut[_0xd019('0xa0')](_0x12aa05)>=_0x2ffaea[_0xd019('0xa5')]){_0x5b196d=ut['cloneAction'](_0x12aa05,0xf,_0xd019('0xc6'));rpcDb[_0xd019('0xa7')](_0x5b196d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xd019('0xa7')](_0x12aa05,_0xd019('0xf0'));}delete this[_0xd019('0x13')][_0x5a1574[_0xd019('0xac')]];}if(!(_0x12aa05[_0xd019('0x71')]&&_0x12575e==='16')){ut['updateOriginated'](_0x2ffaea,'[callProgressDetectingCustomer]');logger['info'](_0xd019('0xf1'),_0x12aa05[_0xd019('0xb2')],_0xd019('0xb3'),_0x2ffaea[_0xd019('0x27')],'originated:\x20',_0x2ffaea[_0xd019('0x4b')]);}if(_0x12575e!==_0xd019('0xad')){delete this[_0xd019('0x13')][_0x5a1574['linkedid']];delete this[_0xd019('0x13')][_0x5a1574[_0xd019('0xf2')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x20c6ff,_0x47183b,_0x411a12){if(_['isUndefined'](_0x47183b)&&'object'!==typeof _0x47183b){return;}if(_[_0xd019('0xf3')](_0x411a12)&&_0xd019('0xf4')!==typeof _0x411a12){return;}switch(_0x411a12[_0xd019('0xf5')]){case'0':ut[_0xd019('0xf6')](_0x20c6ff,0x0,'NoSuchNumber');rpcDb[_0xd019('0xf7')](_0x20c6ff,_0xd019('0xf8'));break;case'3':ut['logAgent'](_0x20c6ff,0x3,_0xd019('0xcc'));rpcDb[_0xd019('0xf7')](_0x20c6ff,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x20c6ff,0x5,_0xd019('0xc2'));rpcDb[_0xd019('0xf7')](_0x20c6ff,_0xd019('0xf9'));break;case'8':ut['logAgent'](_0x20c6ff,0x8,_0xd019('0xd5'));rpcDb[_0xd019('0xf7')](_0x20c6ff,_0xd019('0xfa'));break;case'22':ut[_0xd019('0xf6')](_0x20c6ff,0x16,_0xd019('0xfb'));rpcDb['createAgentHistory'](_0x20c6ff,_0xd019('0xfc'));break;default:ut['logAgent'](_0x20c6ff,0xc,_0x411a12[_0xd019('0xf5')]);rpcDb['createAgentHistory'](_0x20c6ff,_0xd019('0xfa'));}ut[_0xd019('0xfd')](_0x47183b,_0xd019('0xfe'));logger[_0xd019('0x59')](_0xd019('0xff'),_0x20c6ff['uniqueid'],_0xd019('0xb3'),_0x47183b['name'],_0xd019('0x6f'),_0x47183b[_0xd019('0x4b')]);delete this[_0xd019('0x13')][_0x20c6ff[_0xd019('0xb2')]];};Preview[_0xd019('0xc')][_0xd019('0x100')]=function(_0x9b62cf,_0x3f8726,_0x517329,_0xad1ee,_0x42caa3){var _0x3543f9=this;return new BPromise(function(_0x545b6c,_0xb4a72a){if(_[_0xd019('0x101')](_0x3f8726)||_['isNil'](_0x3f8726[_0xd019('0x102')])||_[_0xd019('0x101')](_0x3f8726[_0xd019('0x102')]['phone'])||_[_0xd019('0x101')](_0x3f8726[_0xd019('0x73')])){_0xb4a72a(ut['message'](_0xd019('0x103'),_0xad1ee,_0x42caa3));return;}var _0x33bcb5=uuid['v4']();var _0x14cabb=_0x3543f9[_0xd019('0x66')][_0x3f8726[_0xd019('0x6d')][_0xd019('0x27')]];var _0x599f4b=_0x517329?_0x3543f9['agents'][_0x517329]['id']:undefined;_0x3543f9[_0xd019('0x13')][_0x33bcb5]=new Action(_0x3f8726,_0x14cabb,_0x33bcb5,_0x517329,_0x599f4b);var _0x39c972=_0x3543f9[_0xd019('0x13')][_0x33bcb5];_0x39c972[_0xd019('0xca')]=_0xad1ee;_0x39c972[_0xd019('0xab')]=_0x42caa3;_0x39c972[_0xd019('0x104')]=_0x517329;if(_[_0xd019('0x105')](_0x9b62cf)){_0x3543f9['execCall'](_0x39c972,_0x14cabb,_0x3f8726,_0x517329)[_0xd019('0x83')](function(_0x972636){logger[_0xd019('0x59')](_0xd019('0x106'),_0xd019('0x107')+_0x39c972[_0xd019('0x6e')]+_0xd019('0x108')+_0x39c972['idContact'],JSON[_0xd019('0x55')](_0x972636));ami['emit'](_0xd019('0x109'),ut[_0xd019('0xa3')](_0x39c972,'called'));_0x545b6c(ut[_0xd019('0x4a')]('Calling'));})[_0xd019('0x78')](function(_0xd8e057){ut[_0xd019('0x63')](_0xd019('0x10a'),_0xd8e057);_0xb4a72a(ut['message']('Call\x20failed',_0xad1ee,_0x42caa3));});}else{_0x14cabb[_0xd019('0x3a')]+=0x1;ut['logBlacklist'](_0x39c972);rpcDb[_0xd019('0x10b')](_0x39c972,_0xd019('0x10c'));delete _0x3543f9[_0xd019('0x13')][_0x33bcb5];_0xb4a72a(ut[_0xd019('0x4a')](_0xd019('0x10d'),_0xad1ee,_0x42caa3));}});};Preview[_0xd019('0xc')][_0xd019('0x9a')]=function(_0x3496a7){return!_[_0xd019('0x101')](_0x3496a7)&&!_[_0xd019('0x101')](_0x3496a7[_0xd019('0x27')])&&!_[_0xd019('0x101')](_0x3496a7[_0xd019('0x52')])&&_0x3496a7['active']&&!_[_0xd019('0x101')](this[_0xd019('0x12')][util[_0xd019('0x57')](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])])&&!_[_0xd019('0x101')](this[_0xd019('0x12')][util[_0xd019('0x57')](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])][_0xd019('0x76')])&&(this[_0xd019('0x12')][util[_0xd019('0x57')](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])]['status']===_0xd019('0x10f')||this[_0xd019('0x12')][util['format'](_0xd019('0x10e'),_0x3496a7[_0xd019('0x27')])][_0xd019('0x76')]===_0xd019('0x110'));};Preview[_0xd019('0xc')][_0xd019('0x87')]=function(_0x4e7d0b,_0x5258ef){var _0x5c29e9=this;return new BPromise(function(_0x33eae1,_0x329852){_0x5c29e9[_0xd019('0x111')](_0x4e7d0b,_0x5258ef)[_0xd019('0x83')](function(_0x29c37a){_0x33eae1(_[_0xd019('0x72')](_0x29c37a,[_0xd019('0x4a')]));})[_0xd019('0x78')](function(_0x46889e){if(_0x46889e[_0xd019('0x112')]){rpcDb[_0xd019('0x113')](_0x4e7d0b);}if(_0x46889e[_0xd019('0x52')]){rpcDb[_0xd019('0x89')](_0x4e7d0b);}_0x329852(_['pick'](_0x46889e,[_0xd019('0x4a')]));});});};Preview[_0xd019('0xc')][_0xd019('0x111')]=function(_0x4c3cdf,_0x19b12f){var _0x45a35d=this;return new BPromise(function(_0x14ad1b,_0x1b7065){var _0x339289,_0x599e08;rpcDb[_0xd019('0x114')](_0x4c3cdf)[_0xd019('0x83')](function(_0x4ba511){if(!_[_0xd019('0x101')](_0x4ba511[0x0])){_0x599e08=_0x4ba511[0x0][_0xd019('0x115')]?![]:!![];_0x339289=_0x4ba511[0x0][_0xd019('0x115')]?!![]:![];_0x339289=_0x19b12f?!![]:_0x339289;}var _0x408fbc=_0x45a35d[_0xd019('0x116')](_0x4ba511);if(_0x408fbc[_0xd019('0x117')]){rpcDb[_0xd019('0x118')](_[_0xd019('0x72')](_0x4ba511[0x0],[_0xd019('0x73'),_0xd019('0x119')]))[_0xd019('0x83')](function(_0xe882cf){_0x45a35d[_0xd019('0x100')](_0xe882cf,_0x4ba511[0x0],_0x19b12f,_0x599e08,_0x339289)[_0xd019('0x83')](function(_0x1ed707){_0x14ad1b(_0x1ed707);})[_0xd019('0x78')](function(_0x5a7e81){_0x1b7065(_0x5a7e81);});})['catch'](function(_0x48bcbd){ut[_0xd019('0x63')](_0xd019('0x11a'),_0x48bcbd);_0x1b7065(ut['message'](_0xd019('0x11b'),_0x599e08,_0x339289));});}else{_0x1b7065(ut['message'](_0x408fbc[_0xd019('0x4a')],_0x599e08,_0x339289));}})[_0xd019('0x78')](function(_0x2c6a21){ut[_0xd019('0x63')](_0xd019('0x11c'),_0x2c6a21);_0x1b7065(ut['message'](_0xd019('0x11b'),![],!![]));});});};Preview[_0xd019('0xc')][_0xd019('0x116')]=function(_0x2345f8){if(_[_0xd019('0x101')](_0x2345f8)||_[_0xd019('0x105')](_0x2345f8)||!_[_0xd019('0x101')](_0x2345f8[0x0][_0xd019('0x86')])&&_['isNil'](_0x2345f8[0x0][_0xd019('0x86')][_0xd019('0x27')])){ut[_0xd019('0x63')](_0xd019('0x11d'),_0x2345f8);return{'isValid':![],'message':_0xd019('0x11e')};}var _0x57e64b=this['campaignsPreview'][_0x2345f8[0x0][_0xd019('0x6d')]['name']];_0x57e64b[_0xd019('0x4a')]=_0xd019('0x9d');if(_[_0xd019('0x101')](_0x57e64b)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x57e64b);return{'isValid':![],'message':_0xd019('0x11f')};}if(!this[_0xd019('0x9a')](_0x57e64b['Trunk'])){ut[_0xd019('0x63')](_0xd019('0x120'),_0xd019('0x121')+_0x57e64b[_0xd019('0x27')]+_0xd019('0x122'));if(!this[_0xd019('0x9a')](_0x57e64b[_0xd019('0x9b')])){ut[_0xd019('0x63')](_0xd019('0x120'),_0x57e64b[_0xd019('0x27')]+_0xd019('0x123'));return{'isValid':![],'message':_0xd019('0x124')};}}if(!ut[_0xd019('0x98')](_0x57e64b[_0xd019('0x99')])){ut[_0xd019('0x63')](_0xd019('0x125'),_0x57e64b[_0xd019('0x27')]+_0xd019('0x126'));return{'isValid':![],'message':_0xd019('0x121')+_0x57e64b['name']+_0xd019('0x126')};}return{'isValid':!![],'message':_0xd019('0x127')};};Preview[_0xd019('0xc')][_0xd019('0x128')]=function(_0x3e173f,_0x1c7da4,_0x262397,_0x43210b){var _0x357608=this;return new BPromise(function(_0x59986a,_0x1e85b4){var _0x430e32=_0x3e173f[_0xd019('0xb2')];var _0x3ebc4e=_0x357608[_0xd019('0x9a')](_0x1c7da4['Trunk'])?util[_0xd019('0x57')](_0xd019('0x129'),_0x1c7da4[_0xd019('0x51')]['name'],_[_0xd019('0x101')](_0x1c7da4[_0xd019('0x38')])?'':_0x1c7da4[_0xd019('0x38')][_0xd019('0x12a')]()||'',_0x1c7da4['dialCutDigit']>0x0?_0x262397['Contact']['phone']['substring'](_0x1c7da4[_0xd019('0x12b')]):_0x262397['Contact'][_0xd019('0x12c')]):util[_0xd019('0x57')](_0xd019('0x129'),_[_0xd019('0x101')](_0x1c7da4[_0xd019('0x9b')])?_0x1c7da4['Trunk'][_0xd019('0x27')]:_0x1c7da4[_0xd019('0x9b')][_0xd019('0x27')],_[_0xd019('0x101')](_0x1c7da4[_0xd019('0x38')])?'':_0x1c7da4['dialPrefix']['trim']()||'',_0x1c7da4[_0xd019('0x12b')]>0x0?_0x262397[_0xd019('0x102')][_0xd019('0x12c')][_0xd019('0x12d')](_0x1c7da4[_0xd019('0x12b')]):_0x262397[_0xd019('0x102')][_0xd019('0x12c')]);var _0xf332f2=_0x357608[_0xd019('0x9a')](_0x1c7da4['Trunk'])?ut[_0xd019('0x12e')](_0x1c7da4[_0xd019('0x51')][_0xd019('0x53')],_0x1c7da4[_0xd019('0x35')],_0x1c7da4[_0xd019('0x12f')]>0x0?ut['getCallerIdRandom'](_0x1c7da4[_0xd019('0x36')],_0x1c7da4[_0xd019('0x12f')]):_0x1c7da4[_0xd019('0x36')]):ut[_0xd019('0x12e')](_['isNil'](_0x1c7da4[_0xd019('0x9b')])?_0x1c7da4[_0xd019('0x51')]['callerid']:_0x1c7da4[_0xd019('0x9b')][_0xd019('0x53')],_0x1c7da4[_0xd019('0x35')],_0x1c7da4['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd019('0x130')](_0x1c7da4['dialOriginateCallerIdNumber'],_0x1c7da4[_0xd019('0x12f')]):_0x1c7da4['dialOriginateCallerIdNumber']);if(_0xf332f2){_0x3e173f['originatecalleridname']=ut['extractCalleridName'](_0xf332f2);_0x3e173f['originatecalleridnum']=ut['extractCalleridNumber'](_0xf332f2);}var _0x232b3c=ut[_0xd019('0x131')](_0x1c7da4,_0x262397,_0x3ebc4e,_0xf332f2,_0x430e32,_0x3e173f);_['merge'](_0x3e173f,ut[_0xd019('0x132')](_0x232b3c));_0x3e173f[_0xd019('0x8a')]=moment()[_0xd019('0x57')](_0xd019('0x8b'));ami[_0xd019('0x75')](ut[_0xd019('0x133')](_0x3e173f,_0x1c7da4,_0x232b3c,_0x3e173f[_0xd019('0xab')],_0x43210b))[_0xd019('0x83')](function(_0x4f9c10){_0x1c7da4['originated']+=0x1;logger[_0xd019('0x59')](_0xd019('0x134'),_0x430e32,_0xd019('0xb3'),_0x1c7da4[_0xd019('0x27')],_0xd019('0x6f'),_0x1c7da4[_0xd019('0x4b')]);_0x59986a(_0x4f9c10);})['catch'](function(_0x3e5d4c){ut[_0xd019('0xf6')](_0x3e173f,0xe,_0xd019('0x135'));rpcDb[_0xd019('0xf7')](_0x3e173f,_0xd019('0x136'));_0x1e85b4(_0x3e5d4c);});});};Preview[_0xd019('0xc')]['syncNewExten']=function(_0x2886bb){if(this[_0xd019('0x13')][_0x2886bb[_0xd019('0xac')]]){this['actions'][_0x2886bb[_0xd019('0xac')]]['channel']=_0x2886bb[_0xd019('0x77')];}};Preview[_0xd019('0xc')][_0xd019('0x16')]=function(_0x30cc05){var _0x167bc0=this;var _0x119562=this[_0xd019('0x13')][_0x30cc05['actionid']];if(_0x119562){if(_0x119562[_0xd019('0x104')]&&this[_0xd019('0x14')][_0x119562['lookAgent']]){ut[_0xd019('0x137')](_0x119562,this[_0xd019('0x14')][_0x119562['lookAgent']][_0xd019('0x27')],this[_0xd019('0x14')][_0x119562[_0xd019('0x104')]]['id']);}var _0x5d6bb2=_[_0xd019('0x138')](_0x119562);_0x5d6bb2[_0xd019('0xae')]=moment()[_0xd019('0x57')](_0xd019('0x8b'));var _0x2a95a2=_0x167bc0[_0xd019('0x66')][_0x119562[_0xd019('0x6e')]];if(ut[_0xd019('0x139')](_0x30cc05[_0xd019('0x13a')])){if(_0x119562[_0xd019('0xca')]){rpcDb['unlockContact'](_0x119562[_0xd019('0x13b')]);}if(_0x119562[_0xd019('0xab')]){rpcDb[_0xd019('0x89')](_0x119562[_0xd019('0x13b')]);}ami[_0xd019('0x24')](_0xd019('0x13c'),ut['buildObj'](_0x119562,'rejected'));this[_0xd019('0x13d')](_0x5d6bb2,_0x2a95a2,_0x30cc05);}else{_0x119562[_0xd019('0x8a')]=moment()[_0xd019('0x57')](_0xd019('0x8b'));ut[_0xd019('0xf6')](_0x5d6bb2,0x4,_0xd019('0xbc'));rpcDb[_0xd019('0xf7')](_0x5d6bb2,_0xd019('0x13e'));}}};Preview['prototype'][_0xd019('0x18')]=function(_0x34ffff){var _0x1eede5=this;var _0xd252c7=this[_0xd019('0x13')][_0x34ffff['linkedid']];var _0x553e08;if(_0xd252c7){_0x553e08=this['campaignsPreview'][_0xd252c7[_0xd019('0x6e')]];logger[_0xd019('0x59')](_0xd019('0x13f'),_0x34ffff['linkedid'],_0xd019('0xb3'),_0x553e08[_0xd019('0x27')],_0xd019('0x70'),_0x553e08['pTalking']);}if(this['actions'][_0x34ffff[_0xd019('0xac')]]&&_0x34ffff[_0xd019('0xac')]!==_0x34ffff[_0xd019('0xb2')]){if(_0x34ffff[_0xd019('0x140')]==='16'&&this[_0xd019('0x13')][_0x34ffff[_0xd019('0xac')]][_0xd019('0x71')]){this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff['cause']);}else if(this[_0xd019('0x13')][_0x34ffff[_0xd019('0xac')]][_0xd019('0x71')]){logger['info'](_0xd019('0x141'),_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')],'\x20Queue',_0x553e08[_0xd019('0x27')],_0xd019('0x70'),_0x553e08[_0xd019('0xb0')]);this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')]);}}else if(_0xd252c7&&_[_0xd019('0x101')](_0xd252c7['statedesc'])&&_0x553e08[_0xd019('0x142')]&&_0x34ffff[_0xd019('0xac')]===_0x34ffff['uniqueid']&&_[_0xd019('0x101')](_0x34ffff[_0xd019('0xf5')])&&_0x34ffff[_0xd019('0x140')]==='16'&&_0x34ffff[_0xd019('0x143')]==='6'&&_[_0xd019('0xf3')](_0xd252c7[_0xd019('0x144')])){if(_0xd252c7['unlockAgent']){rpcDb[_0xd019('0x113')](_0xd252c7[_0xd019('0x13b')]);}if(_0xd252c7['activeContact']){rpcDb[_0xd019('0x89')](_0xd252c7[_0xd019('0x13b')]);}_0x34ffff['reason']='22';this['callProgressDetectingAgent'](_0xd252c7,_0x553e08,_0x34ffff);}else if(_0xd252c7&&_0xd252c7[_0xd019('0x144')]){if(_0x34ffff['cause']==='16'&&this['actions'][_0x34ffff['linkedid']][_0xd019('0x71')]){logger['info'](_0xd019('0x145'),_0x34ffff['linkedid'],_0x34ffff[_0xd019('0x140')],_0xd019('0xb3'),_0x553e08['name'],_0xd019('0x70'),_0x553e08[_0xd019('0xb0')]);this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')]);}else if(this[_0xd019('0x13')][_0x34ffff['linkedid']]['dialAnswer']){logger[_0xd019('0x59')](_0xd019('0x141'),_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')],_0xd019('0xb3'),_0x553e08[_0xd019('0x27')],_0xd019('0x70'),_0x553e08[_0xd019('0xb0')]);this[_0xd019('0x9e')](_0x34ffff,_0x34ffff[_0xd019('0xac')],_0x34ffff[_0xd019('0x140')]);}}};Preview[_0xd019('0xc')][_0xd019('0x1d')]=function(_0x63e4d0){if(this[_0xd019('0x13')][_0x63e4d0[_0xd019('0xf2')]]&&_0x63e4d0['destlinkedid']!==_0x63e4d0[_0xd019('0x146')]){this['callProgressDetectingCustomer'](_0x63e4d0,_0x63e4d0[_0xd019('0xf2')],_0x63e4d0[_0xd019('0xee')]);}};Preview['prototype'][_0xd019('0x1b')]=function(_0x40662d){if(this['actions'][_0x40662d[_0xd019('0xac')]]&&_0x40662d[_0xd019('0xac')]!==_0x40662d[_0xd019('0xb2')]&&!this[_0xd019('0x13')][_0x40662d[_0xd019('0xac')]]['dialAnswer']){if(_0x40662d[_0xd019('0x140')]==='1'){this[_0xd019('0x9e')](_0x40662d,_0x40662d[_0xd019('0xac')],_0x40662d['cause']);}}};Preview[_0xd019('0xc')][_0xd019('0x147')]=function(_0x21c2e4,_0x1e5628,_0x147c92){if(this['actions'][_0x21c2e4]){if(_[_0xd019('0x101')](this[_0xd019('0x13')][_0x21c2e4][_0xd019('0x148')])){this['actions'][_0x21c2e4][_0xd019('0x148')]={};}this[_0xd019('0x13')][_0x21c2e4][_0xd019('0x148')][_0x1e5628]=_0x147c92;}};Preview['prototype'][_0xd019('0x21')]=function(_0x3ff09b){try{if(!_[_0xd019('0x101')](_0x3ff09b)){if(ut[_0xd019('0x149')](_[_0xd019('0x14a')](_0x3ff09b[_0xd019('0x14b')])[0x0])){this[_0xd019('0x147')](_0x3ff09b['uniqueid'],_[_0xd019('0x14a')](_0x3ff09b[_0xd019('0x14b')])[0x0],_0x3ff09b[_0xd019('0x14c')]);}}}catch(_0x5f58fb){logger[_0xd019('0x14d')](_0xd019('0x14e'),util[_0xd019('0x14f')](_0x5f58fb,{'showHidden':![],'depth':null}));}};Preview[_0xd019('0xc')][_0xd019('0x150')]=function(_0xde2ae6){if(_0xde2ae6){if(this[_0xd019('0x13')][_0xde2ae6[_0xd019('0x151')]]){this['actions'][_0xde2ae6[_0xd019('0x151')]][_0xd019('0x144')]=!![];}}};Preview[_0xd019('0xc')][_0xd019('0x152')]=function(_0x72a444){if(_0x72a444){if(this[_0xd019('0x13')][_0x72a444['transfererlinkedid']]){this['actions'][_0x72a444['transfererlinkedid']][_0xd019('0x144')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 30af602..2996464 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 _0x4b19=['queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x3535b8,_0x13a753){var _0xf2e2f3=function(_0x5c9928){while(--_0x5c9928){_0x3535b8['push'](_0x3535b8['shift']());}};_0xf2e2f3(++_0x13a753);}(_0x4b19,0x195));var _0x94b1=function(_0x2508ce,_0x1c2d31){_0x2508ce=_0x2508ce-0x0;var _0x470995=_0x4b19[_0x2508ce];return _0x470995;};'use strict';var util=require(_0x94b1('0x0'));var BPromise=require('bluebird');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var _=require(_0x94b1('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x94b1('0x4'));var cmHopperHistory=require(_0x94b1('0x5'));var cmHopperBlack=require(_0x94b1('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x94b1('0x7'));var voiceQueueReport=require(_0x94b1('0x8'));function loggerCatch(_0x52d6c1){return function(_0x24df76){logger[_0x94b1('0x9')](_0x52d6c1,util['inspect'](_0x24df76,{'showHidden':![],'depth':null}));};}function create(_0x40c69c){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopperHistory['createHistory'](_0x40c69c))[_0x94b1('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x4aafcc){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](agentReportPreview[_0x94b1('0xd')](_0x4aafcc))[_0x94b1('0xc')](loggerCatch(_0x94b1('0xe')));}function moveContact(_0x3aeb91){return BPromise['resolve']()[_0x94b1('0xb')](cmHopper[_0x94b1('0xf')](_0x3aeb91,!![]))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x10')));}exports['checkIsBlackList']=function(_0x4a4fe6){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopperBlack['checkIsBlackList'](_0x4a4fe6))['catch'](loggerCatch(_0x94b1('0x11')));};exports[_0x94b1('0x12')]=function(_0x48a13c){return BPromise[_0x94b1('0xa')]()['then'](cmHopper['getContactPreview'](_0x48a13c))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x13')));};exports[_0x94b1('0xd')]=function(_0x1977f4,_0x494138){create(_0x1977f4)[_0x94b1('0xc')](loggerCatch(_0x494138));moveContact(_0x1977f4)[_0x94b1('0xc')](loggerCatch(_0x494138));};exports[_0x94b1('0x14')]=function(_0x224099,_0x3a6ae0){createAgent(_0x224099)[_0x94b1('0xc')](loggerCatch(_0x3a6ae0));};exports[_0x94b1('0x15')]=function(_0x59d7cf,_0x30f969){create(_0x59d7cf)[_0x94b1('0xc')](loggerCatch(_0x30f969));};exports[_0x94b1('0x16')]=function(_0x5deb20,_0x4490c9){moveContact(_0x5deb20)[_0x94b1('0xc')](loggerCatch(_0x4490c9));};exports['rescheduleContact']=function(_0x602c3b,_0x310b9f,_0x29af54){if(_0x310b9f){_0x602c3b[_0x94b1('0x17')]=null;}if(_0x29af54){_0x602c3b[_0x94b1('0x18')]=![];}return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper[_0x94b1('0x19')](_0x602c3b))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x1a')));};exports['countReScheduled']=function(_0xa333a8){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper['countReScheduled'](_0xa333a8))[_0x94b1('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x94b1('0x1b')]=function(_0x3d10ea){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper['unlockContact']({'UserId':null},_0x3d10ea,0x1))['catch'](loggerCatch(_0x94b1('0x1c')));};exports['disableContact']=function(_0x1aa525){return BPromise['resolve']()[_0x94b1('0xb')](cmHopper[_0x94b1('0x1b')]({'active':![]},_0x1aa525,0x1))[_0x94b1('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x94b1('0x1d')]=function(_0x1d86bd){var _0x467c42={};_0x467c42[_0x94b1('0x1e')]=_0x1d86bd[_0x94b1('0x1e')];_0x467c42[_0x94b1('0x1f')]=_0x1d86bd[_0x94b1('0x1f')];_0x467c42[_0x94b1('0x20')]=_0x1d86bd[_0x94b1('0x20')];_0x467c42['calleridname']=_0x1d86bd[_0x94b1('0x21')];_0x467c42[_0x94b1('0x22')]=_0x1d86bd['queue'];_0x467c42[_0x94b1('0x23')]=_0x1d86bd[_0x94b1('0x24')];_0x467c42[_0x94b1('0x25')]=_0x1d86bd[_0x94b1('0x24')];_0x467c42[_0x94b1('0x26')]=0x1;_0x467c42[_0x94b1('0x27')]=_0x1d86bd['endtime'];_0x467c42[_0x94b1('0x28')]=_0x1d86bd['membername'];_0x467c42[_0x94b1('0x29')]='from-sip';_0x467c42['exten']=_0x94b1('0x2a');_0x467c42[_0x94b1('0x2b')]=0x0;_0x467c42[_0x94b1('0x2c')]=0x1;_0x467c42[_0x94b1('0x2d')]=_0x1d86bd[_0x94b1('0x2e')];_0x467c42[_0x94b1('0x2f')]=_0x94b1('0x30');return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](voiceQueueReport[_0x94b1('0x31')](_0x467c42))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x32')));};exports['getContactRecallMe']=function(_0x58e4d0,_0x2da4ac){return BPromise[_0x94b1('0xa')]()[_0x94b1('0xb')](cmHopper[_0x94b1('0x33')](_0x58e4d0,_0x2da4ac))[_0x94b1('0xc')](loggerCatch(_0x94b1('0x34')));};exports[_0x94b1('0x35')]=function(_0x36a2f8){return BPromise[_0x94b1('0xa')]()['then'](cmHopper[_0x94b1('0x19')](_0x36a2f8,!![],!![]))['catch'](loggerCatch(_0x94b1('0x36')));}; \ No newline at end of file +var _0x7dfd=['then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect'];(function(_0x3147a6,_0x781a2a){var _0x517efd=function(_0x58cd1b){while(--_0x58cd1b){_0x3147a6['push'](_0x3147a6['shift']());}};_0x517efd(++_0x781a2a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd7df('0x0'));var BPromise=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var _=require(_0xd7df('0x4'));var cmHopper=require(_0xd7df('0x5'));var cmHopperFinal=require(_0xd7df('0x6'));var cmHopperHistory=require(_0xd7df('0x7'));var cmHopperBlack=require(_0xd7df('0x8'));var voiceQueueRt=require(_0xd7df('0x9'));var agentReportPreview=require(_0xd7df('0xa'));var voiceQueueReport=require(_0xd7df('0xb'));function loggerCatch(_0x36cf0f){return function(_0x39ce98){logger[_0xd7df('0xc')](_0x36cf0f,util[_0xd7df('0xd')](_0x39ce98,{'showHidden':![],'depth':null}));};}function create(_0x2c48a4){return BPromise['resolve']()[_0xd7df('0xe')](cmHopperHistory[_0xd7df('0xf')](_0x2c48a4))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x11')));}function createAgent(_0x5e59c3){return BPromise[_0xd7df('0x12')]()['then'](agentReportPreview[_0xd7df('0xf')](_0x5e59c3))['catch'](loggerCatch(_0xd7df('0x11')));}function moveContact(_0x82f1c0){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper[_0xd7df('0x13')](_0x82f1c0,!![]))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x14')));}exports[_0xd7df('0x15')]=function(_0x7ba3c){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopperBlack[_0xd7df('0x15')](_0x7ba3c))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x16')));};exports[_0xd7df('0x17')]=function(_0x202833){return BPromise[_0xd7df('0x12')]()['then'](cmHopper[_0xd7df('0x17')](_0x202833))[_0xd7df('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd7df('0xf')]=function(_0xbe1c5e,_0x5d3beb){create(_0xbe1c5e)[_0xd7df('0x10')](loggerCatch(_0x5d3beb));moveContact(_0xbe1c5e)[_0xd7df('0x10')](loggerCatch(_0x5d3beb));};exports[_0xd7df('0x18')]=function(_0x5210e5,_0x40167d){createAgent(_0x5210e5)[_0xd7df('0x10')](loggerCatch(_0x40167d));};exports[_0xd7df('0x19')]=function(_0x5ba653,_0x96d86e){create(_0x5ba653)[_0xd7df('0x10')](loggerCatch(_0x96d86e));};exports[_0xd7df('0x1a')]=function(_0x5acb0a,_0x4188af){moveContact(_0x5acb0a)['catch'](loggerCatch(_0x4188af));};exports[_0xd7df('0x1b')]=function(_0x5ab737,_0x3ae7c3,_0x342b54){if(_0x3ae7c3){_0x5ab737[_0xd7df('0x1c')]=null;}if(_0x342b54){_0x5ab737['active']=![];}return BPromise[_0xd7df('0x12')]()['then'](cmHopper[_0xd7df('0x1b')](_0x5ab737))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x1d')));};exports[_0xd7df('0x1e')]=function(_0x1c774b){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper['countReScheduled'](_0x1c774b))['catch'](loggerCatch(_0xd7df('0x1f')));};exports[_0xd7df('0x20')]=function(_0x26047f){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper[_0xd7df('0x20')]({'UserId':null},_0x26047f,0x1))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x21')));};exports[_0xd7df('0x22')]=function(_0x5c4d17){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper[_0xd7df('0x20')]({'active':![]},_0x5c4d17,0x1))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x23')));};exports[_0xd7df('0x24')]=function(_0x3f78fa){var _0x36de76={};_0x36de76['type']=_0x3f78fa['type'];_0x36de76['uniqueid']=_0x3f78fa['uniqueid'];_0x36de76['calleridnum']=_0x3f78fa[_0xd7df('0x25')];_0x36de76['calleridname']=_0x3f78fa[_0xd7df('0x26')];_0x36de76[_0xd7df('0x27')]=_0x3f78fa['queue'];_0x36de76[_0xd7df('0x28')]=_0x3f78fa[_0xd7df('0x29')];_0x36de76['queuecallerleaveAt']=_0x3f78fa[_0xd7df('0x29')];_0x36de76[_0xd7df('0x2a')]=0x1;_0x36de76[_0xd7df('0x2b')]=_0x3f78fa[_0xd7df('0x2c')];_0x36de76[_0xd7df('0x2d')]=_0x3f78fa[_0xd7df('0x2e')];_0x36de76['context']=_0xd7df('0x2f');_0x36de76[_0xd7df('0x30')]=_0xd7df('0x31');_0x36de76[_0xd7df('0x32')]=0x0;_0x36de76[_0xd7df('0x33')]=0x1;_0x36de76[_0xd7df('0x34')]=_0x3f78fa[_0xd7df('0x2e')];_0x36de76[_0xd7df('0x35')]=_0xd7df('0x36');return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](voiceQueueReport['create'](_0x36de76))['catch'](loggerCatch(_0xd7df('0x37')));};exports['getContactRecallMe']=function(_0x2a3bcf,_0xab3dd8){return BPromise[_0xd7df('0x12')]()[_0xd7df('0xe')](cmHopper['getContactRecallMe'](_0x2a3bcf,_0xab3dd8))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd7df('0x38')]=function(_0x15e682){return BPromise['resolve']()[_0xd7df('0xe')](cmHopper[_0xd7df('0x1b')](_0x15e682,!![],!![]))[_0xd7df('0x10')](loggerCatch(_0xd7df('0x39')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 348bce1..7e6873b 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 _0xffb1=['rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','loggerError','logger2','info','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','answertime','isFailure','Failure','RECALL','calleridname','BOOKED','uniqueid','channelAgent','timeout','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','buildAcw','not_inuse','getDiff','createBody','CampaignId','filterKey','type','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged'];(function(_0x59522a,_0x14d1e5){var _0x30f09d=function(_0x5cab74){while(--_0x5cab74){_0x59522a['push'](_0x59522a['shift']());}};_0x30f09d(++_0x14d1e5);}(_0xffb1,0x93));var _0x1ffb=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xffb1[_0x1cfe2e];return _0x39233f;};'use strict';var util=require(_0x1ffb('0x0'));var _=require(_0x1ffb('0x1'));var moment=require(_0x1ffb('0x2'));var logger=require(_0x1ffb('0x3'))(_0x1ffb('0x4'));var ipAgi=process[_0x1ffb('0x5')][_0x1ffb('0x6')]||_0x1ffb('0x7');function getSeconds(_0x41a84c,_0xc36826){var _0x53c232=moment(_0x41a84c)[_0x1ffb('0x8')](0x0);var _0x677ad0=moment(_0xc36826)[_0x1ffb('0x8')](0x0);return _0x53c232[_0x1ffb('0x9')](_0x677ad0,_0x1ffb('0xa'));}exports['loggerCatch']=function(_0x1787b1){return function(_0x4bcfb6){logger['error'](_0x1787b1,util[_0x1ffb('0xb')](_0x4bcfb6,{'showHidden':![],'depth':null}));};};exports[_0x1ffb('0xc')]=function(_0x88a91b,_0x5d1736){logger['info'](_0x88a91b,util[_0x1ffb('0xb')](_0x5d1736,{'showHidden':![],'depth':null}));};exports[_0x1ffb('0xd')]=function(_0x4feca5,_0x2594fe){logger['error'](_0x4feca5,util[_0x1ffb('0xb')](_0x2594fe,{'showHidden':![],'depth':null}));};exports[_0x1ffb('0xe')]=function(_0x327ef0){return function(_0x351de7){logger[_0x1ffb('0xf')](_0x327ef0,util[_0x1ffb('0xb')](_0x351de7,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x192a16,_0x308bbf,_0x379a1e){return{'message':_0x192a16,'unlock':_0x308bbf,'active':_0x379a1e};};exports['getCallerId']=function(_0x208c0b,_0x5d1fba,_0x4c9431){if(!_['isUndefined'](_0x4c9431)&&_0x1ffb('0x10')===typeof _0x4c9431&&!_[_0x1ffb('0x11')](_0x4c9431)){if(!_['isUndefined'](_0x5d1fba)&&_0x1ffb('0x10')===typeof _0x5d1fba&&!_[_0x1ffb('0x11')](_0x5d1fba)){return util[_0x1ffb('0x12')](_0x1ffb('0x13'),_0x5d1fba,_0x4c9431);}return util['format'](_0x1ffb('0x13'),_0x4c9431,_0x4c9431);}if(!_['isUndefined'](_0x208c0b)&&_0x1ffb('0x10')===typeof _0x208c0b&&!_[_0x1ffb('0x11')](_0x208c0b)){return _0x208c0b;}return _0x1ffb('0x14');};exports[_0x1ffb('0x15')]=function(_0x650c2f){if(_['isNil'](_0x650c2f)){return![];}return _0x650c2f;};exports[_0x1ffb('0x16')]=function(_0x59539e,_0x30e2fd,_0x1d5d3f,_0x34dede,_0x5f4c16,_0x1ad8a9){var _0x4dd0ba={'XMD-QUEUE':_0x30e2fd[_0x1ffb('0x17')]?_0x30e2fd['Queue'][_0x1ffb('0x18')]:'','XMD-CALLERID':_0x34dede,'XMD-CALLERID-PREVIEW':_0x1ad8a9?util['format'](_0x1ffb('0x13'),_0x1ad8a9['calleridname'],_0x1ad8a9[_0x1ffb('0x19')]):_0x34dede,'XMD-DIALID':_0x5f4c16,'XMD-CONTACTID':_0x30e2fd[_0x1ffb('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x34dede,'XMD-VOICEQUEUEID':_0x30e2fd['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1d5d3f,'XMD-DIALTIMEOUT':_0x59539e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x1ffb('0x12')]('\x22rtTxX%s%s\x22',_0x59539e['dialQueueProject2']?'g':'',_[_0x1ffb('0x11')](_0x59539e[_0x1ffb('0x1b')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x59539e[_0x1ffb('0x1c')]||'','XMD-AGI':_0x59539e[_0x1ffb('0x1d')]?util[_0x1ffb('0x12')](_0x1ffb('0x1e'),ipAgi,_0x59539e[_0x1ffb('0x1d')]):_0x1ffb('0x1f'),'XMD-AGIAFTER':_0x59539e[_0x1ffb('0x20')]?util['format'](_0x1ffb('0x1e'),ipAgi,_0x59539e[_0x1ffb('0x20')]):_0x1ffb('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x1ad8a9?_0x1ad8a9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1ad8a9?_0x1ad8a9[_0x1ffb('0x21')]:'','XMD-DESTINATION':_0x1ffb('0x22')};if(!_[_0x1ffb('0x11')](_0x59539e['monitor_format'])){_0x4dd0ba[util[_0x1ffb('0x12')]('%s',_0x1ffb('0x23'))]=_0x59539e[_0x1ffb('0x1b')];_0x4dd0ba[util[_0x1ffb('0x12')]('%s',_0x1ffb('0x24'))]=_0x5f4c16;}if(_0x30e2fd&&_0x30e2fd[_0x1ffb('0x25')]){for(var _0x3f2d64 in _0x30e2fd[_0x1ffb('0x25')]){if(_0x30e2fd['Contact'][_0x1ffb('0x26')](_0x3f2d64)){if(!_[_0x1ffb('0x27')](_0x30e2fd['Contact'][_0x3f2d64])&&_0x3f2d64!=='id'&&_0x3f2d64!==_0x1ffb('0x28')&&_0x3f2d64!=='createdAt'&&_0x3f2d64!=='updatedAt'){_0x4dd0ba[util[_0x1ffb('0x12')](_0x1ffb('0x29'),_0x1ffb('0x2a'),_['toUpper'](_0x3f2d64))]=_0x30e2fd[_0x1ffb('0x25')][_0x3f2d64];}}}}return _0x4dd0ba;};exports[_0x1ffb('0x2b')]=function(_0xd6d6f3){var _0x3d6eda={};for(var _0x43e4b7 in _0xd6d6f3){if(_0xd6d6f3[_0x1ffb('0x26')](_0x43e4b7)){_0x3d6eda[util[_0x1ffb('0x12')]('%s',_[_0x1ffb('0x2c')](_0x43e4b7))]=_0xd6d6f3[_0x43e4b7];}}return{'variables':_0x3d6eda};};exports[_0x1ffb('0x2d')]=function(_0x58e887,_0x456554){if(!_[_0x1ffb('0x27')](_0x58e887)){if(_0x58e887[_0x1ffb('0x26')](_0x1ffb('0x2e'))){if(_0x58e887[_0x1ffb('0x2e')]>0x0){_0x58e887[_0x1ffb('0x2e')]-=0x1;}else{logger[_0x1ffb('0x2f')](_0x1ffb('0x30'),_0x456554);}}}else{logger[_0x1ffb('0x2f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x456554);}};exports[_0x1ffb('0x31')]=function(_0x493fff){var _0x26f226=moment()['format'](_0x1ffb('0x32'));_0x493fff[_0x1ffb('0x33')]=0xd;_0x493fff[_0x1ffb('0x34')]=_0x1ffb('0x35');_0x493fff[_0x1ffb('0x36')]=_0x26f226;_0x493fff[_0x1ffb('0x37')]=_0x26f226;_0x493fff['endtime']=_0x26f226;};exports[_0x1ffb('0x38')]=function(_0x2b05fc,_0x1bb59e,_0x4f4335){var _0x4f9a94=moment()['format'](_0x1ffb('0x32'));_0x2b05fc[_0x1ffb('0x33')]=_0x1bb59e;_0x2b05fc[_0x1ffb('0x34')]=_0x4f4335;_0x2b05fc[_0x1ffb('0x37')]=_0x4f9a94;_0x2b05fc[_0x1ffb('0x39')]=getSeconds(_0x2b05fc['responsetime'],_0x2b05fc[_0x1ffb('0x36')]);};exports[_0x1ffb('0x3a')]=function(_0x27d9d3,_0x1a55d6,_0x19d715){_0x27d9d3[_0x1ffb('0x3b')]=_0x1a55d6;_0x27d9d3[_0x1ffb('0x3c')]=_0x19d715;};exports[_0x1ffb('0x3d')]=function(_0x35fc15,_0xfd72d0,_0x487ac9){var _0x1ee2f6=moment()[_0x1ffb('0x12')](_0x1ffb('0x32'));_0x35fc15[_0x1ffb('0x33')]=_0xfd72d0;_0x35fc15['statedesc']=_0x487ac9;_0x35fc15[_0x1ffb('0x37')]=_0x35fc15['responsetime']?_0x35fc15['responsetime']:_0x1ee2f6;_0x35fc15['endtime']=_0x35fc15[_0x1ffb('0x3e')]?_0x35fc15[_0x1ffb('0x3e')]:_0x1ee2f6;_0x35fc15[_0x1ffb('0x39')]=getSeconds(_0x35fc15[_0x1ffb('0x37')]||0x0,_0x35fc15[_0x1ffb('0x36')]||0x0);_0x35fc15['talktime']=_0x35fc15['answertime']?getSeconds(_0x35fc15[_0x1ffb('0x3e')],_0x35fc15[_0x1ffb('0x3f')]):0x0;};exports[_0x1ffb('0x40')]=function(_0x19f82a){return _0x19f82a===_0x1ffb('0x41');};exports['variablesAction']=function(_0x3a3d3c,_0x2afb62,_0x530bf4,_0x271e42,_0x5db0d1){var _0x2474b4=_0x271e42?_0x1ffb('0x42'):_0x3a3d3c[_0x1ffb('0x43')];_0x2474b4=_0x5db0d1?_0x1ffb('0x44'):_0x2474b4;return{'actionid':_0x3a3d3c[_0x1ffb('0x45')],'action':'originate','channel':_0x3a3d3c[_0x1ffb('0x46')],'callerid':util[_0x1ffb('0x12')](_0x1ffb('0x13'),_0x2474b4,_0x3a3d3c[_0x1ffb('0x19')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x530bf4,'timeout':(_0x2afb62[_0x1ffb('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3a3d3c[_0x1ffb('0x45')]};};exports['totalGlobal']=function(_0x50c00a){return _0x50c00a[_0x1ffb('0x48')]+_0x50c00a['countcongestionretry']+_0x50c00a[_0x1ffb('0x49')]+_0x50c00a[_0x1ffb('0x4a')]+_0x50c00a[_0x1ffb('0x4b')];};exports[_0x1ffb('0x4c')]=function(_0x953c27){var _0x3ecaa2=_[_0x1ffb('0x4d')](_0x953c27);_0x3ecaa2['state']=0xf;_0x3ecaa2[_0x1ffb('0x34')]=_0x1ffb('0x4e');return _0x3ecaa2;};exports[_0x1ffb('0x4f')]=function(_0xdd59b1,_0x4860f1,_0x1d965b){var _0x17ca4a={};_0x17ca4a[_0x4860f1]=_0xdd59b1[_0x4860f1];_0x17ca4a[_0x1ffb('0x50')]=![];_0x17ca4a[_0x1ffb('0x51')]=moment()[_0x1ffb('0x52')](_0x1d965b,_0x1ffb('0x53'))[_0x1ffb('0x12')](_0x1ffb('0x32'));_0x17ca4a[_0x1ffb('0x1a')]=_0xdd59b1[_0x1ffb('0x1a')];_0x17ca4a[_0x1ffb('0x54')]=_0xdd59b1[_0x1ffb('0x54')];_0x17ca4a[_0x1ffb('0x55')]=_0xdd59b1[_0x1ffb('0x55')]||undefined;return _0x17ca4a;};exports[_0x1ffb('0x56')]=function(_0x5e23c,_0x1297fc){if(!_[_0x1ffb('0x27')](_0x5e23c)){if(_0x5e23c['pTalking']>0x0){_0x5e23c[_0x1ffb('0x57')]-=0x1;}else{logger['error'](_0x1297fc,_0x1ffb('0x58'));}}else{logger['error'](_0x1297fc,_0x1ffb('0x59'));}};exports[_0x1ffb('0x5a')]=function(_0x51428c){if(_0x51428c<=0x0){return!![];}return![];};exports['buildObj']=function(_0x4918c8,_0x5099ab){_0x4918c8[_0x1ffb('0x5b')]=_0x5099ab;_0x4918c8[_0x1ffb('0x18')]=_0x4918c8[_0x1ffb('0x5c')];_0x4918c8[_0x1ffb('0x5d')]=_0x4918c8[_0x1ffb('0x46')];return _0x4918c8;};exports[_0x1ffb('0x5e')]=function(_0x26f8c9){var _0xe4f2aa={};_0xe4f2aa[_0x1ffb('0x5c')]=_0x26f8c9[_0x1ffb('0x5c')];_0xe4f2aa['interface']=_0x26f8c9[_0x1ffb('0x46')];_0xe4f2aa[_0x1ffb('0x45')]=_0x26f8c9[_0x1ffb('0x45')];return _0xe4f2aa;};exports['agentReadyId']=function(_0x58db97){var _0x42b572=[];for(var _0x442a7b in _0x58db97){if(_0x58db97[_0x1ffb('0x26')](_0x442a7b)){if(!_['isNil'](_0x58db97[_0x442a7b])&&_0x58db97[_0x442a7b][_0x1ffb('0x33')]===_0x1ffb('0x5f')&&_0x58db97[_0x442a7b]['status']==='reachable'){_0x42b572['push'](_0x58db97[_0x442a7b]['id']);}}}return _0x42b572;};exports[_0x1ffb('0x60')]=function(_0x4a070c){var _0x487a2e=moment()[_0x1ffb('0x8')](0x0);var _0x33e25f=moment(_0x4a070c)[_0x1ffb('0x8')](0x0);return _0x487a2e[_0x1ffb('0x9')](_0x33e25f,_0x1ffb('0xa'));};exports[_0x1ffb('0x61')]=function(_0x5bdff3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5bdff3['ContactId'],'ListId':_0x5bdff3['ListId'],'VoiceQueueId':_0x5bdff3[_0x1ffb('0x55')]||undefined,'CampaignId':_0x5bdff3[_0x1ffb('0x62')]||undefined};};exports[_0x1ffb('0x63')]=function(_0x4c2679){if(_0x4c2679===_0x1ffb('0x45')||_0x4c2679==='idContact'||_0x4c2679==='queue'||_0x4c2679===_0x1ffb('0x64')||_0x4c2679==='campaigntype'||_0x4c2679===_0x1ffb('0x65')||_0x4c2679===_0x1ffb('0x3b')||_0x4c2679===_0x1ffb('0x46')||_0x4c2679===_0x1ffb('0x43')||_0x4c2679===_0x1ffb('0x50')||_0x4c2679==='calleridnum'||_0x4c2679===_0x1ffb('0x51')||_0x4c2679===_0x1ffb('0x48')||_0x4c2679===_0x1ffb('0x66')||_0x4c2679==='countnoanswerretry'||_0x4c2679===_0x1ffb('0x67')||_0x4c2679===_0x1ffb('0x68')||_0x4c2679===_0x1ffb('0x69')||_0x4c2679===_0x1ffb('0x6a')||_0x4c2679==='recallme'||_0x4c2679===_0x1ffb('0x1a')||_0x4c2679===_0x1ffb('0x54')||_0x4c2679===_0x1ffb('0x3c')||_0x4c2679==='VoiceQueueId'||_0x4c2679==='sipcallid'||_0x4c2679===_0x1ffb('0x6b')||_0x4c2679===_0x1ffb('0x6c')||_0x4c2679===_0x1ffb('0x6d')||_0x4c2679===_0x1ffb('0x6e')||_0x4c2679===_0x1ffb('0x6f')||_0x4c2679===_0x1ffb('0x70')||_0x4c2679===_0x1ffb('0x71')||_0x4c2679==='xmd-dialid'||_0x4c2679===_0x1ffb('0x72')||_0x4c2679===_0x1ffb('0x73')||_0x4c2679===_0x1ffb('0x74')||_0x4c2679===_0x1ffb('0x75')||_0x4c2679===_0x1ffb('0x76')||_0x4c2679===_0x1ffb('0x77')||_0x4c2679===_0x1ffb('0x78')||_0x4c2679==='rtpaudioqosbridged'||_0x4c2679===_0x1ffb('0x79')||_0x4c2679===_0x1ffb('0x7a')||_0x4c2679===_0x1ffb('0x7b')||_0x4c2679===_0x1ffb('0x7c')||_0x4c2679===_0x1ffb('0x7d')||_0x4c2679===_0x1ffb('0x7e')||_0x4c2679===_0x1ffb('0x78')||_0x4c2679==='rtpaudioqosbridged'||_0x4c2679===_0x1ffb('0x79')||_0x4c2679===_0x1ffb('0x7a')||_0x4c2679===_0x1ffb('0x7b')||_0x4c2679===_0x1ffb('0x7c')||_0x4c2679===_0x1ffb('0x7d')||_0x4c2679==='rtpaudioqosrttbridged'||_0x4c2679==='bridgepeer'||_0x4c2679===_0x1ffb('0x7f')||_0x4c2679===_0x1ffb('0x33')||_0x4c2679==='statedesc'){return![];}return!![];};exports[_0x1ffb('0x80')]=function(_0x2a1cc3,_0x417b26){var _0x3ac821,_0x276600,_0x345813;if(_0x417b26<=0x0){_0x417b26=0x1;}_0x3ac821=new RegExp(_0x1ffb('0x81')+_0x417b26+'}$');_0x276600=Math['pow'](0xa,_0x417b26-0x1);_0x345813=Math[_0x1ffb('0x82')](0xa,_0x417b26)-0x1;return util[_0x1ffb('0x12')]('%s',_[_0x1ffb('0x83')](_0x2a1cc3,_0x3ac821,_[_0x1ffb('0x84')](_0x276600,_0x345813)));};exports[_0x1ffb('0x85')]=function(_0x470e8e){var _0x470d36=_0x470e8e[_0x1ffb('0x86')](/"(.*?)"/);return _0x470d36?_0x470d36[0x1]:_0x470e8e;};exports[_0x1ffb('0x87')]=function(_0x377d4b){var _0x1db54d=_0x377d4b['match'](/<(.*?)>/);return _0x1db54d?_0x1db54d[0x1]:_0x377d4b;}; \ No newline at end of file +var _0x032e=['status','push','createBody','ListId','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','endtime','state','statedesc','ringtime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','\x22%s\x22\x20<%s>','calleridnum','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','buildAcw','queue','agentReadyId','not_inuse'];(function(_0x224800,_0xb3f614){var _0x455662=function(_0x5bbd8c){while(--_0x5bbd8c){_0x224800['push'](_0x224800['shift']());}};_0x455662(++_0xb3f614);}(_0x032e,0x1cc));var _0xe032=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x032e[_0xbca1b1];return _0x4e1686;};'use strict';var util=require('util');var _=require(_0xe032('0x0'));var moment=require(_0xe032('0x1'));var logger=require(_0xe032('0x2'))(_0xe032('0x3'));var ipAgi=process[_0xe032('0x4')]['XCALLY_IP_AGI']||_0xe032('0x5');function getSeconds(_0x3c0e0a,_0x3d33f8){var _0x15430e=moment(_0x3c0e0a)[_0xe032('0x6')](0x0);var _0x43dc81=moment(_0x3d33f8)[_0xe032('0x6')](0x0);return _0x15430e['diff'](_0x43dc81,_0xe032('0x7'));}exports[_0xe032('0x8')]=function(_0x265677){return function(_0xa36fe0){logger[_0xe032('0x9')](_0x265677,util[_0xe032('0xa')](_0xa36fe0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x359454,_0xfcdc67){logger[_0xe032('0xb')](_0x359454,util['inspect'](_0xfcdc67,{'showHidden':![],'depth':null}));};exports[_0xe032('0xc')]=function(_0x4d1170,_0x51031a){logger['error'](_0x4d1170,util[_0xe032('0xa')](_0x51031a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3c333b){return function(_0x48555b){logger[_0xe032('0xb')](_0x3c333b,util[_0xe032('0xa')](_0x48555b,{'showHidden':![],'depth':null}));};};exports[_0xe032('0xd')]=function(_0x3164ab,_0x34fd0b,_0x140e56){return{'message':_0x3164ab,'unlock':_0x34fd0b,'active':_0x140e56};};exports[_0xe032('0xe')]=function(_0x1cc0bb,_0x1bf9e3,_0xec005){if(!_[_0xe032('0xf')](_0xec005)&&_0xe032('0x10')===typeof _0xec005&&!_[_0xe032('0x11')](_0xec005)){if(!_[_0xe032('0xf')](_0x1bf9e3)&&_0xe032('0x10')===typeof _0x1bf9e3&&!_[_0xe032('0x11')](_0x1bf9e3)){return util['format']('\x22%s\x22\x20<%s>',_0x1bf9e3,_0xec005);}return util[_0xe032('0x12')]('\x22%s\x22\x20<%s>',_0xec005,_0xec005);}if(!_[_0xe032('0xf')](_0x1cc0bb)&&_0xe032('0x10')===typeof _0x1cc0bb&&!_[_0xe032('0x11')](_0x1cc0bb)){return _0x1cc0bb;}return _0xe032('0x13');};exports[_0xe032('0x14')]=function(_0x3ca2d0){if(_[_0xe032('0x15')](_0x3ca2d0)){return![];}return _0x3ca2d0;};exports[_0xe032('0x16')]=function(_0x1a6281,_0x4db18c,_0x31496e,_0x230656,_0x35093e,_0x3930a3){var _0x1a159d={'XMD-QUEUE':_0x4db18c[_0xe032('0x17')]?_0x4db18c[_0xe032('0x17')][_0xe032('0x18')]:'','XMD-CALLERID':_0x230656,'XMD-CALLERID-PREVIEW':_0x3930a3?util[_0xe032('0x12')]('\x22%s\x22\x20<%s>',_0x3930a3[_0xe032('0x19')],_0x3930a3['calleridnum']):_0x230656,'XMD-DIALID':_0x35093e,'XMD-CONTACTID':_0x4db18c[_0xe032('0x1a')],'XMD-CDRTYPE':_0xe032('0x1b'),'CALLERID(all)':_0x230656,'XMD-VOICEQUEUEID':_0x4db18c[_0xe032('0x1c')],'XMD-DIALCHANNEL':_0x31496e,'XMD-DIALTIMEOUT':_0x1a6281[_0xe032('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xe032('0x12')](_0xe032('0x1e'),_0x1a6281[_0xe032('0x1f')]?'g':'',_[_0xe032('0x11')](_0x1a6281['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1a6281[_0xe032('0x20')]||'','XMD-AGI':_0x1a6281[_0xe032('0x21')]?util[_0xe032('0x12')](_0xe032('0x22'),ipAgi,_0x1a6281[_0xe032('0x21')]):'NONE','XMD-AGIAFTER':_0x1a6281[_0xe032('0x1f')]?util[_0xe032('0x12')](_0xe032('0x22'),ipAgi,_0x1a6281['dialQueueProject2']):_0xe032('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x3930a3?_0x3930a3['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3930a3?_0x3930a3[_0xe032('0x24')]:'','XMD-DESTINATION':_0xe032('0x25')};if(!_[_0xe032('0x11')](_0x1a6281[_0xe032('0x26')])){_0x1a159d[util['format']('%s',_0xe032('0x27'))]=_0x1a6281['monitor_format'];_0x1a159d[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x35093e;}if(_0x4db18c&&_0x4db18c['Contact']){for(var _0x597b4c in _0x4db18c[_0xe032('0x28')]){if(_0x4db18c[_0xe032('0x28')][_0xe032('0x29')](_0x597b4c)){if(!_['isNil'](_0x4db18c['Contact'][_0x597b4c])&&_0x597b4c!=='id'&&_0x597b4c!==_0xe032('0x2a')&&_0x597b4c!==_0xe032('0x2b')&&_0x597b4c!==_0xe032('0x2c')){_0x1a159d[util[_0xe032('0x12')](_0xe032('0x2d'),_0xe032('0x2e'),_[_0xe032('0x2f')](_0x597b4c))]=_0x4db18c[_0xe032('0x28')][_0x597b4c];}}}}return _0x1a159d;};exports[_0xe032('0x30')]=function(_0x5d58de){var _0x4b3085={};for(var _0x162971 in _0x5d58de){if(_0x5d58de[_0xe032('0x29')](_0x162971)){_0x4b3085[util['format']('%s',_[_0xe032('0x31')](_0x162971))]=_0x5d58de[_0x162971];}}return{'variables':_0x4b3085};};exports[_0xe032('0x32')]=function(_0x11cfe7,_0x15691e){if(!_[_0xe032('0x15')](_0x11cfe7)){if(_0x11cfe7[_0xe032('0x29')](_0xe032('0x33'))){if(_0x11cfe7[_0xe032('0x33')]>0x0){_0x11cfe7[_0xe032('0x33')]-=0x1;}else{logger['error'](_0xe032('0x34'),_0x15691e);}}}else{logger[_0xe032('0x9')](_0xe032('0x35'),_0x15691e);}};exports[_0xe032('0x36')]=function(_0x5fc8b2){var _0x361bde=moment()[_0xe032('0x12')](_0xe032('0x37'));_0x5fc8b2['state']=0xd;_0x5fc8b2['statedesc']=_0xe032('0x38');_0x5fc8b2[_0xe032('0x39')]=_0x361bde;_0x5fc8b2[_0xe032('0x3a')]=_0x361bde;_0x5fc8b2[_0xe032('0x3b')]=_0x361bde;};exports['logAgent']=function(_0x32da10,_0x26fdac,_0x33807d){var _0x98d40c=moment()[_0xe032('0x12')](_0xe032('0x37'));_0x32da10[_0xe032('0x3c')]=_0x26fdac;_0x32da10[_0xe032('0x3d')]=_0x33807d;_0x32da10['responsetime']=_0x98d40c;_0x32da10[_0xe032('0x3e')]=getSeconds(_0x32da10['responsetime'],_0x32da10[_0xe032('0x39')]);};exports[_0xe032('0x3f')]=function(_0x13c3fd,_0x3fbca0,_0x2eb047){_0x13c3fd[_0xe032('0x40')]=_0x3fbca0;_0x13c3fd['UserId']=_0x2eb047;};exports[_0xe032('0x41')]=function(_0x51f196,_0x5cb79c,_0x315dc3){var _0x538d68=moment()[_0xe032('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x51f196['state']=_0x5cb79c;_0x51f196['statedesc']=_0x315dc3;_0x51f196[_0xe032('0x3a')]=_0x51f196[_0xe032('0x3a')]?_0x51f196[_0xe032('0x3a')]:_0x538d68;_0x51f196[_0xe032('0x3b')]=_0x51f196[_0xe032('0x3b')]?_0x51f196[_0xe032('0x3b')]:_0x538d68;_0x51f196[_0xe032('0x3e')]=getSeconds(_0x51f196[_0xe032('0x3a')]||0x0,_0x51f196[_0xe032('0x39')]||0x0);_0x51f196[_0xe032('0x42')]=_0x51f196[_0xe032('0x43')]?getSeconds(_0x51f196[_0xe032('0x3b')],_0x51f196[_0xe032('0x43')]):0x0;};exports[_0xe032('0x44')]=function(_0x2ab67d){return _0x2ab67d===_0xe032('0x45');};exports['variablesAction']=function(_0x55bea2,_0x311647,_0x290ecd,_0xf0513f,_0x39f559){var _0x393414=_0xf0513f?_0xe032('0x46'):_0x55bea2['calleridname'];_0x393414=_0x39f559?_0xe032('0x47'):_0x393414;return{'actionid':_0x55bea2[_0xe032('0x48')],'action':_0xe032('0x49'),'channel':_0x55bea2[_0xe032('0x4a')],'callerid':util[_0xe032('0x12')](_0xe032('0x4b'),_0x393414,_0x55bea2[_0xe032('0x4c')]),'Exten':_0xe032('0x25'),'Context':'from-sip','Priority':'1','variable':_0x290ecd,'timeout':(_0x311647['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x55bea2['uniqueid']};};exports[_0xe032('0x4d')]=function(_0x56015b){return _0x56015b[_0xe032('0x4e')]+_0x56015b[_0xe032('0x4f')]+_0x56015b[_0xe032('0x50')]+_0x56015b[_0xe032('0x51')]+_0x56015b[_0xe032('0x52')];};exports[_0xe032('0x53')]=function(_0x5cecec){var _0x1b8960=_[_0xe032('0x54')](_0x5cecec);_0x1b8960[_0xe032('0x3c')]=0xf;_0x1b8960[_0xe032('0x3d')]=_0xe032('0x55');return _0x1b8960;};exports['scheduledAt']=function(_0x523c92,_0x31fd6a,_0x28e919){var _0x23b656={};_0x23b656[_0x31fd6a]=_0x523c92[_0x31fd6a];_0x23b656[_0xe032('0x56')]=![];_0x23b656[_0xe032('0x57')]=moment()[_0xe032('0x58')](_0x28e919,_0xe032('0x59'))[_0xe032('0x12')](_0xe032('0x37'));_0x23b656['ContactId']=_0x523c92[_0xe032('0x1a')];_0x23b656['ListId']=_0x523c92['ListId'];_0x23b656['VoiceQueueId']=_0x523c92[_0xe032('0x1c')]||undefined;return _0x23b656;};exports[_0xe032('0x5a')]=function(_0x23f067,_0x5500d3){if(!_[_0xe032('0x15')](_0x23f067)){if(_0x23f067['pTalking']>0x0){_0x23f067['pTalking']-=0x1;}else{logger['error'](_0x5500d3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe032('0x9')](_0x5500d3,_0xe032('0x5b'));}};exports[_0xe032('0x5c')]=function(_0x4c2dae){if(_0x4c2dae<=0x0){return!![];}return![];};exports[_0xe032('0x5d')]=function(_0x51dd18,_0x2701f2){_0x51dd18[_0xe032('0x5e')]=_0x2701f2;_0x51dd18['name']=_0x51dd18['queue'];_0x51dd18[_0xe032('0x5f')]=_0x51dd18[_0xe032('0x4a')];return _0x51dd18;};exports[_0xe032('0x60')]=function(_0x13cb92){var _0x500df9={};_0x500df9[_0xe032('0x61')]=_0x13cb92[_0xe032('0x61')];_0x500df9[_0xe032('0x5f')]=_0x13cb92[_0xe032('0x4a')];_0x500df9['uniqueid']=_0x13cb92[_0xe032('0x48')];return _0x500df9;};exports[_0xe032('0x62')]=function(_0x3dc30d){var _0x225853=[];for(var _0x5abeba in _0x3dc30d){if(_0x3dc30d['hasOwnProperty'](_0x5abeba)){if(!_['isNil'](_0x3dc30d[_0x5abeba])&&_0x3dc30d[_0x5abeba]['state']===_0xe032('0x63')&&_0x3dc30d[_0x5abeba][_0xe032('0x64')]==='reachable'){_0x225853[_0xe032('0x65')](_0x3dc30d[_0x5abeba]['id']);}}}return _0x225853;};exports['getDiff']=function(_0x349d77){var _0x18e260=moment()[_0xe032('0x6')](0x0);var _0x908f0a=moment(_0x349d77)[_0xe032('0x6')](0x0);return _0x18e260['diff'](_0x908f0a,_0xe032('0x7'));};exports[_0xe032('0x66')]=function(_0x38a931){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x38a931[_0xe032('0x1a')],'ListId':_0x38a931[_0xe032('0x67')],'VoiceQueueId':_0x38a931[_0xe032('0x1c')]||undefined,'CampaignId':_0x38a931[_0xe032('0x68')]||undefined};};exports[_0xe032('0x69')]=function(_0x5cf6ad){if(_0x5cf6ad===_0xe032('0x48')||_0x5cf6ad===_0xe032('0x6a')||_0x5cf6ad===_0xe032('0x61')||_0x5cf6ad==='type'||_0x5cf6ad===_0xe032('0x6b')||_0x5cf6ad===_0xe032('0x6c')||_0x5cf6ad===_0xe032('0x40')||_0x5cf6ad===_0xe032('0x4a')||_0x5cf6ad===_0xe032('0x19')||_0x5cf6ad===_0xe032('0x56')||_0x5cf6ad===_0xe032('0x4c')||_0x5cf6ad==='scheduledat'||_0x5cf6ad==='countbusyretry'||_0x5cf6ad===_0xe032('0x4f')||_0x5cf6ad===_0xe032('0x50')||_0x5cf6ad===_0xe032('0x6d')||_0x5cf6ad==='callback'||_0x5cf6ad===_0xe032('0x6e')||_0x5cf6ad===_0xe032('0x6f')||_0x5cf6ad===_0xe032('0x70')||_0x5cf6ad==='ContactId'||_0x5cf6ad===_0xe032('0x67')||_0x5cf6ad===_0xe032('0x71')||_0x5cf6ad==='VoiceQueueId'||_0x5cf6ad==='sipcallid'||_0x5cf6ad===_0xe032('0x72')||_0x5cf6ad==='xmd-queue'||_0x5cf6ad==='xmd-phone'||_0x5cf6ad===_0xe032('0x73')||_0x5cf6ad==='xmd-dialurl'||_0x5cf6ad==='xmd-dialtimeout'||_0x5cf6ad===_0xe032('0x74')||_0x5cf6ad===_0xe032('0x75')||_0x5cf6ad==='xmd-dialchannel'||_0x5cf6ad==='xmd-contactid'||_0x5cf6ad===_0xe032('0x76')||_0x5cf6ad===_0xe032('0x77')||_0x5cf6ad===_0xe032('0x78')||_0x5cf6ad===_0xe032('0x79')||_0x5cf6ad==='rtpaudioqos'||_0x5cf6ad==='rtpaudioqosbridged'||_0x5cf6ad===_0xe032('0x7a')||_0x5cf6ad===_0xe032('0x7b')||_0x5cf6ad===_0xe032('0x7c')||_0x5cf6ad==='rtpaudioqoslossbridged'||_0x5cf6ad===_0xe032('0x7d')||_0x5cf6ad===_0xe032('0x7e')||_0x5cf6ad===_0xe032('0x7f')||_0x5cf6ad===_0xe032('0x80')||_0x5cf6ad==='rtpaudioqosjitter'||_0x5cf6ad===_0xe032('0x7b')||_0x5cf6ad===_0xe032('0x7c')||_0x5cf6ad===_0xe032('0x81')||_0x5cf6ad===_0xe032('0x7d')||_0x5cf6ad===_0xe032('0x7e')||_0x5cf6ad===_0xe032('0x82')||_0x5cf6ad===_0xe032('0x83')||_0x5cf6ad===_0xe032('0x3c')||_0x5cf6ad==='statedesc'){return![];}return!![];};exports[_0xe032('0x84')]=function(_0x4955a6,_0x155bf){var _0x180468,_0x33b92e,_0x3955ae;if(_0x155bf<=0x0){_0x155bf=0x1;}_0x180468=new RegExp(_0xe032('0x85')+_0x155bf+'}$');_0x33b92e=Math['pow'](0xa,_0x155bf-0x1);_0x3955ae=Math[_0xe032('0x86')](0xa,_0x155bf)-0x1;return util[_0xe032('0x12')]('%s',_[_0xe032('0x87')](_0x4955a6,_0x180468,_[_0xe032('0x88')](_0x33b92e,_0x3955ae)));};exports[_0xe032('0x89')]=function(_0x3d9aa7){var _0x140d43=_0x3d9aa7[_0xe032('0x8a')](/"(.*?)"/);return _0x140d43?_0x140d43[0x1]:_0x3d9aa7;};exports[_0xe032('0x8b')]=function(_0x533f6a){var _0x39005f=_0x533f6a[_0xe032('0x8a')](/<(.*?)>/);return _0x39005f?_0x39005f[0x1]:_0x533f6a;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 10b17a7..aae8361 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x3e3c8f,_0x4b97ac){var _0x1d976a=function(_0x46e1be){while(--_0x46e1be){_0x3e3c8f['push'](_0x3e3c8f['shift']());}};_0x1d976a(++_0x4b97ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x98cb08,_0x3212b4){_0x98cb08=_0x98cb08-0x0;var _0x23473c=_0xb10b[_0x98cb08];return _0x23473c;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x8207e,_0x374d8c){var _0x2bc725=function(_0x4f75a8){while(--_0x4f75a8){_0x8207e['push'](_0x8207e['shift']());}};_0x2bc725(++_0x374d8c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15891c,_0x19013f){_0x15891c=_0x15891c-0x0;var _0x578f6d=_0x5f2f[_0x15891c];return _0x578f6d;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 39691f7..d2c482c 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 _0xcfef=['../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','SIP/%s','interface','total','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initVoiceQueues','initTemplates','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','outbound','duration','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','merge','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount'];(function(_0x469873,_0x3801d6){var _0x564636=function(_0x5b2af4){while(--_0x5b2af4){_0x469873['push'](_0x469873['shift']());}};_0x564636(++_0x3801d6);}(_0xcfef,0xc1));var _0xfcfe=function(_0x56c852,_0x62d64f){_0x56c852=_0x56c852-0x0;var _0x3baa00=_0xcfef[_0x56c852];return _0x3baa00;};'use strict';var BPromise=require(_0xfcfe('0x0'));var util=require('util');var _=require(_0xfcfe('0x1'));var moment=require(_0xfcfe('0x2'));var Agent=require(_0xfcfe('0x3'));var Telephone=require(_0xfcfe('0x4'));var Trunk=require(_0xfcfe('0x5'));var VoiceQueue=require(_0xfcfe('0x6'));var Trigger=require(_0xfcfe('0x7'));var Template=require(_0xfcfe('0x8'));var Campaign=require(_0xfcfe('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xfcfe('0xa'));var SalesforceAccount=require(_0xfcfe('0xb'));var FreshdeskAccount=require(_0xfcfe('0xc'));var SugarcrmAccount=require(_0xfcfe('0xd'));var ZohoAccount=require(_0xfcfe('0xe'));var DeskAccount=require(_0xfcfe('0xf'));var VtigerAccount=require(_0xfcfe('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xfcfe('0x11'));var FaxAccount=require(_0xfcfe('0x12'));var Realtime=function(){this[_0xfcfe('0x13')]={};this[_0xfcfe('0x14')]={};this[_0xfcfe('0x15')]={};this[_0xfcfe('0x16')]={};this[_0xfcfe('0x17')]={};this[_0xfcfe('0x18')]={};this[_0xfcfe('0x19')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfcfe('0x1a')]={};this[_0xfcfe('0x1b')]={};this['queueChannels']={};this[_0xfcfe('0x1c')]={};this['timers']={};this[_0xfcfe('0x1d')]={};this[_0xfcfe('0x1e')]={};this[_0xfcfe('0x1f')]={};this['freshdeskAccounts']={};this[_0xfcfe('0x20')]={};this[_0xfcfe('0x21')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xfcfe('0x22')]={};this['freshsalesAccounts']={};this[_0xfcfe('0x23')]={};};function freeIsNotKey(_0x138cca,_0x4f29b0,_0x313ef9){var _0x1a8f27=_[_0xfcfe('0x24')](_0x138cca,function(_0x277cb,_0x217534){return _0x277cb[_0x313ef9];});for(var _0x66b4c3 in _0x4f29b0){if(_0x4f29b0[_0xfcfe('0x25')](_0x66b4c3)){if(!_0x1a8f27[_0x66b4c3]){delete _0x4f29b0[_0x66b4c3];}}}}function freeIsNotKeySip(_0x4a445f,_0x25c873){var _0x2811a5=_[_0xfcfe('0x24')](_0x4a445f,function(_0x68cc31,_0x43d8a4){return util[_0xfcfe('0x26')]('SIP/%s',_0x68cc31[_0xfcfe('0x27')]);});for(var _0x2fcd90 in _0x25c873){if(_0x25c873['hasOwnProperty'](_0x2fcd90)){if(!_0x2811a5[_0x2fcd90]){delete _0x25c873[_0x2fcd90];}}}}function freeIsNotKeyAgent(_0xea77c5,_0x5d4170){var _0x268a35=_['mapKeys'](_0xea77c5,function(_0x29d64f,_0x144902){var _0x39276a=_[_0xfcfe('0x28')](_0x29d64f['interface'])?util['format'](_0xfcfe('0x29'),_0x29d64f[_0xfcfe('0x27')]):_0x29d64f[_0xfcfe('0x2a')];return _0x39276a;});for(var _0xa697b1 in _0x5d4170){if(_0x5d4170[_0xfcfe('0x25')](_0xa697b1)){if(!_0x268a35[_0xa697b1]){delete _0x5d4170[_0xa697b1];}}}}function clearVoiceCallReports(_0x35a337){_0x35a337[_0xfcfe('0x2b')]=0x0;_0x35a337['answered']=0x0;_0x35a337[_0xfcfe('0x2c')]=0x0;_0x35a337['sumDuration']=0x0;_0x35a337[_0xfcfe('0x2d')]=0x0;}function clearCampaigns(_0x2fb7bc){if(!_[_0xfcfe('0x2e')](_0x2fb7bc)){for(var _0x1fdd5b in _0x2fb7bc){if(_0x2fb7bc[_0xfcfe('0x25')](_0x1fdd5b)){_0x2fb7bc[_0x1fdd5b][_0xfcfe('0x2f')]=0x0;_0x2fb7bc[_0x1fdd5b][_0xfcfe('0x30')]=0x0;}}}}function clearVoiceQueues(_0x2f047d){if(!_['isEmpty'](_0x2f047d)){for(var _0x2cbec7 in _0x2f047d){if(_0x2f047d['hasOwnProperty'](_0x2cbec7)){_0x2f047d[_0x2cbec7][_0xfcfe('0x2b')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x31')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x32')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x33')]=0x0;_0x2f047d[_0x2cbec7]['sumHoldTime']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x34')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x2d')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x35')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x36')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x37')]=0x0;_0x2f047d[_0x2cbec7]['outboundCongestionCallsDay']=0x0;_0x2f047d[_0x2cbec7]['outboundNoSuchCallsDay']=0x0;_0x2f047d[_0x2cbec7]['outboundUnknownCallsDay']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x38')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x39')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3a')]=0x0;_0x2f047d[_0x2cbec7]['outboundOriginateFailureCallsDay']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3b')]=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3c')]=0x0;_0x2f047d[_0x2cbec7]['outboundAnswerAgiCallsDay']=0x0;_0x2f047d[_0x2cbec7]['outboundAnswerCallsDay']=0x0;_0x2f047d[_0x2cbec7][_0xfcfe('0x3d')]=!![];}}}}Realtime['prototype'][_0xfcfe('0x3e')]=function(_0x13fa77,_0x4403b1){for(var _0x4b799a in _0x4403b1){if(_0x13fa77[_0xfcfe('0x25')](_0x4b799a)){_0x13fa77[_0x4b799a]=_0x4403b1[_0x4b799a];}}};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x40')]=function(){var _0x435a71=this;return function(_0x1eb182){if(_0x1eb182){freeIsNotKeyAgent(_0x1eb182,_0x435a71['agents']);for(var _0x4a1481=0x0,_0x9b619d={},_0x298324={};_0x4a1481<_0x1eb182[_0xfcfe('0x41')];_0x4a1481+=0x1){_0x9b619d=_0x1eb182[_0x4a1481];var _0x2e5a89=_['isNil'](_0x9b619d['interface'])?util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x9b619d[_0xfcfe('0x27')]):_0x9b619d[_0xfcfe('0x2a')];if(_[_0xfcfe('0x42')](_0x435a71[_0xfcfe('0x13')][_0x2e5a89])){_0x435a71[_0xfcfe('0x13')][_0x2e5a89]=new Agent(_0x9b619d);}else{_0x435a71[_0xfcfe('0x3e')](_0x435a71['agents'][_0x2e5a89],_0x9b619d);}}}return _0x435a71['agents'];};};Realtime[_0xfcfe('0x3f')]['initTelephones']=function(){var _0x532305=this;return function(_0x27197b){if(_0x27197b){freeIsNotKeySip(_0x27197b,_0x532305[_0xfcfe('0x14')]);for(var _0x190c8c=0x0,_0x3796ce={},_0x41f8cb={};_0x190c8c<_0x27197b[_0xfcfe('0x41')];_0x190c8c+=0x1){_0x3796ce=_0x27197b[_0x190c8c];if(_['isUndefined'](_0x532305['telephones'][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x3796ce['name'])])){_0x532305[_0xfcfe('0x14')][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x3796ce[_0xfcfe('0x27')])]=new Telephone(_0x3796ce);}else{_0x532305['mergeFromDatabase'](_0x532305['telephones'][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x3796ce['name'])],_0x3796ce);}}}return _0x532305[_0xfcfe('0x14')];};};Realtime[_0xfcfe('0x3f')]['initTrunks']=function(){var _0x1b9a4d=this;return function(_0x4ea2bc){if(_0x4ea2bc){freeIsNotKeySip(_0x4ea2bc,_0x1b9a4d[_0xfcfe('0x15')]);for(var _0x5d51ec=0x0,_0x58a0f1={},_0x2b4f5a={};_0x5d51ec<_0x4ea2bc[_0xfcfe('0x41')];_0x5d51ec+=0x1){_0x58a0f1=_0x4ea2bc[_0x5d51ec];if(_[_0xfcfe('0x42')](_0x1b9a4d[_0xfcfe('0x15')][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x58a0f1[_0xfcfe('0x27')])])){_0x1b9a4d[_0xfcfe('0x15')][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x58a0f1[_0xfcfe('0x27')])]=new Trunk(_0x58a0f1);}else{_0x1b9a4d['mergeFromDatabase'](_0x1b9a4d['trunks'][util[_0xfcfe('0x26')](_0xfcfe('0x29'),_0x58a0f1[_0xfcfe('0x27')])],_0x58a0f1);}}}return _0x1b9a4d[_0xfcfe('0x15')];};};Realtime['prototype'][_0xfcfe('0x43')]=function(){var _0x1bb77e=this;return function(_0x477135){if(_0x477135){freeIsNotKey(_0x477135,_0x1bb77e[_0xfcfe('0x16')],_0xfcfe('0x27'));for(var _0x1d4002=0x0,_0x6d94be={},_0x18cfd3={};_0x1d4002<_0x477135[_0xfcfe('0x41')];_0x1d4002+=0x1){_0x6d94be=_0x477135[_0x1d4002];if(_[_0xfcfe('0x42')](_0x1bb77e[_0xfcfe('0x16')][_0x6d94be[_0xfcfe('0x27')]])){_0x1bb77e[_0xfcfe('0x16')][_0x6d94be[_0xfcfe('0x27')]]=new VoiceQueue(_0x6d94be);}else{_0x1bb77e[_0xfcfe('0x3e')](_0x1bb77e[_0xfcfe('0x16')][_0x6d94be['name']],_0x6d94be);}}}return _0x1bb77e['voiceQueues'];};};Realtime[_0xfcfe('0x3f')]['initTriggers']=function(){var _0x28a1e1=this;return function(_0x5dc4cc){if(_0x5dc4cc){freeIsNotKey(_0x5dc4cc,_0x28a1e1[_0xfcfe('0x17')],'id');for(var _0x293396=0x0,_0x1c4b12={},_0x3c2ce2={};_0x293396<_0x5dc4cc[_0xfcfe('0x41')];_0x293396+=0x1){_0x1c4b12=_0x5dc4cc[_0x293396];if(_['isUndefined'](_0x28a1e1['triggers'][_0x1c4b12['id']])){_0x28a1e1[_0xfcfe('0x17')][_0x1c4b12['id']]=new Trigger(_0x1c4b12);}else{_0x28a1e1[_0xfcfe('0x3e')](_0x28a1e1[_0xfcfe('0x17')][_0x1c4b12['id']],_0x1c4b12);}}}return _0x28a1e1['triggers'];};};Realtime['prototype'][_0xfcfe('0x44')]=function(){var _0x2bcc81=this;return function(_0x30fc62){if(_0x30fc62){freeIsNotKey(_0x30fc62,_0x2bcc81[_0xfcfe('0x19')],'id');for(var _0x51a710=0x0,_0x2f6ea2={},_0x59a54c={};_0x51a710<_0x30fc62[_0xfcfe('0x41')];_0x51a710+=0x1){_0x2f6ea2=_0x30fc62[_0x51a710];if(_[_0xfcfe('0x42')](_0x2bcc81[_0xfcfe('0x19')][_0x2f6ea2['id']])){_0x2bcc81['templates'][_0x2f6ea2['id']]=new Template(_0x2f6ea2);}else{_0x2bcc81[_0xfcfe('0x3e')](_0x2bcc81[_0xfcfe('0x19')][_0x2f6ea2['id']],_0x2f6ea2);}}}return _0x2bcc81[_0xfcfe('0x19')];};};Realtime[_0xfcfe('0x3f')]['initZendeskAccounts']=function(){var _0x2c4335=this;return function(_0x5bfd21){if(_0x5bfd21){freeIsNotKey(_0x5bfd21,_0x2c4335[_0xfcfe('0x1d')],'id');for(var _0x53258c=0x0,_0x556ad6={},_0x3c328a={};_0x53258c<_0x5bfd21[_0xfcfe('0x41')];_0x53258c+=0x1){_0x556ad6=_0x5bfd21[_0x53258c];if(_[_0xfcfe('0x42')](_0x2c4335[_0xfcfe('0x1d')][_0x556ad6['id']])){_0x2c4335[_0xfcfe('0x1d')][_0x556ad6['id']]=new ZendeskAccount(_0x556ad6);}else{_0x2c4335['mergeFromDatabase'](_0x2c4335[_0xfcfe('0x1d')][_0x556ad6['id']],_0x556ad6);}}}return _0x2c4335[_0xfcfe('0x1d')];};};Realtime[_0xfcfe('0x3f')]['initSalesforceAccounts']=function(){var _0x21ce83=this;return function(_0x179610){if(_0x179610){freeIsNotKey(_0x179610,_0x21ce83[_0xfcfe('0x1e')],'id');for(var _0x276a39=0x0,_0x136cc1={},_0x282a94={};_0x276a39<_0x179610[_0xfcfe('0x41')];_0x276a39+=0x1){_0x136cc1=_0x179610[_0x276a39];if(_[_0xfcfe('0x42')](_0x21ce83[_0xfcfe('0x1e')][_0x136cc1['id']])){_0x21ce83['salesforceAccounts'][_0x136cc1['id']]=new SalesforceAccount(_0x136cc1);}else{_0x21ce83['mergeFromDatabase'](_0x21ce83[_0xfcfe('0x1e')][_0x136cc1['id']],_0x136cc1);}}}return _0x21ce83[_0xfcfe('0x1e')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x45')]=function(){var _0x226e9e=this;return function(_0x421869){if(_0x421869){freeIsNotKey(_0x421869,_0x226e9e['freshdeskAccounts'],'id');for(var _0x3137c4=0x0,_0x16833d={},_0x813930={};_0x3137c4<_0x421869['length'];_0x3137c4+=0x1){_0x16833d=_0x421869[_0x3137c4];if(_[_0xfcfe('0x42')](_0x226e9e[_0xfcfe('0x46')][_0x16833d['id']])){_0x226e9e[_0xfcfe('0x46')][_0x16833d['id']]=new FreshdeskAccount(_0x16833d);}else{_0x226e9e[_0xfcfe('0x3e')](_0x226e9e[_0xfcfe('0x46')][_0x16833d['id']],_0x16833d);}}}return _0x226e9e[_0xfcfe('0x46')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x47')]=function(){var _0x52bc45=this;return function(_0x15ed17){if(_0x15ed17){freeIsNotKey(_0x15ed17,_0x52bc45[_0xfcfe('0x20')],'id');for(var _0x34d1d2=0x0,_0x2d7ae0={},_0x175e54={};_0x34d1d2<_0x15ed17[_0xfcfe('0x41')];_0x34d1d2+=0x1){_0x2d7ae0=_0x15ed17[_0x34d1d2];if(_[_0xfcfe('0x42')](_0x52bc45[_0xfcfe('0x20')][_0x2d7ae0['id']])){_0x52bc45[_0xfcfe('0x20')][_0x2d7ae0['id']]=new ZohoAccount(_0x2d7ae0);}else{_0x52bc45[_0xfcfe('0x3e')](_0x52bc45[_0xfcfe('0x20')][_0x2d7ae0['id']],_0x2d7ae0);}}}return _0x52bc45[_0xfcfe('0x20')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x48')]=function(){var _0x4213d8=this;return function(_0x40e5b7){if(_0x40e5b7){freeIsNotKey(_0x40e5b7,_0x4213d8[_0xfcfe('0x21')],'id');for(var _0x470f90=0x0,_0x1c8922={},_0x1f9400={};_0x470f90<_0x40e5b7[_0xfcfe('0x41')];_0x470f90+=0x1){_0x1c8922=_0x40e5b7[_0x470f90];if(_[_0xfcfe('0x42')](_0x4213d8['deskAccounts'][_0x1c8922['id']])){_0x4213d8['deskAccounts'][_0x1c8922['id']]=new DeskAccount(_0x1c8922);}else{_0x4213d8[_0xfcfe('0x3e')](_0x4213d8[_0xfcfe('0x21')][_0x1c8922['id']],_0x1c8922);}}}return _0x4213d8[_0xfcfe('0x21')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x49')]=function(){var _0x56e72d=this;return function(_0x24df27){if(_0x24df27){freeIsNotKey(_0x24df27,_0x56e72d[_0xfcfe('0x1f')],'id');for(var _0x26858b=0x0,_0x26555e={},_0x3b6325={};_0x26858b<_0x24df27['length'];_0x26858b+=0x1){_0x26555e=_0x24df27[_0x26858b];if(_[_0xfcfe('0x42')](_0x56e72d[_0xfcfe('0x1f')][_0x26555e['id']])){_0x56e72d['sugarcrmAccounts'][_0x26555e['id']]=new SugarcrmAccount(_0x26555e);}else{_0x56e72d['mergeFromDatabase'](_0x56e72d[_0xfcfe('0x1f')][_0x26555e['id']],_0x26555e);}}}return _0x56e72d[_0xfcfe('0x1f')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4a')]=function(){var _0x2bb101=this;return function(_0x48d941){if(_0x48d941){freeIsNotKey(_0x48d941,_0x2bb101[_0xfcfe('0x4b')],'id');for(var _0x44114f=0x0,_0xa21ba2={},_0x243bad={};_0x44114f<_0x48d941[_0xfcfe('0x41')];_0x44114f+=0x1){_0xa21ba2=_0x48d941[_0x44114f];if(_['isUndefined'](_0x2bb101[_0xfcfe('0x4b')][_0xa21ba2['id']])){_0x2bb101[_0xfcfe('0x4b')][_0xa21ba2['id']]=new VtigerAccount(_0xa21ba2);}else{_0x2bb101[_0xfcfe('0x3e')](_0x2bb101['vtigerAccounts'][_0xa21ba2['id']],_0xa21ba2);}}}return _0x2bb101[_0xfcfe('0x4b')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4c')]=function(){var _0x4d71d3=this;return function(_0x4e36eb){if(_0x4e36eb){freeIsNotKey(_0x4e36eb,_0x4d71d3[_0xfcfe('0x4d')],'id');for(var _0x3a2ffa=0x0,_0xe903df={},_0x479455={};_0x3a2ffa<_0x4e36eb[_0xfcfe('0x41')];_0x3a2ffa+=0x1){_0xe903df=_0x4e36eb[_0x3a2ffa];if(_[_0xfcfe('0x42')](_0x4d71d3[_0xfcfe('0x4d')][_0xe903df['id']])){_0x4d71d3[_0xfcfe('0x4d')][_0xe903df['id']]=new ServicenowAccount(_0xe903df);}else{_0x4d71d3[_0xfcfe('0x3e')](_0x4d71d3[_0xfcfe('0x4d')][_0xe903df['id']],_0xe903df);}}}return _0x4d71d3[_0xfcfe('0x4d')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4e')]=function(){var _0x2ee9ac=this;return function(_0x14428d){if(_0x14428d){freeIsNotKey(_0x14428d,_0x2ee9ac[_0xfcfe('0x22')],'id');for(var _0x3258f8=0x0,_0x5d34da={},_0x55dbc6={};_0x3258f8<_0x14428d[_0xfcfe('0x41')];_0x3258f8+=0x1){_0x5d34da=_0x14428d[_0x3258f8];if(_[_0xfcfe('0x42')](_0x2ee9ac[_0xfcfe('0x22')][_0x5d34da['id']])){_0x2ee9ac[_0xfcfe('0x22')][_0x5d34da['id']]=new Dynamics365Account(_0x5d34da);}else{_0x2ee9ac[_0xfcfe('0x3e')](_0x2ee9ac[_0xfcfe('0x22')][_0x5d34da['id']],_0x5d34da);}}}return _0x2ee9ac[_0xfcfe('0x22')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x4f')]=function(){var _0x45bf2e=this;return function(_0x5502e1){if(_0x5502e1){freeIsNotKey(_0x5502e1,_0x45bf2e['freshsalesAccounts'],'id');for(var _0x1802ac=0x0,_0xc65104={},_0x1f28e1={};_0x1802ac<_0x5502e1['length'];_0x1802ac+=0x1){_0xc65104=_0x5502e1[_0x1802ac];if(_[_0xfcfe('0x42')](_0x45bf2e[_0xfcfe('0x50')][_0xc65104['id']])){_0x45bf2e[_0xfcfe('0x50')][_0xc65104['id']]=new FreshsalesAccount(_0xc65104);}else{_0x45bf2e[_0xfcfe('0x3e')](_0x45bf2e['freshsalesAccounts'][_0xc65104['id']],_0xc65104);}}}return _0x45bf2e[_0xfcfe('0x50')];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x51')]=function(){var _0x4db4b8=this;return function(_0xaeabe){for(var _0x294405=0x0;_0x294405<_0xaeabe[_0xfcfe('0x41')];_0x294405+=0x1){_['merge'](_0x4db4b8[_0xfcfe('0x16')][_0xaeabe[_0x294405][_0xfcfe('0x27')]],_0xaeabe[_0x294405]);}return _0x4db4b8['voiceQueues'];};};Realtime[_0xfcfe('0x3f')][_0xfcfe('0x52')]=function(){var _0x464a04=this;return function(_0x50241f){clearVoiceQueues(_0x464a04['voiceQueues']);if(_0x50241f){_0x50241f=_[_0xfcfe('0x53')](_0x50241f,_0xfcfe('0x54'));for(var _0x3fb576 in _0x50241f){if(_0x50241f[_0xfcfe('0x25')](_0x3fb576)){var _0xb22338={};for(var _0x46bf73=0x0;_0x46bf73<_0x50241f[_0x3fb576][_0xfcfe('0x41')];_0x46bf73+=0x1){var _0x2495ca=_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x55')];if(_0x464a04['voiceQueues'][_0x2495ca]){if(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x56')]){_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x32')]+=0x1;}if(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x57')]){_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x33')]+=0x1;}_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x2c')]+=moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x58')])[_0xfcfe('0x59')](moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5a')]),_0xfcfe('0x5b'))||0x0;if(_0x46bf73===_0x50241f[_0x3fb576][_0xfcfe('0x41')]-0x1){_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x34')]+=moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5c')]||_0x50241f[_0x3fb576][_0x46bf73]['queuecallerabandonAt']||_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5d')])[_0xfcfe('0x59')](moment(_0x50241f[_0x3fb576][_0x46bf73]['queuecallerjoinAt']),_0xfcfe('0x5b'))||0x0;_0x464a04[_0xfcfe('0x16')][_0x2495ca]['total']+=0x1;if(_0x50241f[_0x3fb576][_0x46bf73]['queuecallercomplete']){_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x31')]+=0x1;_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x2d')]+=moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x5c')])['diff'](moment(_0x50241f[_0x3fb576][_0x46bf73][_0xfcfe('0x58')]),_0xfcfe('0x5b'))||0x0;}}else{_0x464a04[_0xfcfe('0x16')][_0x2495ca][_0xfcfe('0x34')]+=_0x464a04['voiceQueues'][_0x2495ca][_0xfcfe('0x2c')]||0x0;}}}}}}return _0x464a04[_0xfcfe('0x16')];};};Realtime[_0xfcfe('0x3f')]['initVoiceCallReports']=function(){var _0x51f941=this;return function(_0x358411){clearVoiceCallReports(_0x51f941[_0xfcfe('0x5e')]);if(_0x358411){for(var _0x5caa98=0x0;_0x5caa98<_0x358411[_0xfcfe('0x41')];_0x5caa98+=0x1){_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x2b')]+=0x1;_0x51f941[_0xfcfe('0x5e')]['sumDuration']+=_0x358411[_0x5caa98][_0xfcfe('0x5f')];if(_0x358411[_0x5caa98]['disposition']===_0xfcfe('0x60')){_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x31')]+=0x1;_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x2c')]+=_0x358411[_0x5caa98][_0xfcfe('0x5f')]-_0x358411[_0x5caa98]['billableseconds']||0x0;_0x51f941[_0xfcfe('0x5e')][_0xfcfe('0x2d')]+=_0x358411[_0x5caa98][_0xfcfe('0x61')];}}}return _0x51f941[_0xfcfe('0x5e')];};};Realtime[_0xfcfe('0x3f')]['initCampaigns']=function(){var _0x3abb63=this;return function(_0x4dc5bb){if(_0x4dc5bb){freeIsNotKey(_0x4dc5bb,_0x3abb63[_0xfcfe('0x18')],_0xfcfe('0x27'));for(var _0x4fa622=0x0,_0x219900={};_0x4fa622<_0x4dc5bb[_0xfcfe('0x41')];_0x4fa622+=0x1){_0x219900=_0x4dc5bb[_0x4fa622];if(_[_0xfcfe('0x42')](_0x3abb63[_0xfcfe('0x18')][_0x219900[_0xfcfe('0x27')]])){_0x3abb63[_0xfcfe('0x18')][_0x219900[_0xfcfe('0x27')]]=new Campaign(_0x219900);}else{_0x3abb63[_0xfcfe('0x3e')](_0x3abb63['campaigns'][_0x219900[_0xfcfe('0x27')]],_0x219900);_0x3abb63['campaigns'][_0x219900[_0xfcfe('0x27')]][_0xfcfe('0x62')]=_0x219900[_0xfcfe('0x63')]?_0x219900[_0xfcfe('0x63')][_0xfcfe('0x27')]:undefined;}}}return _0x3abb63[_0xfcfe('0x18')];};};Realtime['prototype'][_0xfcfe('0x64')]=function(){var _0x5b2525=this;return function(_0x186422){if(_0x186422){freeIsNotKey(_0x186422,_0x5b2525[_0xfcfe('0x1a')],'id');for(var _0x672a1=0x0,_0xe705b0={};_0x672a1<_0x186422[_0xfcfe('0x41')];_0x672a1+=0x1){_0xe705b0=_0x186422[_0x672a1];if(_[_0xfcfe('0x42')](_0x5b2525[_0xfcfe('0x1a')][_0xe705b0['id']])){_0x5b2525[_0xfcfe('0x1a')][_0xe705b0['id']]=new VoiceExtension(_0xe705b0);}else{_0x5b2525[_0xfcfe('0x3e')](_0x5b2525[_0xfcfe('0x1a')][_0xe705b0['id']],_0xe705b0);}}}return _0x5b2525[_0xfcfe('0x1a')];};};Realtime[_0xfcfe('0x3f')]['initCampaignHopperHistory']=function(){var _0x18790e=this;return function(_0x554303){clearCampaigns(_0x18790e[_0xfcfe('0x18')]);for(var _0x51bf5c=0x0;_0x51bf5c<_0x554303['length'];_0x51bf5c+=0x1){_[_0xfcfe('0x65')](_0x18790e[_0xfcfe('0x18')][_0x554303[_0x51bf5c][_0xfcfe('0x27')]],_0x554303[_0x51bf5c]);}return _0x18790e[_0xfcfe('0x18')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x468724=this;return function(_0x1d46c5){if(_0x1d46c5){freeIsNotKey(_0x1d46c5,_0x468724['faxAccounts'],'id');for(var _0x1e58cc=0x0,_0x1f991b={},_0x506e99={};_0x1e58cc<_0x1d46c5['length'];_0x1e58cc+=0x1){_0x1f991b=_0x1d46c5[_0x1e58cc];if(_[_0xfcfe('0x42')](_0x468724[_0xfcfe('0x23')][_0x1f991b['id']])){_0x468724[_0xfcfe('0x23')][_0x1f991b['id']]=new FaxAccount(_0x1f991b);}else{_0x468724[_0xfcfe('0x3e')](_0x468724[_0xfcfe('0x23')][_0x1f991b['id']],_0x1f991b);}}}return _0x468724[_0xfcfe('0x23')];};};module[_0xfcfe('0x66')]=Realtime; \ No newline at end of file +var _0x365a=['zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','mapKeys','isNil','interface','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','uniqueid','queue','queuecallerexit','unmanaged','diff','seconds','queuecallerexitAt','queuecallercomplete','sumBillable','queuecallerleaveAt','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers'];(function(_0x3b5915,_0x50ac3c){var _0x19525d=function(_0x1beba5){while(--_0x1beba5){_0x3b5915['push'](_0x3b5915['shift']());}};_0x19525d(++_0x50ac3c);}(_0x365a,0x18d));var _0xa365=function(_0x1e8f52,_0x2254f3){_0x1e8f52=_0x1e8f52-0x0;var _0x1750b5=_0x365a[_0x1e8f52];return _0x1750b5;};'use strict';var BPromise=require(_0xa365('0x0'));var util=require(_0xa365('0x1'));var _=require(_0xa365('0x2'));var moment=require(_0xa365('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xa365('0x4'));var VoiceQueue=require(_0xa365('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xa365('0x6'));var Campaign=require(_0xa365('0x7'));var VoiceExtension=require(_0xa365('0x8'));var ZendeskAccount=require(_0xa365('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa365('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa365('0xb'));var VtigerAccount=require(_0xa365('0xc'));var ServicenowAccount=require(_0xa365('0xd'));var Dynamics365Account=require(_0xa365('0xe'));var FreshsalesAccount=require(_0xa365('0xf'));var FaxAccount=require(_0xa365('0x10'));var Realtime=function(){this[_0xa365('0x11')]={};this['telephones']={};this['trunks']={};this[_0xa365('0x12')]={};this[_0xa365('0x13')]={};this[_0xa365('0x14')]={};this[_0xa365('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa365('0x16')]={};this[_0xa365('0x17')]={};this[_0xa365('0x18')]={};this[_0xa365('0x19')]={};this[_0xa365('0x1a')]={};this[_0xa365('0x1b')]={};this[_0xa365('0x1c')]={};this[_0xa365('0x1d')]={};this[_0xa365('0x1e')]={};this['zohoAccounts']={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0xa365('0x1f')]={};this['dynamics365Accounts']={};this[_0xa365('0x20')]={};this[_0xa365('0x21')]={};};function freeIsNotKey(_0x5c09fc,_0x30fc1d,_0x5b0d0f){var _0x1d667d=_['mapKeys'](_0x5c09fc,function(_0xf235ce,_0x38beb3){return _0xf235ce[_0x5b0d0f];});for(var _0x5e823e in _0x30fc1d){if(_0x30fc1d[_0xa365('0x22')](_0x5e823e)){if(!_0x1d667d[_0x5e823e]){delete _0x30fc1d[_0x5e823e];}}}}function freeIsNotKeySip(_0x127efd,_0x193a48){var _0x5d51fb=_['mapKeys'](_0x127efd,function(_0x376c58,_0x3d5680){return util[_0xa365('0x23')](_0xa365('0x24'),_0x376c58[_0xa365('0x25')]);});for(var _0x3b5f2f in _0x193a48){if(_0x193a48[_0xa365('0x22')](_0x3b5f2f)){if(!_0x5d51fb[_0x3b5f2f]){delete _0x193a48[_0x3b5f2f];}}}}function freeIsNotKeyAgent(_0x1f8084,_0x574327){var _0x1f1917=_[_0xa365('0x26')](_0x1f8084,function(_0x5175ca,_0x15c873){var _0x1c3cfb=_[_0xa365('0x27')](_0x5175ca[_0xa365('0x28')])?util['format']('SIP/%s',_0x5175ca[_0xa365('0x25')]):_0x5175ca[_0xa365('0x28')];return _0x1c3cfb;});for(var _0x4ce0b2 in _0x574327){if(_0x574327[_0xa365('0x22')](_0x4ce0b2)){if(!_0x1f1917[_0x4ce0b2]){delete _0x574327[_0x4ce0b2];}}}}function clearVoiceCallReports(_0x8a9763){_0x8a9763['total']=0x0;_0x8a9763[_0xa365('0x29')]=0x0;_0x8a9763[_0xa365('0x2a')]=0x0;_0x8a9763[_0xa365('0x2b')]=0x0;_0x8a9763['sumBillable']=0x0;}function clearCampaigns(_0x6f65c0){if(!_[_0xa365('0x2c')](_0x6f65c0)){for(var _0x2236ed in _0x6f65c0){if(_0x6f65c0[_0xa365('0x22')](_0x2236ed)){_0x6f65c0[_0x2236ed][_0xa365('0x2d')]=0x0;_0x6f65c0[_0x2236ed][_0xa365('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x26a31e){if(!_['isEmpty'](_0x26a31e)){for(var _0xc84a19 in _0x26a31e){if(_0x26a31e[_0xa365('0x22')](_0xc84a19)){_0x26a31e[_0xc84a19][_0xa365('0x2f')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x29')]=0x0;_0x26a31e[_0xc84a19]['unmanaged']=0x0;_0x26a31e[_0xc84a19][_0xa365('0x30')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x2a')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x2b')]=0x0;_0x26a31e[_0xc84a19]['sumBillable']=0x0;_0x26a31e[_0xc84a19]['outboundAnswerAgiCallsDay']=0x0;_0x26a31e[_0xc84a19][_0xa365('0x31')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x32')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x33')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x34')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x35')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x36')]=0x0;_0x26a31e[_0xc84a19]['outboundDropCallsDayCallersExit']=0x0;_0x26a31e[_0xc84a19]['outboundBlacklistCallsDay']=0x0;_0x26a31e[_0xc84a19][_0xa365('0x37')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x38')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x39')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x3a')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x3b')]=0x0;_0x26a31e[_0xc84a19][_0xa365('0x3c')]=!![];}}}}Realtime[_0xa365('0x3d')][_0xa365('0x3e')]=function(_0x36f115,_0x4b6c30){for(var _0x32e2c5 in _0x4b6c30){if(_0x36f115[_0xa365('0x22')](_0x32e2c5)){_0x36f115[_0x32e2c5]=_0x4b6c30[_0x32e2c5];}}};Realtime[_0xa365('0x3d')][_0xa365('0x3f')]=function(){var _0x219b0f=this;return function(_0x5af081){if(_0x5af081){freeIsNotKeyAgent(_0x5af081,_0x219b0f[_0xa365('0x11')]);for(var _0x3bebd6=0x0,_0x5a7d15={},_0x13d147={};_0x3bebd6<_0x5af081[_0xa365('0x40')];_0x3bebd6+=0x1){_0x5a7d15=_0x5af081[_0x3bebd6];var _0x2a7f81=_[_0xa365('0x27')](_0x5a7d15[_0xa365('0x28')])?util['format'](_0xa365('0x24'),_0x5a7d15['name']):_0x5a7d15[_0xa365('0x28')];if(_[_0xa365('0x41')](_0x219b0f[_0xa365('0x11')][_0x2a7f81])){_0x219b0f['agents'][_0x2a7f81]=new Agent(_0x5a7d15);}else{_0x219b0f[_0xa365('0x3e')](_0x219b0f[_0xa365('0x11')][_0x2a7f81],_0x5a7d15);}}}return _0x219b0f[_0xa365('0x11')];};};Realtime['prototype'][_0xa365('0x42')]=function(){var _0x4cb571=this;return function(_0x39ab4a){if(_0x39ab4a){freeIsNotKeySip(_0x39ab4a,_0x4cb571[_0xa365('0x43')]);for(var _0xcae118=0x0,_0x5981b0={},_0x39c0e3={};_0xcae118<_0x39ab4a['length'];_0xcae118+=0x1){_0x5981b0=_0x39ab4a[_0xcae118];if(_[_0xa365('0x41')](_0x4cb571[_0xa365('0x43')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5981b0[_0xa365('0x25')])])){_0x4cb571[_0xa365('0x43')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5981b0[_0xa365('0x25')])]=new Telephone(_0x5981b0);}else{_0x4cb571[_0xa365('0x3e')](_0x4cb571[_0xa365('0x43')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5981b0[_0xa365('0x25')])],_0x5981b0);}}}return _0x4cb571[_0xa365('0x43')];};};Realtime[_0xa365('0x3d')][_0xa365('0x44')]=function(){var _0x4ebe48=this;return function(_0x2036c3){if(_0x2036c3){freeIsNotKeySip(_0x2036c3,_0x4ebe48[_0xa365('0x45')]);for(var _0x3dccd0=0x0,_0x5806f2={},_0x381611={};_0x3dccd0<_0x2036c3['length'];_0x3dccd0+=0x1){_0x5806f2=_0x2036c3[_0x3dccd0];if(_[_0xa365('0x41')](_0x4ebe48[_0xa365('0x45')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5806f2[_0xa365('0x25')])])){_0x4ebe48[_0xa365('0x45')][util[_0xa365('0x23')](_0xa365('0x24'),_0x5806f2[_0xa365('0x25')])]=new Trunk(_0x5806f2);}else{_0x4ebe48['mergeFromDatabase'](_0x4ebe48[_0xa365('0x45')][util[_0xa365('0x23')]('SIP/%s',_0x5806f2[_0xa365('0x25')])],_0x5806f2);}}}return _0x4ebe48[_0xa365('0x45')];};};Realtime[_0xa365('0x3d')][_0xa365('0x46')]=function(){var _0x381329=this;return function(_0x516b0a){if(_0x516b0a){freeIsNotKey(_0x516b0a,_0x381329['voiceQueues'],_0xa365('0x25'));for(var _0x1dfc9e=0x0,_0x175049={},_0x459916={};_0x1dfc9e<_0x516b0a[_0xa365('0x40')];_0x1dfc9e+=0x1){_0x175049=_0x516b0a[_0x1dfc9e];if(_[_0xa365('0x41')](_0x381329[_0xa365('0x12')][_0x175049[_0xa365('0x25')]])){_0x381329[_0xa365('0x12')][_0x175049['name']]=new VoiceQueue(_0x175049);}else{_0x381329[_0xa365('0x3e')](_0x381329['voiceQueues'][_0x175049[_0xa365('0x25')]],_0x175049);}}}return _0x381329['voiceQueues'];};};Realtime[_0xa365('0x3d')][_0xa365('0x47')]=function(){var _0x5ec4e4=this;return function(_0x3c3f8c){if(_0x3c3f8c){freeIsNotKey(_0x3c3f8c,_0x5ec4e4['triggers'],'id');for(var _0x3d014f=0x0,_0x2364d0={},_0x50b05a={};_0x3d014f<_0x3c3f8c[_0xa365('0x40')];_0x3d014f+=0x1){_0x2364d0=_0x3c3f8c[_0x3d014f];if(_[_0xa365('0x41')](_0x5ec4e4[_0xa365('0x13')][_0x2364d0['id']])){_0x5ec4e4[_0xa365('0x13')][_0x2364d0['id']]=new Trigger(_0x2364d0);}else{_0x5ec4e4[_0xa365('0x3e')](_0x5ec4e4[_0xa365('0x13')][_0x2364d0['id']],_0x2364d0);}}}return _0x5ec4e4[_0xa365('0x13')];};};Realtime[_0xa365('0x3d')][_0xa365('0x48')]=function(){var _0x2fdf17=this;return function(_0x5b8467){if(_0x5b8467){freeIsNotKey(_0x5b8467,_0x2fdf17[_0xa365('0x15')],'id');for(var _0x4a31a1=0x0,_0x575c41={},_0x2d40dc={};_0x4a31a1<_0x5b8467['length'];_0x4a31a1+=0x1){_0x575c41=_0x5b8467[_0x4a31a1];if(_[_0xa365('0x41')](_0x2fdf17[_0xa365('0x15')][_0x575c41['id']])){_0x2fdf17[_0xa365('0x15')][_0x575c41['id']]=new Template(_0x575c41);}else{_0x2fdf17[_0xa365('0x3e')](_0x2fdf17[_0xa365('0x15')][_0x575c41['id']],_0x575c41);}}}return _0x2fdf17[_0xa365('0x15')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x1ab1e7=this;return function(_0x4ee26f){if(_0x4ee26f){freeIsNotKey(_0x4ee26f,_0x1ab1e7[_0xa365('0x1b')],'id');for(var _0x3d16dd=0x0,_0x179f67={},_0x52bf4e={};_0x3d16dd<_0x4ee26f[_0xa365('0x40')];_0x3d16dd+=0x1){_0x179f67=_0x4ee26f[_0x3d16dd];if(_[_0xa365('0x41')](_0x1ab1e7[_0xa365('0x1b')][_0x179f67['id']])){_0x1ab1e7[_0xa365('0x1b')][_0x179f67['id']]=new ZendeskAccount(_0x179f67);}else{_0x1ab1e7[_0xa365('0x3e')](_0x1ab1e7['zendeskAccounts'][_0x179f67['id']],_0x179f67);}}}return _0x1ab1e7[_0xa365('0x1b')];};};Realtime['prototype'][_0xa365('0x49')]=function(){var _0x27585d=this;return function(_0x350a88){if(_0x350a88){freeIsNotKey(_0x350a88,_0x27585d[_0xa365('0x1c')],'id');for(var _0x559355=0x0,_0x1375f9={},_0x35f921={};_0x559355<_0x350a88[_0xa365('0x40')];_0x559355+=0x1){_0x1375f9=_0x350a88[_0x559355];if(_[_0xa365('0x41')](_0x27585d['salesforceAccounts'][_0x1375f9['id']])){_0x27585d[_0xa365('0x1c')][_0x1375f9['id']]=new SalesforceAccount(_0x1375f9);}else{_0x27585d[_0xa365('0x3e')](_0x27585d[_0xa365('0x1c')][_0x1375f9['id']],_0x1375f9);}}}return _0x27585d[_0xa365('0x1c')];};};Realtime['prototype'][_0xa365('0x4a')]=function(){var _0x2ba13b=this;return function(_0xd497c6){if(_0xd497c6){freeIsNotKey(_0xd497c6,_0x2ba13b[_0xa365('0x1e')],'id');for(var _0x65f15c=0x0,_0x332bb6={},_0x236bcb={};_0x65f15c<_0xd497c6[_0xa365('0x40')];_0x65f15c+=0x1){_0x332bb6=_0xd497c6[_0x65f15c];if(_['isUndefined'](_0x2ba13b[_0xa365('0x1e')][_0x332bb6['id']])){_0x2ba13b[_0xa365('0x1e')][_0x332bb6['id']]=new FreshdeskAccount(_0x332bb6);}else{_0x2ba13b[_0xa365('0x3e')](_0x2ba13b[_0xa365('0x1e')][_0x332bb6['id']],_0x332bb6);}}}return _0x2ba13b[_0xa365('0x1e')];};};Realtime[_0xa365('0x3d')][_0xa365('0x4b')]=function(){var _0x30b229=this;return function(_0x355dd4){if(_0x355dd4){freeIsNotKey(_0x355dd4,_0x30b229[_0xa365('0x4c')],'id');for(var _0x3966e7=0x0,_0x32ccd7={},_0x101a3b={};_0x3966e7<_0x355dd4['length'];_0x3966e7+=0x1){_0x32ccd7=_0x355dd4[_0x3966e7];if(_['isUndefined'](_0x30b229[_0xa365('0x4c')][_0x32ccd7['id']])){_0x30b229[_0xa365('0x4c')][_0x32ccd7['id']]=new ZohoAccount(_0x32ccd7);}else{_0x30b229[_0xa365('0x3e')](_0x30b229['zohoAccounts'][_0x32ccd7['id']],_0x32ccd7);}}}return _0x30b229[_0xa365('0x4c')];};};Realtime[_0xa365('0x3d')][_0xa365('0x4d')]=function(){var _0x4c0772=this;return function(_0x584dc5){if(_0x584dc5){freeIsNotKey(_0x584dc5,_0x4c0772[_0xa365('0x4e')],'id');for(var _0x2de318=0x0,_0x22f6ac={},_0x4bfeef={};_0x2de318<_0x584dc5['length'];_0x2de318+=0x1){_0x22f6ac=_0x584dc5[_0x2de318];if(_[_0xa365('0x41')](_0x4c0772[_0xa365('0x4e')][_0x22f6ac['id']])){_0x4c0772[_0xa365('0x4e')][_0x22f6ac['id']]=new DeskAccount(_0x22f6ac);}else{_0x4c0772[_0xa365('0x3e')](_0x4c0772[_0xa365('0x4e')][_0x22f6ac['id']],_0x22f6ac);}}}return _0x4c0772[_0xa365('0x4e')];};};Realtime[_0xa365('0x3d')][_0xa365('0x4f')]=function(){var _0x5a332d=this;return function(_0x27c380){if(_0x27c380){freeIsNotKey(_0x27c380,_0x5a332d[_0xa365('0x1d')],'id');for(var _0x3a081b=0x0,_0x3da6f3={},_0xb75fb5={};_0x3a081b<_0x27c380[_0xa365('0x40')];_0x3a081b+=0x1){_0x3da6f3=_0x27c380[_0x3a081b];if(_[_0xa365('0x41')](_0x5a332d[_0xa365('0x1d')][_0x3da6f3['id']])){_0x5a332d[_0xa365('0x1d')][_0x3da6f3['id']]=new SugarcrmAccount(_0x3da6f3);}else{_0x5a332d['mergeFromDatabase'](_0x5a332d[_0xa365('0x1d')][_0x3da6f3['id']],_0x3da6f3);}}}return _0x5a332d['sugarcrmAccounts'];};};Realtime[_0xa365('0x3d')][_0xa365('0x50')]=function(){var _0x55a23f=this;return function(_0x56cc72){if(_0x56cc72){freeIsNotKey(_0x56cc72,_0x55a23f[_0xa365('0x51')],'id');for(var _0x33e72b=0x0,_0x300988={},_0x1080b6={};_0x33e72b<_0x56cc72[_0xa365('0x40')];_0x33e72b+=0x1){_0x300988=_0x56cc72[_0x33e72b];if(_[_0xa365('0x41')](_0x55a23f[_0xa365('0x51')][_0x300988['id']])){_0x55a23f['vtigerAccounts'][_0x300988['id']]=new VtigerAccount(_0x300988);}else{_0x55a23f[_0xa365('0x3e')](_0x55a23f[_0xa365('0x51')][_0x300988['id']],_0x300988);}}}return _0x55a23f['vtigerAccounts'];};};Realtime[_0xa365('0x3d')][_0xa365('0x52')]=function(){var _0x24acde=this;return function(_0x476436){if(_0x476436){freeIsNotKey(_0x476436,_0x24acde[_0xa365('0x1f')],'id');for(var _0x5d7470=0x0,_0x1eb581={},_0x5ce95a={};_0x5d7470<_0x476436['length'];_0x5d7470+=0x1){_0x1eb581=_0x476436[_0x5d7470];if(_[_0xa365('0x41')](_0x24acde[_0xa365('0x1f')][_0x1eb581['id']])){_0x24acde[_0xa365('0x1f')][_0x1eb581['id']]=new ServicenowAccount(_0x1eb581);}else{_0x24acde[_0xa365('0x3e')](_0x24acde[_0xa365('0x1f')][_0x1eb581['id']],_0x1eb581);}}}return _0x24acde['servicenowAccounts'];};};Realtime[_0xa365('0x3d')]['initDynamics365Accounts']=function(){var _0x3e59e0=this;return function(_0x368ef3){if(_0x368ef3){freeIsNotKey(_0x368ef3,_0x3e59e0[_0xa365('0x53')],'id');for(var _0x4123b6=0x0,_0x5021a4={},_0x540573={};_0x4123b6<_0x368ef3['length'];_0x4123b6+=0x1){_0x5021a4=_0x368ef3[_0x4123b6];if(_[_0xa365('0x41')](_0x3e59e0['dynamics365Accounts'][_0x5021a4['id']])){_0x3e59e0[_0xa365('0x53')][_0x5021a4['id']]=new Dynamics365Account(_0x5021a4);}else{_0x3e59e0[_0xa365('0x3e')](_0x3e59e0['dynamics365Accounts'][_0x5021a4['id']],_0x5021a4);}}}return _0x3e59e0[_0xa365('0x53')];};};Realtime['prototype'][_0xa365('0x54')]=function(){var _0x5d07ca=this;return function(_0x5f31f9){if(_0x5f31f9){freeIsNotKey(_0x5f31f9,_0x5d07ca[_0xa365('0x20')],'id');for(var _0x1c1d1c=0x0,_0x3336db={},_0x5098b2={};_0x1c1d1c<_0x5f31f9[_0xa365('0x40')];_0x1c1d1c+=0x1){_0x3336db=_0x5f31f9[_0x1c1d1c];if(_[_0xa365('0x41')](_0x5d07ca[_0xa365('0x20')][_0x3336db['id']])){_0x5d07ca['freshsalesAccounts'][_0x3336db['id']]=new FreshsalesAccount(_0x3336db);}else{_0x5d07ca['mergeFromDatabase'](_0x5d07ca[_0xa365('0x20')][_0x3336db['id']],_0x3336db);}}}return _0x5d07ca[_0xa365('0x20')];};};Realtime[_0xa365('0x3d')][_0xa365('0x55')]=function(){var _0x2f6327=this;return function(_0x2e306c){for(var _0x156c8a=0x0;_0x156c8a<_0x2e306c[_0xa365('0x40')];_0x156c8a+=0x1){_['merge'](_0x2f6327['voiceQueues'][_0x2e306c[_0x156c8a][_0xa365('0x25')]],_0x2e306c[_0x156c8a]);}return _0x2f6327[_0xa365('0x12')];};};Realtime[_0xa365('0x3d')]['initVoiceQueueReports']=function(){var _0x11afab=this;return function(_0x457009){clearVoiceQueues(_0x11afab[_0xa365('0x12')]);if(_0x457009){_0x457009=_['groupBy'](_0x457009,_0xa365('0x56'));for(var _0xde3b6c in _0x457009){if(_0x457009[_0xa365('0x22')](_0xde3b6c)){var _0x4931ce={};for(var _0x555386=0x0;_0x555386<_0x457009[_0xde3b6c][_0xa365('0x40')];_0x555386+=0x1){var _0x7cc5a4=_0x457009[_0xde3b6c][_0x555386][_0xa365('0x57')];if(_0x11afab['voiceQueues'][_0x7cc5a4]){if(_0x457009[_0xde3b6c][_0x555386][_0xa365('0x58')]){_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x59')]+=0x1;}if(_0x457009[_0xde3b6c][_0x555386]['queuecallerabandon']){_0x11afab['voiceQueues'][_0x7cc5a4][_0xa365('0x30')]+=0x1;}_0x11afab['voiceQueues'][_0x7cc5a4][_0xa365('0x2a')]+=moment(_0x457009[_0xde3b6c][_0x555386]['queuecallerleaveAt'])[_0xa365('0x5a')](moment(_0x457009[_0xde3b6c][_0x555386]['queuecallerjoinAt']),_0xa365('0x5b'))||0x0;if(_0x555386===_0x457009[_0xde3b6c][_0xa365('0x40')]-0x1){_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2b')]+=moment(_0x457009[_0xde3b6c][_0x555386]['queuecallercompleteAt']||_0x457009[_0xde3b6c][_0x555386]['queuecallerabandonAt']||_0x457009[_0xde3b6c][_0x555386][_0xa365('0x5c')])[_0xa365('0x5a')](moment(_0x457009[_0xde3b6c][_0x555386]['queuecallerjoinAt']),'seconds')||0x0;_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2f')]+=0x1;if(_0x457009[_0xde3b6c][_0x555386][_0xa365('0x5d')]){_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x29')]+=0x1;_0x11afab['voiceQueues'][_0x7cc5a4][_0xa365('0x5e')]+=moment(_0x457009[_0xde3b6c][_0x555386]['queuecallercompleteAt'])[_0xa365('0x5a')](moment(_0x457009[_0xde3b6c][_0x555386][_0xa365('0x5f')]),'seconds')||0x0;}}else{_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2b')]+=_0x11afab[_0xa365('0x12')][_0x7cc5a4][_0xa365('0x2a')]||0x0;}}}}}}return _0x11afab[_0xa365('0x12')];};};Realtime[_0xa365('0x3d')][_0xa365('0x60')]=function(){var _0x1992fc=this;return function(_0x3cd4b3){clearVoiceCallReports(_0x1992fc[_0xa365('0x61')]);if(_0x3cd4b3){for(var _0x35de49=0x0;_0x35de49<_0x3cd4b3[_0xa365('0x40')];_0x35de49+=0x1){_0x1992fc[_0xa365('0x61')]['total']+=0x1;_0x1992fc['outbound'][_0xa365('0x2b')]+=_0x3cd4b3[_0x35de49][_0xa365('0x62')];if(_0x3cd4b3[_0x35de49]['disposition']===_0xa365('0x63')){_0x1992fc['outbound'][_0xa365('0x29')]+=0x1;_0x1992fc[_0xa365('0x61')][_0xa365('0x2a')]+=_0x3cd4b3[_0x35de49]['duration']-_0x3cd4b3[_0x35de49]['billableseconds']||0x0;_0x1992fc[_0xa365('0x61')][_0xa365('0x5e')]+=_0x3cd4b3[_0x35de49][_0xa365('0x64')];}}}return _0x1992fc[_0xa365('0x61')];};};Realtime['prototype'][_0xa365('0x65')]=function(){var _0x34048a=this;return function(_0x311dc5){if(_0x311dc5){freeIsNotKey(_0x311dc5,_0x34048a[_0xa365('0x14')],'name');for(var _0x46d48d=0x0,_0x25b9fc={};_0x46d48d<_0x311dc5[_0xa365('0x40')];_0x46d48d+=0x1){_0x25b9fc=_0x311dc5[_0x46d48d];if(_[_0xa365('0x41')](_0x34048a[_0xa365('0x14')][_0x25b9fc[_0xa365('0x25')]])){_0x34048a[_0xa365('0x14')][_0x25b9fc[_0xa365('0x25')]]=new Campaign(_0x25b9fc);}else{_0x34048a[_0xa365('0x3e')](_0x34048a[_0xa365('0x14')][_0x25b9fc['name']],_0x25b9fc);_0x34048a[_0xa365('0x14')][_0x25b9fc[_0xa365('0x25')]][_0xa365('0x66')]=_0x25b9fc['SquareProject']?_0x25b9fc[_0xa365('0x67')][_0xa365('0x25')]:undefined;}}}return _0x34048a[_0xa365('0x14')];};};Realtime[_0xa365('0x3d')][_0xa365('0x68')]=function(){var _0x1071cd=this;return function(_0x517ffd){if(_0x517ffd){freeIsNotKey(_0x517ffd,_0x1071cd[_0xa365('0x16')],'id');for(var _0x467297=0x0,_0xc1fe0={};_0x467297<_0x517ffd[_0xa365('0x40')];_0x467297+=0x1){_0xc1fe0=_0x517ffd[_0x467297];if(_['isUndefined'](_0x1071cd[_0xa365('0x16')][_0xc1fe0['id']])){_0x1071cd[_0xa365('0x16')][_0xc1fe0['id']]=new VoiceExtension(_0xc1fe0);}else{_0x1071cd[_0xa365('0x3e')](_0x1071cd[_0xa365('0x16')][_0xc1fe0['id']],_0xc1fe0);}}}return _0x1071cd['voiceExtensions'];};};Realtime[_0xa365('0x3d')][_0xa365('0x69')]=function(){var _0x5b98ee=this;return function(_0x599980){clearCampaigns(_0x5b98ee[_0xa365('0x14')]);for(var _0x28155d=0x0;_0x28155d<_0x599980[_0xa365('0x40')];_0x28155d+=0x1){_['merge'](_0x5b98ee['campaigns'][_0x599980[_0x28155d][_0xa365('0x25')]],_0x599980[_0x28155d]);}return _0x5b98ee['campaigns'];};};Realtime[_0xa365('0x3d')]['initFaxAccounts']=function(){var _0xbd2d19=this;return function(_0x2a45b2){if(_0x2a45b2){freeIsNotKey(_0x2a45b2,_0xbd2d19['faxAccounts'],'id');for(var _0x59866c=0x0,_0x36d367={},_0x651421={};_0x59866c<_0x2a45b2[_0xa365('0x40')];_0x59866c+=0x1){_0x36d367=_0x2a45b2[_0x59866c];if(_[_0xa365('0x41')](_0xbd2d19[_0xa365('0x21')][_0x36d367['id']])){_0xbd2d19[_0xa365('0x21')][_0x36d367['id']]=new FaxAccount(_0x36d367);}else{_0xbd2d19[_0xa365('0x3e')](_0xbd2d19[_0xa365('0x21')][_0x36d367['id']],_0x36d367);}}}return _0xbd2d19[_0xa365('0x21')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8a19aae..68f2590 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 _0xdee3=['SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','exten','type','lastdata','from-voip-provider','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','channel','Local','substring','indexOf','lastIndexOf','membername','exports','bluebird','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','length','connectedlinenum','assigned'];(function(_0x1c0153,_0x45562f){var _0x3fffe5=function(_0x13155a){while(--_0x13155a){_0x1c0153['push'](_0x1c0153['shift']());}};_0x3fffe5(++_0x45562f);}(_0xdee3,0x1b0));var _0x3dee=function(_0x34bbd9,_0x4850d7){_0x34bbd9=_0x34bbd9-0x0;var _0x474191=_0xdee3[_0x34bbd9];return _0x474191;};'use strict';var BPromise=require(_0x3dee('0x0'));var _=require('lodash');var moment=require(_0x3dee('0x1'));var util=require(_0x3dee('0x2'));var config=require(_0x3dee('0x3'));var logger=require(_0x3dee('0x4'))(_0x3dee('0x5'));var ami=require(_0x3dee('0x6'));var RpcVoiceAgentReport=require(_0x3dee('0x7'));var RpcVoiceCallReport=require(_0x3dee('0x8'));var RpcVoiceDialReport=require(_0x3dee('0x9'));var RpcMemberReport=require(_0x3dee('0xa'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3dee('0xb'));var VoiceQueueReport=require(_0x3dee('0xc'));var VoiceCallReport=require(_0x3dee('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xe5e7d2){this[_0x3dee('0xe')]=_0xe5e7d2;this[_0x3dee('0xf')]=_0xe5e7d2[_0x3dee('0xf')];this['telephones']=_0xe5e7d2[_0x3dee('0x10')];}Report[_0x3dee('0x11')][_0x3dee('0x12')]=function(_0x104da7){var _0x16a1fc=new VoiceQueueReport(this[_0x3dee('0xe')]);var _0x116695=new VoiceAgentReport(this[_0x3dee('0xe')]);var _0x4ab697=new VoiceDialReport(this[_0x3dee('0xe')]);var _0x65affe=new VoiceCallReport(this[_0x3dee('0xe')]);var _0x11ee35=new UserReport(this['realtime']);if(config[_0x3dee('0x13')]&&config[_0x3dee('0x13')][_0x3dee('0x14')]){ami['on'](_0x3dee('0x15'),this[_0x3dee('0x16')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x3dee('0x17')][_0x3dee('0x18')](this));ami['on'](_0x3dee('0x19'),this[_0x3dee('0x1a')][_0x3dee('0x18')](this));ami['on']('custom:voiceDialReport',this[_0x3dee('0x1b')][_0x3dee('0x18')](this));ami['on'](_0x3dee('0x1c'),this[_0x3dee('0x1d')][_0x3dee('0x18')](this));ami['on'](_0x3dee('0x1e'),this[_0x3dee('0x1f')][_0x3dee('0x18')](this));}};Report[_0x3dee('0x11')][_0x3dee('0x20')]=function(_0x1c37b3){var _0x344dc6=undefined;_0x344dc6=_['find'](this['agents'],function(_0x54a4b5){return _0x54a4b5[_0x3dee('0x21')]==_0x1c37b3||_0x54a4b5[_0x3dee('0x22')]==_0x1c37b3;});if(_[_0x3dee('0x23')](_0x344dc6)){var _0x1ef812=_[_0x3dee('0x24')](this[_0x3dee('0x10')],function(_0x22571c){return _0x22571c[_0x3dee('0x21')]==_0x1c37b3||_0x22571c[_0x3dee('0x22')]==_0x1c37b3;});if(_0x1ef812){_0x344dc6=_[_0x3dee('0x24')](this[_0x3dee('0xf')],function(_0x40eaa6){return _0x40eaa6[_0x3dee('0x25')]==util[_0x3dee('0x26')]('SIP/%s',_0x1ef812['name']);});}}return _0x344dc6;};Report[_0x3dee('0x11')]['voiceQueueReport']=function(_0x54ca5e){for(var _0x1a1db0=0x0;_0x1a1db0<_0x54ca5e[_0x3dee('0x27')];_0x1a1db0+=0x1){var _0x3e7728=this['findAgent'](_0x54ca5e[_0x1a1db0][_0x3dee('0x28')]);if(_0x3e7728){_0x54ca5e[_0x1a1db0][_0x3dee('0x21')]=_0x3e7728['accountcode'];_0x54ca5e[_0x1a1db0][_0x3dee('0x29')]=!![];_0x54ca5e[_0x1a1db0]['lastAssignedTo']=_0x3e7728[_0x3dee('0x22')];_0x54ca5e[_0x1a1db0][_0x3dee('0x25')]=_[_0x3dee('0x23')](_0x3e7728[_0x3dee('0x25')])?util[_0x3dee('0x26')](_0x3dee('0x2a'),_0x3e7728['name']):_0x3e7728[_0x3dee('0x25')];if(_0x54ca5e[_0x1a1db0][_0x3dee('0x2b')]){_0x54ca5e[_0x1a1db0]['queuecallercompleteAt']=moment()['format'](_0x3dee('0x2c'));}if(_0x54ca5e[_0x1a1db0][_0x3dee('0x2d')]){_0x54ca5e[_0x1a1db0][_0x3dee('0x2e')]=moment()[_0x3dee('0x26')](_0x3dee('0x2c'));}RpcMemberReport[_0x3dee('0x16')](_0x54ca5e[_0x1a1db0]);}RpcVoiceQueueReport[_0x3dee('0x2f')](_0x54ca5e[_0x1a1db0]);}};function extractCalleridNumber(_0x3d2609){var _0x5e639a=_0x3d2609[_0x3dee('0x30')](/<(.*?)>/);return _0x5e639a?_0x5e639a[0x1]:_0x3d2609;}Report[_0x3dee('0x11')]['voiceCallReport']=function(_0x18f73d){_0x18f73d['destination']=_0x18f73d['destination']||_0x18f73d[_0x3dee('0x31')];if(_0x18f73d[_0x3dee('0x32')]=='dialer'){_0x18f73d['lastapplication']='queue';_0x18f73d[_0x3dee('0x33')]=_0x18f73d['queue'];if(_0x18f73d['context']==_0x3dee('0x34')){_0x18f73d['accountcode']='';_0x18f73d[_0x3dee('0x35')]=extractCalleridNumber(_0x18f73d[_0x3dee('0x36')]);}else if(_0x18f73d['context']==_0x3dee('0x37')){if(_0x18f73d[_0x3dee('0x35')]==_0x3dee('0x38')){_0x18f73d[_0x3dee('0x35')]=extractCalleridNumber(_0x18f73d[_0x3dee('0x39')]);_0x18f73d[_0x3dee('0x3a')]=_0x18f73d[_0x3dee('0x3b')];_0x18f73d['destinationchannel']=[_0x18f73d['channel'],_0x18f73d['channel']=_0x18f73d['destinationchannel']][0x0];_0x18f73d['callerid']=_0x18f73d[_0x3dee('0x39')];}else{_0x18f73d[_0x3dee('0x35')]=_0x18f73d['calleridnum'];_0x18f73d[_0x3dee('0x3a')]=_0x18f73d[_0x3dee('0x3b')];if(_0x18f73d[_0x3dee('0x3c')]=='ANSWERED'){_0x18f73d[_0x3dee('0x21')]=_0x18f73d['connectedlinenum'];}else{_0x18f73d['accountcode']='';}}}}else{_0x18f73d[_0x3dee('0x36')]=util['format'](_0x3dee('0x3d'),_0x18f73d[_0x3dee('0x3e')],_0x18f73d[_0x3dee('0x3a')]);}RpcVoiceCallReport[_0x3dee('0x2f')](_0x18f73d);if(_0x18f73d[_0x3dee('0x3f')]){for(var _0x5a67f7=0x0;_0x5a67f7<_0x18f73d[_0x3dee('0x40')][_0x3dee('0x27')];_0x5a67f7+=0x1){_0x18f73d[_0x3dee('0x41')]=_0x18f73d[_0x3dee('0x40')][_0x5a67f7][_0x3dee('0x42')];_0x18f73d[_0x3dee('0x43')]=_0x18f73d['monitors'][_0x5a67f7]['createdAt'];if(_0x18f73d['exten']==_0x3dee('0x38')){_0x18f73d[_0x3dee('0x3a')]=_0x18f73d[_0x3dee('0x28')];_0x18f73d[_0x3dee('0x3e')]=_0x18f73d[_0x3dee('0x44')];_0x18f73d[_0x3dee('0x28')]=_0x18f73d[_0x3dee('0x21')];_0x18f73d[_0x3dee('0x44')]=_0x18f73d['membername'];_0x18f73d[_0x3dee('0x31')]=_0x18f73d[_0x3dee('0x3b')];}else if(_0x18f73d[_0x3dee('0x31')]==_0x3dee('0x45')){_0x18f73d['calleridnum']=_0x18f73d[_0x3dee('0x35')];_0x18f73d[_0x3dee('0x31')]=_0x18f73d[_0x3dee('0x3b')];}RpcVoiceRecording[_0x3dee('0x2f')](_0x18f73d);}}};Report[_0x3dee('0x11')]['voiceAgentReport']=function(_0x442d04){if(_[_0x3dee('0x46')](_0x442d04)){_0x442d04[_0x3dee('0x47')](function(_0x319ade){RpcVoiceAgentReport['create'](_0x319ade);});}else{RpcVoiceAgentReport[_0x3dee('0x2f')](_0x442d04);}};Report['prototype']['voiceDialReport']=function(_0x3021da){RpcVoiceDialReport[_0x3dee('0x2f')](_0x3021da);var _0x513459=undefined;var _0x56b25f=_0x3021da[_0x3dee('0x48')];if(_['startsWith'](_0x56b25f,_0x3dee('0x49'))){var _0x18be3=_0x56b25f[_0x3dee('0x4a')](_0x56b25f['indexOf']('/')+0x1,_0x56b25f['indexOf']('@'));_0x513459=_['find'](this[_0x3dee('0xf')],function(_0x2c4d32){return _0x2c4d32['mobile']==_0x18be3||_0x2c4d32['phone']==_0x18be3||_0x2c4d32[_0x3dee('0x21')]==_0x18be3;});}else{var _0x18be3=_0x56b25f[_0x3dee('0x4a')](_0x56b25f[_0x3dee('0x4b')]('/')+0x1,_0x56b25f[_0x3dee('0x4c')]('-'));_0x513459=this[_0x3dee('0x20')](_0x18be3);}if(_0x513459){_0x3021da['interface']=_[_0x3dee('0x23')](_0x513459[_0x3dee('0x25')])?util[_0x3dee('0x26')](_0x3dee('0x2a'),_0x513459[_0x3dee('0x22')]):_0x513459[_0x3dee('0x25')];_0x3021da[_0x3dee('0x4d')]=_0x513459[_0x3dee('0x22')];_0x3021da[_0x3dee('0x21')]=_0x513459['accountcode'];RpcMemberReport[_0x3dee('0x1b')](_0x3021da);}};Report[_0x3dee('0x11')]['blindTransfer']=function(_0x1c0601){RpcVoiceTransferReport[_0x3dee('0x1d')](_0x1c0601);};Report[_0x3dee('0x11')][_0x3dee('0x1f')]=function(_0x2ff2f3){RpcVoiceTransferReport[_0x3dee('0x1f')](_0x2ff2f3);};module[_0x3dee('0x4e')]=Report; \ No newline at end of file +var _0x05c6=['custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','format','SIP/%s','length','assigned','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','connectedlinenum','calleridname','monitor','monitors','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','startsWith','Local','substring','indexOf','mobile','phone','findAgent','exports','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport'];(function(_0x698afe,_0x3841f9){var _0x49865f=function(_0xe2d368){while(--_0xe2d368){_0x698afe['push'](_0x698afe['shift']());}};_0x49865f(++_0x3841f9);}(_0x05c6,0x1c2));var _0x605c=function(_0x13e22c,_0x4786fc){_0x13e22c=_0x13e22c-0x0;var _0x20b332=_0x05c6[_0x13e22c];return _0x20b332;};'use strict';var BPromise=require(_0x605c('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0x605c('0x1'));var config=require(_0x605c('0x2'));var logger=require(_0x605c('0x3'))(_0x605c('0x4'));var ami=require(_0x605c('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x605c('0x6'));var RpcVoiceDialReport=require(_0x605c('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x605c('0x8'));var RpcVoiceRecording=require(_0x605c('0x9'));var RpcVoiceTransferReport=require(_0x605c('0xa'));var VoiceQueueReport=require(_0x605c('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x605c('0xc'));var VoiceDialReport=require(_0x605c('0xd'));var UserReport=require('./userReport');function Report(_0x19d137){this[_0x605c('0xe')]=_0x19d137;this[_0x605c('0xf')]=_0x19d137['agents'];this[_0x605c('0x10')]=_0x19d137['telephones'];}Report[_0x605c('0x11')]['sync']=function(_0x31ba8d){var _0x19fbdb=new VoiceQueueReport(this[_0x605c('0xe')]);var _0x34ca15=new VoiceAgentReport(this[_0x605c('0xe')]);var _0x3055ff=new VoiceDialReport(this[_0x605c('0xe')]);var _0x7e9d85=new VoiceCallReport(this[_0x605c('0xe')]);var _0x5a66ca=new UserReport(this[_0x605c('0xe')]);if(config[_0x605c('0x12')]&&config[_0x605c('0x12')][_0x605c('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x605c('0x14')][_0x605c('0x15')](this));ami['on'](_0x605c('0x16'),this[_0x605c('0x17')][_0x605c('0x15')](this));ami['on'](_0x605c('0x18'),this['voiceAgentReport'][_0x605c('0x15')](this));ami['on'](_0x605c('0x19'),this[_0x605c('0x1a')][_0x605c('0x15')](this));ami['on'](_0x605c('0x1b'),this[_0x605c('0x1c')][_0x605c('0x15')](this));ami['on'](_0x605c('0x1d'),this[_0x605c('0x1e')][_0x605c('0x15')](this));}};Report[_0x605c('0x11')]['findAgent']=function(_0x5c86a4){var _0x4b28ee=undefined;_0x4b28ee=_[_0x605c('0x1f')](this[_0x605c('0xf')],function(_0x574417){return _0x574417[_0x605c('0x20')]==_0x5c86a4||_0x574417[_0x605c('0x21')]==_0x5c86a4;});if(_[_0x605c('0x22')](_0x4b28ee)){var _0x5c94a3=_[_0x605c('0x1f')](this['telephones'],function(_0x2c3170){return _0x2c3170[_0x605c('0x20')]==_0x5c86a4||_0x2c3170[_0x605c('0x21')]==_0x5c86a4;});if(_0x5c94a3){_0x4b28ee=_['find'](this[_0x605c('0xf')],function(_0x251522){return _0x251522['interface']==util[_0x605c('0x23')](_0x605c('0x24'),_0x5c94a3[_0x605c('0x21')]);});}}return _0x4b28ee;};Report[_0x605c('0x11')][_0x605c('0x14')]=function(_0x363343){for(var _0x22e988=0x0;_0x22e988<_0x363343[_0x605c('0x25')];_0x22e988+=0x1){var _0xe03d6b=this['findAgent'](_0x363343[_0x22e988]['connectedlinenum']);if(_0xe03d6b){_0x363343[_0x22e988][_0x605c('0x20')]=_0xe03d6b['accountcode'];_0x363343[_0x22e988][_0x605c('0x26')]=!![];_0x363343[_0x22e988]['lastAssignedTo']=_0xe03d6b[_0x605c('0x21')];_0x363343[_0x22e988]['interface']=_[_0x605c('0x22')](_0xe03d6b[_0x605c('0x27')])?util[_0x605c('0x23')](_0x605c('0x24'),_0xe03d6b[_0x605c('0x21')]):_0xe03d6b[_0x605c('0x27')];if(_0x363343[_0x22e988][_0x605c('0x28')]){_0x363343[_0x22e988][_0x605c('0x29')]=moment()[_0x605c('0x23')](_0x605c('0x2a'));}if(_0x363343[_0x22e988][_0x605c('0x2b')]){_0x363343[_0x22e988]['queuecallerexitAt']=moment()[_0x605c('0x23')](_0x605c('0x2a'));}RpcMemberReport[_0x605c('0x14')](_0x363343[_0x22e988]);}RpcVoiceQueueReport[_0x605c('0x2c')](_0x363343[_0x22e988]);}};function extractCalleridNumber(_0x1dd179){var _0x168c51=_0x1dd179[_0x605c('0x2d')](/<(.*?)>/);return _0x168c51?_0x168c51[0x1]:_0x1dd179;}Report[_0x605c('0x11')][_0x605c('0x17')]=function(_0x4175ee){_0x4175ee[_0x605c('0x2e')]=_0x4175ee[_0x605c('0x2e')]||_0x4175ee['exten'];if(_0x4175ee['type']=='dialer'){_0x4175ee['lastapplication']=_0x605c('0x2f');_0x4175ee[_0x605c('0x30')]=_0x4175ee[_0x605c('0x2f')];if(_0x4175ee[_0x605c('0x31')]==_0x605c('0x32')){_0x4175ee[_0x605c('0x20')]='';_0x4175ee[_0x605c('0x2e')]=extractCalleridNumber(_0x4175ee[_0x605c('0x33')]);}else if(_0x4175ee[_0x605c('0x31')]==_0x605c('0x34')){if(_0x4175ee['destination']==_0x605c('0x35')){_0x4175ee[_0x605c('0x2e')]=extractCalleridNumber(_0x4175ee[_0x605c('0x36')]);_0x4175ee[_0x605c('0x37')]=_0x4175ee[_0x605c('0x38')];_0x4175ee[_0x605c('0x39')]=[_0x4175ee['channel'],_0x4175ee[_0x605c('0x3a')]=_0x4175ee[_0x605c('0x39')]][0x0];_0x4175ee[_0x605c('0x33')]=_0x4175ee[_0x605c('0x36')];}else{_0x4175ee[_0x605c('0x2e')]=_0x4175ee['calleridnum'];_0x4175ee[_0x605c('0x37')]=_0x4175ee[_0x605c('0x38')];if(_0x4175ee['disposition']==_0x605c('0x3b')){_0x4175ee[_0x605c('0x20')]=_0x4175ee[_0x605c('0x3c')];}else{_0x4175ee['accountcode']='';}}}}else{_0x4175ee['callerid']=util[_0x605c('0x23')]('\x22%s\x22\x20<%s>',_0x4175ee[_0x605c('0x3d')],_0x4175ee['calleridnum']);}RpcVoiceCallReport[_0x605c('0x2c')](_0x4175ee);if(_0x4175ee[_0x605c('0x3e')]){for(var _0x45f84c=0x0;_0x45f84c<_0x4175ee['monitors']['length'];_0x45f84c+=0x1){_0x4175ee['monitorFilename']=_0x4175ee[_0x605c('0x3f')][_0x45f84c]['filename'];_0x4175ee[_0x605c('0x40')]=_0x4175ee[_0x605c('0x3f')][_0x45f84c]['createdAt'];if(_0x4175ee[_0x605c('0x41')]==_0x605c('0x35')){_0x4175ee[_0x605c('0x37')]=_0x4175ee[_0x605c('0x3c')];_0x4175ee['calleridname']=_0x4175ee[_0x605c('0x42')];_0x4175ee[_0x605c('0x3c')]=_0x4175ee[_0x605c('0x20')];_0x4175ee[_0x605c('0x42')]=_0x4175ee[_0x605c('0x43')];_0x4175ee[_0x605c('0x41')]=_0x4175ee['originatecalleridnum'];}else if(_0x4175ee['exten']==_0x605c('0x44')){_0x4175ee['calleridnum']=_0x4175ee[_0x605c('0x2e')];_0x4175ee[_0x605c('0x41')]=_0x4175ee[_0x605c('0x38')];}RpcVoiceRecording[_0x605c('0x2c')](_0x4175ee);}}};Report[_0x605c('0x11')][_0x605c('0x45')]=function(_0x4d43a8){if(_['isArray'](_0x4d43a8)){_0x4d43a8[_0x605c('0x46')](function(_0x4550ac){RpcVoiceAgentReport[_0x605c('0x2c')](_0x4550ac);});}else{RpcVoiceAgentReport[_0x605c('0x2c')](_0x4d43a8);}};Report[_0x605c('0x11')][_0x605c('0x1a')]=function(_0x4af057){RpcVoiceDialReport[_0x605c('0x2c')](_0x4af057);var _0x454a63=undefined;var _0xd0b86a=_0x4af057[_0x605c('0x3a')];if(_[_0x605c('0x47')](_0xd0b86a,_0x605c('0x48'))){var _0x8f403c=_0xd0b86a[_0x605c('0x49')](_0xd0b86a[_0x605c('0x4a')]('/')+0x1,_0xd0b86a[_0x605c('0x4a')]('@'));_0x454a63=_[_0x605c('0x1f')](this[_0x605c('0xf')],function(_0x53dd21){return _0x53dd21[_0x605c('0x4b')]==_0x8f403c||_0x53dd21[_0x605c('0x4c')]==_0x8f403c||_0x53dd21['accountcode']==_0x8f403c;});}else{var _0x8f403c=_0xd0b86a[_0x605c('0x49')](_0xd0b86a[_0x605c('0x4a')]('/')+0x1,_0xd0b86a['lastIndexOf']('-'));_0x454a63=this[_0x605c('0x4d')](_0x8f403c);}if(_0x454a63){_0x4af057[_0x605c('0x27')]=_[_0x605c('0x22')](_0x454a63['interface'])?util[_0x605c('0x23')]('SIP/%s',_0x454a63[_0x605c('0x21')]):_0x454a63[_0x605c('0x27')];_0x4af057['membername']=_0x454a63[_0x605c('0x21')];_0x4af057[_0x605c('0x20')]=_0x454a63[_0x605c('0x20')];RpcMemberReport[_0x605c('0x1a')](_0x4af057);}};Report[_0x605c('0x11')]['blindTransfer']=function(_0x134654){RpcVoiceTransferReport[_0x605c('0x1c')](_0x134654);};Report[_0x605c('0x11')][_0x605c('0x1e')]=function(_0x16cbed){RpcVoiceTransferReport[_0x605c('0x1e')](_0x16cbed);};module[_0x605c('0x4e')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 432c0bd..2d6d753 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 _0xe0da=['name','trunk:save','[syncRegistry][UserReport]','device','toLowerCase','inuse','local','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','startsWith','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','registered','peer','address','status','[syncPeerStatus][UserReport]','exports','lodash','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[loopSyncRealTimeShow]','error','inspect','prototype','loopSyncRealTimeShow','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','omit','actionid','format','trunk:%s'];(function(_0x569729,_0x271db2){var _0x490d8d=function(_0x57a02b){while(--_0x57a02b){_0x569729['push'](_0x569729['shift']());}};_0x490d8d(++_0x271db2);}(_0xe0da,0xe4));var _0xae0d=function(_0x1fe495,_0xcf2f5f){_0x1fe495=_0x1fe495-0x0;var _0x831a05=_0xe0da[_0x1fe495];return _0x831a05;};'use strict';var _=require(_0xae0d('0x0'));var moment=require('moment');var BPromise=require(_0xae0d('0x1'));var util=require(_0xae0d('0x2'));var Redis=require(_0xae0d('0x3'));var config=require(_0xae0d('0x4'));var logger=require(_0xae0d('0x5'))(_0xae0d('0x6'));var ami=require(_0xae0d('0x7'));config[_0xae0d('0x8')]=_[_0xae0d('0x9')](config[_0xae0d('0x8')],{'host':_0xae0d('0xa'),'port':0x18eb});var io=require(_0xae0d('0xb'))(new Redis(config[_0xae0d('0x8')]));function UserReport(_0x3d4e67){this[_0xae0d('0xc')]=_0x3d4e67['trunks'];this[_0xae0d('0xd')]=_0x3d4e67['agents'];this[_0xae0d('0xe')]=_0x3d4e67[_0xae0d('0xe')];ami['on'](_0xae0d('0xf'),this[_0xae0d('0x10')]['bind'](this));ami['on'](_0xae0d('0x11'),this[_0xae0d('0x10')][_0xae0d('0x12')](this));ami['on']('devicestatechange',this[_0xae0d('0x13')][_0xae0d('0x12')](this));ami['on'](_0xae0d('0x14'),this[_0xae0d('0x15')][_0xae0d('0x12')](this));this['loopSyncRealTimeShow']();return BPromise[_0xae0d('0x16')]()[_0xae0d('0x17')](ami[_0xae0d('0x18')]())[_0xae0d('0x17')](ami[_0xae0d('0x19')]())[_0xae0d('0x17')](ami['actionSipPeerStatus']())[_0xae0d('0x1a')](loggerCatch(_0xae0d('0x1b')));}function loggerCatch(_0x43795e){return function(_0x2c64f5){logger[_0xae0d('0x1c')](_0x43795e,util[_0xae0d('0x1d')](_0x2c64f5,{'showHidden':![],'depth':null}));};}UserReport[_0xae0d('0x1e')][_0xae0d('0x1f')]=function(){setInterval(function(){BPromise[_0xae0d('0x16')]()[_0xae0d('0x17')](ami[_0xae0d('0x18')]())[_0xae0d('0x17')](ami[_0xae0d('0x19')]())['then'](ami['actionSipPeerStatus']())[_0xae0d('0x1a')](loggerCatch(_0xae0d('0x1b')));},0x32c8);};UserReport[_0xae0d('0x1e')][_0xae0d('0x20')]=function(_0x4322f0){return _0x4322f0!==null&&!_[_0xae0d('0x21')](_0x4322f0);};UserReport['prototype'][_0xae0d('0x22')]=function(_0x4d5e13,_0x17c3ae,_0x1b64ad){io['to'](_0x4d5e13)[_0xae0d('0x22')](_0x17c3ae,_0x1b64ad);};UserReport[_0xae0d('0x1e')][_0xae0d('0x10')]=function(_0x39b979){try{if(this['isNotNull'](_0x39b979)){var _0x59dde3=_[_0xae0d('0x23')](this['trunks'],{'registry':_0x39b979[_0xae0d('0x24')]});if(_0x59dde3){_0x39b979[_0xae0d('0x25')]=_0x39b979[_0xae0d('0x26')];_[_0xae0d('0x27')](_0x59dde3,_[_0xae0d('0x28')](_0x39b979,['event',_0xae0d('0x29'),_0xae0d('0x24'),'state']));this[_0xae0d('0x22')](util[_0xae0d('0x2a')](_0xae0d('0x2b'),_0x59dde3[_0xae0d('0x2c')]),_0xae0d('0x2d'),_0x59dde3);}}}catch(_0x39051a){logger[_0xae0d('0x1c')](_0xae0d('0x2e'),util[_0xae0d('0x1d')](_0x39051a,{'showHidden':![],'depth':null}));}};UserReport[_0xae0d('0x1e')]['syncDeviceState']=function(_0x4e16c7){try{if(this[_0xae0d('0x20')](_0x4e16c7)){if(this[_0xae0d('0xd')][_0x4e16c7[_0xae0d('0x2f')]]){if(!this['agents'][_0x4e16c7['device']]['local']||_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()==_0xae0d('0x31')){this['agents'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x32')]=![];if(this[_0xae0d('0xd')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()){this[_0xae0d('0xd')][_0x4e16c7['device']]['stateTime']=_[_0xae0d('0x33')](moment()[_0xae0d('0x2a')]('x'));}this[_0xae0d('0xd')][_0x4e16c7[_0xae0d('0x2f')]]['state']=_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]();this['agents'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x34')](_0x4e16c7);}}else if(this[_0xae0d('0xe')][_0x4e16c7[_0xae0d('0x2f')]]){if(this['telephones'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()){this[_0xae0d('0xe')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x35')]=_[_0xae0d('0x33')](moment()[_0xae0d('0x2a')]('x'));}this[_0xae0d('0xe')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]=_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]();this[_0xae0d('0x22')](util['format'](_0xae0d('0x36'),this['telephones'][_0x4e16c7[_0xae0d('0x2f')]]['name']),_0xae0d('0x37'),this['telephones'][_0x4e16c7['device']]);}else if(this[_0xae0d('0xc')][_0x4e16c7['device']]){if(this['trunks'][_0x4e16c7['device']][_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]()){this[_0xae0d('0xc')][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x35')]=_[_0xae0d('0x33')](moment()[_0xae0d('0x2a')]('x'));}this['trunks'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x26')]=_0x4e16c7[_0xae0d('0x26')][_0xae0d('0x30')]();this[_0xae0d('0x22')](util['format'](_0xae0d('0x2b'),this['trunks'][_0x4e16c7[_0xae0d('0x2f')]][_0xae0d('0x2c')]),_0xae0d('0x2d'),this['trunks'][_0x4e16c7[_0xae0d('0x2f')]]);}else if(_[_0xae0d('0x38')](_0x4e16c7[_0xae0d('0x2f')],'Queue')){}else if(_[_0xae0d('0x38')](_0x4e16c7[_0xae0d('0x2f')],'Local')){var _0x2289fd=_0x4e16c7['device'];var _0x5598aa=_0x2289fd['substring'](_0x2289fd[_0xae0d('0x39')]('/')+0x1,_0x2289fd[_0xae0d('0x39')]('@'));var _0x9b28da=_[_0xae0d('0x23')](this[_0xae0d('0xd')],function(_0x1fae7a){return _0x1fae7a[_0xae0d('0x3a')]==_0x5598aa||_0x1fae7a[_0xae0d('0x3b')]==_0x5598aa||_0x1fae7a[_0xae0d('0x3c')]==_0x5598aa;});if(_0x9b28da){if(_0x9b28da[_0xae0d('0x26')]!==_0x4e16c7[_0xae0d('0x26')]['toLowerCase']()){_0x9b28da[_0xae0d('0x35')]=_[_0xae0d('0x33')](moment()['format']('x'));}_0x9b28da[_0xae0d('0x26')]=_0x4e16c7[_0xae0d('0x26')]['toLowerCase']();_0x9b28da[_0xae0d('0x32')]=!![];_0x9b28da['updateStatusRealtime'](_0x4e16c7);}}else{}}}catch(_0x9d2234){logger['error'](_0xae0d('0x3d'),util[_0xae0d('0x1d')](_0x9d2234,{'showHidden':![],'depth':null}));}};UserReport[_0xae0d('0x1e')]['syncPeerStatus']=function(_0x89986f){try{if(this['isNotNull'](_0x89986f)&&this[_0xae0d('0x20')](_0x89986f[_0xae0d('0x14')])){if(this[_0xae0d('0xd')][_0x89986f['peer']]){if(!this[_0xae0d('0xd')][_0x89986f['peer']][_0xae0d('0x32')]||_0x89986f[_0xae0d('0x14')]['toLowerCase']()==_0xae0d('0x3e')){this['agents'][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x32')]=![];this['agents'][_0x89986f[_0xae0d('0x3f')]]['status']=_0x89986f[_0xae0d('0x14')][_0xae0d('0x30')]();this['agents'][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x40')]=_0x89986f['address'];this[_0xae0d('0xd')][_0x89986f['peer']][_0xae0d('0x34')](_0x89986f);}}else if(this[_0xae0d('0xe')][_0x89986f[_0xae0d('0x3f')]]){this[_0xae0d('0xe')][_0x89986f[_0xae0d('0x3f')]]['status']=_0x89986f['peerstatus'][_0xae0d('0x30')]();this['telephones'][_0x89986f[_0xae0d('0x3f')]]['address']=_0x89986f[_0xae0d('0x40')];this[_0xae0d('0x22')](util['format'](_0xae0d('0x36'),this[_0xae0d('0xe')][_0x89986f['peer']][_0xae0d('0x2c')]),_0xae0d('0x37'),this['telephones'][_0x89986f[_0xae0d('0x3f')]]);}else if(this[_0xae0d('0xc')][_0x89986f[_0xae0d('0x3f')]]){this['trunks'][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x41')]=_0x89986f[_0xae0d('0x14')][_0xae0d('0x30')]();this[_0xae0d('0xc')][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x40')]=_0x89986f[_0xae0d('0x40')];this['emit'](util['format']('trunk:%s',this[_0xae0d('0xc')][_0x89986f[_0xae0d('0x3f')]][_0xae0d('0x2c')]),'trunk:save',this['trunks'][_0x89986f[_0xae0d('0x3f')]]);}else{}}}catch(_0x535b46){logger[_0xae0d('0x1c')](_0xae0d('0x42'),util[_0xae0d('0x1d')](_0x535b46,{'showHidden':![],'depth':null}));}};module[_0xae0d('0x43')]=UserReport; \ No newline at end of file +var _0x557b=['format','telephone:%s','startsWith','Queue','Local','substring','indexOf','mobile','phone','updateStatusRealtime','[syncDeviceState][UserReport]','peer','registered','status','address','name','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','isNotNull','isUndefined','emit','find','username','stateRegistry','merge','actionid','state','trunk:%s','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber'];(function(_0xb4947e,_0x39de27){var _0x2af6df=function(_0x308271){while(--_0x308271){_0xb4947e['push'](_0xb4947e['shift']());}};_0x2af6df(++_0x39de27);}(_0x557b,0x97));var _0xb557=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x557b[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0xb557('0x0'));var moment=require(_0xb557('0x1'));var BPromise=require(_0xb557('0x2'));var util=require(_0xb557('0x3'));var Redis=require(_0xb557('0x4'));var config=require('../../../config/environment');var logger=require(_0xb557('0x5'))(_0xb557('0x6'));var ami=require('../ami');config[_0xb557('0x7')]=_[_0xb557('0x8')](config[_0xb557('0x7')],{'host':_0xb557('0x9'),'port':0x18eb});var io=require(_0xb557('0xa'))(new Redis(config[_0xb557('0x7')]));function UserReport(_0x1b5178){this['trunks']=_0x1b5178[_0xb557('0xb')];this[_0xb557('0xc')]=_0x1b5178[_0xb557('0xc')];this[_0xb557('0xd')]=_0x1b5178[_0xb557('0xd')];ami['on']('registryentry',this[_0xb557('0xe')][_0xb557('0xf')](this));ami['on'](_0xb557('0x10'),this[_0xb557('0xe')][_0xb557('0xf')](this));ami['on'](_0xb557('0x11'),this[_0xb557('0x12')][_0xb557('0xf')](this));ami['on'](_0xb557('0x13'),this[_0xb557('0x14')][_0xb557('0xf')](this));this[_0xb557('0x15')]();return BPromise[_0xb557('0x16')]()[_0xb557('0x17')](ami[_0xb557('0x18')]())[_0xb557('0x17')](ami[_0xb557('0x19')]())[_0xb557('0x17')](ami[_0xb557('0x1a')]())[_0xb557('0x1b')](loggerCatch(_0xb557('0x1c')));}function loggerCatch(_0x50c6dc){return function(_0x2d1749){logger[_0xb557('0x1d')](_0x50c6dc,util[_0xb557('0x1e')](_0x2d1749,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xb557('0x15')]=function(){setInterval(function(){BPromise[_0xb557('0x16')]()['then'](ami[_0xb557('0x18')]())[_0xb557('0x17')](ami[_0xb557('0x19')]())[_0xb557('0x17')](ami['actionSipPeerStatus']())[_0xb557('0x1b')](loggerCatch(_0xb557('0x1c')));},0x32c8);};UserReport[_0xb557('0x1f')][_0xb557('0x20')]=function(_0x497ccd){return _0x497ccd!==null&&!_[_0xb557('0x21')](_0x497ccd);};UserReport['prototype'][_0xb557('0x22')]=function(_0x2b1ab3,_0x4c2f80,_0xa28f6d){io['to'](_0x2b1ab3)[_0xb557('0x22')](_0x4c2f80,_0xa28f6d);};UserReport[_0xb557('0x1f')]['syncRegistry']=function(_0x59958e){try{if(this[_0xb557('0x20')](_0x59958e)){var _0x67d527=_[_0xb557('0x23')](this['trunks'],{'registry':_0x59958e[_0xb557('0x24')]});if(_0x67d527){_0x59958e[_0xb557('0x25')]=_0x59958e['state'];_[_0xb557('0x26')](_0x67d527,_['omit'](_0x59958e,['event',_0xb557('0x27'),_0xb557('0x24'),_0xb557('0x28')]));this['emit'](util['format'](_0xb557('0x29'),_0x67d527['name']),_0xb557('0x2a'),_0x67d527);}}}catch(_0x5762e5){logger[_0xb557('0x1d')](_0xb557('0x2b'),util[_0xb557('0x1e')](_0x5762e5,{'showHidden':![],'depth':null}));}};UserReport[_0xb557('0x1f')][_0xb557('0x12')]=function(_0x4ec5d6){try{if(this[_0xb557('0x20')](_0x4ec5d6)){if(this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]]){if(!this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x2d')]||_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()==_0xb557('0x2f')){this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x2d')]=![];if(this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x30')]=_[_0xb557('0x31')](moment()['format']('x'));}this['agents'][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x28')]=_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]();this[_0xb557('0xc')][_0x4ec5d6[_0xb557('0x2c')]]['updateStatusRealtime'](_0x4ec5d6);}}else if(this['telephones'][_0x4ec5d6['device']]){if(this[_0xb557('0xd')][_0x4ec5d6['device']][_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){this[_0xb557('0xd')][_0x4ec5d6[_0xb557('0x2c')]]['stateTime']=_['toNumber'](moment()[_0xb557('0x32')]('x'));}this[_0xb557('0xd')][_0x4ec5d6[_0xb557('0x2c')]]['state']=_0x4ec5d6[_0xb557('0x28')]['toLowerCase']();this[_0xb557('0x22')](util[_0xb557('0x32')](_0xb557('0x33'),this['telephones'][_0x4ec5d6['device']]['name']),'telephone:save',this['telephones'][_0x4ec5d6['device']]);}else if(this['trunks'][_0x4ec5d6[_0xb557('0x2c')]]){if(this[_0xb557('0xb')][_0x4ec5d6[_0xb557('0x2c')]][_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){this[_0xb557('0xb')][_0x4ec5d6['device']][_0xb557('0x30')]=_[_0xb557('0x31')](moment()[_0xb557('0x32')]('x'));}this[_0xb557('0xb')][_0x4ec5d6[_0xb557('0x2c')]]['state']=_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]();this[_0xb557('0x22')](util['format'](_0xb557('0x29'),this[_0xb557('0xb')][_0x4ec5d6['device']]['name']),_0xb557('0x2a'),this[_0xb557('0xb')][_0x4ec5d6[_0xb557('0x2c')]]);}else if(_[_0xb557('0x34')](_0x4ec5d6[_0xb557('0x2c')],_0xb557('0x35'))){}else if(_[_0xb557('0x34')](_0x4ec5d6[_0xb557('0x2c')],_0xb557('0x36'))){var _0xff831d=_0x4ec5d6['device'];var _0x34c2fb=_0xff831d[_0xb557('0x37')](_0xff831d['indexOf']('/')+0x1,_0xff831d[_0xb557('0x38')]('@'));var _0x43edf4=_['find'](this['agents'],function(_0x2cdbe1){return _0x2cdbe1[_0xb557('0x39')]==_0x34c2fb||_0x2cdbe1[_0xb557('0x3a')]==_0x34c2fb||_0x2cdbe1['accountcode']==_0x34c2fb;});if(_0x43edf4){if(_0x43edf4[_0xb557('0x28')]!==_0x4ec5d6[_0xb557('0x28')][_0xb557('0x2e')]()){_0x43edf4[_0xb557('0x30')]=_[_0xb557('0x31')](moment()[_0xb557('0x32')]('x'));}_0x43edf4[_0xb557('0x28')]=_0x4ec5d6['state'][_0xb557('0x2e')]();_0x43edf4[_0xb557('0x2d')]=!![];_0x43edf4[_0xb557('0x3b')](_0x4ec5d6);}}else{}}}catch(_0x2a6222){logger[_0xb557('0x1d')](_0xb557('0x3c'),util[_0xb557('0x1e')](_0x2a6222,{'showHidden':![],'depth':null}));}};UserReport[_0xb557('0x1f')][_0xb557('0x14')]=function(_0x1623fc){try{if(this['isNotNull'](_0x1623fc)&&this[_0xb557('0x20')](_0x1623fc[_0xb557('0x13')])){if(this[_0xb557('0xc')][_0x1623fc['peer']]){if(!this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]]['local']||_0x1623fc[_0xb557('0x13')][_0xb557('0x2e')]()==_0xb557('0x3e')){this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x2d')]=![];this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x3f')]=_0x1623fc[_0xb557('0x13')][_0xb557('0x2e')]();this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x40')]=_0x1623fc[_0xb557('0x40')];this[_0xb557('0xc')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x3b')](_0x1623fc);}}else if(this[_0xb557('0xd')][_0x1623fc['peer']]){this['telephones'][_0x1623fc['peer']][_0xb557('0x3f')]=_0x1623fc['peerstatus']['toLowerCase']();this[_0xb557('0xd')][_0x1623fc[_0xb557('0x3d')]]['address']=_0x1623fc[_0xb557('0x40')];this['emit'](util['format'](_0xb557('0x33'),this[_0xb557('0xd')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x41')]),'telephone:save',this[_0xb557('0xd')][_0x1623fc[_0xb557('0x3d')]]);}else if(this[_0xb557('0xb')][_0x1623fc['peer']]){this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]]['status']=_0x1623fc['peerstatus'][_0xb557('0x2e')]();this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]][_0xb557('0x40')]=_0x1623fc['address'];this[_0xb557('0x22')](util[_0xb557('0x32')](_0xb557('0x29'),this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]]['name']),_0xb557('0x2a'),this[_0xb557('0xb')][_0x1623fc[_0xb557('0x3d')]]);}else{}}}catch(_0x3405d3){logger[_0xb557('0x1d')](_0xb557('0x42'),util[_0xb557('0x1e')](_0x3405d3,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 74dabf2..95c15d7 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 _0x2bb9=['queuecallerabandon','syncAgentComplete','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','custom:agentcalled','emit','format','user:%s','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','agentconnectAt','lastevent','holdtime','connectedlinenum','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','user:agentconnect','agentringnoanswer','agentcomplete','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','hasOwnProperty','agentcompleteAt','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','interface','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','keys','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncMusicOnHoldStart][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','bind'];(function(_0x480396,_0x290389){var _0x27f5dd=function(_0x30ef10){while(--_0x30ef10){_0x480396['push'](_0x480396['shift']());}};_0x27f5dd(++_0x290389);}(_0x2bb9,0x166));var _0x92bb=function(_0x291d65,_0x25bc0b){_0x291d65=_0x291d65-0x0;var _0x59e8f0=_0x2bb9[_0x291d65];return _0x59e8f0;};'use strict';var _=require(_0x92bb('0x0'));var moment=require(_0x92bb('0x1'));var util=require(_0x92bb('0x2'));var Redis=require(_0x92bb('0x3'));var config=require(_0x92bb('0x4'));var logger=require(_0x92bb('0x5'))(_0x92bb('0x6'));var ami=require(_0x92bb('0x7'));config[_0x92bb('0x8')]=_[_0x92bb('0x9')](config[_0x92bb('0x8')],{'host':_0x92bb('0xa'),'port':0x18eb});var io=require(_0x92bb('0xb'))(new Redis(config[_0x92bb('0x8')]));function VoiceAgentReport(_0x2a10ea){this[_0x92bb('0xc')]={};this[_0x92bb('0xd')]=_0x2a10ea[_0x92bb('0xd')];this['agents']=_0x2a10ea[_0x92bb('0xe')];this[_0x92bb('0xf')]={};ami['on']('agentcalled',this[_0x92bb('0x10')]['bind'](this));ami['on'](_0x92bb('0x11'),this[_0x92bb('0x12')][_0x92bb('0x13')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x92bb('0x14'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('agentcomplete',this[_0x92bb('0x15')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x16'),this['syncHangup']['bind'](this));ami['on'](_0x92bb('0x17'),this[_0x92bb('0x18')][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x19'),this[_0x92bb('0x1a')][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x1b'),this[_0x92bb('0x1c')][_0x92bb('0x13')](this));ami['on'](_0x92bb('0x1d'),this[_0x92bb('0x1e')][_0x92bb('0x13')](this));}VoiceAgentReport['prototype']['emit']=function(_0x214aca,_0x5c44d1,_0x1f6f91){io['to'](_0x214aca)['emit'](_0x5c44d1,_0x1f6f91);};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x20')]=function(_0x4e78cd){return _0x4e78cd!==null&&!_[_0x92bb('0x21')](_0x4e78cd);};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x10')]=function(_0xe1ffc5){try{if(this['isNotNull'](_0xe1ffc5)){if(_[_0x92bb('0x21')](this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]])){this[_0x92bb('0xc')][_0xe1ffc5['uniqueid']]={};}if(_[_0x92bb('0x21')](this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]])){this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]]={'agentcalledAt':moment()['format'](_0x92bb('0x24')),'lastevent':_0x92bb('0x25'),'variables':this[_0x92bb('0xf')][_0xe1ffc5[_0x92bb('0x22')]],'type':this[_0x92bb('0xd')][_0xe1ffc5[_0x92bb('0x26')]]?this[_0x92bb('0xd')][_0xe1ffc5[_0x92bb('0x26')]][_0x92bb('0x27')]||_0x92bb('0x28'):_0x92bb('0x28')};}_['merge'](this['channels'][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5['destuniqueid']],_[_0x92bb('0x29')](_0xe1ffc5,[_0x92bb('0x2a'),'privilege']));ami['emit'](_0x92bb('0x2b'),this[_0x92bb('0xc')][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]]);this[_0x92bb('0x2c')](util[_0x92bb('0x2d')](_0x92bb('0x2e'),_0xe1ffc5[_0x92bb('0x2f')]),'user:called',this['channels'][_0xe1ffc5[_0x92bb('0x22')]][_0xe1ffc5[_0x92bb('0x23')]]);}}catch(_0x173497){logger[_0x92bb('0x30')](_0x92bb('0x31'),util[_0x92bb('0x32')](_0x173497,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x12')]=function(_0x1234e7){try{if(this[_0x92bb('0x20')](_0x1234e7)){if(this['channels'][_0x1234e7['uniqueid']]){for(var _0x248868 in this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]]['hasOwnProperty'](_0x248868)){if(_0x1234e7[_0x92bb('0x23')]===_0x248868){this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x33')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x34')]='connect';this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x35')]=_0x1234e7[_0x92bb('0x35')];this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x36')]=_0x1234e7[_0x92bb('0x36')];this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868]['connectedlinename']=_0x1234e7['connectedlinename'];this['channels'][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x37')]=_0x1234e7[_0x92bb('0x37')];this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x38')]=_0x1234e7[_0x92bb('0x38')];_['merge'](this[_0x92bb('0xe')][_0x1234e7['interface']],_[_0x92bb('0x39')](_0x1234e7,[_0x92bb('0x26'),_0x92bb('0x3a')]));this[_0x92bb('0x2c')](util[_0x92bb('0x2d')](_0x92bb('0x2e'),_0x1234e7[_0x92bb('0x2f')]),_0x92bb('0x3b'),this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x1234e7['destuniqueid']]);ami[_0x92bb('0x2c')]('custom:agentconnect',this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868]);}else if(!this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3c')]&&!this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3d')]){this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3c')]=!![];this['channels'][_0x1234e7['uniqueid']][_0x248868]['agentringnoanswerAt']=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this['channels'][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x3e')]=_0x92bb('0x3f');this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868][_0x92bb('0x34')]=_0x92bb('0x3f');this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868][_0x92bb('0x40')]=_0x1234e7['destuniqueid'];this[_0x92bb('0xc')][_0x1234e7[_0x92bb('0x22')]][_0x248868]['answeredelsewheremembername']=_0x1234e7[_0x92bb('0x2f')];ami[_0x92bb('0x2c')](_0x92bb('0x41'),this[_0x92bb('0xc')][_0x1234e7['uniqueid']][_0x248868]);}}}}}}catch(_0x2c293e){logger[_0x92bb('0x30')](_0x92bb('0x42'),util[_0x92bb('0x32')](_0x2c293e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x43')]=function(_0x2aa6b8){try{if(this[_0x92bb('0x20')](_0x2aa6b8)){if(this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]]&&this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8[_0x92bb('0x23')]]){this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8[_0x92bb('0x23')]]['agentringnoanswer']=!![];this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8['destuniqueid']][_0x92bb('0x44')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x2aa6b8[_0x92bb('0x22')]][_0x2aa6b8[_0x92bb('0x23')]][_0x92bb('0x3e')]=_0x92bb('0x45');this['channels'][_0x2aa6b8['uniqueid']][_0x2aa6b8[_0x92bb('0x23')]][_0x92bb('0x34')]=_0x92bb('0x45');ami['emit'](_0x92bb('0x46'),this['channels'][_0x2aa6b8['uniqueid']][_0x2aa6b8['destuniqueid']]);}}}catch(_0x5b8268){logger[_0x92bb('0x30')](_0x92bb('0x47'),util['inspect'](_0x5b8268,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x48')]=function(_0x57181b){try{if(this[_0x92bb('0x20')](_0x57181b)){if(this[_0x92bb('0xc')][_0x57181b['uniqueid']]){for(var _0x2090ee in this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]]['hasOwnProperty'](_0x2090ee)&&!this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3c')]&&!this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3d')]){this['channels'][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3c')]=!![];this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x44')]=moment()['format'](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee][_0x92bb('0x3e')]=_0x92bb('0x49');this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee]['lastevent']=_0x92bb('0x49');ami[_0x92bb('0x2c')](_0x92bb('0x4a'),this[_0x92bb('0xc')][_0x57181b[_0x92bb('0x22')]][_0x2090ee]);}}}}}catch(_0x46350b){logger[_0x92bb('0x30')](_0x92bb('0x4b'),util['inspect'](_0x46350b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x4b809b){try{if(this['isNotNull'](_0x4b809b)){if(this[_0x92bb('0xc')][_0x4b809b['uniqueid']]){for(var _0x4714ed in this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x4b809b['uniqueid']][_0x92bb('0x4c')](_0x4714ed)){if(this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed]['agentconnectAt']&&!this['channels'][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x3d')]){this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x3d')]=!![];this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x4d')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x34')]=_0x92bb('0x4e');this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x4f')]=_0x4b809b[_0x92bb('0x4f')];this[_0x92bb('0xc')][_0x4b809b['uniqueid']][_0x4714ed]['reason']=_0x4b809b[_0x92bb('0x3e')]==_0x92bb('0x50')?'agent':_0x4b809b[_0x92bb('0x3e')];if(this[_0x92bb('0xd')][_0x4b809b[_0x92bb('0x26')]]&&this[_0x92bb('0xd')][_0x4b809b[_0x92bb('0x26')]][_0x92bb('0x51')]){this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed][_0x92bb('0x52')]=!![];this[_0x92bb('0xc')][_0x4b809b['uniqueid']][_0x4714ed][_0x92bb('0x53')]=this[_0x92bb('0xd')][_0x4b809b['queue']][_0x92bb('0x54')];}this[_0x92bb('0xe')][_0x4b809b[_0x92bb('0x55')]]=_[_0x92bb('0x29')](this[_0x92bb('0xe')][_0x4b809b[_0x92bb('0x55')]],[_0x92bb('0x26'),_0x92bb('0x3a')]);this[_0x92bb('0x2c')](util[_0x92bb('0x2d')]('user:%s',_0x4b809b['membername']),_0x92bb('0x56'),this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed]);ami['emit'](_0x92bb('0x57'),this[_0x92bb('0xc')][_0x4b809b[_0x92bb('0x22')]][_0x4714ed]);}}}}}}catch(_0x443251){logger[_0x92bb('0x30')](_0x92bb('0x58'),util[_0x92bb('0x32')](_0x443251,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x59')]=function(_0x55ce06){try{if(this[_0x92bb('0x20')](_0x55ce06)){this['addVariable'](_0x55ce06[_0x92bb('0x22')],_[_0x92bb('0x5a')](_0x55ce06['variable'])[0x0],_0x55ce06[_0x92bb('0x5b')]);if(this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]]){for(var _0x1986fa in this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0x55ce06['uniqueid']]['hasOwnProperty'](_0x1986fa)){if(_[_0x92bb('0x21')](this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]][_0x1986fa][_0x92bb('0xf')])){this[_0x92bb('0xc')][_0x55ce06[_0x92bb('0x22')]][_0x1986fa][_0x92bb('0xf')]={};}this['channels'][_0x55ce06['uniqueid']][_0x1986fa][_0x92bb('0xf')]=this[_0x92bb('0xf')][_0x55ce06['uniqueid']];}}}}}catch(_0x16e39c){logger[_0x92bb('0x30')](_0x92bb('0x5c'),util['inspect'](_0x16e39c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x5d')]=function(_0x43c1d9,_0x37a53f,_0x1dc519){var _0x5d9a1c=[_0x92bb('0x5e'),_0x92bb('0x5f'),'rtpaudioqosjitter',_0x92bb('0x60'),_0x92bb('0x61'),_0x92bb('0x62'),_0x92bb('0x63'),_0x92bb('0x64'),'sipcallid',_0x92bb('0x65'),_0x92bb('0x66'),_0x92bb('0x67'),'membercalls',_0x92bb('0x68'),_0x92bb('0x69'),_0x92bb('0x6a'),_0x92bb('0x2f'),_0x92bb('0x6b'),_0x92bb('0x6c')];if(!_[_0x92bb('0x6d')](_0x37a53f)&&!_[_0x92bb('0x6e')](_0x5d9a1c,_0x37a53f)){if(_[_0x92bb('0x21')](this['variables'][_0x43c1d9])){this[_0x92bb('0xf')][_0x43c1d9]={};}this[_0x92bb('0xf')][_0x43c1d9][_0x37a53f]=_0x1dc519;}};VoiceAgentReport['prototype']['syncHangup']=function(_0xd42119){try{if(this[_0x92bb('0x20')](_0xd42119)){if(this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]){for(var _0x4ef94d in this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]){if(this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]['hasOwnProperty'](_0x4ef94d)){if(this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]][_0x4ef94d][_0x92bb('0x3e')]==_0x92bb('0x50')&&this['channels'][_0xd42119['uniqueid']][_0x4ef94d][_0x92bb('0x3d')]){this['channels'][_0xd42119['uniqueid']][_0x4ef94d][_0x92bb('0x4d')]=moment()[_0x92bb('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit'](_0x92bb('0x6f'),_[_0x92bb('0x70')](this[_0x92bb('0xc')][_0xd42119[_0x92bb('0x22')]]));delete this[_0x92bb('0xc')][_0xd42119['uniqueid']];}if(this[_0x92bb('0xf')][_0xd42119[_0x92bb('0x22')]]){delete this[_0x92bb('0xf')][_0xd42119['uniqueid']];}}}catch(_0x12a7c8){logger[_0x92bb('0x30')]('[syncHangup][VoiceAgentReport]',util[_0x92bb('0x32')](_0x12a7c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')]['syncAttendedTransfer']=function(_0x366ec6){try{if(this[_0x92bb('0x20')](_0x366ec6)){if(this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]]){for(var _0x4a0f4e in this['channels'][_0x366ec6[_0x92bb('0x71')]]){if(this[_0x92bb('0xc')][_0x366ec6['transfereeuniqueid']][_0x92bb('0x4c')](_0x4a0f4e)){if(_0x366ec6[_0x92bb('0x72')]===_0x4a0f4e){var _0x3fb8ea=moment();this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x3d')]=!![];this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x4d')]=moment()[_0x92bb('0x2d')](_0x92bb('0x24'));this[_0x92bb('0xc')][_0x366ec6['transfereeuniqueid']][_0x4a0f4e][_0x92bb('0x3e')]=_0x92bb('0x50');this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x34')]='complete';this['channels'][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x4f')]=_0x3fb8ea[_0x92bb('0x73')](this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]][_0x4a0f4e][_0x92bb('0x33')],'seconds');}}}}if(this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x74')]]){var _0xc5319d=this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x74')]];this[_0x92bb('0xc')][_0x366ec6['secondtransfereruniqueid']]=this['channels'][_0x366ec6[_0x92bb('0x71')]];this[_0x92bb('0xc')][_0x366ec6[_0x92bb('0x71')]]=_0xc5319d;}}}catch(_0x131f3b){logger[_0x92bb('0x30')](_0x92bb('0x75'),util[_0x92bb('0x32')](_0x131f3b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x92bb('0x1e')]=function(_0x261cd7){try{if(this['isNotNull'](_0x261cd7)){if(this[_0x92bb('0xc')][_0x261cd7['transfereeuniqueid']]){for(var _0x9ce419 in this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]]){if(this['channels'][_0x261cd7['transfereeuniqueid']][_0x92bb('0x4c')](_0x9ce419)){if(_0x261cd7[_0x92bb('0x76')]===_0x9ce419){var _0x508558=moment();this['channels'][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x3d')]=!![];this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x4d')]=_0x508558;this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x3e')]='transfer';this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x34')]=_0x92bb('0x4e');this['channels'][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x4f')]=_0x508558[_0x92bb('0x73')](this[_0x92bb('0xc')][_0x261cd7[_0x92bb('0x71')]][_0x9ce419][_0x92bb('0x33')],_0x92bb('0x77'));}}}}}}catch(_0x5d5e83){logger['error']('[syncBlindTransfer][VoiceAgentReport]',util[_0x92bb('0x32')](_0x5d5e83,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x18')]=function(_0x129582){var _0x4e1a85='';try{if(this['isNotNull'](_0x129582)){if(_0x129582['channel']){_0x4e1a85=_0x129582['channel']['substring'](0x0,_0x129582['channel']['lastIndexOf']('-'));if(this[_0x92bb('0xe')][_0x4e1a85]){this[_0x92bb('0xe')][_0x4e1a85]['onhold']=!![];}}}}catch(_0x241f5e){logger[_0x92bb('0x30')](_0x92bb('0x78'),util[_0x92bb('0x32')](_0x241f5e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x92bb('0x1f')][_0x92bb('0x1a')]=function(_0x4d6bf0){var _0xe8e9a5='';try{if(this[_0x92bb('0x20')](_0x4d6bf0)){if(_0x4d6bf0[_0x92bb('0x79')]){_0xe8e9a5=_0x4d6bf0[_0x92bb('0x79')][_0x92bb('0x7a')](0x0,_0x4d6bf0[_0x92bb('0x79')][_0x92bb('0x7b')]('-'));if(this['agents'][_0xe8e9a5]){this[_0x92bb('0xe')][_0xe8e9a5][_0x92bb('0x7c')]=![];}}}}catch(_0x51e92c){logger[_0x92bb('0x30')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x92bb('0x32')](_0x51e92c,{'showHidden':![],'depth':null}));}};module[_0x92bb('0x7d')]=VoiceAgentReport; \ No newline at end of file +var _0x0df6=['membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','agentcompleteAt','complete','talktime','transfer','agent','acw','agentacw','acwtime','acwTimeout','destconnectedlinenum','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','syncMusicOnHoldStart','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','privilege','custom:agentcalled','user:%s'];(function(_0x527712,_0xada768){var _0x38f82e=function(_0xd68bfd){while(--_0xd68bfd){_0x527712['push'](_0x527712['shift']());}};_0x38f82e(++_0xada768);}(_0x0df6,0x1d4));var _0x60df=function(_0x714d39,_0x26aa78){_0x714d39=_0x714d39-0x0;var _0x1f4e96=_0x0df6[_0x714d39];return _0x1f4e96;};'use strict';var _=require(_0x60df('0x0'));var moment=require(_0x60df('0x1'));var util=require(_0x60df('0x2'));var Redis=require(_0x60df('0x3'));var config=require('../../../config/environment');var logger=require(_0x60df('0x4'))(_0x60df('0x5'));var ami=require(_0x60df('0x6'));config[_0x60df('0x7')]=_[_0x60df('0x8')](config[_0x60df('0x7')],{'host':_0x60df('0x9'),'port':0x18eb});var io=require(_0x60df('0xa'))(new Redis(config[_0x60df('0x7')]));function VoiceAgentReport(_0x30fe76){this[_0x60df('0xb')]={};this[_0x60df('0xc')]=_0x30fe76[_0x60df('0xc')];this[_0x60df('0xd')]=_0x30fe76[_0x60df('0xd')];this[_0x60df('0xe')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x60df('0xf')](this));ami['on'](_0x60df('0x10'),this[_0x60df('0x11')][_0x60df('0xf')](this));ami['on'](_0x60df('0x12'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x60df('0x13'),this[_0x60df('0x14')]['bind'](this));ami['on'](_0x60df('0x15'),this[_0x60df('0x16')][_0x60df('0xf')](this));ami['on'](_0x60df('0x17'),this[_0x60df('0x18')]['bind'](this));ami['on']('hangup',this[_0x60df('0x19')][_0x60df('0xf')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x60df('0xf')](this));ami['on'](_0x60df('0x1a'),this[_0x60df('0x1b')][_0x60df('0xf')](this));ami['on']('attendedtransfer',this[_0x60df('0x1c')][_0x60df('0xf')](this));ami['on'](_0x60df('0x1d'),this[_0x60df('0x1e')][_0x60df('0xf')](this));}VoiceAgentReport[_0x60df('0x1f')]['emit']=function(_0x5c7efa,_0x2bf441,_0x13a627){io['to'](_0x5c7efa)[_0x60df('0x20')](_0x2bf441,_0x13a627);};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x21')]=function(_0xca8ee6){return _0xca8ee6!==null&&!_[_0x60df('0x22')](_0xca8ee6);};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x23')]=function(_0xfcb84c){try{if(this[_0x60df('0x21')](_0xfcb84c)){if(_[_0x60df('0x22')](this[_0x60df('0xb')][_0xfcb84c['uniqueid']])){this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]]={};}if(_[_0x60df('0x22')](this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]])){this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]]={'agentcalledAt':moment()[_0x60df('0x26')](_0x60df('0x27')),'lastevent':_0x60df('0x28'),'variables':this[_0x60df('0xe')][_0xfcb84c[_0x60df('0x24')]],'type':this['voiceQueues'][_0xfcb84c[_0x60df('0x29')]]?this[_0x60df('0xc')][_0xfcb84c['queue']]['type']||_0x60df('0x2a'):_0x60df('0x2a')};}_[_0x60df('0x2b')](this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]],_[_0x60df('0x2c')](_0xfcb84c,['event',_0x60df('0x2d')]));ami['emit'](_0x60df('0x2e'),this['channels'][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c['destuniqueid']]);this[_0x60df('0x20')](util['format'](_0x60df('0x2f'),_0xfcb84c[_0x60df('0x30')]),_0x60df('0x31'),this[_0x60df('0xb')][_0xfcb84c[_0x60df('0x24')]][_0xfcb84c[_0x60df('0x25')]]);}}catch(_0x1ddb02){logger[_0x60df('0x32')](_0x60df('0x33'),util[_0x60df('0x34')](_0x1ddb02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x11')]=function(_0x11c7be){try{if(this[_0x60df('0x21')](_0x11c7be)){if(this[_0x60df('0xb')][_0x11c7be['uniqueid']]){for(var _0x3242b0 in this['channels'][_0x11c7be['uniqueid']]){if(this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]]['hasOwnProperty'](_0x3242b0)){if(_0x11c7be[_0x60df('0x25')]===_0x3242b0){this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0]['agentconnectAt']=moment()[_0x60df('0x26')](_0x60df('0x27'));this['channels'][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x35')]=_0x60df('0x36');this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x37')]=_0x11c7be[_0x60df('0x37')];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x38')]=_0x11c7be[_0x60df('0x38')];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x39')]=_0x11c7be[_0x60df('0x39')];this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0][_0x60df('0x3a')]=_0x11c7be[_0x60df('0x3a')];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x3b')]=_0x11c7be[_0x60df('0x3b')];_[_0x60df('0x2b')](this['agents'][_0x11c7be[_0x60df('0x3c')]],_[_0x60df('0x3d')](_0x11c7be,[_0x60df('0x29'),'destconnectedlinenum']));this['emit'](util[_0x60df('0x26')](_0x60df('0x2f'),_0x11c7be['membername']),_0x60df('0x3e'),this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x11c7be[_0x60df('0x25')]]);ami[_0x60df('0x20')]('custom:agentconnect',this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]);}else if(!this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0]['agentringnoanswer']&&!this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]['agentcomplete']){this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]['agentringnoanswer']=!![];this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x3f')]=moment()[_0x60df('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x60df('0xb')][_0x11c7be['uniqueid']][_0x3242b0][_0x60df('0x40')]='answered_elsewhere';this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x35')]=_0x60df('0x41');this['channels'][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x42')]=_0x11c7be[_0x60df('0x25')];this['channels'][_0x11c7be[_0x60df('0x24')]][_0x3242b0][_0x60df('0x43')]=_0x11c7be[_0x60df('0x30')];ami['emit'](_0x60df('0x44'),this[_0x60df('0xb')][_0x11c7be[_0x60df('0x24')]][_0x3242b0]);}}}}}}catch(_0x3b3ad0){logger[_0x60df('0x32')](_0x60df('0x45'),util['inspect'](_0x3b3ad0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x60df('0x46')]=function(_0x394441){try{if(this['isNotNull'](_0x394441)){if(this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]]&&this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441['destuniqueid']]){this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441['destuniqueid']][_0x60df('0x12')]=!![];this['channels'][_0x394441[_0x60df('0x24')]][_0x394441[_0x60df('0x25')]][_0x60df('0x3f')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441['destuniqueid']][_0x60df('0x40')]=_0x60df('0x47');this[_0x60df('0xb')][_0x394441[_0x60df('0x24')]][_0x394441[_0x60df('0x25')]][_0x60df('0x35')]=_0x60df('0x47');ami[_0x60df('0x20')](_0x60df('0x48'),this['channels'][_0x394441['uniqueid']][_0x394441['destuniqueid']]);}}}catch(_0x2eccd3){logger[_0x60df('0x32')](_0x60df('0x49'),util[_0x60df('0x34')](_0x2eccd3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x14')]=function(_0x2cbb4c){try{if(this['isNotNull'](_0x2cbb4c)){if(this['channels'][_0x2cbb4c[_0x60df('0x24')]]){for(var _0x332247 in this['channels'][_0x2cbb4c[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x2cbb4c['uniqueid']][_0x60df('0x4a')](_0x332247)&&!this['channels'][_0x2cbb4c[_0x60df('0x24')]][_0x332247]['agentringnoanswer']&&!this[_0x60df('0xb')][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x15')]){this[_0x60df('0xb')][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x12')]=!![];this['channels'][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x3f')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this[_0x60df('0xb')][_0x2cbb4c['uniqueid']][_0x332247][_0x60df('0x40')]=_0x60df('0x4b');this[_0x60df('0xb')][_0x2cbb4c[_0x60df('0x24')]][_0x332247][_0x60df('0x35')]=_0x60df('0x4b');ami[_0x60df('0x20')]('custom:agentqueuecallerabandon',this['channels'][_0x2cbb4c['uniqueid']][_0x332247]);}}}}}catch(_0x470056){logger[_0x60df('0x32')](_0x60df('0x4c'),util[_0x60df('0x34')](_0x470056,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')]['syncAgentComplete']=function(_0x4c9712){try{if(this[_0x60df('0x21')](_0x4c9712)){if(this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]]){for(var _0x19bf8d in this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x60df('0x4a')](_0x19bf8d)){if(this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x4d')]&&!this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x15')]){this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x15')]=!![];this[_0x60df('0xb')][_0x4c9712['uniqueid']][_0x19bf8d][_0x60df('0x4e')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x35')]=_0x60df('0x4f');this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d][_0x60df('0x50')]=_0x4c9712[_0x60df('0x50')];this['channels'][_0x4c9712[_0x60df('0x24')]][_0x19bf8d]['reason']=_0x4c9712[_0x60df('0x40')]==_0x60df('0x51')?_0x60df('0x52'):_0x4c9712[_0x60df('0x40')];if(this[_0x60df('0xc')][_0x4c9712[_0x60df('0x29')]]&&this[_0x60df('0xc')][_0x4c9712[_0x60df('0x29')]][_0x60df('0x53')]){this[_0x60df('0xb')][_0x4c9712['uniqueid']][_0x19bf8d][_0x60df('0x54')]=!![];this['channels'][_0x4c9712['uniqueid']][_0x19bf8d][_0x60df('0x55')]=this[_0x60df('0xc')][_0x4c9712['queue']][_0x60df('0x56')];}this['agents'][_0x4c9712['interface']]=_[_0x60df('0x2c')](this[_0x60df('0xd')][_0x4c9712[_0x60df('0x3c')]],['queue',_0x60df('0x57')]);this[_0x60df('0x20')](util['format']('user:%s',_0x4c9712[_0x60df('0x30')]),_0x60df('0x58'),this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d]);ami[_0x60df('0x20')]('custom:agentcomplete',this[_0x60df('0xb')][_0x4c9712[_0x60df('0x24')]][_0x19bf8d]);}}}}}}catch(_0xfc1a23){logger['error'](_0x60df('0x59'),util[_0x60df('0x34')](_0xfc1a23,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x18')]=function(_0x94595d){try{if(this['isNotNull'](_0x94595d)){this['addVariable'](_0x94595d[_0x60df('0x24')],_[_0x60df('0x5a')](_0x94595d[_0x60df('0x5b')])[0x0],_0x94595d[_0x60df('0x5c')]);if(this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]]){for(var _0x5cd907 in this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]][_0x60df('0x4a')](_0x5cd907)){if(_[_0x60df('0x22')](this[_0x60df('0xb')][_0x94595d['uniqueid']][_0x5cd907][_0x60df('0xe')])){this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]][_0x5cd907][_0x60df('0xe')]={};}this[_0x60df('0xb')][_0x94595d[_0x60df('0x24')]][_0x5cd907]['variables']=this['variables'][_0x94595d['uniqueid']];}}}}}catch(_0x47725c){logger['error']('[syncVarSet][VoiceAgentReport]',util[_0x60df('0x34')](_0x47725c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x5d')]=function(_0x2c7f14,_0x3e8c10,_0xabb907){var _0x5500ed=[_0x60df('0x5e'),_0x60df('0x5f'),_0x60df('0x60'),_0x60df('0x61'),_0x60df('0x62'),_0x60df('0x63'),_0x60df('0x64'),_0x60df('0x65'),_0x60df('0x66'),_0x60df('0x67'),_0x60df('0x68'),'bridgepvtcallid',_0x60df('0x69'),_0x60df('0x6a'),_0x60df('0x6b'),'memberlastcall',_0x60df('0x30'),_0x60df('0x6c'),'memberrealtime'];if(!_[_0x60df('0x6d')](_0x3e8c10)&&!_[_0x60df('0x6e')](_0x5500ed,_0x3e8c10)){if(_[_0x60df('0x22')](this['variables'][_0x2c7f14])){this[_0x60df('0xe')][_0x2c7f14]={};}this[_0x60df('0xe')][_0x2c7f14][_0x3e8c10]=_0xabb907;}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x19')]=function(_0x3ebb85){try{if(this[_0x60df('0x21')](_0x3ebb85)){if(this[_0x60df('0xb')][_0x3ebb85['uniqueid']]){for(var _0x2f3d5e in this[_0x60df('0xb')][_0x3ebb85[_0x60df('0x24')]]){if(this[_0x60df('0xb')][_0x3ebb85['uniqueid']]['hasOwnProperty'](_0x2f3d5e)){if(this[_0x60df('0xb')][_0x3ebb85['uniqueid']][_0x2f3d5e]['reason']==_0x60df('0x51')&&this[_0x60df('0xb')][_0x3ebb85[_0x60df('0x24')]][_0x2f3d5e]['agentcomplete']){this['channels'][_0x3ebb85['uniqueid']][_0x2f3d5e][_0x60df('0x4e')]=moment()[_0x60df('0x26')](_0x60df('0x27'));}}}ami[_0x60df('0x20')](_0x60df('0x6f'),_[_0x60df('0x70')](this[_0x60df('0xb')][_0x3ebb85['uniqueid']]));delete this[_0x60df('0xb')][_0x3ebb85['uniqueid']];}if(this[_0x60df('0xe')][_0x3ebb85['uniqueid']]){delete this[_0x60df('0xe')][_0x3ebb85[_0x60df('0x24')]];}}}catch(_0x140627){logger[_0x60df('0x32')](_0x60df('0x71'),util[_0x60df('0x34')](_0x140627,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x60df('0x1c')]=function(_0x47019e){try{if(this[_0x60df('0x21')](_0x47019e)){if(this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]]){for(var _0x2f17e3 in this['channels'][_0x47019e[_0x60df('0x72')]]){if(this[_0x60df('0xb')][_0x47019e['transfereeuniqueid']][_0x60df('0x4a')](_0x2f17e3)){if(_0x47019e[_0x60df('0x73')]===_0x2f17e3){var _0x34ec77=moment();this[_0x60df('0xb')][_0x47019e['transfereeuniqueid']][_0x2f17e3][_0x60df('0x15')]=!![];this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]][_0x2f17e3][_0x60df('0x4e')]=moment()[_0x60df('0x26')](_0x60df('0x27'));this['channels'][_0x47019e['transfereeuniqueid']][_0x2f17e3][_0x60df('0x40')]=_0x60df('0x51');this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]][_0x2f17e3][_0x60df('0x35')]='complete';this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]][_0x2f17e3]['talktime']=_0x34ec77[_0x60df('0x74')](this[_0x60df('0xb')][_0x47019e['transfereeuniqueid']][_0x2f17e3]['agentconnectAt'],_0x60df('0x75'));}}}}if(this[_0x60df('0xb')][_0x47019e[_0x60df('0x76')]]){var _0xc65ddc=this[_0x60df('0xb')][_0x47019e[_0x60df('0x76')]];this['channels'][_0x47019e['secondtransfereruniqueid']]=this['channels'][_0x47019e['transfereeuniqueid']];this[_0x60df('0xb')][_0x47019e[_0x60df('0x72')]]=_0xc65ddc;}}}catch(_0x52073f){logger['error'](_0x60df('0x77'),util['inspect'](_0x52073f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x1e')]=function(_0x29d552){try{if(this[_0x60df('0x21')](_0x29d552)){if(this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]]){for(var _0x105380 in this['channels'][_0x29d552[_0x60df('0x72')]]){if(this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x60df('0x4a')](_0x105380)){if(_0x29d552[_0x60df('0x78')]===_0x105380){var _0x579bd8=moment();this['channels'][_0x29d552['transfereeuniqueid']][_0x105380][_0x60df('0x15')]=!![];this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380]['agentcompleteAt']=_0x579bd8;this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380][_0x60df('0x40')]=_0x60df('0x51');this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380]['lastevent']='complete';this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380]['talktime']=_0x579bd8[_0x60df('0x74')](this[_0x60df('0xb')][_0x29d552[_0x60df('0x72')]][_0x105380][_0x60df('0x4d')],_0x60df('0x75'));}}}}}}catch(_0x104017){logger[_0x60df('0x32')]('[syncBlindTransfer][VoiceAgentReport]',util['inspect'](_0x104017,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x79')]=function(_0xe90749){var _0x47fd3f='';try{if(this[_0x60df('0x21')](_0xe90749)){if(_0xe90749[_0x60df('0x7a')]){_0x47fd3f=_0xe90749[_0x60df('0x7a')][_0x60df('0x7b')](0x0,_0xe90749[_0x60df('0x7a')]['lastIndexOf']('-'));if(this['agents'][_0x47fd3f]){this[_0x60df('0xd')][_0x47fd3f][_0x60df('0x7c')]=!![];}}}}catch(_0x4f8200){logger['error'](_0x60df('0x7d'),util[_0x60df('0x34')](_0x4f8200,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x60df('0x1f')][_0x60df('0x1b')]=function(_0x4c971b){var _0x59811b='';try{if(this['isNotNull'](_0x4c971b)){if(_0x4c971b[_0x60df('0x7a')]){_0x59811b=_0x4c971b['channel'][_0x60df('0x7b')](0x0,_0x4c971b[_0x60df('0x7a')][_0x60df('0x7e')]('-'));if(this['agents'][_0x59811b]){this[_0x60df('0xd')][_0x59811b][_0x60df('0x7c')]=![];}}}}catch(_0x3553cc){logger['error'](_0x60df('0x7f'),util['inspect'](_0x3553cc,{'showHidden':![],'depth':null}));}};module[_0x60df('0x80')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 4d73135..9ffb7fe 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 _0x530a=['NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','isNotNull','isUndefined','prototype','emit','uniqueid','linkedid','channels','merge','pick','error','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','from-sip','split','destconnectedlinenum','exten','user:%s','name','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','.wav49','.WAV','monitorFilename','isNil','variable','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','syncHangup','endtime','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','not_inuse','inuse','invalid','unavailable','ringing','onhold','set','queue','agi','playback'];(function(_0x4911ce,_0xdf92db){var _0x20e35d=function(_0x55b200){while(--_0x55b200){_0x4911ce['push'](_0x4911ce['shift']());}};_0x20e35d(++_0xdf92db);}(_0x530a,0x81));var _0xa530=function(_0xcd784e,_0xd3402c){_0xcd784e=_0xcd784e-0x0;var _0x4f661e=_0x530a[_0xcd784e];return _0x4f661e;};'use strict';var BPromise=require('bluebird');var _=require(_0xa530('0x0'));var moment=require(_0xa530('0x1'));var util=require(_0xa530('0x2'));var path=require(_0xa530('0x3'));var Redis=require(_0xa530('0x4'));var config=require(_0xa530('0x5'));var logger=require('../../../config/logger')(_0xa530('0x6'));var ami=require(_0xa530('0x7'));var Channel=require('../model/channel');var statusDesc=['unknown',_0xa530('0x8'),_0xa530('0x9'),'busy',_0xa530('0xa'),_0xa530('0xb'),_0xa530('0xc'),'ringinuse',_0xa530('0xd')];var applications=[_0xa530('0xe'),_0xa530('0xf'),_0xa530('0x10'),'dial',_0xa530('0x11'),'voicemail'];var dispositions=[_0xa530('0x12'),_0xa530('0x13'),_0xa530('0x13'),_0xa530('0x12'),'NO\x20ANSWER',_0xa530('0x12'),'ANSWERED',_0xa530('0x14'),'FAILED',_0xa530('0x13'),_0xa530('0x13')];var actions={};config['redis']=_['defaults'](config[_0xa530('0x15')],{'host':_0xa530('0x16'),'port':0x18eb});var io=require(_0xa530('0x17'))(new Redis(config[_0xa530('0x15')]));function VoiceCallReport(_0xdda513){this['channels']=_0xdda513['channels'];this['agents']=_0xdda513[_0xa530('0x18')];ami['on']('coreshowchannel',this[_0xa530('0x19')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x1b'),this[_0xa530('0x19')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x1c'),this[_0xa530('0x1d')][_0xa530('0x1a')](this));ami['on']('newstate',this[_0xa530('0x1e')]['bind'](this));ami['on']('varset',this[_0xa530('0x1f')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xa530('0x1a')](this));ami['on'](_0xa530('0x20'),this[_0xa530('0x21')]['bind'](this));ami['on'](_0xa530('0x22'),this[_0xa530('0x23')][_0xa530('0x1a')](this));ami['on']('blindtransfer',this[_0xa530('0x24')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x25'),this[_0xa530('0x26')][_0xa530('0x1a')](this));ami['on'](_0xa530('0x27'),this[_0xa530('0x28')][_0xa530('0x1a')](this));return BPromise[_0xa530('0x29')]()[_0xa530('0x2a')](ami[_0xa530('0x2b')]())['catch'](function(_0x127165){console[_0xa530('0x2c')](_0x127165);});}VoiceCallReport['prototype'][_0xa530('0x2d')]=function(_0x5c318d){return _0x5c318d!==null&&!_[_0xa530('0x2e')](_0x5c318d);};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x30')]=function(_0xdd58ac,_0x375665,_0x2be990){io['to'](_0xdd58ac)[_0xa530('0x30')](_0x375665,_0x2be990);};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x21')]=function(_0x1ba1c6){try{if(this['isNotNull'](_0x1ba1c6)){if(_0x1ba1c6[_0xa530('0x31')]===_0x1ba1c6[_0xa530('0x32')]){if(!_[_0xa530('0x2e')](this[_0xa530('0x33')][_0x1ba1c6[_0xa530('0x31')]])){_[_0xa530('0x34')](this['channels'][_0x1ba1c6[_0xa530('0x31')]],_[_0xa530('0x35')](_0x1ba1c6,_['keys'](this[_0xa530('0x33')][_0x1ba1c6[_0xa530('0x31')]])));}}}}catch(_0x333aed){logger[_0xa530('0x36')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x333aed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')]['syncNewChannel']=function(_0x56e571){try{if(this[_0xa530('0x2d')](_0x56e571)){if(_0x56e571[_0xa530('0x31')]===_0x56e571['linkedid']&&_0x56e571[_0xa530('0x37')]!=_0xa530('0x38')){if(_['isUndefined'](this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]])){this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]]=new Channel();this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]][_0xa530('0x39')]=moment()[_0xa530('0x3a')](_0xa530('0x3b'));this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]][_0xa530('0x3c')]=dispositions[_['toNumber'](_0x56e571[_0xa530('0x3d')])];_[_0xa530('0x34')](this[_0xa530('0x33')][_0x56e571['uniqueid']],_[_0xa530('0x35')](_0x56e571,_[_0xa530('0x3e')](this[_0xa530('0x33')][_0x56e571[_0xa530('0x31')]])));if(_0x56e571['context']===_0xa530('0x3f')){if(this[_0xa530('0x18')][_0x56e571[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]]){this[_0xa530('0x18')][_0x56e571[_0xa530('0x37')]['split']('-')[0x0]][_0xa530('0x41')]=_0x56e571[_0xa530('0x42')];this[_0xa530('0x30')](util[_0xa530('0x3a')](_0xa530('0x43'),this['agents'][_0x56e571[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]][_0xa530('0x44')]),'user:agentconnect',{'destaccountcode':this[_0xa530('0x18')][_0x56e571[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]][_0xa530('0x45')],'destconnectedlinenum':_0x56e571[_0xa530('0x42')]});}}}}}}catch(_0x42931a){logger[_0xa530('0x36')](_0xa530('0x46'),util[_0xa530('0x47')](_0x42931a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x19')]=function(_0x56eb73){try{if(this[_0xa530('0x2d')](_0x56eb73)){if(_0x56eb73[_0xa530('0x31')]===_0x56eb73[_0xa530('0x32')]&&_0x56eb73[_0xa530('0x42')]!='h'&&_0x56eb73[_0xa530('0x37')]!=_0xa530('0x38')){_0x56eb73['application']=_0x56eb73[_0xa530('0x48')][_0xa530('0x49')]();_0x56eb73[_0xa530('0x4a')]=(_0x56eb73[_0xa530('0x4b')]||_0x56eb73[_0xa530('0x4a')])[_0xa530('0x49')]();if(_[_0xa530('0x2e')](this[_0xa530('0x33')][_0x56eb73['uniqueid']])){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]]=new Channel();this[_0xa530('0x33')][_0x56eb73['uniqueid']]['starttime']=_0x56eb73[_0xa530('0x4c')]?moment()[_0xa530('0x4d')](moment[_0xa530('0x4c')](_0x56eb73['duration'])['seconds'](),_0xa530('0x4e'))[_0xa530('0x3a')](_0xa530('0x3b')):moment()[_0xa530('0x3a')](_0xa530('0x3b'));this[_0xa530('0x33')][_0x56eb73['uniqueid']]['disposition']='NO\x20ANSWER';}_[_0xa530('0x34')](this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]],_[_0xa530('0x35')](_0x56eb73,_[_0xa530('0x3e')](this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]])));if(_[_0xa530('0x4f')](applications,_0x56eb73[_0xa530('0x48')])){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]][_0xa530('0x50')]=_0x56eb73[_0xa530('0x48')];this[_0xa530('0x33')][_0x56eb73['uniqueid']][_0xa530('0x51')]=_0x56eb73[_0xa530('0x4a')];if(_0x56eb73[_0xa530('0x48')]===_0xa530('0xe')&&_[_0xa530('0x52')](_0x56eb73[_0xa530('0x4a')],_0xa530('0x53'))){var _0x411640=_0x56eb73[_0xa530('0x4a')][_0xa530('0x40')]('=');var _0x4cd23a=_0x411640[0x0][_0xa530('0x54')](/cdr\((.*)\)/);if(_0x4cd23a){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]][_0x4cd23a[0x1]]=_0x411640[0x1];}}else if(_0x56eb73[_0xa530('0x48')]===_0xa530('0xf')){this[_0xa530('0x33')][_0x56eb73[_0xa530('0x31')]][_0xa530('0xf')]=_0x56eb73[_0xa530('0x4a')][_0xa530('0x40')](',')[0x0];}}}}}catch(_0x2fd72f){logger[_0xa530('0x36')]('[syncNewExten][VoiceCallReport]',util[_0xa530('0x47')](_0x2fd72f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')]['syncNewState']=function(_0x55a790){try{if(this[_0xa530('0x2d')](_0x55a790)){if(_0x55a790[_0xa530('0x31')]!==_0x55a790['linkedid']){if(this['channels'][_0x55a790[_0xa530('0x32')]]){if(_0x55a790[_0xa530('0x3d')]==='6'){if(!this['channels'][_0x55a790[_0xa530('0x32')]][_0xa530('0x55')]){var _0x831fe1=moment();this[_0xa530('0x33')][_0x55a790['linkedid']]['answered']=!![];this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x56')]=_0x831fe1['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xa530('0x33')][_0x55a790['linkedid']][_0xa530('0x39')]){this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x57')]=_0x831fe1[_0xa530('0x58')](this[_0xa530('0x33')][_0x55a790['linkedid']][_0xa530('0x39')],_0xa530('0x4e'));}}this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x32')]=_0x55a790['uniqueid'];if(_0x55a790[_0xa530('0x59')]!==_0xa530('0x5a')){this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x5b')]=_0x55a790['calleridnum'];}this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x5c')]=_0x55a790[_0xa530('0x5d')];this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x5e')]=_0x55a790[_0xa530('0x37')];this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x3c')]=dispositions[_[_0xa530('0x5f')](_0x55a790[_0xa530('0x3d')])];if(this[_0xa530('0x18')][_0x55a790[_0xa530('0x37')]['split']('-')[0x0]]){this[_0xa530('0x33')][_0x55a790[_0xa530('0x32')]][_0xa530('0x60')]=this['agents'][_0x55a790['channel']['split']('-')[0x0]]['id'];this[_0xa530('0x33')][_0x55a790['linkedid']]['membername']=this[_0xa530('0x18')][_0x55a790['channel'][_0xa530('0x40')]('-')[0x0]][_0xa530('0x44')];}}}}else{if(this['channels'][_0x55a790[_0xa530('0x31')]]){if(_0x55a790[_0xa530('0x3d')]==='6'){if(this[_0xa530('0x18')][_0x55a790[_0xa530('0x37')]['split']('-')[0x0]]){this['channels'][_0x55a790[_0xa530('0x31')]][_0xa530('0x60')]=this[_0xa530('0x18')][_0x55a790[_0xa530('0x37')]['split']('-')[0x0]]['id'];this[_0xa530('0x33')][_0x55a790[_0xa530('0x31')]]['membername']=this[_0xa530('0x18')][_0x55a790['channel'][_0xa530('0x40')]('-')[0x0]][_0xa530('0x44')];}}}}}}catch(_0x55eeca){logger[_0xa530('0x36')](_0xa530('0x61'),util[_0xa530('0x47')](_0x55eeca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x62')]=function(_0xe45304,_0x150f0f){if(this[_0xa530('0x33')][_0xe45304]){this['channels'][_0xe45304]['monitor']=!![];if(_['endsWith'](_0x150f0f,_0xa530('0x63'))){_0x150f0f=_0x150f0f['replace'](_0xa530('0x63'),_0xa530('0x64'));}this['channels'][_0xe45304][_0xa530('0x65')]=_0x150f0f;var _0x48e17b=_['find'](this[_0xa530('0x33')][_0xe45304]['monitors'],{'filename':_0x150f0f});if(_[_0xa530('0x66')](_0x48e17b)){this[_0xa530('0x33')][_0xe45304]['monitors']['push']({'filename':_0x150f0f,'createdAt':moment()[_0xa530('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x1f')]=function(_0x5ddaa7){try{if(this['isNotNull'](_0x5ddaa7)){if(this['channels'][_0x5ddaa7[_0xa530('0x31')]]&&_0x5ddaa7[_0xa530('0x37')]!=_0xa530('0x38')){if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')])){if(this[_0xa530('0x2d')](_0x5ddaa7['variable']['mixmonitor_filename'])){this[_0xa530('0x62')](_0x5ddaa7[_0xa530('0x31')],_0x5ddaa7[_0xa530('0x68')]);}else if(this[_0xa530('0x2d')](_0x5ddaa7['variable'][_0xa530('0x69')])){this['channels'][_0x5ddaa7['uniqueid']][_0xa530('0x59')]=_0x5ddaa7['value'];}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x6a')])){this[_0xa530('0x33')][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0x6b')]=_0x5ddaa7['value'];}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x6c')])){this[_0xa530('0x33')][_0x5ddaa7['uniqueid']]['type']=_0x5ddaa7[_0xa530('0x68')];}else if(this[_0xa530('0x2d')](_0x5ddaa7['variable'][_0xa530('0x6d')])){this['channels'][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0xf')]=_0x5ddaa7[_0xa530('0x68')]['split'](',')[0x0];}else if(this[_0xa530('0x2d')](_0x5ddaa7['variable'][_0xa530('0x6e')])){this[_0xa530('0x33')][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0x6f')]=_0x5ddaa7['value'];}else if(this['isNotNull'](_0x5ddaa7[_0xa530('0x67')]['xmd-destination'])){this['channels'][_0x5ddaa7['uniqueid']][_0xa530('0x70')]=_0x5ddaa7['value'];}else if(this['isNotNull'](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x71')])){this[_0xa530('0x33')][_0x5ddaa7['uniqueid']][_0xa530('0x72')]=_0x5ddaa7[_0xa530('0x68')];}else if(this['isNotNull'](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x73')])){this[_0xa530('0x33')][_0x5ddaa7[_0xa530('0x31')]]['queue']=_0x5ddaa7[_0xa530('0x68')];}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x74')])){this['channels'][_0x5ddaa7[_0xa530('0x31')]][_0xa530('0x75')]=_0x5ddaa7[_0xa530('0x68')];}}}else if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x76')])){if(_0x5ddaa7[_0xa530('0x68')]){var _0x519f7c=path[_0xa530('0x77')](_0x5ddaa7[_0xa530('0x68')])[_0xa530('0x44')];this[_0xa530('0x62')](_0x519f7c,_0x5ddaa7[_0xa530('0x68')]);}}else if(this['channels'][_0x5ddaa7[_0xa530('0x32')]]){if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')])){if(this[_0xa530('0x2d')](_0x5ddaa7[_0xa530('0x67')][_0xa530('0x74')])){this[_0xa530('0x33')][_0x5ddaa7['linkedid']]['sipcalllinkedid']=_0x5ddaa7['value'];}}}}}catch(_0x5597fc){logger['error']('[syncVarSet][VoiceCallReport]',util[_0xa530('0x47')](_0x5597fc,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa530('0x78')]=function(_0x4d51a8){try{if(this[_0xa530('0x2d')](_0x4d51a8)){if(this['channels'][_0x4d51a8[_0xa530('0x31')]]){var _0x372db9=moment();this['channels'][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x79')]=_0x372db9[_0xa530('0x3a')](_0xa530('0x3b'));this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x4c')]=_0x372db9[_0xa530('0x58')](this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x39')],_0xa530('0x4e'));if(this['channels'][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x55')]){this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x7a')]=_0x372db9[_0xa530('0x58')](this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]]['answertime'],_0xa530('0x4e'));this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x57')]=this['channels'][_0x4d51a8['uniqueid']][_0xa530('0x4c')]-this['channels'][_0x4d51a8[_0xa530('0x31')]][_0xa530('0x7a')];}if(_0x4d51a8['context']===_0xa530('0x3f')){if(this['agents'][_0x4d51a8[_0xa530('0x37')]['split']('-')[0x0]]){this[_0xa530('0x18')][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]]=_[_0xa530('0x7b')](this[_0xa530('0x18')][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]],[_0xa530('0x41')]);this['emit'](util[_0xa530('0x3a')](_0xa530('0x43'),this[_0xa530('0x18')][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]]['name']),_0xa530('0x7c'),{'destaccountcode':this['agents'][_0x4d51a8[_0xa530('0x37')][_0xa530('0x40')]('-')[0x0]][_0xa530('0x45')]});}}ami[_0xa530('0x30')](_0xa530('0x7d'),this[_0xa530('0x33')][_0x4d51a8[_0xa530('0x31')]]);delete this['channels'][_0x4d51a8[_0xa530('0x31')]];}}}catch(_0x4ae645){logger[_0xa530('0x36')](_0xa530('0x7e'),util[_0xa530('0x47')](_0x4ae645,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x23')]=function(_0x10a7ff){try{if(this[_0xa530('0x2d')](_0x10a7ff)){if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]]){this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]][_0xa530('0x80')]=_0x10a7ff[_0xa530('0x81')];this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]][_0xa530('0x82')]=_0x10a7ff[_0xa530('0x83')];if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x84')]]){var _0x10e353=this[_0xa530('0x33')][_0x10a7ff['secondtransfereruniqueid']];this[_0xa530('0x33')][_0x10a7ff['secondtransfereruniqueid']]=this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]];this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x7f')]]=_0x10e353;}}else if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x85')]]){this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x85')]][_0xa530('0x80')]=_0x10a7ff[_0xa530('0x81')];this[_0xa530('0x33')][_0x10a7ff['transfertargetuniqueid']][_0xa530('0x82')]=_0x10a7ff[_0xa530('0x83')];if(this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x86')]]){var _0x10e353=this[_0xa530('0x33')][_0x10a7ff['origtransfereruniqueid']];this[_0xa530('0x33')][_0x10a7ff[_0xa530('0x86')]]=this[_0xa530('0x33')][_0x10a7ff['transfertargetuniqueid']];this['channels'][_0x10a7ff[_0xa530('0x85')]]=_0x10e353;}}}}catch(_0x25fd8b){logger[_0xa530('0x36')](_0xa530('0x87'),util[_0xa530('0x47')](_0x25fd8b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')][_0xa530('0x24')]=function(_0x59a7f2){try{if(this[_0xa530('0x2d')](_0x59a7f2)){if(this[_0xa530('0x33')][_0x59a7f2[_0xa530('0x7f')]]){this[_0xa530('0x33')][_0x59a7f2[_0xa530('0x7f')]][_0xa530('0x80')]=_0x59a7f2[_0xa530('0x88')];this[_0xa530('0x33')][_0x59a7f2[_0xa530('0x7f')]][_0xa530('0x82')]=_0x59a7f2[_0xa530('0x89')];this[_0xa530('0x78')]({'event':_0xa530('0x8a'),'uniqueid':_0x59a7f2['transfereeuniqueid'],'context':_0x59a7f2['context'],'channel':_0x59a7f2[_0xa530('0x8b')]});}}}catch(_0x1772ec){logger['error'](_0xa530('0x8c'),util[_0xa530('0x47')](_0x1772ec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa530('0x2f')]['syncMusicOnHoldStart']=function(_0x57ee2a){try{if(this[_0xa530('0x2d')](_0x57ee2a)){if(this[_0xa530('0x33')][_0x57ee2a[_0xa530('0x31')]]){if(!_[_0xa530('0x66')](this[_0xa530('0x33')][_0x57ee2a[_0xa530('0x31')]][_0xa530('0x56')])){this['channels'][_0x57ee2a['uniqueid']][_0xa530('0x8d')]=moment()[_0xa530('0x3a')](_0xa530('0x3b'));}}}}catch(_0xd1a6a4){logger[_0xa530('0x36')](_0xa530('0x8e'),util[_0xa530('0x47')](_0xd1a6a4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa530('0x28')]=function(_0x5ca8f2){try{if(this[_0xa530('0x2d')](_0x5ca8f2)){if(this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]]){if(!_['isNil'](this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]][_0xa530('0x8d')])){this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]][_0xa530('0x8f')]+=moment()[_0xa530('0x90')](0x0)[_0xa530('0x58')](this[_0xa530('0x33')][_0x5ca8f2[_0xa530('0x31')]]['mohstarttime'],_0xa530('0x4e'));delete this['channels'][_0x5ca8f2['uniqueid']][_0xa530('0x8d')];}}}}catch(_0x5d56a4){logger[_0xa530('0x36')](_0xa530('0x91'),util[_0xa530('0x47')](_0x5d56a4,{'showHidden':![],'depth':null}));}};module[_0xa530('0x92')]=VoiceCallReport; \ No newline at end of file +var _0xa306=['BlindTransfer','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','syncNewState','varset','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','then','actionCoreShowChannels','catch','isNotNull','isUndefined','prototype','emit','linkedid','uniqueid','keys','error','inspect','channel','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','pick','context','split','destconnectedlinenum','exten','format','user:%s','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','duration','seconds','lastapplication','startsWith','match','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','syncVarSet','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','answertime','from-sip','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0xa306,0x1cf));var _0x6a30=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xa306[_0x5cb1af];return _0x8d7940;};'use strict';var BPromise=require(_0x6a30('0x0'));var _=require(_0x6a30('0x1'));var moment=require(_0x6a30('0x2'));var util=require('util');var path=require(_0x6a30('0x3'));var Redis=require('ioredis');var config=require(_0x6a30('0x4'));var logger=require(_0x6a30('0x5'))(_0x6a30('0x6'));var ami=require(_0x6a30('0x7'));var Channel=require(_0x6a30('0x8'));var statusDesc=[_0x6a30('0x9'),_0x6a30('0xa'),_0x6a30('0xb'),_0x6a30('0xc'),_0x6a30('0xd'),'unavailable',_0x6a30('0xe'),_0x6a30('0xf'),_0x6a30('0x10')];var applications=[_0x6a30('0x11'),_0x6a30('0x12'),_0x6a30('0x13'),'dial',_0x6a30('0x14'),_0x6a30('0x15')];var dispositions=['NO\x20ANSWER','FAILED',_0x6a30('0x16'),_0x6a30('0x17'),_0x6a30('0x17'),'NO\x20ANSWER','ANSWERED',_0x6a30('0x18'),'FAILED',_0x6a30('0x16'),'FAILED'];var actions={};config[_0x6a30('0x19')]=_['defaults'](config[_0x6a30('0x19')],{'host':_0x6a30('0x1a'),'port':0x18eb});var io=require(_0x6a30('0x1b'))(new Redis(config[_0x6a30('0x19')]));function VoiceCallReport(_0x499a2b){this['channels']=_0x499a2b[_0x6a30('0x1c')];this[_0x6a30('0x1d')]=_0x499a2b[_0x6a30('0x1d')];ami['on'](_0x6a30('0x1e'),this[_0x6a30('0x1f')][_0x6a30('0x20')](this));ami['on']('newexten',this[_0x6a30('0x1f')][_0x6a30('0x20')](this));ami['on'](_0x6a30('0x21'),this[_0x6a30('0x22')][_0x6a30('0x20')](this));ami['on']('newstate',this[_0x6a30('0x23')][_0x6a30('0x20')](this));ami['on'](_0x6a30('0x24'),this['syncVarSet'][_0x6a30('0x20')](this));ami['on']('hangup',this[_0x6a30('0x25')]['bind'](this));ami['on'](_0x6a30('0x26'),this[_0x6a30('0x27')]['bind'](this));ami['on'](_0x6a30('0x28'),this['syncAttendedTransfer'][_0x6a30('0x20')](this));ami['on']('blindtransfer',this[_0x6a30('0x29')]['bind'](this));ami['on'](_0x6a30('0x2a'),this[_0x6a30('0x2b')][_0x6a30('0x20')](this));ami['on'](_0x6a30('0x2c'),this['syncMusicOnHoldStop'][_0x6a30('0x20')](this));return BPromise[_0x6a30('0x2d')]()[_0x6a30('0x2e')](ami[_0x6a30('0x2f')]())[_0x6a30('0x30')](function(_0x9961c0){console['log'](_0x9961c0);});}VoiceCallReport['prototype'][_0x6a30('0x31')]=function(_0x1fc5ce){return _0x1fc5ce!==null&&!_[_0x6a30('0x32')](_0x1fc5ce);};VoiceCallReport[_0x6a30('0x33')]['emit']=function(_0x8ac750,_0x393241,_0x30d8a5){io['to'](_0x8ac750)[_0x6a30('0x34')](_0x393241,_0x30d8a5);};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x27')]=function(_0x528884){try{if(this[_0x6a30('0x31')](_0x528884)){if(_0x528884['uniqueid']===_0x528884[_0x6a30('0x35')]){if(!_['isUndefined'](this[_0x6a30('0x1c')][_0x528884[_0x6a30('0x36')]])){_['merge'](this[_0x6a30('0x1c')][_0x528884[_0x6a30('0x36')]],_['pick'](_0x528884,_[_0x6a30('0x37')](this[_0x6a30('0x1c')][_0x528884[_0x6a30('0x36')]])));}}}}catch(_0x55cae0){logger[_0x6a30('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0x6a30('0x39')](_0x55cae0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x22')]=function(_0x2d510e){try{if(this[_0x6a30('0x31')](_0x2d510e)){if(_0x2d510e[_0x6a30('0x36')]===_0x2d510e[_0x6a30('0x35')]&&_0x2d510e[_0x6a30('0x3a')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x6a30('0x1c')][_0x2d510e['uniqueid']])){this[_0x6a30('0x1c')][_0x2d510e['uniqueid']]=new Channel();this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]][_0x6a30('0x3b')]=moment()['format'](_0x6a30('0x3c'));this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]][_0x6a30('0x3d')]=dispositions[_[_0x6a30('0x3e')](_0x2d510e[_0x6a30('0x3f')])];_[_0x6a30('0x40')](this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]],_[_0x6a30('0x41')](_0x2d510e,_[_0x6a30('0x37')](this[_0x6a30('0x1c')][_0x2d510e[_0x6a30('0x36')]])));if(_0x2d510e[_0x6a30('0x42')]==='from-sip'){if(this[_0x6a30('0x1d')][_0x2d510e[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]){this[_0x6a30('0x1d')][_0x2d510e['channel'][_0x6a30('0x43')]('-')[0x0]][_0x6a30('0x44')]=_0x2d510e[_0x6a30('0x45')];this[_0x6a30('0x34')](util[_0x6a30('0x46')](_0x6a30('0x47'),this['agents'][_0x2d510e[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x6a30('0x1d')][_0x2d510e[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2d510e[_0x6a30('0x45')]});}}}}}}catch(_0x4ab403){logger[_0x6a30('0x38')](_0x6a30('0x48'),util[_0x6a30('0x39')](_0x4ab403,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x1f')]=function(_0x45374a){try{if(this[_0x6a30('0x31')](_0x45374a)){if(_0x45374a['uniqueid']===_0x45374a[_0x6a30('0x35')]&&_0x45374a[_0x6a30('0x45')]!='h'&&_0x45374a['channel']!=_0x6a30('0x49')){_0x45374a[_0x6a30('0x4a')]=_0x45374a[_0x6a30('0x4a')]['toLowerCase']();_0x45374a['applicationdata']=(_0x45374a[_0x6a30('0x4b')]||_0x45374a[_0x6a30('0x4c')])[_0x6a30('0x4d')]();if(_[_0x6a30('0x32')](this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]])){this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]]=new Channel();this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]][_0x6a30('0x3b')]=_0x45374a[_0x6a30('0x4e')]?moment()['subtract'](moment[_0x6a30('0x4e')](_0x45374a['duration'])[_0x6a30('0x4f')](),_0x6a30('0x4f'))[_0x6a30('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x6a30('0x3c'));this['channels'][_0x45374a[_0x6a30('0x36')]]['disposition']='NO\x20ANSWER';}_[_0x6a30('0x40')](this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]],_[_0x6a30('0x41')](_0x45374a,_['keys'](this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]])));if(_['includes'](applications,_0x45374a[_0x6a30('0x4a')])){this['channels'][_0x45374a['uniqueid']][_0x6a30('0x50')]=_0x45374a[_0x6a30('0x4a')];this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]]['lastdata']=_0x45374a['applicationdata'];if(_0x45374a['application']===_0x6a30('0x11')&&_[_0x6a30('0x51')](_0x45374a['applicationdata'],'cdr(')){var _0x1df113=_0x45374a['applicationdata'][_0x6a30('0x43')]('=');var _0x28261f=_0x1df113[0x0][_0x6a30('0x52')](/cdr\((.*)\)/);if(_0x28261f){this[_0x6a30('0x1c')][_0x45374a[_0x6a30('0x36')]][_0x28261f[0x1]]=_0x1df113[0x1];}}else if(_0x45374a[_0x6a30('0x4a')]===_0x6a30('0x12')){this[_0x6a30('0x1c')][_0x45374a['uniqueid']][_0x6a30('0x12')]=_0x45374a[_0x6a30('0x4c')][_0x6a30('0x43')](',')[0x0];}}}}}catch(_0x2e771d){logger[_0x6a30('0x38')](_0x6a30('0x53'),util[_0x6a30('0x39')](_0x2e771d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')]['syncNewState']=function(_0x14cf19){try{if(this[_0x6a30('0x31')](_0x14cf19)){if(_0x14cf19[_0x6a30('0x36')]!==_0x14cf19[_0x6a30('0x35')]){if(this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]]){if(_0x14cf19[_0x6a30('0x3f')]==='6'){if(!this[_0x6a30('0x1c')][_0x14cf19['linkedid']][_0x6a30('0x54')]){var _0x45c419=moment();this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x54')]=!![];this['channels'][_0x14cf19['linkedid']]['answertime']=_0x45c419[_0x6a30('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6a30('0x1c')][_0x14cf19['linkedid']][_0x6a30('0x3b')]){this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x55')]=_0x45c419[_0x6a30('0x56')](this['channels'][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x3b')],'seconds');}}this[_0x6a30('0x1c')][_0x14cf19['linkedid']][_0x6a30('0x35')]=_0x14cf19['uniqueid'];if(_0x14cf19[_0x6a30('0x57')]!==_0x6a30('0x58')){this['channels'][_0x14cf19['linkedid']][_0x6a30('0x59')]=_0x14cf19[_0x6a30('0x57')];}this['channels'][_0x14cf19['linkedid']][_0x6a30('0x5a')]=_0x14cf19[_0x6a30('0x5b')];this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x5c')]=_0x14cf19[_0x6a30('0x3a')];this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x3d')]=dispositions[_[_0x6a30('0x3e')](_0x14cf19[_0x6a30('0x3f')])];if(this['agents'][_0x14cf19[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]){this['channels'][_0x14cf19['linkedid']][_0x6a30('0x5d')]=this[_0x6a30('0x1d')][_0x14cf19[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]]['id'];this['channels'][_0x14cf19[_0x6a30('0x35')]][_0x6a30('0x5e')]=this['agents'][_0x14cf19[_0x6a30('0x3a')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x36')]]){if(_0x14cf19[_0x6a30('0x3f')]==='6'){if(this[_0x6a30('0x1d')][_0x14cf19['channel'][_0x6a30('0x43')]('-')[0x0]]){this[_0x6a30('0x1c')][_0x14cf19[_0x6a30('0x36')]]['UserId']=this[_0x6a30('0x1d')][_0x14cf19[_0x6a30('0x3a')]['split']('-')[0x0]]['id'];this['channels'][_0x14cf19['uniqueid']][_0x6a30('0x5e')]=this[_0x6a30('0x1d')][_0x14cf19[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]][_0x6a30('0x5f')];}}}}}}catch(_0x486b08){logger[_0x6a30('0x38')](_0x6a30('0x60'),util[_0x6a30('0x39')](_0x486b08,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x61')]=function(_0x5b4732,_0x332e86){if(this[_0x6a30('0x1c')][_0x5b4732]){this[_0x6a30('0x1c')][_0x5b4732][_0x6a30('0x62')]=!![];if(_[_0x6a30('0x63')](_0x332e86,_0x6a30('0x64'))){_0x332e86=_0x332e86[_0x6a30('0x65')]('.wav49',_0x6a30('0x66'));}this[_0x6a30('0x1c')][_0x5b4732]['monitorFilename']=_0x332e86;var _0x3034f0=_[_0x6a30('0x67')](this[_0x6a30('0x1c')][_0x5b4732][_0x6a30('0x68')],{'filename':_0x332e86});if(_[_0x6a30('0x69')](_0x3034f0)){this[_0x6a30('0x1c')][_0x5b4732][_0x6a30('0x68')][_0x6a30('0x6a')]({'filename':_0x332e86,'createdAt':moment()[_0x6a30('0x46')](_0x6a30('0x3c')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x6b')]=function(_0x52e274){try{if(this[_0x6a30('0x31')](_0x52e274)){if(this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]]&&_0x52e274[_0x6a30('0x3a')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')])){if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x6d')])){this[_0x6a30('0x61')](_0x52e274[_0x6a30('0x36')],_0x52e274[_0x6a30('0x6e')]);}else if(this['isNotNull'](_0x52e274['variable'][_0x6a30('0x6f')])){this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]]['calleridnum']=_0x52e274[_0x6a30('0x6e')];}else if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x70')])){this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]]['callerid']=_0x52e274[_0x6a30('0x6e')];}else if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x71')])){this['channels'][_0x52e274['uniqueid']][_0x6a30('0x72')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x73')])){this[_0x6a30('0x1c')][_0x52e274['uniqueid']][_0x6a30('0x12')]=_0x52e274[_0x6a30('0x6e')][_0x6a30('0x43')](',')[0x0];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x74')])){this['channels'][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x75')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x76')])){this[_0x6a30('0x1c')][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x77')]=_0x52e274[_0x6a30('0x6e')];}else if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x78')])){this['channels'][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x79')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x7a')])){this['channels'][_0x52e274[_0x6a30('0x36')]][_0x6a30('0x12')]=_0x52e274[_0x6a30('0x6e')];}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x7b')])){this[_0x6a30('0x1c')][_0x52e274['uniqueid']][_0x6a30('0x7c')]=_0x52e274['value'];}}}else if(this[_0x6a30('0x31')](_0x52e274[_0x6a30('0x6c')]['mixmonitor_filename'])){if(_0x52e274[_0x6a30('0x6e')]){var _0x3e880b=path[_0x6a30('0x7d')](_0x52e274[_0x6a30('0x6e')])[_0x6a30('0x5f')];this[_0x6a30('0x61')](_0x3e880b,_0x52e274[_0x6a30('0x6e')]);}}else if(this['channels'][_0x52e274[_0x6a30('0x35')]]){if(this['isNotNull'](_0x52e274['variable'])){if(this['isNotNull'](_0x52e274[_0x6a30('0x6c')][_0x6a30('0x7b')])){this['channels'][_0x52e274[_0x6a30('0x35')]][_0x6a30('0x7e')]=_0x52e274[_0x6a30('0x6e')];}}}}}catch(_0xead73c){logger['error'](_0x6a30('0x7f'),util[_0x6a30('0x39')](_0xead73c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x25')]=function(_0x469a72){try{if(this[_0x6a30('0x31')](_0x469a72)){if(this['channels'][_0x469a72[_0x6a30('0x36')]]){var _0x7d3b4=moment();this['channels'][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x80')]=_0x7d3b4[_0x6a30('0x46')](_0x6a30('0x3c'));this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x4e')]=_0x7d3b4[_0x6a30('0x56')](this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]]['starttime'],'seconds');if(this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x54')]){this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x81')]=_0x7d3b4[_0x6a30('0x56')](this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x82')],'seconds');this[_0x6a30('0x1c')][_0x469a72['uniqueid']][_0x6a30('0x55')]=this[_0x6a30('0x1c')][_0x469a72['uniqueid']][_0x6a30('0x4e')]-this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]][_0x6a30('0x81')];}if(_0x469a72[_0x6a30('0x42')]===_0x6a30('0x83')){if(this['agents'][_0x469a72[_0x6a30('0x3a')]['split']('-')[0x0]]){this[_0x6a30('0x1d')][_0x469a72['channel'][_0x6a30('0x43')]('-')[0x0]]=_['omit'](this[_0x6a30('0x1d')][_0x469a72[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]],[_0x6a30('0x44')]);this['emit'](util[_0x6a30('0x46')](_0x6a30('0x47'),this[_0x6a30('0x1d')][_0x469a72[_0x6a30('0x3a')]['split']('-')[0x0]][_0x6a30('0x5f')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x469a72[_0x6a30('0x3a')][_0x6a30('0x43')]('-')[0x0]][_0x6a30('0x84')]});}}ami[_0x6a30('0x34')](_0x6a30('0x85'),this['channels'][_0x469a72[_0x6a30('0x36')]]);delete this[_0x6a30('0x1c')][_0x469a72[_0x6a30('0x36')]];}}}catch(_0x55420b){logger[_0x6a30('0x38')](_0x6a30('0x86'),util[_0x6a30('0x39')](_0x55420b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')]['syncAttendedTransfer']=function(_0x2e6897){try{if(this[_0x6a30('0x31')](_0x2e6897)){if(this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x87')]]){this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x87')]][_0x6a30('0x88')]=_0x2e6897[_0x6a30('0x89')];this['channels'][_0x2e6897[_0x6a30('0x87')]][_0x6a30('0x8a')]=_0x2e6897[_0x6a30('0x8b')];if(this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8c')]]){var _0x1e8f56=this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8c')]];this[_0x6a30('0x1c')][_0x2e6897['secondtransfereruniqueid']]=this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x87')]];this['channels'][_0x2e6897['transfereeuniqueid']]=_0x1e8f56;}}else if(this[_0x6a30('0x1c')][_0x2e6897['transfertargetuniqueid']]){this[_0x6a30('0x1c')][_0x2e6897['transfertargetuniqueid']][_0x6a30('0x88')]=_0x2e6897['origtransferercalleridnum'];this['channels'][_0x2e6897[_0x6a30('0x8d')]][_0x6a30('0x8a')]=_0x2e6897[_0x6a30('0x8b')];if(this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8e')]]){var _0x1e8f56=this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8e')]];this['channels'][_0x2e6897[_0x6a30('0x8e')]]=this['channels'][_0x2e6897[_0x6a30('0x8d')]];this[_0x6a30('0x1c')][_0x2e6897[_0x6a30('0x8d')]]=_0x1e8f56;}}}}catch(_0x3d9521){logger[_0x6a30('0x38')](_0x6a30('0x8f'),util[_0x6a30('0x39')](_0x3d9521,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x29')]=function(_0x151052){try{if(this[_0x6a30('0x31')](_0x151052)){if(this[_0x6a30('0x1c')][_0x151052[_0x6a30('0x87')]]){this[_0x6a30('0x1c')][_0x151052['transfereeuniqueid']]['transfercalleridnum']=_0x151052[_0x6a30('0x90')];this[_0x6a30('0x1c')][_0x151052['transfereeuniqueid']][_0x6a30('0x8a')]=_0x151052['extension'];this['syncHangup']({'event':_0x6a30('0x91'),'uniqueid':_0x151052[_0x6a30('0x87')],'context':_0x151052[_0x6a30('0x42')],'channel':_0x151052[_0x6a30('0x92')]});}}}catch(_0x48d13f){logger['error']('[syncBlindTransfer][VoiceCallReport]',util[_0x6a30('0x39')](_0x48d13f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x2b')]=function(_0xe11329){try{if(this[_0x6a30('0x31')](_0xe11329)){if(this['channels'][_0xe11329[_0x6a30('0x36')]]){if(!_[_0x6a30('0x69')](this[_0x6a30('0x1c')][_0xe11329['uniqueid']][_0x6a30('0x82')])){this['channels'][_0xe11329['uniqueid']][_0x6a30('0x93')]=moment()[_0x6a30('0x46')](_0x6a30('0x3c'));}}}}catch(_0x4d2db6){logger[_0x6a30('0x38')](_0x6a30('0x94'),util[_0x6a30('0x39')](_0x4d2db6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a30('0x33')][_0x6a30('0x95')]=function(_0x644af5){try{if(this[_0x6a30('0x31')](_0x644af5)){if(this[_0x6a30('0x1c')][_0x644af5[_0x6a30('0x36')]]){if(!_[_0x6a30('0x69')](this[_0x6a30('0x1c')][_0x644af5['uniqueid']][_0x6a30('0x93')])){this[_0x6a30('0x1c')][_0x644af5['uniqueid']]['mohtime']+=moment()['milliseconds'](0x0)['diff'](this[_0x6a30('0x1c')][_0x644af5[_0x6a30('0x36')]]['mohstarttime'],_0x6a30('0x4f'));delete this[_0x6a30('0x1c')][_0x644af5['uniqueid']][_0x6a30('0x93')];}}}}catch(_0x5dca5e){logger[_0x6a30('0x38')](_0x6a30('0x96'),util[_0x6a30('0x39')](_0x5dca5e,{'showHidden':![],'depth':null}));}};module[_0x6a30('0x97')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 2acb28f..4856734 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 _0xe5ef=['addVariable','value','variable','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','starttime','seconds','lastevent','complete','total','answertime','answered','holdtime','billableseconds','sumBillable','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','outbound','variables','syncDialBegin','dialend','syncDialEnd','varset','syncVarSet','bind','hangup','syncHangup','prototype','isUndefined','emit','uniqueid','merge','channels','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','error','inspect','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]'];(function(_0x4128ff,_0x2ac10f){var _0x316caf=function(_0x537a15){while(--_0x537a15){_0x4128ff['push'](_0x4128ff['shift']());}};_0x316caf(++_0x2ac10f);}(_0xe5ef,0x13a));var _0xfe5e=function(_0x306767,_0x5f0270){_0x306767=_0x306767-0x0;var _0x521324=_0xe5ef[_0x306767];return _0x521324;};'use strict';var _=require(_0xfe5e('0x0'));var moment=require(_0xfe5e('0x1'));var util=require(_0xfe5e('0x2'));var Redis=require(_0xfe5e('0x3'));var config=require('../../../config/environment');var logger=require(_0xfe5e('0x4'))(_0xfe5e('0x5'));var ami=require(_0xfe5e('0x6'));config['redis']=_['defaults'](config[_0xfe5e('0x7')],{'host':_0xfe5e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe5e('0x7')]));function VoiceDialReport(_0xd0aaac){this['channels']=_0xd0aaac['outboundChannels'];this[_0xfe5e('0x9')]=_0xd0aaac[_0xfe5e('0x9')];this[_0xfe5e('0xa')]={};ami['on']('dialbegin',this[_0xfe5e('0xb')]['bind'](this));ami['on'](_0xfe5e('0xc'),this[_0xfe5e('0xd')]['bind'](this));ami['on'](_0xfe5e('0xe'),this[_0xfe5e('0xf')][_0xfe5e('0x10')](this));ami['on'](_0xfe5e('0x11'),this[_0xfe5e('0x12')][_0xfe5e('0x10')](this));}VoiceDialReport[_0xfe5e('0x13')]['isNotNull']=function(_0x3c736c){return _0x3c736c!==null&&!_[_0xfe5e('0x14')](_0x3c736c);};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0x15')]=function(_0x3153dd,_0x380ae4,_0x42dfcb){io['to'](_0x3153dd)[_0xfe5e('0x15')](_0x380ae4,_0x42dfcb);};VoiceDialReport[_0xfe5e('0x13')]['syncDialBegin']=function(_0x351bbf){try{if(this['isNotNull'](_0x351bbf)){if(this['channels'][_0x351bbf[_0xfe5e('0x16')]]){_[_0xfe5e('0x17')](this[_0xfe5e('0x18')][_0x351bbf['uniqueid']],{'starttime':moment()[_0xfe5e('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xfe5e('0x1a'),'interface':_0x351bbf[_0xfe5e('0x1b')][_0xfe5e('0x1c')](0x0,_0x351bbf[_0xfe5e('0x1b')][_0xfe5e('0x1d')]('-')),'membername':_0x351bbf[_0xfe5e('0x1b')][_0xfe5e('0x1c')](_0x351bbf['channel'][_0xfe5e('0x1d')]('/')+0x1,_0x351bbf[_0xfe5e('0x1b')]['lastIndexOf']('-'))},_[_0xfe5e('0x1e')](_0x351bbf,[_0xfe5e('0x1f'),_0xfe5e('0x20')]));this[_0xfe5e('0x15')](_0xfe5e('0x21'),_0xfe5e('0x22'),this['channels'][_0x351bbf[_0xfe5e('0x16')]]);ami[_0xfe5e('0x15')]('custom:dialbegin',this[_0xfe5e('0x18')][_0x351bbf['uniqueid']]);}}}catch(_0x1dfe30){logger[_0xfe5e('0x23')]('[syncDialBegin][VoiceDialReport]',util[_0xfe5e('0x24')](_0x1dfe30,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0xd')]=function(_0xcaa88a){try{if(this[_0xfe5e('0x25')](_0xcaa88a)){if(this['channels'][_0xcaa88a[_0xfe5e('0x16')]]){this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]][_0xfe5e('0x26')]=_0xcaa88a[_0xfe5e('0x26')];if(_0xcaa88a[_0xfe5e('0x26')]===_0xfe5e('0x27')){this['channels'][_0xcaa88a[_0xfe5e('0x16')]][_0xfe5e('0x28')]=_0xcaa88a[_0xfe5e('0x28')];this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]][_0xfe5e('0x29')]=_0xcaa88a['connectedlinename'];this['channels'][_0xcaa88a[_0xfe5e('0x16')]]['answertime']=moment()[_0xfe5e('0x19')](_0xfe5e('0x2a'));this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]]['lastevent']=_0xfe5e('0x2b');ami[_0xfe5e('0x15')](_0xfe5e('0x2c'),this[_0xfe5e('0x18')][_0xcaa88a[_0xfe5e('0x16')]]);}this[_0xfe5e('0x15')](_0xfe5e('0x21'),_0xfe5e('0x22'),this['channels'][_0xcaa88a[_0xfe5e('0x16')]]);}}}catch(_0x96051f){logger[_0xfe5e('0x23')](_0xfe5e('0x2d'),util[_0xfe5e('0x24')](_0x96051f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0xf')]=function(_0x3800c3){try{if(this['isNotNull'](_0x3800c3)){this[_0xfe5e('0x2e')](_0x3800c3[_0xfe5e('0x16')],_['keys'](_0x3800c3['variable'])[0x0],_0x3800c3[_0xfe5e('0x2f')]);if(this[_0xfe5e('0x25')](_0x3800c3[_0xfe5e('0x30')])&&this[_0xfe5e('0x25')](_0x3800c3[_0xfe5e('0x30')][_0xfe5e('0x31')])){if(_['isUndefined'](this['channels'][_0x3800c3['uniqueid']])){this['channels'][_0x3800c3['uniqueid']]={'routeId':_0x3800c3[_0xfe5e('0x2f')],'variables':this[_0xfe5e('0xa')][_0x3800c3[_0xfe5e('0x16')]]};this[_0xfe5e('0x15')](_0xfe5e('0x21'),'voice_outbound_channel:save',this[_0xfe5e('0x18')][_0x3800c3[_0xfe5e('0x16')]]);}}}}catch(_0x13601e){logger[_0xfe5e('0x23')](_0xfe5e('0x32'),util[_0xfe5e('0x24')](_0x13601e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0x2e')]=function(_0x1dffac,_0x4c3477,_0x16983b){var _0x5ea733=[_0xfe5e('0x33'),_0xfe5e('0x34'),_0xfe5e('0x35'),'rtpaudioqosjitterbridged',_0xfe5e('0x36'),_0xfe5e('0x37'),'rtpaudioqosrtt',_0xfe5e('0x38'),_0xfe5e('0x39'),_0xfe5e('0x3a'),_0xfe5e('0x3b'),_0xfe5e('0x3c'),_0xfe5e('0x3d'),_0xfe5e('0x3e'),_0xfe5e('0x3f'),_0xfe5e('0x40'),'membername',_0xfe5e('0x41'),_0xfe5e('0x42')];if(!_[_0xfe5e('0x43')](_0x4c3477)&&!_[_0xfe5e('0x44')](_0x5ea733,_0x4c3477)){if(_['isUndefined'](this[_0xfe5e('0xa')][_0x1dffac])){this[_0xfe5e('0xa')][_0x1dffac]={};}this[_0xfe5e('0xa')][_0x1dffac][_0x4c3477]=_0x16983b;}};VoiceDialReport[_0xfe5e('0x13')][_0xfe5e('0x12')]=function(_0x53e698){try{if(this['isNotNull'](_0x53e698)){if(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]){this['channels'][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x45')]=moment()[_0xfe5e('0x19')](_0xfe5e('0x2a'));this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x46')]=moment(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x45')])[_0xfe5e('0x47')](this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x48')],_0xfe5e('0x49'));this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x4a')]=_0xfe5e('0x4b');this[_0xfe5e('0x9')][_0xfe5e('0x4c')]+=0x1;if(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x4d')]){this[_0xfe5e('0x9')][_0xfe5e('0x4e')]+=0x1;this['channels'][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x4f')]=moment(this[_0xfe5e('0x18')][_0x53e698['uniqueid']][_0xfe5e('0x4d')])[_0xfe5e('0x47')](this['channels'][_0x53e698[_0xfe5e('0x16')]][_0xfe5e('0x48')],'seconds');this[_0xfe5e('0x18')][_0x53e698['uniqueid']][_0xfe5e('0x50')]=moment(this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]['endtime'])[_0xfe5e('0x47')](this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]['answertime'],_0xfe5e('0x49'));this['outbound']['sumHoldTime']+=this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]['holdtime']||0x0;this['outbound'][_0xfe5e('0x51')]+=this['channels'][_0x53e698['uniqueid']][_0xfe5e('0x50')];}this[_0xfe5e('0x9')]['sumDuration']+=this[_0xfe5e('0x18')][_0x53e698['uniqueid']][_0xfe5e('0x46')];ami[_0xfe5e('0x15')](_0xfe5e('0x52'),this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]);ami[_0xfe5e('0x15')](_0xfe5e('0x53'),this['channels'][_0x53e698[_0xfe5e('0x16')]]);this[_0xfe5e('0x15')]('voice:outbound',_0xfe5e('0x54'),this['outbound']);logger[_0xfe5e('0x55')](_0xfe5e('0x56'),JSON['stringify'](this[_0xfe5e('0x18')][_0x53e698['uniqueid']]));this[_0xfe5e('0x15')](_0xfe5e('0x21'),_0xfe5e('0x57'),this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]]);delete this[_0xfe5e('0x18')][_0x53e698[_0xfe5e('0x16')]];}if(this[_0xfe5e('0xa')][_0x53e698[_0xfe5e('0x16')]]){delete this[_0xfe5e('0xa')][_0x53e698['uniqueid']];}}}catch(_0x45daf6){logger['error'](_0xfe5e('0x58'),util[_0xfe5e('0x24')](_0x45daf6,{'showHidden':![],'depth':null}));}};module[_0xfe5e('0x59')]=VoiceDialReport; \ No newline at end of file +var _0xdedf=['sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','defaults','redis','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','custom:dialconnect','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','endtime','duration','diff','starttime','seconds','lastevent','complete','total','billableseconds','sumHoldTime','holdtime','sumBillable'];(function(_0x4cb322,_0x505daf){var _0x25be4b=function(_0x944c96){while(--_0x944c96){_0x4cb322['push'](_0x4cb322['shift']());}};_0x25be4b(++_0x505daf);}(_0xdedf,0x17a));var _0xfded=function(_0x2f0597,_0x269561){_0x2f0597=_0x2f0597-0x0;var _0x2a0882=_0xdedf[_0x2f0597];return _0x2a0882;};'use strict';var _=require(_0xfded('0x0'));var moment=require(_0xfded('0x1'));var util=require('util');var Redis=require(_0xfded('0x2'));var config=require(_0xfded('0x3'));var logger=require(_0xfded('0x4'))(_0xfded('0x5'));var ami=require('../ami');config['redis']=_[_0xfded('0x6')](config[_0xfded('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfded('0x8'))(new Redis(config[_0xfded('0x7')]));function VoiceDialReport(_0x32fe31){this[_0xfded('0x9')]=_0x32fe31[_0xfded('0xa')];this[_0xfded('0xb')]=_0x32fe31['outbound'];this[_0xfded('0xc')]={};ami['on'](_0xfded('0xd'),this[_0xfded('0xe')][_0xfded('0xf')](this));ami['on']('dialend',this[_0xfded('0x10')][_0xfded('0xf')](this));ami['on'](_0xfded('0x11'),this[_0xfded('0x12')][_0xfded('0xf')](this));ami['on']('hangup',this['syncHangup']['bind'](this));}VoiceDialReport[_0xfded('0x13')][_0xfded('0x14')]=function(_0x488e1a){return _0x488e1a!==null&&!_[_0xfded('0x15')](_0x488e1a);};VoiceDialReport[_0xfded('0x13')][_0xfded('0x16')]=function(_0x116b69,_0x40932c,_0x16803a){io['to'](_0x116b69)[_0xfded('0x16')](_0x40932c,_0x16803a);};VoiceDialReport[_0xfded('0x13')][_0xfded('0xe')]=function(_0x34ad7f){try{if(this[_0xfded('0x14')](_0x34ad7f)){if(this[_0xfded('0x9')][_0x34ad7f[_0xfded('0x17')]]){_[_0xfded('0x18')](this[_0xfded('0x9')][_0x34ad7f[_0xfded('0x17')]],{'starttime':moment()[_0xfded('0x19')](_0xfded('0x1a')),'lastevent':_0xfded('0x1b'),'interface':_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1d')](0x0,_0x34ad7f['channel'][_0xfded('0x1e')]('-')),'membername':_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1d')](_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1e')]('/')+0x1,_0x34ad7f[_0xfded('0x1c')][_0xfded('0x1e')]('-'))},_[_0xfded('0x1f')](_0x34ad7f,[_0xfded('0x20'),_0xfded('0x21')]));this[_0xfded('0x16')](_0xfded('0x22'),_0xfded('0x23'),this[_0xfded('0x9')][_0x34ad7f['uniqueid']]);ami[_0xfded('0x16')](_0xfded('0x24'),this[_0xfded('0x9')][_0x34ad7f[_0xfded('0x17')]]);}}}catch(_0x594b6e){logger[_0xfded('0x25')](_0xfded('0x26'),util[_0xfded('0x27')](_0x594b6e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfded('0x13')]['syncDialEnd']=function(_0x599346){try{if(this[_0xfded('0x14')](_0x599346)){if(this[_0xfded('0x9')][_0x599346['uniqueid']]){this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]['dialstatus']=_0x599346[_0xfded('0x28')];if(_0x599346[_0xfded('0x28')]===_0xfded('0x29')){this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]][_0xfded('0x2a')]=_0x599346[_0xfded('0x2a')];this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]][_0xfded('0x2b')]=_0x599346['connectedlinename'];this['channels'][_0x599346['uniqueid']][_0xfded('0x2c')]=moment()[_0xfded('0x19')](_0xfded('0x1a'));this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]['lastevent']=_0xfded('0x2d');ami[_0xfded('0x16')](_0xfded('0x2e'),this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]);}this[_0xfded('0x16')](_0xfded('0x22'),_0xfded('0x23'),this[_0xfded('0x9')][_0x599346[_0xfded('0x17')]]);}}}catch(_0x529500){logger['error']('[syncDialEnd][VoiceDialReport]',util[_0xfded('0x27')](_0x529500,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfded('0x13')][_0xfded('0x12')]=function(_0x2b7fef){try{if(this['isNotNull'](_0x2b7fef)){this[_0xfded('0x2f')](_0x2b7fef['uniqueid'],_[_0xfded('0x30')](_0x2b7fef[_0xfded('0x31')])[0x0],_0x2b7fef['value']);if(this[_0xfded('0x14')](_0x2b7fef[_0xfded('0x31')])&&this[_0xfded('0x14')](_0x2b7fef['variable']['outboundrouteid'])){if(_[_0xfded('0x15')](this['channels'][_0x2b7fef[_0xfded('0x17')]])){this[_0xfded('0x9')][_0x2b7fef[_0xfded('0x17')]]={'routeId':_0x2b7fef[_0xfded('0x32')],'variables':this['variables'][_0x2b7fef[_0xfded('0x17')]]};this[_0xfded('0x16')]('voice:outbound',_0xfded('0x23'),this[_0xfded('0x9')][_0x2b7fef['uniqueid']]);}}}}catch(_0x19a3e2){logger['error'](_0xfded('0x33'),util[_0xfded('0x27')](_0x19a3e2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfded('0x13')][_0xfded('0x2f')]=function(_0x11b114,_0x1275ac,_0x38712b){var _0x28d3eb=['rtpaudioqos',_0xfded('0x34'),'rtpaudioqosjitter',_0xfded('0x35'),_0xfded('0x36'),_0xfded('0x37'),_0xfded('0x38'),_0xfded('0x39'),_0xfded('0x3a'),'sipuri','bridgepeer',_0xfded('0x3b'),_0xfded('0x3c'),_0xfded('0x3d'),_0xfded('0x3e'),_0xfded('0x3f'),_0xfded('0x40'),_0xfded('0x41'),_0xfded('0x42')];if(!_[_0xfded('0x43')](_0x1275ac)&&!_[_0xfded('0x44')](_0x28d3eb,_0x1275ac)){if(_[_0xfded('0x15')](this[_0xfded('0xc')][_0x11b114])){this[_0xfded('0xc')][_0x11b114]={};}this['variables'][_0x11b114][_0x1275ac]=_0x38712b;}};VoiceDialReport['prototype'][_0xfded('0x45')]=function(_0x4b4c9e){try{if(this['isNotNull'](_0x4b4c9e)){if(this[_0xfded('0x9')][_0x4b4c9e['uniqueid']]){this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x46')]=moment()[_0xfded('0x19')](_0xfded('0x1a'));this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x47')]=moment(this['channels'][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x46')])[_0xfded('0x48')](this['channels'][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x49')],_0xfded('0x4a'));this['channels'][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x4b')]=_0xfded('0x4c');this[_0xfded('0xb')][_0xfded('0x4d')]+=0x1;if(this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x2c')]){this[_0xfded('0xb')]['answered']+=0x1;this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]]['holdtime']=moment(this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x2c')])[_0xfded('0x48')](this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x49')],'seconds');this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x4e')]=moment(this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x46')])[_0xfded('0x48')](this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]]['answertime'],_0xfded('0x4a'));this['outbound'][_0xfded('0x4f')]+=this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x50')]||0x0;this[_0xfded('0xb')][_0xfded('0x51')]+=this[_0xfded('0x9')][_0x4b4c9e['uniqueid']][_0xfded('0x4e')];}this['outbound'][_0xfded('0x52')]+=this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]][_0xfded('0x47')];ami[_0xfded('0x16')](_0xfded('0x53'),this['channels'][_0x4b4c9e[_0xfded('0x17')]]);ami['emit'](_0xfded('0x54'),this['channels'][_0x4b4c9e[_0xfded('0x17')]]);this[_0xfded('0x16')](_0xfded('0x22'),_0xfded('0x55'),this[_0xfded('0xb')]);logger[_0xfded('0x56')](_0xfded('0x57'),JSON[_0xfded('0x58')](this['channels'][_0x4b4c9e['uniqueid']]));this['emit']('voice:outbound',_0xfded('0x59'),this[_0xfded('0x9')][_0x4b4c9e[_0xfded('0x17')]]);delete this[_0xfded('0x9')][_0x4b4c9e['uniqueid']];}if(this[_0xfded('0xc')][_0x4b4c9e[_0xfded('0x17')]]){delete this['variables'][_0x4b4c9e[_0xfded('0x17')]];}}}catch(_0x13d3ae){logger[_0xfded('0x25')](_0xfded('0x5a'),util['inspect'](_0x13d3ae,{'showHidden':![],'depth':null}));}};module[_0xfded('0x5b')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 7014896..5ac7d1e 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 _0x004d=['isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','clearZombieChannels','switch','sequence','isNil','catch','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','clearQueueReport','emit','emitVoiceQueueChannelSave','format','name','voice_queue_channel:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','type','inbound','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','voice_queue:save','loopQueueShow','Action','queues','[queues]','loopQueueSummary','then','[queuesummary]','isNotNull','countBy','queue','toNumber','callers','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','inspect','syncNewExten','syncQueueCallerJoin','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','emitVoiceQueueChannelRemove','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','syncAgentComplete','queuecallerabandonAt','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','channel','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','destexten','COMPLETEDBY','reason','toUpperCase','addVariable','variable','value','lastevent','timeout','custom:timeout','queueposition','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','syncHangup','length','diff','milliseconds','seconds','sumBillable','custom:queuecallerabandon','emitVoiceQueueSummary','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transferexten','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfereeuniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','agents','channels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer'];(function(_0x166072,_0x48ef91){var _0x5411c5=function(_0x54ab1d){while(--_0x54ab1d){_0x166072['push'](_0x166072['shift']());}};_0x5411c5(++_0x48ef91);}(_0x004d,0x158));var _0xd004=function(_0x3c6676,_0x3d03c2){_0x3c6676=_0x3c6676-0x0;var _0x17a707=_0x004d[_0x3c6676];return _0x17a707;};'use strict';var _=require(_0xd004('0x0'));var moment=require(_0xd004('0x1'));var BPromise=require(_0xd004('0x2'));var util=require(_0xd004('0x3'));var md5=require(_0xd004('0x4'));var Redis=require(_0xd004('0x5'));var config=require(_0xd004('0x6'));var logger=require(_0xd004('0x7'))('ami');var ami=require(_0xd004('0x8'));var QueueReport=require(_0xd004('0x9'));config[_0xd004('0xa')]=_['defaults'](config[_0xd004('0xa')],{'host':_0xd004('0xb'),'port':0x18eb});var io=require(_0xd004('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xd004('0xd')][_0xd004('0xe')]=function(_0x3aa09f){this[_0xd004('0xf')]=this[_0xd004('0xf')]?this['tail'][_0xd004('0x10')](_0x3aa09f):_0x3aa09f();};function VoiceQueueReport(_0x297342){this['sequence']=new Sequence();this[_0xd004('0x11')]={};this[_0xd004('0x12')]=_0x297342[_0xd004('0x12')];this[_0xd004('0x13')]=_0x297342['queueChannels'];this[_0xd004('0x14')]=_0x297342[_0xd004('0x14')];this[_0xd004('0x15')]=!![];this['campaigns']=_0x297342[_0xd004('0x16')];this[_0xd004('0x17')]={};ami['on'](_0xd004('0x18'),this[_0xd004('0x19')][_0xd004('0x1a')](this));ami['on'](_0xd004('0x1b'),this[_0xd004('0x1c')][_0xd004('0x1a')](this));ami['on'](_0xd004('0x1d'),this['syncQueueCallerJoin'][_0xd004('0x1a')](this));ami['on'](_0xd004('0x1e'),this[_0xd004('0x1f')][_0xd004('0x1a')](this));ami['on']('queuecallerleave',this[_0xd004('0x20')][_0xd004('0x1a')](this));ami['on'](_0xd004('0x21'),this['syncAgentComplete'][_0xd004('0x1a')](this));ami['on'](_0xd004('0x22'),this[_0xd004('0x23')]['bind'](this));ami['on'](_0xd004('0x24'),this[_0xd004('0x25')][_0xd004('0x1a')](this));ami['on'](_0xd004('0x26'),this['syncHangup']['bind'](this));ami['on'](_0xd004('0x27'),this[_0xd004('0x28')][_0xd004('0x1a')](this));ami['on']('musiconholdstart',this[_0xd004('0x29')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xd004('0x1a')](this));ami['on'](_0xd004('0x2a'),this[_0xd004('0x2b')]['bind'](this));ami['on'](_0xd004('0x2c'),this[_0xd004('0x2d')]['bind'](this));this['loopQueueSummary']();this['loopQueueShow']();}function isNotNull(_0x594db6){return _0x594db6!==null&&!_[_0xd004('0x2e')](_0x594db6);}function clearChannels(_0x79a3dc){if(!_[_0xd004('0x2f')](_0x79a3dc)){for(var _0x4d5842 in _0x79a3dc){if(_0x79a3dc[_0xd004('0x30')](_0x4d5842)){delete _0x79a3dc[_0x4d5842];}}}}function clearCampaigns(_0x566e55){if(!_[_0xd004('0x2f')](_0x566e55)){for(var _0xb128d0 in _0x566e55){if(_0x566e55['hasOwnProperty'](_0xb128d0)){_0x566e55[_0xb128d0][_0xd004('0x31')]=0x0;}}}}function clearVoiceQueues(_0x3acf7b){if(!_[_0xd004('0x2f')](_0x3acf7b)){for(var _0x360b20 in _0x3acf7b){if(_0x3acf7b[_0xd004('0x30')](_0x360b20)){_0x3acf7b[_0x360b20][_0xd004('0x31')]=0x0;_0x3acf7b[_0x360b20][_0xd004('0x32')]=0x0;_0x3acf7b[_0x360b20][_0xd004('0x33')]=0x0;_0x3acf7b[_0x360b20]['waiting']=0x0;_0x3acf7b[_0x360b20][_0xd004('0x34')]=!![];}}}}function clearAgentBooked(_0x3fa004){if(!_['isEmpty'](_0x3fa004)){for(var _0x577736 in _0x3fa004){if(_0x3fa004['hasOwnProperty'](_0x577736)){_0x3fa004[_0x577736]['unlockRR']=!![];}}}}VoiceQueueReport[_0xd004('0xd')][_0xd004('0x35')]=function(){var _0xe3a016=this;for(var _0x15293f in this[_0xd004('0x13')]){if(this['channels'][_0xd004('0x30')](_0x15293f)&&!this[_0xd004('0x13')][_0x15293f][_0xd004('0x36')]){this[_0xd004('0x37')][_0xd004('0xe')](function(){if(!_[_0xd004('0x38')](_0xe3a016[_0xd004('0x13')][_0x15293f])){return ami['Action']({'action':'status','channel':_0xe3a016[_0xd004('0x13')][_0x15293f]['channel']})[_0xd004('0x39')](function(_0x20cfed){if(_0x20cfed['message']===_0xd004('0x3a')){setTimeout(function(){if(_0xe3a016[_0xd004('0x13')][_0x15293f]){delete _0xe3a016['channels'][_0x15293f];logger[_0xd004('0x3b')]('[voiceQueueReport][checkChannel]',_0x15293f);}if(_0xe3a016['queueReports'][_0x15293f]){delete _0xe3a016[_0xd004('0x11')][_0x15293f];logger['error'](_0xd004('0x3c'),_0x15293f);}if(_0xe3a016[_0xd004('0x17')][_0x15293f]){delete _0xe3a016[_0xd004('0x17')][_0x15293f];logger[_0xd004('0x3b')](_0xd004('0x3d'),_0x15293f);}},0x1f40);}});}});}}};VoiceQueueReport[_0xd004('0xd')]['syncFullyBooted']=function(){logger[_0xd004('0x3b')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xd004('0x13')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0xd004('0x12')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xd004('0x16')]);};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x3e')]=function(_0x46eb08){var _0x27ab6a=this;if(!_[_0xd004('0x2f')](_0x46eb08)){for(var _0x4f8fc0 in _0x46eb08){if(_0x46eb08['hasOwnProperty'](_0x4f8fc0)){_0x27ab6a['emitVoiceQueueChannelRemove'](_0x46eb08[_0x4f8fc0]);delete _0x46eb08[_0x4f8fc0];}}}};function loggerCatch(_0x10c4fe){return function(_0x1d3eb9){logger[_0xd004('0x3b')](_0x10c4fe,util['inspect'](_0x1d3eb9,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xd004('0xd')]['emit']=function(_0x817fb9,_0x2b5dd2,_0x8f45c1){io['to'](_0x817fb9)[_0xd004('0x3f')](_0x2b5dd2,_0x8f45c1);};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x40')]=function(_0x542c1e){this[_0xd004('0x3f')](util[_0xd004('0x41')]('voice:queue:%s',_0x542c1e[_0xd004('0x42')]),_0xd004('0x43'),_0x542c1e);};VoiceQueueReport[_0xd004('0xd')]['emitVoiceQueueChannelRemove']=function(_0x2cc29d){logger['info'](_0xd004('0x44'),JSON[_0xd004('0x45')](_0x2cc29d));this[_0xd004('0x3f')](util[_0xd004('0x41')](_0xd004('0x46'),_0x2cc29d['name']),'voice_queue_channel:remove',_0x2cc29d);};VoiceQueueReport[_0xd004('0xd')]['emitVoiceQueueSummary']=function(_0x278691){if(_0x278691[_0xd004('0x47')]===_0xd004('0x48')){var _0xfbd45a={'id':_0x278691['id'],'name':_0x278691[_0xd004('0x42')],'strategy':_0x278691[_0xd004('0x49')],'answered':_0x278691[_0xd004('0x4a')],'available':_0x278691[_0xd004('0x4b')],'loggedIn':_0x278691[_0xd004('0x4c')],'pTalking':_0x278691[_0xd004('0x33')],'sumBillable':_0x278691['sumBillable'],'sumDuration':_0x278691[_0xd004('0x4d')],'sumHoldTime':_0x278691[_0xd004('0x4e')]||0x0,'talking':_0x278691['talking'],'total':_0x278691['total'],'type':_0x278691[_0xd004('0x47')],'unmanaged':_0x278691[_0xd004('0x4f')],'abandoned':_0x278691[_0xd004('0x50')],'waiting':_0x278691[_0xd004('0x51')]};if(_0x278691[_0xd004('0x52')]){_0xfbd45a[_0xd004('0x52')]={'id':_0x278691[_0xd004('0x52')]['id'],'name':_0x278691[_0xd004('0x52')]['name'],'active':_0x278691[_0xd004('0x52')][_0xd004('0x53')],'callerid':_0x278691[_0xd004('0x52')][_0xd004('0x54')]};}if(_0x278691[_0xd004('0x55')]){_0xfbd45a[_0xd004('0x55')]={'id':_0x278691[_0xd004('0x55')]['id'],'name':_0x278691[_0xd004('0x55')]['name']};}var _0x3c7cb7=md5(JSON[_0xd004('0x45')](_0xfbd45a));if(_0x278691['md5']!==_0x3c7cb7){_0x278691[_0xd004('0x4')]=_0x3c7cb7;this[_0xd004('0x3f')](util['format'](_0xd004('0x46'),_0xfbd45a['name']),_0xd004('0x56'),_0xfbd45a);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x48baba){return _0x48baba!==null&&!_[_0xd004('0x2e')](_0x48baba);};VoiceQueueReport['prototype'][_0xd004('0x57')]=function(){var _0x59e5ad=this;setInterval(function(){_0x59e5ad[_0xd004('0x35')]();ami[_0xd004('0x58')]({'action':_0xd004('0x59')})['catch'](loggerCatch(_0xd004('0x5a')));},0x2710);};VoiceQueueReport['prototype'][_0xd004('0x5b')]=function(){var _0x58fcd6=this;setInterval(function(){if(_0x58fcd6['flagQueueSummary']){return ami[_0xd004('0x58')]({'action':_0xd004('0x18')})[_0xd004('0x5c')](function(_0x3effb8){_0x58fcd6[_0xd004('0x15')]=![];})[_0xd004('0x39')](loggerCatch(_0xd004('0x5d')));}},0x3e8);};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x19')]=function(_0x451b23){try{if(this['isNotNull'](_0x451b23)&&this[_0xd004('0x5e')](_0x451b23['queue'])){if(this['voiceQueues'][_0x451b23['queue']]){var _0x2d6658=_[_0xd004('0x5f')](this[_0xd004('0x13')],_0xd004('0x60'))[_0x451b23[_0xd004('0x60')]]||0x0;var _0x26b7a5=_0x2d6658-_0x451b23['callers'];if(this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]][_0xd004('0x51')]!==_[_0xd004('0x61')](_0x451b23[_0xd004('0x62')])||this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]][_0xd004('0x4c')]!==_[_0xd004('0x61')](_0x451b23[_0xd004('0x63')])||this['voiceQueues'][_0x451b23['queue']][_0xd004('0x4b')]!==_[_0xd004('0x61')](_0x451b23[_0xd004('0x4b')])||this[_0xd004('0x14')][_0x451b23['queue']][_0xd004('0x32')]!==_0x26b7a5){this[_0xd004('0x14')][_0x451b23['queue']][_0xd004('0x51')]=_[_0xd004('0x61')](_0x451b23[_0xd004('0x62')]);this[_0xd004('0x14')][_0x451b23['queue']][_0xd004('0x4c')]=_[_0xd004('0x61')](_0x451b23['loggedin']);this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]][_0xd004('0x4b')]=_[_0xd004('0x61')](_0x451b23[_0xd004('0x4b')]);this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]]['talking']=_0x26b7a5>0x0?_0x26b7a5:0x0;this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]]['talking']=this['voiceQueues'][_0x451b23['queue']][_0xd004('0x32')]>_[_0xd004('0x61')](_0x451b23['loggedin'])?_[_0xd004('0x61')](_0x451b23['loggedin']):this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]][_0xd004('0x32')];this['emitVoiceQueueSummary'](this[_0xd004('0x14')][_0x451b23[_0xd004('0x60')]]);}ami[_0xd004('0x3f')](_0xd004('0x64'),this['voiceQueues'][_0x451b23[_0xd004('0x60')]]);}}}catch(_0x108887){logger[_0xd004('0x3b')](_0xd004('0x65'),util[_0xd004('0x66')](_0x108887,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd004('0x1c')]=function(_0x459d25){this['flagQueueSummary']=!![];};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x67')]=function(_0x5c30ef){};VoiceQueueReport['prototype'][_0xd004('0x68')]=function(_0xf03af7){try{if(this[_0xd004('0x5e')](_0xf03af7)){if(_[_0xd004('0x2e')](this[_0xd004('0x11')][_0xf03af7[_0xd004('0x69')]])){this['queueReports'][_0xf03af7[_0xd004('0x69')]]=[];this[_0xd004('0x13')][_0xf03af7[_0xd004('0x69')]]={};}var _0xc30150=new QueueReport();_0xc30150[_0xd004('0x42')]=_0xf03af7[_0xd004('0x60')];_0xc30150[_0xd004('0x47')]=this[_0xd004('0x14')][_0xc30150[_0xd004('0x42')]]&&this['voiceQueues'][_0xc30150['name']]['type']?this[_0xd004('0x14')][_0xc30150[_0xd004('0x42')]][_0xd004('0x47')]||_0xd004('0x48'):_0xd004('0x48');_0xc30150[_0xd004('0x60')]=_0xf03af7[_0xd004('0x60')];_0xc30150[_0xd004('0x6a')]=moment()[_0xd004('0x41')](_0xd004('0x6b'));_0xc30150[_0xd004('0x6c')]=_0xf03af7['position'];_0xc30150[_0xd004('0x6d')]=_0xf03af7['count'];_[_0xd004('0x6e')](_0xc30150,_[_0xd004('0x6f')](_0xf03af7,_[_0xd004('0x70')](_0xc30150)));this['queueReports'][_0xf03af7['uniqueid']]['push'](_0xc30150);this[_0xd004('0x13')][_0xf03af7[_0xd004('0x69')]]=_0xc30150;this[_0xd004('0x40')](_0xc30150);}}catch(_0x985b2){logger[_0xd004('0x3b')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xd004('0x66')](_0x985b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x1f')]=function(_0xd114d){try{if(this['isNotNull'](_0xd114d)){if(this[_0xd004('0x11')][_0xd114d[_0xd004('0x69')]]){var _0x284acd=_[_0xd004('0x71')](this[_0xd004('0x11')][_0xd114d['uniqueid']]);_0x284acd[_0xd004('0x72')]=![];_0x284acd[_0xd004('0x73')]=null;_0x284acd[_0xd004('0x74')]=_0xd114d['holdtime'];_0x284acd['originalposition']=_0xd114d[_0xd004('0x75')];_0x284acd[_0xd004('0x1e')]=!![];_0x284acd['queuecallerabandonAt']=moment()[_0xd004('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x284acd['queuecallerexitreason']='ABANDONED';_0x284acd['lastAssignedTo']=null;this[_0xd004('0x13')][_0xd114d[_0xd004('0x69')]]=_0x284acd;this[_0xd004('0x76')](_0x284acd);}}}catch(_0x4eac7b){logger[_0xd004('0x3b')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xd004('0x66')](_0x4eac7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x20')]=function(_0x2cd62c){try{if(this['isNotNull'](_0x2cd62c)){if(this['queueReports'][_0x2cd62c[_0xd004('0x69')]]){var _0x20d358=_[_0xd004('0x71')](this[_0xd004('0x11')][_0x2cd62c['uniqueid']]);_0x20d358[_0xd004('0x77')]=moment()['format'](_0xd004('0x6b'));_0x20d358[_0xd004('0x78')]=_0x2cd62c[_0xd004('0x78')];_0x20d358[_0xd004('0x79')]=_0x2cd62c[_0xd004('0x79')];this['channels'][_0x2cd62c[_0xd004('0x69')]]=_0x20d358;this['emitVoiceQueueChannelSave'](_0x20d358);}}}catch(_0xb8c1af){logger[_0xd004('0x3b')](_0xd004('0x7a'),util[_0xd004('0x66')](_0xb8c1af,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x39c428){try{if(this['isNotNull'](_0x39c428)){if(this[_0xd004('0x11')][_0x39c428[_0xd004('0x69')]]){var _0x4d402f=_['last'](this[_0xd004('0x11')][_0x39c428[_0xd004('0x69')]]);_0x4d402f[_0xd004('0x72')]=!![];_0x4d402f[_0xd004('0x7b')]=_0xd004('0x7c');}}}catch(_0x41cb6f){logger[_0xd004('0x3b')](_0xd004('0x7d'),util[_0xd004('0x66')](_0x41cb6f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x7e')]=function(_0x3f18e5){try{if(this['isNotNull'](_0x3f18e5)){if(this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x69')]]){var _0x142fb3=_['last'](this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x69')]]);_0x142fb3['queuecallerabandon']=![];_0x142fb3[_0xd004('0x7f')]=null;_0x142fb3[_0xd004('0x80')]=!![];_0x142fb3[_0xd004('0x81')]=_0x3f18e5[_0xd004('0x82')];_0x142fb3[_0xd004('0x74')]=_0x3f18e5[_0xd004('0x74')];_0x142fb3['queuecallercomplete']=!![];_0x142fb3[_0xd004('0x83')]=![];_0x142fb3[_0xd004('0x84')]=null;if(!_0x142fb3[_0xd004('0x85')]){if(_0x3f18e5['reason']==_0xd004('0x85')){_0x142fb3[_0xd004('0x7b')]=_0xd004('0x86');}else{if(_['startsWith'](_0x3f18e5[_0xd004('0x87')][_0xd004('0x88')](),_0xd004('0x89'))){if(this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x8a')]]){var _0x507a82=_[_0xd004('0x71')](this[_0xd004('0x11')][_0x3f18e5['linkedid']]);_0x507a82['queuecallercomplete']=![];_0x507a82[_0xd004('0x83')]=!![];_0x507a82[_0xd004('0x84')]=moment(_0x142fb3[_0xd004('0x6a')])[_0xd004('0x8b')](_0x3f18e5['holdtime'],'seconds')[_0xd004('0x41')](_0xd004('0x6b'));_0x507a82['queuecallerexitreason']=_0xd004('0x8c');_0x507a82[_0xd004('0x85')]=!![];_0x507a82[_0xd004('0x8d')]=_0xd004('0x8e');_0x507a82['transferexten']=_0x3f18e5[_0xd004('0x8f')];_0x507a82['transferuniqueid']=_0x3f18e5[_0xd004('0x69')];var _0x6cbff2=this['queueReports'][_0x3f18e5[_0xd004('0x8a')]];this[_0xd004('0x11')][_0x3f18e5[_0xd004('0x8a')]]=this['queueReports'][_0x3f18e5[_0xd004('0x69')]];this['queueReports'][_0x3f18e5['uniqueid']]=_0x6cbff2;}}else{_0x142fb3[_0xd004('0x7b')]=_0xd004('0x90')+_0x3f18e5[_0xd004('0x91')][_0xd004('0x92')]();}}}this[_0xd004('0x13')][_0x3f18e5['uniqueid']]=_0x142fb3;this['emitVoiceQueueChannelRemove'](_0x142fb3);}}}catch(_0x591114){logger[_0xd004('0x3b')]('[syncAgentComplete][VoiceQueueReport]',util[_0xd004('0x66')](_0x591114,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd004('0x25')]=function(_0x6c6e9){try{if(this[_0xd004('0x5e')](_0x6c6e9)){this[_0xd004('0x93')](_0x6c6e9[_0xd004('0x69')],_[_0xd004('0x70')](_0x6c6e9[_0xd004('0x94')])[0x0],_0x6c6e9[_0xd004('0x95')]);if(this[_0xd004('0x11')][_0x6c6e9[_0xd004('0x69')]]){var _0x2beb7e=_[_0xd004('0x71')](this[_0xd004('0x11')][_0x6c6e9[_0xd004('0x69')]]);if(_0x2beb7e){if(this['isNotNull'](_0x6c6e9[_0xd004('0x94')])&&this[_0xd004('0x5e')](_0x6c6e9['variable']['queuestatus'])){switch(_0x6c6e9[_0xd004('0x95')]){case'CONTINUE':_0x2beb7e[_0xd004('0x83')]=![];_0x2beb7e['queuecallerexitAt']=null;break;case'TIMEOUT':_0x2beb7e[_0xd004('0x96')]=_0xd004('0x97');ami[_0xd004('0x3f')](_0xd004('0x98'),_0x2beb7e);break;default:_0x2beb7e[_0xd004('0x83')]=!![];_0x2beb7e[_0xd004('0x84')]=moment()[_0xd004('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x2beb7e[_0xd004('0x77')]=moment()[_0xd004('0x41')](_0xd004('0x6b'));}_0x2beb7e[_0xd004('0x1e')]=![];_0x2beb7e[_0xd004('0x7f')]=null;_0x2beb7e[_0xd004('0x7b')]=_0x6c6e9['value'];this[_0xd004('0x13')][_0x6c6e9[_0xd004('0x69')]]=_0x2beb7e;this[_0xd004('0x76')](_0x2beb7e);}else if(this[_0xd004('0x5e')](_0x6c6e9[_0xd004('0x94')])&&this['isNotNull'](_0x6c6e9[_0xd004('0x94')][_0xd004('0x99')])){if(!_0x2beb7e[_0xd004('0x1e')]){_0x2beb7e[_0xd004('0x83')]=!![];_0x2beb7e[_0xd004('0x84')]=moment()['format'](_0xd004('0x6b'));_0x2beb7e['queuecallerexitreason']='EXITWITHKEY';_0x2beb7e[_0xd004('0x77')]=moment()[_0xd004('0x41')](_0xd004('0x6b'));this[_0xd004('0x13')][_0x6c6e9[_0xd004('0x69')]]=_0x2beb7e;}}_0x2beb7e['variables']=this[_0xd004('0x17')][_0x6c6e9[_0xd004('0x69')]];}}}}catch(_0x51eee2){logger['error']('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x51eee2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd004('0xd')][_0xd004('0x93')]=function(_0x634c88,_0x1ec8f4,_0x415a68){var _0x3d7ae4=['rtpaudioqos','rtpaudioqosbridged',_0xd004('0x9a'),_0xd004('0x9b'),_0xd004('0x9c'),'rtpaudioqoslossbridged',_0xd004('0x9d'),_0xd004('0x9e'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0xd004('0x9f'),'memberdynamic',_0xd004('0xa0'),_0xd004('0xa1'),_0xd004('0x82'),_0xd004('0xa2'),_0xd004('0xa3')];if(!_[_0xd004('0x38')](_0x1ec8f4)&&!_['includes'](_0x3d7ae4,_0x1ec8f4)){if(_[_0xd004('0x2e')](this[_0xd004('0x17')][_0x634c88])){this[_0xd004('0x17')][_0x634c88]={};}this[_0xd004('0x17')][_0x634c88][_0x1ec8f4]=_0x415a68;}};VoiceQueueReport['prototype'][_0xd004('0xa4')]=function(_0x5a70b2){try{if(this[_0xd004('0x5e')](_0x5a70b2)){if(this[_0xd004('0x11')][_0x5a70b2['uniqueid']]){for(var _0x428171=0x0,_0x1c80dc={};_0x4281710x0?_0x45dd18:0x0;this[_0x0a78('0x14')][_0xc70373['queue']][_0x0a78('0x31')]=this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]['talking']>_['toNumber'](_0xc70373[_0x0a78('0x68')])?_[_0x0a78('0x67')](_0xc70373['loggedin']):this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]['talking'];this[_0x0a78('0x4f')](this[_0x0a78('0x14')][_0xc70373[_0x0a78('0x64')]]);}ami[_0x0a78('0x46')]('custom:queuesummary',this[_0x0a78('0x14')][_0xc70373['queue']]);}}}catch(_0x15ff7d){logger['error'](_0x0a78('0x69'),util[_0x0a78('0x45')](_0x15ff7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')]['syncQueueSummaryComplete']=function(_0x42a97a){this[_0x0a78('0x62')]=!![];};VoiceQueueReport[_0x0a78('0xd')]['syncNewExten']=function(_0xdb95cd){};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x1c')]=function(_0x1eaaa3){try{if(this[_0x0a78('0x5e')](_0x1eaaa3)){if(_['isUndefined'](this['queueReports'][_0x1eaaa3[_0x0a78('0x6a')]])){this[_0x0a78('0x11')][_0x1eaaa3[_0x0a78('0x6a')]]=[];this['channels'][_0x1eaaa3['uniqueid']]={};}var _0x58c74c=new QueueReport();_0x58c74c[_0x0a78('0x4a')]=_0x1eaaa3[_0x0a78('0x64')];_0x58c74c[_0x0a78('0x50')]=this[_0x0a78('0x14')][_0x58c74c[_0x0a78('0x4a')]]&&this[_0x0a78('0x14')][_0x58c74c[_0x0a78('0x4a')]]['type']?this[_0x0a78('0x14')][_0x58c74c[_0x0a78('0x4a')]][_0x0a78('0x50')]||_0x0a78('0x51'):_0x0a78('0x51');_0x58c74c['queue']=_0x1eaaa3[_0x0a78('0x64')];_0x58c74c['queuecallerjoinAt']=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));_0x58c74c['position']=_0x1eaaa3['position'];_0x58c74c[_0x0a78('0x6c')]=_0x1eaaa3[_0x0a78('0x6c')];_[_0x0a78('0x6d')](_0x58c74c,_['pick'](_0x1eaaa3,_[_0x0a78('0x6e')](_0x58c74c)));this['queueReports'][_0x1eaaa3[_0x0a78('0x6a')]][_0x0a78('0x6f')](_0x58c74c);this[_0x0a78('0x36')][_0x1eaaa3[_0x0a78('0x6a')]]=_0x58c74c;this[_0x0a78('0x47')](_0x58c74c);}}catch(_0x253a37){logger[_0x0a78('0x3e')](_0x0a78('0x70'),util[_0x0a78('0x45')](_0x253a37,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x1e')]=function(_0x4f58d){try{if(this[_0x0a78('0x5e')](_0x4f58d)){if(this['queueReports'][_0x4f58d[_0x0a78('0x6a')]]){var _0x95d7b6=_['last'](this['queueReports'][_0x4f58d[_0x0a78('0x6a')]]);_0x95d7b6[_0x0a78('0x71')]=![];_0x95d7b6[_0x0a78('0x72')]=null;_0x95d7b6[_0x0a78('0x73')]=_0x4f58d[_0x0a78('0x73')];_0x95d7b6[_0x0a78('0x74')]=_0x4f58d[_0x0a78('0x74')];_0x95d7b6[_0x0a78('0x1d')]=!![];_0x95d7b6[_0x0a78('0x75')]=moment()[_0x0a78('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x95d7b6[_0x0a78('0x76')]=_0x0a78('0x77');_0x95d7b6[_0x0a78('0x78')]=null;this[_0x0a78('0x36')][_0x4f58d['uniqueid']]=_0x95d7b6;this[_0x0a78('0x44')](_0x95d7b6);}}}catch(_0x1585c5){logger[_0x0a78('0x3e')](_0x0a78('0x79'),util[_0x0a78('0x45')](_0x1585c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x7a')]=function(_0x1a6f17){try{if(this[_0x0a78('0x5e')](_0x1a6f17)){if(this[_0x0a78('0x11')][_0x1a6f17['uniqueid']]){var _0x495184=_[_0x0a78('0x7b')](this[_0x0a78('0x11')][_0x1a6f17['uniqueid']]);_0x495184['queuecallerleaveAt']=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));_0x495184[_0x0a78('0x7c')]=_0x1a6f17[_0x0a78('0x7c')];_0x495184['connectedlinename']=_0x1a6f17[_0x0a78('0x7d')];this[_0x0a78('0x36')][_0x1a6f17[_0x0a78('0x6a')]]=_0x495184;this[_0x0a78('0x47')](_0x495184);}}}catch(_0xa2e477){logger['error'](_0x0a78('0x7e'),util[_0x0a78('0x45')](_0xa2e477,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0x7f')]=function(_0x43e2e9){try{if(this[_0x0a78('0x5e')](_0x43e2e9)){if(this['queueReports'][_0x43e2e9[_0x0a78('0x6a')]]){var _0x2a46f5=_[_0x0a78('0x7b')](this['queueReports'][_0x43e2e9['uniqueid']]);_0x2a46f5[_0x0a78('0x71')]=!![];_0x2a46f5[_0x0a78('0x76')]=_0x0a78('0x80');}}}catch(_0x452ce){logger[_0x0a78('0x3e')](_0x0a78('0x81'),util[_0x0a78('0x45')](_0x452ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0a78('0x20')]=function(_0x13e8fe){try{if(this[_0x0a78('0x5e')](_0x13e8fe)){if(this['queueReports'][_0x13e8fe[_0x0a78('0x6a')]]){var _0x351d86=_[_0x0a78('0x7b')](this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x6a')]]);_0x351d86['queuecallerabandon']=![];_0x351d86[_0x0a78('0x75')]=null;_0x351d86[_0x0a78('0x82')]=!![];_0x351d86['lastAssignedTo']=_0x13e8fe['membername'];_0x351d86[_0x0a78('0x73')]=_0x13e8fe['holdtime'];_0x351d86[_0x0a78('0x71')]=!![];_0x351d86[_0x0a78('0x83')]=![];_0x351d86[_0x0a78('0x84')]=null;if(!_0x351d86['transfer']){if(_0x13e8fe[_0x0a78('0x85')]==_0x0a78('0x86')){_0x351d86[_0x0a78('0x76')]='COMPLETED';}else{if(_[_0x0a78('0x87')](_0x13e8fe[_0x0a78('0x88')]['toLowerCase'](),_0x0a78('0x89'))){if(this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x8a')]]){var _0x1fcb7e=_[_0x0a78('0x7b')](this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x8a')]]);_0x1fcb7e[_0x0a78('0x71')]=![];_0x1fcb7e[_0x0a78('0x83')]=!![];_0x1fcb7e[_0x0a78('0x84')]=moment(_0x351d86['queuecallerjoinAt'])[_0x0a78('0x8b')](_0x13e8fe['holdtime'],_0x0a78('0x8c'))[_0x0a78('0x48')](_0x0a78('0x6b'));_0x1fcb7e[_0x0a78('0x76')]=_0x0a78('0x8d');_0x1fcb7e[_0x0a78('0x86')]=!![];_0x1fcb7e['transfertype']='FORWARD';_0x1fcb7e[_0x0a78('0x8e')]=_0x13e8fe[_0x0a78('0x8f')];_0x1fcb7e[_0x0a78('0x90')]=_0x13e8fe[_0x0a78('0x6a')];var _0x67109=this['queueReports'][_0x13e8fe[_0x0a78('0x8a')]];this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x8a')]]=this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x6a')]];this[_0x0a78('0x11')][_0x13e8fe[_0x0a78('0x6a')]]=_0x67109;}}else{_0x351d86[_0x0a78('0x76')]=_0x0a78('0x91')+_0x13e8fe[_0x0a78('0x85')][_0x0a78('0x92')]();}}}this[_0x0a78('0x36')][_0x13e8fe[_0x0a78('0x6a')]]=_0x351d86;this[_0x0a78('0x44')](_0x351d86);}}}catch(_0x592492){logger[_0x0a78('0x3e')](_0x0a78('0x93'),util[_0x0a78('0x45')](_0x592492,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0a78('0xd')]['syncVarSet']=function(_0x2cd199){try{if(this[_0x0a78('0x5e')](_0x2cd199)){this[_0x0a78('0x94')](_0x2cd199[_0x0a78('0x6a')],_['keys'](_0x2cd199[_0x0a78('0x95')])[0x0],_0x2cd199[_0x0a78('0x96')]);if(this['queueReports'][_0x2cd199[_0x0a78('0x6a')]]){var _0x4ef531=_[_0x0a78('0x7b')](this['queueReports'][_0x2cd199[_0x0a78('0x6a')]]);if(_0x4ef531){if(this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')])&&this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')][_0x0a78('0x97')])){switch(_0x2cd199[_0x0a78('0x96')]){case'CONTINUE':_0x4ef531[_0x0a78('0x83')]=![];_0x4ef531['queuecallerexitAt']=null;break;case _0x0a78('0x98'):_0x4ef531['lastevent']=_0x0a78('0x99');ami[_0x0a78('0x46')](_0x0a78('0x9a'),_0x4ef531);break;default:_0x4ef531[_0x0a78('0x83')]=!![];_0x4ef531[_0x0a78('0x84')]=moment()['format'](_0x0a78('0x6b'));_0x4ef531[_0x0a78('0x9b')]=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));}_0x4ef531[_0x0a78('0x1d')]=![];_0x4ef531[_0x0a78('0x75')]=null;_0x4ef531[_0x0a78('0x76')]=_0x2cd199[_0x0a78('0x96')];this['channels'][_0x2cd199['uniqueid']]=_0x4ef531;this[_0x0a78('0x44')](_0x4ef531);}else if(this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')])&&this[_0x0a78('0x5e')](_0x2cd199[_0x0a78('0x95')][_0x0a78('0x9c')])){if(!_0x4ef531[_0x0a78('0x1d')]){_0x4ef531['queuecallerexit']=!![];_0x4ef531[_0x0a78('0x84')]=moment()['format'](_0x0a78('0x6b'));_0x4ef531[_0x0a78('0x76')]=_0x0a78('0x9d');_0x4ef531['queuecallerleaveAt']=moment()[_0x0a78('0x48')](_0x0a78('0x6b'));this[_0x0a78('0x36')][_0x2cd199[_0x0a78('0x6a')]]=_0x4ef531;}}_0x4ef531[_0x0a78('0x16')]=this[_0x0a78('0x16')][_0x2cd199[_0x0a78('0x6a')]];}}}}catch(_0x59b8b1){logger[_0x0a78('0x3e')](_0x0a78('0x9e'),util[_0x0a78('0x45')](_0x59b8b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0a78('0x94')]=function(_0x1a926b,_0x459e75,_0x20d7cd){var _0x22f038=['rtpaudioqos',_0x0a78('0x9f'),_0x0a78('0xa0'),_0x0a78('0xa1'),_0x0a78('0xa2'),_0x0a78('0xa3'),_0x0a78('0xa4'),_0x0a78('0xa5'),_0x0a78('0xa6'),'sipuri',_0x0a78('0xa7'),_0x0a78('0xa8'),_0x0a78('0xa9'),_0x0a78('0xaa'),'memberinterface',_0x0a78('0xab'),_0x0a78('0xac'),'memberpenalty',_0x0a78('0xad')];if(!_[_0x0a78('0x38')](_0x459e75)&&!_[_0x0a78('0xae')](_0x22f038,_0x459e75)){if(_['isUndefined'](this[_0x0a78('0x16')][_0x1a926b])){this[_0x0a78('0x16')][_0x1a926b]={};}this[_0x0a78('0x16')][_0x1a926b][_0x459e75]=_0x20d7cd;}};VoiceQueueReport[_0x0a78('0xd')][_0x0a78('0xaf')]=function(_0x5a3539){try{if(this[_0x0a78('0x5e')](_0x5a3539)){if(this['queueReports'][_0x5a3539['uniqueid']]){for(var _0x2f2dac=0x0,_0x341164={};_0x2f2dac=0x0?moment(_0x5e51af[_0xd776('0x1b')])[_0xd776('0xe')](_0x5e51af[_0xd776('0x1a')],_0xd776('0xf')):null,'data1':_0xd776('0x1c'),'data2':_0x5e51af['accountcode'],'data3':_0x5e51af['exten'],'data4':_0x5e51af['dialstring']||null,'role':_0xd776('0x13'),'internal':_0x5e51af['accountcode']?_[_0xd776('0x14')](_0x5e51af[_0xd776('0x15')]):undefined,'uniqueid':_0x5e51af[_0xd776('0x16')]},'log':_0xd776('0x6')});}; \ No newline at end of file +var _0x1cd2=['queuecallerexitAt','CreateMemberReport','voice','isNil','format','lastAssignedTo','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','Request','membername','starttime','endtime','outbound','dialstring','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x4e0860,_0x441fa8){var _0x4176b9=function(_0x2d5310){while(--_0x2d5310){_0x4e0860['push'](_0x4e0860['shift']());}};_0x4176b9(++_0x441fa8);}(_0x1cd2,0xa4));var _0x21cd=function(_0x4a6bc3,_0x1f11d8){_0x4a6bc3=_0x4a6bc3-0x0;var _0x2dad51=_0x1cd2[_0x4a6bc3];return _0x2dad51;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0x21cd('0x0'));var client=require(_0x21cd('0x1'));exports[_0x21cd('0x2')]=function(_0x84b2b4){var _0x34f2c4=_0x84b2b4[_0x21cd('0x3')]||_0x84b2b4[_0x21cd('0x4')];return client['Request'](_0x21cd('0x5'),{'body':{'channel':_0x21cd('0x6'),'membername':_0x84b2b4['lastAssignedTo'],'interface':_[_0x21cd('0x7')](_0x84b2b4['interface'])?util[_0x21cd('0x8')]('SIP/%s',_0x84b2b4[_0x21cd('0x9')]):_0x84b2b4[_0x21cd('0xa')],'type':_0x21cd('0xb'),'enterAt':_0x84b2b4[_0x21cd('0xc')],'exitAt':_0x34f2c4,'duration':moment(_0x34f2c4)['diff'](_0x84b2b4[_0x21cd('0xc')],_0x21cd('0xd')),'data1':_0x21cd('0xe'),'data2':_0x84b2b4[_0x21cd('0xf')],'data3':_0x84b2b4[_0x21cd('0x10')],'data4':null,'data5':_0x84b2b4[_0x21cd('0x11')],'role':_0x21cd('0x12'),'internal':_0x84b2b4[_0x21cd('0x13')]?_[_0x21cd('0x14')](_0x84b2b4[_0x21cd('0x13')]):undefined,'uniqueid':_0x84b2b4[_0x21cd('0x15')]},'log':_0x21cd('0x5')});};exports['voiceDialReport']=function(_0xd028c3){return client[_0x21cd('0x16')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0xd028c3[_0x21cd('0x17')],'interface':_0xd028c3['interface'],'type':_0x21cd('0xb'),'enterAt':_0xd028c3[_0x21cd('0x18')],'exitAt':_0xd028c3['endtime'],'duration':moment(_0xd028c3[_0x21cd('0x19')])['diff'](_0xd028c3[_0x21cd('0x18')],'seconds')>=0x0?moment(_0xd028c3['endtime'])['diff'](_0xd028c3[_0x21cd('0x18')],_0x21cd('0xd')):null,'data1':_0x21cd('0x1a'),'data2':_0xd028c3[_0x21cd('0x13')],'data3':_0xd028c3[_0x21cd('0x10')],'data4':_0xd028c3[_0x21cd('0x1b')]||null,'role':_0x21cd('0x12'),'internal':_0xd028c3[_0x21cd('0x13')]?_[_0x21cd('0x14')](_0xd028c3[_0x21cd('0x13')]):undefined,'uniqueid':_0xd028c3[_0x21cd('0x15')]},'log':_0x21cd('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b6f4b82..9f15a5f 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 _0x263f=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x3dd0a1,_0x152dcb){var _0x3c624d=function(_0x144274){while(--_0x144274){_0x3dd0a1['push'](_0x3dd0a1['shift']());}};_0x3c624d(++_0x152dcb);}(_0x263f,0x182));var _0xf263=function(_0x5353af,_0x2ed70c){_0x5353af=_0x5353af-0x0;var _0x1e3cd5=_0x263f[_0x5353af];return _0x1e3cd5;};'use strict';var client=require(_0xf263('0x0'));exports[_0xf263('0x1')]=function(_0x1c3e9e){return function(_0x40eadb){return client[_0xf263('0x2')](_0xf263('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xf263('0x4')]},'log':_0xf263('0x3')});};}; \ No newline at end of file +var _0x2504=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x4281fd,_0x1a198f){var _0x41cf17=function(_0x36e097){while(--_0x36e097){_0x4281fd['push'](_0x4281fd['shift']());}};_0x41cf17(++_0x1a198f);}(_0x2504,0xee));var _0x4250=function(_0x50951a,_0xbe9010){_0x50951a=_0x50951a-0x0;var _0x162bd0=_0x2504[_0x50951a];return _0x162bd0;};'use strict';var client=require(_0x4250('0x0'));exports[_0x4250('0x1')]=function(_0x3e4ada){return function(_0xc1dec8){return client[_0x4250('0x2')](_0x4250('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4250('0x4'),_0x4250('0x5')]},'log':_0x4250('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b5b01b2..6426617 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 _0xfd1a=['field','value','AnyConditions','operator','Action','data1','data2','data3','data4','data7','getTriggers','GetTrigger','name','channel','status','Condition'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xfd1a,0xda));var _0xafd1=function(_0x4dd4e3,_0x1c7e93){_0x4dd4e3=_0x4dd4e3-0x0;var _0xfb56d6=_0xfd1a[_0x4dd4e3];return _0xfb56d6;};'use strict';var client=require('../client');exports[_0xafd1('0x0')]=function(_0x3d4c46){return function(_0x124a9d){return client['Request'](_0xafd1('0x1'),{'options':{'raw':![],'attributes':['id',_0xafd1('0x2'),_0xafd1('0x3'),_0xafd1('0x4')],'include':[{'model':_0xafd1('0x5'),'as':'AllConditions','attributes':['id',_0xafd1('0x6'),'operator',_0xafd1('0x7')]},{'model':_0xafd1('0x5'),'as':_0xafd1('0x8'),'attributes':['id',_0xafd1('0x6'),_0xafd1('0x9'),_0xafd1('0x7')]},{'model':_0xafd1('0xa'),'as':'Actions','attributes':['id','action',_0xafd1('0xb'),_0xafd1('0xc'),_0xafd1('0xd'),_0xafd1('0xe'),'data5','data6',_0xafd1('0xf')]}]},'log':_0xafd1('0x1')});};}; \ No newline at end of file +var _0x3acd=['data1','data3','data4','data5','data6','../client','GetTrigger','name','field','value','Condition','AnyConditions','operator','Actions','action'];(function(_0x5cdd4f,_0x5a3d00){var _0x2834da=function(_0xdf0d1e){while(--_0xdf0d1e){_0x5cdd4f['push'](_0x5cdd4f['shift']());}};_0x2834da(++_0x5a3d00);}(_0x3acd,0xe6));var _0xd3ac=function(_0x1a57b5,_0x5a6289){_0x1a57b5=_0x1a57b5-0x0;var _0x423238=_0x3acd[_0x1a57b5];return _0x423238;};'use strict';var client=require(_0xd3ac('0x0'));exports['getTriggers']=function(_0xd8172a){return function(_0x1c103f){return client['Request'](_0xd3ac('0x1'),{'options':{'raw':![],'attributes':['id',_0xd3ac('0x2'),'channel','status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xd3ac('0x3'),'operator',_0xd3ac('0x4')]},{'model':_0xd3ac('0x5'),'as':_0xd3ac('0x6'),'attributes':['id',_0xd3ac('0x3'),_0xd3ac('0x7'),_0xd3ac('0x4')]},{'model':'Action','as':_0xd3ac('0x8'),'attributes':['id',_0xd3ac('0x9'),_0xd3ac('0xa'),'data2',_0xd3ac('0xb'),_0xd3ac('0xc'),_0xd3ac('0xd'),_0xd3ac('0xe'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f44ba38..5876585 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 _0x92e8=['getTrunks','Request','GetTrunk','name'];(function(_0x38071e,_0x598d39){var _0x48f0f1=function(_0xc7c3ea){while(--_0xc7c3ea){_0x38071e['push'](_0x38071e['shift']());}};_0x48f0f1(++_0x598d39);}(_0x92e8,0x16c));var _0x892e=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x92e8[_0xf34109];return _0x570bfc;};'use strict';var client=require('../client');exports[_0x892e('0x0')]=function(_0x1d5460){return function(_0x13de98){return client[_0x892e('0x1')](_0x892e('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x892e('0x3'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x9c96=['getTrunks','registry','GetTrunk'];(function(_0x60339a,_0x25e79c){var _0x2ea897=function(_0x3a47e7){while(--_0x3a47e7){_0x60339a['push'](_0x60339a['shift']());}};_0x2ea897(++_0x25e79c);}(_0x9c96,0x156));var _0x69c9=function(_0x2eee65,_0x4289ff){_0x2eee65=_0x2eee65-0x0;var _0x27cd03=_0x9c96[_0x2eee65];return _0x27cd03;};'use strict';var client=require('../client');exports[_0x69c9('0x0')]=function(_0xb0b8dd){return function(_0x58169e){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x69c9('0x1')]},'log':_0x69c9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 99ef6b3..5b15b4c 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 _0xfea7=['accountcode','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','email','fullname','../client','getAgents','Request','GetUser','agent'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xfea7,0xeb));var _0x7fea=function(_0xd8004,_0x2e5fec){_0xd8004=_0xd8004-0x0;var _0x287332=_0xfea7[_0xd8004];return _0x287332;};'use strict';var client=require(_0x7fea('0x0'));exports[_0x7fea('0x1')]=function(){return function(){return client[_0x7fea('0x2')](_0x7fea('0x3'),{'options':{'raw':![],'where':{'role':_0x7fea('0x4')},'attributes':['id','name','email',_0x7fea('0x5'),'fullname',_0x7fea('0x6'),_0x7fea('0x7'),_0x7fea('0x8'),_0x7fea('0x9'),_0x7fea('0xa'),_0x7fea('0xb'),_0x7fea('0xc'),_0x7fea('0xd')]},'log':_0x7fea('0x1')});};};exports[_0x7fea('0xe')]=function(){return function(){return client['Request'](_0x7fea('0x3'),{'options':{'raw':!![],'where':{'role':_0x7fea('0xf')},'attributes':['id','name',_0x7fea('0x5'),_0x7fea('0x10')]},'log':'getTelephones'});};};exports[_0x7fea('0x11')]=function(_0x5ba9b8,_0xff3f9c,_0x6c4dce){return client['Request'](_0x7fea('0x12'),{'body':{'type':_0xff3f9c,'uniqueid':_0x6c4dce},'options':{'where':{'id':_0x5ba9b8['id']}},'log':_0x7fea('0x11')});};exports[_0x7fea('0x13')]=function(_0x11be49){return client[_0x7fea('0x2')](_0x7fea('0x14'),{'body':{},'options':{'where':{'id':_0x11be49['id']}},'log':_0x7fea('0x11')});};exports[_0x7fea('0x15')]=function(_0x16b5e0){return client[_0x7fea('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x7fea('0x4'),'id':_0x16b5e0},'attributes':['id','name',_0x7fea('0x16'),_0x7fea('0x5'),_0x7fea('0x17'),'online',_0x7fea('0x7'),_0x7fea('0x8'),'lastPauseAt',_0x7fea('0xa'),_0x7fea('0xd')]},'log':_0x7fea('0x15')});}; \ No newline at end of file +var _0x318d=['agent','email','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','telephone','accountcode','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','name','getAgent','getAgents','Request','GetUser'];(function(_0x574167,_0x5a8520){var _0x3fbcc8=function(_0xfef9bd){while(--_0xfef9bd){_0x574167['push'](_0x574167['shift']());}};_0x3fbcc8(++_0x5a8520);}(_0x318d,0x1c9));var _0xd318=function(_0x2b4835,_0x429677){_0x2b4835=_0x2b4835-0x0;var _0x39c81b=_0x318d[_0x2b4835];return _0x39c81b;};'use strict';var client=require('../client');exports[_0xd318('0x0')]=function(){return function(){return client[_0xd318('0x1')](_0xd318('0x2'),{'options':{'raw':![],'where':{'role':_0xd318('0x3')},'attributes':['id','name',_0xd318('0x4'),'accountcode',_0xd318('0x5'),'online',_0xd318('0x6'),_0xd318('0x7'),_0xd318('0x8'),_0xd318('0x9'),_0xd318('0xa'),_0xd318('0xb'),_0xd318('0xc')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0xd318('0x1')](_0xd318('0x2'),{'options':{'raw':!![],'where':{'role':_0xd318('0xd')},'attributes':['id','name',_0xd318('0xe'),'internal']},'log':_0xd318('0xf')});};};exports[_0xd318('0x10')]=function(_0x4c4c7d,_0x377847,_0x53ac84){return client[_0xd318('0x1')](_0xd318('0x11'),{'body':{'type':_0x377847,'uniqueid':_0x53ac84},'options':{'where':{'id':_0x4c4c7d['id']}},'log':'savePause'});};exports[_0xd318('0x12')]=function(_0x1c38f1){return client['Request'](_0xd318('0x13'),{'body':{},'options':{'where':{'id':_0x1c38f1['id']}},'log':_0xd318('0x10')});};exports['getAgent']=function(_0x5b4ddd){return client[_0xd318('0x1')](_0xd318('0x14'),{'options':{'raw':![],'where':{'role':_0xd318('0x3'),'id':_0x5b4ddd},'attributes':['id',_0xd318('0x15'),_0xd318('0x4'),_0xd318('0xe'),'fullname','online',_0xd318('0x6'),_0xd318('0x7'),_0xd318('0x8'),_0xd318('0x9'),_0xd318('0xc')]},'log':_0xd318('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 5a1270d..ba1c28e 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 _0x69a2=['Request','UpdateVoiceAgentReport','create'];(function(_0x136d68,_0x2dbad8){var _0x9561c1=function(_0x412077){while(--_0x412077){_0x136d68['push'](_0x136d68['shift']());}};_0x9561c1(++_0x2dbad8);}(_0x69a2,0xbf));var _0x269a=function(_0x2d6f95,_0x4088c7){_0x2d6f95=_0x2d6f95-0x0;var _0x3c838e=_0x69a2[_0x2d6f95];return _0x3c838e;};'use strict';var client=require('../client');exports[_0x269a('0x0')]=function(_0x1a942a){return client[_0x269a('0x1')]('CreateVoiceAgentReport',{'body':_0x1a942a,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x249b82,_0x471bbb,_0x5e85ab){return client['Request']('UpdateVoiceAgentReport',{'body':_0x249b82,'options':{'where':{'uniqueid':_0x471bbb,'interface':_0x5e85ab,'agentcomplete':!![]}},'log':_0x269a('0x2')});}; \ No newline at end of file +var _0x5bbd=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd5bb('0x0'));exports[_0xd5bb('0x1')]=function(_0x427a12){return client[_0xd5bb('0x2')](_0xd5bb('0x3'),{'body':_0x427a12,'log':_0xd5bb('0x3')});};exports[_0xd5bb('0x4')]=function(_0x480517,_0x5db64a,_0x4a4799){return client[_0xd5bb('0x2')](_0xd5bb('0x5'),{'body':_0x480517,'options':{'where':{'uniqueid':_0x5db64a,'interface':_0x4a4799,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ca9dd84..2aa2ab4 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 _0x7790=['util','lodash','create','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment'];(function(_0x44a517,_0x12e53d){var _0x1c7761=function(_0xb74fc4){while(--_0xb74fc4){_0x44a517['push'](_0x44a517['shift']());}};_0x1c7761(++_0x12e53d);}(_0x7790,0x11c));var _0x0779=function(_0x4b0d06,_0x48a5a0){_0x4b0d06=_0x4b0d06-0x0;var _0x38a9ac=_0x7790[_0x4b0d06];return _0x38a9ac;};'use strict';var moment=require(_0x0779('0x0'));var util=require(_0x0779('0x1'));var _=require(_0x0779('0x2'));var client=require('../client');exports[_0x0779('0x3')]=function(_0xe90bc7){return client['Request']('CreateVoiceCallReport',{'body':_[_0x0779('0x4')](_0xe90bc7,{'source':_0xe90bc7[_0x0779('0x5')],'destinationcontext':_0xe90bc7[_0x0779('0x6')],'callerid':_0xe90bc7[_0x0779('0x7')],'amaflags':_0x0779('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x0779('0x9')]=function(){return function(){return client[_0x0779('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0779('0xb')]('day')[_0x0779('0xc')](_0x0779('0xd')),moment()[_0x0779('0xe')]('day')['format'](_0x0779('0xd'))]}},'attributes':[_0x0779('0xf'),_0x0779('0x10'),_0x0779('0x11'),_0x0779('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x919a=['../client','create','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash'];(function(_0x253b32,_0x3b3c53){var _0x42b52e=function(_0x1008c1){while(--_0x1008c1){_0x253b32['push'](_0x253b32['shift']());}};_0x42b52e(++_0x3b3c53);}(_0x919a,0xb2));var _0xa919=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x919a[_0x5f0089];return _0x193892;};'use strict';var moment=require('moment');var util=require(_0xa919('0x0'));var _=require(_0xa919('0x1'));var client=require(_0xa919('0x2'));exports[_0xa919('0x3')]=function(_0x291f0f){return client[_0xa919('0x4')](_0xa919('0x5'),{'body':_[_0xa919('0x6')](_0x291f0f,{'source':_0x291f0f['calleridnum'],'destinationcontext':_0x291f0f['context'],'callerid':_0x291f0f[_0xa919('0x7')],'amaflags':_0xa919('0x8')}),'log':_0xa919('0x5')});};exports[_0xa919('0x9')]=function(){return function(){return client[_0xa919('0x4')](_0xa919('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xa919('0xb')](_0xa919('0xc'))[_0xa919('0xd')](_0xa919('0xe')),moment()['endOf'](_0xa919('0xc'))['format'](_0xa919('0xe'))]}},'attributes':[_0xa919('0xf'),_0xa919('0x10'),_0xa919('0x11'),_0xa919('0x12')]},'log':_0xa919('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 0fa7566..f59c9de 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 _0xc94d=['../client','create','CreateVoiceDialReport'];(function(_0x198881,_0x574e6c){var _0x284d84=function(_0x3c0f8a){while(--_0x3c0f8a){_0x198881['push'](_0x198881['shift']());}};_0x284d84(++_0x574e6c);}(_0xc94d,0x1da));var _0xdc94=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc94d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xdc94('0x0'));exports[_0xdc94('0x1')]=function(_0x3f7abc){return client['Request']('CreateVoiceDialReport',{'body':_0x3f7abc,'log':_0xdc94('0x2')});}; \ No newline at end of file +var _0x8019=['../client','create','Request','CreateVoiceDialReport'];(function(_0x8afcc4,_0x139cb3){var _0x3c01c5=function(_0x171686){while(--_0x171686){_0x8afcc4['push'](_0x8afcc4['shift']());}};_0x3c01c5(++_0x139cb3);}(_0x8019,0xe0));var _0x9801=function(_0x504df6,_0x43699e){_0x504df6=_0x504df6-0x0;var _0x425a7d=_0x8019[_0x504df6];return _0x425a7d;};'use strict';var client=require(_0x9801('0x0'));exports[_0x9801('0x1')]=function(_0x48a225){return client[_0x9801('0x2')](_0x9801('0x3'),{'body':_0x48a225,'log':_0x9801('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e67e2da..2561904 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 _0x57f8=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x131e60,_0x5352ce){var _0x4bc497=function(_0x2a758e){while(--_0x2a758e){_0x131e60['push'](_0x131e60['shift']());}};_0x4bc497(++_0x5352ce);}(_0x57f8,0x198));var _0x857f=function(_0x1d60d0,_0x2cfa88){_0x1d60d0=_0x1d60d0-0x0;var _0x1a0917=_0x57f8[_0x1d60d0];return _0x1a0917;};'use strict';var client=require('../client');exports[_0x857f('0x0')]=function(){return function(){return client[_0x857f('0x1')](_0x857f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x857f('0x3'),_0x857f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x857f('0x0')});};}; \ No newline at end of file +var _0xc3b7=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0xa2c37d,_0x644ba2){var _0x469aca=function(_0x453997){while(--_0x453997){_0xa2c37d['push'](_0xa2c37d['shift']());}};_0x469aca(++_0x644ba2);}(_0xc3b7,0xb4));var _0x7c3b=function(_0xed2c2c,_0x3374ba){_0xed2c2c=_0xed2c2c-0x0;var _0x415329=_0xc3b7[_0xed2c2c];return _0x415329;};'use strict';var client=require('../client');exports[_0x7c3b('0x0')]=function(){return function(){return client[_0x7c3b('0x1')](_0x7c3b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7c3b('0x3'),_0x7c3b('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x7c3b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c1e77d0..09abf8f 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 _0x75d6=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x75d6,0x184));var _0x675d=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x75d6[_0xd1b4d7];return _0x3002ec;};'use strict';var client=require(_0x675d('0x0'));exports[_0x675d('0x1')]=function(){return function(){return client[_0x675d('0x2')](_0x675d('0x3'),{'options':{'raw':![],'attributes':['id',_0x675d('0x4'),_0x675d('0x5'),_0x675d('0x6'),_0x675d('0x7'),_0x675d('0x8'),_0x675d('0x9'),_0x675d('0xa'),_0x675d('0xb'),_0x675d('0xc'),_0x675d('0xd'),'dialPowerLevel','dialPredictiveOptimization',_0x675d('0xe'),_0x675d('0xf'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x675d('0x10'),_0x675d('0x11'),_0x675d('0x12'),_0x675d('0x13'),_0x675d('0x14'),_0x675d('0x15'),_0x675d('0x16'),_0x675d('0x17'),_0x675d('0x18'),_0x675d('0x19'),_0x675d('0x1a'),'dialTimezone',_0x675d('0x1b'),'dialPrefix',_0x675d('0x1c'),_0x675d('0x1d'),_0x675d('0x1e'),_0x675d('0x1f'),_0x675d('0x20'),_0x675d('0x21'),_0x675d('0x22'),_0x675d('0x23'),_0x675d('0x24'),_0x675d('0x25'),'dialAMDMaximumWordLength',_0x675d('0x26'),_0x675d('0x27'),_0x675d('0x28'),'dialOrderByScheduledAt',_0x675d('0x29'),_0x675d('0x2a'),_0x675d('0x2b'),_0x675d('0x8'),_0x675d('0x2c'),'dialRandomLastDigitCallerIdNumber',_0x675d('0x2d'),_0x675d('0x2e'),_0x675d('0x2f'),_0x675d('0x30'),_0x675d('0x31'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x675d('0x32'),_0x675d('0x33'),'dialAgentRejectMaxRetry',_0x675d('0x34'),_0x675d('0x35'),_0x675d('0x36'),_0x675d('0x37')],'include':[{'model':_0x675d('0x38'),'as':_0x675d('0x38'),'attributes':['id',_0x675d('0x4'),_0x675d('0x39'),'active']},{'model':_0x675d('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0x675d('0x4')]},{'model':_0x675d('0x38'),'as':_0x675d('0x3b'),'attributes':['id',_0x675d('0x4'),_0x675d('0x39'),'active']},{'model':_0x675d('0x3c'),'as':_0x675d('0x3c'),'attributes':['id',_0x675d('0x4')],'include':[{'model':'Interval','as':_0x675d('0x3d'),'attributes':['id','name',_0x675d('0x3e')]}]}]},'log':_0x675d('0x1')});};}; \ No newline at end of file +var _0x47bb=['Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','TrunkBackup','callerid'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x47bb,0x1ca));var _0xb47b=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0x47bb[_0x3a0f77];return _0x54fd0c;};'use strict';var client=require('../client');exports[_0xb47b('0x0')]=function(){return function(){return client[_0xb47b('0x1')](_0xb47b('0x2'),{'options':{'raw':![],'attributes':['id',_0xb47b('0x3'),_0xb47b('0x4'),_0xb47b('0x5'),_0xb47b('0x6'),_0xb47b('0x7'),_0xb47b('0x8'),_0xb47b('0x9'),_0xb47b('0xa'),_0xb47b('0xb'),_0xb47b('0xc'),_0xb47b('0xd'),_0xb47b('0xe'),_0xb47b('0xf'),_0xb47b('0x10'),_0xb47b('0x11'),_0xb47b('0x12'),_0xb47b('0x13'),_0xb47b('0x14'),_0xb47b('0x15'),_0xb47b('0x16'),_0xb47b('0x17'),_0xb47b('0x18'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xb47b('0x19'),_0xb47b('0x1a'),'dialGlobalMaxRetry',_0xb47b('0x1b'),_0xb47b('0x1c'),_0xb47b('0x1d'),'dialCheckDuplicateType',_0xb47b('0x1e'),_0xb47b('0x1f'),_0xb47b('0x20'),_0xb47b('0x21'),'dialAMDTotalAnalysisTime',_0xb47b('0x22'),_0xb47b('0x23'),_0xb47b('0x24'),_0xb47b('0x25'),'dialAMDMaximumWordLength',_0xb47b('0x26'),_0xb47b('0x27'),_0xb47b('0x28'),_0xb47b('0x29'),_0xb47b('0x2a'),_0xb47b('0x2b'),_0xb47b('0x2c'),'monitor_format','strategy',_0xb47b('0x2d'),_0xb47b('0x2e'),'dialNoSuchNumberMaxRetry',_0xb47b('0x2f'),_0xb47b('0x30'),'dialDropRetryFrequency',_0xb47b('0x31'),_0xb47b('0x32'),'dialMachineMaxRetry',_0xb47b('0x33'),_0xb47b('0x34'),_0xb47b('0x35'),_0xb47b('0x36'),_0xb47b('0x37'),_0xb47b('0x38')],'include':[{'model':_0xb47b('0x39'),'as':'Trunk','attributes':['id',_0xb47b('0x3'),'callerid',_0xb47b('0x3a')]},{'model':_0xb47b('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0xb47b('0x3')]},{'model':_0xb47b('0x39'),'as':_0xb47b('0x3c'),'attributes':['id','name',_0xb47b('0x3d'),_0xb47b('0x3a')]},{'model':_0xb47b('0x3e'),'as':'Interval','attributes':['id',_0xb47b('0x3')],'include':[{'model':'Interval','as':_0xb47b('0x3f'),'attributes':['id',_0xb47b('0x3'),_0xb47b('0x40')]}]}]},'log':_0xb47b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b39dd12..8d9ad74 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 _0xffcc=['queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','GetVoiceQueueReports','moment','../client','Request','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','queue'];(function(_0x5a3d7e,_0x28dbe4){var _0x514299=function(_0x40ded8){while(--_0x40ded8){_0x5a3d7e['push'](_0x5a3d7e['shift']());}};_0x514299(++_0x28dbe4);}(_0xffcc,0x147));var _0xcffc=function(_0x4e79b9,_0x442805){_0x4e79b9=_0x4e79b9-0x0;var _0xc93ffb=_0xffcc[_0x4e79b9];return _0xc93ffb;};'use strict';var moment=require(_0xcffc('0x0'));var _=require('lodash');var client=require(_0xcffc('0x1'));exports['create']=function(_0x1e95d2){return client[_0xcffc('0x2')]('CreateVoiceQueueReport',{'body':_0x1e95d2,'log':'CreateVoiceQueueReport'});};exports[_0xcffc('0x3')]=function(){return function(){return client[_0xcffc('0x2')](_0xcffc('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xcffc('0x5')](_0xcffc('0x6'))[_0xcffc('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xcffc('0x6'))[_0xcffc('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0xcffc('0x8'),_0xcffc('0x9'),_0xcffc('0xa'),_0xcffc('0xb'),_0xcffc('0xc'),_0xcffc('0xd'),'queuecallerexitAt',_0xcffc('0xe'),'queuecallerabandonAt']},'log':_0xcffc('0xf')});};}; \ No newline at end of file +var _0x8139=['queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon'];(function(_0x5beb45,_0x2cef68){var _0x29781d=function(_0x413e30){while(--_0x413e30){_0x5beb45['push'](_0x5beb45['shift']());}};_0x29781d(++_0x2cef68);}(_0x8139,0x113));var _0x9813=function(_0x500f94,_0x30e0fd){_0x500f94=_0x500f94-0x0;var _0x4ce260=_0x8139[_0x500f94];return _0x4ce260;};'use strict';var moment=require(_0x9813('0x0'));var _=require(_0x9813('0x1'));var client=require(_0x9813('0x2'));exports[_0x9813('0x3')]=function(_0x2efdfe){return client[_0x9813('0x4')](_0x9813('0x5'),{'body':_0x2efdfe,'log':'CreateVoiceQueueReport'});};exports[_0x9813('0x6')]=function(){return function(){return client[_0x9813('0x4')](_0x9813('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x9813('0x8')]('day')[_0x9813('0x9')](_0x9813('0xa')),moment()[_0x9813('0xb')]('day')[_0x9813('0x9')](_0x9813('0xa'))]}},'attributes':[_0x9813('0xc'),_0x9813('0xd'),_0x9813('0xe'),'queuecallerleaveAt',_0x9813('0xf'),_0x9813('0x10'),'queuecallerexit',_0x9813('0x11'),_0x9813('0x12'),_0x9813('0x13')]},'log':_0x9813('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index d9051bf..7e5c47e 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 _0x7d64=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x7d64,0x103));var _0x47d6=function(_0x3e5962,_0x37d1ed){_0x3e5962=_0x3e5962-0x0;var _0x309e56=_0x7d64[_0x3e5962];return _0x309e56;};'use strict';var client=require(_0x47d6('0x0'));exports[_0x47d6('0x1')]=function(_0x5960a8){return function(){return client[_0x47d6('0x2')](_0x47d6('0x3'),{'options':{'where':{'VoiceQueueId':_0x5960a8,'paused':!![]},'raw':!![]},'log':_0x47d6('0x1')});};}; \ No newline at end of file +var _0x7758=['getVoiceQueueRtPauses','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7758,0x16d));var _0x8775=function(_0x3c1dd2,_0x291c26){_0x3c1dd2=_0x3c1dd2-0x0;var _0x13918b=_0x7758[_0x3c1dd2];return _0x13918b;};'use strict';var client=require(_0x8775('0x0'));exports[_0x8775('0x1')]=function(_0x151b7e){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x151b7e,'paused':!![]},'raw':!![]},'log':_0x8775('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 03bbe46..ffd84a1 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 _0x2349=['CreateVoiceRecording','merge','monitorFilename','../client'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2349,0x1cf));var _0x9234=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x2349[_0x2067e9];return _0x280ce4;};'use strict';var _=require('lodash');var client=require(_0x9234('0x0'));exports['create']=function(_0x35b506){return client['Request'](_0x9234('0x1'),{'body':_[_0x9234('0x2')](_0x35b506,{'value':_0x35b506[_0x9234('0x3')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x137c=['merge','monitorFilename','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x159106,_0x13f069){var _0x396ca7=function(_0x1e768b){while(--_0x1e768b){_0x159106['push'](_0x159106['shift']());}};_0x396ca7(++_0x13f069);}(_0x137c,0x13d));var _0xc137=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x137c[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xc137('0x0'));var client=require(_0xc137('0x1'));exports[_0xc137('0x2')]=function(_0x5e94e8){return client[_0xc137('0x3')](_0xc137('0x4'),{'body':_[_0xc137('0x5')](_0x5e94e8,{'value':_0x5e94e8[_0xc137('0x6')]}),'log':_0xc137('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 33360ca..3fe2097 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 _0xa656=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer'];(function(_0x3e803c,_0x53abc9){var _0x5ec5b3=function(_0x49a570){while(--_0x49a570){_0x3e803c['push'](_0x3e803c['shift']());}};_0x5ec5b3(++_0x53abc9);}(_0xa656,0xa6));var _0x6a65=function(_0x41db38,_0x1213e0){_0x41db38=_0x41db38-0x0;var _0x201f68=_0xa656[_0x41db38];return _0x201f68;};'use strict';var client=require(_0x6a65('0x0'));exports[_0x6a65('0x1')]=function(_0x497c2c){return client[_0x6a65('0x2')](_0x6a65('0x3'),{'body':{'result':_0x497c2c[_0x6a65('0x4')],'transfererchannel':_0x497c2c[_0x6a65('0x5')],'transferercalleridnum':_0x497c2c['transferercalleridnum'],'transferercalleridname':_0x497c2c[_0x6a65('0x6')],'transfererconnectedlinenum':_0x497c2c[_0x6a65('0x7')],'transfererconnectedlinename':_0x497c2c[_0x6a65('0x8')],'transfereraccountcode':_0x497c2c[_0x6a65('0x9')],'transferercontext':_0x497c2c[_0x6a65('0xa')],'transfererexten':_0x497c2c[_0x6a65('0xb')],'transfererlinkedid':_0x497c2c[_0x6a65('0xc')],'transfereechannel':_0x497c2c[_0x6a65('0xd')],'transfereecalleridnum':_0x497c2c[_0x6a65('0xe')],'transfereecalleridname':_0x497c2c[_0x6a65('0xf')],'transfereeconnectedlinenum':_0x497c2c['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x497c2c[_0x6a65('0x10')],'transfereeaccountcode':_0x497c2c[_0x6a65('0x11')],'transfereecontext':_0x497c2c['transfereecontext'],'transfereeexten':_0x497c2c[_0x6a65('0x12')],'transfereelinkedid':_0x497c2c[_0x6a65('0x13')],'isexternal':_0x497c2c[_0x6a65('0x14')],'context':_0x497c2c[_0x6a65('0x15')],'extension':_0x497c2c[_0x6a65('0x16')],'type':'blind'},'log':_0x6a65('0x3')});};exports[_0x6a65('0x17')]=function(_0x1dd926){return client['Request'](_0x6a65('0x3'),{'body':{'result':_0x1dd926[_0x6a65('0x4')],'transfererchannel':_0x1dd926[_0x6a65('0x18')],'transferercalleridnum':_0x1dd926[_0x6a65('0x19')],'transferercalleridname':_0x1dd926[_0x6a65('0x1a')],'transfererconnectedlinenum':_0x1dd926[_0x6a65('0x1b')],'transfererconnectedlinename':_0x1dd926[_0x6a65('0x1c')],'transfereraccountcode':_0x1dd926[_0x6a65('0x1d')],'transferercontext':_0x1dd926[_0x6a65('0x1e')],'transfererexten':_0x1dd926[_0x6a65('0x1f')],'transfererlinkedid':_0x1dd926['origtransfererlinkedid'],'transfereechannel':_0x1dd926['transfertargetchannel'],'transfereecalleridnum':_0x1dd926['transfertargetcalleridnum'],'transfereecalleridname':_0x1dd926[_0x6a65('0x20')],'transfereeconnectedlinenum':_0x1dd926[_0x6a65('0x21')],'transfereeconnectedlinename':_0x1dd926[_0x6a65('0x22')],'transfereeaccountcode':_0x1dd926[_0x6a65('0x23')],'transfereecontext':_0x1dd926[_0x6a65('0x24')],'transfereeexten':_0x1dd926[_0x6a65('0x25')],'transfereelinkedid':_0x1dd926[_0x6a65('0x26')],'isexternal':_0x1dd926['isexternal'],'context':_0x1dd926[_0x6a65('0x27')],'extension':_0x1dd926[_0x6a65('0x28')],'type':_0x6a65('0x29')},'log':_0x6a65('0x3')});}; \ No newline at end of file +var _0x335f=['result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x1940ec,_0xf6db1e){var _0x4b6b22=function(_0x1461a2){while(--_0x1461a2){_0x1940ec['push'](_0x1940ec['shift']());}};_0x4b6b22(++_0xf6db1e);}(_0x335f,0x193));var _0xf335=function(_0x453dfd,_0x2c7796){_0x453dfd=_0x453dfd-0x0;var _0x32e914=_0x335f[_0x453dfd];return _0x32e914;};'use strict';var client=require(_0xf335('0x0'));exports[_0xf335('0x1')]=function(_0x2b5ce8){return client[_0xf335('0x2')](_0xf335('0x3'),{'body':{'result':_0x2b5ce8[_0xf335('0x4')],'transfererchannel':_0x2b5ce8['transfererchannel'],'transferercalleridnum':_0x2b5ce8['transferercalleridnum'],'transferercalleridname':_0x2b5ce8[_0xf335('0x5')],'transfererconnectedlinenum':_0x2b5ce8[_0xf335('0x6')],'transfererconnectedlinename':_0x2b5ce8['transfererconnectedlinename'],'transfereraccountcode':_0x2b5ce8[_0xf335('0x7')],'transferercontext':_0x2b5ce8['transferercontext'],'transfererexten':_0x2b5ce8[_0xf335('0x8')],'transfererlinkedid':_0x2b5ce8[_0xf335('0x9')],'transfereechannel':_0x2b5ce8[_0xf335('0xa')],'transfereecalleridnum':_0x2b5ce8[_0xf335('0xb')],'transfereecalleridname':_0x2b5ce8['transfereecalleridname'],'transfereeconnectedlinenum':_0x2b5ce8[_0xf335('0xc')],'transfereeconnectedlinename':_0x2b5ce8[_0xf335('0xd')],'transfereeaccountcode':_0x2b5ce8['transfereeaccountcode'],'transfereecontext':_0x2b5ce8[_0xf335('0xe')],'transfereeexten':_0x2b5ce8['transfereeexten'],'transfereelinkedid':_0x2b5ce8[_0xf335('0xf')],'isexternal':_0x2b5ce8[_0xf335('0x10')],'context':_0x2b5ce8['context'],'extension':_0x2b5ce8['extension'],'type':_0xf335('0x11')},'log':_0xf335('0x3')});};exports[_0xf335('0x12')]=function(_0x325bd3){return client['Request'](_0xf335('0x3'),{'body':{'result':_0x325bd3['result'],'transfererchannel':_0x325bd3[_0xf335('0x13')],'transferercalleridnum':_0x325bd3['origtransferercalleridnum'],'transferercalleridname':_0x325bd3[_0xf335('0x14')],'transfererconnectedlinenum':_0x325bd3[_0xf335('0x15')],'transfererconnectedlinename':_0x325bd3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x325bd3[_0xf335('0x16')],'transferercontext':_0x325bd3[_0xf335('0x17')],'transfererexten':_0x325bd3[_0xf335('0x18')],'transfererlinkedid':_0x325bd3[_0xf335('0x19')],'transfereechannel':_0x325bd3[_0xf335('0x1a')],'transfereecalleridnum':_0x325bd3[_0xf335('0x1b')],'transfereecalleridname':_0x325bd3[_0xf335('0x1c')],'transfereeconnectedlinenum':_0x325bd3[_0xf335('0x1d')],'transfereeconnectedlinename':_0x325bd3[_0xf335('0x1e')],'transfereeaccountcode':_0x325bd3[_0xf335('0x1f')],'transfereecontext':_0x325bd3[_0xf335('0x20')],'transfereeexten':_0x325bd3[_0xf335('0x21')],'transfereelinkedid':_0x325bd3['transfertargetlinkedid'],'isexternal':_0x325bd3[_0xf335('0x10')],'context':_0x325bd3[_0xf335('0x22')],'extension':_0x325bd3[_0xf335('0x23')],'type':_0xf335('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6628d33..59e1f2a 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 _0xd53d=['map','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','module','action','Reload','Action','then','message','catch','command','Command','voiceQueues','hasOwnProperty','strategy','pTalking','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','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','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','join','find','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist'];(function(_0x5a3e41,_0x1cd3af){var _0x5835e0=function(_0x172371){while(--_0x172371){_0x5a3e41['push'](_0x5a3e41['shift']());}};_0x5835e0(++_0x1cd3af);}(_0xd53d,0xa6));var _0xdd53=function(_0x5b86ea,_0x488ce9){_0x5b86ea=_0x5b86ea-0x0;var _0x51dd6e=_0xd53d[_0x5b86ea];return _0x51dd6e;};'use strict';var _=require('lodash');var util=require(_0xdd53('0x0'));var jayson=require(_0xdd53('0x1'));var schema=require(_0xdd53('0x2'));var BPromise=require(_0xdd53('0x3'));var moment=require(_0xdd53('0x4'));var config=require('../../../config/environment');var properties=require(_0xdd53('0x5'));var ami=require('../ami');exports[_0xdd53('0x6')]=function(_0x1c3d3e,_0x1e29f4,_0x1a99f7){return new BPromise(function(_0x105b7b,_0x1b9fcf){var _0x10432f={'QueuePause':function(_0x2b1536){return new Promise(function(_0x4cd643,_0x31f352){var _0x5f3be3=util[_0xdd53('0x7')]('%s/%s',_0xdd53('0x8'),_0x2b1536[_0xdd53('0x9')]);if(_0x1c3d3e[_0xdd53('0xa')]&&_0x1c3d3e[_0xdd53('0xa')][_0x5f3be3]&&_0x1c3d3e[_0xdd53('0xa')][_0x5f3be3][_0xdd53('0xb')]){_0x1c3d3e['timers'][_0x5f3be3][_0xdd53('0xc')]();}if(_0x1c3d3e[_0xdd53('0xd')][_0x5f3be3]){_0x1c3d3e[_0xdd53('0xd')][_0x5f3be3][_0xdd53('0xe')]({'statePause':_0x2b1536[_0xdd53('0xf')]?!![]:![]});}_0x4cd643({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x16f5ae){var _0x1a7eb4=this;return new Promise(function(_0x2da250,_0x4feb89){if(ami[_0xdd53('0x10')]()==![]){return _0x4feb89(_0x1a7eb4[_0xdd53('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')]['join']('\x20')));}_0x16f5ae=_['pick'](_0x16f5ae,_['keys'](properties[_0xdd53('0x15')]));_0x16f5ae[_0xdd53('0x16')]=_0xdd53('0x17');return ami[_0xdd53('0x18')](_0x16f5ae)[_0xdd53('0x19')](function(_0x336fca){_0x2da250({'code':0xc8,'message':_0x336fca[_0xdd53('0x1a')]});})[_0xdd53('0x1b')](function(_0x1162e1){_0x4feb89(_0x1a7eb4[_0xdd53('0x11')](0x1f5,_0x1162e1[_0xdd53('0x1a')]));});});},'Command':function(_0x313b37){var _0x5c5eb3=this;return new Promise(function(_0x282b67,_0xd81704){if(ami[_0xdd53('0x10')]()==![]){return _0xd81704(_0x5c5eb3[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x313b37=_['pick'](_0x313b37,_0xdd53('0x1c'));_0x313b37[_0xdd53('0x16')]=_0xdd53('0x1d');return ami[_0xdd53('0x18')](_0x313b37)[_0xdd53('0x19')](function(_0x249278){_0x282b67({'code':0xc8,'message':_0x249278['content']});})[_0xdd53('0x1b')](function(_0x8d7cd2){_0xd81704(_0x5c5eb3[_0xdd53('0x11')](0x1f5,_0x8d7cd2[_0xdd53('0x1a')]));});});},'VoiceQueues':function(_0x3ff759){return new Promise(function(_0x118d43,_0x829ac2){var _0x2a1f3e=[];for(var _0x608632 in _0x1c3d3e[_0xdd53('0x1e')]){if(_0x1c3d3e['voiceQueues'][_0xdd53('0x1f')](_0x608632)){var _0x22f06c=_0x1c3d3e[_0xdd53('0x1e')][_0x608632];var _0x32314c={'id':_0x22f06c['id'],'name':_0x22f06c[_0xdd53('0x9')],'strategy':_0x22f06c[_0xdd53('0x20')],'answered':_0x22f06c['answered'],'available':_0x22f06c['available'],'loggedIn':_0x22f06c['loggedIn'],'pTalking':_0x22f06c[_0xdd53('0x21')],'sumBillable':_0x22f06c['sumBillable'],'sumDuration':_0x22f06c[_0xdd53('0x22')],'sumHoldTime':_0x22f06c[_0xdd53('0x23')]||0x0,'talking':_0x22f06c[_0xdd53('0x24')],'total':_0x22f06c['total'],'type':_0x22f06c[_0xdd53('0x25')],'unmanaged':_0x22f06c[_0xdd53('0x26')],'abandoned':_0x22f06c[_0xdd53('0x27')],'waiting':_0x22f06c[_0xdd53('0x28')],'loggedInDb':_0x22f06c[_0xdd53('0x29')]};if(_0x22f06c[_0xdd53('0x25')]===_0xdd53('0x2a')){_0x32314c['dialActive']=_0x22f06c['dialActive'];_0x32314c[_0xdd53('0x2b')]=_0x22f06c[_0xdd53('0x2b')];_0x32314c['dialOriginateCallerIdName']=_0x22f06c[_0xdd53('0x2c')];_0x32314c[_0xdd53('0x2d')]=_0x22f06c['dialOriginateCallerIdNumber'];_0x32314c[_0xdd53('0x2e')]=_0x22f06c[_0xdd53('0x2e')];_0x32314c[_0xdd53('0x2f')]=_0x22f06c['dialPrefix'];_0x32314c[_0xdd53('0x30')]=_0x22f06c[_0xdd53('0x30')];_0x32314c['outboundAnswerCallsDay']=_0x22f06c['outboundAnswerCallsDay'];_0x32314c[_0xdd53('0x31')]=_0x22f06c[_0xdd53('0x31')];_0x32314c[_0xdd53('0x32')]=_0x22f06c[_0xdd53('0x32')];_0x32314c[_0xdd53('0x33')]=_0x22f06c[_0xdd53('0x33')];_0x32314c[_0xdd53('0x34')]=_0x22f06c[_0xdd53('0x34')];_0x32314c[_0xdd53('0x35')]=_0x22f06c[_0xdd53('0x35')];_0x32314c[_0xdd53('0x36')]=_0x22f06c[_0xdd53('0x36')];_0x32314c['outboundNoAnswerCallsDay']=_0x22f06c[_0xdd53('0x37')];_0x32314c[_0xdd53('0x38')]=_0x22f06c['outboundNoSuchCallsDay'];_0x32314c[_0xdd53('0x39')]=_0x22f06c[_0xdd53('0x39')];_0x32314c[_0xdd53('0x3a')]=_0x22f06c['outboundReCallsDay'];_0x32314c[_0xdd53('0x3b')]=_0x22f06c[_0xdd53('0x3b')];_0x32314c['outboundUnknownCallsDay']=_0x22f06c[_0xdd53('0x3c')];_0x32314c[_0xdd53('0x3d')]=_0x22f06c[_0xdd53('0x3d')];_0x32314c['predictiveIntervalAvgHoldtime']=_0x22f06c[_0xdd53('0x3e')];_0x32314c[_0xdd53('0x3f')]=_0x22f06c[_0xdd53('0x3f')];_0x32314c[_0xdd53('0x40')]=_0x22f06c['predictiveIntervalDroppedCallsCallersExit'];_0x32314c[_0xdd53('0x41')]=_0x22f06c[_0xdd53('0x41')];_0x32314c[_0xdd53('0x42')]=_0x22f06c[_0xdd53('0x42')];_0x32314c['predictiveIntervalErlangCallsDroppedCalls']=_0x22f06c[_0xdd53('0x43')];_0x32314c['predictiveIntervalHitRate']=_0x22f06c[_0xdd53('0x44')];_0x32314c[_0xdd53('0x45')]=_0x22f06c['predictiveIntervalMultiplicativeFactor'];_0x32314c[_0xdd53('0x46')]=_0x22f06c['predictiveIntervalPauses'];_0x32314c[_0xdd53('0x47')]=_0x22f06c['predictiveIntervalAvailable'];_0x32314c[_0xdd53('0x48')]=_0x22f06c[_0xdd53('0x48')];_0x32314c[_0xdd53('0x1a')]=_0x22f06c[_0xdd53('0x1a')];_0x32314c[_0xdd53('0x49')]=_0x22f06c[_0xdd53('0x49')];_0x32314c[_0xdd53('0x4a')]=_0x22f06c[_0xdd53('0x4a')];_0x32314c['erlangCallToSecond']=_0x22f06c[_0xdd53('0x4b')];_0x32314c[_0xdd53('0x4c')]=_0x22f06c[_0xdd53('0x4c')];_0x32314c[_0xdd53('0x4d')]=_0x22f06c[_0xdd53('0x4d')];_0x32314c[_0xdd53('0x4e')]=_0x22f06c[_0xdd53('0x4e')];_0x32314c['startProgressive']=_0x22f06c[_0xdd53('0x4f')];}if(_0x22f06c[_0xdd53('0x50')]){_0x32314c[_0xdd53('0x50')]={'id':_0x22f06c[_0xdd53('0x50')]['id'],'name':_0x22f06c['Trunk']['name'],'active':_0x22f06c['Trunk'][_0xdd53('0x51')],'callerid':_0x22f06c['Trunk'][_0xdd53('0x52')]};}if(_0x22f06c['Interval']){_0x32314c['Interval']={'id':_0x22f06c[_0xdd53('0x53')]['id'],'name':_0x22f06c['Interval']['name']};}_0x2a1f3e[_0xdd53('0x54')](_0x32314c);}}_0x118d43({'count':_0x2a1f3e[_0xdd53('0x55')],'rows':_0x2a1f3e});});},'VoiceChannels':function(_0x30b0af){return new Promise(function(_0x4531f9,_0x2b68ea){var _0x5a1d6d=_[_0xdd53('0x56')](_0x1c3d3e[_0xdd53('0x57')]);_0x4531f9({'count':_0x5a1d6d[_0xdd53('0x55')],'rows':_0x5a1d6d});});},'VoiceChannelMixMonitor':function(_0x58d49c){var _0x2ae9d1=this;return new Promise(function(_0x3b557f,_0x2348d2){if(ami['isConnected']()==![]){return _0x2348d2(_0x2ae9d1[_0xdd53('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')]['join']('\x20')));}var _0x564547=schema(properties[_0xdd53('0x58')])['validate'](_0x58d49c);if(_0x564547[_0xdd53('0x55')]>0x0){return _0x2348d2(_0x2ae9d1['error'](0x1f4,_['map'](_0x564547,_0xdd53('0x1a'))[_0xdd53('0x59')](',\x20')));}var _0x5c6dc5=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x57')],{'uniqueid':_0x58d49c[_0xdd53('0x5b')]});if(_0x5c6dc5&&_0x5c6dc5[_0xdd53('0x5c')]){var _0x5535fd=util[_0xdd53('0x7')](_0xdd53('0x5d'),_0x58d49c['filename']||_0x58d49c[_0xdd53('0x5b')],_0x58d49c[_0xdd53('0x7')]||'wav');return ami[_0xdd53('0x18')]({'action':_0xdd53('0x5e'),'channel':_0x5c6dc5[_0xdd53('0x5c')],'file':_0x5535fd,'options':_0xdd53('0x5f')})[_0xdd53('0x19')](function(_0x7f9060){var _0x1752c7=_[_0xdd53('0x5a')](_0x5c6dc5[_0xdd53('0x60')],{'filename':_0xdd53('0x61')+_0x5535fd[_0xdd53('0x62')]()});if(_[_0xdd53('0x63')](_0x1752c7)){_0x5c6dc5['monitors'][_0xdd53('0x54')]({'filename':'/var/spool/asterisk/monitor/'+_0x5535fd[_0xdd53('0x62')](),'createdAt':moment()['format'](_0xdd53('0x64')),'mixmonitorid':_0x7f9060['mixmonitorid'],'status':_0xdd53('0x65')});}else{_0x1752c7[_0xdd53('0x66')]=_0x7f9060['mixmonitorid'];_0x1752c7[_0xdd53('0x67')]=_0xdd53('0x65');}_0x3b557f({'code':0xc8,'message':[_0x58d49c[_0xdd53('0x5b')],_0xdd53('0x68'),_0x7f9060[_0xdd53('0x66')]][_0xdd53('0x59')]('\x20'),'mixmonitorid':_0x7f9060[_0xdd53('0x66')]});})[_0xdd53('0x1b')](function(_0x2f62b1){_0x2348d2(_0x2ae9d1[_0xdd53('0x11')](0x1f5,[_0x58d49c[_0xdd53('0x5b')],_0x2f62b1[_0xdd53('0x1a')][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')));});}else{return _0x2348d2(_0x2ae9d1[_0xdd53('0x11')](0x1f5,_0xdd53('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x1e8cf5){var _0x5aed11=this;return new Promise(function(_0x8a83bc,_0x1bd7ee){if(ami['isConnected']()==![]){return _0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')][_0xdd53('0x59')]('\x20')));}var _0x33eda2=schema(properties['voicechannel'])['validate'](_0x1e8cf5);if(_0x33eda2[_0xdd53('0x55')]>0x0){return _0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f4,_[_0xdd53('0x6a')](_0x33eda2,'message')[_0xdd53('0x59')](',\x20')));}var _0x5d95ce=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x57')],{'uniqueid':_0x1e8cf5[_0xdd53('0x5b')]});if(_0x5d95ce){return BPromise[_0xdd53('0x6b')]()['then'](function(){if(_0x5d95ce[_0xdd53('0x5c')]){return ami[_0xdd53('0x18')]({'action':_0xdd53('0x6c'),'channel':_0x5d95ce[_0xdd53('0x5c')],'mixmonitorid':_0x1e8cf5['mixmonitorid']})['catch'](function(_0x135de7){});}})[_0xdd53('0x19')](function(){if(_0x5d95ce[_0xdd53('0x6d')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x5d95ce[_0xdd53('0x6d')],'mixmonitorid':_0x1e8cf5[_0xdd53('0x66')]})[_0xdd53('0x1b')](function(_0x3e208d){});}})[_0xdd53('0x19')](function(_0x1f376a){var _0x3652f2=_['find'](_0x5d95ce[_0xdd53('0x60')],{'mixmonitorid':_0x1e8cf5[_0xdd53('0x66')]});if(_0x3652f2){_0x3652f2[_0xdd53('0x67')]=_0xdd53('0x6e');}})['then'](function(){var _0x4e62da=util['format'](_0xdd53('0x5d'),_0x1e8cf5[_0xdd53('0x6f')]||_0x1e8cf5[_0xdd53('0x5b')],_0x1e8cf5[_0xdd53('0x7')]||'wav');var _0x374b29=_[_0xdd53('0x5a')](_0x5d95ce[_0xdd53('0x60')],{'filename':_0xdd53('0x61')+_0x4e62da[_0xdd53('0x62')]()});if(_0x374b29){_0x374b29['status']='stop';}})['then'](function(){_0x8a83bc({'code':0xc8,'message':[_0x1e8cf5[_0xdd53('0x5b')],'StopMixMonitor\x20Success'][_0xdd53('0x59')]('\x20')});})['catch'](function(_0x4e90a1){_0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f5,[_0x1e8cf5[_0xdd53('0x5b')],_0x4e90a1['message'][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')));});}else{return _0x1bd7ee(_0x5aed11[_0xdd53('0x11')](0x1f5,_0xdd53('0x69')));}});},'VoiceQueuesChannels':function(_0x2e1307){return new Promise(function(_0x16fa85,_0xcd2e99){var _0x334ce2=_['values'](_0x1c3d3e[_0xdd53('0x70')]);_0x16fa85({'count':_0x334ce2[_0xdd53('0x55')],'rows':_0x334ce2});});},'VoiceQueuesChannel':function(_0x4f31b9){var _0x1c8da4=this;return new Promise(function(_0x142d7e,_0x4b90eb){var _0x464376=schema(properties[_0xdd53('0x71')])['validate'](_0x4f31b9);if(_0x464376[_0xdd53('0x55')]>0x0){return _0x4b90eb(_0x1c8da4['error'](0x1f4,_['map'](_0x464376,_0xdd53('0x1a'))[_0xdd53('0x59')](',\x20')));}var _0x1edba7=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x70')],{'uniqueid':_0x4f31b9[_0xdd53('0x5b')]});if(_0x1edba7){_0x142d7e(_0x1edba7);}else{return _0x4b90eb(_0x1c8da4['error'](0x1f5,_0xdd53('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x362ce9){var _0x3927db=this;return new Promise(function(_0x2dac53,_0x576cc8){if(ami[_0xdd53('0x10')]()==![]){return _0x576cc8(_0x3927db[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')]['username'],_0xdd53('0x14')][_0xdd53('0x59')]('\x20')));}var _0x26059a=schema(properties[_0xdd53('0x72')])['validate'](_0x362ce9);if(_0x26059a[_0xdd53('0x55')]>0x0){return _0x576cc8(_0x3927db[_0xdd53('0x11')](0x1f4,_[_0xdd53('0x6a')](_0x26059a,_0xdd53('0x1a'))[_0xdd53('0x59')](',\x20')));}var _0x1fbd06=_['find'](_0x1c3d3e[_0xdd53('0x70')],{'uniqueid':_0x362ce9[_0xdd53('0x5b')]});if(_0x1fbd06&&_0x1fbd06[_0xdd53('0x5c')]){return ami[_0xdd53('0x18')]({'action':_0xdd53('0x73'),'channel':_0x1fbd06[_0xdd53('0x5c')]})[_0xdd53('0x19')](function(_0x100b6e){_0x2dac53({'code':0xc8,'message':[_0x362ce9[_0xdd53('0x5b')],_0x100b6e[_0xdd53('0x1a')][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')});})['catch'](function(_0xf19bec){_0x576cc8(_0x3927db['error'](0x1f5,[_0x362ce9[_0xdd53('0x5b')],_0xf19bec[_0xdd53('0x1a')]['toLowerCase']()][_0xdd53('0x59')]('\x20')));});}else{return _0x576cc8(_0x3927db[_0xdd53('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x48707f){var _0x4e3f49=this;return new Promise(function(_0x255a8a,_0x40a62c){if(ami[_0xdd53('0x10')]()==![]){return _0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f4,[config[_0xdd53('0x12')]['ip'],config[_0xdd53('0x12')][_0xdd53('0x13')],_0xdd53('0x14')][_0xdd53('0x59')]('\x20')));}var _0x3c3dfb=schema(properties['voicequeuechannelredirect'])[_0xdd53('0x2')](_0x48707f);if(_0x3c3dfb['length']>0x0){return _0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f4,_['map'](_0x3c3dfb,_0xdd53('0x1a'))['join'](',\x20')));}var _0x4f26cc=_[_0xdd53('0x5a')](_0x1c3d3e[_0xdd53('0x70')],{'uniqueid':_0x48707f[_0xdd53('0x5b')]});if(_0x4f26cc&&_0x4f26cc[_0xdd53('0x5c')]){return ami[_0xdd53('0x18')]({'action':_0xdd53('0x74'),'channel':_0x4f26cc[_0xdd53('0x5c')],'exten':_0x48707f[_0xdd53('0x75')],'context':_0x48707f[_0xdd53('0x76')]||_0x4f26cc['context'],'priority':0x1})['then'](function(_0x50858b){_0x255a8a({'code':0xc8,'message':[_0x48707f[_0xdd53('0x5b')],_0x50858b['message'][_0xdd53('0x62')]()][_0xdd53('0x59')]('\x20')});})[_0xdd53('0x1b')](function(_0x3c0ca2){_0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f5,[_0x48707f['uniqueid'],_0x3c0ca2[_0xdd53('0x1a')]['toLowerCase']()][_0xdd53('0x59')]('\x20')));});}else{return _0x40a62c(_0x4e3f49[_0xdd53('0x11')](0x1f5,_0xdd53('0x69')));}});},'Agents':function(_0x413201){return new Promise(function(_0x1d9bed,_0x3f61bd){var _0x4b4038=_[_0xdd53('0x56')](_0x1c3d3e['agents']);_0x1d9bed({'count':_0x4b4038[_0xdd53('0x55')],'rows':_0x4b4038});});},'Telephones':function(_0x492559){return new Promise(function(_0x2e460c,_0x21d11c){var _0x3b8df8=_['values'](_0x1c3d3e[_0xdd53('0x77')]);_0x2e460c({'count':_0x3b8df8[_0xdd53('0x55')],'rows':_0x3b8df8});});},'Trunks':function(_0x180567){return new Promise(function(_0x3a7bbc,_0x33dbc2){var _0x51518e=_[_0xdd53('0x56')](_0x1c3d3e[_0xdd53('0x78')]);_0x3a7bbc({'count':_0x51518e[_0xdd53('0x55')],'rows':_0x51518e});});},'OutboundChannels':function(_0x551a4d){return new Promise(function(_0x126b29,_0x13476e){var _0x2c7003=_[_0xdd53('0x56')](_0x1c3d3e[_0xdd53('0x79')]);_0x126b29({'count':_0x2c7003[_0xdd53('0x55')],'rows':_0x2c7003});});},'Outbound':function(_0x144666){return new Promise(function(_0x25774a,_0x477060){_0x25774a(_0x1c3d3e['outbound']);});},'Campaigns':function(_0x2f701a){return new Promise(function(_0x2fc0fb,_0x97d69e){var _0x58b001=_['values'](_0x1c3d3e[_0xdd53('0x7a')]);_0x2fc0fb({'count':_0x58b001[_0xdd53('0x55')],'rows':_0x58b001});});},'VoiceQueuesPreview':function(_0x54da22){var _0x280f9f=this;return new Promise(function(_0x2ce34f,_0x4b8238){_0x1e29f4[_0xdd53('0x7b')](_0x54da22['id'])['then'](function(_0x143361){_0x2ce34f({'code':0xc8,'message':_0x143361[_0xdd53('0x1a')]});})['catch'](function(_0x412b60){_0x4b8238(_0x280f9f[_0xdd53('0x11')](0x1f4,_0x412b60[_0xdd53('0x1a')]));});});},'EventManager':function(_0x49d2d2){var _0x1343f2=this;return new Promise(function(_0x295728,_0x443403){if(!_0x49d2d2[_0xdd53('0x7c')]){return _0x443403(_0x1343f2[_0xdd53('0x11')](0x1f4,_0xdd53('0x7d')));}ami[_0xdd53('0x7e')](_0xdd53('0x7f')+_0x49d2d2['event'],_0x49d2d2[_0xdd53('0x1a')]);_0x295728({'code':0xc8,'message':_0x49d2d2});});},'FaxAccounts':function(_0x48d3f1){return new Promise(function(_0x5d9631,_0x1ac7b0){var _0x4b1f20=_['values'](_0x1c3d3e[_0xdd53('0x80')]);_0x5d9631({'count':_0x4b1f20['length'],'rows':_0x4b1f20});});},'SendFax':function(_0x2ad10f){var _0x5c045b=this;return new Promise(function(_0x4106e3,_0xd3bb1b){_0x1a99f7['send'](_0x2ad10f)['then'](function(_0x67c247){_0x4106e3({'code':0xc8,'message':_0x67c247[_0xdd53('0x1a')]});})[_0xdd53('0x1b')](function(_0x467b64){_0xd3bb1b(_0x5c045b[_0xdd53('0x11')](0x1f4,_0x467b64[_0xdd53('0x1a')]));});});},'CheckAfterSend':function(_0x3ccfd2){var _0x5da453=this;return new Promise(function(_0x26aeac,_0x31ecf6){_0x1a99f7[_0xdd53('0x81')](_0x3ccfd2)[_0xdd53('0x19')](function(_0x139607){_0x26aeac({'code':0xc8,'message':_0x139607['message']});})[_0xdd53('0x1b')](function(_0x4bfe14){_0x31ecf6(_0x5da453['error'](0x1f4,_0x4bfe14['message']));});});}};var _0x43426b=jayson[_0xdd53('0x82')](_0x10432f)[_0xdd53('0x83')]();_0x43426b['on'](_0xdd53('0x11'),function(_0x253002){return _0x1b9fcf(_0x253002);});_0x43426b[_0xdd53('0x6')](0x232a,_0xdd53('0x84'),function(){console[_0xdd53('0x85')](_0xdd53('0x86'),0x232a);return _0x105b7b(_0xdd53('0x87')+0x232a);});});}; \ No newline at end of file +var _0x3aff=['send','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','join','command','Command','content','catch','message','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','push','values','channels','length','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','map','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts'];(function(_0x3f9943,_0x48d89d){var _0x58577c=function(_0x44fca0){while(--_0x44fca0){_0x3f9943['push'](_0x3f9943['shift']());}};_0x58577c(++_0x48d89d);}(_0x3aff,0x1ad));var _0xf3af=function(_0x47bea9,_0x342588){_0x47bea9=_0x47bea9-0x0;var _0x4d3750=_0x3aff[_0x47bea9];return _0x4d3750;};'use strict';var _=require(_0xf3af('0x0'));var util=require(_0xf3af('0x1'));var jayson=require(_0xf3af('0x2'));var schema=require(_0xf3af('0x3'));var BPromise=require(_0xf3af('0x4'));var moment=require(_0xf3af('0x5'));var config=require(_0xf3af('0x6'));var properties=require('../properties');var ami=require(_0xf3af('0x7'));exports[_0xf3af('0x8')]=function(_0x3fce7d,_0x4bfb91,_0x514ed6){return new BPromise(function(_0x264bed,_0x1e934a){var _0x18a88a={'QueuePause':function(_0x20ddab){return new Promise(function(_0x4282bc,_0x271f0b){var _0x1cd4d4=util[_0xf3af('0x9')](_0xf3af('0xa'),_0xf3af('0xb'),_0x20ddab[_0xf3af('0xc')]);if(_0x3fce7d[_0xf3af('0xd')]&&_0x3fce7d[_0xf3af('0xd')][_0x1cd4d4]&&_0x3fce7d[_0xf3af('0xd')][_0x1cd4d4][_0xf3af('0xe')]){_0x3fce7d[_0xf3af('0xd')][_0x1cd4d4][_0xf3af('0xf')]();}if(_0x3fce7d[_0xf3af('0x10')][_0x1cd4d4]){_0x3fce7d[_0xf3af('0x10')][_0x1cd4d4][_0xf3af('0x11')]({'statePause':_0x20ddab[_0xf3af('0x12')]?!![]:![]});}_0x4282bc({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1eadf9){var _0x5d7f7c=this;return new Promise(function(_0x1ac066,_0x36555d){if(ami[_0xf3af('0x13')]()==![]){return _0x36555d(_0x5d7f7c[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config[_0xf3af('0x15')][_0xf3af('0x16')],_0xf3af('0x17')]['join']('\x20')));}_0x1eadf9=_[_0xf3af('0x18')](_0x1eadf9,_[_0xf3af('0x19')](properties[_0xf3af('0x1a')]));_0x1eadf9[_0xf3af('0x1b')]=_0xf3af('0x1c');return ami[_0xf3af('0x1d')](_0x1eadf9)[_0xf3af('0x1e')](function(_0x48b535){_0x1ac066({'code':0xc8,'message':_0x48b535['message']});})['catch'](function(_0x1a87e6){_0x36555d(_0x5d7f7c[_0xf3af('0x14')](0x1f5,_0x1a87e6['message']));});});},'Command':function(_0x1e6581){var _0xc9a51b=this;return new Promise(function(_0x974715,_0x59f904){if(ami[_0xf3af('0x13')]()==![]){return _0x59f904(_0xc9a51b[_0xf3af('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xf3af('0x15')]['username'],_0xf3af('0x17')][_0xf3af('0x1f')]('\x20')));}_0x1e6581=_[_0xf3af('0x18')](_0x1e6581,_0xf3af('0x20'));_0x1e6581['action']=_0xf3af('0x21');return ami[_0xf3af('0x1d')](_0x1e6581)[_0xf3af('0x1e')](function(_0x2d72b1){_0x974715({'code':0xc8,'message':_0x2d72b1[_0xf3af('0x22')]});})[_0xf3af('0x23')](function(_0x1e349d){_0x59f904(_0xc9a51b['error'](0x1f5,_0x1e349d[_0xf3af('0x24')]));});});},'VoiceQueues':function(_0xf596f0){return new Promise(function(_0x33d44,_0x1939d8){var _0x11dcbc=[];for(var _0x364f19 in _0x3fce7d[_0xf3af('0x25')]){if(_0x3fce7d[_0xf3af('0x25')][_0xf3af('0x26')](_0x364f19)){var _0x353fe0=_0x3fce7d[_0xf3af('0x25')][_0x364f19];var _0x1997ea={'id':_0x353fe0['id'],'name':_0x353fe0[_0xf3af('0xc')],'strategy':_0x353fe0[_0xf3af('0x27')],'answered':_0x353fe0[_0xf3af('0x28')],'available':_0x353fe0[_0xf3af('0x29')],'loggedIn':_0x353fe0[_0xf3af('0x2a')],'pTalking':_0x353fe0[_0xf3af('0x2b')],'sumBillable':_0x353fe0['sumBillable'],'sumDuration':_0x353fe0[_0xf3af('0x2c')],'sumHoldTime':_0x353fe0['sumHoldTime']||0x0,'talking':_0x353fe0['talking'],'total':_0x353fe0[_0xf3af('0x2d')],'type':_0x353fe0[_0xf3af('0x2e')],'unmanaged':_0x353fe0[_0xf3af('0x2f')],'abandoned':_0x353fe0[_0xf3af('0x30')],'waiting':_0x353fe0[_0xf3af('0x31')],'loggedInDb':_0x353fe0[_0xf3af('0x32')]};if(_0x353fe0[_0xf3af('0x2e')]===_0xf3af('0x33')){_0x1997ea[_0xf3af('0x34')]=_0x353fe0[_0xf3af('0x34')];_0x1997ea[_0xf3af('0x35')]=_0x353fe0['dialMethod'];_0x1997ea['dialOriginateCallerIdName']=_0x353fe0[_0xf3af('0x36')];_0x1997ea[_0xf3af('0x37')]=_0x353fe0[_0xf3af('0x37')];_0x1997ea[_0xf3af('0x38')]=_0x353fe0['dialOriginateTimeout'];_0x1997ea[_0xf3af('0x39')]=_0x353fe0['dialPrefix'];_0x1997ea[_0xf3af('0x3a')]=_0x353fe0[_0xf3af('0x3a')];_0x1997ea[_0xf3af('0x3b')]=_0x353fe0[_0xf3af('0x3b')];_0x1997ea['outboundBlacklistCallsDay']=_0x353fe0[_0xf3af('0x3c')];_0x1997ea[_0xf3af('0x3d')]=_0x353fe0[_0xf3af('0x3d')];_0x1997ea[_0xf3af('0x3e')]=_0x353fe0[_0xf3af('0x3e')];_0x1997ea[_0xf3af('0x3f')]=_0x353fe0[_0xf3af('0x3f')];_0x1997ea[_0xf3af('0x40')]=_0x353fe0[_0xf3af('0x40')];_0x1997ea[_0xf3af('0x41')]=_0x353fe0[_0xf3af('0x41')];_0x1997ea[_0xf3af('0x42')]=_0x353fe0[_0xf3af('0x42')];_0x1997ea[_0xf3af('0x43')]=_0x353fe0[_0xf3af('0x43')];_0x1997ea[_0xf3af('0x44')]=_0x353fe0[_0xf3af('0x44')];_0x1997ea['outboundReCallsDay']=_0x353fe0[_0xf3af('0x45')];_0x1997ea[_0xf3af('0x46')]=_0x353fe0['outboundRejectCallsDay'];_0x1997ea[_0xf3af('0x47')]=_0x353fe0[_0xf3af('0x47')];_0x1997ea[_0xf3af('0x48')]=_0x353fe0[_0xf3af('0x48')];_0x1997ea[_0xf3af('0x49')]=_0x353fe0[_0xf3af('0x49')];_0x1997ea[_0xf3af('0x4a')]=_0x353fe0['predictiveIntervalAvgTalktime'];_0x1997ea[_0xf3af('0x4b')]=_0x353fe0[_0xf3af('0x4b')];_0x1997ea[_0xf3af('0x4c')]=_0x353fe0[_0xf3af('0x4c')];_0x1997ea[_0xf3af('0x4d')]=_0x353fe0['predictiveIntervalErlangCalls'];_0x1997ea['predictiveIntervalErlangCallsDroppedCalls']=_0x353fe0[_0xf3af('0x4e')];_0x1997ea[_0xf3af('0x4f')]=_0x353fe0[_0xf3af('0x4f')];_0x1997ea['predictiveIntervalMultiplicativeFactor']=_0x353fe0[_0xf3af('0x50')];_0x1997ea[_0xf3af('0x51')]=_0x353fe0[_0xf3af('0x51')];_0x1997ea['predictiveIntervalAvailable']=_0x353fe0[_0xf3af('0x52')];_0x1997ea[_0xf3af('0x53')]=_0x353fe0[_0xf3af('0x53')];_0x1997ea[_0xf3af('0x24')]=_0x353fe0[_0xf3af('0x24')];_0x1997ea[_0xf3af('0x54')]=_0x353fe0[_0xf3af('0x54')];_0x1997ea[_0xf3af('0x55')]=_0x353fe0['erlangCalls'];_0x1997ea[_0xf3af('0x56')]=_0x353fe0[_0xf3af('0x56')];_0x1997ea[_0xf3af('0x57')]=_0x353fe0[_0xf3af('0x57')];_0x1997ea['erlangBusyFactor']=_0x353fe0[_0xf3af('0x58')];_0x1997ea[_0xf3af('0x59')]=_0x353fe0['startPredictive'];_0x1997ea['startProgressive']=_0x353fe0['startProgressive'];}if(_0x353fe0[_0xf3af('0x5a')]){_0x1997ea[_0xf3af('0x5a')]={'id':_0x353fe0['Trunk']['id'],'name':_0x353fe0[_0xf3af('0x5a')]['name'],'active':_0x353fe0[_0xf3af('0x5a')][_0xf3af('0x5b')],'callerid':_0x353fe0[_0xf3af('0x5a')]['callerid']};}if(_0x353fe0['Interval']){_0x1997ea[_0xf3af('0x5c')]={'id':_0x353fe0[_0xf3af('0x5c')]['id'],'name':_0x353fe0[_0xf3af('0x5c')]['name']};}_0x11dcbc[_0xf3af('0x5d')](_0x1997ea);}}_0x33d44({'count':_0x11dcbc['length'],'rows':_0x11dcbc});});},'VoiceChannels':function(_0x4c71a9){return new Promise(function(_0x5133f6,_0x3461d3){var _0xd91e48=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x5f')]);_0x5133f6({'count':_0xd91e48['length'],'rows':_0xd91e48});});},'VoiceChannelMixMonitor':function(_0x2c87c1){var _0x439ccc=this;return new Promise(function(_0x1fde3d,_0x45bc47){if(ami['isConnected']()==![]){return _0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config[_0xf3af('0x15')][_0xf3af('0x16')],'ami\x20disconnected']['join']('\x20')));}var _0x51a293=schema(properties['voicechannel'])['validate'](_0x2c87c1);if(_0x51a293[_0xf3af('0x60')]>0x0){return _0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f4,_['map'](_0x51a293,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0x48895b=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x5f')],{'uniqueid':_0x2c87c1[_0xf3af('0x62')]});if(_0x48895b&&_0x48895b[_0xf3af('0x63')]){var _0x5b4f33=util[_0xf3af('0x9')](_0xf3af('0x64'),_0x2c87c1[_0xf3af('0x65')]||_0x2c87c1[_0xf3af('0x62')],_0x2c87c1[_0xf3af('0x9')]||_0xf3af('0x66'));return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x67'),'channel':_0x48895b[_0xf3af('0x63')],'file':_0x5b4f33,'options':_0xf3af('0x68')})[_0xf3af('0x1e')](function(_0x2bc4da){var _0x1b68a7=_[_0xf3af('0x61')](_0x48895b[_0xf3af('0x69')],{'filename':_0xf3af('0x6a')+_0x5b4f33[_0xf3af('0x6b')]()});if(_[_0xf3af('0x6c')](_0x1b68a7)){_0x48895b[_0xf3af('0x69')][_0xf3af('0x5d')]({'filename':_0xf3af('0x6a')+_0x5b4f33[_0xf3af('0x6b')](),'createdAt':moment()[_0xf3af('0x9')](_0xf3af('0x6d')),'mixmonitorid':_0x2bc4da[_0xf3af('0x6e')],'status':_0xf3af('0x6f')});}else{_0x1b68a7['mixmonitorid']=_0x2bc4da[_0xf3af('0x6e')];_0x1b68a7[_0xf3af('0x70')]=_0xf3af('0x6f');}_0x1fde3d({'code':0xc8,'message':[_0x2c87c1[_0xf3af('0x62')],'MixMonitor\x20Success',_0x2bc4da[_0xf3af('0x6e')]][_0xf3af('0x1f')]('\x20'),'mixmonitorid':_0x2bc4da[_0xf3af('0x6e')]});})[_0xf3af('0x23')](function(_0x2a8cc8){_0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f5,[_0x2c87c1[_0xf3af('0x62')],_0x2a8cc8[_0xf3af('0x24')]['toLowerCase']()][_0xf3af('0x1f')]('\x20')));});}else{return _0x45bc47(_0x439ccc[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x3de489){var _0x32aa96=this;return new Promise(function(_0x1a7b73,_0x451e5d){if(ami[_0xf3af('0x13')]()==![]){return _0x451e5d(_0x32aa96[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config['asterisk'][_0xf3af('0x16')],'ami\x20disconnected'][_0xf3af('0x1f')]('\x20')));}var _0x5cd116=schema(properties['voicechannel'])['validate'](_0x3de489);if(_0x5cd116[_0xf3af('0x60')]>0x0){return _0x451e5d(_0x32aa96[_0xf3af('0x14')](0x1f4,_['map'](_0x5cd116,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0x5de315=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x5f')],{'uniqueid':_0x3de489[_0xf3af('0x62')]});if(_0x5de315){return BPromise['resolve']()[_0xf3af('0x1e')](function(){if(_0x5de315[_0xf3af('0x63')]){return ami['Action']({'action':_0xf3af('0x72'),'channel':_0x5de315[_0xf3af('0x63')],'mixmonitorid':_0x3de489[_0xf3af('0x6e')]})[_0xf3af('0x23')](function(_0x49c367){});}})[_0xf3af('0x1e')](function(){if(_0x5de315[_0xf3af('0x73')]){return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x72'),'channel':_0x5de315[_0xf3af('0x73')],'mixmonitorid':_0x3de489[_0xf3af('0x6e')]})[_0xf3af('0x23')](function(_0x54ae17){});}})[_0xf3af('0x1e')](function(_0xfeb0f3){var _0x112ee5=_[_0xf3af('0x61')](_0x5de315[_0xf3af('0x69')],{'mixmonitorid':_0x3de489['mixmonitorid']});if(_0x112ee5){_0x112ee5[_0xf3af('0x70')]=_0xf3af('0x74');}})[_0xf3af('0x1e')](function(){var _0x4c5e16=util['format'](_0xf3af('0x64'),_0x3de489[_0xf3af('0x65')]||_0x3de489[_0xf3af('0x62')],_0x3de489[_0xf3af('0x9')]||_0xf3af('0x66'));var _0x4368a4=_[_0xf3af('0x61')](_0x5de315[_0xf3af('0x69')],{'filename':_0xf3af('0x6a')+_0x4c5e16['toLowerCase']()});if(_0x4368a4){_0x4368a4[_0xf3af('0x70')]=_0xf3af('0x74');}})[_0xf3af('0x1e')](function(){_0x1a7b73({'code':0xc8,'message':[_0x3de489[_0xf3af('0x62')],_0xf3af('0x75')]['join']('\x20')});})[_0xf3af('0x23')](function(_0x40bfba){_0x451e5d(_0x32aa96[_0xf3af('0x14')](0x1f5,[_0x3de489['uniqueid'],_0x40bfba[_0xf3af('0x24')][_0xf3af('0x6b')]()][_0xf3af('0x1f')]('\x20')));});}else{return _0x451e5d(_0x32aa96['error'](0x1f5,_0xf3af('0x71')));}});},'VoiceQueuesChannels':function(_0xd2693a){return new Promise(function(_0x4464f9,_0x489c2b){var _0x2e9b0e=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x76')]);_0x4464f9({'count':_0x2e9b0e[_0xf3af('0x60')],'rows':_0x2e9b0e});});},'VoiceQueuesChannel':function(_0x10944a){var _0x18c5e4=this;return new Promise(function(_0x4bc8d6,_0x3632e9){var _0x526200=schema(properties['voicequeuechannel'])['validate'](_0x10944a);if(_0x526200[_0xf3af('0x60')]>0x0){return _0x3632e9(_0x18c5e4[_0xf3af('0x14')](0x1f4,_[_0xf3af('0x77')](_0x526200,'message')[_0xf3af('0x1f')](',\x20')));}var _0x2a39da=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x76')],{'uniqueid':_0x10944a[_0xf3af('0x62')]});if(_0x2a39da){_0x4bc8d6(_0x2a39da);}else{return _0x3632e9(_0x18c5e4[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x562e6c){var _0x5695fb=this;return new Promise(function(_0x288d11,_0xfd14a2){if(ami[_0xf3af('0x13')]()==![]){return _0xfd14a2(_0x5695fb[_0xf3af('0x14')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf3af('0x16')],_0xf3af('0x17')][_0xf3af('0x1f')]('\x20')));}var _0x33b62f=schema(properties[_0xf3af('0x78')])[_0xf3af('0x3')](_0x562e6c);if(_0x33b62f[_0xf3af('0x60')]>0x0){return _0xfd14a2(_0x5695fb[_0xf3af('0x14')](0x1f4,_[_0xf3af('0x77')](_0x33b62f,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0x3c2480=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x76')],{'uniqueid':_0x562e6c[_0xf3af('0x62')]});if(_0x3c2480&&_0x3c2480['channel']){return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x79'),'channel':_0x3c2480[_0xf3af('0x63')]})[_0xf3af('0x1e')](function(_0x138084){_0x288d11({'code':0xc8,'message':[_0x562e6c[_0xf3af('0x62')],_0x138084[_0xf3af('0x24')][_0xf3af('0x6b')]()][_0xf3af('0x1f')]('\x20')});})['catch'](function(_0x512017){_0xfd14a2(_0x5695fb['error'](0x1f5,[_0x562e6c['uniqueid'],_0x512017[_0xf3af('0x24')][_0xf3af('0x6b')]()][_0xf3af('0x1f')]('\x20')));});}else{return _0xfd14a2(_0x5695fb[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x24997c){var _0x1de176=this;return new Promise(function(_0x5387a0,_0x23fab8){if(ami[_0xf3af('0x13')]()==![]){return _0x23fab8(_0x1de176[_0xf3af('0x14')](0x1f4,[config[_0xf3af('0x15')]['ip'],config[_0xf3af('0x15')][_0xf3af('0x16')],_0xf3af('0x17')][_0xf3af('0x1f')]('\x20')));}var _0x4d3375=schema(properties[_0xf3af('0x7a')])[_0xf3af('0x3')](_0x24997c);if(_0x4d3375[_0xf3af('0x60')]>0x0){return _0x23fab8(_0x1de176['error'](0x1f4,_[_0xf3af('0x77')](_0x4d3375,_0xf3af('0x24'))[_0xf3af('0x1f')](',\x20')));}var _0xa3b59d=_[_0xf3af('0x61')](_0x3fce7d[_0xf3af('0x76')],{'uniqueid':_0x24997c[_0xf3af('0x62')]});if(_0xa3b59d&&_0xa3b59d['channel']){return ami[_0xf3af('0x1d')]({'action':_0xf3af('0x7b'),'channel':_0xa3b59d['channel'],'exten':_0x24997c[_0xf3af('0x7c')],'context':_0x24997c[_0xf3af('0x7d')]||_0xa3b59d[_0xf3af('0x7d')],'priority':0x1})[_0xf3af('0x1e')](function(_0x1799ee){_0x5387a0({'code':0xc8,'message':[_0x24997c[_0xf3af('0x62')],_0x1799ee[_0xf3af('0x24')][_0xf3af('0x6b')]()]['join']('\x20')});})[_0xf3af('0x23')](function(_0x6b38d3){_0x23fab8(_0x1de176[_0xf3af('0x14')](0x1f5,[_0x24997c[_0xf3af('0x62')],_0x6b38d3[_0xf3af('0x24')]['toLowerCase']()][_0xf3af('0x1f')]('\x20')));});}else{return _0x23fab8(_0x1de176[_0xf3af('0x14')](0x1f5,_0xf3af('0x71')));}});},'Agents':function(_0x16a424){return new Promise(function(_0x5a2d0f,_0x4c9c35){var _0x3e126b=_['values'](_0x3fce7d[_0xf3af('0x10')]);_0x5a2d0f({'count':_0x3e126b[_0xf3af('0x60')],'rows':_0x3e126b});});},'Telephones':function(_0x11968b){return new Promise(function(_0x134eaa,_0x4a1f14){var _0x4e17c1=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x7e')]);_0x134eaa({'count':_0x4e17c1[_0xf3af('0x60')],'rows':_0x4e17c1});});},'Trunks':function(_0x404c50){return new Promise(function(_0x48249f,_0x38770c){var _0x4aa5f9=_['values'](_0x3fce7d[_0xf3af('0x7f')]);_0x48249f({'count':_0x4aa5f9[_0xf3af('0x60')],'rows':_0x4aa5f9});});},'OutboundChannels':function(_0x4f6aa2){return new Promise(function(_0xcb3a2d,_0x50a75a){var _0x5b057a=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x80')]);_0xcb3a2d({'count':_0x5b057a[_0xf3af('0x60')],'rows':_0x5b057a});});},'Outbound':function(_0x246a3f){return new Promise(function(_0x1f5224,_0x5019aa){_0x1f5224(_0x3fce7d[_0xf3af('0x33')]);});},'Campaigns':function(_0x4edcfb){return new Promise(function(_0x55fdb7,_0x41e814){var _0x126f66=_['values'](_0x3fce7d[_0xf3af('0x81')]);_0x55fdb7({'count':_0x126f66[_0xf3af('0x60')],'rows':_0x126f66});});},'VoiceQueuesPreview':function(_0x5afdb3){var _0x105c94=this;return new Promise(function(_0x14720c,_0x274ef2){_0x4bfb91['run'](_0x5afdb3['id'])['then'](function(_0x2f954f){_0x14720c({'code':0xc8,'message':_0x2f954f[_0xf3af('0x24')]});})[_0xf3af('0x23')](function(_0x3fe135){_0x274ef2(_0x105c94[_0xf3af('0x14')](0x1f4,_0x3fe135[_0xf3af('0x24')]));});});},'EventManager':function(_0x30cd7f){var _0x3ad88d=this;return new Promise(function(_0x191806,_0xdd8171){if(!_0x30cd7f[_0xf3af('0x82')]){return _0xdd8171(_0x3ad88d[_0xf3af('0x14')](0x1f4,_0xf3af('0x83')));}ami[_0xf3af('0x84')](_0xf3af('0x85')+_0x30cd7f['event'],_0x30cd7f[_0xf3af('0x24')]);_0x191806({'code':0xc8,'message':_0x30cd7f});});},'FaxAccounts':function(_0x1c74d4){return new Promise(function(_0x2d7987,_0x51d6a3){var _0x27baf5=_[_0xf3af('0x5e')](_0x3fce7d[_0xf3af('0x86')]);_0x2d7987({'count':_0x27baf5[_0xf3af('0x60')],'rows':_0x27baf5});});},'SendFax':function(_0x42bc28){var _0x1c9b50=this;return new Promise(function(_0x261072,_0x598de5){_0x514ed6[_0xf3af('0x87')](_0x42bc28)[_0xf3af('0x1e')](function(_0x10f59b){_0x261072({'code':0xc8,'message':_0x10f59b[_0xf3af('0x24')]});})[_0xf3af('0x23')](function(_0x205ce2){_0x598de5(_0x1c9b50[_0xf3af('0x14')](0x1f4,_0x205ce2[_0xf3af('0x24')]));});});},'CheckAfterSend':function(_0x1de028){var _0x400163=this;return new Promise(function(_0x3c2ec3,_0x5515c3){_0x514ed6[_0xf3af('0x88')](_0x1de028)[_0xf3af('0x1e')](function(_0x59e2fd){_0x3c2ec3({'code':0xc8,'message':_0x59e2fd[_0xf3af('0x24')]});})[_0xf3af('0x23')](function(_0x2672f1){_0x5515c3(_0x400163[_0xf3af('0x14')](0x1f4,_0x2672f1[_0xf3af('0x24')]));});});}};var _0x20e0b7=jayson[_0xf3af('0x89')](_0x18a88a)[_0xf3af('0x8a')]();_0x20e0b7['on']('error',function(_0x2ef8cd){return _0x1e934a(_0x2ef8cd);});_0x20e0b7[_0xf3af('0x8')](0x232a,_0xf3af('0x8b'),function(){console[_0xf3af('0x8c')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x264bed('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 0b436df..c60ece9 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 _0xee9c=['action','merge','data1','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','toLowerCase','error','[%s][%s]\x20Error\x20creating\x20contact','stringify','[%s][%s]\x20Autocreate\x20disabled','user:%s','name','util','lodash','ioredis','../../../../config/environment','../../rpc/cmContact','redis','localhost','info','[%s][%s]','emit','exec','autoCreate','data2','calleridnum','isNil','routeId','calleridname','','destcalleridname','destcalleridnum','uniqueid','phone','resolve','then','showContact','omit','firstName','[%s][%s]\x20Contact\x20found:%s','format','trigger:%s'];(function(_0x23cc4b,_0xbb5095){var _0x3d0286=function(_0x16b2b3){while(--_0x16b2b3){_0x23cc4b['push'](_0x23cc4b['shift']());}};_0x3d0286(++_0xbb5095);}(_0xee9c,0x1e6));var _0xcee9=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xee9c[_0x22c684];return _0x39fcbb;};'use strict';var BPromise=require('bluebird');var util=require(_0xcee9('0x0'));var _=require(_0xcee9('0x1'));var Redis=require(_0xcee9('0x2'));var config=require(_0xcee9('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xcee9('0x4'));config[_0xcee9('0x5')]=_['defaults'](config['redis'],{'host':_0xcee9('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcee9('0x5')]));function emit(_0x2bc2cb,_0x34819a,_0x58636f,_0x4d1f9a){logger[_0xcee9('0x7')](_0xcee9('0x8'),_0x2bc2cb,'',_0x34819a,_0x58636f,JSON['stringify'](_0x4d1f9a));io['to'](_0x34819a)[_0xcee9('0x9')](_0x58636f,_0x4d1f9a);}exports[_0xcee9('0xa')]=function(_0x3e08b2,_0x13d681,_0x10f960){_0x10f960[_0xcee9('0xb')]=0x0;if(_0x13d681['data2']&&parseInt(_0x13d681[_0xcee9('0xc')],0xa)){var _0x3c28b6={'ListId':parseInt(_0x13d681['data1'],0xa),'phone':_0x10f960[_0xcee9('0xd')]};if(_[_0xcee9('0xe')](_0x10f960[_0xcee9('0xf')])){_0x3c28b6['firstName']=_0x10f960[_0xcee9('0x10')]&&_0x10f960[_0xcee9('0x10')]!==_0xcee9('0x11')?_0x10f960[_0xcee9('0x10')]:_0x10f960[_0xcee9('0xd')]||_0x10f960['uniqueid'];}else{_0x3c28b6['firstName']=_0x10f960[_0xcee9('0x12')]&&_0x10f960[_0xcee9('0x12')]!==_0xcee9('0x11')?_0x10f960[_0xcee9('0x12')]:_0x10f960[_0xcee9('0x13')]||_0x10f960[_0xcee9('0x14')];_0x3c28b6[_0xcee9('0x15')]=_0x10f960[_0xcee9('0x12')]&&_0x10f960[_0xcee9('0x12')]!==_0xcee9('0x11')?_0x10f960[_0xcee9('0x12')]:_0x10f960[_0xcee9('0x13')]||_0x10f960['uniqueid'];}BPromise[_0xcee9('0x16')]()[_0xcee9('0x17')](cmContactRpc[_0xcee9('0x18')]({'where':_[_0xcee9('0x19')](_0x3c28b6,[_0xcee9('0x1a')])}))['then'](function(_0x23c186){if(_0x23c186){logger[_0xcee9('0x7')](_0xcee9('0x1b'),_0x10f960[_0xcee9('0x14')],'',_0x23c186['id']);if(_0x3e08b2){_0x10f960['xmd-contactid2']=_0x23c186['id'];emit(_0x10f960[_0xcee9('0x14')],util[_0xcee9('0x1c')]('user:%s',_0x3e08b2['name']),util[_0xcee9('0x1c')](_0xcee9('0x1d'),_0x13d681[_0xcee9('0x1e')]['toLowerCase']()),_[_0xcee9('0x1f')](_0x10f960,{'ListId':parseInt(_0x13d681[_0xcee9('0x20')],0xa)}));}return;}else{logger[_0xcee9('0x7')]('[%s][%s]\x20Contact\x20not\x20found',_0x10f960[_0xcee9('0x14')],'');return BPromise['resolve']()[_0xcee9('0x17')](cmContactRpc[_0xcee9('0x21')](_0x3c28b6));}})[_0xcee9('0x17')](function(_0x2f0185){if(_0x2f0185){logger[_0xcee9('0x7')](_0xcee9('0x22'),_0x10f960[_0xcee9('0x14')],'',_0x2f0185['id']);if(_0x3e08b2){_0x10f960[_0xcee9('0x23')]=_0x2f0185['id'];emit(_0x10f960[_0xcee9('0x14')],util[_0xcee9('0x1c')]('user:%s',_0x3e08b2['name']),util[_0xcee9('0x1c')]('trigger:%s',_0x13d681[_0xcee9('0x1e')][_0xcee9('0x24')]()),_[_0xcee9('0x1f')](_0x10f960,{'ListId':parseInt(_0x13d681[_0xcee9('0x20')],0xa)}));}}})['catch'](function(_0x277262){logger[_0xcee9('0x25')](_0xcee9('0x26'),_0x10f960['uniqueid'],'',JSON[_0xcee9('0x27')](_0x277262));});}else{if(_0x3e08b2){logger[_0xcee9('0x7')](_0xcee9('0x28'),_0x10f960['uniqueid'],'');emit(_0x10f960[_0xcee9('0x14')],util[_0xcee9('0x1c')](_0xcee9('0x29'),_0x3e08b2[_0xcee9('0x2a')]),util['format'](_0xcee9('0x1d'),_0x13d681[_0xcee9('0x1e')]['toLowerCase']()),_[_0xcee9('0x1f')]({'ListId':parseInt(_0x13d681[_0xcee9('0x20')],0xa)},_0x10f960));}}}; \ No newline at end of file +var _0xb0ee=['../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','','uniqueid','destcalleridname','destcalleridnum','phone','then','showContact','omit','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','name','format','action','toLowerCase','resolve','createContact','[%s][%s]\x20Contact\x20created:%s','user:%s','trigger:%s','merge','catch','error','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger'];(function(_0x3859fb,_0x316c6d){var _0x1d30f6=function(_0x3e7664){while(--_0x3e7664){_0x3859fb['push'](_0x3859fb['shift']());}};_0x1d30f6(++_0x316c6d);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb0ee[_0x413feb];return _0x40ee88;};'use strict';var BPromise=require('bluebird');var util=require(_0xeb0e('0x0'));var _=require(_0xeb0e('0x1'));var Redis=require(_0xeb0e('0x2'));var config=require(_0xeb0e('0x3'));var logger=require(_0xeb0e('0x4'))(_0xeb0e('0x5'));var cmContactRpc=require(_0xeb0e('0x6'));config[_0xeb0e('0x7')]=_[_0xeb0e('0x8')](config[_0xeb0e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb0e('0x9'))(new Redis(config[_0xeb0e('0x7')]));function emit(_0x423095,_0x3e7872,_0x572ee1,_0x3b3c6e){logger[_0xeb0e('0xa')](_0xeb0e('0xb'),_0x423095,'',_0x3e7872,_0x572ee1,JSON[_0xeb0e('0xc')](_0x3b3c6e));io['to'](_0x3e7872)[_0xeb0e('0xd')](_0x572ee1,_0x3b3c6e);}exports[_0xeb0e('0xe')]=function(_0x37cfa5,_0x2e3ec0,_0x29c41f){_0x29c41f[_0xeb0e('0xf')]=0x0;if(_0x2e3ec0[_0xeb0e('0x10')]&&parseInt(_0x2e3ec0[_0xeb0e('0x10')],0xa)){var _0x6c016e={'ListId':parseInt(_0x2e3ec0[_0xeb0e('0x11')],0xa),'phone':_0x29c41f[_0xeb0e('0x12')]};if(_[_0xeb0e('0x13')](_0x29c41f[_0xeb0e('0x14')])){_0x6c016e[_0xeb0e('0x15')]=_0x29c41f['calleridname']&&_0x29c41f['calleridname']!==_0xeb0e('0x16')?_0x29c41f['calleridname']:_0x29c41f['calleridnum']||_0x29c41f[_0xeb0e('0x17')];}else{_0x6c016e[_0xeb0e('0x15')]=_0x29c41f[_0xeb0e('0x18')]&&_0x29c41f[_0xeb0e('0x18')]!==''?_0x29c41f[_0xeb0e('0x18')]:_0x29c41f[_0xeb0e('0x19')]||_0x29c41f['uniqueid'];_0x6c016e[_0xeb0e('0x1a')]=_0x29c41f[_0xeb0e('0x18')]&&_0x29c41f[_0xeb0e('0x18')]!==_0xeb0e('0x16')?_0x29c41f[_0xeb0e('0x18')]:_0x29c41f[_0xeb0e('0x19')]||_0x29c41f[_0xeb0e('0x17')];}BPromise['resolve']()[_0xeb0e('0x1b')](cmContactRpc[_0xeb0e('0x1c')]({'where':_[_0xeb0e('0x1d')](_0x6c016e,[_0xeb0e('0x15')])}))[_0xeb0e('0x1b')](function(_0x42e8d2){if(_0x42e8d2){logger[_0xeb0e('0xa')](_0xeb0e('0x1e'),_0x29c41f['uniqueid'],'',_0x42e8d2['id']);if(_0x37cfa5){_0x29c41f[_0xeb0e('0x1f')]=_0x42e8d2['id'];emit(_0x29c41f[_0xeb0e('0x17')],util['format']('user:%s',_0x37cfa5[_0xeb0e('0x20')]),util[_0xeb0e('0x21')]('trigger:%s',_0x2e3ec0[_0xeb0e('0x22')][_0xeb0e('0x23')]()),_['merge'](_0x29c41f,{'ListId':parseInt(_0x2e3ec0[_0xeb0e('0x11')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x29c41f['uniqueid'],'');return BPromise[_0xeb0e('0x24')]()['then'](cmContactRpc[_0xeb0e('0x25')](_0x6c016e));}})[_0xeb0e('0x1b')](function(_0x2bd11d){if(_0x2bd11d){logger[_0xeb0e('0xa')](_0xeb0e('0x26'),_0x29c41f[_0xeb0e('0x17')],'',_0x2bd11d['id']);if(_0x37cfa5){_0x29c41f[_0xeb0e('0x1f')]=_0x2bd11d['id'];emit(_0x29c41f['uniqueid'],util['format'](_0xeb0e('0x27'),_0x37cfa5[_0xeb0e('0x20')]),util['format'](_0xeb0e('0x28'),_0x2e3ec0[_0xeb0e('0x22')][_0xeb0e('0x23')]()),_[_0xeb0e('0x29')](_0x29c41f,{'ListId':parseInt(_0x2e3ec0[_0xeb0e('0x11')],0xa)}));}}})[_0xeb0e('0x2a')](function(_0xfe0f73){logger[_0xeb0e('0x2b')]('[%s][%s]\x20Error\x20creating\x20contact',_0x29c41f[_0xeb0e('0x17')],'',JSON[_0xeb0e('0xc')](_0xfe0f73));});}else{if(_0x37cfa5){logger[_0xeb0e('0xa')](_0xeb0e('0x2c'),_0x29c41f['uniqueid'],'');emit(_0x29c41f['uniqueid'],util[_0xeb0e('0x21')]('user:%s',_0x37cfa5[_0xeb0e('0x20')]),util[_0xeb0e('0x21')](_0xeb0e('0x28'),_0x2e3ec0[_0xeb0e('0x22')][_0xeb0e('0x23')]()),_[_0xeb0e('0x29')]({'ListId':parseInt(_0x2e3ec0['data1'],0xa)},_0x29c41f));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 89bfdd1..1bf9ec5 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 _0xb28f=['lastevent','exports','util','lodash','url','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:closedinteraction','custom:outgoingmessage','emit','info','stringify','prototype','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','merge','jscripty','name','trigger:%s','toLowerCase','exec','routeId','urlforward','script','buildUri','parse','query','search','replace','AllConditions','length','every','checkConditions','channel','some','AnyConditions','field','account','chat','operator','value','ChatWebsiteId','upperFirst','interaction','message','event','queue','agent','membername'];(function(_0x16c97b,_0x4fe0ea){var _0x1d745c=function(_0x4936df){while(--_0x4936df){_0x16c97b['push'](_0x16c97b['shift']());}};_0x1d745c(++_0x4fe0ea);}(_0xb28f,0x7a));var _0xfb28=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xb28f[_0x51c819];return _0x15c5d2;};'use strict';var util=require(_0xfb28('0x0'));var _=require(_0xfb28('0x1'));var url=require(_0xfb28('0x2'));var Mustache=require('mustache');var Redis=require(_0xfb28('0x3'));var urlforward=require(_0xfb28('0x4'));var integration=require(_0xfb28('0x5'));var cmContact=require('./cmContact');var script=require(_0xfb28('0x6'));var cmContactRpc=require('../rpc/cmContact');var config=require(_0xfb28('0x7'));var logger=require(_0xfb28('0x8'))(_0xfb28('0x9'));var ami=require(_0xfb28('0xa'));config[_0xfb28('0xb')]=_['defaults'](config['redis'],{'host':_0xfb28('0xc'),'port':0x18eb});var io=require(_0xfb28('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x38e9e8,_0xd285bd){return _0x38e9e8==_0xd285bd;},'not_equals':function(_0x554f47,_0xd0c468){return _0x554f47!=_0xd0c468;}};var barAndWebActions=[_0xfb28('0xe'),_0xfb28('0x2'),'winapp'];function Trigger(_0x542e96){this[_0xfb28('0xf')]=_0x542e96[_0xfb28('0xf')];this['agents']=_0x542e96[_0xfb28('0x10')];this[_0xfb28('0x11')]=_0x542e96[_0xfb28('0x11')];this[_0xfb28('0x12')]=_0x542e96[_0xfb28('0x12')];this[_0xfb28('0x13')]=_0x542e96['voiceExtensions'];this[_0xfb28('0x14')]=_0x542e96[_0xfb28('0x14')];this[_0xfb28('0x15')]=_0x542e96[_0xfb28('0x15')];this['salesforceAccounts']=_0x542e96[_0xfb28('0x16')];this['sugarcrmAccounts']=_0x542e96[_0xfb28('0x17')];this['zohoAccounts']=_0x542e96['zohoAccounts'];this[_0xfb28('0x18')]=_0x542e96[_0xfb28('0x18')];this['vtigerAccounts']=_0x542e96[_0xfb28('0x19')];this['servicenowAccounts']=_0x542e96['servicenowAccounts'];this[_0xfb28('0x1a')]=_0x542e96[_0xfb28('0x1a')];this[_0xfb28('0x1b')]=_0x542e96[_0xfb28('0x1b')];this[_0xfb28('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xfb28('0x16')],'freshdesk':this[_0xfb28('0x15')],'sugarcrm':this[_0xfb28('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xfb28('0x18')],'vtiger':this[_0xfb28('0x19')],'dynamics365':this[_0xfb28('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xfb28('0x1d')]};ami['on'](_0xfb28('0x1e'),this['syncCustomEvent'][_0xfb28('0x1f')](this));ami['on']('custom:agentconnect',this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x21'),this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x22'),this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x23'),this['syncCustomEvent'][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x24'),this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x25'),this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x26'),this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfb28('0x28'),this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on']('custom:timeout',this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x29'),this['syncAgentDial'][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x2a'),this[_0xfb28('0x2b')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x2c'),this['syncAgentDial'][_0xfb28('0x1f')](this));ami['on']('custom:newinteraction',this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x2d'),this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this[_0xfb28('0x20')][_0xfb28('0x1f')](this));ami['on'](_0xfb28('0x2e'),this[_0xfb28('0x20')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xfb28('0x20')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xfb28('0x20')][_0xfb28('0x1f')](this));}Trigger['prototype'][_0xfb28('0x2f')]=function(_0x216a7b,_0x4acb1b,_0x2c2a20){logger[_0xfb28('0x30')](_0x216a7b,_0x4acb1b,JSON[_0xfb28('0x31')](_0x2c2a20));io['to'](_0x216a7b)['emit'](_0x4acb1b,_0x2c2a20);};Trigger[_0xfb28('0x32')][_0xfb28('0x20')]=function(_0x483ba5){var _0x4bbbae=_['clone'](_0x483ba5);this[_0xfb28('0x33')](_0x4bbbae);};Trigger[_0xfb28('0x32')][_0xfb28('0x2b')]=function(_0xef9618){if(this[_0xfb28('0x10')][_0xef9618[_0xfb28('0x34')]]){this[_0xfb28('0x20')](_0xef9618);}};Trigger['prototype'][_0xfb28('0x33')]=function(_0x5cc279){var _0x2abd42;for(var _0xf7a37b in this[_0xfb28('0xf')]){if(this[_0xfb28('0xf')][_0xfb28('0x35')](_0xf7a37b)){if(this[_0xfb28('0xf')][_0xf7a37b][_0xfb28('0x36')]){_0x2abd42=this[_0xfb28('0x37')](this[_0xfb28('0xf')][_0xf7a37b],_0x5cc279);if(_0x2abd42){_['merge'](_0x5cc279,_0x5cc279[_0xfb28('0x38')]);for(var _0x29ac41=0x0,_0x466fb2,_0x27253f,_0x20a63e;_0x29ac410x0){_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(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 763f652..f475ede 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 _0x3303=['value','isNil','validateEmail','email','userEmail','length','info',']\x20Agent\x20found\x20','systemuserid','userId','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','message','toLowerCase','destcalleridnum','POST','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','4.0','outbound','telephone1',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','ticketType','assign','getString','/contacts(','Fields','phonecalls','Subjects','calleridnum','Descriptions','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','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','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','password','clientSecret','access_token','catch','error','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','then'];(function(_0x222aee,_0x12e6d9){var _0x1c3f37=function(_0x5872cc){while(--_0x5872cc){_0x222aee['push'](_0x222aee['shift']());}};_0x1c3f37(++_0x12e6d9);}(_0x3303,0x103));var _0x3330=function(_0x59026e,_0x3a36cb){_0x59026e=_0x59026e-0x0;var _0xe9c58b=_0x3303[_0x59026e];return _0xe9c58b;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x3330('0x0'));var util=require(_0x3330('0x1'));var intUtil=require(_0x3330('0x2'));var md5=require(_0x3330('0x3'));var Redis=require(_0x3330('0x4'));var logger=require(_0x3330('0x5'))(_0x3330('0x6'));var config=require(_0x3330('0x7'));config['redis']=_['defaults'](config[_0x3330('0x8')],{'host':_0x3330('0x9'),'port':0x18eb});var io=require(_0x3330('0xa'))(new Redis(config['redis']));function getAuthToken(_0x16e64e,_0xa68c3e,_0x36b88a){var _0x3d0ebe={'method':'POST','uri':_0xa68c3e,'form':{'client_id':_0x16e64e['clientId'],'resource':_0x16e64e[_0x3330('0xb')],'username':_0x16e64e['username'],'password':_0x16e64e[_0x3330('0xc')],'grant_type':'password','client_secret':_0x16e64e[_0x3330('0xd')]},'json':!![]};return rp(_0x3d0ebe)['then'](function(_0x3db810){return _0x3db810[_0x3330('0xe')];})[_0x3330('0xf')](function(_0x29d33e){logger[_0x3330('0x10')]('['+[_0x36b88a['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x29d33e['message'];});}function getUser(_0x337f9a,_0x2f71ed,_0x27491b,_0x295768,_0x1377de,_0x1158a5){return new BPromise(function(_0x74cb8,_0x25c469){return getAuthToken(_0x2f71ed,_0x295768,_0x1158a5)['then'](function(_0x1a116c){var _0x3afcf1={'method':_0x3330('0x11'),'uri':_0x1377de+_0x3330('0x12'),'headers':{'Authorization':'Bearer\x20'+_0x1a116c,'OData-Version':'4.0'},'json':!![]};return rp(_0x3afcf1);})[_0x3330('0x13')](function(_0x1f1cea){var _0x4d2146=_0x1f1cea[_0x3330('0x14')];var _0x2d877f=![];var _0x23c867=null;if(!_[_0x3330('0x15')](_0x27491b)){if(intUtil[_0x3330('0x16')](_0x27491b[_0x3330('0x17')])){_0x337f9a[_0x3330('0x18')]=_0x27491b[_0x3330('0x17')];for(_0x23c867=0x0;_0x23c867<_0x4d2146[_0x3330('0x19')];_0x23c867++){if(_0x4d2146[_0x23c867]['internalemailaddress']===_0x27491b['email']&&!_0x4d2146[_0x23c867]['isdisabled']){_0x2d877f=!![];logger[_0x3330('0x1a')]('['+[_0x1158a5['toUpperCase']()]+_0x3330('0x1b')+_0x4d2146[_0x23c867][_0x3330('0x1c')]+'!');_0x337f9a[_0x3330('0x1d')]=_0x4d2146[_0x23c867][_0x3330('0x1c')];}}}}if(!_0x2d877f){logger[_0x3330('0x1a')]('['+[_0x1158a5[_0x3330('0x1e')]()]+_0x3330('0x1f'));_0x337f9a[_0x3330('0x18')]=_0x2f71ed[_0x3330('0x20')];for(_0x23c867=0x0;_0x23c867<_0x4d2146[_0x3330('0x19')];_0x23c867++){if(_0x4d2146[_0x23c867][_0x3330('0x21')]===_0x2f71ed[_0x3330('0x20')]){_0x337f9a[_0x3330('0x1d')]=_0x4d2146[_0x23c867][_0x3330('0x1c')];}}}_0x74cb8(_0x337f9a);})[_0x3330('0xf')](function(_0x5d2ec4){_0x25c469(_0x5d2ec4[_0x3330('0x22')]);});});}function createEndUser(_0x27094d,_0x51a58e,_0x144ad4,_0x1d0f5d,_0x11fcc1,_0x3a2ba3){return new BPromise(function(_0x13eda9,_0x370540){return getAuthToken(_0x51a58e,_0x144ad4,_0x3a2ba3)[_0x3330('0x13')](function(_0x4daea0){var _0x4b64a2=_0x3a2ba3[_0x3330('0x23')]()==='outbound'?_0x11fcc1[_0x3330('0x24')]:_0x11fcc1['calleridnum'];var _0x459edd={'method':_0x3330('0x25'),'uri':_0x1d0f5d+_0x3330('0x26'),'body':{'telephone1':_0x4b64a2,'fullname':_0x4b64a2,'firstname':_0x4b64a2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3330('0x27')+_0x27094d[_0x3330('0x1d')]+')'},'headers':{'Authorization':_0x3330('0x28')+_0x4daea0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x459edd);})[_0x3330('0x13')](function(_0x932a62){var _0xe7f4c5=_0x932a62[_0x3330('0x29')][_0x3330('0x2a')];var _0x557f79=_0xe7f4c5[_0x3330('0x2b')](_0xe7f4c5[_0x3330('0x2c')]('(')+0x1,_0xe7f4c5['lastIndexOf'](')'));_0x27094d[_0x3330('0x2d')]=_0x557f79;_0x13eda9(_0x27094d);})[_0x3330('0xf')](function(_0x31bd7c){_0x370540(_0x31bd7c[_0x3330('0x22')]);});});}function getEndUser(_0x5dfa03,_0x3ad988,_0x476234,_0x3218a5,_0x486380,_0x23e787){return new BPromise(function(_0x51c613,_0x486f10){return getAuthToken(_0x3ad988,_0x476234,_0x23e787)[_0x3330('0x13')](function(_0x550515){var _0xae70fd={'method':_0x3330('0x11'),'uri':_0x3218a5+'contacts?$select=telephone1','headers':{'Authorization':_0x3330('0x28')+_0x550515,'If-None-Match':null,'OData-Version':_0x3330('0x2e')},'json':!![]};return rp(_0xae70fd);})['then'](function(_0x383790){var _0x29a192=null;if(_0x383790){var _0x21d46b=_0x383790[_0x3330('0x14')];var _0x25042e=![];for(_0x29a192=0x0;_0x29a192<_0x21d46b[_0x3330('0x19')];_0x29a192++){var _0x429a09=_0x23e787[_0x3330('0x23')]()===_0x3330('0x2f')?_0x486380[_0x3330('0x24')]:_0x486380['calleridnum'];if(_0x21d46b[_0x29a192][_0x3330('0x30')]===_0x429a09){_0x25042e=!![];_0x5dfa03[_0x3330('0x2d')]=_0x21d46b[_0x29a192]['contactid'];}}if(_0x25042e){_0x51c613(_0x5dfa03);}else{return createEndUser(_0x5dfa03,_0x3ad988,_0x476234,_0x3218a5,_0x486380,_0x23e787)['then'](function(_0x5d528b){logger['info']('['+[_0x23e787['toUpperCase']()]+']\x20Enduser\x20created!',_0x5d528b[_0x3330('0x2d')]);_0x51c613(_0x5d528b);});}}else{return createEndUser(_0x5dfa03,_0x3ad988,_0x476234,_0x3218a5,_0x486380,_0x23e787)[_0x3330('0x13')](function(_0x1687fa){logger['info']('['+[_0x23e787[_0x3330('0x1e')]()]+_0x3330('0x31'),_0x1687fa[_0x3330('0x2d')]);_0x51c613(_0x1687fa);});}});});}function getCustomFields(_0x3d979a,_0x370931,_0x4cb319){var _0x19676f={};if(_0x3d979a[_0x3330('0x19')]>0x0){_[_0x3330('0x32')](_0x3d979a,function(_0x3c334f){if(_0x3c334f[_0x3330('0x33')]==='string'&&_0x3c334f[_0x3330('0x34')]&&!_0x3c334f[_0x3330('0x35')]){var _0x5b4d97=_0x3c334f[_0x3330('0x36')][_0x3330('0x23')]();var _0x1acabd=_0x5b4d97[_0x3330('0x2b')](0x0,_0x5b4d97['indexOf']('_'));var _0x5c0b50=_0x5b4d97[_0x3330('0x2b')](_0x5b4d97[_0x3330('0x37')]('_')+0x1);if(_0x1acabd===_0x4cb319){_0x19676f[_0x5c0b50]=_0x3c334f[_0x3330('0x38')];}}});}return _0x19676f;}function getTicket(_0x1f5a98,_0x18797f,_0x450da8,_0x5b3c9b,_0x2117de,_0x4db739,_0x3fec26){return new BPromise(function(_0x2622c3,_0x227317){var _0x1cd822;return getAuthToken(_0x18797f,_0x450da8,_0x3fec26)[_0x3330('0x13')](function(_0x16a3a2){if(_0x4db739[_0x3330('0x39')]==='incident'){_0x1cd822={'method':'POST','uri':_0x5b3c9b+'incidents','body':Object[_0x3330('0x3a')]({},{'title':intUtil[_0x3330('0x3b')](_0x4db739['Subjects'],_0x2117de,'\x20'),'description':intUtil['getString'](_0x4db739['Descriptions'],_0x2117de,'\x0a'),'customerid_contact@odata.bind':_0x3330('0x3c')+_0x1f5a98['enduserId']+')','ownerid@odata.bind':_0x3330('0x27')+_0x1f5a98[_0x3330('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x4db739[_0x3330('0x3d')],_0x2117de,_0x4db739[_0x3330('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x16a3a2,'OData-Version':_0x3330('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4db739[_0x3330('0x39')]==='phonecall'){_0x1cd822={'method':_0x3330('0x25'),'uri':_0x5b3c9b+_0x3330('0x3e'),'body':Object[_0x3330('0x3a')]({},{'subject':intUtil[_0x3330('0x3b')](_0x4db739[_0x3330('0x3f')],_0x2117de,'\x20'),'phonenumber':String(_0x2117de[_0x3330('0x40')]),'description':intUtil[_0x3330('0x3b')](_0x4db739[_0x3330('0x41')],_0x2117de,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x1f5a98[_0x3330('0x2d')]+')','ownerid@odata.bind':_0x3330('0x27')+_0x1f5a98[_0x3330('0x1d')]+')','directioncode':_0x1f5a98[_0x3330('0x42')]===_0x3330('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3330('0x27')+_0x1f5a98['userId']+')','participationtypemask':_0x1f5a98[_0x3330('0x42')]===_0x3330('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x3330('0x3c')+_0x1f5a98[_0x3330('0x2d')]+')','participationtypemask':_0x1f5a98['callDirection']===_0x3330('0x43')?0x1:0x2}]},getCustomFields(_0x4db739['Fields'],_0x2117de,_0x4db739[_0x3330('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x16a3a2,'OData-Version':_0x3330('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1cd822);})[_0x3330('0x13')](function(_0x14f8e5){var _0x2e482a=_0x14f8e5[_0x3330('0x29')][_0x3330('0x2a')];var _0x4fdfde=_0x2e482a[_0x3330('0x2b')](_0x2e482a[_0x3330('0x2c')]('(')+0x1,_0x2e482a['lastIndexOf'](')'));_0x1f5a98['ticketId']=_0x4fdfde;_0x2622c3(_0x1f5a98);})[_0x3330('0xf')](function(_0x3067e5){_0x227317(_0x3067e5[_0x3330('0x22')]);});});}function emit(_0x1060a3,_0xa5b5f7,_0x50b325,_0x2a8405){var _0xb64bff={'uri':util[_0x3330('0x44')](_0x3330('0x45'),_0x1060a3,_0x50b325,_0x2a8405)};io['to'](util['format']('user:%s',_0xa5b5f7))['emit'](_0x3330('0x46'),_0xb64bff);}exports['cs']=function(_0x5b5b74,_0x1c1c44,_0x597f46,_0x2977f7,_0x5e3f18,_0x99c16b,_0x51f261,_0x38dcb2){var _0xba8994={};_0x99c16b[_0x3330('0xb')]=intUtil[_0x3330('0x47')](_0x99c16b[_0x3330('0xb')]);_0x99c16b[_0x3330('0x48')]=intUtil[_0x3330('0x47')](_0x99c16b[_0x3330('0x48')]);_0xba8994[_0x3330('0x42')]=_0x38dcb2==='queue'||_0x38dcb2===_0x3330('0x49')?_0x3330('0x43'):'outbound';var _0x4aea8f=util[_0x3330('0x44')](_0x3330('0x4a'),_0x99c16b[_0x3330('0xb')]);var _0x549194=util['format'](_0x3330('0x4b'),_0x99c16b[_0x3330('0x4c')]);var _0xf4a860=util[_0x3330('0x44')](_0x3330('0x4d'),_0x99c16b[_0x3330('0x48')],_0x1c1c44[_0x3330('0x4e')],md5(_0x1c1c44[_0x3330('0x4e')]));if(_0x5e3f18&&_0x5e3f18[_0x3330('0x4f')]){logger[_0x3330('0x1a')]('[QUEUE]',_0x3330('0x50'));_0x1c1c44[_0x3330('0x51')]=_0xf4a860;}else if(_0x51f261&&_0x51f261[_0x3330('0x52')]&&_0x51f261[_0x3330('0x52')]!==_0x3330('0x53')){logger[_0x3330('0x1a')](_0x3330('0x54'),_0x3330('0x50'));_0x1c1c44[_0x3330('0x51')]=_0xf4a860;}else{_0x1c1c44[_0x3330('0x51')]='';}return getUser(_0xba8994,_0x99c16b,_0x2977f7,_0x549194,_0x4aea8f,_0x38dcb2)['then'](function(_0x41d43e){logger[_0x3330('0x1a')]('['+_0x38dcb2['toUpperCase']()+_0x3330('0x55'),_0x41d43e['userId']);logger[_0x3330('0x1a')]('['+_0x38dcb2['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x41d43e[_0x3330('0x18')]);return getEndUser(_0x41d43e,_0x99c16b,_0x549194,_0x4aea8f,_0x1c1c44,_0x38dcb2);})[_0x3330('0x13')](function(_0x29b2c8){logger['info']('['+_0x38dcb2[_0x3330('0x1e')]()+_0x3330('0x56'),_0x29b2c8[_0x3330('0x2d')]);logger[_0x3330('0x1a')]('['+_0x38dcb2['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x1c1c44[_0x3330('0x40')]);return getTicket(_0x29b2c8,_0x99c16b,_0x549194,_0x4aea8f,_0x1c1c44,_0x597f46,_0x38dcb2);})[_0x3330('0x13')](function(_0x2ca892){logger[_0x3330('0x1a')](util[_0x3330('0x44')]('['+_0x38dcb2[_0x3330('0x1e')]()+_0x3330('0x57'),_0x597f46[_0x3330('0x39')],_0x2ca892[_0x3330('0x58')]));logger['info'](util[_0x3330('0x44')]('['+_0x38dcb2[_0x3330('0x1e')]()+_0x3330('0x59'),_0x38dcb2));if(_0x38dcb2!==_0x3330('0x49')){logger[_0x3330('0x1a')]('['+_0x38dcb2[_0x3330('0x1e')]()+']',_0x3330('0x5a'));emit(_0x99c16b[_0x3330('0xb')],_0x2977f7[_0x3330('0x5b')],_0x597f46[_0x3330('0x39')],_0x2ca892[_0x3330('0x58')]);}})['catch'](function(_0x12f925){logger[_0x3330('0x10')]('['+_0x38dcb2[_0x3330('0x1e')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x3330('0x5c')](_0x12f925,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9d88=[']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','username','access_token','catch','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','toUpperCase','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!','type','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','queue','headers','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d88,0x169));var _0x89d8=function(_0x282b5e,_0x436203){_0x282b5e=_0x282b5e-0x0;var _0x5d08cc=_0x9d88[_0x282b5e];return _0x5d08cc;};'use strict';var _=require(_0x89d8('0x0'));var BPromise=require(_0x89d8('0x1'));var rp=require(_0x89d8('0x2'));var util=require(_0x89d8('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x89d8('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0x89d8('0x5')]=_[_0x89d8('0x6')](config['redis'],{'host':_0x89d8('0x7'),'port':0x18eb});var io=require(_0x89d8('0x8'))(new Redis(config[_0x89d8('0x5')]));function getAuthToken(_0x39166c,_0x349db4,_0x41ec30){var _0x5c05ad={'method':_0x89d8('0x9'),'uri':_0x349db4,'form':{'client_id':_0x39166c['clientId'],'resource':_0x39166c['remoteUri'],'username':_0x39166c[_0x89d8('0xa')],'password':_0x39166c['password'],'grant_type':'password','client_secret':_0x39166c['clientSecret']},'json':!![]};return rp(_0x5c05ad)['then'](function(_0x29117d){return _0x29117d[_0x89d8('0xb')];})[_0x89d8('0xc')](function(_0x4b5819){logger[_0x89d8('0xd')]('['+[_0x41ec30['toUpperCase']()]+_0x89d8('0xe'));return _0x4b5819[_0x89d8('0xf')];});}function getUser(_0x55aee1,_0x35050f,_0x1934d4,_0xa5f43a,_0x5e1589,_0xa954f1){return new BPromise(function(_0x5e63a8,_0x132b7a){return getAuthToken(_0x35050f,_0xa5f43a,_0xa954f1)['then'](function(_0x55d08d){var _0x28e3cc={'method':'GET','uri':_0x5e1589+_0x89d8('0x10'),'headers':{'Authorization':_0x89d8('0x11')+_0x55d08d,'OData-Version':_0x89d8('0x12')},'json':!![]};return rp(_0x28e3cc);})[_0x89d8('0x13')](function(_0x19a484){var _0x3b97e4=_0x19a484[_0x89d8('0x14')];var _0x1bfa6f=![];var _0x23d466=null;if(!_[_0x89d8('0x15')](_0x1934d4)){if(intUtil[_0x89d8('0x16')](_0x1934d4[_0x89d8('0x17')])){_0x55aee1[_0x89d8('0x18')]=_0x1934d4[_0x89d8('0x17')];for(_0x23d466=0x0;_0x23d466<_0x3b97e4[_0x89d8('0x19')];_0x23d466++){if(_0x3b97e4[_0x23d466][_0x89d8('0x1a')]===_0x1934d4[_0x89d8('0x17')]&&!_0x3b97e4[_0x23d466]['isdisabled']){_0x1bfa6f=!![];logger['info']('['+[_0xa954f1[_0x89d8('0x1b')]()]+']\x20Agent\x20found\x20'+_0x3b97e4[_0x23d466]['systemuserid']+'!');_0x55aee1[_0x89d8('0x1c')]=_0x3b97e4[_0x23d466]['systemuserid'];}}}}if(!_0x1bfa6f){logger[_0x89d8('0x1d')]('['+[_0xa954f1[_0x89d8('0x1b')]()]+_0x89d8('0x1e'));_0x55aee1['userEmail']=_0x35050f[_0x89d8('0xa')];for(_0x23d466=0x0;_0x23d466<_0x3b97e4[_0x89d8('0x19')];_0x23d466++){if(_0x3b97e4[_0x23d466][_0x89d8('0x1a')]===_0x35050f[_0x89d8('0xa')]){_0x55aee1[_0x89d8('0x1c')]=_0x3b97e4[_0x23d466][_0x89d8('0x1f')];}}}_0x5e63a8(_0x55aee1);})['catch'](function(_0x20922d){_0x132b7a(_0x20922d['message']);});});}function createEndUser(_0xb5196d,_0x51518a,_0x11f2ba,_0x3cadef,_0x204bdc,_0x1fe63f){return new BPromise(function(_0x252282,_0x4b2b43){return getAuthToken(_0x51518a,_0x11f2ba,_0x1fe63f)[_0x89d8('0x13')](function(_0x548c55){var _0x469be1=_0x1fe63f[_0x89d8('0x20')]()===_0x89d8('0x21')?_0x204bdc[_0x89d8('0x22')]:_0x204bdc[_0x89d8('0x23')];var _0xc50ffa={'method':_0x89d8('0x9'),'uri':_0x3cadef+_0x89d8('0x24'),'body':{'telephone1':_0x469be1,'fullname':_0x469be1,'firstname':_0x469be1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x89d8('0x25')+_0xb5196d[_0x89d8('0x1c')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x548c55,'OData-Version':_0x89d8('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xc50ffa);})[_0x89d8('0x13')](function(_0x3747cd){var _0x534c6d=_0x3747cd['headers'][_0x89d8('0x26')];var _0x3a2832=_0x534c6d[_0x89d8('0x27')](_0x534c6d['lastIndexOf']('(')+0x1,_0x534c6d['lastIndexOf'](')'));_0xb5196d[_0x89d8('0x28')]=_0x3a2832;_0x252282(_0xb5196d);})[_0x89d8('0xc')](function(_0x4c322b){_0x4b2b43(_0x4c322b[_0x89d8('0xf')]);});});}function getEndUser(_0x17e923,_0x46a2b9,_0x2557c6,_0x301c2f,_0x376909,_0x72a9f6){return new BPromise(function(_0x3157ca,_0x1c3e0b){return getAuthToken(_0x46a2b9,_0x2557c6,_0x72a9f6)[_0x89d8('0x13')](function(_0x19ff36){var _0x97545c={'method':'GET','uri':_0x301c2f+_0x89d8('0x29'),'headers':{'Authorization':_0x89d8('0x11')+_0x19ff36,'If-None-Match':null,'OData-Version':_0x89d8('0x12')},'json':!![]};return rp(_0x97545c);})[_0x89d8('0x13')](function(_0x8969e8){var _0x332d2d=null;if(_0x8969e8){var _0x26dada=_0x8969e8['value'];var _0x56e57b=![];for(_0x332d2d=0x0;_0x332d2d<_0x26dada['length'];_0x332d2d++){var _0x1aac18=_0x72a9f6[_0x89d8('0x20')]()===_0x89d8('0x21')?_0x376909['destcalleridnum']:_0x376909[_0x89d8('0x23')];if(_0x26dada[_0x332d2d][_0x89d8('0x2a')]===_0x1aac18){_0x56e57b=!![];_0x17e923[_0x89d8('0x28')]=_0x26dada[_0x332d2d][_0x89d8('0x2b')];}}if(_0x56e57b){_0x3157ca(_0x17e923);}else{return createEndUser(_0x17e923,_0x46a2b9,_0x2557c6,_0x301c2f,_0x376909,_0x72a9f6)[_0x89d8('0x13')](function(_0x4f8f5b){logger['info']('['+[_0x72a9f6[_0x89d8('0x1b')]()]+_0x89d8('0x2c'),_0x4f8f5b['enduserId']);_0x3157ca(_0x4f8f5b);});}}else{return createEndUser(_0x17e923,_0x46a2b9,_0x2557c6,_0x301c2f,_0x376909,_0x72a9f6)[_0x89d8('0x13')](function(_0xd91b0){logger['info']('['+[_0x72a9f6['toUpperCase']()]+']\x20Enduser\x20Created!',_0xd91b0[_0x89d8('0x28')]);_0x3157ca(_0xd91b0);});}});});}function getCustomFields(_0x34fd10,_0x2697d0,_0x2b2b50){var _0x1a3a57={};if(_0x34fd10[_0x89d8('0x19')]>0x0){_['forEach'](_0x34fd10,function(_0x4a726b){if(_0x4a726b[_0x89d8('0x2d')]==='string'&&_0x4a726b[_0x89d8('0x2e')]&&!_0x4a726b[_0x89d8('0x2f')]){var _0xd7b470=_0x4a726b[_0x89d8('0x30')][_0x89d8('0x20')]();var _0x21b52b=_0xd7b470[_0x89d8('0x27')](0x0,_0xd7b470[_0x89d8('0x31')]('_'));var _0x69cc61=_0xd7b470[_0x89d8('0x27')](_0xd7b470['indexOf']('_')+0x1);if(_0x21b52b===_0x2b2b50){_0x1a3a57[_0x69cc61]=_0x4a726b[_0x89d8('0x32')];}}});}return _0x1a3a57;}function getTicket(_0x2b9e8d,_0x1df07d,_0x504055,_0x4af27f,_0x54d377,_0x5d9a78,_0x543458){return new BPromise(function(_0x369dfc,_0x192529){var _0x423bff;return getAuthToken(_0x1df07d,_0x504055,_0x543458)['then'](function(_0x492b53){if(_0x5d9a78[_0x89d8('0x33')]==='incident'){_0x423bff={'method':_0x89d8('0x9'),'uri':_0x4af27f+_0x89d8('0x34'),'body':Object[_0x89d8('0x35')]({},{'title':intUtil[_0x89d8('0x36')](_0x5d9a78[_0x89d8('0x37')],_0x54d377,'\x20'),'description':intUtil['getString'](_0x5d9a78[_0x89d8('0x38')],_0x54d377,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2b9e8d[_0x89d8('0x28')]+')','ownerid@odata.bind':_0x89d8('0x25')+_0x2b9e8d[_0x89d8('0x1c')]+')','caseorigincode':'1'},getCustomFields(_0x5d9a78[_0x89d8('0x39')],_0x54d377,_0x5d9a78[_0x89d8('0x33')])),'headers':{'Authorization':_0x89d8('0x11')+_0x492b53,'OData-Version':_0x89d8('0x12')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5d9a78[_0x89d8('0x33')]===_0x89d8('0x3a')){_0x423bff={'method':_0x89d8('0x9'),'uri':_0x4af27f+_0x89d8('0x3b'),'body':Object['assign']({},{'subject':intUtil[_0x89d8('0x36')](_0x5d9a78[_0x89d8('0x37')],_0x54d377,'\x20'),'phonenumber':String(_0x54d377['calleridnum']),'description':intUtil[_0x89d8('0x36')](_0x5d9a78[_0x89d8('0x38')],_0x54d377,'\x0a'),'regardingobjectid_contact@odata.bind':_0x89d8('0x3c')+_0x2b9e8d[_0x89d8('0x28')]+')','ownerid@odata.bind':'/systemusers('+_0x2b9e8d[_0x89d8('0x1c')]+')','directioncode':_0x2b9e8d[_0x89d8('0x3d')]===_0x89d8('0x3e')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x89d8('0x25')+_0x2b9e8d['userId']+')','participationtypemask':_0x2b9e8d[_0x89d8('0x3d')]===_0x89d8('0x3e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2b9e8d[_0x89d8('0x28')]+')','participationtypemask':_0x2b9e8d['callDirection']===_0x89d8('0x3e')?0x1:0x2}]},getCustomFields(_0x5d9a78['Fields'],_0x54d377,_0x5d9a78[_0x89d8('0x33')])),'headers':{'Authorization':_0x89d8('0x11')+_0x492b53,'OData-Version':_0x89d8('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x423bff);})['then'](function(_0x716537){var _0x444903=_0x716537[_0x89d8('0x3f')][_0x89d8('0x26')];var _0x50707a=_0x444903[_0x89d8('0x27')](_0x444903[_0x89d8('0x40')]('(')+0x1,_0x444903[_0x89d8('0x40')](')'));_0x2b9e8d[_0x89d8('0x41')]=_0x50707a;_0x369dfc(_0x2b9e8d);})[_0x89d8('0xc')](function(_0x2460af){_0x192529(_0x2460af[_0x89d8('0xf')]);});});}function emit(_0x345a44,_0x18fba2,_0x461e31,_0x41b2c4){var _0x47b7a6={'uri':util[_0x89d8('0x42')](_0x89d8('0x43'),_0x345a44,_0x461e31,_0x41b2c4)};io['to'](util['format'](_0x89d8('0x44'),_0x18fba2))['emit']('trigger:browser:url',_0x47b7a6);}exports['cs']=function(_0x4ddd85,_0x24bb53,_0x24a498,_0x1860a2,_0x424b3f,_0x379160,_0x224295,_0x4f1018){var _0x164315={};_0x379160[_0x89d8('0x45')]=intUtil[_0x89d8('0x46')](_0x379160[_0x89d8('0x45')]);_0x379160[_0x89d8('0x47')]=intUtil[_0x89d8('0x46')](_0x379160[_0x89d8('0x47')]);_0x164315[_0x89d8('0x3d')]=_0x4f1018===_0x89d8('0x3e')||_0x4f1018===_0x89d8('0x48')?_0x89d8('0x3e'):_0x89d8('0x21');var _0x5d91bd=util[_0x89d8('0x42')](_0x89d8('0x49'),_0x379160[_0x89d8('0x45')]);var _0x24ac78=util[_0x89d8('0x42')](_0x89d8('0x4a'),_0x379160[_0x89d8('0x4b')]);var _0x1595a9=util['format'](_0x89d8('0x4c'),_0x379160[_0x89d8('0x47')],_0x24bb53['uniqueid'],md5(_0x24bb53[_0x89d8('0x4d')]));if(_0x424b3f&&_0x424b3f['monitor_format']){logger[_0x89d8('0x1d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x24bb53[_0x89d8('0x4e')]=_0x1595a9;}else if(_0x224295&&_0x224295[_0x89d8('0x4f')]&&_0x224295[_0x89d8('0x4f')]!==_0x89d8('0x50')){logger[_0x89d8('0x1d')]('[OUTBOUND]',_0x89d8('0x51'));_0x24bb53[_0x89d8('0x4e')]=_0x1595a9;}else{_0x24bb53[_0x89d8('0x4e')]='';}return getUser(_0x164315,_0x379160,_0x1860a2,_0x24ac78,_0x5d91bd,_0x4f1018)[_0x89d8('0x13')](function(_0x204025){logger['info']('['+_0x4f1018['toUpperCase']()+_0x89d8('0x52'),_0x204025[_0x89d8('0x1c')]);logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+_0x89d8('0x53'),_0x204025[_0x89d8('0x18')]);return getEndUser(_0x204025,_0x379160,_0x24ac78,_0x5d91bd,_0x24bb53,_0x4f1018);})['then'](function(_0x1888f6){logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1888f6['enduserId']);logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+_0x89d8('0x54'),_0x24bb53[_0x89d8('0x23')]);return getTicket(_0x1888f6,_0x379160,_0x24ac78,_0x5d91bd,_0x24bb53,_0x24a498,_0x4f1018);})[_0x89d8('0x13')](function(_0x23c989){logger[_0x89d8('0x1d')](util[_0x89d8('0x42')]('['+_0x4f1018[_0x89d8('0x1b')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x24a498[_0x89d8('0x33')],_0x23c989[_0x89d8('0x41')]));logger[_0x89d8('0x1d')](util[_0x89d8('0x42')]('['+_0x4f1018['toUpperCase']()+_0x89d8('0x55'),_0x4f1018));if(_0x4f1018!==_0x89d8('0x48')){logger[_0x89d8('0x1d')]('['+_0x4f1018[_0x89d8('0x1b')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x379160['remoteUri'],_0x1860a2[_0x89d8('0x56')],_0x24a498[_0x89d8('0x33')],_0x23c989[_0x89d8('0x41')]);}})[_0x89d8('0xc')](function(_0x3f6db3){logger['error']('['+_0x4f1018[_0x89d8('0x1b')]()+_0x89d8('0x57'),util[_0x89d8('0x58')](_0x3f6db3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index e5fe621..06e59c1 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 _0x8a08=['toString','customField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','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','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','base64','[HTTP]','stringify','GET','map','forEach','string','nameField','idField','push','content'];(function(_0x2590fc,_0x5950b1){var _0x31aef1=function(_0x3d99e9){while(--_0x3d99e9){_0x2590fc['push'](_0x2590fc['shift']());}};_0x31aef1(++_0x5950b1);}(_0x8a08,0x138));var _0x88a0=function(_0x195d0a,_0x14edcb){_0x195d0a=_0x195d0a-0x0;var _0x11d125=_0x8a08[_0x195d0a];return _0x11d125;};'use strict';var _=require(_0x88a0('0x0'));var rp=require(_0x88a0('0x1'));var md5=require(_0x88a0('0x2'));var util=require('util');var Redis=require(_0x88a0('0x3'));var intUtil=require(_0x88a0('0x4'));var config=require(_0x88a0('0x5'));var logger=require(_0x88a0('0x6'))(_0x88a0('0x7'));config[_0x88a0('0x8')]=_[_0x88a0('0x9')](config['redis'],{'host':_0x88a0('0xa'),'port':0x18eb});var io=require(_0x88a0('0xb'))(new Redis(config[_0x88a0('0x8')]));var headers={'Content-Type':_0x88a0('0xc'),'Accept':'application/json'};function emit(_0x47579b,_0x123c81,_0x351314){io['to'](_0x47579b)['emit'](_0x123c81,_0x351314);}function getTicket(_0x586137,_0x25c265,_0x133e77,_0x590995,_0x33c83b){logger[_0x88a0('0xd')](_0x88a0('0xe'));var _0x3b991d=_[_0x88a0('0xf')]({'responder_id':_0x25c265['id'],'requester_id':_0x133e77['id'],'name':util[_0x88a0('0x10')](_0x88a0('0x11'),_0x33c83b[_0x88a0('0x12')]),'phone':_0x33c83b[_0x88a0('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x590995['Subjects'],_0x33c83b,'\x20'),'description':intUtil['getString'](_0x590995[_0x88a0('0x14')],_0x33c83b,_0x88a0('0x15')),'tags':getTags(_0x590995[_0x88a0('0x16')],_0x88a0('0x17'))},getCustomFields(_0x590995[_0x88a0('0x18')],_0x33c83b));_0x3b991d[_0x88a0('0x19')]=_[_0x88a0('0x1a')](_['keyBy'](_0x3b991d[_0x88a0('0x19')],'id'),_0x88a0('0x1b'));return request({'uri':util['format'](_0x88a0('0x1c'),_0x586137['remoteUri']),'method':'POST','body':_0x3b991d})['then'](function(_0x4c84aa){logger[_0x88a0('0xd')](_0x88a0('0x1d'));return _0x4c84aa;});}function getUser(_0x27ae09,_0x2e4513){if(intUtil[_0x88a0('0x1e')](_0x2e4513)){return request({'uri':util['format'](_0x88a0('0x1f'),_0x27ae09[_0x88a0('0x20')]),'qs':{'email':_0x2e4513}})[_0x88a0('0x21')](function(_0x1e2cd0){if(_0x1e2cd0[_0x88a0('0x22')]){logger[_0x88a0('0xd')](_0x88a0('0x23'));return _[_0x88a0('0x24')](_0x1e2cd0,function(_0x5bf441){return _0x5bf441[_0x88a0('0x25')][_0x88a0('0x26')]===_0x2e4513;});}else{logger[_0x88a0('0xd')](_0x88a0('0x27'));return request({'uri':util[_0x88a0('0x10')](_0x88a0('0x28'),_0x27ae09[_0x88a0('0x20')])})[_0x88a0('0x21')](function(_0x36a9c3){logger[_0x88a0('0xd')]('Admin\x20account\x20selected.');return _0x36a9c3;});}});}else{logger[_0x88a0('0xd')](_0x88a0('0x29'));return request({'uri':util[_0x88a0('0x10')](_0x88a0('0x28'),_0x27ae09['remoteUri'])})[_0x88a0('0x21')](function(_0xba717e){logger[_0x88a0('0xd')](_0x88a0('0x2a'));return _0xba717e;});}}function getEndUser(_0x42707b,_0x391043,_0x5a3925){logger[_0x88a0('0xd')](_0x88a0('0x2b'),_0x5a3925);return request({'uri':util[_0x88a0('0x10')](_0x88a0('0x2c'),_0x42707b[_0x88a0('0x20')]),'qs':{'phone':_0x5a3925}})[_0x88a0('0x21')](function(_0x2aade5){if(_0x2aade5[_0x88a0('0x22')]){logger[_0x88a0('0xd')]('Enduser\x20found!');return _['find'](_0x2aade5,{'phone':_0x5a3925});}else{logger[_0x88a0('0xd')](_0x88a0('0x2d'));return request({'uri':util[_0x88a0('0x10')]('%s/api/v2/contacts',_0x42707b[_0x88a0('0x20')]),'method':_0x88a0('0x2e'),'body':{'name':_0x391043,'phone':_0x5a3925}})[_0x88a0('0x21')](function(_0x39d498){logger['info']('Enduser\x20created.');return _0x39d498;});}});}function getAuth(_0x489233){return util[_0x88a0('0x10')](_0x88a0('0x2f'),new Buffer(_0x489233[_0x88a0('0x30')]+':X')['toString'](_0x88a0('0x31')));}function request(_0x336a81){logger['debug'](_0x88a0('0x32'),JSON[_0x88a0('0x33')](_0x336a81));return rp(_['defaults'](_0x336a81,{'method':_0x88a0('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4c8699,_0x55d95a){var _0x3bcd7a=[];if(_0x4c8699&&_0x4c8699[_0x88a0('0x22')]>0x0){_0x3bcd7a=_[_0x88a0('0x35')](_0x4c8699,_0x55d95a);}return _0x3bcd7a;}function getCustomFields(_0x3f4f4b,_0x3d6748){var _0x18876b=[];var _0x5d668e={'custom_fields':[]};if(_0x3f4f4b[_0x88a0('0x22')]>0x0){_[_0x88a0('0x36')](_0x3f4f4b,function(_0x5e7397){if(_0x5e7397['type']===_0x88a0('0x37')&&_0x5e7397[_0x88a0('0x38')]&&!_0x5e7397['customField']){_0x5d668e[_0x5e7397['nameField']['toLowerCase']()]=_0x5e7397['content']['toString']();}else if(_0x5e7397['type']===_0x88a0('0x37')&&_0x5e7397[_0x88a0('0x39')]&&_0x5e7397['customField']){_0x5d668e['custom_fields'][_0x88a0('0x3a')]({'id':_0x5e7397[_0x88a0('0x39')],'value':_0x5e7397[_0x88a0('0x3b')][_0x88a0('0x3c')]()});}else if(_0x5e7397['type']==='variable'&&_0x5e7397['variableName']&&_0x5e7397[_0x88a0('0x39')]&&_0x5e7397[_0x88a0('0x3d')]){_0x3d6748[_0x5e7397['variableName']]&&_0x5d668e['custom_fields'][_0x88a0('0x3a')]({'id':_0x5e7397[_0x88a0('0x39')],'value':_0x3d6748[_0x5e7397['variableName']][_0x88a0('0x3c')]()});}else if(_0x5e7397['type']===_0x88a0('0x3e')&&_0x5e7397[_0x88a0('0x3f')]&&_0x5e7397[_0x88a0('0x3f')][_0x88a0('0x17')]&&_0x5e7397[_0x88a0('0x39')]&&_0x5e7397['customField']){_0x3d6748[_0x5e7397[_0x88a0('0x3f')]['name'][_0x88a0('0x40')]()]&&_0x5d668e['custom_fields'][_0x88a0('0x3a')]({'id':_0x5e7397[_0x88a0('0x39')],'value':_0x3d6748[_0x5e7397[_0x88a0('0x3f')][_0x88a0('0x17')]['toLowerCase']()]['toString']()});}});}return _0x5d668e;}exports[_0x88a0('0x41')]=function(_0x4f3cf7,_0x264675,_0x44dccc,_0x2a0c96,_0x23dc1e,_0x368970){var _0x4c6470,_0x2d473d;_0x368970[_0x88a0('0x20')]=intUtil[_0x88a0('0x42')](_0x368970['remoteUri']);_0x368970[_0x88a0('0x43')]=intUtil['stripTrailingSlash'](_0x368970[_0x88a0('0x43')]);if(_0x23dc1e&&_0x23dc1e[_0x88a0('0x44')]){logger['info'](_0x88a0('0x45'),_0x88a0('0x46'));_0x264675['recordingURL']=util[_0x88a0('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x368970[_0x88a0('0x43')],_0x264675[_0x88a0('0x47')],md5(_0x264675[_0x88a0('0x47')]));}else{_0x264675[_0x88a0('0x48')]='';}headers['Authorization']=getAuth(_0x368970);return getUser(_0x368970,_0x2a0c96[_0x88a0('0x26')])[_0x88a0('0x21')](function(_0x23facb){_0x4c6470=_0x23facb;logger[_0x88a0('0xd')](_0x88a0('0x49'),_0x4c6470['id']);return getEndUser(_0x368970,_0x264675[_0x88a0('0x12')],_0x264675['calleridnum']);})[_0x88a0('0x21')](function(_0x11e72b){_0x2d473d=_0x11e72b;logger[_0x88a0('0xd')](_0x88a0('0x4a'),_0x2d473d['id']);return getTicket(_0x368970,_0x4c6470,_0x2d473d,_0x44dccc,_0x264675);})[_0x88a0('0x21')](function(_0x11f83e){if(_0x11f83e&&_0x11f83e['id']){logger[_0x88a0('0xd')](_0x88a0('0x1d'));logger[_0x88a0('0xd')](_0x88a0('0x4b'),_0x11f83e['id']);logger[_0x88a0('0xd')](_0x88a0('0x45'),_0x88a0('0x4c'));emit(util[_0x88a0('0x10')](_0x88a0('0x4d'),_0x2a0c96[_0x88a0('0x17')]),_0x88a0('0x4e'),{'uri':util['format'](_0x88a0('0x4f'),_0x368970[_0x88a0('0x20')],_0x11f83e['id'])});}})[_0x88a0('0x50')](function(_0x2fcb96){logger[_0x88a0('0x51')](_0x88a0('0x45'),JSON[_0x88a0('0x33')](_0x2fcb96));});};exports[_0x88a0('0x52')]=function(_0x22bcae,_0x5a8533,_0x9b9136,_0x4a987c,_0x781776,_0xfcc761,_0x123801){var _0x2a4ec2,_0x16ab68;_0xfcc761[_0x88a0('0x20')]=intUtil[_0x88a0('0x42')](_0xfcc761[_0x88a0('0x20')]);_0xfcc761[_0x88a0('0x43')]=intUtil[_0x88a0('0x42')](_0xfcc761[_0x88a0('0x43')]);if(_0x123801&&_0x123801['recordingFormat']&&_0x123801[_0x88a0('0x53')]!==_0x88a0('0x54')){logger[_0x88a0('0xd')](_0x88a0('0x55'),_0x88a0('0x46'));_0x5a8533['recordingURL']=util[_0x88a0('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfcc761[_0x88a0('0x43')],_0x5a8533[_0x88a0('0x47')],md5(_0x5a8533[_0x88a0('0x47')]));}headers[_0x88a0('0x56')]=getAuth(_0xfcc761);return getUser(_0xfcc761,_0x4a987c['email'])[_0x88a0('0x21')](function(_0x572d32){_0x2a4ec2=_0x572d32;logger[_0x88a0('0xd')](_0x88a0('0x49'),_0x2a4ec2['id']);return getEndUser(_0xfcc761,_0x5a8533[_0x88a0('0x57')],_0x5a8533[_0x88a0('0x58')]);})[_0x88a0('0x21')](function(_0x249785){_0x16ab68=_0x249785;logger[_0x88a0('0xd')]('The\x20Enduser\x20ID\x20is:',_0x16ab68['id']);return getTicket(_0xfcc761,_0x2a4ec2,_0x16ab68,_0x9b9136,_0x5a8533);})[_0x88a0('0x21')](function(_0x2b76fd){if(_0x2b76fd&&_0x2b76fd['id']){logger[_0x88a0('0xd')]('Ticket\x20created!');logger['info'](_0x88a0('0x4b'),_0x2b76fd['id']);logger[_0x88a0('0xd')](_0x88a0('0x55'),_0x88a0('0x4c'));emit(util['format'](_0x88a0('0x4d'),_0x4a987c['name']),_0x88a0('0x4e'),{'uri':util[_0x88a0('0x10')](_0x88a0('0x4f'),_0xfcc761[_0x88a0('0x20')],_0x2b76fd['id'])});}})['catch'](function(_0x376385){logger[_0x88a0('0x51')](_0x88a0('0x55'),JSON[_0x88a0('0x33')](_0x376385));});};exports[_0x88a0('0x59')]=function(_0x133931,_0x394edf,_0x5a4ff6,_0x4a66fe,_0x54818f,_0x204c8f){var _0x1617c6,_0x267489;_0x204c8f[_0x88a0('0x20')]=intUtil['stripTrailingSlash'](_0x204c8f[_0x88a0('0x20')]);_0x204c8f['serverUrl']=intUtil['stripTrailingSlash'](_0x204c8f[_0x88a0('0x43')]);if(_0x54818f&&_0x54818f['monitor_format']){logger[_0x88a0('0xd')]('['+_0x394edf['lastevent'][_0x88a0('0x5a')]()+']',_0x88a0('0x46'));_0x394edf['recordingURL']=util['format'](_0x88a0('0x5b'),_0x204c8f[_0x88a0('0x43')],_0x394edf[_0x88a0('0x47')],md5(_0x394edf[_0x88a0('0x47')]));}else{_0x394edf[_0x88a0('0x48')]='';}headers[_0x88a0('0x56')]=getAuth(_0x204c8f);return getUser(_0x204c8f,'')[_0x88a0('0x21')](function(_0x2aa19b){_0x1617c6=_0x2aa19b;logger[_0x88a0('0xd')](_0x88a0('0x49'),_0x1617c6['id']);return getEndUser(_0x204c8f,_0x394edf[_0x88a0('0x12')],_0x394edf['calleridnum']);})['then'](function(_0x134591){_0x267489=_0x134591;logger[_0x88a0('0xd')](_0x88a0('0x4a'),_0x267489['id']);return getTicket(_0x204c8f,_0x1617c6,_0x267489,_0x5a4ff6,_0x394edf);})[_0x88a0('0x21')](function(_0x4c73bf){if(_0x4c73bf){logger['info'](_0x88a0('0x1d'));logger['info'](_0x88a0('0x4b'),_0x4c73bf['id']);}})[_0x88a0('0x50')](function(_0x2970de){logger[_0x88a0('0x51')]('['+_0x394edf[_0x88a0('0x5c')][_0x88a0('0x5a')]()+']',JSON[_0x88a0('0x33')](_0x2970de));});}; \ No newline at end of file +var _0xba77=['queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','user:%s','catch','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','format','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable'];(function(_0x1d5569,_0x15b4a1){var _0x1fa491=function(_0x37b147){while(--_0x37b147){_0x1d5569['push'](_0x1d5569['shift']());}};_0x1fa491(++_0x15b4a1);}(_0xba77,0xd0));var _0x7ba7=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0xba77[_0x5cabfd];return _0x4bc06c;};'use strict';var _=require(_0x7ba7('0x0'));var rp=require(_0x7ba7('0x1'));var md5=require(_0x7ba7('0x2'));var util=require(_0x7ba7('0x3'));var Redis=require(_0x7ba7('0x4'));var intUtil=require(_0x7ba7('0x5'));var config=require(_0x7ba7('0x6'));var logger=require('../../../../config/logger')(_0x7ba7('0x7'));config['redis']=_[_0x7ba7('0x8')](config[_0x7ba7('0x9')],{'host':_0x7ba7('0xa'),'port':0x18eb});var io=require(_0x7ba7('0xb'))(new Redis(config[_0x7ba7('0x9')]));var headers={'Content-Type':_0x7ba7('0xc'),'Accept':'application/json'};function emit(_0x33f1bc,_0x720e1f,_0x2ab1f5){io['to'](_0x33f1bc)[_0x7ba7('0xd')](_0x720e1f,_0x2ab1f5);}function getTicket(_0x26c0aa,_0x3bc1ad,_0x10658f,_0x56900e,_0x3c92e6){logger[_0x7ba7('0xe')]('Creating\x20new\x20ticket...');var _0x20b1da=_[_0x7ba7('0xf')]({'responder_id':_0x3bc1ad['id'],'requester_id':_0x10658f['id'],'name':util['format'](_0x7ba7('0x10'),_0x3c92e6[_0x7ba7('0x11')]),'phone':_0x3c92e6[_0x7ba7('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7ba7('0x13')](_0x56900e[_0x7ba7('0x14')],_0x3c92e6,'\x20'),'description':intUtil['getString'](_0x56900e[_0x7ba7('0x15')],_0x3c92e6,_0x7ba7('0x16')),'tags':getTags(_0x56900e[_0x7ba7('0x17')],_0x7ba7('0x18'))},getCustomFields(_0x56900e[_0x7ba7('0x19')],_0x3c92e6));_0x20b1da[_0x7ba7('0x1a')]=_[_0x7ba7('0x1b')](_['keyBy'](_0x20b1da['custom_fields'],'id'),_0x7ba7('0x1c'));return request({'uri':util[_0x7ba7('0x1d')]('%s/api/v2/tickets',_0x26c0aa[_0x7ba7('0x1e')]),'method':_0x7ba7('0x1f'),'body':_0x20b1da})[_0x7ba7('0x20')](function(_0x4802d2){logger[_0x7ba7('0xe')](_0x7ba7('0x21'));return _0x4802d2;});}function getUser(_0x15ef3d,_0x212897){if(intUtil[_0x7ba7('0x22')](_0x212897)){return request({'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x23'),_0x15ef3d[_0x7ba7('0x1e')]),'qs':{'email':_0x212897}})['then'](function(_0x5db581){if(_0x5db581[_0x7ba7('0x24')]){logger[_0x7ba7('0xe')]('Agent\x20found!');return _[_0x7ba7('0x25')](_0x5db581,function(_0x3d84d9){return _0x3d84d9[_0x7ba7('0x26')]['email']===_0x212897;});}else{logger[_0x7ba7('0xe')](_0x7ba7('0x27'));return request({'uri':util[_0x7ba7('0x1d')]('%s/api/v2/agents/me',_0x15ef3d['remoteUri'])})[_0x7ba7('0x20')](function(_0x2339a4){logger[_0x7ba7('0xe')](_0x7ba7('0x28'));return _0x2339a4;});}});}else{logger['info'](_0x7ba7('0x29'));return request({'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x2a'),_0x15ef3d[_0x7ba7('0x1e')])})['then'](function(_0x3e3d4a){logger[_0x7ba7('0xe')](_0x7ba7('0x28'));return _0x3e3d4a;});}}function getEndUser(_0x3b60ed,_0x2486de,_0x22fd2f){logger['info'](_0x7ba7('0x2b'),_0x22fd2f);return request({'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x2c'),_0x3b60ed['remoteUri']),'qs':{'phone':_0x22fd2f}})[_0x7ba7('0x20')](function(_0x266094){if(_0x266094[_0x7ba7('0x24')]){logger[_0x7ba7('0xe')]('Enduser\x20found!');return _['find'](_0x266094,{'phone':_0x22fd2f});}else{logger[_0x7ba7('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7ba7('0x1d')]('%s/api/v2/contacts',_0x3b60ed[_0x7ba7('0x1e')]),'method':_0x7ba7('0x1f'),'body':{'name':_0x2486de,'phone':_0x22fd2f}})[_0x7ba7('0x20')](function(_0xc536ad){logger[_0x7ba7('0xe')](_0x7ba7('0x2d'));return _0xc536ad;});}});}function getAuth(_0x189267){return util['format']('Basic\x20%s',new Buffer(_0x189267[_0x7ba7('0x2e')]+':X')[_0x7ba7('0x2f')](_0x7ba7('0x30')));}function request(_0x40823c){logger['debug'](_0x7ba7('0x31'),JSON[_0x7ba7('0x32')](_0x40823c));return rp(_[_0x7ba7('0x8')](_0x40823c,{'method':_0x7ba7('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x376e87,_0x3298ba){var _0x3cdffd=[];if(_0x376e87&&_0x376e87[_0x7ba7('0x24')]>0x0){_0x3cdffd=_[_0x7ba7('0x34')](_0x376e87,_0x3298ba);}return _0x3cdffd;}function getCustomFields(_0x436828,_0x10dbb2){var _0x3341bc=[];var _0x2f9d94={'custom_fields':[]};if(_0x436828[_0x7ba7('0x24')]>0x0){_[_0x7ba7('0x35')](_0x436828,function(_0x5817e5){if(_0x5817e5[_0x7ba7('0x36')]===_0x7ba7('0x37')&&_0x5817e5[_0x7ba7('0x38')]&&!_0x5817e5[_0x7ba7('0x39')]){_0x2f9d94[_0x5817e5[_0x7ba7('0x38')][_0x7ba7('0x3a')]()]=_0x5817e5[_0x7ba7('0x3b')][_0x7ba7('0x2f')]();}else if(_0x5817e5[_0x7ba7('0x36')]===_0x7ba7('0x37')&&_0x5817e5[_0x7ba7('0x3c')]&&_0x5817e5['customField']){_0x2f9d94[_0x7ba7('0x1a')][_0x7ba7('0x3d')]({'id':_0x5817e5[_0x7ba7('0x3c')],'value':_0x5817e5['content'][_0x7ba7('0x2f')]()});}else if(_0x5817e5[_0x7ba7('0x36')]==='variable'&&_0x5817e5[_0x7ba7('0x3e')]&&_0x5817e5[_0x7ba7('0x3c')]&&_0x5817e5[_0x7ba7('0x39')]){_0x10dbb2[_0x5817e5[_0x7ba7('0x3e')]]&&_0x2f9d94[_0x7ba7('0x1a')]['push']({'id':_0x5817e5[_0x7ba7('0x3c')],'value':_0x10dbb2[_0x5817e5[_0x7ba7('0x3e')]][_0x7ba7('0x2f')]()});}else if(_0x5817e5[_0x7ba7('0x36')]===_0x7ba7('0x3f')&&_0x5817e5[_0x7ba7('0x40')]&&_0x5817e5[_0x7ba7('0x40')][_0x7ba7('0x18')]&&_0x5817e5[_0x7ba7('0x3c')]&&_0x5817e5[_0x7ba7('0x39')]){_0x10dbb2[_0x5817e5[_0x7ba7('0x40')][_0x7ba7('0x18')][_0x7ba7('0x3a')]()]&&_0x2f9d94[_0x7ba7('0x1a')][_0x7ba7('0x3d')]({'id':_0x5817e5[_0x7ba7('0x3c')],'value':_0x10dbb2[_0x5817e5[_0x7ba7('0x40')]['name'][_0x7ba7('0x3a')]()][_0x7ba7('0x2f')]()});}});}return _0x2f9d94;}exports[_0x7ba7('0x41')]=function(_0x1c591c,_0x2be1ef,_0x5b2394,_0x3e0800,_0x154e0e,_0x34f5a7){var _0x2eca28,_0x14ced6;_0x34f5a7[_0x7ba7('0x1e')]=intUtil[_0x7ba7('0x42')](_0x34f5a7[_0x7ba7('0x1e')]);_0x34f5a7[_0x7ba7('0x43')]=intUtil[_0x7ba7('0x42')](_0x34f5a7['serverUrl']);if(_0x154e0e&&_0x154e0e['monitor_format']){logger[_0x7ba7('0xe')]('[QUEUE]',_0x7ba7('0x44'));_0x2be1ef['recordingURL']=util[_0x7ba7('0x1d')](_0x7ba7('0x45'),_0x34f5a7[_0x7ba7('0x43')],_0x2be1ef[_0x7ba7('0x46')],md5(_0x2be1ef[_0x7ba7('0x46')]));}else{_0x2be1ef[_0x7ba7('0x47')]='';}headers[_0x7ba7('0x48')]=getAuth(_0x34f5a7);return getUser(_0x34f5a7,_0x3e0800[_0x7ba7('0x49')])[_0x7ba7('0x20')](function(_0x252022){_0x2eca28=_0x252022;logger[_0x7ba7('0xe')](_0x7ba7('0x4a'),_0x2eca28['id']);return getEndUser(_0x34f5a7,_0x2be1ef[_0x7ba7('0x11')],_0x2be1ef[_0x7ba7('0x12')]);})[_0x7ba7('0x20')](function(_0x229b1c){_0x14ced6=_0x229b1c;logger[_0x7ba7('0xe')](_0x7ba7('0x4b'),_0x14ced6['id']);return getTicket(_0x34f5a7,_0x2eca28,_0x14ced6,_0x5b2394,_0x2be1ef);})['then'](function(_0x234800){if(_0x234800&&_0x234800['id']){logger[_0x7ba7('0xe')]('Ticket\x20created!');logger[_0x7ba7('0xe')](_0x7ba7('0x4c'),_0x234800['id']);logger['info'](_0x7ba7('0x4d'),_0x7ba7('0x4e'));emit(util[_0x7ba7('0x1d')]('user:%s',_0x3e0800['name']),_0x7ba7('0x4f'),{'uri':util['format'](_0x7ba7('0x50'),_0x34f5a7[_0x7ba7('0x1e')],_0x234800['id'])});}})['catch'](function(_0x4e1c0b){logger['error'](_0x7ba7('0x4d'),JSON[_0x7ba7('0x32')](_0x4e1c0b));});};exports[_0x7ba7('0x51')]=function(_0x104d99,_0x293f35,_0x1c41af,_0x1ac098,_0xac469f,_0x4b9e7a,_0x1f3ea0){var _0x119b35,_0x416be8;_0x4b9e7a[_0x7ba7('0x1e')]=intUtil[_0x7ba7('0x42')](_0x4b9e7a[_0x7ba7('0x1e')]);_0x4b9e7a[_0x7ba7('0x43')]=intUtil[_0x7ba7('0x42')](_0x4b9e7a[_0x7ba7('0x43')]);if(_0x1f3ea0&&_0x1f3ea0['recordingFormat']&&_0x1f3ea0[_0x7ba7('0x52')]!==_0x7ba7('0x53')){logger[_0x7ba7('0xe')](_0x7ba7('0x54'),_0x7ba7('0x44'));_0x293f35[_0x7ba7('0x47')]=util[_0x7ba7('0x1d')](_0x7ba7('0x45'),_0x4b9e7a[_0x7ba7('0x43')],_0x293f35[_0x7ba7('0x46')],md5(_0x293f35[_0x7ba7('0x46')]));}headers['Authorization']=getAuth(_0x4b9e7a);return getUser(_0x4b9e7a,_0x1ac098[_0x7ba7('0x49')])[_0x7ba7('0x20')](function(_0x356007){_0x119b35=_0x356007;logger[_0x7ba7('0xe')](_0x7ba7('0x4a'),_0x119b35['id']);return getEndUser(_0x4b9e7a,_0x293f35['destcalleridname'],_0x293f35[_0x7ba7('0x55')]);})[_0x7ba7('0x20')](function(_0x299a40){_0x416be8=_0x299a40;logger[_0x7ba7('0xe')](_0x7ba7('0x4b'),_0x416be8['id']);return getTicket(_0x4b9e7a,_0x119b35,_0x416be8,_0x1c41af,_0x293f35);})[_0x7ba7('0x20')](function(_0x3beaf6){if(_0x3beaf6&&_0x3beaf6['id']){logger[_0x7ba7('0xe')](_0x7ba7('0x21'));logger[_0x7ba7('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3beaf6['id']);logger[_0x7ba7('0xe')](_0x7ba7('0x54'),_0x7ba7('0x4e'));emit(util[_0x7ba7('0x1d')](_0x7ba7('0x56'),_0x1ac098[_0x7ba7('0x18')]),_0x7ba7('0x4f'),{'uri':util[_0x7ba7('0x1d')](_0x7ba7('0x50'),_0x4b9e7a[_0x7ba7('0x1e')],_0x3beaf6['id'])});}})[_0x7ba7('0x57')](function(_0xbf83c3){logger['error'](_0x7ba7('0x54'),JSON[_0x7ba7('0x32')](_0xbf83c3));});};exports['unmanaged']=function(_0x39d889,_0x1712a6,_0x15c20d,_0x591112,_0x5cefdc,_0x3959ee){var _0x336f49,_0x190c99;_0x3959ee['remoteUri']=intUtil['stripTrailingSlash'](_0x3959ee['remoteUri']);_0x3959ee['serverUrl']=intUtil[_0x7ba7('0x42')](_0x3959ee[_0x7ba7('0x43')]);if(_0x5cefdc&&_0x5cefdc[_0x7ba7('0x58')]){logger[_0x7ba7('0xe')]('['+_0x1712a6[_0x7ba7('0x59')][_0x7ba7('0x5a')]()+']',_0x7ba7('0x44'));_0x1712a6[_0x7ba7('0x47')]=util[_0x7ba7('0x1d')](_0x7ba7('0x45'),_0x3959ee[_0x7ba7('0x43')],_0x1712a6[_0x7ba7('0x46')],md5(_0x1712a6['uniqueid']));}else{_0x1712a6['recordingURL']='';}headers['Authorization']=getAuth(_0x3959ee);return getUser(_0x3959ee,'')[_0x7ba7('0x20')](function(_0x2e340f){_0x336f49=_0x2e340f;logger[_0x7ba7('0xe')]('The\x20User\x20ID\x20is:',_0x336f49['id']);return getEndUser(_0x3959ee,_0x1712a6[_0x7ba7('0x11')],_0x1712a6[_0x7ba7('0x12')]);})[_0x7ba7('0x20')](function(_0xfda78b){_0x190c99=_0xfda78b;logger[_0x7ba7('0xe')](_0x7ba7('0x4b'),_0x190c99['id']);return getTicket(_0x3959ee,_0x336f49,_0x190c99,_0x15c20d,_0x1712a6);})[_0x7ba7('0x20')](function(_0x12f78b){if(_0x12f78b){logger[_0x7ba7('0xe')](_0x7ba7('0x21'));logger[_0x7ba7('0xe')](_0x7ba7('0x4c'),_0x12f78b['id']);}})[_0x7ba7('0x57')](function(_0x28a5ba){logger['error']('['+_0x1712a6[_0x7ba7('0x59')][_0x7ba7('0x5a')]()+']',JSON[_0x7ba7('0x32')](_0x28a5ba));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 369ff31..1d2769d 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 _0x58d3=['endUserId','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','util','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','adminId','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','find','contacts','work_number','mobile_number'];(function(_0x5a4bb2,_0x258eb5){var _0x2821ce=function(_0x36fb9b){while(--_0x36fb9b){_0x5a4bb2['push'](_0x5a4bb2['shift']());}};_0x2821ce(++_0x258eb5);}(_0x58d3,0xd4));var _0x358d=function(_0x3d26b5,_0x36d92f){_0x3d26b5=_0x3d26b5-0x0;var _0x2f501b=_0x58d3[_0x3d26b5];return _0x2f501b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x358d('0x0'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x358d('0x1'));var config=require(_0x358d('0x2'));var logger=require(_0x358d('0x3'))(_0x358d('0x4'));config[_0x358d('0x5')]=_[_0x358d('0x6')](config[_0x358d('0x5')],{'host':_0x358d('0x7'),'port':0x18eb});var io=require(_0x358d('0x8'))(new Redis(config[_0x358d('0x5')]));function getAdminId(_0x4e1f29,_0x20180a,_0x4dc0cf,_0x1a47a3){return new Promise(function(_0x464735,_0x151321){var _0x3bda14=![];var _0x9815de={'method':_0x358d('0x9'),'uri':_0x1a47a3+_0x358d('0xa'),'json':!![]};_0x9815de[_0x358d('0xb')]=_0x4dc0cf;logger[_0x358d('0xc')](_0x358d('0xd'));return rp(_0x9815de)[_0x358d('0xe')](function(_0x5b2104){if(_0x5b2104){var _0x5dd57a=_0x5b2104[_0x358d('0xf')];var _0x1cade7=null;for(_0x1cade7=0x0;_0x1cade7<_0x5dd57a[_0x358d('0x10')];_0x1cade7++){if(_0x5dd57a[_0x1cade7]['email']===_0x4e1f29['adminEmail']){_0x4e1f29['adminId']=_0x5dd57a[_0x1cade7]['id'];_0x3bda14=!![];}}if(_0x3bda14){logger[_0x358d('0xc')]('Admin\x20found:',_0x4e1f29['adminId']);_0x464735(_0x4e1f29);}else{_0x151321({'statusCode':0x194,'message':_0x358d('0x11')});}}else{_0x151321({'statusCode':0x194,'message':_0x358d('0x11')});}})[_0x358d('0x12')](function(_0xde2118){logger[_0x358d('0x13')]('['+[_0x20180a[_0x358d('0x14')]()]+']',_0xde2118[_0x358d('0x15')]);_0x151321(_0xde2118);});});}function getUser(_0x25a720,_0x51103a,_0x19b014){return function(_0x123732){return new Promise(function(_0x3ef03f,_0x3105dd){var _0x56f74b={'method':_0x358d('0x9'),'uri':_0x19b014+_0x358d('0xa'),'json':!![]};_0x56f74b[_0x358d('0xb')]=_0x51103a;logger['info'](_0x358d('0x16'));return rp(_0x56f74b)['then'](function(_0x5e6fcf){if(_0x5e6fcf){var _0x2ead0d=_0x5e6fcf[_0x358d('0xf')];var _0x35a6f8=![];var _0x360c2c=null;if(_0x123732['agentEmail']!==null){logger[_0x358d('0xc')](_0x358d('0x17'),_0x123732['agentEmail']);_0x123732[_0x358d('0x18')]=_0x123732[_0x358d('0x19')];for(_0x360c2c=0x0;_0x360c2c<_0x2ead0d['length'];_0x360c2c++){if(_0x2ead0d[_0x360c2c]['email']===_0x123732[_0x358d('0x19')]){_0x35a6f8=!![];_0x123732[_0x358d('0x1a')]=_0x2ead0d[_0x360c2c]['id'];logger[_0x358d('0xc')](_0x358d('0x1b'),_0x123732['userId']);}}}if(!_0x35a6f8){logger[_0x358d('0xc')]('Admin\x20selected');_0x123732[_0x358d('0x18')]=_0x123732['adminEmail'];_0x123732[_0x358d('0x1a')]=_0x123732[_0x358d('0x1c')];_0x35a6f8=!![];}if(_0x35a6f8){_0x3ef03f(_0x123732);}else{_0x3105dd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3105dd({'statusCode':0x194,'message':_0x358d('0x11')});}})[_0x358d('0x12')](function(_0x385955){logger[_0x358d('0x13')]('['+[_0x25a720['toUpperCase']()]+']',_0x385955[_0x358d('0x15')]);_0x3105dd(_0x385955);});});};}function getEndUser(_0x30494a,_0x120aff,_0x337019){return function(_0x5dca6e){return new Promise(function(_0x575711,_0x28606d){var _0x9f9e9b=0x0;var _0x68e158={'method':_0x358d('0x9'),'uri':_0x337019+_0x358d('0x1d'),'json':!![]};_0x68e158['headers']=_0x120aff;logger[_0x358d('0xc')](_0x358d('0x1e'));return rp(_0x68e158)[_0x358d('0xe')](function(_0x3fd3b3){_0x3fd3b3[_0x358d('0x1f')][_0x358d('0x20')](function(_0x448885){if(_0x448885[_0x358d('0x21')]===_0x358d('0x22')){_0x9f9e9b=_0x448885['id'];}});})[_0x358d('0xe')](function(){logger[_0x358d('0xc')](_0x358d('0x23'));var _0x76dd70={'method':_0x358d('0x9'),'uri':_0x337019+_0x358d('0x24')+_0x9f9e9b,'json':!![]};_0x76dd70['headers']=_0x120aff;return rp(_0x76dd70);})[_0x358d('0xe')](function(_0x5e67e5){logger[_0x358d('0xc')](_0x358d('0x25'),_0x5dca6e[_0x358d('0x26')]);if(_0x5e67e5['contacts'][_0x358d('0x10')]>0x0){var _0x383645=_[_0x358d('0x27')](_0x5e67e5[_0x358d('0x28')],function(_0xa50ed2){if(_0xa50ed2[_0x358d('0x29')]===_0x5dca6e[_0x358d('0x26')]||_0xa50ed2[_0x358d('0x2a')]===_0x5dca6e[_0x358d('0x26')]){return _0xa50ed2;}});if(_0x383645){_0x5dca6e[_0x358d('0x2b')]=_0x383645['id'];logger['info']('Contact\x20found:',_0x5dca6e[_0x358d('0x2b')]);_0x575711(_0x5dca6e);}else{return createEndUser(_0x5dca6e,_0x30494a,_0x120aff,_0x337019)[_0x358d('0xe')](function(_0xd3b6e2){logger[_0x358d('0xc')]('Contact\x20created:',_0x5dca6e[_0x358d('0x2b')]);_0x575711(_0xd3b6e2);});}}else{return createEndUser(_0x5dca6e,_0x30494a,_0x120aff,_0x337019)['then'](function(_0x58c826){logger[_0x358d('0xc')]('Contact\x20created:',_0x5dca6e[_0x358d('0x2b')]);_0x575711(_0x58c826);});}})[_0x358d('0x12')](function(_0x46d388){throw new Error(_0x46d388[_0x358d('0x15')]);});});};}function createEndUser(_0x40adb3,_0x5082e3,_0x2d9c3b,_0x4edf9e){return new Promise(function(_0x2c9994,_0xd8fdf4){var _0x122163=moment();var _0x429d00={'method':_0x358d('0x2c'),'uri':_0x4edf9e+_0x358d('0x2d'),'body':{'contact':{'last_name':_0x40adb3[_0x358d('0x26')],'work_number':_0x40adb3['contactNumber'],'mobile_number':_0x40adb3[_0x358d('0x26')],'owner_id':_0x40adb3[_0x358d('0x1a')],'created_at':_0x122163[_0x358d('0x2e')](_0x358d('0x2f'))}},'json':!![]};_0x429d00[_0x358d('0xb')]=_0x2d9c3b;logger[_0x358d('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x429d00)[_0x358d('0xe')](function(_0x38ac6c){_0x40adb3[_0x358d('0x2b')]=_0x38ac6c[_0x358d('0x30')]['id'];_0x2c9994(_0x40adb3);})[_0x358d('0x12')](function(_0x3dad01){logger[_0x358d('0x13')]('['+[_0x5082e3[_0x358d('0x14')]()]+']',_0x3dad01[_0x358d('0x15')]);_0xd8fdf4(_0x3dad01[_0x358d('0x15')]);});});}function getTicket(_0x1ff34d,_0x504b27,_0x161306,_0x32b2fd,_0x2ec1a3){return function(_0x150b72){logger[_0x358d('0xc')](_0x358d('0x31'));return new Promise(function(_0x35bc78,_0x3b9ad8){var _0x3477a4=moment();var _0x31a6fc={'method':_0x358d('0x2c'),'uri':_0x161306+'/api/tasks','body':{'title':intUtil[_0x358d('0x32')](_0x32b2fd[_0x358d('0x33')],_0x2ec1a3,'\x20'),'description':intUtil['getString'](_0x32b2fd[_0x358d('0x34')],_0x2ec1a3,'\x0a'),'owner_id':_0x150b72[_0x358d('0x1a')],'creater_id':_0x150b72['adminId'],'targetable_id':_0x150b72[_0x358d('0x2b')],'targetable_type':_0x358d('0x35'),'created_at':_0x3477a4[_0x358d('0x2e')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3477a4['add'](0x1e,'m')[_0x358d('0x2e')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x31a6fc['headers']=_0x504b27;return rp(_0x31a6fc)[_0x358d('0xe')](function(_0xbdeeb5){_0x150b72[_0x358d('0x36')]=_0xbdeeb5[_0x358d('0x37')]['id'];logger[_0x358d('0xc')](_0x358d('0x38'),_0x150b72[_0x358d('0x36')]);_0x35bc78(_0x150b72);})[_0x358d('0x12')](function(_0x2623a7){logger['error']('['+[_0x1ff34d[_0x358d('0x14')]()]+']',_0x2623a7['message']);_0x3b9ad8(_0x2623a7[_0x358d('0x15')]);});});};}function emit(_0x79cb83,_0x86d83,_0x181d50){var _0x54ef71={'uri':_0x79cb83+'/contacts/'+_0x181d50};io['to'](util[_0x358d('0x2e')](_0x358d('0x39'),_0x86d83))['emit'](_0x358d('0x3a'),_0x54ef71);}exports['cs']=function(_0x41c870,_0x5b43a0,_0x15e35d,_0x3aee43,_0x56f1b8,_0x2d47b8,_0xb37440,_0x31d9c5){var _0x286e12={};var _0x451a86={'Authorization':_0x358d('0x3b')+_0x2d47b8[_0x358d('0x3c')]};_0x2d47b8[_0x358d('0x3d')]=intUtil[_0x358d('0x3e')](_0x2d47b8[_0x358d('0x3d')]);_0x2d47b8[_0x358d('0x3f')]=intUtil['stripTrailingSlash'](_0x2d47b8[_0x358d('0x3f')]);var _0xb64eee=_0x2d47b8[_0x358d('0x3d')];_0x286e12[_0x358d('0x40')]=_0x2d47b8[_0x358d('0x41')];_0x286e12[_0x358d('0x26')]=_0x31d9c5[_0x358d('0x42')]()==='outbound'?_0x5b43a0[_0x358d('0x43')]:_0x5b43a0[_0x358d('0x44')];_0x286e12[_0x358d('0x45')]=_0x31d9c5===_0x358d('0x46')||_0x31d9c5===_0x358d('0x47')?_0x358d('0x46'):'outbound';if(_0x3aee43){_0x286e12[_0x358d('0x19')]=_0x3aee43[_0x358d('0x48')];}var _0x4bb321=util[_0x358d('0x2e')](_0x358d('0x49'),_0x2d47b8['serverUrl'],_0x5b43a0[_0x358d('0x4a')],md5(_0x5b43a0[_0x358d('0x4a')]));if(_0x56f1b8&&_0x56f1b8[_0x358d('0x4b')]){logger[_0x358d('0xc')](_0x358d('0x4c'),_0x358d('0x4d'));_0x5b43a0[_0x358d('0x4e')]=_0x4bb321;}else if(_0xb37440&&_0xb37440[_0x358d('0x4f')]&&_0xb37440[_0x358d('0x4f')]!==_0x358d('0x50')){logger[_0x358d('0xc')](_0x358d('0x51'),_0x358d('0x4d'));_0x5b43a0[_0x358d('0x4e')]=_0x4bb321;}else{_0x5b43a0[_0x358d('0x4e')]='';}return getAdminId(_0x286e12,_0x31d9c5,_0x451a86,_0xb64eee)[_0x358d('0xe')](getUser(_0x31d9c5,_0x451a86,_0xb64eee))['then'](getEndUser(_0x31d9c5,_0x451a86,_0xb64eee))[_0x358d('0xe')](getTicket(_0x31d9c5,_0x451a86,_0xb64eee,_0x15e35d,_0x5b43a0))[_0x358d('0xe')](function(_0x105c8f){logger[_0x358d('0xc')](util[_0x358d('0x2e')](_0x358d('0x52'),_0x105c8f[_0x358d('0x36')]));if(_0x31d9c5!=='unmanaged'){logger['info']('['+[_0x31d9c5[_0x358d('0x14')]()]+']',_0x358d('0x53'));emit(_0xb64eee,_0x3aee43[_0x358d('0x21')],_0x105c8f[_0x358d('0x2b')]);}})[_0x358d('0x12')](function(_0xb68f24){logger[_0x358d('0x13')]('['+[_0x31d9c5[_0x358d('0x14')]()]+_0x358d('0x54'),util['inspect'](_0xb68f24,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8ef6=['error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch'];(function(_0x5f4fc2,_0x16ac49){var _0x522a03=function(_0x7d781b){while(--_0x7d781b){_0x5f4fc2['push'](_0x5f4fc2['shift']());}};_0x522a03(++_0x16ac49);}(_0x8ef6,0x9b));var _0x68ef=function(_0x50bb4e,_0xaef60c){_0x50bb4e=_0x50bb4e-0x0;var _0x48f4a1=_0x8ef6[_0x50bb4e];return _0x48f4a1;};'use strict';var _=require(_0x68ef('0x0'));var rp=require('request-promise');var md5=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x68ef('0x3'));var intUtil=require(_0x68ef('0x4'));var config=require(_0x68ef('0x5'));var logger=require(_0x68ef('0x6'))(_0x68ef('0x7'));config[_0x68ef('0x8')]=_[_0x68ef('0x9')](config['redis'],{'host':_0x68ef('0xa'),'port':0x18eb});var io=require(_0x68ef('0xb'))(new Redis(config[_0x68ef('0x8')]));function getAdminId(_0x498edd,_0x2ce5b7,_0x347a0f,_0x2505ce){return new Promise(function(_0x46528f,_0x2d36e3){var _0x36530f=![];var _0x36036c={'method':_0x68ef('0xc'),'uri':_0x2505ce+_0x68ef('0xd'),'json':!![]};_0x36036c[_0x68ef('0xe')]=_0x347a0f;logger[_0x68ef('0xf')]('Getting\x20admin\x20information');return rp(_0x36036c)[_0x68ef('0x10')](function(_0x2b7d38){if(_0x2b7d38){var _0x36ec58=_0x2b7d38[_0x68ef('0x11')];var _0x212afc=null;for(_0x212afc=0x0;_0x212afc<_0x36ec58[_0x68ef('0x12')];_0x212afc++){if(_0x36ec58[_0x212afc][_0x68ef('0x13')]===_0x498edd[_0x68ef('0x14')]){_0x498edd[_0x68ef('0x15')]=_0x36ec58[_0x212afc]['id'];_0x36530f=!![];}}if(_0x36530f){logger[_0x68ef('0xf')](_0x68ef('0x16'),_0x498edd[_0x68ef('0x15')]);_0x46528f(_0x498edd);}else{_0x2d36e3({'statusCode':0x194,'message':_0x68ef('0x17')});}}else{_0x2d36e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x68ef('0x18')](function(_0x380a4d){logger[_0x68ef('0x19')]('['+[_0x2ce5b7[_0x68ef('0x1a')]()]+']',_0x380a4d[_0x68ef('0x1b')]);_0x2d36e3(_0x380a4d);});});}function getUser(_0x193ff5,_0x2ecd51,_0x47a69c){return function(_0x276777){return new Promise(function(_0x36db3c,_0x110a4f){var _0x3101e9={'method':_0x68ef('0xc'),'uri':_0x47a69c+'/api/selector/owners','json':!![]};_0x3101e9[_0x68ef('0xe')]=_0x2ecd51;logger[_0x68ef('0xf')]('Getting\x20user\x20list');return rp(_0x3101e9)[_0x68ef('0x10')](function(_0x627725){if(_0x627725){var _0x39e0e9=_0x627725[_0x68ef('0x11')];var _0x42c6af=![];var _0x3ea367=null;if(_0x276777[_0x68ef('0x1c')]!==null){logger[_0x68ef('0xf')](_0x68ef('0x1d'),_0x276777['agentEmail']);_0x276777[_0x68ef('0x1e')]=_0x276777[_0x68ef('0x1c')];for(_0x3ea367=0x0;_0x3ea367<_0x39e0e9[_0x68ef('0x12')];_0x3ea367++){if(_0x39e0e9[_0x3ea367]['email']===_0x276777[_0x68ef('0x1c')]){_0x42c6af=!![];_0x276777[_0x68ef('0x1f')]=_0x39e0e9[_0x3ea367]['id'];logger[_0x68ef('0xf')]('User\x20found:',_0x276777['userId']);}}}if(!_0x42c6af){logger[_0x68ef('0xf')](_0x68ef('0x20'));_0x276777[_0x68ef('0x1e')]=_0x276777['adminEmail'];_0x276777[_0x68ef('0x1f')]=_0x276777[_0x68ef('0x15')];_0x42c6af=!![];}if(_0x42c6af){_0x36db3c(_0x276777);}else{_0x110a4f({'statusCode':0x194,'message':_0x68ef('0x17')});}}else{_0x110a4f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x55f6bf){logger[_0x68ef('0x19')]('['+[_0x193ff5['toUpperCase']()]+']',_0x55f6bf[_0x68ef('0x1b')]);_0x110a4f(_0x55f6bf);});});};}function getEndUser(_0x24b641,_0x1bf2b0,_0x391d1c){return function(_0x799430){return new Promise(function(_0x509b92,_0x5bb3e4){var _0x3cd13f=0x0;var _0xcf94f7={'method':_0x68ef('0xc'),'uri':_0x391d1c+_0x68ef('0x21'),'json':!![]};_0xcf94f7[_0x68ef('0xe')]=_0x1bf2b0;logger[_0x68ef('0xf')](_0x68ef('0x22'));return rp(_0xcf94f7)[_0x68ef('0x10')](function(_0x1f503a){_0x1f503a['filters']['forEach'](function(_0x50ffa4){if(_0x50ffa4['name']===_0x68ef('0x23')){_0x3cd13f=_0x50ffa4['id'];}});})[_0x68ef('0x10')](function(){logger[_0x68ef('0xf')](_0x68ef('0x24'));var _0x23471a={'method':_0x68ef('0xc'),'uri':_0x391d1c+_0x68ef('0x25')+_0x3cd13f,'json':!![]};_0x23471a['headers']=_0x1bf2b0;return rp(_0x23471a);})[_0x68ef('0x10')](function(_0x4a608e){logger[_0x68ef('0xf')](_0x68ef('0x26'),_0x799430[_0x68ef('0x27')]);if(_0x4a608e[_0x68ef('0x28')][_0x68ef('0x12')]>0x0){var _0x39d20a=_[_0x68ef('0x29')](_0x4a608e[_0x68ef('0x28')],function(_0x13a7f8){if(_0x13a7f8['work_number']===_0x799430['contactNumber']||_0x13a7f8[_0x68ef('0x2a')]===_0x799430[_0x68ef('0x27')]){return _0x13a7f8;}});if(_0x39d20a){_0x799430['endUserId']=_0x39d20a['id'];logger[_0x68ef('0xf')](_0x68ef('0x2b'),_0x799430[_0x68ef('0x2c')]);_0x509b92(_0x799430);}else{return createEndUser(_0x799430,_0x24b641,_0x1bf2b0,_0x391d1c)['then'](function(_0x4d44eb){logger[_0x68ef('0xf')](_0x68ef('0x2d'),_0x799430[_0x68ef('0x2c')]);_0x509b92(_0x4d44eb);});}}else{return createEndUser(_0x799430,_0x24b641,_0x1bf2b0,_0x391d1c)[_0x68ef('0x10')](function(_0x5c5d91){logger[_0x68ef('0xf')]('Contact\x20created:',_0x799430['endUserId']);_0x509b92(_0x5c5d91);});}})['catch'](function(_0x28fdd7){throw new Error(_0x28fdd7[_0x68ef('0x1b')]);});});};}function createEndUser(_0x399b4c,_0x8eb2c3,_0x10a12d,_0x724aca){return new Promise(function(_0x4e05c4,_0x30593d){var _0x4e5932=moment();var _0x53cd91={'method':_0x68ef('0x2e'),'uri':_0x724aca+_0x68ef('0x2f'),'body':{'contact':{'last_name':_0x399b4c[_0x68ef('0x27')],'work_number':_0x399b4c[_0x68ef('0x27')],'mobile_number':_0x399b4c[_0x68ef('0x27')],'owner_id':_0x399b4c['userId'],'created_at':_0x4e5932[_0x68ef('0x30')](_0x68ef('0x31'))}},'json':!![]};_0x53cd91['headers']=_0x10a12d;logger[_0x68ef('0xf')](_0x68ef('0x32'));return rp(_0x53cd91)[_0x68ef('0x10')](function(_0x2dc431){_0x399b4c['endUserId']=_0x2dc431[_0x68ef('0x33')]['id'];_0x4e05c4(_0x399b4c);})['catch'](function(_0x5e91f6){logger[_0x68ef('0x19')]('['+[_0x8eb2c3[_0x68ef('0x1a')]()]+']',_0x5e91f6[_0x68ef('0x1b')]);_0x30593d(_0x5e91f6[_0x68ef('0x1b')]);});});}function getTicket(_0x1d4294,_0x497b41,_0x3840fe,_0x44dae2,_0x12fefa){return function(_0xfca434){logger[_0x68ef('0xf')](_0x68ef('0x34'));return new Promise(function(_0x361c25,_0x4a59dc){var _0xa7a640=moment();var _0x414888={'method':'POST','uri':_0x3840fe+_0x68ef('0x35'),'body':{'title':intUtil['getString'](_0x44dae2[_0x68ef('0x36')],_0x12fefa,'\x20'),'description':intUtil[_0x68ef('0x37')](_0x44dae2[_0x68ef('0x38')],_0x12fefa,'\x0a'),'owner_id':_0xfca434[_0x68ef('0x1f')],'creater_id':_0xfca434['adminId'],'targetable_id':_0xfca434['endUserId'],'targetable_type':_0x68ef('0x39'),'created_at':_0xa7a640[_0x68ef('0x30')](_0x68ef('0x31')),'due_date':_0xa7a640[_0x68ef('0x3a')](0x1e,'m')[_0x68ef('0x30')](_0x68ef('0x31'))},'json':!![]};_0x414888['headers']=_0x497b41;return rp(_0x414888)[_0x68ef('0x10')](function(_0x1f3059){_0xfca434[_0x68ef('0x3b')]=_0x1f3059[_0x68ef('0x3c')]['id'];logger[_0x68ef('0xf')](_0x68ef('0x3d'),_0xfca434[_0x68ef('0x3b')]);_0x361c25(_0xfca434);})[_0x68ef('0x18')](function(_0x228de5){logger['error']('['+[_0x1d4294[_0x68ef('0x1a')]()]+']',_0x228de5[_0x68ef('0x1b')]);_0x4a59dc(_0x228de5['message']);});});};}function emit(_0x2a329d,_0x4f0077,_0x2afaa3){var _0x22f1e3={'uri':_0x2a329d+_0x68ef('0x3e')+_0x2afaa3};io['to'](util['format'](_0x68ef('0x3f'),_0x4f0077))[_0x68ef('0x40')](_0x68ef('0x41'),_0x22f1e3);}exports['cs']=function(_0x1a6951,_0x340f08,_0x56d923,_0x388704,_0x206cb7,_0x15905a,_0x4e1159,_0x2376be){var _0x5f65b8={};var _0x421255={'Authorization':_0x68ef('0x42')+_0x15905a[_0x68ef('0x43')]};_0x15905a['remoteUri']=intUtil['stripTrailingSlash'](_0x15905a[_0x68ef('0x44')]);_0x15905a[_0x68ef('0x45')]=intUtil[_0x68ef('0x46')](_0x15905a['serverUrl']);var _0x1034fc=_0x15905a[_0x68ef('0x44')];_0x5f65b8[_0x68ef('0x14')]=_0x15905a[_0x68ef('0x47')];_0x5f65b8[_0x68ef('0x27')]=_0x2376be[_0x68ef('0x48')]()===_0x68ef('0x49')?_0x340f08[_0x68ef('0x4a')]:_0x340f08[_0x68ef('0x4b')];_0x5f65b8['callDirection']=_0x2376be===_0x68ef('0x4c')||_0x2376be===_0x68ef('0x4d')?_0x68ef('0x4c'):_0x68ef('0x49');if(_0x388704){_0x5f65b8[_0x68ef('0x1c')]=_0x388704['email'];}var _0x18622d=util['format'](_0x68ef('0x4e'),_0x15905a[_0x68ef('0x45')],_0x340f08['uniqueid'],md5(_0x340f08['uniqueid']));if(_0x206cb7&&_0x206cb7[_0x68ef('0x4f')]){logger['info'](_0x68ef('0x50'),_0x68ef('0x51'));_0x340f08[_0x68ef('0x52')]=_0x18622d;}else if(_0x4e1159&&_0x4e1159[_0x68ef('0x53')]&&_0x4e1159[_0x68ef('0x53')]!==_0x68ef('0x54')){logger[_0x68ef('0xf')](_0x68ef('0x55'),'Recording\x20is\x20enabled!');_0x340f08['recordingURL']=_0x18622d;}else{_0x340f08['recordingURL']='';}return getAdminId(_0x5f65b8,_0x2376be,_0x421255,_0x1034fc)[_0x68ef('0x10')](getUser(_0x2376be,_0x421255,_0x1034fc))[_0x68ef('0x10')](getEndUser(_0x2376be,_0x421255,_0x1034fc))['then'](getTicket(_0x2376be,_0x421255,_0x1034fc,_0x56d923,_0x340f08))[_0x68ef('0x10')](function(_0x50156f){logger[_0x68ef('0xf')](util[_0x68ef('0x30')](_0x68ef('0x56'),_0x50156f[_0x68ef('0x3b')]));if(_0x2376be!==_0x68ef('0x4d')){logger['info']('['+[_0x2376be[_0x68ef('0x1a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1034fc,_0x388704[_0x68ef('0x57')],_0x50156f['endUserId']);}})[_0x68ef('0x18')](function(_0x12a8c5){logger['error']('['+[_0x2376be[_0x68ef('0x1a')]()]+_0x68ef('0x58'),util[_0x68ef('0x59')](_0x12a8c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 83c501c..eaeb5c3 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 _0x9c00=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk'];(function(_0x4a158e,_0x2a22d1){var _0x30013e=function(_0x417a81){while(--_0x417a81){_0x4a158e['push'](_0x4a158e['shift']());}};_0x30013e(++_0x2a22d1);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4b432a,_0x578c42){_0x4b432a=_0x4b432a-0x0;var _0x505158=_0x9c00[_0x4b432a];return _0x505158;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x09c0('0x2'));var freshdesk=require(_0x09c0('0x3'));var zoho=require('./zoho');var desk=require(_0x09c0('0x4'));var vtiger=require(_0x09c0('0x5'));var servicenow=require(_0x09c0('0x6'));var dynamics365=require(_0x09c0('0x7'));var freshsales=require(_0x09c0('0x8'));var integrations=['zendesk','salesforce',_0x09c0('0x9'),_0x09c0('0xa'),_0x09c0('0xb'),_0x09c0('0xc'),_0x09c0('0xd'),'dynamics365',_0x09c0('0xe'),_0x09c0('0xf')];exports[_0x09c0('0x10')]=function(_0x1feb1d,_0x27a33c,_0x1e16f4,_0x1fec4f,_0x36f26d,_0x278f8b){if(_0x1e16f4){if(_[_0x09c0('0x11')](integrations,_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]())){try{var _0x2929f1=null;var _0x144271='';var _0x3b95cc=_0x1e16f4[_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]()];if(_0x3b95cc){var _0x2a86da=_0x3b95cc[_0x1feb1d[_0x09c0('0x14')]];if(_0x2a86da){var _0x3649d2=_[_0x09c0('0x15')](_0x2a86da[_0x09c0('0x16')],{'id':parseInt(_0x1feb1d[_0x09c0('0x17')],0xa)});if(_0x3649d2){if(_0x1fec4f){if(_0x36f26d&&_0x27a33c[_0x09c0('0x18')]){_0x144271=_0x09c0('0x18');}else if(_0x27a33c[_0x09c0('0x19')]){_0x144271='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x27a33c);}}else{_0x144271=_0x09c0('0x1a');}switch(_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]()){case _0x09c0('0x1b'):zendesk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'salesforce':salesforce[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0x9'):sugarcrm[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'freshdesk':freshdesk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'zoho':zoho[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0xc'):desk[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case'vtiger':vtiger[_0x144271](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b);break;case _0x09c0('0xe'):freshsales['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;case _0x09c0('0xf'):servicenow['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;case _0x09c0('0x1c'):dynamics365['cs'](_0x1feb1d,_0x27a33c,_0x3649d2,_0x1fec4f,_0x36f26d,_0x2a86da,_0x278f8b,_0x144271);break;default:console['log'](_0x09c0('0x1d'));}}else{_0x2929f1=require(_0x09c0('0x1e'))(_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')]());_0x2929f1[_0x09c0('0x1f')](_0x09c0('0x20'),util[_0x09c0('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1feb1d[_0x09c0('0x12')][_0x09c0('0x13')](),_0x1feb1d[_0x09c0('0x17')]));}}else{_0x2929f1=require(_0x09c0('0x1e'))(_0x1feb1d['data1']['toLowerCase']());_0x2929f1[_0x09c0('0x1f')](_0x09c0('0x20'),util[_0x09c0('0x21')](_0x09c0('0x22'),_0x1feb1d['data1'][_0x09c0('0x13')](),_0x1feb1d[_0x09c0('0x14')]));}}else{}}catch(_0x56d883){console[_0x09c0('0x1f')](_0x56d883);}}}}; \ No newline at end of file +var _0x0972=['./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','EVENT\x20UNKNOWN','servicenow','log','unknown\x20integration','[EXEC]','format','data3','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','util','./salesforce'];(function(_0x20dbbb,_0x712626){var _0x1004ef=function(_0xcf5ff2){while(--_0xcf5ff2){_0x20dbbb['push'](_0x20dbbb['shift']());}};_0x1004ef(++_0x712626);}(_0x0972,0x64));var _0x2097=function(_0xd20879,_0xbf32ae){_0xd20879=_0xd20879-0x0;var _0x12bcf7=_0x0972[_0xd20879];return _0x12bcf7;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x2097('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2097('0x2'));var zoho=require(_0x2097('0x3'));var desk=require('./desk');var vtiger=require(_0x2097('0x4'));var servicenow=require(_0x2097('0x5'));var dynamics365=require(_0x2097('0x6'));var freshsales=require(_0x2097('0x7'));var integrations=[_0x2097('0x8'),_0x2097('0x9'),_0x2097('0xa'),'freshdesk',_0x2097('0xb'),_0x2097('0xc'),_0x2097('0xd'),_0x2097('0xe'),_0x2097('0xf'),'servicenow'];exports[_0x2097('0x10')]=function(_0x3b8b76,_0x131f06,_0x430754,_0x7baeb3,_0x3b5847,_0x3d5519){if(_0x430754){if(_[_0x2097('0x11')](integrations,_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]())){try{var _0x2cc91c=null;var _0x3b2f94='';var _0x170005=_0x430754[_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]()];if(_0x170005){var _0x3e3fdc=_0x170005[_0x3b8b76[_0x2097('0x14')]];if(_0x3e3fdc){var _0x1c9ef9=_[_0x2097('0x15')](_0x3e3fdc[_0x2097('0x16')],{'id':parseInt(_0x3b8b76['data3'],0xa)});if(_0x1c9ef9){if(_0x7baeb3){if(_0x3b5847&&_0x131f06[_0x2097('0x17')]){_0x3b2f94=_0x2097('0x17');}else if(_0x131f06['routeId']){_0x3b2f94='outbound';}else{console['log'](_0x2097('0x18'),_0x131f06);}}else{_0x3b2f94='unmanaged';}switch(_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]()){case _0x2097('0x8'):zendesk[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0x9'):salesforce[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xa'):sugarcrm[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case'freshdesk':freshdesk[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xb'):zoho[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xc'):desk[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xd'):vtiger[_0x3b2f94](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519);break;case _0x2097('0xf'):freshsales['cs'](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519,_0x3b2f94);break;case _0x2097('0x19'):servicenow['cs'](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519,_0x3b2f94);break;case _0x2097('0xe'):dynamics365['cs'](_0x3b8b76,_0x131f06,_0x1c9ef9,_0x7baeb3,_0x3b5847,_0x3e3fdc,_0x3d5519,_0x3b2f94);break;default:console[_0x2097('0x1a')](_0x2097('0x1b'));}}else{_0x2cc91c=require('../../../../config/logger')(_0x3b8b76['data1'][_0x2097('0x13')]());_0x2cc91c['error'](_0x2097('0x1c'),util[_0x2097('0x1d')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3b8b76[_0x2097('0x12')]['toLowerCase'](),_0x3b8b76[_0x2097('0x1e')]));}}else{_0x2cc91c=require(_0x2097('0x1f'))(_0x3b8b76[_0x2097('0x12')][_0x2097('0x13')]());_0x2cc91c[_0x2097('0x20')](_0x2097('0x1c'),util['format'](_0x2097('0x21'),_0x3b8b76['data1'][_0x2097('0x13')](),_0x3b8b76[_0x2097('0x14')]));}}else{}}catch(_0x345875){console[_0x2097('0x20')](_0x345875);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 889f76d..6b51958 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 _0x95c9=['type','idField','variable','variableName','toString','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','format','uniqueid','email','calleridname','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','calleridnum','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','jsforce','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','assign','Descriptions','WhoId','Case','Subjects','getString','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','info','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length','Lead','contact','Contact','lead','Name','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach'];(function(_0x2631e1,_0x334a1b){var _0x1ec0f6=function(_0x22e63e){while(--_0x22e63e){_0x2631e1['push'](_0x2631e1['shift']());}};_0x1ec0f6(++_0x334a1b);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x995c('0x0'));var moment=require(_0x995c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x995c('0x2'));var util=require('util');var Redis=require(_0x995c('0x3'));var intUtil=require(_0x995c('0x4'));var config=require('../../../../config/environment');var logger=require(_0x995c('0x5'))(_0x995c('0x6'));config[_0x995c('0x7')]=_[_0x995c('0x8')](config[_0x995c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x995c('0x9'))(new Redis(config['redis']));function emit(_0x5d193a,_0x560251,_0x2ac7c9){io['to'](_0x5d193a)[_0x995c('0xa')](_0x560251,_0x2ac7c9);}function getTicket(_0x2e6227,_0x1e51d6,_0x4434e6,_0x51c610,_0x358f18,_0xe8b469,_0x2fe28a,_0x4022f2){var _0x3611fb={};if(_0x51c610[_0x995c('0xb')]==='Task'){_0x3611fb=Object[_0x995c('0xc')]({},{'OwnerId':_0x1e51d6['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x51c610['Subjects'],_0x358f18,'\x20'),'Description':intUtil['getString'](_0x51c610[_0x995c('0xd')],_0x358f18,'\x0a')},getCustomFields(_0xe8b469,_0x358f18));if(_0x4434e6){_0x3611fb[_0x995c('0xe')]=_0x4434e6['id'];}}else if(_0x51c610[_0x995c('0xb')]===_0x995c('0xf')){_0x3611fb=Object[_0x995c('0xc')]({},{'OwnerId':_0x1e51d6['id'],'Subject':intUtil['getString'](_0x51c610[_0x995c('0x10')],_0x358f18,'\x20'),'Description':intUtil[_0x995c('0x11')](_0x51c610[_0x995c('0xd')],_0x358f18,'\x0a')},getCustomFields(_0xe8b469,_0x358f18));if(_0x4434e6){_0x3611fb[_0x995c('0x12')]=_0x4434e6['id'];}}return _0x2fe28a[_0x995c('0x13')](_0x51c610[_0x995c('0xb')])[_0x995c('0x14')](_0x3611fb);}function getUser(_0x3a2e38,_0xd0399c,_0x17057e){if(!_[_0x995c('0x15')](_0xd0399c)&&intUtil[_0x995c('0x16')](_0xd0399c)){var _0xfe7cb3={'Email':_0xd0399c};var _0x261b8c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x17057e['sobject'](_0x995c('0x17'))[_0x995c('0x18')](_0xfe7cb3,_0x261b8c)[_0x995c('0x19')]()[_0x995c('0x1a')](function(_0x233c08){if(_0x233c08['length']){var _0x22058a=_[_0x995c('0x18')](_0x233c08,function(_0x3d3e16){return _0x3d3e16['Email']===_0xd0399c;});if(_0x22058a){logger[_0x995c('0x1b')](_0x995c('0x1c'),_0xd0399c);return BPromise[_0x995c('0x1d')]({'id':_0x22058a['Id'],'name':_0x22058a['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xd0399c);return _0x17057e[_0x995c('0x1e')]()[_0x995c('0x1a')](function(_0x1cb678){return BPromise['resolve']({'id':_0x1cb678[_0x995c('0x1f')],'name':_0x1cb678[_0x995c('0x20')]});});}});}else{logger[_0x995c('0x1b')](_0x995c('0x21'),_0xd0399c);return _0x17057e['identity']()[_0x995c('0x1a')](function(_0x2e35d0){return BPromise[_0x995c('0x1d')]({'id':_0x2e35d0[_0x995c('0x1f')],'name':_0x2e35d0[_0x995c('0x20')]});});}}function getEndUser(_0x18cf6a,_0x20aff6,_0x4ecb74,_0x9a9366,_0x517f38){var _0xbc860e={'Phone':_0x9a9366};var _0x38b196={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x995c('0x1d')]()[_0x995c('0x1a')](function(){if(_0x20aff6[_0x995c('0xb')]===_0x995c('0x22')){logger[_0x995c('0x1b')](_0x995c('0x23'),_0x9a9366,_0x20aff6[_0x995c('0x24')]);switch(_0x20aff6['moduleSearch']){case _0x995c('0x25'):return _0x517f38[_0x995c('0x13')]('Contact')[_0x995c('0x18')](_0xbc860e,_0x38b196)[_0x995c('0x19')]()[_0x995c('0x1a')](function(_0x4c55c8){if(_0x4c55c8&&_0x4c55c8[_0x995c('0x26')]){return _0x4c55c8;}else{return _0x517f38['sobject'](_0x995c('0x27'))['find'](_0xbc860e,_0x38b196);}});case _0x995c('0x28'):return _0x517f38[_0x995c('0x13')](_0x995c('0x29'))[_0x995c('0x18')](_0xbc860e,_0x38b196)[_0x995c('0x19')]();case _0x995c('0x2a'):return _0x517f38[_0x995c('0x13')](_0x995c('0x27'))['find'](_0xbc860e,_0x38b196);default:return null;}}else if(_0x20aff6['ticketType']===_0x995c('0xf')){logger[_0x995c('0x1b')](_0x995c('0x23'),_0x9a9366,'contact');return _0x517f38['sobject'](_0x995c('0x29'))[_0x995c('0x18')](_0xbc860e,_0x38b196)['execute']();}})[_0x995c('0x1a')](function(_0x19f20e){if(_0x19f20e&&_0x19f20e['length']){var _0xbbc712=_[_0x995c('0x18')](_0x19f20e,function(_0x5a1b7d){return _0x5a1b7d['Phone']===_0x9a9366;});if(_0xbbc712){return BPromise[_0x995c('0x1d')]({'id':_0xbbc712['Id'],'name':_0xbbc712[_0x995c('0x2b')],'phone':_0xbbc712[_0x995c('0x2c')]});}}})['then'](function(_0xed3e03){if(_0xed3e03){logger[_0x995c('0x1b')](_0x995c('0x2d'),_0x9a9366);return BPromise['resolve'](_0xed3e03);}else{logger[_0x995c('0x1b')](_0x995c('0x2e'),_0x9a9366);var _0x5f0c21={'LastName':_0x4ecb74!==''?_0x4ecb74:util['format']('Caller\x20-\x20%s',_0x9a9366),'Phone':_0x9a9366};if(_0x20aff6[_0x995c('0x2f')]){if(_0x20aff6[_0x995c('0x2f')]===_0x995c('0x28')){logger[_0x995c('0x1b')](_0x995c('0x30'),_0x9a9366,_0x20aff6[_0x995c('0x2f')]);}else if(_0x20aff6['moduleCreate']===_0x995c('0x2a')&&_0x20aff6[_0x995c('0xb')]===_0x995c('0x22')){logger['info'](_0x995c('0x30'),_0x9a9366,_0x20aff6[_0x995c('0x2f')]);_0x5f0c21[_0x995c('0x31')]=_0x995c('0x32');}else{return null;}}return _0x517f38[_0x995c('0x13')](_[_0x995c('0x33')](_0x20aff6[_0x995c('0x2f')]))[_0x995c('0x14')](_0x5f0c21);}});}function getCustomFields(_0x5e5321,_0x122c76){var _0x2036a7={};if(_0x5e5321[_0x995c('0x26')]>0x0){_[_0x995c('0x34')](_0x5e5321,function(_0x37eea1){if(_0x37eea1[_0x995c('0x35')]==='string'&&_0x37eea1[_0x995c('0x36')]){_0x2036a7[_0x37eea1[_0x995c('0x36')]]=_0x37eea1['content']['toString']();}else if(_0x37eea1['type']===_0x995c('0x37')&&_0x37eea1[_0x995c('0x38')]&&_0x37eea1[_0x995c('0x36')]){_0x122c76[_0x37eea1[_0x995c('0x38')]]&&(_0x2036a7[_0x37eea1['idField']]=_0x122c76[_0x37eea1[_0x995c('0x38')]][_0x995c('0x39')]());}else if(_0x37eea1['type']==='customVariable'&&_0x37eea1[_0x995c('0x3a')]&&_0x37eea1['Variable'][_0x995c('0x3b')]&&_0x37eea1[_0x995c('0x36')]){_0x122c76[_0x37eea1[_0x995c('0x3a')][_0x995c('0x3b')][_0x995c('0x3c')]()]&&(_0x2036a7[_0x37eea1[_0x995c('0x36')]]=_0x122c76[_0x37eea1[_0x995c('0x3a')][_0x995c('0x3b')][_0x995c('0x3c')]()][_0x995c('0x39')]());}});}return _0x2036a7;}function getConnection(_0xa27b22){var _0x23f92e=_0xa27b22[_0x995c('0x3d')]['concat'](_0xa27b22[_0x995c('0x3e')]);var _0x3caf98=new jsforce[(_0x995c('0x3f'))]({'oauth2':{'loginUrl':_0xa27b22[_0x995c('0x40')]||_0x995c('0x41'),'clientId':_0xa27b22[_0x995c('0x42')],'clientSecret':_0xa27b22[_0x995c('0x43')]}});return _0x3caf98['login'](_0xa27b22[_0x995c('0x44')],_0x23f92e)['then'](function(){logger[_0x995c('0x1b')](_0x995c('0x45'));return _0x3caf98;});}exports['queue']=function(_0x2b59a8,_0xd3f6e2,_0x2c3708,_0x4ced91,_0x5a8f15,_0x2fd8a7){var _0x888b4c,_0x7e5e2f,_0x48149c,_0x1de542;_0x2fd8a7[_0x995c('0x46')]=intUtil[_0x995c('0x47')](_0x2fd8a7[_0x995c('0x46')]);_0x2fd8a7[_0x995c('0x40')]=intUtil[_0x995c('0x47')](_0x2fd8a7[_0x995c('0x40')]);if(_0x5a8f15&&_0x5a8f15[_0x995c('0x48')]){logger[_0x995c('0x1b')](_0x995c('0x49'),'Recording\x20is\x20enabled!');_0xd3f6e2[_0x995c('0x4a')]=util[_0x995c('0x4b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2fd8a7[_0x995c('0x46')],_0xd3f6e2[_0x995c('0x4c')],md5(_0xd3f6e2[_0x995c('0x4c')]));}else{_0xd3f6e2['recordingURL']='';}return getConnection(_0x2fd8a7)['then'](function(_0x6c50e0){_0x1de542=_0x6c50e0;return getUser(_0x2fd8a7,_0x4ced91[_0x995c('0x4d')],_0x1de542);})['then'](function(_0x34e5a4){_0x888b4c=_0x34e5a4;return getEndUser(_0x2fd8a7,_0x2c3708,_0xd3f6e2[_0x995c('0x4e')],_0xd3f6e2['calleridnum'],_0x1de542);})[_0x995c('0x1a')](function(_0x313160){_0x7e5e2f=_0x313160;return getTicket(_0x2fd8a7,_0x888b4c,_0x7e5e2f,_0x2c3708,_0xd3f6e2,_0x2c3708['Fields'],_0x1de542,_0x995c('0x4f'));})[_0x995c('0x1a')](function(_0x161249){_0x48149c=_0x161249;logger[_0x995c('0x1b')](_0x995c('0x50'),_0x48149c['id']);logger[_0x995c('0x1b')](_0x995c('0x51'),_0x48149c['id'],_0x4ced91[_0x995c('0x3b')],_0x2fd8a7[_0x995c('0x35')]);switch(_0x2fd8a7[_0x995c('0x35')]){case _0x995c('0x52'):emit(util[_0x995c('0x4b')](_0x995c('0x53'),_0x4ced91['name']),_0x995c('0x54'),{'recordId':_0x48149c['id']});break;case'newTab':emit(util[_0x995c('0x4b')](_0x995c('0x53'),_0x4ced91['name']),'trigger:browser:url',{'uri':util[_0x995c('0x4b')](_0x995c('0x55'),_0x1de542[_0x995c('0x56')],_0x48149c['id'])});break;default:logger['error'](_0x995c('0x57'));}})[_0x995c('0x58')](function(_0x124e9b){logger[_0x995c('0x59')](_0x995c('0x49'),JSON['stringify'](_0x124e9b));});};exports[_0x995c('0x5a')]=function(_0x2f2fa1,_0x5657e2,_0x13be80,_0x36907a,_0x54bfe4,_0x2e25a5,_0x428091){var _0x3cf077,_0x291a4b,_0x7acf8d,_0x379a45;_0x2e25a5[_0x995c('0x46')]=intUtil['stripTrailingSlash'](_0x2e25a5[_0x995c('0x46')]);_0x2e25a5[_0x995c('0x40')]=intUtil[_0x995c('0x47')](_0x2e25a5['remoteUri']);if(_0x428091&&_0x428091['recordingFormat']&&_0x428091[_0x995c('0x5b')]!==_0x995c('0x5c')){logger[_0x995c('0x1b')](_0x995c('0x5d'),_0x995c('0x5e'));_0x5657e2['recordingURL']=util[_0x995c('0x4b')](_0x995c('0x5f'),_0x2e25a5[_0x995c('0x46')],_0x5657e2[_0x995c('0x4c')],md5(_0x5657e2[_0x995c('0x4c')]));}return getConnection(_0x2e25a5)['then'](function(_0x238ac7){_0x379a45=_0x238ac7;return getUser(_0x2e25a5,_0x36907a['email'],_0x379a45);})[_0x995c('0x1a')](function(_0x172d56){_0x3cf077=_0x172d56;return getEndUser(_0x2e25a5,_0x13be80,_0x5657e2[_0x995c('0x60')],_0x5657e2[_0x995c('0x61')],_0x379a45);})[_0x995c('0x1a')](function(_0x2bdbba){_0x291a4b=_0x2bdbba;return getTicket(_0x2e25a5,_0x3cf077,_0x291a4b,_0x13be80,_0x5657e2,_0x13be80[_0x995c('0x62')],_0x379a45,_0x995c('0x5a'));})[_0x995c('0x1a')](function(_0x3a0a74){_0x7acf8d=_0x3a0a74;logger['info'](_0x995c('0x63'),_0x7acf8d['id']);logger[_0x995c('0x1b')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x7acf8d['id'],_0x36907a['name'],_0x2e25a5[_0x995c('0x35')]);switch(_0x2e25a5[_0x995c('0x35')]){case _0x995c('0x52'):emit(util[_0x995c('0x4b')]('user:%s',_0x36907a['name']),_0x995c('0x54'),{'recordId':_0x7acf8d['id']});break;case _0x995c('0x64'):emit(util[_0x995c('0x4b')](_0x995c('0x53'),_0x36907a['name']),_0x995c('0x65'),{'uri':util['format'](_0x995c('0x55'),_0x379a45[_0x995c('0x56')],_0x7acf8d['id'])});break;default:logger[_0x995c('0x59')]('[OUTBOUND]',_0x995c('0x66'));}})[_0x995c('0x58')](function(_0x2ffda0){logger['error'](_0x995c('0x5d'),JSON['stringify'](_0x2ffda0));});};exports['unmanaged']=function(_0xa0a76c,_0x2bafd5,_0x3c5c7d,_0x4d0331,_0x2f4c7c,_0xa6228f){var _0x1b6ca0,_0x1d015f,_0x58edb8,_0x39790d;_0xa6228f['serverUrl']=intUtil[_0x995c('0x47')](_0xa6228f[_0x995c('0x46')]);_0xa6228f['remoteUri']=intUtil['stripTrailingSlash'](_0xa6228f[_0x995c('0x40')]);if(_0x2f4c7c&&_0x2f4c7c[_0x995c('0x48')]){logger[_0x995c('0x1b')]('['+_0x2bafd5['lastevent']['toUpperCase']()+']',_0x995c('0x5e'));_0x2bafd5[_0x995c('0x4a')]=util[_0x995c('0x4b')](_0x995c('0x5f'),_0xa6228f[_0x995c('0x46')],_0x2bafd5['uniqueid'],md5(_0x2bafd5[_0x995c('0x4c')]));}else{_0x2bafd5[_0x995c('0x4a')]='';}return getConnection(_0xa6228f)[_0x995c('0x1a')](function(_0x3da746){_0x39790d=_0x3da746;if(!_[_0x995c('0x15')](_0x4d0331)){return getUser(_0xa6228f,_0x4d0331[_0x995c('0x3b')],_0x39790d);}else{return getUser(_0xa6228f,null,_0x39790d);}})[_0x995c('0x1a')](function(_0x26d89d){_0x1b6ca0=_0x26d89d;return getEndUser(_0xa6228f,_0x3c5c7d,_0x2bafd5[_0x995c('0x4e')],_0x2bafd5[_0x995c('0x67')],_0x39790d);})[_0x995c('0x1a')](function(_0x49afce){_0x1d015f=_0x49afce;return getTicket(_0xa6228f,_0x1b6ca0,_0x1d015f,_0x3c5c7d,_0x2bafd5,_0x3c5c7d[_0x995c('0x62')],_0x39790d);})[_0x995c('0x1a')](function(_0x13ccf9){_0x58edb8=_0x13ccf9;logger[_0x995c('0x1b')]('['+_0x2bafd5[_0x995c('0x68')][_0x995c('0x69')]()+_0x995c('0x6a'),_0x58edb8['id']);logger[_0x995c('0x1b')]('['+_0x2bafd5[_0x995c('0x68')][_0x995c('0x69')]()+_0x995c('0x6b'),_0xa6228f[_0x995c('0x35')]);})[_0x995c('0x58')](function(_0x266f13){logger[_0x995c('0x59')]('['+_0x2bafd5[_0x995c('0x68')]['toUpperCase']()+']',JSON['stringify'](_0x266f13));});}; \ No newline at end of file +var _0xdd85=['uniqueid','email','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','recordingURL','isNil','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.','stringify','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','User','find','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','concat','Connection','https://login.salesforce.com','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdd85,0x1d1));var _0x5dd8=function(_0x2ba899,_0x115ba1){_0x2ba899=_0x2ba899-0x0;var _0x4ba68a=_0xdd85[_0x2ba899];return _0x4ba68a;};'use strict';var _=require(_0x5dd8('0x0'));var rp=require(_0x5dd8('0x1'));var moment=require(_0x5dd8('0x2'));var BPromise=require(_0x5dd8('0x3'));var md5=require(_0x5dd8('0x4'));var jsforce=require(_0x5dd8('0x5'));var util=require(_0x5dd8('0x6'));var Redis=require(_0x5dd8('0x7'));var intUtil=require('./util');var config=require(_0x5dd8('0x8'));var logger=require(_0x5dd8('0x9'))('salesforce');config['redis']=_['defaults'](config[_0x5dd8('0xa')],{'host':_0x5dd8('0xb'),'port':0x18eb});var io=require(_0x5dd8('0xc'))(new Redis(config[_0x5dd8('0xa')]));function emit(_0x47d2fd,_0x4e4753,_0x370a8e){io['to'](_0x47d2fd)[_0x5dd8('0xd')](_0x4e4753,_0x370a8e);}function getTicket(_0xf063ba,_0xd198bf,_0x322f92,_0x2f6f0c,_0xa2eceb,_0x24855c,_0x56f7a4,_0x473a9a){var _0x49e991={};if(_0x2f6f0c[_0x5dd8('0xe')]===_0x5dd8('0xf')){_0x49e991=Object[_0x5dd8('0x10')]({},{'OwnerId':_0xd198bf['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x5dd8('0x11')](_0x2f6f0c[_0x5dd8('0x12')],_0xa2eceb,'\x20'),'Description':intUtil[_0x5dd8('0x11')](_0x2f6f0c[_0x5dd8('0x13')],_0xa2eceb,'\x0a')},getCustomFields(_0x24855c,_0xa2eceb));if(_0x322f92){_0x49e991[_0x5dd8('0x14')]=_0x322f92['id'];}}else if(_0x2f6f0c[_0x5dd8('0xe')]===_0x5dd8('0x15')){_0x49e991=Object['assign']({},{'OwnerId':_0xd198bf['id'],'Subject':intUtil[_0x5dd8('0x11')](_0x2f6f0c[_0x5dd8('0x12')],_0xa2eceb,'\x20'),'Description':intUtil['getString'](_0x2f6f0c[_0x5dd8('0x13')],_0xa2eceb,'\x0a')},getCustomFields(_0x24855c,_0xa2eceb));if(_0x322f92){_0x49e991[_0x5dd8('0x16')]=_0x322f92['id'];}}return _0x56f7a4[_0x5dd8('0x17')](_0x2f6f0c[_0x5dd8('0xe')])[_0x5dd8('0x18')](_0x49e991);}function getUser(_0x3ea47d,_0x239242,_0x1ca641){if(!_['isNil'](_0x239242)&&intUtil['validateEmail'](_0x239242)){var _0xab1c1={'Email':_0x239242};var _0xf08998={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1ca641[_0x5dd8('0x17')](_0x5dd8('0x19'))[_0x5dd8('0x1a')](_0xab1c1,_0xf08998)['execute']()['then'](function(_0x4a5eba){if(_0x4a5eba[_0x5dd8('0x1b')]){var _0x6f1dbb=_['find'](_0x4a5eba,function(_0x19bcd4){return _0x19bcd4[_0x5dd8('0x1c')]===_0x239242;});if(_0x6f1dbb){logger[_0x5dd8('0x1d')](_0x5dd8('0x1e'),_0x239242);return BPromise[_0x5dd8('0x1f')]({'id':_0x6f1dbb['Id'],'name':_0x6f1dbb[_0x5dd8('0x20')]});}}else{logger[_0x5dd8('0x1d')](_0x5dd8('0x21'),_0x239242);return _0x1ca641[_0x5dd8('0x22')]()['then'](function(_0x1ede9f){return BPromise[_0x5dd8('0x1f')]({'id':_0x1ede9f[_0x5dd8('0x23')],'name':_0x1ede9f[_0x5dd8('0x24')]});});}});}else{logger[_0x5dd8('0x1d')](_0x5dd8('0x21'),_0x239242);return _0x1ca641[_0x5dd8('0x22')]()[_0x5dd8('0x25')](function(_0x326f28){return BPromise[_0x5dd8('0x1f')]({'id':_0x326f28[_0x5dd8('0x23')],'name':_0x326f28['display_name']});});}}function getEndUser(_0x8731a9,_0x28d92e,_0x17bb61,_0x2c2e92,_0x4f5efe){var _0x3ed230={'Phone':_0x2c2e92};var _0x24a98a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5dd8('0x1f')]()[_0x5dd8('0x25')](function(){if(_0x28d92e[_0x5dd8('0xe')]===_0x5dd8('0xf')){logger['info'](_0x5dd8('0x26'),_0x2c2e92,_0x28d92e[_0x5dd8('0x27')]);switch(_0x28d92e[_0x5dd8('0x27')]){case _0x5dd8('0x28'):return _0x4f5efe[_0x5dd8('0x17')](_0x5dd8('0x29'))[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a)[_0x5dd8('0x2a')]()[_0x5dd8('0x25')](function(_0x4c854f){if(_0x4c854f&&_0x4c854f[_0x5dd8('0x1b')]){return _0x4c854f;}else{return _0x4f5efe[_0x5dd8('0x17')](_0x5dd8('0x2b'))[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a);}});case'contact':return _0x4f5efe['sobject']('Contact')['find'](_0x3ed230,_0x24a98a)[_0x5dd8('0x2a')]();case _0x5dd8('0x2c'):return _0x4f5efe[_0x5dd8('0x17')]('Lead')[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a);default:return null;}}else if(_0x28d92e['ticketType']===_0x5dd8('0x15')){logger[_0x5dd8('0x1d')](_0x5dd8('0x26'),_0x2c2e92,_0x5dd8('0x2d'));return _0x4f5efe['sobject'](_0x5dd8('0x29'))[_0x5dd8('0x1a')](_0x3ed230,_0x24a98a)[_0x5dd8('0x2a')]();}})[_0x5dd8('0x25')](function(_0xcb220d){if(_0xcb220d&&_0xcb220d[_0x5dd8('0x1b')]){var _0x2a0ef0=_[_0x5dd8('0x1a')](_0xcb220d,function(_0x31b032){return _0x31b032[_0x5dd8('0x2e')]===_0x2c2e92;});if(_0x2a0ef0){return BPromise[_0x5dd8('0x1f')]({'id':_0x2a0ef0['Id'],'name':_0x2a0ef0[_0x5dd8('0x20')],'phone':_0x2a0ef0[_0x5dd8('0x2e')]});}}})['then'](function(_0x12cb70){if(_0x12cb70){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x2c2e92);return BPromise['resolve'](_0x12cb70);}else{logger[_0x5dd8('0x1d')](_0x5dd8('0x2f'),_0x2c2e92);var _0x3d5fdb={'LastName':_0x17bb61!==_0x5dd8('0x30')?_0x17bb61:util[_0x5dd8('0x31')]('Caller\x20-\x20%s',_0x2c2e92),'Phone':_0x2c2e92};if(_0x28d92e[_0x5dd8('0x32')]){if(_0x28d92e[_0x5dd8('0x32')]===_0x5dd8('0x2d')){logger[_0x5dd8('0x1d')](_0x5dd8('0x33'),_0x2c2e92,_0x28d92e['moduleCreate']);}else if(_0x28d92e[_0x5dd8('0x32')]===_0x5dd8('0x2c')&&_0x28d92e[_0x5dd8('0xe')]==='Task'){logger[_0x5dd8('0x1d')](_0x5dd8('0x33'),_0x2c2e92,_0x28d92e[_0x5dd8('0x32')]);_0x3d5fdb[_0x5dd8('0x34')]=_0x5dd8('0x35');}else{return null;}}return _0x4f5efe[_0x5dd8('0x17')](_[_0x5dd8('0x36')](_0x28d92e['moduleCreate']))['create'](_0x3d5fdb);}});}function getCustomFields(_0x2611a5,_0x71d236){var _0x3341e3={};if(_0x2611a5['length']>0x0){_[_0x5dd8('0x37')](_0x2611a5,function(_0x302a2c){if(_0x302a2c[_0x5dd8('0x38')]===_0x5dd8('0x39')&&_0x302a2c[_0x5dd8('0x3a')]){_0x3341e3[_0x302a2c[_0x5dd8('0x3a')]]=_0x302a2c[_0x5dd8('0x3b')]['toString']();}else if(_0x302a2c[_0x5dd8('0x38')]===_0x5dd8('0x3c')&&_0x302a2c[_0x5dd8('0x3d')]&&_0x302a2c[_0x5dd8('0x3a')]){_0x71d236[_0x302a2c[_0x5dd8('0x3d')]]&&(_0x3341e3[_0x302a2c['idField']]=_0x71d236[_0x302a2c[_0x5dd8('0x3d')]][_0x5dd8('0x3e')]());}else if(_0x302a2c[_0x5dd8('0x38')]===_0x5dd8('0x3f')&&_0x302a2c[_0x5dd8('0x40')]&&_0x302a2c[_0x5dd8('0x40')]['name']&&_0x302a2c[_0x5dd8('0x3a')]){_0x71d236[_0x302a2c[_0x5dd8('0x40')][_0x5dd8('0x41')][_0x5dd8('0x42')]()]&&(_0x3341e3[_0x302a2c[_0x5dd8('0x3a')]]=_0x71d236[_0x302a2c[_0x5dd8('0x40')][_0x5dd8('0x41')][_0x5dd8('0x42')]()][_0x5dd8('0x3e')]());}});}return _0x3341e3;}function getConnection(_0x1ebabf){var _0x4eee9c=_0x1ebabf['password'][_0x5dd8('0x43')](_0x1ebabf['securityToken']);var _0x33604c=new jsforce[(_0x5dd8('0x44'))]({'oauth2':{'loginUrl':_0x1ebabf['remoteUri']||_0x5dd8('0x45'),'clientId':_0x1ebabf['clientId'],'clientSecret':_0x1ebabf[_0x5dd8('0x46')]}});return _0x33604c['login'](_0x1ebabf[_0x5dd8('0x47')],_0x4eee9c)['then'](function(){logger['info'](_0x5dd8('0x48'));return _0x33604c;});}exports['queue']=function(_0x3a9766,_0x4687ae,_0x1e62bd,_0x2be1a9,_0x29c2a2,_0x2b38e4){var _0x10f59e,_0x29bc3f,_0x14b53a,_0xe293d4;_0x2b38e4[_0x5dd8('0x49')]=intUtil[_0x5dd8('0x4a')](_0x2b38e4[_0x5dd8('0x49')]);_0x2b38e4[_0x5dd8('0x4b')]=intUtil[_0x5dd8('0x4a')](_0x2b38e4[_0x5dd8('0x4b')]);if(_0x29c2a2&&_0x29c2a2[_0x5dd8('0x4c')]){logger[_0x5dd8('0x1d')](_0x5dd8('0x4d'),_0x5dd8('0x4e'));_0x4687ae['recordingURL']=util[_0x5dd8('0x31')](_0x5dd8('0x4f'),_0x2b38e4[_0x5dd8('0x49')],_0x4687ae[_0x5dd8('0x50')],md5(_0x4687ae[_0x5dd8('0x50')]));}else{_0x4687ae['recordingURL']='';}return getConnection(_0x2b38e4)['then'](function(_0x1b22f8){_0xe293d4=_0x1b22f8;return getUser(_0x2b38e4,_0x2be1a9[_0x5dd8('0x51')],_0xe293d4);})[_0x5dd8('0x25')](function(_0x149b14){_0x10f59e=_0x149b14;return getEndUser(_0x2b38e4,_0x1e62bd,_0x4687ae['calleridname'],_0x4687ae['calleridnum'],_0xe293d4);})['then'](function(_0x288e8c){_0x29bc3f=_0x288e8c;return getTicket(_0x2b38e4,_0x10f59e,_0x29bc3f,_0x1e62bd,_0x4687ae,_0x1e62bd['Fields'],_0xe293d4,_0x5dd8('0x52'));})[_0x5dd8('0x25')](function(_0x460231){_0x14b53a=_0x460231;logger['info'](_0x5dd8('0x53'),_0x14b53a['id']);logger[_0x5dd8('0x1d')](_0x5dd8('0x54'),_0x14b53a['id'],_0x2be1a9[_0x5dd8('0x41')],_0x2b38e4['type']);switch(_0x2b38e4[_0x5dd8('0x38')]){case _0x5dd8('0x55'):emit(util[_0x5dd8('0x31')](_0x5dd8('0x56'),_0x2be1a9[_0x5dd8('0x41')]),_0x5dd8('0x57'),{'recordId':_0x14b53a['id']});break;case _0x5dd8('0x58'):emit(util[_0x5dd8('0x31')](_0x5dd8('0x56'),_0x2be1a9[_0x5dd8('0x41')]),'trigger:browser:url',{'uri':util[_0x5dd8('0x31')](_0x5dd8('0x59'),_0xe293d4[_0x5dd8('0x5a')],_0x14b53a['id'])});break;default:logger[_0x5dd8('0x5b')](_0x5dd8('0x5c'));}})[_0x5dd8('0x5d')](function(_0x3d042b){logger[_0x5dd8('0x5b')]('[QUEUE]',JSON['stringify'](_0x3d042b));});};exports['outbound']=function(_0x19d91d,_0x255831,_0x536f95,_0x45f62b,_0x7d3c05,_0x37fd03,_0x5ed20e){var _0x270ccb,_0xe89bcd,_0x9ae6b3,_0x11ba49;_0x37fd03[_0x5dd8('0x49')]=intUtil[_0x5dd8('0x4a')](_0x37fd03[_0x5dd8('0x49')]);_0x37fd03[_0x5dd8('0x4b')]=intUtil[_0x5dd8('0x4a')](_0x37fd03[_0x5dd8('0x4b')]);if(_0x5ed20e&&_0x5ed20e['recordingFormat']&&_0x5ed20e['recordingFormat']!=='none'){logger[_0x5dd8('0x1d')]('[OUTBOUND]',_0x5dd8('0x4e'));_0x255831['recordingURL']=util[_0x5dd8('0x31')](_0x5dd8('0x4f'),_0x37fd03['serverUrl'],_0x255831[_0x5dd8('0x50')],md5(_0x255831[_0x5dd8('0x50')]));}return getConnection(_0x37fd03)[_0x5dd8('0x25')](function(_0xb716e9){_0x11ba49=_0xb716e9;return getUser(_0x37fd03,_0x45f62b[_0x5dd8('0x51')],_0x11ba49);})[_0x5dd8('0x25')](function(_0x197ebf){_0x270ccb=_0x197ebf;return getEndUser(_0x37fd03,_0x536f95,_0x255831[_0x5dd8('0x5e')],_0x255831[_0x5dd8('0x5f')],_0x11ba49);})['then'](function(_0x35cbfa){_0xe89bcd=_0x35cbfa;return getTicket(_0x37fd03,_0x270ccb,_0xe89bcd,_0x536f95,_0x255831,_0x536f95['Fields'],_0x11ba49,_0x5dd8('0x60'));})[_0x5dd8('0x25')](function(_0x5b4dfc){_0x9ae6b3=_0x5b4dfc;logger[_0x5dd8('0x1d')](_0x5dd8('0x61'),_0x9ae6b3['id']);logger[_0x5dd8('0x1d')](_0x5dd8('0x62'),_0x9ae6b3['id'],_0x45f62b[_0x5dd8('0x41')],_0x37fd03[_0x5dd8('0x38')]);switch(_0x37fd03['type']){case _0x5dd8('0x55'):emit(util['format']('user:%s',_0x45f62b[_0x5dd8('0x41')]),'trigger:salesforce:display',{'recordId':_0x9ae6b3['id']});break;case _0x5dd8('0x58'):emit(util[_0x5dd8('0x31')](_0x5dd8('0x56'),_0x45f62b[_0x5dd8('0x41')]),'trigger:browser:url',{'uri':util[_0x5dd8('0x31')](_0x5dd8('0x59'),_0x11ba49[_0x5dd8('0x5a')],_0x9ae6b3['id'])});break;default:logger['error'](_0x5dd8('0x63'),_0x5dd8('0x64'));}})[_0x5dd8('0x5d')](function(_0x2074c8){logger[_0x5dd8('0x5b')](_0x5dd8('0x63'),JSON['stringify'](_0x2074c8));});};exports['unmanaged']=function(_0x1ec47c,_0x3fb3cc,_0xdbcac4,_0x1f4a35,_0x475619,_0x44ef1d){var _0x423fdf,_0xf77b9c,_0x4237fd,_0x5e07d9;_0x44ef1d[_0x5dd8('0x49')]=intUtil[_0x5dd8('0x4a')](_0x44ef1d[_0x5dd8('0x49')]);_0x44ef1d['remoteUri']=intUtil[_0x5dd8('0x4a')](_0x44ef1d['remoteUri']);if(_0x475619&&_0x475619['monitor_format']){logger[_0x5dd8('0x1d')]('['+_0x3fb3cc[_0x5dd8('0x65')][_0x5dd8('0x66')]()+']',_0x5dd8('0x4e'));_0x3fb3cc['recordingURL']=util['format'](_0x5dd8('0x4f'),_0x44ef1d[_0x5dd8('0x49')],_0x3fb3cc['uniqueid'],md5(_0x3fb3cc[_0x5dd8('0x50')]));}else{_0x3fb3cc[_0x5dd8('0x67')]='';}return getConnection(_0x44ef1d)[_0x5dd8('0x25')](function(_0x29b65a){_0x5e07d9=_0x29b65a;if(!_[_0x5dd8('0x68')](_0x1f4a35)){return getUser(_0x44ef1d,_0x1f4a35[_0x5dd8('0x41')],_0x5e07d9);}else{return getUser(_0x44ef1d,null,_0x5e07d9);}})[_0x5dd8('0x25')](function(_0xf905cf){_0x423fdf=_0xf905cf;return getEndUser(_0x44ef1d,_0xdbcac4,_0x3fb3cc[_0x5dd8('0x69')],_0x3fb3cc[_0x5dd8('0x6a')],_0x5e07d9);})[_0x5dd8('0x25')](function(_0x113669){_0xf77b9c=_0x113669;return getTicket(_0x44ef1d,_0x423fdf,_0xf77b9c,_0xdbcac4,_0x3fb3cc,_0xdbcac4['Fields'],_0x5e07d9);})[_0x5dd8('0x25')](function(_0x3c1a8e){_0x4237fd=_0x3c1a8e;logger['info']('['+_0x3fb3cc[_0x5dd8('0x65')][_0x5dd8('0x66')]()+_0x5dd8('0x6b'),_0x4237fd['id']);logger[_0x5dd8('0x1d')]('['+_0x3fb3cc[_0x5dd8('0x65')][_0x5dd8('0x66')]()+']\x20Integration\x20account\x20type\x20%s.',_0x44ef1d[_0x5dd8('0x38')]);})[_0x5dd8('0x5d')](function(_0x5377d8){logger[_0x5dd8('0x5b')]('['+_0x3fb3cc[_0x5dd8('0x65')]['toUpperCase']()+']',JSON[_0x5dd8('0x6c')](_0x5377d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index cbe3018..fcf2399 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 _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x99bd7d,_0x5509c7){var _0x5490e9=function(_0x252809){while(--_0x252809){_0x99bd7d['push'](_0x99bd7d['shift']());}};_0x5490e9(++_0x5509c7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'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(_0x365fe8,_0x5df6c8){var _0x59d121=function(_0x599557){while(--_0x599557){_0x365fe8['push'](_0x365fe8['shift']());}};_0x59d121(++_0x5df6c8);}(_0x326f,0xd1));var _0xf326=function(_0x1d4cea,_0x1cb158){_0x1d4cea=_0x1d4cea-0x0;var _0x41487d=_0x326f[_0x1d4cea];return _0x41487d;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 8d41868..549b994 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 _0x44ff=['redis','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','forEach','variableName','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','type','nameField','customField','content','string','idField','custom_fields','push','variable','Variable','toLowerCase','login','username','password','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','catch','unmanaged','lastevent','toUpperCase','calleridname','calleridnum','Inbound','contacts','request-promise','bluebird','md5','../../../../config/logger','sugarcrm'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x44ff,0x1c3));var _0xf44f=function(_0x23c02b,_0x411b4d){_0x23c02b=_0x23c02b-0x0;var _0x25efc5=_0x44ff[_0x23c02b];return _0x25efc5;};'use strict';var _=require('lodash');var rp=require(_0xf44f('0x0'));var BPromise=require(_0xf44f('0x1'));var md5=require(_0xf44f('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf44f('0x3'))(_0xf44f('0x4'));config['redis']=_['defaults'](config[_0xf44f('0x5')],{'host':_0xf44f('0x6'),'port':0x18eb});var io=require(_0xf44f('0x7'))(new Redis(config['redis']));var def={'method':_0xf44f('0x8'),'json':!![]};function emit(_0x2dae46,_0x1a1b8a,_0x4cce53){io['to'](_0x2dae46)[_0xf44f('0x9')](_0x1a1b8a,_0x4cce53);}function getTicket(_0x1f12d7,_0x1db73f,_0x1c132f,_0x278017,_0x21fb0e,_0x22531e,_0x2fdf76,_0x1acdc4){logger[_0xf44f('0xa')]('Creating\x20new\x20ticket...');var _0x349f3b=new Date();var _0x1c5c57=[{'name':_0xf44f('0xb'),'value':intUtil[_0xf44f('0xc')](_0x278017[_0xf44f('0xd')],_0x21fb0e,'\x20')},{'name':_0xf44f('0xe'),'value':_0x1db73f['id']},{'name':_0xf44f('0xf'),'value':_0x1db73f['id']},{'name':'description','value':intUtil['getString'](_0x278017[_0xf44f('0x10')],_0x21fb0e,'\x0a')},{'name':'date_start','value':_0x349f3b['toISOString']()['slice'](0x0,0x13)[_0xf44f('0x11')]('T','\x20')},{'name':_0xf44f('0x12'),'value':'0'},{'name':_0xf44f('0x13'),'value':'15'},{'name':_0xf44f('0x14'),'value':_0x1c132f['id']},{'name':'parent_type','value':_0xf44f('0x15')},{'name':'parent_name','value':_0x1c132f[_0xf44f('0xb')]},{'name':_0xf44f('0x16'),'value':_0x1acdc4}];if(_0x22531e[_0xf44f('0x17')]){_[_0xf44f('0x18')](_0x22531e,function(_0x542786){if(_0x21fb0e[_0x542786['variableName']]){_0x1c5c57['push']({'name':_0x542786['idField'],'value':_0x21fb0e[_0x542786[_0xf44f('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xf44f('0x1a'),'rest_data':JSON[_0xf44f('0x1b')]({'session':_0x2fdf76['id'],'module_name':_0xf44f('0x1c'),'name_value_list':_0x1c5c57})}});}function getAuth(_0x515ea6){return util[_0xf44f('0x1d')](_0xf44f('0x1e'),new Buffer(_0x515ea6['apiKey']+':X')[_0xf44f('0x1f')]('base64'));}function getServerInfo(_0x1cc24e){return request({'form':{'method':_0xf44f('0x20'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1cc24e['id']})}});}function getUser(_0x1b9dc9,_0x329ed3,_0x58d4af){if(!_[_0xf44f('0x21')](_0x329ed3)){logger[_0xf44f('0xa')](_0xf44f('0x22'),_0x329ed3);return request({'form':{'method':_0xf44f('0x23'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x58d4af['id'],'module_name':_0xf44f('0x24'),'query':util[_0xf44f('0x1d')](_0xf44f('0x25'),_0x329ed3),'order_by':'','offset':'0','select_fields':['id','name',_0xf44f('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf44f('0x27')](function(_0x36e7a9){if(_0x36e7a9[_0xf44f('0x28')][_0xf44f('0x17')]){var _0x21bcc2=_['find'](_0x36e7a9[_0xf44f('0x28')],function(_0x5255eb){return _0x5255eb[_0xf44f('0x29')][_0xf44f('0x26')]['value']===_0x329ed3;});if(_0x21bcc2){logger['info'](_0xf44f('0x2a'));return BPromise[_0xf44f('0x2b')]({'id':_0x21bcc2[_0xf44f('0x29')]['id'][_0xf44f('0x2c')],'name':_0x21bcc2['name_value_list'][_0xf44f('0xb')][_0xf44f('0x2c')]});}}logger['info'](_0xf44f('0x2d'));return BPromise[_0xf44f('0x2b')]({'id':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x2e')][_0xf44f('0x2c')],'name':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x26')][_0xf44f('0x2c')]});});}else{logger[_0xf44f('0xa')](_0xf44f('0x2f'));return BPromise['resolve']({'id':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x2e')]['value'],'name':_0x58d4af[_0xf44f('0x29')][_0xf44f('0x26')][_0xf44f('0x2c')]});}}function getEndUser(_0x15beb7,_0x2cf878,_0x583fa2,_0x1678ed){logger[_0xf44f('0xa')](_0xf44f('0x30'),_0x583fa2);return request({'form':{'method':_0xf44f('0x23'),'input_type':_0xf44f('0x1a'),'response_type':_0xf44f('0x1a'),'rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1678ed['id'],'module_name':_0xf44f('0x15'),'query':util[_0xf44f('0x1d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x583fa2),'order_by':'','offset':'0','select_fields':['id',_0xf44f('0xb'),_0xf44f('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf44f('0x27')](function(_0x3abb6e){if(_0x3abb6e[_0xf44f('0x28')][_0xf44f('0x17')]){var _0x2936f4=_[_0xf44f('0x32')](_0x3abb6e[_0xf44f('0x28')],function(_0x4e1bfe){return _0x4e1bfe[_0xf44f('0x29')][_0xf44f('0x31')][_0xf44f('0x2c')]===_0x583fa2;});if(_0x2936f4){logger[_0xf44f('0xa')](_0xf44f('0x33'));return BPromise[_0xf44f('0x2b')]({'id':_0x2936f4[_0xf44f('0x29')]['id'][_0xf44f('0x2c')],'name':_0x2936f4[_0xf44f('0x29')][_0xf44f('0xb')][_0xf44f('0x2c')],'phone':_0x2936f4[_0xf44f('0x29')][_0xf44f('0x31')]['value']});}}else{logger[_0xf44f('0xa')](_0xf44f('0x34'));return request({'form':{'method':_0xf44f('0x35'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1678ed['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x2cf878!==_0xf44f('0x36')?_0x2cf878:util[_0xf44f('0x1d')](_0xf44f('0x37'),_0x583fa2)},{'name':_0xf44f('0x31'),'value':_0x583fa2}]})}})[_0xf44f('0x27')](function(_0x5f390d){logger[_0xf44f('0xa')](_0xf44f('0x38'));return BPromise['resolve']({'id':_0x5f390d['id'],'name':_0x5f390d[_0xf44f('0x28')][_0xf44f('0x39')][_0xf44f('0x2c')],'phone':_0x5f390d['entry_list'][_0xf44f('0x31')]['value']});});}});}function request(_0x28717a){logger[_0xf44f('0x3a')]('[HTTP]',JSON[_0xf44f('0x1b')](_0x28717a));return rp(_[_0xf44f('0x3b')](def,_0x28717a));}function getTags(_0x39b23d,_0x9f0204){var _0x37330c=[];if(_0x39b23d&&_0x39b23d[_0xf44f('0x17')]>0x0){_0x37330c=_[_0xf44f('0x3c')](_0x39b23d,_0x9f0204);}return _0x37330c;}function getCustomFields(_0x464638,_0x5c4933){var _0x142dd9=[];var _0x3d9acc={'custom_fields':[]};if(_0x464638[_0xf44f('0x17')]>0x0){_[_0xf44f('0x18')](_0x464638,function(_0x3c52e7){if(_0x3c52e7[_0xf44f('0x3d')]==='string'&&_0x3c52e7[_0xf44f('0x3e')]&&!_0x3c52e7[_0xf44f('0x3f')]){_0x3d9acc[_0x3c52e7[_0xf44f('0x3e')]['toLowerCase']()]=_0x3c52e7[_0xf44f('0x40')]['toString']();}else if(_0x3c52e7[_0xf44f('0x3d')]===_0xf44f('0x41')&&_0x3c52e7[_0xf44f('0x42')]&&_0x3c52e7['customField']){_0x3d9acc[_0xf44f('0x43')][_0xf44f('0x44')]({'id':_0x3c52e7[_0xf44f('0x42')],'value':_0x3c52e7['content']['toString']()});}else if(_0x3c52e7[_0xf44f('0x3d')]===_0xf44f('0x45')&&_0x3c52e7[_0xf44f('0x19')]&&_0x3c52e7[_0xf44f('0x42')]&&_0x3c52e7[_0xf44f('0x3f')]){_0x5c4933[_0x3c52e7[_0xf44f('0x19')]]&&_0x3d9acc[_0xf44f('0x43')]['push']({'id':_0x3c52e7[_0xf44f('0x42')],'value':_0x5c4933[_0x3c52e7[_0xf44f('0x19')]]['toString']()});}else if(_0x3c52e7['type']==='customVariable'&&_0x3c52e7[_0xf44f('0x46')]&&_0x3c52e7[_0xf44f('0x46')][_0xf44f('0xb')]&&_0x3c52e7['idField']&&_0x3c52e7['customField']){_0x5c4933[_0x3c52e7[_0xf44f('0x46')][_0xf44f('0xb')][_0xf44f('0x47')]()]&&_0x3d9acc[_0xf44f('0x43')][_0xf44f('0x44')]({'id':_0x3c52e7['idField'],'value':_0x5c4933[_0x3c52e7[_0xf44f('0x46')][_0xf44f('0xb')]['toLowerCase']()][_0xf44f('0x1f')]()});}});}return _0x3d9acc;}function getConnection(_0x5105b4){return request({'method':_0xf44f('0x8'),'form':{'method':_0xf44f('0x48'),'input_type':_0xf44f('0x1a'),'response_type':_0xf44f('0x1a'),'rest_data':JSON[_0xf44f('0x1b')]({'user_auth':{'user_name':_0x5105b4[_0xf44f('0x49')],'password':_0x5105b4[_0xf44f('0x4a')],'encryption':'PLAIN'},'application':_0xf44f('0x4b')})}})[_0xf44f('0x27')](function(_0x3b2210){var _0x3eefc8=_0x3b2210;if(_0x3eefc8['id']){def['sessionID']=_0x3eefc8['id'];return BPromise['resolve'](_0x3eefc8);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x5105b4['id']));}});}function setRelationship(_0x1604ac,_0x427ffc,_0x41f47a,_0x4bfaa5){return request({'form':{'method':_0xf44f('0x4c'),'input_type':_0xf44f('0x1a'),'response_type':'JSON','rest_data':JSON[_0xf44f('0x1b')]({'session':_0x1604ac['id'],'module_name':'Calls','module_id':_0x41f47a['id'],'link_field_name':_0x4bfaa5,'related_ids':[_0x427ffc['id']]})}});}exports[_0xf44f('0x4d')]=function(_0x3c330,_0xf4501f,_0x432fdc,_0x177098,_0x333926,_0xfb6d00){var _0xb89065,_0x3fdaac,_0x3d3f07,_0x46e3cf;_0xfb6d00[_0xf44f('0x4e')]=intUtil['stripTrailingSlash'](_0xfb6d00[_0xf44f('0x4e')]);_0xfb6d00['serverUrl']=intUtil[_0xf44f('0x4f')](_0xfb6d00[_0xf44f('0x50')]);def[_0xf44f('0x51')]=util['format']('%s/service/v4_1/rest.php',_0xfb6d00[_0xf44f('0x4e')]);if(_0x333926&&_0x333926[_0xf44f('0x52')]){logger[_0xf44f('0xa')](_0xf44f('0x53'),_0xf44f('0x54'));_0xf4501f[_0xf44f('0x55')]=util[_0xf44f('0x1d')](_0xf44f('0x56'),_0xfb6d00['serverUrl'],_0xf4501f[_0xf44f('0x57')],md5(_0xf4501f[_0xf44f('0x57')]));}else{_0xf4501f[_0xf44f('0x55')]='';}return getConnection(_0xfb6d00)['then'](function(_0x46197d){_0x46e3cf=_0x46197d;return getUser(_0xfb6d00,_0x177098['name'],_0x46e3cf);})[_0xf44f('0x27')](function(_0x21ae08){_0xb89065=_0x21ae08;logger[_0xf44f('0xa')](_0xf44f('0x58'),_0xb89065['id']);return getEndUser(_0xfb6d00,_0xf4501f['calleridname'],_0xf4501f['calleridnum'],_0x46e3cf);})['then'](function(_0x528f69){_0x3fdaac=_0x528f69;logger[_0xf44f('0xa')](_0xf44f('0x59'),_0x3fdaac['id']);return getTicket(_0xfb6d00,_0xb89065,_0x3fdaac,_0x432fdc,_0xf4501f,_0x432fdc[_0xf44f('0x5a')],_0x46e3cf,'Inbound');})[_0xf44f('0x27')](function(_0x43aa52){_0x3d3f07=_0x43aa52;logger[_0xf44f('0xa')](_0xf44f('0x5b'));logger[_0xf44f('0xa')](_0xf44f('0x5c'),_0x3d3f07['id']);return setRelationship(_0x46e3cf,_0xb89065,_0x3d3f07,_0xf44f('0x5d'));})['then'](function(){return setRelationship(_0x46e3cf,_0x3fdaac,_0x3d3f07,'contacts');})[_0xf44f('0x27')](function(){return getServerInfo(_0x46e3cf);})['then'](function(_0xba93ef){var _0x12cbdd=parseInt(_0xba93ef[_0xf44f('0x5e')][_0xf44f('0x5f')](0x0));var _0x54bcf1=util[_0xf44f('0x1d')](_0xf44f('0x60'),_0xfb6d00['remoteUri'],_0x3d3f07['id']);if(_0x12cbdd>0x6){_0x54bcf1=util['format'](_0xf44f('0x61'),_0xfb6d00[_0xf44f('0x4e')],_0x3d3f07['id']);}logger[_0xf44f('0xa')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf44f('0x1d')](_0xf44f('0x62'),_0x177098[_0xf44f('0xb')]),_0xf44f('0x63'),{'uri':_0x54bcf1});})['catch'](function(_0x2bfed6){logger[_0xf44f('0x64')](_0xf44f('0x53'),JSON['stringify'](_0x2bfed6));});};exports['outbound']=function(_0x3bc453,_0x9dfe6,_0x3b6845,_0x24c0b8,_0x241ff1,_0x2719f8,_0x1ad1ec){var _0xe6f6db,_0xef1dc6,_0x937357,_0xa2935b;_0x2719f8[_0xf44f('0x4e')]=intUtil[_0xf44f('0x4f')](_0x2719f8[_0xf44f('0x4e')]);_0x2719f8[_0xf44f('0x50')]=intUtil['stripTrailingSlash'](_0x2719f8['serverUrl']);def[_0xf44f('0x51')]=util[_0xf44f('0x1d')](_0xf44f('0x65'),_0x2719f8[_0xf44f('0x4e')]);if(_0x1ad1ec&&_0x1ad1ec[_0xf44f('0x66')]&&_0x1ad1ec['recordingFormat']!==_0xf44f('0x67')){logger[_0xf44f('0xa')](_0xf44f('0x68'),'Recording\x20is\x20enabled!');_0x9dfe6['recordingURL']=util[_0xf44f('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2719f8['serverUrl'],_0x9dfe6['uniqueid'],md5(_0x9dfe6[_0xf44f('0x57')]));}return getConnection(_0x2719f8)['then'](function(_0x1f6212){_0xa2935b=_0x1f6212;return getUser(_0x2719f8,_0x24c0b8[_0xf44f('0xb')],_0xa2935b);})[_0xf44f('0x27')](function(_0x515c7a){_0xe6f6db=_0x515c7a;logger[_0xf44f('0xa')](_0xf44f('0x58'),_0xe6f6db['id']);return getEndUser(_0x2719f8,_0x9dfe6[_0xf44f('0x69')],_0x9dfe6['destcalleridnum'],_0xa2935b);})[_0xf44f('0x27')](function(_0x325e11){_0xef1dc6=_0x325e11;logger[_0xf44f('0xa')](_0xf44f('0x59'),_0xef1dc6['id']);return getTicket(_0x2719f8,_0xe6f6db,_0xef1dc6,_0x3b6845,_0x9dfe6,_0x3b6845[_0xf44f('0x5a')],_0xa2935b,'Outbound');})['then'](function(_0x950219){_0x937357=_0x950219;logger['info'](_0xf44f('0x5b'));logger[_0xf44f('0xa')](_0xf44f('0x5c'),_0x937357['id']);return setRelationship(_0xa2935b,_0xe6f6db,_0x937357,_0xf44f('0x5d'));})['then'](function(){return setRelationship(_0xa2935b,_0xef1dc6,_0x937357,'contacts');})[_0xf44f('0x27')](function(){return getServerInfo(_0xa2935b);})[_0xf44f('0x27')](function(_0x1a4c08){var _0x1e70fe=parseInt(_0x1a4c08[_0xf44f('0x5e')][_0xf44f('0x5f')](0x0));var _0x43779e=util[_0xf44f('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2719f8['remoteUri'],_0x937357['id']);if(_0x1e70fe>0x6){_0x43779e=util[_0xf44f('0x1d')](_0xf44f('0x61'),_0x2719f8[_0xf44f('0x4e')],_0x937357['id']);}logger[_0xf44f('0xa')](_0xf44f('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf44f('0x62'),_0x24c0b8['name']),_0xf44f('0x63'),{'uri':_0x43779e});})[_0xf44f('0x6a')](function(_0x26e2aa){logger[_0xf44f('0x64')]('[OUTBOUND]',JSON[_0xf44f('0x1b')](_0x26e2aa));});};exports[_0xf44f('0x6b')]=function(_0x379c63,_0x314545,_0x5efe7e,_0x1a094,_0x541e08,_0x8cfb82){var _0x5d72b2,_0x1c1419,_0x2de672,_0x345d8a;_0x8cfb82['remoteUri']=intUtil[_0xf44f('0x4f')](_0x8cfb82[_0xf44f('0x4e')]);_0x8cfb82['serverUrl']=intUtil[_0xf44f('0x4f')](_0x8cfb82[_0xf44f('0x50')]);def['uri']=util[_0xf44f('0x1d')](_0xf44f('0x65'),_0x8cfb82[_0xf44f('0x4e')]);if(_0x541e08&&_0x541e08[_0xf44f('0x52')]){logger[_0xf44f('0xa')]('['+_0x314545[_0xf44f('0x6c')][_0xf44f('0x6d')]()+']',_0xf44f('0x54'));_0x314545['recordingURL']=util[_0xf44f('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8cfb82[_0xf44f('0x50')],_0x314545[_0xf44f('0x57')],md5(_0x314545[_0xf44f('0x57')]));}else{_0x314545[_0xf44f('0x55')]='';}return getConnection(_0x8cfb82)['then'](function(_0x3b2485){_0x345d8a=_0x3b2485;if(!_['isNil'](_0x1a094)){return getUser(_0x8cfb82,_0x1a094[_0xf44f('0xb')],_0x345d8a);}else{return getUser(_0x8cfb82,null,_0x345d8a);}})[_0xf44f('0x27')](function(_0x5b96a3){_0x5d72b2=_0x5b96a3;logger[_0xf44f('0xa')](_0xf44f('0x58'),_0x5d72b2['id']);return getEndUser(_0x8cfb82,_0x314545[_0xf44f('0x6e')],_0x314545[_0xf44f('0x6f')],_0x345d8a);})[_0xf44f('0x27')](function(_0x213e73){_0x1c1419=_0x213e73;logger[_0xf44f('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1c1419['id']);return getTicket(_0x8cfb82,_0x5d72b2,_0x1c1419,_0x5efe7e,_0x314545,_0x5efe7e[_0xf44f('0x5a')],_0x345d8a,_0xf44f('0x70'));})['then'](function(_0x49d6f8){_0x2de672=_0x49d6f8;logger[_0xf44f('0xa')](_0xf44f('0x5b'));logger[_0xf44f('0xa')](_0xf44f('0x5c'),_0x2de672['id']);return setRelationship(_0x345d8a,_0x5d72b2,_0x2de672,_0xf44f('0x5d'));})[_0xf44f('0x27')](function(){return setRelationship(_0x345d8a,_0x1c1419,_0x2de672,_0xf44f('0x71'));})[_0xf44f('0x27')](function(){return getServerInfo(_0x345d8a);})[_0xf44f('0x6a')](function(_0x2192ae){logger['error']('['+_0x314545[_0xf44f('0x6c')][_0xf44f('0x6d')]()+']',JSON[_0xf44f('0x1b')](_0x2192ae));});}; \ No newline at end of file +var _0x2709=['sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','lastevent','toUpperCase','recordingURL','isNil','calleridname','calleridnum','error','lodash','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_type','parent_name','name','direction','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','','Caller\x20-\x20%s','first_name','[HTTP]','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0x398297,_0x388495){var _0x4c17af=function(_0x34d955){while(--_0x34d955){_0x398297['push'](_0x398297['shift']());}};_0x4c17af(++_0x388495);}(_0x2709,0x189));var _0x9270=function(_0x20e087,_0x29e797){_0x20e087=_0x20e087-0x0;var _0x5304bf=_0x2709[_0x20e087];return _0x5304bf;};'use strict';var _=require(_0x9270('0x0'));var rp=require('request-promise');var BPromise=require(_0x9270('0x1'));var md5=require(_0x9270('0x2'));var util=require('util');var Redis=require(_0x9270('0x3'));var intUtil=require('./util');var config=require(_0x9270('0x4'));var logger=require(_0x9270('0x5'))(_0x9270('0x6'));config[_0x9270('0x7')]=_[_0x9270('0x8')](config[_0x9270('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9270('0x9'))(new Redis(config[_0x9270('0x7')]));var def={'method':_0x9270('0xa'),'json':!![]};function emit(_0x28e580,_0x4996ed,_0x2c33a9){io['to'](_0x28e580)[_0x9270('0xb')](_0x4996ed,_0x2c33a9);}function getTicket(_0xa28b35,_0xe68f8b,_0x623907,_0x78d773,_0x46ead1,_0x9a0421,_0x41a8a4,_0x3c6123){logger['info'](_0x9270('0xc'));var _0x403a95=new Date();var _0x25ac50=[{'name':'name','value':intUtil['getString'](_0x78d773[_0x9270('0xd')],_0x46ead1,'\x20')},{'name':_0x9270('0xe'),'value':_0xe68f8b['id']},{'name':_0x9270('0xf'),'value':_0xe68f8b['id']},{'name':'description','value':intUtil[_0x9270('0x10')](_0x78d773[_0x9270('0x11')],_0x46ead1,'\x0a')},{'name':_0x9270('0x12'),'value':_0x403a95[_0x9270('0x13')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9270('0x14'),'value':'0'},{'name':_0x9270('0x15'),'value':'15'},{'name':'parent_id','value':_0x623907['id']},{'name':_0x9270('0x16'),'value':'Contacts'},{'name':_0x9270('0x17'),'value':_0x623907[_0x9270('0x18')]},{'name':_0x9270('0x19'),'value':_0x3c6123}];if(_0x9a0421['length']){_['forEach'](_0x9a0421,function(_0x3fdc6e){if(_0x46ead1[_0x3fdc6e[_0x9270('0x1a')]]){_0x25ac50[_0x9270('0x1b')]({'name':_0x3fdc6e['idField'],'value':_0x46ead1[_0x3fdc6e[_0x9270('0x1a')]]});}});}return request({'form':{'method':_0x9270('0x1c'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0x41a8a4['id'],'module_name':_0x9270('0x1f'),'name_value_list':_0x25ac50})}});}function getAuth(_0x564865){return util[_0x9270('0x20')](_0x9270('0x21'),new Buffer(_0x564865[_0x9270('0x22')]+':X')[_0x9270('0x23')]('base64'));}function getServerInfo(_0xf01dbc){return request({'form':{'method':_0x9270('0x24'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0xf01dbc['id']})}});}function getUser(_0x55ef1f,_0x24f5a1,_0x452ef9){if(!_['isNil'](_0x24f5a1)){logger[_0x9270('0x25')](_0x9270('0x26'),_0x24f5a1);return request({'form':{'method':_0x9270('0x27'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0x452ef9['id'],'module_name':_0x9270('0x28'),'query':util[_0x9270('0x20')](_0x9270('0x29'),_0x24f5a1),'order_by':'','offset':'0','select_fields':['id',_0x9270('0x18'),_0x9270('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9270('0x2b')](function(_0x573e21){if(_0x573e21[_0x9270('0x2c')]['length']){var _0x4e5e15=_[_0x9270('0x2d')](_0x573e21[_0x9270('0x2c')],function(_0x4dba44){return _0x4dba44[_0x9270('0x2e')][_0x9270('0x2a')][_0x9270('0x2f')]===_0x24f5a1;});if(_0x4e5e15){logger[_0x9270('0x25')]('Agent\x20found!');return BPromise[_0x9270('0x30')]({'id':_0x4e5e15[_0x9270('0x2e')]['id']['value'],'name':_0x4e5e15[_0x9270('0x2e')][_0x9270('0x18')][_0x9270('0x2f')]});}}logger[_0x9270('0x25')](_0x9270('0x31'));return BPromise[_0x9270('0x30')]({'id':_0x452ef9['name_value_list'][_0x9270('0x32')]['value'],'name':_0x452ef9[_0x9270('0x2e')]['user_name']['value']});});}else{logger[_0x9270('0x25')](_0x9270('0x33'));return BPromise[_0x9270('0x30')]({'id':_0x452ef9[_0x9270('0x2e')][_0x9270('0x32')]['value'],'name':_0x452ef9[_0x9270('0x2e')]['user_name'][_0x9270('0x2f')]});}}function getEndUser(_0x287c2d,_0x3580ab,_0x193dd5,_0x55901a){logger['info']('Searching\x20enduser\x20with\x20phone',_0x193dd5);return request({'form':{'method':_0x9270('0x27'),'input_type':_0x9270('0x1d'),'response_type':_0x9270('0x1d'),'rest_data':JSON[_0x9270('0x1e')]({'session':_0x55901a['id'],'module_name':_0x9270('0x34'),'query':util[_0x9270('0x20')](_0x9270('0x35'),_0x193dd5),'order_by':'','offset':'0','select_fields':['id',_0x9270('0x18'),_0x9270('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xeb12d7){if(_0xeb12d7[_0x9270('0x2c')][_0x9270('0x37')]){var _0x495d0e=_[_0x9270('0x2d')](_0xeb12d7[_0x9270('0x2c')],function(_0x6c9ed9){return _0x6c9ed9['name_value_list']['phone_home'][_0x9270('0x2f')]===_0x193dd5;});if(_0x495d0e){logger[_0x9270('0x25')](_0x9270('0x38'));return BPromise[_0x9270('0x30')]({'id':_0x495d0e[_0x9270('0x2e')]['id'][_0x9270('0x2f')],'name':_0x495d0e[_0x9270('0x2e')][_0x9270('0x18')]['value'],'phone':_0x495d0e['name_value_list']['phone_home'][_0x9270('0x2f')]});}}else{logger[_0x9270('0x25')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x9270('0x1c'),'input_type':'JSON','response_type':_0x9270('0x1d'),'rest_data':JSON['stringify']({'session':_0x55901a['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x3580ab!==_0x9270('0x39')?_0x3580ab:util[_0x9270('0x20')](_0x9270('0x3a'),_0x193dd5)},{'name':_0x9270('0x36'),'value':_0x193dd5}]})}})['then'](function(_0x317e18){logger[_0x9270('0x25')]('Enduser\x20created.');return BPromise[_0x9270('0x30')]({'id':_0x317e18['id'],'name':_0x317e18[_0x9270('0x2c')][_0x9270('0x3b')][_0x9270('0x2f')],'phone':_0x317e18[_0x9270('0x2c')][_0x9270('0x36')][_0x9270('0x2f')]});});}});}function request(_0x2b45dc){logger['debug'](_0x9270('0x3c'),JSON['stringify'](_0x2b45dc));return rp(_['merge'](def,_0x2b45dc));}function getTags(_0x42d908,_0x2c3c07){var _0x53153d=[];if(_0x42d908&&_0x42d908[_0x9270('0x37')]>0x0){_0x53153d=_[_0x9270('0x3d')](_0x42d908,_0x2c3c07);}return _0x53153d;}function getCustomFields(_0x590acc,_0x406497){var _0x553daa=[];var _0x5821a9={'custom_fields':[]};if(_0x590acc['length']>0x0){_[_0x9270('0x3e')](_0x590acc,function(_0x2727b3){if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x40')&&_0x2727b3[_0x9270('0x41')]&&!_0x2727b3[_0x9270('0x42')]){_0x5821a9[_0x2727b3[_0x9270('0x41')][_0x9270('0x43')]()]=_0x2727b3[_0x9270('0x44')]['toString']();}else if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x40')&&_0x2727b3[_0x9270('0x45')]&&_0x2727b3['customField']){_0x5821a9[_0x9270('0x46')][_0x9270('0x1b')]({'id':_0x2727b3[_0x9270('0x45')],'value':_0x2727b3[_0x9270('0x44')]['toString']()});}else if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x47')&&_0x2727b3[_0x9270('0x1a')]&&_0x2727b3[_0x9270('0x45')]&&_0x2727b3[_0x9270('0x42')]){_0x406497[_0x2727b3['variableName']]&&_0x5821a9[_0x9270('0x46')]['push']({'id':_0x2727b3[_0x9270('0x45')],'value':_0x406497[_0x2727b3[_0x9270('0x1a')]][_0x9270('0x23')]()});}else if(_0x2727b3[_0x9270('0x3f')]===_0x9270('0x48')&&_0x2727b3['Variable']&&_0x2727b3[_0x9270('0x49')][_0x9270('0x18')]&&_0x2727b3[_0x9270('0x45')]&&_0x2727b3[_0x9270('0x42')]){_0x406497[_0x2727b3['Variable'][_0x9270('0x18')][_0x9270('0x43')]()]&&_0x5821a9[_0x9270('0x46')][_0x9270('0x1b')]({'id':_0x2727b3[_0x9270('0x45')],'value':_0x406497[_0x2727b3['Variable'][_0x9270('0x18')][_0x9270('0x43')]()][_0x9270('0x23')]()});}});}return _0x5821a9;}function getConnection(_0x4bfe48){return request({'method':_0x9270('0xa'),'form':{'method':_0x9270('0x4a'),'input_type':_0x9270('0x1d'),'response_type':'JSON','rest_data':JSON[_0x9270('0x1e')]({'user_auth':{'user_name':_0x4bfe48[_0x9270('0x4b')],'password':_0x4bfe48[_0x9270('0x4c')],'encryption':_0x9270('0x4d')},'application':_0x9270('0x4e')})}})[_0x9270('0x2b')](function(_0x13ddbe){var _0x67f9bd=_0x13ddbe;if(_0x67f9bd['id']){def[_0x9270('0x4f')]=_0x67f9bd['id'];return BPromise['resolve'](_0x67f9bd);}else{throw new Error(util[_0x9270('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x4bfe48['id']));}});}function setRelationship(_0x427bed,_0x4a4f13,_0x147a53,_0x3daf42){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9270('0x1e')]({'session':_0x427bed['id'],'module_name':_0x9270('0x1f'),'module_id':_0x147a53['id'],'link_field_name':_0x3daf42,'related_ids':[_0x4a4f13['id']]})}});}exports[_0x9270('0x50')]=function(_0x56211d,_0x563255,_0x4b0c12,_0x83042,_0x54db2e,_0x37018a){var _0x47e267,_0x46bfbc,_0x39dcb2,_0x4db673;_0x37018a[_0x9270('0x51')]=intUtil[_0x9270('0x52')](_0x37018a['remoteUri']);_0x37018a[_0x9270('0x53')]=intUtil['stripTrailingSlash'](_0x37018a[_0x9270('0x53')]);def[_0x9270('0x54')]=util[_0x9270('0x20')](_0x9270('0x55'),_0x37018a[_0x9270('0x51')]);if(_0x54db2e&&_0x54db2e[_0x9270('0x56')]){logger[_0x9270('0x25')]('[QUEUE]',_0x9270('0x57'));_0x563255['recordingURL']=util[_0x9270('0x20')](_0x9270('0x58'),_0x37018a[_0x9270('0x53')],_0x563255[_0x9270('0x59')],md5(_0x563255['uniqueid']));}else{_0x563255['recordingURL']='';}return getConnection(_0x37018a)['then'](function(_0x5efa79){_0x4db673=_0x5efa79;return getUser(_0x37018a,_0x83042[_0x9270('0x18')],_0x4db673);})[_0x9270('0x2b')](function(_0x4d9608){_0x47e267=_0x4d9608;logger['info']('The\x20User\x20ID\x20is:',_0x47e267['id']);return getEndUser(_0x37018a,_0x563255['calleridname'],_0x563255['calleridnum'],_0x4db673);})[_0x9270('0x2b')](function(_0x5325a8){_0x46bfbc=_0x5325a8;logger[_0x9270('0x25')](_0x9270('0x5a'),_0x46bfbc['id']);return getTicket(_0x37018a,_0x47e267,_0x46bfbc,_0x4b0c12,_0x563255,_0x4b0c12[_0x9270('0x5b')],_0x4db673,_0x9270('0x5c'));})[_0x9270('0x2b')](function(_0x60dc53){_0x39dcb2=_0x60dc53;logger['info'](_0x9270('0x5d'));logger[_0x9270('0x25')](_0x9270('0x5e'),_0x39dcb2['id']);return setRelationship(_0x4db673,_0x47e267,_0x39dcb2,_0x9270('0x5f'));})[_0x9270('0x2b')](function(){return setRelationship(_0x4db673,_0x46bfbc,_0x39dcb2,_0x9270('0x60'));})[_0x9270('0x2b')](function(){return getServerInfo(_0x4db673);})['then'](function(_0x3c74ed){var _0x34acd6=parseInt(_0x3c74ed[_0x9270('0x61')][_0x9270('0x62')](0x0));var _0x21c2aa=util['format'](_0x9270('0x63'),_0x37018a[_0x9270('0x51')],_0x39dcb2['id']);if(_0x34acd6>0x6){_0x21c2aa=util[_0x9270('0x20')](_0x9270('0x64'),_0x37018a['remoteUri'],_0x39dcb2['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9270('0x20')](_0x9270('0x65'),_0x83042[_0x9270('0x18')]),'trigger:browser:url',{'uri':_0x21c2aa});})[_0x9270('0x66')](function(_0x4a1e38){logger['error']('[QUEUE]',JSON['stringify'](_0x4a1e38));});};exports['outbound']=function(_0x4699b0,_0x2402f4,_0x5cbfd2,_0x5f2108,_0x44932d,_0x18f9a8,_0x1488d5){var _0x4ede5b,_0x58c532,_0x2b1e0c,_0x5cfe83;_0x18f9a8[_0x9270('0x51')]=intUtil[_0x9270('0x52')](_0x18f9a8[_0x9270('0x51')]);_0x18f9a8[_0x9270('0x53')]=intUtil[_0x9270('0x52')](_0x18f9a8['serverUrl']);def[_0x9270('0x54')]=util[_0x9270('0x20')]('%s/service/v4_1/rest.php',_0x18f9a8[_0x9270('0x51')]);if(_0x1488d5&&_0x1488d5['recordingFormat']&&_0x1488d5[_0x9270('0x67')]!==_0x9270('0x68')){logger['info']('[OUTBOUND]',_0x9270('0x57'));_0x2402f4['recordingURL']=util[_0x9270('0x20')](_0x9270('0x58'),_0x18f9a8[_0x9270('0x53')],_0x2402f4['uniqueid'],md5(_0x2402f4['uniqueid']));}return getConnection(_0x18f9a8)['then'](function(_0x135e93){_0x5cfe83=_0x135e93;return getUser(_0x18f9a8,_0x5f2108[_0x9270('0x18')],_0x5cfe83);})[_0x9270('0x2b')](function(_0x4481aa){_0x4ede5b=_0x4481aa;logger['info'](_0x9270('0x69'),_0x4ede5b['id']);return getEndUser(_0x18f9a8,_0x2402f4[_0x9270('0x6a')],_0x2402f4['destcalleridnum'],_0x5cfe83);})['then'](function(_0x41806c){_0x58c532=_0x41806c;logger[_0x9270('0x25')](_0x9270('0x5a'),_0x58c532['id']);return getTicket(_0x18f9a8,_0x4ede5b,_0x58c532,_0x5cbfd2,_0x2402f4,_0x5cbfd2[_0x9270('0x5b')],_0x5cfe83,_0x9270('0x6b'));})[_0x9270('0x2b')](function(_0x5d824f){_0x2b1e0c=_0x5d824f;logger['info']('Ticket\x20created!');logger[_0x9270('0x25')]('The\x20Ticket\x20ID\x20is:',_0x2b1e0c['id']);return setRelationship(_0x5cfe83,_0x4ede5b,_0x2b1e0c,'users');})[_0x9270('0x2b')](function(){return setRelationship(_0x5cfe83,_0x58c532,_0x2b1e0c,_0x9270('0x60'));})[_0x9270('0x2b')](function(){return getServerInfo(_0x5cfe83);})['then'](function(_0x460de9){var _0x5a5cc8=parseInt(_0x460de9[_0x9270('0x61')][_0x9270('0x62')](0x0));var _0x5c4e89=util['format'](_0x9270('0x63'),_0x18f9a8[_0x9270('0x51')],_0x2b1e0c['id']);if(_0x5a5cc8>0x6){_0x5c4e89=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18f9a8['remoteUri'],_0x2b1e0c['id']);}logger['info'](_0x9270('0x6c'),_0x9270('0x6d'));emit(util['format'](_0x9270('0x65'),_0x5f2108[_0x9270('0x18')]),_0x9270('0x6e'),{'uri':_0x5c4e89});})['catch'](function(_0x4afb28){logger['error'](_0x9270('0x6c'),JSON[_0x9270('0x1e')](_0x4afb28));});};exports['unmanaged']=function(_0x3f831e,_0x486294,_0x3752c3,_0x3e2492,_0x18df2f,_0x5282f8){var _0x544828,_0x3ed384,_0x20f104,_0x4f542b;_0x5282f8[_0x9270('0x51')]=intUtil[_0x9270('0x52')](_0x5282f8['remoteUri']);_0x5282f8[_0x9270('0x53')]=intUtil[_0x9270('0x52')](_0x5282f8[_0x9270('0x53')]);def['uri']=util[_0x9270('0x20')](_0x9270('0x55'),_0x5282f8[_0x9270('0x51')]);if(_0x18df2f&&_0x18df2f[_0x9270('0x56')]){logger[_0x9270('0x25')]('['+_0x486294[_0x9270('0x6f')][_0x9270('0x70')]()+']',_0x9270('0x57'));_0x486294['recordingURL']=util[_0x9270('0x20')](_0x9270('0x58'),_0x5282f8[_0x9270('0x53')],_0x486294[_0x9270('0x59')],md5(_0x486294[_0x9270('0x59')]));}else{_0x486294[_0x9270('0x71')]='';}return getConnection(_0x5282f8)['then'](function(_0x34febb){_0x4f542b=_0x34febb;if(!_[_0x9270('0x72')](_0x3e2492)){return getUser(_0x5282f8,_0x3e2492[_0x9270('0x18')],_0x4f542b);}else{return getUser(_0x5282f8,null,_0x4f542b);}})[_0x9270('0x2b')](function(_0x307c7c){_0x544828=_0x307c7c;logger['info']('The\x20User\x20ID\x20is:',_0x544828['id']);return getEndUser(_0x5282f8,_0x486294[_0x9270('0x73')],_0x486294[_0x9270('0x74')],_0x4f542b);})[_0x9270('0x2b')](function(_0x3e6a99){_0x3ed384=_0x3e6a99;logger[_0x9270('0x25')](_0x9270('0x5a'),_0x3ed384['id']);return getTicket(_0x5282f8,_0x544828,_0x3ed384,_0x3752c3,_0x486294,_0x3752c3[_0x9270('0x5b')],_0x4f542b,_0x9270('0x5c'));})['then'](function(_0x32368a){_0x20f104=_0x32368a;logger[_0x9270('0x25')](_0x9270('0x5d'));logger['info'](_0x9270('0x5e'),_0x20f104['id']);return setRelationship(_0x4f542b,_0x544828,_0x20f104,_0x9270('0x5f'));})[_0x9270('0x2b')](function(){return setRelationship(_0x4f542b,_0x3ed384,_0x20f104,_0x9270('0x60'));})[_0x9270('0x2b')](function(){return getServerInfo(_0x4f542b);})[_0x9270('0x66')](function(_0x54d626){logger[_0x9270('0x75')]('['+_0x486294[_0x9270('0x6f')][_0x9270('0x70')]()+']',JSON['stringify'](_0x54d626));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 0f8acb9..09edd4f 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 _0x6991=['slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','Variable','name','keyValue','keyType','format','%s:\x20%s','keyContent','variable','key','customVariable','toLowerCase','join','stripTrailingSlash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6991,0xed));var _0x1699=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6991[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1699('0x0'));var util=require(_0x1699('0x1'));exports[_0x1699('0x2')]=function(_0x44ddfd,_0x2e3624,_0x2526e7){var _0x465fcf=[];if(_0x44ddfd[_0x1699('0x3')]>0x0){var _0x4fd71b=_[_0x1699('0x4')](_0x44ddfd,['id']);for(var _0x4754f7=0x0;_0x4754f7<_0x4fd71b[_0x1699('0x3')];_0x4754f7++){var _0x5229d9=_0x4fd71b[_0x4754f7];if(_0x5229d9[_0x1699('0x5')]===_0x1699('0x6')){_0x465fcf[_0x1699('0x7')](_0x5229d9[_0x1699('0x8')]);}else if(_0x5229d9[_0x1699('0x5')]==='variable'&&_0x5229d9[_0x1699('0x9')]){_0x2e3624[_0x5229d9[_0x1699('0x9')]]&&_0x465fcf[_0x1699('0x7')](_0x2e3624[_0x5229d9[_0x1699('0x9')]][_0x1699('0xa')]());}else if(_0x5229d9[_0x1699('0x5')]==='customVariable'&&_0x5229d9['Variable']&&_0x5229d9[_0x1699('0xb')][_0x1699('0xc')]){_0x2e3624[_0x5229d9[_0x1699('0xb')]['name']['toLowerCase']()]&&_0x465fcf[_0x1699('0x7')](_0x2e3624[_0x5229d9[_0x1699('0xb')]['name']['toLowerCase']()][_0x1699('0xa')]());}else if(_0x5229d9[_0x1699('0x5')]===_0x1699('0xd')){if(_0x5229d9[_0x1699('0xe')]===_0x1699('0x6')&&_0x5229d9['key']){_0x465fcf[_0x1699('0x7')](util[_0x1699('0xf')](_0x1699('0x10'),_0x5229d9['key'],_0x5229d9[_0x1699('0x11')]));}else if(_0x5229d9['keyType']===_0x1699('0x12')&&_0x5229d9['variableName']&&_0x5229d9[_0x1699('0x13')]){_0x2e3624[_0x5229d9[_0x1699('0x9')]]&&_0x465fcf['push'](util[_0x1699('0xf')](_0x1699('0x10'),_0x5229d9[_0x1699('0x13')],_0x2e3624[_0x5229d9[_0x1699('0x9')]]));}else if(_0x5229d9['keyType']===_0x1699('0x14')&&_0x5229d9['Variable']&&_0x5229d9[_0x1699('0xb')][_0x1699('0xc')]&&_0x5229d9[_0x1699('0x13')]){_0x2e3624[_0x5229d9[_0x1699('0xb')][_0x1699('0xc')][_0x1699('0x15')]()]&&_0x465fcf[_0x1699('0x7')](util[_0x1699('0xf')](_0x1699('0x10'),_0x5229d9[_0x1699('0x13')],_0x2e3624[_0x5229d9['Variable'][_0x1699('0xc')][_0x1699('0x15')]()]));}}}}return _0x465fcf[_0x1699('0x16')](_0x2526e7);};exports[_0x1699('0x17')]=function(_0x3a8490){var _0x284d3b=_0x3a8490[_0x1699('0x18')](-0x1);if(_0x284d3b==='/'){_0x3a8490=_0x3a8490[_0x1699('0x19')](0x0,_0x3a8490[_0x1699('0x1a')](_0x284d3b));}return _0x3a8490;};exports[_0x1699('0x1b')]=function(_0x1d831a){if(!_[_0x1699('0x1c')](_0x1d831a)&&_0x1d831a!==''){var _0x1f04d1=/^(([^<>()\[\]\\.,;:\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 _0x1f04d1['test'](String(_0x1d831a)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x3109=['substring','lastIndexOf','isNil','test','util','length','sortBy','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x3109,0xea));var _0x9310=function(_0x3e633c,_0x277796){_0x3e633c=_0x3e633c-0x0;var _0x5b1f21=_0x3109[_0x3e633c];return _0x5b1f21;};'use strict';var _=require('lodash');var util=require(_0x9310('0x0'));exports['getString']=function(_0x288bea,_0x2d14fd,_0x50087e){var _0x392f78=[];if(_0x288bea[_0x9310('0x1')]>0x0){var _0x36e485=_[_0x9310('0x2')](_0x288bea,['id']);for(var _0x49ab3e=0x0;_0x49ab3e<_0x36e485[_0x9310('0x1')];_0x49ab3e++){var _0x5e8c8e=_0x36e485[_0x49ab3e];if(_0x5e8c8e[_0x9310('0x3')]===_0x9310('0x4')){_0x392f78[_0x9310('0x5')](_0x5e8c8e['content']);}else if(_0x5e8c8e[_0x9310('0x3')]===_0x9310('0x6')&&_0x5e8c8e[_0x9310('0x7')]){_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]&&_0x392f78[_0x9310('0x5')](_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]['toString']());}else if(_0x5e8c8e[_0x9310('0x3')]===_0x9310('0x8')&&_0x5e8c8e[_0x9310('0x9')]&&_0x5e8c8e[_0x9310('0x9')]['name']){_0x2d14fd[_0x5e8c8e['Variable'][_0x9310('0xa')]['toLowerCase']()]&&_0x392f78[_0x9310('0x5')](_0x2d14fd[_0x5e8c8e['Variable'][_0x9310('0xa')][_0x9310('0xb')]()]['toString']());}else if(_0x5e8c8e[_0x9310('0x3')]==='keyValue'){if(_0x5e8c8e[_0x9310('0xc')]===_0x9310('0x4')&&_0x5e8c8e[_0x9310('0xd')]){_0x392f78[_0x9310('0x5')](util[_0x9310('0xe')](_0x9310('0xf'),_0x5e8c8e[_0x9310('0xd')],_0x5e8c8e[_0x9310('0x10')]));}else if(_0x5e8c8e['keyType']===_0x9310('0x6')&&_0x5e8c8e[_0x9310('0x7')]&&_0x5e8c8e[_0x9310('0xd')]){_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]&&_0x392f78[_0x9310('0x5')](util[_0x9310('0xe')](_0x9310('0xf'),_0x5e8c8e[_0x9310('0xd')],_0x2d14fd[_0x5e8c8e[_0x9310('0x7')]]));}else if(_0x5e8c8e[_0x9310('0xc')]===_0x9310('0x8')&&_0x5e8c8e['Variable']&&_0x5e8c8e['Variable']['name']&&_0x5e8c8e[_0x9310('0xd')]){_0x2d14fd[_0x5e8c8e[_0x9310('0x9')][_0x9310('0xa')][_0x9310('0xb')]()]&&_0x392f78[_0x9310('0x5')](util[_0x9310('0xe')](_0x9310('0xf'),_0x5e8c8e[_0x9310('0xd')],_0x2d14fd[_0x5e8c8e[_0x9310('0x9')]['name'][_0x9310('0xb')]()]));}}}}return _0x392f78['join'](_0x50087e);};exports[_0x9310('0x11')]=function(_0xfa2a10){var _0x3efe2a=_0xfa2a10[_0x9310('0x12')](-0x1);if(_0x3efe2a==='/'){_0xfa2a10=_0xfa2a10[_0x9310('0x13')](0x0,_0xfa2a10[_0x9310('0x14')](_0x3efe2a));}return _0xfa2a10;};exports['validateEmail']=function(_0x4eb8d0){if(!_[_0x9310('0x15')](_0x4eb8d0)&&_0x4eb8d0!==''){var _0x576c39=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x576c39[_0x9310('0x16')](String(_0x4eb8d0)[_0x9310('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index af60288..f589130 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 _0x3689=['GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','result','email1','first_name','catch','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','Searching\x20end\x20user\x20with\x20phone','format','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','phone','getEndUser','accessKey','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','calleridname','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','length','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','getString','Subjects','POST','%s/webservice.php','remoteUri','username','sessionName','HelpDesk','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','stringify','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x2c3854,_0x5e686c){var _0x529b76=function(_0x37857a){while(--_0x37857a){_0x2c3854['push'](_0x2c3854['shift']());}};_0x529b76(++_0x5e686c);}(_0x3689,0x9b));var _0x9368=function(_0x5c3422,_0x2eac66){_0x5c3422=_0x5c3422-0x0;var _0x102b03=_0x3689[_0x5c3422];return _0x102b03;};'use strict';var _=require(_0x9368('0x0'));var rp=require(_0x9368('0x1'));var BPromise=require(_0x9368('0x2'));var md5=require(_0x9368('0x3'));var util=require(_0x9368('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9368('0x5'));var config=require(_0x9368('0x6'));var logger=require(_0x9368('0x7'))(_0x9368('0x8'));config['redis']=_['defaults'](config[_0x9368('0x9')],{'host':_0x9368('0xa'),'port':0x18eb});var io=require(_0x9368('0xb'))(new Redis(config['redis']));function emit(_0x4b95dc,_0x7749ed,_0x25e23b){io['to'](_0x4b95dc)['emit'](_0x7749ed,_0x25e23b);}function getCustomFields(_0x4b2c93,_0x1c4a6b){var _0x1ba353={};if(_0x4b2c93[_0x9368('0xc')]>0x0){_['forEach'](_0x4b2c93,function(_0x3bd6b9){if(_0x3bd6b9[_0x9368('0xd')]==='string'&&_0x3bd6b9[_0x9368('0xe')]){_0x1ba353[_0x3bd6b9[_0x9368('0xe')]]=_0x3bd6b9[_0x9368('0xf')][_0x9368('0x10')]();}else if(_0x3bd6b9[_0x9368('0xd')]===_0x9368('0x11')&&_0x3bd6b9['variableName']&&_0x3bd6b9[_0x9368('0xe')]&&_0x1c4a6b[_0x3bd6b9[_0x9368('0x12')]]){_0x1ba353[_0x3bd6b9[_0x9368('0xe')]]=_0x1c4a6b[_0x3bd6b9[_0x9368('0x12')]][_0x9368('0x10')]();}else if(_0x3bd6b9[_0x9368('0xd')]===_0x9368('0x13')&&_0x3bd6b9['Variable']&&_0x3bd6b9[_0x9368('0x14')]['name']&&_0x3bd6b9[_0x9368('0xe')]&&_0x1c4a6b[_0x3bd6b9['Variable'][_0x9368('0x15')][_0x9368('0x16')]()]){_0x1ba353[_0x3bd6b9[_0x9368('0xe')]]=_0x1c4a6b[_0x3bd6b9[_0x9368('0x14')][_0x9368('0x15')][_0x9368('0x16')]()][_0x9368('0x10')]();}});}return _0x1ba353;}function createTicket(_0x306eef,_0x30b7da,_0x157f73,_0x6d8a40,_0x45c091,_0x358497,_0x3cbf1c){logger[_0x9368('0x17')]('Creating\x20new\x20ticket...');var _0x28d681=_[_0x9368('0x18')]({'parent_id':'','assigned_user_id':_0x30b7da['id'],'ticketpriorities':_0x9368('0x19'),'ticketstatus':'Open','ticket_title':intUtil[_0x9368('0x1a')](_0x6d8a40[_0x9368('0x1b')],_0x45c091,'\x20'),'description':intUtil[_0x9368('0x1a')](_0x6d8a40['Descriptions'],_0x45c091,'\x0a'),'contact_id':_0x157f73['id']},getCustomFields(_0x358497,_0x45c091));var _0x2b2179={'method':_0x9368('0x1c'),'uri':util['format'](_0x9368('0x1d'),_0x306eef[_0x9368('0x1e')]),'form':{'operation':'create','username':_0x306eef[_0x9368('0x1f')],'sessionName':_0x3cbf1c[_0x9368('0x20')],'elementType':_0x9368('0x21'),'element':JSON['stringify'](_0x28d681)},'json':!![]};return request(_0x2b2179)[_0x9368('0x22')](function(_0xc08964){if(_0xc08964[_0x9368('0x23')]){return BPromise[_0x9368('0x24')]({'id':_0xc08964['result']['id']});}else{throw new Error(util['format'](_0x9368('0x25'),JSON['stringify'](_0xc08964[_0x9368('0x26')])));}})['catch'](function(_0x267861){var _0x3054a2=_0x267861[_0x9368('0x27')]||0x1f4;logger['error'](_0x9368('0x28'),_0x9368('0x29'),_0x3054a2,JSON[_0x9368('0x2a')](_0x267861));});}function getUser(_0x399b7e,_0x2bc82a,_0x339198){if(intUtil[_0x9368('0x2b')](_0x2bc82a)){logger[_0x9368('0x17')](_0x9368('0x2c'),_0x2bc82a);return request({'method':_0x9368('0x2d'),'uri':util['format'](_0x9368('0x1d'),_0x399b7e[_0x9368('0x1e')]),'qs':{'operation':_0x9368('0x2e'),'username':_0x399b7e['username'],'sessionName':_0x339198[_0x9368('0x20')],'query':util['format'](_0x9368('0x2f'),_0x2bc82a)},'json':!![]})[_0x9368('0x22')](function(_0x3aeee3){if(_0x3aeee3['success']&&_0x3aeee3['result'][_0x9368('0xc')]){logger[_0x9368('0x17')](_0x9368('0x30'));return BPromise[_0x9368('0x24')]({'id':_0x3aeee3[_0x9368('0x31')][0x0]['id'],'email':_0x3aeee3[_0x9368('0x31')][0x0][_0x9368('0x32')],'name':_0x3aeee3[_0x9368('0x31')][0x0][_0x9368('0x33')]+'\x20'+_0x3aeee3[_0x9368('0x31')]['last_name']});}else{logger[_0x9368('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9368('0x24')]({'id':_0x339198['userId'],'email':_0x399b7e[_0x9368('0x1f')],'name':'admin'});}})[_0x9368('0x34')](function(_0xc52119){var _0x402b78=_0xc52119[_0x9368('0x27')]||0x1f4;logger[_0x9368('0x26')](_0x9368('0x28'),_0x9368('0x35'),_0x402b78,JSON[_0x9368('0x2a')](_0xc52119));});}else{logger[_0x9368('0x17')](_0x9368('0x36'));return BPromise['resolve']({'id':_0x339198[_0x9368('0x37')],'email':_0x399b7e[_0x9368('0x1f')],'name':_0x9368('0x38')})[_0x9368('0x34')](function(_0x257090){var _0x3578d0=_0x257090[_0x9368('0x27')]||0x1f4;logger[_0x9368('0x26')](_0x9368('0x28'),_0x9368('0x35'),_0x3578d0,JSON[_0x9368('0x2a')](_0x257090));});}}function getEndUser(_0x5b218a,_0x4a2744,_0x496990,_0x3169cb){logger[_0x9368('0x17')](_0x9368('0x39'),_0x496990);return request({'method':_0x9368('0x2d'),'uri':util['format'](_0x9368('0x1d'),_0x5b218a[_0x9368('0x1e')]),'qs':{'operation':_0x9368('0x2e'),'username':_0x5b218a[_0x9368('0x1f')],'sessionName':_0x3169cb[_0x9368('0x20')],'query':util[_0x9368('0x3a')]('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;',_0x496990,_0x496990,_0x496990,_0x496990,_0x496990)},'json':!![]})[_0x9368('0x22')](function(_0x2ced4b){if(_0x2ced4b[_0x9368('0x23')]&&_0x2ced4b[_0x9368('0x31')][_0x9368('0xc')]){logger['info'](_0x9368('0x3b'));return BPromise['resolve']({'id':_0x2ced4b[_0x9368('0x31')][0x0]['id'],'name':_0x2ced4b['result'][0x0][_0x9368('0x3c')]+'\x20'+_0x2ced4b[_0x9368('0x31')][0x0][_0x9368('0x3d')],'phone':_0x496990});}else{logger['info'](_0x9368('0x3e'));return request({'method':_0x9368('0x1c'),'uri':util[_0x9368('0x3a')]('%s/webservice.php',_0x5b218a[_0x9368('0x1e')]),'form':{'operation':_0x9368('0x3f'),'sessionName':_0x3169cb[_0x9368('0x20')],'elementType':_0x9368('0x40'),'element':JSON[_0x9368('0x2a')]({'lastname':_0x4a2744,'phone':_0x496990,'assigned_user_id':'\x20'})},'json':!![]})[_0x9368('0x22')](function(_0x987dfa){logger[_0x9368('0x17')]('Enduser\x20created.');return BPromise[_0x9368('0x24')]({'id':_0x987dfa[_0x9368('0x31')]['id'],'name':_0x987dfa[_0x9368('0x31')]['lastname'],'phone':_0x987dfa[_0x9368('0x31')][_0x9368('0x41')]});})['catch'](function(_0x4520ed){var _0x329e3d=_0x4520ed['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x9368('0x42'),_0x329e3d,JSON[_0x9368('0x2a')](_0x4520ed));});}});}function getConnection(_0x15aedd){var _0x553db8=_0x15aedd[_0x9368('0x1f')];var _0x2eda61=_0x15aedd[_0x9368('0x43')];return request({'method':_0x9368('0x2d'),'uri':util[_0x9368('0x3a')](_0x9368('0x1d'),_0x15aedd[_0x9368('0x1e')]),'qs':{'operation':'getchallenge','username':_0x553db8},'json':!![]})[_0x9368('0x22')](function(_0x3e25fb){if(_0x3e25fb[_0x9368('0x23')]){return request({'method':_0x9368('0x1c'),'uri':util[_0x9368('0x3a')](_0x9368('0x1d'),_0x15aedd[_0x9368('0x1e')]),'form':{'operation':'login','username':_0x553db8,'accessKey':md5(_0x3e25fb[_0x9368('0x31')][_0x9368('0x44')]+_0x2eda61)},'json':!![]});}})[_0x9368('0x22')](function(_0x2aba21){if(_0x2aba21[_0x9368('0x23')]){return BPromise['resolve'](_0x2aba21[_0x9368('0x31')]);}else{throw new Error(util[_0x9368('0x3a')](_0x9368('0x45'),_0x15aedd['id']));}})[_0x9368('0x34')](function(_0x5716b8){var _0x39de52=_0x5716b8[_0x9368('0x27')]||0x1f4;logger[_0x9368('0x26')](_0x9368('0x28'),_0x9368('0x46'),_0x39de52,JSON[_0x9368('0x2a')](_0x5716b8));});}function request(_0x2d4519){logger['info']('[HTTP]',JSON[_0x9368('0x2a')](_0x2d4519));return rp(_0x2d4519);}exports[_0x9368('0x47')]=function(_0xe17ce,_0x4c7cca,_0x285247,_0x26b4e7,_0x1acbbd,_0xbf0de1){var _0x524cdc,_0x2fbe78,_0x2834e3,_0x1a9803;_0xbf0de1[_0x9368('0x1e')]=intUtil[_0x9368('0x48')](_0xbf0de1[_0x9368('0x1e')]);if(_0x1acbbd&&_0x1acbbd[_0x9368('0x49')]){logger['info']('[QUEUE]',_0x9368('0x4a'));_0x4c7cca['recordingURL']=util[_0x9368('0x3a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xbf0de1[_0x9368('0x4b')],_0x4c7cca[_0x9368('0x4c')],md5(_0x4c7cca[_0x9368('0x4c')]));}else{_0x4c7cca['recordingURL']='';}return getConnection(_0xbf0de1)[_0x9368('0x22')](function(_0x249c11){_0x1a9803=_0x249c11;return getUser(_0xbf0de1,_0x26b4e7[_0x9368('0x4d')],_0x1a9803);})[_0x9368('0x22')](function(_0x4152c5){_0x524cdc=_0x4152c5;logger[_0x9368('0x17')](_0x9368('0x4e'),_0x524cdc['id']);return getEndUser(_0xbf0de1,_0x4c7cca['calleridname'],_0x4c7cca[_0x9368('0x4f')],_0x1a9803);})[_0x9368('0x22')](function(_0x3e81d0){_0x2fbe78=_0x3e81d0;logger[_0x9368('0x17')](_0x9368('0x50'),_0x2fbe78['id']);return createTicket(_0xbf0de1,_0x524cdc,_0x2fbe78,_0x285247,_0x4c7cca,_0x285247[_0x9368('0x51')],_0x1a9803);})[_0x9368('0x22')](function(_0xf95f32){_0x2834e3=_0xf95f32;logger[_0x9368('0x17')](_0x9368('0x52'));logger[_0x9368('0x17')](_0x9368('0x53'),_0x2834e3['id']);var _0x1e7e35=util[_0x9368('0x3a')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xbf0de1[_0x9368('0x1e')],_['split'](_0x2834e3['id'],'x')[0x1]);logger[_0x9368('0x17')](_0x9368('0x54'),_0x9368('0x55'));emit(util[_0x9368('0x3a')](_0x9368('0x56'),_0x26b4e7[_0x9368('0x15')]),_0x9368('0x57'),{'uri':_0x1e7e35});})[_0x9368('0x34')](function(_0x3ae4fb){logger['error'](_0x9368('0x54'),JSON[_0x9368('0x2a')](_0x3ae4fb));});};exports[_0x9368('0x58')]=function(_0x1a0b54,_0x399bca,_0x329803,_0x486887,_0x306c0b,_0x554a58,_0x4abd1e){var _0xf7772d,_0x2e812f,_0x177a22,_0x349376;_0x554a58[_0x9368('0x1e')]=intUtil[_0x9368('0x48')](_0x554a58['remoteUri']);_0x554a58['serverUrl']=intUtil[_0x9368('0x48')](_0x554a58[_0x9368('0x4b')]);if(_0x4abd1e&&_0x4abd1e[_0x9368('0x59')]&&_0x4abd1e['recordingFormat']!==_0x9368('0x5a')){logger['info'](_0x9368('0x5b'),_0x9368('0x4a'));_0x399bca[_0x9368('0x5c')]=util[_0x9368('0x3a')](_0x9368('0x5d'),_0x554a58[_0x9368('0x4b')],_0x399bca[_0x9368('0x4c')],md5(_0x399bca[_0x9368('0x4c')]));}return getConnection(_0x554a58)['then'](function(_0x47eb5a){_0x349376=_0x47eb5a;return getUser(_0x554a58,_0x486887[_0x9368('0x4d')],_0x349376);})['then'](function(_0x19bd6f){_0xf7772d=_0x19bd6f;logger[_0x9368('0x17')](_0x9368('0x4e'),_0xf7772d['id']);return getEndUser(_0x554a58,_0x399bca[_0x9368('0x5e')],_0x399bca[_0x9368('0x5f')],_0x349376);})[_0x9368('0x22')](function(_0x3fcbc8){_0x2e812f=_0x3fcbc8;logger[_0x9368('0x17')](_0x9368('0x50'),_0x2e812f['id']);return createTicket(_0x554a58,_0xf7772d,_0x2e812f,_0x329803,_0x399bca,_0x329803['Fields'],_0x349376);})[_0x9368('0x22')](function(_0x2741db){_0x177a22=_0x2741db;logger[_0x9368('0x17')]('Ticket\x20created!');logger[_0x9368('0x17')]('The\x20Ticket\x20ID\x20is:',_0x177a22['id']);var _0x537a47=util[_0x9368('0x3a')](_0x9368('0x60'),_0x554a58[_0x9368('0x1e')],_['split'](_0x177a22['id'],'x')[0x1]);logger['info'](_0x9368('0x5b'),_0x9368('0x55'));emit(util[_0x9368('0x3a')](_0x9368('0x56'),_0x486887[_0x9368('0x15')]),_0x9368('0x57'),{'uri':_0x537a47});})[_0x9368('0x34')](function(_0x34fa39){logger[_0x9368('0x26')](_0x9368('0x5b'),JSON[_0x9368('0x2a')](_0x34fa39));});};exports[_0x9368('0x61')]=function(_0x3d8b5e,_0x19c8f6,_0x360a46,_0x4eda70,_0x31def6,_0x230d35){var _0x1c0eaa,_0x5f245c,_0x360599,_0x37ca4b;_0x230d35[_0x9368('0x1e')]=intUtil[_0x9368('0x48')](_0x230d35[_0x9368('0x1e')]);_0x230d35['serverUrl']=intUtil[_0x9368('0x48')](_0x230d35[_0x9368('0x4b')]);if(_0x31def6&&_0x31def6['monitor_format']){logger['info']('['+_0x19c8f6['lastevent']['toUpperCase']()+']',_0x9368('0x4a'));_0x19c8f6[_0x9368('0x5c')]=util[_0x9368('0x3a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x230d35['serverUrl'],_0x19c8f6['uniqueid'],md5(_0x19c8f6['uniqueid']));}else{_0x19c8f6[_0x9368('0x5c')]='';}return getConnection(_0x230d35)[_0x9368('0x22')](function(_0x2bd4c7){_0x37ca4b=_0x2bd4c7;return getUser(_0x230d35,'',_0x37ca4b);})[_0x9368('0x22')](function(_0x1f3c18){_0x1c0eaa=_0x1f3c18;logger[_0x9368('0x17')](_0x9368('0x4e'),_0x1c0eaa['id']);return getEndUser(_0x230d35,_0x19c8f6[_0x9368('0x62')],_0x19c8f6[_0x9368('0x4f')],_0x37ca4b);})[_0x9368('0x22')](function(_0x27e94e){_0x5f245c=_0x27e94e;logger[_0x9368('0x17')](_0x9368('0x50'),_0x5f245c['id']);return createTicket(_0x230d35,_0x1c0eaa,_0x5f245c,_0x360a46,_0x19c8f6,_0x360a46[_0x9368('0x51')],_0x37ca4b);})[_0x9368('0x22')](function(_0x302e25){_0x360599=_0x302e25;logger[_0x9368('0x17')](_0x9368('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x360599['id']);})[_0x9368('0x34')](function(_0x2cbb0e){logger[_0x9368('0x26')]('['+_0x19c8f6[_0x9368('0x63')]['toUpperCase']()+']',JSON[_0x9368('0x2a')](_0x2cbb0e));});}; \ No newline at end of file +var _0x16db=['statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','catch','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','content','toString','variable','idField','variableName','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','Descriptions','POST','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x16db,0xa7));var _0xb16d=function(_0x5887c8,_0x4b2ac9){_0x5887c8=_0x5887c8-0x0;var _0x2f9bef=_0x16db[_0x5887c8];return _0x2f9bef;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xb16d('0x0'));var md5=require(_0xb16d('0x1'));var util=require(_0xb16d('0x2'));var Redis=require(_0xb16d('0x3'));var intUtil=require(_0xb16d('0x4'));var config=require(_0xb16d('0x5'));var logger=require(_0xb16d('0x6'))(_0xb16d('0x7'));config[_0xb16d('0x8')]=_[_0xb16d('0x9')](config[_0xb16d('0x8')],{'host':_0xb16d('0xa'),'port':0x18eb});var io=require(_0xb16d('0xb'))(new Redis(config['redis']));function emit(_0x36a94d,_0x4f4ead,_0x2ac0c3){io['to'](_0x36a94d)[_0xb16d('0xc')](_0x4f4ead,_0x2ac0c3);}function getCustomFields(_0x3f7b92,_0x1fb402){var _0x40bc56={};if(_0x3f7b92[_0xb16d('0xd')]>0x0){_[_0xb16d('0xe')](_0x3f7b92,function(_0xbcb30a){if(_0xbcb30a[_0xb16d('0xf')]==='string'&&_0xbcb30a['idField']){_0x40bc56[_0xbcb30a['idField']]=_0xbcb30a[_0xb16d('0x10')][_0xb16d('0x11')]();}else if(_0xbcb30a['type']===_0xb16d('0x12')&&_0xbcb30a['variableName']&&_0xbcb30a[_0xb16d('0x13')]&&_0x1fb402[_0xbcb30a[_0xb16d('0x14')]]){_0x40bc56[_0xbcb30a[_0xb16d('0x13')]]=_0x1fb402[_0xbcb30a[_0xb16d('0x14')]][_0xb16d('0x11')]();}else if(_0xbcb30a[_0xb16d('0xf')]==='customVariable'&&_0xbcb30a['Variable']&&_0xbcb30a['Variable'][_0xb16d('0x15')]&&_0xbcb30a['idField']&&_0x1fb402[_0xbcb30a[_0xb16d('0x16')]['name'][_0xb16d('0x17')]()]){_0x40bc56[_0xbcb30a[_0xb16d('0x13')]]=_0x1fb402[_0xbcb30a[_0xb16d('0x16')][_0xb16d('0x15')]['toLowerCase']()][_0xb16d('0x11')]();}});}return _0x40bc56;}function createTicket(_0xc8acbd,_0x18b357,_0x210448,_0x443b4f,_0x373b40,_0x71bed9,_0xd2bc0d){logger[_0xb16d('0x18')](_0xb16d('0x19'));var _0x470011=_[_0xb16d('0x1a')]({'parent_id':'','assigned_user_id':_0x18b357['id'],'ticketpriorities':_0xb16d('0x1b'),'ticketstatus':'Open','ticket_title':intUtil[_0xb16d('0x1c')](_0x443b4f[_0xb16d('0x1d')],_0x373b40,'\x20'),'description':intUtil['getString'](_0x443b4f[_0xb16d('0x1e')],_0x373b40,'\x0a'),'contact_id':_0x210448['id']},getCustomFields(_0x71bed9,_0x373b40));var _0x23354e={'method':_0xb16d('0x1f'),'uri':util['format'](_0xb16d('0x20'),_0xc8acbd['remoteUri']),'form':{'operation':_0xb16d('0x21'),'username':_0xc8acbd[_0xb16d('0x22')],'sessionName':_0xd2bc0d[_0xb16d('0x23')],'elementType':_0xb16d('0x24'),'element':JSON[_0xb16d('0x25')](_0x470011)},'json':!![]};return request(_0x23354e)[_0xb16d('0x26')](function(_0x4f46d3){if(_0x4f46d3[_0xb16d('0x27')]){return BPromise[_0xb16d('0x28')]({'id':_0x4f46d3[_0xb16d('0x29')]['id']});}else{throw new Error(util[_0xb16d('0x2a')](_0xb16d('0x2b'),JSON[_0xb16d('0x25')](_0x4f46d3[_0xb16d('0x2c')])));}})['catch'](function(_0xdc8119){var _0xb1a0ad=_0xdc8119[_0xb16d('0x2d')]||0x1f4;logger[_0xb16d('0x2c')](_0xb16d('0x2e'),_0xb16d('0x2f'),_0xb1a0ad,JSON[_0xb16d('0x25')](_0xdc8119));});}function getUser(_0x2278e8,_0x1dfe0a,_0x44d9bf){if(intUtil['validateEmail'](_0x1dfe0a)){logger[_0xb16d('0x18')](_0xb16d('0x30'),_0x1dfe0a);return request({'method':_0xb16d('0x31'),'uri':util[_0xb16d('0x2a')](_0xb16d('0x20'),_0x2278e8[_0xb16d('0x32')]),'qs':{'operation':_0xb16d('0x33'),'username':_0x2278e8[_0xb16d('0x22')],'sessionName':_0x44d9bf['sessionName'],'query':util[_0xb16d('0x2a')](_0xb16d('0x34'),_0x1dfe0a)},'json':!![]})[_0xb16d('0x26')](function(_0x486546){if(_0x486546[_0xb16d('0x27')]&&_0x486546['result'][_0xb16d('0xd')]){logger[_0xb16d('0x18')](_0xb16d('0x35'));return BPromise[_0xb16d('0x28')]({'id':_0x486546[_0xb16d('0x29')][0x0]['id'],'email':_0x486546[_0xb16d('0x29')][0x0]['email1'],'name':_0x486546[_0xb16d('0x29')][0x0]['first_name']+'\x20'+_0x486546[_0xb16d('0x29')][_0xb16d('0x36')]});}else{logger['info'](_0xb16d('0x37'));return BPromise['resolve']({'id':_0x44d9bf[_0xb16d('0x38')],'email':_0x2278e8[_0xb16d('0x22')],'name':_0xb16d('0x39')});}})['catch'](function(_0x16782d){var _0x26ad4c=_0x16782d['statusCode']||0x1f4;logger[_0xb16d('0x2c')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xb16d('0x3a'),_0x26ad4c,JSON['stringify'](_0x16782d));});}else{logger[_0xb16d('0x18')](_0xb16d('0x37'));return BPromise['resolve']({'id':_0x44d9bf['userId'],'email':_0x2278e8[_0xb16d('0x22')],'name':_0xb16d('0x39')})[_0xb16d('0x3b')](function(_0xa63d11){var _0x4deb46=_0xa63d11[_0xb16d('0x2d')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x4deb46,JSON[_0xb16d('0x25')](_0xa63d11));});}}function getEndUser(_0x52e02f,_0x15acce,_0x19bc05,_0x333c71){logger[_0xb16d('0x18')]('Searching\x20end\x20user\x20with\x20phone',_0x19bc05);return request({'method':'GET','uri':util[_0xb16d('0x2a')](_0xb16d('0x20'),_0x52e02f[_0xb16d('0x32')]),'qs':{'operation':'query','username':_0x52e02f[_0xb16d('0x22')],'sessionName':_0x333c71[_0xb16d('0x23')],'query':util['format'](_0xb16d('0x3c'),_0x19bc05,_0x19bc05,_0x19bc05,_0x19bc05,_0x19bc05)},'json':!![]})['then'](function(_0x364b33){if(_0x364b33[_0xb16d('0x27')]&&_0x364b33['result']['length']){logger[_0xb16d('0x18')](_0xb16d('0x3d'));return BPromise[_0xb16d('0x28')]({'id':_0x364b33['result'][0x0]['id'],'name':_0x364b33[_0xb16d('0x29')][0x0][_0xb16d('0x3e')]+'\x20'+_0x364b33[_0xb16d('0x29')][0x0][_0xb16d('0x3f')],'phone':_0x19bc05});}else{logger[_0xb16d('0x18')](_0xb16d('0x40'));return request({'method':_0xb16d('0x1f'),'uri':util['format'](_0xb16d('0x20'),_0x52e02f[_0xb16d('0x32')]),'form':{'operation':'create','sessionName':_0x333c71[_0xb16d('0x23')],'elementType':_0xb16d('0x41'),'element':JSON[_0xb16d('0x25')]({'lastname':_0x15acce,'phone':_0x19bc05,'assigned_user_id':'\x20'})},'json':!![]})[_0xb16d('0x26')](function(_0x339742){logger['info'](_0xb16d('0x42'));return BPromise[_0xb16d('0x28')]({'id':_0x339742[_0xb16d('0x29')]['id'],'name':_0x339742[_0xb16d('0x29')][_0xb16d('0x3f')],'phone':_0x339742[_0xb16d('0x29')][_0xb16d('0x43')]});})[_0xb16d('0x3b')](function(_0x13d3ec){var _0xec0e12=_0x13d3ec[_0xb16d('0x2d')]||0x1f4;logger[_0xb16d('0x2c')](_0xb16d('0x2e'),_0xb16d('0x44'),_0xec0e12,JSON[_0xb16d('0x25')](_0x13d3ec));});}});}function getConnection(_0x158ce4){var _0x15f327=_0x158ce4[_0xb16d('0x22')];var _0x536fef=_0x158ce4[_0xb16d('0x45')];return request({'method':_0xb16d('0x31'),'uri':util[_0xb16d('0x2a')](_0xb16d('0x20'),_0x158ce4[_0xb16d('0x32')]),'qs':{'operation':_0xb16d('0x46'),'username':_0x15f327},'json':!![]})[_0xb16d('0x26')](function(_0x760187){if(_0x760187[_0xb16d('0x27')]){return request({'method':_0xb16d('0x1f'),'uri':util['format']('%s/webservice.php',_0x158ce4[_0xb16d('0x32')]),'form':{'operation':_0xb16d('0x47'),'username':_0x15f327,'accessKey':md5(_0x760187[_0xb16d('0x29')][_0xb16d('0x48')]+_0x536fef)},'json':!![]});}})[_0xb16d('0x26')](function(_0x1418a1){if(_0x1418a1[_0xb16d('0x27')]){return BPromise[_0xb16d('0x28')](_0x1418a1[_0xb16d('0x29')]);}else{throw new Error(util[_0xb16d('0x2a')](_0xb16d('0x49'),_0x158ce4['id']));}})['catch'](function(_0x5e357c){var _0x5ea673=_0x5e357c[_0xb16d('0x2d')]||0x1f4;logger['error'](_0xb16d('0x2e'),_0xb16d('0x4a'),_0x5ea673,JSON[_0xb16d('0x25')](_0x5e357c));});}function request(_0x2feaea){logger[_0xb16d('0x18')](_0xb16d('0x4b'),JSON[_0xb16d('0x25')](_0x2feaea));return rp(_0x2feaea);}exports['queue']=function(_0x6b0dc7,_0x5d6148,_0x4f94f5,_0x2b353a,_0x3eb54c,_0x396488){var _0x4aeaff,_0x373218,_0x31b7a4,_0x3793e2;_0x396488[_0xb16d('0x32')]=intUtil['stripTrailingSlash'](_0x396488['remoteUri']);if(_0x3eb54c&&_0x3eb54c[_0xb16d('0x4c')]){logger[_0xb16d('0x18')](_0xb16d('0x4d'),_0xb16d('0x4e'));_0x5d6148['recordingURL']=util[_0xb16d('0x2a')](_0xb16d('0x4f'),_0x396488['serverUrl'],_0x5d6148[_0xb16d('0x50')],md5(_0x5d6148[_0xb16d('0x50')]));}else{_0x5d6148[_0xb16d('0x51')]='';}return getConnection(_0x396488)[_0xb16d('0x26')](function(_0x1124d1){_0x3793e2=_0x1124d1;return getUser(_0x396488,_0x2b353a[_0xb16d('0x52')],_0x3793e2);})[_0xb16d('0x26')](function(_0x3f69e0){_0x4aeaff=_0x3f69e0;logger[_0xb16d('0x18')](_0xb16d('0x53'),_0x4aeaff['id']);return getEndUser(_0x396488,_0x5d6148['calleridname'],_0x5d6148[_0xb16d('0x54')],_0x3793e2);})['then'](function(_0x28e7f3){_0x373218=_0x28e7f3;logger[_0xb16d('0x18')](_0xb16d('0x55'),_0x373218['id']);return createTicket(_0x396488,_0x4aeaff,_0x373218,_0x4f94f5,_0x5d6148,_0x4f94f5[_0xb16d('0x56')],_0x3793e2);})[_0xb16d('0x26')](function(_0x4ef0bf){_0x31b7a4=_0x4ef0bf;logger[_0xb16d('0x18')](_0xb16d('0x57'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x31b7a4['id']);var _0x4419f3=util[_0xb16d('0x2a')](_0xb16d('0x58'),_0x396488['remoteUri'],_[_0xb16d('0x59')](_0x31b7a4['id'],'x')[0x1]);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb16d('0x2a')](_0xb16d('0x5a'),_0x2b353a['name']),_0xb16d('0x5b'),{'uri':_0x4419f3});})['catch'](function(_0x459d1a){logger[_0xb16d('0x2c')](_0xb16d('0x4d'),JSON['stringify'](_0x459d1a));});};exports[_0xb16d('0x5c')]=function(_0x1053b8,_0x173f88,_0x172ae1,_0x2a5571,_0x19b966,_0x3eb4d1,_0x36cdcc){var _0x12379c,_0x4031d3,_0x5c6edd,_0x4ed9d4;_0x3eb4d1[_0xb16d('0x32')]=intUtil[_0xb16d('0x5d')](_0x3eb4d1[_0xb16d('0x32')]);_0x3eb4d1[_0xb16d('0x5e')]=intUtil[_0xb16d('0x5d')](_0x3eb4d1['serverUrl']);if(_0x36cdcc&&_0x36cdcc['recordingFormat']&&_0x36cdcc[_0xb16d('0x5f')]!==_0xb16d('0x60')){logger[_0xb16d('0x18')](_0xb16d('0x61'),_0xb16d('0x4e'));_0x173f88[_0xb16d('0x51')]=util[_0xb16d('0x2a')](_0xb16d('0x4f'),_0x3eb4d1['serverUrl'],_0x173f88[_0xb16d('0x50')],md5(_0x173f88[_0xb16d('0x50')]));}return getConnection(_0x3eb4d1)[_0xb16d('0x26')](function(_0xd7f204){_0x4ed9d4=_0xd7f204;return getUser(_0x3eb4d1,_0x2a5571[_0xb16d('0x52')],_0x4ed9d4);})['then'](function(_0x4278a9){_0x12379c=_0x4278a9;logger[_0xb16d('0x18')]('The\x20User\x20ID\x20is:',_0x12379c['id']);return getEndUser(_0x3eb4d1,_0x173f88[_0xb16d('0x62')],_0x173f88[_0xb16d('0x63')],_0x4ed9d4);})[_0xb16d('0x26')](function(_0x2441cd){_0x4031d3=_0x2441cd;logger[_0xb16d('0x18')](_0xb16d('0x55'),_0x4031d3['id']);return createTicket(_0x3eb4d1,_0x12379c,_0x4031d3,_0x172ae1,_0x173f88,_0x172ae1['Fields'],_0x4ed9d4);})[_0xb16d('0x26')](function(_0x523304){_0x5c6edd=_0x523304;logger[_0xb16d('0x18')](_0xb16d('0x57'));logger[_0xb16d('0x18')](_0xb16d('0x64'),_0x5c6edd['id']);var _0x34b2c8=util[_0xb16d('0x2a')](_0xb16d('0x58'),_0x3eb4d1[_0xb16d('0x32')],_['split'](_0x5c6edd['id'],'x')[0x1]);logger[_0xb16d('0x18')](_0xb16d('0x61'),_0xb16d('0x65'));emit(util[_0xb16d('0x2a')](_0xb16d('0x5a'),_0x2a5571[_0xb16d('0x15')]),_0xb16d('0x5b'),{'uri':_0x34b2c8});})['catch'](function(_0x547301){logger['error'](_0xb16d('0x61'),JSON[_0xb16d('0x25')](_0x547301));});};exports[_0xb16d('0x66')]=function(_0x4ad3d4,_0x12de1f,_0x608c36,_0x3ed621,_0x386e7c,_0x57d1e8){var _0x1c1316,_0x3d0ac8,_0x40a0cb,_0x22e223;_0x57d1e8[_0xb16d('0x32')]=intUtil['stripTrailingSlash'](_0x57d1e8[_0xb16d('0x32')]);_0x57d1e8['serverUrl']=intUtil[_0xb16d('0x5d')](_0x57d1e8['serverUrl']);if(_0x386e7c&&_0x386e7c['monitor_format']){logger[_0xb16d('0x18')]('['+_0x12de1f['lastevent'][_0xb16d('0x67')]()+']',_0xb16d('0x4e'));_0x12de1f['recordingURL']=util[_0xb16d('0x2a')](_0xb16d('0x4f'),_0x57d1e8[_0xb16d('0x5e')],_0x12de1f[_0xb16d('0x50')],md5(_0x12de1f['uniqueid']));}else{_0x12de1f[_0xb16d('0x51')]='';}return getConnection(_0x57d1e8)[_0xb16d('0x26')](function(_0x52221a){_0x22e223=_0x52221a;return getUser(_0x57d1e8,'',_0x22e223);})[_0xb16d('0x26')](function(_0x301a7a){_0x1c1316=_0x301a7a;logger[_0xb16d('0x18')]('The\x20User\x20ID\x20is:',_0x1c1316['id']);return getEndUser(_0x57d1e8,_0x12de1f[_0xb16d('0x68')],_0x12de1f['calleridnum'],_0x22e223);})[_0xb16d('0x26')](function(_0x589a78){_0x3d0ac8=_0x589a78;logger[_0xb16d('0x18')](_0xb16d('0x55'),_0x3d0ac8['id']);return createTicket(_0x57d1e8,_0x1c1316,_0x3d0ac8,_0x608c36,_0x12de1f,_0x608c36[_0xb16d('0x56')],_0x22e223);})[_0xb16d('0x26')](function(_0x44d44e){_0x40a0cb=_0x44d44e;logger['info'](_0xb16d('0x57'));logger[_0xb16d('0x18')](_0xb16d('0x64'),_0x40a0cb['id']);})[_0xb16d('0x3b')](function(_0xb42ef1){logger[_0xb16d('0x2c')]('['+_0x12de1f[_0xb16d('0x69')][_0xb16d('0x67')]()+']',JSON[_0xb16d('0x25')](_0xb42ef1));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 1ef1dca..9dfa900 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 _0x0506=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','%s:%s','password','authType','token','username','toString','base64','[HTTP]','defaults','forEach','type','string','nameField','toLowerCase','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','results','agent'];(function(_0x19dc2d,_0x2b4a8b){var _0x145a78=function(_0x3385db){while(--_0x3385db){_0x19dc2d['push'](_0x19dc2d['shift']());}};_0x145a78(++_0x2b4a8b);}(_0x0506,0x1d1));var _0x6050=function(_0x13cb4f,_0x55405f){_0x13cb4f=_0x13cb4f-0x0;var _0x55bac8=_0x0506[_0x13cb4f];return _0x55bac8;};'use strict';var _=require(_0x6050('0x0'));var rp=require(_0x6050('0x1'));var md5=require(_0x6050('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x6050('0x3'))('zendesk');config[_0x6050('0x4')]=_['defaults'](config['redis'],{'host':_0x6050('0x5'),'port':0x18eb});var io=require(_0x6050('0x6'))(new Redis(config[_0x6050('0x4')]));function emit(_0x1a89fb,_0x3512ba,_0xf64de5){io['to'](_0x1a89fb)[_0x6050('0x7')](_0x3512ba,_0xf64de5);}var headers={'Content-Type':_0x6050('0x8'),'Accept':'application/json'};function getTicket(_0x312217,_0x4f149a,_0x15ad99,_0x1b0140,_0xd01ae7){logger[_0x6050('0x9')](_0x6050('0xa'));return request({'uri':util[_0x6050('0xb')](_0x6050('0xc'),_0x312217[_0x6050('0xd')]),'method':_0x6050('0xe'),'body':{'ticket':_[_0x6050('0xf')]({'requester_id':_0x15ad99['id'],'submitter_id':_0x4f149a?_0x4f149a['id']:undefined,'assignee_id':_0x4f149a?_0x4f149a['id']:undefined,'tags':getTags(_0x1b0140['Tags'],_0x6050('0x10')),'subject':intUtil['getString'](_0x1b0140[_0x6050('0x11')],_0xd01ae7,'\x20'),'description':intUtil[_0x6050('0x12')](_0x1b0140[_0x6050('0x13')],_0xd01ae7,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6050('0x12')](_0x1b0140['Descriptions'],_0xd01ae7,'\x0a')}},getCustomFields(_0x1b0140[_0x6050('0x14')],_0xd01ae7))}})['then'](function(_0x377b42){logger[_0x6050('0x9')](_0x6050('0x15'));return _0x377b42[_0x6050('0x16')];});}function getUser(_0x4e33d1,_0x25976e){if(intUtil[_0x6050('0x17')](_0x25976e)){logger[_0x6050('0x9')](_0x6050('0x18'),_0x25976e);return request({'uri':util[_0x6050('0xb')](_0x6050('0x19'),_0x4e33d1[_0x6050('0xd')]),'qs':{'query':util['format'](_0x6050('0x1a'),_0x25976e)}})[_0x6050('0x1b')](function(_0x44e65d){if(_0x44e65d['count']){logger['info']('Agent\x20found!');return _['find'](_0x44e65d[_0x6050('0x1c')],{'email':_0x25976e,'role':_0x6050('0x1d')});}else{logger['info'](_0x6050('0x1e'));return request({'uri':util[_0x6050('0xb')](_0x6050('0x1f'),_0x4e33d1[_0x6050('0xd')])})[_0x6050('0x1b')](function(_0x295b97){logger['info'](_0x6050('0x20'));return _0x295b97[_0x6050('0x21')];});}});}else{logger[_0x6050('0x9')](_0x6050('0x1e'));return request({'uri':util[_0x6050('0xb')](_0x6050('0x1f'),_0x4e33d1[_0x6050('0xd')])})[_0x6050('0x1b')](function(_0x509c3a){logger[_0x6050('0x9')]('Admin\x20account\x20selected.');return _0x509c3a[_0x6050('0x21')];});}}function getEndUser(_0x411dc9,_0xd6c11d,_0x84d562){logger[_0x6050('0x9')](_0x6050('0x22'),_0x84d562);return request({'uri':util['format'](_0x6050('0x19'),_0x411dc9[_0x6050('0xd')]),'qs':{'query':util[_0x6050('0xb')](_0x6050('0x23'),_0x84d562)}})['then'](function(_0x1527ea){var _0xaf9ebe;if(_0x1527ea[_0x6050('0x1c')][_0x6050('0x24')]){_0x1527ea[_0x6050('0x1c')]=_[_0x6050('0x25')](_0x1527ea[_0x6050('0x1c')],{'suspended':![],'role':'end-user'});if(_0x1527ea[_0x6050('0x1c')][_0x6050('0x24')]){_0xaf9ebe=_[_0x6050('0x26')](_0x1527ea[_0x6050('0x1c')]);}}if(_0xaf9ebe){logger[_0x6050('0x9')](_0x6050('0x27'));return _0xaf9ebe;}else{logger[_0x6050('0x9')](_0x6050('0x28'));return request({'uri':util[_0x6050('0xb')]('%s/users.json',_0x411dc9[_0x6050('0xd')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x6050('0xb')](_0x6050('0x29'),_0xd6c11d||_0x84d562),'phone':_0x84d562}}})[_0x6050('0x1b')](function(_0x536f51){logger[_0x6050('0x9')]('Enduser\x20created.');return _0x536f51['user'];});}});}function getAuth(_0x10ad58){var _0x130b0d;if(_0x10ad58['authType']==='password'){_0x130b0d=util[_0x6050('0xb')](_0x6050('0x2a'),_0x10ad58['username'],_0x10ad58[_0x6050('0x2b')]);}else if(_0x10ad58[_0x6050('0x2c')]===_0x6050('0x2d')){_0x130b0d=util[_0x6050('0xb')]('%s/token:%s',_0x10ad58[_0x6050('0x2e')],_0x10ad58['token']);}return util[_0x6050('0xb')]('Basic\x20%s',new Buffer(_0x130b0d)[_0x6050('0x2f')](_0x6050('0x30')));}function request(_0x162941){logger['debug'](_0x6050('0x31'),JSON['stringify'](_0x162941));return rp(_[_0x6050('0x32')](_0x162941,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x38a834,_0x56aab2){var _0xd8d8bb=[];if(_0x38a834&&_0x38a834[_0x6050('0x24')]>0x0){_0xd8d8bb=_['map'](_0x38a834,_0x56aab2);}return _0xd8d8bb;}function getCustomFields(_0x36fb0b,_0x31482f){var _0x547190=[];var _0x3d0973={'custom_fields':[]};if(_0x36fb0b[_0x6050('0x24')]>0x0){_[_0x6050('0x33')](_0x36fb0b,function(_0x481bde){if(_0x481bde[_0x6050('0x34')]===_0x6050('0x35')&&_0x481bde[_0x6050('0x36')]&&!_0x481bde['customField']){_0x3d0973[_0x481bde[_0x6050('0x36')][_0x6050('0x37')]()]=_0x481bde['content'][_0x6050('0x2f')]();}else if(_0x481bde[_0x6050('0x34')]===_0x6050('0x35')&&_0x481bde[_0x6050('0x38')]&&_0x481bde[_0x6050('0x39')]){_0x3d0973[_0x6050('0x3a')][_0x6050('0x3b')]({'id':_0x481bde[_0x6050('0x38')],'value':_0x481bde['content']['toString']()});}else if(_0x481bde[_0x6050('0x34')]===_0x6050('0x3c')&&_0x481bde['variableName']&&_0x481bde[_0x6050('0x38')]&&_0x481bde['customField']){_0x31482f[_0x481bde[_0x6050('0x3d')]]&&_0x3d0973[_0x6050('0x3a')][_0x6050('0x3b')]({'id':_0x481bde[_0x6050('0x38')],'value':_0x31482f[_0x481bde[_0x6050('0x3d')]][_0x6050('0x2f')]()});}else if(_0x481bde[_0x6050('0x34')]===_0x6050('0x3e')&&_0x481bde['Variable']&&_0x481bde['Variable']['name']&&_0x481bde[_0x6050('0x38')]&&_0x481bde[_0x6050('0x39')]){_0x31482f[_0x481bde[_0x6050('0x3f')][_0x6050('0x10')][_0x6050('0x37')]()]&&_0x3d0973[_0x6050('0x3a')][_0x6050('0x3b')]({'id':_0x481bde[_0x6050('0x38')],'value':_0x31482f[_0x481bde[_0x6050('0x3f')][_0x6050('0x10')][_0x6050('0x37')]()][_0x6050('0x2f')]()});}});}return _0x3d0973;}exports['queue']=function(_0x5ebc99,_0x2da74d,_0x377aa2,_0x13bcbe,_0x750dd8,_0x4ff116){var _0x5c0464,_0x1eae98;_0x4ff116[_0x6050('0xd')]=intUtil['stripTrailingSlash'](_0x4ff116[_0x6050('0xd')]);_0x4ff116[_0x6050('0x40')]=intUtil[_0x6050('0x41')](_0x4ff116['serverUrl']);if(_0x750dd8&&_0x750dd8['monitor_format']){logger['info']('[QUEUE]',_0x6050('0x42'));_0x2da74d[_0x6050('0x43')]=util[_0x6050('0xb')](_0x6050('0x44'),_0x4ff116[_0x6050('0x40')],_0x2da74d[_0x6050('0x45')],md5(_0x2da74d[_0x6050('0x45')]));}else{_0x2da74d[_0x6050('0x43')]='';}headers[_0x6050('0x46')]=getAuth(_0x4ff116);return getUser(_0x4ff116,_0x13bcbe['email'])[_0x6050('0x1b')](function(_0x1ea604){_0x5c0464=_0x1ea604;logger[_0x6050('0x9')](_0x6050('0x47'),_0x5c0464['id']);return getEndUser(_0x4ff116,_0x2da74d[_0x6050('0x48')],_0x2da74d[_0x6050('0x49')]);})[_0x6050('0x1b')](function(_0x13008e){_0x1eae98=_0x13008e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1eae98['id']);return getTicket(_0x4ff116,_0x5c0464,_0x1eae98,_0x377aa2,_0x2da74d);})['then'](function(_0x3754c6){if(_0x3754c6){logger[_0x6050('0x9')](_0x6050('0x4a'),_0x3754c6['id']);switch(_0x4ff116[_0x6050('0x34')]){case _0x6050('0x4b'):logger['info'](_0x6050('0x4c'),_0x6050('0x4d'));return request({'uri':util[_0x6050('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4ff116[_0x6050('0xd')],_0x5c0464['id'],_0x3754c6['id']),'method':_0x6050('0xe')});case _0x6050('0x4e'):logger[_0x6050('0x9')](_0x6050('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6050('0xb')](_0x6050('0x4f'),_0x13bcbe['name']),_0x6050('0x50'),{'uri':util[_0x6050('0xb')]('%s/agent/tickets/%s',_0x4ff116[_0x6050('0xd')],_0x3754c6['id'])});break;default:logger[_0x6050('0x51')](_0x6050('0x4c'),_0x6050('0x52'));}}})['catch'](function(_0x57972f){logger[_0x6050('0x51')](_0x6050('0x53'),util[_0x6050('0x54')](_0x57972f,{'showHidden':!![],'depth':null}));});};exports[_0x6050('0x55')]=function(_0x328424,_0x2377cb,_0x288336,_0x412f73,_0xe4df85,_0x232c9f,_0x3ba734){var _0x4661d0,_0x21774f;_0x232c9f['remoteUri']=intUtil['stripTrailingSlash'](_0x232c9f[_0x6050('0xd')]);_0x232c9f['serverUrl']=intUtil[_0x6050('0x41')](_0x232c9f['serverUrl']);if(_0x3ba734&&_0x3ba734[_0x6050('0x56')]&&_0x3ba734[_0x6050('0x56')]!=='none'){logger[_0x6050('0x9')](_0x6050('0x57'),_0x6050('0x42'));_0x2377cb[_0x6050('0x43')]=util[_0x6050('0xb')](_0x6050('0x44'),_0x232c9f[_0x6050('0x40')],_0x2377cb['uniqueid'],md5(_0x2377cb[_0x6050('0x45')]));}headers['Authorization']=getAuth(_0x232c9f);return getUser(_0x232c9f,_0x412f73['email'])[_0x6050('0x1b')](function(_0x551a79){_0x4661d0=_0x551a79;logger[_0x6050('0x9')](_0x6050('0x47'),_0x4661d0['id']);return getEndUser(_0x232c9f,_0x2377cb[_0x6050('0x58')],_0x2377cb[_0x6050('0x59')]);})['then'](function(_0x3e631a){_0x21774f=_0x3e631a;logger['info'](_0x6050('0x5a'),_0x21774f['id']);return getTicket(_0x232c9f,_0x4661d0,_0x21774f,_0x288336,_0x2377cb);})[_0x6050('0x1b')](function(_0x4e2f46){if(_0x4e2f46){logger[_0x6050('0x9')](_0x6050('0x4a'),_0x4e2f46['id']);switch(_0x232c9f[_0x6050('0x34')]){case _0x6050('0x4b'):logger[_0x6050('0x9')](_0x6050('0x57'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x6050('0xb')](_0x6050('0x5b'),_0x232c9f[_0x6050('0xd')],_0x4661d0['id'],_0x4e2f46['id']),'method':_0x6050('0xe')});case _0x6050('0x4e'):logger[_0x6050('0x9')](_0x6050('0x57'),_0x6050('0x5c'));emit(util['format'](_0x6050('0x4f'),_0x412f73[_0x6050('0x10')]),_0x6050('0x50'),{'uri':util[_0x6050('0xb')](_0x6050('0x5d'),_0x232c9f[_0x6050('0xd')],_0x4e2f46['id'])});break;default:logger[_0x6050('0x51')](_0x6050('0x57'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x48a6ac){logger['error'](_0x6050('0x5e'),util[_0x6050('0x54')](_0x48a6ac,{'showHidden':!![],'depth':null}));});};exports[_0x6050('0x5f')]=function(_0x551c9b,_0x1e9dd2,_0x10cb94,_0x4d7edf,_0x3d6b35,_0x56ce47){var _0x20534f,_0x10161f;_0x56ce47['remoteUri']=intUtil[_0x6050('0x41')](_0x56ce47[_0x6050('0xd')]);_0x56ce47[_0x6050('0x40')]=intUtil[_0x6050('0x41')](_0x56ce47[_0x6050('0x40')]);if(_0x3d6b35&&_0x3d6b35['monitor_format']){logger[_0x6050('0x9')]('['+_0x1e9dd2['lastevent'][_0x6050('0x60')]()+']',_0x6050('0x42'));_0x1e9dd2[_0x6050('0x43')]=util[_0x6050('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56ce47[_0x6050('0x40')],_0x1e9dd2[_0x6050('0x45')],md5(_0x1e9dd2['uniqueid']));}else{_0x1e9dd2['recordingURL']='';}headers[_0x6050('0x46')]=getAuth(_0x56ce47);return getUser(_0x56ce47)[_0x6050('0x1b')](function(_0x416195){_0x20534f=_0x416195;logger[_0x6050('0x9')](_0x6050('0x47'),_0x20534f['id']);return getEndUser(_0x56ce47,_0x1e9dd2['calleridname'],_0x1e9dd2[_0x6050('0x49')]);})['then'](function(_0x228115){_0x10161f=_0x228115;logger[_0x6050('0x9')](_0x6050('0x5a'),_0x10161f['id']);return getTicket(_0x56ce47,_0x20534f,_0x10161f,_0x10cb94,_0x1e9dd2);})['then'](function(_0x37897f){if(_0x37897f){logger[_0x6050('0x9')](_0x6050('0x4a'),_0x37897f['id']);}})[_0x6050('0x61')](function(_0x2ee6ce){logger[_0x6050('0x51')]('['+_0x1e9dd2['lastevent'][_0x6050('0x60')]()+']'+_0x6050('0x62'),util[_0x6050('0x54')](_0x2ee6ce,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x55e0=['toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','emit','application/json','info','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','%s:%s','username','password','authType','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','type','string','customField','nameField','content','idField','push','variable','variableName','Variable','toLowerCase','custom_fields','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent'];(function(_0x595911,_0x4bc4f6){var _0x22aef9=function(_0x31850f){while(--_0x31850f){_0x595911['push'](_0x595911['shift']());}};_0x22aef9(++_0x4bc4f6);}(_0x55e0,0xdc));var _0x055e=function(_0x732e09,_0x4bd3f9){_0x732e09=_0x732e09-0x0;var _0x14c534=_0x55e0[_0x732e09];return _0x14c534;};'use strict';var _=require(_0x055e('0x0'));var rp=require(_0x055e('0x1'));var md5=require(_0x055e('0x2'));var util=require(_0x055e('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x055e('0x4'));var logger=require(_0x055e('0x5'))(_0x055e('0x6'));config[_0x055e('0x7')]=_[_0x055e('0x8')](config[_0x055e('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x055e('0x7')]));function emit(_0x4a442e,_0x8e7824,_0x3c4cf){io['to'](_0x4a442e)[_0x055e('0x9')](_0x8e7824,_0x3c4cf);}var headers={'Content-Type':_0x055e('0xa'),'Accept':_0x055e('0xa')};function getTicket(_0x49540c,_0x40779c,_0xd67814,_0xb816c,_0xa0d384){logger[_0x055e('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x055e('0xc'),_0x49540c['remoteUri']),'method':_0x055e('0xd'),'body':{'ticket':_[_0x055e('0xe')]({'requester_id':_0xd67814['id'],'submitter_id':_0x40779c?_0x40779c['id']:undefined,'assignee_id':_0x40779c?_0x40779c['id']:undefined,'tags':getTags(_0xb816c[_0x055e('0xf')],_0x055e('0x10')),'subject':intUtil[_0x055e('0x11')](_0xb816c[_0x055e('0x12')],_0xa0d384,'\x20'),'description':intUtil[_0x055e('0x11')](_0xb816c['Descriptions'],_0xa0d384,'\x0a'),'comment':{'public':![],'body':intUtil[_0x055e('0x11')](_0xb816c[_0x055e('0x13')],_0xa0d384,'\x0a')}},getCustomFields(_0xb816c[_0x055e('0x14')],_0xa0d384))}})[_0x055e('0x15')](function(_0x222817){logger['info'](_0x055e('0x16'));return _0x222817[_0x055e('0x17')];});}function getUser(_0x111cdb,_0x599533){if(intUtil[_0x055e('0x18')](_0x599533)){logger[_0x055e('0xb')](_0x055e('0x19'),_0x599533);return request({'uri':util[_0x055e('0x1a')](_0x055e('0x1b'),_0x111cdb['remoteUri']),'qs':{'query':util[_0x055e('0x1a')](_0x055e('0x1c'),_0x599533)}})[_0x055e('0x15')](function(_0x2ed6fb){if(_0x2ed6fb['count']){logger[_0x055e('0xb')](_0x055e('0x1d'));return _['find'](_0x2ed6fb[_0x055e('0x1e')],{'email':_0x599533,'role':_0x055e('0x1f')});}else{logger[_0x055e('0xb')](_0x055e('0x20'));return request({'uri':util[_0x055e('0x1a')](_0x055e('0x21'),_0x111cdb['remoteUri'])})[_0x055e('0x15')](function(_0x2f0346){logger[_0x055e('0xb')]('Admin\x20account\x20selected.');return _0x2f0346[_0x055e('0x22')];});}});}else{logger[_0x055e('0xb')](_0x055e('0x20'));return request({'uri':util[_0x055e('0x1a')]('%s/users/me.json',_0x111cdb[_0x055e('0x23')])})['then'](function(_0x33ffdf){logger[_0x055e('0xb')](_0x055e('0x24'));return _0x33ffdf[_0x055e('0x22')];});}}function getEndUser(_0x40c62a,_0x4c653c,_0x58caf9){logger[_0x055e('0xb')](_0x055e('0x25'),_0x58caf9);return request({'uri':util[_0x055e('0x1a')]('%s/search.json',_0x40c62a[_0x055e('0x23')]),'qs':{'query':util[_0x055e('0x1a')](_0x055e('0x26'),_0x58caf9)}})[_0x055e('0x15')](function(_0x59539d){var _0x27f81a;if(_0x59539d['results'][_0x055e('0x27')]){_0x59539d[_0x055e('0x1e')]=_[_0x055e('0x28')](_0x59539d[_0x055e('0x1e')],{'suspended':![],'role':_0x055e('0x29')});if(_0x59539d['results'][_0x055e('0x27')]){_0x27f81a=_[_0x055e('0x2a')](_0x59539d[_0x055e('0x1e')]);}}if(_0x27f81a){logger[_0x055e('0xb')](_0x055e('0x2b'));return _0x27f81a;}else{logger[_0x055e('0xb')](_0x055e('0x2c'));return request({'uri':util[_0x055e('0x1a')]('%s/users.json',_0x40c62a[_0x055e('0x23')]),'method':_0x055e('0xd'),'body':{'user':{'role':'end-user','name':util[_0x055e('0x1a')](_0x055e('0x2d'),_0x4c653c||_0x58caf9),'phone':_0x58caf9}}})[_0x055e('0x15')](function(_0x20717b){logger[_0x055e('0xb')](_0x055e('0x2e'));return _0x20717b['user'];});}});}function getAuth(_0x5ddf59){var _0x25d19d;if(_0x5ddf59['authType']==='password'){_0x25d19d=util['format'](_0x055e('0x2f'),_0x5ddf59[_0x055e('0x30')],_0x5ddf59[_0x055e('0x31')]);}else if(_0x5ddf59[_0x055e('0x32')]===_0x055e('0x33')){_0x25d19d=util[_0x055e('0x1a')](_0x055e('0x34'),_0x5ddf59[_0x055e('0x30')],_0x5ddf59[_0x055e('0x33')]);}return util[_0x055e('0x1a')](_0x055e('0x35'),new Buffer(_0x25d19d)[_0x055e('0x36')]('base64'));}function request(_0x571b75){logger[_0x055e('0x37')](_0x055e('0x38'),JSON[_0x055e('0x39')](_0x571b75));return rp(_[_0x055e('0x8')](_0x571b75,{'method':_0x055e('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x21aaad,_0xb08e29){var _0x4f24f8=[];if(_0x21aaad&&_0x21aaad[_0x055e('0x27')]>0x0){_0x4f24f8=_[_0x055e('0x3b')](_0x21aaad,_0xb08e29);}return _0x4f24f8;}function getCustomFields(_0x3e9d25,_0x14b6ab){var _0x44dbd1=[];var _0x585b8a={'custom_fields':[]};if(_0x3e9d25[_0x055e('0x27')]>0x0){_[_0x055e('0x3c')](_0x3e9d25,function(_0x5b7d16){if(_0x5b7d16[_0x055e('0x3d')]===_0x055e('0x3e')&&_0x5b7d16['nameField']&&!_0x5b7d16[_0x055e('0x3f')]){_0x585b8a[_0x5b7d16[_0x055e('0x40')]['toLowerCase']()]=_0x5b7d16[_0x055e('0x41')][_0x055e('0x36')]();}else if(_0x5b7d16['type']===_0x055e('0x3e')&&_0x5b7d16[_0x055e('0x42')]&&_0x5b7d16[_0x055e('0x3f')]){_0x585b8a['custom_fields'][_0x055e('0x43')]({'id':_0x5b7d16[_0x055e('0x42')],'value':_0x5b7d16['content'][_0x055e('0x36')]()});}else if(_0x5b7d16[_0x055e('0x3d')]===_0x055e('0x44')&&_0x5b7d16['variableName']&&_0x5b7d16[_0x055e('0x42')]&&_0x5b7d16[_0x055e('0x3f')]){_0x14b6ab[_0x5b7d16[_0x055e('0x45')]]&&_0x585b8a['custom_fields']['push']({'id':_0x5b7d16[_0x055e('0x42')],'value':_0x14b6ab[_0x5b7d16[_0x055e('0x45')]]['toString']()});}else if(_0x5b7d16[_0x055e('0x3d')]==='customVariable'&&_0x5b7d16[_0x055e('0x46')]&&_0x5b7d16['Variable'][_0x055e('0x10')]&&_0x5b7d16[_0x055e('0x42')]&&_0x5b7d16[_0x055e('0x3f')]){_0x14b6ab[_0x5b7d16['Variable']['name'][_0x055e('0x47')]()]&&_0x585b8a[_0x055e('0x48')][_0x055e('0x43')]({'id':_0x5b7d16[_0x055e('0x42')],'value':_0x14b6ab[_0x5b7d16['Variable']['name'][_0x055e('0x47')]()][_0x055e('0x36')]()});}});}return _0x585b8a;}exports['queue']=function(_0x42dde3,_0x412684,_0xcb7d81,_0x20eb76,_0x19e29c,_0x1f3c73){var _0x479f4e,_0x297edd;_0x1f3c73[_0x055e('0x23')]=intUtil['stripTrailingSlash'](_0x1f3c73[_0x055e('0x23')]);_0x1f3c73[_0x055e('0x49')]=intUtil[_0x055e('0x4a')](_0x1f3c73[_0x055e('0x49')]);if(_0x19e29c&&_0x19e29c[_0x055e('0x4b')]){logger[_0x055e('0xb')](_0x055e('0x4c'),'Recording\x20is\x20enabled!');_0x412684[_0x055e('0x4d')]=util['format'](_0x055e('0x4e'),_0x1f3c73[_0x055e('0x49')],_0x412684[_0x055e('0x4f')],md5(_0x412684['uniqueid']));}else{_0x412684['recordingURL']='';}headers[_0x055e('0x50')]=getAuth(_0x1f3c73);return getUser(_0x1f3c73,_0x20eb76[_0x055e('0x51')])[_0x055e('0x15')](function(_0x250cab){_0x479f4e=_0x250cab;logger[_0x055e('0xb')](_0x055e('0x52'),_0x479f4e['id']);return getEndUser(_0x1f3c73,_0x412684[_0x055e('0x53')],_0x412684[_0x055e('0x54')]);})[_0x055e('0x15')](function(_0x5437c1){_0x297edd=_0x5437c1;logger[_0x055e('0xb')](_0x055e('0x55'),_0x297edd['id']);return getTicket(_0x1f3c73,_0x479f4e,_0x297edd,_0xcb7d81,_0x412684);})[_0x055e('0x15')](function(_0x17695b){if(_0x17695b){logger[_0x055e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x17695b['id']);switch(_0x1f3c73[_0x055e('0x3d')]){case _0x055e('0x56'):logger[_0x055e('0xb')]('[QUEUE]',_0x055e('0x57'));return request({'uri':util['format'](_0x055e('0x58'),_0x1f3c73[_0x055e('0x23')],_0x479f4e['id'],_0x17695b['id']),'method':'POST'});case _0x055e('0x59'):logger[_0x055e('0xb')](_0x055e('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x055e('0x5a'),_0x20eb76[_0x055e('0x10')]),_0x055e('0x5b'),{'uri':util[_0x055e('0x1a')](_0x055e('0x5c'),_0x1f3c73[_0x055e('0x23')],_0x17695b['id'])});break;default:logger[_0x055e('0x5d')](_0x055e('0x4c'),_0x055e('0x5e'));}}})[_0x055e('0x5f')](function(_0x4d8698){logger[_0x055e('0x5d')](_0x055e('0x60'),util[_0x055e('0x61')](_0x4d8698,{'showHidden':!![],'depth':null}));});};exports[_0x055e('0x62')]=function(_0x57a9e4,_0x3dc39c,_0x302787,_0x214b14,_0x3eb1a1,_0x59fe11,_0x54dcf7){var _0x22bf74,_0xd3a451;_0x59fe11[_0x055e('0x23')]=intUtil[_0x055e('0x4a')](_0x59fe11[_0x055e('0x23')]);_0x59fe11[_0x055e('0x49')]=intUtil[_0x055e('0x4a')](_0x59fe11[_0x055e('0x49')]);if(_0x54dcf7&&_0x54dcf7['recordingFormat']&&_0x54dcf7['recordingFormat']!==_0x055e('0x63')){logger[_0x055e('0xb')]('[OUTBOUND]',_0x055e('0x64'));_0x3dc39c[_0x055e('0x4d')]=util[_0x055e('0x1a')](_0x055e('0x4e'),_0x59fe11['serverUrl'],_0x3dc39c[_0x055e('0x4f')],md5(_0x3dc39c[_0x055e('0x4f')]));}headers[_0x055e('0x50')]=getAuth(_0x59fe11);return getUser(_0x59fe11,_0x214b14[_0x055e('0x51')])[_0x055e('0x15')](function(_0x3f74fa){_0x22bf74=_0x3f74fa;logger[_0x055e('0xb')](_0x055e('0x52'),_0x22bf74['id']);return getEndUser(_0x59fe11,_0x3dc39c['destcalleridname'],_0x3dc39c[_0x055e('0x65')]);})[_0x055e('0x15')](function(_0x5bd8f0){_0xd3a451=_0x5bd8f0;logger[_0x055e('0xb')](_0x055e('0x55'),_0xd3a451['id']);return getTicket(_0x59fe11,_0x22bf74,_0xd3a451,_0x302787,_0x3dc39c);})[_0x055e('0x15')](function(_0xde3c89){if(_0xde3c89){logger['info'](_0x055e('0x66'),_0xde3c89['id']);switch(_0x59fe11[_0x055e('0x3d')]){case _0x055e('0x56'):logger['info'](_0x055e('0x67'),_0x055e('0x57'));return request({'uri':util[_0x055e('0x1a')](_0x055e('0x58'),_0x59fe11[_0x055e('0x23')],_0x22bf74['id'],_0xde3c89['id']),'method':'POST'});case _0x055e('0x59'):logger[_0x055e('0xb')](_0x055e('0x67'),_0x055e('0x68'));emit(util[_0x055e('0x1a')]('user:%s',_0x214b14[_0x055e('0x10')]),_0x055e('0x5b'),{'uri':util[_0x055e('0x1a')]('%s/agent/tickets/%s',_0x59fe11[_0x055e('0x23')],_0xde3c89['id'])});break;default:logger[_0x055e('0x5d')](_0x055e('0x67'),_0x055e('0x5e'));}}})[_0x055e('0x5f')](function(_0x553e16){logger[_0x055e('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x055e('0x61')](_0x553e16,{'showHidden':!![],'depth':null}));});};exports[_0x055e('0x69')]=function(_0x533c0a,_0x3137bb,_0x1954a3,_0x30602f,_0x2bdf06,_0x58c121){var _0x48afae,_0x4c1187;_0x58c121['remoteUri']=intUtil[_0x055e('0x4a')](_0x58c121[_0x055e('0x23')]);_0x58c121[_0x055e('0x49')]=intUtil[_0x055e('0x4a')](_0x58c121[_0x055e('0x49')]);if(_0x2bdf06&&_0x2bdf06[_0x055e('0x4b')]){logger[_0x055e('0xb')]('['+_0x3137bb[_0x055e('0x6a')][_0x055e('0x6b')]()+']',_0x055e('0x64'));_0x3137bb['recordingURL']=util['format'](_0x055e('0x4e'),_0x58c121[_0x055e('0x49')],_0x3137bb['uniqueid'],md5(_0x3137bb[_0x055e('0x4f')]));}else{_0x3137bb['recordingURL']='';}headers[_0x055e('0x50')]=getAuth(_0x58c121);return getUser(_0x58c121)[_0x055e('0x15')](function(_0x10093f){_0x48afae=_0x10093f;logger[_0x055e('0xb')](_0x055e('0x52'),_0x48afae['id']);return getEndUser(_0x58c121,_0x3137bb[_0x055e('0x53')],_0x3137bb[_0x055e('0x54')]);})[_0x055e('0x15')](function(_0x4dfdb0){_0x4c1187=_0x4dfdb0;logger[_0x055e('0xb')](_0x055e('0x55'),_0x4c1187['id']);return getTicket(_0x58c121,_0x48afae,_0x4c1187,_0x1954a3,_0x3137bb);})[_0x055e('0x15')](function(_0x1ff1fa){if(_0x1ff1fa){logger[_0x055e('0xb')](_0x055e('0x66'),_0x1ff1fa['id']);}})[_0x055e('0x5f')](function(_0x406bef){logger[_0x055e('0x5d')]('['+_0x3137bb['lastevent'][_0x055e('0x6b')]()+']'+_0x055e('0x6c'),util['inspect'](_0x406bef,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 2e69b1b..3d549c7 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 _0x7f48=['outbound','recordingFormat','none','[OUTBOUND]','recordingURL','/downloads?type=uniqueid&token=','destcalleridname','Outbound','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','/api/voice/recordings/','com','calleridname','toUpperCase','lodash','request-promise','util','ioredis','bluebird','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','stack','info','Search\x20user','GET','format','ActiveUsers','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','diff','starttime','lastevent','complete','connect','Answered','rejected','Call_Result','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','zoho.eu','email','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s'];(function(_0x34c085,_0x47624b){var _0x9f7dc2=function(_0x3fcbed){while(--_0x3fcbed){_0x34c085['push'](_0x34c085['shift']());}};_0x9f7dc2(++_0x47624b);}(_0x7f48,0xac));var _0x87f4=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x7f48[_0x291f8b];return _0x275171;};'use strict';var _=require(_0x87f4('0x0'));var rp=require(_0x87f4('0x1'));var md5=require('md5');var util=require(_0x87f4('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x87f4('0x3'));var BPromise=require(_0x87f4('0x4'));var config=require('../../../../config/environment');var logger=require(_0x87f4('0x5'))(_0x87f4('0x6'));config[_0x87f4('0x7')]=_['defaults'](config['redis'],{'host':_0x87f4('0x8'),'port':0x18eb});var io=require(_0x87f4('0x9'))(new Redis(config['redis']));function emit(_0x110be3,_0x26ee88,_0xa5c684){io['to'](_0x110be3)[_0x87f4('0xa')](_0x26ee88,_0xa5c684);}function request(_0x2efee0){logger[_0x87f4('0xb')](_0x87f4('0xc'),JSON[_0x87f4('0xd')](_0x2efee0));return rp(_0x2efee0);}function getCustomFields(_0x86348e,_0x13d6e3){var _0x50299a={};if(_0x86348e[_0x87f4('0xe')]>0x0){_[_0x87f4('0xf')](_0x86348e,function(_0x4da009){if(_0x4da009[_0x87f4('0x10')]==='string'&&_0x4da009[_0x87f4('0x11')]){_0x50299a[_0x4da009[_0x87f4('0x11')]]=_0x4da009[_0x87f4('0x12')]['toString']();}else if(_0x4da009[_0x87f4('0x10')]===_0x87f4('0x13')&&_0x4da009['variableName']&&_0x4da009['idField']&&_0x13d6e3[_0x4da009[_0x87f4('0x14')]]){_0x50299a[_0x4da009[_0x87f4('0x11')]]=_0x13d6e3[_0x4da009[_0x87f4('0x14')]]['toString']();}else if(_0x4da009[_0x87f4('0x10')]===_0x87f4('0x15')&&_0x4da009[_0x87f4('0x16')]&&_0x4da009['Variable']['name']&&_0x4da009['idField']&&_0x13d6e3[_0x4da009[_0x87f4('0x16')][_0x87f4('0x17')]['toLowerCase']()]){_0x50299a[_0x4da009[_0x87f4('0x11')]]=_0x13d6e3[_0x4da009['Variable'][_0x87f4('0x17')][_0x87f4('0x18')]()][_0x87f4('0x19')]();}});}return _0x50299a;}function getName(_0x3c09be){if(_0x3c09be[_0x87f4('0x1a')]('\x20')>0x0){var _0x466bbc=_0x3c09be[_0x87f4('0x1b')](/ (.+)/);if(_0x466bbc[0x1]){return _0x466bbc;}}return[_0x3c09be,_0x3c09be];}var accountsTokens={};function getAccessToken(_0x38e027){return new Promise(function(_0x1155ff,_0x71817d){if(!_[_0x87f4('0x1c')](accountsTokens[_0x38e027['id']])&&!_[_0x87f4('0x1c')](accountsTokens[_0x38e027['id']][_0x87f4('0x1d')])){if(moment()[_0x87f4('0x1e')](accountsTokens[_0x38e027['id']][_0x87f4('0x1f')])){_0x1155ff(accountsTokens[_0x38e027['id']][_0x87f4('0x1d')]);}}var _0x3c1e83;switch(_0x38e027[_0x87f4('0x20')]){case'US':_0x3c1e83=_0x87f4('0x21');break;case'AU':_0x3c1e83=_0x87f4('0x22');break;case'EU':_0x3c1e83=_0x87f4('0x23');break;case'IN':_0x3c1e83=_0x87f4('0x24');break;case'CN':_0x3c1e83=_0x87f4('0x25');break;default:_0x3c1e83=_0x87f4('0x23');break;}var _0x2eb33c={'method':'POST','uri':_0x3c1e83+_0x87f4('0x26'),'qs':{'refresh_token':_0x38e027[_0x87f4('0x27')],'client_id':_0x38e027[_0x87f4('0x28')],'client_secret':_0x38e027[_0x87f4('0x29')],'grant_type':_0x87f4('0x2a')},'json':!![]};return rp(_0x2eb33c)[_0x87f4('0x2b')](function(_0x22ac8c){accountsTokens[_0x38e027['id']]={'access_token':_0x22ac8c['access_token'],'expires_in':moment()[_0x87f4('0x2c')](_0x22ac8c[_0x87f4('0x1f')],'seconds')};_0x1155ff(_0x22ac8c['access_token']);})[_0x87f4('0x2d')](function(_0x41953f){logger[_0x87f4('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x41953f[_0x87f4('0x2f')]);_0x71817d(_0x41953f);});});}function getUser(_0x6bb391,_0x918b6e,_0x12bcdd,_0x387866){logger[_0x87f4('0x30')](_0x87f4('0x31'));return request({'method':_0x87f4('0x32'),'uri':util[_0x87f4('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x918b6e),'qs':{'type':_0x87f4('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x6bb391},'json':!![]})[_0x87f4('0x2b')](function(_0x49e8ec){if(_0x49e8ec['users']){var _0x208e45=-0x1;if(_[_0x87f4('0x35')](_0x49e8ec[_0x87f4('0x36')])){if(!_[_0x87f4('0x1c')](_0x387866)){_0x208e45=_[_0x87f4('0x37')](_0x49e8ec[_0x87f4('0x36')],function(_0x3481db){return _0x3481db['email']===_0x387866;});}if(_0x208e45>=0x0){logger[_0x87f4('0x30')](_0x87f4('0x38'));}else{logger[_0x87f4('0x30')](_0x87f4('0x39'));_0x208e45=_[_0x87f4('0x37')](_0x49e8ec['users'],function(_0xbea413){return _0xbea413[_0x87f4('0x3a')][_0x87f4('0x17')]===_0x87f4('0x3b');});}return _0x49e8ec[_0x87f4('0x36')][_0x208e45];}else{if(_0x49e8ec[_0x87f4('0x3c')][_0x87f4('0x3a')][_0x87f4('0x17')]===_0x87f4('0x3b')){logger[_0x87f4('0x30')]('Using\x20the\x20admin\x20account!');user=_0x49e8ec[_0x87f4('0x3c')];return user;}else{logger[_0x87f4('0x2e')](_0x87f4('0x3d'),JSON[_0x87f4('0xd')](_0x49e8ec));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x87f4('0xd')](_0x49e8ec));}}}else{logger['error'](_0x87f4('0x3d'),JSON['stringify'](_0x49e8ec));throw new Error(_0x87f4('0x3e')+JSON['stringify'](_0x49e8ec));}})[_0x87f4('0x2d')](function(_0x2b34c7){console[_0x87f4('0x2e')](_0x2b34c7);});}function getZohoUser(_0xe04478,_0xf64a03){return new BPromise(function(_0x355023,_0x318b0c){request(_0xe04478)['then'](function(_0x4ef676){var _0x4bb12c=null;if(_0x4ef676){_0x4bb12c=_0x4ef676[_0x87f4('0x3f')][0x0];_0x4bb12c['enduserType']=_0xf64a03;}_0x355023(_0x4bb12c);})[_0x87f4('0x2d')](function(_0x278ff4){_0x318b0c(_0x278ff4);});});}function createEndUser(_0xec6c87,_0x8e3687,_0x4f4e26,_0x191d71,_0xf12c43,_0x3a7811){var _0x4f4e26=getName(_0x4f4e26);return request({'method':_0x87f4('0x40'),'uri':_0x87f4('0x41')+_0x8e3687+_0x87f4('0x42')+_[_0x87f4('0x43')](_0x3a7811[_0x87f4('0x44')])+'s','body':{'data':[{'Last_Name':_0x4f4e26[0x1],'First_Name':_0x4f4e26[0x0],'Phone':_0x191d71,'Owner':{'name':!_[_0x87f4('0x1c')](_0xf12c43[_0x87f4('0x45')]['name'])?_0xf12c43[_0x87f4('0x45')][_0x87f4('0x17')]:!_[_0x87f4('0x1c')](_0xf12c43[_0x87f4('0x46')])?_0xf12c43['first_name']+'\x20'+_0xf12c43[_0x87f4('0x47')]:_0xf12c43[_0x87f4('0x47')],'id':_0xf12c43['id']}}]},'headers':{'Authorization':_0x87f4('0x48')+_0xec6c87},'json':!![]})[_0x87f4('0x2b')](function(_0x23ad25){if(_0x23ad25&&_0x23ad25[_0x87f4('0x3f')][0x0][_0x87f4('0x49')]===_0x87f4('0x4a')){var _0x39e422=_0x23ad25[_0x87f4('0x3f')][0x0][_0x87f4('0x4b')];_0x39e422['enduserType']=_[_0x87f4('0x43')](_0x3a7811['moduleCreate'])+'s';return _0x39e422;}logger['error'](_0x87f4('0x3d'),JSON[_0x87f4('0xd')](data));throw new Error(_0x87f4('0x4c')+JSON[_0x87f4('0xd')](data));})[_0x87f4('0x2d')](function(_0x55a055){console[_0x87f4('0x4d')](_0x87f4('0x4e'),_0x55a055);});}function getEndUser(_0x165e6c,_0x2681af,_0x43de1f,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6){var _0x5dc402={'method':_0x87f4('0x32'),'uri':'','headers':{'Authorization':_0x87f4('0x48')+_0x165e6c},'json':!![]};switch(_0x52cef6[_0x87f4('0x4f')]){case'contact_lead':_0x5dc402[_0x87f4('0x50')]=_0x87f4('0x41')+_0x2681af+_0x87f4('0x51')+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x52'))[_0x87f4('0x2b')](function(_0x2180f9){if(_0x2180f9)return _0x2180f9;_0x5dc402[_0x87f4('0x50')]=_0x87f4('0x41')+_0x2681af+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x53'))[_0x87f4('0x2b')](function(_0x1fa942){if(_0x1fa942)return _0x1fa942;if(_0x52cef6[_0x87f4('0x44')]!='nothing'){return createEndUser(_0x165e6c,_0x2681af,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6);}else{return{};}});});break;case'contact':_0x5dc402[_0x87f4('0x50')]=_0x87f4('0x41')+_0x2681af+_0x87f4('0x51')+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x52'))[_0x87f4('0x2b')](function(_0x240988){if(_0x240988)return _0x240988;if(_0x52cef6[_0x87f4('0x44')]!=_0x87f4('0x54')){return createEndUser(_0x165e6c,_0x2681af,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6);}else{return{};}});break;case _0x87f4('0x55'):_0x5dc402['uri']=_0x87f4('0x41')+_0x2681af+_0x87f4('0x56')+_0x5d936d+'))';return getZohoUser(_0x5dc402,_0x87f4('0x53'))['then'](function(_0x4b6e50){if(_0x4b6e50)return _0x4b6e50;if(_0x52cef6[_0x87f4('0x44')]!=_0x87f4('0x54')){return createEndUser(_0x165e6c,_0x2681af,_0x1ebd89,_0x5d936d,_0x834876,_0x52cef6);}else{return{};}});break;}}function getCall(_0x23ee32,_0x145a99,_0x24c693,_0x1df95f,_0x218501,_0x3a9f07,_0x3363f6,_0x5e4e33){logger[_0x87f4('0x30')](_0x87f4('0x57'));var _0x3b1e93={};_0x3b1e93[_0x87f4('0x58')]={'name':!_['isNil'](_0x1df95f[_0x87f4('0x45')][_0x87f4('0x17')])&&!_[_0x87f4('0x1c')](_0x1df95f[_0x87f4('0x3a')][_0x87f4('0x17')])&&_0x1df95f[_0x87f4('0x3a')][_0x87f4('0x17')]===_0x87f4('0x59')?_0x1df95f[_0x87f4('0x45')]['name']:!_[_0x87f4('0x1c')](_0x1df95f[_0x87f4('0x46')])?_0x1df95f['first_name']+'\x20'+_0x1df95f['last_name']:_0x1df95f['last_name'],'id':_0x1df95f['id']};_0x3b1e93['Subject']=intUtil[_0x87f4('0x5a')](_0x3a9f07[_0x87f4('0x5b')],_0x3363f6,'\x20');_0x3b1e93[_0x87f4('0x5c')]=intUtil['getString'](_0x3a9f07[_0x87f4('0x5d')],_0x3363f6,'\x0a');if(_0x218501[_0x87f4('0x5e')]===_0x87f4('0x52')){_0x3b1e93[_0x87f4('0x5f')]={'name':!_[_0x87f4('0x1c')](_0x218501[_0x87f4('0x60')])?_0x218501['Full_Name']:!_['isNil'](_0x218501[_0x87f4('0x61')])?_0x218501['First_Name']+'\x20'+_0x218501[_0x87f4('0x62')]:_0x218501['Last_Name'],'id':_0x218501['id']};}if(_0x218501[_0x87f4('0x5e')]==='Leads'){_0x3b1e93[_0x87f4('0x63')]={'name':!_[_0x87f4('0x1c')](_0x218501[_0x87f4('0x60')])?_0x218501[_0x87f4('0x60')]:!_[_0x87f4('0x1c')](_0x218501[_0x87f4('0x61')])?_0x218501['First_Name']+'\x20'+_0x218501[_0x87f4('0x62')]:_0x218501['Last_Name'],'id':_0x218501['id']};_0x3b1e93[_0x87f4('0x64')]=_['startCase'](_0x218501[_0x87f4('0x5e')]);}if(_0x3363f6[_0x87f4('0x65')]){_0x3b1e93[_0x87f4('0x66')]=moment['utc'](parseInt(_0x3363f6[_0x87f4('0x65')])*0x3e8)['format'](_0x87f4('0x67'));}else if(_0x3363f6[_0x87f4('0x68')]&&_0x3363f6[_0x87f4('0x69')]){_0x3b1e93[_0x87f4('0x66')]=moment[_0x87f4('0x6a')](moment(_0x3363f6[_0x87f4('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x87f4('0x6b')](moment(_0x3363f6[_0x87f4('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x87f4('0x33')](_0x87f4('0x67'));}switch(_0x3363f6[_0x87f4('0x6d')]){case'called':_0x3b1e93['Call_Result']='Called';break;case _0x87f4('0x6e'):case _0x87f4('0x6f'):_0x3b1e93['Call_Result']=_0x87f4('0x70');break;case _0x87f4('0x71'):_0x3b1e93[_0x87f4('0x72')]='Rejected';break;case _0x87f4('0x73'):_0x3b1e93[_0x87f4('0x72')]=_0x87f4('0x74');break;case _0x87f4('0x75'):_0x3b1e93[_0x87f4('0x72')]=_0x87f4('0x76');default:}_0x3b1e93[_0x87f4('0x77')]=(_0x5e4e33==='outbound'?moment(_0x3363f6[_0x87f4('0x6c')])[_0x87f4('0x33')](_0x87f4('0x78')):moment(_0x3363f6[_0x87f4('0x79')])[_0x87f4('0x33')](_0x87f4('0x78')))||moment()[_0x87f4('0x33')](_0x87f4('0x78'));_0x3b1e93[_0x87f4('0x7a')]=_0x5e4e33||'Inbound';_0x3b1e93=_[_0x87f4('0x7b')](_0x3b1e93,getCustomFields(_0x3a9f07[_0x87f4('0x7c')],_0x3363f6));return request({'method':_0x87f4('0x40'),'uri':_0x87f4('0x41')+_0x145a99+'/crm/v2/Calls','headers':{'Authorization':_0x87f4('0x48')+_0x23ee32},'body':{'data':[_0x3b1e93]},'json':!![]})[_0x87f4('0x2b')](function(_0x4071b7){if(_0x4071b7&&_0x4071b7[_0x87f4('0x3f')][0x0][_0x87f4('0x49')]===_0x87f4('0x4a')){logger[_0x87f4('0x30')](_0x87f4('0x7d'));return{'id':_0x4071b7[_0x87f4('0x3f')][0x0]['details']['id']};}})[_0x87f4('0x2d')](function(_0x5b3a99){logger[_0x87f4('0x30')](_0x87f4('0x7e'),_0x5b3a99[_0x87f4('0x2f')]);console['log'](_0x87f4('0x7e'),_0x5b3a99);});}exports[_0x87f4('0x7f')]=function(_0x92a92a,_0x25bdc2,_0x195387,_0x4a6e13,_0x1b3a27,_0x299185){var _0x51c4b5,_0x2733d4,_0x3a5b3e;_0x299185[_0x87f4('0x80')]=intUtil['stripTrailingSlash'](_0x299185[_0x87f4('0x80')]);_0x299185[_0x87f4('0x81')]=intUtil[_0x87f4('0x82')](_0x299185['serverUrl']);if(_0x1b3a27&&_0x1b3a27[_0x87f4('0x83')]){logger[_0x87f4('0x30')](_0x87f4('0x84'),_0x87f4('0x85'));_0x25bdc2['recordingURL']=_0x299185[_0x87f4('0x81')]+'/api/voice/recordings/'+_0x25bdc2[_0x87f4('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x25bdc2['uniqueid']);}else{_0x25bdc2['recordingURL']='';}var _0x4ca0ad=_0x299185[_0x87f4('0x80')]===_0x87f4('0x87')?'eu':'com';return getAccessToken(_0x299185)[_0x87f4('0x2b')](function(_0x49d854){_0x3a5b3e=_0x49d854;return getUser(_0x3a5b3e,_0x4ca0ad,_0x299185,_0x4a6e13[_0x87f4('0x88')]);})[_0x87f4('0x2b')](function(_0x5a2822){_0x51c4b5=_0x5a2822;logger[_0x87f4('0x30')](_0x87f4('0x89'),_0x51c4b5['id']);return getEndUser(_0x3a5b3e,_0x4ca0ad,_0x299185,_0x25bdc2['calleridname'],_0x25bdc2[_0x87f4('0x8a')],_0x51c4b5,_0x195387);})[_0x87f4('0x2b')](function(_0x2105c8){_0x2733d4=_0x2105c8;return getCall(_0x3a5b3e,_0x4ca0ad,_0x299185,_0x51c4b5,_0x2733d4,_0x195387,_0x25bdc2,_0x87f4('0x8b'));})[_0x87f4('0x2b')](function(_0x2ea0d2){if(_0x2ea0d2){logger[_0x87f4('0x30')](_0x87f4('0x8c'),_0x2ea0d2['id']);logger[_0x87f4('0x30')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x87f4('0x33')](_0x87f4('0x8d'),_0x4a6e13['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x299185[_0x87f4('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2ea0d2['id']});}})[_0x87f4('0x2d')](function(_0xb90ee){logger[_0x87f4('0x2e')](_0x87f4('0x84'),JSON[_0x87f4('0xd')](_0xb90ee));});};exports[_0x87f4('0x8e')]=function(_0x31a11f,_0x3fae86,_0x5bda61,_0x4ed68f,_0x5aa1c7,_0x1cfe8e,_0x449ee9){var _0x5a14c7,_0x1b82fc,_0x4e0d3c;_0x1cfe8e['host']=intUtil[_0x87f4('0x82')](_0x1cfe8e[_0x87f4('0x80')]);_0x1cfe8e[_0x87f4('0x81')]=intUtil['stripTrailingSlash'](_0x1cfe8e[_0x87f4('0x81')]);if(_0x449ee9&&_0x449ee9[_0x87f4('0x8f')]&&_0x449ee9[_0x87f4('0x8f')]!==_0x87f4('0x90')){logger[_0x87f4('0x30')](_0x87f4('0x91'),_0x87f4('0x85'));_0x3fae86[_0x87f4('0x92')]=_0x1cfe8e[_0x87f4('0x81')]+'/api/voice/recordings/'+_0x3fae86[_0x87f4('0x86')]+_0x87f4('0x93')+md5(_0x3fae86[_0x87f4('0x86')]);}var _0x2bff3c=_0x1cfe8e['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x1cfe8e)[_0x87f4('0x2b')](function(_0x5b3a2){_0x4e0d3c=_0x5b3a2;return getUser(_0x4e0d3c,_0x2bff3c,_0x1cfe8e,_0x4ed68f[_0x87f4('0x88')]);})[_0x87f4('0x2b')](function(_0x471c64){_0x5a14c7=_0x471c64;logger[_0x87f4('0x30')]('The\x20User\x20ID\x20is:',_0x5a14c7['id']);return getEndUser(_0x4e0d3c,_0x2bff3c,_0x1cfe8e,_0x3fae86[_0x87f4('0x94')],_0x3fae86['destcalleridnum'],_0x5a14c7,_0x5bda61);})[_0x87f4('0x2b')](function(_0x465dfa){_0x1b82fc=_0x465dfa;return getCall(_0x4e0d3c,_0x2bff3c,_0x1cfe8e,_0x5a14c7,_0x1b82fc,_0x5bda61,_0x3fae86,_0x87f4('0x95'));})['then'](function(_0x4af2f5){if(_0x4af2f5){logger[_0x87f4('0x30')](_0x87f4('0x8c'),_0x4af2f5['id']);logger['info'](_0x87f4('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x87f4('0x33')](_0x87f4('0x8d'),_0x4ed68f['name']),_0x87f4('0x96'),{'uri':'https://crm.'+_0x1cfe8e[_0x87f4('0x80')]+_0x87f4('0x97')+_0x4af2f5['id']});}})[_0x87f4('0x2d')](function(_0xb5c81){logger[_0x87f4('0x2e')]('[OUTBOUND]',JSON[_0x87f4('0xd')](_0xb5c81));});};exports[_0x87f4('0x98')]=function(_0x5b004d,_0x498132,_0x3cec16,_0x50a34f,_0x6a38cb,_0x24062a){var _0x2503f1,_0x1c65af,_0x2ac9f1;_0x24062a[_0x87f4('0x80')]=intUtil[_0x87f4('0x82')](_0x24062a['host']);_0x24062a[_0x87f4('0x81')]=intUtil[_0x87f4('0x82')](_0x24062a['serverUrl']);if(_0x6a38cb&&_0x6a38cb[_0x87f4('0x83')]){logger[_0x87f4('0x30')]('['+_0x498132[_0x87f4('0x6d')]['toUpperCase']()+']',_0x87f4('0x85'));_0x498132[_0x87f4('0x92')]=_0x24062a[_0x87f4('0x81')]+_0x87f4('0x99')+_0x498132[_0x87f4('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x498132['uniqueid']);}else{_0x498132[_0x87f4('0x92')]='';}var _0x1fb884=_0x24062a[_0x87f4('0x80')]===_0x87f4('0x87')?'eu':_0x87f4('0x9a');return getAccessToken(_0x24062a)[_0x87f4('0x2b')](function(_0x362b7f){_0x2ac9f1=_0x362b7f;return getUser(_0x2ac9f1,_0x1fb884,_0x24062a);})['then'](function(_0x24eb16){_0x2503f1=_0x24eb16;logger['info'](_0x87f4('0x89'),_0x2503f1['id']);return getEndUser(_0x2ac9f1,_0x1fb884,_0x24062a,_0x498132[_0x87f4('0x9b')],_0x498132['calleridnum'],_0x2503f1,_0x3cec16);})[_0x87f4('0x2b')](function(_0x5639ed){_0x1c65af=_0x5639ed;return getCall(_0x2ac9f1,_0x1fb884,_0x24062a,_0x2503f1,_0x1c65af,_0x3cec16,_0x498132,'Inbound');})[_0x87f4('0x2b')](function(_0x453e3d){if(_0x453e3d){logger[_0x87f4('0x30')]('The\x20Call\x20ID\x20is:',_0x453e3d['id']);}})[_0x87f4('0x2d')](function(_0x40a0be){logger[_0x87f4('0x2e')]('['+_0x498132[_0x87f4('0x6d')][_0x87f4('0x9c')]()+']',JSON[_0x87f4('0xd')](_0x40a0be));});}; \ No newline at end of file +var _0xb5bf=['[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','lastevent','lodash','request-promise','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','host','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','outbound','stripTrailingSlash','recordingFormat','none'];(function(_0x475be2,_0xf0639){var _0x4ff8b1=function(_0x4bccc9){while(--_0x4bccc9){_0x475be2['push'](_0x475be2['shift']());}};_0x4ff8b1(++_0xf0639);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xb5bf[_0x616290];return _0x453879;};'use strict';var _=require(_0xfb5b('0x0'));var rp=require(_0xfb5b('0x1'));var md5=require(_0xfb5b('0x2'));var util=require('util');var intUtil=require(_0xfb5b('0x3'));var moment=require('moment');var Redis=require(_0xfb5b('0x4'));var BPromise=require(_0xfb5b('0x5'));var config=require(_0xfb5b('0x6'));var logger=require(_0xfb5b('0x7'))(_0xfb5b('0x8'));config[_0xfb5b('0x9')]=_['defaults'](config[_0xfb5b('0x9')],{'host':_0xfb5b('0xa'),'port':0x18eb});var io=require(_0xfb5b('0xb'))(new Redis(config[_0xfb5b('0x9')]));function emit(_0x3ac378,_0x5bd4ce,_0x570b34){io['to'](_0x3ac378)['emit'](_0x5bd4ce,_0x570b34);}function request(_0x541c2d){logger[_0xfb5b('0xc')]('[HTTP]',JSON[_0xfb5b('0xd')](_0x541c2d));return rp(_0x541c2d);}function getCustomFields(_0x5a881c,_0x5af168){var _0x9989e8={};if(_0x5a881c[_0xfb5b('0xe')]>0x0){_[_0xfb5b('0xf')](_0x5a881c,function(_0x5cbffd){if(_0x5cbffd[_0xfb5b('0x10')]===_0xfb5b('0x11')&&_0x5cbffd[_0xfb5b('0x12')]){_0x9989e8[_0x5cbffd[_0xfb5b('0x12')]]=_0x5cbffd[_0xfb5b('0x13')][_0xfb5b('0x14')]();}else if(_0x5cbffd[_0xfb5b('0x10')]===_0xfb5b('0x15')&&_0x5cbffd['variableName']&&_0x5cbffd[_0xfb5b('0x12')]&&_0x5af168[_0x5cbffd[_0xfb5b('0x16')]]){_0x9989e8[_0x5cbffd[_0xfb5b('0x12')]]=_0x5af168[_0x5cbffd[_0xfb5b('0x16')]]['toString']();}else if(_0x5cbffd[_0xfb5b('0x10')]===_0xfb5b('0x17')&&_0x5cbffd[_0xfb5b('0x18')]&&_0x5cbffd['Variable'][_0xfb5b('0x19')]&&_0x5cbffd[_0xfb5b('0x12')]&&_0x5af168[_0x5cbffd[_0xfb5b('0x18')][_0xfb5b('0x19')][_0xfb5b('0x1a')]()]){_0x9989e8[_0x5cbffd[_0xfb5b('0x12')]]=_0x5af168[_0x5cbffd['Variable'][_0xfb5b('0x19')]['toLowerCase']()]['toString']();}});}return _0x9989e8;}function getName(_0x14a2fa){if(_0x14a2fa['indexOf']('\x20')>0x0){var _0x2a3fbc=_0x14a2fa[_0xfb5b('0x1b')](/ (.+)/);if(_0x2a3fbc[0x1]){return _0x2a3fbc;}}return[_0x14a2fa,_0x14a2fa];}var accountsTokens={};function getAccessToken(_0x2dd395){return new Promise(function(_0x17d942,_0x1bb368){if(!_[_0xfb5b('0x1c')](accountsTokens[_0x2dd395['id']])&&!_[_0xfb5b('0x1c')](accountsTokens[_0x2dd395['id']][_0xfb5b('0x1d')])){if(moment()[_0xfb5b('0x1e')](accountsTokens[_0x2dd395['id']][_0xfb5b('0x1f')])){_0x17d942(accountsTokens[_0x2dd395['id']]['access_token']);}}var _0x3a6ade;switch(_0x2dd395['zone']){case'US':_0x3a6ade=_0xfb5b('0x20');break;case'AU':_0x3a6ade=_0xfb5b('0x21');break;case'EU':_0x3a6ade='https://accounts.zoho.eu';break;case'IN':_0x3a6ade=_0xfb5b('0x22');break;case'CN':_0x3a6ade=_0xfb5b('0x23');break;default:_0x3a6ade='https://accounts.zoho.eu';break;}var _0x2cd4b9={'method':_0xfb5b('0x24'),'uri':_0x3a6ade+_0xfb5b('0x25'),'qs':{'refresh_token':_0x2dd395['refreshToken'],'client_id':_0x2dd395[_0xfb5b('0x26')],'client_secret':_0x2dd395[_0xfb5b('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2cd4b9)[_0xfb5b('0x28')](function(_0x53987a){accountsTokens[_0x2dd395['id']]={'access_token':_0x53987a[_0xfb5b('0x1d')],'expires_in':moment()[_0xfb5b('0x29')](_0x53987a[_0xfb5b('0x1f')],'seconds')};_0x17d942(_0x53987a['access_token']);})[_0xfb5b('0x2a')](function(_0xd0dbbc){logger[_0xfb5b('0x2b')](_0xfb5b('0x2c'),_0xd0dbbc[_0xfb5b('0x2d')]);_0x1bb368(_0xd0dbbc);});});}function getUser(_0x3281b5,_0x1bd64b,_0x57b3c1,_0x36e376){logger['info'](_0xfb5b('0x2e'));return request({'method':_0xfb5b('0x2f'),'uri':util[_0xfb5b('0x30')](_0xfb5b('0x31'),_0x1bd64b),'qs':{'type':_0xfb5b('0x32')},'headers':{'Authorization':_0xfb5b('0x33')+_0x3281b5},'json':!![]})[_0xfb5b('0x28')](function(_0x4d8f3c){if(_0x4d8f3c[_0xfb5b('0x34')]){var _0x5456f0=-0x1;if(_['isArrayLikeObject'](_0x4d8f3c[_0xfb5b('0x34')])){if(!_['isNil'](_0x36e376)){_0x5456f0=_[_0xfb5b('0x35')](_0x4d8f3c[_0xfb5b('0x34')],function(_0x2a95c4){return _0x2a95c4[_0xfb5b('0x36')]===_0x36e376;});}if(_0x5456f0>=0x0){logger[_0xfb5b('0x37')](_0xfb5b('0x38'));}else{logger[_0xfb5b('0x37')](_0xfb5b('0x39'));_0x5456f0=_[_0xfb5b('0x35')](_0x4d8f3c['users'],function(_0x44a309){return _0x44a309[_0xfb5b('0x3a')]['name']===_0xfb5b('0x3b');});}return _0x4d8f3c[_0xfb5b('0x34')][_0x5456f0];}else{if(_0x4d8f3c[_0xfb5b('0x3c')][_0xfb5b('0x3a')][_0xfb5b('0x19')]===_0xfb5b('0x3b')){logger[_0xfb5b('0x37')]('Using\x20the\x20admin\x20account!');user=_0x4d8f3c[_0xfb5b('0x3c')];return user;}else{logger['error'](_0xfb5b('0x3d'),JSON[_0xfb5b('0xd')](_0x4d8f3c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfb5b('0xd')](_0x4d8f3c));}}}else{logger[_0xfb5b('0x2b')](_0xfb5b('0x3d'),JSON[_0xfb5b('0xd')](_0x4d8f3c));throw new Error(_0xfb5b('0x3e')+JSON[_0xfb5b('0xd')](_0x4d8f3c));}})[_0xfb5b('0x2a')](function(_0x234bd4){console[_0xfb5b('0x2b')](_0x234bd4);});}function getZohoUser(_0x2a4a7d,_0x200795){return new BPromise(function(_0x29a5f6,_0x1a70b5){request(_0x2a4a7d)[_0xfb5b('0x28')](function(_0x357c7d){var _0x25b93d=null;if(_0x357c7d){_0x25b93d=_0x357c7d[_0xfb5b('0x3f')][0x0];_0x25b93d[_0xfb5b('0x40')]=_0x200795;}_0x29a5f6(_0x25b93d);})[_0xfb5b('0x2a')](function(_0x5f74a7){_0x1a70b5(_0x5f74a7);});});}function createEndUser(_0x474c2f,_0xe01a76,_0x4959e0,_0x123801,_0x1a7635,_0xb6d303){var _0x4959e0=getName(_0x4959e0);return request({'method':_0xfb5b('0x24'),'uri':_0xfb5b('0x41')+_0xe01a76+_0xfb5b('0x42')+_[_0xfb5b('0x43')](_0xb6d303[_0xfb5b('0x44')])+'s','body':{'data':[{'Last_Name':_0x4959e0[0x1],'First_Name':_0x4959e0[0x0],'Phone':_0x123801,'Owner':{'name':!_['isNil'](_0x1a7635['role'][_0xfb5b('0x19')])?_0x1a7635[_0xfb5b('0x45')]['name']:!_[_0xfb5b('0x1c')](_0x1a7635[_0xfb5b('0x46')])?_0x1a7635[_0xfb5b('0x46')]+'\x20'+_0x1a7635[_0xfb5b('0x47')]:_0x1a7635[_0xfb5b('0x47')],'id':_0x1a7635['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x474c2f},'json':!![]})[_0xfb5b('0x28')](function(_0x3e1b0b){if(_0x3e1b0b&&_0x3e1b0b['data'][0x0][_0xfb5b('0x48')]===_0xfb5b('0x49')){var _0x77f1b4=_0x3e1b0b['data'][0x0][_0xfb5b('0x4a')];_0x77f1b4[_0xfb5b('0x40')]=_[_0xfb5b('0x43')](_0xb6d303['moduleCreate'])+'s';return _0x77f1b4;}logger[_0xfb5b('0x2b')](_0xfb5b('0x3d'),JSON[_0xfb5b('0xd')](data));throw new Error(_0xfb5b('0x4b')+JSON[_0xfb5b('0xd')](data));})[_0xfb5b('0x2a')](function(_0x58d4a5){console[_0xfb5b('0x4c')](_0xfb5b('0x4d'),_0x58d4a5);});}function getEndUser(_0x405cc1,_0x40e0a3,_0x151295,_0x581df9,_0x26de0d,_0x15249d,_0x462907){var _0x43e2e7={'method':_0xfb5b('0x2f'),'uri':'','headers':{'Authorization':_0xfb5b('0x33')+_0x405cc1},'json':!![]};switch(_0x462907[_0xfb5b('0x4e')]){case _0xfb5b('0x4f'):_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+_0xfb5b('0x51')+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x52'))[_0xfb5b('0x28')](function(_0x3bd16e){if(_0x3bd16e)return _0x3bd16e;_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+_0xfb5b('0x53')+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x54'))[_0xfb5b('0x28')](function(_0x18cf14){if(_0x18cf14)return _0x18cf14;if(_0x462907[_0xfb5b('0x44')]!=_0xfb5b('0x55')){return createEndUser(_0x405cc1,_0x40e0a3,_0x581df9,_0x26de0d,_0x15249d,_0x462907);}else{return{};}});});break;case _0xfb5b('0x56'):_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x52'))['then'](function(_0x1273d9){if(_0x1273d9)return _0x1273d9;if(_0x462907[_0xfb5b('0x44')]!=_0xfb5b('0x55')){return createEndUser(_0x405cc1,_0x40e0a3,_0x581df9,_0x26de0d,_0x15249d,_0x462907);}else{return{};}});break;case'lead':_0x43e2e7[_0xfb5b('0x50')]=_0xfb5b('0x41')+_0x40e0a3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x26de0d+'))';return getZohoUser(_0x43e2e7,_0xfb5b('0x54'))[_0xfb5b('0x28')](function(_0x5b7973){if(_0x5b7973)return _0x5b7973;if(_0x462907[_0xfb5b('0x44')]!=_0xfb5b('0x55')){return createEndUser(_0x405cc1,_0x40e0a3,_0x581df9,_0x26de0d,_0x15249d,_0x462907);}else{return{};}});break;}}function getCall(_0x52751e,_0x70fc56,_0x52eeda,_0x2e563a,_0x321815,_0x63be51,_0x4ae71c,_0x56b6e7){logger[_0xfb5b('0x37')](_0xfb5b('0x57'));var _0x502699={};_0x502699[_0xfb5b('0x58')]={'name':!_[_0xfb5b('0x1c')](_0x2e563a[_0xfb5b('0x45')][_0xfb5b('0x19')])&&!_[_0xfb5b('0x1c')](_0x2e563a[_0xfb5b('0x3a')][_0xfb5b('0x19')])&&_0x2e563a[_0xfb5b('0x3a')][_0xfb5b('0x19')]===_0xfb5b('0x59')?_0x2e563a[_0xfb5b('0x45')][_0xfb5b('0x19')]:!_[_0xfb5b('0x1c')](_0x2e563a[_0xfb5b('0x46')])?_0x2e563a[_0xfb5b('0x46')]+'\x20'+_0x2e563a[_0xfb5b('0x47')]:_0x2e563a[_0xfb5b('0x47')],'id':_0x2e563a['id']};_0x502699['Subject']=intUtil[_0xfb5b('0x5a')](_0x63be51[_0xfb5b('0x5b')],_0x4ae71c,'\x20');_0x502699[_0xfb5b('0x5c')]=intUtil[_0xfb5b('0x5a')](_0x63be51[_0xfb5b('0x5d')],_0x4ae71c,'\x0a');if(_0x321815[_0xfb5b('0x40')]===_0xfb5b('0x52')){_0x502699[_0xfb5b('0x5e')]={'name':!_[_0xfb5b('0x1c')](_0x321815[_0xfb5b('0x5f')])?_0x321815[_0xfb5b('0x5f')]:!_[_0xfb5b('0x1c')](_0x321815[_0xfb5b('0x60')])?_0x321815['First_Name']+'\x20'+_0x321815['Last_Name']:_0x321815[_0xfb5b('0x61')],'id':_0x321815['id']};}if(_0x321815[_0xfb5b('0x40')]===_0xfb5b('0x54')){_0x502699[_0xfb5b('0x62')]={'name':!_['isNil'](_0x321815[_0xfb5b('0x5f')])?_0x321815[_0xfb5b('0x5f')]:!_[_0xfb5b('0x1c')](_0x321815[_0xfb5b('0x60')])?_0x321815[_0xfb5b('0x60')]+'\x20'+_0x321815[_0xfb5b('0x61')]:_0x321815['Last_Name'],'id':_0x321815['id']};_0x502699['$se_module']=_[_0xfb5b('0x43')](_0x321815['enduserType']);}if(_0x4ae71c[_0xfb5b('0x63')]){_0x502699[_0xfb5b('0x64')]=moment[_0xfb5b('0x65')](parseInt(_0x4ae71c[_0xfb5b('0x63')])*0x3e8)[_0xfb5b('0x30')](_0xfb5b('0x66'));}else if(_0x4ae71c[_0xfb5b('0x67')]&&_0x4ae71c[_0xfb5b('0x68')]){_0x502699[_0xfb5b('0x64')]=moment[_0xfb5b('0x65')](moment(_0x4ae71c[_0xfb5b('0x68')],_0xfb5b('0x69'))[_0xfb5b('0x6a')](moment(_0x4ae71c[_0xfb5b('0x6b')],'YYYY-MM-DDTHH:mm:ss')))[_0xfb5b('0x30')](_0xfb5b('0x66'));}switch(_0x4ae71c['lastevent']){case _0xfb5b('0x6c'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x6e');break;case _0xfb5b('0x6f'):case _0xfb5b('0x70'):_0x502699['Call_Result']='Answered';break;case _0xfb5b('0x71'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x72');break;case _0xfb5b('0x73'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x74');break;case _0xfb5b('0x75'):_0x502699[_0xfb5b('0x6d')]=_0xfb5b('0x76');default:}_0x502699[_0xfb5b('0x77')]=(_0x56b6e7==='outbound'?moment(_0x4ae71c[_0xfb5b('0x6b')])[_0xfb5b('0x30')](_0xfb5b('0x69')):moment(_0x4ae71c[_0xfb5b('0x78')])[_0xfb5b('0x30')](_0xfb5b('0x69')))||moment()[_0xfb5b('0x30')](_0xfb5b('0x69'));_0x502699[_0xfb5b('0x79')]=_0x56b6e7||_0xfb5b('0x7a');_0x502699=_['merge'](_0x502699,getCustomFields(_0x63be51[_0xfb5b('0x7b')],_0x4ae71c));return request({'method':'POST','uri':_0xfb5b('0x41')+_0x70fc56+_0xfb5b('0x7c'),'headers':{'Authorization':_0xfb5b('0x33')+_0x52751e},'body':{'data':[_0x502699]},'json':!![]})[_0xfb5b('0x28')](function(_0x4b052d){if(_0x4b052d&&_0x4b052d['data'][0x0][_0xfb5b('0x48')]===_0xfb5b('0x49')){logger[_0xfb5b('0x37')]('Call\x20created!');return{'id':_0x4b052d[_0xfb5b('0x3f')][0x0][_0xfb5b('0x4a')]['id']};}})['catch'](function(_0x33002c){logger[_0xfb5b('0x37')](_0xfb5b('0x7d'),_0x33002c[_0xfb5b('0x2d')]);console[_0xfb5b('0x4c')](_0xfb5b('0x7d'),_0x33002c);});}exports[_0xfb5b('0x7e')]=function(_0xc09d52,_0x3207b9,_0x3b7a54,_0x2dc0e6,_0x1c5de0,_0x3b78a4){var _0x2b6b33,_0x3b8de1,_0x5d0fa3;_0x3b78a4['host']=intUtil['stripTrailingSlash'](_0x3b78a4[_0xfb5b('0x7f')]);_0x3b78a4[_0xfb5b('0x80')]=intUtil['stripTrailingSlash'](_0x3b78a4[_0xfb5b('0x80')]);if(_0x1c5de0&&_0x1c5de0[_0xfb5b('0x81')]){logger[_0xfb5b('0x37')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3207b9[_0xfb5b('0x82')]=_0x3b78a4[_0xfb5b('0x80')]+_0xfb5b('0x83')+_0x3207b9['uniqueid']+_0xfb5b('0x84')+md5(_0x3207b9[_0xfb5b('0x85')]);}else{_0x3207b9[_0xfb5b('0x82')]='';}var _0x53db4f=_0x3b78a4[_0xfb5b('0x7f')]==='zoho.eu'?'eu':_0xfb5b('0x86');return getAccessToken(_0x3b78a4)[_0xfb5b('0x28')](function(_0x5a0090){_0x5d0fa3=_0x5a0090;return getUser(_0x5d0fa3,_0x53db4f,_0x3b78a4,_0x2dc0e6[_0xfb5b('0x36')]);})[_0xfb5b('0x28')](function(_0x3a8d42){_0x2b6b33=_0x3a8d42;logger[_0xfb5b('0x37')](_0xfb5b('0x87'),_0x2b6b33['id']);return getEndUser(_0x5d0fa3,_0x53db4f,_0x3b78a4,_0x3207b9[_0xfb5b('0x88')],_0x3207b9[_0xfb5b('0x89')],_0x2b6b33,_0x3b7a54);})[_0xfb5b('0x28')](function(_0x3a6aa8){_0x3b8de1=_0x3a6aa8;return getCall(_0x5d0fa3,_0x53db4f,_0x3b78a4,_0x2b6b33,_0x3b8de1,_0x3b7a54,_0x3207b9,'Inbound');})[_0xfb5b('0x28')](function(_0x3367ec){if(_0x3367ec){logger[_0xfb5b('0x37')](_0xfb5b('0x8a'),_0x3367ec['id']);logger[_0xfb5b('0x37')](_0xfb5b('0x8b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfb5b('0x30')](_0xfb5b('0x8c'),_0x2dc0e6[_0xfb5b('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3b78a4[_0xfb5b('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3367ec['id']});}})['catch'](function(_0xaac273){logger[_0xfb5b('0x2b')](_0xfb5b('0x8b'),JSON['stringify'](_0xaac273));});};exports[_0xfb5b('0x8d')]=function(_0x3c5900,_0x33281e,_0x17a8b3,_0x505e0f,_0x135972,_0x384b3b,_0x5aa638){var _0x19f1fb,_0x390fb1,_0x48d4f2;_0x384b3b[_0xfb5b('0x7f')]=intUtil[_0xfb5b('0x8e')](_0x384b3b[_0xfb5b('0x7f')]);_0x384b3b[_0xfb5b('0x80')]=intUtil[_0xfb5b('0x8e')](_0x384b3b[_0xfb5b('0x80')]);if(_0x5aa638&&_0x5aa638[_0xfb5b('0x8f')]&&_0x5aa638[_0xfb5b('0x8f')]!==_0xfb5b('0x90')){logger[_0xfb5b('0x37')](_0xfb5b('0x91'),_0xfb5b('0x92'));_0x33281e[_0xfb5b('0x82')]=_0x384b3b[_0xfb5b('0x80')]+'/api/voice/recordings/'+_0x33281e['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x33281e['uniqueid']);}var _0x3212ee=_0x384b3b[_0xfb5b('0x7f')]===_0xfb5b('0x93')?'eu':_0xfb5b('0x86');return getAccessToken(_0x384b3b)[_0xfb5b('0x28')](function(_0x1f179e){_0x48d4f2=_0x1f179e;return getUser(_0x48d4f2,_0x3212ee,_0x384b3b,_0x505e0f['email']);})[_0xfb5b('0x28')](function(_0x140798){_0x19f1fb=_0x140798;logger[_0xfb5b('0x37')](_0xfb5b('0x87'),_0x19f1fb['id']);return getEndUser(_0x48d4f2,_0x3212ee,_0x384b3b,_0x33281e[_0xfb5b('0x94')],_0x33281e[_0xfb5b('0x95')],_0x19f1fb,_0x17a8b3);})[_0xfb5b('0x28')](function(_0x31060d){_0x390fb1=_0x31060d;return getCall(_0x48d4f2,_0x3212ee,_0x384b3b,_0x19f1fb,_0x390fb1,_0x17a8b3,_0x33281e,'Outbound');})[_0xfb5b('0x28')](function(_0x20ca59){if(_0x20ca59){logger[_0xfb5b('0x37')](_0xfb5b('0x8a'),_0x20ca59['id']);logger[_0xfb5b('0x37')](_0xfb5b('0x91'),_0xfb5b('0x96'));emit(util[_0xfb5b('0x30')]('user:%s',_0x505e0f[_0xfb5b('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x384b3b[_0xfb5b('0x7f')]+_0xfb5b('0x97')+_0x20ca59['id']});}})['catch'](function(_0x4b2f3b){logger[_0xfb5b('0x2b')](_0xfb5b('0x91'),JSON[_0xfb5b('0xd')](_0x4b2f3b));});};exports['unmanaged']=function(_0x4564de,_0x3a92c9,_0x57e3f3,_0x4f5450,_0x2d18c0,_0xa74865){var _0x369302,_0x5f369d,_0x20f0eb;_0xa74865[_0xfb5b('0x7f')]=intUtil['stripTrailingSlash'](_0xa74865[_0xfb5b('0x7f')]);_0xa74865[_0xfb5b('0x80')]=intUtil[_0xfb5b('0x8e')](_0xa74865[_0xfb5b('0x80')]);if(_0x2d18c0&&_0x2d18c0[_0xfb5b('0x81')]){logger[_0xfb5b('0x37')]('['+_0x3a92c9['lastevent'][_0xfb5b('0x98')]()+']',_0xfb5b('0x92'));_0x3a92c9[_0xfb5b('0x82')]=_0xa74865[_0xfb5b('0x80')]+_0xfb5b('0x83')+_0x3a92c9[_0xfb5b('0x85')]+_0xfb5b('0x84')+md5(_0x3a92c9[_0xfb5b('0x85')]);}else{_0x3a92c9[_0xfb5b('0x82')]='';}var _0x539506=_0xa74865[_0xfb5b('0x7f')]==='zoho.eu'?'eu':_0xfb5b('0x86');return getAccessToken(_0xa74865)[_0xfb5b('0x28')](function(_0x23dbee){_0x20f0eb=_0x23dbee;return getUser(_0x20f0eb,_0x539506,_0xa74865);})[_0xfb5b('0x28')](function(_0x89a7e4){_0x369302=_0x89a7e4;logger[_0xfb5b('0x37')](_0xfb5b('0x87'),_0x369302['id']);return getEndUser(_0x20f0eb,_0x539506,_0xa74865,_0x3a92c9[_0xfb5b('0x88')],_0x3a92c9['calleridnum'],_0x369302,_0x57e3f3);})[_0xfb5b('0x28')](function(_0x4a9779){_0x5f369d=_0x4a9779;return getCall(_0x20f0eb,_0x539506,_0xa74865,_0x369302,_0x5f369d,_0x57e3f3,_0x3a92c9,_0xfb5b('0x7a'));})[_0xfb5b('0x28')](function(_0x3404df){if(_0x3404df){logger['info']('The\x20Call\x20ID\x20is:',_0x3404df['id']);}})[_0xfb5b('0x2a')](function(_0x5659e9){logger['error']('['+_0x3a92c9[_0xfb5b('0x99')][_0xfb5b('0x98')]()+']',JSON[_0xfb5b('0xd')](_0x5659e9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 15e46a8..6f46a6a 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(_0x5f4cb6,_0x361194){var _0x26efe1=function(_0x34d743){while(--_0x34d743){_0x5f4cb6['push'](_0x5f4cb6['shift']());}};_0x26efe1(++_0x361194);}(_0x7a54,0x106));var _0x47a5=function(_0x1bf68e,_0x368bb7){_0x1bf68e=_0x1bf68e-0x0;var _0x5e5fda=_0x7a54[_0x1bf68e];return _0x5e5fda;};'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(_0xa79b45,_0x5b2a24){var _0x10a5ee=function(_0x4561f8){while(--_0x4561f8){_0xa79b45['push'](_0xa79b45['shift']());}};_0x10a5ee(++_0x5b2a24);}(_0x7a54,0x106));var _0x47a5=function(_0x513d77,_0x3ab23d){_0x513d77=_0x513d77-0x0;var _0xcd9033=_0x7a54[_0x513d77];return _0xcd9033;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 0a63449..b1ca38f 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 _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x52e1a2,_0xa9dde){var _0xb3b25a=function(_0x2b512d){while(--_0x2b512d){_0x52e1a2['push'](_0x52e1a2['shift']());}};_0xb3b25a(++_0xa9dde);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb10b[_0x3f3f40];return _0x403b7a;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x40fc2c,_0x434bc1){var _0x37d2f7=function(_0x5c3fe2){while(--_0x5c3fe2){_0x40fc2c['push'](_0x40fc2c['shift']());}};_0x37d2f7(++_0x434bc1);}(_0x7a54,0x106));var _0x47a5=function(_0xeb4716,_0x57acf6){_0xeb4716=_0xeb4716-0x0;var _0x5eb76a=_0x7a54[_0xeb4716];return _0x5eb76a;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index d1f9f2a..e5f0d91 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 _0x55d2=['message','catch','exports','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x55d2,0x9f));var _0x255d=function(_0x30dbb0,_0x59a6b7){_0x30dbb0=_0x30dbb0-0x0;var _0x7512b8=_0x55d2[_0x30dbb0];return _0x7512b8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x255d('0x0'))(_0x255d('0x1'));var client=jayson[_0x255d('0x2')][_0x255d('0x3')]({'port':0x2329});client[_0x255d('0x4')]=function(_0x2c9d29,_0x57cbc1){return new BPromise(function(_0x44e16c,_0x217a7b){return client[_0x255d('0x5')](_0x2c9d29,_0x57cbc1)[_0x255d('0x6')](function(_0x58dae4){logger['debug'](_0x255d('0x7'),_0x255d('0x1'),_0x2c9d29,_0x57cbc1,_0x58dae4);if(_0x58dae4[_0x255d('0x8')]){logger[_0x255d('0x8')](_0x255d('0x7'),'routing',_0x2c9d29,_0x58dae4['error']['message'],_0x57cbc1);return _0x217a7b(_0x58dae4['error'][_0x255d('0x9')]);}else{return _0x44e16c(_0x58dae4['result']);}})[_0x255d('0xa')](function(_0x2c3754){logger[_0x255d('0x8')]('rpc','routing',_0x2c9d29,_0x2c3754,_0x57cbc1);return _0x217a7b(_0x2c3754);});});};module[_0x255d('0xb')]=client; \ No newline at end of file +var _0xb90d=['exports','bluebird','../../config/logger','routing','client','http','Request','debug','rpc','error','message','result','catch'];(function(_0x5d5bbb,_0x50683a){var _0x56340d=function(_0x53efcd){while(--_0x53efcd){_0x5d5bbb['push'](_0x5d5bbb['shift']());}};_0x56340d(++_0x50683a);}(_0xb90d,0x17a));var _0xdb90=function(_0x7902d0,_0x378152){_0x7902d0=_0x7902d0-0x0;var _0x2ab4ac=_0xb90d[_0x7902d0];return _0x2ab4ac;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdb90('0x0'));var logger=require(_0xdb90('0x1'))(_0xdb90('0x2'));var client=jayson[_0xdb90('0x3')][_0xdb90('0x4')]({'port':0x2329});client[_0xdb90('0x5')]=function(_0x4a9a1f,_0x3db22e){return new BPromise(function(_0x12db41,_0x1b7d75){return client['request'](_0x4a9a1f,_0x3db22e)['then'](function(_0x2cc7cd){logger[_0xdb90('0x6')](_0xdb90('0x7'),_0xdb90('0x2'),_0x4a9a1f,_0x3db22e,_0x2cc7cd);if(_0x2cc7cd['error']){logger[_0xdb90('0x8')](_0xdb90('0x7'),_0xdb90('0x2'),_0x4a9a1f,_0x2cc7cd['error'][_0xdb90('0x9')],_0x3db22e);return _0x1b7d75(_0x2cc7cd[_0xdb90('0x8')][_0xdb90('0x9')]);}else{return _0x12db41(_0x2cc7cd[_0xdb90('0xa')]);}})[_0xdb90('0xb')](function(_0x48eb30){logger['error']('rpc',_0xdb90('0x2'),_0x4a9a1f,_0x48eb30,_0x3db22e);return _0x1b7d75(_0x48eb30);});});};module[_0xdb90('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4086390..20246df 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 _0x455d=['getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','./realtime','./lib/email','./rpc/mailAccount','resolve','then'];(function(_0xef6efc,_0x2813e2){var _0x515676=function(_0x48115d){while(--_0x48115d){_0xef6efc['push'](_0xef6efc['shift']());}};_0x515676(++_0x2813e2);}(_0x455d,0x190));var _0xd455=function(_0x457159,_0x3111e2){_0x457159=_0x457159-0x0;var _0x64539b=_0x455d[_0x457159];return _0x64539b;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xd455('0x0'));var EmailChannel=require(_0xd455('0x1'));var mailAccount=require(_0xd455('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xd455('0x3')]()[_0xd455('0x4')](mailAccount[_0xd455('0x5')]())[_0xd455('0x4')](realtime[_0xd455('0x6')]())[_0xd455('0x4')](function(){email[_0xd455('0x7')](realtime[_0xd455('0x8')]);return realtime;});}function main(){return server[_0xd455('0x9')](realtime,email)['then'](function(_0x2bbebf){return initRealtime();})[_0xd455('0x4')](function(_0x4ef696){return db[_0xd455('0xa')][_0xd455('0xb')]({'attributes':['id',_0xd455('0xc')],'raw':!![]});})[_0xd455('0x4')](function(_0x5cdf73){return setInterval(initRealtime,_0x5cdf73[_0xd455('0xc')]*0x3e8);})[_0xd455('0xd')](function(_0x5a4f0f){console[_0xd455('0xe')](_0x5a4f0f);});}main(); \ No newline at end of file +var _0xb673=['./rpc/mailAccount','../../mysqldb','then','getMailAccounts','mailAccounts','listen','loginMailFrequency','catch','log','bluebird','./server','./lib/email'];(function(_0x3d381e,_0x2a72b1){var _0x5c3e38=function(_0x3e3a26){while(--_0x3e3a26){_0x3d381e['push'](_0x3d381e['shift']());}};_0x5c3e38(++_0x2a72b1);}(_0xb673,0xa5));var _0x3b67=function(_0x2c7643,_0x15ac43){_0x2c7643=_0x2c7643-0x0;var _0xb1b48c=_0xb673[_0x2c7643];return _0xb1b48c;};'use strict';var BPromise=require(_0x3b67('0x0'));var server=require(_0x3b67('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x3b67('0x2'));var mailAccount=require(_0x3b67('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x3b67('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0x3b67('0x5')](mailAccount[_0x3b67('0x6')]())[_0x3b67('0x5')](realtime['initMailAccounts']())[_0x3b67('0x5')](function(){email['refresh'](realtime[_0x3b67('0x7')]);return realtime;});}function main(){return server[_0x3b67('0x8')](realtime,email)[_0x3b67('0x5')](function(_0x329729){return initRealtime();})['then'](function(_0x4c63d3){return db['Setting']['findOne']({'attributes':['id',_0x3b67('0x9')],'raw':!![]});})['then'](function(_0x2571fe){return setInterval(initRealtime,_0x2571fe['loginMailFrequency']*0x3e8);})[_0x3b67('0xa')](function(_0x42cb21){console[_0x3b67('0xb')](_0x42cb21);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8a57824..ccd4faf 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 _0x24c3=['firstName','lastName','from','notify','then','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x52e94f,_0x5285be){var _0x1bcad0=function(_0x2236ac){while(--_0x2236ac){_0x52e94f['push'](_0x52e94f['shift']());}};_0x1bcad0(++_0x5285be);}(_0x24c3,0x170));var _0x324c=function(_0x374bba,_0x2c2841){_0x374bba=_0x374bba-0x0;var _0x7735d2=_0x24c3[_0x374bba];return _0x7735d2;};'use strict';var _=require(_0x324c('0x0'));var moment=require(_0x324c('0x1'));var BPromise=require(_0x324c('0x2'));var md5=require(_0x324c('0x3'));var Redis=require(_0x324c('0x4'));var config=require(_0x324c('0x5'));var logger=require(_0x324c('0x6'))(_0x324c('0x7'));config[_0x324c('0x8')]=_[_0x324c('0x9')](config['redis'],{'host':_0x324c('0xa'),'port':0x18eb});var io=require(_0x324c('0xb'))(new Redis(config[_0x324c('0x8')]));var EmailImap=require(_0x324c('0xc'));var EmailSmtp=require(_0x324c('0xd'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2f61f1){logger['info'](_0x324c('0xe'));this[_0x324c('0xf')]=_0x2f61f1[_0x324c('0xf')];this[_0x324c('0x10')]={};this[_0x324c('0x11')]=new EmailSmtp();}EmailChannel[_0x324c('0x12')][_0x324c('0x13')]=function(_0x20dd1a){var _0x28c489=this[_0x324c('0xf')][_0x20dd1a];var _0x2a84a7={'id':_0x28c489['id'],'name':_0x28c489[_0x324c('0x14')],'key':_0x28c489[_0x324c('0x15')],'active':_0x28c489[_0x324c('0x16')],'Imap':{'status':_0x28c489[_0x324c('0x17')][_0x324c('0x18')],'messageStatus':_0x28c489[_0x324c('0x17')][_0x324c('0x19')],'total':_0x28c489[_0x324c('0x17')][_0x324c('0x1a')]}};if(_['isNil'](md5Accounts[_0x20dd1a])){md5Accounts[_0x20dd1a]={};}var _0x1ad90c=md5(JSON[_0x324c('0x1b')](_0x2a84a7));if(md5Accounts[_0x20dd1a]['md5']!==_0x1ad90c){md5Accounts[_0x20dd1a][_0x324c('0x3')]=_0x1ad90c;io[_0x324c('0x13')](_0x324c('0x1c'),_0x2a84a7);}};EmailChannel[_0x324c('0x12')][_0x324c('0x1d')]=function(_0x2e4c70){for(var _0x2e9e1a in _0x2e4c70){if(_0x2e4c70[_0x324c('0x1e')](_0x2e9e1a)){if(_0x2e4c70[_0x2e9e1a][_0x324c('0x17')]&&_0x2e4c70[_0x2e9e1a]['active']){var _0x169094=_0x2e4c70[_0x2e9e1a][_0x324c('0x17')];if(!this[_0x324c('0x10')][_0x324c('0x1e')](_0x169094['id'])){this[_0x324c('0x10')][_0x169094['id']]=new EmailImap(_0x169094,_0x2e4c70[_0x2e9e1a]['email']);this[_0x324c('0x10')][_0x169094['id']]['on'](_0x324c('0x1f'),this[_0x324c('0x20')][_0x324c('0x21')](this,_0x2e9e1a));this['imapAccounts'][_0x169094['id']]['on'](_0x324c('0x7'),this[_0x324c('0x22')][_0x324c('0x21')](this,_0x2e9e1a));this['imapAccounts'][_0x169094['id']]['on'](_0x324c('0x23'),this[_0x324c('0x24')][_0x324c('0x21')](this,_0x2e9e1a));this[_0x324c('0x10')][_0x169094['id']]['on'](_0x324c('0x25'),this[_0x324c('0x26')][_0x324c('0x21')](this,_0x2e9e1a));}}else{if(_[_0x324c('0x27')](this[_0x324c('0xf')][_0x2e9e1a][_0x324c('0x17')])){this[_0x324c('0xf')][_0x2e9e1a][_0x324c('0x17')]={};}this[_0x324c('0xf')][_0x2e9e1a]['Imap'][_0x324c('0x18')]=_0x324c('0x28');this[_0x324c('0xf')][_0x2e9e1a][_0x324c('0x17')][_0x324c('0x19')]='';this[_0x324c('0x13')](_0x2e9e1a);}}}};EmailChannel[_0x324c('0x12')]['handleImapBox']=function(_0x1a7123,_0x6f2de9){if(this['mailAccounts'][_0x1a7123]){this['mailAccounts'][_0x1a7123][_0x324c('0x17')][_0x324c('0x18')]=_0x324c('0x29');this[_0x324c('0xf')][_0x1a7123][_0x324c('0x17')][_0x324c('0x19')]=_0x6f2de9[_0x324c('0x14')];if(_0x6f2de9[_0x324c('0x2a')]){this[_0x324c('0xf')][_0x1a7123][_0x324c('0x17')][_0x324c('0x1a')]=_0x6f2de9['messages'][_0x324c('0x1a')];}return this[_0x324c('0x13')](_0x1a7123);}};EmailChannel[_0x324c('0x12')]['handleImapEmail']=function(_0x39d9ad,_0x45c97b){logger[_0x324c('0x2b')](_0x324c('0x2c'),_0x45c97b[_0x324c('0x2d')],_0x45c97b[_0x324c('0x2e')],_0x45c97b[_0x324c('0x2f')],_0x39d9ad);if(this['mailAccounts'][_0x39d9ad]){return mailAccount[_0x324c('0x30')](_0x39d9ad,_0x45c97b)[_0x324c('0x31')](function(_0x5377ed){if(_0x5377ed){logger[_0x324c('0x2b')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x5f0a69){logger[_0x324c('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5f0a69));});}};EmailChannel[_0x324c('0x12')][_0x324c('0x24')]=function(_0x1c5d93){if(this[_0x324c('0xf')][_0x1c5d93]&&this[_0x324c('0xf')][_0x1c5d93][_0x324c('0x17')]){if(this['imapAccounts'][this[_0x324c('0xf')][_0x1c5d93]['Imap']['id']]){delete this[_0x324c('0x10')][this[_0x324c('0xf')][_0x1c5d93][_0x324c('0x17')]['id']];}this['mailAccounts'][_0x1c5d93][_0x324c('0x17')][_0x324c('0x32')]=moment();this[_0x324c('0x13')](_0x1c5d93);}};EmailChannel[_0x324c('0x12')][_0x324c('0x26')]=function(_0x10c5fc,_0x5ac219){if(this[_0x324c('0xf')][_0x10c5fc]){this[_0x324c('0xf')][_0x10c5fc][_0x324c('0x17')][_0x324c('0x18')]=_0x324c('0x25');this[_0x324c('0xf')][_0x10c5fc][_0x324c('0x17')][_0x324c('0x19')]=_0x5ac219;return this[_0x324c('0x13')](_0x10c5fc);}};EmailChannel[_0x324c('0x12')][_0x324c('0x33')]=function(_0x4719a7,_0x47d191){return this[_0x324c('0x11')][_0x324c('0x34')](_0x4719a7,_0x47d191);};EmailChannel[_0x324c('0x12')][_0x324c('0x35')]=function(_0x30d2b4){var _0x482347=this;if(this[_0x324c('0xf')][_0x30d2b4['id']]){if(_[_0x324c('0x27')](this[_0x324c('0xf')][_0x30d2b4['id']][_0x324c('0x36')])){this['mailAccounts'][_0x30d2b4['id']][_0x324c('0x36')]={};}this[_0x324c('0xf')][_0x30d2b4['id']][_0x324c('0x36')]['lastSync']=moment();return new BPromise(function(_0xd39995,_0x406784){return _0x482347[_0x324c('0x11')][_0x324c('0x37')](_0x30d2b4)[_0x324c('0x31')](function(_0x47144a){_0x482347['mailAccounts'][_0x30d2b4['id']][_0x324c('0x36')]['status']=_0x324c('0x38');_0x482347[_0x324c('0xf')][_0x30d2b4['id']]['Smtp'][_0x324c('0x19')]='';_0x482347['emit'](_0x30d2b4['id']);_0xd39995(_0x47144a);})[_0x324c('0x39')](function(_0x9f9ff3){_0x482347['mailAccounts'][_0x30d2b4['id']][_0x324c('0x36')][_0x324c('0x18')]='error';_0x482347[_0x324c('0xf')][_0x30d2b4['id']][_0x324c('0x36')]['messageStatus']=_0x9f9ff3;_0x482347[_0x324c('0x13')](_0x30d2b4['id']);_0x406784(_0x9f9ff3);});});}return this[_0x324c('0x11')]['verify'](_0x30d2b4);};module[_0x324c('0x3a')]=EmailChannel; \ No newline at end of file +var _0xb94d=['handleImapError','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','Imap','total','isNil','stringify','mailAccount:update','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0xb94d,0x82));var _0xdb94=function(_0x565d34,_0x4176da){_0x565d34=_0x565d34-0x0;var _0x3751e7=_0xb94d[_0x565d34];return _0x3751e7;};'use strict';var _=require(_0xdb94('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xdb94('0x1'));var Redis=require(_0xdb94('0x2'));var config=require(_0xdb94('0x3'));var logger=require(_0xdb94('0x4'))(_0xdb94('0x5'));config[_0xdb94('0x6')]=_[_0xdb94('0x7')](config[_0xdb94('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xdb94('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xdb94('0x9'));var EmailSmtp=require(_0xdb94('0xa'));var mailAccount=require(_0xdb94('0xb'));var md5Accounts={};function EmailChannel(_0x5068b3){logger[_0xdb94('0xc')](_0xdb94('0xd'));this[_0xdb94('0xe')]=_0x5068b3[_0xdb94('0xe')];this[_0xdb94('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xdb94('0x10')][_0xdb94('0x11')]=function(_0x455dc5){var _0x2dfef6=this[_0xdb94('0xe')][_0x455dc5];var _0x56bda4={'id':_0x2dfef6['id'],'name':_0x2dfef6[_0xdb94('0x12')],'key':_0x2dfef6[_0xdb94('0x13')],'active':_0x2dfef6[_0xdb94('0x14')],'Imap':{'status':_0x2dfef6['Imap'][_0xdb94('0x15')],'messageStatus':_0x2dfef6[_0xdb94('0x16')]['messageStatus'],'total':_0x2dfef6[_0xdb94('0x16')][_0xdb94('0x17')]}};if(_[_0xdb94('0x18')](md5Accounts[_0x455dc5])){md5Accounts[_0x455dc5]={};}var _0x5b438c=md5(JSON[_0xdb94('0x19')](_0x56bda4));if(md5Accounts[_0x455dc5][_0xdb94('0x1')]!==_0x5b438c){md5Accounts[_0x455dc5][_0xdb94('0x1')]=_0x5b438c;io[_0xdb94('0x11')](_0xdb94('0x1a'),_0x56bda4);}};EmailChannel['prototype']['refresh']=function(_0x5120b5){for(var _0x5547e7 in _0x5120b5){if(_0x5120b5['hasOwnProperty'](_0x5547e7)){if(_0x5120b5[_0x5547e7][_0xdb94('0x16')]&&_0x5120b5[_0x5547e7][_0xdb94('0x14')]){var _0x9ccc80=_0x5120b5[_0x5547e7][_0xdb94('0x16')];if(!this['imapAccounts'][_0xdb94('0x1b')](_0x9ccc80['id'])){this[_0xdb94('0xf')][_0x9ccc80['id']]=new EmailImap(_0x9ccc80,_0x5120b5[_0x5547e7][_0xdb94('0x5')]);this['imapAccounts'][_0x9ccc80['id']]['on'](_0xdb94('0x1c'),this[_0xdb94('0x1d')][_0xdb94('0x1e')](this,_0x5547e7));this[_0xdb94('0xf')][_0x9ccc80['id']]['on']('email',this[_0xdb94('0x1f')][_0xdb94('0x1e')](this,_0x5547e7));this[_0xdb94('0xf')][_0x9ccc80['id']]['on'](_0xdb94('0x20'),this[_0xdb94('0x21')][_0xdb94('0x1e')](this,_0x5547e7));this['imapAccounts'][_0x9ccc80['id']]['on'](_0xdb94('0x22'),this[_0xdb94('0x23')][_0xdb94('0x1e')](this,_0x5547e7));}}else{if(_[_0xdb94('0x18')](this['mailAccounts'][_0x5547e7]['Imap'])){this[_0xdb94('0xe')][_0x5547e7][_0xdb94('0x16')]={};}this['mailAccounts'][_0x5547e7]['Imap']['status']='disabled';this[_0xdb94('0xe')][_0x5547e7][_0xdb94('0x16')][_0xdb94('0x24')]='';this[_0xdb94('0x11')](_0x5547e7);}}}};EmailChannel[_0xdb94('0x10')][_0xdb94('0x1d')]=function(_0xe9bfa4,_0x3f794b){if(this[_0xdb94('0xe')][_0xe9bfa4]){this[_0xdb94('0xe')][_0xe9bfa4][_0xdb94('0x16')]['status']=_0xdb94('0x25');this[_0xdb94('0xe')][_0xe9bfa4][_0xdb94('0x16')][_0xdb94('0x24')]=_0x3f794b[_0xdb94('0x12')];if(_0x3f794b[_0xdb94('0x26')]){this[_0xdb94('0xe')][_0xe9bfa4][_0xdb94('0x16')][_0xdb94('0x17')]=_0x3f794b[_0xdb94('0x26')][_0xdb94('0x17')];}return this[_0xdb94('0x11')](_0xe9bfa4);}};EmailChannel[_0xdb94('0x10')][_0xdb94('0x1f')]=function(_0x11d681,_0x59ab13){logger['info'](_0xdb94('0x27'),_0x59ab13[_0xdb94('0x28')],_0x59ab13[_0xdb94('0x29')],_0x59ab13[_0xdb94('0x2a')],_0x11d681);if(this[_0xdb94('0xe')][_0x11d681]){return mailAccount[_0xdb94('0x2b')](_0x11d681,_0x59ab13)[_0xdb94('0x2c')](function(_0x5e7648){if(_0x5e7648){logger['info'](_0xdb94('0x2d'));}})['catch'](function(_0x5ecf9b){logger[_0xdb94('0x22')](_0xdb94('0x2e'),JSON[_0xdb94('0x19')](_0x5ecf9b));});}};EmailChannel[_0xdb94('0x10')][_0xdb94('0x21')]=function(_0x331daa){if(this['mailAccounts'][_0x331daa]&&this['mailAccounts'][_0x331daa][_0xdb94('0x16')]){if(this['imapAccounts'][this['mailAccounts'][_0x331daa][_0xdb94('0x16')]['id']]){delete this[_0xdb94('0xf')][this[_0xdb94('0xe')][_0x331daa][_0xdb94('0x16')]['id']];}this[_0xdb94('0xe')][_0x331daa][_0xdb94('0x16')][_0xdb94('0x2f')]=moment();this['emit'](_0x331daa);}};EmailChannel[_0xdb94('0x10')]['handleImapError']=function(_0x367da0,_0x2ad08a){if(this[_0xdb94('0xe')][_0x367da0]){this[_0xdb94('0xe')][_0x367da0][_0xdb94('0x16')]['status']=_0xdb94('0x22');this[_0xdb94('0xe')][_0x367da0][_0xdb94('0x16')][_0xdb94('0x24')]=_0x2ad08a;return this[_0xdb94('0x11')](_0x367da0);}};EmailChannel['prototype']['sendMail']=function(_0x44d768,_0x4496dc){return this[_0xdb94('0x30')][_0xdb94('0x31')](_0x44d768,_0x4496dc);};EmailChannel[_0xdb94('0x10')][_0xdb94('0x32')]=function(_0x18f1c0){var _0x4f3477=this;if(this['mailAccounts'][_0x18f1c0['id']]){if(_[_0xdb94('0x18')](this['mailAccounts'][_0x18f1c0['id']][_0xdb94('0x33')])){this[_0xdb94('0xe')][_0x18f1c0['id']]['Smtp']={};}this[_0xdb94('0xe')][_0x18f1c0['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x11922d,_0x29fb8c){return _0x4f3477[_0xdb94('0x30')][_0xdb94('0x34')](_0x18f1c0)[_0xdb94('0x2c')](function(_0x24cf4a){_0x4f3477['mailAccounts'][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x15')]=_0xdb94('0x35');_0x4f3477[_0xdb94('0xe')][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x24')]='';_0x4f3477['emit'](_0x18f1c0['id']);_0x11922d(_0x24cf4a);})['catch'](function(_0x5c76b9){_0x4f3477[_0xdb94('0xe')][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x15')]=_0xdb94('0x22');_0x4f3477['mailAccounts'][_0x18f1c0['id']][_0xdb94('0x33')][_0xdb94('0x24')]=_0x5c76b9;_0x4f3477[_0xdb94('0x11')](_0x18f1c0['id']);_0x29fb8c(_0x5c76b9);});});}return this[_0xdb94('0x30')]['verify'](_0x18f1c0);};module[_0xdb94('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 82fa539..c9b5536 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 _0xc5e0=['readUnseen','search','UNSEEN','handleReadUnseen','handleError','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','parser','emit','stringify','textCode','exports','util','imap','Iconv','EventEmitter','email','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','host','port','tls','autotls','required','password','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','box'];(function(_0x5d9ec9,_0x4a9500){var _0x1fd9f4=function(_0x379788){while(--_0x379788){_0x5d9ec9['push'](_0x5d9ec9['shift']());}};_0x1fd9f4(++_0x4a9500);}(_0xc5e0,0x1ad));var _0x0c5e=function(_0x47a78b,_0x15d996){_0x47a78b=_0x47a78b-0x0;var _0x4718ae=_0xc5e0[_0x47a78b];return _0x4718ae;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x0c5e('0x0'));var Imap=require(_0x0c5e('0x1'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0x0c5e('0x2')];var EventEmitter=require('events')[_0x0c5e('0x3')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x0c5e('0x4'));function EmailImap(_0x3067cd,_0x160d79){this['mailbox']=_0x0c5e('0x5');this[_0x0c5e('0x6')]=this[_0x0c5e('0x7')](_0x3067cd,_0x160d79);this[_0x0c5e('0x1')]=new Imap(this[_0x0c5e('0x6')]);this[_0x0c5e('0x1')][_0x0c5e('0x8')](_0x0c5e('0x9'),this[_0x0c5e('0xa')][_0x0c5e('0xb')](this));this['imap'][_0x0c5e('0x8')](_0x0c5e('0xc'),this[_0x0c5e('0xd')]['bind'](this));this[_0x0c5e('0x1')]['on'](_0x0c5e('0xe'),this['handleError'][_0x0c5e('0xb')](this));this[_0x0c5e('0x1')][_0x0c5e('0xf')]();}util[_0x0c5e('0x10')](EmailImap,EventEmitter);EmailImap[_0x0c5e('0x11')][_0x0c5e('0x7')]=function(_0x49953c,_0x114049){var _0x4280b1={'connTimeout':_0x49953c[_0x0c5e('0x12')]?_0x49953c[_0x0c5e('0x12')]*0x3e8:0x2710,'authTimeout':_0x49953c[_0x0c5e('0x13')]?_0x49953c[_0x0c5e('0x13')]*0x3e8:0x1388};if(_[_0x0c5e('0x14')](_0x49953c[_0x0c5e('0x15')])){if(_0x49953c['authentication']){_0x4280b1[_0x0c5e('0x16')]=_0x49953c[_0x0c5e('0x16')];_0x4280b1['password']=_0x49953c['password'];}_0x4280b1['host']=_0x49953c[_0x0c5e('0x17')];_0x4280b1[_0x0c5e('0x18')]=_0x49953c[_0x0c5e('0x18')]||0x3e1;if(_0x49953c[_0x0c5e('0x19')]){_0x4280b1['tls']=!![];}else{_0x4280b1[_0x0c5e('0x19')]=![];_0x4280b1[_0x0c5e('0x1a')]=_0x0c5e('0x1b');}}else{_0x4280b1[_0x0c5e('0x16')]=_0x49953c['user'];_0x4280b1[_0x0c5e('0x1c')]=_0x49953c[_0x0c5e('0x1c')];_0x4280b1['host']=utils[_0x0c5e('0x1d')](_0x49953c[_0x0c5e('0x15')]);_0x4280b1[_0x0c5e('0x18')]=0x3e1;_0x4280b1[_0x0c5e('0x19')]=!![];}_0x4280b1[_0x0c5e('0x4')]=_0x114049||_0x49953c[_0x0c5e('0x16')]||_0x0c5e('0x1e');return _0x4280b1;};EmailImap[_0x0c5e('0x11')][_0x0c5e('0xa')]=function(){this[_0x0c5e('0x1')][_0x0c5e('0x1f')](this[_0x0c5e('0x20')],![],this[_0x0c5e('0x21')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')]['handleOpenBox']=function(_0x41b663,_0x5576d0){if(_0x41b663){this['handleError'](_0x41b663,!![]);}else{this['emit'](_0x0c5e('0x22'),_0x5576d0);this['readUnseen']();}};EmailImap[_0x0c5e('0x11')]['handleCloseBox']=function(_0x20acd){if(_0x20acd){this['handleError'](_0x20acd,!![]);}else{this[_0x0c5e('0x1')][_0x0c5e('0xc')]();}};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x23')]=function(){this[_0x0c5e('0x1')][_0x0c5e('0x24')]([_0x0c5e('0x25')],this[_0x0c5e('0x26')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x26')]=function(_0xea6065,_0x5925f1){if(_0xea6065){this[_0x0c5e('0x27')](_0xea6065,!![]);}else{if(_0x5925f1[_0x0c5e('0x28')]){try{var _0xd0dc8c=this[_0x0c5e('0x1')][_0x0c5e('0x29')](_0x5925f1,{'bodies':'','markSeen':!![]});_0xd0dc8c['on'](_0x0c5e('0x2a'),this[_0x0c5e('0x2b')][_0x0c5e('0xb')](this));_0xd0dc8c[_0x0c5e('0x8')](_0x0c5e('0xe'),this[_0x0c5e('0x2c')]['bind'](this));_0xd0dc8c[_0x0c5e('0x8')](_0x0c5e('0xc'),this[_0x0c5e('0x2d')][_0x0c5e('0xb')](this));}catch(_0x239958){logger[_0x0c5e('0xe')](_0x239958);}}else{this[_0x0c5e('0x1')][_0x0c5e('0x2e')](!![],this[_0x0c5e('0x2f')][_0x0c5e('0xb')](this));}}};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x2b')]=function(_0x253f13,_0x92a763){_0x253f13['on'](_0x0c5e('0x30'),this['handleMessageBody'][_0x0c5e('0xb')](this));_0x253f13[_0x0c5e('0x8')](_0x0c5e('0x31'),this['handleMessageAttributes']['bind'](this));_0x253f13[_0x0c5e('0x8')]('end',this[_0x0c5e('0x32')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')]['handleMessageBody']=function(_0x401a60,_0x27e34b){simpleParser(_0x401a60,{'Iconv':Iconv},this['handleSimpleParser'][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x33')]=function(_0x5d4127){};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x32')]=function(){};EmailImap['prototype'][_0x0c5e('0x34')]=function(_0x23f1e7,_0x1561da){if(_0x23f1e7){logger[_0x0c5e('0xe')](_0x23f1e7);}else{var _0x57116b=this;utils[_0x0c5e('0x35')](this['account'],_0x1561da,function(_0x23cb95){_0x57116b[_0x0c5e('0x36')]('email',_0x23cb95);});}};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x2d')]=function(){this[_0x0c5e('0x1')][_0x0c5e('0x2e')](!![],this[_0x0c5e('0x2f')][_0x0c5e('0xb')](this));};EmailImap[_0x0c5e('0x11')][_0x0c5e('0x2c')]=function(_0x371731){this[_0x0c5e('0x27')](_0x371731);this[_0x0c5e('0x1')][_0x0c5e('0x2e')](!![],this[_0x0c5e('0x2f')][_0x0c5e('0xb')](this));};EmailImap['prototype'][_0x0c5e('0xd')]=function(){this['emit'](_0x0c5e('0xc'));};EmailImap['prototype'][_0x0c5e('0x27')]=function(_0x29d97e,_0x20ab58){logger[_0x0c5e('0xe')]('handleError',this['account'][_0x0c5e('0x4')],JSON[_0x0c5e('0x37')](_0x29d97e));var _0x239afa='';if(_0x29d97e){if(_0x29d97e[_0x0c5e('0x38')]){_0x239afa=_0x29d97e[_0x0c5e('0x38')];}else{for(var _0x1bc3f7 in _0x29d97e){if(_0x29d97e['hasOwnProperty'](_0x1bc3f7)){_0x239afa+=_['upperFirst'](_0x1bc3f7)+':\x20'+_0x29d97e[_0x1bc3f7]+'\x0a';}}}}if(_0x20ab58){this[_0x0c5e('0x1')][_0x0c5e('0xc')]();}else{this['emit'](_0x0c5e('0xe'),_0x239afa);this['emit'](_0x0c5e('0xc'));}};module[_0x0c5e('0x39')]=EmailImap; \ No newline at end of file +var _0x6e1d=['connect','getAccount','connTimeout','authTimeout','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','handleOpenBox','emit','readUnseen','prototype','handleCloseBox','end','search','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','ready','handleReady','bind','once','handleEnd','handleError'];(function(_0x568324,_0x11d7ea){var _0x261f1d=function(_0xc91bd4){while(--_0xc91bd4){_0x568324['push'](_0x568324['shift']());}};_0x261f1d(++_0x11d7ea);}(_0x6e1d,0x1bf));var _0xd6e1=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x6e1d[_0x2706da];return _0x3ba87e;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xd6e1('0x0'));var _=require(_0xd6e1('0x1'));var rs=require('randomstring');var simpleParser=require(_0xd6e1('0x2'))[_0xd6e1('0x3')];var Iconv=require('iconv')[_0xd6e1('0x4')];var EventEmitter=require(_0xd6e1('0x5'))[_0xd6e1('0x6')];var utils=require(_0xd6e1('0x7'));var logger=require(_0xd6e1('0x8'))(_0xd6e1('0x9'));function EmailImap(_0x262ad5,_0x1ca842){this[_0xd6e1('0xa')]='INBOX';this['account']=this['getAccount'](_0x262ad5,_0x1ca842);this[_0xd6e1('0x0')]=new Imap(this['account']);this['imap']['once'](_0xd6e1('0xb'),this[_0xd6e1('0xc')][_0xd6e1('0xd')](this));this[_0xd6e1('0x0')][_0xd6e1('0xe')]('end',this[_0xd6e1('0xf')][_0xd6e1('0xd')](this));this[_0xd6e1('0x0')]['on']('error',this[_0xd6e1('0x10')][_0xd6e1('0xd')](this));this[_0xd6e1('0x0')][_0xd6e1('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xd6e1('0x12')]=function(_0xca68c6,_0xc63f4a){var _0x4cab7b={'connTimeout':_0xca68c6[_0xd6e1('0x13')]?_0xca68c6[_0xd6e1('0x13')]*0x3e8:0x2710,'authTimeout':_0xca68c6[_0xd6e1('0x14')]?_0xca68c6[_0xd6e1('0x14')]*0x3e8:0x1388};if(_['isNil'](_0xca68c6['service'])){if(_0xca68c6['authentication']){_0x4cab7b[_0xd6e1('0x15')]=_0xca68c6[_0xd6e1('0x15')];_0x4cab7b[_0xd6e1('0x16')]=_0xca68c6[_0xd6e1('0x16')];}_0x4cab7b[_0xd6e1('0x17')]=_0xca68c6[_0xd6e1('0x17')];_0x4cab7b['port']=_0xca68c6[_0xd6e1('0x18')]||0x3e1;if(_0xca68c6['tls']){_0x4cab7b['tls']=!![];}else{_0x4cab7b[_0xd6e1('0x19')]=![];_0x4cab7b['autotls']=_0xd6e1('0x1a');}}else{_0x4cab7b['user']=_0xca68c6['user'];_0x4cab7b[_0xd6e1('0x16')]=_0xca68c6[_0xd6e1('0x16')];_0x4cab7b['host']=utils[_0xd6e1('0x1b')](_0xca68c6[_0xd6e1('0x1c')]);_0x4cab7b[_0xd6e1('0x18')]=0x3e1;_0x4cab7b[_0xd6e1('0x19')]=!![];}_0x4cab7b['email']=_0xc63f4a||_0xca68c6[_0xd6e1('0x15')]||_0xd6e1('0x1d');return _0x4cab7b;};EmailImap['prototype'][_0xd6e1('0xc')]=function(){this[_0xd6e1('0x0')]['openBox'](this[_0xd6e1('0xa')],![],this[_0xd6e1('0x1e')][_0xd6e1('0xd')](this));};EmailImap['prototype'][_0xd6e1('0x1e')]=function(_0x4d7acb,_0x43cad2){if(_0x4d7acb){this[_0xd6e1('0x10')](_0x4d7acb,!![]);}else{this[_0xd6e1('0x1f')]('box',_0x43cad2);this[_0xd6e1('0x20')]();}};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x22')]=function(_0xd37a09){if(_0xd37a09){this[_0xd6e1('0x10')](_0xd37a09,!![]);}else{this[_0xd6e1('0x0')][_0xd6e1('0x23')]();}};EmailImap[_0xd6e1('0x21')]['readUnseen']=function(){this[_0xd6e1('0x0')][_0xd6e1('0x24')](['UNSEEN'],this[_0xd6e1('0x25')][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x25')]=function(_0x44f916,_0x54abe2){if(_0x44f916){this['handleError'](_0x44f916,!![]);}else{if(_0x54abe2[_0xd6e1('0x26')]){try{var _0x29895d=this[_0xd6e1('0x0')][_0xd6e1('0x27')](_0x54abe2,{'bodies':'','markSeen':!![]});_0x29895d['on'](_0xd6e1('0x28'),this[_0xd6e1('0x29')]['bind'](this));_0x29895d[_0xd6e1('0xe')](_0xd6e1('0x2a'),this[_0xd6e1('0x2b')][_0xd6e1('0xd')](this));_0x29895d[_0xd6e1('0xe')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x3236f5){logger[_0xd6e1('0x2a')](_0x3236f5);}}else{this[_0xd6e1('0x0')][_0xd6e1('0x2c')](!![],this[_0xd6e1('0x22')][_0xd6e1('0xd')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x23bd4a,_0x1ea0bf){_0x23bd4a['on'](_0xd6e1('0x2d'),this[_0xd6e1('0x2e')][_0xd6e1('0xd')](this));_0x23bd4a[_0xd6e1('0xe')]('attributes',this[_0xd6e1('0x2f')][_0xd6e1('0xd')](this));_0x23bd4a['once'](_0xd6e1('0x23'),this[_0xd6e1('0x30')][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x2e')]=function(_0x360709,_0x6f0bdb){simpleParser(_0x360709,{'Iconv':Iconv},this[_0xd6e1('0x31')][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x2f')]=function(_0x2e2132){};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x30')]=function(){};EmailImap[_0xd6e1('0x21')]['handleSimpleParser']=function(_0x1cc6d1,_0x551ee2){if(_0x1cc6d1){logger[_0xd6e1('0x2a')](_0x1cc6d1);}else{var _0xa89439=this;utils[_0xd6e1('0x32')](this[_0xd6e1('0x33')],_0x551ee2,function(_0x370fb7){_0xa89439['emit']('email',_0x370fb7);});}};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x34')]=function(){this[_0xd6e1('0x0')]['closeBox'](!![],this[_0xd6e1('0x22')]['bind'](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x2b')]=function(_0x35b3a6){this['handleError'](_0x35b3a6);this[_0xd6e1('0x0')]['closeBox'](!![],this['handleCloseBox'][_0xd6e1('0xd')](this));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0xf')]=function(){this[_0xd6e1('0x1f')](_0xd6e1('0x23'));};EmailImap[_0xd6e1('0x21')][_0xd6e1('0x10')]=function(_0xfb931,_0x5c0023){logger[_0xd6e1('0x2a')](_0xd6e1('0x10'),this['account'][_0xd6e1('0x9')],JSON[_0xd6e1('0x35')](_0xfb931));var _0xa71fe3='';if(_0xfb931){if(_0xfb931[_0xd6e1('0x36')]){_0xa71fe3=_0xfb931[_0xd6e1('0x36')];}else{for(var _0x427972 in _0xfb931){if(_0xfb931[_0xd6e1('0x37')](_0x427972)){_0xa71fe3+=_[_0xd6e1('0x38')](_0x427972)+':\x20'+_0xfb931[_0x427972]+'\x0a';}}}}if(_0x5c0023){this[_0xd6e1('0x0')]['end']();}else{this['emit'](_0xd6e1('0x2a'),_0xa71fe3);this['emit'](_0xd6e1('0x23'));}};module[_0xd6e1('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8fe81ed..3c88046 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 _0xd9c0=['send','createTransport','use','sendMail','toString','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9c0,0x1d2));var _0x0d9c=function(_0x113cf0,_0x147145){_0x113cf0=_0x113cf0-0x0;var _0x5f5181=_0xd9c0[_0x113cf0];return _0x5f5181;};'use strict';var nodemailer=require(_0x0d9c('0x0'));var BPromise=require(_0x0d9c('0x1'));var inlineBase64=require(_0x0d9c('0x2'));function EmailSmtp(){}EmailSmtp[_0x0d9c('0x3')][_0x0d9c('0x4')]=function(_0x207b91,_0x2c3896){return new BPromise(function(_0x234b20,_0x2a687c){var _0x52a2d4=nodemailer[_0x0d9c('0x5')](_0x207b91);_0x52a2d4[_0x0d9c('0x6')]('compile',inlineBase64());_0x52a2d4[_0x0d9c('0x7')](_0x2c3896,function(_0x39f20a,_0x404413){if(_0x39f20a){_0x2a687c(_0x39f20a[_0x0d9c('0x8')]());}else{_0x234b20(_0x404413);}});});};EmailSmtp['prototype']['verify']=function(_0x1ccae0){return new BPromise(function(_0x43f8bc,_0x311097){var _0x5e9109=nodemailer[_0x0d9c('0x5')](_0x1ccae0);_0x5e9109['verify'](function(_0x5b67b9,_0xb14da7){if(_0x5b67b9){_0x311097(_0x5b67b9[_0x0d9c('0x8')]());}else{if(_0xb14da7){_0x43f8bc(_0xb14da7);}else{_0x311097('Not\x20verifired');}}});});};module[_0x0d9c('0x9')]=EmailSmtp; \ No newline at end of file +var _0x13cb=['send','createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x13cb,0x1b8));var _0xb13c=function(_0x4b354f,_0x350965){_0x4b354f=_0x4b354f-0x0;var _0xe3f93c=_0x13cb[_0x4b354f];return _0xe3f93c;};'use strict';var nodemailer=require(_0xb13c('0x0'));var BPromise=require(_0xb13c('0x1'));var inlineBase64=require(_0xb13c('0x2'));function EmailSmtp(){}EmailSmtp[_0xb13c('0x3')][_0xb13c('0x4')]=function(_0x481816,_0x369dae){return new BPromise(function(_0x380a34,_0x4bb2a8){var _0x1412ff=nodemailer[_0xb13c('0x5')](_0x481816);_0x1412ff[_0xb13c('0x6')](_0xb13c('0x7'),inlineBase64());_0x1412ff[_0xb13c('0x8')](_0x369dae,function(_0x5e7f07,_0x67db83){if(_0x5e7f07){_0x4bb2a8(_0x5e7f07[_0xb13c('0x9')]());}else{_0x380a34(_0x67db83);}});});};EmailSmtp[_0xb13c('0x3')][_0xb13c('0xa')]=function(_0x49fec9){return new BPromise(function(_0x2e3c22,_0x1bbb0d){var _0x18d637=nodemailer[_0xb13c('0x5')](_0x49fec9);_0x18d637[_0xb13c('0xa')](function(_0x1b1551,_0x23bb10){if(_0x1b1551){_0x1bbb0d(_0x1b1551[_0xb13c('0x9')]());}else{if(_0x23bb10){_0x2e3c22(_0x23bb10);}else{_0x1bbb0d('Not\x20verifired');}}});});};module[_0xb13c('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f2f8970..3e79455 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 _0x94f2=['../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','slice','join','Anonymous','length','pop','test','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','email'];(function(_0x342136,_0x55dab7){var _0x194c7f=function(_0x5e0924){while(--_0x5e0924){_0x342136['push'](_0x342136['shift']());}};_0x194c7f(++_0x55dab7);}(_0x94f2,0x18b));var _0x294f=function(_0x6de97b,_0x3c1340){_0x6de97b=_0x6de97b-0x0;var _0x3db771=_0x94f2[_0x6de97b];return _0x3db771;};'use strict';var _=require(_0x294f('0x0'));var moment=require(_0x294f('0x1'));var random=require(_0x294f('0x2'));var fs=require('fs');var path=require(_0x294f('0x3'));var util=require(_0x294f('0x4'));var tnef=require(_0x294f('0x5'));var logger=require('../../../config/logger')(_0x294f('0x6'));var config=require(_0x294f('0x7'));function getAddress(_0x403f0a){var _0x1b40e4=_[_0x294f('0x8')](_0x403f0a[_0x294f('0x9')]);return _0x1b40e4&&_0x1b40e4[_0x294f('0xa')]?_0x1b40e4[_0x294f('0xa')]:_0x294f('0xb')+random[_0x294f('0xc')](0x6)+_0x294f('0xd');}function getFirstName(_0x210547){var _0x306787=_['head'](_0x210547[_0x294f('0x9')]);if(_0x306787&&_0x306787[_0x294f('0xe')]){var _0x136d3b=_0x306787[_0x294f('0xe')][_0x294f('0xf')](/\s+/);return _0x136d3b['length']?_0x136d3b[_0x294f('0x10')](0x0,-0x1)[_0x294f('0x11')]('\x20'):_0x306787[_0x294f('0xe')];}return _0x294f('0x12');}function getLastName(_0x3c01fb){var _0x5e5339=_[_0x294f('0x8')](_0x3c01fb[_0x294f('0x9')]);if(_0x5e5339&&_0x5e5339[_0x294f('0xe')]){var _0x44cb20=_0x5e5339[_0x294f('0xe')]['split'](/\s+/);return _0x44cb20[_0x294f('0x13')]>0x1?_0x44cb20[_0x294f('0x14')]():'';}return'';}function getMails(_0x33740d,_0x8ac5fb){var _0x3f6be6='';for(var _0x368e82=0x0;_0x368e82<_0x8ac5fb[_0x294f('0x9')][_0x294f('0x13')];_0x368e82+=0x1){if(_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xa')]!==_0x33740d){if(!_['isEmpty'](_0x3f6be6)){_0x3f6be6+=',';}_0x3f6be6+=_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xe')]||_0x8ac5fb['value'][_0x368e82][_0x294f('0xa')]||'';_0x3f6be6+='\x20<';_0x3f6be6+=_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xa')]?_0x8ac5fb[_0x294f('0x9')][_0x368e82][_0x294f('0xa')]:'anonymous'+random[_0x294f('0xc')](0x6)+_0x294f('0xd');_0x3f6be6+='>';}}return _0x3f6be6;}function parseEmail(_0x1cea8c,_0x184655,_0x4eaec8){if(_0x184655['html']){var _0x422f5a=/)<[^<]*)*<\/script>/gi;while(_0x422f5a[_0x294f('0x15')](_0x184655[_0x294f('0x16')])){_0x184655[_0x294f('0x16')]=_0x184655['html'][_0x294f('0x17')](_0x422f5a,'');}_0x4eaec8[_0x294f('0x18')]=_0x184655['html'];}else{_0x4eaec8['body']=_0x184655[_0x294f('0x19')];}if(_0x4eaec8['body']){_0x4eaec8[_0x294f('0x18')]=_0x4eaec8[_0x294f('0x18')]['replace'](/Empty\x20message

','Attachments','push','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','lodash','moment','path','node-tnef','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','slice','join','Anonymous','length','pop','html','replace','body','0x1?_0x4dc298[_0xe0e3('0x11')]():'';}return'';}function getMails(_0x56e441,_0x2eadd1){var _0x2fe74f='';for(var _0x49a9b0=0x0;_0x49a9b0<_0x2eadd1[_0xe0e3('0x6')]['length'];_0x49a9b0+=0x1){if(_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0][_0xe0e3('0x7')]!==_0x56e441){if(!_['isEmpty'](_0x2fe74f)){_0x2fe74f+=',';}_0x2fe74f+=_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0]['name']||_0x2eadd1['value'][_0x49a9b0][_0xe0e3('0x7')]||'';_0x2fe74f+='\x20<';_0x2fe74f+=_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0]['address']?_0x2eadd1[_0xe0e3('0x6')][_0x49a9b0][_0xe0e3('0x7')]:_0xe0e3('0x8')+random[_0xe0e3('0x9')](0x6)+_0xe0e3('0xa');_0x2fe74f+='>';}}return _0x2fe74f;}function parseEmail(_0x24f59d,_0x10513e,_0x4205f2){if(_0x10513e[_0xe0e3('0x12')]){var _0x3c836e=/)<[^<]*)*<\/script>/gi;while(_0x3c836e['test'](_0x10513e[_0xe0e3('0x12')])){_0x10513e[_0xe0e3('0x12')]=_0x10513e[_0xe0e3('0x12')][_0xe0e3('0x13')](_0x3c836e,'');}_0x4205f2['body']=_0x10513e['html'];}else{_0x4205f2[_0xe0e3('0x14')]=_0x10513e['textAsHtml'];}if(_0x4205f2[_0xe0e3('0x14')]){_0x4205f2[_0xe0e3('0x14')]=_0x4205f2[_0xe0e3('0x14')][_0xe0e3('0x13')](/0x0){if(this[_0x568f4f+_0xab19('0x23')]>0x0&&this[_0x568f4f+_0xab19('0x22')]>=this[_0x568f4f+_0xab19('0x23')]){return _0xab19('0x24');}else{return _0xab19('0x25');}}else{return'idle';}};Agent[_0xab19('0x26')][_0xab19('0x20')]=function(){var _0x3c681f=[_0xab19('0x27'),_0xab19('0x28'),_0xab19('0x29'),_0xab19('0x2a'),_0xab19('0x2b'),'whatsapp'];for(var _0x294d3f=0x0;_0x294d3f<_0x3c681f[_0xab19('0x2c')];_0x294d3f+=0x1){var _0x3dda13=this[_0xab19('0x21')](_0x3c681f[_0x294d3f]);if(this[_0x3c681f[_0x294d3f]+_0xab19('0x2d')]!==_0x3dda13){this[_0x3c681f[_0x294d3f]+_0xab19('0x2e')]=_[_0xab19('0x2f')](moment()[_0xab19('0x30')]('x'));}this[_0x3c681f[_0x294d3f]+'Status']=_0x3dda13;}var _0x2452c8={'id':this['id'],'name':this[_0xab19('0x6')],'online':this['online'],'voicePause':this[_0xab19('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0xab19('0xa')],'smsPause':this[_0xab19('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0xab19('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xab19('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xab19('0x11')],'mailStatus':this[_0xab19('0x31')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xab19('0x13')],'mailCurrentCapacity':this[_0xab19('0x14')],'faxStatus':this[_0xab19('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xab19('0x16')],'faxCurrentCapacity':this[_0xab19('0x32')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xab19('0x33')],'smsCapacity':this[_0xab19('0x18')],'smsCurrentCapacity':this[_0xab19('0x19')],'whatsappStatus':this[_0xab19('0x1a')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xab19('0x1b')],'whatsappCurrentCapacity':this[_0xab19('0x34')],'openchannelStatus':this[_0xab19('0x1c')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xab19('0x35')],'busy':this[_0xab19('0x1e')],'busyQueue':this[_0xab19('0x1f')]};var _0x48797b=md5(JSON[_0xab19('0x36')](_0x2452c8));if(this['md5']!==_0x48797b){this[_0xab19('0x37')]=_0x48797b;io[_0xab19('0x38')](_0xab19('0x39'),_0x2452c8);}};module['exports']=Agent; \ No newline at end of file +var _0xea28=['moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','openchannel','fax','sms','length','StatusTime','toNumber','format','Status','chatStatusTime','mailCurrentCapacity','openchannelCurrentCapacity','stringify','emit','user:save','exports','lodash'];(function(_0x4cdbc8,_0x4d8e1d){var _0x311448=function(_0x3f37b1){while(--_0x3f37b1){_0x4cdbc8['push'](_0x4cdbc8['shift']());}};_0x311448(++_0x4d8e1d);}(_0xea28,0x13a));var _0x8ea2=function(_0x487041,_0x31c371){_0x487041=_0x487041-0x0;var _0x6c04a=_0xea28[_0x487041];return _0x6c04a;};'use strict';var _=require(_0x8ea2('0x0'));var moment=require(_0x8ea2('0x1'));var md5=require(_0x8ea2('0x2'));var Redis=require(_0x8ea2('0x3'));var config=require(_0x8ea2('0x4'));config[_0x8ea2('0x5')]=_[_0x8ea2('0x6')](config[_0x8ea2('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8ea2('0x7'))(new Redis(config[_0x8ea2('0x5')]));function Agent(_0x1ccf12){this['id']=_0x1ccf12['id']||0x0;this['name']=_0x1ccf12[_0x8ea2('0x8')]||'';this[_0x8ea2('0x9')]=_0x1ccf12[_0x8ea2('0x9')]||!![];this[_0x8ea2('0xa')]=_0x1ccf12[_0x8ea2('0xa')]||![];this[_0x8ea2('0xb')]=_0x1ccf12[_0x8ea2('0xb')]||![];this[_0x8ea2('0xc')]=_0x1ccf12[_0x8ea2('0xc')]||![];this[_0x8ea2('0xd')]=_0x1ccf12[_0x8ea2('0xd')]||![];this[_0x8ea2('0xe')]=_0x1ccf12['smsPause']||![];this['openchannelPause']=_0x1ccf12[_0x8ea2('0xf')]||![];this[_0x8ea2('0x10')]=_0x8ea2('0x11');this['chatStatusTime']=0x0;this[_0x8ea2('0x12')]=_0x1ccf12[_0x8ea2('0x12')]||0x0;this[_0x8ea2('0x13')]=0x0;this[_0x8ea2('0x14')]=_0x8ea2('0x11');this['mailStatusTime']=0x0;this[_0x8ea2('0x15')]=_0x1ccf12['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x8ea2('0x16')]=_0x8ea2('0x11');this[_0x8ea2('0x17')]=0x0;this[_0x8ea2('0x18')]=_0x1ccf12[_0x8ea2('0x18')]||0x0;this[_0x8ea2('0x19')]=0x0;this[_0x8ea2('0x1a')]=_0x8ea2('0x11');this[_0x8ea2('0x1b')]=0x0;this[_0x8ea2('0x1c')]=_0x1ccf12[_0x8ea2('0x1c')]||0x0;this[_0x8ea2('0x1d')]=0x0;this[_0x8ea2('0x1e')]=_0x8ea2('0x11');this[_0x8ea2('0x1f')]=0x0;this[_0x8ea2('0x20')]=_0x1ccf12[_0x8ea2('0x20')]||0x0;this[_0x8ea2('0x21')]=0x0;this[_0x8ea2('0x22')]=_0x8ea2('0x11');this[_0x8ea2('0x23')]=0x0;this[_0x8ea2('0x24')]=_0x1ccf12['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8ea2('0x25')]=![];this[_0x8ea2('0x26')]=undefined;this[_0x8ea2('0x2')]='';this['updateRealtime']();}Agent[_0x8ea2('0x27')][_0x8ea2('0x28')]=function(_0x5c057a){if(this[_0x5c057a+_0x8ea2('0x29')]>0x0){if(this[_0x5c057a+_0x8ea2('0x2a')]>0x0&&this[_0x5c057a+_0x8ea2('0x29')]>=this[_0x5c057a+_0x8ea2('0x2a')]){return _0x8ea2('0x2b');}else{return _0x8ea2('0x2c');}}else{return _0x8ea2('0x2d');}};Agent[_0x8ea2('0x27')][_0x8ea2('0x2e')]=function(){var _0x4d5030=[_0x8ea2('0x2f'),'chat',_0x8ea2('0x30'),_0x8ea2('0x31'),_0x8ea2('0x32'),'whatsapp'];for(var _0x53ed43=0x0;_0x53ed43<_0x4d5030[_0x8ea2('0x33')];_0x53ed43+=0x1){var _0x4dc7bf=this[_0x8ea2('0x28')](_0x4d5030[_0x53ed43]);if(this[_0x4d5030[_0x53ed43]+'Status']!==_0x4dc7bf){this[_0x4d5030[_0x53ed43]+_0x8ea2('0x34')]=_[_0x8ea2('0x35')](moment()[_0x8ea2('0x36')]('x'));}this[_0x4d5030[_0x53ed43]+_0x8ea2('0x37')]=_0x4dc7bf;}var _0x4e1b90={'id':this['id'],'name':this['name'],'online':this[_0x8ea2('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x8ea2('0xb')],'mailPause':this[_0x8ea2('0xc')],'smsPause':this[_0x8ea2('0xe')],'faxPause':this[_0x8ea2('0xd')],'openchannelPause':this[_0x8ea2('0xf')],'chatStatus':this[_0x8ea2('0x10')],'chatStatusTime':this[_0x8ea2('0x38')],'chatCapacity':this[_0x8ea2('0x12')],'chatCurrentCapacity':this[_0x8ea2('0x13')],'mailStatus':this[_0x8ea2('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x8ea2('0x39')],'faxStatus':this[_0x8ea2('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8ea2('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x8ea2('0x1b')],'smsCapacity':this[_0x8ea2('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x8ea2('0x1e')],'whatsappStatusTime':this[_0x8ea2('0x1f')],'whatsappCapacity':this[_0x8ea2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8ea2('0x24')],'openchannelCurrentCapacity':this[_0x8ea2('0x3a')],'busy':this[_0x8ea2('0x25')],'busyQueue':this['busyQueue']};var _0x456487=md5(JSON[_0x8ea2('0x3b')](_0x4e1b90));if(this[_0x8ea2('0x2')]!==_0x456487){this[_0x8ea2('0x2')]=_0x456487;io[_0x8ea2('0x3c')](_0x8ea2('0x3d'),_0x4e1b90);}};module[_0x8ea2('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 461e902..ce24e83 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 _0x5fdd=['md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash'];(function(_0x2a189e,_0x8130c3){var _0x46d76d=function(_0x5a87c6){while(--_0x5a87c6){_0x2a189e['push'](_0x2a189e['shift']());}};_0x46d76d(++_0x8130c3);}(_0x5fdd,0x194));var _0xd5fd=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x5fdd[_0x12254f];return _0x3a4fa2;};'use strict';var _=require(_0xd5fd('0x0'));var md5=require(_0xd5fd('0x1'));var util=require(_0xd5fd('0x2'));var Redis=require(_0xd5fd('0x3'));var config=require(_0xd5fd('0x4'));config['redis']=_[_0xd5fd('0x5')](config[_0xd5fd('0x6')],{'host':_0xd5fd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x5cdc54){this['id']=_0x5cdc54['id']||0x0;this['name']=_0x5cdc54[_0xd5fd('0x8')]||'';this['timeout']=_0x5cdc54[_0xd5fd('0x9')]||0xa;this[_0xd5fd('0xa')]=_0x5cdc54[_0xd5fd('0xa')]||_0xd5fd('0xb');this['Agents']=_0x5cdc54[_0xd5fd('0xc')];this[_0xd5fd('0xd')]={};this[_0xd5fd('0xe')]=0x0;this[_0xd5fd('0x1')]='';this[_0xd5fd('0xf')]();this[_0xd5fd('0x10')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x4283a4=this[_0xd5fd('0xd')][_0xd5fd('0x11')];this[_0xd5fd('0xd')]=_[_0xd5fd('0x12')](this[_0xd5fd('0xc')],'id');this[_0xd5fd('0xd')][_0xd5fd('0x11')]=_0x4283a4;};ChatQueue['prototype'][_0xd5fd('0x10')]=function(){this[_0xd5fd('0x13')]=0x0;this[_0xd5fd('0x14')]=0x0;for(var _0x1553c0=0x0;_0x1553c0=0x0?this[_0xd5fd('0x15')]:0x0;var _0x433d53={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd5fd('0x13')],'name':this[_0xd5fd('0x8')],'paused':this[_0xd5fd('0x14')],'waiting':this[_0xd5fd('0xe')]};var _0x29f44b=md5(JSON['stringify'](_0x433d53));if(this[_0xd5fd('0x1')]!==_0x29f44b){this[_0xd5fd('0x1')]=_0x29f44b;io['to'](util[_0xd5fd('0x16')](_0xd5fd('0x17'),_0x433d53[_0xd5fd('0x8')]))[_0xd5fd('0x18')](_0xd5fd('0x19'),_0x433d53);}};module[_0xd5fd('0x1a')]=ChatQueue; \ No newline at end of file +var _0x0081=['defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','exports','lodash','util','ioredis','redis'];(function(_0x438eb6,_0x44d872){var _0x25c144=function(_0x4f18b9){while(--_0x4f18b9){_0x438eb6['push'](_0x438eb6['shift']());}};_0x25c144(++_0x44d872);}(_0x0081,0x1c7));var _0x1008=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0081[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x1008('0x0'));var md5=require('md5');var util=require(_0x1008('0x1'));var Redis=require(_0x1008('0x2'));var config=require('../../../config/environment');config[_0x1008('0x3')]=_[_0x1008('0x4')](config[_0x1008('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1008('0x3')]));function ChatQueue(_0x2fe16b){this['id']=_0x2fe16b['id']||0x0;this[_0x1008('0x5')]=_0x2fe16b[_0x1008('0x5')]||'';this[_0x1008('0x6')]=_0x2fe16b[_0x1008('0x6')]||0xa;this[_0x1008('0x7')]=_0x2fe16b[_0x1008('0x7')]||_0x1008('0x8');this[_0x1008('0x9')]=_0x2fe16b[_0x1008('0x9')];this[_0x1008('0xa')]={};this['waiting']=0x0;this[_0x1008('0xb')]='';this[_0x1008('0xc')]();this[_0x1008('0xd')]();}ChatQueue[_0x1008('0xe')][_0x1008('0xc')]=function(){var _0x234ee5=this[_0x1008('0xa')][_0x1008('0xf')];this[_0x1008('0xa')]=_[_0x1008('0x10')](this[_0x1008('0x9')],'id');this[_0x1008('0xa')]['_rr']=_0x234ee5;};ChatQueue[_0x1008('0xe')][_0x1008('0xd')]=function(){this[_0x1008('0x11')]=0x0;this[_0x1008('0x12')]=0x0;for(var _0x2b1d19=0x0;_0x2b1d19=0x0?this['available']:0x0;var _0x4355fa={'id':this['id'],'available':this[_0x1008('0x16')],'loggedIn':this[_0x1008('0x11')],'name':this['name'],'paused':this[_0x1008('0x12')],'waiting':this[_0x1008('0x17')]};var _0x370272=md5(JSON[_0x1008('0x18')](_0x4355fa));if(this['md5']!==_0x370272){this[_0x1008('0xb')]=_0x370272;io['to'](util[_0x1008('0x19')]('chat:queue:%s',_0x4355fa[_0x1008('0x5')]))['emit']('chat_queue:save',_0x4355fa);}};module[_0x1008('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9fea6f1..52fcbc3 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(_0x27b199,_0x4d27e2){var _0x4402f1=function(_0x5ecd35){while(--_0x5ecd35){_0x27b199['push'](_0x27b199['shift']());}};_0x4402f1(++_0x4d27e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x2e5250,_0x5e5597){var _0x376540=function(_0x1595e3){while(--_0x1595e3){_0x2e5250['push'](_0x2e5250['shift']());}};_0x376540(++_0x5e5597);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index ad48849..d61caff 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 _0x8836=['Intervals','exports','name'];(function(_0xb13a01,_0x176a5d){var _0x10011a=function(_0x4cbb90){while(--_0x4cbb90){_0xb13a01['push'](_0xb13a01['shift']());}};_0x10011a(++_0x176a5d);}(_0x8836,0x6e));var _0x6883=function(_0x3c7dbb,_0x4226b6){_0x3c7dbb=_0x3c7dbb-0x0;var _0x5c1b2f=_0x8836[_0x3c7dbb];return _0x5c1b2f;};'use strict';function Interval(_0xd21063){this['id']=_0xd21063['id']||0x0;this[_0x6883('0x0')]=_0xd21063[_0x6883('0x0')]||'';this[_0x6883('0x1')]=_0xd21063[_0x6883('0x1')]||{};}module[_0x6883('0x2')]=Interval; \ No newline at end of file +var _0xde17=['Intervals','exports','name'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xde17,0xec));var _0x7de1=function(_0x53c4a2,_0x2c60c4){_0x53c4a2=_0x53c4a2-0x0;var _0x2fd4b7=_0xde17[_0x53c4a2];return _0x2fd4b7;};'use strict';function Interval(_0x204d32){this['id']=_0x204d32['id']||0x0;this[_0x7de1('0x0')]=_0x204d32['name']||'';this[_0x7de1('0x1')]=_0x204d32['Intervals']||{};}module[_0x7de1('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index c755acc..9c67d3e 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 _0x0895=['updateRouting','_rr','map','loggedIn','paused','length','mailPause','available','waiting','format','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype'];(function(_0x4d709c,_0x2c491e){var _0x47164f=function(_0x1ee76c){while(--_0x1ee76c){_0x4d709c['push'](_0x4d709c['shift']());}};_0x47164f(++_0x2c491e);}(_0x0895,0x1a0));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var md5=require(_0x5089('0x1'));var util=require('util');var Redis=require(_0x5089('0x2'));var config=require(_0x5089('0x3'));config['redis']=_[_0x5089('0x4')](config['redis'],{'host':_0x5089('0x5'),'port':0x18eb});var io=require(_0x5089('0x6'))(new Redis(config[_0x5089('0x7')]));function MailQueue(_0x50df6e){this['id']=_0x50df6e['id']||0x0;this[_0x5089('0x8')]=_0x50df6e[_0x5089('0x8')]||'';this[_0x5089('0x9')]=_0x50df6e[_0x5089('0x9')]||0xa;this[_0x5089('0xa')]=_0x50df6e[_0x5089('0xa')]||_0x5089('0xb');this[_0x5089('0xc')]=_0x50df6e[_0x5089('0xc')];this[_0x5089('0xd')]={};this['waiting']=0x0;this[_0x5089('0x1')]='';this['updateRouting']();this[_0x5089('0xe')]();}MailQueue[_0x5089('0xf')][_0x5089('0x10')]=function(){var _0x17fcd1=this[_0x5089('0xd')][_0x5089('0x11')];this[_0x5089('0xd')]=_[_0x5089('0x12')](this[_0x5089('0xc')],'id');this['mapAgentsId'][_0x5089('0x11')]=_0x17fcd1;};MailQueue['prototype'][_0x5089('0xe')]=function(){this[_0x5089('0x13')]=0x0;this[_0x5089('0x14')]=0x0;for(var _0x442e1f=0x0;_0x442e1f=0x0?this['available']:0x0;var _0x5c4e7f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5089('0x13')],'name':this[_0x5089('0x8')],'paused':this[_0x5089('0x14')],'waiting':this[_0x5089('0x18')]};var _0x55e9e0=md5(JSON['stringify'](_0x5c4e7f));if(this[_0x5089('0x1')]!==_0x55e9e0){this[_0x5089('0x1')]=_0x55e9e0;io['to'](util[_0x5089('0x19')]('mail:queue:%s',_0x5c4e7f[_0x5089('0x8')]))['emit']('mail_queue:save',_0x5c4e7f);}};module[_0x5089('0x1a')]=MailQueue; \ No newline at end of file +var _0x8328=['updateRealtime','loggedIn','length','paused','available','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','_rr','mapAgentsId','map'];(function(_0x3f9f2d,_0xd78f12){var _0x31be33=function(_0x38b133){while(--_0x38b133){_0x3f9f2d['push'](_0x3f9f2d['shift']());}};_0x31be33(++_0xd78f12);}(_0x8328,0xb3));var _0x8832=function(_0x416e83,_0x324c39){_0x416e83=_0x416e83-0x0;var _0x36724e=_0x8328[_0x416e83];return _0x36724e;};'use strict';var _=require(_0x8832('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x8832('0x1'));config[_0x8832('0x2')]=_[_0x8832('0x3')](config[_0x8832('0x2')],{'host':_0x8832('0x4'),'port':0x18eb});var io=require(_0x8832('0x5'))(new Redis(config['redis']));function MailQueue(_0x2f3e50){this['id']=_0x2f3e50['id']||0x0;this[_0x8832('0x6')]=_0x2f3e50['name']||'';this[_0x8832('0x7')]=_0x2f3e50[_0x8832('0x7')]||0xa;this['strategy']=_0x2f3e50[_0x8832('0x8')]||_0x8832('0x9');this[_0x8832('0xa')]=_0x2f3e50[_0x8832('0xa')];this['mapAgentsId']={};this[_0x8832('0xb')]=0x0;this['md5']='';this[_0x8832('0xc')]();this['updateRealtime']();}MailQueue[_0x8832('0xd')][_0x8832('0xc')]=function(){var _0x3d3817=this['mapAgentsId'][_0x8832('0xe')];this[_0x8832('0xf')]=_[_0x8832('0x10')](this[_0x8832('0xa')],'id');this['mapAgentsId']['_rr']=_0x3d3817;};MailQueue[_0x8832('0xd')][_0x8832('0x11')]=function(){this[_0x8832('0x12')]=0x0;this['paused']=0x0;for(var _0x494bfc=0x0;_0x494bfc=0x0?this['available']:0x0;var _0x38b96d={'id':this['id'],'available':this[_0x8832('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x8832('0x6')],'paused':this['paused'],'waiting':this[_0x8832('0xb')]};var _0x26a3b9=md5(JSON['stringify'](_0x38b96d));if(this[_0x8832('0x16')]!==_0x26a3b9){this['md5']=_0x26a3b9;io['to'](util[_0x8832('0x17')](_0x8832('0x18'),_0x38b96d[_0x8832('0x6')]))[_0x8832('0x19')](_0x8832('0x1a'),_0x38b96d);}};module[_0x8832('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ff8fcbb..7883611 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 _0x474c=['paused','online','openchannelPause','available','openchannel:queue:%s','emit','openchannel_queue:save','exports','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x474c,0x8a));var _0xc474=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x474c[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var md5=require(_0xc474('0x0'));var util=require(_0xc474('0x1'));var Redis=require(_0xc474('0x2'));var config=require('../../../config/environment');config[_0xc474('0x3')]=_['defaults'](config[_0xc474('0x3')],{'host':_0xc474('0x4'),'port':0x18eb});var io=require(_0xc474('0x5'))(new Redis(config[_0xc474('0x3')]));function OpenchannelQueue(_0x28a4ae){this['id']=_0x28a4ae['id']||0x0;this['name']=_0x28a4ae[_0xc474('0x6')]||'';this['timeout']=_0x28a4ae[_0xc474('0x7')]||0xa;this['strategy']=_0x28a4ae[_0xc474('0x8')]||_0xc474('0x9');this[_0xc474('0xa')]=_0x28a4ae['Agents'];this['mapAgentsId']={};this[_0xc474('0xb')]=0x0;this[_0xc474('0x0')]='';this[_0xc474('0xc')]();this[_0xc474('0xd')]();}OpenchannelQueue[_0xc474('0xe')][_0xc474('0xc')]=function(){var _0x49c4c6=this[_0xc474('0xf')]['_rr'];this['mapAgentsId']=_[_0xc474('0x10')](this[_0xc474('0xa')],'id');this[_0xc474('0xf')]['_rr']=_0x49c4c6;};OpenchannelQueue[_0xc474('0xe')]['updateRealtime']=function(){this[_0xc474('0x11')]=0x0;this[_0xc474('0x12')]=0x0;for(var _0x3a24f1=0x0;_0x3a24f1=0x0?this[_0xc474('0x15')]:0x0;var _0x5473c4={'id':this['id'],'available':this[_0xc474('0x15')],'loggedIn':this[_0xc474('0x11')],'name':this[_0xc474('0x6')],'paused':this[_0xc474('0x12')],'waiting':this[_0xc474('0xb')]};var _0x12350e=md5(JSON['stringify'](_0x5473c4));if(this[_0xc474('0x0')]!==_0x12350e){this['md5']=_0x12350e;io['to'](util['format'](_0xc474('0x16'),_0x5473c4['name']))[_0xc474('0x17')](_0xc474('0x18'),_0x5473c4);}};module[_0xc474('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x64e6=['mapAgentsId','updateRouting','_rr','map','Agents','prototype','updateRealtime','paused','length','online','available','loggedIn','waiting','format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall'];(function(_0x4b985b,_0xad0c8f){var _0x15b6b2=function(_0x361aea){while(--_0x361aea){_0x4b985b['push'](_0x4b985b['shift']());}};_0x15b6b2(++_0xad0c8f);}(_0x64e6,0xa4));var _0x664e=function(_0x4e6766,_0x52b8bb){_0x4e6766=_0x4e6766-0x0;var _0x3a0eb4=_0x64e6[_0x4e6766];return _0x3a0eb4;};'use strict';var _=require('lodash');var md5=require(_0x664e('0x0'));var util=require(_0x664e('0x1'));var Redis=require(_0x664e('0x2'));var config=require(_0x664e('0x3'));config[_0x664e('0x4')]=_[_0x664e('0x5')](config[_0x664e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x664e('0x6'))(new Redis(config[_0x664e('0x4')]));function OpenchannelQueue(_0x4abed6){this['id']=_0x4abed6['id']||0x0;this['name']=_0x4abed6['name']||'';this[_0x664e('0x7')]=_0x4abed6['timeout']||0xa;this[_0x664e('0x8')]=_0x4abed6['strategy']||_0x664e('0x9');this['Agents']=_0x4abed6['Agents'];this[_0x664e('0xa')]={};this['waiting']=0x0;this[_0x664e('0x0')]='';this[_0x664e('0xb')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x664e('0xb')]=function(){var _0x2141f8=this[_0x664e('0xa')][_0x664e('0xc')];this[_0x664e('0xa')]=_[_0x664e('0xd')](this[_0x664e('0xe')],'id');this[_0x664e('0xa')]['_rr']=_0x2141f8;};OpenchannelQueue[_0x664e('0xf')][_0x664e('0x10')]=function(){this['loggedIn']=0x0;this[_0x664e('0x11')]=0x0;for(var _0x493c73=0x0;_0x493c73=0x0?this[_0x664e('0x14')]:0x0;var _0x246b32={'id':this['id'],'available':this[_0x664e('0x14')],'loggedIn':this[_0x664e('0x15')],'name':this['name'],'paused':this[_0x664e('0x11')],'waiting':this[_0x664e('0x16')]};var _0x523f8b=md5(JSON['stringify'](_0x246b32));if(this['md5']!==_0x523f8b){this[_0x664e('0x0')]=_0x523f8b;io['to'](util[_0x664e('0x17')](_0x664e('0x18'),_0x246b32[_0x664e('0x19')]))[_0x664e('0x1a')](_0x664e('0x1b'),_0x246b32);}};module[_0x664e('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 96b7073..2690a80 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 _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x5a4d34,_0xe79ddb){var _0x5b7c63=function(_0x27df7f){while(--_0x27df7f){_0x5a4d34['push'](_0x5a4d34['shift']());}};_0x5b7c63(++_0xe79ddb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xcb91[_0x2fdf82];return _0x2382f5;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x4bf14c,_0x2fd00d){var _0x3423e6=function(_0x31af91){while(--_0x31af91){_0x4bf14c['push'](_0x4bf14c['shift']());}};_0x3423e6(++_0x2fd00d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 59ad964..7fcf2c6 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 _0x8aa0=['emit','whatsapp_queue:save','exports','lodash','md5','util','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','available','name','paused','stringify','whatsapp:queue:%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8aa0,0x99));var _0x08aa=function(_0x411056,_0x1f93c1){_0x411056=_0x411056-0x0;var _0x46b52e=_0x8aa0[_0x411056];return _0x46b52e;};'use strict';var _=require(_0x08aa('0x0'));var md5=require(_0x08aa('0x1'));var util=require(_0x08aa('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x08aa('0x3')],{'host':_0x08aa('0x4'),'port':0x18eb});var io=require(_0x08aa('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x36b3c7){this['id']=_0x36b3c7['id']||0x0;this['name']=_0x36b3c7['name']||'';this[_0x08aa('0x6')]=_0x36b3c7['timeout']||0xa;this[_0x08aa('0x7')]=_0x36b3c7[_0x08aa('0x7')]||_0x08aa('0x8');this[_0x08aa('0x9')]=_0x36b3c7[_0x08aa('0x9')];this[_0x08aa('0xa')]={};this[_0x08aa('0xb')]=0x0;this['md5']='';this[_0x08aa('0xc')]();this[_0x08aa('0xd')]();}WhatsappQueue[_0x08aa('0xe')][_0x08aa('0xc')]=function(){var _0x120060=this[_0x08aa('0xa')]['_rr'];this[_0x08aa('0xa')]=_[_0x08aa('0xf')](this[_0x08aa('0x9')],'id');this[_0x08aa('0xa')]['_rr']=_0x120060;};WhatsappQueue[_0x08aa('0xe')][_0x08aa('0xd')]=function(){this[_0x08aa('0x10')]=0x0;this['paused']=0x0;for(var _0x39664e=0x0;_0x39664e=0x0?this[_0x08aa('0x11')]:0x0;var _0x25f17c={'id':this['id'],'available':this[_0x08aa('0x11')],'loggedIn':this[_0x08aa('0x10')],'name':this[_0x08aa('0x12')],'paused':this[_0x08aa('0x13')],'waiting':this[_0x08aa('0xb')]};var _0xc0dbe=md5(JSON[_0x08aa('0x14')](_0x25f17c));if(this[_0x08aa('0x1')]!==_0xc0dbe){this[_0x08aa('0x1')]=_0xc0dbe;io['to'](util['format'](_0x08aa('0x15'),_0x25f17c[_0x08aa('0x12')]))[_0x08aa('0x16')](_0x08aa('0x17'),_0x25f17c);}};module[_0x08aa('0x18')]=WhatsappQueue; \ No newline at end of file +var _0xea6a=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','_rr','map','updateRealtime','loggedIn','length','online','available','paused','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash'];(function(_0x20748a,_0x197d91){var _0x4296f8=function(_0x4ae51f){while(--_0x4ae51f){_0x20748a['push'](_0x20748a['shift']());}};_0x4296f8(++_0x197d91);}(_0xea6a,0x151));var _0xaea6=function(_0x2ff065,_0x5e96cb){_0x2ff065=_0x2ff065-0x0;var _0x834a38=_0xea6a[_0x2ff065];return _0x834a38;};'use strict';var _=require(_0xaea6('0x0'));var md5=require(_0xaea6('0x1'));var util=require('util');var Redis=require(_0xaea6('0x2'));var config=require(_0xaea6('0x3'));config[_0xaea6('0x4')]=_[_0xaea6('0x5')](config['redis'],{'host':_0xaea6('0x6'),'port':0x18eb});var io=require(_0xaea6('0x7'))(new Redis(config[_0xaea6('0x4')]));function WhatsappQueue(_0x473a38){this['id']=_0x473a38['id']||0x0;this[_0xaea6('0x8')]=_0x473a38['name']||'';this[_0xaea6('0x9')]=_0x473a38['timeout']||0xa;this['strategy']=_0x473a38['strategy']||'beepall';this[_0xaea6('0xa')]=_0x473a38[_0xaea6('0xa')];this[_0xaea6('0xb')]={};this[_0xaea6('0xc')]=0x0;this[_0xaea6('0x1')]='';this[_0xaea6('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x2e8940=this[_0xaea6('0xb')][_0xaea6('0xe')];this[_0xaea6('0xb')]=_[_0xaea6('0xf')](this[_0xaea6('0xa')],'id');this[_0xaea6('0xb')][_0xaea6('0xe')]=_0x2e8940;};WhatsappQueue['prototype'][_0xaea6('0x10')]=function(){this[_0xaea6('0x11')]=0x0;this['paused']=0x0;for(var _0x12bffa=0x0;_0x12bffa=0x0?this[_0xaea6('0x14')]:0x0;var _0x4d68ff={'id':this['id'],'available':this[_0xaea6('0x14')],'loggedIn':this[_0xaea6('0x11')],'name':this['name'],'paused':this[_0xaea6('0x15')],'waiting':this['waiting']};var _0x29b498=md5(JSON['stringify'](_0x4d68ff));if(this[_0xaea6('0x1')]!==_0x29b498){this['md5']=_0x29b498;io['to'](util[_0xaea6('0x16')](_0xaea6('0x17'),_0x4d68ff[_0xaea6('0x8')]))[_0xaea6('0x18')](_0xaea6('0x19'),_0x4d68ff);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9eb8d98..1a661de 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 _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x1cb9,0x14e));var _0x91cb=function(_0x283640,_0x1e7163){_0x283640=_0x283640-0x0;var _0x38ec02=_0x1cb9[_0x283640];return _0x38ec02;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file +var _0x8ef6=['mergeFromDatabase','initAgents','length','agents','intervals','isUndefined','updateRouting','initChatQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8ef6,0xf2));var _0x68ef=function(_0x39d7bf,_0x69ed35){_0x39d7bf=_0x39d7bf-0x0;var _0x3f6663=_0x8ef6[_0x39d7bf];return _0x3f6663;};'use strict';var BPromise=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var moment=require(_0x68ef('0x3'));var Agent=require(_0x68ef('0x4'));var Interval=require(_0x68ef('0x5'));var OpenchannelQueue=require(_0x68ef('0x6'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x68ef('0x7'));var MailQueue=require(_0x68ef('0x8'));var FaxQueue=require(_0x68ef('0x9'));var WhatsappQueue=require(_0x68ef('0xa'));var Realtime=function(){this['agents']={};this['intervals']={};this[_0x68ef('0xb')]={};this[_0x68ef('0xc')]={};this[_0x68ef('0xd')]={};this['mailQueues']={};this[_0x68ef('0xe')]={};this[_0x68ef('0xf')]={};this[_0x68ef('0x10')]={};this[_0x68ef('0x11')]={};this[_0x68ef('0x12')]={};this[_0x68ef('0x13')]={};this[_0x68ef('0x14')]={};this[_0x68ef('0x15')]={};};function freeIsNotKey(_0x1f6747,_0x255c85,_0x3afc1d){var _0xfa6763=_['mapKeys'](_0x1f6747,function(_0x1aa045,_0x46356f){return _0x1aa045[_0x3afc1d];});for(var _0x1e117a in _0x255c85){if(_0x255c85[_0x68ef('0x16')](_0x1e117a)){if(!_0xfa6763[_0x1e117a]){delete _0x255c85[_0x1e117a];}}}}Realtime[_0x68ef('0x17')][_0x68ef('0x18')]=function(_0x508671,_0x3b48dd){for(var _0xc50cce in _0x3b48dd){if(_0x508671[_0x68ef('0x16')](_0xc50cce)){_0x508671[_0xc50cce]=_0x3b48dd[_0xc50cce];}}};Realtime['prototype'][_0x68ef('0x19')]=function(){var _0x1764de=this;return function(_0x24682d){if(_0x24682d){freeIsNotKey(_0x24682d,_0x1764de['agents'],'id');for(var _0x35493d=0x0,_0x37c4cc={},_0x3d1e90={};_0x35493d<_0x24682d[_0x68ef('0x1a')];_0x35493d+=0x1){_0x37c4cc=_0x24682d[_0x35493d];if(_['isUndefined'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']])){_0x1764de['agents'][_0x37c4cc['id']]=new Agent(_0x37c4cc);}else{_0x1764de['mergeFromDatabase'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']],_0x37c4cc);}}}return _0x1764de[_0x68ef('0x1b')];};};Realtime['prototype']['initIntervals']=function(){var _0x3c4c1f=this;return function(_0x2cd92c){if(_0x2cd92c){freeIsNotKey(_0x2cd92c,_0x3c4c1f[_0x68ef('0x1c')],'id');for(var _0x4fad1c=0x0,_0x1dc49c={},_0x36a4cb={};_0x4fad1c<_0x2cd92c[_0x68ef('0x1a')];_0x4fad1c+=0x1){_0x1dc49c=_0x2cd92c[_0x4fad1c];if(_['isUndefined'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']])){_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']]=new Interval(_0x1dc49c);}else{_0x3c4c1f['mergeFromDatabase'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']],_0x1dc49c);}}}return _0x3c4c1f[_0x68ef('0x1c')];};};Realtime[_0x68ef('0x17')]['initOpenchannelQueues']=function(){var _0x59723c=this;return function(_0x59bebc){if(_0x59bebc){freeIsNotKey(_0x59bebc,_0x59723c[_0x68ef('0xb')],'id');for(var _0x2023f2=0x0,_0x312cc9={},_0x2e6e39={};_0x2023f2<_0x59bebc[_0x68ef('0x1a')];_0x2023f2+=0x1){_0x312cc9=_0x59bebc[_0x2023f2];if(_[_0x68ef('0x1d')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']])){_0x59723c[_0x68ef('0xb')][_0x312cc9['id']]=new OpenchannelQueue(_0x312cc9);}else{_0x59723c[_0x68ef('0x18')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']],_0x312cc9);}_0x59723c['openchannelQueues'][_0x312cc9['id']][_0x68ef('0x1e')]();_0x59723c['openchannelQueues'][_0x312cc9['id']]['updateRealtime']();}}return _0x59723c['openchannelQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x1f')]=function(){var _0x123041=this;return function(_0x29518e){if(_0x29518e){freeIsNotKey(_0x29518e,_0x123041['chatQueues'],'id');for(var _0x4a0550=0x0,_0x1cbe4f={},_0x28907a={};_0x4a0550<_0x29518e[_0x68ef('0x1a')];_0x4a0550+=0x1){_0x1cbe4f=_0x29518e[_0x4a0550];if(_[_0x68ef('0x1d')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']])){_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']]=new ChatQueue(_0x1cbe4f);}else{_0x123041[_0x68ef('0x18')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']],_0x1cbe4f);}_0x123041['chatQueues'][_0x1cbe4f['id']][_0x68ef('0x1e')]();_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']][_0x68ef('0x20')]();}}return _0x123041['chatQueues'];};};Realtime[_0x68ef('0x17')]['initSmsQueues']=function(){var _0x133788=this;return function(_0x17588a){if(_0x17588a){freeIsNotKey(_0x17588a,_0x133788['smsQueues'],'id');for(var _0x5e1e1b=0x0,_0x159395={},_0x5fa72a={};_0x5e1e1b<_0x17588a['length'];_0x5e1e1b+=0x1){_0x159395=_0x17588a[_0x5e1e1b];if(_[_0x68ef('0x1d')](_0x133788[_0x68ef('0xd')][_0x159395['id']])){_0x133788[_0x68ef('0xd')][_0x159395['id']]=new SmsQueue(_0x159395);}else{_0x133788[_0x68ef('0x18')](_0x133788['smsQueues'][_0x159395['id']],_0x159395);}_0x133788[_0x68ef('0xd')][_0x159395['id']][_0x68ef('0x1e')]();_0x133788['smsQueues'][_0x159395['id']][_0x68ef('0x20')]();}}return _0x133788['smsQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x21')]=function(){var _0x4973c2=this;return function(_0x24c2c9){if(_0x24c2c9){freeIsNotKey(_0x24c2c9,_0x4973c2['mailQueues'],'id');for(var _0x38c2f8=0x0,_0x575f43={},_0x2fbb0d={};_0x38c2f8<_0x24c2c9[_0x68ef('0x1a')];_0x38c2f8+=0x1){_0x575f43=_0x24c2c9[_0x38c2f8];if(_[_0x68ef('0x1d')](_0x4973c2['mailQueues'][_0x575f43['id']])){_0x4973c2[_0x68ef('0x22')][_0x575f43['id']]=new MailQueue(_0x575f43);}else{_0x4973c2['mergeFromDatabase'](_0x4973c2[_0x68ef('0x22')][_0x575f43['id']],_0x575f43);}_0x4973c2['mailQueues'][_0x575f43['id']][_0x68ef('0x1e')]();_0x4973c2[_0x68ef('0x22')][_0x575f43['id']][_0x68ef('0x20')]();}}return _0x4973c2[_0x68ef('0x22')];};};Realtime[_0x68ef('0x17')][_0x68ef('0x23')]=function(){var _0x51ba3d=this;return function(_0x294fba){if(_0x294fba){freeIsNotKey(_0x294fba,_0x51ba3d[_0x68ef('0xe')],'id');for(var _0x32074a=0x0,_0x52a8b9={},_0x32eddd={};_0x32074a<_0x294fba[_0x68ef('0x1a')];_0x32074a+=0x1){_0x52a8b9=_0x294fba[_0x32074a];if(_[_0x68ef('0x1d')](_0x51ba3d['faxQueues'][_0x52a8b9['id']])){_0x51ba3d['faxQueues'][_0x52a8b9['id']]=new FaxQueue(_0x52a8b9);}else{_0x51ba3d[_0x68ef('0x18')](_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']],_0x52a8b9);}_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x1e')]();_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x20')]();}}return _0x51ba3d[_0x68ef('0xe')];};};Realtime['prototype'][_0x68ef('0x24')]=function(){var _0xd7f9ca=this;return function(_0x2f6ee0){if(_0x2f6ee0){freeIsNotKey(_0x2f6ee0,_0xd7f9ca[_0x68ef('0xf')],'id');for(var _0x492b74=0x0,_0x3cb156={},_0x3a2f53={};_0x492b74<_0x2f6ee0[_0x68ef('0x1a')];_0x492b74+=0x1){_0x3cb156=_0x2f6ee0[_0x492b74];if(_[_0x68ef('0x1d')](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']])){_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']]=new WhatsappQueue(_0x3cb156);}else{_0xd7f9ca['mergeFromDatabase'](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']],_0x3cb156);}_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x1e')]();_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x20')]();}}return _0xd7f9ca[_0x68ef('0xf')];};};module[_0x68ef('0x25')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 26eb693..d4a1a33 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 _0xb2cf=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xb2cf,0x1a8));var _0xfb2c=function(_0x3d2bcd,_0x4ea0ed){_0x3d2bcd=_0x3d2bcd-0x0;var _0x5a2ba4=_0xb2cf[_0x3d2bcd];return _0x5a2ba4;};'use strict';var client=require(_0xfb2c('0x0'));exports[_0xfb2c('0x1')]=function(_0x174324,_0x9e0ad3){return client[_0xfb2c('0x2')](_0xfb2c('0x3'),{'body':_0x9e0ad3,'options':{'where':{'id':_0x174324}},'log':'updateChatInteraction'});};exports[_0xfb2c('0x4')]=function(_0x14325f,_0x8e1a0f){return client['Request'](_0xfb2c('0x5'),{'body':_0x8e1a0f,'options':{'where':{'id':_0x14325f}},'log':_0xfb2c('0x6')});}; \ No newline at end of file +var _0x6e1d=['update','Request','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6e1d,0x161));var _0xd6e1=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x6e1d[_0x1cbcf1];return _0x3a06f0;};'use strict';var client=require(_0xd6e1('0x0'));exports[_0xd6e1('0x1')]=function(_0x614999,_0x31c368){return client[_0xd6e1('0x2')]('UpdateChatInteraction',{'body':_0x31c368,'options':{'where':{'id':_0x614999}},'log':_0xd6e1('0x3')});};exports[_0xd6e1('0x4')]=function(_0x307d7c,_0x2cc631){return client[_0xd6e1('0x2')]('AddTagsToChatInteraction',{'body':_0x2cc631,'options':{'where':{'id':_0x307d7c}},'log':_0xd6e1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index df0d88b..7d9ab51 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 _0x24cf=['Request','CreateChatMessage','../client'];(function(_0x37c824,_0x1496f9){var _0x322862=function(_0x557322){while(--_0x557322){_0x37c824['push'](_0x37c824['shift']());}};_0x322862(++_0x1496f9);}(_0x24cf,0x1a0));var _0xf24c=function(_0x3a6325,_0xa36fc2){_0x3a6325=_0x3a6325-0x0;var _0x3e5621=_0x24cf[_0x3a6325];return _0x3e5621;};'use strict';var client=require(_0xf24c('0x0'));exports['create']=function(_0x47f545){return client[_0xf24c('0x1')](_0xf24c('0x2'),{'body':_0x47f545,'log':'createChatMessage'});}; \ No newline at end of file +var _0x18de=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x277d74,_0x3bb7c8){var _0x3d18f8=function(_0x2ddac4){while(--_0x2ddac4){_0x277d74['push'](_0x277d74['shift']());}};_0x3d18f8(++_0x3bb7c8);}(_0x18de,0x1cf));var _0xe18d=function(_0x45d7a9,_0x21e348){_0x45d7a9=_0x45d7a9-0x0;var _0x3bce4a=_0x18de[_0x45d7a9];return _0x3bce4a;};'use strict';var client=require(_0xe18d('0x0'));exports[_0xe18d('0x1')]=function(_0xc5be51){return client[_0xe18d('0x2')](_0xe18d('0x3'),{'body':_0xc5be51,'log':_0xe18d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a6aec4f..39a6922 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 _0x1b6b=['Request','GetChatQueue','timeout','strategy','Agents','name','online','chatPause','getChatQueues','../client'];(function(_0x5a6f56,_0x2cbf3d){var _0x41a90f=function(_0x15eb31){while(--_0x15eb31){_0x5a6f56['push'](_0x5a6f56['shift']());}};_0x41a90f(++_0x2cbf3d);}(_0x1b6b,0xd1));var _0xb1b6=function(_0x2af409,_0x5d311a){_0x2af409=_0x2af409-0x0;var _0x5e8f45=_0x1b6b[_0x2af409];return _0x5e8f45;};'use strict';var client=require(_0xb1b6('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xb1b6('0x1')](_0xb1b6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xb1b6('0x3'),_0xb1b6('0x4')],'include':[{'model':'User','as':_0xb1b6('0x5'),'attributes':['id',_0xb1b6('0x6'),_0xb1b6('0x7'),_0xb1b6('0x8')]}]},'log':_0xb1b6('0x9')});};}; \ No newline at end of file +var _0xaeb5=['User','Agents','name','online','chatPause','getChatQueues','Request','GetChatQueue','timeout'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xaeb5,0xc3));var _0x5aeb=function(_0x24b66b,_0x149f2a){_0x24b66b=_0x24b66b-0x0;var _0x1eac23=_0xaeb5[_0x24b66b];return _0x1eac23;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x5aeb('0x0')](_0x5aeb('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5aeb('0x2'),'strategy'],'include':[{'model':_0x5aeb('0x3'),'as':_0x5aeb('0x4'),'attributes':['id',_0x5aeb('0x5'),_0x5aeb('0x6'),_0x5aeb('0x7')]}]},'log':_0x5aeb('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index aeeb6ec..15aa299 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 _0x39a9=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x20a3e7,_0x44499e){var _0x3c27ed=function(_0xfccdb3){while(--_0xfccdb3){_0x20a3e7['push'](_0x20a3e7['shift']());}};_0x3c27ed(++_0x44499e);}(_0x39a9,0x1d0));var _0x939a=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x39a9[_0x30e004];return _0x5ca247;};'use strict';var client=require(_0x939a('0x0'));exports[_0x939a('0x1')]=function(_0xb72a0){return client[_0x939a('0x2')](_0x939a('0x3'),{'body':_0xb72a0,'log':_0x939a('0x3')});};exports[_0x939a('0x4')]=function(_0x2b4648,_0x450b95){return client[_0x939a('0x2')](_0x939a('0x5'),{'body':_0x450b95,'options':{'where':{'uniqueid':_0x2b4648},'order':[['id','DESC']],'limit':0x1},'log':_0x939a('0x5')});}; \ No newline at end of file +var _0xf874=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x110596,_0x235052){var _0x581068=function(_0x46734f){while(--_0x46734f){_0x110596['push'](_0x110596['shift']());}};_0x581068(++_0x235052);}(_0xf874,0x177));var _0x4f87=function(_0x5ec384,_0x26d31c){_0x5ec384=_0x5ec384-0x0;var _0x35a620=_0xf874[_0x5ec384];return _0x35a620;};'use strict';var client=require(_0x4f87('0x0'));exports['create']=function(_0x391d9f){return client[_0x4f87('0x1')](_0x4f87('0x2'),{'body':_0x391d9f,'log':_0x4f87('0x2')});};exports[_0x4f87('0x3')]=function(_0xe4464e,_0x87123d){return client['Request'](_0x4f87('0x4'),{'body':_0x87123d,'options':{'where':{'uniqueid':_0xe4464e},'order':[['id',_0x4f87('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 90dbc47..b24d76e 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 _0xe207=['updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','UpdateFaxInteraction'];(function(_0x58d77e,_0x1366c9){var _0x457f1e=function(_0x1f696a){while(--_0x1f696a){_0x58d77e['push'](_0x58d77e['shift']());}};_0x457f1e(++_0x1366c9);}(_0xe207,0x101));var _0x7e20=function(_0x54ecb0,_0x554a06){_0x54ecb0=_0x54ecb0-0x0;var _0x93dffa=_0xe207[_0x54ecb0];return _0x93dffa;};'use strict';var client=require(_0x7e20('0x0'));exports['update']=function(_0x5e716d,_0x555896){return client['Request'](_0x7e20('0x1'),{'body':_0x555896,'options':{'where':{'id':_0x5e716d}},'log':_0x7e20('0x2')});};exports[_0x7e20('0x3')]=function(_0x2485d2,_0x48d175){return client[_0x7e20('0x4')](_0x7e20('0x5'),{'body':_0x48d175,'options':{'where':{'id':_0x2485d2}},'log':_0x7e20('0x6')});}; \ No newline at end of file +var _0xefc4=['addTagsToFaxInteraction','update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5846b6,_0x299729){var _0x5b4ba4=function(_0x50357f){while(--_0x50357f){_0x5846b6['push'](_0x5846b6['shift']());}};_0x5b4ba4(++_0x299729);}(_0xefc4,0x181));var _0x4efc=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0xefc4[_0x5ef55a];return _0x20ae40;};'use strict';var client=require('../client');exports[_0x4efc('0x0')]=function(_0x16b2a2,_0x3ebc0e){return client[_0x4efc('0x1')](_0x4efc('0x2'),{'body':_0x3ebc0e,'options':{'where':{'id':_0x16b2a2}},'log':_0x4efc('0x3')});};exports[_0x4efc('0x4')]=function(_0x220c28,_0x592513){return client[_0x4efc('0x1')]('AddTagsToFaxInteraction',{'body':_0x592513,'options':{'where':{'id':_0x220c28}},'log':_0x4efc('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 23f41ca..d57bea6 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 _0x524f=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x2b3ab9,_0x2471c3){var _0x202929=function(_0x3e2a2f){while(--_0x3e2a2f){_0x2b3ab9['push'](_0x2b3ab9['shift']());}};_0x202929(++_0x2471c3);}(_0x524f,0x123));var _0xf524=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x524f[_0x1f99a0];return _0x1e0849;};'use strict';var client=require('../client');exports['create']=function(_0x40a5d1){return client[_0xf524('0x0')](_0xf524('0x1'),{'body':_0x40a5d1,'log':_0xf524('0x2')});}; \ No newline at end of file +var _0xe256=['CreateFaxMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe256,0x8b));var _0x6e25=function(_0x5314b1,_0x45da01){_0x5314b1=_0x5314b1-0x0;var _0x302689=_0xe256[_0x5314b1];return _0x302689;};'use strict';var client=require(_0x6e25('0x0'));exports[_0x6e25('0x1')]=function(_0x32c138){return client['Request'](_0x6e25('0x2'),{'body':_0x32c138,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 125522d..c8e3768 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 _0x5326=['name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues','GetFaxQueue'];(function(_0x44512b,_0x199f03){var _0x30e108=function(_0x8730a8){while(--_0x8730a8){_0x44512b['push'](_0x44512b['shift']());}};_0x30e108(++_0x199f03);}(_0x5326,0x165));var _0x6532=function(_0x56e711,_0x5917c8){_0x56e711=_0x56e711-0x0;var _0x1cf38f=_0x5326[_0x56e711];return _0x1cf38f;};'use strict';var client=require(_0x6532('0x0'));exports[_0x6532('0x1')]=function(){return function(){return client['Request'](_0x6532('0x2'),{'options':{'raw':![],'attributes':['id',_0x6532('0x3'),_0x6532('0x4'),_0x6532('0x5')],'include':[{'model':_0x6532('0x6'),'as':_0x6532('0x7'),'attributes':['id',_0x6532('0x3'),'online',_0x6532('0x8')]}]},'log':_0x6532('0x1')});};}; \ No newline at end of file +var _0xd87a=['Request','name','User','Agents','online','../client','getFaxQueues'];(function(_0x26a382,_0x3d54db){var _0x14f9c8=function(_0x1b69f6){while(--_0x1b69f6){_0x26a382['push'](_0x26a382['shift']());}};_0x14f9c8(++_0x3d54db);}(_0xd87a,0x7c));var _0xad87=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xd87a[_0x83af7f];return _0x32d85c;};'use strict';var client=require(_0xad87('0x0'));exports[_0xad87('0x1')]=function(){return function(){return client[_0xad87('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xad87('0x3'),'timeout','strategy'],'include':[{'model':_0xad87('0x4'),'as':_0xad87('0x5'),'attributes':['id',_0xad87('0x3'),_0xad87('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 43c5b15..73540da 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 _0xdf02=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x48f0bc,_0x4960ed){var _0xa46b85=function(_0x594a93){while(--_0x594a93){_0x48f0bc['push'](_0x48f0bc['shift']());}};_0xa46b85(++_0x4960ed);}(_0xdf02,0xde));var _0x2df0=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xdf02[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0x2df0('0x0'));exports[_0x2df0('0x1')]=function(_0x4c4c3e){return client[_0x2df0('0x2')]('CreateFaxQueueReport',{'body':_0x4c4c3e,'log':_0x2df0('0x3')});};exports[_0x2df0('0x4')]=function(_0x29c355,_0x36c624){return client[_0x2df0('0x2')](_0x2df0('0x5'),{'body':_0x36c624,'options':{'where':{'uniqueid':_0x29c355},'order':[['id',_0x2df0('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x26bb=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x26bb,0x8e));var _0xb26b=function(_0x55944d,_0x3195f0){_0x55944d=_0x55944d-0x0;var _0x494a5b=_0x26bb[_0x55944d];return _0x494a5b;};'use strict';var client=require(_0xb26b('0x0'));exports[_0xb26b('0x1')]=function(_0x54aa3d){return client[_0xb26b('0x2')]('CreateFaxQueueReport',{'body':_0x54aa3d,'log':_0xb26b('0x3')});};exports[_0xb26b('0x4')]=function(_0x46c089,_0x5a5f31){return client[_0xb26b('0x2')](_0xb26b('0x5'),{'body':_0x5a5f31,'options':{'where':{'uniqueid':_0x46c089},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a980260..1b2152c 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 _0xd7d1=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x2de5ab,_0x2682c3){var _0x162d19=function(_0x37ad95){while(--_0x37ad95){_0x2de5ab['push'](_0x2de5ab['shift']());}};_0x162d19(++_0x2682c3);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x39514b,_0x8b596e){_0x39514b=_0x39514b-0x0;var _0x2d3266=_0xd7d1[_0x39514b];return _0x2d3266;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(){return function(){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1d7d('0x4')],'include':[{'model':_0x1d7d('0x5'),'as':_0x1d7d('0x6'),'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0x7')]}]},'log':_0x1d7d('0x1')});};}; \ No newline at end of file +var _0xc2da=['name','Intervals','interval','getIntervals','../client','Request'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xc2da,0x124));var _0xac2d=function(_0x308bc6,_0x564ec7){_0x308bc6=_0x308bc6-0x0;var _0x422fcf=_0xc2da[_0x308bc6];return _0x422fcf;};'use strict';var client=require(_0xac2d('0x0'));exports['getIntervals']=function(){return function(){return client[_0xac2d('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xac2d('0x2')],'include':[{'model':'Interval','as':_0xac2d('0x3'),'attributes':['id',_0xac2d('0x2'),_0xac2d('0x4')]}]},'log':_0xac2d('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 322be6d..d0144d7 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 _0x790d=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction'];(function(_0xb6ce64,_0x180025){var _0x38ddd=function(_0x36d79a){while(--_0x36d79a){_0xb6ce64['push'](_0xb6ce64['shift']());}};_0x38ddd(++_0x180025);}(_0x790d,0xe1));var _0xd790=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x790d[_0x3a94e1];return _0x6a09d5;};'use strict';var client=require(_0xd790('0x0'));exports[_0xd790('0x1')]=function(_0x3b2218,_0x47ee83){return client[_0xd790('0x2')](_0xd790('0x3'),{'body':_0x47ee83,'options':{'where':{'id':_0x3b2218}},'log':_0xd790('0x4')});};exports['addTags']=function(_0x4b2f62,_0x4a0af7){return client[_0xd790('0x2')](_0xd790('0x5'),{'body':_0x4a0af7,'options':{'where':{'id':_0x4b2f62}},'log':_0xd790('0x6')});}; \ No newline at end of file +var _0x630a=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x160ef0,_0x131e44){var _0x44d081=function(_0x1aa3ef){while(--_0x1aa3ef){_0x160ef0['push'](_0x160ef0['shift']());}};_0x44d081(++_0x131e44);}(_0x630a,0x166));var _0xa630=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x630a[_0x10291b];return _0x1d5fbe;};'use strict';var client=require(_0xa630('0x0'));exports[_0xa630('0x1')]=function(_0x418ac5,_0x55394e){return client[_0xa630('0x2')](_0xa630('0x3'),{'body':_0x55394e,'options':{'where':{'id':_0x418ac5}},'log':_0xa630('0x4')});};exports[_0xa630('0x5')]=function(_0x57ed67,_0x31eaea){return client['Request'](_0xa630('0x6'),{'body':_0x31eaea,'options':{'where':{'id':_0x57ed67}},'log':_0xa630('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5fb340a..f388c72 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 _0x65dd=['CreateMailMessage','../client'];(function(_0x1bbe6c,_0x56d18a){var _0x76ab07=function(_0x220f14){while(--_0x220f14){_0x1bbe6c['push'](_0x1bbe6c['shift']());}};_0x76ab07(++_0x56d18a);}(_0x65dd,0x199));var _0xd65d=function(_0x4bc53b,_0x39fc31){_0x4bc53b=_0x4bc53b-0x0;var _0x5743f5=_0x65dd[_0x4bc53b];return _0x5743f5;};'use strict';var client=require(_0xd65d('0x0'));exports['create']=function(_0x513501){return client['Request'](_0xd65d('0x1'),{'body':_0x513501,'log':'createMailMessage'});}; \ No newline at end of file +var _0x686c=['create'];(function(_0x43e58c,_0x5efeb1){var _0x56f27e=function(_0x38f1f3){while(--_0x38f1f3){_0x43e58c['push'](_0x43e58c['shift']());}};_0x56f27e(++_0x5efeb1);}(_0x686c,0x113));var _0xc686=function(_0x1becf4,_0x54d2f0){_0x1becf4=_0x1becf4-0x0;var _0x4fedf2=_0x686c[_0x1becf4];return _0x4fedf2;};'use strict';var client=require('../client');exports[_0xc686('0x0')]=function(_0x113289){return client['Request']('CreateMailMessage',{'body':_0x113289,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 70f060c..a441f7d 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 _0x0ad8=['name','timeout','Agents','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0xdf1d4d,_0xf23cac){var _0x2637a4=function(_0x4617d4){while(--_0x4617d4){_0xdf1d4d['push'](_0xdf1d4d['shift']());}};_0x2637a4(++_0xf23cac);}(_0x0ad8,0x17c));var _0x80ad=function(_0x19a95a,_0x246daf){_0x19a95a=_0x19a95a-0x0;var _0x397a89=_0x0ad8[_0x19a95a];return _0x397a89;};'use strict';var client=require(_0x80ad('0x0'));exports[_0x80ad('0x1')]=function(){return function(){return client[_0x80ad('0x2')](_0x80ad('0x3'),{'options':{'raw':![],'attributes':['id',_0x80ad('0x4'),_0x80ad('0x5'),'strategy'],'include':[{'model':'User','as':_0x80ad('0x6'),'attributes':['id',_0x80ad('0x4'),'online',_0x80ad('0x7')]}]},'log':_0x80ad('0x1')});};}; \ No newline at end of file +var _0xb394=['strategy','User','Agents','online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout'];(function(_0x59965c,_0x2a1658){var _0x58cf2d=function(_0x38027b){while(--_0x38027b){_0x59965c['push'](_0x59965c['shift']());}};_0x58cf2d(++_0x2a1658);}(_0xb394,0xe2));var _0x4b39=function(_0x2f2fe2,_0x55913d){_0x2f2fe2=_0x2f2fe2-0x0;var _0x49a79d=_0xb394[_0x2f2fe2];return _0x49a79d;};'use strict';var client=require(_0x4b39('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x4b39('0x1')](_0x4b39('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b39('0x3'),_0x4b39('0x4'),_0x4b39('0x5')],'include':[{'model':_0x4b39('0x6'),'as':_0x4b39('0x7'),'attributes':['id','name',_0x4b39('0x8'),_0x4b39('0x9')]}]},'log':_0x4b39('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4dfa080..037771f 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 _0x6dbf=['CreateMailQueueReport','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6dbf,0x81));var _0xf6db=function(_0x212afc,_0x2919af){_0x212afc=_0x212afc-0x0;var _0x4fa879=_0x6dbf[_0x212afc];return _0x4fa879;};'use strict';var client=require(_0xf6db('0x0'));exports[_0xf6db('0x1')]=function(_0x23c3e9){return client[_0xf6db('0x2')](_0xf6db('0x3'),{'body':_0x23c3e9,'log':_0xf6db('0x3')});};exports['update']=function(_0x40558a,_0x1d9336){return client['Request']('UpdateMailQueueReport',{'body':_0x1d9336,'options':{'where':{'uniqueid':_0x40558a},'order':[['id',_0xf6db('0x4')]],'limit':0x1},'log':_0xf6db('0x5')});}; \ No newline at end of file +var _0xe8ea=['UpdateMailQueueReport','DESC','Request','CreateMailQueueReport','update'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xe8ea,0x1dd));var _0xae8e=function(_0x53dd23,_0x319c48){_0x53dd23=_0x53dd23-0x0;var _0x35671a=_0xe8ea[_0x53dd23];return _0x35671a;};'use strict';var client=require('../client');exports['create']=function(_0xf65414){return client[_0xae8e('0x0')](_0xae8e('0x1'),{'body':_0xf65414,'log':_0xae8e('0x1')});};exports[_0xae8e('0x2')]=function(_0x56c36b,_0x545f87){return client[_0xae8e('0x0')](_0xae8e('0x3'),{'body':_0x545f87,'options':{'where':{'uniqueid':_0x56c36b},'order':[['id',_0xae8e('0x4')]],'limit':0x1},'log':_0xae8e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 68a78e0..fc2e702 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 _0xce3d=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update'];(function(_0x29e371,_0xf3d8c9){var _0x478324=function(_0x4cfd01){while(--_0x4cfd01){_0x29e371['push'](_0x29e371['shift']());}};_0x478324(++_0xf3d8c9);}(_0xce3d,0x132));var _0xdce3=function(_0x5d7803,_0x30e9aa){_0x5d7803=_0x5d7803-0x0;var _0x1a43b2=_0xce3d[_0x5d7803];return _0x1a43b2;};'use strict';var client=require(_0xdce3('0x0'));exports[_0xdce3('0x1')]=function(_0x488c92,_0x4cb8be){return client[_0xdce3('0x2')](_0xdce3('0x3'),{'body':_0x4cb8be,'options':{'where':{'id':_0x488c92}},'log':_0xdce3('0x4')});};exports[_0xdce3('0x5')]=function(_0x207d16,_0x4a348d){return client['Request'](_0xdce3('0x6'),{'body':_0x4a348d,'options':{'where':{'id':_0x207d16}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x1206=['addTagsToChatInteraction','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x176683,_0x168eb1){var _0x41ab61=function(_0x30b18e){while(--_0x30b18e){_0x176683['push'](_0x176683['shift']());}};_0x41ab61(++_0x168eb1);}(_0x1206,0xec));var _0x6120=function(_0x4bc156,_0x5ab86e){_0x4bc156=_0x4bc156-0x0;var _0x33c7da=_0x1206[_0x4bc156];return _0x33c7da;};'use strict';var client=require('../client');exports['update']=function(_0x13d227,_0x3e84a5){return client[_0x6120('0x0')](_0x6120('0x1'),{'body':_0x3e84a5,'options':{'where':{'id':_0x13d227}},'log':'updateOpenchannelInteraction'});};exports[_0x6120('0x2')]=function(_0x364691,_0x109d8a){return client[_0x6120('0x0')](_0x6120('0x3'),{'body':_0x109d8a,'options':{'where':{'id':_0x364691}},'log':_0x6120('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 06c7a93..1b0ffb5 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 _0xe14d=['Request','createOpenchannelMessage','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14d,0x1ee));var _0xde14=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe14d[_0x266618];return _0x54dbf5;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateOpenchannelMessage',{'body':_0x1b5d3b,'log':_0xde14('0x3')});}; \ No newline at end of file +var _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0xc06a4e,_0x22d0c3){var _0x313fe7=function(_0x350b86){while(--_0x350b86){_0xc06a4e['push'](_0xc06a4e['shift']());}};_0x313fe7(++_0x22d0c3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3ed430,_0x5fafab){_0x3ed430=_0x3ed430-0x0;var _0xae4a10=_0xbdb7[_0x3ed430];return _0xae4a10;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5adea25..2756be6 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 _0xc6f7=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x2cb7df,_0x2196db){var _0x47863d=function(_0x5c0f3d){while(--_0x5c0f3d){_0x2cb7df['push'](_0x2cb7df['shift']());}};_0x47863d(++_0x2196db);}(_0xc6f7,0x122));var _0x7c6f=function(_0x459918,_0x3281f7){_0x459918=_0x459918-0x0;var _0x149a78=_0xc6f7[_0x459918];return _0x149a78;};'use strict';var client=require(_0x7c6f('0x0'));exports[_0x7c6f('0x1')]=function(){return function(){return client['Request'](_0x7c6f('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c6f('0x3'),_0x7c6f('0x4'),_0x7c6f('0x5')],'include':[{'model':_0x7c6f('0x6'),'as':_0x7c6f('0x7'),'attributes':['id',_0x7c6f('0x3'),_0x7c6f('0x8'),_0x7c6f('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xd5ad=['strategy','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x511c6b,_0x24ece6){var _0x191672=function(_0x155920){while(--_0x155920){_0x511c6b['push'](_0x511c6b['shift']());}};_0x191672(++_0x24ece6);}(_0xd5ad,0x1f4));var _0xdd5a=function(_0x507523,_0x58488c){_0x507523=_0x507523-0x0;var _0x395885=_0xd5ad[_0x507523];return _0x395885;};'use strict';var client=require(_0xdd5a('0x0'));exports[_0xdd5a('0x1')]=function(){return function(){return client[_0xdd5a('0x2')](_0xdd5a('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xdd5a('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xdd5a('0x5'),_0xdd5a('0x6'),_0xdd5a('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 76f7481..37ba62a 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 _0xf5ac=['DESC','../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x559807,_0x5eba81){var _0x233bd2=function(_0x2c0fab){while(--_0x2c0fab){_0x559807['push'](_0x559807['shift']());}};_0x233bd2(++_0x5eba81);}(_0xf5ac,0x79));var _0xcf5a=function(_0x5c83c2,_0x60c559){_0x5c83c2=_0x5c83c2-0x0;var _0x1afef4=_0xf5ac[_0x5c83c2];return _0x1afef4;};'use strict';var client=require(_0xcf5a('0x0'));exports['create']=function(_0x26fb76){return client[_0xcf5a('0x1')](_0xcf5a('0x2'),{'body':_0x26fb76,'log':'CreateOpenchannelQueueReport'});};exports[_0xcf5a('0x3')]=function(_0x4971c8,_0x530e57){return client[_0xcf5a('0x1')](_0xcf5a('0x4'),{'body':_0x530e57,'options':{'where':{'uniqueid':_0x4971c8},'order':[['id',_0xcf5a('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xa5a4=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa5a4,0x1ac));var _0x4a5a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xa5a4[_0x3fba9f];return _0x192cf1;};'use strict';var client=require(_0x4a5a('0x0'));exports[_0x4a5a('0x1')]=function(_0x3946ce){return client[_0x4a5a('0x2')](_0x4a5a('0x3'),{'body':_0x3946ce,'log':'CreateOpenchannelQueueReport'});};exports[_0x4a5a('0x4')]=function(_0x36cea6,_0x5e91a7){return client[_0x4a5a('0x2')](_0x4a5a('0x5'),{'body':_0x5e91a7,'options':{'where':{'uniqueid':_0x36cea6},'order':[['id','DESC']],'limit':0x1},'log':_0x4a5a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f9cfe6e..126b906 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 _0xc6f8=['addTags','addTagsToSmsInteraction','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x1a5332,_0xf73dde){var _0x3e7f32=function(_0x561607){while(--_0x561607){_0x1a5332['push'](_0x1a5332['shift']());}};_0x3e7f32(++_0xf73dde);}(_0xc6f8,0x14c));var _0x8c6f=function(_0x43904b,_0x1e1703){_0x43904b=_0x43904b-0x0;var _0x5274d5=_0xc6f8[_0x43904b];return _0x5274d5;};'use strict';var client=require('../client');exports['update']=function(_0x39f9d8,_0x54cf34){return client[_0x8c6f('0x0')](_0x8c6f('0x1'),{'body':_0x54cf34,'options':{'where':{'id':_0x39f9d8}},'log':_0x8c6f('0x2')});};exports[_0x8c6f('0x3')]=function(_0x29b9b0,_0x5da903){return client[_0x8c6f('0x0')]('AddTagsToSmsInteraction',{'body':_0x5da903,'options':{'where':{'id':_0x29b9b0}},'log':_0x8c6f('0x4')});}; \ No newline at end of file +var _0x7c9d=['../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x502cbe,_0x5ef46b){var _0x306bd1=function(_0x3b456d){while(--_0x3b456d){_0x502cbe['push'](_0x502cbe['shift']());}};_0x306bd1(++_0x5ef46b);}(_0x7c9d,0x9b));var _0xd7c9=function(_0x4d13f4,_0x2d6953){_0x4d13f4=_0x4d13f4-0x0;var _0x2308a0=_0x7c9d[_0x4d13f4];return _0x2308a0;};'use strict';var client=require(_0xd7c9('0x0'));exports[_0xd7c9('0x1')]=function(_0x436a17,_0xfb4ff3){return client[_0xd7c9('0x2')](_0xd7c9('0x3'),{'body':_0xfb4ff3,'options':{'where':{'id':_0x436a17}},'log':'updateSmsInteraction'});};exports[_0xd7c9('0x4')]=function(_0x2360b9,_0x3c6dd2){return client[_0xd7c9('0x2')]('AddTagsToSmsInteraction',{'body':_0x3c6dd2,'options':{'where':{'id':_0x2360b9}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 49a05b9..36be5f7 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 _0xf2f2=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x528228,_0x1e5394){var _0x1417d5=function(_0x5398fa){while(--_0x5398fa){_0x528228['push'](_0x528228['shift']());}};_0x1417d5(++_0x1e5394);}(_0xf2f2,0x101));var _0x2f2f=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0xf2f2[_0x119e7a];return _0x1fb90a;};'use strict';var client=require(_0x2f2f('0x0'));exports['create']=function(_0x36c969){return client[_0x2f2f('0x1')](_0x2f2f('0x2'),{'body':_0x36c969,'log':_0x2f2f('0x3')});}; \ No newline at end of file +var _0xc212=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xc212,0x175));var _0x2c21=function(_0x15ec05,_0x51dd86){_0x15ec05=_0x15ec05-0x0;var _0x2a9659=_0xc212[_0x15ec05];return _0x2a9659;};'use strict';var client=require(_0x2c21('0x0'));exports['create']=function(_0x323295){return client[_0x2c21('0x1')](_0x2c21('0x2'),{'body':_0x323295,'log':_0x2c21('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 97759eb..d6c5fe6 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 _0x5b1d=['Agents','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User'];(function(_0x49ea88,_0x2dbea4){var _0x4ba86f=function(_0x3d94fc){while(--_0x3d94fc){_0x49ea88['push'](_0x49ea88['shift']());}};_0x4ba86f(++_0x2dbea4);}(_0x5b1d,0x92));var _0xd5b1=function(_0x5bebeb,_0x321512){_0x5bebeb=_0x5bebeb-0x0;var _0x3ea1f1=_0x5b1d[_0x5bebeb];return _0x3ea1f1;};'use strict';var client=require(_0xd5b1('0x0'));exports[_0xd5b1('0x1')]=function(){return function(){return client[_0xd5b1('0x2')](_0xd5b1('0x3'),{'options':{'raw':![],'attributes':['id',_0xd5b1('0x4'),_0xd5b1('0x5'),_0xd5b1('0x6')],'include':[{'model':_0xd5b1('0x7'),'as':_0xd5b1('0x8'),'attributes':['id',_0xd5b1('0x4'),_0xd5b1('0x9'),_0xd5b1('0xa')]}]},'log':_0xd5b1('0x1')});};}; \ No newline at end of file +var _0xf494=['User','Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy'];(function(_0xee5bcb,_0x28070a){var _0xe2cc6=function(_0x5d395c){while(--_0x5d395c){_0xee5bcb['push'](_0xee5bcb['shift']());}};_0xe2cc6(++_0x28070a);}(_0xf494,0x1c6));var _0x4f49=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0xf494[_0x89c40f];return _0x17acbb;};'use strict';var client=require(_0x4f49('0x0'));exports[_0x4f49('0x1')]=function(){return function(){return client[_0x4f49('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x4f49('0x3'),_0x4f49('0x4'),_0x4f49('0x5')],'include':[{'model':_0x4f49('0x6'),'as':_0x4f49('0x7'),'attributes':['id',_0x4f49('0x3'),_0x4f49('0x8'),_0x4f49('0x9')]}]},'log':_0x4f49('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 825c79d..d7a3c75 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 _0x36b1=['DESC','../client','create','Request','UpdateSmsQueueReport'];(function(_0x17249c,_0x168d62){var _0x324e7b=function(_0x1b1397){while(--_0x1b1397){_0x17249c['push'](_0x17249c['shift']());}};_0x324e7b(++_0x168d62);}(_0x36b1,0x1aa));var _0x136b=function(_0xa5aaf9,_0x51c384){_0xa5aaf9=_0xa5aaf9-0x0;var _0x2c05d0=_0x36b1[_0xa5aaf9];return _0x2c05d0;};'use strict';var client=require(_0x136b('0x0'));exports[_0x136b('0x1')]=function(_0x46dfb2){return client['Request']('CreateSmsQueueReport',{'body':_0x46dfb2,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x1aa203,_0x534dac){return client[_0x136b('0x2')](_0x136b('0x3'),{'body':_0x534dac,'options':{'where':{'uniqueid':_0x1aa203},'order':[['id',_0x136b('0x4')]],'limit':0x1},'log':_0x136b('0x3')});}; \ No newline at end of file +var _0xedca=['CreateSmsQueueReport','update','Request','DESC','UpdateSmsQueueReport','../client','create'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0xedca,0xc9));var _0xaedc=function(_0x31d97b,_0x43f835){_0x31d97b=_0x31d97b-0x0;var _0x3edb97=_0xedca[_0x31d97b];return _0x3edb97;};'use strict';var client=require(_0xaedc('0x0'));exports[_0xaedc('0x1')]=function(_0x5c4803){return client['Request'](_0xaedc('0x2'),{'body':_0x5c4803,'log':'CreateSmsQueueReport'});};exports[_0xaedc('0x3')]=function(_0x31d9c6,_0xceee20){return client[_0xaedc('0x4')]('UpdateSmsQueueReport',{'body':_0xceee20,'options':{'where':{'uniqueid':_0x31d9c6},'order':[['id',_0xaedc('0x5')]],'limit':0x1},'log':_0xaedc('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 93dfc80..6e1eb72 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 _0x5723=['openchannelCapacity','../client','getAgents','GetUser','name','online','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity'];(function(_0x2ceb47,_0x5c6f60){var _0x4a77b0=function(_0x3c5771){while(--_0x3c5771){_0x2ceb47['push'](_0x2ceb47['shift']());}};_0x4a77b0(++_0x5c6f60);}(_0x5723,0xef));var _0x3572=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5723[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x3572('0x0'));exports[_0x3572('0x1')]=function(){return function(){return client['Request'](_0x3572('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x3572('0x3'),_0x3572('0x4'),'pauseType',_0x3572('0x5'),_0x3572('0x6'),_0x3572('0x7'),_0x3572('0x8'),_0x3572('0x9'),_0x3572('0xa'),_0x3572('0xb'),_0x3572('0xc'),_0x3572('0xd'),'mailCapacity',_0x3572('0xe'),_0x3572('0xf'),'whatsappCapacity',_0x3572('0x10')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x192a=['Request','online','lastPauseAt','voicePause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','../client','getAgents'];(function(_0x4ec6db,_0x393d10){var _0x5b46fc=function(_0x18d087){while(--_0x18d087){_0x4ec6db['push'](_0x4ec6db['shift']());}};_0x5b46fc(++_0x393d10);}(_0x192a,0x16a));var _0xa192=function(_0x13ae3f,_0x235b18){_0x13ae3f=_0x13ae3f-0x0;var _0x1d6e04=_0x192a[_0x13ae3f];return _0x1d6e04;};'use strict';var client=require(_0xa192('0x0'));exports[_0xa192('0x1')]=function(){return function(){return client[_0xa192('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name',_0xa192('0x3'),'pauseType',_0xa192('0x4'),_0xa192('0x5'),'chatPause','mailPause',_0xa192('0x6'),_0xa192('0x7'),_0xa192('0x8'),_0xa192('0x9'),_0xa192('0xa'),_0xa192('0xb'),_0xa192('0xc'),'smsCapacity',_0xa192('0xd'),'openchannelCapacity']},'log':_0xa192('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 716df61..6e5b3ff 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 _0x9b9b=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x27812f,_0x3b89ac){var _0xfe3084=function(_0x149d84){while(--_0x149d84){_0x27812f['push'](_0x27812f['shift']());}};_0xfe3084(++_0x3b89ac);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4b14bb,_0xe7b4d3){_0x4b14bb=_0x4b14bb-0x0;var _0x285200=_0x9b9b[_0x4b14bb];return _0x285200;};'use strict';var client=require('../client');exports[_0xb9b9('0x0')]=function(_0x4980d7,_0x5010f5){return client[_0xb9b9('0x1')](_0xb9b9('0x2'),{'body':_0x5010f5,'options':{'where':{'id':_0x4980d7}},'log':_0xb9b9('0x3')});};exports[_0xb9b9('0x4')]=function(_0x1d6ab6,_0x43c8ff){return client[_0xb9b9('0x1')](_0xb9b9('0x5'),{'body':_0x43c8ff,'options':{'where':{'id':_0x1d6ab6}},'log':_0xb9b9('0x6')});}; \ No newline at end of file +var _0x56e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x4d5d28,_0x26bd9b){var _0x2026b1=function(_0x1fe42c){while(--_0x1fe42c){_0x4d5d28['push'](_0x4d5d28['shift']());}};_0x2026b1(++_0x26bd9b);}(_0x56e6,0x6b));var _0x656e=function(_0x2d3134,_0x477c10){_0x2d3134=_0x2d3134-0x0;var _0x2dd03e=_0x56e6[_0x2d3134];return _0x2dd03e;};'use strict';var client=require(_0x656e('0x0'));exports[_0x656e('0x1')]=function(_0x27c324,_0x75e34c){return client[_0x656e('0x2')](_0x656e('0x3'),{'body':_0x75e34c,'options':{'where':{'id':_0x27c324}},'log':'updateWhatsappInteraction'});};exports[_0x656e('0x4')]=function(_0x23c947,_0xe7d540){return client[_0x656e('0x2')](_0x656e('0x5'),{'body':_0xe7d540,'options':{'where':{'id':_0x23c947}},'log':_0x656e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a4efe85..4395837 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 _0x175d=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x41b4a9,_0x2a6605){var _0x4a0854=function(_0x16c60e){while(--_0x16c60e){_0x41b4a9['push'](_0x41b4a9['shift']());}};_0x4a0854(++_0x2a6605);}(_0x175d,0x18f));var _0xd175=function(_0x5bc4b4,_0x3144ba){_0x5bc4b4=_0x5bc4b4-0x0;var _0x7ffead=_0x175d[_0x5bc4b4];return _0x7ffead;};'use strict';var client=require(_0xd175('0x0'));exports[_0xd175('0x1')]=function(_0x5a61ff){return client[_0xd175('0x2')](_0xd175('0x3'),{'body':_0x5a61ff,'log':_0xd175('0x4')});}; \ No newline at end of file +var _0x7c24=['CreateWhatsappMessage','../client','Request'];(function(_0x551260,_0x39788a){var _0x5f257f=function(_0x4dcaef){while(--_0x4dcaef){_0x551260['push'](_0x551260['shift']());}};_0x5f257f(++_0x39788a);}(_0x7c24,0x1b7));var _0x47c2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7c24[_0x5f3f88];return _0xd08119;};'use strict';var client=require(_0x47c2('0x0'));exports['create']=function(_0x3ec61c){return client[_0x47c2('0x1')](_0x47c2('0x2'),{'body':_0x3ec61c,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 09f07ad..c9aee66 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 _0x6e6c=['name','User','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xc6e6('0x0'));exports[_0xc6e6('0x1')]=function(){return function(){return client['Request'](_0xc6e6('0x2'),{'options':{'raw':![],'attributes':['id',_0xc6e6('0x3'),'timeout','strategy'],'include':[{'model':_0xc6e6('0x4'),'as':'Agents','attributes':['id',_0xc6e6('0x3'),'online',_0xc6e6('0x5')]}]},'log':_0xc6e6('0x1')});};}; \ No newline at end of file +var _0x8cc8=['whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x50c8e4,_0xbd83c0){var _0x46a5ea=function(_0x371111){while(--_0x371111){_0x50c8e4['push'](_0x50c8e4['shift']());}};_0x46a5ea(++_0xbd83c0);}(_0x8cc8,0x177));var _0x88cc=function(_0x2741d0,_0x418a1f){_0x2741d0=_0x2741d0-0x0;var _0x259125=_0x8cc8[_0x2741d0];return _0x259125;};'use strict';var client=require(_0x88cc('0x0'));exports[_0x88cc('0x1')]=function(){return function(){return client[_0x88cc('0x2')](_0x88cc('0x3'),{'options':{'raw':![],'attributes':['id',_0x88cc('0x4'),_0x88cc('0x5'),_0x88cc('0x6')],'include':[{'model':_0x88cc('0x7'),'as':_0x88cc('0x8'),'attributes':['id',_0x88cc('0x4'),_0x88cc('0x9'),_0x88cc('0xa')]}]},'log':_0x88cc('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ee4cedd..e250eae 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 _0x35a6=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x5dbe03,_0x2941ff){var _0x8f51a9=function(_0x9fc00e){while(--_0x9fc00e){_0x5dbe03['push'](_0x5dbe03['shift']());}};_0x8f51a9(++_0x2941ff);}(_0x35a6,0x1a7));var _0x635a=function(_0x4dbdc3,_0x5a525d){_0x4dbdc3=_0x4dbdc3-0x0;var _0x1765ad=_0x35a6[_0x4dbdc3];return _0x1765ad;};'use strict';var client=require(_0x635a('0x0'));exports[_0x635a('0x1')]=function(_0x12e989){return client[_0x635a('0x2')](_0x635a('0x3'),{'body':_0x12e989,'log':_0x635a('0x3')});};exports['update']=function(_0x45c633,_0x545557){return client[_0x635a('0x2')](_0x635a('0x4'),{'body':_0x545557,'options':{'where':{'uniqueid':_0x45c633},'order':[['id',_0x635a('0x5')]],'limit':0x1},'log':_0x635a('0x4')});}; \ No newline at end of file +var _0x1fe8=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x898e5d,_0x5e2b4d){var _0x4adf2f=function(_0x4fda53){while(--_0x4fda53){_0x898e5d['push'](_0x898e5d['shift']());}};_0x4adf2f(++_0x5e2b4d);}(_0x1fe8,0xbc));var _0x81fe=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x1fe8[_0x565ed7];return _0x183ad7;};'use strict';var client=require('../client');exports['create']=function(_0x3edd6a){return client[_0x81fe('0x0')](_0x81fe('0x1'),{'body':_0x3edd6a,'log':_0x81fe('0x1')});};exports[_0x81fe('0x2')]=function(_0x12d307,_0x302bb4){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x302bb4,'options':{'where':{'uniqueid':_0x12d307},'order':[['id','DESC']],'limit':0x1},'log':_0x81fe('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 84e19d0..74a3e5e 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 _0xe6c9=['join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','consequence','length','[%s][AGENT]\x20%s','map'];(function(_0x4ad202,_0x2b7325){var _0x5653c5=function(_0x144005){while(--_0x144005){_0x4ad202['push'](_0x4ad202['shift']());}};_0x5653c5(++_0x2b7325);}(_0xe6c9,0x1cf));var _0x9e6c=function(_0x1ff9a8,_0x3be674){_0x1ff9a8=_0x1ff9a8-0x0;var _0x284012=_0xe6c9[_0x1ff9a8];return _0x284012;};'use strict';var schema=require(_0x9e6c('0x0'));var _=require(_0x9e6c('0x1'));var util=require(_0x9e6c('0x2'));var seqqueue=require(_0x9e6c('0x3'));var logger=require('../../../../config/logger')(_0x9e6c('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9e6c('0x5')},'timeout':{'type':_0x9e6c('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xd75d62,_0x447a63,_0x3c0ade){return logger['info'](util[_0x9e6c('0x7')](_0x9e6c('0x8'),_0xd75d62,_0x447a63['name'],_0x3c0ade));}function handleFindAgent(_0x1a582a){return function(_0x331e7b){return _0x331e7b['name']['toLowerCase']()===_0x1a582a['toLowerCase']();};}exports[_0x9e6c('0x9')]=function(_0x9f516d,_0xc104a2,_0x1298b1,_0x21346c){return function(_0x1d3ef5){try{var _0x436a6d={'name':_0xc104a2[0x0],'timeout':_0xc104a2[0x1]};var _0x2ae42b=queue['validate'](_0x436a6d,{'typecast':!![]});if(_0x2ae42b[_0x9e6c('0xa')]){logger['error'](_0x9e6c('0xb'),_0x9f516d,_[_0x9e6c('0xc')](_0x2ae42b,'message')[_0x9e6c('0xd')](',\x20'));_0x1d3ef5[_0x9e6c('0xe')]();}else{var _0xf81236=_[_0x9e6c('0xf')](_0x1298b1[_0x9e6c('0x10')],handleFindAgent(_0x436a6d['name']));if(_0xf81236){var _0xd17e0d=(_0x436a6d[_0x9e6c('0x11')]||0xa)*0x3e8;var _0x4e68ad,_0x127aa0;var _0x4a6dc5=seqqueue[_0x9e6c('0x12')](_0xd17e0d);_0x4a6dc5['id']=_0x9f516d;_0x4a6dc5[_0x9e6c('0x13')]=_0xd17e0d;_0x4a6dc5['channel']=_0x21346c[_0x9e6c('0x14')];writeLog(_0x9f516d,_0xf81236,util['format'](_0x9e6c('0x15'),_0xd17e0d));_0x1298b1[_0x9e6c('0x16')][_0x9f516d]['on'](_0x9e6c('0x17'),function(){logger[_0x9e6c('0x18')](_0x9e6c('0x19'),_0x9f516d);clearTimeout(_0x127aa0);_0x127aa0=undefined;_0x4a6dc5[_0x9e6c('0x1a')]();if(_0x1298b1[_0x9e6c('0x16')][_0x9f516d]){delete _0x1298b1[_0x9e6c('0x16')][_0x9f516d];}_0x1d3ef5['stop']();});_0x1298b1[_0x9e6c('0x16')][_0x9f516d]['on']('complete',function(){if(_0x1298b1[_0x9e6c('0x16')][_0x9f516d]){delete _0x1298b1['rules'][_0x9f516d];}});_0x127aa0=setTimeout(function(){logger[_0x9e6c('0x18')](_0x9e6c('0x1b'),_0x9f516d);clearTimeout(_0x127aa0);_0x4a6dc5[_0x9e6c('0x1a')]();_0x1d3ef5['next']();},_0xd17e0d);strategy[_0x9e6c('0x1c')](_0x4a6dc5,_0xf81236,_0x1298b1,_0x21346c);}else{logger[_0x9e6c('0x1d')](_0x9e6c('0x1e'),_0x9f516d,_0x436a6d['name']);_0x1d3ef5['stop']();}}}catch(_0x28bc3c){console[_0x9e6c('0x1f')](_0x28bc3c);logger['error'](_0x9e6c('0x20'),_0x9f516d,_0x28bc3c[_0x9e6c('0x21')]);_0x1d3ef5[_0x9e6c('0xe')]();}};}; \ No newline at end of file +var _0x849c=['rules','end','complete','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','join','stop','timeout','channel','START:%s'];(function(_0x1ae1cf,_0x495ec5){var _0x3f6779=function(_0x36be87){while(--_0x36be87){_0x1ae1cf['push'](_0x1ae1cf['shift']());}};_0x3f6779(++_0x495ec5);}(_0x849c,0x153));var _0xc849=function(_0x919947,_0x40a822){_0x919947=_0x919947-0x0;var _0x40bfb9=_0x849c[_0x919947];return _0x40bfb9;};'use strict';var schema=require(_0xc849('0x0'));var _=require(_0xc849('0x1'));var util=require(_0xc849('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xc849('0x3'))(_0xc849('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xc849('0x5'),'required':!![],'message':_0xc849('0x6')},'timeout':{'type':_0xc849('0x7'),'message':_0xc849('0x8')}});function writeLog(_0x4bac76,_0x430d43,_0x1ed908){return logger[_0xc849('0x9')](util[_0xc849('0xa')](_0xc849('0xb'),_0x4bac76,_0x430d43[_0xc849('0xc')],_0x1ed908));}function handleFindAgent(_0x1e593a){return function(_0x578c64){return _0x578c64[_0xc849('0xc')][_0xc849('0xd')]()===_0x1e593a[_0xc849('0xd')]();};}exports['consequence']=function(_0x3cb325,_0x4e934b,_0xb120ef,_0x4ec18a){return function(_0x316a27){try{var _0x5db035={'name':_0x4e934b[0x0],'timeout':_0x4e934b[0x1]};var _0x26055b=queue[_0xc849('0x0')](_0x5db035,{'typecast':!![]});if(_0x26055b[_0xc849('0xe')]){logger['error'](_0xc849('0xf'),_0x3cb325,_['map'](_0x26055b,'message')[_0xc849('0x10')](',\x20'));_0x316a27[_0xc849('0x11')]();}else{var _0x11cea3=_['find'](_0xb120ef['agents'],handleFindAgent(_0x5db035[_0xc849('0xc')]));if(_0x11cea3){var _0x43df43=(_0x5db035[_0xc849('0x12')]||0xa)*0x3e8;var _0x173f4f,_0x5589db;var _0x3cf2b2=seqqueue['createQueue'](_0x43df43);_0x3cf2b2['id']=_0x3cb325;_0x3cf2b2['atimeout']=_0x43df43;_0x3cf2b2[_0xc849('0x13')]=_0x4ec18a['channel'];writeLog(_0x3cb325,_0x11cea3,util[_0xc849('0xa')](_0xc849('0x14'),_0x43df43));_0xb120ef[_0xc849('0x15')][_0x3cb325]['on'](_0xc849('0x16'),function(){logger[_0xc849('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3cb325);clearTimeout(_0x5589db);_0x5589db=undefined;_0x3cf2b2['close']();if(_0xb120ef[_0xc849('0x15')][_0x3cb325]){delete _0xb120ef[_0xc849('0x15')][_0x3cb325];}_0x316a27[_0xc849('0x11')]();});_0xb120ef[_0xc849('0x15')][_0x3cb325]['on'](_0xc849('0x17'),function(){if(_0xb120ef['rules'][_0x3cb325]){delete _0xb120ef[_0xc849('0x15')][_0x3cb325];}});_0x5589db=setTimeout(function(){logger[_0xc849('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3cb325);clearTimeout(_0x5589db);_0x3cf2b2[_0xc849('0x18')]();_0x316a27[_0xc849('0x19')]();},_0x43df43);strategy[_0xc849('0x1a')](_0x3cf2b2,_0x11cea3,_0xb120ef,_0x4ec18a);}else{logger['error'](_0xc849('0x1b'),_0x3cb325,_0x5db035[_0xc849('0xc')]);_0x316a27[_0xc849('0x11')]();}}}catch(_0x4195ce){console[_0xc849('0x1c')](_0x4195ce);logger['error'](_0xc849('0x1d'),_0x3cb325,_0x4195ce['stack']);_0x316a27[_0xc849('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f12df63..a6c5392 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 _0x3f8a=['channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','Message','dialogState','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fb16a,_0x19e217){var _0x1bbd83=function(_0x4940d7){while(--_0x4940d7){_0x2fb16a['push'](_0x2fb16a['shift']());}};_0x1bbd83(++_0x19e217);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x27bae4,_0x3d2bf8){_0x27bae4=_0x27bae4-0x0;var _0x9733e6=_0x3f8a[_0x27bae4];return _0x9733e6;};'use strict';var _=require(_0xa3f8('0x0'));var moment=require(_0xa3f8('0x1'));var AWS=require(_0xa3f8('0x2'));var utils=require(_0xa3f8('0x3'));var logger=require('../../../../config/logger')(_0xa3f8('0x4'));var rpc={'chatMessage':require(_0xa3f8('0x5')),'openchannelMessage':require(_0xa3f8('0x6')),'mailMessage':require(_0xa3f8('0x7')),'smsMessage':require(_0xa3f8('0x8')),'faxMessage':require(_0xa3f8('0x9')),'whatsappMessage':require(_0xa3f8('0xa'))};exports[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return function(_0xcfea5){try{if(!_[_0xa3f8('0xc')](this[_0xa3f8('0xd')][_0xa3f8('0xe')])){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0xa3f8('0x11'));return _0xcfea5['next']();}var _0x47496a={'ContactId':this[_0xa3f8('0x12')]['id'],'sentAt':moment()[_0xa3f8('0x13')](_0xa3f8('0x14')),'direction':'out'};var _0x206b69=this[_0xa3f8('0x15')];if(_0x206b69===_0xa3f8('0x16')){_0x47496a[_0xa3f8('0x17')]=this[_0xa3f8('0x18')]['id'];}else{_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1a')]=this[_0xa3f8('0x18')]['id'];}_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1b')]=this[_0xa3f8('0xd')]['id'];if(this[_0xa3f8('0xd')]['created']){var _0x2d8f74=_0xf895d9[0x4];if(!_[_0xa3f8('0x1c')](_0x2d8f74)){_0x47496a[_0xa3f8('0x1d')]=utils[_0xa3f8('0x1e')](_0x2d8f74,this);return rpc[_0x206b69+'Message'][_0xa3f8('0x1f')](_0x47496a)[_0xa3f8('0x20')](function(_0x46a8d9){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a[_0xa3f8('0x1d')]);})[_0xa3f8('0x21')](function(_0x3e2e1c){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON['stringify'](_0x3e2e1c));})[_0xa3f8('0x23')](function(){logger['info'](_0xa3f8('0x24'),_0x1f160a);_0xcfea5[_0xa3f8('0x25')]();});}else{logger[_0xa3f8('0xf')](_0xa3f8('0x26'),_0x1f160a);_0xcfea5['stop']();}}else{var _0x1f0bb8=this;var _0x5b0d57=new AWS[(_0xa3f8('0x27'))]({'accessKeyId':_0xf895d9[0x0],'secretAccessKey':_0xf895d9[0x1],'region':_0xf895d9[0x2]});var _0x58336d={'botAlias':_0xa3f8('0x28'),'botName':_0xf895d9[0x3],'inputText':this[_0xa3f8('0x29')][_0xa3f8('0x1d')],'userId':this[_0xa3f8('0x15')]+':'+this[_0xa3f8('0xd')]['id'][_0xa3f8('0x2a')]()};_0x5b0d57[_0xa3f8('0x2b')](_0x58336d,function(_0x490717,_0xae76ec){if(_0x490717){logger['error'](_0xa3f8('0x10'),_0x1f160a,_0x490717[_0xa3f8('0x29')]);_0xcfea5[_0xa3f8('0x2c')]();}else if(_0xae76ec&&_0xae76ec[_0xa3f8('0x29')]){_0x1f0bb8[_0xa3f8('0x1d')][_0xa3f8('0x2d')]=_0xae76ec;_0x47496a[_0xa3f8('0x1d')]=_0xae76ec[_0xa3f8('0x29')];return rpc[_0x206b69+_0xa3f8('0x2e')][_0xa3f8('0x1f')](_0x47496a)['then'](function(_0x1c3358){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a['body']);if(_0xae76ec[_0xa3f8('0x2f')]=='Failed'){_0xcfea5[_0xa3f8('0x2c')]();}else{_0xcfea5[_0xa3f8('0x25')]();}})[_0xa3f8('0x21')](function(_0x4ea213){logger[_0xa3f8('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1f160a,JSON[_0xa3f8('0x30')](_0x4ea213));_0xcfea5[_0xa3f8('0x2c')]();});}else{_0xcfea5[_0xa3f8('0x2c')]();}});}}catch(_0x406140){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON[_0xa3f8('0x30')](_0x406140));_0xcfea5[_0xa3f8('0x25')]();}};}; \ No newline at end of file +var _0x31f0=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','dialogState','Failed','catch','error','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','Message','create','then','[%s][AMAZONLEX]\x20%s','body','stringify','finally'];(function(_0x4b4889,_0x41cc03){var _0x38aac9=function(_0x514501){while(--_0x514501){_0x4b4889['push'](_0x4b4889['shift']());}};_0x38aac9(++_0x41cc03);}(_0x31f0,0xb7));var _0x031f=function(_0x24221e,_0x3f8144){_0x24221e=_0x24221e-0x0;var _0x2acb89=_0x31f0[_0x24221e];return _0x2acb89;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var AWS=require(_0x031f('0x1'));var utils=require('./utils');var logger=require(_0x031f('0x2'))(_0x031f('0x3'));var rpc={'chatMessage':require(_0x031f('0x4')),'openchannelMessage':require(_0x031f('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x031f('0x6')),'faxMessage':require(_0x031f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x56328c,_0x3dc98e){return function(_0x487e65){try{if(!_[_0x031f('0x8')](this[_0x031f('0x9')][_0x031f('0xa')])){logger[_0x031f('0xb')]('[%s][AMAZONLEX]\x20%s',_0x56328c,_0x031f('0xc'));return _0x487e65[_0x031f('0xd')]();}var _0x327f11={'ContactId':this[_0x031f('0xe')]['id'],'sentAt':moment()[_0x031f('0xf')](_0x031f('0x10')),'direction':_0x031f('0x11')};var _0x3fd541=this['channel'];if(_0x3fd541===_0x031f('0x12')){_0x327f11[_0x031f('0x13')]=this[_0x031f('0x14')]['id'];}else{_0x327f11[_[_0x031f('0x15')](_0x3fd541)+_0x031f('0x16')]=this[_0x031f('0x14')]['id'];}_0x327f11[_[_0x031f('0x15')](_0x3fd541)+'InteractionId']=this[_0x031f('0x9')]['id'];if(this[_0x031f('0x9')][_0x031f('0x17')]){var _0x2e3dfe=_0x3dc98e[0x4];if(!_[_0x031f('0x18')](_0x2e3dfe)){_0x327f11['body']=utils['getMustacheRender'](_0x2e3dfe,this);return rpc[_0x3fd541+_0x031f('0x19')][_0x031f('0x1a')](_0x327f11)[_0x031f('0x1b')](function(_0x286177){logger['info'](_0x031f('0x1c'),_0x56328c,_0x327f11[_0x031f('0x1d')]);})['catch'](function(_0xcdae16){logger['error'](_0x031f('0x1c'),_0x56328c,JSON[_0x031f('0x1e')](_0xcdae16));})[_0x031f('0x1f')](function(){logger[_0x031f('0xb')](_0x031f('0x20'),_0x56328c);_0x487e65[_0x031f('0x21')]();});}else{logger[_0x031f('0xb')](_0x031f('0x22'),_0x56328c);_0x487e65[_0x031f('0x21')]();}}else{var _0x345bde=this;var _0x29dd6e=new AWS['LexRuntime']({'accessKeyId':_0x3dc98e[0x0],'secretAccessKey':_0x3dc98e[0x1],'region':_0x3dc98e[0x2]});var _0xf72793={'botAlias':_0x031f('0x23'),'botName':_0x3dc98e[0x3],'inputText':this[_0x031f('0x24')]['body'],'userId':this['channel']+':'+this[_0x031f('0x9')]['id']['toString']()};_0x29dd6e[_0x031f('0x25')](_0xf72793,function(_0x57f6c4,_0x54d054){if(_0x57f6c4){logger['error'](_0x031f('0x1c'),_0x56328c,_0x57f6c4[_0x031f('0x24')]);_0x487e65[_0x031f('0xd')]();}else if(_0x54d054&&_0x54d054[_0x031f('0x24')]){_0x345bde['body'][_0x031f('0x26')]=_0x54d054;_0x327f11['body']=_0x54d054[_0x031f('0x24')];return rpc[_0x3fd541+_0x031f('0x19')][_0x031f('0x1a')](_0x327f11)['then'](function(_0x35af16){logger[_0x031f('0xb')]('[%s][AMAZONLEX]\x20%s',_0x56328c,_0x327f11[_0x031f('0x1d')]);if(_0x54d054[_0x031f('0x27')]==_0x031f('0x28')){_0x487e65['next']();}else{_0x487e65[_0x031f('0x21')]();}})[_0x031f('0x29')](function(_0xb6ed6c){logger[_0x031f('0x2a')](_0x031f('0x1c'),_0x56328c,JSON[_0x031f('0x1e')](_0xb6ed6c));_0x487e65['next']();});}else{_0x487e65[_0x031f('0xd')]();}});}}catch(_0xab24ad){logger[_0x031f('0x2a')](_0x031f('0x1c'),_0x56328c,JSON[_0x031f('0x1e')](_0xab24ad));_0x487e65[_0x031f('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index a6a8cbc..cf1166e 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 _0x7fbd=['consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','mail','Smtp','service','host','port','secure','authentication','user','inReplyTo','replace','body','','sendMailMessage','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc'];(function(_0x3642a6,_0x36d827){var _0x369e1f=function(_0xd4d680){while(--_0xd4d680){_0x3642a6['push'](_0x3642a6['shift']());}};_0x369e1f(++_0x36d827);}(_0x7fbd,0x121));var _0xd7fb=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x7fbd[_0xe1441d];return _0x2ef242;};'use strict';var _=require(_0xd7fb('0x0'));var moment=require(_0xd7fb('0x1'));var utils=require(_0xd7fb('0x2'));var logger=require(_0xd7fb('0x3'))(_0xd7fb('0x4'));var rpc={'chatMessage':require(_0xd7fb('0x5')),'openchannelMessage':require(_0xd7fb('0x6')),'mailMessage':require(_0xd7fb('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd7fb('0x8')),'whatsappMessage':require(_0xd7fb('0x9'))};var mailRpc=require(_0xd7fb('0xa'));exports[_0xd7fb('0xb')]=function(_0x5065c2,_0x2c166f){return function(_0x33604f){try{if(_0x2c166f[0x0]==='1'&&(_[_0xd7fb('0xc')](this[_0xd7fb('0xd')][_0xd7fb('0xe')])||!this[_0xd7fb('0xd')][_0xd7fb('0xe')])){logger[_0xd7fb('0xf')](_0xd7fb('0x10'),_0x5065c2,_0xd7fb('0x11'));return _0x33604f[_0xd7fb('0x12')]();}var _0x33b344=this[_0xd7fb('0x13')];var _0x4f1888={'body':utils[_0xd7fb('0x14')](_0x2c166f[0x1],this),'ContactId':this[_0xd7fb('0x15')]['id'],'sentAt':moment()['format'](_0xd7fb('0x16')),'direction':'out'};if(this['message']){_0x4f1888['to']=this[_0xd7fb('0x17')][_0xd7fb('0x18')]||'';_0x4f1888['cc']=this[_0xd7fb('0x17')]['cc']||'';_0x4f1888[_0xd7fb('0x18')]=this[_0xd7fb('0x17')]['to']||'';_0x4f1888[_0xd7fb('0x19')]=this['message'][_0xd7fb('0x19')]||'';_0x4f1888[_0xd7fb('0x1a')]=!![];if(this[_0xd7fb('0x17')][_0xd7fb('0x1b')]){_0x4f1888[_0xd7fb('0x1b')]='';_0x4f1888[_0xd7fb('0x1b')]+=_['startsWith'](this[_0xd7fb('0x17')]['subject'],_0xd7fb('0x1c'))?'':_0xd7fb('0x1d');_0x4f1888['subject']+=this[_0xd7fb('0x17')][_0xd7fb('0x1b')];}}if(this[_0xd7fb('0x13')]===_0xd7fb('0x1e')){_0x4f1888[_0xd7fb('0x1f')]=this[_0xd7fb('0x20')]['id'];}else{_0x4f1888[_[_0xd7fb('0x21')](this['channel'])+_0xd7fb('0x22')]=this[_0xd7fb('0x20')]['id'];}_0x4f1888[_['upperFirst'](this[_0xd7fb('0x13')])+'InteractionId']=this[_0xd7fb('0xd')]['id'];if(rpc[this[_0xd7fb('0x13')]+_0xd7fb('0x23')]){if(this['channel']===_0xd7fb('0x24')){var _0x5e8b20={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xd7fb('0x25')][_0xd7fb('0x26')]){_0x5e8b20[_0xd7fb('0x26')]=this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x26')];}else{_0x5e8b20[_0xd7fb('0x27')]=this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x27')];_0x5e8b20[_0xd7fb('0x28')]=this[_0xd7fb('0x20')][_0xd7fb('0x25')][_0xd7fb('0x28')];_0x5e8b20[_0xd7fb('0x29')]=this[_0xd7fb('0x20')][_0xd7fb('0x25')][_0xd7fb('0x29')];}if(this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x2a')]){_0x5e8b20['auth']={'user':this[_0xd7fb('0x20')]['Smtp'][_0xd7fb('0x2b')],'pass':this[_0xd7fb('0x20')]['Smtp']['pass']};}_0x4f1888[_0xd7fb('0x2c')]=this[_0xd7fb('0x17')]['messageId'];_0x4f1888['html']=''+_[_0xd7fb('0x2d')](_0x4f1888[_0xd7fb('0x2e')],_0xd7fb('0x2f'),_0xd7fb('0x30'))+_0xd7fb('0x31');return mailRpc[_0xd7fb('0x32')](_0x5e8b20,_0x4f1888)['then'](function(_0x57fe40){logger[_0xd7fb('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x5065c2);_0x4f1888[_0xd7fb('0x33')]=_0x57fe40[_0xd7fb('0x17')]['messageId'];return rpc[_0x33b344+'Message'][_0xd7fb('0x34')](_0x4f1888);})[_0xd7fb('0x35')](function(_0x2e32ae){logger['info'](_0xd7fb('0x10'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x2e32ae));})[_0xd7fb('0x37')](function(_0x54d6d3){logger[_0xd7fb('0x38')](_0xd7fb('0x39'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x54d6d3));})[_0xd7fb('0x3a')](function(){_0x33604f[_0xd7fb('0x12')]();});}else{return rpc[this['channel']+'Message'][_0xd7fb('0x34')](_0x4f1888)[_0xd7fb('0x35')](function(_0x3a33f5){logger[_0xd7fb('0xf')](_0xd7fb('0x10'),_0x5065c2,_0x4f1888[_0xd7fb('0x2e')]);})[_0xd7fb('0x37')](function(_0x21525c){logger['error'](_0xd7fb('0x10'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x21525c));})[_0xd7fb('0x3a')](function(){_0x33604f[_0xd7fb('0x12')]();});}}}catch(_0x1fdc59){logger[_0xd7fb('0x38')](_0xd7fb('0x10'),_0x5065c2,JSON[_0xd7fb('0x36')](_0x1fdc59));_0x33604f[_0xd7fb('0x3b')]();}};}; \ No newline at end of file +var _0x4a93=['format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','auth','user','inReplyTo','messageId','html','','replace','body','','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','next','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','channel','getMustacheRender'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4a93,0x15b));var _0x34a9=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x4a93[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x34a9('0x0'));var moment=require(_0x34a9('0x1'));var utils=require(_0x34a9('0x2'));var logger=require(_0x34a9('0x3'))('routing');var rpc={'chatMessage':require(_0x34a9('0x4')),'openchannelMessage':require(_0x34a9('0x5')),'mailMessage':require(_0x34a9('0x6')),'smsMessage':require(_0x34a9('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x34a9('0x8'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x129719,_0x2d31cb){return function(_0x3a5fd5){try{if(_0x2d31cb[0x0]==='1'&&(_[_0x34a9('0x9')](this[_0x34a9('0xa')]['created'])||!this[_0x34a9('0xa')]['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x129719,'Autoreply\x20already\x20sent');return _0x3a5fd5['next']();}var _0x1fc9fa=this[_0x34a9('0xb')];var _0x4f2914={'body':utils[_0x34a9('0xc')](_0x2d31cb[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x34a9('0xd')](_0x34a9('0xe')),'direction':_0x34a9('0xf')};if(this[_0x34a9('0x10')]){_0x4f2914['to']=this[_0x34a9('0x10')][_0x34a9('0x11')]||'';_0x4f2914['cc']=this['message']['cc']||'';_0x4f2914['from']=this['message']['to']||'';_0x4f2914[_0x34a9('0x12')]=this[_0x34a9('0x10')][_0x34a9('0x12')]||'';_0x4f2914[_0x34a9('0x13')]=!![];if(this[_0x34a9('0x10')]['subject']){_0x4f2914[_0x34a9('0x14')]='';_0x4f2914[_0x34a9('0x14')]+=_[_0x34a9('0x15')](this[_0x34a9('0x10')][_0x34a9('0x14')],_0x34a9('0x16'))?'':_0x34a9('0x17');_0x4f2914[_0x34a9('0x14')]+=this[_0x34a9('0x10')][_0x34a9('0x14')];}}if(this[_0x34a9('0xb')]===_0x34a9('0x18')){_0x4f2914[_0x34a9('0x19')]=this[_0x34a9('0x1a')]['id'];}else{_0x4f2914[_[_0x34a9('0x1b')](this[_0x34a9('0xb')])+_0x34a9('0x1c')]=this[_0x34a9('0x1a')]['id'];}_0x4f2914[_[_0x34a9('0x1b')](this[_0x34a9('0xb')])+_0x34a9('0x1d')]=this['interaction']['id'];if(rpc[this[_0x34a9('0xb')]+_0x34a9('0x1e')]){if(this[_0x34a9('0xb')]===_0x34a9('0x1f')){var _0x4d92ee={'tls':{'rejectUnauthorized':![]}};if(this[_0x34a9('0x1a')][_0x34a9('0x20')][_0x34a9('0x21')]){_0x4d92ee['service']=this[_0x34a9('0x1a')][_0x34a9('0x20')][_0x34a9('0x21')];}else{_0x4d92ee[_0x34a9('0x22')]=this[_0x34a9('0x1a')]['Smtp'][_0x34a9('0x22')];_0x4d92ee[_0x34a9('0x23')]=this[_0x34a9('0x1a')]['Smtp'][_0x34a9('0x23')];_0x4d92ee[_0x34a9('0x24')]=this[_0x34a9('0x1a')][_0x34a9('0x20')]['secure'];}if(this['account']['Smtp']['authentication']){_0x4d92ee[_0x34a9('0x25')]={'user':this[_0x34a9('0x1a')][_0x34a9('0x20')][_0x34a9('0x26')],'pass':this[_0x34a9('0x1a')][_0x34a9('0x20')]['pass']};}_0x4f2914[_0x34a9('0x27')]=this[_0x34a9('0x10')][_0x34a9('0x28')];_0x4f2914[_0x34a9('0x29')]=_0x34a9('0x2a')+_[_0x34a9('0x2b')](_0x4f2914[_0x34a9('0x2c')],_0x34a9('0x2d'),_0x34a9('0x2e'))+_0x34a9('0x2f');return mailRpc['sendMailMessage'](_0x4d92ee,_0x4f2914)[_0x34a9('0x30')](function(_0x46ac4f){logger[_0x34a9('0x31')](_0x34a9('0x32'),_0x129719);_0x4f2914[_0x34a9('0x28')]=_0x46ac4f['message'][_0x34a9('0x28')];return rpc[_0x1fc9fa+_0x34a9('0x1e')][_0x34a9('0x33')](_0x4f2914);})['then'](function(_0x2e1d59){logger[_0x34a9('0x31')](_0x34a9('0x34'),_0x129719,JSON[_0x34a9('0x35')](_0x2e1d59));})[_0x34a9('0x36')](function(_0xde0364){logger[_0x34a9('0x37')](_0x34a9('0x38'),_0x129719,JSON[_0x34a9('0x35')](_0xde0364));})[_0x34a9('0x39')](function(){_0x3a5fd5[_0x34a9('0x3a')]();});}else{return rpc[this[_0x34a9('0xb')]+_0x34a9('0x1e')][_0x34a9('0x33')](_0x4f2914)[_0x34a9('0x30')](function(_0x394524){logger[_0x34a9('0x31')](_0x34a9('0x34'),_0x129719,_0x4f2914[_0x34a9('0x2c')]);})['catch'](function(_0x12ef87){logger[_0x34a9('0x37')]('[%s][AUTOREPLY]\x20%s',_0x129719,JSON['stringify'](_0x12ef87));})[_0x34a9('0x39')](function(){_0x3a5fd5[_0x34a9('0x3a')]();});}}}catch(_0xa9a070){logger[_0x34a9('0x37')]('[%s][AUTOREPLY]\x20%s',_0x129719,JSON[_0x34a9('0x35')](_0xa9a070));_0x3a5fd5[_0x34a9('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index bcbd64f..0139902 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 _0xf13b=['stringify','finally','stop','moment','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','info','catch','error'];(function(_0xdbbbee,_0x18c495){var _0x172b8f=function(_0x46dfed){while(--_0x46dfed){_0xdbbbee['push'](_0xdbbbee['shift']());}};_0x172b8f(++_0x18c495);}(_0xf13b,0x1f0));var _0xbf13=function(_0x9bf5b9,_0x129b0f){_0x9bf5b9=_0x9bf5b9-0x0;var _0xdf1f35=_0xf13b[_0x9bf5b9];return _0xdf1f35;};'use strict';var moment=require(_0xbf13('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xbf13('0x1')),'smsInteraction':require(_0xbf13('0x2')),'mailInteraction':require(_0xbf13('0x3')),'faxInteraction':require(_0xbf13('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x179246,_0x1256ed,_0x5f4b13,_0x325b03){return function(_0x2316ad){try{logger['info'](_0xbf13('0x5'),_0x179246,_0x1256ed[0x0]);var _0x212fac={'closed':0x1,'closedAt':moment()['format'](_0xbf13('0x6')),'closeReason':_0xbf13('0x7'),'disposition':_0x1256ed[0x0]};if(rpc[_0x325b03[_0xbf13('0x8')]+_0xbf13('0x9')]){rpc[_0x325b03['channel']+_0xbf13('0x9')]['update'](_0x325b03[_0xbf13('0xa')]['id'],_0x212fac)['then'](function(_0x1ac7a8){logger[_0xbf13('0xb')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x179246,_0x325b03[_0xbf13('0xa')]['id']);})[_0xbf13('0xc')](function(_0x1d6cc9){logger[_0xbf13('0xd')]('[%s][CLOSE]\x20%s',_0x179246,JSON[_0xbf13('0xe')](_0x1d6cc9));})[_0xbf13('0xf')](function(){_0x2316ad[_0xbf13('0x10')]();});}}catch(_0x1c0d95){logger['error']('[%s][CLOSE]\x20%s',_0x179246,JSON['stringify'](_0x1c0d95));_0x2316ad[_0xbf13('0x10')]();}};}; \ No newline at end of file +var _0xd8a7=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x3cf548,_0x322d92){_0x3cf548=_0x3cf548-0x0;var _0x207544=_0xd8a7[_0x3cf548];return _0x207544;};'use strict';var moment=require(_0x7d8a('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7d8a('0x1')),'smsInteraction':require(_0x7d8a('0x2')),'mailInteraction':require(_0x7d8a('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7d8a('0x4'))};exports['consequence']=function(_0x435491,_0x4906c5,_0x27ef8e,_0x530308){return function(_0x1cf673){try{logger[_0x7d8a('0x5')](_0x7d8a('0x6'),_0x435491,_0x4906c5[0x0]);var _0x58ead1={'closed':0x1,'closedAt':moment()[_0x7d8a('0x7')](_0x7d8a('0x8')),'closeReason':_0x7d8a('0x9'),'disposition':_0x4906c5[0x0]};if(rpc[_0x530308[_0x7d8a('0xa')]+_0x7d8a('0xb')]){rpc[_0x530308[_0x7d8a('0xa')]+_0x7d8a('0xb')][_0x7d8a('0xc')](_0x530308[_0x7d8a('0xd')]['id'],_0x58ead1)[_0x7d8a('0xe')](function(_0x32241e){logger[_0x7d8a('0x5')](_0x7d8a('0xf'),_0x435491,_0x530308['interaction']['id']);})[_0x7d8a('0x10')](function(_0xd57f7d){logger[_0x7d8a('0x11')](_0x7d8a('0x12'),_0x435491,JSON[_0x7d8a('0x13')](_0xd57f7d));})['finally'](function(){_0x1cf673[_0x7d8a('0x14')]();});}}catch(_0x5a9b2c){logger[_0x7d8a('0x11')]('[%s][CLOSE]\x20%s',_0x435491,JSON[_0x7d8a('0x13')](_0x5a9b2c));_0x1cf673['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 68edd55..d151ef5 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 _0x2a20=['contact','out','channel','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next'];(function(_0x5eeadd,_0x24b979){var _0x3b08a1=function(_0x5890e1){while(--_0x5890e1){_0x5eeadd['push'](_0x5eeadd['shift']());}};_0x3b08a1(++_0x24b979);}(_0x2a20,0x1f3));var _0x02a2=function(_0x575556,_0x564e7e){_0x575556=_0x575556-0x0;var _0x10c6a0=_0x2a20[_0x575556];return _0x10c6a0;};'use strict';var _=require(_0x02a2('0x0'));var moment=require(_0x02a2('0x1'));var apiai=require(_0x02a2('0x2'));var md5=require('md5');var utils=require(_0x02a2('0x3'));var logger=require(_0x02a2('0x4'))(_0x02a2('0x5'));var rpc={'chatMessage':require(_0x02a2('0x6')),'openchannelMessage':require(_0x02a2('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x02a2('0x8')),'faxMessage':require(_0x02a2('0x9')),'whatsappMessage':require(_0x02a2('0xa'))};exports[_0x02a2('0xb')]=function(_0x22613b,_0x121748){return function(_0x4ea425){try{if(!_[_0x02a2('0xc')](this[_0x02a2('0xd')]['UserId'])){logger[_0x02a2('0xe')](_0x02a2('0xf'),_0x22613b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4ea425[_0x02a2('0x10')]();}var _0x3b92b0={'ContactId':this[_0x02a2('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x02a2('0x12')};var _0x5b7fa5=this[_0x02a2('0x13')];if(_0x5b7fa5==='chat'){_0x3b92b0[_0x02a2('0x14')]=this[_0x02a2('0x15')]['id'];}else{_0x3b92b0[_[_0x02a2('0x16')](_0x5b7fa5)+_0x02a2('0x17')]=this[_0x02a2('0x15')]['id'];}_0x3b92b0[_[_0x02a2('0x16')](_0x5b7fa5)+'InteractionId']=this[_0x02a2('0xd')]['id'];if(this['interaction'][_0x02a2('0x18')]){var _0x349d70=_0x121748[0x2];if(!_[_0x02a2('0x19')](_0x349d70)){_0x3b92b0[_0x02a2('0x1a')]=utils[_0x02a2('0x1b')](_0x349d70,this);return rpc[_0x5b7fa5+_0x02a2('0x1c')][_0x02a2('0x1d')](_0x3b92b0)[_0x02a2('0x1e')](function(_0x2ee5bf){logger[_0x02a2('0xe')](_0x02a2('0xf'),_0x22613b,_0x3b92b0[_0x02a2('0x1a')]);})[_0x02a2('0x1f')](function(_0xa4b025){logger[_0x02a2('0x20')](_0x02a2('0xf'),_0x22613b,JSON[_0x02a2('0x21')](_0xa4b025));})[_0x02a2('0x22')](function(){logger[_0x02a2('0xe')](_0x02a2('0x23'),_0x22613b);_0x4ea425[_0x02a2('0x24')]();});}else{logger[_0x02a2('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x22613b);_0x4ea425[_0x02a2('0x24')]();}}else{var _0x40657e=this;var _0x7612e0=apiai(_0x121748[0x0],{'language':_0x121748[0x1]||'en'});return _0x7612e0[_0x02a2('0x25')](this[_0x02a2('0x26')][_0x02a2('0x1a')],{'sessionId':md5(this[_0x02a2('0xd')]['id'])})['then'](function(_0x17af87){_0x40657e[_0x02a2('0x1a')][_0x02a2('0x27')]=_0x17af87;_0x3b92b0[_0x02a2('0x1a')]=_0x17af87['result']['fulfillment']['speech'];return rpc[_0x5b7fa5+_0x02a2('0x1c')][_0x02a2('0x1d')](_0x3b92b0)['then'](function(_0x112032){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x22613b,_0x3b92b0[_0x02a2('0x1a')]);if(_0x17af87[_0x02a2('0x28')][_0x02a2('0x29')][_0x02a2('0x2a')]){_0x4ea425['next']();}else{_0x4ea425['stop']();}})[_0x02a2('0x1f')](function(_0x45235d){logger[_0x02a2('0x20')](_0x02a2('0xf'),_0x22613b,JSON[_0x02a2('0x21')](_0x45235d));_0x4ea425[_0x02a2('0x10')]();});})[_0x02a2('0x1f')](function(_0x1f2668){logger['error'](_0x02a2('0xf'),_0x22613b,_0x1f2668['message']);_0x4ea425['next']();});}}catch(_0xc9517c){logger[_0x02a2('0x20')](_0x02a2('0xf'),_0x22613b,JSON[_0x02a2('0x21')](_0xc9517c));_0x4ea425[_0x02a2('0x24')]();}};}; \ No newline at end of file +var _0xe1fc=['info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','metadata','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','then'];(function(_0x684730,_0x1b91e9){var _0x230593=function(_0x32377a){while(--_0x32377a){_0x684730['push'](_0x684730['shift']());}};_0x230593(++_0x1b91e9);}(_0xe1fc,0x143));var _0xce1f=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0xe1fc[_0x56756b];return _0xa3002;};'use strict';var _=require(_0xce1f('0x0'));var moment=require(_0xce1f('0x1'));var apiai=require(_0xce1f('0x2'));var md5=require(_0xce1f('0x3'));var utils=require(_0xce1f('0x4'));var logger=require('../../../../config/logger')(_0xce1f('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xce1f('0x6')),'mailMessage':require(_0xce1f('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xce1f('0x8'))};exports[_0xce1f('0x9')]=function(_0xaf1d4c,_0xc8a1de){return function(_0x4c661e){try{if(!_[_0xce1f('0xa')](this[_0xce1f('0xb')][_0xce1f('0xc')])){logger['info'](_0xce1f('0xd'),_0xaf1d4c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4c661e[_0xce1f('0xe')]();}var _0x1568d2={'ContactId':this[_0xce1f('0xf')]['id'],'sentAt':moment()[_0xce1f('0x10')](_0xce1f('0x11')),'direction':'out'};var _0x138e0b=this[_0xce1f('0x12')];if(_0x138e0b===_0xce1f('0x13')){_0x1568d2['ChatWebsiteId']=this[_0xce1f('0x14')]['id'];}else{_0x1568d2[_[_0xce1f('0x15')](_0x138e0b)+_0xce1f('0x16')]=this['account']['id'];}_0x1568d2[_[_0xce1f('0x15')](_0x138e0b)+'InteractionId']=this['interaction']['id'];if(this[_0xce1f('0xb')]['created']){var _0x40b401=_0xc8a1de[0x2];if(!_[_0xce1f('0x17')](_0x40b401)){_0x1568d2[_0xce1f('0x18')]=utils[_0xce1f('0x19')](_0x40b401,this);return rpc[_0x138e0b+_0xce1f('0x1a')][_0xce1f('0x1b')](_0x1568d2)[_0xce1f('0x1c')](function(_0x2723ae){logger[_0xce1f('0x1d')](_0xce1f('0xd'),_0xaf1d4c,_0x1568d2[_0xce1f('0x18')]);})[_0xce1f('0x1e')](function(_0x6cf4cf){logger[_0xce1f('0x1f')](_0xce1f('0xd'),_0xaf1d4c,JSON[_0xce1f('0x20')](_0x6cf4cf));})[_0xce1f('0x21')](function(){logger['info'](_0xce1f('0x22'),_0xaf1d4c);_0x4c661e['stop']();});}else{logger['info'](_0xce1f('0x23'),_0xaf1d4c);_0x4c661e['stop']();}}else{var _0x2d390d=this;var _0x5e8f84=apiai(_0xc8a1de[0x0],{'language':_0xc8a1de[0x1]||'en'});return _0x5e8f84[_0xce1f('0x24')](this[_0xce1f('0x25')][_0xce1f('0x18')],{'sessionId':md5(this[_0xce1f('0xb')]['id'])})['then'](function(_0x1d408a){_0x2d390d[_0xce1f('0x18')][_0xce1f('0x26')]=_0x1d408a;_0x1568d2['body']=_0x1d408a['result'][_0xce1f('0x27')][_0xce1f('0x28')];return rpc[_0x138e0b+_0xce1f('0x1a')][_0xce1f('0x1b')](_0x1568d2)[_0xce1f('0x1c')](function(_0x38ba54){logger[_0xce1f('0x1d')](_0xce1f('0xd'),_0xaf1d4c,_0x1568d2[_0xce1f('0x18')]);if(_0x1d408a['result'][_0xce1f('0x29')][_0xce1f('0x2a')]){_0x4c661e[_0xce1f('0xe')]();}else{_0x4c661e[_0xce1f('0x2b')]();}})[_0xce1f('0x1e')](function(_0x3848d4){logger[_0xce1f('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0xaf1d4c,JSON[_0xce1f('0x20')](_0x3848d4));_0x4c661e[_0xce1f('0xe')]();});})['catch'](function(_0x9e868e){logger['error'](_0xce1f('0xd'),_0xaf1d4c,_0x9e868e[_0xce1f('0x25')]);_0x4c661e[_0xce1f('0xe')]();});}}catch(_0x446e4f){logger[_0xce1f('0x1f')](_0xce1f('0xd'),_0xaf1d4c,JSON['stringify'](_0x446e4f));_0x4c661e[_0xce1f('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 3881b3d..93a3c86 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 _0x6839=['consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6839,0x136));var _0x9683=function(_0x424c0f,_0x31a27d){_0x424c0f=_0x424c0f-0x0;var _0x265bf4=_0x6839[_0x424c0f];return _0x265bf4;};'use strict';var schema=require(_0x9683('0x0'));var _=require(_0x9683('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x9683('0x2'));var logger=require(_0x9683('0x3'))(_0x9683('0x4'));var gotoif=schema({'condition':{'type':_0x9683('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x9683('0x6'),'message':_0x9683('0x7')},'priorityFalse':{'type':_0x9683('0x6'),'message':_0x9683('0x8')}});exports[_0x9683('0x9')]=function(_0xe7b01a,_0x5b94b4){return function(_0x4f4f41){try{var _0x1b7fc5={'condition':htmlToText[_0x9683('0xa')](utils[_0x9683('0xb')](_0x5b94b4[0x0],this),{'wordwrap':![]})[_0x9683('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5b94b4[0x1],'priorityFalse':_0x5b94b4[0x2]};var _0x3baffd=gotoif[_0x9683('0x0')](_0x1b7fc5,{'typecast':!![]});if(_0x3baffd[_0x9683('0xd')]){logger['error'](_0x9683('0xe'),_0xe7b01a,_['map'](_0x3baffd,'message')['join'](',\x20'));_0x4f4f41['stop']();}else{try{var _0x36dc2f=eval('('+_0x1b7fc5[_0x9683('0xf')]+')');var _0xbb4983=_0x36dc2f?_0x1b7fc5[_0x9683('0x10')]:_0x1b7fc5[_0x9683('0x11')];logger['info'](_0x9683('0x12'),_0xe7b01a,_0x1b7fc5[_0x9683('0xf')],_0x36dc2f,_0xbb4983||_0x9683('0x13'));if(_0xbb4983){var _0x4d0c5c=_[_0x9683('0x14')](_0x4f4f41[_0x9683('0x15')](),{'p':_0xbb4983});if(_0x4d0c5c>=0x0){logger[_0x9683('0x16')](_0x9683('0x17'),_0xe7b01a,_0xbb4983||_0x9683('0x13'),_0x4d0c5c);_0x4f4f41[_0x9683('0x13')](_0x4d0c5c);}else{logger[_0x9683('0x16')](_0x9683('0x18'),_0xe7b01a,_0xbb4983||_0x9683('0x13'));_0x4f4f41['stop']();}}else{_0x4f4f41['next']();}}catch(_0x3a7fc5){logger[_0x9683('0x19')](_0x9683('0x1a'),_0xe7b01a,_0x3a7fc5[_0x9683('0x1b')]);_0x4f4f41['stop']();}}}catch(_0x5d5b91){logger['error']('[%s][GOTOIF]\x20%s',_0xe7b01a,JSON[_0x9683('0x1c')](_0x5d5b91));_0x4f4f41['stop']();}};}; \ No newline at end of file +var _0x2834=['join','priorityTrue','priorityFalse','info','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x42879f,_0x3b68ed){var _0x328d93=function(_0x20e0ed){while(--_0x20e0ed){_0x42879f['push'](_0x42879f['shift']());}};_0x328d93(++_0x3b68ed);}(_0x2834,0x174));var _0x4283=function(_0x10bed5,_0x277d1e){_0x10bed5=_0x10bed5-0x0;var _0x198db7=_0x2834[_0x10bed5];return _0x198db7;};'use strict';var schema=require(_0x4283('0x0'));var _=require(_0x4283('0x1'));var htmlToText=require(_0x4283('0x2'));var utils=require(_0x4283('0x3'));var logger=require(_0x4283('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x4283('0x5'),'required':!![],'message':_0x4283('0x6')},'priorityTrue':{'type':_0x4283('0x7'),'message':_0x4283('0x8')},'priorityFalse':{'type':_0x4283('0x7'),'message':_0x4283('0x9')}});exports[_0x4283('0xa')]=function(_0x106851,_0x21a7cd){return function(_0x1d8d3f){try{var _0x43e9fa={'condition':htmlToText['fromString'](utils[_0x4283('0xb')](_0x21a7cd[0x0],this),{'wordwrap':![]})[_0x4283('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x21a7cd[0x1],'priorityFalse':_0x21a7cd[0x2]};var _0x272546=gotoif['validate'](_0x43e9fa,{'typecast':!![]});if(_0x272546[_0x4283('0xd')]){logger[_0x4283('0xe')](_0x4283('0xf'),_0x106851,_[_0x4283('0x10')](_0x272546,_0x4283('0x11'))[_0x4283('0x12')](',\x20'));_0x1d8d3f['stop']();}else{try{var _0x2f9edf=eval('('+_0x43e9fa['condition']+')');var _0x4d5148=_0x2f9edf?_0x43e9fa[_0x4283('0x13')]:_0x43e9fa[_0x4283('0x14')];logger[_0x4283('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x106851,_0x43e9fa[_0x4283('0x16')],_0x2f9edf,_0x4d5148||_0x4283('0x17'));if(_0x4d5148){var _0x39c45d=_[_0x4283('0x18')](_0x1d8d3f[_0x4283('0x19')](),{'p':_0x4d5148});if(_0x39c45d>=0x0){logger[_0x4283('0x15')](_0x4283('0x1a'),_0x106851,_0x4d5148||_0x4283('0x17'),_0x39c45d);_0x1d8d3f[_0x4283('0x17')](_0x39c45d);}else{logger[_0x4283('0x15')](_0x4283('0x1b'),_0x106851,_0x4d5148||_0x4283('0x17'));_0x1d8d3f['stop']();}}else{_0x1d8d3f[_0x4283('0x17')]();}}catch(_0x856a36){logger[_0x4283('0xe')](_0x4283('0x1c'),_0x106851,_0x856a36[_0x4283('0x11')]);_0x1d8d3f['stop']();}}}catch(_0x4f1ec6){logger['error'](_0x4283('0xf'),_0x106851,JSON[_0x4283('0x1d')](_0x4f1ec6));_0x1d8d3f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index e0996de..a83ab01 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 _0x6d13=['validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','stop'];(function(_0x128cea,_0x615e4b){var _0x358597=function(_0x561acb){while(--_0x561acb){_0x128cea['push'](_0x128cea['shift']());}};_0x358597(++_0x615e4b);}(_0x6d13,0x150));var _0x36d1=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x6d13[_0x364048];return _0x591678;};'use strict';var schema=require(_0x36d1('0x0'));var _=require(_0x36d1('0x1'));var logger=require(_0x36d1('0x2'))(_0x36d1('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x36d1('0x4')}});exports[_0x36d1('0x5')]=function(_0x3eaa6b,_0x1fe068){return function(_0x2144e5){try{var _0x10feed={'priority':_0x1fe068[0x0]};var _0x516b05=gotop[_0x36d1('0x0')](_0x10feed,{'typecast':!![]});if(_0x516b05[_0x36d1('0x6')]){logger[_0x36d1('0x7')](_0x36d1('0x8'),_0x3eaa6b,_[_0x36d1('0x9')](_0x516b05,_0x36d1('0xa'))[_0x36d1('0xb')](',\x20'));_0x2144e5['stop']();}else{logger[_0x36d1('0xc')](_0x36d1('0xd'),_0x3eaa6b,_0x10feed['priority']);if(_0x10feed[_0x36d1('0xe')]){var _0xc0dbca=_[_0x36d1('0xf')](_0x2144e5[_0x36d1('0x10')](),{'p':_0x10feed[_0x36d1('0xe')]});if(_0xc0dbca>=0x0){logger[_0x36d1('0xc')](_0x36d1('0x11'),_0x3eaa6b,_0x10feed[_0x36d1('0xe')]||_0x36d1('0x12'),_0xc0dbca);_0x2144e5[_0x36d1('0x12')](_0xc0dbca);}else{logger[_0x36d1('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x3eaa6b,_0x10feed[_0x36d1('0xe')]||'next');_0x2144e5['stop']();}}else{_0x2144e5['next']();}}}catch(_0x3760e7){logger[_0x36d1('0x7')]('[%s][GOTOP]\x20%s',_0x3eaa6b,JSON[_0x36d1('0x13')](_0x3760e7));_0x2144e5[_0x36d1('0x14')]();}};}; \ No newline at end of file +var _0xeac3=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xeac3,0x1f3));var _0x3eac=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeac3[_0x2641f9];return _0x585741;};'use strict';var schema=require(_0x3eac('0x0'));var _=require('lodash');var logger=require(_0x3eac('0x1'))('routing');var gotop=schema({'priority':{'type':_0x3eac('0x2'),'required':!![],'message':_0x3eac('0x3')}});exports[_0x3eac('0x4')]=function(_0xec023c,_0x77f43e){return function(_0x26a12d){try{var _0x1ebdc4={'priority':_0x77f43e[0x0]};var _0x37184c=gotop[_0x3eac('0x0')](_0x1ebdc4,{'typecast':!![]});if(_0x37184c[_0x3eac('0x5')]){logger['error'](_0x3eac('0x6'),_0xec023c,_['map'](_0x37184c,_0x3eac('0x7'))['join'](',\x20'));_0x26a12d['stop']();}else{logger[_0x3eac('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0xec023c,_0x1ebdc4['priority']);if(_0x1ebdc4[_0x3eac('0x9')]){var _0x1fb78e=_[_0x3eac('0xa')](_0x26a12d['rules'](),{'p':_0x1ebdc4['priority']});if(_0x1fb78e>=0x0){logger[_0x3eac('0x8')](_0x3eac('0xb'),_0xec023c,_0x1ebdc4[_0x3eac('0x9')]||_0x3eac('0xc'),_0x1fb78e);_0x26a12d[_0x3eac('0xc')](_0x1fb78e);}else{logger[_0x3eac('0x8')](_0x3eac('0xd'),_0xec023c,_0x1ebdc4[_0x3eac('0x9')]||_0x3eac('0xc'));_0x26a12d[_0x3eac('0xe')]();}}else{_0x26a12d[_0x3eac('0xc')]();}}}catch(_0x544eea){logger['error']('[%s][GOTOP]\x20%s',_0xec023c,JSON[_0x3eac('0xf')](_0x544eea));_0x26a12d['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c0243f9..3b5cd14 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 _0xe899=['consequence','contact','channel','chat','AccountId','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','stringify','stop','error','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x36c417,_0x8b8eec){var _0x39d9a0=function(_0x2c685f){while(--_0x2c685f){_0x36c417['push'](_0x36c417['shift']());}};_0x39d9a0(++_0x8b8eec);}(_0xe899,0x8e));var _0x9e89=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe899[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x9e89('0x0'));var utils=require(_0x9e89('0x1'));var logger=require('../../../../config/logger')(_0x9e89('0x2'));var rpc={'chatMessage':require(_0x9e89('0x3')),'openchannelMessage':require(_0x9e89('0x4')),'mailMessage':require(_0x9e89('0x5')),'smsMessage':require(_0x9e89('0x6')),'faxMessage':require(_0x9e89('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9e89('0x8')]=function(_0x1babc1,_0x5a8e2d){return function(_0x16cf11){try{var _0x5cd029={'body':utils['getMustacheRender'](_0x5a8e2d[0x0],this),'ContactId':this[_0x9e89('0x9')]['id']};if(this[_0x9e89('0xa')]===_0x9e89('0xb')){_0x5cd029['ChatWebsiteId']=this['account']['id'];}else{_0x5cd029[_['upperFirst'](this[_0x9e89('0xa')])+_0x9e89('0xc')]=this[_0x9e89('0xd')]['id'];}_0x5cd029[_['upperFirst'](this[_0x9e89('0xa')])+_0x9e89('0xe')]=this[_0x9e89('0xf')]['id'];if(rpc[this['channel']+_0x9e89('0x10')]){return rpc[this[_0x9e89('0xa')]+_0x9e89('0x10')][_0x9e89('0x11')](_0x5cd029)[_0x9e89('0x12')](function(_0x20afdf){logger[_0x9e89('0x13')](_0x9e89('0x14'),_0x1babc1,_0x5cd029['body']);_0x16cf11[_0x9e89('0x15')]();})['catch'](function(_0x2c8b99){logger['error'](_0x9e89('0x14'),_0x1babc1,JSON[_0x9e89('0x16')](_0x2c8b99));_0x16cf11[_0x9e89('0x17')]();});}}catch(_0x565758){logger[_0x9e89('0x18')](_0x9e89('0x14'),_0x1babc1,JSON[_0x9e89('0x16')](_0x565758));_0x16cf11[_0x9e89('0x17')]();}};}; \ No newline at end of file +var _0x1fa3=['upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','next','catch','error','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x2b3567,_0x4beff3){var _0x29f24a=function(_0x4eabc9){while(--_0x4eabc9){_0x2b3567['push'](_0x2b3567['shift']());}};_0x29f24a(++_0x4beff3);}(_0x1fa3,0xc9));var _0x31fa=function(_0x429369,_0x4a7df4){_0x429369=_0x429369-0x0;var _0x36f0c5=_0x1fa3[_0x429369];return _0x36f0c5;};'use strict';var _=require('lodash');var utils=require(_0x31fa('0x0'));var logger=require(_0x31fa('0x1'))(_0x31fa('0x2'));var rpc={'chatMessage':require(_0x31fa('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x31fa('0x4')),'smsMessage':require(_0x31fa('0x5')),'faxMessage':require(_0x31fa('0x6')),'whatsappMessage':require(_0x31fa('0x7'))};exports[_0x31fa('0x8')]=function(_0x1fa871,_0x4ee266){return function(_0x49c945){try{var _0x3de22e={'body':utils[_0x31fa('0x9')](_0x4ee266[0x0],this),'ContactId':this[_0x31fa('0xa')]['id']};if(this[_0x31fa('0xb')]===_0x31fa('0xc')){_0x3de22e[_0x31fa('0xd')]=this[_0x31fa('0xe')]['id'];}else{_0x3de22e[_[_0x31fa('0xf')](this[_0x31fa('0xb')])+_0x31fa('0x10')]=this[_0x31fa('0xe')]['id'];}_0x3de22e[_[_0x31fa('0xf')](this['channel'])+_0x31fa('0x11')]=this[_0x31fa('0x12')]['id'];if(rpc[this[_0x31fa('0xb')]+_0x31fa('0x13')]){return rpc[this['channel']+_0x31fa('0x13')][_0x31fa('0x14')](_0x3de22e)[_0x31fa('0x15')](function(_0x5c6282){logger[_0x31fa('0x16')]('[%s][MESSAGE]\x20%s',_0x1fa871,_0x3de22e['body']);_0x49c945[_0x31fa('0x17')]();})[_0x31fa('0x18')](function(_0x41d4b4){logger[_0x31fa('0x19')]('[%s][MESSAGE]\x20%s',_0x1fa871,JSON[_0x31fa('0x1a')](_0x41d4b4));_0x49c945['stop']();});}}catch(_0x1be720){logger[_0x31fa('0x19')]('[%s][MESSAGE]\x20%s',_0x1fa871,JSON['stringify'](_0x1be720));_0x49c945['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 28f84c6..844e170 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 _0x7209=['next','error','stringify','./utils','../../../../config/logger','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7209,0x1df));var _0x9720=function(_0xbcd67e,_0x1c8a24){_0xbcd67e=_0xbcd67e-0x0;var _0x3c9acd=_0x7209[_0xbcd67e];return _0x3c9acd;};'use strict';var utils=require(_0x9720('0x0'));var logger=require(_0x9720('0x1'))('routing');exports['consequence']=function(_0x353f6f,_0x4f4cec){return function(_0x275e09){try{logger['info'](_0x9720('0x2'),_0x353f6f,utils[_0x9720('0x3')](_0x4f4cec[0x0],this));_0x275e09[_0x9720('0x4')]();}catch(_0x4a4923){logger[_0x9720('0x5')](_0x9720('0x2'),_0x353f6f,JSON[_0x9720('0x6')](_0x4a4923));_0x275e09['stop']();}};}; \ No newline at end of file +var _0xfcbf=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0xfcbf,0x8c));var _0xffcb=function(_0x405f3f,_0x2830cd){_0x405f3f=_0x405f3f-0x0;var _0x42cf3b=_0xfcbf[_0x405f3f];return _0x42cf3b;};'use strict';var utils=require('./utils');var logger=require(_0xffcb('0x0'))(_0xffcb('0x1'));exports['consequence']=function(_0x4c7788,_0x33c0e7){return function(_0x4c0972){try{logger[_0xffcb('0x2')](_0xffcb('0x3'),_0x4c7788,utils[_0xffcb('0x4')](_0x33c0e7[0x0],this));_0x4c0972[_0xffcb('0x5')]();}catch(_0x1d9f06){logger[_0xffcb('0x6')](_0xffcb('0x3'),_0x4c7788,JSON[_0xffcb('0x7')](_0x1d9f06));_0x4c0972[_0xffcb('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index fbcea81..c1132d5 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 _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x3c433f,_0xf49700){var _0x573591=function(_0x56c6e8){while(--_0x56c6e8){_0x3c433f['push'](_0x3c433f['shift']());}};_0x573591(++_0xf49700);}(_0x34e8,0x12c));var _0x834e=function(_0x3c0049,_0x172b98){_0x3c0049=_0x3c0049-0x0;var _0x4f5849=_0x34e8[_0x3c0049];return _0x4f5849;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x4dcded,_0x27b074){var _0x33c8c2=function(_0x15ba23){while(--_0x15ba23){_0x4dcded['push'](_0x4dcded['shift']());}};_0x33c8c2(++_0x27b074);}(_0xedd9,0xfc));var _0x9edd=function(_0x30f730,_0x5a1aad){_0x30f730=_0x30f730-0x0;var _0x4b3c3d=_0xedd9[_0x30f730];return _0x4b3c3d;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 1054c72..f280878 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 _0xf825=['hideNotification','TIMEOUT','exports','lodash','uuid','routing','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0xdac678,_0x5d1714){var _0x92c2fe=function(_0x1108c5){while(--_0x1108c5){_0xdac678['push'](_0xdac678['shift']());}};_0x92c2fe(++_0x5d1714);}(_0xf825,0xc3));var _0x5f82=function(_0x151200,_0x5b50a1){_0x151200=_0x151200-0x0;var _0x2041c2=_0xf825[_0x151200];return _0x2041c2;};'use strict';var _=require(_0x5f82('0x0'));var uuid=require(_0x5f82('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x5f82('0x2'));var Agent=function(_0x22339a,_0x1b28bf,_0x57d917,_0x368f98){this['notificationId']=uuid['v4']();this[_0x5f82('0x3')]=_0x22339a;this[_0x5f82('0x4')]=_0x1b28bf;this[_0x5f82('0x5')]=_0x57d917;this[_0x5f82('0x2')]=_0x368f98;this[_0x5f82('0x3')]['push'](this[_0x5f82('0x6')][_0x5f82('0x7')](this),this[_0x5f82('0x8')][_0x5f82('0x7')](this));this[_0x5f82('0x3')]['on'](_0x5f82('0x9'),this['handleTimeout'][_0x5f82('0x7')](this));this['squeue']['on'](_0x5f82('0xa'),this[_0x5f82('0xb')][_0x5f82('0x7')](this));};Agent['prototype'][_0x5f82('0xc')]=function(){this['squeue'][_0x5f82('0xc')](this[_0x5f82('0x6')][_0x5f82('0x7')](this),this[_0x5f82('0x8')][_0x5f82('0x7')](this));};Agent[_0x5f82('0xd')][_0x5f82('0xb')]=function(){this[_0x5f82('0x8')](!![]);};Agent[_0x5f82('0xd')][_0x5f82('0x6')]=function(_0x531e6b){logger[_0x5f82('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x5f82('0x4')]['id']);if(_[_0x5f82('0xf')](this[_0x5f82('0x5')][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']])){logger[_0x5f82('0xe')](_0x5f82('0x11'),this[_0x5f82('0x3')]['id'],this[_0x5f82('0x4')]['id']);setTimeout(this[_0x5f82('0xc')][_0x5f82('0x7')](this),0x3e8);}else{if(this[_0x5f82('0x2')]['forcedOwnership']||util[_0x5f82('0x12')](this[_0x5f82('0x3')]['id'],this[_0x5f82('0x5')][_0x5f82('0x10')][this['agent']['id']],this['squeue'][_0x5f82('0x13')],![])){this[_0x5f82('0x5')]['agents'][this[_0x5f82('0x4')]['id']][_0x5f82('0x14')]=!![];this[_0x5f82('0x5')][_0x5f82('0x10')][this['agent']['id']][_0x5f82('0x15')]=undefined;util[_0x5f82('0x16')](this[_0x5f82('0x17')],this[_0x5f82('0x3')]['id'],this[_0x5f82('0x5')]['agents'][this[_0x5f82('0x4')]['id']],null,this['routing']);util['writeLog'](this[_0x5f82('0x3')]['id'],this['realtime'][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']],_0x5f82('0x18')+(this['routing'][_0x5f82('0x19')]?_0x5f82('0x1a'):''));}else{logger['info'](_0x5f82('0x1b'),this['squeue']['id'],this[_0x5f82('0x4')]['id']);setTimeout(this['push'][_0x5f82('0x7')](this),0x3e8);}}};Agent[_0x5f82('0xd')]['handleTimeout']=function(_0x4ca0cc){if(_[_0x5f82('0xf')](this['realtime'][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']])){return logger[_0x5f82('0xe')](_0x5f82('0x11'),this[_0x5f82('0x3')]['id'],this[_0x5f82('0x4')]['id']);}else{logger['info'](_0x5f82('0x1c'),this[_0x5f82('0x3')]['id'],this[_0x5f82('0x4')]['id']);util[_0x5f82('0x1d')](this[_0x5f82('0x17')],this[_0x5f82('0x3')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x5f82('0x2')]);this[_0x5f82('0x5')][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']][_0x5f82('0x14')]=![];this['realtime'][_0x5f82('0x10')][this['agent']['id']][_0x5f82('0x15')]=undefined;util['writeLog'](this[_0x5f82('0x3')]['id'],this[_0x5f82('0x5')][_0x5f82('0x10')][this[_0x5f82('0x4')]['id']],_0x4ca0cc?'STOP':_0x5f82('0x1e'));}if(!_0x4ca0cc){setTimeout(this['push'][_0x5f82('0x7')](this),0x3e8);}};function agent(_0x320209,_0x57037e,_0x3f43e5,_0x4278c5){return new Agent(_0x320209,_0x57037e,_0x3f43e5,_0x4278c5);}module[_0x5f82('0x1f')]=agent; \ No newline at end of file +var _0x684c=['exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','isAgentAvailable','agents','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc684('0x0'));var uuid=require(_0xc684('0x1'));var util=require('./util');var logger=require(_0xc684('0x2'))(_0xc684('0x3'));var Agent=function(_0x313548,_0x1a0d37,_0x2c50cf,_0x4a3536){this[_0xc684('0x4')]=uuid['v4']();this[_0xc684('0x5')]=_0x313548;this[_0xc684('0x6')]=_0x1a0d37;this[_0xc684('0x7')]=_0x2c50cf;this[_0xc684('0x3')]=_0x4a3536;this[_0xc684('0x5')][_0xc684('0x8')](this[_0xc684('0x9')][_0xc684('0xa')](this),this[_0xc684('0xb')][_0xc684('0xa')](this));this[_0xc684('0x5')]['on'](_0xc684('0xc'),this[_0xc684('0xb')][_0xc684('0xa')](this));this[_0xc684('0x5')]['on'](_0xc684('0xd'),this['handleDrained'][_0xc684('0xa')](this));};Agent[_0xc684('0xe')][_0xc684('0x8')]=function(){this[_0xc684('0x5')][_0xc684('0x8')](this[_0xc684('0x9')]['bind'](this),this[_0xc684('0xb')][_0xc684('0xa')](this));};Agent['prototype']['handleDrained']=function(){this[_0xc684('0xb')](!![]);};Agent[_0xc684('0xe')][_0xc684('0x9')]=function(_0x2ad4f1){logger[_0xc684('0xf')](_0xc684('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xc684('0x11')](this['realtime']['agents'][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc684('0x5')]['id'],this[_0xc684('0x6')]['id']);setTimeout(this[_0xc684('0x8')][_0xc684('0xa')](this),0x3e8);}else{if(this[_0xc684('0x3')]['forcedOwnership']||util[_0xc684('0x12')](this[_0xc684('0x5')]['id'],this['realtime'][_0xc684('0x13')][this[_0xc684('0x6')]['id']],this[_0xc684('0x5')]['channel'],![])){this[_0xc684('0x7')][_0xc684('0x13')][this[_0xc684('0x6')]['id']][_0xc684('0x14')]=!![];this[_0xc684('0x7')]['agents'][this[_0xc684('0x6')]['id']][_0xc684('0x15')]=undefined;util[_0xc684('0x16')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xc684('0x13')][this[_0xc684('0x6')]['id']],null,this[_0xc684('0x3')]);util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xc684('0x6')]['id']],_0xc684('0x17')+(this[_0xc684('0x3')]['forcedOwnership']?_0xc684('0x18'):''));}else{logger['info'](_0xc684('0x19'),this[_0xc684('0x5')]['id'],this[_0xc684('0x6')]['id']);setTimeout(this['push'][_0xc684('0xa')](this),0x3e8);}}};Agent['prototype'][_0xc684('0xb')]=function(_0x640ca1){if(_[_0xc684('0x11')](this[_0xc684('0x7')]['agents'][this[_0xc684('0x6')]['id']])){return logger[_0xc684('0xf')](_0xc684('0x1a'),this[_0xc684('0x5')]['id'],this[_0xc684('0x6')]['id']);}else{logger[_0xc684('0xf')](_0xc684('0x1b'),this[_0xc684('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xc684('0x5')]['id'],this[_0xc684('0x7')]['agents'][this['agent']['id']],null,this[_0xc684('0x3')]);this['realtime'][_0xc684('0x13')][this[_0xc684('0x6')]['id']][_0xc684('0x14')]=![];this['realtime']['agents'][this[_0xc684('0x6')]['id']][_0xc684('0x15')]=undefined;util['writeLog'](this['squeue']['id'],this[_0xc684('0x7')][_0xc684('0x13')][this[_0xc684('0x6')]['id']],_0x640ca1?_0xc684('0x1c'):_0xc684('0x1d'));}if(!_0x640ca1){setTimeout(this[_0xc684('0x8')]['bind'](this),0x3e8);}};function agent(_0x1a0b08,_0x4c2938,_0x5b25ec,_0x289116){return new Agent(_0x1a0b08,_0x4c2938,_0x5b25ec,_0x289116);}module[_0xc684('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 6562c54..54730bb 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 _0x7268=['busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','isNil','Agents','length','info','isAgentAvailable','agents','channel','writeLog','RINGING'];(function(_0xc1bff7,_0x5d17cc){var _0x4c9cc7=function(_0x2a5f80){while(--_0x2a5f80){_0xc1bff7['push'](_0xc1bff7['shift']());}};_0x4c9cc7(++_0x5d17cc);}(_0x7268,0x1a2));var _0x8726=function(_0xb0acb,_0x322550){_0xb0acb=_0xb0acb-0x0;var _0x3ec04f=_0x7268[_0xb0acb];return _0x3ec04f;};'use strict';var _=require(_0x8726('0x0'));var uuid=require('uuid');var util=require(_0x8726('0x1'));var logger=require(_0x8726('0x2'))(_0x8726('0x3'));var Beepall=function(_0x4cb4e0,_0x558ca8,_0x3df7ec,_0x384868){this[_0x8726('0x4')]=uuid['v4']();this[_0x8726('0x5')]=_0x4cb4e0;this[_0x8726('0x6')]=_0x558ca8;this[_0x8726('0x7')]=_0x3df7ec;this[_0x8726('0x3')]=_0x384868;this[_0x8726('0x5')][_0x8726('0x8')](this[_0x8726('0x9')][_0x8726('0xa')](this),this[_0x8726('0xb')][_0x8726('0xa')](this));this[_0x8726('0x5')]['on'](_0x8726('0xc'),this[_0x8726('0xb')][_0x8726('0xa')](this));this[_0x8726('0x5')]['on'](_0x8726('0xd'),this['handleDrained'][_0x8726('0xa')](this));};Beepall['prototype'][_0x8726('0x8')]=function(){this['squeue'][_0x8726('0x8')](this[_0x8726('0x9')][_0x8726('0xa')](this),this[_0x8726('0xb')]['bind'](this));};Beepall['prototype'][_0x8726('0xe')]=function(_0x2c08d8){this[_0x8726('0xb')](!![]);};Beepall['prototype']['handleRun']=function(_0x50a3c3){var _0x11cf2d=!![];if(!_[_0x8726('0xf')](this[_0x8726('0x6')])&&!_['isNil'](this[_0x8726('0x6')][_0x8726('0x10')])&&this[_0x8726('0x6')][_0x8726('0x10')]['length']>0x0){for(var _0x148d8a=0x0,_0x21c4c5;_0x148d8a0x0){for(var _0x2fb146=0x0,_0x48cb60;_0x2fb1460x0&&_0x544b7a[_0x593515+'CurrentCapacity']>=_0x544b7a[_0x593515+_0x561a('0x21')]){writeLog(_0xb88610,_0x544b7a,_0x593515['toUpperCase']()+_0x561a('0x22'));return![];}}return!![];};exports[_0x561a('0x23')]=function(_0x19f5e5,_0x1eea93,_0x1b1e61,_0x3de0f6,_0x261efd){return sendNotification(!![],_0x19f5e5,_0x1eea93,_0x1b1e61,_0x3de0f6,_0x261efd);};exports[_0x561a('0x24')]=function(_0x44fd4d,_0x2293bf,_0x1e9c37,_0x1d8948,_0x4d3b16){return sendNotification(![],_0x44fd4d,_0x2293bf,_0x1e9c37,_0x1d8948,_0x4d3b16);};exports[_0x561a('0x25')]=writeLog; \ No newline at end of file +var _0x6085=['I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','writeLog','lodash','util','mustache','routing','redis','localhost','socket.io-emitter','emit','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate'];(function(_0x5149ee,_0x4ede6c){var _0x169909=function(_0x2ea42b){while(--_0x2ea42b){_0x5149ee['push'](_0x5149ee['shift']());}};_0x169909(++_0x4ede6c);}(_0x6085,0x15d));var _0x5608=function(_0x3af2bf,_0x2d9fde){_0x3af2bf=_0x3af2bf-0x0;var _0xbffc81=_0x6085[_0x3af2bf];return _0xbffc81;};'use strict';var _=require(_0x5608('0x0'));var util=require(_0x5608('0x1'));var utils=require('../utils');var Mustache=require(_0x5608('0x2'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0x5608('0x3'));config[_0x5608('0x4')]=_['defaults'](config[_0x5608('0x4')],{'host':_0x5608('0x5'),'port':0x18eb});var io=require(_0x5608('0x6'))(new Redis(config[_0x5608('0x4')]));function emit(_0x3e5a94,_0x545e78,_0x1a25f2){io['to'](_0x3e5a94)[_0x5608('0x7')](_0x545e78,_0x1a25f2);}function sendNotification(_0x5c177a,_0x79e4ac,_0x36a270,_0x57c27b,_0x1fa28a,_0x54c181){io['to'](util['format'](_0x5608('0x8'),_0x57c27b[_0x5608('0x9')]))[_0x5608('0x7')](_0x5608('0xa'),_0x57c27b);var _0x25fc5c=_0x54c181||{};var _0x1805af=_0x36a270[_0x5608('0xb')]('.');var _0x1985a7={'uniqueid':_0x79e4ac,'channel':_0x1805af[0x0],'id':_0x1805af[0x1],'title':_0x1805af[0x0]+_0x5608('0xc'),'interactionId':_0x1805af[0x2],'queue':_0x1fa28a?_0x1fa28a['name']:null,'sound':_0x25fc5c[_0x5608('0xd')][_0x5608('0xe')],'shake':_0x25fc5c['account'][_0x5608('0xf')]};try{if(!_0x25fc5c[_0x5608('0x10')]){_0x25fc5c[_0x5608('0x10')]={};}if(_0x1fa28a){_0x25fc5c['body'][_0x5608('0x11')]=_0x1fa28a;}else if(_0x25fc5c[_0x5608('0x10')][_0x5608('0x11')]){delete _0x25fc5c[_0x5608('0x10')]['queue'];}_0x1985a7[_0x5608('0x12')]=utils['getMustacheRender'](_0x25fc5c[_0x5608('0xd')][_0x5608('0x13')],_0x25fc5c);}catch(_0xa4b5ff){_0x1985a7['msg']=_0x5608('0x14');logger[_0x5608('0x15')](util[_0x5608('0x16')](_0x5608('0x17'),_0x79e4ac,_0xa4b5ff['message']));}io['to'](util[_0x5608('0x16')]('user:%s',_0x57c27b[_0x5608('0x9')]))[_0x5608('0x7')](util[_0x5608('0x16')](_0x5608('0x18'),_0x5c177a?_0x5608('0x19'):_0x5608('0x1a')),_0x1985a7);}function writeLog(_0x112bc4,_0x4e48b7,_0x18e50f){return logger[_0x5608('0x1b')](util[_0x5608('0x16')](_0x5608('0x1c'),_0x112bc4,_0x4e48b7[_0x5608('0x9')],_0x18e50f));}exports[_0x5608('0x1d')]=function(_0x23f802,_0x5733dc,_0x505d26,_0x5864b7){if(_0x5733dc[_0x5608('0x1e')]){writeLog(_0x23f802,_0x5733dc,_0x5608('0x1f'));return![];}if(!_0x5733dc[_0x5608('0x20')]){writeLog(_0x23f802,_0x5733dc,'OFFLINE');return![];}if(_0x5733dc[_0x505d26+_0x5608('0x21')]){writeLog(_0x23f802,_0x5733dc,_0x5608('0x22'));return![];}if(_0x5864b7&&_0x5733dc[_0x5608('0x23')](_0x505d26+_0x5608('0x24'))&&_0x5733dc[_0x5608('0x23')](_0x505d26+'CurrentCapacity')){if(_0x5733dc[_0x505d26+'Capacity']>0x0&&_0x5733dc[_0x505d26+_0x5608('0x25')]>=_0x5733dc[_0x505d26+_0x5608('0x24')]){writeLog(_0x23f802,_0x5733dc,_0x505d26[_0x5608('0x26')]()+_0x5608('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x1953ef,_0x5bbe37,_0x171b39,_0x516683,_0x5961c4){return sendNotification(!![],_0x1953ef,_0x5bbe37,_0x171b39,_0x516683,_0x5961c4);};exports['hideNotification']=function(_0x269970,_0x1b34f7,_0x354e9f,_0x540bb6,_0x4e2f17){return sendNotification(![],_0x269970,_0x1b34f7,_0x354e9f,_0x540bb6,_0x4e2f17);};exports[_0x5608('0x28')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 3f63dc8..6909cd4 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 _0x6de3=['consequence','length','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x14e9cd,_0xd130c4){var _0x2450be=function(_0x5e9e12){while(--_0x5e9e12){_0x14e9cd['push'](_0x14e9cd['shift']());}};_0x2450be(++_0xd130c4);}(_0x6de3,0x89));var _0x36de=function(_0x34b5fb,_0x19f2ce){_0x34b5fb=_0x34b5fb-0x0;var _0x473c41=_0x6de3[_0x34b5fb];return _0x473c41;};'use strict';var schema=require(_0x36de('0x0'));var sh=require('shelljs');var _=require(_0x36de('0x1'));var utils=require(_0x36de('0x2'));var logger=require(_0x36de('0x3'))(_0x36de('0x4'));var system=schema({'command':{'type':_0x36de('0x5'),'required':!![],'message':_0x36de('0x6')}});exports[_0x36de('0x7')]=function(_0x2f7152,_0x13becf){return function(_0x4d5fd6){try{var _0x163e48={'command':_0x13becf[0x0]};var _0x3a570d=system[_0x36de('0x0')](_0x163e48,{'typecast':!![]});if(_0x3a570d[_0x36de('0x8')]){logger['error'](_0x36de('0x9'),_0x2f7152,_['map'](_0x3a570d,_0x36de('0xa'))['join'](',\x20'));logger[_0x36de('0xb')](_0x36de('0xc'),_0x2f7152);_0x4d5fd6[_0x36de('0xd')]();}else{var _0xf55070=this;var _0x3d3bc4=utils['getMustacheRender'](_0x13becf[0x0],this);logger[_0x36de('0xb')](_0x36de('0xe'),_0x2f7152,_0x3d3bc4);sh[_0x36de('0xf')](_[_0x36de('0x10')](_0x3d3bc4),function(_0x389530,_0xc963bc){logger[_0x36de('0xb')](_0x36de('0x11'),_0x2f7152,_0x389530);if(_0x389530==0x0){var _0x3628e4=_0xc963bc[_0x36de('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x36de('0x13')](_0x13becf[0x1])||_['isEmpty'](_0x13becf[0x1])){logger[_0x36de('0xb')](_0x36de('0x14'),_0x2f7152);_0xf55070['body'][_0x13becf[0x1]]=_0x3628e4;}else{logger['info'](_0x36de('0x15'),_0x2f7152,_0x13becf[0x1],_0x3628e4);_0xf55070['body'][_0x13becf[0x1]]=_0x3628e4;}}_0x4d5fd6[_0x36de('0xd')]();});}}catch(_0x2ff7bf){logger['error']('[%s][SYSTEM]\x20%s',_0x2f7152,_[_0x36de('0x16')](_0x2ff7bf)?JSON[_0x36de('0x17')](_0x2ff7bf):_0x2ff7bf);logger[_0x36de('0xb')](_0x36de('0xc'),_0x2f7152);_0x4d5fd6[_0x36de('0xd')]();}};}; \ No newline at end of file +var _0x9152=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x9152,0x19a));var _0x2915=function(_0x27b75b,_0x4f858c){_0x27b75b=_0x27b75b-0x0;var _0x4cfe27=_0x9152[_0x27b75b];return _0x4cfe27;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x2915('0x0'));var utils=require(_0x2915('0x1'));var logger=require(_0x2915('0x2'))(_0x2915('0x3'));var system=schema({'command':{'type':_0x2915('0x4'),'required':!![],'message':_0x2915('0x5')}});exports[_0x2915('0x6')]=function(_0x532a50,_0x37c925){return function(_0x32402f){try{var _0x3750e0={'command':_0x37c925[0x0]};var _0x160093=system['validate'](_0x3750e0,{'typecast':!![]});if(_0x160093[_0x2915('0x7')]){logger[_0x2915('0x8')](_0x2915('0x9'),_0x532a50,_[_0x2915('0xa')](_0x160093,_0x2915('0xb'))['join'](',\x20'));logger[_0x2915('0xc')](_0x2915('0xd'),_0x532a50);_0x32402f['next']();}else{var _0x329151=this;var _0x2e8f34=utils[_0x2915('0xe')](_0x37c925[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x532a50,_0x2e8f34);sh[_0x2915('0xf')](_[_0x2915('0x10')](_0x2e8f34),function(_0x53b7fb,_0x341bb9){logger[_0x2915('0xc')](_0x2915('0x11'),_0x532a50,_0x53b7fb);if(_0x53b7fb==0x0){var _0x86afe5=_0x341bb9[_0x2915('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x2915('0x13')](_0x37c925[0x1])||_[_0x2915('0x14')](_0x37c925[0x1])){logger[_0x2915('0xc')](_0x2915('0x15'),_0x532a50);_0x329151[_0x2915('0x16')][_0x37c925[0x1]]=_0x86afe5;}else{logger[_0x2915('0xc')](_0x2915('0x17'),_0x532a50,_0x37c925[0x1],_0x86afe5);_0x329151['body'][_0x37c925[0x1]]=_0x86afe5;}}_0x32402f[_0x2915('0x18')]();});}}catch(_0x42762a){logger[_0x2915('0x8')](_0x2915('0x9'),_0x532a50,_['isObject'](_0x42762a)?JSON['stringify'](_0x42762a):_0x42762a);logger[_0x2915('0xc')](_0x2915('0xd'),_0x532a50);_0x32402f[_0x2915('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 0f851a7..4c4fc5a 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 _0xd406=['error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20%s','info','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x319ece,_0x194eba){var _0x26b838=function(_0x2dbb14){while(--_0x2dbb14){_0x319ece['push'](_0x319ece['shift']());}};_0x26b838(++_0x194eba);}(_0xd406,0xf9));var _0x6d40=function(_0x4538b9,_0x4ee76d){_0x4538b9=_0x4538b9-0x0;var _0x2bfdc0=_0xd406[_0x4538b9];return _0x2bfdc0;};'use strict';var schema=require(_0x6d40('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x6d40('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6d40('0x2')),'faxInteraction':require(_0x6d40('0x3')),'whatsappInteraction':require(_0x6d40('0x4'))};var logger=require(_0x6d40('0x5'))(_0x6d40('0x6'));var tag=schema({'tag':{'type':_0x6d40('0x7'),'required':!![],'message':_0x6d40('0x8')}});exports[_0x6d40('0x9')]=function(_0x40a0a7,_0x46dcd6,_0x170e2b,_0x3718ed){return function(_0x424939){try{var _0x3bd719={'tag':_0x46dcd6[0x0]};var _0x294f9e=tag['validate'](_0x3bd719,{'typecast':!![]});if(_0x294f9e[_0x6d40('0xa')]){logger[_0x6d40('0xb')]('[%s][TAG]\x20%s',_0x40a0a7,_[_0x6d40('0xc')](_0x294f9e,_0x6d40('0xd'))[_0x6d40('0xe')](',\x20'));logger['info'](_0x6d40('0xf'),_0x40a0a7);_0x424939[_0x6d40('0x10')]();}else{var _0x5d64e8={'ids':[_0x46dcd6[0x0]]};if(rpc[_0x3718ed[_0x6d40('0x11')]+_0x6d40('0x12')]){rpc[_0x3718ed[_0x6d40('0x11')]+_0x6d40('0x12')][_0x6d40('0x13')](_0x3718ed[_0x6d40('0x14')]['id'],_0x5d64e8)[_0x6d40('0x15')](function(_0x5b7a09){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x40a0a7,_0x46dcd6[0x1],_0x3718ed[_0x6d40('0x11')],_0x3718ed[_0x6d40('0x14')]['id']);})['catch'](function(_0x113e14){logger[_0x6d40('0xb')](_0x6d40('0x16'),_0x40a0a7,JSON['stringify'](_0x113e14));logger[_0x6d40('0x17')](_0x6d40('0xf'),_0x40a0a7);})[_0x6d40('0x18')](function(){_0x424939[_0x6d40('0x10')]();});}}}catch(_0x215fdf){logger[_0x6d40('0xb')]('[%s][TAG]\x20%s',_0x40a0a7,_[_0x6d40('0x19')](_0x215fdf)?JSON['stringify'](_0x215fdf):_0x215fdf);logger[_0x6d40('0x17')](_0x6d40('0xf'),_0x40a0a7);_0x424939[_0x6d40('0x10')]();}};}; \ No newline at end of file +var _0xf3b2=['finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify'];(function(_0x21eb04,_0x44cb7f){var _0x11b38a=function(_0x276fc6){while(--_0x276fc6){_0x21eb04['push'](_0x21eb04['shift']());}};_0x11b38a(++_0x44cb7f);}(_0xf3b2,0x110));var _0x2f3b=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0xf3b2[_0x3b8774];return _0x5bcfcc;};'use strict';var schema=require('validate');var _=require(_0x2f3b('0x0'));var rpc={'chatInteraction':require(_0x2f3b('0x1')),'openchannelInteraction':require(_0x2f3b('0x2')),'smsInteraction':require(_0x2f3b('0x3')),'mailInteraction':require(_0x2f3b('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x2f3b('0x5'))(_0x2f3b('0x6'));var tag=schema({'tag':{'type':_0x2f3b('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x33bd20,_0x504fb6,_0x27533d,_0x423326){return function(_0x5570d9){try{var _0x113358={'tag':_0x504fb6[0x0]};var _0x42d179=tag[_0x2f3b('0x8')](_0x113358,{'typecast':!![]});if(_0x42d179[_0x2f3b('0x9')]){logger[_0x2f3b('0xa')]('[%s][TAG]\x20%s',_0x33bd20,_[_0x2f3b('0xb')](_0x42d179,_0x2f3b('0xc'))[_0x2f3b('0xd')](',\x20'));logger[_0x2f3b('0xe')](_0x2f3b('0xf'),_0x33bd20);_0x5570d9[_0x2f3b('0x10')]();}else{var _0x46832c={'ids':[_0x504fb6[0x0]]};if(rpc[_0x423326[_0x2f3b('0x11')]+_0x2f3b('0x12')]){rpc[_0x423326['channel']+_0x2f3b('0x12')][_0x2f3b('0x13')](_0x423326['interaction']['id'],_0x46832c)['then'](function(_0x14c79c){logger[_0x2f3b('0xe')](_0x2f3b('0x14'),_0x33bd20,_0x504fb6[0x1],_0x423326[_0x2f3b('0x11')],_0x423326[_0x2f3b('0x15')]['id']);})[_0x2f3b('0x16')](function(_0xf1867c){logger[_0x2f3b('0xa')](_0x2f3b('0x17'),_0x33bd20,JSON[_0x2f3b('0x18')](_0xf1867c));logger[_0x2f3b('0xe')](_0x2f3b('0xf'),_0x33bd20);})[_0x2f3b('0x19')](function(){_0x5570d9['next']();});}}}catch(_0xf55008){logger[_0x2f3b('0xa')](_0x2f3b('0x17'),_0x33bd20,_[_0x2f3b('0x1a')](_0xf55008)?JSON['stringify'](_0xf55008):_0xf55008);logger['info'](_0x2f3b('0xf'),_0x33bd20);_0x5570d9[_0x2f3b('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index bc8f4d1..1fa3818 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 _0xa1fd=['list','mustache','lodash','exports','render','merge','body','contact','message','interaction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x36665f,_0x4f9488){_0x36665f=_0x36665f-0x0;var _0x481d25=_0xa1fd[_0x36665f];return _0x481d25;};'use strict';var Mustache=require(_0xda1f('0x0'));var _=require(_0xda1f('0x1'));module[_0xda1f('0x2')]={'getMustacheRender':function(_0x3feff6,_0x595195){return Mustache[_0xda1f('0x3')](_0x3feff6,_[_0xda1f('0x4')](_0x595195[_0xda1f('0x5')],{'contact':_0x595195[_0xda1f('0x6')],'message':_0x595195[_0xda1f('0x7')],'account':_0x595195['account'],'interaction':_0x595195[_0xda1f('0x8')],'list':_0x595195[_0xda1f('0x9')]}))||'';}}; \ No newline at end of file +var _0x579c=['interaction','list','mustache','lodash','exports','merge','contact','message','account'];(function(_0x40aeb4,_0x2047e0){var _0x2e29f5=function(_0x451e4b){while(--_0x451e4b){_0x40aeb4['push'](_0x40aeb4['shift']());}};_0x2e29f5(++_0x2047e0);}(_0x579c,0xda));var _0xc579=function(_0x5bf295,_0x16f26b){_0x5bf295=_0x5bf295-0x0;var _0x355f9a=_0x579c[_0x5bf295];return _0x355f9a;};'use strict';var Mustache=require(_0xc579('0x0'));var _=require(_0xc579('0x1'));module[_0xc579('0x2')]={'getMustacheRender':function(_0x1db849,_0x397136){return Mustache['render'](_0x1db849,_[_0xc579('0x3')](_0x397136['body'],{'contact':_0x397136[_0xc579('0x4')],'message':_0x397136[_0xc579('0x5')],'account':_0x397136[_0xc579('0x6')],'interaction':_0x397136[_0xc579('0x7')],'list':_0x397136[_0xc579('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c11f065..301ae19 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 _0x2b39=['whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','format','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','error','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x23e985,_0x1fe322){var _0xf47a90=function(_0x2d2c4e){while(--_0x2d2c4e){_0x23e985['push'](_0x23e985['shift']());}};_0xf47a90(++_0x1fe322);}(_0x2b39,0x11d));var _0x92b3=function(_0x423f00,_0x467bb2){_0x423f00=_0x423f00-0x0;var _0x238c49=_0x2b39[_0x423f00];return _0x238c49;};'use strict';var _=require(_0x92b3('0x0'));var util=require(_0x92b3('0x1'));var path=require(_0x92b3('0x2'));var fs=require('fs');var jayson=require(_0x92b3('0x3'));var BPromise=require(_0x92b3('0x4'));var uuid=require(_0x92b3('0x5'));var config=require('../../../config/environment');var logger=require(_0x92b3('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x92b3('0x7')),'mailQueueReport':require(_0x92b3('0x8')),'chatQueueReport':require(_0x92b3('0x9')),'smsQueueReport':require(_0x92b3('0xa')),'faxQueueReport':require(_0x92b3('0xb')),'whatsappQueueReport':require(_0x92b3('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x947378,_0x9e6ebc,_0x162d4c){return util['format']('%s.%s.%s',_0x947378,_0x9e6ebc||0x0,_0x162d4c||0x0);}function getIntervals(_0x1bd4ad,_0x5f4698){var _0x340e8c=[];if(!_['isNil'](_0x5f4698[_0x92b3('0xd')])&&!_['isNil'](_0x1bd4ad[_0x5f4698[_0x92b3('0xd')]])&&!_[_0x92b3('0xe')](_0x1bd4ad[_0x5f4698[_0x92b3('0xd')]][_0x92b3('0xf')])){_0x340e8c=_[_0x92b3('0x10')](_0x1bd4ad[_0x5f4698[_0x92b3('0xd')]][_0x92b3('0xf')],_0x92b3('0x11'));}else if(!_[_0x92b3('0xe')](_0x5f4698[_0x92b3('0x11')])){_0x340e8c=[_0x5f4698[_0x92b3('0x11')]];}return _0x340e8c;}exports[_0x92b3('0x12')]=function(_0x35639a){_0x35639a[_0x92b3('0x13')]={};return new BPromise(function(_0x42907a,_0x4aa47b){var _0x379ec3={'Start':function(_0x538256){var _0x4e1be7=this;return new Promise(function(_0x5a62c5,_0x36418f){if(_0x538256){try{var _0x2d9494=[];var _0x2e2026=getId(_0x538256[_0x92b3('0x14')],_0x538256[_0x92b3('0x15')]?_0x538256[_0x92b3('0x15')]['id']:0x0,_0x538256[_0x92b3('0x16')]?_0x538256[_0x92b3('0x16')]['id']:0x0);if(_0x538256[_0x92b3('0x17')]&&_['isArray'](_0x538256['applications'])&&_0x538256[_0x92b3('0x17')][_0x92b3('0x18')]){for(var _0x16ea11=0x0;_0x16ea11<_0x538256['applications']['length'];_0x16ea11+=0x1){var _0xe025cb=_0x538256[_0x92b3('0x17')][_0x16ea11];if(fs[_0x92b3('0x19')](path[_0x92b3('0x1a')](__dirname,'applications',_0xe025cb['app']+_0x92b3('0x1b')))){var _0x26f453=[];switch(_0xe025cb[_0x92b3('0x1c')][_0x92b3('0x1d')]()){case _0x92b3('0x1e'):var _0x56bfa9=_0xe025cb[_0x92b3('0x1f')][_0x92b3('0x20')](',');_0x26f453[_0x92b3('0x21')](_0x56bfa9[0x0]);_0x26f453[_0x92b3('0x21')](_0x56bfa9[_0x92b3('0x22')](0x1,_0x56bfa9[_0x92b3('0x18')])[_0x92b3('0x1a')](','));break;case _0x92b3('0x23'):var _0x2918c3=_0xe025cb['appdata'][_0x92b3('0x20')](',');_0x26f453[_0x92b3('0x21')](_0x2918c3[0x0]);_0x26f453[_0x92b3('0x21')](_0x2918c3[0x1]);_0x26f453[_0x92b3('0x21')](_0x2918c3['slice'](0x2,_0x2918c3[_0x92b3('0x18')])[_0x92b3('0x1a')](','));break;case _0x92b3('0x24'):var _0x194f5e=_0xe025cb[_0x92b3('0x1f')][_0x92b3('0x20')](',');_0x26f453[_0x92b3('0x21')](_0x194f5e[0x0]);_0x26f453[_0x92b3('0x21')](_0x194f5e[0x1]);_0x26f453[_0x92b3('0x21')](_0x194f5e[0x2]);_0x26f453[_0x92b3('0x21')](_0x194f5e[0x3]);_0x26f453[_0x92b3('0x21')](_0x194f5e[_0x92b3('0x22')](0x4,_0x194f5e[_0x92b3('0x18')])[_0x92b3('0x1a')](','));break;case'message':_0x26f453[_0x92b3('0x21')](_0xe025cb[_0x92b3('0x1f')]);break;case _0x92b3('0x25'):_0x26f453[_0x92b3('0x21')](_0xe025cb['TagId']);_0x26f453[_0x92b3('0x21')](_0xe025cb['appdata']);break;default:_0x26f453=_[_0x92b3('0xe')](_0xe025cb[_0x92b3('0x1f')])?[]:_0xe025cb['appdata'][_0x92b3('0x20')](',');}var _0x473456={'id':util[_0x92b3('0x26')](_0x92b3('0x27'),_0x2e2026,_0xe025cb['id'],_0xe025cb[_0x92b3('0x1c')]),'condition':require(_0x92b3('0x28'))['condition'](_0x2e2026,getIntervals(_0x35639a[_0x92b3('0x29')],_0xe025cb),_0x35639a),'consequence':require('./applications/'+_0xe025cb[_0x92b3('0x1c')])[_0x92b3('0x2a')](_0x2e2026,_0x26f453,_0x35639a,_0x538256),'p':_0xe025cb[_0x92b3('0x2b')]||0x0};logger[_0x92b3('0x2c')](_0x92b3('0x2d'),_0x473456['id'],_0x92b3('0x2e'),getIntervals(_0x35639a[_0x92b3('0x29')],_0xe025cb)[_0x92b3('0x1a')](_0x92b3('0x2f')));_0x2d9494[_0x92b3('0x21')](_0x473456);}else{logger['error'](_0x92b3('0x30'),path['join'](__dirname,'applications',_0xe025cb[_0x92b3('0x1c')]+'.js'));}}_0x35639a[_0x92b3('0x13')][_0x2e2026]=new RuleEngine(_0x2d9494);_0x35639a[_0x92b3('0x13')][_0x2e2026][_0x92b3('0x31')](_0x538256,function(_0x36a52b){logger[_0x92b3('0x2c')](_0x92b3('0x32'),JSON[_0x92b3('0x33')](_0x36a52b['matchPath']));if(_0x35639a[_0x92b3('0x13')][_0x2e2026]){_0x35639a['rules'][_0x2e2026][_0x92b3('0x34')]('complete');}});return _0x5a62c5({'code':0xc8,'message':_0x538256});}else{logger[_0x92b3('0x2c')]('No\x20applications\x20to\x20execute');return _0x5a62c5({'code':0xc8,'message':_0x538256});}}catch(_0x5dc5c2){logger[_0x92b3('0x35')](_0x5dc5c2['stack']);return _0x36418f(_0x4e1be7['error'](0x1f4,_0x5dc5c2));}}return _0x36418f(_0x92b3('0x36'));});},'AcceptMessage':function(_0x495b56){var _0x485944=this;return new Promise(function(_0x2fcb0e,_0x30551c){if(_0x495b56[_0x92b3('0x15')]&&_0x495b56[_0x92b3('0x15')]['id']){try{var _0x4eb0a9=getId(_0x495b56['channel'],_0x495b56[_0x92b3('0x15')]?_0x495b56['message']['id']:0x0,_0x495b56['interaction']?_0x495b56[_0x92b3('0x16')]['id']:0x0);if(_0x35639a[_0x92b3('0x13')][_0x4eb0a9]){_0x35639a[_0x92b3('0x13')][_0x4eb0a9][_0x92b3('0x34')](_0x92b3('0x37'));if(rpc[_0x495b56[_0x92b3('0x14')]+_0x92b3('0x38')]){rpc[_0x495b56['channel']+_0x92b3('0x38')][_0x92b3('0x39')](_0x4eb0a9,{'UserId':_0x495b56[_0x92b3('0x15')][_0x92b3('0x3a')]})[_0x92b3('0x3b')](function(_0x3dc9fb){logger[_0x92b3('0x35')](_0x92b3('0x3c'));});}}return _0x2fcb0e({'code':0xc8,'message':_0x495b56});}catch(_0x4b587e){logger['error'](_0x4b587e[_0x92b3('0x3d')]);return _0x30551c(_0x485944[_0x92b3('0x35')](0x1f4,_0x4b587e));}}logger[_0x92b3('0x35')]('message\x20is\x20empty');return _0x30551c(_0x485944[_0x92b3('0x35')](0x1f4,_0x92b3('0x3e')));});},'RejectMessage':function(_0x23f54b){var _0x56e24d=this;return new Promise(function(_0x12623d,_0x45734c){if(_0x23f54b['agent']&&_0x23f54b[_0x92b3('0x3f')]['id']){try{if(_0x35639a[_0x92b3('0x40')][_0x23f54b[_0x92b3('0x3f')]['id']]){_0x35639a[_0x92b3('0x40')][_0x23f54b[_0x92b3('0x3f')]['id']]['busy']=![];_0x35639a[_0x92b3('0x40')][_0x23f54b[_0x92b3('0x3f')]['id']][_0x92b3('0x41')]=undefined;}return _0x12623d({'code':0xc8,'message':_0x23f54b});}catch(_0x3bc8ed){logger[_0x92b3('0x35')](_0x3bc8ed[_0x92b3('0x3d')]);return _0x45734c(_0x56e24d[_0x92b3('0x35')](0x1f4,_0x3bc8ed));}}logger[_0x92b3('0x35')]('message\x20is\x20empty');return _0x45734c(_0x56e24d[_0x92b3('0x35')](0x1f4,_0x92b3('0x3e')));});},'AbandonInteraction':function(_0x34db04){var _0x233fd4=this;return new Promise(function(_0x25d34d,_0x31688a){if(_0x34db04['channel']&&_0x34db04[_0x92b3('0x16')]&&_0x34db04[_0x92b3('0x16')]['id']){try{var _0x1a17d5=getId(_0x34db04[_0x92b3('0x14')],_0x34db04[_0x92b3('0x15')]?_0x34db04['message']['id']:0x0,_0x34db04[_0x92b3('0x16')]?_0x34db04['interaction']['id']:0x0);if(_0x35639a[_0x92b3('0x13')][_0x1a17d5]){_0x35639a['rules'][_0x1a17d5][_0x92b3('0x34')]('end');}return _0x25d34d({'code':0xc8,'message':_0x34db04});}catch(_0x181ff2){logger[_0x92b3('0x35')](_0x181ff2[_0x92b3('0x3d')]);return _0x31688a(_0x233fd4['error'](0x1f4,_0x181ff2));}}logger[_0x92b3('0x35')](_0x92b3('0x3e'));return _0x31688a(_0x233fd4[_0x92b3('0x35')](0x1f4,_0x92b3('0x3e')));});},'AgentCapacity':function(_0x43c336){var _0x1051f4=this;return new Promise(function(_0x37dcc1,_0x23c8f8){if(_0x35639a['agents'][_0x92b3('0x42')](_0x43c336['id'])){for(var _0x3d44be in _0x43c336['capacity']){if(_0x43c336['capacity'][_0x92b3('0x42')](_0x3d44be)){if(_0x35639a['agents'][_0x43c336['id']]['hasOwnProperty'](_0x3d44be+_0x92b3('0x43'))){_0x35639a[_0x92b3('0x40')][_0x43c336['id']][_0x3d44be+'CurrentCapacity']=parseInt(_0x43c336['capacity'][_0x3d44be],0xa);}}}_0x35639a[_0x92b3('0x40')][_0x43c336['id']][_0x92b3('0x44')]();return _0x37dcc1({'code':0xc8,'message':_0x35639a[_0x92b3('0x40')][_0x43c336['id']]});}else{return _0x23c8f8(_0x1051f4['error'](0x1f4,_0x92b3('0x45')));}});},'Agents':function(_0x29a9ca){return new Promise(function(_0x56f13d,_0x2944cf){var _0x25aad4=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x40')]);_0x56f13d({'count':_0x25aad4[_0x92b3('0x18')],'rows':_0x25aad4});});},'ChatQueues':function(_0x272a9d){return new Promise(function(_0x724895,_0x3ddac9){var _0x1401fd=[];for(var _0x1e8f81 in _0x35639a[_0x92b3('0x47')]){if(_0x35639a[_0x92b3('0x47')][_0x92b3('0x42')](_0x1e8f81)){var _0x190046=_0x35639a[_0x92b3('0x47')][_0x1e8f81];var _0x1a713b={'id':_0x190046['id'],'available':_0x190046['available'],'loggedIn':_0x190046[_0x92b3('0x48')],'name':_0x190046[_0x92b3('0x49')],'paused':_0x190046[_0x92b3('0x4a')],'waiting':_0x190046[_0x92b3('0x4b')]};_0x1401fd[_0x92b3('0x21')](_0x1a713b);}}_0x724895({'count':_0x1401fd['length'],'rows':_0x1401fd});});},'MailQueues':function(_0x5b3328){return new Promise(function(_0x5d5ba5,_0x56059b){var _0x3633cf=[];for(var _0x4bc0b6 in _0x35639a['mailQueues']){if(_0x35639a['mailQueues'][_0x92b3('0x42')](_0x4bc0b6)){var _0x36fd6b=_0x35639a[_0x92b3('0x4c')][_0x4bc0b6];var _0x4f3021={'id':_0x36fd6b['id'],'available':_0x36fd6b[_0x92b3('0x4d')],'loggedIn':_0x36fd6b[_0x92b3('0x48')],'name':_0x36fd6b['name'],'paused':_0x36fd6b[_0x92b3('0x4a')],'waiting':_0x36fd6b[_0x92b3('0x4b')]};_0x3633cf[_0x92b3('0x21')](_0x4f3021);}}_0x5d5ba5({'count':_0x3633cf[_0x92b3('0x18')],'rows':_0x3633cf});});},'OpenchannelQueues':function(_0x1772e9){return new Promise(function(_0x2201de,_0x2bbc13){var _0x3c87c7=[];for(var _0x4a3b38 in _0x35639a['openchannelQueues']){if(_0x35639a['openchannelQueues'][_0x92b3('0x42')](_0x4a3b38)){var _0xff4505=_0x35639a[_0x92b3('0x4e')][_0x4a3b38];var _0x198968={'id':_0xff4505['id'],'available':_0xff4505['available'],'loggedIn':_0xff4505[_0x92b3('0x48')],'name':_0xff4505[_0x92b3('0x49')],'paused':_0xff4505[_0x92b3('0x4a')],'waiting':_0xff4505[_0x92b3('0x4b')]};_0x3c87c7['push'](_0x198968);}}_0x2201de({'count':_0x3c87c7[_0x92b3('0x18')],'rows':_0x3c87c7});});},'SmsQueues':function(_0xa4515d){return new Promise(function(_0x24fa52,_0x436ff6){var _0x49437e=[];for(var _0x124c82 in _0x35639a[_0x92b3('0x4f')]){if(_0x35639a[_0x92b3('0x4f')][_0x92b3('0x42')](_0x124c82)){var _0xa81b9e=_0x35639a[_0x92b3('0x4f')][_0x124c82];var _0x505b05={'id':_0xa81b9e['id'],'available':_0xa81b9e['available'],'loggedIn':_0xa81b9e[_0x92b3('0x48')],'name':_0xa81b9e[_0x92b3('0x49')],'paused':_0xa81b9e['paused'],'waiting':_0xa81b9e[_0x92b3('0x4b')]};_0x49437e[_0x92b3('0x21')](_0x505b05);}}_0x24fa52({'count':_0x49437e['length'],'rows':_0x49437e});});},'FaxQueues':function(_0x12f67b){return new Promise(function(_0xc7c916,_0x389535){var _0x209127=[];for(var _0x1dfb5b in _0x35639a['faxQueues']){if(_0x35639a[_0x92b3('0x50')][_0x92b3('0x42')](_0x1dfb5b)){var _0x18a1bf=_0x35639a[_0x92b3('0x50')][_0x1dfb5b];var _0x2f2e15={'id':_0x18a1bf['id'],'available':_0x18a1bf['available'],'loggedIn':_0x18a1bf[_0x92b3('0x48')],'name':_0x18a1bf['name'],'paused':_0x18a1bf[_0x92b3('0x4a')],'waiting':_0x18a1bf[_0x92b3('0x4b')]};_0x209127[_0x92b3('0x21')](_0x2f2e15);}}_0xc7c916({'count':_0x209127['length'],'rows':_0x209127});});},'WhatsappQueues':function(_0x121892){return new Promise(function(_0x397079,_0x9187fd){var _0xe42a6b=[];for(var _0x473d15 in _0x35639a[_0x92b3('0x51')]){if(_0x35639a['whatsappQueues']['hasOwnProperty'](_0x473d15)){var _0x4cce0a=_0x35639a[_0x92b3('0x51')][_0x473d15];var _0x2360ef={'id':_0x4cce0a['id'],'available':_0x4cce0a[_0x92b3('0x4d')],'loggedIn':_0x4cce0a[_0x92b3('0x48')],'name':_0x4cce0a[_0x92b3('0x49')],'paused':_0x4cce0a['paused'],'waiting':_0x4cce0a['waiting']};_0xe42a6b[_0x92b3('0x21')](_0x2360ef);}}_0x397079({'count':_0xe42a6b[_0x92b3('0x18')],'rows':_0xe42a6b});});},'ChatQueuesWaitingInteractions':function(_0x4ef93b){return new Promise(function(_0x91e97e,_0x314676){var _0x18bec7=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x52')]);_0x91e97e({'count':_0x18bec7[_0x92b3('0x18')],'rows':_0x18bec7});});},'MailQueuesWaitingInteractions':function(_0x2daa50){return new Promise(function(_0xe0a30,_0x104977){var _0x5ce769=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x53')]);_0xe0a30({'count':_0x5ce769[_0x92b3('0x18')],'rows':_0x5ce769});});},'OpenchannelQueuesWaitingInteractions':function(_0x3a91d8){return new Promise(function(_0x247470,_0x37d870){var _0x4eb787=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x54')]);_0x247470({'count':_0x4eb787[_0x92b3('0x18')],'rows':_0x4eb787});});},'SmsQueuesWaitingInteractions':function(_0x1c6332){return new Promise(function(_0x54e206,_0x414bc6){var _0x1f8208=_['values'](_0x35639a[_0x92b3('0x55')]);_0x54e206({'count':_0x1f8208['length'],'rows':_0x1f8208});});},'FaxQueuesWaitingInteractions':function(_0x56a132){return new Promise(function(_0x485755,_0x27e3f9){var _0x136b11=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x56')]);_0x485755({'count':_0x136b11[_0x92b3('0x18')],'rows':_0x136b11});});},'WhatsappQueuesWaitingInteractions':function(_0x2be8bf){return new Promise(function(_0xa8c85a,_0x275754){var _0x253378=_[_0x92b3('0x46')](_0x35639a[_0x92b3('0x57')]);_0xa8c85a({'count':_0x253378[_0x92b3('0x18')],'rows':_0x253378});});}};var _0x3bc581=jayson[_0x92b3('0x58')](_0x379ec3)[_0x92b3('0x59')]();_0x3bc581['on'](_0x92b3('0x35'),function(_0x5c6b3b){logger['error'](JSON[_0x92b3('0x33')](_0x5c6b3b));return _0x4aa47b(_0x5c6b3b);});_0x3bc581[_0x92b3('0x12')](0x232c,_0x92b3('0x5a'),function(){console[_0x92b3('0x5b')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x42907a(_0x92b3('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x7380=['priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','interaction','end','QueueReport','update','UserId','catch','stack','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','applications','isArray','length','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','%s:%s:%s','./interval','intervals','consequence'];(function(_0x38c4ce,_0x611d14){var _0x4bda76=function(_0x4fc211){while(--_0x4fc211){_0x38c4ce['push'](_0x38c4ce['shift']());}};_0x4bda76(++_0x611d14);}(_0x7380,0x14f));var _0x0738=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x7380[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x0738('0x0'));var util=require(_0x0738('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x0738('0x2'));var BPromise=require(_0x0738('0x3'));var uuid=require('uuid');var config=require(_0x0738('0x4'));var logger=require(_0x0738('0x5'))(_0x0738('0x6'));var rpc={'openchannelQueueReport':require(_0x0738('0x7')),'mailQueueReport':require(_0x0738('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x0738('0x9')),'faxQueueReport':require(_0x0738('0xa')),'whatsappQueueReport':require(_0x0738('0xb'))};var RuleEngine=require(_0x0738('0xc'));function getId(_0x310524,_0x41798a,_0x2f55f5){return util[_0x0738('0xd')](_0x0738('0xe'),_0x310524,_0x41798a||0x0,_0x2f55f5||0x0);}function getIntervals(_0x58cb3b,_0x430c67){var _0xbef535=[];if(!_[_0x0738('0xf')](_0x430c67[_0x0738('0x10')])&&!_[_0x0738('0xf')](_0x58cb3b[_0x430c67[_0x0738('0x10')]])&&!_['isNil'](_0x58cb3b[_0x430c67[_0x0738('0x10')]]['Intervals'])){_0xbef535=_[_0x0738('0x11')](_0x58cb3b[_0x430c67[_0x0738('0x10')]][_0x0738('0x12')],_0x0738('0x13'));}else if(!_[_0x0738('0xf')](_0x430c67[_0x0738('0x13')])){_0xbef535=[_0x430c67[_0x0738('0x13')]];}return _0xbef535;}exports['listen']=function(_0x369a4d){_0x369a4d[_0x0738('0x14')]={};return new BPromise(function(_0x41fb54,_0x91ceed){var _0x3eb43c={'Start':function(_0x5d4017){var _0x35a5da=this;return new Promise(function(_0x1d0b78,_0x3f5386){if(_0x5d4017){try{var _0x1c8b0f=[];var _0x48a3ff=getId(_0x5d4017[_0x0738('0x15')],_0x5d4017[_0x0738('0x16')]?_0x5d4017[_0x0738('0x16')]['id']:0x0,_0x5d4017['interaction']?_0x5d4017['interaction']['id']:0x0);if(_0x5d4017[_0x0738('0x17')]&&_[_0x0738('0x18')](_0x5d4017[_0x0738('0x17')])&&_0x5d4017['applications'][_0x0738('0x19')]){for(var _0x468d63=0x0;_0x468d63<_0x5d4017[_0x0738('0x17')][_0x0738('0x19')];_0x468d63+=0x1){var _0x1c7faa=_0x5d4017[_0x0738('0x17')][_0x468d63];if(fs['existsSync'](path[_0x0738('0x1a')](__dirname,'applications',_0x1c7faa[_0x0738('0x1b')]+'.js'))){var _0x3be2fd=[];switch(_0x1c7faa[_0x0738('0x1b')][_0x0738('0x1c')]()){case _0x0738('0x1d'):var _0x103c25=_0x1c7faa[_0x0738('0x1e')][_0x0738('0x1f')](',');_0x3be2fd[_0x0738('0x20')](_0x103c25[0x0]);_0x3be2fd[_0x0738('0x20')](_0x103c25[_0x0738('0x21')](0x1,_0x103c25['length'])['join'](','));break;case _0x0738('0x22'):var _0x3ee3f5=_0x1c7faa[_0x0738('0x1e')][_0x0738('0x1f')](',');_0x3be2fd[_0x0738('0x20')](_0x3ee3f5[0x0]);_0x3be2fd[_0x0738('0x20')](_0x3ee3f5[0x1]);_0x3be2fd['push'](_0x3ee3f5['slice'](0x2,_0x3ee3f5['length'])['join'](','));break;case _0x0738('0x23'):var _0x30a83a=_0x1c7faa['appdata'][_0x0738('0x1f')](',');_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x0]);_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x1]);_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x2]);_0x3be2fd[_0x0738('0x20')](_0x30a83a[0x3]);_0x3be2fd[_0x0738('0x20')](_0x30a83a['slice'](0x4,_0x30a83a[_0x0738('0x19')])[_0x0738('0x1a')](','));break;case _0x0738('0x16'):_0x3be2fd[_0x0738('0x20')](_0x1c7faa[_0x0738('0x1e')]);break;case _0x0738('0x24'):_0x3be2fd[_0x0738('0x20')](_0x1c7faa['TagId']);_0x3be2fd[_0x0738('0x20')](_0x1c7faa[_0x0738('0x1e')]);break;default:_0x3be2fd=_[_0x0738('0xf')](_0x1c7faa['appdata'])?[]:_0x1c7faa['appdata'][_0x0738('0x1f')](',');}var _0x3bf6d9={'id':util[_0x0738('0xd')](_0x0738('0x25'),_0x48a3ff,_0x1c7faa['id'],_0x1c7faa[_0x0738('0x1b')]),'condition':require(_0x0738('0x26'))['condition'](_0x48a3ff,getIntervals(_0x369a4d[_0x0738('0x27')],_0x1c7faa),_0x369a4d),'consequence':require('./applications/'+_0x1c7faa[_0x0738('0x1b')])[_0x0738('0x28')](_0x48a3ff,_0x3be2fd,_0x369a4d,_0x5d4017),'p':_0x1c7faa[_0x0738('0x29')]||0x0};logger[_0x0738('0x2a')](_0x0738('0x2b'),_0x3bf6d9['id'],_0x0738('0x2c'),getIntervals(_0x369a4d['intervals'],_0x1c7faa)[_0x0738('0x1a')](_0x0738('0x2d')));_0x1c8b0f[_0x0738('0x20')](_0x3bf6d9);}else{logger['error'](_0x0738('0x2e'),path[_0x0738('0x1a')](__dirname,_0x0738('0x17'),_0x1c7faa['app']+_0x0738('0x2f')));}}_0x369a4d[_0x0738('0x14')][_0x48a3ff]=new RuleEngine(_0x1c8b0f);_0x369a4d[_0x0738('0x14')][_0x48a3ff]['execute'](_0x5d4017,function(_0x2b2a0a){logger[_0x0738('0x2a')](_0x0738('0x30'),JSON[_0x0738('0x31')](_0x2b2a0a[_0x0738('0x32')]));if(_0x369a4d[_0x0738('0x14')][_0x48a3ff]){_0x369a4d[_0x0738('0x14')][_0x48a3ff][_0x0738('0x33')](_0x0738('0x34'));}});return _0x1d0b78({'code':0xc8,'message':_0x5d4017});}else{logger[_0x0738('0x2a')](_0x0738('0x35'));return _0x1d0b78({'code':0xc8,'message':_0x5d4017});}}catch(_0x46736c){logger[_0x0738('0x36')](_0x46736c['stack']);return _0x3f5386(_0x35a5da[_0x0738('0x36')](0x1f4,_0x46736c));}}return _0x3f5386(_0x0738('0x37'));});},'AcceptMessage':function(_0x1bf096){var _0xcaed2b=this;return new Promise(function(_0x4939a9,_0x4d3dc4){if(_0x1bf096['message']&&_0x1bf096['message']['id']){try{var _0x820aa0=getId(_0x1bf096[_0x0738('0x15')],_0x1bf096[_0x0738('0x16')]?_0x1bf096[_0x0738('0x16')]['id']:0x0,_0x1bf096[_0x0738('0x38')]?_0x1bf096['interaction']['id']:0x0);if(_0x369a4d[_0x0738('0x14')][_0x820aa0]){_0x369a4d[_0x0738('0x14')][_0x820aa0][_0x0738('0x33')](_0x0738('0x39'));if(rpc[_0x1bf096[_0x0738('0x15')]+_0x0738('0x3a')]){rpc[_0x1bf096['channel']+_0x0738('0x3a')][_0x0738('0x3b')](_0x820aa0,{'UserId':_0x1bf096[_0x0738('0x16')][_0x0738('0x3c')]})[_0x0738('0x3d')](function(_0x65b263){logger[_0x0738('0x36')]('error\x20update\x20queue\x20report');});}}return _0x4939a9({'code':0xc8,'message':_0x1bf096});}catch(_0x4e07ab){logger[_0x0738('0x36')](_0x4e07ab[_0x0738('0x3e')]);return _0x4d3dc4(_0xcaed2b[_0x0738('0x36')](0x1f4,_0x4e07ab));}}logger[_0x0738('0x36')](_0x0738('0x3f'));return _0x4d3dc4(_0xcaed2b[_0x0738('0x36')](0x1f4,_0x0738('0x3f')));});},'RejectMessage':function(_0x4eb60c){var _0x26c044=this;return new Promise(function(_0x190bf5,_0x1d324d){if(_0x4eb60c[_0x0738('0x40')]&&_0x4eb60c[_0x0738('0x40')]['id']){try{if(_0x369a4d[_0x0738('0x41')][_0x4eb60c[_0x0738('0x40')]['id']]){_0x369a4d[_0x0738('0x41')][_0x4eb60c[_0x0738('0x40')]['id']]['busy']=![];_0x369a4d[_0x0738('0x41')][_0x4eb60c[_0x0738('0x40')]['id']][_0x0738('0x42')]=undefined;}return _0x190bf5({'code':0xc8,'message':_0x4eb60c});}catch(_0x4b09d4){logger[_0x0738('0x36')](_0x4b09d4[_0x0738('0x3e')]);return _0x1d324d(_0x26c044[_0x0738('0x36')](0x1f4,_0x4b09d4));}}logger['error'](_0x0738('0x3f'));return _0x1d324d(_0x26c044['error'](0x1f4,_0x0738('0x3f')));});},'AbandonInteraction':function(_0x383b2c){var _0xb6faa4=this;return new Promise(function(_0x5913bf,_0x9d1946){if(_0x383b2c['channel']&&_0x383b2c[_0x0738('0x38')]&&_0x383b2c[_0x0738('0x38')]['id']){try{var _0x27b055=getId(_0x383b2c[_0x0738('0x15')],_0x383b2c['message']?_0x383b2c['message']['id']:0x0,_0x383b2c['interaction']?_0x383b2c[_0x0738('0x38')]['id']:0x0);if(_0x369a4d[_0x0738('0x14')][_0x27b055]){_0x369a4d[_0x0738('0x14')][_0x27b055][_0x0738('0x33')](_0x0738('0x39'));}return _0x5913bf({'code':0xc8,'message':_0x383b2c});}catch(_0x1770a8){logger[_0x0738('0x36')](_0x1770a8[_0x0738('0x3e')]);return _0x9d1946(_0xb6faa4[_0x0738('0x36')](0x1f4,_0x1770a8));}}logger[_0x0738('0x36')](_0x0738('0x3f'));return _0x9d1946(_0xb6faa4[_0x0738('0x36')](0x1f4,_0x0738('0x3f')));});},'AgentCapacity':function(_0x17c0b2){var _0x1145c8=this;return new Promise(function(_0x53c82b,_0x2647f3){if(_0x369a4d[_0x0738('0x41')][_0x0738('0x43')](_0x17c0b2['id'])){for(var _0x6824c1 in _0x17c0b2[_0x0738('0x44')]){if(_0x17c0b2['capacity'][_0x0738('0x43')](_0x6824c1)){if(_0x369a4d[_0x0738('0x41')][_0x17c0b2['id']][_0x0738('0x43')](_0x6824c1+_0x0738('0x45'))){_0x369a4d[_0x0738('0x41')][_0x17c0b2['id']][_0x6824c1+'CurrentCapacity']=parseInt(_0x17c0b2['capacity'][_0x6824c1],0xa);}}}_0x369a4d[_0x0738('0x41')][_0x17c0b2['id']]['updateRealtime']();return _0x53c82b({'code':0xc8,'message':_0x369a4d['agents'][_0x17c0b2['id']]});}else{return _0x2647f3(_0x1145c8[_0x0738('0x36')](0x1f4,_0x0738('0x46')));}});},'Agents':function(_0x299404){return new Promise(function(_0xa426ee,_0x248ee9){var _0x38880f=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x41')]);_0xa426ee({'count':_0x38880f[_0x0738('0x19')],'rows':_0x38880f});});},'ChatQueues':function(_0xc6d6a1){return new Promise(function(_0x295154,_0x372f27){var _0x448e9a=[];for(var _0x39b0c8 in _0x369a4d[_0x0738('0x48')]){if(_0x369a4d[_0x0738('0x48')][_0x0738('0x43')](_0x39b0c8)){var _0x350a56=_0x369a4d[_0x0738('0x48')][_0x39b0c8];var _0x59a71f={'id':_0x350a56['id'],'available':_0x350a56[_0x0738('0x49')],'loggedIn':_0x350a56[_0x0738('0x4a')],'name':_0x350a56['name'],'paused':_0x350a56[_0x0738('0x4b')],'waiting':_0x350a56[_0x0738('0x4c')]};_0x448e9a[_0x0738('0x20')](_0x59a71f);}}_0x295154({'count':_0x448e9a[_0x0738('0x19')],'rows':_0x448e9a});});},'MailQueues':function(_0x4d96a5){return new Promise(function(_0x4420fe,_0x204fbd){var _0x47bd4e=[];for(var _0x519844 in _0x369a4d[_0x0738('0x4d')]){if(_0x369a4d[_0x0738('0x4d')][_0x0738('0x43')](_0x519844)){var _0x592d30=_0x369a4d['mailQueues'][_0x519844];var _0x40c49c={'id':_0x592d30['id'],'available':_0x592d30[_0x0738('0x49')],'loggedIn':_0x592d30[_0x0738('0x4a')],'name':_0x592d30[_0x0738('0x4e')],'paused':_0x592d30['paused'],'waiting':_0x592d30['waiting']};_0x47bd4e[_0x0738('0x20')](_0x40c49c);}}_0x4420fe({'count':_0x47bd4e[_0x0738('0x19')],'rows':_0x47bd4e});});},'OpenchannelQueues':function(_0x8b385a){return new Promise(function(_0x49ee43,_0x571766){var _0x1d420e=[];for(var _0x362961 in _0x369a4d[_0x0738('0x4f')]){if(_0x369a4d[_0x0738('0x4f')][_0x0738('0x43')](_0x362961)){var _0x2a15ef=_0x369a4d[_0x0738('0x4f')][_0x362961];var _0x29b44c={'id':_0x2a15ef['id'],'available':_0x2a15ef['available'],'loggedIn':_0x2a15ef[_0x0738('0x4a')],'name':_0x2a15ef[_0x0738('0x4e')],'paused':_0x2a15ef[_0x0738('0x4b')],'waiting':_0x2a15ef[_0x0738('0x4c')]};_0x1d420e[_0x0738('0x20')](_0x29b44c);}}_0x49ee43({'count':_0x1d420e[_0x0738('0x19')],'rows':_0x1d420e});});},'SmsQueues':function(_0x2a1923){return new Promise(function(_0x30e273,_0x26cc7c){var _0x4fd9d5=[];for(var _0x96f007 in _0x369a4d[_0x0738('0x50')]){if(_0x369a4d[_0x0738('0x50')][_0x0738('0x43')](_0x96f007)){var _0x573a0b=_0x369a4d[_0x0738('0x50')][_0x96f007];var _0x1c1bf9={'id':_0x573a0b['id'],'available':_0x573a0b[_0x0738('0x49')],'loggedIn':_0x573a0b[_0x0738('0x4a')],'name':_0x573a0b[_0x0738('0x4e')],'paused':_0x573a0b[_0x0738('0x4b')],'waiting':_0x573a0b['waiting']};_0x4fd9d5['push'](_0x1c1bf9);}}_0x30e273({'count':_0x4fd9d5[_0x0738('0x19')],'rows':_0x4fd9d5});});},'FaxQueues':function(_0x33be02){return new Promise(function(_0x4bec40,_0x3cba39){var _0x2a4e9d=[];for(var _0x2e3074 in _0x369a4d[_0x0738('0x51')]){if(_0x369a4d['faxQueues'][_0x0738('0x43')](_0x2e3074)){var _0x30136a=_0x369a4d[_0x0738('0x51')][_0x2e3074];var _0xb91c2e={'id':_0x30136a['id'],'available':_0x30136a['available'],'loggedIn':_0x30136a[_0x0738('0x4a')],'name':_0x30136a[_0x0738('0x4e')],'paused':_0x30136a[_0x0738('0x4b')],'waiting':_0x30136a[_0x0738('0x4c')]};_0x2a4e9d[_0x0738('0x20')](_0xb91c2e);}}_0x4bec40({'count':_0x2a4e9d['length'],'rows':_0x2a4e9d});});},'WhatsappQueues':function(_0x4241ba){return new Promise(function(_0x559638,_0x3b7058){var _0x12765c=[];for(var _0x58e8ed in _0x369a4d['whatsappQueues']){if(_0x369a4d[_0x0738('0x52')][_0x0738('0x43')](_0x58e8ed)){var _0x2cd27b=_0x369a4d['whatsappQueues'][_0x58e8ed];var _0x2c8663={'id':_0x2cd27b['id'],'available':_0x2cd27b[_0x0738('0x49')],'loggedIn':_0x2cd27b[_0x0738('0x4a')],'name':_0x2cd27b[_0x0738('0x4e')],'paused':_0x2cd27b['paused'],'waiting':_0x2cd27b[_0x0738('0x4c')]};_0x12765c[_0x0738('0x20')](_0x2c8663);}}_0x559638({'count':_0x12765c[_0x0738('0x19')],'rows':_0x12765c});});},'ChatQueuesWaitingInteractions':function(_0x685433){return new Promise(function(_0x291fce,_0x4818a4){var _0x5915c7=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x53')]);_0x291fce({'count':_0x5915c7['length'],'rows':_0x5915c7});});},'MailQueuesWaitingInteractions':function(_0x18724e){return new Promise(function(_0x5d82f5,_0x51bcab){var _0x4977c8=_['values'](_0x369a4d[_0x0738('0x54')]);_0x5d82f5({'count':_0x4977c8[_0x0738('0x19')],'rows':_0x4977c8});});},'OpenchannelQueuesWaitingInteractions':function(_0x4e490c){return new Promise(function(_0x5ef98b,_0x465d55){var _0x4c1d19=_['values'](_0x369a4d[_0x0738('0x55')]);_0x5ef98b({'count':_0x4c1d19[_0x0738('0x19')],'rows':_0x4c1d19});});},'SmsQueuesWaitingInteractions':function(_0x1d65c9){return new Promise(function(_0xb7b934,_0x38a1c0){var _0x10461e=_['values'](_0x369a4d['smsQueuesWaitingInteractions']);_0xb7b934({'count':_0x10461e[_0x0738('0x19')],'rows':_0x10461e});});},'FaxQueuesWaitingInteractions':function(_0x2c5b05){return new Promise(function(_0x23689f,_0x16f16f){var _0x3568f=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x56')]);_0x23689f({'count':_0x3568f[_0x0738('0x19')],'rows':_0x3568f});});},'WhatsappQueuesWaitingInteractions':function(_0x1ee979){return new Promise(function(_0x420c04,_0xe7cf80){var _0x441af2=_[_0x0738('0x47')](_0x369a4d[_0x0738('0x57')]);_0x420c04({'count':_0x441af2['length'],'rows':_0x441af2});});}};var _0x5a7df8=jayson[_0x0738('0x58')](_0x3eb43c)[_0x0738('0x59')]();_0x5a7df8['on']('error',function(_0x2f5d6a){logger['error'](JSON[_0x0738('0x31')](_0x2f5d6a));return _0x91ceed(_0x2f5d6a);});_0x5a7df8[_0x0738('0x5a')](0x232c,'127.0.0.1',function(){console[_0x0738('0x5b')](_0x0738('0x5c'),0x232c);return _0x41fb54(_0x0738('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d6109bf..ad353be 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 _0xc77d=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','lodash','../../../config/logger','routing','request','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','then','indexOf'];(function(_0x24e832,_0x9c8319){var _0x352549=function(_0x5c182a){while(--_0x5c182a){_0x24e832['push'](_0x24e832['shift']());}};_0x352549(++_0x9c8319);}(_0xc77d,0x1af));var _0xdc77=function(_0x5283d4,_0x134a3b){_0x5283d4=_0x5283d4-0x0;var _0x2d0300=_0xc77d[_0x5283d4];return _0x2d0300;};'use strict';var util=require(_0xdc77('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xdc77('0x1'));var logger=require(_0xdc77('0x2'))(_0xdc77('0x3'));var client=jayson['client']['http']({'port':0x232a});function request(_0x562b84,_0x48c032){return new BPromise(function(_0x12d865,_0x35ccf1){return client[_0xdc77('0x4')](_0x562b84,_0x48c032)['then'](function(_0xc4e426){if(_0xc4e426[_0xdc77('0x5')]){return _0x35ccf1(_0xc4e426['error'][_0xdc77('0x6')]);}else{return _0x12d865(_0xc4e426['result']);}})[_0xdc77('0x7')](function(_0x5d0a3c){return _0x35ccf1(_0x5d0a3c);});});}exports['condition']=function(_0x587951,_0x517444,_0x5d3f32){return function(_0x348f8d){if(_0x5d3f32[_0xdc77('0x8')]&&!_0x5d3f32[_0xdc77('0x8')][_0x587951]){logger[_0xdc77('0x9')](_0xdc77('0xa'),_0x587951);return _0x348f8d['stop']();}var _0x56c6bf=[];for(var _0x317b6a=0x0;_0x317b6a<_0x517444['length'];_0x317b6a+=0x1){_0x56c6bf[_0xdc77('0xb')](request(_0xdc77('0xc'),{'command':util[_0xdc77('0xd')](_0xdc77('0xe'),_0x517444[_0x317b6a])})[_0xdc77('0xf')](function(_0x315440){return _0x315440&&_0x315440[_0xdc77('0x6')]&&_0x315440[_0xdc77('0x6')][_0xdc77('0x10')](_0xdc77('0x11'))>=0x0?!![]:![];})[_0xdc77('0x7')](function(_0x52176e){logger[_0xdc77('0x5')](_0xdc77('0x12'),_0x587951,_0x517444[_0x317b6a]);}));}BPromise[_0xdc77('0x13')](_0x56c6bf)['then'](function(_0x322ea7){var _0x233e6c=_[_0xdc77('0x14')](_0x322ea7);logger[_0xdc77('0x9')](_0xdc77('0x15'),_0x587951,_0x517444[_0xdc77('0x16')](_0xdc77('0x17')),_0x233e6c);_0x348f8d[_0xdc77('0x18')](_0x233e6c);})[_0xdc77('0x7')](function(_0x463bfe){console[_0xdc77('0x19')](_0x463bfe);logger[_0xdc77('0x5')](_0xdc77('0x15'),_0x587951,_0x517444[_0xdc77('0x16')](_0xdc77('0x17')),_0x463bfe[_0xdc77('0x1a')]);_0x348f8d[_0xdc77('0x1b')]();});};}; \ No newline at end of file +var _0x0564=['log','stack','stop','bluebird','lodash','../../../config/logger','client','http','request','error','result','catch','rules','info','length','Command','format','message','true','all','then','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when'];(function(_0x275676,_0x2d49a0){var _0x2a6423=function(_0x3c2de4){while(--_0x3c2de4){_0x275676['push'](_0x275676['shift']());}};_0x2a6423(++_0x2d49a0);}(_0x0564,0xfd));var _0x4056=function(_0x3b45a1,_0x310aca){_0x3b45a1=_0x3b45a1-0x0;var _0x587eda=_0x0564[_0x3b45a1];return _0x587eda;};'use strict';var util=require('util');var BPromise=require(_0x4056('0x0'));var jayson=require('jayson/promise');var _=require(_0x4056('0x1'));var logger=require(_0x4056('0x2'))('routing');var client=jayson[_0x4056('0x3')][_0x4056('0x4')]({'port':0x232a});function request(_0x58bc53,_0x118607){return new BPromise(function(_0x4cd468,_0x496cd5){return client[_0x4056('0x5')](_0x58bc53,_0x118607)['then'](function(_0x44e0d8){if(_0x44e0d8[_0x4056('0x6')]){return _0x496cd5(_0x44e0d8['error']['message']);}else{return _0x4cd468(_0x44e0d8[_0x4056('0x7')]);}})[_0x4056('0x8')](function(_0x101d52){return _0x496cd5(_0x101d52);});});}exports['condition']=function(_0x47052d,_0x93653c,_0x3ec8fd){return function(_0x575dc2){if(_0x3ec8fd[_0x4056('0x9')]&&!_0x3ec8fd[_0x4056('0x9')][_0x47052d]){logger[_0x4056('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x47052d);return _0x575dc2['stop']();}var _0x1c95fc=[];for(var _0x3cfc4f=0x0;_0x3cfc4f<_0x93653c[_0x4056('0xb')];_0x3cfc4f+=0x1){_0x1c95fc['push'](request(_0x4056('0xc'),{'command':util[_0x4056('0xd')]('iftime\x20%s',_0x93653c[_0x3cfc4f])})['then'](function(_0x17d8b7){return _0x17d8b7&&_0x17d8b7[_0x4056('0xe')]&&_0x17d8b7[_0x4056('0xe')]['indexOf'](_0x4056('0xf'))>=0x0?!![]:![];})['catch'](function(_0x56e338){logger['error']('[%s][INTERVAL]\x20%s',_0x47052d,_0x93653c[_0x3cfc4f]);}));}BPromise[_0x4056('0x10')](_0x1c95fc)[_0x4056('0x11')](function(_0x1faf44){var _0x23dfe2=_[_0x4056('0x12')](_0x1faf44);logger[_0x4056('0xa')](_0x4056('0x13'),_0x47052d,_0x93653c['join'](_0x4056('0x14')),_0x23dfe2);_0x575dc2[_0x4056('0x15')](_0x23dfe2);})[_0x4056('0x8')](function(_0x13eebe){console[_0x4056('0x16')](_0x13eebe);logger[_0x4056('0x6')](_0x4056('0x13'),_0x47052d,_0x93653c['join'](_0x4056('0x14')),_0x13eebe[_0x4056('0x17')]);_0x575dc2[_0x4056('0x18')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 015aeef..b4eba06 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 _0x97c8=['origtransfererlinkedid','secondtransfereruniqueid','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','rejected','indexOf','splice','agent','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','push','forIn','includes','abandoned','talktime','agentconnect','agentconnectAt','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','diffTime','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x97c8,0x1b4));var _0x897c=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0x97c8[_0xe89d97];return _0x1b6e5d;};'use strict';var _=require('lodash');var util=require(_0x897c('0x0'));var utils=require(_0x897c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4d5c7f,_0x34d914){utils['info'](util[_0x897c('0x2')](_0x897c('0x3'),_0x4d5c7f[_0x897c('0x4')],_0x4d5c7f['channel'],_0x4d5c7f[_0x897c('0x5')],_0x4d5c7f[_0x897c('0x6')],_0x4d5c7f[_0x897c('0x7')],_0x4d5c7f['calleridnum'],_0x4d5c7f[_0x897c('0x8')],_0x4d5c7f[_0x897c('0x9')]));if(_0x4d5c7f[_0x897c('0x5')]){utils['getVoiceQueueByName'](_0x4d5c7f[_0x897c('0x5')])[_0x897c('0xa')](function(_0x31f2a){if(_0x31f2a){_0x4d5c7f[_0x897c('0xb')]=_0x31f2a['type'];_0x4d5c7f[_0x897c('0xc')]=_0x4d5c7f[_0x897c('0xd')]?_0x31f2a['acw']:![];_0x4d5c7f[_0x897c('0xe')]=_0x4d5c7f['agentacw']?_0x31f2a['acwTimeout']:0x0;}utils[_0x897c('0xf')](_0x897c('0x10'),_0x4d5c7f);});}else{utils[_0x897c('0xf')](_0x897c('0x10'),_0x4d5c7f);}if(_0x34d914){delete transfers[_0x4d5c7f['uniqueid']];}else{delete agents[_0x4d5c7f[_0x897c('0x11')]];}}exports[_0x897c('0x12')]=function(_0x2e6232){try{agents[_0x2e6232[_0x897c('0x11')]]=_0x2e6232;agents[_0x2e6232['destuniqueid']][_0x897c('0x13')]=utils[_0x897c('0x14')]();agents[_0x2e6232[_0x897c('0x11')]][_0x897c('0x9')]=_0x897c('0x15');agents[_0x2e6232['destuniqueid']][_0x897c('0x8')]=null;agents[_0x2e6232[_0x897c('0x11')]]['connectedlinename']=null;}catch(_0x794d46){utils[_0x897c('0x16')](_0x794d46[_0x897c('0x17')]);}};exports[_0x897c('0x18')]=function(_0x349c44){try{if(!_['isNil'](agents[_0x349c44[_0x897c('0x11')]])){agents[_0x349c44[_0x897c('0x11')]]['agentringnoanswer']=!![];agents[_0x349c44['destuniqueid']][_0x897c('0x19')]=utils['now']();agents[_0x349c44[_0x897c('0x11')]]['lastevent']=_0x897c('0x1a');agents[_0x349c44[_0x897c('0x11')]][_0x897c('0x1b')]='timeout';agents[_0x349c44['destuniqueid']][_0x897c('0x1c')]=_0x349c44['ringtime']?parseInt(_0x349c44['ringtime'])/0x3e8:0x0;agents[_0x349c44[_0x897c('0x11')]]['talktime']=0x0;unanswered[_0x897c('0x1d')](_0x349c44['destuniqueid']);}}catch(_0x2c76c9){utils[_0x897c('0x16')](_0x2c76c9[_0x897c('0x17')]);}};exports['queuecallerabandon']=function(_0x82bd9){try{_[_0x897c('0x1e')](agents,function(_0x2b87c8,_0x4bb54e){if(_0x2b87c8['uniqueid']==_0x82bd9[_0x897c('0x4')]&&!_[_0x897c('0x1f')](unanswered,_0x2b87c8[_0x897c('0x11')])){_0x2b87c8[_0x897c('0x18')]=!![];_0x2b87c8[_0x897c('0x19')]=utils[_0x897c('0x14')]();_0x2b87c8['lastevent']='abandoned';_0x2b87c8[_0x897c('0x1b')]=_0x897c('0x20');_0x2b87c8['holdtime']=_0x82bd9['holdtime'];_0x2b87c8[_0x897c('0x21')]=0x0;writeDB(_0x2b87c8);}});}catch(_0x37a3e7){utils[_0x897c('0x16')](_0x37a3e7[_0x897c('0x17')]);}};exports[_0x897c('0x22')]=function(_0x5e7714){try{if(agents[_0x5e7714[_0x897c('0x11')]]){agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x23')]=utils[_0x897c('0x14')]();agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x8')]=_0x5e7714[_0x897c('0x8')];agents[_0x5e7714['destuniqueid']]['connectedlinename']=_0x5e7714[_0x897c('0x24')];agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x1c')]=_0x5e7714[_0x897c('0x25')];agents[_0x5e7714[_0x897c('0x11')]][_0x897c('0x9')]=_0x897c('0x26');_['forIn'](agents,function(_0x4583c0,_0x53ea7b){if(_0x4583c0[_0x897c('0x11')]!=_0x5e7714[_0x897c('0x11')]&&_0x4583c0[_0x897c('0x4')]==_0x5e7714[_0x897c('0x4')]){_0x4583c0[_0x897c('0x21')]=0x0;_0x4583c0[_0x897c('0x1c')]=_0x5e7714[_0x897c('0x25')];_0x4583c0[_0x897c('0x18')]=!![];_0x4583c0[_0x897c('0x19')]=utils['now']();_0x4583c0['lastevent']=_0x897c('0x27');_0x4583c0[_0x897c('0x1b')]=_0x897c('0x27');_0x4583c0[_0x897c('0x28')]=_0x5e7714['destuniqueid'];_0x4583c0[_0x897c('0x29')]=_0x5e7714[_0x897c('0x6')];writeDB(_0x4583c0);}});}}catch(_0x4a96c8){utils[_0x897c('0x16')](_0x4a96c8[_0x897c('0x17')]);}};exports[_0x897c('0xd')]=function(_0x1e1f81){try{if(!_[_0x897c('0x2a')](agents[_0x1e1f81[_0x897c('0x11')]])){agents[_0x1e1f81[_0x897c('0x11')]][_0x897c('0xd')]=!![];agents[_0x1e1f81[_0x897c('0x11')]]['agentcompleteAt']=utils['now']();agents[_0x1e1f81[_0x897c('0x11')]][_0x897c('0x21')]=utils[_0x897c('0x2b')](agents[_0x1e1f81['destuniqueid']][_0x897c('0x2c')],agents[_0x1e1f81[_0x897c('0x11')]][_0x897c('0x23')]);agents[_0x1e1f81['destuniqueid']][_0x897c('0x1b')]=_0x1e1f81['reason'];agents[_0x1e1f81[_0x897c('0x11')]]['lastevent']=_0x897c('0x2d');writeDB(agents[_0x1e1f81['destuniqueid']]);}}catch(_0x195fbd){utils[_0x897c('0x16')](_0x195fbd[_0x897c('0x17')]);}};exports['blindtransfer']=function(_0x15cbfc){try{if(!_[_0x897c('0x2a')](agents[_0x15cbfc['transfereruniqueid']])){agents[_0x15cbfc[_0x897c('0x2e')]][_0x897c('0x2f')]=!![];agents[_0x15cbfc[_0x897c('0x2e')]][_0x897c('0x30')]=_0x897c('0x31');agents[_0x15cbfc[_0x897c('0x2e')]][_0x897c('0x32')]=_0x15cbfc[_0x897c('0x33')];agents[_0x15cbfc[_0x897c('0x2e')]]['transferuniqueid']=agents[_0x15cbfc[_0x897c('0x2e')]]['uniqueid'];}}catch(_0x1b6035){utils['error'](_0x1b6035['stack']);}};exports[_0x897c('0x34')]=function(_0x49af69){try{if(_0x49af69[_0x897c('0x35')]==_0x49af69[_0x897c('0x36')]){if(!_[_0x897c('0x2a')](agents[_0x49af69[_0x897c('0x37')]])){agents[_0x49af69[_0x897c('0x37')]]['transfer']=!![];agents[_0x49af69[_0x897c('0x37')]][_0x897c('0x30')]='ATTENDED';agents[_0x49af69['secondtransfereruniqueid']][_0x897c('0x32')]=_0x49af69['origtransfererexten'];agents[_0x49af69['secondtransfereruniqueid']][_0x897c('0x38')]=_0x49af69['origtransfereruniqueid'];}if(_0x49af69['transfereeuniqueid']&&agents[_0x49af69['transfereeuniqueid']]){agents[_0x49af69[_0x897c('0x39')]][_0x897c('0x3a')]=0x1;transfers[_0x49af69[_0x897c('0x39')]]=_[_0x897c('0x3b')](agents[_0x49af69[_0x897c('0x39')]]);transfers[_0x49af69['transfereeuniqueid']][_0x897c('0x3c')]=agents[_0x49af69[_0x897c('0x37')]][_0x897c('0x3c')];transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x3d')]=agents[_0x49af69[_0x897c('0x37')]][_0x897c('0x3d')];transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x13')]=utils[_0x897c('0x14')]();transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x23')]=utils['now']();transfers[_0x49af69['transfereeuniqueid']][_0x897c('0x1c')]=0x0;transfers[_0x49af69[_0x897c('0x39')]][_0x897c('0x3a')]=0x2;}}else if(_0x49af69[_0x897c('0x37')]==_0x49af69['secondtransfererlinkedid']){if(!_[_0x897c('0x2a')](agents[_0x49af69[_0x897c('0x35')]])){agents[_0x49af69[_0x897c('0x35')]]['transfer']=!![];agents[_0x49af69[_0x897c('0x35')]][_0x897c('0x30')]=_0x897c('0x3e');agents[_0x49af69['origtransfereruniqueid']][_0x897c('0x32')]=_0x49af69[_0x897c('0x3f')];agents[_0x49af69['origtransfereruniqueid']][_0x897c('0x38')]=_0x49af69[_0x897c('0x37')];}if(_0x49af69[_0x897c('0x40')]&&agents[_0x49af69[_0x897c('0x40')]]){agents[_0x49af69['transfertargetuniqueid']][_0x897c('0x3a')]=0x1;transfers[_0x49af69[_0x897c('0x40')]]=_[_0x897c('0x3b')](agents[_0x49af69[_0x897c('0x40')]]);transfers[_0x49af69[_0x897c('0x40')]]['calleridnum']=agents[_0x49af69[_0x897c('0x35')]][_0x897c('0x3c')];transfers[_0x49af69['transfertargetuniqueid']][_0x897c('0x3d')]=agents[_0x49af69[_0x897c('0x35')]]['calleridname'];transfers[_0x49af69[_0x897c('0x40')]][_0x897c('0x13')]=utils[_0x897c('0x14')]();transfers[_0x49af69['transfertargetuniqueid']][_0x897c('0x23')]=utils[_0x897c('0x14')]();transfers[_0x49af69[_0x897c('0x40')]][_0x897c('0x1c')]=0x0;transfers[_0x49af69[_0x897c('0x40')]][_0x897c('0x3a')]=0x2;}}}catch(_0x42f65b){utils[_0x897c('0x16')](_0x42f65b['stack']);}};exports[_0x897c('0x41')]=function(_0x3f9327){try{if(agents[_0x3f9327[_0x897c('0x4')]]&&agents[_0x3f9327['uniqueid']][_0x897c('0x1b')]===_0x897c('0x1a')){if(_0x3f9327['cause']==='21'){agents[_0x3f9327['uniqueid']][_0x897c('0x1b')]=_0x897c('0x42');agents[_0x3f9327['uniqueid']][_0x897c('0x9')]=_0x897c('0x42');}writeDB(agents[_0x3f9327[_0x897c('0x4')]]);var _0x270e06=unanswered[_0x897c('0x43')](_0x3f9327[_0x897c('0x4')]);if(_0x270e06>-0x1)unanswered[_0x897c('0x44')](_0x270e06,0x1);}if(transfers[_0x3f9327[_0x897c('0x4')]]){transfers[_0x3f9327[_0x897c('0x4')]]['agentcomplete']=!![];transfers[_0x3f9327[_0x897c('0x4')]][_0x897c('0x2c')]=utils[_0x897c('0x14')]();transfers[_0x3f9327[_0x897c('0x4')]][_0x897c('0x21')]=utils['diffTime'](transfers[_0x3f9327['uniqueid']][_0x897c('0x2c')],transfers[_0x3f9327['uniqueid']][_0x897c('0x23')]);transfers[_0x3f9327[_0x897c('0x4')]][_0x897c('0x1b')]=_0x897c('0x45');transfers[_0x3f9327['uniqueid']][_0x897c('0x9')]=_0x897c('0x2d');writeDB(transfers[_0x3f9327[_0x897c('0x4')]],!![]);}if(agents[_0x3f9327[_0x897c('0x4')]]&&agents[_0x3f9327[_0x897c('0x4')]][_0x897c('0x23')]){agents[_0x3f9327[_0x897c('0x4')]]['agentcomplete']=!![];agents[_0x3f9327['uniqueid']][_0x897c('0x2c')]=utils['now']();agents[_0x3f9327['uniqueid']][_0x897c('0x21')]=utils[_0x897c('0x2b')](agents[_0x3f9327[_0x897c('0x4')]][_0x897c('0x2c')],agents[_0x3f9327[_0x897c('0x4')]]['agentconnectAt']);agents[_0x3f9327[_0x897c('0x4')]]['reason']=agents[_0x3f9327['uniqueid']][_0x897c('0x2f')]?'transfer':_0x897c('0x45');agents[_0x3f9327[_0x897c('0x4')]][_0x897c('0x9')]='complete';writeDB(agents[_0x3f9327[_0x897c('0x4')]]);}}catch(_0x28814e){utils[_0x897c('0x16')](_0x28814e[_0x897c('0x17')]);}}; \ No newline at end of file +var _0xa0e5=['connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','connectedlinename','error','isNil','agentringnoanswerAt','now','timeout','ringtime','talktime','stack','queuecallerabandon','agentringnoanswer','abandoned','reason','holdtime','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','diffTime','agentcompleteAt','complete','transfereruniqueid','transfer','transfertype','transferexten','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','origtransfereruniqueid','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','agentcalledAt','hangup','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','membername','interface','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0e5,0x193));var _0x5a0e=function(_0x1bf463,_0x4b6a97){_0x1bf463=_0x1bf463-0x0;var _0xcdf46b=_0xa0e5[_0x1bf463];return _0xcdf46b;};'use strict';var _=require(_0x5a0e('0x0'));var util=require(_0x5a0e('0x1'));var utils=require(_0x5a0e('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2efba7,_0x29d887){utils[_0x5a0e('0x3')](util[_0x5a0e('0x4')](_0x5a0e('0x5'),_0x2efba7[_0x5a0e('0x6')],_0x2efba7[_0x5a0e('0x7')],_0x2efba7['queue'],_0x2efba7[_0x5a0e('0x8')],_0x2efba7[_0x5a0e('0x9')],_0x2efba7[_0x5a0e('0xa')],_0x2efba7[_0x5a0e('0xb')],_0x2efba7[_0x5a0e('0xc')]));if(_0x2efba7['queue']){utils[_0x5a0e('0xd')](_0x2efba7['queue'])['then'](function(_0x1944bc){if(_0x1944bc){_0x2efba7[_0x5a0e('0xe')]=_0x1944bc[_0x5a0e('0xe')];_0x2efba7[_0x5a0e('0xf')]=_0x2efba7['agentcomplete']?_0x1944bc[_0x5a0e('0x10')]:![];_0x2efba7[_0x5a0e('0x11')]=_0x2efba7[_0x5a0e('0xf')]?_0x1944bc[_0x5a0e('0x12')]:0x0;}utils[_0x5a0e('0x13')](_0x5a0e('0x14'),_0x2efba7);});}else{utils[_0x5a0e('0x13')](_0x5a0e('0x14'),_0x2efba7);}if(_0x29d887){delete transfers[_0x2efba7[_0x5a0e('0x6')]];}else{delete agents[_0x2efba7['destuniqueid']];}}exports[_0x5a0e('0x15')]=function(_0x25d58b){try{agents[_0x25d58b[_0x5a0e('0x16')]]=_0x25d58b;agents[_0x25d58b[_0x5a0e('0x16')]]['agentcalledAt']=utils['now']();agents[_0x25d58b[_0x5a0e('0x16')]][_0x5a0e('0xc')]='called';agents[_0x25d58b['destuniqueid']][_0x5a0e('0xb')]=null;agents[_0x25d58b[_0x5a0e('0x16')]][_0x5a0e('0x17')]=null;}catch(_0x18eaf6){utils[_0x5a0e('0x18')](_0x18eaf6['stack']);}};exports['agentringnoanswer']=function(_0xb04097){try{if(!_[_0x5a0e('0x19')](agents[_0xb04097[_0x5a0e('0x16')]])){agents[_0xb04097[_0x5a0e('0x16')]]['agentringnoanswer']=!![];agents[_0xb04097[_0x5a0e('0x16')]][_0x5a0e('0x1a')]=utils[_0x5a0e('0x1b')]();agents[_0xb04097['destuniqueid']][_0x5a0e('0xc')]=_0x5a0e('0x1c');agents[_0xb04097['destuniqueid']]['reason']=_0x5a0e('0x1c');agents[_0xb04097['destuniqueid']]['holdtime']=_0xb04097[_0x5a0e('0x1d')]?parseInt(_0xb04097['ringtime'])/0x3e8:0x0;agents[_0xb04097[_0x5a0e('0x16')]][_0x5a0e('0x1e')]=0x0;unanswered['push'](_0xb04097[_0x5a0e('0x16')]);}}catch(_0x447c3c){utils[_0x5a0e('0x18')](_0x447c3c[_0x5a0e('0x1f')]);}};exports[_0x5a0e('0x20')]=function(_0xfee107){try{_['forIn'](agents,function(_0x40f374,_0x5e7d43){if(_0x40f374[_0x5a0e('0x6')]==_0xfee107['uniqueid']&&!_['includes'](unanswered,_0x40f374[_0x5a0e('0x16')])){_0x40f374[_0x5a0e('0x21')]=!![];_0x40f374[_0x5a0e('0x1a')]=utils[_0x5a0e('0x1b')]();_0x40f374[_0x5a0e('0xc')]=_0x5a0e('0x22');_0x40f374[_0x5a0e('0x23')]=_0x5a0e('0x22');_0x40f374['holdtime']=_0xfee107[_0x5a0e('0x24')];_0x40f374[_0x5a0e('0x1e')]=0x0;writeDB(_0x40f374);}});}catch(_0x11a93e){utils[_0x5a0e('0x18')](_0x11a93e[_0x5a0e('0x1f')]);}};exports['agentconnect']=function(_0xf03535){try{if(agents[_0xf03535[_0x5a0e('0x16')]]){agents[_0xf03535[_0x5a0e('0x16')]][_0x5a0e('0x25')]=utils[_0x5a0e('0x1b')]();agents[_0xf03535[_0x5a0e('0x16')]]['connectedlinenum']=_0xf03535[_0x5a0e('0xb')];agents[_0xf03535['destuniqueid']][_0x5a0e('0x17')]=_0xf03535[_0x5a0e('0x17')];agents[_0xf03535[_0x5a0e('0x16')]][_0x5a0e('0x24')]=_0xf03535[_0x5a0e('0x1d')];agents[_0xf03535['destuniqueid']][_0x5a0e('0xc')]='connect';_[_0x5a0e('0x26')](agents,function(_0x767643,_0x5c5d23){if(_0x767643[_0x5a0e('0x16')]!=_0xf03535[_0x5a0e('0x16')]&&_0x767643[_0x5a0e('0x6')]==_0xf03535[_0x5a0e('0x6')]){_0x767643['talktime']=0x0;_0x767643[_0x5a0e('0x24')]=_0xf03535[_0x5a0e('0x1d')];_0x767643['agentringnoanswer']=!![];_0x767643[_0x5a0e('0x1a')]=utils[_0x5a0e('0x1b')]();_0x767643[_0x5a0e('0xc')]=_0x5a0e('0x27');_0x767643[_0x5a0e('0x23')]=_0x5a0e('0x27');_0x767643[_0x5a0e('0x28')]=_0xf03535[_0x5a0e('0x16')];_0x767643[_0x5a0e('0x29')]=_0xf03535['membername'];writeDB(_0x767643);}});}}catch(_0x18d4e3){utils[_0x5a0e('0x18')](_0x18d4e3[_0x5a0e('0x1f')]);}};exports[_0x5a0e('0x2a')]=function(_0x3b58a8){try{if(!_['isNil'](agents[_0x3b58a8[_0x5a0e('0x16')]])){agents[_0x3b58a8[_0x5a0e('0x16')]][_0x5a0e('0x2a')]=!![];agents[_0x3b58a8[_0x5a0e('0x16')]]['agentcompleteAt']=utils[_0x5a0e('0x1b')]();agents[_0x3b58a8['destuniqueid']][_0x5a0e('0x1e')]=utils[_0x5a0e('0x2b')](agents[_0x3b58a8['destuniqueid']][_0x5a0e('0x2c')],agents[_0x3b58a8['destuniqueid']][_0x5a0e('0x25')]);agents[_0x3b58a8[_0x5a0e('0x16')]][_0x5a0e('0x23')]=_0x3b58a8[_0x5a0e('0x23')];agents[_0x3b58a8[_0x5a0e('0x16')]][_0x5a0e('0xc')]=_0x5a0e('0x2d');writeDB(agents[_0x3b58a8[_0x5a0e('0x16')]]);}}catch(_0x1f93f7){utils[_0x5a0e('0x18')](_0x1f93f7[_0x5a0e('0x1f')]);}};exports['blindtransfer']=function(_0x25c047){try{if(!_[_0x5a0e('0x19')](agents[_0x25c047['transfereruniqueid']])){agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x2f')]=!![];agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x30')]='blind';agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x31')]=_0x25c047['extension'];agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x32')]=agents[_0x25c047[_0x5a0e('0x2e')]][_0x5a0e('0x6')];}}catch(_0x38d114){utils[_0x5a0e('0x18')](_0x38d114['stack']);}};exports[_0x5a0e('0x33')]=function(_0x27a457){try{if(_0x27a457['origtransfereruniqueid']==_0x27a457[_0x5a0e('0x34')]){if(!_[_0x5a0e('0x19')](agents[_0x27a457[_0x5a0e('0x35')]])){agents[_0x27a457[_0x5a0e('0x35')]][_0x5a0e('0x2f')]=!![];agents[_0x27a457[_0x5a0e('0x35')]]['transfertype']=_0x5a0e('0x36');agents[_0x27a457['secondtransfereruniqueid']][_0x5a0e('0x31')]=_0x27a457[_0x5a0e('0x37')];agents[_0x27a457[_0x5a0e('0x35')]][_0x5a0e('0x32')]=_0x27a457[_0x5a0e('0x38')];}if(_0x27a457[_0x5a0e('0x39')]&&agents[_0x27a457[_0x5a0e('0x39')]]){agents[_0x27a457[_0x5a0e('0x39')]][_0x5a0e('0x3a')]=0x1;transfers[_0x27a457['transfereeuniqueid']]=_['clone'](agents[_0x27a457[_0x5a0e('0x39')]]);transfers[_0x27a457[_0x5a0e('0x39')]]['calleridnum']=agents[_0x27a457[_0x5a0e('0x35')]][_0x5a0e('0xa')];transfers[_0x27a457[_0x5a0e('0x39')]][_0x5a0e('0x3b')]=agents[_0x27a457['secondtransfereruniqueid']][_0x5a0e('0x3b')];transfers[_0x27a457[_0x5a0e('0x39')]]['agentcalledAt']=utils[_0x5a0e('0x1b')]();transfers[_0x27a457['transfereeuniqueid']][_0x5a0e('0x25')]=utils['now']();transfers[_0x27a457['transfereeuniqueid']][_0x5a0e('0x24')]=0x0;transfers[_0x27a457['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x27a457[_0x5a0e('0x35')]==_0x27a457['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x27a457['origtransfereruniqueid']])){agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0x2f')]=!![];agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0x30')]=_0x5a0e('0x36');agents[_0x27a457['origtransfereruniqueid']][_0x5a0e('0x31')]=_0x27a457['secondtransfererexten'];agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0x32')]=_0x27a457['secondtransfereruniqueid'];}if(_0x27a457[_0x5a0e('0x3c')]&&agents[_0x27a457[_0x5a0e('0x3c')]]){agents[_0x27a457['transfertargetuniqueid']][_0x5a0e('0x3a')]=0x1;transfers[_0x27a457['transfertargetuniqueid']]=_[_0x5a0e('0x3d')](agents[_0x27a457['transfertargetuniqueid']]);transfers[_0x27a457[_0x5a0e('0x3c')]][_0x5a0e('0xa')]=agents[_0x27a457[_0x5a0e('0x38')]][_0x5a0e('0xa')];transfers[_0x27a457[_0x5a0e('0x3c')]][_0x5a0e('0x3b')]=agents[_0x27a457[_0x5a0e('0x38')]]['calleridname'];transfers[_0x27a457['transfertargetuniqueid']][_0x5a0e('0x3e')]=utils[_0x5a0e('0x1b')]();transfers[_0x27a457[_0x5a0e('0x3c')]][_0x5a0e('0x25')]=utils[_0x5a0e('0x1b')]();transfers[_0x27a457[_0x5a0e('0x3c')]]['holdtime']=0x0;transfers[_0x27a457['transfertargetuniqueid']][_0x5a0e('0x3a')]=0x2;}}}catch(_0xa35301){utils['error'](_0xa35301[_0x5a0e('0x1f')]);}};exports[_0x5a0e('0x3f')]=function(_0x42a749){try{if(agents[_0x42a749[_0x5a0e('0x6')]]&&agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x23')]===_0x5a0e('0x1c')){if(_0x42a749[_0x5a0e('0x40')]==='21'){agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x23')]=_0x5a0e('0x41');agents[_0x42a749[_0x5a0e('0x6')]]['lastevent']=_0x5a0e('0x41');}writeDB(agents[_0x42a749['uniqueid']]);var _0x4c7889=unanswered[_0x5a0e('0x42')](_0x42a749[_0x5a0e('0x6')]);if(_0x4c7889>-0x1)unanswered[_0x5a0e('0x43')](_0x4c7889,0x1);}if(transfers[_0x42a749[_0x5a0e('0x6')]]){transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2a')]=!![];transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2c')]=utils[_0x5a0e('0x1b')]();transfers[_0x42a749[_0x5a0e('0x6')]]['talktime']=utils[_0x5a0e('0x2b')](transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2c')],transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x25')]);transfers[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x23')]=_0x5a0e('0x44');transfers[_0x42a749['uniqueid']]['lastevent']='complete';writeDB(transfers[_0x42a749[_0x5a0e('0x6')]],!![]);}if(agents[_0x42a749[_0x5a0e('0x6')]]&&agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x25')]){agents[_0x42a749['uniqueid']][_0x5a0e('0x2a')]=!![];agents[_0x42a749[_0x5a0e('0x6')]][_0x5a0e('0x2c')]=utils[_0x5a0e('0x1b')]();agents[_0x42a749[_0x5a0e('0x6')]]['talktime']=utils['diffTime'](agents[_0x42a749[_0x5a0e('0x6')]]['agentcompleteAt'],agents[_0x42a749[_0x5a0e('0x6')]]['agentconnectAt']);agents[_0x42a749[_0x5a0e('0x6')]]['reason']=agents[_0x42a749['uniqueid']]['transfer']?_0x5a0e('0x2f'):_0x5a0e('0x44');agents[_0x42a749[_0x5a0e('0x6')]]['lastevent']='complete';writeDB(agents[_0x42a749[_0x5a0e('0x6')]]);}}catch(_0xb578b1){utils[_0x5a0e('0x18')](_0xb578b1[_0x5a0e('0x1f')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index f874b57..27322e4 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 _0xaec7=['xmd-originatecalleridnum','value','xmd-phone','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','application','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','type','accountcode','source','destination','callerid','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','exten','context','now','DOCUMENTATION','stack','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','hangup','calleridname','endtime','duration','diffTime','starttime','answertime','error','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xaec7,0x1a7));var _0x7aec=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xaec7[_0x40dd56];return _0x4f850f;};'use strict';var _=require('lodash');var util=require(_0x7aec('0x0'));var utils=require(_0x7aec('0x1'));var dispositions=[_0x7aec('0x2'),_0x7aec('0x3'),_0x7aec('0x3'),_0x7aec('0x2'),_0x7aec('0x2'),_0x7aec('0x2'),_0x7aec('0x4'),_0x7aec('0x5'),'FAILED',_0x7aec('0x3'),_0x7aec('0x3')];var channels={};function writeDB(_0x258d68){utils[_0x7aec('0x6')](util[_0x7aec('0x7')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x258d68[_0x7aec('0x8')],_0x258d68[_0x7aec('0x9')],_0x258d68[_0x7aec('0xa')],_0x258d68[_0x7aec('0xb')],_0x258d68[_0x7aec('0xc')],_0x258d68[_0x7aec('0xd')],_0x258d68[_0x7aec('0xe')],_0x258d68['disposition']));if(_0x258d68[_0x7aec('0xb')]){utils[_0x7aec('0xf')](_0x258d68[_0x7aec('0xb')])[_0x7aec('0x10')](function(_0x22482d){if(_0x22482d){_0x258d68[_0x7aec('0x11')]=_0x22482d['id'];}utils[_0x7aec('0x12')](_0x7aec('0x13'),_0x258d68);});}else{utils['request'](_0x7aec('0x13'),_0x258d68);}if(channels[_0x258d68[_0x7aec('0x8')]]){delete channels[_0x258d68[_0x7aec('0x8')]];}}exports['newchannel']=function(_0x29cb6d){try{if(_0x29cb6d['uniqueid']==_0x29cb6d[_0x7aec('0x14')]&&_0x29cb6d[_0x7aec('0x9')]!='OutgoingSpoolFailed'){channels[_0x29cb6d[_0x7aec('0x8')]]={'uniqueid':_0x29cb6d[_0x7aec('0x8')],'accountcode':_0x29cb6d[_0x7aec('0xb')],'source':_0x29cb6d['calleridnum'],'destination':_0x29cb6d[_0x7aec('0x15')],'destinationcontext':_0x29cb6d[_0x7aec('0x16')],'channel':_0x29cb6d[_0x7aec('0x9')],'starttime':utils[_0x7aec('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7aec('0x2'),'amaflags':_0x7aec('0x18')};}}catch(_0x4ff630){utils['error'](_0x4ff630[_0x7aec('0x19')]);}};exports[_0x7aec('0x1a')]=function(_0x4d6a2a){try{if(!_[_0x7aec('0x1b')](channels[_0x4d6a2a[_0x7aec('0x8')]])&&_0x4d6a2a[_0x7aec('0x1c')]==0x6){if(_[_0x7aec('0x1b')](channels[_0x4d6a2a[_0x7aec('0x8')]][_0x7aec('0x1d')])){channels[_0x4d6a2a[_0x7aec('0x8')]]['systemanswertime']=utils[_0x7aec('0x17')]();}}else if(!_['isNil'](channels[_0x4d6a2a[_0x7aec('0x14')]])&&_0x4d6a2a[_0x7aec('0x1c')]==0x6&&_0x4d6a2a[_0x7aec('0x16')]!=_0x7aec('0x1e')){channels[_0x4d6a2a[_0x7aec('0x14')]]['accountcode']=_0x4d6a2a['accountcode'];channels[_0x4d6a2a[_0x7aec('0x14')]][_0x7aec('0x1f')]=_0x4d6a2a[_0x7aec('0x9')];if(_[_0x7aec('0x1b')](channels[_0x4d6a2a[_0x7aec('0x14')]]['answertime'])){channels[_0x4d6a2a[_0x7aec('0x14')]]['answertime']=utils['now']();}channels[_0x4d6a2a[_0x7aec('0x14')]]['disposition']=dispositions[_['toNumber'](_0x4d6a2a['channelstate'])]||'ANSWERED';}}catch(_0x330a02){utils['error'](_0x330a02[_0x7aec('0x19')]);}};exports[_0x7aec('0x20')]=function(_0x34ba8e){try{if(!_[_0x7aec('0x1b')](channels[_0x34ba8e['uniqueid']])){if(_[_0x7aec('0x1b')](channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0xe')])){channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0xe')]=_0x34ba8e[_0x7aec('0x21')]+'\x20<'+_0x34ba8e['calleridnum']+'>';}channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x22')]=utils[_0x7aec('0x17')]();channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x23')]=utils[_0x7aec('0x24')](channels[_0x34ba8e[_0x7aec('0x8')]]['endtime'],channels[_0x34ba8e['uniqueid']][_0x7aec('0x25')]);channels[_0x34ba8e[_0x7aec('0x8')]]['billableseconds']=channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x26')]?utils[_0x7aec('0x24')](channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x22')],channels[_0x34ba8e[_0x7aec('0x8')]][_0x7aec('0x26')]):0x0;writeDB(channels[_0x34ba8e['uniqueid']]);}}catch(_0x13be7f){utils[_0x7aec('0x27')](_0x13be7f[_0x7aec('0x19')]);}};exports[_0x7aec('0x28')]=function(_0xbe29c1){try{if(!_[_0x7aec('0x1b')](channels[_0xbe29c1[_0x7aec('0x29')]])){if(channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x9')]==_0xbe29c1[_0x7aec('0x2a')]){channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x1f')]=_0xbe29c1['secondtransfererchannel'];channels[_0xbe29c1['localtwolinkedid']][_0x7aec('0x2b')]=_0x7aec('0x2c');}else if(channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x9')]=_0xbe29c1['transfertargetchannel']){channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x1f')]=_0xbe29c1[_0x7aec('0x2d')];channels[_0xbe29c1[_0x7aec('0x29')]][_0x7aec('0x2b')]=_0x7aec('0x2c');}}}catch(_0x358a5e){utils[_0x7aec('0x27')](_0x358a5e[_0x7aec('0x19')]);}};exports[_0x7aec('0x2e')]=function(_0x5b3c60){try{if(!_[_0x7aec('0x1b')](channels[_0x5b3c60[_0x7aec('0x8')]])){channels[_0x5b3c60[_0x7aec('0x8')]][_0x7aec('0x2f')]=utils[_0x7aec('0x17')]();}}catch(_0x190929){utils[_0x7aec('0x27')](_0x190929[_0x7aec('0x19')]);}};exports[_0x7aec('0x30')]=function(_0x1eb5e4){try{if(!_['isNil'](channels[_0x1eb5e4[_0x7aec('0x8')]])){if(!_[_0x7aec('0x1b')](channels[_0x1eb5e4['uniqueid']][_0x7aec('0x2f')])){channels[_0x1eb5e4[_0x7aec('0x8')]]['mohtime']+=utils[_0x7aec('0x24')](utils[_0x7aec('0x17')](),channels[_0x1eb5e4[_0x7aec('0x8')]][_0x7aec('0x2f')]);delete channels[_0x1eb5e4[_0x7aec('0x8')]]['musiconholdstartAt'];}}}catch(_0x5f3576){utils['error'](_0x5f3576[_0x7aec('0x19')]);}};exports[_0x7aec('0x31')]=function(_0x204afe){try{if(!_['isNil'](channels[_0x204afe['uniqueid']])){if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x33')])){channels[_0x204afe[_0x7aec('0x8')]]['source']=_0x204afe[_0x7aec('0x34')];}if(!_['isNil'](_0x204afe[_0x7aec('0x32')][_0x7aec('0x35')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0xd')]=_0x204afe[_0x7aec('0x34')];channels[_0x204afe['uniqueid']][_0x7aec('0xe')]='\x22'+_0x204afe[_0x7aec('0x34')]+'\x22\x20<'+_0x204afe[_0x7aec('0x34')]+'>';}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x36')])||!_['isNil'](_0x204afe[_0x7aec('0x32')][_0x7aec('0x37')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0xe')]=_0x204afe[_0x7aec('0x34')];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x38')])||!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x39')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x3a')]=_0x7aec('0x3b');channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x3c')]=_0x204afe[_0x7aec('0x34')];channels[_0x204afe['uniqueid']]['queue']=!![];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x3d')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x3e')]=_0x204afe[_0x7aec('0x34')];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x3f')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0xa')]=_0x204afe[_0x7aec('0x34')];}if(!_[_0x7aec('0x1b')](_0x204afe[_0x7aec('0x32')][_0x7aec('0x40')])){channels[_0x204afe['uniqueid']]['routeid']=_0x204afe[_0x7aec('0x34')];}if(!_['isNil'](_0x204afe[_0x7aec('0x32')][_0x7aec('0x41')])){channels[_0x204afe[_0x7aec('0x8')]][_0x7aec('0x41')]=_0x204afe[_0x7aec('0x34')];}}}catch(_0x3646bf){utils[_0x7aec('0x27')](_0x3646bf[_0x7aec('0x19')]);}};exports['newexten']=function(_0x1b06a0){try{if(!_[_0x7aec('0x1b')](channels[_0x1b06a0[_0x7aec('0x8')]])){if(_0x1b06a0['application'][_0x7aec('0x42')]()==_0x7aec('0x43')&&_[_0x7aec('0x44')](_0x1b06a0[_0x7aec('0x45')][_0x7aec('0x42')](),_0x7aec('0x46'))){var _0x4a69c3=_0x1b06a0[_0x7aec('0x45')][_0x7aec('0x47')]('=');var _0x5ed815=_0x4a69c3[0x0][_0x7aec('0x48')](_0x4a69c3[0x0]['lastIndexOf']('(')+0x1,_0x4a69c3[0x0][_0x7aec('0x49')](')'));var _0x246ef7=_0x4a69c3[0x1];channels[_0x1b06a0['uniqueid']][_0x5ed815]=_0x246ef7;}if(!_[_0x7aec('0x4a')](['hangup',_0x7aec('0x4b'),_0x7aec('0x4c'),_0x7aec('0x43'),_0x7aec('0x4d')],_0x1b06a0[_0x7aec('0x4e')][_0x7aec('0x42')]())){channels[_0x1b06a0[_0x7aec('0x8')]][_0x7aec('0x3a')]=_0x1b06a0['application'];channels[_0x1b06a0['uniqueid']][_0x7aec('0x3c')]=_0x1b06a0['appdata'];}}}catch(_0x45c743){utils['error'](_0x45c743[_0x7aec('0x19')]);}}; \ No newline at end of file +var _0x36ca=['newchannel','uniqueid','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','destinationchannel','answertime','hangup','calleridname','diffTime','endtime','starttime','stack','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','xmcs-queue','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','sipcallid','set','startsWith','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','execif','gotoif','application','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','channel','accountcode','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport'];(function(_0x568d35,_0x5fe4b8){var _0x3bcdd0=function(_0x390d09){while(--_0x390d09){_0x568d35['push'](_0x568d35['shift']());}};_0x3bcdd0(++_0x5fe4b8);}(_0x36ca,0x8a));var _0xa36c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x36ca[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa36c('0x0'));var util=require(_0xa36c('0x1'));var utils=require(_0xa36c('0x2'));var dispositions=[_0xa36c('0x3'),'FAILED','FAILED',_0xa36c('0x3'),_0xa36c('0x3'),_0xa36c('0x3'),_0xa36c('0x4'),_0xa36c('0x5'),'FAILED',_0xa36c('0x6'),_0xa36c('0x6')];var channels={};function writeDB(_0x382dda){utils[_0xa36c('0x7')](util['format']('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x382dda['uniqueid'],_0x382dda[_0xa36c('0x8')],_0x382dda['type'],_0x382dda[_0xa36c('0x9')],_0x382dda['source'],_0x382dda[_0xa36c('0xa')],_0x382dda[_0xa36c('0xb')],_0x382dda[_0xa36c('0xc')]));if(_0x382dda['accountcode']){utils[_0xa36c('0xd')](_0x382dda[_0xa36c('0x9')])[_0xa36c('0xe')](function(_0x63f64f){if(_0x63f64f){_0x382dda[_0xa36c('0xf')]=_0x63f64f['id'];}utils[_0xa36c('0x10')]('CreateVoiceCallReport',_0x382dda);});}else{utils['request'](_0xa36c('0x11'),_0x382dda);}if(channels[_0x382dda['uniqueid']]){delete channels[_0x382dda['uniqueid']];}}exports[_0xa36c('0x12')]=function(_0x268c9b){try{if(_0x268c9b[_0xa36c('0x13')]==_0x268c9b[_0xa36c('0x14')]&&_0x268c9b[_0xa36c('0x8')]!=_0xa36c('0x15')){channels[_0x268c9b['uniqueid']]={'uniqueid':_0x268c9b['uniqueid'],'accountcode':_0x268c9b['accountcode'],'source':_0x268c9b[_0xa36c('0x16')],'destination':_0x268c9b[_0xa36c('0x17')],'destinationcontext':_0x268c9b[_0xa36c('0x18')],'channel':_0x268c9b[_0xa36c('0x8')],'starttime':utils[_0xa36c('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xa36c('0x1a')};}}catch(_0x4b6bfa){utils[_0xa36c('0x1b')](_0x4b6bfa['stack']);}};exports[_0xa36c('0x1c')]=function(_0x2b4180){try{if(!_[_0xa36c('0x1d')](channels[_0x2b4180[_0xa36c('0x13')]])&&_0x2b4180[_0xa36c('0x1e')]==0x6){if(_[_0xa36c('0x1d')](channels[_0x2b4180['uniqueid']][_0xa36c('0x1f')])){channels[_0x2b4180[_0xa36c('0x13')]][_0xa36c('0x1f')]=utils['now']();}}else if(!_[_0xa36c('0x1d')](channels[_0x2b4180[_0xa36c('0x14')]])&&_0x2b4180['channelstate']==0x6&&_0x2b4180[_0xa36c('0x18')]!='transfer'){channels[_0x2b4180[_0xa36c('0x14')]][_0xa36c('0x9')]=_0x2b4180['accountcode'];channels[_0x2b4180['linkedid']][_0xa36c('0x20')]=_0x2b4180[_0xa36c('0x8')];if(_['isNil'](channels[_0x2b4180['linkedid']][_0xa36c('0x21')])){channels[_0x2b4180['linkedid']][_0xa36c('0x21')]=utils['now']();}channels[_0x2b4180[_0xa36c('0x14')]][_0xa36c('0xc')]=dispositions[_['toNumber'](_0x2b4180[_0xa36c('0x1e')])]||_0xa36c('0x4');}}catch(_0x1fb47c){utils[_0xa36c('0x1b')](_0x1fb47c['stack']);}};exports[_0xa36c('0x22')]=function(_0x4c6ae8){try{if(!_[_0xa36c('0x1d')](channels[_0x4c6ae8[_0xa36c('0x13')]])){if(_['isNil'](channels[_0x4c6ae8['uniqueid']][_0xa36c('0xb')])){channels[_0x4c6ae8[_0xa36c('0x13')]][_0xa36c('0xb')]=_0x4c6ae8[_0xa36c('0x23')]+'\x20<'+_0x4c6ae8[_0xa36c('0x16')]+'>';}channels[_0x4c6ae8[_0xa36c('0x13')]]['endtime']=utils[_0xa36c('0x19')]();channels[_0x4c6ae8[_0xa36c('0x13')]]['duration']=utils[_0xa36c('0x24')](channels[_0x4c6ae8['uniqueid']][_0xa36c('0x25')],channels[_0x4c6ae8[_0xa36c('0x13')]][_0xa36c('0x26')]);channels[_0x4c6ae8[_0xa36c('0x13')]]['billableseconds']=channels[_0x4c6ae8[_0xa36c('0x13')]][_0xa36c('0x21')]?utils['diffTime'](channels[_0x4c6ae8['uniqueid']][_0xa36c('0x25')],channels[_0x4c6ae8[_0xa36c('0x13')]]['answertime']):0x0;writeDB(channels[_0x4c6ae8['uniqueid']]);}}catch(_0x33aaeb){utils[_0xa36c('0x1b')](_0x33aaeb[_0xa36c('0x27')]);}};exports['attendedtransfer']=function(_0x4b8607){try{if(!_[_0xa36c('0x1d')](channels[_0x4b8607[_0xa36c('0x28')]])){if(channels[_0x4b8607['localtwolinkedid']][_0xa36c('0x8')]==_0x4b8607[_0xa36c('0x29')]){channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x20')]=_0x4b8607[_0xa36c('0x2a')];channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x2b')]='_attended';}else if(channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x8')]=_0x4b8607[_0xa36c('0x2c')]){channels[_0x4b8607['localtwolinkedid']][_0xa36c('0x20')]=_0x4b8607[_0xa36c('0x2d')];channels[_0x4b8607[_0xa36c('0x28')]][_0xa36c('0x2b')]=_0xa36c('0x2e');}}}catch(_0x7d7765){utils['error'](_0x7d7765[_0xa36c('0x27')]);}};exports[_0xa36c('0x2f')]=function(_0x24f55b){try{if(!_[_0xa36c('0x1d')](channels[_0x24f55b[_0xa36c('0x13')]])){channels[_0x24f55b[_0xa36c('0x13')]][_0xa36c('0x30')]=utils[_0xa36c('0x19')]();}}catch(_0x1dc4b5){utils[_0xa36c('0x1b')](_0x1dc4b5['stack']);}};exports[_0xa36c('0x31')]=function(_0x2cd600){try{if(!_[_0xa36c('0x1d')](channels[_0x2cd600[_0xa36c('0x13')]])){if(!_[_0xa36c('0x1d')](channels[_0x2cd600[_0xa36c('0x13')]]['musiconholdstartAt'])){channels[_0x2cd600[_0xa36c('0x13')]]['mohtime']+=utils[_0xa36c('0x24')](utils[_0xa36c('0x19')](),channels[_0x2cd600[_0xa36c('0x13')]][_0xa36c('0x30')]);delete channels[_0x2cd600[_0xa36c('0x13')]][_0xa36c('0x30')];}}}catch(_0xd21d1a){utils['error'](_0xd21d1a['stack']);}};exports['varset']=function(_0x4c4b6e){try{if(!_[_0xa36c('0x1d')](channels[_0x4c4b6e[_0xa36c('0x13')]])){if(!_['isNil'](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x33')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x34')]=_0x4c4b6e[_0xa36c('0x35')];}if(!_['isNil'](_0x4c4b6e['variable'][_0xa36c('0x36')])){channels[_0x4c4b6e['uniqueid']][_0xa36c('0xa')]=_0x4c4b6e[_0xa36c('0x35')];channels[_0x4c4b6e[_0xa36c('0x13')]]['callerid']='\x22'+_0x4c4b6e[_0xa36c('0x35')]+_0xa36c('0x37')+_0x4c4b6e['value']+'>';}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')]['xmd-callerid-preview'])||!_['isNil'](_0x4c4b6e[_0xa36c('0x32')]['xmd-callerid'])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0xb')]=_0x4c4b6e[_0xa36c('0x35')];}if(!_['isNil'](_0x4c4b6e['variable']['xmd-queue'])||!_['isNil'](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x38')])){channels[_0x4c4b6e['uniqueid']]['lastapplication']=_0xa36c('0x39');channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3a')]=_0x4c4b6e[_0xa36c('0x35')];channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3b')]=!![];}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x3c')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3d')]=_0x4c4b6e['value'];}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x3e')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x3f')]=_0x4c4b6e[_0xa36c('0x35')];}if(!_[_0xa36c('0x1d')](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x40')])){channels[_0x4c4b6e[_0xa36c('0x13')]]['routeid']=_0x4c4b6e[_0xa36c('0x35')];}if(!_['isNil'](_0x4c4b6e[_0xa36c('0x32')][_0xa36c('0x41')])){channels[_0x4c4b6e[_0xa36c('0x13')]][_0xa36c('0x41')]=_0x4c4b6e['value'];}}}catch(_0x2f8399){utils[_0xa36c('0x1b')](_0x2f8399['stack']);}};exports['newexten']=function(_0x3742e4){try{if(!_[_0xa36c('0x1d')](channels[_0x3742e4['uniqueid']])){if(_0x3742e4['application']['toLowerCase']()==_0xa36c('0x42')&&_[_0xa36c('0x43')](_0x3742e4['appdata'][_0xa36c('0x44')](),_0xa36c('0x45'))){var _0x2051eb=_0x3742e4[_0xa36c('0x46')][_0xa36c('0x47')]('=');var _0x16cbea=_0x2051eb[0x0][_0xa36c('0x48')](_0x2051eb[0x0][_0xa36c('0x49')]('(')+0x1,_0x2051eb[0x0][_0xa36c('0x49')](')'));var _0x8a3665=_0x2051eb[0x1];channels[_0x3742e4[_0xa36c('0x13')]][_0x16cbea]=_0x8a3665;}if(!_[_0xa36c('0x4a')]([_0xa36c('0x22'),'noop',_0xa36c('0x4b'),_0xa36c('0x42'),_0xa36c('0x4c')],_0x3742e4['application'][_0xa36c('0x44')]())){channels[_0x3742e4[_0xa36c('0x13')]]['lastapplication']=_0x3742e4[_0xa36c('0x4d')];channels[_0x3742e4[_0xa36c('0x13')]][_0xa36c('0x3a')]=_0x3742e4[_0xa36c('0x46')];}}}catch(_0x5e8b42){utils['error'](_0x5e8b42[_0xa36c('0x27')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2f42c98..53725c9 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 _0x7278=['FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED','SHUTDOWN','fullybooted'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0x7278,0x161));var _0x8727=function(_0x479692,_0x497af4){_0x479692=_0x479692-0x0;var _0x3f24f1=_0x7278[_0x479692];return _0x3f24f1;};'use strict';var utils=require(_0x8727('0x0'));var _=require(_0x8727('0x1'));exports[_0x8727('0x2')]=function(){utils[_0x8727('0x3')](_0x8727('0x4'));};exports['shutdown']=function(){utils[_0x8727('0x3')](_0x8727('0x5'));};exports[_0x8727('0x6')]=function(){utils[_0x8727('0x3')](_0x8727('0x7'));};exports[_0x8727('0x8')]=function(_0x180b71){utils['error'](_0x180b71);};exports[_0x8727('0x9')]=function(){utils[_0x8727('0x3')](_0x8727('0xa'));};exports[_0x8727('0xb')]=function(_0x4160c3){}; \ No newline at end of file +var _0x187d=['error','close','CLOSE','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','FULLYBOOTED'];(function(_0x506de3,_0x209251){var _0x2e254a=function(_0x1b096e){while(--_0x1b096e){_0x506de3['push'](_0x506de3['shift']());}};_0x2e254a(++_0x209251);}(_0x187d,0x93));var _0xd187=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x187d[_0xae7c2f];return _0x5d7001;};'use strict';var utils=require(_0xd187('0x0'));var _=require('lodash');exports[_0xd187('0x1')]=function(){utils[_0xd187('0x2')](_0xd187('0x3'));};exports[_0xd187('0x4')]=function(){utils[_0xd187('0x2')](_0xd187('0x5'));};exports['fullybooted']=function(){utils[_0xd187('0x2')](_0xd187('0x6'));};exports['error']=function(_0x1d2533){utils[_0xd187('0x7')](_0x1d2533);};exports[_0xd187('0x8')]=function(){utils[_0xd187('0x2')](_0xd187('0x9'));};exports[_0xd187('0xa')]=function(_0x358c45){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f1b7008..8cd0ec6 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 _0x6629=['CreateVoiceDialReport','newexten','application','toLowerCase','set','appdata','cdr(routeid)','error','stack','varset','variable','outboundrouteid','value','dialbegin','assign','starttime','lastevent','called','dialend','isNil','answertime','now','hangup','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstatus','request'];(function(_0x2b2ac8,_0x22f79a){var _0x5cd081=function(_0x31155d){while(--_0x31155d){_0x2b2ac8['push'](_0x2b2ac8['shift']());}};_0x5cd081(++_0x22f79a);}(_0x6629,0x1a9));var _0x9662=function(_0x315e3c,_0xb112ee){_0x315e3c=_0x315e3c-0x0;var _0x4ad165=_0x6629[_0x315e3c];return _0x4ad165;};'use strict';var _=require(_0x9662('0x0'));var util=require(_0x9662('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x11dfb5){utils['info'](util[_0x9662('0x2')](_0x9662('0x3'),_0x11dfb5[_0x9662('0x4')],_0x11dfb5['channel'],_0x11dfb5['dialstring'],_0x11dfb5['calleridnum'],_0x11dfb5['connectedlinenum'],_0x11dfb5[_0x9662('0x5')]));utils[_0x9662('0x6')](_0x9662('0x7'),_0x11dfb5);delete dials[_0x11dfb5[_0x9662('0x4')]];}exports[_0x9662('0x8')]=function(_0xbd5747){try{if(_0xbd5747[_0x9662('0x9')][_0x9662('0xa')]()==_0x9662('0xb')&&_['startsWith'](_0xbd5747[_0x9662('0xc')][_0x9662('0xa')](),_0x9662('0xd'))){var _0x552558=_0xbd5747[_0x9662('0xc')]['split']('=');dials[_0xbd5747[_0x9662('0x4')]]={'routeId':_0x552558[0x1]};}}catch(_0x495488){utils[_0x9662('0xe')](_0x495488[_0x9662('0xf')]);}};exports[_0x9662('0x10')]=function(_0x5da90d){try{if(!_['isNil'](_0x5da90d[_0x9662('0x11')][_0x9662('0x12')])){dials[_0x5da90d[_0x9662('0x4')]]={'routeId':_0x5da90d[_0x9662('0x13')]};}}catch(_0x2a8fc3){utils['error'](_0x2a8fc3[_0x9662('0xf')]);}};exports[_0x9662('0x14')]=function(_0x104071){try{if(!_['isNil'](dials[_0x104071[_0x9662('0x4')]])){dials[_0x104071[_0x9662('0x4')]]=_[_0x9662('0x15')](dials[_0x104071[_0x9662('0x4')]],_0x104071);dials[_0x104071['uniqueid']][_0x9662('0x16')]=utils['now']();dials[_0x104071[_0x9662('0x4')]][_0x9662('0x17')]=_0x9662('0x18');}}catch(_0x4ae800){utils['error'](_0x4ae800[_0x9662('0xf')]);}};exports[_0x9662('0x19')]=function(_0x2dd785){try{if(!_[_0x9662('0x1a')](dials[_0x2dd785['uniqueid']])){dials[_0x2dd785[_0x9662('0x4')]]['dialstatus']=_0x2dd785[_0x9662('0x5')];if(_0x2dd785[_0x9662('0x5')]=='ANSWER'){dials[_0x2dd785[_0x9662('0x4')]]=_[_0x9662('0x15')](dials[_0x2dd785['uniqueid']],_0x2dd785);dials[_0x2dd785[_0x9662('0x4')]][_0x9662('0x1b')]=utils[_0x9662('0x1c')]();dials[_0x2dd785[_0x9662('0x4')]][_0x9662('0x17')]='connect';}}}catch(_0x4000a8){utils[_0x9662('0xe')](_0x4000a8[_0x9662('0xf')]);}};exports[_0x9662('0x1d')]=function(_0x964f9d){try{if(!_['isNil'](dials[_0x964f9d[_0x9662('0x4')]])){dials[_0x964f9d[_0x9662('0x4')]]=_[_0x9662('0x15')](dials[_0x964f9d[_0x9662('0x4')]],{'endtime':utils[_0x9662('0x1c')](),'lastevent':_0x9662('0x1e')});dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1f')]=utils['diffTime'](dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x20')],dials[_0x964f9d['uniqueid']][_0x9662('0x16')]);dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x21')]=utils[_0x9662('0x22')](dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1b')]||dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x20')],dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x16')]);dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x23')]=dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1b')]?utils[_0x9662('0x22')](dials[_0x964f9d[_0x9662('0x4')]]['endtime'],dials[_0x964f9d[_0x9662('0x4')]][_0x9662('0x1b')]):0x0;writeDB(dials[_0x964f9d[_0x9662('0x4')]]);}}catch(_0x4b292b){utils[_0x9662('0xe')](_0x4b292b[_0x9662('0xf')]);}}; \ No newline at end of file +var _0x6eb7=['format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','stack','dialbegin','assign','starttime','now','lastevent','called','dialend','answertime','connect','hangup','complete','duration','diffTime','endtime','util','info'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6eb7,0x1d2));var _0x76eb=function(_0x36c15d,_0x567797){_0x36c15d=_0x36c15d-0x0;var _0x4f9882=_0x6eb7[_0x36c15d];return _0x4f9882;};'use strict';var _=require('lodash');var util=require(_0x76eb('0x0'));var utils=require('./utils');var dials={};function writeDB(_0xd3fbcd){utils[_0x76eb('0x1')](util[_0x76eb('0x2')](_0x76eb('0x3'),_0xd3fbcd[_0x76eb('0x4')],_0xd3fbcd[_0x76eb('0x5')],_0xd3fbcd[_0x76eb('0x6')],_0xd3fbcd[_0x76eb('0x7')],_0xd3fbcd[_0x76eb('0x8')],_0xd3fbcd[_0x76eb('0x9')]));utils[_0x76eb('0xa')]('CreateVoiceDialReport',_0xd3fbcd);delete dials[_0xd3fbcd[_0x76eb('0x4')]];}exports[_0x76eb('0xb')]=function(_0x488f6){try{if(_0x488f6[_0x76eb('0xc')][_0x76eb('0xd')]()==_0x76eb('0xe')&&_[_0x76eb('0xf')](_0x488f6[_0x76eb('0x10')][_0x76eb('0xd')](),_0x76eb('0x11'))){var _0x285a36=_0x488f6[_0x76eb('0x10')][_0x76eb('0x12')]('=');dials[_0x488f6['uniqueid']]={'routeId':_0x285a36[0x1]};}}catch(_0x1e5b9f){utils[_0x76eb('0x13')](_0x1e5b9f['stack']);}};exports[_0x76eb('0x14')]=function(_0x350644){try{if(!_[_0x76eb('0x15')](_0x350644[_0x76eb('0x16')][_0x76eb('0x17')])){dials[_0x350644[_0x76eb('0x4')]]={'routeId':_0x350644['value']};}}catch(_0x5a435d){utils[_0x76eb('0x13')](_0x5a435d[_0x76eb('0x18')]);}};exports[_0x76eb('0x19')]=function(_0x2671b5){try{if(!_[_0x76eb('0x15')](dials[_0x2671b5[_0x76eb('0x4')]])){dials[_0x2671b5[_0x76eb('0x4')]]=_[_0x76eb('0x1a')](dials[_0x2671b5[_0x76eb('0x4')]],_0x2671b5);dials[_0x2671b5['uniqueid']][_0x76eb('0x1b')]=utils[_0x76eb('0x1c')]();dials[_0x2671b5[_0x76eb('0x4')]][_0x76eb('0x1d')]=_0x76eb('0x1e');}}catch(_0x164e07){utils[_0x76eb('0x13')](_0x164e07[_0x76eb('0x18')]);}};exports[_0x76eb('0x1f')]=function(_0x3ed9b5){try{if(!_[_0x76eb('0x15')](dials[_0x3ed9b5['uniqueid']])){dials[_0x3ed9b5['uniqueid']][_0x76eb('0x9')]=_0x3ed9b5[_0x76eb('0x9')];if(_0x3ed9b5[_0x76eb('0x9')]=='ANSWER'){dials[_0x3ed9b5[_0x76eb('0x4')]]=_['assign'](dials[_0x3ed9b5[_0x76eb('0x4')]],_0x3ed9b5);dials[_0x3ed9b5[_0x76eb('0x4')]][_0x76eb('0x20')]=utils[_0x76eb('0x1c')]();dials[_0x3ed9b5[_0x76eb('0x4')]][_0x76eb('0x1d')]=_0x76eb('0x21');}}}catch(_0x2ba457){utils[_0x76eb('0x13')](_0x2ba457[_0x76eb('0x18')]);}};exports[_0x76eb('0x22')]=function(_0x3d5f9e){try{if(!_['isNil'](dials[_0x3d5f9e[_0x76eb('0x4')]])){dials[_0x3d5f9e[_0x76eb('0x4')]]=_['assign'](dials[_0x3d5f9e[_0x76eb('0x4')]],{'endtime':utils['now'](),'lastevent':_0x76eb('0x23')});dials[_0x3d5f9e['uniqueid']][_0x76eb('0x24')]=utils[_0x76eb('0x25')](dials[_0x3d5f9e[_0x76eb('0x4')]]['endtime'],dials[_0x3d5f9e[_0x76eb('0x4')]][_0x76eb('0x1b')]);dials[_0x3d5f9e[_0x76eb('0x4')]]['holdtime']=utils[_0x76eb('0x25')](dials[_0x3d5f9e['uniqueid']][_0x76eb('0x20')]||dials[_0x3d5f9e['uniqueid']]['endtime'],dials[_0x3d5f9e[_0x76eb('0x4')]][_0x76eb('0x1b')]);dials[_0x3d5f9e[_0x76eb('0x4')]]['billableseconds']=dials[_0x3d5f9e[_0x76eb('0x4')]]['answertime']?utils[_0x76eb('0x25')](dials[_0x3d5f9e[_0x76eb('0x4')]][_0x76eb('0x26')],dials[_0x3d5f9e['uniqueid']][_0x76eb('0x20')]):0x0;writeDB(dials[_0x3d5f9e[_0x76eb('0x4')]]);}}catch(_0x25432e){utils[_0x76eb('0x13')](_0x25432e[_0x76eb('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index fe9861c..4806669 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 _0x29aa=['newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x29aa,0x18f));var _0xa29a=function(_0x2d879d,_0x40805c){_0x2d879d=_0x2d879d-0x0;var _0x172210=_0x29aa[_0x2d879d];return _0x172210;};var AsteriskManager=require(_0xa29a('0x0'));var config=require(_0xa29a('0x1'));var utils=require(_0xa29a('0x2'));var ami=new AsteriskManager(config[_0xa29a('0x3')][_0xa29a('0x4')],config['asterisk']['ip'],config[_0xa29a('0x3')][_0xa29a('0x5')],config[_0xa29a('0x3')][_0xa29a('0x6')],!![]);ami['keepConnected']();if(config[_0xa29a('0x7')]&&config['xdr']['disabled']){utils[_0xa29a('0x8')](_0xa29a('0x9'));}else{var agents=require(_0xa29a('0xa'));var calls=require('./calls.controller');var queues=require(_0xa29a('0xb'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xa29a('0xc'));var transfers=require('./transfers.controller');var core=require(_0xa29a('0xd'));ami['on'](_0xa29a('0xe'),core[_0xa29a('0xe')]);ami['on'](_0xa29a('0xf'),core[_0xa29a('0xf')]);ami['on'](_0xa29a('0x10'),core[_0xa29a('0x10')]);ami['on'](_0xa29a('0x11'),core['error']);ami['on'](_0xa29a('0x12'),core[_0xa29a('0x12')]);ami['on'](_0xa29a('0x13'),core[_0xa29a('0x13')]);ami['on'](_0xa29a('0x14'),function(_0x59d6f3){try{members[_0xa29a('0x14')](_0x59d6f3);}catch(_0x1ead66){utils[_0xa29a('0x11')](_0x1ead66);}});ami['on']('agentcalled',function(_0x4819c1){try{agents[_0xa29a('0x15')](_0x4819c1);}catch(_0x4e88b9){utils[_0xa29a('0x11')](_0x4e88b9);}});ami['on'](_0xa29a('0x16'),function(_0x15fc60){try{agents[_0xa29a('0x16')](_0x15fc60);}catch(_0x403c14){utils[_0xa29a('0x11')](_0x403c14);}});ami['on'](_0xa29a('0x17'),function(_0xa48e6c){try{agents[_0xa29a('0x17')](_0xa48e6c);queues[_0xa29a('0x17')](_0xa48e6c);}catch(_0x5be78c){utils[_0xa29a('0x11')](_0x5be78c);}});ami['on'](_0xa29a('0x18'),function(_0x4d390b){try{agents[_0xa29a('0x18')](_0x4d390b);queues[_0xa29a('0x18')](_0x4d390b);members['agentcomplete'](_0x4d390b);}catch(_0x12f689){utils[_0xa29a('0x11')](_0x12f689);}});ami['on'](_0xa29a('0x19'),function(_0x2c50e6){try{agents['queuecallerabandon'](_0x2c50e6);queues[_0xa29a('0x19')](_0x2c50e6);}catch(_0x323846){utils['error'](_0x323846);}});ami['on']('queuecallerjoin',function(_0x3a70f9){try{queues[_0xa29a('0x1a')](_0x3a70f9);recordings[_0xa29a('0x1a')](_0x3a70f9);}catch(_0x1f2bf5){utils['error'](_0x1f2bf5);}});ami['on'](_0xa29a('0x1b'),function(_0x188cca){try{queues[_0xa29a('0x1b')](_0x188cca);}catch(_0x32c4ec){utils[_0xa29a('0x11')](_0x32c4ec);}});ami['on']('musiconholdstart',function(_0xea6ddb){try{queues[_0xa29a('0x1c')](_0xea6ddb);calls[_0xa29a('0x1c')](_0xea6ddb);}catch(_0x1d066b){utils[_0xa29a('0x11')](_0x1d066b);}});ami['on'](_0xa29a('0x1d'),function(_0x42e441){try{queues[_0xa29a('0x1d')](_0x42e441);calls[_0xa29a('0x1d')](_0x42e441);}catch(_0x5b42c9){utils[_0xa29a('0x11')](_0x5b42c9);}});ami['on'](_0xa29a('0x1e'),function(_0x58a48c){try{calls[_0xa29a('0x1e')](_0x58a48c);recordings['newstate'](_0x58a48c);}catch(_0x523b45){utils['error'](_0x523b45);}});ami['on']('hangup',function(_0x55501f){try{calls[_0xa29a('0x1f')](_0x55501f);recordings['hangup'](_0x55501f);dials[_0xa29a('0x1f')](_0x55501f);agents[_0xa29a('0x1f')](_0x55501f);queues[_0xa29a('0x1f')](_0x55501f);}catch(_0xa6f05e){utils['error'](_0xa6f05e);}});ami['on'](_0xa29a('0x20'),function(_0x461877){try{members[_0xa29a('0x20')](_0x461877);}catch(_0x19aafb){utils[_0xa29a('0x11')](_0x19aafb);}});ami['on'](_0xa29a('0x21'),function(_0x20056c){try{queues['blindtransfer'](_0x20056c);agents[_0xa29a('0x21')](_0x20056c);transfers['blindtransfer'](_0x20056c);}catch(_0x15fb9a){utils[_0xa29a('0x11')](_0x15fb9a);}});ami['on'](_0xa29a('0x22'),function(_0x212fb0){try{queues[_0xa29a('0x22')](_0x212fb0);transfers[_0xa29a('0x22')](_0x212fb0);agents[_0xa29a('0x22')](_0x212fb0);calls[_0xa29a('0x22')](_0x212fb0);}catch(_0x31e79d){utils[_0xa29a('0x11')](_0x31e79d);}});ami['on'](_0xa29a('0x23'),function(_0x43219f){try{queues[_0xa29a('0x23')](_0x43219f);recordings[_0xa29a('0x23')](_0x43219f);calls[_0xa29a('0x23')](_0x43219f);dials[_0xa29a('0x23')](_0x43219f);}catch(_0x33d3b9){utils[_0xa29a('0x11')](_0x33d3b9);}});ami['on'](_0xa29a('0x24'),function(_0x5ded47){try{calls['newexten'](_0x5ded47);recordings[_0xa29a('0x24')](_0x5ded47);dials[_0xa29a('0x24')](_0x5ded47);}catch(_0x202f5f){utils[_0xa29a('0x11')](_0x202f5f);}});ami['on'](_0xa29a('0x25'),function(_0x3efccd){try{calls[_0xa29a('0x25')](_0x3efccd);recordings[_0xa29a('0x25')](_0x3efccd);}catch(_0x2fccd3){utils[_0xa29a('0x11')](_0x2fccd3);}});ami['on'](_0xa29a('0x26'),function(_0x1c52c2){try{dials[_0xa29a('0x26')](_0x1c52c2);}catch(_0x4c34af){utils['error'](_0x4c34af);}});ami['on']('dialend',function(_0x1c4c5c){try{dials['dialend'](_0x1c4c5c);}catch(_0x1f030b){utils[_0xa29a('0x11')](_0x1f030b);}});} \ No newline at end of file +var _0xa048=['username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','asterisk','port'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa048,0x19f));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};var AsteriskManager=require(_0x8a04('0x0'));var config=require('../../config/environment');var utils=require('./utils');var ami=new AsteriskManager(config[_0x8a04('0x1')][_0x8a04('0x2')],config[_0x8a04('0x1')]['ip'],config[_0x8a04('0x1')][_0x8a04('0x3')],config[_0x8a04('0x1')][_0x8a04('0x4')],!![]);ami['keepConnected']();if(config[_0x8a04('0x5')]&&config[_0x8a04('0x5')]['disabled']){utils[_0x8a04('0x6')](_0x8a04('0x7'));}else{var agents=require(_0x8a04('0x8'));var calls=require(_0x8a04('0x9'));var queues=require('./queues.controller');var recordings=require(_0x8a04('0xa'));var members=require(_0x8a04('0xb'));var dials=require('./dials.controller');var transfers=require(_0x8a04('0xc'));var core=require(_0x8a04('0xd'));ami['on'](_0x8a04('0xe'),core[_0x8a04('0xe')]);ami['on'](_0x8a04('0xf'),core[_0x8a04('0xf')]);ami['on'](_0x8a04('0x10'),core[_0x8a04('0x10')]);ami['on'](_0x8a04('0x11'),core['error']);ami['on'](_0x8a04('0x12'),core[_0x8a04('0x12')]);ami['on'](_0x8a04('0x13'),core[_0x8a04('0x13')]);ami['on'](_0x8a04('0x14'),function(_0x5d9bfe){try{members[_0x8a04('0x14')](_0x5d9bfe);}catch(_0x469c5a){utils[_0x8a04('0x11')](_0x469c5a);}});ami['on'](_0x8a04('0x15'),function(_0x5c683){try{agents['agentcalled'](_0x5c683);}catch(_0x393207){utils['error'](_0x393207);}});ami['on'](_0x8a04('0x16'),function(_0x1401f6){try{agents['agentringnoanswer'](_0x1401f6);}catch(_0x6a1054){utils[_0x8a04('0x11')](_0x6a1054);}});ami['on'](_0x8a04('0x17'),function(_0x11a5be){try{agents['agentconnect'](_0x11a5be);queues[_0x8a04('0x17')](_0x11a5be);}catch(_0x391768){utils[_0x8a04('0x11')](_0x391768);}});ami['on']('agentcomplete',function(_0x24c6d0){try{agents[_0x8a04('0x18')](_0x24c6d0);queues[_0x8a04('0x18')](_0x24c6d0);members[_0x8a04('0x18')](_0x24c6d0);}catch(_0x3322fc){utils[_0x8a04('0x11')](_0x3322fc);}});ami['on'](_0x8a04('0x19'),function(_0x2acabd){try{agents[_0x8a04('0x19')](_0x2acabd);queues[_0x8a04('0x19')](_0x2acabd);}catch(_0x1c4cde){utils['error'](_0x1c4cde);}});ami['on'](_0x8a04('0x1a'),function(_0x56b516){try{queues['queuecallerjoin'](_0x56b516);recordings[_0x8a04('0x1a')](_0x56b516);}catch(_0x294b4a){utils[_0x8a04('0x11')](_0x294b4a);}});ami['on']('queuecallerleave',function(_0x21d984){try{queues['queuecallerleave'](_0x21d984);}catch(_0xd4ed7){utils['error'](_0xd4ed7);}});ami['on']('musiconholdstart',function(_0x1f535d){try{queues[_0x8a04('0x1b')](_0x1f535d);calls[_0x8a04('0x1b')](_0x1f535d);}catch(_0x3577b2){utils[_0x8a04('0x11')](_0x3577b2);}});ami['on'](_0x8a04('0x1c'),function(_0x4f0c9c){try{queues[_0x8a04('0x1c')](_0x4f0c9c);calls[_0x8a04('0x1c')](_0x4f0c9c);}catch(_0x5d2970){utils['error'](_0x5d2970);}});ami['on'](_0x8a04('0x1d'),function(_0x27cefd){try{calls[_0x8a04('0x1d')](_0x27cefd);recordings[_0x8a04('0x1d')](_0x27cefd);}catch(_0x4b851d){utils['error'](_0x4b851d);}});ami['on'](_0x8a04('0x1e'),function(_0x43f57f){try{calls[_0x8a04('0x1e')](_0x43f57f);recordings[_0x8a04('0x1e')](_0x43f57f);dials[_0x8a04('0x1e')](_0x43f57f);agents[_0x8a04('0x1e')](_0x43f57f);queues[_0x8a04('0x1e')](_0x43f57f);}catch(_0x1a8c3c){utils['error'](_0x1a8c3c);}});ami['on']('cdr',function(_0x5e0947){try{members[_0x8a04('0x1f')](_0x5e0947);}catch(_0x4e6c66){utils[_0x8a04('0x11')](_0x4e6c66);}});ami['on'](_0x8a04('0x20'),function(_0x59ce11){try{queues['blindtransfer'](_0x59ce11);agents['blindtransfer'](_0x59ce11);transfers['blindtransfer'](_0x59ce11);}catch(_0x343253){utils[_0x8a04('0x11')](_0x343253);}});ami['on']('attendedtransfer',function(_0x4c0f04){try{queues[_0x8a04('0x21')](_0x4c0f04);transfers[_0x8a04('0x21')](_0x4c0f04);agents[_0x8a04('0x21')](_0x4c0f04);calls[_0x8a04('0x21')](_0x4c0f04);}catch(_0x2d211c){utils['error'](_0x2d211c);}});ami['on']('varset',function(_0x202151){try{queues[_0x8a04('0x22')](_0x202151);recordings['varset'](_0x202151);calls['varset'](_0x202151);dials[_0x8a04('0x22')](_0x202151);}catch(_0x419a9d){utils[_0x8a04('0x11')](_0x419a9d);}});ami['on'](_0x8a04('0x23'),function(_0x7af917){try{calls[_0x8a04('0x23')](_0x7af917);recordings[_0x8a04('0x23')](_0x7af917);dials['newexten'](_0x7af917);}catch(_0x523623){utils[_0x8a04('0x11')](_0x523623);}});ami['on'](_0x8a04('0x24'),function(_0x5510cc){try{calls[_0x8a04('0x24')](_0x5510cc);recordings['newchannel'](_0x5510cc);}catch(_0x9fabbc){utils[_0x8a04('0x11')](_0x9fabbc);}});ami['on'](_0x8a04('0x25'),function(_0x947404){try{dials[_0x8a04('0x25')](_0x947404);}catch(_0x427828){utils[_0x8a04('0x11')](_0x427828);}});ami['on']('dialend',function(_0x3ab128){try{dials['dialend'](_0x3ab128);}catch(_0x4091ed){utils[_0x8a04('0x11')](_0x4091ed);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 229cbdf..34a273a 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 _0x6252=['getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','some','startsWith','devicestatechange','state','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','assign','queue','uniqueid','cdr','data1','data2','data3','destination','destinationchannel','type','source','util','./utils','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','membername'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x6252,0xac));var _0x2625=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x6252[_0x45f951];return _0x24756c;};'use strict';var _=require('lodash');var util=require(_0x2625('0x0'));var utils=require(_0x2625('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x2625('0x2')];function writeDB(_0x4a12a6){utils['info'](util[_0x2625('0x3')](_0x2625('0x4'),_0x4a12a6['uniqueid'],_0x4a12a6[_0x2625('0x5')],_0x4a12a6[_0x2625('0x6')],_0x4a12a6['data2'],_0x4a12a6[_0x2625('0x7')],_0x4a12a6['type']));if(_0x4a12a6['interface']){utils[_0x2625('0x8')](_0x4a12a6['interface'])[_0x2625('0x9')](function(_0x4c57a0){if(_0x4c57a0){_0x4a12a6[_0x2625('0x7')]=_0x4c57a0[_0x2625('0xa')];_0x4a12a6['internal']=_0x4c57a0[_0x2625('0xb')];utils[_0x2625('0xc')](_0x2625('0xd'),_0x4a12a6);}else{utils['getUserByName'](_0x4a12a6[_0x2625('0x5')][_0x2625('0xe')]('/')[0x1])[_0x2625('0x9')](function(_0x5c6c8e){if(_0x5c6c8e){_0x4a12a6[_0x2625('0x7')]=_0x5c6c8e['name'];_0x4a12a6[_0x2625('0xb')]=_0x5c6c8e[_0x2625('0xb')];utils[_0x2625('0xc')](_0x2625('0xd'),_0x4a12a6);}});}})[_0x2625('0xf')](function(_0x555a82){utils[_0x2625('0x10')](_0x555a82);});}delete members[_0x4a12a6['interface']];}function startsWith(_0x3c5a0b,_0x176dc7){return _[_0x2625('0x11')](_0x3c5a0b,function(_0x4f8afb){return _[_0x2625('0x12')](_0x176dc7,_0x4f8afb);});}exports[_0x2625('0x13')]=function(_0x21fb32){switch(_0x21fb32[_0x2625('0x14')]){case'INUSE':case _0x2625('0x15'):if(!startsWith(exclude,_0x21fb32[_0x2625('0x16')])){members[_0x21fb32[_0x2625('0x16')]]={'channel':_0x2625('0x17'),'interface':_0x21fb32[_0x2625('0x16')],'type':_0x2625('0x18'),'enterAt':utils[_0x2625('0x19')](),'role':_0x2625('0x1a')};}break;case _0x2625('0x1b'):if(!_['isNil'](members[_0x21fb32[_0x2625('0x16')]])){members[_0x21fb32[_0x2625('0x16')]][_0x2625('0x1c')]=utils[_0x2625('0x19')]();members[_0x21fb32[_0x2625('0x16')]][_0x2625('0x1d')]=utils[_0x2625('0x1e')](members[_0x21fb32['device']]['exitAt'],members[_0x21fb32[_0x2625('0x16')]][_0x2625('0x1f')]);if(members[_0x21fb32[_0x2625('0x16')]]['uniqueid']){writeDB(members[_0x21fb32['device']]);}}default:break;}};exports[_0x2625('0x20')]=function(_0x47966d){if(!_[_0x2625('0x21')](members[_0x47966d[_0x2625('0x5')]])){members[_0x47966d[_0x2625('0x5')]]=_[_0x2625('0x22')](members[_0x47966d['interface']],{'data4':_0x47966d[_0x2625('0x23')],'uniqueid':_0x47966d[_0x2625('0x24')]});}};exports[_0x2625('0x25')]=function(_0x30ec04){if(_0x30ec04[_0x2625('0x6')]){var _0x15330e=_0x30ec04['channel'][_0x2625('0xe')]('-')[0x0];if(!_[_0x2625('0x21')](members[_0x15330e])){members[_0x15330e]=_[_0x2625('0x22')](members[_0x15330e],{'data1':members[_0x15330e][_0x2625('0x26')]||_0x30ec04['type'],'data2':members[_0x15330e][_0x2625('0x27')]||_0x30ec04['source'],'data3':members[_0x15330e][_0x2625('0x28')]||_0x30ec04[_0x2625('0x29')],'uniqueid':members[_0x15330e][_0x2625('0x24')]||_0x30ec04[_0x2625('0x24')]});if(members[_0x15330e][_0x2625('0x1c')]){writeDB(members[_0x15330e]);}}}if(_0x30ec04[_0x2625('0x2a')]){var _0x5aa174=_0x30ec04[_0x2625('0x2a')][_0x2625('0xe')]('-')[0x0];if(!_[_0x2625('0x21')](members[_0x5aa174])){members[_0x5aa174]=_[_0x2625('0x22')](members[_0x5aa174],{'data1':members[_0x5aa174][_0x2625('0x26')]||_0x30ec04[_0x2625('0x2b')],'data2':members[_0x5aa174][_0x2625('0x27')]||_0x30ec04[_0x2625('0x2c')],'data3':members[_0x5aa174][_0x2625('0x28')]||_0x30ec04['destination'],'uniqueid':members[_0x5aa174][_0x2625('0x24')]||_0x30ec04[_0x2625('0x24')]});if(members[_0x5aa174][_0x2625('0x1c')]){writeDB(members[_0x5aa174]);}}}}; \ No newline at end of file +var _0x5b01=['data1','data2','data3','destinationchannel','type','source','destination','lodash','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','membername','getUserByInterface','then','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','state','INUSE','BUSY','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','assign','queue'];(function(_0x2158a6,_0x11993c){var _0x4da6ed=function(_0xadf211){while(--_0xadf211){_0x2158a6['push'](_0x2158a6['shift']());}};_0x4da6ed(++_0x11993c);}(_0x5b01,0x1ab));var _0x15b0=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5b01[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x15b0('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x15b0('0x1'),_0x15b0('0x2')];function writeDB(_0x1522ae){utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x5'),_0x1522ae[_0x15b0('0x6')],_0x1522ae[_0x15b0('0x7')],_0x1522ae[_0x15b0('0x8')],_0x1522ae['data2'],_0x1522ae[_0x15b0('0x9')],_0x1522ae['type']));if(_0x1522ae[_0x15b0('0x7')]){utils[_0x15b0('0xa')](_0x1522ae[_0x15b0('0x7')])[_0x15b0('0xb')](function(_0x524ab2){if(_0x524ab2){_0x1522ae[_0x15b0('0x9')]=_0x524ab2['name'];_0x1522ae[_0x15b0('0xc')]=_0x524ab2['internal'];utils[_0x15b0('0xd')]('CreateMemberReport',_0x1522ae);}else{utils[_0x15b0('0xe')](_0x1522ae[_0x15b0('0x7')][_0x15b0('0xf')]('/')[0x1])[_0x15b0('0xb')](function(_0x244b59){if(_0x244b59){_0x1522ae[_0x15b0('0x9')]=_0x244b59['name'];_0x1522ae[_0x15b0('0xc')]=_0x244b59[_0x15b0('0xc')];utils[_0x15b0('0xd')](_0x15b0('0x10'),_0x1522ae);}});}})[_0x15b0('0x11')](function(_0x1cc47d){utils[_0x15b0('0x12')](_0x1cc47d);});}delete members[_0x1522ae[_0x15b0('0x7')]];}function startsWith(_0x2ff9eb,_0x190d48){return _[_0x15b0('0x13')](_0x2ff9eb,function(_0x54044c){return _[_0x15b0('0x14')](_0x190d48,_0x54044c);});}exports['devicestatechange']=function(_0x34a91f){switch(_0x34a91f[_0x15b0('0x15')]){case _0x15b0('0x16'):case _0x15b0('0x17'):if(!startsWith(exclude,_0x34a91f[_0x15b0('0x18')])){members[_0x34a91f['device']]={'channel':'voice','interface':_0x34a91f[_0x15b0('0x18')],'type':_0x15b0('0x19'),'enterAt':utils[_0x15b0('0x1a')](),'role':_0x15b0('0x1b')};}break;case _0x15b0('0x1c'):if(!_[_0x15b0('0x1d')](members[_0x34a91f['device']])){members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x1e')]=utils[_0x15b0('0x1a')]();members[_0x34a91f['device']][_0x15b0('0x1f')]=utils['diffTime'](members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x1e')],members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x20')]);if(members[_0x34a91f[_0x15b0('0x18')]][_0x15b0('0x6')]){writeDB(members[_0x34a91f['device']]);}}default:break;}};exports['agentcomplete']=function(_0x2c5fe2){if(!_[_0x15b0('0x1d')](members[_0x2c5fe2[_0x15b0('0x7')]])){members[_0x2c5fe2[_0x15b0('0x7')]]=_[_0x15b0('0x21')](members[_0x2c5fe2[_0x15b0('0x7')]],{'data4':_0x2c5fe2[_0x15b0('0x22')],'uniqueid':_0x2c5fe2[_0x15b0('0x6')]});}};exports['cdr']=function(_0x411477){if(_0x411477[_0x15b0('0x8')]){var _0x4a296f=_0x411477[_0x15b0('0x8')][_0x15b0('0xf')]('-')[0x0];if(!_[_0x15b0('0x1d')](members[_0x4a296f])){members[_0x4a296f]=_[_0x15b0('0x21')](members[_0x4a296f],{'data1':members[_0x4a296f][_0x15b0('0x23')]||_0x411477['type'],'data2':members[_0x4a296f][_0x15b0('0x24')]||_0x411477['source'],'data3':members[_0x4a296f][_0x15b0('0x25')]||_0x411477['destination'],'uniqueid':members[_0x4a296f][_0x15b0('0x6')]||_0x411477[_0x15b0('0x6')]});if(members[_0x4a296f]['exitAt']){writeDB(members[_0x4a296f]);}}}if(_0x411477[_0x15b0('0x26')]){var _0x37a62d=_0x411477[_0x15b0('0x26')][_0x15b0('0xf')]('-')[0x0];if(!_['isNil'](members[_0x37a62d])){members[_0x37a62d]=_[_0x15b0('0x21')](members[_0x37a62d],{'data1':members[_0x37a62d][_0x15b0('0x23')]||_0x411477[_0x15b0('0x27')],'data2':members[_0x37a62d]['data2']||_0x411477[_0x15b0('0x28')],'data3':members[_0x37a62d][_0x15b0('0x25')]||_0x411477[_0x15b0('0x29')],'uniqueid':members[_0x37a62d][_0x15b0('0x6')]||_0x411477['uniqueid']});if(members[_0x37a62d][_0x15b0('0x1e')]){writeDB(members[_0x37a62d]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 065d196..aec93ce 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 _0x169b=['info','format','uniqueid','channel','calleridnum','queuecallerexitreason','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','variable','toUpperCase','value','queueposition','queuecallerabandonAt','queuecallerexitAt','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo','agentcomplete','membername','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','util','./utils'];(function(_0x4d3313,_0x56b507){var _0x4a7a5e=function(_0x45583a){while(--_0x45583a){_0x4d3313['push'](_0x4d3313['shift']());}};_0x4a7a5e(++_0x56b507);}(_0x169b,0xe4));var _0xb169=function(_0x5a80f5,_0x1cbe44){_0x5a80f5=_0x5a80f5-0x0;var _0x3acf33=_0x169b[_0x5a80f5];return _0x3acf33;};'use strict';var _=require(_0xb169('0x0'));var util=require(_0xb169('0x1'));var utils=require(_0xb169('0x2'));var queues={};function writeDB(_0x471113){utils[_0xb169('0x3')](util[_0xb169('0x4')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x471113[_0xb169('0x5')],_0x471113[_0xb169('0x6')],_0x471113['queue'],_0x471113['lastAssignedTo'],_0x471113[_0xb169('0x7')],_0x471113['accountcode'],_0x471113[_0xb169('0x8')]));if(_0x471113['queue']){utils['getVoiceQueueByName'](_0x471113[_0xb169('0x9')])['then'](function(_0x38a6c9){if(_0x38a6c9){_0x471113[_0xb169('0xa')]=_0x38a6c9['type'];}utils[_0xb169('0xb')](_0xb169('0xc'),_0x471113);});}else{utils[_0xb169('0xb')](_0xb169('0xc'),_0x471113);}if(_0x471113['transfereduniqueid']){delete queues[_0x471113[_0xb169('0xd')]];}else{delete queues[_0x471113[_0xb169('0x5')]];}}exports[_0xb169('0xe')]=function(_0x13611f){queues[_0x13611f[_0xb169('0x5')]]=_[_0xb169('0xf')](_0x13611f,{'originalposition':_0x13611f[_0xb169('0x10')],'queuecallerjoinAt':utils[_0xb169('0x11')](),'mohtime':0x0});};exports[_0xb169('0x12')]=function(_0x2f0c53){if(!_[_0xb169('0x13')](queues[_0x2f0c53[_0xb169('0x5')]])){if(queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x14')]){if(!queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x15')]&&!queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x16')]){queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x17')]=!![];queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x18')]=utils[_0xb169('0x11')]();queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0x8')]=_0xb169('0x19');}writeDB(queues[_0x2f0c53[_0xb169('0x5')]]);}else{if(queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0xd')]){queues[queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0xd')]]=queues[_0x2f0c53[_0xb169('0x5')]];queues[queues[_0x2f0c53[_0xb169('0x5')]][_0xb169('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x2f0c53['uniqueid']];}}}};exports['varset']=function(_0x5930a1){if(!_[_0xb169('0x13')](_0x5930a1[_0xb169('0x1a')]['queuestatus'])&&_0x5930a1['value'][_0xb169('0x1b')]()!=='CONTINUE'){if(!_[_0xb169('0x13')](queues[_0x5930a1[_0xb169('0x5')]])){queues[_0x5930a1['uniqueid']]['queuecallerabandon']=![];queues[_0x5930a1['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x16')]=!![];queues[_0x5930a1['uniqueid']]['queuecallerexitAt']=utils[_0xb169('0x11')]();queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x8')]=_0x5930a1[_0xb169('0x1c')][_0xb169('0x1b')]();writeDB(queues[_0x5930a1[_0xb169('0x5')]]);}}else if(!_[_0xb169('0x13')](_0x5930a1[_0xb169('0x1a')][_0xb169('0x1d')])){if(!_['isNil'](queues[_0x5930a1['uniqueid']])&&!queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x15')]){queues[_0x5930a1['uniqueid']][_0xb169('0x15')]=![];queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x1e')]=null;queues[_0x5930a1['uniqueid']][_0xb169('0x16')]=!![];queues[_0x5930a1[_0xb169('0x5')]][_0xb169('0x1f')]=utils['now']();queues[_0x5930a1['uniqueid']][_0xb169('0x8')]='EXITWITHKEY';}}};exports[_0xb169('0x15')]=function(_0x220f6d){if(!_[_0xb169('0x13')](queues[_0x220f6d[_0xb169('0x5')]])){queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x16')]=![];queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x1f')]=null;queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x15')]=!![];queues[_0x220f6d[_0xb169('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x220f6d[_0xb169('0x5')]][_0xb169('0x8')]=_0xb169('0x20');}};exports['queuecallerleave']=function(_0xf43e68){if(!_[_0xb169('0x13')](queues[_0xf43e68[_0xb169('0x5')]])){queues[_0xf43e68['uniqueid']][_0xb169('0x21')]=!![];queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x14')]=utils['now']();queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x22')]=utils['diffTime'](queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x14')],queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x23')]);queues[_0xf43e68[_0xb169('0x5')]]['position']=_0xf43e68[_0xb169('0x10')];queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x24')]=_0xf43e68[_0xb169('0x24')];queues[_0xf43e68[_0xb169('0x5')]][_0xb169('0x25')]=_0xf43e68[_0xb169('0x25')];queues[_0xf43e68['uniqueid']][_0xb169('0x26')]=_0xf43e68[_0xb169('0x26')];}};exports[_0xb169('0x27')]=function(_0x13e217){if(!_[_0xb169('0x13')](queues[_0x13e217['uniqueid']])){queues[_0x13e217[_0xb169('0x5')]]['queuecallerabandon']=![];queues[_0x13e217[_0xb169('0x5')]][_0xb169('0x15')]=![];queues[_0x13e217['uniqueid']][_0xb169('0x1e')]=null;queues[_0x13e217['uniqueid']][_0xb169('0x16')]=![];queues[_0x13e217[_0xb169('0x5')]]['queuecallerexitreason']=null;queues[_0x13e217['uniqueid']][_0xb169('0x1f')]=null;queues[_0x13e217[_0xb169('0x5')]][_0xb169('0x28')]=!![];queues[_0x13e217['uniqueid']][_0xb169('0x29')]=_0x13e217[_0xb169('0x2a')];queues[_0x13e217[_0xb169('0x5')]][_0xb169('0x2b')]=_0x13e217['membername'];}};exports[_0xb169('0x2c')]=function(_0x3c91fb){if(!_['isNil'](queues[_0x3c91fb[_0xb169('0x5')]])){if(queues[_0x3c91fb[_0xb169('0x5')]]['queuecallerleaveAt']){queues[_0x3c91fb[_0xb169('0x5')]]['queuecallerabandon']=![];queues[_0x3c91fb['uniqueid']][_0xb169('0x15')]=![];queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x1e')]=null;queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x16')]=![];queues[_0x3c91fb['uniqueid']][_0xb169('0x1f')]=null;queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x28')]=!![];queues[_0x3c91fb[_0xb169('0x5')]][_0xb169('0x2b')]=_0x3c91fb[_0xb169('0x2d')];queues[_0x3c91fb[_0xb169('0x5')]]['queuecallercomplete']=!![];queues[_0x3c91fb['uniqueid']][_0xb169('0x18')]=utils[_0xb169('0x11')]();if(_0x3c91fb[_0xb169('0x2e')]=='transfer'){if(!queues[_0x3c91fb['uniqueid']][_0xb169('0x2f')]){queues[_0x3c91fb['uniqueid']][_0xb169('0x8')]='TRANSFER';}}else{queues[_0x3c91fb['uniqueid']][_0xb169('0x8')]=_0xb169('0x30')+_0x3c91fb['reason'][_0xb169('0x1b')]();}writeDB(queues[_0x3c91fb['uniqueid']]);}}};exports[_0xb169('0x31')]=function(_0x121142){if(!_['isNil'](queues[_0x121142['transfereeuniqueid']])){queues[_0x121142[_0xb169('0x32')]][_0xb169('0x2f')]=!![];queues[_0x121142[_0xb169('0x32')]][_0xb169('0x33')]=_0xb169('0x34');queues[_0x121142[_0xb169('0x32')]][_0xb169('0x35')]=_0x121142[_0xb169('0x36')];queues[_0x121142['transfereeuniqueid']][_0xb169('0x37')]=_0x121142['transfereeuniqueid'];queues[_0x121142[_0xb169('0x32')]][_0xb169('0x8')]=_0xb169('0x38');}};exports['attendedtransfer']=function(_0x236adf){try{if(_0x236adf[_0xb169('0x39')]==_0x236adf[_0xb169('0x3a')]){if(!_[_0xb169('0x13')](queues[_0x236adf['secondtransfererlinkedid']])){queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x2f')]=!![];queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x33')]='ATTENDED';queues[_0x236adf['secondtransfererlinkedid']][_0xb169('0x35')]=_0x236adf['origtransfererexten'];queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x37')]=_0x236adf['origtransfereruniqueid'];queues[_0x236adf[_0xb169('0x3b')]]['queuecallerexitreason']=_0xb169('0x3c');}if(!_[_0xb169('0x13')](queues[_0x236adf[_0xb169('0x3a')]])){if(_0x236adf[_0xb169('0x3d')]&&queues[_0x236adf[_0xb169('0x3d')]]){queues[_0x236adf[_0xb169('0x3d')]][_0xb169('0x3e')]=0x1;queues[_0x236adf['transfereeuniqueid']]=_['clone'](queues[_0x236adf[_0xb169('0x3d')]]);queues[_0x236adf[_0xb169('0x32')]][_0xb169('0xd')]=_0x236adf[_0xb169('0x3f')];queues[_0x236adf['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x236adf['transfereeuniqueid']][_0xb169('0x7')]=queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x7')];queues[_0x236adf[_0xb169('0x32')]]['calleridname']=queues[_0x236adf[_0xb169('0x3b')]][_0xb169('0x40')];queues[_0x236adf['transfereeuniqueid']][_0xb169('0x23')]=utils[_0xb169('0x11')]();queues[_0x236adf[_0xb169('0x32')]][_0xb169('0x14')]=utils[_0xb169('0x11')]();queues[_0x236adf[_0xb169('0x32')]][_0xb169('0x22')]=0x0;queues[_0x236adf[_0xb169('0x32')]][_0xb169('0x41')]=0x0;}else{queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0xd')]=_0x236adf['secondtransfererlinkedid'];}}}else if(_0x236adf[_0xb169('0x42')]==_0x236adf[_0xb169('0x3b')]){if(!_['isNil'](queues[_0x236adf[_0xb169('0x3a')]])){queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x2f')]=!![];queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x33')]=_0xb169('0x43');queues[_0x236adf['origtransfererlinkedid']][_0xb169('0x35')]=_0x236adf[_0xb169('0x44')];queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x37')]=_0x236adf[_0xb169('0x42')];queues[_0x236adf[_0xb169('0x3a')]]['queuecallerexitreason']=_0xb169('0x3c');}if(!_[_0xb169('0x13')](queues[_0x236adf[_0xb169('0x3b')]])){if(_0x236adf['transfertargetlinkedid']&&queues[_0x236adf[_0xb169('0x45')]]){queues[_0x236adf[_0xb169('0x45')]]['queuecallerenterreason']=0x1;queues[_0x236adf[_0xb169('0x3f')]]=_[_0xb169('0x46')](queues[_0x236adf['transfertargetlinkedid']]);queues[_0x236adf[_0xb169('0x3f')]][_0xb169('0xd')]=_0x236adf[_0xb169('0x3f')];queues[_0x236adf[_0xb169('0x3f')]]['queuecallerenterreason']=0x2;queues[_0x236adf[_0xb169('0x3f')]][_0xb169('0x7')]=queues[_0x236adf[_0xb169('0x3a')]]['calleridnum'];queues[_0x236adf[_0xb169('0x3f')]]['calleridname']=queues[_0x236adf[_0xb169('0x3a')]][_0xb169('0x40')];queues[_0x236adf['transfertargetuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x236adf[_0xb169('0x3f')]][_0xb169('0x14')]=utils[_0xb169('0x11')]();queues[_0x236adf[_0xb169('0x3f')]]['holdtime']=0x0;queues[_0x236adf['transfertargetuniqueid']][_0xb169('0x41')]=0x0;}else{queues[_0x236adf[_0xb169('0x3b')]]['transfereduniqueid']=_0x236adf[_0xb169('0x3a')];}}}}catch(_0x2fc903){utils[_0xb169('0x47')](_0x2fc903[_0xb169('0x48')]);}};exports[_0xb169('0x49')]=function(_0x325344){if(!_[_0xb169('0x13')](queues[_0x325344[_0xb169('0x5')]])){queues[_0x325344['uniqueid']][_0xb169('0x4a')]=utils[_0xb169('0x11')]();}};exports[_0xb169('0x4b')]=function(_0x1045af){if(!_['isNil'](queues[_0x1045af['uniqueid']])){if(!_['isNil'](queues[_0x1045af['uniqueid']][_0xb169('0x4a')])){queues[_0x1045af[_0xb169('0x5')]]['mohtime']+=utils[_0xb169('0x4c')](utils[_0xb169('0x11')](),queues[_0x1045af['uniqueid']][_0xb169('0x4a')]);delete queues[_0x1045af['uniqueid']]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0x7366=['transfertype','ATTENDED','transferexten','transfereelinkedid','transfertargetuniqueid','calleridname','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','mohtime','error','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','position','now','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','ABANDONED','queuecallerleave','holdtime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','destaccountcode','membername','agentcomplete','lastAssignedTo','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','BLIND','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7366,0x192));var _0x6736=function(_0x10ed05,_0x6a2997){_0x10ed05=_0x10ed05-0x0;var _0x489ad4=_0x7366[_0x10ed05];return _0x489ad4;};'use strict';var _=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var utils=require(_0x6736('0x2'));var queues={};function writeDB(_0x4298a2){utils[_0x6736('0x3')](util[_0x6736('0x4')](_0x6736('0x5'),_0x4298a2[_0x6736('0x6')],_0x4298a2[_0x6736('0x7')],_0x4298a2['queue'],_0x4298a2['lastAssignedTo'],_0x4298a2[_0x6736('0x8')],_0x4298a2[_0x6736('0x9')],_0x4298a2[_0x6736('0xa')]));if(_0x4298a2[_0x6736('0xb')]){utils['getVoiceQueueByName'](_0x4298a2[_0x6736('0xb')])[_0x6736('0xc')](function(_0x232621){if(_0x232621){_0x4298a2[_0x6736('0xd')]=_0x232621['type'];}utils[_0x6736('0xe')](_0x6736('0xf'),_0x4298a2);});}else{utils['request'](_0x6736('0xf'),_0x4298a2);}if(_0x4298a2[_0x6736('0x10')]){delete queues[_0x4298a2[_0x6736('0x10')]];}else{delete queues[_0x4298a2[_0x6736('0x6')]];}}exports['queuecallerjoin']=function(_0x2179db){queues[_0x2179db[_0x6736('0x6')]]=_['assign'](_0x2179db,{'originalposition':_0x2179db[_0x6736('0x11')],'queuecallerjoinAt':utils[_0x6736('0x12')](),'mohtime':0x0});};exports[_0x6736('0x13')]=function(_0x37b2e0){if(!_[_0x6736('0x14')](queues[_0x37b2e0[_0x6736('0x6')]])){if(queues[_0x37b2e0[_0x6736('0x6')]]['queuecallerleaveAt']){if(!queues[_0x37b2e0['uniqueid']][_0x6736('0x15')]&&!queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x16')]){queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x17')]=!![];queues[_0x37b2e0['uniqueid']]['queuecallercompleteAt']=utils[_0x6736('0x12')]();queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0xa')]=_0x6736('0x18');}writeDB(queues[_0x37b2e0[_0x6736('0x6')]]);}else{if(queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x10')]){queues[queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x10')]]=queues[_0x37b2e0[_0x6736('0x6')]];queues[queues[_0x37b2e0[_0x6736('0x6')]][_0x6736('0x10')]][_0x6736('0x19')]=0x2;delete queues[_0x37b2e0['uniqueid']];}}}};exports['varset']=function(_0x2994d0){if(!_[_0x6736('0x14')](_0x2994d0[_0x6736('0x1a')][_0x6736('0x1b')])&&_0x2994d0[_0x6736('0x1c')][_0x6736('0x1d')]()!==_0x6736('0x1e')){if(!_[_0x6736('0x14')](queues[_0x2994d0['uniqueid']])){queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x2994d0[_0x6736('0x6')]]['queuecallerabandonAt']=null;queues[_0x2994d0['uniqueid']]['queuecallerexit']=!![];queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x1f')]=utils[_0x6736('0x12')]();queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0xa')]=_0x2994d0[_0x6736('0x1c')][_0x6736('0x1d')]();writeDB(queues[_0x2994d0[_0x6736('0x6')]]);}}else if(!_[_0x6736('0x14')](_0x2994d0['variable'][_0x6736('0x20')])){if(!_[_0x6736('0x14')](queues[_0x2994d0[_0x6736('0x6')]])&&!queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x15')]){queues[_0x2994d0['uniqueid']]['queuecallerabandon']=![];queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x21')]=null;queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0x16')]=!![];queues[_0x2994d0['uniqueid']][_0x6736('0x1f')]=utils[_0x6736('0x12')]();queues[_0x2994d0[_0x6736('0x6')]][_0x6736('0xa')]='EXITWITHKEY';}}};exports['queuecallerabandon']=function(_0x5831f6){if(!_['isNil'](queues[_0x5831f6[_0x6736('0x6')]])){queues[_0x5831f6['uniqueid']][_0x6736('0x16')]=![];queues[_0x5831f6[_0x6736('0x6')]][_0x6736('0x1f')]=null;queues[_0x5831f6[_0x6736('0x6')]][_0x6736('0x15')]=!![];queues[_0x5831f6[_0x6736('0x6')]]['queuecallerabandonAt']=utils[_0x6736('0x12')]();queues[_0x5831f6['uniqueid']][_0x6736('0xa')]=_0x6736('0x22');}};exports[_0x6736('0x23')]=function(_0x85bdf){if(!_[_0x6736('0x14')](queues[_0x85bdf[_0x6736('0x6')]])){queues[_0x85bdf['uniqueid']][_0x6736('0x23')]=!![];queues[_0x85bdf['uniqueid']]['queuecallerleaveAt']=utils[_0x6736('0x12')]();queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x24')]=utils['diffTime'](queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x25')],queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x26')]);queues[_0x85bdf['uniqueid']][_0x6736('0x11')]=_0x85bdf['position'];queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x27')]=_0x85bdf['count'];queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x28')]=_0x85bdf[_0x6736('0x28')];queues[_0x85bdf[_0x6736('0x6')]][_0x6736('0x29')]=_0x85bdf['connectedlinename'];}};exports['agentconnect']=function(_0x27cc61){if(!_[_0x6736('0x14')](queues[_0x27cc61[_0x6736('0x6')]])){queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x27cc61['uniqueid']][_0x6736('0x21')]=null;queues[_0x27cc61[_0x6736('0x6')]]['queuecallerexit']=![];queues[_0x27cc61[_0x6736('0x6')]]['queuecallerexitreason']=null;queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x1f')]=null;queues[_0x27cc61[_0x6736('0x6')]][_0x6736('0x2a')]=!![];queues[_0x27cc61['uniqueid']][_0x6736('0x9')]=_0x27cc61[_0x6736('0x2b')];queues[_0x27cc61[_0x6736('0x6')]]['lastAssignedTo']=_0x27cc61[_0x6736('0x2c')];}};exports[_0x6736('0x2d')]=function(_0x3fa0dc){if(!_[_0x6736('0x14')](queues[_0x3fa0dc[_0x6736('0x6')]])){if(queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x25')]){queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x15')]=![];queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x21')]=null;queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x16')]=![];queues[_0x3fa0dc[_0x6736('0x6')]]['queuecallerexitAt']=null;queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x2a')]=!![];queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x2e')]=_0x3fa0dc[_0x6736('0x2c')];queues[_0x3fa0dc['uniqueid']][_0x6736('0x17')]=!![];queues[_0x3fa0dc[_0x6736('0x6')]]['queuecallercompleteAt']=utils[_0x6736('0x12')]();if(_0x3fa0dc[_0x6736('0x2f')]=='transfer'){if(!queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0x30')]){queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0xa')]='TRANSFER';}}else{queues[_0x3fa0dc[_0x6736('0x6')]][_0x6736('0xa')]=_0x6736('0x31')+_0x3fa0dc[_0x6736('0x2f')][_0x6736('0x1d')]();}writeDB(queues[_0x3fa0dc[_0x6736('0x6')]]);}}};exports[_0x6736('0x32')]=function(_0x30e582){if(!_[_0x6736('0x14')](queues[_0x30e582[_0x6736('0x33')]])){queues[_0x30e582['transfereeuniqueid']][_0x6736('0x30')]=!![];queues[_0x30e582[_0x6736('0x33')]]['transfertype']=_0x6736('0x34');queues[_0x30e582[_0x6736('0x33')]]['transferexten']=_0x30e582[_0x6736('0x35')];queues[_0x30e582[_0x6736('0x33')]][_0x6736('0x36')]=_0x30e582[_0x6736('0x33')];queues[_0x30e582[_0x6736('0x33')]][_0x6736('0xa')]=_0x6736('0x37');}};exports[_0x6736('0x38')]=function(_0x34e414){try{if(_0x34e414[_0x6736('0x39')]==_0x34e414[_0x6736('0x3a')]){if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3b')]])){queues[_0x34e414[_0x6736('0x3b')]]['transfer']=!![];queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0x3c')]=_0x6736('0x3d');queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0x3e')]=_0x34e414['origtransfererexten'];queues[_0x34e414['secondtransfererlinkedid']][_0x6736('0x36')]=_0x34e414['origtransfereruniqueid'];queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3a')]])){if(_0x34e414['transfereelinkedid']&&queues[_0x34e414[_0x6736('0x3f')]]){queues[_0x34e414[_0x6736('0x3f')]]['queuecallerenterreason']=0x1;queues[_0x34e414[_0x6736('0x33')]]=_['clone'](queues[_0x34e414['transfereelinkedid']]);queues[_0x34e414['transfereeuniqueid']]['transfereduniqueid']=_0x34e414[_0x6736('0x40')];queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x19')]=0x2;queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x8')]=queues[_0x34e414[_0x6736('0x3b')]][_0x6736('0x8')];queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x41')]=queues[_0x34e414[_0x6736('0x3b')]]['calleridname'];queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x26')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x25')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x33')]][_0x6736('0x24')]=0x0;queues[_0x34e414[_0x6736('0x33')]]['mohtime']=0x0;}else{queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x10')]=_0x34e414[_0x6736('0x3b')];}}}else if(_0x34e414[_0x6736('0x42')]==_0x34e414['secondtransfererlinkedid']){if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3a')]])){queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x30')]=!![];queues[_0x34e414['origtransfererlinkedid']][_0x6736('0x3c')]='ATTENDED';queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x3e')]=_0x34e414[_0x6736('0x43')];queues[_0x34e414['origtransfererlinkedid']][_0x6736('0x36')]=_0x34e414[_0x6736('0x42')];queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0xa')]=_0x6736('0x44');}if(!_[_0x6736('0x14')](queues[_0x34e414[_0x6736('0x3b')]])){if(_0x34e414[_0x6736('0x45')]&&queues[_0x34e414['transfertargetlinkedid']]){queues[_0x34e414[_0x6736('0x45')]][_0x6736('0x19')]=0x1;queues[_0x34e414[_0x6736('0x40')]]=_[_0x6736('0x46')](queues[_0x34e414[_0x6736('0x45')]]);queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x10')]=_0x34e414[_0x6736('0x40')];queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x19')]=0x2;queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x8')]=queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x8')];queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x41')]=queues[_0x34e414[_0x6736('0x3a')]][_0x6736('0x41')];queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x26')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x25')]=utils[_0x6736('0x12')]();queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x24')]=0x0;queues[_0x34e414[_0x6736('0x40')]][_0x6736('0x47')]=0x0;}else{queues[_0x34e414[_0x6736('0x3b')]]['transfereduniqueid']=_0x34e414['origtransfererlinkedid'];}}}}catch(_0x441792){utils[_0x6736('0x48')](_0x441792[_0x6736('0x49')]);}};exports[_0x6736('0x4a')]=function(_0x3b5e41){if(!_['isNil'](queues[_0x3b5e41[_0x6736('0x6')]])){queues[_0x3b5e41['uniqueid']]['musiconholdstartAt']=utils[_0x6736('0x12')]();}};exports[_0x6736('0x4b')]=function(_0x125967){if(!_[_0x6736('0x14')](queues[_0x125967[_0x6736('0x6')]])){if(!_[_0x6736('0x14')](queues[_0x125967[_0x6736('0x6')]]['musiconholdstartAt'])){queues[_0x125967['uniqueid']][_0x6736('0x47')]+=utils['diffTime'](utils[_0x6736('0x12')](),queues[_0x125967[_0x6736('0x6')]]['musiconholdstartAt']);delete queues[_0x125967[_0x6736('0x6')]][_0x6736('0x4c')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 3d6474f..c4104b5 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x33314d,_0x499628){var _0x4ffe8e=function(_0xb1ec35){while(--_0xb1ec35){_0x33314d['push'](_0x33314d['shift']());}};_0x4ffe8e(++_0x499628);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e33d3,_0xa30c3){_0x3e33d3=_0x3e33d3-0x0;var _0x3ce611=_0xedd9[_0x3e33d3];return _0x3ce611;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file +var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x205ad8,_0x1c50ab){var _0x51f2b4=function(_0x398f25){while(--_0x398f25){_0x205ad8['push'](_0x205ad8['shift']());}};_0x51f2b4(++_0x1c50ab);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a09d6,_0x907173){_0x5a09d6=_0x5a09d6-0x0;var _0x339dff=_0xedd9[_0x5a09d6];return _0x339dff;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1880bc2..b4dc64e 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 _0xc57c=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0x2083ad,_0x1bbf3d){var _0x178293=function(_0x957979){while(--_0x957979){_0x2083ad['push'](_0x2083ad['shift']());}};_0x178293(++_0x1bbf3d);}(_0xc57c,0x9f));var _0xcc57=function(_0x111eaa,_0x51ad9e){_0x111eaa=_0x111eaa-0x0;var _0x5e0792=_0xc57c[_0x111eaa];return _0x5e0792;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var utils=require(_0xcc57('0x1'));function writeDB(_0x44420c){utils[_0xcc57('0x2')](util[_0xcc57('0x3')](_0xcc57('0x4'),_0x44420c[_0xcc57('0x5')]));utils[_0xcc57('0x6')](_0xcc57('0x7'),_0x44420c);}exports[_0xcc57('0x8')]=function(_0x47e843){try{_0x47e843[_0xcc57('0x5')]=_0xcc57('0x9');writeDB(_0x47e843);}catch(_0x49138a){utils[_0xcc57('0xa')](_0x49138a[_0xcc57('0xb')]);}};exports[_0xcc57('0xc')]=function(_0x4e3395){try{_0x4e3395=_[_0xcc57('0xd')](_0x4e3395,{'transfererchannel':_0x4e3395[_0xcc57('0xe')],'transferercalleridnum':_0x4e3395[_0xcc57('0xf')],'transferercalleridname':_0x4e3395[_0xcc57('0x10')],'transfererconnectedlinenum':_0x4e3395[_0xcc57('0x11')],'transfererconnectedlinename':_0x4e3395[_0xcc57('0x12')],'transfereraccountcode':_0x4e3395[_0xcc57('0x13')],'transferercontext':_0x4e3395['secondtransferercontext'],'transfererexten':_0x4e3395[_0xcc57('0x14')],'transfererlinkedid':_0x4e3395[_0xcc57('0x15')],'context':_0x4e3395[_0xcc57('0x16')],'extension':_0x4e3395[_0xcc57('0x17')],'type':_0xcc57('0x18')});if(_[_0xcc57('0x19')](_0x4e3395[_0xcc57('0x1a')])){_0x4e3395=_['assign'](_0x4e3395,{'transfereechannel':_0x4e3395[_0xcc57('0x1b')],'transfereecalleridnum':_0x4e3395[_0xcc57('0x1c')],'transfereecalleridname':_0x4e3395[_0xcc57('0x1d')],'transfereeconnectedlinenum':_0x4e3395[_0xcc57('0x1e')],'transfereeconnectedlinename':_0x4e3395[_0xcc57('0x1f')],'transfereeaccountcode':_0x4e3395[_0xcc57('0x20')],'transfereecontext':_0x4e3395[_0xcc57('0x21')],'transfereeexten':_0x4e3395['transfertargetexten'],'transfereelinkedid':_0x4e3395[_0xcc57('0x22')]});}writeDB(_0x4e3395);}catch(_0x75a5f4){utils[_0xcc57('0xa')](_0x75a5f4[_0xcc57('0xb')]);}}; \ No newline at end of file +var _0xe77f=['origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','info','TRANSFER|%s','type','CreateVoiceTransferReport','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x5d8e11,_0x1b2574){var _0x25fa53=function(_0x5376ce){while(--_0x5376ce){_0x5d8e11['push'](_0x5d8e11['shift']());}};_0x25fa53(++_0x1b2574);}(_0xe77f,0xba));var _0xfe77=function(_0x309725,_0x593bc7){_0x309725=_0x309725-0x0;var _0x2d9d03=_0xe77f[_0x309725];return _0x2d9d03;};'use strict';var _=require(_0xfe77('0x0'));var util=require(_0xfe77('0x1'));var utils=require('./utils');function writeDB(_0x397a5c){utils[_0xfe77('0x2')](util['format'](_0xfe77('0x3'),_0x397a5c[_0xfe77('0x4')]));utils['request'](_0xfe77('0x5'),_0x397a5c);}exports[_0xfe77('0x6')]=function(_0xaad04a){try{_0xaad04a[_0xfe77('0x4')]=_0xfe77('0x7');writeDB(_0xaad04a);}catch(_0x51d137){utils['error'](_0x51d137[_0xfe77('0x8')]);}};exports[_0xfe77('0x9')]=function(_0x1bb5e0){try{_0x1bb5e0=_[_0xfe77('0xa')](_0x1bb5e0,{'transfererchannel':_0x1bb5e0[_0xfe77('0xb')],'transferercalleridnum':_0x1bb5e0[_0xfe77('0xc')],'transferercalleridname':_0x1bb5e0['origtransferercalleridname'],'transfererconnectedlinenum':_0x1bb5e0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1bb5e0[_0xfe77('0xd')],'transfereraccountcode':_0x1bb5e0[_0xfe77('0xe')],'transferercontext':_0x1bb5e0[_0xfe77('0xf')],'transfererexten':_0x1bb5e0[_0xfe77('0x10')],'transfererlinkedid':_0x1bb5e0['origtransfererlinkedid'],'context':_0x1bb5e0[_0xfe77('0x11')],'extension':_0x1bb5e0[_0xfe77('0x12')],'type':_0xfe77('0x13')});if(_[_0xfe77('0x14')](_0x1bb5e0['transfereechannel'])){_0x1bb5e0=_[_0xfe77('0xa')](_0x1bb5e0,{'transfereechannel':_0x1bb5e0[_0xfe77('0x15')],'transfereecalleridnum':_0x1bb5e0[_0xfe77('0x16')],'transfereecalleridname':_0x1bb5e0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1bb5e0[_0xfe77('0x17')],'transfereeconnectedlinename':_0x1bb5e0[_0xfe77('0x18')],'transfereeaccountcode':_0x1bb5e0['transfertargetaccountcode'],'transfereecontext':_0x1bb5e0[_0xfe77('0x19')],'transfereeexten':_0x1bb5e0[_0xfe77('0x1a')],'transfereelinkedid':_0x1bb5e0[_0xfe77('0x1b')]});}writeDB(_0x1bb5e0);}catch(_0x28366f){utils[_0xfe77('0x1c')](_0x28366f[_0xfe77('0x8')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b69fe85..85c5306 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 _0x9314=['length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','stack','request','then','catch','error','internal','name','interface','GETUSER|','result','FOUND','NOTFOUND'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0x9314,0x17a));var _0x4931=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9314[_0x1694f5];return _0x5b4321;};'use strict';var jayson=require(_0x4931('0x0'));var moment=require(_0x4931('0x1'));var BPromise=require(_0x4931('0x2'));var client=jayson[_0x4931('0x3')][_0x4931('0x4')]({'port':0x2329});var logger=require(_0x4931('0x5'))(_0x4931('0x6'));exports[_0x4931('0x7')]=function(_0xd90e0b){logger['info'](_0xd90e0b);};exports[_0x4931('0x8')]=function(_0x50deb6){logger[_0x4931('0x8')](JSON[_0x4931('0x9')](_0x50deb6));};exports['error']=function(_0x3b6669){logger['error'](_0x3b6669[_0x4931('0xa')]);};exports[_0x4931('0xb')]=function(_0x2e31f3,_0x239974){return client[_0x4931('0xb')](_0x2e31f3,{'body':_0x239974})[_0x4931('0xc')](function(_0x7c6d86){logger[_0x4931('0x8')](JSON[_0x4931('0x9')](_0x7c6d86));})[_0x4931('0xd')](function(_0x223061){logger[_0x4931('0xe')](_0x223061[_0x4931('0xa')]);});};function getUser(_0x3abc6c){return client[_0x4931('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x4931('0xf'),_0x4931('0x10'),_0x4931('0x11')],'where':_0x3abc6c,'limit':0x1}})[_0x4931('0xc')](function(_0x590c2a){logger[_0x4931('0x7')](_0x4931('0x12')+JSON['stringify'](_0x3abc6c)+'|'+(_0x590c2a[_0x4931('0x13')]['length']?_0x4931('0x14'):_0x4931('0x15')));return _0x590c2a['result'][_0x4931('0x16')]?_0x590c2a[_0x4931('0x13')][0x0]:null;});}exports[_0x4931('0x17')]=function(_0x4cdf36){return new BPromise(function(_0x1f9374,_0x1ed906){if(_0x4cdf36){return getUser({'internal':_0x4cdf36})['then'](function(_0x3281b9){return _0x1f9374(_0x3281b9);})[_0x4931('0xd')](function(_0x76e77b){logger[_0x4931('0xe')](_0x76e77b['stack']);return _0x1f9374(null);});}else{return _0x1f9374(null);}});};exports[_0x4931('0x18')]=function(_0x5180e2){return new BPromise(function(_0x17970c,_0x1acb26){if(_0x5180e2){return getUser({'interface':_0x5180e2})[_0x4931('0xc')](function(_0x4ca2b5){return _0x17970c(_0x4ca2b5);})[_0x4931('0xd')](function(_0xfc1919){logger[_0x4931('0xe')](_0xfc1919[_0x4931('0xa')]);return _0x17970c(null);});}else{return _0x17970c(null);}});};exports[_0x4931('0x19')]=function(_0x370fe3){return new BPromise(function(_0x4113b9,_0x57ef66){if(_0x370fe3){return getUser({'name':_0x370fe3})[_0x4931('0xc')](function(_0x380708){return _0x4113b9(_0x380708);})['catch'](function(_0x494fb4){logger[_0x4931('0xe')](_0x494fb4[_0x4931('0xa')]);return _0x4113b9(null);});}else{return _0x4113b9(null);}});};exports[_0x4931('0x1a')]=function(_0x1400ab){return new BPromise(function(_0x3be144,_0x3d8a24){if(_0x1400ab){return client[_0x4931('0xb')](_0x4931('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x4931('0x10'),'type',_0x4931('0x1c'),_0x4931('0x1d')],'where':{'name':_0x1400ab},'limit':0x1}})[_0x4931('0xc')](function(_0x52a492){logger[_0x4931('0x7')]('GETVOICEQUEUEBYNAME|'+_0x1400ab+'|'+(_0x52a492['result']['length']?'FOUND':'NOTFOUND'));return _0x3be144(_0x52a492[_0x4931('0x13')]['length']?_0x52a492[_0x4931('0x13')][0x0]:null);})['catch'](function(_0x407556){logger[_0x4931('0xe')](_0x407556['stack']);return _0x3be144(null);});}else{return _0x3be144(null);}});};exports[_0x4931('0x1e')]=function(_0x23c92a,_0x3ae889){return moment(_0x23c92a)['add'](_0x3ae889,'seconds')[_0x4931('0x1f')](_0x4931('0x20'));};exports[_0x4931('0x21')]=function(_0x1730c2,_0x50a8df){return moment(_0x1730c2)[_0x4931('0x22')](_0x50a8df,_0x4931('0x23'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0xf07319,_0x45e6c8){return moment(_0xf07319)[_0x4931('0x24')](moment(_0x45e6c8),'seconds');};exports[_0x4931('0x25')]=function(_0x51dfd3,_0x765ecb){return parseInt(_0x51dfd3,0xa)+parseInt(_0x765ecb,0xa);};exports['now']=function(){return moment()[_0x4931('0x1f')](_0x4931('0x20'));};exports['isAfter']=function(_0x265b1c,_0x1ab361){if(_0x1ab361){return moment(_0x265b1c)[_0x4931('0x26')](_0x1ab361);}else{return!![];}};exports['isBefore']=function(_0x1e6921,_0x569e31){if(_0x569e31){return moment(_0x1e6921)[_0x4931('0x27')](_0x569e31);}else if(_0x1e6921){return!![];}else{return![];}}; \ No newline at end of file +var _0xd478=['YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','debug','error','stack','request','GetUser','internal','then','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','catch','getUserByName','GetVoiceQueue','name','type','acw','acwTimeout','info','GETVOICEQUEUEBYNAME|','add','seconds','subtract','format'];(function(_0x54cfaf,_0x59f305){var _0x4e80e3=function(_0x4ee6b7){while(--_0x4ee6b7){_0x54cfaf['push'](_0x54cfaf['shift']());}};_0x4e80e3(++_0x59f305);}(_0xd478,0x117));var _0x8d47=function(_0x3e0e6c,_0x4757cd){_0x3e0e6c=_0x3e0e6c-0x0;var _0xad2be9=_0xd478[_0x3e0e6c];return _0xad2be9;};'use strict';var jayson=require(_0x8d47('0x0'));var moment=require(_0x8d47('0x1'));var BPromise=require(_0x8d47('0x2'));var client=jayson[_0x8d47('0x3')][_0x8d47('0x4')]({'port':0x2329});var logger=require(_0x8d47('0x5'))(_0x8d47('0x6'));exports['info']=function(_0x36fbb6){logger['info'](_0x36fbb6);};exports[_0x8d47('0x7')]=function(_0xe64b35){logger['debug'](JSON['stringify'](_0xe64b35));};exports[_0x8d47('0x8')]=function(_0x5e4f39){logger[_0x8d47('0x8')](_0x5e4f39[_0x8d47('0x9')]);};exports[_0x8d47('0xa')]=function(_0x41c839,_0x2bfd00){return client['request'](_0x41c839,{'body':_0x2bfd00})['then'](function(_0x4a6daa){logger[_0x8d47('0x7')](JSON['stringify'](_0x4a6daa));})['catch'](function(_0x12809c){logger[_0x8d47('0x8')](_0x12809c[_0x8d47('0x9')]);});};function getUser(_0x54df75){return client[_0x8d47('0xa')](_0x8d47('0xb'),{'options':{'raw':!![],'attributes':['id',_0x8d47('0xc'),'name','interface'],'where':_0x54df75,'limit':0x1}})[_0x8d47('0xd')](function(_0x5ac908){logger['info']('GETUSER|'+JSON['stringify'](_0x54df75)+'|'+(_0x5ac908[_0x8d47('0xe')][_0x8d47('0xf')]?_0x8d47('0x10'):_0x8d47('0x11')));return _0x5ac908[_0x8d47('0xe')][_0x8d47('0xf')]?_0x5ac908['result'][0x0]:null;});}exports[_0x8d47('0x12')]=function(_0x27c7a9){return new BPromise(function(_0x5778ee,_0x35fae8){if(_0x27c7a9){return getUser({'internal':_0x27c7a9})[_0x8d47('0xd')](function(_0x15164e){return _0x5778ee(_0x15164e);})['catch'](function(_0x2db9ca){logger['error'](_0x2db9ca[_0x8d47('0x9')]);return _0x5778ee(null);});}else{return _0x5778ee(null);}});};exports[_0x8d47('0x13')]=function(_0x3d438b){return new BPromise(function(_0x1f21e2,_0x364061){if(_0x3d438b){return getUser({'interface':_0x3d438b})[_0x8d47('0xd')](function(_0x4b7967){return _0x1f21e2(_0x4b7967);})[_0x8d47('0x14')](function(_0xb50576){logger['error'](_0xb50576[_0x8d47('0x9')]);return _0x1f21e2(null);});}else{return _0x1f21e2(null);}});};exports[_0x8d47('0x15')]=function(_0x54246b){return new BPromise(function(_0xaf4b61,_0x25303b){if(_0x54246b){return getUser({'name':_0x54246b})[_0x8d47('0xd')](function(_0x455a18){return _0xaf4b61(_0x455a18);})[_0x8d47('0x14')](function(_0x322269){logger[_0x8d47('0x8')](_0x322269[_0x8d47('0x9')]);return _0xaf4b61(null);});}else{return _0xaf4b61(null);}});};exports['getVoiceQueueByName']=function(_0x407acf){return new BPromise(function(_0x5d90ce,_0x170d84){if(_0x407acf){return client[_0x8d47('0xa')](_0x8d47('0x16'),{'options':{'raw':!![],'attributes':['id',_0x8d47('0x17'),_0x8d47('0x18'),_0x8d47('0x19'),_0x8d47('0x1a')],'where':{'name':_0x407acf},'limit':0x1}})[_0x8d47('0xd')](function(_0x3e0afb){logger[_0x8d47('0x1b')](_0x8d47('0x1c')+_0x407acf+'|'+(_0x3e0afb['result'][_0x8d47('0xf')]?_0x8d47('0x10'):'NOTFOUND'));return _0x5d90ce(_0x3e0afb[_0x8d47('0xe')][_0x8d47('0xf')]?_0x3e0afb[_0x8d47('0xe')][0x0]:null);})[_0x8d47('0x14')](function(_0x27397e){logger[_0x8d47('0x8')](_0x27397e[_0x8d47('0x9')]);return _0x5d90ce(null);});}else{return _0x5d90ce(null);}});};exports['addTime']=function(_0x51db81,_0x202764){return moment(_0x51db81)[_0x8d47('0x1d')](_0x202764,_0x8d47('0x1e'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x579fc4,_0xce4508){return moment(_0x579fc4)[_0x8d47('0x1f')](_0xce4508,'seconds')[_0x8d47('0x20')](_0x8d47('0x21'));};exports[_0x8d47('0x22')]=function(_0x17f6fd,_0x568140){return moment(_0x17f6fd)['diff'](moment(_0x568140),_0x8d47('0x1e'));};exports[_0x8d47('0x23')]=function(_0x1d25ae,_0x3428fb){return parseInt(_0x1d25ae,0xa)+parseInt(_0x3428fb,0xa);};exports[_0x8d47('0x24')]=function(){return moment()[_0x8d47('0x20')](_0x8d47('0x21'));};exports[_0x8d47('0x25')]=function(_0x1003dd,_0x557a09){if(_0x557a09){return moment(_0x1003dd)[_0x8d47('0x25')](_0x557a09);}else{return!![];}};exports['isBefore']=function(_0x3eac41,_0x348eac){if(_0x348eac){return moment(_0x3eac41)[_0x8d47('0x26')](_0x348eac);}else if(_0x3eac41){return!![];}else{return![];}}; \ No newline at end of file